Skip to content

Commit 169291c

Browse files
committed
Update
1 parent 81b94d4 commit 169291c

1 file changed

Lines changed: 4 additions & 23 deletions

File tree

app/src/main/java/com/tool/tree/MainActivity.kt

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,8 @@ class MainActivity : AppCompatActivity() {
7878
// ========================
7979
private fun loadTabs() {
8080
Thread {
81-
val page2Config = krScriptConfig.pageListConfig
82-
val favoritesConfig = krScriptConfig.favoriteConfig
83-
84-
val pages = getItems(page2Config)
85-
val favorites = getItems(favoritesConfig)
81+
val pages = getItems(krScriptConfig.pageListConfig)
82+
val favorites = getItems(krScriptConfig.favoriteConfig)
8683

8784
handler.post {
8885
progressBarDialog.hideDialog()
@@ -93,7 +90,7 @@ class MainActivity : AppCompatActivity() {
9390
adapter.addFragment(
9491
ActionListFragment.create(
9592
favorites,
96-
getKrScriptActionHandler(favoritesConfig, true),
93+
getKrScriptActionHandler(krScriptConfig.favoriteConfig, true),
9794
null,
9895
ThemeModeState.getThemeMode()
9996
),
@@ -105,7 +102,7 @@ class MainActivity : AppCompatActivity() {
105102
adapter.addFragment(
106103
ActionListFragment.create(
107104
pages,
108-
getKrScriptActionHandler(page2Config, false),
105+
getKrScriptActionHandler(krScriptConfig.pageListConfig, false),
109106
null,
110107
ThemeModeState.getThemeMode()
111108
),
@@ -193,22 +190,6 @@ class MainActivity : AppCompatActivity() {
193190
finish()
194191
}
195192

196-
// Thêm vào MainActivity
197-
// ========================
198-
// RECREATE WITHOUT DATA LOSS
199-
// ========================
200-
201-
fun refreshUIWithRecreate() {
202-
val currentTabIndex = binding.tabLayout.selectedTabPosition
203-
recreate()
204-
handler.post {
205-
reloadTabs()
206-
binding.viewPager.post {
207-
binding.viewPager.setCurrentItem(currentTabIndex, false)
208-
}
209-
}
210-
}
211-
212193
private fun getKrScriptActionHandler(pageNode: PageNode, isFavoritesTab: Boolean): KrScriptActionHandler {
213194
return object : KrScriptActionHandler {
214195
override fun onActionCompleted(runnableNode: RunnableNode) {

0 commit comments

Comments
 (0)