package ca.ualberta.cs.cmput301f14t14.questionapp;

import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.TabHost;

public class QuestionActivity extends Activity {
	static final String TAB_ANSWERS = "answer";
	static final String TAB_COMMENTS = "comment";

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

		TabHost tabs = (TabHost) findViewById(android.R.id.tabhost);
		tabs.setup();

		TabHost.TabSpec aTab = tabs.newTabSpec(TAB_ANSWERS);
		aTab.setContent(R.id.answerSummaryList);
		aTab.setIndicator(getString(R.string.tab_answers));
		tabs.addTab(aTab);

		TabHost.TabSpec cTab = tabs.newTabSpec(TAB_COMMENTS);
		cTab.setContent(R.id.commentList);
		cTab.setIndicator(getString(R.string.tab_comments));
		tabs.addTab(cTab);
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.question, menu);
		return true;
	}

	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
		// Handle action bar item clicks here. The action bar will
		// automatically handle clicks on the Home/Up button, so long
		// as you specify a parent activity in AndroidManifest.xml.
		int id = item.getItemId();
		if (id == R.id.action_settings) {
			return true;
		}
		return super.onOptionsItemSelected(item);
	}
}

@@ -45,16 +45,206 @@
 onapp;%0A%0A
+import java.util.ArrayList;%0Aimport java.util.List;%0A%0Aimport ca.ualberta.cs.cmput301f14t14.questionapp.model.Comment;%0Aimport ca.ualberta.cs.cmput301f14t14.questionapp.view.CommentListAdapter;%0A
 import a
@@ -264,16 +264,16 @@
 tivity;%0A
-
 import a
@@ -346,16 +346,48 @@
 nuItem;%0A
+import android.widget.ListView;%0A
 import a
@@ -1100,24 +1100,24 @@
 comments));%0A
-
 %09%09tabs.addTa
@@ -1124,16 +1124,442 @@
 b(cTab);
+%0A%0A%09%09List%3CComment%3E cl = new ArrayList%3CComment%3E();%0A%09%09// Populate list with dummy data for now...%0A%09%09cl.add(new Comment(%22This is a demo comment which will exceed the screen width.%22, %22Boris%22));%0A%09%09cl.add(new Comment(%22Shorter comment.%22, %22Natasha%22));%0A%0A%09%09CommentListAdapter cla = new CommentListAdapter(this, R.layout.list_comment, cl);%0A%09%09ListView commentView = (ListView) findViewById(R.id.commentList);%0A%09%09commentView.setAdapter(cla);
 %0A%09%7D%0A%0A%09@O

Use the comment adapter in the question view.