From aca4b25f479065088a798eff3b87ec46325632e3 Mon Sep 17 00:00:00 2001 From: Christoph Studer Date: Tue, 9 Sep 2014 15:58:41 +0200 Subject: Notification: Use ViewStub for ProgressBar Lazily inflate ProgressBars since they're expensive. Bug: 17366831 Bug: 17399567 Change-Id: I2b85169a67d41a66fead2fccef2381eaa671c3e4 --- core/java/android/app/Notification.java | 2 +- .../layout/notification_template_part_line2.xml | 4 ++-- .../layout/notification_template_progressbar.xml | 23 ++++++++++++++++++++++ 3 files changed, 26 insertions(+), 3 deletions(-) create mode 100644 core/res/res/layout/notification_template_progressbar.xml diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java index 10839433e327..9aa852b95bdf 100644 --- a/core/java/android/app/Notification.java +++ b/core/java/android/app/Notification.java @@ -2721,9 +2721,9 @@ public class Notification implements Parcelable } else { contentView.setViewVisibility(R.id.text2, View.GONE); if (hasProgress && (mProgressMax != 0 || mProgressIndeterminate)) { + contentView.setViewVisibility(R.id.progress, View.VISIBLE); contentView.setProgressBar( R.id.progress, mProgressMax, mProgress, mProgressIndeterminate); - contentView.setViewVisibility(R.id.progress, View.VISIBLE); showLine2 = true; } else { contentView.setViewVisibility(R.id.progress, View.GONE); diff --git a/core/res/res/layout/notification_template_part_line2.xml b/core/res/res/layout/notification_template_part_line2.xml index 7e99c5ea4050..aeef3ab2ad33 100644 --- a/core/res/res/layout/notification_template_part_line2.xml +++ b/core/res/res/layout/notification_template_part_line2.xml @@ -45,13 +45,13 @@ android:visibility="gone" /> - diff --git a/core/res/res/layout/notification_template_progressbar.xml b/core/res/res/layout/notification_template_progressbar.xml new file mode 100644 index 000000000000..61480b8664cb --- /dev/null +++ b/core/res/res/layout/notification_template_progressbar.xml @@ -0,0 +1,23 @@ + + + + -- cgit v1.2.3-59-g8ed1b