Files
app_Settings/src/com/android/settings/fuelgauge/batteryusage/TextViewPreference.java
mxyyiyi 45ac3f280d [Expressive Battery] Update screen on time text preference style.
For expressive style:
- Update the enlarge font size
- Remove the background

Bug: 349652542
Test: visual
Flag: com.android.settingslib.widget.theme.flags.is_expressive_design_enabled
Change-Id: If85d2903eec6d1f7c3b58e71daef2409325ac83d
2025-02-06 16:00:10 +08:00

52 lines
1.7 KiB
Java

/*
* Copyright (C) 2023 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.
*/
package com.android.settings.fuelgauge.batteryusage;
import android.content.Context;
import android.util.AttributeSet;
import android.widget.TextView;
import androidx.preference.Preference;
import androidx.preference.PreferenceViewHolder;
import com.android.internal.annotations.VisibleForTesting;
import com.android.settings.R;
import com.android.settingslib.widget.GroupSectionDividerMixin;
/** A preference for a single text view. */
public class TextViewPreference extends Preference implements GroupSectionDividerMixin {
private static final String TAG = "TextViewPreference";
@VisibleForTesting CharSequence mText;
public TextViewPreference(Context context, AttributeSet attrs) {
super(context, attrs);
setLayoutResource(R.layout.preference_text_view);
}
@Override
public void onBindViewHolder(PreferenceViewHolder view) {
final TextView textView = (TextView) view.findViewById(R.id.text);
textView.setText(mText);
}
void setText(CharSequence text) {
mText = text;
notifyChanged();
}
}