Skip to content

Commit

Permalink
Merge pull request #20 from sladomic/master
Browse files Browse the repository at this point in the history
Release 1.0.2
  • Loading branch information
Jo Grimstad authored Apr 28, 2017
2 parents a75c579 + 5ea794a commit 57a3b31
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ android {
applicationId "org.literacyapp.startguide"
minSdkVersion 21
targetSdkVersion 23
versionCode 1000001
versionName "1.0.1"
versionCode 1000002
versionName "1.0.2"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class BootReceiver extends BroadcastReceiver {

@Override
public void onReceive(Context context, Intent intent) {
if (Intent.ACTION_BOOT_COMPLETED.equals(intent.getAction()) && StartPrefsHelper.startAfterBoot(context)) {
if (Intent.ACTION_BOOT_COMPLETED.equals(intent.getAction()) && !StartPrefsHelper.inactivateStartGuide()) {
Intent bootIntent = new Intent(context, SwipeUpDownActivity.class);
bootIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(bootIntent);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import android.preference.PreferenceManager;
import android.util.Log;

import java.util.Date;


public class StartPrefsHelper {

Expand All @@ -26,6 +28,15 @@ public static boolean startAfterBoot(Context context) {
return ((firstStartupDate + SEVEN_DAYS_IN_MILLISECONDS) > currentDate);
}

public static boolean inactivateStartGuide(){
//UTC Thu May 11 2017 20:59:59
long inactivationTime = 1494536399000L;
long currentTime = System.currentTimeMillis();
boolean inactive = currentTime > inactivationTime;
Log.i(StartPrefsHelper.class.getName(), "Start Guide inactive: " + inactive + ", inactivationTime: " + new Date(inactivationTime) + ", currentTime: " + new Date(currentTime));
return inactive;
}

private static long getFirstStartupDate(Context context) {
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context);
return sharedPreferences.getLong(PREF_FIRST_STARTUP_DATE, 0);
Expand Down

0 comments on commit 57a3b31

Please sign in to comment.