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

Commit a16a79f6 authored by Mohit Mali's avatar Mohit Mali Committed by Nishith Khanna
Browse files

Contacts: about: Add license, authors, and contact information

parent b8e6964a
Loading
Loading
Loading
Loading
+33 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2006 The Android Open Source Project

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
-->
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
    <!-- About App -->
    <string name="preferences_about_app">Contacts is forked from LineageOS Contacts</string>

    <!-- Authors -->
    <string name="preferences_authors">Authors</string>

    <!-- Source Code-->
    <string name="preferences_source_code">Source code</string>

    <!-- License -->
    <string name="preferences_licence">Licence</string>

    <!-- Contact Information -->
    <string name="preferences_app_info_title">Contacts information</string>
    <string name="preferences_app_info">Contacts is an open source App for Android</string>

</resources>
+26 −0
Original line number Diff line number Diff line
@@ -15,11 +15,37 @@
-->

<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
    <Preference
            android:icon="@null"
            android:key="contacts_info"
            android:summary="@string/preferences_app_info"
            android:title="@string/preferences_app_info_title" />

    <Preference
            android:icon="@null"
            android:key="@string/pref_build_version_key"
            android:title="@string/about_build_version"/>

    <Preference
            android:icon="@null"
            android:key="about_app"
            android:title="@string/preferences_about_app" />

    <Preference
            android:icon="@null"
            android:key="license"
            android:title="@string/preferences_licence" />

    <Preference
            android:icon="@null"
            android:key="authors"
            android:title="@string/preferences_authors" />

    <Preference
            android:icon="@null"
            android:key="source_code"
            android:title="@string/preferences_source_code" />

    <Preference
            android:icon="@null"
            android:key="@string/pref_open_source_licenses_key"
+31 −6
Original line number Diff line number Diff line
@@ -35,8 +35,13 @@ import com.android.contacts.activities.LicenseActivity;
 */
public class AboutPreferenceFragment extends PreferenceFragment {

    public static final String PRIVACY_POLICY_URL = "http://www.google.com/policies/privacy";
    public static final String TERMS_OF_SERVICE_URL = "http://www.google.com/policies/terms";
    public static final String BUILD_VERSION_URL = "https://gitlab.e.foundation/e/os/android_packages_apps_Contacts/-/releases";
    public static final String ABOUT_APP_URL = "https://github.com/LineageOS/android_packages_apps_Contacts";
    public static final String LICENSE_URL = "https://gitlab.e.foundation/e/os/android_packages_apps_Contacts/-/blob/v1-r/NOTICE";
    public static final String AUTHORS_URL = "https://gitlab.e.foundation/e/os/android_packages_apps_Contacts";
    public static final String SOURCE_CODE_URL = "https://gitlab.e.foundation/e/os/android_packages_apps_Contacts";
    public static final String PRIVACY_POLICY_URL = "https://e.foundation/legal-notice-privacy/";
    public static final String TERMS_OF_SERVICE_URL = "https://e.foundation/legal-notice-privacy/";

    public static AboutPreferenceFragment newInstance() {
        return new AboutPreferenceFragment();
@@ -60,12 +65,14 @@ public class AboutPreferenceFragment extends PreferenceFragment {
            // Nothing
        }

        final Preference licensePreference = findPreference(
                getString(R.string.pref_open_source_licenses_key));
        licensePreference.setIntent(new Intent(getActivity(), LicenseActivity.class));

        final Preference buildVersionPreference = findPreference("pref_build_version");
        final Preference aboutAppPreference = findPreference("about_app");
        final Preference licensePreference = findPreference("license");
        final Preference authorsPreference = findPreference("authors");
        final Preference sourceCodePreference = findPreference("source_code");
        final Preference privacyPolicyPreference = findPreference("pref_privacy_policy");
        final Preference termsOfServicePreference = findPreference("pref_terms_of_service");
        final Preference openSourceLicensePreference = findPreference(getString(R.string.pref_open_source_licenses_key));

        final Preference.OnPreferenceClickListener listener =
                new Preference.OnPreferenceClickListener() {
@@ -76,6 +83,18 @@ public class AboutPreferenceFragment extends PreferenceFragment {
                        startActivityForUrl(PRIVACY_POLICY_URL);
                    } else if (preference == termsOfServicePreference) {
                        startActivityForUrl(TERMS_OF_SERVICE_URL);
                    } else if (preference == buildVersionPreference) {
                        startActivityForUrl(BUILD_VERSION_URL);
                    } else if (preference == aboutAppPreference) {
                        startActivityForUrl(ABOUT_APP_URL);
                    } else if (preference == licensePreference) {
                        startActivityForUrl(LICENSE_URL);
                    } else if (preference == authorsPreference) {
                        startActivityForUrl(AUTHORS_URL);
                    } else if (preference == sourceCodePreference) {
                        startActivityForUrl(SOURCE_CODE_URL);
                    } else if (preference == openSourceLicensePreference) {
                        startActivity(new Intent(getActivity(), LicenseActivity.class));
                    }
                } catch (ActivityNotFoundException ex) {
                    Toast.makeText(getContext(), getString(R.string.url_open_error_toast),
@@ -85,6 +104,12 @@ public class AboutPreferenceFragment extends PreferenceFragment {
            }
        };

        buildVersionPreference.setOnPreferenceClickListener(listener);
        aboutAppPreference.setOnPreferenceClickListener(listener);
        licensePreference.setOnPreferenceClickListener(listener);
        authorsPreference.setOnPreferenceClickListener(listener);
        sourceCodePreference.setOnPreferenceClickListener(listener);
        openSourceLicensePreference.setOnPreferenceClickListener(listener);
        privacyPolicyPreference.setOnPreferenceClickListener(listener);
        termsOfServicePreference.setOnPreferenceClickListener(listener);
    }