Skip to content

Commit c3cd9a5

Browse files
committed
Update
1 parent f2f3515 commit c3cd9a5

2 files changed

Lines changed: 3 additions & 28 deletions

File tree

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

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,6 @@ class MainActivity : AppCompatActivity() {
132132
val tab4Items = getItems(krScriptConfig.customTab4Config)
133133

134134
withContext(Dispatchers.Main) {
135-
if (!isActive || isFinishing) return@withContext
136-
137135
if (!favorites.isNullOrEmpty()) (adapter.getFragment(0) as? ActionListFragment)?.updateData(favorites, getKrScriptActionHandler(krScriptConfig.favoriteConfig, true), ThemeModeState.getThemeMode())
138136
if (!pages.isNullOrEmpty()) (adapter.getFragment(1) as? ActionListFragment)?.updateData(pages, getKrScriptActionHandler(krScriptConfig.pageListConfig, false), ThemeModeState.getThemeMode())
139137
if (!tab3Items.isNullOrEmpty()) (adapter.getFragment(2) as? ActionListFragment)?.updateData(tab3Items, getKrScriptActionHandler(krScriptConfig.customTab3Config, false), ThemeModeState.getThemeMode())
@@ -171,20 +169,12 @@ class MainActivity : AppCompatActivity() {
171169
* Lấy danh sách item từ cấu hình trang.
172170
* Đã thêm kiểm tra null-safety để tránh NullPointerException.
173171
*/
174-
private fun getItems(pageNode: PageNode?): ArrayList<NodeInfoBase>? {
175-
if (pageNode == null) return null
176-
172+
private fun getItems(pageNode: PageNode): ArrayList<NodeInfoBase>? {
177173
var items: ArrayList<NodeInfoBase>? = null
178-
179-
// Sử dụng ?. để truy cập thuộc tính an toàn
180-
if (pageNode.pageConfigSh?.isNotEmpty() == true) {
174+
if (pageNode.pageConfigSh.isNotEmpty())
181175
items = PageConfigSh(this, pageNode.pageConfigSh, null).execute()
182-
}
183-
184-
if (items == null && pageNode.pageConfigPath?.isNotEmpty() == true) {
176+
if (items == null && pageNode.pageConfigPath.isNotEmpty())
185177
items = PageConfigReader(this.applicationContext, pageNode.pageConfigPath, null).readConfigXml()
186-
}
187-
188178
return items
189179
}
190180

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

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -203,21 +203,6 @@ class SplashActivity : AppCompatActivity() {
203203
}
204204
}
205205

206-
private fun applyTheme() {
207-
val typedValue = TypedValue()
208-
theme.resolveAttribute(android.R.attr.windowBackground, typedValue, true)
209-
val bgColor = if (typedValue.resourceId != 0) getColor(typedValue.resourceId) else typedValue.data
210-
211-
WindowCompat.setDecorFitsSystemWindows(window, false)
212-
window.statusBarColor = bgColor
213-
window.navigationBarColor = bgColor
214-
215-
val controller = WindowCompat.getInsetsController(window, window.decorView)
216-
val isDark = ThemeModeState.isDarkMode()
217-
controller.isAppearanceLightStatusBars = !isDark
218-
controller.isAppearanceLightNavigationBars = !isDark
219-
}
220-
221206
private fun gotoHome() {
222207
val intentToStart = if (intent?.getBooleanExtra("JumpActionPage", false) == true) {
223208
Intent(this, ActionPage::class.java).apply { putExtras(intent!!) }

0 commit comments

Comments
 (0)