import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
+import android.app.DialogFragment;
import android.content.DialogInterface;
import android.os.Bundle;
import android.support.annotation.NonNull;
-import android.support.v4.app.DialogFragment;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ArrayAdapter;
public abstract class ActionDialogFragment extends DialogFragment implements DialogInterface.OnClickListener {
- protected LoadingTask.DataChangeListener listener;
protected ArrayList<Dossier> dossiers;
protected String bureauId;
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setView(createView())
// Set action button
- .setPositiveButton(getTitle(), this).setNegativeButton(
- android.R.string.cancel, new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int id) {
- ActionDialogFragment.this.getDialog().cancel();
- }
- }
- );
+ .setPositiveButton(getTitle(), this).setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
+ public void onClick(DialogInterface dialog, int id) {
+ ActionDialogFragment.this.getDialog().cancel();
+ }
+ });
return builder.create();
}
- @Override public void onAttach(Activity activity) {
- super.onAttach(activity);
- // Activities containing this fragment must implement its callbacks.
- if (!(activity instanceof LoadingTask.DataChangeListener))
- throw new IllegalStateException("Activity must implement DataChangeListener.");
-
- listener = (LoadingTask.DataChangeListener) activity;
- }
-
- @Override public void onDetach() {
- super.onDetach();
-
- // Reset the active callbacks interface.
- listener = null;
- }
-
// </editor-fold desc="LifeCycle">
@Override public void onClick(DialogInterface dialog, int which) {