New fresh look for CustomSeekbar
Oreo prefs style thanks @Mazda-- for suggestion on how to remove the top divider Signed-off-by: xyyx <xyyx@mail.ru>
This commit is contained in:
@@ -14,14 +14,37 @@
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:minHeight="?android:attr/listPreferredItemHeight"
|
android:minHeight="?android:attr/listPreferredItemHeightSmall"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
|
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
|
||||||
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
|
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
|
||||||
android:clickable="false" >
|
android:clickable="false"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/text_container"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:minWidth="44dp"
|
||||||
|
android:gravity="start|center_vertical"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:paddingEnd="12dp"
|
||||||
|
android:paddingTop="4dp"
|
||||||
|
android:paddingBottom="4dp">
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/seekBarPrefValue"
|
||||||
|
android:layout_width="24dp"
|
||||||
|
android:layout_height="24dp"
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:textAppearance="@android:style/TextAppearance.Material.Body1"
|
||||||
|
android:textColor="?android:attr/textColorSecondary"/>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@@ -31,46 +54,39 @@
|
|||||||
android:layout_marginBottom="8dip">
|
android:layout_marginBottom="8dip">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
<TextView android:id="@android:id/title"
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:id="@android:id/title"
|
||||||
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
|
android:paddingStart="16dp"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
android:textAppearance="@android:style/TextAppearance.Material.Subhead"
|
android:textAppearance="@android:style/TextAppearance.Material.Subhead"
|
||||||
android:textColor="?android:attr/textColorPrimary"
|
android:textColor="?android:attr/textColorPrimary"
|
||||||
android:ellipsize="marquee"
|
android:ellipsize="marquee"
|
||||||
android:fadingEdge="horizontal" />
|
android:fadingEdge="horizontal"/>
|
||||||
<!-- Preference should place its actual preference widget here. -->
|
<!-- Preference should place its actual preference widget here. -->
|
||||||
<LinearLayout android:id="@android:id/widget_frame"
|
<LinearLayout
|
||||||
|
android:id="@android:id/widget_frame"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:gravity="end|center_vertical"
|
android:gravity="end|center_vertical"
|
||||||
android:paddingStart="16dp"
|
android:paddingStart="16dp"
|
||||||
android:orientation="vertical" />
|
android:orientation="vertical"/>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<RelativeLayout
|
<FrameLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="6dp">
|
android:layout_marginTop="6dp">
|
||||||
|
|
||||||
<TextView android:id="@+id/seekBarPrefValue"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_centerInParent="true"
|
|
||||||
android:layout_alignParentRight="true"
|
|
||||||
android:textAppearance="@android:style/TextAppearance.Material.Body1"
|
|
||||||
android:textColor="?android:attr/textColorSecondary" />
|
|
||||||
|
|
||||||
<LinearLayout android:id="@+id/seekBarPrefBarContainer"
|
<LinearLayout android:id="@+id/seekBarPrefBarContainer"
|
||||||
android:layout_centerInParent="true"
|
android:layout_gravity="center_vertical"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content" />
|
||||||
android:layout_toLeftOf="@id/seekBarPrefValue" />
|
</FrameLayout>
|
||||||
</RelativeLayout>
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</FrameLayout>
|
</LinearLayout>
|
||||||
|
|||||||
@@ -135,6 +135,9 @@ public class CustomSeekBarPreference extends Preference implements SeekBar.OnSee
|
|||||||
mStatusText.setMinimumWidth(30);
|
mStatusText.setMinimumWidth(30);
|
||||||
mSeekBar.setProgress(mCurrentValue - mMin);
|
mSeekBar.setProgress(mCurrentValue - mMin);
|
||||||
mTitle = (TextView) view.findViewById(android.R.id.title);
|
mTitle = (TextView) view.findViewById(android.R.id.title);
|
||||||
|
|
||||||
|
view.setDividerAllowedAbove(false);
|
||||||
|
//view.setDividerAllowedBelow(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMax(int max) {
|
public void setMax(int max) {
|
||||||
|
|||||||
Reference in New Issue
Block a user