diff --git a/app/src/main/java/com/puutaro/commandclick/activity_lib/ExecMainActivityLaunchIntent.kt b/app/src/main/java/com/puutaro/commandclick/activity_lib/ExecMainActivityLaunchIntent.kt new file mode 100644 index 000000000..fc95801a5 --- /dev/null +++ b/app/src/main/java/com/puutaro/commandclick/activity_lib/ExecMainActivityLaunchIntent.kt @@ -0,0 +1,30 @@ +package com.puutaro.commandclick.activity_lib + +import android.content.Intent +import com.puutaro.commandclick.activity.MainActivity +import com.puutaro.commandclick.common.variable.settings.FannelInfoSetting +import com.puutaro.commandclick.util.state.FannelInfoTool + +object ExecMainActivityLaunchIntent { + fun launch( + activity: MainActivity, + ){ + val execIntent = Intent(activity, activity::class.java) + execIntent.action = Intent.ACTION_MAIN + execIntent.flags = Intent.FLAG_ACTIVITY_CLEAR_TOP + val startUpPref = FannelInfoTool.getSharePref(activity) + val currentAppDirPath = FannelInfoTool.getStringFromFannelInfo( + startUpPref, + FannelInfoSetting.current_app_dir + ) + FannelInfoTool.putAllFannelInfo( + startUpPref, + currentAppDirPath = currentAppDirPath, + currentFannelName = FannelInfoSetting.current_fannel_name.defalutStr, + onShortcutValue = FannelInfoSetting.on_shortcut.defalutStr, + currentFannelState = FannelInfoSetting.current_fannel_state.defalutStr + ) + activity.finish() + activity.startActivity(execIntent) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/puutaro/commandclick/activity_lib/event/lib/common/ExecKeyDownHandle.kt b/app/src/main/java/com/puutaro/commandclick/activity_lib/event/lib/common/ExecKeyDownHandle.kt index 70f5fe81e..95ce5d4c2 100755 --- a/app/src/main/java/com/puutaro/commandclick/activity_lib/event/lib/common/ExecKeyDownHandle.kt +++ b/app/src/main/java/com/puutaro/commandclick/activity_lib/event/lib/common/ExecKeyDownHandle.kt @@ -10,6 +10,7 @@ import androidx.fragment.app.FragmentManager import com.blankj.utilcode.util.ToastUtils import com.blankj.utilcode.util.VolumeUtils import com.puutaro.commandclick.activity.MainActivity +import com.puutaro.commandclick.activity_lib.ExecMainActivityLaunchIntent import com.puutaro.commandclick.common.variable.path.UsePath import com.puutaro.commandclick.common.variable.settings.FannelInfoSetting import com.puutaro.commandclick.util.url.WebUrlVariables @@ -123,10 +124,17 @@ private object BackstackManager { ToastUtils.showShort("End by double tap") return } - execPopBackStackImmediate( - activity, - supportFragmentManager, - ) + if( + currentBottomFragment is CommandIndexFragment + ) { + execPopBackStackImmediate( + activity, + supportFragmentManager, + ) + return + } + ExecMainActivityLaunchIntent.launch(activity) + } else -> execBack( activity, diff --git a/app/src/main/java/com/puutaro/commandclick/activity_lib/manager/InitFragmentManager.kt b/app/src/main/java/com/puutaro/commandclick/activity_lib/manager/InitFragmentManager.kt index b9f70a75d..bfcb91c57 100755 --- a/app/src/main/java/com/puutaro/commandclick/activity_lib/manager/InitFragmentManager.kt +++ b/app/src/main/java/com/puutaro/commandclick/activity_lib/manager/InitFragmentManager.kt @@ -401,7 +401,6 @@ private fun execMainActivityUrlIntent( currentFannelName = FannelInfoSetting.current_fannel_name.defalutStr, onShortcutValue = FannelInfoSetting.on_shortcut.defalutStr, currentFannelState = FannelInfoSetting.current_fannel_state.defalutStr - ) execRestartIntent( activity,