package com.nbusy.app;

import android.content.Intent;
import android.os.Bundle;
import android.app.Activity;




/**
 * An activity representing a list of Messages. This activity
 * has different presentations for handset and tablet-size devices. On
 * handsets, the activity presents a list of items, which when touched,
 * lead to a {@link MessageDetailActivity} representing
 * item details. On tablets, the activity presents the list of items and
 * item details side-by-side using two vertical panes.
 * <p>
 * The activity makes heavy use of fragments. The list of items is a
 * {@link MessageListFragment} and the item details
 * (if present) is a {@link MessageDetailFragment}.
 * <p>
 * This activity also implements the required
 * {@link MessageListFragment.Callbacks} interface
 * to listen for item selections.
 */
public class MessageListActivity extends Activity
        implements MessageListFragment.Callbacks {

    /**
     * Whether or not the activity is in two-pane mode, i.e. running on a tablet
     * device.
     */
    private boolean mTwoPane;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_message_list);

        if (findViewById(R.id.message_detail_container) != null) {
            // The detail container view will be present only in the
            // large-screen layouts (res/values-large and
            // res/values-sw600dp). If this view is present, then the
            // activity should be in two-pane mode.
            mTwoPane = true;

            // In two-pane mode, list items should be given the
            // 'activated' state when touched.
            ((MessageListFragment) getFragmentManager()
                    .findFragmentById(R.id.message_list))
                    .setActivateOnItemClick(true);
        }

        // TODO: If exposing deep links into your app, handle intents here.
    }

    /**
     * Callback method from {@link MessageListFragment.Callbacks}
     * indicating that the item with the given ID was selected.
     */
    @Override
    public void onItemSelected(String id) {
        if (mTwoPane) {
            // In two-pane mode, show the detail view in this activity by
            // adding or replacing the detail fragment using a
            // fragment transaction.
            Bundle arguments = new Bundle();
            arguments.putString(MessageDetailFragment.ARG_ITEM_ID, id);
            MessageDetailFragment fragment = new MessageDetailFragment();
            fragment.setArguments(arguments);
            getFragmentManager().beginTransaction()
                    .replace(R.id.message_detail_container, fragment)
                    .commit();

        } else {
            // In single-pane mode, simply start the detail activity
            // for the selected item ID.
            Intent detailIntent = new Intent(this, MessageDetailActivity.class);
            detailIntent.putExtra(MessageDetailFragment.ARG_ITEM_ID, id);
            startActivity(detailIntent);
        }
    }
}

@@ -17,16 +17,45 @@
 y.app;%0A%0A
+import android.app.Activity;%0A
 import a
@@ -107,40 +107,8 @@
 le;%0A
-import android.app.Activity;%0A%0A%0A%0A
 %0A/**
@@ -169,19 +169,16 @@
 activity
-%0A *
  has dif
@@ -309,19 +309,16 @@
 touched,
-%0A *
  lead to
@@ -435,19 +435,16 @@
 tems and
-%0A *
  item de
@@ -489,24 +489,25 @@
 panes.%0A * %3Cp
+/
 %3E%0A * The act
@@ -564,19 +564,16 @@
 ems is a
-%0A *
  %7B@link 
@@ -671,16 +671,17 @@
 %7D.%0A * %3Cp
+/
 %3E%0A * Thi
@@ -719,19 +719,16 @@
 required
-%0A *
  %7B@link 
@@ -767,19 +767,16 @@
 nterface
-%0A *
  to list
@@ -852,24 +852,16 @@
 Activity
-%0A       
  impleme
@@ -985,23 +985,16 @@
 a tablet
-%0A     *
  device.
@@ -1340,31 +1340,16 @@
 y in the
-%0A            //
  large-s
@@ -1453,31 +1453,16 @@
 then the
-%0A            //
  activit
@@ -1584,31 +1584,16 @@
 iven the
-%0A            //
  'activa
@@ -1949,23 +1949,16 @@
 llbacks%7D
-%0A     *
  indicat
@@ -2170,31 +2170,16 @@
 ivity by
-%0A            //
  adding 
@@ -2218,31 +2218,16 @@
  using a
-%0A            //
  fragmen
@@ -2717,31 +2717,16 @@
 activity
-%0A            //
  for the

tidy up msg detail act.