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) {
binding.llEmpty.isVisible = arrayList.isEmpty() if (showEmpty) {
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)
} }
......
...@@ -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