Save last app version on preferences

pull/30/head
Alinson S. Xavier 10 years ago
parent f41f877107
commit b4911b6cb4

@ -27,6 +27,8 @@ import android.util.DisplayMetrics;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import org.isoron.uhabits.BuildConfig;
public abstract class DialogHelper
{
@ -59,6 +61,12 @@ public abstract class DialogHelper
prefs.edit().putInt("launch_count", count + 1).apply();
}
public static void updateLastAppVersion(Context context)
{
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
prefs.edit().putInt("last_version", BuildConfig.VERSION_CODE).apply();
}
public static int getLaunchCount(Context context)
{
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);

@ -73,6 +73,7 @@ public class MainActivity extends ReplayableActivity
{
PreferenceManager.setDefaultValues(this, R.xml.preferences, false);
DialogHelper.incrementLaunchCount(this);
DialogHelper.updateLastAppVersion(this);
showTutorial();
new AsyncTask<Void, Void, Void>() {

Loading…
Cancel
Save