diff options
author | Christian Schneppe <christian@pix-art.de> | 2019-09-20 23:53:07 +0200 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2019-09-20 23:53:07 +0200 |
commit | c0c1af1ccaf11856fa765f98e5d4ad8e0fb4ab0c (patch) | |
tree | d6f7d12a6ba1c8b7051cedcd19cb20368c4c4d8b /src/main | |
parent | 008d2895145e931fbb99a0f98d90ea5db880ef05 (diff) |
added overlay to avatar in EditAccountActivity
in addition to #390
Diffstat (limited to '')
-rw-r--r-- | src/main/java/de/pixart/messenger/persistance/FileBackend.java | 33 | ||||
-rw-r--r-- | src/main/java/de/pixart/messenger/ui/EditAccountActivity.java | 4 | ||||
-rw-r--r-- | src/main/java/de/pixart/messenger/ui/util/AvatarWorkerTask.java | 22 | ||||
-rw-r--r-- | src/main/res/drawable-hdpi/pencil_overlay.png | bin | 0 -> 1199 bytes | |||
-rw-r--r-- | src/main/res/drawable-mdpi/pencil_overlay.png | bin | 0 -> 1873 bytes | |||
-rw-r--r-- | src/main/res/drawable-xhdpi/pencil_overlay.png | bin | 0 -> 3465 bytes | |||
-rw-r--r-- | src/main/res/drawable-xxhdpi/pencil_overlay.png | bin | 0 -> 2119 bytes | |||
-rw-r--r-- | src/main/res/drawable-xxxhdpi/pencil_overlay.png | bin | 0 -> 9724 bytes | |||
-rw-r--r-- | src/main/res/layout/activity_edit_account.xml | 444 | ||||
-rw-r--r-- | src/main/res/values/strings.xml | 1 |
10 files changed, 276 insertions, 228 deletions
diff --git a/src/main/java/de/pixart/messenger/persistance/FileBackend.java b/src/main/java/de/pixart/messenger/persistance/FileBackend.java index e30cb028c..274b84c08 100644 --- a/src/main/java/de/pixart/messenger/persistance/FileBackend.java +++ b/src/main/java/de/pixart/messenger/persistance/FileBackend.java @@ -13,6 +13,7 @@ import android.graphics.Color; import android.graphics.Matrix; import android.graphics.Paint; import android.graphics.RectF; +import android.graphics.drawable.Drawable; import android.media.MediaMetadataRetriever; import android.media.MediaScannerConnection; import android.net.Uri; @@ -21,8 +22,6 @@ import android.os.Environment; import android.os.ParcelFileDescriptor; import android.provider.MediaStore; import android.provider.OpenableColumns; -import androidx.annotation.RequiresApi; -import androidx.core.content.FileProvider; import android.system.Os; import android.system.StructStat; import android.util.Base64; @@ -30,6 +29,9 @@ import android.util.Base64OutputStream; import android.util.Log; import android.util.LruCache; +import androidx.annotation.RequiresApi; +import androidx.core.content.FileProvider; + import java.io.ByteArrayOutputStream; import java.io.Closeable; import java.io.File; @@ -677,7 +679,7 @@ public class FileBackend { } } - private void drawOverlay(Bitmap bitmap, int resource, float factor) { + public void drawOverlay(final Bitmap bitmap, final int resource, final float factor) { Bitmap overlay = BitmapFactory.decodeResource(mXmppConnectionService.getResources(), resource); Canvas canvas = new Canvas(bitmap); float targetSize = Math.min(canvas.getWidth(), canvas.getHeight()) * factor; @@ -688,6 +690,31 @@ public class FileBackend { canvas.drawBitmap(overlay, null, dst, createAntiAliasingPaint()); } + public void drawOverlayFromDrawable(final Drawable drawable, final int resource, final float factor) { + Bitmap overlay = BitmapFactory.decodeResource(mXmppConnectionService.getResources(), resource); + Bitmap original = drawableToBitmap(drawable); + Canvas canvas = new Canvas(original); + float targetSize = Math.min(canvas.getWidth(), canvas.getHeight()) * factor; + Log.d(Config.LOGTAG, "target size overlay: " + targetSize + " overlay bitmap size was " + overlay.getHeight()); + float left = (canvas.getWidth() - targetSize) / 2.0f; + float top = (canvas.getHeight() - targetSize) / 2.0f; + RectF dst = new RectF(left, top, left + targetSize - 1, top + targetSize - 1); + canvas.drawBitmap(overlay, null, dst, createAntiAliasingPaint()); + } + + private static Bitmap drawableToBitmap(Drawable drawable) { + Bitmap bitmap = null; + if (drawable.getIntrinsicWidth() <= 0 || drawable.getIntrinsicHeight() <= 0) { + bitmap = Bitmap.createBitmap(1, 1, Bitmap.Config.ARGB_8888); // Single color bitmap will be created of 1x1 pixel + } else { + bitmap = Bitmap.createBitmap(drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight(), Bitmap.Config.ARGB_8888); + } + Canvas canvas = new Canvas(bitmap); + drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight()); + drawable.draw(canvas); + return bitmap; + } + private static Paint createAntiAliasingPaint() { Paint paint = new Paint(); paint.setAntiAlias(true); diff --git a/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java b/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java index 8d5712bf5..f3488a3fc 100644 --- a/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java +++ b/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java @@ -671,7 +671,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat } private void refreshAvatar() { - AvatarWorkerTask.loadAvatar(mAccount, binding.avater, R.dimen.avatar_on_details_screen_size); + AvatarWorkerTask.loadAvatar(mAccount, binding.avater, R.dimen.avatar_on_details_screen_size, true); } @Override @@ -1154,7 +1154,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat if (!mInitMode) { binding.avater.setVisibility(View.VISIBLE); - AvatarWorkerTask.loadAvatar(mAccount, binding.avater, R.dimen.avatar_on_details_screen_size); + refreshAvatar(); this.binding.accountJid.setEnabled(false); } else { binding.avater.setVisibility(View.GONE); diff --git a/src/main/java/de/pixart/messenger/ui/util/AvatarWorkerTask.java b/src/main/java/de/pixart/messenger/ui/util/AvatarWorkerTask.java index 54cb3c2a1..738f387de 100644 --- a/src/main/java/de/pixart/messenger/ui/util/AvatarWorkerTask.java +++ b/src/main/java/de/pixart/messenger/ui/util/AvatarWorkerTask.java @@ -4,6 +4,7 @@ import android.content.res.Resources; import android.graphics.Bitmap; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; +import android.graphics.drawable.LayerDrawable; import android.os.AsyncTask; import androidx.annotation.DimenRes; import android.widget.ImageView; @@ -11,6 +12,7 @@ import android.widget.ImageView; import java.lang.ref.WeakReference; import java.util.concurrent.RejectedExecutionException; +import de.pixart.messenger.R; import de.pixart.messenger.services.AvatarService; import de.pixart.messenger.ui.XmppActivity; @@ -72,22 +74,36 @@ public class AvatarWorkerTask extends AsyncTask<AvatarService.Avatarable, Void, } public static void loadAvatar(final AvatarService.Avatarable avatarable, final ImageView imageView, final @DimenRes int size) { + loadAvatar(avatarable, imageView, size, false); + } + + public static void loadAvatar(final AvatarService.Avatarable avatarable, final ImageView imageView, final @DimenRes int size, final boolean overlay) { if (cancelPotentialWork(avatarable, imageView)) { final XmppActivity activity = XmppActivity.find(imageView); if (activity == null) { return; } - final Bitmap bm = activity.avatarService().get(avatarable, (int) activity.getResources().getDimension(size), true); + final Bitmap bm = activity.avatarService().get(avatarable, (int) activity.getResources().getDimension(size), false); if (bm != null) { cancelPotentialWork(avatarable, imageView); - imageView.setImageBitmap(bm); + if (overlay) { + activity.xmppConnectionService.fileBackend.drawOverlay(bm, R.drawable.pencil_overlay, 1.0f); + imageView.setImageBitmap(bm); + } else { + imageView.setImageBitmap(bm); + } imageView.setBackgroundColor(0x00000000); } else { imageView.setBackgroundColor(avatarable.getAvatarBackgroundColor()); imageView.setImageDrawable(null); final AvatarWorkerTask task = new AvatarWorkerTask(imageView, size); final AsyncDrawable asyncDrawable = new AsyncDrawable(activity.getResources(), null, task); - imageView.setImageDrawable(asyncDrawable); + if (overlay) { + activity.xmppConnectionService.fileBackend.drawOverlayFromDrawable(asyncDrawable, R.drawable.pencil_overlay, 1.0f); + imageView.setImageDrawable(asyncDrawable); + } else { + imageView.setImageDrawable(asyncDrawable); + } try { task.execute(avatarable); } catch (final RejectedExecutionException ignored) { diff --git a/src/main/res/drawable-hdpi/pencil_overlay.png b/src/main/res/drawable-hdpi/pencil_overlay.png Binary files differnew file mode 100644 index 000000000..78c3b4e16 --- /dev/null +++ b/src/main/res/drawable-hdpi/pencil_overlay.png diff --git a/src/main/res/drawable-mdpi/pencil_overlay.png b/src/main/res/drawable-mdpi/pencil_overlay.png Binary files differnew file mode 100644 index 000000000..daedd4d9f --- /dev/null +++ b/src/main/res/drawable-mdpi/pencil_overlay.png diff --git a/src/main/res/drawable-xhdpi/pencil_overlay.png b/src/main/res/drawable-xhdpi/pencil_overlay.png Binary files differnew file mode 100644 index 000000000..6cdbe555b --- /dev/null +++ b/src/main/res/drawable-xhdpi/pencil_overlay.png diff --git a/src/main/res/drawable-xxhdpi/pencil_overlay.png b/src/main/res/drawable-xxhdpi/pencil_overlay.png Binary files differnew file mode 100644 index 000000000..12c95c2f5 --- /dev/null +++ b/src/main/res/drawable-xxhdpi/pencil_overlay.png diff --git a/src/main/res/drawable-xxxhdpi/pencil_overlay.png b/src/main/res/drawable-xxxhdpi/pencil_overlay.png Binary files differnew file mode 100644 index 000000000..f98e658a1 --- /dev/null +++ b/src/main/res/drawable-xxxhdpi/pencil_overlay.png diff --git a/src/main/res/layout/activity_edit_account.xml b/src/main/res/layout/activity_edit_account.xml index fd2cb6b3a..a4638fee3 100644 --- a/src/main/res/layout/activity_edit_account.xml +++ b/src/main/res/layout/activity_edit_account.xml @@ -48,7 +48,7 @@ android:id="@+id/jid_password_box" android:layout_width="fill_parent" android:layout_height="wrap_content" - android:layout_below="@+id/nick_avatar_box" + android:layout_below="@+id/status_avatar_box" android:orientation="vertical"> <LinearLayout @@ -174,70 +174,71 @@ </LinearLayout> <RelativeLayout - android:id="@+id/nick_avatar_box" - android:layout_width="match_parent" + android:id="@+id/your_name_box" + android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_alignParentTop="true" - android:layout_marginBottom="@dimen/activity_vertical_margin" - android:orientation="horizontal"> + android:layout_marginStart="6dp" + android:layout_marginLeft="6dp" + android:visibility="gone"> - <RelativeLayout + <ImageButton + android:id="@+id/action_edit_your_name" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_toEndOf="@+id/avater" - android:layout_toRightOf="@+id/avater" + android:layout_alignParentEnd="true" + android:layout_alignParentRight="true" + android:layout_centerVertical="true" + android:alpha="?attr/icon_alpha" + android:background="?attr/selectableItemBackgroundBorderless" + android:padding="@dimen/image_button_padding" + android:src="?attr/icon_edit_body" + android:visibility="visible" /> + + <LinearLayout + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignParentStart="true" + android:layout_alignParentLeft="true" + android:layout_centerVertical="true" + android:layout_toStartOf="@+id/action_edit_your_name" + android:layout_toLeftOf="@+id/action_edit_your_name" android:orientation="vertical"> - <RelativeLayout - android:id="@+id/your_name_box" + <TextView + android:id="@+id/your_name_desc" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:visibility="gone"> - - <ImageButton - android:id="@+id/action_edit_your_name" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_alignParentEnd="true" - android:layout_alignParentRight="true" - android:layout_centerVertical="true" - android:alpha="?attr/icon_alpha" - android:background="?attr/selectableItemBackgroundBorderless" - android:padding="@dimen/image_button_padding" - android:src="?attr/icon_edit_body" - android:visibility="visible" /> + android:text="@string/your_name" + android:textAppearance="@style/TextAppearance.Conversations.Caption" /> - <LinearLayout - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_alignParentStart="true" - android:layout_alignParentLeft="true" - android:layout_centerVertical="true" - android:layout_toStartOf="@+id/action_edit_your_name" - android:layout_toLeftOf="@+id/action_edit_your_name" - android:orientation="vertical"> + <TextView + android:id="@+id/your_name" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/no_name_set_instructions" + android:textAppearance="@style/TextAppearance.Conversations.Body1.Tertiary" /> + </LinearLayout> + </RelativeLayout> - <TextView - android:id="@+id/your_name_desc" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/your_name" - android:textAppearance="@style/TextAppearance.Conversations.Caption" /> + <RelativeLayout + android:id="@+id/status_avatar_box" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_below="@+id/your_name_box" + android:layout_marginBottom="@dimen/activity_vertical_margin" + android:orientation="horizontal"> - <TextView - android:id="@+id/your_name" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/no_name_set_instructions" - android:textAppearance="@style/TextAppearance.Conversations.Body1.Tertiary" /> - </LinearLayout> - </RelativeLayout> + <RelativeLayout + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_toEndOf="@+id/avater" + android:layout_toRightOf="@+id/avater" + android:orientation="vertical"> <RelativeLayout android:id="@+id/your_status_box" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_below="@+id/your_name_box" android:visibility="gone"> <ImageButton @@ -374,15 +375,10 @@ android:id="@+id/stats" android:layout_width="fill_parent" android:layout_height="fill_parent" - android:layout_marginStart="@dimen/activity_horizontal_margin" + android:layout_marginBottom="@dimen/activity_vertical_margin" android:layout_marginLeft="@dimen/activity_horizontal_margin" - android:layout_marginTop="@dimen/activity_vertical_margin" - android:layout_marginEnd="@dimen/activity_horizontal_margin" android:layout_marginRight="@dimen/activity_horizontal_margin" - android:layout_marginBottom="@dimen/activity_vertical_margin" - android:background="@drawable/infocard_border" - android:orientation="vertical" - android:padding="@dimen/card_padding_regular" + android:layout_marginTop="@dimen/activity_vertical_margin" android:visibility="gone"> <LinearLayout @@ -391,161 +387,44 @@ android:orientation="vertical" android:padding="@dimen/card_padding_regular"> - <RelativeLayout - android:id="@+id/pgp_fingerprint_box" - android:layout_width="wrap_content" - android:layout_height="match_parent" - android:layout_marginTop="32dp"> - - <ImageButton - android:id="@+id/action_delete_pgp" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_alignParentEnd="true" - android:layout_alignParentRight="true" - android:layout_centerVertical="true" - android:alpha="1.0" - android:background="?attr/selectableItemBackgroundBorderless" - android:padding="@dimen/image_button_padding" - android:src="?attr/icon_remove" - android:visibility="visible" /> - - <LinearLayout - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_alignParentStart="true" - android:layout_alignParentLeft="true" - android:layout_centerVertical="true" - android:layout_toStartOf="@+id/action_delete_pgp" - android:layout_toLeftOf="@+id/action_delete_pgp" - android:orientation="vertical"> - - <TextView - android:id="@+id/pgp_fingerprint" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:textAppearance="@style/TextAppearance.Conversations.Fingerprint" /> - - <TextView - android:id="@+id/pgp_fingerprint_desc" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/openpgp_key_id" - android:textAppearance="@style/TextAppearance.Conversations.Caption" /> - </LinearLayout> - </RelativeLayout> - - <RelativeLayout - android:id="@+id/otr_fingerprint_box" - android:layout_width="wrap_content" - android:layout_height="match_parent" - android:layout_marginTop="24dp"> - - <LinearLayout - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_alignParentStart="true" - android:layout_alignParentLeft="true" - android:layout_centerVertical="true" - android:layout_toStartOf="@+id/key_actions" - android:layout_toLeftOf="@+id/key_actions" - android:orientation="vertical"> - - <TextView - android:id="@+id/otr_fingerprint" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:textAppearance="@style/TextAppearance.Conversations.Fingerprint" /> - - <TextView - android:id="@+id/otr_fingerprint_desc" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/otr_fingerprint" - android:textAppearance="@style/TextAppearance.Conversations.Caption" /> - - </LinearLayout> - - <LinearLayout - android:id="@+id/key_actions" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_alignParentEnd="true" - android:layout_alignParentRight="true" - android:layout_centerVertical="true" - android:orientation="horizontal"> - - <ImageButton - android:id="@+id/action_copy_to_clipboard" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:background="?attr/selectableItemBackgroundBorderless" - android:contentDescription="@string/copy_otr_clipboard_description" - android:padding="@dimen/image_button_padding" - android:src="?attr/icon_copy" - android:visibility="visible" /> - </LinearLayout> - </RelativeLayout> - - <RelativeLayout - android:id="@+id/axolotl_fingerprint_box" + <TextView + android:id="@+id/this_device_keys_title" android:layout_width="wrap_content" - android:layout_height="match_parent" - android:layout_marginTop="24dp"> + android:layout_height="wrap_content" + android:layout_marginTop="@dimen/list_padding" + android:layout_marginBottom="@dimen/list_padding" + android:text="@string/this_device" + android:textAppearance="@style/TextAppearance.Conversations.Title" /> - <LinearLayout - android:layout_width="wrap_content" + <TableLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:shrinkColumns="0" + android:stretchColumns="1"> + <TableRow + android:layout_width="fill_parent" android:layout_height="wrap_content" - android:layout_alignParentStart="true" - android:layout_alignParentLeft="true" - android:layout_centerVertical="true" - android:layout_toStartOf="@+id/axolotl_actions" - android:layout_toLeftOf="@+id/axolotl_actions" - android:orientation="vertical"> + tools:ignore="UselessParent"> <TextView - android:id="@+id/axolotl_fingerprint" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:textAppearance="@style/TextAppearance.Conversations.Fingerprint" /> + android:ellipsize="end" + android:singleLine="true" + android:text="@string/server_info_session_established" + android:textAppearance="@style/TextAppearance.Conversations.Body1" /> <TextView - android:id="@+id/own_fingerprint_desc" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:textAppearance="@style/TextAppearance.Conversations.Caption" /> - </LinearLayout> - - <LinearLayout - android:id="@+id/axolotl_actions" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_alignParentEnd="true" - android:layout_alignParentRight="true" - android:layout_centerVertical="true" - android:orientation="horizontal"> - - <ImageButton - android:id="@+id/action_copy_axolotl_to_clipboard" + android:id="@+id/session_est" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:background="?attr/selectableItemBackgroundBorderless" - android:contentDescription="@string/copy_omemo_clipboard_description" - android:padding="@dimen/image_button_padding" - android:src="?attr/icon_copy" - android:visibility="visible" /> + android:layout_gravity="end" + android:paddingStart="4dp" + android:paddingLeft="4dp" + android:textAppearance="@style/TextAppearance.Conversations.Body1" /> + </TableRow> - <ImageButton - android:id="@+id/action_regenerate_omemo_key" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:background="?attr/selectableItemBackgroundBorderless" - android:contentDescription="@string/regenerate_omemo_key" - android:padding="@dimen/image_button_padding" - android:src="?attr/icon_refresh" - android:visibility="gone" /> - </LinearLayout> - </RelativeLayout> + </TableLayout> <TableLayout android:id="@+id/server_info_more" @@ -779,40 +658,165 @@ </TableRow> </TableLayout> - <TableLayout + <View android:layout_width="match_parent" - android:layout_height="wrap_content" - android:shrinkColumns="0" - android:stretchColumns="1"> + android:layout_height="8dp" /> - <TableRow - android:layout_width="fill_parent" + <RelativeLayout + android:id="@+id/pgp_fingerprint_box" + android:layout_width="wrap_content" + android:layout_height="match_parent" + android:layout_marginTop="32dp"> + + <ImageButton + android:id="@+id/action_delete_pgp" + android:layout_width="wrap_content" android:layout_height="wrap_content" - tools:ignore="UselessParent"> + android:layout_alignParentEnd="true" + android:layout_alignParentRight="true" + android:layout_centerVertical="true" + android:alpha="1.0" + android:background="?attr/selectableItemBackgroundBorderless" + android:padding="@dimen/image_button_padding" + android:src="?attr/icon_remove" + android:visibility="visible" /> + + <LinearLayout + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignParentStart="true" + android:layout_alignParentLeft="true" + android:layout_centerVertical="true" + android:layout_toStartOf="@+id/action_delete_pgp" + android:layout_toLeftOf="@+id/action_delete_pgp" + android:orientation="vertical"> <TextView + android:id="@+id/pgp_fingerprint" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:ellipsize="end" - android:singleLine="true" - android:text="@string/server_info_session_established" - android:textAppearance="@style/TextAppearance.Conversations.Body1" /> + android:textAppearance="@style/TextAppearance.Conversations.Fingerprint" /> <TextView - android:id="@+id/session_est" + android:id="@+id/pgp_fingerprint_desc" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_gravity="end" - android:paddingStart="4dp" - android:paddingLeft="4dp" - android:textAppearance="@style/TextAppearance.Conversations.Body1" /> - </TableRow> + android:text="@string/openpgp_key_id" + android:textAppearance="@style/TextAppearance.Conversations.Caption" /> + </LinearLayout> + </RelativeLayout> - </TableLayout> + <RelativeLayout + android:id="@+id/otr_fingerprint_box" + android:layout_width="wrap_content" + android:layout_height="match_parent" + android:layout_marginTop="24dp"> - <View - android:layout_width="match_parent" - android:layout_height="8dp" /> + <LinearLayout + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignParentStart="true" + android:layout_alignParentLeft="true" + android:layout_centerVertical="true" + android:layout_toStartOf="@+id/key_actions" + android:layout_toLeftOf="@+id/key_actions" + android:orientation="vertical"> + + <TextView + android:id="@+id/otr_fingerprint" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:textAppearance="@style/TextAppearance.Conversations.Fingerprint" /> + + <TextView + android:id="@+id/otr_fingerprint_desc" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/otr_fingerprint" + android:textAppearance="@style/TextAppearance.Conversations.Caption" /> + + </LinearLayout> + + <LinearLayout + android:id="@+id/key_actions" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignParentEnd="true" + android:layout_alignParentRight="true" + android:layout_centerVertical="true" + android:orientation="horizontal"> + + <ImageButton + android:id="@+id/action_copy_to_clipboard" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:background="?attr/selectableItemBackgroundBorderless" + android:contentDescription="@string/copy_otr_clipboard_description" + android:padding="@dimen/image_button_padding" + android:src="?attr/icon_copy" + android:visibility="visible" /> + </LinearLayout> + </RelativeLayout> + + <RelativeLayout + android:id="@+id/axolotl_fingerprint_box" + android:layout_width="wrap_content" + android:layout_height="match_parent" + android:layout_marginTop="24dp"> + + <LinearLayout + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignParentStart="true" + android:layout_alignParentLeft="true" + android:layout_centerVertical="true" + android:layout_toStartOf="@+id/axolotl_actions" + android:layout_toLeftOf="@+id/axolotl_actions" + android:orientation="vertical"> + + <TextView + android:id="@+id/axolotl_fingerprint" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:textAppearance="@style/TextAppearance.Conversations.Fingerprint" /> + + <TextView + android:id="@+id/own_fingerprint_desc" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:textAppearance="@style/TextAppearance.Conversations.Caption" /> + </LinearLayout> + + <LinearLayout + android:id="@+id/axolotl_actions" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignParentEnd="true" + android:layout_alignParentRight="true" + android:layout_centerVertical="true" + android:orientation="horizontal"> + + <ImageButton + android:id="@+id/action_copy_axolotl_to_clipboard" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:background="?attr/selectableItemBackgroundBorderless" + android:contentDescription="@string/copy_omemo_clipboard_description" + android:padding="@dimen/image_button_padding" + android:src="?attr/icon_copy" + android:visibility="visible" /> + + <ImageButton + android:id="@+id/action_regenerate_omemo_key" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:background="?attr/selectableItemBackgroundBorderless" + android:contentDescription="@string/regenerate_omemo_key" + android:padding="@dimen/image_button_padding" + android:src="?attr/icon_refresh" + android:visibility="gone" /> + </LinearLayout> + </RelativeLayout> </LinearLayout> </androidx.cardview.widget.CardView> diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml index 420b13b2f..47dfc1b9b 100644 --- a/src/main/res/values/strings.xml +++ b/src/main/res/values/strings.xml @@ -940,4 +940,5 @@ <string name="your_status">Your status</string> <string name="pref_use_invidious">Replace YouTube links with Invidious</string> <string name="pref_use_invidious_summary">Invidious is a privacy friendly alternative to YouTube</string> + <string name="this_device">This device</string> </resources> |