Commit ad694826 authored by wanglei's avatar wanglei

...

parent 79c9e404
......@@ -262,6 +262,7 @@ class DocumentFragment(
uiMode = UI_MODE_SEARCH
(requireActivity() as MainActivity).callback.isEnabled = true
binding.card.elevation = 0f
binding.tvTittle.visibility = View.INVISIBLE
binding.ivPaixu.visibility = View.INVISIBLE
binding.ivXuanze.visibility = View.INVISIBLE
......@@ -281,6 +282,7 @@ class DocumentFragment(
uiMode = UI_MODE_NORMAL
(requireActivity() as MainActivity).callback.isEnabled = false
binding.card.elevation = resources.getDimension(R.dimen.dp_5)
binding.editSearch.visibility = View.INVISIBLE
binding.flFanhui.visibility = View.INVISIBLE
binding.flSearch.visibility = View.INVISIBLE
......
......@@ -61,10 +61,15 @@ class DocumentPageFragment() : BaseFragment<FragmentDocumentPageBinding>(), Docu
super.setListener()
binding.swipeRefreshLayout.setOnRefreshListener {
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) {
delay(1500)
delay(900)
binding.swipeRefreshLayout.isRefreshing = false
binding.progressBar.visibility = View.GONE
binding.llEmpty.isVisible = isEmpty
}
}
}
......@@ -75,7 +80,10 @@ class DocumentPageFragment() : BaseFragment<FragmentDocumentPageBinding>(), Docu
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) {
LogEx.logDebug(TAG, "type=$type refreshData dataType=$dataType")
val mainActivity = (requireActivity() as MainActivity?)
......@@ -95,14 +103,16 @@ class DocumentPageFragment() : BaseFragment<FragmentDocumentPageBinding>(), Docu
}
launch(Dispatchers.Main) {
if (showEmpty) {
binding.llEmpty.isVisible = arrayList.isEmpty()
}
val flag = AdmobHelper.isShowRvNativeAd()
LogEx.logDebug(TAG, "isShowRvNativeAd flag=$flag")
if (arrayList.isEmpty()) {
isEmpty = true
binding.flAd.visibility = View.VISIBLE
if (flag) {
AdmobNativeUtils.showNativeAd(requireActivity(), binding.flAd, R.layout.layout_admob_document)
}
......
......@@ -5,6 +5,17 @@
android:layout_width="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
android:id="@+id/cl_top"
android:layout_width="match_parent"
......@@ -113,7 +124,7 @@
<LinearLayout
android:id="@+id/ll_main_content"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@id/cl_top">
......@@ -123,7 +134,8 @@
android:id="@+id/cl_tabLayout"
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="#00000000">
android:background="#00000000"
tools:ignore="UselessParent">
<com.angcyo.tablayout.DslTabLayout
android:id="@+id/tabLayout_document"
......@@ -198,13 +210,21 @@
</FrameLayout>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>
<androidx.viewpager2.widget.ViewPager2
android:id="@+id/viewPager2"
android:layout_width="match_parent"
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
android:id="@+id/fl_search"
......@@ -213,7 +233,7 @@
android:background="@color/white"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@id/cl_top">
app:layout_constraintTop_toBottomOf="@id/card">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_search"
......
......@@ -4,6 +4,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
tools:context=".ui.main.DocumentPageFragment">
<LinearLayout
......@@ -11,6 +12,18 @@
android:layout_height="wrap_content"
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
android:id="@+id/fl_ad"
android:layout_width="match_parent"
......
......@@ -5,4 +5,5 @@
<dimen name="dp_200">200dp</dimen>
<dimen name="dp_146">146dp</dimen>
<dimen name="dp_345">345dp</dimen>
<dimen name="dp_5">5dp</dimen>
</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