Commit 8af9b83b authored by mengcuiguang2's avatar mengcuiguang2

优化切换bug

parent 2d41b642
......@@ -115,9 +115,7 @@ android {
vivo {}
baidu {}
oppo {}
huawei {}
xiaomi {}
store360 {}
yingyongbao {}
}
productFlavors.all {
......
......@@ -121,14 +121,14 @@ class MovieFragment : LazyLoadBaseFragment(), PicContentView, OnLoadMoreListener
hotStyleAdapter.animationEnable = false
rv_pic_list.adapter = hotStyleAdapter
val emptyView =
LayoutInflater.from(requireContext()).inflate(R.layout.item_empty_data, null)
LayoutInflater.from(requireContext()).inflate(R.layout.item_empty_data, null)
hotStyleAdapter.setEmptyView(emptyView)
hotStyleAdapter.setOnCustomChildClickListener(object :
NewHotStyleAdapter.OnCustomChildClickListener {
NewHotStyleAdapter.OnCustomChildClickListener {
override fun onCustomChildClick(view: View, vedioBean: VedioBean) {
LocalVedioManager.startVedioDetailActivityForType(
requireActivity(),
vedioBean
requireActivity(),
vedioBean
)
}
})
......@@ -169,19 +169,22 @@ class MovieFragment : LazyLoadBaseFragment(), PicContentView, OnLoadMoreListener
var insertIndex = 3
val allData = hotStyleAdapter.data
for (i in allData.size - 1 downTo 0) {
if (allData[i].itemType == MULTI_ITEM_3) {
insertIndex += 4
if (allData != null && allData.size > 0) {
for (i in allData.size - 1 downTo 0) {
if (allData[i].itemType == MULTI_ITEM_3) {
insertIndex += 4
}
}
}
if (insertIndex >= allData.size) {
insertIndex = allData.size
}
if (insertIndex >= allData.size) {
insertIndex = allData.size
}
if (allData[allData.lastIndex].itemType == MULTI_ITEM_3) return
if (allData[allData.lastIndex].itemType == MULTI_ITEM_3) return
val data = VideoMultiItemEntity3(MULTI_ITEM_3, null, adView)
hotStyleAdapter.addData(insertIndex, data)
}
val data = VideoMultiItemEntity3(MULTI_ITEM_3, null, adView)
hotStyleAdapter.addData(insertIndex, data)
}
override fun onDestroyView() {
......
......@@ -28,8 +28,7 @@ public class UIUtils {
DisplayMetrics dm = context.getResources().getDisplayMetrics();
return dm.widthPixels;
}catch (Exception e){
DisplayMetrics dm = ForegroundOrBackground.getTopActivity().getResources().getDisplayMetrics();
return dm.widthPixels;
return 0;
}
}
......@@ -39,8 +38,7 @@ public class UIUtils {
DisplayMetrics dm = context.getResources().getDisplayMetrics();
return dm.heightPixels;
}catch (Exception e){
DisplayMetrics dm = ForegroundOrBackground.getTopActivity().getResources().getDisplayMetrics();
return dm.heightPixels;
return 0;
}
}
......@@ -60,8 +58,7 @@ public class UIUtils {
final float scale = context.getResources().getDisplayMetrics().density;
return (int) (dpValue * scale + 0.5f);
}catch (Exception e){
final float scale = ForegroundOrBackground.getTopActivity().getResources().getDisplayMetrics().density;
return (int) (dpValue * scale + 0.5f);
return 0;
}
}
......@@ -293,8 +290,7 @@ public class UIUtils {
final float scale = context.getResources().getDisplayMetrics().density;
return (int) (pxValue / (scale <= 0 ? 1 : scale) + 0.5f);
}catch (Exception e){
final float scale = ForegroundOrBackground.getTopActivity().getResources().getDisplayMetrics().density;
return (int) (pxValue / (scale <= 0 ? 1 : scale) + 0.5f);
return 0;
}
}
......@@ -304,8 +300,7 @@ public class UIUtils {
final float scale = context.getResources().getDisplayMetrics().density;
return (int) (dp * scale + 0.5f);
}catch (Exception e){
final float scale = ForegroundOrBackground.getTopActivity().getResources().getDisplayMetrics().density;
return (int) (dp * scale + 0.5f);
return 0;
}
}
......
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