Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ba26bd37 authored by John Spurlock's avatar John Spurlock
Browse files

Clock: Add dialog title to full-screen alarm alert.

Add dialog title layout to full-screen alarm alert.  It must remain
non-floating to wake device, yet appear like a standard dialog.
Remove unused AlarmAlertTheme.

Bug: 6003408
Change-Id: I033e6eb9edc97c14020d5e1f30fb0b2cfff4fa62
parent 8683babb
Loading
Loading
Loading
Loading
+33 −2
Original line number Diff line number Diff line
@@ -20,6 +20,37 @@
    android:layout_height="match_parent"
    >

    <LinearLayout android:id="@+id/topPanel"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:orientation="vertical">

        <LinearLayout android:id="@+id/title_template"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            android:gravity="center_vertical|left"
            android:minHeight="@dimen/alert_dialog_title_height"
            android:layout_marginLeft="16dip"
            android:layout_marginRight="16dip">

            <TextView android:id="@+id/alertTitle"
                style="?android:attr/windowTitleStyle"
                android:singleLine="true"
                android:ellipsize="end"
                android:layout_width="match_parent"
                android:layout_height="wrap_content" />

        </LinearLayout>

        <View android:id="@+id/titleDivider"
            android:layout_width="match_parent"
            android:layout_height="2dip"
            android:background="@android:color/holo_blue_light" />

    </LinearLayout>

    <com.android.deskclock.DigitalClock
        android:id="@+id/digitalClock"
        android:layout_width="match_parent"
@@ -30,7 +61,7 @@
        android:paddingRight="20dip"
        android:paddingBottom="80dp"
        android:baselineAligned="true"
        android:layout_alignParentTop="true"
        android:layout_below="@id/topPanel"
        android:layout_centerHorizontal="true"
        >

@@ -61,7 +92,7 @@
        style="?android:attr/buttonBarButtonStyle"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_alignParentTop="true"
        android:layout_below="@id/topPanel"
        android:layout_alignBottom="@id/digitalClock"
        android:paddingBottom="16dp"
        android:gravity="bottom|center_horizontal"
+0 −6
Original line number Diff line number Diff line
@@ -19,12 +19,6 @@
    <style name="AlarmClockTheme" parent="android:Theme.Holo.Dialog"/>
    <style name="SetAlarmTheme" parent="android:Theme.Holo.Dialog"/>

    <!-- This theme is similar to the Theme.Dialog.Alert but does not rely on a
         non-public resource. -->
    <style name="AlarmAlertTheme" parent="android:Theme.Holo.Dialog">
        <item name="android:windowBackground">@android:color/transparent</item>
    </style>

    <!-- NOTE: This must be a fullscreen theme, or else the fullscreen alarm will 
         be unable to turn the screen on. -->
    <style name="AlarmAlertFullScreenTheme" parent="android:Theme.Holo.Wallpaper.NoTitleBar"/>
+1 −0
Original line number Diff line number Diff line
@@ -31,4 +31,5 @@
    <dimen name="font_margin_adjust">4dip</dimen>
    <dimen name="next_alarm_margin_top">-4dip</dimen>
    <dimen name="alarm_label_padding">8dip</dimen>
    <dimen name="alert_dialog_title_height">64dip</dimen>
</resources>
+9 −6
Original line number Diff line number Diff line
@@ -24,15 +24,18 @@
    <style name="AlarmClockTheme" parent="android:Theme.Holo.DialogWhenLarge"/>
    <style name="SetAlarmTheme" parent="android:Theme.Holo.DialogWhenLarge"/>

    <!-- This theme is similar to the Theme.Dialog.Alert but does not rely on a
         non-public resource. -->
    <style name="AlarmAlertTheme" parent="android:Theme.Dialog">
        <item name="android:windowBackground">@android:color/transparent</item>
    <style name="AlarmAlertFullScreenWindowTitle">
        <item name="android:maxLines">1</item>
        <item name="android:scrollHorizontally">true</item>
        <item name="android:textSize">22sp</item>
        <item name="android:textColor">@android:color/holo_blue_light</item>
    </style>
    
    <!-- NOTE: This must be a fullscreen theme, or else the fullscreen alarm will 
         be unable to turn the screen on. -->
    <style name="AlarmAlertFullScreenTheme" parent="android:Theme.Holo.Wallpaper.NoTitleBar"/>
    <style name="AlarmAlertFullScreenTheme" parent="android:Theme.Holo.Wallpaper.NoTitleBar">
        <item name="android:windowTitleStyle">@style/AlarmAlertFullScreenWindowTitle</item>
    </style>

    <style name="RoundTouchButton">
        <item name="android:gravity">center</item>
+4 −0
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import android.content.IntentFilter;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.view.View;

/**
 * Full screen alarm alert: pops visible indicator and plays alarm tone. This
@@ -58,6 +59,9 @@ public class AlarmAlert extends AlarmAlertFullScreen {
    protected void onCreate(Bundle icicle) {
        super.onCreate(icicle);

        /* Disable custom title, this will already be shown as a dialog */
        findViewById(R.id.topPanel).setVisibility(View.GONE);

        // Listen for the screen turning off so that when the screen comes back
        // on, the user does not need to unlock the phone to dismiss the alarm.
        registerReceiver(mScreenOffReceiver,
Loading