Merge "Tweak SettingsSpinner UI" into sc-dev
This commit is contained in:
@@ -16,11 +16,11 @@
|
||||
-->
|
||||
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24"
|
||||
android:viewportWidth="18"
|
||||
android:viewportHeight="18"
|
||||
android:width="24dp"
|
||||
android:height="24dp">
|
||||
<path
|
||||
android:pathData="M7 10l5 5 5 -5z"
|
||||
android:fillColor="?android:attr/textColorPrimary"/>
|
||||
</vector>
|
||||
android:fillColor="@android:color/black"/>
|
||||
</vector>
|
||||
@@ -24,21 +24,21 @@
|
||||
android:bottom="8dp">
|
||||
<shape>
|
||||
<corners
|
||||
android:radius="20dp"/>
|
||||
android:radius="28dp"/>
|
||||
<solid
|
||||
android:color="?android:attr/colorPrimary"/>
|
||||
android:color="?android:attr/colorAccent"/>
|
||||
<stroke
|
||||
android:color="#1f000000"
|
||||
android:color="?android:attr/colorPrimary"
|
||||
android:width="1dp"/>
|
||||
<size
|
||||
android:height="32dp"/>
|
||||
android:height="@dimen/spinner_height"/>
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
<item
|
||||
android:gravity="center|end"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:end="4dp"
|
||||
android:drawable="@drawable/arrow_drop_down_24dp"/>
|
||||
android:width="18dp"
|
||||
android:height="18dp"
|
||||
android:end="8dp"
|
||||
android:drawable="@drawable/arrow_drop_down"/>
|
||||
</layer-list>
|
||||
@@ -0,0 +1,33 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2021 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.
|
||||
-->
|
||||
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item>
|
||||
<shape>
|
||||
<solid
|
||||
android:color="?android:attr/colorAccent"/>
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<shape>
|
||||
<solid android:color="#BBFFFFFF"/>
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
</layer-list>
|
||||
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2021 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.
|
||||
-->
|
||||
|
||||
<TextView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@android:id/text1"
|
||||
style="@style/SettingsSpinnerTitleBar"
|
||||
android:gravity="center_vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/settings_spinner_dropdown_background"/>
|
||||
@@ -19,7 +19,5 @@
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@android:id/text1"
|
||||
style="@style/SettingsSpinnerTitleBar"
|
||||
android:maxLines="1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="marquee"/>
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
20
packages/SettingsLib/SettingsSpinner/res/values/dimens.xml
Normal file
20
packages/SettingsLib/SettingsSpinner/res/values/dimens.xml
Normal file
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2021 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.
|
||||
-->
|
||||
|
||||
<resources>
|
||||
<dimen name="spinner_height">36dp</dimen>
|
||||
<dimen name="spinner_padding_top_or_bottom">8dp</dimen>
|
||||
</resources>
|
||||
@@ -18,9 +18,13 @@
|
||||
<resources>
|
||||
<style name="SettingsSpinnerTitleBar">
|
||||
<item name="android:textAppearance">?android:attr/textAppearanceButton</item>
|
||||
<item name="android:textColor">@android:color/black</item>
|
||||
<item name="android:maxLines">1</item>
|
||||
<item name="android:ellipsize">marquee</item>
|
||||
<item name="android:minHeight">@dimen/spinner_height</item>
|
||||
<item name="android:paddingStart">16dp</item>
|
||||
<item name="android:paddingEnd">36dp</item>
|
||||
<item name="android:paddingTop">8dp</item>
|
||||
<item name="android:paddingBottom">8dp</item>
|
||||
<item name="android:paddingTop">@dimen/spinner_padding_top_or_bottom</item>
|
||||
<item name="android:paddingBottom">@dimen/spinner_padding_top_or_bottom</item>
|
||||
</style>
|
||||
</resources>
|
||||
</resources>
|
||||
|
||||
@@ -121,4 +121,11 @@ public class SettingsSpinner extends Spinner {
|
||||
int mode) {
|
||||
super(context, attrs, defStyleAttr, defStyleRes, mode, null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
|
||||
setDropDownVerticalOffset(getMeasuredHeight() - (int) getContext().getResources()
|
||||
.getDimension(R.dimen.spinner_padding_top_or_bottom));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,8 +30,7 @@ import com.android.settingslib.widget.R;
|
||||
public class SettingsSpinnerAdapter<T> extends ArrayAdapter<T> {
|
||||
|
||||
private static final int DEFAULT_RESOURCE = R.layout.settings_spinner_view;
|
||||
private static final int DFAULT_DROPDOWN_RESOURCE =
|
||||
android.R.layout.simple_spinner_dropdown_item;
|
||||
private static final int DFAULT_DROPDOWN_RESOURCE = R.layout.settings_spinner_dropdown_view;
|
||||
private final LayoutInflater mDefaultInflater;
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user