package com.marlonjones.simplereminder;

import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.BitmapFactory;
import android.net.Uri;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.app.NotificationCompat;
import android.support.v7.widget.Toolbar;
import android.text.InputType;
import android.view.View;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.EditText;
import android.widget.Toast;

import com.afollestad.materialdialogs.MaterialDialog;

public class MainActivity extends AppCompatActivity {
//TODO - ADD ANDROID WEAR AND TIME FUNCTIONALITY
    public static final int NOTIFICATION_ID = 1;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        new MaterialDialog.Builder(this)
                .title(R.string.input)
                .autoDismiss(false)
                .inputType(InputType.TYPE_CLASS_TEXT)
                .input(null, null, new MaterialDialog.InputCallback()

                {
                    @Override
                    public void onInput(MaterialDialog dialog, CharSequence input) {
                        //notification
                            NotificationCompat.Builder builder = new NotificationCompat.Builder(getApplicationContext());
                        PendingIntent pendingIntent = PendingIntent.getActivity(MainActivity.this, 0,
                                new Intent(getApplicationContext(), MainActivity.class)
                                        .setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP),
                                0);
                            builder.setStyle(new NotificationCompat.BigTextStyle().bigText(input.toString())); //BigText
                            builder.setOngoing(true); //Make persistent
                            builder.setContentIntent(pendingIntent); //OnClick for Reopening App
                            builder.setSmallIcon(R.drawable.ic_note);
                            builder.setLargeIcon(BitmapFactory.decodeResource(getResources(), R.mipmap.ic_launcher));
                            builder.setContentTitle("Remember!");
                            builder.setContentText(input.toString()); //Get text from dialog input
                            builder.addAction(R.drawable.ic_action_name, "Done", pendingIntent);
                            NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
                            notificationManager.notify(NOTIFICATION_ID, builder.build());
                        //toast
                        Toast.makeText(MainActivity.this, "Done! Reminder has been set. Check your Notification Bar! :)",
                                Toast.LENGTH_SHORT).show();
                        //Close app when done entering in text
                        finish();


                    }

                }).dismissListener(new DialogInterface.OnDismissListener() {
            @Override
            public void onDismiss(DialogInterface dialog) {
               finish();
            }
        }).show();
    }
    //Closes the app when the back button is pressed
    public void onBackPressed(){
        finish();
    }
}

@@ -3196,18 +3196,16 @@
 nish();%0A
-%0A%0A
         
@@ -3218,16 +3218,102 @@
       %7D%0A
+                    //Close app when dialog is dismissed (ex: click outside of dialog)
 %0A       

Comment edited