- package com.tutu.common.a;
- import android.graphics.drawable.ColorDrawable;
- import android.os.Bundle;
- import android.support.v4.app.DialogFragment;
- import android.view.LayoutInflater;
- import android.view.View;
- import android.view.View.OnClickListener;
- import android.view.ViewGroup;
- import android.widget.Button;
- import android.widget.TextView;
- import com.feng.android.i.e;
- import com.feng.android.i.f;
- /* compiled from: TutuAlertDialog */
- public class b extends DialogFragment {
- private TextView a;
- private Button b;
- private Button c;
- private String d;
- private String e;
- private String f;
- private String g;
- private a h;
- /* compiled from: TutuAlertDialog */
- public interface a {
- void c(String str);
- void c_(String str);
- }
- public void onCreate(Bundle bundle) {
- super.onCreate(bundle);
- }
- public static b a(String str, String str2, String str3, String str4, a aVar) {
- b bVar = new b();
- Bundle bundle = new Bundle();
- bundle.putString("left_text", str);
- bundle.putString("right_text", str2);
- bundle.putString("dialog_tips", str3);
- bundle.putString("dialog_tag", str4);
- bVar.setArguments(bundle);
- bVar.a(aVar);
- return bVar;
- }
- public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
- getDialog().requestWindowFeature(1);
- getDialog().getWindow().setBackgroundDrawable(new ColorDrawable(0));
- View inflate = layoutInflater.inflate(e.c(getActivity(), "tutu_alert_dialog_layout"), viewGroup, false);
- getDialog().getWindow().setGravity(17);
- if (getArguments() != null) {
- this.d = getArguments().getString("left_text");
- this.e = getArguments().getString("right_text");
- this.f = getArguments().getString("dialog_tips");
- this.g = getArguments().getString("dialog_tag");
- }
- a(inflate);
- setCancelable(false);
- return inflate;
- }
- public void a(a aVar) {
- this.h = aVar;
- }
- private void a(View view) {
- this.b = (Button) view.findViewById(e.a(getActivity(), "tutu_alert_dialog_ignore_btn"));
- this.c = (Button) view.findViewById(e.a(getActivity(), "tutu_alert_dialog_recharge_btn"));
- this.a = (TextView) view.findViewById(e.a(getContext(), "tutu_alert_dialog_tips"));
- if (!f.c(this.d)) {
- this.b.setText(this.d);
- }
- if (!f.c(this.e)) {
- this.c.setText(this.e);
- }
- if (!f.c(this.f)) {
- this.a.setText(this.f);
- }
- this.b.setOnClickListener(new OnClickListener(this) {
- final
- /* synthetic */
- b a; {
- this.a = r1;
- }
- public void onClick(View view) {
- if (this.a.h != null) {
- this.a.h.c_(this.a.g);
- }
- this.a.dismiss();
- }
- });
- this.c.setOnClickListener(new OnClickListener(this) {
- final
- /* synthetic */
- b a; {
- this.a = r1;
- }
- public void onClick(View view) {
- if (this.a.h != null) {
- this.a.h.c(this.a.g);
- }
- this.a.dismiss();
- }
- });
- }
- }
来源: http://www.cnblogs.com/lonkiss/p/6733472.html