Skip to content

Commit

Permalink
OFAC UI changes for rewards
Browse files Browse the repository at this point in the history
  • Loading branch information
deeppandya committed Jan 10, 2023
1 parent e64018f commit df0e4e7
Showing 1 changed file with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

import androidx.preference.Preference;
import androidx.preference.Preference.OnPreferenceChangeListener;
import androidx.preference.PreferenceCategory;

import org.chromium.base.ContextUtils;
import org.chromium.chrome.R;
Expand All @@ -35,6 +36,7 @@ public class BackgroundImagesPreferences
public static final String PREF_SHOW_BRAVE_STATS = "show_brave_stats";
public static final String PREF_SHOW_NON_DISRUPTIVE_BANNER = "show_non_disruptive_banner";
public static final String PREF_SHOW_BRE_BANNER = "show_bre_banner";
public static final String PREF_BACKGROUND_IMAGES_CATEGORY = "background_images";

private ChromeSwitchPreference mShowBackgroundImagesPref;
private ChromeSwitchPreference mShowSponsoredImagesPref;
Expand All @@ -46,14 +48,6 @@ public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getActivity().setTitle(R.string.prefs_new_tab_page);
SettingsUtils.addPreferencesFromResource(this, R.xml.background_images_preferences);
if (!NTPBackgroundImagesBridge.enableSponsoredImages()) {
removePreferenceIfPresent(PREF_SHOW_SPONSORED_IMAGES);
}
}

private void removePreferenceIfPresent(String key) {
Preference preference = getPreferenceScreen().findPreference(key);
if (preference != null) getPreferenceScreen().removePreference(preference);
}

@Override
Expand All @@ -80,6 +74,12 @@ public void onActivityCreated(Bundle savedInstanceState) {
BravePref.NEW_TAB_PAGE_SHOW_SPONSORED_IMAGES_BACKGROUND_IMAGE));
mShowSponsoredImagesPref.setOnPreferenceChangeListener(this);
}
if (!NTPBackgroundImagesBridge.enableSponsoredImages()) {
PreferenceCategory preferenceCategory =
(PreferenceCategory) findPreference(PREF_BACKGROUND_IMAGES_CATEGORY);
preferenceCategory.removePreference(mShowSponsoredImagesPref);
}

mShowTopSitesPref = (ChromeSwitchPreference) findPreference(PREF_SHOW_TOP_SITES);
if (mShowTopSitesPref != null) {
mShowTopSitesPref.setEnabled(true);
Expand Down

0 comments on commit df0e4e7

Please sign in to comment.