Add separator to preferences

This commit is contained in:
Moez Bhatti
2017-12-17 16:38:38 -05:00
parent 75f5a7b813
commit 9db72e7c0a
2 changed files with 35 additions and 21 deletions
@@ -26,6 +26,7 @@ class PreferenceView @JvmOverloads constructor(context: Context, attrs: Attribut
init { init {
View.inflate(context, R.layout.preference_view, this) View.inflate(context, R.layout.preference_view, this)
setBackgroundResource(R.drawable.ripple) setBackgroundResource(R.drawable.ripple)
orientation = VERTICAL
context.obtainStyledAttributes(attrs, R.styleable.PreferenceView)?.run { context.obtainStyledAttributes(attrs, R.styleable.PreferenceView)?.run {
title = getString(R.styleable.PreferenceView_title) title = getString(R.styleable.PreferenceView_title)
+34 -21
View File
@@ -3,36 +3,49 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="center_vertical" android:orientation="vertical"
tools:parentTag="com.moez.QKSMS.presentation.common.widget.PreferenceView"> tools:parentTag="com.moez.QKSMS.presentation.common.widget.PreferenceView">
<LinearLayout <LinearLayout
android:layout_width="0dp" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:baselineAligned="false"
android:orientation="vertical" android:gravity="center_vertical"
android:padding="16dp"> android:orientation="horizontal">
<com.moez.QKSMS.presentation.common.widget.QkTextView <LinearLayout
android:id="@+id/titleView" android:layout_width="0dp"
style="@style/TextPrimary"
android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
tools:text="Default SMS App" /> android:layout_weight="1"
android:orientation="vertical"
android:padding="16dp">
<com.moez.QKSMS.presentation.common.widget.QkTextView <com.moez.QKSMS.presentation.common.widget.QkTextView
android:id="@+id/summaryView" android:id="@+id/titleView"
style="@style/TextSecondary" style="@style/TextPrimary"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
tools:text="QKSMS is your default SMS app" /> tools:text="Default SMS App" />
<com.moez.QKSMS.presentation.common.widget.QkTextView
android:id="@+id/summaryView"
style="@style/TextSecondary"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:text="QKSMS is your default SMS app" />
</LinearLayout>
<FrameLayout
android:id="@+id/widgetFrame"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginRight="16dp" />
</LinearLayout> </LinearLayout>
<FrameLayout <com.moez.QKSMS.presentation.common.widget.Separator
android:id="@+id/widgetFrame" android:layout_width="match_parent"
android:layout_width="wrap_content" android:layout_height="1dp" />
android:layout_height="match_parent"
android:layout_marginRight="16dp" />
</merge> </merge>