Add key sharing buttons to ViewKeyActivity
parent
d1c64e3159
commit
d3ecbc8487
|
@ -106,6 +106,7 @@ import org.sufficientlysecure.keychain.ui.util.Notify.Style;
|
|||
import org.sufficientlysecure.keychain.ui.util.QrCodeUtils;
|
||||
import org.sufficientlysecure.keychain.util.ContactHelper;
|
||||
import org.sufficientlysecure.keychain.util.Preferences;
|
||||
import org.sufficientlysecure.keychain.util.ShareKeyHelper;
|
||||
import timber.log.Timber;
|
||||
|
||||
|
||||
|
@ -139,6 +140,8 @@ public class ViewKeyActivity extends BaseSecurityTokenActivity implements
|
|||
|
||||
private ImageButton actionEncryptFile;
|
||||
private ImageButton actionEncryptText;
|
||||
private ImageButton actionShare;
|
||||
private ImageButton actionShareClipboard;
|
||||
private FloatingActionButton floatingActionButton;
|
||||
private ImageView photoView;
|
||||
private FrameLayout photoLayout;
|
||||
|
@ -177,6 +180,8 @@ public class ViewKeyActivity extends BaseSecurityTokenActivity implements
|
|||
|
||||
actionEncryptFile = findViewById(R.id.view_key_action_encrypt_files);
|
||||
actionEncryptText = findViewById(R.id.view_key_action_encrypt_text);
|
||||
actionShare= findViewById(R.id.view_key_action_share);
|
||||
actionShareClipboard = findViewById(R.id.view_key_action_share_clipboard);
|
||||
floatingActionButton = findViewById(R.id.fab);
|
||||
photoView = findViewById(R.id.view_key_photo);
|
||||
photoLayout = findViewById(R.id.view_key_photo_layout);
|
||||
|
@ -189,6 +194,8 @@ public class ViewKeyActivity extends BaseSecurityTokenActivity implements
|
|||
|
||||
ContentDescriptionHint.setup(actionEncryptFile);
|
||||
ContentDescriptionHint.setup(actionEncryptText);
|
||||
ContentDescriptionHint.setup(actionShare);
|
||||
ContentDescriptionHint.setup(actionShareClipboard);
|
||||
ContentDescriptionHint.setup(floatingActionButton);
|
||||
|
||||
|
||||
|
@ -256,6 +263,8 @@ public class ViewKeyActivity extends BaseSecurityTokenActivity implements
|
|||
|
||||
actionEncryptFile.setOnClickListener(v -> encrypt(false));
|
||||
actionEncryptText.setOnClickListener(v -> encrypt(true));
|
||||
actionShare.setOnClickListener(v -> ShareKeyHelper.shareKey(this, unifiedKeyInfo));
|
||||
actionShareClipboard.setOnClickListener(v -> ShareKeyHelper.shareKeyToClipboard(this, unifiedKeyInfo));
|
||||
|
||||
floatingActionButton.setOnClickListener(v -> {
|
||||
if (unifiedKeyInfo.has_any_secret()) {
|
||||
|
@ -798,12 +807,16 @@ public class ViewKeyActivity extends BaseSecurityTokenActivity implements
|
|||
|
||||
actionEncryptFile.setVisibility(View.VISIBLE);
|
||||
actionEncryptText.setVisibility(View.VISIBLE);
|
||||
actionShare.setVisibility(View.VISIBLE);
|
||||
actionShareClipboard.setVisibility(View.VISIBLE);
|
||||
|
||||
showFab();
|
||||
floatingActionButton.setImageDrawable(ContextCompat.getDrawable(this, R.drawable.ic_repeat_white_24dp));
|
||||
} else {
|
||||
actionEncryptFile.setVisibility(View.VISIBLE);
|
||||
actionEncryptText.setVisibility(View.VISIBLE);
|
||||
actionShare.setVisibility(View.VISIBLE);
|
||||
actionShareClipboard.setVisibility(View.VISIBLE);
|
||||
qrCodeLayout.setVisibility(View.GONE);
|
||||
|
||||
if (unifiedKeyInfo.is_verified()) {
|
||||
|
|
|
@ -111,6 +111,26 @@
|
|||
android:src="@drawable/ic_action_encrypt_text_24dp"
|
||||
android:visibility="invisible"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/view_key_action_share"
|
||||
android:contentDescription="@string/share_key"
|
||||
style="?android:attr/borderlessButtonStyle"
|
||||
android:layout_width="64dp"
|
||||
android:layout_height="64dp"
|
||||
android:src="@drawable/ic_share_white_24dp"
|
||||
android:visibility="invisible"
|
||||
tools:visibility="visible"/>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/view_key_action_share_clipboard"
|
||||
android:contentDescription="@string/share_key_clipboard"
|
||||
style="?android:attr/borderlessButtonStyle"
|
||||
android:layout_width="64dp"
|
||||
android:layout_height="64dp"
|
||||
android:src="?attr/actionModeCopyDrawable"
|
||||
android:visibility="invisible"
|
||||
tools:visibility="visible"/>
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
|
|
|
@ -2063,4 +2063,6 @@
|
|||
<string name="subkey_action_strip">Subkey will be stripped</string>
|
||||
<string name="subkey_action_expiry_never">Expiry will change to never</string>
|
||||
<string name="subkey_action_expiry_date">Expiry will change to %s</string>
|
||||
<string name="share_key_clipboard">Share key via clipboard</string>
|
||||
<string name="share_key">Share key</string>
|
||||
</resources>
|
||||
|
|
Loading…
Reference in New Issue