use of android.content.Context.MODE_PRIVATE in project AntennaPod by AntennaPod.
the class QuickFeedDiscoveryFragment method loadToplist.
private void loadToplist() {
progressBar.setVisibility(View.VISIBLE);
discoverGridLayout.setVisibility(View.INVISIBLE);
errorView.setVisibility(View.GONE);
errorRetry.setVisibility(View.INVISIBLE);
poweredByTextView.setVisibility(View.VISIBLE);
ItunesTopListLoader loader = new ItunesTopListLoader(getContext());
SharedPreferences prefs = getActivity().getSharedPreferences(ItunesTopListLoader.PREFS, MODE_PRIVATE);
String countryCode = prefs.getString(ItunesTopListLoader.PREF_KEY_COUNTRY_CODE, Locale.getDefault().getCountry());
if (countryCode.equals(ItunesTopListLoader.DISCOVER_HIDE_FAKE_COUNTRY_CODE)) {
errorTextView.setText(String.format(getResources().getString(R.string.discover_is_hidden), getResources().getString(R.string.discover_hide)));
errorView.setVisibility(View.VISIBLE);
progressBar.setVisibility(View.GONE);
discoverGridLayout.setVisibility(View.INVISIBLE);
errorRetry.setVisibility(View.INVISIBLE);
poweredByTextView.setVisibility(View.INVISIBLE);
return;
}
disposable = loader.loadToplist(countryCode, NUM_SUGGESTIONS).subscribe(podcasts -> {
errorView.setVisibility(View.GONE);
progressBar.setVisibility(View.GONE);
discoverGridLayout.setVisibility(View.VISIBLE);
if (podcasts.size() == 0) {
errorTextView.setText(getResources().getText(R.string.search_status_no_results));
errorView.setVisibility(View.VISIBLE);
discoverGridLayout.setVisibility(View.INVISIBLE);
} else {
adapter.updateData(podcasts);
}
}, error -> {
Log.e(TAG, Log.getStackTraceString(error));
errorTextView.setText(error.getLocalizedMessage());
errorView.setVisibility(View.VISIBLE);
progressBar.setVisibility(View.GONE);
discoverGridLayout.setVisibility(View.INVISIBLE);
errorRetry.setVisibility(View.VISIBLE);
});
}
use of android.content.Context.MODE_PRIVATE in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class NotificationChannelWorker method removeUninstalledPackages.
private void removeUninstalledPackages() {
final SharedPreferences prefs = getContext().getSharedPreferences(PREFS, MODE_PRIVATE);
final Set<String> interactedPackages = prefs.getStringSet(PREF_KEY_INTERACTED_PACKAGES, new ArraySet());
if (interactedPackages.isEmpty()) {
return;
}
final List<PackageInfo> installedPackageInfos = getContext().getPackageManager().getInstalledPackages(0);
final List<String> installedPackages = installedPackageInfos.stream().map(packageInfo -> packageInfo.packageName).collect(Collectors.toList());
final Set<String> newInteractedPackages = new ArraySet<>();
for (String packageName : interactedPackages) {
if (installedPackages.contains(packageName)) {
newInteractedPackages.add(packageName);
}
}
prefs.edit().putStringSet(PREF_KEY_INTERACTED_PACKAGES, newInteractedPackages).apply();
}
Aggregations