kopia lustrzana https://github.com/ryukoposting/Signal-Android
Add transparency to the compose bar when wallpaper is present.
rodzic
133a7d2576
commit
8f86de1764
|
@ -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();
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -19,6 +19,8 @@ class AttachmentKeyboardButtonAdapter extends RecyclerView.Adapter<AttachmentKey
|
|||
private final List<AttachmentKeyboardButton> 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<AttachmentKey
|
|||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull ButtonViewHolder holder, int position) {
|
||||
holder.bind(buttons.get(position), listener);
|
||||
holder.bind(buttons.get(position), wallpaperEnabled, listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -52,13 +54,19 @@ class AttachmentKeyboardButtonAdapter extends RecyclerView.Adapter<AttachmentKey
|
|||
return buttons.size();
|
||||
}
|
||||
|
||||
|
||||
public void setButtons(@NonNull List<AttachmentKeyboardButton> 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<AttachmentKey
|
|||
this.title = itemView.findViewById(R.id.attachment_button_title);
|
||||
}
|
||||
|
||||
void bind(@NonNull AttachmentKeyboardButton button, @NonNull Listener listener) {
|
||||
void bind(@NonNull AttachmentKeyboardButton button,boolean wallpaperEnabled, @NonNull Listener listener) {
|
||||
image.setImageResource(button.getIconRes());
|
||||
title.setText(button.getTitleRes());
|
||||
|
||||
itemView.setOnClickListener(v -> 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() {
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ripple
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:color="@color/transparent_white_20">
|
||||
|
||||
<item android:id="@+id/mask">
|
||||
<shape>
|
||||
<corners android:radius="4dp" />
|
||||
<solid android:color="@color/transparent_black" />
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<shape android:shape="rectangle" >
|
||||
<corners android:radius="4dp" />
|
||||
<solid android:color="@color/core_grey_95"/>
|
||||
</shape>
|
||||
</item>
|
||||
</ripple>
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >
|
||||
<corners android:radius="4dp" />
|
||||
<solid android:color="@color/core_grey_95"/>
|
||||
</shape>
|
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
|
||||
<stroke
|
||||
android:width="1dp"
|
||||
android:color="@color/core_grey_75" />
|
||||
|
||||
<solid
|
||||
android:color="@color/conversation_item_wallpaper_bubble_color" />
|
||||
|
||||
<corners
|
||||
android:radius="20dp" />
|
||||
|
||||
</shape>
|
|
@ -0,0 +1,19 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ripple
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:color="@color/transparent_black_10">
|
||||
|
||||
<item android:id="@+id/mask">
|
||||
<shape>
|
||||
<corners android:radius="4dp" />
|
||||
<solid android:color="@color/transparent_black" />
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<shape android:shape="rectangle" >
|
||||
<corners android:radius="4dp" />
|
||||
<solid android:color="@color/core_white"/>
|
||||
</shape>
|
||||
</item>
|
||||
</ripple>
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >
|
||||
<corners android:radius="4dp" />
|
||||
<solid android:color="@color/core_white"/>
|
||||
</shape>
|
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
|
||||
<stroke
|
||||
android:width="1dp"
|
||||
android:color="@color/core_grey_05" />
|
||||
|
||||
<solid
|
||||
android:color="@color/conversation_item_wallpaper_bubble_color" />
|
||||
|
||||
<corners
|
||||
android:radius="20dp" />
|
||||
|
||||
</shape>
|
|
@ -7,6 +7,7 @@
|
|||
android:layout_height="wrap_content">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/attachment_keyboard_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/signal_background_primary"
|
||||
|
@ -29,6 +30,7 @@
|
|||
android:id="@+id/attachment_keyboard_button_list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="80dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:paddingStart="8dp"
|
||||
android:clipToPadding="false"
|
||||
android:clipChildren="false"
|
||||
|
|
|
@ -120,4 +120,6 @@
|
|||
<color name="tooltip_default_color">@color/core_grey_75</color>
|
||||
|
||||
<color name="wallpaper_preview_background">@color/transparent_black_60</color>
|
||||
<color name="wallpaper_compose_background">@color/transparent_black_80</color>
|
||||
<color name="wallpaper_toolbar_background">@color/core_black</color>
|
||||
</resources>
|
||||
|
|
|
@ -120,4 +120,6 @@
|
|||
<color name="tooltip_default_color">@color/core_white</color>
|
||||
|
||||
<color name="wallpaper_preview_background">@color/transparent_white_30</color>
|
||||
<color name="wallpaper_compose_background">@color/transparent_white_80</color>
|
||||
<color name="wallpaper_toolbar_background">@color/core_white</color>
|
||||
</resources>
|
||||
|
|
Ładowanie…
Reference in New Issue