未验证 提交 a75f666c 编写于 作者: 布兰柯基 提交者: GitHub

Merge pull request #822 from Blankj/1.23.3

1.23.3
* `19/01/29` [fix] LogUtils format json when json not start with '{'. Publish v1.23.3.
* `19/01/28` [fix] KeyboardUtils#fixSoftInputLeaks don't work on the device of HuaWei.
* `19/01/26` [fix] NetworkUtils#getNetworkType.
* `19/01/25` [add] CloneUtils, PermissionUtils support request permission of WRITE_SETTINGS and DRAW_OVERLAYS. Publish v1.23.2. * `19/01/25` [add] CloneUtils, PermissionUtils support request permission of WRITE_SETTINGS and DRAW_OVERLAYS. Publish v1.23.2.
* `19/01/24` [add] BrightnessUtils and FlashlightUtils. * `19/01/24` [add] BrightnessUtils and FlashlightUtils.
* `19/01/23` [add] Modify the demo of utilcode use kotlin. Publish v1.23.1. * `19/01/23` [add] Modify the demo of utilcode use kotlin. Publish v1.23.1.
......
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
[logo]: https://raw.githubusercontent.com/Blankj/AndroidUtilCode/master/art/logo.png [logo]: https://raw.githubusercontent.com/Blankj/AndroidUtilCode/master/art/logo.png
[aucSvg]: https://img.shields.io/badge/AndroidUtilCode-v1.23.2-brightgreen.svg [aucSvg]: https://img.shields.io/badge/AndroidUtilCode-v1.23.3-brightgreen.svg
[auc]: https://github.com/Blankj/AndroidUtilCode [auc]: https://github.com/Blankj/AndroidUtilCode
[apiSvg]: https://img.shields.io/badge/API-14+-brightgreen.svg [apiSvg]: https://img.shields.io/badge/API-14+-brightgreen.svg
......
...@@ -41,7 +41,7 @@ If this project helps you a lot and you want to support the project's developmen ...@@ -41,7 +41,7 @@ If this project helps you a lot and you want to support the project's developmen
[logo]: https://raw.githubusercontent.com/Blankj/AndroidUtilCode/master/art/logo.png [logo]: https://raw.githubusercontent.com/Blankj/AndroidUtilCode/master/art/logo.png
[aucSvg]: https://img.shields.io/badge/AndroidUtilCode-v1.23.2-brightgreen.svg [aucSvg]: https://img.shields.io/badge/AndroidUtilCode-v1.23.3-brightgreen.svg
[auc]: https://github.com/Blankj/AndroidUtilCode [auc]: https://github.com/Blankj/AndroidUtilCode
[apiSvg]: https://img.shields.io/badge/API-14+-brightgreen.svg [apiSvg]: https://img.shields.io/badge/API-14+-brightgreen.svg
......
...@@ -5,8 +5,8 @@ ext { ...@@ -5,8 +5,8 @@ ext {
compileSdkVersion = 27 compileSdkVersion = 27
minSdkVersion = 14 minSdkVersion = 14
targetSdkVersion = 27 targetSdkVersion = 27
versionCode = 1_023_002 versionCode = 1_023_003
versionName = '1.23.2'// E.g. 1.9.72 => 1,009,072 versionName = '1.23.3'// E.g. 1.9.72 => 1,009,072
bus = [ bus = [
isDebug: false, isDebug: false,
...@@ -17,7 +17,7 @@ ext { ...@@ -17,7 +17,7 @@ ext {
// lib version // lib version
kotlin_version = '1.3.0' kotlin_version = '1.3.0'
support_version = '27.1.1' support_version = '27.1.1'
leakcanary_version = '1.5.4' leakcanary_version = '1.6.3'
dep = [ dep = [
plugin : [ plugin : [
...@@ -38,8 +38,9 @@ ext { ...@@ -38,8 +38,9 @@ ext {
constraint : "com.android.support.constraint:constraint-layout:1.1.3", constraint : "com.android.support.constraint:constraint-layout:1.1.3",
kotlin : "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version", kotlin : "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version",
leakcanary : [ leakcanary : [
android : "com.squareup.leakcanary:leakcanary-android:$leakcanary_version", android : "com.squareup.leakcanary:leakcanary-android:$leakcanary_version",
android_no_op: "com.squareup.leakcanary:leakcanary-android-no-op:$leakcanary_version", android_no_op : "com.squareup.leakcanary:leakcanary-android-no-op:$leakcanary_version",
support_fragment: "com.squareup.leakcanary:leakcanary-support-fragment:$leakcanary_version"
], ],
free_proguard: "com.blankj:free-proguard:0.0.7", free_proguard: "com.blankj:free-proguard:0.0.7",
adapt_screen : "com.blankj:adapt-screen:0.0.3", adapt_screen : "com.blankj:adapt-screen:0.0.3",
......
...@@ -40,6 +40,7 @@ android { ...@@ -40,6 +40,7 @@ android {
dependencies { dependencies {
// LeakCanary // LeakCanary
debugImplementation dep.leakcanary.android debugImplementation dep.leakcanary.android
debugImplementation dep.leakcanary.support_fragment
releaseImplementation dep.leakcanary.android_no_op releaseImplementation dep.leakcanary.android_no_op
} }
......
...@@ -15,5 +15,5 @@ dependencies { ...@@ -15,5 +15,5 @@ dependencies {
api dep.free_proguard api dep.free_proguard
api 'com.r0adkll:slidableactivity:2.0.5' api 'com.r0adkll:slidableactivity:2.0.5'
compileOnly dep.leakcanary.android_no_op compileOnly dep.leakcanary.android_no_op
// api 'com.blankj:utilcode:1.23.2' // api 'com.blankj:utilcode:1.23.3'
} }
\ No newline at end of file
...@@ -51,7 +51,7 @@ class LocationActivity : BaseBackActivity() { ...@@ -51,7 +51,7 @@ class LocationActivity : BaseBackActivity() {
override fun getLocation(lastLatitude: String, lastLongitude: String, latitude: String, override fun getLocation(lastLatitude: String, lastLongitude: String, latitude: String,
longitude: String, country: String, locality: String, street: String) { longitude: String, country: String, locality: String, street: String) {
runOnUiThread { runOnUiThread {
locationAboutTv.text = SpanUtils() SpanUtils.with(locationAboutTv)
.appendLine("lastLatitude: $lastLatitude") .appendLine("lastLatitude: $lastLatitude")
.appendLine("lastLongitude: $lastLongitude") .appendLine("lastLongitude: $lastLongitude")
.appendLine("latitude: $latitude") .appendLine("latitude: $latitude")
...@@ -77,7 +77,7 @@ class LocationActivity : BaseBackActivity() { ...@@ -77,7 +77,7 @@ class LocationActivity : BaseBackActivity() {
override fun initView(savedInstanceState: Bundle?, contentView: View) { override fun initView(savedInstanceState: Bundle?, contentView: View) {
setTitle(R.string.demo_location) setTitle(R.string.demo_location)
locationAboutTv.text = SpanUtils() SpanUtils.with(locationAboutTv)
.appendLine("lastLatitude: unknown") .appendLine("lastLatitude: unknown")
.appendLine("lastLongitude: unknown") .appendLine("lastLongitude: unknown")
.appendLine("latitude: unknown") .appendLine("latitude: unknown")
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
Gradle: Gradle:
```groovy ```groovy
implementation 'com.blankj:utilcode:1.23.2' implementation 'com.blankj:utilcode:1.23.3'
``` ```
......
...@@ -27,7 +27,7 @@ apply plugin: "com.blankj.bus" ...@@ -27,7 +27,7 @@ apply plugin: "com.blankj.bus"
给 base 模块添加 [AndroidUtilCode](https://github.com/Blankj/AndroidUtilCode) 依赖: 给 base 模块添加 [AndroidUtilCode](https://github.com/Blankj/AndroidUtilCode) 依赖:
```groovy ```groovy
api "com.blankj:utilcode:1.23.2" api "com.blankj:utilcode:1.23.3"
``` ```
比如 module0 中存在的 `Module0Activity.java`,我们通常都是在它内部写一个 `start` 函数来启动它,现在我们给它添加 `@BusUtils.Subscribe` 注解,并给注解的 `name` 赋唯一值,要注意,函数务必要 `public static` 哦: 比如 module0 中存在的 `Module0Activity.java`,我们通常都是在它内部写一个 `start` 函数来启动它,现在我们给它添加 `@BusUtils.Subscribe` 注解,并给注解的 `name` 赋唯一值,要注意,函数务必要 `public static` 哦:
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
Gradle: Gradle:
```groovy ```groovy
implementation 'com.blankj:utilcode:1.23.2' implementation 'com.blankj:utilcode:1.23.3'
``` ```
......
...@@ -736,7 +736,7 @@ public final class AppUtils { ...@@ -736,7 +736,7 @@ public final class AppUtils {
* </ul> * </ul>
* *
* @param packageName The name of the package. * @param packageName The name of the package.
* @return 当前应用的 AppInfo * @return the application's information
*/ */
public static AppInfo getAppInfo(final String packageName) { public static AppInfo getAppInfo(final String packageName) {
try { try {
......
...@@ -127,7 +127,6 @@ public final class BarUtils { ...@@ -127,7 +127,6 @@ public final class BarUtils {
if (decorView != null) { if (decorView != null) {
int vis = decorView.getSystemUiVisibility(); int vis = decorView.getSystemUiVisibility();
if (isLightMode) { if (isLightMode) {
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
vis |= View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR; vis |= View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
} else { } else {
vis &= ~View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR; vis &= ~View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
...@@ -137,6 +136,33 @@ public final class BarUtils { ...@@ -137,6 +136,33 @@ public final class BarUtils {
} }
} }
/**
* Is the status bar light mode.
*
* @param activity The activity.
* @return {@code true}: yes<br>{@code false}: no
*/
public static boolean isStatusBarLightMode(@NonNull final Activity activity) {
return isStatusBarLightMode(activity.getWindow());
}
/**
* Is the status bar light mode.
*
* @param window The window.
* @return {@code true}: yes<br>{@code false}: no
*/
public static boolean isStatusBarLightMode(@NonNull final Window window) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
View decorView = window.getDecorView();
if (decorView != null) {
int vis = decorView.getSystemUiVisibility();
return (vis & View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR) != 0;
}
}
return false;
}
/** /**
* Add the top margin size equals status bar's height for view. * Add the top margin size equals status bar's height for view.
* *
...@@ -437,9 +463,10 @@ public final class BarUtils { ...@@ -437,9 +463,10 @@ public final class BarUtils {
* @param activity The activity. * @param activity The activity.
* @param isVisible True to set navigation bar visible, false otherwise. * @param isVisible True to set navigation bar visible, false otherwise.
*/ */
@RequiresApi(api = Build.VERSION_CODES.KITKAT)
public static void setNavBarVisibility(@NonNull final Activity activity, boolean isVisible) { public static void setNavBarVisibility(@NonNull final Activity activity, boolean isVisible) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) return;
setNavBarVisibility(activity.getWindow(), isVisible); setNavBarVisibility(activity.getWindow(), isVisible);
} }
/** /**
...@@ -448,8 +475,8 @@ public final class BarUtils { ...@@ -448,8 +475,8 @@ public final class BarUtils {
* @param window The window. * @param window The window.
* @param isVisible True to set navigation bar visible, false otherwise. * @param isVisible True to set navigation bar visible, false otherwise.
*/ */
@RequiresApi(Build.VERSION_CODES.KITKAT)
public static void setNavBarVisibility(@NonNull final Window window, boolean isVisible) { public static void setNavBarVisibility(@NonNull final Window window, boolean isVisible) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) return;
final ViewGroup decorView = (ViewGroup) window.getDecorView(); final ViewGroup decorView = (ViewGroup) window.getDecorView();
for (int i = 0, count = decorView.getChildCount(); i < count; i++) { for (int i = 0, count = decorView.getChildCount(); i < count; i++) {
final View child = decorView.getChildAt(i); final View child = decorView.getChildAt(i);
......
package com.blankj.utilcode.util; package com.blankj.utilcode.util;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.content.res.Resources;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.BitmapFactory; import android.graphics.BitmapFactory;
import android.graphics.Canvas; import android.graphics.Canvas;
...@@ -578,7 +579,7 @@ public final class ConvertUtils { ...@@ -578,7 +579,7 @@ public final class ConvertUtils {
* @return value of px * @return value of px
*/ */
public static int dp2px(final float dpValue) { public static int dp2px(final float dpValue) {
final float scale = Utils.getApp().getResources().getDisplayMetrics().density; final float scale = Resources.getSystem().getDisplayMetrics().density;
return (int) (dpValue * scale + 0.5f); return (int) (dpValue * scale + 0.5f);
} }
...@@ -589,7 +590,7 @@ public final class ConvertUtils { ...@@ -589,7 +590,7 @@ public final class ConvertUtils {
* @return value of dp * @return value of dp
*/ */
public static int px2dp(final float pxValue) { public static int px2dp(final float pxValue) {
final float scale = Utils.getApp().getResources().getDisplayMetrics().density; final float scale = Resources.getSystem().getDisplayMetrics().density;
return (int) (pxValue / scale + 0.5f); return (int) (pxValue / scale + 0.5f);
} }
...@@ -600,7 +601,7 @@ public final class ConvertUtils { ...@@ -600,7 +601,7 @@ public final class ConvertUtils {
* @return value of px * @return value of px
*/ */
public static int sp2px(final float spValue) { public static int sp2px(final float spValue) {
final float fontScale = Utils.getApp().getResources().getDisplayMetrics().scaledDensity; final float fontScale = Resources.getSystem().getDisplayMetrics().scaledDensity;
return (int) (spValue * fontScale + 0.5f); return (int) (spValue * fontScale + 0.5f);
} }
...@@ -611,7 +612,7 @@ public final class ConvertUtils { ...@@ -611,7 +612,7 @@ public final class ConvertUtils {
* @return value of sp * @return value of sp
*/ */
public static int px2sp(final float pxValue) { public static int px2sp(final float pxValue) {
final float fontScale = Utils.getApp().getResources().getDisplayMetrics().scaledDensity; final float fontScale = Resources.getSystem().getDisplayMetrics().scaledDensity;
return (int) (pxValue / fontScale + 0.5f); return (int) (pxValue / fontScale + 0.5f);
} }
......
...@@ -211,10 +211,15 @@ public final class JsonUtils { ...@@ -211,10 +211,15 @@ public final class JsonUtils {
public static String formatJson(final String json, final int indentSpaces) { public static String formatJson(final String json, final int indentSpaces) {
try { try {
if (json.startsWith("{")) { for (int i = 0, len = json.length(); i < len; i++) {
return new JSONObject(json).toString(indentSpaces); char c = json.charAt(i);
} else if (json.startsWith("[")) { if (c == '{') {
return new JSONArray(json).toString(indentSpaces); return new JSONObject(json).toString(indentSpaces);
} else if (c == '[') {
return new JSONArray(json).toString(indentSpaces);
} else if (!Character.isWhitespace(c)) {
return json;
}
} }
} catch (JSONException e) { } catch (JSONException e) {
e.printStackTrace(); e.printStackTrace();
......
...@@ -259,17 +259,17 @@ public final class KeyboardUtils { ...@@ -259,17 +259,17 @@ public final class KeyboardUtils {
* Fix the leaks of soft input. * Fix the leaks of soft input.
* <p>Call the function in {@link Activity#onDestroy()}.</p> * <p>Call the function in {@link Activity#onDestroy()}.</p>
* *
* @param context The context. * @param activity The activity.
*/ */
public static void fixSoftInputLeaks(final Context context) { public static void fixSoftInputLeaks(final Activity activity) {
if (context == null) return; if (activity == null) return;
InputMethodManager imm = InputMethodManager imm =
(InputMethodManager) Utils.getApp().getSystemService(Context.INPUT_METHOD_SERVICE); (InputMethodManager) Utils.getApp().getSystemService(Context.INPUT_METHOD_SERVICE);
String[] strArr = new String[]{"mCurRootView", "mServedView", "mNextServedView", "mLastSrvView"}; if (imm == null) return;
for (int i = 0; i < 4; i++) { String[] leakViews = new String[]{"mLastSrvView", "mCurRootView", "mServedView", "mNextServedView"};
for (String leakView : leakViews) {
try { try {
//noinspection ConstantConditions Field declaredField = InputMethodManager.class.getDeclaredField(leakView);
Field declaredField = imm.getClass().getDeclaredField(strArr[i]);
if (declaredField == null) continue; if (declaredField == null) continue;
if (!declaredField.isAccessible()) { if (!declaredField.isAccessible()) {
declaredField.setAccessible(true); declaredField.setAccessible(true);
...@@ -277,10 +277,8 @@ public final class KeyboardUtils { ...@@ -277,10 +277,8 @@ public final class KeyboardUtils {
Object obj = declaredField.get(imm); Object obj = declaredField.get(imm);
if (!(obj instanceof View)) continue; if (!(obj instanceof View)) continue;
View view = (View) obj; View view = (View) obj;
if (view.getContext() == context) { if (view.getRootView() == activity.getWindow().getDecorView().getRootView()) {
declaredField.set(imm, null); declaredField.set(imm, null);
} else {
return;
} }
} catch (Throwable th) { } catch (Throwable th) {
th.printStackTrace(); th.printStackTrace();
......
...@@ -626,7 +626,7 @@ public final class LogUtils { ...@@ -626,7 +626,7 @@ public final class LogUtils {
private String mFilePrefix = "util";// The file prefix of log. private String mFilePrefix = "util";// The file prefix of log.
private boolean mLogSwitch = true; // The switch of log. private boolean mLogSwitch = true; // The switch of log.
private boolean mLog2ConsoleSwitch = true; // The logcat's switch of log. private boolean mLog2ConsoleSwitch = true; // The logcat's switch of log.
private String mGlobalTag = null; // The global tag of log. private String mGlobalTag = ""; // The global tag of log.
private boolean mTagIsSpace = true; // The global tag is space. private boolean mTagIsSpace = true; // The global tag is space.
private boolean mLogHeadSwitch = true; // The head's switch of log. private boolean mLogHeadSwitch = true; // The head's switch of log.
private boolean mLog2FileSwitch = false; // The file's switch of log. private boolean mLog2FileSwitch = false; // The file's switch of log.
...@@ -744,22 +744,83 @@ public final class LogUtils { ...@@ -744,22 +744,83 @@ public final class LogUtils {
return this; return this;
} }
public String getDefaultDir() {
return mDefaultDir;
}
public String getDir() {
return mDir == null ? mDefaultDir : mDir;
}
public String getFilePrefix() {
return mFilePrefix;
}
public boolean isLogSwitch() {
return mLogSwitch;
}
public boolean isLog2ConsoleSwitch() {
return mLog2ConsoleSwitch;
}
public String getGlobalTag() {
if (isSpace(mGlobalTag)) return "null";
return mGlobalTag;
}
public boolean isLogHeadSwitch() {
return mLogHeadSwitch;
}
public boolean isLog2FileSwitch() {
return mLog2FileSwitch;
}
public boolean isLogBorderSwitch() {
return mLogBorderSwitch;
}
public boolean isSingleTagSwitch() {
return mSingleTagSwitch;
}
public char getConsoleFilter() {
return T[mConsoleFilter - V];
}
public char getFileFilter() {
return T[mFileFilter - V];
}
public int getStackDeep() {
return mStackDeep;
}
public int getStackOffset() {
return mStackOffset;
}
public int getSaveDays() {
return mSaveDays;
}
@Override @Override
public String toString() { public String toString() {
return "switch: " + mLogSwitch return "switch: " + isLogSwitch()
+ LINE_SEP + "console: " + mLog2ConsoleSwitch + LINE_SEP + "console: " + isLog2ConsoleSwitch()
+ LINE_SEP + "tag: " + (mTagIsSpace ? "null" : mGlobalTag) + LINE_SEP + "tag: " + getGlobalTag()
+ LINE_SEP + "head: " + mLogHeadSwitch + LINE_SEP + "head: " + isLogHeadSwitch()
+ LINE_SEP + "file: " + mLog2FileSwitch + LINE_SEP + "file: " + isLog2FileSwitch()
+ LINE_SEP + "dir: " + (mDir == null ? mDefaultDir : mDir) + LINE_SEP + "dir: " + getDir()
+ LINE_SEP + "filePrefix: " + mFilePrefix + LINE_SEP + "filePrefix: " + getFilePrefix()
+ LINE_SEP + "border: " + mLogBorderSwitch + LINE_SEP + "border: " + isLogBorderSwitch()
+ LINE_SEP + "singleTag: " + mSingleTagSwitch + LINE_SEP + "singleTag: " + isSingleTagSwitch()
+ LINE_SEP + "consoleFilter: " + T[mConsoleFilter - V] + LINE_SEP + "consoleFilter: " + getConsoleFilter()
+ LINE_SEP + "fileFilter: " + T[mFileFilter - V] + LINE_SEP + "fileFilter: " + getFileFilter()
+ LINE_SEP + "stackDeep: " + mStackDeep + LINE_SEP + "stackDeep: " + getStackDeep()
+ LINE_SEP + "stackOffset: " + mStackOffset + LINE_SEP + "stackOffset: " + getStackOffset()
+ LINE_SEP + "saveDays: " + mSaveDays + LINE_SEP + "saveDays: " + getSaveDays()
+ LINE_SEP + "formatter: " + I_FORMATTER_MAP; + LINE_SEP + "formatter: " + I_FORMATTER_MAP;
} }
} }
...@@ -969,10 +1030,15 @@ public final class LogUtils { ...@@ -969,10 +1030,15 @@ public final class LogUtils {
private static String formatJson(String json) { private static String formatJson(String json) {
try { try {
if (json.startsWith("{")) { for (int i = 0, len = json.length(); i < len; i++) {
json = new JSONObject(json).toString(2); char c = json.charAt(i);
} else if (json.startsWith("[")) { if (c == '{') {
json = new JSONArray(json).toString(2); return new JSONObject(json).toString(2);
} else if (c == '[') {
return new JSONArray(json).toString(2);
} else if (!Character.isWhitespace(c)) {
return json;
}
} }
} catch (JSONException e) { } catch (JSONException e) {
e.printStackTrace(); e.printStackTrace();
......
...@@ -134,13 +134,13 @@ public final class NetworkUtils { ...@@ -134,13 +134,13 @@ public final class NetworkUtils {
return tm.isDataEnabled(); return tm.isDataEnabled();
} }
@SuppressLint("PrivateApi") @SuppressLint("PrivateApi")
Method getMobileDataEnabledMethod = tm.getClass().getDeclaredMethod("getDataEnabled"); Method getMobileDataEnabledMethod =
tm.getClass().getDeclaredMethod("getDataEnabled");
if (null != getMobileDataEnabledMethod) { if (null != getMobileDataEnabledMethod) {
return (boolean) getMobileDataEnabledMethod.invoke(tm); return (boolean) getMobileDataEnabledMethod.invoke(tm);
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); Log.e("NetworkUtils", "getMobileDataEnabled: ", e);
} }
return false; return false;
} }
...@@ -151,21 +151,28 @@ public final class NetworkUtils { ...@@ -151,21 +151,28 @@ public final class NetworkUtils {
* {@code <uses-permission android:name="android.permission.MODIFY_PHONE_STATE" />}</p> * {@code <uses-permission android:name="android.permission.MODIFY_PHONE_STATE" />}</p>
* *
* @param enabled True to enabled, false otherwise. * @param enabled True to enabled, false otherwise.
* @return {@code true}: success<br>{@code false}: fail
*/ */
@RequiresPermission(MODIFY_PHONE_STATE) @RequiresPermission(MODIFY_PHONE_STATE)
public static void setMobileDataEnabled(final boolean enabled) { public static boolean setMobileDataEnabled(final boolean enabled) {
try { try {
TelephonyManager tm = TelephonyManager tm =
(TelephonyManager) Utils.getApp().getSystemService(Context.TELEPHONY_SERVICE); (TelephonyManager) Utils.getApp().getSystemService(Context.TELEPHONY_SERVICE);
if (tm == null) return; if (tm == null) return false;
Method setMobileDataEnabledMethod = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
tm.setDataEnabled(enabled);
return false;
}
Method setDataEnabledMethod =
tm.getClass().getDeclaredMethod("setDataEnabled", boolean.class); tm.getClass().getDeclaredMethod("setDataEnabled", boolean.class);
if (null != setMobileDataEnabledMethod) { if (null != setDataEnabledMethod) {
setMobileDataEnabledMethod.invoke(tm, enabled); setDataEnabledMethod.invoke(tm, enabled);
return true;
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); Log.e("NetworkUtils", "setMobileDataEnabled: ", e);
} }
return false;
} }
/** /**
...@@ -281,24 +288,22 @@ public final class NetworkUtils { ...@@ -281,24 +288,22 @@ public final class NetworkUtils {
*/ */
@RequiresPermission(ACCESS_NETWORK_STATE) @RequiresPermission(ACCESS_NETWORK_STATE)
public static NetworkType getNetworkType() { public static NetworkType getNetworkType() {
NetworkType netType = NetworkType.NETWORK_NO; if (isEthernet()) {
return NetworkType.NETWORK_ETHERNET;
}
NetworkInfo info = getActiveNetworkInfo(); NetworkInfo info = getActiveNetworkInfo();
if (info != null && info.isAvailable()) { if (info != null && info.isAvailable()) {
if (isEthernet()) { if (info.getType() == ConnectivityManager.TYPE_WIFI) {
netType = NetworkType.NETWORK_ETHERNET; return NetworkType.NETWORK_WIFI;
} else if (info.getType() == ConnectivityManager.TYPE_WIFI) {
netType = NetworkType.NETWORK_WIFI;
} else if (info.getType() == ConnectivityManager.TYPE_MOBILE) { } else if (info.getType() == ConnectivityManager.TYPE_MOBILE) {
switch (info.getSubtype()) { switch (info.getSubtype()) {
case TelephonyManager.NETWORK_TYPE_GSM: case TelephonyManager.NETWORK_TYPE_GSM:
case TelephonyManager.NETWORK_TYPE_GPRS: case TelephonyManager.NETWORK_TYPE_GPRS:
case TelephonyManager.NETWORK_TYPE_CDMA: case TelephonyManager.NETWORK_TYPE_CDMA:
case TelephonyManager.NETWORK_TYPE_EDGE: case TelephonyManager.NETWORK_TYPE_EDGE:
case TelephonyManager.NETWORK_TYPE_1xRTT: case TelephonyManager.NETWORK_TYPE_1xRTT:
case TelephonyManager.NETWORK_TYPE_IDEN: case TelephonyManager.NETWORK_TYPE_IDEN:
netType = NetworkType.NETWORK_2G; return NetworkType.NETWORK_2G;
break;
case TelephonyManager.NETWORK_TYPE_TD_SCDMA: case TelephonyManager.NETWORK_TYPE_TD_SCDMA:
case TelephonyManager.NETWORK_TYPE_EVDO_A: case TelephonyManager.NETWORK_TYPE_EVDO_A:
...@@ -310,30 +315,23 @@ public final class NetworkUtils { ...@@ -310,30 +315,23 @@ public final class NetworkUtils {
case TelephonyManager.NETWORK_TYPE_EVDO_B: case TelephonyManager.NETWORK_TYPE_EVDO_B:
case TelephonyManager.NETWORK_TYPE_EHRPD: case TelephonyManager.NETWORK_TYPE_EHRPD:
case TelephonyManager.NETWORK_TYPE_HSPAP: case TelephonyManager.NETWORK_TYPE_HSPAP:
netType = NetworkType.NETWORK_3G; return NetworkType.NETWORK_3G;
break;
case TelephonyManager.NETWORK_TYPE_IWLAN: case TelephonyManager.NETWORK_TYPE_IWLAN:
case TelephonyManager.NETWORK_TYPE_LTE: case TelephonyManager.NETWORK_TYPE_LTE:
netType = NetworkType.NETWORK_4G; return NetworkType.NETWORK_4G;
break;
default:
default:
String subtypeName = info.getSubtypeName(); String subtypeName = info.getSubtypeName();
if (subtypeName.equalsIgnoreCase("TD-SCDMA") if (subtypeName.equalsIgnoreCase("TD-SCDMA")
|| subtypeName.equalsIgnoreCase("WCDMA") || subtypeName.equalsIgnoreCase("WCDMA")
|| subtypeName.equalsIgnoreCase("CDMA2000")) { || subtypeName.equalsIgnoreCase("CDMA2000")) {
netType = NetworkType.NETWORK_3G; return NetworkType.NETWORK_3G;
} else {
netType = NetworkType.NETWORK_UNKNOWN;
} }
break;
} }
} else {
netType = NetworkType.NETWORK_UNKNOWN;
} }
} }
return netType; return NetworkType.NETWORK_UNKNOWN;
} }
/** /**
...@@ -344,18 +342,15 @@ public final class NetworkUtils { ...@@ -344,18 +342,15 @@ public final class NetworkUtils {
* @return {@code true}: yes<br>{@code false}: no * @return {@code true}: yes<br>{@code false}: no
*/ */
@RequiresPermission(ACCESS_NETWORK_STATE) @RequiresPermission(ACCESS_NETWORK_STATE)
public static boolean isEthernet() { private static boolean isEthernet() {
final ConnectivityManager connectivityManager = (ConnectivityManager) Utils.getApp().getSystemService(Context.CONNECTIVITY_SERVICE); final ConnectivityManager cm =
final NetworkInfo ethernet = connectivityManager.getNetworkInfo(ConnectivityManager.TYPE_ETHERNET); (ConnectivityManager) Utils.getApp().getSystemService(Context.CONNECTIVITY_SERVICE);
if (ethernet != null) { if (cm == null) return false;
NetworkInfo.State state = ethernet.getState(); final NetworkInfo info = cm.getNetworkInfo(ConnectivityManager.TYPE_ETHERNET);
if (null != state) { if (info == null) return false;
if (state == NetworkInfo.State.CONNECTED || state == NetworkInfo.State.CONNECTING) { NetworkInfo.State state = info.getState();
return true; if (null == state) return false;
} return state == NetworkInfo.State.CONNECTED || state == NetworkInfo.State.CONNECTING;
}
}
return false;
} }
@RequiresPermission(ACCESS_NETWORK_STATE) @RequiresPermission(ACCESS_NETWORK_STATE)
......
...@@ -284,7 +284,7 @@ public final class PhoneUtils { ...@@ -284,7 +284,7 @@ public final class PhoneUtils {
str += "SimSerialNumber = " + tm.getSimSerialNumber() + "\n"; str += "SimSerialNumber = " + tm.getSimSerialNumber() + "\n";
str += "SimState = " + tm.getSimState() + "\n"; str += "SimState = " + tm.getSimState() + "\n";
str += "SubscriberId(IMSI) = " + tm.getSubscriberId() + "\n"; str += "SubscriberId(IMSI) = " + tm.getSubscriberId() + "\n";
str += "VoiceMailNumber = " + tm.getVoiceMailNumber() + "\n"; str += "VoiceMailNumber = " + tm.getVoiceMailNumber();
return str; return str;
} }
......
...@@ -75,7 +75,7 @@ public final class SizeUtils { ...@@ -75,7 +75,7 @@ public final class SizeUtils {
* metrics depending on its unit. * metrics depending on its unit.
*/ */
public static float applyDimension(final float value, final int unit) { public static float applyDimension(final float value, final int unit) {
DisplayMetrics metrics = Utils.getApp().getResources().getDisplayMetrics(); DisplayMetrics metrics = Resources.getSystem().getDisplayMetrics();
switch (unit) { switch (unit) {
case TypedValue.COMPLEX_UNIT_PX: case TypedValue.COMPLEX_UNIT_PX:
return value; return value;
......
...@@ -335,15 +335,15 @@ public final class Utils { ...@@ -335,15 +335,15 @@ public final class Utils {
return null; return null;
} }
private static void fixSoftInputLeaks(final Context context) { private static void fixSoftInputLeaks(final Activity activity) {
if (context == null) return; if (activity == null) return;
InputMethodManager imm = InputMethodManager imm =
(InputMethodManager) Utils.getApp().getSystemService(Context.INPUT_METHOD_SERVICE); (InputMethodManager) Utils.getApp().getSystemService(Context.INPUT_METHOD_SERVICE);
String[] strArr = new String[]{"mCurRootView", "mServedView", "mNextServedView", "mLastSrvView"}; if (imm == null) return;
for (int i = 0; i < 4; i++) { String[] leakViews = new String[]{"mLastSrvView", "mCurRootView", "mServedView", "mNextServedView"};
for (String leakView : leakViews) {
try { try {
//noinspection ConstantConditions Field declaredField = InputMethodManager.class.getDeclaredField(leakView);
Field declaredField = imm.getClass().getDeclaredField(strArr[i]);
if (declaredField == null) continue; if (declaredField == null) continue;
if (!declaredField.isAccessible()) { if (!declaredField.isAccessible()) {
declaredField.setAccessible(true); declaredField.setAccessible(true);
...@@ -351,10 +351,8 @@ public final class Utils { ...@@ -351,10 +351,8 @@ public final class Utils {
Object obj = declaredField.get(imm); Object obj = declaredField.get(imm);
if (!(obj instanceof View)) continue; if (!(obj instanceof View)) continue;
View view = (View) obj; View view = (View) obj;
if (view.getContext() == context) { if (view.getRootView() == activity.getWindow().getDecorView().getRootView()) {
declaredField.set(imm, null); declaredField.set(imm, null);
} else {
return;
} }
} catch (Throwable th) { } catch (Throwable th) {
th.printStackTrace(); th.printStackTrace();
......
...@@ -35,7 +35,9 @@ public class CloneUtilsTest { ...@@ -35,7 +35,9 @@ public class CloneUtilsTest {
@Override @Override
public String toString() { public String toString() {
return "{\"code\":" + code + ",\"message\":" + message + ",\"data\":" + data + "}"; return "{\"code\":" + primitive2String(code) +
",\"message\":" + primitive2String(message) +
",\"data\":" + primitive2String(data) + "}";
} }
} }
...@@ -51,7 +53,15 @@ public class CloneUtilsTest { ...@@ -51,7 +53,15 @@ public class CloneUtilsTest {
@Override @Override
public String toString() { public String toString() {
return "{\"name\":" + name + ",\"gender\":" + gender + ",\"address\":" + address + "}"; return "{\"name\":" + primitive2String(name) +
",\"gender\":" + primitive2String(gender) +
",\"address\":" + primitive2String(address) + "}";
} }
} }
private static String primitive2String(final Object obj) {
if (obj == null) return "null";
if (obj instanceof CharSequence) return "\"" + obj.toString() + "\"";
return obj.toString();
}
} }
\ No newline at end of file
...@@ -16,7 +16,7 @@ import java.util.Map; ...@@ -16,7 +16,7 @@ import java.util.Map;
*/ */
public class LogUtilsTest extends BaseTest { public class LogUtilsTest extends BaseTest {
private static final String JSON = "{\"tools\": [{ \"name\":\"css format\" , \"site\":\"http://tools.w3cschool.cn/code/css\" },{ \"name\":\"JSON format\" , \"site\":\"http://tools.w3cschool.cn/code/JSON\" },{ \"name\":\"pwd check\" , \"site\":\"http://tools.w3cschool.cn/password/my_password_safe\" }]}"; private static final String JSON = "\r\n{\"tools\": [{ \"name\":\"css format\" , \"site\":\"http://tools.w3cschool.cn/code/css\" },{ \"name\":\"JSON format\" , \"site\":\"http://tools.w3cschool.cn/code/JSON\" },{ \"name\":\"pwd check\" , \"site\":\"http://tools.w3cschool.cn/password/my_password_safe\" }]}";
private static final String XML = "<books><book><author>Jack Herrington</author><title>PHP Hacks</title><publisher>O'Reilly</publisher></book><book><author>Jack Herrington</author><title>Podcasting Hacks</title><publisher>O'Reilly</publisher></book></books>"; private static final String XML = "<books><book><author>Jack Herrington</author><title>PHP Hacks</title><publisher>O'Reilly</publisher></book><book><author>Jack Herrington</author><title>Podcasting Hacks</title><publisher>O'Reilly</publisher></book></books>";
private static final int[] ONE_D_ARRAY = new int[]{1, 2, 3}; private static final int[] ONE_D_ARRAY = new int[]{1, 2, 3};
private static final int[][] TWO_D_ARRAY = new int[][]{{1, 2, 3}, {4, 5, 6}, {7, 8, 9}}; private static final int[][] TWO_D_ARRAY = new int[][]{{1, 2, 3}, {4, 5, 6}, {7, 8, 9}};
...@@ -166,10 +166,6 @@ public class LogUtilsTest extends BaseTest { ...@@ -166,10 +166,6 @@ public class LogUtilsTest extends BaseTest {
LogUtils.d((Object) TWO_D_ARRAY); LogUtils.d((Object) TWO_D_ARRAY);
LogUtils.d(LIST); LogUtils.d(LIST);
LogUtils.d(MAP); LogUtils.d(MAP);
Object o = GsonUtils.fromJson(GsonUtils.toJson(LIST), GsonUtils.getListType(String.class));
System.out.println(o);
} }
static class Person { static class Person {
...@@ -193,5 +189,18 @@ public class LogUtilsTest extends BaseTest { ...@@ -193,5 +189,18 @@ public class LogUtilsTest extends BaseTest {
private static boolean equals(final Object o1, final Object o2) { private static boolean equals(final Object o1, final Object o2) {
return o1 == o2 || (o1 != null && o1.equals(o2)); return o1 == o2 || (o1 != null && o1.equals(o2));
} }
@Override
public String toString() {
return "{\"name\":" + primitive2String(name) +
",\"gender\":" + primitive2String(gender) +
",\"address\":" + primitive2String(address) + "}";
}
}
private static String primitive2String(final Object obj) {
if (obj == null) return "null";
if (obj instanceof CharSequence) return "\"" + obj.toString() + "\"";
return obj.toString();
} }
} }
...@@ -54,7 +54,6 @@ class ActivityActivity : BaseBackActivity() { ...@@ -54,7 +54,6 @@ class ActivityActivity : BaseBackActivity() {
override fun initView(savedInstanceState: Bundle?, contentView: View) { override fun initView(savedInstanceState: Bundle?, contentView: View) {
setTitle(R.string.demo_activity) setTitle(R.string.demo_activity)
activityClzBtn.setOnClickListener(this) activityClzBtn.setOnClickListener(this)
......
...@@ -34,6 +34,7 @@ class SubActivityActivity : BaseBackActivity() { ...@@ -34,6 +34,7 @@ class SubActivityActivity : BaseBackActivity() {
} }
override fun initView(savedInstanceState: Bundle?, contentView: View) { override fun initView(savedInstanceState: Bundle?, contentView: View) {
setTitle(R.string.demo_activity)
contentView.setBackgroundColor(ColorUtils.getRandomColor(false)) contentView.setBackgroundColor(ColorUtils.getRandomColor(false))
} }
......
...@@ -24,12 +24,20 @@ class AdaptScreenActivity : BaseBackActivity() { ...@@ -24,12 +24,20 @@ class AdaptScreenActivity : BaseBackActivity() {
} }
override fun initView(savedInstanceState: Bundle?, contentView: View) { override fun initView(savedInstanceState: Bundle?, contentView: View) {
adaptScreenAdaptWidthBtn.setOnClickListener { WidthActivity.start(this) } setTitle(R.string.demo_adapt_screen)
adaptScreenAdaptHeightBtn.setOnClickListener { HeightActivity.start(this) }
adaptScreenCloseAdaptBtn.setOnClickListener { CloseAdaptActivity.start(this) } adaptScreenAdaptWidthBtn.setOnClickListener(this)
adaptScreenAdaptHeightBtn.setOnClickListener(this)
adaptScreenCloseAdaptBtn.setOnClickListener(this)
} }
override fun doBusiness() {} override fun doBusiness() {}
override fun onWidgetClick(view: View) {} override fun onWidgetClick(view: View) {
when (view.id) {
R.id.adaptScreenAdaptWidthBtn -> WidthActivity.start(this)
R.id.adaptScreenAdaptHeightBtn -> HeightActivity.start(this)
R.id.adaptScreenCloseAdaptBtn -> CloseAdaptActivity.start(this)
}
}
} }
...@@ -9,6 +9,7 @@ import android.view.View ...@@ -9,6 +9,7 @@ import android.view.View
import com.blankj.lib.base.BaseBackActivity import com.blankj.lib.base.BaseBackActivity
import com.blankj.utilcode.pkg.R import com.blankj.utilcode.pkg.R
import com.blankj.utilcode.util.BarUtils import com.blankj.utilcode.util.BarUtils
import com.blankj.utilcode.util.ColorUtils
import com.blankj.utilcode.util.SpanUtils import com.blankj.utilcode.util.SpanUtils
import kotlinx.android.synthetic.main.activity_bar_nav.* import kotlinx.android.synthetic.main.activity_bar_nav.*
...@@ -38,13 +39,18 @@ class BarNavActivity : BaseBackActivity() { ...@@ -38,13 +39,18 @@ class BarNavActivity : BaseBackActivity() {
} }
override fun initView(savedInstanceState: Bundle?, contentView: View) { override fun initView(savedInstanceState: Bundle?, contentView: View) {
(contentView.parent as View).setBackgroundColor(Color.GRAY)
setTitle(R.string.demo_bar) setTitle(R.string.demo_bar)
barNavShowBtn.setOnClickListener(this) contentView.setBackgroundColor(Color.GRAY)
barNavHideBtn.setOnClickListener(this) if (!BarUtils.isSupportNavBar()) {
barNavSetColorBtn.setOnClickListener(this) barNavVisibilityCb.visibility = View.GONE
updateAboutNav() barNavSetColorBtn.visibility = View.GONE
} else {
barNavVisibilityCb.setOnCheckedChangeListener { buttonView, isChecked ->
BarUtils.setNavBarVisibility(this, isChecked)
}
barNavSetColorBtn.setOnClickListener(this)
}
} }
override fun doBusiness() { override fun doBusiness() {
...@@ -53,14 +59,8 @@ class BarNavActivity : BaseBackActivity() { ...@@ -53,14 +59,8 @@ class BarNavActivity : BaseBackActivity() {
override fun onWidgetClick(view: View) { override fun onWidgetClick(view: View) {
when (view.id) { when (view.id) {
R.id.barNavShowBtn -> if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
BarUtils.setNavBarVisibility(this, true)
}
R.id.barNavHideBtn -> if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
BarUtils.setNavBarVisibility(this, false)
}
R.id.barNavSetColorBtn -> if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { R.id.barNavSetColorBtn -> if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
BarUtils.setNavBarColor(this, (Math.random() * 0xFFFFFFFF).toInt()) BarUtils.setNavBarColor(this, ColorUtils.getRandomColor())
} }
} }
updateAboutNav() updateAboutNav()
...@@ -69,10 +69,9 @@ class BarNavActivity : BaseBackActivity() { ...@@ -69,10 +69,9 @@ class BarNavActivity : BaseBackActivity() {
private fun updateAboutNav() { private fun updateAboutNav() {
SpanUtils.with(barNavAboutTv) SpanUtils.with(barNavAboutTv)
.appendLine("navHeight: " + BarUtils.getNavBarHeight()) .appendLine("navHeight: " + BarUtils.getNavBarHeight())
.appendLine("isNavBarVisible: " + BarUtils.isNavBarVisible(this))
.apply { .apply {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
appendLine("getNavBarColor: #" + Integer.toHexString(BarUtils.getNavBarColor(mActivity))) appendLine("getNavBarColor: " + ColorUtils.int2ArgbString(BarUtils.getNavBarColor(mActivity)))
} }
} }
.append("isSupportNavBar: " + BarUtils.isSupportNavBar()) .append("isSupportNavBar: " + BarUtils.isSupportNavBar())
...@@ -81,6 +80,7 @@ class BarNavActivity : BaseBackActivity() { ...@@ -81,6 +80,7 @@ class BarNavActivity : BaseBackActivity() {
override fun onWindowFocusChanged(hasFocus: Boolean) { override fun onWindowFocusChanged(hasFocus: Boolean) {
super.onWindowFocusChanged(hasFocus) super.onWindowFocusChanged(hasFocus)
barNavVisibilityCb.isChecked = BarUtils.isNavBarVisible(this)
updateAboutNav() updateAboutNav()
} }
} }
...@@ -38,31 +38,35 @@ class BarStatusActivity : BaseBackActivity() { ...@@ -38,31 +38,35 @@ class BarStatusActivity : BaseBackActivity() {
override fun initView(savedInstanceState: Bundle?, contentView: View) { override fun initView(savedInstanceState: Bundle?, contentView: View) {
setTitle(R.string.demo_bar) setTitle(R.string.demo_bar)
barStatusShowBtn.setOnClickListener(this) barStatusVisibilityCb.isChecked = BarUtils.isStatusBarVisible(this)
barStatusHideBtn.setOnClickListener(this) barStatusVisibilityCb.setOnCheckedChangeListener { buttonView, isChecked ->
barStatusLightModeBtn.setOnClickListener(this) BarUtils.setStatusBarVisibility(this, isChecked)
barStatusDarkModeBtn.setOnClickListener(this) }
updateAboutStatus()
barStatusLightModeCb.isChecked = BarUtils.isStatusBarLightMode(this)
barStatusLightModeCb.setOnCheckedChangeListener { buttonView, isChecked ->
BarUtils.setStatusBarLightMode(this, isChecked)
}
} }
override fun doBusiness() { override fun doBusiness() {
} }
override fun onResume() {
super.onResume()
updateAboutStatus()
}
override fun onWidgetClick(view: View) { override fun onWidgetClick(view: View) {
when (view.id) { when (view.id) {
R.id.barStatusShowBtn -> BarUtils.setStatusBarVisibility(this, true)
R.id.barStatusHideBtn -> BarUtils.setStatusBarVisibility(this, false)
R.id.barStatusLightModeBtn -> BarUtils.setStatusBarLightMode(this, true)
R.id.barStatusDarkModeBtn -> BarUtils.setStatusBarLightMode(this, false)
} }
updateAboutStatus() updateAboutStatus()
} }
private fun updateAboutStatus() { private fun updateAboutStatus() {
barStatusAboutTv.text = SpanUtils() SpanUtils.with(barStatusAboutTv)
.appendLine("statusHeight: " + BarUtils.getStatusBarHeight()) .append("getStatusBarHeight: " + BarUtils.getStatusBarHeight())
.append("isStatusVisible: " + BarUtils.isStatusBarVisible(this))
.create() .create()
} }
} }
...@@ -25,8 +25,21 @@ class BrightnessActivity : BaseBackActivity() { ...@@ -25,8 +25,21 @@ class BrightnessActivity : BaseBackActivity() {
companion object { companion object {
fun start(context: Context) { fun start(context: Context) {
val starter = Intent(context, BrightnessActivity::class.java) if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
context.startActivity(starter) PermissionUtils.requestWriteSettings(object : PermissionUtils.SimpleCallback {
override fun onGranted() {
val starter = Intent(context, BrightnessActivity::class.java)
context.startActivity(starter)
}
override fun onDenied() {
start(context)
}
})
} else {
val starter = Intent(context, BrightnessActivity::class.java)
context.startActivity(starter)
}
} }
} }
...@@ -69,6 +82,7 @@ class BrightnessActivity : BaseBackActivity() { ...@@ -69,6 +82,7 @@ class BrightnessActivity : BaseBackActivity() {
} }
override fun initView(savedInstanceState: Bundle?, contentView: View) { override fun initView(savedInstanceState: Bundle?, contentView: View) {
setTitle(R.string.demo_brightness)
brightnessChangeSb.progress = BrightnessUtils.getBrightness() brightnessChangeSb.progress = BrightnessUtils.getBrightness()
brightnessChangeSb.setOnSeekBarChangeListener(brightnessChangeListener) brightnessChangeSb.setOnSeekBarChangeListener(brightnessChangeListener)
...@@ -79,19 +93,7 @@ class BrightnessActivity : BaseBackActivity() { ...@@ -79,19 +93,7 @@ class BrightnessActivity : BaseBackActivity() {
updateWindowBrightness() updateWindowBrightness()
brightnessSetAutoCb.setOnCheckedChangeListener { buttonView, isChecked -> brightnessSetAutoCb.setOnCheckedChangeListener { buttonView, isChecked ->
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { BrightnessUtils.setAutoBrightnessEnabled(isChecked)
PermissionUtils.requestWriteSettings(object : PermissionUtils.SimpleCallback {
override fun onGranted() {
BrightnessUtils.setAutoBrightnessEnabled(isChecked)
}
override fun onDenied() {
}
})
} else {
BrightnessUtils.setAutoBrightnessEnabled(isChecked)
}
} }
} }
...@@ -105,13 +107,13 @@ class BrightnessActivity : BaseBackActivity() { ...@@ -105,13 +107,13 @@ class BrightnessActivity : BaseBackActivity() {
private fun updateBrightness() { private fun updateBrightness() {
SpanUtils.with(brightnessAboutTv) SpanUtils.with(brightnessAboutTv)
.append(BrightnessUtils.getBrightness().toString()) .append("getBrightness: " + BrightnessUtils.getBrightness())
.create() .create()
} }
private fun updateWindowBrightness() { private fun updateWindowBrightness() {
SpanUtils.with(brightnessWindowAboutTv) SpanUtils.with(brightnessWindowAboutTv)
.append(BrightnessUtils.getWindowBrightness(window).toString()) .append("getWindowBrightness: " + BrightnessUtils.getWindowBrightness(window))
.create() .create()
} }
} }
...@@ -50,9 +50,11 @@ class FlashlightActivity : BaseBackActivity() { ...@@ -50,9 +50,11 @@ class FlashlightActivity : BaseBackActivity() {
} }
override fun initView(savedInstanceState: Bundle?, contentView: View) { override fun initView(savedInstanceState: Bundle?, contentView: View) {
flashlightEnableCb.setOnCheckedChangeListener { buttonView, isChecked -> setTitle(R.string.demo_flashlight)
flashlightStatusCb.isChecked = FlashlightUtils.isFlashlightOn()
flashlightStatusCb.setOnCheckedChangeListener { buttonView, isChecked ->
FlashlightUtils.setFlashlightStatus(isChecked) FlashlightUtils.setFlashlightStatus(isChecked)
updateAboutFlashlight()
} }
} }
...@@ -66,8 +68,7 @@ class FlashlightActivity : BaseBackActivity() { ...@@ -66,8 +68,7 @@ class FlashlightActivity : BaseBackActivity() {
private fun updateAboutFlashlight() { private fun updateAboutFlashlight() {
SpanUtils.with(flashlightAboutTv) SpanUtils.with(flashlightAboutTv)
.appendLine("isFlashlightEnable: " + FlashlightUtils.isFlashlightEnable()) .append("isFlashlightEnable: " + FlashlightUtils.isFlashlightEnable())
.appendLine("isFlashlightOn: " + FlashlightUtils.isFlashlightOn())
.create() .create()
} }
......
...@@ -67,34 +67,32 @@ class KeyboardActivity : BaseBackActivity() { ...@@ -67,34 +67,32 @@ class KeyboardActivity : BaseBackActivity() {
} }
} }
// @Override // override fun dispatchTouchEvent(ev: MotionEvent): Boolean {
// public boolean dispatchTouchEvent(MotionEvent ev) { // if (ev.action == MotionEvent.ACTION_DOWN) {
// if (ev.getAction() == MotionEvent.ACTION_DOWN) { // val v = currentFocus
// View v = getCurrentFocus(); // if (isShouldHideKeyboard(v, ev)) {
// if (isShouldHideKeyboard(v, ev)) { // val imm = getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
// InputMethodManager imm = // ?: return super.dispatchTouchEvent(ev)
// (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); // imm.hideSoftInputFromWindow(v.windowToken, InputMethodManager.HIDE_NOT_ALWAYS)
// if (imm == null) return super.dispatchTouchEvent(ev); // }
// imm.hideSoftInputFromWindow(v.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); // }
// } // return super.dispatchTouchEvent(ev)
// } // }
// return super.dispatchTouchEvent(ev); //
// } // // 根据 EditText 所在坐标和用户点击的坐标相对比,来判断是否隐藏键盘
// // private fun isShouldHideKeyboard(v: View?, event: MotionEvent): Boolean {
// // 根据 EditText 所在坐标和用户点击的坐标相对比,来判断是否隐藏键盘 // if (v != null && v is EditText) {
// private boolean isShouldHideKeyboard(View v, MotionEvent event) { // val l = intArrayOf(0, 0)
// if (v != null && (v instanceof EditText)) { // v.getLocationInWindow(l)
// int[] l = {0, 0}; // val left = l[0]
// v.getLocationInWindow(l); // val top = l[1]
// int left = l[0], // val bottom = top + v.height
// top = l[1], // val right = left + v.width
// bottom = top + v.getHeight(), // return !(event.x > left && event.x < right
// right = left + v.getWidth(); // && event.y > top && event.y < bottom)
// return !(event.getX() > left && event.getX() < right // }
// && event.getY() > top && event.getY() < bottom); // return false
// } // }
// return false;
// }
override fun onDestroy() { override fun onDestroy() {
KeyboardUtils.unregisterSoftInputChangedListener(this) KeyboardUtils.unregisterSoftInputChangedListener(this)
......
...@@ -6,12 +6,14 @@ import android.content.Intent ...@@ -6,12 +6,14 @@ import android.content.Intent
import android.net.Uri import android.net.Uri
import android.os.Bundle import android.os.Bundle
import android.view.View import android.view.View
import android.widget.CompoundButton
import com.blankj.lib.base.BaseApplication import com.blankj.lib.base.BaseApplication
import com.blankj.lib.base.BaseBackActivity import com.blankj.lib.base.BaseBackActivity
import com.blankj.utilcode.pkg.R import com.blankj.utilcode.pkg.R
import com.blankj.utilcode.util.AppUtils import com.blankj.utilcode.util.AppUtils
import com.blankj.utilcode.util.LogUtils import com.blankj.utilcode.util.LogUtils
import com.blankj.utilcode.util.PathUtils import com.blankj.utilcode.util.PathUtils
import com.blankj.utilcode.util.StringUtils
import kotlinx.android.synthetic.main.activity_log.* import kotlinx.android.synthetic.main.activity_log.*
import java.util.* import java.util.*
...@@ -24,21 +26,11 @@ import java.util.* ...@@ -24,21 +26,11 @@ import java.util.*
* desc : demo about LogUtils * desc : demo about LogUtils
* ``` * ```
*/ */
class LogActivity : BaseBackActivity() { class LogActivity : BaseBackActivity(),
CompoundButton.OnCheckedChangeListener {
companion object { companion object {
private const val TAG = "CMJ" private const val TAG = "CMJ"
private const val UPDATE_LOG = 0x01
private const val UPDATE_CONSOLE = 0x01 shl 1
private const val UPDATE_TAG = 0x01 shl 2
private const val UPDATE_HEAD = 0x01 shl 3
private const val UPDATE_FILE = 0x01 shl 4
private const val UPDATE_DIR = 0x01 shl 5
private const val UPDATE_BORDER = 0x01 shl 6
private const val UPDATE_SINGLE = 0x01 shl 7
private const val UPDATE_CONSOLE_FILTER = 0x01 shl 8
private const val UPDATE_FILE_FILTER = 0x01 shl 9
private const val JSON = "{\"tools\": [{ \"name\":\"css format\" , \"site\":\"http://tools.w3cschool.cn/code/css\" },{ \"name\":\"JSON format\" , \"site\":\"http://tools.w3cschool.cn/code/JSON\" },{ \"name\":\"pwd check\" , \"site\":\"http://tools.w3cschool.cn/password/my_password_safe\" }]}" private const val JSON = "{\"tools\": [{ \"name\":\"css format\" , \"site\":\"http://tools.w3cschool.cn/code/css\" },{ \"name\":\"JSON format\" , \"site\":\"http://tools.w3cschool.cn/code/JSON\" },{ \"name\":\"pwd check\" , \"site\":\"http://tools.w3cschool.cn/password/my_password_safe\" }]}"
private const val XML = "<books><book><author>Jack Herrington</author><title>PHP Hacks</title><publisher>O'Reilly</publisher></book><book><author>Jack Herrington</author><title>Podcasting Hacks</title><publisher>O'Reilly</publisher></book></books>" private const val XML = "<books><book><author>Jack Herrington</author><title>PHP Hacks</title><publisher>O'Reilly</publisher></book><book><author>Jack Herrington</author><title>Podcasting Hacks</title><publisher>O'Reilly</publisher></book></books>"
private val ONE_D_ARRAY = intArrayOf(1, 2, 3) private val ONE_D_ARRAY = intArrayOf(1, 2, 3)
...@@ -107,17 +99,6 @@ class LogActivity : BaseBackActivity() { ...@@ -107,17 +99,6 @@ class LogActivity : BaseBackActivity() {
private val mConfig = LogUtils.getConfig() private val mConfig = LogUtils.getConfig()
private var dir: String = ""
private var globalTag = ""
private var log = true
private var console = true
private var head = true
private var file = false
private var border = true
private var single = true
private var consoleFilter = LogUtils.V
private var fileFilter = LogUtils.V
private val mRunnable = Runnable { private val mRunnable = Runnable {
LogUtils.v("verbose") LogUtils.v("verbose")
LogUtils.d("debug") LogUtils.d("debug")
...@@ -138,16 +119,40 @@ class LogActivity : BaseBackActivity() { ...@@ -138,16 +119,40 @@ class LogActivity : BaseBackActivity() {
override fun initView(savedInstanceState: Bundle?, contentView: View) { override fun initView(savedInstanceState: Bundle?, contentView: View) {
setTitle(R.string.demo_log) setTitle(R.string.demo_log)
logToggleLogBtn.setOnClickListener(this) logSwitchCb.isChecked = mConfig.isLogSwitch
logToggleConsoleBtn.setOnClickListener(this) logSwitchCb.setOnCheckedChangeListener(this)
logToggleTagBtn.setOnClickListener(this)
logToggleHeadBtn.setOnClickListener(this) log2ConsoleSwitchCb.isChecked = mConfig.isLog2ConsoleSwitch
logToggleBorderBtn.setOnClickListener(this) log2ConsoleSwitchCb.setOnCheckedChangeListener(this)
logToggleSingleBtn.setOnClickListener(this)
logToggleFileBtn.setOnClickListener(this) logGlobalTagCb.isChecked = !StringUtils.isSpace(mConfig.globalTag)
logToggleDirBtn.setOnClickListener(this) logGlobalTagCb.setOnCheckedChangeListener(this)
logToggleConsoleFilterBtn.setOnClickListener(this) logGlobalTagCb.text = String.format("Global Tag: %s", mConfig.globalTag)
logToggleFileFilterBtn.setOnClickListener(this)
logHeadSwitchCb.isChecked = mConfig.isLogHeadSwitch
logHeadSwitchCb.setOnCheckedChangeListener(this)
log2FileSwitchCb.isChecked = mConfig.isLog2FileSwitch
log2FileSwitchCb.setOnCheckedChangeListener(this)
logDirCb.isChecked = mConfig.dir != mConfig.defaultDir
logDirCb.setOnCheckedChangeListener(this)
logDirCb.text = String.format("Dir: %s", mConfig.dir)
logBorderSwitchCb.isChecked = mConfig.isLogBorderSwitch
logBorderSwitchCb.setOnCheckedChangeListener(this)
logBorderSwitchCb.isChecked = mConfig.isSingleTagSwitch
logSingleTagSwitchCb.setOnCheckedChangeListener(this)
logConsoleFilterCb.isChecked = mConfig.consoleFilter != 'V'
logConsoleFilterCb.setOnCheckedChangeListener(this)
logConsoleFilterCb.text = String.format("ConsoleFilter: %s", mConfig.consoleFilter)
logFileFilterCb.isChecked = mConfig.fileFilter != 'V'
logFileFilterCb.setOnCheckedChangeListener(this)
logFileFilterCb.text = String.format("FileFilter: %s", mConfig.fileFilter)
logNoTagBtn.setOnClickListener(this) logNoTagBtn.setOnClickListener(this)
logWithTagBtn.setOnClickListener(this) logWithTagBtn.setOnClickListener(this)
logInNewThreadBtn.setOnClickListener(this) logInNewThreadBtn.setOnClickListener(this)
...@@ -163,7 +168,7 @@ class LogActivity : BaseBackActivity() { ...@@ -163,7 +168,7 @@ class LogActivity : BaseBackActivity() {
logIntentBtn.setOnClickListener(this) logIntentBtn.setOnClickListener(this)
logArrayListBtn.setOnClickListener(this) logArrayListBtn.setOnClickListener(this)
logMapBtn.setOnClickListener(this) logMapBtn.setOnClickListener(this)
updateConfig(0) updateAboutLog()
} }
override fun doBusiness() { override fun doBusiness() {
...@@ -172,16 +177,6 @@ class LogActivity : BaseBackActivity() { ...@@ -172,16 +177,6 @@ class LogActivity : BaseBackActivity() {
override fun onWidgetClick(view: View) { override fun onWidgetClick(view: View) {
when (view.id) { when (view.id) {
R.id.logToggleLogBtn -> updateConfig(UPDATE_LOG)
R.id.logToggleConsoleBtn -> updateConfig(UPDATE_CONSOLE)
R.id.logToggleTagBtn -> updateConfig(UPDATE_TAG)
R.id.logToggleHeadBtn -> updateConfig(UPDATE_HEAD)
R.id.logToggleFileBtn -> updateConfig(UPDATE_FILE)
R.id.logToggleDirBtn -> updateConfig(UPDATE_DIR)
R.id.logToggleBorderBtn -> updateConfig(UPDATE_BORDER)
R.id.logToggleSingleBtn -> updateConfig(UPDATE_SINGLE)
R.id.logToggleConsoleFilterBtn -> updateConfig(UPDATE_CONSOLE_FILTER)
R.id.logToggleFileFilterBtn -> updateConfig(UPDATE_FILE_FILTER)
R.id.logNoTagBtn -> { R.id.logNoTagBtn -> {
LogUtils.v("verbose") LogUtils.v("verbose")
LogUtils.d("debug") LogUtils.d("debug")
...@@ -189,7 +184,6 @@ class LogActivity : BaseBackActivity() { ...@@ -189,7 +184,6 @@ class LogActivity : BaseBackActivity() {
LogUtils.w("warn") LogUtils.w("warn")
LogUtils.e("error") LogUtils.e("error")
LogUtils.a("assert") LogUtils.a("assert")
} }
R.id.logWithTagBtn -> { R.id.logWithTagBtn -> {
LogUtils.vTag("customTag", "verbose") LogUtils.vTag("customTag", "verbose")
...@@ -198,12 +192,10 @@ class LogActivity : BaseBackActivity() { ...@@ -198,12 +192,10 @@ class LogActivity : BaseBackActivity() {
LogUtils.wTag("customTag", "warn") LogUtils.wTag("customTag", "warn")
LogUtils.eTag("customTag", "error") LogUtils.eTag("customTag", "error")
LogUtils.aTag("customTag", "assert") LogUtils.aTag("customTag", "assert")
} }
R.id.logInNewThreadBtn -> { R.id.logInNewThreadBtn -> {
val thread = Thread(mRunnable) val thread = Thread(mRunnable)
thread.start() thread.start()
} }
R.id.logNullBtn -> { R.id.logNullBtn -> {
LogUtils.v(null) LogUtils.v(null)
...@@ -212,7 +204,6 @@ class LogActivity : BaseBackActivity() { ...@@ -212,7 +204,6 @@ class LogActivity : BaseBackActivity() {
LogUtils.w(null) LogUtils.w(null)
LogUtils.e(null) LogUtils.e(null)
LogUtils.a(null) LogUtils.a(null)
} }
R.id.logManyParamsBtn -> { R.id.logManyParamsBtn -> {
LogUtils.v("verbose0", "verbose1") LogUtils.v("verbose0", "verbose1")
...@@ -227,7 +218,6 @@ class LogActivity : BaseBackActivity() { ...@@ -227,7 +218,6 @@ class LogActivity : BaseBackActivity() {
LogUtils.eTag("customTag", "error0", "error1") LogUtils.eTag("customTag", "error0", "error1")
LogUtils.a("assert0", "assert1") LogUtils.a("assert0", "assert1")
LogUtils.aTag("customTag", "assert0", "assert1") LogUtils.aTag("customTag", "assert0", "assert1")
} }
R.id.logLongBtn -> LogUtils.d(LONG_STR) R.id.logLongBtn -> LogUtils.d(LONG_STR)
R.id.logFileBtn -> for (i in 0..99) { R.id.logFileBtn -> for (i in 0..99) {
...@@ -237,17 +227,14 @@ class LogActivity : BaseBackActivity() { ...@@ -237,17 +227,14 @@ class LogActivity : BaseBackActivity() {
R.id.logJsonBtn -> { R.id.logJsonBtn -> {
LogUtils.json(JSON) LogUtils.json(JSON)
LogUtils.json(LogUtils.I, JSON) LogUtils.json(LogUtils.I, JSON)
} }
R.id.logXmlBtn -> { R.id.logXmlBtn -> {
LogUtils.xml(XML) LogUtils.xml(XML)
LogUtils.xml(LogUtils.I, XML) LogUtils.xml(LogUtils.I, XML)
} }
R.id.logArrayBtn -> { R.id.logArrayBtn -> {
LogUtils.e(ONE_D_ARRAY) LogUtils.e(ONE_D_ARRAY)
LogUtils.e(TWO_D_ARRAY) LogUtils.e(TWO_D_ARRAY)
} }
R.id.logThrowableBtn -> LogUtils.e(THROWABLE) R.id.logThrowableBtn -> LogUtils.e(THROWABLE)
R.id.logBundleBtn -> LogUtils.e(BUNDLE) R.id.logBundleBtn -> LogUtils.e(BUNDLE)
...@@ -257,41 +244,44 @@ class LogActivity : BaseBackActivity() { ...@@ -257,41 +244,44 @@ class LogActivity : BaseBackActivity() {
} }
} }
private fun updateConfig(args: Int) { override fun onCheckedChanged(buttonView: CompoundButton?, isChecked: Boolean) {
when (args) { when (buttonView?.id) {
UPDATE_LOG -> log = !log R.id.logSwitchCb -> mConfig.setLogSwitch(isChecked)
UPDATE_CONSOLE -> console = !console R.id.log2ConsoleSwitchCb -> mConfig.setConsoleSwitch(isChecked)
UPDATE_TAG -> globalTag = if (globalTag == TAG) "" else TAG R.id.logGlobalTagCb -> {
UPDATE_HEAD -> head = !head if (isChecked) {
UPDATE_FILE -> file = !file mConfig.setGlobalTag(TAG)
UPDATE_DIR -> dir = } else {
if (getDir().contains("test")) { mConfig.setGlobalTag("")
"" }
} else { logGlobalTagCb.text = String.format("Global Tag: %s", mConfig.globalTag)
PathUtils.getInternalAppFilesPath() + System.getProperty("file.separator") + "test" }
} R.id.logHeadSwitchCb -> mConfig.setLogHeadSwitch(isChecked)
UPDATE_BORDER -> border = !border R.id.log2FileSwitchCb -> mConfig.setLog2FileSwitch(isChecked)
UPDATE_SINGLE -> single = !single R.id.logDirCb -> {
UPDATE_CONSOLE_FILTER -> consoleFilter = if (consoleFilter == LogUtils.V) LogUtils.W else LogUtils.V if (isChecked) {
UPDATE_FILE_FILTER -> fileFilter = if (fileFilter == LogUtils.V) LogUtils.I else LogUtils.V mConfig.setDir("")
} else {
mConfig.setDir(PathUtils.getInternalAppFilesPath() + System.getProperty("file.separator") + "test")
}
logDirCb.text = String.format("Dir: %s", mConfig.dir)
}
R.id.logBorderSwitchCb -> mConfig.setBorderSwitch(isChecked)
R.id.logSingleTagSwitchCb -> mConfig.setSingleTagSwitch(isChecked)
R.id.logConsoleFilterCb -> {
mConfig.setConsoleFilter(if (isChecked) LogUtils.W else LogUtils.V)
logConsoleFilterCb.text = String.format("ConsoleFilter: %s", mConfig.consoleFilter)
}
R.id.logFileFilterCb -> {
mConfig.setFileFilter(if (isChecked) LogUtils.W else LogUtils.V)
logFileFilterCb.text = String.format("FileFilter: %s", mConfig.fileFilter)
}
} }
mConfig.setLogSwitch(log) updateAboutLog();
.setConsoleSwitch(console)
.setGlobalTag(globalTag)
.setLogHeadSwitch(head)
.setLog2FileSwitch(file)
.setDir(dir)
.setBorderSwitch(border)
.setSingleTagSwitch(single)
.setConsoleFilter(consoleFilter)
.setFileFilter(fileFilter)
logAboutTv.text = mConfig.toString()
} }
private fun getDir(): String { private fun updateAboutLog() {
return mConfig.toString() logAboutTv.text = mConfig.toString()
.split(System.getProperty("line.separator"))[5]
.substring(5)
} }
override fun onDestroy() { override fun onDestroy() {
......
...@@ -7,6 +7,7 @@ import android.text.SpannableStringBuilder ...@@ -7,6 +7,7 @@ import android.text.SpannableStringBuilder
import android.view.View import android.view.View
import com.blankj.lib.base.BaseBackActivity import com.blankj.lib.base.BaseBackActivity
import com.blankj.utilcode.pkg.R import com.blankj.utilcode.pkg.R
import com.blankj.utilcode.util.AppUtils
import com.blankj.utilcode.util.NetworkUtils import com.blankj.utilcode.util.NetworkUtils
import com.blankj.utilcode.util.SpanUtils import com.blankj.utilcode.util.SpanUtils
import com.blankj.utilcode.util.ThreadUtils import com.blankj.utilcode.util.ThreadUtils
...@@ -56,7 +57,28 @@ class NetworkActivity : BaseBackActivity() { ...@@ -56,7 +57,28 @@ class NetworkActivity : BaseBackActivity() {
setTitle(R.string.demo_network) setTitle(R.string.demo_network)
networkOpenWirelessSettingsBtn.setOnClickListener(this) networkOpenWirelessSettingsBtn.setOnClickListener(this)
networkSetWifiEnabledBtn.setOnClickListener(this)
networkMobileDataEnabledCb.setOnClickListener(this)
if (AppUtils.isAppSystem()) {
networkMobileDataEnabledCb.setOnCheckedChangeListener { buttonView, isChecked ->
NetworkUtils.setMobileDataEnabled(isChecked)
updateAboutNetwork()
}
} else {
networkMobileDataEnabledCb.isEnabled = false
}
networkWifiEnabledCb.setOnCheckedChangeListener { buttonView, isChecked ->
NetworkUtils.setWifiEnabled(isChecked)
updateAboutNetwork()
}
}
override fun onResume() {
super.onResume()
networkMobileDataEnabledCb.isChecked = NetworkUtils.getMobileDataEnabled()
networkWifiEnabledCb.isChecked = NetworkUtils.getWifiEnabled()
updateAboutNetwork() updateAboutNetwork()
} }
...@@ -67,8 +89,6 @@ class NetworkActivity : BaseBackActivity() { ...@@ -67,8 +89,6 @@ class NetworkActivity : BaseBackActivity() {
override fun onWidgetClick(view: View) { override fun onWidgetClick(view: View) {
when (view.id) { when (view.id) {
R.id.networkOpenWirelessSettingsBtn -> NetworkUtils.openWirelessSettings() R.id.networkOpenWirelessSettingsBtn -> NetworkUtils.openWirelessSettings()
R.id.btn_set_data_enabled -> NetworkUtils.setMobileDataEnabled(!NetworkUtils.getMobileDataEnabled())
R.id.networkSetWifiEnabledBtn -> NetworkUtils.setWifiEnabled(!NetworkUtils.getWifiEnabled())
} }
updateAboutNetwork() updateAboutNetwork()
} }
......
...@@ -56,7 +56,7 @@ class PhoneActivity : BaseBackActivity() { ...@@ -56,7 +56,7 @@ class PhoneActivity : BaseBackActivity() {
.appendLine("isSimCardReady: " + PhoneUtils.isSimCardReady()) .appendLine("isSimCardReady: " + PhoneUtils.isSimCardReady())
.appendLine("getSimOperatorName: " + PhoneUtils.getSimOperatorName()) .appendLine("getSimOperatorName: " + PhoneUtils.getSimOperatorName())
.appendLine("getSimOperatorByMnc: " + PhoneUtils.getSimOperatorByMnc()) .appendLine("getSimOperatorByMnc: " + PhoneUtils.getSimOperatorByMnc())
.appendLine("getPhoneStatus: " + PhoneUtils.getPhoneStatus()) .append("getPhoneStatus: " + PhoneUtils.getPhoneStatus())
.create() .create()
phoneDialBtn.setOnClickListener(this) phoneDialBtn.setOnClickListener(this)
......
...@@ -16,7 +16,7 @@ import kotlinx.android.synthetic.main.activity_resource.* ...@@ -16,7 +16,7 @@ import kotlinx.android.synthetic.main.activity_resource.*
* author: Blankj * author: Blankj
* blog : http://blankj.com * blog : http://blankj.com
* time : 2018/05/07 * time : 2018/05/07
* desc : * desc : demo about ResourceUtils
* ``` * ```
*/ */
class ResourceActivity : BaseBackActivity() { class ResourceActivity : BaseBackActivity() {
...@@ -37,8 +37,10 @@ class ResourceActivity : BaseBackActivity() { ...@@ -37,8 +37,10 @@ class ResourceActivity : BaseBackActivity() {
} }
override fun initView(savedInstanceState: Bundle?, contentView: View) { override fun initView(savedInstanceState: Bundle?, contentView: View) {
resourceTestAssetsBtn.setOnClickListener(this) setTitle(R.string.demo_resource)
resourceTestRawBtn.setOnClickListener(this)
resourceCopyFileFromAssets.setOnClickListener(this)
resourceCopyFileFromRaw.setOnClickListener(this)
SpanUtils.with(resourceAboutTv) SpanUtils.with(resourceAboutTv)
.appendLine("readAssets2String: " + ResourceUtils.readAssets2String("test/test.txt")) .appendLine("readAssets2String: " + ResourceUtils.readAssets2String("test/test.txt"))
...@@ -53,8 +55,8 @@ class ResourceActivity : BaseBackActivity() { ...@@ -53,8 +55,8 @@ class ResourceActivity : BaseBackActivity() {
override fun onWidgetClick(view: View) { override fun onWidgetClick(view: View) {
when (view.id) { when (view.id) {
R.id.resourceTestAssetsBtn -> ResourceUtils.copyFileFromAssets("test", Config.CACHE_PATH + "/assets/test") R.id.resourceCopyFileFromAssets -> ResourceUtils.copyFileFromAssets("test", Config.CACHE_PATH + "/assets/test")
R.id.resourceTestRawBtn -> ResourceUtils.copyFileFromRaw(R.raw.test, Config.CACHE_PATH + "/raw/test.txt") R.id.resourceCopyFileFromRaw -> ResourceUtils.copyFileFromRaw(R.raw.test, Config.CACHE_PATH + "/raw/test.txt")
} }
} }
} }
...@@ -48,6 +48,8 @@ class SPStaticActivity : BaseBackActivity() { ...@@ -48,6 +48,8 @@ class SPStaticActivity : BaseBackActivity() {
} }
override fun initView(savedInstanceState: Bundle?, contentView: View) { override fun initView(savedInstanceState: Bundle?, contentView: View) {
setTitle(R.string.demo_spStatic)
spStaticPutStringBtn.setOnClickListener(this) spStaticPutStringBtn.setOnClickListener(this)
spStaticPutIntBtn.setOnClickListener(this) spStaticPutIntBtn.setOnClickListener(this)
spStaticPutLongBtn.setOnClickListener(this) spStaticPutLongBtn.setOnClickListener(this)
......
...@@ -229,12 +229,12 @@ class SpanActivity : BaseBackActivity() { ...@@ -229,12 +229,12 @@ class SpanActivity : BaseBackActivity() {
} }
override fun onDestroy() { // override fun onDestroy() {
if (valueAnimator.isRunning) { // if (valueAnimator.isRunning) {
valueAnimator.cancel() // valueAnimator.cancel()
} // }
super.onDestroy() // super.onDestroy()
} // }
} }
class BlurMaskFilterSpan(private var mRadius: Float) : CharacterStyle(), UpdateAppearance { class BlurMaskFilterSpan(private var mRadius: Float) : CharacterStyle(), UpdateAppearance {
......
...@@ -23,7 +23,7 @@ object CustomToast { ...@@ -23,7 +23,7 @@ object CustomToast {
private val HANDLER = Handler(Looper.getMainLooper()) private val HANDLER = Handler(Looper.getMainLooper())
fun showShort(text: CharSequence) { fun showShort(text: CharSequence) {
show(text, Toast.LENGTH_SHORT) showReal(text, Toast.LENGTH_SHORT)
} }
fun showShort(@StringRes resId: Int) { fun showShort(@StringRes resId: Int) {
...@@ -39,7 +39,7 @@ object CustomToast { ...@@ -39,7 +39,7 @@ object CustomToast {
} }
fun showLong(text: CharSequence) { fun showLong(text: CharSequence) {
show(text, Toast.LENGTH_LONG) showReal(text, Toast.LENGTH_LONG)
} }
fun showLong(@StringRes resId: Int) { fun showLong(@StringRes resId: Int) {
...@@ -63,10 +63,10 @@ object CustomToast { ...@@ -63,10 +63,10 @@ object CustomToast {
} }
private fun show(format: String, duration: Int, vararg args: Any) { private fun show(format: String, duration: Int, vararg args: Any) {
show(String.format(format, *args), duration) showReal(String.format(format, *args), duration)
} }
private fun show(text: CharSequence, duration: Int) { private fun showReal(text: CharSequence, duration: Int) {
HANDLER.post { HANDLER.post {
val toastView: TextView val toastView: TextView
if (duration == Toast.LENGTH_SHORT) { if (duration == Toast.LENGTH_SHORT) {
......
...@@ -79,7 +79,7 @@ object DialogHelper { ...@@ -79,7 +79,7 @@ object DialogHelper {
dialogView.findViewById<View>(R.id.toastDialogShowShortToastBtn) dialogView.findViewById<View>(R.id.toastDialogShowShortToastBtn)
.setOnClickListener { ToastUtils.showShort("Short") } .setOnClickListener { ToastUtils.showShort("Short") }
val dialog = AlertDialog.Builder(topActivity).setView(dialogView).create() val dialog = AlertDialog.Builder(topActivity).setView(dialogView).create()
dialog.setCanceledOnTouchOutside(false) // dialog.setCanceledOnTouchOutside(false)
dialog.show() dialog.show()
} }
} }
...@@ -13,19 +13,12 @@ ...@@ -13,19 +13,12 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" /> android:layout_height="wrap_content" />
<Button <CheckBox
android:id="@+id/barNavShowBtn" android:id="@+id/barNavVisibilityCb"
style="@style/WideBtnStyle" style="@style/CbStyle"
android:layout_width="match_parent" android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/bar_nav_show" />
<Button
android:id="@+id/barNavHideBtn"
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/bar_nav_hide" /> android:text="@string/bar_nav_visibility" />
<Button <Button
android:id="@+id/barNavSetColorBtn" android:id="@+id/barNavSetColorBtn"
......
...@@ -13,32 +13,18 @@ ...@@ -13,32 +13,18 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" /> android:layout_height="wrap_content" />
<Button <CheckBox
android:id="@+id/barStatusShowBtn" android:id="@+id/barStatusVisibilityCb"
style="@style/WideBtnStyle" style="@style/CbStyle"
android:layout_width="match_parent" android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/bar_status_show" />
<Button
android:id="@+id/barStatusHideBtn"
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/bar_status_hide" /> android:text="@string/bar_status_visibility" />
<Button <CheckBox
android:id="@+id/barStatusLightModeBtn" android:id="@+id/barStatusLightModeCb"
style="@style/WideBtnStyle" style="@style/CbStyle"
android:layout_width="match_parent" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/bar_status_light_mode" /> android:text="@string/bar_status_light_mode" />
<Button
android:id="@+id/barStatusDarkModeBtn"
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/bar_status_dark_mode" />
</LinearLayout> </LinearLayout>
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
style="@style/CbStyle" style="@style/CbStyle"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_margin="4dp" android:layout_margin="4dp"
android:text="@string/bar_status_title_alpha" /> android:text="@string/bar_status_title_alpha" />
...@@ -31,7 +30,6 @@ ...@@ -31,7 +30,6 @@
style="@style/CbStyle" style="@style/CbStyle"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_margin="4dp" android:layout_margin="4dp"
android:text="@string/bar_status_is_front" /> android:text="@string/bar_status_is_front" />
......
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
style="@style/CbStyle" style="@style/CbStyle"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_margin="4dp" android:layout_margin="4dp"
android:text="@string/bar_status_title_alpha" /> android:text="@string/bar_status_title_alpha" />
......
...@@ -37,8 +37,7 @@ ...@@ -37,8 +37,7 @@
style="@style/CbStyle" style="@style/CbStyle"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_margin="4dp" android:layout_margin="4dp"
android:text="@string/brightness_set_auto_brightness" /> android:text="@string/brightness_auto_brightness" />
</LinearLayout> </LinearLayout>
\ No newline at end of file
...@@ -14,11 +14,10 @@ ...@@ -14,11 +14,10 @@
android:layout_height="wrap_content" /> android:layout_height="wrap_content" />
<CheckBox <CheckBox
android:id="@+id/flashlightEnableCb" android:id="@+id/flashlightStatusCb"
style="@style/CbStyle" style="@style/CbStyle"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="@string/flashlight_status" /> android:text="@string/flashlight_status" />
</LinearLayout> </LinearLayout>
...@@ -13,75 +13,71 @@ ...@@ -13,75 +13,71 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" /> android:layout_height="wrap_content" />
<Button <CheckBox
android:id="@+id/logToggleLogBtn" android:id="@+id/logSwitchCb"
style="@style/WideBtnStyle" style="@style/CbStyle"
android:layout_width="match_parent" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/log_toggle_log" /> android:text="@string/log_switch" />
<Button <CheckBox
android:id="@+id/logToggleConsoleBtn" android:id="@+id/log2ConsoleSwitchCb"
style="@style/WideBtnStyle" style="@style/CbStyle"
android:layout_width="match_parent" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/log_toggle_console" /> android:text="@string/log_console_console" />
<Button <CheckBox
android:id="@+id/logToggleTagBtn" android:id="@+id/logGlobalTagCb"
style="@style/WideBtnStyle" style="@style/CbStyle"
android:layout_width="match_parent" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content" />
android:text="@string/log_toggle_tag" />
<Button <CheckBox
android:id="@+id/logToggleHeadBtn" android:id="@+id/logHeadSwitchCb"
style="@style/WideBtnStyle" style="@style/CbStyle"
android:layout_width="match_parent" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/log_toggle_head" /> android:text="@string/log_head_switch" />
<Button <CheckBox
android:id="@+id/logToggleFileBtn" android:id="@+id/log2FileSwitchCb"
style="@style/WideBtnStyle" style="@style/CbStyle"
android:layout_width="match_parent" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/log_toggle_file" /> android:text="@string/log_file_switch" />
<Button <CheckBox
android:id="@+id/logToggleDirBtn" android:id="@+id/logDirCb"
style="@style/WideBtnStyle" style="@style/CbStyle"
android:layout_width="match_parent" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content" />
android:text="@string/log_toggle_dir" />
<Button <CheckBox
android:id="@+id/logToggleBorderBtn" android:id="@+id/logBorderSwitchCb"
style="@style/WideBtnStyle" style="@style/CbStyle"
android:layout_width="match_parent" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/log_toggle_border" /> android:text="@string/log_border_switch" />
<Button <CheckBox
android:id="@+id/logToggleSingleBtn" android:id="@+id/logSingleTagSwitchCb"
style="@style/WideBtnStyle" style="@style/CbStyle"
android:layout_width="match_parent" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/log_toggle_single" /> android:text="@string/log_single_tag_switch" />
<Button <CheckBox
android:id="@+id/logToggleConsoleFilterBtn" android:id="@+id/logConsoleFilterCb"
style="@style/WideBtnStyle" style="@style/CbStyle"
android:layout_width="match_parent" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content" />
android:text="@string/log_toggle_console_filter" />
<Button <CheckBox
android:id="@+id/logToggleFileFilterBtn" android:id="@+id/logFileFilterCb"
style="@style/WideBtnStyle" style="@style/CbStyle"
android:layout_width="match_parent" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content" />
android:text="@string/log_toggle_file_filter" />
<Button <Button
android:id="@+id/logNoTagBtn" android:id="@+id/logNoTagBtn"
......
...@@ -20,18 +20,18 @@ ...@@ -20,18 +20,18 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/network_open_wireless_settings" /> android:text="@string/network_open_wireless_settings" />
<Button <CheckBox
android:id="@+id/btn_set_data_enabled" android:id="@+id/networkMobileDataEnabledCb"
style="@style/WideBtnStyle" style="@style/CbStyle"
android:layout_width="match_parent" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/network_set_data_enabled" /> android:text="@string/network_data_enabled" />
<Button <CheckBox
android:id="@+id/networkSetWifiEnabledBtn" android:id="@+id/networkWifiEnabledCb"
style="@style/WideBtnStyle" style="@style/CbStyle"
android:layout_width="match_parent" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/network_set_wifi_enabled" /> android:text="@string/network_wifi_enabled" />
</LinearLayout> </LinearLayout>
\ No newline at end of file
...@@ -14,17 +14,17 @@ ...@@ -14,17 +14,17 @@
android:layout_height="wrap_content" /> android:layout_height="wrap_content" />
<Button <Button
android:id="@+id/resourceTestAssetsBtn" android:id="@+id/resourceCopyFileFromAssets"
style="@style/WideBtnStyle" style="@style/WideBtnStyle"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/resource_test_assets" /> android:text="@string/resource_copy_file_from_assets_2_cache" />
<Button <Button
android:id="@+id/resourceTestRawBtn" android:id="@+id/resourceCopyFileFromRaw"
style="@style/WideBtnStyle" style="@style/WideBtnStyle"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/resource_test_raw" /> android:text="@string/resource_copy_file_from_raw_2_cache" />
</LinearLayout> </LinearLayout>
...@@ -4,19 +4,19 @@ ...@@ -4,19 +4,19 @@
<string name="demo_adapt_screen">AdaptScreenUtils Demo</string> <string name="demo_adapt_screen">AdaptScreenUtils Demo</string>
<string name="demo_app">AppUtils Demo</string> <string name="demo_app">AppUtils Demo</string>
<string name="demo_bar">BarUtils Demo</string> <string name="demo_bar">BarUtils Demo</string>
<string name="demo_brightness">Brightness Demo</string> <string name="demo_brightness">BrightnessUtils Demo</string>
<string name="demo_blur">BlurUtils Demo</string> <string name="demo_blur">BlurUtils Demo</string>
<string name="demo_clean">CleanUtils Demo</string> <string name="demo_clean">CleanUtils Demo</string>
<string name="demo_crash">CrashUtils Demo</string> <string name="demo_crash">CrashUtils Demo</string>
<string name="demo_device">DeviceUtils Demo</string> <string name="demo_device">DeviceUtils Demo</string>
<string name="demo_flashlight">Flashlight Demo</string> <string name="demo_flashlight">FlashlightUtils Demo</string>
<string name="demo_fragment">FragmentUtils Demo</string> <string name="demo_fragment">FragmentUtils Demo</string>
<string name="demo_image">ImageUtils Demo</string> <string name="demo_image">ImageUtils Demo</string>
<string name="demo_keyboard">KeyboardUtils Demo</string> <string name="demo_keyboard">KeyboardUtils Demo</string>
<string name="demo_log">LogUtils Demo</string> <string name="demo_log">LogUtils Demo</string>
<string name="demo_meta_data">MetaData Demo</string> <string name="demo_meta_data">MetaDataUtils Demo</string>
<string name="demo_network">NetworkUtils Demo</string> <string name="demo_network">NetworkUtils Demo</string>
<string name="demo_path">Path Demo</string> <string name="demo_path">PathUtils Demo</string>
<string name="demo_permission">PermissionUtils Demo</string> <string name="demo_permission">PermissionUtils Demo</string>
<string name="demo_phone">PhoneUtils Demo</string> <string name="demo_phone">PhoneUtils Demo</string>
<string name="demo_process">ProcessUtils Demo</string> <string name="demo_process">ProcessUtils Demo</string>
...@@ -24,8 +24,8 @@ ...@@ -24,8 +24,8 @@
<string name="demo_resource">ResourceUtils Demo</string> <string name="demo_resource">ResourceUtils Demo</string>
<string name="demo_screen">ScreenUtils Demo</string> <string name="demo_screen">ScreenUtils Demo</string>
<string name="demo_sdcard">SDCardUtils Demo</string> <string name="demo_sdcard">SDCardUtils Demo</string>
<string name="demo_snackbar">Snackbar Demo</string> <string name="demo_snackbar">SnackbarUtils Demo</string>
<string name="demo_spStatic">SPStatic Demo</string> <string name="demo_spStatic">SPStaticUtils Demo</string>
<string name="demo_span">SpanUtils Demo</string> <string name="demo_span">SpanUtils Demo</string>
<string name="demo_toast">ToastUtils Demo</string> <string name="demo_toast">ToastUtils Demo</string>
<string name="demo_vibrate">VibrateUtils Demo</string> <string name="demo_vibrate">VibrateUtils Demo</string>
...@@ -84,10 +84,8 @@ ...@@ -84,10 +84,8 @@
<string name="bar_about_notification_bar">About Notification Bar</string> <string name="bar_about_notification_bar">About Notification Bar</string>
<string name="bar_status_about">About Status</string> <string name="bar_status_about">About Status</string>
<string name="bar_status_show">Show Status</string> <string name="bar_status_visibility">Status Visibility</string>
<string name="bar_status_hide">Hide Status</string> <string name="bar_status_light_mode">Light Mode</string>
<string name="bar_status_light_mode">Light Mode Status</string>
<string name="bar_status_dark_mode">Dark Mode Status</string>
<string name="bar_status_set_color">Set Color</string> <string name="bar_status_set_color">Set Color</string>
<string name="bar_status_set_alpha">Set Alpha</string> <string name="bar_status_set_alpha">Set Alpha</string>
<string name="bar_status_set_image_view">Set Image View</string> <string name="bar_status_set_image_view">Set Image View</string>
...@@ -107,13 +105,11 @@ ...@@ -107,13 +105,11 @@
<string name="bar_notification_show">Show Notification And Hide After 2s</string> <string name="bar_notification_show">Show Notification And Hide After 2s</string>
<string name="bar_nav_about">About Nav</string> <string name="bar_nav_about">About Nav</string>
<string name="bar_nav_show">Show Nav</string> <string name="bar_nav_visibility">Nav Visibility</string>
<string name="bar_nav_hide">Hide Nav</string>
<string name="bar_nav_immersive">Immersive Nav</string>
<string name="bar_nav_color">Set Nav Color Random</string> <string name="bar_nav_color">Set Nav Color Random</string>
<!-- Brightness 相关 --> <!-- Brightness 相关 -->
<string name="brightness_set_auto_brightness">Set Auto Brightness</string> <string name="brightness_auto_brightness">Auto Brightness</string>
<!--Clean 相关--> <!--Clean 相关-->
<string name="clean_internal_cache">Clean Internal Cache</string> <string name="clean_internal_cache">Clean Internal Cache</string>
...@@ -177,8 +173,8 @@ ...@@ -177,8 +173,8 @@
<!--Network 相关--> <!--Network 相关-->
<string name="network_open_wireless_settings">Open Wireless Settings</string> <string name="network_open_wireless_settings">Open Wireless Settings</string>
<string name="network_set_data_enabled">Set Data Enabled</string> <string name="network_data_enabled">Mobile Data Enabled</string>
<string name="network_set_wifi_enabled">Set Wifi Enabled</string> <string name="network_wifi_enabled">Wifi Enabled</string>
<!--Keyboard 相关--> <!--Keyboard 相关-->
<string name="keyboard_hide_soft_input">Hide Soft Input</string> <string name="keyboard_hide_soft_input">Hide Soft Input</string>
...@@ -188,16 +184,12 @@ ...@@ -188,16 +184,12 @@
<string name="keyboard_close_dialog">Close Dialog</string> <string name="keyboard_close_dialog">Close Dialog</string>
<!--log 相关--> <!--log 相关-->
<string name="log_toggle_log">Toggle Log</string> <string name="log_switch">Log Switch</string>
<string name="log_toggle_console">Toggle Console</string> <string name="log_console_console">Console Switch</string>
<string name="log_toggle_tag">Toggle Tag</string> <string name="log_head_switch">Head Switch</string>
<string name="log_toggle_head">Toggle Head</string> <string name="log_file_switch">File Switch</string>
<string name="log_toggle_border">Toggle Border</string> <string name="log_border_switch">Border Switch</string>
<string name="log_toggle_single">Toggle Single</string> <string name="log_single_tag_switch">Single Tag Switch</string>
<string name="log_toggle_console_filter">Toggle Console Filter</string>
<string name="log_toggle_file_filter">Toggle File Filter</string>
<string name="log_toggle_file">Toggle File</string>
<string name="log_toggle_dir">Toggle Dir</string>
<string name="log_with_no_tag">Log With No Tag</string> <string name="log_with_no_tag">Log With No Tag</string>
<string name="log_with_tag">Log With Tag</string> <string name="log_with_tag">Log With Tag</string>
<string name="log_in_new_thread">Log In New Thread</string> <string name="log_in_new_thread">Log In New Thread</string>
...@@ -233,8 +225,8 @@ ...@@ -233,8 +225,8 @@
<string name="process_kill_all_background">Kill All Background Processes</string> <string name="process_kill_all_background">Kill All Background Processes</string>
<!--Resource 相关--> <!--Resource 相关-->
<string name="resource_test_assets">Test Assets</string> <string name="resource_copy_file_from_assets_2_cache">Copy File From Assets to Cache</string>
<string name="resource_test_raw">Test Raw</string> <string name="resource_copy_file_from_raw_2_cache">Copy File From Raw to Cache</string>
<!--Screen 相关--> <!--Screen 相关-->
<string name="screen_set_fullscreen">Set Fullscreen</string> <string name="screen_set_fullscreen">Set Fullscreen</string>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册