Compare commits
	
		
			2 Commits
		
	
	
		
			37e7df98af
			...
			854f5df595
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 854f5df595 | |||
| dbb1af03c4 | 
@@ -2,11 +2,11 @@ apply plugin: 'com.android.application'
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
android {
 | 
					android {
 | 
				
			||||||
    namespace "com.hyperling.apps.infinitetimer"
 | 
					    namespace "com.hyperling.apps.infinitetimer"
 | 
				
			||||||
    compileSdkVersion 35
 | 
					    compileSdkVersion 36
 | 
				
			||||||
    defaultConfig {
 | 
					    defaultConfig {
 | 
				
			||||||
        applicationId "com.hyperling.apps.infinitetimer"
 | 
					        applicationId "com.hyperling.apps.infinitetimer"
 | 
				
			||||||
        minSdkVersion 15
 | 
					        minSdkVersion 14
 | 
				
			||||||
        targetSdkVersion 35
 | 
					        targetSdkVersion 36
 | 
				
			||||||
        versionCode 8
 | 
					        versionCode 8
 | 
				
			||||||
        versionName "1.1.0"
 | 
					        versionName "1.1.0"
 | 
				
			||||||
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
 | 
					        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");
 | 
					                    if (DEBUG) Log.d(tag, "Shutting off improper START value");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    // Ensure START is always off if we are creating (not resuming).
 | 
					                    // 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 {
 | 
					        try {
 | 
				
			||||||
            hours = Integer.parseInt("0" + etHours.getText().toString());
 | 
					            hours = Integer.parseInt("0" + etHours.getText().toString());
 | 
				
			||||||
        } catch (NumberFormatException e) {
 | 
					        } catch (NumberFormatException e) {
 | 
				
			||||||
            etHours.setText("");
 | 
					            hours = 99;
 | 
				
			||||||
 | 
					 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        try {
 | 
					        try {
 | 
				
			||||||
            minutes = Integer.parseInt("0" + etMinutes.getText().toString());
 | 
					            minutes = Integer.parseInt("0" + etMinutes.getText().toString());
 | 
				
			||||||
        } catch (NumberFormatException e) {
 | 
					        } catch (NumberFormatException e) {
 | 
				
			||||||
            etMinutes.setText("");
 | 
					            minutes = 59;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        try {
 | 
					        try {
 | 
				
			||||||
            seconds = Integer.parseInt("0" + etSeconds.getText().toString());
 | 
					            seconds = Integer.parseInt("0" + etSeconds.getText().toString());
 | 
				
			||||||
        } catch (NumberFormatException e) {
 | 
					        } catch (NumberFormatException e) {
 | 
				
			||||||
            etSeconds.setText("");
 | 
					            seconds = 59;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // TODO: Properly handle hours being set to 999, which casues a negative.
 | 
					        if ((hours + (minutes/60) + (seconds/60/60)) > 99) {
 | 
				
			||||||
        // TODO: Properly handle time being greater than current time, such as
 | 
					            hours = 99;
 | 
				
			||||||
        longLoopInterval = (long) (((hours*60*60) + (minutes*60) + seconds) * 1000);
 | 
					            minutes = 59;
 | 
				
			||||||
        if (longLoopInterval > System.currentTimeMillis() || longLoopInterval < 0) {
 | 
					            seconds = 59;
 | 
				
			||||||
            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 > 0) etHours.setText("" + hours);
 | 
				
			||||||
 | 
					        if (minutes > 0) etMinutes.setText("" + minutes);
 | 
				
			||||||
 | 
					        if (seconds > 0) etSeconds.setText("" + seconds);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (DEBUG) Log.d(tag, "longLoopInterval=" + longLoopInterval);
 | 
					        if (DEBUG) Log.d(tag, "longLoopInterval=" + longLoopInterval);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        setChronometer(longLoopInterval);
 | 
					        setChronometer(longLoopInterval);
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user