library-Logger 重命名
This commit is contained in:
@@ -11,9 +11,8 @@ import com.chwl.library.common.application.BaseApp
|
|||||||
import com.chwl.library.common.delegate.SpDelegate
|
import com.chwl.library.common.delegate.SpDelegate
|
||||||
import com.chwl.library.common.file.FileHelper
|
import com.chwl.library.common.file.FileHelper
|
||||||
import com.chwl.library.common.glide.GlideEngine
|
import com.chwl.library.common.glide.GlideEngine
|
||||||
import com.chwl.library.common.util.Logger
|
import com.chwl.library.common.util.LibLogger
|
||||||
import com.chwl.library.easyphoto.EasyPhotos
|
import com.chwl.library.easyphoto.EasyPhotos
|
||||||
import com.chwl.library.easyphoto.constant.Type.*
|
|
||||||
import com.chwl.library.easyphoto.models.album.entity.Photo
|
import com.chwl.library.easyphoto.models.album.entity.Photo
|
||||||
import com.chwl.library.utils.TimeUtils
|
import com.chwl.library.utils.TimeUtils
|
||||||
import com.chwl.library.utils.TimeUtils.TIME_FORMAT
|
import com.chwl.library.utils.TimeUtils.TIME_FORMAT
|
||||||
@@ -160,7 +159,7 @@ object PhotoProvider {
|
|||||||
val path = "$foldPath${it.name}"
|
val path = "$foldPath${it.name}"
|
||||||
if (FileHelper.copyFileFromUri(it.uri, path, true)) {
|
if (FileHelper.copyFileFromUri(it.uri, path, true)) {
|
||||||
newPaths.add(path)
|
newPaths.add(path)
|
||||||
Logger.debug(TAG, "path: ${it.path} , displayName: ${it.name} , newPath: $path ")
|
LibLogger.debug(TAG, "path: ${it.path} , displayName: ${it.name} , newPath: $path ")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -174,7 +173,7 @@ object PhotoProvider {
|
|||||||
* 清除复制缓存
|
* 清除复制缓存
|
||||||
*/
|
*/
|
||||||
fun clearCache() {
|
fun clearCache() {
|
||||||
Logger.debug(
|
LibLogger.debug(
|
||||||
TAG, "clearCache => mLastSelectTime: ${TimeUtils.getDateTimeString(
|
TAG, "clearCache => mLastSelectTime: ${TimeUtils.getDateTimeString(
|
||||||
mLastSelectTime, TIME_FORMAT)}")
|
mLastSelectTime, TIME_FORMAT)}")
|
||||||
FileHelper.removeAllFile(getInternalPath() + File.separator)
|
FileHelper.removeAllFile(getInternalPath() + File.separator)
|
||||||
|
@@ -14,7 +14,7 @@ import java.io.FileNotFoundException;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
|
||||||
import com.chwl.library.common.util.Logger;
|
import com.chwl.library.common.util.LibLogger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by wushaocheng
|
* Created by wushaocheng
|
||||||
@@ -41,7 +41,7 @@ public class BitmapUtil {
|
|||||||
|
|
||||||
final int height = options.outHeight;
|
final int height = options.outHeight;
|
||||||
final int width = options.outWidth;
|
final int width = options.outWidth;
|
||||||
Logger.info(TAG, "origin, w= " + width + " h=" + height);
|
LibLogger.info(TAG, "origin, w= " + width + " h=" + height);
|
||||||
int inSampleSize = 1;
|
int inSampleSize = 1;
|
||||||
|
|
||||||
if (height > reqHeight || width > reqWidth) {
|
if (height > reqHeight || width > reqWidth) {
|
||||||
@@ -54,13 +54,13 @@ public class BitmapUtil {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger.info(TAG, "sampleSize:" + inSampleSize);
|
LibLogger.info(TAG, "sampleSize:" + inSampleSize);
|
||||||
return inSampleSize;
|
return inSampleSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Bitmap setImgSize(Bitmap bm, float newWidth, float newHeight) {
|
public static Bitmap setImgSize(Bitmap bm, float newWidth, float newHeight) {
|
||||||
if (bm == null) {
|
if (bm == null) {
|
||||||
Logger.error(TAG, "bitmap is null.");
|
LibLogger.error(TAG, "bitmap is null.");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
// 获得图片的宽高.
|
// 获得图片的宽高.
|
||||||
|
@@ -8,8 +8,6 @@ import android.content.Intent
|
|||||||
import android.text.TextUtils
|
import android.text.TextUtils
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.View.OnLongClickListener
|
import android.view.View.OnLongClickListener
|
||||||
import androidx.core.content.ContextCompat
|
|
||||||
import androidx.core.view.isVisible
|
|
||||||
import androidx.databinding.DataBindingUtil
|
import androidx.databinding.DataBindingUtil
|
||||||
import androidx.fragment.app.activityViewModels
|
import androidx.fragment.app.activityViewModels
|
||||||
import androidx.fragment.app.viewModels
|
import androidx.fragment.app.viewModels
|
||||||
@@ -18,35 +16,26 @@ import com.chwl.app.UIHelper
|
|||||||
import com.chwl.app.application.IReportConstants
|
import com.chwl.app.application.IReportConstants
|
||||||
import com.chwl.app.application.ReportManager
|
import com.chwl.app.application.ReportManager
|
||||||
import com.chwl.app.avroom.activity.AVRoomActivity
|
import com.chwl.app.avroom.activity.AVRoomActivity
|
||||||
import com.chwl.app.avroom.fragment.RoomRankDialogUtils
|
|
||||||
import com.chwl.app.base.BaseActivity
|
import com.chwl.app.base.BaseActivity
|
||||||
import com.chwl.app.base.BaseFragment
|
import com.chwl.app.base.BaseFragment
|
||||||
import com.chwl.app.base.list.LineColorDecoration
|
|
||||||
import com.chwl.app.databinding.FragmentMeBinding
|
import com.chwl.app.databinding.FragmentMeBinding
|
||||||
import com.chwl.app.earn.activity.EarnRecordActivity
|
|
||||||
import com.chwl.app.home.HomeViewModel
|
import com.chwl.app.home.HomeViewModel
|
||||||
import com.chwl.app.home.MeViewModel
|
import com.chwl.app.home.MeViewModel
|
||||||
import com.chwl.app.home.activity.AssociationActivity
|
import com.chwl.app.home.activity.AssociationActivity
|
||||||
import com.chwl.app.home.adapter.MeCenterAdapter
|
import com.chwl.app.home.adapter.MeCenterAdapter
|
||||||
import com.chwl.app.home.helper.BannerHelper
|
|
||||||
import com.chwl.app.home.helper.OpenRoomHelper
|
import com.chwl.app.home.helper.OpenRoomHelper
|
||||||
import com.chwl.app.module_hall.hall.activity.ModuleClanActivity
|
import com.chwl.app.module_hall.hall.activity.ModuleClanActivity
|
||||||
import com.chwl.app.module_hall.hall.activity.ModuleHallActivity
|
import com.chwl.app.module_hall.hall.activity.ModuleHallActivity
|
||||||
import com.chwl.app.pay.activity.GiveGoldActivity
|
|
||||||
import com.chwl.app.ui.im.RouterHandler
|
import com.chwl.app.ui.im.RouterHandler
|
||||||
import com.chwl.app.ui.pay.ChargeActivity
|
import com.chwl.app.ui.pay.ChargeActivity
|
||||||
import com.chwl.app.ui.relation.AttentionListActivity
|
import com.chwl.app.ui.relation.AttentionListActivity
|
||||||
import com.chwl.app.ui.relation.FansListActivity
|
import com.chwl.app.ui.relation.FansListActivity
|
||||||
import com.chwl.app.ui.utils.ImageLoadUtils
|
import com.chwl.app.ui.utils.ImageLoadUtils
|
||||||
import com.chwl.app.ui.utils.ImageLoadUtilsV2
|
|
||||||
import com.chwl.app.ui.utils.load
|
|
||||||
import com.chwl.app.ui.webview.CommonWebViewActivity
|
import com.chwl.app.ui.webview.CommonWebViewActivity
|
||||||
import com.chwl.app.vip.VipMainActivity
|
import com.chwl.app.vip.VipMainActivity
|
||||||
import com.chwl.app.vip.VipViewModel
|
import com.chwl.app.vip.VipViewModel
|
||||||
import com.chwl.core.Constants
|
|
||||||
import com.chwl.core.UriProvider
|
import com.chwl.core.UriProvider
|
||||||
import com.chwl.core.auth.AuthModel
|
import com.chwl.core.auth.AuthModel
|
||||||
import com.chwl.core.initial.InitialModel
|
|
||||||
import com.chwl.core.level.UserLevelVo
|
import com.chwl.core.level.UserLevelVo
|
||||||
import com.chwl.core.manager.IMNetEaseManager
|
import com.chwl.core.manager.IMNetEaseManager
|
||||||
import com.chwl.core.manager.RelationShipEvent
|
import com.chwl.core.manager.RelationShipEvent
|
||||||
@@ -63,7 +52,6 @@ import com.chwl.core.user.event.LoginUserInfoUpdateEvent
|
|||||||
import com.chwl.core.utils.CoreLogger
|
import com.chwl.core.utils.CoreLogger
|
||||||
import com.chwl.core.utils.StarUtils
|
import com.chwl.core.utils.StarUtils
|
||||||
import com.chwl.library.common.util.DeviceUtil
|
import com.chwl.library.common.util.DeviceUtil
|
||||||
import com.chwl.library.utils.AppMetaDataUtil
|
|
||||||
import com.chwl.library.utils.FormatUtils
|
import com.chwl.library.utils.FormatUtils
|
||||||
import com.example.lib_utils.ktx.singleClick
|
import com.example.lib_utils.ktx.singleClick
|
||||||
import org.greenrobot.eventbus.EventBus
|
import org.greenrobot.eventbus.EventBus
|
||||||
|
@@ -18,7 +18,7 @@ import java.util.List;
|
|||||||
|
|
||||||
import com.chwl.library.common.fragmentation.ISupportActivity;
|
import com.chwl.library.common.fragmentation.ISupportActivity;
|
||||||
import com.chwl.library.common.fragmentation.SupportActivityDelegate;
|
import com.chwl.library.common.fragmentation.SupportActivityDelegate;
|
||||||
import com.chwl.library.common.util.Logger;
|
import com.chwl.library.common.util.LibLogger;
|
||||||
import com.chwl.library.common.util.ViewBindingUtil;
|
import com.chwl.library.common.util.ViewBindingUtil;
|
||||||
|
|
||||||
public abstract class BaseActivity<VB extends ViewBinding> extends AppCompatActivity implements ISupportActivity {
|
public abstract class BaseActivity<VB extends ViewBinding> extends AppCompatActivity implements ISupportActivity {
|
||||||
@@ -34,7 +34,7 @@ public abstract class BaseActivity<VB extends ViewBinding> extends AppCompatActi
|
|||||||
super.onActivityResult(requestCode, resultCode, data);
|
super.onActivityResult(requestCode, resultCode, data);
|
||||||
this.handleFragmentActivityResult(this.getSupportFragmentManager(), requestCode, resultCode, data);
|
this.handleFragmentActivityResult(this.getSupportFragmentManager(), requestCode, resultCode, data);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Logger.error(TAG, "onActivityResult", e);
|
LibLogger.error(TAG, "onActivityResult", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -88,7 +88,7 @@ public abstract class BaseActivity<VB extends ViewBinding> extends AppCompatActi
|
|||||||
super.onResume();
|
super.onResume();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
callUpActivity();
|
callUpActivity();
|
||||||
Logger.error(TAG, "onResume", e);
|
LibLogger.error(TAG, "onResume", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -103,7 +103,7 @@ public abstract class BaseActivity<VB extends ViewBinding> extends AppCompatActi
|
|||||||
field.setAccessible(true);
|
field.setAccessible(true);
|
||||||
field.setBoolean(this, true);
|
field.setBoolean(this, true);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Logger.error(TAG, "callUpActivity", e);
|
LibLogger.error(TAG, "callUpActivity", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -126,7 +126,7 @@ public abstract class BaseActivity<VB extends ViewBinding> extends AppCompatActi
|
|||||||
try {
|
try {
|
||||||
super.onSaveInstanceState(outState);
|
super.onSaveInstanceState(outState);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Logger.error(TAG, "onSaveInstanceState", e);
|
LibLogger.error(TAG, "onSaveInstanceState", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -168,7 +168,7 @@ public abstract class BaseActivity<VB extends ViewBinding> extends AppCompatActi
|
|||||||
try {
|
try {
|
||||||
return super.dispatchTouchEvent(ev);
|
return super.dispatchTouchEvent(ev);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Logger.error(TAG, "dispatchTouchEvent", e);
|
LibLogger.error(TAG, "dispatchTouchEvent", e);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -19,7 +19,7 @@ import com.chwl.library.common.fragmentation.ISupportFragment;
|
|||||||
import com.chwl.library.common.fragmentation.SupportFragmentDelegate;
|
import com.chwl.library.common.fragmentation.SupportFragmentDelegate;
|
||||||
import com.chwl.library.common.fragmentation.windowcallback.WindowCallbackProxyUtil;
|
import com.chwl.library.common.fragmentation.windowcallback.WindowCallbackProxyUtil;
|
||||||
import com.chwl.library.common.util.ActivityHelper;
|
import com.chwl.library.common.util.ActivityHelper;
|
||||||
import com.chwl.library.common.util.Logger;
|
import com.chwl.library.common.util.LibLogger;
|
||||||
import com.chwl.library.common.util.ViewBindingUtil;
|
import com.chwl.library.common.util.ViewBindingUtil;
|
||||||
|
|
||||||
public abstract class BaseDialogFragment<VB extends ViewBinding> extends DialogFragment implements ISupportFragment {
|
public abstract class BaseDialogFragment<VB extends ViewBinding> extends DialogFragment implements ISupportFragment {
|
||||||
@@ -146,7 +146,7 @@ public abstract class BaseDialogFragment<VB extends ViewBinding> extends DialogF
|
|||||||
super.show(manager, tag);
|
super.show(manager, tag);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Logger.error(TAG, "show", e);
|
LibLogger.error(TAG, "show", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -7,7 +7,7 @@ import androidx.lifecycle.LifecycleObserver;
|
|||||||
import androidx.lifecycle.LifecycleOwner;
|
import androidx.lifecycle.LifecycleOwner;
|
||||||
import com.chwl.library.R;
|
import com.chwl.library.R;
|
||||||
|
|
||||||
import com.chwl.library.common.util.Logger;
|
import com.chwl.library.common.util.LibLogger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* author: wushaocheng
|
* author: wushaocheng
|
||||||
@@ -25,11 +25,11 @@ public class BaseViewTag {
|
|||||||
*/
|
*/
|
||||||
public static void registerLifecycle(View view) {
|
public static void registerLifecycle(View view) {
|
||||||
if (view == null) {
|
if (view == null) {
|
||||||
Logger.warn(TAG, "registerLifecycle view is null");
|
LibLogger.warn(TAG, "registerLifecycle view is null");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!(view instanceof LifecycleObserver)) {
|
if (!(view instanceof LifecycleObserver)) {
|
||||||
Logger.warn(TAG, "registerLifecycle view: " + view.getClass().getSimpleName() + ", view must implements LifecycleObserver");
|
LibLogger.warn(TAG, "registerLifecycle view: " + view.getClass().getSimpleName() + ", view must implements LifecycleObserver");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
view.post(new Runnable() {
|
view.post(new Runnable() {
|
||||||
@@ -58,7 +58,7 @@ public class BaseViewTag {
|
|||||||
}
|
}
|
||||||
register(view, view.getContext());
|
register(view, view.getContext());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Logger.error(TAG, "registerLifecycle view: " + view.getClass().getSimpleName() + ", error", e);
|
LibLogger.error(TAG, "registerLifecycle view: " + view.getClass().getSimpleName() + ", error", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -72,11 +72,11 @@ public class BaseViewTag {
|
|||||||
*/
|
*/
|
||||||
private static void register(View view, Object owner) {
|
private static void register(View view, Object owner) {
|
||||||
if (view == null) {
|
if (view == null) {
|
||||||
Logger.warn(TAG, "registerLifecycle view is null");
|
LibLogger.warn(TAG, "registerLifecycle view is null");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (owner == null) {
|
if (owner == null) {
|
||||||
Logger.warn(TAG, "registerLifecycle owner is null");
|
LibLogger.warn(TAG, "registerLifecycle owner is null");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
@@ -84,12 +84,12 @@ public class BaseViewTag {
|
|||||||
LifecycleOwner lifecycleOwner = (LifecycleOwner) owner;
|
LifecycleOwner lifecycleOwner = (LifecycleOwner) owner;
|
||||||
lifecycleOwner.getLifecycle().addObserver((LifecycleObserver) view);//核心代码
|
lifecycleOwner.getLifecycle().addObserver((LifecycleObserver) view);//核心代码
|
||||||
view.setTag(BaseViewTag.TAG_NAME, owner);
|
view.setTag(BaseViewTag.TAG_NAME, owner);
|
||||||
Logger.debug(TAG, "registerLifecycle view: " + view.getClass().getSimpleName() + ", owner: " + owner.getClass().getSimpleName());
|
LibLogger.debug(TAG, "registerLifecycle view: " + view.getClass().getSimpleName() + ", owner: " + owner.getClass().getSimpleName());
|
||||||
} else {
|
} else {
|
||||||
Logger.warn(TAG, "registerLifecycle view:" + view.getClass().getSimpleName() + ", owner is not instanceof LifecycleOwner");
|
LibLogger.warn(TAG, "registerLifecycle view:" + view.getClass().getSimpleName() + ", owner is not instanceof LifecycleOwner");
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Logger.error(TAG, "registerLifecycle view: " + view.getClass().getSimpleName() + ", owner: " + owner.getClass().getSimpleName() + ", error", e);
|
LibLogger.error(TAG, "registerLifecycle view: " + view.getClass().getSimpleName() + ", owner: " + owner.getClass().getSimpleName() + ", error", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -101,19 +101,19 @@ public class BaseViewTag {
|
|||||||
*/
|
*/
|
||||||
public static void unRegisterLifecycle(View view, LifecycleOwner owner) {
|
public static void unRegisterLifecycle(View view, LifecycleOwner owner) {
|
||||||
if (view == null) {
|
if (view == null) {
|
||||||
Logger.warn(TAG, "unRegisterLifecycle view is null");
|
LibLogger.warn(TAG, "unRegisterLifecycle view is null");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (owner == null) {
|
if (owner == null) {
|
||||||
Logger.warn(TAG, "unRegisterLifecycle owner is null");
|
LibLogger.warn(TAG, "unRegisterLifecycle owner is null");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
view.setTag(BaseViewTag.TAG_NAME, null);
|
view.setTag(BaseViewTag.TAG_NAME, null);
|
||||||
owner.getLifecycle().removeObserver((LifecycleObserver) view);
|
owner.getLifecycle().removeObserver((LifecycleObserver) view);
|
||||||
Logger.debug(TAG, "unRegisterLifecycle view: " + view.getClass().getSimpleName() + ", owner: " + owner.getClass().getSimpleName());
|
LibLogger.debug(TAG, "unRegisterLifecycle view: " + view.getClass().getSimpleName() + ", owner: " + owner.getClass().getSimpleName());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Logger.error(TAG, "unRegisterLifecycle view: " + view.getClass().getSimpleName() + ", owner: " + owner.getClass().getSimpleName() + ", error", e);
|
LibLogger.error(TAG, "unRegisterLifecycle view: " + view.getClass().getSimpleName() + ", owner: " + owner.getClass().getSimpleName() + ", error", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -7,7 +7,7 @@ import android.text.TextUtils;
|
|||||||
|
|
||||||
import com.qiniu.android.utils.StringUtils;
|
import com.qiniu.android.utils.StringUtils;
|
||||||
import com.chwl.library.common.application.BaseApp;
|
import com.chwl.library.common.application.BaseApp;
|
||||||
import com.chwl.library.common.util.Logger;
|
import com.chwl.library.common.util.LibLogger;
|
||||||
import com.chwl.library.utils.FP;
|
import com.chwl.library.utils.FP;
|
||||||
|
|
||||||
import java.io.BufferedInputStream;
|
import java.io.BufferedInputStream;
|
||||||
@@ -829,7 +829,7 @@ public class FileHelper {
|
|||||||
try {
|
try {
|
||||||
return streamToBytes(new FileInputStream(file));
|
return streamToBytes(new FileInputStream(file));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Logger.error(TAG, String.valueOf(e));
|
LibLogger.error(TAG, String.valueOf(e));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
@@ -858,20 +858,20 @@ public class FileHelper {
|
|||||||
content = null;
|
content = null;
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Logger.error(TAG, String.valueOf(e));
|
LibLogger.error(TAG, String.valueOf(e));
|
||||||
} finally {
|
} finally {
|
||||||
if (baos != null) {
|
if (baos != null) {
|
||||||
try {
|
try {
|
||||||
baos.close();
|
baos.close();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Logger.error(TAG, String.valueOf(e));
|
LibLogger.error(TAG, String.valueOf(e));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (bis != null) {
|
if (bis != null) {
|
||||||
try {
|
try {
|
||||||
bis.close();
|
bis.close();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Logger.error(TAG, String.valueOf(e));
|
LibLogger.error(TAG, String.valueOf(e));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -900,7 +900,7 @@ public class FileHelper {
|
|||||||
}
|
}
|
||||||
content = sb.toString();
|
content = sb.toString();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Logger.error(TAG, "getTxtFileContent read fail, e = " + e);
|
LibLogger.error(TAG, "getTxtFileContent read fail, e = " + e);
|
||||||
} finally {
|
} finally {
|
||||||
if (inputStream != null) {
|
if (inputStream != null) {
|
||||||
try {
|
try {
|
||||||
|
@@ -30,7 +30,7 @@ import com.bumptech.glide.request.target.Target
|
|||||||
import com.chwl.library.common.transform.AssignScaleTransformation
|
import com.chwl.library.common.transform.AssignScaleTransformation
|
||||||
import com.chwl.library.common.transform.ComplexTransformation
|
import com.chwl.library.common.transform.ComplexTransformation
|
||||||
import com.chwl.library.common.util.ActivityHelper
|
import com.chwl.library.common.util.ActivityHelper
|
||||||
import com.chwl.library.common.util.Logger
|
import com.chwl.library.common.util.LibLogger
|
||||||
import com.chwl.library.common.util.Utils
|
import com.chwl.library.common.util.Utils
|
||||||
import jp.wasabeef.glide.transformations.RoundedCornersTransformation
|
import jp.wasabeef.glide.transformations.RoundedCornersTransformation
|
||||||
import java.io.File
|
import java.io.File
|
||||||
@@ -51,7 +51,7 @@ class GlideUtils {
|
|||||||
vararg transformation: Transformation<Bitmap?>?
|
vararg transformation: Transformation<Bitmap?>?
|
||||||
) {
|
) {
|
||||||
if (imageView == null) {
|
if (imageView == null) {
|
||||||
Logger.error(TAG, "loadBytes imageView is null")
|
LibLogger.error(TAG, "loadBytes imageView is null")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
getGlideConfig(imageView.context)?.apply {
|
getGlideConfig(imageView.context)?.apply {
|
||||||
@@ -141,7 +141,7 @@ class GlideUtils {
|
|||||||
format: DecodeFormat
|
format: DecodeFormat
|
||||||
) {
|
) {
|
||||||
if (imageView == null) {
|
if (imageView == null) {
|
||||||
Logger.error(TAG, "loadFormat imageView is null")
|
LibLogger.error(TAG, "loadFormat imageView is null")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
getGlideConfig(imageView.context)?.apply {
|
getGlideConfig(imageView.context)?.apply {
|
||||||
@@ -159,7 +159,7 @@ class GlideUtils {
|
|||||||
format: DecodeFormat
|
format: DecodeFormat
|
||||||
) {
|
) {
|
||||||
if (imageView == null) {
|
if (imageView == null) {
|
||||||
Logger.error(TAG, "loadFormat imageView is null")
|
LibLogger.error(TAG, "loadFormat imageView is null")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
getGlideConfig(imageView.context)?.apply {
|
getGlideConfig(imageView.context)?.apply {
|
||||||
@@ -175,7 +175,7 @@ class GlideUtils {
|
|||||||
*/
|
*/
|
||||||
fun loadObjectFitCenter(path: Any, @DrawableRes errorRes: Int, imageView: ImageView?) {
|
fun loadObjectFitCenter(path: Any, @DrawableRes errorRes: Int, imageView: ImageView?) {
|
||||||
if (imageView == null) {
|
if (imageView == null) {
|
||||||
Logger.error(TAG, "loadObjectFitCenter imageView is null")
|
LibLogger.error(TAG, "loadObjectFitCenter imageView is null")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
getGlideConfig(imageView.context)?.apply {
|
getGlideConfig(imageView.context)?.apply {
|
||||||
@@ -190,7 +190,7 @@ class GlideUtils {
|
|||||||
*/
|
*/
|
||||||
fun loadObject(path: Any, imageView: ImageView?, @DrawableRes errorRes: Int) {
|
fun loadObject(path: Any, imageView: ImageView?, @DrawableRes errorRes: Int) {
|
||||||
if (imageView == null) {
|
if (imageView == null) {
|
||||||
Logger.error(TAG, "loadObject imageView is null")
|
LibLogger.error(TAG, "loadObject imageView is null")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
getGlideConfig(imageView.context)?.apply {
|
getGlideConfig(imageView.context)?.apply {
|
||||||
@@ -259,7 +259,7 @@ class GlideUtils {
|
|||||||
vararg transformation: Transformation<Bitmap?>?
|
vararg transformation: Transformation<Bitmap?>?
|
||||||
) {
|
) {
|
||||||
if (imageView == null) {
|
if (imageView == null) {
|
||||||
Logger.error(TAG, "loadObject imageView is null")
|
LibLogger.error(TAG, "loadObject imageView is null")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
getGlideConfig(imageView.context)?.apply {
|
getGlideConfig(imageView.context)?.apply {
|
||||||
@@ -279,7 +279,7 @@ class GlideUtils {
|
|||||||
*/
|
*/
|
||||||
fun loadUriCrossFade(uri: Uri, imageView: ImageView?) {
|
fun loadUriCrossFade(uri: Uri, imageView: ImageView?) {
|
||||||
if (imageView == null) {
|
if (imageView == null) {
|
||||||
Logger.error(TAG, "loadUriCrossFade imageView is null")
|
LibLogger.error(TAG, "loadUriCrossFade imageView is null")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
getGlideConfig(imageView.context)?.apply {
|
getGlideConfig(imageView.context)?.apply {
|
||||||
@@ -297,7 +297,7 @@ class GlideUtils {
|
|||||||
vararg transformation: Transformation<Bitmap?>?
|
vararg transformation: Transformation<Bitmap?>?
|
||||||
) {
|
) {
|
||||||
if (imageView == null) {
|
if (imageView == null) {
|
||||||
Logger.error(TAG, "loadResCrossFade imageView is null")
|
LibLogger.error(TAG, "loadResCrossFade imageView is null")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
getGlideConfig(imageView.context)?.apply {
|
getGlideConfig(imageView.context)?.apply {
|
||||||
@@ -317,7 +317,7 @@ class GlideUtils {
|
|||||||
vararg transformation: Transformation<Bitmap?>?
|
vararg transformation: Transformation<Bitmap?>?
|
||||||
) {
|
) {
|
||||||
if (imageView == null) {
|
if (imageView == null) {
|
||||||
Logger.error(TAG, "loadResCrossFade imageView is null")
|
LibLogger.error(TAG, "loadResCrossFade imageView is null")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
getGlideConfig(imageView.context)?.apply {
|
getGlideConfig(imageView.context)?.apply {
|
||||||
@@ -334,7 +334,7 @@ class GlideUtils {
|
|||||||
*/
|
*/
|
||||||
fun loadUriGift(uri: Uri, imageView: ImageView?) {
|
fun loadUriGift(uri: Uri, imageView: ImageView?) {
|
||||||
if (imageView == null) {
|
if (imageView == null) {
|
||||||
Logger.error(TAG, "loadUriGift imageView is null")
|
LibLogger.error(TAG, "loadUriGift imageView is null")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
getGlideConfig(imageView.context)?.apply {
|
getGlideConfig(imageView.context)?.apply {
|
||||||
@@ -348,7 +348,7 @@ class GlideUtils {
|
|||||||
*/
|
*/
|
||||||
fun loadUriGiftAndCrossFade(uri: Uri, imageView: ImageView?) {
|
fun loadUriGiftAndCrossFade(uri: Uri, imageView: ImageView?) {
|
||||||
if (imageView == null) {
|
if (imageView == null) {
|
||||||
Logger.error(TAG, "loadUriGift imageView is null")
|
LibLogger.error(TAG, "loadUriGift imageView is null")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
getGlideConfig(imageView.context)?.apply {
|
getGlideConfig(imageView.context)?.apply {
|
||||||
@@ -368,7 +368,7 @@ class GlideUtils {
|
|||||||
vararg transformation: Transformation<Bitmap?>?
|
vararg transformation: Transformation<Bitmap?>?
|
||||||
) {
|
) {
|
||||||
if (imageView == null) {
|
if (imageView == null) {
|
||||||
Logger.error(TAG, "loadCrossFade imageView is null")
|
LibLogger.error(TAG, "loadCrossFade imageView is null")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
getGlideConfig(imageView.context)?.apply {
|
getGlideConfig(imageView.context)?.apply {
|
||||||
@@ -390,7 +390,7 @@ class GlideUtils {
|
|||||||
vararg transformation: Transformation<Bitmap?>?
|
vararg transformation: Transformation<Bitmap?>?
|
||||||
) {
|
) {
|
||||||
if (imageView == null) {
|
if (imageView == null) {
|
||||||
Logger.error(TAG, "loadCrossFade imageView is null")
|
LibLogger.error(TAG, "loadCrossFade imageView is null")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
getGlideConfig(imageView.context)?.apply {
|
getGlideConfig(imageView.context)?.apply {
|
||||||
@@ -415,7 +415,7 @@ class GlideUtils {
|
|||||||
listener: RequestListener<Drawable>
|
listener: RequestListener<Drawable>
|
||||||
) {
|
) {
|
||||||
if (imageView == null) {
|
if (imageView == null) {
|
||||||
Logger.error(TAG, "loadCrossFade imageView is null")
|
LibLogger.error(TAG, "loadCrossFade imageView is null")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
getGlideConfig(imageView.context)?.apply {
|
getGlideConfig(imageView.context)?.apply {
|
||||||
@@ -438,7 +438,7 @@ class GlideUtils {
|
|||||||
priority: Priority
|
priority: Priority
|
||||||
) {
|
) {
|
||||||
if (imageView == null) {
|
if (imageView == null) {
|
||||||
Logger.error(TAG, "loadCrossFade imageView is null")
|
LibLogger.error(TAG, "loadCrossFade imageView is null")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
getGlideConfig(imageView.context)?.apply {
|
getGlideConfig(imageView.context)?.apply {
|
||||||
@@ -463,7 +463,7 @@ class GlideUtils {
|
|||||||
vararg transformation: Transformation<Bitmap?>?
|
vararg transformation: Transformation<Bitmap?>?
|
||||||
) {
|
) {
|
||||||
if (imageView == null) {
|
if (imageView == null) {
|
||||||
Logger.error(TAG, "loadCrossFade imageView is null")
|
LibLogger.error(TAG, "loadCrossFade imageView is null")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
getGlideConfig(imageView.context)?.apply {
|
getGlideConfig(imageView.context)?.apply {
|
||||||
@@ -503,7 +503,7 @@ class GlideUtils {
|
|||||||
priority: Priority
|
priority: Priority
|
||||||
) {
|
) {
|
||||||
if (imageView == null) {
|
if (imageView == null) {
|
||||||
Logger.error(TAG, "loadPriority imageView is null")
|
LibLogger.error(TAG, "loadPriority imageView is null")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
getGlideConfig(imageView.context)?.apply {
|
getGlideConfig(imageView.context)?.apply {
|
||||||
@@ -562,7 +562,7 @@ class GlideUtils {
|
|||||||
vararg transformation: Transformation<Bitmap?>?
|
vararg transformation: Transformation<Bitmap?>?
|
||||||
) {
|
) {
|
||||||
if (imageView == null) {
|
if (imageView == null) {
|
||||||
Logger.error(TAG, "loadPriority imageView is null")
|
LibLogger.error(TAG, "loadPriority imageView is null")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
getGlideConfig(imageView.context)?.apply {
|
getGlideConfig(imageView.context)?.apply {
|
||||||
@@ -583,7 +583,7 @@ class GlideUtils {
|
|||||||
priority: Priority
|
priority: Priority
|
||||||
) {
|
) {
|
||||||
if (imageView == null) {
|
if (imageView == null) {
|
||||||
Logger.error(TAG, "loadPriority imageView is null")
|
LibLogger.error(TAG, "loadPriority imageView is null")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
getGlideConfig(imageView.context)?.apply {
|
getGlideConfig(imageView.context)?.apply {
|
||||||
@@ -616,7 +616,7 @@ class GlideUtils {
|
|||||||
*/
|
*/
|
||||||
fun loadResBySize(imageView: ImageView?, @DrawableRes resId: Int, width: Int, height: Int) {
|
fun loadResBySize(imageView: ImageView?, @DrawableRes resId: Int, width: Int, height: Int) {
|
||||||
if (imageView == null) {
|
if (imageView == null) {
|
||||||
Logger.error(TAG, "loadSquareIcon imageView is null")
|
LibLogger.error(TAG, "loadSquareIcon imageView is null")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
getGlideConfig(imageView.context)?.apply {
|
getGlideConfig(imageView.context)?.apply {
|
||||||
@@ -744,7 +744,7 @@ class GlideUtils {
|
|||||||
vararg transformation: Transformation<Bitmap?>?
|
vararg transformation: Transformation<Bitmap?>?
|
||||||
) {
|
) {
|
||||||
if (imageView == null) {
|
if (imageView == null) {
|
||||||
Logger.error(TAG, "loadLocalFile imageView is null")
|
LibLogger.error(TAG, "loadLocalFile imageView is null")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
val file = File(filePath)
|
val file = File(filePath)
|
||||||
@@ -771,7 +771,7 @@ class GlideUtils {
|
|||||||
height: Int
|
height: Int
|
||||||
) {
|
) {
|
||||||
if (imageView == null) {
|
if (imageView == null) {
|
||||||
Logger.error(TAG, "loadLocalFile imageView is null")
|
LibLogger.error(TAG, "loadLocalFile imageView is null")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
val file = File(filePath)
|
val file = File(filePath)
|
||||||
@@ -813,7 +813,7 @@ class GlideUtils {
|
|||||||
if (imageView == null)
|
if (imageView == null)
|
||||||
return
|
return
|
||||||
if (TextUtils.isEmpty(filePath)) {
|
if (TextUtils.isEmpty(filePath)) {
|
||||||
Logger.error(TAG, "loadLocalFile url is empty.")
|
LibLogger.error(TAG, "loadLocalFile url is empty.")
|
||||||
getGlideConfig(imageView.context)?.apply {
|
getGlideConfig(imageView.context)?.apply {
|
||||||
this
|
this
|
||||||
.load(defaultDrawable)
|
.load(defaultDrawable)
|
||||||
@@ -840,7 +840,7 @@ class GlideUtils {
|
|||||||
@DrawableRes defaultRes: Int,
|
@DrawableRes defaultRes: Int,
|
||||||
) {
|
) {
|
||||||
if (imageView == null) {
|
if (imageView == null) {
|
||||||
Logger.error(TAG, "loadRoundIcon imageView is null")
|
LibLogger.error(TAG, "loadRoundIcon imageView is null")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
getGlideConfig(imageView.context)?.apply {
|
getGlideConfig(imageView.context)?.apply {
|
||||||
@@ -859,7 +859,7 @@ class GlideUtils {
|
|||||||
// 加载圆形本地头像
|
// 加载圆形本地头像
|
||||||
fun loadRoundIcon(resId: Int, imageView: ImageView?) {
|
fun loadRoundIcon(resId: Int, imageView: ImageView?) {
|
||||||
if (imageView == null) {
|
if (imageView == null) {
|
||||||
Logger.error(TAG, "loadRoundIcon imageView is null")
|
LibLogger.error(TAG, "loadRoundIcon imageView is null")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
getGlideConfig(imageView.context)?.apply {
|
getGlideConfig(imageView.context)?.apply {
|
||||||
@@ -908,7 +908,7 @@ class GlideUtils {
|
|||||||
*/
|
*/
|
||||||
fun loadGiftRes(@DrawableRes resId: Int, imageView: ImageView?) {
|
fun loadGiftRes(@DrawableRes resId: Int, imageView: ImageView?) {
|
||||||
if (imageView == null) {
|
if (imageView == null) {
|
||||||
Logger.error(TAG, "loadGiftRes imageView is null")
|
LibLogger.error(TAG, "loadGiftRes imageView is null")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
getGlideConfig(imageView.context)?.apply {
|
getGlideConfig(imageView.context)?.apply {
|
||||||
@@ -925,7 +925,7 @@ class GlideUtils {
|
|||||||
anim: Int
|
anim: Int
|
||||||
) {
|
) {
|
||||||
if (imageView == null) {
|
if (imageView == null) {
|
||||||
Logger.error(TAG, "loadGiftRes imageView is null")
|
LibLogger.error(TAG, "loadGiftRes imageView is null")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
getGlideConfig(imageView.context)?.apply {
|
getGlideConfig(imageView.context)?.apply {
|
||||||
@@ -940,7 +940,7 @@ class GlideUtils {
|
|||||||
*/
|
*/
|
||||||
fun loadGift(url: String?, imageView: ImageView?) {
|
fun loadGift(url: String?, imageView: ImageView?) {
|
||||||
if (imageView == null) {
|
if (imageView == null) {
|
||||||
Logger.error(TAG, "loadGif imageView is null")
|
LibLogger.error(TAG, "loadGif imageView is null")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
getGlideConfig(imageView.context)?.apply {
|
getGlideConfig(imageView.context)?.apply {
|
||||||
@@ -960,7 +960,7 @@ class GlideUtils {
|
|||||||
imageView: ImageView?
|
imageView: ImageView?
|
||||||
) {
|
) {
|
||||||
if (imageView == null) {
|
if (imageView == null) {
|
||||||
Logger.error(TAG, "loadGif imageView is null")
|
LibLogger.error(TAG, "loadGif imageView is null")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
getGlideConfig(imageView.context)?.apply {
|
getGlideConfig(imageView.context)?.apply {
|
||||||
@@ -984,7 +984,7 @@ class GlideUtils {
|
|||||||
callBack: IGlideLoaderCallBack?
|
callBack: IGlideLoaderCallBack?
|
||||||
) {
|
) {
|
||||||
if (imageView == null) {
|
if (imageView == null) {
|
||||||
Logger.error(TAG, "loadGifImage imageView is null")
|
LibLogger.error(TAG, "loadGifImage imageView is null")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
val builder = ComplexTransformation.ComplexParamsBuilder()
|
val builder = ComplexTransformation.ComplexParamsBuilder()
|
||||||
@@ -1007,7 +1007,7 @@ class GlideUtils {
|
|||||||
target: Target<Drawable?>,
|
target: Target<Drawable?>,
|
||||||
isFirstResource: Boolean
|
isFirstResource: Boolean
|
||||||
): Boolean {
|
): Boolean {
|
||||||
Logger.error(TAG, "loadGifImage url:$url, onException:$e")
|
LibLogger.error(TAG, "loadGifImage url:$url, onException:$e")
|
||||||
callBack?.onError()
|
callBack?.onError()
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
@@ -1039,7 +1039,7 @@ class GlideUtils {
|
|||||||
callBack: IGlideLoaderCallBack?
|
callBack: IGlideLoaderCallBack?
|
||||||
) {
|
) {
|
||||||
if (imageView == null) {
|
if (imageView == null) {
|
||||||
Logger.error(TAG, "loadAssignScaleImage imageView is null")
|
LibLogger.error(TAG, "loadAssignScaleImage imageView is null")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
getGlideConfig(imageView.context)?.apply {
|
getGlideConfig(imageView.context)?.apply {
|
||||||
@@ -1055,7 +1055,7 @@ class GlideUtils {
|
|||||||
target: Target<Drawable?>,
|
target: Target<Drawable?>,
|
||||||
isFirstResource: Boolean
|
isFirstResource: Boolean
|
||||||
): Boolean {
|
): Boolean {
|
||||||
Logger.error(
|
LibLogger.error(
|
||||||
TAG,
|
TAG,
|
||||||
"loadAssignScaleImage url:$url, onException:$e"
|
"loadAssignScaleImage url:$url, onException:$e"
|
||||||
)
|
)
|
||||||
@@ -1084,7 +1084,7 @@ class GlideUtils {
|
|||||||
*/
|
*/
|
||||||
fun loadCircleImage(url: String?, @DrawableRes resId: Int, imageView: ImageView?) {
|
fun loadCircleImage(url: String?, @DrawableRes resId: Int, imageView: ImageView?) {
|
||||||
if (imageView == null) {
|
if (imageView == null) {
|
||||||
Logger.error(TAG, "loadCircleImage imageView is null")
|
LibLogger.error(TAG, "loadCircleImage imageView is null")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
getGlideConfig(imageView.context)?.apply {
|
getGlideConfig(imageView.context)?.apply {
|
||||||
@@ -1106,7 +1106,7 @@ class GlideUtils {
|
|||||||
imageView: ImageView?
|
imageView: ImageView?
|
||||||
) {
|
) {
|
||||||
if (imageView == null) {
|
if (imageView == null) {
|
||||||
Logger.error(TAG, "loadHalfConnerImage imageView is null")
|
LibLogger.error(TAG, "loadHalfConnerImage imageView is null")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
getGlideConfig(imageView.context)?.apply {
|
getGlideConfig(imageView.context)?.apply {
|
||||||
@@ -1133,7 +1133,7 @@ class GlideUtils {
|
|||||||
imageView: ImageView?
|
imageView: ImageView?
|
||||||
) {
|
) {
|
||||||
if (imageView == null) {
|
if (imageView == null) {
|
||||||
Logger.error(TAG, "ImageLoader ImageView is null")
|
LibLogger.error(TAG, "ImageLoader ImageView is null")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
getGlideConfig(imageView.context)?.apply {
|
getGlideConfig(imageView.context)?.apply {
|
||||||
@@ -1153,7 +1153,7 @@ class GlideUtils {
|
|||||||
// 加载本地资源图片
|
// 加载本地资源图片
|
||||||
fun loadLocalRes(@DrawableRes resId: Int, imageView: ImageView?) {
|
fun loadLocalRes(@DrawableRes resId: Int, imageView: ImageView?) {
|
||||||
if (imageView == null) {
|
if (imageView == null) {
|
||||||
Logger.error(TAG, "loadLocalRes imageView is null")
|
LibLogger.error(TAG, "loadLocalRes imageView is null")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
getGlideConfig(imageView.context)?.apply {
|
getGlideConfig(imageView.context)?.apply {
|
||||||
@@ -1174,7 +1174,7 @@ class GlideUtils {
|
|||||||
format: DecodeFormat
|
format: DecodeFormat
|
||||||
) {
|
) {
|
||||||
if (imageView == null) {
|
if (imageView == null) {
|
||||||
Logger.error(TAG, "loadLocalRes imageView is null")
|
LibLogger.error(TAG, "loadLocalRes imageView is null")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
getGlideConfig(imageView.context)?.apply {
|
getGlideConfig(imageView.context)?.apply {
|
||||||
@@ -1197,7 +1197,7 @@ class GlideUtils {
|
|||||||
vararg transformation: Transformation<Bitmap?>?
|
vararg transformation: Transformation<Bitmap?>?
|
||||||
) {
|
) {
|
||||||
if (imageView == null) {
|
if (imageView == null) {
|
||||||
Logger.error(TAG, "loadLocalRes imageView is null")
|
LibLogger.error(TAG, "loadLocalRes imageView is null")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
getGlideConfig(imageView.context)?.apply {
|
getGlideConfig(imageView.context)?.apply {
|
||||||
@@ -1211,7 +1211,7 @@ class GlideUtils {
|
|||||||
// 加载Assets图片
|
// 加载Assets图片
|
||||||
fun loadAssetsImg(path: String?, imageView: ImageView?) {
|
fun loadAssetsImg(path: String?, imageView: ImageView?) {
|
||||||
if (imageView == null || TextUtils.isEmpty(path)) {
|
if (imageView == null || TextUtils.isEmpty(path)) {
|
||||||
Logger.error(TAG, "loadAssetsImg path is invalid or imageView is null")
|
LibLogger.error(TAG, "loadAssetsImg path is invalid or imageView is null")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
getGlideConfig(imageView.context)?.apply {
|
getGlideConfig(imageView.context)?.apply {
|
||||||
@@ -1226,7 +1226,7 @@ class GlideUtils {
|
|||||||
*/
|
*/
|
||||||
fun loadResCenterCrop(@DrawableRes resId: Int, imageView: ImageView?) {
|
fun loadResCenterCrop(@DrawableRes resId: Int, imageView: ImageView?) {
|
||||||
if (imageView == null) {
|
if (imageView == null) {
|
||||||
Logger.error(TAG, "loadResScale imageView is null")
|
LibLogger.error(TAG, "loadResScale imageView is null")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
getGlideConfig(imageView.context)?.apply {
|
getGlideConfig(imageView.context)?.apply {
|
||||||
@@ -1241,7 +1241,7 @@ class GlideUtils {
|
|||||||
*/
|
*/
|
||||||
fun loadResFitCenter(@DrawableRes resId: Int, imageView: ImageView?) {
|
fun loadResFitCenter(@DrawableRes resId: Int, imageView: ImageView?) {
|
||||||
if (imageView == null) {
|
if (imageView == null) {
|
||||||
Logger.error(TAG, "loadResFitCenter imageView is null")
|
LibLogger.error(TAG, "loadResFitCenter imageView is null")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
getGlideConfig(imageView.context)?.apply {
|
getGlideConfig(imageView.context)?.apply {
|
||||||
@@ -1257,7 +1257,7 @@ class GlideUtils {
|
|||||||
*/
|
*/
|
||||||
fun loadFitCenter(url: String, imageView: ImageView?) {
|
fun loadFitCenter(url: String, imageView: ImageView?) {
|
||||||
if (imageView == null) {
|
if (imageView == null) {
|
||||||
Logger.error(TAG, " loadFitCenter imageViw is null")
|
LibLogger.error(TAG, " loadFitCenter imageViw is null")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
getGlideConfig(imageView.context)?.apply {
|
getGlideConfig(imageView.context)?.apply {
|
||||||
@@ -1274,7 +1274,7 @@ class GlideUtils {
|
|||||||
*/
|
*/
|
||||||
fun loadFitCenter(url: String?, @DrawableRes errorRes: Int, imageView: ImageView?) {
|
fun loadFitCenter(url: String?, @DrawableRes errorRes: Int, imageView: ImageView?) {
|
||||||
if (imageView == null) {
|
if (imageView == null) {
|
||||||
Logger.error(TAG, " loadFitCenter imageViw is null")
|
LibLogger.error(TAG, " loadFitCenter imageViw is null")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
getGlideConfig(imageView.context)?.apply {
|
getGlideConfig(imageView.context)?.apply {
|
||||||
@@ -1322,7 +1322,7 @@ class GlideUtils {
|
|||||||
vararg transformation: Transformation<Bitmap?>?
|
vararg transformation: Transformation<Bitmap?>?
|
||||||
) {
|
) {
|
||||||
if (imageView == null) {
|
if (imageView == null) {
|
||||||
Logger.error(TAG, "load imageViw is null")
|
LibLogger.error(TAG, "load imageViw is null")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
getGlideConfig(imageView.context)?.apply {
|
getGlideConfig(imageView.context)?.apply {
|
||||||
@@ -1344,7 +1344,7 @@ class GlideUtils {
|
|||||||
vararg transformation: Transformation<Bitmap?>?
|
vararg transformation: Transformation<Bitmap?>?
|
||||||
) {
|
) {
|
||||||
if (imageView == null) {
|
if (imageView == null) {
|
||||||
Logger.error(TAG, "load imageViw is null")
|
LibLogger.error(TAG, "load imageViw is null")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
getGlideConfig(imageView.context)?.apply {
|
getGlideConfig(imageView.context)?.apply {
|
||||||
@@ -1368,7 +1368,7 @@ class GlideUtils {
|
|||||||
listener: RequestListener<File?>?
|
listener: RequestListener<File?>?
|
||||||
) {
|
) {
|
||||||
if (context == null) {
|
if (context == null) {
|
||||||
Logger.error(TAG, "load context is null")
|
LibLogger.error(TAG, "load context is null")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1381,7 +1381,7 @@ class GlideUtils {
|
|||||||
*/
|
*/
|
||||||
fun load(url: String?, imageView: ImageView?, listener: RequestListener<Drawable>) {
|
fun load(url: String?, imageView: ImageView?, listener: RequestListener<Drawable>) {
|
||||||
if (imageView == null || TextUtils.isEmpty(url)) {
|
if (imageView == null || TextUtils.isEmpty(url)) {
|
||||||
Logger.error(TAG, "load imageViw is null")
|
LibLogger.error(TAG, "load imageViw is null")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
getGlideConfig(imageView.context)?.apply {
|
getGlideConfig(imageView.context)?.apply {
|
||||||
@@ -1401,7 +1401,7 @@ class GlideUtils {
|
|||||||
listener: RequestListener<Bitmap?>
|
listener: RequestListener<Bitmap?>
|
||||||
) {
|
) {
|
||||||
if (imageView == null || TextUtils.isEmpty(url)) {
|
if (imageView == null || TextUtils.isEmpty(url)) {
|
||||||
Logger.error(TAG, "load imageViw is null")
|
LibLogger.error(TAG, "load imageViw is null")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
getGlideConfig(imageView.context)?.apply {
|
getGlideConfig(imageView.context)?.apply {
|
||||||
@@ -1413,7 +1413,7 @@ class GlideUtils {
|
|||||||
//加载图片,无默认图片
|
//加载图片,无默认图片
|
||||||
fun load(url: String?, imageView: ImageView?) {
|
fun load(url: String?, imageView: ImageView?) {
|
||||||
if (imageView == null || TextUtils.isEmpty(url)) {
|
if (imageView == null || TextUtils.isEmpty(url)) {
|
||||||
Logger.error(TAG, "load url is invalid or imageViw is null")
|
LibLogger.error(TAG, "load url is invalid or imageViw is null")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
getGlideConfig(imageView.context)?.apply {
|
getGlideConfig(imageView.context)?.apply {
|
||||||
@@ -1426,7 +1426,7 @@ class GlideUtils {
|
|||||||
//加载图片,无默认图片
|
//加载图片,无默认图片
|
||||||
fun loadWithError(url: String?, errorDrawable: Int, imageView: ImageView?) {
|
fun loadWithError(url: String?, errorDrawable: Int, imageView: ImageView?) {
|
||||||
if (imageView == null || TextUtils.isEmpty(url)) {
|
if (imageView == null || TextUtils.isEmpty(url)) {
|
||||||
Logger.error(TAG, "load url imageViw is null")
|
LibLogger.error(TAG, "load url imageViw is null")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
getGlideConfig(imageView.context)?.apply {
|
getGlideConfig(imageView.context)?.apply {
|
||||||
@@ -1442,7 +1442,7 @@ class GlideUtils {
|
|||||||
*/
|
*/
|
||||||
fun load(url: String?, @DrawableRes defaultRes: Int, imageView: ImageView?) {
|
fun load(url: String?, @DrawableRes defaultRes: Int, imageView: ImageView?) {
|
||||||
if (imageView == null) {
|
if (imageView == null) {
|
||||||
Logger.error(TAG, "load url is invalid or imageViw is null")
|
LibLogger.error(TAG, "load url is invalid or imageViw is null")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
getGlideConfig(imageView.context)?.apply {
|
getGlideConfig(imageView.context)?.apply {
|
||||||
@@ -1454,7 +1454,7 @@ class GlideUtils {
|
|||||||
}
|
}
|
||||||
fun load(url: String?, @DrawableRes defaultRes: Int, @DrawableRes errorRes: Int,imageView: ImageView?) {
|
fun load(url: String?, @DrawableRes defaultRes: Int, @DrawableRes errorRes: Int,imageView: ImageView?) {
|
||||||
if (imageView == null) {
|
if (imageView == null) {
|
||||||
Logger.error(TAG, "load url is invalid or imageViw is null")
|
LibLogger.error(TAG, "load url is invalid or imageViw is null")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
getGlideConfig(imageView.context)?.apply {
|
getGlideConfig(imageView.context)?.apply {
|
||||||
|
@@ -11,7 +11,7 @@ import com.chwl.library.common.application.BaseApp
|
|||||||
import com.chwl.library.common.delegate.SpDelegate
|
import com.chwl.library.common.delegate.SpDelegate
|
||||||
import com.chwl.library.common.file.FileHelper
|
import com.chwl.library.common.file.FileHelper
|
||||||
import com.chwl.library.common.glide.GlideEngine
|
import com.chwl.library.common.glide.GlideEngine
|
||||||
import com.chwl.library.common.util.Logger
|
import com.chwl.library.common.util.LibLogger
|
||||||
import com.chwl.library.easyphoto.EasyPhotos
|
import com.chwl.library.easyphoto.EasyPhotos
|
||||||
import com.chwl.library.easyphoto.constant.Type.*
|
import com.chwl.library.easyphoto.constant.Type.*
|
||||||
import com.chwl.library.easyphoto.models.album.entity.Photo
|
import com.chwl.library.easyphoto.models.album.entity.Photo
|
||||||
@@ -181,7 +181,7 @@ object PhotoProviderNew {
|
|||||||
val path = "$foldPath${it.name}"
|
val path = "$foldPath${it.name}"
|
||||||
if (FileHelper.copyFileFromUri(it.uri, path, true)) {
|
if (FileHelper.copyFileFromUri(it.uri, path, true)) {
|
||||||
newPaths.add(path)
|
newPaths.add(path)
|
||||||
Logger.debug(TAG, "path: ${it.path} , displayName: ${it.name} , newPath: $path ")
|
LibLogger.debug(TAG, "path: ${it.path} , displayName: ${it.name} , newPath: $path ")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -195,7 +195,7 @@ object PhotoProviderNew {
|
|||||||
* 清除复制缓存
|
* 清除复制缓存
|
||||||
*/
|
*/
|
||||||
fun clearCache() {
|
fun clearCache() {
|
||||||
Logger.debug(
|
LibLogger.debug(
|
||||||
TAG, "clearCache => mLastSelectTime: ${TimeUtils.getDateTimeString(
|
TAG, "clearCache => mLastSelectTime: ${TimeUtils.getDateTimeString(
|
||||||
mLastSelectTime, TIME_FORMAT)}")
|
mLastSelectTime, TIME_FORMAT)}")
|
||||||
FileHelper.removeAllFile(getInternalPath() + File.separator)
|
FileHelper.removeAllFile(getInternalPath() + File.separator)
|
||||||
|
@@ -9,13 +9,13 @@ public class CoreUtils {
|
|||||||
|
|
||||||
public static <T> void send(T moduleCallback) {
|
public static <T> void send(T moduleCallback) {
|
||||||
if (moduleCallback == null) {
|
if (moduleCallback == null) {
|
||||||
Logger.warn(TAG, "moduleCallback == null");
|
LibLogger.warn(TAG, "moduleCallback == null");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
CoreUtils.getEventBus().post(moduleCallback);
|
CoreUtils.getEventBus().post(moduleCallback);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Logger.error(TAG, "EventBus exception", e);
|
LibLogger.error(TAG, "EventBus exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -27,7 +27,7 @@ public class CoreUtils {
|
|||||||
} catch (EventBusException e) {
|
} catch (EventBusException e) {
|
||||||
//ignore
|
//ignore
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Logger.error(TAG, "register error", e);
|
LibLogger.error(TAG, "register error", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -39,7 +39,7 @@ public class CoreUtils {
|
|||||||
} catch (EventBusException e) {
|
} catch (EventBusException e) {
|
||||||
//ignore
|
//ignore
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Logger.error(TAG, "unregister error", e);
|
LibLogger.error(TAG, "unregister error", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -166,9 +166,9 @@ object DeviceUtil {
|
|||||||
deviceId = UTDevice.getUtdid(context)
|
deviceId = UTDevice.getUtdid(context)
|
||||||
if (TextUtils.isEmpty(deviceId)) {
|
if (TextUtils.isEmpty(deviceId)) {
|
||||||
deviceId = handyDevicesId
|
deviceId = handyDevicesId
|
||||||
Logger.info(TAG, "use handy deviceId=$deviceId")
|
LibLogger.info(TAG, "use handy deviceId=$deviceId")
|
||||||
} else {
|
} else {
|
||||||
Logger.info(TAG, "use system deviceId=$deviceId")
|
LibLogger.info(TAG, "use system deviceId=$deviceId")
|
||||||
}
|
}
|
||||||
//缓存上次取到的数据,避免有些机型每次打开APP都能拿到一个新的设备id
|
//缓存上次取到的数据,避免有些机型每次打开APP都能拿到一个新的设备id
|
||||||
Config.getInstance(context).putString(cache_device_id, deviceId)
|
Config.getInstance(context).putString(cache_device_id, deviceId)
|
||||||
@@ -182,19 +182,19 @@ object DeviceUtil {
|
|||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun getAndroidID(): String {
|
fun getAndroidID(): String {
|
||||||
if (!TextUtils.isEmpty(ANDROID_ID)) {
|
if (!TextUtils.isEmpty(ANDROID_ID)) {
|
||||||
Logger.info(TAG, "getAndroidID from cache, ANDROID_ID=$ANDROID_ID")
|
LibLogger.info(TAG, "getAndroidID from cache, ANDROID_ID=$ANDROID_ID")
|
||||||
return ANDROID_ID
|
return ANDROID_ID
|
||||||
}
|
}
|
||||||
ANDROID_ID = SPUtils.getString(ANDROID_ID_KEY, "")
|
ANDROID_ID = SPUtils.getString(ANDROID_ID_KEY, "")
|
||||||
if (!TextUtils.isEmpty(ANDROID_ID)) {
|
if (!TextUtils.isEmpty(ANDROID_ID)) {
|
||||||
Logger.info(TAG, "getAndroidID from SP, ANDROID_ID=$ANDROID_ID")
|
LibLogger.info(TAG, "getAndroidID from SP, ANDROID_ID=$ANDROID_ID")
|
||||||
return ANDROID_ID
|
return ANDROID_ID
|
||||||
}
|
}
|
||||||
ANDROID_ID = Settings.Secure.getString(
|
ANDROID_ID = Settings.Secure.getString(
|
||||||
BaseApp.getContext().contentResolver,
|
BaseApp.getContext().contentResolver,
|
||||||
Settings.Secure.ANDROID_ID
|
Settings.Secure.ANDROID_ID
|
||||||
)
|
)
|
||||||
Logger.info(TAG, "getAndroidID from system, ANDROID_ID=$ANDROID_ID")
|
LibLogger.info(TAG, "getAndroidID from system, ANDROID_ID=$ANDROID_ID")
|
||||||
SPUtils.putString(ANDROID_ID_KEY, ANDROID_ID)
|
SPUtils.putString(ANDROID_ID_KEY, ANDROID_ID)
|
||||||
return ANDROID_ID
|
return ANDROID_ID
|
||||||
}
|
}
|
||||||
@@ -235,7 +235,7 @@ object DeviceUtil {
|
|||||||
}
|
}
|
||||||
return mcc_mnc
|
return mcc_mnc
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
Logger.error(TAG, e.message)
|
LibLogger.error(TAG, e.message)
|
||||||
}
|
}
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
@@ -254,7 +254,7 @@ object DeviceUtil {
|
|||||||
return mcc
|
return mcc
|
||||||
}
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
Logger.error(TAG, e.message)
|
LibLogger.error(TAG, e.message)
|
||||||
}
|
}
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
@@ -273,7 +273,7 @@ object DeviceUtil {
|
|||||||
return mnc
|
return mnc
|
||||||
}
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
Logger.error(TAG, e.message)
|
LibLogger.error(TAG, e.message)
|
||||||
}
|
}
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
@@ -297,7 +297,7 @@ object DeviceUtil {
|
|||||||
installed = true
|
installed = true
|
||||||
}
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
Logger.error(TAG, "isAppInstalled packageName=$packageName", e)
|
LibLogger.error(TAG, "isAppInstalled packageName=$packageName", e)
|
||||||
}
|
}
|
||||||
installed
|
installed
|
||||||
}
|
}
|
||||||
|
@@ -49,7 +49,7 @@ public class ExecutorCenter {
|
|||||||
|
|
||||||
private boolean checkNull(Runnable runnable) {
|
private boolean checkNull(Runnable runnable) {
|
||||||
if (null == runnable) {
|
if (null == runnable) {
|
||||||
Logger.error(TAG, "runnable null!!!!");
|
LibLogger.error(TAG, "runnable null!!!!");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@@ -36,7 +36,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@SuppressLint("SimpleDateFormat")
|
@SuppressLint("SimpleDateFormat")
|
||||||
public class Logger {
|
public class LibLogger {
|
||||||
|
|
||||||
public enum LogLevel {
|
public enum LogLevel {
|
||||||
Verbose,
|
Verbose,
|
||||||
@@ -82,7 +82,7 @@ public class Logger {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static ConcurrentHashMap<String, Logger> loggers = new ConcurrentHashMap<String, Logger>();
|
private static ConcurrentHashMap<String, LibLogger> loggers = new ConcurrentHashMap<String, LibLogger>();
|
||||||
// private static Context context;
|
// private static Context context;
|
||||||
private static LoggerThread loggerThread; // 用于在另一个线程写log文件
|
private static LoggerThread loggerThread; // 用于在另一个线程写log文件
|
||||||
|
|
||||||
@@ -92,7 +92,7 @@ public class Logger {
|
|||||||
|
|
||||||
private String myTag;
|
private String myTag;
|
||||||
|
|
||||||
private Logger(String tag) {
|
private LibLogger(String tag) {
|
||||||
myTag = tag;
|
myTag = tag;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -159,33 +159,33 @@ public class Logger {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Logger getLogger(String tag) {
|
public static LibLogger getLogger(String tag) {
|
||||||
if (StringUtils.isEmpty(tag)) {
|
if (StringUtils.isEmpty(tag)) {
|
||||||
tag = "Default";
|
tag = "Default";
|
||||||
}
|
}
|
||||||
Logger logger;
|
LibLogger libLogger;
|
||||||
try {
|
try {
|
||||||
logger = loggers.get(tag);
|
libLogger = loggers.get(tag);
|
||||||
if (logger == null) {
|
if (libLogger == null) {
|
||||||
logger = new Logger(tag);
|
libLogger = new LibLogger(tag);
|
||||||
loggers.put(tag, logger);
|
loggers.put(tag, libLogger);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
MLog.error("Logger", "getLogger error! " + e);
|
MLog.error("Logger", "getLogger error! " + e);
|
||||||
logger = new Logger(tag);
|
libLogger = new LibLogger(tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
return logger;
|
return libLogger;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Logger getLogger(Class<?> cls) {
|
public static LibLogger getLogger(Class<?> cls) {
|
||||||
if (cls == null) {
|
if (cls == null) {
|
||||||
return Logger.getLogger("");
|
return LibLogger.getLogger("");
|
||||||
}
|
}
|
||||||
|
|
||||||
// String className = cls.getName();
|
// String className = cls.getName();
|
||||||
// String tag = className.substring(className.lastIndexOf(".") + 1);
|
// String tag = className.substring(className.lastIndexOf(".") + 1);
|
||||||
return Logger.getLogger(cls.getSimpleName());
|
return LibLogger.getLogger(cls.getSimpleName());
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean isLoggable(LogLevel level) {
|
private static boolean isLoggable(LogLevel level) {
|
||||||
@@ -238,7 +238,7 @@ public class Logger {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void log(String tag, LogLevel level, String message) {
|
public static void log(String tag, LogLevel level, String message) {
|
||||||
if (Logger.isLoggable(level)) {
|
if (LibLogger.isLoggable(level)) {
|
||||||
message = msgForTextLog(tag, message);
|
message = msgForTextLog(tag, message);
|
||||||
switch (level) {
|
switch (level) {
|
||||||
case Debug:
|
case Debug:
|
||||||
@@ -271,7 +271,7 @@ public class Logger {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void logError(String tag, String msg, Throwable tr) {
|
private static void logError(String tag, String msg, Throwable tr) {
|
||||||
if (Logger.isLoggable(LogLevel.Error)) {
|
if (LibLogger.isLoggable(LogLevel.Error)) {
|
||||||
// msg = msgForTextLog(tag, msg);
|
// msg = msgForTextLog(tag, msg);
|
||||||
if (tr == null) {
|
if (tr == null) {
|
||||||
// Log.e(tag, msg);
|
// Log.e(tag, msg);
|
||||||
@@ -348,66 +348,66 @@ public class Logger {
|
|||||||
|
|
||||||
public static void verbose(String tag, String message) {
|
public static void verbose(String tag, String message) {
|
||||||
// message = msgForTextLog(tag, message);
|
// message = msgForTextLog(tag, message);
|
||||||
Logger.log(tag, LogLevel.Verbose, message);
|
LibLogger.log(tag, LogLevel.Verbose, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void debug(String tag, String message) {
|
public static void debug(String tag, String message) {
|
||||||
// message = msgForTextLog(tag, message);
|
// message = msgForTextLog(tag, message);
|
||||||
Logger.log(tag, LogLevel.Debug, message);
|
LibLogger.log(tag, LogLevel.Debug, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void info(String tag, String message) {
|
public static void info(String tag, String message) {
|
||||||
// message = msgForTextLog(tag, message);
|
// message = msgForTextLog(tag, message);
|
||||||
Logger.log(tag, LogLevel.Info, message);
|
LibLogger.log(tag, LogLevel.Info, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void warn(String tag, String message) {
|
public static void warn(String tag, String message) {
|
||||||
// message = msgForTextLog(tag, message);
|
// message = msgForTextLog(tag, message);
|
||||||
Logger.log(tag, LogLevel.Warn, message);
|
LibLogger.log(tag, LogLevel.Warn, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void error(String tag, String message) {
|
public static void error(String tag, String message) {
|
||||||
// message = msgForTextLog(tag, message);
|
// message = msgForTextLog(tag, message);
|
||||||
Logger.log(tag, LogLevel.Error, message);
|
LibLogger.log(tag, LogLevel.Error, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void error(String tag, String message, Throwable throwable) {
|
public static void error(String tag, String message, Throwable throwable) {
|
||||||
// message = msgForTextLog(tag, message);
|
// message = msgForTextLog(tag, message);
|
||||||
Logger.logError(tag, message, throwable);
|
LibLogger.logError(tag, message, throwable);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void verbose(String message) {
|
public void verbose(String message) {
|
||||||
Logger.verbose(myTag, message);
|
LibLogger.verbose(myTag, message);
|
||||||
// message = msgForTextLog(myTag, message);
|
// message = msgForTextLog(myTag, message);
|
||||||
// MLog.verboseWithoutLineNumber(myTag, message);
|
// MLog.verboseWithoutLineNumber(myTag, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void debug(String message) {
|
public void debug(String message) {
|
||||||
Logger.debug(myTag, message);
|
LibLogger.debug(myTag, message);
|
||||||
// message = msgForTextLog(myTag, message);
|
// message = msgForTextLog(myTag, message);
|
||||||
// MLog.debugWithoutLineNumber(myTag, message);
|
// MLog.debugWithoutLineNumber(myTag, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void info(String message) {
|
public void info(String message) {
|
||||||
Logger.info(myTag, message);
|
LibLogger.info(myTag, message);
|
||||||
// message = msgForTextLog(myTag, message);
|
// message = msgForTextLog(myTag, message);
|
||||||
// MLog.infoWithoutLineNumber(myTag, message);
|
// MLog.infoWithoutLineNumber(myTag, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void warn(String message) {
|
public void warn(String message) {
|
||||||
Logger.warn(myTag, message);
|
LibLogger.warn(myTag, message);
|
||||||
// message = msgForTextLog(myTag, message);
|
// message = msgForTextLog(myTag, message);
|
||||||
// MLog.warnWithoutLineNumber(myTag, message);
|
// MLog.warnWithoutLineNumber(myTag, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void error(String message) {
|
public void error(String message) {
|
||||||
Logger.error(myTag, message);
|
LibLogger.error(myTag, message);
|
||||||
// message = msgForTextLog(myTag, message);
|
// message = msgForTextLog(myTag, message);
|
||||||
// MLog.errorWithoutLineNumber(myTag, message);
|
// MLog.errorWithoutLineNumber(myTag, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void error(String message, Throwable throwable) {
|
public void error(String message, Throwable throwable) {
|
||||||
Logger.logError(myTag, message, throwable);
|
LibLogger.logError(myTag, message, throwable);
|
||||||
// message = msgForTextLog(myTag, message);
|
// message = msgForTextLog(myTag, message);
|
||||||
// MLog.errorWithoutLineNumber(myTag, message, throwable);
|
// MLog.errorWithoutLineNumber(myTag, message, throwable);
|
||||||
}
|
}
|
||||||
@@ -487,7 +487,7 @@ public class Logger {
|
|||||||
|
|
||||||
String thread = (Looper.getMainLooper() == Looper.myLooper()) ? "[Main]"
|
String thread = (Looper.getMainLooper() == Looper.myLooper()) ? "[Main]"
|
||||||
: ("[" + Thread.currentThread().getId() + "]");
|
: ("[" + Thread.currentThread().getId() + "]");
|
||||||
String strLevel = "[" + Logger.levelToString(level) + "]";
|
String strLevel = "[" + LibLogger.levelToString(level) + "]";
|
||||||
String logMsg = thread + "[" + tag + "]" + strLevel + " " + msg;
|
String logMsg = thread + "[" + tag + "]" + strLevel + " " + msg;
|
||||||
return logMsg;
|
return logMsg;
|
||||||
}
|
}
|
||||||
@@ -537,7 +537,7 @@ public class Logger {
|
|||||||
|
|
||||||
File logDir = new File(config.dir);
|
File logDir = new File(config.dir);
|
||||||
if (!logDir.exists()) {
|
if (!logDir.exists()) {
|
||||||
Logger.info("Logger", "create log dir: " + logDir.getAbsolutePath());
|
LibLogger.info("Logger", "create log dir: " + logDir.getAbsolutePath());
|
||||||
logDir.mkdirs();
|
logDir.mkdirs();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -549,7 +549,7 @@ public class Logger {
|
|||||||
}
|
}
|
||||||
|
|
||||||
filePath = config.dir + "/" + f.format(new Date()) + ".log";
|
filePath = config.dir + "/" + f.format(new Date()) + ".log";
|
||||||
Logger.info("Logger", "log file name: " + filePath);
|
LibLogger.info("Logger", "log file name: " + filePath);
|
||||||
|
|
||||||
handler = new LogThreadHandler(this);
|
handler = new LogThreadHandler(this);
|
||||||
isReady = true;
|
isReady = true;
|
||||||
@@ -558,7 +558,7 @@ public class Logger {
|
|||||||
List<String> list = new ArrayList<String>(logList);
|
List<String> list = new ArrayList<String>(logList);
|
||||||
try {
|
try {
|
||||||
if (list.size() > 0) {
|
if (list.size() > 0) {
|
||||||
Logger.debug("Logger", "write logs before logger thread ready to file: " + list.size());
|
LibLogger.debug("Logger", "write logs before logger thread ready to file: " + list.size());
|
||||||
for (String s : list) {
|
for (String s : list) {
|
||||||
handler.writeLine(s);
|
handler.writeLine(s);
|
||||||
}
|
}
|
@@ -13,7 +13,7 @@ public class Pools {
|
|||||||
protected void afterExecute(Runnable r, Throwable t) {
|
protected void afterExecute(Runnable r, Throwable t) {
|
||||||
super.afterExecute(r, t);
|
super.afterExecute(r, t);
|
||||||
if (t != null) {
|
if (t != null) {
|
||||||
Logger.error(TAG, String.valueOf(t));
|
LibLogger.error(TAG, String.valueOf(t));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@@ -23,7 +23,7 @@ public class ReflectionUtils {
|
|||||||
field.setAccessible(true);
|
field.setAccessible(true);
|
||||||
field.set(object, value);
|
field.set(object, value);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Logger.error(TAG, "ReflectionUtils setFieldValue", e);
|
LibLogger.error(TAG, "ReflectionUtils setFieldValue", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -33,7 +33,7 @@ public class ReflectionUtils {
|
|||||||
field.setAccessible(true);
|
field.setAccessible(true);
|
||||||
return field.get(object);
|
return field.get(object);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Logger.error(TAG, "ReflectionUtils getFieldValue", e);
|
LibLogger.error(TAG, "ReflectionUtils getFieldValue", e);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -158,19 +158,19 @@ public class Utils {
|
|||||||
|
|
||||||
public static void executePendingTransactionsSafely(String TAG, FragmentManager fragmentManager) {
|
public static void executePendingTransactionsSafely(String TAG, FragmentManager fragmentManager) {
|
||||||
if (fragmentManager == null) {
|
if (fragmentManager == null) {
|
||||||
Logger.error(TAG, "executePendingTransactionsSafely fragmentManager == null");
|
LibLogger.error(TAG, "executePendingTransactionsSafely fragmentManager == null");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
fragmentManager.executePendingTransactions();
|
fragmentManager.executePendingTransactions();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Logger.error(TAG, String.valueOf(e));
|
LibLogger.error(TAG, String.valueOf(e));
|
||||||
try {
|
try {
|
||||||
Field mExecutingActions = fragmentManager.getClass().getDeclaredField("mExecutingActions");
|
Field mExecutingActions = fragmentManager.getClass().getDeclaredField("mExecutingActions");
|
||||||
mExecutingActions.setAccessible(true);
|
mExecutingActions.setAccessible(true);
|
||||||
mExecutingActions.set(fragmentManager, false);
|
mExecutingActions.set(fragmentManager, false);
|
||||||
} catch (Exception e1) {
|
} catch (Exception e1) {
|
||||||
Logger.error(TAG, "set field value fail", e1);
|
LibLogger.error(TAG, "set field value fail", e1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -47,7 +47,7 @@ object ViewBindingUtil {
|
|||||||
).invoke(null, layoutInflater, parent, true) as? VB
|
).invoke(null, layoutInflater, parent, true) as? VB
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
//merge 标签会找不到
|
//merge 标签会找不到
|
||||||
Logger.debug(
|
LibLogger.debug(
|
||||||
TAG,
|
TAG,
|
||||||
"inflateWithView => maybe use merge: " + genericOwner.javaClass.simpleName + ", genericSuperclass: " + genericOwner.javaClass.genericSuperclass
|
"inflateWithView => maybe use merge: " + genericOwner.javaClass.simpleName + ", genericSuperclass: " + genericOwner.javaClass.genericSuperclass
|
||||||
)
|
)
|
||||||
@@ -75,7 +75,7 @@ object ViewBindingUtil {
|
|||||||
} catch (e: NoSuchMethodException) {
|
} catch (e: NoSuchMethodException) {
|
||||||
} catch (e: ClassCastException) {
|
} catch (e: ClassCastException) {
|
||||||
} catch (e: InvocationTargetException) {
|
} catch (e: InvocationTargetException) {
|
||||||
Logger.error(
|
LibLogger.error(
|
||||||
TAG,
|
TAG,
|
||||||
"withGenericBindingClass => ${e.message}" + ", class: " + genericOwner.javaClass.simpleName
|
"withGenericBindingClass => ${e.message}" + ", class: " + genericOwner.javaClass.simpleName
|
||||||
)
|
)
|
||||||
@@ -86,7 +86,7 @@ object ViewBindingUtil {
|
|||||||
genericSuperclass = superclass.genericSuperclass
|
genericSuperclass = superclass.genericSuperclass
|
||||||
superclass = superclass.superclass
|
superclass = superclass.superclass
|
||||||
}
|
}
|
||||||
Logger.error(
|
LibLogger.error(
|
||||||
TAG,
|
TAG,
|
||||||
"withGenericBindingClass: " + genericOwner.javaClass.simpleName + ", genericSuperclass: " + genericOwner.javaClass.genericSuperclass
|
"withGenericBindingClass: " + genericOwner.javaClass.simpleName + ", genericSuperclass: " + genericOwner.javaClass.genericSuperclass
|
||||||
)
|
)
|
||||||
|
Reference in New Issue
Block a user