allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Step 2. Add the dependency
dependencies {
compile 'com.github.wangdongyi:WDYApplication:1.0.4'
}
public class BaseApplication extends com.base.library.application.BaseApplication
修改TabLayout下面线的长度 用法 TabLayoutUtils.setIndicator(this, tab, 左边距(dp),右边局(dp);
PhotoUtils.showPhotoIntent(Context mContext, boolean isShowCamera, int MODE, int maxNum);
参数:
isShowCamera//是否显示相机
MODE;//单选多选0单选1多选
maxNum;//最多张数
返回 :
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
PhotoUtils.onPhotoResult(resultCode,data, new PhotoUtils.onPhotoBack() {
@Override
public void onBack(ArrayList result) {
//图片路径 result
}
});
}
PhotoPreviewUtil.movePhotoPreview(this,list,0);
注释:
Context context, ArrayList urls, int selected,
跳转到图片预览 ArrayList urls 图片地址 selected 选择位置
checkPermission(ArrayList permission, OnPermissionListen onPermissionListen)
ArrayList permission 需要申请的权限。
OnPermissionListen 监听返回值
setStatusBar(boolean dark) true是黑色false白色。包含了小米,魅族和官方6.0以上系统。
final Request request = new Request.Builder()
.get()
.tag(this)
.url("http://wthrcdn.etouch.cn/weather_mini?citykey=101010100")
.build();
OkHttpUtil.with(this, request, new GenericsCallback<RequestBean>() {
@Override
public void onResponse(RequestBean response) {
Log.i("onSuccess", "泛型:" + JsonUtil.toJson(response));
}
@Override
public boolean onBefore() {
return true;
}
@Override
public void onRequest(String response) {
Log.i("onSuccess", "回掉:" + response);
}
@Override
public void onError(String msg) {
Log.i("onSuccess", "错误:" + msg);
}
@Override
public void onCancel() {
Log.i("onSuccess", "取消:");
}
@Override
public void onFinish() {
Log.i("onSuccess", "结束:");
}
});
传入activity和fragment 能绑定生命周期,在destroy中停止调用。