代码合并
This commit is contained in:
@ -295,15 +295,21 @@ public class DownloadItemUtils {
|
||||
}
|
||||
|
||||
private static void setNormalOnClickListener(final Context context,
|
||||
final TextView downloadBtn,
|
||||
final GameEntity gameEntity,
|
||||
final int position,
|
||||
final RecyclerView.Adapter<RecyclerView.ViewHolder> adapter,
|
||||
final String entrance,
|
||||
final String location) {
|
||||
final TextView downloadBtn,
|
||||
final GameEntity gameEntity,
|
||||
final int position,
|
||||
final RecyclerView.Adapter<RecyclerView.ViewHolder> adapter,
|
||||
final String entrance,
|
||||
final String location, final boolean isCloseSoftInput) {
|
||||
downloadBtn.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (isCloseSoftInput) {
|
||||
InputMethodManager imm = (InputMethodManager) context
|
||||
.getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
imm.hideSoftInputFromWindow(v.getWindowToken(), 0);
|
||||
}
|
||||
|
||||
String str = downloadBtn.getText().toString();
|
||||
if ("下载".equals(str)) {
|
||||
if (NetworkUtils.isWifiConnected(context)) {
|
||||
@ -335,6 +341,7 @@ public class DownloadItemUtils {
|
||||
PackageUtils.launchApplicationByPackageName(context, gameEntity.getApk().get(0).getPackageName());
|
||||
} else if ("下载中".equals(str)) {
|
||||
Intent intent = new Intent(context, DownloadManagerActivity.class);
|
||||
intent.putExtra("currentItem", 1);
|
||||
intent.putExtra("url", gameEntity.getApk().get(0).getUrl());
|
||||
intent.putExtra("entrance", entrance + "+(" + location.split(":")[0] + ")");
|
||||
context.startActivity(intent);
|
||||
@ -383,7 +390,7 @@ public class DownloadItemUtils {
|
||||
boolean isCloseSoftInput) {
|
||||
|
||||
if (gameEntity.getApk().size() == 1) {
|
||||
setNormalOnClickListener(context, downloadBtn, gameEntity, position, adapter, entrance, location);
|
||||
setNormalOnClickListener(context, downloadBtn, gameEntity, position, adapter, entrance, location, isCloseSoftInput);
|
||||
} else {
|
||||
setPluginOnClickListener(context, downloadBtn, gameEntity, entrance, location, isCloseSoftInput);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user