混淆配置:重命名Logger
This commit is contained in:
@@ -34,7 +34,7 @@ import com.nnbc123.app.ui.utils.ImageLoadUtils
|
||||
import com.nnbc123.app.ui.widget.dialog.CommonTipDialog
|
||||
import com.nnbc123.core.file.FileModel
|
||||
import com.nnbc123.core.privilege.bean.PrivilegeCardInfo
|
||||
import com.nnbc123.core.utils.Logger
|
||||
import com.nnbc123.core.utils.CLogger
|
||||
import com.nnbc123.core.utils.CTextUtils
|
||||
import com.nnbc123.library.common.file.FileHelper
|
||||
import com.nnbc123.library.common.photo.PhotoProviderNew
|
||||
@@ -330,7 +330,7 @@ class CreatePrivilegeCardDialog : BaseDialog<DialogCreatePrivilegeCardBinding>()
|
||||
}
|
||||
if (sourceSize > 0) {
|
||||
//不能上传图片的最小文件大小
|
||||
Logger.debug(TAG, "sourceSize: $sourceSize")
|
||||
CLogger.debug(TAG, "sourceSize: $sourceSize")
|
||||
if (sourceSize < MIN_HEAD_PHOTO_SIZE) {
|
||||
ToastUtils.show(R.string.text_bitmap_too_small)
|
||||
return
|
||||
|
@@ -7,7 +7,7 @@ import android.graphics.Point;
|
||||
import android.net.Uri;
|
||||
|
||||
import com.nnbc123.app.application.XChatApplication;
|
||||
import com.nnbc123.core.utils.Logger;
|
||||
import com.nnbc123.core.utils.CLogger;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.FileDescriptor;
|
||||
@@ -40,7 +40,7 @@ public class BitmapUtil {
|
||||
|
||||
final int height = options.outHeight;
|
||||
final int width = options.outWidth;
|
||||
Logger.info(TAG, "origin, w= " + width + " h=" + height);
|
||||
CLogger.info(TAG, "origin, w= " + width + " h=" + height);
|
||||
int inSampleSize = 1;
|
||||
|
||||
if (height > reqHeight || width > reqWidth) {
|
||||
@@ -53,13 +53,13 @@ public class BitmapUtil {
|
||||
}
|
||||
}
|
||||
|
||||
Logger.info(TAG, "sampleSize:" + inSampleSize);
|
||||
CLogger.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.");
|
||||
CLogger.error(TAG, "bitmap is null.");
|
||||
return null;
|
||||
}
|
||||
// 获得图片的宽高.
|
||||
|
@@ -36,7 +36,7 @@ import com.nnbc123.core.file.FileModel
|
||||
import com.nnbc123.core.user.UserModel
|
||||
import com.nnbc123.core.user.bean.UserInfo
|
||||
import com.nnbc123.core.user.bean.UserPhoto
|
||||
import com.nnbc123.core.utils.Logger
|
||||
import com.nnbc123.core.utils.CLogger
|
||||
import com.nnbc123.library.common.file.FileHelper
|
||||
import com.nnbc123.library.common.photo.PhotoProviderNew
|
||||
import com.nnbc123.library.common.util.PhotoCompressCallback
|
||||
@@ -445,7 +445,7 @@ class UserInfoModifyActivity : BaseViewBindingActivity<ActivityUserInfoModifyBin
|
||||
mostCompressSize = IMAGE_MOST_COMPRESS_SIZE
|
||||
)
|
||||
} catch (e: FileNotFoundException) {
|
||||
Logger.error(TAG, e.message)
|
||||
CLogger.error(TAG, e.message)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -466,7 +466,7 @@ class UserInfoModifyActivity : BaseViewBindingActivity<ActivityUserInfoModifyBin
|
||||
}
|
||||
if (sourceSize > 0) {
|
||||
//不能上传图片的最小文件大小
|
||||
Logger.debug(TAG, "sourceSize: $sourceSize")
|
||||
CLogger.debug(TAG, "sourceSize: $sourceSize")
|
||||
if (sourceSize < MIN_HEAD_PHOTO_SIZE) {
|
||||
toast(R.string.text_bitmap_too_small)
|
||||
return
|
||||
|
@@ -31,6 +31,7 @@ import com.nnbc123.core.file.FileModel
|
||||
import com.nnbc123.core.user.UserModel
|
||||
import com.nnbc123.core.user.bean.UserInfo
|
||||
import com.nnbc123.core.user.bean.UserPhoto
|
||||
import com.nnbc123.core.utils.CLogger
|
||||
import com.nnbc123.core.utils.net.BeanObserver
|
||||
import com.nnbc123.library.common.file.FileHelper
|
||||
import com.nnbc123.library.common.photo.PhotoProviderNew
|
||||
@@ -335,7 +336,7 @@ class UserModifyPhotosActivity : TakePhotoActivity(), PhotoItemClickListener,
|
||||
mostCompressSize = IMAGE_MOST_COMPRESS_SIZE
|
||||
)
|
||||
} catch (e: FileNotFoundException) {
|
||||
com.nnbc123.core.utils.Logger.error(TAG, e.message)
|
||||
CLogger.error(TAG, e.message)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -355,7 +356,7 @@ class UserModifyPhotosActivity : TakePhotoActivity(), PhotoItemClickListener,
|
||||
}
|
||||
if (sourceSize > 0) {
|
||||
//不能上传图片的最小文件大小
|
||||
com.nnbc123.core.utils.Logger.debug(TAG, "sourceSize: $sourceSize")
|
||||
CLogger.debug(TAG, "sourceSize: $sourceSize")
|
||||
if (sourceSize < MIN_HEAD_PHOTO_SIZE) {
|
||||
toast(R.string.text_bitmap_too_small)
|
||||
return
|
||||
|
@@ -10,7 +10,7 @@ import com.nnbc123.core.music.view.IAddLocalMusicListView
|
||||
import com.nnbc123.core.utils.net.RxHelper
|
||||
import com.nnbc123.library.base.PresenterEvent
|
||||
import com.nnbc123.library.common.file.FileHelper
|
||||
import com.nnbc123.library.common.util.Logger
|
||||
import com.nnbc123.library.common.util.LLogger
|
||||
import io.reactivex.disposables.Disposable
|
||||
import kotlinx.coroutines.*
|
||||
import java.io.File
|
||||
@@ -110,7 +110,7 @@ class AddLocalMusicListPresenter : BaseMvpPresenter<IAddLocalMusicListView?>() {
|
||||
private fun copyFileToCache(music: LocalMusicBean): String? {
|
||||
val path = "${getCacheMusicDir()}${music.songName}"
|
||||
return if (FileHelper.copyFileFromUri(Uri.parse(music.uri), path, false)) {
|
||||
Logger.debug(TAG, "copy success, path: $path ")
|
||||
LLogger.debug(TAG, "copy success, path: $path ")
|
||||
path
|
||||
} else {
|
||||
null
|
||||
|
@@ -8,7 +8,7 @@ import android.content.Context;
|
||||
import com.netease.nimlib.sdk.chatroom.ChatRoomMessageBuilder;
|
||||
import com.netease.nimlib.sdk.chatroom.model.ChatRoomMessage;
|
||||
import com.nnbc123.core.R;
|
||||
import com.nnbc123.library.common.util.Logger;
|
||||
import com.nnbc123.library.common.util.LLogger;
|
||||
import com.nnbc123.library.utils.ResUtil;
|
||||
import com.nnbc123.xchat_android_constants.XChatConstants;
|
||||
import com.nnbc123.core.UriProvider;
|
||||
@@ -521,7 +521,7 @@ public class ShareModel extends BaseModel implements IShareModel {
|
||||
emitter.onSuccess("已复制");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Logger.info("copyText", String.valueOf(e));
|
||||
LLogger.info("copyText", String.valueOf(e));
|
||||
if (emitter != null) {
|
||||
emitter.onError(new Throwable(String.valueOf(e)));
|
||||
}
|
||||
|
@@ -37,7 +37,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
*
|
||||
*/
|
||||
@SuppressLint("SimpleDateFormat")
|
||||
public class Logger {
|
||||
public class CLogger {
|
||||
|
||||
public enum LogLevel {
|
||||
Verbose,
|
||||
@@ -83,7 +83,7 @@ public class Logger {
|
||||
}
|
||||
|
||||
|
||||
private static ConcurrentHashMap<String, Logger> loggers = new ConcurrentHashMap<String, Logger>();
|
||||
private static ConcurrentHashMap<String, CLogger> loggers = new ConcurrentHashMap<String, CLogger>();
|
||||
// private static Context context;
|
||||
private static LoggerThread loggerThread; // 用于在另一个线程写log文件
|
||||
|
||||
@@ -93,7 +93,7 @@ public class Logger {
|
||||
|
||||
private String myTag;
|
||||
|
||||
private Logger(String tag) {
|
||||
private CLogger(String tag) {
|
||||
myTag = tag;
|
||||
}
|
||||
|
||||
@@ -160,33 +160,33 @@ public class Logger {
|
||||
}
|
||||
}
|
||||
|
||||
public static Logger getLogger(String tag) {
|
||||
public static CLogger getLogger(String tag) {
|
||||
if (StringUtils.isEmpty(tag)) {
|
||||
tag = "Default";
|
||||
}
|
||||
Logger logger;
|
||||
CLogger logger;
|
||||
try {
|
||||
logger = loggers.get(tag);
|
||||
if (logger == null) {
|
||||
logger = new Logger(tag);
|
||||
logger = new CLogger(tag);
|
||||
loggers.put(tag, logger);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
MLog.error("Logger", "getLogger error! " + e);
|
||||
logger = new Logger(tag);
|
||||
logger = new CLogger(tag);
|
||||
}
|
||||
|
||||
return logger;
|
||||
}
|
||||
|
||||
public static Logger getLogger(Class<?> cls) {
|
||||
public static CLogger getLogger(Class<?> cls) {
|
||||
if (cls == null) {
|
||||
return Logger.getLogger("");
|
||||
return CLogger.getLogger("");
|
||||
}
|
||||
|
||||
// String className = cls.getName();
|
||||
// String tag = className.substring(className.lastIndexOf(".") + 1);
|
||||
return Logger.getLogger(cls.getSimpleName());
|
||||
return CLogger.getLogger(cls.getSimpleName());
|
||||
}
|
||||
|
||||
private static boolean isLoggable(LogLevel level) {
|
||||
@@ -239,7 +239,7 @@ public class Logger {
|
||||
}
|
||||
|
||||
public static void log(String tag, LogLevel level, String message) {
|
||||
if (Logger.isLoggable(level)) {
|
||||
if (CLogger.isLoggable(level)) {
|
||||
message = msgForTextLog(tag, message);
|
||||
switch (level) {
|
||||
case Debug:
|
||||
@@ -272,7 +272,7 @@ public class Logger {
|
||||
}
|
||||
|
||||
private static void logError(String tag, String msg, Throwable tr) {
|
||||
if (Logger.isLoggable(LogLevel.Error)) {
|
||||
if (CLogger.isLoggable(LogLevel.Error)) {
|
||||
// msg = msgForTextLog(tag, msg);
|
||||
if (tr == null) {
|
||||
// Log.e(tag, msg);
|
||||
@@ -349,66 +349,66 @@ public class Logger {
|
||||
|
||||
public static void verbose(String tag, String message) {
|
||||
// message = msgForTextLog(tag, message);
|
||||
Logger.log(tag, LogLevel.Verbose, message);
|
||||
CLogger.log(tag, LogLevel.Verbose, message);
|
||||
}
|
||||
|
||||
public static void debug(String tag, String message) {
|
||||
// message = msgForTextLog(tag, message);
|
||||
Logger.log(tag, LogLevel.Debug, message);
|
||||
CLogger.log(tag, LogLevel.Debug, message);
|
||||
}
|
||||
|
||||
public static void info(String tag, String message) {
|
||||
// message = msgForTextLog(tag, message);
|
||||
Logger.log(tag, LogLevel.Info, message);
|
||||
CLogger.log(tag, LogLevel.Info, message);
|
||||
}
|
||||
|
||||
public static void warn(String tag, String message) {
|
||||
// message = msgForTextLog(tag, message);
|
||||
Logger.log(tag, LogLevel.Warn, message);
|
||||
CLogger.log(tag, LogLevel.Warn, message);
|
||||
}
|
||||
|
||||
public static void error(String tag, String message) {
|
||||
// message = msgForTextLog(tag, message);
|
||||
Logger.log(tag, LogLevel.Error, message);
|
||||
CLogger.log(tag, LogLevel.Error, message);
|
||||
}
|
||||
|
||||
public static void error(String tag, String message, Throwable throwable) {
|
||||
// message = msgForTextLog(tag, message);
|
||||
Logger.logError(tag, message, throwable);
|
||||
CLogger.logError(tag, message, throwable);
|
||||
}
|
||||
|
||||
public void verbose(String message) {
|
||||
Logger.verbose(myTag, message);
|
||||
CLogger.verbose(myTag, message);
|
||||
// message = msgForTextLog(myTag, message);
|
||||
// MLog.verboseWithoutLineNumber(myTag, message);
|
||||
}
|
||||
|
||||
public void debug(String message) {
|
||||
Logger.debug(myTag, message);
|
||||
CLogger.debug(myTag, message);
|
||||
// message = msgForTextLog(myTag, message);
|
||||
// MLog.debugWithoutLineNumber(myTag, message);
|
||||
}
|
||||
|
||||
public void info(String message) {
|
||||
Logger.info(myTag, message);
|
||||
CLogger.info(myTag, message);
|
||||
// message = msgForTextLog(myTag, message);
|
||||
// MLog.infoWithoutLineNumber(myTag, message);
|
||||
}
|
||||
|
||||
public void warn(String message) {
|
||||
Logger.warn(myTag, message);
|
||||
CLogger.warn(myTag, message);
|
||||
// message = msgForTextLog(myTag, message);
|
||||
// MLog.warnWithoutLineNumber(myTag, message);
|
||||
}
|
||||
|
||||
public void error(String message) {
|
||||
Logger.error(myTag, message);
|
||||
CLogger.error(myTag, message);
|
||||
// message = msgForTextLog(myTag, message);
|
||||
// MLog.errorWithoutLineNumber(myTag, message);
|
||||
}
|
||||
|
||||
public void error(String message, Throwable throwable) {
|
||||
Logger.logError(myTag, message, throwable);
|
||||
CLogger.logError(myTag, message, throwable);
|
||||
// message = msgForTextLog(myTag, message);
|
||||
// MLog.errorWithoutLineNumber(myTag, message, throwable);
|
||||
}
|
||||
@@ -488,7 +488,7 @@ public class Logger {
|
||||
|
||||
String thread = (Looper.getMainLooper() == Looper.myLooper()) ? "[Main]"
|
||||
: ("[" + Thread.currentThread().getId() + "]");
|
||||
String strLevel = "[" + Logger.levelToString(level) + "]";
|
||||
String strLevel = "[" + CLogger.levelToString(level) + "]";
|
||||
String logMsg = thread + "[" + tag + "]" + strLevel + " " + msg;
|
||||
return logMsg;
|
||||
}
|
||||
@@ -538,7 +538,7 @@ public class Logger {
|
||||
|
||||
File logDir = new File(config.dir);
|
||||
if (!logDir.exists()) {
|
||||
Logger.info("Logger", "create log dir: " + logDir.getAbsolutePath());
|
||||
CLogger.info("Logger", "create log dir: " + logDir.getAbsolutePath());
|
||||
logDir.mkdirs();
|
||||
}
|
||||
|
||||
@@ -550,7 +550,7 @@ public class Logger {
|
||||
}
|
||||
|
||||
filePath = config.dir + "/" + f.format(new Date()) + ".log";
|
||||
Logger.info("Logger", "log file name: " + filePath);
|
||||
CLogger.info("Logger", "log file name: " + filePath);
|
||||
|
||||
handler = new LogThreadHandler(this);
|
||||
isReady = true;
|
||||
@@ -559,7 +559,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());
|
||||
CLogger.debug("Logger", "write logs before logger thread ready to file: " + list.size());
|
||||
for (String s : list) {
|
||||
handler.writeLine(s);
|
||||
}
|
@@ -18,7 +18,7 @@ import java.util.List;
|
||||
|
||||
import com.nnbc123.library.common.fragmentation.ISupportActivity;
|
||||
import com.nnbc123.library.common.fragmentation.SupportActivityDelegate;
|
||||
import com.nnbc123.library.common.util.Logger;
|
||||
import com.nnbc123.library.common.util.LLogger;
|
||||
import com.nnbc123.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);
|
||||
LLogger.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);
|
||||
LLogger.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);
|
||||
LLogger.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);
|
||||
LLogger.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);
|
||||
LLogger.error(TAG, "dispatchTouchEvent", e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@@ -19,7 +19,7 @@ import com.nnbc123.library.common.fragmentation.ISupportFragment;
|
||||
import com.nnbc123.library.common.fragmentation.SupportFragmentDelegate;
|
||||
import com.nnbc123.library.common.fragmentation.windowcallback.WindowCallbackProxyUtil;
|
||||
import com.nnbc123.library.common.util.ActivityHelper;
|
||||
import com.nnbc123.library.common.util.Logger;
|
||||
import com.nnbc123.library.common.util.LLogger;
|
||||
import com.nnbc123.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);
|
||||
LLogger.error(TAG, "show", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -7,7 +7,7 @@ import androidx.lifecycle.LifecycleObserver;
|
||||
import androidx.lifecycle.LifecycleOwner;
|
||||
|
||||
import com.nnbc123.library.R;
|
||||
import com.nnbc123.library.common.util.Logger;
|
||||
import com.nnbc123.library.common.util.LLogger;
|
||||
|
||||
/**
|
||||
* 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");
|
||||
LLogger.warn(TAG, "registerLifecycle view is null");
|
||||
return;
|
||||
}
|
||||
if (!(view instanceof LifecycleObserver)) {
|
||||
Logger.warn(TAG, "registerLifecycle view: " + view.getClass().getSimpleName() + ", view must implements LifecycleObserver");
|
||||
LLogger.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);
|
||||
LLogger.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");
|
||||
LLogger.warn(TAG, "registerLifecycle view is null");
|
||||
return;
|
||||
}
|
||||
if (owner == null) {
|
||||
Logger.warn(TAG, "registerLifecycle owner is null");
|
||||
LLogger.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());
|
||||
LLogger.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");
|
||||
LLogger.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);
|
||||
LLogger.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");
|
||||
LLogger.warn(TAG, "unRegisterLifecycle view is null");
|
||||
return;
|
||||
}
|
||||
if (owner == null) {
|
||||
Logger.warn(TAG, "unRegisterLifecycle owner is null");
|
||||
LLogger.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());
|
||||
LLogger.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);
|
||||
LLogger.error(TAG, "unRegisterLifecycle view: " + view.getClass().getSimpleName() + ", owner: " + owner.getClass().getSimpleName() + ", error", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -5,21 +5,17 @@ import android.net.Uri;
|
||||
import android.os.Environment;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import androidx.core.text.TextUtilsCompat;
|
||||
|
||||
import com.nnbc123.library.utils.FP;
|
||||
import com.nnbc123.library.common.application.BaseApp;
|
||||
import com.nnbc123.library.common.util.Logger;
|
||||
import com.nnbc123.library.common.util.LLogger;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStream;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.text.DecimalFormat;
|
||||
@@ -830,7 +826,7 @@ public class FileHelper {
|
||||
try {
|
||||
return streamToBytes(new FileInputStream(file));
|
||||
} catch (Exception e) {
|
||||
Logger.error(TAG, String.valueOf(e));
|
||||
LLogger.error(TAG, String.valueOf(e));
|
||||
}
|
||||
}
|
||||
return null;
|
||||
@@ -859,20 +855,20 @@ public class FileHelper {
|
||||
content = null;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
Logger.error(TAG, String.valueOf(e));
|
||||
LLogger.error(TAG, String.valueOf(e));
|
||||
} finally {
|
||||
if (baos != null) {
|
||||
try {
|
||||
baos.close();
|
||||
} catch (IOException e) {
|
||||
Logger.error(TAG, String.valueOf(e));
|
||||
LLogger.error(TAG, String.valueOf(e));
|
||||
}
|
||||
}
|
||||
if (bis != null) {
|
||||
try {
|
||||
bis.close();
|
||||
} catch (IOException e) {
|
||||
Logger.error(TAG, String.valueOf(e));
|
||||
LLogger.error(TAG, String.valueOf(e));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -31,7 +31,7 @@ import com.bumptech.glide.request.target.Target
|
||||
import com.nnbc123.library.common.transform.AssignScaleTransformation
|
||||
import com.nnbc123.library.common.transform.ComplexTransformation
|
||||
import com.nnbc123.library.common.util.ActivityHelper
|
||||
import com.nnbc123.library.common.util.Logger
|
||||
import com.nnbc123.library.common.util.LLogger
|
||||
import com.nnbc123.library.common.util.Utils
|
||||
import jp.wasabeef.glide.transformations.RoundedCornersTransformation
|
||||
import java.io.File
|
||||
@@ -53,7 +53,7 @@ class GlideUtils {
|
||||
vararg transformation: Transformation<Bitmap?>?
|
||||
) {
|
||||
if (imageView == null) {
|
||||
Logger.error(TAG, "loadBytes imageView is null")
|
||||
LLogger.error(TAG, "loadBytes imageView is null")
|
||||
return
|
||||
}
|
||||
getGlideConfig(imageView.context)?.apply {
|
||||
@@ -143,7 +143,7 @@ class GlideUtils {
|
||||
format: DecodeFormat
|
||||
) {
|
||||
if (imageView == null) {
|
||||
Logger.error(TAG, "loadFormat imageView is null")
|
||||
LLogger.error(TAG, "loadFormat imageView is null")
|
||||
return
|
||||
}
|
||||
getGlideConfig(imageView.context)?.apply {
|
||||
@@ -161,7 +161,7 @@ class GlideUtils {
|
||||
format: DecodeFormat
|
||||
) {
|
||||
if (imageView == null) {
|
||||
Logger.error(TAG, "loadFormat imageView is null")
|
||||
LLogger.error(TAG, "loadFormat imageView is null")
|
||||
return
|
||||
}
|
||||
getGlideConfig(imageView.context)?.apply {
|
||||
@@ -177,7 +177,7 @@ class GlideUtils {
|
||||
*/
|
||||
fun loadObjectFitCenter(path: Any, @DrawableRes errorRes: Int, imageView: ImageView?) {
|
||||
if (imageView == null) {
|
||||
Logger.error(TAG, "loadObjectFitCenter imageView is null")
|
||||
LLogger.error(TAG, "loadObjectFitCenter imageView is null")
|
||||
return
|
||||
}
|
||||
getGlideConfig(imageView.context)?.apply {
|
||||
@@ -192,7 +192,7 @@ class GlideUtils {
|
||||
*/
|
||||
fun loadObject(path: Any, imageView: ImageView?, @DrawableRes errorRes: Int) {
|
||||
if (imageView == null) {
|
||||
Logger.error(TAG, "loadObject imageView is null")
|
||||
LLogger.error(TAG, "loadObject imageView is null")
|
||||
return
|
||||
}
|
||||
getGlideConfig(imageView.context)?.apply {
|
||||
@@ -261,7 +261,7 @@ class GlideUtils {
|
||||
vararg transformation: Transformation<Bitmap?>?
|
||||
) {
|
||||
if (imageView == null) {
|
||||
Logger.error(TAG, "loadObject imageView is null")
|
||||
LLogger.error(TAG, "loadObject imageView is null")
|
||||
return
|
||||
}
|
||||
getGlideConfig(imageView.context)?.apply {
|
||||
@@ -281,7 +281,7 @@ class GlideUtils {
|
||||
*/
|
||||
fun loadUriCrossFade(uri: Uri, imageView: ImageView?) {
|
||||
if (imageView == null) {
|
||||
Logger.error(TAG, "loadUriCrossFade imageView is null")
|
||||
LLogger.error(TAG, "loadUriCrossFade imageView is null")
|
||||
return
|
||||
}
|
||||
getGlideConfig(imageView.context)?.apply {
|
||||
@@ -299,7 +299,7 @@ class GlideUtils {
|
||||
vararg transformation: Transformation<Bitmap?>?
|
||||
) {
|
||||
if (imageView == null) {
|
||||
Logger.error(TAG, "loadResCrossFade imageView is null")
|
||||
LLogger.error(TAG, "loadResCrossFade imageView is null")
|
||||
return
|
||||
}
|
||||
getGlideConfig(imageView.context)?.apply {
|
||||
@@ -319,7 +319,7 @@ class GlideUtils {
|
||||
vararg transformation: Transformation<Bitmap?>?
|
||||
) {
|
||||
if (imageView == null) {
|
||||
Logger.error(TAG, "loadResCrossFade imageView is null")
|
||||
LLogger.error(TAG, "loadResCrossFade imageView is null")
|
||||
return
|
||||
}
|
||||
getGlideConfig(imageView.context)?.apply {
|
||||
@@ -336,7 +336,7 @@ class GlideUtils {
|
||||
*/
|
||||
fun loadUriGift(uri: Uri, imageView: ImageView?) {
|
||||
if (imageView == null) {
|
||||
Logger.error(TAG, "loadUriGift imageView is null")
|
||||
LLogger.error(TAG, "loadUriGift imageView is null")
|
||||
return
|
||||
}
|
||||
getGlideConfig(imageView.context)?.apply {
|
||||
@@ -350,7 +350,7 @@ class GlideUtils {
|
||||
*/
|
||||
fun loadUriGiftAndCrossFade(uri: Uri, imageView: ImageView?) {
|
||||
if (imageView == null) {
|
||||
Logger.error(TAG, "loadUriGift imageView is null")
|
||||
LLogger.error(TAG, "loadUriGift imageView is null")
|
||||
return
|
||||
}
|
||||
getGlideConfig(imageView.context)?.apply {
|
||||
@@ -365,7 +365,7 @@ class GlideUtils {
|
||||
*/
|
||||
fun loadUriGiftAndCrossFadeRound(uri: Uri, imageView: ImageView?, radius: Float) {
|
||||
if (imageView == null) {
|
||||
Logger.error(TAG, "loadUriGift imageView is null")
|
||||
LLogger.error(TAG, "loadUriGift imageView is null")
|
||||
return
|
||||
}
|
||||
getGlideConfig(imageView.context)?.apply {
|
||||
@@ -386,7 +386,7 @@ class GlideUtils {
|
||||
*/
|
||||
fun loadUriGiftAndCrossFadeRound(uri: String, imageView: ImageView?, radius: Float) {
|
||||
if (imageView == null) {
|
||||
Logger.error(TAG, "loadUriGift imageView is null")
|
||||
LLogger.error(TAG, "loadUriGift imageView is null")
|
||||
return
|
||||
}
|
||||
getGlideConfig(imageView.context)?.apply {
|
||||
@@ -407,7 +407,7 @@ class GlideUtils {
|
||||
*/
|
||||
fun loadGiftAndCrossFadeRound(uri: String, imageView: ImageView?, radius: Float) {
|
||||
if (imageView == null) {
|
||||
Logger.error(TAG, "loadUriGift imageView is null")
|
||||
LLogger.error(TAG, "loadUriGift imageView is null")
|
||||
return
|
||||
}
|
||||
val options = RequestOptions().diskCacheStrategy(DiskCacheStrategy.RESOURCE)
|
||||
@@ -431,7 +431,7 @@ class GlideUtils {
|
||||
*/
|
||||
fun loadGiftAndImage(uri: String, imageView: ImageView?) {
|
||||
if (imageView == null) {
|
||||
Logger.error(TAG, "loadUriGift imageView is null")
|
||||
LLogger.error(TAG, "loadUriGift imageView is null")
|
||||
return
|
||||
}
|
||||
getGlideConfig(imageView.context)?.apply {
|
||||
@@ -451,7 +451,7 @@ class GlideUtils {
|
||||
vararg transformation: Transformation<Bitmap?>?
|
||||
) {
|
||||
if (imageView == null) {
|
||||
Logger.error(TAG, "loadCrossFade imageView is null")
|
||||
LLogger.error(TAG, "loadCrossFade imageView is null")
|
||||
return
|
||||
}
|
||||
getGlideConfig(imageView.context)?.apply {
|
||||
@@ -473,7 +473,7 @@ class GlideUtils {
|
||||
vararg transformation: Transformation<Bitmap?>?
|
||||
) {
|
||||
if (imageView == null) {
|
||||
Logger.error(TAG, "loadCrossFade imageView is null")
|
||||
LLogger.error(TAG, "loadCrossFade imageView is null")
|
||||
return
|
||||
}
|
||||
getGlideConfig(imageView.context)?.apply {
|
||||
@@ -498,7 +498,7 @@ class GlideUtils {
|
||||
listener: RequestListener<Drawable>
|
||||
) {
|
||||
if (imageView == null) {
|
||||
Logger.error(TAG, "loadCrossFade imageView is null")
|
||||
LLogger.error(TAG, "loadCrossFade imageView is null")
|
||||
return
|
||||
}
|
||||
getGlideConfig(imageView.context)?.apply {
|
||||
@@ -521,7 +521,7 @@ class GlideUtils {
|
||||
priority: Priority
|
||||
) {
|
||||
if (imageView == null) {
|
||||
Logger.error(TAG, "loadCrossFade imageView is null")
|
||||
LLogger.error(TAG, "loadCrossFade imageView is null")
|
||||
return
|
||||
}
|
||||
getGlideConfig(imageView.context)?.apply {
|
||||
@@ -546,7 +546,7 @@ class GlideUtils {
|
||||
vararg transformation: Transformation<Bitmap?>?
|
||||
) {
|
||||
if (imageView == null) {
|
||||
Logger.error(TAG, "loadCrossFade imageView is null")
|
||||
LLogger.error(TAG, "loadCrossFade imageView is null")
|
||||
return
|
||||
}
|
||||
getGlideConfig(imageView.context)?.apply {
|
||||
@@ -586,7 +586,7 @@ class GlideUtils {
|
||||
priority: Priority
|
||||
) {
|
||||
if (imageView == null) {
|
||||
Logger.error(TAG, "loadPriority imageView is null")
|
||||
LLogger.error(TAG, "loadPriority imageView is null")
|
||||
return
|
||||
}
|
||||
getGlideConfig(imageView.context)?.apply {
|
||||
@@ -645,7 +645,7 @@ class GlideUtils {
|
||||
vararg transformation: Transformation<Bitmap?>?
|
||||
) {
|
||||
if (imageView == null) {
|
||||
Logger.error(TAG, "loadPriority imageView is null")
|
||||
LLogger.error(TAG, "loadPriority imageView is null")
|
||||
return
|
||||
}
|
||||
getGlideConfig(imageView.context)?.apply {
|
||||
@@ -666,7 +666,7 @@ class GlideUtils {
|
||||
priority: Priority
|
||||
) {
|
||||
if (imageView == null) {
|
||||
Logger.error(TAG, "loadPriority imageView is null")
|
||||
LLogger.error(TAG, "loadPriority imageView is null")
|
||||
return
|
||||
}
|
||||
getGlideConfig(imageView.context)?.apply {
|
||||
@@ -699,7 +699,7 @@ class GlideUtils {
|
||||
*/
|
||||
fun loadResBySize(imageView: ImageView?, @DrawableRes resId: Int, width: Int, height: Int) {
|
||||
if (imageView == null) {
|
||||
Logger.error(TAG, "loadSquareIcon imageView is null")
|
||||
LLogger.error(TAG, "loadSquareIcon imageView is null")
|
||||
return
|
||||
}
|
||||
getGlideConfig(imageView.context)?.apply {
|
||||
@@ -827,7 +827,7 @@ class GlideUtils {
|
||||
vararg transformation: Transformation<Bitmap?>?
|
||||
) {
|
||||
if (imageView == null) {
|
||||
Logger.error(TAG, "loadLocalFile imageView is null")
|
||||
LLogger.error(TAG, "loadLocalFile imageView is null")
|
||||
return
|
||||
}
|
||||
val file = File(filePath)
|
||||
@@ -854,7 +854,7 @@ class GlideUtils {
|
||||
height: Int
|
||||
) {
|
||||
if (imageView == null) {
|
||||
Logger.error(TAG, "loadLocalFile imageView is null")
|
||||
LLogger.error(TAG, "loadLocalFile imageView is null")
|
||||
return
|
||||
}
|
||||
val file = File(filePath)
|
||||
@@ -896,7 +896,7 @@ class GlideUtils {
|
||||
if (imageView == null)
|
||||
return
|
||||
if (TextUtils.isEmpty(filePath)) {
|
||||
Logger.error(TAG, "loadLocalFile url is empty.")
|
||||
LLogger.error(TAG, "loadLocalFile url is empty.")
|
||||
getGlideConfig(imageView.context)?.apply {
|
||||
this
|
||||
.load(defaultDrawable)
|
||||
@@ -923,7 +923,7 @@ class GlideUtils {
|
||||
@DrawableRes defaultRes: Int,
|
||||
) {
|
||||
if (imageView == null) {
|
||||
Logger.error(TAG, "loadRoundIcon imageView is null")
|
||||
LLogger.error(TAG, "loadRoundIcon imageView is null")
|
||||
return
|
||||
}
|
||||
getGlideConfig(imageView.context)?.apply {
|
||||
@@ -942,7 +942,7 @@ class GlideUtils {
|
||||
// 加载圆形本地头像
|
||||
fun loadRoundIcon(resId: Int, imageView: ImageView?) {
|
||||
if (imageView == null) {
|
||||
Logger.error(TAG, "loadRoundIcon imageView is null")
|
||||
LLogger.error(TAG, "loadRoundIcon imageView is null")
|
||||
return
|
||||
}
|
||||
getGlideConfig(imageView.context)?.apply {
|
||||
@@ -991,7 +991,7 @@ class GlideUtils {
|
||||
*/
|
||||
fun loadGiftRes(@DrawableRes resId: Int, imageView: ImageView?) {
|
||||
if (imageView == null) {
|
||||
Logger.error(TAG, "loadGiftRes imageView is null")
|
||||
LLogger.error(TAG, "loadGiftRes imageView is null")
|
||||
return
|
||||
}
|
||||
getGlideConfig(imageView.context)?.apply {
|
||||
@@ -1008,7 +1008,7 @@ class GlideUtils {
|
||||
anim: Int
|
||||
) {
|
||||
if (imageView == null) {
|
||||
Logger.error(TAG, "loadGiftRes imageView is null")
|
||||
LLogger.error(TAG, "loadGiftRes imageView is null")
|
||||
return
|
||||
}
|
||||
getGlideConfig(imageView.context)?.apply {
|
||||
@@ -1023,7 +1023,7 @@ class GlideUtils {
|
||||
*/
|
||||
fun loadGift(url: String?, imageView: ImageView?) {
|
||||
if (imageView == null) {
|
||||
Logger.error(TAG, "loadGif imageView is null")
|
||||
LLogger.error(TAG, "loadGif imageView is null")
|
||||
return
|
||||
}
|
||||
getGlideConfig(imageView.context)?.apply {
|
||||
@@ -1043,7 +1043,7 @@ class GlideUtils {
|
||||
imageView: ImageView?
|
||||
) {
|
||||
if (imageView == null) {
|
||||
Logger.error(TAG, "loadGif imageView is null")
|
||||
LLogger.error(TAG, "loadGif imageView is null")
|
||||
return
|
||||
}
|
||||
getGlideConfig(imageView.context)?.apply {
|
||||
@@ -1067,7 +1067,7 @@ class GlideUtils {
|
||||
callBack: IGlideLoaderCallBack?
|
||||
) {
|
||||
if (imageView == null) {
|
||||
Logger.error(TAG, "loadGifImage imageView is null")
|
||||
LLogger.error(TAG, "loadGifImage imageView is null")
|
||||
return
|
||||
}
|
||||
val builder = ComplexTransformation.ComplexParamsBuilder()
|
||||
@@ -1090,7 +1090,7 @@ class GlideUtils {
|
||||
target: Target<Drawable?>,
|
||||
isFirstResource: Boolean
|
||||
): Boolean {
|
||||
Logger.error(TAG, "loadGifImage url:$url, onException:$e")
|
||||
LLogger.error(TAG, "loadGifImage url:$url, onException:$e")
|
||||
callBack?.onError()
|
||||
return false
|
||||
}
|
||||
@@ -1122,7 +1122,7 @@ class GlideUtils {
|
||||
callBack: IGlideLoaderCallBack?
|
||||
) {
|
||||
if (imageView == null) {
|
||||
Logger.error(TAG, "loadAssignScaleImage imageView is null")
|
||||
LLogger.error(TAG, "loadAssignScaleImage imageView is null")
|
||||
return
|
||||
}
|
||||
getGlideConfig(imageView.context)?.apply {
|
||||
@@ -1138,7 +1138,7 @@ class GlideUtils {
|
||||
target: Target<Drawable?>,
|
||||
isFirstResource: Boolean
|
||||
): Boolean {
|
||||
Logger.error(
|
||||
LLogger.error(
|
||||
TAG,
|
||||
"loadAssignScaleImage url:$url, onException:$e"
|
||||
)
|
||||
@@ -1167,7 +1167,7 @@ class GlideUtils {
|
||||
*/
|
||||
fun loadCircleImage(url: String?, @DrawableRes resId: Int, imageView: ImageView?) {
|
||||
if (imageView == null) {
|
||||
Logger.error(TAG, "loadCircleImage imageView is null")
|
||||
LLogger.error(TAG, "loadCircleImage imageView is null")
|
||||
return
|
||||
}
|
||||
getGlideConfig(imageView.context)?.apply {
|
||||
@@ -1189,7 +1189,7 @@ class GlideUtils {
|
||||
imageView: ImageView?
|
||||
) {
|
||||
if (imageView == null) {
|
||||
Logger.error(TAG, "loadHalfConnerImage imageView is null")
|
||||
LLogger.error(TAG, "loadHalfConnerImage imageView is null")
|
||||
return
|
||||
}
|
||||
getGlideConfig(imageView.context)?.apply {
|
||||
@@ -1216,7 +1216,7 @@ class GlideUtils {
|
||||
imageView: ImageView?
|
||||
) {
|
||||
if (imageView == null) {
|
||||
Logger.error(TAG, "ImageLoader ImageView is null")
|
||||
LLogger.error(TAG, "ImageLoader ImageView is null")
|
||||
return
|
||||
}
|
||||
getGlideConfig(imageView.context)?.apply {
|
||||
@@ -1236,7 +1236,7 @@ class GlideUtils {
|
||||
// 加载本地资源图片
|
||||
fun loadLocalRes(@DrawableRes resId: Int, imageView: ImageView?) {
|
||||
if (imageView == null) {
|
||||
Logger.error(TAG, "loadLocalRes imageView is null")
|
||||
LLogger.error(TAG, "loadLocalRes imageView is null")
|
||||
return
|
||||
}
|
||||
getGlideConfig(imageView.context)?.apply {
|
||||
@@ -1257,7 +1257,7 @@ class GlideUtils {
|
||||
format: DecodeFormat
|
||||
) {
|
||||
if (imageView == null) {
|
||||
Logger.error(TAG, "loadLocalRes imageView is null")
|
||||
LLogger.error(TAG, "loadLocalRes imageView is null")
|
||||
return
|
||||
}
|
||||
getGlideConfig(imageView.context)?.apply {
|
||||
@@ -1280,7 +1280,7 @@ class GlideUtils {
|
||||
vararg transformation: Transformation<Bitmap?>?
|
||||
) {
|
||||
if (imageView == null) {
|
||||
Logger.error(TAG, "loadLocalRes imageView is null")
|
||||
LLogger.error(TAG, "loadLocalRes imageView is null")
|
||||
return
|
||||
}
|
||||
getGlideConfig(imageView.context)?.apply {
|
||||
@@ -1294,7 +1294,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")
|
||||
LLogger.error(TAG, "loadAssetsImg path is invalid or imageView is null")
|
||||
return
|
||||
}
|
||||
getGlideConfig(imageView.context)?.apply {
|
||||
@@ -1309,7 +1309,7 @@ class GlideUtils {
|
||||
*/
|
||||
fun loadResCenterCrop(@DrawableRes resId: Int, imageView: ImageView?) {
|
||||
if (imageView == null) {
|
||||
Logger.error(TAG, "loadResScale imageView is null")
|
||||
LLogger.error(TAG, "loadResScale imageView is null")
|
||||
return
|
||||
}
|
||||
getGlideConfig(imageView.context)?.apply {
|
||||
@@ -1324,7 +1324,7 @@ class GlideUtils {
|
||||
*/
|
||||
fun loadResFitCenter(@DrawableRes resId: Int, imageView: ImageView?) {
|
||||
if (imageView == null) {
|
||||
Logger.error(TAG, "loadResFitCenter imageView is null")
|
||||
LLogger.error(TAG, "loadResFitCenter imageView is null")
|
||||
return
|
||||
}
|
||||
getGlideConfig(imageView.context)?.apply {
|
||||
@@ -1340,7 +1340,7 @@ class GlideUtils {
|
||||
*/
|
||||
fun loadFitCenter(url: String, imageView: ImageView?) {
|
||||
if (imageView == null) {
|
||||
Logger.error(TAG, " loadFitCenter imageViw is null")
|
||||
LLogger.error(TAG, " loadFitCenter imageViw is null")
|
||||
return
|
||||
}
|
||||
getGlideConfig(imageView.context)?.apply {
|
||||
@@ -1357,7 +1357,7 @@ class GlideUtils {
|
||||
*/
|
||||
fun loadFitCenter(url: String?, @DrawableRes errorRes: Int, imageView: ImageView?) {
|
||||
if (imageView == null) {
|
||||
Logger.error(TAG, " loadFitCenter imageViw is null")
|
||||
LLogger.error(TAG, " loadFitCenter imageViw is null")
|
||||
return
|
||||
}
|
||||
getGlideConfig(imageView.context)?.apply {
|
||||
@@ -1405,7 +1405,7 @@ class GlideUtils {
|
||||
vararg transformation: Transformation<Bitmap?>?
|
||||
) {
|
||||
if (imageView == null) {
|
||||
Logger.error(TAG, "load imageViw is null")
|
||||
LLogger.error(TAG, "load imageViw is null")
|
||||
return
|
||||
}
|
||||
getGlideConfig(imageView.context)?.apply {
|
||||
@@ -1427,7 +1427,7 @@ class GlideUtils {
|
||||
vararg transformation: Transformation<Bitmap?>?
|
||||
) {
|
||||
if (imageView == null) {
|
||||
Logger.error(TAG, "load imageViw is null")
|
||||
LLogger.error(TAG, "load imageViw is null")
|
||||
return
|
||||
}
|
||||
getGlideConfig(imageView.context)?.apply {
|
||||
@@ -1451,7 +1451,7 @@ class GlideUtils {
|
||||
listener: RequestListener<File?>?
|
||||
) {
|
||||
if (context == null) {
|
||||
Logger.error(TAG, "load context is null")
|
||||
LLogger.error(TAG, "load context is null")
|
||||
return
|
||||
}
|
||||
|
||||
@@ -1464,7 +1464,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")
|
||||
LLogger.error(TAG, "load imageViw is null")
|
||||
return
|
||||
}
|
||||
getGlideConfig(imageView.context)?.apply {
|
||||
@@ -1484,7 +1484,7 @@ class GlideUtils {
|
||||
listener: RequestListener<Bitmap?>
|
||||
) {
|
||||
if (imageView == null || TextUtils.isEmpty(url)) {
|
||||
Logger.error(TAG, "load imageViw is null")
|
||||
LLogger.error(TAG, "load imageViw is null")
|
||||
return
|
||||
}
|
||||
getGlideConfig(imageView.context)?.apply {
|
||||
@@ -1496,7 +1496,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")
|
||||
LLogger.error(TAG, "load url is invalid or imageViw is null")
|
||||
return
|
||||
}
|
||||
getGlideConfig(imageView.context)?.apply {
|
||||
@@ -1509,7 +1509,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")
|
||||
LLogger.error(TAG, "load url imageViw is null")
|
||||
return
|
||||
}
|
||||
getGlideConfig(imageView.context)?.apply {
|
||||
@@ -1525,7 +1525,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")
|
||||
LLogger.error(TAG, "load url is invalid or imageViw is null")
|
||||
return
|
||||
}
|
||||
getGlideConfig(imageView.context)?.apply {
|
||||
@@ -1543,7 +1543,7 @@ class GlideUtils {
|
||||
imageView: ImageView?
|
||||
) {
|
||||
if (imageView == null) {
|
||||
Logger.error(TAG, "load url is invalid or imageViw is null")
|
||||
LLogger.error(TAG, "load url is invalid or imageViw is null")
|
||||
return
|
||||
}
|
||||
getGlideConfig(imageView.context)?.apply {
|
||||
|
@@ -11,7 +11,7 @@ import com.nnbc123.library.common.application.BaseApp
|
||||
import com.nnbc123.library.common.delegate.SpDelegate
|
||||
import com.nnbc123.library.common.file.FileHelper
|
||||
import com.nnbc123.library.common.glide.GlideEngine
|
||||
import com.nnbc123.library.common.util.Logger
|
||||
import com.nnbc123.library.common.util.LLogger
|
||||
import com.nnbc123.library.easyphoto.EasyPhotos
|
||||
import com.nnbc123.library.easyphoto.constant.Type.*
|
||||
import com.nnbc123.library.easyphoto.models.album.entity.Photo
|
||||
@@ -217,7 +217,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 ")
|
||||
LLogger.debug(TAG, "path: ${it.path} , displayName: ${it.name} , newPath: $path ")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -231,7 +231,7 @@ object PhotoProviderNew {
|
||||
* 清除复制缓存
|
||||
*/
|
||||
fun clearCache() {
|
||||
Logger.debug(
|
||||
LLogger.debug(
|
||||
TAG, "clearCache => mLastSelectTime: ${TimeUtils.getDateTimeString(
|
||||
mLastSelectTime, TIME_FORMAT)}")
|
||||
FileHelper.removeAllFile(getInternalPath() + File.separator)
|
||||
|
@@ -9,13 +9,13 @@ public class CoreUtils {
|
||||
|
||||
public static <T> void send(T moduleCallback) {
|
||||
if (moduleCallback == null) {
|
||||
Logger.warn(TAG, "moduleCallback == null");
|
||||
LLogger.warn(TAG, "moduleCallback == null");
|
||||
return;
|
||||
}
|
||||
try {
|
||||
CoreUtils.getEventBus().post(moduleCallback);
|
||||
} catch (Exception e) {
|
||||
Logger.error(TAG, "EventBus exception", e);
|
||||
LLogger.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);
|
||||
LLogger.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);
|
||||
LLogger.error(TAG, "unregister error", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -166,9 +166,9 @@ object DeviceUtil {
|
||||
deviceId = UTDevice.getUtdid(context)
|
||||
if (TextUtils.isEmpty(deviceId)) {
|
||||
deviceId = handyDevicesId
|
||||
Logger.info(TAG, "use handy deviceId=$deviceId")
|
||||
LLogger.info(TAG, "use handy deviceId=$deviceId")
|
||||
} else {
|
||||
Logger.info(TAG, "use system deviceId=$deviceId")
|
||||
LLogger.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")
|
||||
LLogger.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")
|
||||
LLogger.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")
|
||||
LLogger.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)
|
||||
LLogger.error(TAG, e.message)
|
||||
}
|
||||
return ""
|
||||
}
|
||||
@@ -254,7 +254,7 @@ object DeviceUtil {
|
||||
return mcc
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
Logger.error(TAG, e.message)
|
||||
LLogger.error(TAG, e.message)
|
||||
}
|
||||
return ""
|
||||
}
|
||||
@@ -273,7 +273,7 @@ object DeviceUtil {
|
||||
return mnc
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
Logger.error(TAG, e.message)
|
||||
LLogger.error(TAG, e.message)
|
||||
}
|
||||
return ""
|
||||
}
|
||||
@@ -297,7 +297,7 @@ object DeviceUtil {
|
||||
installed = true
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
Logger.error(TAG, "isAppInstalled packageName=$packageName", e)
|
||||
LLogger.error(TAG, "isAppInstalled packageName=$packageName", e)
|
||||
}
|
||||
installed
|
||||
}
|
||||
|
@@ -49,7 +49,7 @@ public class ExecutorCenter {
|
||||
|
||||
private boolean checkNull(Runnable runnable) {
|
||||
if (null == runnable) {
|
||||
Logger.error(TAG, "runnable null!!!!");
|
||||
LLogger.error(TAG, "runnable null!!!!");
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@@ -36,7 +36,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
*
|
||||
*/
|
||||
@SuppressLint("SimpleDateFormat")
|
||||
public class Logger {
|
||||
public class LLogger {
|
||||
|
||||
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, LLogger> loggers = new ConcurrentHashMap<String, LLogger>();
|
||||
// private static Context context;
|
||||
private static LoggerThread loggerThread; // 用于在另一个线程写log文件
|
||||
|
||||
@@ -92,7 +92,7 @@ public class Logger {
|
||||
|
||||
private String myTag;
|
||||
|
||||
private Logger(String tag) {
|
||||
private LLogger(String tag) {
|
||||
myTag = tag;
|
||||
}
|
||||
|
||||
@@ -159,33 +159,33 @@ public class Logger {
|
||||
}
|
||||
}
|
||||
|
||||
public static Logger getLogger(String tag) {
|
||||
public static LLogger getLogger(String tag) {
|
||||
if (StringUtils.isEmpty(tag)) {
|
||||
tag = "Default";
|
||||
}
|
||||
Logger logger;
|
||||
LLogger logger;
|
||||
try {
|
||||
logger = loggers.get(tag);
|
||||
if (logger == null) {
|
||||
logger = new Logger(tag);
|
||||
logger = new LLogger(tag);
|
||||
loggers.put(tag, logger);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
MLog.error("Logger", "getLogger error! " + e);
|
||||
logger = new Logger(tag);
|
||||
logger = new LLogger(tag);
|
||||
}
|
||||
|
||||
return logger;
|
||||
}
|
||||
|
||||
public static Logger getLogger(Class<?> cls) {
|
||||
public static LLogger getLogger(Class<?> cls) {
|
||||
if (cls == null) {
|
||||
return Logger.getLogger("");
|
||||
return LLogger.getLogger("");
|
||||
}
|
||||
|
||||
// String className = cls.getName();
|
||||
// String tag = className.substring(className.lastIndexOf(".") + 1);
|
||||
return Logger.getLogger(cls.getSimpleName());
|
||||
return LLogger.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 (LLogger.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 (LLogger.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);
|
||||
LLogger.log(tag, LogLevel.Verbose, message);
|
||||
}
|
||||
|
||||
public static void debug(String tag, String message) {
|
||||
// message = msgForTextLog(tag, message);
|
||||
Logger.log(tag, LogLevel.Debug, message);
|
||||
LLogger.log(tag, LogLevel.Debug, message);
|
||||
}
|
||||
|
||||
public static void info(String tag, String message) {
|
||||
// message = msgForTextLog(tag, message);
|
||||
Logger.log(tag, LogLevel.Info, message);
|
||||
LLogger.log(tag, LogLevel.Info, message);
|
||||
}
|
||||
|
||||
public static void warn(String tag, String message) {
|
||||
// message = msgForTextLog(tag, message);
|
||||
Logger.log(tag, LogLevel.Warn, message);
|
||||
LLogger.log(tag, LogLevel.Warn, message);
|
||||
}
|
||||
|
||||
public static void error(String tag, String message) {
|
||||
// message = msgForTextLog(tag, message);
|
||||
Logger.log(tag, LogLevel.Error, message);
|
||||
LLogger.log(tag, LogLevel.Error, message);
|
||||
}
|
||||
|
||||
public static void error(String tag, String message, Throwable throwable) {
|
||||
// message = msgForTextLog(tag, message);
|
||||
Logger.logError(tag, message, throwable);
|
||||
LLogger.logError(tag, message, throwable);
|
||||
}
|
||||
|
||||
public void verbose(String message) {
|
||||
Logger.verbose(myTag, message);
|
||||
LLogger.verbose(myTag, message);
|
||||
// message = msgForTextLog(myTag, message);
|
||||
// MLog.verboseWithoutLineNumber(myTag, message);
|
||||
}
|
||||
|
||||
public void debug(String message) {
|
||||
Logger.debug(myTag, message);
|
||||
LLogger.debug(myTag, message);
|
||||
// message = msgForTextLog(myTag, message);
|
||||
// MLog.debugWithoutLineNumber(myTag, message);
|
||||
}
|
||||
|
||||
public void info(String message) {
|
||||
Logger.info(myTag, message);
|
||||
LLogger.info(myTag, message);
|
||||
// message = msgForTextLog(myTag, message);
|
||||
// MLog.infoWithoutLineNumber(myTag, message);
|
||||
}
|
||||
|
||||
public void warn(String message) {
|
||||
Logger.warn(myTag, message);
|
||||
LLogger.warn(myTag, message);
|
||||
// message = msgForTextLog(myTag, message);
|
||||
// MLog.warnWithoutLineNumber(myTag, message);
|
||||
}
|
||||
|
||||
public void error(String message) {
|
||||
Logger.error(myTag, message);
|
||||
LLogger.error(myTag, message);
|
||||
// message = msgForTextLog(myTag, message);
|
||||
// MLog.errorWithoutLineNumber(myTag, message);
|
||||
}
|
||||
|
||||
public void error(String message, Throwable throwable) {
|
||||
Logger.logError(myTag, message, throwable);
|
||||
LLogger.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 = "[" + LLogger.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());
|
||||
LLogger.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);
|
||||
LLogger.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());
|
||||
LLogger.debug("Logger", "write logs before logger thread ready to file: " + list.size());
|
||||
for (String s : list) {
|
||||
handler.writeLine(s);
|
||||
}
|
@@ -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));
|
||||
LLogger.error(TAG, String.valueOf(t));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@@ -23,7 +23,7 @@ public class ReflectionUtils {
|
||||
field.setAccessible(true);
|
||||
field.set(object, value);
|
||||
} catch (Exception e) {
|
||||
Logger.error(TAG, "ReflectionUtils setFieldValue", e);
|
||||
LLogger.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);
|
||||
LLogger.error(TAG, "ReflectionUtils getFieldValue", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@@ -158,19 +158,19 @@ public class Utils {
|
||||
|
||||
public static void executePendingTransactionsSafely(String TAG, FragmentManager fragmentManager) {
|
||||
if (fragmentManager == null) {
|
||||
Logger.error(TAG, "executePendingTransactionsSafely fragmentManager == null");
|
||||
LLogger.error(TAG, "executePendingTransactionsSafely fragmentManager == null");
|
||||
return;
|
||||
}
|
||||
try {
|
||||
fragmentManager.executePendingTransactions();
|
||||
} catch (Exception e) {
|
||||
Logger.error(TAG, String.valueOf(e));
|
||||
LLogger.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);
|
||||
LLogger.error(TAG, "set field value fail", e1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -47,7 +47,7 @@ object ViewBindingUtil {
|
||||
).invoke(null, layoutInflater, parent, true) as? VB
|
||||
} catch (e: Exception) {
|
||||
//merge 标签会找不到
|
||||
Logger.debug(
|
||||
LLogger.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(
|
||||
LLogger.error(
|
||||
TAG,
|
||||
"withGenericBindingClass => ${e.message}" + ", class: " + genericOwner.javaClass.simpleName
|
||||
)
|
||||
@@ -86,7 +86,7 @@ object ViewBindingUtil {
|
||||
genericSuperclass = superclass.genericSuperclass
|
||||
superclass = superclass.superclass
|
||||
}
|
||||
Logger.error(
|
||||
LLogger.error(
|
||||
TAG,
|
||||
"withGenericBindingClass: " + genericOwner.javaClass.simpleName + ", genericSuperclass: " + genericOwner.javaClass.genericSuperclass
|
||||
)
|
||||
|
Reference in New Issue
Block a user