Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
mmm-rain
AndroidUtilCode
提交
07925ad2
A
AndroidUtilCode
项目概览
mmm-rain
/
AndroidUtilCode
与 Fork 源项目一致
从无法访问的项目Fork
通知
4
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
A
AndroidUtilCode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
07925ad2
编写于
8月 09, 2018
作者:
B
Blankj
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
see 08/09 log
上级
205943d3
变更
13
隐藏空白更改
内联
并排
Showing
13 changed file
with
45 addition
and
34 deletion
+45
-34
README-CN.md
README-CN.md
+1
-1
README.md
README.md
+1
-1
apk/output.json
apk/output.json
+1
-1
apk/util_1_18_6.apk
apk/util_1_18_6.apk
+0
-0
app/src/main/java/com/blankj/androidutilcode/UtilsApp.java
app/src/main/java/com/blankj/androidutilcode/UtilsApp.java
+1
-1
app/src/main/java/com/blankj/androidutilcode/feature/core/toast/ToastActivity.java
...nkj/androidutilcode/feature/core/toast/ToastActivity.java
+1
-0
config.gradle
config.gradle
+3
-3
update_log.md
update_log.md
+1
-0
utilcode/README-CN.md
utilcode/README-CN.md
+2
-1
utilcode/README.md
utilcode/README.md
+2
-1
utilcode/src/main/java/com/blankj/utilcode/util/IntentUtils.java
...e/src/main/java/com/blankj/utilcode/util/IntentUtils.java
+10
-0
utilcode/src/main/java/com/blankj/utilcode/util/ScreenUtils.java
...e/src/main/java/com/blankj/utilcode/util/ScreenUtils.java
+2
-0
utilcode/src/main/java/com/blankj/utilcode/util/ToastUtils.java
...de/src/main/java/com/blankj/utilcode/util/ToastUtils.java
+20
-25
未找到文件。
README-CN.md
浏览文件 @
07925ad2
...
...
@@ -41,7 +41,7 @@
[
logo
]:
https://raw.githubusercontent.com/Blankj/AndroidUtilCode/master/art/logo.png
[
aucsvg
]:
https://img.shields.io/badge/AndroidUtilCode-v1.18.
5
-brightgreen.svg
[
aucsvg
]:
https://img.shields.io/badge/AndroidUtilCode-v1.18.
6
-brightgreen.svg
[
auc
]:
https://github.com/Blankj/AndroidUtilCode
[
apisvg
]:
https://img.shields.io/badge/API-14+-brightgreen.svg
...
...
README.md
浏览文件 @
07925ad2
...
...
@@ -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
[
aucsvg
]:
https://img.shields.io/badge/AndroidUtilCode-v1.18.
5
-brightgreen.svg
[
aucsvg
]:
https://img.shields.io/badge/AndroidUtilCode-v1.18.
6
-brightgreen.svg
[
auc
]:
https://github.com/Blankj/AndroidUtilCode
[
apisvg
]:
https://img.shields.io/badge/API-14+-brightgreen.svg
...
...
apk/output.json
浏览文件 @
07925ad2
[{
"outputType"
:{
"type"
:
"APK"
},
"apkInfo"
:{
"type"
:
"MAIN"
,
"splits"
:[],
"versionCode"
:
1018005
,
"versionName"
:
"1.18.5"
,
"enabled"
:
true
,
"outputFile"
:
"util_1_18_5.apk"
,
"fullName"
:
"release"
,
"baseName"
:
"release"
},
"path"
:
"util_1_18_5.apk"
,
"properties"
:{}}]
\ No newline at end of file
[{
"outputType"
:{
"type"
:
"APK"
},
"apkInfo"
:{
"type"
:
"MAIN"
,
"splits"
:[],
"versionCode"
:
1018006
,
"versionName"
:
"1.18.6"
,
"enabled"
:
true
,
"outputFile"
:
"util_1_18_6.apk"
,
"fullName"
:
"release"
,
"baseName"
:
"release"
},
"path"
:
"util_1_18_6.apk"
,
"properties"
:{}}]
\ No newline at end of file
apk/util_1_18_
5
.apk
→
apk/util_1_18_
6
.apk
浏览文件 @
07925ad2
无法预览此类型文件
app/src/main/java/com/blankj/androidutilcode/UtilsApp.java
浏览文件 @
07925ad2
...
...
@@ -63,7 +63,7 @@ public class UtilsApp extends BaseApplication {
.
setLogHeadSwitch
(
true
)
// 设置 log 头信息开关,默认为开
.
setLog2FileSwitch
(
false
)
// 打印 log 时是否存到文件的开关,默认关
.
setDir
(
""
)
// 当自定义路径为空时,写入应用的/cache/log/目录中
.
setFilePrefix
(
""
)
// 当文件前缀为空时,默认为"util",即写入文件为"util-MM-dd.txt"
.
setFilePrefix
(
""
)
// 当文件前缀为空时,默认为"util",即写入文件为"util-
yyyy-
MM-dd.txt"
.
setBorderSwitch
(
true
)
// 输出日志是否带边框开关,默认开
.
setSingleTagSwitch
(
true
)
// 一条日志仅输出一条,默认开,为美化 AS 3.1 的 Logcat
.
setConsoleFilter
(
LogUtils
.
V
)
// log 的控制台过滤器,和 logcat 过滤器同理,默认 Verbose
...
...
app/src/main/java/com/blankj/androidutilcode/feature/core/toast/ToastActivity.java
浏览文件 @
07925ad2
...
...
@@ -8,6 +8,7 @@ import android.support.annotation.Nullable;
import
android.support.v4.content.ContextCompat
;
import
android.view.Gravity
;
import
android.view.View
;
import
android.widget.Toast
;
import
com.blankj.androidutilcode.R
;
import
com.blankj.androidutilcode.base.BaseBackActivity
;
...
...
config.gradle
浏览文件 @
07925ad2
...
...
@@ -6,8 +6,8 @@ ext {
compileSdkVersion:
27
,
minSdkVersion
:
14
,
targetSdkVersion
:
27
,
versionCode
:
1
_018_00
5
,
versionName
:
'1.18.
5
'
// E.g 1.9.72 => 1,009,072
versionCode
:
1
_018_00
6
,
versionName
:
'1.18.
6
'
// E.g 1.9.72 => 1,009,072
]
versionConfig
=
[
...
...
@@ -167,7 +167,7 @@ def configAppDependencies(Project pro) {
// LeakCanary
debugImplementation
depConfig
.
leakcanary
.
android
releaseImplementation
depConfig
.
leakcanary
.
android_no_op
// implementation 'com.blankj:utilcode:1.18.
5
'
// implementation 'com.blankj:utilcode:1.18.
6
'
}
}
...
...
update_log.md
浏览文件 @
07925ad2
*
18/08/09 新增 IntentUtils#isIntentAvailable,ToastUtils 传入空显示 null,发布 1.18.6
*
18/08/08 修复 ScreenUtils#adaptxx 在第三方 SDK 会出现的问题,发布 1.18.5
*
18/08/07 修复 ScreenUtils#adaptxx 在 API 26 以下无效的 bug,发布 1.18.4
*
18/08/06 修复 ScreenUtils#screenShot 中 decorView.getDrawingCache() 为空的问题,发布 1.18.3
...
...
utilcode/README-CN.md
浏览文件 @
07925ad2
...
...
@@ -2,7 +2,7 @@
Gradle:
```
groovy
implementation
'com.blankj:utilcode:1.18.
5
'
implementation
'com.blankj:utilcode:1.18.
6
'
```
...
...
@@ -347,6 +347,7 @@ compressBySampleSize : 按采样大小压缩
*
### 意图相关 ->
[
IntentUtils.java
][
intent.java
]
```
isIntentAvailable : 判断意图是否可用
getInstallAppIntent : 获取安装 App(支持 6.0)的意图
getUninstallAppIntent : 获取卸载 App 的意图
getLaunchAppIntent : 获取打开 App 的意图
...
...
utilcode/README.md
浏览文件 @
07925ad2
...
...
@@ -2,7 +2,7 @@
Gradle:
```
groovy
implementation
'com.blankj:utilcode:1.18.
5
'
implementation
'com.blankj:utilcode:1.18.
6
'
```
...
...
@@ -347,6 +347,7 @@ compressBySampleSize
*
### About Intent ->
[
IntentUtils.java
][
intent.java
]
```
isIntentAvailable
getInstallAppIntent
getUninstallAppIntent
getLaunchAppIntent
...
...
utilcode/src/main/java/com/blankj/utilcode/util/IntentUtils.java
浏览文件 @
07925ad2
...
...
@@ -30,6 +30,16 @@ public final class IntentUtils {
throw
new
UnsupportedOperationException
(
"u can't instantiate me..."
);
}
/**
* Return whether the intent is available.
*
* @param intent The intent.
* @return {@code true}: yes<br>{@code false}: no
*/
public
static
boolean
isIntentAvailable
(
final
Intent
intent
)
{
return
Utils
.
getApp
().
getPackageManager
().
queryIntentActivities
(
intent
,
0
).
size
()
>
0
;
}
/**
* Return the intent of install app.
* <p>Target APIs greater than 25 must hold
...
...
utilcode/src/main/java/com/blankj/utilcode/util/ScreenUtils.java
浏览文件 @
07925ad2
...
...
@@ -302,6 +302,7 @@ public final class ScreenUtils {
/**
* Adapt the screen for vertical slide.
*
* @param activity The activity.
* @param designWidthInPx The size of design diagram's width, in pixel.
*/
public
static
void
adaptScreen4VerticalSlide
(
final
Activity
activity
,
...
...
@@ -312,6 +313,7 @@ public final class ScreenUtils {
/**
* Adapt the screen for horizontal slide.
*
* @param activity The activity.
* @param designHeightInPx The size of design diagram's height, in pixel.
*/
public
static
void
adaptScreen4HorizontalSlide
(
final
Activity
activity
,
...
...
utilcode/src/main/java/com/blankj/utilcode/util/ToastUtils.java
浏览文件 @
07925ad2
...
...
@@ -39,6 +39,7 @@ public final class ToastUtils {
private
static
final
int
COLOR_DEFAULT
=
0xFEFFFFFF
;
private
static
final
Handler
HANDLER
=
new
Handler
(
Looper
.
getMainLooper
());
private
static
final
String
NULL
=
"null"
;
private
static
Toast
sToast
;
private
static
int
sGravity
=
-
1
;
...
...
@@ -107,8 +108,8 @@ public final class ToastUtils {
*
* @param text The text.
*/
public
static
void
showShort
(
@NonNull
final
CharSequence
text
)
{
show
(
text
,
Toast
.
LENGTH_SHORT
);
public
static
void
showShort
(
final
CharSequence
text
)
{
show
(
text
==
null
?
NULL
:
text
,
Toast
.
LENGTH_SHORT
);
}
/**
...
...
@@ -127,11 +128,7 @@ public final class ToastUtils {
* @param args The args.
*/
public
static
void
showShort
(
@StringRes
final
int
resId
,
final
Object
...
args
)
{
if
(
args
!=
null
&&
args
.
length
==
0
)
{
show
(
resId
,
Toast
.
LENGTH_SHORT
);
}
else
{
show
(
resId
,
Toast
.
LENGTH_SHORT
,
args
);
}
show
(
resId
,
Toast
.
LENGTH_SHORT
,
args
);
}
/**
...
...
@@ -141,11 +138,7 @@ public final class ToastUtils {
* @param args The args.
*/
public
static
void
showShort
(
final
String
format
,
final
Object
...
args
)
{
if
(
args
!=
null
&&
args
.
length
==
0
)
{
show
(
format
,
Toast
.
LENGTH_SHORT
);
}
else
{
show
(
format
,
Toast
.
LENGTH_SHORT
,
args
);
}
show
(
format
,
Toast
.
LENGTH_SHORT
,
args
);
}
/**
...
...
@@ -153,8 +146,8 @@ public final class ToastUtils {
*
* @param text The text.
*/
public
static
void
showLong
(
@NonNull
final
CharSequence
text
)
{
show
(
text
,
Toast
.
LENGTH_LONG
);
public
static
void
showLong
(
final
CharSequence
text
)
{
show
(
text
==
null
?
NULL
:
text
,
Toast
.
LENGTH_LONG
);
}
/**
...
...
@@ -173,11 +166,7 @@ public final class ToastUtils {
* @param args The args.
*/
public
static
void
showLong
(
@StringRes
final
int
resId
,
final
Object
...
args
)
{
if
(
args
!=
null
&&
args
.
length
==
0
)
{
show
(
resId
,
Toast
.
LENGTH_SHORT
);
}
else
{
show
(
resId
,
Toast
.
LENGTH_LONG
,
args
);
}
show
(
resId
,
Toast
.
LENGTH_LONG
,
args
);
}
/**
...
...
@@ -187,11 +176,7 @@ public final class ToastUtils {
* @param args The args.
*/
public
static
void
showLong
(
final
String
format
,
final
Object
...
args
)
{
if
(
args
!=
null
&&
args
.
length
==
0
)
{
show
(
format
,
Toast
.
LENGTH_SHORT
);
}
else
{
show
(
format
,
Toast
.
LENGTH_LONG
,
args
);
}
show
(
format
,
Toast
.
LENGTH_LONG
,
args
);
}
/**
...
...
@@ -234,7 +219,16 @@ public final class ToastUtils {
}
private
static
void
show
(
final
String
format
,
final
int
duration
,
final
Object
...
args
)
{
show
(
String
.
format
(
format
,
args
),
duration
);
String
text
;
if
(
format
==
null
)
{
text
=
NULL
;
}
else
{
text
=
String
.
format
(
format
,
args
);
if
(
text
==
null
)
{
text
=
NULL
;
}
}
show
(
text
,
duration
);
}
private
static
void
show
(
final
CharSequence
text
,
final
int
duration
)
{
...
...
@@ -280,6 +274,7 @@ public final class ToastUtils {
private
static
void
showToast
()
{
if
(
Build
.
VERSION
.
SDK_INT
==
Build
.
VERSION_CODES
.
N_MR1
)
{
try
{
//noinspection JavaReflectionMemberAccess
Field
field
=
View
.
class
.
getDeclaredField
(
"mContext"
);
field
.
setAccessible
(
true
);
field
.
set
(
sToast
.
getView
(),
new
ApplicationContextWrapperForApi25
());
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录