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

Commit fc68e846 authored by Romain Hunault's avatar Romain Hunault
Browse files

Add /e/ legal informations

parent e41f95d8
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -7966,4 +7966,6 @@
    <string name="e_contributors_title">/e/ contributors</string>
    <string name="lineageos_contributors_title">LineageOS contributors</string>
    <string name="elicense_title">/e/ legal</string>
</resources>
+5 −1
Original line number Diff line number Diff line
@@ -36,6 +36,11 @@
        <intent android:action="android.settings.LICENSE" />
    </PreferenceScreen>

    <!-- eFoundation License information -->
    <PreferenceScreen
        android:key="elicense"
        android:title="@string/elicense_title" />

    <!-- CM License information -->
    <PreferenceScreen
        android:key="cmlicense"
@@ -56,4 +61,3 @@
    </PreferenceScreen>

</PreferenceScreen>
+17 −3
Original line number Diff line number Diff line
@@ -47,7 +47,9 @@ public class LegalSettings extends SettingsPreferenceFragment implements Indexab
    private static final String KEY_COPYRIGHT = "copyright";
    private static final String KEY_WEBVIEW_LICENSE = "webview_license";
    private static final String PROPERTY_CMLICENSE_URL = "ro.cmlegal.url";
    private static final String PROPERTY_ELICENSE_URL = "ro.elegal.url";
    private static final String KEY_CM_LICENSE = "cmlicense";
    private static final String KEY_E_LICENSE = "elicense";

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

    @Override
    public boolean onPreferenceTreeClick(Preference preference) {
        if (preference.getKey().equals(KEY_CM_LICENSE)) {
            String userCMLicenseUrl = SystemProperties.get(PROPERTY_CMLICENSE_URL);

        boolean clickOnELicense = preference.getKey().equals(KEY_E_LICENSE);
        boolean clickOnCMLicense = preference.getKey().equals(KEY_CM_LICENSE);

        if (clickOnELicense || clickOnCMLicense) {

            String userLicenseUrl = "";

            if (clickOnELicense) {
                userLicenseUrl = SystemProperties.get(PROPERTY_ELICENSE_URL);
            } else if (clickOnCMLicense) {
                userLicenseUrl = SystemProperties.get(PROPERTY_CMLICENSE_URL);
            }

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