This commit is contained in:
wangcongtao
2020-04-15 20:45:43 +08:00
parent 05a0dbb68b
commit aa78e07ce7
13 changed files with 149 additions and 24 deletions

View File

@@ -9,6 +9,7 @@ package com.mogo.utils;
import android.content.Context;
import android.os.Handler;
import android.text.TextUtils;
import android.view.Gravity;
import android.view.View;
import android.widget.Toast;
@@ -144,10 +145,6 @@ public final class TipToast {
sToast.cancel();
}
if ( sGenerator == null ) {
sToast = Toast.makeText( context, msg, duration );
}
if ( sGenerator == null ) {
sToast = Toast.makeText( context, msg, duration );
} else {
@@ -155,6 +152,7 @@ public final class TipToast {
final View view = sGenerator.make( context, msg );
if ( view != null ) {
sToast.setView( view );
sToast.setGravity( sGenerator.gravity(), sGenerator.xOffset(), sGenerator.yOffset() );
sToast.setDuration( duration );
} else {
sToast = Toast.makeText( context, msg, duration );
@@ -171,6 +169,12 @@ public final class TipToast {
public interface ToastViewGenerator {
View make( Context context, String message );
int gravity();
int yOffset();
int xOffset();
}
}