Skip to content

Commit

Permalink
fannel backstack change
Browse files Browse the repository at this point in the history
  • Loading branch information
puutaro committed Aug 19, 2024
1 parent 9f03275 commit e0c7f26
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -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)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit e0c7f26

Please sign in to comment.