billyyoyo před 5 roky
rodič
revize
f58894f7ec

+ 0 - 1
app/src/main/java/com/sheep/gamegroup/module/home/fragment/FgtMainHeader.java

@@ -198,7 +198,6 @@ public class FgtMainHeader extends BaseFragment {
                         if (entity != null && entity.getNum() > 0) {
                             ViewUtil.setVisibility(tv_msg_count, true);
                             ViewUtil.setText(tv_msg_count, entity.getNum());
-                            DialogNotificationOfArrival.checkNotificationOfArrivalList(getActivity());
                         } else {
                             ViewUtil.setVisibility(tv_msg_count, false);
                         }

+ 41 - 0
app/src/main/java/com/sheep/gamegroup/module/home/fragment/HomeWrapperFragment.java

@@ -0,0 +1,41 @@
+package com.sheep.gamegroup.module.home.fragment;
+
+import android.graphics.Color;
+import android.os.Bundle;
+import android.support.v4.app.Fragment;
+import android.support.v4.app.FragmentTransaction;
+import android.view.View;
+
+import com.kfzs.duanduan.cardview.ScreenUtil;
+import com.sheep.gamegroup.model.entity.WebParams;
+import com.sheep.gamegroup.util.ViewUtil;
+import com.sheep.gamegroup.view.fragment.FgtFind;
+import com.sheep.gamegroup.view.fragment.FgtSmallSheep;
+import com.sheep.jiuyan.samllsheep.Config;
+import com.sheep.jiuyan.samllsheep.R;
+import com.sheep.jiuyan.samllsheep.base.BaseFragment;
+
+public class HomeWrapperFragment extends BaseFragment {
+
+    private View frame_container;
+
+    @Override
+    public int getLayoutId() {
+        return R.layout.common_container_v2;
+    }
+
+    @Override
+    public void onViewCreated() {
+        frame_container = getView().findViewById(R.id.frame_container);
+        frame_container.setPadding(0, ScreenUtil.dip2px(getContext(), 8), 0, 0);
+        Fragment contentFragment = getChildFragmentManager().findFragmentByTag("fragment_content");
+        FragmentTransaction transaction = getChildFragmentManager().beginTransaction();
+        if (contentFragment == null) {
+            contentFragment = ViewUtil.newWebFragment(new WebParams(Config.getUrlByPath(Config.PATH_APP_HOME)).hideProgress());
+            transaction.add(R.id.frame_container, contentFragment, "fragment_content").show(contentFragment);
+        } else {
+            transaction.show(contentFragment);
+        }
+        transaction.commitAllowingStateLoss();
+    }
+}

+ 22 - 0
app/src/main/java/com/sheep/gamegroup/util/Jump2View.java

@@ -11,6 +11,7 @@ import android.view.View;
 
 import com.kfzs.cfyl.share_library.util.CallBackAPI;
 import com.kfzs.duanduan.utils.ApkUtils;
+import com.kfzs.duanduan.utils.NumberFormatUtils;
 import com.sheep.gamegroup.absBase.AbsObserver;
 import com.sheep.gamegroup.absBase.BaseActivity;
 import com.sheep.gamegroup.absBase.IHomePageSearch;
@@ -26,6 +27,7 @@ import com.sheep.gamegroup.model.entity.Agreement;
 import com.sheep.gamegroup.model.entity.Applications;
 import com.sheep.gamegroup.model.entity.Article;
 import com.sheep.gamegroup.model.entity.BaseMessage;
+import com.sheep.gamegroup.model.entity.BulletinEnty;
 import com.sheep.gamegroup.model.entity.CheckUserLabel;
 import com.sheep.gamegroup.model.entity.CommendApp;
 import com.sheep.gamegroup.model.entity.Container;
@@ -964,6 +966,26 @@ public class Jump2View {
         context.startActivity(intent);
     }
 
+    public void onClickNotice(Activity activity, BulletinEnty item) {
+        switch (item.getJumpType()) {// 跳转类型:11,任务 98,内部h5 99,外部h5
+            case 11:
+                Jump2View.getInstance().goTaskById(NumberFormatUtils.parseInteger(item.getJumpValue()));
+                break;
+            case 98:
+                Jump2View.getInstance().goWeb(activity, item.getJumpValue(), null);
+                break;
+            case 99:
+                Jump2View.getInstance().goWeb(activity, item.getJumpValue());
+                break;
+            case 14://幂动科技
+                Jump2View.getInstance().goMiDong(activity, null);
+                break;
+            case 15://小米游戏列表
+                Jump2View.getInstance().goXiaomiGameList(activity, null);
+                break;
+        }
+    }
+
     /**
      * 跳到信用卡任务界面界面
      *

+ 4 - 1
app/src/main/java/com/sheep/gamegroup/util/MainTab.java

@@ -6,6 +6,8 @@ import com.sheep.gamegroup.model.entity.WebParams;
 import com.sheep.gamegroup.module.game.fragment.FgtGameCenter;
 import com.sheep.gamegroup.module.home.fragment.FgtHome;
 import com.sheep.gamegroup.module.home.fragment.FgtWrapper;
+import com.sheep.gamegroup.module.home.fragment.HomeWrapperFragment;
+import com.sheep.jiuyan.samllsheep.Config;
 import com.sheep.jiuyan.samllsheep.R;
 import com.snail.antifake.jni.EmulatorDetectUtil;
 
@@ -18,7 +20,8 @@ public enum MainTab {
     FgtSmallSheep(R.string.main_tab_make_money) {
         @Override
         public Fragment getFragment() {
-            return new FgtHome();
+//            return new FgtHome();
+            return new HomeWrapperFragment();
         }
 
         @Override

+ 23 - 4
app/src/main/java/com/sheep/gamegroup/util/js/KFZSJs.java

@@ -24,10 +24,12 @@ import com.sheep.gamegroup.greendao.DDProviderHelper;
 import com.sheep.gamegroup.greendao.download.SheepAd;
 import com.sheep.gamegroup.model.api.IWeb;
 import com.sheep.gamegroup.model.entity.BaseMessage;
+import com.sheep.gamegroup.model.entity.BulletinEnty;
 import com.sheep.gamegroup.model.entity.DialogConfig;
 import com.sheep.gamegroup.model.entity.GameListTag;
 import com.sheep.gamegroup.model.entity.GameListType;
 import com.sheep.gamegroup.model.entity.Release_task;
+import com.sheep.gamegroup.model.entity.SystemNotification;
 import com.sheep.gamegroup.model.entity.TaskEty;
 import com.sheep.gamegroup.model.entity.WebParams;
 import com.sheep.gamegroup.model.util.SheepSubscriber;
@@ -139,7 +141,7 @@ public class KFZSJs {
     }
 
     @JavascriptInterface
-    public void gotoDownload(){
+    public void gotoDownload() {
         Jump2View.getInstance().goActDownloadManager(activity);
     }
 
@@ -498,6 +500,12 @@ public class KFZSJs {
     }
 
     @JavascriptInterface
+    public void goSystemNotification(String str) {
+        SystemNotification notification = JSONObject.parseObject(str, SystemNotification.class);
+        Jump2View.getInstance().onClickSystemNotification(activity, notification);
+    }
+
+    @JavascriptInterface
     public void onPayCompleted(String orderNo, int status) {
         Intent intent = new Intent();
         intent.putExtra("orderno", orderNo);
@@ -512,7 +520,7 @@ public class KFZSJs {
     }
 
     @JavascriptInterface
-    public boolean isVip(){
+    public boolean isVip() {
         return DataUtil.getInstance().getUserEntity().isVIP();
     }
 
@@ -672,8 +680,8 @@ public class KFZSJs {
     }
 
     @JavascriptInterface
-    public void goActGameListByTag(int id, String name){
-        GameListTag tag= new GameListTag();
+    public void goActGameListByTag(int id, String name) {
+        GameListTag tag = new GameListTag();
         tag.setId(id);
         tag.setName(name);
         Jump2View.getInstance().goActPlayGameList(activity, tag);
@@ -718,6 +726,17 @@ public class KFZSJs {
     }
 
     @JavascriptInterface
+    public void goNotice(String text){
+        BulletinEnty item = JSONObject.parseObject(text, BulletinEnty.class);
+        Jump2View.getInstance().onClickNotice(activity, item);
+    }
+
+    @JavascriptInterface
+    public boolean isNewbie(){
+        return CommonUtil.getInstance().addNewTask(activity, DataUtil.getInstance().getUserEntity());
+    }
+
+    @JavascriptInterface
     public void postEvent(int action, String data, String callback) {
         EventBus.getDefault().post(new WebViewEvent(action, data, callback));
     }

+ 26 - 4
app/src/main/java/com/sheep/gamegroup/view/customview/TouchFrameLayout.java

@@ -5,12 +5,14 @@ import android.support.v4.view.MotionEventCompat;
 import android.util.AttributeSet;
 import android.util.Log;
 import android.view.MotionEvent;
+import android.view.VelocityTracker;
 import android.view.View;
 import android.view.ViewConfiguration;
 import android.widget.FrameLayout;
 import android.widget.RelativeLayout;
 
 import com.kfzs.duanduan.cardview.ScreenUtil;
+import com.sheep.gamegroup.util.LogUtil;
 import com.sheep.jiuyan.samllsheep.R;
 
 import androidx.annotation.NonNull;
@@ -26,6 +28,8 @@ public class TouchFrameLayout extends FrameLayout {
 
     private int touchSlop;
 
+    private VelocityTracker veloctiy;
+
     public TouchFrameLayout(@NonNull Context context) {
         super(context);
         init(context);
@@ -42,9 +46,9 @@ public class TouchFrameLayout extends FrameLayout {
     }
 
     private void init(Context ctx) {
+        ViewConfiguration viewConfiguration = ViewConfiguration.get(ctx);
         max = ScreenUtil.dip2px(ctx, 72);
         min = ScreenUtil.dip2px(ctx, 32);
-        ViewConfiguration viewConfiguration = ViewConfiguration.get(ctx);
         touchSlop = viewConfiguration.getScaledTouchSlop();
     }
 
@@ -74,17 +78,25 @@ public class TouchFrameLayout extends FrameLayout {
             case MotionEvent.ACTION_DOWN:
                 startX = ev.getRawX();
                 startY = ev.getRawY();
+                if (veloctiy == null) {
+                    veloctiy = VelocityTracker.obtain();
+                } else {
+                    veloctiy.clear();
+                }
+                veloctiy.addMovement(ev);
                 break;
             case MotionEvent.ACTION_MOVE:
+                veloctiy.addMovement(ev);
+                veloctiy.computeCurrentVelocity(1000);
                 float distance = ev.getRawY() - startY;
                 if (distance > 0) {
                     if (((RelativeLayout.LayoutParams) getLayoutParams()).topMargin == max) {
                         break;
                     } else {
-                        if (Math.abs(startX - ev.getRawX()) < Math.abs(startY - ev.getRawY())) {
+                        if (Math.abs(startX - ev.getRawX()) < Math.abs(startY - ev.getRawY()) && Math.abs(veloctiy.getYVelocity()) > 5000) {
                             moveHook(distance);
+                            return true;
                         }
-                        break;
                     }
                 } else {
                     if (((RelativeLayout.LayoutParams) getLayoutParams()).topMargin == min) {
@@ -92,11 +104,21 @@ public class TouchFrameLayout extends FrameLayout {
                     } else {
                         if (Math.abs(startX - ev.getRawX()) < Math.abs(startY - ev.getRawY())) {
                             moveHook(distance);
+                            return true;
                         }
-                        break;
                     }
                 }
+            case MotionEvent.ACTION_UP:
+                break;
         }
         return super.onInterceptTouchEvent(ev);
     }
+
+    @Override
+    protected void onDetachedFromWindow() {
+        if (veloctiy != null) {
+            veloctiy.recycle();
+        }
+        super.onDetachedFromWindow();
+    }
 }

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

@@ -1348,7 +1348,7 @@ public class FgtSmallSheep extends BaseFragment implements SmallSheepContract.Vi
 
             moreView.setOnClickListener(new View.OnClickListener() {
                 public void onClick(View v) {
-                    onClickNotice(entity);
+                    Jump2View.getInstance().onClickNotice(getActivity(), entity);
                 }
             });
             homepageItemNoticeMv.addView(moreView);
@@ -1363,25 +1363,7 @@ public class FgtSmallSheep extends BaseFragment implements SmallSheepContract.Vi
     /**
      * 点击一条公告
      */
-    private void onClickNotice(BulletinEnty item) {
-        switch (item.getJumpType()) {// 跳转类型:11,任务 98,内部h5 99,外部h5
-            case 11:
-                Jump2View.getInstance().goTaskById(NumberFormatUtils.parseInteger(item.getJumpValue()));
-                break;
-            case 98:
-                Jump2View.getInstance().goWeb(activity, item.getJumpValue(), null);
-                break;
-            case 99:
-                Jump2View.getInstance().goWeb(activity, item.getJumpValue());
-                break;
-            case 14://幂动科技
-                Jump2View.getInstance().goMiDong(activity, null);
-                break;
-            case 15://小米游戏列表
-                Jump2View.getInstance().goXiaomiGameList(activity, null);
-                break;
-        }
-    }
+
 
     /**
      * 提示用户开启推送通知权限

+ 10 - 10
app/src/main/java/com/sheep/jiuyan/samllsheep/Config.java

@@ -1,7 +1,6 @@
 package com.sheep.jiuyan.samllsheep;
 
 import android.text.TextUtils;
-import android.util.Log;
 
 /**
  * Created by kemllor on 2017/12/14.
@@ -52,7 +51,7 @@ public class Config {
     //随便打
     private static final String STATION_SUI_BIAN_DA = "/casual_call/#";
     //福利
-    private static final String STATION_WELFARE = "/small_sheep_app/#";
+    private static final String STATION_APP = "/small_sheep_app/#";
     //游戏商城
     private static final String STATION_GAME_SHOP = "/game_mall/#";
     //遇见预约
@@ -99,11 +98,12 @@ public class Config {
     //随便打首页
     public static final String PATH_SBD_HOME = STATION_SUI_BIAN_DA + "/";
     //福利
-    public static final String PATH_WELFARE_HOME = STATION_WELFARE + "/welfare-center";
-    public static final String PATH_GAME_HOME = STATION_WELFARE + "/game-center";
-    public static final String PATH_ARTICLE_LIST = STATION_WELFARE + "/article-list";
-    public static final String PATH_WELFARE_DETAIL = STATION_WELFARE + "/detail";
-    public static final String PATH_DISCOUNT_DESC = STATION_WELFARE + "/discount";
+    public static final String PATH_APP_HOME = STATION_APP + "/home";
+    public static final String PATH_WELFARE_HOME = STATION_APP + "/welfare-center";
+    public static final String PATH_GAME_HOME = STATION_APP + "/game-center";
+    public static final String PATH_ARTICLE_LIST = STATION_APP + "/article-list";
+    public static final String PATH_WELFARE_DETAIL = STATION_APP + "/detail";
+    public static final String PATH_DISCOUNT_DESC = STATION_APP + "/discount";
     //游戏商城
     public static final String PATH_GAME_SHOP_HOME = STATION_GAME_SHOP + "/gameMallHome";
     public static final String PATH_GAME_SHOP_MY_GAME = STATION_GAME_SHOP + "/myGameRole";
@@ -114,10 +114,10 @@ public class Config {
     public static final String PATH_YY_SHOP_ORDER = STATION_YY_SHOP + "/pages/order/order";
     public static final String PATH_YY_SHOP_INDEX = STATION_YY_SHOP + "/pages/index/index";
     //赏金福利
-    public static final String PATH_MONEY_REWARD_DETAIL = STATION_WELFARE + "/money-reward-detail";
-    public static final String PATH_ACTIVITY_COIN_LIST = STATION_WELFARE + "/activity_coin_list";
+    public static final String PATH_MONEY_REWARD_DETAIL = STATION_APP + "/money-reward-detail";
+    public static final String PATH_ACTIVITY_COIN_LIST = STATION_APP + "/activity_coin_list";
     //赏金任务列表
-    public static final String PATH_WELFARE_MONEY_REWARD_LIST = STATION_WELFARE + "/money-reward-list";
+    public static final String PATH_WELFARE_MONEY_REWARD_LIST = STATION_APP + "/money-reward-list";
     //邀请赚钱主页
     public static final String PATH_SMALL_SHEEP_INVITATION_HOME = STATION_SMALL_SHEEP_INVITATION + "/home-page3";
     public static final String PATH_SMALL_SHEEP_CLOCK_CHALLENGE = STATION_CLOCK_CHALLENGE + "/homePage";

+ 5 - 0
app/src/main/res/layout/common_container_v2.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@+id/frame_container"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent" />