Java Code Examples for com.blankj.utilcode.util.LogUtils#i()

The following examples show how to use com.blankj.utilcode.util.LogUtils#i() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PersistentCookieStore.java    From DanDanPlayForAndroid with MIT License 6 votes vote down vote up
public void add(String host, String token, String coo) {
    Cookie cookie = decodeCookie(coo);
    if (cookie != null) {
        LogUtils.i(cookie.toString());
        LogUtils.i(cookie.persistent()+"");
        if (!cookies.containsKey(host)) {
            cookies.put(host, new HashMap<String, Cookie>());
        }
        cookies.get(host).put(token, cookie);
        //讲cookies持久化到本地
        SharedPreferences.Editor prefsWriter = cookiePrefs.edit();
        prefsWriter.putString(host, token);
        prefsWriter.putString(token, encodeCookie(new SerializableOkHttpCookies(cookie)));
        prefsWriter.apply();
    }

}
 
Example 2
Source File: JsAppInterface.java    From YCAudioPlayer with Apache License 2.0 6 votes vote down vote up
/**
 * 在js中调用window.AndroidWebView.showInfoFromJs(name),便会触发此方法。
 * 此方法名称一定要和js中showInfoFromJava方法一样
 * 注意此注解一定需要添加上!!!!!
 * @param valJson                      json字符串
 */
@JavascriptInterface
public String jsToAppInterface(String valJson) {
    if (mContext instanceof WebViewActivity) {
        if (!((WebViewActivity) (mContext)).isJsToAppCallBack) {
            LogUtils.i("url不在白名单或者证书错误");
            return "";
        }
    }
    try {
        JSONObject jsonObject = new JSONObject(valJson);
        String method = jsonObject.optString("method");
        String data = jsonObject.optString("data");
        String callbackId = jsonObject.optString("callbackId");
        LogUtils.i("jsToAppInterface:" + valJson);
        //this.mWebView.loadUrl("javascript:"+method+"('" + data + "')");
        routePageNew(method, data, callbackId);
    } catch (Exception e) {
        e.printStackTrace();
    }
    return "";
}
 
Example 3
Source File: ServiceActivity.java    From AndroidSamples with Apache License 2.0 5 votes vote down vote up
@Override
public void onServiceConnected(ComponentName componentName, IBinder iBinder) {
    LogUtils.i("onServiceConnected: " + "绑定回调");
    InteractiveService.MyBind myBind = (InteractiveService.MyBind) iBinder;
    myBind.showLog();
    myBind.show("测试传输数据");
}
 
Example 4
Source File: BaseApplication.java    From AndroidUtilCode with Apache License 2.0 5 votes vote down vote up
public void initLog() {
    LogUtils.Config config = LogUtils.getConfig()
            .setLogSwitch(isDebug())// 设置 log 总开关,包括输出到控制台和文件,默认开
            .setConsoleSwitch(isDebug())// 设置是否输出到控制台开关,默认开
            .setGlobalTag(null)// 设置 log 全局标签,默认为空
            // 当全局标签不为空时,我们输出的 log 全部为该 tag,
            // 为空时,如果传入的 tag 为空那就显示类名,否则显示 tag
            .setLogHeadSwitch(true)// 设置 log 头信息开关,默认为开
            .setLog2FileSwitch(false)// 打印 log 时是否存到文件的开关,默认关
            .setDir("")// 当自定义路径为空时,写入应用的/cache/log/目录中
            .setFilePrefix("")// 当文件前缀为空时,默认为"util",即写入文件为"util-yyyy-MM-dd$fileExtension"
            .setFileExtension(".log")// 设置日志文件后缀
            .setBorderSwitch(true)// 输出日志是否带边框开关,默认开
            .setSingleTagSwitch(true)// 一条日志仅输出一条,默认开,为美化 AS 3.1 的 Logcat
            .setConsoleFilter(LogUtils.V)// log 的控制台过滤器,和 logcat 过滤器同理,默认 Verbose
            .setFileFilter(LogUtils.V)// log 文件过滤器,和 logcat 过滤器同理,默认 Verbose
            .setStackDeep(1)// log 栈深度,默认为 1
            .setStackOffset(0)// 设置栈偏移,比如二次封装的话就需要设置,默认为 0
            .setSaveDays(3)// 设置日志可保留天数,默认为 -1 表示无限时长
            // 新增 ArrayList 格式化器,默认已支持 Array, Throwable, Bundle, Intent 的格式化输出
            .addFormatter(new LogUtils.IFormatter<ArrayList>() {
                @Override
                public String format(ArrayList arrayList) {
                    return "LogUtils Formatter ArrayList { " + arrayList.toString() + " }";
                }
            })
            .setFileWriter(null);
    LogUtils.i(config.toString());
}
 
Example 5
Source File: OkHttpEngine.java    From DanDanPlayForAndroid with MIT License 5 votes vote down vote up
public RequestBody joinParams(Map<String, String> paramsMap) {
    if (paramsMap == null) return new FormBody.Builder().build();
    FormBody.Builder builder = new FormBody.Builder();
    for (String key : paramsMap.keySet()) {
        LogUtils.i(key + "========>" + paramsMap.get(key));
        builder.add(key, paramsMap.get(key));
    }
    return builder.build();
}
 
Example 6
Source File: BasePresenter.java    From AndroidUtilCode with Apache License 2.0 5 votes vote down vote up
@Override
public void onLifecycleChanged(@NonNull Activity activity, Lifecycle.Event event) {
    super.onLifecycleChanged(activity, event);
    if (event == Lifecycle.Event.ON_DESTROY) {
        destroyPresenter();
    }
    LogUtils.i("onLifecycleChanged: " + event);
}
 
Example 7
Source File: CommJsonObserver.java    From DanDanPlayForAndroid with MIT License 5 votes vote down vote up
private String getErrorMessage(Throwable e) {
    LogUtils.e(e.toString());
    if (e instanceof JsonSyntaxException) {
        LogUtils.i("error", e.toString());
        return "数据异常";
    } else if (e instanceof UnknownHostException) {
        LogUtils.i("error", e.toString());
        return "网络连接中断";
    } else if (e instanceof SocketTimeoutException) {
        return "服务器繁忙";
    }
    return "服务器繁忙";
}
 
Example 8
Source File: OrderBroadcastReceiver.java    From AndroidSamples with Apache License 2.0 5 votes vote down vote up
@Override
public void onReceive(Context context, Intent intent) {
    LogUtils.i("onReceive: " + "High");
    //传递结果到下一个广播接收器
    int code = 0;
    String data = "hello";
    Bundle bundle = new Bundle();
    bundle.putString("key", "values");
    setResult(code, data, bundle);
}
 
Example 9
Source File: OrderBroadcastReceiver.java    From AndroidSamples with Apache License 2.0 5 votes vote down vote up
@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();
}
 
Example 10
Source File: AppInfoService.java    From YCAudioPlayer with Apache License 2.0 5 votes vote down vote up
@Nullable
@Override
public IBinder onBind(Intent intent) {
    LogUtils.i("AppInfoService--IBinder:");
    /*int check = checkCallingOrSelfPermission("aidl.AppInfoService");
    if(check == PackageManager.PERMISSION_DENIED){
        return null;
    }*/
    return binder;
}
 
Example 11
Source File: ServiceActivity.java    From AndroidSamples with Apache License 2.0 4 votes vote down vote up
@Override
public void onServiceDisconnected(ComponentName componentName) {
    LogUtils.i("onServiceDisconnected: ");
}
 
Example 12
Source File: GdView.java    From AndroidSamples with Apache License 2.0 4 votes vote down vote up
@Override
public boolean onDown(MotionEvent e) {
    LogUtils.i("onDown: 按下");
    return true;
}
 
Example 13
Source File: GdView.java    From AndroidSamples with Apache License 2.0 4 votes vote down vote up
@Override
public boolean onSingleTapUp(MotionEvent e) {
    LogUtils.i("onSingleTapUp: 轻轻一碰后马上松开");
    return true;
}
 
Example 14
Source File: PositionView.java    From AndroidSamples with Apache License 2.0 4 votes vote down vote up
@Override
    protected void onDraw(Canvas canvas) {
        int left = getLeft();
        int Right = getRight();
        int Top = getTop();
        int Bottom = getBottom();
//        float Z = getZ();

        LogUtils.i("left: " + left);
        LogUtils.i("right: " + Right);
        LogUtils.i("top: " + Top);
        LogUtils.i("bottom: " + Bottom);
//        LogUtils.i("Z: " + Z);

        int width = Right - left;
        int widthdp = ConvertUtils.px2dp(width);
        int height = Bottom - Top;
        int heightdp = ConvertUtils.px2dp(height);
        // 转换为dp
        LogUtils.i("width:" + width);
        LogUtils.i("宽度(dp):" + widthdp);
        LogUtils.i("height:" + height);
        LogUtils.i("高度(dp):" + heightdp);

        float translationX = getTranslationX();
        float translationY = getTranslationY();
//        float translationZ = getTranslationZ();

        LogUtils.i("translationX:" + translationX);
        LogUtils.i("translationY:" + translationY);
//        LogUtils.i("translationZ:" + translationZ);

        // x,y:移动后left与top的位置
        float x = left + translationX;
        float y = Top + translationY;

        LogUtils.i("移动后left的位置" + x);
        LogUtils.i("移动后top的位置" + y);

        super.onDraw(canvas);
    }
 
Example 15
Source File: PersistentCookieStore.java    From DanDanPlayForAndroid with MIT License 4 votes vote down vote up
public void getCookiePrefs() {
    Map<String, ?> prefsMap = cookiePrefs.getAll();
    for (Map.Entry<String, ?> entry : prefsMap.entrySet()) {
        LogUtils.i("cookie_map", entry.getKey()+"========>"+entry.getValue());
    }
}
 
Example 16
Source File: AppInfoService.java    From YCAudioPlayer with Apache License 2.0 4 votes vote down vote up
@Override
public void onDestroy() {
    super.onDestroy();
    LogUtils.i("AppInfoService--onDestroy:");
}
 
Example 17
Source File: GdView.java    From AndroidSamples with Apache License 2.0 4 votes vote down vote up
@Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
    LogUtils.i("onFling: 滑动后松开");
    return true;
}
 
Example 18
Source File: GdView.java    From AndroidSamples with Apache License 2.0 4 votes vote down vote up
@Override
public boolean onSingleTapConfirmed(MotionEvent e) {
    LogUtils.i("onSingleTapConfirmed: 严格的单击");
    return true;
}
 
Example 19
Source File: OrdinaryBroadcastReceiver.java    From AndroidSamples with Apache License 2.0 4 votes vote down vote up
@Override
public void onReceive(Context context, Intent intent) {
    String str = intent.getStringExtra("name");
    LogUtils.i("onReceive(普通广播,静态注册): " + str);
}
 
Example 20
Source File: MainActivity.java    From AndroidSamples with Apache License 2.0 3 votes vote down vote up
@Override
protected void initEventAndData() {

    LogUtils.i("日志测试");

    mMain_tv = (TextView) findViewById(R.id.main_tv);

    mPresenter.getWeather("101190201");
}