增加安装指引
This commit is contained in:
@ -10,6 +10,7 @@ import android.text.Html;
|
||||
import android.text.Spanned;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.gh.gamecenter.R;
|
||||
@ -88,6 +89,66 @@ public class DialogUtils {
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
public static void showInstallHintDialog(Context context ,final ConfiremListener cmListener) {
|
||||
|
||||
|
||||
final Dialog dialog = new Dialog(context);
|
||||
|
||||
View view = View.inflate(context, R.layout.dialog_install_hint, null);
|
||||
|
||||
// 标题
|
||||
TextView alertdialog_title = (TextView) view.findViewById(R.id.installhint_title);
|
||||
alertdialog_title.setText("重要提示");
|
||||
Spanned content = Html.fromHtml("如果您使用的是华为手机或OPPO手机,安装游戏时请选择“" +
|
||||
"<font color=\"#ff0000\">继续安装</font>" +
|
||||
"”(请记住不要选择“官方推荐”或“软件商店安装”)");
|
||||
// 内容
|
||||
TextView alertdialog_content = (TextView) view.findViewById(R.id.installhint_content);
|
||||
alertdialog_content.setText(content);
|
||||
|
||||
// 确定按钮
|
||||
TextView installhint_confirm = (TextView) view.findViewById(R.id.installhint_confirm);
|
||||
installhint_confirm.setText("知道了");
|
||||
|
||||
final CheckBox installhint_checkBox = (CheckBox) view.findViewById(R.id.installhint_checkbox);
|
||||
|
||||
TextView installhint_cancel = (TextView) view.findViewById(R.id.installhint_cancel);
|
||||
|
||||
installhint_cancel.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (installhint_checkBox.isChecked()) {
|
||||
installhint_checkBox.setChecked(false);
|
||||
} else {
|
||||
installhint_checkBox.setChecked(true);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
installhint_confirm.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
dialog.dismiss();
|
||||
if (installhint_checkBox.isChecked()) {
|
||||
if (cmListener != null) {
|
||||
cmListener.onConfirem();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
dialog.setOnDismissListener(new Dialog.OnDismissListener() {
|
||||
@Override
|
||||
public void onDismiss(DialogInterface dialog) {
|
||||
isShow = false;
|
||||
}
|
||||
});
|
||||
|
||||
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
dialog.setContentView(view);
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
public static void showHintDialog(Context context, String title, CharSequence msg, String confirm) {
|
||||
final Dialog dialog = new Dialog(context);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user