diff --git a/README.md b/README.md
index fe31992..ce97cc5 100644
--- a/README.md
+++ b/README.md
@@ -226,10 +226,10 @@ dependencies {
[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/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
+[39]: https://github.com/jingle1267/android-utils/tree/master/app/src/com/ihongqiqu/app/BaseApplication.java
+[40]: https://github.com/jingle1267/android-utils/tree/master/app/src/com/ihongqiqu/app/BaseCrashHandler.java
+[41]: https://github.com/jingle1267/android-utils/tree/master/app/src/com/ihongqiqu/app/RebootThreadExceptionHandler.java
+[42]: https://github.com/jingle1267/android-utils/tree/master/app/src/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/tree/master/util/src/main/java/com/ihongqiqu/util/ViewFinder.java
diff --git a/app/build.gradle b/app/build.gradle
index 7702d96..0646798 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -6,7 +6,7 @@ android {
defaultConfig {
applicationId "com.ihongqiqu.demo"
minSdkVersion 15
- targetSdkVersion 22
+ targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
@@ -29,7 +29,7 @@ dependencies {
})
compile 'com.android.support:appcompat-v7:25.1.0'
compile 'com.android.support.constraint:constraint-layout:1.0.0-beta4'
- compile 'com.ihongqiqu.util:android-utils:1.0.0'
+ compile 'com.ihongqiqu.util:android-utils:1.0.1'
// testCompile 'junit:junit:4.12'
- // compile project(path: ':util')
+// compile project(path: ':util')
}
diff --git a/app/src/main/res/layout/activity_bitmap.xml b/app/src/main/res/layout/activity_bitmap.xml
index ada7c6b..387ede3 100644
--- a/app/src/main/res/layout/activity_bitmap.xml
+++ b/app/src/main/res/layout/activity_bitmap.xml
@@ -5,7 +5,7 @@
@@ -14,10 +14,10 @@
android:id="@+id/textView1"
android:layout_margin="15dp"
android:textSize="20sp"
- android:gravity="left"
+ android:gravity="start"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:text="圆形图:" />
+ android:text="@string/str_circle_title" />
+ android:text="@string/str_combine_img" />
@@ -64,7 +64,7 @@
+ android:text="@string/str_all_demos" />
+ android:text="@string/str_bitmap_demo" />
+ android:text="@string/str_view_finder_demo" />
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_view_finder.xml b/app/src/main/res/layout/activity_view_finder.xml
index 765bcfc..24a90b0 100644
--- a/app/src/main/res/layout/activity_view_finder.xml
+++ b/app/src/main/res/layout/activity_view_finder.xml
@@ -4,22 +4,22 @@
+ android:text="@string/app_name" />
+ android:text="@string/app_name" />
- demo
+ 工具类Demo
+ 圆形图:
+ 合并图:
+ 高斯模糊:
+ Radius -
+ Radius +
+ Demos :
+ Bitmap Demo
+ View Finder Demo
diff --git a/demo/.gitignore b/demo/.gitignore
new file mode 100644
index 0000000..796b96d
--- /dev/null
+++ b/demo/.gitignore
@@ -0,0 +1 @@
+/build
diff --git a/demo/build.gradle b/demo/build.gradle
new file mode 100644
index 0000000..4173844
--- /dev/null
+++ b/demo/build.gradle
@@ -0,0 +1,33 @@
+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'
+ }
+ }
+}
+
+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'
+ testCompile 'junit:junit:4.12'
+}
diff --git a/demo/proguard-rules.pro b/demo/proguard-rules.pro
new file mode 100644
index 0000000..d96da59
--- /dev/null
+++ b/demo/proguard-rules.pro
@@ -0,0 +1,25 @@
+# Add project specific ProGuard rules here.
+# By default, the flags in this file are appended to flags specified
+# 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
+
+# Add any project specific keep options here:
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-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/demo/src/androidTest/java/com/ihongqiqu/demo/ExampleInstrumentedTest.java b/demo/src/androidTest/java/com/ihongqiqu/demo/ExampleInstrumentedTest.java
new file mode 100644
index 0000000..4f1ad13
--- /dev/null
+++ b/demo/src/androidTest/java/com/ihongqiqu/demo/ExampleInstrumentedTest.java
@@ -0,0 +1,26 @@
+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/demo/src/main/AndroidManifest.xml b/demo/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..0739292
--- /dev/null
+++ b/demo/src/main/AndroidManifest.xml
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/demo/src/main/java/com/ihongqiqu/demo/MainActivity.java b/demo/src/main/java/com/ihongqiqu/demo/MainActivity.java
new file mode 100644
index 0000000..0a43f08
--- /dev/null
+++ b/demo/src/main/java/com/ihongqiqu/demo/MainActivity.java
@@ -0,0 +1,13 @@
+package com.ihongqiqu.demo;
+
+import android.support.v7.app.AppCompatActivity;
+import android.os.Bundle;
+
+public class MainActivity extends AppCompatActivity {
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_main);
+ }
+}
diff --git a/demo/src/main/res/layout/activity_main.xml b/demo/src/main/res/layout/activity_main.xml
new file mode 100644
index 0000000..3165c85
--- /dev/null
+++ b/demo/src/main/res/layout/activity_main.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
diff --git a/demo/src/main/res/mipmap-hdpi/ic_launcher.png b/demo/src/main/res/mipmap-hdpi/ic_launcher.png
new file mode 100644
index 0000000..cde69bc
Binary files /dev/null and b/demo/src/main/res/mipmap-hdpi/ic_launcher.png differ
diff --git a/demo/src/main/res/mipmap-hdpi/ic_launcher_round.png b/demo/src/main/res/mipmap-hdpi/ic_launcher_round.png
new file mode 100644
index 0000000..9a078e3
Binary files /dev/null and b/demo/src/main/res/mipmap-hdpi/ic_launcher_round.png differ
diff --git a/demo/src/main/res/mipmap-mdpi/ic_launcher.png b/demo/src/main/res/mipmap-mdpi/ic_launcher.png
new file mode 100644
index 0000000..c133a0c
Binary files /dev/null and b/demo/src/main/res/mipmap-mdpi/ic_launcher.png differ
diff --git a/demo/src/main/res/mipmap-mdpi/ic_launcher_round.png b/demo/src/main/res/mipmap-mdpi/ic_launcher_round.png
new file mode 100644
index 0000000..efc028a
Binary files /dev/null and b/demo/src/main/res/mipmap-mdpi/ic_launcher_round.png differ
diff --git a/demo/src/main/res/mipmap-xhdpi/ic_launcher.png b/demo/src/main/res/mipmap-xhdpi/ic_launcher.png
new file mode 100644
index 0000000..bfa42f0
Binary files /dev/null and b/demo/src/main/res/mipmap-xhdpi/ic_launcher.png differ
diff --git a/demo/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/demo/src/main/res/mipmap-xhdpi/ic_launcher_round.png
new file mode 100644
index 0000000..3af2608
Binary files /dev/null and b/demo/src/main/res/mipmap-xhdpi/ic_launcher_round.png differ
diff --git a/demo/src/main/res/mipmap-xxhdpi/ic_launcher.png b/demo/src/main/res/mipmap-xxhdpi/ic_launcher.png
new file mode 100644
index 0000000..324e72c
Binary files /dev/null and b/demo/src/main/res/mipmap-xxhdpi/ic_launcher.png differ
diff --git a/demo/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/demo/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
new file mode 100644
index 0000000..9bec2e6
Binary files /dev/null and b/demo/src/main/res/mipmap-xxhdpi/ic_launcher_round.png differ
diff --git a/demo/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/demo/src/main/res/mipmap-xxxhdpi/ic_launcher.png
new file mode 100644
index 0000000..aee44e1
Binary files /dev/null and b/demo/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ
diff --git a/demo/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/demo/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
new file mode 100644
index 0000000..34947cd
Binary files /dev/null and b/demo/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png differ
diff --git a/demo/src/main/res/values/colors.xml b/demo/src/main/res/values/colors.xml
new file mode 100644
index 0000000..3ab3e9c
--- /dev/null
+++ b/demo/src/main/res/values/colors.xml
@@ -0,0 +1,6 @@
+
+
+ #3F51B5
+ #303F9F
+ #FF4081
+
diff --git a/demo/src/main/res/values/strings.xml b/demo/src/main/res/values/strings.xml
new file mode 100644
index 0000000..ad12620
--- /dev/null
+++ b/demo/src/main/res/values/strings.xml
@@ -0,0 +1,3 @@
+
+ demo
+
diff --git a/demo/src/main/res/values/styles.xml b/demo/src/main/res/values/styles.xml
new file mode 100644
index 0000000..5885930
--- /dev/null
+++ b/demo/src/main/res/values/styles.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
diff --git a/util/build.gradle b/util/build.gradle
index bc0bbaa..efdbbb8 100644
--- a/util/build.gradle
+++ b/util/build.gradle
@@ -37,7 +37,7 @@ publish {
userOrg = 'hongqiqu'
groupId = 'com.ihongqiqu.util'
artifactId = 'android-utils'
- publishVersion = '1.0.0'
+ publishVersion = '1.0.1'
desc = 'android utils'
website = 'https://github.com/jingle1267/android-utils'
}
diff --git a/util/src/main/java/com/ihongqiqu/util/AppUtils.java b/util/src/main/java/com/ihongqiqu/util/AppUtils.java
index 79516d3..30c020b 100644
--- a/util/src/main/java/com/ihongqiqu/util/AppUtils.java
+++ b/util/src/main/java/com/ihongqiqu/util/AppUtils.java
@@ -15,6 +15,8 @@
*/
package com.ihongqiqu.util;
+import android.Manifest;
+
import android.annotation.TargetApi;
import android.app.ActivityManager;
import android.app.ActivityManager.MemoryInfo;
@@ -31,6 +33,7 @@
import android.content.pm.Signature;
import android.net.Uri;
import android.os.Build;
+import android.support.v4.app.ActivityCompat;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
import android.util.Log;
@@ -506,17 +509,31 @@ public static boolean isDebuggable(Context ctx) {
}
/**
- * 获取设备唯一标识
+ * 获取设备唯一标识 本方法调用需要READ_PHONE_STATE权限
+ *
* @param context
* @return
*/
public static String getUUID(Context context) {
- final TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
+ String tmDevice = "", tmSerial = "", tmPhone = "", androidId = "";
+ if (ActivityCompat.checkSelfPermission(context, Manifest.permission.READ_PHONE_STATE)
+ == PackageManager.PERMISSION_GRANTED) {
+ try {
+ final TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
+
+ tmDevice = "" + tm.getDeviceId();
+ tmSerial = "" + tm.getSimSerialNumber();
+ androidId = "" + android.provider.Settings.Secure.getString(context.getContentResolver(), android.provider.Settings.Secure.ANDROID_ID);
+ } catch (Exception e) {
+ Log.e("AppUtils", "exception:" + e.getMessage());
+ }
+ } else {
+ Log.e("AppUtils", "没有 android.permission.READ_PHONE_STATE 权限");
+ tmDevice = "device";
+ tmSerial = "serial";
+ androidId = "androidid";
+ }
- final String tmDevice, tmSerial, tmPhone, androidId;
- tmDevice = "" + tm.getDeviceId();
- tmSerial = "" + tm.getSimSerialNumber();
- androidId = "" + android.provider.Settings.Secure.getString(context.getContentResolver(), android.provider.Settings.Secure.ANDROID_ID);
UUID deviceUuid = new UUID(androidId.hashCode(), ((long) tmDevice.hashCode() << 32) | tmSerial.hashCode());
String uniqueId = deviceUuid.toString();
@@ -527,6 +544,7 @@ public static String getUUID(Context context) {
/**
* 是否是主线程
+ *
* @return
*/
public static boolean isMainProcess(Context context) {