| | |
| | | import com.basic.security.R; |
| | | import com.basic.security.base.BaseApplication; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | public class ToastUtil { |
| | | |
| | | public static Toast prevToast = null; |
| | | |
| | | public static void show(final String message) { |
| | | show(message, true); |
| | | } |
| | | |
| | | public static void show(final String message, final boolean error) { |
| | | BaseApplication.getApplication().activity.runOnUiThread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | |
| | | msg.setGravity(Gravity.TOP, msg.getXOffset() / 2, msg.getYOffset() / 2); |
| | | LayoutInflater inflater = (LayoutInflater) BaseApplication.getApplication().getSystemService(Context.LAYOUT_INFLATER_SERVICE); |
| | | View view = inflater.inflate(R.layout.my_toast, null); |
| | | if (error) { |
| | | view = inflater.inflate(R.layout.my_toast_error, null); |
| | | } |
| | | TextView text = view.findViewById(R.id.text); |
| | | text.setText(message); |
| | | msg.setView(view); |