diff options
author | newt@chromium.org <newt@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-14 00:19:43 +0000 |
---|---|---|
committer | newt@chromium.org <newt@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-14 00:19:43 +0000 |
commit | 41d60bdddb80337277058eaf734267eac3f82e83 (patch) | |
tree | 203651364263fe37274d3d59768c2c77483889ed /base/android/java | |
parent | 9b908ff4b2055889eabf4fa4a3d055827cec9029 (diff) | |
download | chromium_src-41d60bdddb80337277058eaf734267eac3f82e83.zip chromium_src-41d60bdddb80337277058eaf734267eac3f82e83.tar.gz chromium_src-41d60bdddb80337277058eaf734267eac3f82e83.tar.bz2 |
Update compatibility methods in ApiCompatibilityUtils.java.
This adds a method for RemoteViews.setContentDescription(), and removes
buildNotification(): android.support.v4.app.NotificationCompat can be
used instead.
BUG=316522
R=yfriedman@chromium.org
Review URL: https://codereview.chromium.org/58923006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@234974 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/android/java')
-rw-r--r-- | base/android/java/src/org/chromium/base/ApiCompatibilityUtils.java | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/base/android/java/src/org/chromium/base/ApiCompatibilityUtils.java b/base/android/java/src/org/chromium/base/ApiCompatibilityUtils.java index 8c4ac0f..625fed3 100644 --- a/base/android/java/src/org/chromium/base/ApiCompatibilityUtils.java +++ b/base/android/java/src/org/chromium/base/ApiCompatibilityUtils.java @@ -10,6 +10,7 @@ import android.os.Build; import android.view.View; import android.view.ViewGroup.MarginLayoutParams; import android.view.ViewTreeObserver; +import android.widget.RemoteViews; /** * Utility class to use new APIs that were added after ICS (API level 14). @@ -99,6 +100,18 @@ public class ApiCompatibilityUtils { } } + /** + * @see android.widget.RemoteViews#setContentDescription(int, CharSequence) + */ + public static void setContentDescriptionForRemoteView(RemoteViews remoteViews, int viewId, + CharSequence contentDescription) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1) { + remoteViews.setContentDescription(viewId, contentDescription); + } else { + // setContentDescription() is unavailable in earlier versions. + } + } + // These methods have a new name, and the old name is deprecated. /** @@ -125,16 +138,4 @@ public class ApiCompatibilityUtils { view.getViewTreeObserver().removeGlobalOnLayoutListener(listener); } } - - /** - * @see android.app.Notification.Builder#build() - */ - @SuppressWarnings("deprecation") - public static Notification buildNotification(Notification.Builder builder) { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { - return builder.build(); - } else { - return builder.getNotification(); - } - } } |