├── .classpath
├── .project
├── AndroidManifest.xml
├── README.md
├── proguard-project.txt
├── project.properties
├── res
├── anim
│ └── spinner.xml
├── drawable-hdpi
│ └── ic_launcher.png
├── drawable-ldpi
│ └── ic_launcher.png
├── drawable-mdpi
│ ├── ic_launcher.png
│ ├── progress_hud_bg.xml
│ ├── spinner_0.png
│ ├── spinner_1.png
│ ├── spinner_10.png
│ ├── spinner_11.png
│ ├── spinner_2.png
│ ├── spinner_3.png
│ ├── spinner_4.png
│ ├── spinner_5.png
│ ├── spinner_6.png
│ ├── spinner_7.png
│ ├── spinner_8.png
│ └── spinner_9.png
├── drawable-xhdpi
│ └── ic_launcher.png
├── layout
│ ├── main.xml
│ └── progress_hud.xml
└── values
│ ├── strings.xml
│ └── styles.xml
└── src
└── com
└── walnutlabs
└── android
├── ProgressHUD.java
└── ProgressHUDDemo.java
/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | ProgressHUD
4 |
5 |
6 |
7 |
8 |
9 | com.android.ide.eclipse.adt.ResourceManagerBuilder
10 |
11 |
12 |
13 |
14 | com.android.ide.eclipse.adt.PreCompilerBuilder
15 |
16 |
17 |
18 |
19 | org.eclipse.jdt.core.javabuilder
20 |
21 |
22 |
23 |
24 | com.android.ide.eclipse.adt.ApkBuilder
25 |
26 |
27 |
28 |
29 |
30 | com.android.ide.eclipse.adt.AndroidNature
31 | org.eclipse.jdt.core.javanature
32 |
33 |
34 |
--------------------------------------------------------------------------------
/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
9 |
13 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | AndroidProgressHUD
2 | ==================
3 |
4 | A ProgressHUD similar to https://github.com/jdg/MBProgressHUD but for Android
5 |
--------------------------------------------------------------------------------
/proguard-project.txt:
--------------------------------------------------------------------------------
1 | # To enable ProGuard in your project, edit project.properties
2 | # to define the proguard.config property as described in that file.
3 | #
4 | # Add project specific ProGuard rules here.
5 | # By default, the flags in this file are appended to flags specified
6 | # in ${sdk.dir}/tools/proguard/proguard-android.txt
7 | # You can edit the include path and order by changing the ProGuard
8 | # include property in project.properties.
9 | #
10 | # For more details, see
11 | # http://developer.android.com/guide/developing/tools/proguard.html
12 |
13 | # Add any project specific keep options here:
14 |
15 | # If your project uses WebView with JS, uncomment the following
16 | # and specify the fully qualified class name to the JavaScript interface
17 | # class:
18 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
19 | # public *;
20 | #}
21 |
--------------------------------------------------------------------------------
/project.properties:
--------------------------------------------------------------------------------
1 | # This file is automatically generated by Android Tools.
2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3 | #
4 | # This file must be checked in Version Control Systems.
5 | #
6 | # To customize properties used by the Ant build system edit
7 | # "ant.properties", and override values to adapt the script to your
8 | # project structure.
9 | #
10 | # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
11 | #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
12 |
13 | # Project target.
14 | target=android-8
15 |
--------------------------------------------------------------------------------
/res/anim/spinner.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
7 |
10 |
13 |
16 |
19 |
22 |
25 |
28 |
31 |
34 |
37 |
40 |
--------------------------------------------------------------------------------
/res/drawable-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anupamdhanuka/AndroidProgressHUD/417233972534bcfa88334ab26eb67591fa5b58ac/res/drawable-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/res/drawable-ldpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anupamdhanuka/AndroidProgressHUD/417233972534bcfa88334ab26eb67591fa5b58ac/res/drawable-ldpi/ic_launcher.png
--------------------------------------------------------------------------------
/res/drawable-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anupamdhanuka/AndroidProgressHUD/417233972534bcfa88334ab26eb67591fa5b58ac/res/drawable-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/res/drawable-mdpi/progress_hud_bg.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
11 |
12 |
--------------------------------------------------------------------------------
/res/drawable-mdpi/spinner_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anupamdhanuka/AndroidProgressHUD/417233972534bcfa88334ab26eb67591fa5b58ac/res/drawable-mdpi/spinner_0.png
--------------------------------------------------------------------------------
/res/drawable-mdpi/spinner_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anupamdhanuka/AndroidProgressHUD/417233972534bcfa88334ab26eb67591fa5b58ac/res/drawable-mdpi/spinner_1.png
--------------------------------------------------------------------------------
/res/drawable-mdpi/spinner_10.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anupamdhanuka/AndroidProgressHUD/417233972534bcfa88334ab26eb67591fa5b58ac/res/drawable-mdpi/spinner_10.png
--------------------------------------------------------------------------------
/res/drawable-mdpi/spinner_11.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anupamdhanuka/AndroidProgressHUD/417233972534bcfa88334ab26eb67591fa5b58ac/res/drawable-mdpi/spinner_11.png
--------------------------------------------------------------------------------
/res/drawable-mdpi/spinner_2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anupamdhanuka/AndroidProgressHUD/417233972534bcfa88334ab26eb67591fa5b58ac/res/drawable-mdpi/spinner_2.png
--------------------------------------------------------------------------------
/res/drawable-mdpi/spinner_3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anupamdhanuka/AndroidProgressHUD/417233972534bcfa88334ab26eb67591fa5b58ac/res/drawable-mdpi/spinner_3.png
--------------------------------------------------------------------------------
/res/drawable-mdpi/spinner_4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anupamdhanuka/AndroidProgressHUD/417233972534bcfa88334ab26eb67591fa5b58ac/res/drawable-mdpi/spinner_4.png
--------------------------------------------------------------------------------
/res/drawable-mdpi/spinner_5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anupamdhanuka/AndroidProgressHUD/417233972534bcfa88334ab26eb67591fa5b58ac/res/drawable-mdpi/spinner_5.png
--------------------------------------------------------------------------------
/res/drawable-mdpi/spinner_6.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anupamdhanuka/AndroidProgressHUD/417233972534bcfa88334ab26eb67591fa5b58ac/res/drawable-mdpi/spinner_6.png
--------------------------------------------------------------------------------
/res/drawable-mdpi/spinner_7.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anupamdhanuka/AndroidProgressHUD/417233972534bcfa88334ab26eb67591fa5b58ac/res/drawable-mdpi/spinner_7.png
--------------------------------------------------------------------------------
/res/drawable-mdpi/spinner_8.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anupamdhanuka/AndroidProgressHUD/417233972534bcfa88334ab26eb67591fa5b58ac/res/drawable-mdpi/spinner_8.png
--------------------------------------------------------------------------------
/res/drawable-mdpi/spinner_9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anupamdhanuka/AndroidProgressHUD/417233972534bcfa88334ab26eb67591fa5b58ac/res/drawable-mdpi/spinner_9.png
--------------------------------------------------------------------------------
/res/drawable-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anupamdhanuka/AndroidProgressHUD/417233972534bcfa88334ab26eb67591fa5b58ac/res/drawable-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/res/layout/main.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
14 |
15 |
--------------------------------------------------------------------------------
/res/layout/progress_hud.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
14 |
15 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | ProgressHUD Demo
4 | Simple Indeterminate
5 |
--------------------------------------------------------------------------------
/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
12 |
--------------------------------------------------------------------------------
/src/com/walnutlabs/android/ProgressHUD.java:
--------------------------------------------------------------------------------
1 | package com.walnutlabs.android;
2 |
3 | import android.app.Dialog;
4 | import android.content.Context;
5 | import android.graphics.drawable.AnimationDrawable;
6 | import android.view.Gravity;
7 | import android.view.View;
8 | import android.view.WindowManager;
9 | import android.widget.ImageView;
10 | import android.widget.TextView;
11 |
12 | public class ProgressHUD extends Dialog {
13 | public ProgressHUD(Context context) {
14 | super(context);
15 | }
16 |
17 | public ProgressHUD(Context context, int theme) {
18 | super(context, theme);
19 | }
20 |
21 |
22 | public void onWindowFocusChanged(boolean hasFocus){
23 | ImageView imageView = (ImageView) findViewById(R.id.spinnerImageView);
24 | AnimationDrawable spinner = (AnimationDrawable) imageView.getBackground();
25 | spinner.start();
26 | }
27 |
28 | public void setMessage(CharSequence message) {
29 | if(message != null && message.length() > 0) {
30 | findViewById(R.id.message).setVisibility(View.VISIBLE);
31 | TextView txt = (TextView)findViewById(R.id.message);
32 | txt.setText(message);
33 | txt.invalidate();
34 | }
35 | }
36 |
37 | public static ProgressHUD show(Context context, CharSequence message, boolean indeterminate, boolean cancelable,
38 | OnCancelListener cancelListener) {
39 | ProgressHUD dialog = new ProgressHUD(context,R.style.ProgressHUD);
40 | dialog.setTitle("");
41 | dialog.setContentView(R.layout.progress_hud);
42 | if(message == null || message.length() == 0) {
43 | dialog.findViewById(R.id.message).setVisibility(View.GONE);
44 | } else {
45 | TextView txt = (TextView)dialog.findViewById(R.id.message);
46 | txt.setText(message);
47 | }
48 | dialog.setCancelable(cancelable);
49 | dialog.setOnCancelListener(cancelListener);
50 | dialog.getWindow().getAttributes().gravity=Gravity.CENTER;
51 | WindowManager.LayoutParams lp = dialog.getWindow().getAttributes();
52 | lp.dimAmount=0.2f;
53 | dialog.getWindow().setAttributes(lp);
54 | //dialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
55 | dialog.show();
56 | return dialog;
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/src/com/walnutlabs/android/ProgressHUDDemo.java:
--------------------------------------------------------------------------------
1 | package com.walnutlabs.android;
2 |
3 | import android.app.Activity;
4 | import android.content.DialogInterface;
5 | import android.content.DialogInterface.OnCancelListener;
6 | import android.os.AsyncTask;
7 | import android.os.Bundle;
8 | import android.view.View;
9 |
10 | public class ProgressHUDDemo extends Activity {
11 | @Override
12 | public void onCreate(Bundle savedInstanceState) {
13 | super.onCreate(savedInstanceState);
14 | setContentView(R.layout.main);
15 | }
16 |
17 | public void showSimpleIndeterminate(View v) {
18 | TimeConsumingTask t = new TimeConsumingTask();
19 | t.execute();
20 | }
21 |
22 |
23 | public class TimeConsumingTask extends AsyncTask implements OnCancelListener {
24 | ProgressHUD mProgressHUD;
25 |
26 | @Override
27 | protected void onPreExecute() {
28 | mProgressHUD = ProgressHUD.show(ProgressHUDDemo.this,"Connecting", true,true,this);
29 | super.onPreExecute();
30 | }
31 |
32 | @Override
33 | protected Void doInBackground(Void... params) {
34 | try {
35 | publishProgress("Connecting");
36 | Thread.sleep(2000);
37 | publishProgress("Downloading");
38 | Thread.sleep(5000);
39 | publishProgress("Done");
40 | } catch (InterruptedException e) {
41 | e.printStackTrace();
42 | }
43 | return null;
44 | }
45 |
46 | @Override
47 | protected void onProgressUpdate(String... values) {
48 | mProgressHUD.setMessage(values[0]);
49 | super.onProgressUpdate(values);
50 | }
51 |
52 | @Override
53 | protected void onPostExecute(Void result) {
54 | mProgressHUD.dismiss();
55 | super.onPostExecute(result);
56 | }
57 |
58 | @Override
59 | public void onCancel(DialogInterface dialog) {
60 | this.cancel(true);
61 | mProgressHUD.dismiss();
62 | }
63 | }
64 |
65 | }
66 |
--------------------------------------------------------------------------------