Merge pull request #2301 from open-keychain/api-choose-sign-key

New identity chooser dialog for API
This commit is contained in:
Dominik Schürmann
2018-05-03 14:58:20 +02:00
committed by GitHub
34 changed files with 2295 additions and 84 deletions

View File

@@ -0,0 +1,49 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?listPreferredItemHeight"
android:gravity="center_vertical"
android:orientation="horizontal"
android:background="?selectableItemBackground"
android:clickable="true"
android:focusable="true">
<ImageView
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:id="@+id/key_list_item_icon"
tools:tint="@color/md_grey_600"
tools:src="@drawable/apps_k9"
/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/key_list_item_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:maxLines="1"
android:ellipsize="end"
tools:text="Use key: look@my.amazin.horse"
/>
<TextView
android:id="@+id/key_list_item_creation"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxLines="1"
android:textAppearance="?android:attr/textAppearanceSmall"
tools:visibility="visible"
tools:text="Created on 10/10/2010 10:00" />
</LinearLayout>
</LinearLayout>

View File

@@ -0,0 +1,582 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:custom="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
tools:layout_marginTop="24dp"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary"
android:elevation="4dp"
android:padding="16dp"
android:gravity="center_vertical"
tools:targetApi="lollipop">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:layout_marginStart="8dp"
android:src="@mipmap/ic_launcher"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:maxLines="1"
android:ellipsize="end"
android:text="@string/app_name"
style="?android:textAppearanceLarge"/>
<Space
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_more_vert_black_24dp"
android:background="?selectableItemBackground"
android:id="@+id/overflow_menu" />
</LinearLayout>
<TextView
android:id="@+id/text_title_select_key"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="22dp"
android:textAppearance="?android:attr/textAppearanceMedium"
tools:text="@string/title_select_key" />
<TextView
android:id="@+id/text_user_id"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:gravity="center_vertical"
android:minHeight="?listPreferredItemHeight"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textStyle="bold"
tools:text="look@my.amazin.horse"
/>
<org.sufficientlysecure.keychain.ui.widget.ToolableViewAnimator
android:id="@+id/layout_animator"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inAnimation="@anim/fade_in"
android:outAnimation="@anim/fade_out"
android:measureAllChildren="false"
custom:initialView="01">
<Space
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/select_key_layout_empty" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:id="@+id/select_key_layout_no_keys"
>
<LinearLayout
android:id="@+id/button_no_keys_new"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?selectableItemBackground"
android:gravity="center_vertical"
android:minHeight="?listPreferredItemHeight"
android:orientation="horizontal">
<ImageView
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:src="@drawable/ic_key_plus_grey600_24dp"
/>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<TextView
style="?android:textAppearanceMedium"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/no_keys_gen_title"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/no_keys_gen_subtitle"
/>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/button_no_keys_existing"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?selectableItemBackground"
android:gravity="center_vertical"
android:minHeight="?listPreferredItemHeight"
android:orientation="horizontal">
<ImageView
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:src="@drawable/ic_help_black_24dp"
android:tint="@color/md_grey_600"
/>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<TextView
style="?android:textAppearanceMedium"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/no_keys_import_title"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/no_keys_import_subtitle"
/>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/button_no_keys_cancel"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:background="?selectableItemBackground"
android:gravity="center_vertical"
android:minHeight="?listPreferredItemHeight"
android:orientation="horizontal">
<ImageView
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:src="@drawable/ic_close_black_24dp"
android:tint="@color/md_grey_600"
/>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<TextView
style="?android:textAppearanceMedium"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/select_identity_cancel"
/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/select_key_layout_key_list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<android.support.v7.widget.RecyclerView
android:id="@+id/identity_key_list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:layout_height="?listPreferredItemHeight"
tools:listitem="@layout/api_select_identity_item"
/>
<LinearLayout
android:id="@+id/button_key_list_other"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?selectableItemBackground"
android:gravity="center_vertical"
android:minHeight="?listPreferredItemHeight"
android:orientation="horizontal">
<ImageView
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:src="@drawable/ic_help_black_24dp"
android:tint="@color/md_grey_600"
/>
<TextView
style="?android:textAppearanceMedium"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/key_list_import"
/>
</LinearLayout>
<LinearLayout
android:id="@+id/button_key_list_cancel"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:background="?selectableItemBackground"
android:gravity="center_vertical"
android:minHeight="?listPreferredItemHeight"
android:orientation="horizontal">
<ImageView
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:src="@drawable/ic_close_black_24dp"
android:tint="@color/md_grey_600"
/>
<TextView
style="?android:textAppearanceMedium"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@android:string/cancel"
/>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/select_key_layout_import_expl"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:text="@string/key_import_text"
android:textAppearance="?android:attr/textAppearanceMedium"
/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:layout_gravity="center_horizontal"
android:id="@+id/button_goto_openkeychain"
android:background="?selectableItemBackground"
android:paddingLeft="12dp"
android:paddingRight="12dp"
>
<ImageView
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_marginRight="12dp"
android:layout_gravity="center_vertical"
android:src="@mipmap/ic_launcher"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="0dp"
android:paddingRight="0dp"
android:text="@string/button_goto_openkeychain"
android:clickable="false"
android:background="@android:color/transparent"
style="?buttonBarButtonStyle"/>
</LinearLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:id="@+id/key_import_autocrypt_hint"
android:text="@string/key_import_text_autocrypt_setup_msg"
android:textAppearance="?android:attr/textAppearanceMedium"
/>
<LinearLayout
style="?buttonBarStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_marginTop="12dp"
android:gravity="end"
android:orientation="horizontal"
android:padding="8dp">
<Button
android:id="@+id/button_expl_back"
style="?buttonBarButtonStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/button_back"
/>
<Space
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
/>
<Button
android:id="@+id/button_expl_got_it"
style="?buttonBarButtonStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:text="@string/button_got_it"
/>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?listPreferredItemHeight"
android:orientation="vertical"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:id="@+id/select_key_layout_generate_progress">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?listPreferredItemHeight">
<ProgressBar
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_gravity="center_vertical"
android:indeterminate="true"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text="@string/key_gen_progress"
android:textAppearance="?android:attr/textAppearanceMedium"
/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?listPreferredItemHeight"
android:background="?selectableItemBackground"
android:orientation="horizontal"
style="?buttonBarStyle">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:enabled="false"
android:text="@string/key_gen_back"
style="?buttonBarButtonStyle"
/>
<Space
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:enabled="false"
android:text="@string/key_gen_finish"
style="?buttonBarButtonStyle"
/>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:id="@+id/select_key_layout_generate_ok"
android:paddingLeft="16dp"
android:paddingRight="16dp"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?listPreferredItemHeight"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:src="@drawable/ic_check_black_24dp"
android:tint="@color/android_green_light"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text="@string/key_gen_done"
android:textAppearance="?android:attr/textAppearanceMedium"
/>
</LinearLayout>
<LinearLayout
android:id="@+id/button_gen_back"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?listPreferredItemHeight"
android:background="?selectableItemBackground"
android:orientation="horizontal"
style="?buttonBarStyle">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/button_genok_back"
android:text="@string/key_gen_back"
style="?buttonBarButtonStyle"
/>
<Space
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/button_genok_finish"
android:text="@string/key_gen_finish"
style="?buttonBarButtonStyle"
/>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:id="@+id/select_key_layout_generate_save"
android:paddingLeft="16dp"
android:paddingRight="16dp"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?listPreferredItemHeight"
android:gravity="center_vertical"
android:orientation="horizontal">
<ProgressBar
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:indeterminate="true"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text="@string/key_gen_finishing"
android:textAppearance="?android:attr/textAppearanceMedium"
/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?listPreferredItemHeight"
android:background="?selectableItemBackground"
android:orientation="horizontal"
style="?buttonBarStyle">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:enabled="false"
android:text="@string/key_gen_back"
style="?buttonBarButtonStyle"
/>
<Space
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:enabled="false"
android:text="@string/key_gen_finish"
style="?buttonBarButtonStyle"
/>
</LinearLayout>
</LinearLayout>
</org.sufficientlysecure.keychain.ui.widget.ToolableViewAnimator>
</LinearLayout>

View File

@@ -2,13 +2,15 @@
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?android:attr/listPreferredItemHeight"
android:paddingLeft="4dp"
android:paddingStart="4dp"
android:paddingRight="?android:attr/scrollbarSize"
android:maxLines="1">
android:paddingEnd="?android:attr/scrollbarSize"
android:maxLines="1"
tools:layout_marginTop="24dp">
<CheckBox
android:id="@+id/selected"

View File

@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?listPreferredItemHeight"
android:orientation="horizontal"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:background="?android:selectableItemBackground"
tools:layout_marginTop="24dp">
<ImageView
android:id="@+id/select_key_item_status_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:padding="16dp"
tools:src="@drawable/ic_vpn_key_grey_24dp"
/>
<LinearLayout
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical"
android:layout_gravity="center_vertical">
<TextView
android:id="@+id/select_key_item_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:text="Use Key: Alice"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="@+id/select_key_item_creation"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:text="Key created Dec 16, 2005, 12:18 PM"
android:textAppearance="?android:attr/textAppearanceSmall" />
</LinearLayout>
</LinearLayout>

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/list_all_keys"
android:title="@string/menu_list_unrelated_keys"
android:orderInCategory="1" />
</menu>

View File

@@ -2,6 +2,13 @@
<resources>
<!-- see http://stackoverflow.com/questions/32169303/activity-did-not-call-finish-api-23 -->
<style name="Theme.Keychain.Transparent" parent="@android:style/Theme.Translucent.NoTitleBar" />
<style name="Theme.Keychain.Transparent" parent="@android:style/Theme.Translucent.NoTitleBar">
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:colorBackgroundCacheHint">@null</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowAnimationStyle">@android:style/Animation.Translucent</item>
</style>
</resources>

View File

@@ -1774,6 +1774,8 @@
<string name="requested_key_unavailable_warning">This key is not available. To use it, you must import it as one of your own!</string>
<string name="button_allow">Allow</string>
<string name="button_cancel">Cancel</string>
<string name="button_back">Back</string>
<string name="button_got_it">Got it</string>
<string name="requested_key_label">Requested key:</string>
<string name="error_preselect_sign_key">Error selecting key %s for signing!</string>
<string name="error_preselect_encrypt_key">Error selecting key %s for encryption!</string>
@@ -1993,4 +1995,24 @@
<string name="label_usb_untested_summary">If enabled, USB Smartcard readers can be used that have not been properly tested.</string>
<string name="label_usb_untested">Allow untested USB Devices</string>
<string name="use_key">Use key: %s</string>
<string name="use_key_no_name">Use key: <![CDATA[<no name>]]></string>
<string name="title_select_key">%s wants to set up end-to-end encryption for this address:</string>
<string name="select_identity_cancel">Disable</string>
<string name="select_identity_create">Create a key for me</string>
<string name="error_save_key_internal">"Internal error saving key!"</string>
<string name="menu_list_unrelated_keys">List unrelated keys</string>
<string name="no_keys_gen_title">This is a new address</string>
<string name="no_keys_gen_subtitle">Create new end-to-end key in OpenKeychain</string>
<string name="no_keys_import_title">I already have a key</string>
<string name="no_keys_import_subtitle">Import end-to-end key from other device</string>
<string name="key_list_import">Use a different key</string>
<string name="key_gen_progress">Please wait…</string>
<string name="key_gen_back">Back</string>
<string name="key_gen_finish">Finish</string>
<string name="key_gen_done">Generated end-to-end key!</string>
<string name="key_gen_finishing">Finishing setup…</string>
<string name="key_import_text">To use an end-to-end key, it has to be imported into OpenKeychain.</string>
<string name="key_import_text_autocrypt_setup_msg">To import your existing setup from another device, you can also open an Autocrypt Setup Message in %s.</string>
<string name="button_goto_openkeychain">Go to OpenKeychain</string>
</resources>

View File

@@ -133,18 +133,17 @@
<item name="windowNoTitle">true</item>
</style>
<style name="Theme.Keychain.AppCompat.Transparent" parent="Theme.AppCompat.NoActionBar">
<style name="Theme.Keychain.AppCompat.Transparent" parent="Theme.AppCompat.Light.Dialog">
<item name="android:windowNoTitle">true</item>
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:colorBackgroundCacheHint">@null</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowFullscreen">true</item>
<item name="android:windowAnimationStyle">@style/Animation.AppCompat.Dialog</item>
<item name="android:windowAnimationStyle">@android:style/Animation.Translucent</item>
</style>
<style name="Theme.Keychain.AppCompat.Transparent.Fullscreen" parent="Theme.Keychain.AppCompat.Transparent">
<item name="android:windowFullscreen">true</item>
</style>
<style name="Theme.Keychain.Transparent" parent="@android:style/Theme.NoDisplay" />
<style name="Theme.Keychain.Transparent" parent="Theme.Keychain.AppCompat.Transparent" />
</resources>