comparison android/DWindows.kt @ 2516:8f5d064b7054

Android: Fix the down arrow on the comboboxes, found a system resource that works. Also use system resources for "Ok" and "Cancel" ... the "Yes" and "No" are wrong... and deprecated so those are hardcoded and not localized for now.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Sat, 08 May 2021 01:54:52 +0000
parents 211044d98e86
children d746323f2841
comparison
equal deleted inserted replaced
2515:211044d98e86 2516:8f5d064b7054
87 class DWComboBox(context: Context) : AppCompatEditText(context), OnTouchListener, OnItemClickListener { 87 class DWComboBox(context: Context) : AppCompatEditText(context), OnTouchListener, OnItemClickListener {
88 var lpw: ListPopupWindow? = null 88 var lpw: ListPopupWindow? = null
89 var list = mutableListOf<String>() 89 var list = mutableListOf<String>()
90 90
91 init { 91 init {
92 //setCompoundDrawablesWithIntrinsicBounds(0, 0, R.drawable.unfold, 0); 92 setCompoundDrawablesWithIntrinsicBounds(0, 0, android.R.drawable.arrow_down_float, 0);
93 setOnTouchListener(this) 93 setOnTouchListener(this)
94 lpw = ListPopupWindow(context) 94 lpw = ListPopupWindow(context)
95 lpw!!.setAdapter( 95 lpw!!.setAdapter(
96 ArrayAdapter( 96 ArrayAdapter(
97 context, 97 context,
1090 var alert = AlertDialog.Builder(this) 1090 var alert = AlertDialog.Builder(this)
1091 1091
1092 alert.setTitle(title) 1092 alert.setTitle(title)
1093 alert.setMessage(body) 1093 alert.setMessage(body)
1094 if ((flags and (1 shl 3)) != 0) { 1094 if ((flags and (1 shl 3)) != 0) {
1095 alert.setPositiveButton( 1095 alert.setPositiveButton("Yes",
1096 "Yes", 1096 //android.R.string.yes,
1097 DialogInterface.OnClickListener { _: DialogInterface, _: Int -> 1097 DialogInterface.OnClickListener { _: DialogInterface, _: Int ->
1098 retval = 1 1098 retval = 1
1099 throw java.lang.RuntimeException() 1099 throw java.lang.RuntimeException()
1100 }); 1100 });
1101 } 1101 }
1102 if ((flags and ((1 shl 1) or (1 shl 2))) != 0) { 1102 if ((flags and ((1 shl 1) or (1 shl 2))) != 0) {
1103 alert.setNegativeButton( 1103 alert.setNegativeButton(
1104 "Ok", 1104 android.R.string.ok,
1105 DialogInterface.OnClickListener { _: DialogInterface, _: Int -> 1105 DialogInterface.OnClickListener { _: DialogInterface, _: Int ->
1106 retval = 0 1106 retval = 0
1107 throw java.lang.RuntimeException() 1107 throw java.lang.RuntimeException()
1108 }); 1108 });
1109 } 1109 }
1110 if ((flags and ((1 shl 3) or (1 shl 4))) != 0) { 1110 if ((flags and ((1 shl 3) or (1 shl 4))) != 0) {
1111 alert.setNegativeButton( 1111 alert.setNegativeButton("No",
1112 "No", 1112 //android.R.string.no,
1113 DialogInterface.OnClickListener { _: DialogInterface, _: Int -> 1113 DialogInterface.OnClickListener { _: DialogInterface, _: Int ->
1114 retval = 0 1114 retval = 0
1115 throw java.lang.RuntimeException() 1115 throw java.lang.RuntimeException()
1116 }); 1116 });
1117 } 1117 }
1118 if ((flags and ((1 shl 2) or (1 shl 4))) != 0) { 1118 if ((flags and ((1 shl 2) or (1 shl 4))) != 0) {
1119 alert.setNeutralButton( 1119 alert.setNeutralButton(
1120 "Cancel", 1120 android.R.string.cancel,
1121 DialogInterface.OnClickListener { _: DialogInterface, _: Int -> 1121 DialogInterface.OnClickListener { _: DialogInterface, _: Int ->
1122 retval = 2 1122 retval = 2
1123 throw java.lang.RuntimeException() 1123 throw java.lang.RuntimeException()
1124 }); 1124 });
1125 } 1125 }