Browse Source

添加游戏用户快速跳转游戏的功能,普通用户可以到设置中开启

zengjiebin 7 years ago
parent
commit
8905e398df

+ 61 - 25
app/src/main/java/com/sheep/gamegroup/util/CommonUtil.java

@@ -18,7 +18,6 @@ import android.util.TypedValue;
 import android.view.View;
 import android.view.ViewGroup;
 import android.view.ViewTreeObserver;
-import android.webkit.DownloadListener;
 import android.webkit.WebView;
 import android.widget.ImageView;
 import android.widget.LinearLayout;
@@ -1014,9 +1013,11 @@ public class CommonUtil {
                 .observeOn(AndroidSchedulers.mainThread())
                 .subscribe(observer);
     }
+
     /**
      * 微信支付
      * apk签名:c69316882eada62ae560c31076740400
+     *
      * @param payInfo
      */
     public void wxpay(IWXAPI api, final JSONObject payInfo) {
@@ -1725,7 +1726,7 @@ public class CommonUtil {
                     int fillCount = Math.min(5, count);//一屏的个数
 
                     int tabWidth = tabLayout.getWidth();
-                    if(tabWidth == 0){
+                    if (tabWidth == 0) {
                         tabWidth = G.WIDTH;
                     }
                     for (int i = 0; i < count; i++) {
@@ -2299,9 +2300,10 @@ public class CommonUtil {
      *
      * @param i -1:不限制 否者限制tag 个数
      */
-    public void paintLineaLayout( GameEntity gameEntity, LinearLayout ll_game_tag, int i, int color, int drawable) {
-        paintLineaLayout(gameEntity.getApp(),ll_game_tag, i, color, drawable);
+    public void paintLineaLayout(GameEntity gameEntity, LinearLayout ll_game_tag, int i, int color, int drawable) {
+        paintLineaLayout(gameEntity.getApp(), ll_game_tag, i, color, drawable);
     }
+
     /**
      * tag 标签绘制
      * R.drawable.shape_blue_stroke_rectangle_no_lb
@@ -2309,7 +2311,7 @@ public class CommonUtil {
      * @param i -1:不限制 否者限制tag 个数
      */
     public void paintLineaLayout(Applications app, LinearLayout ll_game_tag, int i, int color, int drawable) {
-        if(app == null){
+        if (app == null) {
             ll_game_tag.removeAllViews();
             return;
         }
@@ -2371,7 +2373,7 @@ public class CommonUtil {
                 }
             } else {
                 releaseEty.getDownloadHelper().updateDownloadTaskView(showSimpleText, taskEty, detail_task_tv_center, o -> {
-                    if(o instanceof Integer){//下载游戏时判断是否领取了任务
+                    if (o instanceof Integer) {//下载游戏时判断是否领取了任务
                         CommonUtil.getInstance().receiveAward(gameEntity, new Action1<Integer>() {
                             @Override
                             public void call(Integer integer) {
@@ -2554,24 +2556,18 @@ public class CommonUtil {
 
     //使webView支持下载文件
     public void setDownloadListener(final Context context, WebView webView) {
-        webView.setDownloadListener(new DownloadListener() {
-            @Override
-            public void onDownloadStart(final String url, String userAgent, String contentDisposition, String mimeType, long contentLength) {
-                LogUtil.println("setDownloadListener", "setDownloadListener", "onDownloadStart", url, userAgent, contentDisposition, mimeType);
-                showDownloadDialog(context, url);
-            }
+        webView.setDownloadListener((url, userAgent, contentDisposition, mimeType, contentLength) -> {
+            LogUtil.println("setDownloadListener", "setDownloadListener", "onDownloadStart", url, userAgent, contentDisposition, mimeType);
+            showDownloadDialog(context, url);
         });
     }
 
     //使webView支持下载文件
     public void setDownloadListener(final Activity activity, com.tencent.smtt.sdk.WebView webView) {
-        webView.setDownloadListener(new com.tencent.smtt.sdk.DownloadListener() {
-            @Override
-            public void onDownloadStart(final String url, String userAgent, String contentDisposition, String mimeType, long contentLength) {
-                LogUtil.println("setDownloadListener", "setDownloadListener", "onDownloadStart", url, userAgent, contentDisposition, mimeType);
-                showDownloadDialog(activity, url);
+        webView.setDownloadListener((url, userAgent, contentDisposition, mimeType, contentLength) -> {
+            LogUtil.println("setDownloadListener", "setDownloadListener", "onDownloadStart", url, userAgent, contentDisposition, mimeType);
+            showDownloadDialog(activity, url);
 
-            }
         });
     }
 
@@ -2582,14 +2578,54 @@ public class CommonUtil {
         final boolean exists = saveFile.exists();
         ViewUtil.showMsgDialog(context, new DialogConfig().setTitle("下载提示")
                 .setMsg((exists ? "是否重新下载文件:" : "是否下载文件:") + saveFile.getAbsolutePath()).setBtnLeftText("取消下载").setBtnRightText("确认下载")
-                .setBtnRightOnClickListener(new View.OnClickListener() {
-                    @Override
-                    public void onClick(View view) {
-                        if (exists && saveFile.delete()) {
-                            LogUtil.println("setDownloadListener", "setDownloadListener", "onDownloadStart", url, saveFile.getAbsolutePath(), "成功删除原来的文件");
-                        }
-                        DownloadService.sysDownload(context, url, fileName, "来自小绵羊的下载:" + fileName, fileName, "系统开始下载apk");
+                .setBtnRightOnClickListener(view -> {
+                    if (exists && saveFile.delete()) {
+                        LogUtil.println("setDownloadListener", "setDownloadListener", "onDownloadStart", url, saveFile.getAbsolutePath(), "成功删除原来的文件");
                     }
+                    DownloadService.sysDownload(context, url, fileName, "来自小绵羊的下载:" + fileName, fileName, "系统开始下载apk");
                 }));
     }
+
+    //检查粘贴板
+    public void checkCopyText() {
+        boolean enableCheckCopyText = DataUtil.getAsBoolean(Config.KEY_ENABLE_CHECK_COPY_TEXT, Config.dvbEnableCheckCopyText());
+        if(!enableCheckCopyText){
+            LogUtil.println("checkCopyText", "closed");
+            return;
+        }
+        CharSequence text = StringUtils.getCopyText();
+        String used = DataUtil.getAsString(Config.KEY_USED_COPY_TEXT, null);
+        LogUtil.println("checkCopyText", "\ntext\t", text, "\nused\t", used);
+        if (!TextUtils.isEmpty(text) && !TextUtils.equals(text.toString(), used)) {//内容不为空时或者与上次记录的内容不相同时
+            String textString = text.toString();
+            View.OnClickListener closeListener = view -> DataUtil.putAsString(Config.KEY_USED_COPY_TEXT, textString);
+            DialogConfig dialogConfig = new DialogConfig().setTitle("小绵羊提示").setBtnCloseOnClickListener(closeListener);
+            if (textString.startsWith("http://") || textString.startsWith("https://")) {//如果是链接,直接跳转外部浏览器
+                dialogConfig.setMsg("已经复制如下内容:\n" + textString + "\n,是否访问该链接?")
+                        .setBtnLeftText("仅一次").setBtnLeftOnClickListener(view -> {
+                    closeListener.onClick(view);
+                    Jump2View.getInstance().goWeb(SheepApp.getInstance().getCurrentActivity(), textString);
+                })
+                        .setBtnRightText("确定").setBtnRightOnClickListener(view -> Jump2View.getInstance().goWeb(SheepApp.getInstance().getCurrentActivity(), textString));
+                ViewUtil.showMsgDialog(SheepApp.getInstance().getCurrentActivity(), dialogConfig);
+            } else if (textString.contains("://")) {
+                dialogConfig.setMsg("已经复制如下内容:\n" + textString + "\n,是否尝试跳转?")
+                        .setBtnLeftText("仅一次").setBtnLeftOnClickListener(view -> {
+                    closeListener.onClick(view);
+                    Jump2View.getInstance().tryGotoDeepLink(textString);
+                })
+                        .setBtnRightText("确定").setBtnRightOnClickListener(view -> Jump2View.getInstance().tryGotoDeepLink(textString));
+                ViewUtil.showMsgDialog(SheepApp.getInstance().getCurrentActivity(), dialogConfig);
+            } else if(TestUtil.isDev()){
+                String msg = textString.length() > 100 ? textString.substring(0, 100) + "..." : textString;
+                dialogConfig.setMsg("已经复制如下内容:\n" + msg + "\n,是否查看详情?")
+                        .setBtnLeftText("仅一次").setBtnLeftOnClickListener(view -> {
+                    closeListener.onClick(view);
+                    Jump2View.getInstance().goLoadH5(SheepApp.getInstance().getCurrentActivity(), "来自粘贴板", textString);
+                })
+                        .setBtnRightText("确定").setBtnRightOnClickListener(view -> Jump2View.getInstance().goLoadH5(SheepApp.getInstance().getCurrentActivity(), "来自粘贴板", textString));
+                ViewUtil.showMsgDialog(SheepApp.getInstance().getCurrentActivity(), dialogConfig);
+            }
+        }
+    }
 }

+ 5 - 0
app/src/main/java/com/sheep/gamegroup/util/DataUtil.java

@@ -325,6 +325,11 @@ public class DataUtil {
     public static void putAsBoolean(String key, boolean value) {
         aCache.put(key, Boolean.toString(value));
     }
+    public static boolean toggleAsBoolean(String key, boolean defaultValue) {
+        boolean value = !getAsBoolean(key, defaultValue);
+        putAsBoolean(key, value);
+        return value;
+    }
 
 
     private Map<String, Object> objectMap = new HashMap<>();

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

@@ -34,10 +34,13 @@ public class StringUtils {
      * @param text
      */
     public static boolean CopyText(String text) {
+        return CopyText("sheep text copy", text);
+    }
+    public static boolean CopyText(String label, String text) {
         ClipboardManager clipboardManager = (ClipboardManager) SheepApp.getInstance().getSystemService(Context.CLIPBOARD_SERVICE);
         if (clipboardManager != null && !TextUtils.isEmpty(text)) {
             //创建ClipData对象
-            ClipData clipData = ClipData.newPlainText("sheep text copy", text);
+            ClipData clipData = ClipData.newPlainText(label, text);
             //添加ClipData对象到剪切板中
             clipboardManager.setPrimaryClip(clipData);
             return true;

+ 14 - 35
app/src/main/java/com/sheep/gamegroup/util/ViewUtil.java

@@ -4,8 +4,6 @@ import android.app.ActionBar;
 import android.app.Activity;
 import android.app.Dialog;
 import android.app.ProgressDialog;
-import android.content.ClipData;
-import android.content.ClipboardManager;
 import android.content.Context;
 import android.content.DialogInterface;
 import android.content.Intent;
@@ -84,7 +82,6 @@ import com.sheep.gamegroup.model.entity.RobTask;
 import com.sheep.gamegroup.model.entity.TaskEty;
 import com.sheep.gamegroup.model.entity.WebParams;
 import com.sheep.gamegroup.model.util.SheepSubscriber;
-import com.sheep.gamegroup.module.game.fragment.FgtMyGameList;
 import com.sheep.gamegroup.module.skin.util.SkinUtil;
 import com.sheep.gamegroup.module.yf_shop.model.ReceiveCouponsCheckResq;
 import com.sheep.gamegroup.module.yf_shop.model.ReceiveCouponsResp;
@@ -505,41 +502,22 @@ public class ViewUtil {
         }
         popupWindow.setOnDismissListener(new PopDismissListener(mActivity));
         tvTitle.setText("兑换");
-        tvGetRedPackage.setOnClickListener(new View.OnClickListener() {
-            @Override
-            public void onClick(View v) {
-                if (TextUtils.isEmpty(edInvitationCode.getText())) {
-                    G.showToast("邀请码不能为空!");
-                } else {
-                    fgtPersonalCenter.getRedPackage(edInvitationCode.getText().toString(), popupWindow);
-                    popupWindow.dismiss();
-                }
-            }
-        });
-        edInvitationCode.setOnLongClickListener(new View.OnLongClickListener() {
-            @Override
-            public boolean onLongClick(View view) {
-                // 获取系统剪贴板
-                ClipboardManager clipboard = (ClipboardManager) mActivity.getSystemService(Context.CLIPBOARD_SERVICE);
-                // 获取剪贴板的剪贴数据集
-                ClipData clipData = clipboard.getPrimaryClip();
-
-                if (clipData != null && clipData.getItemCount() > 0) {
-                    // 从数据集中获取(粘贴)第一条文本数据
-                    CharSequence codetext = clipData.getItemAt(0).getText();
-                    if (!TextUtils.isEmpty(codetext)) {
-                        edInvitationCode.setText(codetext);
-                    }
-                }
-                return false;
+        tvGetRedPackage.setOnClickListener(v -> {
+            if (TextUtils.isEmpty(edInvitationCode.getText())) {
+                G.showToast("邀请码不能为空!");
+            } else {
+                fgtPersonalCenter.getRedPackage(edInvitationCode.getText().toString(), popupWindow);
+                popupWindow.dismiss();
             }
         });
-        ivClose.setOnClickListener(new View.OnClickListener() {
-            @Override
-            public void onClick(View view) {
-                popupWindow.dismiss();
+        edInvitationCode.setOnLongClickListener(view1 -> {
+            CharSequence text = StringUtils.getCopyText();
+            if(!TextUtils.isEmpty(text)){
+                edInvitationCode.setText(text);
             }
+            return false;
         });
+        ivClose.setOnClickListener(view12 -> popupWindow.dismiss());
 
     }
 
@@ -1123,7 +1101,8 @@ public class ViewUtil {
         return showMsgDialog(context, new DialogConfig().setMsg(msg).setTitle(title).setFinish(isFinish).setBtnLeftText("知道了"));
     }
 
-    public static AlertDialog showMsgDialog(Context mContext, final DialogConfig dialogConfig) {
+    public static AlertDialog showMsgDialog(Context context, final DialogConfig dialogConfig) {
+        Context mContext = context == null ? SheepApp.getInstance() : context;
         String title = dialogConfig.getTitle();
         String msg = dialogConfig.getMsg();
         String msgMore = dialogConfig.getMsgMore();

+ 9 - 10
app/src/main/java/com/sheep/gamegroup/view/activity/ActMain.java

@@ -232,11 +232,15 @@ public class ActMain extends BaseActYmPermissionCheck {
             FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
             Fragment cFragment = getSupportFragmentManager().findFragmentByTag("fragment_" + position);
             Fragment lFragment = getSupportFragmentManager().findFragmentByTag("fragment_" + lastPosition);
-            transaction.hide(lFragment);
-            transaction.show(cFragment);
+            if(lFragment != null)
+                transaction.hide(lFragment);
+            if(cFragment != null)
+                transaction.show(cFragment);
             transaction.commitAllowingStateLoss();
-            lFragment.setUserVisibleHint(false);
-            cFragment.setUserVisibleHint(true);
+            if(lFragment != null)
+                lFragment.setUserVisibleHint(false);
+            if(cFragment != null)
+                cFragment.setUserVisibleHint(true);
         }
         changeVisible(lastPosition, position);
         lastPosition = position;
@@ -337,12 +341,7 @@ public class ActMain extends BaseActYmPermissionCheck {
             }
         } else {
             if (onResumeCount == 0 && !TestUtil.isDev()) {
-                SysAppUtil.showVersionInfo(this, SpUtils.getIgnoreMd5(), new Action1<Integer>() {
-                    @Override
-                    public void call(Integer integer) {
-                        Jump2View.getInstance().tryShowHalfScreenAd(ActMain.this, getContainer());
-                    }
-                });
+                SysAppUtil.showVersionInfo(this, SpUtils.getIgnoreMd5(), integer -> Jump2View.getInstance().tryShowHalfScreenAd(ActMain.this, getContainer()));
             }
         }
         onResumeCount++;

+ 25 - 14
app/src/main/java/com/sheep/gamegroup/view/activity/ActSetting.java

@@ -15,6 +15,7 @@ import com.sheep.gamegroup.util.DataUtil;
 import com.sheep.gamegroup.util.Jump2View;
 import com.sheep.gamegroup.util.SysAppUtil;
 import com.sheep.gamegroup.util.ViewUtil;
+import com.sheep.jiuyan.samllsheep.Config;
 import com.sheep.jiuyan.samllsheep.R;
 import com.sheep.jiuyan.samllsheep.SheepApp;
 import com.sheep.jiuyan.samllsheep.utils.G;
@@ -57,9 +58,10 @@ public class ActSetting extends BaseActivity {
     @Override
     public void initData() {
         initCacheSize();
+        initCopyState();
     }
 
-    @OnClick({R.id.change_password_layout, R.id.abourt_us_layout, R.id.clear_layout, R.id.tv_submit, R.id.change_layout})
+    @OnClick({R.id.change_password_layout, R.id.abourt_us_layout, R.id.clear_layout, R.id.tv_submit, R.id.copy_text_layout, R.id.change_layout})
     public void onClick(View view) {
         switch (view.getId()) {
             case R.id.change_password_layout:
@@ -71,21 +73,25 @@ public class ActSetting extends BaseActivity {
             case R.id.change_layout://新功能介绍
                 Jump2View.getInstance().goVersionChange(activity, ApkUtils.getCurrentPkgVersionName(SheepApp.getInstance()));
                 break;
+            case R.id.copy_text_layout://粘贴板助手
+                boolean opened = DataUtil.toggleAsBoolean(Config.KEY_ENABLE_CHECK_COPY_TEXT, Config.dvbEnableCheckCopyText());
+                initCopyState();
+                if(opened){
+                    ViewUtil.showMsgDialog(activity, getString(R.string.copy_assistant_tip));
+                }
+                break;
             case R.id.clear_layout://清除缓存
                 ViewUtil.showMsgDialog(activity, new DialogConfig().setTitle("清除缓存").setMsg("所有本地的缓存都会被清理").setBtnRightText("取消")
-                        .setBtnLeftText("确定").setBtnLeftOnClickListener(new View.OnClickListener() {
-                            @Override
-                            public void onClick(View view) {
-                                USER_CLEAN_SURE.onEvent();
-                                SysAppUtil.clearCache(new AbsObserver<Object>() {
-                                    @Override
-                                    public void onNext(Object o) {
-                                        DataUtil.putAsInt(DataKey.KEY_ORDER, 1);
-                                        G.showToast("清理缓存完成");
-                                        initCacheSize();
-                                    }
-                                });
-                            }
+                        .setBtnLeftText("确定").setBtnLeftOnClickListener(view1 -> {
+                            USER_CLEAN_SURE.onEvent();
+                            SysAppUtil.clearCache(new AbsObserver<Object>() {
+                                @Override
+                                public void onNext(Object o) {
+                                    DataUtil.putAsInt(DataKey.KEY_ORDER, 1);
+                                    G.showToast("清理缓存完成");
+                                    initCacheSize();
+                                }
+                            });
                         }));
                 USER_CLEAN.onEvent();
                 break;
@@ -102,5 +108,10 @@ public class ActSetting extends BaseActivity {
         String size = SysAppUtil.getAppCacheSize();
         clear_item_tv.setText(TextUtils.isEmpty(size) || TextUtils.equals("0K", size) ? "无需清理" : size);
     }
+    @BindView(R.id.copy_text_tv)
+    TextView copy_text_tv;
+    private void initCopyState() {
+        copy_text_tv.setText(DataUtil.getAsBoolean(Config.KEY_ENABLE_CHECK_COPY_TEXT, Config.dvbEnableCheckCopyText()) ? R.string.opened : R.string.closed);
+    }
 
 }

+ 13 - 34
app/src/main/java/com/sheep/gamegroup/view/fragment/FgtSmallSheep.java

@@ -3,8 +3,6 @@ package com.sheep.gamegroup.view.fragment;
 import android.annotation.SuppressLint;
 import android.app.ActionBar;
 import android.app.Activity;
-import android.content.ClipData;
-import android.content.ClipboardManager;
 import android.content.Context;
 import android.content.DialogInterface;
 import android.content.Intent;
@@ -44,7 +42,6 @@ import com.alibaba.fastjson.JSONArray;
 import com.bumptech.glide.Glide;
 import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
 import com.bumptech.glide.request.RequestOptions;
-import com.chad.library.adapter.base.BaseQuickAdapter;
 import com.kfzs.duanduan.utils.NumberFormatUtils;
 import com.scwang.smartrefresh.layout.SmartRefreshLayout;
 import com.scwang.smartrefresh.layout.api.RefreshLayout;
@@ -83,6 +80,7 @@ import com.sheep.gamegroup.util.GlideImageLoader;
 import com.sheep.gamegroup.util.Jump2View;
 import com.sheep.gamegroup.util.ListUtil;
 import com.sheep.gamegroup.util.RefreshUtil;
+import com.sheep.gamegroup.util.StringUtils;
 import com.sheep.gamegroup.util.SysAppUtil;
 import com.sheep.gamegroup.util.TestUtil;
 import com.sheep.gamegroup.util.UMConfigUtils;
@@ -280,41 +278,22 @@ public class FgtSmallSheep extends BaseFragment implements SmallSheepContract.Vi
         }
         popupWindow.setOnDismissListener(new ViewUtil.PopDismissListener(mActivity));
         tvTitle.setText("邀请码领取,金额更大");
-        tvGetRedPackage.setOnClickListener(new View.OnClickListener() {
-            @Override
-            public void onClick(View v) {
-                if (TextUtils.isEmpty(edInvitationCode.getText())) {
-                    G.showToast("邀请码不能为空!");
-                } else {
-                    fgtSmallSheep.getRedPackage(edInvitationCode.getText().toString(), popupWindow);
-                    popupWindow.dismiss();
-                }
-            }
-        });
-        edInvitationCode.setOnLongClickListener(new View.OnLongClickListener() {
-            @Override
-            public boolean onLongClick(View view) {
-                // 获取系统剪贴板
-                ClipboardManager clipboard = (ClipboardManager) mActivity.getSystemService(Context.CLIPBOARD_SERVICE);
-                // 获取剪贴板的剪贴数据集
-                ClipData clipData = clipboard.getPrimaryClip();
-
-                if (clipData != null && clipData.getItemCount() > 0) {
-                    // 从数据集中获取(粘贴)第一条文本数据
-                    CharSequence codetext = clipData.getItemAt(0).getText();
-                    if (!TextUtils.isEmpty(codetext)) {
-                        edInvitationCode.setText(codetext);
-                    }
-                }
-                return false;
+        tvGetRedPackage.setOnClickListener(v -> {
+            if (TextUtils.isEmpty(edInvitationCode.getText())) {
+                G.showToast("邀请码不能为空!");
+            } else {
+                fgtSmallSheep.getRedPackage(edInvitationCode.getText().toString(), popupWindow);
+                popupWindow.dismiss();
             }
         });
-        ivClose.setOnClickListener(new View.OnClickListener() {
-            @Override
-            public void onClick(View view) {
-                popupWindow.dismiss();
+        edInvitationCode.setOnLongClickListener(view1 -> {
+            CharSequence text = StringUtils.getCopyText();
+            if(!TextUtils.isEmpty(text)){
+                edInvitationCode.setText(text);
             }
+            return false;
         });
+        ivClose.setOnClickListener(view12 -> popupWindow.dismiss());
     }
 
     @OnClick(R.id.to_search_but)

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

@@ -1,5 +1,8 @@
 package com.sheep.jiuyan.samllsheep;
 
+import com.sheep.gamegroup.model.entity.UserEntity;
+import com.sheep.gamegroup.util.DataUtil;
+
 /**
  * Created by kemllor on 2017/12/14.
  */
@@ -50,4 +53,15 @@ public class Config {
 
     //微信支付app_id
     public static final String WX_PAY_APP_ID = "wx427e8e74e8dd27a6";
+
+
+    //缓存数据的key
+    public static final String KEY_ENABLE_CHECK_COPY_TEXT = "enable_check_copy_text";//是否开启粘贴板助手的key boolean
+    public static final String KEY_USED_COPY_TEXT = "used_copy_text";//忽略的复制内容的key String
+
+    //默认值
+    public static boolean dvbEnableCheckCopyText(){//游戏用户默认开启检查粘贴板
+        UserEntity userEntity = DataUtil.getInstance().getUserEntity();
+        return userEntity != null && userEntity.isGameUser();
+    }
 }

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

@@ -31,6 +31,7 @@ import com.sheep.gamegroup.usage.AppUsageManager;
 import com.sheep.gamegroup.util.AppUtil;
 import com.sheep.gamegroup.util.CertificationUtil;
 import com.sheep.gamegroup.util.ChannelContent;
+import com.sheep.gamegroup.util.CommonUtil;
 import com.sheep.gamegroup.util.ConfigUtil;
 import com.sheep.gamegroup.util.ConnectAddress;
 import com.sheep.gamegroup.util.DataKey;
@@ -475,6 +476,9 @@ public class SheepApp extends MultiDexApplication {
                     Jump2View.getInstance().startShotScreenFloat(activity, false);
                 }
             }
+            if (mActivityCount == 1) { // 应用回到前台
+                CommonUtil.getInstance().checkCopyText();
+            }
         }
 
         @Override

+ 16 - 0
app/src/main/res/layout/act_setting.xml

@@ -57,6 +57,22 @@
         </LinearLayout>
 
         <View style="@style/style_item_line" />
+        <LinearLayout
+            android:id="@+id/copy_text_layout"
+            style="@style/style_item_container">
+
+            <TextView
+                style="@style/style_item_label"
+                android:text="@string/copy_assistant" />
+
+            <TextView
+                android:id="@+id/copy_text_tv"
+                style="@style/style_item_end"
+                android:text="@string/opened" />
+
+        </LinearLayout>
+
+        <View style="@style/style_item_line" />
 
         <LinearLayout
             android:id="@+id/clear_layout"

+ 4 - 4
app/src/main/res/values/dd_styles.xml

@@ -340,7 +340,7 @@
 
     <style name="style_item_line">
         <item name="android:layout_width">match_parent</item>
-        <item name="android:layout_height">1px</item>
+        <item name="android:layout_height">1dp</item>
         <item name="android:layout_marginEnd">@dimen/content_padding</item>
         <item name="android:layout_marginStart">@dimen/content_padding</item>
         <item name="android:background">@color/white_bg_line</item>
@@ -348,14 +348,14 @@
 
     <style name="style_item_line_3_0">
         <item name="android:layout_width">match_parent</item>
-        <item name="android:layout_height">1px</item>
+        <item name="android:layout_height">1dp</item>
         <item name="android:layout_marginStart">20dp</item>
         <item name="android:background">@color/white_bg_line</item>
     </style>
 
     <style name="style_item_line_new">
         <item name="android:layout_width">match_parent</item>
-        <item name="android:layout_height">1px</item>
+        <item name="android:layout_height">1dp</item>
         <item name="android:layout_marginEnd">@dimen/content_padding</item>
         <item name="android:layout_marginStart">@dimen/content_padding_left_new</item>
         <item name="android:background">@color/white_bg_line</item>
@@ -363,7 +363,7 @@
 
     <style name="style_item_line_full">
         <item name="android:layout_width">match_parent</item>
-        <item name="android:layout_height">1px</item>
+        <item name="android:layout_height">1dp</item>
         <item name="android:background">@color/white_bg_line</item>
     </style>
 

+ 5 - 1
app/src/main/res/values/strings.xml

@@ -216,5 +216,9 @@
 
     <!-- WXPayEntryActivity -->
     <string name="pay_result_tip">这个界面用于显示第三方app通过微信支付的结果</string>
-    <string name="pay_result_callback_msg" formatted="false">微信支付结果:%s</string>
+
+    <string name="copy_assistant">启动检查粘贴板</string>
+    <string name="copy_assistant_tip">如果您是游戏玩家,恭喜您,通过复制链接,然后回到小绵羊,可以实现快速进入游戏,快去尝试吧!</string>
+    <string name="opened">已开启</string>
+    <string name="closed">已关闭</string>
 </resources>