mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-02-23 11:15:44 +00:00
Switch to a standard toolbar color.
* Switch to a standard toolbar color. * T r a n s p a r e n c y * Add back a toolbar shadow. * Some more theming * Also fix verify identity screen. * Hide shadow on empty conversations. * Slightly less transparent.
This commit is contained in:
committed by
Cody Henthorne
parent
236e1ba885
commit
937a288cee
@@ -113,7 +113,7 @@ public class VerifyIdentityActivity extends PassphraseRequiredActivity implement
|
||||
private static final String IDENTITY_EXTRA = "recipient_identity";
|
||||
private static final String VERIFIED_EXTRA = "verified_state";
|
||||
|
||||
private final DynamicTheme dynamicTheme = new DynamicDarkActionBarTheme();
|
||||
private final DynamicTheme dynamicTheme = new DynamicTheme();
|
||||
|
||||
private final VerifyDisplayFragment displayFragment = new VerifyDisplayFragment();
|
||||
private final VerifyScanFragment scanFragment = new VerifyScanFragment();
|
||||
@@ -161,11 +161,6 @@ public class VerifyIdentityActivity extends PassphraseRequiredActivity implement
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
getSupportActionBar().setTitle(R.string.AndroidManifest__verify_safety_number);
|
||||
|
||||
LiveRecipient recipient = Recipient.live(getIntent().getParcelableExtra(RECIPIENT_EXTRA));
|
||||
recipient.observe(this, r -> setActionBarNotificationBarColor(r.getColor()));
|
||||
|
||||
setActionBarNotificationBarColor(recipient.get().getColor());
|
||||
|
||||
Bundle extras = new Bundle();
|
||||
extras.putParcelable(VerifyDisplayFragment.RECIPIENT_ID, getIntent().getParcelableExtra(RECIPIENT_EXTRA));
|
||||
extras.putParcelable(VerifyDisplayFragment.REMOTE_IDENTITY, getIntent().getParcelableExtra(IDENTITY_EXTRA));
|
||||
|
||||
@@ -26,12 +26,10 @@ import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.content.pm.ShortcutManager;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.content.res.Configuration;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.hardware.Camera;
|
||||
import android.net.Uri;
|
||||
@@ -106,7 +104,6 @@ import org.thoughtcrime.securesms.VerifyIdentityActivity;
|
||||
import org.thoughtcrime.securesms.attachments.Attachment;
|
||||
import org.thoughtcrime.securesms.attachments.TombstoneAttachment;
|
||||
import org.thoughtcrime.securesms.audio.AudioRecorder;
|
||||
import org.thoughtcrime.securesms.color.MaterialColor;
|
||||
import org.thoughtcrime.securesms.components.AnimatingToggle;
|
||||
import org.thoughtcrime.securesms.components.ComposeText;
|
||||
import org.thoughtcrime.securesms.components.ConversationSearchBottomBar;
|
||||
@@ -255,8 +252,8 @@ import org.thoughtcrime.securesms.util.CommunicationActions;
|
||||
import org.thoughtcrime.securesms.util.ContextUtil;
|
||||
import org.thoughtcrime.securesms.util.ConversationUtil;
|
||||
import org.thoughtcrime.securesms.util.DrawableUtil;
|
||||
import org.thoughtcrime.securesms.util.DynamicDarkToolbarTheme;
|
||||
import org.thoughtcrime.securesms.util.DynamicLanguage;
|
||||
import org.thoughtcrime.securesms.util.DynamicNoActionBarTheme;
|
||||
import org.thoughtcrime.securesms.util.DynamicTheme;
|
||||
import org.thoughtcrime.securesms.util.FeatureFlags;
|
||||
import org.thoughtcrime.securesms.util.FullscreenHelper;
|
||||
@@ -381,6 +378,7 @@ public class ConversationActivity extends PassphraseRequiredActivity
|
||||
private boolean callingTooltipShown;
|
||||
private ImageView wallpaper;
|
||||
private View wallpaperDim;
|
||||
private Toolbar toolbar;
|
||||
|
||||
private LinkPreviewViewModel linkPreviewViewModel;
|
||||
private ConversationSearchViewModel searchViewModel;
|
||||
@@ -401,7 +399,7 @@ public class ConversationActivity extends PassphraseRequiredActivity
|
||||
private boolean isSecurityInitialized = false;
|
||||
|
||||
private IdentityRecordList identityRecords = new IdentityRecordList(Collections.emptyList());
|
||||
private final DynamicTheme dynamicTheme = new DynamicDarkToolbarTheme();
|
||||
private final DynamicTheme dynamicTheme = new DynamicNoActionBarTheme();
|
||||
private final DynamicLanguage dynamicLanguage = new DynamicLanguage();
|
||||
|
||||
@Override
|
||||
@@ -428,7 +426,6 @@ public class ConversationActivity extends PassphraseRequiredActivity
|
||||
setContentView(R.layout.conversation_activity);
|
||||
|
||||
getWindow().getDecorView().setBackgroundResource(R.color.signal_background_primary);
|
||||
WindowUtil.setLightNavigationBarFromTheme(this);
|
||||
|
||||
fragment = initFragment(R.id.fragment_content, new ConversationFragment(), dynamicLanguage.getCurrentLocale());
|
||||
|
||||
@@ -529,6 +526,9 @@ public class ConversationActivity extends PassphraseRequiredActivity
|
||||
dynamicTheme.onResume(this);
|
||||
dynamicLanguage.onResume(this);
|
||||
|
||||
WindowUtil.setLightNavigationBarFromTheme(this);
|
||||
WindowUtil.setLightStatusBarFromTheme(this);
|
||||
|
||||
EventBus.getDefault().register(this);
|
||||
initializeMmsEnabledCheck();
|
||||
initializeIdentityRecords();
|
||||
@@ -537,7 +537,6 @@ public class ConversationActivity extends PassphraseRequiredActivity
|
||||
Recipient recipientSnapshot = recipient.get();
|
||||
|
||||
titleView.setTitle(glideRequests, recipientSnapshot);
|
||||
setActionBarColor(recipientSnapshot.getColor());
|
||||
setBlockedUserState(recipientSnapshot, isSecureText, isDefaultSms);
|
||||
calculateCharactersRemaining();
|
||||
|
||||
@@ -1933,7 +1932,7 @@ public class ConversationActivity extends PassphraseRequiredActivity
|
||||
noLongerMemberBanner = findViewById(R.id.conversation_no_longer_member_banner);
|
||||
requestingMemberBanner = findViewById(R.id.conversation_requesting_banner);
|
||||
cancelJoinRequest = findViewById(R.id.conversation_cancel_request);
|
||||
joinGroupCallButton = findViewById(R.id.conversation_group_cal_join);
|
||||
joinGroupCallButton = findViewById(R.id.conversation_group_call_join);
|
||||
|
||||
container.addOnKeyboardShownListener(this);
|
||||
inputPanel.setListener(this);
|
||||
@@ -2001,6 +2000,10 @@ public class ConversationActivity extends PassphraseRequiredActivity
|
||||
if (attachmentKeyboardStub.resolved()) {
|
||||
attachmentKeyboardStub.get().setWallpaperEnabled(true);
|
||||
}
|
||||
|
||||
int toolbarColor = getResources().getColor(R.color.conversation_toolbar_color_wallpaper);
|
||||
toolbar.setBackgroundColor(toolbarColor);
|
||||
WindowUtil.setStatusBarColor(getWindow(), toolbarColor);
|
||||
} else {
|
||||
wallpaper.setImageDrawable(null);
|
||||
wallpaperDim.setVisibility(View.GONE);
|
||||
@@ -2008,12 +2011,16 @@ public class ConversationActivity extends PassphraseRequiredActivity
|
||||
if (attachmentKeyboardStub.resolved()) {
|
||||
attachmentKeyboardStub.get().setWallpaperEnabled(false);
|
||||
}
|
||||
|
||||
int toolbarColor = getResources().getColor(R.color.conversation_toolbar_color);
|
||||
toolbar.setBackgroundColor(toolbarColor);
|
||||
WindowUtil.setStatusBarColor(getWindow(), toolbarColor);
|
||||
}
|
||||
fragment.onWallpaperChanged(chatWallpaper);
|
||||
}
|
||||
|
||||
protected void initializeActionBar() {
|
||||
Toolbar toolbar = findViewById(R.id.toolbar);
|
||||
toolbar = findViewById(R.id.toolbar);
|
||||
setSupportActionBar(toolbar);
|
||||
|
||||
ActionBar supportActionBar = getSupportActionBar();
|
||||
@@ -2305,7 +2312,6 @@ public class ConversationActivity extends PassphraseRequiredActivity
|
||||
titleView.setTitle(glideRequests, recipient);
|
||||
titleView.setVerified(identityRecords.isVerified());
|
||||
setBlockedUserState(recipient, isSecureText, isDefaultSms);
|
||||
setActionBarColor(recipient.getColor());
|
||||
updateReminders();
|
||||
updateDefaultSubscriptionId(recipient.getDefaultSubscriptionId());
|
||||
initializeSecurity(isSecureText, isDefaultSms);
|
||||
@@ -2507,18 +2513,6 @@ public class ConversationActivity extends PassphraseRequiredActivity
|
||||
return future;
|
||||
}
|
||||
|
||||
private void setActionBarColor(MaterialColor color) {
|
||||
ActionBar supportActionBar = getSupportActionBar();
|
||||
if (supportActionBar == null) throw new AssertionError();
|
||||
int actionBarColor = color.toActionBarColor(this);
|
||||
supportActionBar.setBackgroundDrawable(new ColorDrawable(actionBarColor));
|
||||
WindowUtil.setStatusBarColor(getWindow(), actionBarColor);
|
||||
|
||||
joinGroupCallButton.setTextColor(actionBarColor);
|
||||
joinGroupCallButton.setIconTint(ColorStateList.valueOf(actionBarColor));
|
||||
joinGroupCallButton.setRippleColor(ColorStateList.valueOf(actionBarColor));
|
||||
}
|
||||
|
||||
private void setBlockedUserState(Recipient recipient, boolean isSecureText, boolean isDefaultSms) {
|
||||
if (!isSecureText && isPushGroupConversation()) {
|
||||
unblockButton.setVisibility(View.GONE);
|
||||
|
||||
@@ -23,6 +23,8 @@ import android.content.ClipData;
|
||||
import android.content.ClipboardManager;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.res.Configuration;
|
||||
import android.graphics.Rect;
|
||||
import android.net.Uri;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Build;
|
||||
@@ -35,6 +37,7 @@ import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.ViewTreeObserver;
|
||||
import android.view.Window;
|
||||
import android.view.animation.Animation;
|
||||
import android.view.animation.AnimationUtils;
|
||||
@@ -196,6 +199,7 @@ public class ConversationFragment extends LoggingFragment {
|
||||
private OnScrollListener conversationScrollListener;
|
||||
private int pulsePosition = -1;
|
||||
private VoiceNoteMediaController voiceNoteMediaController;
|
||||
private View toolbarShadow;
|
||||
|
||||
public static void prepare(@NonNull Context context) {
|
||||
FrameLayout parent = new FrameLayout(context);
|
||||
@@ -225,6 +229,7 @@ public class ConversationFragment extends LoggingFragment {
|
||||
scrollToMentionButton = view.findViewById(R.id.scroll_to_mention);
|
||||
scrollDateHeader = view.findViewById(R.id.scroll_date_header);
|
||||
emptyConversationBanner = view.findViewById(R.id.empty_conversation_banner);
|
||||
toolbarShadow = requireActivity().findViewById(R.id.conversation_toolbar_shadow);
|
||||
|
||||
final LinearLayoutManager layoutManager = new SmoothScrollingLinearLayoutManager(getActivity(), true);
|
||||
list.setHasFixedSize(false);
|
||||
@@ -283,6 +288,8 @@ public class ConversationFragment extends LoggingFragment {
|
||||
scrollToBottomButton.setOnClickListener(v -> scrollToBottom());
|
||||
scrollToMentionButton.setOnClickListener(v -> scrollToNextMention());
|
||||
|
||||
updateToolbarDependentMargins();
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
@@ -363,6 +370,12 @@ public class ConversationFragment extends LoggingFragment {
|
||||
ApplicationDependencies.getTypingStatusRepository().getTypists(threadId).removeObservers(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConfigurationChanged(@NonNull Configuration newConfig) {
|
||||
super.onConfigurationChanged(newConfig);
|
||||
updateToolbarDependentMargins();
|
||||
}
|
||||
|
||||
public void onNewIntent() {
|
||||
if (actionMode != null) {
|
||||
actionMode.finish();
|
||||
@@ -526,6 +539,7 @@ public class ConversationFragment extends LoggingFragment {
|
||||
|
||||
conversationScrollListener = new ConversationScrollListener(requireContext());
|
||||
list.addOnScrollListener(conversationScrollListener);
|
||||
list.addOnScrollListener(new ShadowScrollListener());
|
||||
|
||||
if (oldThreadId != threadId) {
|
||||
ApplicationDependencies.getTypingStatusRepository().getTypists(oldThreadId).removeObservers(this);
|
||||
@@ -548,6 +562,7 @@ public class ConversationFragment extends LoggingFragment {
|
||||
emptyConversationBanner.setVisibility(View.GONE);
|
||||
} else if (threadId == -1) {
|
||||
emptyConversationBanner.setVisibility(View.VISIBLE);
|
||||
toolbarShadow.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1127,6 +1142,22 @@ public class ConversationFragment extends LoggingFragment {
|
||||
}
|
||||
}
|
||||
|
||||
private void updateToolbarDependentMargins() {
|
||||
Toolbar toolbar = requireActivity().findViewById(R.id.toolbar);
|
||||
toolbar.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
|
||||
@Override
|
||||
public void onGlobalLayout() {
|
||||
Rect rect = new Rect();
|
||||
toolbar.getGlobalVisibleRect(rect);
|
||||
ViewUtil.setTopMargin(scrollDateHeader, rect.bottom + ViewUtil.dpToPx(8));
|
||||
ViewUtil.setTopMargin(conversationBanner, rect.bottom + ViewUtil.dpToPx(16));
|
||||
ViewUtil.setTopMargin(emptyConversationBanner, rect.bottom + ViewUtil.dpToPx(16));
|
||||
toolbar.getViewTreeObserver().removeOnGlobalLayoutListener(this);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public interface ConversationFragmentListener {
|
||||
void setThreadId(long threadId);
|
||||
void handleReplyMessage(ConversationMessage conversationMessage);
|
||||
@@ -1249,6 +1280,7 @@ public class ConversationFragment extends LoggingFragment {
|
||||
listener.handleReaction(maskTarget, messageRecord, new ReactionsToolbarListener(conversationMessage), () -> {
|
||||
isReacting = false;
|
||||
list.setLayoutFrozen(false);
|
||||
WindowUtil.setLightStatusBarFromTheme(requireActivity());
|
||||
});
|
||||
} else {
|
||||
((ConversationAdapter) list.getAdapter()).toggleSelection(conversationMessage);
|
||||
@@ -1605,7 +1637,7 @@ public class ConversationFragment extends LoggingFragment {
|
||||
|
||||
mode.setTitle("1");
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
if (Build.VERSION.SDK_INT >= 21) {
|
||||
Window window = getActivity().getWindow();
|
||||
statusBarColor = window.getStatusBarColor();
|
||||
WindowUtil.setStatusBarColor(window, getResources().getColor(R.color.action_mode_status_bar));
|
||||
@@ -1631,11 +1663,11 @@ public class ConversationFragment extends LoggingFragment {
|
||||
((ConversationAdapter)list.getAdapter()).clearSelection();
|
||||
list.getAdapter().notifyDataSetChanged();
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
if (Build.VERSION.SDK_INT >= 21) {
|
||||
WindowUtil.setStatusBarColor(requireActivity().getWindow(), statusBarColor);
|
||||
}
|
||||
|
||||
WindowUtil.clearLightStatusBar(getActivity().getWindow());
|
||||
WindowUtil.setLightStatusBarFromTheme(requireActivity());
|
||||
actionMode = null;
|
||||
}
|
||||
|
||||
@@ -1722,4 +1754,18 @@ public class ConversationFragment extends LoggingFragment {
|
||||
}
|
||||
}
|
||||
|
||||
private class ShadowScrollListener extends RecyclerView.OnScrollListener {
|
||||
@Override
|
||||
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
|
||||
if (recyclerView.canScrollVertically(-1)) {
|
||||
if (toolbarShadow.getVisibility() != View.VISIBLE) {
|
||||
ViewUtil.fadeIn(toolbarShadow, 250);
|
||||
}
|
||||
} else {
|
||||
if (toolbarShadow.getVisibility() != View.GONE) {
|
||||
ViewUtil.fadeOut(toolbarShadow, 250);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ public class ConversationTitleView extends RelativeLayout {
|
||||
}
|
||||
|
||||
title.setCompoundDrawablesRelativeWithIntrinsicBounds(startDrawable, 0, endDrawable, 0);
|
||||
TextViewCompat.setCompoundDrawableTintList(title, ColorStateList.valueOf(ContextCompat.getColor(getContext(), R.color.transparent_white_90)));
|
||||
TextViewCompat.setCompoundDrawableTintList(title, ColorStateList.valueOf(ContextCompat.getColor(getContext(), R.color.signal_inverse_transparent_80)));
|
||||
|
||||
if (recipient != null) {
|
||||
this.avatar.setAvatar(glideRequests, recipient, false);
|
||||
|
||||
@@ -39,7 +39,7 @@ public final class MessageDetailsActivity extends PassphraseRequiredActivity {
|
||||
private MessageDetailsViewModel viewModel;
|
||||
private MessageDetailsAdapter adapter;
|
||||
|
||||
private DynamicTheme dynamicTheme = new DynamicDarkActionBarTheme();
|
||||
private DynamicTheme dynamicTheme = new DynamicTheme();
|
||||
|
||||
public static @NonNull Intent getIntentForMessageDetails(@NonNull Context context, @NonNull MessageRecord message, @NonNull RecipientId recipientId, long threadId) {
|
||||
Intent intent = new Intent(context, MessageDetailsActivity.class);
|
||||
@@ -116,15 +116,6 @@ public final class MessageDetailsActivity extends PassphraseRequiredActivity {
|
||||
private void initializeActionBar() {
|
||||
requireSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
requireSupportActionBar().setTitle(R.string.AndroidManifest__message_details);
|
||||
|
||||
viewModel.getRecipientColor().observe(this, this::setActionBarColor);
|
||||
}
|
||||
|
||||
private void setActionBarColor(MaterialColor color) {
|
||||
assert getSupportActionBar() != null;
|
||||
getSupportActionBar().setBackgroundDrawable(new ColorDrawable(color.toActionBarColor(this)));
|
||||
|
||||
WindowUtil.setStatusBarColor(getWindow(), color.toStatusBarColor(this));
|
||||
}
|
||||
|
||||
private List<MessageDetailsViewState<?>> convertToRows(MessageDetails details) {
|
||||
|
||||
Reference in New Issue
Block a user