Skip to content

Commit

Permalink
💄 ui: added icons in the dialog.
Browse files Browse the repository at this point in the history
  • Loading branch information
huangyz0918 committed Aug 12, 2019
1 parent 0877e6d commit a0a3445
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ public static AlertDialog createSimpleDialog(Context context, String title, Stri
*/
public static AlertDialog createMethodSwitchDialog(Activity targetActivity, DialogInterface.OnClickListener listener) {
AlertDialog alertDialog = new AlertDialog.Builder(targetActivity).create();
alertDialog.setTitle(targetActivity.getString(R.string.switch_method_title));
alertDialog.setCancelable(false);
alertDialog.setButton(DialogInterface.BUTTON_POSITIVE, targetActivity.getString(R.string.cancel),
(dialog, i) -> {
Expand All @@ -52,8 +51,12 @@ public static AlertDialog createMethodSwitchDialog(Activity targetActivity, Dial
alertDialog.setButton(DialogInterface.BUTTON_NEGATIVE, targetActivity.getString(R.string.switch_method), listener);

if (targetActivity instanceof BtReceiverActivity || targetActivity instanceof BtSenderActivity) {
alertDialog.setIcon(R.drawable.ic_wifi_tethering_black_24dp);
alertDialog.setTitle(targetActivity.getString(R.string.switch_to_hotspot_title));
alertDialog.setMessage(targetActivity.getString(R.string.hotspot_switch_method));
} else if (targetActivity instanceof HpReceiverActivity || targetActivity instanceof HpSenderActivity) {
alertDialog.setIcon(R.drawable.ic_bluetooth_black_24dp);
alertDialog.setTitle(targetActivity.getString(R.string.switch_to_bluetooth_title));
alertDialog.setMessage(targetActivity.getString(R.string.bluetooth_switch_method));
} else {
throw new IllegalArgumentException("Not a valid activity parameter");
Expand Down
3 changes: 2 additions & 1 deletion skunkworks_crow/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,8 @@
<string name="preference_default_method_summary">Bluetooth</string>
<string name="bluetooth_switch_method">Are you sure to stop and switch to bluetooth method?</string>
<string name="hotspot_switch_method">Are you sure to stop and switch to hotspot method?</string>
<string name="switch_method_title">Switch Method</string>
<string name="switch_to_bluetooth_title">Switch to Bluetooth Method</string>
<string name="switch_to_hotspot_title">Switch to Hotspot Method</string>
<string name="permission_location_denied">Location permission is required to send the forms using Bluetooth. Please allow it in the app settings.</string>
<string name="permission_open_info">Skunkworks-crow app requires location permission to access your Bluetooth. Please allow location permission from your app settings.</string>
<string name="permission_open_info_button">Open Settings</string>
Expand Down

0 comments on commit a0a3445

Please sign in to comment.