package com.seandbeach.stockticker;

import android.content.Intent;
import android.support.v4.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

/**
 * A placeholder fragment containing a simple view.
 */
public class DetailActivityFragment extends Fragment {

    public DetailActivityFragment() {
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        Intent intent = getActivity().getIntent();
        View rootView = inflater.inflate(R.layout.fragment_detail, container, false);
        if (intent != null && intent.hasExtra(Intent.EXTRA_TEXT)) {
            String quote = intent.getStringExtra(Intent.EXTRA_TEXT);
            ((TextView) rootView.findViewById(R.id.detail_text))
                    .setText(quote);
        }
        return rootView;
    }
}

@@ -57,24 +57,50 @@
 ent.Intent;%0A
+import android.os.Bundle;%0A
 import andro
@@ -146,53 +146,243 @@
 oid.
-os.Bundle;%0Aimport android.view.LayoutInflater
+support.v4.view.MenuItemCompat;%0Aimport android.support.v7.widget.ShareActionProvider;%0Aimport android.util.Log;%0Aimport android.view.LayoutInflater;%0Aimport android.view.Menu;%0Aimport android.view.MenuInflater;%0Aimport android.view.MenuItem
 ;%0Aim
@@ -585,16 +585,135 @@
 ment %7B%0A%0A
+    private static final String LOG_TAG = DetailActivityFragment.class.getSimpleName();%0A    private String mQuoteStr;%0A%0A
     publ
@@ -738,24 +738,57 @@
 ragment() %7B%0A
+        setHasOptionsMenu(true);%0A
     %7D%0A%0A    @
@@ -1150,20 +1150,17 @@
     
-String q
+mQ
 uote
+Str
  = i
@@ -1298,13 +1298,17 @@
 ext(
-q
+mQ
 uote
+Str
 );%0A 
@@ -1346,11 +1346,1243 @@
 w;%0A    %7D
+%0A%0A    @Override%0A    public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) %7B%0A        // Inflate the menu; this adds items to the action bar if it is present.%0A        inflater.inflate(R.menu.detail_fragment, menu);%0A%0A        // Retrieve the share menu item%0A        MenuItem menuItem = menu.findItem(R.id.action_share);%0A%0A        // Get the provider and hold onto it to set/change the share intent.%0A        ShareActionProvider mShareActionProvider = (ShareActionProvider) MenuItemCompat.getActionProvider(menuItem);%0A%0A        // Attach an intent to this ShareActionProvider.  You can update this at any time,%0A        // like when the user selects a new piece of data they might like to share.%0A        if (mShareActionProvider != null ) %7B%0A            mShareActionProvider.setShareIntent(createShareQuoteIntent());%0A        %7D else %7B%0A            Log.d(LOG_TAG, %22Share Action Provider is null?%22);%0A        %7D%0A    %7D%0A%0A    private Intent createShareQuoteIntent() %7B%0A        Intent shareIntent = new Intent(Intent.ACTION_SEND);%0A        shareIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);%0A        shareIntent.setType(%22text/plain%22);%0A        shareIntent.putExtra(Intent.EXTRA_TEXT, mQuoteStr);%0A        return shareIntent;%0A    %7D
 %0A%7D%0A

Add ShareActionProvider to DetailFragment