1. minor GUI fixes

This commit is contained in:
vadym 2020-07-02 10:53:00 -07:00
parent 21c70cb0f7
commit efca13b58f
2 changed files with 10 additions and 9 deletions

View File

@ -133,13 +133,17 @@ class PeerListActivity : AppCompatActivity() {
this.resources.configuration.locale.country this.resources.configuration.locale.country
} }
var schemaInput = view.findViewById<TextView>(R.id.schemaInput) var schemaInput = view.findViewById<TextView>(R.id.schemaInput)
var ipInput = view.findViewById<TextView>(R.id.ipInput)
ipInput.requestFocus()
schemaInput.showSoftInputOnFocus = false schemaInput.showSoftInputOnFocus = false
schemaInput.setOnFocusChangeListener { v, b -> schemaInput.setOnFocusChangeListener { v, b ->
if(schemaInput.isFocused) { if(schemaInput.isFocused) {
val height = -1 * v.height +30 onClickSchemaList(v)
getAddressListPopup()?.showAsDropDown(v, -10, height)
} }
} }
schemaInput.setOnClickListener { v->
onClickSchemaList(v)
}
getPopupWindow(R.layout.spinner_item, resources.getStringArray(R.array.schemas), schemaInput, getString(R.string.schema)); getPopupWindow(R.layout.spinner_item, resources.getStringArray(R.array.schemas), schemaInput, getString(R.string.schema));
var ccp = view.findViewById<com.hbb20.CountryCodePicker>(R.id.ccp) var ccp = view.findViewById<com.hbb20.CountryCodePicker>(R.id.ccp)
ccp.setCountryForNameCode(countryCode) ccp.setCountryForNameCode(countryCode)
@ -148,7 +152,6 @@ class PeerListActivity : AppCompatActivity() {
var ad = ab.show() var ad = ab.show()
var addButton = view.findViewById<Button>(R.id.add) var addButton = view.findViewById<Button>(R.id.add)
addButton.setOnClickListener{ addButton.setOnClickListener{
var ipInput = view.findViewById<TextView>(R.id.ipInput)
var portInput = view.findViewById<TextView>(R.id.portInput) var portInput = view.findViewById<TextView>(R.id.portInput)
var ccpInput = view.findViewById<com.hbb20.CountryCodePicker>(R.id.ccp) var ccpInput = view.findViewById<com.hbb20.CountryCodePicker>(R.id.ccp)
var schema = schemaInput.text.toString().toLowerCase() var schema = schemaInput.text.toString().toLowerCase()
@ -175,7 +178,7 @@ class PeerListActivity : AppCompatActivity() {
fun onClickSchemaList(v: View) { fun onClickSchemaList(v: View) {
val height = -1 * v.height +30 val height = -1 * v.height +30
getAddressListPopup()?.showAsDropDown(v, -10, height) getAddressListPopup()?.showAsDropDown(v, -5, height)
} }
private fun getAddressListPopup(): PopupWindow? { private fun getAddressListPopup(): PopupWindow? {
@ -203,7 +206,7 @@ class PeerListActivity : AppCompatActivity() {
//popupWindow.setWidth(400); //popupWindow.setWidth(400);
val display: Display = val display: Display =
(this.getSystemService(Context.WINDOW_SERVICE) as WindowManager).getDefaultDisplay() (this.getSystemService(Context.WINDOW_SERVICE) as WindowManager).getDefaultDisplay()
popupWindow.width = display.getWidth() - 230 popupWindow.width = 320
popupWindow.height = WindowManager.LayoutParams.WRAP_CONTENT popupWindow.height = WindowManager.LayoutParams.WRAP_CONTENT
// set the list view as pop up window content // set the list view as pop up window content
popupWindow.contentView = listView popupWindow.contentView = listView

View File

@ -23,9 +23,7 @@
android:hint="Schema" android:hint="Schema"
android:textColor="@color/white" android:textColor="@color/white"
android:inputType="textNoSuggestions" android:inputType="textNoSuggestions"
android:textCursorDrawable="@null" android:textCursorDrawable="@null"/>
android:onClick="onClickSchemaList"
/>
</com.google.android.material.textfield.TextInputLayout> </com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout <com.google.android.material.textfield.TextInputLayout
@ -49,7 +47,7 @@
android:inputType="textNoSuggestions" android:inputType="textNoSuggestions"
android:textColor="@color/white" android:textColor="@color/white"
android:textCursorDrawable="@null" android:textCursorDrawable="@null"
/> android:focusedByDefault="true"/>
</com.google.android.material.textfield.TextInputLayout> </com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout <com.google.android.material.textfield.TextInputLayout