OSDN Git Service

Update to use new unlock APIs, new wallpaper theme.
authorDianne Hackborn <hackbod@google.com>
Tue, 22 Sep 2009 20:44:12 +0000 (13:44 -0700)
committerDianne Hackborn <hackbod@google.com>
Tue, 22 Sep 2009 20:44:12 +0000 (13:44 -0700)
Also don't allow the user to press back when in the full screen alarm.

Change-Id: Ic0c9658c75d3a2b3f49028f432fe226b1a0d8e9e

AndroidManifest.xml
src/com/android/alarmclock/AlarmAlert.java
src/com/android/alarmclock/AlarmAlertFullScreen.java

index 8cdaf55..8ee8ab6 100644 (file)
@@ -34,8 +34,8 @@
         <activity android:name="AlarmAlert"
                 android:excludeFromRecents="true"
                 android:theme="@style/alarm_alert"
-                android:launchMode="singleTask"
-                android:taskAffinity=":AlarmAlert"
+                android:launchMode="singleInstance"
+                android:taskAffinity=""
                 android:configChanges="orientation|keyboardHidden|keyboard|navigation"/>
 
         <!-- This activity is basically the same as AlarmAlert but with a more
@@ -43,9 +43,9 @@
              with the wallpaper background. -->
         <activity android:name="AlarmAlertFullScreen"
                 android:excludeFromRecents="true"
-                android:theme="@android:style/Theme.NoTitleBar"
-                android:launchMode="singleTask"
-                android:taskAffinity=":AlarmAlert"
+                android:theme="@android:style/Theme.Wallpaper.NoTitleBar"
+                android:launchMode="singleInstance"
+                android:taskAffinity=""
                 android:configChanges="orientation|keyboardHidden|keyboard|navigation"/>
 
         <activity android:name="ClockPicker" />
index 71871d5..1543c03 100644 (file)
@@ -78,9 +78,6 @@ public class AlarmAlert extends Activity {
         mVolumeBehavior = Integer.parseInt(vol);
 
         requestWindowFeature(android.view.Window.FEATURE_NO_TITLE);
-        getWindow().addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED
-                | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON
-                | WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON);
         updateLayout();
 
         // Register to get the alarm killed intent.
@@ -219,6 +216,13 @@ public class AlarmAlert extends Activity {
     }
 
     @Override
+    protected void onStop() {
+        super.onStop();
+        // Don't hang around.
+        finish();
+    }
+    
+    @Override
     public void onDestroy() {
         super.onDestroy();
         if (Log.LOGV) Log.v("AlarmAlert.onDestroy()");
index 07d0d9c..714262a 100644 (file)
 
 package com.android.alarmclock;
 
-import android.graphics.drawable.BitmapDrawable;
-import android.view.View;
-import android.view.Gravity;
-import android.view.LayoutInflater;
+import android.os.Bundle;
+import android.view.WindowManager;
 
 /**
  * Full screen alarm alert: pops visible indicator and plays alarm tone. This
@@ -27,17 +25,18 @@ import android.view.LayoutInflater;
  * background is the current wallpaper.
  */
 public class AlarmAlertFullScreen extends AlarmAlert {
-
     @Override
-    final protected View inflateView(LayoutInflater inflater) {
-        View v = inflater.inflate(R.layout.alarm_alert, null);
-
-        // Display the wallpaper as the background.
-        BitmapDrawable wallpaper = (BitmapDrawable) getWallpaper();
-        wallpaper.setGravity(Gravity.CENTER);
-        v.setBackgroundDrawable(wallpaper);
-
-        return v;
+    protected void onCreate(Bundle icicle) {
+        super.onCreate(icicle);
+        getWindow().addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED
+                | WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD
+                | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON
+                | WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON);
+    }
+    
+    @Override
+    public void onBackPressed() {
+        // Don't allow back to dismiss.
+        return;
     }
-
 }