package edu.ua.caps.objectmappertest;

import java.util.ArrayList;

import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.widget.TextView;
import edu.ua.caps.ObjectMapper.OMXmlObject;
import edu.ua.caps.ObjectMapper.ObjectMapper;

public class MainActivity extends Activity {

	public TextView mTxt;
	SomeObject so;
	OMXmlObject xml,xml2;
	
	Note note;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		ArrayList<String> reallys = new ArrayList<String>();
		
		reallys.add("really");
		reallys.add("really");
		reallys.add("really");
		reallys.add("really");
		
		ArrayList<SomeOtherObject> bam = new ArrayList<SomeOtherObject>();
		bam.add(new SomeOtherObject("hi", "bu bye"));
		bam.add(new SomeOtherObject("hola", "Asta Lavista"));
		bam.add(new SomeOtherObject("bonjour", "au revoir"));
		so = new SomeObject( 1 ,"This", "is", "something", reallys, "freaking", "Cool",bam,new SomeOtherObject("sup", "dueces"));
		xml = new OMXmlObject(so);
		String text = ObjectMapper.toXML(xml);
		note = new Note("Matt", "Aaron", "XML MAPPING", "So I think this should work but we shall see");
		xml2 = new OMXmlObject(note);
		String noteToMatt = ObjectMapper.toXML(xml2);
		
		Note note2 = (Note) ObjectMapper.fromXML(noteToMatt, Note.class);
		mTxt = (TextView) findViewById(R.id.mtxt1);
		mTxt.setText(text +"\n\n\n\n" + noteToMatt  +"\n\n\n\nTo: " + note2.getTo() + "\nFrom: "+ note.getFrom()+ "\nHeading: "+ note.getHeading()+ "\n\nBody:\n"+ note.getBody());

	}

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

}

@@ -327,21 +327,22 @@
  %7B%0D%0A%0D%0A%09p
-ublic
+rivate
  TextVie
@@ -351,16 +351,24 @@
 mTxt;%0D%0A%09
+private 
 SomeObje
@@ -376,16 +376,24 @@
 t so;%0D%0A%09
+private 
 OMXmlObj
@@ -412,20 +412,165 @@
 ;%0D%0A%09
-%0D%0A%09Note note
+private Note note;%0D%0A%09private ArrayList%3CString%3E reallys = new ArrayList%3CString%3E();%0D%0A%09private ArrayList%3CSomeOtherObject%3E bam = new ArrayList%3CSomeOtherObject%3E()
 ;%0D%0A%0D
@@ -725,64 +725,50 @@
 %0D%0A%09%09
-ArrayList%3CString%3E reallys = new ArrayList%3CString%3E();%0D%0A%09%09
+%0D%0A%09%09//Adding content to a string arrayList
 %0D%0A%09%09
@@ -879,74 +879,47 @@
 %0D%0A%09%09
-ArrayList%3CSomeOtherObject%3E bam = new ArrayList%3CSomeOtherObject%3E();
+//Adding Content to a complex ArrayList
 %0D%0A%09%09
@@ -1079,16 +1079,60 @@
 ir%22));%0D%0A
+%09%09%0D%0A%09%09//Adding Content to a Complex object%0D%0A
 %09%09so = n
@@ -1254,34 +1254,151 @@
 %0D%0A%09%09
-xml = new OMXmlObject(so);
+%0D%0A%09%09//Creating an OMXmlObject with the SomeObject as a parameter%0D%0A%09%09xml = new OMXmlObject(so);%0D%0A%09%09//Creating an xml String from the OMXmlObject
 %0D%0A%09%09
@@ -1437,16 +1437,23 @@
 (xml);%0D%0A
+%09%09%0D%0A%09%0D%0A
 %09%09note =
@@ -1550,90 +1550,307 @@
 %0D%0A%09%09
-xml2 = new OMXmlObject(note);%0D%0A%09%09String noteToMatt = ObjectMapper.toXML(xml2);%0D%0A%09%09
+//Creating an OMXmlObject with the note as a parameter%0D%0A%09%09xml2 = new OMXmlObject(note);%0D%0A%09%09//Creating an xml String from the OMXmlObject%0D%0A%09%09String noteToMatt = ObjectMapper.toXML(xml2);%0D%0A%09%09//Create complex object from xml String. all you need to do is tell it what object you want to map the xml to.
 %0D%0A%09%09

Update MainActivity.java