aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/cgeo/geocaching
diff options
context:
space:
mode:
Diffstat (limited to 'main/src/cgeo/geocaching')
-rw-r--r--main/src/cgeo/geocaching/AboutActivity.java17
-rw-r--r--main/src/cgeo/geocaching/MainActivity.java12
-rw-r--r--main/src/cgeo/geocaching/TrackableActivity.java6
-rw-r--r--main/src/cgeo/geocaching/settings/Settings.java8
4 files changed, 39 insertions, 4 deletions
diff --git a/main/src/cgeo/geocaching/AboutActivity.java b/main/src/cgeo/geocaching/AboutActivity.java
index 6cda723..f46a5a6 100644
--- a/main/src/cgeo/geocaching/AboutActivity.java
+++ b/main/src/cgeo/geocaching/AboutActivity.java
@@ -14,6 +14,7 @@ import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.commons.lang3.tuple.Pair;
+import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
@@ -28,6 +29,8 @@ import java.util.Scanner;
public class AboutActivity extends AbstractViewPagerActivity<AboutActivity.Page> {
+ private static final String EXTRA_ABOUT_STARTPAGE = "cgeo.geocaching.extra.about.startpage";
+
class LicenseViewCreator extends AbstractCachingPageViewCreator<ScrollView> {
@InjectView(R.id.license) protected TextView licenseLink;
@@ -142,7 +145,13 @@ public class AboutActivity extends AbstractViewPagerActivity<AboutActivity.Page>
@Override
public void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState, R.layout.viewpager_activity);
- createViewPager(0, null);
+
+ int startPage = Page.VERSION.ordinal();
+ Bundle extras = getIntent().getExtras();
+ if (extras != null) {
+ startPage = extras.getInt(EXTRA_ABOUT_STARTPAGE, startPage);
+ }
+ createViewPager(startPage, null);
reinitializeViewPager();
}
@@ -210,4 +219,10 @@ public class AboutActivity extends AbstractViewPagerActivity<AboutActivity.Page>
return result;
}
+ public static void showChangeLog(Context fromActivity) {
+ final Intent intent = new Intent(fromActivity, AboutActivity.class);
+ intent.putExtra(EXTRA_ABOUT_STARTPAGE, Page.CHANGELOG.ordinal());
+ fromActivity.startActivity(intent);
+ }
+
}
diff --git a/main/src/cgeo/geocaching/MainActivity.java b/main/src/cgeo/geocaching/MainActivity.java
index 473d870..8de27b0 100644
--- a/main/src/cgeo/geocaching/MainActivity.java
+++ b/main/src/cgeo/geocaching/MainActivity.java
@@ -213,6 +213,8 @@ public class MainActivity extends AbstractActionBarActivity {
Log.i("Starting " + getPackageName() + ' ' + version + " a.k.a " + Version.getVersionName(this));
init();
+
+ checkShowChangelog();
}
@Override
@@ -726,6 +728,16 @@ public class MainActivity extends AbstractActionBarActivity {
}
}
+ private void checkShowChangelog() {
+ int lastVersion = Settings.getLastChangelogVersion();
+ int version = Version.getVersionCode(this);
+ Settings.setLastChangelogVersion(version);
+ // don't show change log after new install...
+ if (lastVersion > 0 && version != lastVersion) {
+ AboutActivity.showChangeLog(this);
+ }
+ }
+
/**
* @param view
* unused here but needed since this method is referenced from XML layout
diff --git a/main/src/cgeo/geocaching/TrackableActivity.java b/main/src/cgeo/geocaching/TrackableActivity.java
index 7dfc3c1..927e3f4 100644
--- a/main/src/cgeo/geocaching/TrackableActivity.java
+++ b/main/src/cgeo/geocaching/TrackableActivity.java
@@ -96,9 +96,9 @@ public class TrackableActivity extends AbstractViewPagerActivity<TrackableActivi
geocode = trackable.getGeocode();
if (StringUtils.isNotBlank(trackable.getName())) {
- setTitle(Html.fromHtml(trackable.getName()).toString());
+ getSupportActionBar().setTitle(Html.fromHtml(trackable.getName()).toString());
} else {
- setTitle(trackable.getName());
+ getSupportActionBar().setTitle(trackable.getName());
}
invalidateOptionsMenuCompatible();
@@ -121,7 +121,7 @@ public class TrackableActivity extends AbstractViewPagerActivity<TrackableActivi
super.onCreate(savedInstanceState, R.layout.viewpager_activity);
// set title in code, as the activity needs a hard coded title due to the intent filters
- setTitle(res.getString(R.string.trackable));
+ getSupportActionBar().setTitle(res.getString(R.string.trackable));
// get parameters
final Bundle extras = getIntent().getExtras();
diff --git a/main/src/cgeo/geocaching/settings/Settings.java b/main/src/cgeo/geocaching/settings/Settings.java
index a527fc5..474558d 100644
--- a/main/src/cgeo/geocaching/settings/Settings.java
+++ b/main/src/cgeo/geocaching/settings/Settings.java
@@ -1008,4 +1008,12 @@ public class Settings {
return getString(R.string.pref_ec_icons, "1");
}
+ /* Store last version for the changelog display */
+ public static int getLastChangelogVersion() {
+ return getInt(R.string.pref_changelog_last_version, 0);
+ }
+
+ public static void setLastChangelogVersion(int version) {
+ putInt(R.string.pref_changelog_last_version, version);
+ }
}