Add infra for battery tip
This cl adds the basic structure for battery tip: 1. BaseBatteryTip: Model class to represent the tip and build preference and dialog 2. SummaryTip: Display a general battery summary(i.e. your battery is good..) 3. BatteryTipLoader: AsyncLoader to load the battery tips. 4. BatteryTipPreferenceController: preference controller for preference group to display battery tips This cl also: 1. Remove the anomaly code in PowerUsageSummary and we will add it to app restriction in future. 2. Add preference_category_no_title.xml to avoid the extra 32dp blank at the top. Bug: 70570352 Test: RunSettingsRoboTests Change-Id: If91a553888e2eb91d55fb1d0d7bbea69652f144c
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* Copyright (C) 2017 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.batterytip.tips;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
|
||||
import com.android.settings.R;
|
||||
|
||||
/**
|
||||
* Tip to show general summary about battery life
|
||||
*/
|
||||
public class SummaryTip extends BatteryTip {
|
||||
|
||||
public SummaryTip(@StateType int state) {
|
||||
mShowDialog = false;
|
||||
mState = state;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CharSequence getTitle(Context context) {
|
||||
return context.getString(R.string.battery_tip_summary_title);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CharSequence getSummary(Context context) {
|
||||
return context.getString(R.string.battery_tip_summary_summary);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getIconId() {
|
||||
return R.drawable.ic_check_circle_green_24dp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateState(BatteryTip tip) {
|
||||
mState = tip.mState;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void action() {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dialog buildDialog() {
|
||||
//TODO(b/70570352): create the dialog for summary tip and add test
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user