Skip to content

Commit

Permalink
fix: fix crash issue in BrowserActivity::onCreate when saveInstance h…
Browse files Browse the repository at this point in the history
…as values
  • Loading branch information
plateaukao committed Nov 2, 2022
1 parent b2e0c62 commit fb07dbb
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,10 @@ open class BrowserActivity : FragmentActivity(), BrowserController {
private var fullscreenHolder: FrameLayout? = null

// Others
private var title: String? = null
private var downloadReceiver: BroadcastReceiver? = null
private val sp: SharedPreferences by inject()
private val config: ConfigManager by inject()

private fun prepareRecord(): Boolean {
val webView = currentAlbumController as NinjaWebView
val title = webView.title
Expand Down Expand Up @@ -132,6 +132,7 @@ open class BrowserActivity : FragmentActivity(), BrowserController {
)
}


private fun onToolActionLongClick(toolbarAction: ToolbarAction) {
when (toolbarAction) {
ToolbarAction.Back -> openHistoryPage(5)
Expand Down Expand Up @@ -280,7 +281,9 @@ open class BrowserActivity : FragmentActivity(), BrowserController {

// Overrides
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
// workaround for crash issue
// Caused by java.lang.NoSuchMethodException:
super.onCreate(null)
binding = ActivityMainBinding.inflate(layoutInflater)

lifecycleScope.launch {
Expand Down Expand Up @@ -338,7 +341,6 @@ open class BrowserActivity : FragmentActivity(), BrowserController {
listenKeyboardShowHide()

orientation = resources.configuration.orientation

}

private fun initInputBar() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package info.plateaukao.einkbro.view.dialog.compose
import android.graphics.Bitmap
import android.view.LayoutInflater
import android.view.View
import android.view.animation.Animation
import androidx.compose.foundation.*
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.interaction.collectIsPressedAsState
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ abstract class ComposeDialogFragment: AppCompatDialogFragment(), KoinComponent {
protected val config: ConfigManager by inject()
protected lateinit var composeView: ComposeView


override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
setStyle(STYLE_NO_FRAME, 0)
return super.onCreateDialog(savedInstanceState)
Expand Down

1 comment on commit fb07dbb

@plateaukao
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Finally found why it always crashes in BrowserActivity::onCreate()
ncapdevi/FragNav#238 (comment)

Please sign in to comment.