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

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

Merge "Allow set start/end text programmatically" into main

parents 3a444aad d449c5b9
Loading
Loading
Loading
Loading
+24 −2
Original line number Diff line number Diff line
@@ -35,6 +35,7 @@ import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.StringRes;
import androidx.preference.Preference;
import androidx.preference.PreferenceViewHolder;

@@ -52,8 +53,8 @@ public class SliderPreference extends Preference {
    public static final int HAPTIC_FEEDBACK_MODE_ON_TICKS = 1;
    public static final int HAPTIC_FEEDBACK_MODE_ON_ENDS = 2;

    private final int mTextStartId;
    private final int mTextEndId;
    private int mTextStartId;
    private int mTextEndId;
    private final ColorStateList mTrackActiveColor;
    private final ColorStateList mTrackInactiveColor;
    private final ColorStateList mThumbColor;
@@ -317,6 +318,27 @@ public class SliderPreference extends Preference {
        }
    }


    /**
     * Sets the text for the start of the slider.
     */
    public void setTextStart(@StringRes int textStartId) {
        if (mTextStartId != textStartId) {
            mTextStartId = textStartId;
            notifyChanged();
        }
    }

    /**
     * Sets the text for the end of the slider.
     */
    public void setTextEnd(@StringRes int textEndId) {
        if (mTextEndId != textEndId) {
            mTextEndId = textEndId;
            notifyChanged();
        }
    }

    @Override
    public void onBindViewHolder(@NonNull PreferenceViewHolder holder) {
        super.onBindViewHolder(holder);