Floating Action Button added in app settings
Before Width: | Height: | Size: 148 KiB After Width: | Height: | Size: 137 KiB |
@ -15,3 +15,6 @@ python copy OpenKeychain action black lock_outline 24
|
||||
python copy OpenKeychain navigation black apps 24
|
||||
python copy OpenKeychain action black help 24
|
||||
python copy OpenKeychain action black settings 24
|
||||
|
||||
# floating action button
|
||||
python copy OpenKeychain av white play_arrow 24
|
@ -28,6 +28,7 @@ dependencies {
|
||||
compile 'com.jpardogo.materialtabstrip:library:1.0.8'
|
||||
compile 'it.neokree:MaterialNavigationDrawer:1.3'
|
||||
compile 'com.nispok:snackbar:2.7.4'
|
||||
compile 'com.getbase:floatingactionbutton:1.7.0'
|
||||
}
|
||||
|
||||
android {
|
||||
|
@ -21,12 +21,18 @@ import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.getbase.floatingactionbutton.FloatingActionButton;
|
||||
|
||||
import org.spongycastle.util.encoders.Hex;
|
||||
import org.sufficientlysecure.keychain.Constants;
|
||||
import org.sufficientlysecure.keychain.R;
|
||||
import org.sufficientlysecure.keychain.operations.results.OperationResult;
|
||||
@ -36,13 +42,22 @@ import org.sufficientlysecure.keychain.remote.AppSettings;
|
||||
import org.sufficientlysecure.keychain.ui.BaseActivity;
|
||||
import org.sufficientlysecure.keychain.util.Log;
|
||||
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
|
||||
public class AppSettingsActivity extends BaseActivity {
|
||||
private Uri mAppUri;
|
||||
|
||||
private AppSettingsHeaderFragment mSettingsFragment;
|
||||
private AccountsListFragment mAccountsListFragment;
|
||||
private AppSettingsAllowedKeysListFragment mAllowedKeysFragment;
|
||||
|
||||
private TextView mAppNameView;
|
||||
private ImageView mAppIconView;
|
||||
private TextView mPackageName;
|
||||
private TextView mPackageSignature;
|
||||
|
||||
private FloatingActionButton mStartFab;
|
||||
|
||||
// model
|
||||
AppSettings mAppSettings;
|
||||
|
||||
@ -50,23 +65,26 @@ public class AppSettingsActivity extends BaseActivity {
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
setFullScreenDialogDoneClose(R.string.api_settings_save,
|
||||
new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
save();
|
||||
}
|
||||
},
|
||||
new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
cancel();
|
||||
}
|
||||
});
|
||||
setTitle(null);
|
||||
mAppNameView = (TextView) findViewById(R.id.api_app_settings_app_name);
|
||||
mAppIconView = (ImageView) findViewById(R.id.api_app_settings_app_icon);
|
||||
mPackageName = (TextView) findViewById(R.id.api_app_settings_package_name);
|
||||
mPackageSignature = (TextView) findViewById(R.id.api_app_settings_package_signature);
|
||||
mStartFab = (FloatingActionButton) findViewById(R.id.fab);
|
||||
|
||||
mSettingsFragment = (AppSettingsHeaderFragment) getSupportFragmentManager().findFragmentById(
|
||||
R.id.api_app_settings_fragment);
|
||||
mStartFab.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
startApp();
|
||||
}
|
||||
});
|
||||
|
||||
setFullScreenDialogClose(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
cancel();
|
||||
}
|
||||
});
|
||||
setTitle(null);
|
||||
|
||||
Intent intent = getIntent();
|
||||
mAppUri = intent.getData();
|
||||
@ -109,8 +127,8 @@ public class AppSettingsActivity extends BaseActivity {
|
||||
case R.id.menu_api_settings_revoke:
|
||||
revokeAccess();
|
||||
return true;
|
||||
case R.id.menu_api_settings_start:
|
||||
startApp();
|
||||
case R.id.menu_api_save:
|
||||
save();
|
||||
return true;
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
@ -134,18 +152,37 @@ public class AppSettingsActivity extends BaseActivity {
|
||||
|
||||
private void loadData(Bundle savedInstanceState, Uri appUri) {
|
||||
mAppSettings = new ProviderHelper(this).getApiAppSettings(appUri);
|
||||
mSettingsFragment.setAppSettings(mAppSettings);
|
||||
|
||||
// String appName;
|
||||
// PackageManager pm = getPackageManager();
|
||||
// try {
|
||||
// ApplicationInfo ai = pm.getApplicationInfo(mAppSettings.getPackageName(), 0);
|
||||
// appName = (String) pm.getApplicationLabel(ai);
|
||||
// } catch (PackageManager.NameNotFoundException e) {
|
||||
// // fallback
|
||||
// appName = mAppSettings.getPackageName();
|
||||
// }
|
||||
// setTitle(appName);
|
||||
// get application name and icon from package manager
|
||||
String appName;
|
||||
Drawable appIcon = null;
|
||||
PackageManager pm = getApplicationContext().getPackageManager();
|
||||
try {
|
||||
ApplicationInfo ai = pm.getApplicationInfo(mAppSettings.getPackageName(), 0);
|
||||
|
||||
appName = (String) pm.getApplicationLabel(ai);
|
||||
appIcon = pm.getApplicationIcon(ai);
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
// fallback
|
||||
appName = mAppSettings.getPackageName();
|
||||
}
|
||||
mAppNameView.setText(appName);
|
||||
mAppIconView.setImageDrawable(appIcon);
|
||||
|
||||
// advanced info: package name
|
||||
mPackageName.setText(mAppSettings.getPackageName());
|
||||
|
||||
// advanced info: package signature SHA-256
|
||||
try {
|
||||
MessageDigest md = MessageDigest.getInstance("SHA-256");
|
||||
md.update(mAppSettings.getPackageSignature());
|
||||
byte[] digest = md.digest();
|
||||
String signature = new String(Hex.encode(digest));
|
||||
|
||||
mPackageSignature.setText(signature);
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
Log.e(Constants.TAG, "Should not happen!", e);
|
||||
}
|
||||
|
||||
Uri accountsUri = appUri.buildUpon().appendPath(KeychainContract.PATH_ACCOUNTS).build();
|
||||
Log.d(Constants.TAG, "accountsUri: " + accountsUri);
|
||||
|
After Width: | Height: | Size: 282 B |
After Width: | Height: | Size: 257 B |
After Width: | Height: | Size: 318 B |
After Width: | Height: | Size: 399 B |
After Width: | Height: | Size: 477 B |
Before Width: | Height: | Size: 46 KiB After Width: | Height: | Size: 47 KiB |
@ -5,7 +5,7 @@
|
||||
|
||||
<include
|
||||
android:id="@+id/toolbar"
|
||||
layout="@layout/toolbar" />
|
||||
layout="@layout/toolbar_standalone" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_below="@id/toolbar"
|
||||
|
@ -1,26 +1,66 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:custom="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:fab="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<include
|
||||
android:id="@+id/toolbar"
|
||||
layout="@layout/toolbar" />
|
||||
<RelativeLayout
|
||||
android:id="@+id/toolbar_big"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="120dp"
|
||||
android:elevation="4dp"
|
||||
android:background="?attr/colorPrimaryDark"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<android.support.v7.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="?attr/actionBarSize"
|
||||
android:background="?attr/colorPrimaryDark"
|
||||
android:overScrollMode="always"
|
||||
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
|
||||
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
|
||||
tools:ignore="UnusedAttribute"
|
||||
android:transitionGroup="false"
|
||||
android:touchscreenBlocksFocus="false" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_below="@+id/toolbar"
|
||||
android:paddingLeft="48dp"
|
||||
android:paddingBottom="8dp"
|
||||
android:paddingRight="72dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/api_app_settings_app_icon"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:src="@drawable/ic_launcher" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/api_app_settings_app_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Name (set in-code)longlong"
|
||||
android:textColor="@color/icons"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:paddingLeft="8dp"
|
||||
android:layout_gravity="center_vertical" />
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_below="@id/toolbar"
|
||||
android:id="@+id/body"
|
||||
android:layout_below="@id/toolbar_big"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<fragment
|
||||
android:id="@+id/api_app_settings_fragment"
|
||||
android:name="org.sufficientlysecure.keychain.remote.ui.AppSettingsHeaderFragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
tools:layout="@layout/api_app_settings_fragment" />
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
@ -55,7 +95,56 @@
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical" />
|
||||
|
||||
<org.sufficientlysecure.keychain.ui.widget.FoldableLinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:textColor="@color/icons"
|
||||
custom:foldedLabel="@string/api_settings_show_info"
|
||||
custom:unFoldedLabel="@string/api_settings_hide_info">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/api_settings_package_name"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/api_app_settings_package_name"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="com.example"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/api_settings_package_signature"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/api_app_settings_package_signature"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Base64 encoded hash of signature"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||
|
||||
</org.sufficientlysecure.keychain.ui.widget.FoldableLinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
</LinearLayout>
|
||||
|
||||
<com.getbase.floatingactionbutton.FloatingActionButton
|
||||
android:id="@+id/fab"
|
||||
android:layout_alignBottom="@id/toolbar_big"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_marginRight="20dp"
|
||||
android:layout_marginBottom="-40dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:elevation="4dp"
|
||||
fab:fab_icon="@drawable/ic_play_arrow_white_24dp"
|
||||
fab:fab_colorNormal="@color/fab"
|
||||
fab:fab_colorPressed="@color/fab_pressed" />
|
||||
|
||||
</RelativeLayout>
|
@ -5,7 +5,7 @@
|
||||
|
||||
<include
|
||||
android:id="@+id/toolbar"
|
||||
layout="@layout/toolbar" />
|
||||
layout="@layout/toolbar_standalone" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_below="@id/toolbar"
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
<include
|
||||
android:id="@+id/toolbar"
|
||||
layout="@layout/toolbar" />
|
||||
layout="@layout/toolbar_standalone" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_below="@id/toolbar"
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
<include
|
||||
android:id="@+id/toolbar"
|
||||
layout="@layout/toolbar" />
|
||||
layout="@layout/toolbar_standalone" />
|
||||
|
||||
<ScrollView
|
||||
android:layout_below="@id/toolbar"
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
<include
|
||||
android:id="@+id/toolbar"
|
||||
layout="@layout/toolbar" />
|
||||
layout="@layout/toolbar_standalone" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_below="@id/toolbar"
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
<include
|
||||
android:id="@+id/toolbar"
|
||||
layout="@layout/toolbar" />
|
||||
layout="@layout/toolbar_standalone" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_below="@id/toolbar"
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
<include
|
||||
android:id="@+id/toolbar"
|
||||
layout="@layout/toolbar" />
|
||||
layout="@layout/toolbar_standalone" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_below="@id/toolbar"
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
<include
|
||||
android:id="@+id/toolbar"
|
||||
layout="@layout/toolbar" />
|
||||
layout="@layout/toolbar_standalone" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_below="@id/toolbar"
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
<include
|
||||
android:id="@+id/toolbar"
|
||||
layout="@layout/toolbar" />
|
||||
layout="@layout/toolbar_standalone" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_below="@id/toolbar"
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
<include
|
||||
android:id="@+id/toolbar"
|
||||
layout="@layout/toolbar" />
|
||||
layout="@layout/toolbar_standalone" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_below="@id/toolbar"
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
<include
|
||||
android:id="@+id/toolbar"
|
||||
layout="@layout/toolbar" />
|
||||
layout="@layout/toolbar_standalone" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_below="@id/toolbar"
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
<include
|
||||
android:id="@+id/toolbar"
|
||||
layout="@layout/toolbar" />
|
||||
layout="@layout/toolbar_standalone" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_below="@id/toolbar"
|
||||
|
@ -6,13 +6,14 @@
|
||||
|
||||
<include
|
||||
android:id="@+id/toolbar"
|
||||
layout="@layout/toolbar" />
|
||||
layout="@layout/toolbar_standalone" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_below="@id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
android:orientation="vertical"
|
||||
android:elevation="4dp">
|
||||
|
||||
<com.astuetz.PagerSlidingTabStrip
|
||||
android:id="@+id/sliding_tab_layout"
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
<include
|
||||
android:id="@+id/toolbar"
|
||||
layout="@layout/toolbar" />
|
||||
layout="@layout/toolbar_standalone" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_below="@id/toolbar"
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
<include
|
||||
android:id="@+id/toolbar"
|
||||
layout="@layout/toolbar" />
|
||||
layout="@layout/toolbar_standalone" />
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
<include
|
||||
android:id="@+id/toolbar"
|
||||
layout="@layout/toolbar" />
|
||||
layout="@layout/toolbar_standalone" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_below="@id/toolbar"
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
<include
|
||||
android:id="@+id/toolbar"
|
||||
layout="@layout/toolbar" />
|
||||
layout="@layout/toolbar_standalone" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_below="@id/toolbar"
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
<include
|
||||
android:id="@+id/toolbar"
|
||||
layout="@layout/toolbar" />
|
||||
layout="@layout/toolbar_standalone" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_below="@id/toolbar"
|
||||
|
@ -5,6 +5,6 @@
|
||||
|
||||
<include
|
||||
android:id="@+id/toolbar"
|
||||
layout="@layout/toolbar" />
|
||||
layout="@layout/toolbar_standalone" />
|
||||
|
||||
</LinearLayout>
|
@ -5,7 +5,7 @@
|
||||
|
||||
<include
|
||||
android:id="@+id/toolbar"
|
||||
layout="@layout/toolbar" />
|
||||
layout="@layout/toolbar_standalone" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_below="@id/toolbar"
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
<include
|
||||
android:id="@+id/toolbar"
|
||||
layout="@layout/toolbar" />
|
||||
layout="@layout/toolbar_standalone" />
|
||||
|
||||
<ScrollView
|
||||
android:layout_below="@id/toolbar"
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
<include
|
||||
android:id="@+id/toolbar"
|
||||
layout="@layout/toolbar" />
|
||||
layout="@layout/toolbar_standalone" />
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_below="@id/toolbar"
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
<include
|
||||
android:id="@+id/toolbar"
|
||||
layout="@layout/toolbar" />
|
||||
layout="@layout/toolbar_standalone" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_below="@id/toolbar"
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
<include
|
||||
android:id="@+id/toolbar"
|
||||
layout="@layout/toolbar" />
|
||||
layout="@layout/toolbar_standalone" />
|
||||
|
||||
<ScrollView
|
||||
android:layout_below="@id/toolbar"
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
<include
|
||||
android:id="@+id/toolbar"
|
||||
layout="@layout/toolbar" />
|
||||
layout="@layout/toolbar_standalone" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_below="@id/toolbar"
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
<include
|
||||
android:id="@+id/toolbar"
|
||||
layout="@layout/toolbar" />
|
||||
layout="@layout/toolbar_standalone" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_below="@id/toolbar"
|
||||
|
@ -3,9 +3,8 @@
|
||||
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"
|
||||
android:id="@+id/menu_api_save"
|
||||
android:title="@string/api_settings_save"
|
||||
app:showAsAction="always" />
|
||||
|
||||
<item
|
||||
|
@ -20,6 +20,8 @@
|
||||
<color name="primary_dark">#388E3C</color>
|
||||
<color name="primary_light">#C8E6C9</color>
|
||||
<color name="accent">#00BCD4</color>
|
||||
<color name="fab">#00BCD4</color>
|
||||
<color name="fab_pressed">#0097A7</color>
|
||||
<color name="primary_text">#212121</color>
|
||||
<color name="secondary_text">#727272</color>
|
||||
<color name="icons">#FFFFFF</color>
|
||||
|