优化dialog,统一dialog显示

This commit is contained in:
huangzhuanghua
2016-07-06 11:16:37 +08:00
parent e7f510941f
commit 4feff1600e
9 changed files with 195 additions and 393 deletions

View File

@ -1,6 +1,5 @@
package com.gh.common.view;
import android.app.Dialog;
import android.content.Context;
import android.content.SharedPreferences;
import android.graphics.Color;
@ -16,8 +15,6 @@ import android.support.v4.view.ViewPager;
import android.support.v4.view.ViewPager.OnPageChangeListener;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.text.Html;
import android.text.Spanned;
import android.text.TextUtils;
import android.util.SparseArray;
import android.view.Gravity;
@ -26,7 +23,6 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.view.Window;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.LinearLayout.LayoutParams;
@ -513,35 +509,9 @@ public class DownloadDialog {
// 显示插件化
private void showPluginDialog(final ApkEntity apkEntity,
final RecyclerViewAdapter adapter, final int location) {
final Dialog dialog = new Dialog(context);
View view = View.inflate(context,
R.layout.search_history_delete_dialog, null);
TextView title = (TextView) view.findViewById(R.id.delete_dialog_title);
title.setText("插件化安装");
TextView content = (TextView) view
.findViewById(R.id.delete_dialog_message);
Spanned spanned = Html.fromHtml("您将进行插件化安装以实现插件功能,此过程将"
+ "<font color=\"#ff0000\">卸载</font>" + "当前使用的版本并"
+ "<font color=\"#ff0000\">安装插件版本</font>" + "");
content.setText(spanned);
TextView cancel = (TextView) view
.findViewById(R.id.delete_dialog_cancel);
cancel.setText("取消");
cancel.setOnClickListener(new OnClickListener() {
DialogUtils.showPluginDialog(context, new DialogUtils.ConfiremListener() {
@Override
public void onClick(View v) {
dialog.dismiss();
}
});
TextView confirm = (TextView) view
.findViewById(R.id.delete_dialog_confirm);
confirm.setText("确定");
confirm.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
dialog.dismiss();
public void onConfirem() {
Map<String, Object> kv6 = new HashMap<String, Object>();
kv6.put("操作", "点击插件化安装完成");
DataUtils.onEvent(context, "插件化", gameName, kv6);
@ -557,11 +527,7 @@ public class DownloadDialog {
context.startActivity(PackageUtils.getUninstallIntent(context, path));
}
}
});
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(view);
dialog.show();
}, null);
}
private class RecyclerViewAdapter extends