同步hiyoo混淆配置:重命名Looger

This commit is contained in:
Max
2024-01-06 14:38:14 +08:00
parent 4fd2afe8e0
commit 7679937945
16 changed files with 146 additions and 147 deletions

View File

@@ -11,9 +11,8 @@ import com.yizhuan.xchat_android_library.common.application.BaseApp
import com.yizhuan.xchat_android_library.common.delegate.SpDelegate
import com.yizhuan.xchat_android_library.common.file.FileHelper
import com.yizhuan.xchat_android_library.common.glide.GlideEngine
import com.yizhuan.xchat_android_library.common.util.Logger
import com.yizhuan.xchat_android_library.common.util.LibLogger
import com.yizhuan.xchat_android_library.easyphoto.EasyPhotos
import com.yizhuan.xchat_android_library.easyphoto.constant.Type.*
import com.yizhuan.xchat_android_library.easyphoto.models.album.entity.Photo
import com.yizhuan.xchat_android_library.utils.TimeUtils
import com.yizhuan.xchat_android_library.utils.TimeUtils.TIME_FORMAT
@@ -160,7 +159,7 @@ object PhotoProvider {
val path = "$foldPath${it.name}"
if (FileHelper.copyFileFromUri(it.uri, path, true)) {
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() {
Logger.debug(
LibLogger.debug(
TAG, "clearCache => mLastSelectTime: ${TimeUtils.getDateTimeString(
mLastSelectTime, TIME_FORMAT)}")
FileHelper.removeAllFile(getInternalPath() + File.separator)

View File

@@ -14,7 +14,7 @@ import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import com.yizhuan.xchat_android_library.common.util.Logger;
import com.yizhuan.xchat_android_library.common.util.LibLogger;
/**
* Created by wushaocheng
@@ -41,7 +41,7 @@ public class BitmapUtil {
final int height = options.outHeight;
final int width = options.outWidth;
Logger.info(TAG, "origin, w= " + width + " h=" + height);
LibLogger.info(TAG, "origin, w= " + width + " h=" + height);
int inSampleSize = 1;
if (height > reqHeight || width > reqWidth) {
@@ -54,13 +54,13 @@ public class BitmapUtil {
}
}
Logger.info(TAG, "sampleSize:" + inSampleSize);
LibLogger.info(TAG, "sampleSize:" + inSampleSize);
return inSampleSize;
}
public static Bitmap setImgSize(Bitmap bm, float newWidth, float newHeight) {
if (bm == null) {
Logger.error(TAG, "bitmap is null.");
LibLogger.error(TAG, "bitmap is null.");
return null;
}
// 获得图片的宽高.

View File

@@ -18,7 +18,7 @@ import java.util.List;
import com.yizhuan.xchat_android_library.common.fragmentation.ISupportActivity;
import com.yizhuan.xchat_android_library.common.fragmentation.SupportActivityDelegate;
import com.yizhuan.xchat_android_library.common.util.Logger;
import com.yizhuan.xchat_android_library.common.util.LibLogger;
import com.yizhuan.xchat_android_library.common.util.ViewBindingUtil;
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);
this.handleFragmentActivityResult(this.getSupportFragmentManager(), requestCode, resultCode, data);
} 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();
} catch (Exception e) {
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.setBoolean(this, true);
} 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 {
super.onSaveInstanceState(outState);
} 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 {
return super.dispatchTouchEvent(ev);
} catch (Exception e) {
Logger.error(TAG, "dispatchTouchEvent", e);
LibLogger.error(TAG, "dispatchTouchEvent", e);
return false;
}
}

View File

@@ -19,7 +19,7 @@ import com.yizhuan.xchat_android_library.common.fragmentation.ISupportFragment;
import com.yizhuan.xchat_android_library.common.fragmentation.SupportFragmentDelegate;
import com.yizhuan.xchat_android_library.common.fragmentation.windowcallback.WindowCallbackProxyUtil;
import com.yizhuan.xchat_android_library.common.util.ActivityHelper;
import com.yizhuan.xchat_android_library.common.util.Logger;
import com.yizhuan.xchat_android_library.common.util.LibLogger;
import com.yizhuan.xchat_android_library.common.util.ViewBindingUtil;
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);
}
} catch (Exception e) {
Logger.error(TAG, "show", e);
LibLogger.error(TAG, "show", e);
}
}

View File

@@ -7,7 +7,7 @@ import androidx.lifecycle.LifecycleObserver;
import androidx.lifecycle.LifecycleOwner;
import com.yizhuan.xchat_android_library.R;
import com.yizhuan.xchat_android_library.common.util.Logger;
import com.yizhuan.xchat_android_library.common.util.LibLogger;
/**
* author: wushaocheng
@@ -25,11 +25,11 @@ public class BaseViewTag {
*/
public static void registerLifecycle(View view) {
if (view == null) {
Logger.warn(TAG, "registerLifecycle view is null");
LibLogger.warn(TAG, "registerLifecycle view is null");
return;
}
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;
}
view.post(new Runnable() {
@@ -58,7 +58,7 @@ public class BaseViewTag {
}
register(view, view.getContext());
} 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) {
if (view == null) {
Logger.warn(TAG, "registerLifecycle view is null");
LibLogger.warn(TAG, "registerLifecycle view is null");
return;
}
if (owner == null) {
Logger.warn(TAG, "registerLifecycle owner is null");
LibLogger.warn(TAG, "registerLifecycle owner is null");
return;
}
try {
@@ -84,12 +84,12 @@ public class BaseViewTag {
LifecycleOwner lifecycleOwner = (LifecycleOwner) owner;
lifecycleOwner.getLifecycle().addObserver((LifecycleObserver) view);//核心代码
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 {
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) {
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) {
if (view == null) {
Logger.warn(TAG, "unRegisterLifecycle view is null");
LibLogger.warn(TAG, "unRegisterLifecycle view is null");
return;
}
if (owner == null) {
Logger.warn(TAG, "unRegisterLifecycle owner is null");
LibLogger.warn(TAG, "unRegisterLifecycle owner is null");
return;
}
try {
view.setTag(BaseViewTag.TAG_NAME, null);
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) {
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);
}
}
}

View File

@@ -7,7 +7,7 @@ import android.text.TextUtils;
import com.qiniu.android.utils.StringUtils;
import com.yizhuan.xchat_android_library.common.application.BaseApp;
import com.yizhuan.xchat_android_library.common.util.Logger;
import com.yizhuan.xchat_android_library.common.util.LibLogger;
import com.yizhuan.xchat_android_library.utils.FP;
import java.io.BufferedInputStream;
@@ -829,7 +829,7 @@ public class FileHelper {
try {
return streamToBytes(new FileInputStream(file));
} catch (Exception e) {
Logger.error(TAG, String.valueOf(e));
LibLogger.error(TAG, String.valueOf(e));
}
}
return null;
@@ -858,20 +858,20 @@ public class FileHelper {
content = null;
}
} catch (IOException e) {
Logger.error(TAG, String.valueOf(e));
LibLogger.error(TAG, String.valueOf(e));
} finally {
if (baos != null) {
try {
baos.close();
} catch (IOException e) {
Logger.error(TAG, String.valueOf(e));
LibLogger.error(TAG, String.valueOf(e));
}
}
if (bis != null) {
try {
bis.close();
} 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();
} catch (Exception e) {
Logger.error(TAG, "getTxtFileContent read fail, e = " + e);
LibLogger.error(TAG, "getTxtFileContent read fail, e = " + e);
} finally {
if (inputStream != null) {
try {

View File

@@ -30,7 +30,7 @@ import com.bumptech.glide.request.target.Target
import com.yizhuan.xchat_android_library.common.transform.AssignScaleTransformation
import com.yizhuan.xchat_android_library.common.transform.ComplexTransformation
import com.yizhuan.xchat_android_library.common.util.ActivityHelper
import com.yizhuan.xchat_android_library.common.util.Logger
import com.yizhuan.xchat_android_library.common.util.LibLogger
import com.yizhuan.xchat_android_library.common.util.Utils
import jp.wasabeef.glide.transformations.RoundedCornersTransformation
import java.io.File
@@ -51,7 +51,7 @@ class GlideUtils {
vararg transformation: Transformation<Bitmap?>?
) {
if (imageView == null) {
Logger.error(TAG, "loadBytes imageView is null")
LibLogger.error(TAG, "loadBytes imageView is null")
return
}
getGlideConfig(imageView.context)?.apply {
@@ -141,7 +141,7 @@ class GlideUtils {
format: DecodeFormat
) {
if (imageView == null) {
Logger.error(TAG, "loadFormat imageView is null")
LibLogger.error(TAG, "loadFormat imageView is null")
return
}
getGlideConfig(imageView.context)?.apply {
@@ -159,7 +159,7 @@ class GlideUtils {
format: DecodeFormat
) {
if (imageView == null) {
Logger.error(TAG, "loadFormat imageView is null")
LibLogger.error(TAG, "loadFormat imageView is null")
return
}
getGlideConfig(imageView.context)?.apply {
@@ -175,7 +175,7 @@ class GlideUtils {
*/
fun loadObjectFitCenter(path: Any, @DrawableRes errorRes: Int, imageView: ImageView?) {
if (imageView == null) {
Logger.error(TAG, "loadObjectFitCenter imageView is null")
LibLogger.error(TAG, "loadObjectFitCenter imageView is null")
return
}
getGlideConfig(imageView.context)?.apply {
@@ -190,7 +190,7 @@ class GlideUtils {
*/
fun loadObject(path: Any, imageView: ImageView?, @DrawableRes errorRes: Int) {
if (imageView == null) {
Logger.error(TAG, "loadObject imageView is null")
LibLogger.error(TAG, "loadObject imageView is null")
return
}
getGlideConfig(imageView.context)?.apply {
@@ -259,7 +259,7 @@ class GlideUtils {
vararg transformation: Transformation<Bitmap?>?
) {
if (imageView == null) {
Logger.error(TAG, "loadObject imageView is null")
LibLogger.error(TAG, "loadObject imageView is null")
return
}
getGlideConfig(imageView.context)?.apply {
@@ -279,7 +279,7 @@ class GlideUtils {
*/
fun loadUriCrossFade(uri: Uri, imageView: ImageView?) {
if (imageView == null) {
Logger.error(TAG, "loadUriCrossFade imageView is null")
LibLogger.error(TAG, "loadUriCrossFade imageView is null")
return
}
getGlideConfig(imageView.context)?.apply {
@@ -297,7 +297,7 @@ class GlideUtils {
vararg transformation: Transformation<Bitmap?>?
) {
if (imageView == null) {
Logger.error(TAG, "loadResCrossFade imageView is null")
LibLogger.error(TAG, "loadResCrossFade imageView is null")
return
}
getGlideConfig(imageView.context)?.apply {
@@ -317,7 +317,7 @@ class GlideUtils {
vararg transformation: Transformation<Bitmap?>?
) {
if (imageView == null) {
Logger.error(TAG, "loadResCrossFade imageView is null")
LibLogger.error(TAG, "loadResCrossFade imageView is null")
return
}
getGlideConfig(imageView.context)?.apply {
@@ -334,7 +334,7 @@ class GlideUtils {
*/
fun loadUriGift(uri: Uri, imageView: ImageView?) {
if (imageView == null) {
Logger.error(TAG, "loadUriGift imageView is null")
LibLogger.error(TAG, "loadUriGift imageView is null")
return
}
getGlideConfig(imageView.context)?.apply {
@@ -348,7 +348,7 @@ class GlideUtils {
*/
fun loadUriGiftAndCrossFade(uri: Uri, imageView: ImageView?) {
if (imageView == null) {
Logger.error(TAG, "loadUriGift imageView is null")
LibLogger.error(TAG, "loadUriGift imageView is null")
return
}
getGlideConfig(imageView.context)?.apply {
@@ -368,7 +368,7 @@ class GlideUtils {
vararg transformation: Transformation<Bitmap?>?
) {
if (imageView == null) {
Logger.error(TAG, "loadCrossFade imageView is null")
LibLogger.error(TAG, "loadCrossFade imageView is null")
return
}
getGlideConfig(imageView.context)?.apply {
@@ -390,7 +390,7 @@ class GlideUtils {
vararg transformation: Transformation<Bitmap?>?
) {
if (imageView == null) {
Logger.error(TAG, "loadCrossFade imageView is null")
LibLogger.error(TAG, "loadCrossFade imageView is null")
return
}
getGlideConfig(imageView.context)?.apply {
@@ -415,7 +415,7 @@ class GlideUtils {
listener: RequestListener<Drawable>
) {
if (imageView == null) {
Logger.error(TAG, "loadCrossFade imageView is null")
LibLogger.error(TAG, "loadCrossFade imageView is null")
return
}
getGlideConfig(imageView.context)?.apply {
@@ -438,7 +438,7 @@ class GlideUtils {
priority: Priority
) {
if (imageView == null) {
Logger.error(TAG, "loadCrossFade imageView is null")
LibLogger.error(TAG, "loadCrossFade imageView is null")
return
}
getGlideConfig(imageView.context)?.apply {
@@ -463,7 +463,7 @@ class GlideUtils {
vararg transformation: Transformation<Bitmap?>?
) {
if (imageView == null) {
Logger.error(TAG, "loadCrossFade imageView is null")
LibLogger.error(TAG, "loadCrossFade imageView is null")
return
}
getGlideConfig(imageView.context)?.apply {
@@ -503,7 +503,7 @@ class GlideUtils {
priority: Priority
) {
if (imageView == null) {
Logger.error(TAG, "loadPriority imageView is null")
LibLogger.error(TAG, "loadPriority imageView is null")
return
}
getGlideConfig(imageView.context)?.apply {
@@ -562,7 +562,7 @@ class GlideUtils {
vararg transformation: Transformation<Bitmap?>?
) {
if (imageView == null) {
Logger.error(TAG, "loadPriority imageView is null")
LibLogger.error(TAG, "loadPriority imageView is null")
return
}
getGlideConfig(imageView.context)?.apply {
@@ -583,7 +583,7 @@ class GlideUtils {
priority: Priority
) {
if (imageView == null) {
Logger.error(TAG, "loadPriority imageView is null")
LibLogger.error(TAG, "loadPriority imageView is null")
return
}
getGlideConfig(imageView.context)?.apply {
@@ -616,7 +616,7 @@ class GlideUtils {
*/
fun loadResBySize(imageView: ImageView?, @DrawableRes resId: Int, width: Int, height: Int) {
if (imageView == null) {
Logger.error(TAG, "loadSquareIcon imageView is null")
LibLogger.error(TAG, "loadSquareIcon imageView is null")
return
}
getGlideConfig(imageView.context)?.apply {
@@ -744,7 +744,7 @@ class GlideUtils {
vararg transformation: Transformation<Bitmap?>?
) {
if (imageView == null) {
Logger.error(TAG, "loadLocalFile imageView is null")
LibLogger.error(TAG, "loadLocalFile imageView is null")
return
}
val file = File(filePath)
@@ -771,7 +771,7 @@ class GlideUtils {
height: Int
) {
if (imageView == null) {
Logger.error(TAG, "loadLocalFile imageView is null")
LibLogger.error(TAG, "loadLocalFile imageView is null")
return
}
val file = File(filePath)
@@ -813,7 +813,7 @@ class GlideUtils {
if (imageView == null)
return
if (TextUtils.isEmpty(filePath)) {
Logger.error(TAG, "loadLocalFile url is empty.")
LibLogger.error(TAG, "loadLocalFile url is empty.")
getGlideConfig(imageView.context)?.apply {
this
.load(defaultDrawable)
@@ -840,7 +840,7 @@ class GlideUtils {
@DrawableRes defaultRes: Int,
) {
if (imageView == null) {
Logger.error(TAG, "loadRoundIcon imageView is null")
LibLogger.error(TAG, "loadRoundIcon imageView is null")
return
}
getGlideConfig(imageView.context)?.apply {
@@ -859,7 +859,7 @@ class GlideUtils {
// 加载圆形本地头像
fun loadRoundIcon(resId: Int, imageView: ImageView?) {
if (imageView == null) {
Logger.error(TAG, "loadRoundIcon imageView is null")
LibLogger.error(TAG, "loadRoundIcon imageView is null")
return
}
getGlideConfig(imageView.context)?.apply {
@@ -908,7 +908,7 @@ class GlideUtils {
*/
fun loadGiftRes(@DrawableRes resId: Int, imageView: ImageView?) {
if (imageView == null) {
Logger.error(TAG, "loadGiftRes imageView is null")
LibLogger.error(TAG, "loadGiftRes imageView is null")
return
}
getGlideConfig(imageView.context)?.apply {
@@ -925,7 +925,7 @@ class GlideUtils {
anim: Int
) {
if (imageView == null) {
Logger.error(TAG, "loadGiftRes imageView is null")
LibLogger.error(TAG, "loadGiftRes imageView is null")
return
}
getGlideConfig(imageView.context)?.apply {
@@ -940,7 +940,7 @@ class GlideUtils {
*/
fun loadGift(url: String?, imageView: ImageView?) {
if (imageView == null) {
Logger.error(TAG, "loadGif imageView is null")
LibLogger.error(TAG, "loadGif imageView is null")
return
}
getGlideConfig(imageView.context)?.apply {
@@ -960,7 +960,7 @@ class GlideUtils {
imageView: ImageView?
) {
if (imageView == null) {
Logger.error(TAG, "loadGif imageView is null")
LibLogger.error(TAG, "loadGif imageView is null")
return
}
getGlideConfig(imageView.context)?.apply {
@@ -984,7 +984,7 @@ class GlideUtils {
callBack: IGlideLoaderCallBack?
) {
if (imageView == null) {
Logger.error(TAG, "loadGifImage imageView is null")
LibLogger.error(TAG, "loadGifImage imageView is null")
return
}
val builder = ComplexTransformation.ComplexParamsBuilder()
@@ -1007,7 +1007,7 @@ class GlideUtils {
target: Target<Drawable?>,
isFirstResource: Boolean
): Boolean {
Logger.error(TAG, "loadGifImage url:$url, onException:$e")
LibLogger.error(TAG, "loadGifImage url:$url, onException:$e")
callBack?.onError()
return false
}
@@ -1039,7 +1039,7 @@ class GlideUtils {
callBack: IGlideLoaderCallBack?
) {
if (imageView == null) {
Logger.error(TAG, "loadAssignScaleImage imageView is null")
LibLogger.error(TAG, "loadAssignScaleImage imageView is null")
return
}
getGlideConfig(imageView.context)?.apply {
@@ -1055,7 +1055,7 @@ class GlideUtils {
target: Target<Drawable?>,
isFirstResource: Boolean
): Boolean {
Logger.error(
LibLogger.error(
TAG,
"loadAssignScaleImage url:$url, onException:$e"
)
@@ -1084,7 +1084,7 @@ class GlideUtils {
*/
fun loadCircleImage(url: String?, @DrawableRes resId: Int, imageView: ImageView?) {
if (imageView == null) {
Logger.error(TAG, "loadCircleImage imageView is null")
LibLogger.error(TAG, "loadCircleImage imageView is null")
return
}
getGlideConfig(imageView.context)?.apply {
@@ -1106,7 +1106,7 @@ class GlideUtils {
imageView: ImageView?
) {
if (imageView == null) {
Logger.error(TAG, "loadHalfConnerImage imageView is null")
LibLogger.error(TAG, "loadHalfConnerImage imageView is null")
return
}
getGlideConfig(imageView.context)?.apply {
@@ -1133,7 +1133,7 @@ class GlideUtils {
imageView: ImageView?
) {
if (imageView == null) {
Logger.error(TAG, "ImageLoader ImageView is null")
LibLogger.error(TAG, "ImageLoader ImageView is null")
return
}
getGlideConfig(imageView.context)?.apply {
@@ -1153,7 +1153,7 @@ class GlideUtils {
// 加载本地资源图片
fun loadLocalRes(@DrawableRes resId: Int, imageView: ImageView?) {
if (imageView == null) {
Logger.error(TAG, "loadLocalRes imageView is null")
LibLogger.error(TAG, "loadLocalRes imageView is null")
return
}
getGlideConfig(imageView.context)?.apply {
@@ -1174,7 +1174,7 @@ class GlideUtils {
format: DecodeFormat
) {
if (imageView == null) {
Logger.error(TAG, "loadLocalRes imageView is null")
LibLogger.error(TAG, "loadLocalRes imageView is null")
return
}
getGlideConfig(imageView.context)?.apply {
@@ -1197,7 +1197,7 @@ class GlideUtils {
vararg transformation: Transformation<Bitmap?>?
) {
if (imageView == null) {
Logger.error(TAG, "loadLocalRes imageView is null")
LibLogger.error(TAG, "loadLocalRes imageView is null")
return
}
getGlideConfig(imageView.context)?.apply {
@@ -1211,7 +1211,7 @@ class GlideUtils {
// 加载Assets图片
fun loadAssetsImg(path: String?, imageView: ImageView?) {
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
}
getGlideConfig(imageView.context)?.apply {
@@ -1226,7 +1226,7 @@ class GlideUtils {
*/
fun loadResCenterCrop(@DrawableRes resId: Int, imageView: ImageView?) {
if (imageView == null) {
Logger.error(TAG, "loadResScale imageView is null")
LibLogger.error(TAG, "loadResScale imageView is null")
return
}
getGlideConfig(imageView.context)?.apply {
@@ -1241,7 +1241,7 @@ class GlideUtils {
*/
fun loadResFitCenter(@DrawableRes resId: Int, imageView: ImageView?) {
if (imageView == null) {
Logger.error(TAG, "loadResFitCenter imageView is null")
LibLogger.error(TAG, "loadResFitCenter imageView is null")
return
}
getGlideConfig(imageView.context)?.apply {
@@ -1257,7 +1257,7 @@ class GlideUtils {
*/
fun loadFitCenter(url: String, imageView: ImageView?) {
if (imageView == null) {
Logger.error(TAG, " loadFitCenter imageViw is null")
LibLogger.error(TAG, " loadFitCenter imageViw is null")
return
}
getGlideConfig(imageView.context)?.apply {
@@ -1274,7 +1274,7 @@ class GlideUtils {
*/
fun loadFitCenter(url: String?, @DrawableRes errorRes: Int, imageView: ImageView?) {
if (imageView == null) {
Logger.error(TAG, " loadFitCenter imageViw is null")
LibLogger.error(TAG, " loadFitCenter imageViw is null")
return
}
getGlideConfig(imageView.context)?.apply {
@@ -1322,7 +1322,7 @@ class GlideUtils {
vararg transformation: Transformation<Bitmap?>?
) {
if (imageView == null) {
Logger.error(TAG, "load imageViw is null")
LibLogger.error(TAG, "load imageViw is null")
return
}
getGlideConfig(imageView.context)?.apply {
@@ -1344,7 +1344,7 @@ class GlideUtils {
vararg transformation: Transformation<Bitmap?>?
) {
if (imageView == null) {
Logger.error(TAG, "load imageViw is null")
LibLogger.error(TAG, "load imageViw is null")
return
}
getGlideConfig(imageView.context)?.apply {
@@ -1368,7 +1368,7 @@ class GlideUtils {
listener: RequestListener<File?>?
) {
if (context == null) {
Logger.error(TAG, "load context is null")
LibLogger.error(TAG, "load context is null")
return
}
@@ -1381,7 +1381,7 @@ class GlideUtils {
*/
fun load(url: String?, imageView: ImageView?, listener: RequestListener<Drawable>) {
if (imageView == null || TextUtils.isEmpty(url)) {
Logger.error(TAG, "load imageViw is null")
LibLogger.error(TAG, "load imageViw is null")
return
}
getGlideConfig(imageView.context)?.apply {
@@ -1401,7 +1401,7 @@ class GlideUtils {
listener: RequestListener<Bitmap?>
) {
if (imageView == null || TextUtils.isEmpty(url)) {
Logger.error(TAG, "load imageViw is null")
LibLogger.error(TAG, "load imageViw is null")
return
}
getGlideConfig(imageView.context)?.apply {
@@ -1413,7 +1413,7 @@ class GlideUtils {
//加载图片,无默认图片
fun load(url: String?, imageView: ImageView?) {
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
}
getGlideConfig(imageView.context)?.apply {
@@ -1426,7 +1426,7 @@ class GlideUtils {
//加载图片,无默认图片
fun loadWithError(url: String?, errorDrawable: Int, imageView: ImageView?) {
if (imageView == null || TextUtils.isEmpty(url)) {
Logger.error(TAG, "load url imageViw is null")
LibLogger.error(TAG, "load url imageViw is null")
return
}
getGlideConfig(imageView.context)?.apply {
@@ -1442,7 +1442,7 @@ class GlideUtils {
*/
fun load(url: String?, @DrawableRes defaultRes: Int, imageView: ImageView?) {
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
}
getGlideConfig(imageView.context)?.apply {
@@ -1454,7 +1454,7 @@ class GlideUtils {
}
fun load(url: String?, @DrawableRes defaultRes: Int, @DrawableRes errorRes: Int,imageView: ImageView?) {
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
}
getGlideConfig(imageView.context)?.apply {

View File

@@ -11,7 +11,7 @@ import com.yizhuan.xchat_android_library.common.application.BaseApp
import com.yizhuan.xchat_android_library.common.delegate.SpDelegate
import com.yizhuan.xchat_android_library.common.file.FileHelper
import com.yizhuan.xchat_android_library.common.glide.GlideEngine
import com.yizhuan.xchat_android_library.common.util.Logger
import com.yizhuan.xchat_android_library.common.util.LibLogger
import com.yizhuan.xchat_android_library.easyphoto.EasyPhotos
import com.yizhuan.xchat_android_library.easyphoto.constant.Type.*
import com.yizhuan.xchat_android_library.easyphoto.models.album.entity.Photo
@@ -181,7 +181,7 @@ object PhotoProviderNew {
val path = "$foldPath${it.name}"
if (FileHelper.copyFileFromUri(it.uri, path, true)) {
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() {
Logger.debug(
LibLogger.debug(
TAG, "clearCache => mLastSelectTime: ${TimeUtils.getDateTimeString(
mLastSelectTime, TIME_FORMAT)}")
FileHelper.removeAllFile(getInternalPath() + File.separator)

View File

@@ -9,13 +9,13 @@ public class CoreUtils {
public static <T> void send(T moduleCallback) {
if (moduleCallback == null) {
Logger.warn(TAG, "moduleCallback == null");
LibLogger.warn(TAG, "moduleCallback == null");
return;
}
try {
CoreUtils.getEventBus().post(moduleCallback);
} 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) {
//ignore
} 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) {
//ignore
} catch (Exception e) {
Logger.error(TAG, "unregister error", e);
LibLogger.error(TAG, "unregister error", e);
}
}

View File

@@ -166,9 +166,9 @@ object DeviceUtil {
deviceId = UTDevice.getUtdid(context)
if (TextUtils.isEmpty(deviceId)) {
deviceId = handyDevicesId
Logger.info(TAG, "use handy deviceId=$deviceId")
LibLogger.info(TAG, "use handy deviceId=$deviceId")
} else {
Logger.info(TAG, "use system deviceId=$deviceId")
LibLogger.info(TAG, "use system deviceId=$deviceId")
}
//缓存上次取到的数据避免有些机型每次打开APP都能拿到一个新的设备id
Config.getInstance(context).putString(cache_device_id, deviceId)
@@ -182,19 +182,19 @@ object DeviceUtil {
@JvmStatic
fun getAndroidID(): String {
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
}
ANDROID_ID = SPUtils.getString(ANDROID_ID_KEY, "")
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
}
ANDROID_ID = Settings.Secure.getString(
BaseApp.getContext().contentResolver,
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)
return ANDROID_ID
}
@@ -235,7 +235,7 @@ object DeviceUtil {
}
return mcc_mnc
} catch (e: Exception) {
Logger.error(TAG, e.message)
LibLogger.error(TAG, e.message)
}
return ""
}
@@ -254,7 +254,7 @@ object DeviceUtil {
return mcc
}
} catch (e: Exception) {
Logger.error(TAG, e.message)
LibLogger.error(TAG, e.message)
}
return ""
}
@@ -273,7 +273,7 @@ object DeviceUtil {
return mnc
}
} catch (e: Exception) {
Logger.error(TAG, e.message)
LibLogger.error(TAG, e.message)
}
return ""
}
@@ -297,7 +297,7 @@ object DeviceUtil {
installed = true
}
} catch (e: Exception) {
Logger.error(TAG, "isAppInstalled packageName=$packageName", e)
LibLogger.error(TAG, "isAppInstalled packageName=$packageName", e)
}
installed
}

View File

@@ -49,7 +49,7 @@ public class ExecutorCenter {
private boolean checkNull(Runnable runnable) {
if (null == runnable) {
Logger.error(TAG, "runnable null!!!!");
LibLogger.error(TAG, "runnable null!!!!");
return true;
}
return false;

View File

@@ -36,7 +36,7 @@ import java.util.concurrent.ConcurrentHashMap;
*
*/
@SuppressLint("SimpleDateFormat")
public class Logger {
public class LibLogger {
public enum LogLevel {
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 LoggerThread loggerThread; // 用于在另一个线程写log文件
@@ -92,7 +92,7 @@ public class Logger {
private String myTag;
private Logger(String tag) {
private LibLogger(String 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)) {
tag = "Default";
}
Logger logger;
LibLogger libLogger;
try {
logger = loggers.get(tag);
if (logger == null) {
logger = new Logger(tag);
loggers.put(tag, logger);
libLogger = loggers.get(tag);
if (libLogger == null) {
libLogger = new LibLogger(tag);
loggers.put(tag, libLogger);
}
} catch (Exception 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) {
return Logger.getLogger("");
return LibLogger.getLogger("");
}
// String className = cls.getName();
// String tag = className.substring(className.lastIndexOf(".") + 1);
return Logger.getLogger(cls.getSimpleName());
return LibLogger.getLogger(cls.getSimpleName());
}
private static boolean isLoggable(LogLevel level) {
@@ -238,7 +238,7 @@ public class Logger {
}
public static void log(String tag, LogLevel level, String message) {
if (Logger.isLoggable(level)) {
if (LibLogger.isLoggable(level)) {
message = msgForTextLog(tag, message);
switch (level) {
case Debug:
@@ -271,7 +271,7 @@ public class Logger {
}
private static void logError(String tag, String msg, Throwable tr) {
if (Logger.isLoggable(LogLevel.Error)) {
if (LibLogger.isLoggable(LogLevel.Error)) {
// msg = msgForTextLog(tag, msg);
if (tr == null) {
// Log.e(tag, msg);
@@ -348,66 +348,66 @@ public class Logger {
public static void verbose(String tag, String 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) {
// message = msgForTextLog(tag, message);
Logger.log(tag, LogLevel.Debug, message);
LibLogger.log(tag, LogLevel.Debug, message);
}
public static void info(String tag, String 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) {
// message = msgForTextLog(tag, message);
Logger.log(tag, LogLevel.Warn, message);
LibLogger.log(tag, LogLevel.Warn, message);
}
public static void error(String tag, String 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) {
// message = msgForTextLog(tag, message);
Logger.logError(tag, message, throwable);
LibLogger.logError(tag, message, throwable);
}
public void verbose(String message) {
Logger.verbose(myTag, message);
LibLogger.verbose(myTag, message);
// message = msgForTextLog(myTag, message);
// MLog.verboseWithoutLineNumber(myTag, message);
}
public void debug(String message) {
Logger.debug(myTag, message);
LibLogger.debug(myTag, message);
// message = msgForTextLog(myTag, message);
// MLog.debugWithoutLineNumber(myTag, message);
}
public void info(String message) {
Logger.info(myTag, message);
LibLogger.info(myTag, message);
// message = msgForTextLog(myTag, message);
// MLog.infoWithoutLineNumber(myTag, message);
}
public void warn(String message) {
Logger.warn(myTag, message);
LibLogger.warn(myTag, message);
// message = msgForTextLog(myTag, message);
// MLog.warnWithoutLineNumber(myTag, message);
}
public void error(String message) {
Logger.error(myTag, message);
LibLogger.error(myTag, message);
// message = msgForTextLog(myTag, message);
// MLog.errorWithoutLineNumber(myTag, message);
}
public void error(String message, Throwable throwable) {
Logger.logError(myTag, message, throwable);
LibLogger.logError(myTag, message, throwable);
// message = msgForTextLog(myTag, message);
// MLog.errorWithoutLineNumber(myTag, message, throwable);
}
@@ -487,7 +487,7 @@ public class Logger {
String thread = (Looper.getMainLooper() == Looper.myLooper()) ? "[Main]"
: ("[" + Thread.currentThread().getId() + "]");
String strLevel = "[" + Logger.levelToString(level) + "]";
String strLevel = "[" + LibLogger.levelToString(level) + "]";
String logMsg = thread + "[" + tag + "]" + strLevel + " " + msg;
return logMsg;
}
@@ -537,7 +537,7 @@ public class Logger {
File logDir = new File(config.dir);
if (!logDir.exists()) {
Logger.info("Logger", "create log dir: " + logDir.getAbsolutePath());
LibLogger.info("Logger", "create log dir: " + logDir.getAbsolutePath());
logDir.mkdirs();
}
@@ -549,7 +549,7 @@ public class Logger {
}
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);
isReady = true;
@@ -558,7 +558,7 @@ public class Logger {
List<String> list = new ArrayList<String>(logList);
try {
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) {
handler.writeLine(s);
}

View File

@@ -13,7 +13,7 @@ public class Pools {
protected void afterExecute(Runnable r, Throwable t) {
super.afterExecute(r, t);
if (t != null) {
Logger.error(TAG, String.valueOf(t));
LibLogger.error(TAG, String.valueOf(t));
}
}
});

View File

@@ -23,7 +23,7 @@ public class ReflectionUtils {
field.setAccessible(true);
field.set(object, value);
} 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);
return field.get(object);
} catch (Exception e) {
Logger.error(TAG, "ReflectionUtils getFieldValue", e);
LibLogger.error(TAG, "ReflectionUtils getFieldValue", e);
return null;
}
}

View File

@@ -158,19 +158,19 @@ public class Utils {
public static void executePendingTransactionsSafely(String TAG, FragmentManager fragmentManager) {
if (fragmentManager == null) {
Logger.error(TAG, "executePendingTransactionsSafely fragmentManager == null");
LibLogger.error(TAG, "executePendingTransactionsSafely fragmentManager == null");
return;
}
try {
fragmentManager.executePendingTransactions();
} catch (Exception e) {
Logger.error(TAG, String.valueOf(e));
LibLogger.error(TAG, String.valueOf(e));
try {
Field mExecutingActions = fragmentManager.getClass().getDeclaredField("mExecutingActions");
mExecutingActions.setAccessible(true);
mExecutingActions.set(fragmentManager, false);
} catch (Exception e1) {
Logger.error(TAG, "set field value fail", e1);
LibLogger.error(TAG, "set field value fail", e1);
}
}
}

View File

@@ -47,7 +47,7 @@ object ViewBindingUtil {
).invoke(null, layoutInflater, parent, true) as? VB
} catch (e: Exception) {
//merge 标签会找不到
Logger.debug(
LibLogger.debug(
TAG,
"inflateWithView => maybe use merge " + genericOwner.javaClass.simpleName + ", genericSuperclass: " + genericOwner.javaClass.genericSuperclass
)
@@ -75,7 +75,7 @@ object ViewBindingUtil {
} catch (e: NoSuchMethodException) {
} catch (e: ClassCastException) {
} catch (e: InvocationTargetException) {
Logger.error(
LibLogger.error(
TAG,
"withGenericBindingClass => ${e.message}" + ", class: " + genericOwner.javaClass.simpleName
)
@@ -86,7 +86,7 @@ object ViewBindingUtil {
genericSuperclass = superclass.genericSuperclass
superclass = superclass.superclass
}
Logger.error(
LibLogger.error(
TAG,
"withGenericBindingClass " + genericOwner.javaClass.simpleName + ", genericSuperclass: " + genericOwner.javaClass.genericSuperclass
)