kopia lustrzana https://github.com/ryukoposting/Signal-Android
37 wiersze
1.0 KiB
Kotlin
37 wiersze
1.0 KiB
Kotlin
package org.thoughtcrime.securesms.components
|
|
|
|
import android.os.Bundle
|
|
import androidx.fragment.app.Fragment
|
|
import org.thoughtcrime.securesms.PassphraseRequiredActivity
|
|
import org.thoughtcrime.securesms.R
|
|
import org.thoughtcrime.securesms.util.DynamicNoActionBarTheme
|
|
import org.thoughtcrime.securesms.util.DynamicTheme
|
|
|
|
/**
|
|
* Activity that wraps a given fragment
|
|
*/
|
|
abstract class FragmentWrapperActivity : PassphraseRequiredActivity() {
|
|
|
|
protected open val dynamicTheme: DynamicTheme = DynamicNoActionBarTheme()
|
|
protected open val contentViewId: Int = R.layout.fragment_container
|
|
|
|
override fun onCreate(savedInstanceState: Bundle?, ready: Boolean) {
|
|
super.onCreate(savedInstanceState, ready)
|
|
setContentView(contentViewId)
|
|
dynamicTheme.onCreate(this)
|
|
|
|
if (savedInstanceState == null) {
|
|
supportFragmentManager.beginTransaction()
|
|
.replace(R.id.fragment_container, getFragment())
|
|
.commit()
|
|
}
|
|
}
|
|
|
|
abstract fun getFragment(): Fragment
|
|
|
|
override fun onResume() {
|
|
super.onResume()
|
|
dynamicTheme.onResume(this)
|
|
}
|
|
}
|