|
|
@@ -4,10 +4,13 @@ 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;
|
|
|
import android.graphics.Bitmap;
|
|
|
+import android.graphics.BitmapFactory;
|
|
|
import android.graphics.Color;
|
|
|
import android.graphics.drawable.BitmapDrawable;
|
|
|
import android.graphics.drawable.Drawable;
|
|
|
@@ -18,6 +21,7 @@ import android.provider.MediaStore;
|
|
|
import android.support.v4.app.FragmentActivity;
|
|
|
import android.support.v7.app.AlertDialog;
|
|
|
import android.support.v7.widget.GridLayoutManager;
|
|
|
+import android.support.v7.widget.LinearLayoutManager;
|
|
|
import android.support.v7.widget.RecyclerView;
|
|
|
import android.text.Html;
|
|
|
import android.text.TextUtils;
|
|
|
@@ -45,6 +49,11 @@ import com.bumptech.glide.request.RequestOptions;
|
|
|
import com.google.gson.Gson;
|
|
|
import com.jcodecraeer.xrecyclerview.CustomFooterViewCallBack;
|
|
|
import com.jcodecraeer.xrecyclerview.XRecyclerView;
|
|
|
+import com.kfzs.duanduan.cardview.BlurBitmapUtils;
|
|
|
+import com.kfzs.duanduan.cardview.CardAdapter;
|
|
|
+import com.kfzs.duanduan.cardview.CardScaleHelper;
|
|
|
+import com.kfzs.duanduan.cardview.SpeedRecyclerView;
|
|
|
+import com.kfzs.duanduan.cardview.ViewSwitchUtils;
|
|
|
import com.kfzs.duanduan.fragment.FgtPersonalCenter;
|
|
|
import com.sheep.gamegroup.dateview.DatePickerDialog;
|
|
|
import com.sheep.gamegroup.dateview.DateUtil;
|
|
|
@@ -81,6 +90,7 @@ import java.io.File;
|
|
|
import java.io.FileNotFoundException;
|
|
|
import java.io.FileOutputStream;
|
|
|
import java.io.IOException;
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
import java.util.Locale;
|
|
|
import java.util.Map;
|
|
|
@@ -104,6 +114,9 @@ public class ViewUtil {
|
|
|
public static final int REQUEST_CODE_TASK_LIST = 110;
|
|
|
private static ViewUtil viewUtil;
|
|
|
static RobTask mRobTask;
|
|
|
+ private static int mLastPos = -1;
|
|
|
+ private static CardScaleHelper mCardScaleHelper = new CardScaleHelper();
|
|
|
+ private static Runnable mBlurRunnable;
|
|
|
|
|
|
public static ViewUtil newInstance() {
|
|
|
if (viewUtil == null) {
|
|
|
@@ -352,6 +365,24 @@ public class ViewUtil {
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
+ 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;
|
|
|
+ }
|
|
|
+ });
|
|
|
ivClose.setOnClickListener(new View.OnClickListener() {
|
|
|
@Override
|
|
|
public void onClick(View view) {
|
|
|
@@ -1307,6 +1338,79 @@ public class ViewUtil {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 初始化画廊
|
|
|
+ *
|
|
|
+ * @param mRecyclerView ,recycleView
|
|
|
+ * @param mBlurView 显示的ImageView
|
|
|
+ * @param mList 图片文件地址集合,
|
|
|
+ * @param context 。。。
|
|
|
+ */
|
|
|
+ private static void init(SpeedRecyclerView mRecyclerView, ImageView mBlurView, List<Integer> mList, Context context) {
|
|
|
+ if (mList == null) {
|
|
|
+ mList = new ArrayList<>();
|
|
|
+ }
|
|
|
+ for (int i = 0; i < 10; i++) {
|
|
|
+ mList.add(R.drawable.kaipin);
|
|
|
+ mList.add(R.drawable.kaipin);
|
|
|
+ mList.add(R.drawable.kaipin);
|
|
|
+ }
|
|
|
+
|
|
|
+ final LinearLayoutManager linearLayoutManager = new LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false);
|
|
|
+ mRecyclerView.setLayoutManager(linearLayoutManager);
|
|
|
+ mRecyclerView.setAdapter(new CardAdapter(mList));
|
|
|
+ // mRecyclerView绑定scale效果
|
|
|
+ mCardScaleHelper.setCurrentItemPos(2);
|
|
|
+ mCardScaleHelper.attachToRecyclerView(mRecyclerView);
|
|
|
+
|
|
|
+ initBlurBackground(mBlurView, mRecyclerView, mList, context);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 给画廊设置背景
|
|
|
+ *
|
|
|
+ * @param mBlurView
|
|
|
+ * @param mRecyclerView
|
|
|
+ * @param mList
|
|
|
+ * @param context
|
|
|
+ */
|
|
|
+ private static void initBlurBackground(ImageView mBlurView, RecyclerView mRecyclerView, final List<Integer> mList, final Context context) {
|
|
|
+ final ImageView finalMBlurView = mBlurView;
|
|
|
+ mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
|
|
|
+ @Override
|
|
|
+ public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
|
|
|
+ super.onScrollStateChanged(recyclerView, newState);
|
|
|
+ if (newState == RecyclerView.SCROLL_STATE_IDLE) {
|
|
|
+ notifyBackgroundChange(finalMBlurView, mList, context);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ notifyBackgroundChange(mBlurView, mList, context);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 检测画廊图片变化
|
|
|
+ *
|
|
|
+ * @param mBlurView
|
|
|
+ * @param mList
|
|
|
+ * @param context
|
|
|
+ */
|
|
|
+ private static void notifyBackgroundChange(final ImageView mBlurView, List<Integer> mList, final Context context) {
|
|
|
+ if (mLastPos == mCardScaleHelper.getCurrentItemPos()) return;
|
|
|
+ mLastPos = mCardScaleHelper.getCurrentItemPos();
|
|
|
+ final int resId = mList.get(mCardScaleHelper.getCurrentItemPos());
|
|
|
+ mBlurView.removeCallbacks(mBlurRunnable);
|
|
|
+ mBlurRunnable = new Runnable() {
|
|
|
+ @Override
|
|
|
+ public void run() {
|
|
|
+ Bitmap bitmap = BitmapFactory.decodeResource(context.getResources(), resId);
|
|
|
+ ViewSwitchUtils.startSwitchBackgroundAnim(mBlurView, BlurBitmapUtils.getBlurBitmap(mBlurView.getContext(), bitmap, 15));
|
|
|
+ }
|
|
|
+ };
|
|
|
+ mBlurView.postDelayed(mBlurRunnable, 500);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* 添加游戏账户
|
|
|
*/
|
|
|
public void showAddAccount(Activity activity, Action1<Integer> action1) {
|
|
|
@@ -1316,7 +1420,7 @@ public class ViewUtil {
|
|
|
public static void showShareDialog(final Activity activity, final String url, final String description) {
|
|
|
View dialog_parent = View.inflate(activity, R.layout.ask_to_share, null);
|
|
|
final AlertDialog dialog = new AlertDialog.Builder(activity, R.style.AppTheme_Dialog_Alert)
|
|
|
- .setView(dialog_parent)
|
|
|
+ .setView(dialog_parent).setCancelable(true)
|
|
|
.create();
|
|
|
Window windows = dialog.getWindow();
|
|
|
windows.setGravity(Gravity.BOTTOM); //Dialog在屏幕底部弹出来
|
|
|
@@ -1324,6 +1428,11 @@ public class ViewUtil {
|
|
|
layoutParams.width = 400; //设置Dialog的宽
|
|
|
layoutParams.height = 200; //设置Dialog的高
|
|
|
windows.setWindowAnimations(R.style.Rising);//设置动画效果
|
|
|
+ View viewEmpty = dialog_parent.findViewById(R.id.empty_view);
|
|
|
+ // SpeedRecyclerView speedRecyclerView = dialog_parent.findViewById(R.id.recyclerView);
|
|
|
+ // ImageView card = dialog_parent.findViewById(R.id.blurView);
|
|
|
+ // List<Integer> mList = new ArrayList<>();
|
|
|
+ // init(speedRecyclerView, card, mList, activity);
|
|
|
// TextView ask_share_title = dialog_parent.findViewById(R.id.ask_share_title);
|
|
|
RecyclerView ask_share_list = dialog_parent.findViewById(R.id.ask_share_list);
|
|
|
GridLayoutManager gridLayoutManager = new GridLayoutManager(activity, 5);
|
|
|
@@ -1348,6 +1457,12 @@ public class ViewUtil {
|
|
|
nameList.add("QQ好友");
|
|
|
nameList.add("朋友圈");
|
|
|
nameList.add("复制链接");
|
|
|
+ viewEmpty.setOnClickListener(new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View view) {
|
|
|
+ dialog.cancel();
|
|
|
+ }
|
|
|
+ });
|
|
|
AdbCommonRecycler<String> adapter = new AdbCommonRecycler<String>(activity, list) {
|
|
|
|
|
|
@Override
|