Skip to content

Commit

Permalink
see 11/16 log
Browse files Browse the repository at this point in the history
  • Loading branch information
Blankj committed Nov 16, 2016
1 parent 6fbe083 commit f763655
Show file tree
Hide file tree
Showing 13 changed files with 544 additions and 223 deletions.
54 changes: 32 additions & 22 deletions README-CN.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
## Android开发人员不得不收集的代码([持续更新中][update_log.md])
**[README of English][readme.md][一键生成英文版README函数][trans]**
**[README of English][readme.md]**
***
为方便查找,已进行大致归类,其目录如下所示:
> - **Activity相关→[ActivityUtils.java][activity.java]**
```
isActivityExists : 判断是否存在Activity
launchActivity : 打开Activity
getLauncherActivity : 获取launcheractivity
getLauncherActivity : 获取入口activity
```

> - **App相关→[AppUtils.java][app.java]**
Expand Down Expand Up @@ -283,10 +283,10 @@ getDomainAddress : 获取域名ip地址
> - **手机相关→[PhoneUtils.java][phone.java]**
```
isPhone : 判断设备是否是手机
getIMEI : 获取IMIE码
getIMEI : 获取IMEI码
getIMSI : 获取IMSI码
getPhoneType : 获取移动终端类型
isSimCardReady : 判断是否存在sim卡
isSimCardReady : 判断sim卡是否准备好
getSimOperatorName, getSimOperatorByMnc : 获取Sim卡运营商名称
getPhoneStatus : 获取手机状态信息
dial : 跳至拨号界面
Expand All @@ -298,26 +298,36 @@ getContactNum : 打开手机联系人界面点击联
getAllSMS : 获取手机短信并保存到xml中
```

> - **拼音相关→[PinyinUtils.java][pinyin.java][Test][pinyin.test]**
```
getPinyinFirstLetter : 获取第一个汉字首字母
ccs2Pinyin : 汉字转拼音
```

> - **进程相关→[ProcessUtils.java][process.java]**
```
getForegroundProcessName : 获取前台线程包名
cleanAllBackgroundProcessescleanBackgroundProcesses : 清理后台服务进程
getForegroundProcessName : 获取前台线程包名
cleanAllBackgroundProcesses, cleanBackgroundProcesses : 清理后台服务进程
```

> - **正则相关→[RegexUtils.java][regex.java][Test][regex.test]**
```
isMobileSimple : 验证手机号(简单)
isMobileExact : 验证手机号(精确)
isTel : 验证电话号码
isIDCard15 : 验证身份证号码15位
isIDCard18 : 验证身份证号码18位
isEmail : 验证邮箱
isURL : 验证URL
isChz : 验证汉字
isUsername : 验证用户名
isDate : 验证yyyy-MM-dd格式的日期校验,已考虑平闰年
isIP : 验证IP地址
isMatch : string是否匹配regex
isMobileSimple : 验证手机号(简单)
isMobileExact : 验证手机号(精确)
isTel : 验证电话号码
isIDCard15 : 验证身份证号码15位
isIDCard18 : 验证身份证号码18位
isEmail : 验证邮箱
isURL : 验证URL
isZh : 验证汉字
isUsername : 验证用户名
isDate : 验证yyyy-MM-dd格式的日期校验,已考虑平闰年
isIP : 验证IP地址
isMatch : 判断是否匹配正则
getMatches : 获取正则匹配的部分
getSplits : 获取正则匹配分组
getReplaceFirst : 替换正则匹配的第一部分
getReplaceAll : 替换所有正则匹配的部分
```

> - **屏幕相关→[ScreenUtils.java][screen.java]**
Expand Down Expand Up @@ -397,15 +407,14 @@ clear : SP中清除所有数据
isEmpty : 判断字符串是否为null或长度为0
isSpace : 判断字符串是否为null或全为空格
equals : 判断两字符串是否相等
equalsIgnoreCase : 判断两字符串忽略大小写是否相等
null2Length0 : null转为长度为0的字符串
length : 返回字符串长度
upperFirstLetter : 首字母大写
lowerFirstLetter : 首字母小写
reverse : 反转字符串
toDBC : 转化为半角字符
toSBC : 转化为全角字符
getPYFirstLetter : 获得第一个汉字首字母
cn2PY : 中文转拼音
```

> - **线程池相关→[ThreadPoolUtils.java][thread_pool.java]**
Expand Down Expand Up @@ -510,8 +519,6 @@ limitations under the License.
[readme.md]: https://github.com/Blankj/AndroidUtilCode
[readme-cn.md]: https://github.com/Blankj/AndroidUtilCode/blob/master/README-CN.md

[trans]: https://github.com/Blankj/AndroidUtilCode/blob/master/utilcode/src/test/java/com/blankj/utilcode/utils/TestUtils.java

[activity.java]: https://github.com/Blankj/AndroidUtilCode/blob/master/utilcode/src/main/java/com/blankj/utilcode/utils/ActivityUtils.java

[app.java]: https://github.com/Blankj/AndroidUtilCode/blob/master/utilcode/src/main/java/com/blankj/utilcode/utils/AppUtils.java
Expand Down Expand Up @@ -558,6 +565,9 @@ limitations under the License.

[phone.java]: https://github.com/Blankj/AndroidUtilCode/blob/master/utilcode/src/main/java/com/blankj/utilcode/utils/PhoneUtils.java

[pinyin.java]: https://github.com/Blankj/AndroidUtilCode/blob/master/utilcode/src/main/java/com/blankj/utilcode/utils/PinyinUtils.java
[pinyin.test]: https://github.com/Blankj/AndroidUtilCode/blob/master/utilcode/src/test/java/com/blankj/utilcode/utils/PinyinUtilsTest.java

[process.java]: https://github.com/Blankj/AndroidUtilCode/blob/master/utilcode/src/main/java/com/blankj/utilcode/utils/ProcessUtils.java

[regex.java]: https://github.com/Blankj/AndroidUtilCode/blob/master/utilcode/src/main/java/com/blankj/utilcode/utils/RegexUtils.java
Expand Down
24 changes: 17 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## Android developers should collect the following utils
**[中文版README][readme-cn.md][How to get this README from README-CN][trans]**
**[中文版README][readme-cn.md]**
***
Directory is shown below:
> - **About Activity→[ActivityUtils.java][activity.java]**
Expand Down Expand Up @@ -298,10 +298,16 @@ getContactNum
getAllSMS
```

> - **About Pinyin→[PinyinUtils.java][pinyin.java][Test][pinyin.test]**
```
getPinyinFirstLetter
ccs2Pinyin
```

> - **About Process→[ProcessUtils.java][process.java]**
```
getForegroundProcessName
cleanAllBackgroundProcessescleanBackgroundProcesses
cleanAllBackgroundProcesses, cleanBackgroundProcesses
```

> - **About Regex→[RegexUtils.java][regex.java][Test][regex.test]**
Expand All @@ -313,11 +319,15 @@ isIDCard15
isIDCard18
isEmail
isURL
isChz
isZh
isUsername
isDate
isIP
isMatch
getMatches
getSplits
getReplaceFirst
getReplaceAll
```

> - **About Screen→[ScreenUtils.java][screen.java]**
Expand Down Expand Up @@ -397,15 +407,14 @@ clear
isEmpty
isSpace
equals
equalsIgnoreCase
null2Length0
length
upperFirstLetter
lowerFirstLetter
reverse
toDBC
toSBC
getPYFirstLetter
cn2PY
```

> - **About ThreadPool→[ThreadPoolUtils.java][thread_pool.java]**
Expand Down Expand Up @@ -510,8 +519,6 @@ limitations under the License.
[readme.md]: https://github.com/Blankj/AndroidUtilCode
[readme-cn.md]: https://github.com/Blankj/AndroidUtilCode/blob/master/README-CN.md

[trans]: https://github.com/Blankj/AndroidUtilCode/blob/master/utilcode/src/test/java/com/blankj/utilcode/utils/TestUtils.java

[activity.java]: https://github.com/Blankj/AndroidUtilCode/blob/master/utilcode/src/main/java/com/blankj/utilcode/utils/ActivityUtils.java

[app.java]: https://github.com/Blankj/AndroidUtilCode/blob/master/utilcode/src/main/java/com/blankj/utilcode/utils/AppUtils.java
Expand Down Expand Up @@ -558,6 +565,9 @@ limitations under the License.

[phone.java]: https://github.com/Blankj/AndroidUtilCode/blob/master/utilcode/src/main/java/com/blankj/utilcode/utils/PhoneUtils.java

[pinyin.java]: https://github.com/Blankj/AndroidUtilCode/blob/master/utilcode/src/main/java/com/blankj/utilcode/utils/PinyinUtils.java
[pinyin.test]: https://github.com/Blankj/AndroidUtilCode/blob/master/utilcode/src/test/java/com/blankj/utilcode/utils/PinyinUtilsTest.java

[process.java]: https://github.com/Blankj/AndroidUtilCode/blob/master/utilcode/src/main/java/com/blankj/utilcode/utils/ProcessUtils.java

[regex.java]: https://github.com/Blankj/AndroidUtilCode/blob/master/utilcode/src/main/java/com/blankj/utilcode/utils/RegexUtils.java
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package com.blankj.androidutilcode.activities;

import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;

import com.blankj.androidutilcode.R;
import com.blankj.utilcode.utils.LocationUtils;

/**
* <pre>
* author: Blankj
* blog : http://blankj.com
* time : 2016/10/13
* desc : Location工具类测试
* </pre>
*/

public class LocationActivity extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_activity);

TextView tvAboutLocation = (TextView) findViewById(R.id.tv_about_location);

LocationUtils.getInstance(this).init(new);

tvAboutLocation.setText("");
}
}
23 changes: 23 additions & 0 deletions app/src/main/res/layout/activity_location.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:orientation="vertical"
android:padding="@dimen/spacing_small">

<TextView
android:id="@+id/tv_about_location"
style="@style/Font"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
/>

</LinearLayout>
</ScrollView>
1 change: 1 addition & 0 deletions update_log.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
###
#### 16/11/16 拼音工具类单独拎出来做了整理
#### 16/11/15 完善正则工具类
#### 16/11/14 新增启动服务
#### 16/11/13 新增判断sim卡是否准备好
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public enum TimeUnit {
*/
public static final String REGEX_IP = "((2[0-4]\\d|25[0-5]|[01]?\\d\\d?)\\.){3}(2[0-4]\\d|25[0-5]|[01]?\\d\\d?)";

/*以下摘自http://tool.oschina.net/regex*/
/************** 以下摘自http://tool.oschina.net/regex **************/
/**
* 正则:双字节字符(包括汉字在内)
*/
Expand Down Expand Up @@ -166,7 +166,5 @@ public enum TimeUnit {
*/
public static final String REGEX_NEGATIVE_FLOAT = "^-[1-9]\\d*\\.\\d*|-0\\.\\d*[1-9]\\d*$";

/**
* If u want more please visit http://toutiao.com/i6231678548520731137/
*/
/************** If u want more please visit http://toutiao.com/i6231678548520731137/ **************/
}
Loading

0 comments on commit f763655

Please sign in to comment.