com.orhanobut.logger.Logger Java Examples

The following examples show how to use com.orhanobut.logger.Logger. 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: AppApiHelper.java    From v9porn with MIT License 6 votes vote down vote up
@Override
public Observable<List<V9PornItem>> loadPorn9VideoIndex(boolean cleanCache) {
    Observable<String> indexPhpObservable = v9PornServiceApi.porn9VideoIndexPhp(HeaderUtils.getIndexHeader(addressHelper));
    return cacheProviders.getIndexPhp(indexPhpObservable, new EvictProvider(cleanCache))
            .map(responseBodyReply -> {
                switch (responseBodyReply.getSource()) {
                    case CLOUD:
                        Logger.t(TAG).d("数据来自:网络");
                        break;
                    case MEMORY:
                        Logger.t(TAG).d("数据来自:内存");
                        break;
                    case PERSISTENCE:
                        Logger.t(TAG).d("数据来自:磁盘缓存");
                        break;
                    default:
                        break;
                }
                return responseBodyReply.getData();
            })
            .map(ParseV9PronVideo::parseIndex);
}
 
Example #2
Source File: HttpLogger.java    From nongbeer-mvp-android-demo with Apache License 2.0 6 votes vote down vote up
@Override
public void log( String message ){
    final String logName = "OkHttp";
    if( !message.startsWith( "{" ) ){
        Log.d( logName, message );
        return;
    }
    try{
        String prettyPrintJson = new GsonBuilder()
                .setPrettyPrinting()
                .create()
                .toJson( new JsonParser().parse( message ) );
        Logger.init().methodCount( 1 ).hideThreadInfo();
        Logger.t( logName ).json( prettyPrintJson );
    }catch( JsonSyntaxException m ){
        Log.e( TAG, "html header parse failed" );
        m.printStackTrace();
        Log.e( logName, message );
    }
}
 
Example #3
Source File: PictureAdapter.java    From v9porn with MIT License 6 votes vote down vote up
@Override
public void destroyItem(@NonNull ViewGroup container, int position, @NonNull Object object) {
    FrameLayout view = (FrameLayout) object;
    for (int i = 0; i < view.getChildCount(); i++) {
        View childView = view.getChildAt(i);
        if (childView instanceof PhotoView) {
            childView.setOnClickListener(null);
            childView.setOnLongClickListener(null);
            GlideApp.with(container).clear(childView);
            view.removeViewAt(i);
            Logger.t(TAG).d("clean photoView");
        }
    }
    container.removeView(view);
    Logger.t(TAG).d("destroyItem");
}
 
Example #4
Source File: ConnectionManagerImpl.java    From landlord_client with Apache License 2.0 6 votes vote down vote up
public ConnectionManagerImpl(ConnectionInfo remoteInfo, ConnectionInfo localInfo) {
    super(remoteInfo, localInfo);
    isConnectionPermitted = true;
    isDisconnecting = false;
    String ip = "";
    String port = "";
    if (remoteInfo != null) {
        ip = remoteInfo.getIp();
        port = remoteInfo.getPort() + "";
    }
    Logger.d("block connection init with:" + ip + ":" + port);
    if (localInfo != null) {
        Logger.d("binding local addr:" + localInfo.getIp() + " port:" + localInfo.getPort());
    }
    s = new Semaphore(1);
}
 
Example #5
Source File: AbstractSlot.java    From Easer with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Change the satisfaction state of the current slot.
 * It will notify the corresponding {@link ryey.easer.core.Lotus} (by emitting {@link android.content.Intent} with {@link #notifyLotusData} as data) iif the satisfaction state is changed.
 *
 * This method sets the {@link #satisfied} variable.
 */
protected synchronized void changeSatisfiedState(boolean newSatisfiedState, Bundle dynamics) {
    if (satisfied != null) {
        if (persistent && satisfied && !newSatisfiedState) {
            Logger.v("prevent from resetting a persistent slot back to unsatisfied");
            return;
        }
        if (!retriggerable && (satisfied == newSatisfiedState)) {
            Logger.v("satisfied state is already %s", newSatisfiedState);
            return;
        }
    }
    satisfied = newSatisfiedState;
    //FIXME: remove the explicit use of core package (Lotus)
    Intent notifyLotusIntent = satisfied
            ? Lotus.NotifyIntentPrototype.obtainPositiveIntent(notifyLotusData)
            : Lotus.NotifyIntentPrototype.obtainNegativeIntent(notifyLotusData);
    notifyLotusIntent.putExtra(Lotus.EXTRA_DYNAMICS_PROPERTIES, dynamics);
    context.sendBroadcast(notifyLotusIntent);
    Logger.d("finished changeSatisfiedState to %s", newSatisfiedState);
}
 
Example #6
Source File: WorkWorldBrowersingFragment.java    From imsdk-android with MIT License 6 votes vote down vote up
public boolean onTouch(View v, MotionEvent event) {
    switch (event.getAction()) {
        case MotionEvent.ACTION_DOWN:
            isLongClick = false;
            isDraged = false;
            mx = 0;
            my = 0;
            x = event.getX();
            y = event.getY();
            break;
        case MotionEvent.ACTION_MOVE:
            mx = (int) (event.getRawX() - x);
            my = (int) (event.getRawY() - 50 - y);
            if(mx > 10 || my > 10){
                isDraged = true;
            }
            break;
        case MotionEvent.ACTION_UP:
            if(mx < 10 && my < 10 && !isLongClick && !isDraged){
                Logger.i("点击退出图片浏览GalleryFragment");
                getActivity().finish();
            }
            break;
    }
    return false;
}
 
Example #7
Source File: InviteBll.java    From PlayTogether with Apache License 2.0 6 votes vote down vote up
/**
 * 通过一个objectid获得一个invitation
 *
 * @param invitationId
 * @return
 */
public Observable<Invitation> getInvitationById(final String invitationId)
{
	return Observable.create(new Observable.OnSubscribe<Invitation>()
	{
		@Override
		public void call(Subscriber<? super Invitation> subscriber)
		{
			AVQuery<Invitation> query = AVObject.getQuery(Invitation.class);
			query.include(Invitation.FIELD_ACCEPT_INVITE_USERS);
			query.include(Invitation.FIELD_PIC);
			query.include(Invitation.FIELD_AUTHOR);
			try
			{
				Invitation invitation = query.get(invitationId);
				subscriber.onNext(invitation);
			} catch (AVException e)
			{
				Logger.e(e, "失败");
				e.printStackTrace();
				subscriber.onError(e);
			}
		}
	});
}
 
Example #8
Source File: AFCertificateUtil.java    From AFBaseLibrary with Apache License 2.0 6 votes vote down vote up
private static InputStream[] getCertificatesByAssert(Context context, String... certificateNames) {
    if (context == null) {
        Logger.d("context is empty");
        return null;
    }
    if (certificateNames == null) {
        Logger.d("certificate is empty");
        return null;
    }

    AssetManager assets = context.getAssets();
    InputStream[] certificates = new InputStream[certificateNames.length];
    for (int i = 0; i < certificateNames.length; i++) {
        String certificateName = certificateNames[i];
        try {
            certificates[i] = assets.open(certificateName);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
    return certificates;
}
 
Example #9
Source File: PictureFolderVu.java    From FlyWoo with Apache License 2.0 6 votes vote down vote up
public void setData(final List<PictureFolderEntity> list) {
    adapter = new PictureFolderAdapter(context, list);
    mListView.setAdapter(adapter);
    mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            Logger.i("setOnItemClickListener:" + position);
          //  BusProvider.getInstance().post(new ShowImageListEvent(list.get(position).images));
         //   EventBus.getDefault().post();
            if(mListView.getAdapter() instanceof PictureFolderAdapter) { //如果是文件夹
                setPictureList(list.get(position).images);
            }else {//如果是图片,点击返回
                mListView.setAdapter(adapter);
            }
        }
    });
}
 
Example #10
Source File: PictureSelectorAdapter.java    From imsdk-android with MIT License 6 votes vote down vote up
public void releaseDraweeView(){
    if(draweeViewList != null && draweeViewList.size() > 0){
        for (Map.Entry<String, SimpleDraweeView> entry : draweeViewList.entrySet()) {
            if(entry.getValue() != null && entry.getValue().getController() != null){
                if(entry.getValue() != null){
                    if(entry.getValue().getController() != null){
                        entry.getValue().getController().onDetach();
                    }
                    entry.getValue().setImageDrawable(null);
                    Logger.i("release cache");
                }
            }
        }
        draweeViewList.clear();
    }
    selectedImages.clear();
}
 
Example #11
Source File: BluetoothConnectManager.java    From AndroidBleManager with Apache License 2.0 6 votes vote down vote up
@Override
protected void onDeviceDisconnect(final BluetoothGatt gatt, int errorState) {
    //is bluetooth enable
    //可以不关闭,以便重用,因为在连接connect的时候可以快速连接
    if (!checkIsSamsung() || !mBluetoothUtils.isBluetoothIsEnable()){//三星手机断开后直接连接
        Logger.e( "Disconnected from GATT server address:"+gatt.getDevice().getAddress());
        close(gatt.getDevice().getAddress()); //防止出现status 133
    }else {
        updateConnectStateListener(gatt.getDevice().getAddress(), ConnectState.NORMAL);
    }

    //if disconnect by hand, so not run reconnect device
    runOnUiThread(new Runnable() {
        @Override
        public void run() {
            reconnectDevice(gatt.getDevice().getAddress()); //如果设备断开则指定时间后尝试重新连接,重新连接
        }
    });
}
 
Example #12
Source File: ApplicationAndroidStarter.java    From AndroidStarter with Apache License 2.0 6 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();
    sSharedApplication = this;

    Logger.init(TAG)
            .logLevel(LogLevel.FULL);

    buildComponent();

    mComponentApplication.inject(this);
    merlin.bind();

    final StrictMode.ThreadPolicy loStrictModeThreadPolicy = new StrictMode.ThreadPolicy.Builder()
            .detectAll()
            .penaltyDeath()
            .build();
    StrictMode.setThreadPolicy(loStrictModeThreadPolicy);
}
 
Example #13
Source File: SelectDateDialog.java    From SmartChart with Apache License 2.0 6 votes vote down vote up
private void setDays(int year, int month) {

        int day = 31;
        if (month == 4 || month == 6 || month == 9 || month == 11) {
            day = 30;
        } else if (month == 2) {
            if (isLeapYear(year)) {
                day = 29;
            } else {
                day = 28;
            }
        }

        dayData.clear();

        for (int i = 0; i < day; i++) {
            dayData.add((i + 1) + "");
        }

        Logger.i("ChooseDateDialog:setDays:>>>>>" + dayData.toString());
    }
 
Example #14
Source File: MyApplication.java    From PlayTogether with Apache License 2.0 6 votes vote down vote up
@Override
    public void onCreate() {
        super.onCreate();
        setTheme(R.style.SplashTheme);
//        BlockCanary.install(this, new AppBlockCanaryContext()).start();
        initLeanCloud();
        initChat();
        mApplicationComponent = DaggerApplicationComponent.builder()
                .apiModule(new ApiModule())
                .bllModule(new BllModule())
                .applicationModule(new ApplicationModule(this))
                .build();
        //leancloud所需要的参数
        initBean();
        initLeanCloud();
        //初始化log
        Logger.init("cat")
                .methodCount(2)
                .hideThreadInfo();
        initPicasso();

    }
 
Example #15
Source File: DownloadManager.java    From v9porn with MIT License 6 votes vote down vote up
public int startDownload(String url, final String path, boolean isDownloadNeedWifi, boolean isForceReDownload) {
    Logger.t(TAG).d("url::" + url);
    Logger.t(TAG).d("path::" + path);
    Logger.t(TAG).d("isDownloadNeedWifi::" + isDownloadNeedWifi);
    Logger.t(TAG).d("isForceReDownload::" + isForceReDownload);
    int id = FileDownloader.getImpl().create(url)
            .setPath(path)
            .setListener(lis)
            .setWifiRequired(isDownloadNeedWifi)
            .setAutoRetryTimes(3)
            .setForceReDownload(isForceReDownload)
            .asInQueueTask()
            .enqueue();
    FileDownloader.getImpl().start(lis, false);
    return id;
}
 
Example #16
Source File: MainActivity.java    From Meteorite with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("StatementWithEmptyBody")
@Override
public boolean onNavigationItemSelected(MenuItem item) {
    // Handle navigation view item clicks here.
    int id = item.getItemId();
    if (id == R.id.nav_home) {
    } else if (id == R.id.nav_about) {
        tv_content.setText("about");
        AboutActivity.start(this);
    } else if (id == R.id.nav_login) {
        WebActivity.loadUrl(this, "https://github.com/login", "登录GitHub");
    } else if (id == R.id.nav_set) {
        tv_content.setText("set");
    } else if (id == R.id.nav_comments) {
        FeedBackActivity.start(this);
    } else if (id == R.id.nav_logout) {
        finish();
    }
    Logger.d(tv_content.getText().toString());
    DrawerLayout drawer = findViewById(R.id.drawer_layout);
    drawer.closeDrawer(GravityCompat.START);
    return true;
}
 
Example #17
Source File: ImageImproveService.java    From GankApp with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 预解码图片并将抓到的图片尺寸保存至数据库
 *
 * @param realm   Realm 实例
 * @param image 图片
 * @return 是否保存成功
 */
private boolean saveToDb(Realm realm, Image image) {
    realm.beginTransaction();
    try {
        Point size = new Point();
        loadImageForSize(image.getUrl(),size);
        image.setHeight(size.y);
        image.setWidth(size.x);
        realm.copyToRealmOrUpdate(image);
    } catch (IOException e) {
        Logger.d("Failed to fetch image");
        realm.cancelTransaction();
        return false;
    }
    realm.commitTransaction();
    return true;
}
 
Example #18
Source File: IdentitySelectActivity.java    From imsdk-android with MIT License 6 votes vote down vote up
private void showSelect() {
    mAnonymousData = null;
    cacheIdentity = getIntent().getIntExtra(now_identity_type, 0);
    if (cacheIdentity == REAL_NAME) {
        identity_anonymous.setTextColor(getResources().getColor(R.color.send_no));
        identity_real.setTextColor(getResources().getColor(R.color.atom_ui_new_like_select));

    } else {
        try {
            identity_anonymous.setTextColor(getResources().getColor(R.color.atom_ui_new_like_select));
            identity_real.setTextColor(getResources().getColor(R.color.send_no));
            if (getIntent().hasExtra(ANONYMOUS_DATA)) {
                mAnonymousData = (AnonymousData) getIntent().getSerializableExtra(ANONYMOUS_DATA);
                anonymous_real_name.setText(getString(R.string.atom_ui_nickname) + ":" + mAnonymousData.getData().getAnonymous());
            }


        } catch (Exception e) {
            Logger.i("初始化花名出错");
        }

    }
}
 
Example #19
Source File: DownloadManager.java    From v9porn with MIT License 6 votes vote down vote up
public int startDownload(String url, final String path, boolean isDownloadNeedWifi, boolean isForceReDownload) {
    Logger.t(TAG).d("url::" + url);
    Logger.t(TAG).d("path::" + path);
    Logger.t(TAG).d("isDownloadNeedWifi::" + isDownloadNeedWifi);
    Logger.t(TAG).d("isForceReDownload::" + isForceReDownload);
    int id = FileDownloader.getImpl().create(url)
            .setPath(path)
            .setListener(lis)
            .setWifiRequired(isDownloadNeedWifi)
            .setAutoRetryTimes(3)
            .setForceReDownload(isForceReDownload)
            .asInQueueTask()
            .enqueue();
    FileDownloader.getImpl().start(lis, false);
    return id;
}
 
Example #20
Source File: DownloadingFragment.java    From v9porn with MIT License 5 votes vote down vote up
@Override
protected void onLazyLoadOnce() {
    super.onLazyLoadOnce();
    if (!FileDownloader.getImpl().isServiceConnected()) {
        FileDownloader.getImpl().bindService();
        Logger.t(TAG).d("启动下载服务");
    } else {
        presenter.loadDownloadingData();
        Logger.t(TAG).d("下载服务已经连接");
    }
}
 
Example #21
Source File: App.java    From xifan with Apache License 2.0 5 votes vote down vote up
private void init() {
    Router.initialize(this);

    Stetho.initializeWithDefaults(this);
    Logger.init(TAG)                 // default PRETTYLOGGER or use just init()
            .methodCount(1)                 // default 2
            .hideThreadInfo()               // default shown
            .logLevel(LogLevel.FULL)        // default LogLevel.FULL
            .methodOffset(2);            // default 0

    FIR.init(this);
    // 初始化参数依次为 this, AppId, AppKey
    AVOSCloud.initialize(this, Constants.AVOSCloud.APP_ID, Constants.AVOSCloud.APP_KEY);
    AVAnalytics.enableCrashReport(this, true);
}
 
Example #22
Source File: MainActivity.java    From RxjavaSample with MIT License 5 votes vote down vote up
/**
 * 需要:依次输入学生的姓名:将每个学生(实体对象)依次发射出去
 * RxJava解决方案:
 * {@link #method8()}
 */
private void method9() {
    //just(T...): 将传入的参数依次发送出来,实现遍历的目的
    Observable.from(DataFactory.getData())
            .subscribeOn(Schedulers.io())
            .observeOn(AndroidSchedulers.mainThread())
            .subscribe(new Action1<Student>() {
                @Override
                public void call(Student student) {
                    Logger.d("观察者:" + student.name);
                }
            });
}
 
Example #23
Source File: ConnectRequestQueue.java    From AndroidBleManager with Apache License 2.0 5 votes vote down vote up
/**
 * 断开蓝牙连接,不会释放BluetoothGatt持有的所有资源,可以调用mBluetoothGatt.connect()很快重新连接上
 * 如果不及时释放资源,可能出现133错误,http://www.loverobots.cn/android-ble-connection-solution-bluetoothgatt-status-133.html
 * @param address
 */
public void disconnect(String address){
    if (!isEmpty(address) && gattMap.containsKey(address)){
        Logger.w("disconnect gatt server " + address);
        BluetoothGatt mBluetoothGatt = gattMap.get(address);
        mBluetoothGatt.disconnect();
        updateConnectState(address, ConnectState.NORMAL);
    }
}
 
Example #24
Source File: DownloadingFragment.java    From v9porn with MIT License 5 votes vote down vote up
@Override
public void connected() {
    Logger.t(TAG).d("连接上下载服务");
    List<V9PornItem> v9PornItems = presenter.loadDownloadingDatas();
    for (V9PornItem v9PornItem : v9PornItems) {
        int status = FileDownloader.getImpl().getStatus(v9PornItem.getVideoResult().getVideoUrl(), v9PornItem.getDownLoadPath(presenter.getCustomDownloadVideoDirPath()));
        Logger.t(TAG).d("fix status:::" + status);
        if (status != v9PornItem.getStatus()) {
            v9PornItem.setStatus(status);
            presenter.updateV9PornItem(v9PornItem);
        }
    }
    presenter.loadDownloadingData();
}
 
Example #25
Source File: WorkWorldSpannableTextView.java    From imsdk-android with MIT License 5 votes vote down vote up
@Override
    public boolean onTouchEvent(MotionEvent event) {
        boolean result = super.onTouchEvent(event);
        Logger.i("点击事件:系统结果1:"+result);
        if(event.getAction()==MotionEvent.ACTION_DOWN){
            down = System.currentTimeMillis();
            Logger.i("点击事件:down:"+down);
        }else if(event.getAction()==MotionEvent.ACTION_UP){
            up = System.currentTimeMillis();
            Logger.i("点击事件:up:"+up);
            long rs = up -down;
            Logger.i("点击事件:rs:"+rs);
            Logger.i("点击事件:事件:"+workWorldLinkTouchMovementMethod);
            if(rs<=500){
                boolean methodResult = workWorldLinkTouchMovementMethod != null ? workWorldLinkTouchMovementMethod.isPressedSpan() : result;
                Logger.i("点击事件:methodResult:"+methodResult);
                return methodResult;
            }else{
                return result;
            }

        }

        Logger.i("点击事件:系统结果2:"+result);
//        return workWorldLinkTouchMovementMethod != null ? workWorldLinkTouchMovementMethod.isPressedSpan() : result;
        return result;
    }
 
Example #26
Source File: DetailActivity.java    From AndroidReview with GNU General Public License v3.0 5 votes vote down vote up
private void loadData() {
    //是否有缓存
    boolean hasCache = CacheHelper.isExistDataCache(this, CacheHelper.CONTENT_CACHE_KEY + mContent.getObjectId());
    //缓存是否过期
    boolean isCacheOverTiem = CacheHelper.isCacheDataFailure(this, CacheHelper.CONTENT_CACHE_KEY + mContent.getObjectId());
    //是否开启缓存过期设置
    boolean isOpenCacheOverTime = CacheHelper.isOpenCacheOverTime();
    //有网络并且有没缓存||有网络且有启动缓存过期设置且缓存过期  就请求网络数据 否则 读取缓存


    if (TDevice.hasInternet() && (!hasCache || (isOpenCacheOverTime && isCacheOverTiem))) {
        //从网络上读取数据
        loadDataByNet();
        Logger.e("detail_page hasCache : " + hasCache + "\n"
                + "detail_page isCacheOverTiem : " + isCacheOverTiem + "\n"
                + "detail_page isOpenCacheOverTime : " + isOpenCacheOverTime + "\n"
                + "detail_page request net");
    } else {
        //用AsynTask读取缓存
        readCache();
        Logger.e("detail_page hasCache : " + hasCache + "\n"
                + "detail_page isCacheOverTiem : " + isCacheOverTiem + "\n"
                + "detail_page isOpenCacheOverTime : " + isOpenCacheOverTime + "\n"
                + "detail_page readCache");
    }

}
 
Example #27
Source File: QimRNBModule.java    From imsdk-android with MIT License 5 votes vote down vote up
/**
 * 群角色管理
 * @param params
 * @param callback
 */
@ReactMethod
public void setGroupAdmin(ReadableMap params, Callback callback){
    Logger.i("setGroupAdmin:" + params.toString());
    String groupId = params.getString("groupId");
    String xmppid = params.getString("xmppid");
    String name = params.getString("name");
    boolean isAdmin = params.getBoolean("isAdmin");
    ConnectionUtil.getInstance().setGroupAdmin(groupId,xmppid,name,isAdmin);
}
 
Example #28
Source File: TestActivity.java    From Mobike with Apache License 2.0 5 votes vote down vote up
private void insertMessage2() {
    MyMessage r = new MyMessage();
    r.setClickUrl("https://prg.lp-game.com/cdnweb/sunplay050201/?uid=1909139792283648233927&from=singlemessage");
    r.setDecrdescription("一起和阳光玩游戏");
    r.setImgUrl("http://pic.qiantucdn.com/58pic/18/42/77/55825cab52849_1024.jpg");
    r.setTime("2017-05-09 00:00");
    r.save(new SaveListener<String>() {
        @Override
        public void done(String s, BmobException e) {
            Logger.d(s, e);
        }
    });
}
 
Example #29
Source File: WaitForNfcActivity.java    From Easer with GNU General Public License v3.0 5 votes vote down vote up
private void resolveIntent(Intent intent) {
    String action = intent.getAction();
    if (NfcAdapter.ACTION_TAG_DISCOVERED.equals(action)
            || NfcAdapter.ACTION_TECH_DISCOVERED.equals(action)
            || NfcAdapter.ACTION_NDEF_DISCOVERED.equals(action)) {
        Logger.d("NFC Tag detected");
        Tag tag = intent.getParcelableExtra(NfcAdapter.EXTRA_TAG);
        byte[] tag_id = tag.getId();
        Intent return_intent = new Intent();
        return_intent.putExtra(EXTRA_ID, tag_id);
        setResult(RESULT_OK, return_intent);
        Logger.v("result handed. finishing self");
        finish();
    }
}
 
Example #30
Source File: WebRtcClient.java    From imsdk-android with MIT License 5 votes vote down vote up
@Override
public void onAddStream(MediaStream mediaStream) {
    LogUtil.d(TAG, "onAddStream " + mediaStream.label());
    Logger.i(TAG + " onAddStream " + mediaStream.label());
    if(mListener != null)
        mListener.onAddRemoteStream(mediaStream);
}