Java Code Examples for com.orhanobut.logger.Logger#d()

The following examples show how to use com.orhanobut.logger.Logger#d() . 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: 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 2
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 3
Source File: CycledLeScanner.java    From AndroidBleManager with Apache License 2.0 6 votes vote down vote up
private void stopScan(){
    if (mScanning) {
        BluetoothAdapter mAdapter = mBluetoothUtils.getBluetoothAdapter();
        if (mAdapter != null && mBluetoothUtils.isBluetoothIsEnable()) {
            try {
                BluetoothLeScannerCompat.stopScan(mAdapter, scanCallbackCompat);
                lastScanEndTime = SystemClock.elapsedRealtime();
                Logger.d("stopping bluetooth le scan "+lastScanEndTime);
            } catch (Exception e) {
                Logger.w("Internal Android exception scanning for beacons "+e.toString());
            }
        } else {
            Logger.d("Bluetooth is disabled.  Cannot scan for beacons.");
        }
        nextScanStartTime = SystemClock.elapsedRealtime() + betweenScanPeriod;
        //start next scan cycle
        if (!isPauseScan){
            scanLeDevice(true);
        }
    }
    mScanning = false;
    //// FIXME: 2017/6/22 将其调整到mScanning后面
    if (scanOverListener != null){
        scanOverListener.onScanOver();
    }
}
 
Example 4
Source File: ConnectRequestQueue.java    From AndroidBleManager with Apache License 2.0 6 votes vote down vote up
/**
 * trigger reconnect task
 */
private void triggerReconnect(String mac){
    //if deviceQueue is null, start reconnect
    if (deviceQueue.size() == 0){
        //将重连的设备全部放入重连队列
        for (String key:macMap.keySet()){
            if (macMap.get(key) == ConnectState.NORMAL){
                ReconnectParamsBean bean;
                if (!reconnectMap.containsKey(key)){
                    bean = new ReconnectParamsBean(key);
                    reconnectMap.put(key, bean);
                }else if(key.equals(mac)){
                    bean = reconnectMap.get(key);
                    bean.addNumber();
                    Logger.d( "trigger reconnect, reconnect after "+(bean.getNextReconnectTime() - SystemClock.elapsedRealtime())/1000+" seconds");
                }
            }
        }

        startReconnectTask();
    }
}
 
Example 5
Source File: SubFragment.java    From Meteorite with Apache License 2.0 6 votes vote down vote up
@Override
protected void initData() {
    calendar.setTime(new Date());
    presenter = new SubPresenter(this);
    switch (position){
        case 0:
            presenter.dealEveryDay(String.valueOf(calendar.get(Calendar.YEAR)),String.valueOf(calendar.get(Calendar.MONTH)+1),String.valueOf(calendar.get(Calendar.DATE)));
            banner.setVisibility(View.VISIBLE);
            break;
        case 1:
            type = "福利";
            presenter.dealContent(type,pageIndex,pageSize);
            break;
        case 2:
            type = "Android";
            presenter.dealContent(type,pageIndex,pageSize);
            break;
        case 3:
            type = "iOS";
            presenter.dealContent(type,pageIndex,pageSize);
            break;
    }
    hideLoading();
    textView.setText(tabName + " " + position + " 界面加载完毕");
    Logger.d("position="+String.valueOf(position));
}
 
Example 6
Source File: BaseActivity.java    From AndroidReview with GNU General Public License v3.0 5 votes vote down vote up
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        onBeforeSetContentLayout();
        //禁止横屏
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
        AppManager.getAppManager().addActivity(this);
//        隐藏ToolBar
//        hideToolBar();
        Logger.d("当前Activity 栈中有:" + AppManager.getAppManager().getActivityCount() + "个Activity");
    }
 
Example 7
Source File: CalendarTracker.java    From Easer with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onReceive(Context context, Intent intent) {
    Logger.d("Intent received. action: %s", intent.getAction());
    if (intent.getAction().equals(ACTION_UPDATE)) {
        updateTracker();
    }
}
 
Example 8
Source File: BluetoothScanManager.java    From AndroidBleManager with Apache License 2.0 5 votes vote down vote up
public static BluetoothScanManager getInstance(Context context){
    if (INSTANCE == null){
        synchronized (obj){
            if (INSTANCE == null){
                Logger.d("BluetoothScanManager instance creation");
                INSTANCE = new BluetoothScanManager(context);
            }
        }
    }
    return INSTANCE;
}
 
Example 9
Source File: Downloader.java    From OpenHub with GNU General Public License v3.0 5 votes vote down vote up
private void checkStatus() {
    //cause SQLiteException at 乐视 LE X820 Android 6.0.1,level 23
    try{
        DownloadManager.Query query = new DownloadManager.Query();
        query.setFilterById(downloadId);
        Cursor c = downloadManager.query(query);
        if (c.moveToFirst()) {
            int status = c.getInt(c.getColumnIndex(DownloadManager.COLUMN_STATUS));
            switch (status) {
                case DownloadManager.STATUS_PAUSED:
                    break;
                case DownloadManager.STATUS_PENDING:
                    break;
                case DownloadManager.STATUS_RUNNING:
                    break;
                case DownloadManager.STATUS_SUCCESSFUL:
                    String tip = mContext.getString(R.string.download_complete)
                            .concat("\n").concat(getFilePath());
                    Toasty.success(mContext, tip).show();
                    unregister();
                    break;
                case DownloadManager.STATUS_FAILED:
                    Toasty.error(mContext, mContext.getString(R.string.download_failed)).show();
                    unregister();
                    break;
            }
        }
        c.close();
    }catch (SQLiteException e){
        Logger.d(e);
        unregister();
    }

}
 
Example 10
Source File: EventLotus.java    From Easer with GNU General Public License v3.0 5 votes vote down vote up
private boolean checkAndSetCooldown(String eventName) {
    if (cooldownInMillisecond > 0) {
        Calendar now = Calendar.getInstance();
        if (lastSatisfied != null) {
            if (now.getTimeInMillis() - lastSatisfied.getTimeInMillis() < cooldownInMillisecond) {
                Logger.d("event <%s> is within cooldown time", eventName);
                return false;
            }
        }
        Logger.d("event <%s> is not within cooldown time", eventName);
        lastSatisfied = now;
        return true;
    }
    return true;
}
 
Example 11
Source File: ActivityZipEncrypt.java    From RxTools-master with Apache License 2.0 5 votes vote down vote up
@OnClick({R.id.btn_create_folder, R.id.btn_zip})
public void onViewClicked(View view) {
    switch (view.getId()) {
        case R.id.btn_create_folder:
            fileDir = new File(RxFileTool.getRootPath().getAbsolutePath() + File.separator + "RxTools");
            if (!fileDir.exists()) {
                fileDir.mkdirs();
            }
            mTvState.setText("文件夹 RxTools 创建成功,文件夹位于在根目录");
            break;
        case R.id.btn_zip:
            File fileZip = new File(RxFileTool.getRootPath().getAbsolutePath() + File.separator + "RxTools.zip");
            if (fileZip.exists()) {
                RxFileTool.deleteFile(fileZip);
                Logger.d("导出文件已存在,将之删除");
            }

            if (fileDir != null) {
                if (fileDir.exists()) {
                    String result = RxZipTool.zipEncrypt(fileDir.getAbsolutePath(), fileZip.getAbsolutePath(), true, "123456");
                    mTvState.setText("压缩并加密成功,路径" + result);
                } else {
                    RxToast.error("导出的文件不存在");
                }
            } else {
                RxToast.error("导出的文件不存在");
            }
            break;
    }
}
 
Example 12
Source File: ConnectionManagerImpl.java    From landlord_client with Apache License 2.0 5 votes vote down vote up
public synchronized void connect() {
    Logger.d("Thread name:" + Thread.currentThread().getName() + " id:" + Thread.currentThread().getId());
    if (isConnectionPermitted) {
        isConnectionPermitted = false;
        if (!isConnect()) {
            isDisconnecting = false;
            if (mRemoteConnectionInfo == null) {
                isConnectionPermitted = true;
                throw new UnConnectException("连接参数为空,检查连接参数");
            } else {
                if (mActionHandler != null) {
                    mActionHandler.detach(this);
                    Logger.d("mActionHandler is detached.");
                }

                mActionHandler = new ActionHandler();
                mActionHandler.attach(this, this);
                Logger.d("mActionHandler is attached.");
                if (mReconnectionManager != null) {
                    mReconnectionManager.detach();
                    Logger.d("ReconnectionManager is detached.");
                }

                mReconnectionManager = mOptions.getReconnectionManager();
                if (mReconnectionManager != null) {
                    mReconnectionManager.attach(this);
                    Logger.d("ReconnectionManager is attached.");
                }

                String info = mRemoteConnectionInfo.getIp() + ":" + mRemoteConnectionInfo.getPort();
                mConnectThread = new ConnectionManagerImpl.ConnectionThread(" Connect thread for " + info);
                mConnectThread.setDaemon(true);
                mConnectThread.start();
            }
        }
    }
}
 
Example 13
Source File: WriteLogUtil.java    From CoordinatorLayoutExample with Apache License 2.0 5 votes vote down vote up
/**
 * 调试信息
 *
 * @param TAG
 * @param msg
 */
public final static void d(String TAG, String msg) {
    if(!isDShow){
        return;
    }
    Logger.d(TAG, msg);
    if (LOG_WRITE_TO_FILE)
        writeLogtoFile("d", TAG, msg);
}
 
Example 14
Source File: FindFragment.java    From POCenter with MIT License 5 votes vote down vote up
@Override
public void loadMore() {
    // disable refresh when load more
    bind.vContent.setEnabled(false);

    presenter.loadMore(findAdapter.getData().size());
    Logger.d("start load more");
}
 
Example 15
Source File: PermissionOutlineFragment.java    From Easer with GNU General Public License v3.0 5 votes vote down vote up
boolean hasAllRequiredPermissions() {
    final boolean logging = SettingsUtils.logging(getContext());
    boolean satisfied = true;
    for (Object obj_plugin : LocalSkillRegistry.getInstance().all().getEnabledSkills(getContext())) {
        Skill plugin = (Skill) obj_plugin;
        if (plugin.checkPermissions(getContext()) == Boolean.FALSE) {
            Logger.d("Permission for plugin <%s> not satisfied", plugin.id());
            if (!logging)
                return false;
            satisfied = false;
        }
    }
    return satisfied;
}
 
Example 16
Source File: MainActivity.java    From AndroidBasicProject with MIT License 4 votes vote down vote up
@Override public void onFirst() {
    super.onFirst();
    Logger.d("onFirst只有第一次才会执行");
    //这里可以做一些界面功能引导
}
 
Example 17
Source File: AppStatusTracker.java    From Meteorite with Apache License 2.0 4 votes vote down vote up
@Override
public void onActivityPaused(Activity activity) {
    Logger.d(activity.getClass().getSimpleName(),"onActivityPaused");
}
 
Example 18
Source File: CycledLeScanner.java    From AndroidBleManager with Apache License 2.0 4 votes vote down vote up
/**
 * Tells the cycler the scan rate and whether it is in operating in background mode.
 * Background mode flag  is used only with the Android 5.0 scanning implementations to switch
 * between LOW_POWER_MODE vs. LOW_LATENCY_MODE
 * @param backgroundFlag is running background
 */
public void setBackgroundMode(long scanPeriod, long betweenScanPeriod, boolean backgroundFlag) {
    if (android.os.Build.VERSION.SDK_INT < 18) {
        Logger.w("Not supported prior to API 18.  Method invocation will be ignored");
        return;
    }

    this.scanPeriod = scanPeriod;
    this.betweenScanPeriod = betweenScanPeriod;
    if (backgroundFlag != mBackgroundFlag) {
        Logger.d("restart polling task scanPeriod:" + scanPeriod + " betweenScanPeriod:" + betweenScanPeriod + " backgroundFlag:" + backgroundFlag + " mode:" + mBackgroundFlag);
        mBackgroundFlag = backgroundFlag;
        long now = SystemClock.elapsedRealtime();

        //update next scan start time(在等待开始扫描时修正下一次开始时间,提前开始)
        if (nextScanStartTime > now){
            long proposedNextScanStartTime = lastScanEndTime + betweenScanPeriod;
            if (proposedNextScanStartTime < nextScanStartTime){
                Logger.d("Waiting...Adjusted nextScanStartTime to be" + (proposedNextScanStartTime - now) + " old:" + (nextScanStartTime - now));
                nextScanStartTime = proposedNextScanStartTime;
            }
        }

        //update current scan stop time(如果在扫描中则修正本次的结束时间,提前结束)
        if (scanStopTime > now){
            long proposedStopTime = nextScanStartTime + scanPeriod;
            if (proposedStopTime < scanStopTime){
                Logger.d("Scanning...Adjusted scanStopTime to be " + (proposedStopTime - now) + " old:" + (scanStopTime - now));
                scanStopTime = proposedStopTime;
            }
        }

        //set scan setting params
        if (!isSetScanSetting || scanSettings == null){
            if (mBackgroundFlag) {
                Logger.d("starting filtered scan in SCAN_MODE_LOW_POWER");
                scanSettings = (new ScanSettingsCompat.Builder().setScanMode(ScanSettingsCompat.SCAN_MODE_LOW_POWER)).build();
            } else {
                Logger.d("starting non-filtered scan in SCAN_MODE_LOW_LATENCY");
                scanSettings = (new ScanSettingsCompat.Builder().setScanMode(ScanSettingsCompat.SCAN_MODE_LOW_LATENCY)).build();
            }
        }
    }
}
 
Example 19
Source File: FutureListAdapter.java    From easyweather with MIT License 4 votes vote down vote up
public FutureListAdapter(List<FutureContext> futureList) {
    this.futureList = futureList;
    Logger.d(futureList.size());
}
 
Example 20
Source File: DownloadManager.java    From v9porn with MIT License 4 votes vote down vote up
@Override
protected void completed(BaseDownloadTask task) {
    Logger.t(TAG).d("completed:" + "--status:" + task.getStatus() + "--:soFarBytes:" + task.getSmallFileSoFarBytes() + "--:totalBytes:" + task.getSmallFileTotalBytes());
    Logger.d("completed");
    saveDownloadInfo(task);
}