快传(接收方图片缩略图尚需改进, 连接断开处理尚需改进),安装包清理, 网页传网页乱码未解决
This commit is contained in:
@ -0,0 +1,91 @@
|
||||
package com.gh.gamecenter;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.view.View;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.gh.base.AppController;
|
||||
import com.gh.base.BaseActivity;
|
||||
import com.gh.common.util.Utils;
|
||||
import com.gh.gamecenter.adapter.KcSelectGameAdapter;
|
||||
import com.gh.gamecenter.kuaichuan.FileInfo;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import butterknife.BindView;
|
||||
|
||||
/**
|
||||
* Created by khy on 2017/1/20.
|
||||
* 快传-选择游戏
|
||||
*/
|
||||
public class KcSelectGameActivity extends BaseActivity {
|
||||
|
||||
@BindView(R.id.select_game_rv) RecyclerView mSelectRv;
|
||||
@BindView(R.id.select_game_send) TextView mSelectSend;
|
||||
@BindView(R.id.select_game_all) CheckBox selectAll;
|
||||
@BindView(R.id.install_count) TextView installCount;
|
||||
|
||||
private KcSelectGameAdapter mAdapter;
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
if (requestCode == 0*123) {
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
View contentView = View.inflate(this, R.layout.activity_kc_select_game, null);
|
||||
init(contentView, "选择游戏");
|
||||
|
||||
|
||||
mAdapter = new KcSelectGameAdapter(this, mSelectSend);
|
||||
mSelectRv.setLayoutManager(new LinearLayoutManager(this));
|
||||
mSelectRv.setAdapter(mAdapter);
|
||||
|
||||
mSelectSend.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
List<FileInfo> selectData = mAdapter.getSelectData();
|
||||
if (selectData.size() == 0) {
|
||||
Utils.toast(KcSelectGameActivity.this, "请选择游戏");
|
||||
return;
|
||||
}
|
||||
AppController.put("FileInfo", selectData);
|
||||
Intent intent = new Intent(KcSelectGameActivity.this, ChooseReceiverActivity.class);
|
||||
startActivityForResult(intent, 0*123);
|
||||
}
|
||||
});
|
||||
|
||||
selectAll.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
HashMap<Integer, Boolean> selectPosition = new HashMap<>();
|
||||
int itemCount = mAdapter.getItemCount();
|
||||
if (isChecked) {
|
||||
for (int i = 0; i < itemCount; i++) {
|
||||
selectPosition.put(i, true);
|
||||
}
|
||||
} else {
|
||||
for (int i = 0; i < itemCount; i++) {
|
||||
selectPosition.put(i, false);
|
||||
}
|
||||
}
|
||||
|
||||
mAdapter.setSelectPosition(selectPosition);
|
||||
mAdapter.notifyItemRangeChanged(0, itemCount);
|
||||
}
|
||||
});
|
||||
|
||||
installCount.setText("已安装(" + mAdapter.getItemCount() + ")");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user