Skip to content

Commit

Permalink
resolved comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Nikhil7174 committed Jun 1, 2024
1 parent 8736811 commit 0c02e40
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 71 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,50 +109,50 @@ public void prepareMenu(Menu menu, AppMenuHandler handler) {

mMenu = menu;

// if (BraveVpnUtils.isVpnFeatureSupported(mContext)) {
// SubMenu vpnSubMenu = menu.findItem(R.id.request_brave_vpn_row_menu_id).getSubMenu();
// MenuItem braveVpnSubMenuItem = vpnSubMenu.findItem(R.id.request_brave_vpn_id);
// if (shouldShowIconBeforeItem()) {
// braveVpnSubMenuItem.setIcon(
// AppCompatResources.getDrawable(mContext, R.drawable.ic_vpn));
// }
// MenuItem braveVpnCheckedSubMenuItem =
// vpnSubMenu.findItem(R.id.request_brave_vpn_check_id);
// if (braveVpnCheckedSubMenuItem != null) {
// braveVpnCheckedSubMenuItem.setCheckable(true);
// braveVpnCheckedSubMenuItem.setChecked(
// BraveVpnProfileUtils.getInstance().isBraveVPNConnected(mContext));
// }

// if (BraveVpnPrefUtils.isSubscriptionPurchase()
// && !TextUtils.isEmpty(BraveVpnPrefUtils.getServerIsoCode())) {
// String serverLocation =
// " "
// + BraveVpnUtils.countryCodeToEmoji(
// BraveVpnPrefUtils.getServerIsoCode())
// + " "
// + BraveVpnPrefUtils.getServerNamePretty();

// SubMenu vpnLocationSubMenu =
// menu.findItem(R.id.request_vpn_location_row_menu_id).getSubMenu();
// MenuItem vpnLocationSubMenuItem =
// vpnLocationSubMenu.findItem(R.id.request_vpn_location_id);
// vpnLocationSubMenuItem.setTitle(serverLocation);
// MenuItem vpnLocationIconSubMenuItem =
// vpnLocationSubMenu.findItem(R.id.request_vpn_location_icon_id);
// Drawable drawable = vpnLocationIconSubMenuItem.getIcon();

// drawable = DrawableCompat.wrap(drawable);
// DrawableCompat.setTint(
// drawable, ContextCompat.getColor(mContext, R.color.vpn_timer_icon_color));
// vpnLocationIconSubMenuItem.setIcon(drawable);
// } else {
// menu.findItem(R.id.request_vpn_location_row_menu_id).setVisible(false);
// }
// } else {
if (BraveVpnUtils.isVpnFeatureSupported(mContext) && false) {
SubMenu vpnSubMenu = menu.findItem(R.id.request_brave_vpn_row_menu_id).getSubMenu();
MenuItem braveVpnSubMenuItem = vpnSubMenu.findItem(R.id.request_brave_vpn_id);
if (shouldShowIconBeforeItem()) {
braveVpnSubMenuItem.setIcon(
AppCompatResources.getDrawable(mContext, R.drawable.ic_vpn));
}
MenuItem braveVpnCheckedSubMenuItem =
vpnSubMenu.findItem(R.id.request_brave_vpn_check_id);
if (braveVpnCheckedSubMenuItem != null) {
braveVpnCheckedSubMenuItem.setCheckable(true);
braveVpnCheckedSubMenuItem.setChecked(
BraveVpnProfileUtils.getInstance().isBraveVPNConnected(mContext));
}

if (BraveVpnPrefUtils.isSubscriptionPurchase()
&& !TextUtils.isEmpty(BraveVpnPrefUtils.getServerIsoCode())) {
String serverLocation =
" "
+ BraveVpnUtils.countryCodeToEmoji(
BraveVpnPrefUtils.getServerIsoCode())
+ " "
+ BraveVpnPrefUtils.getServerNamePretty();

SubMenu vpnLocationSubMenu =
menu.findItem(R.id.request_vpn_location_row_menu_id).getSubMenu();
MenuItem vpnLocationSubMenuItem =
vpnLocationSubMenu.findItem(R.id.request_vpn_location_id);
vpnLocationSubMenuItem.setTitle(serverLocation);
MenuItem vpnLocationIconSubMenuItem =
vpnLocationSubMenu.findItem(R.id.request_vpn_location_icon_id);
Drawable drawable = vpnLocationIconSubMenuItem.getIcon();

drawable = DrawableCompat.wrap(drawable);
DrawableCompat.setTint(
drawable, ContextCompat.getColor(mContext, R.color.vpn_timer_icon_color));
vpnLocationIconSubMenuItem.setIcon(drawable);
} else {
menu.findItem(R.id.request_vpn_location_row_menu_id).setVisible(false);
}
} else {
menu.findItem(R.id.request_brave_vpn_row_menu_id).setVisible(false);
menu.findItem(R.id.request_vpn_location_row_menu_id).setVisible(false);
// }
}

// Brave donesn't show `Clear browsing data` menu.
menu.findItem(R.id.quick_delete_menu_id).setVisible(false).setEnabled(false);
Expand Down Expand Up @@ -220,38 +220,38 @@ public void prepareMenu(Menu menu, AppMenuHandler handler) {
}

MenuItem bravePlaylist = menu.findItem(R.id.brave_playlist_id);
// if (bravePlaylist != null) {
// if (ChromeFeatureList.isEnabled(BraveFeatureList.BRAVE_PLAYLIST)
// && ChromeSharedPreferences.getInstance()
// .readBoolean(BravePreferenceKeys.PREF_ENABLE_PLAYLIST, true)) {
// bravePlaylist.setVisible(true);
// if (shouldShowIconBeforeItem()) {
// bravePlaylist.setIcon(
// AppCompatResources.getDrawable(mContext, R.drawable.ic_open_playlist));
// }
// } else {
if (bravePlaylist != null || true) {
if (ChromeFeatureList.isEnabled(BraveFeatureList.BRAVE_PLAYLIST)
&& ChromeSharedPreferences.getInstance()
.readBoolean(BravePreferenceKeys.PREF_ENABLE_PLAYLIST, true) && false) {
bravePlaylist.setVisible(true);
if (shouldShowIconBeforeItem()) {
bravePlaylist.setIcon(
AppCompatResources.getDrawable(mContext, R.drawable.ic_open_playlist));
}
} else {
bravePlaylist.setVisible(false);
// }
// }
}
}

MenuItem addToPlaylist = menu.findItem(R.id.add_to_playlist_id);
// if (addToPlaylist != null) {
// if (ChromeFeatureList.isEnabled(BraveFeatureList.BRAVE_PLAYLIST)
// && ChromeSharedPreferences.getInstance()
// .readBoolean(BravePreferenceKeys.PREF_ENABLE_PLAYLIST, true)
// && !ChromeSharedPreferences.getInstance()
// .readBoolean(BravePreferenceKeys.PREF_ADD_TO_PLAYLIST_BUTTON, true)
// && BraveToolbarLayoutImpl.mShouldShowPlaylistMenu) {
// addToPlaylist.setVisible(true);
// if (shouldShowIconBeforeItem()) {
// addToPlaylist.setIcon(
// AppCompatResources.getDrawable(
// mContext, R.drawable.ic_baseline_add_24));
// }
// } else {
if (addToPlaylist != null || true) {
if (ChromeFeatureList.isEnabled(BraveFeatureList.BRAVE_PLAYLIST)
&& ChromeSharedPreferences.getInstance()
.readBoolean(BravePreferenceKeys.PREF_ENABLE_PLAYLIST, true)
&& !ChromeSharedPreferences.getInstance()
.readBoolean(BravePreferenceKeys.PREF_ADD_TO_PLAYLIST_BUTTON, true)
&& BraveToolbarLayoutImpl.mShouldShowPlaylistMenu && false) {
addToPlaylist.setVisible(true);
if (shouldShowIconBeforeItem()) {
addToPlaylist.setIcon(
AppCompatResources.getDrawable(
mContext, R.drawable.ic_baseline_add_24));
}
} else {
addToPlaylist.setVisible(false);
// }
// }
}
}
//
// MenuItem braveNews = menu.add(Menu.NONE, R.id.brave_news_id, 0, R.string.brave_news_title);
// if (shouldShowIconBeforeItem()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public BraveNtpAdapter(Activity activity, OnBraveNtpListener onBraveNtpListener,
mRecyclerViewHeight = recyclerViewHeight;
mIsTopSitesEnabled = isTopSitesEnabled;
mIsBraveStatsEnabled = isBraveStatsEnabled;
// mIsDisplayNews = false;
mIsDisplayNewsFeed = false;
mIsDisplayNewsOptin = false;
}

Expand Down

0 comments on commit 0c02e40

Please sign in to comment.