Просмотр исходного кода

Merge remote-tracking branch 'origin/sheep2.0' into sheep2.0

zengjiebin лет назад: 8
Родитель
Сommit
3b0db7b801

+ 3 - 0
app/src/main/java/com/sheep/gamegroup/util/MyScrollView.java

@@ -1,6 +1,8 @@
 package com.sheep.gamegroup.util;
 
 import android.content.Context;
+import android.os.Build;
+import android.support.annotation.RequiresApi;
 import android.util.AttributeSet;
 import android.widget.ScrollView;
 
@@ -21,6 +23,7 @@ public class MyScrollView extends ScrollView {
         super(context, attrs, defStyleAttr);
     }
 
+    @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
     public MyScrollView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
         super(context, attrs, defStyleAttr, defStyleRes);
     }

+ 49 - 0
app/src/main/java/com/sheep/gamegroup/util/SheepSwipeRefreshLayout.java

@@ -0,0 +1,49 @@
+package com.sheep.gamegroup.util;
+
+import android.content.Context;
+import android.support.annotation.NonNull;
+import android.support.annotation.Nullable;
+import android.support.v4.widget.SwipeRefreshLayout;
+import android.util.AttributeSet;
+import android.view.MotionEvent;
+
+/**
+ * Created by ljy on 2018/6/1.
+ */
+
+public class SheepSwipeRefreshLayout extends SwipeRefreshLayout {
+
+    private float mDownPosX = 0;
+    private float mDownPosY = 0;
+    public SheepSwipeRefreshLayout(@NonNull Context context) {
+        super(context);
+    }
+
+    public SheepSwipeRefreshLayout(@NonNull Context context, @Nullable AttributeSet attrs) {
+        super(context, attrs);
+    }
+
+    @Override
+    public boolean onInterceptTouchEvent(MotionEvent ev) {
+        final float x = ev.getX();
+        final float y = ev.getY();
+
+        final int action = ev.getAction();
+        switch (action) {
+            case MotionEvent.ACTION_DOWN:
+                mDownPosX = x;
+                mDownPosY = y;
+
+                break;
+            case MotionEvent.ACTION_MOVE:
+                final float deltaX = Math.abs(x - mDownPosX);
+                final float deltaY = Math.abs(y - mDownPosY);
+                // 这里是否拦截的判断依据是左右滑动,读者可根据自己的逻辑进行是否拦截
+
+                if (deltaX > deltaY) {// 左右滑动不拦截
+                    return false;
+                }
+        }
+        return super.onInterceptTouchEvent(ev);
+    }
+}

+ 4 - 4
app/src/main/res/layout/adp_homelist_gridview.xml

@@ -7,8 +7,8 @@
     android:layout_gravity="center_vertical"
     android:paddingLeft="@dimen/content_padding_15"
     android:paddingRight="@dimen/content_padding_10"
-    android:paddingTop="@dimen/content_padding_10"
-    android:paddingBottom="@dimen/content_padding_10"
+    android:paddingTop="@dimen/content_padding_small"
+    android:paddingBottom="@dimen/content_padding_small"
     android:background="@drawable/x_shap_shadow_bg_rectgangle_white">
         <LinearLayout
             android:layout_width="wrap_content"
@@ -34,8 +34,8 @@
             android:id="@+id/gridview_item_icon_iv"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
-            android:maxHeight="@dimen/view_size_73"
-            android:maxWidth="@dimen/view_size_73"
+            android:maxHeight="@dimen/view_size_65"
+            android:maxWidth="@dimen/view_size_65"
             android:src="@mipmap/home_try_play_circle_bg"
             android:adjustViewBounds="true"/>
 </LinearLayout>

+ 2 - 2
app/src/main/res/layout/homepage_act_layout.xml

@@ -5,7 +5,7 @@
     android:clipChildren="true"
     android:background="@color/bg_gray">
 
-    <android.support.v4.widget.SwipeRefreshLayout
+    <com.sheep.gamegroup.util.SheepSwipeRefreshLayout
         android:id="@+id/refresh"
         android:layout_width="match_parent"
         android:layout_height="wrap_content">
@@ -61,7 +61,7 @@
                 android:paddingRight="@dimen/content_padding_10"/>
         </LinearLayout>
     </ScrollView>
-    </android.support.v4.widget.SwipeRefreshLayout>
+    </com.sheep.gamegroup.util.SheepSwipeRefreshLayout>
 
     <com.kfzs.duanduan.view.DragRelativeLayout
         android:id="@+id/newbie_task"

+ 1 - 0
app/src/main/res/values/common.xml

@@ -70,6 +70,7 @@
     <dimen name="view_size_45">45dp</dimen>
     <dimen name="view_size_55">55dp</dimen>
     <dimen name="view_size_60">60dp</dimen>
+    <dimen name="view_size_65">65dp</dimen>
     <dimen name="view_size_73">73dp</dimen>
     <dimen name="view_size_80">80dp</dimen>
     <dimen name="view_size_90">90dp</dimen>