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

Commit 62fafeb6 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Refine Spinner style in Mobile data usage settings" into main

parents 235f62a5 a5a44f32
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -26,7 +26,8 @@
        android:layout_height="wrap_content"
        android:layout_width="wrap_content"
        android:layout_centerHorizontal="true"
        android:theme="@style/Widget.PopupWindow.Settings"/>
        android:theme="@style/Widget.PopupWindow.Settings"
        android:dropDownVerticalOffset="@dimen/min_tap_target_size"/>

    <ImageView
        android:id="@+id/filter_settings"
+2 −1
Original line number Diff line number Diff line
@@ -24,7 +24,8 @@
        android:id="@+id/cycles_spinner"
        android:layout_height="wrap_content"
        android:layout_width="wrap_content"
        android:layout_centerInParent="true"/>
        android:layout_centerInParent="true"
        android:dropDownVerticalOffset="@dimen/min_tap_target_size"/>

</RelativeLayout>
+15 −0
Original line number Diff line number Diff line
@@ -15,6 +15,12 @@ package com.android.settings.datausage;

import android.content.Context;
import android.util.Range;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Spinner;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.android.settings.Utils;
import com.android.settingslib.widget.SettingsSpinnerAdapter;
@@ -31,6 +37,15 @@ public class CycleAdapter extends SettingsSpinnerAdapter<CycleAdapter.CycleItem>
        mSpinner.setAdapter(this);
    }

    @Override
    public View getDropDownView(int position, @Nullable View convertView,
            @NonNull ViewGroup parent) {
        if (parent instanceof Spinner) {
            setSelectedPosition(((Spinner) parent).getSelectedItemPosition());
        }
        return super.getDropDownView(position, convertView, parent);
    }

    /**
     * Find position of {@link CycleItem} in this adapter which is nearest
     * the given {@link CycleItem}.