mirror of
https://github.com/iSoron/uhabits.git
synced 2025-12-06 01:08:50 -06:00
Save last app version on preferences
This commit is contained in:
@@ -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>() {
|
||||
|
||||
Reference in New Issue
Block a user