// Path: Android/app/src/main/java/com/examples/abelanav2/grpcclient/AbelanaClientException.java
// public class AbelanaClientException extends Exception {
//     public AbelanaClientException() { super(); }
//     public AbelanaClientException(String message) { super(message); }
//     public AbelanaClientException(String message, Throwable cause) { super(message, cause); }
//     public AbelanaClientException(Throwable cause) { super(cause); }
// }


import android.app.Activity;
import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.Toast;
import com.examples.abelanav2.R;
import com.examples.abelanav2.grpcclient.AbelanaClientException;
import java.io.FileNotFoundException;
import java.io.InputStream;

    @Override
    public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
        MenuItem uploadMenu = menu.add(R.string.upload_menu_action);
        uploadMenu.setIcon(R.drawable.ic_done_white_24dp);
        uploadMenu.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
        uploadMenu.setOnMenuItemClickListener(this);
        super.onCreateOptionsMenu(menu, inflater);
    }


    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_upload, container,
                false);
        ImageView imageView = (ImageView) view.findViewById(R.id
                .imageViewUploadImage);
        imageView.setOnClickListener(this);
        if (!mRetrieving) {
            mRetrieving = true;
            selectPhoto();
        }
        return view;
    }

    /**
     * Starts the select photo intent.
     */
    private void selectPhoto() {
// Path: Android/app/src/main/java/com/examples/abelanav2/grpcclient/AbelanaClientException.java
// public class AbelanaClientException extends Exception {
//     public AbelanaClientException() { super(); }
//     public AbelanaClientException(String message) { super(message); }
//     public AbelanaClientException(String message, Throwable cause) { super(message, cause); }
//     public AbelanaClientException(Throwable cause) { super(cause); }
// }


// Path: Android/app/src/main/java/com/examples/abelanav2/ui/UploadFragment.java
import android.app.Activity;
import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.Toast;
import com.examples.abelanav2.R;
import com.examples.abelanav2.grpcclient.AbelanaClientException;
import java.io.FileNotFoundException;
import java.io.InputStream;


    @Override
    public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
        MenuItem uploadMenu = menu.add(R.string.upload_menu_action);
        uploadMenu.setIcon(R.drawable.ic_done_white_24dp);
        uploadMenu.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
        uploadMenu.setOnMenuItemClickListener(this);
        super.onCreateOptionsMenu(menu, inflater);
    }


    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_upload, container,
                false);
        ImageView imageView = (ImageView) view.findViewById(R.id
                .imageViewUploadImage);
        imageView.setOnClickListener(this);
        if (!mRetrieving) {
            mRetrieving = true;
            selectPhoto();
        }
        return view;
    }

    /**
     * Starts the select photo intent.
     */
    private void selectPhoto() {
        Intent photoPickerIntent = new Intent(Intent.ACTION_PICK);