mirror of
https://github.com/SimpleMobileTools/Simple-Notes.git
synced 2025-01-30 14:04:48 +01:00
show the keyboard at creating new note
This commit is contained in:
parent
91fd8c27a3
commit
e546f17552
@ -143,6 +143,7 @@ class MainActivity : SimpleActivity(), ViewPager.OnPageChangeListener {
|
||||
invalidateOptionsMenu()
|
||||
initViewPager()
|
||||
updateSelectedNote(id)
|
||||
mAdapter.showKeyboard(getNoteIndexWithId(id))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -33,4 +33,6 @@ class NotesPagerAdapter(fm: FragmentManager, private val notes: List<Note>) : Fr
|
||||
}
|
||||
|
||||
override fun getPageTitle(position: Int) = notes[position].title
|
||||
|
||||
fun showKeyboard(position: Int) = fragments[position]?.showKeyboard()
|
||||
}
|
||||
|
@ -1,11 +1,13 @@
|
||||
package com.simplemobiletools.notes.fragments
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Bundle
|
||||
import android.support.v4.app.Fragment
|
||||
import android.util.TypedValue
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.view.inputmethod.InputMethodManager
|
||||
import com.simplemobiletools.filepicker.extensions.value
|
||||
import com.simplemobiletools.notes.NOTE_ID
|
||||
import com.simplemobiletools.notes.R
|
||||
@ -16,6 +18,7 @@ import com.simplemobiletools.notes.extensions.updateWidget
|
||||
import com.simplemobiletools.notes.models.Note
|
||||
import kotlinx.android.synthetic.main.fragment_note.view.*
|
||||
|
||||
|
||||
class NoteFragment : Fragment() {
|
||||
var noteId = 0
|
||||
lateinit var view: ViewGroup
|
||||
@ -42,6 +45,12 @@ class NoteFragment : Fragment() {
|
||||
}
|
||||
}
|
||||
|
||||
fun showKeyboard() {
|
||||
view.notes_view.requestFocus()
|
||||
val imm = context.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
|
||||
imm.showSoftInput(view.notes_view, InputMethodManager.SHOW_IMPLICIT)
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
view.notes_view.setTextSize(TypedValue.COMPLEX_UNIT_PX, context.getTextSize())
|
||||
|
Loading…
x
Reference in New Issue
Block a user