Merge branch 'main' into adb/issue-4082

This commit is contained in:
adb
2025-12-07 17:21:50 +01:00
committed by GitHub
4 changed files with 79 additions and 33 deletions
+1
View File
@@ -16,6 +16,7 @@
* Fix: avoid crash in push notifications handling
* Fix: avoid freezing in background
* Fix: clean up web storage of deleted in-chat apps
* Fix: avoid crash when exporting some files with wrong image MIME type
* Expose new "Multi-device mode" option instead of "Delete from server" for chatmail profiles
* Opened in-chat apps got a 'About Apps' menu item
* Avoid gray avatar on profile creation
@@ -65,6 +65,7 @@ public class RelayListAdapter extends RecyclerView.Adapter<RelayListAdapter.Rela
public static class RelayViewHolder extends RecyclerView.ViewHolder {
private final TextView titleText;
private final TextView subtitleText;
private final ImageView mainIndicator;
private final ImageView editButton;
private final ImageView deleteButton;
@@ -72,14 +73,17 @@ public class RelayListAdapter extends RecyclerView.Adapter<RelayListAdapter.Rela
public RelayViewHolder(@NonNull View itemView) {
super(itemView);
titleText = itemView.findViewById(R.id.title);
subtitleText = itemView.findViewById(R.id.subtitle);
mainIndicator = itemView.findViewById(R.id.main_indicator);
editButton = itemView.findViewById(R.id.edit_button);
deleteButton = itemView.findViewById(R.id.delete_button);
}
public void bind(EnteredLoginParam relay, boolean isMain, OnRelayClickListener listener) {
titleText.setText(relay.addr);
mainIndicator.setVisibility(isMain ? View.VISIBLE : View.GONE);
String[] parts = relay.addr.split("@");
titleText.setText(parts.length == 2? parts[1] : parts[0]);
subtitleText.setText(parts.length == 2? parts[0] : "");
mainIndicator.setVisibility(isMain ? View.VISIBLE : View.INVISIBLE);
deleteButton.setVisibility(isMain ? View.GONE : View.VISIBLE);
itemView.setOnClickListener(v -> {
@@ -152,13 +152,32 @@ public class SaveAttachmentTask extends ProgressDialogAsyncTask<SaveAttachmentTa
return StorageUtil.getVideoUri();
} else if (contentType.startsWith("audio/")) {
return StorageUtil.getAudioUri();
} else if (contentType.startsWith("image/")) {
} else if (isMediaStoreImageType(contentType)) {
return StorageUtil.getImageUri();
} else {
return StorageUtil.getDownloadUri();
}
}
/**
* Checks if the content type is a standard image format supported by Android's MediaStore.
* Non-standard image formats (like XCF, PSD, etc.) should be saved to Downloads instead.
*/
private boolean isMediaStoreImageType(@NonNull String contentType) {
if (!contentType.startsWith("image/")) {
return false;
}
return contentType.equals("image/jpeg") ||
contentType.equals("image/jpg") ||
contentType.equals("image/png") ||
contentType.equals("image/gif") ||
contentType.equals("image/webp") ||
contentType.equals("image/bmp") ||
contentType.equals("image/heic") ||
contentType.equals("image/heif") ||
contentType.equals("image/avif");
}
private @Nullable File ensureExternalPath(@Nullable File path) {
if (path != null && path.exists()) {
return path;
@@ -197,7 +216,7 @@ public class SaveAttachmentTask extends ProgressDialogAsyncTask<SaveAttachmentTa
storage = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_MOVIES);
} else if (contentType.startsWith("audio/")) {
storage = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_MUSIC);
} else if (contentType.startsWith("image/")) {
} else if (isMediaStoreImageType(contentType)) {
storage = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);
}
+51 -29
View File
@@ -15,40 +15,49 @@
android:background="?attr/conversation_list_item_background"
android:gravity="center_vertical">
<ImageView
android:id="@+id/main_indicator"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginEnd="16dp"
android:src="@drawable/ic_check_white_24dp"
android:contentDescription="@string/def"
android:visibility="gone"
app:tint="?attr/colorAccent"
tools:visibility="visible" />
<ImageView
android:id="@+id/main_indicator"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginEnd="16dp"
android:src="@drawable/ic_check_white_24dp"
android:contentDescription="@string/def"
android:visibility="invisible"
app:tint="?attr/colorAccent"
tools:visibility="visible" />
<TextView
android:id="@+id/title"
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:singleLine="true"
android:ellipsize="marquee"
android:fontFamily="sans-serif"
android:textSize="16sp"
tools:text="user@example.com" />
android:orientation="vertical"
android:gravity="center_vertical">
<ImageView
android:id="@+id/edit_button"
android:layout_width="48dp"
android:layout_height="72dp"
android:paddingStart="12dp"
android:paddingEnd="12dp"
android:clickable="true"
android:focusable="true"
android:contentDescription="@string/edit_transport"
android:background="@drawable/touch_highlight_background"
android:src="@drawable/ic_create_white_24dp"
app:tint="?attr/conversation_list_item_date_color" />
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="2dp"
android:singleLine="true"
android:ellipsize="marquee"
android:fontFamily="sans-serif-medium"
android:textColor="?attr/conversation_list_item_contact_color"
android:textSize="16sp"
style="@style/Signal.Text.Body"
tools:text="example.com" />
<TextView
android:id="@+id/subtitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:ellipsize="marquee"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textSize="14sp"
android:fontFamily="sans-serif-light"
tools:text="a2sf029ve"/>
</LinearLayout>
<ImageView
android:id="@+id/delete_button"
@@ -63,4 +72,17 @@
android:src="@drawable/ic_delete_white_24dp"
app:tint="?attr/conversation_list_item_date_color" />
<ImageView
android:id="@+id/edit_button"
android:layout_width="48dp"
android:layout_height="72dp"
android:paddingStart="12dp"
android:paddingEnd="12dp"
android:clickable="true"
android:focusable="true"
android:contentDescription="@string/edit_transport"
android:background="@drawable/touch_highlight_background"
android:src="@drawable/ic_create_white_24dp"
app:tint="?attr/conversation_list_item_date_color" />
</LinearLayout>