Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0a7d372b authored by Romain Hunault's avatar Romain Hunault
Browse files

Add /e/ legal informations

parent fe0b2086
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -9061,4 +9061,5 @@
    <string name="e_contributors_title">/e/ contributors</string>
    <string name="lineageos_contributors_title">LineageOS contributors</string>
    <string name="microg_title">MicroG settings</string>
    <string name="elicense_title">/e/ legal</string>
</resources>
+6 −1
Original line number Diff line number Diff line
@@ -37,6 +37,12 @@
        <intent android:action="android.settings.LICENSE"/>
    </Preference>


    <!-- eFoundation License information -->
    <PreferenceScreen
        android:key="elicense"
        android:title="@string/elicense_title" />
        
    <!-- Lineage License information -->
    <PreferenceScreen
        android:key="lineagelicense"
@@ -65,4 +71,3 @@
-->

</PreferenceScreen>
+17 −3
Original line number Diff line number Diff line
@@ -50,7 +50,9 @@ public class LegalSettings extends SettingsPreferenceFragment implements Indexab
    private static final String KEY_WALLPAPER_ATTRIBUTIONS = "wallpaper_attributions";
*/
    private static final String PROPERTY_LINEAGELICENSE_URL = "ro.lineagelegal.url";
    private static final String PROPERTY_ELICENSE_URL = "ro.elegal.url";
    private static final String KEY_LINEAGE_LICENSE = "lineagelicense";
    private static final String KEY_E_LICENSE = "elicense";

    public void onCreate(Bundle icicle) {
        super.onCreate(icicle);
@@ -71,11 +73,23 @@ public class LegalSettings extends SettingsPreferenceFragment implements Indexab

    @Override
    public boolean onPreferenceTreeClick(Preference preference) {
        if (preference.getKey().equals(KEY_LINEAGE_LICENSE)) {
            String userLineageLicenseUrl = SystemProperties.get(PROPERTY_LINEAGELICENSE_URL);

        boolean clickOnELicense = preference.getKey().equals(KEY_E_LICENSE);
        boolean clickOnLineageLicense = preference.getKey().equals(KEY_LINEAGE_LICENSE);

        if (clickOnELicense || clickOnLineageLicense) {

            String userLicenseUrl = "";

            if (clickOnELicense) {
                userLicenseUrl = SystemProperties.get(PROPERTY_ELICENSE_URL);
            } else if (clickOnLineageLicense) {
                userLicenseUrl = SystemProperties.get(PROPERTY_LINEAGELICENSE_URL);
            }

            final Intent intent = new Intent(Intent.ACTION_VIEW);
            intent.addCategory(Intent.CATEGORY_DEFAULT);
            intent.setData(Uri.parse(userLineageLicenseUrl));
            intent.setData(Uri.parse(userLicenseUrl));
            try {
                startActivity(intent);
            } catch (Exception e) {