Changed: Do not show toast if text null or empty

This commit is contained in:
agnostic-apollo 2021-10-08 22:32:19 +05:00
parent 87c8f3d35a
commit aee0da49a0
No known key found for this signature in database
GPG key ID: BCCC0287E9DCCAED

View file

@ -7,6 +7,7 @@ import android.util.Log;
import android.widget.Toast;
import com.termux.shared.R;
import com.termux.shared.data.DataUtils;
import com.termux.shared.termux.TermuxConstants;
import java.io.IOException;
@ -363,7 +364,7 @@ public class Logger {
public static void showToast(final Context context, final String toastText, boolean longDuration) {
if (context == null) return;
if (context == null || DataUtils.isNullOrEmpty(toastText)) return;
new Handler(Looper.getMainLooper()).post(() -> Toast.makeText(context, toastText, longDuration ? Toast.LENGTH_LONG : Toast.LENGTH_SHORT).show());
}