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

Commit 3012eefc authored by Chiao Cheng's avatar Chiao Cheng Committed by Isaac Katzenelson
Browse files

Adding unlock-like slider control for alarm dismiss/snooze.

This is a re-addition of something that was previously added and then removed:
I65be41b889446ae7232488bfc2809bd2add93f6f

- Ported GlowPadView and helper classes over to clock app.  Framework version
  relies on a couple hidden api's so there are minor changes to the code.
- Added necessary drawables to support slider.
- Added special paddings for 7" and 10" tablet.

Bug: 7353387
Change-Id: I6101bebdb4be6f0208d171fbfadc4317f9fac675
parent 3fd30065
Loading
Loading
Loading
Loading
+37 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>

<!--
  ~ Copyright (C) 2012 The Android Open Source Project
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~      http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License
  -->

<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item
        android:state_enabled="true"
        android:state_active="false"
        android:state_focused="false"
        android:drawable="@drawable/ic_lockscreen_wakeup_normal"/>

    <item
        android:state_enabled="true"
        android:state_active="true"
        android:state_focused="false"
        android:drawable="@drawable/ic_lockscreen_wakeup_activated"/>

    <item
        android:state_enabled="true"
        android:state_active="false"
        android:state_focused="true"
        android:drawable="@drawable/ic_lockscreen_wakeup_activated"/>
</selector>
+27 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>

<!--
  ~ Copyright (C) 2012 The Android Open Source Project
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~      http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License
  -->

<shape xmlns:android="http://schemas.android.com/apk/res/android"
       android:shape="oval"
    >
    <size android:height="@dimen/glowpadview_outerring_diameter"
          android:width="@dimen/glowpadview_outerring_diameter"/>
    <solid android:color="#00000000"/>
    <stroke android:color="#1affffff" android:width="2dp"/>
</shape>
+37 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>

<!--
  ~ Copyright (C) 2012 The Android Open Source Project
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~      http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License
  -->

<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item
        android:state_enabled="true"
        android:state_active="false"
        android:state_focused="false"
        android:drawable="@drawable/ic_lockscreen_snooze_normal"/>

    <item
        android:state_enabled="true"
        android:state_active="true"
        android:state_focused="false"
        android:drawable="@drawable/ic_lockscreen_snooze_activated"/>

    <item
        android:state_enabled="true"
        android:state_active="false"
        android:state_focused="true"
        android:drawable="@drawable/ic_lockscreen_snooze_activated"/>
</selector>
+32 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>

<!--
  ~ Copyright (C) 2012 The Android Open Source Project
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~      http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License
  -->

<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item
        android:state_enabled="true"
        android:state_active="false"
        android:state_focused="false"
        android:drawable="@drawable/ic_lockscreen_alarm"/>

    <!-- "Pressed" state uses the same simple "ring" image as on the lockscreen -->
    <item
        android:state_enabled="true"
        android:state_active="true"
        android:state_focused="false"
        android:drawable="@drawable/ic_lockscreen_handle_pressed"/>
</selector>
+30 −36
Original line number Diff line number Diff line
@@ -15,7 +15,8 @@
     limitations under the License.
-->

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:dc="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
@@ -28,12 +29,14 @@
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:layout_alignParentLeft="true"
        android:layout_centerVertical="true"
        android:paddingBottom="@dimen/header_font_size"
        android:paddingLeft="24dp" >
        android:paddingLeft="@dimen/alarm_alert_clock_padding_left" >

        <TextView
            android:id="@+id/alertTitle"
            style="@style/header_not_caps"
            style="@style/header"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:ellipsize="end"
@@ -71,6 +74,7 @@
            <com.android.deskclock.ZeroTopPaddingTextView
                android:id="@+id/am_pm"
                style="@style/label"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:ellipsize="none"
                android:singleLine="true"
@@ -78,40 +82,30 @@
        </com.android.deskclock.DigitalClock>
    </LinearLayout>

    <LinearLayout
        android:layout_width="0dip"
    <com.android.deskclock.widget.multiwaveview.GlowPadView
        android:id="@+id/glow_pad_view"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:orientation="vertical"
        android:paddingLeft="24dip"
        android:paddingRight="24dip" >

        <Button
            android:id="@+id/snooze"
            style="@style/bold_button"
            android:layout_width="match_parent"
            android:layout_height="96dip"
            android:layout_marginBottom="10dip"
            android:background="@+drawable/btn_alarm_alert"
            android:ellipsize="end"
        android:focusable="true"
        android:layout_marginRight="@dimen/glowpadview_margin_right"
        android:layout_alignParentRight="true"
        android:layout_centerVertical="true"
        android:gravity="center"
            android:singleLine="true"
            android:text="@string/alarm_alert_snooze_text"
            android:textColor="@color/black" />
        android:layout_gravity="center_vertical"

        <Button
            android:id="@+id/ok"
            style="@style/bold_button"
            android:layout_width="match_parent"
            android:layout_height="48dip"
            android:layout_marginBottom="@dimen/label_font_size"
            android:layout_marginTop="10dip"
            android:background="@+drawable/btn_alarm_alert"
            android:ellipsize="end"
            android:gravity="center"
            android:singleLine="true"
            android:text="@android:string/ok"
            android:textColor="@color/black" />
    </LinearLayout>
        dc:targetDrawables="@array/snooze_dismiss_drawables"
        dc:targetDescriptions="@array/snooze_dismiss_descriptions"
        dc:directionDescriptions="@array/snooze_dismiss_direction_descriptions"
        dc:handleDrawable="@drawable/ic_alarm_alert_touch_handle"
        dc:outerRingDrawable="@drawable/ic_alarm_alert_outerring"
        dc:outerRadius="@dimen/glowpadview_target_placement_radius"
        dc:innerRadius="@dimen/glowpadview_inner_radius"
        dc:snapMargin="@dimen/glowpadview_snap_margin"
        dc:feedbackCount="1"
        dc:vibrationDuration="20"
        dc:glowRadius="@dimen/glowpadview_glow_radius"
        dc:pointDrawable="@drawable/ic_lockscreen_glowdot"
        />

</RelativeLayout>
</LinearLayout>
 No newline at end of file
Loading