diff options
author | Jeremy Klein <jklein24@gmail.com> | 2015-10-27 14:14:03 -0700 |
---|---|---|
committer | Jeremy Klein <jklein24@gmail.com> | 2015-10-27 14:14:03 -0700 |
commit | 2711885e446b5d18b5487dee0c04dea0b4f68b92 (patch) | |
tree | 5a664c7731d33ccaad2cbd83a270df32ac94eba0 | |
parent | 63a8a42db55fb9d6f101e5c77ec2d753e45b26c5 (diff) | |
parent | bb206a6380f32d0ee48ba856b364fe3697cf7d47 (diff) | |
download | connectbot-2711885e446b5d18b5487dee0c04dea0b4f68b92.tar.gz connectbot-2711885e446b5d18b5487dee0c04dea0b4f68b92.tar.bz2 connectbot-2711885e446b5d18b5487dee0c04dea0b4f68b92.zip |
Merge pull request #332 from johnheroy/canceldialog
Fix colors of positive/negative buttons in new host cancel dialog
7 files changed, 40 insertions, 22 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/EditHostActivity.java b/app/src/main/java/org/connectbot/EditHostActivity.java index d5e2458..427fe26 100644 --- a/app/src/main/java/org/connectbot/EditHostActivity.java +++ b/app/src/main/java/org/connectbot/EditHostActivity.java @@ -234,7 +234,7 @@ public class EditHostActivity extends AppCompatActivity implements HostEditorFra private void showDiscardDialog() { android.support.v7.app.AlertDialog.Builder builder = - new android.support.v7.app.AlertDialog.Builder(this); + new android.support.v7.app.AlertDialog.Builder(this, R.style.AlertDialogTheme); builder.setMessage(R.string.discard_host_changes_message) .setPositiveButton(R.string.discard_host_button, new DialogInterface.OnClickListener() { @Override 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) { diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index f782fb4..80e0a81 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -24,6 +24,10 @@ <item name="colorAccent">@color/accent</item> </style> + <style name="AlertDialogTheme" parent="Theme.AppCompat.Dialog.Alert"> + <item name="colorAccent">@color/accent</item> + </style> + <style name="KeyboardKey"> <item name="android:layout_width">45dip</item> <item name="android:layout_height">30dip</item> @@ -101,4 +105,6 @@ <item name="colorAccent">@color/accent</item> </style> + + </resources> |