aboutsummaryrefslogtreecommitdiffstats
path: root/APG/android-libs/ActionBarSherlock/src/com/actionbarsherlock/internal
diff options
context:
space:
mode:
authorDominik Schürmann <dominik@dominikschuermann.de>2012-12-12 13:58:22 +0100
committerDominik Schürmann <dominik@dominikschuermann.de>2012-12-12 13:58:22 +0100
commite3fea30abe9f9f16dbfa5e989e7058842b085b7e (patch)
tree06c5bdcb4e8d18d315115a8a0fc414a1d0d64ccc /APG/android-libs/ActionBarSherlock/src/com/actionbarsherlock/internal
parenta4ea3e65a7feb9175e206b4aa93662bf51457072 (diff)
downloadopen-keychain-e3fea30abe9f9f16dbfa5e989e7058842b085b7e.tar.gz
open-keychain-e3fea30abe9f9f16dbfa5e989e7058842b085b7e.tar.bz2
open-keychain-e3fea30abe9f9f16dbfa5e989e7058842b085b7e.zip
Update ActionBarSherlock
Diffstat (limited to 'APG/android-libs/ActionBarSherlock/src/com/actionbarsherlock/internal')
-rw-r--r--APG/android-libs/ActionBarSherlock/src/com/actionbarsherlock/internal/ActionBarSherlockCompat.java44
-rw-r--r--APG/android-libs/ActionBarSherlock/src/com/actionbarsherlock/internal/ActionBarSherlockNative.java10
-rw-r--r--APG/android-libs/ActionBarSherlock/src/com/actionbarsherlock/internal/app/ActionBarImpl.java6
-rw-r--r--APG/android-libs/ActionBarSherlock/src/com/actionbarsherlock/internal/app/ActionBarWrapper.java14
-rw-r--r--APG/android-libs/ActionBarSherlock/src/com/actionbarsherlock/internal/nineoldandroids/widget/NineFrameLayout.java8
-rw-r--r--APG/android-libs/ActionBarSherlock/src/com/actionbarsherlock/internal/nineoldandroids/widget/NineLinearLayout.java8
-rw-r--r--APG/android-libs/ActionBarSherlock/src/com/actionbarsherlock/internal/view/menu/ActionMenuPresenter.java11
-rw-r--r--APG/android-libs/ActionBarSherlock/src/com/actionbarsherlock/internal/view/menu/ActionMenuView.java3
-rw-r--r--APG/android-libs/ActionBarSherlock/src/com/actionbarsherlock/internal/view/menu/MenuItemWrapper.java22
-rw-r--r--APG/android-libs/ActionBarSherlock/src/com/actionbarsherlock/internal/view/menu/MenuWrapper.java13
-rw-r--r--APG/android-libs/ActionBarSherlock/src/com/actionbarsherlock/internal/widget/ActionBarContainer.java13
-rw-r--r--APG/android-libs/ActionBarSherlock/src/com/actionbarsherlock/internal/widget/CapitalizingTextView.java10
-rw-r--r--APG/android-libs/ActionBarSherlock/src/com/actionbarsherlock/internal/widget/CollapsibleActionViewWrapper.java30
-rw-r--r--APG/android-libs/ActionBarSherlock/src/com/actionbarsherlock/internal/widget/IcsColorDrawable.java41
-rw-r--r--APG/android-libs/ActionBarSherlock/src/com/actionbarsherlock/internal/widget/IcsLinearLayout.java154
-rw-r--r--APG/android-libs/ActionBarSherlock/src/com/actionbarsherlock/internal/widget/ScrollingTabContainerView.java1
16 files changed, 312 insertions, 76 deletions
diff --git a/APG/android-libs/ActionBarSherlock/src/com/actionbarsherlock/internal/ActionBarSherlockCompat.java b/APG/android-libs/ActionBarSherlock/src/com/actionbarsherlock/internal/ActionBarSherlockCompat.java
index 05353d28c..5e69275c7 100644
--- a/APG/android-libs/ActionBarSherlock/src/com/actionbarsherlock/internal/ActionBarSherlockCompat.java
+++ b/APG/android-libs/ActionBarSherlock/src/com/actionbarsherlock/internal/ActionBarSherlockCompat.java
@@ -52,6 +52,7 @@ public class ActionBarSherlockCompat extends ActionBarSherlock implements MenuBu
/** Window features which are enabled by default. */
protected static final int DEFAULT_FEATURES = 0;
+ static private final String PANELS_TAG = "sherlock:Panels";
public ActionBarSherlockCompat(Activity activity, int flags) {
super(activity, flags);
@@ -71,8 +72,6 @@ public class ActionBarSherlockCompat extends ActionBarSherlock implements MenuBu
private MenuBuilder mMenu;
/** Map between native options items and sherlock items. */
protected HashMap<android.view.MenuItem, MenuItemImpl> mNativeItemMap;
- /** Indication of a long-press on the hardware menu key. */
- private boolean mMenuKeyIsLongPress = false;
/** Parent view of the window decoration (action bar, mode, etc.). */
private ViewGroup mDecor;
@@ -293,7 +292,10 @@ public class ActionBarSherlockCompat extends ActionBarSherlock implements MenuBu
return false;
}
- return wActionBar.hideOverflowMenu();
+ if (wActionBar != null) {
+ return wActionBar.hideOverflowMenu();
+ }
+ return false;
}
@Override
@@ -424,27 +426,8 @@ public class ActionBarSherlockCompat extends ActionBarSherlock implements MenuBu
}
}
- boolean result = false;
- if (keyCode == KeyEvent.KEYCODE_MENU && isReservingOverflow()) {
- if (event.getAction() == KeyEvent.ACTION_DOWN && event.isLongPress()) {
- mMenuKeyIsLongPress = true;
- } else if (event.getAction() == KeyEvent.ACTION_UP) {
- if (!mMenuKeyIsLongPress) {
- if (mActionMode == null && wActionBar != null) {
- if (wActionBar.isOverflowMenuShowing()) {
- wActionBar.hideOverflowMenu();
- } else {
- wActionBar.showOverflowMenu();
- }
- }
- result = true;
- }
- mMenuKeyIsLongPress = false;
- }
- }
-
- if (DEBUG) Log.d(TAG, "[dispatchKeyEvent] returning " + result);
- return result;
+ if (DEBUG) Log.d(TAG, "[dispatchKeyEvent] returning false");
+ return false;
}
@Override
@@ -452,6 +435,19 @@ public class ActionBarSherlockCompat extends ActionBarSherlock implements MenuBu
mIsDestroyed = true;
}
+ @Override
+ public void dispatchSaveInstanceState(Bundle outState) {
+ if (mMenu != null) {
+ mMenuFrozenActionViewState = new Bundle();
+ mMenu.saveActionViewStates(mMenuFrozenActionViewState);
+ }
+ outState.putParcelable(PANELS_TAG, mMenuFrozenActionViewState);
+ }
+
+ @Override
+ public void dispatchRestoreInstanceState(Bundle savedInstanceState) {
+ mMenuFrozenActionViewState = savedInstanceState.getParcelable(PANELS_TAG);
+ }
///////////////////////////////////////////////////////////////////////////
// Menu callback lifecycle and creation
diff --git a/APG/android-libs/ActionBarSherlock/src/com/actionbarsherlock/internal/ActionBarSherlockNative.java b/APG/android-libs/ActionBarSherlock/src/com/actionbarsherlock/internal/ActionBarSherlockNative.java
index 9afca185a..0824d3848 100644
--- a/APG/android-libs/ActionBarSherlock/src/com/actionbarsherlock/internal/ActionBarSherlockNative.java
+++ b/APG/android-libs/ActionBarSherlock/src/com/actionbarsherlock/internal/ActionBarSherlockNative.java
@@ -208,7 +208,12 @@ public class ActionBarSherlockNative extends ActionBarSherlock {
//is where we will set the new instance to mActionMode since we need
//to pass it through to the sherlock callbacks and the call below
//will not have returned yet to store its value.
- mActivity.startActionMode(wrapped);
+ if (mActivity.startActionMode(wrapped) == null) {
+ mActionMode = null;
+ }
+ if (mActivity instanceof OnActionModeStartedListener && mActionMode != null) {
+ ((OnActionModeStartedListener)mActivity).onActionModeStarted(mActionMode);
+ }
return mActionMode;
}
@@ -241,6 +246,9 @@ public class ActionBarSherlockNative extends ActionBarSherlock {
@Override
public void onDestroyActionMode(android.view.ActionMode mode) {
mCallback.onDestroyActionMode(mActionMode);
+ if (mActivity instanceof OnActionModeFinishedListener) {
+ ((OnActionModeFinishedListener)mActivity).onActionModeFinished(mActionMode);
+ }
}
}
diff --git a/APG/android-libs/ActionBarSherlock/src/com/actionbarsherlock/internal/app/ActionBarImpl.java b/APG/android-libs/ActionBarSherlock/src/com/actionbarsherlock/internal/app/ActionBarImpl.java
index 6ae0402c0..d022a2465 100644
--- a/APG/android-libs/ActionBarSherlock/src/com/actionbarsherlock/internal/app/ActionBarImpl.java
+++ b/APG/android-libs/ActionBarSherlock/src/com/actionbarsherlock/internal/app/ActionBarImpl.java
@@ -26,6 +26,7 @@ import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Handler;
+import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentTransaction;
import android.util.TypedValue;
import android.view.ContextThemeWrapper;
@@ -36,7 +37,6 @@ import android.view.accessibility.AccessibilityEvent;
import android.widget.SpinnerAdapter;
import com.actionbarsherlock.R;
import com.actionbarsherlock.app.ActionBar;
-import com.actionbarsherlock.app.SherlockFragmentActivity;
import com.actionbarsherlock.internal.nineoldandroids.animation.Animator;
import com.actionbarsherlock.internal.nineoldandroids.animation.AnimatorListenerAdapter;
import com.actionbarsherlock.internal.nineoldandroids.animation.AnimatorSet;
@@ -506,8 +506,8 @@ public class ActionBarImpl extends ActionBar {
}
FragmentTransaction trans = null;
- if (mActivity instanceof SherlockFragmentActivity) {
- trans = ((SherlockFragmentActivity)mActivity).getSupportFragmentManager().beginTransaction()
+ if (mActivity instanceof FragmentActivity) {
+ trans = ((FragmentActivity)mActivity).getSupportFragmentManager().beginTransaction()
.disallowAddToBackStack();
}
diff --git a/APG/android-libs/ActionBarSherlock/src/com/actionbarsherlock/internal/app/ActionBarWrapper.java b/APG/android-libs/ActionBarSherlock/src/com/actionbarsherlock/internal/app/ActionBarWrapper.java
index e390ea428..840cb3d27 100644
--- a/APG/android-libs/ActionBarSherlock/src/com/actionbarsherlock/internal/app/ActionBarWrapper.java
+++ b/APG/android-libs/ActionBarSherlock/src/com/actionbarsherlock/internal/app/ActionBarWrapper.java
@@ -6,12 +6,12 @@ import java.util.Set;
import android.app.Activity;
import android.content.Context;
import android.graphics.drawable.Drawable;
+import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentTransaction;
import android.view.View;
import android.widget.SpinnerAdapter;
import com.actionbarsherlock.app.ActionBar;
-import com.actionbarsherlock.app.SherlockFragmentActivity;
public class ActionBarWrapper extends ActionBar implements android.app.ActionBar.OnNavigationListener, android.app.ActionBar.OnMenuVisibilityListener {
private final Activity mActivity;
@@ -319,8 +319,8 @@ public class ActionBarWrapper extends ActionBar implements android.app.ActionBar
public void onTabReselected(android.app.ActionBar.Tab tab, android.app.FragmentTransaction ft) {
if (mListener != null) {
FragmentTransaction trans = null;
- if (mActivity instanceof SherlockFragmentActivity) {
- trans = ((SherlockFragmentActivity)mActivity).getSupportFragmentManager().beginTransaction()
+ if (mActivity instanceof FragmentActivity) {
+ trans = ((FragmentActivity)mActivity).getSupportFragmentManager().beginTransaction()
.disallowAddToBackStack();
}
@@ -336,8 +336,8 @@ public class ActionBarWrapper extends ActionBar implements android.app.ActionBar
public void onTabSelected(android.app.ActionBar.Tab tab, android.app.FragmentTransaction ft) {
if (mListener != null) {
- if (mFragmentTransaction == null && mActivity instanceof SherlockFragmentActivity) {
- mFragmentTransaction = ((SherlockFragmentActivity)mActivity).getSupportFragmentManager().beginTransaction()
+ if (mFragmentTransaction == null && mActivity instanceof FragmentActivity) {
+ mFragmentTransaction = ((FragmentActivity)mActivity).getSupportFragmentManager().beginTransaction()
.disallowAddToBackStack();
}
@@ -356,8 +356,8 @@ public class ActionBarWrapper extends ActionBar implements android.app.ActionBar
public void onTabUnselected(android.app.ActionBar.Tab tab, android.app.FragmentTransaction ft) {
if (mListener != null) {
FragmentTransaction trans = null;
- if (mActivity instanceof SherlockFragmentActivity) {
- trans = ((SherlockFragmentActivity)mActivity).getSupportFragmentManager().beginTransaction()
+ if (mActivity instanceof FragmentActivity) {
+ trans = ((FragmentActivity)mActivity).getSupportFragmentManager().beginTransaction()
.disallowAddToBackStack();
mFragmentTransaction = trans;
}
diff --git a/APG/android-libs/ActionBarSherlock/src/com/actionbarsherlock/internal/nineoldandroids/widget/NineFrameLayout.java b/APG/android-libs/ActionBarSherlock/src/com/actionbarsherlock/internal/nineoldandroids/widget/NineFrameLayout.java
index 2c428e907..953e3e844 100644
--- a/APG/android-libs/ActionBarSherlock/src/com/actionbarsherlock/internal/nineoldandroids/widget/NineFrameLayout.java
+++ b/APG/android-libs/ActionBarSherlock/src/com/actionbarsherlock/internal/nineoldandroids/widget/NineFrameLayout.java
@@ -9,18 +9,10 @@ import com.actionbarsherlock.internal.nineoldandroids.view.animation.AnimatorPro
public class NineFrameLayout extends FrameLayout {
private final AnimatorProxy mProxy;
- public NineFrameLayout(Context context) {
- super(context);
- mProxy = AnimatorProxy.NEEDS_PROXY ? AnimatorProxy.wrap(this) : null;
- }
public NineFrameLayout(Context context, AttributeSet attrs) {
super(context, attrs);
mProxy = AnimatorProxy.NEEDS_PROXY ? AnimatorProxy.wrap(this) : null;
}
- public NineFrameLayout(Context context, AttributeSet attrs, int defStyle) {
- super(context, attrs, defStyle);
- mProxy = AnimatorProxy.NEEDS_PROXY ? AnimatorProxy.wrap(this) : null;
- }
@Override
public void setVisibility(int visibility) {
diff --git a/APG/android-libs/ActionBarSherlock/src/com/actionbarsherlock/internal/nineoldandroids/widget/NineLinearLayout.java b/APG/android-libs/ActionBarSherlock/src/com/actionbarsherlock/internal/nineoldandroids/widget/NineLinearLayout.java
index a670b1f64..1f381013a 100644
--- a/APG/android-libs/ActionBarSherlock/src/com/actionbarsherlock/internal/nineoldandroids/widget/NineLinearLayout.java
+++ b/APG/android-libs/ActionBarSherlock/src/com/actionbarsherlock/internal/nineoldandroids/widget/NineLinearLayout.java
@@ -9,18 +9,10 @@ import com.actionbarsherlock.internal.nineoldandroids.view.animation.AnimatorPro
public class NineLinearLayout extends LinearLayout {
private final AnimatorProxy mProxy;
- public NineLinearLayout(Context context) {
- super(context);
- mProxy = AnimatorProxy.NEEDS_PROXY ? AnimatorProxy.wrap(this) : null;
- }
public NineLinearLayout(Context context, AttributeSet attrs) {
super(context, attrs);
mProxy = AnimatorProxy.NEEDS_PROXY ? AnimatorProxy.wrap(this) : null;
}
- public NineLinearLayout(Context context, AttributeSet attrs, int defStyle) {
- super(context, attrs, defStyle);
- mProxy = AnimatorProxy.NEEDS_PROXY ? AnimatorProxy.wrap(this) : null;
- }
@Override
public void setVisibility(int visibility) {
diff --git a/APG/android-libs/ActionBarSherlock/src/com/actionbarsherlock/internal/view/menu/ActionMenuPresenter.java b/APG/android-libs/ActionBarSherlock/src/com/actionbarsherlock/internal/view/menu/ActionMenuPresenter.java
index 6f568c698..876a22c58 100644
--- a/APG/android-libs/ActionBarSherlock/src/com/actionbarsherlock/internal/view/menu/ActionMenuPresenter.java
+++ b/APG/android-libs/ActionBarSherlock/src/com/actionbarsherlock/internal/view/menu/ActionMenuPresenter.java
@@ -23,7 +23,6 @@ import java.util.Set;
import android.content.Context;
import android.content.res.Configuration;
import android.content.res.Resources;
-import android.content.res.TypedArray;
import android.os.Build;
import android.os.Parcel;
import android.os.Parcelable;
@@ -119,14 +118,6 @@ public class ActionMenuPresenter extends BaseMenuPresenter
}
public static boolean reserveOverflow(Context context) {
- //Check for theme-forced overflow action item
- TypedArray a = context.getTheme().obtainStyledAttributes(R.styleable.SherlockTheme);
- boolean result = a.getBoolean(R.styleable.SherlockTheme_absForceOverflow, false);
- a.recycle();
- if (result) {
- return true;
- }
-
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
return (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB);
} else {
@@ -621,6 +612,8 @@ public class ActionMenuPresenter extends BaseMenuPresenter
for (View_OnAttachStateChangeListener listener : mListeners) {
listener.onViewDetachedFromWindow(this);
}
+
+ if (mOverflowPopup != null) mOverflowPopup.dismiss();
}
@Override
diff --git a/APG/android-libs/ActionBarSherlock/src/com/actionbarsherlock/internal/view/menu/ActionMenuView.java b/APG/android-libs/ActionBarSherlock/src/com/actionbarsherlock/internal/view/menu/ActionMenuView.java
index e090677a1..0e3b1ae0d 100644
--- a/APG/android-libs/ActionBarSherlock/src/com/actionbarsherlock/internal/view/menu/ActionMenuView.java
+++ b/APG/android-libs/ActionBarSherlock/src/com/actionbarsherlock/internal/view/menu/ActionMenuView.java
@@ -520,6 +520,9 @@ public class ActionMenuView extends IcsLinearLayout implements MenuBuilder.ItemI
//@Override
protected boolean hasDividerBeforeChildAt(int childIndex) {
+ if (childIndex == 0) {
+ return false;
+ }
final View childBefore = getChildAt(childIndex - 1);
final View child = getChildAt(childIndex);
boolean result = false;
diff --git a/APG/android-libs/ActionBarSherlock/src/com/actionbarsherlock/internal/view/menu/MenuItemWrapper.java b/APG/android-libs/ActionBarSherlock/src/com/actionbarsherlock/internal/view/menu/MenuItemWrapper.java
index 907a7aa04..aaf2997b7 100644
--- a/APG/android-libs/ActionBarSherlock/src/com/actionbarsherlock/internal/view/menu/MenuItemWrapper.java
+++ b/APG/android-libs/ActionBarSherlock/src/com/actionbarsherlock/internal/view/menu/MenuItemWrapper.java
@@ -2,10 +2,12 @@ package com.actionbarsherlock.internal.view.menu;
import android.content.Intent;
import android.graphics.drawable.Drawable;
-import android.view.View;
import android.view.ContextMenu.ContextMenuInfo;
+import android.view.View;
import com.actionbarsherlock.internal.view.ActionProviderWrapper;
+import com.actionbarsherlock.internal.widget.CollapsibleActionViewWrapper;
import com.actionbarsherlock.view.ActionProvider;
+import com.actionbarsherlock.view.CollapsibleActionView;
import com.actionbarsherlock.view.MenuItem;
import com.actionbarsherlock.view.SubMenu;
@@ -215,19 +217,35 @@ public class MenuItemWrapper implements MenuItem, android.view.MenuItem.OnMenuIt
@Override
public MenuItem setActionView(View view) {
+ if (view != null && view instanceof CollapsibleActionView) {
+ view = new CollapsibleActionViewWrapper(view);
+ }
mNativeItem.setActionView(view);
return this;
}
@Override
public MenuItem setActionView(int resId) {
+ //Allow the native menu to inflate the resource
mNativeItem.setActionView(resId);
+ if (resId != 0) {
+ //Get newly created view
+ View view = mNativeItem.getActionView();
+ if (view instanceof CollapsibleActionView) {
+ //Wrap it and re-set it
+ mNativeItem.setActionView(new CollapsibleActionViewWrapper(view));
+ }
+ }
return this;
}
@Override
public View getActionView() {
- return mNativeItem.getActionView();
+ View actionView = mNativeItem.getActionView();
+ if (actionView instanceof CollapsibleActionViewWrapper) {
+ return ((CollapsibleActionViewWrapper)actionView).unwrap();
+ }
+ return actionView;
}
@Override
diff --git a/APG/android-libs/ActionBarSherlock/src/com/actionbarsherlock/internal/view/menu/MenuWrapper.java b/APG/android-libs/ActionBarSherlock/src/com/actionbarsherlock/internal/view/menu/MenuWrapper.java
index 64fc4aeaa..3d4dd42fd 100644
--- a/APG/android-libs/ActionBarSherlock/src/com/actionbarsherlock/internal/view/menu/MenuWrapper.java
+++ b/APG/android-libs/ActionBarSherlock/src/com/actionbarsherlock/internal/view/menu/MenuWrapper.java
@@ -79,10 +79,15 @@ public class MenuWrapper implements Menu {
@Override
public int addIntentOptions(int groupId, int itemId, int order, ComponentName caller, Intent[] specifics, Intent intent, int flags, MenuItem[] outSpecificItems) {
- android.view.MenuItem[] nativeOutItems = new android.view.MenuItem[outSpecificItems.length];
- int result = mNativeMenu.addIntentOptions(groupId, itemId, order, caller, specifics, intent, flags, nativeOutItems);
- for (int i = 0, length = outSpecificItems.length; i < length; i++) {
- outSpecificItems[i] = new MenuItemWrapper(nativeOutItems[i]);
+ int result;
+ if (outSpecificItems != null) {
+ android.view.MenuItem[] nativeOutItems = new android.view.MenuItem[outSpecificItems.length];
+ result = mNativeMenu.addIntentOptions(groupId, itemId, order, caller, specifics, intent, flags, nativeOutItems);
+ for (int i = 0, length = outSpecificItems.length; i < length; i++) {
+ outSpecificItems[i] = new MenuItemWrapper(nativeOutItems[i]);
+ }
+ } else {
+ result = mNativeMenu.addIntentOptions(groupId, itemId, order, caller, specifics, intent, flags, null);
}
return result;
}
diff --git a/APG/android-libs/ActionBarSherlock/src/com/actionbarsherlock/internal/widget/ActionBarContainer.java b/APG/android-libs/ActionBarSherlock/src/com/actionbarsherlock/internal/widget/ActionBarContainer.java
index 5e5aa2867..1d9c68b37 100644
--- a/APG/android-libs/ActionBarSherlock/src/com/actionbarsherlock/internal/widget/ActionBarContainer.java
+++ b/APG/android-libs/ActionBarSherlock/src/com/actionbarsherlock/internal/widget/ActionBarContainer.java
@@ -18,8 +18,11 @@ package com.actionbarsherlock.internal.widget;
import android.content.Context;
import android.content.res.TypedArray;
+import android.graphics.Bitmap;
import android.graphics.Canvas;
+import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
+import android.os.Build;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
@@ -60,6 +63,16 @@ public class ActionBarContainer extends NineFrameLayout {
mStackedBackground = a.getDrawable(
R.styleable.SherlockActionBar_backgroundStacked);
+ //Fix for issue #379
+ if (mStackedBackground instanceof ColorDrawable && Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
+ Bitmap bitmap = Bitmap.createBitmap(1, 1, Bitmap.Config.ARGB_8888);
+ Canvas c = new Canvas(bitmap);
+ mStackedBackground.draw(c);
+ int color = bitmap.getPixel(0, 0);
+ bitmap.recycle();
+ mStackedBackground = new IcsColorDrawable(color);
+ }
+
if (getId() == R.id.abs__split_action_bar) {
mIsSplit = true;
mSplitBackground = a.getDrawable(
diff --git a/APG/android-libs/ActionBarSherlock/src/com/actionbarsherlock/internal/widget/CapitalizingTextView.java b/APG/android-libs/ActionBarSherlock/src/com/actionbarsherlock/internal/widget/CapitalizingTextView.java
index 673ec554f..cae8b8aed 100644
--- a/APG/android-libs/ActionBarSherlock/src/com/actionbarsherlock/internal/widget/CapitalizingTextView.java
+++ b/APG/android-libs/ActionBarSherlock/src/com/actionbarsherlock/internal/widget/CapitalizingTextView.java
@@ -1,12 +1,13 @@
package com.actionbarsherlock.internal.widget;
-import java.util.Locale;
import android.content.Context;
import android.content.res.TypedArray;
import android.os.Build;
import android.util.AttributeSet;
import android.widget.TextView;
+import java.util.Locale;
+
public class CapitalizingTextView extends TextView {
private static final boolean SANS_ICE_CREAM = Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH;
private static final boolean IS_GINGERBREAD = Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD;
@@ -33,7 +34,12 @@ public class CapitalizingTextView extends TextView {
public void setTextCompat(CharSequence text) {
if (SANS_ICE_CREAM && mAllCaps && text != null) {
if (IS_GINGERBREAD) {
- setText(text.toString().toUpperCase(Locale.ROOT));
+ try {
+ setText(text.toString().toUpperCase(Locale.ROOT));
+ } catch (NoSuchFieldError e) {
+ //Some manufacturer broke Locale.ROOT. See #572.
+ setText(text.toString().toUpperCase());
+ }
} else {
setText(text.toString().toUpperCase());
}
diff --git a/APG/android-libs/ActionBarSherlock/src/com/actionbarsherlock/internal/widget/CollapsibleActionViewWrapper.java b/APG/android-libs/ActionBarSherlock/src/com/actionbarsherlock/internal/widget/CollapsibleActionViewWrapper.java
new file mode 100644
index 000000000..14f092c81
--- /dev/null
+++ b/APG/android-libs/ActionBarSherlock/src/com/actionbarsherlock/internal/widget/CollapsibleActionViewWrapper.java
@@ -0,0 +1,30 @@
+package com.actionbarsherlock.internal.widget;
+
+import android.view.View;
+import android.widget.FrameLayout;
+import com.actionbarsherlock.view.CollapsibleActionView;
+
+/**
+ * Wraps an ABS collapsible action view in a native container that delegates the calls.
+ */
+public class CollapsibleActionViewWrapper extends FrameLayout implements android.view.CollapsibleActionView {
+ private final CollapsibleActionView child;
+
+ public CollapsibleActionViewWrapper(View child) {
+ super(child.getContext());
+ this.child = (CollapsibleActionView) child;
+ addView(child);
+ }
+
+ @Override public void onActionViewExpanded() {
+ child.onActionViewExpanded();
+ }
+
+ @Override public void onActionViewCollapsed() {
+ child.onActionViewCollapsed();
+ }
+
+ public View unwrap() {
+ return getChildAt(0);
+ }
+}
diff --git a/APG/android-libs/ActionBarSherlock/src/com/actionbarsherlock/internal/widget/IcsColorDrawable.java b/APG/android-libs/ActionBarSherlock/src/com/actionbarsherlock/internal/widget/IcsColorDrawable.java
new file mode 100644
index 000000000..a78b3f71b
--- /dev/null
+++ b/APG/android-libs/ActionBarSherlock/src/com/actionbarsherlock/internal/widget/IcsColorDrawable.java
@@ -0,0 +1,41 @@
+package com.actionbarsherlock.internal.widget;
+
+import android.graphics.Canvas;
+import android.graphics.ColorFilter;
+import android.graphics.Paint;
+import android.graphics.drawable.Drawable;
+
+/**
+ * A version of {@link android.graphics.drawable.ColorDrawable} that respects bounds.
+ */
+public class IcsColorDrawable extends Drawable {
+ private int color;
+ private final Paint paint = new Paint();
+
+ public IcsColorDrawable(int color) {
+ this.color = color;
+ }
+
+ @Override public void draw(Canvas canvas) {
+ if ((color >>> 24) != 0) {
+ paint.setColor(color);
+ canvas.drawRect(getBounds(), paint);
+ }
+ }
+
+ @Override
+ public void setAlpha(int alpha) {
+ if (alpha != (color >>> 24)) {
+ color = (color & 0x00FFFFFF) & (alpha << 24);
+ invalidateSelf();
+ }
+ }
+
+ @Override public void setColorFilter(ColorFilter colorFilter) {
+ //Ignored
+ }
+
+ @Override public int getOpacity() {
+ return color >>> 24;
+ }
+}
diff --git a/APG/android-libs/ActionBarSherlock/src/com/actionbarsherlock/internal/widget/IcsLinearLayout.java b/APG/android-libs/ActionBarSherlock/src/com/actionbarsherlock/internal/widget/IcsLinearLayout.java
index 1b4463a59..4947c41df 100644
--- a/APG/android-libs/ActionBarSherlock/src/com/actionbarsherlock/internal/widget/IcsLinearLayout.java
+++ b/APG/android-libs/ActionBarSherlock/src/com/actionbarsherlock/internal/widget/IcsLinearLayout.java
@@ -6,6 +6,8 @@ import android.graphics.Canvas;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.view.View;
+import android.widget.LinearLayout;
+
import com.actionbarsherlock.internal.nineoldandroids.widget.NineLinearLayout;
/**
@@ -16,14 +18,16 @@ import com.actionbarsherlock.internal.nineoldandroids.widget.NineLinearLayout;
* {@link android.widget.FrameLayout} so it can receive the margin.
*/
public class IcsLinearLayout extends NineLinearLayout {
- private static final int[] LinearLayout = new int[] {
+ private static final int[] R_styleable_LinearLayout = new int[] {
/* 0 */ android.R.attr.divider,
- /* 1 */ android.R.attr.showDividers,
- /* 2 */ android.R.attr.dividerPadding,
+ /* 1 */ android.R.attr.measureWithLargestChild,
+ /* 2 */ android.R.attr.showDividers,
+ /* 3 */ android.R.attr.dividerPadding,
};
private static final int LinearLayout_divider = 0;
- private static final int LinearLayout_showDividers = 1;
- private static final int LinearLayout_dividerPadding = 2;
+ private static final int LinearLayout_measureWithLargestChild = 1;
+ private static final int LinearLayout_showDividers = 2;
+ private static final int LinearLayout_dividerPadding = 3;
/**
* Don't show any dividers.
@@ -49,15 +53,17 @@ public class IcsLinearLayout extends NineLinearLayout {
private int mShowDividers;
private int mDividerPadding;
+ private boolean mUseLargestChild;
public IcsLinearLayout(Context context, AttributeSet attrs) {
super(context, attrs);
- TypedArray a = context.obtainStyledAttributes(attrs, /*com.android.internal.R.styleable.*/LinearLayout);
+ TypedArray a = context.obtainStyledAttributes(attrs, /*com.android.internal.R.styleable.*/R_styleable_LinearLayout);
setDividerDrawable(a.getDrawable(/*com.android.internal.R.styleable.*/LinearLayout_divider));
mShowDividers = a.getInt(/*com.android.internal.R.styleable.*/LinearLayout_showDividers, SHOW_DIVIDER_NONE);
mDividerPadding = a.getDimensionPixelSize(/*com.android.internal.R.styleable.*/LinearLayout_dividerPadding, 0);
+ mUseLargestChild = a.getBoolean(/*com.android.internal.R.styleable.*/LinearLayout_measureWithLargestChild, false);
a.recycle();
}
@@ -199,7 +205,7 @@ public class IcsLinearLayout extends NineLinearLayout {
if (child == null) {
bottom = getHeight() - getPaddingBottom() - mDividerHeight;
} else {
- final LayoutParams lp = (LayoutParams) child.getLayoutParams();
+ //final LayoutParams lp = (LayoutParams) child.getLayoutParams();
bottom = child.getBottom()/* + lp.bottomMargin*/;
}
drawHorizontalDivider(canvas, bottom);
@@ -226,7 +232,7 @@ public class IcsLinearLayout extends NineLinearLayout {
if (child == null) {
right = getWidth() - getPaddingRight() - mDividerWidth;
} else {
- final LayoutParams lp = (LayoutParams) child.getLayoutParams();
+ //final LayoutParams lp = (LayoutParams) child.getLayoutParams();
right = child.getRight()/* + lp.rightMargin*/;
}
drawVerticalDivider(canvas, right);
@@ -269,4 +275,136 @@ public class IcsLinearLayout extends NineLinearLayout {
}
return false;
}
+
+ /**
+ * When true, all children with a weight will be considered having
+ * the minimum size of the largest child. If false, all children are
+ * measured normally.
+ *
+ * @return True to measure children with a weight using the minimum
+ * size of the largest child, false otherwise.
+ *
+ * @attr ref android.R.styleable#LinearLayout_measureWithLargestChild
+ */
+ public boolean isMeasureWithLargestChildEnabled() {
+ return mUseLargestChild;
+ }
+
+ /**
+ * When set to true, all children with a weight will be considered having
+ * the minimum size of the largest child. If false, all children are
+ * measured normally.
+ *
+ * Disabled by default.
+ *
+ * @param enabled True to measure children with a weight using the
+ * minimum size of the largest child, false otherwise.
+ *
+ * @attr ref android.R.styleable#LinearLayout_measureWithLargestChild
+ */
+ public void setMeasureWithLargestChildEnabled(boolean enabled) {
+ mUseLargestChild = enabled;
+ }
+
+ @Override
+ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
+ super.onMeasure(widthMeasureSpec, heightMeasureSpec);
+
+ if (mUseLargestChild) {
+ final int orientation = getOrientation();
+ switch (orientation) {
+ case HORIZONTAL:
+ useLargestChildHorizontal();
+ break;
+
+ case VERTICAL:
+ useLargestChildVertical();
+ break;
+ }
+ }
+ }
+
+ private void useLargestChildHorizontal() {
+ final int childCount = getChildCount();
+
+ // Find largest child width
+ int largestChildWidth = 0;
+ for (int i = 0; i < childCount; i++) {
+ final View child = getChildAt(i);
+ largestChildWidth = Math.max(child.getMeasuredWidth(), largestChildWidth);
+ }
+
+ int totalWidth = 0;
+ // Re-measure childs
+ for (int i = 0; i < childCount; i++) {
+ final View child = getChildAt(i);
+
+ if (child == null || child.getVisibility() == View.GONE) {
+ continue;
+ }
+
+ final LinearLayout.LayoutParams lp =
+ (LinearLayout.LayoutParams) child.getLayoutParams();
+
+ float childExtra = lp.weight;
+ if (childExtra > 0) {
+ child.measure(
+ MeasureSpec.makeMeasureSpec(largestChildWidth,
+ MeasureSpec.EXACTLY),
+ MeasureSpec.makeMeasureSpec(child.getMeasuredHeight(),
+ MeasureSpec.EXACTLY));
+ totalWidth += largestChildWidth;
+
+ } else {
+ totalWidth += child.getMeasuredWidth();
+ }
+
+ totalWidth += lp.leftMargin + lp.rightMargin;
+ }
+
+ totalWidth += getPaddingLeft() + getPaddingRight();
+ setMeasuredDimension(totalWidth, getMeasuredHeight());
+ }
+
+ private void useLargestChildVertical() {
+ final int childCount = getChildCount();
+
+ // Find largest child width
+ int largestChildHeight = 0;
+ for (int i = 0; i < childCount; i++) {
+ final View child = getChildAt(i);
+ largestChildHeight = Math.max(child.getMeasuredHeight(), largestChildHeight);
+ }
+
+ int totalHeight = 0;
+ // Re-measure childs
+ for (int i = 0; i < childCount; i++) {
+ final View child = getChildAt(i);
+
+ if (child == null || child.getVisibility() == View.GONE) {
+ continue;
+ }
+
+ final LinearLayout.LayoutParams lp =
+ (LinearLayout.LayoutParams) child.getLayoutParams();
+
+ float childExtra = lp.weight;
+ if (childExtra > 0) {
+ child.measure(
+ MeasureSpec.makeMeasureSpec(child.getMeasuredWidth(),
+ MeasureSpec.EXACTLY),
+ MeasureSpec.makeMeasureSpec(largestChildHeight,
+ MeasureSpec.EXACTLY));
+ totalHeight += largestChildHeight;
+
+ } else {
+ totalHeight += child.getMeasuredHeight();
+ }
+
+ totalHeight += lp.leftMargin + lp.rightMargin;
+ }
+
+ totalHeight += getPaddingLeft() + getPaddingRight();
+ setMeasuredDimension(getMeasuredWidth(), totalHeight);
+ }
}
diff --git a/APG/android-libs/ActionBarSherlock/src/com/actionbarsherlock/internal/widget/ScrollingTabContainerView.java b/APG/android-libs/ActionBarSherlock/src/com/actionbarsherlock/internal/widget/ScrollingTabContainerView.java
index 1a532e06c..48fb5d8b4 100644
--- a/APG/android-libs/ActionBarSherlock/src/com/actionbarsherlock/internal/widget/ScrollingTabContainerView.java
+++ b/APG/android-libs/ActionBarSherlock/src/com/actionbarsherlock/internal/widget/ScrollingTabContainerView.java
@@ -188,6 +188,7 @@ public class ScrollingTabContainerView extends NineHorizontalScrollView
private IcsLinearLayout createTabLayout() {
final IcsLinearLayout tabLayout = (IcsLinearLayout) LayoutInflater.from(getContext())
.inflate(R.layout.abs__action_bar_tab_bar_view, null);
+ tabLayout.setMeasureWithLargestChildEnabled(true);
tabLayout.setLayoutParams(new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.MATCH_PARENT));
return tabLayout;