Giter Club home page Giter Club logo

androidutils's Introduction

个人收藏的Android常用工具类,每次做项目,一些常用的工具类总要重写一篇,烦死了,终于还是建了库,收藏这些常用的。

#Gradle依赖

compile 'com.wuxiaolong.androidutils:androidutils:1.0.3'

功能简介

v1.0.3

TimeUtil

时间戳转北京时间

String unixTimestamp2BeijingTime(Object millisecond, String format)

北京时间转时间戳

long beijingTime2UnixTimestamp(String beijingTime, String format)

BitmapCompressUtil

图片压缩类

ArithUtil

算术类,包括加减乘除

v1.0.2

AppUtils

工具类集合,不好单独起名都放在AppUtils里

MD5加密

String md5(String plainText)

安装apk

void installAPK(Context context, String path)

直接拨号,需要增加CALL_PHONE权限

void actionCall(Context context, String phone)

跳到拨号盘-拨打电话

void actionDial(Context context, String phone)

DisplayMetricsUtil

获取屏幕分辨率-宽

int getScreenWidth(Context context)

获取屏幕分辨率-高

int getScreenHeight(Context context)

根据手机的分辨率从 dp 的单位 转成为 px(像素)

int dip2px(Context context, float dpValue)

根据手机的分辨率从 px(像素) 的单位 转成为 dp

int px2dip(Context context, float pxValue)

AbsolutePathUtil

通过Url获取绝对路径

String getAbsolutePath(final Context context, final Uri uri)

DownloadUtil

调用DownloadManager下载

DownloadUtil downloadUtil = new DownloadUtil(content, downloadUrl);
//下载显示名字,不能是中文
downloadUtil.setDownloadFileName("apkName" + System.currentTimeMillis() + ".apk");
downloadUtil.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
downloadUtil.start();

LogUtil

log打印类

LogUtil.d("");

RegexUtils

手机号码,中间4位星号替换

String phoneNoHide(String phone)

银行卡号,保留最后4位,其他星号替换

String cardIdHide(String cardId)

验证Email

boolean checkEmail(String email)

验证身份证号码

boolean checkIdCard(String idCard)

验证手机号码

boolean checkMobile(String mobile)

验证固定电话号码

 boolean checkPhone(String phone)

验证整数(正整数和负整数)

boolean checkDecimals(String decimals)

SharedPreferencesUtil

SharedPreferences工具类

void setString(Context context, final String key,final String value)

TimeUtil

时间工具类

VersionUtil

获取版本号

String getVersionName(Context context)

获取版本code

int getVersionCode(Context context)

AndroidProgrammer

我的微信公众号:Android高手进阶之路,让我们共同学习,每天进步一点点。欢迎微信扫一扫关注。

关于作者

点击查看

androidutils's People

Contributors

wuxiaolong avatar allencoder avatar

Stargazers

Qing208 avatar

Watchers

James Cloos avatar Qing208 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.