├── sample ├── .gitignore ├── src │ └── main │ │ ├── res │ │ ├── drawable-hdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_action_refresh.png │ │ ├── drawable-mdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_action_refresh.png │ │ ├── drawable-xhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_action_refresh.png │ │ ├── drawable-xxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_action_refresh.png │ │ ├── values │ │ │ ├── styles.xml │ │ │ ├── dimens.xml │ │ │ └── strings.xml │ │ ├── menu │ │ │ └── refresh_menu.xml │ │ └── layout │ │ │ └── activity_main.xml │ │ ├── AndroidManifest.xml │ │ └── java │ │ └── progress │ │ └── menu │ │ └── item │ │ └── sample │ │ ├── ReloadAsyncTask.java │ │ └── MainActivity.java ├── build.gradle └── proguard-rules.txt ├── library ├── .gitignore ├── gradle.properties ├── src │ └── main │ │ ├── AndroidManifest.xml │ │ ├── res │ │ ├── values │ │ │ └── dimens.xml │ │ └── layout │ │ │ ├── menu_item_progress.xml │ │ │ └── menu_item_progress_large.xml │ │ └── java │ │ └── progress │ │ └── menu │ │ └── item │ │ ├── ProgressMenuItemSize.java │ │ ├── ReferenceHelper.java │ │ └── ProgressMenuItemHelper.java └── build.gradle ├── settings.gradle ├── .gitignore ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradle.properties ├── .travis.yml ├── gradlew.bat ├── README.md └── gradlew /sample/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /library/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':library', ':sample' 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .gradle 2 | local.properties 3 | 4 | .idea/ 5 | *.iml 6 | 7 | build/ 8 | 9 | .DS_Store -------------------------------------------------------------------------------- /library/gradle.properties: -------------------------------------------------------------------------------- 1 | POM_NAME=ProgressMenuItem 2 | POM_ARTIFACT_ID=ProgressMenuItem 3 | POM_PACKAGING=aar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hotchemi/ProgressMenuItem/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /library/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /sample/src/main/res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hotchemi/ProgressMenuItem/HEAD/sample/src/main/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hotchemi/ProgressMenuItem/HEAD/sample/src/main/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hotchemi/ProgressMenuItem/HEAD/sample/src/main/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hotchemi/ProgressMenuItem/HEAD/sample/src/main/res/drawable-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-hdpi/ic_action_refresh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hotchemi/ProgressMenuItem/HEAD/sample/src/main/res/drawable-hdpi/ic_action_refresh.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-mdpi/ic_action_refresh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hotchemi/ProgressMenuItem/HEAD/sample/src/main/res/drawable-mdpi/ic_action_refresh.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-xhdpi/ic_action_refresh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hotchemi/ProgressMenuItem/HEAD/sample/src/main/res/drawable-xhdpi/ic_action_refresh.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-xxhdpi/ic_action_refresh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hotchemi/ProgressMenuItem/HEAD/sample/src/main/res/drawable-xxhdpi/ic_action_refresh.png -------------------------------------------------------------------------------- /library/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 32dp 4 | 48dp 5 | -------------------------------------------------------------------------------- /sample/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /sample/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 6 | -------------------------------------------------------------------------------- /library/src/main/java/progress/menu/item/ProgressMenuItemSize.java: -------------------------------------------------------------------------------- 1 | package progress.menu.item; 2 | 3 | public final class ProgressMenuItemSize { 4 | 5 | public static final int LARGE = 1; 6 | 7 | private ProgressMenuItemSize() { 8 | } 9 | 10 | } -------------------------------------------------------------------------------- /sample/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | ProgressMenuItem Sample 4 | Hello world! 5 | Refresh 6 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Mon Jul 11 13:08:30 JST 2016 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip 7 | -------------------------------------------------------------------------------- /library/src/main/java/progress/menu/item/ReferenceHelper.java: -------------------------------------------------------------------------------- 1 | package progress.menu.item; 2 | 3 | import java.lang.ref.Reference; 4 | 5 | final class ReferenceHelper { 6 | 7 | private ReferenceHelper() { 8 | } 9 | 10 | static boolean isNotNull(Reference reference) { 11 | return reference != null && reference.get() != null; 12 | } 13 | 14 | } -------------------------------------------------------------------------------- /library/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | 3 | android { 4 | compileSdkVersion 24 5 | buildToolsVersion '21.1.2' 6 | 7 | defaultConfig { 8 | minSdkVersion 9 9 | targetSdkVersion 24 10 | } 11 | } 12 | 13 | dependencies { 14 | compile "com.android.support:support-v4:24.0.0" 15 | } 16 | 17 | apply from: 'https://raw.github.com/chrisbanes/gradle-mvn-push/master/gradle-mvn-push.gradle' -------------------------------------------------------------------------------- /library/src/main/res/layout/menu_item_progress.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 10 | 11 | -------------------------------------------------------------------------------- /sample/src/main/res/menu/refresh_menu.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 11 | -------------------------------------------------------------------------------- /library/src/main/res/layout/menu_item_progress_large.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 10 | 11 | -------------------------------------------------------------------------------- /sample/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 23 5 | buildToolsVersion '21.1.2' 6 | 7 | defaultConfig { 8 | minSdkVersion 9 9 | targetSdkVersion 23 10 | versionCode 1 11 | versionName "1.0" 12 | } 13 | buildTypes { 14 | release { 15 | minifyEnabled false 16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' 17 | } 18 | } 19 | } 20 | 21 | dependencies { 22 | compile 'com.android.support:appcompat-v7:23.+' 23 | compile project(':library') 24 | } 25 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | VERSION_NAME=0.3.4 2 | VERSION_CODE=7 3 | GROUP=com.github.hotchemi 4 | POM_DESCRIPTION=Helper library about Showing and stopping a progress in the ActionBar. 5 | POM_URL=https://github.com/hotchemi/ProgressMenu 6 | POM_SCM_URL=https://github.com/hotchemi/ProgressMenuItem 7 | POM_SCM_CONNECTION=scm:git@github.com:hotchemi/ProgressMenuItem.git 8 | POM_SCM_DEV_CONNECTION=scm:git@github.com:hotchemi/ProgressMenuItem.git 9 | POM_LICENCE_NAME=The Apache Software License, Version 2.0 10 | POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt 11 | POM_LICENCE_DIST=repo 12 | POM_DEVELOPER_ID=hotchemi 13 | POM_DEVELOPER_NAME=Shintaro Katafuchi -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: android 2 | jdk: oraclejdk7 3 | env: 4 |   matrix: 5 |     - ANDROID_TARGET=android-19 ANDROID_ABI=armeabi-v7a 6 | 7 | android: 8 |   components: 9 |     - build-tools-19.1.0 10 | 11 | before_install: 12 | - echo yes | android update sdk --filter platform-tools --no-ui --force 13 | - echo yes | android update sdk --all --filter build-tools-19.1.0 --no-ui --force 14 | 15 | before_script: 16 |   # Create and start emulator 17 |   - echo no | android create avd --force -n test -t $ANDROID_TARGET --abi $ANDROID_ABI 18 |   - emulator -avd test -no-skin -no-audio -no-window & 19 |   - adb wait-for-device 20 |   - adb shell input keyevent 82 & 21 | 22 | script: 23 | - chmod +x gradlew 24 | - ./gradlew assemble -------------------------------------------------------------------------------- /sample/proguard-rules.txt: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Applications/adt-bundle-mac-x86_64-20130729/sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the ProGuard 5 | # include property in project.properties. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} -------------------------------------------------------------------------------- /sample/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 10 | 11 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /sample/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 11 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /sample/src/main/java/progress/menu/item/sample/ReloadAsyncTask.java: -------------------------------------------------------------------------------- 1 | package progress.menu.item.sample; 2 | 3 | import android.os.AsyncTask; 4 | import android.util.Log; 5 | 6 | import progress.menu.item.ProgressMenuItemHelper; 7 | 8 | public class ReloadAsyncTask extends AsyncTask { 9 | 10 | private ProgressMenuItemHelper progressHelper; 11 | 12 | public ReloadAsyncTask(ProgressMenuItemHelper progressHelper) { 13 | this.progressHelper = progressHelper; 14 | } 15 | 16 | @Override 17 | protected void onPreExecute() { 18 | super.onPreExecute(); 19 | progressHelper.startProgress(); 20 | } 21 | 22 | @Override 23 | protected Void doInBackground(Void... params) { 24 | try { 25 | Thread.sleep(3000); 26 | } catch (final InterruptedException e) { 27 | Log.d(getClass().getCanonicalName(), e.toString()); 28 | } 29 | return null; 30 | } 31 | 32 | @Override 33 | protected void onPostExecute(Void aVoid) { 34 | super.onPostExecute(aVoid); 35 | progressHelper.stopProgress(); 36 | } 37 | 38 | } -------------------------------------------------------------------------------- /sample/src/main/java/progress/menu/item/sample/MainActivity.java: -------------------------------------------------------------------------------- 1 | package progress.menu.item.sample; 2 | 3 | import android.os.Bundle; 4 | import android.support.v7.app.ActionBarActivity; 5 | import android.view.Menu; 6 | import android.view.MenuItem; 7 | 8 | import progress.menu.item.ProgressMenuItemHelper; 9 | import progress.menu.item.ProgressMenuItemSize; 10 | 11 | public class MainActivity extends ActionBarActivity { 12 | 13 | private ProgressMenuItemHelper progressHelper; 14 | 15 | @Override 16 | protected void onCreate(Bundle savedInstanceState) { 17 | super.onCreate(savedInstanceState); 18 | setContentView(R.layout.activity_main); 19 | } 20 | 21 | @Override 22 | public boolean onCreateOptionsMenu(Menu menu) { 23 | getMenuInflater().inflate(R.menu.refresh_menu, menu); 24 | progressHelper = new ProgressMenuItemHelper(menu, R.id.action_refresh, ProgressMenuItemSize.LARGE); 25 | return true; 26 | } 27 | 28 | @Override 29 | public boolean onOptionsItemSelected(MenuItem item) { 30 | switch (item.getItemId()) { 31 | case R.id.action_refresh: 32 | new ReloadAsyncTask(progressHelper).execute(); 33 | return true; 34 | default: 35 | return super.onOptionsItemSelected(item); 36 | } 37 | } 38 | 39 | } -------------------------------------------------------------------------------- /library/src/main/java/progress/menu/item/ProgressMenuItemHelper.java: -------------------------------------------------------------------------------- 1 | package progress.menu.item; 2 | 3 | import android.support.v4.view.MenuItemCompat; 4 | import android.view.Menu; 5 | import android.view.MenuItem; 6 | 7 | import java.lang.ref.Reference; 8 | import java.lang.ref.WeakReference; 9 | 10 | public class ProgressMenuItemHelper { 11 | 12 | private Reference menuItemReference; 13 | 14 | private int resourceId = R.layout.menu_item_progress; 15 | 16 | private ProgressMenuItemHelper() { 17 | } 18 | 19 | public ProgressMenuItemHelper(Menu menu, int resourceId) { 20 | this(menu.findItem(resourceId)); 21 | } 22 | 23 | public ProgressMenuItemHelper(Menu menu, int resourceId, int progressSize) { 24 | this(menu.findItem(resourceId), progressSize); 25 | } 26 | 27 | public ProgressMenuItemHelper(MenuItem menuItem) { 28 | menuItemReference = new WeakReference(menuItem); 29 | } 30 | 31 | public ProgressMenuItemHelper(MenuItem menuItem, int progressSize) { 32 | this(menuItem); 33 | if (progressSize == ProgressMenuItemSize.LARGE) { 34 | resourceId = R.layout.menu_item_progress_large; 35 | } 36 | } 37 | 38 | public void setResourceId(int resourceId) { 39 | this.resourceId = resourceId; 40 | } 41 | 42 | public void startProgress() { 43 | if (ReferenceHelper.isNotNull(menuItemReference)) { 44 | MenuItemCompat.setActionView(menuItemReference.get(), resourceId); 45 | } 46 | } 47 | 48 | public void stopProgress() { 49 | if (ReferenceHelper.isNotNull(menuItemReference)) { 50 | MenuItemCompat.setActionView(menuItemReference.get(), null); 51 | } 52 | } 53 | 54 | } -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ProgressMenuItem 2 | ================ 3 | 4 | [![Build Status](https://travis-ci.org/hotchemi/ProgressMenuItem.png?branch=master)](https://travis-ci.org/hotchemi/ProgressMenuItem) 5 | [![Android Arsenal](http://img.shields.io/badge/Android%20Arsenal-ProgressMenuItem-brightgreen.svg?style=flat)](http://android-arsenal.com/details/1/845) 6 | 7 | Helper library about Showing and stopping a progress in the ActionBar. 8 | 9 | ![gif](http://gifzo.net/BO3wY1zTTkb.gif) 10 | 11 | ## Download 12 | 13 | ![Maven Badges](https://maven-badges.herokuapp.com/maven-central/com.github.hotchemi/ProgressMenuItem/badge.svg) 14 | 15 | Download from maven central. 16 | 17 | ```groovy 18 | dependencies { 19 | compile 'com.github.hotchemi:ProgressMenuItem:{$latest.version}' 20 | } 21 | ``` 22 | 23 | ## How to use 24 | 25 | [![javadoc.io](https://javadocio-badges.herokuapp.com/com.github.hotchemi/ProgressMenuItem/badge.svg)](http://www.javadoc.io/doc/com.github.hotchemi/ProgressMenuItem/) 26 | 27 | ### Initialize 28 | 29 | Simple in your Activity or Fragment's `onCreateOptionsMenu` method instantiate it. 30 | 31 | Specifies a menu id to be progressed by the second argument. 32 | 33 | ```java 34 | private ProgressMenuItemHelper progressHelper; 35 | 36 | @Override 37 | public boolean onCreateOptionsMenu(Menu menu) { 38 | getMenuInflater().inflate(R.menu.refresh_menu, menu); 39 | progressHelper = new ProgressMenuItemHelper(menu, R.id.action_refresh); 40 | // or 41 | progressHelper = new ProgressMenuItemHelper(menu.findItem(R.id.action_refresh)); 42 | return true; 43 | } 44 | ``` 45 | 46 | ### Start progress 47 | 48 | ``` java 49 | progressHelper.startProgress(); 50 | ``` 51 | 52 | ### Stop progress 53 | 54 | ``` java 55 | progressHelper.stopProgress(); 56 | ``` 57 | 58 | ### Use large progress 59 | 60 | ```java 61 | private ProgressMenuItemHelper progressHelper; 62 | 63 | @Override 64 | public boolean onCreateOptionsMenu(Menu menu) { 65 | getMenuInflater().inflate(R.menu.refresh_menu, menu); 66 | progressHelper = new ProgressMenuItemHelper(menu, R.id.action_refresh, ProgressMenuSize.LARGE); 67 | return true; 68 | } 69 | ``` 70 | 71 | ### Override progress 72 | 73 | Call `setResourceId(int resId)` and set your custom layout. 74 | 75 | ``` java 76 | progressHelper.setResourceId(R.layout.my_menu_item_progress); 77 | ``` 78 | 79 | ## Sample 80 | 81 | Please try to move the [sample](https://github.com/hotchemi/ProgressMenuItem/tree/master/sample/). 82 | 83 | ## Requirements 84 | 85 | Supports Android 2.1 or greater. 86 | 87 | ## Contribute 88 | 89 | 1. Fork it 90 | 2. Create your feature branch (`git checkout -b my-new-feature`) 91 | 3. Commit your changes (`git commit -am 'Added some feature'`) 92 | 4. Push to the branch (`git push origin my-new-feature`) 93 | 5. Create new Pull Request 94 | 95 | ## Inspired 96 | 97 | ProgressMenuItem is inspired by [RefreshMenuItem](https://github.com/nicolasjafelle/RefreshMenuItem). 98 | 99 | But ProgressMenuItem has some merits: 100 | 101 | - Supports Android 2.1 or greater. 102 | - ProgressMenuItem's Interface is more simple. 103 | 104 | ## ChangeLog 105 | 106 | - 2014/07/03 0.3.3 release. 107 | - 2014/06/22 0.3.2 release. 108 | - 2014/05/25 0.3.1 release. 109 | - 2014/05/18 0.3.0 release. 110 | - 2014/05/11 0.2.0 release. 111 | - 2014/05/04 0.1.0 release. 112 | 113 | ## Used 114 | 115 | - [Fril](https://play.google.com/store/apps/details?id=jp.co.fablic.fril) 116 | 117 | ## Licence 118 | 119 | ``` 120 | Copyright 2014 Shintaro Katafuchi 121 | 122 | Licensed under the Apache License, Version 2.0 (the "License"); 123 | you may not use this file except in compliance with the License. 124 | You may obtain a copy of the License at 125 | 126 | http://www.apache.org/licenses/LICENSE-2.0 127 | 128 | Unless required by applicable law or agreed to in writing, software 129 | distributed under the License is distributed on an "AS IS" BASIS, 130 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 131 | See the License for the specific language governing permissions and 132 | limitations under the License. 133 | ``` 134 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # For Cygwin, ensure paths are in UNIX format before anything is touched. 46 | if $cygwin ; then 47 | [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` 48 | fi 49 | 50 | # Attempt to set APP_HOME 51 | # Resolve links: $0 may be a link 52 | PRG="$0" 53 | # Need this for relative symlinks. 54 | while [ -h "$PRG" ] ; do 55 | ls=`ls -ld "$PRG"` 56 | link=`expr "$ls" : '.*-> \(.*\)$'` 57 | if expr "$link" : '/.*' > /dev/null; then 58 | PRG="$link" 59 | else 60 | PRG=`dirname "$PRG"`"/$link" 61 | fi 62 | done 63 | SAVED="`pwd`" 64 | cd "`dirname \"$PRG\"`/" >&- 65 | APP_HOME="`pwd -P`" 66 | cd "$SAVED" >&- 67 | 68 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 69 | 70 | # Determine the Java command to use to start the JVM. 71 | if [ -n "$JAVA_HOME" ] ; then 72 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 73 | # IBM's JDK on AIX uses strange locations for the executables 74 | JAVACMD="$JAVA_HOME/jre/sh/java" 75 | else 76 | JAVACMD="$JAVA_HOME/bin/java" 77 | fi 78 | if [ ! -x "$JAVACMD" ] ; then 79 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 80 | 81 | Please set the JAVA_HOME variable in your environment to match the 82 | location of your Java installation." 83 | fi 84 | else 85 | JAVACMD="java" 86 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 87 | 88 | Please set the JAVA_HOME variable in your environment to match the 89 | location of your Java installation." 90 | fi 91 | 92 | # Increase the maximum file descriptors if we can. 93 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 94 | MAX_FD_LIMIT=`ulimit -H -n` 95 | if [ $? -eq 0 ] ; then 96 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 97 | MAX_FD="$MAX_FD_LIMIT" 98 | fi 99 | ulimit -n $MAX_FD 100 | if [ $? -ne 0 ] ; then 101 | warn "Could not set maximum file descriptor limit: $MAX_FD" 102 | fi 103 | else 104 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 105 | fi 106 | fi 107 | 108 | # For Darwin, add options to specify how the application appears in the dock 109 | if $darwin; then 110 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 111 | fi 112 | 113 | # For Cygwin, switch paths to Windows format before running java 114 | if $cygwin ; then 115 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 116 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 158 | function splitJvmOpts() { 159 | JVM_OPTS=("$@") 160 | } 161 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 162 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 163 | 164 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 165 | --------------------------------------------------------------------------------