[android] Warning and code style fixes

This commit is contained in:
Alex Zolotarev 2012-08-10 23:08:05 +03:00 committed by Alex Zolotarev
parent 8c2051a2e9
commit b508730fec
5 changed files with 24 additions and 18 deletions

View file

@ -462,6 +462,7 @@ public class MWMActivity extends NvEventQueueActivity implements LocationService
@Override
public void onCompassUpdated(long time, double magneticNorth, double trueNorth, double accuracy)
{
@SuppressWarnings("deprecation")
final int orientation = getWindowManager().getDefaultDisplay().getOrientation();
final double correction = LocationService.getAngleCorrection(orientation);
@ -478,7 +479,7 @@ public class MWMActivity extends NvEventQueueActivity implements LocationService
super.onStart();
// Restore My Position state on startup/activity recreation
SharedPreferences prefs = getSharedPreferences(mApplication.getPackageName(), MODE_PRIVATE);
final SharedPreferences prefs = getSharedPreferences(mApplication.getPackageName(), MODE_PRIVATE);
final boolean isMyPositionEnabled = prefs.getBoolean(PREFERENCES_MYPOSITION, false);
findViewById(R.id.map_button_myposition).setSelected(isMyPositionEnabled);
}

View file

@ -26,13 +26,12 @@ public class MWMApplication extends android.app.Application implements MapStorag
private MapStorage m_storage = null;
private int m_slotID = 0;
private boolean mIsProVersion = false;
private String mProVersionCheckURL = "";
private boolean m_isProVersion = false;
private String m_proVersionCheckURL = "";
private void showDownloadToast(int resID, Index idx)
{
String msg = String.format(getString(resID), m_storage.countryName(idx));
final String msg = String.format(getString(resID), m_storage.countryName(idx));
Toast.makeText(this, msg, Toast.LENGTH_LONG).show();
}
@ -61,10 +60,10 @@ public class MWMApplication extends android.app.Application implements MapStorag
{
super.onCreate();
mIsProVersion = getPackageName().endsWith(".pro");
m_isProVersion = getPackageName().endsWith(".pro");
// http://stackoverflow.com/questions/1440957/httpurlconnection-getresponsecode-returns-1-on-second-invocation
if (Integer.parseInt(Build.VERSION.SDK) < Build.VERSION_CODES.FROYO)
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.ECLAIR_MR1)
System.setProperty("http.keepAlive", "false");
AssetManager assets = getAssets();
@ -73,9 +72,9 @@ public class MWMApplication extends android.app.Application implements MapStorag
{
stream = assets.open("app_info.txt");
BufferedReader reader = new BufferedReader(new InputStreamReader(stream));
mProVersionCheckURL = reader.readLine();
m_proVersionCheckURL = reader.readLine();
Log.i(TAG, "PROCHECKURL: " + mProVersionCheckURL);
Log.i(TAG, "PROCHECKURL: " + m_proVersionCheckURL);
}
catch (IOException ex)
{
@ -96,7 +95,7 @@ public class MWMApplication extends android.app.Application implements MapStorag
extTmpPath,
// Changed path for settings to be the same as external storage
extStoragePath, //getSettingsPath(),
mIsProVersion);
m_isProVersion);
m_slotID = getMapStorage().subscribe(this);
}
@ -117,7 +116,6 @@ public class MWMApplication extends android.app.Application implements MapStorag
return m_storage;
}
public String getApkPath()
{
try
@ -144,12 +142,12 @@ public class MWMApplication extends android.app.Application implements MapStorag
public boolean isProVersion()
{
return mIsProVersion;
return m_isProVersion;
}
public String getProVersionCheckURL()
{
return mProVersionCheckURL;
return m_proVersionCheckURL;
}
private String getTmpPath()

View file

@ -103,12 +103,17 @@ public class SearchActivity extends ListActivity implements LocationService.List
/// 1 - feature result
public int m_type;
// Called from native code
@SuppressWarnings("unused")
public SearchResult(String suggestion)
{
m_name = suggestion;
m_type = 0;
}
// Called from native code
@SuppressWarnings("unused")
public SearchResult(String name, String country, String amenity,
String flag, String distance, double azimut)
{
@ -351,6 +356,7 @@ public class SearchActivity extends ListActivity implements LocationService.List
@Override
public void onCompassUpdated(long time, double magneticNorth, double trueNorth, double accuracy)
{
@SuppressWarnings("deprecation")
final int orientation = getWindowManager().getDefaultDisplay().getOrientation();
final double correction = LocationService.getAngleCorrection(orientation);

View file

@ -57,14 +57,14 @@ public class LocationService implements LocationListener, SensorEventListener, W
/// true when GPS is on
private boolean m_isActive = false;
private MWMApplication mApplication = null;
private MWMApplication m_application = null;
public LocationService(MWMApplication application)
{
mApplication = application;
m_application = application;
m_locationManager = (LocationManager) mApplication.getSystemService(Context.LOCATION_SERVICE);
m_sensorManager = (SensorManager) mApplication.getSystemService(Context.SENSOR_SERVICE);
m_locationManager = (LocationManager) m_application.getSystemService(Context.LOCATION_SERVICE);
m_sensorManager = (SensorManager) m_application.getSystemService(Context.SENSOR_SERVICE);
if (m_sensorManager != null)
{
@ -134,7 +134,7 @@ public class LocationService implements LocationListener, SensorEventListener, W
if (m_wifiScanner == null)
m_wifiScanner = new WifiLocation();
m_wifiScanner.StartScan(mApplication, this);
m_wifiScanner.StartScan(m_application, this);
}
else
observer.onLocationStatusChanged(DISABLED_BY_USER);

View file

@ -92,6 +92,7 @@ public abstract class NvEventQueueActivity extends Activity
public native boolean multiTouchEvent(int action, boolean hasFirst,
boolean hasSecond, int x0, int y0, int x1, int y1, MotionEvent event);
@SuppressWarnings("deprecation")
@Override
public void onCreate(Bundle savedInstanceState)
{