Ver código fonte

fixing package name

Dola TENG 2 anos atrás
pai
commit
1cc55a2941

+ 1 - 1
app/src/main/java/com/khmer9/sbcmain/screen/main/MainFragment.kt

@@ -187,7 +187,7 @@ class MainFragment : BaseFragment(R.layout.layout_fragment_main_yuki) {
                                         putString("module_id", id)
                                     }
                                 })
-                                .addToBackStack(null)
+                                .addToBackStack("MainFragment")
                                 .commit()
                         }
                     } else {

+ 10 - 0
app/src/main/java/com/khmer9/sbcmain/screen/main/SubModuleFragment.kt

@@ -13,7 +13,9 @@ import com.khmer9.sbcmain.app.App
 import com.khmer9.sbcmain.app.DownloadController
 import com.khmer9.sbcmain.app.ShareActivity
 import com.khmer9.sbcmain.base.BaseFragment
+import com.khmer9.sbcmain.extension.btnClick
 import com.khmer9.sbcmain.remote.User
+import kotlinx.android.synthetic.main.layout_sub_module.*
 
 class SubModuleFragment : BaseFragment(R.layout.layout_sub_module) {
     private val shareViewModel = App.injectShareViewModel()
@@ -44,6 +46,14 @@ class SubModuleFragment : BaseFragment(R.layout.layout_sub_module) {
         (requireActivity() as ShareActivity).apply {
             recyclerView = view.findViewById(R.id.rv_main)
 
+            close_btn.setOnClickListener {
+                it.btnClick().subscribe() {
+                    (requireActivity() as? ShareActivity)?.apply {
+                        onBackPressed()
+                    }
+                }
+            }
+
             val moduleId = requireArguments().getString(ARG_PARAM1)
             if (!moduleId.isNullOrEmpty()) {
                 shareViewModel.remoteSubModule(moduleId)

+ 18 - 2
app/src/main/res/layout/layout_sub_module.xml

@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
-<androidx.appcompat.widget.LinearLayoutCompat xmlns:android="http://schemas.android.com/apk/res/android"
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:tools="http://schemas.android.com/tools"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
@@ -13,4 +13,20 @@
         android:layout_width="match_parent"
         android:layout_height="match_parent" />
 
-</androidx.appcompat.widget.LinearLayoutCompat>
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_alignParentBottom="true"
+        android:gravity="center">
+
+        <com.google.android.material.button.MaterialButton
+            android:id="@+id/close_btn"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_margin="5dp"
+            android:padding="5dp"
+            android:text="@string/close"
+            android:textSize="16sp" />
+    </LinearLayout>
+
+</RelativeLayout>