zengjiebin 7 lat temu
rodzic
commit
06026eb94e
41 zmienionych plików z 165 dodań i 2899 usunięć
  1. 1 4
      app/src/main/AndroidManifest.xml
  2. 0 98
      app/src/main/java/com/kfzs/duanduan/ActPicturesEnlarge.java
  3. 11 9
      app/src/main/java/com/kfzs/duanduan/ActSearch.java
  4. 9 6
      app/src/main/java/com/kfzs/duanduan/BaseCompatFragment.java
  5. 5 5
      app/src/main/java/com/kfzs/duanduan/bll/GameListBll.java
  6. 0 146
      app/src/main/java/com/kfzs/duanduan/db/UserGraphUtils.java
  7. 7 4
      app/src/main/java/com/kfzs/duanduan/fragment/CategoryRankFragment.java
  8. 23 22
      app/src/main/java/com/kfzs/duanduan/fragment/FgtGameDetail.java
  9. 3 2
      app/src/main/java/com/kfzs/duanduan/fragment/FgtSmallSheep.java
  10. 0 144
      app/src/main/java/com/kfzs/duanduan/fragment/PictureViewPagerAdapter.java
  11. 11 4
      app/src/main/java/com/kfzs/duanduan/oem/AppAddOrdelReceiver.java
  12. 5 2
      app/src/main/java/com/kfzs/duanduan/react/upfile/UpFileUtils.java
  13. 0 83
      app/src/main/java/com/kfzs/duanduan/utils/PermissionUtils.java
  14. 0 1463
      app/src/main/java/com/kfzs/duanduan/utils/dlg/CropImageView.java
  15. 3 20
      app/src/main/java/com/kfzs/duanduan/utils/dlg/HelperUtils.java
  16. 0 135
      app/src/main/java/com/kfzs/duanduan/utils/sys/HomeListenByBroadcast.java
  17. 0 655
      app/src/main/java/com/kfzs/duanduan/view/ArrowDownloadButton.java
  18. 11 0
      app/src/main/java/com/sheep/gamegroup/util/ConnectAddress.java
  19. 18 6
      app/src/main/java/com/sheep/gamegroup/util/Jump2View.java
  20. 9 0
      app/src/main/java/com/sheep/gamegroup/util/ListUtil.java
  21. 2 2
      app/src/main/java/com/sheep/gamegroup/util/TestUtil.java
  22. 7 7
      app/src/main/java/com/sheep/gamegroup/view/activity/ActInstallApkList.java
  23. 1 1
      app/src/main/java/com/sheep/gamegroup/view/activity/GamemakeMoneyAct.java
  24. 1 1
      app/src/main/java/com/sheep/gamegroup/view/activity/SplashAct.java
  25. 1 1
      app/src/main/java/com/sheep/gamegroup/view/activity/TaskDetailAct.java
  26. 1 1
      app/src/main/java/com/sheep/gamegroup/view/activity/TryMakeMoneyact.java
  27. 1 1
      app/src/main/java/com/sheep/gamegroup/view/adapter/ArrayAdapter.java
  28. 1 1
      app/src/main/java/com/sheep/gamegroup/view/adapter/TryMakeMoneyAdp.java
  29. 2 2
      app/src/main/java/com/sheep/gamegroup/view/adapter/expandadapter/BaseViewHolder.java
  30. 4 4
      app/src/main/java/com/sheep/gamegroup/view/adapter/expandadapter/SignRecordViewHolder.java
  31. 3 3
      app/src/main/java/com/sheep/gamegroup/view/dialog/DialogOrienteeringDetails.java
  32. 2 8
      app/src/main/java/com/sheep/jiuyan/samllsheep/SheepApp.java
  33. 8 0
      app/src/main/res/drawable/shape_ash_stroke_rectangle_small.xml
  34. 5 5
      app/src/main/res/layout/homepage_act_layout.xml
  35. 3 3
      app/src/main/res/layout/splash_activity.xml
  36. 0 1
      app/src/main/res/layout/withdrawal_layout.xml
  37. 0 41
      app/src/main/res/values/dd_view_style.xml
  38. 1 1
      app/src/main/res/values/gamegroup_string.xml
  39. 0 1
      app/src/main/res/values/str_menu_strings.xml
  40. 6 1
      app/src/main/res/values/str_network_strings.xml
  41. 0 6
      app/src/main/res/values/strings.xml

+ 1 - 4
app/src/main/AndroidManifest.xml

@@ -204,8 +204,8 @@
             android:screenOrientation="portrait"
             android:theme="@style/AppTheme"
             android:windowSoftInputMode="adjustPan|stateHidden">
-            <category android:name="android.intent.category.DEFAULT" />
             <intent-filter>
+                <category android:name="android.intent.category.DEFAULT" />
                 <action android:name="android.intent.action.VIEW" />
             </intent-filter>
         </activity>
@@ -218,9 +218,6 @@
             android:name="com.kfzs.duanduan.ActGameDetails"
             android:screenOrientation="portrait" />
         <activity
-            android:name="com.kfzs.duanduan.ActPicturesEnlarge"
-            android:screenOrientation="portrait" />
-        <activity
             android:name="com.kfzs.duanduan.ActGategoryRank"
             android:screenOrientation="portrait" />
 

+ 0 - 98
app/src/main/java/com/kfzs/duanduan/ActPicturesEnlarge.java

@@ -1,98 +0,0 @@
-package com.kfzs.duanduan;
-
-import android.os.Bundle;
-import android.support.annotation.Nullable;
-import android.support.v4.view.ViewPager;
-import android.widget.TextView;
-
-import com.kfzs.duanduan.bean.KFIntentKeys;
-import com.kfzs.duanduan.fragment.PictureViewPagerAdapter;
-import com.kfzs.duanduan.view.DepthPageTransformer;
-import com.sheep.jiuyan.samllsheep.R;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import butterknife.BindView;
-import butterknife.ButterKnife;
-
-/**
- * Created by HooRang on 2017/3/22.
- */
-public class ActPicturesEnlarge extends BaseCompatActivity {
-
-    private Bundle extras;
-
-    @BindView(R.id.picture_enlarge_viewpager)
-    ViewPager vpPictureEnlarge;
-
-    @BindView(R.id.picture_enlarge_label)
-    TextView tvLabel;
-
-    Map<Integer, String> mUrlCollections;
-    int iCurrentItem = 1;
-
-    PictureViewPagerAdapter picViewPagerAdapter;
-
-    @Override
-    protected void onCreate(@Nullable Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-        setContentView(R.layout.activity_picture_enlarge);
-        ButterKnife.bind(this);
-
-        extras = getIntent().getExtras();
-        if(extras == null) {
-            finish();
-            return;
-        }
-        String imgs = null;
-        if((imgs = extras.getString("imgs")) != null){
-            String[] items = imgs.split(";");
-            mUrlCollections = new HashMap<>();
-            for (int i = 0; i < items.length; i++) {
-                mUrlCollections.put(i,items[i]);
-            }
-        } else {
-            mUrlCollections = (Map<Integer, String>) extras.getSerializable(KFIntentKeys.EXTRA_CURRENT_PICTURE_COLLECTIONS);
-        }
-        iCurrentItem = extras.getInt(KFIntentKeys.EXTRA_CURRENT_PICTURE_INDEX);
-
-        initActivityUI();
-
-    }
-
-
-    private void initActivityUI() {
-        tvLabel.setText(formatLabel(iCurrentItem + 1));
-
-        picViewPagerAdapter = new PictureViewPagerAdapter(this, mUrlCollections, PictureViewPagerAdapter.ViewPagerOpenModel.PICTURE_ENLARGE);
-        vpPictureEnlarge.setOffscreenPageLimit(mUrlCollections.size());
-        vpPictureEnlarge.setPageMargin(15);
-        vpPictureEnlarge.setAdapter(picViewPagerAdapter);
-        picViewPagerAdapter.setmIntFirstShowPos(iCurrentItem);
-        vpPictureEnlarge.setPageTransformer(true, new DepthPageTransformer());
-
-
-        vpPictureEnlarge.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
-            @Override
-            public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
-
-            }
-
-            @Override
-            public void onPageSelected(int position) {
-                tvLabel.setText(formatLabel(position + 1));
-            }
-
-            @Override
-            public void onPageScrollStateChanged(int state) {
-            }
-        });
-
-    }
-
-    private String formatLabel(int iCurrentIndex) {
-        return iCurrentIndex + "/" + (mUrlCollections == null ? 0 : mUrlCollections.size());
-    }
-
-}

+ 11 - 9
app/src/main/java/com/kfzs/duanduan/ActSearch.java

@@ -277,7 +277,8 @@ public class ActSearch extends BaseCompatActivity {
         mEdtKeyWord.setFocusableInTouchMode(true);
         mEdtKeyWord.requestFocus();
         InputMethodManager imm = (InputMethodManager) this.getSystemService(Context.INPUT_METHOD_SERVICE);
-        imm.showSoftInput(mEdtKeyWord, 0);
+        if(imm != null)
+            imm.showSoftInput(mEdtKeyWord, 0);
     }
 
 
@@ -319,8 +320,11 @@ public class ActSearch extends BaseCompatActivity {
             @Override
             public boolean onKey(View v, int keyCode, KeyEvent event) {
                 if (keyCode == KeyEvent.KEYCODE_ENTER) {
-                    ((InputMethodManager) getSystemService(INPUT_METHOD_SERVICE))
-                            .hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
+                    Object imm = getSystemService(INPUT_METHOD_SERVICE);
+                    View focus = getCurrentFocus();
+                    if(imm instanceof InputMethodManager && focus != null) {
+                        ((InputMethodManager) imm).hideSoftInputFromWindow(focus.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
+                    }
                     doQueryTask(mEdtKeyWord.getText().toString());
                 }
                 return false;
@@ -368,12 +372,10 @@ public class ActSearch extends BaseCompatActivity {
     public void onClick(View v) {
         switch (v.getId()) {
             case R.id.ibtn_act_serach:
-
-                try {
-                    ((InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE))
-                            .hideSoftInputFromWindow(this.getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
-                } catch (Exception e) {
-                    e.printStackTrace();
+                Object imm = getSystemService(INPUT_METHOD_SERVICE);
+                View focus = getCurrentFocus();
+                if(imm instanceof InputMethodManager && focus != null) {
+                    ((InputMethodManager) imm).hideSoftInputFromWindow(focus.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
                 }
                 this.finish();
                 break;

+ 9 - 6
app/src/main/java/com/kfzs/duanduan/BaseCompatFragment.java

@@ -72,13 +72,16 @@ public abstract class BaseCompatFragment extends Fragment {
         super.onCreate(savedInstanceState);
         if (savedInstanceState != null) {
             boolean isSupportHidden = savedInstanceState.getBoolean(STATE_SAVE_IS_HIDDEN);
-            FragmentTransaction ft = getFragmentManager().beginTransaction();
-            if (isSupportHidden) {
-                ft.hide(this);
-            } else {
-                ft.show(this);
+            FragmentManager fragmentmanager = getFragmentManager();
+            if(fragmentmanager != null) {
+                FragmentTransaction ft = fragmentmanager.beginTransaction();
+                if (isSupportHidden) {
+                    ft.hide(this);
+                } else {
+                    ft.show(this);
+                }
+                ft.commitAllowingStateLoss();
             }
-            ft.commitAllowingStateLoss();
         }
     }
 

+ 5 - 5
app/src/main/java/com/kfzs/duanduan/bll/GameListBll.java

@@ -41,7 +41,7 @@ public class GameListBll {
 
         APIRequestV2 apiRequestV2 = APIRequestInstance.getReqUrlV2("getNewGameRecommendList",
                 UrlBll.V2.NEW_GAME_RECOMMEND, hashMap, listener,
-                HelperUtils.makeErr(KFZSApp.context.getString(R.string.network_conf_network)));
+                HelperUtils.makeErr(KFZSApp.context.getString(R.string.error_package_link)));
         KFZSNetwork.addRequest(apiRequestV2);
     }
 
@@ -54,7 +54,7 @@ public class GameListBll {
     public void getGuessYouLike(Response.Listener<BaseMsg> listener) {
         APIRequestV2 apiRequestV2 = APIRequestInstance.getReqUrlV2("getGuessYouLike",
                 UrlBll.V2.GUESS_YOU_LIKE, null, listener,
-                HelperUtils.makeErr(KFZSApp.context.getString(R.string.network_conf_network)));
+                HelperUtils.makeErr(KFZSApp.context.getString(R.string.unknown_error)));
         KFZSNetwork.addRequest(apiRequestV2);
     }
 
@@ -67,7 +67,7 @@ public class GameListBll {
     public void getSpecialRecommend(Response.Listener<BaseMsg> listener) {
         APIRequestV2 apiRequestV2 = APIRequestInstance.getReqUrlV2("getSpecialRecommend",
                 UrlBll.V2.SPECIAL_RECOMMEND, null, listener,
-                HelperUtils.makeErr(KFZSApp.context.getString(R.string.network_conf_network)));
+                HelperUtils.makeErr(KFZSApp.context.getString(R.string.unknown_error)));
         KFZSNetwork.addRequest(apiRequestV2);
     }
 
@@ -80,7 +80,7 @@ public class GameListBll {
     public void getCartonRPGEtc(Response.Listener<BaseMsg> listener) {
         APIRequestV2 apiRequestV2 = APIRequestInstance.getReqUrlV2("getSpecialRecommend",
                 UrlBll.V2.CATE_RECOMMEND, null, listener,
-                HelperUtils.makeErr(KFZSApp.context.getString(R.string.network_conf_network)));
+                HelperUtils.makeErr(KFZSApp.context.getString(R.string.unknown_error)));
         KFZSNetwork.addRequest(apiRequestV2);
     }
 
@@ -92,7 +92,7 @@ public class GameListBll {
     public void getNewGameBook(Response.Listener<BaseMsg> listener) {
         APIRequestV2 apiRequestV2 = APIRequestInstance.getReqUrlV2("getSpecialRecommend",
                 UrlBll.V2.NEW_GAME_BOOK, null, listener,
-                HelperUtils.makeErr(KFZSApp.context.getString(R.string.network_conf_network)));
+                HelperUtils.makeErr(KFZSApp.context.getString(R.string.unknown_error)));
         KFZSNetwork.addRequest(apiRequestV2);
     }
 }

+ 0 - 146
app/src/main/java/com/kfzs/duanduan/db/UserGraphUtils.java

@@ -1,146 +0,0 @@
-package com.kfzs.duanduan.db;
-
-import android.content.ContentResolver;
-import android.content.Context;
-
-import com.kfzs.duanduan.KFZSApp;
-import com.kfzs.duanduan.data.graph.provider.player.User;
-import com.kfzs.duanduan.data.graph.provider.user.UserBean;
-import com.kfzs.duanduan.data.graph.provider.user.UserContentValues;
-import com.kfzs.duanduan.data.graph.provider.user.UserCursor;
-import com.kfzs.duanduan.data.graph.provider.user.UserSelection;
-import com.kfzs.duanduan.datashare.DDProviderHelper;
-import com.kfzs.duanduan.datashare.KFZSDDContentSession;
-import com.kfzs.duanduan.proto.UserOuterClass;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * <pre>
- *     sinlov
- *
- *     /\__/\
- *    /`    '\
- *  ≈≈≈ 0  0 ≈≈≈ Hello world!
- *    \  --  /
- *   /        \
- *  /          \
- * |            |
- *  \  ||  ||  /
- *   \_oo__oo_/≡≡≡≡≡≡≡≡o
- *
- * </pre>
- * Created by sinlov on 17/3/24.
- */
-public class UserGraphUtils {
-
-    public static UserBean saveNewUserGraph(UserOuterClass.User user) {
-        KFZSDDContentSession session = KFZSDDContentSession.getInstance();
-        KFZSApp app = KFZSApp.getInstance();
-        boolean hasHeadSession = session.isHasHeadSession(app);
-        if (hasHeadSession) {
-//            SessionBean outHeadSession = session.findOutHeadSession(app);
-//            String userName = outHeadSession.getAccount();
-            String userName = user.getName();
-            UserBean userBean = new UserBean();
-            int id = user.getId();
-            String nickname = user.getNickname();
-            String phone = user.getPhone();
-            String openId = user.getOpenId();
-            String avatar = user.getAvatar();
-            long updateTime = System.currentTimeMillis();
-            userBean.setUid(id);
-            userBean.setUserName(userName);
-            userBean.setNickname(nickname);
-            userBean.setPhone(phone);
-            userBean.setOpenId(openId);
-            userBean.setUpdateTime(updateTime);
-            userBean.setAvatar(avatar);
-            insertOrUpdateHeadUser(app, userBean);
-
-            //TODO 两套USER系统,带来的问题太多了。
-            User user1=new User();
-            user1.setMMobile(phone);
-            user1.setMOpenId(openId);
-            user1.setMAvatar(avatar);
-            user1.setMNickName(nickname);
-            user1.setMUserId(""+id);
-            user1.setMUserName(userName);
-            user1.setMVipType(user.getVipType());
-            user1.setMUpdateTime(updateTime+"");
-            user1.setMToken(session.findOutHeadSession(app).getToken());
-            DDProviderHelper.getInstance().addOrUpdateUser(KFZSApp.getInstance(),user1);
-            return userBean;
-        } else {
-            return null;
-        }
-    }
-
-    public static void insertOrUpdateHeadUser(Context ctx, UserBean userBean) {
-        String userName = userBean.getUserName();
-        UserContentValues userContentValues = new UserContentValues();
-        userContentValues.putUid(userBean.getUid());
-        userContentValues.putUserName(userName);
-        long nowTime = System.currentTimeMillis();
-        userContentValues.putUpdateTime(nowTime);
-        userContentValues.putPhone(userBean.getPhone());
-        userContentValues.putNickname(userBean.getNickname());
-        userContentValues.putUserIcon(userBean.getUserIcon());
-        userContentValues.putAvatar(userBean.getAvatar());
-        userContentValues.putOpenId(userBean.getOpenId());
-        userContentValues.putMail(userBean.getMail());
-        userContentValues.putRefreshToken(userBean.getRefreshToken());
-        UserSelection where = new UserSelection();
-        where.orderByUpdateTime(false);
-        ContentResolver contentResolver = ctx.getContentResolver();
-        UserCursor query = where.query(contentResolver);
-        if (query == null) {
-        }
-        query.moveToNext();
-//        ALog.d("Count user name:  " + query.getCount());
-        if (query.getCount() > -1) {
-            contentResolver.insert(userContentValues.uri(), userContentValues.values());
-//            ALog.d("insert first user name: " + userName);
-        }
-        query.close();
-    }
-
-    public static List<UserBean> checkOutFullUser(Context ctx) {
-        ContentResolver contentResolver = ctx.getContentResolver();
-        UserSelection userSelection = new UserSelection();
-        userSelection.orderByUpdateTime(true);
-        UserCursor query = userSelection.query(contentResolver);
-        if (query == null) {
-        }
-        ArrayList outList = new ArrayList();
-
-        while (query.moveToNext()) {
-            com.kfzs.duanduan.data.graph.provider.user.UserBean userBean = new com.kfzs.duanduan.data.graph.provider.user.UserBean();
-            userBean.setUid(query.getUid());
-            userBean.setUserName(query.getUserName());
-            userBean.setUpdateTime(query.getUpdateTime());
-            userBean.setPhone(query.getPhone());
-            userBean.setNickname(query.getNickname());
-            userBean.setUserIcon(query.getUserIcon());
-            userBean.setAvatar(query.getAvatar());
-            userBean.setOpenId(query.getOpenId());
-            userBean.setMail(query.getMail());
-            userBean.setRefreshToken(query.getRefreshToken());
-            outList.add(userBean);
-        }
-
-        query.close();
-        return outList;
-    }
-
-    public static int removeByUid(Context ctx, int... uid) {
-        UserSelection where = new UserSelection();
-        ContentResolver contentResolver = ctx.getContentResolver();
-        where.uid(uid);
-        return where.delete(contentResolver);
-    }
-
-    private UserGraphUtils() {
-    }
-}

+ 7 - 4
app/src/main/java/com/kfzs/duanduan/fragment/CategoryRankFragment.java

@@ -1,5 +1,6 @@
 package com.kfzs.duanduan.fragment;
 
+import android.app.Activity;
 import android.os.Bundle;
 import android.support.v7.widget.LinearLayoutManager;
 import android.support.v7.widget.RecyclerView;
@@ -53,8 +54,10 @@ public class CategoryRankFragment extends BaseCompatFragment {
     private EventDownloadHandler.OnDownCallback mOnDownCallback;
     private int gameType = 0;
 
+    private Activity activity;
     @Override
     protected void initView(Bundle savedInstanceState) {
+        activity = getActivity();
         EventBus.getDefault().register(this);
 
         setContentView(R.layout.fragment_game_lists_common);
@@ -66,10 +69,10 @@ public class CategoryRankFragment extends BaseCompatFragment {
         mRecyclerView = ViewFindUtils.find(mContentView, R.id.recy_fgt_main_game);
         //隐藏空空如也
         ViewFindUtils.find(mContentView, R.id.download_mgr_empty_view).setVisibility(View.GONE);
-        mAdpFragmentRank = new AdpFragmentRank(getActivity(), mRecyclerView, ClsTypeChoose);
+        mAdpFragmentRank = new AdpFragmentRank(activity, mRecyclerView, ClsTypeChoose);
 
-        mRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
-        DividerItemDecoration decor = new DividerItemDecoration(getActivity(), DividerItemDecoration.VERTICAL);
+        mRecyclerView.setLayoutManager(new LinearLayoutManager(activity));
+        DividerItemDecoration decor = new DividerItemDecoration(activity, DividerItemDecoration.VERTICAL);
         decor.setIsShowFirstItemDecoration(false);
         decor.setSize(getResources().getDimensionPixelOffset(R.dimen.app_list_item_divider_size));
         decor.setColor(getResources().getColor(R.color.theme_app_divider_color));
@@ -189,7 +192,7 @@ public class CategoryRankFragment extends BaseCompatFragment {
             mOnDownCallback = DownBtnUtils.installBtnStatus(mAdpFragmentRank.getmDownLoadItemLogicMgrMap());
         }
         EventDownloadHandler
-                .newInstance(getActivity(), mOnDownCallback)
+                .newInstance(activity, mOnDownCallback)
                 .setmTag(TAG)
                 .handlDownloadResult(info);
     }

+ 23 - 22
app/src/main/java/com/kfzs/duanduan/fragment/FgtGameDetail.java

@@ -1,41 +1,42 @@
 package com.kfzs.duanduan.fragment;
 
-import android.content.Intent;
+import android.app.Activity;
 import android.os.Bundle;
 import android.support.annotation.Nullable;
 import android.support.v7.widget.LinearLayoutManager;
 import android.support.v7.widget.RecyclerView;
+import android.text.TextUtils;
 import android.view.View;
 import android.widget.ImageView;
 import android.widget.TextView;
 
 import com.android.volleyplus.Response;
 import com.bumptech.glide.Glide;
-import com.kfzs.duanduan.view.KFProgressButton;
 import com.kfzs.appstore.utils.adapter.recyclerview.RecyclerViewAdapter;
 import com.kfzs.appstore.utils.adapter.recyclerview.ViewHolder;
 import com.kfzs.appstore.utils.restful.KFZSNetwork;
-import com.sheep.jiuyan.samllsheep.R;
+import com.kfzs.duanduan.BaseCompatFragment;
 import com.kfzs.duanduan.bean.DownloadStatus;
-import com.kfzs.duanduan.utils.InstallButtonUtils;
 import com.kfzs.duanduan.bean.KFIntentKeys;
 import com.kfzs.duanduan.bll.UrlBll;
 import com.kfzs.duanduan.event.EventDownloadHandler;
 import com.kfzs.duanduan.proto.ApiResponseOuterClass;
 import com.kfzs.duanduan.proto.GameOuterClass;
+import com.kfzs.duanduan.utils.InstallButtonUtils;
 import com.kfzs.duanduan.utils.dlg.DownBtnUtils;
 import com.kfzs.duanduan.utils.dlg.HelperUtils;
 import com.kfzs.duanduan.utils.dlg.SkipUtils;
 import com.kfzs.duanduan.utils.net.APIRequest;
 import com.kfzs.duanduan.utils.net.APIRequestInstance;
-import com.kfzs.duanduan.ActPicturesEnlarge;
-import com.kfzs.duanduan.BaseCompatFragment;
+import com.kfzs.duanduan.view.KFProgressButton;
+import com.sheep.gamegroup.util.Jump2View;
+import com.sheep.jiuyan.samllsheep.R;
 
 import org.greenrobot.eventbus.EventBus;
 import org.greenrobot.eventbus.Subscribe;
 
-import java.io.Serializable;
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -82,8 +83,10 @@ public class FgtGameDetail extends BaseCompatFragment {
         EventBus.getDefault().unregister(this);
     }
 
+    private Activity activity;
     @Override
     protected void initView(Bundle savedInstanceState) {
+        activity = getActivity();
         setContentView(R.layout.fgt_game_detail);
         initViewById();
         getGsGame();
@@ -103,7 +106,7 @@ public class FgtGameDetail extends BaseCompatFragment {
      * guess the fuck games;
      */
     private void getGsGame() {
-        String gameId = getActivity().getIntent().getStringExtra(KFIntentKeys.EXTRA_GAME_ID);
+        String gameId = activity.getIntent().getStringExtra(KFIntentKeys.EXTRA_GAME_ID);
         //        http://10.8.210.223:8081/test/game/guess?game_id=125
         String url = UrlBll.GameApi.GAME_GUESS + "game_id=" + gameId;
 
@@ -153,7 +156,7 @@ public class FgtGameDetail extends BaseCompatFragment {
     private View.OnClickListener guessYouLikeLisener = new View.OnClickListener() {
         @Override
         public void onClick(View v) {
-            SkipUtils.getInstance().goGameDetails(getActivity(), (int) v.getTag(R.id.view_tag_game_icon));
+            SkipUtils.getInstance().goGameDetails(activity, (int) v.getTag(R.id.view_tag_game_icon));
         }
     };
 
@@ -179,18 +182,16 @@ public class FgtGameDetail extends BaseCompatFragment {
     }
 
     //设置数据;
-    public void setData(GameOuterClass.Game game) {
-        String[] urls = game.getDetailImage().split("&&");
-        List<String> mUrls = new ArrayList<>();
-        final HashMap<Integer, String> mUrlsCollection = new HashMap<>();
-        for (int i = 0; i < urls.length; i++) {
-            mUrls.add(urls[i]);
-            mUrlsCollection.put(i, urls[i]);
+    public void setData(final GameOuterClass.Game game) {
+        if(game == null){
+            return;
         }
-
+        String[] urls = game.getDetailImage().split("&&");
+        final ArrayList<String> urlList = new ArrayList<>();
+        Collections.addAll(urlList, urls);
         if (mGameDesc != null)
             mGameDesc.setText(game.getIntroduce());
-        mRecyclerViewAdapter = new RecyclerViewAdapter<String>(getContext(), R.layout.item_image, mUrls) {
+        mRecyclerViewAdapter = new RecyclerViewAdapter<String>(getContext(), R.layout.item_image, urlList) {
             @Override
             public void convert(ViewHolder viewHolder, String url, final int position) {
                 View view = viewHolder.getView(R.id.img_detail);
@@ -199,10 +200,10 @@ public class FgtGameDetail extends BaseCompatFragment {
                     view.setOnClickListener(new View.OnClickListener() {
                         @Override
                         public void onClick(View v) {
-                            Intent picEnlargeIntent = new Intent(getActivity(), ActPicturesEnlarge.class);
-                            picEnlargeIntent.putExtra(KFIntentKeys.EXTRA_CURRENT_PICTURE_INDEX, (position));
-                            picEnlargeIntent.putExtra(KFIntentKeys.EXTRA_CURRENT_PICTURE_COLLECTIONS, mUrlsCollection);
-                            getActivity().startActivity(picEnlargeIntent);
+                            if(TextUtils.isEmpty(game.getDetailImage())){
+                               return;
+                            }
+                            Jump2View.getInstance().showImgList(activity, position, urlList);
                         }
                     });
                 }

+ 3 - 2
app/src/main/java/com/kfzs/duanduan/fragment/FgtSmallSheep.java

@@ -620,7 +620,7 @@ public class FgtSmallSheep extends BaseCompatFragment implements SmallSheepContr
 
     @Override
     public void showMore(final List<MoreDataEntity> loginEty) {
-        getActivity().runOnUiThread(new Runnable() {
+        activity.runOnUiThread(new Runnable() {
             @Override
             public void run() {
                 setViews(loginEty);
@@ -856,7 +856,8 @@ public class FgtSmallSheep extends BaseCompatFragment implements SmallSheepContr
     public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
         // TODO: inflate a fragment view
         View rootView = super.onCreateView(inflater, container, savedInstanceState);
-        unbinder = ButterKnife.bind(this, rootView);
+        if(rootView != null)
+            unbinder = ButterKnife.bind(this, rootView);
         return rootView;
     }
 

+ 0 - 144
app/src/main/java/com/kfzs/duanduan/fragment/PictureViewPagerAdapter.java

@@ -1,144 +0,0 @@
-package com.kfzs.duanduan.fragment;
-
-import android.app.Activity;
-import android.content.Intent;
-import android.support.v4.view.PagerAdapter;
-import android.support.v4.view.ViewPager;
-import android.view.Gravity;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.ImageView;
-import android.widget.LinearLayout;
-import android.widget.RelativeLayout;
-
-import com.bumptech.glide.Glide;
-import com.bumptech.glide.load.engine.DiskCacheStrategy;
-import com.bumptech.glide.request.RequestOptions;
-import com.kfzs.duanduan.ActPicturesEnlarge;
-import com.sheep.jiuyan.samllsheep.R;
-import com.kfzs.duanduan.bean.KFIntentKeys;
-
-import java.io.Serializable;
-import java.util.Map;
-
-/**
- * Created by HooRang on 2017/2/16.
- */
-public class PictureViewPagerAdapter extends PagerAdapter {
-
-    public enum ViewPagerOpenModel {
-        GAME_DETAILS,
-        PICTURE_ENLARGE
-    }
-
-    private int mIntFirstShowPos = 0;
-    private Activity that;
-    public ViewPagerOpenModel openModel;
-    private Map<Integer, String> mUrlsCollection;
-
-    public int getmIntFirstShowPos() {
-        return mIntFirstShowPos;
-    }
-
-    public void setmIntFirstShowPos(int mIntFirstShowPos) {
-        this.mIntFirstShowPos = mIntFirstShowPos;
-    }
-
-    public PictureViewPagerAdapter(Activity ctx, Map<Integer, String> gameUrls, ViewPagerOpenModel model) {
-        this.that = ctx;
-        this.mUrlsCollection = gameUrls;
-        this.openModel = model;
-    }
-
-    @Override
-    public int getCount() {
-        return mUrlsCollection.size();
-    }
-
-    @Override
-    public boolean isViewFromObject(View view, Object object) {
-        return (view == object);
-    }
-
-
-    @Override
-    public void destroyItem(ViewGroup container, int position, Object object) {
-        super.destroyItem(container, position, object);
-        container.removeView((View) object);
-    }
-
-
-    @Override
-    public Object instantiateItem(ViewGroup container, final int position) {
-
-        ImageView ivChildItem = new ImageView(that);
-        View child = null;
-        if (openModel == ViewPagerOpenModel.GAME_DETAILS) {
-            LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
-                    LinearLayout.LayoutParams.MATCH_PARENT,
-                    LinearLayout.LayoutParams.MATCH_PARENT);
-            lp.gravity = Gravity.CENTER;
-            ivChildItem.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
-            ivChildItem.setLayoutParams(lp);
-
-            Glide.with(that)
-                    .load(mUrlsCollection.get(position))
-                    .apply(new RequestOptions().placeholder(R.drawable.loading)
-                    .diskCacheStrategy(DiskCacheStrategy.ALL))
-                    .into(ivChildItem);
-
-            ivChildItem.setOnClickListener(new View.OnClickListener() {
-                @Override
-                public void onClick(View v) {
-                    Intent picEnlargeIntent = new Intent(that, ActPicturesEnlarge.class);
-                    picEnlargeIntent.putExtra(KFIntentKeys.EXTRA_CURRENT_PICTURE_INDEX, (position));
-                    picEnlargeIntent.putExtra(KFIntentKeys.EXTRA_CURRENT_PICTURE_COLLECTIONS, (Serializable) mUrlsCollection);
-                    that.startActivity(picEnlargeIntent);
-                }
-            });
-            child = ivChildItem;
-            container.addView(ivChildItem, position);
-
-        } else if (openModel == ViewPagerOpenModel.PICTURE_ENLARGE) {
-            RelativeLayout parent = new RelativeLayout(that);
-            LinearLayout.LayoutParams lpParent = new LinearLayout.LayoutParams(
-                    LinearLayout.LayoutParams.MATCH_PARENT,
-                    LinearLayout.LayoutParams.MATCH_PARENT);
-            parent.setLayoutParams(lpParent);
-
-            RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(
-                    LinearLayout.LayoutParams.MATCH_PARENT,
-                    LinearLayout.LayoutParams.MATCH_PARENT);
-            lp.setMargins(20, 20, 20, 20);
-            lp.addRule(RelativeLayout.CENTER_IN_PARENT);
-            ivChildItem.setLayoutParams(lp);
-
-            Glide.with(that).load(mUrlsCollection.get(position))
-                    .apply(new RequestOptions().placeholder(R.drawable.loading)).into(ivChildItem);
-            ivChildItem.setOnClickListener(new View.OnClickListener() {
-                @Override
-                public void onClick(View v) {
-                    that.finish();
-                }
-            });
-
-            parent.addView(ivChildItem);
-            child = parent;
-            if (mIntFirstShowPos > 0 && container.getChildCount() == mIntFirstShowPos) {
-                ((ViewPager) container).setCurrentItem(mIntFirstShowPos);
-                mIntFirstShowPos = 0;//仅第一次设置生效
-            }
-            container.addView(parent, position);
-        }
-
-
-        return child;
-
-    }
-
-
-    @Override
-    public float getPageWidth(int position) {
-        return openModel == ViewPagerOpenModel.GAME_DETAILS ? (float) 0.4 : 1;
-    }
-}

+ 11 - 4
app/src/main/java/com/kfzs/duanduan/oem/AppAddOrdelReceiver.java

@@ -5,6 +5,7 @@ import android.content.Context;
 import android.content.Intent;
 import android.os.Handler;
 import android.os.Looper;
+import android.text.TextUtils;
 
 import com.alibaba.fastjson.JSONObject;
 import com.kfzs.duanduan.datashare.DDProviderHelper;
@@ -32,8 +33,11 @@ public class AppAddOrdelReceiver extends BroadcastReceiver {
                 new Handler(Looper.getMainLooper()).postDelayed(new Runnable() {
                     @Override
                     public void run() {
-                        String packages = intent.getDataString().replace("package:","");
-                        String packageName = intent.getPackage();
+                        String dataString = intent.getDataString();
+                        if(TextUtils.isEmpty(dataString)){
+                            return;
+                        }
+                        String packages = dataString.replace("package:","");
                         final DownLoadInfo downLoadInfo = DDProviderHelper.getInstance()
                                 .getDownloadTaskToPackname(context, packages);
                         if(downLoadInfo == null){
@@ -75,8 +79,11 @@ public class AppAddOrdelReceiver extends BroadcastReceiver {
                 new Handler(Looper.getMainLooper()).postDelayed(new Runnable() {
                     @Override
                     public void run() {
-                        String packages = intent.getDataString().replace("package:","");
-                        String packageName = intent.getPackage();
+                        String dataString = intent.getDataString();
+                        if(TextUtils.isEmpty(dataString)){
+                            return;
+                        }
+                        String packages = dataString.replace("package:","");
                         if(packages.equals(SheepApp.getInstance().getPackgeName()+"")){
                             G.showToast("安装失败,请检查是否空间不足或其他问题!");
                         }

+ 5 - 2
app/src/main/java/com/kfzs/duanduan/react/upfile/UpFileUtils.java

@@ -14,6 +14,7 @@ import java.util.ArrayList;
 
 import okhttp3.Call;
 import okhttp3.Response;
+import okhttp3.ResponseBody;
 
 /**
  * Created by howie on 2017/5/11.
@@ -38,7 +39,8 @@ public class UpFileUtils {
 
                     @Override
                     public Object parseNetworkResponse(Response response, int id) throws Exception {
-                        return response.body().string();
+                        ResponseBody body = response.body();
+                        return body == null ? response : body.string();
                     }
 
                     @Override
@@ -82,7 +84,8 @@ public class UpFileUtils {
 
                             @Override
                             public Object parseNetworkResponse(Response response, int id) throws Exception {
-                                return response.body().string();
+                                ResponseBody body = response.body();
+                                return body == null ? response : body.string();
                             }
 
                             @Override

+ 0 - 83
app/src/main/java/com/kfzs/duanduan/utils/PermissionUtils.java

@@ -1,83 +0,0 @@
-package com.kfzs.duanduan.utils;
-
-import android.app.Activity;
-import android.content.ComponentName;
-import android.content.Intent;
-import android.net.Uri;
-import android.os.Build;
-
-import com.sheep.jiuyan.samllsheep.BuildConfig;
-
-/**
- * Created by Administrator on 2017/11/23.
- */
-
-public class PermissionUtils {
-    /**
-     * 跳转到miui的权限管理页面
-     */
-    public static void gotoMiuiPermission(Activity activity) {
-        Intent i = new Intent("miui.intent.action.APP_PERM_EDITOR");
-        ComponentName componentName = new ComponentName("com.miui.securitycenter", "com.miui.permcenter.permissions.AppPermissionsEditorActivity");
-        i.setComponent(componentName);
-        i.putExtra("extra_pkgname", BuildConfig.APPLICATION_ID);
-        try {
-            activity.startActivity(i);
-        } catch (Exception e) {
-            e.printStackTrace();
-            gotoMeizuPermission(activity);
-        }
-    }
-    /**
-     * 跳转到魅族的权限管理系统
-     */
-    public static void gotoMeizuPermission(Activity activity) {
-        Intent intent = new Intent("com.meizu.safe.security.SHOW_APPSEC");
-        intent.addCategory(Intent.CATEGORY_DEFAULT);
-        intent.putExtra("packageName", BuildConfig.APPLICATION_ID);
-        try {
-            activity.startActivity(intent);
-        } catch (Exception e) {
-            e.printStackTrace();
-            gotoHuaweiPermission(activity);
-        }
-    }
-    /**
-     * 华为的权限管理页面
-     */
-    public static void gotoHuaweiPermission(Activity activity) {
-        try {
-            Intent intent = new Intent();
-            intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
-            ComponentName comp = new ComponentName("com.huawei.systemmanager", "com.huawei.permissionmanager.ui.ActMain");//华为权限管理
-            intent.setComponent(comp);
-            activity.startActivity(intent);
-        } catch (Exception e) {
-            e.printStackTrace();
-            gotoAppDetailSetting(activity);
-        }
-
-    }
-
-    public static void gotoAppDetailSetting(Activity activity) {
-        activity.startActivity(getAppDetailSettingIntent());
-    }
-    /**
-     * 获取应用详情页面intent
-     *
-     * @return
-     */
-    public static Intent getAppDetailSettingIntent() {
-        Intent localIntent = new Intent();
-        localIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
-        if (Build.VERSION.SDK_INT >= 9) {
-            localIntent.setAction("android.settings.APPLICATION_DETAILS_SETTINGS");
-            localIntent.setData(Uri.fromParts("package", BuildConfig.APPLICATION_ID, null));
-        } else if (Build.VERSION.SDK_INT <= 8) {
-            localIntent.setAction(Intent.ACTION_VIEW);
-            localIntent.setClassName("com.android.settings", "com.android.settings.InstalledAppDetails");
-            localIntent.putExtra("com.android.settings.ApplicationPkgName", BuildConfig.APPLICATION_ID);
-        }
-        return localIntent;
-    }
-}

Plik diff jest za duży
+ 0 - 1463
app/src/main/java/com/kfzs/duanduan/utils/dlg/CropImageView.java


+ 3 - 20
app/src/main/java/com/kfzs/duanduan/utils/dlg/HelperUtils.java

@@ -1,8 +1,5 @@
 package com.kfzs.duanduan.utils.dlg;
 
-import android.app.Activity;
-import android.app.ActivityManager;
-import android.content.ComponentName;
 import android.content.Context;
 import android.os.Build;
 import android.os.Environment;
@@ -21,7 +18,6 @@ import com.sheep.jiuyan.samllsheep.BuildConfig;
 import com.sheep.jiuyan.samllsheep.utils.G;
 
 import java.io.File;
-import java.util.List;
 
 /**
  * @ Created by Dlg
@@ -45,6 +41,9 @@ public class HelperUtils {
     public static void init() {
         WindowManager wm = (WindowManager) KFZSApp.context.getSystemService(Context.WINDOW_SERVICE);
         DisplayMetrics outMetrics = new DisplayMetrics();
+        if(wm == null){
+            return;
+        }
         wm.getDefaultDisplay().getMetrics(outMetrics);
         H = outMetrics.heightPixels;
         W = outMetrics.widthPixels;
@@ -85,22 +84,6 @@ public class HelperUtils {
 
 
     /**
-     * 判断当前Activity处于前台还是后台
-     */
-    public static boolean isActivityOnTop(Activity activity) {
-        ActivityManager am = (ActivityManager) activity.getSystemService(Context.ACTIVITY_SERVICE);
-        List<ActivityManager.RunningTaskInfo> tasks = am.getRunningTasks(1);
-        if (!tasks.isEmpty()) {
-            ComponentName topActivity = tasks.get(0).topActivity;
-            if (topActivity.getClassName().equals(activity.getClass().getName())) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-
-    /**
      * 获取剩余空间
      *
      * @return

+ 0 - 135
app/src/main/java/com/kfzs/duanduan/utils/sys/HomeListenByBroadcast.java

@@ -1,135 +0,0 @@
-/*
- * Copyright (c) 2015, Incito Corporation, All Rights Reserved
- */
-package com.kfzs.duanduan.utils.sys;
-
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-import android.content.IntentFilter;
-
-/**
- * @author tianran
- * @version 1.0
- * @description 本类基于系统广播, 无法做到拦截Home键
- * <p>如无法接收系统广播,或者因为ROM定制问题导致广播消失,则无法使用本工具类
- * <p>Home按键监听类 使用说明:
- * <p>1、初始化<p>HomeListen HomeListen homeListen = new HomeListen(context);
- * <p>2、设置Home键监听<p>homeListen.setOnHomeBtnPressListener( new setOnHomeBtnPressListener(){};
- * <p>3、设置Home键监听<p>在onResume方法中启动HomeListen广播: homeListen.start();
- * <p>4、一定要停止广播,比如在onPause方法中停止HomeListen广播: homeListen.stop();
- * @description public void onHomeBtnPress(){按下Home按键回调 };
- * @description public void onHomeBtnLongPress(){长按Home按键回调 };
- * @createDate Apr 2, 2015
- */
-public class HomeListenByBroadcast {
-
-    public static final int DEFAULT_PRIORITY = 1000;
-    /**
-     * 按Home按键,监听标识
-     */
-    public static final String HOME_KEY = "homekey";
-    /**
-     * 长按Home按键,监听标识
-     */
-    public static final String RECENT_APPS = "recentapps";
-
-    public HomeListenByBroadcast(Context context) {
-        mContext = context;
-        mHomeBtnReceiver = new HomeBtnReceiver();
-        mHomeBtnIntentFilter = new IntentFilter(
-                Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
-        mHomeBtnIntentFilter.setPriority(DEFAULT_PRIORITY);
-    }
-
-    /**
-     * 设置Home键监听
-     *
-     * @param onHomeBtnPressListener
-     * @description
-     * @author tianran
-     * @createDate Apr 2, 2015
-     */
-    public void setOnHomeBtnPressListener(
-            OnHomeBtnPressListener onHomeBtnPressListener) {
-        mOnHomeBtnPressListener = onHomeBtnPressListener;
-    }
-
-    /**
-     * 开始监听Home按键
-     *
-     * @description
-     * @author tianran
-     * @createDate Apr 2, 2015
-     */
-    public void start() {
-        mContext.registerReceiver(mHomeBtnReceiver, mHomeBtnIntentFilter);
-    }
-
-    /**
-     * 停止监听Home按键
-     *
-     * @description
-     * @author tianran
-     * @createDate Apr 2, 2015
-     */
-    public void stop() {
-        mContext.unregisterReceiver(mHomeBtnReceiver);
-    }
-
-    private class HomeBtnReceiver extends BroadcastReceiver {
-        @Override
-        public void onReceive(Context context, Intent intent) {
-            receive(context, intent);
-        }
-    }
-
-    private void receive(Context context, Intent intent) {
-        String action = intent.getAction();
-        if (action.equals(Intent.ACTION_CLOSE_SYSTEM_DIALOGS)) {
-            String reason = intent.getStringExtra("reason");
-            if (reason != null) {
-                if (null != mOnHomeBtnPressListener) {
-                    if (reason.equals(HOME_KEY)) {
-                        mOnHomeBtnPressListener.onHomeBtnPress();
-                    } else if (reason.equals(RECENT_APPS)) {
-                        mOnHomeBtnPressListener.onHomeBtnLongPress();
-                    }
-                }
-            }
-        }
-    }
-
-    /**
-     * Home 键监听接口
-     *
-     * @author tianran
-     * @version 1.0
-     * @description
-     * @createDate Apr 2, 2015
-     */
-    public interface OnHomeBtnPressListener {
-        /**
-         * Home键按下监听动作
-         *
-         * @description
-         * @author tianran
-         * @createDate Apr 2, 2015
-         */
-        void onHomeBtnPress();
-
-        /**
-         * Home键长按监听
-         *
-         * @description
-         * @author tianran
-         * @createDate Apr 2, 2015
-         */
-        void onHomeBtnLongPress();
-    }
-
-    private Context mContext = null;
-    private IntentFilter mHomeBtnIntentFilter = null;
-    private OnHomeBtnPressListener mOnHomeBtnPressListener = null;
-    private HomeBtnReceiver mHomeBtnReceiver = null;
-}

+ 0 - 655
app/src/main/java/com/kfzs/duanduan/view/ArrowDownloadButton.java

@@ -1,655 +0,0 @@
-package com.kfzs.duanduan.view;
-
-import android.content.Context;
-import android.graphics.Canvas;
-import android.graphics.Color;
-import android.graphics.Paint;
-import android.graphics.Path;
-import android.graphics.RectF;
-import android.os.Bundle;
-import android.os.Parcelable;
-import android.util.AttributeSet;
-import android.view.View;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * @ Created by Dlg
- * @ <p>TiTle:  ArrowDownloadButton</p>
- * @ <p>Description:</p>
- * @ date:  2018/1/30 14:54
- * @ QQ:    315096953
- */
-public class ArrowDownloadButton extends View {
-
-    private static final int BLUE_ONE = Color.parseColor("#f2f2f2");
-    private static final int WHILE = Color.parseColor("#F44336");
-    private static final boolean mIsClockwise = true;//是否为顺时针旋转
-    private static final float RADIUS = 180;
-    private static final int TRI_POINT_NUMBER = 17;
-    private static final float MAX_WAVE_HEIGHT = 12;//10,最大波浪高
-    private static final float MIN_WAVE_HEIGHT = 5;//最低波浪高
-    private static final int PROGRESS = 100;
-    private static final int ANGLE = 360;
-    private static final float TEXT_Y = 67.5f;
-    private static final float OFFSET = 10;
-    private static final float SMALL_RADIUS = 5;
-    private static final float TEXT_SIZE = 40;
-    private static final float ARC_WIDTH = 26;
-    private static final float ARROW_WIDTH = 14;
-    private static final float TRI_WIDTH = 14;
-    private static final float LOADING_WIDTH = 14;
-
-    private static final float STEP = 2;
-    private static final float ELASTICITY_STEP = 10;
-    private static final float ROPE_STEP_X = 30;
-    private static final float ROPE_STEP_Y = 32;
-    private static final float ROPE_HEAD_STEP_Y = 17;
-    private static final float JUMP_STEP = 45;
-    private static final float DOWN_STEP = 7.5f;
-    private static final float TRI_STEP = 16.875f;
-    private static final float TIME_STEP = 20;
-    private static final float HOOK_STEP_Y = 15;
-    private static final float HOOK_COUNT = 4;
-    private static final float LITTLE_STEP = 8;
-    private static final int DURATION = 20;
-    private static final int COMPLETE_DURATION = 20;
-
-    /**
-     * start instance
-     **/
-    private static final String INSTANCE_STATE = "instance_state";
-    /**
-     *
-     */
-    private static final String X_I = "x";
-    private static final String Y_I = "y";
-    private static final String RADIUS_I = "radius";
-    private static final String MAX_WAVE_HEIGHT_I = "max_wave_height";
-    private static final String MIN_WAVE_HEIGHT_I = "min_wave_height";
-    private static final String TEXT_Y_I = "text_y";
-    private static final String STEP_I = "step";
-    private static final String ELASTICITY_STEP_I = "elasticity_step";
-    private static final String ROPE_STEP_X_I = "rope_step_x";
-    private static final String ROPE_STEP_Y_I = "rope_step_y";
-    private static final String ROPE_HEAD_STEP_Y_I = "rope_head_step_y";
-    private static final String JUMP_STEP_I = "jump_step";
-    private static final String DOWN_STEP_I = "down_step";
-    private static final String TRI_STEP_I = "tri_step";
-    private static final String HOOK_STEP_Y_I = "hook_step";
-    private static final String LITTLE_STEP_I = "little_step";
-    private static final String SMALL_RADIUS_I = "small_radius";
-    private static final String TEXT_SIZE_I = "text_size";
-    private static final String ARC_WIDTH_I = "arc_width";
-    private static final String ARROW_WIDTH_I = "arrow_width";
-    private static final String TRI_WIDTH_I = "tri_width";
-    private static final String LOADING_WIDTH_I = "loading_width";
-    private static final String IS_FIRST_I = "is_first";
-    private static final String IS_ANIMATING_I = "is_animating";
-    private static final String BEZIER_I = "bezier";
-    private static final String IS_LOADING_I = "is_loading";
-    private static final String IS_COMPLETED_I = "is_completed";
-    private static final String IS_END_I = "is_end";
-    private static final String COUNT_I = "count";
-    private static final String LENGTH_I = "length";
-    private static final String CURRENT_TIME_I = "current_time";
-    private static final String WAVE_HEIGHT_I = "wave_height";
-    private static final String PROGRESS_I = "progress";
-    private static final String HOOK_COUNT_I = "hook_count";
-    private static final String LENGTH_X_I = "length_x";
-    private static final String LENGTH_Y_I = "length_y";
-
-
-    private float x = 550;
-    private float y = 550;
-    private float radius = RADIUS;
-    private float maxWaveHeight = MAX_WAVE_HEIGHT;
-    private float minWaveHeight = MIN_WAVE_HEIGHT;
-    private float textY = TEXT_Y;
-    private float step = STEP;
-    private float elasticityStep = ELASTICITY_STEP;
-    private float ropeStepX = ROPE_STEP_X;
-    private float ropeStepY = ROPE_STEP_Y;
-    private float ropeHeadStepY = ROPE_HEAD_STEP_Y;
-    private float jumpStep = JUMP_STEP;
-    private float downStep = DOWN_STEP;
-    private float triStep = TRI_STEP;
-    private float hookStepY = HOOK_STEP_Y;
-    private float littleStep = LITTLE_STEP;
-    private float smallRadius = SMALL_RADIUS;
-    private float textSize = TEXT_SIZE;
-    private float arcWidth = ARC_WIDTH;
-    private float arrowWidth = ARROW_WIDTH;
-    private float triWidth = TRI_WIDTH;
-    private float loadingWidth = LOADING_WIDTH;
-
-    private Paint arrowPaint;
-    private Paint arcPaint;
-    private Paint smallPaint;
-    private Paint triPaint;
-    private Paint loadingPaint;
-    private Paint textPaint;
-
-    private Path arrowPath;
-    private Path triPath;
-    private Path textPath;
-
-    private RectF oval;
-
-    private Point a;
-    private Point b;
-    private Point c;
-    private Point d;
-    private Point e;
-    private Point jumpPoint;
-
-    private List<Point> triPoints = new ArrayList<>();
-
-    private boolean isFirst = true;
-    private boolean isAnimating = false;
-    private boolean bezier = false;
-    private boolean isLoading = false;
-    private boolean isCompleted = false;
-    private boolean isEnd = false;
-    private int count = 0;
-    private float length;
-    private int currentTime = 0;
-    private float waveHeight = MIN_WAVE_HEIGHT;
-    private float progress = 0;
-    private int hookCount = 0;
-    float lengthX = 3 * radius / 4;
-    float lengthY = 3 * radius / 4;
-
-    public float getProgress() {
-        return progress;
-    }
-
-    public void setProgress(float progress) {
-        if (progress > 100) {
-            this.progress = 100;
-        } else {
-            this.progress = progress;
-        }
-
-        if (progress == 100) {
-            isLoading = false;
-            isCompleted = true;
-        }
-    }
-
-    public ArrowDownloadButton(Context context) {
-        this(context, null);
-    }
-
-    public ArrowDownloadButton(Context context, AttributeSet attrs) {
-        this(context, attrs, 0);
-    }
-
-    public ArrowDownloadButton(Context context, AttributeSet attrs, int defStyleAttr) {
-        super(context, attrs, defStyleAttr);
-        init();
-    }
-
-    @Override
-    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
-        setMeasuredDimension(measure(widthMeasureSpec, true), measure(heightMeasureSpec, false));
-    }
-
-    private int measure(int measureSpec, boolean isWidth) {
-        int result;
-        int mode = MeasureSpec.getMode(measureSpec);
-        int size = MeasureSpec.getSize(measureSpec);
-        int padding = isWidth ? getPaddingLeft() + getPaddingRight() : getPaddingTop() + getPaddingBottom();
-        if (mode == MeasureSpec.EXACTLY) {
-            result = size;
-        } else {
-            result = isWidth ? getSuggestedMinimumWidth() : getSuggestedMinimumHeight();
-            result += padding;
-            if (mode == MeasureSpec.AT_MOST) {
-                if (isWidth) {
-                    result = Math.max(result, size);
-                } else {
-                    result = Math.min(result, size);
-                }
-            }
-        }
-        return result;
-    }
-
-    @Override
-    protected void onDraw(Canvas canvas) {
-        if (isFirst) {
-            init();
-            isFirst = false;
-        }
-        canvas.drawCircle(x, y, radius, arcPaint);
-        drawArrow(canvas);
-        if (isAnimating) {
-            animating();
-        }
-        if (isLoading) {
-            loading(canvas);
-        }
-        if (isCompleted) {
-            afterCompleted(canvas);
-        }
-    }
-
-    private void init() {
-        float temp = getHeight() > getWidth() ? getWidth() / 2 : getHeight() / 2;
-        radius = temp - temp * OFFSET / RADIUS - temp * ELASTICITY_STEP / RADIUS - 6;
-        x = getPaddingLeft() + getWidth() / 2;
-        y = getPaddingTop() + getHeight() / 2;
-        maxWaveHeight = convert(MAX_WAVE_HEIGHT);
-        minWaveHeight = convert(MIN_WAVE_HEIGHT);
-        textY = convert(TEXT_Y);
-        step = convert(STEP);
-        elasticityStep = convert(ELASTICITY_STEP);
-        ropeStepX = convert(ROPE_STEP_X);
-        ropeStepY = convert(ROPE_STEP_Y);
-        ropeHeadStepY = convert(ROPE_HEAD_STEP_Y);
-        jumpStep = convert(JUMP_STEP);
-        downStep = convert(DOWN_STEP);
-        triStep = convert(TRI_STEP);
-        hookStepY = convert(HOOK_STEP_Y);
-        littleStep = convert(LITTLE_STEP);
-        smallRadius = convert(SMALL_RADIUS);
-        textSize = convert(TEXT_SIZE);
-        arcWidth = convert(ARC_WIDTH);
-        arrowWidth = convert(ARROW_WIDTH);
-        triWidth = convert(TRI_WIDTH);
-        loadingWidth = convert(LOADING_WIDTH);
-        lengthX = 3 * radius / 4;
-        lengthY = 3 * radius / 4;
-
-        arrowPath = new Path();
-        triPath = new Path();
-        textPath = new Path();
-        oval = new RectF();
-        oval.left = x - radius;
-        oval.top = y - radius;
-        oval.right = x + radius;
-        oval.bottom = y + radius;
-        length = radius / 2;
-        initializePaints();
-        initializePoints();
-    }
-
-    /**
-     * start animating before loading
-     */
-    public void startAnimating() {
-        isAnimating = true;
-        invalidate();
-    }
-
-    /**
-     * reset to initial state
-     */
-    public void reset() {
-        isAnimating = false;
-        isLoading = false;
-        bezier = false;
-        isCompleted = false;
-        isEnd = false;
-        length = radius / 2;
-        count = 0;
-        hookCount = 0;
-        jumpPoint.x = -1;
-        progress = 0;
-        lengthX = 3 * radius / 4;
-        lengthY = 3 * radius / 4;
-        a.y = y + length;
-        b.y = y - length;
-        e.y = y + length;
-        c.x = x - length / 2;
-        c.y = y + length / 2;
-        d.x = x + length / 2;
-        d.y = y + length / 2;
-        invalidate();
-    }
-
-    /**
-     * animating
-     */
-    public void animating() {
-        if (count < 19) {
-            length = length * 3 / 4;
-            a.y = y + length;
-            b.y = y - length;
-
-            if (((count + 1) % 3) == 0 && count < 9) {
-                e.y = e.y + step;
-                c.y = c.y + step;
-                d.y = d.y + step;
-            }
-            if (count > 8 && count < 12) {
-                jumpPoint.x = x;
-                jumpPoint.y = y - jumpStep * (count - 8);
-                c.x = c.x - ropeStepX;
-                c.y = c.y - ropeHeadStepY;
-                d.x = d.x + ropeStepX;
-                d.y = d.y - ropeHeadStepY;
-                e.y = e.y - ropeStepY;
-            }
-            if (count > 11) {
-                bezier = true;
-                if (count == 12) {
-                    jumpPoint.y = jumpPoint.y - jumpStep * 2;
-                } else {
-                    jumpPoint.y = jumpPoint.y + downStep;
-                    if (count < 16) {
-                        int time1 = 15 - count;
-                        e.y = y + time1 * elasticityStep;
-                    }
-                }
-            }
-            count++;
-            postInvalidateDelayed(DURATION);
-        } else {
-            isAnimating = false;
-            bezier = false;
-            if (progress != 100) {
-                isLoading = true;
-            } else {
-                isLoading = false;
-                isCompleted = true;
-            }
-        }
-    }
-
-    /**
-     * under loading
-     *
-     * @param canvas Target Canvas
-     */
-    private void loading(Canvas canvas) {
-        Point currentPoint = triPoints.get(0);
-        Point nextPoint;
-        for (int i = 0; i < TRI_POINT_NUMBER; i++) {
-            Point p = triPoints.get(i);
-            p.x = (x - 3 * radius / 4) + triStep * i;
-            p.y = y + calculateTri(TIME_STEP * i, currentTime);
-        }
-        for (int i = 1; i < TRI_POINT_NUMBER; i++) {
-            nextPoint = triPoints.get(i);
-            triPath.reset();
-            triPath.moveTo(currentPoint.x, currentPoint.y);
-            triPath.lineTo(nextPoint.x, nextPoint.y);
-            canvas.drawCircle(nextPoint.x, nextPoint.y, smallRadius, smallPaint);
-            canvas.drawPath(triPath, triPaint);
-            currentPoint = nextPoint;
-        }
-        textPath.moveTo(x - textSize, y + textY);
-        textPath.lineTo(x + textSize, y + textY);
-        canvas.drawTextOnPath((int) progress + "%", textPath, 0, 0, textPaint);
-        currentTime = (int) (currentTime + TIME_STEP);
-        float sweepAngle = (progress / PROGRESS * ANGLE);
-        sweepAngle = mIsClockwise ? sweepAngle : -sweepAngle;
-        canvas.drawArc(oval, 270, 0 + sweepAngle, false, loadingPaint);
-        postInvalidateDelayed(DURATION);
-    }
-
-    /**
-     * the method do such things:
-     * 1.draw arrow.
-     * 2.when animate was completed, let the small ball jump.
-     *
-     * @param canvas Target Canvas
-     */
-    protected void drawArrow(Canvas canvas) {
-        if (jumpPoint.x != -1) {
-            canvas.drawCircle(jumpPoint.x, jumpPoint.y, smallRadius, smallPaint);
-        }
-        if (bezier) {
-            arrowPath.reset();
-            arrowPath.moveTo(c.x, c.y);
-            arrowPath.quadTo(e.x, e.y, d.x, d.y);
-            canvas.drawPath(arrowPath, arrowPaint);
-        } else if (isLoading) {
-        } else if (isCompleted) {
-        } else if (isEnd) {
-            canvas.drawCircle(x, y, radius, loadingPaint);
-            drawArrowOrHook(canvas);
-        } else {
-            arrowPath.reset();
-            arrowPath.moveTo(a.x, a.y);
-            arrowPath.lineTo(b.x, b.y);
-            canvas.drawPath(arrowPath, arrowPaint);
-
-            canvas.drawCircle(a.x, a.y, smallRadius, smallPaint);
-            canvas.drawCircle(b.x, b.y, smallRadius, smallPaint);
-
-            drawArrowOrHook(canvas);
-
-        }
-    }
-
-    /**
-     * draw arrow or hook
-     *
-     * @param canvas Target Canvas
-     */
-    private void drawArrowOrHook(Canvas canvas) {
-        arrowPath.reset();
-        arrowPath.moveTo(e.x, e.y);
-        arrowPath.lineTo(c.x, c.y);
-        canvas.drawPath(arrowPath, arrowPaint);
-        arrowPath.reset();
-        arrowPath.moveTo(e.x, e.y);
-        arrowPath.lineTo(d.x, d.y);
-        canvas.drawPath(arrowPath, arrowPaint);
-
-        canvas.drawCircle(c.x, c.y, smallRadius, smallPaint);
-        canvas.drawCircle(d.x, d.y, smallRadius, smallPaint);
-        canvas.drawCircle(e.x, e.y, smallRadius, smallPaint);
-    }
-
-    /**
-     * the animate after loading
-     *
-     * @param canvas Target Canvas
-     */
-    private void afterCompleted(Canvas canvas) {
-        canvas.drawCircle(x, y, radius, loadingPaint);
-        if (hookCount == HOOK_COUNT - 1) {
-            e.y = e.y + littleStep;
-            c.x = c.x - littleStep;
-            d.x = d.x + littleStep;
-            d.y = d.y - littleStep;
-            isCompleted = false;
-            isEnd = true;
-        } else {
-            e.x = x;
-            e.y = y + hookStepY * (hookCount + 1);
-            lengthX = lengthX * 3 / 4;
-            c.x = x - lengthX * 3 / 4;
-            c.y = y;
-            d.x = x + lengthY - radius / (float) 8 * (hookCount + 1);
-            d.y = y - hookStepY * (hookCount + 1);
-            hookCount++;
-        }
-        drawArrowOrHook(canvas);
-        postInvalidateDelayed(COMPLETE_DURATION);
-
-    }
-
-    protected void initializePaints() {
-        arcPaint = new Paint();
-        arcPaint.setAntiAlias(true);
-        arcPaint.setStyle(Paint.Style.STROKE);
-        arcPaint.setStrokeWidth(arcWidth);
-        arcPaint.setColor(BLUE_ONE);
-
-        arrowPaint = new Paint();
-        arrowPaint.setAntiAlias(true);
-        arrowPaint.setStyle(Paint.Style.STROKE);
-        arrowPaint.setStrokeWidth(arrowWidth);
-        arrowPaint.setColor(WHILE);
-
-        smallPaint = new Paint();
-        smallPaint.setAntiAlias(true);
-        smallPaint.setStyle(Paint.Style.FILL);
-        smallPaint.setColor(WHILE);
-
-        triPaint = new Paint();
-        triPaint.setAntiAlias(true);
-        triPaint.setStyle(Paint.Style.STROKE);
-        triPaint.setStrokeWidth(triWidth);
-        triPaint.setColor(WHILE);
-
-        loadingPaint = new Paint();
-        loadingPaint.setAntiAlias(true);
-        loadingPaint.setStyle(Paint.Style.STROKE);
-        loadingPaint.setStrokeWidth(loadingWidth);
-        loadingPaint.setColor(WHILE);
-
-        textPaint = new Paint();
-        textPaint.setAntiAlias(true);
-        textPaint.setStyle(Paint.Style.FILL);
-        textPaint.setStrokeWidth(1);
-        textPaint.setColor(WHILE);
-        textPaint.setTextSize(textSize);
-    }
-
-    protected void initializePoints() {
-        a = new Point(x, y + radius / 2);
-        b = new Point(x, y - radius / 2);
-        c = new Point(x - radius / 4, y + radius / 4);
-        d = new Point(x + radius / 4, y + radius / 4);
-        e = new Point(x, y + radius / 2);
-        jumpPoint = new Point();
-
-        for (int i = 0; i < TRI_POINT_NUMBER; i++) {
-            Point point = new Point();
-            point.x = (x - 3 * radius / 4) + triStep * i;
-            point.y = y + calculateTri(TIME_STEP * i, 0);
-            triPoints.add(point);
-        }
-    }
-
-    /**
-     * calculate the wave
-     *
-     * @param originalTime original time
-     * @param currentTime  current time
-     * @return wave
-     */
-    private float calculateTri(float originalTime, float currentTime) {
-        if (progress < PROGRESS / 3) {
-            waveHeight = MIN_WAVE_HEIGHT;
-        } else if (progress < PROGRESS * 2 / 3) {
-            waveHeight = maxWaveHeight;
-        } else {
-            waveHeight = minWaveHeight;
-        }
-        return (float) (waveHeight * Math.sin((Math.PI / 80) * (originalTime + currentTime)));
-    }
-
-    private float convert(float original) {
-        return radius * original / RADIUS;
-    }
-
-    @Override
-    protected Parcelable onSaveInstanceState() {
-        final Bundle bundle = new Bundle();
-        bundle.putParcelable(INSTANCE_STATE, super.onSaveInstanceState());
-        bundle.putFloat(X_I, x);
-        bundle.putFloat(Y_I, y);
-        bundle.putFloat(RADIUS_I, radius);
-        bundle.putFloat(MAX_WAVE_HEIGHT_I, maxWaveHeight);
-        bundle.putFloat(MIN_WAVE_HEIGHT_I, minWaveHeight);
-        bundle.putFloat(TEXT_Y_I, textY);
-        bundle.putFloat(STEP_I, step);
-        bundle.putFloat(ELASTICITY_STEP_I, elasticityStep);
-        bundle.putFloat(ROPE_STEP_X_I, ropeStepX);
-        bundle.putFloat(ROPE_STEP_Y_I, ropeStepY);
-        bundle.putFloat(ROPE_HEAD_STEP_Y_I, ropeHeadStepY);
-        bundle.putFloat(JUMP_STEP_I, jumpStep);
-        bundle.putFloat(DOWN_STEP_I, downStep);
-        bundle.putFloat(TRI_STEP_I, triStep);
-        bundle.putFloat(HOOK_STEP_Y_I, hookStepY);
-        bundle.putFloat(LITTLE_STEP_I, littleStep);
-        bundle.putFloat(SMALL_RADIUS_I, smallRadius);
-        bundle.putFloat(TEXT_SIZE_I, textSize);
-        bundle.putFloat(ARC_WIDTH_I, arcWidth);
-        bundle.putFloat(ARROW_WIDTH_I, arrowWidth);
-        bundle.putFloat(TRI_WIDTH_I, triWidth);
-        bundle.putFloat(LOADING_WIDTH_I, loadingWidth);
-        bundle.putBoolean(IS_FIRST_I, isFirst);
-        bundle.putBoolean(IS_ANIMATING_I, isAnimating);
-        bundle.putBoolean(BEZIER_I, bezier);
-        bundle.putBoolean(IS_LOADING_I, isLoading);
-        bundle.putBoolean(IS_COMPLETED_I, isCompleted);
-        bundle.putBoolean(IS_END_I, isEnd);
-        bundle.putInt(COUNT_I, count);
-        bundle.putFloat(LENGTH_I, length);
-        bundle.putInt(CURRENT_TIME_I, currentTime);
-        bundle.putFloat(WAVE_HEIGHT_I, waveHeight);
-        bundle.putFloat(PROGRESS_I, progress);
-        bundle.putInt(HOOK_COUNT_I, hookCount);
-        bundle.putFloat(LENGTH_X_I, lengthX);
-        bundle.putFloat(LENGTH_Y_I, lengthY);
-        return bundle;
-    }
-
-    @Override
-    protected void onRestoreInstanceState(Parcelable state) {
-        if (state instanceof Bundle) {
-            final Bundle bundle = (Bundle) state;
-            x = bundle.getFloat(X_I);
-            y = bundle.getFloat(Y_I);
-            radius = bundle.getFloat(RADIUS_I);
-            maxWaveHeight = bundle.getFloat(MAX_WAVE_HEIGHT_I);
-            minWaveHeight = bundle.getFloat(MIN_WAVE_HEIGHT_I);
-            textY = bundle.getFloat(TEXT_Y_I);
-            step = bundle.getFloat(STEP_I);
-            elasticityStep = bundle.getFloat(ELASTICITY_STEP_I);
-            ropeStepX = bundle.getFloat(ROPE_STEP_X_I);
-            ropeStepY = bundle.getFloat(ROPE_STEP_Y_I);
-            ropeHeadStepY = bundle.getFloat(ROPE_HEAD_STEP_Y_I);
-            jumpStep = bundle.getFloat(JUMP_STEP_I);
-            downStep = bundle.getFloat(DOWN_STEP_I);
-            triStep = bundle.getFloat(TRI_STEP_I);
-            hookStepY = bundle.getFloat(HOOK_STEP_Y_I);
-            littleStep = bundle.getFloat(LITTLE_STEP_I);
-            smallRadius = bundle.getFloat(SMALL_RADIUS_I);
-            textSize = bundle.getFloat(TEXT_SIZE_I);
-            arcWidth = bundle.getFloat(ARC_WIDTH_I);
-            arrowWidth = bundle.getFloat(ARROW_WIDTH_I);
-            triWidth = bundle.getFloat(TRI_WIDTH_I);
-            loadingWidth = bundle.getFloat(LOADING_WIDTH_I);
-            isFirst = bundle.getBoolean(IS_FIRST_I);
-            isAnimating = bundle.getBoolean(IS_ANIMATING_I);
-            bezier = bundle.getBoolean(BEZIER_I);
-            isLoading = bundle.getBoolean(IS_LOADING_I);
-            isCompleted = bundle.getBoolean(IS_COMPLETED_I);
-            isEnd = bundle.getBoolean(IS_END_I);
-            count = bundle.getInt(COUNT_I);
-            length = bundle.getFloat(LENGTH_I);
-            currentTime = bundle.getInt(CURRENT_TIME_I);
-            waveHeight = bundle.getFloat(WAVE_HEIGHT_I);
-            progress = bundle.getFloat(PROGRESS_I);
-            hookCount = bundle.getInt(HOOK_COUNT_I);
-            lengthX = bundle.getFloat(LENGTH_X_I);
-            lengthY = bundle.getFloat(LENGTH_Y_I);
-        }
-        super.onRestoreInstanceState(state);
-    }
-
-    static class Point {
-        public float x;
-        public float y;
-
-        public Point(float x, float y) {
-            this.x = x;
-            this.y = y;
-        }
-
-        public Point() {
-            x = -1;
-            y = -1;
-        }
-    }
-}

+ 11 - 0
app/src/main/java/com/sheep/gamegroup/util/ConnectAddress.java

@@ -1,6 +1,7 @@
 package com.sheep.gamegroup.util;
 
 
+import com.kfzs.duanduan.react.SharedPreferences;
 import com.sheep.jiuyan.samllsheep.BuildConfig;
 import com.sheep.jiuyan.samllsheep.SheepApp;
 
@@ -117,4 +118,14 @@ public enum ConnectAddress {
                 return 0;
         }
     }
+
+    public ConnectAddress getDefultConnectAddress() {
+        String flavor = TestUtil.isSheep() ? "sheep" : SharedPreferences.getInstance().getString("flavor", BuildConfig.FLAVOR);
+        try {
+            return ConnectAddress.valueOf(flavor);
+        } catch (IllegalArgumentException e) {
+            e.printStackTrace();
+        }
+        return this;
+    }
 }

+ 18 - 6
app/src/main/java/com/sheep/gamegroup/util/Jump2View.java

@@ -13,7 +13,6 @@ import android.view.View;
 
 import com.alibaba.fastjson.JSON;
 import com.kfzs.duanduan.ActMain;
-import com.kfzs.duanduan.ActPicturesEnlarge;
 import com.kfzs.duanduan.bean.KFIntentKeys;
 import com.sheep.gamegroup.absBase.BaseActivity;
 import com.sheep.gamegroup.model.entity.Advertising;
@@ -82,7 +81,6 @@ import com.sheep.gamegroup.view.activity.WebviewAct;
 import com.sheep.gamegroup.view.activity.WithdrawalAct;
 import com.sheep.gamegroup.view.activity.WithdrawalListAct;
 import com.sheep.gamegroup.view.activity.WithdrawalResultAct;
-import com.sheep.gamegroup.view.dialog.DialogAgreement;
 import com.sheep.gamegroup.view.dialog.DialogNewbieTask1;
 import com.sheep.gamegroup.view.dialog.DialogNewbieTaskRegistSuccess;
 import com.sheep.jiuyan.samllsheep.BuildConfig;
@@ -98,6 +96,7 @@ import org.xutils.ex.DbException;
 import java.util.ArrayList;
 import java.util.List;
 
+import me.iwf.photopicker.PhotoPreview;
 import rx.android.schedulers.AndroidSchedulers;
 import rx.functions.Action1;
 import rx.schedulers.Schedulers;
@@ -841,10 +840,23 @@ public class Jump2View {
      * @param imgs 多张图片地址,用;分隔
      */
     public void showImgs(Context context, int position, String imgs) {
-        Intent picEnlargeIntent = new Intent(context, ActPicturesEnlarge.class);
-        picEnlargeIntent.putExtra(KFIntentKeys.EXTRA_CURRENT_PICTURE_INDEX, (position));
-        picEnlargeIntent.putExtra("imgs", imgs);
-        context.startActivity(picEnlargeIntent);
+        showImgList(context, position, ListUtil.asList(imgs.split(";")));
+    }
+    /**
+     * 显示多张图片
+     * @param context
+     * @param position
+     * @param imgList
+     */
+    public void showImgList(Context context, int position, ArrayList<String> imgList) {
+        Activity activity = context instanceof Activity ? (Activity) context : ActivityManager.getInstance().currentActivity();
+        if(activity != null) {
+            PhotoPreview.builder()
+                    .setPhotos(imgList)
+                    .setCurrentItem(position)
+                    .setShowDeleteButton(false)
+                    .start(activity);
+        }
     }
 
 

+ 9 - 0
app/src/main/java/com/sheep/gamegroup/util/ListUtil.java

@@ -2,6 +2,8 @@ package com.sheep.gamegroup.util;
 
 
 import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
 import java.util.List;
 
 /**
@@ -55,4 +57,11 @@ public class ListUtil {
     public static <T> int size(List<T> list) {
         return isEmpty(list) ? 0 : list.size();
     }
+
+    @SafeVarargs
+    public static <T> ArrayList<T> asList(T...items) {
+        ArrayList<T> list = emptyList();
+        Collections.addAll(list, items);
+        return list;
+    }
 }

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

@@ -220,9 +220,9 @@ public class TestUtil {
         if (isTest()) {
             if (loginEty != null && loginEty.getUser() != null) {
                 LoginUser loginUser = new LoginUser();
-                loginUser.setId(loginEty.getUser().getOpen_id());
-                loginUser.setToken(loginEty.getToken());
                 loginUser.setServiceName(SheepApp.getInstance().getConnectAddress().getName());
+                loginUser.setId(loginEty.getUser().getOpen_id()+loginUser.getServiceName());
+                loginUser.setToken(loginEty.getToken());
                 loginUser.setNickname(loginEty.getUser().getNickname());
                 MyDbManager.getInstance().saveOrUpdate(loginUser);
             }

+ 7 - 7
app/src/main/java/com/sheep/gamegroup/view/activity/ActInstallApkList.java

@@ -76,13 +76,13 @@ public class ActInstallApkList extends BaseActivity {
 
             @Override
             public void convert(ViewHolder holder, final AppInfo appInfo) {
-                ImageView app_info_iv = (ImageView)holder.itemView.findViewById(R.id.app_info_iv);
-                TextView app_info_name_tv = (TextView)holder.itemView.findViewById(R.id.app_info_name_tv);
-                TextView app_info_package_name_tv = (TextView)holder.itemView.findViewById(R.id.app_info_package_name_tv);
-                TextView app_info_size_tv = (TextView)holder.itemView.findViewById(R.id.app_info_size_tv);
-                TextView app_info_path_tv = (TextView)holder.itemView.findViewById(R.id.app_info_path_tv);
-                TextView app_info_is_sys_tv = (TextView)holder.itemView.findViewById(R.id.app_info_is_sys_tv);
-                TextView app_info_is_sd_tv = (TextView)holder.itemView.findViewById(R.id.app_info_is_sd_tv);
+                ImageView app_info_iv = holder.itemView.findViewById(R.id.app_info_iv);
+                TextView app_info_name_tv = holder.itemView.findViewById(R.id.app_info_name_tv);
+                TextView app_info_package_name_tv = holder.itemView.findViewById(R.id.app_info_package_name_tv);
+                TextView app_info_size_tv = holder.itemView.findViewById(R.id.app_info_size_tv);
+                TextView app_info_path_tv = holder.itemView.findViewById(R.id.app_info_path_tv);
+                TextView app_info_is_sys_tv = holder.itemView.findViewById(R.id.app_info_is_sys_tv);
+                TextView app_info_is_sd_tv = holder.itemView.findViewById(R.id.app_info_is_sd_tv);
 
                 app_info_iv.setImageDrawable(appInfo.getIcon());
                 ViewUtil.setText(app_info_name_tv, appInfo.getAppName());

+ 1 - 1
app/src/main/java/com/sheep/gamegroup/view/activity/GamemakeMoneyAct.java

@@ -135,7 +135,7 @@ public class GamemakeMoneyAct extends BaseActivity {
         tabGridview.setOnItemClickListener(new AdapterView.OnItemClickListener() {
             @Override
             public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
-                if(gridViewEntity == (GridViewEntity) gridviewList.get(position)){
+                if(gridViewEntity == gridviewList.get(position)){
                     return;
                 }
                 select = position;

+ 1 - 1
app/src/main/java/com/sheep/gamegroup/view/activity/SplashAct.java

@@ -208,7 +208,7 @@ public class SplashAct extends BaseActivity implements EasyPermissions.Permissio
         mHandler.removeMessages(0);
         if(advertising.getShow_time() > 0) {
             splash_skip.setVisibility(View.VISIBLE);
-            timer = RxjavaCountDownTimer.getInstance(BuildConfig.DEBUG ? 1 : advertising.getShow_time())
+            timer = RxjavaCountDownTimer.getInstance(BuildConfig.DEBUG ? 10 : advertising.getShow_time())
                     .setOnTickListener(new RxjavaCountDownTimer.OnTickListener() {
                         @Override
                         public void onFinish() {

+ 1 - 1
app/src/main/java/com/sheep/gamegroup/view/activity/TaskDetailAct.java

@@ -516,7 +516,7 @@ public class TaskDetailAct extends AbsChooseImageActivity implements TaskDetailC
                     break;
                 case R.id.btn_task_item:
                     if((game_id > 0 && (btnTaskItem.getText() + "").equals("去充值"))){
-                        ViewUtil.showGamePayAccount((Activity) activity, game_id);
+                        ViewUtil.showGamePayAccount(activity, game_id);
                         return;
                     }
                     switch (type) {

+ 1 - 1
app/src/main/java/com/sheep/gamegroup/view/activity/TryMakeMoneyact.java

@@ -139,7 +139,7 @@ public class TryMakeMoneyact extends BaseActivity {
         tabGridview.setOnItemClickListener(new AdapterView.OnItemClickListener() {
             @Override
             public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
-                if(gridViewEntity == (GridViewEntity) gridviewList.get(position)){
+                if(gridViewEntity == gridviewList.get(position)){
                     return;
                 }
                 select = position;

+ 1 - 1
app/src/main/java/com/sheep/gamegroup/view/adapter/ArrayAdapter.java

@@ -391,7 +391,7 @@ public class ArrayAdapter<T> extends BaseAdapter implements Filterable {
                     text = (TextView) view;
                 } else {
                     //  Otherwise, find the TextView field within the layout
-                    text = (TextView) view.findViewById(mFieldId);
+                    text = view.findViewById(mFieldId);
                 }
             } catch (ClassCastException e) {
                 Log.e("ArrayAdapter", "You must supply a resource ID for a TextView");

+ 1 - 1
app/src/main/java/com/sheep/gamegroup/view/adapter/TryMakeMoneyAdp.java

@@ -199,7 +199,7 @@ public class TryMakeMoneyAdp extends AdpCommonRecy<RecyleObj> {
                 ((TextView)viewHolder.itemView.findViewById(R.id.item_anem_tv)).setText(etyList.get(i).getName()+"");
                 TextView task_type_tv = viewHolder.itemView.findViewById(R.id.task_type_tv);
                 task_type_tv.setVisibility(View.VISIBLE);
-                ((TextView)viewHolder.itemView.findViewById(R.id.item_money)).setVisibility(View.GONE);
+                viewHolder.itemView.findViewById(R.id.item_money).setVisibility(View.GONE);
                 //领取任务
                 final boolean isInstall = PackageUtil.isAppInstalled(SheepApp.mContext, etyList.get(i).getPackage_name());
                 String taskTypeTvValue = "下载游戏";

+ 2 - 2
app/src/main/java/com/sheep/gamegroup/view/adapter/expandadapter/BaseViewHolder.java

@@ -20,10 +20,10 @@ public abstract class BaseViewHolder extends RecyclerView.ViewHolder {
         super(itemView);
         switch (viewType) {
             case VIEW_TYPE_PARENT:
-                groupView = (ViewGroup)itemView.findViewById(getGroupViewResId());
+                groupView = itemView.findViewById(getGroupViewResId());
                 break;
             case VIEW_TYPE_CHILD:
-                childView = (ViewGroup) itemView.findViewById(getChildViewResId());
+                childView = itemView.findViewById(getChildViewResId());
                 break;
         }
     }

+ 4 - 4
app/src/main/java/com/sheep/gamegroup/view/adapter/expandadapter/SignRecordViewHolder.java

@@ -17,10 +17,10 @@ public class SignRecordViewHolder extends BaseViewHolder {
 
     public SignRecordViewHolder(Context ctx, View itemView, int viewType) {
         super(ctx,itemView, viewType);
-        sign_child_tv_time = (TextView) itemView.findViewById(R.id.sign_child_tv_time);
-        sign_child_tv_text = (TextView) itemView.findViewById(R.id.sign_child_tv_text);
-        sign_group_tv_title = (TextView)itemView.findViewById(R.id.sign_group_tv_title);
-        sign_group_iv_course = (ImageView)itemView.findViewById(R.id.sign_group_iv_course);
+        sign_child_tv_time = itemView.findViewById(R.id.sign_child_tv_time);
+        sign_child_tv_text = itemView.findViewById(R.id.sign_child_tv_text);
+        sign_group_tv_title = itemView.findViewById(R.id.sign_group_tv_title);
+        sign_group_iv_course = itemView.findViewById(R.id.sign_group_iv_course);
     }
 
     @Override

+ 3 - 3
app/src/main/java/com/sheep/gamegroup/view/dialog/DialogOrienteeringDetails.java

@@ -64,9 +64,9 @@ public class DialogOrienteeringDetails {
 
             empty_view = view.findViewById(R.id.empty_view);
             swipe_container = view.findViewById(R.id.swipe_container);
-            dialog_list_view = (ListView)view.findViewById(R.id.dialog_list_view);
-            TextView dialog_btn_left = (TextView)view.findViewById(R.id.dialog_btn_left);
-            TextView dialog_btn_right = (TextView)view.findViewById(R.id.dialog_btn_right);
+            dialog_list_view = view.findViewById(R.id.dialog_list_view);
+            TextView dialog_btn_left = view.findViewById(R.id.dialog_btn_left);
+            TextView dialog_btn_right = view.findViewById(R.id.dialog_btn_right);
 
             swipe_container.setFooterView(activity, dialog_list_view, R.layout.listview_footer);
             adapter = new ArrayAdapter<OrienteeringDetail>(activity, R.layout.dialog_orienteering_details_item, list){

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

@@ -21,6 +21,7 @@ import com.sheep.gamegroup.util.Jump2View;
 import com.sheep.gamegroup.util.LogUtil;
 import com.sheep.gamegroup.util.MyDbManager;
 import com.sheep.gamegroup.util.SysAppUtil;
+import com.sheep.gamegroup.util.TestUtil;
 import com.sheep.gamegroup.util.UMConfigUtils;
 import com.sheep.gamegroup.view.activity.LoginAct;
 import com.sheep.gamegroup.view.activity.PhoneAct;
@@ -87,14 +88,7 @@ public class SheepApp extends BaseApplication {
         if(AppUtil.isMainPross(this)) {
             mContext = getApplicationContext();
             mSheepApp = this;
-            String flavor = SharedPreferences.getInstance().getString("flavor", BuildConfig.FLAVOR);
-            if("sheep".equals(BuildConfig.FLAVOR) && !BuildConfig.DEBUG){
-                flavor = BuildConfig.FLAVOR;
-            }
-            connectAddress = ConnectAddress.valueOf(flavor);
-            if(connectAddress == null){
-                connectAddress = ConnectAddress.sheep;
-            }
+            connectAddress = ConnectAddress.sheep.getDefultConnectAddress();
             registerActivityLifecycleCallbacks(activityLifecycleCallbacks);
             initGoble();
             initNet();

+ 8 - 0
app/src/main/res/drawable/shape_ash_stroke_rectangle_small.xml

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+    android:shape="rectangle">
+    <corners android:radius="10dp" />
+    <stroke
+        android:width="1dp"
+        android:color="#E5E5E5" />
+</shape>

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

@@ -86,7 +86,7 @@
             android:src="@mipmap/bg_newbie_task"/>
     </com.kfzs.duanduan.view.DragRelativeLayout>
     <TextView
-        android:id="@+id/test_change"
+        android:id="@+id/test_change_user"
         style="@style/style_button_small_yellow"
         android:layout_width="wrap_content"
         android:layout_height="30dp"
@@ -95,18 +95,18 @@
         android:layout_margin="@dimen/content_padding_10"
         android:layout_alignParentBottom="true"
         android:layout_alignParentStart="true"
-        android:text="切换服务器"
+        android:text="切换账号"
         android:visibility="gone"/>
     <TextView
-        android:id="@+id/test_change_user"
+        android:id="@+id/test_change"
         style="@style/style_button_small_yellow"
         android:layout_width="wrap_content"
         android:layout_height="30dp"
         android:paddingStart="@dimen/content_padding_10"
         android:paddingEnd="@dimen/content_padding_10"
         android:layout_margin="@dimen/content_padding_10"
-        android:layout_above="@+id/test_change"
+        android:layout_above="@+id/test_change_user"
         android:layout_alignParentStart="true"
-        android:text="切换账号"
+        android:text="切换服务器"
         android:visibility="gone"/>
 </RelativeLayout>

+ 3 - 3
app/src/main/res/layout/splash_activity.xml

@@ -29,12 +29,12 @@
         android:layout_gravity="top|end"
         android:paddingTop="2dp"
         android:paddingBottom="2dp"
-        android:paddingStart="@dimen/content_padding_15"
-        android:paddingEnd="@dimen/content_padding_15"
+        android:paddingStart="10dp"
+        android:paddingEnd="10dp"
         android:layout_margin="@dimen/content_padding_20"
         android:textColor="#918F8F"
         android:textSize="14sp"
-        android:background="@drawable/shape_ash_solid_rectangle_small"
+        android:background="@drawable/shape_ash_stroke_rectangle_small"
         android:visibility="gone"
         android:text="跳过" />
     <TextView

+ 0 - 1
app/src/main/res/layout/withdrawal_layout.xml

@@ -1,6 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:tools="http://schemas.android.com/tools"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
     xmlns:app="http://schemas.android.com/apk/res-auto"

+ 0 - 41
app/src/main/res/values/dd_view_style.xml

@@ -1,41 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<resources>
-    <!--裁剪图片-->
-    <declare-styleable name="CropImageView">
-        <attr name="imgSrc" format="reference" />
-        <attr name="cropMode">
-            <enum name="ratio_fit_image" value="0" />
-            <enum name="ratio_4_3" value="1" />
-            <enum name="ratio_3_4" value="2" />
-            <enum name="ratio_1_1" value="3" />
-            <enum name="ratio_16_9" value="4" />
-            <enum name="ratio_9_16" value="5" />
-            <enum name="ratio_free" value="6" />
-            <enum name="ratio_custom" value="7" />
-            <enum name="circle" value="8" />
-        </attr>
-        <attr name="backgroundColor" format="color" />
-        <attr name="overlayColor" format="color" />
-        <attr name="frameColor" format="color" />
-        <attr name="handleColor" format="color" />
-        <attr name="guideColor" format="color" />
-        <attr name="guideShowMode">
-            <enum name="show_always" value="1" />
-            <enum name="show_on_touch" value="2" />
-            <enum name="not_show" value="3" />
-        </attr>
-        <attr name="handleShowMode">
-            <enum name="show_always" value="1" />
-            <enum name="show_on_touch" value="2" />
-            <enum name="not_show" value="3" />
-        </attr>
-        <attr name="handleSize" format="dimension" />
-        <attr name="touchPadding" format="dimension" />
-        <attr name="minFrameSize" format="dimension" />
-        <attr name="frameStrokeWeight" format="dimension" />
-        <attr name="guideStrokeWeight" format="dimension" />
-        <attr name="cropEnabled" format="boolean" />
-        <attr name="initialFrameScale" format="float" />
-    </declare-styleable>
-
-</resources>

+ 1 - 1
app/src/main/res/values/gamegroup_string.xml

@@ -25,7 +25,7 @@
     <string name="sheep_id">绵羊号</string>
     <string name="my_qr">我的二维码</string>
 
-    <string name="tip_skip">(%1$d秒)后可关闭</string>
+    <string name="tip_skip">(%1$d秒)后自动跳过</string>
     <string name="tip_newbie_task_1">我知道了(%1$d秒)</string>
     <string name="friend_extract_count">共%1d条</string>
 </resources>

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

@@ -1 +0,0 @@
-<resources />

+ 6 - 1
app/src/main/res/values/str_network_strings.xml

@@ -1,4 +1,9 @@
 <?xml version="1.0" encoding="utf-8"?>
 <resources>
-    <string name="network_conf_network">网络错误</string>
+    <string name="coming_soon">敬请期待</string>
+    <string name="loading_data">数据正在加载中,请稍候重试</string>
+    <string name="service_data_error">数据错误,请稍候再试</string>
+    <string name="unknown_error">未知错误,请稍候再试</string>
+    <string name="error_download_link">下载地址错误,请联系客服</string>
+    <string name="error_package_link">包名错误,请联系客服</string>
 </resources>

+ 0 - 6
app/src/main/res/values/strings.xml

@@ -11,12 +11,6 @@
     <string name="bind_weixin_withdrawal_notice_text">你的每次收入提现,我们都会通过微信的企业商户入账功能将收入实时入账到绑定微信号的微信零钱上</string>
     <string name="no_bind_wx_notice_text">未绑定微信号,无法入账到你的微信零钱</string>
     <string name="no_bind_tel_notice_text">我们已将你的手机号与该帐号绑定,如有变更,请点击</string>
-    <string name="coming_soon">敬请期待</string>
-    <string name="loading_data">数据正在加载中,请稍候重试</string>
-    <string name="service_data_error">数据错误,请稍候再试</string>
-    <string name="unknown_error">未知错误,请稍候再试</string>
-    <string name="error_download_link">下载地址错误,请联系客服</string>
-    <string name="error_package_link">包名错误,请联系客服</string>
     <string name="last_page">&#060;</string>
     <string name="next_page">&#062;</string>