mirror of
https://github.com/SimpleMobileTools/Simple-Notes.git
synced 2025-04-16 16:27:23 +02:00
fix #30, hide the fab when keyboard is shown
This commit is contained in:
parent
53be83418b
commit
e50c4f600f
@ -38,8 +38,15 @@ class MainActivity : SimpleActivity(), OpenNoteDialog.OpenNoteListener {
|
|||||||
mDb = DBHelper.newInstance(applicationContext)
|
mDb = DBHelper.newInstance(applicationContext)
|
||||||
mNotes = mDb.getNotes()
|
mNotes = mDb.getNotes()
|
||||||
updateSelectedNote(config.currentNoteId)
|
updateSelectedNote(config.currentNoteId)
|
||||||
|
|
||||||
notes_fab.setOnClickListener { displayNewNoteDialog() }
|
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() {
|
override fun onResume() {
|
||||||
super.onResume()
|
super.onResume()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user