diff --git a/app/src/main/java/com/gh/common/databind/BindingAdapters.java b/app/src/main/java/com/gh/common/databind/BindingAdapters.java
index 2ea44d73bc..577be7a77a 100644
--- a/app/src/main/java/com/gh/common/databind/BindingAdapters.java
+++ b/app/src/main/java/com/gh/common/databind/BindingAdapters.java
@@ -6,7 +6,6 @@ import android.support.v4.content.ContextCompat;
import android.support.v4.widget.SwipeRefreshLayout;
import android.text.TextUtils;
import android.view.LayoutInflater;
-import android.view.MotionEvent;
import android.view.View;
import android.widget.EditText;
import android.widget.LinearLayout;
@@ -38,14 +37,11 @@ import com.gh.gamecenter.databinding.KaifuDetailItemRowBinding;
import com.gh.gamecenter.entity.ApkEntity;
import com.gh.gamecenter.entity.GameEntity;
import com.gh.gamecenter.entity.KaiFuCalendarEntity;
-import com.gh.gamecenter.eventbus.EBReuse;
import com.gh.gamecenter.manager.PackageManager;
import com.lightgame.download.DownloadEntity;
import com.lightgame.download.FileUtils;
import com.lightgame.utils.Utils;
-import org.greenrobot.eventbus.EventBus;
-
import java.text.SimpleDateFormat;
import java.util.List;
import java.util.Locale;
@@ -71,22 +67,14 @@ public class BindingAdapters {
KaifuDetailItemRowBinding binding = KaifuDetailItemRowBinding.bind(inflate);
binding.setIsCloseBottom(i == list.size());
binding.setIsReadyPatch(isReadyPatch);
+ binding.getRoot().setClickable(isReadyPatch);
if (i == 0) {
binding.setIsTitle(true);
} else {
KaiFuCalendarEntity serverEntity = list.get(i - 1);
binding.setEntity(serverEntity);
binding.getRoot().setOnClickListener(v -> {
- listener.onClick(v, isReadyPatch != null && isReadyPatch ? serverEntity : null);
- });
- // 滑动冲突处理
- binding.getRoot().setOnTouchListener((v, event) -> {
- if (event.getAction() == MotionEvent.ACTION_DOWN) {
- EventBus.getDefault().post(new EBReuse("CalenderDown"));
- } else if (event.getAction() == MotionEvent.ACTION_UP || event.getAction() == MotionEvent.ACTION_CANCEL) {
- EventBus.getDefault().post(new EBReuse("CalenderCancel"));
- }
- return false;
+ listener.onClick(v, serverEntity);
});
}
view.addView(inflate);
diff --git a/app/src/main/java/com/gh/common/view/NestedRecyclerView.kt b/app/src/main/java/com/gh/common/view/NestedRecyclerView.kt
new file mode 100644
index 0000000000..bf8cdce203
--- /dev/null
+++ b/app/src/main/java/com/gh/common/view/NestedRecyclerView.kt
@@ -0,0 +1,102 @@
+package com.gh.common.view
+
+import android.content.Context
+import android.support.v4.view.NestedScrollingParent
+import android.support.v7.widget.RecyclerView
+import android.util.AttributeSet
+import android.view.MotionEvent
+import android.view.View
+
+open class NestedRecyclerView : RecyclerView, NestedScrollingParent {
+
+ private var nestedScrollTarget: View? = null
+ private var nestedScrollTargetIsBeingDragged = false
+ private var nestedScrollTargetWasUnableToScroll = false
+ private var skipsTouchInterception = false
+
+
+ constructor(context: Context) :
+ super(context)
+
+
+ constructor(context: Context, attrs: AttributeSet?) :
+ super(context, attrs)
+
+
+ constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) :
+ super(context, attrs, defStyleAttr)
+
+
+ override fun dispatchTouchEvent(ev: MotionEvent): Boolean {
+ val temporarilySkipsInterception = nestedScrollTarget != null
+ if (temporarilySkipsInterception) {
+ // If a descendent view is scrolling we set a flag to temporarily skip our onInterceptTouchEvent implementation
+ skipsTouchInterception = true
+ }
+
+ // First dispatch, potentially skipping our onInterceptTouchEvent
+ var handled = super.dispatchTouchEvent(ev)
+
+ if (temporarilySkipsInterception) {
+ skipsTouchInterception = false
+
+ // If the first dispatch yielded no result or we noticed that the descendent view is unable to scroll in the
+ // direction the user is scrolling, we dispatch once more but without skipping our onInterceptTouchEvent.
+ // Note that RecyclerView automatically cancels active touches of all its descendents once it starts scrolling
+ // so we don't have to do that.
+ if (!handled || nestedScrollTargetWasUnableToScroll) {
+ handled = super.dispatchTouchEvent(ev)
+ }
+ }
+
+ return handled
+ }
+
+
+ // Skips RecyclerView's onInterceptTouchEvent if requested
+ override fun onInterceptTouchEvent(e: MotionEvent) =
+ !skipsTouchInterception && super.onInterceptTouchEvent(e)
+
+
+ override fun onNestedScroll(target: View, dxConsumed: Int, dyConsumed: Int, dxUnconsumed: Int, dyUnconsumed: Int) {
+ if (target === nestedScrollTarget && !nestedScrollTargetIsBeingDragged) {
+ if (dyConsumed != 0) {
+ // The descendent was actually scrolled, so we won't bother it any longer.
+ // It will receive all future events until it finished scrolling.
+ nestedScrollTargetIsBeingDragged = true
+ nestedScrollTargetWasUnableToScroll = false
+ }
+ else if (dyConsumed == 0 && dyUnconsumed != 0) {
+ // The descendent tried scrolling in response to touch movements but was not able to do so.
+ // We remember that in order to allow RecyclerView to take over scrolling.
+ nestedScrollTargetWasUnableToScroll = true
+ target.parent?.requestDisallowInterceptTouchEvent(false)
+ }
+ }
+ }
+
+
+ override fun onNestedScrollAccepted(child: View, target: View, axes: Int) {
+ if (axes and View.SCROLL_AXIS_VERTICAL != 0) {
+ // A descendent started scrolling, so we'll observe it.
+ nestedScrollTarget = target
+ nestedScrollTargetIsBeingDragged = false
+ nestedScrollTargetWasUnableToScroll = false
+ }
+
+ super.onNestedScrollAccepted(child, target, axes)
+ }
+
+
+ // We only support vertical scrolling.
+ override fun onStartNestedScroll(child: View, target: View, nestedScrollAxes: Int) =
+ (nestedScrollAxes and View.SCROLL_AXIS_VERTICAL != 0)
+
+
+ override fun onStopNestedScroll(child: View) {
+ // The descendent finished scrolling. Clean up!
+ nestedScrollTarget = null
+ nestedScrollTargetIsBeingDragged = false
+ nestedScrollTargetWasUnableToScroll = false
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/gh/gamecenter/gamedetail/FuliFragment.java b/app/src/main/java/com/gh/gamecenter/gamedetail/FuliFragment.java
index 75d729f5f7..723ee05ff6 100644
--- a/app/src/main/java/com/gh/gamecenter/gamedetail/FuliFragment.java
+++ b/app/src/main/java/com/gh/gamecenter/gamedetail/FuliFragment.java
@@ -55,7 +55,7 @@ public class FuliFragment extends BaseFragment {
public final static String GAME_DETAIL_ADD_KAIFU_KEY = "GAME_DETAIL_ADD_KAIFU_KEY";
public final static String GAME_DETAIL_PATCH_KAIFU_KEY = "GAME_DETAIL_PATCH_KAIFU_KEY";
- private boolean isCanScroll;
+ private boolean isCanScroll; // todo 更改实现方式,如果测试没问题可以删除
private boolean isCanShowKaiFuHint;
private int indexHeight = 0;
diff --git a/app/src/main/res/layout/fragment_fuli.xml b/app/src/main/res/layout/fragment_fuli.xml
index c128652795..e8c6daa329 100644
--- a/app/src/main/res/layout/fragment_fuli.xml
+++ b/app/src/main/res/layout/fragment_fuli.xml
@@ -2,13 +2,12 @@
-
+ android:layout_height = "match_parent" />
\ No newline at end of file
diff --git a/app/src/main/res/layout/gamedetail_item_kaifu.xml b/app/src/main/res/layout/gamedetail_item_kaifu.xml
index f58576b729..ea3a958e06 100644
--- a/app/src/main/res/layout/gamedetail_item_kaifu.xml
+++ b/app/src/main/res/layout/gamedetail_item_kaifu.xml
@@ -123,10 +123,9 @@
android:layout_width = "match_parent"
android:layout_height = "match_parent"
android:background = "@color/title"
- android:clickable = "true"
android:visibility = "gone" >
-
-
+