diff --git a/res/drawable/circle_touch_highlight_background.xml b/res/drawable/circle_touch_highlight_background.xml index fe392b45e6..8f1c2885be 100644 --- a/res/drawable/circle_touch_highlight_background.xml +++ b/res/drawable/circle_touch_highlight_background.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <ripple xmlns:android="http://schemas.android.com/apk/res/android" - android:color="@color/touch_highlight"> + android:color="?attr/colorControlHighlight"> <item android:id="@android:id/mask"> <shape android:shape="oval"> <solid android:color="@color/black" /> diff --git a/res/drawable/ic_arrow_up_circle_24.xml b/res/drawable/ic_arrow_up_circle_24.xml new file mode 100644 index 0000000000..a13b7c5b40 --- /dev/null +++ b/res/drawable/ic_arrow_up_circle_24.xml @@ -0,0 +1,11 @@ +<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,2.4355c-5.2796,0 -9.5645,4.2848 -9.5645,9.5645 0,5.2796 4.2848,9.5645 9.5645,9.5645 5.2796,0 9.5645,-4.2848 9.5645,-9.5645 0,-5.2796 -4.2848,-9.5645 -9.5645,-9.5645zM12.123,7.9375 L15.6777,11.4922 14.9707,12.1992 12.623,9.8515v6.1797h-1v-6.1797l-1.9961,1.9941 -0.3535,0.3535 -0.707,-0.707 0.3535,-0.3535 3.2031,-3.2012z" + android:strokeWidth=".95645"/> +</vector> diff --git a/res/drawable/ic_baseline_photo_camera_24.xml b/res/drawable/ic_baseline_photo_camera_24.xml new file mode 100644 index 0000000000..13186deefc --- /dev/null +++ b/res/drawable/ic_baseline_photo_camera_24.xml @@ -0,0 +1,13 @@ +<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,12m-3.2,0a3.2,3.2 0,1 1,6.4 0a3.2,3.2 0,1 1,-6.4 0"/> + <path + android:fillColor="@android:color/white" + android:pathData="M9,2L7.17,4L4,4c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2h16c1.1,0 2,-0.9 2,-2L22,6c0,-1.1 -0.9,-2 -2,-2h-3.17L15,2L9,2zM12,17c-2.76,0 -5,-2.24 -5,-5s2.24,-5 5,-5 5,2.24 5,5 -2.24,5 -5,5z"/> +</vector> diff --git a/res/drawable/ic_circle_plus.xml b/res/drawable/ic_circle_plus.xml index b222f9a9ae..e9db1a80a8 100644 --- a/res/drawable/ic_circle_plus.xml +++ b/res/drawable/ic_circle_plus.xml @@ -2,7 +2,8 @@ android:width="27dp" android:height="27dp" android:viewportWidth="27" - android:viewportHeight="27"> + android:viewportHeight="27" + android:tint="?attr/colorControlNormal"> <group> <clip-path android:pathData="M-19,-756h375v812h-375z M 0,0"/> <group> @@ -14,7 +15,7 @@ <path android:pathData="M-4,-4h35v35h-35z" android:strokeAlpha="0.9" - android:fillColor="#FFFFFF" + android:fillColor="@android:color/white" android:fillAlpha="0.9"/> </group> </group> @@ -27,8 +28,7 @@ android:pathData="M13.51,8.82c-0.35,0 -0.63,0.28 -0.62,0.62v3.43H9.46c-0.35,0 -0.63,0.28 -0.62,0.62c0,0.35 0.28,0.63 0.62,0.62h3.43v3.43c-0.02,0.35 0.27,0.63 0.61,0.63c0.17,0 0.33,-0.07 0.44,-0.18c0.11,-0.11 0.18,-0.27 0.18,-0.44v-3.43h3.43c0.17,0 0.33,-0.07 0.44,-0.18c0.11,-0.11 0.18,-0.27 0.18,-0.44c0,-0.35 -0.28,-0.63 -0.62,-0.62h-3.43V9.44C14.13,9.09 13.85,8.81 13.51,8.82zM21.46,5.54c4.39,4.39 4.39,11.53 0,15.92c-4.39,4.39 -11.53,4.39 -15.92,0c-4.39,-4.39 -4.39,-11.53 0,-15.92C9.93,1.15 17.07,1.15 21.46,5.54zM22.34,22.34c4.88,-4.88 4.88,-12.81 0,-17.69s-12.81,-4.88 -17.69,0s-4.88,12.81 0,17.69S17.47,27.22 22.34,22.34z" android:strokeAlpha="0.9" android:strokeWidth="0.5" - android:fillColor="#00000000" - android:strokeColor="#FFFFFF" + android:strokeColor="@android:color/white" android:fillAlpha="0.9"/> </group> </group> diff --git a/res/layout/conversation_input_panel.xml b/res/layout/conversation_input_panel.xml index ccfcdf50d1..9f5048f4ad 100644 --- a/res/layout/conversation_input_panel.xml +++ b/res/layout/conversation_input_panel.xml @@ -98,7 +98,7 @@ android:layout_gravity="center_vertical" android:textAlignment="viewStart" android:layout_weight="1" - android:textColorHint="#99FFFFFF" + android:textColorHint="?android:attr/textColorHint" android:textSize="@dimen/small_font_size" android:nextFocusForward="@+id/send_button" android:nextFocusRight="@+id/send_button" @@ -199,7 +199,7 @@ android:id="@+id/send_button" android:layout_width="match_parent" android:layout_height="match_parent" - android:scaleType="centerInside" + android:scaleType="fitXY" android:contentDescription="@string/conversation_activity__send" android:nextFocusLeft="@+id/embedded_text_editor" android:src="?conversation_transport_sms_indicator" diff --git a/res/values-notnight/themes.xml b/res/values-notnight/themes.xml index 3fa42d6cf9..898e3edfed 100644 --- a/res/values-notnight/themes.xml +++ b/res/values-notnight/themes.xml @@ -5,14 +5,184 @@ <item name="android:navigationBarColor">@color/gray65</item> <item name="android:statusBarColor">@color/accent</item> <item name="titleTextColor">@color/text</item> + <item name="android:textColorHint">@color/gray50</item> </style> <style name="TextSecure.DarkNoActionBar" parent="@style/TextSecure.BaseDarkNoActionBar"> <item name="android:navigationBarColor">@color/gray78</item> - <item name="conversation_item_sent_text_primary_color">@color/core_grey_95</item> - <item name="conversation_item_sent_text_secondary_color">@color/core_grey_85</item> + <item name="theme_type">light</item> + <item name="actionBarTabBarStyle">@style/TextSecure.LightActionBar.TabBar</item> + <item name="colorPrimary">@color/action_bar_background</item> + <item name="colorPrimaryDark">@color/action_bar_background</item> + <item name="colorAccent">@color/accent</item> + <item name="colorControlActivated">@color/accent</item> + <item name="colorControlNormal">@color/text</item> + <item name="colorControlHighlight">@color/accent</item> + <item name="android:windowBackground">@color/loki_darkest_gray</item> + <item name="alertDialogTheme">@style/AppCompatAlertDialogStyleLight</item> + <item name="android:alertDialogTheme">@style/AppCompatDialogStyleLight</item> + <item name="bottomSheetDialogTheme">@style/Theme.MaterialComponents.Light.BottomSheetDialog</item> + <!--<item name="android:windowContentOverlay">@drawable/compat_actionbar_shadow_background</item>--> + + <item name="attachment_type_selector_background">@color/white</item> + <item name="attachment_document_icon_small">@drawable/ic_document_small_light</item> + <item name="attachment_document_icon_large">@drawable/ic_document_large_light</item> + + <item name="compose_icon_tint">@color/core_grey_60</item> + + <item name="conversation_list_item_background">@drawable/conversation_list_item_background</item> + <item name="conversation_list_item_contact_color">@color/core_grey_90</item> + <item name="conversation_list_item_subject_color">@color/core_grey_60</item> + <item name="conversation_list_item_delivery_icon_color">@color/core_grey_60</item> + <item name="conversation_list_item_date_color">@color/core_grey_60</item> + <item name="conversation_list_item_unread_color">@color/core_black</item> + <item name="conversation_list_item_unread_background">@drawable/unread_count_background_light</item> + <item name="conversation_list_item_divider">@drawable/conversation_list_divider_shape</item> + <item name="conversation_list_toolbar_background">@color/core_blue</item> + <item name="conversation_list_typing_tint">@color/core_grey_60</item> + + <item name="fab_color">@color/textsecure_primary</item> + <item name="lower_right_divet">@drawable/divet_lower_right_dark</item> + + <item name="conversation_group_member_name">#99000000</item> + + <item name="conversation_background">@color/core_white</item> + <item name="conversation_editor_background">#22000000</item> + <item name="conversation_editor_text_color">#ff111111</item> + <item name="conversation_input_background">@drawable/compose_background_light</item> + <item name="conversation_input_inline_attach_icon_tint">@color/core_grey_60</item> + <item name="conversation_transport_popup_background">@color/white</item> + <item name="conversation_emoji_toggle">@drawable/ic_emoji_outline_keyboard</item> + <item name="conversation_sticker_toggle">@drawable/ic_sticker_filled_keyboard_light</item> + <item name="conversation_keyboard_toggle">@drawable/ic_keyboard_grey600_24dp</item> + <item name="conversation_attach_camera">@drawable/ic_photo_camera_light</item> + <item name="conversation_attach_image">@drawable/ic_image_light</item> + <item name="conversation_attach_video">@drawable/ic_movie_creation_light</item> + <item name="conversation_attach_sound">@drawable/ic_volume_up_light</item> + <item name="conversation_attach_contact_info">@drawable/ic_account_box_light</item> + <item name="conversation_attach">@drawable/ic_attach_grey600_24dp</item> + <item name="conversation_number_picker_text_color_normal">@color/gray65</item> + <item name="conversation_number_picker_text_color_selected">@color/black</item> + <item name="conversation_sticker_footer_text_color">@color/core_grey_60</item> + <item name="conversation_sticker_footer_icon_color">@color/core_grey_60</item> + <item name="conversation_sticker_author_color">@color/core_grey_95</item> + + <item name="contact_list_divider">@drawable/contact_list_divider_light</item> + + <item name="verification_background">@color/core_grey_05</item> + + <item name="emoji_tab_strip_background">@color/cell_background</item> + <item name="emoji_tab_indicator">#66555555</item> + <item name="emoji_tab_underline">#44555555</item> + <item name="emoji_tab_seperator">@color/gray20</item> + <item name="emoji_drawer_background">@color/compose_view_background</item> + <item name="emoji_text_color">@color/black</item> + + <item name="emoji_category_recent">@drawable/ic_recent_light_20</item> + <item name="emoji_category_people">@drawable/ic_emoji_people_light_20</item> + <item name="emoji_category_nature">@drawable/ic_emoji_animal_light_20</item> + <item name="emoji_category_foods">@drawable/ic_emoji_food_light_20</item> + <item name="emoji_category_activity">@drawable/ic_emoji_activity_light_20</item> + <item name="emoji_category_places">@drawable/ic_emoji_travel_light_20</item> + <item name="emoji_category_objects">@drawable/ic_emoji_object_light_20</item> + <item name="emoji_category_symbol">@drawable/ic_emoji_symbol_light_20</item> + <item name="emoji_category_flags">@drawable/ic_emoji_flag_light_20</item> + <item name="emoji_category_emoticons">@drawable/ic_emoji_emoticon_light_20</item> + <item name="emoji_variation_selector_background">@drawable/emoji_variation_selector_background_light</item> + + <item name="conversation_item_bubble_background">@color/sent_message_background</item> + <item name="conversation_item_sent_text_primary_color">@color/core_grey_90</item> + <item name="conversation_item_sent_text_secondary_color">@color/core_grey_60</item> + <item name="conversation_item_sent_icon_color">@color/core_grey_60</item> + <item name="conversation_item_sent_download_icon_color">@color/core_grey_60</item> + <item name="conversation_item_sent_text_indicator_tab_color">#99000000</item> + <item name="conversation_item_received_text_primary_color">@color/text</item> + <item name="conversation_item_received_text_secondary_color">@color/text</item> + <item name="conversation_item_update_text_color">@color/core_grey_60</item> + <item name="conversation_item_last_seen_text_color">@color/core_grey_90</item> + <item name="conversation_item_last_seen_line_color">@color/core_grey_60</item> + <item name="conversation_item_date_line_color">@color/core_grey_25</item> + <item name="conversation_item_quote_text_color">@color/core_grey_90</item> + <item name="conversation_item_sticky_date_background">@drawable/sticky_date_header_background_light</item> + <item name="conversation_item_sticky_date_text_color">@color/core_grey_60</item> + <item name="conversation_item_image_outline_color">@color/transparent_black_30</item> + + <item name="quick_mic_icon">@drawable/ic_mic_grey600_24dp</item> + + <item name="conversation_item_sent_indicator_text_background">@drawable/conversation_item_sent_indicator_text_shape</item> + + <item name="dialog_info_icon">@drawable/ic_info_outline_light</item> + <item name="dialog_alert_icon">@drawable/ic_warning_light</item> + <item name="dialog_background_color">@color/background_material_light</item> + + <item name="device_link_item_card_background">@color/device_link_item_background_light</item> + + <item name="mediapicker_image_outline">@drawable/mediapicker_item_border_light</item> + + <item name="import_export_item_background_color">@color/import_export_item_background_light</item> + <item name="import_export_item_background_shadow_color">@color/import_export_item_background_shadow_light</item> + <item name="import_export_item_card_background">@drawable/clickable_card_light</item> + + <item name="linkpreview_background_color">@color/core_white</item> + <item name="linkpreview_primary_text_color">@color/core_black</item> + <item name="linkpreview_secondary_text_color">@color/core_grey_60</item> + <item name="linkpreview_divider_color">@color/core_grey_25</item> + + <item name="media_keyboard_button_color">@color/core_grey_60</item> + + <item name="menu_new_conversation_icon">@drawable/ic_add_white_24dp</item> + <item name="menu_group_icon">@drawable/ic_group_white_24dp</item> + <item name="menu_search_icon">@drawable/ic_search_white_24dp</item> + <item name="menu_call_icon">@drawable/ic_call_white_24dp</item> + <item name="menu_popup_expand">@drawable/ic_launch_white_24dp</item> + <item name="menu_unlock_icon">@drawable/ic_unlocked_white_24dp</item> + <item name="menu_lock_icon">@drawable/ic_lock_white_24dp</item> + <item name="menu_lock_icon_small">@drawable/ic_lock_white_18dp</item> + <item name="menu_trash_icon">@drawable/ic_delete_white_24dp</item> + <item name="menu_selectall_icon">@drawable/ic_select_all_white_24dp</item> + <item name="menu_split_icon">@drawable/ic_call_split_white_24dp</item> + <item name="menu_accept_icon">@drawable/ic_check_white_24dp</item> + <item name="menu_refresh_directory">@drawable/ic_refresh_white_24dp</item> + <item name="menu_copy_icon">@drawable/ic_content_copy_white_24dp</item> + <item name="menu_info_icon">@drawable/ic_info_outline_white_24dp</item> + <item name="menu_forward_icon">@drawable/ic_forward_white_24dp</item> + <item name="menu_save_icon">@drawable/ic_save_white_24dp</item> + <item name="menu_reply_icon">@drawable/ic_reply_white_24dp</item> + + <item name="conversation_icon_attach_audio">@drawable/ic_audio_light</item> + <item name="conversation_icon_attach_video">@drawable/ic_video_light</item> + + <item name="reminder_header_background">#ff1d85d7</item> + + <item name="sticker_management_icon">@drawable/sticker_button_light</item> + <item name="sticker_management_divider_color">@color/core_grey_15</item> + <item name="sticker_management_empty_background_color">@color/core_grey_05</item> + <item name="sticker_management_action_button_color">@color/core_grey_90</item> + <item name="sticker_popup_background">@color/transparent_white_aa</item> + <item name="sticker_preview_toolbar_background">@color/core_white</item> + <item name="sticker_preview_status_bar_color">@color/core_grey_05</item> + <item name="sticker_view_missing_background">@drawable/sticker_missing_background_light</item> + + <item name="tooltip_default_color">@color/core_white</item> + + <item name="pref_icon_tint">@color/textsecure_primary_dark</item> + + <item name="pref_divider">@drawable/preference_divider_light</item> + + <item name="quote_missing_icon_color">@color/core_grey_60</item> + + <item name="group_members_dialog_icon">@drawable/ic_group_grey600_24dp</item> + <item name="preferenceTheme">@style/PreferenceThemeOverlay.Fix</item> + + <item name="search_toolbar_background">@color/white</item> + <item name="search_background">@color/white</item> + <item name="invite_background">@color/signal_primary</item> + + <item name="shared_contact_details_header_background">@color/grey_100</item> + <item name="shared_contact_details_titlebar">@color/grey_400</item> + <item name="shared_contact_item_button_color">@color/core_grey_02</item> </style> </resources> \ No newline at end of file diff --git a/res/values/themes.xml b/res/values/themes.xml index 8f006438c4..5a63b2db9a 100644 --- a/res/values/themes.xml +++ b/res/values/themes.xml @@ -20,6 +20,7 @@ <item name="colorControlNormal">@color/text</item> <item name="appBarLayoutStyle">@style/Widget.Design.AppBarLayout</item> <item name="android:textColor">@color/text</item> + <item name="android:textColorHint">#9FFF</item> <item name="windowActionModeOverlay">true</item> <item name="actionModeCloseDrawable">@drawable/ic_baseline_clear_24</item> @@ -350,7 +351,7 @@ <!-- leave empty to allow overriding --> </style> - <style name="TextSecure.BaseDarkTheme" parent="@style/Theme.AppCompat"> + <style name="TextSecure.BaseDarkTheme" parent="@style/Session.DarkTheme"> <item name="theme_type">dark</item> <item name="actionBarTheme">@style/Session.DarkActionBar</item> @@ -431,8 +432,8 @@ <item name="conversation_editor_text_color">#ffeeeeee</item> <item name="conversation_input_background">@drawable/compose_background_dark</item> <item name="conversation_input_inline_attach_icon_tint">@color/core_grey_05</item> - <item name="conversation_transport_sms_indicator">@drawable/ic_send_sms_insecure_dark</item> - <item name="conversation_transport_push_indicator">@drawable/ic_send_push</item> + <item name="conversation_transport_sms_indicator">@drawable/ic_arrow_up_circle_24</item> + <item name="conversation_transport_push_indicator">@drawable/ic_arrow_up_circle_24</item> <item name="conversation_transport_popup_background">@color/black</item> <item name="conversation_emoji_toggle">@drawable/ic_emoji_filled_keyboard_dark</item> <item name="conversation_sticker_toggle">@drawable/ic_sticker_filled_keyboard_dark</item> @@ -473,7 +474,7 @@ <item name="linkpreview_secondary_text_color">@color/text</item> <item name="linkpreview_divider_color">@color/transparent</item> - <item name="quick_camera_icon">@drawable/quick_camera_dark</item> + <item name="quick_camera_icon">@drawable/ic_baseline_photo_camera_24</item> <item name="quick_mic_icon">@drawable/ic_mic_white_24dp</item> <item name="media_keyboard_button_color">@color/core_grey_25</item> diff --git a/src/org/thoughtcrime/securesms/TransportOption.java b/src/org/thoughtcrime/securesms/TransportOption.java index c361a42168..21117eff01 100644 --- a/src/org/thoughtcrime/securesms/TransportOption.java +++ b/src/org/thoughtcrime/securesms/TransportOption.java @@ -2,7 +2,6 @@ package org.thoughtcrime.securesms; import android.os.Parcel; import android.os.Parcelable; -import androidx.annotation.DrawableRes; import androidx.annotation.NonNull; import android.text.TextUtils; @@ -19,8 +18,6 @@ public class TransportOption implements Parcelable { TEXTSECURE } - private final int drawable; - private final int backgroundColor; private final @NonNull String text; private final @NonNull Type type; private final @NonNull String composeHint; @@ -29,19 +26,15 @@ public class TransportOption implements Parcelable { private final @NonNull Optional<Integer> simSubscriptionId; public TransportOption(@NonNull Type type, - @DrawableRes int drawable, - int backgroundColor, @NonNull String text, @NonNull String composeHint, @NonNull CharacterCalculator characterCalculator) { - this(type, drawable, backgroundColor, text, composeHint, characterCalculator, + this(type, text, composeHint, characterCalculator, Optional.<CharSequence>absent(), Optional.<Integer>absent()); } public TransportOption(@NonNull Type type, - @DrawableRes int drawable, - int backgroundColor, @NonNull String text, @NonNull String composeHint, @NonNull CharacterCalculator characterCalculator, @@ -49,8 +42,6 @@ public class TransportOption implements Parcelable { @NonNull Optional<Integer> simSubscriptionId) { this.type = type; - this.drawable = drawable; - this.backgroundColor = backgroundColor; this.text = text; this.composeHint = composeHint; this.characterCalculator = characterCalculator; @@ -60,8 +51,6 @@ public class TransportOption implements Parcelable { TransportOption(Parcel in) { this(Type.valueOf(in.readString()), - in.readInt(), - in.readInt(), in.readString(), in.readString(), CharacterCalculator.readFromParcel(in), @@ -85,14 +74,6 @@ public class TransportOption implements Parcelable { return characterCalculator.calculateCharacters(messageBody); } - public @DrawableRes int getDrawable() { - return R.drawable.ic_arrow_up; - } - - public int getBackgroundColor() { - return backgroundColor; - } - public @NonNull String getComposeHint() { return composeHint; } @@ -119,8 +100,6 @@ public class TransportOption implements Parcelable { @Override public void writeToParcel(Parcel dest, int flags) { dest.writeString(type.name()); - dest.writeInt(drawable); - dest.writeInt(backgroundColor); dest.writeString(text); dest.writeString(composeHint); CharacterCalculator.writeToParcel(dest, characterCalculator); diff --git a/src/org/thoughtcrime/securesms/TransportOptions.java b/src/org/thoughtcrime/securesms/TransportOptions.java index 52b37ff25c..de65069e87 100644 --- a/src/org/thoughtcrime/securesms/TransportOptions.java +++ b/src/org/thoughtcrime/securesms/TransportOptions.java @@ -2,6 +2,10 @@ package org.thoughtcrime.securesms; import android.Manifest; import android.content.Context; +import android.util.TypedValue; + +import androidx.annotation.AttrRes; +import androidx.annotation.DrawableRes; import androidx.annotation.NonNull; import androidx.annotation.Nullable; @@ -147,8 +151,7 @@ public class TransportOptions { private List<TransportOption> initializeAvailableTransports(boolean isMediaMessage) { List<TransportOption> results = new LinkedList<>(); - results.add(new TransportOption(Type.TEXTSECURE, R.drawable.ic_send_push_white_24dp, - context.getResources().getColor(R.color.textsecure_primary), + results.add(new TransportOption(Type.TEXTSECURE, context.getString(R.string.ConversationActivity_transport_signal), context.getString(R.string.conversation_activity__type_message_push), new PushCharacterCalculator())); @@ -171,13 +174,11 @@ public class TransportOptions { } if (subscriptions.size() < 2) { - results.add(new TransportOption(Type.SMS, R.drawable.ic_send_sms_white_24dp, - context.getResources().getColor(R.color.grey_600), + results.add(new TransportOption(Type.SMS, text, composeHint, characterCalculator)); } else { for (SubscriptionInfoCompat subscriptionInfo : subscriptions) { - results.add(new TransportOption(Type.SMS, R.drawable.ic_send_sms_white_24dp, - context.getResources().getColor(R.color.grey_600), + results.add(new TransportOption(Type.SMS, text, composeHint, characterCalculator, Optional.of(subscriptionInfo.getDisplayName()), Optional.of(subscriptionInfo.getSubscriptionId()))); @@ -202,6 +203,6 @@ public class TransportOptions { } public interface OnTransportChangedListener { - public void onChange(TransportOption newTransport, boolean manuallySelected); + void onChange(TransportOption newTransport, boolean manuallySelected); } } diff --git a/src/org/thoughtcrime/securesms/TransportOptionsAdapter.java b/src/org/thoughtcrime/securesms/TransportOptionsAdapter.java index 703b379915..42a997555a 100644 --- a/src/org/thoughtcrime/securesms/TransportOptionsAdapter.java +++ b/src/org/thoughtcrime/securesms/TransportOptionsAdapter.java @@ -1,8 +1,6 @@ package org.thoughtcrime.securesms; import android.content.Context; -import android.graphics.PorterDuff.Mode; -import androidx.annotation.NonNull; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -10,6 +8,8 @@ import android.widget.BaseAdapter; import android.widget.ImageView; import android.widget.TextView; +import androidx.annotation.NonNull; + import org.thoughtcrime.securesms.util.ViewUtil; import java.util.List; @@ -60,8 +60,7 @@ public class TransportOptionsAdapter extends BaseAdapter { TextView textView = ViewUtil.findById(convertView, R.id.text); TextView subtextView = ViewUtil.findById(convertView, R.id.subtext); - imageView.getBackground().setColorFilter(transport.getBackgroundColor(), Mode.MULTIPLY); - imageView.setImageResource(transport.getDrawable()); + imageView.setImageResource(R.drawable.ic_arrow_up_circle_24); textView.setText(transport.getDescription()); if (transport.getSimName().isPresent()) { diff --git a/src/org/thoughtcrime/securesms/components/SendButton.java b/src/org/thoughtcrime/securesms/components/SendButton.java index ce4488ffd0..3c86779ef2 100644 --- a/src/org/thoughtcrime/securesms/components/SendButton.java +++ b/src/org/thoughtcrime/securesms/components/SendButton.java @@ -1,23 +1,30 @@ package org.thoughtcrime.securesms.components; import android.content.Context; + +import androidx.annotation.AttrRes; +import androidx.annotation.DrawableRes; import androidx.annotation.NonNull; import androidx.appcompat.widget.AppCompatImageButton; import android.util.AttributeSet; +import android.util.Log; +import android.util.TypedValue; import android.view.View; import org.thoughtcrime.securesms.TransportOption; import org.thoughtcrime.securesms.TransportOptions; import org.thoughtcrime.securesms.TransportOptions.OnTransportChangedListener; import org.thoughtcrime.securesms.TransportOptionsPopup; +import org.thoughtcrime.securesms.util.ThemeUtil; import org.thoughtcrime.securesms.util.ViewUtil; import org.whispersystems.libsignal.util.guava.Optional; +import network.loki.messenger.R; + public class SendButton extends AppCompatImageButton implements TransportOptions.OnTransportChangedListener, TransportOptionsPopup.SelectedListener, - View.OnLongClickListener -{ + View.OnLongClickListener { private final TransportOptions transportOptions; @@ -102,7 +109,19 @@ public class SendButton extends AppCompatImageButton @Override public void onChange(TransportOption newTransport, boolean isManualSelection) { - setImageResource(newTransport.getDrawable()); + // Map send icon drawable resource from a transport type. + //TODO These values should come from XML layout as view's attributes and not be resolved in code like this. + @DrawableRes final int sendDrawable; + switch (newTransport.getType()) { + case SMS: + case TEXTSECURE: + default: { + sendDrawable = ThemeUtil.getDrawableResWithAttribute( + getContext(), R.attr.conversation_transport_sms_indicator); + } + } + + setImageResource(sendDrawable); setContentDescription(newTransport.getDescription()); } diff --git a/src/org/thoughtcrime/securesms/util/ThemeUtil.java b/src/org/thoughtcrime/securesms/util/ThemeUtil.java index 564932c57d..24e2854f2a 100644 --- a/src/org/thoughtcrime/securesms/util/ThemeUtil.java +++ b/src/org/thoughtcrime/securesms/util/ThemeUtil.java @@ -4,15 +4,19 @@ import android.content.Context; import android.content.res.Resources; import android.graphics.Color; import androidx.annotation.AttrRes; +import androidx.annotation.DrawableRes; import androidx.annotation.NonNull; import androidx.annotation.StyleRes; import androidx.appcompat.view.ContextThemeWrapper; + +import android.util.Log; import android.util.TypedValue; import android.view.LayoutInflater; import network.loki.messenger.R; public class ThemeUtil { + private static final String TAG = ThemeUtil.class.getSimpleName(); public static boolean isDarkTheme(@NonNull Context context) { return getAttribute(context, R.attr.theme_type, "light").equals("dark"); @@ -45,4 +49,15 @@ public class ThemeUtil { return defaultValue; } + + @DrawableRes + public static int getDrawableResWithAttribute(Context context, @AttrRes int attributeId) { + TypedValue resolvedValue = new TypedValue(); + context.getTheme().resolveAttribute(attributeId, resolvedValue, true); + if (resolvedValue.type != TypedValue.TYPE_STRING) { + Log.e(TAG, "Cannot resolve a drawable resource from an attribute ID: " + attributeId); + return 0; + } + return resolvedValue.resourceId; + } }