From fb07dbbe5131af6fa27bdb3b41ae35c61a9f9ac5 Mon Sep 17 00:00:00 2001 From: Daniel Kao Date: Wed, 2 Nov 2022 20:58:52 +0800 Subject: [PATCH] fix: fix crash issue in BrowserActivity::onCreate when saveInstance has values --- .../info/plateaukao/einkbro/activity/BrowserActivity.kt | 8 +++++--- .../view/dialog/compose/BookmarksDialogFragment.kt | 1 - .../einkbro/view/dialog/compose/ComposeDialogFragment.kt | 1 - 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/info/plateaukao/einkbro/activity/BrowserActivity.kt b/app/src/main/java/info/plateaukao/einkbro/activity/BrowserActivity.kt index 6f2836f5f..ad53610e8 100755 --- a/app/src/main/java/info/plateaukao/einkbro/activity/BrowserActivity.kt +++ b/app/src/main/java/info/plateaukao/einkbro/activity/BrowserActivity.kt @@ -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 @@ -132,6 +132,7 @@ open class BrowserActivity : FragmentActivity(), BrowserController { ) } + private fun onToolActionLongClick(toolbarAction: ToolbarAction) { when (toolbarAction) { ToolbarAction.Back -> openHistoryPage(5) @@ -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 { @@ -338,7 +341,6 @@ open class BrowserActivity : FragmentActivity(), BrowserController { listenKeyboardShowHide() orientation = resources.configuration.orientation - } private fun initInputBar() { diff --git a/app/src/main/java/info/plateaukao/einkbro/view/dialog/compose/BookmarksDialogFragment.kt b/app/src/main/java/info/plateaukao/einkbro/view/dialog/compose/BookmarksDialogFragment.kt index 2d5313037..6ff5e81bd 100644 --- a/app/src/main/java/info/plateaukao/einkbro/view/dialog/compose/BookmarksDialogFragment.kt +++ b/app/src/main/java/info/plateaukao/einkbro/view/dialog/compose/BookmarksDialogFragment.kt @@ -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 diff --git a/app/src/main/java/info/plateaukao/einkbro/view/dialog/compose/ComposeDialogFragment.kt b/app/src/main/java/info/plateaukao/einkbro/view/dialog/compose/ComposeDialogFragment.kt index 07e1ffbee..aac9103d8 100644 --- a/app/src/main/java/info/plateaukao/einkbro/view/dialog/compose/ComposeDialogFragment.kt +++ b/app/src/main/java/info/plateaukao/einkbro/view/dialog/compose/ComposeDialogFragment.kt @@ -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)