hanjing před 7 roky
rodič
revize
8625e4136a

+ 15 - 15
app/src/main/java/com/sheep/gamegroup/greendao/download/DaoMaster.java

@@ -21,26 +21,26 @@ public class DaoMaster extends AbstractDaoMaster {
 
     /** Creates underlying database table using DAOs. */
     public static void createAllTables(Database db, boolean ifNotExists) {
-        AcceptTaskRecordDao.createTable(db, ifNotExists);
-        AccountDao.createTable(db, ifNotExists);
-        AppdownloadBeanDao.createTable(db, ifNotExists);
-        DownLoadInfoDao.createTable(db, ifNotExists);
         ProcessRecordDao.createTable(db, ifNotExists);
-        ScreenShotRecordDao.createTable(db, ifNotExists);
+        AppdownloadBeanDao.createTable(db, ifNotExists);
         SdkLoginUserDao.createTable(db, ifNotExists);
+        ScreenShotRecordDao.createTable(db, ifNotExists);
+        AcceptTaskRecordDao.createTable(db, ifNotExists);
+        AccountDao.createTable(db, ifNotExists);
         SearchRecordDao.createTable(db, ifNotExists);
+        DownLoadInfoDao.createTable(db, ifNotExists);
     }
 
     /** Drops underlying database table using DAOs. */
     public static void dropAllTables(Database db, boolean ifExists) {
-        AcceptTaskRecordDao.dropTable(db, ifExists);
-        AccountDao.dropTable(db, ifExists);
-        AppdownloadBeanDao.dropTable(db, ifExists);
-        DownLoadInfoDao.dropTable(db, ifExists);
         ProcessRecordDao.dropTable(db, ifExists);
-        ScreenShotRecordDao.dropTable(db, ifExists);
+        AppdownloadBeanDao.dropTable(db, ifExists);
         SdkLoginUserDao.dropTable(db, ifExists);
+        ScreenShotRecordDao.dropTable(db, ifExists);
+        AcceptTaskRecordDao.dropTable(db, ifExists);
+        AccountDao.dropTable(db, ifExists);
         SearchRecordDao.dropTable(db, ifExists);
+        DownLoadInfoDao.dropTable(db, ifExists);
     }
 
     /**
@@ -59,14 +59,14 @@ public class DaoMaster extends AbstractDaoMaster {
 
     public DaoMaster(Database db) {
         super(db, SCHEMA_VERSION);
-        registerDaoClass(AcceptTaskRecordDao.class);
-        registerDaoClass(AccountDao.class);
-        registerDaoClass(AppdownloadBeanDao.class);
-        registerDaoClass(DownLoadInfoDao.class);
         registerDaoClass(ProcessRecordDao.class);
-        registerDaoClass(ScreenShotRecordDao.class);
+        registerDaoClass(AppdownloadBeanDao.class);
         registerDaoClass(SdkLoginUserDao.class);
+        registerDaoClass(ScreenShotRecordDao.class);
+        registerDaoClass(AcceptTaskRecordDao.class);
+        registerDaoClass(AccountDao.class);
         registerDaoClass(SearchRecordDao.class);
+        registerDaoClass(DownLoadInfoDao.class);
     }
 
     public DaoSession newSession() {

+ 61 - 61
app/src/main/java/com/sheep/gamegroup/greendao/download/DaoSession.java

@@ -8,23 +8,23 @@ import org.greenrobot.greendao.database.Database;
 import org.greenrobot.greendao.identityscope.IdentityScopeType;
 import org.greenrobot.greendao.internal.DaoConfig;
 
-import com.sheep.gamegroup.greendao.download.AcceptTaskRecord;
-import com.sheep.gamegroup.greendao.download.Account;
-import com.sheep.gamegroup.greendao.download.AppdownloadBean;
-import com.sheep.gamegroup.greendao.download.DownLoadInfo;
 import com.sheep.gamegroup.greendao.download.ProcessRecord;
-import com.sheep.gamegroup.greendao.download.ScreenShotRecord;
+import com.sheep.gamegroup.greendao.download.AppdownloadBean;
 import com.sheep.gamegroup.greendao.download.SdkLoginUser;
+import com.sheep.gamegroup.greendao.download.ScreenShotRecord;
+import com.sheep.gamegroup.greendao.download.AcceptTaskRecord;
+import com.sheep.gamegroup.greendao.download.Account;
 import com.sheep.gamegroup.greendao.download.SearchRecord;
+import com.sheep.gamegroup.greendao.download.DownLoadInfo;
 
-import com.sheep.gamegroup.greendao.download.AcceptTaskRecordDao;
-import com.sheep.gamegroup.greendao.download.AccountDao;
-import com.sheep.gamegroup.greendao.download.AppdownloadBeanDao;
-import com.sheep.gamegroup.greendao.download.DownLoadInfoDao;
 import com.sheep.gamegroup.greendao.download.ProcessRecordDao;
-import com.sheep.gamegroup.greendao.download.ScreenShotRecordDao;
+import com.sheep.gamegroup.greendao.download.AppdownloadBeanDao;
 import com.sheep.gamegroup.greendao.download.SdkLoginUserDao;
+import com.sheep.gamegroup.greendao.download.ScreenShotRecordDao;
+import com.sheep.gamegroup.greendao.download.AcceptTaskRecordDao;
+import com.sheep.gamegroup.greendao.download.AccountDao;
 import com.sheep.gamegroup.greendao.download.SearchRecordDao;
+import com.sheep.gamegroup.greendao.download.DownLoadInfoDao;
 
 // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
 
@@ -35,112 +35,112 @@ import com.sheep.gamegroup.greendao.download.SearchRecordDao;
  */
 public class DaoSession extends AbstractDaoSession {
 
-    private final DaoConfig acceptTaskRecordDaoConfig;
-    private final DaoConfig accountDaoConfig;
-    private final DaoConfig appdownloadBeanDaoConfig;
-    private final DaoConfig downLoadInfoDaoConfig;
     private final DaoConfig processRecordDaoConfig;
-    private final DaoConfig screenShotRecordDaoConfig;
+    private final DaoConfig appdownloadBeanDaoConfig;
     private final DaoConfig sdkLoginUserDaoConfig;
+    private final DaoConfig screenShotRecordDaoConfig;
+    private final DaoConfig acceptTaskRecordDaoConfig;
+    private final DaoConfig accountDaoConfig;
     private final DaoConfig searchRecordDaoConfig;
+    private final DaoConfig downLoadInfoDaoConfig;
 
-    private final AcceptTaskRecordDao acceptTaskRecordDao;
-    private final AccountDao accountDao;
-    private final AppdownloadBeanDao appdownloadBeanDao;
-    private final DownLoadInfoDao downLoadInfoDao;
     private final ProcessRecordDao processRecordDao;
-    private final ScreenShotRecordDao screenShotRecordDao;
+    private final AppdownloadBeanDao appdownloadBeanDao;
     private final SdkLoginUserDao sdkLoginUserDao;
+    private final ScreenShotRecordDao screenShotRecordDao;
+    private final AcceptTaskRecordDao acceptTaskRecordDao;
+    private final AccountDao accountDao;
     private final SearchRecordDao searchRecordDao;
+    private final DownLoadInfoDao downLoadInfoDao;
 
     public DaoSession(Database db, IdentityScopeType type, Map<Class<? extends AbstractDao<?, ?>>, DaoConfig>
             daoConfigMap) {
         super(db);
 
-        acceptTaskRecordDaoConfig = daoConfigMap.get(AcceptTaskRecordDao.class).clone();
-        acceptTaskRecordDaoConfig.initIdentityScope(type);
-
-        accountDaoConfig = daoConfigMap.get(AccountDao.class).clone();
-        accountDaoConfig.initIdentityScope(type);
+        processRecordDaoConfig = daoConfigMap.get(ProcessRecordDao.class).clone();
+        processRecordDaoConfig.initIdentityScope(type);
 
         appdownloadBeanDaoConfig = daoConfigMap.get(AppdownloadBeanDao.class).clone();
         appdownloadBeanDaoConfig.initIdentityScope(type);
 
-        downLoadInfoDaoConfig = daoConfigMap.get(DownLoadInfoDao.class).clone();
-        downLoadInfoDaoConfig.initIdentityScope(type);
-
-        processRecordDaoConfig = daoConfigMap.get(ProcessRecordDao.class).clone();
-        processRecordDaoConfig.initIdentityScope(type);
+        sdkLoginUserDaoConfig = daoConfigMap.get(SdkLoginUserDao.class).clone();
+        sdkLoginUserDaoConfig.initIdentityScope(type);
 
         screenShotRecordDaoConfig = daoConfigMap.get(ScreenShotRecordDao.class).clone();
         screenShotRecordDaoConfig.initIdentityScope(type);
 
-        sdkLoginUserDaoConfig = daoConfigMap.get(SdkLoginUserDao.class).clone();
-        sdkLoginUserDaoConfig.initIdentityScope(type);
+        acceptTaskRecordDaoConfig = daoConfigMap.get(AcceptTaskRecordDao.class).clone();
+        acceptTaskRecordDaoConfig.initIdentityScope(type);
+
+        accountDaoConfig = daoConfigMap.get(AccountDao.class).clone();
+        accountDaoConfig.initIdentityScope(type);
 
         searchRecordDaoConfig = daoConfigMap.get(SearchRecordDao.class).clone();
         searchRecordDaoConfig.initIdentityScope(type);
 
-        acceptTaskRecordDao = new AcceptTaskRecordDao(acceptTaskRecordDaoConfig, this);
-        accountDao = new AccountDao(accountDaoConfig, this);
-        appdownloadBeanDao = new AppdownloadBeanDao(appdownloadBeanDaoConfig, this);
-        downLoadInfoDao = new DownLoadInfoDao(downLoadInfoDaoConfig, this);
+        downLoadInfoDaoConfig = daoConfigMap.get(DownLoadInfoDao.class).clone();
+        downLoadInfoDaoConfig.initIdentityScope(type);
+
         processRecordDao = new ProcessRecordDao(processRecordDaoConfig, this);
-        screenShotRecordDao = new ScreenShotRecordDao(screenShotRecordDaoConfig, this);
+        appdownloadBeanDao = new AppdownloadBeanDao(appdownloadBeanDaoConfig, this);
         sdkLoginUserDao = new SdkLoginUserDao(sdkLoginUserDaoConfig, this);
+        screenShotRecordDao = new ScreenShotRecordDao(screenShotRecordDaoConfig, this);
+        acceptTaskRecordDao = new AcceptTaskRecordDao(acceptTaskRecordDaoConfig, this);
+        accountDao = new AccountDao(accountDaoConfig, this);
         searchRecordDao = new SearchRecordDao(searchRecordDaoConfig, this);
+        downLoadInfoDao = new DownLoadInfoDao(downLoadInfoDaoConfig, this);
 
-        registerDao(AcceptTaskRecord.class, acceptTaskRecordDao);
-        registerDao(Account.class, accountDao);
-        registerDao(AppdownloadBean.class, appdownloadBeanDao);
-        registerDao(DownLoadInfo.class, downLoadInfoDao);
         registerDao(ProcessRecord.class, processRecordDao);
-        registerDao(ScreenShotRecord.class, screenShotRecordDao);
+        registerDao(AppdownloadBean.class, appdownloadBeanDao);
         registerDao(SdkLoginUser.class, sdkLoginUserDao);
+        registerDao(ScreenShotRecord.class, screenShotRecordDao);
+        registerDao(AcceptTaskRecord.class, acceptTaskRecordDao);
+        registerDao(Account.class, accountDao);
         registerDao(SearchRecord.class, searchRecordDao);
+        registerDao(DownLoadInfo.class, downLoadInfoDao);
     }
     
     public void clear() {
-        acceptTaskRecordDaoConfig.clearIdentityScope();
-        accountDaoConfig.clearIdentityScope();
-        appdownloadBeanDaoConfig.clearIdentityScope();
-        downLoadInfoDaoConfig.clearIdentityScope();
         processRecordDaoConfig.clearIdentityScope();
-        screenShotRecordDaoConfig.clearIdentityScope();
+        appdownloadBeanDaoConfig.clearIdentityScope();
         sdkLoginUserDaoConfig.clearIdentityScope();
+        screenShotRecordDaoConfig.clearIdentityScope();
+        acceptTaskRecordDaoConfig.clearIdentityScope();
+        accountDaoConfig.clearIdentityScope();
         searchRecordDaoConfig.clearIdentityScope();
+        downLoadInfoDaoConfig.clearIdentityScope();
     }
 
-    public AcceptTaskRecordDao getAcceptTaskRecordDao() {
-        return acceptTaskRecordDao;
-    }
-
-    public AccountDao getAccountDao() {
-        return accountDao;
+    public ProcessRecordDao getProcessRecordDao() {
+        return processRecordDao;
     }
 
     public AppdownloadBeanDao getAppdownloadBeanDao() {
         return appdownloadBeanDao;
     }
 
-    public DownLoadInfoDao getDownLoadInfoDao() {
-        return downLoadInfoDao;
-    }
-
-    public ProcessRecordDao getProcessRecordDao() {
-        return processRecordDao;
+    public SdkLoginUserDao getSdkLoginUserDao() {
+        return sdkLoginUserDao;
     }
 
     public ScreenShotRecordDao getScreenShotRecordDao() {
         return screenShotRecordDao;
     }
 
-    public SdkLoginUserDao getSdkLoginUserDao() {
-        return sdkLoginUserDao;
+    public AcceptTaskRecordDao getAcceptTaskRecordDao() {
+        return acceptTaskRecordDao;
+    }
+
+    public AccountDao getAccountDao() {
+        return accountDao;
     }
 
     public SearchRecordDao getSearchRecordDao() {
         return searchRecordDao;
     }
 
+    public DownLoadInfoDao getDownLoadInfoDao() {
+        return downLoadInfoDao;
+    }
+
 }

+ 3 - 1
app/src/main/java/com/sheep/gamegroup/util/TestUtil.java

@@ -116,7 +116,9 @@ public class TestUtil {
                 public void onClick(View view) {
                     final ConnectAddress[] connectAddresses = ConnectAddress.values();
                     AlertDialog dialog = new AlertDialog.Builder(activity).setTitle("请选择要切换的服务器")
-                            .setSingleChoiceItems(new ArrayAdapter<>(activity, android.R.layout.simple_list_item_single_choice, connectAddresses), SheepApp.getInstance().getConnectAddress().ordinal(), new DialogInterface.OnClickListener() {
+                            .setSingleChoiceItems(new ArrayAdapter<>(activity,
+                                    android.R.layout.simple_list_item_single_choice,
+                                    connectAddresses), SheepApp.getInstance().getConnectAddress().ordinal(), new DialogInterface.OnClickListener() {
 
                                 @Override
                                 public void onClick(DialogInterface dialogInterface, int which) {

+ 0 - 72
app/src/main/java/com/sheep/gamegroup/view/adapter/PagerAdapter.java

@@ -1,72 +0,0 @@
-package com.sheep.gamegroup.view.adapter;
-
-import android.support.v4.app.Fragment;
-import android.support.v4.app.FragmentManager;
-import android.support.v4.app.FragmentPagerAdapter;
-import android.util.SparseArray;
-import android.view.ViewGroup;
-
-import com.sheep.gamegroup.view.fragment.FgtFriendExtractPage;
-
-
-/**
- * Created by realicing on 2018/4/25.
- * realicing@sina.com
- */
-public class PagerAdapter extends FragmentPagerAdapter {
-    private static final String TAG = "PagerAdapter";
-
-    SparseArray<FgtFriendExtractPage> mTestFragments;
-
-
-    public PagerAdapter(FragmentManager fm, SparseArray<FgtFriendExtractPage> testFragments) {
-        super(fm);
-        this.mTestFragments = testFragments;
-    }
-
-    @Override
-    public Fragment getItem(int position) {
-        FgtFriendExtractPage testFragment=mTestFragments.valueAt(position);
-        return testFragment;
-    }
-
-    @Override
-    public int getCount() {
-        return mTestFragments.size();
-    }
-
-    /**
-     * 返回每一个item所有对应的key,在instantiateItem中 会根据这个item去查找是否已经存在这个item
-     * 如果不存在则调用getItem创建
-     * 存在则在FragmentManager中去find
-     * 详情查看instantiateItem源码
-     * @param position
-     * @return
-     */
-    @Override
-    public long getItemId(int position) {
-        return mTestFragments.keyAt(position);
-    }
-
-    @Override
-    public Object instantiateItem(ViewGroup container, int position) {
-        return super.instantiateItem(container, position);
-    }
-
-    @Override
-    public void destroyItem(ViewGroup container, int position, Object object) {
-        super.destroyItem(container, position, object);
-    }
-
-    @Override
-    public int getItemPosition(Object object) {
-        return POSITION_NONE;
-
-
-    }
-
-    @Override
-    public void setPrimaryItem(ViewGroup container, int position, Object object) {
-        super.setPrimaryItem(container, position, object);
-    }
-}

+ 95 - 77
app/src/main/java/com/sheep/gamegroup/view/fragment/FgtAskGetMoneyFriend.java

@@ -1,21 +1,28 @@
 package com.sheep.gamegroup.view.fragment;
 
-import android.support.v4.view.ViewPager;
-import android.util.SparseArray;
+import android.view.LayoutInflater;
 import android.view.View;
+import android.widget.LinearLayout;
 import android.widget.TextView;
 
+import com.sheep.gamegroup.model.entity.BaseMessage;
+import com.sheep.gamegroup.model.entity.Friend;
+import com.sheep.gamegroup.model.util.SheepSubscriber;
+import com.sheep.gamegroup.util.CommonUtil;
 import com.sheep.gamegroup.util.ListUtil;
+import com.sheep.gamegroup.util.TimeUtil;
 import com.sheep.gamegroup.util.ViewUtil;
-import com.sheep.gamegroup.view.adapter.PagerAdapter;
-import com.sheep.jiuyan.samllsheep.BuildConfig;
 import com.sheep.jiuyan.samllsheep.R;
+import com.sheep.jiuyan.samllsheep.SheepApp;
 import com.sheep.jiuyan.samllsheep.base.BaseFragment;
-import com.sheep.jiuyan.samllsheep.utils.G;
 
-import java.util.Locale;
+import java.util.ArrayList;
+import java.util.List;
 
 import butterknife.BindView;
+import butterknife.OnClick;
+import io.reactivex.android.schedulers.AndroidSchedulers;
+import io.reactivex.schedulers.Schedulers;
 
 /**
  * Created by ljy on 2018/8/17.
@@ -23,19 +30,26 @@ import butterknife.BindView;
 
 public class FgtAskGetMoneyFriend extends BaseFragment {
 
-    @BindView(R.id.friend_extract_vp)
-    ViewPager friend_extract_vp;
-    @BindView(R.id.friend_extract_last_page_tv)
-    TextView friend_extract_last_page_tv;
+    @BindView(R.id.empty_view)
+    View emptyView;
+    @BindView(R.id.pager_view)
+    View pagerView;
+    @BindView(R.id.friend_list_ll)
+    LinearLayout friendListView;
     @BindView(R.id.friend_extract_page_tv)
-    TextView friend_extract_page_tv;
-    @BindView(R.id.friend_extract_next_page_tv)
-    TextView friend_extract_next_page_tv;
+    TextView pageIndexView;
 
+    private int totalPage = 0;
+    private int pageSize = 5;
+    private int curPage = 1;
+    private boolean isLoading = false;
 
-    public static FgtAskGetMoneyFriend newInstance(){
+    private List<Friend> friends = new ArrayList<>();
+
+    public static FgtAskGetMoneyFriend newInstance() {
         return new FgtAskGetMoneyFriend();
     }
+
     @Override
     public int getLayoutId() {
         return R.layout.fgt_askgetmoney_friend;
@@ -43,79 +57,83 @@ public class FgtAskGetMoneyFriend extends BaseFragment {
 
     @Override
     public void onViewCreated() {
-        initView();
+        loadPageData(curPage);
     }
 
-    private void initView() {
-        initFriendExtractList();
+    public void setFriendExtractCount(int count) {
+        totalPage = ListUtil.getTotalPage(count, pageSize);
+        ViewUtil.setVisibility(pagerView, true);
+        ViewUtil.setVisibility(emptyView, false);
+        pageIndexView.setText(curPage + "/" + totalPage);
     }
 
-    private SparseArray<FgtFriendExtractPage> mTestFragments;
-    private int totalPage = 0;
-    public void setFriendExtractCount(int count, int page, int size) {
-        totalPage = ListUtil.getTotalPage(count, 5);
-        friend_extract_page_tv.setText(String.format(Locale.CHINA, "%d/%d", curPage, totalPage));
-        if (count > 0)
-            checkAddPage(page, size);
-    }
     //无好友,不显示翻页操作按钮
-    public void updateByNoFriend(){
-        if(friend_extract_last_page_tv.getParent() instanceof View)
-            ViewUtil.setVisibility(((View) friend_extract_last_page_tv.getParent()), false);
+    public void updateByNoFriend() {
+        ViewUtil.setVisibility(pagerView, false);
+        ViewUtil.setVisibility(emptyView, true);
     }
 
-    private void checkAddPage(int page, int size) {
-        if (curPage + 2 > page && size == FgtFriendExtractPage.per_page) {//已经到最后一页面,且数据是满的,可以添加一页面
-            int nextPage = page + 1;
-            if (mTestFragments.get(nextPage) == null) {
-//                if(BuildConfig.DEBUG) G.showToast("添加新的一页:" + nextPage);
-                mTestFragments.put(nextPage, FgtFriendExtractPage.newInstance(nextPage));
-                mPagerAdapter.notifyDataSetChanged();
-            } else {
-//                if(BuildConfig.DEBUG) G.showToast("不用添加新的一页:" + nextPage);
-            }
+    private void loadPageData(int index) {
+        isLoading = true;
+        SheepApp.getInstance().getNetComponent().getApiService().getUserFriendList(index, pageSize)
+                .subscribeOn(Schedulers.io())
+                .observeOn(AndroidSchedulers.mainThread())
+                .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {
+                    @Override
+                    public void onNext(BaseMessage baseMessage) {
+                        List<Friend> friendList = baseMessage.getDatas(Friend.class);
+                        if (friendList == null) {
+                            onError(baseMessage);
+                        } else {
+                            friends.clear();
+                            friendListView.removeAllViews();
+                            setFriendExtractCount(baseMessage.getTotal());
+                            friends.addAll(friendList);
+                            isLoading = false;
+                            showDataListView();
+                        }
+                    }
+
+                    @Override
+                    public void onError(BaseMessage baseMessage) {
+                        CommonUtil.getInstance().updateEmptyView(emptyView, friends.isEmpty(), true);
+                        isLoading = false;
+                        updateByNoFriend();
+                        friends.clear();
+                        friendListView.removeAllViews();
+                    }
+                });
+    }
+
+    private void showDataListView() {
+        for (Friend friend : friends) {
+            View separetor = LayoutInflater.from(getContext()).inflate(R.layout.separetor_margin_13, friendListView, false);
+            View friendView = LayoutInflater.from(getContext()).inflate(R.layout.x_ask_getmoney_act_layout_item, friendListView, false);
+            TextView friend_item_id = friendView.findViewById(R.id.sheep_no_view);
+            friend_item_id.setText(friend.getInvitation_code());
+            TextView friend_item_name = friendView.findViewById(R.id.register_time_view);
+            friend_item_name.setText(TimeUtil.TimeStamp2Date(friend.getCreate_time(), "yyyy/MM/dd HH:mm"));
+            TextView friend_item_extract = friendView.findViewById(R.id.source_page_view);
+            ViewUtil.setText(friend_item_extract, friend.getSource_page());
+            TextView friend_item_time = friendView.findViewById(R.id.award_view);;
+            ViewUtil.setText(friend_item_time, friend.getAward_amount());
+            friendListView.addView(separetor);
+            friendListView.addView(friendView);
         }
-        if (size > FgtFriendExtractPage.per_page) {
-            if (BuildConfig.DEBUG) G.showToast("页面" + page + "的数据为:" + size);
+    }
+
+    @OnClick(R.id.friend_extract_last_page_tv)
+    public void doLastPage(View v) {
+        if (curPage > 1 && !isLoading) {
+            loadPageData(--curPage);
         }
     }
-    private int curPage = 1;
-    private PagerAdapter mPagerAdapter;
-    private void initFriendExtractList() {
-        mTestFragments = new SparseArray<>();
-        mTestFragments.put(1, FgtFriendExtractPage.newInstance(1));
-        mPagerAdapter = new PagerAdapter(getChildFragmentManager(), mTestFragments);
-        friend_extract_vp.setAdapter(mPagerAdapter);
-        friend_extract_vp.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
-            @Override
-            public void onPageScrolled(int i, float v, int i1) {
-
-            }
-
-            @Override
-            public void onPageSelected(int i) {
-                curPage = i + 1;
-                friend_extract_page_tv.setText(String.format(Locale.CHINA, "%d/%d", curPage, totalPage));
-                checkAddPage(curPage, mTestFragments.get(curPage).getList().size());
-            }
-
-            @Override
-            public void onPageScrollStateChanged(int i) {
-
-            }
-        });
-        friend_extract_last_page_tv.setOnClickListener(new View.OnClickListener() {
-            @Override
-            public void onClick(View view) {
-                friend_extract_vp.setCurrentItem(curPage - 2);
-            }
-        });
-        friend_extract_next_page_tv.setOnClickListener(new View.OnClickListener() {
-            @Override
-            public void onClick(View view) {
-                friend_extract_vp.setCurrentItem(curPage);
-            }
-        });
+
+    @OnClick(R.id.friend_extract_next_page_tv)
+    public void doNextPage(View v) {
+        if (curPage < totalPage && !isLoading) {
+            loadPageData(++curPage);
+        }
     }
 
 }

+ 0 - 151
app/src/main/java/com/sheep/gamegroup/view/fragment/FgtFriendExtractPage.java

@@ -1,151 +0,0 @@
-package com.sheep.gamegroup.view.fragment;
-
-import android.support.v4.app.Fragment;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.LinearLayout;
-import android.widget.TextView;
-
-import com.sheep.gamegroup.event.BigEvent;
-import com.sheep.gamegroup.model.entity.BaseMessage;
-import com.sheep.gamegroup.model.entity.Friend;
-import com.sheep.gamegroup.model.util.SheepSubscriber;
-import com.sheep.gamegroup.util.CommonUtil;
-import com.sheep.gamegroup.util.TimeUtil;
-import com.sheep.gamegroup.util.ViewUtil;
-import com.sheep.jiuyan.samllsheep.R;
-import com.sheep.jiuyan.samllsheep.SheepApp;
-import com.sheep.jiuyan.samllsheep.base.BaseFragment;
-
-import org.greenrobot.eventbus.EventBus;
-import org.greenrobot.eventbus.Subscribe;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import butterknife.BindView;
-import io.reactivex.android.schedulers.AndroidSchedulers;
-import io.reactivex.schedulers.Schedulers;
-
-/**
- * Created by realicing on 2018/4/25.
- * realicing@sina.com
- */
-public class FgtFriendExtractPage extends BaseFragment {
-    @BindView(R.id.friend_list_ll)
-    LinearLayout friend_list_ll;
-    @BindView(R.id.empty_view)
-    View empty_view;
-    @Override
-    public int getLayoutId() {
-        return R.layout.friend_list_empty;
-    }
-
-    private List<Friend> list = new ArrayList<>();
-
-    private Fragment activity;
-    @Override
-    public void onViewCreated() {
-        activity = getParentFragment();
-        if(!EventBus.getDefault().isRegistered(this))
-            EventBus.getDefault().register(this);
-        initData();
-    }
-
-
-    public static int per_page = 5;
-    private int page = 1;
-    private void notifyDataSetChanged(){
-        if(friend_list_ll == null)
-            return;
-        int size = list.size();
-        for (int i = 0; i < friend_list_ll.getChildCount(); ) {
-            View line = friend_list_ll.getChildAt(i);
-            ViewGroup view = (ViewGroup) friend_list_ll.getChildAt(i+1);
-            if(i/2 < size){
-                line.setVisibility(View.VISIBLE);
-                view.setVisibility(View.VISIBLE);
-//                if(i % 2 == 0)
-//                    view.setBackgroundColor(0xffF8F8F8);
-                int j = 0;
-                Friend friend = list.get(i/2);
-                TextView friend_item_id = (TextView) view.getChildAt(j++);
-                friend_item_id.setText(friend.getInvitation_code());
-                TextView friend_item_name = (TextView) view.getChildAt(j++);
-                friend_item_name.setText(TimeUtil.TimeStamp2Date(friend.getCreate_time(), "yyyy/MM/dd HH:mm"));
-                TextView friend_item_extract = (TextView) view.getChildAt(j++);
-                ViewUtil.setText(friend_item_extract, friend.getSource_page());
-                TextView friend_item_time = (TextView) view.getChildAt(j);
-                ViewUtil.setText(friend_item_time, friend.getAward_amount());
-            } else {
-                line.setVisibility(View.GONE);
-                view.setVisibility(View.GONE);
-            }
-            i += 2;
-        }
-        CommonUtil.getInstance().updateEmptyView(empty_view, list.isEmpty(), true);
-    }
-    private boolean isLoading = false;
-    private void initData(){
-        if(list.size() >= per_page || isLoading){
-            return;
-        }
-        isLoading = true;
-        list.clear();
-        SheepApp.getInstance().getNetComponent().getApiService().getUserFriendList(page, per_page)
-                .subscribeOn(Schedulers.io())
-                .observeOn(AndroidSchedulers.mainThread())
-                .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {
-                    @Override
-                    public void onNext(BaseMessage baseMessage) {
-                        List<Friend> friendList = baseMessage.getDatas(Friend.class);
-                        if(friendList == null) {
-//                            baseMessage.setMsg("您还没有邀请到好友");
-                            onError(baseMessage);
-                        } else {
-                            if (activity instanceof FgtAskGetMoneyFriend) {
-                                ((FgtAskGetMoneyFriend) activity).setFriendExtractCount(baseMessage.getTotal(), page, friendList.size());
-                            }
-                            list.addAll(friendList);
-                            notifyDataSetChanged();
-                            isLoading = false;
-                        }
-                    }
-
-                    @Override
-                    public void onError(BaseMessage baseMessage) {
-                        CommonUtil.getInstance().updateEmptyView(empty_view, list.isEmpty(), true);
-                        isLoading = false;
-                        if (activity instanceof FgtAskGetMoneyFriend) {
-                            ((FgtAskGetMoneyFriend) activity).updateByNoFriend();
-                        }
-                    }
-                });
-    }
-    public static FgtFriendExtractPage newInstance(int page) {
-        FgtFriendExtractPage friendExtractPage = new FgtFriendExtractPage();
-        friendExtractPage.page = page;
-        return friendExtractPage;
-    }
-
-    public List<Friend> getList() {
-        return list;
-    }
-
-    @Override
-    public void onDestroy() {
-        super.onDestroy();
-
-        if(EventBus.getDefault().isRegistered(this))
-            EventBus.getDefault().unregister(this);
-    }
-
-    @Subscribe
-    public void onEventMainThread(BigEvent event) {
-        switch (event.getEventTypes()) {
-            case ASK_GETMONEY_FRIEND_REFRESH:
-                initData();
-                break;
-        }
-    }
-}

+ 2 - 0
app/src/main/java/com/sheep/jiuyan/samllsheep/SheepApp.java

@@ -144,11 +144,13 @@ public class SheepApp extends MultiDexApplication {
 
     public void setConnectAddress(ConnectAddress connectAddress) {
         if (this.connectAddress != connectAddress) {
+            this.connectAddress = connectAddress;
             DataUtil.putAsString("flavor", connectAddress.name());
             if (activityRef != null && activityRef.get() != null) {
                 activityRef.get().finish();
             }
             quit();
+//            System.exit(0);
         } else {
             G.showToast("已经是该服务器");
         }

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

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

+ 2 - 3
app/src/main/res/layout/act_main.xml

@@ -4,11 +4,10 @@
     android:layout_width="match_parent"
     android:layout_height="match_parent">
 
-    <com.sheep.gamegroup.view.customview.WindowInsetsFrameLayout
-        android:id="@+id/frame_container"
+    <include layout="@layout/main_frame_layout"
         android:layout_width="match_parent"
         android:layout_height="match_parent"
-        android:layout_marginBottom="@dimen/bottom_height" />
+        android:layout_marginBottom="@dimen/bottom_height"/>
 
     <RelativeLayout
         android:layout_width="match_parent"

+ 38 - 3
app/src/main/res/layout/fgt_askgetmoney_friend.xml

@@ -21,17 +21,52 @@
 
     <include layout="@layout/x_ask_getmoney_act_layout_include" />
 
-    <com.kfzs.android.view.widget.WrapContentHeightViewPager
-        android:id="@+id/friend_extract_vp"
+    <LinearLayout
+        android:id="@+id/friend_list_ll"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:layout_marginTop="3dp" />
+        android:layout_centerInParent="true"
+        android:orientation="vertical">
+
+    </LinearLayout>
+
+    <RelativeLayout
+        android:id="@+id/empty_view"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:visibility="gone"
+        android:minHeight="200dp">
+
+        <ImageView
+            android:id="@+id/empty_view_img"
+            android:layout_width="wrap_content"
+            android:layout_height="80dp"
+            android:layout_centerHorizontal="true"
+            android:layout_marginTop="60dp"
+            android:gravity="center"
+            android:scaleType="centerInside"
+            android:src="@mipmap/wushuju"
+            android:visibility="visible" />
+
+        <TextView
+            android:id="@+id/empty_view_msg"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_below="@id/empty_view_img"
+            android:layout_centerHorizontal="true"
+            android:layout_marginTop="@dimen/content_padding_5"
+            android:text="@string/wushuju"
+            android:textColor="#ffffff"
+            android:textSize="15sp" />
+    </RelativeLayout>
 
     <LinearLayout
+        android:id="@+id/pager_view"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:layout_marginTop="@dimen/content_padding_10"
         android:gravity="center"
+        android:visibility="gone"
         android:orientation="horizontal">
 
         <TextView

+ 0 - 78
app/src/main/res/layout/friend_list.xml

@@ -1,78 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:id="@+id/friend_list_ll"
-    android:layout_width="match_parent"
-    android:layout_height="wrap_content"
-    android:layout_centerInParent="true"
-    android:orientation="vertical">
-
-    <View
-        android:layout_width="match_parent"
-        android:layout_height="1dp"
-        android:layout_marginTop="@dimen/dp_10"
-        android:layout_marginBottom="@dimen/dp_10"
-        android:layout_marginStart="@dimen/content_padding_10"
-        android:layout_marginEnd="@dimen/content_padding_10"
-        android:background="#4cF5F5F5"
-        android:visibility="gone" />
-
-    <include
-        layout="@layout/x_ask_getmoney_act_layout_item"
-        android:visibility="gone" />
-
-    <View
-        android:layout_width="match_parent"
-        android:layout_height="1dp"
-        android:layout_marginTop="@dimen/dp_10"
-        android:layout_marginBottom="@dimen/dp_10"
-        android:layout_marginStart="@dimen/content_padding_10"
-        android:layout_marginEnd="@dimen/content_padding_10"
-        android:background="#4cF5F5F5"
-        android:visibility="gone" />
-
-    <include
-        layout="@layout/x_ask_getmoney_act_layout_item"
-        android:visibility="gone" />
-
-    <View
-        android:layout_width="match_parent"
-        android:layout_height="1dp"
-        android:layout_marginTop="@dimen/dp_10"
-        android:layout_marginBottom="@dimen/dp_10"
-        android:layout_marginStart="@dimen/content_padding_10"
-        android:layout_marginEnd="@dimen/content_padding_10"
-        android:background="#4cF5F5F5"
-        android:visibility="gone" />
-
-    <include
-        layout="@layout/x_ask_getmoney_act_layout_item"
-        android:visibility="gone" />
-
-    <View
-        android:layout_width="match_parent"
-        android:layout_height="1dp"
-        android:layout_marginTop="@dimen/dp_10"
-        android:layout_marginBottom="@dimen/dp_10"
-        android:layout_marginStart="@dimen/content_padding_10"
-        android:layout_marginEnd="@dimen/content_padding_10"
-        android:background="#4cF5F5F5"
-        android:visibility="gone" />
-
-    <include
-        layout="@layout/x_ask_getmoney_act_layout_item"
-        android:visibility="gone" />
-
-    <View
-        android:layout_width="match_parent"
-        android:layout_height="1dp"
-        android:layout_marginTop="@dimen/dp_10"
-        android:layout_marginBottom="@dimen/dp_10"
-        android:layout_marginStart="@dimen/content_padding_10"
-        android:layout_marginEnd="@dimen/content_padding_10"
-        android:background="#4cF5F5F5"
-        android:visibility="gone" />
-
-    <include
-        layout="@layout/x_ask_getmoney_act_layout_item"
-        android:visibility="gone" />
-</LinearLayout>

+ 0 - 39
app/src/main/res/layout/friend_list_empty.xml

@@ -1,39 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="match_parent"
-    android:layout_height="wrap_content"
-    android:layout_centerInParent="true"
-    android:orientation="vertical">
-
-    <RelativeLayout
-        android:id="@+id/empty_view"
-        android:layout_width="match_parent"
-        android:layout_height="match_parent"
-        android:minHeight="200dp"
-        android:visibility="gone">
-
-        <ImageView
-            android:id="@+id/empty_view_img"
-            android:layout_width="wrap_content"
-            android:layout_height="80dp"
-            android:layout_centerHorizontal="true"
-            android:layout_marginTop="60dp"
-            android:gravity="center"
-            android:scaleType="centerInside"
-            android:src="@mipmap/wushuju"
-            android:visibility="visible" />
-
-        <TextView
-            android:id="@+id/empty_view_msg"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_below="@id/empty_view_img"
-            android:layout_centerHorizontal="true"
-            android:layout_marginTop="@dimen/content_padding_5"
-            android:text="@string/wushuju"
-            android:textColor="#ffffff"
-            android:textSize="15sp" />
-    </RelativeLayout>
-
-    <include layout="@layout/friend_list" />
-</LinearLayout>

+ 5 - 0
app/src/main/res/layout/main_frame_layout.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" />

+ 9 - 0
app/src/main/res/layout/separetor_margin_13.xml

@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<View xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="1dp"
+    android:layout_marginTop="@dimen/dp_10"
+    android:layout_marginBottom="@dimen/dp_10"
+    android:layout_marginStart="@dimen/content_padding_10"
+    android:layout_marginEnd="@dimen/content_padding_10"
+    android:background="#4cF5F5F5" />

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

@@ -10,7 +10,7 @@
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:orientation="vertical"
-        android:layout_marginTop="60dp"
+        android:layout_marginTop="44dp"
         android:background="@color/white"
         android:paddingBottom="10dp">
 

+ 4 - 0
app/src/main/res/layout/x_ask_getmoney_act_layout_item.xml

@@ -5,6 +5,7 @@
     android:gravity="center_vertical"
     android:orientation="horizontal">
     <TextView
+        android:id="@+id/sheep_no_view"
         android:layout_width="0dp"
         android:layout_height="26dp"
         android:layout_marginStart="@dimen/content_padding_10"
@@ -15,6 +16,7 @@
         android:textColor="#ffffff"
         android:text="绵羊ID"/>
     <TextView
+        android:id="@+id/register_time_view"
         android:layout_width="0dp"
         android:layout_height="26dp"
         android:layout_weight="6"
@@ -24,6 +26,7 @@
         android:textColor="#ffffff"
         android:text="好友昵称"/>
     <TextView
+        android:id="@+id/source_page_view"
         android:layout_width="0dp"
         android:layout_height="26dp"
         android:layout_weight="3"
@@ -33,6 +36,7 @@
         android:textColor="#ffffff"
         android:text="获得奖励金"/>
     <TextView
+        android:id="@+id/award_view"
         android:layout_width="0dp"
         android:layout_height="26dp"
         android:layout_weight="3"