本文整理匯總了Java中com.orhanobut.logger.Logger類的典型用法代碼示例。如果您正苦於以下問題:Java Logger類的具體用法?Java Logger怎麽用?Java Logger使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Logger類屬於com.orhanobut.logger包,在下文中一共展示了Logger類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: checkHide
import com.orhanobut.logger.Logger; //導入依賴的package包/類
/**
* 切換fragment(隱藏)
*/
protected final void checkHide(int viewId, int showIndex) {
List allFragment = bindFragment();
hideAllFrag(showIndex);
FragmentTransaction b = getSupportFragmentManager().beginTransaction();
if (showIndex >= allFragment.size()) {
Logger.e("showIndex >= allFragment.size():showIndex=" + showIndex + ",allFragment.size()=" + allFragment.size());
return;
}
Fragment fragment = (Fragment) allFragment.get(showIndex);
if (!fragment.isAdded()) {
b.add(viewId, fragment);
}
b.show(fragment);
b.commit();
}
示例2: stopScan
import com.orhanobut.logger.Logger; //導入依賴的package包/類
private void stopScan(){
if (scanOverListener != null){
scanOverListener.onScanOver();
}
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;
}
示例3: add
import com.orhanobut.logger.Logger; //導入依賴的package包/類
private void add(Credit cr) {
cr.update(new UpdateListener() {
@Override
public void done(BmobException e) {
if (e==null){
}else {
ToastUtils.show(RouteDetailActivity.this,"騎行記錄保存失敗");
Logger.d(e);
mDialog.dismiss();
}
}
});
}
示例4: initEvent
import com.orhanobut.logger.Logger; //導入依賴的package包/類
private void initEvent() {
bind.btnOk.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Set<Integer> list = bind.tfl.getSelectedList();
Logger.d(list);
if (list.isEmpty()) {
Toast.makeText(TypeActivity.this, R.string.toast_select_one_or_more_type, Toast.LENGTH_SHORT).show();
return;
}
// save selected types
BaseApplication.getRepertories().setTypes(list);
// start activity
if (presenter.isFirstSetting())
startActivity(new Intent(TypeActivity.this, MainActivity.class));
finish();
}
});
}
示例5: initView
import com.orhanobut.logger.Logger; //導入依賴的package包/類
@Override
protected void initView(Bundle savedInstanceState) {
super.initView(savedInstanceState);
setToolbarBackEnable();
Fragment temp = getSupportFragmentManager().findFragmentByTag(FRAGMENT_TAG);
if(temp == null){
mFragment = createFragment();
getSupportFragmentManager()
.beginTransaction()
.add(R.id.container, mFragment, FRAGMENT_TAG)
.commit();
Logger.d("temp fragment is null");
} else {
mFragment = (F) temp;
Logger.d("temp fragment not null");
}
}
示例6: startReconnectTask
import com.orhanobut.logger.Logger; //導入依賴的package包/類
/**
* can not reconnect all the time
*/
private synchronized void startReconnectTask(){
if (reconnectMap.size() <= 0) return;
long nextTime = SystemClock.elapsedRealtime()*2;
String address = "";
//select minimum time of list
for (String addr:reconnectMap.keySet()){
ReconnectParamsBean bean = reconnectMap.get(addr);
if (bean.getNextReconnectTime() < nextTime){
nextTime = bean.getNextReconnectTime();
address = addr;
}
}
//start reconnect task
if (!isEmpty(address)){
if (nextTime <= SystemClock.elapsedRealtime()){
Logger.d( "start reconnect device:"+address);
reconnectDevice(address);
}else{
Logger.d( "start reconnect device "+address+" after "+(nextTime - SystemClock.elapsedRealtime())/1000+" seconds");
getMainLooperHandler().removeCallbacks(reconnectTask);
getMainLooperHandler().postDelayed(reconnectTask, nextTime - SystemClock.elapsedRealtime());
}
}
}
示例7: insert
import com.orhanobut.logger.Logger; //導入依賴的package包/類
public void insert(QuestionModel questionModel) {
try {
this.open();
ContentValues cv = new ContentValues();
cv.put(questionDB.Question_Num, questionModel.getQuestionNum());
cv.put(questionDB.Question_Type, questionTypeToInt(questionModel.getQuestionType()));
cv.put(questionDB.Question_Done_Type, questionDoneTypeToInt(questionModel.getDone()));
cv.put(questionDB.Question_Catogory, questionModel.getCatogory());
cv.put(questionDB.Question_Text, questionModel.getQuestion());
cv.put(questionDB.Option_List, listToString(questionModel.getOptionList(), '#'));
cv.put(questionDB.Answer_List, listToString(questionModel.getAnswerList(), '#'));
cv.put(questionDB.isCollect, booleanToInt(questionModel.isCollected()));
cv.put(questionDB.isWrong, booleanToInt(questionModel.isWrong()));
db.insert(QuestionDB.TABLE_NAME, null, cv);
}catch (Exception e){
Logger.e(e);
}finally {
this.close();
}
}
示例8: loadData
import com.orhanobut.logger.Logger; //導入依賴的package包/類
/**
* 加載數據,測試
*/
public void loadData() {
view.showWaitingDialog();
getCompositeDisposable().add(AppDataManager.getInstance().getNews(1)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Consumer<NewsModel>() {
@Override
public void accept(NewsModel newsModel) throws Exception {
Logger.e("accept", "llll");
}
}, new Consumer<Throwable>() {
@Override
public void accept(Throwable throwable) throws Exception {
}
})
);
}
示例9: getMoreData
import com.orhanobut.logger.Logger; //導入依賴的package包/類
@Override
public void getMoreData() {
RetrofitService.getWelfarePhoto(mPage)
.compose(mTransformer)
.subscribe(new Subscriber<List<WelfarePhotoInfo>>() {
@Override
public void onCompleted() {
}
@Override
public void onError(Throwable e) {
Logger.e(e.toString());
mView.loadNoData();
}
@Override
public void onNext(List<WelfarePhotoInfo> photoList) {
mView.loadMoreData(photoList);
mPage++;
}
});
}
示例10: displayImage
import com.orhanobut.logger.Logger; //導入依賴的package包/類
private void displayImage() {
BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true; // 對圖片進行設置 但不形成示例,不耗費內存
BitmapFactory.decodeFile(mImageFile.getPath(), options);
int imageRequestWidth = getRequestImeWidth();
int imageRequestHeight = getRequestImeHeight(options);
Logger.d("width " + imageRequestWidth + " height:" + imageRequestHeight);
Logger.d("bitmap1 width " + options.outWidth + " height:" + options.outHeight);
Glide.with(mView.getActivity())
.load(mImageFile)
.asBitmap()
.override(imageRequestWidth, imageRequestHeight) // 設置大小
.fitCenter() // 不按照比例
.into(new SimpleTarget<Bitmap>() {
@Override
public void onResourceReady(Bitmap resource, GlideAnimation<? super Bitmap> glideAnimation) {
//根據Bitmap對象創建ImageSpan對象
Logger.d("bitmap width:" + resource.getWidth() + " height:" + resource.getHeight());
mView.insertImage(mImageName, resource);
}
});
}
示例11: setPhotoViewScaleScheme
import com.orhanobut.logger.Logger; //導入依賴的package包/類
private void setPhotoViewScaleScheme(MotionEvent e) {
try {
float scale = mAttacher.getScale();
float x = e.getX();
float y = e.getY();
if (scale < mAttacher.getMediumScale()) {
mAttacher.setScale(
mAttacher.getMediumScale(), x, y, true);
} else {
mAttacher.setScale(1.0f, x, y, true);
}
} catch (ArrayIndexOutOfBoundsException vr) {
Logger.e(vr.getMessage());
}
}
示例12: _handleCheckedChanged
import com.orhanobut.logger.Logger; //導入依賴的package包/類
/**
* 處理選中事件
* @param position
* @param isChecked
*/
protected void _handleCheckedChanged(int position, boolean isChecked) {
if (position == INVALID_POS) {
Logger.i(position + "" + isChecked);
return;
}
mSparseItemChecked.put(position, isChecked);
int checkedCount = 0;
int checkedStatus;
for (int i = 0; i < getItemCount(); i++) {
if (mSparseItemChecked.get(i, false)) {
checkedCount++;
}
}
if (checkedCount == 0) {
checkedStatus = VideoEvent.CHECK_NONE;
} else if (checkedCount == getItemCount()) {
checkedStatus = VideoEvent.CHECK_ALL;
} else {
checkedStatus = VideoEvent.CHECK_SOME;
}
// 通知 DownloadActivity 更新界麵
mRxBus.post(new VideoEvent(checkedStatus));
}
示例13: onCreate
import com.orhanobut.logger.Logger; //導入依賴的package包/類
@Override
public void onCreate() {
super.onCreate();
MultiDex.install(this);
Logger.addLogAdapter(new AndroidLogAdapter() {
@Override
public boolean isLoggable(int priority, String tag) {
return BuildConfig.DEBUG;
}
});
Hawk.init(getBaseContext()).build();
CalligraphyConfig.initDefault(new CalligraphyConfig.Builder()
.setDefaultFontPath("fonts/lato_regular.ttf")
.setFontAttrId(R.attr.fontPath)
.build()
);
}
示例14: parseData
import com.orhanobut.logger.Logger; //導入依賴的package包/類
/**
* 數據解析方法
*
* @param data 要解析的數據
* @param clazz 解析類
* @param bodyType 解析數據類型
* @param onResultListener 回調方數據接口
*/
@SuppressWarnings("unchecked")
private void parseData(String data, Class clazz, @DataType.Type int bodyType, OnResultListener onResultListener) {
switch (bodyType) {
case DataType.STRING:
onResultListener.onSuccess(data);
break;
case DataType.JSON_OBJECT:
onResultListener.onSuccess(DataParseUtil.parseObject(data, clazz));
break;
case DataType.JSON_ARRAY:
onResultListener.onSuccess(DataParseUtil.parseToArrayList(data, clazz));
break;
case DataType.XML:
onResultListener.onSuccess(DataParseUtil.parseXml(data, clazz));
break;
default:
Logger.e("http parse tip:", "if you want return object, please use bodyType() set data type");
break;
}
}
示例15: initApplication
import com.orhanobut.logger.Logger; //導入依賴的package包/類
private void initApplication() {
//初始化日誌
Logger.init(getPackageName()).hideThreadInfo();
//初始化錯誤收集
// CrashHandler.init(new CrashHandler(getApplicationContext()));
initBugly();
//初始化內存泄漏檢測
LeakCanary.install(App.getInstance());
//初始化過度繪製檢測
BlockCanary.install(getApplicationContext(), new AppBlockCanaryContext()).start();
//初始化tbs x5 webview
QbSdk.allowThirdPartyAppDownload(true);
QbSdk.initX5Environment(getApplicationContext(), QbSdk.WebviewInitType.FIRSTUSE_AND_PRELOAD, new QbSdk.PreInitCallback() {
@Override
public void onCoreInitFinished() {
}
@Override
public void onViewInitFinished(boolean b) {
}
});
}