Commit 5199dd9e authored by mengcuiguang's avatar mengcuiguang

优化吐司

parent 5d68fb12
......@@ -172,6 +172,8 @@ dependencies {
implementation 'com.androidkun:XTabLayout:1.1.5'
// zxing
implementation 'com.king.zxing:zxing-lite:1.1.7-androidx'
// toast
implementation 'com.hjq:toast:8.8'
// 工具类
// gson
......
......@@ -11,6 +11,7 @@ import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import androidx.multidex.MultiDexApplication;
import com.bun.miitmdid.core.JLibrary;
import com.hjq.toast.ToastUtils;
import com.mints.goodmoney.common.Constant;
import com.mints.goodmoney.manager.ChannelManager;
import com.mints.goodmoney.manager.LiebaoManager;
......@@ -107,6 +108,12 @@ public class MintsApplication extends MultiDexApplication {
* 三方配置
*/
private void thirdConfig() {
try {
ToastUtils.init(this);
} catch (Exception e) {
e.printStackTrace();
}
// 移动安全联盟 oaid
initMiitHelper();
......
......@@ -10,6 +10,7 @@ import android.view.View;
import android.widget.TextView;
import android.widget.Toast;
import com.hjq.toast.ToastUtils;
import com.mints.goodmoney.R;
/**
......@@ -26,11 +27,21 @@ public class ToastUtil {
private static final Object mSynObj = new Object();
public static void show(Context context, String msg) {
showToast(context, msg, Toast.LENGTH_SHORT, Gravity.CENTER);
try {
ToastUtils.show(msg);
} catch (Exception e) {
e.printStackTrace();
showToast(context, msg, Toast.LENGTH_SHORT, Gravity.CENTER);
}
}
public static void showLong(Context context, String msg) {
showToast(context, msg, Toast.LENGTH_LONG, Gravity.CENTER);
try {
ToastUtils.show(msg);
} catch (Exception e) {
e.printStackTrace();
showToast(context, msg, Toast.LENGTH_LONG, Gravity.CENTER);
}
}
public static void show(Context context, String msg, boolean isShowToast) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment