Permalink
Browse files

see 10/31 log

  • Loading branch information...
1 parent 7ec066f commit df1a07b5df489647a8c7a3a458b8657f77d9d72a @Blankj committed Oct 31, 2016
Showing with 2,350 additions and 87 deletions.
  1. +8 −0 .gitignore
  2. +1 −0 app/.gitignore
  3. +27 −0 app/build.gradle
  4. +21 −0 app/proguard-rules.pro
  5. +60 −0 app/src/main/AndroidManifest.xml
  6. +35 −0 app/src/main/java/com/blankj/androidutilcode/App.java
  7. +53 −0 app/src/main/java/com/blankj/androidutilcode/activities/ActivityActivity.java
  8. +81 −0 app/src/main/java/com/blankj/androidutilcode/activities/AppActivity.java
  9. +69 −0 app/src/main/java/com/blankj/androidutilcode/activities/CleanActivity.java
  10. +52 −0 app/src/main/java/com/blankj/androidutilcode/activities/DeviceActivity.java
  11. +66 −0 app/src/main/java/com/blankj/androidutilcode/activities/ImageActivity.java
  12. +78 −0 app/src/main/java/com/blankj/androidutilcode/activities/KeyboardActivity.java
  13. +77 −0 app/src/main/java/com/blankj/androidutilcode/activities/MainActivity.java
  14. +59 −0 app/src/main/java/com/blankj/androidutilcode/activities/NetworkActivity.java
  15. +55 −0 app/src/main/java/com/blankj/androidutilcode/activities/PhoneActivity.java
  16. +31 −0 app/src/main/java/com/blankj/androidutilcode/activities/ProcessActivity.java
  17. +33 −0 app/src/main/java/com/blankj/androidutilcode/activities/SDCardActivity.java
  18. +94 −0 app/src/main/java/com/blankj/androidutilcode/activities/SnackbarActivity.java
  19. +81 −0 app/src/main/java/com/blankj/androidutilcode/activities/ToastActivity.java
  20. BIN app/src/main/res/drawable/lena.png
  21. +31 −0 app/src/main/res/layout/activity_activity.xml
  22. +70 −0 app/src/main/res/layout/activity_app.xml
  23. +49 −0 app/src/main/res/layout/activity_clean.xml
  24. +41 −0 app/src/main/res/layout/activity_device.xml
  25. +89 −0 app/src/main/res/layout/activity_image.xml
  26. +52 −0 app/src/main/res/layout/activity_keyboard.xml
  27. +119 −0 app/src/main/res/layout/activity_main.xml
  28. +48 −0 app/src/main/res/layout/activity_network.xml
  29. +55 −0 app/src/main/res/layout/activity_phone.xml
  30. +22 −0 app/src/main/res/layout/activity_process.xml
  31. +22 −0 app/src/main/res/layout/activity_sdcard.xml
  32. +79 −0 app/src/main/res/layout/activity_snackbar.xml
  33. +69 −0 app/src/main/res/layout/activity_toast.xml
  34. +6 −0 app/src/main/res/layout/snackbar_add.xml
  35. BIN app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
  36. +8 −0 app/src/main/res/values/colors.xml
  37. +11 −0 app/src/main/res/values/dimens.xml
  38. +74 −0 app/src/main/res/values/string.xml
  39. +15 −0 app/src/main/res/values/styles.xml
  40. +25 −0 build.gradle
  41. +32 −0 config.gradle
  42. +18 −0 gradle.properties
  43. BIN gradle/wrapper/gradle-wrapper.jar
  44. +6 −0 gradle/wrapper/gradle-wrapper.properties
  45. +160 −0 gradlew
  46. +90 −0 gradlew.bat
  47. +1 −0 settings.gradle
  48. +5 −5 utilcode/build.gradle
  49. +1 −7 utilcode/src/main/AndroidManifest.xml
  50. +25 −7 utilcode/src/main/java/com/blankj/utilcode/utils/AppUtils.java
  51. +2 −27 utilcode/src/main/java/com/blankj/utilcode/utils/DeviceUtils.java
  52. +33 −0 utilcode/src/main/java/com/blankj/utilcode/utils/FileUtils.java
  53. +3 −21 utilcode/src/main/java/com/blankj/utilcode/utils/KeyboardUtils.java
  54. +24 −2 utilcode/src/main/java/com/blankj/utilcode/utils/NetworkUtils.java
  55. +17 −14 utilcode/src/main/java/com/blankj/utilcode/utils/ProcessUtils.java
  56. +2 −2 utilcode/src/main/java/com/blankj/utilcode/utils/ShellUtils.java
  57. +4 −1 utilcode/src/main/java/com/blankj/utilcode/utils/SnackBarUtils.java
  58. +0 −1 utilcode/src/main/java/com/blankj/utilcode/utils/ToastUtils.java
  59. +49 −0 utilcode/src/main/res/layout/design_layout_snackbar_include.xml
  60. +7 −0 utilcode/src/main/res/values/values.xml
  61. +5 −0 utilcode/src/test/java/com/blankj/utilcode/utils/FileUtilsTest.java
View
@@ -0,0 +1,8 @@
+*.iml
+.gradle
+/local.properties
+.idea
+.DS_Store
+/build
+/captures
+.externalNativeBuild
View
@@ -0,0 +1 @@
+/build
View
@@ -0,0 +1,27 @@
+apply plugin: 'com.android.application'
+
+android {
+ compileSdkVersion rootProject.ext.android.compileSdkVersion
+ buildToolsVersion rootProject.ext.android.buildToolsVersion
+
+ defaultConfig {
+ applicationId "com.blankj.androidutilcode"
+ minSdkVersion rootProject.ext.android.minSdkVersion
+ targetSdkVersion rootProject.ext.android.targetSdkVersion
+ versionCode rootProject.ext.android.versionCode
+ versionName rootProject.ext.android.versionName
+ }
+ buildTypes {
+ release {
+ minifyEnabled true
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ }
+ }
+}
+
+dependencies {
+ compile fileTree(include: ['*.jar'], dir: 'libs')
+ compile project(':utilcode')
+ compile rootProject.ext.deps.design
+ compile rootProject.ext.deps.supportV4
+}
@@ -0,0 +1,21 @@
+# Add project specific ProGuard rules here.
+# By default, the flags in this file are appended to flags specified
+# in G:\Android_IDE\ADT\sdk/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 *;
+#}
+
+-keep class com.blankj.utilcode.** { *; }
+-keep classmembers class com.blankj.utilcode.** { *; }
+-dontwarn com.blankj.utilcode.**
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.blankj.androidutilcode">
+悲剧
+ <!--读写内存-->
+ <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
+ <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
+
+ <!--network-->
+ <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
+ <uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/>
+ <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
+ <uses-permission android:name="android.permission.MODIFY_PHONE_STATE"/>
+ <uses-permission android:name="android.permission.INTERNET"/>
+
+ <!--phone-->
+ <uses-permission android:name="android.permission.READ_PHONE_STATE"/>
+ <uses-permission android:name="android.permission.CALL_PHONE"/>
+ <uses-permission android:name="android.permission.SEND_SMS"/>
+ <!--拨打电话-->
+ <uses-permission android:name="android.permission.CALL_PHONE"/>
+ <!--发送短信-->
+ <uses-permission android:name="android.permission.SEND_SMS"/>
+ <!--获取手机联系人-->
+ <!--<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>-->
+ <uses-permission android:name="android.permission.READ_CONTACTS"/>
+ <!--获取短信-->
+ <!--<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>-->
+ <uses-permission android:name="android.permission.READ_SMS"/>
+
+ <application
+ android:name=".App"
+ android:allowBackup="true"
+ android:icon="@mipmap/ic_launcher"
+ android:label="@string/my_app_name"
+ android:supportsRtl="true"
+ android:theme="@style/AppTheme">
+ <activity android:name=".activities.ActivityActivity"/>
+ <activity android:name=".activities.AppActivity"/>
+ <activity android:name=".activities.CleanActivity"/>
+ <activity android:name=".activities.DeviceActivity"/>
+ <activity android:name=".activities.ImageActivity"/>
+ <activity
+ android:name=".activities.KeyboardActivity"
+ android:windowSoftInputMode="stateHidden|adjustPan"/>
+ <activity android:name=".activities.MainActivity">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN"/>
+ <category android:name="android.intent.category.LAUNCHER"/>
+ </intent-filter>
+ </activity>
+ <activity android:name=".activities.NetworkActivity"/>
+ <activity android:name=".activities.PhoneActivity"/>
+ <activity android:name=".activities.ProcessActivity"/>
+ <activity android:name=".activities.SDCardActivity"/>
+ <activity android:name=".activities.SnackbarActivity"/>
+ <activity android:name=".activities.ToastActivity"/>
+ </application>
+
+</manifest>
@@ -0,0 +1,35 @@
+package com.blankj.androidutilcode;
+
+import android.app.Application;
+import android.os.Handler;
+import android.os.Message;
+
+import com.blankj.utilcode.utils.CrashUtils;
+import com.blankj.utilcode.utils.LogUtils;
+
+import java.lang.ref.WeakReference;
+
+/**
+ * <pre>
+ * author: Blankj
+ * blog : http://blankj.com
+ * time : 2016/10/12
+ * desc :
+ * </pre>
+ */
+public class App extends Application {
+
+ private static App ourInstance;
+
+ public static App getInstance() {
+ return ourInstance;
+ }
+
+ @Override
+ public void onCreate() {
+ super.onCreate();
+ ourInstance = this;
+ CrashUtils.getInstance().init(this);
+ LogUtils.getBuilder(this).setTag("MyTag").setLog2FileSwitch(true).create();
+ }
+}
@@ -0,0 +1,53 @@
+package com.blankj.androidutilcode.activities;
+
+import android.app.Activity;
+import android.os.Bundle;
+import android.view.View;
+import android.widget.TextView;
+
+import com.blankj.androidutilcode.R;
+import com.blankj.utilcode.utils.ActivityUtils;
+import com.blankj.utilcode.utils.DeviceUtils;
+import com.blankj.utilcode.utils.IntentUtils;
+import com.blankj.utilcode.utils.ShellUtils;
+
+/**
+ * <pre>
+ * author: Blankj
+ * blog : http://blankj.com
+ * time : 2016/10/13
+ * desc : Activity工具类测试
+ * </pre>
+ */
+
+public class ActivityActivity extends Activity
+ implements View.OnClickListener {
+
+ private String packageName;
+ private String className;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_activity);
+
+ packageName = this.getPackageName();
+ className = packageName + ".activities.ImageActivity";
+
+ TextView tvAboutActivity = (TextView) findViewById(R.id.tv_about_activity);
+
+ findViewById(R.id.btn_launch_image_activity).setOnClickListener(this);
+
+ boolean isExists = ActivityUtils.isActivityExists(this, packageName, className);
+ tvAboutActivity.setText(String.format("Is ImageActivity Exists: %b", isExists));
+ }
+
+ @Override
+ public void onClick(View view) {
+ switch (view.getId()) {
+ case R.id.btn_launch_image_activity:
+ ActivityUtils.launchActivity(this, packageName, className);
+ break;
+ }
+ }
+}
@@ -0,0 +1,81 @@
+package com.blankj.androidutilcode.activities;
+
+import android.app.Activity;
+import android.os.Bundle;
+import android.view.View;
+import android.widget.TextView;
+
+import com.blankj.androidutilcode.App;
+import com.blankj.androidutilcode.R;
+import com.blankj.utilcode.utils.AppUtils;
+
+/**
+ * <pre>
+ * author: Blankj
+ * blog : http://blankj.com
+ * time : 2016/10/13
+ * desc : App工具类测试
+ * </pre>
+ */
+
+public class AppActivity extends Activity
+ implements View.OnClickListener {
+
+ private String appPath;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_app);
+
+ appPath = AppUtils.getAppPath(this);
+
+ TextView tvAboutApp = (TextView) findViewById(R.id.tv_about_app);
+
+ findViewById(R.id.btn_install_app).setOnClickListener(this);
+ findViewById(R.id.btn_install_app_silent).setOnClickListener(this);
+ findViewById(R.id.btn_uninstall_app).setOnClickListener(this);
+ findViewById(R.id.btn_uninstall_app_silent).setOnClickListener(this);
+ findViewById(R.id.btn_launch_app).setOnClickListener(this);
+ findViewById(R.id.btn_get_app_details_settings).setOnClickListener(this);
+
+ tvAboutApp.setText(AppUtils.getAppInfo(this).toString() +
+ "\nisInstallWeiXin: " + AppUtils.isInstallApp(this, "com.tencent.mm") +
+ "\nisAppRoot: " + AppUtils.isAppRoot() +
+ "\nisAppDebug: " + AppUtils.isAppDebug(this) +
+ "\nisWeiXinAppDebug: " + AppUtils.isAppDebug(this, "com.tencent.mm") +
+ "\nAppSignatureSHA1: " + AppUtils.getAppSignatureSHA1(this) +
+ "\nisAppForeground: " + AppUtils.isAppForeground(this) +
+ "\nisWeiXinForeground: " + AppUtils.isAppForeground(this, "com.tencent.mm")
+ );
+ }
+
+ @Override
+ public void onClick(View view) {
+ switch (view.getId()) {
+ case R.id.btn_install_app:
+ AppUtils.installApp(this, appPath);
+ break;
+ case R.id.btn_install_app_silent:
+ new Thread(new Runnable() {
+ @Override
+ public void run() {
+ AppUtils.installAppSilent(App.getInstance(), appPath);
+ }
+ }).start();
+ break;
+ case R.id.btn_uninstall_app:
+ AppUtils.uninstallApp(this, this.getPackageName());
+ break;
+ case R.id.btn_uninstall_app_silent:
+ AppUtils.uninstallAppSilent(this, this.getPackageName(), false);
+ break;
+ case R.id.btn_launch_app:
+ AppUtils.launchApp(this, this.getPackageName());
+ break;
+ case R.id.btn_get_app_details_settings:
+ AppUtils.getAppDetailsSettings(this);
+ break;
+ }
+ }
+}
@@ -0,0 +1,69 @@
+package com.blankj.androidutilcode.activities;
+
+import android.os.Bundle;
+import android.app.Activity;
+import android.util.Log;
+import android.view.View;
+import android.widget.Button;
+
+import com.blankj.androidutilcode.R;
+import com.blankj.utilcode.utils.CleanUtils;
+
+import java.io.File;
+
+/**
+ * <pre>
+ * author: Blankj
+ * blog : http://blankj.com
+ * time : 2016/9/29
+ * desc : Clean工具类测试
+ * </pre>
+ */
+public class CleanActivity extends Activity
+ implements View.OnClickListener {
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_clean);
+
+ Button btnCleanInternalCache = (Button) findViewById(R.id.btn_clean_internal_cache);
+ Button btnCleanInternalFiles = (Button) findViewById(R.id.btn_clean_internal_files);
+ Button btnCleanInternalDbs = (Button) findViewById(R.id.btn_clean_internal_databases);
+ Button btnCleanInternalSP = (Button) findViewById(R.id.btn_clean_internal_sp);
+ Button btnCleanExternalCache = (Button) findViewById(R.id.btn_clean_external_cache);
+
+ btnCleanInternalCache.setOnClickListener(this);
+ btnCleanInternalFiles.setOnClickListener(this);
+ btnCleanInternalDbs.setOnClickListener(this);
+ btnCleanInternalSP.setOnClickListener(this);
+ btnCleanExternalCache.setOnClickListener(this);
+
+ btnCleanInternalCache.setText(getCacheDir().getPath());
+ btnCleanInternalFiles.setText(getFilesDir().getPath());
+ btnCleanInternalDbs.setText(getFilesDir().getParent() + File.separator + "databases");
+ btnCleanInternalSP.setText(getFilesDir().getParent() + File.separator + "shared_prefs");
+ btnCleanExternalCache.setText(getExternalCacheDir().getPath());
+ }
+
+ @Override
+ public void onClick(View view) {
+ switch (view.getId()) {
+ case R.id.btn_clean_internal_cache:
+ Log.d("cleanInternalCache", "" + CleanUtils.cleanInternalCache(this));
+ break;
+ case R.id.btn_clean_internal_files:
+ Log.d("cleanInternalFiles", "" + CleanUtils.cleanInternalFiles(this));
+ break;
+ case R.id.btn_clean_internal_databases:
+ Log.d("cleanInternalDbs", "" + CleanUtils.cleanInternalDbs(this));
+ break;
+ case R.id.btn_clean_internal_sp:
+ Log.d("cleanInternalSP", "" + CleanUtils.cleanInternalSP(this));
+ break;
+ case R.id.btn_clean_external_cache:
+ Log.d("cleanExternalCache", "" + CleanUtils.cleanExternalCache(this));
+ break;
+ }
+ }
+}
Oops, something went wrong.

0 comments on commit df1a07b

Please sign in to comment.