Updated Navigation Architecture Component library version and tested it worked fine. Setted a maximum width to the MerchantsFragment's SearchView so that it does not move other items out of the screen. Added the auto hide keyboard feature to ReceiveTransactionFragment's AutoCompleteTextView when it loses focus.

This commit is contained in:
Severiano Jaramillo 2019-01-29 11:08:32 -06:00
parent 5fc5db88c2
commit fb7c91d6bb
3 changed files with 12 additions and 1 deletions

View file

@ -57,7 +57,7 @@ android {
dependencies {
def lifecycle_version = "2.0.0"
def room_version = "2.1.0-alpha03"
def nav_version = "1.0.0-alpha09"
def nav_version = "1.0.0-alpha11"
def rx_bindings_version = "3.0.0-alpha2"
implementation fileTree(dir: 'libs', include: ['*.jar'])

View file

@ -182,6 +182,9 @@ class MerchantsFragment : Fragment(), OnMapReadyCallback, SearchView.OnSuggestio
}
mSearchView?.setOnSuggestionListener(this)
// Adjust SearchView width to avoid pushing other menu items out of the screen
mSearchView?.maxWidth = screenWidth * 7 / 10
}
private fun updateSearchViewSuggestions(query: String) {

View file

@ -1,15 +1,18 @@
package cy.agorise.bitsybitshareswallet.views
import android.content.Context
import android.graphics.Rect
import android.util.AttributeSet
import com.google.android.material.textfield.TextInputLayout
import android.view.inputmethod.InputConnection
import android.view.inputmethod.EditorInfo
import androidx.appcompat.widget.AppCompatAutoCompleteTextView
import cy.agorise.bitsybitshareswallet.utils.hideKeyboard
/**
* Custom AutoCompleteTextView to be used inside a TextInputLayout, so that they can share their hint
* From https://stackoverflow.com/a/41864063/5428997
* And also hides the keyboard when it loses focus.
*/
class MyTextInputAutoCompleteTextView : AppCompatAutoCompleteTextView {
@ -42,4 +45,9 @@ class MyTextInputAutoCompleteTextView : AppCompatAutoCompleteTextView {
}
return ic
}
override fun onFocusChanged(focused: Boolean, direction: Int, previouslyFocusedRect: Rect?) {
super.onFocusChanged(focused, direction, previouslyFocusedRect)
if (!focused) this.hideKeyboard()
}
}