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

Commit 7f78a4b7 authored by Mihai Nita's avatar Mihai Nita Committed by Roozbeh Pournader
Browse files

UX fixes for the language draggable cell

This should bring things closer to the recommended UX guidelines.

It changes the way the checkbox / label play together,
and changes the "localization missing" warning icon to a string.
Also some cleanup of hard-coded styles and sizes.

Bug: 26758865
Bug: 26707846
Change-Id: I07a78a1e4a41122b91e895e363a217d3e9cacd40
parent 4b796fa7
Loading
Loading
Loading
Loading
+6 −8
Original line number Diff line number Diff line
@@ -15,15 +15,13 @@
-->

<vector xmlns:android="http://schemas.android.com/apk/res/android"
        android:height="50dp"
        android:width="50dp"
        android:viewportHeight="100"
        android:viewportWidth="100"
        android:tint="#757575" >
        android:height="24dp"
        android:width="24dp"
        android:viewportHeight="48"
        android:viewportWidth="48"
        android:tint="@color/material_grey_600">

    <path android:fillColor="@android:color/white"
          android:pathData="M29,48 l 0,-4 42,0 0,4 z" />
    <path android:fillColor="@android:color/white"
          android:pathData="M29,56 l 0,-4 42,0 0,4 z" />
          android:pathData="M8,18v4h32v-4hm-32,8v4h32v-4z" />

</vector>
+41 −38
Original line number Diff line number Diff line
@@ -19,61 +19,64 @@
              xmlns:tools="http://schemas.android.com/tools"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:gravity="center_vertical"
              android:orientation="horizontal"
              android:baselineAligned="false"
              android:minHeight="?android:listPreferredItemHeight"
              android:background="?android:colorBackground"
              android:layoutDirection="locale"
              android:textDirection="locale">

    <CheckBox
        android:id="@+id/checkbox"
        style="@style/LanguageCheckboxAndLabel"
        tools:text="French"
        android:paddingStart="16dp"
        android:layout_toStartOf="@+id/dragHandle"/>

    <TextView
        android:id="@+id/label"
        style="@style/LanguageCheckboxAndLabel"
        tools:text="French"
        android:paddingStart="48dp"
        android:layout_toStartOf="@+id/dragHandle"/>

    <TextView
        android:id="@+id/miniLabel"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_marginLeft="12dp"
        android:layout_marginRight="12dp"
        android:layout_marginStart="?android:attr/listPreferredItemPaddingStart"
        tools:text="22"
        android:textColor="?android:attr/colorAccent"
        android:minWidth="20sp"
        android:textAlignment="textEnd"
        android:gravity="center_vertical|end"
        android:background="?android:colorBackground"/>

    <CheckBox
        android:id="@+id/checkbox"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:minWidth="20sp"
        android:layout_marginLeft="6dp"
        android:layout_marginRight="6dp"
        android:visibility="gone"
        android:background="?android:colorBackground"/>
        android:minWidth="32sp"
        android:gravity="center_vertical|center_horizontal"
        android:layout_alignTop="@id/checkbox"
        android:layout_alignBottom="@id/checkbox"/>

    <TextView
        android:id="@+id/label"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:padding="12dp"
        tools:text="France"
        android:textAppearance="?android:attr/textAppearanceListItem"
        android:background="?android:colorBackground"/>

    <ImageView
        android:id="@+id/l10nWarn"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:src="@android:drawable/stat_sys_warning"
        android:focusableInTouchMode="false"
        android:focusable="false"
        android:paddingStart="12dp"
        android:paddingEnd="12dp"
        android:tint="?android:attr/colorAccent"/>
        style="@style/LanguageCheckboxAndLabel"
        android:layout_marginTop="-28dp"
        android:paddingStart="48dp"
        android:textAppearance="?android:attr/textAppearanceListItemSecondary"
        android:textColor="?android:textColorSecondary"
        android:text="@string/locale_not_translated"
        android:layout_toStartOf="@+id/dragHandle"
        android:layout_below="@id/label"/>

    <ImageView
        android:id="@+id/dragHandle"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:paddingStart="?android:attr/listPreferredItemPaddingStart"
        android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
        android:layout_gravity="center_vertical"
        android:src="@drawable/drag_handle"/>
        android:src="@drawable/drag_handle"
        android:layout_alignParentEnd="true"
        android:layout_alignTop="@id/checkbox"
        android:layout_alignBottom="@id/checkbox"/>

    <View
        android:layout_width="match_parent"
        android:layout_height="1dp"
        android:background="?android:attr/listDivider"
        android:layout_alignParentBottom="true"/>

</com.android.settings.localepicker.LocaleDragCell>
+7 −4
Original line number Diff line number Diff line
@@ -17,8 +17,10 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:layoutDirection="locale"
              android:paddingTop="8dp"
              android:paddingBottom="8dp"
              android:orientation="vertical"
              android:layoutDirection="locale"
              android:textDirection="locale">

    <com.android.settings.localepicker.LocaleRecyclerView
@@ -31,10 +33,11 @@
    <Button
        android:id="@+id/add_language"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_height="?android:listPreferredItemHeight"
        android:paddingStart="?android:attr/listPreferredItemPaddingStart"
        android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
        android:drawableStart="@drawable/ic_add_24dp"
        android:drawablePadding="12dp"
        android:minHeight="64dp"
        android:drawablePadding="24dp"
        android:textAlignment="textStart"
        android:text="@string/add_a_language"
        style="@style/Base.Widget.AppCompat.Button.Borderless"
+3 −0
Original line number Diff line number Diff line
@@ -536,6 +536,9 @@
    <!-- The text of the error dialog shown when the user selected all the languages and tries to remove them [CHAR LIMIT=NONE] -->
    <string name="dlg_remove_locales_error_message">Can’t remove all the languages, you should leave at least one.</string>
    <!-- TODO: Marked non-translatable for now, as it is not final. Waiting on b/27070104 -->
    <!-- This text shows in the language picker when the system is not translated into that languages [CHAR LIMIT=130] -->
    <string name="locale_not_translated" translatable="false">Not all applications are translated into this language; you might experience a mixture.</string>
    <!-- The title of the dialog to pick an activity.  This is shown when there are multiple activities that can do a particular action.  For example, suppose you click on the "Share" menu item in the Browser.  Since you can share the webpage URL via many communication methods, this dialog would come up with choices like "Email", "IM", etc.  This is a generic message, and the previous example is a single possible scenario (so please don't assume it's for the browser or anything :) ). -->
    <string name="activity_picker_label">Choose activity</string>
+10 −0
Original line number Diff line number Diff line
@@ -372,4 +372,14 @@
        <item name="pageIndicatorColor">@android:color/tertiary_text_light</item>
        <item name="currentPageIndicatorColor">@android:color/primary_text_light</item>
    </style>

    <style name="LanguageCheckboxAndLabel">
        <item name="android:layout_width">match_parent</item>
        <item name="android:layout_height">wrap_content</item>
        <item name="android:layout_marginStart">?android:attr/listPreferredItemPaddingStart</item>
        <item name="android:minHeight">?android:attr/listPreferredItemHeight</item>
        <item name="android:textAppearance">?android:attr/textAppearanceListItem</item>
        <item name="android:gravity">center_vertical</item>
    </style>

</resources>
Loading