Implement the battery tips cards.(1/2)
- Implement a tips card UI in Battery Usage. [Screenshot]: - Tips Card with thumbs-up/down feedback in dark mode https://screenshot.googleplex.com/3nRCFYvLTWfiYYT - Tips Card without feedback https://screenshot.googleplex.com/B7QGRJZAHzgWpCP - Tips Card in Force RTL layout https://screenshot.googleplex.com/8crQdj8ao26pKpH - Tips Card in light mode https://screenshot.googleplex.com/885aVvZm8xmhK2S [TODO]: - Add accessibility - Localization Bug: 291689623 Test: Manual Change-Id: I4443cdb21b3ba30900fc2f6fcc21c4c56dc1293f Merged-In: I4443cdb21b3ba30900fc2f6fcc21c4c56dc1293f
This commit is contained in:
@@ -98,6 +98,20 @@ public class BatteryChartPreferenceController extends AbstractPreferenceControll
|
||||
void onScreenOnTimeUpdated(Long screenOnTime, String slotTimestamp);
|
||||
}
|
||||
|
||||
/**
|
||||
* A callback listener for the battery tips card is updated.
|
||||
* This happens when battery tips card is ready.
|
||||
*/
|
||||
public interface OnBatteryTipsUpdatedListener {
|
||||
/**
|
||||
* The callback function for the battery tips card is updated.
|
||||
* @param title the title of the battery tip card
|
||||
* @param summary the summary of the battery tip card
|
||||
*/
|
||||
void onBatteryTipsUpdated(String title, String summary);
|
||||
}
|
||||
|
||||
|
||||
@VisibleForTesting
|
||||
Context mPrefContext;
|
||||
@VisibleForTesting
|
||||
@@ -119,6 +133,7 @@ public class BatteryChartPreferenceController extends AbstractPreferenceControll
|
||||
private List<BatteryChartViewModel> mHourlyViewModels;
|
||||
private OnBatteryUsageUpdatedListener mOnBatteryUsageUpdatedListener;
|
||||
private OnScreenOnTimeUpdatedListener mOnScreenOnTimeUpdatedListener;
|
||||
private OnBatteryTipsUpdatedListener mOnBatteryTipsUpdatedListener;
|
||||
|
||||
private final SettingsActivity mActivity;
|
||||
private final MetricsFeatureProvider mMetricsFeatureProvider;
|
||||
@@ -209,6 +224,10 @@ public class BatteryChartPreferenceController extends AbstractPreferenceControll
|
||||
mOnScreenOnTimeUpdatedListener = listener;
|
||||
}
|
||||
|
||||
void setOnBatteryTipsUpdatedListener(OnBatteryTipsUpdatedListener listener) {
|
||||
mOnBatteryTipsUpdatedListener = listener;
|
||||
}
|
||||
|
||||
void setBatteryHistoryMap(
|
||||
final Map<Long, Map<String, BatteryHistEntry>> batteryHistoryMap) {
|
||||
Log.d(TAG, "setBatteryHistoryMap() " + (batteryHistoryMap == null ? "null"
|
||||
@@ -344,6 +363,10 @@ public class BatteryChartPreferenceController extends AbstractPreferenceControll
|
||||
}
|
||||
mOnBatteryUsageUpdatedListener.onBatteryUsageUpdated(
|
||||
slotUsageData, getSlotInformation(), isBatteryUsageMapNullOrEmpty());
|
||||
|
||||
if (mOnBatteryTipsUpdatedListener != null) {
|
||||
mOnBatteryTipsUpdatedListener.onBatteryTipsUpdated(null, null);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
Reference in New Issue
Block a user