Update actionbarsherlock from 4.2 to 4.4
@ -1,6 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="100" android:versionName="4.2.0" package="com.actionbarsherlock">
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="440" android:versionName="4.4.0" package="com.actionbarsherlock">
|
||||||
|
<uses-sdk android:minSdkVersion="7" android:targetSdkVersion="17"/>
|
||||||
<uses-sdk android:minSdkVersion="7" android:targetSdkVersion="16"/>
|
<application/>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
||||||
|
@ -1,21 +1,12 @@
|
|||||||
buildscript {
|
|
||||||
repositories {
|
|
||||||
mavenCentral()
|
|
||||||
}
|
|
||||||
dependencies {
|
|
||||||
classpath 'com.android.tools.build:gradle:0.4.1'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
apply plugin: 'android-library'
|
apply plugin: 'android-library'
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile files('libs/android-support-v4.jar')
|
compile 'com.android.support:support-v4:18.0.+'
|
||||||
}
|
}
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 17
|
compileSdkVersion 14
|
||||||
buildToolsVersion '17'
|
buildToolsVersion '17.0.0'
|
||||||
|
|
||||||
sourceSets {
|
sourceSets {
|
||||||
main {
|
main {
|
||||||
|
@ -1,92 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project name="MainActivity" default="help">
|
|
||||||
|
|
||||||
<!-- The local.properties file is created and updated by the 'android' tool.
|
|
||||||
It contains the path to the SDK. It should *NOT* be checked into
|
|
||||||
Version Control Systems. -->
|
|
||||||
<property file="local.properties" />
|
|
||||||
|
|
||||||
<!-- The ant.properties file can be created by you. It is only edited by the
|
|
||||||
'android' tool to add properties to it.
|
|
||||||
This is the place to change some Ant specific build properties.
|
|
||||||
Here are some properties you may want to change/update:
|
|
||||||
|
|
||||||
source.dir
|
|
||||||
The name of the source directory. Default is 'src'.
|
|
||||||
out.dir
|
|
||||||
The name of the output directory. Default is 'bin'.
|
|
||||||
|
|
||||||
For other overridable properties, look at the beginning of the rules
|
|
||||||
files in the SDK, at tools/ant/build.xml
|
|
||||||
|
|
||||||
Properties related to the SDK location or the project target should
|
|
||||||
be updated using the 'android' tool with the 'update' action.
|
|
||||||
|
|
||||||
This file is an integral part of the build system for your
|
|
||||||
application and should be checked into Version Control Systems.
|
|
||||||
|
|
||||||
-->
|
|
||||||
<property file="ant.properties" />
|
|
||||||
|
|
||||||
<!-- if sdk.dir was not set from one of the property file, then
|
|
||||||
get it from the ANDROID_HOME env var.
|
|
||||||
This must be done before we load project.properties since
|
|
||||||
the proguard config can use sdk.dir -->
|
|
||||||
<property environment="env" />
|
|
||||||
<condition property="sdk.dir" value="${env.ANDROID_HOME}">
|
|
||||||
<isset property="env.ANDROID_HOME" />
|
|
||||||
</condition>
|
|
||||||
|
|
||||||
<!-- The project.properties file is created and updated by the 'android'
|
|
||||||
tool, as well as ADT.
|
|
||||||
|
|
||||||
This contains project specific properties such as project target, and library
|
|
||||||
dependencies. Lower level build properties are stored in ant.properties
|
|
||||||
(or in .classpath for Eclipse projects).
|
|
||||||
|
|
||||||
This file is an integral part of the build system for your
|
|
||||||
application and should be checked into Version Control Systems. -->
|
|
||||||
<loadproperties srcFile="project.properties" />
|
|
||||||
|
|
||||||
<!-- quick check on sdk.dir -->
|
|
||||||
<fail
|
|
||||||
message="sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through the ANDROID_HOME environment variable."
|
|
||||||
unless="sdk.dir"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<!--
|
|
||||||
Import per project custom build rules if present at the root of the project.
|
|
||||||
This is the place to put custom intermediary targets such as:
|
|
||||||
-pre-build
|
|
||||||
-pre-compile
|
|
||||||
-post-compile (This is typically used for code obfuscation.
|
|
||||||
Compiled code location: ${out.classes.absolute.dir}
|
|
||||||
If this is not done in place, override ${out.dex.input.absolute.dir})
|
|
||||||
-post-package
|
|
||||||
-post-build
|
|
||||||
-pre-clean
|
|
||||||
-->
|
|
||||||
<import file="custom_rules.xml" optional="true" />
|
|
||||||
|
|
||||||
<!-- Import the actual build file.
|
|
||||||
|
|
||||||
To customize existing targets, there are two options:
|
|
||||||
- Customize only one target:
|
|
||||||
- copy/paste the target into this file, *before* the
|
|
||||||
<import> task.
|
|
||||||
- customize it to your needs.
|
|
||||||
- Customize the whole content of build.xml
|
|
||||||
- copy/paste the content of the rules files (minus the top node)
|
|
||||||
into this file, replacing the <import> task.
|
|
||||||
- customize to your needs.
|
|
||||||
|
|
||||||
***********************
|
|
||||||
****** IMPORTANT ******
|
|
||||||
***********************
|
|
||||||
In all cases you must update the value of version-tag below to read 'custom' instead of an integer,
|
|
||||||
in order to avoid having your file be overridden by tools such as "android update project"
|
|
||||||
-->
|
|
||||||
<!-- version-tag: 1 -->
|
|
||||||
<import file="${sdk.dir}/tools/ant/build.xml" />
|
|
||||||
|
|
||||||
</project>
|
|
@ -3,17 +3,17 @@
|
|||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
<artifactId>actionbarsherlock</artifactId>
|
|
||||||
<name>ActionBarSherlock</name>
|
|
||||||
<packaging>apklib</packaging>
|
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.actionbarsherlock</groupId>
|
<groupId>com.actionbarsherlock</groupId>
|
||||||
<artifactId>parent</artifactId>
|
<artifactId>parent</artifactId>
|
||||||
<version>4.2.0</version>
|
<version>4.4.0</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
<artifactId>actionbarsherlock</artifactId>
|
||||||
|
<name>ActionBarSherlock</name>
|
||||||
|
<packaging>apklib</packaging>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.google.android</groupId>
|
<groupId>com.google.android</groupId>
|
||||||
@ -30,6 +30,16 @@
|
|||||||
<artifactId>junit</artifactId>
|
<artifactId>junit</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.easytesting</groupId>
|
||||||
|
<artifactId>fest-assert-core</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.robolectric</groupId>
|
||||||
|
<artifactId>robolectric</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
@ -41,9 +51,6 @@
|
|||||||
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
|
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
|
||||||
<artifactId>android-maven-plugin</artifactId>
|
<artifactId>android-maven-plugin</artifactId>
|
||||||
<extensions>true</extensions>
|
<extensions>true</extensions>
|
||||||
<configuration>
|
|
||||||
<nativeLibrariesDirectory>ignored</nativeLibrariesDirectory>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
<plugin>
|
<plugin>
|
||||||
@ -57,7 +64,6 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>com.google.code.maven-replacer-plugin</groupId>
|
<groupId>com.google.code.maven-replacer-plugin</groupId>
|
||||||
<artifactId>maven-replacer-plugin</artifactId>
|
<artifactId>maven-replacer-plugin</artifactId>
|
||||||
<version>1.4.0</version>
|
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<phase>process-sources</phase>
|
<phase>process-sources</phase>
|
||||||
@ -76,26 +82,9 @@
|
|||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-checkstyle-plugin</artifactId>
|
|
||||||
<configuration>
|
|
||||||
<configLocation>../checkstyle.xml</configLocation>
|
|
||||||
</configuration>
|
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<phase>verify</phase>
|
|
||||||
<goals>
|
|
||||||
<goal>checkstyle</goal>
|
|
||||||
</goals>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
</plugin>
|
|
||||||
|
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.codehaus.mojo</groupId>
|
<groupId>org.codehaus.mojo</groupId>
|
||||||
<artifactId>build-helper-maven-plugin</artifactId>
|
<artifactId>build-helper-maven-plugin</artifactId>
|
||||||
<version>1.7</version>
|
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<phase>package</phase>
|
<phase>package</phase>
|
||||||
@ -108,6 +97,10 @@
|
|||||||
<type>jar</type>
|
<type>jar</type>
|
||||||
<file>${project.build.directory}/${project.build.finalName}.jar</file>
|
<file>${project.build.directory}/${project.build.finalName}.jar</file>
|
||||||
</artifact>
|
</artifact>
|
||||||
|
<artifact>
|
||||||
|
<type>aar</type>
|
||||||
|
<file>${project.basedir}/build/libs/${project.artifactId}-${gradle.version}.aar</file>
|
||||||
|
</artifact>
|
||||||
</artifacts>
|
</artifacts>
|
||||||
</configuration>
|
</configuration>
|
||||||
</execution>
|
</execution>
|
||||||
|
@ -1,20 +0,0 @@
|
|||||||
# To enable ProGuard in your project, edit project.properties
|
|
||||||
# to define the proguard.config property as described in that file.
|
|
||||||
#
|
|
||||||
# Add project specific ProGuard rules here.
|
|
||||||
# By default, the flags in this file are appended to flags specified
|
|
||||||
# in ${sdk.dir}/tools/proguard/proguard-android.txt
|
|
||||||
# You can edit the include path and order by changing the ProGuard
|
|
||||||
# include property in project.properties.
|
|
||||||
#
|
|
||||||
# For more details, see
|
|
||||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
|
||||||
|
|
||||||
# Add any project specific keep options here:
|
|
||||||
|
|
||||||
# If your project uses WebView with JS, uncomment the following
|
|
||||||
# and specify the fully qualified class name to the JavaScript interface
|
|
||||||
# class:
|
|
||||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
|
||||||
# public *;
|
|
||||||
#}
|
|
Before Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 597 B |
After Width: | Height: | Size: 616 B |
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.5 KiB |
After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 882 B |
Before Width: | Height: | Size: 1003 B |
After Width: | Height: | Size: 511 B |
After Width: | Height: | Size: 532 B |
After Width: | Height: | Size: 839 B |
Before Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 703 B |
After Width: | Height: | Size: 712 B |
After Width: | Height: | Size: 1.9 KiB |
@ -21,6 +21,7 @@ This is an optimized layout for a screen with the Action Bar enabled.
|
|||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:fitsSystemWindows="true"
|
android:fitsSystemWindows="true"
|
||||||
|
android:splitMotionEvents="false"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="fill_parent">
|
android:layout_height="fill_parent">
|
||||||
<com.actionbarsherlock.internal.widget.ActionBarContainer
|
<com.actionbarsherlock.internal.widget.ActionBarContainer
|
||||||
|
@ -20,7 +20,8 @@ the Action Bar enabled overlaying application content.
|
|||||||
-->
|
-->
|
||||||
|
|
||||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:fitsSystemWindows="true">
|
android:fitsSystemWindows="true"
|
||||||
|
android:splitMotionEvents="false">
|
||||||
<com.actionbarsherlock.internal.nineoldandroids.widget.NineFrameLayout android:id="@+id/abs__content"
|
<com.actionbarsherlock.internal.nineoldandroids.widget.NineFrameLayout android:id="@+id/abs__content"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="fill_parent" />
|
android:layout_height="fill_parent" />
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
<com.actionbarsherlock.internal.widget.IcsLinearLayout
|
<com.actionbarsherlock.internal.widget.TabsLinearLayout
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
style="?attr/actionBarTabBarStyle"
|
style="?attr/actionBarTabBarStyle"
|
||||||
/>
|
/>
|
@ -1,46 +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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
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="match_parent" 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>
|
|
@ -1,59 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<!-- Copyright (C) 2007 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.view.menu.ListMenuItemView xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:layout_height="?attr/listPreferredItemHeightSmall">
|
|
||||||
|
|
||||||
<!-- Icon will be inserted here. -->
|
|
||||||
|
|
||||||
<!-- The title and summary have some gap between them, and this 'group' should be centered vertically. -->
|
|
||||||
<RelativeLayout
|
|
||||||
android:layout_width="0dip"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center_vertical"
|
|
||||||
android:layout_marginLeft="?attr/listPreferredItemPaddingLeft"
|
|
||||||
android:layout_marginRight="?attr/listPreferredItemPaddingRight"
|
|
||||||
android:duplicateParentState="true">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/abs__title"
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_alignParentTop="true"
|
|
||||||
android:layout_alignParentLeft="true"
|
|
||||||
android:textAppearance="?attr/textAppearanceListItemSmall"
|
|
||||||
android:singleLine="true"
|
|
||||||
android:duplicateParentState="true"
|
|
||||||
android:ellipsize="marquee"
|
|
||||||
android:fadingEdge="horizontal" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/abs__shortcut"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_below="@id/abs__title"
|
|
||||||
android:layout_alignParentLeft="true"
|
|
||||||
android:textAppearance="?attr/textAppearanceSmall"
|
|
||||||
android:singleLine="true"
|
|
||||||
android:duplicateParentState="true" />
|
|
||||||
|
|
||||||
</RelativeLayout>
|
|
||||||
|
|
||||||
<!-- Checkbox, and/or radio button will be inserted here. -->
|
|
||||||
|
|
||||||
</com.actionbarsherlock.internal.view.menu.ListMenuItemView>
|
|
@ -22,7 +22,8 @@ This is an optimized layout for a screen with the Action Bar enabled.
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:fitsSystemWindows="true">
|
android:fitsSystemWindows="true"
|
||||||
|
android:splitMotionEvents="false">
|
||||||
<com.actionbarsherlock.internal.widget.ActionBarContainer
|
<com.actionbarsherlock.internal.widget.ActionBarContainer
|
||||||
android:id="@+id/abs__action_bar_container"
|
android:id="@+id/abs__action_bar_container"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
|
@ -22,7 +22,8 @@ the Action Bar enabled overlaying application content.
|
|||||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:fitsSystemWindows="true">
|
android:fitsSystemWindows="true"
|
||||||
|
android:splitMotionEvents="false">
|
||||||
<com.actionbarsherlock.internal.nineoldandroids.widget.NineFrameLayout android:id="@+id/abs__content"
|
<com.actionbarsherlock.internal.nineoldandroids.widget.NineFrameLayout android:id="@+id/abs__content"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent" />
|
android:layout_height="match_parent" />
|
||||||
|
@ -40,7 +40,7 @@
|
|||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/abs__search_button"
|
android:id="@+id/abs__search_button"
|
||||||
style="?android:attr/actionButtonStyle"
|
style="?attr/actionButtonStyle"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_gravity="center_vertical"
|
android:layout_gravity="center_vertical"
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
-->
|
-->
|
||||||
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:id="@android:id/text1"
|
android:id="@android:id/text1"
|
||||||
android:textAppearance="?android:attr/dropDownHintAppearance"
|
android:textAppearance="?attr/dropDownHintAppearance"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
android:layout_marginLeft="3dip"
|
android:layout_marginLeft="3dip"
|
||||||
android:layout_marginTop="3dip"
|
android:layout_marginTop="3dip"
|
||||||
|
@ -32,5 +32,5 @@
|
|||||||
<dimen name="abs__action_bar_subtitle_bottom_margin">9dip</dimen>
|
<dimen name="abs__action_bar_subtitle_bottom_margin">9dip</dimen>
|
||||||
|
|
||||||
<!-- Minimum width for an action button in the menu area of an action bar -->
|
<!-- 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>
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -1,29 +0,0 @@
|
|||||||
<?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>
|
|
||||||
<!-- 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>
|
|
@ -34,5 +34,5 @@
|
|||||||
<integer name="abs__max_action_buttons">5</integer>
|
<integer name="abs__max_action_buttons">5</integer>
|
||||||
|
|
||||||
<!-- Minimum width for an action button in the menu area of an action bar -->
|
<!-- 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>
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -26,9 +26,4 @@
|
|||||||
<item name="android:windowActionBar">false</item>
|
<item name="android:windowActionBar">false</item>
|
||||||
<item name="android:windowNoTitle">true</item>
|
<item name="android:windowNoTitle">true</item>
|
||||||
</style>
|
</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>
|
</resources>
|
||||||
|
@ -181,7 +181,7 @@
|
|||||||
<!-- Drawable used as a background for activated items. -->
|
<!-- Drawable used as a background for activated items. -->
|
||||||
<attr name="activatedBackgroundIndicator" format="reference" />
|
<attr name="activatedBackgroundIndicator" format="reference" />
|
||||||
|
|
||||||
<attr name="android:windowIsFloating" />
|
<attr name="dropDownHintAppearance" format="reference" />
|
||||||
</declare-styleable>
|
</declare-styleable>
|
||||||
|
|
||||||
|
|
||||||
|
@ -21,7 +21,4 @@
|
|||||||
<color name="abs__bright_foreground_holo_light">@color/abs__background_holo_dark</color>
|
<color name="abs__bright_foreground_holo_light">@color/abs__background_holo_dark</color>
|
||||||
<color name="abs__bright_foreground_disabled_holo_dark">#ff4c4c4c</color>
|
<color name="abs__bright_foreground_disabled_holo_dark">#ff4c4c4c</color>
|
||||||
<color name="abs__bright_foreground_disabled_holo_light">#ffb2b2b2</color>
|
<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>
|
</resources>
|
||||||
|
@ -36,18 +36,6 @@
|
|||||||
<!-- Minimum width for an action button in the menu area of an action bar -->
|
<!-- Minimum width for an action button in the menu area of an action bar -->
|
||||||
<dimen name="abs__action_button_min_width">56dip</dimen>
|
<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>
|
|
||||||
|
|
||||||
|
|
||||||
<!-- Text padding for dropdown items -->
|
<!-- Text padding for dropdown items -->
|
||||||
<dimen name="abs__dropdownitem_text_padding_left">8dip</dimen>
|
<dimen name="abs__dropdownitem_text_padding_left">8dip</dimen>
|
||||||
|
@ -29,10 +29,6 @@
|
|||||||
|
|
||||||
<!-- Title for a button to expand the list of activities in ActivityChooserView [CHAR LIMIT=25] -->
|
<!-- 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>
|
<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] -->
|
<!-- 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>
|
<string name="abs__activitychooserview_choose_application">Choose an application</string>
|
||||||
<!-- Description of the choose target button in a ShareActionProvider (share UI). [CHAR LIMIT=NONE] -->
|
<!-- Description of the choose target button in a ShareActionProvider (share UI). [CHAR LIMIT=NONE] -->
|
||||||
|
@ -302,25 +302,6 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<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">
|
<style name="TextAppearance.Sherlock.Widget.ActionBar.Menu" parent="Widget">
|
||||||
<item name="android:textSize">12sp</item>
|
<item name="android:textSize">12sp</item>
|
||||||
<item name="android:textStyle">bold</item>
|
<item name="android:textStyle">bold</item>
|
||||||
@ -387,15 +368,6 @@
|
|||||||
<item name="android:textStyle">normal</item>
|
<item name="android:textStyle">normal</item>
|
||||||
</style>
|
</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">
|
<style name="Sherlock.__TextAppearance.Small" parent="Widget">
|
||||||
<item name="android:textSize">14sp</item>
|
<item name="android:textSize">14sp</item>
|
||||||
<item name="android:textColor">?android:attr/textColorSecondary</item>
|
<item name="android:textColor">?android:attr/textColorSecondary</item>
|
||||||
@ -409,4 +381,32 @@
|
|||||||
<item name="android:textColor">?textColorPrimary</item>
|
<item name="android:textColor">?textColorPrimary</item>
|
||||||
<item name="android:textSize">14sp</item>
|
<item name="android:textSize">14sp</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
<style name="TextAppearance.Sherlock" parent="@android:style/TextAppearance"/>
|
||||||
|
|
||||||
|
<style name="TextAppearance.Sherlock.SearchResult">
|
||||||
|
<item name="android:textStyle">normal</item>
|
||||||
|
<item name="android:textColor">?android:attr/textColorPrimary</item>
|
||||||
|
<item name="android:textColorHint">?android:attr/textColorHint</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="TextAppearance.Sherlock.SearchResult.Title">
|
||||||
|
<item name="android:textSize">18sp</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="TextAppearance.Sherlock.SearchResult.Subtitle">
|
||||||
|
<item name="android:textSize">14sp</item>
|
||||||
|
<item name="android:textColor">?android:attr/textColorSecondary</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="TextAppearance.Sherlock.Light.SearchResult" parent="TextAppearance.Sherlock.SearchResult"/>
|
||||||
|
|
||||||
|
<style name="TextAppearance.Sherlock.Light.SearchResult.Title">
|
||||||
|
<item name="android:textSize">18sp</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="TextAppearance.Sherlock.Light.SearchResult.Subtitle">
|
||||||
|
<item name="android:textSize">14sp</item>
|
||||||
|
<item name="android:textColor">?android:attr/textColorSecondary</item>
|
||||||
|
</style>
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -9,8 +9,6 @@
|
|||||||
</style>
|
</style>
|
||||||
<style name="Sherlock.__Theme.DarkActionBar" parent="Theme.Sherlock.Light">
|
<style name="Sherlock.__Theme.DarkActionBar" parent="Theme.Sherlock.Light">
|
||||||
</style>
|
</style>
|
||||||
<style name="Sherlock.__Theme.Dialog" parent="android:Theme.Dialog">
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<style name="Theme.Sherlock" parent="Sherlock.__Theme">
|
<style name="Theme.Sherlock" parent="Sherlock.__Theme">
|
||||||
<!-- Action bar styles (from Theme.Holo) -->
|
<!-- Action bar styles (from Theme.Holo) -->
|
||||||
@ -62,6 +60,8 @@
|
|||||||
<item name="textAppearanceSmall">@style/TextAppearance.Sherlock.Small</item>
|
<item name="textAppearanceSmall">@style/TextAppearance.Sherlock.Small</item>
|
||||||
<item name="textAppearanceLargePopupMenu">@style/TextAppearance.Sherlock.Widget.PopupMenu.Large</item>
|
<item name="textAppearanceLargePopupMenu">@style/TextAppearance.Sherlock.Widget.PopupMenu.Large</item>
|
||||||
<item name="textAppearanceSmallPopupMenu">@style/TextAppearance.Sherlock.Widget.PopupMenu.Small</item>
|
<item name="textAppearanceSmallPopupMenu">@style/TextAppearance.Sherlock.Widget.PopupMenu.Small</item>
|
||||||
|
<item name="textAppearanceSearchResultTitle">@style/TextAppearance.Sherlock.SearchResult.Title</item>
|
||||||
|
<item name="textAppearanceSearchResultSubtitle">@style/TextAppearance.Sherlock.SearchResult.Subtitle</item>
|
||||||
|
|
||||||
<item name="popupMenuStyle">@style/Widget.Sherlock.PopupMenu</item>
|
<item name="popupMenuStyle">@style/Widget.Sherlock.PopupMenu</item>
|
||||||
<!-- Internal --><item name="listPopupWindowStyle">@style/Widget.Sherlock.ListPopupWindow</item>
|
<!-- Internal --><item name="listPopupWindowStyle">@style/Widget.Sherlock.ListPopupWindow</item>
|
||||||
@ -74,8 +74,12 @@
|
|||||||
<item name="searchViewGoIcon">@drawable/abs__ic_go</item>
|
<item name="searchViewGoIcon">@drawable/abs__ic_go</item>
|
||||||
<item name="searchViewVoiceIcon">@drawable/abs__ic_voice_search</item>
|
<item name="searchViewVoiceIcon">@drawable/abs__ic_voice_search</item>
|
||||||
<item name="searchAutoCompleteTextView">@style/Widget.Sherlock.SearchAutoCompleteTextView</item>
|
<item name="searchAutoCompleteTextView">@style/Widget.Sherlock.SearchAutoCompleteTextView</item>
|
||||||
<item name="android:dropDownHintAppearance">@style/TextAppearance.Sherlock.Widget.DropDownHint</item>
|
<item name="dropDownHintAppearance">@style/TextAppearance.Sherlock.Widget.DropDownHint</item>
|
||||||
|
<item name="searchViewEditQuery">@drawable/abs__ic_commit_search_api_holo_dark</item>
|
||||||
|
<item name="searchViewEditQueryBackground">?selectableItemBackground</item>
|
||||||
|
<item name="searchResultListItemHeight">58dp</item>
|
||||||
|
|
||||||
|
<item name="windowNoTitle">false</item>
|
||||||
<item name="windowActionBar">true</item>
|
<item name="windowActionBar">true</item>
|
||||||
<item name="windowActionModeOverlay">false</item>
|
<item name="windowActionModeOverlay">false</item>
|
||||||
<item name="windowContentOverlay">@null</item>
|
<item name="windowContentOverlay">@null</item>
|
||||||
@ -130,6 +134,8 @@
|
|||||||
<item name="textAppearanceSmall">@style/TextAppearance.Sherlock.Light.Small</item>
|
<item name="textAppearanceSmall">@style/TextAppearance.Sherlock.Light.Small</item>
|
||||||
<item name="textAppearanceLargePopupMenu">@style/TextAppearance.Sherlock.Light.Widget.PopupMenu.Large</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="textAppearanceSmallPopupMenu">@style/TextAppearance.Sherlock.Light.Widget.PopupMenu.Small</item>
|
||||||
|
<item name="textAppearanceSearchResultTitle">@style/TextAppearance.Sherlock.Light.SearchResult.Title</item>
|
||||||
|
<item name="textAppearanceSearchResultSubtitle">@style/TextAppearance.Sherlock.Light.SearchResult.Subtitle</item>
|
||||||
|
|
||||||
<item name="popupMenuStyle">@style/Widget.Sherlock.Light.PopupMenu</item>
|
<item name="popupMenuStyle">@style/Widget.Sherlock.Light.PopupMenu</item>
|
||||||
<!-- Internal --><item name="listPopupWindowStyle">@style/Widget.Sherlock.Light.ListPopupWindow</item>
|
<!-- Internal --><item name="listPopupWindowStyle">@style/Widget.Sherlock.Light.ListPopupWindow</item>
|
||||||
@ -142,8 +148,12 @@
|
|||||||
<item name="searchViewGoIcon">@drawable/abs__ic_go_search_api_holo_light</item>
|
<item name="searchViewGoIcon">@drawable/abs__ic_go_search_api_holo_light</item>
|
||||||
<item name="searchViewVoiceIcon">@drawable/abs__ic_voice_search_api_holo_light</item>
|
<item name="searchViewVoiceIcon">@drawable/abs__ic_voice_search_api_holo_light</item>
|
||||||
<item name="searchAutoCompleteTextView">@style/Widget.Sherlock.Light.SearchAutoCompleteTextView</item>
|
<item name="searchAutoCompleteTextView">@style/Widget.Sherlock.Light.SearchAutoCompleteTextView</item>
|
||||||
<item name="android:dropDownHintAppearance">@style/TextAppearance.Sherlock.Widget.DropDownHint</item>
|
<item name="dropDownHintAppearance">@style/TextAppearance.Sherlock.Widget.DropDownHint</item>
|
||||||
|
<item name="searchViewEditQuery">@drawable/abs__ic_commit_search_api_holo_light</item>
|
||||||
|
<item name="searchViewEditQueryBackground">?selectableItemBackground</item>
|
||||||
|
<item name="searchResultListItemHeight">58dp</item>
|
||||||
|
|
||||||
|
<item name="windowNoTitle">false</item>
|
||||||
<item name="windowActionBar">true</item>
|
<item name="windowActionBar">true</item>
|
||||||
<item name="windowActionModeOverlay">false</item>
|
<item name="windowActionModeOverlay">false</item>
|
||||||
<item name="windowContentOverlay">@null</item>
|
<item name="windowContentOverlay">@null</item>
|
||||||
@ -171,6 +181,18 @@
|
|||||||
<item name="actionModePopupWindowStyle">@style/Widget.Sherlock.PopupWindow.ActionMode</item>
|
<item name="actionModePopupWindowStyle">@style/Widget.Sherlock.PopupWindow.ActionMode</item>
|
||||||
|
|
||||||
<item name="actionModeShareDrawable">@drawable/abs__ic_menu_share_holo_dark</item>
|
<item name="actionModeShareDrawable">@drawable/abs__ic_menu_share_holo_dark</item>
|
||||||
|
|
||||||
|
<!-- We want the dark action bar SearchView stuff -->
|
||||||
|
<item name="searchDropdownBackground">@drawable/abs__search_dropdown_dark</item>
|
||||||
|
<item name="searchViewTextField">@drawable/abs__textfield_searchview_holo_dark</item>
|
||||||
|
<item name="searchViewTextFieldRight">@drawable/abs__textfield_searchview_right_holo_dark</item>
|
||||||
|
<item name="searchViewCloseIcon">@drawable/abs__ic_clear</item>
|
||||||
|
<item name="searchViewSearchIcon">@drawable/abs__ic_search</item>
|
||||||
|
<item name="searchViewGoIcon">@drawable/abs__ic_go</item>
|
||||||
|
<item name="searchViewVoiceIcon">@drawable/abs__ic_voice_search</item>
|
||||||
|
<item name="searchAutoCompleteTextView">@style/Widget.Sherlock.SearchAutoCompleteTextView</item>
|
||||||
|
<item name="dropDownHintAppearance">@style/TextAppearance.Sherlock.Widget.DropDownHint</item>
|
||||||
|
<item name="searchViewEditQuery">@drawable/abs__ic_commit_search_api_holo_dark</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
|
||||||
@ -182,58 +204,4 @@
|
|||||||
<item name="windowActionBar">false</item>
|
<item name="windowActionBar">false</item>
|
||||||
<item name="windowNoTitle">true</item>
|
<item name="windowNoTitle">true</item>
|
||||||
</style>
|
</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>
|
</resources>
|
||||||
|
@ -3,18 +3,17 @@ package android.support.v4.app;
|
|||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.Window;
|
import android.view.Window;
|
||||||
|
import com.actionbarsherlock.ActionBarSherlock;
|
||||||
import com.actionbarsherlock.ActionBarSherlock.OnCreatePanelMenuListener;
|
import com.actionbarsherlock.ActionBarSherlock.OnCreatePanelMenuListener;
|
||||||
import com.actionbarsherlock.ActionBarSherlock.OnMenuItemSelectedListener;
|
import com.actionbarsherlock.ActionBarSherlock.OnMenuItemSelectedListener;
|
||||||
import com.actionbarsherlock.ActionBarSherlock.OnPreparePanelListener;
|
import com.actionbarsherlock.ActionBarSherlock.OnPreparePanelListener;
|
||||||
import com.actionbarsherlock.view.Menu;
|
import com.actionbarsherlock.view.Menu;
|
||||||
import com.actionbarsherlock.view.MenuInflater;
|
import com.actionbarsherlock.view.MenuInflater;
|
||||||
import com.actionbarsherlock.view.MenuItem;
|
import com.actionbarsherlock.view.MenuItem;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
/** I'm in ur package. Stealing ur variables. */
|
/** I'm in ur package. Stealing ur variables. */
|
||||||
public abstract class Watson extends FragmentActivity implements OnCreatePanelMenuListener, OnPreparePanelListener, OnMenuItemSelectedListener {
|
public abstract class Watson extends FragmentActivity implements OnCreatePanelMenuListener, OnPreparePanelListener, OnMenuItemSelectedListener {
|
||||||
private static final boolean DEBUG = false;
|
|
||||||
private static final String TAG = "Watson";
|
private static final String TAG = "Watson";
|
||||||
|
|
||||||
/** Fragment interface for menu creation callback. */
|
/** Fragment interface for menu creation callback. */
|
||||||
@ -39,11 +38,11 @@ public abstract class Watson extends FragmentActivity implements OnCreatePanelMe
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCreatePanelMenu(int featureId, Menu menu) {
|
public boolean onCreatePanelMenu(int featureId, Menu menu) {
|
||||||
if (DEBUG) Log.d(TAG, "[onCreatePanelMenu] featureId: " + featureId + ", menu: " + menu);
|
if (ActionBarSherlock.DEBUG) Log.d(TAG, "[onCreatePanelMenu] featureId: " + featureId + ", menu: " + menu);
|
||||||
|
|
||||||
if (featureId == Window.FEATURE_OPTIONS_PANEL) {
|
if (featureId == Window.FEATURE_OPTIONS_PANEL) {
|
||||||
boolean result = onCreateOptionsMenu(menu);
|
boolean result = onCreateOptionsMenu(menu);
|
||||||
if (DEBUG) Log.d(TAG, "[onCreatePanelMenu] activity create result: " + result);
|
if (ActionBarSherlock.DEBUG) Log.d(TAG, "[onCreatePanelMenu] activity create result: " + result);
|
||||||
|
|
||||||
MenuInflater inflater = getSupportMenuInflater();
|
MenuInflater inflater = getSupportMenuInflater();
|
||||||
boolean show = false;
|
boolean show = false;
|
||||||
@ -73,10 +72,10 @@ public abstract class Watson extends FragmentActivity implements OnCreatePanelMe
|
|||||||
|
|
||||||
mCreatedMenus = newMenus;
|
mCreatedMenus = newMenus;
|
||||||
|
|
||||||
if (DEBUG) Log.d(TAG, "[onCreatePanelMenu] fragments create result: " + show);
|
if (ActionBarSherlock.DEBUG) Log.d(TAG, "[onCreatePanelMenu] fragments create result: " + show);
|
||||||
result |= show;
|
result |= show;
|
||||||
|
|
||||||
if (DEBUG) Log.d(TAG, "[onCreatePanelMenu] returning " + result);
|
if (ActionBarSherlock.DEBUG) Log.d(TAG, "[onCreatePanelMenu] returning " + result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -84,11 +83,11 @@ public abstract class Watson extends FragmentActivity implements OnCreatePanelMe
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onPreparePanel(int featureId, View view, Menu menu) {
|
public boolean onPreparePanel(int featureId, View view, Menu menu) {
|
||||||
if (DEBUG) Log.d(TAG, "[onPreparePanel] featureId: " + featureId + ", view: " + view + " menu: " + menu);
|
if (ActionBarSherlock.DEBUG) Log.d(TAG, "[onPreparePanel] featureId: " + featureId + ", view: " + view + " menu: " + menu);
|
||||||
|
|
||||||
if (featureId == Window.FEATURE_OPTIONS_PANEL) {
|
if (featureId == Window.FEATURE_OPTIONS_PANEL) {
|
||||||
boolean result = onPrepareOptionsMenu(menu);
|
boolean result = onPrepareOptionsMenu(menu);
|
||||||
if (DEBUG) Log.d(TAG, "[onPreparePanel] activity prepare result: " + result);
|
if (ActionBarSherlock.DEBUG) Log.d(TAG, "[onPreparePanel] activity prepare result: " + result);
|
||||||
|
|
||||||
boolean show = false;
|
boolean show = false;
|
||||||
if (mFragments.mAdded != null) {
|
if (mFragments.mAdded != null) {
|
||||||
@ -101,11 +100,11 @@ public abstract class Watson extends FragmentActivity implements OnCreatePanelMe
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DEBUG) Log.d(TAG, "[onPreparePanel] fragments prepare result: " + show);
|
if (ActionBarSherlock.DEBUG) Log.d(TAG, "[onPreparePanel] fragments prepare result: " + show);
|
||||||
result |= show;
|
result |= show;
|
||||||
|
|
||||||
result &= menu.hasVisibleItems();
|
result &= menu.hasVisibleItems();
|
||||||
if (DEBUG) Log.d(TAG, "[onPreparePanel] returning " + result);
|
if (ActionBarSherlock.DEBUG) Log.d(TAG, "[onPreparePanel] returning " + result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -113,7 +112,7 @@ public abstract class Watson extends FragmentActivity implements OnCreatePanelMe
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onMenuItemSelected(int featureId, MenuItem item) {
|
public boolean onMenuItemSelected(int featureId, MenuItem item) {
|
||||||
if (DEBUG) Log.d(TAG, "[onMenuItemSelected] featureId: " + featureId + ", item: " + item);
|
if (ActionBarSherlock.DEBUG) Log.d(TAG, "[onMenuItemSelected] featureId: " + featureId + ", item: " + item);
|
||||||
|
|
||||||
if (featureId == Window.FEATURE_OPTIONS_PANEL) {
|
if (featureId == Window.FEATURE_OPTIONS_PANEL) {
|
||||||
if (onOptionsItemSelected(item)) {
|
if (onOptionsItemSelected(item)) {
|
||||||
|
@ -1,14 +1,5 @@
|
|||||||
package com.actionbarsherlock;
|
package com.actionbarsherlock;
|
||||||
|
|
||||||
import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;
|
|
||||||
import java.lang.annotation.ElementType;
|
|
||||||
import java.lang.annotation.Retention;
|
|
||||||
import java.lang.annotation.RetentionPolicy;
|
|
||||||
import java.lang.annotation.Target;
|
|
||||||
import java.lang.reflect.Constructor;
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
@ -27,6 +18,16 @@ import com.actionbarsherlock.view.ActionMode;
|
|||||||
import com.actionbarsherlock.view.Menu;
|
import com.actionbarsherlock.view.Menu;
|
||||||
import com.actionbarsherlock.view.MenuInflater;
|
import com.actionbarsherlock.view.MenuInflater;
|
||||||
import com.actionbarsherlock.view.MenuItem;
|
import com.actionbarsherlock.view.MenuItem;
|
||||||
|
import java.lang.annotation.ElementType;
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
import java.lang.annotation.Target;
|
||||||
|
import java.lang.reflect.Constructor;
|
||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Iterator;
|
||||||
|
|
||||||
|
import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>Helper for implementing the action bar design pattern across all versions
|
* <p>Helper for implementing the action bar design pattern across all versions
|
||||||
@ -40,7 +41,7 @@ import com.actionbarsherlock.view.MenuItem;
|
|||||||
*/
|
*/
|
||||||
public abstract class ActionBarSherlock {
|
public abstract class ActionBarSherlock {
|
||||||
protected static final String TAG = "ActionBarSherlock";
|
protected static final String TAG = "ActionBarSherlock";
|
||||||
protected static final boolean DEBUG = false;
|
public static final boolean DEBUG = false;
|
||||||
|
|
||||||
private static final Class<?>[] CONSTRUCTOR_ARGS = new Class[] { Activity.class, int.class };
|
private static final Class<?>[] CONSTRUCTOR_ARGS = new Class[] { Activity.class, int.class };
|
||||||
private static final HashMap<Implementation, Class<? extends ActionBarSherlock>> IMPLEMENTATIONS =
|
private static final HashMap<Implementation, Class<? extends ActionBarSherlock>> IMPLEMENTATIONS =
|
||||||
@ -791,4 +792,9 @@ public abstract class ActionBarSherlock {
|
|||||||
* @see ActionMode
|
* @see ActionMode
|
||||||
*/
|
*/
|
||||||
public abstract ActionMode startActionMode(ActionMode.Callback callback);
|
public abstract ActionMode startActionMode(ActionMode.Callback callback);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ensure that the action bar is attached.
|
||||||
|
*/
|
||||||
|
public void ensureActionBar() {}
|
||||||
}
|
}
|
||||||
|
@ -243,6 +243,12 @@ public abstract class SherlockActivity extends Activity implements OnCreatePanel
|
|||||||
getSherlock().requestFeature((int)featureId);
|
getSherlock().requestFeature((int)featureId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View findViewById(int id) {
|
||||||
|
getSherlock().ensureActionBar();
|
||||||
|
return super.findViewById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// Progress Indication
|
// Progress Indication
|
||||||
|
@ -8,9 +8,9 @@ import com.actionbarsherlock.view.Menu;
|
|||||||
import com.actionbarsherlock.view.MenuInflater;
|
import com.actionbarsherlock.view.MenuInflater;
|
||||||
import com.actionbarsherlock.view.MenuItem;
|
import com.actionbarsherlock.view.MenuItem;
|
||||||
|
|
||||||
import static com.actionbarsherlock.app.SherlockFragmentActivity.OnCreateOptionsMenuListener;
|
import static android.support.v4.app.Watson.OnCreateOptionsMenuListener;
|
||||||
import static com.actionbarsherlock.app.SherlockFragmentActivity.OnOptionsItemSelectedListener;
|
import static android.support.v4.app.Watson.OnOptionsItemSelectedListener;
|
||||||
import static com.actionbarsherlock.app.SherlockFragmentActivity.OnPrepareOptionsMenuListener;
|
import static android.support.v4.app.Watson.OnPrepareOptionsMenuListener;
|
||||||
|
|
||||||
public class SherlockDialogFragment extends DialogFragment implements OnCreateOptionsMenuListener, OnPrepareOptionsMenuListener, OnOptionsItemSelectedListener {
|
public class SherlockDialogFragment extends DialogFragment implements OnCreateOptionsMenuListener, OnPrepareOptionsMenuListener, OnOptionsItemSelectedListener {
|
||||||
private SherlockFragmentActivity mActivity;
|
private SherlockFragmentActivity mActivity;
|
||||||
|
@ -232,6 +232,12 @@ public abstract class SherlockExpandableListActivity extends ExpandableListActiv
|
|||||||
getSherlock().requestFeature((int)featureId);
|
getSherlock().requestFeature((int)featureId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View findViewById(int id) {
|
||||||
|
getSherlock().ensureActionBar();
|
||||||
|
return super.findViewById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// Progress Indication
|
// Progress Indication
|
||||||
|
@ -8,9 +8,9 @@ import com.actionbarsherlock.view.Menu;
|
|||||||
import com.actionbarsherlock.view.MenuInflater;
|
import com.actionbarsherlock.view.MenuInflater;
|
||||||
import com.actionbarsherlock.view.MenuItem;
|
import com.actionbarsherlock.view.MenuItem;
|
||||||
|
|
||||||
import static com.actionbarsherlock.app.SherlockFragmentActivity.OnCreateOptionsMenuListener;
|
import static android.support.v4.app.Watson.OnCreateOptionsMenuListener;
|
||||||
import static com.actionbarsherlock.app.SherlockFragmentActivity.OnOptionsItemSelectedListener;
|
import static android.support.v4.app.Watson.OnOptionsItemSelectedListener;
|
||||||
import static com.actionbarsherlock.app.SherlockFragmentActivity.OnPrepareOptionsMenuListener;
|
import static android.support.v4.app.Watson.OnPrepareOptionsMenuListener;
|
||||||
|
|
||||||
public class SherlockFragment extends Fragment implements OnCreateOptionsMenuListener, OnPrepareOptionsMenuListener, OnOptionsItemSelectedListener {
|
public class SherlockFragment extends Fragment implements OnCreateOptionsMenuListener, OnPrepareOptionsMenuListener, OnOptionsItemSelectedListener {
|
||||||
private SherlockFragmentActivity mActivity;
|
private SherlockFragmentActivity mActivity;
|
||||||
|
@ -19,7 +19,6 @@ import static com.actionbarsherlock.ActionBarSherlock.OnActionModeStartedListene
|
|||||||
|
|
||||||
/** @see {@link android.support.v4.app.Watson} */
|
/** @see {@link android.support.v4.app.Watson} */
|
||||||
public class SherlockFragmentActivity extends Watson implements OnActionModeStartedListener, OnActionModeFinishedListener {
|
public class SherlockFragmentActivity extends Watson implements OnActionModeStartedListener, OnActionModeFinishedListener {
|
||||||
private static final boolean DEBUG = false;
|
|
||||||
private static final String TAG = "SherlockFragmentActivity";
|
private static final String TAG = "SherlockFragmentActivity";
|
||||||
|
|
||||||
private ActionBarSherlock mSherlock;
|
private ActionBarSherlock mSherlock;
|
||||||
@ -139,33 +138,33 @@ public class SherlockFragmentActivity extends Watson implements OnActionModeStar
|
|||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
public MenuInflater getSupportMenuInflater() {
|
public MenuInflater getSupportMenuInflater() {
|
||||||
if (DEBUG) Log.d(TAG, "[getSupportMenuInflater]");
|
if (ActionBarSherlock.DEBUG) Log.d(TAG, "[getSupportMenuInflater]");
|
||||||
|
|
||||||
return getSherlock().getMenuInflater();
|
return getSherlock().getMenuInflater();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void invalidateOptionsMenu() {
|
public void invalidateOptionsMenu() {
|
||||||
if (DEBUG) Log.d(TAG, "[invalidateOptionsMenu]");
|
if (ActionBarSherlock.DEBUG) Log.d(TAG, "[invalidateOptionsMenu]");
|
||||||
|
|
||||||
getSherlock().dispatchInvalidateOptionsMenu();
|
getSherlock().dispatchInvalidateOptionsMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void supportInvalidateOptionsMenu() {
|
public void supportInvalidateOptionsMenu() {
|
||||||
if (DEBUG) Log.d(TAG, "[supportInvalidateOptionsMenu]");
|
if (ActionBarSherlock.DEBUG) Log.d(TAG, "[supportInvalidateOptionsMenu]");
|
||||||
|
|
||||||
invalidateOptionsMenu();
|
invalidateOptionsMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final boolean onCreatePanelMenu(int featureId, android.view.Menu menu) {
|
public final boolean onCreatePanelMenu(int featureId, android.view.Menu menu) {
|
||||||
if (DEBUG) Log.d(TAG, "[onCreatePanelMenu] featureId: " + featureId + ", menu: " + menu);
|
if (ActionBarSherlock.DEBUG) Log.d(TAG, "[onCreatePanelMenu] featureId: " + featureId + ", menu: " + menu);
|
||||||
|
|
||||||
if (featureId == Window.FEATURE_OPTIONS_PANEL && !mIgnoreNativeCreate) {
|
if (featureId == Window.FEATURE_OPTIONS_PANEL && !mIgnoreNativeCreate) {
|
||||||
mIgnoreNativeCreate = true;
|
mIgnoreNativeCreate = true;
|
||||||
boolean result = getSherlock().dispatchCreateOptionsMenu(menu);
|
boolean result = getSherlock().dispatchCreateOptionsMenu(menu);
|
||||||
mIgnoreNativeCreate = false;
|
mIgnoreNativeCreate = false;
|
||||||
|
|
||||||
if (DEBUG) Log.d(TAG, "[onCreatePanelMenu] returning " + result);
|
if (ActionBarSherlock.DEBUG) Log.d(TAG, "[onCreatePanelMenu] returning " + result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
return super.onCreatePanelMenu(featureId, menu);
|
return super.onCreatePanelMenu(featureId, menu);
|
||||||
@ -178,14 +177,14 @@ public class SherlockFragmentActivity extends Watson implements OnActionModeStar
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final boolean onPreparePanel(int featureId, View view, android.view.Menu menu) {
|
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 (ActionBarSherlock.DEBUG) Log.d(TAG, "[onPreparePanel] featureId: " + featureId + ", view: " + view + ", menu: " + menu);
|
||||||
|
|
||||||
if (featureId == Window.FEATURE_OPTIONS_PANEL && !mIgnoreNativePrepare) {
|
if (featureId == Window.FEATURE_OPTIONS_PANEL && !mIgnoreNativePrepare) {
|
||||||
mIgnoreNativePrepare = true;
|
mIgnoreNativePrepare = true;
|
||||||
boolean result = getSherlock().dispatchPrepareOptionsMenu(menu);
|
boolean result = getSherlock().dispatchPrepareOptionsMenu(menu);
|
||||||
mIgnoreNativePrepare = false;
|
mIgnoreNativePrepare = false;
|
||||||
|
|
||||||
if (DEBUG) Log.d(TAG, "[onPreparePanel] returning " + result);
|
if (ActionBarSherlock.DEBUG) Log.d(TAG, "[onPreparePanel] returning " + result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
return super.onPreparePanel(featureId, view, menu);
|
return super.onPreparePanel(featureId, view, menu);
|
||||||
@ -198,14 +197,14 @@ public class SherlockFragmentActivity extends Watson implements OnActionModeStar
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final boolean onMenuItemSelected(int featureId, android.view.MenuItem item) {
|
public final boolean onMenuItemSelected(int featureId, android.view.MenuItem item) {
|
||||||
if (DEBUG) Log.d(TAG, "[onMenuItemSelected] featureId: " + featureId + ", item: " + item);
|
if (ActionBarSherlock.DEBUG) Log.d(TAG, "[onMenuItemSelected] featureId: " + featureId + ", item: " + item.getTitle());
|
||||||
|
|
||||||
if (featureId == Window.FEATURE_OPTIONS_PANEL && !mIgnoreNativeSelected) {
|
if (featureId == Window.FEATURE_OPTIONS_PANEL && !mIgnoreNativeSelected) {
|
||||||
mIgnoreNativeSelected = true;
|
mIgnoreNativeSelected = true;
|
||||||
boolean result = getSherlock().dispatchOptionsItemSelected(item);
|
boolean result = getSherlock().dispatchOptionsItemSelected(item);
|
||||||
mIgnoreNativeSelected = false;
|
mIgnoreNativeSelected = false;
|
||||||
|
|
||||||
if (DEBUG) Log.d(TAG, "[onMenuItemSelected] returning " + result);
|
if (ActionBarSherlock.DEBUG) Log.d(TAG, "[onMenuItemSelected] returning " + result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
return super.onMenuItemSelected(featureId, item);
|
return super.onMenuItemSelected(featureId, item);
|
||||||
@ -276,6 +275,12 @@ public class SherlockFragmentActivity extends Watson implements OnActionModeStar
|
|||||||
getSherlock().requestFeature((int)featureId);
|
getSherlock().requestFeature((int)featureId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View findViewById(int id) {
|
||||||
|
getSherlock().ensureActionBar();
|
||||||
|
return super.findViewById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// Progress Indication
|
// Progress Indication
|
||||||
|
@ -243,6 +243,12 @@ public abstract class SherlockListActivity extends ListActivity implements OnCre
|
|||||||
getSherlock().requestFeature((int)featureId);
|
getSherlock().requestFeature((int)featureId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View findViewById(int id) {
|
||||||
|
getSherlock().ensureActionBar();
|
||||||
|
return super.findViewById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// Progress Indication
|
// Progress Indication
|
||||||
|
@ -8,9 +8,9 @@ import com.actionbarsherlock.view.Menu;
|
|||||||
import com.actionbarsherlock.view.MenuInflater;
|
import com.actionbarsherlock.view.MenuInflater;
|
||||||
import com.actionbarsherlock.view.MenuItem;
|
import com.actionbarsherlock.view.MenuItem;
|
||||||
|
|
||||||
import static com.actionbarsherlock.app.SherlockFragmentActivity.OnCreateOptionsMenuListener;
|
import static android.support.v4.app.Watson.OnCreateOptionsMenuListener;
|
||||||
import static com.actionbarsherlock.app.SherlockFragmentActivity.OnOptionsItemSelectedListener;
|
import static android.support.v4.app.Watson.OnOptionsItemSelectedListener;
|
||||||
import static com.actionbarsherlock.app.SherlockFragmentActivity.OnPrepareOptionsMenuListener;
|
import static android.support.v4.app.Watson.OnPrepareOptionsMenuListener;
|
||||||
|
|
||||||
public class SherlockListFragment extends ListFragment implements OnCreateOptionsMenuListener, OnPrepareOptionsMenuListener, OnOptionsItemSelectedListener {
|
public class SherlockListFragment extends ListFragment implements OnCreateOptionsMenuListener, OnPrepareOptionsMenuListener, OnOptionsItemSelectedListener {
|
||||||
private SherlockFragmentActivity mActivity;
|
private SherlockFragmentActivity mActivity;
|
||||||
|
@ -243,6 +243,12 @@ public abstract class SherlockPreferenceActivity extends PreferenceActivity impl
|
|||||||
getSherlock().requestFeature((int)featureId);
|
getSherlock().requestFeature((int)featureId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View findViewById(int id) {
|
||||||
|
getSherlock().ensureActionBar();
|
||||||
|
return super.findViewById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// Progress Indication
|
// Progress Indication
|
||||||
|
@ -1,11 +1,5 @@
|
|||||||
package com.actionbarsherlock.internal;
|
package com.actionbarsherlock.internal;
|
||||||
|
|
||||||
import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;
|
|
||||||
import static com.actionbarsherlock.internal.ResourcesCompat.getResources_getBoolean;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import org.xmlpull.v1.XmlPullParser;
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.pm.ActivityInfo;
|
import android.content.pm.ActivityInfo;
|
||||||
@ -28,9 +22,8 @@ import android.view.Window;
|
|||||||
import android.view.accessibility.AccessibilityEvent;
|
import android.view.accessibility.AccessibilityEvent;
|
||||||
import android.view.animation.Animation;
|
import android.view.animation.Animation;
|
||||||
import android.view.animation.AnimationUtils;
|
import android.view.animation.AnimationUtils;
|
||||||
import android.widget.FrameLayout;
|
|
||||||
import android.widget.TextView;
|
|
||||||
import com.actionbarsherlock.ActionBarSherlock;
|
import com.actionbarsherlock.ActionBarSherlock;
|
||||||
|
import com.actionbarsherlock.BuildConfig;
|
||||||
import com.actionbarsherlock.R;
|
import com.actionbarsherlock.R;
|
||||||
import com.actionbarsherlock.app.ActionBar;
|
import com.actionbarsherlock.app.ActionBar;
|
||||||
import com.actionbarsherlock.internal.app.ActionBarImpl;
|
import com.actionbarsherlock.internal.app.ActionBarImpl;
|
||||||
@ -46,6 +39,13 @@ import com.actionbarsherlock.internal.widget.IcsProgressBar;
|
|||||||
import com.actionbarsherlock.view.ActionMode;
|
import com.actionbarsherlock.view.ActionMode;
|
||||||
import com.actionbarsherlock.view.Menu;
|
import com.actionbarsherlock.view.Menu;
|
||||||
import com.actionbarsherlock.view.MenuItem;
|
import com.actionbarsherlock.view.MenuItem;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import org.xmlpull.v1.XmlPullParser;
|
||||||
|
|
||||||
|
import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;
|
||||||
|
import static com.actionbarsherlock.internal.ResourcesCompat.getResources_getBoolean;
|
||||||
|
|
||||||
@ActionBarSherlock.Implementation(api = 7)
|
@ActionBarSherlock.Implementation(api = 7)
|
||||||
public class ActionBarSherlockCompat extends ActionBarSherlock implements MenuBuilder.Callback, com.actionbarsherlock.view.Window.Callback, MenuPresenter.Callback, android.view.MenuItem.OnMenuItemClickListener {
|
public class ActionBarSherlockCompat extends ActionBarSherlock implements MenuBuilder.Callback, com.actionbarsherlock.view.Window.Callback, MenuPresenter.Callback, android.view.MenuItem.OnMenuItemClickListener {
|
||||||
@ -108,13 +108,6 @@ public class ActionBarSherlockCompat extends ActionBarSherlock implements MenuBu
|
|||||||
/** Parent view in which the context action bar is displayed. */
|
/** Parent view in which the context action bar is displayed. */
|
||||||
private ActionBarContextView mActionModeView;
|
private ActionBarContextView mActionModeView;
|
||||||
|
|
||||||
/** Title view used with dialogs. */
|
|
||||||
private TextView mTitleView;
|
|
||||||
/** Current activity title. */
|
|
||||||
private CharSequence mTitle = null;
|
|
||||||
/** Whether or not this "activity" is floating (i.e., a dialog) */
|
|
||||||
private boolean mIsFloating;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
@ -123,14 +116,14 @@ public class ActionBarSherlockCompat extends ActionBarSherlock implements MenuBu
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ActionBar getActionBar() {
|
public ActionBar getActionBar() {
|
||||||
if (DEBUG) Log.d(TAG, "[getActionBar]");
|
if (ActionBarSherlock.DEBUG) Log.d(TAG, "[getActionBar]");
|
||||||
|
|
||||||
initActionBar();
|
initActionBar();
|
||||||
return aActionBar;
|
return aActionBar;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initActionBar() {
|
private void initActionBar() {
|
||||||
if (DEBUG) Log.d(TAG, "[initActionBar]");
|
if (ActionBarSherlock.DEBUG) Log.d(TAG, "[initActionBar]");
|
||||||
|
|
||||||
// Initializing the window decor can change window feature flags.
|
// Initializing the window decor can change window feature flags.
|
||||||
// Make sure that we have the correct set before performing the test below.
|
// Make sure that we have the correct set before performing the test below.
|
||||||
@ -157,14 +150,14 @@ public class ActionBarSherlockCompat extends ActionBarSherlock implements MenuBu
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setTitle(CharSequence title) {
|
public void setTitle(CharSequence title) {
|
||||||
if (DEBUG) Log.d(TAG, "[setTitle] title: " + title);
|
if (ActionBarSherlock.DEBUG) Log.d(TAG, "[setTitle] title: " + title);
|
||||||
|
|
||||||
dispatchTitleChanged(title, 0);
|
dispatchTitleChanged(title, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ActionMode startActionMode(ActionMode.Callback callback) {
|
public ActionMode startActionMode(ActionMode.Callback callback) {
|
||||||
if (DEBUG) Log.d(TAG, "[startActionMode] callback: " + callback);
|
if (ActionBarSherlock.DEBUG) Log.d(TAG, "[startActionMode] callback: " + callback);
|
||||||
|
|
||||||
if (mActionMode != null) {
|
if (mActionMode != null) {
|
||||||
mActionMode.finish();
|
mActionMode.finish();
|
||||||
@ -215,7 +208,7 @@ public class ActionBarSherlockCompat extends ActionBarSherlock implements MenuBu
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void dispatchConfigurationChanged(Configuration newConfig) {
|
public void dispatchConfigurationChanged(Configuration newConfig) {
|
||||||
if (DEBUG) Log.d(TAG, "[dispatchConfigurationChanged] newConfig: " + newConfig);
|
if (ActionBarSherlock.DEBUG) Log.d(TAG, "[dispatchConfigurationChanged] newConfig: " + newConfig);
|
||||||
|
|
||||||
if (aActionBar != null) {
|
if (aActionBar != null) {
|
||||||
aActionBar.onConfigurationChanged(newConfig);
|
aActionBar.onConfigurationChanged(newConfig);
|
||||||
@ -224,7 +217,7 @@ public class ActionBarSherlockCompat extends ActionBarSherlock implements MenuBu
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void dispatchPostResume() {
|
public void dispatchPostResume() {
|
||||||
if (DEBUG) Log.d(TAG, "[dispatchPostResume]");
|
if (ActionBarSherlock.DEBUG) Log.d(TAG, "[dispatchPostResume]");
|
||||||
|
|
||||||
if (aActionBar != null) {
|
if (aActionBar != null) {
|
||||||
aActionBar.setShowHideAnimationEnabled(true);
|
aActionBar.setShowHideAnimationEnabled(true);
|
||||||
@ -233,7 +226,7 @@ public class ActionBarSherlockCompat extends ActionBarSherlock implements MenuBu
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void dispatchPause() {
|
public void dispatchPause() {
|
||||||
if (DEBUG) Log.d(TAG, "[dispatchPause]");
|
if (ActionBarSherlock.DEBUG) Log.d(TAG, "[dispatchPause]");
|
||||||
|
|
||||||
if (wActionBar != null && wActionBar.isOverflowMenuShowing()) {
|
if (wActionBar != null && wActionBar.isOverflowMenuShowing()) {
|
||||||
wActionBar.hideOverflowMenu();
|
wActionBar.hideOverflowMenu();
|
||||||
@ -242,7 +235,7 @@ public class ActionBarSherlockCompat extends ActionBarSherlock implements MenuBu
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void dispatchStop() {
|
public void dispatchStop() {
|
||||||
if (DEBUG) Log.d(TAG, "[dispatchStop]");
|
if (ActionBarSherlock.DEBUG) Log.d(TAG, "[dispatchStop]");
|
||||||
|
|
||||||
if (aActionBar != null) {
|
if (aActionBar != null) {
|
||||||
aActionBar.setShowHideAnimationEnabled(false);
|
aActionBar.setShowHideAnimationEnabled(false);
|
||||||
@ -251,7 +244,7 @@ public class ActionBarSherlockCompat extends ActionBarSherlock implements MenuBu
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void dispatchInvalidateOptionsMenu() {
|
public void dispatchInvalidateOptionsMenu() {
|
||||||
if (DEBUG) Log.d(TAG, "[dispatchInvalidateOptionsMenu]");
|
if (ActionBarSherlock.DEBUG) Log.d(TAG, "[dispatchInvalidateOptionsMenu]");
|
||||||
|
|
||||||
Bundle savedActionViewStates = null;
|
Bundle savedActionViewStates = null;
|
||||||
if (mMenu != null) {
|
if (mMenu != null) {
|
||||||
@ -275,7 +268,7 @@ public class ActionBarSherlockCompat extends ActionBarSherlock implements MenuBu
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean dispatchOpenOptionsMenu() {
|
public boolean dispatchOpenOptionsMenu() {
|
||||||
if (DEBUG) Log.d(TAG, "[dispatchOpenOptionsMenu]");
|
if (ActionBarSherlock.DEBUG) Log.d(TAG, "[dispatchOpenOptionsMenu]");
|
||||||
|
|
||||||
if (!isReservingOverflow()) {
|
if (!isReservingOverflow()) {
|
||||||
return false;
|
return false;
|
||||||
@ -286,7 +279,7 @@ public class ActionBarSherlockCompat extends ActionBarSherlock implements MenuBu
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean dispatchCloseOptionsMenu() {
|
public boolean dispatchCloseOptionsMenu() {
|
||||||
if (DEBUG) Log.d(TAG, "[dispatchCloseOptionsMenu]");
|
if (ActionBarSherlock.DEBUG) Log.d(TAG, "[dispatchCloseOptionsMenu]");
|
||||||
|
|
||||||
if (!isReservingOverflow()) {
|
if (!isReservingOverflow()) {
|
||||||
return false;
|
return false;
|
||||||
@ -300,7 +293,7 @@ public class ActionBarSherlockCompat extends ActionBarSherlock implements MenuBu
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void dispatchPostCreate(Bundle savedInstanceState) {
|
public void dispatchPostCreate(Bundle savedInstanceState) {
|
||||||
if (DEBUG) Log.d(TAG, "[dispatchOnPostCreate]");
|
if (ActionBarSherlock.DEBUG) Log.d(TAG, "[dispatchOnPostCreate]");
|
||||||
|
|
||||||
if (mIsDelegate) {
|
if (mIsDelegate) {
|
||||||
mIsTitleReady = true;
|
mIsTitleReady = true;
|
||||||
@ -313,7 +306,7 @@ public class ActionBarSherlockCompat extends ActionBarSherlock implements MenuBu
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean dispatchCreateOptionsMenu(android.view.Menu menu) {
|
public boolean dispatchCreateOptionsMenu(android.view.Menu menu) {
|
||||||
if (DEBUG) {
|
if (BuildConfig.DEBUG) {
|
||||||
Log.d(TAG, "[dispatchCreateOptionsMenu] android.view.Menu: " + menu);
|
Log.d(TAG, "[dispatchCreateOptionsMenu] android.view.Menu: " + menu);
|
||||||
Log.d(TAG, "[dispatchCreateOptionsMenu] returning true");
|
Log.d(TAG, "[dispatchCreateOptionsMenu] returning true");
|
||||||
}
|
}
|
||||||
@ -322,7 +315,7 @@ public class ActionBarSherlockCompat extends ActionBarSherlock implements MenuBu
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean dispatchPrepareOptionsMenu(android.view.Menu menu) {
|
public boolean dispatchPrepareOptionsMenu(android.view.Menu menu) {
|
||||||
if (DEBUG) Log.d(TAG, "[dispatchPrepareOptionsMenu] android.view.Menu: " + menu);
|
if (ActionBarSherlock.DEBUG) Log.d(TAG, "[dispatchPrepareOptionsMenu] android.view.Menu: " + menu);
|
||||||
|
|
||||||
if (mActionMode != null) {
|
if (mActionMode != null) {
|
||||||
return false;
|
return false;
|
||||||
@ -348,7 +341,7 @@ public class ActionBarSherlockCompat extends ActionBarSherlock implements MenuBu
|
|||||||
}
|
}
|
||||||
|
|
||||||
boolean result = mMenu.bindNativeOverflow(menu, this, mNativeItemMap);
|
boolean result = mMenu.bindNativeOverflow(menu, this, mNativeItemMap);
|
||||||
if (DEBUG) Log.d(TAG, "[dispatchPrepareOptionsMenu] returning " + result);
|
if (ActionBarSherlock.DEBUG) Log.d(TAG, "[dispatchPrepareOptionsMenu] returning " + result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -359,7 +352,7 @@ public class ActionBarSherlockCompat extends ActionBarSherlock implements MenuBu
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean dispatchMenuOpened(int featureId, android.view.Menu menu) {
|
public boolean dispatchMenuOpened(int featureId, android.view.Menu menu) {
|
||||||
if (DEBUG) Log.d(TAG, "[dispatchMenuOpened] featureId: " + featureId + ", menu: " + menu);
|
if (ActionBarSherlock.DEBUG) Log.d(TAG, "[dispatchMenuOpened] featureId: " + featureId + ", menu: " + menu);
|
||||||
|
|
||||||
if (featureId == Window.FEATURE_ACTION_BAR || featureId == Window.FEATURE_OPTIONS_PANEL) {
|
if (featureId == Window.FEATURE_ACTION_BAR || featureId == Window.FEATURE_OPTIONS_PANEL) {
|
||||||
if (aActionBar != null) {
|
if (aActionBar != null) {
|
||||||
@ -373,7 +366,7 @@ public class ActionBarSherlockCompat extends ActionBarSherlock implements MenuBu
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void dispatchPanelClosed(int featureId, android.view.Menu menu){
|
public void dispatchPanelClosed(int featureId, android.view.Menu menu){
|
||||||
if (DEBUG) Log.d(TAG, "[dispatchPanelClosed] featureId: " + featureId + ", menu: " + menu);
|
if (ActionBarSherlock.DEBUG) Log.d(TAG, "[dispatchPanelClosed] featureId: " + featureId + ", menu: " + menu);
|
||||||
|
|
||||||
if (featureId == Window.FEATURE_ACTION_BAR || featureId == Window.FEATURE_OPTIONS_PANEL) {
|
if (featureId == Window.FEATURE_ACTION_BAR || featureId == Window.FEATURE_OPTIONS_PANEL) {
|
||||||
if (aActionBar != null) {
|
if (aActionBar != null) {
|
||||||
@ -384,22 +377,16 @@ public class ActionBarSherlockCompat extends ActionBarSherlock implements MenuBu
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void dispatchTitleChanged(CharSequence title, int color) {
|
public void dispatchTitleChanged(CharSequence title, int color) {
|
||||||
if (DEBUG) Log.d(TAG, "[dispatchTitleChanged] title: " + title + ", color: " + color);
|
if (ActionBarSherlock.DEBUG) Log.d(TAG, "[dispatchTitleChanged] title: " + title + ", color: " + color);
|
||||||
|
|
||||||
if (!mIsDelegate || mIsTitleReady) {
|
if ((!mIsDelegate || mIsTitleReady) && (wActionBar != null)) {
|
||||||
if (mTitleView != null) {
|
|
||||||
mTitleView.setText(title);
|
|
||||||
} else if (wActionBar != null) {
|
|
||||||
wActionBar.setWindowTitle(title);
|
wActionBar.setWindowTitle(title);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mTitle = title;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean dispatchKeyEvent(KeyEvent event) {
|
public boolean dispatchKeyEvent(KeyEvent event) {
|
||||||
if (DEBUG) Log.d(TAG, "[dispatchKeyEvent] event: " + event);
|
if (ActionBarSherlock.DEBUG) Log.d(TAG, "[dispatchKeyEvent] event: " + event);
|
||||||
|
|
||||||
final int keyCode = event.getKeyCode();
|
final int keyCode = event.getKeyCode();
|
||||||
|
|
||||||
@ -412,7 +399,7 @@ public class ActionBarSherlockCompat extends ActionBarSherlock implements MenuBu
|
|||||||
if (action == KeyEvent.ACTION_UP) {
|
if (action == KeyEvent.ACTION_UP) {
|
||||||
mActionMode.finish();
|
mActionMode.finish();
|
||||||
}
|
}
|
||||||
if (DEBUG) Log.d(TAG, "[dispatchKeyEvent] returning true");
|
if (ActionBarSherlock.DEBUG) Log.d(TAG, "[dispatchKeyEvent] returning true");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -421,12 +408,12 @@ public class ActionBarSherlockCompat extends ActionBarSherlock implements MenuBu
|
|||||||
if (action == KeyEvent.ACTION_UP) {
|
if (action == KeyEvent.ACTION_UP) {
|
||||||
wActionBar.collapseActionView();
|
wActionBar.collapseActionView();
|
||||||
}
|
}
|
||||||
if (DEBUG) Log.d(TAG, "[dispatchKeyEvent] returning true");
|
if (ActionBarSherlock.DEBUG) Log.d(TAG, "[dispatchKeyEvent] returning true");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DEBUG) Log.d(TAG, "[dispatchKeyEvent] returning false");
|
if (ActionBarSherlock.DEBUG) Log.d(TAG, "[dispatchKeyEvent] returning false");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -596,7 +583,7 @@ public class ActionBarSherlockCompat extends ActionBarSherlock implements MenuBu
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onMenuItemClick(android.view.MenuItem item) {
|
public boolean onMenuItemClick(android.view.MenuItem item) {
|
||||||
if (DEBUG) Log.d(TAG, "[mNativeItemListener.onMenuItemClick] item: " + item);
|
if (ActionBarSherlock.DEBUG) Log.d(TAG, "[mNativeItemListener.onMenuItemClick] item: " + item);
|
||||||
|
|
||||||
final MenuItemImpl sherlockItem = mNativeItemMap.get(item);
|
final MenuItemImpl sherlockItem = mNativeItemMap.get(item);
|
||||||
if (sherlockItem != null) {
|
if (sherlockItem != null) {
|
||||||
@ -620,7 +607,7 @@ public class ActionBarSherlockCompat extends ActionBarSherlock implements MenuBu
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setProgressBarVisibility(boolean visible) {
|
public void setProgressBarVisibility(boolean visible) {
|
||||||
if (DEBUG) Log.d(TAG, "[setProgressBarVisibility] visible: " + visible);
|
if (ActionBarSherlock.DEBUG) Log.d(TAG, "[setProgressBarVisibility] visible: " + visible);
|
||||||
|
|
||||||
setFeatureInt(Window.FEATURE_PROGRESS, visible ? Window.PROGRESS_VISIBILITY_ON :
|
setFeatureInt(Window.FEATURE_PROGRESS, visible ? Window.PROGRESS_VISIBILITY_ON :
|
||||||
Window.PROGRESS_VISIBILITY_OFF);
|
Window.PROGRESS_VISIBILITY_OFF);
|
||||||
@ -628,7 +615,7 @@ public class ActionBarSherlockCompat extends ActionBarSherlock implements MenuBu
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setProgressBarIndeterminateVisibility(boolean visible) {
|
public void setProgressBarIndeterminateVisibility(boolean visible) {
|
||||||
if (DEBUG) Log.d(TAG, "[setProgressBarIndeterminateVisibility] visible: " + visible);
|
if (ActionBarSherlock.DEBUG) Log.d(TAG, "[setProgressBarIndeterminateVisibility] visible: " + visible);
|
||||||
|
|
||||||
setFeatureInt(Window.FEATURE_INDETERMINATE_PROGRESS,
|
setFeatureInt(Window.FEATURE_INDETERMINATE_PROGRESS,
|
||||||
visible ? Window.PROGRESS_VISIBILITY_ON : Window.PROGRESS_VISIBILITY_OFF);
|
visible ? Window.PROGRESS_VISIBILITY_ON : Window.PROGRESS_VISIBILITY_OFF);
|
||||||
@ -636,7 +623,7 @@ public class ActionBarSherlockCompat extends ActionBarSherlock implements MenuBu
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setProgressBarIndeterminate(boolean indeterminate) {
|
public void setProgressBarIndeterminate(boolean indeterminate) {
|
||||||
if (DEBUG) Log.d(TAG, "[setProgressBarIndeterminate] indeterminate: " + indeterminate);
|
if (ActionBarSherlock.DEBUG) Log.d(TAG, "[setProgressBarIndeterminate] indeterminate: " + indeterminate);
|
||||||
|
|
||||||
setFeatureInt(Window.FEATURE_PROGRESS,
|
setFeatureInt(Window.FEATURE_PROGRESS,
|
||||||
indeterminate ? Window.PROGRESS_INDETERMINATE_ON : Window.PROGRESS_INDETERMINATE_OFF);
|
indeterminate ? Window.PROGRESS_INDETERMINATE_ON : Window.PROGRESS_INDETERMINATE_OFF);
|
||||||
@ -644,14 +631,14 @@ public class ActionBarSherlockCompat extends ActionBarSherlock implements MenuBu
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setProgress(int progress) {
|
public void setProgress(int progress) {
|
||||||
if (DEBUG) Log.d(TAG, "[setProgress] progress: " + progress);
|
if (ActionBarSherlock.DEBUG) Log.d(TAG, "[setProgress] progress: " + progress);
|
||||||
|
|
||||||
setFeatureInt(Window.FEATURE_PROGRESS, progress + Window.PROGRESS_START);
|
setFeatureInt(Window.FEATURE_PROGRESS, progress + Window.PROGRESS_START);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setSecondaryProgress(int secondaryProgress) {
|
public void setSecondaryProgress(int secondaryProgress) {
|
||||||
if (DEBUG) Log.d(TAG, "[setSecondaryProgress] secondaryProgress: " + secondaryProgress);
|
if (ActionBarSherlock.DEBUG) Log.d(TAG, "[setSecondaryProgress] secondaryProgress: " + secondaryProgress);
|
||||||
|
|
||||||
setFeatureInt(Window.FEATURE_PROGRESS,
|
setFeatureInt(Window.FEATURE_PROGRESS,
|
||||||
secondaryProgress + Window.PROGRESS_SECONDARY_START);
|
secondaryProgress + Window.PROGRESS_SECONDARY_START);
|
||||||
@ -790,23 +777,23 @@ public class ActionBarSherlockCompat extends ActionBarSherlock implements MenuBu
|
|||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
private int getFeatures() {
|
private int getFeatures() {
|
||||||
if (DEBUG) Log.d(TAG, "[getFeatures] returning " + mFeatures);
|
if (ActionBarSherlock.DEBUG) Log.d(TAG, "[getFeatures] returning " + mFeatures);
|
||||||
|
|
||||||
return mFeatures;
|
return mFeatures;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasFeature(int featureId) {
|
public boolean hasFeature(int featureId) {
|
||||||
if (DEBUG) Log.d(TAG, "[hasFeature] featureId: " + featureId);
|
if (ActionBarSherlock.DEBUG) Log.d(TAG, "[hasFeature] featureId: " + featureId);
|
||||||
|
|
||||||
boolean result = (mFeatures & (1 << featureId)) != 0;
|
boolean result = (mFeatures & (1 << featureId)) != 0;
|
||||||
if (DEBUG) Log.d(TAG, "[hasFeature] returning " + result);
|
if (ActionBarSherlock.DEBUG) Log.d(TAG, "[hasFeature] returning " + result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean requestFeature(int featureId) {
|
public boolean requestFeature(int featureId) {
|
||||||
if (DEBUG) Log.d(TAG, "[requestFeature] featureId: " + featureId);
|
if (ActionBarSherlock.DEBUG) Log.d(TAG, "[requestFeature] featureId: " + featureId);
|
||||||
|
|
||||||
if (mContentParent != null) {
|
if (mContentParent != null) {
|
||||||
throw new AndroidRuntimeException("requestFeature() must be called before adding content");
|
throw new AndroidRuntimeException("requestFeature() must be called before adding content");
|
||||||
@ -829,21 +816,21 @@ public class ActionBarSherlockCompat extends ActionBarSherlock implements MenuBu
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setUiOptions(int uiOptions) {
|
public void setUiOptions(int uiOptions) {
|
||||||
if (DEBUG) Log.d(TAG, "[setUiOptions] uiOptions: " + uiOptions);
|
if (ActionBarSherlock.DEBUG) Log.d(TAG, "[setUiOptions] uiOptions: " + uiOptions);
|
||||||
|
|
||||||
mUiOptions = uiOptions;
|
mUiOptions = uiOptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setUiOptions(int uiOptions, int mask) {
|
public void setUiOptions(int uiOptions, int mask) {
|
||||||
if (DEBUG) Log.d(TAG, "[setUiOptions] uiOptions: " + uiOptions + ", mask: " + mask);
|
if (ActionBarSherlock.DEBUG) Log.d(TAG, "[setUiOptions] uiOptions: " + uiOptions + ", mask: " + mask);
|
||||||
|
|
||||||
mUiOptions = (mUiOptions & ~mask) | (uiOptions & mask);
|
mUiOptions = (mUiOptions & ~mask) | (uiOptions & mask);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setContentView(int layoutResId) {
|
public void setContentView(int layoutResId) {
|
||||||
if (DEBUG) Log.d(TAG, "[setContentView] layoutResId: " + layoutResId);
|
if (ActionBarSherlock.DEBUG) Log.d(TAG, "[setContentView] layoutResId: " + layoutResId);
|
||||||
|
|
||||||
if (mContentParent == null) {
|
if (mContentParent == null) {
|
||||||
installDecor();
|
installDecor();
|
||||||
@ -862,7 +849,7 @@ public class ActionBarSherlockCompat extends ActionBarSherlock implements MenuBu
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setContentView(View view, ViewGroup.LayoutParams params) {
|
public void setContentView(View view, ViewGroup.LayoutParams params) {
|
||||||
if (DEBUG) Log.d(TAG, "[setContentView] view: " + view + ", params: " + params);
|
if (ActionBarSherlock.DEBUG) Log.d(TAG, "[setContentView] view: " + view + ", params: " + params);
|
||||||
|
|
||||||
if (mContentParent == null) {
|
if (mContentParent == null) {
|
||||||
installDecor();
|
installDecor();
|
||||||
@ -881,7 +868,7 @@ public class ActionBarSherlockCompat extends ActionBarSherlock implements MenuBu
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addContentView(View view, ViewGroup.LayoutParams params) {
|
public void addContentView(View view, ViewGroup.LayoutParams params) {
|
||||||
if (DEBUG) Log.d(TAG, "[addContentView] view: " + view + ", params: " + params);
|
if (ActionBarSherlock.DEBUG) Log.d(TAG, "[addContentView] view: " + view + ", params: " + params);
|
||||||
|
|
||||||
if (mContentParent == null) {
|
if (mContentParent == null) {
|
||||||
installDecor();
|
installDecor();
|
||||||
@ -892,7 +879,7 @@ public class ActionBarSherlockCompat extends ActionBarSherlock implements MenuBu
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void installDecor() {
|
private void installDecor() {
|
||||||
if (DEBUG) Log.d(TAG, "[installDecor]");
|
if (ActionBarSherlock.DEBUG) Log.d(TAG, "[installDecor]");
|
||||||
|
|
||||||
if (mDecor == null) {
|
if (mDecor == null) {
|
||||||
mDecor = (ViewGroup)mActivity.getWindow().getDecorView().findViewById(android.R.id.content);
|
mDecor = (ViewGroup)mActivity.getWindow().getDecorView().findViewById(android.R.id.content);
|
||||||
@ -921,17 +908,6 @@ public class ActionBarSherlockCompat extends ActionBarSherlock implements MenuBu
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mTitleView = (TextView)mDecor.findViewById(android.R.id.title);
|
|
||||||
if (mTitleView != null) {
|
|
||||||
if (hasFeature(Window.FEATURE_NO_TITLE)) {
|
|
||||||
mTitleView.setVisibility(View.GONE);
|
|
||||||
if (mContentParent instanceof FrameLayout) {
|
|
||||||
((FrameLayout)mContentParent).setForeground(null);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
mTitleView.setText(mTitle);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
wActionBar = (ActionBarView)mDecor.findViewById(R.id.abs__action_bar);
|
wActionBar = (ActionBarView)mDecor.findViewById(R.id.abs__action_bar);
|
||||||
if (wActionBar != null) {
|
if (wActionBar != null) {
|
||||||
wActionBar.setWindowCallback(this);
|
wActionBar.setWindowCallback(this);
|
||||||
@ -988,17 +964,14 @@ public class ActionBarSherlockCompat extends ActionBarSherlock implements MenuBu
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private ViewGroup generateLayout() {
|
private ViewGroup generateLayout() {
|
||||||
if (DEBUG) Log.d(TAG, "[generateLayout]");
|
if (ActionBarSherlock.DEBUG) Log.d(TAG, "[generateLayout]");
|
||||||
|
|
||||||
// Apply data from current theme.
|
// Apply data from current theme.
|
||||||
|
|
||||||
TypedArray a = mActivity.getTheme().obtainStyledAttributes(R.styleable.SherlockTheme);
|
TypedArray a = mActivity.getTheme().obtainStyledAttributes(R.styleable.SherlockTheme);
|
||||||
|
|
||||||
mIsFloating = a.getBoolean(R.styleable.SherlockTheme_android_windowIsFloating, false);
|
|
||||||
|
|
||||||
if (!a.hasValue(R.styleable.SherlockTheme_windowActionBar)) {
|
if (!a.hasValue(R.styleable.SherlockTheme_windowActionBar)) {
|
||||||
throw new IllegalStateException("You must use Theme.Sherlock, Theme.Sherlock.Light, Theme.Sherlock.Light.DarkActionBar, or a derivative.");
|
throw new IllegalStateException("You must use Theme.Sherlock, Theme.Sherlock.Light, Theme.Sherlock.Light.DarkActionBar, or a derivative.");
|
||||||
}
|
}
|
||||||
@ -1022,26 +995,18 @@ public class ActionBarSherlockCompat extends ActionBarSherlock implements MenuBu
|
|||||||
|
|
||||||
int layoutResource;
|
int layoutResource;
|
||||||
if (!hasFeature(Window.FEATURE_NO_TITLE)) {
|
if (!hasFeature(Window.FEATURE_NO_TITLE)) {
|
||||||
if (mIsFloating) {
|
|
||||||
//Trash original dialog LinearLayout
|
|
||||||
mDecor = (ViewGroup)mDecor.getParent();
|
|
||||||
mDecor.removeAllViews();
|
|
||||||
|
|
||||||
layoutResource = R.layout.abs__dialog_title_holo;
|
|
||||||
} else {
|
|
||||||
if (hasFeature(Window.FEATURE_ACTION_BAR_OVERLAY)) {
|
if (hasFeature(Window.FEATURE_ACTION_BAR_OVERLAY)) {
|
||||||
layoutResource = R.layout.abs__screen_action_bar_overlay;
|
layoutResource = R.layout.abs__screen_action_bar_overlay;
|
||||||
} else {
|
} else {
|
||||||
layoutResource = R.layout.abs__screen_action_bar;
|
layoutResource = R.layout.abs__screen_action_bar;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} else if (hasFeature(Window.FEATURE_ACTION_MODE_OVERLAY) && !hasFeature(Window.FEATURE_NO_TITLE)) {
|
} else if (hasFeature(Window.FEATURE_ACTION_MODE_OVERLAY) && !hasFeature(Window.FEATURE_NO_TITLE)) {
|
||||||
layoutResource = R.layout.abs__screen_simple_overlay_action_mode;
|
layoutResource = R.layout.abs__screen_simple_overlay_action_mode;
|
||||||
} else {
|
} else {
|
||||||
layoutResource = R.layout.abs__screen_simple;
|
layoutResource = R.layout.abs__screen_simple;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DEBUG) Log.d(TAG, "[generateLayout] using screen XML " + mActivity.getResources().getString(layoutResource));
|
if (ActionBarSherlock.DEBUG) Log.d(TAG, "[generateLayout] using screen XML " + mActivity.getResources().getString(layoutResource));
|
||||||
View in = mActivity.getLayoutInflater().inflate(layoutResource, null);
|
View in = mActivity.getLayoutInflater().inflate(layoutResource, null);
|
||||||
mDecor.addView(in, new ViewGroup.LayoutParams(MATCH_PARENT, MATCH_PARENT));
|
mDecor.addView(in, new ViewGroup.LayoutParams(MATCH_PARENT, MATCH_PARENT));
|
||||||
|
|
||||||
@ -1086,7 +1051,7 @@ public class ActionBarSherlockCompat extends ActionBarSherlock implements MenuBu
|
|||||||
int uiOptions = 0;
|
int uiOptions = 0;
|
||||||
try {
|
try {
|
||||||
final String thisPackage = activity.getClass().getName();
|
final String thisPackage = activity.getClass().getName();
|
||||||
if (DEBUG) Log.i(TAG, "Parsing AndroidManifest.xml for " + thisPackage);
|
if (ActionBarSherlock.DEBUG) Log.i(TAG, "Parsing AndroidManifest.xml for " + thisPackage);
|
||||||
|
|
||||||
final String packageName = activity.getApplicationInfo().packageName;
|
final String packageName = activity.getApplicationInfo().packageName;
|
||||||
final AssetManager am = activity.createPackageContext(packageName, 0).getAssets();
|
final AssetManager am = activity.createPackageContext(packageName, 0).getAssets();
|
||||||
@ -1099,10 +1064,10 @@ public class ActionBarSherlockCompat extends ActionBarSherlock implements MenuBu
|
|||||||
|
|
||||||
if ("application".equals(name)) {
|
if ("application".equals(name)) {
|
||||||
//Check if the <application> has the attribute
|
//Check if the <application> has the attribute
|
||||||
if (DEBUG) Log.d(TAG, "Got <application>");
|
if (ActionBarSherlock.DEBUG) Log.d(TAG, "Got <application>");
|
||||||
|
|
||||||
for (int i = xml.getAttributeCount() - 1; i >= 0; i--) {
|
for (int i = xml.getAttributeCount() - 1; i >= 0; i--) {
|
||||||
if (DEBUG) Log.d(TAG, xml.getAttributeName(i) + ": " + xml.getAttributeValue(i));
|
if (ActionBarSherlock.DEBUG) Log.d(TAG, xml.getAttributeName(i) + ": " + xml.getAttributeValue(i));
|
||||||
|
|
||||||
if ("uiOptions".equals(xml.getAttributeName(i))) {
|
if ("uiOptions".equals(xml.getAttributeName(i))) {
|
||||||
uiOptions = xml.getAttributeIntValue(i, 0);
|
uiOptions = xml.getAttributeIntValue(i, 0);
|
||||||
@ -1111,13 +1076,13 @@ public class ActionBarSherlockCompat extends ActionBarSherlock implements MenuBu
|
|||||||
}
|
}
|
||||||
} else if ("activity".equals(name)) {
|
} else if ("activity".equals(name)) {
|
||||||
//Check if the <activity> is us and has the attribute
|
//Check if the <activity> is us and has the attribute
|
||||||
if (DEBUG) Log.d(TAG, "Got <activity>");
|
if (ActionBarSherlock.DEBUG) Log.d(TAG, "Got <activity>");
|
||||||
Integer activityUiOptions = null;
|
Integer activityUiOptions = null;
|
||||||
String activityPackage = null;
|
String activityPackage = null;
|
||||||
boolean isOurActivity = false;
|
boolean isOurActivity = false;
|
||||||
|
|
||||||
for (int i = xml.getAttributeCount() - 1; i >= 0; i--) {
|
for (int i = xml.getAttributeCount() - 1; i >= 0; i--) {
|
||||||
if (DEBUG) Log.d(TAG, xml.getAttributeName(i) + ": " + xml.getAttributeValue(i));
|
if (ActionBarSherlock.DEBUG) Log.d(TAG, xml.getAttributeName(i) + ": " + xml.getAttributeValue(i));
|
||||||
|
|
||||||
//We need both uiOptions and name attributes
|
//We need both uiOptions and name attributes
|
||||||
String attrName = xml.getAttributeName(i);
|
String attrName = xml.getAttributeName(i);
|
||||||
@ -1149,7 +1114,7 @@ public class ActionBarSherlockCompat extends ActionBarSherlock implements MenuBu
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
if (DEBUG) Log.i(TAG, "Returning " + Integer.toHexString(uiOptions));
|
if (ActionBarSherlock.DEBUG) Log.i(TAG, "Returning " + Integer.toHexString(uiOptions));
|
||||||
return uiOptions;
|
return uiOptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1200,4 +1165,13 @@ public class ActionBarSherlockCompat extends ActionBarSherlock implements MenuBu
|
|||||||
mActionMode = null;
|
mActionMode = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void ensureActionBar() {
|
||||||
|
if (ActionBarSherlock.DEBUG) Log.d(TAG, "[ensureActionBar]");
|
||||||
|
|
||||||
|
if (mDecor == null) {
|
||||||
|
initActionBar();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,19 +1,21 @@
|
|||||||
package com.actionbarsherlock.internal;
|
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.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.util.TypedValue;
|
import android.util.TypedValue;
|
||||||
import android.view.ContextThemeWrapper;
|
import android.view.ContextThemeWrapper;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.Window;
|
|
||||||
import android.view.ViewGroup.LayoutParams;
|
import android.view.ViewGroup.LayoutParams;
|
||||||
|
import android.view.Window;
|
||||||
|
import com.actionbarsherlock.ActionBarSherlock;
|
||||||
|
import com.actionbarsherlock.app.ActionBar;
|
||||||
|
import com.actionbarsherlock.internal.app.ActionBarWrapper;
|
||||||
|
import com.actionbarsherlock.internal.view.menu.MenuItemWrapper;
|
||||||
|
import com.actionbarsherlock.internal.view.menu.MenuWrapper;
|
||||||
|
import com.actionbarsherlock.view.ActionMode;
|
||||||
|
import com.actionbarsherlock.view.MenuInflater;
|
||||||
|
import com.actionbarsherlock.view.MenuItem;
|
||||||
|
|
||||||
@ActionBarSherlock.Implementation(api = 14)
|
@ActionBarSherlock.Implementation(api = 14)
|
||||||
public class ActionBarSherlockNative extends ActionBarSherlock {
|
public class ActionBarSherlockNative extends ActionBarSherlock {
|
||||||
@ -28,7 +30,7 @@ public class ActionBarSherlockNative extends ActionBarSherlock {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ActionBar getActionBar() {
|
public ActionBar getActionBar() {
|
||||||
if (DEBUG) Log.d(TAG, "[getActionBar]");
|
if (ActionBarSherlock.DEBUG) Log.d(TAG, "[getActionBar]");
|
||||||
|
|
||||||
initActionBar();
|
initActionBar();
|
||||||
return mActionBar;
|
return mActionBar;
|
||||||
@ -44,77 +46,89 @@ public class ActionBarSherlockNative extends ActionBarSherlock {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void dispatchInvalidateOptionsMenu() {
|
public void dispatchInvalidateOptionsMenu() {
|
||||||
if (DEBUG) Log.d(TAG, "[dispatchInvalidateOptionsMenu]");
|
if (ActionBarSherlock.DEBUG) Log.d(TAG, "[dispatchInvalidateOptionsMenu]");
|
||||||
|
|
||||||
mActivity.getWindow().invalidatePanelMenu(Window.FEATURE_OPTIONS_PANEL);
|
mActivity.getWindow().invalidatePanelMenu(Window.FEATURE_OPTIONS_PANEL);
|
||||||
|
|
||||||
|
if (mMenu != null) mMenu.invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean dispatchCreateOptionsMenu(android.view.Menu menu) {
|
public boolean dispatchCreateOptionsMenu(android.view.Menu menu) {
|
||||||
if (DEBUG) Log.d(TAG, "[dispatchCreateOptionsMenu] menu: " + menu);
|
if (ActionBarSherlock.DEBUG) Log.d(TAG, "[dispatchCreateOptionsMenu] menu: " + menu);
|
||||||
|
|
||||||
if (mMenu == null || menu != mMenu.unwrap()) {
|
if (mMenu == null || menu != mMenu.unwrap()) {
|
||||||
mMenu = new MenuWrapper(menu);
|
mMenu = new MenuWrapper(menu);
|
||||||
}
|
}
|
||||||
|
|
||||||
final boolean result = callbackCreateOptionsMenu(mMenu);
|
final boolean result = callbackCreateOptionsMenu(mMenu);
|
||||||
if (DEBUG) Log.d(TAG, "[dispatchCreateOptionsMenu] returning " + result);
|
if (ActionBarSherlock.DEBUG) Log.d(TAG, "[dispatchCreateOptionsMenu] returning " + result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean dispatchPrepareOptionsMenu(android.view.Menu menu) {
|
public boolean dispatchPrepareOptionsMenu(android.view.Menu menu) {
|
||||||
if (DEBUG) Log.d(TAG, "[dispatchPrepareOptionsMenu] menu: " + menu);
|
if (ActionBarSherlock.DEBUG) Log.d(TAG, "[dispatchPrepareOptionsMenu] menu: " + menu);
|
||||||
|
|
||||||
final boolean result = callbackPrepareOptionsMenu(mMenu);
|
final boolean result = callbackPrepareOptionsMenu(mMenu);
|
||||||
if (DEBUG) Log.d(TAG, "[dispatchPrepareOptionsMenu] returning " + result);
|
if (ActionBarSherlock.DEBUG) Log.d(TAG, "[dispatchPrepareOptionsMenu] returning " + result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean dispatchOptionsItemSelected(android.view.MenuItem item) {
|
public boolean dispatchOptionsItemSelected(android.view.MenuItem item) {
|
||||||
if (DEBUG) Log.d(TAG, "[dispatchOptionsItemSelected] item: " + item.getTitleCondensed());
|
if (ActionBarSherlock.DEBUG) Log.d(TAG, "[dispatchOptionsItemSelected] item: " + item.getTitleCondensed());
|
||||||
|
|
||||||
final boolean result = callbackOptionsItemSelected(mMenu.findItem(item));
|
MenuItem wrapped;
|
||||||
if (DEBUG) Log.d(TAG, "[dispatchOptionsItemSelected] returning " + result);
|
if (mMenu == null) {
|
||||||
|
if (item.getItemId() != android.R.id.home) {
|
||||||
|
throw new IllegalStateException("Non-home action item clicked before onCreateOptionsMenu with ID " + item.getItemId());
|
||||||
|
}
|
||||||
|
// Create a throw-away wrapper for now.
|
||||||
|
wrapped = new MenuItemWrapper(item);
|
||||||
|
} else {
|
||||||
|
wrapped = mMenu.findItem(item);
|
||||||
|
}
|
||||||
|
final boolean result = callbackOptionsItemSelected(wrapped);
|
||||||
|
if (ActionBarSherlock.DEBUG) Log.d(TAG, "[dispatchOptionsItemSelected] returning " + result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasFeature(int feature) {
|
public boolean hasFeature(int feature) {
|
||||||
if (DEBUG) Log.d(TAG, "[hasFeature] feature: " + feature);
|
if (ActionBarSherlock.DEBUG) Log.d(TAG, "[hasFeature] feature: " + feature);
|
||||||
|
|
||||||
final boolean result = mActivity.getWindow().hasFeature(feature);
|
final boolean result = mActivity.getWindow().hasFeature(feature);
|
||||||
if (DEBUG) Log.d(TAG, "[hasFeature] returning " + result);
|
if (ActionBarSherlock.DEBUG) Log.d(TAG, "[hasFeature] returning " + result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean requestFeature(int featureId) {
|
public boolean requestFeature(int featureId) {
|
||||||
if (DEBUG) Log.d(TAG, "[requestFeature] featureId: " + featureId);
|
if (ActionBarSherlock.DEBUG) Log.d(TAG, "[requestFeature] featureId: " + featureId);
|
||||||
|
|
||||||
final boolean result = mActivity.getWindow().requestFeature(featureId);
|
final boolean result = mActivity.getWindow().requestFeature(featureId);
|
||||||
if (DEBUG) Log.d(TAG, "[requestFeature] returning " + result);
|
if (ActionBarSherlock.DEBUG) Log.d(TAG, "[requestFeature] returning " + result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setUiOptions(int uiOptions) {
|
public void setUiOptions(int uiOptions) {
|
||||||
if (DEBUG) Log.d(TAG, "[setUiOptions] uiOptions: " + uiOptions);
|
if (ActionBarSherlock.DEBUG) Log.d(TAG, "[setUiOptions] uiOptions: " + uiOptions);
|
||||||
|
|
||||||
mActivity.getWindow().setUiOptions(uiOptions);
|
mActivity.getWindow().setUiOptions(uiOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setUiOptions(int uiOptions, int mask) {
|
public void setUiOptions(int uiOptions, int mask) {
|
||||||
if (DEBUG) Log.d(TAG, "[setUiOptions] uiOptions: " + uiOptions + ", mask: " + mask);
|
if (ActionBarSherlock.DEBUG) Log.d(TAG, "[setUiOptions] uiOptions: " + uiOptions + ", mask: " + mask);
|
||||||
|
|
||||||
mActivity.getWindow().setUiOptions(uiOptions, mask);
|
mActivity.getWindow().setUiOptions(uiOptions, mask);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setContentView(int layoutResId) {
|
public void setContentView(int layoutResId) {
|
||||||
if (DEBUG) Log.d(TAG, "[setContentView] layoutResId: " + layoutResId);
|
if (ActionBarSherlock.DEBUG) Log.d(TAG, "[setContentView] layoutResId: " + layoutResId);
|
||||||
|
|
||||||
mActivity.getWindow().setContentView(layoutResId);
|
mActivity.getWindow().setContentView(layoutResId);
|
||||||
initActionBar();
|
initActionBar();
|
||||||
@ -122,7 +136,7 @@ public class ActionBarSherlockNative extends ActionBarSherlock {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setContentView(View view, LayoutParams params) {
|
public void setContentView(View view, LayoutParams params) {
|
||||||
if (DEBUG) Log.d(TAG, "[setContentView] view: " + view + ", params: " + params);
|
if (ActionBarSherlock.DEBUG) Log.d(TAG, "[setContentView] view: " + view + ", params: " + params);
|
||||||
|
|
||||||
mActivity.getWindow().setContentView(view, params);
|
mActivity.getWindow().setContentView(view, params);
|
||||||
initActionBar();
|
initActionBar();
|
||||||
@ -130,7 +144,7 @@ public class ActionBarSherlockNative extends ActionBarSherlock {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addContentView(View view, LayoutParams params) {
|
public void addContentView(View view, LayoutParams params) {
|
||||||
if (DEBUG) Log.d(TAG, "[addContentView] view: " + view + ", params: " + params);
|
if (ActionBarSherlock.DEBUG) Log.d(TAG, "[addContentView] view: " + view + ", params: " + params);
|
||||||
|
|
||||||
mActivity.getWindow().addContentView(view, params);
|
mActivity.getWindow().addContentView(view, params);
|
||||||
initActionBar();
|
initActionBar();
|
||||||
@ -138,42 +152,42 @@ public class ActionBarSherlockNative extends ActionBarSherlock {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setTitle(CharSequence title) {
|
public void setTitle(CharSequence title) {
|
||||||
if (DEBUG) Log.d(TAG, "[setTitle] title: " + title);
|
if (ActionBarSherlock.DEBUG) Log.d(TAG, "[setTitle] title: " + title);
|
||||||
|
|
||||||
mActivity.getWindow().setTitle(title);
|
mActivity.getWindow().setTitle(title);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setProgressBarVisibility(boolean visible) {
|
public void setProgressBarVisibility(boolean visible) {
|
||||||
if (DEBUG) Log.d(TAG, "[setProgressBarVisibility] visible: " + visible);
|
if (ActionBarSherlock.DEBUG) Log.d(TAG, "[setProgressBarVisibility] visible: " + visible);
|
||||||
|
|
||||||
mActivity.setProgressBarVisibility(visible);
|
mActivity.setProgressBarVisibility(visible);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setProgressBarIndeterminateVisibility(boolean visible) {
|
public void setProgressBarIndeterminateVisibility(boolean visible) {
|
||||||
if (DEBUG) Log.d(TAG, "[setProgressBarIndeterminateVisibility] visible: " + visible);
|
if (ActionBarSherlock.DEBUG) Log.d(TAG, "[setProgressBarIndeterminateVisibility] visible: " + visible);
|
||||||
|
|
||||||
mActivity.setProgressBarIndeterminateVisibility(visible);
|
mActivity.setProgressBarIndeterminateVisibility(visible);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setProgressBarIndeterminate(boolean indeterminate) {
|
public void setProgressBarIndeterminate(boolean indeterminate) {
|
||||||
if (DEBUG) Log.d(TAG, "[setProgressBarIndeterminate] indeterminate: " + indeterminate);
|
if (ActionBarSherlock.DEBUG) Log.d(TAG, "[setProgressBarIndeterminate] indeterminate: " + indeterminate);
|
||||||
|
|
||||||
mActivity.setProgressBarIndeterminate(indeterminate);
|
mActivity.setProgressBarIndeterminate(indeterminate);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setProgress(int progress) {
|
public void setProgress(int progress) {
|
||||||
if (DEBUG) Log.d(TAG, "[setProgress] progress: " + progress);
|
if (ActionBarSherlock.DEBUG) Log.d(TAG, "[setProgress] progress: " + progress);
|
||||||
|
|
||||||
mActivity.setProgress(progress);
|
mActivity.setProgress(progress);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setSecondaryProgress(int secondaryProgress) {
|
public void setSecondaryProgress(int secondaryProgress) {
|
||||||
if (DEBUG) Log.d(TAG, "[setSecondaryProgress] secondaryProgress: " + secondaryProgress);
|
if (ActionBarSherlock.DEBUG) Log.d(TAG, "[setSecondaryProgress] secondaryProgress: " + secondaryProgress);
|
||||||
|
|
||||||
mActivity.setSecondaryProgress(secondaryProgress);
|
mActivity.setSecondaryProgress(secondaryProgress);
|
||||||
}
|
}
|
||||||
@ -194,7 +208,7 @@ public class ActionBarSherlockNative extends ActionBarSherlock {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ActionMode startActionMode(com.actionbarsherlock.view.ActionMode.Callback callback) {
|
public ActionMode startActionMode(com.actionbarsherlock.view.ActionMode.Callback callback) {
|
||||||
if (DEBUG) Log.d(TAG, "[startActionMode] callback: " + callback);
|
if (ActionBarSherlock.DEBUG) Log.d(TAG, "[startActionMode] callback: " + callback);
|
||||||
|
|
||||||
if (mActionMode != null) {
|
if (mActionMode != null) {
|
||||||
mActionMode.finish();
|
mActionMode.finish();
|
||||||
@ -288,6 +302,7 @@ public class ActionBarSherlockNative extends ActionBarSherlock {
|
|||||||
@Override
|
@Override
|
||||||
public void invalidate() {
|
public void invalidate() {
|
||||||
mActionMode.invalidate();
|
mActionMode.invalidate();
|
||||||
|
if (mMenu != null) mMenu.invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,11 +1,19 @@
|
|||||||
package com.actionbarsherlock.internal;
|
package com.actionbarsherlock.internal;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.res.AssetManager;
|
||||||
|
import android.content.res.XmlResourceParser;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.util.DisplayMetrics;
|
import android.util.DisplayMetrics;
|
||||||
|
import android.util.Log;
|
||||||
|
import com.actionbarsherlock.ActionBarSherlock;
|
||||||
import com.actionbarsherlock.R;
|
import com.actionbarsherlock.R;
|
||||||
|
import org.xmlpull.v1.XmlPullParser;
|
||||||
|
|
||||||
public final class ResourcesCompat {
|
public final class ResourcesCompat {
|
||||||
|
private static final String TAG = "ResourcesCompat";
|
||||||
|
|
||||||
//No instances
|
//No instances
|
||||||
private ResourcesCompat() {}
|
private ResourcesCompat() {}
|
||||||
|
|
||||||
@ -15,14 +23,14 @@ public final class ResourcesCompat {
|
|||||||
* can use to simulate filtering based on width and smallest width
|
* can use to simulate filtering based on width and smallest width
|
||||||
* qualifiers on pre-3.2.
|
* qualifiers on pre-3.2.
|
||||||
*
|
*
|
||||||
* @param context Context to load booleans from on 3.2+ and to fetch the
|
* @param context Context to load booleans from on 4.0+ and to fetch the
|
||||||
* display metrics.
|
* display metrics.
|
||||||
* @param id Id of boolean to load.
|
* @param id Id of boolean to load.
|
||||||
* @return Associated boolean value as reflected by the current display
|
* @return Associated boolean value as reflected by the current display
|
||||||
* metrics.
|
* metrics.
|
||||||
*/
|
*/
|
||||||
public static boolean getResources_getBoolean(Context context, int id) {
|
public static boolean getResources_getBoolean(Context context, int id) {
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
|
||||||
return context.getResources().getBoolean(id);
|
return context.getResources().getBoolean(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -92,4 +100,83 @@ public final class ResourcesCompat {
|
|||||||
|
|
||||||
throw new IllegalArgumentException("Unknown integer resource ID " + id);
|
throw new IllegalArgumentException("Unknown integer resource ID " + id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Attempt to programmatically load the logo from the manifest file of an
|
||||||
|
* activity by using an XML pull parser. This should allow us to read the
|
||||||
|
* logo attribute regardless of the platform it is being run on.
|
||||||
|
*
|
||||||
|
* @param activity Activity instance.
|
||||||
|
* @return Logo resource ID.
|
||||||
|
*/
|
||||||
|
public static int loadLogoFromManifest(Activity activity) {
|
||||||
|
int logo = 0;
|
||||||
|
try {
|
||||||
|
final String thisPackage = activity.getClass().getName();
|
||||||
|
if (ActionBarSherlock.DEBUG) Log.i(TAG, "Parsing AndroidManifest.xml for " + thisPackage);
|
||||||
|
|
||||||
|
final String packageName = activity.getApplicationInfo().packageName;
|
||||||
|
final AssetManager am = activity.createPackageContext(packageName, 0).getAssets();
|
||||||
|
final XmlResourceParser xml = am.openXmlResourceParser("AndroidManifest.xml");
|
||||||
|
|
||||||
|
int eventType = xml.getEventType();
|
||||||
|
while (eventType != XmlPullParser.END_DOCUMENT) {
|
||||||
|
if (eventType == XmlPullParser.START_TAG) {
|
||||||
|
String name = xml.getName();
|
||||||
|
|
||||||
|
if ("application".equals(name)) {
|
||||||
|
//Check if the <application> has the attribute
|
||||||
|
if (ActionBarSherlock.DEBUG) Log.d(TAG, "Got <application>");
|
||||||
|
|
||||||
|
for (int i = xml.getAttributeCount() - 1; i >= 0; i--) {
|
||||||
|
if (ActionBarSherlock.DEBUG) Log.d(TAG, xml.getAttributeName(i) + ": " + xml.getAttributeValue(i));
|
||||||
|
|
||||||
|
if ("logo".equals(xml.getAttributeName(i))) {
|
||||||
|
logo = xml.getAttributeResourceValue(i, 0);
|
||||||
|
break; //out of for loop
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if ("activity".equals(name)) {
|
||||||
|
//Check if the <activity> is us and has the attribute
|
||||||
|
if (ActionBarSherlock.DEBUG) Log.d(TAG, "Got <activity>");
|
||||||
|
Integer activityLogo = null;
|
||||||
|
String activityPackage = null;
|
||||||
|
boolean isOurActivity = false;
|
||||||
|
|
||||||
|
for (int i = xml.getAttributeCount() - 1; i >= 0; i--) {
|
||||||
|
if (ActionBarSherlock.DEBUG) Log.d(TAG, xml.getAttributeName(i) + ": " + xml.getAttributeValue(i));
|
||||||
|
|
||||||
|
//We need both uiOptions and name attributes
|
||||||
|
String attrName = xml.getAttributeName(i);
|
||||||
|
if ("logo".equals(attrName)) {
|
||||||
|
activityLogo = xml.getAttributeResourceValue(i, 0);
|
||||||
|
} else if ("name".equals(attrName)) {
|
||||||
|
activityPackage = ActionBarSherlockCompat.cleanActivityName(packageName, xml.getAttributeValue(i));
|
||||||
|
if (!thisPackage.equals(activityPackage)) {
|
||||||
|
break; //on to the next
|
||||||
|
}
|
||||||
|
isOurActivity = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Make sure we have both attributes before processing
|
||||||
|
if ((activityLogo != null) && (activityPackage != null)) {
|
||||||
|
//Our activity, logo specified, override with our value
|
||||||
|
logo = activityLogo.intValue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (isOurActivity) {
|
||||||
|
//If we matched our activity but it had no logo don't
|
||||||
|
//do any more processing of the manifest
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
eventType = xml.nextToken();
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
if (ActionBarSherlock.DEBUG) Log.i(TAG, "Returning " + Integer.toHexString(logo));
|
||||||
|
return logo;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -170,7 +170,12 @@ public class ActionBarImpl extends ActionBar {
|
|||||||
|
|
||||||
// Older apps get the home button interaction enabled by default.
|
// Older apps get the home button interaction enabled by default.
|
||||||
// Newer apps need to enable it explicitly.
|
// Newer apps need to enable it explicitly.
|
||||||
setHomeButtonEnabled(mContext.getApplicationInfo().targetSdkVersion < 14);
|
boolean homeButtonEnabled = mContext.getApplicationInfo().targetSdkVersion < Build.VERSION_CODES.ICE_CREAM_SANDWICH;
|
||||||
|
|
||||||
|
// If the homeAsUp display option is set, always enable the home button.
|
||||||
|
homeButtonEnabled |= (mActionView.getDisplayOptions() & ActionBar.DISPLAY_HOME_AS_UP) != 0;
|
||||||
|
|
||||||
|
setHomeButtonEnabled(homeButtonEnabled);
|
||||||
|
|
||||||
setHasEmbeddedTabs(getResources_getBoolean(mContext,
|
setHasEmbeddedTabs(getResources_getBoolean(mContext,
|
||||||
R.bool.abs__action_bar_embed_tabs));
|
R.bool.abs__action_bar_embed_tabs));
|
||||||
@ -321,7 +326,7 @@ public class ActionBarImpl extends ActionBar {
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new IllegalStateException(
|
throw new IllegalStateException(
|
||||||
"setSelectedNavigationIndex not valid for current navigation mode");
|
"setSelectedNavigationItem not valid for current navigation mode");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,6 +26,10 @@ public class ActionBarWrapper extends ActionBar implements android.app.ActionBar
|
|||||||
mActionBar = activity.getActionBar();
|
mActionBar = activity.getActionBar();
|
||||||
if (mActionBar != null) {
|
if (mActionBar != null) {
|
||||||
mActionBar.addOnMenuVisibilityListener(this);
|
mActionBar.addOnMenuVisibilityListener(this);
|
||||||
|
|
||||||
|
// Fixes issue #746
|
||||||
|
int displayOptions = mActionBar.getDisplayOptions();
|
||||||
|
mActionBar.setHomeButtonEnabled((displayOptions & DISPLAY_HOME_AS_UP) != 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -132,11 +136,19 @@ public class ActionBarWrapper extends ActionBar implements android.app.ActionBar
|
|||||||
@Override
|
@Override
|
||||||
public void setDisplayOptions(int options) {
|
public void setDisplayOptions(int options) {
|
||||||
mActionBar.setDisplayOptions(options);
|
mActionBar.setDisplayOptions(options);
|
||||||
|
|
||||||
|
// Fixes issue #746
|
||||||
|
mActionBar.setHomeButtonEnabled((options & DISPLAY_HOME_AS_UP) != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setDisplayOptions(int options, int mask) {
|
public void setDisplayOptions(int options, int mask) {
|
||||||
mActionBar.setDisplayOptions(options, mask);
|
mActionBar.setDisplayOptions(options, mask);
|
||||||
|
|
||||||
|
// Fixes issue #746
|
||||||
|
if ((mask & DISPLAY_HOME_AS_UP) != 0) {
|
||||||
|
mActionBar.setHomeButtonEnabled((options & DISPLAY_HOME_AS_UP) != 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -582,6 +582,7 @@ public class ValueAnimator extends Animator {
|
|||||||
* active animations to process.
|
* active animations to process.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("fallthrough")
|
||||||
public void handleMessage(Message msg) {
|
public void handleMessage(Message msg) {
|
||||||
boolean callAgain = true;
|
boolean callAgain = true;
|
||||||
ArrayList<ValueAnimator> animations = sAnimations.get();
|
ArrayList<ValueAnimator> animations = sAnimations.get();
|
||||||
|
@ -37,6 +37,7 @@ import com.actionbarsherlock.R;
|
|||||||
import com.actionbarsherlock.internal.view.View_HasStateListenerSupport;
|
import com.actionbarsherlock.internal.view.View_HasStateListenerSupport;
|
||||||
import com.actionbarsherlock.internal.view.View_OnAttachStateChangeListener;
|
import com.actionbarsherlock.internal.view.View_OnAttachStateChangeListener;
|
||||||
import com.actionbarsherlock.internal.widget.CapitalizingButton;
|
import com.actionbarsherlock.internal.widget.CapitalizingButton;
|
||||||
|
import com.actionbarsherlock.internal.widget.IcsToast;
|
||||||
|
|
||||||
import static com.actionbarsherlock.internal.ResourcesCompat.getResources_getBoolean;
|
import static com.actionbarsherlock.internal.ResourcesCompat.getResources_getBoolean;
|
||||||
|
|
||||||
@ -263,7 +264,7 @@ public class ActionMenuItemView extends LinearLayout
|
|||||||
final int midy = screenPos[1] + height / 2;
|
final int midy = screenPos[1] + height / 2;
|
||||||
final int screenWidth = context.getResources().getDisplayMetrics().widthPixels;
|
final int screenWidth = context.getResources().getDisplayMetrics().widthPixels;
|
||||||
|
|
||||||
Toast cheatSheet = Toast.makeText(context, mItemData.getTitle(), Toast.LENGTH_SHORT);
|
Toast cheatSheet = IcsToast.makeText(context, mItemData.getTitle(), IcsToast.LENGTH_SHORT);
|
||||||
if (midy < displayFrame.height()) {
|
if (midy < displayFrame.height()) {
|
||||||
// Show along the top; follow action buttons
|
// Show along the top; follow action buttons
|
||||||
cheatSheet.setGravity(Gravity.TOP | Gravity.RIGHT,
|
cheatSheet.setGravity(Gravity.TOP | Gravity.RIGHT,
|
||||||
|
@ -31,6 +31,7 @@ import android.content.pm.ResolveInfo;
|
|||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Parcelable;
|
import android.os.Parcelable;
|
||||||
import android.util.SparseArray;
|
import android.util.SparseArray;
|
||||||
@ -353,6 +354,11 @@ public class MenuBuilder implements Menu {
|
|||||||
SparseArray<Parcelable> viewStates = states.getSparseParcelableArray(
|
SparseArray<Parcelable> viewStates = states.getSparseParcelableArray(
|
||||||
getActionViewStatesKey());
|
getActionViewStatesKey());
|
||||||
|
|
||||||
|
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB && viewStates == null) {
|
||||||
|
//Fixes Issue #652 with sdk <= 2.3.6
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
final int itemCount = size();
|
final int itemCount = size();
|
||||||
for (int i = 0; i < itemCount; i++) {
|
for (int i = 0; i < itemCount; i++) {
|
||||||
final MenuItem item = getItem(i);
|
final MenuItem item = getItem(i);
|
||||||
|
@ -115,10 +115,20 @@ public class MenuPopupHelper implements AdapterView.OnItemClickListener, View.On
|
|||||||
|
|
||||||
View anchor = mAnchorView;
|
View anchor = mAnchorView;
|
||||||
if (anchor != null) {
|
if (anchor != null) {
|
||||||
final boolean addGlobalListener = mTreeObserver == null;
|
// Don't attach to the VTO unless the anchor itself is attached to avoid VTO-related leaks.
|
||||||
mTreeObserver = anchor.getViewTreeObserver(); // Refresh to latest
|
if (anchor.getWindowToken() != null) {
|
||||||
if (addGlobalListener) mTreeObserver.addOnGlobalLayoutListener(this);
|
ViewTreeObserver vto = anchor.getViewTreeObserver();
|
||||||
|
if (vto != mTreeObserver) {
|
||||||
|
if (mTreeObserver != null && mTreeObserver.isAlive()) {
|
||||||
|
mTreeObserver.removeGlobalOnLayoutListener(this);
|
||||||
|
}
|
||||||
|
if ((mTreeObserver = vto) != null) {
|
||||||
|
vto.addOnGlobalLayoutListener(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (anchor instanceof View_HasStateListenerSupport) {
|
||||||
((View_HasStateListenerSupport) anchor).addOnAttachStateChangeListener(this);
|
((View_HasStateListenerSupport) anchor).addOnAttachStateChangeListener(this);
|
||||||
|
}
|
||||||
mPopup.setAnchorView(anchor);
|
mPopup.setAnchorView(anchor);
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
@ -141,12 +151,12 @@ public class MenuPopupHelper implements AdapterView.OnItemClickListener, View.On
|
|||||||
mPopup = null;
|
mPopup = null;
|
||||||
mMenu.close();
|
mMenu.close();
|
||||||
if (mTreeObserver != null) {
|
if (mTreeObserver != null) {
|
||||||
if (!mTreeObserver.isAlive()) mTreeObserver = mAnchorView.getViewTreeObserver();
|
if (mTreeObserver.isAlive()) mTreeObserver.removeGlobalOnLayoutListener(this);
|
||||||
mTreeObserver.removeGlobalOnLayoutListener(this);
|
|
||||||
mTreeObserver = null;
|
mTreeObserver = null;
|
||||||
}
|
} else if (mAnchorView instanceof View_HasStateListenerSupport) {
|
||||||
((View_HasStateListenerSupport) mAnchorView).removeOnAttachStateChangeListener(this);
|
((View_HasStateListenerSupport) mAnchorView).removeOnAttachStateChangeListener(this);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isShowing() {
|
public boolean isShowing() {
|
||||||
return mPopup != null && mPopup.isShowing();
|
return mPopup != null && mPopup.isShowing();
|
||||||
@ -207,15 +217,16 @@ public class MenuPopupHelper implements AdapterView.OnItemClickListener, View.On
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onViewAttachedToWindow(View v) {
|
public void onViewAttachedToWindow(View v) {
|
||||||
|
((View_HasStateListenerSupport) v).removeOnAttachStateChangeListener(this);
|
||||||
|
|
||||||
|
// The anchor wasn't attached in tryShow(), attach to the ViewRoot VTO now.
|
||||||
|
if (mPopup != null && mTreeObserver == null) {
|
||||||
|
(mTreeObserver = v.getViewTreeObserver()).addOnGlobalLayoutListener(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onViewDetachedFromWindow(View v) {
|
public void onViewDetachedFromWindow(View v) {
|
||||||
if (mTreeObserver != null) {
|
|
||||||
if (!mTreeObserver.isAlive()) mTreeObserver = v.getViewTreeObserver();
|
|
||||||
mTreeObserver.removeGlobalOnLayoutListener(this);
|
|
||||||
}
|
|
||||||
((View_HasStateListenerSupport)v).removeOnAttachStateChangeListener(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -94,11 +94,18 @@ public class MenuWrapper implements Menu {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeItem(int id) {
|
public void removeItem(int id) {
|
||||||
|
mNativeMap.remove(mNativeMenu.findItem(id));
|
||||||
mNativeMenu.removeItem(id);
|
mNativeMenu.removeItem(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeGroup(int groupId) {
|
public void removeGroup(int groupId) {
|
||||||
|
for (int i = 0; i < mNativeMenu.size(); i++) {
|
||||||
|
final android.view.MenuItem item = mNativeMenu.getItem(i);
|
||||||
|
if (item.getGroupId() == groupId) {
|
||||||
|
mNativeMap.remove(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
mNativeMenu.removeGroup(groupId);
|
mNativeMenu.removeGroup(groupId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -108,6 +115,20 @@ public class MenuWrapper implements Menu {
|
|||||||
mNativeMenu.clear();
|
mNativeMenu.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void invalidate() {
|
||||||
|
if (mNativeMap.isEmpty()) return;
|
||||||
|
|
||||||
|
final WeakHashMap<android.view.MenuItem, MenuItem> menuMapCopy = new WeakHashMap<android.view.MenuItem, MenuItem>(mNativeMap.size());
|
||||||
|
|
||||||
|
for (int i = 0; i < mNativeMenu.size(); i++) {
|
||||||
|
final android.view.MenuItem item = mNativeMenu.getItem(i);
|
||||||
|
menuMapCopy.put(item, mNativeMap.get(item));
|
||||||
|
}
|
||||||
|
|
||||||
|
mNativeMap.clear();
|
||||||
|
mNativeMap.putAll(menuMapCopy);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setGroupCheckable(int group, boolean checkable, boolean exclusive) {
|
public void setGroupCheckable(int group, boolean checkable, boolean exclusive) {
|
||||||
mNativeMenu.setGroupCheckable(group, checkable, exclusive);
|
mNativeMenu.setGroupCheckable(group, checkable, exclusive);
|
||||||
|
@ -18,7 +18,6 @@ package com.actionbarsherlock.internal.widget;
|
|||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.res.TypedArray;
|
import android.content.res.TypedArray;
|
||||||
import android.graphics.Bitmap;
|
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
import android.graphics.drawable.ColorDrawable;
|
import android.graphics.drawable.ColorDrawable;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
@ -27,7 +26,6 @@ import android.util.AttributeSet;
|
|||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
import com.actionbarsherlock.R;
|
import com.actionbarsherlock.R;
|
||||||
import com.actionbarsherlock.app.ActionBar;
|
import com.actionbarsherlock.app.ActionBar;
|
||||||
import com.actionbarsherlock.internal.nineoldandroids.widget.NineFrameLayout;
|
import com.actionbarsherlock.internal.nineoldandroids.widget.NineFrameLayout;
|
||||||
@ -65,12 +63,7 @@ public class ActionBarContainer extends NineFrameLayout {
|
|||||||
|
|
||||||
//Fix for issue #379
|
//Fix for issue #379
|
||||||
if (mStackedBackground instanceof ColorDrawable && Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
|
if (mStackedBackground instanceof ColorDrawable && Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
|
||||||
Bitmap bitmap = Bitmap.createBitmap(1, 1, Bitmap.Config.ARGB_8888);
|
mStackedBackground = new IcsColorDrawable((ColorDrawable) mStackedBackground);
|
||||||
Canvas c = new Canvas(bitmap);
|
|
||||||
mStackedBackground.draw(c);
|
|
||||||
int color = bitmap.getPixel(0, 0);
|
|
||||||
bitmap.recycle();
|
|
||||||
mStackedBackground = new IcsColorDrawable(color);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getId() == R.id.abs__split_action_bar) {
|
if (getId() == R.id.abs__split_action_bar) {
|
||||||
|
@ -16,16 +16,14 @@
|
|||||||
|
|
||||||
package com.actionbarsherlock.internal.widget;
|
package com.actionbarsherlock.internal.widget;
|
||||||
|
|
||||||
import org.xmlpull.v1.XmlPullParser;
|
import com.actionbarsherlock.internal.ResourcesCompat;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.pm.ApplicationInfo;
|
import android.content.pm.ApplicationInfo;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.content.pm.PackageManager.NameNotFoundException;
|
import android.content.pm.PackageManager.NameNotFoundException;
|
||||||
import android.content.res.AssetManager;
|
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.content.res.TypedArray;
|
import android.content.res.TypedArray;
|
||||||
import android.content.res.XmlResourceParser;
|
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Parcel;
|
import android.os.Parcel;
|
||||||
@ -49,7 +47,6 @@ import android.widget.TextView;
|
|||||||
import com.actionbarsherlock.R;
|
import com.actionbarsherlock.R;
|
||||||
import com.actionbarsherlock.app.ActionBar;
|
import com.actionbarsherlock.app.ActionBar;
|
||||||
import com.actionbarsherlock.app.ActionBar.OnNavigationListener;
|
import com.actionbarsherlock.app.ActionBar.OnNavigationListener;
|
||||||
import com.actionbarsherlock.internal.ActionBarSherlockCompat;
|
|
||||||
import com.actionbarsherlock.internal.view.menu.ActionMenuItem;
|
import com.actionbarsherlock.internal.view.menu.ActionMenuItem;
|
||||||
import com.actionbarsherlock.internal.view.menu.ActionMenuPresenter;
|
import com.actionbarsherlock.internal.view.menu.ActionMenuPresenter;
|
||||||
import com.actionbarsherlock.internal.view.menu.ActionMenuView;
|
import com.actionbarsherlock.internal.view.menu.ActionMenuView;
|
||||||
@ -70,7 +67,6 @@ import static com.actionbarsherlock.internal.ResourcesCompat.getResources_getBoo
|
|||||||
*/
|
*/
|
||||||
public class ActionBarView extends AbsActionBarView {
|
public class ActionBarView extends AbsActionBarView {
|
||||||
private static final String TAG = "ActionBarView";
|
private static final String TAG = "ActionBarView";
|
||||||
private static final boolean DEBUG = false;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display options applied by default
|
* Display options applied by default
|
||||||
@ -190,7 +186,7 @@ public class ActionBarView extends AbsActionBarView {
|
|||||||
if (context instanceof Activity) {
|
if (context instanceof Activity) {
|
||||||
//Even though native methods existed in API 9 and 10 they don't work
|
//Even though native methods existed in API 9 and 10 they don't work
|
||||||
//so just parse the manifest to look for the logo pre-Honeycomb
|
//so just parse the manifest to look for the logo pre-Honeycomb
|
||||||
final int resId = loadLogoFromManifest((Activity) context);
|
final int resId = ResourcesCompat.loadLogoFromManifest((Activity) context);
|
||||||
if (resId != 0) {
|
if (resId != 0) {
|
||||||
mLogo = context.getResources().getDrawable(resId);
|
mLogo = context.getResources().getDrawable(resId);
|
||||||
}
|
}
|
||||||
@ -265,85 +261,6 @@ public class ActionBarView extends AbsActionBarView {
|
|||||||
mHomeLayout.setFocusable(true);
|
mHomeLayout.setFocusable(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Attempt to programmatically load the logo from the manifest file of an
|
|
||||||
* activity by using an XML pull parser. This should allow us to read the
|
|
||||||
* logo attribute regardless of the platform it is being run on.
|
|
||||||
*
|
|
||||||
* @param activity Activity instance.
|
|
||||||
* @return Logo resource ID.
|
|
||||||
*/
|
|
||||||
private static int loadLogoFromManifest(Activity activity) {
|
|
||||||
int logo = 0;
|
|
||||||
try {
|
|
||||||
final String thisPackage = activity.getClass().getName();
|
|
||||||
if (DEBUG) Log.i(TAG, "Parsing AndroidManifest.xml for " + thisPackage);
|
|
||||||
|
|
||||||
final String packageName = activity.getApplicationInfo().packageName;
|
|
||||||
final AssetManager am = activity.createPackageContext(packageName, 0).getAssets();
|
|
||||||
final XmlResourceParser xml = am.openXmlResourceParser("AndroidManifest.xml");
|
|
||||||
|
|
||||||
int eventType = xml.getEventType();
|
|
||||||
while (eventType != XmlPullParser.END_DOCUMENT) {
|
|
||||||
if (eventType == XmlPullParser.START_TAG) {
|
|
||||||
String name = xml.getName();
|
|
||||||
|
|
||||||
if ("application".equals(name)) {
|
|
||||||
//Check if the <application> has the attribute
|
|
||||||
if (DEBUG) Log.d(TAG, "Got <application>");
|
|
||||||
|
|
||||||
for (int i = xml.getAttributeCount() - 1; i >= 0; i--) {
|
|
||||||
if (DEBUG) Log.d(TAG, xml.getAttributeName(i) + ": " + xml.getAttributeValue(i));
|
|
||||||
|
|
||||||
if ("logo".equals(xml.getAttributeName(i))) {
|
|
||||||
logo = xml.getAttributeResourceValue(i, 0);
|
|
||||||
break; //out of for loop
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if ("activity".equals(name)) {
|
|
||||||
//Check if the <activity> is us and has the attribute
|
|
||||||
if (DEBUG) Log.d(TAG, "Got <activity>");
|
|
||||||
Integer activityLogo = null;
|
|
||||||
String activityPackage = null;
|
|
||||||
boolean isOurActivity = false;
|
|
||||||
|
|
||||||
for (int i = xml.getAttributeCount() - 1; i >= 0; i--) {
|
|
||||||
if (DEBUG) Log.d(TAG, xml.getAttributeName(i) + ": " + xml.getAttributeValue(i));
|
|
||||||
|
|
||||||
//We need both uiOptions and name attributes
|
|
||||||
String attrName = xml.getAttributeName(i);
|
|
||||||
if ("logo".equals(attrName)) {
|
|
||||||
activityLogo = xml.getAttributeResourceValue(i, 0);
|
|
||||||
} else if ("name".equals(attrName)) {
|
|
||||||
activityPackage = ActionBarSherlockCompat.cleanActivityName(packageName, xml.getAttributeValue(i));
|
|
||||||
if (!thisPackage.equals(activityPackage)) {
|
|
||||||
break; //on to the next
|
|
||||||
}
|
|
||||||
isOurActivity = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
//Make sure we have both attributes before processing
|
|
||||||
if ((activityLogo != null) && (activityPackage != null)) {
|
|
||||||
//Our activity, logo specified, override with our value
|
|
||||||
logo = activityLogo.intValue();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (isOurActivity) {
|
|
||||||
//If we matched our activity but it had no logo don't
|
|
||||||
//do any more processing of the manifest
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
eventType = xml.nextToken();
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
if (DEBUG) Log.i(TAG, "Returning " + Integer.toHexString(logo));
|
|
||||||
return logo;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Must be public so we can dispatch pre-2.2 via ActionBarImpl.
|
* Must be public so we can dispatch pre-2.2 via ActionBarImpl.
|
||||||
*/
|
*/
|
||||||
|
@ -12,9 +12,14 @@ public class CapitalizingButton extends Button {
|
|||||||
private static final boolean IS_GINGERBREAD = Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD;
|
private static final boolean IS_GINGERBREAD = Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD;
|
||||||
|
|
||||||
private static final int[] R_styleable_Button = new int[] {
|
private static final int[] R_styleable_Button = new int[] {
|
||||||
|
android.R.attr.textAppearance
|
||||||
|
};
|
||||||
|
private static final int R_styleable_Button_textAppearance = 0;
|
||||||
|
|
||||||
|
private static final int[] R_styleable_TextAppearance = new int[] {
|
||||||
android.R.attr.textAllCaps
|
android.R.attr.textAllCaps
|
||||||
};
|
};
|
||||||
private static final int R_styleable_Button_textAllCaps = 0;
|
private static final int R_styleable_TextAppearance_textAllCaps = 0;
|
||||||
|
|
||||||
private boolean mAllCaps;
|
private boolean mAllCaps;
|
||||||
|
|
||||||
@ -22,14 +27,26 @@ public class CapitalizingButton extends Button {
|
|||||||
super(context, attrs);
|
super(context, attrs);
|
||||||
|
|
||||||
TypedArray a = context.obtainStyledAttributes(attrs, R_styleable_Button);
|
TypedArray a = context.obtainStyledAttributes(attrs, R_styleable_Button);
|
||||||
mAllCaps = a.getBoolean(R_styleable_Button_textAllCaps, true);
|
int ap = a.getResourceId(R_styleable_Button_textAppearance, -1);
|
||||||
a.recycle();
|
a.recycle();
|
||||||
|
if (ap != -1) {
|
||||||
|
TypedArray appearance = context.obtainStyledAttributes(ap, R_styleable_TextAppearance);
|
||||||
|
if (appearance != null) {
|
||||||
|
mAllCaps = appearance.getBoolean(R_styleable_TextAppearance_textAllCaps, true);
|
||||||
|
appearance.recycle();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTextCompat(CharSequence text) {
|
public void setTextCompat(CharSequence text) {
|
||||||
if (SANS_ICE_CREAM && mAllCaps && text != null) {
|
if (SANS_ICE_CREAM && mAllCaps && text != null) {
|
||||||
if (IS_GINGERBREAD) {
|
if (IS_GINGERBREAD) {
|
||||||
|
try {
|
||||||
setText(text.toString().toUpperCase(Locale.ROOT));
|
setText(text.toString().toUpperCase(Locale.ROOT));
|
||||||
|
} catch (NoSuchFieldError e) {
|
||||||
|
//Some manufacturer broke Locale.ROOT. See #572.
|
||||||
|
setText(text.toString().toUpperCase());
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
setText(text.toString().toUpperCase());
|
setText(text.toString().toUpperCase());
|
||||||
}
|
}
|
||||||
|
@ -1,64 +0,0 @@
|
|||||||
package com.actionbarsherlock.internal.widget;
|
|
||||||
|
|
||||||
import static android.view.View.MeasureSpec.EXACTLY;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.res.TypedArray;
|
|
||||||
import android.util.AttributeSet;
|
|
||||||
import android.util.DisplayMetrics;
|
|
||||||
import android.util.TypedValue;
|
|
||||||
import android.widget.LinearLayout;
|
|
||||||
import com.actionbarsherlock.R;
|
|
||||||
|
|
||||||
public class FakeDialogPhoneWindow extends LinearLayout {
|
|
||||||
final TypedValue mMinWidthMajor = new TypedValue();
|
|
||||||
final TypedValue mMinWidthMinor = new TypedValue();
|
|
||||||
|
|
||||||
public FakeDialogPhoneWindow(Context context, AttributeSet attrs) {
|
|
||||||
super(context, attrs);
|
|
||||||
|
|
||||||
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.SherlockTheme);
|
|
||||||
|
|
||||||
a.getValue(R.styleable.SherlockTheme_windowMinWidthMajor, mMinWidthMajor);
|
|
||||||
a.getValue(R.styleable.SherlockTheme_windowMinWidthMinor, mMinWidthMinor);
|
|
||||||
|
|
||||||
a.recycle();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Stolen from PhoneWindow */
|
|
||||||
@Override
|
|
||||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
|
||||||
final DisplayMetrics metrics = getContext().getResources().getDisplayMetrics();
|
|
||||||
final boolean isPortrait = metrics.widthPixels < metrics.heightPixels;
|
|
||||||
|
|
||||||
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
|
|
||||||
|
|
||||||
int width = getMeasuredWidth();
|
|
||||||
boolean measure = false;
|
|
||||||
|
|
||||||
widthMeasureSpec = MeasureSpec.makeMeasureSpec(width, EXACTLY);
|
|
||||||
|
|
||||||
final TypedValue tv = isPortrait ? mMinWidthMinor : mMinWidthMajor;
|
|
||||||
|
|
||||||
if (tv.type != TypedValue.TYPE_NULL) {
|
|
||||||
final int min;
|
|
||||||
if (tv.type == TypedValue.TYPE_DIMENSION) {
|
|
||||||
min = (int)tv.getDimension(metrics);
|
|
||||||
} else if (tv.type == TypedValue.TYPE_FRACTION) {
|
|
||||||
min = (int)tv.getFraction(metrics.widthPixels, metrics.widthPixels);
|
|
||||||
} else {
|
|
||||||
min = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (width < min) {
|
|
||||||
widthMeasureSpec = MeasureSpec.makeMeasureSpec(min, EXACTLY);
|
|
||||||
measure = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: Support height?
|
|
||||||
|
|
||||||
if (measure) {
|
|
||||||
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,8 +1,10 @@
|
|||||||
package com.actionbarsherlock.internal.widget;
|
package com.actionbarsherlock.internal.widget;
|
||||||
|
|
||||||
|
import android.graphics.Bitmap;
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
import android.graphics.ColorFilter;
|
import android.graphics.ColorFilter;
|
||||||
import android.graphics.Paint;
|
import android.graphics.Paint;
|
||||||
|
import android.graphics.drawable.ColorDrawable;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -12,6 +14,14 @@ public class IcsColorDrawable extends Drawable {
|
|||||||
private int color;
|
private int color;
|
||||||
private final Paint paint = new Paint();
|
private final Paint paint = new Paint();
|
||||||
|
|
||||||
|
public IcsColorDrawable(ColorDrawable drawable) {
|
||||||
|
Bitmap bitmap = Bitmap.createBitmap(1, 1, Bitmap.Config.ARGB_8888);
|
||||||
|
Canvas c = new Canvas(bitmap);
|
||||||
|
drawable.draw(c);
|
||||||
|
this.color = bitmap.getPixel(0, 0);
|
||||||
|
bitmap.recycle();
|
||||||
|
}
|
||||||
|
|
||||||
public IcsColorDrawable(int color) {
|
public IcsColorDrawable(int color) {
|
||||||
this.color = color;
|
this.color = color;
|
||||||
}
|
}
|
||||||
@ -26,7 +36,7 @@ public class IcsColorDrawable extends Drawable {
|
|||||||
@Override
|
@Override
|
||||||
public void setAlpha(int alpha) {
|
public void setAlpha(int alpha) {
|
||||||
if (alpha != (color >>> 24)) {
|
if (alpha != (color >>> 24)) {
|
||||||
color = (color & 0x00FFFFFF) & (alpha << 24);
|
color = (color & 0x00FFFFFF) | (alpha << 24);
|
||||||
invalidateSelf();
|
invalidateSelf();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,10 +3,11 @@ package com.actionbarsherlock.internal.widget;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.res.TypedArray;
|
import android.content.res.TypedArray;
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
|
import android.graphics.drawable.ColorDrawable;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
|
import android.os.Build;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.LinearLayout;
|
|
||||||
|
|
||||||
import com.actionbarsherlock.internal.nineoldandroids.widget.NineLinearLayout;
|
import com.actionbarsherlock.internal.nineoldandroids.widget.NineLinearLayout;
|
||||||
|
|
||||||
@ -20,14 +21,12 @@ import com.actionbarsherlock.internal.nineoldandroids.widget.NineLinearLayout;
|
|||||||
public class IcsLinearLayout extends NineLinearLayout {
|
public class IcsLinearLayout extends NineLinearLayout {
|
||||||
private static final int[] R_styleable_LinearLayout = new int[] {
|
private static final int[] R_styleable_LinearLayout = new int[] {
|
||||||
/* 0 */ android.R.attr.divider,
|
/* 0 */ android.R.attr.divider,
|
||||||
/* 1 */ android.R.attr.measureWithLargestChild,
|
|
||||||
/* 2 */ android.R.attr.showDividers,
|
/* 2 */ android.R.attr.showDividers,
|
||||||
/* 3 */ android.R.attr.dividerPadding,
|
/* 3 */ android.R.attr.dividerPadding,
|
||||||
};
|
};
|
||||||
private static final int LinearLayout_divider = 0;
|
private static final int LinearLayout_divider = 0;
|
||||||
private static final int LinearLayout_measureWithLargestChild = 1;
|
private static final int LinearLayout_showDividers = 1;
|
||||||
private static final int LinearLayout_showDividers = 2;
|
private static final int LinearLayout_dividerPadding = 2;
|
||||||
private static final int LinearLayout_dividerPadding = 3;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Don't show any dividers.
|
* Don't show any dividers.
|
||||||
@ -53,8 +52,6 @@ public class IcsLinearLayout extends NineLinearLayout {
|
|||||||
private int mShowDividers;
|
private int mShowDividers;
|
||||||
private int mDividerPadding;
|
private int mDividerPadding;
|
||||||
|
|
||||||
private boolean mUseLargestChild;
|
|
||||||
|
|
||||||
public IcsLinearLayout(Context context, AttributeSet attrs) {
|
public IcsLinearLayout(Context context, AttributeSet attrs) {
|
||||||
super(context, attrs);
|
super(context, attrs);
|
||||||
|
|
||||||
@ -63,7 +60,6 @@ public class IcsLinearLayout extends NineLinearLayout {
|
|||||||
setDividerDrawable(a.getDrawable(/*com.android.internal.R.styleable.*/LinearLayout_divider));
|
setDividerDrawable(a.getDrawable(/*com.android.internal.R.styleable.*/LinearLayout_divider));
|
||||||
mShowDividers = a.getInt(/*com.android.internal.R.styleable.*/LinearLayout_showDividers, SHOW_DIVIDER_NONE);
|
mShowDividers = a.getInt(/*com.android.internal.R.styleable.*/LinearLayout_showDividers, SHOW_DIVIDER_NONE);
|
||||||
mDividerPadding = a.getDimensionPixelSize(/*com.android.internal.R.styleable.*/LinearLayout_dividerPadding, 0);
|
mDividerPadding = a.getDimensionPixelSize(/*com.android.internal.R.styleable.*/LinearLayout_dividerPadding, 0);
|
||||||
mUseLargestChild = a.getBoolean(/*com.android.internal.R.styleable.*/LinearLayout_measureWithLargestChild, false);
|
|
||||||
|
|
||||||
a.recycle();
|
a.recycle();
|
||||||
}
|
}
|
||||||
@ -100,6 +96,12 @@ public class IcsLinearLayout extends NineLinearLayout {
|
|||||||
if (divider == mDivider) {
|
if (divider == mDivider) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Fix for issue #379
|
||||||
|
if (divider instanceof ColorDrawable && Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
|
||||||
|
divider = new IcsColorDrawable((ColorDrawable) divider);
|
||||||
|
}
|
||||||
|
|
||||||
mDivider = divider;
|
mDivider = divider;
|
||||||
if (divider != null) {
|
if (divider != null) {
|
||||||
mDividerWidth = divider.getIntrinsicWidth();
|
mDividerWidth = divider.getIntrinsicWidth();
|
||||||
@ -275,136 +277,4 @@ public class IcsLinearLayout extends NineLinearLayout {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* When true, all children with a weight will be considered having
|
|
||||||
* the minimum size of the largest child. If false, all children are
|
|
||||||
* measured normally.
|
|
||||||
*
|
|
||||||
* @return True to measure children with a weight using the minimum
|
|
||||||
* size of the largest child, false otherwise.
|
|
||||||
*
|
|
||||||
* @attr ref android.R.styleable#LinearLayout_measureWithLargestChild
|
|
||||||
*/
|
|
||||||
public boolean isMeasureWithLargestChildEnabled() {
|
|
||||||
return mUseLargestChild;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* When set to true, all children with a weight will be considered having
|
|
||||||
* the minimum size of the largest child. If false, all children are
|
|
||||||
* measured normally.
|
|
||||||
*
|
|
||||||
* Disabled by default.
|
|
||||||
*
|
|
||||||
* @param enabled True to measure children with a weight using the
|
|
||||||
* minimum size of the largest child, false otherwise.
|
|
||||||
*
|
|
||||||
* @attr ref android.R.styleable#LinearLayout_measureWithLargestChild
|
|
||||||
*/
|
|
||||||
public void setMeasureWithLargestChildEnabled(boolean enabled) {
|
|
||||||
mUseLargestChild = enabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
|
||||||
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
|
|
||||||
|
|
||||||
if (mUseLargestChild) {
|
|
||||||
final int orientation = getOrientation();
|
|
||||||
switch (orientation) {
|
|
||||||
case HORIZONTAL:
|
|
||||||
useLargestChildHorizontal();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case VERTICAL:
|
|
||||||
useLargestChildVertical();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void useLargestChildHorizontal() {
|
|
||||||
final int childCount = getChildCount();
|
|
||||||
|
|
||||||
// Find largest child width
|
|
||||||
int largestChildWidth = 0;
|
|
||||||
for (int i = 0; i < childCount; i++) {
|
|
||||||
final View child = getChildAt(i);
|
|
||||||
largestChildWidth = Math.max(child.getMeasuredWidth(), largestChildWidth);
|
|
||||||
}
|
|
||||||
|
|
||||||
int totalWidth = 0;
|
|
||||||
// Re-measure childs
|
|
||||||
for (int i = 0; i < childCount; i++) {
|
|
||||||
final View child = getChildAt(i);
|
|
||||||
|
|
||||||
if (child == null || child.getVisibility() == View.GONE) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
final LinearLayout.LayoutParams lp =
|
|
||||||
(LinearLayout.LayoutParams) child.getLayoutParams();
|
|
||||||
|
|
||||||
float childExtra = lp.weight;
|
|
||||||
if (childExtra > 0) {
|
|
||||||
child.measure(
|
|
||||||
MeasureSpec.makeMeasureSpec(largestChildWidth,
|
|
||||||
MeasureSpec.EXACTLY),
|
|
||||||
MeasureSpec.makeMeasureSpec(child.getMeasuredHeight(),
|
|
||||||
MeasureSpec.EXACTLY));
|
|
||||||
totalWidth += largestChildWidth;
|
|
||||||
|
|
||||||
} else {
|
|
||||||
totalWidth += child.getMeasuredWidth();
|
|
||||||
}
|
|
||||||
|
|
||||||
totalWidth += lp.leftMargin + lp.rightMargin;
|
|
||||||
}
|
|
||||||
|
|
||||||
totalWidth += getPaddingLeft() + getPaddingRight();
|
|
||||||
setMeasuredDimension(totalWidth, getMeasuredHeight());
|
|
||||||
}
|
|
||||||
|
|
||||||
private void useLargestChildVertical() {
|
|
||||||
final int childCount = getChildCount();
|
|
||||||
|
|
||||||
// Find largest child width
|
|
||||||
int largestChildHeight = 0;
|
|
||||||
for (int i = 0; i < childCount; i++) {
|
|
||||||
final View child = getChildAt(i);
|
|
||||||
largestChildHeight = Math.max(child.getMeasuredHeight(), largestChildHeight);
|
|
||||||
}
|
|
||||||
|
|
||||||
int totalHeight = 0;
|
|
||||||
// Re-measure childs
|
|
||||||
for (int i = 0; i < childCount; i++) {
|
|
||||||
final View child = getChildAt(i);
|
|
||||||
|
|
||||||
if (child == null || child.getVisibility() == View.GONE) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
final LinearLayout.LayoutParams lp =
|
|
||||||
(LinearLayout.LayoutParams) child.getLayoutParams();
|
|
||||||
|
|
||||||
float childExtra = lp.weight;
|
|
||||||
if (childExtra > 0) {
|
|
||||||
child.measure(
|
|
||||||
MeasureSpec.makeMeasureSpec(child.getMeasuredWidth(),
|
|
||||||
MeasureSpec.EXACTLY),
|
|
||||||
MeasureSpec.makeMeasureSpec(largestChildHeight,
|
|
||||||
MeasureSpec.EXACTLY));
|
|
||||||
totalHeight += largestChildHeight;
|
|
||||||
|
|
||||||
} else {
|
|
||||||
totalHeight += child.getMeasuredHeight();
|
|
||||||
}
|
|
||||||
|
|
||||||
totalHeight += lp.leftMargin + lp.rightMargin;
|
|
||||||
}
|
|
||||||
|
|
||||||
totalHeight += getPaddingLeft() + getPaddingRight();
|
|
||||||
setMeasuredDimension(getMeasuredWidth(), totalHeight);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,7 @@ public class IcsListPopupWindow {
|
|||||||
private static final int EXPAND_LIST_TIMEOUT = 250;
|
private static final int EXPAND_LIST_TIMEOUT = 250;
|
||||||
|
|
||||||
private Context mContext;
|
private Context mContext;
|
||||||
private PopupWindow mPopup;
|
private final PopupWindowCompat mPopup;
|
||||||
private ListAdapter mAdapter;
|
private ListAdapter mAdapter;
|
||||||
private DropDownListView mDropDownList;
|
private DropDownListView mDropDownList;
|
||||||
|
|
||||||
@ -80,7 +80,7 @@ public class IcsListPopupWindow {
|
|||||||
|
|
||||||
public IcsListPopupWindow(Context context, AttributeSet attrs, int defStyleAttr) {
|
public IcsListPopupWindow(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||||
mContext = context;
|
mContext = context;
|
||||||
mPopup = new PopupWindow(context, attrs, defStyleAttr);
|
mPopup = new PopupWindowCompat(context, attrs, defStyleAttr);
|
||||||
mPopup.setInputMethodMode(PopupWindow.INPUT_METHOD_NEEDED);
|
mPopup.setInputMethodMode(PopupWindow.INPUT_METHOD_NEEDED);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -88,9 +88,9 @@ public class IcsListPopupWindow {
|
|||||||
mContext = context;
|
mContext = context;
|
||||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
|
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
|
||||||
Context wrapped = new ContextThemeWrapper(context, defStyleRes);
|
Context wrapped = new ContextThemeWrapper(context, defStyleRes);
|
||||||
mPopup = new PopupWindow(wrapped, attrs, defStyleAttr);
|
mPopup = new PopupWindowCompat(wrapped, attrs, defStyleAttr);
|
||||||
} else {
|
} else {
|
||||||
mPopup = new PopupWindow(context, attrs, defStyleAttr, defStyleRes);
|
mPopup = new PopupWindowCompat(context, attrs, defStyleAttr, defStyleRes);
|
||||||
}
|
}
|
||||||
mPopup.setInputMethodMode(PopupWindow.INPUT_METHOD_NEEDED);
|
mPopup.setInputMethodMode(PopupWindow.INPUT_METHOD_NEEDED);
|
||||||
}
|
}
|
||||||
@ -258,6 +258,23 @@ public class IcsListPopupWindow {
|
|||||||
mPopup.setInputMethodMode(mode);
|
mPopup.setInputMethodMode(mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the selected position of the list.
|
||||||
|
* Only valid when {@link #isShowing()} == {@code true}.
|
||||||
|
*
|
||||||
|
* @param position List position to set as selected.
|
||||||
|
*/
|
||||||
|
public void setSelection(int position) {
|
||||||
|
DropDownListView list = mDropDownList;
|
||||||
|
if (isShowing() && list != null) {
|
||||||
|
list.mListSelectionHidden = false;
|
||||||
|
list.setSelection(position);
|
||||||
|
if (list.getChoiceMode() != ListView.CHOICE_MODE_NONE) {
|
||||||
|
list.setItemChecked(position, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void clearListSelection() {
|
public void clearListSelection() {
|
||||||
final DropDownListView list = mDropDownList;
|
final DropDownListView list = mDropDownList;
|
||||||
if (list != null) {
|
if (list != null) {
|
||||||
|
@ -0,0 +1,60 @@
|
|||||||
|
|
||||||
|
package com.actionbarsherlock.internal.widget;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.view.Gravity;
|
||||||
|
import android.os.Build.VERSION;
|
||||||
|
import android.os.Build.VERSION_CODES;
|
||||||
|
import android.widget.TextView;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import com.actionbarsherlock.R;
|
||||||
|
|
||||||
|
public class IcsToast extends Toast {
|
||||||
|
public static final int LENGTH_LONG = Toast.LENGTH_LONG;
|
||||||
|
public static final int LENGTH_SHORT = Toast.LENGTH_SHORT;
|
||||||
|
private static final String TAG = "Toast";
|
||||||
|
|
||||||
|
public static Toast makeText(Context context, CharSequence s, int duration) {
|
||||||
|
if (VERSION.SDK_INT >= VERSION_CODES.ICE_CREAM_SANDWICH) {
|
||||||
|
return Toast.makeText(context, s, duration);
|
||||||
|
}
|
||||||
|
IcsToast toast = new IcsToast(context);
|
||||||
|
toast.setDuration(duration);
|
||||||
|
TextView view = new TextView(context);
|
||||||
|
view.setText(s);
|
||||||
|
// Original AOSP using reference on @android:color/bright_foreground_dark
|
||||||
|
// bright_foreground_dark - reference on @android:color/background_light
|
||||||
|
// background_light - 0xffffffff
|
||||||
|
view.setTextColor(0xffffffff);
|
||||||
|
view.setGravity(Gravity.CENTER);
|
||||||
|
view.setBackgroundResource(R.drawable.abs__toast_frame);
|
||||||
|
toast.setView(view);
|
||||||
|
return toast;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Toast makeText(Context context, int resId, int duration) {
|
||||||
|
return makeText(context, context.getResources().getString(resId), duration);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IcsToast(Context context) {
|
||||||
|
super(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setText(CharSequence s) {
|
||||||
|
if (VERSION.SDK_INT >= VERSION_CODES.ICE_CREAM_SANDWICH) {
|
||||||
|
super.setText(s);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (getView() == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
((TextView) getView()).setText(s);
|
||||||
|
} catch (ClassCastException e) {
|
||||||
|
Log.e(TAG, "This Toast was not created with IcsToast.makeText", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,178 @@
|
|||||||
|
|
||||||
|
package com.actionbarsherlock.internal.widget;
|
||||||
|
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.util.AttributeSet;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewTreeObserver;
|
||||||
|
import android.view.ViewTreeObserver.OnScrollChangedListener;
|
||||||
|
import android.widget.PopupWindow;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Works around bugs in the handling of {@link ViewTreeObserver} by
|
||||||
|
* {@link PopupWindow}.
|
||||||
|
* <p>
|
||||||
|
* <code>PopupWindow</code> registers an {@link OnScrollChangedListener} with
|
||||||
|
* {@link ViewTreeObserver}, but does not keep a reference to the observer
|
||||||
|
* instance that it has registers on. This is problematic when the anchor view
|
||||||
|
* used by <code>PopupWindow</code> to access the observer is detached from the
|
||||||
|
* window, as it will revert from the shared <code>ViewTreeObserver</code> owned
|
||||||
|
* by the <code>ViewRoot</code> to a floating one, meaning
|
||||||
|
* <code>PopupWindow</code> cannot unregister it's listener anymore and has
|
||||||
|
* leaked it into the global observer.
|
||||||
|
* <p>
|
||||||
|
* This class works around this issue by
|
||||||
|
* <ul>
|
||||||
|
* <li>replacing <code>PopupWindow.mOnScrollChangedListener</code> with a no-op
|
||||||
|
* listener so that any registration or unregistration performed by
|
||||||
|
* <code>PopupWindow</code> itself has no effect and causes no leaks.
|
||||||
|
* <li>registering the real listener only with the shared
|
||||||
|
* <code>ViewTreeObserver</code> and keeping a reference to it to facilitate
|
||||||
|
* correct unregistration. The reason for not registering on a floating observer
|
||||||
|
* (before a view is attached) is that there is no safe way to get a reference
|
||||||
|
* to the shared observer that the floating one will be merged into. This would
|
||||||
|
* again cause the listener to leak.
|
||||||
|
* </ul>
|
||||||
|
*/
|
||||||
|
public class PopupWindowCompat extends PopupWindow {
|
||||||
|
|
||||||
|
private static final Field superListenerField;
|
||||||
|
static {
|
||||||
|
Field f = null;
|
||||||
|
try {
|
||||||
|
f = PopupWindow.class.getDeclaredField("mOnScrollChangedListener");
|
||||||
|
f.setAccessible(true);
|
||||||
|
} catch (NoSuchFieldException e) {
|
||||||
|
/* ignored */
|
||||||
|
}
|
||||||
|
superListenerField = f;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final OnScrollChangedListener NOP = new OnScrollChangedListener() {
|
||||||
|
@Override
|
||||||
|
public void onScrollChanged() {
|
||||||
|
/* do nothing */
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
private OnScrollChangedListener mSuperScrollListener;
|
||||||
|
private ViewTreeObserver mViewTreeObserver;
|
||||||
|
|
||||||
|
public PopupWindowCompat() {
|
||||||
|
super();
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
public PopupWindowCompat(Context context) {
|
||||||
|
super(context);
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
public PopupWindowCompat(Context context, AttributeSet attrs) {
|
||||||
|
super(context, attrs);
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
public PopupWindowCompat(Context context, AttributeSet attrs, int defStyle) {
|
||||||
|
super(context, attrs, defStyle);
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
// @TargetApi(Build.VERSION_CODES.HONEYCOMB)
|
||||||
|
public PopupWindowCompat(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
|
||||||
|
super(context, attrs, defStyleAttr, defStyleRes);
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
public PopupWindowCompat(int width, int height) {
|
||||||
|
super(width, height);
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
public PopupWindowCompat(View contentView) {
|
||||||
|
super(contentView);
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
public PopupWindowCompat(View contentView, int width, int height, boolean focusable) {
|
||||||
|
super(contentView, width, height, focusable);
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
public PopupWindowCompat(View contentView, int width, int height) {
|
||||||
|
super(contentView, width, height);
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void init() {
|
||||||
|
if (superListenerField != null) {
|
||||||
|
try {
|
||||||
|
mSuperScrollListener = (OnScrollChangedListener) superListenerField.get(this);
|
||||||
|
superListenerField.set(this, NOP);
|
||||||
|
} catch (Exception e) {
|
||||||
|
mSuperScrollListener = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void unregisterListener() {
|
||||||
|
// Don't do anything if we haven't managed to patch the super listener
|
||||||
|
if (mSuperScrollListener != null && mViewTreeObserver != null) {
|
||||||
|
if (mViewTreeObserver.isAlive()) {
|
||||||
|
mViewTreeObserver.removeOnScrollChangedListener(mSuperScrollListener);
|
||||||
|
}
|
||||||
|
mViewTreeObserver = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void registerListener(View anchor) {
|
||||||
|
// Don't do anything if we haven't managed to patch the super listener.
|
||||||
|
// And don't bother attaching the listener if the anchor view isn't
|
||||||
|
// attached. This means we'll only have to deal with the real VTO owned
|
||||||
|
// by the ViewRoot.
|
||||||
|
if (mSuperScrollListener != null) {
|
||||||
|
ViewTreeObserver vto = (anchor.getWindowToken() != null) ? anchor.getViewTreeObserver()
|
||||||
|
: null;
|
||||||
|
if (vto != mViewTreeObserver) {
|
||||||
|
if (mViewTreeObserver != null && mViewTreeObserver.isAlive()) {
|
||||||
|
mViewTreeObserver.removeOnScrollChangedListener(mSuperScrollListener);
|
||||||
|
}
|
||||||
|
if ((mViewTreeObserver = vto) != null) {
|
||||||
|
vto.addOnScrollChangedListener(mSuperScrollListener);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void showAsDropDown(View anchor, int xoff, int yoff) {
|
||||||
|
super.showAsDropDown(anchor, xoff, yoff);
|
||||||
|
registerListener(anchor);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void update(View anchor, int xoff, int yoff, int width, int height) {
|
||||||
|
super.update(anchor, xoff, yoff, width, height);
|
||||||
|
registerListener(anchor);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void update(View anchor, int width, int height) {
|
||||||
|
super.update(anchor, width, height);
|
||||||
|
registerListener(anchor);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void showAtLocation(View parent, int gravity, int x, int y) {
|
||||||
|
super.showAtLocation(parent, gravity, x, y);
|
||||||
|
unregisterListener();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void dismiss() {
|
||||||
|
super.dismiss();
|
||||||
|
unregisterListener();
|
||||||
|
}
|
||||||
|
}
|
@ -186,7 +186,7 @@ public class ScrollingTabContainerView extends NineHorizontalScrollView
|
|||||||
}
|
}
|
||||||
|
|
||||||
private IcsLinearLayout createTabLayout() {
|
private IcsLinearLayout createTabLayout() {
|
||||||
final IcsLinearLayout tabLayout = (IcsLinearLayout) LayoutInflater.from(getContext())
|
final TabsLinearLayout tabLayout = (TabsLinearLayout) LayoutInflater.from(getContext())
|
||||||
.inflate(R.layout.abs__action_bar_tab_bar_view, null);
|
.inflate(R.layout.abs__action_bar_tab_bar_view, null);
|
||||||
tabLayout.setMeasureWithLargestChildEnabled(true);
|
tabLayout.setMeasureWithLargestChildEnabled(true);
|
||||||
tabLayout.setLayoutParams(new LinearLayout.LayoutParams(
|
tabLayout.setLayoutParams(new LinearLayout.LayoutParams(
|
||||||
|
@ -0,0 +1,113 @@
|
|||||||
|
package com.actionbarsherlock.internal.widget;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.res.TypedArray;
|
||||||
|
import android.util.AttributeSet;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
|
|
||||||
|
public class TabsLinearLayout extends IcsLinearLayout {
|
||||||
|
private static final int[] R_styleable_LinearLayout = new int[] {
|
||||||
|
/* 0 */ android.R.attr.measureWithLargestChild,
|
||||||
|
};
|
||||||
|
private static final int LinearLayout_measureWithLargestChild = 0;
|
||||||
|
|
||||||
|
private boolean mUseLargestChild;
|
||||||
|
|
||||||
|
public TabsLinearLayout(Context context, AttributeSet attrs) {
|
||||||
|
super(context, attrs);
|
||||||
|
|
||||||
|
TypedArray a = context.obtainStyledAttributes(attrs, /*com.android.internal.R.styleable.*/R_styleable_LinearLayout);
|
||||||
|
mUseLargestChild = a.getBoolean(/*com.android.internal.R.styleable.*/LinearLayout_measureWithLargestChild, false);
|
||||||
|
|
||||||
|
a.recycle();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When true, all children with a weight will be considered having
|
||||||
|
* the minimum size of the largest child. If false, all children are
|
||||||
|
* measured normally.
|
||||||
|
*
|
||||||
|
* @return True to measure children with a weight using the minimum
|
||||||
|
* size of the largest child, false otherwise.
|
||||||
|
*
|
||||||
|
* @attr ref android.R.styleable#LinearLayout_measureWithLargestChild
|
||||||
|
*/
|
||||||
|
public boolean isMeasureWithLargestChildEnabled() {
|
||||||
|
return mUseLargestChild;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When set to true, all children with a weight will be considered having
|
||||||
|
* the minimum size of the largest child. If false, all children are
|
||||||
|
* measured normally.
|
||||||
|
*
|
||||||
|
* Disabled by default.
|
||||||
|
*
|
||||||
|
* @param enabled True to measure children with a weight using the
|
||||||
|
* minimum size of the largest child, false otherwise.
|
||||||
|
*
|
||||||
|
* @attr ref android.R.styleable#LinearLayout_measureWithLargestChild
|
||||||
|
*/
|
||||||
|
public void setMeasureWithLargestChildEnabled(boolean enabled) {
|
||||||
|
mUseLargestChild = enabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||||
|
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
|
||||||
|
|
||||||
|
final int childCount = getChildCount();
|
||||||
|
if (childCount <= 2) return;
|
||||||
|
|
||||||
|
final int mode = MeasureSpec.getMode(widthMeasureSpec);
|
||||||
|
if (mUseLargestChild && mode == MeasureSpec.UNSPECIFIED) {
|
||||||
|
final int orientation = getOrientation();
|
||||||
|
if (orientation == HORIZONTAL) {
|
||||||
|
useLargestChildHorizontal();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void useLargestChildHorizontal() {
|
||||||
|
final int childCount = getChildCount();
|
||||||
|
|
||||||
|
// Find largest child width
|
||||||
|
int largestChildWidth = 0;
|
||||||
|
for (int i = 0; i < childCount; i++) {
|
||||||
|
final View child = getChildAt(i);
|
||||||
|
largestChildWidth = Math.max(child.getMeasuredWidth(), largestChildWidth);
|
||||||
|
}
|
||||||
|
|
||||||
|
int totalWidth = 0;
|
||||||
|
// Re-measure childs
|
||||||
|
for (int i = 0; i < childCount; i++) {
|
||||||
|
final View child = getChildAt(i);
|
||||||
|
|
||||||
|
if (child == null || child.getVisibility() == View.GONE) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
final LinearLayout.LayoutParams lp =
|
||||||
|
(LinearLayout.LayoutParams) child.getLayoutParams();
|
||||||
|
|
||||||
|
float childExtra = lp.weight;
|
||||||
|
if (childExtra > 0) {
|
||||||
|
child.measure(
|
||||||
|
MeasureSpec.makeMeasureSpec(largestChildWidth,
|
||||||
|
MeasureSpec.EXACTLY),
|
||||||
|
MeasureSpec.makeMeasureSpec(child.getMeasuredHeight(),
|
||||||
|
MeasureSpec.EXACTLY));
|
||||||
|
totalWidth += largestChildWidth;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
totalWidth += child.getMeasuredWidth();
|
||||||
|
}
|
||||||
|
|
||||||
|
totalWidth += lp.leftMargin + lp.rightMargin;
|
||||||
|
}
|
||||||
|
|
||||||
|
totalWidth += getPaddingLeft() + getPaddingRight();
|
||||||
|
setMeasuredDimension(totalWidth, getMeasuredHeight());
|
||||||
|
}
|
||||||
|
}
|
@ -395,7 +395,11 @@ class ActivityChooserView extends ViewGroup implements ActivityChooserModelClien
|
|||||||
super.onAttachedToWindow();
|
super.onAttachedToWindow();
|
||||||
ActivityChooserModel dataModel = mAdapter.getDataModel();
|
ActivityChooserModel dataModel = mAdapter.getDataModel();
|
||||||
if (dataModel != null) {
|
if (dataModel != null) {
|
||||||
|
try {
|
||||||
dataModel.registerObserver(mModelDataSetOberver);
|
dataModel.registerObserver(mModelDataSetOberver);
|
||||||
|
} catch (IllegalStateException e) {
|
||||||
|
// Related to #557.
|
||||||
|
}
|
||||||
}
|
}
|
||||||
mIsAttachedToWindow = true;
|
mIsAttachedToWindow = true;
|
||||||
}
|
}
|
||||||
@ -522,6 +526,9 @@ class ActivityChooserView extends ViewGroup implements ActivityChooserModelClien
|
|||||||
mDefaultActionButtonContentDescription, label);
|
mDefaultActionButtonContentDescription, label);
|
||||||
mDefaultActivityButton.setContentDescription(contentDescription);
|
mDefaultActivityButton.setContentDescription(contentDescription);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Work-around for #415.
|
||||||
|
mAdapter.setShowDefaultActivity(false, false);
|
||||||
} else {
|
} else {
|
||||||
mDefaultActivityButton.setVisibility(View.GONE);
|
mDefaultActivityButton.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
@ -644,7 +651,8 @@ class ActivityChooserView extends ViewGroup implements ActivityChooserModelClien
|
|||||||
|
|
||||||
private int mMaxActivityCount = MAX_ACTIVITY_COUNT_DEFAULT;
|
private int mMaxActivityCount = MAX_ACTIVITY_COUNT_DEFAULT;
|
||||||
|
|
||||||
private boolean mShowDefaultActivity;
|
// Work-around for #415.
|
||||||
|
private boolean mShowDefaultActivity = true;
|
||||||
|
|
||||||
private boolean mHighlightDefaultActivity;
|
private boolean mHighlightDefaultActivity;
|
||||||
|
|
||||||
@ -661,7 +669,11 @@ class ActivityChooserView extends ViewGroup implements ActivityChooserModelClien
|
|||||||
}
|
}
|
||||||
mDataModel = dataModel;
|
mDataModel = dataModel;
|
||||||
if (dataModel != null && isShown()) {
|
if (dataModel != null && isShown()) {
|
||||||
|
try {
|
||||||
dataModel.registerObserver(mModelDataSetOberver);
|
dataModel.registerObserver(mModelDataSetOberver);
|
||||||
|
} catch (IllegalStateException e) {
|
||||||
|
// Related to #557.
|
||||||
|
}
|
||||||
}
|
}
|
||||||
notifyDataSetChanged();
|
notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
|
@ -1623,8 +1623,8 @@ public class SearchView extends LinearLayout implements CollapsibleActionView {
|
|||||||
|
|
||||||
private void forceSuggestionQuery() {
|
private void forceSuggestionQuery() {
|
||||||
try {
|
try {
|
||||||
Method before = SearchAutoComplete.class.getMethod("doBeforeTextChanged");
|
Method before = AutoCompleteTextView.class.getDeclaredMethod("doBeforeTextChanged");
|
||||||
Method after = SearchAutoComplete.class.getMethod("doAfterTextChanged");
|
Method after = AutoCompleteTextView.class.getDeclaredMethod("doAfterTextChanged");
|
||||||
before.setAccessible(true);
|
before.setAccessible(true);
|
||||||
after.setAccessible(true);
|
after.setAccessible(true);
|
||||||
before.invoke(mQueryTextView);
|
before.invoke(mQueryTextView);
|
||||||
|
@ -66,6 +66,7 @@ class SuggestionsAdapter extends ResourceCursorAdapter implements OnClickListene
|
|||||||
static final int REFINE_ALL = 2;
|
static final int REFINE_ALL = 2;
|
||||||
|
|
||||||
private SearchManager mSearchManager;
|
private SearchManager mSearchManager;
|
||||||
|
private SearchableInfo mSearchable;
|
||||||
private SearchView mSearchView;
|
private SearchView mSearchView;
|
||||||
private Context mProviderContext;
|
private Context mProviderContext;
|
||||||
private WeakHashMap<String, Drawable.ConstantState> mOutsideDrawablesCache;
|
private WeakHashMap<String, Drawable.ConstantState> mOutsideDrawablesCache;
|
||||||
@ -94,12 +95,13 @@ class SuggestionsAdapter extends ResourceCursorAdapter implements OnClickListene
|
|||||||
//private static final long DELETE_KEY_POST_DELAY = 500L;
|
//private static final long DELETE_KEY_POST_DELAY = 500L;
|
||||||
|
|
||||||
public SuggestionsAdapter(Context context, SearchView searchView,
|
public SuggestionsAdapter(Context context, SearchView searchView,
|
||||||
SearchableInfo mSearchable, WeakHashMap<String, Drawable.ConstantState> outsideDrawablesCache) {
|
SearchableInfo searchable, WeakHashMap<String, Drawable.ConstantState> outsideDrawablesCache) {
|
||||||
super(context,
|
super(context,
|
||||||
R.layout.abs__search_dropdown_item_icons_2line,
|
R.layout.abs__search_dropdown_item_icons_2line,
|
||||||
null, // no initial cursor
|
null, // no initial cursor
|
||||||
true); // auto-requery
|
true); // auto-requery
|
||||||
mSearchManager = (SearchManager) mContext.getSystemService(Context.SEARCH_SERVICE);
|
mSearchManager = (SearchManager) mContext.getSystemService(Context.SEARCH_SERVICE);
|
||||||
|
mSearchable = searchable;
|
||||||
mProviderContext = mContext;
|
mProviderContext = mContext;
|
||||||
mSearchView = searchView;
|
mSearchView = searchView;
|
||||||
|
|
||||||
@ -199,25 +201,48 @@ class SuggestionsAdapter extends ResourceCursorAdapter implements OnClickListene
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Cursor getSuggestions(String query, int limit) {
|
public Cursor getSuggestions(String query, int limit) {
|
||||||
|
if (mSearchable == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
String authority = mSearchable.getSuggestAuthority();
|
||||||
|
if (authority == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
Uri.Builder uriBuilder = new Uri.Builder()
|
Uri.Builder uriBuilder = new Uri.Builder()
|
||||||
.scheme(ContentResolver.SCHEME_CONTENT)
|
.scheme(ContentResolver.SCHEME_CONTENT)
|
||||||
|
.authority(authority)
|
||||||
.query("") // TODO: Remove, workaround for a bug in Uri.writeToParcel()
|
.query("") // TODO: Remove, workaround for a bug in Uri.writeToParcel()
|
||||||
.fragment(""); // TODO: Remove, workaround for a bug in Uri.writeToParcel()
|
.fragment(""); // TODO: Remove, workaround for a bug in Uri.writeToParcel()
|
||||||
|
|
||||||
|
// if content path provided, insert it now
|
||||||
|
final String contentPath = mSearchable.getSuggestPath();
|
||||||
|
if (contentPath != null) {
|
||||||
|
uriBuilder.appendEncodedPath(contentPath);
|
||||||
|
}
|
||||||
|
|
||||||
// append standard suggestion query path
|
// append standard suggestion query path
|
||||||
uriBuilder.appendPath(SearchManager.SUGGEST_URI_PATH_QUERY);
|
uriBuilder.appendPath(SearchManager.SUGGEST_URI_PATH_QUERY);
|
||||||
|
|
||||||
|
// get the query selection, may be null
|
||||||
|
String selection = mSearchable.getSuggestSelection();
|
||||||
// inject query, either as selection args or inline
|
// inject query, either as selection args or inline
|
||||||
|
String[] selArgs = null;
|
||||||
|
if (selection != null) { // use selection if provided
|
||||||
|
selArgs = new String[] { query };
|
||||||
|
} else { // no selection, use REST pattern
|
||||||
uriBuilder.appendPath(query);
|
uriBuilder.appendPath(query);
|
||||||
|
}
|
||||||
|
|
||||||
if (limit > 0) {
|
if (limit > 0) {
|
||||||
uriBuilder.appendQueryParameter(SearchManager.SUGGEST_PARAMETER_LIMIT, String.valueOf(limit));
|
uriBuilder.appendQueryParameter("limit", String.valueOf(limit));
|
||||||
}
|
}
|
||||||
|
|
||||||
Uri uri = uriBuilder.build();
|
Uri uri = uriBuilder.build();
|
||||||
|
|
||||||
// finally, make the query
|
// finally, make the query
|
||||||
return mContext.getContentResolver().query(uri, null, null, null, null);
|
return mContext.getContentResolver().query(uri, null, selection, selArgs, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void close() {
|
public void close() {
|
||||||
|
@ -1,37 +0,0 @@
|
|||||||
package com.actionbarsherlock.internal;
|
|
||||||
|
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
import static com.actionbarsherlock.internal.ActionBarSherlockCompat.cleanActivityName;
|
|
||||||
import static org.hamcrest.CoreMatchers.equalTo;
|
|
||||||
import static org.junit.Assert.assertThat;
|
|
||||||
|
|
||||||
public class ManifestParsingTest {
|
|
||||||
@Test
|
|
||||||
public void testFullyQualifiedClassName() {
|
|
||||||
String expected = "com.other.package.SomeClass";
|
|
||||||
String actual = cleanActivityName("com.jakewharton.test", "com.other.package.SomeClass");
|
|
||||||
assertThat(expected, equalTo(actual));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testFullyQualifiedClassNameSamePackage() {
|
|
||||||
String expected = "com.jakewharton.test.SomeClass";
|
|
||||||
String actual = cleanActivityName("com.jakewharton.test", "com.jakewharton.test.SomeClass");
|
|
||||||
assertThat(expected, equalTo(actual));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testUnqualifiedClassName() {
|
|
||||||
String expected = "com.jakewharton.test.SomeClass";
|
|
||||||
String actual = cleanActivityName("com.jakewharton.test", "SomeClass");
|
|
||||||
assertThat(expected, equalTo(actual));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testRelativeClassName() {
|
|
||||||
String expected = "com.jakewharton.test.ui.SomeClass";
|
|
||||||
String actual = cleanActivityName("com.jakewharton.test", ".ui.SomeClass");
|
|
||||||
assertThat(expected, equalTo(actual));
|
|
||||||
}
|
|
||||||
}
|
|
@ -0,0 +1,23 @@
|
|||||||
|
package com.actionbarsherlock.internal;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.robolectric.RobolectricTestRunner;
|
||||||
|
|
||||||
|
import static com.actionbarsherlock.internal.ActionBarSherlockCompat.cleanActivityName;
|
||||||
|
import static org.fest.assertions.api.Assertions.assertThat;
|
||||||
|
|
||||||
|
@RunWith(RobolectricTestRunner.class)
|
||||||
|
public class ResourcesCompatTest {
|
||||||
|
@Test
|
||||||
|
public void testCleanActivityName() {
|
||||||
|
assertThat(cleanActivityName("com.jakewharton.test", "com.other.package.SomeClass")) //
|
||||||
|
.isEqualTo("com.other.package.SomeClass");
|
||||||
|
assertThat(cleanActivityName("com.jakewharton.test", "com.jakewharton.test.SomeClass")) //
|
||||||
|
.isEqualTo("com.jakewharton.test.SomeClass");
|
||||||
|
assertThat(cleanActivityName("com.jakewharton.test", "SomeClass")) //
|
||||||
|
.isEqualTo("com.jakewharton.test.SomeClass");
|
||||||
|
assertThat(cleanActivityName("com.jakewharton.test", ".ui.SomeClass")) //
|
||||||
|
.isEqualTo("com.jakewharton.test.ui.SomeClass");
|
||||||
|
}
|
||||||
|
}
|