Parcourir la source

Merge remote-tracking branch 'origin/sheep_develop' into sheep_develop

zengjiebin il y a 7 ans
Parent
commit
d70d105efd

+ 4 - 0
app/src/main/java/com/sheep/gamegroup/view/activity/ActMain.java

@@ -26,6 +26,7 @@ import com.sheep.gamegroup.util.DrawablesHelper;
 import com.sheep.gamegroup.util.ListUtil;
 import com.sheep.gamegroup.util.UMConfigUtils;
 import com.sheep.gamegroup.view.fragment.FgtMainAudit;
+import com.sheep.gamegroup.view.fragment.FgtSmallSheep;
 import com.sheep.jiuyan.samllsheep.R;
 import com.sheep.jiuyan.samllsheep.SheepApp;
 import com.sheep.jiuyan.samllsheep.utils.G;
@@ -150,6 +151,9 @@ public class ActMain extends BaseActivity {
                     lastTab.setActivated(false);
                 if (curTab != null)
                     curTab.setActivated(true);
+                if(lastPosition == MainTab.FgtSmallSheep.ordinal() && position != MainTab.FgtSmallSheep.ordinal()){
+                    ((FgtSmallSheep)MainTab.FgtSmallSheep.getFragment()).onPause();
+                }
                 showFind(position == MainTab.Fgt_Find.ordinal());
                 //更新position
                 lastPosition = position;

+ 8 - 1
app/src/main/java/com/sheep/gamegroup/view/fragment/BaseListFragment2.java

@@ -72,6 +72,8 @@ public abstract class BaseListFragment2<T> extends BaseFragment {
     protected SmartRefreshLayout refreshLayout;
     @BindView(R.id.view_list)
     protected RecyclerView view_list;
+    @BindView(R.id.tag_view)
+    View tag_view;
 
     protected BaseMessage lastMessage;//最后一个网络获取的结果
     protected int page = 1;//页数
@@ -92,6 +94,8 @@ public abstract class BaseListFragment2<T> extends BaseFragment {
 //        refreshLayout.setFooterTriggerRate(1);
     }
     protected View bottomLine;
+    /* 记录滑动坐标的数组 */
+    int[] locate = new int[2];
     public void initListener() {
         refreshLayout.setOnRefreshListener(new OnRefreshListener() {
             @Override
@@ -136,8 +140,9 @@ public abstract class BaseListFragment2<T> extends BaseFragment {
                     int lastVisibleItem = linearLayoutManager.findLastCompletelyVisibleItemPosition();
                     int totalCount = linearLayoutManager.getItemCount();
                     Log.e("lastvisi_item_-----", lastVisibleItem+","+totalCount);
+                    Log.e("lastvisi_item_-----", locate[1]+"");
 
-                    if(newState == RecyclerView.SCROLL_STATE_IDLE && isSlidingToLast){//滑动到了底部
+                    if(newState == RecyclerView.SCROLL_STATE_IDLE && isSlidingToLast && locate[1] > 0){//滑动到了底部
                         if(ListUtil.size(list) >= per_page*page){
 
                             refreshLayout.autoLoadMore();
@@ -150,6 +155,8 @@ public abstract class BaseListFragment2<T> extends BaseFragment {
             @Override
             public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
                 super.onScrolled(recyclerView, dx, dy);
+                tag_view.getLocationInWindow(locate);
+                Log.e("locate-----", locate[0]+","+locate[1]);
                 Log.e("dx-----", dx+","+dy);
                 if (dy > 0) {
                     //大于0表示正在向下滚动

+ 6 - 2
app/src/main/java/com/sheep/gamegroup/view/fragment/FgtSmallSheep.java

@@ -198,6 +198,7 @@ public class FgtSmallSheep extends BaseFragment implements SmallSheepContract.Vi
     TextView test_change_user;
     @BindView(R.id.list_title)
     LinearLayout listTitle;
+    @BindView(R.id.title_car)
     LinearLayout titleCardLayout;
     /* 记录滑动坐标的数组 */
     int[] locate = new int[2];
@@ -546,7 +547,7 @@ public class FgtSmallSheep extends BaseFragment implements SmallSheepContract.Vi
      */
     @SuppressLint("InflateParams")
     private void initTitleCardLayout(final Context context) {
-        titleCardLayout = (LinearLayout) LayoutInflater.from(context).inflate(R.layout.view_float_title_card, null);
+//        titleCardLayout = (LinearLayout) LayoutInflater.from(context).inflate(R.layout.view_float_title_card, null);
         doIt = titleCardLayout.findViewById(R.id.do_it_text);
         willStart = titleCardLayout.findViewById(R.id.will_start_text);
         doItLine = titleCardLayout.findViewById(R.id.do_it_every_day_line);
@@ -573,7 +574,7 @@ public class FgtSmallSheep extends BaseFragment implements SmallSheepContract.Vi
                 willStartClick();
             }
         });
-        ((ViewGroup) activity.getWindow().getDecorView()).addView(titleCardLayout);
+//        ((ViewGroup) activity.getWindow().getDecorView()).addView(titleCardLayout);
         titleCardLayout.setVisibility(View.GONE);
     }
 
@@ -1323,6 +1324,9 @@ public class FgtSmallSheep extends BaseFragment implements SmallSheepContract.Vi
 
     @Override
     public void onPause() {
+        if(titleCardLayout != null){
+            titleCardLayout.setVisibility(View.GONE);
+        }
         super.onPause();
         if (upview1 != null) {
             //停止滚动

+ 4 - 1
app/src/main/res/layout/homepage_act_layout.xml

@@ -5,7 +5,6 @@
     android:layout_height="match_parent"
     android:background="@color/white"
     android:clipChildren="true">
-
     <com.sheep.gamegroup.util.SheepSwipeRefreshLayout
         android:id="@+id/refresh"
         android:layout_width="match_parent"
@@ -175,4 +174,8 @@
         android:paddingEnd="@dimen/content_padding_10"
         android:text="切换服务器"
         android:visibility="gone" />
+
+    <include
+        layout="@layout/view_float_title_card"
+        android:visibility="visible" />
 </RelativeLayout>

+ 3 - 1
app/src/main/res/layout/view_float_title_card.xml

@@ -3,7 +3,9 @@
     android:id="@+id/title_car"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
-    android:orientation="vertical">
+    android:orientation="vertical"
+    android:background="@color/white"
+    android:visibility="visible">
 
     <LinearLayout
         android:layout_width="match_parent"