package com.ianhanniballake.localstorage;

import android.app.Activity;
import android.content.Intent;
import android.database.Cursor;
import android.os.Bundle;
import android.provider.OpenableColumns;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;

public class MainActivity extends Activity {
    private static final int REQUEST_CODE = 1;
    private TextView returnedName;
    private ImageView returnedImage;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Button openAll = (Button) findViewById(R.id.open_all_files);
        openAll.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
                intent.addCategory(Intent.CATEGORY_OPENABLE);
                intent.setType("*/*");
                startActivityForResult(intent, REQUEST_CODE);
            }
        });
        Button openImages = (Button) findViewById(R.id.open_images);
        openImages.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
                intent.addCategory(Intent.CATEGORY_OPENABLE);
                intent.setType("image/*");
                startActivityForResult(intent, REQUEST_CODE);
            }
        });
        Button createFile = (Button) findViewById(R.id.create_file);
        createFile.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(Intent.ACTION_CREATE_DOCUMENT);
                // Filter to only show results that can be "opened", such as
                // a file (as opposed to a list of contacts or timezones).
                intent.addCategory(Intent.CATEGORY_OPENABLE);
                // Create a file with the requested MIME type.
                intent.setType("text/plain");
                intent.putExtra(Intent.EXTRA_TITLE, "test_file.txt");
                startActivityForResult(intent, REQUEST_CODE);
            }
        });
        returnedName = (TextView) findViewById(R.id.returned_name);
        returnedImage = (ImageView) findViewById(R.id.returned_image);
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        super.onCreateOptionsMenu(menu);
        getMenuInflater().inflate(R.menu.menu, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {
            case R.id.menu_donate:
                startActivity(new Intent(this, DonateActivity.class));
                return true;
            default:
                return super.onOptionsItemSelected(item);
        }
    }

    @Override
    public void onActivityResult(int requestCode, int resultCode, Intent data) {
        if (requestCode != REQUEST_CODE) {
            super.onActivityResult(requestCode, resultCode, data);
            return;
        }
        if (resultCode != Activity.RESULT_OK || data == null || data.getData() == null) {
            returnedName.setText("");
            returnedImage.setImageURI(null);
            return;
        }
        Cursor cursor = getContentResolver().query(data.getData(), null, null, null, null);
        try {
            // moveToFirst() returns false if the cursor has 0 rows.  Very handy for
            // "if there's anything to look at, look at it" conditionals.
            if (cursor != null && cursor.moveToFirst()) {
                // Note it's called "Display Name".  This is
                // provider-specific, and might not necessarily be the file name.
                String displayName = cursor.getString(
                        cursor.getColumnIndex(OpenableColumns.DISPLAY_NAME));
                returnedName.setText(displayName);
                returnedImage.setImageURI(data.getData());
            } else {
                returnedName.setText("");
                returnedImage.setImageURI(null);
            }
        } finally {
            if (cursor != null)
                cursor.close();
        }
    }
}

@@ -482,25 +482,26 @@
 te TextView 
-r
+mR
 eturnedName;
@@ -523,17 +523,18 @@
 ageView 
-r
+mR
 eturnedI
@@ -2384,33 +2384,34 @@
     %7D);%0A        
-r
+mR
 eturnedName = (T
@@ -2453,33 +2453,34 @@
 _name);%0A        
-r
+mR
 eturnedImage = (
@@ -3389,33 +3389,34 @@
 ) %7B%0A            
-r
+mR
 eturnedName.setT
@@ -3428,33 +3428,34 @@
 %22);%0A            
-r
+mR
 eturnedImage.set
@@ -4107,33 +4107,34 @@
                 
-r
+mR
 eturnedName.setT
@@ -4159,33 +4159,34 @@
                 
-r
+mR
 eturnedImage.set
@@ -4244,25 +4244,26 @@
             
-r
+mR
 eturnedName.
@@ -4287,25 +4287,26 @@
             
-r
+mR
 eturnedImage

Update field variable names to Android code style