快传成绩单 - 热点优化

This commit is contained in:
khy
2017-02-24 15:11:00 +08:00
parent ef1f2251b5
commit da20b817d2
42 changed files with 960 additions and 155 deletions

View File

@ -5,12 +5,15 @@ import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.gh.base.AppController;
import com.gh.base.BaseActivity;
import com.gh.common.util.DisplayUtils;
import com.gh.common.util.Utils;
import com.gh.gamecenter.adapter.KcSelectGameAdapter;
import com.gh.gamecenter.kuaichuan.FileInfo;
@ -30,10 +33,13 @@ public class KcSelectGameActivity extends BaseActivity {
@BindView(R.id.select_game_send) TextView mSelectSend;
@BindView(R.id.select_game_all) CheckBox selectAll;
@BindView(R.id.install_count) TextView installCount;
@BindView(R.id.select_game_installed_ll) RelativeLayout installRl;
private KcSelectGameAdapter mAdapter;
private boolean mIsConn;
private LinearLayoutManager layoutManager;
private RelativeLayout.LayoutParams rparams;
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
@ -57,10 +63,14 @@ public class KcSelectGameActivity extends BaseActivity {
selectAll.setVisibility(View.GONE);
mAdapter = new KcSelectGameAdapter(this, mSelectSend);
mSelectRv.setLayoutManager(new LinearLayoutManager(this));
mAdapter = new KcSelectGameAdapter(this, mSelectSend, installCount);
layoutManager = new LinearLayoutManager(this);
mSelectRv.setLayoutManager(layoutManager);
mSelectRv.setAdapter(mAdapter);
rparams = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
DisplayUtils.dip2px(this, 40));
mSelectSend.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
@ -106,6 +116,35 @@ public class KcSelectGameActivity extends BaseActivity {
}
});
installCount.setText("已安装的游戏(" + mAdapter.getItemCount() + "");
mSelectRv.setOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
super.onScrolled(recyclerView, dx, dy);
int position = layoutManager.findFirstVisibleItemPosition();
if (position >= mAdapter.getGameSize()) {
installCount.setText("已安装的应用(" + mAdapter.getAppSize() +"");
} else {
installCount.setText("已安装的游戏(" + mAdapter.getGameSize() +"");
}
if (position == mAdapter.getGameSize() - 1) {
int buttom = layoutManager.findViewByPosition(position).getBottom();
if (buttom <= installRl.getHeight()) {
rparams.topMargin = buttom - installRl.getHeight();
installRl.setLayoutParams(rparams);
} else {
rparams.topMargin = 0;
installRl.setLayoutParams(rparams);
}
} else {
rparams.topMargin = 0;
installRl.setLayoutParams(rparams);
}
}
});
}
}