mirror of
https://github.com/moparisthebest/open-keychain
synced 2025-01-13 06:28:20 -05:00
Accounts API, user interface
This commit is contained in:
parent
930d722013
commit
9542dc0e12
@ -50,7 +50,7 @@
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.NFC" />
|
||||
<uses-permission android:name="android.permission.GET_ACCOUNTS"/>
|
||||
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
|
||||
|
||||
<!-- android:allowBackup="false": Don't allow backup over adb backup or other apps! -->
|
||||
<application
|
||||
@ -98,14 +98,12 @@
|
||||
android:name=".ui.SelectPublicKeyActivity"
|
||||
android:configChanges="orientation|screenSize|keyboardHidden|keyboard"
|
||||
android:label="@string/title_select_recipients"
|
||||
android:launchMode="singleTop">
|
||||
</activity>
|
||||
android:launchMode="singleTop"></activity>
|
||||
<activity
|
||||
android:name=".ui.SelectSecretKeyActivity"
|
||||
android:configChanges="orientation|screenSize|keyboardHidden|keyboard"
|
||||
android:label="@string/title_select_secret_key"
|
||||
android:launchMode="singleTop">
|
||||
</activity>
|
||||
android:launchMode="singleTop"></activity>
|
||||
<activity
|
||||
android:name=".ui.EncryptActivity"
|
||||
android:configChanges="orientation|screenSize|keyboardHidden|keyboard"
|
||||
@ -144,23 +142,23 @@
|
||||
|
||||
<!--<!– VIEW with mimeType: TODO (from email app) –>-->
|
||||
<!--<intent-filter android:label="@string/intent_import_key">-->
|
||||
<!--<action android:name="android.intent.action.VIEW" />-->
|
||||
<!--<action android:name="android.intent.action.VIEW" />-->
|
||||
|
||||
<!--<category android:name="android.intent.category.BROWSABLE" />-->
|
||||
<!--<category android:name="android.intent.category.DEFAULT" />-->
|
||||
<!--<category android:name="android.intent.category.BROWSABLE" />-->
|
||||
<!--<category android:name="android.intent.category.DEFAULT" />-->
|
||||
|
||||
<!--<!– mime type as defined in http://tools.ietf.org/html/rfc3156 –>-->
|
||||
<!--<data android:mimeType="application/pgp-signature" />-->
|
||||
<!--<!– mime type as defined in http://tools.ietf.org/html/rfc3156 –>-->
|
||||
<!--<data android:mimeType="application/pgp-signature" />-->
|
||||
<!--</intent-filter>-->
|
||||
<!--<!– VIEW with mimeType: TODO (from email app) –>-->
|
||||
<!--<intent-filter android:label="@string/intent_import_key">-->
|
||||
<!--<action android:name="android.intent.action.VIEW" />-->
|
||||
<!--<action android:name="android.intent.action.VIEW" />-->
|
||||
|
||||
<!--<category android:name="android.intent.category.BROWSABLE" />-->
|
||||
<!--<category android:name="android.intent.category.DEFAULT" />-->
|
||||
<!--<category android:name="android.intent.category.BROWSABLE" />-->
|
||||
<!--<category android:name="android.intent.category.DEFAULT" />-->
|
||||
|
||||
<!--<!– mime type as defined in http://tools.ietf.org/html/rfc3156 –>-->
|
||||
<!--<data android:mimeType="application/pgp-encrypted" />-->
|
||||
<!--<!– mime type as defined in http://tools.ietf.org/html/rfc3156 –>-->
|
||||
<!--<data android:mimeType="application/pgp-encrypted" />-->
|
||||
<!--</intent-filter>-->
|
||||
<!-- Keychain's own Actions -->
|
||||
<!-- DECRYPT with text as extra -->
|
||||
@ -236,7 +234,7 @@
|
||||
<activity
|
||||
android:name=".ui.PreferencesActivity"
|
||||
android:configChanges="orientation|screenSize|keyboardHidden|keyboard"
|
||||
android:label="@string/title_preferences" >
|
||||
android:label="@string/title_preferences">
|
||||
<intent-filter>
|
||||
<action android:name="org.sufficientlysecure.keychain.ui.PREFS_GEN" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
@ -374,17 +372,17 @@
|
||||
android:exported="false"
|
||||
android:process=":passphrase_cache" />
|
||||
<service
|
||||
android:name="org.sufficientlysecure.keychain.service.KeychainIntentService"
|
||||
android:name=".service.KeychainIntentService"
|
||||
android:exported="false" />
|
||||
|
||||
<provider
|
||||
android:name="org.sufficientlysecure.keychain.provider.KeychainProvider"
|
||||
android:name=".provider.KeychainProvider"
|
||||
android:authorities="org.sufficientlysecure.keychain.provider"
|
||||
android:exported="false" />
|
||||
|
||||
<!-- Internal classes of the remote APIs (not exported) -->
|
||||
<activity
|
||||
android:name="org.sufficientlysecure.keychain.remote.ui.RemoteServiceActivity"
|
||||
android:name=".remote.ui.RemoteServiceActivity"
|
||||
android:exported="false"
|
||||
android:label="@string/app_name" />
|
||||
<!--android:launchMode="singleTop"-->
|
||||
@ -395,23 +393,28 @@
|
||||
android:exported="false"
|
||||
android:label="@string/title_api_registered_apps" />
|
||||
<activity
|
||||
android:name="org.sufficientlysecure.keychain.remote.ui.AppSettingsActivity"
|
||||
android:name=".remote.ui.AppSettingsActivity"
|
||||
android:configChanges="orientation|screenSize|keyboardHidden|keyboard"
|
||||
android:exported="false">
|
||||
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".remote.ui.AppsListActivity" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".remote.ui.AccountSettingsActivity"
|
||||
android:configChanges="orientation|screenSize|keyboardHidden|keyboard"
|
||||
android:exported="false" />
|
||||
|
||||
<!-- OpenPGP Remote API -->
|
||||
<service
|
||||
android:name="org.sufficientlysecure.keychain.remote.OpenPgpService"
|
||||
android:name=".remote.OpenPgpService"
|
||||
android:enabled="true"
|
||||
android:exported="true"
|
||||
android:process=":remote_api">
|
||||
<intent-filter>
|
||||
<action android:name="org.openintents.openpgp.IOpenPgpService" />
|
||||
</intent-filter>
|
||||
|
||||
<meta-data
|
||||
android:name="api_version"
|
||||
android:value="1" />
|
||||
</service>
|
||||
|
||||
<!-- Extended Remote API -->
|
||||
|
@ -0,0 +1,110 @@
|
||||
/*
|
||||
* Copyright (C) 2013 Dominik Schürmann <dominik@dominikschuermann.de>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package org.sufficientlysecure.keychain.remote.ui;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.app.ActionBarActivity;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
|
||||
import org.sufficientlysecure.keychain.Constants;
|
||||
import org.sufficientlysecure.keychain.R;
|
||||
import org.sufficientlysecure.keychain.helper.ActionBarHelper;
|
||||
import org.sufficientlysecure.keychain.provider.ProviderHelper;
|
||||
import org.sufficientlysecure.keychain.remote.AccountSettings;
|
||||
import org.sufficientlysecure.keychain.util.Log;
|
||||
|
||||
public class AccountSettingsActivity extends ActionBarActivity {
|
||||
private Uri mAccountUri;
|
||||
|
||||
private AccountSettingsFragment mAccountSettingsFragment;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
// Inflate a "Done" custom action bar
|
||||
ActionBarHelper.setOneButtonView(getSupportActionBar(),
|
||||
R.string.api_settings_save, R.drawable.ic_action_done,
|
||||
new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// "Done"
|
||||
save();
|
||||
}
|
||||
});
|
||||
|
||||
setContentView(R.layout.api_account_settings_activity);
|
||||
|
||||
mAccountSettingsFragment = (AccountSettingsFragment) getSupportFragmentManager().findFragmentById(
|
||||
R.id.api_account_settings_fragment);
|
||||
|
||||
Intent intent = getIntent();
|
||||
mAccountUri = intent.getData();
|
||||
if (mAccountUri == null) {
|
||||
Log.e(Constants.TAG, "Intent data missing. Should be Uri of app!");
|
||||
finish();
|
||||
return;
|
||||
} else {
|
||||
Log.d(Constants.TAG, "uri: " + mAccountUri);
|
||||
loadData(savedInstanceState, mAccountUri);
|
||||
}
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public boolean onCreateOptionsMenu(Menu menu) {
|
||||
// super.onCreateOptionsMenu(menu);
|
||||
// getMenuInflater().inflate(R.menu.api_app_settings, menu);
|
||||
// return true;
|
||||
// }
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case R.id.menu_api_settings_revoke:
|
||||
deleteAccount();
|
||||
return true;
|
||||
case R.id.menu_api_settings_cancel:
|
||||
finish();
|
||||
return true;
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
private void loadData(Bundle savedInstanceState, Uri accountUri) {
|
||||
// TODO: load this also like other fragment with newInstance arguments?
|
||||
AccountSettings settings = ProviderHelper.getApiAccountSettings(this, accountUri);
|
||||
mAccountSettingsFragment.setAccSettings(settings);
|
||||
}
|
||||
|
||||
private void deleteAccount() {
|
||||
if (getContentResolver().delete(mAccountUri, null, null) <= 0) {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
finish();
|
||||
}
|
||||
|
||||
private void save() {
|
||||
ProviderHelper.updateApiAccount(this, mAccountSettingsFragment.getAccSettings(), mAccountUri);
|
||||
|
||||
finish();
|
||||
}
|
||||
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2013 Dominik Schürmann <dominik@dominikschuermann.de>
|
||||
* Copyright (C) 2014 Dominik Schürmann <dominik@dominikschuermann.de>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -17,35 +17,35 @@
|
||||
|
||||
package org.sufficientlysecure.keychain.remote.ui;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.content.ContentUris;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.database.Cursor;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.ListFragment;
|
||||
import android.support.v4.app.LoaderManager;
|
||||
import android.support.v4.content.CursorLoader;
|
||||
import android.support.v4.content.Loader;
|
||||
import android.support.v4.widget.CursorAdapter;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.AdapterView.OnItemClickListener;
|
||||
import android.widget.SimpleCursorAdapter;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.sufficientlysecure.keychain.Constants;
|
||||
import org.sufficientlysecure.keychain.R;
|
||||
import org.sufficientlysecure.keychain.provider.KeychainContract;
|
||||
import org.sufficientlysecure.keychain.provider.KeychainContract.ApiApps;
|
||||
import org.sufficientlysecure.keychain.util.Log;
|
||||
|
||||
// TODO: make compat with < 11
|
||||
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
|
||||
public class AccountsListFragment extends ListFragment implements
|
||||
LoaderManager.LoaderCallbacks<Cursor> {
|
||||
|
||||
private static final String ARG_DATA_URI = "uri";
|
||||
|
||||
// This is the Adapter being used to display the list's data.
|
||||
SimpleCursorAdapter mAdapter;
|
||||
AccountsAdapter mAdapter;
|
||||
|
||||
private Uri mDataUri;
|
||||
|
||||
@ -72,10 +72,14 @@ public class AccountsListFragment extends ListFragment implements
|
||||
getListView().setOnItemClickListener(new OnItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) {
|
||||
// // edit app settings
|
||||
// Intent intent = new Intent(getActivity(), AppSettingsActivity.class);
|
||||
// intent.setData(ContentUris.withAppendedId(ApiApps.CONTENT_URI, id));
|
||||
// startActivity(intent);
|
||||
String selectedAccountName = mAdapter.getItemAccountName(position);
|
||||
Uri accountUri = mDataUri.buildUpon().appendEncodedPath(selectedAccountName).build();
|
||||
Log.d(Constants.TAG, "accountUri: " + accountUri);
|
||||
|
||||
// edit account settings
|
||||
Intent intent = new Intent(getActivity(), AccountSettingsActivity.class);
|
||||
intent.setData(accountUri);
|
||||
startActivity(intent);
|
||||
}
|
||||
});
|
||||
|
||||
@ -87,12 +91,7 @@ public class AccountsListFragment extends ListFragment implements
|
||||
setHasOptionsMenu(true);
|
||||
|
||||
// Create an empty adapter we will use to display the loaded data.
|
||||
mAdapter = new SimpleCursorAdapter(getActivity(),
|
||||
android.R.layout.simple_list_item_1,
|
||||
null,
|
||||
new String[]{KeychainContract.ApiAccounts.ACCOUNT_NAME},
|
||||
new int[]{android.R.id.text1},
|
||||
0);
|
||||
mAdapter = new AccountsAdapter(getActivity(), null, 0);
|
||||
setListAdapter(mAdapter);
|
||||
|
||||
// Prepare the loader. Either re-connect with an existing one,
|
||||
@ -102,15 +101,13 @@ public class AccountsListFragment extends ListFragment implements
|
||||
|
||||
// These are the Contacts rows that we will retrieve.
|
||||
static final String[] PROJECTION = new String[]{
|
||||
KeychainContract.ApiAccounts._ID,
|
||||
KeychainContract.ApiAccounts.ACCOUNT_NAME};
|
||||
KeychainContract.ApiAccounts._ID, // 0
|
||||
KeychainContract.ApiAccounts.ACCOUNT_NAME // 1
|
||||
};
|
||||
|
||||
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
|
||||
// This is called when a new Loader needs to be created. This
|
||||
// sample only has one Loader, so we don't care about the ID.
|
||||
// First, pick the base URI to use depending on whether we are
|
||||
// currently filtering.
|
||||
// Uri baseUri = KeychainContract.ApiAccounts.buildBaseUri(mPackageName);
|
||||
|
||||
// Now create and return a CursorLoader that will take care of
|
||||
// creating a Cursor for the data being displayed.
|
||||
@ -131,46 +128,46 @@ public class AccountsListFragment extends ListFragment implements
|
||||
mAdapter.swapCursor(null);
|
||||
}
|
||||
|
||||
// private class RegisteredAppsAdapter extends CursorAdapter {
|
||||
//
|
||||
// private LayoutInflater mInflater;
|
||||
// private PackageManager mPM;
|
||||
//
|
||||
// public RegisteredAppsAdapter(Context context, Cursor c, int flags) {
|
||||
// super(context, c, flags);
|
||||
//
|
||||
// mInflater = LayoutInflater.from(context);
|
||||
// mPM = context.getApplicationContext().getPackageManager();
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void bindView(View view, Context context, Cursor cursor) {
|
||||
// TextView text = (TextView) view.findViewById(R.id.api_apps_adapter_item_name);
|
||||
// ImageView icon = (ImageView) view.findViewById(R.id.api_apps_adapter_item_icon);
|
||||
//
|
||||
// String packageName = cursor.getString(cursor.getColumnIndex(ApiApps.PACKAGE_NAME));
|
||||
// if (packageName != null) {
|
||||
// // get application name
|
||||
// try {
|
||||
// ApplicationInfo ai = mPM.getApplicationInfo(packageName, 0);
|
||||
//
|
||||
// text.setText(mPM.getApplicationLabel(ai));
|
||||
// icon.setImageDrawable(mPM.getApplicationIcon(ai));
|
||||
// } catch (final PackageManager.NameNotFoundException e) {
|
||||
// // fallback
|
||||
// text.setText(packageName);
|
||||
// }
|
||||
// } else {
|
||||
// // fallback
|
||||
// text.setText(packageName);
|
||||
// }
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public View newView(Context context, Cursor cursor, ViewGroup parent) {
|
||||
// return mInflater.inflate(R.layout.api_apps_adapter_list_item, null);
|
||||
// }
|
||||
// }
|
||||
private class AccountsAdapter extends CursorAdapter {
|
||||
private LayoutInflater mInflater;
|
||||
|
||||
public AccountsAdapter(Context context, Cursor c, int flags) {
|
||||
super(context, c, flags);
|
||||
|
||||
mInflater = LayoutInflater.from(context);
|
||||
}
|
||||
|
||||
/**
|
||||
* Similar to CursorAdapter.getItemId().
|
||||
* Required to build Uris for api app view, which is not based on row ids
|
||||
*
|
||||
* @param position
|
||||
* @return
|
||||
*/
|
||||
public String getItemAccountName(int position) {
|
||||
if (mDataValid && mCursor != null) {
|
||||
if (mCursor.moveToPosition(position)) {
|
||||
return mCursor.getString(1);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bindView(View view, Context context, Cursor cursor) {
|
||||
TextView text = (TextView) view.findViewById(R.id.api_accounts_adapter_item_name);
|
||||
|
||||
String accountName = cursor.getString(1);
|
||||
text.setText(accountName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public View newView(Context context, Cursor cursor, ViewGroup parent) {
|
||||
return mInflater.inflate(R.layout.api_accounts_adapter_list_item, null);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -18,16 +18,17 @@
|
||||
package org.sufficientlysecure.keychain.remote.ui;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.app.ActionBar;
|
||||
import android.support.v7.app.ActionBarActivity;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
|
||||
import org.sufficientlysecure.keychain.Constants;
|
||||
import org.sufficientlysecure.keychain.R;
|
||||
import org.sufficientlysecure.keychain.helper.ActionBarHelper;
|
||||
import org.sufficientlysecure.keychain.provider.KeychainContract;
|
||||
import org.sufficientlysecure.keychain.provider.ProviderHelper;
|
||||
import org.sufficientlysecure.keychain.remote.AppSettings;
|
||||
@ -43,16 +44,11 @@ public class AppSettingsActivity extends ActionBarActivity {
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
// Inflate a "Done" custom action bar
|
||||
ActionBarHelper.setOneButtonView(getSupportActionBar(),
|
||||
R.string.api_settings_save, R.drawable.ic_action_done,
|
||||
new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// "Done"
|
||||
save();
|
||||
}
|
||||
});
|
||||
// let the actionbar look like Android's contact app
|
||||
ActionBar actionBar = getSupportActionBar();
|
||||
actionBar.setDisplayHomeAsUpEnabled(true);
|
||||
actionBar.setIcon(android.R.color.transparent);
|
||||
actionBar.setHomeButtonEnabled(true);
|
||||
|
||||
setContentView(R.layout.api_app_settings_activity);
|
||||
|
||||
@ -96,6 +92,18 @@ public class AppSettingsActivity extends ActionBarActivity {
|
||||
AppSettings settings = ProviderHelper.getApiAppSettings(this, appUri);
|
||||
mSettingsFragment.setAppSettings(settings);
|
||||
|
||||
String appName;
|
||||
PackageManager pm = getPackageManager();
|
||||
try {
|
||||
ApplicationInfo ai = pm.getApplicationInfo(settings.getPackageName(), 0);
|
||||
appName = (String) pm.getApplicationLabel(ai);
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
// fallback
|
||||
appName = settings.getPackageName();
|
||||
}
|
||||
setTitle(appName);
|
||||
|
||||
|
||||
Uri accountsUri = appUri.buildUpon().appendPath(KeychainContract.PATH_ACCOUNTS).build();
|
||||
Log.d(Constants.TAG, "accountsUri: " + accountsUri);
|
||||
startListFragment(savedInstanceState, accountsUri);
|
||||
@ -128,10 +136,4 @@ public class AppSettingsActivity extends ActionBarActivity {
|
||||
finish();
|
||||
}
|
||||
|
||||
private void save() {
|
||||
ProviderHelper.updateApiApp(this, mSettingsFragment.getAppSettings(), mAppUri);
|
||||
|
||||
finish();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -26,19 +26,13 @@ import android.support.v4.app.Fragment;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.AdapterView.OnItemSelectedListener;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.spongycastle.util.encoders.Hex;
|
||||
import org.sufficientlysecure.keychain.Constants;
|
||||
import org.sufficientlysecure.keychain.R;
|
||||
import org.sufficientlysecure.keychain.remote.AppSettings;
|
||||
import org.sufficientlysecure.keychain.ui.SelectSecretKeyLayoutFragment;
|
||||
import org.sufficientlysecure.keychain.ui.adapter.KeyValueSpinnerAdapter;
|
||||
import org.sufficientlysecure.keychain.util.AlgorithmNames;
|
||||
import org.sufficientlysecure.keychain.util.Log;
|
||||
|
||||
import java.security.MessageDigest;
|
||||
@ -100,14 +94,14 @@ public class AppSettingsFragment extends Fragment {
|
||||
PackageManager pm = getActivity().getApplicationContext().getPackageManager();
|
||||
|
||||
// get application name and icon from package manager
|
||||
String appName = null;
|
||||
String appName;
|
||||
Drawable appIcon = null;
|
||||
try {
|
||||
ApplicationInfo ai = pm.getApplicationInfo(packageName, 0);
|
||||
|
||||
appName = (String) pm.getApplicationLabel(ai);
|
||||
appIcon = pm.getApplicationIcon(ai);
|
||||
} catch (final NameNotFoundException e) {
|
||||
} catch (NameNotFoundException e) {
|
||||
// fallback
|
||||
appName = packageName;
|
||||
}
|
||||
|
@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="16dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<fragment
|
||||
android:id="@+id/api_account_settings_fragment"
|
||||
android:name="org.sufficientlysecure.keychain.remote.ui.AccountSettingsFragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
@ -0,0 +1,16 @@
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="?android:attr/listPreferredItemHeight"
|
||||
android:paddingTop="4dp"
|
||||
android:paddingBottom="4dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/api_accounts_adapter_item_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:text="Account Name"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
</LinearLayout>
|
Loading…
Reference in New Issue
Block a user