mirror of
https://github.com/SimpleMobileTools/Simple-Notes.git
synced 2025-02-07 09:33:19 +01:00
fix #30, hide the fab when keyboard is shown
This commit is contained in:
parent
53be83418b
commit
e50c4f600f
@ -38,9 +38,16 @@ class MainActivity : SimpleActivity(), OpenNoteDialog.OpenNoteListener {
|
||||
mDb = DBHelper.newInstance(applicationContext)
|
||||
mNotes = mDb.getNotes()
|
||||
updateSelectedNote(config.currentNoteId)
|
||||
|
||||
notes_fab.setOnClickListener { displayNewNoteDialog() }
|
||||
notes_fab.viewTreeObserver.addOnGlobalLayoutListener {
|
||||
val heightDiff = notes_coordinator.rootView.height - notes_coordinator.height
|
||||
notes_fab.visibility = if (heightDiff > dpToPx(this, 200f)) View.INVISIBLE else View.VISIBLE
|
||||
}
|
||||
}
|
||||
|
||||
fun dpToPx(context: Context, valueInDp: Float) = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, valueInDp, context.resources.displayMetrics)
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
invalidateOptionsMenu()
|
||||
|
Loading…
x
Reference in New Issue
Block a user