Compare commits
	
		
			2 Commits
		
	
	
		
			37e7df98af
			...
			854f5df595
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 854f5df595 | |||
| dbb1af03c4 | 
@@ -2,11 +2,11 @@ apply plugin: 'com.android.application'
 | 
			
		||||
 | 
			
		||||
android {
 | 
			
		||||
    namespace "com.hyperling.apps.infinitetimer"
 | 
			
		||||
    compileSdkVersion 35
 | 
			
		||||
    compileSdkVersion 36
 | 
			
		||||
    defaultConfig {
 | 
			
		||||
        applicationId "com.hyperling.apps.infinitetimer"
 | 
			
		||||
        minSdkVersion 15
 | 
			
		||||
        targetSdkVersion 35
 | 
			
		||||
        minSdkVersion 14
 | 
			
		||||
        targetSdkVersion 36
 | 
			
		||||
        versionCode 8
 | 
			
		||||
        versionName "1.1.0"
 | 
			
		||||
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
 | 
			
		||||
 
 | 
			
		||||
@@ -93,9 +93,14 @@ public class MainActivity extends AppCompatActivity {
 | 
			
		||||
                    if (DEBUG) Log.d(tag, "Shutting off improper START value");
 | 
			
		||||
 | 
			
		||||
                    // Ensure START is always off if we are creating (not resuming).
 | 
			
		||||
                    sharedPreferences.edit().putBoolean(keyStartStop, false).apply();
 | 
			
		||||
                    int count = 0;
 | 
			
		||||
                    while (!sharedPreferences.edit().putBoolean(keyStartStop, false).commit() && count < 50) {
 | 
			
		||||
                        if (DEBUG) Log.d(tag, "Commit failed, trying again. count=" + count);
 | 
			
		||||
                        count++;
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                    Log.d(tag, "key=" + key + " value=" + sharedPreferencesAll.get(key));
 | 
			
		||||
                    boolean checkStartStop = sharedPreferences.getBoolean(keyStartStop, false);;
 | 
			
		||||
                    Log.d(tag, "key=" + key + " value=" + checkStartStop);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
@@ -203,38 +208,29 @@ public class MainActivity extends AppCompatActivity {
 | 
			
		||||
        try {
 | 
			
		||||
            hours = Integer.parseInt("0" + etHours.getText().toString());
 | 
			
		||||
        } catch (NumberFormatException e) {
 | 
			
		||||
            etHours.setText("");
 | 
			
		||||
 | 
			
		||||
            hours = 99;
 | 
			
		||||
        }
 | 
			
		||||
        try {
 | 
			
		||||
            minutes = Integer.parseInt("0" + etMinutes.getText().toString());
 | 
			
		||||
        } catch (NumberFormatException e) {
 | 
			
		||||
            etMinutes.setText("");
 | 
			
		||||
            minutes = 59;
 | 
			
		||||
        }
 | 
			
		||||
        try {
 | 
			
		||||
            seconds = Integer.parseInt("0" + etSeconds.getText().toString());
 | 
			
		||||
        } catch (NumberFormatException e) {
 | 
			
		||||
            etSeconds.setText("");
 | 
			
		||||
            seconds = 59;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // TODO: Properly handle hours being set to 999, which casues a negative.
 | 
			
		||||
        // TODO: Properly handle time being greater than current time, such as
 | 
			
		||||
        longLoopInterval = (long) (((hours*60*60) + (minutes*60) + seconds) * 1000);
 | 
			
		||||
        if (longLoopInterval > System.currentTimeMillis() || longLoopInterval < 0) {
 | 
			
		||||
            if (DEBUG) Log.d(tag, "Got a number larger than current time");
 | 
			
		||||
            if (DEBUG) Log.d(tag, "Setting to current time value");
 | 
			
		||||
            longLoopInterval = System.currentTimeMillis();
 | 
			
		||||
 | 
			
		||||
            /* Not quite doing what we want yet.
 | 
			
		||||
            String sHours = "" + longLoopInterval/1000;
 | 
			
		||||
            String sMinutes = "" + longLoopInterval/1000/60 % 60;
 | 
			
		||||
            String sSeconds = "" + longLoopInterval/1000/60/60 % 60;
 | 
			
		||||
 | 
			
		||||
            etHours.setText(sHours);
 | 
			
		||||
            etMinutes.setText(sMinutes);
 | 
			
		||||
            etSeconds.setText(sSeconds);
 | 
			
		||||
            */
 | 
			
		||||
        if ((hours + (minutes/60) + (seconds/60/60)) > 99) {
 | 
			
		||||
            hours = 99;
 | 
			
		||||
            minutes = 59;
 | 
			
		||||
            seconds = 59;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (hours > 0) etHours.setText("" + hours);
 | 
			
		||||
        if (minutes > 0) etMinutes.setText("" + minutes);
 | 
			
		||||
        if (seconds > 0) etSeconds.setText("" + seconds);
 | 
			
		||||
 | 
			
		||||
        if (DEBUG) Log.d(tag, "longLoopInterval=" + longLoopInterval);
 | 
			
		||||
 | 
			
		||||
        setChronometer(longLoopInterval);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user