mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-04-14 19:56:32 +00:00
Fix crash that occurs when changing day/night mode on API Token bottom sheet
This commit is contained in:
parent
145de783fb
commit
b568223c60
2 changed files with 18 additions and 5 deletions
|
|
@ -184,8 +184,7 @@ class AccountPreferenceFragment :
|
|||
}
|
||||
|
||||
"APIToken" -> {
|
||||
ApiTokenBottomSheetFragment(
|
||||
apiToken = hostConfig.apiKey).show(childFragmentManager, ApiTokenBottomSheetFragment.TAG)
|
||||
ApiTokenBottomSheetFragment.newInstance(hostConfig.apiKey).show(childFragmentManager, ApiTokenBottomSheetFragment.TAG)
|
||||
return true
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -11,9 +11,15 @@ import com.habitrpg.android.habitica.ui.views.ApiTokenBottomSheet
|
|||
import com.habitrpg.android.habitica.ui.views.HabiticaSnackbar
|
||||
import com.habitrpg.android.habitica.ui.views.SnackbarActivity
|
||||
|
||||
class ApiTokenBottomSheetFragment(
|
||||
private val apiToken: String
|
||||
) : BottomSheetDialogFragment() {
|
||||
class ApiTokenBottomSheetFragment : BottomSheetDialogFragment() {
|
||||
private lateinit var apiToken: String
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
apiToken = arguments?.getString(ARG_API_TOKEN) ?: ""
|
||||
}
|
||||
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater,
|
||||
container: ViewGroup?,
|
||||
|
|
@ -33,6 +39,14 @@ class ApiTokenBottomSheetFragment(
|
|||
}
|
||||
|
||||
companion object {
|
||||
private const val ARG_API_TOKEN = "arg_api_token"
|
||||
fun newInstance(apiToken: String): ApiTokenBottomSheetFragment =
|
||||
ApiTokenBottomSheetFragment().apply {
|
||||
arguments = Bundle().apply {
|
||||
putString(ARG_API_TOKEN, apiToken)
|
||||
}
|
||||
}
|
||||
|
||||
const val TAG = "ApiTokenBottomSheet"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue