光环助手
-乐于分享的人
是最帅的^_^
- DOWNLOAD
+
乐于分享的人是最帅的^_^ 仅限安卓系统 + mScanResultList;
@@ -78,6 +95,10 @@ public class ChooseReceiverActivity extends BaseActivity implements View.OnClick
private SharedPreferences sp;
+ private ScaleAnimation mScaleAnimation; // 火箭喷火动画
+
+ private TranslateAnimation mTranslateAnimation; // 整个火箭移动页面
+
Handler handler = new Handler() {
@Override
public void handleMessage(Message msg) {
@@ -95,6 +116,20 @@ public class ChooseReceiverActivity extends BaseActivity implements View.OnClick
View contentView = View.inflate(this, R.layout.activity_choosereceiver, null);
init(contentView, "发送游戏");
+
+ // 添加分享图标
+ TextView hintTv = new TextView(this);
+ hintTv.setText("操作说明");
+ hintTv.setTextColor(Color.WHITE);
+ hintTv.setGravity(Gravity.CENTER);
+ hintTv.setPadding(DisplayUtils.dip2px(this, 13),0 ,DisplayUtils.dip2px(this, 13),0);
+ RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(
+ ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT);
+ params.addRule(RelativeLayout.ALIGN_PARENT_RIGHT );
+ RelativeLayout reuse_actionbar = (RelativeLayout) contentView.findViewById(
+ R.id.reuse_actionbar);
+ reuse_actionbar.addView(hintTv, params);
+
//修改沉浸栏以及ActionBar 颜色
mActionbar.setBackgroundColor(getResources().getColor(R.color.scan_bg));
SystemBarTintManager tintManager = getTintManager();
@@ -103,13 +138,39 @@ public class ChooseReceiverActivity extends BaseActivity implements View.OnClick
}
init();
+
+ hintTv.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ showConnHintDialog();
+ }
+ });
+
+ boolean showConnHintDialog = sp.getBoolean("showConnHintDialog", true);
+ if (showConnHintDialog || (getIntent() != null && getIntent().getExtras() != null
+ && getIntent().getExtras().getBoolean("showConnHintDialog"))) {
+ if (showConnHintDialog) {
+ sp.edit().putBoolean("showConnHintDialog", false).apply();
+ }
+ showConnHintDialog();
+ }
+ }
+
+ private void showConnHintDialog() {
+ DialogUtils.showHintDialog(ChooseReceiverActivity.this, "请告诉你的好友这样操作:", "1.拿出手机,打开光环助手 " +
+ "\n2.点击左上角“↓”按钮 \n3.点击“我要接收”", "确定");
}
@OnClick(R.id.scan_hint)
public void onScanHintListener() {
- DialogUtils.showHintDialog(this, "请告诉你的好友这样操作:", "1.拿出手机,打开光环助手 " +
- "\n2.点击首页左上角,进入下载管理 \n3.点击“零流量传送”,再点击“我要接收”",
- "确定");
+// DialogUtils.showHintDialog(this, "请告诉你的好友这样操作:", "1.拿出手机,打开光环助手 " +
+// "\n2.点击首页左上角,进入下载管理 \n3.点击“零流量传送”,再点击“我要接收”",
+// "确定");
+
+ // TODO 关闭扫描??
+
+ Intent intent = new Intent(this, ShareGhActivity.class);
+ startActivity(intent);
}
private void init() {
@@ -122,7 +183,7 @@ public class ChooseReceiverActivity extends BaseActivity implements View.OnClick
.build();
mScanGif.setController(controller);
- mScanHint.setText(Html.fromHtml(""+"搜不到对方?"+""));
+ mScanHint.setText(Html.fromHtml(""+"好友还没安装光环助手?请点这里"+""));
isStopScan = false;
isDestroy = false;
@@ -225,6 +286,9 @@ public class ChooseReceiverActivity extends BaseActivity implements View.OnClick
//1.连接网络
private void connReceiverWifi(int connPosition) {
+ // 进入动画页面
+ readyAnimView();
+
if (isStopScan) {
return;
}
@@ -271,6 +335,7 @@ public class ChooseReceiverActivity extends BaseActivity implements View.OnClick
startFileSenderServer(ipAddress);
} catch (Exception e) {
isStopScan = false;
+ handler.sendEmptyMessage(0);
Utils.log("UDP通信异常--startFileSenderServer" + e.toString());
e.printStackTrace();
}
@@ -305,6 +370,18 @@ public class ChooseReceiverActivity extends BaseActivity implements View.OnClick
// mDatagramSocket = new DatagramSocket(serverPort);
byte[] receiveData = new byte[1024];
byte[] sendData;
+ Utils.log("=====ip::" + ipAddress);
+ if (!ipAddress.equals("192.168.43.1")) {
+ // 连接失败,可能是连接的热点已经关闭, 关闭动画,开启扫描
+ isStopScan = false;
+ handler.sendEmptyMessage(0);
+ handler.post(new Runnable() {
+ @Override
+ public void run() {
+ connFailedAnimView();
+ }
+ });
+ }
InetAddress ipAddressName = InetAddress.getByName(ipAddress); // 转译
//发送 即将发送的文件列表 到文件接收方
@@ -336,13 +413,13 @@ public class ChooseReceiverActivity extends BaseActivity implements View.OnClick
userMap.put("usericon", String.valueOf(conUserIconTag));
AppController.put("userMap", userMap);
- // 进入文件发送列表界面 (并且通知文件接收方进入文件接收列表界面)
- Intent intent = new Intent(ChooseReceiverActivity.this, FileSenderActivity.class);
- startActivity(intent);
- closeSocket();
- Intent resultIntent= new Intent();
- setResult(0x123, resultIntent);
- finish();
+
+ handler.post(new Runnable() {
+ @Override
+ public void run() {
+ connSuccessAnimView();
+ }
+ });
break;
}
}
@@ -366,21 +443,143 @@ public class ChooseReceiverActivity extends BaseActivity implements View.OnClick
}
}
+ // 连接中-动画
+ private void readyAnimView() {
+
+ mRoketRl.setVisibility(View.VISIBLE);
+ mRoketRl.animate()
+ .alpha(1f)
+ .setDuration(1000)
+ .setListener(null);
+
+ mScaleAnimation = new ScaleAnimation(0.5f, 0.8f, 0.5f, 0.8f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
+ mScaleAnimation.setDuration(250);
+ mScaleAnimation.setRepeatCount(Animation.INFINITE);
+ mScaleAnimation.setRepeatMode(Animation.REVERSE);
+
+ mRoketAnimLeft.startAnimation(mScaleAnimation);
+ mRoketAnimRight.startAnimation(mScaleAnimation);
+ }
+
+ // 连接成功-动画
+ private void connSuccessAnimView() {
+ if (mScaleAnimation != null) {
+ mScaleAnimation.cancel();
+ }
+ AlphaAnimation alphaAnimation = new AlphaAnimation(1f, 0.6f);
+ alphaAnimation.setDuration(250);
+ alphaAnimation.setRepeatCount(Animation.INFINITE);
+ alphaAnimation.setRepeatMode(Animation.REVERSE);
+ mRoketAnimLeft.startAnimation(alphaAnimation);
+ mRoketAnimRight.startAnimation(alphaAnimation);
+
+ mScaleAnimation = new ScaleAnimation(0.5f, 0.8f, 0.5f, 0.8f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
+ mScaleAnimation.setDuration(250);
+ mScaleAnimation.setRepeatCount(Animation.INFINITE);
+ mScaleAnimation.setRepeatMode(Animation.REVERSE);
+
+ mRoketAnimLeft.setImageResource(R.drawable.kuaichuan_rocket_fire);
+ mRoketAnimRight.setImageResource(R.drawable.kuaichuan_rocket_fire);
+
+ LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) mRoketAnimRight.getLayoutParams();
+ layoutParams.height = LinearLayout.LayoutParams.MATCH_PARENT;
+ layoutParams.width = DisplayUtils.dip2px(this, 25);
+
+ mRoketAnimRight.setLayoutParams(layoutParams);
+ LinearLayout.LayoutParams layoutParams2 = (LinearLayout.LayoutParams) mRoketAnimLeft.getLayoutParams();
+ layoutParams2.height = LinearLayout.LayoutParams.MATCH_PARENT;
+ layoutParams2.width = DisplayUtils.dip2px(this, 25);
+
+ layoutParams2.setMargins(0, 0, DisplayUtils.dip2px(ChooseReceiverActivity.this, 14), 0);
+ mRoketAnimLeft.setLayoutParams(layoutParams2);
+
+
+ if (mScaleAnimation == null) {
+ mScaleAnimation.cancel();
+ }
+
+ mTranslateAnimation = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, -1000);
+ mTranslateAnimation.setDuration(1000);
+ mTranslateAnimation.setInterpolator(new AccelerateInterpolator(2.0f));
+// mTranslateAnimation.setFillAfter(true);
+
+ mRoketAnimRl.startAnimation(mTranslateAnimation);
+
+ mTranslateAnimation.setAnimationListener(new Animation.AnimationListener() {
+ @Override
+ public void onAnimationStart(Animation animation) {
+
+ }
+
+ @Override
+ public void onAnimationEnd(Animation animation) {
+ mRoketAnimRl.setVisibility(View.GONE);
+ Intent intent = new Intent(ChooseReceiverActivity.this, FileSenderActivity.class);
+ startActivity(intent);
+ closeSocket();
+ Intent resultIntent= new Intent();
+ setResult(0x123, resultIntent);
+ finish();
+ }
+
+ @Override
+ public void onAnimationRepeat(Animation animation) {
+
+ }
+ });
+ }
+
+ // 连接失败-动画
+ private void connFailedAnimView() {
+ Utils.toast(ChooseReceiverActivity.this, "连接失败");
+ if (mScaleAnimation == null) {
+ mScaleAnimation.cancel();
+ }
+ mRoketRl.animate()
+ .alpha(0f)
+ .setDuration(1000)
+ .setListener(new Animator.AnimatorListener() {
+ @Override
+ public void onAnimationStart(Animator animation) {
+
+ }
+
+ @Override
+ public void onAnimationEnd(Animator animation) {
+ mRoketRl.setVisibility(View.GONE);
+ }
+
+ @Override
+ public void onAnimationCancel(Animator animation) {
+
+ }
+
+ @Override
+ public void onAnimationRepeat(Animator animation) {
+
+ }
+
+ });
+ }
+
@Override
public void onBackPressed() {
super.onBackPressed();
closeSocket();
+ AppController.remove("FileInfo");
}
@OnClick(R.id.actionbar_rl_back)
public void onBackListener() {
closeSocket();
+ AppController.remove("FileInfo");
}
@Override
protected void onDestroy() {
super.onDestroy();
isDestroy = true;
+ isStopScan = true;
}
/**
@@ -389,7 +588,7 @@ public class ChooseReceiverActivity extends BaseActivity implements View.OnClick
private void closeSocket(){
isStopScan = true;
if(mDatagramSocket != null) {
- mDatagramSocket.disconnect();
+// mDatagramSocket.disconnect();
mDatagramSocket.close();
mDatagramSocket = null;
}
diff --git a/app/src/main/java/com/gh/gamecenter/CleanApkActivity.java b/app/src/main/java/com/gh/gamecenter/CleanApkActivity.java
index e079dee5fb..32ae73fb75 100644
--- a/app/src/main/java/com/gh/gamecenter/CleanApkActivity.java
+++ b/app/src/main/java/com/gh/gamecenter/CleanApkActivity.java
@@ -51,7 +51,7 @@ public class CleanApkActivity extends BaseActivity implements CleanApkAdapter.On
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
View contentView = View.inflate(this, R.layout.activity_clean_apk, null);
- init(contentView, "选择游戏");
+ init(contentView, "安装包清理");
mNodataSkipLl.setVisibility(View.GONE);
@@ -92,7 +92,7 @@ public class CleanApkActivity extends BaseActivity implements CleanApkAdapter.On
if ("停止扫描".equals(s)) {
mAdapter.isStopScan();
} else {
- if (s.equals("一键删除")) {
+ if (s.equals("立即删除")) {
Utils.toast(CleanApkActivity.this, "请选择需要删除的安装包");
return;
}
@@ -103,7 +103,7 @@ public class CleanApkActivity extends BaseActivity implements CleanApkAdapter.On
for (int i = 0; i < apkList.size(); i++) {
if (selectPosition.get(i) && apkList.get(i).getInstallStatus() == 1) {
DialogUtils.showWarningDialog(CleanApkActivity.this, "删除安装包"
- , "已选的安装包中包含未安装的应用,确定删除吗?", "取消 ", "确定"
+ , "你选择的安装包中包含未安装的应用,确定删除吗?", "取消 ", "确定"
, new DialogUtils.ConfiremListener() {
@Override
public void onConfirem() {
@@ -169,7 +169,7 @@ public class CleanApkActivity extends BaseActivity implements CleanApkAdapter.On
@Override
public void onScanOver() {
- mApkDeleteBtn.setText("一键删除");
+ mApkDeleteBtn.setText("立即删除");
mApkDeleteBtn.setBackgroundResource(R.drawable.game_item_btn_red_style);
long allSize = 0;
diff --git a/app/src/main/java/com/gh/gamecenter/DownloadManagerActivity.java b/app/src/main/java/com/gh/gamecenter/DownloadManagerActivity.java
index 0885d5a55d..7820d80345 100644
--- a/app/src/main/java/com/gh/gamecenter/DownloadManagerActivity.java
+++ b/app/src/main/java/com/gh/gamecenter/DownloadManagerActivity.java
@@ -99,11 +99,12 @@ public class DownloadManagerActivity extends BaseFragmentActivity implements
}
}
if (currentItem == -1) {
- if (updateSize != 0 && downloadSize == 0) {
- currentItem = 1;
- } else {
- currentItem = 0;
- }
+ currentItem = 0;
+// if (updateSize != 0 && downloadSize == 0) {
+// currentItem = 1;
+// } else {
+// currentItem = 0;
+// }
}
DisplayMetrics outMetrics = new DisplayMetrics();
@@ -115,9 +116,9 @@ public class DownloadManagerActivity extends BaseFragmentActivity implements
downloadmanager_slide_line.setLayoutParams(lparams);
List list = new ArrayList<>();
+ list.add(new FileSendFragment());
list.add(new GameDownLoadFragment());
list.add(new GameUpdateFragment());
- list.add(new FileSendFragment());
downloadmanager_viewPager.setAdapter(new FragmentAdapter(getSupportFragmentManager(), list));
downloadmanager_viewPager.addOnPageChangeListener(this);
downloadmanager_viewPager.setCurrentItem(currentItem);
@@ -125,13 +126,13 @@ public class DownloadManagerActivity extends BaseFragmentActivity implements
@Override
public void onPageSelected(int position) {
- if (position == 0) {
- EventBus.getDefault().post(new EBUISwitch("DownloadManagerActivity", 0));
+ if (position == 1) {
+ EventBus.getDefault().post(new EBUISwitch("DownloadManagerActivity", 1));
downloadmanager_tv_download.setTextColor(getResources().getColor(R.color.theme));
downloadmanager_tv_update.setTextColor(getResources().getColor(R.color.title));
downloadmanager_tv_send.setTextColor(getResources().getColor(R.color.title));
- } else if (position == 1){
- EventBus.getDefault().post(new EBUISwitch("DownloadManagerActivity", 1));
+ } else if (position == 2){
+ EventBus.getDefault().post(new EBUISwitch("DownloadManagerActivity", 2));
downloadmanager_tv_download.setTextColor(getResources().getColor(R.color.title));
downloadmanager_tv_update.setTextColor(getResources().getColor(R.color.theme));
downloadmanager_tv_send.setTextColor(getResources().getColor(R.color.title));
@@ -161,11 +162,11 @@ public class DownloadManagerActivity extends BaseFragmentActivity implements
if (id == R.id.actionbar_rl_back) {
finish();
} else if (id == R.id.downloadmanager_ll_download) {
- downloadmanager_viewPager.setCurrentItem(0);
- } else if (id == R.id.downloadmanager_ll_update) {
downloadmanager_viewPager.setCurrentItem(1);
- } else if (id == R.id.downloadmanager_ll_send) {
+ } else if (id == R.id.downloadmanager_ll_update) {
downloadmanager_viewPager.setCurrentItem(2);
+ } else if (id == R.id.downloadmanager_ll_send) {
+ downloadmanager_viewPager.setCurrentItem(0);
}
}
diff --git a/app/src/main/java/com/gh/gamecenter/FileReceiverActivity.java b/app/src/main/java/com/gh/gamecenter/FileReceiverActivity.java
index 1ea0e858b5..d6d8353159 100644
--- a/app/src/main/java/com/gh/gamecenter/FileReceiverActivity.java
+++ b/app/src/main/java/com/gh/gamecenter/FileReceiverActivity.java
@@ -1,6 +1,9 @@
package com.gh.gamecenter;
import android.Manifest;
+import android.content.Context;
+import android.content.Intent;
+import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.os.Environment;
@@ -11,11 +14,14 @@ import android.support.v4.content.ContextCompat;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
+import android.widget.LinearLayout;
+import android.widget.RelativeLayout;
import android.widget.TextView;
import com.facebook.drawee.view.SimpleDraweeView;
import com.gh.base.AppController;
import com.gh.base.BaseActivity;
+import com.gh.common.constant.Config;
import com.gh.common.util.DialogUtils;
import com.gh.common.util.UserIconUtils;
import com.gh.common.util.Utils;
@@ -31,6 +37,7 @@ import com.gh.gamecenter.kuaichuan.FileReceiver;
import com.gh.gamecenter.kuaichuan.HotspotManager;
import com.gh.gamecenter.kuaichuan.IpPortInfo;
import com.gh.gamecenter.kuaichuan.WifiMgr;
+import com.gh.gamecenter.manager.DataCollectionManager;
import org.json.JSONException;
import org.json.JSONObject;
@@ -41,7 +48,9 @@ import java.net.DatagramSocket;
import java.net.ServerSocket;
import java.net.Socket;
import java.text.DecimalFormat;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import butterknife.BindView;
import butterknife.OnClick;
@@ -56,6 +65,11 @@ public class FileReceiverActivity extends BaseActivity implements FileReceiverAd
@BindView(R.id.sender_user_name) TextView mSenderUserName;
@BindView(R.id.sender_user_send_des) TextView mSenderUserDes;
@BindView(R.id.sender_hint) TextView mSenderHint;
+ @BindView(R.id.sender_bottom) LinearLayout mReceiverBottom;
+ @BindView(R.id.sender_keep_send) RelativeLayout mKeepReceiver;
+ @BindView(R.id.sender_keep_send_tv) TextView mKeepReceiverTv;
+ @BindView(R.id.sender_bottom_hint) TextView mReceiverBottomHint;
+ @BindView(R.id.sender_bottom_control) LinearLayout mReceiverControl;
private FileReceiverAdapter mFileReceiverAdapter;
@@ -71,10 +85,14 @@ public class FileReceiverActivity extends BaseActivity implements FileReceiverAd
private DatagramSocket mDatagramSocket;
+ private SharedPreferences sp;
+
private boolean isReceivesOver;
private boolean isOpenWifi; //记录开热点前的WiFi状态
private boolean isDestroy;
+ private long mStartTime;
+
Handler handler = new Handler() {
@Override
public void handleMessage(Message msg) {
@@ -100,16 +118,19 @@ public class FileReceiverActivity extends BaseActivity implements FileReceiverAd
long progress = (long) msg.obj;
fileInfo.setProgress(progress);
fileInfo.setResult(FileInfo.FLAG_DEFAULT);
-
} else if (msg.what == FileInfo.FLAG_SUCCESS) { // 传输成功更新界面
fileInfo.setResult(FileInfo.FLAG_SUCCESS);
- if (index == mFileInfos.size() -1) initSenderHint();
+ if (index == mFileInfos.size() -1) initSenderHint(false);
} else if (msg.what == FileInfo.FLAG_FAILURE) { // 传输失败更新界面
fileInfo.setResult(FileInfo.FLAG_FAILURE);
- if (index == mFileInfos.size() -1) initSenderHint();
+ if (index == mFileInfos.size() -1) initSenderHint(false);
} else if (msg.what == FileInfo.FLAG_CANCEL) { // 传输取消更新界面
fileInfo.setResult(FileInfo.FLAG_CANCEL);
- if (index == mFileInfos.size() -1) initSenderHint();
+ if (index == mFileInfos.size() -1) initSenderHint(false);
+ } else if (msg.what == FileInfo.FLAG_NO_MEMORY) {
+ Utils.toast(FileReceiverActivity.this, "手机空间不足");
+ fileInfo.setResult(FileInfo.FLAG_NO_MEMORY); // 接收方内存不足
+ if (index == mFileInfos.size() -1) initSenderHint(true);
}
Utils.log("FileReceiverActivity:: 刷新位置::" + index + "刷新状态::" + msg.what);
@@ -128,10 +149,6 @@ public class FileReceiverActivity extends BaseActivity implements FileReceiverAd
}
}
Utils.log("FileReceiverActivity:: 获取刷新位置异常" + mFileInfos.size());
- for (FileInfo mFileInfo : mFileInfos) {
- Utils.log("FileReceiverActivity:: 位置异常mFileInfos====" + mFileInfo.getFileTag() + "==" + mFileInfo.getName());
- Utils.log("FileReceiverActivity:: 位置异常mCurFileInfo====" + mCurFileInfo.getFileTag() + "==" + mCurFileInfo.getName());
- }
return -1;
}
@@ -141,7 +158,6 @@ public class FileReceiverActivity extends BaseActivity implements FileReceiverAd
View contentView = View.inflate(this, R.layout.activity_file_sender, null);
init(contentView, "接收游戏");
- isReceivesOver = false;
isDestroy = false;
mFileReceiverAdapter = new FileReceiverAdapter(this);
@@ -153,6 +169,10 @@ public class FileReceiverActivity extends BaseActivity implements FileReceiverAd
mIpPortInfo = (IpPortInfo) getIntent().getSerializableExtra(Constant.KEY_IP_PORT_INFO);
isOpenWifi = getIntent().getBooleanExtra("isOpenWifi", false);
+ mKeepReceiverTv.setText("继续接收");
+
+ sp = getSharedPreferences(Config.PREFERENCE, Context.MODE_PRIVATE);
+
initUserData();
if (ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE)
@@ -164,6 +184,8 @@ public class FileReceiverActivity extends BaseActivity implements FileReceiverAd
}
private void initUserData() {
+ isReceivesOver = false;
+
long allGameSize = 0;
for (FileInfo mFileInfo : mFileInfos) {
allGameSize = allGameSize + mFileInfo.getSize();
@@ -174,8 +196,12 @@ public class FileReceiverActivity extends BaseActivity implements FileReceiverAd
String sizeName = df.format(size) + "MB";
mSenderUserDes.setText(mFileInfos.size() + "个游戏,共" + sizeName);
- mSenderUserName.setText("来自-" + mIpPortInfo.getSenderName());
+ mSenderUserName.setText("来自 " + mIpPortInfo.getSenderName());
mSenderUserIcon.setImageURI(UserIconUtils.getUserIcon(mIpPortInfo.getSenderIcon()));
+
+ mReceiverBottom.setVisibility(View.GONE);
+
+ mSenderHint.setText("已连接");
}
/**
@@ -238,7 +264,7 @@ public class FileReceiverActivity extends BaseActivity implements FileReceiverAd
* @param msg
*/
private void parseFileInfo(String msg) {
- mFileInfos = (List) AppController.get("FileInfo", false); //TODO mFileInfos 数据异常 需要重新获取
+ mFileInfos = (List) AppController.get("FileInfo", false); // mFileInfos 数据异常 需要重新获取
FileInfo fileInfo = FileInfo.toObject(msg);
if(fileInfo != null && fileInfo.getFilePath() != null){
mFileInfos.add(fileInfo);
@@ -256,9 +282,16 @@ public class FileReceiverActivity extends BaseActivity implements FileReceiverAd
// }
- //TODO 接收方发送取消消息 会导致接收列表时无法回复信息 == 将消息整合在一起
Utils.log("接收方发送取消消息 让发送方取消");
+
+
try {
+ // 接收方更改界面
+ FileInfo fileInfo = mFileInfos.get(position);
+ fileInfo.setResult(FileInfo.FLAG_CANCEL);
+ mFileReceiverAdapter.notifyItemChanged(position);
+
+ // 发消息让发送方取消
JSONObject jsonObject = new JSONObject();
jsonObject.put("controlStatus", Constant.MSG_RECEIVER_CANCEL);
jsonObject.put("controlTag", position);
@@ -325,11 +358,12 @@ public class FileReceiverActivity extends BaseActivity implements FileReceiverAd
while (!Thread.currentThread().isInterrupted()){
Socket socket = serverSocket.accept();
- mFileReceiver = new FileReceiver(socket);
+ mFileReceiver = new FileReceiver(socket, FileReceiverActivity.this);
mFileReceiver.setOnReceiveListener(new FileReceiver.OnReceiveListener() {
@Override
public void onStart() {
Utils.log("快传文件接收::onStart");
+ mStartTime = Utils.getTime(FileReceiverActivity.this);
}
@Override
@@ -354,22 +388,42 @@ public class FileReceiverActivity extends BaseActivity implements FileReceiverAd
}
@Override
- public void onSuccess(FileInfo fileInfo) { // 获取传输成功
+ public void onSuccess() { // 获取传输成功
handler.sendEmptyMessage(FileInfo.FLAG_SUCCESS);
- Utils.log("快传文件接收成功::onSuccess");
+
+ // TODO 数据收集
+ long sendTime = Utils.getTime(FileReceiverActivity.this) - mStartTime;
+
+ Map hashMap = new HashMap<>();
+ hashMap.put("send_time", mStartTime);
+ hashMap.put("receive_time", Utils.getTime(FileReceiverActivity.this));
+ hashMap.put("game_name", mCurFileInfo.getName());
+ hashMap.put("package_name", mCurFileInfo.getPackageName());
+ hashMap.put("package_size", mCurFileInfo.getSize());
+ hashMap.put("expend_time", sendTime);
+ hashMap.put("send_nickname", mIpPortInfo.getSenderName());
+ hashMap.put("receive_nickname", mIpPortInfo.getReceiverName());
+ hashMap.put("receive_token", sp.getString("token", null));
+ DataCollectionManager.onEvent(FileReceiverActivity.this, "transfer", hashMap, false);
+ Utils.log("快传文件接收成功::onSuccess:: 发送事件::" + sendTime);
}
@Override
- public void onFailure(Throwable t, FileInfo fileInfo) { // 获取传输失败
+ public void onFailure(Throwable t) { // 获取传输失败
Utils.log("快传文件接收失败::onFailure");
handler.sendEmptyMessage(FileInfo.FLAG_FAILURE);
}
@Override
- public void onCancel(FileInfo fileInfo) { // 获取传输取消
+ public void onCancel() { // 获取传输取消
Utils.log("快传文件接收取消::onCancel");
handler.sendEmptyMessage(FileInfo.FLAG_CANCEL);
}
+
+ @Override
+ public void onNoMemory() {
+ handler.sendEmptyMessage(FileInfo.FLAG_NO_MEMORY);
+ }
});
AppController.MAIN_EXECUTOR.execute(mFileReceiver);
@@ -394,7 +448,12 @@ public class FileReceiverActivity extends BaseActivity implements FileReceiverAd
}
}
- private void initSenderHint(){
+ private void initSenderHint(boolean isNoMemory) {
+
+ mReceiverBottom.setVisibility(View.VISIBLE);
+ mReceiverControl.setVisibility(View.VISIBLE);
+
+
isReceivesOver = true;
int sendSuccess = 0;
for (FileInfo mFileInfo : mFileInfos) {
@@ -403,6 +462,10 @@ public class FileReceiverActivity extends BaseActivity implements FileReceiverAd
}
}
+ if (isNoMemory) {
+ mKeepReceiverTv.setText("手机空间清理");
+ }
+
if (sendSuccess > 0) {
mSenderHint.setVisibility(View.VISIBLE);
mSenderHint.setText("传输结束,成功接收" + sendSuccess + "个游戏");
@@ -429,15 +492,31 @@ public class FileReceiverActivity extends BaseActivity implements FileReceiverAd
isDestroy = true;
}
- @OnClick(R.id.actionbar_rl_back)
- public void back() {
- backHint();
+ @OnClick({R.id.actionbar_rl_back, R.id.sender_keep_send, R.id.sender_back})
+ public void back(View view) {
+ switch (view.getId()) {
+ case R.id.actionbar_rl_back:
+ backHint();
+ break;
+ case R.id.sender_back:
+ backHint();
+ break;
+ case R.id.sender_keep_send:
+ if ("继续接收".equals(mKeepReceiverTv.getText())) {
+ mReceiverControl.setVisibility(View.GONE);
+ } else { // 跳转安装包清理
+ Intent intent = new Intent(this, CleanApkActivity.class);
+ startActivity(intent);
+ }
+ break;
+
+ }
}
private void colsePage() {
if(mDatagramSocket != null) {
- mDatagramSocket.disconnect();
+// mDatagramSocket.disconnect();
mDatagramSocket.close();
mDatagramSocket = null;
}
diff --git a/app/src/main/java/com/gh/gamecenter/FileSenderActivity.java b/app/src/main/java/com/gh/gamecenter/FileSenderActivity.java
index 0a958d139d..2a85fe0bf9 100644
--- a/app/src/main/java/com/gh/gamecenter/FileSenderActivity.java
+++ b/app/src/main/java/com/gh/gamecenter/FileSenderActivity.java
@@ -101,7 +101,6 @@ public class FileSenderActivity extends BaseActivity implements FileSenderAdapte
mFileInfos = (List) AppController.get("FileInfo", false);
- isSendOver = false;
isDestroy = false;
mFileSenderList = new ArrayList<>();
@@ -115,11 +114,9 @@ public class FileSenderActivity extends BaseActivity implements FileSenderAdapte
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
- if (requestCode == 0x178) {
- mFileInfos = (List) AppController.get("FileInfo", false);
+ if (resultCode == 0x130 && requestCode == 0x178) {
mSenderAdapter.notifyDataSetChanged();
initUserData();
- Utils.log("FileSenderActivity:: onActivityResult::" + mFileInfos.size());
new Thread(new Runnable() {
@Override
public void run() {
@@ -214,6 +211,10 @@ public class FileSenderActivity extends BaseActivity implements FileSenderAdapte
JSONObject jsonObject = new JSONObject(response);
int cancelPosition = (int) jsonObject.get("controlTag");
FileSender fileSender = mFileSenderList.get(cancelPosition);
+ Message message = new Message();
+ message.what = FileInfo.FLAG_CANCEL;
+ message.obj = cancelPosition;
+ handler.sendMessage(message);
if (fileSender != null && fileSender.isRunning()) {
Utils.log("接收方取消发送");
fileSender.cancel();
@@ -231,6 +232,8 @@ public class FileSenderActivity extends BaseActivity implements FileSenderAdapte
//初始化用户数据
private void initUserData() {
+ isSendOver = false;
+
Map map = (Map) AppController.get("userMap", false);
long allGameSize = 0;
@@ -243,10 +246,12 @@ public class FileSenderActivity extends BaseActivity implements FileSenderAdapte
String sizeName = df.format(size) + "MB";
mSenderUserDes.setText(mFileInfos.size() + "个游戏,共" + sizeName);
- mSenderUserName.setText("发给-" + map.get("receiverName"));
+ mSenderUserName.setText("发给 " + map.get("receiverName"));
mSenderUserIcon.setImageURI(UserIconUtils.getUserIcon(Integer.parseInt(map.get("usericon"))));
mSenderBottom.setVisibility(View.GONE);
+
+ mSenderHint.setText("已连接");
}
private void initSendServer() throws Exception {
@@ -330,6 +335,12 @@ public class FileSenderActivity extends BaseActivity implements FileSenderAdapte
}
private void initSenderHint(){
+ for (FileInfo mFileInfo : mFileInfos) {
+ if (mFileInfo.getResult() == 0 || mFileInfo.getResult() == 1) { // 还有没完成的任务
+ return;
+ }
+ }
+
mSenderBottom.setVisibility(View.VISIBLE);
int sendSuccess = 0;
@@ -376,9 +387,9 @@ public class FileSenderActivity extends BaseActivity implements FileSenderAdapte
isDestroy = true;
}
- @OnClick({R.id.actionbar_rl_back, R.id.sender_keep_send})
+ @OnClick({R.id.actionbar_rl_back, R.id.sender_keep_send, R.id.sender_back})
public void onClick(View view) {
- if (view.getId() == R.id.actionbar_rl_back) {
+ if (view.getId() == R.id.actionbar_rl_back || view.getId() == R.id.sender_back) {
backHint();
} else if (view.getId() == R.id.sender_keep_send) {
Intent intent = new Intent(this, KcSelectGameActivity.class);
@@ -402,13 +413,16 @@ public class FileSenderActivity extends BaseActivity implements FileSenderAdapte
public void colsePage() {
if(mDatagramSocket != null) {
- mDatagramSocket.disconnect();
+// mDatagramSocket.disconnect();
mDatagramSocket.close();
mDatagramSocket = null;
}
stopAllFileSendingTask();
AppController.remove("FileInfo");
+
+ setResult(0x171);
+ Utils.log("======zz" + 0x171);
FileSenderActivity.this.finish();
}
diff --git a/app/src/main/java/com/gh/gamecenter/KcSelectGameActivity.java b/app/src/main/java/com/gh/gamecenter/KcSelectGameActivity.java
index c7e31b3120..5ca8a61433 100644
--- a/app/src/main/java/com/gh/gamecenter/KcSelectGameActivity.java
+++ b/app/src/main/java/com/gh/gamecenter/KcSelectGameActivity.java
@@ -55,7 +55,7 @@ public class KcSelectGameActivity extends BaseActivity {
mIsConn = false;
}
-
+ selectAll.setVisibility(View.GONE);
mAdapter = new KcSelectGameAdapter(this, mSelectSend);
mSelectRv.setLayoutManager(new LinearLayoutManager(this));
@@ -75,9 +75,7 @@ public class KcSelectGameActivity extends BaseActivity {
for (FileInfo fileInfo : selectData) {
oldInfo.add(fileInfo);
}
-
- AppController.put("FileInfo", oldInfo);
- setResult(0x178);
+ setResult(0x130);
finish();
} else {
AppController.put("FileInfo", selectData);
@@ -108,6 +106,6 @@ public class KcSelectGameActivity extends BaseActivity {
}
});
- installCount.setText("已安装(" + mAdapter.getItemCount() + ")");
+ installCount.setText("已安装的游戏(" + mAdapter.getItemCount() + ")");
}
}
diff --git a/app/src/main/java/com/gh/gamecenter/ReceiverWaitingActivity.java b/app/src/main/java/com/gh/gamecenter/ReceiverWaitingActivity.java
index 10404ca6fb..8afda8689c 100644
--- a/app/src/main/java/com/gh/gamecenter/ReceiverWaitingActivity.java
+++ b/app/src/main/java/com/gh/gamecenter/ReceiverWaitingActivity.java
@@ -4,6 +4,7 @@ import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.SharedPreferences;
+import android.graphics.Color;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
@@ -12,8 +13,6 @@ import android.view.View;
import android.widget.RelativeLayout;
import android.widget.TextView;
-import com.facebook.drawee.backends.pipeline.Fresco;
-import com.facebook.drawee.interfaces.DraweeController;
import com.facebook.drawee.view.SimpleDraweeView;
import com.gh.base.AppController;
import com.gh.base.BaseActivity;
@@ -21,6 +20,7 @@ import com.gh.common.constant.Config;
import com.gh.common.util.RandomUtils;
import com.gh.common.util.UserIconUtils;
import com.gh.common.util.Utils;
+import com.gh.common.view.RadarLayout;
import com.gh.gamecenter.kuaichuan.BaseTransfer;
import com.gh.gamecenter.kuaichuan.Constant;
import com.gh.gamecenter.kuaichuan.FileInfo;
@@ -40,7 +40,6 @@ import java.util.ArrayList;
import java.util.List;
import butterknife.BindView;
-import butterknife.OnClick;
/**
* Created by khy on 2017/1/20.
@@ -51,9 +50,10 @@ public class ReceiverWaitingActivity extends BaseActivity {
@BindView(R.id.waiting_user_name) TextView mUserName;
@BindView(R.id.waiting_user_status) TextView mUserStatus;
@BindView(R.id.waiting_conn) TextView mWaitingConn;
- @BindView(R.id.waiting_gif) SimpleDraweeView mWaitingGif;
+ @BindView(R.id.waiting_radar_layout) RadarLayout mRadarLayout;
@BindView(R.id.waiting_hint) TextView mWaitingHint;
@BindView(R.id.reuse_actionbar) RelativeLayout mActionbar;
+ @BindView(R.id.waiting_gprs_hint) TextView mGPRSHint;
private WifiAPBroadcastReceiver mWifiAPBroadcastReceiver;
@@ -117,15 +117,16 @@ public class ReceiverWaitingActivity extends BaseActivity {
}
mUserStatus.setText("正在初始化...");
- DraweeController controller = Fresco.newDraweeControllerBuilder()
- .setUri("res:///" + R.drawable.kuaichuan_receiver_waiting)
- .setAutoPlayAnimations(true)
- .build();
- mWaitingGif.setController(controller);
+ mRadarLayout.setUseRing(true);
+ mRadarLayout.setColor(Color.WHITE);
+ mRadarLayout.setCount(4);
+ mRadarLayout.start();
mFileInfos = new ArrayList<>();
+ HotspotManager.initApData(this); // 记录原始热点信息
+
//初始化热点
if(HotspotManager.isApOn(this)){
HotspotManager.disableAp(this);
@@ -134,7 +135,7 @@ public class ReceiverWaitingActivity extends BaseActivity {
mWifiAPBroadcastReceiver = new WifiAPBroadcastReceiver() {
@Override
public void onWifiApEnabled() {
- if(!mIsInitialized){
+ if(!mIsInitialized) {
mUdpServerRuannable = createSendMsgToFileSenderRunnable();
AppController.MAIN_EXECUTOR.execute(mUdpServerRuannable);
mIsInitialized = true;
@@ -142,6 +143,8 @@ public class ReceiverWaitingActivity extends BaseActivity {
mWaitingConn.setVisibility(View.VISIBLE);
mUserStatus.setText(Html.fromHtml("成功创建热点:" + "" + mySsid + ""));
mWaitingHint.setVisibility(View.GONE);
+ mUserName.setVisibility(View.GONE);
+ mGPRSHint.setVisibility(View.VISIBLE);
}
}
@@ -159,6 +162,20 @@ public class ReceiverWaitingActivity extends BaseActivity {
}
mySsid = mySsid + sp.getInt("default_user_icon", 1);
HotspotManager.configApState(this, mySsid); // change Ap state :boolean
+
+ findViewById(R.id.actionbar_rl_back).setOnClickListener(
+ new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ colsePage();
+ //关闭热点
+ HotspotManager.disableAp(ReceiverWaitingActivity.this);
+
+ if (isOpenWifi) {
+ WifiMgr.getInstance(ReceiverWaitingActivity.this).openWifi();
+ }
+ }
+ });
}
/**
@@ -232,7 +249,8 @@ public class ReceiverWaitingActivity extends BaseActivity {
Message message = new Message();
message.what = 0;
JSONObject jsonObject = new JSONObject(msg);
- message.obj = new IpPortInfo(inetAddress, port, jsonObject.getString(Constant.MSG_FILE_RECEIVER_INIT), jsonObject.getInt("UserIcon"));
+ message.obj = new IpPortInfo(inetAddress, port, jsonObject.getString(Constant.MSG_FILE_RECEIVER_INIT),
+ sp.getString("user_name", "光环用户"),jsonObject.getInt("UserIcon"));
mHandler.sendMessage(message);
} else {
@@ -260,23 +278,23 @@ public class ReceiverWaitingActivity extends BaseActivity {
*/
private void closeSocket(){
if(mDatagramSocket != null){
- mDatagramSocket.disconnect();
+// mDatagramSocket.disconnect();
mDatagramSocket.close();
mDatagramSocket = null;
}
}
- @OnClick(R.id.actionbar_rl_back)
- public void back() {
- colsePage();
-
- //关闭热点
- HotspotManager.disableAp(this);
-
- if (isOpenWifi) {
- WifiMgr.getInstance(this).openWifi();
- }
- }
+// @OnClick(R.id.actionbar_rl_back)
+// public void onBackListener() {
+// Utils.log("=========back");
+// colsePage();
+// //关闭热点
+// HotspotManager.disableAp(this);
+//
+// if (isOpenWifi) {
+// WifiMgr.getInstance(this).openWifi();
+// }
+// }
@Override
public void onBackPressed() {
@@ -284,7 +302,7 @@ public class ReceiverWaitingActivity extends BaseActivity {
colsePage();
//关闭热点
- HotspotManager.disableAp(this);
+ HotspotManager.initUserAp(ReceiverWaitingActivity.this);
if (isOpenWifi) {
WifiMgr.getInstance(this).openWifi();
@@ -295,6 +313,8 @@ public class ReceiverWaitingActivity extends BaseActivity {
* 关闭广播并关闭Socket流
*/
private void colsePage() {
+ mRadarLayout.stop();
+
try {
if(mWifiAPBroadcastReceiver != null){
unregisterReceiver(mWifiAPBroadcastReceiver);
diff --git a/app/src/main/java/com/gh/gamecenter/SelectUserIconActivity.java b/app/src/main/java/com/gh/gamecenter/SelectUserIconActivity.java
index 14a6abd41c..4db2e16072 100644
--- a/app/src/main/java/com/gh/gamecenter/SelectUserIconActivity.java
+++ b/app/src/main/java/com/gh/gamecenter/SelectUserIconActivity.java
@@ -9,14 +9,30 @@ import android.os.Bundle;
import android.provider.MediaStore;
import android.view.View;
import android.widget.TextView;
+import android.widget.Toast;
import com.gh.base.BaseActivity;
import com.gh.common.constant.Config;
-import com.gh.common.util.UserIconUtils;
+import com.gh.common.util.TokenUtils;
import com.gh.common.util.Utils;
+import com.gh.gamecenter.retrofit.JSONObjectResponse;
+import com.gh.gamecenter.retrofit.RetrofitManager;
+
+import org.json.JSONObject;
+
+import java.util.HashMap;
+import java.util.Map;
import butterknife.BindView;
import butterknife.OnClick;
+import okhttp3.MediaType;
+import okhttp3.RequestBody;
+import okhttp3.ResponseBody;
+import retrofit2.adapter.rxjava.HttpException;
+import rx.Observable;
+import rx.android.schedulers.AndroidSchedulers;
+import rx.functions.Func1;
+import rx.schedulers.Schedulers;
/**
* Created by khy on 2017/2/10.
@@ -108,11 +124,65 @@ public class SelectUserIconActivity extends BaseActivity {
}
public void postUserIocn(int i) {
- sp.edit().putInt("default_user_icon", i).apply();
- Intent intent = new Intent();
- intent.putExtra("url", UserIconUtils.getUserIcon(i));
- setResult(0x125, intent);
- finish();
+ postDefaultIcon(true, i);
+ }
+
+ public void postDefaultIcon(boolean isCheck, final int i) {
+ TokenUtils.getToken(this, isCheck)
+ .flatMap(new Func1>() {
+ @Override
+ public Observable call(String token) {
+ Map params = new HashMap<>();
+ params.put("icon_key" , "icon" + i);
+ RequestBody body = RequestBody.create(MediaType.parse("application/json"),
+ new JSONObject(params).toString());
+ return RetrofitManager.getUser().postDefaultIcon(token, body);
+ }
+ })
+ .subscribeOn(Schedulers.io())
+ .observeOn(AndroidSchedulers.mainThread())
+ .subscribe(new JSONObjectResponse(){
+ @Override
+ public void onResponse(JSONObject response) {
+ super.onResponse(response);
+ try {
+ String icon = response.getString("icon");
+
+ sp.edit().putInt("default_user_icon", i).apply();
+ Intent intent = new Intent();
+ intent.putExtra("url", icon);
+ setResult(0x125, intent);
+ finish();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ @Override
+ public void onFailure(HttpException e) {
+ super.onFailure(e);
+ if (e != null) {
+ if (e.code() == 401) {
+ postDefaultIcon(true, i);
+ return;
+ }
+
+ if (e.code() == 403) {
+ try {
+ JSONObject response = new JSONObject(new String(e.response().errorBody().bytes()));
+ if ("too frequent".equals(response.getString("detail"))) {
+ Toast.makeText(SelectUserIconActivity.this, "修改太频繁", Toast.LENGTH_SHORT).show();
+ } else {
+ Toast.makeText(SelectUserIconActivity.this, "修改失败", Toast.LENGTH_SHORT).show();
+ }
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ Toast.makeText(SelectUserIconActivity.this, "修改失败", Toast.LENGTH_SHORT).show();
+ }
+ }
+ }
+ }
+ }
+ );
}
}
diff --git a/app/src/main/java/com/gh/gamecenter/ShareGhActivity.java b/app/src/main/java/com/gh/gamecenter/ShareGhActivity.java
index 6a06bad6ad..6335cc6b79 100644
--- a/app/src/main/java/com/gh/gamecenter/ShareGhActivity.java
+++ b/app/src/main/java/com/gh/gamecenter/ShareGhActivity.java
@@ -57,7 +57,7 @@ public class ShareGhActivity extends BaseActivity {
ClipboardManager cmb = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
cmb.setText("http://www.ghzhushou.com?source=appshare100");
- Utils.toast(this, "网址复制成功");
+ Utils.toast(this, "网址复制成功,请到微信/QQ粘贴分享");
}
diff --git a/app/src/main/java/com/gh/gamecenter/ShareGhWfifActivity.java b/app/src/main/java/com/gh/gamecenter/ShareGhWfifActivity.java
index e5e5d166ba..7bbb055646 100644
--- a/app/src/main/java/com/gh/gamecenter/ShareGhWfifActivity.java
+++ b/app/src/main/java/com/gh/gamecenter/ShareGhWfifActivity.java
@@ -3,8 +3,13 @@ package com.gh.gamecenter;
import android.content.Context;
import android.content.IntentFilter;
import android.content.SharedPreferences;
+import android.graphics.Color;
import android.os.Bundle;
+import android.text.Html;
import android.view.View;
+import android.widget.ImageView;
+import android.widget.LinearLayout;
+import android.widget.ProgressBar;
import android.widget.TextView;
import com.gh.base.AppController;
@@ -21,7 +26,6 @@ import com.gh.gamecenter.kuaichuan.HtmlUriHandler;
import com.gh.gamecenter.kuaichuan.ImageUriHandler;
import com.gh.gamecenter.kuaichuan.KcUriHandler;
import com.gh.gamecenter.kuaichuan.WifiMgr;
-import com.gh.gamecenter.kuaichuan.WifiUtils;
import com.gh.gamecenter.receiver.WifiAPBroadcastReceiver;
import java.io.IOException;
@@ -41,7 +45,12 @@ import butterknife.OnClick;
*/
public class ShareGhWfifActivity extends BaseActivity {
- @BindView(R.id.hotspot_name) TextView mHotSpotName;
+// @BindView(R.id.hotspot_name) TextView mHotSpotName;
+ @BindView(R.id.init_hotpost_pb) ProgressBar mInitHotspostPb;
+ @BindView(R.id.init_status_icon) ImageView mInitStatusIcon;
+ @BindView(R.id.init_status_tv) TextView mInitStatusTv;
+ @BindView(R.id.init_hotpost_hint) TextView mInitHotpostHint;
+ @BindView(R.id.init_success_ll) LinearLayout mInitSuccessLl;
private ServerSocket mServerSocket;
@@ -57,13 +66,15 @@ public class ShareGhWfifActivity extends BaseActivity {
private boolean isOpenWifi; //记录开热点前的WiFi状态
+ private boolean initSuccess;
+
private String mySsid;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
View contentView = View.inflate(this, R.layout.activity_share_gh_wifi, null);
- init(contentView, "分享光环");
+ init(contentView, "免流量分享");
ButterKnife.bind(this);
mUriHandlers = new ArrayList<>();
@@ -73,13 +84,16 @@ public class ShareGhWfifActivity extends BaseActivity {
sp = getSharedPreferences(Config.PREFERENCE, Context.MODE_PRIVATE);
isColseActivity = false;
+ initSuccess = false;
if (WifiMgr.getInstance(this).isWifiEnable()) {
isOpenWifi = true;
WifiMgr.getInstance(this).closeWifi();
}
+ HotspotManager.initApData(this); // 记录原始热点信息
+ initHotSpotView(0);
initHotSpot();
}
@@ -93,7 +107,7 @@ public class ShareGhWfifActivity extends BaseActivity {
Utils.log("===初始化热点成功");
AppController.MAIN_EXECUTOR.execute(checkHotSpot());
mIsInitialized = true;
- mHotSpotName.setText(mySsid);
+// mHotSpotName.setText(mySsid);
}
}
@@ -114,6 +128,42 @@ public class ShareGhWfifActivity extends BaseActivity {
HotspotManager.configApState(this, mySsid); // change Ap state :boolean
}
+ /**
+ * 初始化创建热点View
+ * @param i i=0 初始化中, i=1 初始化成功, i=2 初始化失败
+ */
+
+ public void initHotSpotView(int i) {
+ switch (i) {
+ case 0:
+ mInitHotspostPb.setVisibility(View.VISIBLE);
+ mInitStatusIcon.setVisibility(View.GONE);
+ mInitStatusTv.setText("正在创建热点...");
+ mInitStatusTv.setTextColor(getResources().getColor(R.color.title));
+ mInitHotpostHint.setVisibility(View.VISIBLE);
+ mInitHotpostHint.setText("如果出现获取权限的提示,请点击允许");
+ break;
+ case 1:
+ mInitStatusIcon.setVisibility(View.VISIBLE);
+ mInitStatusIcon.setImageResource(R.drawable.kc_checkbox_select);
+ mInitStatusTv.setText(Html.fromHtml("热点创建成功:" + "" + mySsid + ""));
+ mInitHotpostHint.setVisibility(View.VISIBLE);
+ mInitHotpostHint.setText("为了避免消耗流量,请关闭你手机的移动网络");
+ mInitHotspostPb.setVisibility(View.GONE);
+ mInitSuccessLl.setVisibility(View.VISIBLE);
+ initSuccess = true;
+ break;
+ case 2:
+ mInitStatusIcon.setVisibility(View.VISIBLE);
+ mInitStatusIcon.setImageResource(R.drawable.hotspot_failed_icon);
+ mInitStatusTv.setText("初始化失败, 请退出重试");
+ mInitStatusTv.setTextColor(Color.parseColor("#ff4147"));
+ mInitHotpostHint.setVisibility(View.VISIBLE);
+ mInitHotspostPb.setVisibility(View.GONE);
+ break;
+ }
+ }
+
private Runnable checkHotSpot() {
return new Runnable() {
@Override
@@ -129,11 +179,11 @@ public class ShareGhWfifActivity extends BaseActivity {
}
// 即使热点wifi的IP地址也是无法连接网络 所以采取此策略
- count = 0;
- while(!WifiUtils.pingIpAddress(hotspotIpAddr) && count < Constant.DEFAULT_TRY_TIME){
- Thread.sleep(500);
- count ++;
- }
+// count = 0;
+// while(!WifiUtils.pingIpAddress(hotspotIpAddr) && count < Constant.DEFAULT_TRY_TIME){
+// Thread.sleep(500);
+// count ++;
+// }
} catch(Exception e) {
Utils.log("==热点启动异常::" + e.toString());
}
@@ -158,6 +208,15 @@ public class ShareGhWfifActivity extends BaseActivity {
}
while (!isColseActivity) {
+ if (!initSuccess) {
+ mInitStatusTv.post(new Runnable() {
+ @Override
+ public void run() {
+ initHotSpotView(1);
+ }
+ });
+ }
+
Utils.log("===循环等待客户端请求");
Socket socket = mServerSocket.accept();
KcWebRequestEntity requestEntity = hanlderSocket(socket);
@@ -175,6 +234,15 @@ public class ShareGhWfifActivity extends BaseActivity {
} catch (IOException e) {
Utils.log("===网页传下载出现异常" + e.toString());
e.printStackTrace();
+
+ if (!e.toString().contains("Socket closed")) {
+ mInitStatusTv.post(new Runnable() {
+ @Override
+ public void run() {
+ initHotSpotView(2);
+ }
+ });
+ }
}
}
}).start();
@@ -251,7 +319,7 @@ public class ShareGhWfifActivity extends BaseActivity {
}
}
- HotspotManager.disableAp(ShareGhWfifActivity.this);
+ HotspotManager.initUserAp(ShareGhWfifActivity.this);
if (isOpenWifi) {
WifiMgr.getInstance(ShareGhWfifActivity.this).openWifi();
}
diff --git a/app/src/main/java/com/gh/gamecenter/adapter/CleanApkAdapter.java b/app/src/main/java/com/gh/gamecenter/adapter/CleanApkAdapter.java
index fce956c141..65166342e0 100644
--- a/app/src/main/java/com/gh/gamecenter/adapter/CleanApkAdapter.java
+++ b/app/src/main/java/com/gh/gamecenter/adapter/CleanApkAdapter.java
@@ -4,10 +4,12 @@ import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
+import android.database.Cursor;
import android.graphics.Color;
import android.graphics.drawable.Drawable;
-import android.os.Environment;
+import android.net.Uri;
import android.os.Handler;
+import android.provider.MediaStore;
import android.support.v4.util.ArrayMap;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
@@ -76,7 +78,7 @@ public class CleanApkAdapter extends RecyclerView.Adapter 0) {
- for (File file_str : files) {
- FindAllAPKFile(file_str);
- }
+ handler.post(new Runnable() {
+ @Override
+ public void run() {
+ notifyItemInserted((mApkList.size() - 1));
+ }
+ });
+ } while (cursor.moveToNext());
}
}
+ cursor.close();
}
private int doType(PackageManager pm, String packageName) {
diff --git a/app/src/main/java/com/gh/gamecenter/adapter/FileReceiverAdapter.java b/app/src/main/java/com/gh/gamecenter/adapter/FileReceiverAdapter.java
index 61d80d0562..2eb97a98c8 100644
--- a/app/src/main/java/com/gh/gamecenter/adapter/FileReceiverAdapter.java
+++ b/app/src/main/java/com/gh/gamecenter/adapter/FileReceiverAdapter.java
@@ -72,9 +72,22 @@ public class FileReceiverAdapter extends RecyclerView.Adapter gameList;
+ private List sendOverList; //发送过的游戏
+
private int cardMargin;
public KcSelectGameAdapter(KcSelectGameActivity activity, TextView selectCount) {
@@ -54,6 +57,8 @@ public class KcSelectGameAdapter extends RecyclerView.Adapter();
selectPosition = new HashMap<>();
+ sendOverList = (List) AppController.get("FileInfo", false);
+
cardMargin = (int) context.getResources().getDimension(R.dimen.cardview_margin);
@@ -170,11 +175,20 @@ public class KcSelectGameAdapter extends RecyclerView.Adapter" + sizeName + "");
holder.gameSize.setText(spanned);
- holder.gameNameAndSize.setText(gameEntity.getGameName());
holder.gameDes.setText("版本:V" + gameEntity.getGameVersion());
holder.gameThumb.setImageBitmap(gameEntity.getGameBm());
+ holder.gameNameAndSize.setText(gameEntity.getGameName());
+ holder.gameNameAndSize.setTextColor(context.getResources().getColor(R.color.title));
+ if (sendOverList != null && sendOverList.size() > 0) {
+ for (FileInfo fileInfo : sendOverList) {
+ if (fileInfo.getFilePath().equals(gameEntity.getGamePath())) {
+ holder.gameNameAndSize.setTextColor(context.getResources().getColor(R.color.hint));
+ break;
+ }
+ }
+ }
holder.selectCB.setVisibility(View.VISIBLE);
if (selectPosition.get(i)) {
@@ -185,27 +199,47 @@ public class KcSelectGameAdapter extends RecyclerView.Adapter getSelectData() {
diff --git a/app/src/main/java/com/gh/gamecenter/adapter/viewholder/GameNormalSwipeViewHolder.java b/app/src/main/java/com/gh/gamecenter/adapter/viewholder/GameNormalSwipeViewHolder.java
index 8804e55d49..5ac1f9e6c9 100644
--- a/app/src/main/java/com/gh/gamecenter/adapter/viewholder/GameNormalSwipeViewHolder.java
+++ b/app/src/main/java/com/gh/gamecenter/adapter/viewholder/GameNormalSwipeViewHolder.java
@@ -31,6 +31,7 @@ public class GameNormalSwipeViewHolder extends RecyclerView.ViewHolder {
public CardLinearLayout cardView;
public SwipeLayout swipeLayout;
public TextView swipeText;
+ public TextView swipeShareText;
public GameNormalSwipeViewHolder(View itemView) {
super(itemView);
@@ -49,6 +50,7 @@ public class GameNormalSwipeViewHolder extends RecyclerView.ViewHolder {
cardView = (CardLinearLayout) itemView.findViewById(R.id.home1_game_card);
swipeLayout = (SwipeLayout) itemView.findViewById(R.id.swipeLayout);
swipeText = (TextView) itemView.findViewById(R.id.swipe_text);
+ swipeShareText = (TextView) itemView.findViewById(R.id.swipe_share_text);
}
}
diff --git a/app/src/main/java/com/gh/gamecenter/adapter/viewholder/KcSelectGameViewHolder.java b/app/src/main/java/com/gh/gamecenter/adapter/viewholder/KcSelectGameViewHolder.java
index beaaa1efe6..a3b7582278 100644
--- a/app/src/main/java/com/gh/gamecenter/adapter/viewholder/KcSelectGameViewHolder.java
+++ b/app/src/main/java/com/gh/gamecenter/adapter/viewholder/KcSelectGameViewHolder.java
@@ -9,7 +9,6 @@ import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.TextView;
-import com.facebook.drawee.view.SimpleDraweeView;
import com.gh.gamecenter.R;
import butterknife.BindView;
@@ -21,7 +20,7 @@ import butterknife.ButterKnife;
public class KcSelectGameViewHolder extends RecyclerView.ViewHolder{
@BindView(R.id.select_game_order) public TextView gameOrder;
- @BindView(R.id.select_game_thumb) public SimpleDraweeView gameThumb;
+ @BindView(R.id.select_game_thumb) public ImageView gameThumb;
@BindView(R.id.select_game_nameAndsize) public TextView gameNameAndSize;
@BindView(R.id.select_game_btn) public CheckBox selectCB;
@BindView(R.id.select_game_des) public TextView gameDes;
@@ -33,6 +32,7 @@ public class KcSelectGameViewHolder extends RecyclerView.ViewHolder{
@BindView(R.id.select_download_speed) public TextView downloadSpeed;
@BindView(R.id.send_over_icon) public ImageView sendOverIcon;
@BindView(R.id.select_game_rl) public RelativeLayout selectGameRl;
+ @BindView(R.id.select_game_cb_rl) public RelativeLayout checkBoxRl;
public KcSelectGameViewHolder(View itemView) {
super(itemView);
diff --git a/app/src/main/java/com/gh/gamecenter/download/FileSendFragment.java b/app/src/main/java/com/gh/gamecenter/download/FileSendFragment.java
index 160ccc72df..22c4651a00 100644
--- a/app/src/main/java/com/gh/gamecenter/download/FileSendFragment.java
+++ b/app/src/main/java/com/gh/gamecenter/download/FileSendFragment.java
@@ -10,6 +10,7 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
+import com.gh.common.util.Utils;
import com.gh.gamecenter.CleanApkActivity;
import com.gh.gamecenter.KcSelectGameActivity;
import com.gh.gamecenter.R;
@@ -39,7 +40,7 @@ public class FileSendFragment extends Fragment {
@Override
public void onClick(View v) {
Intent intent = new Intent(getActivity(), KcSelectGameActivity.class);
- getActivity().startActivity(intent);
+ startActivityForResult(intent, 0x170);
}
});
@@ -76,4 +77,12 @@ public class FileSendFragment extends Fragment {
return view;
}
+
+ @Override
+ public void onActivityResult(int requestCode, int resultCode, Intent data) {
+ Utils.log("======zzzz" + 0x170 + "===" + 0x171 + "==" + requestCode + "==" + resultCode);
+ if (requestCode == 0x170 && resultCode == 0x171) {
+ Utils.toast(getContext(), "显示弹窗啦");
+ }
+ }
}
diff --git a/app/src/main/java/com/gh/gamecenter/kuaichuan/FileInfo.java b/app/src/main/java/com/gh/gamecenter/kuaichuan/FileInfo.java
index 66c98d5c06..e46e1cab9b 100644
--- a/app/src/main/java/com/gh/gamecenter/kuaichuan/FileInfo.java
+++ b/app/src/main/java/com/gh/gamecenter/kuaichuan/FileInfo.java
@@ -16,6 +16,7 @@ public class FileInfo implements Serializable {
* 文件传输的标识
*/
// -1 失败 0 发送中 1 成功 2发送取消 3已安装
+ public static final int FLAG_NO_MEMORY =5;
public static final int FLAG_INSTALLED = 4;
public static final int FLAG_CANCEL = 3;
public static final int FLAG_SUCCESS = 2;
diff --git a/app/src/main/java/com/gh/gamecenter/kuaichuan/FileReceiver.java b/app/src/main/java/com/gh/gamecenter/kuaichuan/FileReceiver.java
index 7babad729b..7f762670c8 100644
--- a/app/src/main/java/com/gh/gamecenter/kuaichuan/FileReceiver.java
+++ b/app/src/main/java/com/gh/gamecenter/kuaichuan/FileReceiver.java
@@ -1,10 +1,14 @@
package com.gh.gamecenter.kuaichuan;
+import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Environment;
+import android.text.TextUtils;
+import com.gh.common.util.FileUtils;
import com.gh.common.util.Utils;
+import com.gh.gamecenter.FileReceiverActivity;
import java.io.File;
import java.io.FileOutputStream;
@@ -12,6 +16,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;
+import java.text.DecimalFormat;
/**
@@ -19,6 +24,8 @@ import java.net.Socket;
*/
public class FileReceiver extends BaseTransfer implements Runnable {
+ Context mContext;
+
/**
* Socket的输入输出流
*/
@@ -44,8 +51,9 @@ public class FileReceiver extends BaseTransfer implements Runnable {
OnReceiveListener mOnReceiveListener;
- public FileReceiver(Socket mSocket) {
+ public FileReceiver(Socket mSocket, FileReceiverActivity activity) {
this.mSocket = mSocket;
+ this.mContext = activity;
}
public void setOnReceiveListener(OnReceiveListener mOnReceiveListener) {
@@ -61,7 +69,7 @@ public class FileReceiver extends BaseTransfer implements Runnable {
} catch (Exception e) {
e.printStackTrace();
Utils.log("FileReceiver init() --->>> occur expection" + e.toString());
- if(mOnReceiveListener != null) mOnReceiveListener.onFailure(e, mFileInfo);
+ if(mOnReceiveListener != null) mOnReceiveListener.onFailure(e);
}
//解析头部
@@ -70,7 +78,7 @@ public class FileReceiver extends BaseTransfer implements Runnable {
} catch (Exception e) {
e.printStackTrace();
Utils.log("FileReceiver parseHeader() --->>> occur expection" + e.toString());
- if(mOnReceiveListener != null) mOnReceiveListener.onFailure(e, mFileInfo);
+ if(mOnReceiveListener != null) mOnReceiveListener.onFailure(e);
}
@@ -80,7 +88,7 @@ public class FileReceiver extends BaseTransfer implements Runnable {
} catch (Exception e) {
e.printStackTrace();
Utils.log("FileReceiver parseBody() --->>> occur expection" + e.toString());
- if(mOnReceiveListener != null) mOnReceiveListener.onFailure(e, mFileInfo);
+ if(mOnReceiveListener != null) mOnReceiveListener.onFailure(e);
}
//结束
@@ -89,7 +97,7 @@ public class FileReceiver extends BaseTransfer implements Runnable {
} catch (Exception e) {
e.printStackTrace();
Utils.log("FileReceiver finish() --->>> occur expection"+ e.toString());
- if(mOnReceiveListener != null) mOnReceiveListener.onFailure(e, mFileInfo);
+ if(mOnReceiveListener != null) mOnReceiveListener.onFailure(e);
}
@@ -186,6 +194,12 @@ public class FileReceiver extends BaseTransfer implements Runnable {
long sTime = System.currentTimeMillis();
long eTime = 0;
+
+ double size = (((float)mFileInfo.getSize()/1024)/1024);
+ DecimalFormat df = new DecimalFormat("#.00");
+ String sizeName = df.format(size) + "MB";
+
+ String canDownload = FileUtils.isCanDownload(mContext, sizeName);
while((len=mInputStream.read(bytes)) != -1){
synchronized(LOCK) {
if (mIsPaused) {
@@ -196,6 +210,8 @@ public class FileReceiver extends BaseTransfer implements Runnable {
}
}
+ if (!TextUtils.isEmpty(canDownload)) break; // 内存不足 拒绝接受
+
bos.write(bytes, 0, len);
total = total + len;
eTime = System.currentTimeMillis();
@@ -217,10 +233,16 @@ public class FileReceiver extends BaseTransfer implements Runnable {
long endTime = System.currentTimeMillis();
Utils.log("接收完成对比 游戏总大小:" + fileSize + "游戏接收大小:" + total);
+
+ if (!TextUtils.isEmpty(canDownload)) { // 内存不足回调
+ if(mOnReceiveListener != null) mOnReceiveListener.onNoMemory();
+ return;
+ }
+
if (total == fileSize) {
- if(mOnReceiveListener != null) mOnReceiveListener.onSuccess(mFileInfo);
+ if(mOnReceiveListener != null) mOnReceiveListener.onSuccess();
} else {
- if(mOnReceiveListener != null) mOnReceiveListener.onCancel(mFileInfo);
+ if(mOnReceiveListener != null) mOnReceiveListener.onCancel();
}
}
@@ -280,9 +302,10 @@ public class FileReceiver extends BaseTransfer implements Runnable {
void onStart();
void onGetFileInfo(FileInfo fileInfo);
void onProgress(long progress, long total);
- void onSuccess(FileInfo fileInfo);
- void onFailure(Throwable t, FileInfo fileInfo);
- void onCancel(FileInfo fileInfo);
+ void onSuccess();
+ void onFailure(Throwable t);
+ void onCancel();
+ void onNoMemory();
}
}
diff --git a/app/src/main/java/com/gh/gamecenter/kuaichuan/HotspotManager.java b/app/src/main/java/com/gh/gamecenter/kuaichuan/HotspotManager.java
index 04f4b261a1..f1638f2b7d 100644
--- a/app/src/main/java/com/gh/gamecenter/kuaichuan/HotspotManager.java
+++ b/app/src/main/java/com/gh/gamecenter/kuaichuan/HotspotManager.java
@@ -2,7 +2,12 @@ package com.gh.gamecenter.kuaichuan;
import android.content.Context;
import android.net.wifi.WifiConfiguration;
+import android.net.wifi.WifiManager;
+import android.text.TextUtils;
+import com.gh.common.util.Utils;
+
+import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
/**
@@ -10,6 +15,62 @@ import java.lang.reflect.Method;
*/
public class HotspotManager {
+ private static String apSSID;
+ private static String apKey;
+ private static String apKeyMgmt;
+
+
+ public static void initApData(Context context) {
+ try {
+ WifiManager manager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
+ //拿到getWifiApConfiguration()方法
+ Method method = manager.getClass().getDeclaredMethod("getWifiApConfiguration");
+ //调用getWifiApConfiguration()方法,获取到 热点的WifiConfiguration
+ WifiConfiguration configuration = (WifiConfiguration) method.invoke(manager);
+ apSSID = configuration.SSID;
+ apKey = configuration.preSharedKey;
+ apKeyMgmt = configuration.allowedKeyManagement.toString();
+ Utils.log("=====名称:" + apSSID);
+ Utils.log("=====密码:" + apKey);
+ Utils.log("=====安全:" + apKeyMgmt);
+ } catch (NoSuchMethodException e) {
+ e.printStackTrace();
+ } catch (InvocationTargetException e) {
+ e.printStackTrace();
+ } catch (IllegalAccessException e) {
+ e.printStackTrace();
+ }
+ }
+
+ // 初始化用户热点 回退到原始状态并关闭热点
+ public static void initUserAp(Context context) {
+ android.net.wifi.WifiManager wifimanager = (android.net.wifi.WifiManager) context.getSystemService(context.WIFI_SERVICE);
+ WifiConfiguration wificonfiguration = null;
+ try {
+ wificonfiguration = new WifiConfiguration();
+ wificonfiguration.SSID = apSSID;
+ if (!TextUtils.isEmpty(apKey)) {
+ wificonfiguration.preSharedKey = apKey;
+ wificonfiguration.allowedKeyManagement.set(4); //WPA2_PSK
+ }
+ // if WiFi is on, turn it off
+ if(isApOn(context)) {
+ wifimanager.setWifiEnabled(false);
+ // if ap is on and then disable ap
+ disableAp(context);
+ }
+ Method method = wifimanager.getClass().getMethod("setWifiApConfiguration", WifiConfiguration.class);
+ method.invoke(wifimanager, wificonfiguration);
+ }
+ catch (Exception e) {
+ Utils.log("======" + e.toString());
+ e.printStackTrace();
+ }
+ }
+
+
+
+
//检查热点开关
public static boolean isApOn(Context context) {
android.net.wifi.WifiManager wifimanager = (android.net.wifi.WifiManager) context.getSystemService(context.WIFI_SERVICE);
diff --git a/app/src/main/java/com/gh/gamecenter/kuaichuan/IpPortInfo.java b/app/src/main/java/com/gh/gamecenter/kuaichuan/IpPortInfo.java
index 1bad096a1b..a829c74cb3 100644
--- a/app/src/main/java/com/gh/gamecenter/kuaichuan/IpPortInfo.java
+++ b/app/src/main/java/com/gh/gamecenter/kuaichuan/IpPortInfo.java
@@ -12,11 +12,13 @@ public class IpPortInfo implements Serializable {
private int port;
private String senderName;
private int senderIcon;
+ private String receiverName;
- public IpPortInfo(InetAddress inetAddress, int port, String senderName, int senderIcon) {
+ public IpPortInfo(InetAddress inetAddress, int port, String senderName, String receiverName, int senderIcon) {
this.inetAddress = inetAddress;
this.port = port;
this.senderName = senderName;
+ this.receiverName = receiverName;
this.senderIcon = senderIcon;
}
@@ -51,4 +53,12 @@ public class IpPortInfo implements Serializable {
public void setSenderIcon(int senderIcon) {
this.senderIcon = senderIcon;
}
+
+ public String getReceiverName() {
+ return receiverName;
+ }
+
+ public void setReceiverName(String receiverName) {
+ this.receiverName = receiverName;
+ }
}
diff --git a/app/src/main/java/com/gh/gamecenter/personal/InstallFragmentAdapter.java b/app/src/main/java/com/gh/gamecenter/personal/InstallFragmentAdapter.java
index 623dacaa56..533e29ac8e 100644
--- a/app/src/main/java/com/gh/gamecenter/personal/InstallFragmentAdapter.java
+++ b/app/src/main/java/com/gh/gamecenter/personal/InstallFragmentAdapter.java
@@ -26,6 +26,7 @@ import com.gh.common.util.GameViewUtils;
import com.gh.common.util.PackageUtils;
import com.gh.common.util.PlatformUtils;
import com.gh.common.util.TrafficUtils;
+import com.gh.common.util.Utils;
import com.gh.common.view.SwipeLayout;
import com.gh.download.DownloadManager;
import com.gh.gamecenter.ChooseReceiverActivity;
@@ -63,22 +64,29 @@ class InstallFragmentAdapter extends RecyclerView.Adapter gameList;
private ArrayList sortedList;
- private int cardMargin;
-
//下载用到的map
private ArrayMap> locationMap;
+ private LibaoDao libaoDao;
+
private boolean isRemove;
private boolean isSwipe;
- private LibaoDao libaoDao;
-
private boolean showUserNameHint;
+ private boolean showKcHint;
+
+ private int cardMargin;
+
+ private int maxWidth;
+
+
InstallFragmentAdapter(InstallFragment fragment) {
this.context = fragment.getActivity();
@@ -94,8 +102,11 @@ class InstallFragmentAdapter extends RecyclerView.Adapter runnableGame = cManager.getInstalledGame();
@@ -346,9 +357,18 @@ class InstallFragmentAdapter extends RecyclerView.Adapter 480) {
- holder.swipeText.setPadding(0, 0, DisplayUtils.dip2px(context, 30), 0);
- holder.swipeText.setText("释放分享");
+ Utils.log("==================zzz" + leftOffset + "==" + maxWidth/2);
+ if (leftOffset > maxWidth/2) {
+// holder.swipeText.setPadding(0, 0, DisplayUtils.dip2px(context, 30), 0);
+ holder.swipeText.setVisibility(View.GONE);
+ holder.swipeShareText.setVisibility(View.VISIBLE);
} else {
- holder.swipeText.setPadding(0, 0, DisplayUtils.dip2px(context, 15), 0);
- holder.swipeText.setText("右划分享");
+// holder.swipeText.setPadding(0, 0, DisplayUtils.dip2px(context, 15), 0);
+ holder.swipeText.setVisibility(View.VISIBLE);
+ holder.swipeShareText.setVisibility(View.GONE);
}
}
@@ -520,14 +543,17 @@ class InstallFragmentAdapter extends RecyclerView.Adapter postGhzs(@Header("TOKEN") String token, @Body RequestBody body);
+ @Headers({"Content-Type: application/json", "Accept: application/json"})
+ @POST("icon-default") // 上传用户所使用的助手信息
+ Observable postDefaultIcon(@Header("TOKEN") String token, @Body RequestBody body);
+
}
diff --git a/app/src/main/res/anim/huojian_test_anim.xml b/app/src/main/res/anim/huojian_test_anim.xml
new file mode 100644
index 0000000000..8938d9f075
--- /dev/null
+++ b/app/src/main/res/anim/huojian_test_anim.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable-hdpi/anyshare_scan_anim_rocket_fire.png b/app/src/main/res/drawable-hdpi/anyshare_scan_anim_rocket_fire.png
new file mode 100644
index 0000000000..cfe3f27191
Binary files /dev/null and b/app/src/main/res/drawable-hdpi/anyshare_scan_anim_rocket_fire.png differ
diff --git a/app/src/main/res/drawable-hdpi/hotspot_failed_icon.png b/app/src/main/res/drawable-hdpi/hotspot_failed_icon.png
new file mode 100644
index 0000000000..558758d199
Binary files /dev/null and b/app/src/main/res/drawable-hdpi/hotspot_failed_icon.png differ
diff --git a/app/src/main/res/drawable-hdpi/installfragment_footerview_icon.png b/app/src/main/res/drawable-hdpi/installfragment_footerview_icon.png
index 58b6cf8cc5..fdbfe64a1a 100644
Binary files a/app/src/main/res/drawable-hdpi/installfragment_footerview_icon.png and b/app/src/main/res/drawable-hdpi/installfragment_footerview_icon.png differ
diff --git a/app/src/main/res/drawable-hdpi/kuaichuan_rocket_bg.jpg b/app/src/main/res/drawable-hdpi/kuaichuan_rocket_bg.jpg
new file mode 100644
index 0000000000..2ee71b4141
Binary files /dev/null and b/app/src/main/res/drawable-hdpi/kuaichuan_rocket_bg.jpg differ
diff --git a/app/src/main/res/drawable-hdpi/kuaichuan_rocket_body.png b/app/src/main/res/drawable-hdpi/kuaichuan_rocket_body.png
new file mode 100644
index 0000000000..16ec84b6f6
Binary files /dev/null and b/app/src/main/res/drawable-hdpi/kuaichuan_rocket_body.png differ
diff --git a/app/src/main/res/drawable-hdpi/kuaichuan_rocket_circle.png b/app/src/main/res/drawable-hdpi/kuaichuan_rocket_circle.png
new file mode 100644
index 0000000000..04a52b2f55
Binary files /dev/null and b/app/src/main/res/drawable-hdpi/kuaichuan_rocket_circle.png differ
diff --git a/app/src/main/res/drawable-hdpi/kuaichuan_rocket_fire.png b/app/src/main/res/drawable-hdpi/kuaichuan_rocket_fire.png
new file mode 100644
index 0000000000..6b21e791be
Binary files /dev/null and b/app/src/main/res/drawable-hdpi/kuaichuan_rocket_fire.png differ
diff --git a/app/src/main/res/drawable-nodpi/anyshare_scan_anim_rocket_body.png b/app/src/main/res/drawable-nodpi/anyshare_scan_anim_rocket_body.png
new file mode 100644
index 0000000000..f71694e629
Binary files /dev/null and b/app/src/main/res/drawable-nodpi/anyshare_scan_anim_rocket_body.png differ
diff --git a/app/src/main/res/drawable/sender_hint_bg.xml b/app/src/main/res/drawable/sender_hint_bg.xml
index 016e9a9268..50af017a5f 100644
--- a/app/src/main/res/drawable/sender_hint_bg.xml
+++ b/app/src/main/res/drawable/sender_hint_bg.xml
@@ -2,7 +2,7 @@
-
+
diff --git a/app/src/main/res/layout/activity_choosereceiver.xml b/app/src/main/res/layout/activity_choosereceiver.xml
index e27f273dde..14715ec64e 100644
--- a/app/src/main/res/layout/activity_choosereceiver.xml
+++ b/app/src/main/res/layout/activity_choosereceiver.xml
@@ -6,159 +6,234 @@
-
+ android:layout_height="match_parent">
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ android:layout_height="match_parent">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+ android:layout_marginBottom="100dp"
+ android:text="准备发送中..."
+ android:textColor="@android:color/white"/>
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_clean_apk.xml b/app/src/main/res/layout/activity_clean_apk.xml
index 259c65b7c3..ffeb576c9c 100644
--- a/app/src/main/res/layout/activity_clean_apk.xml
+++ b/app/src/main/res/layout/activity_clean_apk.xml
@@ -54,29 +54,49 @@
android:layout_below="@+id/select_game_installed_ll"
android:layout_above="@+id/delete_bottom"/>
+
+
+
+ android:layout_height="67dp"
+ android:orientation="vertical"
+ android:layout_marginTop="-7dp"
+ android:layout_alignParentBottom="true">
-
+ android:layout_height="7dp"
+ android:background="@drawable/shadow"/>
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_downloadmanager.xml b/app/src/main/res/layout/activity_downloadmanager.xml
index b56054bfc1..1cbd02fe9a 100644
--- a/app/src/main/res/layout/activity_downloadmanager.xml
+++ b/app/src/main/res/layout/activity_downloadmanager.xml
@@ -17,6 +17,22 @@
android:layout_height="35dp"
android:orientation="horizontal" >
+
+
+
+
+
-
-
-
-
+ android:layout_height="67dp"
+ android:orientation="vertical"
+ android:visibility="visible"
+ android:layout_marginTop="-7dp"
+ android:layout_alignParentBottom="true">
+
+
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+ android:background="@android:color/white"
+ android:text="无需操作,请让对方继续发送即可"/>
-
-
-
-
-
+ android:orientation="horizontal"
+ android:background="@android:color/white">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/layout/activity_kc_select_game.xml b/app/src/main/res/layout/activity_kc_select_game.xml
index 6b7113d34d..103100a604 100644
--- a/app/src/main/res/layout/activity_kc_select_game.xml
+++ b/app/src/main/res/layout/activity_kc_select_game.xml
@@ -21,7 +21,7 @@
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center"
- android:layout_marginLeft="12dp" />
+ android:layout_marginLeft="20dp" />
+
+
+ android:layout_marginTop="-7dp"
+ android:orientation="vertical">
-
+
+
+ android:orientation="horizontal"
+ android:background="@android:color/white"
+ android:padding="10dp">
+
+
+
+
diff --git a/app/src/main/res/layout/activity_receiver_waiting.xml b/app/src/main/res/layout/activity_receiver_waiting.xml
index 98a2e50f97..8d0681c4f1 100644
--- a/app/src/main/res/layout/activity_receiver_waiting.xml
+++ b/app/src/main/res/layout/activity_receiver_waiting.xml
@@ -19,18 +19,17 @@
android:layout_marginTop="30dp"
android:layout_marginBottom="30dp">
-
+ android:layout_width="85dp"
+ android:layout_height="85dp"
+ android:layout_centerInParent="true" />
+ android:text="等待发送者连接..."/>
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_share_gh.xml b/app/src/main/res/layout/activity_share_gh.xml
index 260823b9f2..19a127169a 100644
--- a/app/src/main/res/layout/activity_share_gh.xml
+++ b/app/src/main/res/layout/activity_share_gh.xml
@@ -41,6 +41,15 @@
android:textStyle="bold"
android:textColor="@color/theme"/>
+
-
-
diff --git a/app/src/main/res/layout/activity_share_gh_wifi.xml b/app/src/main/res/layout/activity_share_gh_wifi.xml
index ae2612ae57..784b001c32 100644
--- a/app/src/main/res/layout/activity_share_gh_wifi.xml
+++ b/app/src/main/res/layout/activity_share_gh_wifi.xml
@@ -45,137 +45,174 @@
-
+ android:orientation="horizontal"
+ android:gravity="center_vertical">
-
-
-
-
-
+ android:gravity="center_vertical">
-
+
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="45dp"
+ android:layout_marginTop="10dp"
+ android:layout_marginLeft="20dp"
+ android:text="请好友在浏览器中输入以上地址,即可免流量下载"/>
-
+ android:gravity="center_vertical"
+ android:background="@drawable/blue_title_bg"
+ android:layout_marginBottom="25dp">
-
+
-
+
-
-
-
+
-
-
+ android:layout_marginBottom="45dp"
+ android:layout_marginLeft="20dp"
+ android:text="好友下载成功之后,记得退出本页面,即可自动关闭热点"/>
-
-
diff --git a/app/src/main/res/layout/game_normal_item_swipe.xml b/app/src/main/res/layout/game_normal_item_swipe.xml
index 1ca8090c5c..3aa7c5fea5 100644
--- a/app/src/main/res/layout/game_normal_item_swipe.xml
+++ b/app/src/main/res/layout/game_normal_item_swipe.xml
@@ -1,183 +1,200 @@
-
-
-
-
-
-
-
+ android:textSize="15sp"
+ android:gravity="center"
+ android:layout_centerVertical="true"
+ android:textColor="@color/content"
+ android:paddingRight="25dp"
+ android:text="释放分享"/>
-
-
-
-
-
-
-
-
-
+
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:gravity="center_vertical">
+ android:gravity="right"
+ android:textColor="@color/content"
+ android:paddingRight="15dp"
+ android:text="右划分享"/>
+
+
+
+
+
+ android:layout_width="68dp"
+ android:layout_height="74dp">
-
+
-
-
-
-
-
-
-
-
-
+
+ android:orientation="vertical"
+ android:layout_marginLeft="10dp"
+ android:layout_marginRight="8dp">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
+
-
+
-
+
diff --git a/app/src/main/res/layout/installfragment_footerview.xml b/app/src/main/res/layout/installfragment_footerview.xml
index 7efa62a95e..e79c6f0340 100644
--- a/app/src/main/res/layout/installfragment_footerview.xml
+++ b/app/src/main/res/layout/installfragment_footerview.xml
@@ -7,10 +7,22 @@
android:paddingBottom="20dp"
android:gravity="center">
-
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/kc_game_select_item.xml b/app/src/main/res/layout/kc_game_select_item.xml
index efb920b333..7e97aa76d0 100644
--- a/app/src/main/res/layout/kc_game_select_item.xml
+++ b/app/src/main/res/layout/kc_game_select_item.xml
@@ -26,13 +26,12 @@
android:textSize="14sp"
android:visibility="gone"/>
-
+ fresco:roundedCornerRadius="10dp" />
-
+ android:visibility="gone">
+
+
+
+
光环助手
+乐于分享的人是最帅的^_^ 仅限安卓系统 +
+ 零流量下载
diff --git a/app/src/main/java/com/gh/common/util/ShareUtils.java b/app/src/main/java/com/gh/common/util/ShareUtils.java
index ed29c92211..9959a0cd6f 100644
--- a/app/src/main/java/com/gh/common/util/ShareUtils.java
+++ b/app/src/main/java/com/gh/common/util/ShareUtils.java
@@ -230,7 +230,7 @@ public class ShareUtils {
Intent data=new Intent(Intent.ACTION_SENDTO);
data.setData(Uri.parse("mailto:"));
data.putExtra(Intent.EXTRA_SUBJECT, "快来试试光环助手");
- data.putExtra(Intent.EXTRA_TEXT, "我用光环助手一段时间了,在里面可以下载各种热门卡牌手游的加速版,绿色安全,超级省心,做日常效率提高3-5倍!\n" +
+ data.putExtra(Intent.EXTRA_TEXT, "我用光环助手一段时间了,在里面可以下载各种热门卡牌手游的加速版,绿色安全,超级省心,日常效率提高3-5倍!\n" +
"\n" +
"不用肝的感觉真好,快来试试。\n" +
"\n" +
@@ -292,7 +292,7 @@ public class ShareUtils {
}
}
} else {
- title = "不用肝的感觉真好";
+ title = "玩手游不用肝的感觉真好";
summary = "绿色安全的手游加速助手";
}
params.putString(QQShare.SHARE_TO_QQ_TITLE, title);
@@ -333,7 +333,7 @@ public class ShareUtils {
}
}
} else {
- title = "不用肝的感觉真好";
+ title = "玩手游不用肝的感觉真好";
summary = "绿色安全的手游加速助手";
}
@@ -371,7 +371,7 @@ public class ShareUtils {
}
}
} else {
- title = "不用肝的感觉真好";
+ title = "玩手游不用肝的感觉真好";
summary = "绿色安全的手游加速助手";
}
@@ -465,7 +465,7 @@ public class ShareUtils {
}
}
} else {
- smsBody = "这个App可以下载各种热门卡牌手游的加速版,绿色安全,超级省心,做日常效率提高3-5倍!光环助手官网:" + shareUrl;
+ smsBody = "这个App可以下载各种热门卡牌手游的加速版,绿色安全,超级省心,日常效率提高3-5倍!光环助手官网地址:" + shareUrl;
}
Intent sendIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("smsto:"));
diff --git a/app/src/main/java/com/gh/common/util/UserIconUtils.java b/app/src/main/java/com/gh/common/util/UserIconUtils.java
index 4b627032fb..4c902fbb30 100644
--- a/app/src/main/java/com/gh/common/util/UserIconUtils.java
+++ b/app/src/main/java/com/gh/common/util/UserIconUtils.java
@@ -34,4 +34,27 @@ public class UserIconUtils {
return "res:///" + R.drawable.user_default_icon1;
}
}
+
+ public static String getUserIconUrl(int i) {
+ switch (i) {
+ case 1:
+ return "http://image.ghzhushou.com/pic/default_icon_1.png";
+ case 2:
+ return "http://image.ghzhushou.com/pic/default_icon_2.png";
+ case 3:
+ return "http://image.ghzhushou.com/pic/default_icon_3.png";
+ case 4:
+ return "http://image.ghzhushou.com/pic/default_icon_4.png";
+ case 5:
+ return "http://image.ghzhushou.com/pic/default_icon_5.png";
+ case 6:
+ return "http://image.ghzhushou.com/pic/default_icon_6.png";
+ case 7:
+ return "http://image.ghzhushou.com/pic/default_icon_7.png";
+ case 8:
+ return "http://image.ghzhushou.com/pic/default_icon_8.png";
+ default:
+ return "http://image.ghzhushou.com/pic/default_icon_1.png";
+ }
+ }
}
diff --git a/app/src/main/java/com/gh/common/view/RadarLayout.java b/app/src/main/java/com/gh/common/view/RadarLayout.java
new file mode 100644
index 0000000000..6472e3e30d
--- /dev/null
+++ b/app/src/main/java/com/gh/common/view/RadarLayout.java
@@ -0,0 +1,255 @@
+package com.gh.common.view;
+
+import android.animation.Animator;
+import android.animation.AnimatorSet;
+import android.animation.ObjectAnimator;
+import android.content.Context;
+import android.graphics.Canvas;
+import android.graphics.Color;
+import android.graphics.Paint;
+import android.util.AttributeSet;
+import android.view.View;
+import android.view.animation.LinearInterpolator;
+import android.widget.FrameLayout;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Created by khy on 2017/2/16.
+ * 快传接收方 的雷达动画
+ */
+public class RadarLayout extends FrameLayout {
+
+ public static final int INFINITE = 0;
+
+ private static final int DEFAULT_COUNT = 4;
+ private static final int DEFAULT_COLOR = Color.rgb(0, 116, 193);
+ private static final int DEFAULT_DURATION = 7000;
+ private static final int DEFAULT_REPEAT = INFINITE;
+ private static final int DEFAULT_STROKE_WIDTH = 2;
+
+ private int mCount;
+ private int mDuration;
+ private int mRepeat;
+
+ private AnimatorSet mAnimatorSet;
+
+ private Paint mPaint;
+ private int mColor;
+ private float mRadius;
+ private float mCenterX;
+ private float mCenterY;
+ private int mStrokeWidth;
+ private boolean mIsStarted;
+ private boolean mUseRing;
+
+ public RadarLayout(Context context) {
+ super(context);
+ initGlobalparams();
+ }
+
+ public RadarLayout(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ initGlobalparams();
+ }
+
+ public RadarLayout(Context context, AttributeSet attrs, int defStyleAttr) {
+ super(context, attrs, defStyleAttr);
+ initGlobalparams();
+ }
+
+ private void initGlobalparams() {
+ mColor = DEFAULT_COLOR;
+ mCount = DEFAULT_COUNT;
+ mDuration = DEFAULT_DURATION;
+ mRepeat = DEFAULT_REPEAT;
+ mUseRing = false;
+ mStrokeWidth = dip2px(DEFAULT_STROKE_WIDTH);
+
+ build();
+ }
+
+ public synchronized void start() {
+ if (mAnimatorSet == null || mIsStarted) {
+ return;
+ }
+
+ mAnimatorSet.start();
+ }
+
+ public synchronized void stop() {
+ if (mAnimatorSet == null || !mIsStarted) {
+ return;
+ }
+ mAnimatorSet.end();
+ }
+
+ public synchronized boolean isStarted() {
+ return (mAnimatorSet != null && mIsStarted);
+ }
+
+ public int getCount() {
+ return mCount;
+ }
+
+ public int getDuration() {
+ return mDuration;
+ }
+
+ public void setCount(int count) {
+ if (count < 0) {
+ throw new IllegalArgumentException("Count cannot be negative");
+ }
+
+ if (count != mCount) {
+ mCount = count;
+ reset();
+ invalidate();
+ }
+ }
+
+ public void setDuration(int millis) {
+ if (millis < 0) {
+ throw new IllegalArgumentException("Duration cannot be negative");
+ }
+
+ if (millis != mDuration) {
+ mDuration = millis;
+ reset();
+ invalidate();
+ }
+ }
+
+ public void setColor(int color) {
+ if (mColor != color) {
+ mColor = color;
+ reset();
+ invalidate();
+ }
+ }
+
+ public void setUseRing(boolean useRing) {
+ if (mUseRing != useRing) {
+ mUseRing = useRing;
+ reset();
+ invalidate();
+ }
+ }
+
+ @Override
+ public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
+ super.onMeasure(widthMeasureSpec, heightMeasureSpec);
+
+ int width = getMeasuredWidth() - getPaddingLeft() - getPaddingRight();
+ int height = getMeasuredHeight() - getPaddingTop() - getPaddingBottom();
+
+ // 确定圆的圆点坐标及半径
+ mCenterX = width * 0.5f;
+ mCenterY = height * 0.5f;
+ mRadius = Math.min(width, height) * 0.5f;
+ }
+
+ private void clear() {
+ stop();
+ removeAllViews();
+ }
+
+ private void build() {
+
+ LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
+
+ int repeatCount = (mRepeat == INFINITE) ? ObjectAnimator.INFINITE : mRepeat;
+
+ List animators = new ArrayList();
+ for (int index = 0; index < mCount; index++) {
+ RadarView radarView = new RadarView(getContext());
+ radarView.setScaleX(0);
+ radarView.setScaleY(0);
+ radarView.setAlpha(1);
+
+ addView(radarView, index, params);
+
+ // 计算时间间隔
+ long delay = index * mDuration / mCount;
+
+ // 属性动画
+ animators.add(create(radarView, "scaleX", repeatCount, delay, 0, 1));
+ animators.add(create(radarView, "scaleY", repeatCount, delay, 0, 1));
+ animators.add(create(radarView, "alpha", repeatCount, delay, 1, 0));
+ }
+
+ mAnimatorSet = new AnimatorSet();
+ mAnimatorSet.playTogether(animators);
+ mAnimatorSet.setInterpolator(new LinearInterpolator());
+ mAnimatorSet.setDuration(mDuration);
+ mAnimatorSet.addListener(mAnimatorListener);
+ }
+
+ private ObjectAnimator create(View target, String propertyName, int repeatCount, long delay, float from, float to) {
+ ObjectAnimator animator = ObjectAnimator.ofFloat(target, propertyName, from, to);
+ animator.setRepeatCount(repeatCount);
+ animator.setRepeatMode(ObjectAnimator.RESTART);
+ animator.setStartDelay(delay);
+ return animator;
+ }
+
+ private void reset() {
+ boolean isStarted = isStarted();
+
+ clear();
+ build();
+
+ if (isStarted) {
+ start();
+ }
+ }
+
+ private class RadarView extends View {
+
+ public RadarView(Context context) {
+ super(context);
+ }
+
+ @Override
+ protected void onDraw(Canvas canvas) {
+ if (null == mPaint) {
+ mPaint = new Paint();
+ mPaint.setColor(mColor);
+ mPaint.setAntiAlias(true);
+ // 注意Style的用法,【STROKE:画环】【FILL:画圆】
+ mPaint.setStyle(mUseRing ? Paint.Style.STROKE : Paint.Style.FILL);
+ mPaint.setStrokeWidth(mUseRing ? mStrokeWidth : 0);
+ }
+ // 画圆或环
+ canvas.drawCircle(mCenterX, mCenterY, mUseRing ? mRadius - mStrokeWidth : mRadius, mPaint);
+ }
+ }
+
+ private int dip2px(float dpValue) {
+ final float scale = getResources().getDisplayMetrics().density;
+ return (int) (dpValue * scale + 0.5f);
+ }
+
+ private final Animator.AnimatorListener mAnimatorListener = new Animator.AnimatorListener() {
+
+ @Override
+ public void onAnimationStart(Animator animator) {
+ mIsStarted = true;
+ }
+
+ @Override
+ public void onAnimationEnd(Animator animator) {
+ mIsStarted = false;
+ }
+
+ @Override
+ public void onAnimationCancel(Animator animator) {
+ mIsStarted = false;
+ }
+
+ @Override
+ public void onAnimationRepeat(Animator animator) {
+ }
+ };
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/gh/common/view/SwipeLayout.java b/app/src/main/java/com/gh/common/view/SwipeLayout.java
index 0fbb5d9a24..3c49709c97 100644
--- a/app/src/main/java/com/gh/common/view/SwipeLayout.java
+++ b/app/src/main/java/com/gh/common/view/SwipeLayout.java
@@ -524,7 +524,6 @@ public class SwipeLayout extends FrameLayout {
private int mEventCounter = 0;
protected void dispatchSwipeEvent(int surfaceLeft, int surfaceTop, int dx, int dy) {
- Utils.log("=======dispatchSwipeEvent");
DragEdge edge = getDragEdge();
boolean open = true;
if (edge == DragEdge.Left) {
diff --git a/app/src/main/java/com/gh/gamecenter/ChooseReceiverActivity.java b/app/src/main/java/com/gh/gamecenter/ChooseReceiverActivity.java
index 1b445416a0..ecb4626fd4 100644
--- a/app/src/main/java/com/gh/gamecenter/ChooseReceiverActivity.java
+++ b/app/src/main/java/com/gh/gamecenter/ChooseReceiverActivity.java
@@ -1,14 +1,24 @@
package com.gh.gamecenter;
+import android.animation.Animator;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
+import android.graphics.Color;
import android.net.wifi.ScanResult;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.text.Html;
+import android.view.Gravity;
import android.view.View;
+import android.view.ViewGroup;
+import android.view.animation.AccelerateInterpolator;
+import android.view.animation.AlphaAnimation;
+import android.view.animation.Animation;
+import android.view.animation.ScaleAnimation;
+import android.view.animation.TranslateAnimation;
+import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
@@ -20,6 +30,7 @@ import com.gh.base.AppController;
import com.gh.base.BaseActivity;
import com.gh.common.constant.Config;
import com.gh.common.util.DialogUtils;
+import com.gh.common.util.DisplayUtils;
import com.gh.common.util.UserIconUtils;
import com.gh.common.util.Utils;
import com.gh.gamecenter.kuaichuan.BaseTransfer;
@@ -65,6 +76,12 @@ public class ChooseReceiverActivity extends BaseActivity implements View.OnClick
@BindView(R.id.scan_user_des) TextView mScanUserDes;
@BindView(R.id.reuse_actionbar) RelativeLayout mActionbar;
@BindView(R.id.scan_hint) TextView mScanHint;
+ @BindView(R.id.choosereceiver_roket_anim) RelativeLayout mRoketAnimRl;
+ @BindView(R.id.choosereceiver_ready_rl) RelativeLayout mRoketRl;
+ @BindView(R.id.choosereceiver_roket_anim_bottom) LinearLayout mRoketAnimBottom;
+ @BindView(R.id.choosereceiver_roket_anim_top) ImageView mRoketTop;
+ @BindView(R.id.choosereceiver_roket_left) ImageView mRoketAnimLeft;
+ @BindView(R.id.choosereceiver_roket_right) ImageView mRoketAnimRight;
private List