Skip to content

Commit

Permalink
Merge pull request #344 from cpeterso/cpeterso/only-update-mozilla-bu…
Browse files Browse the repository at this point in the history
…ilds

Only Mozilla builds should try to download updated Mozilla builds
  • Loading branch information
cpeterso committed Jan 25, 2014
2 parents bb86f1a + 728ea3a commit 51dfd8c
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 26 deletions.
8 changes: 3 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ android {
}

signingConfigs {
release
release
}

buildTypes {
Expand All @@ -47,7 +47,6 @@ android {
}

release {
debuggable true
runProguard true
proguardFile 'proguard.cfg'
signingConfig signingConfigs.release
Expand All @@ -74,15 +73,14 @@ if (hasProperty('StoreFile')) {
}

String getMozillaApiKey() {
return project.hasProperty('MozAPIKey') ? '"' + project['MozAPIKey'] + '"' : "\"test\"";
return project.hasProperty('MozAPIKey') ? '"' + project['MozAPIKey'] + '"' : "null";
}

String getTileServerUrl() {
if (project.hasProperty('TileServerURL')) {
return '"' + project['TileServerURL'] + '"';
} else if (project.hasProperty('MapAPIKey')) {
return "\"http://api.tiles.mapbox.com/v3/${project['MapAPIKey']}/\"";
} else {
return "null";
}
return "null";
}
5 changes: 4 additions & 1 deletion src/org/mozilla/mozstumbler/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,10 @@ protected void onCreate(Bundle savedInstanceState) {
setContentView(R.layout.activity_main);

new Prefs(this).setDefaultValues();
Updater.checkForUpdates(this);

if (BuildConfig.MOZILLA_API_KEY != null) {
Updater.checkForUpdates(this);
}

Log.d(LOGTAG, "onCreate");
}
Expand Down
33 changes: 13 additions & 20 deletions src/org/mozilla/mozstumbler/MapActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ public void onReceive(Context context, Intent intent) {
}
}

@SuppressWarnings("ConstantConditions")
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Expand All @@ -94,20 +93,8 @@ protected void onCreate(Bundle savedInstanceState) {
mWifiData = Collections.emptyList();
MOZSTUMBLER_USER_AGENT_STRING = NetworkUtils.getUserAgentString(this);

OnlineTileSourceBase tileSource;
if (BuildConfig.TILE_SERVER_URL == null) {
tileSource = TileSourceFactory.DEFAULT_TILE_SOURCE;
} else {
tileSource = new XYTileSource("MozStumbler Tile Store",
null,
1, 20, 256,
".png",
BuildConfig.TILE_SERVER_URL);
}

mMap = (MapView) this.findViewById(R.id.map);

mMap.setTileSource(tileSource);
mMap.setTileSource(getTileSource());
mMap.setBuiltInZoomControls(true);
mMap.setMultiTouchControls(true);

Expand All @@ -120,6 +107,18 @@ protected void onCreate(Bundle savedInstanceState) {
Log.d(LOGTAG, "onCreate");
}

@SuppressWarnings("ConstantConditions")
private static OnlineTileSourceBase getTileSource() {
if (BuildConfig.TILE_SERVER_URL == null) {
return TileSourceFactory.DEFAULT_TILE_SOURCE;
}
return new XYTileSource("MozStumbler Tile Store",
null,
1, 20, 256,
".png",
BuildConfig.TILE_SERVER_URL);
}

private static class AccuracyCircleOverlay extends SafeDrawOverlay {
private GeoPoint mPoint;
private float mAccuracy;
Expand Down Expand Up @@ -180,12 +179,6 @@ protected void onStart() {
protected void onStop() {
super.onStop();

Context context = getApplicationContext();
Intent i = new Intent(ScannerService.MESSAGE_TOPIC);
i.putExtra(Intent.EXTRA_SUBJECT, "Scanner");
i.putExtra("enable", 0);
context.sendBroadcast(i);

Log.d(LOGTAG, "onStop");
mMap.getTileProvider().clearTileCache();
if (mReceiver != null) {
Expand Down

0 comments on commit 51dfd8c

Please sign in to comment.