Updated on 2026-08-14

This commit is contained in:
Tangem 2018-12-20 14:23:38 +03:00
parent 89c16fba70
commit 92a057f919
3 changed files with 173 additions and 95 deletions

View file

@ -0,0 +1,58 @@
package com.tangem.util;
import android.util.Log;
import com.tangem.wallet.BuildConfig;
public final class LOG {
public static String TAG = "com.tangem.wallet";
public static void d(String msg) {
d(null, msg);
}
public static void e(String msg) {
e(null, msg);
}
public static void d(String tag, String msg) {
if (BuildConfig.DEBUG)
Log.d(TAG + (tag != null && !tag.equals("") ? "." + tag : ""), msg);
}
public static void d(String tag, int msg) {
if (BuildConfig.DEBUG)
Log.d(TAG + (tag != null && !tag.equals("") ? "." + tag : ""), String.valueOf(msg));
}
public static void i(String tag, String msg) {
if (BuildConfig.DEBUG)
Log.i(TAG + (tag != null && !tag.equals("") ? "." + tag : ""), msg);
}
public static void i(String tag, int msg) {
if (BuildConfig.DEBUG)
Log.i(TAG + (tag != null && !tag.equals("") ? "." + tag : ""), String.valueOf(msg));
}
public static void w(String tag, String msg) {
if (BuildConfig.DEBUG)
Log.w(TAG + (tag != null && !tag.equals("") ? "." + tag : ""), msg);
}
public static void w(String tag, int msg) {
if (BuildConfig.DEBUG)
Log.w(TAG + (tag != null && !tag.equals("") ? "." + tag : ""), String.valueOf(msg));
}
public static void e(String tag, String msg) {
if (BuildConfig.DEBUG)
Log.e(TAG + (tag != null && !tag.equals("") ? "." + tag : ""), msg);
}
public static void e(String tag, int msg) {
if (BuildConfig.DEBUG)
Log.d(TAG + (tag != null && !tag.equals("") ? "." + tag : ""), String.valueOf(msg));
}
}

View file

@ -6,6 +6,7 @@ import android.graphics.Bitmap
import android.graphics.Color
import android.net.ConnectivityManager
import android.net.NetworkInfo
import android.widget.Toast
import com.google.zxing.BarcodeFormat
import com.google.zxing.EncodeHintType
import com.google.zxing.WriterException
@ -48,4 +49,19 @@ object UtilHelper {
}
}
private var singleToast: Toast? = null
private var showTime: Date = Date()
fun showSingleToast(context: Context?, text: String) {
if (singleToast == null || !singleToast!!.view.isShown || showTime.time + 2000 < Date().time) {
if (singleToast != null)
singleToast!!.cancel()
if (context != null) {
singleToast = Toast.makeText(context, text, Toast.LENGTH_LONG)
singleToast!!.show()
showTime = Date()
}
}
}
}