Skip to content

Commit

Permalink
1.完善部分工具类代码注释、以及部分返回值等。
Browse files Browse the repository at this point in the history
2.更新新的 api MarkDown 文档


Former-commit-id: 54856b1
  • Loading branch information
Ttt committed Oct 24, 2018
1 parent 7a1dda4 commit 7631a27
Show file tree
Hide file tree
Showing 24 changed files with 65 additions and 63 deletions.
2 changes: 1 addition & 1 deletion DevLibUtils/README.md.REMOVED.git-id
Original file line number Diff line number Diff line change
@@ -1 +1 @@
188350dfe58874ffa018c8c0b5df3df71b25a66d
818f8b9669c5b84ce9097dfdecfd5cb2dcf1f3af
2 changes: 1 addition & 1 deletion DevLibUtils/src/main/java/dev/utils/app/ActivityUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public static void startHomeActivity() {
}

/**
* 获取 launcher activity
* 获取 Launcher activity
* @return
*/
public static String getLauncherActivity() {
Expand Down
6 changes: 3 additions & 3 deletions DevLibUtils/src/main/java/dev/utils/app/AppUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -375,11 +375,11 @@ public static int getAppVersionCode(final String packageName) {
*/
public static void setLanguage(Locale locale) {
try {
// 获得res资源对象
// 获取res资源对象
Resources resources = DevUtils.getContext().getResources();
// 获得设置对象
// 获取设置对象
Configuration config = resources.getConfiguration();
// 获得屏幕参数:主要是分辨率,像素等。
// 获取屏幕参数:主要是分辨率,像素等。
DisplayMetrics dm = resources.getDisplayMetrics();
// 语言
config.locale = locale;
Expand Down
8 changes: 4 additions & 4 deletions DevLibUtils/src/main/java/dev/utils/app/EncodeUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ private EncodeUtils() {
private static final String TAG = EncodeUtils.class.getSimpleName();

/**
* url编码 - UTF-8
* url 编码 - UTF-8
* @param input The input.
* @return the urlencoded string
*/
Expand All @@ -31,7 +31,7 @@ public static String urlEncode(final String input) {
}

/**
* url编码
* url 编码
* @param input The input.
* @param charsetName The name of charset.
* @return the urlencoded string
Expand Down Expand Up @@ -139,7 +139,7 @@ public static String base64DecodeToString(final byte[] input) {
}

/**
* html编码
* html 编码
* @param input The input.
* @return html-encode string
*/
Expand Down Expand Up @@ -177,7 +177,7 @@ public static String htmlEncode(final CharSequence input) {
}

/**
* html解码
* html 解码
* @param input The input.
* @return the string of decode html-encode string
*/
Expand Down
4 changes: 2 additions & 2 deletions DevLibUtils/src/main/java/dev/utils/app/KeyBoardUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -490,9 +490,9 @@ public void onGlobalLayout() {
decorView.getWindowVisibleDisplayFrame(rect);
// 计算出可见屏幕的高度
int displayHight = rect.bottom - rect.top;
// 获得屏幕整体的高度
// 获取屏幕整体的高度
int hight = decorView.getHeight();
// 获得键盘高度
// 获取键盘高度
int keyboardHeight = hight - displayHight;
// 计算一定比例
boolean visible = (double) displayHight / hight < 0.8;
Expand Down
2 changes: 1 addition & 1 deletion DevLibUtils/src/main/java/dev/utils/app/LocationUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public static boolean register(long minTime, long minDistance, OnLocationChangeL
}

/**
* 注销
* 注销监听
*/
@SuppressLint("MissingPermission")
public static void unregister() {
Expand Down
2 changes: 1 addition & 1 deletion DevLibUtils/src/main/java/dev/utils/app/MemoryUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ public static String getMemInfoIype(String type) {
/* \\s表示 空格,回车,换行等空白符,
+号表示一个或多个的意思 */
String[] array = str.split("\\s+");
// 获得系统总内存,单位是KB,乘以1024转换为Byte
// 获取系统总内存,单位是KB,乘以1024转换为Byte
long length = Long.valueOf(array[1]).longValue() * 1024;
return android.text.format.Formatter.formatFileSize(DevUtils.getContext(), length);
} catch (Exception e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,8 +264,8 @@ public static LightPattern obtain(int argb, int startOffMS, int durationMS) {
*/
public static class VibratePattern {
/**
* vibrate 属性是一个长整型的数组,用于设置手机静止和振动的时长,以毫秒为单位。
* 参数中下标为0的值表示手机静止的时长,下标为1的值表示手机振动的时长, 下标为2的值又表示手机静止的时长,以此类推。
* vibrate 属性是一个长整型的数组,用于设置手机静止和震动的时长,以毫秒为单位。
* 参数中下标为0的值表示手机静止的时长,下标为1的值表示手机震动的时长, 下标为2的值又表示手机静止的时长,以此类推。
*/
// long[] vibrates = { 0, 1000, 1000, 1000 };
private long[] vibrates = null;
Expand Down
2 changes: 1 addition & 1 deletion DevLibUtils/src/main/java/dev/utils/app/ProcessUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public static String getProcessName(int pid) {
}

/**
* 获得当前进程的名字
* 获取当前进程的名字
* hit: 获取当前进程 DevUtils.getContext().getApplicationInfo().packageName
* @return 进程号
*/
Expand Down
26 changes: 13 additions & 13 deletions DevLibUtils/src/main/java/dev/utils/app/ResourceUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ private ResourceUtils() {
public static final String ATTR = "attr";

/**
* 获得字符串
* 获取字符串
* @param strId 字符串id
* @return 字符串
*/
Expand All @@ -62,7 +62,7 @@ public static String getString(int strId) {
}

/**
* 获得颜色
* 获取 Color
* @param colorId 颜色id
* @return 颜色
*/
Expand All @@ -76,7 +76,7 @@ public static int getColor(int colorId) {
}

/**
* 获得Drawable
* 获取 Drawable
* @param drawableId Drawable的id
* @return Drawable
*/
Expand All @@ -90,7 +90,7 @@ public static Drawable getDrawable(int drawableId) {
}

/**
* 根据资源名获得资源id
* 根据资源名获取资源id
* @param name 资源名
* @param type 资源类型
* @return 资源id,找不到返回0
Expand All @@ -107,7 +107,7 @@ public static int getResourceId(String name, String type) {
}

/**
* 获取资源id
* 获取 drawable id
* @param imageName
* @return
*/
Expand All @@ -129,7 +129,7 @@ public static int getDrawableId2(String imageName){
// ==

/**
* 获取 layout 布局文件
* 获取 layout 布局文件 id
* @param resName layout xml 的文件名
* @return layout
*/
Expand All @@ -143,7 +143,7 @@ public static int getLayoutId(String resName) {
}

/**
* 获取 string
* 获取 string id
* @param resName string name的名称
* @return string
*/
Expand All @@ -157,7 +157,7 @@ public static int getStringId(String resName) {
}

/**
* 获取 drawable
* 获取 drawable id
* @param resName drawable 的名称
* @return drawable
*/
Expand All @@ -171,7 +171,7 @@ public static int getDrawableId(String resName) {
}

/**
* 获取 mipmap
* 获取 mipmap id
* @param resName
* @return
*/
Expand All @@ -186,7 +186,7 @@ public static int getMipmapId(String resName) {


/**
* 获取 style
* 获取 style id
* @param resName style的名称
* @return style
*/
Expand All @@ -200,7 +200,7 @@ public static int getStyleId(String resName) {
}

/**
* 获取 styleable
* 获取 styleable id
* @param resName styleable 的名称
* @return styleable
*/
Expand All @@ -215,7 +215,7 @@ public static Object getStyleableId(String resName){


/**
* 获取 anim
* 获取 anim id
* @param resName anim xml 文件名称
* @return anim
*/
Expand Down Expand Up @@ -243,7 +243,7 @@ public static int getId(String resName) {
}

/**
* 获取 Color id
* 获取 color id
* @param resName color 名称
* @return
*/
Expand Down
8 changes: 4 additions & 4 deletions DevLibUtils/src/main/java/dev/utils/app/SDCardUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ public static long[] getBlockSizeInfos(String path) {
}

/**
* 获得 SD 卡总大小
* 获取 SD 卡总大小
* @return
*/
public static String getSDTotalSize() {
Expand All @@ -228,7 +228,7 @@ public static String getSDTotalSize() {
}

/**
* 获得 SD 卡剩余容量,即可用大小
* 获取 SD 卡剩余容量,即可用大小
* @return
*/
public static String getSDAvailableSize() {
Expand All @@ -245,7 +245,7 @@ public static String getSDAvailableSize() {
}

/**
* 获得机身内存总大小
* 获取机身内存总大小
* @return
*/
public static String getRomTotalSize() {
Expand All @@ -262,7 +262,7 @@ public static String getRomTotalSize() {
}

/**
* 获得机身可用内存
* 获取机身可用内存
* @return
*/
public static String getRomAvailableSize() {
Expand Down
2 changes: 1 addition & 1 deletion DevLibUtils/src/main/java/dev/utils/app/ScreenUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,7 @@ public static boolean isTablet() {
// == ----------------------------------------- ==

/**
* 获得状态栏的高度(无关 android:theme 获取状态栏高度)
* 获取状态栏的高度(无关 android:theme 获取状态栏高度)
* @return
*/
public static int getStatusHeight() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ private StateListUtils() {
// android:state_middle 是否处于中间
// android:state_pressed 是否处于按下状态 .
// android:state_selected 是否处于选中状态
// android:state_window_focused 是否窗口已获得焦点
// android:state_window_focused 是否窗口已获取焦点

/**
* 通过 Context 获取 ColorStateList
Expand Down
10 changes: 5 additions & 5 deletions DevLibUtils/src/main/java/dev/utils/app/VibrationUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ private VibrationUtils() {
* 震动
* <uses-permission android:name="android.permission.VIBRATE" />
* @param context
* @param milliseconds 振动时长
* @param milliseconds 震动时长
*/
public static void vibrate(final Context context, final long milliseconds) {
try {
Expand All @@ -33,10 +33,10 @@ public static void vibrate(final Context context, final long milliseconds) {
}

/**
* 指定手机以pattern模式振动
* 指定手机以pattern模式震动
* @param context
* @param pattern new long[]{400,800,1200,1600},就是指定在 400ms、800ms、1200ms、1600ms 这些时间点交替启动、关闭手机振动器
* @param repeat 指定pattern数组的索引,指定pattern数组中从repeat索引开始的振动进行循环。-1表示只振动一次,非-1表示从 pattern的指定下标开始重复振动
* @param pattern new long[]{400,800,1200,1600},就是指定在 400ms、800ms、1200ms、1600ms 这些时间点交替启动、关闭手机震动器
* @param repeat 指定pattern数组的索引,指定pattern数组中从repeat索引开始的震动进行循环。-1表示只震动一次,非-1表示从 pattern的指定下标开始重复震动
*/
public static void vibrate(final Context context, final long[] pattern, final int repeat) {
try {
Expand All @@ -48,7 +48,7 @@ public static void vibrate(final Context context, final long[] pattern, final in
}

/**
* 取消振动
* 取消震动
* @param context
*/
public static void cancel(final Context context) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ public BeepVibrateAssist setMediaPlayer(MediaPlayer mediaPlayer) {
}

/**
* 进行播放声音, 并且振动
* 进行播放声音, 并且震动
*/
public synchronized void playBeepSoundAndVibrate() {
// 判断是否允许播放
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ public static Bitmap zoom(Bitmap bitmap, int w, int h) {
}

/**
* 获得圆角图片的方法
* 获取圆角图片的方法
* @param bitmap 源Bitmap
* @param roundPx 圆角大小
* @return 期望Bitmap
Expand All @@ -271,7 +271,7 @@ public static Bitmap getRoundedCornerBitmap(Bitmap bitmap, float roundPx) {
}

/**
* 获得带倒影的图片方法
* 获取带倒影的图片方法
* @param bitmap 源Bitmap
* @return 带倒影的Bitmap
*/
Expand Down Expand Up @@ -520,7 +520,7 @@ public static Bitmap codec(Bitmap src, Bitmap.CompressFormat format, int quality
* @param maxSize 压缩后的大小,单位kb
*/
public static void compress(Bitmap bitmap, double maxSize) {
// 将bitmap放至数组中,意在获得bitmap的大小(与实际读取的原文件要大)
// 将bitmap放至数组中,意在获取bitmap的大小(与实际读取的原文件要大)
ByteArrayOutputStream baos = new ByteArrayOutputStream();
// 格式、质量、输出流
bitmap.compress(Bitmap.CompressFormat.PNG, 70, baos);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ public static void printApkPermission(String pckName){
// 通过usesPermissionName获取该权限的详细信息
PermissionInfo permissionInfo = packageManager.getPermissionInfo(usesPermissionName, 0);

// 获得该权限属于哪个权限组,如:网络通信
// 获取该权限属于哪个权限组,如:网络通信
PermissionGroupInfo permissionGroupInfo = packageManager.getPermissionGroupInfo(permissionInfo.group, 0);
LogPrintUtils.dTag(TAG, "permissionGroup = " + permissionGroupInfo.loadLabel(packageManager).toString());

Expand Down
Loading

0 comments on commit 7631a27

Please sign in to comment.