62 lines
1.9 KiB
Java
62 lines
1.9 KiB
Java
package ch.dissem.apps.abit;
|
|
|
|
import android.os.Bundle;
|
|
import android.support.v4.app.Fragment;
|
|
import android.view.LayoutInflater;
|
|
import android.view.View;
|
|
import android.view.ViewGroup;
|
|
import android.widget.TextView;
|
|
import ch.dissem.bitmessage.entity.Plaintext;
|
|
|
|
|
|
/**
|
|
* A fragment representing a single Message detail screen.
|
|
* This fragment is either contained in a {@link MessageListActivity}
|
|
* in two-pane mode (on tablets) or a {@link MessageDetailActivity}
|
|
* on handsets.
|
|
*/
|
|
public class MessageDetailFragment extends Fragment {
|
|
/**
|
|
* The fragment argument representing the item ID that this fragment
|
|
* represents.
|
|
*/
|
|
public static final String ARG_ITEM = "item";
|
|
|
|
/**
|
|
* The dummy content this fragment is presenting.
|
|
*/
|
|
private Plaintext item;
|
|
|
|
/**
|
|
* Mandatory empty constructor for the fragment manager to instantiate the
|
|
* fragment (e.g. upon screen orientation changes).
|
|
*/
|
|
public MessageDetailFragment() {
|
|
}
|
|
|
|
@Override
|
|
public void onCreate(Bundle savedInstanceState) {
|
|
super.onCreate(savedInstanceState);
|
|
|
|
if (getArguments().containsKey(ARG_ITEM)) {
|
|
// Load the dummy content specified by the fragment
|
|
// arguments. In a real-world scenario, use a Loader
|
|
// to load content from a content provider.
|
|
item = (Plaintext) getArguments().getSerializable(ARG_ITEM);
|
|
}
|
|
}
|
|
|
|
@Override
|
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
|
Bundle savedInstanceState) {
|
|
View rootView = inflater.inflate(R.layout.fragment_message_detail, container, false);
|
|
|
|
// Show the dummy content as text in a TextView.
|
|
if (item != null) {
|
|
((TextView) rootView.findViewById(R.id.message_detail)).setText(item.getText());
|
|
}
|
|
|
|
return rootView;
|
|
}
|
|
}
|