├── .gitignore ├── .gradle └── 1.11 │ └── taskArtifacts │ ├── cache.properties │ ├── cache.properties.lock │ ├── fileSnapshots.bin │ ├── outputFileStates.bin │ └── taskArtifacts.bin ├── LICENSE ├── README.md ├── SimpleHUD ├── .classpath ├── .project ├── AndroidManifest.xml ├── proguard-project.txt ├── project.properties ├── res │ ├── anim │ │ └── progressbar.xml │ ├── drawable-xhdpi │ │ ├── simplehud_bg.xml │ │ ├── simplehud_error.png │ │ ├── simplehud_info.png │ │ ├── simplehud_spinner.png │ │ └── simplehud_success.png │ ├── layout │ │ └── simplehud.xml │ ├── values-v11 │ │ └── styles.xml │ ├── values-v14 │ │ └── styles.xml │ └── values │ │ ├── strings.xml │ │ └── styles.xml └── src │ └── info │ └── wangchen │ └── simplehud │ ├── SimpleHUD.java │ └── SimpleHUDDialog.java ├── SimpleHUDDemo ├── .classpath ├── .project ├── AndroidManifest.xml ├── libs │ └── android-support-v4.jar ├── proguard-project.txt ├── project.properties ├── res │ ├── drawable-hdpi │ │ └── ic_launcher.png │ ├── drawable-mdpi │ │ └── ic_launcher.png │ ├── drawable-xhdpi │ │ └── ic_launcher.png │ ├── layout │ │ └── activity_main.xml │ ├── values-sw600dp │ │ └── dimens.xml │ ├── values-sw720dp-land │ │ └── dimens.xml │ ├── values-v11 │ │ └── styles.xml │ ├── values-v14 │ │ └── styles.xml │ └── values │ │ ├── dimens.xml │ │ ├── strings.xml │ │ └── styles.xml └── src │ └── info │ └── wangchen │ └── simplehuddemo │ └── MainActivity.java └── screenshots └── screenshot.png /.gitignore: -------------------------------------------------------------------------------- 1 | .gradle/ 2 | SimpleHUD/bin/ 3 | SimpleHUD/gen/ 4 | SimpleHUD/gradle/ 5 | SimpleHUD/build/ 6 | SimpleHUDDemo/bin/ 7 | SimpleHUDDemo/gen/ 8 | SimpleHUDDemo/gradle/ 9 | SimpleHUDDemo/build/ 10 | -------------------------------------------------------------------------------- /.gradle/1.11/taskArtifacts/cache.properties: -------------------------------------------------------------------------------- 1 | #Sun Sep 14 19:44:10 CST 2014 2 | -------------------------------------------------------------------------------- /.gradle/1.11/taskArtifacts/cache.properties.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangvsa/SimpleHUD/1132befd7893795ad39752d2601f8a8f7fcb8806/.gradle/1.11/taskArtifacts/cache.properties.lock -------------------------------------------------------------------------------- /.gradle/1.11/taskArtifacts/fileSnapshots.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangvsa/SimpleHUD/1132befd7893795ad39752d2601f8a8f7fcb8806/.gradle/1.11/taskArtifacts/fileSnapshots.bin -------------------------------------------------------------------------------- /.gradle/1.11/taskArtifacts/outputFileStates.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangvsa/SimpleHUD/1132befd7893795ad39752d2601f8a8f7fcb8806/.gradle/1.11/taskArtifacts/outputFileStates.bin -------------------------------------------------------------------------------- /.gradle/1.11/taskArtifacts/taskArtifacts.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangvsa/SimpleHUD/1132befd7893795ad39752d2601f8a8f7fcb8806/.gradle/1.11/taskArtifacts/taskArtifacts.bin -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 王辰 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | SimpleHUD 2 | ========= 3 | 4 | SimpleHUD is an easy-to-use yet beautiful HUD for android. 5 | 6 | ![截图](https://raw.githubusercontent.com/wangvsa/SimpleHUD/master/screenshots/screenshot.png) 7 | 8 | ## Installation 9 | 10 | ### Android Studio 11 | 12 | Add the following line into the dependencies block. 13 | ```bash 14 | compile group:'info.wangchen', name:'SimpleHUD', version:'1.0' 15 | ``` 16 | 17 | ### Eclipse 18 | 1. Clone or download SimpleHUD if you haven't yet. 19 | 2. Import SimpleHUD project. 20 | 3. Add SimpleHUD as a dependency to your existing project and you're good to go. 21 | 22 | 23 | 24 | 25 | 26 | ## Usage 27 | 28 | (See sample project in /SimpleHUDDemo) 29 | 30 | The HUD is created as singleton so you can just use a static method like `showSuccessMessage()` to show a HUD. 31 | If there's an existing HUD, it will be dismissed and show the new one. 32 | 33 | ### Showing the loading dialog 34 | 35 | ```java 36 | SimpleHUD.showLoadingMessage(this, "loading data, please wait...", true); 37 | ``` 38 | 39 | Note the third parameter `boolean cancelable`, if you set it to `true` then you can tap the back button to cancel the HUD. 40 | 41 | When your operation is completed, call `dismiss()` method to dismiss it. 42 | ```java 43 | SimpleHUD.dismiss(); 44 | ``` 45 | 46 | ### Showing the message dialog 47 | 48 | The next three HUD are the same except the icon. 49 | It will dismiss itself so no need to to invoke `dimiss()` explicitly. 50 | 51 | ```java 52 | SimpleHUD.showInfoMessage(this, "This is a info message."); 53 | SimpleHUD.showErrorMessage(this, "This ia an error message."); 54 | SimpleHUD.showSuccessMessage(this, "This ia a success message."); 55 | ``` 56 | 57 | ### Invoke your method when the HUD dimisses 58 | 59 | Create an object of the `SimpleHUDCallback` interface and implement its `onSimpleHUDDismissed` method. 60 | Then pass it to SimpleHUD as an argument. Here's an example: 61 | 62 | ```java 63 | private SimpleHUDCallback simplehudCallback = new SimpleHUDCallback() { 64 | @Override 65 | public void onSimpleHUDDismissed() { 66 | // your code goes here... 67 | } 68 | }; 69 | SimpleHUD.showInfoMessage(this, "This is a info message.", simplehudCallback); 70 | // SimpleHUD.showErrorMessage(this, "This ia an error message.", simplehudCallback); 71 | // SimpleHUD.showSuccessMessage(this, "This ia a success message.", simplehudCallback); 72 | ``` 73 | 74 | 75 | ## Customization 76 | 77 | ### Change the display time 78 | 79 | Set the variable `dismissDelay` to one of the three constants. 80 | ```java 81 | SimpleHUD.dismissDelay = SimpleHUD.DISMISS_DELAY_SHORT; // 2s 82 | SimpleHUD.dismissDelay = SimpleHUD.DISMISS_DELAY_MIDIUM; // 4s 83 | SimpleHUD.dismissDelay = SimpleHUD.DISMISS_DELAY_LONG; // 6s 84 | ``` 85 | 86 | Or a arbitrary value. 87 | ```java 88 | SimpleHUD.dismissDelay = 8000; // 8s 89 | ``` 90 | 91 | ### Change the icon 92 | 93 | There are three icons in drawable folder, you can replace them using your own icons with the same name. 94 | -------------------------------------------------------------------------------- /SimpleHUD/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /SimpleHUD/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | SimpleHUD 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 | -------------------------------------------------------------------------------- /SimpleHUD/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 9 | 10 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /SimpleHUD/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 | -------------------------------------------------------------------------------- /SimpleHUD/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-19 15 | android.library=true 16 | -------------------------------------------------------------------------------- /SimpleHUD/res/anim/progressbar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 13 | -------------------------------------------------------------------------------- /SimpleHUD/res/drawable-xhdpi/simplehud_bg.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /SimpleHUD/res/drawable-xhdpi/simplehud_error.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangvsa/SimpleHUD/1132befd7893795ad39752d2601f8a8f7fcb8806/SimpleHUD/res/drawable-xhdpi/simplehud_error.png -------------------------------------------------------------------------------- /SimpleHUD/res/drawable-xhdpi/simplehud_info.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangvsa/SimpleHUD/1132befd7893795ad39752d2601f8a8f7fcb8806/SimpleHUD/res/drawable-xhdpi/simplehud_info.png -------------------------------------------------------------------------------- /SimpleHUD/res/drawable-xhdpi/simplehud_spinner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangvsa/SimpleHUD/1132befd7893795ad39752d2601f8a8f7fcb8806/SimpleHUD/res/drawable-xhdpi/simplehud_spinner.png -------------------------------------------------------------------------------- /SimpleHUD/res/drawable-xhdpi/simplehud_success.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangvsa/SimpleHUD/1132befd7893795ad39752d2601f8a8f7fcb8806/SimpleHUD/res/drawable-xhdpi/simplehud_success.png -------------------------------------------------------------------------------- /SimpleHUD/res/layout/simplehud.xml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 13 | 14 | 21 | 22 | -------------------------------------------------------------------------------- /SimpleHUD/res/values-v11/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /SimpleHUD/res/values-v14/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /SimpleHUD/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | SimpleHUD 4 | 5 | 6 | -------------------------------------------------------------------------------- /SimpleHUD/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /SimpleHUD/src/info/wangchen/simplehud/SimpleHUD.java: -------------------------------------------------------------------------------- 1 | package info.wangchen.simplehud; 2 | 3 | import android.app.Activity; 4 | import android.content.Context; 5 | import android.os.Handler; 6 | import android.os.Message; 7 | 8 | public class SimpleHUD { 9 | 10 | private static SimpleHUDDialog dialog; 11 | private static Context context; 12 | private static SimpleHUDCallback callback; 13 | 14 | public static int dismissDelay = SimpleHUD.DISMISS_DELAY_SHORT; 15 | public static final int DISMISS_DELAY_SHORT = 2000; 16 | public static final int DISMISS_DELAY_MIDIUM = 4000; 17 | public static final int DISMISS_DELAY_LONG = 6000; 18 | 19 | 20 | 21 | 22 | public static void showLoadingMessage(Context context, String msg, boolean cancelable, SimpleHUDCallback callback) { 23 | SimpleHUD.callback = callback; 24 | showLoadingMessage(context, msg, cancelable); 25 | } 26 | public static void showLoadingMessage(Context context, String msg, boolean cancelable) { 27 | dismiss(); 28 | setDialog(context, msg, R.drawable.simplehud_spinner, cancelable); 29 | if(dialog!=null) dialog.show(); 30 | } 31 | 32 | 33 | public static void showErrorMessage(Context context, String msg, SimpleHUDCallback callback) { 34 | SimpleHUD.callback = callback; 35 | showErrorMessage(context, msg); 36 | } 37 | public static void showErrorMessage(Context context, String msg) { 38 | dismiss(); 39 | setDialog(context, msg, R.drawable.simplehud_error, true); 40 | if(dialog!=null) { 41 | dialog.show(); 42 | dismissAfterSeconds(); 43 | } 44 | } 45 | 46 | 47 | public static void showSuccessMessage(Context context, String msg, SimpleHUDCallback callback) { 48 | SimpleHUD.callback = callback; 49 | showSuccessMessage(context, msg); 50 | } 51 | public static void showSuccessMessage(Context context, String msg) { 52 | dismiss(); 53 | setDialog(context, msg, R.drawable.simplehud_success, true); 54 | if(dialog!=null) { 55 | dialog.show(); 56 | dismissAfterSeconds(); 57 | } 58 | } 59 | 60 | public static void showInfoMessage(Context context, String msg, SimpleHUDCallback callback) { 61 | SimpleHUD.callback = callback; 62 | showInfoMessage(context, msg); 63 | } 64 | public static void showInfoMessage(Context context, String msg) { 65 | dismiss(); 66 | setDialog(context, msg, R.drawable.simplehud_info, true); 67 | if(dialog!=null) { 68 | dialog.show(); 69 | dismissAfterSeconds(); 70 | } 71 | } 72 | 73 | 74 | 75 | 76 | private static void setDialog(Context ctx, String msg, int resId, boolean cancelable) { 77 | context = ctx; 78 | 79 | if(!isContextValid()) 80 | return; 81 | 82 | dialog = SimpleHUDDialog.createDialog(ctx); 83 | dialog.setMessage(msg); 84 | dialog.setImage(ctx, resId); 85 | dialog.setCanceledOnTouchOutside(false); 86 | dialog.setCancelable(cancelable); // back键是否可dimiss对话框 87 | } 88 | 89 | public static void dismiss() { 90 | if(isContextValid() && dialog!=null && dialog.isShowing()) 91 | dialog.dismiss(); 92 | dialog = null; 93 | } 94 | 95 | 96 | /** 97 | * 计时关闭对话框 98 | * 99 | */ 100 | private static void dismissAfterSeconds() { 101 | new Thread(new Runnable() { 102 | @Override 103 | public void run() { 104 | try { 105 | Thread.sleep(dismissDelay); 106 | handler.sendEmptyMessage(0); 107 | } catch (InterruptedException e) { 108 | e.printStackTrace(); 109 | } 110 | } 111 | }).start(); 112 | } 113 | 114 | 115 | private static Handler handler = new Handler() { 116 | public void handleMessage(Message msg) { 117 | if(msg.what==0) { 118 | dismiss(); 119 | if(SimpleHUD.callback!=null) { 120 | callback.onSimpleHUDDismissed(); 121 | callback = null; 122 | } 123 | } 124 | }; 125 | }; 126 | 127 | 128 | /** 129 | * 判断parent view是否还存在 130 | * 若不存在不能调用dismis,或setDialog等方法 131 | * @return 132 | */ 133 | private static boolean isContextValid() { 134 | if(context==null) 135 | return false; 136 | if(context instanceof Activity) { 137 | Activity act = (Activity)context; 138 | if(act.isFinishing()) 139 | return false; 140 | } 141 | return true; 142 | } 143 | 144 | 145 | public static interface SimpleHUDCallback { 146 | public void onSimpleHUDDismissed(); 147 | } 148 | } 149 | -------------------------------------------------------------------------------- /SimpleHUD/src/info/wangchen/simplehud/SimpleHUDDialog.java: -------------------------------------------------------------------------------- 1 | package info.wangchen.simplehud; 2 | 3 | import android.app.Dialog; 4 | import android.content.Context; 5 | import android.view.Gravity; 6 | import android.view.animation.Animation; 7 | import android.view.animation.AnimationUtils; 8 | import android.widget.ImageView; 9 | import android.widget.TextView; 10 | 11 | class SimpleHUDDialog extends Dialog { 12 | 13 | public SimpleHUDDialog(Context context, int theme) { 14 | super(context, theme); 15 | } 16 | 17 | public static SimpleHUDDialog createDialog(Context context) { 18 | SimpleHUDDialog dialog = new SimpleHUDDialog(context, R.style.SimpleHUD); 19 | dialog.setContentView(R.layout.simplehud); 20 | dialog.getWindow().getAttributes().gravity = Gravity.CENTER; 21 | return dialog; 22 | } 23 | 24 | public void setMessage(String message) { 25 | TextView msgView = (TextView)findViewById(R.id.simplehud_message); 26 | msgView.setText(message); 27 | } 28 | 29 | public void setImage(Context ctx, int resId) { 30 | ImageView image = (ImageView)findViewById(R.id.simplehud_image); 31 | image.setImageResource(resId); 32 | 33 | if(resId==R.drawable.simplehud_spinner) { 34 | Animation anim = AnimationUtils.loadAnimation(ctx, R.anim.progressbar); 35 | anim.start(); 36 | image.startAnimation(anim); 37 | } 38 | } 39 | 40 | 41 | } 42 | -------------------------------------------------------------------------------- /SimpleHUDDemo/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /SimpleHUDDemo/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | SimpleHUDDemo 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 | -------------------------------------------------------------------------------- /SimpleHUDDemo/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 10 | 11 | 16 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /SimpleHUDDemo/libs/android-support-v4.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangvsa/SimpleHUD/1132befd7893795ad39752d2601f8a8f7fcb8806/SimpleHUDDemo/libs/android-support-v4.jar -------------------------------------------------------------------------------- /SimpleHUDDemo/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 | -------------------------------------------------------------------------------- /SimpleHUDDemo/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-19 15 | android.library.reference.1=../SimpleHUD 16 | -------------------------------------------------------------------------------- /SimpleHUDDemo/res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangvsa/SimpleHUD/1132befd7893795ad39752d2601f8a8f7fcb8806/SimpleHUDDemo/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /SimpleHUDDemo/res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangvsa/SimpleHUD/1132befd7893795ad39752d2601f8a8f7fcb8806/SimpleHUDDemo/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /SimpleHUDDemo/res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangvsa/SimpleHUD/1132befd7893795ad39752d2601f8a8f7fcb8806/SimpleHUDDemo/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /SimpleHUDDemo/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 11 | 12 | 18 | 19 | 25 | 26 | 32 | 33 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /SimpleHUDDemo/res/values-sw600dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /SimpleHUDDemo/res/values-sw720dp-land/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 128dp 8 | 9 | 10 | -------------------------------------------------------------------------------- /SimpleHUDDemo/res/values-v11/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /SimpleHUDDemo/res/values-v14/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /SimpleHUDDemo/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 16dp 5 | 16dp 6 | 7 | 8 | -------------------------------------------------------------------------------- /SimpleHUDDemo/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | SimpleHUD Demo 5 | Hello world! 6 | 7 | 8 | -------------------------------------------------------------------------------- /SimpleHUDDemo/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 14 | 15 | 16 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /SimpleHUDDemo/src/info/wangchen/simplehuddemo/MainActivity.java: -------------------------------------------------------------------------------- 1 | package info.wangchen.simplehuddemo; 2 | 3 | import info.wangchen.simplehud.SimpleHUD; 4 | import android.app.Activity; 5 | import android.os.Bundle; 6 | import android.view.View; 7 | import android.view.View.OnClickListener; 8 | import android.widget.Button; 9 | 10 | public class MainActivity extends Activity implements OnClickListener { 11 | 12 | @Override 13 | protected void onCreate(Bundle savedInstanceState) { 14 | super.onCreate(savedInstanceState); 15 | setContentView(R.layout.activity_main); 16 | 17 | Button showInfoMessage = (Button)findViewById(R.id.btn_info_message); 18 | Button showLoadingMessage = (Button)findViewById(R.id.btn_loading_message); 19 | Button showErrorMessage = (Button)findViewById(R.id.btn_error_message); 20 | Button showSuccessMessage = (Button)findViewById(R.id.btn_success_message); 21 | showInfoMessage.setOnClickListener(this); 22 | showLoadingMessage.setOnClickListener(this); 23 | showErrorMessage.setOnClickListener(this); 24 | showSuccessMessage.setOnClickListener(this); 25 | } 26 | 27 | @Override 28 | public void onClick(View v) { 29 | switch( v.getId() ) { 30 | case R.id.btn_loading_message: 31 | SimpleHUD.showLoadingMessage(this, "loading data, please wait...", true); 32 | // when you finish loading your data, call SimpleHUD.dismiss(); 33 | break; 34 | case R.id.btn_info_message: 35 | SimpleHUD.showInfoMessage(this, "This is a info message."); 36 | break; 37 | case R.id.btn_error_message: 38 | SimpleHUD.showErrorMessage(this, "This ia a error message."); 39 | break; 40 | case R.id.btn_success_message: 41 | SimpleHUD.showSuccessMessage(this, "This a success message, and it's a long sentence!"); 42 | break; 43 | } 44 | } 45 | 46 | 47 | } 48 | -------------------------------------------------------------------------------- /screenshots/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangvsa/SimpleHUD/1132befd7893795ad39752d2601f8a8f7fcb8806/screenshots/screenshot.png --------------------------------------------------------------------------------