1
0
mirror of https://github.com/moparisthebest/Yaaic synced 2024-11-25 10:22:16 -05:00

Update ActionBarSherlock to 4.1.0 release.

This commit is contained in:
Sebastian Kaspari 2012-05-19 11:00:23 +02:00
parent c292892307
commit cb5354a306
41 changed files with 377 additions and 236 deletions

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="51" android:versionName="4.0.1-SNAPSHOT" package="com.actionbarsherlock"> <manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="90" android:versionName="4.1.0" package="com.actionbarsherlock">
<uses-sdk android:minSdkVersion="7" android:targetSdkVersion="15"/> <uses-sdk android:minSdkVersion="7" android:targetSdkVersion="15"/>

View File

@ -11,7 +11,7 @@
<parent> <parent>
<groupId>com.actionbarsherlock</groupId> <groupId>com.actionbarsherlock</groupId>
<artifactId>parent</artifactId> <artifactId>parent</artifactId>
<version>4.0.1</version> <version>4.1.0</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
@ -148,39 +148,4 @@
</plugins> </plugins>
</pluginManagement> </pluginManagement>
</build> </build>
<profiles>
<profile>
<id>release</id>
<activation>
<property>
<name>performRelease</name>
<value>true</value>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<version>${android-maven.version}</version>
<configuration>
<manifest>
<versionCodeAutoIncrement>true</versionCodeAutoIncrement>
</manifest>
</configuration>
<executions>
<execution>
<id>manifestUpdate</id>
<phase>process-resources</phase>
<goals>
<goal>manifest-update</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project> </project>

Binary file not shown.

After

Width:  |  Height:  |  Size: 882 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1003 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

@ -14,8 +14,7 @@
limitations under the License. limitations under the License.
--> -->
<selector xmlns:android="http://schemas.android.com/apk/res/android" <selector xmlns:android="http://schemas.android.com/apk/res/android">
android:exitFadeDuration="@android:integer/config_mediumAnimTime">
<item android:state_activated="true" android:drawable="@drawable/abs__list_activated_holo" /> <item android:state_activated="true" android:drawable="@drawable/abs__list_activated_holo" />
<item android:drawable="@android:color/transparent" /> <item android:drawable="@android:color/transparent" />
</selector> </selector>

View File

@ -14,8 +14,7 @@
limitations under the License. limitations under the License.
--> -->
<selector xmlns:android="http://schemas.android.com/apk/res/android" <selector xmlns:android="http://schemas.android.com/apk/res/android">
android:exitFadeDuration="@android:integer/config_mediumAnimTime">
<item android:state_activated="true" android:drawable="@drawable/abs__list_activated_holo" /> <item android:state_activated="true" android:drawable="@drawable/abs__list_activated_holo" />
<item android:drawable="@android:color/transparent" /> <item android:drawable="@android:color/transparent" />
</selector> </selector>

View File

@ -14,8 +14,7 @@
limitations under the License. limitations under the License.
--> -->
<selector xmlns:android="http://schemas.android.com/apk/res/android" <selector xmlns:android="http://schemas.android.com/apk/res/android">
android:exitFadeDuration="@android:integer/config_mediumAnimTime">
<item android:state_pressed="true" <item android:state_pressed="true"
android:drawable="@drawable/abs__btn_cab_done_pressed_holo_dark" /> android:drawable="@drawable/abs__btn_cab_done_pressed_holo_dark" />
<item android:state_focused="true" android:state_enabled="true" <item android:state_focused="true" android:state_enabled="true"

View File

@ -14,8 +14,7 @@
limitations under the License. limitations under the License.
--> -->
<selector xmlns:android="http://schemas.android.com/apk/res/android" <selector xmlns:android="http://schemas.android.com/apk/res/android">
android:exitFadeDuration="@android:integer/config_mediumAnimTime">
<item android:state_pressed="true" <item android:state_pressed="true"
android:drawable="@drawable/abs__btn_cab_done_pressed_holo_light" /> android:drawable="@drawable/abs__btn_cab_done_pressed_holo_light" />
<item android:state_focused="true" android:state_enabled="true" <item android:state_focused="true" android:state_enabled="true"

View File

@ -14,8 +14,7 @@
limitations under the License. limitations under the License.
--> -->
<selector xmlns:android="http://schemas.android.com/apk/res/android" <selector xmlns:android="http://schemas.android.com/apk/res/android">
android:exitFadeDuration="@android:integer/config_mediumAnimTime">
<!-- Even though these two point to the same resource, have two states so the drawable will invalidate itself when coming out of pressed state. --> <!-- Even though these two point to the same resource, have two states so the drawable will invalidate itself when coming out of pressed state. -->
<item android:state_focused="true" android:state_enabled="false" android:state_pressed="true" android:drawable="@drawable/abs__list_selector_disabled_holo_dark" /> <item android:state_focused="true" android:state_enabled="false" android:state_pressed="true" android:drawable="@drawable/abs__list_selector_disabled_holo_dark" />

View File

@ -14,8 +14,7 @@
limitations under the License. limitations under the License.
--> -->
<selector xmlns:android="http://schemas.android.com/apk/res/android" <selector xmlns:android="http://schemas.android.com/apk/res/android">
android:exitFadeDuration="@android:integer/config_mediumAnimTime">
<!-- Even though these two point to the same resource, have two states so the drawable will invalidate itself when coming out of pressed state. --> <!-- Even though these two point to the same resource, have two states so the drawable will invalidate itself when coming out of pressed state. -->
<item android:state_focused="true" android:state_enabled="false" android:state_pressed="true" android:drawable="@drawable/abs__list_selector_disabled_holo_light" /> <item android:state_focused="true" android:state_enabled="false" android:state_pressed="true" android:drawable="@drawable/abs__list_selector_disabled_holo_light" />

View File

@ -14,8 +14,7 @@
limitations under the License. limitations under the License.
--> -->
<selector xmlns:android="http://schemas.android.com/apk/res/android" <selector xmlns:android="http://schemas.android.com/apk/res/android">
android:exitFadeDuration="@android:integer/config_mediumAnimTime">
<item android:state_window_focused="false" android:drawable="@android:color/transparent" /> <item android:state_window_focused="false" android:drawable="@android:color/transparent" />

View File

@ -14,8 +14,7 @@
limitations under the License. limitations under the License.
--> -->
<selector xmlns:android="http://schemas.android.com/apk/res/android" <selector xmlns:android="http://schemas.android.com/apk/res/android">
android:exitFadeDuration="@android:integer/config_mediumAnimTime">
<item android:state_window_focused="false" android:drawable="@android:color/transparent" /> <item android:state_window_focused="false" android:drawable="@android:color/transparent" />

View File

@ -18,6 +18,6 @@
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:divider="?attr/dividerVertical" android:divider="?attr/actionBarDivider"
android:dividerPadding="12dip" android:dividerPadding="12dip"
android:gravity="center_vertical" /> android:gravity="center_vertical" />

View File

@ -19,10 +19,10 @@ This is an optimized layout for a screen with the Action Bar enabled.
--> -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" android:orientation="vertical"
android:fitsSystemWindows="true" android:fitsSystemWindows="true">
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<com.actionbarsherlock.internal.widget.ActionBarContainer <com.actionbarsherlock.internal.widget.ActionBarContainer
android:id="@+id/abs__action_bar_container" android:id="@+id/abs__action_bar_container"
android:layout_width="fill_parent" android:layout_width="fill_parent"

View File

@ -19,38 +19,41 @@ This is an optimized layout for a screen with
the Action Bar enabled overlaying application content. the Action Bar enabled overlaying application content.
--> -->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"> android:fitsSystemWindows="true">
<com.actionbarsherlock.internal.nineoldandroids.widget.NineFrameLayout android:id="@+id/abs__content" <com.actionbarsherlock.internal.nineoldandroids.widget.NineFrameLayout android:id="@+id/abs__content"
android:layout_width="fill_parent" android:layout_width="match_parent"
android:layout_height="fill_parent" /> android:layout_height="match_parent" />
<com.actionbarsherlock.internal.widget.ActionBarContainer android:id="@+id/abs__action_bar_container" <com.actionbarsherlock.internal.widget.ActionBarContainer android:id="@+id/abs__action_bar_container"
android:layout_width="fill_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentTop="true"
style="?attr/actionBarStyle" style="?attr/actionBarStyle"
android:gravity="top"> android:gravity="top">
<com.actionbarsherlock.internal.widget.ActionBarView <com.actionbarsherlock.internal.widget.ActionBarView
android:id="@+id/abs__action_bar" android:id="@+id/abs__action_bar"
android:layout_width="fill_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
style="?attr/actionBarStyle" /> style="?attr/actionBarStyle" />
<com.actionbarsherlock.internal.widget.ActionBarContextView <com.actionbarsherlock.internal.widget.ActionBarContextView
android:id="@+id/abs__action_context_bar" android:id="@+id/abs__action_context_bar"
android:layout_width="fill_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:visibility="gone" android:visibility="gone"
style="?attr/actionModeStyle" /> style="?attr/actionModeStyle" />
</com.actionbarsherlock.internal.widget.ActionBarContainer> </com.actionbarsherlock.internal.widget.ActionBarContainer>
<ImageView android:src="?attr/windowContentOverlay" <ImageView android:src="?attr/windowContentOverlay"
android:scaleType="fitXY" android:scaleType="fitXY"
android:layout_width="fill_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@id/abs__action_bar_container" /> android:layout_below="@id/abs__action_bar_container" />
<com.actionbarsherlock.internal.widget.ActionBarContainer android:id="@+id/abs__split_action_bar" <com.actionbarsherlock.internal.widget.ActionBarContainer android:id="@+id/abs__split_action_bar"
android:layout_width="fill_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentBottom="true" android:layout_gravity="bottom"
style="?attr/actionBarSplitStyle" style="?attr/actionBarSplitStyle"
android:visibility="gone" android:visibility="gone"
android:gravity="center"/> android:gravity="center"/>
</RelativeLayout> </FrameLayout>

View File

@ -21,6 +21,8 @@ enabled.
--> -->
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"> android:fitsSystemWindows="true">
<com.actionbarsherlock.internal.nineoldandroids.widget.NineFrameLayout <com.actionbarsherlock.internal.nineoldandroids.widget.NineFrameLayout
android:id="@+id/abs__content" android:id="@+id/abs__content"

View File

@ -10,6 +10,10 @@
<item name="actionBarSize">?android:attr/actionBarSize</item> <item name="actionBarSize">?android:attr/actionBarSize</item>
<!-- Needed for our bug-fix dropdown list navigation layout. :( --> <!-- Needed for our bug-fix dropdown list navigation layout. :( -->
<item name="dropdownListPreferredItemHeight">48dp</item> <item name="dropdownListPreferredItemHeight">48dp</item>
<!-- Needed for our ShareActionProvider implementation. -->
<item name="android:actionBarWidgetTheme">@style/Theme.Sherlock</item>
<!-- For crazy people who use IcsSpinner. -->
<item name="dropDownListViewStyle">?android:attr/dropDownListViewStyle</item>
</style> </style>
<style name="Theme.Sherlock.NoActionBar"> <style name="Theme.Sherlock.NoActionBar">

View File

@ -74,7 +74,7 @@
<style name="Widget.Sherlock.ActionBar.TabView" parent="Widget"> <style name="Widget.Sherlock.ActionBar.TabView" parent="Widget">
<item name="android:gravity">center_horizontal</item> <item name="android:gravity">center_horizontal</item>
<item name="android:background">@drawable/abs__tab_indicator_holo</item> <item name="android:background">@drawable/abs__tab_indicator_ab_holo</item>
<item name="android:paddingLeft">16dip</item> <item name="android:paddingLeft">16dip</item>
<item name="android:paddingRight">16dip</item> <item name="android:paddingRight">16dip</item>
</style> </style>
@ -112,7 +112,7 @@
<item name="android:background">?attr/actionBarItemBackground</item> <item name="android:background">?attr/actionBarItemBackground</item>
<item name="android:minHeight">?attr/actionBarSize</item> <item name="android:minHeight">?attr/actionBarSize</item>
<item name="android:minWidth">56dip</item> <item name="android:minWidth">@dimen/abs__action_button_min_width</item>
<item name="android:gravity">center</item> <item name="android:gravity">center</item>
<item name="android:paddingLeft">12dip</item> <item name="android:paddingLeft">12dip</item>
<item name="android:paddingRight">12dip</item> <item name="android:paddingRight">12dip</item>

View File

@ -0,0 +1,144 @@
package android.support.v4.app;
import android.util.Log;
import android.view.View;
import android.view.Window;
import com.actionbarsherlock.ActionBarSherlock.OnCreatePanelMenuListener;
import com.actionbarsherlock.ActionBarSherlock.OnMenuItemSelectedListener;
import com.actionbarsherlock.ActionBarSherlock.OnPreparePanelListener;
import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuInflater;
import com.actionbarsherlock.view.MenuItem;
import java.util.ArrayList;
/** I'm in ur package. Stealing ur variables. */
public abstract class _ActionBarSherlockTrojanHorse extends FragmentActivity implements OnCreatePanelMenuListener, OnPreparePanelListener, OnMenuItemSelectedListener {
private static final boolean DEBUG = false;
private static final String TAG = "_ActionBarSherlockTrojanHorse";
/** Fragment interface for menu creation callback. */
public interface OnCreateOptionsMenuListener {
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater);
}
/** Fragment interface for menu preparation callback. */
public interface OnPrepareOptionsMenuListener {
public void onPrepareOptionsMenu(Menu menu);
}
/** Fragment interface for menu item selection callback. */
public interface OnOptionsItemSelectedListener {
public boolean onOptionsItemSelected(MenuItem item);
}
private ArrayList<Fragment> mCreatedMenus;
///////////////////////////////////////////////////////////////////////////
// Sherlock menu handling
///////////////////////////////////////////////////////////////////////////
@Override
public boolean onCreatePanelMenu(int featureId, Menu menu) {
if (DEBUG) Log.d(TAG, "[onCreatePanelMenu] featureId: " + featureId + ", menu: " + menu);
if (featureId == Window.FEATURE_OPTIONS_PANEL) {
boolean result = onCreateOptionsMenu(menu);
if (DEBUG) Log.d(TAG, "[onCreatePanelMenu] activity create result: " + result);
MenuInflater inflater = getSupportMenuInflater();
boolean show = false;
ArrayList<Fragment> newMenus = null;
if (mFragments.mActive != null) {
for (int i = 0; i < mFragments.mAdded.size(); i++) {
Fragment f = mFragments.mAdded.get(i);
if (f != null && !f.mHidden && f.mHasMenu && f.mMenuVisible && f instanceof OnCreateOptionsMenuListener) {
show = true;
((OnCreateOptionsMenuListener)f).onCreateOptionsMenu(menu, inflater);
if (newMenus == null) {
newMenus = new ArrayList<Fragment>();
}
newMenus.add(f);
}
}
}
if (mCreatedMenus != null) {
for (int i = 0; i < mCreatedMenus.size(); i++) {
Fragment f = mCreatedMenus.get(i);
if (newMenus == null || !newMenus.contains(f)) {
f.onDestroyOptionsMenu();
}
}
}
mCreatedMenus = newMenus;
if (DEBUG) Log.d(TAG, "[onCreatePanelMenu] fragments create result: " + show);
result |= show;
if (DEBUG) Log.d(TAG, "[onCreatePanelMenu] returning " + result);
return result;
}
return false;
}
@Override
public boolean onPreparePanel(int featureId, View view, Menu menu) {
if (DEBUG) Log.d(TAG, "[onPreparePanel] featureId: " + featureId + ", view: " + view + " menu: " + menu);
if (featureId == Window.FEATURE_OPTIONS_PANEL) {
boolean result = onPrepareOptionsMenu(menu);
if (DEBUG) Log.d(TAG, "[onPreparePanel] activity prepare result: " + result);
boolean show = false;
if (mFragments.mActive != null) {
for (int i = 0; i < mFragments.mAdded.size(); i++) {
Fragment f = mFragments.mAdded.get(i);
if (f != null && !f.mHidden && f.mHasMenu && f.mMenuVisible && f instanceof OnPrepareOptionsMenuListener) {
show = true;
((OnPrepareOptionsMenuListener)f).onPrepareOptionsMenu(menu);
}
}
}
if (DEBUG) Log.d(TAG, "[onPreparePanel] fragments prepare result: " + show);
result |= show;
result &= menu.hasVisibleItems();
if (DEBUG) Log.d(TAG, "[onPreparePanel] returning " + result);
return result;
}
return false;
}
@Override
public boolean onMenuItemSelected(int featureId, MenuItem item) {
if (DEBUG) Log.d(TAG, "[onMenuItemSelected] featureId: " + featureId + ", item: " + item);
if (featureId == Window.FEATURE_OPTIONS_PANEL) {
if (onOptionsItemSelected(item)) {
return true;
}
if (mFragments.mActive != null) {
for (int i = 0; i < mFragments.mAdded.size(); i++) {
Fragment f = mFragments.mAdded.get(i);
if (f != null && !f.mHidden && f.mHasMenu && f.mMenuVisible && f instanceof OnOptionsItemSelectedListener) {
if (((OnOptionsItemSelectedListener)f).onOptionsItemSelected(item)) {
return true;
}
}
}
}
}
return false;
}
public abstract boolean onCreateOptionsMenu(Menu menu);
public abstract boolean onPrepareOptionsMenu(Menu menu);
public abstract boolean onOptionsItemSelected(MenuItem item);
public abstract MenuInflater getSupportMenuInflater();
}

View File

@ -37,7 +37,6 @@ import com.actionbarsherlock.view.MenuItem;
* counterpart and you should refer to its documentation for instruction.</p> * counterpart and you should refer to its documentation for instruction.</p>
* *
* @author Jake Wharton <jakewharton@gmail.com> * @author Jake Wharton <jakewharton@gmail.com>
* @version 4.0.0
*/ */
public abstract class ActionBarSherlock { public abstract class ActionBarSherlock {
protected static final String TAG = "ActionBarSherlock"; protected static final String TAG = "ActionBarSherlock";
@ -524,6 +523,20 @@ public abstract class ActionBarSherlock {
*/ */
public void dispatchPanelClosed(int featureId, android.view.Menu menu) {} public void dispatchPanelClosed(int featureId, android.view.Menu menu) {}
/**
* Notify the action bar that the activity has been destroyed. This method
* should be called before the superclass implementation.
*
* <blockquote><p>
* @Override
* public void onDestroy() {
* mSherlock.dispatchDestroy();
* super.onDestroy();
* }
* </p></blockquote>
*/
public void dispatchDestroy() {}
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////

View File

@ -76,6 +76,12 @@ public abstract class SherlockActivity extends Activity implements OnCreatePanel
super.onStop(); super.onStop();
} }
@Override
protected void onDestroy() {
getSherlock().dispatchDestroy();
super.onDestroy();
}
@Override @Override
protected void onPostCreate(Bundle savedInstanceState) { protected void onPostCreate(Bundle savedInstanceState) {
getSherlock().dispatchPostCreate(savedInstanceState); getSherlock().dispatchPostCreate(savedInstanceState);

View File

@ -1,18 +1,18 @@
package com.actionbarsherlock.app; package com.actionbarsherlock.app;
import static com.actionbarsherlock.app.SherlockFragmentActivity.DEBUG;
import android.app.Activity; import android.app.Activity;
import android.support.v4.app.DialogFragment; import android.support.v4.app.DialogFragment;
import android.util.Log; import com.actionbarsherlock.internal.view.menu.MenuItemWrapper;
import com.actionbarsherlock.internal.view.menu.MenuItemMule; import com.actionbarsherlock.internal.view.menu.MenuWrapper;
import com.actionbarsherlock.internal.view.menu.MenuMule;
import com.actionbarsherlock.view.Menu; import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuInflater; import com.actionbarsherlock.view.MenuInflater;
import com.actionbarsherlock.view.MenuItem; import com.actionbarsherlock.view.MenuItem;
public class SherlockDialogFragment extends DialogFragment { import static com.actionbarsherlock.app.SherlockFragmentActivity.OnCreateOptionsMenuListener;
private static final String TAG = "SherlockDialogFragment"; import static com.actionbarsherlock.app.SherlockFragmentActivity.OnOptionsItemSelectedListener;
import static com.actionbarsherlock.app.SherlockFragmentActivity.OnPrepareOptionsMenuListener;
public class SherlockDialogFragment extends DialogFragment implements OnCreateOptionsMenuListener, OnPrepareOptionsMenuListener, OnOptionsItemSelectedListener {
private SherlockFragmentActivity mActivity; private SherlockFragmentActivity mActivity;
public SherlockFragmentActivity getSherlockActivity() { public SherlockFragmentActivity getSherlockActivity() {
@ -22,7 +22,7 @@ public class SherlockDialogFragment extends DialogFragment {
@Override @Override
public void onAttach(Activity activity) { public void onAttach(Activity activity) {
if (!(activity instanceof SherlockFragmentActivity)) { if (!(activity instanceof SherlockFragmentActivity)) {
throw new IllegalStateException(TAG + " must be attached to a SherlockFragmentActivity."); throw new IllegalStateException(getClass().getSimpleName() + " must be attached to a SherlockFragmentActivity.");
} }
mActivity = (SherlockFragmentActivity)activity; mActivity = (SherlockFragmentActivity)activity;
@ -30,41 +30,37 @@ public class SherlockDialogFragment extends DialogFragment {
} }
@Override @Override
public final void onCreateOptionsMenu(android.view.Menu menu, android.view.MenuInflater inflater) { public void onDetach() {
if (DEBUG) Log.d(TAG, "[onCreateOptionsMenu] menu: " + menu + ", inflater: " + inflater); mActivity = null;
super.onDetach();
if (menu instanceof MenuMule) {
onCreateOptionsMenu(((MenuMule)menu).unwrap(), mActivity.getSupportMenuInflater());
}
} }
@Override
public final void onCreateOptionsMenu(android.view.Menu menu, android.view.MenuInflater inflater) {
onCreateOptionsMenu(new MenuWrapper(menu), mActivity.getSupportMenuInflater());
}
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
//Nothing to see here. //Nothing to see here.
} }
@Override @Override
public final void onPrepareOptionsMenu(android.view.Menu menu) { public final void onPrepareOptionsMenu(android.view.Menu menu) {
if (DEBUG) Log.d(TAG, "[onPrepareOptionsMenu] menu: " + menu); onPrepareOptionsMenu(new MenuWrapper(menu));
if (menu instanceof MenuMule) {
onPrepareOptionsMenu(((MenuMule)menu).unwrap());
}
} }
@Override
public void onPrepareOptionsMenu(Menu menu) { public void onPrepareOptionsMenu(Menu menu) {
//Nothing to see here. //Nothing to see here.
} }
@Override @Override
public final boolean onOptionsItemSelected(android.view.MenuItem item) { public final boolean onOptionsItemSelected(android.view.MenuItem item) {
if (DEBUG) Log.d(TAG, "[onOptionsItemSelected] item: " + item); return onOptionsItemSelected(new MenuItemWrapper(item));
if (item instanceof MenuItemMule) {
return onOptionsItemSelected(((MenuItemMule)item).unwrap());
}
return false;
} }
@Override
public boolean onOptionsItemSelected(MenuItem item) { public boolean onOptionsItemSelected(MenuItem item) {
//Nothing to see here. //Nothing to see here.
return false; return false;

View File

@ -76,6 +76,12 @@ public abstract class SherlockExpandableListActivity extends ExpandableListActiv
super.onStop(); super.onStop();
} }
@Override
protected void onDestroy() {
getSherlock().dispatchDestroy();
super.onDestroy();
}
@Override @Override
protected void onPostCreate(Bundle savedInstanceState) { protected void onPostCreate(Bundle savedInstanceState) {
getSherlock().dispatchPostCreate(savedInstanceState); getSherlock().dispatchPostCreate(savedInstanceState);

View File

@ -1,18 +1,18 @@
package com.actionbarsherlock.app; package com.actionbarsherlock.app;
import static com.actionbarsherlock.app.SherlockFragmentActivity.DEBUG;
import android.app.Activity; import android.app.Activity;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
import android.util.Log; import com.actionbarsherlock.internal.view.menu.MenuItemWrapper;
import com.actionbarsherlock.internal.view.menu.MenuItemMule; import com.actionbarsherlock.internal.view.menu.MenuWrapper;
import com.actionbarsherlock.internal.view.menu.MenuMule;
import com.actionbarsherlock.view.Menu; import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuInflater; import com.actionbarsherlock.view.MenuInflater;
import com.actionbarsherlock.view.MenuItem; import com.actionbarsherlock.view.MenuItem;
public class SherlockFragment extends Fragment { import static com.actionbarsherlock.app.SherlockFragmentActivity.OnCreateOptionsMenuListener;
private static final String TAG = "SherlockFragment"; import static com.actionbarsherlock.app.SherlockFragmentActivity.OnOptionsItemSelectedListener;
import static com.actionbarsherlock.app.SherlockFragmentActivity.OnPrepareOptionsMenuListener;
public class SherlockFragment extends Fragment implements OnCreateOptionsMenuListener, OnPrepareOptionsMenuListener, OnOptionsItemSelectedListener {
private SherlockFragmentActivity mActivity; private SherlockFragmentActivity mActivity;
public SherlockFragmentActivity getSherlockActivity() { public SherlockFragmentActivity getSherlockActivity() {
@ -22,7 +22,7 @@ public class SherlockFragment extends Fragment {
@Override @Override
public void onAttach(Activity activity) { public void onAttach(Activity activity) {
if (!(activity instanceof SherlockFragmentActivity)) { if (!(activity instanceof SherlockFragmentActivity)) {
throw new IllegalStateException(TAG + " must be attached to a SherlockFragmentActivity."); throw new IllegalStateException(getClass().getSimpleName() + " must be attached to a SherlockFragmentActivity.");
} }
mActivity = (SherlockFragmentActivity)activity; mActivity = (SherlockFragmentActivity)activity;
@ -30,41 +30,37 @@ public class SherlockFragment extends Fragment {
} }
@Override @Override
public final void onCreateOptionsMenu(android.view.Menu menu, android.view.MenuInflater inflater) { public void onDetach() {
if (DEBUG) Log.d(TAG, "[onCreateOptionsMenu] menu: " + menu + ", inflater: " + inflater); mActivity = null;
super.onDetach();
if (menu instanceof MenuMule) {
onCreateOptionsMenu(((MenuMule)menu).unwrap(), mActivity.getSupportMenuInflater());
}
} }
@Override
public final void onCreateOptionsMenu(android.view.Menu menu, android.view.MenuInflater inflater) {
onCreateOptionsMenu(new MenuWrapper(menu), mActivity.getSupportMenuInflater());
}
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
//Nothing to see here. //Nothing to see here.
} }
@Override @Override
public final void onPrepareOptionsMenu(android.view.Menu menu) { public final void onPrepareOptionsMenu(android.view.Menu menu) {
if (DEBUG) Log.d(TAG, "[onPrepareOptionsMenu] menu: " + menu); onPrepareOptionsMenu(new MenuWrapper(menu));
if (menu instanceof MenuMule) {
onPrepareOptionsMenu(((MenuMule)menu).unwrap());
}
} }
@Override
public void onPrepareOptionsMenu(Menu menu) { public void onPrepareOptionsMenu(Menu menu) {
//Nothing to see here. //Nothing to see here.
} }
@Override @Override
public final boolean onOptionsItemSelected(android.view.MenuItem item) { public final boolean onOptionsItemSelected(android.view.MenuItem item) {
if (DEBUG) Log.d(TAG, "[onOptionsItemSelected] item: " + item); return onOptionsItemSelected(new MenuItemWrapper(item));
if (item instanceof MenuItemMule) {
return onOptionsItemSelected(((MenuItemMule)item).unwrap());
}
return false;
} }
@Override
public boolean onOptionsItemSelected(MenuItem item) { public boolean onOptionsItemSelected(MenuItem item) {
//Nothing to see here. //Nothing to see here.
return false; return false;

View File

@ -1,36 +1,31 @@
package com.actionbarsherlock.app; package com.actionbarsherlock.app;
import android.content.res.Configuration; import android.content.res.Configuration;
import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.app.FragmentActivity; import android.support.v4.app._ActionBarSherlockTrojanHorse;
import android.util.Log; import android.util.Log;
import android.view.KeyEvent; import android.view.KeyEvent;
import android.view.View; import android.view.View;
import android.view.ViewGroup.LayoutParams; import android.view.ViewGroup.LayoutParams;
import android.view.Window; import android.view.Window;
import com.actionbarsherlock.ActionBarSherlock; import com.actionbarsherlock.ActionBarSherlock;
import com.actionbarsherlock.ActionBarSherlock.OnActionModeFinishedListener;
import com.actionbarsherlock.ActionBarSherlock.OnActionModeStartedListener;
import com.actionbarsherlock.ActionBarSherlock.OnCreatePanelMenuListener;
import com.actionbarsherlock.ActionBarSherlock.OnMenuItemSelectedListener;
import com.actionbarsherlock.ActionBarSherlock.OnPreparePanelListener;
import com.actionbarsherlock.internal.view.menu.MenuItemMule;
import com.actionbarsherlock.internal.view.menu.MenuMule;
import com.actionbarsherlock.view.ActionMode; import com.actionbarsherlock.view.ActionMode;
import com.actionbarsherlock.view.Menu; import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuInflater; import com.actionbarsherlock.view.MenuInflater;
import com.actionbarsherlock.view.MenuItem; import com.actionbarsherlock.view.MenuItem;
public abstract class SherlockFragmentActivity extends FragmentActivity implements OnCreatePanelMenuListener, OnPreparePanelListener, OnMenuItemSelectedListener, OnActionModeStartedListener, OnActionModeFinishedListener { import static com.actionbarsherlock.ActionBarSherlock.OnActionModeFinishedListener;
static final boolean DEBUG = false; import static com.actionbarsherlock.ActionBarSherlock.OnActionModeStartedListener;
/** @see {@link _ActionBarSherlockTrojanHorse} */
public class SherlockFragmentActivity extends _ActionBarSherlockTrojanHorse implements OnActionModeStartedListener, OnActionModeFinishedListener {
private static final boolean DEBUG = false;
private static final String TAG = "SherlockFragmentActivity"; private static final String TAG = "SherlockFragmentActivity";
private ActionBarSherlock mSherlock; private ActionBarSherlock mSherlock;
private boolean mIgnoreNativeCreate = false; private boolean mIgnoreNativeCreate = false;
private boolean mIgnoreNativePrepare = false; private boolean mIgnoreNativePrepare = false;
private boolean mIgnoreNativeSelected = false; private boolean mIgnoreNativeSelected = false;
private Boolean mOverrideNativeCreate = null;
protected final ActionBarSherlock getSherlock() { protected final ActionBarSherlock getSherlock() {
if (mSherlock == null) { if (mSherlock == null) {
@ -87,6 +82,12 @@ public abstract class SherlockFragmentActivity extends FragmentActivity implemen
super.onStop(); super.onStop();
} }
@Override
protected void onDestroy() {
getSherlock().dispatchDestroy();
super.onDestroy();
}
@Override @Override
protected void onPostCreate(Bundle savedInstanceState) { protected void onPostCreate(Bundle savedInstanceState) {
getSherlock().dispatchPostCreate(savedInstanceState); getSherlock().dispatchPostCreate(savedInstanceState);
@ -138,7 +139,7 @@ public abstract class SherlockFragmentActivity extends FragmentActivity implemen
getSherlock().dispatchInvalidateOptionsMenu(); getSherlock().dispatchInvalidateOptionsMenu();
} }
protected void supportInvalidateOptionsMenu() { public void supportInvalidateOptionsMenu() {
if (DEBUG) Log.d(TAG, "[supportInvalidateOptionsMenu]"); if (DEBUG) Log.d(TAG, "[supportInvalidateOptionsMenu]");
invalidateOptionsMenu(); invalidateOptionsMenu();
@ -161,7 +162,7 @@ public abstract class SherlockFragmentActivity extends FragmentActivity implemen
@Override @Override
public final boolean onCreateOptionsMenu(android.view.Menu menu) { public final boolean onCreateOptionsMenu(android.view.Menu menu) {
return (mOverrideNativeCreate != null) ? mOverrideNativeCreate.booleanValue() : true; return true;
} }
@Override @Override
@ -223,70 +224,14 @@ public abstract class SherlockFragmentActivity extends FragmentActivity implemen
// Sherlock menu handling // Sherlock menu handling
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
@Override
public boolean onCreatePanelMenu(int featureId, Menu menu) {
if (DEBUG) Log.d(TAG, "[onCreatePanelMenu] featureId: " + featureId + ", menu: " + menu);
if (featureId == Window.FEATURE_OPTIONS_PANEL) {
boolean result = onCreateOptionsMenu(menu);
//Dispatch to parent panel creation for fragment dispatching
if (DEBUG) Log.d(TAG, "[onCreatePanelMenu] dispatching to native with mule");
mOverrideNativeCreate = result;
boolean fragResult = super.onCreatePanelMenu(featureId, new MenuMule(menu));
mOverrideNativeCreate = null;
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
result |= menu.hasVisibleItems();
} else {
result |= fragResult;
}
return result;
}
return false;
}
public boolean onCreateOptionsMenu(Menu menu) { public boolean onCreateOptionsMenu(Menu menu) {
return true; return true;
} }
@Override
public boolean onPreparePanel(int featureId, View view, Menu menu) {
if (DEBUG) Log.d(TAG, "[onPreparePanel] featureId: " + featureId + ", view: " + view + " menu: " + menu);
if (featureId == Window.FEATURE_OPTIONS_PANEL) {
boolean result = onPrepareOptionsMenu(menu);
//Dispatch to parent panel preparation for fragment dispatching
if (DEBUG) Log.d(TAG, "[onPreparePanel] dispatching to native with mule");
super.onPreparePanel(featureId, view, new MenuMule(menu));
return result;
}
return false;
}
public boolean onPrepareOptionsMenu(Menu menu) { public boolean onPrepareOptionsMenu(Menu menu) {
return true; return true;
} }
@Override
public boolean onMenuItemSelected(int featureId, MenuItem item) {
if (DEBUG) Log.d(TAG, "[onMenuItemSelected] featureId: " + featureId + ", item: " + item);
if (featureId == Window.FEATURE_OPTIONS_PANEL) {
if (onOptionsItemSelected(item)) {
return true;
}
//Dispatch to parent panel selection for fragment dispatching
if (DEBUG) Log.d(TAG, "[onMenuItemSelected] dispatching to native with mule");
return super.onMenuItemSelected(featureId, new MenuItemMule(item));
}
return false;
}
public boolean onOptionsItemSelected(MenuItem item) { public boolean onOptionsItemSelected(MenuItem item) {
return false; return false;
} }

View File

@ -76,6 +76,12 @@ public abstract class SherlockListActivity extends ListActivity implements OnCre
super.onStop(); super.onStop();
} }
@Override
protected void onDestroy() {
getSherlock().dispatchDestroy();
super.onDestroy();
}
@Override @Override
protected void onPostCreate(Bundle savedInstanceState) { protected void onPostCreate(Bundle savedInstanceState) {
getSherlock().dispatchPostCreate(savedInstanceState); getSherlock().dispatchPostCreate(savedInstanceState);

View File

@ -1,18 +1,18 @@
package com.actionbarsherlock.app; package com.actionbarsherlock.app;
import static com.actionbarsherlock.app.SherlockFragmentActivity.DEBUG;
import android.app.Activity; import android.app.Activity;
import android.support.v4.app.ListFragment; import android.support.v4.app.ListFragment;
import android.util.Log; import com.actionbarsherlock.internal.view.menu.MenuItemWrapper;
import com.actionbarsherlock.internal.view.menu.MenuItemMule; import com.actionbarsherlock.internal.view.menu.MenuWrapper;
import com.actionbarsherlock.internal.view.menu.MenuMule;
import com.actionbarsherlock.view.Menu; import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuInflater; import com.actionbarsherlock.view.MenuInflater;
import com.actionbarsherlock.view.MenuItem; import com.actionbarsherlock.view.MenuItem;
public class SherlockListFragment extends ListFragment { import static com.actionbarsherlock.app.SherlockFragmentActivity.OnCreateOptionsMenuListener;
private static final String TAG = "SherlockListFragment"; import static com.actionbarsherlock.app.SherlockFragmentActivity.OnOptionsItemSelectedListener;
import static com.actionbarsherlock.app.SherlockFragmentActivity.OnPrepareOptionsMenuListener;
public class SherlockListFragment extends ListFragment implements OnCreateOptionsMenuListener, OnPrepareOptionsMenuListener, OnOptionsItemSelectedListener {
private SherlockFragmentActivity mActivity; private SherlockFragmentActivity mActivity;
public SherlockFragmentActivity getSherlockActivity() { public SherlockFragmentActivity getSherlockActivity() {
@ -22,7 +22,7 @@ public class SherlockListFragment extends ListFragment {
@Override @Override
public void onAttach(Activity activity) { public void onAttach(Activity activity) {
if (!(activity instanceof SherlockFragmentActivity)) { if (!(activity instanceof SherlockFragmentActivity)) {
throw new IllegalStateException(TAG + " must be attached to a SherlockFragmentActivity."); throw new IllegalStateException(getClass().getSimpleName() + " must be attached to a SherlockFragmentActivity.");
} }
mActivity = (SherlockFragmentActivity)activity; mActivity = (SherlockFragmentActivity)activity;
@ -30,41 +30,37 @@ public class SherlockListFragment extends ListFragment {
} }
@Override @Override
public final void onCreateOptionsMenu(android.view.Menu menu, android.view.MenuInflater inflater) { public void onDetach() {
if (DEBUG) Log.d(TAG, "[onCreateOptionsMenu] menu: " + menu + ", inflater: " + inflater); mActivity = null;
super.onDetach();
if (menu instanceof MenuMule) {
onCreateOptionsMenu(((MenuMule)menu).unwrap(), mActivity.getSupportMenuInflater());
}
} }
@Override
public final void onCreateOptionsMenu(android.view.Menu menu, android.view.MenuInflater inflater) {
onCreateOptionsMenu(new MenuWrapper(menu), mActivity.getSupportMenuInflater());
}
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
//Nothing to see here. //Nothing to see here.
} }
@Override @Override
public final void onPrepareOptionsMenu(android.view.Menu menu) { public final void onPrepareOptionsMenu(android.view.Menu menu) {
if (DEBUG) Log.d(TAG, "[onPrepareOptionsMenu] menu: " + menu); onPrepareOptionsMenu(new MenuWrapper(menu));
if (menu instanceof MenuMule) {
onPrepareOptionsMenu(((MenuMule)menu).unwrap());
}
} }
@Override
public void onPrepareOptionsMenu(Menu menu) { public void onPrepareOptionsMenu(Menu menu) {
//Nothing to see here. //Nothing to see here.
} }
@Override @Override
public final boolean onOptionsItemSelected(android.view.MenuItem item) { public final boolean onOptionsItemSelected(android.view.MenuItem item) {
if (DEBUG) Log.d(TAG, "[onOptionsItemSelected] item: " + item); return onOptionsItemSelected(new MenuItemWrapper(item));
if (item instanceof MenuItemMule) {
return onOptionsItemSelected(((MenuItemMule)item).unwrap());
}
return false;
} }
@Override
public boolean onOptionsItemSelected(MenuItem item) { public boolean onOptionsItemSelected(MenuItem item) {
//Nothing to see here. //Nothing to see here.
return false; return false;

View File

@ -76,6 +76,12 @@ public abstract class SherlockPreferenceActivity extends PreferenceActivity impl
super.onStop(); super.onStop();
} }
@Override
protected void onDestroy() {
getSherlock().dispatchDestroy();
super.onDestroy();
}
@Override @Override
protected void onPostCreate(Bundle savedInstanceState) { protected void onPostCreate(Bundle savedInstanceState) {
getSherlock().dispatchPostCreate(savedInstanceState); getSherlock().dispatchPostCreate(savedInstanceState);

View File

@ -71,6 +71,8 @@ public class ActionBarSherlockCompat extends ActionBarSherlock implements MenuBu
private MenuBuilder mMenu; private MenuBuilder mMenu;
/** Map between native options items and sherlock items. */ /** Map between native options items and sherlock items. */
protected HashMap<android.view.MenuItem, MenuItemImpl> mNativeItemMap; 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.). */ /** Parent view of the window decoration (action bar, mode, etc.). */
private ViewGroup mDecor; private ViewGroup mDecor;
@ -79,6 +81,8 @@ public class ActionBarSherlockCompat extends ActionBarSherlock implements MenuBu
/** Whether or not the title is stable and can be displayed. */ /** Whether or not the title is stable and can be displayed. */
private boolean mIsTitleReady = false; private boolean mIsTitleReady = false;
/** Whether or not the parent activity has been destroyed. */
private boolean mIsDestroyed = false;
/* Emulate PanelFeatureState */ /* Emulate PanelFeatureState */
private boolean mClosingActionMenu; private boolean mClosingActionMenu;
@ -411,7 +415,7 @@ public class ActionBarSherlockCompat extends ActionBarSherlock implements MenuBu
} }
// Next collapse any expanded action views. // Next collapse any expanded action views.
if (aActionBar != null && wActionBar.hasExpandedActionView()) { if (wActionBar != null && wActionBar.hasExpandedActionView()) {
if (action == KeyEvent.ACTION_UP) { if (action == KeyEvent.ACTION_UP) {
wActionBar.collapseActionView(); wActionBar.collapseActionView();
} }
@ -420,20 +424,32 @@ public class ActionBarSherlockCompat extends ActionBarSherlock implements MenuBu
} }
} }
if (keyCode == KeyEvent.KEYCODE_MENU && event.getAction() == KeyEvent.ACTION_UP && isReservingOverflow()) { boolean result = false;
if (mActionMode == null) { if (keyCode == KeyEvent.KEYCODE_MENU && isReservingOverflow()) {
if (wActionBar.isOverflowMenuShowing()) { if (event.getAction() == KeyEvent.ACTION_DOWN && event.isLongPress()) {
wActionBar.hideOverflowMenu(); mMenuKeyIsLongPress = true;
} else { } else if (event.getAction() == KeyEvent.ACTION_UP) {
wActionBar.showOverflowMenu(); 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 true");
return true;
} }
if (DEBUG) Log.d(TAG, "[dispatchKeyEvent] returning false"); if (DEBUG) Log.d(TAG, "[dispatchKeyEvent] returning " + result);
return false; return result;
}
@Override
public void dispatchDestroy() {
mIsDestroyed = true;
} }
@ -968,7 +984,7 @@ public class ActionBarSherlockCompat extends ActionBarSherlock implements MenuBu
@Override @Override
public void run() { public void run() {
//Invalidate if the panel menu hasn't been created before this. //Invalidate if the panel menu hasn't been created before this.
if (mMenu == null) { if (!mIsDestroyed && !mActivity.isFinishing() && mMenu == null) {
dispatchInvalidateOptionsMenu(); dispatchInvalidateOptionsMenu();
} }
} }

View File

@ -314,5 +314,15 @@ public class ActionBarSherlockNative extends ActionBarSherlock {
public MenuInflater getMenuInflater() { public MenuInflater getMenuInflater() {
return ActionBarSherlockNative.this.getMenuInflater(); return ActionBarSherlockNative.this.getMenuInflater();
} }
@Override
public void setTag(Object tag) {
mActionMode.setTag(tag);
}
@Override
public Object getTag() {
return mActionMode.getTag();
}
} }
} }

View File

@ -217,7 +217,6 @@ public class ActionBarWrapper extends ActionBar implements android.app.ActionBar
public TabWrapper(android.app.ActionBar.Tab nativeTab) { public TabWrapper(android.app.ActionBar.Tab nativeTab) {
mNativeTab = nativeTab; mNativeTab = nativeTab;
mNativeTab.setTag(this); mNativeTab.setTag(this);
mNativeTab.setTabListener(this);
} }
@Override @Override
@ -289,6 +288,7 @@ public class ActionBarWrapper extends ActionBar implements android.app.ActionBar
@Override @Override
public Tab setTabListener(TabListener listener) { public Tab setTabListener(TabListener listener) {
mNativeTab.setTabListener(listener != null ? this : null);
mListener = listener; mListener = listener;
return this; return this;
} }

View File

@ -140,6 +140,8 @@ public final class AnimatorProxy extends Animation {
return; return;
} }
view.setAnimation(this);
final RectF after = mAfter; final RectF after = mAfter;
computeRect(after, view); computeRect(after, view);
after.union(mBefore); after.union(mBefore);
@ -202,4 +204,9 @@ public final class AnimatorProxy extends Animation {
transformMatrix(t.getMatrix(), view); transformMatrix(t.getMatrix(), view);
} }
} }
@Override
public void reset() {
/* Do nothing. */
}
} }

View File

@ -305,7 +305,7 @@ public class ActionMenuPresenter extends BaseMenuPresenter
*/ */
public boolean showOverflowMenu() { public boolean showOverflowMenu() {
if (mReserveOverflow && !isOverflowMenuShowing() && mMenu != null && mMenuView != null && if (mReserveOverflow && !isOverflowMenuShowing() && mMenu != null && mMenuView != null &&
mPostedOpenRunnable == null) { mPostedOpenRunnable == null && !mMenu.getNonActionItems().isEmpty()) {
OverflowPopup popup = new OverflowPopup(mContext, mMenu, mOverflowButton, true); OverflowPopup popup = new OverflowPopup(mContext, mMenu, mOverflowButton, true);
mPostedOpenRunnable = new OpenOverflowRunnable(popup); mPostedOpenRunnable = new OpenOverflowRunnable(popup);
// Post this for later; we might still need a layout for the anchor to be right. // Post this for later; we might still need a layout for the anchor to be right.

View File

@ -132,7 +132,7 @@ public class ActionBarView extends AbsActionBarView {
private SpinnerAdapter mSpinnerAdapter; private SpinnerAdapter mSpinnerAdapter;
private OnNavigationListener mCallback; private OnNavigationListener mCallback;
private Runnable mTabSelector; //UNUSED private Runnable mTabSelector;
private ExpandedActionViewMenuPresenter mExpandedMenuPresenter; private ExpandedActionViewMenuPresenter mExpandedMenuPresenter;
View mExpandedActionView; View mExpandedActionView;
@ -383,7 +383,7 @@ public class ActionBarView extends AbsActionBarView {
@Override @Override
public void onDetachedFromWindow() { public void onDetachedFromWindow() {
super.onDetachedFromWindow(); super.onDetachedFromWindow();
removeCallbacks(mTabSelector); //UNUSED removeCallbacks(mTabSelector);
if (mActionMenuPresenter != null) { if (mActionMenuPresenter != null) {
mActionMenuPresenter.hideOverflowMenu(); mActionMenuPresenter.hideOverflowMenu();
mActionMenuPresenter.hideSubMenus(); mActionMenuPresenter.hideSubMenus();

View File

@ -106,6 +106,30 @@ public class IcsLinearLayout extends NineLinearLayout {
requestLayout(); requestLayout();
} }
/**
* Set padding displayed on both ends of dividers.
*
* @param padding Padding value in pixels that will be applied to each end
*
* @see #setShowDividers(int)
* @see #setDividerDrawable(Drawable)
* @see #getDividerPadding()
*/
public void setDividerPadding(int padding) {
mDividerPadding = padding;
}
/**
* Get the padding size used to inset dividers in pixels
*
* @see #setShowDividers(int)
* @see #setDividerDrawable(Drawable)
* @see #setDividerPadding(int)
*/
public int getDividerPadding() {
return mDividerPadding;
}
/** /**
* Get the width of the current divider drawable. * Get the width of the current divider drawable.
* *

View File

@ -78,6 +78,10 @@ public class IcsSpinner extends IcsAbsSpinner implements OnClickListener {
private Rect mTempRect = new Rect(); private Rect mTempRect = new Rect();
public IcsSpinner(Context context, AttributeSet attrs) {
this(context, attrs, R.attr.actionDropDownStyle);
}
/** /**
* Construct a new spinner with the given context's theme, the supplied attribute set, * Construct a new spinner with the given context's theme, the supplied attribute set,
* and default style. * and default style.