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

Commit a4c8487f authored by Michael W's avatar Michael W
Browse files

DeskClock: Redesign Ringtone Picker

* Use ConstraintLayout
* Custom ringtones:
  * Add three-dot menu so deletion is more obvious
  * Use standard icon
  * New error icon
  * New '+' icon

Change-Id: Idea05d3948c5690bd0ffbf990bcbac756a352810
parent 84bae0c3
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
     SPDX-FileCopyrightText: 2022 The Android Open Source Project
     SPDX-License-Identifier: Apache-2.0
-->

<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="24dp"
    android:height="24dp"
    android:viewportWidth="24"
    android:viewportHeight="24">
    <path
        android:fillColor="#FF4444"
        android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM13,17h-2v-2h2v2zM13,13h-2L11,7h2v6z" />
</vector>
+14 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
     SPDX-FileCopyrightText: 2022 The Android Open Source Project
     SPDX-License-Identifier: Apache-2.0
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="24dp"
    android:height="24dp"
    android:viewportWidth="24"
    android:viewportHeight="24">
    <path
        android:fillColor="#FFF"
        android:pathData="M12,16A2,2 0 0,1 14,18A2,2 0 0,1 12,20A2,2 0 0,1 10,18A2,2 0 0,1 12,16M12,10A2,2 0 0,1 14,12A2,2 0 0,1 12,14A2,2 0 0,1 10,12A2,2 0 0,1 12,10M12,4A2,2 0 0,1 14,6A2,2 0 0,1 12,8A2,2 0 0,1 10,6A2,2 0 0,1 12,4Z" />
</vector>
+0 −26
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2016 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.
-->

<vector
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="40dp"
    android:height="40dp"
    android:viewportHeight="40.0"
    android:viewportWidth="40.0">
    <path
        android:fillColor="#FFFFFFFF"
        android:pathData="M38,0H2C0.9,0 0,0.9 0,2v36c0,1.1 0.9,2 2,2h36c1.1,0 2,-0.9 2,-2V2C40,0.9 39.1,0 38,0zM26,15h-4v10c0,2.2 -1.8,4 -4,4s-4,-1.8 -4,-4c0,-2.2 1.8,-4 4,-4c0.7,0 1.4,0.2 2,0.5V11h6V15z" />
</vector>
 No newline at end of file
+78 −70
Original line number Diff line number Diff line
@@ -15,81 +15,89 @@
  limitations under the License.
  -->

<!-- This parent FrameLayout provides a tap ripple effect over all children. -->
<FrameLayout
<androidx.constraintlayout.widget.ConstraintLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:foreground="?attr/selectableItemBackground">
    android:foreground="?attr/selectableItemBackground"
    android:paddingTop="12dp"
    android:paddingBottom="12dp">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:animateLayoutChanges="true"
        android:orientation="horizontal"
        android:paddingBottom="8dp"
        android:paddingTop="8dp"
        tools:ignore="UselessParent">

        <Space
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="@integer/gutter_width_percent" />

        <RelativeLayout
            android:layout_width="0dp"
    <androidx.constraintlayout.widget.Guideline
        android:id="@+id/start_guide"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
            android:layout_weight="@integer/guttered_content_width_percent"
            android:gravity="center_vertical"
            android:orientation="horizontal">
        android:orientation="vertical"
        app:layout_constraintGuide_begin="@dimen/gutter_horizontal_padding" />

            <LinearLayout
    <androidx.constraintlayout.widget.Guideline
        android:id="@+id/end_guide_very_thin"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
                android:gravity="center_vertical">
        android:orientation="vertical"
        app:layout_constraintGuide_percent="0.98" />

    <ImageView
        android:id="@+id/ringtone_image"
                    android:layout_width="40dp"
                    android:layout_height="40dp"
        android:layout_width="48dp"
        android:layout_height="48dp"
        android:importantForAccessibility="no"
                    android:scaleType="center"
        android:scaleType="centerInside"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintStart_toEndOf="@id/start_guide"
        app:layout_constraintTop_toTopOf="parent"
        tools:src="@drawable/ic_ringtone" />

    <TextView
        android:id="@+id/ringtone_name"
                    android:layout_width="wrap_content"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
                    android:paddingEnd="16dp"
        android:paddingStart="16dp"
                    android:textColor="@color/white"
                    android:textSize="@dimen/alarm_text_font_size"
                    tools:text="Standard"/>

            </LinearLayout>
        android:paddingEnd="16dp"
        android:singleLine="true"
        android:textColor="?android:textColorPrimary"
        android:textSize="16sp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toStartOf="@id/sound_image_selected"
        app:layout_constraintStart_toEndOf="@id/ringtone_image"
        app:layout_constraintTop_toTopOf="parent" />

    <ImageView
        android:id="@+id/sound_image_selected"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:contentDescription="@string/selected"
        android:minWidth="@dimen/touch_target_min_size"
        android:minHeight="@dimen/touch_target_min_size"
        android:scaleType="center"
        android:src="@drawable/selector_checkbox_checked"
                android:layout_width="40dp"
                android:layout_height="40dp"
        android:visibility="gone"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toStartOf="@id/music_actions"
        app:layout_constraintTop_toTopOf="parent"
        app:tint="?colorAccent"
        app:tintMode="src_in"
        tools:visibility="visible" />

    <ImageView
        android:id="@+id/music_actions"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentEnd="true"
        android:layout_centerVertical="true"
                android:importantForAccessibility="no"
        android:contentDescription="@string/more_options"
        android:foreground="?selectableItemBackgroundBorderless"
        android:minWidth="@dimen/touch_target_min_size"
        android:minHeight="@dimen/touch_target_min_size"
        android:scaleType="center"
        android:scaleX="0.75"
        android:scaleY="0.75"
        android:src="@drawable/ic_more"
        android:visibility="gone"
                app:tint="@color/accent_color"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toStartOf="@id/end_guide_very_thin"
        app:layout_constraintTop_toTopOf="parent"
        tools:visibility="visible" />

        </RelativeLayout>

        <Space
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="@integer/gutter_width_percent" />

    </LinearLayout>

</FrameLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
+4 −2
Original line number Diff line number Diff line
@@ -16,12 +16,14 @@

<FrameLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <androidx.recyclerview.widget.RecyclerView
        android:id="@+id/ringtone_content"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />
        android:layout_height="match_parent"
        tools:listitem="@layout/ringtone_item_sound" />

</FrameLayout>
Loading