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

Commit 0f1e11e2 authored by Amith Yamasani's avatar Amith Yamasani
Browse files

Track native processes.

Add gauge to detail screen and make it look like the item from summary screen.
Some string changes.
parent a54672f3
Loading
Loading
Loading
Loading
+48 −33
Original line number Diff line number Diff line
@@ -22,55 +22,70 @@
        android:id="@+id/all_details"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:paddingRight="6dip"
        android:paddingTop="5dip"
        android:paddingBottom="5dip"
        android:orientation="vertical">

        <!-- Details header - icon, label and percentage -->
        <RelativeLayout
        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="center_vertical">
            android:minHeight="?android:attr/listPreferredItemHeight"
            android:orientation="horizontal"
            android:gravity="center_vertical"
            android:paddingLeft="12dip"
            android:paddingRight="?android:attr/scrollbarSize">

            <ImageView
                android:id="@+id/icon"
                android:layout_width="48dip"
                android:layout_height="wrap_content"
                android:layout_marginRight="6dip"
                android:layout_gravity="center" />

            <LinearLayout
                android:orientation="vertical"
                android:layout_alignParentLeft="true"
                android:layout_width="fill_parent"
            <RelativeLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:paddingTop="6dip"
                android:paddingBottom="6dip"
                android:paddingRight="6dip"
                android:paddingLeft="6dip" >
                <!-- application name -->
                android:layout_marginRight="8dip"
                android:layout_marginTop="2dip"
                android:layout_marginBottom="6dip"
                android:layout_weight="1">

                <TextView android:id="@+id/name"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:textAppearance="?android:attr/textAppearanceMedium"
                    android:textStyle="bold"
                    android:singleLine="true"
                    android:layout_marginTop="2dip"
                    android:layout_alignParentLeft="true"
                    android:layout_alignParentTop="true"
                    android:layout_toLeftOf="@+id/battery_percentage"
                    android:ellipsize="marquee"
                    android:layout_marginBottom="2dip" />
                <!-- application version -->
                    android:textAppearance="?android:attr/textAppearanceMedium"/>
                <TextView android:id="@+id/battery_percentage"
                    android:layout_marginTop="-4dip"
                    android:layout_gravity="center_vertical"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:textAppearance="?android:attr/textAppearanceSmall" />
            </LinearLayout>

            <!-- application icon -->
            <ImageView android:id="@+id/icon"
                android:layout_width="@android:dimen/app_icon_size"
                android:layout_height="@android:dimen/app_icon_size"
                    android:singleLine="true"
                    android:layout_alignParentRight="true"
                android:paddingTop="6dip"
                android:paddingBottom="6dip"
                android:paddingRight="6dip"
                android:scaleType="fitCenter" />
                    android:layout_alignBottom="@+id/name"
                    android:layout_gravity="bottom"
                    android:textAppearance="?android:attr/textAppearanceSmall"
                    android:textStyle="bold"/>
                <ImageView
                    android:id="@+id/gauge"
                    android:background="#80404040"
                    android:layout_height="wrap_content"
                    android:layout_width="fill_parent"
                    android:layout_marginTop="5dip"
                    android:layout_below="@id/battery_percentage"
                    android:layout_gravity="center_vertical" />
                <TextView android:id="@+id/summary"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignLeft="@id/gauge"
                    android:layout_below="@id/gauge"
                    android:textAppearance="?android:attr/textAppearanceSmall"
                    />
            </RelativeLayout>

        </LinearLayout>

        <TextView
            style="?android:attr/listSeparatorTextViewStyle"
+1 −1
Original line number Diff line number Diff line
@@ -61,7 +61,7 @@

        <ImageView
            android:id="@+id/appGauge"
            android:background="#2e2e2e"
            android:background="#80404040"
            android:layout_height="wrap_content"
            android:layout_width="fill_parent"
            android:layout_marginTop="5dip"
+16 −2
Original line number Diff line number Diff line
@@ -1647,7 +1647,13 @@ found in the list of installed applications.</string>
    <!-- Battery usage since user reset the stats -->
    <string name="battery_since_reset">Battery use since reset</string>
    <!-- Battery usage duration -->
    <string name="battery_stats_duration">Use duration - <xliff:g id="time">%1$s</xliff:g></string>
    <string name="battery_stats_duration"><xliff:g id="time">%1$s</xliff:g> since unplugged</string>
    <!-- CPU awake time title -->
    <string name="awake">Device awake time</string>
    <!-- Wifi on time -->
    <string name="wifi_on_time">WiFi on time</string>
    <!-- Bluetooth on time -->
    <string name="bluetooth_on_time">WiFi on time</string>
    <!-- Application name and battery usage percentage -->
    <string name="usage_name_percent"><xliff:g id="name">%1$s</xliff:g>" - "
            <xliff:g id="percent">%2$s</xliff:g>"%%"</string>
@@ -1705,6 +1711,9 @@ found in the list of installed applications.</string>
    <!-- Label for bluetooth settings -->
    <string name="battery_action_bluetooth">Bluetooth settings</string>

    <!-- Description for voice call detail -->
    <string name="battery_desc_voice">Battery used by voice calls</string>

    <!-- Description for standby detail -->
    <string name="battery_desc_standby">Battery used when phone is idle</string>

@@ -1748,6 +1757,11 @@ found in the list of installed applications.</string>
    <!-- Menu label for refreshing with latest usage numbers -->
    <string name="menu_stats_refresh">Refresh</string>

    <!-- Label for kernel threads -->
    <string name="process_kernel_label">Android OS</string>
    <!-- Label for mediaserver process -->
    <string name="process_mediaserver_label">Mediaserver</string>

    <!-- Text-To-Speech (TTS) settings --><skip />
    <!-- Title of setting on main settings screen.  This item will take the user to the screen to tweak settings related to the text-to-speech functionality -->
    <string name="tts_settings">Speech synthesis</string>
+2 −3
Original line number Diff line number Diff line
@@ -15,7 +15,6 @@
-->

<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
        android:title="@string/battery_since_unplugged">
    <PreferenceCategory
        android:key="app_list"/>
        android:title="@string/battery_since_unplugged"
        android:key="app_list">
</PreferenceScreen>
+67 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2009 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;

import android.graphics.Canvas;
import android.graphics.ColorFilter;
import android.graphics.PixelFormat;
import android.graphics.drawable.Drawable;

/**
 * A drawable for drawing a bar with a background.
 */
class PercentageBar extends Drawable {

    Drawable bar;
    double percent;
    int lastWidth = -1;

    @Override
    public void draw(Canvas canvas) {
        if (lastWidth == -1) {
            lastWidth = getBarWidth();
            bar.setBounds(0, 0, lastWidth, bar.getIntrinsicHeight());
        }
        bar.draw(canvas);
    }

    @Override
    public int getOpacity() {
        return PixelFormat.TRANSLUCENT;
    }

    @Override
    public void setAlpha(int alpha) {
        // Ignore
    }

    @Override
    public void setColorFilter(ColorFilter cf) {
        // Ignore
    }

    private int getBarWidth() {
        int width = (int) ((this.getBounds().width() * percent) / 100);
        int intrinsicWidth = bar.getIntrinsicWidth();
        return Math.max(width, intrinsicWidth);
    }

    @Override
    public int getIntrinsicHeight() {
        return bar.getIntrinsicHeight();
    }
}
Loading