reformat code & optimize import & reorder entries

This commit is contained in:
CsHeng
2017-04-27 14:27:11 +08:00
parent 153f33f44b
commit 9432e34571
671 changed files with 33616 additions and 34861 deletions

View File

@ -7,13 +7,9 @@ import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.text.Html;
import android.view.View;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.*;
import butterknife.BindView;
import butterknife.OnClick;
import com.gh.base.BaseActivity;
import com.gh.common.util.DialogUtils;
import com.gh.common.util.Utils;
@ -21,30 +17,37 @@ import com.gh.common.view.VerticalItemDecoration;
import com.gh.gamecenter.adapter.CleanApkAdapter;
import com.gh.gamecenter.entity.InstallGameEntity;
import com.gh.gamecenter.eventbus.EBSkip;
import de.greenrobot.event.EventBus;
import java.io.File;
import java.text.DecimalFormat;
import java.util.List;
import butterknife.BindView;
import butterknife.OnClick;
import de.greenrobot.event.EventBus;
/**
* Created by khy on 2017/1/24.
*/
public class CleanApkActivity extends BaseActivity implements CleanApkAdapter.OnScanListener {
@BindView(R.id.apk_count) TextView mApkCount;
@BindView(R.id.apk_rv) RecyclerView mApkRv;
@BindView(R.id.delete_btn) TextView mApkDeleteBtn;
@BindView(R.id.select_game_all) CheckBox mApkSelectAll;
@BindView(R.id.scan_pb) ProgressBar mScanPb;
@BindView(R.id.reuse_nodata_skip_tv_hint) TextView mNodataSkipTv;
@BindView(R.id.reuse_nodata_skip_tv_btn) TextView mNodataSkipBtn;
@BindView(R.id.reuse_nodata_skip) LinearLayout mNodataSkipLl;
@BindView(R.id.delete_bottom) LinearLayout mDeleteBottom;
@BindView(R.id.select_game_installed_ll) RelativeLayout mInstallAllData;
@BindView(R.id.apk_count)
TextView mApkCount;
@BindView(R.id.apk_rv)
RecyclerView mApkRv;
@BindView(R.id.delete_btn)
TextView mApkDeleteBtn;
@BindView(R.id.select_game_all)
CheckBox mApkSelectAll;
@BindView(R.id.scan_pb)
ProgressBar mScanPb;
@BindView(R.id.reuse_nodata_skip_tv_hint)
TextView mNodataSkipTv;
@BindView(R.id.reuse_nodata_skip_tv_btn)
TextView mNodataSkipBtn;
@BindView(R.id.reuse_nodata_skip)
LinearLayout mNodataSkipLl;
@BindView(R.id.delete_bottom)
LinearLayout mDeleteBottom;
@BindView(R.id.select_game_installed_ll)
RelativeLayout mInstallAllData;
private CleanApkAdapter mAdapter;
@ -64,7 +67,7 @@ public class CleanApkActivity extends BaseActivity implements CleanApkAdapter.On
mApkSelectAll.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
ArrayMap<Integer, Boolean> selectPosition = new ArrayMap<>();
ArrayMap<Integer, Boolean> selectPosition = new ArrayMap<>();
ArrayMap<Integer, Boolean> selectPosition1 = mAdapter.getSelectPosition();
int itemCount = mAdapter.getItemCount();
if (isChecked) {
@ -75,7 +78,7 @@ public class CleanApkActivity extends BaseActivity implements CleanApkAdapter.On
int selectCount = 0;
for (Integer integer : selectPosition1.keySet()) {
if (selectPosition1.get(integer)) {
selectCount ++;
selectCount++;
}
}
@ -119,8 +122,8 @@ 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, "删除安装包"
, Html.fromHtml("你选择的安装包中包含"+ "<font color=\"#ff0000\">未安装</font>"
+"的应用,确定删除吗?"), "取消 ", "确定"
, Html.fromHtml("你选择的安装包中包含" + "<font color=\"#ff0000\">未安装</font>"
+ "的应用,确定删除吗?"), "取消 ", "确定"
, new DialogUtils.ConfiremListener() {
@Override
public void onConfirem() {
@ -139,7 +142,7 @@ public class CleanApkActivity extends BaseActivity implements CleanApkAdapter.On
Intent intent = new Intent(CleanApkActivity.this, MainActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
new Thread(){
new Thread() {
@Override
public void run() {
try {
@ -170,7 +173,7 @@ public class CleanApkActivity extends BaseActivity implements CleanApkAdapter.On
}
}
double allSize = (((float)size/1024)/1024);
double allSize = (((float) size / 1024) / 1024);
DecimalFormat df = new DecimalFormat("#.00");
String sizeName = df.format(allSize) + "MB";
Utils.toast(CleanApkActivity.this, "删除成功,已为您节省" + sizeName + "空间");
@ -186,19 +189,19 @@ public class CleanApkActivity extends BaseActivity implements CleanApkAdapter.On
}
}
private void updateScanData(){
private void updateScanData() {
long allSize = 0;
List<InstallGameEntity> apkList = mAdapter.getApkList();
for (InstallGameEntity installGameEntity : apkList) {
allSize = allSize + installGameEntity.getGameSize();
}
double size = (((float)allSize/1024)/1024);
double size = (((float) allSize / 1024) / 1024);
DecimalFormat df = new DecimalFormat("0.00");
String sizeName = df.format(size) + "MB";
mApkCount.setText(Html.fromHtml("找到" + apkList.size() + "个安装包,占用"
+ "<font color=\"#ff4147\">" + sizeName + "</font>"+ "空间"));
+ "<font color=\"#ff4147\">" + sizeName + "</font>" + "空间"));
}
@Override