├── app ├── .gitignore ├── src │ └── main │ │ ├── res │ │ ├── mipmap-xhdpi │ │ │ ├── test.jpg │ │ │ ├── splash.jpg │ │ │ ├── splash1.jpg │ │ │ ├── splash2.jpg │ │ │ ├── test_image.jpg │ │ │ └── ic_launcher.png │ │ ├── mipmap-hdpi │ │ │ └── ic_launcher.png │ │ ├── mipmap-mdpi │ │ │ └── ic_launcher.png │ │ ├── mipmap-xxhdpi │ │ │ └── ic_launcher.png │ │ ├── mipmap-xxxhdpi │ │ │ └── ic_launcher.png │ │ ├── values │ │ │ ├── strings.xml │ │ │ ├── dimens.xml │ │ │ ├── attrs.xml │ │ │ └── colors.xml │ │ ├── layout │ │ │ ├── activity_fragment.xml │ │ │ ├── activity_listview.xml │ │ │ ├── activity_listview_item2.xml │ │ │ ├── activity_listview_item.xml │ │ │ ├── activity_main_item.xml │ │ │ ├── activity_eventbus.xml │ │ │ └── activity_main.xml │ │ ├── drawable │ │ │ ├── red_background.xml │ │ │ ├── blue_background.xml │ │ │ ├── brown_background.xml │ │ │ ├── cyan_background.xml │ │ │ ├── green_background.xml │ │ │ ├── lime_background.xml │ │ │ ├── pink_background.xml │ │ │ ├── teal_background.xml │ │ │ ├── indigo_background.xml │ │ │ ├── orange_background.xml │ │ │ ├── purple_background.xml │ │ │ ├── blue_grey_background.xml │ │ │ ├── deep_orange_background.xml │ │ │ ├── deep_purple_background.xml │ │ │ └── light_green_background.xml │ │ └── values-w820dp │ │ │ └── dimens.xml │ │ ├── java │ │ └── com │ │ │ └── hy │ │ │ └── quickbasicproject │ │ │ ├── event │ │ │ ├── package-info.java │ │ │ └── EventUtil.java │ │ │ ├── app │ │ │ └── MyApplication.java │ │ │ ├── fragment │ │ │ ├── ImageFragment.java │ │ │ ├── Image2Fragment.java │ │ │ └── AppBaseFragment.java │ │ │ ├── activity │ │ │ ├── AppBaseActivity.java │ │ │ ├── SplashActivity.java │ │ │ ├── FragmentActivity.java │ │ │ ├── ListViewActivity.java │ │ │ └── EventBusActivity.java │ │ │ ├── crash │ │ │ └── CustomCrashProcessImpl.java │ │ │ └── model │ │ │ └── Demo.java │ │ └── AndroidManifest.xml ├── proguard-rules.pro └── build.gradle ├── settings.gradle ├── Night.gif ├── Quick basic project.gif ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── basicproject ├── src │ └── main │ │ ├── res │ │ └── values │ │ │ └── strings.xml │ │ ├── AndroidManifest.xml │ │ └── java │ │ └── com │ │ └── hy │ │ └── basicproject │ │ ├── event │ │ └── SkinChangeEvent.java │ │ ├── log │ │ ├── LogLevel.java │ │ ├── LogTool.java │ │ ├── Printer.java │ │ ├── AndroidLogTool.java │ │ ├── Settings.java │ │ └── Logger.java │ │ ├── interfaces │ │ ├── ICrashProcess.java │ │ ├── IRegister.java │ │ ├── IFragment.java │ │ └── IActivity.java │ │ ├── theme │ │ ├── ColorUiInterface.java │ │ ├── Theme.java │ │ ├── ColorView.java │ │ ├── ColorRelativeLayout.java │ │ ├── ColorListView.java │ │ ├── ColorTextView.java │ │ ├── ColorUiUtil.java │ │ └── ViewAttributeUtil.java │ │ ├── utils │ │ ├── SizeUtil.java │ │ ├── ThemeUtils.java │ │ ├── CloseUtil.java │ │ ├── ToastUtil.java │ │ ├── ViewHolder.java │ │ ├── ConversionUtil.java │ │ ├── SystemUtils.java │ │ ├── CursorUtil.java │ │ ├── MatcherUtil.java │ │ ├── HtmlUtil.java │ │ ├── encrypt │ │ │ ├── MD5.java │ │ │ └── DESUtil.java │ │ ├── DataUtil.java │ │ ├── DoubleClickExitHelper.java │ │ ├── IpUtil.java │ │ ├── SharedPreferencesUtil.java │ │ ├── ByteUtil.java │ │ ├── KeyBoardUtil.java │ │ ├── NetworkUtil.java │ │ ├── MoneyUtil.java │ │ ├── AppInfoUtil.java │ │ ├── StringUtil.java │ │ ├── WindowUtil.java │ │ ├── EditTextUtil.java │ │ ├── IntentUtil.java │ │ ├── WifiHelper.java │ │ └── DeviceUtil.java │ │ ├── exception │ │ ├── CrashHandler.java │ │ └── impl │ │ │ └── DefaultCrashProcess.java │ │ ├── fragment │ │ └── BaseFragment.java │ │ ├── activity │ │ ├── BaseActivityStack.java │ │ └── BaseActivity.java │ │ ├── BasicConfig.java │ │ └── consts │ │ └── MIME.java ├── build.gradle └── proguard-rules.pro ├── .idea └── libraries │ ├── support_v4_24_2_0.xml │ ├── support_annotations_24_2_0.xml │ ├── butterknife_7_0_1.xml │ ├── cardview_v7_24_2_0.xml │ ├── androideventbus_latest.xml │ ├── core_0_9_0_1.xml │ ├── commonadapter_1_0_0.xml │ ├── support_vector_drawable_24_2_0.xml │ ├── animated_vector_drawable_24_2_0.xml │ ├── design_24_2_0.xml │ ├── appcompat_v7_24_2_0.xml │ ├── recyclerview_v7_24_2_0.xml │ ├── support_core_utils_24_2_0.xml │ ├── commons_0_9_0_1.xml │ ├── library_1_1_7.xml │ ├── support_compat_24_2_0.xml │ ├── support_core_ui_24_2_0.xml │ ├── support_fragment_24_2_0.xml │ └── support_media_compat_24_2_0.xml ├── gradle.properties ├── gradlew.bat └── gradlew /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app', ':basicproject' -------------------------------------------------------------------------------- /Night.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qq8585083/Basic-Project/HEAD/Night.gif -------------------------------------------------------------------------------- /Quick basic project.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qq8585083/Basic-Project/HEAD/Quick basic project.gif -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qq8585083/Basic-Project/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /basicproject/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | basicproject 3 | 4 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/test.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qq8585083/Basic-Project/HEAD/app/src/main/res/mipmap-xhdpi/test.jpg -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/splash.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qq8585083/Basic-Project/HEAD/app/src/main/res/mipmap-xhdpi/splash.jpg -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/splash1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qq8585083/Basic-Project/HEAD/app/src/main/res/mipmap-xhdpi/splash1.jpg -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/splash2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qq8585083/Basic-Project/HEAD/app/src/main/res/mipmap-xhdpi/splash2.jpg -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qq8585083/Basic-Project/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qq8585083/Basic-Project/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/test_image.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qq8585083/Basic-Project/HEAD/app/src/main/res/mipmap-xhdpi/test_image.jpg -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qq8585083/Basic-Project/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qq8585083/Basic-Project/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qq8585083/Basic-Project/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/java/com/hy/quickbasicproject/event/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * 基于AndroidEventBus的工具类 3 | * @author qq8585083 4 | * 5 | * 6 | * 7 | */ 8 | package com.hy.quickbasicproject.event; -------------------------------------------------------------------------------- /basicproject/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /basicproject/src/main/java/com/hy/basicproject/event/SkinChangeEvent.java: -------------------------------------------------------------------------------- 1 | package com.hy.basicproject.event; 2 | 3 | /** 4 | * Created by qq8585083 on 2016/2/19. 5 | */ 6 | public class SkinChangeEvent { 7 | } 8 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Quick Basic Project 3 | 更换主题 4 | 取消 5 | 完成 6 | 7 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Wed Sep 14 09:45:42 CST 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 | -------------------------------------------------------------------------------- /basicproject/src/main/java/com/hy/basicproject/log/LogLevel.java: -------------------------------------------------------------------------------- 1 | package com.hy.basicproject.log; 2 | 3 | public enum LogLevel { 4 | 5 | /** 6 | * Prints all logs 7 | */ 8 | FULL, 9 | 10 | /** 11 | * No log will be printed 12 | */ 13 | NONE 14 | } 15 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_fragment.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | -------------------------------------------------------------------------------- /basicproject/src/main/java/com/hy/basicproject/interfaces/ICrashProcess.java: -------------------------------------------------------------------------------- 1 | package com.hy.basicproject.interfaces; 2 | 3 | /** 4 | * 崩溃日志接口协议 5 | * 6 | * @author qq8585083 7 | * 8 | */ 9 | public interface ICrashProcess { 10 | 11 | void onException(Thread thread, Throwable exception) throws Exception; 12 | } 13 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/red_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/blue_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/brown_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/cyan_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/green_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/lime_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/pink_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/teal_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/indigo_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/orange_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/purple_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/blue_grey_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | -------------------------------------------------------------------------------- /basicproject/src/main/java/com/hy/basicproject/interfaces/IRegister.java: -------------------------------------------------------------------------------- 1 | package com.hy.basicproject.interfaces; 2 | 3 | /** 4 | * 规范注册的接口协议 5 | * 6 | * @author qq8585083 7 | * 8 | */ 9 | public interface IRegister { 10 | /** 11 | * 注册广播、服务 12 | */ 13 | void register(); 14 | 15 | /** 16 | * 注销广播、服务 17 | */ 18 | void unRegister(); 19 | } 20 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/deep_orange_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/deep_purple_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/light_green_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | -------------------------------------------------------------------------------- /basicproject/src/main/java/com/hy/basicproject/theme/ColorUiInterface.java: -------------------------------------------------------------------------------- 1 | package com.hy.basicproject.theme; 2 | 3 | import android.content.res.Resources; 4 | import android.view.View; 5 | 6 | /** 7 | * 换肤接口 8 | * Created by qq8585083 on 15/6/8. 9 | */ 10 | public interface ColorUiInterface { 11 | 12 | 13 | View getView(); 14 | 15 | void setTheme(Resources.Theme themeId); 16 | } 17 | -------------------------------------------------------------------------------- /app/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 64dp 6 | 7 | -------------------------------------------------------------------------------- /basicproject/src/main/java/com/hy/basicproject/utils/SizeUtil.java: -------------------------------------------------------------------------------- 1 | package com.hy.basicproject.utils; 2 | 3 | /** 4 | * 5 | * @author qq8585083 6 | * 7 | */ 8 | public final class SizeUtil { 9 | private SizeUtil() { } 10 | 11 | public static final long GB_2_BYTE = 1073741824; 12 | public static final long MB_2_BYTE = 1048576; 13 | public static final long KB_2_BYTE = 1024; 14 | 15 | } 16 | -------------------------------------------------------------------------------- /basicproject/src/main/java/com/hy/basicproject/log/LogTool.java: -------------------------------------------------------------------------------- 1 | package com.hy.basicproject.log; 2 | 3 | public interface LogTool { 4 | void d(String tag, String message); 5 | 6 | void e(String tag, String message); 7 | 8 | void w(String tag, String message); 9 | 10 | void i(String tag, String message); 11 | 12 | void v(String tag, String message); 13 | 14 | void wtf(String tag, String message); 15 | } -------------------------------------------------------------------------------- /basicproject/src/main/java/com/hy/basicproject/theme/Theme.java: -------------------------------------------------------------------------------- 1 | package com.hy.basicproject.theme; 2 | 3 | /** 4 | * Created by qq8585083 on 2016/2/6. 5 | */ 6 | public enum Theme { 7 | Blue, 8 | Red, 9 | Brown, 10 | Purple, 11 | Teal, 12 | Green, 13 | Pink, 14 | Orange, 15 | DeepPurple, 16 | Indigo, 17 | Cyan, 18 | LightGreen, 19 | Lime, 20 | DeepOrange, 21 | BlueGrey 22 | 23 | } 24 | -------------------------------------------------------------------------------- /.idea/libraries/support_v4_24_2_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 8dp 6 | 80dp 7 | 144dp 8 | 24sp 9 | 18sp 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/support_annotations_24_2_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /basicproject/src/main/java/com/hy/basicproject/utils/ThemeUtils.java: -------------------------------------------------------------------------------- 1 | package com.hy.basicproject.utils; 2 | 3 | import android.content.Context; 4 | import android.content.res.TypedArray; 5 | 6 | /** 7 | * Created by qq8585083 on 2016/4/6. 8 | */ 9 | public class ThemeUtils { 10 | public static int getThemeColor(Context context, int attrRes) { 11 | TypedArray typedArray = context.obtainStyledAttributes(new int[]{attrRes}); 12 | int color = typedArray.getColor(0, 0xffffff); 13 | typedArray.recycle(); 14 | return color; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /.idea/libraries/butterknife_7_0_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/cardview_v7_24_2_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /basicproject/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | android { 3 | compileSdkVersion 24 4 | buildToolsVersion "24.0.2" 5 | 6 | defaultConfig { 7 | minSdkVersion 19 8 | targetSdkVersion 24 9 | versionCode 1 10 | versionName "1.0" 11 | } 12 | buildTypes { 13 | release { 14 | minifyEnabled false 15 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 16 | } 17 | } 18 | 19 | } 20 | 21 | dependencies { 22 | compile fileTree(dir: 'libs', include: ['*.jar']) 23 | compile 'com.android.support:appcompat-v7:24.2.0' 24 | } 25 | -------------------------------------------------------------------------------- /.idea/libraries/androideventbus_latest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/core_0_9_0_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/commonadapter_1_0_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/support_vector_drawable_24_2_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/animated_vector_drawable_24_2_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_listview.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 18 | 19 | -------------------------------------------------------------------------------- /basicproject/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in E:\Android_SDK/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 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 | #} 18 | -------------------------------------------------------------------------------- /basicproject/src/main/java/com/hy/basicproject/log/Printer.java: -------------------------------------------------------------------------------- 1 | package com.hy.basicproject.log; 2 | 3 | public interface Printer { 4 | 5 | Printer t(String tag, int methodCount); 6 | 7 | Settings init(String tag); 8 | 9 | Settings getSettings(); 10 | 11 | void d(String message, Object... args); 12 | 13 | void e(String message, Object... args); 14 | 15 | void e(Throwable throwable, String message, Object... args); 16 | 17 | void w(String message, Object... args); 18 | 19 | void i(String message, Object... args); 20 | 21 | void v(String message, Object... args); 22 | 23 | void wtf(String message, Object... args); 24 | 25 | void json(String json); 26 | 27 | void xml(String xml); 28 | 29 | void clear(); 30 | } 31 | -------------------------------------------------------------------------------- /.idea/libraries/design_24_2_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /app/src/main/java/com/hy/quickbasicproject/app/MyApplication.java: -------------------------------------------------------------------------------- 1 | package com.hy.quickbasicproject.app; 2 | 3 | import android.app.Application; 4 | 5 | import com.hy.basicproject.BasicConfig; 6 | 7 | 8 | public class MyApplication extends Application { 9 | 10 | @Override 11 | public void onCreate() { 12 | super.onCreate(); 13 | 14 | /** 15 | * 默认配置,适用于正式版本 16 | * 内部调用了: initDir() initLog(false) initExceptionHandler()三个方法 17 | */ 18 | //BasicConfig.getInstance(this).init(); 19 | 20 | /** 21 | * 自定义配置 22 | * initDir() 初始化SDCard缓存目录 23 | * initLog() 初始化日志打印 24 | * initExceptionHandler() 默认异常信息处理 25 | */ 26 | BasicConfig.getInstance(this).init(); 27 | 28 | } 29 | 30 | 31 | } 32 | -------------------------------------------------------------------------------- /.idea/libraries/appcompat_v7_24_2_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in E:\Android_SDK/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 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 | #} 18 | # view res/layout/item_android.xml #generated:8 19 | -keep class com.yyydjk.gank.theme.ColorTextView { (...); } -------------------------------------------------------------------------------- /.idea/libraries/recyclerview_v7_24_2_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /.idea/libraries/support_core_utils_24_2_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/commons_0_9_0_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /app/src/main/java/com/hy/quickbasicproject/fragment/ImageFragment.java: -------------------------------------------------------------------------------- 1 | package com.hy.quickbasicproject.fragment; 2 | 3 | 4 | import com.hy.basicproject.log.Logger; 5 | import com.hy.quickbasicproject.R; 6 | 7 | public class ImageFragment extends AppBaseFragment { 8 | 9 | @Override 10 | public int getLayoutResId() { 11 | return R.layout.activity_listview_item; 12 | } 13 | 14 | @Override 15 | public void onFirst() { 16 | Logger.d("亲!只有第一次才会执行哦!"); 17 | //这里可以做一些界面功能引导 18 | } 19 | 20 | @Override 21 | public void onChange() { 22 | //ToastUtil.showToast(getActivity(),"onChange:"+this.getClass().getSimpleName()); 23 | Logger.d("ImageFragment --> onChange"); 24 | } 25 | 26 | @Override 27 | public void onHidden() { 28 | super.onHidden(); 29 | Logger.d("ImageFragment --> onHidden"); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /app/src/main/java/com/hy/quickbasicproject/fragment/Image2Fragment.java: -------------------------------------------------------------------------------- 1 | package com.hy.quickbasicproject.fragment; 2 | 3 | 4 | import com.hy.basicproject.log.Logger; 5 | import com.hy.quickbasicproject.R; 6 | 7 | public class Image2Fragment extends AppBaseFragment { 8 | 9 | @Override 10 | public int getLayoutResId() { 11 | return R.layout.activity_listview_item2; 12 | } 13 | 14 | @Override 15 | public void onFirst() { 16 | Logger.d("亲!只有第一次才会执行哦!"); 17 | //这里可以做一些界面功能引导 18 | } 19 | 20 | @Override 21 | public void onChange() { 22 | //ToastUtil.showToast(getActivity(),"onChange:"+this.getClass().getSimpleName()); 23 | Logger.d("Image2Fragment --> onChange"); 24 | } 25 | 26 | @Override 27 | public void onHidden() { 28 | super.onHidden(); 29 | Logger.d("Image2Fragment --> onHidden"); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /.idea/libraries/library_1_1_7.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 14 | 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | # org.gradle.parallel=true 19 | -------------------------------------------------------------------------------- /basicproject/src/main/java/com/hy/basicproject/log/AndroidLogTool.java: -------------------------------------------------------------------------------- 1 | package com.hy.basicproject.log; 2 | 3 | import android.util.Log; 4 | 5 | public class AndroidLogTool implements LogTool { 6 | @Override 7 | public void d(String tag, String message) { 8 | Log.d(tag, message); 9 | } 10 | 11 | 12 | @Override 13 | public void e(String tag, String message) { 14 | Log.e(tag, message); 15 | } 16 | 17 | 18 | @Override 19 | public void w(String tag, String message) { 20 | Log.w(tag, message); 21 | } 22 | 23 | 24 | @Override 25 | public void i(String tag, String message) { 26 | Log.i(tag, message); 27 | } 28 | 29 | 30 | @Override 31 | public void v(String tag, String message) { 32 | Log.v(tag, message); 33 | } 34 | 35 | 36 | @Override 37 | public void wtf(String tag, String message) { 38 | Log.wtf(tag, message); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /app/src/main/java/com/hy/quickbasicproject/activity/AppBaseActivity.java: -------------------------------------------------------------------------------- 1 | package com.hy.quickbasicproject.activity; 2 | 3 | import android.os.Bundle; 4 | 5 | import com.hy.basicproject.activity.BaseActivity; 6 | import com.hy.quickbasicproject.event.EventUtil; 7 | 8 | import butterknife.ButterKnife; 9 | 10 | public abstract class AppBaseActivity extends BaseActivity { 11 | 12 | public boolean configEventBus() { 13 | return false; 14 | } 15 | 16 | @Override 17 | public void initView(Bundle savedInstanceState) { 18 | ButterKnife.bind(this); 19 | } 20 | 21 | @Override 22 | public void register() { 23 | if (configEventBus()) { 24 | EventUtil.registerEventBus(this); 25 | } 26 | } 27 | 28 | @Override 29 | public void unRegister() { 30 | ButterKnife.unbind(this); 31 | if (configEventBus()) { 32 | EventUtil.unRegisterEventBus(this); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /basicproject/src/main/java/com/hy/basicproject/utils/CloseUtil.java: -------------------------------------------------------------------------------- 1 | package com.hy.basicproject.utils; 2 | 3 | import java.io.Closeable; 4 | import java.io.IOException; 5 | 6 | /** 7 | * 8 | * @author qq8585083 9 | * 10 | */ 11 | public final class CloseUtil { 12 | private CloseUtil() { } 13 | 14 | 15 | public static void close(Closeable closeable) { 16 | if (null != closeable) { 17 | try { 18 | closeable.close(); 19 | } catch (IOException e) { 20 | e.printStackTrace(); 21 | } 22 | } 23 | } 24 | 25 | 26 | public static void close(Closeable... params) { 27 | if (null != params) { 28 | try { 29 | for (Closeable closeable : params) { 30 | closeable.close(); 31 | } 32 | } catch (IOException e) { 33 | e.printStackTrace(); 34 | } 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /app/src/main/java/com/hy/quickbasicproject/fragment/AppBaseFragment.java: -------------------------------------------------------------------------------- 1 | package com.hy.quickbasicproject.fragment; 2 | 3 | import android.os.Bundle; 4 | import android.view.View; 5 | 6 | import com.hy.basicproject.fragment.BaseFragment; 7 | import com.hy.quickbasicproject.event.EventUtil; 8 | 9 | import butterknife.ButterKnife; 10 | 11 | public abstract class AppBaseFragment extends BaseFragment { 12 | 13 | public boolean configEventBus() { 14 | return false; 15 | } 16 | 17 | @Override 18 | public void initView(View parentView, Bundle savedInstanceState) { 19 | ButterKnife.bind(this, parentView); 20 | } 21 | 22 | @Override 23 | public void register() { 24 | if (configEventBus()) { 25 | EventUtil.registerEventBus(this); 26 | } 27 | } 28 | 29 | @Override 30 | public void unRegister() { 31 | ButterKnife.unbind(this); 32 | if (configEventBus()) { 33 | EventUtil.unRegisterEventBus(this); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /basicproject/src/main/java/com/hy/basicproject/interfaces/IFragment.java: -------------------------------------------------------------------------------- 1 | package com.hy.basicproject.interfaces; 2 | 3 | import android.os.Bundle; 4 | import android.view.View; 5 | 6 | /** 7 | * 规范Fragment接口协议 8 | * 9 | * @author qq8585083 10 | * 11 | */ 12 | public interface IFragment { 13 | 14 | /** 15 | * 获取布局文件 16 | */ 17 | int getLayoutResId(); 18 | 19 | /** 20 | * Fragment被切换到前台时调用 21 | */ 22 | void onChange(); 23 | 24 | /** 25 | * Fragment被切换到后台时调用 26 | */ 27 | void onHidden(); 28 | 29 | /** 第一次启动会执行此方法 */ 30 | void onFirst(); 31 | 32 | /** 33 | * 初始化数据 34 | */ 35 | void initData(); 36 | 37 | /** 38 | * 初始化控件 39 | */ 40 | void initView(View parentView, Bundle savedInstanceState); 41 | 42 | /** 43 | * 点击事件回调方法 44 | */ 45 | void viewClick(View v); 46 | 47 | /** 48 | * 显示进度条 49 | */ 50 | void showProgress(); 51 | 52 | /** 53 | * 隐藏进度条 54 | */ 55 | void hideProgress(); 56 | } 57 | -------------------------------------------------------------------------------- /.idea/libraries/support_compat_24_2_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /.idea/libraries/support_core_ui_24_2_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /.idea/libraries/support_fragment_24_2_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /basicproject/src/main/java/com/hy/basicproject/utils/ToastUtil.java: -------------------------------------------------------------------------------- 1 | package com.hy.basicproject.utils; 2 | 3 | import android.content.Context; 4 | import android.widget.Toast; 5 | 6 | /** 7 | * Toast工具类 8 | * 9 | * @author qq8585083 10 | * 11 | */ 12 | public final class ToastUtil { 13 | private ToastUtil() {} 14 | 15 | 16 | public static void showToast(Context context, String text) { 17 | Toast.makeText(context, text, Toast.LENGTH_SHORT).show(); 18 | } 19 | 20 | 21 | public static void showToast(Context context, int resId) { 22 | Toast.makeText(context, context.getResources().getText(resId), 23 | Toast.LENGTH_SHORT).show(); 24 | } 25 | 26 | 27 | public static void showLongToast(Context context, String text) { 28 | Toast.makeText(context, text, Toast.LENGTH_LONG).show(); 29 | } 30 | 31 | 32 | public static void showLongToast(Context context, int resId) { 33 | Toast.makeText(context, context.getResources().getText(resId), 34 | Toast.LENGTH_LONG).show(); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /.idea/libraries/support_media_compat_24_2_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_listview_item2.xml: -------------------------------------------------------------------------------- 1 | 2 | 12 | 13 | 21 | 29 | 30 | -------------------------------------------------------------------------------- /basicproject/src/main/java/com/hy/basicproject/utils/ViewHolder.java: -------------------------------------------------------------------------------- 1 | package com.hy.basicproject.utils; 2 | 3 | import android.util.SparseArray; 4 | import android.view.View; 5 | 6 | /** 7 | * 比较规范独立的的ViewHolder. 8 | * 9 | * @author Jack Tony 10 | * 11 | * 12 | */ 13 | public final class ViewHolder { 14 | private ViewHolder(){} 15 | @SuppressWarnings("unchecked") 16 | public static T get(View view, int id) { 17 | //SparseArray在代码理解上等价于HashMap 18 | //SparseArray是Android提供的一个数据结构,旨在提高查询的效率。 19 | SparseArray viewHolder = (SparseArray) view.getTag(); 20 | if (viewHolder == null) { 21 | viewHolder = new SparseArray(); 22 | view.setTag(viewHolder); 23 | } 24 | View childView = viewHolder.get(id); 25 | if (childView == null) { 26 | childView = view.findViewById(id); 27 | viewHolder.put(id, childView); 28 | } 29 | return (T) childView; 30 | } 31 | 32 | /** 33 | * 替代findviewById方法 34 | */ 35 | public static T find(View view, int id) 36 | { 37 | return (T) view.findViewById(id); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /app/src/main/java/com/hy/quickbasicproject/event/EventUtil.java: -------------------------------------------------------------------------------- 1 | package com.hy.quickbasicproject.event; 2 | 3 | import org.simple.eventbus.EventBus; 4 | 5 | /** 6 | * AndroidEventBus工具类 7 | * 8 | * @author qq8585083 9 | * 10 | */ 11 | public class EventUtil { 12 | private EventUtil() { 13 | } 14 | 15 | /** 16 | * 注册成为订阅者 17 | * 18 | * @param subscriber Activity/Fragment/Class...等对象 19 | */ 20 | public static void registerEventBus(Object subscriber) { 21 | EventBus.getDefault().register(subscriber); 22 | } 23 | 24 | /** 25 | * 注销订阅者 26 | */ 27 | public static void unRegisterEventBus(Object subscriber) { 28 | EventBus.getDefault().unregister(subscriber); 29 | } 30 | 31 | /** 32 | * 发布一个事件 33 | * 34 | * @param event 发布事件时传递的参数 35 | */ 36 | public static void post(Object event) { 37 | EventBus.getDefault().post(event); 38 | } 39 | 40 | /** 41 | * 发布一个事件 42 | * 43 | * @param event 发布事件时传递的参数 44 | * @param tag 事件的tag, 类似于BroadcastReceiver的action 45 | */ 46 | public static void post(Object event, String tag) { 47 | EventBus.getDefault().post(event, tag); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_listview_item.xml: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 18 | 30 | -------------------------------------------------------------------------------- /basicproject/src/main/java/com/hy/basicproject/theme/ColorView.java: -------------------------------------------------------------------------------- 1 | package com.hy.basicproject.theme; 2 | 3 | import android.content.Context; 4 | import android.content.res.Resources; 5 | import android.util.AttributeSet; 6 | import android.view.View; 7 | 8 | 9 | /** 10 | * Created by qq8585083 on 15/6/8. 11 | */ 12 | public class ColorView extends View implements ColorUiInterface { 13 | 14 | private int attr_background = -1; 15 | 16 | public ColorView(Context context) { 17 | super(context); 18 | } 19 | 20 | public ColorView(Context context, AttributeSet attrs) { 21 | super(context, attrs); 22 | this.attr_background = ViewAttributeUtil.getBackgroundAttibute(attrs); 23 | } 24 | 25 | public ColorView(Context context, AttributeSet attrs, int defStyleAttr) { 26 | super(context, attrs, defStyleAttr); 27 | this.attr_background = ViewAttributeUtil.getBackgroundAttibute(attrs); 28 | } 29 | 30 | @Override 31 | public View getView() { 32 | return this; 33 | } 34 | 35 | @Override 36 | public void setTheme(Resources.Theme themeId) { 37 | if (attr_background != -1) { 38 | ViewAttributeUtil.applyBackgroundDrawable(this, themeId, attr_background); 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /basicproject/src/main/java/com/hy/basicproject/utils/ConversionUtil.java: -------------------------------------------------------------------------------- 1 | package com.hy.basicproject.utils; 2 | 3 | import android.content.Context; 4 | import android.util.TypedValue; 5 | 6 | /** 7 | * 单位转换工具类 8 | * 9 | * @author qq8585083 10 | * 11 | */ 12 | public final class ConversionUtil { 13 | private ConversionUtil() { } 14 | 15 | /** 16 | * dp转px 17 | */ 18 | public static int dp2px(Context context, float dpVal) { 19 | return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dpVal, context.getResources().getDisplayMetrics()); 20 | } 21 | 22 | /** 23 | * sp转px 24 | */ 25 | public static int sp2px(Context context, float spVal) { 26 | return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, spVal, context.getResources().getDisplayMetrics()); 27 | } 28 | 29 | /** 30 | * px转dp 31 | */ 32 | public static float px2dp(Context context, float pxVal) { 33 | final float scale = context.getResources().getDisplayMetrics().density; 34 | return (pxVal / scale); 35 | } 36 | 37 | /** 38 | * px转sp 39 | */ 40 | public static float px2sp(Context context, float pxVal) { 41 | return (pxVal / context.getResources().getDisplayMetrics().scaledDensity); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | repositories { 3 | maven { 4 | url 'https://dl.bintray.com/qq8585083/maven/' 5 | } 6 | } 7 | android { 8 | compileSdkVersion 24 9 | buildToolsVersion "24.0.2" 10 | 11 | defaultConfig { 12 | applicationId "com.hy.quickbasicproject" 13 | minSdkVersion 19 14 | targetSdkVersion 24 15 | versionCode 1 16 | versionName "1.0" 17 | } 18 | buildTypes { 19 | release { 20 | minifyEnabled false 21 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 22 | } 23 | } 24 | } 25 | 26 | dependencies { 27 | compile fileTree(include: ['*.jar'], dir: 'libs') 28 | compile 'com.android.support:recyclerview-v7:24.2.0' 29 | compile 'com.android.support:cardview-v7:24.2.0' 30 | compile 'com.android.support:design:24.2.0' 31 | compile 'com.jakewharton:butterknife:7.0.1' 32 | compile 'org.simple:androideventbus:latest' 33 | compile 'com.hy.commonadapter:commonadapter:1.0.0' 34 | // compile 'com.hy.basicproject:basicproject:1.0.0' 35 | compile project(':basicproject') 36 | compile 'com.afollestad.material-dialogs:core:0.9.0.1' 37 | compile 'com.afollestad.material-dialogs:commons:0.9.0.1' 38 | } 39 | -------------------------------------------------------------------------------- /app/src/main/java/com/hy/quickbasicproject/crash/CustomCrashProcessImpl.java: -------------------------------------------------------------------------------- 1 | package com.hy.quickbasicproject.crash; 2 | 3 | import com.hy.basicproject.interfaces.ICrashProcess; 4 | import com.hy.basicproject.utils.DateUtil; 5 | import com.hy.basicproject.utils.SDcardUtil; 6 | 7 | import java.io.BufferedWriter; 8 | import java.io.File; 9 | import java.io.FileWriter; 10 | import java.io.PrintWriter; 11 | 12 | /** 13 | * 14 | * 自定义崩溃日志处理 15 | */ 16 | public class CustomCrashProcessImpl implements ICrashProcess { 17 | private static final String SUFFIX = ".txt"; 18 | 19 | @Override 20 | public void onException(Thread thread, Throwable exception) throws Exception { 21 | 22 | //TODO 这里替换你的自定义逻辑 23 | 24 | final String logName = DateUtil.formatDate("yyyyMMdd_HHmmss", System.currentTimeMillis()) + SUFFIX; 25 | final File file = new File(SDcardUtil.getLogDirPath(), logName); 26 | if (!file.exists()) { 27 | file.createNewFile(); 28 | } 29 | PrintWriter pw = new PrintWriter(new BufferedWriter(new FileWriter(file, true))); 30 | pw.println(DateUtil.formatDate(DateUtil.FORMAT, System.currentTimeMillis())); 31 | pw.println(); 32 | exception.printStackTrace(pw); 33 | pw.println(); 34 | pw.close(); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /basicproject/src/main/java/com/hy/basicproject/exception/CrashHandler.java: -------------------------------------------------------------------------------- 1 | package com.hy.basicproject.exception; 2 | 3 | 4 | import com.hy.basicproject.interfaces.ICrashProcess; 5 | 6 | /** 7 | * 异常信息收集 8 | * 9 | * @author qq8585083 10 | * 11 | */ 12 | public class CrashHandler implements Thread.UncaughtExceptionHandler { 13 | private static CrashHandler sInstance; 14 | private ICrashProcess mCrashProcess; 15 | 16 | private CrashHandler(ICrashProcess crashProcessImpl) { 17 | // 将当前实例设为系统默认的异常处理器 18 | Thread.setDefaultUncaughtExceptionHandler(this); 19 | this.mCrashProcess = crashProcessImpl; 20 | } 21 | 22 | public synchronized static CrashHandler getInstance(ICrashProcess crashProcessImpl) { 23 | if (sInstance == null) { 24 | sInstance = new CrashHandler(crashProcessImpl); 25 | } 26 | return sInstance; 27 | } 28 | 29 | /** 30 | * 这个是最关键的函数,当程序中有未被捕获的异常,系统将会自动调用uncaughtException方法 31 | * thread为出现未捕获异常的线程, 32 | * exception为未捕获的异常。 33 | */ 34 | @Override 35 | public void uncaughtException(Thread thread, Throwable exception) { 36 | try { 37 | mCrashProcess.onException(thread, exception); 38 | } catch (Exception e) { 39 | } finally { 40 | System.exit(0); 41 | } 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /basicproject/src/main/java/com/hy/basicproject/utils/SystemUtils.java: -------------------------------------------------------------------------------- 1 | package com.hy.basicproject.utils; 2 | 3 | import android.app.Activity; 4 | import android.graphics.Rect; 5 | 6 | /** 7 | * Created by qq8585083 on 2015/11/24. 8 | */ 9 | public class SystemUtils { 10 | 11 | /** 12 | * @param activity 13 | * @return > 0 success; <= 0 fail 14 | */ 15 | public static int getStatusHeight(Activity activity) { 16 | int statusHeight = 0; 17 | Rect localRect = new Rect(); 18 | activity.getWindow().getDecorView().getWindowVisibleDisplayFrame(localRect); 19 | statusHeight = localRect.top; 20 | if (0 == statusHeight) { 21 | Class localClass; 22 | try { 23 | localClass = Class.forName("com.android.internal.R$dimen"); 24 | Object localObject = localClass.newInstance(); 25 | int i5 = Integer.parseInt(localClass.getField("status_bar_height").get(localObject).toString()); 26 | statusHeight = activity.getResources().getDimensionPixelSize(i5); 27 | } catch (ClassNotFoundException | IllegalAccessException | InstantiationException | IllegalArgumentException | SecurityException | NoSuchFieldException e) { 28 | e.printStackTrace(); 29 | } 30 | } 31 | return statusHeight; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /basicproject/src/main/java/com/hy/basicproject/theme/ColorRelativeLayout.java: -------------------------------------------------------------------------------- 1 | package com.hy.basicproject.theme; 2 | 3 | import android.content.Context; 4 | import android.content.res.Resources; 5 | import android.util.AttributeSet; 6 | import android.view.View; 7 | import android.widget.RelativeLayout; 8 | 9 | 10 | /** 11 | * Created by qq8585083 on 15/6/8. 12 | */ 13 | public class ColorRelativeLayout extends RelativeLayout implements ColorUiInterface { 14 | 15 | private int attr_background = -1; 16 | 17 | public ColorRelativeLayout(Context context) { 18 | super(context); 19 | } 20 | 21 | public ColorRelativeLayout(Context context, AttributeSet attrs) { 22 | super(context, attrs); 23 | this.attr_background = ViewAttributeUtil.getBackgroundAttibute(attrs); 24 | } 25 | 26 | public ColorRelativeLayout(Context context, AttributeSet attrs, int defStyleAttr) { 27 | super(context, attrs, defStyleAttr); 28 | this.attr_background = ViewAttributeUtil.getBackgroundAttibute(attrs); 29 | } 30 | 31 | @Override 32 | public View getView() { 33 | return this; 34 | } 35 | 36 | @Override 37 | public void setTheme(Resources.Theme themeId) { 38 | if (attr_background != -1) { 39 | ViewAttributeUtil.applyBackgroundDrawable(this, themeId, attr_background); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main_item.xml: -------------------------------------------------------------------------------- 1 | 12 | 13 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_eventbus.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 |