forked from organicmaps/organicmaps
Removed unnecessary application params.
This commit is contained in:
parent
46602339c3
commit
59c0b17e0f
6 changed files with 19 additions and 17 deletions
|
@ -52,7 +52,7 @@ public class AdsManager
|
|||
public static void updateMenuAds()
|
||||
{
|
||||
String menuAdsString;
|
||||
if (ConnectionState.isConnected(MWMApplication.get()))
|
||||
if (ConnectionState.isConnected())
|
||||
{
|
||||
menuAdsString = getJsonAdsFromServer();
|
||||
cacheMenuAds(menuAdsString);
|
||||
|
@ -162,7 +162,7 @@ public class AdsManager
|
|||
*/
|
||||
private static Bitmap loadAdIcon(String urlString, String adId)
|
||||
{
|
||||
if (!ConnectionState.isConnected(MWMApplication.get()))
|
||||
if (!ConnectionState.isConnected())
|
||||
return loadCachedBitmap(adId);
|
||||
|
||||
InputStream inputStream = null;
|
||||
|
|
|
@ -243,7 +243,7 @@ public class DownloadResourcesActivity extends MapsWithMeBaseFragmentActivity
|
|||
break;
|
||||
|
||||
case ERR_DOWNLOAD_ERROR:
|
||||
if (ConnectionState.isConnected(this))
|
||||
if (ConnectionState.isConnected())
|
||||
id = R.string.download_has_failed;
|
||||
else
|
||||
id = R.string.no_internet_connection_detected;
|
||||
|
@ -386,7 +386,7 @@ public class DownloadResourcesActivity extends MapsWithMeBaseFragmentActivity
|
|||
{
|
||||
setAction(DOWNLOAD);
|
||||
|
||||
if (ConnectionState.isWifiConnected(this))
|
||||
if (ConnectionState.isWifiConnected())
|
||||
onDownloadClicked(mButton);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -515,7 +515,7 @@ public class MWMActivity extends NvEventQueueActivity
|
|||
|
||||
private void checkFacebookDialog()
|
||||
{
|
||||
if (ConnectionState.isConnected(this) &&
|
||||
if (ConnectionState.isConnected() &&
|
||||
MWMApplication.get().shouldShowDialog(MWMApplication.FACEBOOK) &&
|
||||
!isChinaRegion())
|
||||
{
|
||||
|
@ -538,7 +538,7 @@ public class MWMActivity extends NvEventQueueActivity
|
|||
private void checkBuyProDialog()
|
||||
{
|
||||
if (!BuildConfig.IS_PRO &&
|
||||
(ConnectionState.isConnected(this)) &&
|
||||
(ConnectionState.isConnected()) &&
|
||||
MWMApplication.get().shouldShowDialog(MWMApplication.BUYPRO))
|
||||
{
|
||||
showDialogImpl(MWMApplication.BUYPRO, R.string.pro_version_available,
|
||||
|
|
|
@ -163,7 +163,7 @@ public enum LocationService implements
|
|||
private void startWifiLocationUpdate()
|
||||
{
|
||||
if (Statistics.INSTANCE.isStatisticsEnabled() &&
|
||||
ConnectionState.isWifiConnected(MWMApplication.get()))
|
||||
ConnectionState.isWifiConnected())
|
||||
{
|
||||
if (mWifiScanner == null)
|
||||
mWifiScanner = new WifiLocationScanner();
|
||||
|
@ -460,7 +460,7 @@ public enum LocationService implements
|
|||
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB &&
|
||||
LocationManager.NETWORK_PROVIDER.equals(prov) &&
|
||||
!ConnectionState.isConnected(MWMApplication.get()))
|
||||
!ConnectionState.isConnected())
|
||||
continue;
|
||||
|
||||
acceptedProviders.add(prov);
|
||||
|
|
|
@ -4,6 +4,8 @@ import android.content.Context;
|
|||
import android.net.ConnectivityManager;
|
||||
import android.net.NetworkInfo;
|
||||
|
||||
import com.mapswithme.maps.MWMApplication;
|
||||
|
||||
public class ConnectionState
|
||||
{
|
||||
public static final int NOT_CONNECTED = 0;
|
||||
|
@ -13,12 +15,12 @@ public class ConnectionState
|
|||
private static final String TYPE_WIFI = "WIFI";
|
||||
private static final String TYPE_MOBILE = "MOBILE";
|
||||
|
||||
private static int getState(Context c)
|
||||
private static int getState()
|
||||
{
|
||||
boolean isWifiConnected = false;
|
||||
boolean isMobileConnected = false;
|
||||
|
||||
ConnectivityManager cm = (ConnectivityManager) c.getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||
ConnectivityManager cm = (ConnectivityManager) MWMApplication.get().getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||
NetworkInfo[] netInfo = cm.getAllNetworkInfo();
|
||||
for (NetworkInfo ni : netInfo)
|
||||
{
|
||||
|
@ -37,18 +39,18 @@ public class ConnectionState
|
|||
return NOT_CONNECTED;
|
||||
}
|
||||
|
||||
public static boolean is3GConnected(Context c)
|
||||
public static boolean is3GConnected()
|
||||
{
|
||||
return (getState(c) & CONNECTED_BY_3G) == CONNECTED_BY_3G;
|
||||
return (getState() & CONNECTED_BY_3G) == CONNECTED_BY_3G;
|
||||
}
|
||||
|
||||
public static boolean isWifiConnected(Context c)
|
||||
public static boolean isWifiConnected()
|
||||
{
|
||||
return (getState(c) & CONNECTED_BY_WIFI) == CONNECTED_BY_WIFI;
|
||||
return (getState() & CONNECTED_BY_WIFI) == CONNECTED_BY_WIFI;
|
||||
}
|
||||
|
||||
public static boolean isConnected(Context c)
|
||||
public static boolean isConnected()
|
||||
{
|
||||
return getState(c) != NOT_CONNECTED;
|
||||
return getState() != NOT_CONNECTED;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -361,7 +361,7 @@ public final class UiUtils
|
|||
|
||||
public static void checkConnectionAndShowAlert(final Activity activity, final String message)
|
||||
{
|
||||
if (!ConnectionState.isConnected(activity))
|
||||
if (!ConnectionState.isConnected())
|
||||
{
|
||||
activity.runOnUiThread(new Runnable()
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue