mirror of
https://github.com/nix-community/nix-on-droid-app.git
synced 2025-11-23 18:59:44 +01:00
Changed: Do not show toast if text null or empty
This commit is contained in:
parent
87c8f3d35a
commit
aee0da49a0
1 changed files with 2 additions and 1 deletions
|
|
@ -7,6 +7,7 @@ import android.util.Log;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import com.termux.shared.R;
|
import com.termux.shared.R;
|
||||||
|
import com.termux.shared.data.DataUtils;
|
||||||
import com.termux.shared.termux.TermuxConstants;
|
import com.termux.shared.termux.TermuxConstants;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
@ -363,7 +364,7 @@ public class Logger {
|
||||||
|
|
||||||
|
|
||||||
public static void showToast(final Context context, final String toastText, boolean longDuration) {
|
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());
|
new Handler(Looper.getMainLooper()).post(() -> Toast.makeText(context, toastText, longDuration ? Toast.LENGTH_LONG : Toast.LENGTH_SHORT).show());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue