|
@@ -33,10 +33,12 @@ import com.sheep.gamegroup.util.Jump2View;
|
|
|
import com.sheep.gamegroup.util.MyDbManager;
|
|
import com.sheep.gamegroup.util.MyDbManager;
|
|
|
import com.sheep.gamegroup.util.StringUtils;
|
|
import com.sheep.gamegroup.util.StringUtils;
|
|
|
import com.sheep.gamegroup.util.UMConfigUtils;
|
|
import com.sheep.gamegroup.util.UMConfigUtils;
|
|
|
|
|
+import com.sheep.gamegroup.util.ViewUtil;
|
|
|
import com.sheep.gamegroup.view.activity.AskGetMoneyAct;
|
|
import com.sheep.gamegroup.view.activity.AskGetMoneyAct;
|
|
|
import com.sheep.gamegroup.view.activity.PersonalCenterAct;
|
|
import com.sheep.gamegroup.view.activity.PersonalCenterAct;
|
|
|
import com.sheep.jiuyan.samllsheep.R;
|
|
import com.sheep.jiuyan.samllsheep.R;
|
|
|
import com.sheep.jiuyan.samllsheep.SheepApp;
|
|
import com.sheep.jiuyan.samllsheep.SheepApp;
|
|
|
|
|
+import com.sheep.jiuyan.samllsheep.utils.ClassFileHelper;
|
|
|
import com.sheep.jiuyan.samllsheep.utils.G;
|
|
import com.sheep.jiuyan.samllsheep.utils.G;
|
|
|
|
|
|
|
|
import org.xutils.ex.DbException;
|
|
import org.xutils.ex.DbException;
|
|
@@ -173,7 +175,7 @@ public class FgtPersonalCenter extends BaseCompatFragment {
|
|
|
break;
|
|
break;
|
|
|
case R.id.recommend_friend_layout://推荐给好友
|
|
case R.id.recommend_friend_layout://推荐给好友
|
|
|
if(Ety!= null){
|
|
if(Ety!= null){
|
|
|
- shardFriend(getActivity(),Ety.getShare_link());
|
|
|
|
|
|
|
+ ViewUtil.shareLink(getActivity(),Ety.getShare_link());
|
|
|
}
|
|
}
|
|
|
break;
|
|
break;
|
|
|
case R.id.tv_submit://注销
|
|
case R.id.tv_submit://注销
|
|
@@ -183,84 +185,6 @@ public class FgtPersonalCenter extends BaseCompatFragment {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * 分享对话框
|
|
|
|
|
- * @param activity
|
|
|
|
|
- * @param link
|
|
|
|
|
- */
|
|
|
|
|
- private void shardFriend(final Activity activity, final String link) {
|
|
|
|
|
- AlertDialog.Builder builder = new AlertDialog.Builder(activity);
|
|
|
|
|
- View view = View.inflate(activity, R.layout.x_recommend_dialog, null);
|
|
|
|
|
- builder.setView(view);
|
|
|
|
|
-
|
|
|
|
|
- final AlertDialog dialog = builder.create();
|
|
|
|
|
- ImageView iv = view.findViewById(R.id.iv_close);
|
|
|
|
|
- TextView withdrawal = view.findViewById(R.id.withdrawal);
|
|
|
|
|
- TextView tv_link = view.findViewById(R.id.tv_link);
|
|
|
|
|
- TextView save_pic = view.findViewById(R.id.save_pic);
|
|
|
|
|
- ImageView iv_qr = view.findViewById(R.id.iv_qr);
|
|
|
|
|
- ImageView iv_qr_small = view.findViewById(R.id.iv_qr_small);
|
|
|
|
|
-
|
|
|
|
|
- tv_link.setText(link);
|
|
|
|
|
-
|
|
|
|
|
- Glide.with(activity)
|
|
|
|
|
- .load(AppUtil.getQRLink(link, 800))
|
|
|
|
|
- .apply(new RequestOptions().override(800, 800))
|
|
|
|
|
- .into(iv_qr);
|
|
|
|
|
- Glide.with(activity)
|
|
|
|
|
- .load("http://cdngame.kuaifazs.com/icon.png")
|
|
|
|
|
- .apply(new RequestOptions().override(G.WIDTH/5))
|
|
|
|
|
- .into(iv_qr_small);
|
|
|
|
|
- dialog.show();
|
|
|
|
|
- Window window = dialog.getWindow();
|
|
|
|
|
- if(window != null) {
|
|
|
|
|
- android.view.WindowManager.LayoutParams p = window.getAttributes();
|
|
|
|
|
- p.height = WindowManager.LayoutParams.WRAP_CONTENT;
|
|
|
|
|
-// p.height = G.WIDTH;
|
|
|
|
|
- p.width = G.WIDTH;
|
|
|
|
|
- dialog.getWindow().setAttributes(p); //设置生效
|
|
|
|
|
- }
|
|
|
|
|
- iv.setOnClickListener(new View.OnClickListener() {
|
|
|
|
|
- @Override
|
|
|
|
|
- public void onClick(View v) {
|
|
|
|
|
- dialog.dismiss();
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
-
|
|
|
|
|
- withdrawal.setOnClickListener(new View.OnClickListener() {
|
|
|
|
|
- @Override
|
|
|
|
|
- public void onClick(View v) {
|
|
|
|
|
- StringUtils.CopyText(activity,Ety.getShare_link());
|
|
|
|
|
- showToast("复制链接成功");
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
-
|
|
|
|
|
- save_pic.setOnClickListener(new View.OnClickListener() {
|
|
|
|
|
- @Override
|
|
|
|
|
- public void onClick(View v) {
|
|
|
|
|
-
|
|
|
|
|
- new Thread(new Runnable() {
|
|
|
|
|
- @Override
|
|
|
|
|
- public void run() {
|
|
|
|
|
- String imagePath = Environment.getExternalStorageDirectory().getAbsolutePath() + "/" + new Date().toString() +".png";
|
|
|
|
|
- String path = getImagePath(AppUtil.getQRLink(link, 800));
|
|
|
|
|
- /**
|
|
|
|
|
- * 拷贝到指定路径
|
|
|
|
|
- */
|
|
|
|
|
- copyFile(path, imagePath);
|
|
|
|
|
- Intent intentBroadcast = new Intent(
|
|
|
|
|
- Intent.ACTION_MEDIA_SCANNER_SCAN_FILE);
|
|
|
|
|
- File file = new File(imagePath);
|
|
|
|
|
- intentBroadcast.setData(Uri.fromFile(file));
|
|
|
|
|
- activity.sendBroadcast(intentBroadcast);
|
|
|
|
|
- }
|
|
|
|
|
- }).start();
|
|
|
|
|
- showToast("已保存");
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
FriendAndAwardEntity Ety;
|
|
FriendAndAwardEntity Ety;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -290,51 +214,4 @@ public class FgtPersonalCenter extends BaseCompatFragment {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * 获取Glide显示图片的缓存路径
|
|
|
|
|
- * @param imgUrl
|
|
|
|
|
- * @return
|
|
|
|
|
- */
|
|
|
|
|
- private String getImagePath(String imgUrl) {
|
|
|
|
|
- String path = null;
|
|
|
|
|
- FutureTarget<File> future = Glide.with(this)
|
|
|
|
|
- .load(imgUrl)
|
|
|
|
|
- .downloadOnly(Target.SIZE_ORIGINAL,Target.SIZE_ORIGINAL);
|
|
|
|
|
- try {
|
|
|
|
|
- File cacheFile = future.get();
|
|
|
|
|
- path = cacheFile.getAbsolutePath();
|
|
|
|
|
- } catch (InterruptedException | ExecutionException e) {
|
|
|
|
|
- e.printStackTrace();
|
|
|
|
|
- }
|
|
|
|
|
- return path;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * 保存图片
|
|
|
|
|
- * @param oldPath
|
|
|
|
|
- * @param newPath
|
|
|
|
|
- */
|
|
|
|
|
- public void copyFile(String oldPath, String newPath) {
|
|
|
|
|
- try {
|
|
|
|
|
- int bytesum = 0;
|
|
|
|
|
- int byteread = 0;
|
|
|
|
|
- File oldfile = new File(oldPath);
|
|
|
|
|
- if (oldfile.exists()) { //文件存在时
|
|
|
|
|
- InputStream inStream = new FileInputStream(oldPath); //读入原文件
|
|
|
|
|
- FileOutputStream fs = new FileOutputStream(newPath);
|
|
|
|
|
- byte[] buffer = new byte[1024];
|
|
|
|
|
- while ( (byteread = inStream.read(buffer)) != -1) {
|
|
|
|
|
- bytesum += byteread; //字节数 文件大小
|
|
|
|
|
- fs.write(buffer, 0, byteread);
|
|
|
|
|
- }
|
|
|
|
|
- inStream.close();
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- catch (Exception e) {
|
|
|
|
|
- e.printStackTrace();
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
}
|
|
}
|