app/src/main/java/com/example/iamatourist/MainActivity.java
private void secondDialog() {
        final Context context = this;
        final Dialog dialog = new Dialog(context);
        dialog.setContentView(R.layout.dialog_second);
        dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));

        ImageView image = dialog.findViewById(R.id.image_preview_2);
        image.setImageBitmap(currentImage.getPhoto());

        final TextView title = dialog.findViewById(R.id.title_edit_img);
        final TextView desc = dialog.findViewById(R.id.desc_edit_img);
        final TextView tags = dialog.findViewById(R.id.tags_edit_img);
        final Button submit = dialog.findViewById(R.id.submit_btn_img);
        final ImageButton close = dialog.findViewById(R.id.cancel_button_2);

        close.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                dialog.dismiss();
            }
        });

        submit.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                currentImage.setTitle(title.getText().toString());
                currentImage.setDesc(desc.getText().toString());
                ArrayList<String> tagsList = getTags(tags.getText().toString());
                if (tagsList != null) {
                    currentImage.setTags(tagsList);
                }
                currentTrip.addImage(currentImage);
                currentImage = null;
                dialog.dismiss();
            }
        });
        dialog.show();

        this.currentTrip.addImage(currentImage);
    }
/**
     * Uses a custom layout to display entry points for Title, desc and Tags
     */
Uses a custom layout to display entry points for Title, desc and Tags
Uses a custom layout to display entry points for Title desc and Tags
private void secondDialog() {
        final Context context = this;
        final Dialog dialog = new Dialog(context);
        dialog.setContentView(R.layout.dialog_second);
        dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
        ImageView image = dialog.findViewById(R.id.image_preview_2);
        image.setImageBitmap(currentImage.getPhoto());
        final TextView title = dialog.findViewById(R.id.title_edit_img);
        final TextView desc = dialog.findViewById(R.id.desc_edit_img);
        final TextView tags = dialog.findViewById(R.id.tags_edit_img);
        final Button submit = dialog.findViewById(R.id.submit_btn_img);
        final ImageButton close = dialog.findViewById(R.id.cancel_button_2);
        close.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                dialog.dismiss();
            }
        });
        submit.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                currentImage.setTitle(title.getText().toString());
                currentImage.setDesc(desc.getText().toString());
                ArrayList<String> tagsList = getTags(tags.getText().toString());
                if (tagsList != null) {
                    currentImage.setTags(tagsList);
                }
                currentTrip.addImage(currentImage);
                currentImage = null;
                dialog.dismiss();
            }
        });
        dialog.show();
        this.currentTrip.addImage(currentImage);
    }
private void secondDialog ( ) { final Context context = this ; final Dialog dialog = new Dialog ( context ) ; dialog . setContentView ( R . layout . dialog_second ) ; dialog . getWindow ( ) . setBackgroundDrawable ( new ColorDrawable ( Color . TRANSPARENT ) ) ; ImageView image = dialog . findViewById ( R . id . image_preview_2 ) ; image . setImageBitmap ( currentImage . getPhoto ( ) ) ; final TextView title = dialog . findViewById ( R . id . title_edit_img ) ; final TextView desc = dialog . findViewById ( R . id . desc_edit_img ) ; final TextView tags = dialog . findViewById ( R . id . tags_edit_img ) ; final Button submit = dialog . findViewById ( R . id . submit_btn_img ) ; final ImageButton close = dialog . findViewById ( R . id . cancel_button_2 ) ; close . setOnClickListener ( new View . OnClickListener ( ) { @ Override public void onClick ( View view ) { dialog . dismiss ( ) ; } } ) ; submit . setOnClickListener ( new View . OnClickListener ( ) { @ Override public void onClick ( View view ) { currentImage . setTitle ( title . getText ( ) . toString ( ) ) ; currentImage . setDesc ( desc . getText ( ) . toString ( ) ) ; ArrayList < String > tagsList = getTags ( tags . getText ( ) . toString ( ) ) ; if ( tagsList != null ) { currentImage . setTags ( tagsList ) ; } currentTrip . addImage ( currentImage ) ; currentImage = null ; dialog . dismiss ( ) ; } } ) ; dialog . show ( ) ; this . currentTrip . addImage ( currentImage ) ; }
Uses a custom layout to display entry points for Title, desc and Tags
Uses a custom layout to display entry points for Title desc and Tags