1. minor fixes

This commit is contained in:
vadym 2020-07-04 13:17:04 -07:00
parent 5e7ac8cb57
commit 0826a65d68
2 changed files with 7 additions and 11 deletions

View File

@ -45,7 +45,7 @@ class DNSListActivity : AppCompatActivity() {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
setContentView(R.layout.activity_dns_list) setContentView(R.layout.activity_dns_list)
setSupportActionBar(findViewById(R.id.toolbar)) setSupportActionBar(findViewById(R.id.toolbar))
findViewById<FloatingActionButton>(R.id.fab).setOnClickListener { view -> findViewById<FloatingActionButton>(R.id.fab).setOnClickListener { _ ->
addNewDNS() addNewDNS()
} }
var extras = intent.extras var extras = intent.extras
@ -88,6 +88,7 @@ class DNSListActivity : AppCompatActivity() {
} }
@Suppress("DEPRECATION")
private fun addNewDNS() { private fun addNewDNS() {
val view: View = LayoutInflater.from(this).inflate(R.layout.new_dns_dialog, null) val view: View = LayoutInflater.from(this).inflate(R.layout.new_dns_dialog, null)
val countryCode: String = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { val countryCode: String = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {

View File

@ -61,7 +61,7 @@ class PeerListActivity : AppCompatActivity() {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
setContentView(R.layout.activity_peer_list) setContentView(R.layout.activity_peer_list)
setSupportActionBar(findViewById(R.id.toolbar)) setSupportActionBar(findViewById(R.id.toolbar))
findViewById<FloatingActionButton>(R.id.fab).setOnClickListener { view -> findViewById<FloatingActionButton>(R.id.fab).setOnClickListener { _ ->
addNewPeer() addNewPeer()
} }
var extras = intent.extras var extras = intent.extras
@ -141,7 +141,7 @@ class PeerListActivity : AppCompatActivity() {
var ipInput = view.findViewById<TextView>(R.id.ipInput) var ipInput = view.findViewById<TextView>(R.id.ipInput)
ipInput.requestFocus() ipInput.requestFocus()
schemaInput.showSoftInputOnFocus = false schemaInput.showSoftInputOnFocus = false
schemaInput.setOnFocusChangeListener { v, b -> schemaInput.setOnFocusChangeListener { v, _ ->
if(schemaInput.isFocused) { if(schemaInput.isFocused) {
onClickSchemaList(v) onClickSchemaList(v)
} }
@ -149,9 +149,8 @@ class PeerListActivity : AppCompatActivity() {
schemaInput.setOnClickListener { v-> schemaInput.setOnClickListener { v->
onClickSchemaList(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);
var ccp = view.findViewById<com.hbb20.CountryCodePicker>(R.id.ccp) view.findViewById<com.hbb20.CountryCodePicker>(R.id.ccp).setCountryForNameCode(countryCode)
ccp.setCountryForNameCode(countryCode)
val ab: AlertDialog.Builder = AlertDialog.Builder(this) val ab: AlertDialog.Builder = AlertDialog.Builder(this)
ab.setCancelable(true).setView(view) ab.setCancelable(true).setView(view)
var ad = ab.show() var ad = ab.show()
@ -193,8 +192,7 @@ class PeerListActivity : AppCompatActivity() {
private fun getPopupWindow( private fun getPopupWindow(
textViewResourceId: Int, textViewResourceId: Int,
objects: Array<String>, objects: Array<String>,
editText: TextView, editText: TextView
hint: String?
): PopupWindow? { ): PopupWindow? {
// initialize a pop up window type // initialize a pop up window type
val popupWindow = PopupWindow(this) val popupWindow = PopupWindow(this)
@ -208,9 +206,6 @@ class PeerListActivity : AppCompatActivity() {
listView.onItemClickListener = adapter listView.onItemClickListener = adapter
// some other visual settings // some other visual settings
popupWindow.isFocusable = true popupWindow.isFocusable = true
//popupWindow.setWidth(400);
val display: Display =
(this.getSystemService(Context.WINDOW_SERVICE) as WindowManager).getDefaultDisplay()
popupWindow.width = 320 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