Merge ui and xmpp
authorDa Risk <darisk972@gmail.com>
Thu, 26 Mar 2009 18:26:13 +0100
changeset 41 c537c1ea3636
parent 40 abf9da283377 (current diff)
parent 28 5b42427793c5 (diff)
child 42 a0baf41c24a1
child 44 ff7b74becc50
Merge ui and xmpp
project.aidl
src/com/beem/project/beem/service/aidl/IRoster.aidl
src/com/beem/project/beem/ui/ContactList.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project.aidl	Thu Mar 26 18:26:13 2009 +0100
@@ -0,0 +1,6 @@
+// This file is auto-generated by the
+//    'Create Aidl preprocess file for Parcelable classes'
+// action. Do not modify!
+
+parcelable com.beem.project.beem.BeemException
+parcelable com.beem.project.beem.service.Contact
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/res/layout/messagelist.xml	Thu Mar 26 18:26:13 2009 +0100
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<TextView xmlns:android="http://schemas.android.com/apk/res/android" id="text1"
+          android:textStyle="bold"
+          android:singleLine="false"
+          android:layout_width="fill_parent"
+          android:layout_height="wrap_content"/>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/res/layout/sendim.xml	Thu Mar 26 18:26:13 2009 +0100
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+              android:orientation="vertical"
+              android:layout_width="fill_parent"
+              android:layout_height="fill_parent"
+        >
+    <ListView android:id="@+id/listMessages"
+              android:layout_width="wrap_content"
+              android:layout_height="wrap_content"
+              android:layout_weight="1"
+              android:scrollbars="horizontal"
+            />
+    <EditText android:id="@+id/sendText"
+              android:layout_width="fill_parent"
+              android:layout_height="wrap_content"
+              android:singleLine="true"
+              android:textSize="16sp"
+              android:autoText="false"
+              android:capitalize="none"
+              android:scrollHorizontally="true"/>
+    <Button android:id="@+id/send"
+            android:layout_width="fill_parent"
+            android:layout_height="wrap_content"
+            android:text="Send">
+    </Button>
+</LinearLayout>
--- a/src/com/beem/project/beem/service/aidl/IRoster.aidl	Thu Mar 26 18:19:57 2009 +0100
+++ b/src/com/beem/project/beem/service/aidl/IRoster.aidl	Thu Mar 26 18:26:13 2009 +0100
@@ -1,6 +1,6 @@
 package com.beem.project.beem.service.aidl;
 
-import com.beem.project.beem.service.aidl.IRosterEntry;
+import com.beem.project.beem.service.Contact;
 
 interface IRoster {
     
--- a/src/com/beem/project/beem/ui/ContactList.java	Thu Mar 26 18:19:57 2009 +0100
+++ b/src/com/beem/project/beem/ui/ContactList.java	Thu Mar 26 18:26:13 2009 +0100
@@ -39,6 +39,7 @@
 
     private void showContactList() {
         ExpandableListAdapter Adapter;
+        
         List<Map<String, String>> groupData = new ArrayList<Map<String, String>>();
         List<List<Map<String, String>>> childData = new ArrayList<List<Map<String, String>>>();
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/com/beem/project/beem/ui/SendIM.java	Thu Mar 26 18:26:13 2009 +0100
@@ -0,0 +1,52 @@
+package com.beem.project.beem.ui;
+
+import java.util.ArrayList;
+
+import org.jivesoftware.smack.packet.Message;
+
+import android.app.Activity;
+import android.os.Bundle;
+import android.view.View;
+import android.widget.ArrayAdapter;
+import android.widget.Button;
+import android.widget.EditText;
+import android.widget.ListView;
+
+import com.beem.project.beem.R;
+
+public class SendIM extends Activity {
+	private EditText		mToSend;
+	private ListView		mList;
+	private ArrayList<String>	mMessages = new ArrayList<String>();
+	
+	@Override
+    public void onCreate(Bundle saveBundle) {
+        super.onCreate(saveBundle);
+        setContentView(R.layout.sendim);
+        mToSend = (EditText) findViewById(R.id.sendText);
+        mList = (ListView) findViewById(R.id.listMessages);
+        
+        Button send = (Button) this.findViewById(R.id.send);
+        send.setOnClickListener(new View.OnClickListener() {
+            public void onClick(View view) {
+                String text = mToSend.getText().toString();
+                if (text != "")
+                {
+                    /*
+                     * Prepare the message to send 
+                     * */
+                    Message msg = new Message("barbu", Message.Type.chat);
+                    msg.setBody(text);
+                    mMessages.add("Barbu says:\n" + text);
+                    mToSend.setText("");
+                    setListAdapter();
+                }
+            }
+        });
+	}
+	
+	private void setListAdapter() {
+	    ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, R.layout.messagelist, mMessages);
+	    mList.setAdapter(adapter);
+	}
+}