Merge "Polish some behaviors of the battery saver schedule screen"
This commit is contained in:
committed by
Android (Google) Code Review
commit
0c388c5f4e
@@ -54,9 +54,11 @@ public class BatterySaverScheduleSeekBarController implements
|
||||
mContext = context;
|
||||
mSeekBarPreference = new SeekBarPreference(context);
|
||||
mSeekBarPreference.setOnPreferenceChangeListener(this);
|
||||
mSeekBarPreference.setMax(BatterySaverScheduleSeekBarController.MAX_SEEKBAR_VALUE);
|
||||
mSeekBarPreference.setMin(BatterySaverScheduleSeekBarController.MIN_SEEKBAR_VALUE);
|
||||
mSeekBarPreference.setContinuousUpdates(true);
|
||||
mSeekBarPreference.setMax(MAX_SEEKBAR_VALUE);
|
||||
mSeekBarPreference.setMin(MIN_SEEKBAR_VALUE);
|
||||
mSeekBarPreference.setKey(KEY_BATTERY_SAVER_SEEK_BAR);
|
||||
updateSeekBar();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -83,11 +85,12 @@ public class BatterySaverScheduleSeekBarController implements
|
||||
if (threshold <= 0) {
|
||||
mSeekBarPreference.setVisible(false);
|
||||
} else {
|
||||
final int currentSeekbarValue = Math.max(threshold / 5, MIN_SEEKBAR_VALUE);
|
||||
mSeekBarPreference.setVisible(true);
|
||||
mSeekBarPreference.setProgress(MIN_SEEKBAR_VALUE);
|
||||
mSeekBarPreference.setProgress(currentSeekbarValue);
|
||||
mSeekBarPreference.setTitle(mContext.getString(
|
||||
R.string.battery_saver_seekbar_title,
|
||||
Utils.formatPercentage(MIN_SEEKBAR_VALUE * 5)));
|
||||
Utils.formatPercentage(currentSeekbarValue * 5)));
|
||||
}
|
||||
} else {
|
||||
mSeekBarPreference.setVisible(false);
|
||||
|
@@ -17,10 +17,14 @@
|
||||
package com.android.settings.fuelgauge.batterysaver;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.preference.PreferenceScreen;
|
||||
import com.android.settings.widget.RadioButtonPickerFragment;
|
||||
import com.android.settings.R;
|
||||
@@ -58,6 +62,13 @@ public class BatterySaverScheduleSettings extends RadioButtonPickerFragment {
|
||||
context, mSeekBarController);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
setDivider(new ColorDrawable(Color.TRANSPARENT));
|
||||
setDividerHeight(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
Reference in New Issue
Block a user