summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcyBerta <cyberta@riseup.net>2021-11-24 23:53:08 +0100
committercyBerta <cyberta@riseup.net>2021-11-24 23:53:56 +0100
commitf78eeced2a24d869e514330467395b0471fb2adc (patch)
tree363035e7dbbd08aba5c14529175c324bec256013
parent68ca9c827da3c3fad9e70c74960f113560fd6711 (diff)
improve settings list entry layouts
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/base/views/IconSwitchEntry.java3
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/base/views/IconTextEntry.java6
-rw-r--r--app/src/main/res/layout-xlarge/v_icon_text_list_item.xml106
-rw-r--r--app/src/main/res/layout-xlarge/v_switch_list_item.xml138
-rw-r--r--app/src/main/res/layout/v_icon_text_list_item.xml105
-rw-r--r--app/src/main/res/layout/v_switch_list_item.xml140
-rw-r--r--app/src/main/res/values/attrs.xml3
7 files changed, 264 insertions, 237 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/base/views/IconSwitchEntry.java b/app/src/main/java/se/leap/bitmaskclient/base/views/IconSwitchEntry.java
index a499cdd1..79563bcf 100644
--- a/app/src/main/java/se/leap/bitmaskclient/base/views/IconSwitchEntry.java
+++ b/app/src/main/java/se/leap/bitmaskclient/base/views/IconSwitchEntry.java
@@ -92,6 +92,9 @@ public class IconSwitchEntry extends LinearLayout {
iconView.setImageDrawable(drawable);
}
+ boolean singleLine = typedArray.getBoolean(R.styleable.IconTextEntry_singleLine, true);
+ subtitleView.setSingleLine(singleLine);
+
typedArray.recycle();
}
}
diff --git a/app/src/main/java/se/leap/bitmaskclient/base/views/IconTextEntry.java b/app/src/main/java/se/leap/bitmaskclient/base/views/IconTextEntry.java
index 2d9525ed..7aefd089 100644
--- a/app/src/main/java/se/leap/bitmaskclient/base/views/IconTextEntry.java
+++ b/app/src/main/java/se/leap/bitmaskclient/base/views/IconTextEntry.java
@@ -14,6 +14,7 @@ import androidx.annotation.ColorRes;
import androidx.annotation.DrawableRes;
import androidx.annotation.Nullable;
import androidx.annotation.StringRes;
+import androidx.appcompat.widget.AppCompatImageView;
import androidx.appcompat.widget.AppCompatTextView;
import se.leap.bitmaskclient.R;
@@ -22,7 +23,7 @@ import se.leap.bitmaskclient.R;
public class IconTextEntry extends LinearLayout {
private AppCompatTextView textView;
- private ImageView iconView;
+ private AppCompatImageView iconView;
private AppCompatTextView subtitleView;
public IconTextEntry(Context context) {
@@ -73,6 +74,9 @@ public class IconTextEntry extends LinearLayout {
iconView.setImageDrawable(drawable);
}
+ boolean singleLine = typedArray.getBoolean(R.styleable.IconTextEntry_singleLine, true);
+ subtitleView.setSingleLine(singleLine);
+
typedArray.recycle();
}
diff --git a/app/src/main/res/layout-xlarge/v_icon_text_list_item.xml b/app/src/main/res/layout-xlarge/v_icon_text_list_item.xml
index b39540a6..530660af 100644
--- a/app/src/main/res/layout-xlarge/v_icon_text_list_item.xml
+++ b/app/src/main/res/layout-xlarge/v_icon_text_list_item.xml
@@ -1,63 +1,67 @@
-<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/item_container"
- android:layout_height="?android:attr/listPreferredItemHeight"
+ android:layout_height="wrap_content"
android:layout_width="match_parent"
- android:orientation="horizontal"
+ android:orientation="vertical"
xmlns:tools="http://schemas.android.com/tools">
-
- <ImageView
- android:id="@+id/material_icon"
- android:layout_width="?android:attr/listPreferredItemHeight"
- android:layout_height="?android:attr/listPreferredItemHeight"
- android:layout_gravity="center"
- android:paddingStart="?android:attr/listPreferredItemPaddingStart"
- android:paddingLeft="?android:attr/listPreferredItemPaddingLeft"
- tools:src="@drawable/ic_add_circle_outline_grey600_24dp"
- />
-
- <androidx.appcompat.widget.AppCompatTextView
- android:id="@android:id/text1"
+ <LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:textAppearance="?android:attr/textAppearanceListItem"
- android:gravity="center_vertical"
- android:maxLines="1"
- android:ellipsize="end"
- android:paddingStart="?android:attr/listPreferredItemPaddingStart"
- android:paddingLeft="?android:attr/listPreferredItemPaddingLeft"
- android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
- android:paddingRight="?android:attr/listPreferredItemPaddingRight"
- android:minHeight="?android:attr/listPreferredItemHeight"
- tools:text="TEST"
- android:layout_toEndOf="@id/material_icon"
- android:layout_toRightOf="@+id/material_icon"
- android:layout_above="@+id/subtitle"
- />
+ android:orientation="horizontal">
+ <androidx.appcompat.widget.AppCompatImageView
+ android:id="@+id/material_icon"
+ android:layout_width="?android:attr/listPreferredItemHeight"
+ android:layout_height="?android:attr/listPreferredItemHeight"
+ android:layout_gravity="center"
+ android:paddingStart="?android:attr/listPreferredItemPaddingStart"
+ android:paddingLeft="?android:attr/listPreferredItemPaddingLeft"
+ tools:src="@drawable/ic_add_circle_outline_grey600_24dp"
+ />
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ android:layout_gravity="center_vertical"
+ android:paddingTop="@dimen/compact_padding"
+ android:paddingBottom="@dimen/compact_padding"
+ >
+ <androidx.appcompat.widget.AppCompatTextView
+ android:id="@android:id/text1"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:textAppearance="?android:attr/textAppearanceListItem"
+ android:gravity="center_vertical"
+ android:maxLines="1"
+ android:ellipsize="end"
+ android:paddingStart="?android:attr/listPreferredItemPaddingStart"
+ android:paddingLeft="?android:attr/listPreferredItemPaddingLeft"
+ android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
+ android:paddingRight="?android:attr/listPreferredItemPaddingRight"
+ tools:text="TEST"
+ />
- <androidx.appcompat.widget.AppCompatTextView
- android:id="@+id/subtitle"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:gravity="center_vertical"
- android:layout_alignParentBottom="true"
- android:textAppearance="?android:attr/textAppearanceSmall"
- android:maxLines="1"
- android:ellipsize="end"
- android:paddingStart="?android:attr/listPreferredItemPaddingStart"
- android:paddingLeft="?android:attr/listPreferredItemPaddingLeft"
- android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
- android:paddingRight="?android:attr/listPreferredItemPaddingRight"
- android:paddingBottom="8dp"
- tools:text="TEST"
- android:visibility="gone"
- android:layout_toEndOf="@id/material_icon"
- android:layout_toRightOf="@+id/material_icon"
- />
+ <androidx.appcompat.widget.AppCompatTextView
+ android:id="@+id/subtitle"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:gravity="center_vertical"
+ android:singleLine="false"
+ android:ellipsize="end"
+ android:textAppearance="?android:attr/textAppearanceSmall"
+ android:paddingStart="?android:attr/listPreferredItemPaddingStart"
+ android:paddingLeft="?android:attr/listPreferredItemPaddingLeft"
+ android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
+ android:paddingRight="?android:attr/listPreferredItemPaddingRight"
+ tools:text="TEST \ntest2 \n3test"
+ android:visibility="gone"
+ tools:visibility="visible"
+ />
+ </LinearLayout>
+ </LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1px"
android:background="@android:color/darker_gray"
- android:layout_alignParentBottom="true"
/>
-</RelativeLayout>
+</LinearLayout>
diff --git a/app/src/main/res/layout-xlarge/v_switch_list_item.xml b/app/src/main/res/layout-xlarge/v_switch_list_item.xml
index f4c3e892..a24f5089 100644
--- a/app/src/main/res/layout-xlarge/v_switch_list_item.xml
+++ b/app/src/main/res/layout-xlarge/v_switch_list_item.xml
@@ -1,84 +1,88 @@
-<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/item_container"
android:layout_height="wrap_content"
android:layout_width="match_parent"
+ android:orientation="vertical"
>
+ <RelativeLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ >
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ android:layout_toStartOf="@+id/option_switch"
+ android:layout_toLeftOf="@+id/option_switch"
+ >
+ <androidx.appcompat.widget.AppCompatImageView
+ android:id="@+id/material_icon"
+ android:layout_width="?android:attr/listPreferredItemHeight"
+ android:layout_height="?android:attr/listPreferredItemHeight"
+ android:layout_gravity="center"
+ android:paddingStart="?android:attr/listPreferredItemPaddingStart"
+ android:paddingLeft="?android:attr/listPreferredItemPaddingLeft"
+ tools:src="@drawable/ic_add_circle_outline_grey600_24dp" />
- <androidx.appcompat.widget.AppCompatImageView
- android:id="@+id/material_icon"
- android:layout_width="?android:attr/listPreferredItemHeight"
- android:layout_height="?android:attr/listPreferredItemHeight"
- android:layout_gravity="center"
- android:layout_alignTop="@+id/textContainer"
- android:layout_alignBottom="@+id/textContainer"
- android:paddingStart="?android:attr/listPreferredItemPaddingStart"
- android:paddingLeft="?android:attr/listPreferredItemPaddingLeft"
- tools:src="@drawable/ic_add_circle_outline_grey600_24dp" />
+ <LinearLayout
+ android:id="@+id/textContainer"
+ android:orientation="vertical"
+ android:layout_gravity="center_vertical"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:paddingTop="@dimen/compact_padding"
+ android:paddingBottom="@dimen/compact_padding"
+ >
+ <androidx.appcompat.widget.AppCompatTextView
+ android:id="@+id/title"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:ellipsize="end"
+ android:singleLine="true"
+ android:gravity="center_vertical"
+ android:paddingStart="?android:attr/listPreferredItemPaddingStart"
+ android:paddingLeft="?android:attr/listPreferredItemPaddingLeft"
+ android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
+ android:paddingRight="?android:attr/listPreferredItemPaddingRight"
+ android:textAppearance="?android:attr/textAppearanceListItem"
+ tools:text=".,m.,m" />
- <LinearLayout
- android:id="@+id/textContainer"
- android:orientation="vertical"
- android:gravity="center_vertical"
- android:layout_toStartOf="@+id/option_switch"
- android:layout_toLeftOf="@+id/option_switch"
- android:layout_toEndOf="@id/material_icon"
- android:layout_toRightOf="@+id/material_icon"
- android:minHeight="?android:attr/listPreferredItemHeight"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content">
- <androidx.appcompat.widget.AppCompatTextView
- android:id="@+id/title"
+ <androidx.appcompat.widget.AppCompatTextView
+ android:id="@+id/subtitle"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:gravity="center_vertical"
+ android:paddingStart="?android:attr/listPreferredItemPaddingStart"
+ android:paddingLeft="?android:attr/listPreferredItemPaddingLeft"
+ android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
+ android:paddingRight="?android:attr/listPreferredItemPaddingRight"
+ android:textAppearance="?android:attr/textAppearanceSmall"
+ android:visibility="gone"
+ android:singleLine="false"
+ android:ellipsize="end"
+ tools:text="sdlfkjsdf"
+ tools:visibility="visible" />
+ </LinearLayout>
+ </LinearLayout>
+ <androidx.appcompat.widget.SwitchCompat
+ android:id="@+id/option_switch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:maxLines="1"
- android:ellipsize="end"
- android:gravity="center_vertical"
- android:paddingStart="?android:attr/listPreferredItemPaddingStart"
- android:paddingLeft="?android:attr/listPreferredItemPaddingLeft"
+ android:background="?android:attr/activatedBackgroundIndicator"
+ android:checked="false"
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
android:paddingRight="?android:attr/listPreferredItemPaddingRight"
android:textAppearance="?android:attr/textAppearanceListItem"
- tools:text=".,m.,msdflksdjflksjdflkjsdflksdlsdflkj lskjdf lkjsdf lkjsdf fsdls" />
-
- <androidx.appcompat.widget.AppCompatTextView
- android:id="@+id/subtitle"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:gravity="center_vertical"
- android:paddingStart="?android:attr/listPreferredItemPaddingStart"
- android:paddingLeft="?android:attr/listPreferredItemPaddingLeft"
- android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
- android:paddingRight="?android:attr/listPreferredItemPaddingRight"
- android:textAppearance="?android:attr/textAppearanceSmall"
- android:visibility="gone"
- tools:text="ldflkjdfglkjdfglksjdflksjdf lksjddf lkjsdfl kjlkjsdf lkjsdfl kjsdlfkj lkj sdflk lkjsdlfdkjsdlfkj "
- tools:visibility="visible" />
- </LinearLayout>
-
-
- <androidx.appcompat.widget.SwitchCompat
- android:id="@+id/option_switch"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_alignParentEnd="true"
- android:layout_alignParentRight="true"
- android:layout_alignTop="@id/textContainer"
- android:layout_alignBottom="@id/textContainer"
- android:background="?android:attr/activatedBackgroundIndicator"
- android:checked="false"
- android:gravity="center_vertical"
- android:paddingStart="?android:attr/listPreferredItemPaddingStart"
- android:paddingLeft="?android:attr/listPreferredItemPaddingLeft"
- android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
- android:paddingRight="?android:attr/listPreferredItemPaddingRight"
- android:textAppearance="?android:attr/textAppearanceListItem"
- tools:text="" />
-
+ android:visibility="visible"
+ android:layout_alignParentRight="true"
+ android:layout_alignParentEnd="true"
+ android:layout_centerVertical="true"
+ tools:text="" />
+ </RelativeLayout>
<View
android:layout_width="match_parent"
android:layout_height="1px"
android:background="@android:color/darker_gray"
- android:layout_alignBottom="@id/textContainer"
/>
-</RelativeLayout> \ No newline at end of file
+</LinearLayout> \ No newline at end of file
diff --git a/app/src/main/res/layout/v_icon_text_list_item.xml b/app/src/main/res/layout/v_icon_text_list_item.xml
index 06b70a2e..d183864d 100644
--- a/app/src/main/res/layout/v_icon_text_list_item.xml
+++ b/app/src/main/res/layout/v_icon_text_list_item.xml
@@ -1,62 +1,67 @@
-<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/item_container"
- android:layout_height="?android:attr/listPreferredItemHeightSmall"
+ android:layout_height="wrap_content"
android:layout_width="match_parent"
- android:orientation="horizontal"
+ android:orientation="vertical"
xmlns:tools="http://schemas.android.com/tools">
-
- <ImageView
- android:id="@+id/material_icon"
- android:layout_width="?android:attr/listPreferredItemHeightSmall"
- android:layout_height="?android:attr/listPreferredItemHeightSmall"
- android:layout_gravity="center"
- android:paddingStart="?android:attr/listPreferredItemPaddingStart"
- android:paddingLeft="?android:attr/listPreferredItemPaddingLeft"
- tools:src="@drawable/ic_add_circle_outline_grey600_24dp"
- />
- <androidx.appcompat.widget.AppCompatTextView
- android:id="@android:id/text1"
+ <LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:textAppearance="?android:attr/textAppearanceListItemSmall"
- android:gravity="center_vertical"
- android:maxLines="1"
- android:ellipsize="end"
- android:paddingStart="?android:attr/listPreferredItemPaddingStart"
- android:paddingLeft="?android:attr/listPreferredItemPaddingLeft"
- android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
- android:paddingRight="?android:attr/listPreferredItemPaddingRight"
- android:minHeight="?android:attr/listPreferredItemHeightSmall"
- tools:text="TEST"
- android:layout_toEndOf="@id/material_icon"
- android:layout_toRightOf="@+id/material_icon"
- android:layout_above="@+id/subtitle"
- />
+ android:orientation="horizontal">
+ <androidx.appcompat.widget.AppCompatImageView
+ android:id="@+id/material_icon"
+ android:layout_width="?android:attr/listPreferredItemHeightSmall"
+ android:layout_height="?android:attr/listPreferredItemHeightSmall"
+ android:layout_gravity="center"
+ android:paddingStart="?android:attr/listPreferredItemPaddingStart"
+ android:paddingLeft="?android:attr/listPreferredItemPaddingLeft"
+ tools:src="@drawable/ic_add_circle_outline_grey600_24dp"
+ />
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ android:layout_gravity="center_vertical"
+ android:paddingTop="@dimen/compact_padding"
+ android:paddingBottom="@dimen/compact_padding"
+ >
+ <androidx.appcompat.widget.AppCompatTextView
+ android:id="@android:id/text1"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:textAppearance="?android:attr/textAppearanceListItemSmall"
+ android:gravity="center_vertical"
+ android:maxLines="1"
+ android:ellipsize="end"
+ android:paddingStart="?android:attr/listPreferredItemPaddingStart"
+ android:paddingLeft="?android:attr/listPreferredItemPaddingLeft"
+ android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
+ android:paddingRight="?android:attr/listPreferredItemPaddingRight"
+ tools:text="TEST"
+ />
- <androidx.appcompat.widget.AppCompatTextView
- android:id="@+id/subtitle"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:gravity="center_vertical"
- android:maxLines="1"
- android:ellipsize="end"
- android:layout_alignParentBottom="true"
- android:textAppearance="?android:attr/textAppearanceSmall"
- android:paddingStart="?android:attr/listPreferredItemPaddingStart"
- android:paddingLeft="?android:attr/listPreferredItemPaddingLeft"
- android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
- android:paddingRight="?android:attr/listPreferredItemPaddingRight"
- android:paddingBottom="4dp"
- tools:text="TEST"
- android:visibility="gone"
- android:layout_toEndOf="@id/material_icon"
- android:layout_toRightOf="@+id/material_icon"
- />
+ <androidx.appcompat.widget.AppCompatTextView
+ android:id="@+id/subtitle"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:gravity="center_vertical"
+ android:singleLine="false"
+ android:ellipsize="end"
+ android:textAppearance="?android:attr/textAppearanceSmall"
+ android:paddingStart="?android:attr/listPreferredItemPaddingStart"
+ android:paddingLeft="?android:attr/listPreferredItemPaddingLeft"
+ android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
+ android:paddingRight="?android:attr/listPreferredItemPaddingRight"
+ tools:text="some more text \n sdflksdfd"
+ android:visibility="gone"
+ tools:visibility="visible"
+ />
+ </LinearLayout>
+ </LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1px"
android:background="@android:color/darker_gray"
- android:layout_alignParentBottom="true"
/>
-</RelativeLayout>
+</LinearLayout>
diff --git a/app/src/main/res/layout/v_switch_list_item.xml b/app/src/main/res/layout/v_switch_list_item.xml
index 5bd4de1b..3ba37b81 100644
--- a/app/src/main/res/layout/v_switch_list_item.xml
+++ b/app/src/main/res/layout/v_switch_list_item.xml
@@ -1,85 +1,89 @@
-<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/item_container"
android:layout_height="wrap_content"
android:layout_width="match_parent"
+ android:orientation="vertical"
>
+ <RelativeLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ >
- <androidx.appcompat.widget.AppCompatImageView
- android:id="@+id/material_icon"
- android:layout_width="?android:attr/listPreferredItemHeightSmall"
- android:layout_height="?android:attr/listPreferredItemHeightSmall"
- android:layout_gravity="center"
- android:layout_alignTop="@+id/textContainer"
- android:layout_alignBottom="@+id/textContainer"
- android:paddingStart="?android:attr/listPreferredItemPaddingStart"
- android:paddingLeft="?android:attr/listPreferredItemPaddingLeft"
- tools:src="@drawable/ic_add_circle_outline_grey600_24dp" />
-
- <LinearLayout
- android:id="@+id/textContainer"
- android:orientation="vertical"
- android:gravity="center_vertical"
- android:layout_toStartOf="@+id/option_switch"
- android:layout_toLeftOf="@+id/option_switch"
- android:layout_toEndOf="@id/material_icon"
- android:layout_toRightOf="@+id/material_icon"
- android:minHeight="?android:attr/listPreferredItemHeightSmall"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content">
- <androidx.appcompat.widget.AppCompatTextView
- android:id="@+id/title"
- android:layout_width="wrap_content"
+ <LinearLayout
+ android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:ellipsize="end"
- android:singleLine="true"
- android:gravity="center_vertical"
- android:paddingStart="?android:attr/listPreferredItemPaddingStart"
- android:paddingLeft="?android:attr/listPreferredItemPaddingLeft"
- android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
- android:paddingRight="?android:attr/listPreferredItemPaddingRight"
- android:textAppearance="?android:attr/textAppearanceListItemSmall"
- tools:text=".,m.,msdflksdjflksjdflkjsdflksdlsdflkj lskjdf lkjsdf lkjsdf fsdls" />
+ android:orientation="horizontal"
+ android:layout_toStartOf="@+id/option_switch"
+ android:layout_toLeftOf="@+id/option_switch"
+ >
+ <androidx.appcompat.widget.AppCompatImageView
+ android:id="@+id/material_icon"
+ android:layout_width="?android:attr/listPreferredItemHeightSmall"
+ android:layout_height="?android:attr/listPreferredItemHeightSmall"
+ android:layout_gravity="center"
+ android:paddingStart="?android:attr/listPreferredItemPaddingStart"
+ android:paddingLeft="?android:attr/listPreferredItemPaddingLeft"
+ tools:src="@drawable/ic_add_circle_outline_grey600_24dp" />
- <androidx.appcompat.widget.AppCompatTextView
- android:id="@+id/subtitle"
+ <LinearLayout
+ android:id="@+id/textContainer"
+ android:orientation="vertical"
+ android:layout_gravity="center_vertical"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:paddingTop="@dimen/compact_padding"
+ android:paddingBottom="@dimen/compact_padding"
+ >
+ <androidx.appcompat.widget.AppCompatTextView
+ android:id="@+id/title"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:ellipsize="end"
+ android:singleLine="true"
+ android:gravity="center_vertical"
+ android:paddingStart="?android:attr/listPreferredItemPaddingStart"
+ android:paddingLeft="?android:attr/listPreferredItemPaddingLeft"
+ android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
+ android:paddingRight="?android:attr/listPreferredItemPaddingRight"
+ android:textAppearance="?android:attr/textAppearanceListItemSmall"
+ tools:text="Test" />
+
+ <androidx.appcompat.widget.AppCompatTextView
+ android:id="@+id/subtitle"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:gravity="center_vertical"
+ android:paddingStart="?android:attr/listPreferredItemPaddingStart"
+ android:paddingLeft="?android:attr/listPreferredItemPaddingLeft"
+ android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
+ android:paddingRight="?android:attr/listPreferredItemPaddingRight"
+ android:textAppearance="?android:attr/textAppearanceSmall"
+ android:visibility="gone"
+ android:singleLine="false"
+ android:ellipsize="end"
+ tools:text="sdlfkjsdf \n lksdfj \lksjflksdjf "
+ tools:visibility="visible" />
+ </LinearLayout>
+ </LinearLayout>
+ <androidx.appcompat.widget.SwitchCompat
+ android:id="@+id/option_switch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:gravity="center_vertical"
- android:paddingStart="?android:attr/listPreferredItemPaddingStart"
- android:paddingLeft="?android:attr/listPreferredItemPaddingLeft"
+ android:background="?android:attr/activatedBackgroundIndicator"
+ android:checked="false"
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
android:paddingRight="?android:attr/listPreferredItemPaddingRight"
- android:paddingBottom="2dp"
- android:textAppearance="?android:attr/textAppearanceSmall"
- android:visibility="gone"
- android:singleLine="true"
- android:ellipsize="end"
- tools:text="sdlfkjsdf lksdjdf lkj sdldfk jlkj sdf lkj lskdjf sedflkjsdlfjk"
- tools:visibility="visible" />
- </LinearLayout>
-
-
- <androidx.appcompat.widget.SwitchCompat
- android:id="@+id/option_switch"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_alignParentEnd="true"
- android:layout_alignParentRight="true"
- android:layout_alignTop="@id/textContainer"
- android:layout_alignBottom="@id/textContainer"
- android:background="?android:attr/activatedBackgroundIndicator"
- android:checked="false"
- android:gravity="center_vertical"
- android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
- android:paddingRight="?android:attr/listPreferredItemPaddingRight"
- android:textAppearance="?android:attr/textAppearanceListItemSmall"
- tools:text="" />
-
+ android:textAppearance="?android:attr/textAppearanceListItemSmall"
+ android:visibility="visible"
+ android:layout_alignParentRight="true"
+ android:layout_alignParentEnd="true"
+ android:layout_centerVertical="true"
+ tools:text="" />
+ </RelativeLayout>
<View
android:layout_width="match_parent"
android:layout_height="1px"
android:background="@android:color/darker_gray"
- android:layout_alignBottom="@id/textContainer"
/>
-</RelativeLayout> \ No newline at end of file
+</LinearLayout> \ No newline at end of file
diff --git a/app/src/main/res/values/attrs.xml b/app/src/main/res/values/attrs.xml
index d3a88b81..5631e3f3 100644
--- a/app/src/main/res/values/attrs.xml
+++ b/app/src/main/res/values/attrs.xml
@@ -8,15 +8,18 @@
<attr name="text" format="string|reference"/>
<attr name="icon" format="reference"/>
<attr name="subtitle" format="string|reference"/>
+ <attr name="singleLine" format="boolean"/>
<declare-styleable name="IconSwitchEntry">
<attr name="text"/>
<attr name="subtitle" />
<attr name="icon"/>
+ <attr name="singleLine"/>
</declare-styleable>
<declare-styleable name="IconTextEntry">
<attr name="text"/>
<attr name="subtitle" />
<attr name="icon"/>
+ <attr name="singleLine"/>
</declare-styleable>
</resources> \ No newline at end of file