Skip to content

Commit

Permalink
Uplift of #13945 (squashed) to beta
Browse files Browse the repository at this point in the history
  • Loading branch information
Pavneet-Sing committed Jun 24, 2022
1 parent e5206b0 commit 80a2725
Showing 1 changed file with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.res.ColorStateList;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.Canvas;
Expand Down Expand Up @@ -124,6 +125,7 @@
import org.chromium.content_public.browser.NavigationHandle;
import org.chromium.ui.UiUtils;
import org.chromium.ui.interpolators.BakedBezierInterpolator;
import org.chromium.ui.util.ColorUtils;
import org.chromium.ui.widget.Toast;
import org.chromium.url.GURL;

Expand Down Expand Up @@ -170,6 +172,7 @@ public abstract class BraveToolbarLayoutImpl extends ToolbarLayout
private TextView mBraveRewardsNotificationsCount;
private ImageView mBraveRewardsOnboardingIcon;
private View mBraveWalletBadge;
private ImageView mWalletIcon;
private boolean mShieldsLayoutIsColorBackground;
private int mCurrentToolbarColor;

Expand All @@ -181,6 +184,9 @@ public abstract class BraveToolbarLayoutImpl extends ToolbarLayout

private boolean mIsBottomToolbarVisible;

private ColorStateList mDarkModeTint;
private ColorStateList mLightModeTint;

private final Set<Integer> mTabsWithWalletIcon =
Collections.synchronizedSet(new HashSet<Integer>());

Expand Down Expand Up @@ -226,6 +232,11 @@ protected void onFinishInflate() {
mBraveRewardsButton = (ImageButton) findViewById(R.id.brave_rewards_button);
mHomeButton = (HomeButton) findViewById(R.id.home_button);
mBraveWalletBadge = findViewById(R.id.wallet_notfication_badge);
mWalletIcon = mWalletLayout.findViewById(R.id.brave_wallet_button);

mDarkModeTint = ThemeUtils.getThemedToolbarIconTint(getContext(), false);
mLightModeTint =
ColorStateList.valueOf(ContextCompat.getColor(getContext(), R.color.brave_white));

if (mHomeButton != null) {
mHomeButton.setOnLongClickListener(this);
Expand Down Expand Up @@ -1178,6 +1189,10 @@ private void updateNotificationBadgeForNewInstall() {

@Override
public void onThemeColorChanged(int color, boolean shouldAnimate) {
ApiCompatibilityUtils.setImageTintList(mWalletIcon,
!ColorUtils.shouldUseLightForegroundOnBackground(color) ? mDarkModeTint
: mLightModeTint);

final int textBoxColor = ThemeUtils.getTextBoxColorForToolbarBackgroundInNonNativePage(
getContext(), color, isIncognito());
updateModernLocationBarColorImpl(textBoxColor);
Expand Down

0 comments on commit 80a2725

Please sign in to comment.