Permalink
Browse files

handle finishing activity

  • Loading branch information...
herrlado committed Feb 8, 2012
1 parent daf679f commit dcebbcc824b523cdffa951ffeec6fef2e2c894e8
Showing with 14 additions and 0 deletions.
  1. +14 −0 src/org/herrlado/geofonts/Installer.java
@@ -33,6 +33,7 @@
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ProgressBar;
+import android.widget.Toast;
public class Installer extends Activity implements OnClickListener,
DialogInterface.OnClickListener {
@@ -78,13 +79,21 @@
//private SDCardMountIntentReceiver sDCardMountIntentReceiver = null;
private void alertUser(String text, DialogInterface.OnClickListener listener) {
+ if(isFinishing()){
+ Toast.makeText(this,text, Toast.LENGTH_SHORT).show();
+ return;
+ }
new AlertDialog.Builder(this).setMessage(text).setCancelable(false)
.setTitle(R.string.alert_warn)
.setIcon(android.R.drawable.ic_dialog_alert)
.setPositiveButton(R.string.alert_ok, listener).show();
}
private void notifyUser(String text) {
+ if(isFinishing()){
+ Toast.makeText(this,text, Toast.LENGTH_SHORT).show();
+ return;
+ }
new AlertDialog.Builder(this).setMessage(text).setCancelable(false)
.setTitle(R.string.alert_info)
.setIcon(android.R.drawable.ic_dialog_info)
@@ -309,6 +318,10 @@ public void onCreate(Bundle savedInstanceState) {
ShellCommand shc = new ShellCommand();
if (shc.canSU(true) == false) {
+ if(isFinishing()){
+ Toast.makeText(Installer.this, "This app cannot gain Super User permissions. Is your device rooted?", Toast.LENGTH_SHORT).show();
+ return;
+ }
new AlertDialog.Builder(this)
.setTitle(R.string.alert_warn)
.setMessage(
@@ -463,6 +476,7 @@ public final boolean onCreateOptionsMenu(final Menu menu) {
inflater.inflate(R.menu.menu, menu);
return true;
}
+
@Override
public final boolean onOptionsItemSelected(final MenuItem item) {

0 comments on commit dcebbcc

Please sign in to comment.