Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f0cd128025 | ||
|
|
b7a419eeab |
@@ -1,6 +1,5 @@
|
||||
package com.hyperling.apps.infinitetimer;
|
||||
|
||||
import android.app.NotificationManager;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
@@ -8,7 +7,6 @@ import android.graphics.Color;
|
||||
import android.media.AudioManager;
|
||||
import android.media.MediaPlayer;
|
||||
import android.media.Ringtone;
|
||||
import android.media.RingtoneManager;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
@@ -16,6 +14,7 @@ import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.os.Message;
|
||||
import android.provider.Settings;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.util.Log;
|
||||
@@ -28,7 +27,6 @@ import android.widget.SeekBar;
|
||||
import android.widget.TableRow;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Map;
|
||||
|
||||
public class MainActivity extends AppCompatActivity {
|
||||
@@ -489,9 +487,9 @@ public class MainActivity extends AppCompatActivity {
|
||||
if (DEBUG) Log.d(tag, "Finished");
|
||||
}
|
||||
|
||||
private final android.os.Handler incrementTime = new android.os.Handler(android.os.Looper.getMainLooper()){
|
||||
private final Handler incrementTime = new Handler(Looper.getMainLooper()){
|
||||
@Override
|
||||
public void handleMessage(Message msg) {
|
||||
public void handleMessage(@NonNull Message msg) {
|
||||
String tag = TAG + "handleMessage";
|
||||
if (DEBUG) Log.d(tag, "Starting");
|
||||
|
||||
@@ -537,30 +535,36 @@ public class MainActivity extends AppCompatActivity {
|
||||
}
|
||||
|
||||
// Wait
|
||||
Runnable task = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
synchronized (this){
|
||||
try{
|
||||
wait(waitInterval);
|
||||
if (DEBUG) Log.d(tag, "Done waiting.");
|
||||
}
|
||||
catch (Exception e){
|
||||
e.printStackTrace();
|
||||
if (DEBUG) Log.d(tag, "Failed to wait.");
|
||||
}
|
||||
}
|
||||
//sharedPreferences.edit().putBoolean(keyStartStop, true).apply();
|
||||
incrementTime.sendEmptyMessage(0);
|
||||
//startStopChronometer("Start");
|
||||
}
|
||||
};
|
||||
Thread t = new Thread(task);
|
||||
Thread t = wait(tag);
|
||||
t.start();
|
||||
}
|
||||
if (DEBUG) Log.d(tag, "Finished");
|
||||
}
|
||||
|
||||
@NonNull
|
||||
private Thread wait(String tag) {
|
||||
Runnable task = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
synchronized (this){
|
||||
try{
|
||||
wait(waitInterval);
|
||||
if (DEBUG) Log.d(tag, "Done waiting.");
|
||||
}
|
||||
catch (Exception e){
|
||||
e.printStackTrace();
|
||||
if (DEBUG) Log.d(tag, "Failed to wait.");
|
||||
}
|
||||
}
|
||||
//sharedPreferences.edit().putBoolean(keyStartStop, true).apply();
|
||||
incrementTime.sendEmptyMessage(0);
|
||||
//startStopChronometer("Start");
|
||||
}
|
||||
};
|
||||
Thread t = new Thread(task);
|
||||
return t;
|
||||
}
|
||||
};
|
||||
|
||||
private void setStartTime(){
|
||||
|
||||
Reference in new issue
Block a user