Commit 26810fc8 authored by halatmit's avatar halatmit Committed by Gerrit Review System

Change the Notifier to increase the font size for alerts.

Rearraged method definitions

Change-Id: Ic4668e2fc78009bf8758fa65f48eb860c316b6a7
parent bd0f0111
......@@ -15,9 +15,13 @@ import com.google.appinventor.components.common.YaVersion;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.graphics.Color;
import android.graphics.Typeface;
import android.os.Handler;
import android.util.Log;
import android.view.Gravity;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
/**
......@@ -200,11 +204,28 @@ public final class Notifier extends AndroidNonvisibleComponent implements Compon
public void ShowAlert(final String notice) {
handler.post(new Runnable() {
public void run() {
Toast.makeText(activity, notice, Toast.LENGTH_LONG).show();
toastNow(notice);
}
});
}
// show a toast using a TextView, which allows us to set the
// font size. The default toast is too small.
private void toastNow (String message) {
Toast toast = Toast.makeText(activity, message, Toast.LENGTH_LONG);
toast.setGravity(Gravity.CENTER, toast.getXOffset() / 2, toast.getYOffset() / 2);
TextView textView = new TextView(activity);
textView.setBackgroundColor(Color.DKGRAY);
textView.setTextColor(Color.WHITE);
textView.setTextSize(30);
Typeface typeface = Typeface.create("serif", Typeface.BOLD);
textView.setTypeface(typeface);
textView.setPadding(10, 10, 10, 10);
textView.setText(message);
toast.setView(textView);
toast.show();
}
/**
* Log an error message.
*
......
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