package me.jakemoritz.tasking.dialog;

import android.app.AlertDialog;
import android.app.Dialog;
import android.app.DialogFragment;
import android.content.DialogInterface;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

import me.jakemoritz.tasking.R;

public class SimpleTextDialogFragment extends DialogFragment {

    private String filename;

    public SimpleTextDialogFragment() {
    }

    public static SimpleTextDialogFragment newInstance(String filename){
        SimpleTextDialogFragment simpleTextDialogFragment = new SimpleTextDialogFragment();
        simpleTextDialogFragment.setRetainInstance(true);
        simpleTextDialogFragment.filename = filename;
        return simpleTextDialogFragment;
    }

    @Override
    public Dialog onCreateDialog(Bundle savedInstanceState) {
        View view = LayoutInflater.from(getActivity()).inflate(R.layout.dialog_add_task, (ViewGroup) null);

        AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());

        builder.setMessage(readTextFile())
                .setPositiveButton("Close", new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                dismiss();
            }
        });

        return builder.create();
    }

    @Override
    public void onDestroyView() {
        Dialog dialog = getDialog();

        if (dialog != null && getRetainInstance()){
            dialog.setDismissMessage(null);
        }

        super.onDestroyView();
    }
    
    private String readTextFile() {
        StringBuilder text = new StringBuilder();
        BufferedReader reader = null;

        try {
            reader = new BufferedReader(
                    new InputStreamReader(getActivity().getAssets().open("license_" + filename.trim().toLowerCase() + ".txt")));

            // do reading, usually loop until end of file reading
            String mLine;
            while ((mLine = reader.readLine()) != null) {
                text.append(mLine);
                text.append('\n');
            }
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            if (reader != null) {
                try {
                    reader.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }

        return text.toString();
    }
}

@@ -195,101 +195,8 @@
 dle;
-%0Aimport android.view.LayoutInflater;%0Aimport android.view.View;%0Aimport android.view.ViewGroup;
 %0A%0Aim
@@ -291,41 +291,8 @@
 r;%0A%0A
-import me.jakemoritz.tasking.R;%0A%0A
 publ
@@ -833,117 +833,8 @@
 ) %7B%0A
-        View view = LayoutInflater.from(getActivity()).inflate(R.layout.dialog_add_task, (ViewGroup) null);%0A%0A
     
@@ -1450,20 +1450,16 @@
 ;%0A    %7D%0A
-    
 %0A    pri

Remove unused view from SimpleTextDialogFragment