Ajout de l'activité changement de status
authorPhilippe Lago <lago_p@epitech.net>
Fri, 17 Apr 2009 17:56:55 +0200
changeset 110 f9be2a11c4c1
parent 109 ec30f9790f83
child 111 d0fab932cb6e
Ajout de l'activité changement de status
AndroidManifest.xml
res/layout/changestatus.xml
res/layout/contactlistsettings.xml
res/values/strings.xml
res/values/style.xml
src/com/beem/project/beem/ui/ChangeStatus.java
src/com/beem/project/beem/ui/SendIM.java
--- a/AndroidManifest.xml	Wed Apr 15 20:09:24 2009 +0200
+++ b/AndroidManifest.xml	Fri Apr 17 17:56:55 2009 +0200
@@ -11,6 +11,7 @@
 		</activity>
 		<activity android:name=".ui.ContactListSettings" android:label="@string/app_name" />
 		<activity android:name=".ui.SendIM" android:label="@string/app_name" />
+		<activity android:name=".ui.ChangeStatus" android:label="@string/app_name" />
 		<service android:name="BeemService" android:enabled="true"
 			android:label="Beem Service" android:permission="com.beem.project.beem.BEEM_SERVICE">
 			<intent-filter>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/res/layout/changestatus.xml	Fri Apr 17 17:56:55 2009 +0200
@@ -0,0 +1,40 @@
+<?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">
+	
+	<Spinner android:id="@+id/ChangeStatusSpinner"
+            android:layout_width="fill_parent"
+            android:layout_height="wrap_content"
+            android:drawSelectorOnTop="true"/>
+            
+    <TextView android:layout_width="fill_parent"
+    		android:layout_height="wrap_content"
+    		android:text="@string/ChangeStatusText"
+    		android:textColor="@color/blue_sky"/>
+   	
+   	<EditText android:id="@+id/ChangeStatusText"
+   			android:layout_width="fill_parent"
+   			android:layout_height="wrap_content"
+   			android:lines="6"/>
+   	
+   	<LinearLayout
+   		android:orientation="horizontal"
+   		android:layout_width="fill_parent"
+   		android:layout_height="wrap_content">
+   		
+	   	<Button android:id="@+id/ChangeStatusOk"
+	   		android:layout_width="fill_parent"
+	   		android:layout_height="fill_parent"
+	   		android:layout_weight="1"
+	   		android:text="@string/OkButton"/>
+	   		
+		<Button android:id="@+id/ChangeStatusCancel"
+	   		android:layout_width="fill_parent"
+	   		android:layout_height="fill_parent"
+	   		android:layout_weight="1"
+	   		android:text="@string/ClearButton"/>
+   	</LinearLayout>
+</LinearLayout>
\ No newline at end of file
--- a/res/layout/contactlistsettings.xml	Wed Apr 15 20:09:24 2009 +0200
+++ b/res/layout/contactlistsettings.xml	Fri Apr 17 17:56:55 2009 +0200
@@ -82,7 +82,7 @@
 
     <Button android:id="@+id/ok"
             android:layout_width="fill_parent"
-            android:layout_height="fill_parent"
+            android:layout_height="wrap_content"
             android:text="OK">
         <requestFocus/>
     </Button>
--- a/res/values/strings.xml	Wed Apr 15 20:09:24 2009 +0200
+++ b/res/values/strings.xml	Fri Apr 17 17:56:55 2009 +0200
@@ -1,7 +1,9 @@
 <?xml version="1.0" encoding="utf-8"?>
 <resources>
 	<string name="app_name">Beem</string>
-
+	<string name="OkButton">Ok</string>
+	<string name="ClearButton">Clear</string>
+	
 	<!--  Beem class -->
 	
 	<string name="BeemJabberID">Jabber ID</string>
@@ -29,11 +31,15 @@
 
 	<!--  SendIM class -->
 	<string name="SendIMSays"> says :\n</string>
+	<string name="SendIMYouSay">You say :\n</string>
 	<string name="SendIMToSendHint">Tip text here</string>
 	<string name="SendIMState">Is : </string>
 	<string name="SendIMFrom">and is speaking from : </string>
 	<string name="SendIMSmiley">Insert a smiley</string>
 	<string name="SendIMLoginHint">login</string>
 	<string name="SendIMNoStatusSet">No status set</string>
+	
+	<!--  ChangeStatus class -->
+	<string name="ChangeStatusText">Type here your status message :</string>
 
 </resources>
--- a/res/values/style.xml	Wed Apr 15 20:09:24 2009 +0200
+++ b/res/values/style.xml	Fri Apr 17 17:56:55 2009 +0200
@@ -6,7 +6,7 @@
   	<style name="customtheme.contactList"> 
     <item name="android:windowBackground">@drawable/background</item>
     <item name="android:windowNoTitle">true</item>
-    <item name="android:textColor">#FFFF00</item>
+    <item name="android:textColor">#000000</item>
     <item name="android:typeface">sans</item>
     <item name="android:textSize">18sp</item>
 
@@ -15,9 +15,17 @@
   	<style name="customtheme.jungle">
   	<item name="android:windowBackground">@drawable/background</item>
     <item name="android:windowNoTitle">true</item>
-    <item name="android:textColor">#FFFF00</item>
+    <item name="android:textColor">#FFFFFF</item>
     <item name="android:typeface">sans</item>
     <item name="android:textSize">18sp</item>
     </style>
   	
+  	<style name="customtheme.spinner">
+  	<item name="android:windowBackground">@drawable/background</item>
+    <item name="android:windowNoTitle">true</item>
+    <item name="android:textColor">#FF0000</item>
+    <item name="android:typeface">sans</item>
+    <item name="android:textSize">18sp</item>
+    </style>
+    
 </resources>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/com/beem/project/beem/ui/ChangeStatus.java	Fri Apr 17 17:56:55 2009 +0200
@@ -0,0 +1,27 @@
+package com.beem.project.beem.ui;
+
+import com.beem.project.beem.R;
+
+import android.app.Activity;
+import android.os.Bundle;
+import android.widget.ArrayAdapter;
+import android.widget.Spinner;
+
+public class ChangeStatus extends Activity {
+    
+    private static final String[] mStatus = {"Available for chat", "Available", "Busy", "Away",
+	"Unavailable", "Disconnected"};
+    
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        // TODO Auto-generated method stub
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.changestatus);
+        
+        Spinner s1 = (Spinner) findViewById(R.id.ChangeStatusSpinner);
+        ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
+                android.R.layout.simple_spinner_item, mStatus);
+        adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
+        s1.setAdapter(adapter);
+    }
+}
--- a/src/com/beem/project/beem/ui/SendIM.java	Wed Apr 15 20:09:24 2009 +0200
+++ b/src/com/beem/project/beem/ui/SendIM.java	Fri Apr 17 17:56:55 2009 +0200
@@ -1,14 +1,11 @@
 package com.beem.project.beem.ui;
 
-import java.util.ArrayList;
-
 import android.app.Activity;
 import android.content.SharedPreferences;
 import android.graphics.drawable.Drawable;
 import android.os.Bundle;
 import android.os.Handler;
 import android.os.RemoteException;
-import android.text.method.ScrollingMovementMethod;
 import android.util.Log;
 import android.view.KeyEvent;
 import android.view.Menu;
@@ -39,7 +36,7 @@
 public class SendIM extends Activity implements OnClickListener,
 	OnKeyListener {
     private EditText mToSend;
-    private ArrayList<String> mMessages = new ArrayList<String>();
+    //private ArrayList<String> mMessages = new ArrayList<String>();
     //private ArrayAdapter<String> mAdapter;
     private SendIMDialogSmiley mSmyDialog;
     private SharedPreferences mSet;
@@ -137,8 +134,6 @@
 	if (mSpeak == null)
 	    mSpeak = false;
 	String text = mToSend.getText().toString();
-	String from = mGlobalSettings.getString(
-		getString(R.string.PreferenceJID), "You");
 	if (!text.equals("")) {
 	    Message msg = new Message(mContact.getJID(), Message.MSG_TYPE_CHAT);
 	    msg.setBody(text);
@@ -148,9 +143,8 @@
 		// TODO Auto-generated catch block
 		e.printStackTrace();
 	    }
-	    //mAdapter.add(from + getString(R.string.SendIMSays) + text);
 	    if (!mSpeak)
-		mText.append(from + getString(R.string.SendIMSays) + text + "\n");
+		mText.append(getString(R.string.SendIMYouSay) + text + "\n");
 	    else
 		mText.append(text + "\n");
 	    mToSend.setText(null);