Java Code Examples for com.blankj.utilcode.util.LogUtils

The following examples show how to use com.blankj.utilcode.util.LogUtils. These examples are extracted from open source projects. 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 Project: YCAudioPlayer   Source File: PlayService.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * 播放索引为position的音乐
 * @param position              索引
 */
public void play(int position) {
    if (audioMusics.isEmpty()) {
        return;
    }

    if (position < 0) {
        position = audioMusics.size() - 1;
    } else if (position >= audioMusics.size()) {
        //如果是最后一首音乐,则播放时直接播放第一首音乐
        position = 0;
    }

    mPlayingPosition = position;
    AudioBean music = audioMusics.get(mPlayingPosition);
    String id = music.getId();
    LogUtils.e("PlayService"+"----id----"+ id);
    //保存当前播放的musicId,下次进来可以记录状态
    long musicId = Long.parseLong(id);
    SPUtils.getInstance(Constant.SP_NAME).put(Constant.MUSIC_ID,musicId);
    play(music);
}
 
Example 2
Source Project: AndroidSamples   Source File: RxJavaMapActivity.java    License: Apache License 2.0 6 votes vote down vote up
private void rxJavaFlatMap() {
    Observable.create((ObservableOnSubscribe<Integer>) emitter -> {
        emitter.onNext(1);
        emitter.onNext(2);
        emitter.onNext(3);
    }).flatMap(integer -> {
        final List<String> list = new ArrayList<>();
        for (int i = 0; i < 3; i++) {
            list.add("I am value " + integer);
        }
        // 10毫秒的延时
        return Observable.fromIterable(list).delay(10, TimeUnit.MILLISECONDS);
    }).subscribeOn(Schedulers.io())
            .observeOn(AndroidSchedulers.mainThread())
            .subscribe(s -> LogUtils.e(s));
}
 
Example 3
Source Project: YCAudioPlayer   Source File: MainActivity.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * 是当某个按键被按下是触发。所以也有人在点击返回键的时候去执行该方法来做判断
 */
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    LogUtils.e("触摸监听", "onKeyDown");
    if (keyCode == KeyEvent.KEYCODE_BACK) {
        if (mPlayFragment != null && isPlayFragmentShow) {
            hidePlayingFragment();
        }else {
            //双击返回桌面
            if ((System.currentTimeMillis() - time > 1000)) {
                ToastUtils.showRoundRectToast("再按一次返回桌面");
                time = System.currentTimeMillis();
            } else {
                moveTaskToBack(true);
            }
        }
        return true;
    }
    return super.onKeyDown(keyCode, event);
}
 
Example 4
Source Project: DanDanPlayForAndroid   Source File: NewTaskRunnable.java    License: MIT License 6 votes vote down vote up
@Override
public void run() {
    try {
        File torrentFile = new File(mTorrent.getTorrentPath());
        File saveDirFile = new File(mTorrent.getSaveDirPath());
        File resumeFile = new File(Constants.DefaultConfig.torrentResumeFilePath);

        TorrentInfo torrentInfo = new TorrentInfo(torrentFile);
        mTorrent.setHash(torrentInfo.infoHash().toHex());

        Priority[] priorities = mTorrent.getPriorities();
        if (priorities == null || priorities.length != torrentInfo.numFiles()) {
            LogUtils.e("添加任务失败");
            return;
        }

        if(callBack.beforeAddTask(mTorrent))
            engine.download(torrentInfo, saveDirFile, resumeFile, mTorrent.getPriorities(), null);
    } catch (Exception ignore) {
    }

}
 
Example 5
Source Project: AndroidSamples   Source File: PictureActivity.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * 拍照
 */
private void camera() {

    File file = new File(Config.SAVE_REAL_PATH, System.currentTimeMillis() + ".jpg");
    LogUtils.e(file.getPath());
    if (!file.getParentFile().exists()) {
        file.getParentFile().mkdirs();
    }
    Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
    //Android7.0以上URI
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
        //通过FileProvider创建一个content类型的Uri
        mProviderUri = FileProvider.getUriForFile(this, "com.sdwfqin.sample.fileprovider", file);
        intent.putExtra(MediaStore.EXTRA_OUTPUT, mProviderUri);
        //添加这一句表示对目标应用临时授权该Uri所代表的文件
        intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
    } else {
        mUri = Uri.fromFile(file);
        intent.putExtra(MediaStore.EXTRA_OUTPUT, mUri);
    }
    try {
        startActivityForResult(intent, RESULT_CODE_1);
    } catch (ActivityNotFoundException anf) {
        ToastUtils.showShort("摄像头未准备好!");
    }
}
 
Example 6
Source Project: AndroidSamples   Source File: MySurfaceView.java    License: Apache License 2.0 6 votes vote down vote up
private void draw() {
    try {
        // 获取Canvas对象
        mCanvas = mHolder.lockCanvas();
        // SurfaceView背景
        mCanvas.drawColor(Color.WHITE);
        mCanvas.drawPath(mPath, mPaint);
    } catch (Exception e) {
        LogUtils.e("draw: ", e);
    } finally {
        if (mCanvas != null) {
            // 提交画布内容
            mHolder.unlockCanvasAndPost(mCanvas);
        }
    }
}
 
Example 7
Source Project: DanDanPlayForAndroid   Source File: PersistentCookieStore.java    License: MIT License 6 votes vote down vote up
public PersistentCookieStore(Context context) {
    cookiePrefs = context.getSharedPreferences(COOKIE_PREFS, Context.MODE_PRIVATE);
    cookies = new HashMap<>();

    //将持久化的cookies缓存到内存中 即map cookies
    Map<String, ?> prefsMap = cookiePrefs.getAll();
    for (Map.Entry<String, ?> entry : prefsMap.entrySet()) {
        String[] cookieNames = TextUtils.split((String) entry.getValue(), ",");
        for (String name : cookieNames) {
            String encodedCookie = cookiePrefs.getString(name, null);
            LogUtils.i("cookies_encodeCookie",name+"===========>" + (encodedCookie != null ? encodedCookie : "null"));
            if (encodedCookie != null) {
                Cookie decodedCookie = decodeCookie(encodedCookie);
                if (decodedCookie != null) {
                    if (!cookies.containsKey(entry.getKey())) {
                        cookies.put(entry.getKey(), new HashMap<>());
                    }
                    cookies.get(entry.getKey()).put(name, decodedCookie);
                }
            }
        }
    }
}
 
Example 8
Source Project: DanDanPlayForAndroid   Source File: PersistentCookieStore.java    License: 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 9
Source Project: DanDanPlayForAndroid   Source File: SerializableOkHttpCookies.java    License: MIT License 6 votes vote down vote up
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
    String name = (String) in.readObject();
    String value = (String) in.readObject();
    long expiresAt = in.readLong();
    String domain = (String) in.readObject();
    String path = (String) in.readObject();
    boolean secure = in.readBoolean();
    boolean httpOnly = in.readBoolean();
    boolean hostOnly = in.readBoolean();
    boolean persistent = in.readBoolean();
    LogUtils.i("persistent====>"+persistent);
    Cookie.Builder builder = new Cookie.Builder();
    builder = builder.name(name);
    builder = builder.value(value);
    builder = builder.expiresAt(expiresAt);
    builder = hostOnly ? builder.hostOnlyDomain(domain) : builder.domain(domain);
    builder = builder.path(path);
    builder = secure ? builder.secure() : builder;
    builder = httpOnly ? builder.httpOnly() : builder;
    clientCookies =builder.build();
}
 
Example 10
Source Project: DanDanPlayForAndroid   Source File: SearchPresenterImpl.java    License: MIT License 6 votes vote down vote up
@Override
public void downloadTorrent(String magnet) {
    getView().showDownloadTorrentLoading();
    MagnetBean.downloadTorrent(magnet, new CommOtherDataObserver<ResponseBody>() {
        @Override
        public void onSuccess(ResponseBody responseBody) {
            String downloadPath = getView().getDownloadFolder();
            downloadPath += Constants.DefaultConfig.torrentFolder;
            downloadPath += "/" + magnet.substring(20) + ".torrent";
            FileIOUtils.writeFileFromIS(downloadPath, responseBody.byteStream());
            getView().dismissDownloadTorrentLoading();
            getView().downloadTorrentOver(downloadPath, magnet);
        }

        @Override
        public void onError(int errorCode, String message) {
            getView().dismissDownloadTorrentLoading();
            LogUtils.e(message);
            ToastUtils.showShort("下载种子文件失败");
        }
    }, new NetworkConsumer());
}
 
Example 11
Source Project: DanDanPlayForAndroid   Source File: ResetPasswordPresenterImpl.java    License: MIT License 6 votes vote down vote up
@Override
public void reset(ResetPasswordParam param) {
    getView().showLoading();
    PersonalBean.resetPassword(param, new CommJsonObserver<CommJsonEntity>(getLifecycle()) {
        @Override
        public void onSuccess(CommJsonEntity commJsonEntity) {
            getView().hideLoading();
            getView().resetSuccess();
        }

        @Override
        public void onError(int errorCode, String message) {
            getView().hideLoading();
            LogUtils.e(message);
            ToastUtils.showShort(message);
        }
    }, new NetworkConsumer());
}
 
Example 12
Source Project: DanDanPlayForAndroid   Source File: AnimeDetailPresenterImpl.java    License: MIT License 6 votes vote down vote up
@Override
public void getAnimeDetail(String animeId) {
    getView().showLoading();
    AnimeDetailBean.getAnimaDetail(animeId, new CommJsonObserver<AnimeDetailBean>(getLifecycle()) {
        @Override
        public void onSuccess(AnimeDetailBean animeDetailBean) {
            getView().hideLoading();
            getView().showAnimeDetail(animeDetailBean);
        }

        @Override
        public void onError(int errorCode, String message) {
            getView().hideLoading();
            LogUtils.e(message);
            ToastUtils.showShort(message);
        }
    }, new NetworkConsumer());
}
 
Example 13
Source Project: DanDanPlayForAndroid   Source File: LoginPresenterImpl.java    License: MIT License 6 votes vote down vote up
@Override
public void login(LoginParam param){
    getView().showLoading();
    PersonalBean.login(param, new CommJsonObserver<PersonalBean>(getLifecycle()) {
        @Override
        public void onSuccess(PersonalBean personalBean) {
            getView().hideLoading();
            AppConfig.getInstance().setLogin(true);
            AppConfig.getInstance().saveUserScreenName(personalBean.getScreenName());
            AppConfig.getInstance().saveUserName(param.getUserName());
            AppConfig.getInstance().saveUserImage(personalBean.getProfileImage());
            AppConfig.getInstance().saveToken(personalBean.getToken());
            AppConfig.getInstance().setLastLoginTime(System.currentTimeMillis());
            ToastUtils.showShort("登录成功");
            EventBus.getDefault().post(UpdateFragmentEvent.updatePersonal());
            getView().launchMain();
        }

        @Override
        public void onError(int errorCode, String message) {
            getView().hideLoading();
            LogUtils.e(message);
            ToastUtils.showShort(message);
        }
    }, new NetworkConsumer());
}
 
Example 14
Source Project: DanDanPlayForAndroid   Source File: AnimeListPresenterImpl.java    License: MIT License 6 votes vote down vote up
@Override
public void getByTag(int tagId) {
    getView().showLoading();
    AnimeTagBean.getTagAnimeList(tagId+"", new CommJsonObserver<AnimeTagBean>(getLifecycle()) {
        @Override
        public void onSuccess(AnimeTagBean animeTagBean) {
            getView().hideLoading();
            getView().refreshTagAnime(animeTagBean);
        }

        @Override
        public void onError(int errorCode, String message) {
            getView().hideLoading();
            getView().refreshTagAnime(null);
            LogUtils.e(message);
        }
    }, new NetworkConsumer());
}
 
Example 15
Source Project: DanDanPlayForAndroid   Source File: ChangePasswordPresenterImpl.java    License: MIT License 6 votes vote down vote up
@Override
public void change(ChangePasswordParam param) {
    getView().showLoading();
    PersonalBean.changePassword(param, new CommJsonObserver<CommJsonEntity>(getLifecycle()) {
        @Override
        public void onSuccess(CommJsonEntity commJsonEntity) {
            getView().hideLoading();
            getView().changeSuccess();
        }

        @Override
        public void onError(int errorCode, String message) {
            getView().hideLoading();
            LogUtils.e(message);
            ToastUtils.showShort(message);
        }
    }, new NetworkConsumer());
}
 
Example 16
Source Project: DanDanPlayForAndroid   Source File: PlayerActivity.java    License: MIT License 6 votes vote down vote up
/**
 * 上传一条弹幕到弹弹
 */
private void uploadDanmu(BaseDanmaku data) {
    BigDecimal bigDecimal = new BigDecimal(data.getTime() / 1000.00)
            .setScale(2, BigDecimal.ROUND_HALF_UP);
    int type = data.getType();
    if (type != 1 && type != 4 && type != 5) {
        type = 1;
    }
    String time = bigDecimal.toString();
    String mode = type + "";
    String color = (data.textColor & 0x00FFFFFF) + "";
    String comment = String.valueOf(data.text);
    DanmuUploadParam uploadParam = new DanmuUploadParam(time, mode, color, comment);
    UploadDanmuBean.uploadDanmu(uploadParam, episodeId + "", new CommJsonObserver<UploadDanmuBean>(this) {
        @Override
        public void onSuccess(UploadDanmuBean bean) {
            LogUtils.d("upload danmu success: text:" + data.text + "  cid:" + bean.getCid());
        }

        @Override
        public void onError(int errorCode, String message) {
            ToastUtils.showShort(message);
        }
    }, new NetworkConsumer());
}
 
Example 17
Source Project: DanDanPlayForAndroid   Source File: PlayerActivity.java    License: MIT License 6 votes vote down vote up
/**
 * 增加播放历史
 */
private void addPlayHistory(int episodeId) {
    if (episodeId > 0) {
        PlayHistoryBean.addPlayHistory(episodeId, new CommJsonObserver<CommJsonEntity>(this) {
            @Override
            public void onSuccess(CommJsonEntity commJsonEntity) {
                LogUtils.d("add history success: episodeId:" + episodeId);
            }

            @Override
            public void onError(int errorCode, String message) {
                LogUtils.e("add history fail: episodeId:" + episodeId + "  message:" + message);
            }
        }, new NetworkConsumer());
    }
}
 
Example 18
Source Project: DanDanPlayForAndroid   Source File: RegisterParam.java    License: MIT License 6 votes vote down vote up
public void buildHash(Context context) {
    if (StringUtils.isEmpty(userName) ||
            StringUtils.isEmpty(password) ||
            StringUtils.isEmpty(email) ||
            StringUtils.isEmpty(appId) ||
            unixTimestamp == 0){
        LogUtils.e("注册信息错误");
        ToastUtils.showShort("注册信息错误");
    }else {
        String builder = this.appId +
                this.email +
                this.password +
                this.screenName +
                this.unixTimestamp +
                this.userName +
                SoUtils.getInstance().getDanDanAppSecret();
        hash = EncryptUtils.encryptMD5ToString(builder);
    }
}
 
Example 19
Source Project: DanDanPlayForAndroid   Source File: ResetPasswordParam.java    License: MIT License 6 votes vote down vote up
public void buildHash(Context context) {
    if (StringUtils.isEmpty(userName) ||
            StringUtils.isEmpty(email) ||
            StringUtils.isEmpty(appId) ||
            unixTimestamp == 0){
        LogUtils.e("注册信息错误");
        ToastUtils.showShort("注册信息错误");
    }else {
        String builder = this.appId +
                this.email +
                this.unixTimestamp +
                this.userName +
                SoUtils.getInstance().getDanDanAppSecret();
        hash = EncryptUtils.encryptMD5ToString(builder);
    }
}
 
Example 20
Source Project: AndroidSamples   Source File: BroadcastActivity.java    License: Apache License 2.0 6 votes vote down vote up
@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);
}
 
Example 21
Source Project: YCAudioPlayer   Source File: InterceptorUtils.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 网络缓存拦截器,网络连接时请求服务器,否则从本地缓存中获取
 * @return
 */
public static Interceptor addNetWorkInterceptor(){
    Interceptor interceptor = new Interceptor() {
        @Override
        public Response intercept(Chain chain) throws IOException {
            Request request = chain.request();
            if (!NetworkUtils.isConnected()) {
                request = request.newBuilder()
                        .cacheControl(CacheControl.FORCE_CACHE)
                        .build();
                LogUtils.d("addNetWorkInterceptor"+ "没有网络链接");
            }
            Response response = chain.proceed(request);
            if (NetworkUtils.isConnected()) {
                int maxAge = 0; // 有网络时 设置缓存超时时间0个小时
                LogUtils.d("addNetWorkInterceptor"+ "网络已连接,缓存时间为:" + maxAge);
                response = response.newBuilder()
                        .addHeader("Cache-Control", "public, max-age=" + maxAge)
                        .removeHeader("Pragma")// 清除头信息,因为服务器如果不支持,会返回一些干扰信息,不清除下面无法生效
                        .build();
            } else {
                int maxStale = Constant.TIME_CACHE;
                LogUtils.d("addNetWorkInterceptor"+ "网络未连接,缓存时间为:" + maxStale);
                response = response.newBuilder()
                        .addHeader("Cache-Control", "public, only-if-cached, max-stale=" + maxStale)
                        .removeHeader("Pragma")
                        .build();
            }
            String cookeHeader = response.header("Set-Cookie", "");
            LogUtils.e("cookeHeader1-----------"+cookeHeader);
            return response;
        }
    };
    return interceptor;
}
 
Example 22
Source Project: YCAudioPlayer   Source File: PlayService.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 下一首
 * 记住有播放类型,单曲循环,顺序循环,随机播放
 * 逻辑:如果不是最后一首,则还有下一首;如果是最后一首,则切换回第一首
 */
public void next() {
    //建议都添加这个判断
    if (audioMusics.isEmpty()) {
        return;
    }
    int playMode = SPUtils.getInstance(Constant.SP_NAME).getInt(Constant.PLAY_MODE, 0);
    int size = audioMusics.size();
    PlayModeEnum mode = PlayModeEnum.valueOf(playMode);
    switch (mode) {
        //随机
        case SHUFFLE:
            mPlayingPosition = new Random().nextInt(size);
            play(mPlayingPosition);
            break;
        //单曲
        case SINGLE:
            play(mPlayingPosition);
            break;
        //顺序播放并且循环
        case LOOP:
        default:
            if (mPlayingPosition != size - 1) {
                // 如果不是最后一首,则还有下一首
                mPlayingPosition++;
            } else {
                // 如果是最后一首,则切换回第一首
                mPlayingPosition = 0;
            }
            LogUtils.e("PlayService"+"----mPlayingPosition----"+ mPlayingPosition);
            play(mPlayingPosition);
            break;
    }
}
 
Example 23
Source Project: YCAudioPlayer   Source File: AppInfoService.java    License: 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 24
Source Project: AndroidSamples   Source File: OrderBroadcastReceiver.java    License: 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 25
Source Project: YCAudioPlayer   Source File: AppInfoService.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public boolean setToken(String sign, String token) throws RemoteException {
    if(!AppToolUtils.getAidlCheckAppInfoSign().equals(sign)){
        return false;
    }
    SPUtils.getInstance(Constant.SP_NAME).put("token",token);
    LogUtils.i("AppInfoService--setToken:"+ token);
    return true;
}
 
Example 26
Source Project: YCAudioPlayer   Source File: AppInfoService.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public boolean setChannel(String sign, String channel) throws RemoteException {
    if(!AppToolUtils.getAidlCheckAppInfoSign().equals(sign)){
        return false;
    }
    SPUtils.getInstance(Constant.SP_NAME).put("channel",channel);
    LogUtils.i("AppInfoService--setChannel:"+ channel);
    return true;
}
 
Example 27
Source Project: AndroidSamples   Source File: SurfaceViewTemplate.java    License: Apache License 2.0 5 votes vote down vote up
private void draw() {
    try {
        // 获取Canvas对象
        mCanvas = mHolder.lockCanvas();
    } catch (Exception e) {
        LogUtils.e("draw: ", e);
    } finally {
        if (mCanvas != null) {
            // 提交画布内容
            mHolder.unlockCanvasAndPost(mCanvas);
        }
    }
}
 
Example 28
Source Project: YCAudioPlayer   Source File: PlayMusicFragment.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 当使用add()+show(),hide()跳转新的Fragment时,旧的Fragment回调onHiddenChanged(),
 * 不会回调onStop()等生命周期方法,
 * 而新的Fragment在创建时是不会回调onHiddenChanged(),这点要切记
 * @param hidden                        是否显示
 */
@Override
public void onHiddenChanged(boolean hidden) {
    super.onHiddenChanged(hidden);
    LogUtils.e(TAG+"onHiddenChanged"+hidden);
    if (!hidden){
        initData();
    }
}
 
Example 29
Source Project: YCAudioPlayer   Source File: JsAppInterface.java    License: Apache License 2.0 5 votes vote down vote up
static void callBackH5method(Context context, final WebView mWebView, final String callMethod) {
    LogUtils.i("callBackH5method:" + callMethod);
    if (context instanceof BaseActivity) {
        ((BaseActivity) context).runOnUiThread(new Runnable() {
            @Override
            public void run() {
                mWebView.loadUrl(callMethod);
            }
        });
    }
}
 
Example 30
Source Project: YCAudioPlayer   Source File: WebViewActivity.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void onReceivedError(WebView view, WebResourceRequest request, WebResourceError error) {
    super.onReceivedError(view, request, error);
    LogUtils.e("WebViewActivity-----onReceivedError-------" + error.toString());
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
        LogUtils.e("服务器异常" + error.getDescription().toString());
    }
    ToastUtils.showRoundRectToast("服务器异常6.0之后");
    //当加载错误时,就让它加载本地错误网页文件
    //mWebView.loadUrl("file:///android_asset/errorpage/error.html");

    showErrorPage();//显示错误页面
}