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

Update ActionBarSherlock dependency to version 4.0.1.

This commit is contained in:
Sebastian Kaspari 2012-04-04 21:24:57 +02:00
parent 9f314df091
commit 690012504e
122 changed files with 11189 additions and 2630 deletions

View File

@ -1,13 +1,6 @@
<?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"
package="com.actionbarsherlock"
android:versionCode="45"
android:versionName="4.0.0-SNAPSHOT">
<uses-sdk
android:minSdkVersion="7"
android:targetSdkVersion="15" />
<uses-sdk android:minSdkVersion="7" android:targetSdkVersion="15"/>
</manifest>

View File

@ -5,11 +5,11 @@ This folder contains the main library which should be linked against as an
Android library project in your application.
For more information see the "Including In Your Project" section of the
[download page][1].
[usage page][1].
[1]: http://actionbarsherlock.com/download.html
[1]: http://actionbarsherlock.com/usage.html

Binary file not shown.

View File

@ -11,20 +11,36 @@
<parent>
<groupId>com.actionbarsherlock</groupId>
<artifactId>parent</artifactId>
<version>4.0.0-SNAPSHOT</version>
<version>4.0.1</version>
<relativePath>../pom.xml</relativePath>
</parent>
<dependencies>
<dependency>
<groupId>android</groupId>
<groupId>com.google.android</groupId>
<artifactId>android</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>support-v4</artifactId>
</dependency>
<dependency>
<groupId>com.pivotallabs</groupId>
<artifactId>robolectric</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<sourceDirectory>src</sourceDirectory>
<testSourceDirectory>test</testSourceDirectory>
<plugins>
<plugin>
@ -101,5 +117,70 @@
</executions>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>com.google.code.maven-replacer-plugin</groupId>
<artifactId>maven-replacer-plugin</artifactId>
<versionRange>[1.4.1,)</versionRange>
<goals>
<goal>replace</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore />
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</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>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2011 The Android Open Source Project
<!-- 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.
@ -14,6 +14,7 @@
limitations under the License.
-->
<resources>
<bool name="abs__action_bar_expanded_action_views_exclusive">false</bool>
</resources>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="false" android:color="@color/abs__bright_foreground_disabled_holo_dark"/>
<item android:color="@color/abs__bright_foreground_holo_dark"/> <!-- not selected -->
</selector>

View File

@ -0,0 +1,21 @@
<?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:color="@color/abs__bright_foreground_disabled_holo_light"/>
<item android:color="@color/abs__bright_foreground_holo_light"/> <!-- not selected -->
</selector>

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 192 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 467 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 505 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 154 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 122 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 168 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 582 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 622 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 332 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 355 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 151 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 290 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 699 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 935 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 158 B

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 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.
-->
<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:drawable="@android:color/transparent" />
</selector>

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 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.
-->
<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:drawable="@android:color/transparent" />
</selector>

View File

@ -0,0 +1,40 @@
<?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.
-->
<com.actionbarsherlock.internal.nineoldandroids.widget.NineLinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/abs__action_mode_close_button"
android:focusable="true"
android:clickable="true"
android:paddingLeft="8dip"
style="?attr/actionModeCloseButtonStyle"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginRight="16dip">
<ImageView android:layout_width="48dip"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:scaleType="center"
android:src="?attr/actionModeCloseDrawable" />
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="4dip"
android:layout_marginRight="16dip"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textSize="12sp"
android:textAllCaps="true"
android:text="@string/abs__action_mode_done" />
</com.actionbarsherlock.internal.nineoldandroids.widget.NineLinearLayout>

View File

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/* //device/apps/common/assets/res/any/layout/simple_spinner_item.xml
**
** 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"
style="?android:attr/spinnerDropDownItemStyle"
android:singleLine="true"
android:layout_width="match_parent"
android:layout_height="?attr/dropdownListPreferredItemHeight"
android:ellipsize="marquee" />

View File

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/* //device/apps/common/assets/res/any/layout/simple_spinner_item.xml
**
** Copyright 2006, 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"
style="?android:attr/spinnerItemStyle"
android:singleLine="true"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="marquee" />

View File

@ -0,0 +1,50 @@
<?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.
-->
<!--
This is an optimized layout for a screen with the Action Bar enabled.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:fitsSystemWindows="true"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<com.actionbarsherlock.internal.widget.ActionBarContainer
android:id="@+id/abs__action_bar_container"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
style="?attr/actionBarStyle">
<com.actionbarsherlock.internal.widget.ActionBarView
android:id="@+id/abs__action_bar"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
style="?attr/actionBarStyle" />
<com.actionbarsherlock.internal.widget.ActionBarContextView
android:id="@+id/abs__action_context_bar"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:visibility="gone"
style="?attr/actionModeStyle" />
</com.actionbarsherlock.internal.widget.ActionBarContainer>
<com.actionbarsherlock.internal.nineoldandroids.widget.NineFrameLayout
android:id="@+id/abs__content"
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="1"
android:foregroundGravity="fill_horizontal|top"
android:foreground="?attr/windowContentOverlay" />
</LinearLayout>

View File

@ -0,0 +1,49 @@
<?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.
-->
<!--
This is an optimized layout for a screen with
the Action Bar enabled overlaying application content.
-->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:fitsSystemWindows="true">
<com.actionbarsherlock.internal.nineoldandroids.widget.NineFrameLayout android:id="@+id/abs__content"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
<com.actionbarsherlock.internal.widget.ActionBarContainer android:id="@+id/abs__action_bar_container"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
style="?attr/actionBarStyle"
android:gravity="top">
<com.actionbarsherlock.internal.widget.ActionBarView
android:id="@+id/abs__action_bar"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
style="?attr/actionBarStyle" />
<com.actionbarsherlock.internal.widget.ActionBarContextView
android:id="@+id/abs__action_context_bar"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:visibility="gone"
style="?attr/actionModeStyle" />
</com.actionbarsherlock.internal.widget.ActionBarContainer>
<ImageView android:src="?attr/windowContentOverlay"
android:scaleType="fitXY"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/abs__action_bar_container" />
</RelativeLayout>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<com.actionbarsherlock.internal.widget.IcsLinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
style="?attr/actionBarTabBarStyle"
/>

View File

@ -37,7 +37,7 @@
android:adjustViewBounds="true"
android:background="@null"
android:focusable="false" />
<Button android:id="@+id/abs__textButton"
<com.actionbarsherlock.internal.widget.CapitalizingButton android:id="@+id/abs__textButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"

View File

@ -14,7 +14,7 @@
limitations under the License.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<com.actionbarsherlock.internal.nineoldandroids.widget.NineLinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/abs__action_mode_close_button"
android:focusable="true"
android:clickable="true"
@ -28,4 +28,4 @@
android:layout_gravity="center"
android:scaleType="fitCenter"
android:src="?attr/actionModeCloseDrawable" />
</LinearLayout>
</com.actionbarsherlock.internal.nineoldandroids.widget.NineLinearLayout>

View File

@ -0,0 +1,70 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
**
** Copyright 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.
*/
-->
<com.actionbarsherlock.internal.widget.IcsLinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/abs__activity_chooser_view_content"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_gravity="center"
style="?attr/activityChooserViewStyle">
<FrameLayout
android:id="@+id/abs__expand_activities_button"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_gravity="center"
android:focusable="true"
android:addStatesFromChildren="true"
android:background="?attr/actionBarItemBackground">
<ImageView android:id="@+id/abs__image"
android:layout_width="56dip"
android:layout_height="36dip"
android:layout_gravity="center"
android:paddingTop="2dip"
android:paddingBottom="2dip"
android:paddingLeft="12dip"
android:paddingRight="12dip"
android:scaleType="fitCenter"
android:adjustViewBounds="true" />
</FrameLayout>
<FrameLayout
android:id="@+id/abs__default_activity_button"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_gravity="center"
android:focusable="true"
android:addStatesFromChildren="true"
android:background="?attr/actionBarItemBackground">
<ImageView android:id="@+id/abs__image"
android:layout_width="56dip"
android:layout_height="36dip"
android:layout_gravity="center"
android:paddingTop="2dip"
android:paddingBottom="2dip"
android:paddingLeft="12dip"
android:paddingRight="12dip"
android:scaleType="fitCenter"
android:adjustViewBounds="true" />
</FrameLayout>
</com.actionbarsherlock.internal.widget.IcsLinearLayout>

View File

@ -0,0 +1,53 @@
<?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.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/abs__list_item"
android:layout_width="match_parent"
android:layout_height="?attr/dropdownListPreferredItemHeight"
android:paddingLeft="16dip"
android:paddingRight="16dip"
android:minWidth="196dip"
android:background="?attr/activatedBackgroundIndicator"
android:orientation="vertical" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:duplicateParentState="true" >
<ImageView
android:id="@+id/abs__icon"
android:layout_width="32dip"
android:layout_height="32dip"
android:layout_gravity="center_vertical"
android:layout_marginRight="8dip"
android:duplicateParentState="true" />
<TextView
android:id="@+id/abs__title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:textAppearance="?attr/textAppearanceLargePopupMenu"
android:duplicateParentState="true"
android:singleLine="true"
android:ellipsize="marquee"
android:fadingEdge="horizontal" />
</LinearLayout>
</LinearLayout>

View File

@ -0,0 +1,46 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
** Copyright 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.
*/
This is an optimized layout for a screen, with the minimum set of features
enabled.
-->
<com.actionbarsherlock.internal.widget.FakeDialogPhoneWindow xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:fitsSystemWindows="true">
<TextView android:id="@android:id/title" style="?android:attr/windowTitleStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minHeight="@dimen/abs__alert_dialog_title_height"
android:paddingLeft="16dip"
android:paddingRight="16dip"
android:gravity="center_vertical|left" />
<View android:id="@+id/abs__titleDivider"
android:layout_width="fill_parent"
android:layout_height="2dip"
android:background="@color/abs__holo_blue_light" />
<FrameLayout
android:layout_width="wrap_content" android:layout_height="0dp"
android:layout_weight="1"
android:orientation="vertical"
android:foreground="?attr/windowContentOverlay">
<FrameLayout android:id="@+id/abs__content"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
</FrameLayout>
</com.actionbarsherlock.internal.widget.FakeDialogPhoneWindow>

View File

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/* //device/apps/common/assets/res/any/layout/simple_spinner_item.xml
**
** 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"
style="?attr/spinnerDropDownItemStyle"
android:singleLine="true"
android:layout_width="match_parent"
android:layout_height="?attr/dropdownListPreferredItemHeight"
android:ellipsize="marquee" />

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/* //device/apps/common/assets/res/any/dimens.xml
/* //device/apps/common/assets/res/any/layout/simple_spinner_item.xml
**
** Copyright 2006, The Android Open Source Project
**
@ -17,6 +17,10 @@
** limitations under the License.
*/
-->
<resources>
<integer name="abs__max_action_buttons">3</integer>
</resources>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/text1"
style="?attr/spinnerItemStyle"
android:singleLine="true"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="marquee" />

View File

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/* //device/apps/common/assets/res/any/dimens.xml
**
** Copyright 2006, 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.
*/
-->
<resources>
<!-- Default height of an action bar. -->
<dimen name="abs__action_bar_default_height">40dip</dimen>
<!-- Vertical padding around action bar icons. -->
<dimen name="abs__action_bar_icon_vertical_padding">4dip</dimen>
<!-- Text size for action bar titles -->
<dimen name="abs__action_bar_title_text_size">16dp</dimen>
<!-- Text size for action bar subtitles -->
<dimen name="abs__action_bar_subtitle_text_size">12dp</dimen>
<!-- Top margin for action bar subtitles -->
<dimen name="abs__action_bar_subtitle_top_margin">-2dp</dimen>
<!-- Bottom margin for action bar subtitles -->
<dimen name="abs__action_bar_subtitle_bottom_margin">4dip</dimen>
</resources>

View File

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/* //device/apps/common/assets/res/any/dimens.xml
**
** Copyright 2006, 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.
*/
-->
<resources>
<!-- Default height of an action bar. -->
<dimen name="abs__action_bar_default_height">48dip</dimen>
<!-- Vertical padding around action bar icons. -->
<dimen name="abs__action_bar_icon_vertical_padding">8dip</dimen>
<!-- Text size for action bar titles -->
<dimen name="abs__action_bar_title_text_size">18dp</dimen>
<!-- Text size for action bar subtitles -->
<dimen name="abs__action_bar_subtitle_text_size">14dp</dimen>
<!-- Top margin for action bar subtitles -->
<dimen name="abs__action_bar_subtitle_top_margin">-3dp</dimen>
<!-- Bottom margin for action bar subtitles -->
<dimen name="abs__action_bar_subtitle_bottom_margin">5dip</dimen>
</resources>

View File

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/* //device/apps/common/assets/res/any/dimens.xml
**
** Copyright 2006, 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.
*/
-->
<resources>
<!-- Default height of an action bar. -->
<dimen name="abs__action_bar_default_height">56dip</dimen>
<!-- Vertical padding around action bar icons. -->
<dimen name="abs__action_bar_icon_vertical_padding">4dip</dimen>
<!-- Text size for action bar titles -->
<dimen name="abs__action_bar_title_text_size">18dp</dimen>
<!-- Text size for action bar subtitles -->
<dimen name="abs__action_bar_subtitle_text_size">14dp</dimen>
<!-- Top margin for action bar subtitles -->
<dimen name="abs__action_bar_subtitle_top_margin">-3dp</dimen>
<!-- Bottom margin for action bar subtitles -->
<dimen name="abs__action_bar_subtitle_bottom_margin">9dip</dimen>
<!-- Minimum width for an action button in the menu area of an action bar -->
<dimen name="action_button_min_width">64dip</dimen>
</resources>

View File

@ -1,22 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
** Copyright 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.
*/
-->
<resources>
<bool name="abs__action_bar_embed_tabs">true</bool>
<bool name="abs__split_action_bar_is_narrow">false</bool>
</resources>

View File

@ -1,29 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
** Copyright 2009, 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.
*/
-->
<!-- These resources are around just to allow their values to be customized
for different hardware and product builds. -->
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<!-- Whether action menu items should obey the "withText" showAsAction
flag. This may be set to false for situations where space is
extremely limited. -->
<bool name="abs__config_allowActionMenuItemTextWithIcon">true</bool>
</resources>

View File

@ -18,5 +18,12 @@
*/
-->
<resources>
<integer name="abs__max_action_buttons">4</integer>
<!-- The platform's desired minimum size for a dialog's width when it
is along the major axis (that is the screen is landscape). This may
be either a fraction or a dimension. -->
<item type="dimen" name="abs__dialog_min_width_major">55%</item>
<!-- The platform's desired minimum size for a dialog's width when it
is along the minor axis (that is the screen is portrait). This may
be either a fraction or a dimension. -->
<item type="dimen" name="abs__dialog_min_width_minor">80%</item>
</resources>

View File

@ -1,22 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
** Copyright 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.
*/
-->
<resources>
<bool name="abs__action_bar_embed_tabs">true</bool>
<bool name="abs__split_action_bar_is_narrow">false</bool>
</resources>

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Theme.SherlockBase" parent="android:Theme.Holo.NoActionBar"></style>
<style name="Theme.SherlockBase.Light" parent="android:Theme.Holo.Light.NoActionBar"></style>
</resources>

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Sherlock.__Theme" parent="android:Theme.Holo">
<item name="android:windowNoTitle">true</item>
<item name="android:windowActionBar">false</item>
</style>
<style name="Sherlock.__Theme.Light" parent="android:Theme.Holo.Light">
<item name="android:windowNoTitle">true</item>
<item name="android:windowActionBar">false</item>
</style>
</resources>

View File

@ -1,6 +1,118 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Theme.SherlockBase" parent="android:Theme.DeviceDefault.NoActionBar"></style>
<style name="Theme.SherlockBase.Light" parent="android:Theme.DeviceDefault.Light.NoActionBar"></style>
<style name="Widget.Sherlock.ActionBar" parent="android:Widget.Holo.ActionBar">
</style>
<style name="Widget.Sherlock.ActionBar.Solid" parent="android:Widget.Holo.ActionBar.Solid">
</style>
<style name="Widget.Sherlock.Light.ActionBar" parent="android:Widget.Holo.Light.ActionBar">
</style>
<style name="Widget.Sherlock.Light.ActionBar.Solid" parent="android:Widget.Holo.Light.ActionBar.Solid">
</style>
<style name="Widget.Sherlock.Light.ActionBar.Solid.Inverse" parent="android:Widget.Holo.Light.ActionBar.Solid.Inverse">
</style>
<style name="Widget.Sherlock.ActionBar.TabView" parent="android:Widget.Holo.ActionBar.TabView">
</style>
<style name="Widget.Sherlock.Light.ActionBar.TabView" parent="android:Widget.Holo.Light.ActionBar.TabView">
</style>
<style name="Widget.Sherlock.Light.ActionBar.TabView.Inverse" parent="android:Widget.Holo.Light.ActionBar.TabView.Inverse">
</style>
<style name="Widget.Sherlock.ActionBar.TabBar" parent="android:Widget.Holo.ActionBar.TabBar">
</style>
<style name="Widget.Sherlock.Light.ActionBar.TabBar" parent="android:Widget.Holo.Light.ActionBar.TabBar">
</style>
<style name="Widget.Sherlock.Light.ActionBar.TabBar.Inverse" parent="android:Widget.Holo.Light.ActionBar.TabBar.Inverse">
</style>
<style name="Widget.Sherlock.ActionBar.TabText" parent="android:Widget.Holo.ActionBar.TabText">
</style>
<style name="Widget.Sherlock.Light.ActionBar.TabText" parent="android:Widget.Holo.Light.ActionBar.TabText">
</style>
<style name="Widget.Sherlock.Light.ActionBar.TabText.Inverse" parent="android:Widget.Holo.Light.ActionBar.TabText.Inverse">
</style>
<style name="Widget.Sherlock.ActionButton" parent="android:Widget.Holo.ActionButton">
</style>
<style name="Widget.Sherlock.Light.ActionButton" parent="android:Widget.Holo.Light.ActionButton">
</style>
<style name="Widget.Sherlock.ActionButton.CloseMode" parent="android:Widget.Holo.ActionButton.CloseMode">
</style>
<style name="Widget.Sherlock.Light.ActionButton.CloseMode" parent="android:Widget.Holo.Light.ActionButton.CloseMode">
</style>
<style name="Widget.Sherlock.ActionButton.Overflow" parent="android:Widget.Holo.ActionButton.Overflow">
</style>
<style name="Widget.Sherlock.Light.ActionButton.Overflow" parent="android:Widget.Holo.Light.ActionButton.Overflow">
</style>
<style name="Widget.Sherlock.ActionMode" parent="android:Widget.Holo.ActionMode">
</style>
<style name="Widget.Sherlock.Light.ActionMode" parent="android:Widget.Holo.Light.ActionMode">
</style>
<style name="Widget.Sherlock.Light.ActionMode.Inverse" parent="android:Widget.Holo.Light.ActionMode.Inverse">
</style>
<style name="Widget.Sherlock.PopupMenu" parent="android:Widget.Holo.PopupMenu">
</style>
<style name="Widget.Sherlock.Light.PopupMenu" parent="android:Widget.Holo.Light.PopupMenu">
</style>
<style name="Widget.Sherlock.Spinner.DropDown.ActionBar" parent="android:Widget.Holo.Spinner">
</style>
<style name="Widget.Sherlock.Light.Spinner.DropDown.ActionBar" parent="android:Widget.Holo.Light.Spinner">
</style>
<style name="Widget.Sherlock.ListView.DropDown" parent="android:Widget.Holo.ListView.DropDown">
</style>
<style name="Widget.Sherlock.Light.ListView.DropDown" parent="android:Widget.Holo.Light.ListView.DropDown">
</style>
<style name="Widget.Sherlock.PopupWindow.ActionMode" parent="android:Widget.Holo.PopupWindow">
</style>
<style name="Widget.Sherlock.Light.PopupWindow.ActionMode" parent="android:Widget.Holo.Light.PopupWindow">
</style>
<style name="Widget.Sherlock.ProgressBar" parent="android:Widget.Holo.ProgressBar">
</style>
<style name="Widget.Sherlock.Light.ProgressBar" parent="android:Widget.Holo.Light.ProgressBar">
</style>
<style name="Widget.Sherlock.ProgressBar.Horizontal" parent="android:Widget.Holo.ProgressBar.Horizontal">
</style>
<style name="Widget.Sherlock.Light.ProgressBar.Horizontal" parent="android:Widget.Holo.Light.ProgressBar.Horizontal">
</style>
<style name="TextAppearance.Sherlock.Widget.ActionBar.Menu" parent="android:TextAppearance.Holo.Widget.ActionBar.Menu">
</style>
<style name="TextAppearance.Sherlock.Widget.ActionBar.Title" parent="android:TextAppearance.Holo.Widget.ActionBar.Title">
</style>
<style name="TextAppearance.Sherlock.Widget.ActionBar.Title.Inverse" parent="android:TextAppearance.Holo.Widget.ActionBar.Title.Inverse">
</style>
<style name="TextAppearance.Sherlock.Widget.ActionBar.Subtitle" parent="android:TextAppearance.Holo.Widget.ActionBar.Subtitle">
</style>
<style name="TextAppearance.Sherlock.Widget.ActionBar.Subtitle.Inverse" parent="android:TextAppearance.Holo.Widget.ActionBar.Subtitle.Inverse">
</style>
<style name="TextAppearance.Sherlock.Widget.ActionMode.Title" parent="android:TextAppearance.Holo.Widget.ActionMode.Title">
</style>
<style name="TextAppearance.Sherlock.Widget.ActionMode.Title.Inverse" parent="android:TextAppearance.Holo.Widget.ActionMode.Title.Inverse">
</style>
<style name="TextAppearance.Sherlock.Widget.ActionMode.Subtitle" parent="android:TextAppearance.Holo.Widget.ActionMode.Subtitle">
</style>
<style name="TextAppearance.Sherlock.Widget.ActionMode.Subtitle.Inverse" parent="android:TextAppearance.Holo.Widget.ActionMode.Subtitle.Inverse">
</style>
<style name="TextAppearance.Sherlock.Widget.PopupMenu" parent="android:TextAppearance.Holo.Widget.PopupMenu">
</style>
<style name="TextAppearance.Sherlock.Widget.PopupMenu.Large" parent="android:TextAppearance.Holo.Widget.PopupMenu.Large">
</style>
<style name="TextAppearance.Sherlock.Light.Widget.PopupMenu.Large" parent="android:TextAppearance.Holo.Widget.PopupMenu.Large">
</style>
<style name="TextAppearance.Sherlock.Widget.PopupMenu.Small" parent="android:TextAppearance.Holo.Widget.PopupMenu.Small">
</style>
<style name="TextAppearance.Sherlock.Light.Widget.PopupMenu.Small" parent="android:TextAppearance.Holo.Widget.PopupMenu.Small">
</style>
</resources>

View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Sherlock.__Theme" parent="android:Theme.Holo">
</style>
<style name="Sherlock.__Theme.Light" parent="android:Theme.Holo.Light">
</style>
<style name="Sherlock.__Theme.DarkActionBar" parent="android:Theme.Holo.Light.DarkActionBar">
<!-- Useful for offsetting contents with an overlay action bar. -->
<item name="actionBarSize">?android:attr/actionBarSize</item>
<!-- Needed for our bug-fix dropdown list navigation layout. :( -->
<item name="dropdownListPreferredItemHeight">48dp</item>
</style>
<style name="Theme.Sherlock.NoActionBar">
<item name="android:windowActionBar">false</item>
<item name="android:windowNoTitle">true</item>
</style>
<style name="Theme.Sherlock.Light.NoActionBar">
<item name="android:windowActionBar">false</item>
<item name="android:windowNoTitle">true</item>
</style>
<style name="Theme.Sherlock.Dialog" parent="android:Theme.Holo.Dialog">
</style>
<style name="Theme.Sherlock.Light.Dialog" parent="android:Theme.Holo.Light.Dialog">
</style>
</resources>

View File

@ -31,8 +31,15 @@
<!-- Bottom margin for action bar subtitles -->
<dimen name="abs__action_bar_subtitle_bottom_margin">9dip</dimen>
<integer name="abs__max_action_buttons">5</integer>
<!-- Minimum width for an action button in the menu area of an action bar -->
<dimen name="action_button_min_width">64dip</dimen>
<dimen name="abs__action_button_min_width">64dip</dimen>
<!-- The platform's desired minimum size for a dialog's width when it
is along the major axis (that is the screen is landscape). This may
be either a fraction or a dimension. -->
<item type="dimen" name="abs__dialog_min_width_major">45%</item>
<!-- The platform's desired minimum size for a dialog's width when it
is along the minor axis (that is the screen is portrait). This may
be either a fraction or a dimension. -->
<item type="dimen" name="abs__dialog_min_width_minor">72%</item>
</resources>

View File

@ -3,8 +3,8 @@
<resources>
<attr name="titleTextStyle" format="reference" />
<attr name="subtitleTextStyle" format="reference" />
<attr name="background" format="reference" />
<attr name="backgroundSplit" format="reference" />
<attr name="background" format="reference|color" />
<attr name="backgroundSplit" format="reference|color" />
<attr name="height" format="dimension" />
<attr name="divider" format="reference" />
@ -60,6 +60,8 @@
<attr name="actionModeSplitBackground" format="reference" />
<!-- Drawable to use for the close action mode button -->
<attr name="actionModeCloseDrawable" format="reference" />
<!-- Drawable to use for the Share action button in WebView selection action modes -->
<attr name="actionModeShareDrawable" format="reference" />
<!-- PopupWindow style to use for action modes when showing as a window overlay. -->
<attr name="actionModePopupWindowStyle" format="reference" />
@ -89,8 +91,11 @@
<attr name="textAppearanceSmall" format="reference" />
<attr name="textColorPrimary" format="color" />
<attr name="textColorPrimaryDisableOnly" format="color" />
<attr name="textColorPrimaryInverse" format="color" />
<attr name="spinnerItemStyle" format="reference" />
<attr name="spinnerDropDownItemStyle" format="reference" />
<!-- =========== -->
<!-- List styles -->
@ -109,6 +114,9 @@
<attr name="textAppearanceListItemSmall" format="reference" />
<attr name="windowMinWidthMajor" format="dimension" />
<attr name="windowMinWidthMinor" format="dimension" />
<!-- Drawable to use for generic vertical dividers. -->
@ -127,8 +135,19 @@
<attr name="windowActionModeOverlay" format="boolean"/>
<attr name="windowSplitActionBar" format="boolean" />
<attr name="listPopupWindowStyle" format="reference" />
<!-- Default ActivityChooserView style. -->
<attr name="activityChooserViewStyle" format="reference" />
<!-- Drawable used as a background for activated items. -->
<attr name="activatedBackgroundIndicator" format="reference" />
<!-- Specified if we are forcing an action item overflow menu. -->
<attr name="absForceOverflow" format="boolean" />
<attr name="android:windowIsFloating" />
</declare-styleable>
@ -221,4 +240,141 @@
<!-- Whether space should be reserved in layout when an icon is missing. -->
<attr name="preserveIconSpacing" format="boolean" />
</declare-styleable>
<declare-styleable name="SherlockActionMenuItemView">
<attr name="android:minWidth" />
</declare-styleable>
<declare-styleable name="SherlockActivityChooserView">
<!-- The maximal number of items initially shown in the activity list. -->
<attr name="initialActivityCount" format="string" />
<!-- The drawable to show in the button for expanding the activities overflow popup.
<strong>Note:</strong> Clients would like to set this drawable
as a clue about the action the chosen activity will perform. For
example, if share activity is to be chosen the drawable should
give a clue that sharing is to be performed.
-->
<attr name="expandActivityOverflowButtonDrawable" format="reference" />
<attr name="android:background" />
</declare-styleable>
<!-- Base attributes that are available to all groups. -->
<declare-styleable name="SherlockMenuGroup">
<!-- The ID of the group. -->
<attr name="android:id" />
<!-- The category applied to all items within this group.
(This will be or'ed with the orderInCategory attribute.) -->
<attr name="android:menuCategory" />
<!-- The order within the category applied to all items within this group.
(This will be or'ed with the category attribute.) -->
<attr name="android:orderInCategory" />
<!-- Whether the items are capable of displaying a check mark. -->
<attr name="android:checkableBehavior" />
<!-- Whether the items are shown/visible. -->
<attr name="android:visible" />
<!-- Whether the items are enabled. -->
<attr name="android:enabled" />
</declare-styleable>
<!-- Base attributes that are available to all Item objects. -->
<declare-styleable name="SherlockMenuItem">
<!-- The ID of the item. -->
<attr name="android:id" />
<!-- The category applied to the item.
(This will be or'ed with the orderInCategory attribute.) -->
<attr name="android:menuCategory" />
<!-- The order within the category applied to the item.
(This will be or'ed with the category attribute.) -->
<attr name="android:orderInCategory" />
<!-- The title associated with the item. -->
<attr name="android:title" />
<!-- The condensed title associated with the item. This is used in situations where the
normal title may be too long to be displayed. -->
<attr name="android:titleCondensed" />
<!-- The icon associated with this item. This icon will not always be shown, so
the title should be sufficient in describing this item. -->
<attr name="android:icon" />
<!-- The alphabetic shortcut key. This is the shortcut when using a keyboard
with alphabetic keys. -->
<attr name="android:alphabeticShortcut" />
<!-- The numeric shortcut key. This is the shortcut when using a numeric (e.g., 12-key)
keyboard. -->
<attr name="android:numericShortcut" />
<!-- Whether the item is capable of displaying a check mark. -->
<attr name="android:checkable" />
<!-- Whether the item is checked. Note that you must first have enabled checking with
the checkable attribute or else the check mark will not appear. -->
<attr name="android:checked" />
<!-- Whether the item is shown/visible. -->
<attr name="android:visible" />
<!-- Whether the item is enabled. -->
<attr name="android:enabled" />
<!-- Name of a method on the Context used to inflate the menu that will be
called when the item is clicked. -->
<attr name="android:onClick" />
<!-- How this item should display in the Action Bar, if present. -->
<attr name="android:showAsAction" />
<!-- An optional layout to be used as an action view.
See {@link android.view.MenuItem#setActionView(android.view.View)}
for more info. -->
<attr name="android:actionLayout" />
<!-- The name of an optional View class to instantiate and use as an
action view. See {@link android.view.MenuItem#setActionView(android.view.View)}
for more info. -->
<attr name="android:actionViewClass" />
<!-- The name of an optional ActionProvider class to instantiate an action view
and perform operations such as default action for that menu item.
See {@link android.view.MenuItem#setActionProvider(android.view.ActionProvider)}
for more info. -->
<attr name="android:actionProviderClass" />
</declare-styleable>
<declare-styleable name="SherlockSpinner">
<!-- The prompt to display when the spinner's dialog is shown. -->
<attr name="android:prompt" />
<!-- List selector to use for spinnerMode="dropdown" display. -->
<attr name="android:dropDownSelector" />
<!-- Background drawable to use for the dropdown in spinnerMode="dropdown". -->
<attr name="android:popupBackground" />
<!-- Vertical offset from the spinner widget for positioning the dropdown in
spinnerMode="dropdown". -->
<attr name="android:dropDownVerticalOffset" />
<!-- Horizontal offset from the spinner widget for positioning the dropdown
in spinnerMode="dropdown". -->
<attr name="android:dropDownHorizontalOffset" />
<!-- Width of the dropdown in spinnerMode="dropdown". -->
<attr name="android:dropDownWidth" />
<!-- Reference to a layout to use for displaying a prompt in the dropdown for
spinnerMode="dropdown". This layout must contain a TextView with the id
@android:id/text1 to be populated with the prompt text. -->
<attr name="android:popupPromptView" />
<!-- Gravity setting for positioning the currently selected item. -->
<attr name="android:gravity" />
</declare-styleable>
</resources>

View File

@ -23,4 +23,5 @@
<color name="abs__bright_foreground_disabled_holo_light">#ffb2b2b2</color>
<color name="abs__bright_foreground_inverse_holo_dark">@color/abs__bright_foreground_holo_light</color>
<color name="abs__bright_foreground_inverse_holo_light">@color/abs__bright_foreground_holo_dark</color>
<color name="abs__holo_blue_light">#ff33b5e5</color>
</resources>

View File

@ -35,4 +35,16 @@
<!-- Minimum width for an action button in the menu area of an action bar -->
<dimen name="abs__action_button_min_width">56dip</dimen>
<!-- Dialog title height -->
<dimen name="abs__alert_dialog_title_height">64dip</dimen>
<!-- The platform's desired minimum size for a dialog's width when it
is along the major axis (that is the screen is landscape). This may
be either a fraction or a dimension. -->
<item type="dimen" name="abs__dialog_min_width_major">65%</item>
<!-- The platform's desired minimum size for a dialog's width when it
is along the minor axis (that is the screen is portrait). This may
be either a fraction or a dimension. -->
<item type="dimen" name="abs__dialog_min_width_minor">95%</item>
</resources>

View File

@ -16,11 +16,27 @@
** limitations under the License.
*/
-->
<resources>
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<!-- Content description for the action bar "home" affordance. [CHAR LIMIT=NONE] -->
<string name="abs__action_bar_home_description">Navigate home</string>
<!-- Content description for the action bar "up" affordance. [CHAR LIMIT=NONE] -->
<string name="abs__action_bar_up_description">Navigate up</string>
<!-- Content description for the action menu overflow button. [CHAR LIMIT=NONE] -->
<string name="abs__action_menu_overflow_description">More options</string>
<!-- Label for the "Done" button on the far left of action mode toolbars. -->
<string name="abs__action_mode_done">Done</string>
<!-- Title for a button to expand the list of activities in ActivityChooserView [CHAR LIMIT=25] -->
<string name="abs__activity_chooser_view_see_all">See all...</string>
<!-- Title default for a dialog showing possible activities in ActivityChooserView [CHAR LIMIT=25] -->
<string name="abs__activity_chooser_view_dialog_title_default">Select activity</string>
<!-- Title for a dialog showing possible activities for sharing in ShareActionProvider [CHAR LIMIT=25] -->
<string name="abs__share_action_provider_share_with">Share with...</string>
<!-- Description of the shwoing of a popup window with activities to choose from. [CHAR LIMIT=NONE] -->
<string name="abs__activitychooserview_choose_application">Choose an application</string>
<!-- Description of the choose target button in a ShareActionProvider (share UI). [CHAR LIMIT=NONE] -->
<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] -->
<string name="abs__shareactionprovider_share_with_application">Share with <xliff:g id="application_name" example="Bluetooth">%s</xliff:g></string>
</resources>

View File

@ -1,59 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Theme.SherlockBase" parent="android:Theme.NoTitleBar"></style>
<style name="Theme.SherlockBase.Light" parent="android:Theme.Light.NoTitleBar"></style>
<style name="Theme.Sherlock" parent="Theme.SherlockBase">
<!-- Action bar styles (from Theme.Holo) -->
<item name="actionDropDownStyle">@style/Widget.Sherlock.Spinner.DropDown.ActionBar</item>
<item name="actionButtonStyle">@style/Widget.Sherlock.ActionButton</item>
<item name="actionOverflowButtonStyle">@style/Widget.Sherlock.ActionButton.Overflow</item>
<item name="actionModeBackground">@drawable/abs__cab_background_top_holo_dark</item>
<item name="actionModeSplitBackground">@drawable/abs__cab_background_bottom_holo_dark</item>
<item name="actionModeCloseDrawable">@drawable/abs__ic_cab_done_holo_dark</item>
<item name="actionBarTabStyle">@style/Widget.Sherlock.ActionBar.TabView</item>
<item name="actionBarTabBarStyle">@style/Widget.Sherlock.ActionBar.TabBar</item>
<item name="actionBarTabTextStyle">@style/Widget.Sherlock.ActionBar.TabText</item>
<item name="actionModeStyle">@style/Widget.Sherlock.ActionMode</item>
<item name="actionModeCloseButtonStyle">@style/Widget.Sherlock.ActionButton.CloseMode</item>
<item name="actionBarStyle">@style/Widget.Sherlock.ActionBar</item>
<item name="actionBarSize">@dimen/abs__action_bar_default_height</item>
<item name="actionModePopupWindowStyle">@style/Widget.Sherlock.PopupWindow.ActionMode</item>
<item name="actionBarWidgetTheme">@null</item>
<!-- Action bar styles (defaults from Theme) -->
<item name="actionBarSplitStyle">?attr/actionBarStyle</item>
<item name="actionMenuTextAppearance">@style/TextAppearance.Sherlock.Widget.ActionBar.Menu</item>
<item name="actionMenuTextColor">?attr/textColorPrimary</item>
<item name="actionBarDivider">?attr/dividerVertical</item>
<item name="actionBarItemBackground">@drawable/abs__item_background_holo_dark</item>
<item name="homeAsUpIndicator">@drawable/abs__ic_ab_back_holo_dark</item>
<item name="dividerVertical">@drawable/abs__list_divider_holo_dark</item>
<item name="textColorPrimary">@color/abs__primary_text_holo_dark</item>
<item name="dropdownListPreferredItemHeight">48dip</item>
<item name="dropDownListViewStyle">@style/Widget.Sherlock.ListView.DropDown</item>
<item name="textAppearanceLargePopupMenu">@style/TextAppearance.Sherlock.Widget.PopupMenu.Large</item>
<item name="textAppearanceSmallPopupMenu">@style/TextAppearance.Sherlock.Widget.PopupMenu.Small</item>
<item name="popupMenuStyle">@style/Widget.Sherlock.PopupMenu</item>
<item name="windowActionBar">true</item>
<item name="windowActionModeOverlay">false</item>
<item name="windowContentOverlay">@null</item>
</style>
<style name="Theme.Sherlock.ForceOverflow">
<item name="absForceOverflow">true</item>
<style name="Widget">
</style>
<style name="Widget"></style>
<style name="Widget.Sherlock.ActionBar" parent="Widget">
<style name="Sherlock.__Widget.ActionBar" parent="Widget">
<item name="displayOptions">useLogo|showHome|showTitle</item>
<item name="height">?attr/actionBarSize</item>
<item name="android:paddingLeft">0dip</item>
@ -61,7 +12,8 @@
<item name="android:paddingRight">0dip</item>
<item name="android:paddingBottom">0dip</item>
<item name="homeLayout">@layout/abs__action_bar_home</item>
</style>
<style name="Widget.Sherlock.ActionBar" parent="Sherlock.__Widget.ActionBar">
<item name="titleTextStyle">@style/TextAppearance.Sherlock.Widget.ActionBar.Title</item>
<item name="subtitleTextStyle">@style/TextAppearance.Sherlock.Widget.ActionBar.Subtitle</item>
<item name="background">@drawable/abs__ab_transparent_dark_holo</item>
@ -73,19 +25,76 @@
<item name="progressBarPadding">32dip</item>
<item name="itemPadding">8dip</item>
</style>
<style name="Widget.Sherlock.ActionBar.Solid" parent="Sherlock.__Widget.ActionBar">
<item name="titleTextStyle">@style/TextAppearance.Sherlock.Widget.ActionBar.Title</item>
<item name="subtitleTextStyle">@style/TextAppearance.Sherlock.Widget.ActionBar.Subtitle</item>
<item name="background">@drawable/abs__ab_solid_dark_holo</item>
<item name="backgroundStacked">@drawable/abs__ab_stacked_solid_dark_holo</item>
<item name="backgroundSplit">@drawable/abs__ab_bottom_solid_dark_holo</item>
<item name="divider">?attr/dividerVertical</item>
<item name="progressBarStyle">@style/Widget.Sherlock.ProgressBar.Horizontal</item>
<item name="indeterminateProgressStyle">@style/Widget.Sherlock.ProgressBar</item>
<item name="progressBarPadding">32dip</item>
<item name="itemPadding">8dip</item>
</style>
<style name="Widget.Sherlock.Light.ActionBar" parent="Widget.Sherlock.ActionBar">
<item name="titleTextStyle">@style/TextAppearance.Sherlock.Widget.ActionBar.Title</item>
<item name="subtitleTextStyle">@style/TextAppearance.Sherlock.Widget.ActionBar.Subtitle</item>
<item name="background">@drawable/abs__ab_transparent_light_holo</item>
<item name="backgroundStacked">@drawable/abs__ab_stacked_transparent_light_holo</item>
<item name="backgroundSplit">@drawable/abs__ab_bottom_transparent_light_holo</item>
<item name="homeAsUpIndicator">@drawable/abs__ic_ab_back_holo_light</item>
<item name="progressBarStyle">@style/Widget.Sherlock.Light.ProgressBar.Horizontal</item>
<item name="indeterminateProgressStyle">@style/Widget.Sherlock.Light.ProgressBar</item>
</style>
<style name="Widget.Sherlock.Light.ActionBar.Solid">
<item name="titleTextStyle">@style/TextAppearance.Sherlock.Widget.ActionBar.Title</item>
<item name="subtitleTextStyle">@style/TextAppearance.Sherlock.Widget.ActionBar.Subtitle</item>
<item name="background">@drawable/abs__ab_solid_light_holo</item>
<item name="backgroundStacked">@drawable/abs__ab_stacked_solid_light_holo</item>
<item name="backgroundSplit">@drawable/abs__ab_bottom_solid_light_holo</item>
<item name="divider">?attr/dividerVertical</item>
<item name="progressBarStyle">@style/Widget.Sherlock.Light.ProgressBar.Horizontal</item>
<item name="indeterminateProgressStyle">@style/Widget.Sherlock.Light.ProgressBar</item>
<item name="progressBarPadding">32dip</item>
<item name="itemPadding">8dip</item>
</style>
<style name="Widget.Sherlock.Light.ActionBar.Solid.Inverse">
<item name="titleTextStyle">@style/TextAppearance.Sherlock.Widget.ActionBar.Title.Inverse</item>
<item name="subtitleTextStyle">@style/TextAppearance.Sherlock.Widget.ActionBar.Subtitle.Inverse</item>
<item name="background">@drawable/abs__ab_solid_dark_holo</item>
<item name="backgroundStacked">@drawable/abs__ab_stacked_solid_dark_holo</item>
<item name="backgroundSplit">@drawable/abs__ab_bottom_solid_inverse_holo</item>
<item name="divider">@drawable/abs__list_divider_holo_dark</item>
<item name="progressBarStyle">@style/Widget.Sherlock.ProgressBar.Horizontal</item>
<item name="indeterminateProgressStyle">@style/Widget.Sherlock.ProgressBar</item>
<item name="progressBarPadding">32dip</item>
<item name="itemPadding">8dip</item>
</style>
<style name="Widget.Sherlock.ActionBar.TabView" parent="Widget">
<item name="android:gravity">center_horizontal</item>
<item name="android:background">@drawable/abs__tab_indicator_holo</item>
<item name="android:paddingLeft">16dip</item>
<item name="android:paddingRight">16dip</item>
</style>
<style name="Widget.Sherlock.Light.ActionBar.TabView" parent="Widget.Sherlock.ActionBar.TabView">
</style>
<style name="Widget.Sherlock.Light.ActionBar.TabView.Inverse">
</style>
<style name="Widget.Sherlock.ActionBar.TabBar" parent="Widget">
<item name="android:divider">?attr/actionBarDivider</item>
<item name="android:showDividers">middle</item>
<item name="android:dividerPadding">12dip</item>
</style>
<style name="Widget.Sherlock.Light.ActionBar.TabBar" parent="Widget.Sherlock.ActionBar.TabBar">
</style>
<style name="Widget.Sherlock.Light.ActionBar.TabBar.Inverse">
</style>
<style name="Widget.Sherlock.ActionBar.TabText" parent="Widget">
<item name="android:textAppearance">@style/TextAppearance.Sherlock.Medium</item>
<item name="android:textAppearance">@null</item>
<item name="android:textColor">?attr/textColorPrimary</item>
<item name="android:textSize">12sp</item>
<item name="android:textStyle">bold</item>
@ -93,6 +102,11 @@
<item name="android:ellipsize">marquee</item>
<item name="android:maxLines">2</item>
</style>
<style name="Widget.Sherlock.Light.ActionBar.TabText" parent="Widget.Sherlock.ActionBar.TabText">
</style>
<style name="Widget.Sherlock.Light.ActionBar.TabText.Inverse">
<item name="android:textColor">?attr/textColorPrimaryInverse</item>
</style>
<style name="Widget.Sherlock.ActionButton" parent="Widget">
<item name="android:background">?attr/actionBarItemBackground</item>
@ -104,59 +118,137 @@
<item name="android:paddingRight">12dip</item>
<item name="android:scaleType">center</item>
</style>
<style name="Widget.Sherlock.Light.ActionButton" parent="Widget.Sherlock.ActionButton">
</style>
<style name="Widget.Sherlock.ActionButton.CloseMode">
<item name="android:background">@drawable/abs__btn_cab_done_holo_dark</item>
</style>
<style name="Widget.Sherlock.Light.ActionButton.CloseMode">
<item name="android:background">@drawable/abs__btn_cab_done_holo_light</item>
</style>
<style name="Widget.Sherlock.ActionButton.Overflow">
<item name="android:src">@drawable/abs__ic_menu_moreoverflow_holo_dark</item>
<item name="android:background">?attr/actionBarItemBackground</item>
<item name="android:contentDescription">@string/abs__action_menu_overflow_description</item>
</style>
<style name="Widget.Sherlock.Light.ActionButton.Overflow">
<item name="android:src">@drawable/abs__ic_menu_moreoverflow_holo_light</item>
</style>
<style name="Widget.Sherlock.ActionMode" parent="Widget">
<style name="Sherlock.__Widget.ActionMode" parent="Widget">
<item name="background">?attr/actionModeBackground</item>
<item name="backgroundSplit">?attr/actionModeSplitBackground</item>
<item name="height">?attr/actionBarSize</item>
</style>
<style name="Widget.Sherlock.ActionMode" parent="Sherlock.__Widget.ActionMode">
<item name="titleTextStyle">@style/TextAppearance.Sherlock.Widget.ActionMode.Title</item>
<item name="subtitleTextStyle">@style/TextAppearance.Sherlock.Widget.ActionMode.Subtitle</item>
</style>
<style name="Widget.Sherlock.Light.ActionMode" parent="Widget.Sherlock.ActionMode">
<item name="titleTextStyle">@style/TextAppearance.Sherlock.Widget.ActionMode.Title</item>
<item name="subtitleTextStyle">@style/TextAppearance.Sherlock.Widget.ActionMode.Subtitle</item>
</style>
<style name="Widget.Sherlock.Light.ActionMode.Inverse" parent="Sherlock.__Widget.ActionMode">
<item name="titleTextStyle">@style/TextAppearance.Sherlock.Widget.ActionMode.Title.Inverse</item>
<item name="subtitleTextStyle">@style/TextAppearance.Sherlock.Widget.ActionMode.Subtitle.Inverse</item>
</style>
<style name="Widget.Sherlock.PopupMenu" parent="Widget">
<style name="Widget.Sherlock.ListPopupWindow" parent="Widget">
<item name="android:dropDownSelector">@drawable/abs__list_selector_holo_dark</item>
<item name="android:popupBackground">@drawable/abs__menu_dropdown_panel_holo_dark</item>
<item name="android:dropDownVerticalOffset">0dip</item>
<item name="android:dropDownHorizontalOffset">0dip</item>
<item name="android:dropDownWidth">wrap_content</item>
</style>
<style name="Widget.Sherlock.Light.ListPopupWindow" parent="Widget">
<item name="android:dropDownSelector">@drawable/abs__list_selector_holo_light</item>
<item name="android:popupBackground">@drawable/abs__menu_dropdown_panel_holo_light</item>
<item name="android:dropDownVerticalOffset">0dip</item>
<item name="android:dropDownHorizontalOffset">0dip</item>
<item name="android:dropDownWidth">wrap_content</item>
</style>
<style name="Widget.Sherlock.PopupMenu" parent="Widget.Sherlock.ListPopupWindow">
</style>
<style name="Widget.Sherlock.Light.PopupMenu" parent="Widget.Sherlock.Light.ListPopupWindow">
</style>
<style name="Widget.Sherlock.Spinner.DropDown.ActionBar" parent="Widget">
<!-- From Widget.Holo.Spinner.DropDown.ActionBar -->
<item name="android:background">@drawable/abs__spinner_ab_holo_dark</item>
<!-- From Widget.Holo.Spinner.DropDown -->
<style name="Sherlock.__Widget.ActivityChooserView" parent="Widget">
<item name="android:gravity">center</item>
<item name="android:background">@drawable/abs__ab_share_pack_holo_dark</item>
<item name="android:divider">?attr/dividerVertical</item>
<item name="android:showDividers">middle</item>
<item name="android:dividerPadding">6dip</item>
</style>
<style name="Widget.Sherlock.ActivityChooserView" parent="Sherlock.__Widget.ActivityChooserView">
</style>
<style name="Widget.Sherlock.Light.ActivityChooserView" parent="Widget.Sherlock.ActivityChooserView">
<item name="android:background">@drawable/abs__ab_share_pack_holo_light</item>
</style>
<style name="Widget.Sherlock.Button.Small" parent="Widget">
<item name="android:textAppearance">?attr/textAppearanceSmall</item>
<item name="android:textColor">@color/abs__primary_text_holo_dark</item>
<item name="android:minHeight">48dip</item>
<item name="android:minWidth">48dip</item>
</style>
<style name="Widget.Sherlock.Light.Button.Small" parent="Widget">
<item name="android:textAppearance">?attr/textAppearanceSmall</item>
<item name="android:textColor">@color/abs__primary_text_holo_light</item>
<item name="android:minHeight">48dip</item>
<item name="android:minWidth">48dip</item>
</style>
<style name="Sherlock.__Widget.Holo.Spinner" parent="Widget">
<item name="android:dropDownSelector">@drawable/abs__list_selector_holo_dark</item>
<item name="android:popupBackground">@drawable/abs__menu_dropdown_panel_holo_dark</item>
<item name="android:dropDownVerticalOffset">0dip</item>
<item name="android:dropDownHorizontalOffset">0dip</item>
<item name="android:dropDownWidth">wrap_content</item>
<item name="android:gravity">left|center_vertical</item>
<!-- From Widget.Holo.Spinner -->
<item name="android:spinnerMode">dropdown</item>
<!-- From Widget.Spinner.DropDown -->
<item name="android:clickable">true</item>
</style>
<style name="Widget.Sherlock.Spinner.DropDown.ActionBar" parent="Sherlock.__Widget.Holo.Spinner">
<item name="android:background">@drawable/abs__spinner_ab_holo_dark</item>
</style>
<style name="Widget.Sherlock.Light.Spinner.DropDown.ActionBar" parent="Sherlock.__Widget.Holo.Spinner">
<item name="android:background">@drawable/abs__spinner_ab_holo_light</item>
<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="Widget.Sherlock.ListView.DropDown" parent="android:Widget.ListView">
<!-- From Widget.Holo.ListView.DropDown -->
<!-- From Widget.Holo.ListView -->
<style name="Sherlock.__Widget.Holo.ListView" parent="android:Widget.ListView">
<item name="android:divider">@drawable/abs__list_divider_holo_dark</item>
<item name="android:listSelector">@drawable/abs__list_selector_holo_dark</item>
</style>
<style name="Widget.Sherlock.ListView.DropDown" parent="Sherlock.__Widget.Holo.ListView">
</style>
<style name="Widget.Sherlock.Light.ListView.DropDown" parent="Sherlock.__Widget.Holo.ListView">
<item name="android:divider">@drawable/abs__list_divider_holo_light</item>
<item name="android:listSelector">@drawable/abs__list_selector_holo_light</item>
</style>
<style name="Sherlock.__Widget.Holo.DropDownItem" parent="Widget">
<item name="android:textAppearance">@style/TextAppearance.Sherlock.Widget.DropDownItem</item>
<item name="android:paddingLeft">8dp</item>
<item name="android:paddingRight">8dp</item>
<item name="android:gravity">center_vertical</item>
</style>
<style name="Widget.Sherlock.DropDownItem.Spinner" parent="Sherlock.__Widget.Holo.DropDownItem">
</style>
<style name="Widget.Sherlock.Light.DropDownItem.Spinner" parent="Sherlock.__Widget.Holo.DropDownItem">
</style>
<style name="Widget.Sherlock.PopupWindow.ActionMode" parent="Widget"></style>
<style name="Widget.Sherlock.PopupWindow.ActionMode" parent="Widget">
</style>
<style name="Widget.Sherlock.Light.PopupWindow.ActionMode" parent="Widget">
<item name="android:popupBackground">@android:color/white</item>
</style>
@ -164,6 +256,8 @@
<item name="android:indeterminateDrawable">@drawable/abs__progress_medium_holo</item>
<item name="android:animationResolution">33</item>
</style>
<style name="Widget.Sherlock.Light.ProgressBar" parent="Widget.Sherlock.ProgressBar">
</style>
<style name="Widget.Sherlock.ProgressBar.Horizontal" parent="android:Widget.ProgressBar.Horizontal">
<item name="android:progressDrawable">@drawable/abs__progress_horizontal_holo_dark</item>
@ -171,28 +265,78 @@
<item name="android:minHeight">16dip</item>
<item name="android:maxHeight">16dip</item>
</style>
<style name="Widget.Sherlock.Light.ProgressBar.Horizontal" parent="Widget.Sherlock.ProgressBar.Horizontal">
<item name="android:progressDrawable">@drawable/abs__progress_horizontal_holo_light</item>
</style>
<style name="TextAppearance.Sherlock.Medium" parent="Widget"></style>
<style name="TextAppearance.Sherlock.Widget.ActionBar.Menu" parent="Widget"></style>
<style name="Widget.Sherlock.TextView.SpinnerItem" parent="Widget">
<item name="android:textAppearance">@style/TextAppearance.Sherlock.Widget.TextView.SpinnerItem</item>
<item name="android:paddingLeft">8dp</item>
<item name="android:paddingRight">8dp</item>
</style>
<style name="DialogWindowTitle.Sherlock" parent="Widget">
<item name="android:maxLines">1</item>
<item name="android:scrollHorizontally">true</item>
<item name="android:textAppearance">@style/TextAppearance.Sherlock.DialogWindowTitle</item>
<item name="android:minHeight">@dimen/abs__alert_dialog_title_height</item>
<item name="android:paddingLeft">16dip</item>
<item name="android:paddingRight">16dip</item>
</style>
<style name="DialogWindowTitle.Sherlock.Light" parent="Widget">
<item name="android:maxLines">1</item>
<item name="android:scrollHorizontally">true</item>
<item name="android:textAppearance">@style/TextAppearance.Sherlock.Light.DialogWindowTitle</item>
<item name="android:minHeight">@dimen/abs__alert_dialog_title_height</item>
<item name="android:paddingLeft">16dip</item>
<item name="android:paddingRight">16dip</item>
</style>
<style name="TextAppearance.Sherlock.Widget.ActionBar.Menu" parent="Widget">
<item name="android:textSize">12sp</item>
<item name="android:textStyle">bold</item>
<item name="android:textColor">?attr/actionMenuTextColor</item>
<item name="android:textAllCaps">@bool/abs__config_actionMenuItemAllCaps</item>
</style>
<style name="TextAppearance.Sherlock.Widget.ActionBar.Title" parent="Widget">
<item name="android:textSize">@dimen/abs__action_bar_title_text_size</item>
<item name="android:textColor">?android:attr/textColorPrimary</item>
</style>
<style name="TextAppearance.Sherlock.Widget.ActionBar.Title.Inverse" parent="Widget">
<item name="android:textSize">@dimen/abs__action_bar_title_text_size</item>
<item name="android:textColor">?android:attr/textColorPrimaryInverse</item>
</style>
<style name="TextAppearance.Sherlock.Widget.ActionBar.Subtitle" parent="Widget">
<item name="android:textSize">@dimen/abs__action_bar_subtitle_text_size</item>
<item name="android:textColor">?android:attr/textColorSecondary</item>
</style>
<style name="TextAppearance.Sherlock.Widget.ActionBar.Subtitle.Inverse" parent="Widget">
<item name="android:textSize">@dimen/abs__action_bar_subtitle_text_size</item>
<item name="android:textColor">?android:attr/textColorPrimaryInverse</item>
</style>
<style name="TextAppearance.Sherlock.Widget.ActionMode.Title" parent="Widget">
<item name="android:textSize">@dimen/abs__action_bar_title_text_size</item>
<item name="android:textColor">?android:attr/textColorPrimary</item>
</style>
<style name="TextAppearance.Sherlock.Widget.ActionMode.Title.Inverse" parent="Widget">
<item name="android:textSize">@dimen/abs__action_bar_title_text_size</item>
<item name="android:textColor">?android:attr/textColorPrimaryInverse</item>
</style>
<style name="TextAppearance.Sherlock.Widget.ActionMode.Subtitle" parent="Widget">
<item name="android:textSize">@dimen/abs__action_bar_subtitle_text_size</item>
<item name="android:textColor">?android:attr/textColorSecondary</item>
</style>
<style name="TextAppearance.Sherlock.Widget.ActionMode.Subtitle.Inverse" parent="Widget">
<item name="android:textSize">@dimen/abs__action_bar_subtitle_text_size</item>
<item name="android:textColor">?android:attr/textColorPrimaryInverse</item>
</style>
<style name="TextAppearance.Sherlock.Widget.PopupMenu" parent="Widget">
<item name="android:textColor">?attr/textColorPrimary</item>
@ -200,7 +344,41 @@
<style name="TextAppearance.Sherlock.Widget.PopupMenu.Large">
<item name="android:textSize">18sp</item>
</style>
<style name="TextAppearance.Sherlock.Light.Widget.PopupMenu.Large" parent="TextAppearance.Sherlock.Widget.PopupMenu.Large">
</style>
<style name="TextAppearance.Sherlock.Widget.PopupMenu.Small">
<item name="android:textSize">14sp</item>
</style>
<style name="TextAppearance.Sherlock.Light.Widget.PopupMenu.Small" parent="TextAppearance.Sherlock.Widget.PopupMenu.Small">
</style>
<style name="TextAppearance.Sherlock.Widget.TextView.SpinnerItem" parent="Widget">
<item name="android:textColor">?textColorPrimary</item>
<item name="android:textSize">16sp</item>
<item name="android:textStyle">normal</item>
</style>
<style name="TextAppearance.Sherlock.Widget.DropDownItem" parent="Widget">
<item name="android:textColor">?textColorPrimaryDisableOnly</item>
<item name="android:textSize">16sp</item>
<item name="android:textStyle">normal</item>
</style>
<style name="TextAppearance.Sherlock.DialogWindowTitle" parent="Widget">
<item name="android:textSize">22sp</item>
<item name="android:textColor">@color/abs__holo_blue_light</item>
</style>
<style name="TextAppearance.Sherlock.Light.DialogWindowTitle" parent="Widget">
<item name="android:textSize">22sp</item>
<item name="android:textColor">@color/abs__holo_blue_light</item>
</style>
<style name="Sherlock.__TextAppearance.Small" parent="Widget">
<item name="android:textSize">14sp</item>
<item name="android:textColor">?android:attr/textColorSecondary</item>
</style>
<style name="TextAppearance.Sherlock.Small" parent="Sherlock.__TextAppearance.Small">
</style>
<style name="TextAppearance.Sherlock.Light.Small" parent="TextAppearance.Sherlock.Small">
</style>
</resources>

View File

@ -0,0 +1,226 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Sherlock.__Theme" parent="android:Theme.NoTitleBar">
<item name="android:windowContentOverlay">@null</item>
</style>
<style name="Sherlock.__Theme.Light" parent="android:Theme.Light.NoTitleBar">
<item name="android:windowContentOverlay">@null</item>
</style>
<style name="Sherlock.__Theme.DarkActionBar" parent="Theme.Sherlock.Light">
</style>
<style name="Sherlock.__Theme.Dialog" parent="android:Theme.Dialog">
</style>
<style name="Theme.Sherlock" parent="Sherlock.__Theme">
<!-- Action bar styles (from Theme.Holo) -->
<item name="actionDropDownStyle">@style/Widget.Sherlock.Spinner.DropDown.ActionBar</item>
<item name="actionButtonStyle">@style/Widget.Sherlock.ActionButton</item>
<item name="actionOverflowButtonStyle">@style/Widget.Sherlock.ActionButton.Overflow</item>
<item name="actionModeBackground">@drawable/abs__cab_background_top_holo_dark</item>
<item name="actionModeSplitBackground">@drawable/abs__cab_background_bottom_holo_dark</item>
<item name="actionModeCloseDrawable">@drawable/abs__ic_cab_done_holo_dark</item>
<item name="actionBarTabStyle">@style/Widget.Sherlock.ActionBar.TabView</item>
<item name="actionBarTabBarStyle">@style/Widget.Sherlock.ActionBar.TabBar</item>
<item name="actionBarTabTextStyle">@style/Widget.Sherlock.ActionBar.TabText</item>
<item name="actionModeStyle">@style/Widget.Sherlock.ActionMode</item>
<item name="actionModeCloseButtonStyle">@style/Widget.Sherlock.ActionButton.CloseMode</item>
<item name="actionBarStyle">@style/Widget.Sherlock.ActionBar</item>
<item name="actionBarSize">@dimen/abs__action_bar_default_height</item>
<!-- Internal --><item name="actionModePopupWindowStyle">@style/Widget.Sherlock.PopupWindow.ActionMode</item>
<item name="actionBarWidgetTheme">@null</item>
<!-- Action bar styles (defaults from Theme) -->
<item name="actionBarSplitStyle">?attr/actionBarStyle</item>
<item name="actionMenuTextAppearance">@style/TextAppearance.Sherlock.Widget.ActionBar.Menu</item>
<item name="actionMenuTextColor">?attr/textColorPrimary</item>
<item name="actionBarDivider">?attr/dividerVertical</item>
<item name="actionBarItemBackground">@drawable/abs__item_background_holo_dark</item>
<item name="buttonStyleSmall">@style/Widget.Sherlock.Button.Small</item>
<item name="activatedBackgroundIndicator">@drawable/abs__activated_background_holo_dark</item>
<item name="actionModeShareDrawable">@drawable/abs__ic_menu_share_holo_dark</item>
<item name="activityChooserViewStyle">@style/Widget.Sherlock.ActivityChooserView</item>
<item name="homeAsUpIndicator">@drawable/abs__ic_ab_back_holo_dark</item>
<item name="dividerVertical">@drawable/abs__list_divider_holo_dark</item>
<item name="spinnerDropDownItemStyle">@style/Widget.Sherlock.DropDownItem.Spinner</item>
<item name="spinnerItemStyle">@style/Widget.Sherlock.TextView.SpinnerItem</item>
<item name="textColorPrimary">@color/abs__primary_text_holo_dark</item>
<item name="textColorPrimaryDisableOnly">@color/abs__primary_text_disable_only_holo_dark</item>
<item name="textColorPrimaryInverse">@color/abs__primary_text_holo_light</item>
<!-- Internal --><item name="dropdownListPreferredItemHeight">48dip</item>
<item name="dropDownListViewStyle">@style/Widget.Sherlock.ListView.DropDown</item>
<item name="textAppearanceSmall">@style/TextAppearance.Sherlock.Small</item>
<item name="textAppearanceLargePopupMenu">@style/TextAppearance.Sherlock.Widget.PopupMenu.Large</item>
<item name="textAppearanceSmallPopupMenu">@style/TextAppearance.Sherlock.Widget.PopupMenu.Small</item>
<item name="popupMenuStyle">@style/Widget.Sherlock.PopupMenu</item>
<!-- Internal --><item name="listPopupWindowStyle">@style/Widget.Sherlock.ListPopupWindow</item>
<item name="windowActionBar">true</item>
<item name="windowActionModeOverlay">false</item>
<item name="windowContentOverlay">@null</item>
</style>
<style name="Theme.Sherlock.Light" parent="Sherlock.__Theme.Light">
<!-- Action bar styles (from Theme.Holo) -->
<item name="actionDropDownStyle">@style/Widget.Sherlock.Light.Spinner.DropDown.ActionBar</item>
<item name="actionButtonStyle">@style/Widget.Sherlock.Light.ActionButton</item>
<item name="actionOverflowButtonStyle">@style/Widget.Sherlock.Light.ActionButton.Overflow</item>
<item name="actionModeBackground">@drawable/abs__cab_background_top_holo_light</item>
<item name="actionModeSplitBackground">@drawable/abs__cab_background_bottom_holo_light</item>
<item name="actionModeCloseDrawable">@drawable/abs__ic_cab_done_holo_light</item>
<item name="actionBarTabStyle">@style/Widget.Sherlock.Light.ActionBar.TabView</item>
<item name="actionBarTabBarStyle">@style/Widget.Sherlock.Light.ActionBar.TabBar</item>
<item name="actionBarTabTextStyle">@style/Widget.Sherlock.Light.ActionBar.TabText</item>
<item name="actionModeStyle">@style/Widget.Sherlock.Light.ActionMode</item>
<item name="actionModeCloseButtonStyle">@style/Widget.Sherlock.Light.ActionButton.CloseMode</item>
<item name="actionBarStyle">@style/Widget.Sherlock.Light.ActionBar.Solid</item>
<item name="actionBarSize">@dimen/abs__action_bar_default_height</item>
<!-- Internal --><item name="actionModePopupWindowStyle">@style/Widget.Sherlock.Light.PopupWindow.ActionMode</item>
<item name="actionBarWidgetTheme">@null</item>
<!-- Action bar styles (defaults from Theme) -->
<item name="actionBarSplitStyle">?attr/actionBarStyle</item>
<item name="actionMenuTextAppearance">@style/TextAppearance.Sherlock.Widget.ActionBar.Menu</item>
<item name="actionMenuTextColor">?attr/textColorPrimary</item>
<item name="actionBarDivider">?attr/dividerVertical</item>
<item name="actionBarItemBackground">@drawable/abs__item_background_holo_light</item>
<item name="buttonStyleSmall">@style/Widget.Sherlock.Light.Button.Small</item>
<item name="activatedBackgroundIndicator">@drawable/abs__activated_background_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="homeAsUpIndicator">@drawable/abs__ic_ab_back_holo_light</item>
<item name="dividerVertical">@drawable/abs__list_divider_holo_light</item>
<item name="spinnerDropDownItemStyle">@style/Widget.Sherlock.Light.DropDownItem.Spinner</item>
<item name="spinnerItemStyle">@style/Widget.Sherlock.TextView.SpinnerItem</item>
<item name="textColorPrimary">@color/abs__primary_text_holo_light</item>
<item name="textColorPrimaryDisableOnly">@color/abs__primary_text_disable_only_holo_light</item>
<item name="textColorPrimaryInverse">@color/abs__primary_text_holo_dark</item>
<!-- Internal --><item name="dropdownListPreferredItemHeight">48dip</item>
<item name="dropDownListViewStyle">@style/Widget.Sherlock.Light.ListView.DropDown</item>
<item name="textAppearanceSmall">@style/TextAppearance.Sherlock.Light.Small</item>
<item name="textAppearanceLargePopupMenu">@style/TextAppearance.Sherlock.Light.Widget.PopupMenu.Large</item>
<item name="textAppearanceSmallPopupMenu">@style/TextAppearance.Sherlock.Light.Widget.PopupMenu.Small</item>
<item name="popupMenuStyle">@style/Widget.Sherlock.Light.PopupMenu</item>
<!-- Internal --><item name="listPopupWindowStyle">@style/Widget.Sherlock.Light.ListPopupWindow</item>
<item name="windowActionBar">true</item>
<item name="windowActionModeOverlay">false</item>
<item name="windowContentOverlay">@null</item>
</style>
<style name="Theme.Sherlock.Light.DarkActionBar" parent="Sherlock.__Theme.DarkActionBar">
<item name="windowContentOverlay">@drawable/abs__ab_solid_shadow_holo</item>
<item name="actionBarStyle">@style/Widget.Sherlock.Light.ActionBar.Solid.Inverse</item>
<item name="actionBarWidgetTheme">@style/Theme.Sherlock</item>
<item name="actionDropDownStyle">@style/Widget.Sherlock.Spinner.DropDown.ActionBar</item>
<item name="actionButtonStyle">@style/Widget.Sherlock.ActionButton</item>
<item name="actionOverflowButtonStyle">@style/Widget.Sherlock.ActionButton.Overflow</item>
<item name="actionModeBackground">@drawable/abs__cab_background_top_holo_dark</item>
<item name="actionModeSplitBackground">@drawable/abs__cab_background_bottom_holo_dark</item>
<item name="actionModeCloseDrawable">@drawable/abs__ic_cab_done_holo_dark</item>
<item name="homeAsUpIndicator">@drawable/abs__ic_ab_back_holo_dark</item>
<item name="actionBarTabStyle">@style/Widget.Sherlock.Light.ActionBar.TabView.Inverse</item>
<item name="actionBarTabBarStyle">@style/Widget.Sherlock.Light.ActionBar.TabBar.Inverse</item>
<item name="actionBarTabTextStyle">@style/Widget.Sherlock.Light.ActionBar.TabText.Inverse</item>
<item name="actionBarDivider">@drawable/abs__list_divider_holo_dark</item>
<item name="actionBarItemBackground">@drawable/abs__item_background_holo_dark</item>
<item name="actionMenuTextColor">?attr/textColorPrimaryInverse</item>
<item name="actionModeStyle">@style/Widget.Sherlock.Light.ActionMode.Inverse</item>
<item name="actionModeCloseButtonStyle">@style/Widget.Sherlock.ActionButton.CloseMode</item>
<item name="actionModePopupWindowStyle">@style/Widget.Sherlock.PopupWindow.ActionMode</item>
<item name="actionModeShareDrawable">@drawable/abs__ic_menu_share_holo_dark</item>
</style>
<style name="Theme.Sherlock.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<style name="Theme.Sherlock.Light.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</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">
<item name="android:windowFrame">@null</item>
<item name="android:windowTitleStyle">@style/DialogWindowTitle.Sherlock</item>
<item name="android:windowBackground">@drawable/abs__dialog_full_holo_dark</item>
<item name="android:windowIsFloating">true</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowAnimationStyle">@android:style/Animation.Dialog</item>
<item name="android:windowSoftInputMode">stateUnspecified|adjustPan</item>
<item name="android:windowActionBar">false</item>
<item name="android:windowActionModeOverlay">true</item>
<item name="android:windowCloseOnTouchOutside">true</item>
<item name="android:windowNoTitle">true</item>
<item name="android:backgroundDimAmount">0.6</item>
<item name="android:colorBackgroundCacheHint">@null</item>
<item name="android:textColorPrimary">@color/abs__primary_text_holo_dark</item>
<item name="android:textColorPrimaryInverse">@color/abs__primary_text_holo_light</item>
<item name="windowMinWidthMajor">@dimen/abs__dialog_min_width_major</item>
<item name="windowMinWidthMinor">@dimen/abs__dialog_min_width_minor</item>
<item name="windowActionBar">false</item>
<item name="windowContentOverlay">@null</item>
</style>
<style name="Theme.Sherlock.Light.Dialog" parent="android:Theme.Light">
<item name="android:windowFrame">@null</item>
<item name="android:windowTitleStyle">@style/DialogWindowTitle.Sherlock.Light</item>
<item name="android:windowBackground">@drawable/abs__dialog_full_holo_light</item>
<item name="android:windowIsFloating">true</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowAnimationStyle">@android:style/Animation.Dialog</item>
<item name="android:windowSoftInputMode">stateUnspecified|adjustPan</item>
<item name="android:windowActionBar">false</item>
<item name="android:windowActionModeOverlay">true</item>
<item name="android:windowCloseOnTouchOutside">true</item>
<item name="android:windowNoTitle">true</item>
<item name="android:backgroundDimAmount">0.6</item>
<item name="android:colorBackgroundCacheHint">@null</item>
<item name="android:textColorPrimary">@color/abs__primary_text_holo_light</item>
<item name="android:textColorPrimaryInverse">@color/abs__primary_text_holo_dark</item>
<item name="windowMinWidthMajor">@dimen/abs__dialog_min_width_major</item>
<item name="windowMinWidthMinor">@dimen/abs__dialog_min_width_minor</item>
<item name="windowActionBar">false</item>
<item name="windowContentOverlay">@null</item>
</style>
</resources>

View File

@ -18,6 +18,7 @@ package com.actionbarsherlock.app;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.support.v4.app.FragmentTransaction;
import android.util.AttributeSet;
import android.view.Gravity;
import android.view.View;
@ -61,20 +62,20 @@ public abstract class ActionBar {
* will dispatch onOptionsItemSelected to the host Activity with
* a MenuItem with item ID android.R.id.home.
*/
public static final int NAVIGATION_MODE_STANDARD = 1;
public static final int NAVIGATION_MODE_STANDARD = android.app.ActionBar.NAVIGATION_MODE_STANDARD;
/**
* List navigation mode. Instead of static title text this mode
* presents a list menu for navigation within the activity.
* e.g. this might be presented to the user as a dropdown list.
*/
public static final int NAVIGATION_MODE_LIST = 2;
public static final int NAVIGATION_MODE_LIST = android.app.ActionBar.NAVIGATION_MODE_LIST;
/**
* Tab navigation mode. Instead of static title text this mode
* presents a series of tabs for navigation within the activity.
*/
public static final int NAVIGATION_MODE_TABS = 3;
public static final int NAVIGATION_MODE_TABS = android.app.ActionBar.NAVIGATION_MODE_TABS;
/**
* Use logo instead of icon if available. This flag will cause appropriate
@ -83,7 +84,7 @@ public abstract class ActionBar {
* @see #setDisplayOptions(int)
* @see #setDisplayOptions(int, int)
*/
public static final int DISPLAY_USE_LOGO = 0x01;
public static final int DISPLAY_USE_LOGO = android.app.ActionBar.DISPLAY_USE_LOGO;
/**
* Show 'home' elements in this action bar, leaving more space for other
@ -92,7 +93,7 @@ public abstract class ActionBar {
* @see #setDisplayOptions(int)
* @see #setDisplayOptions(int, int)
*/
public static final int DISPLAY_SHOW_HOME = 0x02;
public static final int DISPLAY_SHOW_HOME = android.app.ActionBar.DISPLAY_SHOW_HOME;
/**
* Display the 'home' element such that it appears as an 'up' affordance.
@ -107,7 +108,7 @@ public abstract class ActionBar {
* @see #setDisplayOptions(int)
* @see #setDisplayOptions(int, int)
*/
public static final int DISPLAY_HOME_AS_UP = 0x04;
public static final int DISPLAY_HOME_AS_UP = android.app.ActionBar.DISPLAY_HOME_AS_UP;
/**
* Show the activity title and subtitle, if present.
@ -119,7 +120,7 @@ public abstract class ActionBar {
* @see #setDisplayOptions(int)
* @see #setDisplayOptions(int, int)
*/
public static final int DISPLAY_SHOW_TITLE = 0x08;
public static final int DISPLAY_SHOW_TITLE = android.app.ActionBar.DISPLAY_SHOW_TITLE;
/**
* Show the custom view if one has been set.
@ -127,7 +128,7 @@ public abstract class ActionBar {
* @see #setDisplayOptions(int)
* @see #setDisplayOptions(int, int)
*/
public static final int DISPLAY_SHOW_CUSTOM = 0x10;
public static final int DISPLAY_SHOW_CUSTOM = android.app.ActionBar.DISPLAY_SHOW_CUSTOM;
/**
* Set the action bar into custom navigation mode, supplying a view
@ -863,7 +864,7 @@ public abstract class ActionBar {
* executed in a single transaction. This FragmentTransaction does not support
* being added to the back stack.
*/
public void onTabSelected(Tab tab); //XXX, FragmentTransaction ft);
public void onTabSelected(Tab tab, FragmentTransaction ft);
/**
* Called when a tab exits the selected state.
@ -874,7 +875,7 @@ public abstract class ActionBar {
* will be executed in a single transaction. This FragmentTransaction does not
* support being added to the back stack.
*/
public void onTabUnselected(Tab tab); //XXX, FragmentTransaction ft);
public void onTabUnselected(Tab tab, FragmentTransaction ft);
/**
* Called when a tab that is already selected is chosen again by the user.
@ -885,7 +886,7 @@ public abstract class ActionBar {
* once this method returns. This FragmentTransaction does not support
* being added to the back stack.
*/
public void onTabReselected(Tab tab); //XXX, FragmentTransaction ft);
public void onTabReselected(Tab tab, FragmentTransaction ft);
}
/**

View File

@ -18,8 +18,15 @@ import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuInflater;
import com.actionbarsherlock.view.MenuItem;
public class SherlockActivity extends Activity implements OnCreatePanelMenuListener, OnPreparePanelListener, OnMenuItemSelectedListener, OnActionModeStartedListener, OnActionModeFinishedListener {
final ActionBarSherlock mSherlock = ActionBarSherlock.asDelegateFor(this);
public abstract class SherlockActivity extends Activity implements OnCreatePanelMenuListener, OnPreparePanelListener, OnMenuItemSelectedListener, OnActionModeStartedListener, OnActionModeFinishedListener {
private ActionBarSherlock mSherlock;
protected final ActionBarSherlock getSherlock() {
if (mSherlock == null) {
mSherlock = ActionBarSherlock.wrap(this, ActionBarSherlock.FLAG_DELEGATE);
}
return mSherlock;
}
///////////////////////////////////////////////////////////////////////////
@ -27,22 +34,18 @@ public class SherlockActivity extends Activity implements OnCreatePanelMenuListe
///////////////////////////////////////////////////////////////////////////
public ActionBar getSupportActionBar() {
return mSherlock.getActionBar();
return getSherlock().getActionBar();
}
public ActionMode startActionMode(ActionMode.Callback callback) {
return mSherlock.startActionMode(callback);
return getSherlock().startActionMode(callback);
}
@Override
public void onActionModeStarted(ActionMode mode) {
//This space for rent.
}
public void onActionModeStarted(ActionMode mode) {}
@Override
public void onActionModeFinished(ActionMode mode) {
//This space for rent.
}
public void onActionModeFinished(ActionMode mode) {}
///////////////////////////////////////////////////////////////////////////
@ -52,42 +55,42 @@ public class SherlockActivity extends Activity implements OnCreatePanelMenuListe
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
mSherlock.dispatchConfigurationChanged(newConfig);
getSherlock().dispatchConfigurationChanged(newConfig);
}
@Override
protected void onPostResume() {
super.onPostResume();
mSherlock.dispatchPostResume();
getSherlock().dispatchPostResume();
}
@Override
protected void onPause() {
mSherlock.dispatchPause();
getSherlock().dispatchPause();
super.onPause();
}
@Override
protected void onStop() {
mSherlock.dispatchStop();
getSherlock().dispatchStop();
super.onStop();
}
@Override
protected void onPostCreate(Bundle savedInstanceState) {
mSherlock.dispatchPostCreate(savedInstanceState);
getSherlock().dispatchPostCreate(savedInstanceState);
super.onPostCreate(savedInstanceState);
}
@Override
protected void onTitleChanged(CharSequence title, int color) {
mSherlock.dispatchTitleChanged(title, color);
getSherlock().dispatchTitleChanged(title, color);
super.onTitleChanged(title, color);
}
@Override
public final boolean onMenuOpened(int featureId, android.view.Menu menu) {
if (mSherlock.dispatchMenuOpened(featureId, menu)) {
if (getSherlock().dispatchMenuOpened(featureId, menu)) {
return true;
}
return super.onMenuOpened(featureId, menu);
@ -95,32 +98,69 @@ public class SherlockActivity extends Activity implements OnCreatePanelMenuListe
@Override
public void onPanelClosed(int featureId, android.view.Menu menu) {
mSherlock.dispatchPanelClosed(featureId, menu);
getSherlock().dispatchPanelClosed(featureId, menu);
super.onPanelClosed(featureId, menu);
}
@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
if (mSherlock.dispatchKeyUp(keyCode, event)) {
public boolean dispatchKeyEvent(KeyEvent event) {
if (getSherlock().dispatchKeyEvent(event)) {
return true;
}
return super.onKeyUp(keyCode, event);
return super.dispatchKeyEvent(event);
}
///////////////////////////////////////////////////////////////////////////
// Menu handling
// Native menu handling
///////////////////////////////////////////////////////////////////////////
public MenuInflater getSupportMenuInflater() {
return mSherlock.getMenuInflater();
return getSherlock().getMenuInflater();
}
public void invalidateOptionsMenu() {
getSherlock().dispatchInvalidateOptionsMenu();
}
public void supportInvalidateOptionsMenu() {
invalidateOptionsMenu();
}
@Override
public final boolean onCreateOptionsMenu(android.view.Menu menu) {
return true;
return getSherlock().dispatchCreateOptionsMenu(menu);
}
@Override
public final boolean onPrepareOptionsMenu(android.view.Menu menu) {
return getSherlock().dispatchPrepareOptionsMenu(menu);
}
@Override
public final boolean onOptionsItemSelected(android.view.MenuItem item) {
return getSherlock().dispatchOptionsItemSelected(item);
}
@Override
public void openOptionsMenu() {
if (!getSherlock().dispatchOpenOptionsMenu()) {
super.openOptionsMenu();
}
}
@Override
public void closeOptionsMenu() {
if (!getSherlock().dispatchCloseOptionsMenu()) {
super.closeOptionsMenu();
}
}
///////////////////////////////////////////////////////////////////////////
// Sherlock menu handling
///////////////////////////////////////////////////////////////////////////
@Override
public boolean onCreatePanelMenu(int featureId, Menu menu) {
if (featureId == Window.FEATURE_OPTIONS_PANEL) {
@ -133,11 +173,6 @@ public class SherlockActivity extends Activity implements OnCreatePanelMenuListe
return true;
}
@Override
public final boolean onPrepareOptionsMenu(android.view.Menu menu) {
return mSherlock.dispatchPrepareOptionsMenu(menu);
}
@Override
public boolean onPreparePanel(int featureId, View view, Menu menu) {
if (featureId == Window.FEATURE_OPTIONS_PANEL) {
@ -150,11 +185,6 @@ public class SherlockActivity extends Activity implements OnCreatePanelMenuListe
return true;
}
@Override
public final boolean onOptionsItemSelected(android.view.MenuItem item) {
throw new RuntimeException("This should never be called. Create reproducible test case and report!");
}
@Override
public boolean onMenuItemSelected(int featureId, MenuItem item) {
if (featureId == Window.FEATURE_OPTIONS_PANEL) {
@ -167,30 +197,6 @@ public class SherlockActivity extends Activity implements OnCreatePanelMenuListe
return false;
}
public void invalidateOptionsMenu() {
mSherlock.dispatchInvalidateOptionsMenu();
}
/** @deprecated Use {@link #invalidateOptionsMenu()}. */
@Deprecated
public void supportInvalidateOptionsMenu() {
invalidateOptionsMenu();
}
@Override
public void openOptionsMenu() {
if (!mSherlock.dispatchOpenOptionsMenu()) {
super.openOptionsMenu();
}
}
@Override
public void closeOptionsMenu() {
if (!mSherlock.dispatchCloseOptionsMenu()) {
super.closeOptionsMenu();
}
}
///////////////////////////////////////////////////////////////////////////
// Content
@ -198,26 +204,26 @@ public class SherlockActivity extends Activity implements OnCreatePanelMenuListe
@Override
public void addContentView(View view, LayoutParams params) {
mSherlock.addContentView(view, params);
getSherlock().addContentView(view, params);
}
@Override
public void setContentView(int layoutResId) {
mSherlock.setContentView(layoutResId);
getSherlock().setContentView(layoutResId);
}
@Override
public void setContentView(View view, LayoutParams params) {
mSherlock.setContentView(view, params);
getSherlock().setContentView(view, params);
}
@Override
public void setContentView(View view) {
mSherlock.setContentView(view);
getSherlock().setContentView(view);
}
public void requestWindowFeature(long featureId) {
mSherlock.requestFeature((int)featureId);
getSherlock().requestFeature((int)featureId);
}
@ -226,22 +232,22 @@ public class SherlockActivity extends Activity implements OnCreatePanelMenuListe
///////////////////////////////////////////////////////////////////////////
public void setSupportProgress(int progress) {
mSherlock.setProgress(progress);
getSherlock().setProgress(progress);
}
public void setSupportProgressBarIndeterminate(boolean indeterminate) {
mSherlock.setProgressBarIndeterminate(indeterminate);
getSherlock().setProgressBarIndeterminate(indeterminate);
}
public void setSupportProgressBarIndeterminateVisibility(boolean visible) {
mSherlock.setProgressBarIndeterminateVisibility(visible);
getSherlock().setProgressBarIndeterminateVisibility(visible);
}
public void setSupportProgressBarVisibility(boolean visible) {
mSherlock.setProgressBarVisibility(visible);
getSherlock().setProgressBarVisibility(visible);
}
public void setSupportSecondaryProgress(int secondaryProgress) {
mSherlock.setSecondaryProgress(secondaryProgress);
getSherlock().setSecondaryProgress(secondaryProgress);
}
}

View File

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

View File

@ -18,8 +18,15 @@ import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuInflater;
import com.actionbarsherlock.view.MenuItem;
public class SherlockExpandableListActivity extends ExpandableListActivity implements OnCreatePanelMenuListener, OnPreparePanelListener, OnMenuItemSelectedListener, OnActionModeStartedListener, OnActionModeFinishedListener {
final ActionBarSherlock mSherlock = ActionBarSherlock.asDelegateFor(this);
public abstract class SherlockExpandableListActivity extends ExpandableListActivity implements OnCreatePanelMenuListener, OnPreparePanelListener, OnMenuItemSelectedListener, OnActionModeStartedListener, OnActionModeFinishedListener {
private ActionBarSherlock mSherlock;
protected final ActionBarSherlock getSherlock() {
if (mSherlock == null) {
mSherlock = ActionBarSherlock.wrap(this, ActionBarSherlock.FLAG_DELEGATE);
}
return mSherlock;
}
///////////////////////////////////////////////////////////////////////////
@ -27,22 +34,18 @@ public class SherlockExpandableListActivity extends ExpandableListActivity imple
///////////////////////////////////////////////////////////////////////////
public ActionBar getSupportActionBar() {
return mSherlock.getActionBar();
return getSherlock().getActionBar();
}
public ActionMode startActionMode(ActionMode.Callback callback) {
return mSherlock.startActionMode(callback);
return getSherlock().startActionMode(callback);
}
@Override
public void onActionModeStarted(ActionMode mode) {
//This space for rent.
}
public void onActionModeStarted(ActionMode mode) {}
@Override
public void onActionModeFinished(ActionMode mode) {
//This space for rent.
}
public void onActionModeFinished(ActionMode mode) {}
///////////////////////////////////////////////////////////////////////////
@ -52,42 +55,42 @@ public class SherlockExpandableListActivity extends ExpandableListActivity imple
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
mSherlock.dispatchConfigurationChanged(newConfig);
getSherlock().dispatchConfigurationChanged(newConfig);
}
@Override
protected void onPostResume() {
super.onPostResume();
mSherlock.dispatchPostResume();
getSherlock().dispatchPostResume();
}
@Override
protected void onPause() {
mSherlock.dispatchPause();
getSherlock().dispatchPause();
super.onPause();
}
@Override
protected void onStop() {
mSherlock.dispatchStop();
getSherlock().dispatchStop();
super.onStop();
}
@Override
protected void onPostCreate(Bundle savedInstanceState) {
mSherlock.dispatchPostCreate(savedInstanceState);
getSherlock().dispatchPostCreate(savedInstanceState);
super.onPostCreate(savedInstanceState);
}
@Override
protected void onTitleChanged(CharSequence title, int color) {
mSherlock.dispatchTitleChanged(title, color);
getSherlock().dispatchTitleChanged(title, color);
super.onTitleChanged(title, color);
}
@Override
public final boolean onMenuOpened(int featureId, android.view.Menu menu) {
if (mSherlock.dispatchMenuOpened(featureId, menu)) {
if (getSherlock().dispatchMenuOpened(featureId, menu)) {
return true;
}
return super.onMenuOpened(featureId, menu);
@ -95,32 +98,69 @@ public class SherlockExpandableListActivity extends ExpandableListActivity imple
@Override
public void onPanelClosed(int featureId, android.view.Menu menu) {
mSherlock.dispatchPanelClosed(featureId, menu);
getSherlock().dispatchPanelClosed(featureId, menu);
super.onPanelClosed(featureId, menu);
}
@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
if (mSherlock.dispatchKeyUp(keyCode, event)) {
public boolean dispatchKeyEvent(KeyEvent event) {
if (getSherlock().dispatchKeyEvent(event)) {
return true;
}
return super.onKeyUp(keyCode, event);
return super.dispatchKeyEvent(event);
}
///////////////////////////////////////////////////////////////////////////
// Menu handling
// Native menu handling
///////////////////////////////////////////////////////////////////////////
public MenuInflater getSupportMenuInflater() {
return mSherlock.getMenuInflater();
return getSherlock().getMenuInflater();
}
public void invalidateOptionsMenu() {
getSherlock().dispatchInvalidateOptionsMenu();
}
public void supportInvalidateOptionsMenu() {
invalidateOptionsMenu();
}
@Override
public final boolean onCreateOptionsMenu(android.view.Menu menu) {
return true;
return getSherlock().dispatchCreateOptionsMenu(menu);
}
@Override
public final boolean onPrepareOptionsMenu(android.view.Menu menu) {
return getSherlock().dispatchPrepareOptionsMenu(menu);
}
@Override
public final boolean onOptionsItemSelected(android.view.MenuItem item) {
return getSherlock().dispatchOptionsItemSelected(item);
}
@Override
public void openOptionsMenu() {
if (!getSherlock().dispatchOpenOptionsMenu()) {
super.openOptionsMenu();
}
}
@Override
public void closeOptionsMenu() {
if (!getSherlock().dispatchCloseOptionsMenu()) {
super.closeOptionsMenu();
}
}
///////////////////////////////////////////////////////////////////////////
// Sherlock menu handling
///////////////////////////////////////////////////////////////////////////
@Override
public boolean onCreatePanelMenu(int featureId, Menu menu) {
if (featureId == Window.FEATURE_OPTIONS_PANEL) {
@ -133,11 +173,6 @@ public class SherlockExpandableListActivity extends ExpandableListActivity imple
return true;
}
@Override
public final boolean onPrepareOptionsMenu(android.view.Menu menu) {
return mSherlock.dispatchPrepareOptionsMenu(menu);
}
@Override
public boolean onPreparePanel(int featureId, View view, Menu menu) {
if (featureId == Window.FEATURE_OPTIONS_PANEL) {
@ -150,11 +185,6 @@ public class SherlockExpandableListActivity extends ExpandableListActivity imple
return true;
}
@Override
public final boolean onOptionsItemSelected(android.view.MenuItem item) {
throw new RuntimeException("This should never be called. Create reproducible test case and report!");
}
@Override
public boolean onMenuItemSelected(int featureId, MenuItem item) {
if (featureId == Window.FEATURE_OPTIONS_PANEL) {
@ -167,30 +197,6 @@ public class SherlockExpandableListActivity extends ExpandableListActivity imple
return false;
}
public void invalidateOptionsMenu() {
mSherlock.dispatchInvalidateOptionsMenu();
}
/** @deprecated Use {@link #invalidateOptionsMenu()}. */
@Deprecated
public void supportInvalidateOptionsMenu() {
invalidateOptionsMenu();
}
@Override
public void openOptionsMenu() {
if (!mSherlock.dispatchOpenOptionsMenu()) {
super.openOptionsMenu();
}
}
@Override
public void closeOptionsMenu() {
if (!mSherlock.dispatchCloseOptionsMenu()) {
super.closeOptionsMenu();
}
}
///////////////////////////////////////////////////////////////////////////
// Content
@ -198,26 +204,26 @@ public class SherlockExpandableListActivity extends ExpandableListActivity imple
@Override
public void addContentView(View view, LayoutParams params) {
mSherlock.addContentView(view, params);
getSherlock().addContentView(view, params);
}
@Override
public void setContentView(int layoutResId) {
mSherlock.setContentView(layoutResId);
getSherlock().setContentView(layoutResId);
}
@Override
public void setContentView(View view, LayoutParams params) {
mSherlock.setContentView(view, params);
getSherlock().setContentView(view, params);
}
@Override
public void setContentView(View view) {
mSherlock.setContentView(view);
getSherlock().setContentView(view);
}
public void requestWindowFeature(long featureId) {
mSherlock.requestFeature((int)featureId);
getSherlock().requestFeature((int)featureId);
}
@ -226,22 +232,22 @@ public class SherlockExpandableListActivity extends ExpandableListActivity imple
///////////////////////////////////////////////////////////////////////////
public void setSupportProgress(int progress) {
mSherlock.setProgress(progress);
getSherlock().setProgress(progress);
}
public void setSupportProgressBarIndeterminate(boolean indeterminate) {
mSherlock.setProgressBarIndeterminate(indeterminate);
getSherlock().setProgressBarIndeterminate(indeterminate);
}
public void setSupportProgressBarIndeterminateVisibility(boolean visible) {
mSherlock.setProgressBarIndeterminateVisibility(visible);
getSherlock().setProgressBarIndeterminateVisibility(visible);
}
public void setSupportProgressBarVisibility(boolean visible) {
mSherlock.setProgressBarVisibility(visible);
getSherlock().setProgressBarVisibility(visible);
}
public void setSupportSecondaryProgress(int secondaryProgress) {
mSherlock.setSecondaryProgress(secondaryProgress);
getSherlock().setSecondaryProgress(secondaryProgress);
}
}

View File

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

View File

@ -0,0 +1,347 @@
package com.actionbarsherlock.app;
import android.content.res.Configuration;
import android.os.Build;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.util.Log;
import android.view.KeyEvent;
import android.view.View;
import android.view.ViewGroup.LayoutParams;
import android.view.Window;
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.Menu;
import com.actionbarsherlock.view.MenuInflater;
import com.actionbarsherlock.view.MenuItem;
public abstract class SherlockFragmentActivity extends FragmentActivity implements OnCreatePanelMenuListener, OnPreparePanelListener, OnMenuItemSelectedListener, OnActionModeStartedListener, OnActionModeFinishedListener {
static final boolean DEBUG = false;
private static final String TAG = "SherlockFragmentActivity";
private ActionBarSherlock mSherlock;
private boolean mIgnoreNativeCreate = false;
private boolean mIgnoreNativePrepare = false;
private boolean mIgnoreNativeSelected = false;
private Boolean mOverrideNativeCreate = null;
protected final ActionBarSherlock getSherlock() {
if (mSherlock == null) {
mSherlock = ActionBarSherlock.wrap(this, ActionBarSherlock.FLAG_DELEGATE);
}
return mSherlock;
}
///////////////////////////////////////////////////////////////////////////
// Action bar and mode
///////////////////////////////////////////////////////////////////////////
public ActionBar getSupportActionBar() {
return getSherlock().getActionBar();
}
public ActionMode startActionMode(ActionMode.Callback callback) {
return getSherlock().startActionMode(callback);
}
@Override
public void onActionModeStarted(ActionMode mode) {}
@Override
public void onActionModeFinished(ActionMode mode) {}
///////////////////////////////////////////////////////////////////////////
// General lifecycle/callback dispatching
///////////////////////////////////////////////////////////////////////////
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
getSherlock().dispatchConfigurationChanged(newConfig);
}
@Override
protected void onPostResume() {
super.onPostResume();
getSherlock().dispatchPostResume();
}
@Override
protected void onPause() {
getSherlock().dispatchPause();
super.onPause();
}
@Override
protected void onStop() {
getSherlock().dispatchStop();
super.onStop();
}
@Override
protected void onPostCreate(Bundle savedInstanceState) {
getSherlock().dispatchPostCreate(savedInstanceState);
super.onPostCreate(savedInstanceState);
}
@Override
protected void onTitleChanged(CharSequence title, int color) {
getSherlock().dispatchTitleChanged(title, color);
super.onTitleChanged(title, color);
}
@Override
public final boolean onMenuOpened(int featureId, android.view.Menu menu) {
if (getSherlock().dispatchMenuOpened(featureId, menu)) {
return true;
}
return super.onMenuOpened(featureId, menu);
}
@Override
public void onPanelClosed(int featureId, android.view.Menu menu) {
getSherlock().dispatchPanelClosed(featureId, menu);
super.onPanelClosed(featureId, menu);
}
@Override
public boolean dispatchKeyEvent(KeyEvent event) {
if (getSherlock().dispatchKeyEvent(event)) {
return true;
}
return super.dispatchKeyEvent(event);
}
///////////////////////////////////////////////////////////////////////////
// Native menu handling
///////////////////////////////////////////////////////////////////////////
public MenuInflater getSupportMenuInflater() {
if (DEBUG) Log.d(TAG, "[getSupportMenuInflater]");
return getSherlock().getMenuInflater();
}
public void invalidateOptionsMenu() {
if (DEBUG) Log.d(TAG, "[invalidateOptionsMenu]");
getSherlock().dispatchInvalidateOptionsMenu();
}
protected void supportInvalidateOptionsMenu() {
if (DEBUG) Log.d(TAG, "[supportInvalidateOptionsMenu]");
invalidateOptionsMenu();
}
@Override
public final boolean onCreatePanelMenu(int featureId, android.view.Menu menu) {
if (DEBUG) Log.d(TAG, "[onCreatePanelMenu] featureId: " + featureId + ", menu: " + menu);
if (featureId == Window.FEATURE_OPTIONS_PANEL && !mIgnoreNativeCreate) {
mIgnoreNativeCreate = true;
boolean result = getSherlock().dispatchCreateOptionsMenu(menu);
mIgnoreNativeCreate = false;
if (DEBUG) Log.d(TAG, "[onCreatePanelMenu] returning " + result);
return result;
}
return super.onCreatePanelMenu(featureId, menu);
}
@Override
public final boolean onCreateOptionsMenu(android.view.Menu menu) {
return (mOverrideNativeCreate != null) ? mOverrideNativeCreate.booleanValue() : true;
}
@Override
public final boolean onPreparePanel(int featureId, View view, android.view.Menu menu) {
if (DEBUG) Log.d(TAG, "[onPreparePanel] featureId: " + featureId + ", view: " + view + ", menu: " + menu);
if (featureId == Window.FEATURE_OPTIONS_PANEL && !mIgnoreNativePrepare) {
mIgnoreNativePrepare = true;
boolean result = getSherlock().dispatchPrepareOptionsMenu(menu);
mIgnoreNativePrepare = false;
if (DEBUG) Log.d(TAG, "[onPreparePanel] returning " + result);
return result;
}
return super.onPreparePanel(featureId, view, menu);
}
@Override
public final boolean onPrepareOptionsMenu(android.view.Menu menu) {
return true;
}
@Override
public final boolean onMenuItemSelected(int featureId, android.view.MenuItem item) {
if (DEBUG) Log.d(TAG, "[onMenuItemSelected] featureId: " + featureId + ", item: " + item);
if (featureId == Window.FEATURE_OPTIONS_PANEL && !mIgnoreNativeSelected) {
mIgnoreNativeSelected = true;
boolean result = getSherlock().dispatchOptionsItemSelected(item);
mIgnoreNativeSelected = false;
if (DEBUG) Log.d(TAG, "[onMenuItemSelected] returning " + result);
return result;
}
return super.onMenuItemSelected(featureId, item);
}
@Override
public final boolean onOptionsItemSelected(android.view.MenuItem item) {
return false;
}
@Override
public void openOptionsMenu() {
if (!getSherlock().dispatchOpenOptionsMenu()) {
super.openOptionsMenu();
}
}
@Override
public void closeOptionsMenu() {
if (!getSherlock().dispatchCloseOptionsMenu()) {
super.closeOptionsMenu();
}
}
///////////////////////////////////////////////////////////////////////////
// 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) {
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) {
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) {
return false;
}
///////////////////////////////////////////////////////////////////////////
// Content
///////////////////////////////////////////////////////////////////////////
@Override
public void addContentView(View view, LayoutParams params) {
getSherlock().addContentView(view, params);
}
@Override
public void setContentView(int layoutResId) {
getSherlock().setContentView(layoutResId);
}
@Override
public void setContentView(View view, LayoutParams params) {
getSherlock().setContentView(view, params);
}
@Override
public void setContentView(View view) {
getSherlock().setContentView(view);
}
public void requestWindowFeature(long featureId) {
getSherlock().requestFeature((int)featureId);
}
///////////////////////////////////////////////////////////////////////////
// Progress Indication
///////////////////////////////////////////////////////////////////////////
public void setSupportProgress(int progress) {
getSherlock().setProgress(progress);
}
public void setSupportProgressBarIndeterminate(boolean indeterminate) {
getSherlock().setProgressBarIndeterminate(indeterminate);
}
public void setSupportProgressBarIndeterminateVisibility(boolean visible) {
getSherlock().setProgressBarIndeterminateVisibility(visible);
}
public void setSupportProgressBarVisibility(boolean visible) {
getSherlock().setProgressBarVisibility(visible);
}
public void setSupportSecondaryProgress(int secondaryProgress) {
getSherlock().setSecondaryProgress(secondaryProgress);
}
}

View File

@ -18,8 +18,15 @@ import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuInflater;
import com.actionbarsherlock.view.MenuItem;
public class SherlockListActivity extends ListActivity implements OnCreatePanelMenuListener, OnPreparePanelListener, OnMenuItemSelectedListener, OnActionModeStartedListener, OnActionModeFinishedListener {
final ActionBarSherlock mSherlock = ActionBarSherlock.asDelegateFor(this);
public abstract class SherlockListActivity extends ListActivity implements OnCreatePanelMenuListener, OnPreparePanelListener, OnMenuItemSelectedListener, OnActionModeStartedListener, OnActionModeFinishedListener {
private ActionBarSherlock mSherlock;
protected final ActionBarSherlock getSherlock() {
if (mSherlock == null) {
mSherlock = ActionBarSherlock.wrap(this, ActionBarSherlock.FLAG_DELEGATE);
}
return mSherlock;
}
///////////////////////////////////////////////////////////////////////////
@ -27,22 +34,18 @@ public class SherlockListActivity extends ListActivity implements OnCreatePanelM
///////////////////////////////////////////////////////////////////////////
public ActionBar getSupportActionBar() {
return mSherlock.getActionBar();
return getSherlock().getActionBar();
}
public ActionMode startActionMode(ActionMode.Callback callback) {
return mSherlock.startActionMode(callback);
return getSherlock().startActionMode(callback);
}
@Override
public void onActionModeStarted(ActionMode mode) {
//This space for rent.
}
public void onActionModeStarted(ActionMode mode) {}
@Override
public void onActionModeFinished(ActionMode mode) {
//This space for rent.
}
public void onActionModeFinished(ActionMode mode) {}
///////////////////////////////////////////////////////////////////////////
@ -52,42 +55,42 @@ public class SherlockListActivity extends ListActivity implements OnCreatePanelM
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
mSherlock.dispatchConfigurationChanged(newConfig);
getSherlock().dispatchConfigurationChanged(newConfig);
}
@Override
protected void onPostResume() {
super.onPostResume();
mSherlock.dispatchPostResume();
getSherlock().dispatchPostResume();
}
@Override
protected void onPause() {
mSherlock.dispatchPause();
getSherlock().dispatchPause();
super.onPause();
}
@Override
protected void onStop() {
mSherlock.dispatchStop();
getSherlock().dispatchStop();
super.onStop();
}
@Override
protected void onPostCreate(Bundle savedInstanceState) {
mSherlock.dispatchPostCreate(savedInstanceState);
getSherlock().dispatchPostCreate(savedInstanceState);
super.onPostCreate(savedInstanceState);
}
@Override
protected void onTitleChanged(CharSequence title, int color) {
mSherlock.dispatchTitleChanged(title, color);
getSherlock().dispatchTitleChanged(title, color);
super.onTitleChanged(title, color);
}
@Override
public final boolean onMenuOpened(int featureId, android.view.Menu menu) {
if (mSherlock.dispatchMenuOpened(featureId, menu)) {
if (getSherlock().dispatchMenuOpened(featureId, menu)) {
return true;
}
return super.onMenuOpened(featureId, menu);
@ -95,32 +98,69 @@ public class SherlockListActivity extends ListActivity implements OnCreatePanelM
@Override
public void onPanelClosed(int featureId, android.view.Menu menu) {
mSherlock.dispatchPanelClosed(featureId, menu);
getSherlock().dispatchPanelClosed(featureId, menu);
super.onPanelClosed(featureId, menu);
}
@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
if (mSherlock.dispatchKeyUp(keyCode, event)) {
public boolean dispatchKeyEvent(KeyEvent event) {
if (getSherlock().dispatchKeyEvent(event)) {
return true;
}
return super.onKeyUp(keyCode, event);
return super.dispatchKeyEvent(event);
}
///////////////////////////////////////////////////////////////////////////
// Menu handling
// Native menu handling
///////////////////////////////////////////////////////////////////////////
public MenuInflater getSupportMenuInflater() {
return mSherlock.getMenuInflater();
return getSherlock().getMenuInflater();
}
public void invalidateOptionsMenu() {
getSherlock().dispatchInvalidateOptionsMenu();
}
public void supportInvalidateOptionsMenu() {
invalidateOptionsMenu();
}
@Override
public final boolean onCreateOptionsMenu(android.view.Menu menu) {
return true;
return getSherlock().dispatchCreateOptionsMenu(menu);
}
@Override
public final boolean onPrepareOptionsMenu(android.view.Menu menu) {
return getSherlock().dispatchPrepareOptionsMenu(menu);
}
@Override
public final boolean onOptionsItemSelected(android.view.MenuItem item) {
return getSherlock().dispatchOptionsItemSelected(item);
}
@Override
public void openOptionsMenu() {
if (!getSherlock().dispatchOpenOptionsMenu()) {
super.openOptionsMenu();
}
}
@Override
public void closeOptionsMenu() {
if (!getSherlock().dispatchCloseOptionsMenu()) {
super.closeOptionsMenu();
}
}
///////////////////////////////////////////////////////////////////////////
// Sherlock menu handling
///////////////////////////////////////////////////////////////////////////
@Override
public boolean onCreatePanelMenu(int featureId, Menu menu) {
if (featureId == Window.FEATURE_OPTIONS_PANEL) {
@ -133,11 +173,6 @@ public class SherlockListActivity extends ListActivity implements OnCreatePanelM
return true;
}
@Override
public final boolean onPrepareOptionsMenu(android.view.Menu menu) {
return mSherlock.dispatchPrepareOptionsMenu(menu);
}
@Override
public boolean onPreparePanel(int featureId, View view, Menu menu) {
if (featureId == Window.FEATURE_OPTIONS_PANEL) {
@ -150,11 +185,6 @@ public class SherlockListActivity extends ListActivity implements OnCreatePanelM
return true;
}
@Override
public final boolean onOptionsItemSelected(android.view.MenuItem item) {
throw new RuntimeException("This should never be called. Create reproducible test case and report!");
}
@Override
public boolean onMenuItemSelected(int featureId, MenuItem item) {
if (featureId == Window.FEATURE_OPTIONS_PANEL) {
@ -167,30 +197,6 @@ public class SherlockListActivity extends ListActivity implements OnCreatePanelM
return false;
}
public void invalidateOptionsMenu() {
mSherlock.dispatchInvalidateOptionsMenu();
}
/** @deprecated Use {@link #invalidateOptionsMenu()}. */
@Deprecated
public void supportInvalidateOptionsMenu() {
invalidateOptionsMenu();
}
@Override
public void openOptionsMenu() {
if (!mSherlock.dispatchOpenOptionsMenu()) {
super.openOptionsMenu();
}
}
@Override
public void closeOptionsMenu() {
if (!mSherlock.dispatchCloseOptionsMenu()) {
super.closeOptionsMenu();
}
}
///////////////////////////////////////////////////////////////////////////
// Content
@ -198,26 +204,26 @@ public class SherlockListActivity extends ListActivity implements OnCreatePanelM
@Override
public void addContentView(View view, LayoutParams params) {
mSherlock.addContentView(view, params);
getSherlock().addContentView(view, params);
}
@Override
public void setContentView(int layoutResId) {
mSherlock.setContentView(layoutResId);
getSherlock().setContentView(layoutResId);
}
@Override
public void setContentView(View view, LayoutParams params) {
mSherlock.setContentView(view, params);
getSherlock().setContentView(view, params);
}
@Override
public void setContentView(View view) {
mSherlock.setContentView(view);
getSherlock().setContentView(view);
}
public void requestWindowFeature(long featureId) {
mSherlock.requestFeature((int)featureId);
getSherlock().requestFeature((int)featureId);
}
@ -226,22 +232,22 @@ public class SherlockListActivity extends ListActivity implements OnCreatePanelM
///////////////////////////////////////////////////////////////////////////
public void setSupportProgress(int progress) {
mSherlock.setProgress(progress);
getSherlock().setProgress(progress);
}
public void setSupportProgressBarIndeterminate(boolean indeterminate) {
mSherlock.setProgressBarIndeterminate(indeterminate);
getSherlock().setProgressBarIndeterminate(indeterminate);
}
public void setSupportProgressBarIndeterminateVisibility(boolean visible) {
mSherlock.setProgressBarIndeterminateVisibility(visible);
getSherlock().setProgressBarIndeterminateVisibility(visible);
}
public void setSupportProgressBarVisibility(boolean visible) {
mSherlock.setProgressBarVisibility(visible);
getSherlock().setProgressBarVisibility(visible);
}
public void setSupportSecondaryProgress(int secondaryProgress) {
mSherlock.setSecondaryProgress(secondaryProgress);
getSherlock().setSecondaryProgress(secondaryProgress);
}
}

View File

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

View File

@ -18,8 +18,15 @@ import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuInflater;
import com.actionbarsherlock.view.MenuItem;
public class SherlockPreferenceActivity extends PreferenceActivity implements OnCreatePanelMenuListener, OnPreparePanelListener, OnMenuItemSelectedListener, OnActionModeStartedListener, OnActionModeFinishedListener {
final ActionBarSherlock mSherlock = ActionBarSherlock.asDelegateFor(this);
public abstract class SherlockPreferenceActivity extends PreferenceActivity implements OnCreatePanelMenuListener, OnPreparePanelListener, OnMenuItemSelectedListener, OnActionModeStartedListener, OnActionModeFinishedListener {
private ActionBarSherlock mSherlock;
protected final ActionBarSherlock getSherlock() {
if (mSherlock == null) {
mSherlock = ActionBarSherlock.wrap(this, ActionBarSherlock.FLAG_DELEGATE);
}
return mSherlock;
}
///////////////////////////////////////////////////////////////////////////
@ -27,22 +34,18 @@ public class SherlockPreferenceActivity extends PreferenceActivity implements On
///////////////////////////////////////////////////////////////////////////
public ActionBar getSupportActionBar() {
return mSherlock.getActionBar();
return getSherlock().getActionBar();
}
public ActionMode startActionMode(ActionMode.Callback callback) {
return mSherlock.startActionMode(callback);
return getSherlock().startActionMode(callback);
}
@Override
public void onActionModeStarted(ActionMode mode) {
//This space for rent.
}
public void onActionModeStarted(ActionMode mode) {}
@Override
public void onActionModeFinished(ActionMode mode) {
//This space for rent.
}
public void onActionModeFinished(ActionMode mode) {}
///////////////////////////////////////////////////////////////////////////
@ -52,42 +55,42 @@ public class SherlockPreferenceActivity extends PreferenceActivity implements On
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
mSherlock.dispatchConfigurationChanged(newConfig);
getSherlock().dispatchConfigurationChanged(newConfig);
}
@Override
protected void onPostResume() {
super.onPostResume();
mSherlock.dispatchPostResume();
getSherlock().dispatchPostResume();
}
@Override
protected void onPause() {
mSherlock.dispatchPause();
getSherlock().dispatchPause();
super.onPause();
}
@Override
protected void onStop() {
mSherlock.dispatchStop();
getSherlock().dispatchStop();
super.onStop();
}
@Override
protected void onPostCreate(Bundle savedInstanceState) {
mSherlock.dispatchPostCreate(savedInstanceState);
getSherlock().dispatchPostCreate(savedInstanceState);
super.onPostCreate(savedInstanceState);
}
@Override
protected void onTitleChanged(CharSequence title, int color) {
mSherlock.dispatchTitleChanged(title, color);
getSherlock().dispatchTitleChanged(title, color);
super.onTitleChanged(title, color);
}
@Override
public final boolean onMenuOpened(int featureId, android.view.Menu menu) {
if (mSherlock.dispatchMenuOpened(featureId, menu)) {
if (getSherlock().dispatchMenuOpened(featureId, menu)) {
return true;
}
return super.onMenuOpened(featureId, menu);
@ -95,32 +98,69 @@ public class SherlockPreferenceActivity extends PreferenceActivity implements On
@Override
public void onPanelClosed(int featureId, android.view.Menu menu) {
mSherlock.dispatchPanelClosed(featureId, menu);
getSherlock().dispatchPanelClosed(featureId, menu);
super.onPanelClosed(featureId, menu);
}
@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
if (mSherlock.dispatchKeyUp(keyCode, event)) {
public boolean dispatchKeyEvent(KeyEvent event) {
if (getSherlock().dispatchKeyEvent(event)) {
return true;
}
return super.onKeyUp(keyCode, event);
return super.dispatchKeyEvent(event);
}
///////////////////////////////////////////////////////////////////////////
// Menu handling
// Native menu handling
///////////////////////////////////////////////////////////////////////////
public MenuInflater getSupportMenuInflater() {
return mSherlock.getMenuInflater();
return getSherlock().getMenuInflater();
}
public void invalidateOptionsMenu() {
getSherlock().dispatchInvalidateOptionsMenu();
}
public void supportInvalidateOptionsMenu() {
invalidateOptionsMenu();
}
@Override
public final boolean onCreateOptionsMenu(android.view.Menu menu) {
return true;
return getSherlock().dispatchCreateOptionsMenu(menu);
}
@Override
public final boolean onPrepareOptionsMenu(android.view.Menu menu) {
return getSherlock().dispatchPrepareOptionsMenu(menu);
}
@Override
public final boolean onOptionsItemSelected(android.view.MenuItem item) {
return getSherlock().dispatchOptionsItemSelected(item);
}
@Override
public void openOptionsMenu() {
if (!getSherlock().dispatchOpenOptionsMenu()) {
super.openOptionsMenu();
}
}
@Override
public void closeOptionsMenu() {
if (!getSherlock().dispatchCloseOptionsMenu()) {
super.closeOptionsMenu();
}
}
///////////////////////////////////////////////////////////////////////////
// Sherlock menu handling
///////////////////////////////////////////////////////////////////////////
@Override
public boolean onCreatePanelMenu(int featureId, Menu menu) {
if (featureId == Window.FEATURE_OPTIONS_PANEL) {
@ -133,11 +173,6 @@ public class SherlockPreferenceActivity extends PreferenceActivity implements On
return true;
}
@Override
public final boolean onPrepareOptionsMenu(android.view.Menu menu) {
return mSherlock.dispatchPrepareOptionsMenu(menu);
}
@Override
public boolean onPreparePanel(int featureId, View view, Menu menu) {
if (featureId == Window.FEATURE_OPTIONS_PANEL) {
@ -150,11 +185,6 @@ public class SherlockPreferenceActivity extends PreferenceActivity implements On
return true;
}
@Override
public final boolean onOptionsItemSelected(android.view.MenuItem item) {
throw new RuntimeException("This should never be called. Create reproducible test case and report!");
}
@Override
public boolean onMenuItemSelected(int featureId, MenuItem item) {
if (featureId == Window.FEATURE_OPTIONS_PANEL) {
@ -167,30 +197,6 @@ public class SherlockPreferenceActivity extends PreferenceActivity implements On
return false;
}
public void invalidateOptionsMenu() {
mSherlock.dispatchInvalidateOptionsMenu();
}
/** @deprecated Use {@link #invalidateOptionsMenu()}. */
@Deprecated
public void supportInvalidateOptionsMenu() {
invalidateOptionsMenu();
}
@Override
public void openOptionsMenu() {
if (!mSherlock.dispatchOpenOptionsMenu()) {
super.openOptionsMenu();
}
}
@Override
public void closeOptionsMenu() {
if (!mSherlock.dispatchCloseOptionsMenu()) {
super.closeOptionsMenu();
}
}
///////////////////////////////////////////////////////////////////////////
// Content
@ -198,26 +204,26 @@ public class SherlockPreferenceActivity extends PreferenceActivity implements On
@Override
public void addContentView(View view, LayoutParams params) {
mSherlock.addContentView(view, params);
getSherlock().addContentView(view, params);
}
@Override
public void setContentView(int layoutResId) {
mSherlock.setContentView(layoutResId);
getSherlock().setContentView(layoutResId);
}
@Override
public void setContentView(View view, LayoutParams params) {
mSherlock.setContentView(view, params);
getSherlock().setContentView(view, params);
}
@Override
public void setContentView(View view) {
mSherlock.setContentView(view);
getSherlock().setContentView(view);
}
public void requestWindowFeature(long featureId) {
mSherlock.requestFeature((int)featureId);
getSherlock().requestFeature((int)featureId);
}
@ -226,22 +232,22 @@ public class SherlockPreferenceActivity extends PreferenceActivity implements On
///////////////////////////////////////////////////////////////////////////
public void setSupportProgress(int progress) {
mSherlock.setProgress(progress);
getSherlock().setProgress(progress);
}
public void setSupportProgressBarIndeterminate(boolean indeterminate) {
mSherlock.setProgressBarIndeterminate(indeterminate);
getSherlock().setProgressBarIndeterminate(indeterminate);
}
public void setSupportProgressBarIndeterminateVisibility(boolean visible) {
mSherlock.setProgressBarIndeterminateVisibility(visible);
getSherlock().setProgressBarIndeterminateVisibility(visible);
}
public void setSupportProgressBarVisibility(boolean visible) {
mSherlock.setProgressBarVisibility(visible);
getSherlock().setProgressBarVisibility(visible);
}
public void setSupportSecondaryProgress(int secondaryProgress) {
mSherlock.setSecondaryProgress(secondaryProgress);
getSherlock().setSecondaryProgress(secondaryProgress);
}
}

View File

@ -0,0 +1,318 @@
package com.actionbarsherlock.internal;
import com.actionbarsherlock.ActionBarSherlock;
import com.actionbarsherlock.app.ActionBar;
import com.actionbarsherlock.internal.app.ActionBarWrapper;
import com.actionbarsherlock.internal.view.menu.MenuWrapper;
import com.actionbarsherlock.view.ActionMode;
import com.actionbarsherlock.view.MenuInflater;
import android.app.Activity;
import android.content.Context;
import android.util.Log;
import android.util.TypedValue;
import android.view.ContextThemeWrapper;
import android.view.View;
import android.view.Window;
import android.view.ViewGroup.LayoutParams;
@ActionBarSherlock.Implementation(api = 14)
public class ActionBarSherlockNative extends ActionBarSherlock {
private ActionBarWrapper mActionBar;
private ActionModeWrapper mActionMode;
private MenuWrapper mMenu;
public ActionBarSherlockNative(Activity activity, int flags) {
super(activity, flags);
}
@Override
public ActionBar getActionBar() {
if (DEBUG) Log.d(TAG, "[getActionBar]");
initActionBar();
return mActionBar;
}
private void initActionBar() {
if (mActionBar != null || mActivity.getActionBar() == null) {
return;
}
mActionBar = new ActionBarWrapper(mActivity);
}
@Override
public void dispatchInvalidateOptionsMenu() {
if (DEBUG) Log.d(TAG, "[dispatchInvalidateOptionsMenu]");
mActivity.getWindow().invalidatePanelMenu(Window.FEATURE_OPTIONS_PANEL);
}
@Override
public boolean dispatchCreateOptionsMenu(android.view.Menu menu) {
if (DEBUG) Log.d(TAG, "[dispatchCreateOptionsMenu] menu: " + menu);
if (mMenu == null || menu != mMenu.unwrap()) {
mMenu = new MenuWrapper(menu);
}
final boolean result = callbackCreateOptionsMenu(mMenu);
if (DEBUG) Log.d(TAG, "[dispatchCreateOptionsMenu] returning " + result);
return result;
}
@Override
public boolean dispatchPrepareOptionsMenu(android.view.Menu menu) {
if (DEBUG) Log.d(TAG, "[dispatchPrepareOptionsMenu] menu: " + menu);
final boolean result = callbackPrepareOptionsMenu(mMenu);
if (DEBUG) Log.d(TAG, "[dispatchPrepareOptionsMenu] returning " + result);
return result;
}
@Override
public boolean dispatchOptionsItemSelected(android.view.MenuItem item) {
if (DEBUG) Log.d(TAG, "[dispatchOptionsItemSelected] item: " + item.getTitleCondensed());
final boolean result = callbackOptionsItemSelected(mMenu.findItem(item));
if (DEBUG) Log.d(TAG, "[dispatchOptionsItemSelected] returning " + result);
return result;
}
@Override
public boolean hasFeature(int feature) {
if (DEBUG) Log.d(TAG, "[hasFeature] feature: " + feature);
final boolean result = mActivity.getWindow().hasFeature(feature);
if (DEBUG) Log.d(TAG, "[hasFeature] returning " + result);
return result;
}
@Override
public boolean requestFeature(int featureId) {
if (DEBUG) Log.d(TAG, "[requestFeature] featureId: " + featureId);
final boolean result = mActivity.getWindow().requestFeature(featureId);
if (DEBUG) Log.d(TAG, "[requestFeature] returning " + result);
return result;
}
@Override
public void setUiOptions(int uiOptions) {
if (DEBUG) Log.d(TAG, "[setUiOptions] uiOptions: " + uiOptions);
mActivity.getWindow().setUiOptions(uiOptions);
}
@Override
public void setUiOptions(int uiOptions, int mask) {
if (DEBUG) Log.d(TAG, "[setUiOptions] uiOptions: " + uiOptions + ", mask: " + mask);
mActivity.getWindow().setUiOptions(uiOptions, mask);
}
@Override
public void setContentView(int layoutResId) {
if (DEBUG) Log.d(TAG, "[setContentView] layoutResId: " + layoutResId);
mActivity.getWindow().setContentView(layoutResId);
initActionBar();
}
@Override
public void setContentView(View view, LayoutParams params) {
if (DEBUG) Log.d(TAG, "[setContentView] view: " + view + ", params: " + params);
mActivity.getWindow().setContentView(view, params);
initActionBar();
}
@Override
public void addContentView(View view, LayoutParams params) {
if (DEBUG) Log.d(TAG, "[addContentView] view: " + view + ", params: " + params);
mActivity.getWindow().addContentView(view, params);
initActionBar();
}
@Override
public void setTitle(CharSequence title) {
if (DEBUG) Log.d(TAG, "[setTitle] title: " + title);
mActivity.getWindow().setTitle(title);
}
@Override
public void setProgressBarVisibility(boolean visible) {
if (DEBUG) Log.d(TAG, "[setProgressBarVisibility] visible: " + visible);
mActivity.setProgressBarVisibility(visible);
}
@Override
public void setProgressBarIndeterminateVisibility(boolean visible) {
if (DEBUG) Log.d(TAG, "[setProgressBarIndeterminateVisibility] visible: " + visible);
mActivity.setProgressBarIndeterminateVisibility(visible);
}
@Override
public void setProgressBarIndeterminate(boolean indeterminate) {
if (DEBUG) Log.d(TAG, "[setProgressBarIndeterminate] indeterminate: " + indeterminate);
mActivity.setProgressBarIndeterminate(indeterminate);
}
@Override
public void setProgress(int progress) {
if (DEBUG) Log.d(TAG, "[setProgress] progress: " + progress);
mActivity.setProgress(progress);
}
@Override
public void setSecondaryProgress(int secondaryProgress) {
if (DEBUG) Log.d(TAG, "[setSecondaryProgress] secondaryProgress: " + secondaryProgress);
mActivity.setSecondaryProgress(secondaryProgress);
}
@Override
protected Context getThemedContext() {
Context context = mActivity;
TypedValue outValue = new TypedValue();
mActivity.getTheme().resolveAttribute(android.R.attr.actionBarWidgetTheme, outValue, true);
if (outValue.resourceId != 0) {
//We are unable to test if this is the same as our current theme
//so we just wrap it and hope that if the attribute was specified
//then the user is intentionally specifying an alternate theme.
context = new ContextThemeWrapper(context, outValue.resourceId);
}
return context;
}
@Override
public ActionMode startActionMode(com.actionbarsherlock.view.ActionMode.Callback callback) {
if (DEBUG) Log.d(TAG, "[startActionMode] callback: " + callback);
if (mActionMode != null) {
mActionMode.finish();
}
ActionModeCallbackWrapper wrapped = null;
if (callback != null) {
wrapped = new ActionModeCallbackWrapper(callback);
}
//Calling this will trigger the callback wrapper's onCreate which
//is where we will set the new instance to mActionMode since we need
//to pass it through to the sherlock callbacks and the call below
//will not have returned yet to store its value.
mActivity.startActionMode(wrapped);
return mActionMode;
}
private class ActionModeCallbackWrapper implements android.view.ActionMode.Callback {
private final ActionMode.Callback mCallback;
public ActionModeCallbackWrapper(ActionMode.Callback callback) {
mCallback = callback;
}
@Override
public boolean onCreateActionMode(android.view.ActionMode mode, android.view.Menu menu) {
//See ActionBarSherlockNative#startActionMode
mActionMode = new ActionModeWrapper(mode);
return mCallback.onCreateActionMode(mActionMode, mActionMode.getMenu());
}
@Override
public boolean onPrepareActionMode(android.view.ActionMode mode, android.view.Menu menu) {
return mCallback.onPrepareActionMode(mActionMode, mActionMode.getMenu());
}
@Override
public boolean onActionItemClicked(android.view.ActionMode mode, android.view.MenuItem item) {
return mCallback.onActionItemClicked(mActionMode, mActionMode.getMenu().findItem(item));
}
@Override
public void onDestroyActionMode(android.view.ActionMode mode) {
mCallback.onDestroyActionMode(mActionMode);
}
}
private class ActionModeWrapper extends ActionMode {
private final android.view.ActionMode mActionMode;
private MenuWrapper mMenu = null;
ActionModeWrapper(android.view.ActionMode actionMode) {
mActionMode = actionMode;
}
@Override
public void setTitle(CharSequence title) {
mActionMode.setTitle(title);
}
@Override
public void setTitle(int resId) {
mActionMode.setTitle(resId);
}
@Override
public void setSubtitle(CharSequence subtitle) {
mActionMode.setSubtitle(subtitle);
}
@Override
public void setSubtitle(int resId) {
mActionMode.setSubtitle(resId);
}
@Override
public void setCustomView(View view) {
mActionMode.setCustomView(view);
}
@Override
public void invalidate() {
mActionMode.invalidate();
}
@Override
public void finish() {
mActionMode.finish();
}
@Override
public MenuWrapper getMenu() {
if (mMenu == null) {
mMenu = new MenuWrapper(mActionMode.getMenu());
}
return mMenu;
}
@Override
public CharSequence getTitle() {
return mActionMode.getTitle();
}
@Override
public CharSequence getSubtitle() {
return mActionMode.getSubtitle();
}
@Override
public View getCustomView() {
return mActionMode.getCustomView();
}
@Override
public MenuInflater getMenuInflater() {
return ActionBarSherlockNative.this.getMenuInflater();
}
}
}

View File

@ -0,0 +1,95 @@
package com.actionbarsherlock.internal;
import android.content.Context;
import android.os.Build;
import android.util.DisplayMetrics;
import com.actionbarsherlock.R;
public final class ResourcesCompat {
//No instances
private ResourcesCompat() {}
/**
* Support implementation of {@code getResources().getBoolean()} that we
* can use to simulate filtering based on width and smallest width
* qualifiers on pre-3.2.
*
* @param context Context to load booleans from on 3.2+ and to fetch the
* display metrics.
* @param id Id of boolean to load.
* @return Associated boolean value as reflected by the current display
* metrics.
*/
public static boolean getResources_getBoolean(Context context, int id) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) {
return context.getResources().getBoolean(id);
}
DisplayMetrics metrics = context.getResources().getDisplayMetrics();
float widthDp = metrics.widthPixels / metrics.density;
float heightDp = metrics.heightPixels / metrics.density;
float smallestWidthDp = (widthDp < heightDp) ? widthDp : heightDp;
if (id == R.bool.abs__action_bar_embed_tabs) {
if (widthDp >= 480) {
return true; //values-w480dp
}
return false; //values
}
if (id == R.bool.abs__split_action_bar_is_narrow) {
if (widthDp >= 480) {
return false; //values-w480dp
}
return true; //values
}
if (id == R.bool.abs__action_bar_expanded_action_views_exclusive) {
if (smallestWidthDp >= 600) {
return false; //values-sw600dp
}
return true; //values
}
if (id == R.bool.abs__config_allowActionMenuItemTextWithIcon) {
if (widthDp >= 480) {
return true; //values-w480dp
}
return false; //values
}
throw new IllegalArgumentException("Unknown boolean resource ID " + id);
}
/**
* Support implementation of {@code getResources().getInteger()} that we
* can use to simulate filtering based on width qualifiers on pre-3.2.
*
* @param context Context to load integers from on 3.2+ and to fetch the
* display metrics.
* @param id Id of integer to load.
* @return Associated integer value as reflected by the current display
* metrics.
*/
public static int getResources_getInteger(Context context, int id) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) {
return context.getResources().getInteger(id);
}
DisplayMetrics metrics = context.getResources().getDisplayMetrics();
float widthDp = metrics.widthPixels / metrics.density;
if (id == R.integer.abs__max_action_buttons) {
if (widthDp >= 600) {
return 5; //values-w600dp
}
if (widthDp >= 500) {
return 4; //values-w500dp
}
if (widthDp >= 360) {
return 3; //values-w360dp
}
return 2; //values
}
throw new IllegalArgumentException("Unknown integer resource ID " + id);
}
}

View File

@ -26,6 +26,7 @@ import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Handler;
import android.support.v4.app.FragmentTransaction;
import android.util.TypedValue;
import android.view.ContextThemeWrapper;
import android.view.LayoutInflater;
@ -35,6 +36,7 @@ import android.view.accessibility.AccessibilityEvent;
import android.widget.SpinnerAdapter;
import com.actionbarsherlock.R;
import com.actionbarsherlock.app.ActionBar;
import com.actionbarsherlock.app.SherlockFragmentActivity;
import com.actionbarsherlock.internal.nineoldandroids.animation.Animator;
import com.actionbarsherlock.internal.nineoldandroids.animation.AnimatorListenerAdapter;
import com.actionbarsherlock.internal.nineoldandroids.animation.AnimatorSet;
@ -43,7 +45,6 @@ import com.actionbarsherlock.internal.nineoldandroids.animation.Animator.Animato
import com.actionbarsherlock.internal.nineoldandroids.widget.NineFrameLayout;
import com.actionbarsherlock.internal.view.menu.MenuBuilder;
import com.actionbarsherlock.internal.view.menu.MenuPopupHelper;
import com.actionbarsherlock.internal.view.menu.MenuPresenter;
import com.actionbarsherlock.internal.view.menu.SubMenuBuilder;
import com.actionbarsherlock.internal.widget.ActionBarContainer;
import com.actionbarsherlock.internal.widget.ActionBarContextView;
@ -53,6 +54,7 @@ import com.actionbarsherlock.view.ActionMode;
import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuInflater;
import com.actionbarsherlock.view.MenuItem;
import static com.actionbarsherlock.internal.ResourcesCompat.getResources_getBoolean;
/**
* ActionBarImpl is the ActionBar implementation used
@ -66,7 +68,7 @@ public class ActionBarImpl extends ActionBar {
private Context mContext;
private Context mThemedContext;
//UNUSED private Activity mActivity;
private Activity mActivity;
//UNUSED private Dialog mDialog;
private ActionBarContainer mContainerView;
@ -131,7 +133,7 @@ public class ActionBarImpl extends ActionBar {
};
public ActionBarImpl(Activity activity, int features) {
//UNUSED mActivity = activity;
mActivity = activity;
Window window = activity.getWindow();
View decor = window.getDecorView();
init(decor);
@ -168,20 +170,14 @@ public class ActionBarImpl extends ActionBar {
// Older apps get the home button interaction enabled by default.
// Newer apps need to enable it explicitly.
//setHomeButtonEnabled(mContext.getApplicationInfo().targetSdkVersion < 14);
// We're all new brotha! This. Is. ActionBarSherlock!
setHomeButtonEnabled(false);
setHomeButtonEnabled(mContext.getApplicationInfo().targetSdkVersion < 14);
setHasEmbeddedTabs(mContext.getResources().getBoolean(
setHasEmbeddedTabs(getResources_getBoolean(mContext,
R.bool.abs__action_bar_embed_tabs));
}
public void setMenu(Menu menu, MenuPresenter.Callback cb) {
mActionView.setMenu(menu, cb);
}
public void onConfigurationChanged(Configuration newConfig) {
setHasEmbeddedTabs(mContext.getResources().getBoolean(
setHasEmbeddedTabs(getResources_getBoolean(mContext,
R.bool.abs__action_bar_embed_tabs));
//Manually dispatch a configuration change to the action bar view on pre-2.2
@ -509,28 +505,31 @@ public class ActionBarImpl extends ActionBar {
return;
}
/* XXX final FragmentTransaction trans = mActivity.getSupportFragmentManager().beginTransaction()
.disallowAddToBackStack();*/
FragmentTransaction trans = null;
if (mActivity instanceof SherlockFragmentActivity) {
trans = ((SherlockFragmentActivity)mActivity).getSupportFragmentManager().beginTransaction()
.disallowAddToBackStack();
}
if (mSelectedTab == tab) {
if (mSelectedTab != null) {
mSelectedTab.getCallback().onTabReselected(mSelectedTab); //XXX, trans);
mSelectedTab.getCallback().onTabReselected(mSelectedTab, trans);
mTabScrollView.animateToTab(tab.getPosition());
}
} else {
mTabScrollView.setTabSelected(tab != null ? tab.getPosition() : Tab.INVALID_POSITION);
if (mSelectedTab != null) {
mSelectedTab.getCallback().onTabUnselected(mSelectedTab); //XXX, trans);
mSelectedTab.getCallback().onTabUnselected(mSelectedTab, trans);
}
mSelectedTab = (TabImpl) tab;
if (mSelectedTab != null) {
mSelectedTab.getCallback().onTabSelected(mSelectedTab); //XXX, trans);
mSelectedTab.getCallback().onTabSelected(mSelectedTab, trans);
}
}
/* XXX if (!trans.isEmpty()) {
if (trans != null && !trans.isEmpty()) {
trans.commit();
}*/
}
}
@Override

View File

@ -0,0 +1,468 @@
package com.actionbarsherlock.internal.app;
import java.util.HashSet;
import java.util.Set;
import android.app.Activity;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.support.v4.app.FragmentTransaction;
import android.view.View;
import android.widget.SpinnerAdapter;
import com.actionbarsherlock.app.ActionBar;
import com.actionbarsherlock.app.SherlockFragmentActivity;
public class ActionBarWrapper extends ActionBar implements android.app.ActionBar.OnNavigationListener, android.app.ActionBar.OnMenuVisibilityListener {
private final Activity mActivity;
private final android.app.ActionBar mActionBar;
private ActionBar.OnNavigationListener mNavigationListener;
private Set<OnMenuVisibilityListener> mMenuVisibilityListeners = new HashSet<OnMenuVisibilityListener>(1);
private FragmentTransaction mFragmentTransaction;
public ActionBarWrapper(Activity activity) {
mActivity = activity;
mActionBar = activity.getActionBar();
if (mActionBar != null) {
mActionBar.addOnMenuVisibilityListener(this);
}
}
@Override
public void setHomeButtonEnabled(boolean enabled) {
mActionBar.setHomeButtonEnabled(enabled);
}
@Override
public Context getThemedContext() {
return mActionBar.getThemedContext();
}
@Override
public void setCustomView(View view) {
mActionBar.setCustomView(view);
}
@Override
public void setCustomView(View view, LayoutParams layoutParams) {
android.app.ActionBar.LayoutParams lp = new android.app.ActionBar.LayoutParams(layoutParams);
lp.gravity = layoutParams.gravity;
lp.bottomMargin = layoutParams.bottomMargin;
lp.topMargin = layoutParams.topMargin;
lp.leftMargin = layoutParams.leftMargin;
lp.rightMargin = layoutParams.rightMargin;
mActionBar.setCustomView(view, lp);
}
@Override
public void setCustomView(int resId) {
mActionBar.setCustomView(resId);
}
@Override
public void setIcon(int resId) {
mActionBar.setIcon(resId);
}
@Override
public void setIcon(Drawable icon) {
mActionBar.setIcon(icon);
}
@Override
public void setLogo(int resId) {
mActionBar.setLogo(resId);
}
@Override
public void setLogo(Drawable logo) {
mActionBar.setLogo(logo);
}
@Override
public void setListNavigationCallbacks(SpinnerAdapter adapter, OnNavigationListener callback) {
mNavigationListener = callback;
mActionBar.setListNavigationCallbacks(adapter, (callback != null) ? this : null);
}
@Override
public boolean onNavigationItemSelected(int itemPosition, long itemId) {
//This should never be a NullPointerException since we only set
//ourselves as the listener when the callback is not null.
return mNavigationListener.onNavigationItemSelected(itemPosition, itemId);
}
@Override
public void setSelectedNavigationItem(int position) {
mActionBar.setSelectedNavigationItem(position);
}
@Override
public int getSelectedNavigationIndex() {
return mActionBar.getSelectedNavigationIndex();
}
@Override
public int getNavigationItemCount() {
return mActionBar.getNavigationItemCount();
}
@Override
public void setTitle(CharSequence title) {
mActionBar.setTitle(title);
}
@Override
public void setTitle(int resId) {
mActionBar.setTitle(resId);
}
@Override
public void setSubtitle(CharSequence subtitle) {
mActionBar.setSubtitle(subtitle);
}
@Override
public void setSubtitle(int resId) {
mActionBar.setSubtitle(resId);
}
@Override
public void setDisplayOptions(int options) {
mActionBar.setDisplayOptions(options);
}
@Override
public void setDisplayOptions(int options, int mask) {
mActionBar.setDisplayOptions(options, mask);
}
@Override
public void setDisplayUseLogoEnabled(boolean useLogo) {
mActionBar.setDisplayUseLogoEnabled(useLogo);
}
@Override
public void setDisplayShowHomeEnabled(boolean showHome) {
mActionBar.setDisplayShowHomeEnabled(showHome);
}
@Override
public void setDisplayHomeAsUpEnabled(boolean showHomeAsUp) {
mActionBar.setDisplayHomeAsUpEnabled(showHomeAsUp);
}
@Override
public void setDisplayShowTitleEnabled(boolean showTitle) {
mActionBar.setDisplayShowTitleEnabled(showTitle);
}
@Override
public void setDisplayShowCustomEnabled(boolean showCustom) {
mActionBar.setDisplayShowCustomEnabled(showCustom);
}
@Override
public void setBackgroundDrawable(Drawable d) {
mActionBar.setBackgroundDrawable(d);
}
@Override
public void setStackedBackgroundDrawable(Drawable d) {
mActionBar.setStackedBackgroundDrawable(d);
}
@Override
public void setSplitBackgroundDrawable(Drawable d) {
mActionBar.setSplitBackgroundDrawable(d);
}
@Override
public View getCustomView() {
return mActionBar.getCustomView();
}
@Override
public CharSequence getTitle() {
return mActionBar.getTitle();
}
@Override
public CharSequence getSubtitle() {
return mActionBar.getSubtitle();
}
@Override
public int getNavigationMode() {
return mActionBar.getNavigationMode();
}
@Override
public void setNavigationMode(int mode) {
mActionBar.setNavigationMode(mode);
}
@Override
public int getDisplayOptions() {
return mActionBar.getDisplayOptions();
}
public class TabWrapper extends ActionBar.Tab implements android.app.ActionBar.TabListener {
final android.app.ActionBar.Tab mNativeTab;
private Object mTag;
private TabListener mListener;
public TabWrapper(android.app.ActionBar.Tab nativeTab) {
mNativeTab = nativeTab;
mNativeTab.setTag(this);
mNativeTab.setTabListener(this);
}
@Override
public int getPosition() {
return mNativeTab.getPosition();
}
@Override
public Drawable getIcon() {
return mNativeTab.getIcon();
}
@Override
public CharSequence getText() {
return mNativeTab.getText();
}
@Override
public Tab setIcon(Drawable icon) {
mNativeTab.setIcon(icon);
return this;
}
@Override
public Tab setIcon(int resId) {
mNativeTab.setIcon(resId);
return this;
}
@Override
public Tab setText(CharSequence text) {
mNativeTab.setText(text);
return this;
}
@Override
public Tab setText(int resId) {
mNativeTab.setText(resId);
return this;
}
@Override
public Tab setCustomView(View view) {
mNativeTab.setCustomView(view);
return this;
}
@Override
public Tab setCustomView(int layoutResId) {
mNativeTab.setCustomView(layoutResId);
return this;
}
@Override
public View getCustomView() {
return mNativeTab.getCustomView();
}
@Override
public Tab setTag(Object obj) {
mTag = obj;
return this;
}
@Override
public Object getTag() {
return mTag;
}
@Override
public Tab setTabListener(TabListener listener) {
mListener = listener;
return this;
}
@Override
public void select() {
mNativeTab.select();
}
@Override
public Tab setContentDescription(int resId) {
mNativeTab.setContentDescription(resId);
return this;
}
@Override
public Tab setContentDescription(CharSequence contentDesc) {
mNativeTab.setContentDescription(contentDesc);
return this;
}
@Override
public CharSequence getContentDescription() {
return mNativeTab.getContentDescription();
}
@Override
public void onTabReselected(android.app.ActionBar.Tab tab, android.app.FragmentTransaction ft) {
if (mListener != null) {
FragmentTransaction trans = null;
if (mActivity instanceof SherlockFragmentActivity) {
trans = ((SherlockFragmentActivity)mActivity).getSupportFragmentManager().beginTransaction()
.disallowAddToBackStack();
}
mListener.onTabReselected(this, trans);
if (trans != null && !trans.isEmpty()) {
trans.commit();
}
}
}
@Override
public void onTabSelected(android.app.ActionBar.Tab tab, android.app.FragmentTransaction ft) {
if (mListener != null) {
if (mFragmentTransaction == null && mActivity instanceof SherlockFragmentActivity) {
mFragmentTransaction = ((SherlockFragmentActivity)mActivity).getSupportFragmentManager().beginTransaction()
.disallowAddToBackStack();
}
mListener.onTabSelected(this, mFragmentTransaction);
if (mFragmentTransaction != null) {
if (!mFragmentTransaction.isEmpty()) {
mFragmentTransaction.commit();
}
mFragmentTransaction = null;
}
}
}
@Override
public void onTabUnselected(android.app.ActionBar.Tab tab, android.app.FragmentTransaction ft) {
if (mListener != null) {
FragmentTransaction trans = null;
if (mActivity instanceof SherlockFragmentActivity) {
trans = ((SherlockFragmentActivity)mActivity).getSupportFragmentManager().beginTransaction()
.disallowAddToBackStack();
mFragmentTransaction = trans;
}
mListener.onTabUnselected(this, trans);
}
}
}
@Override
public Tab newTab() {
return new TabWrapper(mActionBar.newTab());
}
@Override
public void addTab(Tab tab) {
mActionBar.addTab(((TabWrapper)tab).mNativeTab);
}
@Override
public void addTab(Tab tab, boolean setSelected) {
mActionBar.addTab(((TabWrapper)tab).mNativeTab, setSelected);
}
@Override
public void addTab(Tab tab, int position) {
mActionBar.addTab(((TabWrapper)tab).mNativeTab, position);
}
@Override
public void addTab(Tab tab, int position, boolean setSelected) {
mActionBar.addTab(((TabWrapper)tab).mNativeTab, position, setSelected);
}
@Override
public void removeTab(Tab tab) {
mActionBar.removeTab(((TabWrapper)tab).mNativeTab);
}
@Override
public void removeTabAt(int position) {
mActionBar.removeTabAt(position);
}
@Override
public void removeAllTabs() {
mActionBar.removeAllTabs();
}
@Override
public void selectTab(Tab tab) {
mActionBar.selectTab(((TabWrapper)tab).mNativeTab);
}
@Override
public Tab getSelectedTab() {
android.app.ActionBar.Tab selected = mActionBar.getSelectedTab();
return (selected != null) ? (Tab)selected.getTag() : null;
}
@Override
public Tab getTabAt(int index) {
android.app.ActionBar.Tab selected = mActionBar.getTabAt(index);
return (selected != null) ? (Tab)selected.getTag() : null;
}
@Override
public int getTabCount() {
return mActionBar.getTabCount();
}
@Override
public int getHeight() {
return mActionBar.getHeight();
}
@Override
public void show() {
mActionBar.show();
}
@Override
public void hide() {
mActionBar.hide();
}
@Override
public boolean isShowing() {
return mActionBar.isShowing();
}
@Override
public void addOnMenuVisibilityListener(OnMenuVisibilityListener listener) {
mMenuVisibilityListeners.add(listener);
}
@Override
public void removeOnMenuVisibilityListener(OnMenuVisibilityListener listener) {
mMenuVisibilityListeners.remove(listener);
}
@Override
public void onMenuVisibilityChanged(boolean isVisible) {
for (OnMenuVisibilityListener listener : mMenuVisibilityListeners) {
listener.onMenuVisibilityChanged(isVisible);
}
}
}

View File

@ -42,6 +42,7 @@ import android.view.animation.Interpolator;
* circular dependencies do not make logical sense anyway), circular dependencies
* should be avoided, and the dependency flow of animations should only be in one direction.
*/
@SuppressWarnings("unchecked")
public final class AnimatorSet extends Animator {
/**
@ -278,7 +279,6 @@ public final class AnimatorSet extends Animator {
* <p>Note that canceling a <code>AnimatorSet</code> also cancels all of the animations that it
* is responsible for.</p>
*/
@SuppressWarnings("unchecked")
@Override
public void cancel() {
mTerminated = true;
@ -445,7 +445,6 @@ public final class AnimatorSet extends Animator {
* it is responsible. The details of when exactly those animations are started depends on
* the dependency relationships that have been set up between the animations.
*/
@SuppressWarnings("unchecked")
@Override
public void start() {
mTerminated = false;
@ -727,7 +726,6 @@ public final class AnimatorSet extends Animator {
}
}
@SuppressWarnings("unchecked")
public void onAnimationEnd(Animator animation) {
animation.removeListener(this);
mPlayingSet.remove(animation);
@ -949,7 +947,7 @@ public final class AnimatorSet extends Animator {
public Node clone() {
try {
Node node = (Node) super.clone();
node.animation = (Animator) animation.clone();
node.animation = animation.clone();
return node;
} catch (CloneNotSupportedException e) {
throw new AssertionError();

View File

@ -31,6 +31,7 @@ import com.actionbarsherlock.internal.nineoldandroids.animation.Keyframe.FloatKe
* TypeEvaluator set for the animation, so that values can be calculated without autoboxing to the
* Object equivalents of these primitive types.</p>
*/
@SuppressWarnings("unchecked")
class FloatKeyframeSet extends KeyframeSet {
private float firstValue;
private float lastValue;

View File

@ -31,6 +31,7 @@ import com.actionbarsherlock.internal.nineoldandroids.animation.Keyframe.IntKeyf
* TypeEvaluator set for the animation, so that values can be calculated without autoboxing to the
* Object equivalents of these primitive types.</p>
*/
@SuppressWarnings("unchecked")
class IntKeyframeSet extends KeyframeSet {
private int firstValue;
private int lastValue;

View File

@ -35,6 +35,7 @@ import android.view.animation.Interpolator;
* of {@link TypeEvaluator}), you should stick to using float and int as animations using those
* types have lower runtime overhead than other types.</p>
*/
@SuppressWarnings("rawtypes")
public abstract class Keyframe implements Cloneable {
/**
* The time at which mValue will hold true.

View File

@ -29,6 +29,7 @@ import com.actionbarsherlock.internal.nineoldandroids.animation.Keyframe.ObjectK
* values between those keyframes for a given animation. The class internal to the animation
* package because it is an implementation detail of how Keyframes are stored and used.
*/
@SuppressWarnings({"rawtypes", "unchecked"})
class KeyframeSet {
int mNumKeyframes;

View File

@ -32,6 +32,7 @@ import java.util.ArrayList;
* @see #setPropertyName(String)
*
*/
@SuppressWarnings("rawtypes")
public final class ObjectAnimator extends ValueAnimator {
private static final boolean DBG = false;

View File

@ -32,6 +32,7 @@ import java.util.concurrent.locks.ReentrantReadWriteLock;
* animations with ValueAnimator or ObjectAnimator that operate on several different properties
* in parallel.
*/
@SuppressWarnings({"rawtypes", "unchecked"})
public class PropertyValuesHolder implements Cloneable {
/**
@ -255,7 +256,7 @@ public class PropertyValuesHolder implements Cloneable {
else {
PropertyValuesHolder pvh = new PropertyValuesHolder(propertyName);
pvh.mKeyframeSet = keyframeSet;
pvh.mValueType = ((Keyframe)values[0]).getType();
pvh.mValueType = values[0].getType();
return pvh;
}
}
@ -335,9 +336,9 @@ public class PropertyValuesHolder implements Cloneable {
public void setKeyframes(Keyframe... values) {
int numKeyframes = values.length;
Keyframe keyframes[] = new Keyframe[Math.max(numKeyframes,2)];
mValueType = ((Keyframe)values[0]).getType();
mValueType = values[0].getType();
for (int i = 0; i < numKeyframes; ++i) {
keyframes[i] = (Keyframe)values[i];
keyframes[i] = values[i];
}
mKeyframeSet = new KeyframeSet(keyframes);
}

View File

@ -40,6 +40,7 @@ import java.util.HashMap;
* out of an animation. This behavior can be changed by calling
* {@link ValueAnimator#setInterpolator(TimeInterpolator)}.</p>
*/
@SuppressWarnings({"rawtypes", "unchecked"})
public class ValueAnimator extends Animator {
/**
@ -145,8 +146,8 @@ public class ValueAnimator extends Animator {
new AccelerateDecelerateInterpolator();
// type evaluators for the primitive types handled by this implementation
private static final TypeEvaluator sIntEvaluator = new IntEvaluator();
private static final TypeEvaluator sFloatEvaluator = new FloatEvaluator();
//private static final TypeEvaluator sIntEvaluator = new IntEvaluator();
//private static final TypeEvaluator sFloatEvaluator = new FloatEvaluator();
/**
* Used to indicate whether the animation is currently playing in reverse. This causes the
@ -457,7 +458,7 @@ public class ValueAnimator extends Animator {
mValues = values;
mValuesMap = new HashMap<String, PropertyValuesHolder>(numValues);
for (int i = 0; i < numValues; ++i) {
PropertyValuesHolder valuesHolder = (PropertyValuesHolder) values[i];
PropertyValuesHolder valuesHolder = values[i];
mValuesMap.put(valuesHolder.getPropertyName(), valuesHolder);
}
// New property/values/target should cause re-initialization prior to starting

View File

@ -22,6 +22,18 @@ public abstract class NineViewGroup extends ViewGroup {
mProxy = AnimatorProxy.NEEDS_PROXY ? AnimatorProxy.wrap(this) : null;
}
@Override
public void setVisibility(int visibility) {
if (mProxy != null) {
if (visibility == GONE) {
clearAnimation();
} else if (visibility == VISIBLE) {
setAnimation(mProxy);
}
}
super.setVisibility(visibility);
}
public float getAlpha() {
if (AnimatorProxy.NEEDS_PROXY) {
return mProxy.getAlpha();

View File

@ -1,7 +1,11 @@
package com.actionbarsherlock.internal.nineoldandroids.view.animation;
import java.lang.ref.WeakReference;
import java.util.WeakHashMap;
import android.graphics.Matrix;
import android.graphics.RectF;
import android.os.Build;
import android.util.FloatMath;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.Transformation;
@ -9,24 +13,35 @@ import android.view.animation.Transformation;
public final class AnimatorProxy extends Animation {
public static final boolean NEEDS_PROXY = Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB;
private static final WeakHashMap<View, AnimatorProxy> PROXIES =
new WeakHashMap<View, AnimatorProxy>();
public static AnimatorProxy wrap(View view) {
return new AnimatorProxy(view);
AnimatorProxy proxy = PROXIES.get(view);
if (proxy == null) {
proxy = new AnimatorProxy(view);
PROXIES.put(view, proxy);
}
return proxy;
}
private final View mView;
private final WeakReference<View> mView;
private float mAlpha = 1f;
private float mTranslationX = 0f;
private float mTranslationY = 0f;
private float mScaleX = 1f;
private float mScaleY = 1f;
private float mAlpha = 1;
private float mScaleX = 1;
private float mScaleY = 1;
private float mTranslationX;
private float mTranslationY;
private final RectF mBefore = new RectF();
private final RectF mAfter = new RectF();
private final Matrix mTempMatrix = new Matrix();
private AnimatorProxy(View view) {
super();
setDuration(0); //perform transformation immediately
setFillAfter(true); //persist transformation beyond duration
view.setAnimation(this);
mView = view;
mView = new WeakReference<View>(view);
}
public float getAlpha() {
@ -35,34 +50,20 @@ public final class AnimatorProxy extends Animation {
public void setAlpha(float alpha) {
if (mAlpha != alpha) {
mAlpha = alpha;
invalidateParent();
}
}
public float getTranslationX() {
return mTranslationX;
}
public void setTranslationX(float translationX) {
if (mTranslationX != translationX) {
mTranslationX = translationX;
invalidateParent();
}
}
public float getTranslationY() {
return mTranslationY;
}
public void setTranslationY(float translationY) {
if (mTranslationY != translationY) {
mTranslationY = translationY;
invalidateParent();
View view = mView.get();
if (view != null) {
view.invalidate();
}
}
}
public float getScaleX() {
return mScaleX;
}
public void setScaleX(float scale) {
if (mScaleX != scale) {
mScaleX = scale;
invalidateParent();
public void setScaleX(float scaleX) {
if (mScaleX != scaleX) {
prepareForUpdate();
mScaleX = scaleX;
invalidateAfterUpdate();
}
}
public float getScaleY() {
@ -70,22 +71,135 @@ public final class AnimatorProxy extends Animation {
}
public void setScaleY(float scaleY) {
if (mScaleY != scaleY) {
prepareForUpdate();
mScaleY = scaleY;
invalidateParent();
invalidateAfterUpdate();
}
}
public int getScrollX() {
View view = mView.get();
if (view == null) {
return 0;
}
return view.getScrollX();
}
public void setScrollX(int value) {
View view = mView.get();
if (view != null) {
view.scrollTo(value, view.getScrollY());
}
}
public int getScrollY() {
View view = mView.get();
if (view == null) {
return 0;
}
return view.getScrollY();
}
public void setScrollY(int value) {
View view = mView.get();
if (view != null) {
view.scrollTo(view.getScrollY(), value);
}
}
private void invalidateParent() {
//TODO only invalidate what we need to change
((View)mView.getParent()).invalidate();
public float getTranslationX() {
return mTranslationX;
}
public void setTranslationX(float translationX) {
if (mTranslationX != translationX) {
prepareForUpdate();
mTranslationX = translationX;
invalidateAfterUpdate();
}
}
public float getTranslationY() {
return mTranslationY;
}
public void setTranslationY(float translationY) {
if (mTranslationY != translationY) {
prepareForUpdate();
mTranslationY = translationY;
invalidateAfterUpdate();
}
}
private void prepareForUpdate() {
View view = mView.get();
if (view != null) {
computeRect(mBefore, view);
}
}
private void invalidateAfterUpdate() {
View view = mView.get();
if (view == null) {
return;
}
View parent = (View)view.getParent();
if (parent == null) {
return;
}
final RectF after = mAfter;
computeRect(after, view);
after.union(mBefore);
parent.invalidate(
(int) FloatMath.floor(after.left),
(int) FloatMath.floor(after.top),
(int) FloatMath.ceil(after.right),
(int) FloatMath.ceil(after.bottom));
}
private void computeRect(final RectF r, View view) {
// compute current rectangle according to matrix transformation
final float w = view.getWidth();
final float h = view.getHeight();
// use a rectangle at 0,0 to make sure we don't run into issues with scaling
r.set(0, 0, w, h);
final Matrix m = mTempMatrix;
m.reset();
transformMatrix(m, view);
mTempMatrix.mapRect(r);
r.offset(view.getLeft(), view.getTop());
// Straighten coords if rotations flipped them
if (r.right < r.left) {
final float f = r.right;
r.right = r.left;
r.left = f;
}
if (r.bottom < r.top) {
final float f = r.top;
r.top = r.bottom;
r.bottom = f;
}
}
private void transformMatrix(Matrix m, View view) {
final float w = view.getWidth();
final float h = view.getHeight();
final float sX = mScaleX;
final float sY = mScaleY;
if ((sX != 1.0f) || (sY != 1.0f)) {
final float deltaSX = ((sX * w) - w) / 2f;
final float deltaSY = ((sY * h) - h) / 2f;
m.postScale(sX, sY);
m.postTranslate(-deltaSX, -deltaSY);
}
m.postTranslate(mTranslationX, mTranslationY);
}
@Override
protected void applyTransformation(float interpolatedTime, Transformation t) {
t.setAlpha(mAlpha);
final Matrix m = t.getMatrix();
m.postTranslate(mTranslationX, mTranslationY);
m.postScale(mScaleX, mScaleY);
View view = mView.get();
if (view != null) {
t.setAlpha(mAlpha);
transformMatrix(t.getMatrix(), view);
}
}
}

View File

@ -22,6 +22,18 @@ public class NineFrameLayout extends FrameLayout {
mProxy = AnimatorProxy.NEEDS_PROXY ? AnimatorProxy.wrap(this) : null;
}
@Override
public void setVisibility(int visibility) {
if (mProxy != null) {
if (visibility == GONE) {
clearAnimation();
} else if (visibility == VISIBLE) {
setAnimation(mProxy);
}
}
super.setVisibility(visibility);
}
public float getAlpha() {
if (AnimatorProxy.NEEDS_PROXY) {
return mProxy.getAlpha();

View File

@ -0,0 +1,41 @@
package com.actionbarsherlock.internal.nineoldandroids.widget;
import android.content.Context;
import android.widget.HorizontalScrollView;
import com.actionbarsherlock.internal.nineoldandroids.view.animation.AnimatorProxy;
public class NineHorizontalScrollView extends HorizontalScrollView {
private final AnimatorProxy mProxy;
public NineHorizontalScrollView(Context context) {
super(context);
mProxy = AnimatorProxy.NEEDS_PROXY ? AnimatorProxy.wrap(this) : null;
}
@Override
public void setVisibility(int visibility) {
if (mProxy != null) {
if (visibility == GONE) {
clearAnimation();
} else if (visibility == VISIBLE) {
setAnimation(mProxy);
}
}
super.setVisibility(visibility);
}
public float getAlpha() {
if (AnimatorProxy.NEEDS_PROXY) {
return mProxy.getAlpha();
} else {
return super.getAlpha();
}
}
public void setAlpha(float alpha) {
if (AnimatorProxy.NEEDS_PROXY) {
mProxy.setAlpha(alpha);
} else {
super.setAlpha(alpha);
}
}
}

View File

@ -0,0 +1,65 @@
package com.actionbarsherlock.internal.nineoldandroids.widget;
import android.content.Context;
import android.util.AttributeSet;
import android.widget.LinearLayout;
import com.actionbarsherlock.internal.nineoldandroids.view.animation.AnimatorProxy;
public class NineLinearLayout extends LinearLayout {
private final AnimatorProxy mProxy;
public NineLinearLayout(Context context) {
super(context);
mProxy = AnimatorProxy.NEEDS_PROXY ? AnimatorProxy.wrap(this) : null;
}
public NineLinearLayout(Context context, AttributeSet attrs) {
super(context, attrs);
mProxy = AnimatorProxy.NEEDS_PROXY ? AnimatorProxy.wrap(this) : null;
}
public NineLinearLayout(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
mProxy = AnimatorProxy.NEEDS_PROXY ? AnimatorProxy.wrap(this) : null;
}
@Override
public void setVisibility(int visibility) {
if (mProxy != null) {
if (visibility == GONE) {
clearAnimation();
} else if (visibility == VISIBLE) {
setAnimation(mProxy);
}
}
super.setVisibility(visibility);
}
public float getAlpha() {
if (AnimatorProxy.NEEDS_PROXY) {
return mProxy.getAlpha();
} else {
return super.getAlpha();
}
}
public void setAlpha(float alpha) {
if (AnimatorProxy.NEEDS_PROXY) {
mProxy.setAlpha(alpha);
} else {
super.setAlpha(alpha);
}
}
public float getTranslationX() {
if (AnimatorProxy.NEEDS_PROXY) {
return mProxy.getTranslationX();
} else {
return super.getTranslationX();
}
}
public void setTranslationX(float translationX) {
if (AnimatorProxy.NEEDS_PROXY) {
mProxy.setTranslationX(translationX);
} else {
super.setTranslationX(translationX);
}
}
}

View File

@ -0,0 +1,40 @@
package com.actionbarsherlock.internal.view;
import com.actionbarsherlock.internal.view.menu.SubMenuWrapper;
import com.actionbarsherlock.view.ActionProvider;
import android.view.View;
public class ActionProviderWrapper extends android.view.ActionProvider {
private final ActionProvider mProvider;
public ActionProviderWrapper(ActionProvider provider) {
super(null/*TODO*/); //XXX this *should* be unused
mProvider = provider;
}
public ActionProvider unwrap() {
return mProvider;
}
@Override
public View onCreateActionView() {
return mProvider.onCreateActionView();
}
@Override
public boolean hasSubMenu() {
return mProvider.hasSubMenu();
}
@Override
public boolean onPerformDefaultAction() {
return mProvider.onPerformDefaultAction();
}
@Override
public void onPrepareSubMenu(android.view.SubMenu subMenu) {
mProvider.onPrepareSubMenu(new SubMenuWrapper(subMenu));
}
}

View File

@ -19,7 +19,7 @@ package com.actionbarsherlock.internal.view.menu;
import java.util.HashSet;
import java.util.Set;
import android.content.Context;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.os.Build;
@ -29,7 +29,6 @@ import android.view.Gravity;
import android.view.MotionEvent;
import android.view.View;
import android.view.accessibility.AccessibilityEvent;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.LinearLayout;
import android.widget.Toast;
@ -37,6 +36,9 @@ import android.widget.Toast;
import com.actionbarsherlock.R;
import com.actionbarsherlock.internal.view.View_HasStateListenerSupport;
import com.actionbarsherlock.internal.view.View_OnAttachStateChangeListener;
import com.actionbarsherlock.internal.widget.CapitalizingButton;
import static com.actionbarsherlock.internal.ResourcesCompat.getResources_getBoolean;
/**
* @hide
@ -51,10 +53,10 @@ public class ActionMenuItemView extends LinearLayout
private MenuBuilder.ItemInvoker mItemInvoker;
private ImageButton mImageButton;
private Button mTextButton;
private CapitalizingButton mTextButton;
private boolean mAllowTextWithIcon;
//UNUSED private boolean mShowTextAllCaps;
private boolean mExpandedFormat;
private int mMinWidth;
private final Set<View_OnAttachStateChangeListener> mListeners = new HashSet<View_OnAttachStateChangeListener>();
@ -69,10 +71,13 @@ public class ActionMenuItemView extends LinearLayout
public ActionMenuItemView(Context context, AttributeSet attrs, int defStyle) {
//TODO super(context, attrs, defStyle);
super(context, attrs);
final Resources res = context.getResources();
mAllowTextWithIcon = res.getBoolean(
mAllowTextWithIcon = getResources_getBoolean(context,
R.bool.abs__config_allowActionMenuItemTextWithIcon);
//UNUSED mShowTextAllCaps = res.getBoolean(R.bool.abs__config_actionMenuItemAllCaps);
TypedArray a = context.obtainStyledAttributes(attrs,
R.styleable.SherlockActionMenuItemView, 0, 0);
mMinWidth = a.getDimensionPixelSize(
R.styleable.SherlockActionMenuItemView_android_minWidth, 0);
a.recycle();
}
@Override
@ -105,7 +110,7 @@ public class ActionMenuItemView extends LinearLayout
public void onFinishInflate() {
mImageButton = (ImageButton) findViewById(R.id.abs__imageButton);
mTextButton = (Button) findViewById(R.id.abs__textButton);
mTextButton = (CapitalizingButton) findViewById(R.id.abs__textButton);
mImageButton.setOnClickListener(this);
mTextButton.setOnClickListener(this);
mImageButton.setOnLongClickListener(this);
@ -196,7 +201,7 @@ public class ActionMenuItemView extends LinearLayout
public void setTitle(CharSequence title) {
mTitle = title;
mTextButton.setText(mTitle);
mTextButton.setTextCompat(mTitle);
setContentDescription(mTitle);
updateTextButtonVisibility();
@ -270,4 +275,21 @@ public class ActionMenuItemView extends LinearLayout
cheatSheet.show();
return true;
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
final int widthMode = MeasureSpec.getMode(widthMeasureSpec);
final int specSize = MeasureSpec.getSize(widthMeasureSpec);
final int oldMeasuredWidth = getMeasuredWidth();
final int targetWidth = widthMode == MeasureSpec.AT_MOST ? Math.min(specSize, mMinWidth)
: mMinWidth;
if (widthMode != MeasureSpec.EXACTLY && mMinWidth > 0 && oldMeasuredWidth < targetWidth) {
// Remeasure at exactly the minimum width.
super.onMeasure(MeasureSpec.makeMeasureSpec(targetWidth, MeasureSpec.EXACTLY),
heightMeasureSpec);
}
}
}

View File

@ -16,10 +16,10 @@
package com.actionbarsherlock.internal.view.menu;
import static com.actionbarsherlock.internal.ResourcesCompat.getResources_getInteger;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Set;
import android.content.Context;
import android.content.res.Configuration;
import android.content.res.Resources;
@ -34,7 +34,6 @@ import android.view.View.MeasureSpec;
import android.view.ViewConfiguration;
import android.view.ViewGroup;
import android.widget.ImageButton;
import com.actionbarsherlock.R;
import com.actionbarsherlock.internal.view.View_HasStateListenerSupport;
import com.actionbarsherlock.internal.view.View_OnAttachStateChangeListener;
@ -88,7 +87,6 @@ public class ActionMenuPresenter extends BaseMenuPresenter
if (!mReserveOverflowSet) {
mReserveOverflow = reserveOverflow(mContext);
mReserveOverflowSet = true;
}
if (!mWidthLimitSet) {
@ -97,7 +95,7 @@ public class ActionMenuPresenter extends BaseMenuPresenter
// Measure for initial configuration
if (!mMaxItemsSet) {
mMaxItems = res.getInteger(R.integer.abs__max_action_buttons);
mMaxItems = getResources_getInteger(context, R.integer.abs__max_action_buttons);
}
int width = mWidthLimit;
@ -132,13 +130,19 @@ public class ActionMenuPresenter extends BaseMenuPresenter
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
return (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB);
} else {
return !ViewConfiguration.get(context).hasPermanentMenuKey();
return !HasPermanentMenuKey.get(context);
}
}
private static class HasPermanentMenuKey {
public static boolean get(Context context) {
return ViewConfiguration.get(context).hasPermanentMenuKey();
}
}
public void onConfigurationChanged(Configuration newConfig) {
if (!mMaxItemsSet) {
mMaxItems = mContext.getResources().getInteger(
mMaxItems = getResources_getInteger(mContext,
R.integer.abs__max_action_buttons);
if (mMenu != null) {
mMenu.onItemsChanged(true);
@ -324,6 +328,7 @@ public class ActionMenuPresenter extends BaseMenuPresenter
public boolean hideOverflowMenu() {
if (mPostedOpenRunnable != null && mMenuView != null) {
((View) mMenuView).removeCallbacks(mPostedOpenRunnable);
mPostedOpenRunnable = null;
return true;
}
@ -680,6 +685,7 @@ public class ActionMenuPresenter extends BaseMenuPresenter
}
private class PopupPresenterCallback implements MenuPresenter.Callback {
@Override
public boolean onOpenSubMenu(MenuBuilder subMenu) {
if (subMenu == null) return false;
@ -705,10 +711,11 @@ public class ActionMenuPresenter extends BaseMenuPresenter
public void run() {
mMenu.changeMenuMode();
if (mPopup.tryShow()) {
final View menuView = (View) mMenuView;
if (menuView != null && menuView.getWindowToken() != null && mPopup.tryShow()) {
mOverflowPopup = mPopup;
mPostedOpenRunnable = null;
}
mPostedOpenRunnable = null;
}
}
}

View File

@ -15,22 +15,24 @@
*/
package com.actionbarsherlock.internal.view.menu;
import com.actionbarsherlock.internal.widget.IcsLinearLayout;
import android.content.Context;
import android.content.res.Configuration;
import android.graphics.Canvas;
import android.os.Build;
import android.util.AttributeSet;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.view.accessibility.AccessibilityEvent;
import android.widget.LinearLayout;
import com.actionbarsherlock.internal.widget.IcsLinearLayout;
/**
* @hide
*/
public class ActionMenuView extends IcsLinearLayout implements MenuBuilder.ItemInvoker, MenuView {
//UNUSED private static final String TAG = "ActionMenuView";
private static final boolean IS_FROYO = Build.VERSION.SDK_INT >= Build.VERSION_CODES.FROYO;
static final int MIN_CELL_SIZE = 56; // dips
static final int GENERATED_ITEM_PADDING = 4; // dips
@ -45,6 +47,8 @@ public class ActionMenuView extends IcsLinearLayout implements MenuBuilder.ItemI
private int mGeneratedItemPadding;
//UNUSED private int mMeasuredExtraWidth;
private boolean mFirst = true;
public ActionMenuView(Context context) {
this(context, null);
}
@ -67,9 +71,8 @@ public class ActionMenuView extends IcsLinearLayout implements MenuBuilder.ItemI
@Override
public void onConfigurationChanged(Configuration newConfig) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.FROYO) {
if (IS_FROYO) {
super.onConfigurationChanged(newConfig);
//TODO figure out a way to call this pre-2.2
}
mPresenter.updateMenuView(false);
@ -79,6 +82,19 @@ public class ActionMenuView extends IcsLinearLayout implements MenuBuilder.ItemI
}
}
@Override
protected void onDraw(Canvas canvas) {
//Need to trigger a relayout since we may have been added extremely
//late in the initial rendering (e.g., when contained in a ViewPager).
//See: https://github.com/JakeWharton/ActionBarSherlock/issues/272
if (!IS_FROYO && mFirst) {
mFirst = false;
requestLayout();
return;
}
super.onDraw(canvas);
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
// If we've been given an exact size to match, apply special formatting during layout.
@ -369,7 +385,7 @@ public class ActionMenuView extends IcsLinearLayout implements MenuBuilder.ItemI
final int childCount = getChildCount();
final int midVertical = (top + bottom) / 2;
final int dividerWidth = getDividerWidth();
final int dividerWidth = 0;//getDividerWidth();
int overflowWidth = 0;
//UNUSED int nonOverflowWidth = 0;
int nonOverflowCount = 0;
@ -401,9 +417,9 @@ public class ActionMenuView extends IcsLinearLayout implements MenuBuilder.ItemI
final int size = v.getMeasuredWidth() + p.leftMargin + p.rightMargin;
//UNUSED nonOverflowWidth += size;
widthRemaining -= size;
if (hasDividerBeforeChildAt(i)) {
//if (hasDividerBeforeChildAt(i)) {
//UNUSED nonOverflowWidth += dividerWidth;
}
//}
nonOverflowCount++;
}
}
@ -502,7 +518,7 @@ public class ActionMenuView extends IcsLinearLayout implements MenuBuilder.ItemI
mMenu = menu;
}
@Override
//@Override
protected boolean hasDividerBeforeChildAt(int childIndex) {
final View childBefore = getChildAt(childIndex - 1);
final View child = getChildAt(childIndex);
@ -525,7 +541,7 @@ public class ActionMenuView extends IcsLinearLayout implements MenuBuilder.ItemI
public boolean needsDividerAfter();
}
public static class LayoutParams extends IcsLinearLayout.LayoutParams {
public static class LayoutParams extends LinearLayout.LayoutParams {
public boolean isOverflowButton;
public int cellsUsed;
public int extraPixels;
@ -539,7 +555,7 @@ public class ActionMenuView extends IcsLinearLayout implements MenuBuilder.ItemI
}
public LayoutParams(LayoutParams other) {
super((IcsLinearLayout.LayoutParams) other);
super((LinearLayout.LayoutParams) other);
isOverflowButton = other.isOverflowButton;
}

View File

@ -16,19 +16,21 @@
package com.actionbarsherlock.internal.view.menu;
import java.util.ArrayList;
import android.content.Context;
import android.os.Build;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import java.util.ArrayList;
/**
* Base class for MenuPresenters that have a consistent container view and item
* views. Behaves similarly to an AdapterView in that existing item views will
* be reused if possible when items change.
*/
public abstract class BaseMenuPresenter implements MenuPresenter {
private static final boolean IS_HONEYCOMB = Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB;
protected Context mSystemContext;
protected Context mContext;
protected MenuBuilder mMenu;
@ -91,7 +93,14 @@ public abstract class BaseMenuPresenter implements MenuPresenter {
MenuItemImpl item = visibleItems.get(i);
if (shouldIncludeItem(childIndex, item)) {
final View convertView = parent.getChildAt(childIndex);
final MenuItemImpl oldItem = convertView instanceof MenuView.ItemView ?
((MenuView.ItemView) convertView).getItemData() : null;
final View itemView = getItemView(item, convertView, parent);
if (item != oldItem) {
// Don't let old states linger with new data.
itemView.setPressed(false);
if (IS_HONEYCOMB) itemView.jumpDrawablesToCurrentState();
}
if (itemView != convertView) {
addItemView(itemView, childIndex);
}
@ -179,7 +188,7 @@ public abstract class BaseMenuPresenter implements MenuPresenter {
/**
* Filter item by child index and item data.
*
* @param childIndex Intended presentation index of this item
* @param childIndex Indended presentation index of this item
* @param item Item to present
* @return true if this item should be included in this menu presentation; false otherwise
*/

View File

@ -0,0 +1,234 @@
package com.actionbarsherlock.internal.view.menu;
import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.view.ActionProvider;
import android.view.MenuItem;
import android.view.SubMenu;
import android.view.View;
import android.view.ContextMenu.ContextMenuInfo;
/** Used to carry an instance of our version of MenuItem through a native channel. */
public class MenuItemMule implements MenuItem {
private static final String ERROR = "Cannot interact with object designed for temporary "
+ "instance passing. Make sure you using both SherlockFragmentActivity and "
+ "SherlockFragment.";
private final com.actionbarsherlock.view.MenuItem mItem;
public MenuItemMule(com.actionbarsherlock.view.MenuItem item) {
mItem = item;
}
public com.actionbarsherlock.view.MenuItem unwrap() {
return mItem;
}
@Override
public boolean collapseActionView() {
throw new IllegalStateException(ERROR);
}
@Override
public boolean expandActionView() {
throw new IllegalStateException(ERROR);
}
@Override
public ActionProvider getActionProvider() {
throw new IllegalStateException(ERROR);
}
@Override
public View getActionView() {
throw new IllegalStateException(ERROR);
}
@Override
public char getAlphabeticShortcut() {
throw new IllegalStateException(ERROR);
}
@Override
public int getGroupId() {
throw new IllegalStateException(ERROR);
}
@Override
public Drawable getIcon() {
throw new IllegalStateException(ERROR);
}
@Override
public Intent getIntent() {
throw new IllegalStateException(ERROR);
}
@Override
public int getItemId() {
throw new IllegalStateException(ERROR);
}
@Override
public ContextMenuInfo getMenuInfo() {
throw new IllegalStateException(ERROR);
}
@Override
public char getNumericShortcut() {
throw new IllegalStateException(ERROR);
}
@Override
public int getOrder() {
throw new IllegalStateException(ERROR);
}
@Override
public SubMenu getSubMenu() {
throw new IllegalStateException(ERROR);
}
@Override
public CharSequence getTitle() {
throw new IllegalStateException(ERROR);
}
@Override
public CharSequence getTitleCondensed() {
return mItem.getTitleCondensed();
//throw new IllegalStateException(ERROR);
}
@Override
public boolean hasSubMenu() {
throw new IllegalStateException(ERROR);
}
@Override
public boolean isActionViewExpanded() {
throw new IllegalStateException(ERROR);
}
@Override
public boolean isCheckable() {
throw new IllegalStateException(ERROR);
}
@Override
public boolean isChecked() {
throw new IllegalStateException(ERROR);
}
@Override
public boolean isEnabled() {
throw new IllegalStateException(ERROR);
}
@Override
public boolean isVisible() {
throw new IllegalStateException(ERROR);
}
@Override
public MenuItem setActionProvider(ActionProvider arg0) {
throw new IllegalStateException(ERROR);
}
@Override
public MenuItem setActionView(View arg0) {
throw new IllegalStateException(ERROR);
}
@Override
public MenuItem setActionView(int arg0) {
throw new IllegalStateException(ERROR);
}
@Override
public MenuItem setAlphabeticShortcut(char arg0) {
throw new IllegalStateException(ERROR);
}
@Override
public MenuItem setCheckable(boolean arg0) {
throw new IllegalStateException(ERROR);
}
@Override
public MenuItem setChecked(boolean arg0) {
throw new IllegalStateException(ERROR);
}
@Override
public MenuItem setEnabled(boolean arg0) {
throw new IllegalStateException(ERROR);
}
@Override
public MenuItem setIcon(Drawable arg0) {
throw new IllegalStateException(ERROR);
}
@Override
public MenuItem setIcon(int arg0) {
throw new IllegalStateException(ERROR);
}
@Override
public MenuItem setIntent(Intent arg0) {
throw new IllegalStateException(ERROR);
}
@Override
public MenuItem setNumericShortcut(char arg0) {
throw new IllegalStateException(ERROR);
}
@Override
public MenuItem setOnActionExpandListener(OnActionExpandListener arg0) {
throw new IllegalStateException(ERROR);
}
@Override
public MenuItem setOnMenuItemClickListener(OnMenuItemClickListener arg0) {
throw new IllegalStateException(ERROR);
}
@Override
public MenuItem setShortcut(char arg0, char arg1) {
throw new IllegalStateException(ERROR);
}
@Override
public void setShowAsAction(int arg0) {
throw new IllegalStateException(ERROR);
}
@Override
public MenuItem setShowAsActionFlags(int arg0) {
throw new IllegalStateException(ERROR);
}
@Override
public MenuItem setTitle(CharSequence arg0) {
throw new IllegalStateException(ERROR);
}
@Override
public MenuItem setTitle(int arg0) {
throw new IllegalStateException(ERROR);
}
@Override
public MenuItem setTitleCondensed(CharSequence arg0) {
throw new IllegalStateException(ERROR);
}
@Override
public MenuItem setVisible(boolean arg0) {
throw new IllegalStateException(ERROR);
}
}

View File

@ -0,0 +1,292 @@
package com.actionbarsherlock.internal.view.menu;
import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.view.View;
import android.view.ContextMenu.ContextMenuInfo;
import com.actionbarsherlock.internal.view.ActionProviderWrapper;
import com.actionbarsherlock.view.ActionProvider;
import com.actionbarsherlock.view.MenuItem;
import com.actionbarsherlock.view.SubMenu;
public class MenuItemWrapper implements MenuItem, android.view.MenuItem.OnMenuItemClickListener {
private final android.view.MenuItem mNativeItem;
private SubMenu mSubMenu = null;
private OnMenuItemClickListener mMenuItemClickListener = null;
private OnActionExpandListener mActionExpandListener = null;
private android.view.MenuItem.OnActionExpandListener mNativeActionExpandListener = null;
public MenuItemWrapper(android.view.MenuItem nativeItem) {
if (nativeItem == null) {
throw new IllegalStateException("Wrapped menu item cannot be null.");
}
mNativeItem = nativeItem;
}
@Override
public int getItemId() {
return mNativeItem.getItemId();
}
@Override
public int getGroupId() {
return mNativeItem.getGroupId();
}
@Override
public int getOrder() {
return mNativeItem.getOrder();
}
@Override
public MenuItem setTitle(CharSequence title) {
mNativeItem.setTitle(title);
return this;
}
@Override
public MenuItem setTitle(int title) {
mNativeItem.setTitle(title);
return this;
}
@Override
public CharSequence getTitle() {
return mNativeItem.getTitle();
}
@Override
public MenuItem setTitleCondensed(CharSequence title) {
mNativeItem.setTitleCondensed(title);
return this;
}
@Override
public CharSequence getTitleCondensed() {
return mNativeItem.getTitleCondensed();
}
@Override
public MenuItem setIcon(Drawable icon) {
mNativeItem.setIcon(icon);
return this;
}
@Override
public MenuItem setIcon(int iconRes) {
mNativeItem.setIcon(iconRes);
return this;
}
@Override
public Drawable getIcon() {
return mNativeItem.getIcon();
}
@Override
public MenuItem setIntent(Intent intent) {
mNativeItem.setIntent(intent);
return this;
}
@Override
public Intent getIntent() {
return mNativeItem.getIntent();
}
@Override
public MenuItem setShortcut(char numericChar, char alphaChar) {
mNativeItem.setShortcut(numericChar, alphaChar);
return this;
}
@Override
public MenuItem setNumericShortcut(char numericChar) {
mNativeItem.setNumericShortcut(numericChar);
return this;
}
@Override
public char getNumericShortcut() {
return mNativeItem.getNumericShortcut();
}
@Override
public MenuItem setAlphabeticShortcut(char alphaChar) {
mNativeItem.setAlphabeticShortcut(alphaChar);
return this;
}
@Override
public char getAlphabeticShortcut() {
return mNativeItem.getAlphabeticShortcut();
}
@Override
public MenuItem setCheckable(boolean checkable) {
mNativeItem.setCheckable(checkable);
return this;
}
@Override
public boolean isCheckable() {
return mNativeItem.isCheckable();
}
@Override
public MenuItem setChecked(boolean checked) {
mNativeItem.setChecked(checked);
return this;
}
@Override
public boolean isChecked() {
return mNativeItem.isChecked();
}
@Override
public MenuItem setVisible(boolean visible) {
mNativeItem.setVisible(visible);
return this;
}
@Override
public boolean isVisible() {
return mNativeItem.isVisible();
}
@Override
public MenuItem setEnabled(boolean enabled) {
mNativeItem.setEnabled(enabled);
return this;
}
@Override
public boolean isEnabled() {
return mNativeItem.isEnabled();
}
@Override
public boolean hasSubMenu() {
return mNativeItem.hasSubMenu();
}
@Override
public SubMenu getSubMenu() {
if (hasSubMenu() && (mSubMenu == null)) {
mSubMenu = new SubMenuWrapper(mNativeItem.getSubMenu());
}
return mSubMenu;
}
@Override
public MenuItem setOnMenuItemClickListener(OnMenuItemClickListener menuItemClickListener) {
mMenuItemClickListener = menuItemClickListener;
//Register ourselves as the listener to proxy
mNativeItem.setOnMenuItemClickListener(this);
return this;
}
@Override
public boolean onMenuItemClick(android.view.MenuItem item) {
if (mMenuItemClickListener != null) {
return mMenuItemClickListener.onMenuItemClick(this);
}
return false;
}
@Override
public ContextMenuInfo getMenuInfo() {
return mNativeItem.getMenuInfo();
}
@Override
public void setShowAsAction(int actionEnum) {
mNativeItem.setShowAsAction(actionEnum);
}
@Override
public MenuItem setShowAsActionFlags(int actionEnum) {
mNativeItem.setShowAsActionFlags(actionEnum);
return this;
}
@Override
public MenuItem setActionView(View view) {
mNativeItem.setActionView(view);
return this;
}
@Override
public MenuItem setActionView(int resId) {
mNativeItem.setActionView(resId);
return this;
}
@Override
public View getActionView() {
return mNativeItem.getActionView();
}
@Override
public MenuItem setActionProvider(ActionProvider actionProvider) {
mNativeItem.setActionProvider(new ActionProviderWrapper(actionProvider));
return this;
}
@Override
public ActionProvider getActionProvider() {
android.view.ActionProvider nativeProvider = mNativeItem.getActionProvider();
if (nativeProvider != null && nativeProvider instanceof ActionProviderWrapper) {
return ((ActionProviderWrapper)nativeProvider).unwrap();
}
return null;
}
@Override
public boolean expandActionView() {
return mNativeItem.expandActionView();
}
@Override
public boolean collapseActionView() {
return mNativeItem.collapseActionView();
}
@Override
public boolean isActionViewExpanded() {
return mNativeItem.isActionViewExpanded();
}
@Override
public MenuItem setOnActionExpandListener(OnActionExpandListener listener) {
mActionExpandListener = listener;
if (mNativeActionExpandListener == null) {
mNativeActionExpandListener = new android.view.MenuItem.OnActionExpandListener() {
@Override
public boolean onMenuItemActionExpand(android.view.MenuItem menuItem) {
if (mActionExpandListener != null) {
return mActionExpandListener.onMenuItemActionExpand(MenuItemWrapper.this);
}
return false;
}
@Override
public boolean onMenuItemActionCollapse(android.view.MenuItem menuItem) {
if (mActionExpandListener != null) {
return mActionExpandListener.onMenuItemActionCollapse(MenuItemWrapper.this);
}
return false;
}
};
//Register our inner-class as the listener to proxy method calls
mNativeItem.setOnActionExpandListener(mNativeActionExpandListener);
}
return this;
}
}

View File

@ -0,0 +1,150 @@
package com.actionbarsherlock.internal.view.menu;
import android.content.ComponentName;
import android.content.Intent;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuItem;
import android.view.SubMenu;
/** Used to carry an instance of our version of Menu through a native channel. */
public class MenuMule implements Menu {
private static final String ERROR = "Cannot interact with object designed for temporary "
+ "instance passing. Make sure you using both SherlockFragmentActivity and "
+ "SherlockFragment.";
private final com.actionbarsherlock.view.Menu mMenu;
public MenuMule(com.actionbarsherlock.view.Menu menu) {
mMenu = menu;
}
public com.actionbarsherlock.view.Menu unwrap() {
return mMenu;
}
@Override
public MenuItem add(CharSequence arg0) {
throw new IllegalStateException(ERROR);
}
@Override
public MenuItem add(int arg0) {
throw new IllegalStateException(ERROR);
}
@Override
public MenuItem add(int arg0, int arg1, int arg2, CharSequence arg3) {
throw new IllegalStateException(ERROR);
}
@Override
public MenuItem add(int arg0, int arg1, int arg2, int arg3) {
throw new IllegalStateException(ERROR);
}
@Override
public int addIntentOptions(int arg0, int arg1, int arg2,
ComponentName arg3, Intent[] arg4, Intent arg5, int arg6,
MenuItem[] arg7) {
throw new IllegalStateException(ERROR);
}
@Override
public SubMenu addSubMenu(CharSequence arg0) {
throw new IllegalStateException(ERROR);
}
@Override
public SubMenu addSubMenu(int arg0) {
throw new IllegalStateException(ERROR);
}
@Override
public SubMenu addSubMenu(int arg0, int arg1, int arg2, CharSequence arg3) {
throw new IllegalStateException(ERROR);
}
@Override
public SubMenu addSubMenu(int arg0, int arg1, int arg2, int arg3) {
throw new IllegalStateException(ERROR);
}
@Override
public void clear() {
throw new IllegalStateException(ERROR);
}
@Override
public void close() {
throw new IllegalStateException(ERROR);
}
@Override
public MenuItem findItem(int arg0) {
throw new IllegalStateException(ERROR);
}
@Override
public MenuItem getItem(int arg0) {
throw new IllegalStateException(ERROR);
}
@Override
public boolean hasVisibleItems() {
return mMenu.hasVisibleItems();
//throw new IllegalStateException(ERROR);
}
@Override
public boolean isShortcutKey(int arg0, KeyEvent arg1) {
throw new IllegalStateException(ERROR);
}
@Override
public boolean performIdentifierAction(int arg0, int arg1) {
throw new IllegalStateException(ERROR);
}
@Override
public boolean performShortcut(int arg0, KeyEvent arg1, int arg2) {
throw new IllegalStateException(ERROR);
}
@Override
public void removeGroup(int arg0) {
throw new IllegalStateException(ERROR);
}
@Override
public void removeItem(int arg0) {
throw new IllegalStateException(ERROR);
}
@Override
public void setGroupCheckable(int arg0, boolean arg1, boolean arg2) {
throw new IllegalStateException(ERROR);
}
@Override
public void setGroupEnabled(int arg0, boolean arg1) {
throw new IllegalStateException(ERROR);
}
@Override
public void setGroupVisible(int arg0, boolean arg1) {
throw new IllegalStateException(ERROR);
}
@Override
public void setQwertyMode(boolean arg0) {
throw new IllegalStateException(ERROR);
}
@Override
public int size() {
throw new IllegalStateException(ERROR);
}
}

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