Code review comments

This commit is contained in:
Matthew Simmons
2011-03-16 15:59:21 -04:00
parent c943e5dd43
commit 79e2c55c34
4 changed files with 18 additions and 29 deletions
@@ -15,7 +15,6 @@
*/
package com.google.android.apps.mytracks.util;
import com.google.android.apps.mytracks.MyTracks;
import com.google.android.apps.mytracks.MyTracksConstants;
import com.google.android.apps.mytracks.content.Track;
import com.google.android.apps.mytracks.stats.TripStatistics;
@@ -264,7 +263,7 @@ public class MyTracksUtils {
return false;
}
for (Signature sig: packageInfo.signatures) {
for (Signature sig : packageInfo.signatures) {
if (sig.hashCode() == RELEASE_SIGNATURE_HASHCODE) {
return true;
}
@@ -273,13 +272,6 @@ public class MyTracksUtils {
return false;
}
/**
* @see isRelease(Context)
*/
public static boolean isRelease() {
return isRelease(MyTracks.getInstance());
}
/**
* Get the My Tracks version from the manifest.
*
@@ -290,27 +282,19 @@ public class MyTracksUtils {
return packageInfo == null ? "" : packageInfo.versionName;
}
/**
* @see getMyTracksVersion(Context)
*/
public static String getMyTracksVersion() {
return getMyTracksVersion(MyTracks.getInstance());
}
/**
* Return the My Tracks version code from the manifest.
*
* @return the version code, or an empty string in case of failure.
*/
public static int getMyTracksVersionCode() {
PackageInfo packageInfo = getPackageInfo(MyTracks.getInstance(),
PackageManager.GET_META_DATA);
public static int getMyTracksVersionCode(Context context) {
PackageInfo packageInfo = getPackageInfo(context, PackageManager.GET_META_DATA);
return packageInfo == null ? -1 : packageInfo.versionCode;
}
private static PackageInfo getPackageInfo(Context context, int flags) {
if (context == null) {
Log.w(MyTracksConstants.TAG, "No context found when attempting to get version");
Log.w(MyTracksConstants.TAG, "No context found when attempting to get PackageInfo");
return null;
}
try {