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

Commit 4bc32519 authored by Romain Hunault's avatar Romain Hunault
Browse files

Add submenu for contributors

parent 8a1ce10c
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -7963,4 +7963,7 @@
    <string name="micro_g">MicroG</string>
    <string name="micro_g_title">Access to MicroG settings</string>
    <string name="e_contributors_title">/e/ contributors</string>
    <string name="lineageos_contributors_title">LineageOS contributors</string>
</resources>
+16 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>

<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
    android:title="@string/contributors_title">

    <!-- LineageOS Contributors (cloud) -->
    <org.cyanogenmod.internal.cmparts.CMPartsPreference
            android:key="contributors"
            android:title="lineageos_contributors_title" />

    <!-- /e/ Contributors (web) -->
    <PreferenceScreen
        android:key="e_contributors"
        android:title="@string/e_contributors_title" />

</PreferenceScreen>
+6 −3
Original line number Diff line number Diff line
@@ -82,9 +82,12 @@
                android:title="@string/device_feedback">
        </PreferenceScreen>

        <!-- Contributors cloud -->
        <org.cyanogenmod.internal.cmparts.CMPartsPreference
                android:key="contributors" />
        <!-- Feedback on the device -->
        <PreferenceScreen
                android:key="contributors_page"
                android:title="@string/contributors_title"
                android:fragment="com.android.settings.Contributors" >
        </PreferenceScreen>

        <!-- Device name -->
        <Preference android:key="device_name"
+42 −0
Original line number Diff line number Diff line
package com.android.settings;

import android.content.Intent;
import android.app.Activity;
import android.net.Uri;
import android.util.Log;
import android.os.Bundle;
import android.support.v7.preference.Preference;
import android.support.v7.preference.PreferenceGroup;
import com.android.internal.logging.MetricsProto.MetricsEvent;

public class Contributors extends SettingsPreferenceFragment {

    private static final String LOG_TAG = "Contributors";
    private static final String URL_E_CONTRIBUTORS = "https://e.foundation/support-us/#halloffame";
    private static final String KEY_E_CONTRIBUTORS = "e_contributors";

    public void onCreate(Bundle icicle) {
        super.onCreate(icicle);
        addPreferencesFromResource(R.xml.contributors);
    }

    @Override
    protected int getMetricsCategory() {
        return MetricsEvent.CONTRIBUTORS;
    }

    @Override
    public boolean onPreferenceTreeClick(Preference preference) {
        if (preference.getKey().equals(KEY_E_CONTRIBUTORS)) {
            final Intent intent = new Intent(Intent.ACTION_VIEW);
            intent.addCategory(Intent.CATEGORY_DEFAULT);
            intent.setData(Uri.parse(URL_E_CONTRIBUTORS));
            try {
                startActivity(intent);
            } catch (Exception e) {
                Log.e(LOG_TAG, "Unable to start activity " + intent.toString());
            }
        }
        return super.onPreferenceTreeClick(preference);
    }
}