diff --git a/.classpath b/.classpath deleted file mode 100644 index 5176974..0000000 --- a/.classpath +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/.gitignore b/.gitignore index 4c4215b..f545b32 100644 --- a/.gitignore +++ b/.gitignore @@ -1,14 +1,10 @@ -*.class - -# Mobile Tools for Java (J2ME) -.mtj.tmp/ - -# Package Files # -#*.jar -*.war -*.ear - -# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml -hs_err_pid* -/gen -/bin +*.iml +.gradle +/local.properties +/.idea/workspace.xml +/.idea/libraries +.DS_Store +/build +/captures +.externalNativeBuild +/.idea/ diff --git a/.idea/.name b/.idea/.name deleted file mode 100644 index 7608497..0000000 --- a/.idea/.name +++ /dev/null @@ -1 +0,0 @@ -android-utils \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml deleted file mode 100644 index 9a8b7e5..0000000 --- a/.idea/compiler.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - \ No newline at end of file diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml deleted file mode 100644 index e7bedf3..0000000 --- a/.idea/copyright/profiles_settings.xml +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml deleted file mode 100644 index 97626ba..0000000 --- a/.idea/encodings.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml deleted file mode 100644 index ab88b5b..0000000 --- a/.idea/misc.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index 50f91b7..0000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml deleted file mode 100644 index a686c7e..0000000 --- a/.idea/workspace.xml +++ /dev/null @@ -1,844 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - $USER_HOME$/.subversion - 125 - - - - - 1447899354991 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Android (android-utils)|Android - - - - - - - - - - - - - - - 1.7 - - - - - - - - Android|android-utils - - - - - - - - Android API 20 Platform - - - - - - - - gradle-wrapper - - - - - - - - \ No newline at end of file diff --git a/.project b/.project deleted file mode 100644 index 80ef2d7..0000000 --- a/.project +++ /dev/null @@ -1,33 +0,0 @@ - - - android-utils-jingle1267 - - - - - - com.android.ide.eclipse.adt.ResourceManagerBuilder - - - - - com.android.ide.eclipse.adt.PreCompilerBuilder - - - - - org.eclipse.jdt.core.javabuilder - - - - - com.android.ide.eclipse.adt.ApkBuilder - - - - - - com.android.ide.eclipse.adt.AndroidNature - org.eclipse.jdt.core.javanature - - diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index 99f26c0..0000000 --- a/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,2 +0,0 @@ -eclipse.preferences.version=1 -encoding/=UTF-8 diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 48ab4c6..0000000 --- a/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,4 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.source=1.6 diff --git a/.settings/org.eclipse.jdt.ui.prefs b/.settings/org.eclipse.jdt.ui.prefs deleted file mode 100644 index 21982ed..0000000 --- a/.settings/org.eclipse.jdt.ui.prefs +++ /dev/null @@ -1,3 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.ui.javadoc=true -org.eclipse.jdt.ui.text.custom_code_templates= diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..576922e --- /dev/null +++ b/.travis.yml @@ -0,0 +1,24 @@ +language: android + +jdk: oraclejdk8 + +sudo: false + +licenses: + - 'android-sdk-preview-license-.+' + - 'android-sdk-preview-license' + - 'android-sdk-license-.+' + - 'android-sdk-license' + - 'google-gdk-license-.+' + - '.+' + +android: + components: + - tools + - build-tools-25.0.0 + - android-25 + - extra-android-m2repository + - extra-android-support + +script: + - "./gradlew assembleRelease" \ No newline at end of file diff --git a/AndroidManifest.xml b/AndroidManifest.xml deleted file mode 100644 index 7e99881..0000000 --- a/AndroidManifest.xml +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/LICENSE b/LICENSE index ad410e1..261eeb9 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Apache License + Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ @@ -178,7 +178,7 @@ Apache License APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" + boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a @@ -186,7 +186,7 @@ Apache License same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright {yyyy} {name of copyright owner} + Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -198,4 +198,4 @@ Apache License distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and - limitations under the License. \ No newline at end of file + limitations under the License. diff --git a/README.md b/README.md index b23e51d..9dee6ba 100644 --- a/README.md +++ b/README.md @@ -1,58 +1,144 @@ -android工具类库 -============== +## Android工具类库 [![Build Status](https://travis-ci.org/jingle1267/android-utils.svg?branch=master)](https://travis-ci.org/jingle1267/android-utils) [ ![Download](https://api.bintray.com/packages/ihongqiqu/maven/android-utils/images/download.svg) ](https://bintray.com/ihongqiqu/maven/android-utils/_latestVersion)[![API](https://img.shields.io/badge/API-15%2B-brightgreen.svg?style=flat)](https://android-arsenal.com/api?level=15) [![Gradle Version](https://img.shields.io/badge/gradle-3.3-green.svg)](https://docs.gradle.org/current/release-notes) [![Licence](https://img.shields.io/badge/licence-Apache-blue.svg)](http://www.apache.org/licenses/LICENSE-2.0) + 囊括了一大部分Android应用开发过程当中常用的工具类。工具类来源整理自网络和自己编写。 -所有的工具类简介 (a - z): - - - * [AnimationUtils][1] Animation工具类 - * [AppUtils][2] APP相关信息工具类 - * [AssetDatabaseOpenHelper][3] 读取Asset目录中数据库工具类 - * [BitmapUtil][4] Bitmap工具类主要包括获取Bitmap和对Bitmap的操作 - * [CipherUtils][5] 加密与解密的工具类 - * [Colors][6] 常用颜色色值工具类 - * [CommonUtil][7] 一些通用的方法 - * [ChannelUtil][46] 为打包而生的渠道工具类 [极速打包传送门][47] - * [DataCleanManager][8] 应用数据清除类,主要功能有清除内/外缓存,清除数据库,清除sharedPreference,清除files和清除自定义目录 - * [DatabaseExportUtils][9] 导出应用数据库工具类 - * [DateUtils][10] 日期工具类 - * [DeviceStatusUtils][11] 手机状态工具类 主要包括网络、蓝牙、屏幕亮度、飞行模式、音量等 - * [DisplayUtils][13] 系统显示相关工具类(包括键盘操作) - * [DoubleKeyValueMap][14] 双键值对 - * [DownloadManagerPro][15] 下载管理工具类 - * [FileUtils][16] 文件操作工具类 - * [HanziToPinyin][17] 汉字转拼音工具类 - * [ImsiUtil][18] IMSI工具类 - * [JSONUtils][46] Json解析工具类 - * [LocationUtils][19] 根据经纬度查询地址信息和根据地址信息查询经纬度 - * [LogUtils][20] Log工具类。课参考博文:[Android Log工具类][43]。 - * [NetUtil][21] 网络工具类 - * [PackageUtils][22] 应用安装下载相关 - * [PhoneUtil][23] 手机组件调用工具类 - * [PollingUtils][24] 轮询服务工具类 - * [PreferencesCookieStore][25] Cookie存储工具类 - * [RUtils][26] R反射资源ID工具类 - * [RandomUtils][27] 随机工具类 - * [RegUtils][28] 数据校验工具类 - * [ResourceUtils][29] 文件资源读取工具类 - * [SDCardUtils][30] SDcard操作工具类 - * [SettingUtils][31] 应用配置工具类 - * [ShellUtils][32] shell工具类 - * [ShortCutUtils][33] 快捷方式工具类 - * [Singleton][34] 单例模式抽象类 - * [StringUtils][35] 字符串操作工具包。字符串其他操作可以使用TextUtils类。 - * [ViewAnimationUtils][36] 视图动画工具箱,提供简单的控制视图的动画的工具方法 - * [ViewUtils][37] View相关工具类 - * [ViewFinder][45] findViewById替代工具类 - * [WindowUtils][38] 窗口工具类 - * [BaseApplication][39] 应用Application此处主要是为了错误处理。 - * [BaseCrashHandler][40] 在Application中统一捕获异常,保存到文件中下次再打开时上传 - * [RebootThreadExceptionHandler][41] 重启线程异常处理器,当发生未知异常时会提示异常信息并在一秒钟后重新启动应用。 - * [StartAppReceiver][42] 重启应用广播接收器。 - -需要权限 (Permission) -------------------- +## 所有的工具类简介 (a - z): + +|类|介绍| +| ------ | ------------ | +|[AnimationUtils][1]|Animation 工具类| +|[AppUtils][2]|APP 相关信息工具类| +|[AssetDatabaseOpenHelper][3]|读取 Asset 目录中数据库工具类| +|[BitmapUtil][4]|Bitmap 工具类主要包括获取 Bitmap 和对 Bitmap 的操作| +|[CipherUtils][5]|加密与解密的工具类| +|[Colors][6]|常用颜色色值工具类| +|[CommonUtil][7]|一些通用的方法| +|[ChannelUtil][46]|为打包而生的渠道工具类 [极速打包传送门][47]| +|[DataCleanManager][8]|应用数据清除类,主要功能有清除内/外缓存,清除数据库,清除 SharedPreference,清除 files 和清除自定义目录| +|[DatabaseExportUtils][9]|导出应用数据库工具类| +|[DateUtils][10]|日期工具类| +|[DeviceStatusUtils][11]|手机状态工具类 主要包括网络、蓝牙、屏幕亮度、飞行模式、音量等| +|[DisplayUtils][13]|系统显示相关工具类| +|[DoubleKeyValueMap][14]|双键值对| +|[DownloadManagerPro][15]|下载管理工具类| +|[FileUtils][16]|文件操作工具类| +|[HanziToPinyin][17]|汉字转拼音工具类| +|[ImsiUtil][18]|IMSI 工具类| +|[JSONUtils][48]|Json 解析工具类| +|[LocationUtils][19]|根据经纬度查询地址信息和根据地址信息查询经纬度| +|[LogUtils][20]|Log工具类。课参考博文:[Android Log 工具类][43]。| +|[NetUtil][21]|网络工具类| +|[PackageUtils][22]|应用安装下载相关| +|[PhoneUtil][23]|手机组件调用工具类| +|[PollingUtils][24]|轮询服务工具类| +|[PreferencesCookieStore][25]|Cookie 存储工具类| +|[RUtils][26]|R 反射资源 ID 工具类| +|[RandomUtils][27]|随机工具类| +|[RegUtils][28]|数据校验工具类| +|[ResourceUtils][29]|文件资源读取工具类| +|[SDCardUtils][30]|SDcard 操作工具类| +|[SettingUtils][31]|应用配置工具类| +|[ShellUtils][32]|shell 工具类| +|[ShortCutUtils][33]|快捷方式工具类| +|[Singleton][34]|单例模式抽象类| +|[StringUtils][35]|字符串操作工具包。字符串其他操作可以使用 TextUtils 类。| +|[ViewAnimationUtils][36]|视图动画工具箱,提供简单的控制视图的动画的工具方法| +|[ViewUtils][37]|View 相关工具类| +|[ViewFinder][45]|findViewById 替代工具类| +|[WindowUtils][38]|窗口工具类| +|[BaseApplication][39]|应用 Application 此处主要是为了错误处理。| +|[BaseCrashHandler][40]|在 Application 中统一捕获异常,保存到文件中下次再打开时上传| +|[RebootThreadExceptionHandler][41]|重启线程异常处理器,当发生未知异常时会提示异常信息并在一秒钟后重新启动应用。| +|[StartAppReceiver][42]|重启应用广播接收器。| +|[ToastsUtils][49]|Toasts弹框。| +|[SharesUtils][50]|分享,调用手机自带的分享字符串或图片。| +|[DeviceUtils][51]|获取设备唯一标志| + +### Framework 内置工具类 + +AOSP 源码中包含Util关键字的类,整理出的列表如下: + +```java +// 系统 +./android/database/DatabaseUtils.java +./android/transition/TransitionUtils.java +./android/view/animation/AnimationUtils.java +./android/view/ViewAnimationUtils.java +./android/webkit/URLUtil.java +./android/bluetooth/le/BluetoothLeUtils.java +./android/gesture/GestureUtils.java +./android/text/TextUtils.java +./android/text/format/DateUtils.java +./android/os/FileUtils.java +./android/os/CommonTimeUtils.java +./android/net/NetworkUtils.java +./android/util/MathUtils.java +./android/util/TimeUtils.java +./android/util/ExceptionUtils.java +./android/util/DebugUtils.java +./android/drm/DrmUtils.java +./android/media/ThumbnailUtils.java +./android/media/ImageUtils.java +./android/media/Utils.java +./android/opengl/GLUtils.java +./android/opengl/ETC1Util.java +./android/telephony/PhoneNumberUtils.java + +// 设计和支持库 +./design/src/android/support/design/widget/ViewGroupUtils.java +./design/src/android/support/design/widget/ThemeUtils.java +./design/src/android/support/design/widget/ViewUtils.java +./design/lollipop/android/support/design/widget/ViewUtilsLollipop.java +./design/base/android/support/design/widget/AnimationUtils.java +./design/base/android/support/design/widget/MathUtils.java +./design/honeycomb/android/support/design/widget/ViewGroupUtilsHoneycomb.java +./v7/recyclerview/src/android/support/v7/widget/helper/ItemTouchUIUtil.java +./v7/recyclerview/src/android/support/v7/widget/helper/ItemTouchUIUtilImpl.java +./v7/recyclerview/src/android/support/v7/util/MessageThreadUtil.java +./v7/recyclerview/src/android/support/v7/util/AsyncListUtil.java +./v7/recyclerview/src/android/support/v7/util/ThreadUtil.java +./v7/recyclerview/tests/src/android/support/v7/widget/AsyncListUtilLayoutTest.java +./v7/recyclerview/tests/src/android/support/v7/util/AsyncListUtilTest.java +./v7/recyclerview/tests/src/android/support/v7/util/ThreadUtilTest.java +./v7/appcompat/src/android/support/v7/graphics/drawable/DrawableUtils.java +./v7/appcompat/src/android/support/v7/widget/DrawableUtils.java +./v7/appcompat/src/android/support/v7/widget/ThemeUtils.java +./v7/appcompat/src/android/support/v7/widget/ViewUtils.java +./v4/tests/java/android/support/v4/graphics/ColorUtilsTest.java +./v4/jellybean-mr1/android/support/v4/text/TextUtilsCompatJellybeanMr1.java +./v4/jellybean/android/support/v4/app/BundleUtil.java +./v4/jellybean/android/support/v4/app/NavUtilsJB.java +./v4/java/android/support/v4/app/NavUtils.java +./v4/java/android/support/v4/database/DatabaseUtilsCompat.java +./v4/java/android/support/v4/graphics/ColorUtils.java +./v4/java/android/support/v4/text/TextUtilsCompat.java +./v4/java/android/support/v4/util/TimeUtils.java +./v4/java/android/support/v4/util/DebugUtils.java +./v4/java/android/support/v4/content/res/TypedArrayUtils.java +``` + +### 如何使用 (How to install) + +```xml +allprojects { + repositories { + // other repositories + maven { + url "http://dl.bintray.com/ihongqiqu/maven" + } + } +} +``` + + +```xml +dependencies { + compile 'com.ihongqiqu:android-utils:1.0.2' +} +``` + +### 需要权限 (Permission) ```xml @@ -60,38 +146,36 @@ android工具类库 + + ``` -配置 (Configuration) ------------------- +### 配置 (Configuration) ```xml ``` -发布正式版本注释Log只需要设置 LogUtils.DEBUG_LEVEL = Log.ASSERT 。 +发布正式版本注释 Log 只需要设置 LogUtils.DEBUG_LEVEL = Log.ASSERT 。 -混淆 (Proguard) -------------- +### 混淆 (Proguard) - 代码混淆只需要在Proguard规则文件中添加如下代码即可(Eclipse下为proguard.cfg文件): + 代码混淆只需要在 Proguard 规则文件中添加如下代码即可( Eclipse 下为 proguard.cfg 文件): -``` xml +```xml -keep class com.ihongqiqu.** { *; } -keepclassmembers class com.ihongqiqu.** { *; } -dontwarn com.ihongqiqu.** ``` -开发者 (Developer) ----------------- +### 开发者 (Developer) * [Zhenguo Jin][44] - -License -------- +## License - Copyright 2014-2015 Zhenguo Jin + Copyright 2014-2017 Zhenguo Jin Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -105,52 +189,55 @@ License See the License for the specific language governing permissions and limitations under the License. -[1]: https://github.com/jingle1267/android-utils/blob/master/src/com/ihongqiqu/util/AnimationUtils.java -[2]: https://github.com/jingle1267/android-utils/blob/master/src/com/ihongqiqu/util/AppUtils.java -[3]: https://github.com/jingle1267/android-utils/blob/master/src/com/ihongqiqu/util/AssetDatabaseOpenHelper.java -[4]: https://github.com/jingle1267/android-utils/blob/master/src/com/ihongqiqu/util/BitmapUtil.java -[5]: https://github.com/jingle1267/android-utils/blob/master/src/com/ihongqiqu/util/CipherUtils.java -[6]: https://github.com/jingle1267/android-utils/blob/master/src/com/ihongqiqu/util/Colors.java -[7]: https://github.com/jingle1267/android-utils/blob/master/src/com/ihongqiqu/util/CommonUtil.java -[8]: https://github.com/jingle1267/android-utils/blob/master/src/com/ihongqiqu/util/DataCleanManager.java -[9]: https://github.com/jingle1267/android-utils/blob/master/src/com/ihongqiqu/util/DatabaseExportUtils.java -[10]: https://github.com/jingle1267/android-utils/blob/master/src/com/ihongqiqu/util/DateUtils.java -[11]: https://github.com/jingle1267/android-utils/blob/master/src/com/ihongqiqu/util/DeviceStatusUtils.java -[12]: https://github.com/jingle1267/android-utils/blob/master/src/com/ihongqiqu/util/ -[13]: https://github.com/jingle1267/android-utils/blob/master/src/com/ihongqiqu/util/DisplayUtils.java -[14]: https://github.com/jingle1267/android-utils/blob/master/src/com/ihongqiqu/util/DoubleKeyValueMap.java -[15]: https://github.com/jingle1267/android-utils/blob/master/src/com/ihongqiqu/util/DownloadManagerPro.java -[16]: https://github.com/jingle1267/android-utils/blob/master/src/com/ihongqiqu/util/FileUtils.java -[17]: https://github.com/jingle1267/android-utils/blob/master/src/com/ihongqiqu/util/HanziToPinyin.java -[18]: https://github.com/jingle1267/android-utils/blob/master/src/com/ihongqiqu/util/ImsiUtil.java -[19]: https://github.com/jingle1267/android-utils/blob/master/src/com/ihongqiqu/util/LocationUtils.java -[20]: https://github.com/jingle1267/android-utils/blob/master/src/com/ihongqiqu/util/LogUtils.java -[21]: https://github.com/jingle1267/android-utils/blob/master/src/com/ihongqiqu/util/NetUtil.java -[22]: https://github.com/jingle1267/android-utils/blob/master/src/com/ihongqiqu/util/PackageUtils.java -[23]: https://github.com/jingle1267/android-utils/blob/master/src/com/ihongqiqu/util/PhoneUtil.java -[24]: https://github.com/jingle1267/android-utils/blob/master/src/com/ihongqiqu/util/PollingUtils.java -[25]: https://github.com/jingle1267/android-utils/blob/master/src/com/ihongqiqu/util/PreferencesCookieStore.java -[26]: https://github.com/jingle1267/android-utils/blob/master/src/com/ihongqiqu/util/RUtils.java -[27]: https://github.com/jingle1267/android-utils/blob/master/src/com/ihongqiqu/util/RandomUtils.java -[28]: https://github.com/jingle1267/android-utils/blob/master/src/com/ihongqiqu/util/RegUtils.java -[29]: https://github.com/jingle1267/android-utils/blob/master/src/com/ihongqiqu/util/ResourceUtils.java -[30]: https://github.com/jingle1267/android-utils/blob/master/src/com/ihongqiqu/util/SDCardUtils.java -[31]: https://github.com/jingle1267/android-utils/blob/master/src/com/ihongqiqu/util/SettingUtils.java -[32]: https://github.com/jingle1267/android-utils/blob/master/src/com/ihongqiqu/util/ShellUtils.java -[33]: https://github.com/jingle1267/android-utils/blob/master/src/com/ihongqiqu/util/ShortCutUtils.java -[34]: https://github.com/jingle1267/android-utils/blob/master/src/com/ihongqiqu/util/Singleton.java -[35]: https://github.com/jingle1267/android-utils/blob/master/src/com/ihongqiqu/util/StringUtils.java -[36]: https://github.com/jingle1267/android-utils/blob/master/src/com/ihongqiqu/util/ViewAnimationUtils.java -[37]: https://github.com/jingle1267/android-utils/blob/master/src/com/ihongqiqu/util/ViewUtils.java -[38]: https://github.com/jingle1267/android-utils/blob/master/src/com/ihongqiqu/util/WindowUtils.java -[46]: https://github.com/jingle1267/android-utils/blob/master/src/com/ihongqiqu/util/JSONUtils.java - -[39]: https://github.com/jingle1267/android-utils/blob/master/src/com/ihongqiqu/app/BaseApplication.java -[40]: https://github.com/jingle1267/android-utils/blob/master/src/com/ihongqiqu/app/BaseCrashHandler.java -[41]: https://github.com/jingle1267/android-utils/blob/master/src/com/ihongqiqu/app/RebootThreadExceptionHandler.java -[42]: https://github.com/jingle1267/android-utils/blob/master/src/com/ihongqiqu/app/StartAppReceiver.java -[43]: http://ihongqiqu.com/blog/2014/10/16/android-log/ +[1]: https://github.com/jingle1267/android-utils/tree/master/util/src/main/java/com/ihongqiqu/util/AnimationUtils.java +[2]: https://github.com/jingle1267/android-utils/tree/master/util/src/main/java/com/ihongqiqu/util/AppUtils.java +[3]: https://github.com/jingle1267/android-utils/tree/master/util/src/main/java/com/ihongqiqu/util/AssetDatabaseOpenHelper.java +[4]: https://github.com/jingle1267/android-utils/tree/master/util/src/main/java/com/ihongqiqu/util/BitmapUtil.java +[5]: https://github.com/jingle1267/android-utils/tree/master/util/src/main/java/com/ihongqiqu/util/CipherUtils.java +[6]: https://github.com/jingle1267/android-utils/tree/master/util/src/main/java/com/ihongqiqu/util/Colors.java +[7]: https://github.com/jingle1267/android-utils/tree/master/util/src/main/java/com/ihongqiqu/util/CommonUtil.java +[8]: https://github.com/jingle1267/android-utils/tree/master/util/src/main/java/com/ihongqiqu/util/DataCleanManager.java +[9]: https://github.com/jingle1267/android-utils/tree/master/util/src/main/java/com/ihongqiqu/util/DatabaseExportUtils.java +[10]: https://github.com/jingle1267/android-utils/tree/master/util/src/main/java/com/ihongqiqu/util/DateUtils.java +[11]: https://github.com/jingle1267/android-utils/tree/master/util/src/main/java/com/ihongqiqu/util/DeviceStatusUtils.java +[12]: https://github.com/jingle1267/android-utils/tree/master/util/src/main/java/com/ihongqiqu/util/ +[13]: https://github.com/jingle1267/android-utils/tree/master/util/src/main/java/com/ihongqiqu/util/DisplayUtils.java +[14]: https://github.com/jingle1267/android-utils/tree/master/util/src/main/java/com/ihongqiqu/util/DoubleKeyValueMap.java +[15]: https://github.com/jingle1267/android-utils/tree/master/util/src/main/java/com/ihongqiqu/util/DownloadManagerPro.java +[16]: https://github.com/jingle1267/android-utils/tree/master/util/src/main/java/com/ihongqiqu/util/FileUtils.java +[17]: https://github.com/jingle1267/android-utils/tree/master/util/src/main/java/com/ihongqiqu/util/HanziToPinyin.java +[18]: https://github.com/jingle1267/android-utils/tree/master/util/src/main/java/com/ihongqiqu/util/ImsiUtil.java +[19]: https://github.com/jingle1267/android-utils/tree/master/util/src/main/java/com/ihongqiqu/util/LocationUtils.java +[20]: https://github.com/jingle1267/android-utils/tree/master/util/src/main/java/com/ihongqiqu/util/LogUtils.java +[21]: https://github.com/jingle1267/android-utils/tree/master/util/src/main/java/com/ihongqiqu/util/NetUtil.java +[22]: https://github.com/jingle1267/android-utils/tree/master/util/src/main/java/com/ihongqiqu/util/PackageUtils.java +[23]: https://github.com/jingle1267/android-utils/tree/master/util/src/main/java/com/ihongqiqu/util/PhoneUtil.java +[24]: https://github.com/jingle1267/android-utils/tree/master/util/src/main/java/com/ihongqiqu/util/PollingUtils.java +[25]: https://github.com/jingle1267/android-utils/tree/master/util/src/main/java/com/ihongqiqu/util/PreferencesCookieStore.java +[26]: https://github.com/jingle1267/android-utils/tree/master/util/src/main/java/com/ihongqiqu/util/RUtils.java +[27]: https://github.com/jingle1267/android-utils/tree/master/util/src/main/java/com/ihongqiqu/util/RandomUtils.java +[28]: https://github.com/jingle1267/android-utils/tree/master/util/src/main/java/com/ihongqiqu/util/RegUtils.java +[29]: https://github.com/jingle1267/android-utils/tree/master/util/src/main/java/com/ihongqiqu/util/ResourceUtils.java +[30]: https://github.com/jingle1267/android-utils/tree/master/util/src/main/java/com/ihongqiqu/util/SDCardUtils.java +[31]: https://github.com/jingle1267/android-utils/tree/master/util/src/main/java/com/ihongqiqu/util/SettingUtils.java +[32]: https://github.com/jingle1267/android-utils/tree/master/util/src/main/java/com/ihongqiqu/util/ShellUtils.java +[33]: https://github.com/jingle1267/android-utils/tree/master/util/src/main/java/com/ihongqiqu/util/ShortCutUtils.java +[34]: https://github.com/jingle1267/android-utils/tree/master/util/src/main/java/com/ihongqiqu/util/Singleton.java +[35]: https://github.com/jingle1267/android-utils/tree/master/util/src/main/java/com/ihongqiqu/util/StringUtils.java +[36]: https://github.com/jingle1267/android-utils/tree/master/util/src/main/java/com/ihongqiqu/util/ViewAnimationUtils.java +[37]: https://github.com/jingle1267/android-utils/tree/master/util/src/main/java/com/ihongqiqu/util/ViewUtils.java +[38]: https://github.com/jingle1267/android-utils/tree/master/util/src/main/java/com/ihongqiqu/util/WindowUtils.java + +[39]: https://github.com/jingle1267/android-utils/blob/master/app/src/main/java/com/ihongqiqu/app/BaseApplication.java +[40]: https://github.com/jingle1267/android-utils/blob/master/app/src/main/java/com/ihongqiqu/app/BaseCrashHandler.java +[41]: https://github.com/jingle1267/android-utils/blob/master/app/src/main/java/com/ihongqiqu/app/RebootThreadExceptionHandler.java +[42]: https://github.com/jingle1267/android-utils/blob/master/app/src/main/java/com/ihongqiqu/app/StartAppReceiver.java +[43]: http://ihongqiqu.com/2014/10/16/android-log/ [44]: http://ihongqiqu.com -[45]: https://github.com/jingle1267/android-utils/blob/master/src/com/ihongqiqu/util/ViewFinder.java -[46]: https://github.com/jingle1267/android-utils/blob/master/src/com/ihongqiqu/util/ChannelUtil.java -[47]: http://ihongqiqu.com/blog/2015/07/16/android-mutiple-channel-build/ +[45]: https://github.com/jingle1267/android-utils/tree/master/util/src/main/java/com/ihongqiqu/util/ViewFinder.java +[46]: https://github.com/jingle1267/android-utils/tree/master/util/src/main/java/com/ihongqiqu/util/ChannelUtil.java +[47]: http://ihongqiqu.com/2015/07/16/android-mutiple-channel-build/ +[48]: https://github.com/jingle1267/android-utils/tree/master/util/src/main/java/com/ihongqiqu/util/JSONUtils.java +[49]: https://github.com/jingle1267/android-utils/tree/master/util/src/main/java/com/ihongqiqu/util/ToastsUtils.java +[50]: https://github.com/jingle1267/android-utils/tree/master/util/src/main/java/com/ihongqiqu/util/SharesUtils.java +[51]: https://github.com/jingle1267/android-utils/tree/master/util/src/main/java/com/ihongqiqu/util/DeviceUtils.java diff --git a/android-utils-jingle1267.iml b/android-utils-jingle1267.iml deleted file mode 100644 index 96b12f9..0000000 --- a/android-utils-jingle1267.iml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/android-utils.iml b/android-utils.iml deleted file mode 100644 index 14f7fbd..0000000 --- a/android-utils.iml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/.gitignore b/app/.gitignore new file mode 100644 index 0000000..796b96d --- /dev/null +++ b/app/.gitignore @@ -0,0 +1 @@ +/build diff --git a/app/build.gradle b/app/build.gradle new file mode 100644 index 0000000..b1efe9d --- /dev/null +++ b/app/build.gradle @@ -0,0 +1,35 @@ +apply plugin: 'com.android.application' + +android { + compileSdkVersion 25 + buildToolsVersion "25.0.0" + defaultConfig { + applicationId "com.ihongqiqu.demo" + minSdkVersion 15 + targetSdkVersion 25 + versionCode 1 + versionName "1.0" + testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + } + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + } + lintOptions { + abortOnError false + } +} + +dependencies { + compile fileTree(dir: 'libs', include: ['*.jar']) + androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { + exclude group: 'com.android.support', module: 'support-annotations' + }) + compile 'com.android.support:appcompat-v7:25.1.0' + //compile 'com.android.support.constraint:constraint-layout:1.0.0-beta4' + compile 'com.ihongqiqu:android-utils:1.0.2' + // testCompile 'junit:junit:4.12' +// compile project(path: ':util') +} diff --git a/proguard-project.txt b/app/proguard-rules.pro similarity index 51% rename from proguard-project.txt rename to app/proguard-rules.pro index f2fe155..d96da59 100644 --- a/proguard-project.txt +++ b/app/proguard-rules.pro @@ -1,11 +1,8 @@ -# To enable ProGuard in your project, edit project.properties -# to define the proguard.config property as described in that file. -# # Add project specific ProGuard rules here. # By default, the flags in this file are appended to flags specified -# in ${sdk.dir}/tools/proguard/proguard-android.txt -# You can edit the include path and order by changing the ProGuard -# include property in project.properties. +# in /Users/zhenguo/Documents/develop/android-sdk-macosx/tools/proguard/proguard-android.txt +# You can edit the include path and order by changing the proguardFiles +# directive in build.gradle. # # For more details, see # http://developer.android.com/guide/developing/tools/proguard.html @@ -18,3 +15,11 @@ #-keepclassmembers class fqcn.of.javascript.interface.for.webview { # public *; #} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile diff --git a/app/src/androidTest/java/com/ihongqiqu/demo/ExampleInstrumentedTest.java b/app/src/androidTest/java/com/ihongqiqu/demo/ExampleInstrumentedTest.java new file mode 100644 index 0000000..cfc9c95 --- /dev/null +++ b/app/src/androidTest/java/com/ihongqiqu/demo/ExampleInstrumentedTest.java @@ -0,0 +1,27 @@ +package com.ihongqiqu.demo; + +import android.content.Context; +import android.support.test.InstrumentationRegistry; +import android.support.test.runner.AndroidJUnit4; + +import org.junit.Test; +import org.junit.runner.RunWith; + + +import static org.junit.Assert.*; + +/** + * Instrumentation test, which will execute on an Android device. + * + * @see Testing documentation + */ +@RunWith(AndroidJUnit4.class) +public class ExampleInstrumentedTest { + @Test + public void useAppContext() throws Exception { + // Context of the app under test. + Context appContext = InstrumentationRegistry.getTargetContext(); + + assertEquals("com.ihongqiqu.demo", appContext.getPackageName()); + } +} diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..36d3ea7 --- /dev/null +++ b/app/src/main/AndroidManifest.xml @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/com/ihongqiqu/app/BaseApplication.java b/app/src/main/java/com/ihongqiqu/app/BaseApplication.java similarity index 100% rename from src/com/ihongqiqu/app/BaseApplication.java rename to app/src/main/java/com/ihongqiqu/app/BaseApplication.java index 3a3bb2b..7219d83 100644 --- a/src/com/ihongqiqu/app/BaseApplication.java +++ b/app/src/main/java/com/ihongqiqu/app/BaseApplication.java @@ -1,11 +1,11 @@ package com.ihongqiqu.app; -import java.util.ArrayList; -import java.util.List; - import android.app.Activity; import android.app.Application; +import java.util.ArrayList; +import java.util.List; + /** * 捕获应用异常Application * 在这里完成整个应用退出;在这里进行全局变量的传递;在这里完成低内存的释放;在这里捕获未抓住的异常;用于应用配置, 预加载处理 diff --git a/src/com/ihongqiqu/app/BaseCrashHandler.java b/app/src/main/java/com/ihongqiqu/app/BaseCrashHandler.java similarity index 98% rename from src/com/ihongqiqu/app/BaseCrashHandler.java rename to app/src/main/java/com/ihongqiqu/app/BaseCrashHandler.java index 91be596..19ca6a2 100644 --- a/src/com/ihongqiqu/app/BaseCrashHandler.java +++ b/app/src/main/java/com/ihongqiqu/app/BaseCrashHandler.java @@ -1,12 +1,12 @@ /** * Copyright 2014 Zhenguo Jin - * + *

* Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -15,17 +15,15 @@ */ package com.ihongqiqu.app; -import java.io.File; -import java.io.FileOutputStream; -import java.lang.Thread.UncaughtExceptionHandler; -import java.util.Date; - -import com.ihongqiqu.util.LogUtils; - import android.content.Context; import android.os.Environment; import android.os.Looper; import android.widget.Toast; +import com.ihongqiqu.util.LogUtils; +import java.io.File; +import java.io.FileOutputStream; +import java.lang.Thread.UncaughtExceptionHandler; +import java.util.Date; /** * 在Application中统一捕获异常,保存到文件中下次再打开时上传 @@ -42,7 +40,7 @@ public class BaseCrashHandler implements UncaughtExceptionHandler { /** * 系统默认的UncaughtException处理类 */ - private Thread.UncaughtExceptionHandler mDefaultHandler; + private UncaughtExceptionHandler mDefaultHandler; /** * CrashHandler实例 diff --git a/src/com/ihongqiqu/app/RebootThreadExceptionHandler.java b/app/src/main/java/com/ihongqiqu/app/RebootThreadExceptionHandler.java similarity index 97% rename from src/com/ihongqiqu/app/RebootThreadExceptionHandler.java rename to app/src/main/java/com/ihongqiqu/app/RebootThreadExceptionHandler.java index 168aafb..5b1bb38 100644 --- a/src/com/ihongqiqu/app/RebootThreadExceptionHandler.java +++ b/app/src/main/java/com/ihongqiqu/app/RebootThreadExceptionHandler.java @@ -1,12 +1,12 @@ /** * Copyright 2014 Zhenguo Jin (jinzhenguo1990@gmail.com) - * + *

* Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -15,10 +15,6 @@ */ package com.ihongqiqu.app; -import java.lang.Thread.UncaughtExceptionHandler; -import java.util.Calendar; -import java.util.GregorianCalendar; - import android.app.AlarmManager; import android.app.PendingIntent; import android.content.Context; @@ -27,6 +23,10 @@ import android.text.TextUtils; import android.widget.Toast; +import java.lang.Thread.UncaughtExceptionHandler; +import java.util.Calendar; +import java.util.GregorianCalendar; + /** * 重启线程异常处理器,当发生未知异常时会提示异常信息并在一秒钟后重新启动应用 *
使用此功能的第一步需要你在AndroidMainfest.xml中注册me.xiaopan.android.content.StartApplicationBrocastReceiver广播(注意不要任何的filter) diff --git a/src/com/ihongqiqu/app/StartAppReceiver.java b/app/src/main/java/com/ihongqiqu/app/StartAppReceiver.java similarity index 93% rename from src/com/ihongqiqu/app/StartAppReceiver.java rename to app/src/main/java/com/ihongqiqu/app/StartAppReceiver.java index 0c1c81e..895eec1 100644 --- a/src/com/ihongqiqu/app/StartAppReceiver.java +++ b/app/src/main/java/com/ihongqiqu/app/StartAppReceiver.java @@ -1,12 +1,12 @@ /** * Copyright 2014 Zhenguo Jin (jinzhenguo1990@gmail.com) - * + *

* Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/app/src/main/java/com/ihongqiqu/component/OnClickEvent.java b/app/src/main/java/com/ihongqiqu/component/OnClickEvent.java new file mode 100644 index 0000000..022ffd5 --- /dev/null +++ b/app/src/main/java/com/ihongqiqu/component/OnClickEvent.java @@ -0,0 +1,35 @@ +package com.ihongqiqu.component; + +import android.view.View; + +/** + * 防止Button的频繁点击,多次执行点击事件 + *

+ * Created by zhenguo on 4/16/16. + */ +public abstract class OnClickEvent implements View.OnClickListener { + + public static long lastTime; + + public abstract void singleClick(View v); + + @Override + public void onClick(View v) { + if (onDoubClick()) { + return; + } + singleClick(v); + } + + public boolean onDoubClick() { + boolean flag = false; + long time = System.currentTimeMillis() - lastTime; + + if (time > 500) { + flag = true; + } + lastTime = System.currentTimeMillis(); + return flag; + } + +} diff --git a/src/com/ihongqiqu/demo/BitmapActivity.java b/app/src/main/java/com/ihongqiqu/demo/BitmapActivity.java similarity index 92% rename from src/com/ihongqiqu/demo/BitmapActivity.java rename to app/src/main/java/com/ihongqiqu/demo/BitmapActivity.java index 82a6ddb..d29bddc 100644 --- a/src/com/ihongqiqu/demo/BitmapActivity.java +++ b/app/src/main/java/com/ihongqiqu/demo/BitmapActivity.java @@ -1,12 +1,12 @@ /** * Copyright 2014 Zhenguo Jin - * + *

* Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -15,17 +15,16 @@ */ package com.ihongqiqu.demo; -import android.view.View; -import android.widget.Toast; -import com.worthed.R; -import com.ihongqiqu.util.BitmapUtil; - import android.app.Activity; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.os.Bundle; import android.util.Log; +import android.view.View; import android.widget.ImageView; +import android.widget.Toast; + +import com.ihongqiqu.util.BitmapUtil; import com.ihongqiqu.util.LogUtils; /** @@ -54,22 +53,22 @@ protected void onCreate(Bundle savedInstanceState) { testProcess(); testCombine(); - blurOriginBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.sea); + blurOriginBitmap = BitmapFactory.decodeResource(getResources(), R.mipmap.sea); toast = Toast.makeText(this, "Radius 必须在0到25范围", Toast.LENGTH_SHORT); } private void testProcess() { Bitmap bitmap = BitmapFactory.decodeResource(getResources(), - R.drawable.beautiful); + R.mipmap.beautiful); imageViewOrigin.setImageBitmap(BitmapUtil.getRoundBitmap(bitmap)); bitmap.recycle(); } private void testCombine() { Bitmap bitmap = BitmapUtil.getRoundBitmap(BitmapFactory.decodeResource(getResources(), - R.drawable.beautiful)); + R.mipmap.beautiful)); Bitmap mask = BitmapFactory.decodeResource(getResources(), - R.drawable.sea); + R.mipmap.sea); Log.d(TAG, "foreground width - height : " + bitmap.getWidth() + " - " + bitmap.getHeight()); Log.d(TAG, "background width - height : " + mask.getWidth() + " - " + mask.getHeight()); @@ -84,7 +83,7 @@ public void radiusSmall(View view) { if (radius < 0) { radius = 0; toast.show(); - blurImageView.setImageResource(R.drawable.sea); + blurImageView.setImageResource(R.mipmap.sea); return; } long start = System.nanoTime(); diff --git a/app/src/main/java/com/ihongqiqu/demo/MainActivity.java b/app/src/main/java/com/ihongqiqu/demo/MainActivity.java new file mode 100644 index 0000000..f5f31de --- /dev/null +++ b/app/src/main/java/com/ihongqiqu/demo/MainActivity.java @@ -0,0 +1,80 @@ +package com.ihongqiqu.demo; + +import android.app.Activity; +import android.content.Intent; +import android.os.Bundle; +import android.util.Log; +import android.view.Menu; +import android.view.View; +import android.widget.Button; +import android.widget.TextView; + +import com.ihongqiqu.util.AppUtils; +import com.ihongqiqu.util.NetUtil; +import com.ihongqiqu.util.ViewFinder; + +import java.util.Map; + +/** + * 测试代码 + */ +public class MainActivity extends Activity { + + private TextView title; + private Button btnBitmap, btnViewFinder; + + private ViewFinder finder; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + finder = new ViewFinder(this); + title = finder.find(R.id.title); + btnBitmap = finder.find(R.id.btn_bitmap); + btnViewFinder = finder.find(R.id.btn_view_finder); + + title.setText("Demos:"); + btnBitmap.setText("BitmapDemo"); + btnViewFinder.setText("ViewFinderDemo"); + + Log.d("MainActivity", AppUtils.getUUID(this)); + netTest(); + } + + @Override + public boolean onCreateOptionsMenu(Menu menu) { + return true; + } + + public void onClick(View view) { + int i = view.getId(); + if (i == R.id.btn_bitmap) { + Intent intent = new Intent(this, BitmapActivity.class); + startActivity(intent); + } else if (i == R.id.btn_view_finder) { + Intent intent1 = new Intent(this, ViewFinderActivity.class); + startActivity(intent1); + } + } + + void netTest() { + String url = "http://baidu.com"; + String url2 = "ftp://baidu.com?a=1&b="; + String url3 = "https://baidu.com?a=1&b="; + String url4 = "010%"; + String url5 = " "; + Log.d("MainActivity", "NetUtil.isUrl(url):" + NetUtil.isUrl(url)); + Log.d("MainActivity", "NetUtil.isUrl(url2):" + NetUtil.isUrl(url2)); + Log.d("MainActivity", "NetUtil.isUrl(url3):" + NetUtil.isUrl(url3)); + Log.d("MainActivity", "NetUtil.isUrl(url4):" + NetUtil.isUrl(url4)); + Log.d("MainActivity", "NetUtil.isUrl(url5):" + NetUtil.isUrl(url5)); + + Map params = NetUtil.getUrlParams("http://www.baidu.com/abc/c.html?a=1&b=&c="); + for (String key : params.keySet()) { + String value = params.get(key); + Log.d("MainActivity", "key-value : " + key + "-" + value); + } + } + +} \ No newline at end of file diff --git a/src/com/ihongqiqu/demo/ViewFinderActivity.java b/app/src/main/java/com/ihongqiqu/demo/ViewFinderActivity.java similarity index 91% rename from src/com/ihongqiqu/demo/ViewFinderActivity.java rename to app/src/main/java/com/ihongqiqu/demo/ViewFinderActivity.java index a89d6d3..eac69a0 100644 --- a/src/com/ihongqiqu/demo/ViewFinderActivity.java +++ b/app/src/main/java/com/ihongqiqu/demo/ViewFinderActivity.java @@ -5,7 +5,7 @@ import android.widget.Button; import android.widget.ImageView; import android.widget.TextView; -import com.worthed.R; + import com.ihongqiqu.util.ViewFinder; /** @@ -34,7 +34,7 @@ protected void onCreate(Bundle savedInstanceState) { title.setText("text"); bitmapBtn.setText("button"); - imageView.setImageResource(R.drawable.beautiful); + imageView.setImageResource(R.mipmap.beautiful); } } diff --git a/app/src/main/res/layout/activity_bitmap.xml b/app/src/main/res/layout/activity_bitmap.xml new file mode 100644 index 0000000..387ede3 --- /dev/null +++ b/app/src/main/res/layout/activity_bitmap.xml @@ -0,0 +1,92 @@ + + + + + + + + + + + + + + + + + + + + + +