[cr141][Android] Fixes for HidingField warning
warning: [HidingField] Hiding fields of superclasses may cause confusion and errors
This commit is contained in:
+24
-20
@@ -79,10 +79,10 @@ import java.util.List;
|
||||
/** Brave's extension for TabbedAppMenuPropertiesDelegate */
|
||||
@NullMarked
|
||||
public class BraveTabbedAppMenuPropertiesDelegate extends TabbedAppMenuPropertiesDelegate {
|
||||
private final AppMenuDelegate mAppMenuDelegate;
|
||||
private final AppMenuDelegate mBraveAppMenuDelegate;
|
||||
private final ObservableSupplier<BookmarkModel> mBookmarkModelSupplier;
|
||||
private boolean mJunitIsTesting;
|
||||
private final Context mContext;
|
||||
private final Context mBraveContext;
|
||||
|
||||
public BraveTabbedAppMenuPropertiesDelegate(
|
||||
Context context,
|
||||
@@ -117,9 +117,9 @@ public class BraveTabbedAppMenuPropertiesDelegate extends TabbedAppMenuPropertie
|
||||
incognitoReauthControllerOneshotSupplier,
|
||||
readAloudControllerSupplier);
|
||||
|
||||
mAppMenuDelegate = appMenuDelegate;
|
||||
mBraveAppMenuDelegate = appMenuDelegate;
|
||||
mBookmarkModelSupplier = bookmarkModelSupplier;
|
||||
mContext = context;
|
||||
mBraveContext = context;
|
||||
}
|
||||
|
||||
private void onFooterViewInflated(AppMenuHandler appMenuHandler, View view) {
|
||||
@@ -139,7 +139,7 @@ public class BraveTabbedAppMenuPropertiesDelegate extends TabbedAppMenuPropertie
|
||||
appMenuHandler,
|
||||
mBookmarkModelSupplier.get(),
|
||||
mActivityTabProvider.get(),
|
||||
mAppMenuDelegate);
|
||||
mBraveAppMenuDelegate);
|
||||
}
|
||||
|
||||
// Hide bookmark button if bottom toolbar is enabled and address bar is on top.
|
||||
@@ -182,7 +182,7 @@ public class BraveTabbedAppMenuPropertiesDelegate extends TabbedAppMenuPropertie
|
||||
public @Nullable View buildFooterView(AppMenuHandler appMenuHandler) {
|
||||
if (isMenuButtonInBottomToolbar() && shouldShowPageMenu()) {
|
||||
View footer =
|
||||
LayoutInflater.from(mContext).inflate(R.layout.icon_row_menu_footer, null);
|
||||
LayoutInflater.from(mBraveContext).inflate(R.layout.icon_row_menu_footer, null);
|
||||
|
||||
this.onFooterViewInflated(appMenuHandler, footer);
|
||||
|
||||
@@ -206,37 +206,41 @@ public class BraveTabbedAppMenuPropertiesDelegate extends TabbedAppMenuPropertie
|
||||
if (itemId == R.id.new_tab_menu_id) {
|
||||
item.model.set(
|
||||
AppMenuItemProperties.ICON,
|
||||
AppCompatResources.getDrawable(mContext, R.drawable.ic_new_tab_page));
|
||||
AppCompatResources.getDrawable(mBraveContext, R.drawable.ic_new_tab_page));
|
||||
} else if (itemId == R.id.new_incognito_tab_menu_id) {
|
||||
item.model.set(
|
||||
AppMenuItemProperties.ICON,
|
||||
AppCompatResources.getDrawable(
|
||||
mContext, R.drawable.brave_menu_new_private_tab));
|
||||
mBraveContext, R.drawable.brave_menu_new_private_tab));
|
||||
} else if (itemId == R.id.all_bookmarks_menu_id) {
|
||||
item.model.set(
|
||||
AppMenuItemProperties.ICON,
|
||||
AppCompatResources.getDrawable(mContext, R.drawable.brave_menu_bookmarks));
|
||||
AppCompatResources.getDrawable(
|
||||
mBraveContext, R.drawable.brave_menu_bookmarks));
|
||||
} else if (itemId == R.id.recent_tabs_menu_id) {
|
||||
item.model.set(
|
||||
AppMenuItemProperties.ICON,
|
||||
AppCompatResources.getDrawable(
|
||||
mContext, R.drawable.brave_menu_recent_tabs));
|
||||
mBraveContext, R.drawable.brave_menu_recent_tabs));
|
||||
} else if (itemId == R.id.open_history_menu_id) {
|
||||
item.model.set(
|
||||
AppMenuItemProperties.ICON,
|
||||
AppCompatResources.getDrawable(mContext, R.drawable.brave_menu_history));
|
||||
AppCompatResources.getDrawable(
|
||||
mBraveContext, R.drawable.brave_menu_history));
|
||||
} else if (itemId == R.id.downloads_menu_id) {
|
||||
item.model.set(
|
||||
AppMenuItemProperties.ICON,
|
||||
AppCompatResources.getDrawable(mContext, R.drawable.brave_menu_downloads));
|
||||
AppCompatResources.getDrawable(
|
||||
mBraveContext, R.drawable.brave_menu_downloads));
|
||||
} else if (itemId == R.id.preferences_id) {
|
||||
item.model.set(
|
||||
AppMenuItemProperties.ICON,
|
||||
AppCompatResources.getDrawable(mContext, R.drawable.brave_menu_settings));
|
||||
AppCompatResources.getDrawable(
|
||||
mBraveContext, R.drawable.brave_menu_settings));
|
||||
} else if (itemId == R.id.download_page_id) {
|
||||
item.model.set(
|
||||
AppMenuItemProperties.ICON,
|
||||
AppCompatResources.getDrawable(mContext, R.drawable.ic_download));
|
||||
AppCompatResources.getDrawable(mBraveContext, R.drawable.ic_download));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -690,11 +694,11 @@ public class BraveTabbedAppMenuPropertiesDelegate extends TabbedAppMenuPropertie
|
||||
modelList, buildBraveSpeedreaderItem(), Arrays.asList(R.id.page_zoom_id));
|
||||
}
|
||||
}
|
||||
if (!BraveSetDefaultBrowserUtils.isBraveSetAsDefaultBrowser(mContext)) {
|
||||
if (!BraveSetDefaultBrowserUtils.isBraveSetAsDefaultBrowser(mBraveContext)) {
|
||||
modelList.add(buildSetDefaultBrowserItem());
|
||||
}
|
||||
if (!mJunitIsTesting) {
|
||||
if (BraveVpnUtils.isVpnFeatureSupported(mContext)) {
|
||||
if (BraveVpnUtils.isVpnFeatureSupported(mBraveContext)) {
|
||||
modelList.add(buildBraveVpnItem());
|
||||
if (BraveVpnPrefUtils.isSubscriptionPurchase()
|
||||
&& !TextUtils.isEmpty(BraveVpnPrefUtils.getRegionIsoCode())) {
|
||||
@@ -856,7 +860,7 @@ public class BraveTabbedAppMenuPropertiesDelegate extends TabbedAppMenuPropertie
|
||||
R.string.brave_vpn,
|
||||
shouldShowIconBeforeItem() ? R.drawable.ic_vpn : 0,
|
||||
R.id.request_brave_vpn_check_id,
|
||||
BraveVpnProfileUtils.getInstance().isBraveVPNConnected(mContext)));
|
||||
BraveVpnProfileUtils.getInstance().isBraveVPNConnected(mBraveContext)));
|
||||
}
|
||||
|
||||
private MVCListAdapter.ListItem buildBraveVpnLocationIconItem() {
|
||||
@@ -864,14 +868,14 @@ public class BraveTabbedAppMenuPropertiesDelegate extends TabbedAppMenuPropertie
|
||||
String regionName =
|
||||
BraveVpnPrefUtils.getRegionPrecision()
|
||||
.equals(BraveVpnConstants.REGION_PRECISION_COUNTRY)
|
||||
? mContext.getString(R.string.optimal_text)
|
||||
? mBraveContext.getString(R.string.optimal_text)
|
||||
: BraveVpnPrefUtils.getRegionNamePretty();
|
||||
Drawable secondaryActionIcon =
|
||||
AppCompatResources.getDrawable(mContext, R.drawable.ic_chevron_right);
|
||||
AppCompatResources.getDrawable(mBraveContext, R.drawable.ic_chevron_right);
|
||||
secondaryActionIcon = DrawableCompat.wrap(secondaryActionIcon);
|
||||
DrawableCompat.setTint(
|
||||
secondaryActionIcon,
|
||||
ContextCompat.getColor(mContext, R.color.vpn_timer_icon_color));
|
||||
ContextCompat.getColor(mBraveContext, R.color.vpn_timer_icon_color));
|
||||
PropertyModel model =
|
||||
buildModelForMenuItemWithSecondaryButton(
|
||||
R.id.request_vpn_location_id,
|
||||
|
||||
+12
-12
@@ -64,9 +64,9 @@ import java.util.function.BooleanSupplier;
|
||||
import java.util.function.Function;
|
||||
|
||||
public class BraveTabbedRootUiCoordinator extends TabbedRootUiCoordinator {
|
||||
private final AppCompatActivity mActivity;
|
||||
private final AppCompatActivity mBraveActivity;
|
||||
private final OneshotSupplier<HubManager> mHubManagerSupplier;
|
||||
private final ObservableSupplier<EdgeToEdgeController> mEdgeToEdgeControllerSupplier;
|
||||
private final ObservableSupplier<EdgeToEdgeController> mBraveEdgeToEdgeControllerSupplier;
|
||||
|
||||
public BraveTabbedRootUiCoordinator(
|
||||
@NonNull AppCompatActivity activity,
|
||||
@@ -170,21 +170,21 @@ public class BraveTabbedRootUiCoordinator extends TabbedRootUiCoordinator {
|
||||
bookmarkManagerOpenerSupplier,
|
||||
xrSpaceModeObservableSupplier);
|
||||
|
||||
mActivity = activity;
|
||||
mBraveActivity = activity;
|
||||
mHubManagerSupplier = hubManagerSupplier;
|
||||
mEdgeToEdgeControllerSupplier = edgeToEdgeSupplier;
|
||||
mBraveEdgeToEdgeControllerSupplier = edgeToEdgeSupplier;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPostInflationStartup() {
|
||||
super.onPostInflationStartup();
|
||||
|
||||
assert mActivity instanceof BraveActivity;
|
||||
assert mBraveActivity instanceof BraveActivity;
|
||||
|
||||
if (mActivity instanceof BraveActivity) {
|
||||
((BraveActivity) mActivity)
|
||||
if (mBraveActivity instanceof BraveActivity) {
|
||||
((BraveActivity) mBraveActivity)
|
||||
.updateBottomSheetPosition(
|
||||
mActivity.getResources().getConfiguration().orientation);
|
||||
mBraveActivity.getResources().getConfiguration().orientation);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -196,14 +196,14 @@ public class BraveTabbedRootUiCoordinator extends TabbedRootUiCoordinator {
|
||||
hubManager -> {
|
||||
// Make it negative to indicate that we adjust the bottom margin.
|
||||
int bottomToolbarHeight =
|
||||
mActivity
|
||||
mBraveActivity
|
||||
.getResources()
|
||||
.getDimensionPixelSize(R.dimen.bottom_controls_height)
|
||||
* -1;
|
||||
if (EdgeToEdgeUtils.isEdgeToEdgeBottomChinEnabled(mActivity)
|
||||
&& mEdgeToEdgeControllerSupplier.get() != null) {
|
||||
if (EdgeToEdgeUtils.isEdgeToEdgeBottomChinEnabled(mBraveActivity)
|
||||
&& mBraveEdgeToEdgeControllerSupplier.get() != null) {
|
||||
bottomToolbarHeight -=
|
||||
mEdgeToEdgeControllerSupplier.get().getBottomInsetPx();
|
||||
mBraveEdgeToEdgeControllerSupplier.get().getBottomInsetPx();
|
||||
}
|
||||
hubManager.setStatusIndicatorHeight(bottomToolbarHeight);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user