package de.eightbitboy.hijacr.fragments.dialog;


import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.DialogFragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import de.eightbitboy.hijacr.R;

public class ErrorDialog extends DialogFragment {

	public static ErrorDialog newInstance(String message) {
		ErrorDialog dialog = new ErrorDialog();

		Bundle args = new Bundle();
		args.putString("message", message);
		dialog.setArguments(args);

		return dialog;
	}

	//TODO see http://developer.android.com/guide/topics/ui/dialogs.html

	@Nullable
	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
		//return super.onCreateView(inflater, container, savedInstanceState);

		View view = inflater.inflate(R.layout.error_dialog, container);
		TextView textView = (TextView) view.findViewById(R.id.error_message);
		textView.setText(getArguments().getString("message"));

		return view;
	}
}

@@ -62,17 +62,127 @@
 oid.
-os.Bundle
+app.Dialog;%0Aimport android.content.DialogInterface;%0Aimport android.os.Bundle;%0Aimport android.support.annotation.NonNull
 ;%0Aim
@@ -269,16 +269,59 @@
 agment;%0A
+import android.support.v7.app.AlertDialog;%0A
 import a
@@ -522,16 +522,71 @@
 ment %7B%0A%0A
+%09private static final String MESSAGE_KEY = %22message%22;%0A%0A
 %09public 
@@ -724,25 +724,27 @@
 tString(
-%22message%22
+MESSAGE_KEY
 , messag
@@ -872,23 +872,22 @@
 tml%0A%0A%09@N
+onN
 ull
-able
 %0A%09@Overr
@@ -898,20 +898,22 @@
 %09public 
-View
+Dialog
  onCreat
@@ -917,370 +917,388 @@
 eate
-View(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) %7B%0A%09%09//return super.onCreateView(inflater, container, savedInstanceState);%0A%0A%09%09View view = inflater.inflate(R.layout.error_dialog, container
+Dialog(Bundle savedInstanceState) %7B%0A%09%09AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()
 );%0A
+%0A
 %09%09
-TextView textView = (TextView) view.findViewById(R.id.error_message);%0A%09%09textView.setText(getArguments().getString(%22message%22));%0A%0A%09%09return view
+builder.setTitle(%22Error%22)%0A%09%09%09%09.setMessage(getArguments().getString(MESSAGE_KEY))%0A%09%09%09%09.setNeutralButton(%22ok%22, new DialogInterface.OnClickListener() %7B%0A%09%09%09%09%09public void onClick(DialogInterface dialog, int which) %7B%0A%09%09%09%09%09%09dismiss();%0A%09%09%09%09%09%7D%0A%09%09%09%09%7D);%0A%0A%09%09return builder.create()
 ;%0A%09%7D

Improve error dialog