aboutsummaryrefslogtreecommitdiffstats
path: root/OpenKeychain
diff options
context:
space:
mode:
authorDominik Schürmann <dominik@dominikschuermann.de>2014-05-07 15:03:24 +0200
committerDominik Schürmann <dominik@dominikschuermann.de>2014-05-07 15:03:24 +0200
commitb771276611b98e167242dd790416811ff2966a47 (patch)
treeb383454ee1428770eb334ca92ad0b620bce1a061 /OpenKeychain
parent2a33eae9ebad8b24326ad30b262e6062f47be80f (diff)
downloadopen-keychain-b771276611b98e167242dd790416811ff2966a47.tar.gz
open-keychain-b771276611b98e167242dd790416811ff2966a47.tar.bz2
open-keychain-b771276611b98e167242dd790416811ff2966a47.zip
Start app menu item for registered apps
Diffstat (limited to 'OpenKeychain')
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/ui/AppSettingsActivity.java28
-rw-r--r--OpenKeychain/src/main/res/drawable-hdpi/ic_action_play.pngbin0 -> 497 bytes
-rw-r--r--OpenKeychain/src/main/res/drawable-mdpi/ic_action_play.pngbin0 -> 375 bytes
-rw-r--r--OpenKeychain/src/main/res/drawable-xhdpi/ic_action_play.pngbin0 -> 531 bytes
-rw-r--r--OpenKeychain/src/main/res/drawable-xxhdpi/ic_action_play.pngbin0 -> 778 bytes
-rw-r--r--OpenKeychain/src/main/res/menu/api_app_settings.xml6
-rw-r--r--OpenKeychain/src/main/res/values/strings.xml1
7 files changed, 31 insertions, 4 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/ui/AppSettingsActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/ui/AppSettingsActivity.java
index c6637c058..8df341f9e 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/ui/AppSettingsActivity.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/ui/AppSettingsActivity.java
@@ -40,6 +40,9 @@ public class AppSettingsActivity extends ActionBarActivity {
private AppSettingsFragment mSettingsFragment;
private AccountsListFragment mAccountsListFragment;
+ // model
+ AppSettings mAppSettings;
+
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -80,22 +83,39 @@ public class AppSettingsActivity extends ActionBarActivity {
case R.id.menu_api_settings_revoke:
revokeAccess();
return true;
+ case R.id.menu_api_settings_start:
+ startApp();
+ return true;
}
return super.onOptionsItemSelected(item);
}
+ private void startApp() {
+ Intent i;
+ PackageManager manager = getPackageManager();
+ try {
+ i = manager.getLaunchIntentForPackage(mAppSettings.getPackageName());
+ if (i == null)
+ throw new PackageManager.NameNotFoundException();
+ i.addCategory(Intent.CATEGORY_LAUNCHER);
+ startActivity(i);
+ } catch (PackageManager.NameNotFoundException e) {
+ Log.e(Constants.TAG, "startApp", e);
+ }
+ }
+
private void loadData(Bundle savedInstanceState, Uri appUri) {
- AppSettings settings = new ProviderHelper(this).getApiAppSettings(appUri);
- mSettingsFragment.setAppSettings(settings);
+ mAppSettings = new ProviderHelper(this).getApiAppSettings(appUri);
+ mSettingsFragment.setAppSettings(mAppSettings);
String appName;
PackageManager pm = getPackageManager();
try {
- ApplicationInfo ai = pm.getApplicationInfo(settings.getPackageName(), 0);
+ ApplicationInfo ai = pm.getApplicationInfo(mAppSettings.getPackageName(), 0);
appName = (String) pm.getApplicationLabel(ai);
} catch (PackageManager.NameNotFoundException e) {
// fallback
- appName = settings.getPackageName();
+ appName = mAppSettings.getPackageName();
}
setTitle(appName);
diff --git a/OpenKeychain/src/main/res/drawable-hdpi/ic_action_play.png b/OpenKeychain/src/main/res/drawable-hdpi/ic_action_play.png
new file mode 100644
index 000000000..869f0014b
--- /dev/null
+++ b/OpenKeychain/src/main/res/drawable-hdpi/ic_action_play.png
Binary files differ
diff --git a/OpenKeychain/src/main/res/drawable-mdpi/ic_action_play.png b/OpenKeychain/src/main/res/drawable-mdpi/ic_action_play.png
new file mode 100644
index 000000000..5f3bf86fd
--- /dev/null
+++ b/OpenKeychain/src/main/res/drawable-mdpi/ic_action_play.png
Binary files differ
diff --git a/OpenKeychain/src/main/res/drawable-xhdpi/ic_action_play.png b/OpenKeychain/src/main/res/drawable-xhdpi/ic_action_play.png
new file mode 100644
index 000000000..7f709bbf1
--- /dev/null
+++ b/OpenKeychain/src/main/res/drawable-xhdpi/ic_action_play.png
Binary files differ
diff --git a/OpenKeychain/src/main/res/drawable-xxhdpi/ic_action_play.png b/OpenKeychain/src/main/res/drawable-xxhdpi/ic_action_play.png
new file mode 100644
index 000000000..df5994710
--- /dev/null
+++ b/OpenKeychain/src/main/res/drawable-xxhdpi/ic_action_play.png
Binary files differ
diff --git a/OpenKeychain/src/main/res/menu/api_app_settings.xml b/OpenKeychain/src/main/res/menu/api_app_settings.xml
index a21db6708..1233e4f6e 100644
--- a/OpenKeychain/src/main/res/menu/api_app_settings.xml
+++ b/OpenKeychain/src/main/res/menu/api_app_settings.xml
@@ -3,6 +3,12 @@
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
+ android:id="@+id/menu_api_settings_start"
+ android:title="@string/api_settings_start"
+ android:icon="@drawable/ic_action_play"
+ app:showAsAction="always" />
+
+ <item
android:id="@+id/menu_api_settings_revoke"
android:title="@string/api_settings_revoke"
app:showAsAction="never" />
diff --git a/OpenKeychain/src/main/res/values/strings.xml b/OpenKeychain/src/main/res/values/strings.xml
index 02889eac2..fd9920cfe 100644
--- a/OpenKeychain/src/main/res/values/strings.xml
+++ b/OpenKeychain/src/main/res/values/strings.xml
@@ -424,6 +424,7 @@
<string name="api_settings_save">Save</string>
<string name="api_settings_cancel">Cancel</string>
<string name="api_settings_revoke">Revoke access</string>
+ <string name="api_settings_start">Start application</string>
<string name="api_settings_delete_account">Delete account</string>
<string name="api_settings_package_name">Package Name</string>
<string name="api_settings_package_signature">SHA-256 of Package Signature</string>