├── 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 |
--------------------------------------------------------------------------------
/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