123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153 |
- package com.epson.mobilephone.common.wifidirect;
- import android.app.Dialog;
- import android.content.DialogInterface;
- import android.os.Bundle;
- import android.support.annotation.Nullable;
- import android.support.p000v4.app.DialogFragment;
- import android.support.p000v4.app.FragmentManager;
- import android.view.View;
- import android.view.ViewGroup;
- import android.widget.ProgressBar;
- import android.widget.RelativeLayout;
- import android.widget.TextView;
- public class DialogProgressWiFiDirect extends DialogFragment {
- public static final int MESSAGE_BOTTOM = 1;
- public static final int MESSAGE_ONLY = 2;
- public static final int MESSAGE_RIGHT = 0;
- private static final String TAG_DIALOG = "tag";
- private static final String TAG_MESSAGE = "message";
- private static final String TAG_NEGATIVE_MESSAGE = "negative_dialog_message";
- private static final String TAG_NEUTRAL_MESSAGE = "neutral_dialog_message";
- private static final String TAG_POSITION = "position";
- private static final String TAG_POSITIVE_MESSAGE = "positive_dialog_message";
- private static final String TAG_TITLE_MESSAGE = "title_message";
- /* access modifiers changed from: private */
- public DialogButtonClick mActivity;
- /* access modifiers changed from: private */
- public String mTag;
- public interface DialogButtonClick {
- void onCancelDialog(String str);
- void onNegativeClick(String str);
- void onNeutralClick(String str);
- void onPositiveClick(String str);
- }
- public static DialogProgressWiFiDirect newInstance(String str, int i, @Nullable String str2) {
- return newInstance(str, i, str2, (String) null, (String) null, (String) null, (String) null);
- }
- public static DialogProgressWiFiDirect newInstance(String str, int i, @Nullable String str2, @Nullable String str3, @Nullable String str4, @Nullable String str5, @Nullable String str6) {
- DialogProgressWiFiDirect dialogProgressWiFiDirect = new DialogProgressWiFiDirect();
- Bundle bundle = new Bundle();
- bundle.putString(TAG_DIALOG, str);
- bundle.putInt("position", i);
- bundle.putString("message", str2);
- bundle.putString(TAG_TITLE_MESSAGE, str3);
- bundle.putString(TAG_POSITIVE_MESSAGE, str4);
- bundle.putString(TAG_NEUTRAL_MESSAGE, str5);
- bundle.putString(TAG_NEGATIVE_MESSAGE, str6);
- dialogProgressWiFiDirect.setArguments(bundle);
- return dialogProgressWiFiDirect;
- }
- private void deleteFragment(FragmentManager fragmentManager, String str) {
- Dialog dialog;
- DialogProgressWiFiDirect dialogProgressWiFiDirect = (DialogProgressWiFiDirect) fragmentManager.findFragmentByTag(str);
- if (dialogProgressWiFiDirect != null && (dialog = dialogProgressWiFiDirect.getDialog()) != null && dialog.isShowing()) {
- dialogProgressWiFiDirect.dismiss();
- }
- }
- @NonNull
- public Dialog onCreateDialog(@Nullable Bundle bundle) {
- this.mTag = getArguments().getString(TAG_DIALOG);
- int i = getArguments().getInt("position");
- String string = getArguments().getString("message");
- String string2 = getArguments().getString(TAG_TITLE_MESSAGE);
- String string3 = getArguments().getString(TAG_POSITIVE_MESSAGE);
- String string4 = getArguments().getString(TAG_NEUTRAL_MESSAGE);
- String string5 = getArguments().getString(TAG_NEGATIVE_MESSAGE);
- AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
- View inflate = getActivity().getLayoutInflater().inflate(C1113R.layout.dialog_progress_wifi_direct, (ViewGroup) null);
- try {
- this.mActivity = (DialogButtonClick) getActivity();
- } catch (ClassCastException unused) {
- this.mActivity = null;
- }
- if (string2 != null) {
- builder.setTitle((CharSequence) string2);
- }
- if (string3 != null) {
- builder.setPositiveButton((CharSequence) string3, (DialogInterface.OnClickListener) new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialogInterface, int i) {
- DialogProgressWiFiDirect.this.dismiss();
- if (DialogProgressWiFiDirect.this.mActivity != null) {
- DialogProgressWiFiDirect.this.mActivity.onPositiveClick(DialogProgressWiFiDirect.this.mTag);
- }
- }
- });
- }
- if (string4 != null) {
- builder.setNeutralButton((CharSequence) string4, (DialogInterface.OnClickListener) new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialogInterface, int i) {
- DialogProgressWiFiDirect.this.dismiss();
- if (DialogProgressWiFiDirect.this.mActivity != null) {
- DialogProgressWiFiDirect.this.mActivity.onNeutralClick(DialogProgressWiFiDirect.this.mTag);
- }
- }
- });
- }
- if (string5 != null) {
- builder.setNegativeButton((CharSequence) string5, (DialogInterface.OnClickListener) new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialogInterface, int i) {
- DialogProgressWiFiDirect.this.dismiss();
- if (DialogProgressWiFiDirect.this.mActivity != null) {
- DialogProgressWiFiDirect.this.mActivity.onNegativeClick(DialogProgressWiFiDirect.this.mTag);
- }
- }
- });
- }
- ProgressBar progressBar = (ProgressBar) inflate.findViewById(C1113R.C1115id.dialog_progress_id);
- if (i == 1) {
- RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) progressBar.getLayoutParams();
- layoutParams.addRule(14);
- progressBar.setLayoutParams(layoutParams);
- TextView textView = (TextView) inflate.findViewById(C1113R.C1115id.dialog_progress_text_bottom);
- textView.setText(string);
- progressBar.setVisibility(0);
- textView.setVisibility(0);
- } else if (i == 0) {
- TextView textView2 = (TextView) inflate.findViewById(C1113R.C1115id.dialog_progress_text_right);
- textView2.setText(string);
- progressBar.setVisibility(0);
- textView2.setVisibility(0);
- } else {
- TextView textView3 = (TextView) inflate.findViewById(C1113R.C1115id.dialog_progress_text_right);
- textView3.setText(string);
- textView3.setVisibility(0);
- }
- builder.setView(inflate);
- return builder.create();
- }
- public void onCancel(DialogInterface dialogInterface) {
- DialogButtonClick dialogButtonClick = this.mActivity;
- if (dialogButtonClick != null) {
- dialogButtonClick.onCancelDialog(this.mTag);
- }
- super.onCancel(dialogInterface);
- }
- public void show(FragmentManager fragmentManager, String str) {
- deleteFragment(fragmentManager, str);
- super.showNow(fragmentManager, str);
- }
- }
|