Compare commits

...

14 Commits

12 changed files with 57 additions and 70 deletions

View File

@@ -1,3 +1,9 @@
# android-infinite-timer
# Infinite Timer
Timer which loops over the specified interval, playing your default notification sound each time it hits 0.
Timer which loops over the specified interval, playing your default notification sound each time it hits 0.
## Update Notes
### 2025-07-11
(This article)[https://sijus.medium.com/resurrecting-a-5-year-old-android-app-a-developers-journey-59d8f5689e5b]
was very helpful in getting this app updated from SDK 25 to 36.

View File

@@ -1,14 +1,14 @@
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
buildToolsVersion '28.0.3'
namespace "com.hyperling.apps.infinitetimer"
compileSdkVersion 35
defaultConfig {
applicationId "com.hyperling.apps.infinitetimer"
minSdkVersion 15
targetSdkVersion 28
versionCode 7
versionName "1.06"
targetSdkVersion 35
versionCode 8
versionName "1.1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {

View File

@@ -1,26 +0,0 @@
package com.hyperling.apps.infinitetimer.deleteme;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumentation test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("infinitetimer.apps.hyperling.com.infinitetimer", appContext.getPackageName());
}
}

View File

@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.hyperling.apps.infinitetimer">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application
android:allowBackup="true"
@@ -9,10 +8,9 @@
android:supportsRtl="true"
android:theme="@style/InfiniteTimer"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize">
<activity android:name=".MainActivity">
<activity android:name=".MainActivity" android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

View File

@@ -11,7 +11,6 @@ import android.os.Message;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.view.ViewManager;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.EditText;
@@ -208,9 +207,11 @@ public class MainActivity extends AppCompatActivity {
//chronometer = (TextView) findViewById(R.id.chronometer);
String[] time = {Long.toString(milliseconds/(1000*60*60)),
Long.toString((milliseconds/(1000*60)%(60*60))),
Long.toString((milliseconds/(1000))%60)};
String[] time = {
Long.toString(milliseconds/(1000*60*60)),
Long.toString((milliseconds/(1000*60))%60),
Long.toString((milliseconds/(1000))%60)
};
for (int i = 0; i < time.length; i++){
while (time[i].length() < 2){
@@ -351,7 +352,7 @@ public class MainActivity extends AppCompatActivity {
}
}
private Handler incrementTime = new Handler(){
private final Handler incrementTime = new Handler(){
@Override
public void handleMessage(Message msg) {
super.handleMessage(msg);
@@ -468,6 +469,22 @@ public class MainActivity extends AppCompatActivity {
mediaPlayer.start();
}
// TODO: use this to fix bug when app is closed during a countdown, it opens
// back up with a 0 count but timer is enabled and needs Stopped before the
// edit texts can be used.
private void resetAll() {
setChronometer(0);
setEditTexts("");
setLoopInterval();
start = false;
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.putBoolean(keyStartStop, start);
editor.putBoolean(keyAppOpen, start);
editor.putBoolean(keyServiceRunning, start);
editor.apply();
}
@Override
protected void onPause() {
super.onPause();
@@ -495,6 +512,13 @@ public class MainActivity extends AppCompatActivity {
recoverScreen();
}
@Override
protected void onDestroy() {
resetAll();
super.onDestroy();
}
private void flipInputTexts() {
etHours.setEnabled(!start);
etMinutes.setEnabled(!start);

View File

@@ -4,6 +4,7 @@
android:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="?android:actionBarSize"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"

View File

@@ -5,20 +5,18 @@
android:id="@+id/action_milis"
android:orderInCategory="100"
android:title="@string/action_millis"
app:showAsAction="never"
android:checkable="true" />
<item
android:id="@+id/action_enable_ads"
android:orderInCategory="150"
android:title="@string/action_enable_ads"
app:showAsAction="never"
android:checkable="true" />
<item
android:id="@+id/action_exit"
android:orderInCategory="500"
android:title="@string/action_exit"
app:showAsAction="never" />
/>
</menu>

View File

@@ -1,7 +1,7 @@
<resources>
<!-- App details -->
<string name="appName">Infinite Timer</string>
<string name="appVersion">Test v201610291024</string>
<string name="appVersion">Test v20250711</string>
<string name="TAG">com.hyperling.apps.infinitetimer</string>
<!-- Keys -->

View File

@@ -1,7 +1,7 @@
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<style name="AppTheme" parent="Theme.AppCompat.DayNight.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
@@ -9,7 +9,7 @@
</style>
<!-- Base application theme. -->
<style name="InfiniteTimer" parent="Theme.AppCompat.Light.DarkActionBar">
<style name="InfiniteTimer" parent="Theme.AppCompat.DayNight.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>

View File

@@ -1,17 +0,0 @@
package com.hyperling.apps.infinitetimer.deleteme;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
}

View File

@@ -2,7 +2,10 @@
buildscript {
repositories {
jcenter()
mavenCentral()
maven {
url 'https://jitpack.io'
}
google()
maven {
url 'https://maven.google.com/'
@@ -10,7 +13,7 @@ buildscript {
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.android.tools.build:gradle:8.11.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
@@ -19,7 +22,7 @@ buildscript {
allprojects {
repositories {
jcenter()
mavenCentral()
google()
}
}

View File

@@ -1,6 +1,6 @@
#Thu Jan 10 06:37:42 CST 2019
#Fri Jul 11 12:55:34 MST 2025
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip