Skip to content

Commit cfba2c2

Browse files
committed
Update
1 parent a7acd6d commit cfba2c2

2 files changed

Lines changed: 20 additions & 21 deletions

File tree

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

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,33 +32,34 @@ class ActivityFileSelector : AppCompatActivity() {
3232
private lateinit var binding : ActivityFileSelectorBinding
3333
private var toolbar: Toolbar? = null
3434
override fun onCreate(savedInstanceState: Bundle?) {
35-
// TODO:ThemeSwitch.switchTheme(this)
3635
super.onCreate(savedInstanceState)
3736
ThemeModeState.switchTheme(this)
3837
binding = ActivityFileSelectorBinding.inflate(layoutInflater)
3938
setContentView(binding.root)
4039

41-
binding.fileActivi.isDrawStrokeEnabled = false
42-
BlurEngine.controller.captureAndBlur(this)
43-
40+
binding.fileDrawerContainer.isDrawStrokeEnabled = false
41+
42+
// Chờ màn hình vẽ xong mới chụp nền để blur
43+
binding.root.post {
44+
BlurEngine.controller.captureAndBlur(this)
45+
}
46+
4447
val toolbar = findViewById<View>(R.id.toolbar) as Toolbar
4548
this.toolbar = toolbar
4649
setSupportActionBar(toolbar)
47-
// setTitle(R.string.app_name)
48-
49-
// 显示返回按钮
50+
5051
supportActionBar!!.setHomeButtonEnabled(true)
5152
supportActionBar!!.setDisplayHomeAsUpEnabled(true)
5253
toolbar.setNavigationOnClickListener {
5354
finish()
5455
}
55-
56+
5657
onBackPressedDispatcher.addCallback(this) {
5758
if (adapterFileSelector?.goParent() == true) return@addCallback
5859
setResult(RESULT_CANCELED, Intent())
5960
finish()
6061
}
61-
62+
6263
intent.extras?.run {
6364
if (containsKey("extension")) {
6465
extension = "" + intent.extras?.getString("extension")
@@ -82,7 +83,7 @@ class ActivityFileSelector : AppCompatActivity() {
8283
pathHome = "" + intent.extras?.getString("path_home")
8384
}
8485
}
85-
86+
8687
invalidateOptionsMenu()
8788
}
8889

app/src/main/res/layout/activity_file_selector.xml

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,35 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<androidx.drawerlayout.widget.DrawerLayout
33
xmlns:android="http://schemas.android.com/apk/res/android"
4+
xmlns:app="http://schemas.android.com/apk/res-auto"
45
xmlns:tools="http://schemas.android.com/tools"
6+
android:id="@+id/drawer_layout"
57
android:layout_width="match_parent"
68
android:layout_height="match_parent"
7-
android:clipToPadding="true"
89
android:fitsSystemWindows="false"
910
tools:openDrawer="start">
1011

11-
<!-- 1. Nội dung chính của màn hình (luôn nằm ở trên cùng trong XML) -->
12+
<!-- 1. Nội dung chính của màn hình -->
1213
<include
1314
layout="@layout/app_bar_main"
1415
android:layout_width="match_parent"
1516
android:layout_height="match_parent" />
1617

17-
<!-- 2. Menu Drawer mờ (Nằm bên dưới, có layout_gravity="start") -->
18+
<!-- 2. Menu Drawer mờ (Khuyên dùng chiều rộng cố định khoảng 300dp - 320dp) -->
1819
<com.omarea.common.ui.BlurViewLinearLayout
19-
android:layout_width="match_parent"
20+
android:id="@+id/file_drawer_container"
21+
android:layout_width="300dp"
2022
android:layout_height="match_parent"
2123
android:layout_gravity="start"
22-
android:id="@+id/file_activi"
2324
android:orientation="vertical">
2425

25-
<ListView
26+
<!-- Nên thay ListView bằng RecyclerView -->
27+
<androidx.recyclerview.widget.RecyclerView
2628
android:id="@+id/file_selector_list"
2729
android:layout_width="match_parent"
2830
android:layout_height="match_parent"
2931
android:layout_marginTop="?attr/actionBarSize"
30-
android:fastScrollEnabled="true"
31-
android:fadingEdge="vertical"
32-
android:requiresFadingEdge="vertical"
33-
android:scrollbarStyle="insideOverlay"
34-
android:smoothScrollbar="true" />
32+
android:scrollbars="vertical" />
3533

3634
</com.omarea.common.ui.BlurViewLinearLayout>
3735

0 commit comments

Comments
 (0)