mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-11 03:25:05 -05:00
Start app menu item for registered apps
This commit is contained in:
parent
2a33eae9eb
commit
b771276611
@ -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);
|
||||
|
||||
|
BIN
OpenKeychain/src/main/res/drawable-hdpi/ic_action_play.png
Normal file
BIN
OpenKeychain/src/main/res/drawable-hdpi/ic_action_play.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 497 B |
BIN
OpenKeychain/src/main/res/drawable-mdpi/ic_action_play.png
Normal file
BIN
OpenKeychain/src/main/res/drawable-mdpi/ic_action_play.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 375 B |
BIN
OpenKeychain/src/main/res/drawable-xhdpi/ic_action_play.png
Normal file
BIN
OpenKeychain/src/main/res/drawable-xhdpi/ic_action_play.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 531 B |
BIN
OpenKeychain/src/main/res/drawable-xxhdpi/ic_action_play.png
Normal file
BIN
OpenKeychain/src/main/res/drawable-xxhdpi/ic_action_play.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 778 B |
@ -2,6 +2,12 @@
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
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"
|
||||
|
@ -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>
|
||||
|
Loading…
Reference in New Issue
Block a user