diff options
author | John Heroy <johnheroy@gmail.com> | 2015-10-26 14:15:22 -0700 |
---|---|---|
committer | John Heroy <johnheroy@gmail.com> | 2015-10-26 14:15:22 -0700 |
commit | 951d4f609803e92ac1594a8ca4af1165baca8573 (patch) | |
tree | 452b4e575ba2a60799822a141a731c7477975818 | |
parent | d3f6db5a85fcd80edc053259c6fd740cb0a7128f (diff) | |
download | connectbot-951d4f609803e92ac1594a8ca4af1165baca8573.tar.gz connectbot-951d4f609803e92ac1594a8ca4af1165baca8573.tar.bz2 connectbot-951d4f609803e92ac1594a8ca4af1165baca8573.zip |
Refactor all uses of framework AlertDialog to use v7 support version instead with AlertDialogTheme instead
5 files changed, 33 insertions, 21 deletions
diff --git a/app/src/main/java/org/connectbot/ConsoleActivity.java b/app/src/main/java/org/connectbot/ConsoleActivity.java index 9cdb4a5..f15174c 100644 --- a/app/src/main/java/org/connectbot/ConsoleActivity.java +++ b/app/src/main/java/org/connectbot/ConsoleActivity.java @@ -31,7 +31,6 @@ import org.connectbot.util.PreferenceConstants; import org.connectbot.util.TerminalViewPager; import android.annotation.TargetApi; -import android.app.AlertDialog; import android.app.Dialog; import android.content.ComponentName; import android.content.Context; @@ -857,7 +856,8 @@ public class ConsoleActivity extends AppCompatActivity implements BridgeDisconne final TerminalView terminalView = adapter.getCurrentTerminalView(); final View resizeView = inflater.inflate(R.layout.dia_resize, null, false); - new AlertDialog.Builder(ConsoleActivity.this) + new android.support.v7.app.AlertDialog.Builder( + ConsoleActivity.this, R.style.AlertDialogTheme) .setView(resizeView) .setPositiveButton(R.string.button_resize, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { diff --git a/app/src/main/java/org/connectbot/HelpActivity.java b/app/src/main/java/org/connectbot/HelpActivity.java index 2a522dc..7fbbf40 100644 --- a/app/src/main/java/org/connectbot/HelpActivity.java +++ b/app/src/main/java/org/connectbot/HelpActivity.java @@ -17,7 +17,6 @@ package org.connectbot; -import android.app.AlertDialog; import android.content.Intent; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; @@ -53,7 +52,8 @@ public class HelpActivity extends AppCompatActivity { public void onClick(View v) { final View shortcuts = inflater.inflate(R.layout.dia_keyboard_shortcuts, null, false); - new AlertDialog.Builder(HelpActivity.this) + new android.support.v7.app.AlertDialog.Builder( + HelpActivity.this, R.style.AlertDialogTheme) .setView(shortcuts) .setTitle(R.string.keyboard_shortcuts) .show(); diff --git a/app/src/main/java/org/connectbot/HostListActivity.java b/app/src/main/java/org/connectbot/HostListActivity.java index 39f810c..d83bd0c 100644 --- a/app/src/main/java/org/connectbot/HostListActivity.java +++ b/app/src/main/java/org/connectbot/HostListActivity.java @@ -28,7 +28,6 @@ import org.connectbot.transport.TransportFactory; import org.connectbot.util.HostDatabase; import org.connectbot.util.PreferenceConstants; -import android.app.AlertDialog; import android.content.ComponentName; import android.content.Context; import android.content.DialogInterface; @@ -295,7 +294,8 @@ public class HostListActivity extends AppCompatListActivity implements OnHostSta return; } - new AlertDialog.Builder(HostListActivity.this) + new android.support.v7.app.AlertDialog.Builder( + HostListActivity.this, R.style.AlertDialogTheme) .setMessage(getString(R.string.disconnect_all_message)) .setPositiveButton(R.string.disconnect_all_pos, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { @@ -454,7 +454,8 @@ public class HostListActivity extends AppCompatListActivity implements OnHostSta delete.setOnMenuItemClickListener(new OnMenuItemClickListener() { public boolean onMenuItemClick(MenuItem item) { // prompt user to make sure they really want this - new AlertDialog.Builder(HostListActivity.this) + new android.support.v7.app.AlertDialog.Builder( + HostListActivity.this, R.style.AlertDialogTheme) .setMessage(getString(R.string.delete_message, host.getNickname())) .setPositiveButton(R.string.delete_pos, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { diff --git a/app/src/main/java/org/connectbot/PortForwardListActivity.java b/app/src/main/java/org/connectbot/PortForwardListActivity.java index e5d3210..efd4f72 100644 --- a/app/src/main/java/org/connectbot/PortForwardListActivity.java +++ b/app/src/main/java/org/connectbot/PortForwardListActivity.java @@ -26,7 +26,6 @@ import org.connectbot.service.TerminalBridge; import org.connectbot.service.TerminalManager; import org.connectbot.util.HostDatabase; -import android.app.AlertDialog; import android.content.ComponentName; import android.content.Context; import android.content.DialogInterface; @@ -36,7 +35,6 @@ import android.content.res.Resources; import android.database.SQLException; import android.graphics.Paint; import android.os.Bundle; -import android.os.Handler; import android.os.IBinder; import android.os.Message; import android.support.annotation.VisibleForTesting; @@ -167,7 +165,8 @@ public class PortForwardListActivity extends AppCompatListActivity { } }); - new AlertDialog.Builder(PortForwardListActivity.this) + new android.support.v7.app.AlertDialog.Builder( + PortForwardListActivity.this, R.style.AlertDialogTheme) .setView(portForwardView) .setPositiveButton(R.string.portforward_pos, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { @@ -312,7 +311,8 @@ public class PortForwardListActivity extends AppCompatListActivity { } }); - new AlertDialog.Builder(PortForwardListActivity.this) + new android.support.v7.app.AlertDialog.Builder( + PortForwardListActivity.this, R.style.AlertDialogTheme) .setView(editTunnelView) .setPositiveButton(R.string.button_change, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { @@ -368,7 +368,8 @@ public class PortForwardListActivity extends AppCompatListActivity { delete.setOnMenuItemClickListener(new OnMenuItemClickListener() { public boolean onMenuItemClick(MenuItem item) { // prompt user to make sure they really want this - new AlertDialog.Builder(PortForwardListActivity.this) + new android.support.v7.app.AlertDialog.Builder( + PortForwardListActivity.this, R.style.AlertDialogTheme) .setMessage(getString(R.string.delete_message, portForward.getNickname())) .setPositiveButton(R.string.delete_pos, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { diff --git a/app/src/main/java/org/connectbot/PubkeyListActivity.java b/app/src/main/java/org/connectbot/PubkeyListActivity.java index df00333..85ca570 100644 --- a/app/src/main/java/org/connectbot/PubkeyListActivity.java +++ b/app/src/main/java/org/connectbot/PubkeyListActivity.java @@ -41,7 +41,6 @@ import com.trilead.ssh2.crypto.Base64; import com.trilead.ssh2.crypto.PEMDecoder; import com.trilead.ssh2.crypto.PEMStructure; -import android.app.AlertDialog; import android.content.ActivityNotFoundException; import android.content.ComponentName; import android.content.Context; @@ -219,7 +218,8 @@ public class PubkeyListActivity extends AppCompatListActivity implements EventLi final View view = View.inflate(this, R.layout.dia_password, null); final EditText passwordField = (EditText) view.findViewById(android.R.id.text1); - new AlertDialog.Builder(PubkeyListActivity.this) + new android.support.v7.app.AlertDialog.Builder( + PubkeyListActivity.this, R.style.AlertDialogTheme) .setView(view) .setPositiveButton(R.string.pubkey_unlock, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { @@ -376,7 +376,8 @@ public class PubkeyListActivity extends AppCompatListActivity implements EventLi final String state = Environment.getExternalStorageState(); if (!Environment.MEDIA_MOUNTED_READ_ONLY.equals(state) && !Environment.MEDIA_MOUNTED.equals(state)) { - new AlertDialog.Builder(PubkeyListActivity.this) + new android.support.v7.app.AlertDialog.Builder( + PubkeyListActivity.this, R.style.AlertDialogTheme) .setMessage(R.string.alert_sdcard_absent) .setNegativeButton(android.R.string.cancel, null).create().show(); return; @@ -398,7 +399,8 @@ public class PubkeyListActivity extends AppCompatListActivity implements EventLi Log.d(TAG, names.toString()); // prompt user to select any file from the sdcard root - new AlertDialog.Builder(PubkeyListActivity.this) + new android.support.v7.app.AlertDialog.Builder( + PubkeyListActivity.this, R.style.AlertDialogTheme) .setTitle(R.string.pubkey_list_pick) .setItems(namesList, new OnClickListener() { public void onClick(DialogInterface arg0, int arg1) { @@ -527,7 +529,8 @@ public class PubkeyListActivity extends AppCompatListActivity implements EventLi View.inflate(PubkeyListActivity.this, R.layout.dia_changepassword, null); ((TableRow) changePasswordView.findViewById(R.id.old_password_prompt)) .setVisibility(pubkey.isEncrypted() ? View.VISIBLE : View.GONE); - new AlertDialog.Builder(PubkeyListActivity.this) + new android.support.v7.app.AlertDialog.Builder( + PubkeyListActivity.this, R.style.AlertDialogTheme) .setView(changePasswordView) .setPositiveButton(R.string.button_change, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { @@ -536,7 +539,9 @@ public class PubkeyListActivity extends AppCompatListActivity implements EventLi String password2 = ((EditText) changePasswordView.findViewById(R.id.password2)).getText().toString(); if (!password1.equals(password2)) { - new AlertDialog.Builder(PubkeyListActivity.this) + new android.support.v7.app.AlertDialog.Builder( + PubkeyListActivity.this, + R.style.AlertDialogTheme) .setMessage(R.string.alert_passwords_do_not_match_msg) .setPositiveButton(android.R.string.ok, null) .create().show(); @@ -545,7 +550,9 @@ public class PubkeyListActivity extends AppCompatListActivity implements EventLi try { if (!pubkey.changePassword(oldPassword, password1)) - new AlertDialog.Builder(PubkeyListActivity.this) + new android.support.v7.app.AlertDialog.Builder( + PubkeyListActivity.this, + R.style.AlertDialogTheme) .setMessage(R.string.alert_wrong_password_msg) .setPositiveButton(android.R.string.ok, null) .create().show(); @@ -556,7 +563,9 @@ public class PubkeyListActivity extends AppCompatListActivity implements EventLi } } catch (Exception e) { Log.e(TAG, "Could not change private key password", e); - new AlertDialog.Builder(PubkeyListActivity.this) + new android.support.v7.app.AlertDialog.Builder( + PubkeyListActivity.this, + R.style.AlertDialogTheme) .setMessage(R.string.alert_key_corrupted_msg) .setPositiveButton(android.R.string.ok, null) .create().show(); @@ -587,7 +596,8 @@ public class PubkeyListActivity extends AppCompatListActivity implements EventLi delete.setOnMenuItemClickListener(new OnMenuItemClickListener() { public boolean onMenuItemClick(MenuItem item) { // prompt user to make sure they really want this - new AlertDialog.Builder(PubkeyListActivity.this) + new android.support.v7.app.AlertDialog.Builder( + PubkeyListActivity.this, R.style.AlertDialogTheme) .setMessage(getString(R.string.delete_message, pubkey.getNickname())) .setPositiveButton(R.string.delete_pos, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { |