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

Commit b02e7838 authored by Edgar Wang's avatar Edgar Wang Committed by Automerger Merge Worker
Browse files

Merge "Fine tune Spinner style" into tm-dev am: e5ee7aa2 am: f39e0145

parents 9fb2ddf7 f39e0145
Loading
Loading
Loading
Loading
+0 −0

File moved.

+1 −1
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
     Copyright (C) 2018 The Android Open Source Project
     Copyright (C) 2022 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.
+1 −0
Original line number Diff line number Diff line
@@ -16,5 +16,6 @@

<resources>
    <dimen name="spinner_height">36dp</dimen>
    <dimen name="spinner_dropdown_height">48dp</dimen>
    <dimen name="spinner_padding_top_or_bottom">8dp</dimen>
</resources>
+1 −1
Original line number Diff line number Diff line
@@ -35,7 +35,7 @@
        <item name="android:textColor">@color/settingslib_spinner_dropdown_color</item>
        <item name="android:maxLines">1</item>
        <item name="android:ellipsize">marquee</item>
        <item name="android:minHeight">@dimen/spinner_height</item>
        <item name="android:minHeight">@dimen/spinner_dropdown_height</item>
        <item name="android:paddingStart">16dp</item>
        <item name="android:paddingEnd">36dp</item>
        <item name="android:paddingTop">@dimen/spinner_padding_top_or_bottom</item>
+8 −4
Original line number Diff line number Diff line
@@ -41,7 +41,7 @@ public class SettingsSpinnerAdapter<T> extends ArrayAdapter<T> {
     *                access the current theme, resources, etc.
     */
    public SettingsSpinnerAdapter(Context context) {
        super(context, DEFAULT_RESOURCE);
        super(context, getDefaultResource());

        setDropDownViewResource(getDropdownResource());
        mDefaultInflater = LayoutInflater.from(context);
@@ -51,7 +51,7 @@ public class SettingsSpinnerAdapter<T> extends ArrayAdapter<T> {
     * In overridded {@link #getView(int, View, ViewGroup)}, use this method to get default view.
     */
    public View getDefaultView(int position, View convertView, ViewGroup parent) {
        return mDefaultInflater.inflate(DEFAULT_RESOURCE, parent, false /* attachToRoot */);
        return mDefaultInflater.inflate(getDefaultResource(), parent, false /* attachToRoot */);
    }

    /**
@@ -62,8 +62,12 @@ public class SettingsSpinnerAdapter<T> extends ArrayAdapter<T> {
        return mDefaultInflater.inflate(getDropdownResource(), parent, false /* attachToRoot */);
    }

    private int getDropdownResource() {
        return (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S)
    private static int getDefaultResource() {
        return (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU)
                ? DEFAULT_RESOURCE : android.R.layout.simple_spinner_dropdown_item;
    }
    private static int getDropdownResource() {
        return (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU)
                ? DFAULT_DROPDOWN_RESOURCE : android.R.layout.simple_spinner_dropdown_item;
    }
}
Loading