光环助手V2.4优化汇总(20170302)
This commit is contained in:
@ -9,6 +9,7 @@ import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.os.Parcelable;
|
||||
import android.support.v4.app.ActivityCompat;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
@ -32,6 +33,8 @@ import com.gh.download.DownloadDao;
|
||||
import com.gh.download.DownloadEntity;
|
||||
import com.gh.download.DownloadStatus;
|
||||
import com.gh.gamecenter.adapter.FileReceiverAdapter;
|
||||
import com.gh.gamecenter.eventbus.EBDownloadChanged;
|
||||
import com.gh.gamecenter.eventbus.EBDownloadStatus;
|
||||
import com.gh.gamecenter.eventbus.EBPackage;
|
||||
import com.gh.gamecenter.kuaichuan.BaseTransfer;
|
||||
import com.gh.gamecenter.kuaichuan.Constant;
|
||||
@ -58,6 +61,7 @@ import java.util.Map;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.OnClick;
|
||||
import de.greenrobot.event.EventBus;
|
||||
|
||||
/**
|
||||
* Created by khy on 2017/1/20.
|
||||
@ -115,7 +119,7 @@ public class FileReceiverActivity extends BaseActivity implements FileReceiverAd
|
||||
}
|
||||
|
||||
if (index == -1) {
|
||||
Utils.toast(FileReceiverActivity.this, " 获取刷新位置异常");
|
||||
// Utils.toast(FileReceiverActivity.this, " 获取刷新位置异常");
|
||||
return;
|
||||
}
|
||||
FileInfo fileInfo = mFileInfos.get(index);
|
||||
@ -156,7 +160,9 @@ public class FileReceiverActivity extends BaseActivity implements FileReceiverAd
|
||||
}
|
||||
}
|
||||
Utils.log("FileReceiverActivity:: 获取刷新位置异常" + mFileInfos.size());
|
||||
return -1;
|
||||
mFileInfos.add(mCurFileInfo);
|
||||
|
||||
return mFileInfos.size() - 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -167,16 +173,19 @@ public class FileReceiverActivity extends BaseActivity implements FileReceiverAd
|
||||
|
||||
isDestroy = false;
|
||||
|
||||
mFileReceiverAdapter = new FileReceiverAdapter(this);
|
||||
mReceiverRv.setLayoutManager(new LinearLayoutManager(this));
|
||||
mReceiverRv.setAdapter(mFileReceiverAdapter);
|
||||
|
||||
mFileInfos = (List<FileInfo>) AppController.get("FileInfo", false);
|
||||
// mFileInfos = (List<FileInfo>) AppController.get("FileInfo", false);
|
||||
|
||||
sendData = new ArrayList<>();
|
||||
|
||||
mIpPortInfo = (IpPortInfo) getIntent().getSerializableExtra(Constant.KEY_IP_PORT_INFO);
|
||||
isOpenWifi = getIntent().getBooleanExtra("isOpenWifi", false);
|
||||
ArrayList<Parcelable> list = getIntent().getParcelableArrayListExtra(Constant.KEY_IP_FILE_INFO);
|
||||
mFileInfos = (List<FileInfo>) list.get(0);
|
||||
|
||||
mFileReceiverAdapter = new FileReceiverAdapter(this, mFileInfos);
|
||||
mReceiverRv.setLayoutManager(new LinearLayoutManager(this));
|
||||
mReceiverRv.setAdapter(mFileReceiverAdapter);
|
||||
|
||||
|
||||
mKeepReceiverTv.setText("继续接收");
|
||||
|
||||
@ -190,6 +199,13 @@ public class FileReceiverActivity extends BaseActivity implements FileReceiverAd
|
||||
} else {
|
||||
initServer(); //启动接收服务
|
||||
}
|
||||
|
||||
findViewById(R.id.actionbar_rl_back).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
backHint();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void initUserData() {
|
||||
@ -273,11 +289,12 @@ public class FileReceiverActivity extends BaseActivity implements FileReceiverAd
|
||||
* @param msg
|
||||
*/
|
||||
private void parseFileInfo(String msg) {
|
||||
mFileInfos = (List<FileInfo>) AppController.get("FileInfo", false); // mFileInfos 数据异常 需要重新获取
|
||||
// mFileInfos = (List<FileInfo>) AppController.get("FileInfo", false); // mFileInfos 数据异常 需要重新获取
|
||||
FileInfo fileInfo = FileInfo.toObject(msg);
|
||||
if(fileInfo != null && fileInfo.getFilePath() != null){
|
||||
mFileInfos.add(fileInfo);
|
||||
AppController.put("FileInfo", mFileInfos);
|
||||
Utils.log("FileReceiverActivity 添加一条数据::" + msg);
|
||||
// AppController.put("FileInfo", mFileInfos);
|
||||
|
||||
}
|
||||
}
|
||||
@ -540,7 +557,9 @@ public class FileReceiverActivity extends BaseActivity implements FileReceiverAd
|
||||
break;
|
||||
case R.id.sender_keep_send:
|
||||
if ("继续接收".equals(mKeepReceiverTv.getText())) {
|
||||
mReceiverControl.setVisibility(View.GONE);
|
||||
// mReceiverControl.setVisibility(View.GONE);
|
||||
mKeepReceiverTv.setBackgroundResource(R.drawable.game_item_btn_pause_style);
|
||||
Utils.toast(FileReceiverActivity.this, "无需操作,请让对方继续发送即可");
|
||||
} else { // 跳转安装包清理
|
||||
Intent intent = new Intent(this, CleanApkActivity.class);
|
||||
startActivity(intent);
|
||||
@ -585,9 +604,12 @@ public class FileReceiverActivity extends BaseActivity implements FileReceiverAd
|
||||
DownloadDao.getInstance(this).newOrUpdate(entry);
|
||||
}
|
||||
}
|
||||
List<DownloadEntity> all = DownloadDao.getInstance(this).getAll();
|
||||
EventBus.getDefault().post(new EBDownloadChanged("download", View.VISIBLE, all.size()));
|
||||
EventBus.getDefault().post(new EBDownloadStatus("download"));
|
||||
|
||||
mReceiverServer.close();
|
||||
AppController.remove("FileInfo");
|
||||
// AppController.remove("FileInfo");
|
||||
mFileInfos.clear();
|
||||
|
||||
AppController.put("sendData", sendData);
|
||||
|
||||
Reference in New Issue
Block a user