本文整理汇总了Java中com.blankj.utilcode.util.LogUtils.i方法的典型用法代码示例。如果您正苦于以下问题:Java LogUtils.i方法的具体用法?Java LogUtils.i怎么用?Java LogUtils.i使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.blankj.utilcode.util.LogUtils
的用法示例。
在下文中一共展示了LogUtils.i方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onError
import com.blankj.utilcode.util.LogUtils; //导入方法依赖的package包/类
@Override
public void onError(@NonNull Throwable e) {
LoadingDialog.dissmiss();
String errMsg = "";
if (e instanceof SocketTimeoutException) {
errMsg = "网络连接超时,请检查您的网络状态,稍后重试";
} else if (e instanceof ConnectException) {
errMsg = "网络连接异常,请检查您的网络状态";
} else if (e instanceof UnknownHostException) {
errMsg = "网络异常,请检查您的网络状态";
} else {
errMsg = e.getMessage();
}
LogUtils.i("onError:" + errMsg);
_onError(errMsg);
}
示例2: sendLogRequest
import com.blankj.utilcode.util.LogUtils; //导入方法依赖的package包/类
/**
* 开始解析发送参数
*/
private void sendLogRequest(Request request) throws IOException {
if (request != null) {
String body = "";
if (request.body() != null) {
Buffer buffer = new Buffer();
request.body().writeTo(buffer);
//编码设为UTF-8
Charset charset = Charset.forName("UTF-8");
MediaType contentType = request.body().contentType();
if (contentType != null) {
charset = contentType.charset(Charset.forName("UTF-8"));
}
body = buffer.readString(charset);
//如果你出现中文参数乱码情况,请进行URL解码处理!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
body = URLEncoder.encode(body, "UTF-8");
}
LogUtils.i("发送----" + "method:" + request.method() + " url:" + request.url() + " body:" + body);
}
}
示例3: sendLogResponse
import com.blankj.utilcode.util.LogUtils; //导入方法依赖的package包/类
/**
* 开始解析服务器返回参数
*/
private void sendLogResponse(Response response) throws IOException {
String rBody = "";
if (response != null && response.body() != null) {
BufferedSource source = response.body().source();
source.request(Long.MAX_VALUE); // Buffer the entire body.
Buffer buffer = source.buffer();
Charset charset = Charset.forName("UTF-8");
MediaType contentType = response.body().contentType();
if (contentType != null) {
try {
charset = contentType.charset(Charset.forName("UTF-8"));
} catch (UnsupportedCharsetException e) {
e.printStackTrace();
}
}
rBody = buffer.clone().readString(charset);
}
LogUtils.i("接收:" + rBody.toString());
}
示例4: onStart
import com.blankj.utilcode.util.LogUtils; //导入方法依赖的package包/类
@Override
protected void onStart() {
super.onStart();
// 注册普通广播
mReceiver1 = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
String str = intent.getStringExtra("name");
LogUtils.i("onReceive(普通广播,动态注册): " + str);
}
};
IntentFilter filter1 = new IntentFilter();
filter1.addAction("com.sdwfqin.broadcastdemo");
registerReceiver(mReceiver1, filter1);
// ===================================================
// 注册本地广播
mReceiver2 = new LocalBroadcastReceiver();
IntentFilter filter2 = new IntentFilter();
filter2.addAction("com.sdwfqin.broadcastdemo3");
LocalBroadcastManager.getInstance(BroadcastActivity.this).registerReceiver(mReceiver2, filter2);
}
示例5: run
import com.blankj.utilcode.util.LogUtils; //导入方法依赖的package包/类
@Override
public void run() {
long start = System.currentTimeMillis();
while (mIsDrawing) {
draw();
}
long end = System.currentTimeMillis();
// 50-100
if (end - start < 100) {
try {
Thread.sleep(100 - (end - start));
} catch (InterruptedException e) {
LogUtils.i("run: ", e);
}
}
}
示例6: draw
import com.blankj.utilcode.util.LogUtils; //导入方法依赖的package包/类
private void draw() {
try {
// 获取Canvas对象
mCanvas = mHolder.lockCanvas();
// SurfaceView背景
mCanvas.drawColor(Color.WHITE);
mCanvas.drawPath(mPath, mPaint);
} catch (Exception e) {
LogUtils.i("draw: ", e);
} finally {
if (mCanvas != null) {
// 提交画布内容
mHolder.unlockCanvasAndPost(mCanvas);
}
}
}
示例7: run
import com.blankj.utilcode.util.LogUtils; //导入方法依赖的package包/类
@Override
public void run() {
LogUtils.v("verbose");
LogUtils.d("debug");
LogUtils.i("info");
LogUtils.w("warn");
LogUtils.e("初始化成功");
LogUtils.a("assert");
}
示例8: run
import com.blankj.utilcode.util.LogUtils; //导入方法依赖的package包/类
@Override
public void run() {
LogUtils.v("verbose");
LogUtils.d("debug");
LogUtils.i("info");
LogUtils.w("warn");
LogUtils.e("error");
LogUtils.a("assert");
}
示例9: drawBottomBorder
import com.blankj.utilcode.util.LogUtils; //导入方法依赖的package包/类
/**
* 画底部显示的分割线
*
* @param canvas
*/
private void drawBottomBorder(Canvas canvas) {
// startX是底部横线的长度 cx是x轴横线的中间位置
// 画底部横线
for (int i = 0; i < maxCount; i++) {
cX = startX + i * 2 * startX;
LogUtils.i("cX" + cX + "startX" + startX);
canvas.drawLine(cX - bottomLineLength / 2,
height,
cX + bottomLineLength / 2,
height, bottomLinePaint);
}
}
示例10: onReceive
import com.blankj.utilcode.util.LogUtils; //导入方法依赖的package包/类
@Override
public void onReceive(Context context, Intent intent) {
// 获取上个广播接收者增加的Bundle
Bundle bundle = getResultExtras(true);
LogUtils.i("onReceive: " + "Mid Bunder:" + bundle.getString("key"));
//获取上一个广播接收器结果
int code = getResultCode();
String data = getResultData();
LogUtils.i("onReceive: " + "获取到上一个广播接收器结果:" + "code=" + code + "data=" + data);
// 拦截广播
abortBroadcast();
}
示例11: onServiceConnected
import com.blankj.utilcode.util.LogUtils; //导入方法依赖的package包/类
@Override
public void onServiceConnected(ComponentName componentName, IBinder iBinder) {
LogUtils.i("onServiceConnected: " + "绑定回调");
InteractiveService.MyBind myBind = (InteractiveService.MyBind) iBinder;
myBind.showLog();
myBind.show("测试传输数据");
}
示例12: onViewClicked
import com.blankj.utilcode.util.LogUtils; //导入方法依赖的package包/类
@OnClick(R.id.glide_btn)
public void onViewClicked() {
LogUtils.i("onViewClicked: " + "加载图片");
// 图片url(来自必应)
// String url = "http://cn.bing.com/az/hprichbg/rb/Dongdaemun_ZH-CN10736487148_1920x1080.jpg";
String url = "http://p1.pstatp.com/large/166200019850062839d3";
// String url = "http://12345";
Glide
// 创建一个加载图片的实例
.with(this)
// 指定待加载的图片资源(网络图片、本地图片、应用资源、二进制流、Uri对象等等)
.load(url)
// 指定以图片形式显示(默认自动识别)
// .asBitmap()
// 指定以gif图片显示
// .asGif()
// 添加占位图
.placeholder(R.drawable.img_tm)
// 异常占位图
.error(R.mipmap.ic_launcher)
// 淡入加载效果
.crossFade()
// 自定义动画效果
// .animate()
// 图片加载优先级,越高越先加载
.priority(Priority.HIGH)
// 设置图片大小(以像素为单位)
// .override(100, 100)
// 设置缓存策略
.diskCacheStrategy(DiskCacheStrategy.NONE)
// .into(glid1Img); // 让图片显示在哪个ImageView上
// 带有监听得into方法
.into(new GlideDrawableImageViewTarget(mGlideImg) {
@Override
public void onResourceReady(GlideDrawable resource, GlideAnimation<? super GlideDrawable> animation) {
super.onResourceReady(resource, animation);
LogUtils.i("onResourceReady: " + "图片加载完成");
}
});
}
示例13: onActivityResult
import com.blankj.utilcode.util.LogUtils; //导入方法依赖的package包/类
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == UCrop.RESULT_ERROR) {
mCameraTv.setText(UCrop.getError(data) + "");
return;
}
if (resultCode == RESULT_OK) {
switch (requestCode) {
case RESULT_CODE_1:
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
cropRawPhoto(mProviderUri);
} else {
cropRawPhoto(mUri);
}
break;
case RESULT_CODE_2:
LogUtils.i("onActivityResult: " + data.getData());
cropRawPhoto(data.getData());
break;
case UCrop.REQUEST_CROP:
LogUtils.i("onActivityResult: " + UCrop.getOutput(data));
mCameraTv.setText(UCrop.getOutput(data) + "");
Glide.with(this)
.load(UCrop.getOutput(data))
.crossFade()
.into(mCameraImg);
break;
default:
break;
}
}
}
示例14: onSelectionChanged
import com.blankj.utilcode.util.LogUtils; //导入方法依赖的package包/类
/**
* 保证光标始终在最后
*
* @param selStart
* @param selEnd
*/
@Override
protected void onSelectionChanged(int selStart, int selEnd) {
LogUtils.i("onSelectionChanged: ");
super.onSelectionChanged(selStart, selEnd);
//保证光标始终在最后
if (selStart == selEnd) {
setSelection(getText().length());
}
}
示例15: onNext
import com.blankj.utilcode.util.LogUtils; //导入方法依赖的package包/类
@Override
public void onNext(@NonNull T t) {
LogUtils.i("onNext:" + t.toString());
_onNext(t);
}