Commit 0f830266 authored by Romain Hunault's avatar Romain Hunault

Add OpenKeychain in Settings

parent e48b70c7
......@@ -3231,5 +3231,24 @@
</activity>
<activity android:name="Settings$OpenKeychainActivity"
android:label="@string/open_keychain"
android:icon="@drawable/ic_openkeychain_settings">
<intent-filter android:priority="1">
<action android:name="android.settings.OPENKEYCHAIN_SETTINGS" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<intent-filter android:priority="6">
<action android:name="com.android.settings.action.SETTINGS" />
</intent-filter>
<meta-data android:name="com.android.settings.category"
android:value="com.android.settings.category.personal" />
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
android:value="com.android.settings.OpenKeychainSettings" />
</activity>
</application>
</manifest>
......@@ -7961,6 +7961,7 @@
<string name="touchscreen_gesture_settings_summary">Perform various touchscreen gestures for quick actions</string>
<string name="micro_g">MicroG</string>
<string name="open_keychain">OpenKeychain</string>
<string name="e_contributors_title">/e/ contributors</string>
<string name="e_supporters_title">/e/ supporters</string>
......
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:settings="http://schemas.android.com/apk/res/com.android.settings"
android:key="open_keychain_settings"
android:title="@string/open_keychain">
<Preference>
<intent android:action="android.intent.action.MAIN"
android:targetPackage="org.sufficientlysecure.keychain"
android:targetClass="org.sufficientlysecure.keychain.ui.MainActivity" />
</Preference>
</PreferenceScreen>
package com.android.settings;
import android.os.Bundle;
import android.content.Intent;
import android.content.ComponentName;
import android.app.Fragment;
import android.app.Activity;
import android.app.Activity;
import android.content.Context;
import android.provider.SearchIndexableResource;
import com.android.settings.R;
import com.android.settings.search.BaseSearchIndexProvider;
import com.android.settings.search.Indexable;
import java.util.ArrayList;
import java.util.List;
public class OpenKeychainSettings extends Fragment {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Intent intent = new Intent("android.intent.action.MAIN");
intent.setComponent(new ComponentName("org.sufficientlysecure.keychain", "org.sufficientlysecure.keychain.ui.MainActivity"));
startActivity(intent);
Activity activity = getActivity();
if (activity != null) {
activity.finish();
}
}
public static final Indexable.SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
new BaseSearchIndexProvider() {
@Override
public List<SearchIndexableResource> getXmlResourcesToIndex(Context context,
boolean enabled) {
final ArrayList<SearchIndexableResource> result = new ArrayList<>();
final SearchIndexableResource sir = new SearchIndexableResource(context);
sir.xmlResId = R.xml.open_keychain_prefs;
result.add(sir);
return result;
}
};
}
......@@ -157,6 +157,7 @@ public class Settings extends SettingsActivity {
public static class WifiAPITestActivity extends SettingsActivity { /* empty */ }
public static class WifiInfoActivity extends SettingsActivity { /* empty */ }
public static class MicroGActivity extends SettingsActivity { /* empty */ }
public static class OpenKeychainActivity extends SettingsActivity { /* empty */ }
// Categories.
public static class WirelessSettings extends SettingsActivity { /* empty */ }
......
......@@ -370,7 +370,8 @@ public class SettingsActivity extends SettingsDrawerActivity
NightDisplaySettings.class.getName(),
ManageDomainUrls.class.getName(),
AutomaticStorageManagerSettings.class.getName(),
MicroGSettings.class.getName()
MicroGSettings.class.getName(),
OpenKeychainSettings.class.getName()
};
......@@ -1169,7 +1170,7 @@ public class SettingsActivity extends SettingsDrawerActivity
String backupIntent = getResources().getString(R.string.config_backup_settings_intent);
boolean useDefaultBackup = TextUtils.isEmpty(backupIntent);
// /e/ Do NOT display Backup & reset item for the moment.
useDefaultBackup = false;
setTileEnabled(new ComponentName(packageName,
......@@ -1183,7 +1184,7 @@ public class SettingsActivity extends SettingsDrawerActivity
Log.e(LOG_TAG, "Invalid backup intent URI!", e);
}
}
// /e/ Do NOT display Backup & reset item for the moment.
hasBackupActivity = false;
setTileEnabled(new ComponentName(packageName,
......
......@@ -56,6 +56,7 @@ import com.android.settings.wifi.AdvancedWifiSettings;
import com.android.settings.wifi.SavedAccessPointsWifiSettings;
import com.android.settings.wifi.WifiSettings;
import com.android.settings.MicroGSettings;
import com.android.settings.OpenKeychainSettings;
import java.util.HashMap;
......@@ -89,6 +90,7 @@ public final class Ranking {
public static final int RANK_DEVICE_INFO = 23;
public static final int RANK_GESTURE = 24;
public static final int RANK_MICROG = 25;
public static final int RANK_OPENKEYCHAIN = 26;
public static final int RANK_UNDEFINED = -1;
public static final int RANK_OTHERS = 1024;
......@@ -190,6 +192,9 @@ public final class Ranking {
// MicroG
sRankMap.put(MicroGSettings.class.getName(), RANK_MICROG);
// OpenKeychain
sRankMap.put(OpenKeychainSettings.class.getName(), RANK_OPENKEYCHAIN);
sBaseRankMap.put("com.android.settings", 0);
}
......
......@@ -56,6 +56,7 @@ import com.android.settings.wifi.AdvancedWifiSettings;
import com.android.settings.wifi.SavedAccessPointsWifiSettings;
import com.android.settings.wifi.WifiSettings;
import com.android.settings.MicroGSettings;
import com.android.settings.OpenKeychainSettings;
import java.util.Collection;
import java.util.HashMap;
......@@ -334,6 +335,14 @@ public final class SearchIndexableResources {
R.xml.micro_g_prefs,
MicroGSettings.class.getName(),
R.drawable.ic_microg_settings));
sResMap.put(OpenKeychainSettings.class.getName(),
new SearchIndexableResource(
Ranking.getRankForClassName(OpenKeychainSettings.class.getName()),
R.xml.open_keychain_prefs,
OpenKeychainSettings.class.getName(),
R.drawable.ic_openkeychain_settings));
}
private SearchIndexableResources() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment