diff --git a/app/src/main/java/org/thoughtcrime/securesms/components/InputPanel.java b/app/src/main/java/org/thoughtcrime/securesms/components/InputPanel.java index 6d4743dd81..08cbfcbbd0 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/components/InputPanel.java +++ b/app/src/main/java/org/thoughtcrime/securesms/components/InputPanel.java @@ -74,6 +74,7 @@ public class InputPanel extends LinearLayout private View buttonToggle; private View recordingContainer; private View recordLockCancel; + private View composeContainer; private MicrophoneRecorderView microphoneRecorderView; private SlideToCancel slideToCancel; @@ -103,6 +104,7 @@ public class InputPanel extends LinearLayout View quoteDismiss = findViewById(R.id.quote_dismiss); + this.composeContainer = findViewById(R.id.compose_bubble); this.stickerSuggestion = findViewById(R.id.input_panel_sticker_suggestion); this.quoteView = findViewById(R.id.quote_view); this.linkPreview = findViewById(R.id.link_preview); @@ -286,6 +288,16 @@ public class InputPanel extends LinearLayout return mediaKeyboard; } + public void setWallpaperEnabled(boolean enabled) { + if (enabled) { + setBackgroundColor(getContext().getResources().getColor(R.color.wallpaper_compose_background)); + composeContainer.setBackgroundResource(R.drawable.compose_background_wallpaper); + } else { + setBackgroundColor(getResources().getColor(R.color.signal_background_primary)); + composeContainer.setBackgroundResource(R.drawable.compose_background); + } + } + @Override public void onRecordPermissionRequired() { if (listener != null) listener.onRecorderPermissionRequired(); diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/AttachmentKeyboard.java b/app/src/main/java/org/thoughtcrime/securesms/conversation/AttachmentKeyboard.java index 836c04bec3..59909d8414 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/conversation/AttachmentKeyboard.java +++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/AttachmentKeyboard.java @@ -6,6 +6,7 @@ import android.view.View; import android.view.ViewGroup; import android.widget.FrameLayout; +import androidx.annotation.ColorInt; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.recyclerview.widget.GridLayoutManager; @@ -23,6 +24,7 @@ import java.util.List; public class AttachmentKeyboard extends FrameLayout implements InputAwareLayout.InputView { + private View container; private AttachmentKeyboardMediaAdapter mediaAdapter; private AttachmentKeyboardButtonAdapter buttonAdapter; private Callback callback; @@ -44,8 +46,9 @@ public class AttachmentKeyboard extends FrameLayout implements InputAwareLayout. private void init(@NonNull Context context) { inflate(context, R.layout.attachment_keyboard, this); - this.mediaList = findViewById(R.id.attachment_keyboard_media_list ); - this.permissionText = findViewById(R.id.attachment_keyboard_permission_text ); + this.container = findViewById(R.id.attachment_keyboard_container); + this.mediaList = findViewById(R.id.attachment_keyboard_media_list); + this.permissionText = findViewById(R.id.attachment_keyboard_permission_text); this.permissionButton = findViewById(R.id.attachment_keyboard_permission_button); RecyclerView buttonList = findViewById(R.id.attachment_keyboard_button_list); @@ -98,6 +101,16 @@ public class AttachmentKeyboard extends FrameLayout implements InputAwareLayout. } } + public void setWallpaperEnabled(boolean wallpaperEnabled) { + if (wallpaperEnabled) { + container.setBackgroundColor(getContext().getResources().getColor(R.color.wallpaper_compose_background)); + } else { + container.setBackgroundColor(getContext().getResources().getColor(R.color.signal_background_primary)); + } + buttonAdapter.setWallpaperEnabled(wallpaperEnabled); + } + + @Override public void show(int height, boolean immediate) { ViewGroup.LayoutParams params = getLayoutParams(); diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/AttachmentKeyboardButtonAdapter.java b/app/src/main/java/org/thoughtcrime/securesms/conversation/AttachmentKeyboardButtonAdapter.java index bbc027cf4e..ba4eec9dbe 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/conversation/AttachmentKeyboardButtonAdapter.java +++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/AttachmentKeyboardButtonAdapter.java @@ -19,6 +19,8 @@ class AttachmentKeyboardButtonAdapter extends RecyclerView.Adapter buttons; private final Listener listener; + private boolean wallpaperEnabled; + AttachmentKeyboardButtonAdapter(@NonNull Listener listener) { this.buttons = new ArrayList<>(); this.listener = listener; @@ -39,7 +41,7 @@ class AttachmentKeyboardButtonAdapter extends RecyclerView.Adapter buttons) { this.buttons.clear(); this.buttons.addAll(buttons); notifyDataSetChanged(); } + public void setWallpaperEnabled(boolean enabled) { + if (wallpaperEnabled != enabled) { + wallpaperEnabled = enabled; + notifyDataSetChanged(); + } + } + interface Listener { void onClick(@NonNull AttachmentKeyboardButton button); } @@ -75,11 +83,17 @@ class AttachmentKeyboardButtonAdapter extends RecyclerView.Adapter listener.onClick(button)); + + if (wallpaperEnabled) { + itemView.setBackgroundResource(R.drawable.attachment_keyboard_button_wallpaper_background); + } else { + itemView.setBackgroundResource(R.drawable.attachment_keyboard_button_background); + } } void recycle() { diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/ConversationActivity.java b/app/src/main/java/org/thoughtcrime/securesms/conversation/ConversationActivity.java index 131c8562e1..0395b7f5af 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/conversation/ConversationActivity.java +++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/ConversationActivity.java @@ -1403,6 +1403,7 @@ public class ConversationActivity extends PassphraseRequiredActivity } else { viewModel.getRecentMedia().observe(this, media -> attachmentKeyboardStub.get().onMediaChanged(media)); attachmentKeyboardStub.get().setCallback(this); + attachmentKeyboardStub.get().setWallpaperEnabled(recipient.get().hasWallpaper()); container.show(composeText, attachmentKeyboardStub.get()); viewModel.onAttachmentKeyboardOpen(); @@ -1996,9 +1997,17 @@ public class ConversationActivity extends PassphraseRequiredActivity if (chatWallpaper != null) { chatWallpaper.loadInto(wallpaper); ChatWallpaperDimLevelUtil.applyDimLevelForNightMode(wallpaperDim, chatWallpaper); + inputPanel.setWallpaperEnabled(true); + if (attachmentKeyboardStub.resolved()) { + attachmentKeyboardStub.get().setWallpaperEnabled(true); + } } else { wallpaper.setImageDrawable(null); wallpaperDim.setVisibility(View.GONE); + inputPanel.setWallpaperEnabled(false); + if (attachmentKeyboardStub.resolved()) { + attachmentKeyboardStub.get().setWallpaperEnabled(false); + } } fragment.onWallpaperChanged(chatWallpaper); } @@ -2503,7 +2512,7 @@ public class ConversationActivity extends PassphraseRequiredActivity if (supportActionBar == null) throw new AssertionError(); int actionBarColor = color.toActionBarColor(this); supportActionBar.setBackgroundDrawable(new ColorDrawable(actionBarColor)); - WindowUtil.setStatusBarColor(getWindow(), color.toStatusBarColor(this)); + WindowUtil.setStatusBarColor(getWindow(), actionBarColor); joinGroupCallButton.setTextColor(actionBarColor); joinGroupCallButton.setIconTint(ColorStateList.valueOf(actionBarColor)); diff --git a/app/src/main/res/drawable-night-v21/attachment_keyboard_button_wallpaper_background.xml b/app/src/main/res/drawable-night-v21/attachment_keyboard_button_wallpaper_background.xml new file mode 100644 index 0000000000..cf02c88ebf --- /dev/null +++ b/app/src/main/res/drawable-night-v21/attachment_keyboard_button_wallpaper_background.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable-night/attachment_keyboard_button_wallpaper_background.xml b/app/src/main/res/drawable-night/attachment_keyboard_button_wallpaper_background.xml new file mode 100644 index 0000000000..a51007e8ba --- /dev/null +++ b/app/src/main/res/drawable-night/attachment_keyboard_button_wallpaper_background.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable-night/compose_background_wallpaper.xml b/app/src/main/res/drawable-night/compose_background_wallpaper.xml new file mode 100644 index 0000000000..1a35e754fe --- /dev/null +++ b/app/src/main/res/drawable-night/compose_background_wallpaper.xml @@ -0,0 +1,16 @@ + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable-v21/attachment_keyboard_button_wallpaper_background.xml b/app/src/main/res/drawable-v21/attachment_keyboard_button_wallpaper_background.xml new file mode 100644 index 0000000000..71d346bb23 --- /dev/null +++ b/app/src/main/res/drawable-v21/attachment_keyboard_button_wallpaper_background.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/attachment_keyboard_button_wallpaper_background.xml b/app/src/main/res/drawable/attachment_keyboard_button_wallpaper_background.xml new file mode 100644 index 0000000000..1c60482dcf --- /dev/null +++ b/app/src/main/res/drawable/attachment_keyboard_button_wallpaper_background.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/compose_background_wallpaper.xml b/app/src/main/res/drawable/compose_background_wallpaper.xml new file mode 100644 index 0000000000..e8b7e6d583 --- /dev/null +++ b/app/src/main/res/drawable/compose_background_wallpaper.xml @@ -0,0 +1,16 @@ + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/attachment_keyboard.xml b/app/src/main/res/layout/attachment_keyboard.xml index 4b648189f9..4dd3c712db 100644 --- a/app/src/main/res/layout/attachment_keyboard.xml +++ b/app/src/main/res/layout/attachment_keyboard.xml @@ -7,6 +7,7 @@ android:layout_height="wrap_content"> @color/core_grey_75 @color/transparent_black_60 + @color/transparent_black_80 + @color/core_black diff --git a/app/src/main/res/values/light_colors.xml b/app/src/main/res/values/light_colors.xml index 29e2721711..731636c191 100644 --- a/app/src/main/res/values/light_colors.xml +++ b/app/src/main/res/values/light_colors.xml @@ -120,4 +120,6 @@ @color/core_white @color/transparent_white_30 + @color/transparent_white_80 + @color/core_white