Message details activity styling fixes.

Message details activity is available form the conversation context menu.
This commit is contained in:
Anton Chekulaev 2020-09-11 17:27:57 +10:00
parent 2991bd37c7
commit 655d971727
18 changed files with 70 additions and 28 deletions

View File

@ -310,7 +310,7 @@
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize" android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"
android:label="Message Details" android:label="Message Details"
android:screenOrientation="portrait" android:screenOrientation="portrait"
android:theme="@style/Theme.Session.DayNight" android:theme="@style/Theme.TextSecure.DayNight"
android:launchMode="singleTask" android:launchMode="singleTask"
android:windowSoftInputMode="stateHidden" /> android:windowSoftInputMode="stateHidden" />
<activity <activity

Binary file not shown.

Before

Width:  |  Height:  |  Size: 693 B

View File

@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM13,17h-2v-6h2v6zM13,9h-2L11,7h2v2z"/>
</vector>

View File

@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M17.65,6.35C16.2,4.9 14.21,4 12,4c-4.42,0 -7.99,3.58 -7.99,8s3.57,8 7.99,8c3.73,0 6.84,-2.55 7.73,-6h-2.08c-0.82,2.33 -3.04,4 -5.65,4 -3.31,0 -6,-2.69 -6,-6s2.69,-6 6,-6c1.66,0 3.14,0.69 4.22,1.78L13,11h7V4l-2.35,2.35z"/>
</vector>

View File

@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M11,7h2v2h-2zM11,11h2v6h-2zM12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM12,20c-4.41,0 -8,-3.59 -8,-8s3.59,-8 8,-8 8,3.59 8,8 -3.59,8 -8,8z"/>
</vector>

View File

@ -41,13 +41,14 @@
android:id="@+id/resend_button" android:id="@+id/resend_button"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="38sp" android:layout_height="38sp"
style="@style/InfoButton" style="@style/Widget.Session.Button.Common.ProminentOutline"
android:paddingStart="10dp" android:paddingStart="10dp"
android:paddingEnd="10dp" android:paddingEnd="10dp"
android:paddingTop="5dp" android:paddingTop="5dp"
android:paddingBottom="5dp" android:paddingBottom="5dp"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:drawableStart="@drawable/ic_refresh_white_18dp" android:drawableStart="@drawable/ic_baseline_refresh_24"
android:drawablePadding="4dp"
android:text="@string/message_recipients_list_item__resend" android:text="@string/message_recipients_list_item__resend"
android:visibility="gone" android:visibility="gone"
tools:visibility="visible" /> tools:visibility="visible" />

View File

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto"> <menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto">
<!-- <item android:title="@string/conversation_context__menu_message_details" <item android:title="@string/conversation_context__menu_message_details"
android:id="@+id/menu_context_details" android:id="@+id/menu_context_details"
android:icon="?menu_info_icon" android:icon="?menu_info_icon"
app:showAsAction="always" /> --> app:showAsAction="always" />
<item android:title="@string/conversation_context__menu_delete_message" <item android:title="@string/conversation_context__menu_delete_message"
android:id="@+id/menu_context_delete_message" android:id="@+id/menu_context_delete_message"

View File

@ -1,14 +1,16 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources xmlns:tools="http://schemas.android.com/tools">
<style name="Widget.Session.Button.Common.ProminentOutline"> <style name="Widget.Session.Button.Common.ProminentOutline">
<item name="android:background">@drawable/prominent_outline_button_medium_background</item> <item name="android:background">@drawable/prominent_outline_button_medium_background</item>
<item name="android:textColor">?android:textColorPrimary</item> <item name="android:textColor">?android:textColorPrimary</item>
<item name="android:drawableTint" tools:ignore="NewApi">?android:textColorPrimary</item>
</style> </style>
<style name="Widget.Session.Button.Common.ProminentFilled"> <style name="Widget.Session.Button.Common.ProminentFilled">
<item name="android:background">@drawable/prominent_filled_button_medium_background</item> <item name="android:background">@drawable/prominent_filled_button_medium_background</item>
<item name="android:textColor">@android:color/white</item> <item name="android:textColor">@android:color/white</item>
<item name="android:drawableTint" tools:ignore="NewApi">@android:color/white</item>
</style> </style>
<style name="FakeChatViewMessageBubble.Incoming"> <style name="FakeChatViewMessageBubble.Incoming">

View File

@ -25,6 +25,8 @@
<item name="quick_camera_icon">@drawable/ic_outline_photo_camera_24</item> <item name="quick_camera_icon">@drawable/ic_outline_photo_camera_24</item>
<item name="media_keyboard_button_color">@color/core_grey_60</item> <item name="media_keyboard_button_color">@color/core_grey_60</item>
<item name="menu_info_icon">@drawable/ic_outline_info_24</item>
</style> </style>
<style name="Theme.Session.DayNight" parent="Theme.Session.Light"> <style name="Theme.Session.DayNight" parent="Theme.Session.Light">

View File

@ -113,6 +113,7 @@
<attr name="menu_block_icon" format="reference" /> <attr name="menu_block_icon" format="reference" />
<attr name="menu_photo_library_icon" format="reference" /> <attr name="menu_photo_library_icon" format="reference" />
<attr name="menu_delete_icon" format="reference" /> <attr name="menu_delete_icon" format="reference" />
<attr name="menu_info_icon" format="reference" />
<attr name="pref_icon_tint" format="color"/> <attr name="pref_icon_tint" format="color"/>

View File

@ -74,21 +74,25 @@
<style name="Widget.Session.Button.Common.ProminentFilled"> <style name="Widget.Session.Button.Common.ProminentFilled">
<item name="android:background">@drawable/prominent_filled_button_medium_background</item> <item name="android:background">@drawable/prominent_filled_button_medium_background</item>
<item name="android:textColor">?android:textColorPrimary</item> <item name="android:textColor">?android:textColorPrimary</item>
<item name="android:drawableTint" tools:ignore="NewApi">?android:textColorPrimary</item>
</style> </style>
<style name="Widget.Session.Button.Common.ProminentOutline"> <style name="Widget.Session.Button.Common.ProminentOutline">
<item name="android:background">@drawable/prominent_outline_button_medium_background</item> <item name="android:background">@drawable/prominent_outline_button_medium_background</item>
<item name="android:textColor">@color/accent</item> <item name="android:textColor">@color/accent</item>
<item name="android:drawableTint" tools:ignore="NewApi">@color/accent</item>
</style> </style>
<style name="Widget.Session.Button.Common.UnimportantFilled"> <style name="Widget.Session.Button.Common.UnimportantFilled">
<item name="android:background">@drawable/unimportant_filled_button_medium_background</item> <item name="android:background">@drawable/unimportant_filled_button_medium_background</item>
<item name="android:textColor">?android:textColorPrimary</item> <item name="android:textColor">?android:textColorPrimary</item>
<item name="android:drawableTint" tools:ignore="NewApi">?android:textColorPrimary</item>
</style> </style>
<style name="Widget.Session.Button.Common.UnimportantOutline"> <style name="Widget.Session.Button.Common.UnimportantOutline">
<item name="android:background">@drawable/unimportant_outline_button_medium_background</item> <item name="android:background">@drawable/unimportant_outline_button_medium_background</item>
<item name="android:textColor">?android:textColorPrimary</item> <item name="android:textColor">?android:textColorPrimary</item>
<item name="android:drawableTint" tools:ignore="NewApi">?android:textColorPrimary</item>
</style> </style>
<style name="Widget.Session.Button.Dialog" parent=""> <style name="Widget.Session.Button.Dialog" parent="">

View File

@ -77,6 +77,7 @@
<item name="menu_selectall_icon">@drawable/ic_baseline_select_all_24</item> <item name="menu_selectall_icon">@drawable/ic_baseline_select_all_24</item>
<item name="menu_split_icon">@drawable/ic_baseline_call_split_24</item> <item name="menu_split_icon">@drawable/ic_baseline_call_split_24</item>
<item name="menu_popup_expand">@drawable/ic_baseline_launch_24</item> <item name="menu_popup_expand">@drawable/ic_baseline_launch_24</item>
<item name="menu_info_icon">@drawable/ic_baseline_info_24</item>
<item name="conversation_emoji_toggle">@drawable/ic_emoji_filled_keyboard_24</item> <item name="conversation_emoji_toggle">@drawable/ic_emoji_filled_keyboard_24</item>
<item name="conversation_sticker_toggle">@drawable/ic_sticker_filled_keyboard_24</item> <item name="conversation_sticker_toggle">@drawable/ic_sticker_filled_keyboard_24</item>

View File

@ -24,10 +24,6 @@ import android.database.Cursor;
import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.ColorDrawable;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Bundle; import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.loader.app.LoaderManager.LoaderCallbacks;
import androidx.loader.content.Loader;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;
@ -35,6 +31,11 @@ import android.view.ViewGroup;
import android.widget.ListView; import android.widget.ListView;
import android.widget.TextView; import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.loader.app.LoaderManager.LoaderCallbacks;
import androidx.loader.content.Loader;
import org.thoughtcrime.securesms.MessageDetailsRecipientAdapter.RecipientDeliveryStatus; import org.thoughtcrime.securesms.MessageDetailsRecipientAdapter.RecipientDeliveryStatus;
import org.thoughtcrime.securesms.color.MaterialColor; import org.thoughtcrime.securesms.color.MaterialColor;
import org.thoughtcrime.securesms.conversation.ConversationItem; import org.thoughtcrime.securesms.conversation.ConversationItem;
@ -55,7 +56,6 @@ import org.thoughtcrime.securesms.recipients.RecipientModifiedListener;
import org.thoughtcrime.securesms.sms.MessageSender; import org.thoughtcrime.securesms.sms.MessageSender;
import org.thoughtcrime.securesms.util.DateUtils; import org.thoughtcrime.securesms.util.DateUtils;
import org.thoughtcrime.securesms.util.DynamicLanguage; import org.thoughtcrime.securesms.util.DynamicLanguage;
import org.thoughtcrime.securesms.util.DynamicTheme;
import org.thoughtcrime.securesms.util.ExpirationUtil; import org.thoughtcrime.securesms.util.ExpirationUtil;
import org.thoughtcrime.securesms.util.Util; import org.thoughtcrime.securesms.util.Util;
import org.whispersystems.libsignal.util.guava.Optional; import org.whispersystems.libsignal.util.guava.Optional;
@ -100,14 +100,12 @@ public class MessageDetailsActivity extends PassphraseRequiredActionBarActivity
private ListView recipientsList; private ListView recipientsList;
private LayoutInflater inflater; private LayoutInflater inflater;
private DynamicTheme dynamicTheme = new DynamicTheme();
private DynamicLanguage dynamicLanguage = new DynamicLanguage(); private DynamicLanguage dynamicLanguage = new DynamicLanguage();
private boolean running; private boolean running;
@Override @Override
protected void onPreCreate() { protected void onPreCreate() {
dynamicTheme.onCreate(this);
dynamicLanguage.onCreate(this); dynamicLanguage.onCreate(this);
} }
@ -119,14 +117,12 @@ public class MessageDetailsActivity extends PassphraseRequiredActionBarActivity
initializeResources(); initializeResources();
initializeActionBar(); initializeActionBar();
getWindow().setNavigationBarColor(getResources().getColor(R.color.navigation_bar_background));
getSupportLoaderManager().initLoader(0, null, this); getSupportLoaderManager().initLoader(0, null, this);
} }
@Override @Override
protected void onResume() { protected void onResume() {
super.onResume(); super.onResume();
dynamicTheme.onResume(this);
dynamicLanguage.onResume(this); dynamicLanguage.onResume(this);
assert getSupportActionBar() != null; assert getSupportActionBar() != null;

View File

@ -103,8 +103,6 @@ public class ShareActivity extends PassphraseRequiredActionBarActivity
initializeResources(); initializeResources();
initializeSearch(); initializeSearch();
initializeMedia(); initializeMedia();
getWindow().setNavigationBarColor(getResources().getColor(R.color.navigation_bar_background));
} }
@Override @Override

View File

@ -6,6 +6,7 @@ import android.graphics.Canvas;
import android.graphics.Color; import android.graphics.Color;
import android.graphics.Outline; import android.graphics.Outline;
import android.graphics.Paint; import android.graphics.Paint;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.provider.ContactsContract; import android.provider.ContactsContract;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
@ -21,6 +22,7 @@ import org.thoughtcrime.securesms.contacts.avatars.ContactColors;
import org.thoughtcrime.securesms.contacts.avatars.ContactPhoto; import org.thoughtcrime.securesms.contacts.avatars.ContactPhoto;
import org.thoughtcrime.securesms.contacts.avatars.ResourceContactPhoto; import org.thoughtcrime.securesms.contacts.avatars.ResourceContactPhoto;
import org.thoughtcrime.securesms.database.Address; import org.thoughtcrime.securesms.database.Address;
import org.thoughtcrime.securesms.loki.utilities.AvatarPlaceholderGenerator;
import org.thoughtcrime.securesms.mms.GlideApp; import org.thoughtcrime.securesms.mms.GlideApp;
import org.thoughtcrime.securesms.mms.GlideRequests; import org.thoughtcrime.securesms.mms.GlideRequests;
import org.thoughtcrime.securesms.recipients.Recipient; import org.thoughtcrime.securesms.recipients.Recipient;
@ -128,17 +130,21 @@ public class AvatarImageView extends AppCompatImageView {
requestManager.clear(this); requestManager.clear(this);
recipientContactPhoto = photo; recipientContactPhoto = photo;
Drawable fallbackContactPhotoDrawable = photo.recipient.getFallbackContactPhotoDrawable(getContext(), inverted); Drawable photoPlaceholderDrawable = AvatarPlaceholderGenerator.generate(
getContext(), 128, recipient.getAddress().serialize(), recipient.getName());
if (photo.contactPhoto != null) { if (photo.contactPhoto != null) {
requestManager.load(photo.contactPhoto) requestManager.load(photo.contactPhoto)
.fallback(fallbackContactPhotoDrawable) .fallback(photoPlaceholderDrawable)
.error(fallbackContactPhotoDrawable) .error(photoPlaceholderDrawable)
.diskCacheStrategy(DiskCacheStrategy.ALL) .diskCacheStrategy(DiskCacheStrategy.ALL)
.circleCrop() .circleCrop()
.into(this); .into(this);
} else { } else {
setImageDrawable(fallbackContactPhotoDrawable); requestManager.load(photoPlaceholderDrawable)
.circleCrop()
.into(this);
// setImageDrawable(photoPlaceholderDrawable);
} }
} }
} }

View File

@ -374,12 +374,14 @@ public class ConversationFragment extends Fragment
} }
if (messageRecords.size() > 1) { if (messageRecords.size() > 1) {
menu.findItem(R.id.menu_context_details).setVisible(false);
menu.findItem(R.id.menu_context_reply).setVisible(false); menu.findItem(R.id.menu_context_reply).setVisible(false);
menu.findItem(R.id.menu_context_save_attachment).setVisible(false); menu.findItem(R.id.menu_context_save_attachment).setVisible(false);
menu.findItem(R.id.menu_context_resend).setVisible(false); menu.findItem(R.id.menu_context_resend).setVisible(false);
} else { } else {
MessageRecord messageRecord = messageRecords.iterator().next(); MessageRecord messageRecord = messageRecords.iterator().next();
menu.findItem(R.id.menu_context_details).setVisible(true);
menu.findItem(R.id.menu_context_resend).setVisible(messageRecord.isFailed()); menu.findItem(R.id.menu_context_resend).setVisible(messageRecord.isFailed());
menu.findItem(R.id.menu_context_save_attachment).setVisible(!actionMessage && menu.findItem(R.id.menu_context_save_attachment).setVisible(!actionMessage &&
messageRecord.isMms() && messageRecord.isMms() &&
@ -1126,16 +1128,14 @@ public class ConversationFragment extends Fragment
handleDeleteMessages(getListAdapter().getSelectedItems()); handleDeleteMessages(getListAdapter().getSelectedItems());
actionMode.finish(); actionMode.finish();
return true; return true;
/*
case R.id.menu_context_details: case R.id.menu_context_details:
handleDisplayDetails(getSelectedMessageRecord()); handleDisplayDetails(getSelectedMessageRecord());
actionMode.finish(); actionMode.finish();
return true; return true;
case R.id.menu_context_forward: // case R.id.menu_context_forward:
handleForwardMessage(getSelectedMessageRecord()); // handleForwardMessage(getSelectedMessageRecord());
actionMode.finish(); // actionMode.finish();
return true; // return true;
*/
case R.id.menu_context_resend: case R.id.menu_context_resend:
handleResendMessage(getSelectedMessageRecord()); handleResendMessage(getSelectedMessageRecord());
actionMode.finish(); actionMode.finish();

View File

@ -15,6 +15,7 @@ object AvatarPlaceholderGenerator {
private const val EMPTY_LABEL = "0"; private const val EMPTY_LABEL = "0";
@JvmStatic
fun generate(context: Context, pixelSize: Int, hashString: String, displayName: String?): BitmapDrawable { fun generate(context: Context, pixelSize: Int, hashString: String, displayName: String?): BitmapDrawable {
//TODO That should be replaced with a proper hash extraction code. //TODO That should be replaced with a proper hash extraction code.
val hash: Long val hash: Long

View File

@ -326,6 +326,6 @@ public class SingleRecipientNotificationBuilder extends AbstractNotificationBuil
? TextSecurePreferences.getMasterHexEncodedPublicKey(context) ? TextSecurePreferences.getMasterHexEncodedPublicKey(context)
: publicKey; : publicKey;
String displayName = recipient.getName(); String displayName = recipient.getName();
return AvatarPlaceholderGenerator.INSTANCE.generate(context, 128, hepk, displayName); return AvatarPlaceholderGenerator.generate(context, 128, hepk, displayName);
} }
} }