[Demonstration 1]

[Buggy Method]
@Override
protected void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mContext = this;
    setContentView(R.layout.activity_my_stocks);
    checkForConnection();
    base_cl = (CoordinatorLayout) findViewById(R.id.base_cl);
    // The intent service is for executing immediate pulls from the Yahoo API
    // GCMTaskService can only schedule tasks, they cannot execute immediately
    mServiceIntent = new Intent(this, StockIntentService.class);
    mClickListener = new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            performApiCall(savedInstanceState);
        }
    };
    performApiCall(savedInstanceState);
    final RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recycler_view);
    recyclerView.setLayoutManager(new LinearLayoutManager(this));
    getLoaderManager().initLoader(CURSOR_LOADER_ID, null, this);
    mCursorAdapter = new QuoteCursorAdapter(this, null);
    recyclerView.addOnItemTouchListener(new RecyclerViewItemClickListener(this, new RecyclerViewItemClickListener.OnItemClickListener() {

        @Override
        public void onItemClick(View v, int position) {
            //TODO:
            // do something on item click
            Log.i(TAG, v.toString() + " : " + position + " : " + v.getTag().toString());
            Intent in = new Intent(MyStocksActivity.this, ChartActivity.class);
            in.putExtra("stock_symbol", v.getTag().toString());
            startActivity(in);
        }
    }));
    recyclerView.setAdapter(mCursorAdapter);
    FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
    fab.attachToRecyclerView(recyclerView);
    fab.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            if (checkForConnection()) {
                removeSnackBar();
                new MaterialDialog.Builder(mContext).title(R.string.symbol_search).content(R.string.content_test).inputType(InputType.TYPE_CLASS_TEXT).input(R.string.input_hint, R.string.input_prefill, new MaterialDialog.InputCallback() {

                    @Override
                    public void onInput(MaterialDialog dialog, CharSequence input) {
                        // On FAB click, receive user input. Make sure the stock doesn't already exist
                        // in the DB and proceed accordingly
                        Cursor c = getContentResolver().query(QuoteProvider.Quotes.CONTENT_URI, new String[] { QuoteColumns.SYMBOL }, QuoteColumns.SYMBOL + "= ?", new String[] { input.toString() }, null);
                        if (c.getCount() != 0) {
                            Toast toast = Toast.makeText(MyStocksActivity.this, "This stock is already saved!", Toast.LENGTH_LONG);
                            toast.setGravity(Gravity.CENTER, Gravity.CENTER, 0);
                            toast.show();
                            return;
                        } else {
                            // Add the stock to DB
                            mServiceIntent.putExtra("tag", "add");
                            mServiceIntent.putExtra("symbol", input.toString());
                            startService(mServiceIntent);
                        }
                    }
                }).show();
            } else {
                networkToast();
            }
        }
    });
    ItemTouchHelper.Callback callback = new SimpleItemTouchHelperCallback(mCursorAdapter);
    mItemTouchHelper = new ItemTouchHelper(callback);
    mItemTouchHelper.attachToRecyclerView(recyclerView);
    mTitle = getTitle();
    if (checkForConnection()) {
        long period = 3600L;
        long flex = 10L;
        String periodicTag = "periodic";
        // create a periodic task to pull stocks once every hour after the app has been opened. This
        // is so Widget data stays up to date.
        PeriodicTask periodicTask = new PeriodicTask.Builder().setService(StockTaskService.class).setPeriod(period).setFlex(flex).setTag(periodicTag).setRequiredNetwork(Task.NETWORK_STATE_CONNECTED).setRequiresCharging(false).build();
        // Schedule task with tag "periodic." This ensure that only the stocks present in the DB
        // are updated.
        GcmNetworkManager.getInstance(this).schedule(periodicTask);
    }
}

[Buggy Hunk]
Toast.makeText(MyStocksActivity.this, "This stock is already saved!",

[Patch]
Toast.makeText(MyStocksActivity.this, getString(R.string.stock_already_saved),

[Demonstration 2]

[Buggy Method]
private void showSaveDialog() {
    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setTitle(R.string.action_save);
    final EditText input = new EditText(this);
    input.setInputType(InputType.TYPE_CLASS_TEXT);
    input.setHint(R.string.hint_filename);
    input.setText(presenter.getFileName());
    builder.setView(input);
    builder.setPositiveButton("OK", (dialog, which) -> {
        if (input.getText().length() > 0) {
            presenter.setFileName(input.getText().toString());
            setTitle(input.getText());
            if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
                String path = getDocsPath() + input.getText();
                presenter.saveMarkdown(path);
            }
        }
    });
    builder.setNegativeButton("Cancel", (dialog, which) -> {
        dialog.cancel();
    });
    builder.show();
}

[Buggy Hunk]
setTitle(input.getText());

[Patch]
setTitle(presenter.getFileName());

[Demonstration 3]

[Buggy Method]
public void setData(User user, Comment comment) {
    if (user == null || comment == null) {
        return;
    }
    mTvName.setText("" + user.getUserName());
    mTvDate.setText("" + mReviewAdapter.newDateFormat(comment.getUpdatedAt()));
    mTvRating.setText("" + comment.getRating());
    mTvComment.setText("" + comment.getComment());
}

[Buggy Hunk]
mTvRating.setText("" + comment.getRating());

[Patch]
mTvRating.setText("" + comment.getRating() / 2);