Java Code Examples for org.telegram.messenger.DownloadController#getInstance()
The following examples show how to use
org.telegram.messenger.DownloadController#getInstance() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: VoIPHelper.java From Telegram-FOSS with GNU General Public License v2.0 | 6 votes |
public static int getDataSavingDefault() { boolean low = DownloadController.getInstance(0).lowPreset.lessCallData, medium = DownloadController.getInstance(0).mediumPreset.lessCallData, high = DownloadController.getInstance(0).highPreset.lessCallData; if (!low && !medium && !high) { return TgVoip.DATA_SAVING_NEVER; } else if (low && !medium && !high) { return TgVoip.DATA_SAVING_ROAMING; } else if (low && medium && !high) { return TgVoip.DATA_SAVING_MOBILE; } else if (low && medium && high) { return TgVoip.DATA_SAVING_ALWAYS; } if (BuildVars.LOGS_ENABLED) FileLog.w("Invalid call data saving preset configuration: " + low + "/" + medium + "/" + high); return TgVoip.DATA_SAVING_NEVER; }
Example 2
Source File: VoIPHelper.java From Telegram with GNU General Public License v2.0 | 6 votes |
public static int getDataSavingDefault() { boolean low = DownloadController.getInstance(0).lowPreset.lessCallData, medium = DownloadController.getInstance(0).mediumPreset.lessCallData, high = DownloadController.getInstance(0).highPreset.lessCallData; if (!low && !medium && !high) { return TgVoip.DATA_SAVING_NEVER; } else if (low && !medium && !high) { return TgVoip.DATA_SAVING_ROAMING; } else if (low && medium && !high) { return TgVoip.DATA_SAVING_MOBILE; } else if (low && medium && high) { return TgVoip.DATA_SAVING_ALWAYS; } if (BuildVars.LOGS_ENABLED) FileLog.w("Invalid call data saving preset configuration: " + low + "/" + medium + "/" + high); return TgVoip.DATA_SAVING_NEVER; }
Example 3
Source File: DataAutoDownloadActivity.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
public DataAutoDownloadActivity(int type) { super(); currentType = type; if (currentType == DownloadController.AUTODOWNLOAD_MASK_VIDEOMESSAGE) { maxSize = 8 * 1024 * 1024; } else if (currentType == DownloadController.AUTODOWNLOAD_MASK_GIF) { maxSize = 10 * 1024 * 1024; } else { maxSize = 1536 * 1024 * 1024; } mobileDataDownloadMask = DownloadController.getInstance(currentAccount).mobileDataDownloadMask[0]; mobileDataPrivateDownloadMask = DownloadController.getInstance(currentAccount).mobileDataDownloadMask[1]; mobileDataGroupDownloadMask = DownloadController.getInstance(currentAccount).mobileDataDownloadMask[2]; mobileDataChannelDownloadMask = DownloadController.getInstance(currentAccount).mobileDataDownloadMask[3]; wifiDownloadMask = DownloadController.getInstance(currentAccount).wifiDownloadMask[0]; wifiPrivateDownloadMask = DownloadController.getInstance(currentAccount).wifiDownloadMask[1]; wifiGroupDownloadMask = DownloadController.getInstance(currentAccount).wifiDownloadMask[2]; wifiChannelDownloadMask = DownloadController.getInstance(currentAccount).wifiDownloadMask[3]; roamingDownloadMask = DownloadController.getInstance(currentAccount).roamingDownloadMask[0]; roamingPrivateDownloadMask = DownloadController.getInstance(currentAccount).roamingDownloadMask[1]; roamingGroupDownloadMask = DownloadController.getInstance(currentAccount).roamingDownloadMask[2]; roamingChannelDownloadMask = DownloadController.getInstance(currentAccount).roamingDownloadMask[2]; mobileMaxSize = DownloadController.getInstance(currentAccount).mobileMaxFileSize[DownloadController.maskToIndex(currentType)]; wifiMaxSize = DownloadController.getInstance(currentAccount).wifiMaxFileSize[DownloadController.maskToIndex(currentType)]; roamingMaxSize = DownloadController.getInstance(currentAccount).roamingMaxFileSize[DownloadController.maskToIndex(currentType)]; }
Example 4
Source File: DataSettingsActivity.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
@Override public boolean isEnabled(RecyclerView.ViewHolder holder) { int position = holder.getAdapterPosition(); if (position == photosRow || position == voiceMessagesRow || position == videoMessagesRow || position == videosRow || position == filesRow || position == musicRow || position == gifsRow) { return DownloadController.getInstance(currentAccount).globalAutodownloadEnabled; } return position == storageUsageRow || position == useLessDataForCallsRow || position == mobileUsageRow || position == roamingUsageRow || position == wifiUsageRow || position == proxyRow || position == resetDownloadRow || position == autoDownloadMediaRow || position == enableCacheStreamRow || position == enableStreamRow || position == enableAllStreamRow || position == quickRepliesRow; }
Example 5
Source File: DataAutoDownloadActivity.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
public DataAutoDownloadActivity(int type) { super(); currentType = type; if (currentType == DownloadController.AUTODOWNLOAD_MASK_VIDEOMESSAGE) { maxSize = 8 * 1024 * 1024; } else if (currentType == DownloadController.AUTODOWNLOAD_MASK_GIF) { maxSize = 10 * 1024 * 1024; } else { maxSize = 1536 * 1024 * 1024; } mobileDataDownloadMask = DownloadController.getInstance(currentAccount).mobileDataDownloadMask[0]; mobileDataPrivateDownloadMask = DownloadController.getInstance(currentAccount).mobileDataDownloadMask[1]; mobileDataGroupDownloadMask = DownloadController.getInstance(currentAccount).mobileDataDownloadMask[2]; mobileDataChannelDownloadMask = DownloadController.getInstance(currentAccount).mobileDataDownloadMask[3]; wifiDownloadMask = DownloadController.getInstance(currentAccount).wifiDownloadMask[0]; wifiPrivateDownloadMask = DownloadController.getInstance(currentAccount).wifiDownloadMask[1]; wifiGroupDownloadMask = DownloadController.getInstance(currentAccount).wifiDownloadMask[2]; wifiChannelDownloadMask = DownloadController.getInstance(currentAccount).wifiDownloadMask[3]; roamingDownloadMask = DownloadController.getInstance(currentAccount).roamingDownloadMask[0]; roamingPrivateDownloadMask = DownloadController.getInstance(currentAccount).roamingDownloadMask[1]; roamingGroupDownloadMask = DownloadController.getInstance(currentAccount).roamingDownloadMask[2]; roamingChannelDownloadMask = DownloadController.getInstance(currentAccount).roamingDownloadMask[2]; mobileMaxSize = DownloadController.getInstance(currentAccount).mobileMaxFileSize[DownloadController.maskToIndex(currentType)]; wifiMaxSize = DownloadController.getInstance(currentAccount).wifiMaxFileSize[DownloadController.maskToIndex(currentType)]; roamingMaxSize = DownloadController.getInstance(currentAccount).roamingMaxFileSize[DownloadController.maskToIndex(currentType)]; }
Example 6
Source File: DataSettingsActivity.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
@Override public boolean isEnabled(RecyclerView.ViewHolder holder) { int position = holder.getAdapterPosition(); if (position == photosRow || position == voiceMessagesRow || position == videoMessagesRow || position == videosRow || position == filesRow || position == musicRow || position == gifsRow) { return DownloadController.getInstance(currentAccount).globalAutodownloadEnabled; } return position == storageUsageRow || position == useLessDataForCallsRow || position == mobileUsageRow || position == roamingUsageRow || position == wifiUsageRow || position == proxyRow || position == resetDownloadRow || position == autoDownloadMediaRow || position == enableCacheStreamRow || position == enableStreamRow || position == enableAllStreamRow || position == quickRepliesRow; }
Example 7
Source File: DataAutoDownloadActivity.java From Telegram-FOSS with GNU General Public License v2.0 | 5 votes |
public DataAutoDownloadActivity(int type) { super(); currentType = type; lowPreset = DownloadController.getInstance(currentAccount).lowPreset; mediumPreset = DownloadController.getInstance(currentAccount).mediumPreset; highPreset = DownloadController.getInstance(currentAccount).highPreset; if (currentType == 0) { currentPresetNum = DownloadController.getInstance(currentAccount).currentMobilePreset; typePreset = DownloadController.getInstance(currentAccount).mobilePreset; defaultPreset = mediumPreset; key = "mobilePreset"; key2 = "currentMobilePreset"; } else if (currentType == 1) { currentPresetNum = DownloadController.getInstance(currentAccount).currentWifiPreset; typePreset = DownloadController.getInstance(currentAccount).wifiPreset; defaultPreset = highPreset; key = "wifiPreset"; key2 = "currentWifiPreset"; } else { currentPresetNum = DownloadController.getInstance(currentAccount).currentRoamingPreset; typePreset = DownloadController.getInstance(currentAccount).roamingPreset; defaultPreset = lowPreset; key = "roamingPreset"; key2 = "currentRoamingPreset"; } }
Example 8
Source File: DataSettingsActivity.java From Telegram-FOSS with GNU General Public License v2.0 | 5 votes |
public boolean isRowEnabled(int position) { if (position == resetDownloadRow) { DownloadController controller = DownloadController.getInstance(currentAccount); return !controller.lowPreset.equals(controller.getCurrentRoamingPreset()) || controller.lowPreset.isEnabled() != controller.roamingPreset.enabled || !controller.mediumPreset.equals(controller.getCurrentMobilePreset()) || controller.mediumPreset.isEnabled() != controller.mobilePreset.enabled || !controller.highPreset.equals(controller.getCurrentWiFiPreset()) || controller.highPreset.isEnabled() != controller.wifiPreset.enabled; } return position == mobileRow || position == roamingRow || position == wifiRow || position == storageUsageRow || position == useLessDataForCallsRow || position == dataUsageRow || position == proxyRow || position == enableCacheStreamRow || position == enableStreamRow || position == enableAllStreamRow || position == enableMkvRow || position == quickRepliesRow || position == autoplayVideoRow || position == autoplayGifsRow; }
Example 9
Source File: DataAutoDownloadActivity.java From Telegram with GNU General Public License v2.0 | 5 votes |
public DataAutoDownloadActivity(int type) { super(); currentType = type; lowPreset = DownloadController.getInstance(currentAccount).lowPreset; mediumPreset = DownloadController.getInstance(currentAccount).mediumPreset; highPreset = DownloadController.getInstance(currentAccount).highPreset; if (currentType == 0) { currentPresetNum = DownloadController.getInstance(currentAccount).currentMobilePreset; typePreset = DownloadController.getInstance(currentAccount).mobilePreset; defaultPreset = mediumPreset; key = "mobilePreset"; key2 = "currentMobilePreset"; } else if (currentType == 1) { currentPresetNum = DownloadController.getInstance(currentAccount).currentWifiPreset; typePreset = DownloadController.getInstance(currentAccount).wifiPreset; defaultPreset = highPreset; key = "wifiPreset"; key2 = "currentWifiPreset"; } else { currentPresetNum = DownloadController.getInstance(currentAccount).currentRoamingPreset; typePreset = DownloadController.getInstance(currentAccount).roamingPreset; defaultPreset = lowPreset; key = "roamingPreset"; key2 = "currentRoamingPreset"; } }
Example 10
Source File: DataSettingsActivity.java From Telegram with GNU General Public License v2.0 | 5 votes |
public boolean isRowEnabled(int position) { if (position == resetDownloadRow) { DownloadController controller = DownloadController.getInstance(currentAccount); return !controller.lowPreset.equals(controller.getCurrentRoamingPreset()) || controller.lowPreset.isEnabled() != controller.roamingPreset.enabled || !controller.mediumPreset.equals(controller.getCurrentMobilePreset()) || controller.mediumPreset.isEnabled() != controller.mobilePreset.enabled || !controller.highPreset.equals(controller.getCurrentWiFiPreset()) || controller.highPreset.isEnabled() != controller.wifiPreset.enabled; } return position == mobileRow || position == roamingRow || position == wifiRow || position == storageUsageRow || position == useLessDataForCallsRow || position == dataUsageRow || position == proxyRow || position == enableCacheStreamRow || position == enableStreamRow || position == enableAllStreamRow || position == enableMkvRow || position == quickRepliesRow || position == autoplayVideoRow || position == autoplayGifsRow; }