Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d589bafc authored by Jason Monk's avatar Jason Monk
Browse files

Update battery content descriptions with labels

Change-Id: I0ad4ca753f8f5e1a01e2e21181526ddb921d487a
Fixes: 28301362
parent f315e2e6
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -35,7 +35,7 @@ public class PowerGaugePreference extends TintablePreference {
    private final int mIconSize;

    private BatteryEntry mInfo;
    private final CharSequence mContentDescription;
    private CharSequence mContentDescription;
    private CharSequence mProgress;

    public PowerGaugePreference(Context context, Drawable icon, CharSequence contentDescription,
@@ -48,6 +48,11 @@ public class PowerGaugePreference extends TintablePreference {
        mIconSize = context.getResources().getDimensionPixelSize(R.dimen.app_icon_size);
    }

    public void setContentDescription(String name) {
        mContentDescription = name;
        notifyChanged();
    }

    public void setPercent(double percentOfMax, double percentOfTotal) {
        mProgress = Utils.formatPercentage((int) (percentOfTotal + 0.5));
        notifyChanged();
+3 −0
Original line number Diff line number Diff line
@@ -432,6 +432,9 @@ public class PowerUsageSummary extends PowerUsageBase {
                        final UserHandle userHandle = new UserHandle(userId);
                        pgp.setIcon(mUm.getBadgedIconForUser(entry.getIcon(), userHandle));
                        pgp.setTitle(entry.name);
                        if (entry.sipper.drainType == DrainType.APP) {
                            pgp.setContentDescription(entry.name);
                        }
                    }
                    break;
                case BatteryEntry.MSG_REPORT_FULLY_DRAWN: