67 lines
2.2 KiB
Kotlin
67 lines
2.2 KiB
Kotlin
package com.github.mondei1.offpass
|
|
|
|
import android.os.Bundle
|
|
import android.view.LayoutInflater
|
|
import android.view.View
|
|
import android.view.ViewGroup
|
|
import androidx.fragment.app.Fragment
|
|
import kotlinx.android.synthetic.main.fragment_text_input.*
|
|
|
|
// TODO: Rename parameter arguments, choose names that match
|
|
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
|
|
private const val ARG_HEAD = "param1"
|
|
private const val ARG_TITLE = "param2"
|
|
private const val ARG_TITLE_SIZE = "param3"
|
|
|
|
/**
|
|
* A simple [Fragment] subclass.
|
|
* Use the [TextInput.newInstance] factory method to
|
|
* create an instance of this fragment.
|
|
*/
|
|
class TextInput : Fragment() {
|
|
// TODO: Rename and change types of parameters
|
|
private var arg_head: String? = null
|
|
private var arg_title: String? = null
|
|
private var arg_title_size: String? = null
|
|
|
|
override fun onCreate(savedInstanceState: Bundle?) {
|
|
super.onCreate(savedInstanceState)
|
|
arguments?.let {
|
|
arg_title = it.getString(ARG_TITLE)
|
|
arg_head = it.getString(ARG_HEAD)
|
|
arg_title_size = it.getString(ARG_TITLE_SIZE)
|
|
}
|
|
}
|
|
|
|
override fun onCreateView(
|
|
inflater: LayoutInflater, container: ViewGroup?,
|
|
savedInstanceState: Bundle?
|
|
): View? {
|
|
// Inflate the layout for this fragment
|
|
return inflater.inflate(R.layout.fragment_text_input, container, false)
|
|
}
|
|
|
|
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
|
super.onActivityCreated(savedInstanceState)
|
|
head.text = arg_head
|
|
title.background = null
|
|
title.hint = arg_title
|
|
}
|
|
|
|
companion object {
|
|
/**
|
|
* Use this factory method to create a new instance of
|
|
* this fragment using the provided parameters.
|
|
*/
|
|
// TODO: Rename and change types and number of parameters
|
|
@JvmStatic
|
|
fun newInstance(head: String, title: String, title_size: String) =
|
|
TextInput().apply {
|
|
arguments = Bundle().apply {
|
|
putString(ARG_HEAD, head)
|
|
putString(ARG_TITLE, title)
|
|
putString(ARG_TITLE_SIZE, title_size)
|
|
}
|
|
}
|
|
}
|
|
} |