diff options
author | Deepanshu Gupta <deepanshu@google.com> | 2015-11-17 20:22:43 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-11-17 20:22:43 +0000 |
commit | 42a893b50b2763d7a2a3da4006c9433afaf86cfd (patch) | |
tree | 82663e3616293bdb21d8118f92236e35cb504ff1 /tools | |
parent | 22931224d9a9845d316a9ea30e56557bec0b2e45 (diff) | |
parent | 99b54b364b6d4e0689933393a9b584e542fc2c54 (diff) | |
download | frameworks_base-42a893b50b2763d7a2a3da4006c9433afaf86cfd.zip frameworks_base-42a893b50b2763d7a2a3da4006c9433afaf86cfd.tar.gz frameworks_base-42a893b50b2763d7a2a3da4006c9433afaf86cfd.tar.bz2 |
Merge "AppCompatActionBar: use findClass to test presence" into mnc-ub-dev
Diffstat (limited to 'tools')
-rw-r--r-- | tools/layoutlib/bridge/src/com/android/layoutlib/bridge/bars/AppCompatActionBar.java | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/bars/AppCompatActionBar.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/bars/AppCompatActionBar.java index b67afeb..cdcf0ea 100644 --- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/bars/AppCompatActionBar.java +++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/bars/AppCompatActionBar.java @@ -76,19 +76,18 @@ public class AppCompatActionBar extends BridgeActionBar { Class[] constructorParams = {View.class}; Object[] constructorArgs = {getDecorContent()}; LayoutlibCallback callback = params.getLayoutlibCallback(); - // First try to load the class as was available before appcompat v23.1.1, without - // logging warnings. + + // Check if the old action bar class is present. + String actionBarClass = WINDOW_ACTION_BAR_CLASS; try { - mWindowDecorActionBar = callback.loadClass(WINDOW_ACTION_BAR_CLASS, - constructorParams, constructorArgs); - } catch (ClassNotFoundException ignore) { - } - if (mWindowDecorActionBar == null) { - // If failed, load the new class, while logging warnings. - mWindowDecorActionBar = callback.loadView(WINDOW_ACTION_BAR_CLASS_NEW, - constructorParams, constructorArgs); + callback.findClass(actionBarClass); + } catch (ClassNotFoundException expected) { + // Failed to find the old class, use the newer one. + actionBarClass = WINDOW_ACTION_BAR_CLASS_NEW; } + mWindowDecorActionBar = callback.loadView(actionBarClass, + constructorParams, constructorArgs); mWindowActionBarClass = mWindowDecorActionBar == null ? null : mWindowDecorActionBar.getClass(); setupActionBar(); |