Commit ad694826 authored by wanglei's avatar wanglei

...

parent 79c9e404
...@@ -262,6 +262,7 @@ class DocumentFragment( ...@@ -262,6 +262,7 @@ class DocumentFragment(
uiMode = UI_MODE_SEARCH uiMode = UI_MODE_SEARCH
(requireActivity() as MainActivity).callback.isEnabled = true (requireActivity() as MainActivity).callback.isEnabled = true
binding.card.elevation = 0f
binding.tvTittle.visibility = View.INVISIBLE binding.tvTittle.visibility = View.INVISIBLE
binding.ivPaixu.visibility = View.INVISIBLE binding.ivPaixu.visibility = View.INVISIBLE
binding.ivXuanze.visibility = View.INVISIBLE binding.ivXuanze.visibility = View.INVISIBLE
...@@ -281,6 +282,7 @@ class DocumentFragment( ...@@ -281,6 +282,7 @@ class DocumentFragment(
uiMode = UI_MODE_NORMAL uiMode = UI_MODE_NORMAL
(requireActivity() as MainActivity).callback.isEnabled = false (requireActivity() as MainActivity).callback.isEnabled = false
binding.card.elevation = resources.getDimension(R.dimen.dp_5)
binding.editSearch.visibility = View.INVISIBLE binding.editSearch.visibility = View.INVISIBLE
binding.flFanhui.visibility = View.INVISIBLE binding.flFanhui.visibility = View.INVISIBLE
binding.flSearch.visibility = View.INVISIBLE binding.flSearch.visibility = View.INVISIBLE
......
...@@ -61,10 +61,15 @@ class DocumentPageFragment() : BaseFragment<FragmentDocumentPageBinding>(), Docu ...@@ -61,10 +61,15 @@ class DocumentPageFragment() : BaseFragment<FragmentDocumentPageBinding>(), Docu
super.setListener() super.setListener()
binding.swipeRefreshLayout.setOnRefreshListener { binding.swipeRefreshLayout.setOnRefreshListener {
binding.swipeRefreshLayout.isRefreshing = true binding.swipeRefreshLayout.isRefreshing = true
refreshData() binding.llEmpty.visibility = View.INVISIBLE
binding.progressBar.visibility = View.VISIBLE
binding.progressBar.isIndeterminate = true
refreshData(false)
lifecycleScope.launch(Dispatchers.Main) { lifecycleScope.launch(Dispatchers.Main) {
delay(1500) delay(900)
binding.swipeRefreshLayout.isRefreshing = false binding.swipeRefreshLayout.isRefreshing = false
binding.progressBar.visibility = View.GONE
binding.llEmpty.isVisible = isEmpty
} }
} }
} }
...@@ -75,7 +80,10 @@ class DocumentPageFragment() : BaseFragment<FragmentDocumentPageBinding>(), Docu ...@@ -75,7 +80,10 @@ class DocumentPageFragment() : BaseFragment<FragmentDocumentPageBinding>(), Docu
refreshData() refreshData()
} }
fun refreshData() = lifecycleScope.launch(Dispatchers.IO) {
var isEmpty: Boolean = false
fun refreshData(showEmpty: Boolean = true) = lifecycleScope.launch(Dispatchers.IO) {
isEmpty = false
if (isInitialized && !isHidden && !MainPresenter.mainRefreshData) { if (isInitialized && !isHidden && !MainPresenter.mainRefreshData) {
LogEx.logDebug(TAG, "type=$type refreshData dataType=$dataType") LogEx.logDebug(TAG, "type=$type refreshData dataType=$dataType")
val mainActivity = (requireActivity() as MainActivity?) val mainActivity = (requireActivity() as MainActivity?)
...@@ -95,14 +103,16 @@ class DocumentPageFragment() : BaseFragment<FragmentDocumentPageBinding>(), Docu ...@@ -95,14 +103,16 @@ class DocumentPageFragment() : BaseFragment<FragmentDocumentPageBinding>(), Docu
} }
launch(Dispatchers.Main) { launch(Dispatchers.Main) {
if (showEmpty) {
binding.llEmpty.isVisible = arrayList.isEmpty() binding.llEmpty.isVisible = arrayList.isEmpty()
}
val flag = AdmobHelper.isShowRvNativeAd() val flag = AdmobHelper.isShowRvNativeAd()
LogEx.logDebug(TAG, "isShowRvNativeAd flag=$flag") LogEx.logDebug(TAG, "isShowRvNativeAd flag=$flag")
if (arrayList.isEmpty()) { if (arrayList.isEmpty()) {
isEmpty = true
binding.flAd.visibility = View.VISIBLE binding.flAd.visibility = View.VISIBLE
if (flag) { if (flag) {
AdmobNativeUtils.showNativeAd(requireActivity(), binding.flAd, R.layout.layout_admob_document) AdmobNativeUtils.showNativeAd(requireActivity(), binding.flAd, R.layout.layout_admob_document)
} }
......
...@@ -5,6 +5,17 @@ ...@@ -5,6 +5,17 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<androidx.cardview.widget.CardView
android:id="@+id/card"
app:cardElevation="5dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/cl_top" android:id="@+id/cl_top"
android:layout_width="match_parent" android:layout_width="match_parent"
...@@ -113,7 +124,7 @@ ...@@ -113,7 +124,7 @@
<LinearLayout <LinearLayout
android:id="@+id/ll_main_content" android:id="@+id/ll_main_content"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="0dp" android:layout_height="wrap_content"
android:orientation="vertical" android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@id/cl_top"> app:layout_constraintTop_toBottomOf="@id/cl_top">
...@@ -123,7 +134,8 @@ ...@@ -123,7 +134,8 @@
android:id="@+id/cl_tabLayout" android:id="@+id/cl_tabLayout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="50dp" android:layout_height="50dp"
android:background="#00000000"> android:background="#00000000"
tools:ignore="UselessParent">
<com.angcyo.tablayout.DslTabLayout <com.angcyo.tablayout.DslTabLayout
android:id="@+id/tabLayout_document" android:id="@+id/tabLayout_document"
...@@ -198,13 +210,21 @@ ...@@ -198,13 +210,21 @@
</FrameLayout> </FrameLayout>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>
<androidx.viewpager2.widget.ViewPager2 <androidx.viewpager2.widget.ViewPager2
android:id="@+id/viewPager2" android:id="@+id/viewPager2"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="0dp" android:layout_height="0dp"
android:layout_weight="1" /> android:layout_marginTop="5dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@id/card" />
</LinearLayout>
<FrameLayout <FrameLayout
android:id="@+id/fl_search" android:id="@+id/fl_search"
...@@ -213,7 +233,7 @@ ...@@ -213,7 +233,7 @@
android:background="@color/white" android:background="@color/white"
android:visibility="gone" android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@id/cl_top"> app:layout_constraintTop_toBottomOf="@id/card">
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_search" android:id="@+id/rv_search"
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@color/white"
tools:context=".ui.main.DocumentPageFragment"> tools:context=".ui.main.DocumentPageFragment">
<LinearLayout <LinearLayout
...@@ -11,6 +12,18 @@ ...@@ -11,6 +12,18 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical"> android:orientation="vertical">
<ProgressBar
android:indeterminateDuration="1600"
android:id="@+id/progressBar"
style="@style/Widget.AppCompat.ProgressBar.Horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:indeterminate="true"
android:indeterminateBehavior="cycle"
android:indeterminateTint="#00B8DE"
android:indeterminateTintMode="src_atop"
android:visibility="gone" />
<FrameLayout <FrameLayout
android:id="@+id/fl_ad" android:id="@+id/fl_ad"
android:layout_width="match_parent" android:layout_width="match_parent"
......
...@@ -5,4 +5,5 @@ ...@@ -5,4 +5,5 @@
<dimen name="dp_200">200dp</dimen> <dimen name="dp_200">200dp</dimen>
<dimen name="dp_146">146dp</dimen> <dimen name="dp_146">146dp</dimen>
<dimen name="dp_345">345dp</dimen> <dimen name="dp_345">345dp</dimen>
<dimen name="dp_5">5dp</dimen>
</resources> </resources>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment