Fixed battery tips card UI.
- Add highlight effect after navigate to new page. - Update text format inside button. Screenshot: https://screenshot.googleplex.com/8ib66dWzn6PZmhy Fix: 296001546 Fix: 296339767 Bug: 291689623 Test: manual Change-Id: Ic789e5feb684a109582477c553963a9a3f9936b8
This commit is contained in:
@@ -18,6 +18,7 @@ package com.android.settings.fuelgauge.batteryusage;
|
||||
|
||||
import android.app.settings.SettingsEnums;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
@@ -30,6 +31,7 @@ import androidx.preference.Preference;
|
||||
import androidx.preference.PreferenceViewHolder;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.SettingsActivity;
|
||||
import com.android.settings.core.SubSettingLauncher;
|
||||
import com.android.settings.fuelgauge.PowerUsageFeatureProvider;
|
||||
import com.android.settings.overlay.FeatureFactory;
|
||||
@@ -56,6 +58,8 @@ public class BatteryTipsCardPreference extends Preference implements View.OnClic
|
||||
@VisibleForTesting
|
||||
String mDestinationComponentName;
|
||||
@VisibleForTesting
|
||||
String mPreferenceHighlightKey;
|
||||
@VisibleForTesting
|
||||
Integer mSourceMetricsCategory;
|
||||
|
||||
public BatteryTipsCardPreference(Context context, AttributeSet attrs) {
|
||||
@@ -98,9 +102,10 @@ public class BatteryTipsCardPreference extends Preference implements View.OnClic
|
||||
* Sets the info of target fragment launched by main button.
|
||||
*/
|
||||
public void setMainButtonLauncherInfo(final String destinationClassName,
|
||||
final Integer sourceMetricsCategory) {
|
||||
final Integer sourceMetricsCategory, final String highlightKey) {
|
||||
mDestinationComponentName = destinationClassName;
|
||||
mSourceMetricsCategory = sourceMetricsCategory;
|
||||
mPreferenceHighlightKey = highlightKey;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -110,9 +115,16 @@ public class BatteryTipsCardPreference extends Preference implements View.OnClic
|
||||
if (TextUtils.isEmpty(mDestinationComponentName)) {
|
||||
return;
|
||||
}
|
||||
Bundle arguments = Bundle.EMPTY;
|
||||
if (!TextUtils.isEmpty(mPreferenceHighlightKey)) {
|
||||
arguments = new Bundle(1);
|
||||
arguments.putString(SettingsActivity.EXTRA_FRAGMENT_ARG_KEY,
|
||||
mPreferenceHighlightKey);
|
||||
}
|
||||
new SubSettingLauncher(getContext())
|
||||
.setDestination(mDestinationComponentName)
|
||||
.setSourceMetricsCategory(mSourceMetricsCategory)
|
||||
.setArguments(arguments)
|
||||
.launch();
|
||||
setVisible(false);
|
||||
mMetricsFeatureProvider.action(
|
||||
|
||||
Reference in New Issue
Block a user