use of com.frostwire.android.core.ConfigurationManager in project frostwire by frostwire.
the class MainActivity method onResume.
@Override
protected void onResume() {
super.onResume();
localBroadcastReceiver.register(this);
setupDrawer();
ConfigurationManager CM = ConfigurationManager.instance();
if (CM.getBoolean(Constants.PREF_KEY_GUI_INITIAL_SETTINGS_COMPLETE)) {
mainResume();
Offers.initAdNetworks(this);
} else if (!isShutdown()) {
controller.startWizardActivity();
}
checkLastSeenVersionBuild();
registerMainBroadcastReceiver();
syncNavigationMenu();
updateNavigationMenu();
// UIUtils.showSocialLinksDialog(this, true, null, "");
if (CM.getBoolean(Constants.PREF_KEY_GUI_TOS_ACCEPTED)) {
checkExternalStoragePermissionsOrBindMusicService();
}
tryOnResumeInterstitial();
async(NetworkManager.instance(), NetworkManager::queryNetworkStatusBackground);
}
use of com.frostwire.android.core.ConfigurationManager in project frostwire by frostwire.
the class SoftwareUpdater method updateConfiguration.
private void updateConfiguration(Update update, MainActivity mainActivity) {
if (update.config == null) {
return;
}
if (update.config.activeSearchEngines != null && update.config.activeSearchEngines.keySet() != null) {
for (String name : update.config.activeSearchEngines.keySet()) {
SearchEngine engine = SearchEngine.forName(name);
if (engine != null) {
// LOG.info(engine.getName() + " is remotely active: " + update.config.activeSearchEngines.get(name));
engine.setActive(update.config.activeSearchEngines.get(name));
} else {
LOG.warn("Can't find any search engine by the name of: '" + name + "'");
}
}
}
ConfigurationManager CM = ConfigurationManager.instance();
CM.setStringArray(Constants.PREF_KEY_GUI_OFFERS_WATERFALL, update.config.waterfall);
CM.setInt(Constants.PREF_KEY_GUI_MOPUB_ALBUM_ART_BANNER_THRESHOLD, update.config.mopubAlbumArtBannerThreshold);
CM.setInt(Constants.PREF_KEY_GUI_MOPUB_PREVIEW_BANNER_THRESHOLD, update.config.mopubPreviewBannerThreshold);
CM.setInt(Constants.PREF_KEY_GUI_MOPUB_SEARCH_HEADER_BANNER_THRESHOLD, update.config.mopubSearchHeaderBannerThreshold);
CM.setInt(Constants.PREF_KEY_GUI_MOPUB_SEARCH_HEADER_BANNER_DISMISS_INTERVAL_IN_MS, update.config.mopubSearchHeaderBannerIntervalInMs);
CM.setInt(Constants.PREF_KEY_GUI_OGURY_THRESHOLD, update.config.oguryThreshold);
CM.setInt(Constants.PREF_KEY_GUI_PREBID_THRESHOLD, update.config.prebidThreshold);
CM.setInt(Constants.PREF_KEY_GUI_REMOVEADS_BACK_TO_BACK_THRESHOLD, update.config.removeAdsB2bThreshold);
CM.setInt(Constants.PREF_KEY_GUI_INTERSTITIAL_OFFERS_TRANSFER_STARTS, update.config.interstitialOffersTransferStarts);
CM.setInt(Constants.PREF_KEY_GUI_INTERSTITIAL_TRANSFER_OFFERS_TIMEOUT_IN_MINUTES, update.config.interstitialTransferOffersTimeoutInMinutes);
CM.setInt(Constants.PREF_KEY_GUI_INTERSTITIAL_ON_RESUME_FIRST_DISPLAY_DELAY_IN_MINUTES, update.config.interstitialOnResumeFirstDisplayDelayInMinutes);
CM.setInt(Constants.PREF_KEY_GUI_INTERSTITIAL_ON_RESUME_TIMEOUT_IN_MINUTES, update.config.interstitialOnResumeTimeoutInMinutes);
CM.setInt(Constants.PREF_KEY_GUI_INTERSTITIAL_ON_EXIT_THRESHOLD, update.config.onExitThreshold);
CM.setInt(Constants.PREF_KEY_GUI_INTERSTITIAL_ON_BACK_THRESHOLD, update.config.onBackThreshold);
CM.setInt(Constants.PREF_KEY_GUI_INTERSTITIAL_ON_RESUME_THRESHOLD, update.config.onResumeThreshold);
// This has to be invoked once again here. It gets invoked by main activity on resume before we're done on this thread.
Offers.initAdNetworks(mainActivity);
if (update.config.uxEnabled && CM.getBoolean(Constants.PREF_KEY_UXSTATS_ENABLED)) {
String url = "http://ux.frostwire.com/aux";
String os = SearchEngine.getOSVersionString();
String fwversion = Constants.FROSTWIRE_VERSION_STRING;
String fwbuild = Constants.FROSTWIRE_BUILD;
int period = update.config.uxPeriod;
int minEntries = update.config.uxMinEntries;
int maxEntries = update.config.uxMaxEntries;
UXStatsConf uxStatsContext = new UXStatsConf(url, os, fwversion, fwbuild, period, minEntries, maxEntries);
UXStats.instance().setContext(uxStatsContext);
}
}
use of com.frostwire.android.core.ConfigurationManager in project frostwire by frostwire.
the class SearchFragment method onResume.
@Override
public void onResume() {
super.onResume();
// TODO: refactor this
if (filterButton == null && isAdded() && getActivity() != null) {
// best effort
// this will happen due to the call to onTabReselected on full resume
// and this is only solving the NPE, the drawback is that it will
// create a few orphan view objects to be GC'ed soon.
// it'is a poor solution overall, but the right one requires
// a big refactor.
getHeader(getActivity());
}
ConfigurationManager CM = ConfigurationManager.instance();
if (adapter != null && (adapter.getCount() > 0 || adapter.getTotalCount() > 0)) {
refreshFileTypeCounters(true);
searchInput.selectTabByMediaType((byte) CM.getLastMediaTypeFilter());
filterButton.reset(false);
boolean filtersApplied = !adapter.getKeywordFiltersPipeline().isEmpty();
if (filtersApplied) {
updateKeywordDetector(adapter.filter().keywordFiltered);
} else {
updateKeywordDetector(adapter.getList());
}
searchProgress.setKeywordFiltersApplied(filtersApplied);
filterButton.updateVisibility();
keywordFilterDrawerView.updateAppliedKeywordFilters(adapter.getKeywordFiltersPipeline());
} else {
setupPromoSlides();
}
if (list != null) {
list.setOnScrollListener(new FastScrollDisabledWhenIdleOnScrollListener());
}
if (list != null && CM.getBoolean(Constants.PREF_KEY_GUI_DISTRACTION_FREE_SEARCH)) {
list.setOnScrollListener(new ComposedOnScrollListener(new FastScrollDisabledWhenIdleOnScrollListener(), new DirectionDetectorScrollListener(new ScrollDirectionListener(this), Engine.instance().getThreadPool())));
}
if (searchHeaderBanner != null) {
searchHeaderBanner.setSearchFragmentReference(this);
if (getCurrentQuery() == null || Offers.disabledAds()) {
searchHeaderBanner.setBannerViewVisibility(SearchHeaderBanner.BannerType.ALL, false);
}
}
if (getCurrentQuery() == null) {
searchInput.setFileTypeCountersVisible(false);
}
}
use of com.frostwire.android.core.ConfigurationManager in project frostwire by frostwire.
the class EngineBroadcastReceiver method handleConnectedNetwork.
private void handleConnectedNetwork(NetworkInfo networkInfo) {
PlayStore.getInstance().refresh();
NetworkManager networkManager = NetworkManager.instance();
if (networkManager.isDataUp()) {
ConfigurationManager CM = ConfigurationManager.instance();
boolean useTorrentsOnMobileData = !CM.getBoolean(Constants.PREF_KEY_NETWORK_USE_WIFI_ONLY);
if (!networkManager.isDataMobileUp() || useTorrentsOnMobileData) {
LOG.info("Connected to " + networkInfo.getTypeName());
if (Engine.instance().isDisconnected()) {
if (CM.getBoolean(Constants.PREF_KEY_NETWORK_BITTORRENT_ON_VPN_ONLY) && !(networkManager.isTunnelUp() || isNetworkVPN(networkInfo))) {
// don't start
return;
}
Engine.instance().startServices();
if (shouldStopSeeding()) {
TransferManager.instance().stopSeedingTorrents();
}
} else if (shouldStopSeeding()) {
TransferManager.instance().stopSeedingTorrents();
}
}
}
}
use of com.frostwire.android.core.ConfigurationManager in project frostwire by frostwire.
the class TransferManager method isResumable.
public static boolean isResumable(BittorrentDownload bt) {
// not enabled, are actually paused
if (bt.isFinished()) {
ConfigurationManager CM = ConfigurationManager.instance();
if (!CM.isSeedFinishedTorrents()) {
// this implies !isSeedingEnabledOnlyForWifi
return false;
}
boolean isSeedingEnabledOnlyForWifi = CM.isSeedingEnabledOnlyForWifi();
// TODO: find a better way to express relationship with isSeedingEnabled
if (isSeedingEnabledOnlyForWifi && !NetworkManager.instance().isDataWIFIUp()) {
return false;
}
}
return bt.isPaused();
}
Aggregations