Bug fixes for Alarm service, to make sure we don't remove an inactive alarm service (thus preventing it from ever starting next time). Also add commented-out code for a radial timepicker, which can be reenabled when betterpickers releases 1.5.3 (but test it).

This commit is contained in:
Timothy Allen 2014-04-18 16:07:19 +02:00
parent 048d56c84d
commit 55e8777d42
6 changed files with 29 additions and 46 deletions

View File

@ -1,10 +0,0 @@
<component name="libraryTable">
<library name="library-1.5.2">
<CLASSES>
<root url="jar://$PROJECT_DIR$/HypoAlarm/build/exploded-aar/com.doomonafireball.betterpickers/library/1.5.2/classes.jar!/" />
<root url="file://$PROJECT_DIR$/HypoAlarm/build/exploded-aar/com.doomonafireball.betterpickers/library/1.5.2/res" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>

View File

@ -8,11 +8,10 @@
</facet>
<facet type="android" name="Android">
<configuration>
<option name="SELECTED_BUILD_VARIANT" value="debug" />
<option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
<option name="COMPILE_JAVA_TASK_NAME" value="compileDebugJava" />
<option name="ASSEMBLE_TEST_TASK_NAME" value="assembleDebugTest" />
<option name="SOURCE_GEN_TASK_NAME" value="generateDebugSources" />
<option name="SELECTED_BUILD_VARIANT" value="release" />
<option name="ASSEMBLE_TASK_NAME" value="assembleRelease" />
<option name="COMPILE_JAVA_TASK_NAME" value="compileReleaseJava" />
<option name="SOURCE_GEN_TASK_NAME" value="generateReleaseSources" />
<option name="ALLOW_USER_CONFIGURATION" value="false" />
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
@ -22,26 +21,21 @@
</facet>
</component>
<component name="NewModuleRootManager" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/build/classes/debug" />
<output url="file://$MODULE_DIR$/build/classes/release" />
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/build/source/r/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/source/aidl/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/source/buildConfig/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/source/rs/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/res/rs/debug" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/source/r/test/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/source/aidl/test/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/source/buildConfig/test/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/source/rs/test/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/res/rs/test/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/aidl" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/assets" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/build/source/r/release" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/source/aidl/release" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/source/buildConfig/release" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/source/rs/release" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/res/rs/release" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/release/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/release/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/release/aidl" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/release/assets" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/release/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/release/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/release/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/aidl" isTestSource="false" />
@ -75,7 +69,6 @@
<orderEntry type="library" exported="" name="play-services-4.3.23" level="project" />
<orderEntry type="library" exported="" name="glowpadbackport-2.1.0" level="project" />
<orderEntry type="library" exported="" name="library-2.4.0" level="project" />
<orderEntry type="library" exported="" name="library-1.5.2" level="project" />
</component>
</module>

View File

@ -32,12 +32,10 @@ dependencies {
compile 'net.frakbot.glowpadbackport:glowpadbackport:+'
//compile 'net.frakbot.glowpadbackport:glowpadbackport:2.1.0'
compile 'com.doomonafireball.betterpickers:library:+'
//compile 'com.doomonafireball.betterpickers:library:+'
//compile 'com.doomonafireball.betterpickers:library:1.5.2'
//compile 'com.doomonafireball.betterpickers:library:1.5.3-SNAPSHOT'
//compile project(':GlowPadBackport')
//compile project(':SeekArc')
//compile fileTree(dir: 'libs', include: ['*.aar'])
//compile fileTree(dir: 'libs', include: ['*.jar'])
//compile 'com.github.flavienlaurent.datetimepicker:library:+'
//compile 'com.github.flavienlaurent.datetimepicker:library:0.0.1'
}

View File

@ -13,11 +13,17 @@ import net.frakbot.glowpadbackport.GlowPadView;
public class AlarmAlertActivity extends Activity {
public static Activity alertActivity;
@Override
protected void onDestroy() {
super.onDestroy();
alertActivity = null;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Self-reference so we can run finish() from outside.
// Self-reference so we can run finish() from other classes
alertActivity = this;
requestWindowFeature(Window.FEATURE_NO_TITLE);

View File

@ -21,7 +21,6 @@ public class AlarmService extends Service {
private static final int SNOOZE_TIME = 1000*60*5; // Snooze for 5 minutes if need be
private static final int ALERT_LIFE = 1000*60*2; // 2 minutes
private static PowerManager.WakeLock wl;
private static AlarmManager alarmManager;
private static Intent alarmServiceIntent, alertActivityIntent, notifyIntent;
private static Boolean alarmStarted = false;
public static volatile String alarmStatus; // Register ALARM_DISMISSED and its brethren here
@ -39,9 +38,6 @@ public class AlarmService extends Service {
wl = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "AlarmService");
// TODO: wake lock?
//wl.acquire();
alarmManager = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
}
@Override
public void onDestroy() {
@ -74,7 +70,6 @@ public class AlarmService extends Service {
Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
if (alarmStarted) {
stopAlert(getApplicationContext());
stopService(notifyIntent);
}
alarmStarted = true;

View File

@ -34,6 +34,7 @@ public class CancelAlarmReceiver extends BroadcastReceiver {
Toast.makeText(context, context.getString(R.string.alarmCancelToast), Toast.LENGTH_LONG).show();
// Stop any snoozed/existing alarms that may have started
AlarmService.setAlarmStatus(AlarmService.ALARM_DISMISSED);
context.stopService(new Intent(context, AlarmService.class));
// Remove notification