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

Commit ba3c377b authored by Adam Powell's avatar Adam Powell
Browse files

Fix metrics on Holo progress dialogs

Change-Id: I8818d002dcee0ca6d6deead9e0403c07e8ef4460
parent 0e23c2ef
Loading
Loading
Loading
Loading
+13 −4
Original line number Diff line number Diff line
@@ -16,7 +16,10 @@

package android.app;

import com.android.internal.R;

import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.os.Handler;
@@ -29,8 +32,6 @@ import android.view.View;
import android.widget.ProgressBar;
import android.widget.TextView;

import com.android.internal.R;

import java.text.NumberFormat;

/**
@@ -119,6 +120,9 @@ public class ProgressDialog extends AlertDialog {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        LayoutInflater inflater = LayoutInflater.from(mContext);
        TypedArray a = mContext.obtainStyledAttributes(null,
                com.android.internal.R.styleable.AlertDialog,
                com.android.internal.R.attr.alertDialogStyle, 0);
        if (mProgressStyle == STYLE_HORIZONTAL) {
            
            /* Use a separate handler to update the text views as they
@@ -149,17 +153,22 @@ public class ProgressDialog extends AlertDialog {
                    }
                }
            };
            View view = inflater.inflate(R.layout.alert_dialog_progress, null);
            View view = inflater.inflate(a.getResourceId(
                    com.android.internal.R.styleable.AlertDialog_horizontalProgressLayout,
                    R.layout.alert_dialog_progress), null);
            mProgress = (ProgressBar) view.findViewById(R.id.progress);
            mProgressNumber = (TextView) view.findViewById(R.id.progress_number);
            mProgressPercent = (TextView) view.findViewById(R.id.progress_percent);
            setView(view);
        } else {
            View view = inflater.inflate(R.layout.progress_dialog, null);
            View view = inflater.inflate(a.getResourceId(
                    com.android.internal.R.styleable.AlertDialog_progressLayout,
                    R.layout.progress_dialog), null);
            mProgress = (ProgressBar) view.findViewById(R.id.progress);
            mMessageView = (TextView) view.findViewById(R.id.message);
            setView(view);
        }
        a.recycle();
        if (mMax > 0) {
            setMax(mMax);
        }
+48 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2011 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.
-->

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content" android:layout_height="match_parent">
        <ProgressBar android:id="@+id/progress"
            style="?android:attr/progressBarStyleHorizontal"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="16dip"
            android:layout_marginBottom="1dip"
            android:layout_marginLeft="16dip"
            android:layout_marginRight="16dip"
            android:layout_centerHorizontal="true" />
        <TextView
            android:id="@+id/progress_percent"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:paddingBottom="16dip"
            android:layout_marginLeft="16dip"
            android:layout_marginRight="16dip"
            android:layout_alignParentLeft="true"
            android:layout_below="@id/progress"
        />
        <TextView
            android:id="@+id/progress_number"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:paddingBottom="16dip"
            android:layout_marginLeft="16dip"
            android:layout_marginRight="16dip"
            android:layout_alignParentRight="true"
            android:layout_below="@id/progress"
        />
</RelativeLayout>
+43 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
** Copyright 2011, 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.
*/
-->

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <LinearLayout android:id="@+id/body"
        android:orientation="horizontal"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:baselineAligned="false"
        android:padding="16dip">

        <ProgressBar android:id="@android:id/progress"
            style="?android:attr/progressBarStyle"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:max="10000"
            android:layout_marginRight="16dip" />

        <TextView android:id="@+id/message"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="center_vertical" />
    </LinearLayout>
</FrameLayout>
+2 −0
Original line number Diff line number Diff line
@@ -1551,6 +1551,8 @@
        <attr name="multiChoiceItemLayout" format="reference" />
        <attr name="singleChoiceItemLayout" format="reference" />
        <attr name="listItemLayout" format="reference" />
        <attr name="progressLayout" format="reference" />
        <attr name="horizontalProgressLayout" format="reference" />
    </declare-styleable>

    <!-- Fragment animation class attributes. -->
+4 −0
Original line number Diff line number Diff line
@@ -61,6 +61,8 @@ please see styles_device_defaults.xml.
        <item name="bottomBright">@android:drawable/popup_bottom_bright</item>
        <item name="bottomMedium">@android:drawable/popup_bottom_medium</item>
        <item name="centerMedium">@android:drawable/popup_center_medium</item>
        <item name="progressLayout">@android:layout/progress_dialog</item>
        <item name="horizontalProgressLayout">@android:layout/alert_dialog_progress</item>
    </style>

    <style name="Widget.PreferenceFrameLayout">
@@ -2350,6 +2352,8 @@ please see styles_device_defaults.xml.
        <item name="centerMedium">@android:drawable/dialog_middle_holo_dark</item>
        <item name="layout">@android:layout/alert_dialog_holo</item>
        <item name="listLayout">@android:layout/select_dialog_holo</item>
        <item name="progressLayout">@android:layout/progress_dialog_holo</item>
        <item name="horizontalProgressLayout">@android:layout/alert_dialog_progress_holo</item>
        <item name="listItemLayout">@android:layout/select_dialog_item_holo</item>
        <item name="multiChoiceItemLayout">@android:layout/select_dialog_multichoice_holo</item>
        <item name="singleChoiceItemLayout">@android:layout/select_dialog_singlechoice_holo</item>