Update ActionBarSherlock

This commit is contained in:
Dominik Schürmann 2012-12-12 13:58:22 +01:00
parent a4ea3e65a7
commit e3fea30abe
113 changed files with 3797 additions and 209 deletions

View File

@ -1,6 +1,6 @@
<?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="90" android:versionName="4.1.0" package="com.actionbarsherlock"> <manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="100" android:versionName="4.2.0" package="com.actionbarsherlock">
<uses-sdk android:minSdkVersion="7" android:targetSdkVersion="15"/> <uses-sdk android:minSdkVersion="7" android:targetSdkVersion="16"/>
</manifest> </manifest>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project name="com_actionbarsherlock" default="help"> <project name="ActionBarSherlock" default="help">
<!-- The local.properties file is created and updated by the 'android' tool. <!-- The local.properties file is created and updated by the 'android' tool.
It contains the path to the SDK. It should *NOT* be checked into It contains the path to the SDK. It should *NOT* be checked into
@ -28,6 +28,15 @@
--> -->
<property file="ant.properties" /> <property file="ant.properties" />
<!-- if sdk.dir was not set from one of the property file, then
get it from the ANDROID_HOME env var.
This must be done before we load project.properties since
the proguard config can use sdk.dir -->
<property environment="env" />
<condition property="sdk.dir" value="${env.ANDROID_HOME}">
<isset property="env.ANDROID_HOME" />
</condition>
<!-- The project.properties file is created and updated by the 'android' <!-- The project.properties file is created and updated by the 'android'
tool, as well as ADT. tool, as well as ADT.
@ -41,25 +50,23 @@
<!-- quick check on sdk.dir --> <!-- quick check on sdk.dir -->
<fail <fail
message="sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through an env var" message="sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through the ANDROID_HOME environment variable."
unless="sdk.dir" unless="sdk.dir"
/> />
<!-- extension targets. Uncomment the ones where you want to do custom work
in between standard targets -->
<!-- <!--
<target name="-pre-build"> Import per project custom build rules if present at the root of the project.
</target> This is the place to put custom intermediary targets such as:
<target name="-pre-compile"> -pre-build
</target> -pre-compile
-post-compile (This is typically used for code obfuscation.
/* This is typically used for code obfuscation.
Compiled code location: ${out.classes.absolute.dir} Compiled code location: ${out.classes.absolute.dir}
If this is not done in place, override ${out.dex.input.absolute.dir} */ If this is not done in place, override ${out.dex.input.absolute.dir})
<target name="-post-compile"> -post-package
</target> -post-build
-pre-clean
--> -->
<import file="custom_rules.xml" optional="true" />
<!-- Import the actual build file. <!-- Import the actual build file.

View File

@ -3,15 +3,14 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>com.actionbarsherlock</groupId> <artifactId>actionbarsherlock</artifactId>
<artifactId>library</artifactId>
<name>ActionBarSherlock</name> <name>ActionBarSherlock</name>
<packaging>apklib</packaging> <packaging>apklib</packaging>
<parent> <parent>
<groupId>com.actionbarsherlock</groupId> <groupId>com.actionbarsherlock</groupId>
<artifactId>parent</artifactId> <artifactId>parent</artifactId>
<version>4.1.0</version> <version>4.2.0</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
@ -26,11 +25,6 @@
<artifactId>support-v4</artifactId> <artifactId>support-v4</artifactId>
</dependency> </dependency>
<dependency>
<groupId>com.pivotallabs</groupId>
<artifactId>robolectric</artifactId>
<scope>test</scope>
</dependency>
<dependency> <dependency>
<groupId>junit</groupId> <groupId>junit</groupId>
<artifactId>junit</artifactId> <artifactId>junit</artifactId>
@ -47,6 +41,9 @@
<groupId>com.jayway.maven.plugins.android.generation2</groupId> <groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId> <artifactId>android-maven-plugin</artifactId>
<extensions>true</extensions> <extensions>true</extensions>
<configuration>
<nativeLibrariesDirectory>ignored</nativeLibrariesDirectory>
</configuration>
</plugin> </plugin>
<plugin> <plugin>
@ -132,7 +129,7 @@
<pluginExecutionFilter> <pluginExecutionFilter>
<groupId>com.google.code.maven-replacer-plugin</groupId> <groupId>com.google.code.maven-replacer-plugin</groupId>
<artifactId>maven-replacer-plugin</artifactId> <artifactId>maven-replacer-plugin</artifactId>
<versionRange>[1.4.1,)</versionRange> <versionRange>[1.4.0,)</versionRange>
<goals> <goals>
<goal>replace</goal> <goal>replace</goal>
</goals> </goals>

View File

@ -0,0 +1,20 @@
# To enable ProGuard in your project, edit project.properties
# to define the proguard.config property as described in that file.
#
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in ${sdk.dir}/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the ProGuard
# include property in project.properties.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 110 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 105 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 108 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 103 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 114 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 111 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 114 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 112 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 122 B

After

Width:  |  Height:  |  Size: 191 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 740 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 743 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 570 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 794 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 106 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 105 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 98 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 107 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 107 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 109 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 109 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 836 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 125 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 127 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 114 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 B

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2010 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="false"
android:drawable="@drawable/abs__ic_clear_disabled" />
<item
android:drawable="@drawable/abs__ic_clear_normal" />
</selector>

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2010 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="false"
android:drawable="@drawable/abs__ic_clear_search_api_disabled_holo_light" />
<item
android:drawable="@drawable/abs__ic_clear_search_api_holo_light" />
</selector>

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2010 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#F0A0A0A0"/>
<stroke android:width="2dp" color="#A00080FF"/>
<padding android:left="5dp" android:top="0dp"
android:right="5dp" android:bottom="1dp" />
</shape>

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2010 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#F0FFFFFF"/>
<stroke android:width="1dp" color="#A00080FF"/>
<padding android:left="5dp" android:top="0dp"
android:right="5dp" android:bottom="1dp" />
</shape>

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2011 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_focused="true"
android:drawable="@drawable/abs__textfield_search_selected_holo_dark" />
<item android:drawable="@drawable/abs__textfield_search_default_holo_dark" />
</selector>

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2011 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_focused="true"
android:drawable="@drawable/abs__textfield_search_selected_holo_light" />
<item android:drawable="@drawable/abs__textfield_search_default_holo_light" />
</selector>

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2011 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_focused="true"
android:drawable="@drawable/abs__textfield_search_right_selected_holo_dark" />
<item android:drawable="@drawable/abs__textfield_search_right_default_holo_dark" />
</selector>

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2011 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_focused="true"
android:drawable="@drawable/abs__textfield_search_right_selected_holo_light" />
<item android:drawable="@drawable/abs__textfield_search_right_default_holo_light" />
</selector>

View File

@ -19,7 +19,7 @@
<com.actionbarsherlock.internal.widget.IcsLinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <com.actionbarsherlock.internal.widget.IcsLinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/abs__activity_chooser_view_content" android:id="@+id/abs__activity_chooser_view_content"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="fill_parent" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
style="?attr/activityChooserViewStyle"> style="?attr/activityChooserViewStyle">

View File

@ -35,7 +35,7 @@ enabled.
android:layout_height="2dip" android:layout_height="2dip"
android:background="@color/abs__holo_blue_light" /> android:background="@color/abs__holo_blue_light" />
<FrameLayout <FrameLayout
android:layout_width="wrap_content" android:layout_height="0dp" android:layout_width="match_parent" android:layout_height="0dp"
android:layout_weight="1" android:layout_weight="1"
android:orientation="vertical" android:orientation="vertical"
android:foreground="?attr/windowContentOverlay"> android:foreground="?attr/windowContentOverlay">

View File

@ -0,0 +1,89 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
**
** Copyright 2008, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
-->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:paddingLeft="@dimen/abs__dropdownitem_text_padding_left"
android:paddingRight="4dip"
android:layout_width="match_parent"
android:layout_height="?attr/searchResultListItemHeight" >
<!-- Icons come first in the layout, since their placement doesn't depend on
the placement of the text views. -->
<ImageView android:id="@android:id/icon1"
android:layout_width="@dimen/abs__dropdownitem_icon_width"
android:layout_height="48dip"
android:scaleType="centerInside"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_alignParentBottom="true"
android:visibility="invisible" />
<ImageView android:id="@+id/edit_query"
android:layout_width="48dip"
android:layout_height="48dip"
android:scaleType="centerInside"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_alignParentBottom="true"
android:src="?attr/searchViewEditQuery"
android:background="?attr/searchViewEditQueryBackground"
android:visibility="gone" />
<ImageView android:id="@android:id/icon2"
android:layout_width="48dip"
android:layout_height="48dip"
android:scaleType="centerInside"
android:layout_alignWithParentIfMissing="true"
android:layout_toLeftOf="@id/edit_query"
android:layout_alignParentTop="true"
android:layout_alignParentBottom="true"
android:visibility="gone" />
<!-- The subtitle comes before the title, since the height of the title depends on whether the
subtitle is visible or gone. -->
<TextView android:id="@android:id/text2"
style="?android:attr/dropDownItemStyle"
android:textAppearance="?attr/textAppearanceSearchResultSubtitle"
android:singleLine="true"
android:layout_width="match_parent"
android:layout_height="29dip"
android:paddingBottom="4dip"
android:gravity="top"
android:layout_toRightOf="@android:id/icon1"
android:layout_toLeftOf="@android:id/icon2"
android:layout_alignWithParentIfMissing="true"
android:layout_alignParentBottom="true"
android:visibility="gone" />
<!-- The title is placed above the subtitle, if there is one. If there is no
subtitle, it fills the parent. -->
<TextView android:id="@android:id/text1"
style="?android:attr/dropDownItemStyle"
android:textAppearance="?attr/textAppearanceSearchResultTitle"
android:singleLine="true"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toRightOf="@android:id/icon1"
android:layout_toLeftOf="@android:id/icon2"
android:layout_above="@android:id/text2" />
</RelativeLayout>

View File

@ -0,0 +1,159 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
* Copyright (C) 2010 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/abs__search_bar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
>
<!-- This is actually used for the badge icon *or* the badge label (or neither) -->
<TextView
android:id="@+id/abs__search_badge"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:layout_marginBottom="2dip"
android:drawablePadding="0dip"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="?attr/textColorPrimary"
android:visibility="gone"
/>
<ImageView
android:id="@+id/abs__search_button"
style="?android:attr/actionButtonStyle"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:src="?attr/searchViewSearchIcon"
android:contentDescription="@string/abs__searchview_description_search"
/>
<LinearLayout
android:id="@+id/abs__search_edit_frame"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_gravity="center_vertical"
android:layout_marginTop="4dip"
android:layout_marginBottom="4dip"
android:layout_marginLeft="8dip"
android:layout_marginRight="8dip"
android:orientation="horizontal">
<ImageView
android:id="@+id/abs__search_mag_icon"
android:layout_width="@dimen/abs__dropdownitem_icon_width"
android:layout_height="wrap_content"
android:scaleType="centerInside"
android:layout_marginLeft="@dimen/abs__dropdownitem_text_padding_left"
android:layout_gravity="center_vertical"
android:src="?attr/searchViewSearchIcon"
android:visibility="gone"
/>
<!-- Inner layout contains the app icon, button(s) and EditText -->
<LinearLayout
android:id="@+id/abs__search_plate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_gravity="center_vertical"
android:orientation="horizontal"
android:background="?attr/searchViewTextField">
<view class="com.actionbarsherlock.widget.SearchView$SearchAutoComplete"
style="?attr/searchAutoCompleteTextView"
android:id="@+id/abs__search_src_text"
android:layout_height="36dip"
android:layout_width="0dp"
android:layout_weight="1"
android:minWidth="@dimen/abs__search_view_text_min_width"
android:layout_gravity="bottom"
android:paddingLeft="@dimen/abs__dropdownitem_text_padding_left"
android:paddingRight="@dimen/abs__dropdownitem_text_padding_right"
android:singleLine="true"
android:ellipsize="end"
android:background="@null"
android:inputType="text|textAutoComplete|textNoSuggestions"
android:imeOptions="actionSearch"
android:dropDownHeight="wrap_content"
android:dropDownAnchor="@id/abs__search_edit_frame"
android:dropDownVerticalOffset="0dip"
android:dropDownHorizontalOffset="0dip"
android:contentDescription="@string/abs__searchview_description_query"
/>
<ImageView
android:id="@+id/abs__search_close_btn"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:paddingLeft="8dip"
android:paddingRight="8dip"
android:layout_gravity="center_vertical"
android:background="?attr/selectableItemBackground"
android:src="?attr/searchViewCloseIcon"
android:focusable="true"
android:contentDescription="@string/abs__searchview_description_clear"
/>
</LinearLayout>
<LinearLayout
android:id="@+id/abs__submit_area"
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="?attr/searchViewTextFieldRight">
<ImageView
android:id="@+id/abs__search_go_btn"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:paddingLeft="16dip"
android:paddingRight="16dip"
android:background="?attr/selectableItemBackground"
android:src="?attr/searchViewGoIcon"
android:visibility="gone"
android:focusable="true"
android:contentDescription="@string/abs__searchview_description_submit"
/>
<ImageView
android:id="@+id/abs__search_voice_btn"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:paddingLeft="16dip"
android:paddingRight="16dip"
android:src="?attr/searchViewVoiceIcon"
android:background="?attr/selectableItemBackground"
android:visibility="gone"
android:focusable="true"
android:contentDescription="@string/abs__searchview_description_voice"
/>
</LinearLayout>
</LinearLayout>
</LinearLayout>

View File

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
**
** Copyright 2008, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
-->
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/text1"
android:textAppearance="?android:attr/dropDownHintAppearance"
android:singleLine="true"
android:layout_marginLeft="3dip"
android:layout_marginTop="3dip"
android:layout_marginRight="3dip"
android:layout_marginBottom="3dip"
android:layout_width="match_parent"
android:layout_height="wrap_content" />

View File

@ -85,6 +85,11 @@
<style name="Widget.Sherlock.Light.ProgressBar.Horizontal" parent="android:Widget.Holo.Light.ProgressBar.Horizontal"> <style name="Widget.Sherlock.Light.ProgressBar.Horizontal" parent="android:Widget.Holo.Light.ProgressBar.Horizontal">
</style> </style>
<style name="Widget.Sherlock.SearchAutoCompleteTextView" parent="android:Widget.Holo.AutoCompleteTextView">
</style>
<style name="Widget.Sherlock.Light.SearchAutoCompleteTextView" parent="android:Widget.Holo.Light.AutoCompleteTextView">
</style>
<style name="TextAppearance.Sherlock.Widget.ActionBar.Menu" parent="android:TextAppearance.Holo.Widget.ActionBar.Menu"> <style name="TextAppearance.Sherlock.Widget.ActionBar.Menu" parent="android:TextAppearance.Holo.Widget.ActionBar.Menu">
</style> </style>

View File

@ -10,10 +10,12 @@
<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. --> <!-- Needed for our ShareActionProvider and SearchView implementation. -->
<item name="android:actionBarWidgetTheme">@style/Theme.Sherlock</item> <item name="android:actionBarWidgetTheme">@style/Theme.Sherlock</item>
<!-- For crazy people who use IcsSpinner. --> <!-- For crazy people who use IcsSpinner. -->
<item name="dropDownListViewStyle">?android:attr/dropDownListViewStyle</item> <item name="dropDownListViewStyle">?android:attr/dropDownListViewStyle</item>
<!-- Needed for our SearchView implementation. -->
<item name="selectableItemBackground">?android:attr/selectableItemBackground</item>
</style> </style>
<style name="Theme.Sherlock.NoActionBar"> <style name="Theme.Sherlock.NoActionBar">

View File

@ -74,6 +74,9 @@
<!-- Small Button style. --> <!-- Small Button style. -->
<attr name="buttonStyleSmall" format="reference" /> <attr name="buttonStyleSmall" format="reference" />
<!-- Background drawable for standalone items that need focus/pressed states. -->
<attr name="selectableItemBackground" format="reference" />
<!-- This Drawable is overlaid over the foreground of the Window's content area, usually <!-- This Drawable is overlaid over the foreground of the Window's content area, usually
@ -97,6 +100,40 @@
<attr name="spinnerItemStyle" format="reference" /> <attr name="spinnerItemStyle" format="reference" />
<attr name="spinnerDropDownItemStyle" format="reference" /> <attr name="spinnerDropDownItemStyle" format="reference" />
<!-- ============================ -->
<!-- SearchView styles and assets -->
<!-- ============================ -->
<eat-comment />
<!-- SearchView AutoCompleteTextView style -->
<attr name="searchAutoCompleteTextView" format="reference" />
<!-- SearchView dropdown background -->
<attr name="searchDropdownBackground" format="reference" />
<!-- SearchView close button icon -->
<attr name="searchViewCloseIcon" format="reference" />
<!-- SearchView Go button icon -->
<attr name="searchViewGoIcon" format="reference" />
<!-- SearchView Search icon -->
<attr name="searchViewSearchIcon" format="reference" />
<!-- SearchView Voice button icon -->
<attr name="searchViewVoiceIcon" format="reference" />
<!-- SearchView query refinement icon -->
<attr name="searchViewEditQuery" format="reference" />
<!-- SearchView query refinement icon background -->
<attr name="searchViewEditQueryBackground" format="reference" />
<!-- SearchView text field background for the left section -->
<attr name="searchViewTextField" format="reference" />
<!-- SearchView text field background for the right section -->
<attr name="searchViewTextFieldRight" format="reference" />
<!-- Text color for urls in search suggestions, used by things like global search and the browser. @hide -->
<attr name="textColorSearchUrl" format="reference|color" />
<!-- The list item height for search results. @hide -->
<attr name="searchResultListItemHeight" format="dimension" />
<!-- Text color, typeface, size, and style for system search result title. Defaults to primary inverse text color. -->
<attr name="textAppearanceSearchResultTitle" format="reference" />
<!-- Text color, typeface, size, and style for system search result subtitle. Defaults to primary inverse text color. -->
<attr name="textAppearanceSearchResultSubtitle" format="reference" />
<!-- =========== --> <!-- =========== -->
<!-- List styles --> <!-- List styles -->
<!-- =========== --> <!-- =========== -->
@ -144,9 +181,6 @@
<!-- Drawable used as a background for activated items. --> <!-- Drawable used as a background for activated items. -->
<attr name="activatedBackgroundIndicator" format="reference" /> <attr name="activatedBackgroundIndicator" format="reference" />
<!-- Specified if we are forcing an action item overflow menu. -->
<attr name="absForceOverflow" format="boolean" />
<attr name="android:windowIsFloating" /> <attr name="android:windowIsFloating" />
</declare-styleable> </declare-styleable>
@ -377,4 +411,22 @@
<!-- Gravity setting for positioning the currently selected item. --> <!-- Gravity setting for positioning the currently selected item. -->
<attr name="android:gravity" /> <attr name="android:gravity" />
</declare-styleable> </declare-styleable>
<declare-styleable name="SherlockSearchView">
<!-- The default state of the SearchView. If true, it will be iconified when not in
use and expanded when clicked. -->
<attr name="iconifiedByDefault" format="boolean"/>
<!-- An optional maximum width of the SearchView. -->
<attr name="android:maxWidth" />
<!-- An optional query hint string to be displayed in the empty query field. -->
<attr name="queryHint" format="string" />
<!-- The IME options to set on the query text field. -->
<attr name="android:imeOptions" />
<!-- The input type to set on the query text field. -->
<attr name="android:inputType" />
</declare-styleable>
<declare-styleable name="SherlockView">
<attr name="android:focusable"/>
</declare-styleable>
</resources> </resources>

View File

@ -47,4 +47,21 @@
is along the minor axis (that is the screen is portrait). This may is along the minor axis (that is the screen is portrait). This may
be either a fraction or a dimension. --> be either a fraction or a dimension. -->
<item type="dimen" name="abs__dialog_min_width_minor">95%</item> <item type="dimen" name="abs__dialog_min_width_minor">95%</item>
<!-- Text padding for dropdown items -->
<dimen name="abs__dropdownitem_text_padding_left">8dip</dimen>
<!-- Text padding for dropdown items -->
<dimen name="abs__dropdownitem_text_padding_right">8dip</dimen>
<!-- Width of the icon in a dropdown list -->
<dimen name="abs__dropdownitem_icon_width">32dip</dimen>
<!-- Minimum width of the search view text entry area. -->
<dimen name="abs__search_view_text_min_width">160dip</dimen>
<!-- Preferred width of the search view. -->
<dimen name="abs__search_view_preferred_width">320dip</dimen>
</resources> </resources>

View File

@ -39,4 +39,15 @@
<string name="abs__shareactionprovider_share_with">Share with</string> <string name="abs__shareactionprovider_share_with">Share with</string>
<!-- Description of a share target (both in the list of such or the default share button) in a ShareActionProvider (share UI). [CHAR LIMIT=NONE] --> <!-- Description of a share target (both in the list of such or the default share button) in a ShareActionProvider (share UI). [CHAR LIMIT=NONE] -->
<string name="abs__shareactionprovider_share_with_application">Share with <xliff:g id="application_name" example="Bluetooth">%s</xliff:g></string> <string name="abs__shareactionprovider_share_with_application">Share with <xliff:g id="application_name" example="Bluetooth">%s</xliff:g></string>
<!-- SearchView accessibility description for search button [CHAR LIMIT=NONE] -->
<string name="abs__searchview_description_search">Search</string>
<!-- SearchView accessibility description for search text field [CHAR LIMIT=NONE] -->
<string name="abs__searchview_description_query">Search query</string>
<!-- SearchView accessibility description for clear button [CHAR LIMIT=NONE] -->
<string name="abs__searchview_description_clear">Clear query</string>
<!-- SearchView accessibility description for submit button [CHAR LIMIT=NONE] -->
<string name="abs__searchview_description_submit">Submit query</string>
<!-- SearchView accessibility description for voice button [CHAR LIMIT=NONE] -->
<string name="abs__searchview_description_voice">Voice search</string>
</resources> </resources>

View File

@ -182,6 +182,7 @@
<item name="android:divider">?attr/dividerVertical</item> <item name="android:divider">?attr/dividerVertical</item>
<item name="android:showDividers">middle</item> <item name="android:showDividers">middle</item>
<item name="android:dividerPadding">6dip</item> <item name="android:dividerPadding">6dip</item>
<item name="android:minHeight">?attr/actionBarSize</item>
</style> </style>
<style name="Widget.Sherlock.ActivityChooserView" parent="Sherlock.__Widget.ActivityChooserView"> <style name="Widget.Sherlock.ActivityChooserView" parent="Sherlock.__Widget.ActivityChooserView">
</style> </style>
@ -279,6 +280,28 @@
<style name="Sherlock.__Widget.SearchAutoCompleteTextView" parent="Widget">
<item name="android:focusable">true</item>
<item name="android:focusableInTouchMode">true</item>
<item name="android:clickable">true</item>
<item name="android:textAppearance">?android:attr/textAppearanceMediumInverse</item>
<item name="android:textColor">?attr/textColorPrimary</item>
<item name="android:gravity">center_vertical</item>
<item name="android:completionHintView">@layout/abs__simple_dropdown_hint</item>
<item name="android:completionThreshold">2</item>
<item name="android:dropDownWidth">wrap_content</item>
</style>
<style name="Widget.Sherlock.SearchAutoCompleteTextView" parent="Sherlock.__Widget.SearchAutoCompleteTextView">
<item name="android:dropDownSelector">@drawable/abs__list_selector_holo_dark</item>
<item name="android:popupBackground">@drawable/abs__menu_dropdown_panel_holo_dark</item>
</style>
<style name="Widget.Sherlock.Light.SearchAutoCompleteTextView" parent="Sherlock.__Widget.SearchAutoCompleteTextView">
<item name="android:dropDownSelector">@drawable/abs__list_selector_holo_light</item>
<item name="android:popupBackground">@drawable/abs__menu_dropdown_panel_holo_light</item>
</style>
<style name="DialogWindowTitle.Sherlock" parent="Widget"> <style name="DialogWindowTitle.Sherlock" parent="Widget">
<item name="android:maxLines">1</item> <item name="android:maxLines">1</item>
<item name="android:scrollHorizontally">true</item> <item name="android:scrollHorizontally">true</item>
@ -381,4 +404,9 @@
</style> </style>
<style name="TextAppearance.Sherlock.Light.Small" parent="TextAppearance.Sherlock.Small"> <style name="TextAppearance.Sherlock.Light.Small" parent="TextAppearance.Sherlock.Small">
</style> </style>
<style name="TextAppearance.Sherlock.Widget.DropDownHint" parent="Widget">
<item name="android:textColor">?textColorPrimary</item>
<item name="android:textSize">14sp</item>
</style>
</resources> </resources>

View File

@ -35,10 +35,12 @@
<item name="actionMenuTextAppearance">@style/TextAppearance.Sherlock.Widget.ActionBar.Menu</item> <item name="actionMenuTextAppearance">@style/TextAppearance.Sherlock.Widget.ActionBar.Menu</item>
<item name="actionMenuTextColor">?attr/textColorPrimary</item> <item name="actionMenuTextColor">?attr/textColorPrimary</item>
<item name="actionBarDivider">?attr/dividerVertical</item> <item name="actionBarDivider">?attr/dividerVertical</item>
<item name="actionBarItemBackground">@drawable/abs__item_background_holo_dark</item> <item name="actionBarItemBackground">?attr/selectableItemBackground</item>
<item name="buttonStyleSmall">@style/Widget.Sherlock.Button.Small</item> <item name="buttonStyleSmall">@style/Widget.Sherlock.Button.Small</item>
<item name="selectableItemBackground">@drawable/abs__item_background_holo_dark</item>
<item name="activatedBackgroundIndicator">@drawable/abs__activated_background_holo_dark</item> <item name="activatedBackgroundIndicator">@drawable/abs__activated_background_holo_dark</item>
<item name="actionModeShareDrawable">@drawable/abs__ic_menu_share_holo_dark</item> <item name="actionModeShareDrawable">@drawable/abs__ic_menu_share_holo_dark</item>
<item name="activityChooserViewStyle">@style/Widget.Sherlock.ActivityChooserView</item> <item name="activityChooserViewStyle">@style/Widget.Sherlock.ActivityChooserView</item>
@ -64,6 +66,16 @@
<item name="popupMenuStyle">@style/Widget.Sherlock.PopupMenu</item> <item name="popupMenuStyle">@style/Widget.Sherlock.PopupMenu</item>
<!-- Internal --><item name="listPopupWindowStyle">@style/Widget.Sherlock.ListPopupWindow</item> <!-- Internal --><item name="listPopupWindowStyle">@style/Widget.Sherlock.ListPopupWindow</item>
<item name="searchDropdownBackground">@drawable/abs__search_dropdown_dark</item>
<item name="searchViewTextField">@drawable/abs__textfield_searchview_holo_dark</item>
<item name="searchViewTextFieldRight">@drawable/abs__textfield_searchview_right_holo_dark</item>
<item name="searchViewCloseIcon">@drawable/abs__ic_clear</item>
<item name="searchViewSearchIcon">@drawable/abs__ic_search</item>
<item name="searchViewGoIcon">@drawable/abs__ic_go</item>
<item name="searchViewVoiceIcon">@drawable/abs__ic_voice_search</item>
<item name="searchAutoCompleteTextView">@style/Widget.Sherlock.SearchAutoCompleteTextView</item>
<item name="android:dropDownHintAppearance">@style/TextAppearance.Sherlock.Widget.DropDownHint</item>
<item name="windowActionBar">true</item> <item name="windowActionBar">true</item>
<item name="windowActionModeOverlay">false</item> <item name="windowActionModeOverlay">false</item>
<item name="windowContentOverlay">@null</item> <item name="windowContentOverlay">@null</item>
@ -91,10 +103,12 @@
<item name="actionMenuTextAppearance">@style/TextAppearance.Sherlock.Widget.ActionBar.Menu</item> <item name="actionMenuTextAppearance">@style/TextAppearance.Sherlock.Widget.ActionBar.Menu</item>
<item name="actionMenuTextColor">?attr/textColorPrimary</item> <item name="actionMenuTextColor">?attr/textColorPrimary</item>
<item name="actionBarDivider">?attr/dividerVertical</item> <item name="actionBarDivider">?attr/dividerVertical</item>
<item name="actionBarItemBackground">@drawable/abs__item_background_holo_light</item> <item name="actionBarItemBackground">?attr/selectableItemBackground</item>
<item name="buttonStyleSmall">@style/Widget.Sherlock.Light.Button.Small</item> <item name="buttonStyleSmall">@style/Widget.Sherlock.Light.Button.Small</item>
<item name="selectableItemBackground">@drawable/abs__item_background_holo_light</item>
<item name="activatedBackgroundIndicator">@drawable/abs__activated_background_holo_light</item> <item name="activatedBackgroundIndicator">@drawable/abs__activated_background_holo_light</item>
<item name="actionModeShareDrawable">@drawable/abs__ic_menu_share_holo_light</item> <item name="actionModeShareDrawable">@drawable/abs__ic_menu_share_holo_light</item>
<item name="activityChooserViewStyle">@style/Widget.Sherlock.Light.ActivityChooserView</item> <item name="activityChooserViewStyle">@style/Widget.Sherlock.Light.ActivityChooserView</item>
@ -120,6 +134,16 @@
<item name="popupMenuStyle">@style/Widget.Sherlock.Light.PopupMenu</item> <item name="popupMenuStyle">@style/Widget.Sherlock.Light.PopupMenu</item>
<!-- Internal --><item name="listPopupWindowStyle">@style/Widget.Sherlock.Light.ListPopupWindow</item> <!-- Internal --><item name="listPopupWindowStyle">@style/Widget.Sherlock.Light.ListPopupWindow</item>
<item name="searchDropdownBackground">@drawable/abs__search_dropdown_light</item>
<item name="searchViewTextField">@drawable/abs__textfield_searchview_holo_light</item>
<item name="searchViewTextFieldRight">@drawable/abs__textfield_searchview_right_holo_light</item>
<item name="searchViewCloseIcon">@drawable/abs__ic_clear_holo_light</item>
<item name="searchViewSearchIcon">@drawable/abs__ic_search_api_holo_light</item>
<item name="searchViewGoIcon">@drawable/abs__ic_go_search_api_holo_light</item>
<item name="searchViewVoiceIcon">@drawable/abs__ic_voice_search_api_holo_light</item>
<item name="searchAutoCompleteTextView">@style/Widget.Sherlock.Light.SearchAutoCompleteTextView</item>
<item name="android:dropDownHintAppearance">@style/TextAppearance.Sherlock.Widget.DropDownHint</item>
<item name="windowActionBar">true</item> <item name="windowActionBar">true</item>
<item name="windowActionModeOverlay">false</item> <item name="windowActionModeOverlay">false</item>
<item name="windowContentOverlay">@null</item> <item name="windowContentOverlay">@null</item>
@ -160,17 +184,6 @@
</style> </style>
<style name="Theme.Sherlock.ForceOverflow">
<item name="absForceOverflow">true</item>
</style>
<style name="Theme.Sherlock.Light.ForceOverflow">
<item name="absForceOverflow">true</item>
</style>
<style name="Theme.Sherlock.Light.DarkActionBar.ForceOverflow">
<item name="absForceOverflow">true</item>
</style>
<style name="Theme.Sherlock.Dialog" parent="android:Theme"> <style name="Theme.Sherlock.Dialog" parent="android:Theme">
<item name="android:windowFrame">@null</item> <item name="android:windowFrame">@null</item>
<item name="android:windowTitleStyle">@style/DialogWindowTitle.Sherlock</item> <item name="android:windowTitleStyle">@style/DialogWindowTitle.Sherlock</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 Watson extends FragmentActivity implements OnCreatePanelMenuListener, OnPreparePanelListener, OnMenuItemSelectedListener {
private static final boolean DEBUG = false;
private static final String TAG = "Watson";
/** 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.mAdded != 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.mAdded != 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.mAdded != 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

@ -537,6 +537,9 @@ public abstract class ActionBarSherlock {
*/ */
public void dispatchDestroy() {} public void dispatchDestroy() {}
public void dispatchSaveInstanceState(Bundle outState) {}
public void dispatchRestoreInstanceState(Bundle savedInstanceState) {}
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
@ -769,7 +772,7 @@ public abstract class ActionBarSherlock {
// Make sure that action views can get an appropriate theme. // Make sure that action views can get an appropriate theme.
if (mMenuInflater == null) { if (mMenuInflater == null) {
if (getActionBar() != null) { if (getActionBar() != null) {
mMenuInflater = new MenuInflater(getThemedContext()); mMenuInflater = new MenuInflater(getThemedContext(), mActivity);
} else { } else {
mMenuInflater = new MenuInflater(mActivity); mMenuInflater = new MenuInflater(mActivity);
} }

View File

@ -17,6 +17,7 @@
package com.actionbarsherlock.app; package com.actionbarsherlock.app;
import android.content.Context; import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.support.v4.app.FragmentTransaction; import android.support.v4.app.FragmentTransaction;
import android.util.AttributeSet; import android.util.AttributeSet;
@ -895,6 +896,10 @@ public abstract class ActionBar {
* @attr ref android.R.styleable#ActionBar_LayoutParams_layout_gravity * @attr ref android.R.styleable#ActionBar_LayoutParams_layout_gravity
*/ */
public static class LayoutParams extends MarginLayoutParams { public static class LayoutParams extends MarginLayoutParams {
private static final int[] ATTRS = new int[] {
android.R.attr.layout_gravity
};
/** /**
* Gravity for the view associated with these LayoutParams. * Gravity for the view associated with these LayoutParams.
* *
@ -918,6 +923,10 @@ public abstract class ActionBar {
public LayoutParams(Context c, AttributeSet attrs) { public LayoutParams(Context c, AttributeSet attrs) {
super(c, attrs); super(c, attrs);
TypedArray a = c.obtainStyledAttributes(attrs, ATTRS);
gravity = a.getInt(0, -1);
a.recycle();
} }
public LayoutParams(int width, int height) { public LayoutParams(int width, int height) {

View File

@ -116,6 +116,17 @@ public abstract class SherlockActivity extends Activity implements OnCreatePanel
return super.dispatchKeyEvent(event); return super.dispatchKeyEvent(event);
} }
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
getSherlock().dispatchSaveInstanceState(outState);
}
@Override
protected void onRestoreInstanceState(Bundle savedInstanceState) {
super.onRestoreInstanceState(savedInstanceState);
getSherlock().dispatchRestoreInstanceState(savedInstanceState);
}
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// Native menu handling // Native menu handling

View File

@ -2,7 +2,7 @@ package com.actionbarsherlock.app;
import android.content.res.Configuration; import android.content.res.Configuration;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.app._ActionBarSherlockTrojanHorse; import android.support.v4.app.Watson;
import android.util.Log; import android.util.Log;
import android.view.KeyEvent; import android.view.KeyEvent;
import android.view.View; import android.view.View;
@ -17,8 +17,8 @@ import com.actionbarsherlock.view.MenuItem;
import static com.actionbarsherlock.ActionBarSherlock.OnActionModeFinishedListener; import static com.actionbarsherlock.ActionBarSherlock.OnActionModeFinishedListener;
import static com.actionbarsherlock.ActionBarSherlock.OnActionModeStartedListener; import static com.actionbarsherlock.ActionBarSherlock.OnActionModeStartedListener;
/** @see {@link _ActionBarSherlockTrojanHorse} */ /** @see {@link android.support.v4.app.Watson} */
public class SherlockFragmentActivity extends _ActionBarSherlockTrojanHorse implements OnActionModeStartedListener, OnActionModeFinishedListener { public class SherlockFragmentActivity extends Watson implements OnActionModeStartedListener, OnActionModeFinishedListener {
private static final boolean DEBUG = false; private static final boolean DEBUG = false;
private static final String TAG = "SherlockFragmentActivity"; private static final String TAG = "SherlockFragmentActivity";
@ -122,6 +122,17 @@ public class SherlockFragmentActivity extends _ActionBarSherlockTrojanHorse impl
return super.dispatchKeyEvent(event); return super.dispatchKeyEvent(event);
} }
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
getSherlock().dispatchSaveInstanceState(outState);
}
@Override
protected void onRestoreInstanceState(Bundle savedInstanceState) {
super.onRestoreInstanceState(savedInstanceState);
getSherlock().dispatchRestoreInstanceState(savedInstanceState);
}
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// Native menu handling // Native menu handling

View File

@ -116,6 +116,17 @@ public abstract class SherlockListActivity extends ListActivity implements OnCre
return super.dispatchKeyEvent(event); return super.dispatchKeyEvent(event);
} }
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
getSherlock().dispatchSaveInstanceState(outState);
}
@Override
protected void onRestoreInstanceState(Bundle savedInstanceState) {
super.onRestoreInstanceState(savedInstanceState);
getSherlock().dispatchRestoreInstanceState(savedInstanceState);
}
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// Native menu handling // Native menu handling

View File

@ -116,6 +116,17 @@ public abstract class SherlockPreferenceActivity extends PreferenceActivity impl
return super.dispatchKeyEvent(event); return super.dispatchKeyEvent(event);
} }
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
getSherlock().dispatchSaveInstanceState(outState);
}
@Override
protected void onRestoreInstanceState(Bundle savedInstanceState) {
super.onRestoreInstanceState(savedInstanceState);
getSherlock().dispatchRestoreInstanceState(savedInstanceState);
}
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// Native menu handling // Native menu handling

View File

@ -52,6 +52,7 @@ public class ActionBarSherlockCompat extends ActionBarSherlock implements MenuBu
/** Window features which are enabled by default. */ /** Window features which are enabled by default. */
protected static final int DEFAULT_FEATURES = 0; protected static final int DEFAULT_FEATURES = 0;
static private final String PANELS_TAG = "sherlock:Panels";
public ActionBarSherlockCompat(Activity activity, int flags) { public ActionBarSherlockCompat(Activity activity, int flags) {
super(activity, flags); super(activity, flags);
@ -71,8 +72,6 @@ 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;
@ -293,8 +292,11 @@ public class ActionBarSherlockCompat extends ActionBarSherlock implements MenuBu
return false; return false;
} }
if (wActionBar != null) {
return wActionBar.hideOverflowMenu(); return wActionBar.hideOverflowMenu();
} }
return false;
}
@Override @Override
public void dispatchPostCreate(Bundle savedInstanceState) { public void dispatchPostCreate(Bundle savedInstanceState) {
@ -424,27 +426,8 @@ public class ActionBarSherlockCompat extends ActionBarSherlock implements MenuBu
} }
} }
boolean result = false; if (DEBUG) Log.d(TAG, "[dispatchKeyEvent] returning false");
if (keyCode == KeyEvent.KEYCODE_MENU && isReservingOverflow()) { return false;
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;
} }
@Override @Override
@ -452,6 +435,19 @@ public class ActionBarSherlockCompat extends ActionBarSherlock implements MenuBu
mIsDestroyed = true; 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 // Menu callback lifecycle and creation

View File

@ -208,7 +208,12 @@ public class ActionBarSherlockNative extends ActionBarSherlock {
//is where we will set the new instance to mActionMode since we need //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 //to pass it through to the sherlock callbacks and the call below
//will not have returned yet to store its value. //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; return mActionMode;
} }
@ -241,6 +246,9 @@ public class ActionBarSherlockNative extends ActionBarSherlock {
@Override @Override
public void onDestroyActionMode(android.view.ActionMode mode) { public void onDestroyActionMode(android.view.ActionMode mode) {
mCallback.onDestroyActionMode(mActionMode); mCallback.onDestroyActionMode(mActionMode);
if (mActivity instanceof OnActionModeFinishedListener) {
((OnActionModeFinishedListener)mActivity).onActionModeFinished(mActionMode);
}
} }
} }

View File

@ -26,6 +26,7 @@ import android.content.res.Resources;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.os.Build; import android.os.Build;
import android.os.Handler; import android.os.Handler;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentTransaction; import android.support.v4.app.FragmentTransaction;
import android.util.TypedValue; import android.util.TypedValue;
import android.view.ContextThemeWrapper; import android.view.ContextThemeWrapper;
@ -36,7 +37,6 @@ import android.view.accessibility.AccessibilityEvent;
import android.widget.SpinnerAdapter; import android.widget.SpinnerAdapter;
import com.actionbarsherlock.R; import com.actionbarsherlock.R;
import com.actionbarsherlock.app.ActionBar; import com.actionbarsherlock.app.ActionBar;
import com.actionbarsherlock.app.SherlockFragmentActivity;
import com.actionbarsherlock.internal.nineoldandroids.animation.Animator; import com.actionbarsherlock.internal.nineoldandroids.animation.Animator;
import com.actionbarsherlock.internal.nineoldandroids.animation.AnimatorListenerAdapter; import com.actionbarsherlock.internal.nineoldandroids.animation.AnimatorListenerAdapter;
import com.actionbarsherlock.internal.nineoldandroids.animation.AnimatorSet; import com.actionbarsherlock.internal.nineoldandroids.animation.AnimatorSet;
@ -506,8 +506,8 @@ public class ActionBarImpl extends ActionBar {
} }
FragmentTransaction trans = null; FragmentTransaction trans = null;
if (mActivity instanceof SherlockFragmentActivity) { if (mActivity instanceof FragmentActivity) {
trans = ((SherlockFragmentActivity)mActivity).getSupportFragmentManager().beginTransaction() trans = ((FragmentActivity)mActivity).getSupportFragmentManager().beginTransaction()
.disallowAddToBackStack(); .disallowAddToBackStack();
} }

View File

@ -6,12 +6,12 @@ import java.util.Set;
import android.app.Activity; import android.app.Activity;
import android.content.Context; import android.content.Context;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentTransaction; import android.support.v4.app.FragmentTransaction;
import android.view.View; import android.view.View;
import android.widget.SpinnerAdapter; import android.widget.SpinnerAdapter;
import com.actionbarsherlock.app.ActionBar; import com.actionbarsherlock.app.ActionBar;
import com.actionbarsherlock.app.SherlockFragmentActivity;
public class ActionBarWrapper extends ActionBar implements android.app.ActionBar.OnNavigationListener, android.app.ActionBar.OnMenuVisibilityListener { public class ActionBarWrapper extends ActionBar implements android.app.ActionBar.OnNavigationListener, android.app.ActionBar.OnMenuVisibilityListener {
private final Activity mActivity; 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) { public void onTabReselected(android.app.ActionBar.Tab tab, android.app.FragmentTransaction ft) {
if (mListener != null) { if (mListener != null) {
FragmentTransaction trans = null; FragmentTransaction trans = null;
if (mActivity instanceof SherlockFragmentActivity) { if (mActivity instanceof FragmentActivity) {
trans = ((SherlockFragmentActivity)mActivity).getSupportFragmentManager().beginTransaction() trans = ((FragmentActivity)mActivity).getSupportFragmentManager().beginTransaction()
.disallowAddToBackStack(); .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) { public void onTabSelected(android.app.ActionBar.Tab tab, android.app.FragmentTransaction ft) {
if (mListener != null) { if (mListener != null) {
if (mFragmentTransaction == null && mActivity instanceof SherlockFragmentActivity) { if (mFragmentTransaction == null && mActivity instanceof FragmentActivity) {
mFragmentTransaction = ((SherlockFragmentActivity)mActivity).getSupportFragmentManager().beginTransaction() mFragmentTransaction = ((FragmentActivity)mActivity).getSupportFragmentManager().beginTransaction()
.disallowAddToBackStack(); .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) { public void onTabUnselected(android.app.ActionBar.Tab tab, android.app.FragmentTransaction ft) {
if (mListener != null) { if (mListener != null) {
FragmentTransaction trans = null; FragmentTransaction trans = null;
if (mActivity instanceof SherlockFragmentActivity) { if (mActivity instanceof FragmentActivity) {
trans = ((SherlockFragmentActivity)mActivity).getSupportFragmentManager().beginTransaction() trans = ((FragmentActivity)mActivity).getSupportFragmentManager().beginTransaction()
.disallowAddToBackStack(); .disallowAddToBackStack();
mFragmentTransaction = trans; mFragmentTransaction = trans;
} }

View File

@ -9,18 +9,10 @@ import com.actionbarsherlock.internal.nineoldandroids.view.animation.AnimatorPro
public class NineFrameLayout extends FrameLayout { public class NineFrameLayout extends FrameLayout {
private final AnimatorProxy mProxy; private final AnimatorProxy mProxy;
public NineFrameLayout(Context context) {
super(context);
mProxy = AnimatorProxy.NEEDS_PROXY ? AnimatorProxy.wrap(this) : null;
}
public NineFrameLayout(Context context, AttributeSet attrs) { public NineFrameLayout(Context context, AttributeSet attrs) {
super(context, attrs); super(context, attrs);
mProxy = AnimatorProxy.NEEDS_PROXY ? AnimatorProxy.wrap(this) : null; 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 @Override
public void setVisibility(int visibility) { public void setVisibility(int visibility) {

View File

@ -9,18 +9,10 @@ import com.actionbarsherlock.internal.nineoldandroids.view.animation.AnimatorPro
public class NineLinearLayout extends LinearLayout { public class NineLinearLayout extends LinearLayout {
private final AnimatorProxy mProxy; private final AnimatorProxy mProxy;
public NineLinearLayout(Context context) {
super(context);
mProxy = AnimatorProxy.NEEDS_PROXY ? AnimatorProxy.wrap(this) : null;
}
public NineLinearLayout(Context context, AttributeSet attrs) { public NineLinearLayout(Context context, AttributeSet attrs) {
super(context, attrs); super(context, attrs);
mProxy = AnimatorProxy.NEEDS_PROXY ? AnimatorProxy.wrap(this) : null; 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 @Override
public void setVisibility(int visibility) { public void setVisibility(int visibility) {

View File

@ -23,7 +23,6 @@ import java.util.Set;
import android.content.Context; import android.content.Context;
import android.content.res.Configuration; import android.content.res.Configuration;
import android.content.res.Resources; import android.content.res.Resources;
import android.content.res.TypedArray;
import android.os.Build; import android.os.Build;
import android.os.Parcel; import android.os.Parcel;
import android.os.Parcelable; import android.os.Parcelable;
@ -119,14 +118,6 @@ public class ActionMenuPresenter extends BaseMenuPresenter
} }
public static boolean reserveOverflow(Context context) { 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) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
return (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB); return (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB);
} else { } else {
@ -621,6 +612,8 @@ public class ActionMenuPresenter extends BaseMenuPresenter
for (View_OnAttachStateChangeListener listener : mListeners) { for (View_OnAttachStateChangeListener listener : mListeners) {
listener.onViewDetachedFromWindow(this); listener.onViewDetachedFromWindow(this);
} }
if (mOverflowPopup != null) mOverflowPopup.dismiss();
} }
@Override @Override

View File

@ -520,6 +520,9 @@ public class ActionMenuView extends IcsLinearLayout implements MenuBuilder.ItemI
//@Override //@Override
protected boolean hasDividerBeforeChildAt(int childIndex) { protected boolean hasDividerBeforeChildAt(int childIndex) {
if (childIndex == 0) {
return false;
}
final View childBefore = getChildAt(childIndex - 1); final View childBefore = getChildAt(childIndex - 1);
final View child = getChildAt(childIndex); final View child = getChildAt(childIndex);
boolean result = false; boolean result = false;

View File

@ -2,10 +2,12 @@ package com.actionbarsherlock.internal.view.menu;
import android.content.Intent; import android.content.Intent;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.view.View;
import android.view.ContextMenu.ContextMenuInfo; import android.view.ContextMenu.ContextMenuInfo;
import android.view.View;
import com.actionbarsherlock.internal.view.ActionProviderWrapper; import com.actionbarsherlock.internal.view.ActionProviderWrapper;
import com.actionbarsherlock.internal.widget.CollapsibleActionViewWrapper;
import com.actionbarsherlock.view.ActionProvider; import com.actionbarsherlock.view.ActionProvider;
import com.actionbarsherlock.view.CollapsibleActionView;
import com.actionbarsherlock.view.MenuItem; import com.actionbarsherlock.view.MenuItem;
import com.actionbarsherlock.view.SubMenu; import com.actionbarsherlock.view.SubMenu;
@ -215,19 +217,35 @@ public class MenuItemWrapper implements MenuItem, android.view.MenuItem.OnMenuIt
@Override @Override
public MenuItem setActionView(View view) { public MenuItem setActionView(View view) {
if (view != null && view instanceof CollapsibleActionView) {
view = new CollapsibleActionViewWrapper(view);
}
mNativeItem.setActionView(view); mNativeItem.setActionView(view);
return this; return this;
} }
@Override @Override
public MenuItem setActionView(int resId) { public MenuItem setActionView(int resId) {
//Allow the native menu to inflate the resource
mNativeItem.setActionView(resId); 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; return this;
} }
@Override @Override
public View getActionView() { public View getActionView() {
return mNativeItem.getActionView(); View actionView = mNativeItem.getActionView();
if (actionView instanceof CollapsibleActionViewWrapper) {
return ((CollapsibleActionViewWrapper)actionView).unwrap();
}
return actionView;
} }
@Override @Override

Some files were not shown because too many files have changed in this diff Show More