/*
UA CMPUT 301 Project Group: CMPUT301W15T06

Copyright {2015} {Jingjiao Ni

              Tianqi Xiao

              Jiafeng Wu

              Xinyi Pan 

              Xinyi Wu

              Han Wang}
Licensed under the Apache License, Version 2.0 (the "License");

you may not use this file except in compliance with the License.

You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 
Unless required by applicable law or agreed to in writing, software distributed under 
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 
ANY KIND, either express or implied. See the License for the specific language 
governing permissions and limitations under the License.

 */
package ca.ualberta.CMPUT301W15T06;

import java.util.ArrayList;

import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.TextView;

public class ClaimantClaimDetailActivity extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_claimant_add_destination);
		
		TextView nameView= (TextView) findViewById(R.id.nameValueClaimantClaimDetailTextView);
		TextView beginView=(TextView) findViewById(R.id.startDateValueClaimantClaimDetailTextView);
		TextView endView=(TextView) findViewById(R.id.endingDateValueClaimantClaimDetailTextView);
		nameView.setText(AppSingleton.getInstance().getCurrentClaim().getName());
		beginView.setText(AppSingleton.formatDate(AppSingleton.getInstance().getCurrentClaim().getBeginDate()));
		endView.setText(AppSingleton.formatDate(AppSingleton.getInstance().getCurrentClaim().getEndDate()));
		ListView listView = (ListView) findViewById(R.id.claimantDetailListView);
		ArrayList<Destination> list =AppSingleton.getInstance().getCurrentClaim().getDestinationList();
		final ArrayAdapter<Destination> adapter=new ArrayAdapter<Destination>(this, android.R.layout.simple_list_item_1,list);
		listView.setAdapter(adapter);
		
		
		Listener l=new Listener() {
			
			@Override
			public void update() {
				adapter.notifyDataSetChanged();
			}
		};
		
		AppSingleton.getInstance().getCurrentClaim().addListener(l);
		
		for (Destination dest:AppSingleton.getInstance().getCurrentClaim().getDestinationList()){
			dest.addListener(l);
		};
		
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.claimant_add_destination, menu);
		return true;
	}
	
	
	
	public void addDestination(View v){
		Intent intent =new Intent(ClaimantClaimDetailActivity.this,ClaimantAddDestinationActivity.class);
		startActivity(intent);	
	}

}

@@ -723,16 +723,893 @@
 cense.%0A%0A
+ */%0A %0A /**%0A * This %3Ccode%3EClaimantClaimDetailActivity%3C/code%3E class is an extended class%0A * of %3Ccode%3EActivity%3C/code%3E class. This class will control the interface%0A * of %3Ccode%3EClaim%3C/code%3E detail for claimant. This view displays %0A * %3Ccode%3EClaim%3C/code%3E details,  and creates an option menu, including claimant's%0A * name, travel begin and end date, destination. It will be used when the claimant %0A * asks to access to the %3Ccode%3EClaim%3C/code%3E detail. The associated class including%0A * %3Ccode%3EClaim%3C/code%3E and %3Ccode%3EDestination%3C/code%3E.%0A * %0A * @author CMPUT301W15T06%0A * @version 03/16/2015%0A * @see java.util.ArrayList%0A * @see android.os.Bundle%0A * @see android.app.Activity%0A * @see android.content.Intent%0A * @see android.view.Menu%0A * @see android.view.View%0A * @see android.widget.ArrayAdapter%0A * @see android.widget.EditText%0A * @see android.widget.ListView%0A * @see android.widget.TextView%0A
  */%0Apack
@@ -3605,18 +3605,281 @@
 ;%0A%09%7D%0A%09%0A%09
-%0A%09
+/**%0A%09 * Set up a addDestination view. This method will be called when the %0A%09 * claimant wants to add a new %3Ccode%3EDestination%3C/code%3E to a current%0A%09 * %3Ccode%3EClaim%3C/code%3E.%0A%09 * %0A%09 * @param v  a View object%0A%09 * @see android.view.View%0A%09 * @see android.content.Intent%0A%09 */
 %0A%09public

Update ClaimantClaimDetailActivity.java