rien a commit
authornikita@nikita-rack
Sat, 04 Apr 2009 10:13:51 +0200
changeset 66 661aa8634e98
parent 65 fcafa1e28942 (current diff)
parent 62 ec87eec66d56 (diff)
child 68 0c76c67a2b99
rien a commit
--- a/src/com/beem/project/beem/ui/ContactList.java	Sat Apr 04 09:59:40 2009 +0200
+++ b/src/com/beem/project/beem/ui/ContactList.java	Sat Apr 04 10:13:51 2009 +0200
@@ -49,7 +49,7 @@
 	Map<String, Contact> child = (HashMap<String, Contact>) parent
 		.getExpandableListAdapter().getChild(groupPosition,
 			childPosition);
-	i.putExtra("contact", child.values().toArray());
+	i.putExtra("contact", child.get("CHILD"));
 	startActivity(i);
 	return true;
     }
@@ -181,6 +181,7 @@
 		Map<String, Contact> curChildMap = new HashMap<String, Contact>();
 		children.add(curChildMap);
 		Contact c = listContact.get(j);
+		Log.i(TAG, c.getID() + " " +c.getJID());
 		curChildMap.put("CHILD", c);
 	    }
 	    childData.add(children);
--- a/src/com/beem/project/beem/ui/SendIM.java	Sat Apr 04 09:59:40 2009 +0200
+++ b/src/com/beem/project/beem/ui/SendIM.java	Sat Apr 04 10:13:51 2009 +0200
@@ -25,112 +25,118 @@
  */
 
 public class SendIM extends ListActivity implements OnClickListener,
-		OnKeyListener {
-	private EditText mToSend;
-	private ArrayList<String> mMessages = new ArrayList<String>();
-	private ArrayAdapter<String> mAdapter;
-	private SendIMDialogSmiley mSmyDialog;
-	private SharedPreferences mSet;
-	private Contact mContact;
+	OnKeyListener {
+    private EditText mToSend;
+    private ArrayList<String> mMessages = new ArrayList<String>();
+    private ArrayAdapter<String> mAdapter;
+    private SendIMDialogSmiley mSmyDialog;
+    private SharedPreferences mSet;
+    private Contact mContact;
 
-	/**
-	 * Constructor.
-	 */
-	public SendIM() {
-		super();
-	}
+    /**
+     * Constructor.
+     */
+    public SendIM() {
+	super();
+    }
+
+    /**
+     * Overload of onCreate() Activity inherited function
+     */
+    @Override
+    public void onCreate(Bundle saveBundle) {
+	super.onCreate(saveBundle);
 
-	/**
-	 * Overload of onCreate() Activity inherited function
-	 */
-	@Override
-	public void onCreate(Bundle saveBundle) {
-		super.onCreate(saveBundle);
-		
-		setContentView(R.layout.sendim);
-		mToSend = (EditText) findViewById(R.id.userText);
-		mSet = getSharedPreferences("lol", MODE_PRIVATE);
-		mSmyDialog = new SendIMDialogSmiley(this, mSet);
+	setContentView(R.layout.sendim);
+	mToSend = (EditText) findViewById(R.id.userText);
+	mSet = getSharedPreferences("lol", MODE_PRIVATE);
+	mSmyDialog = new SendIMDialogSmiley(this, mSet);
+
+	mAdapter = new ArrayAdapter<String>(this, R.layout.messagelist,
+		mMessages);
+	setListAdapter(mAdapter);
+
+	mToSend.setOnClickListener(this);
+	mToSend.setOnKeyListener(this);
 
-		mAdapter = new ArrayAdapter<String>(this, R.layout.messagelist,
-				mMessages);
-		setListAdapter(mAdapter);
+	mContact = getIntent().getParcelableExtra("contact");
+    }
+
+    @Override
+    public void onStart() {
+	super.onStart();
 
-		mToSend.setOnClickListener(this);
-		mToSend.setOnKeyListener(this);
-		
-		mContact = getIntent().getParcelableExtra("contact");
-	}
+    }
+
+    /**
+     * Abstract method inherited from OnClickListener
+     */
+    public void onClick(View view) {
+	sendText();
+    }
 
-	@Override
-	public void onStart() {
-		super.onStart();
-
+    /**
+     * This method send a message to the server over the XMPP connection and
+     * display it on activity view TODO : Exception si la connexion se coupe
+     * pendant la conversation
+     */
+    private void sendText() {
+	String text = mToSend.getText().toString();
+	if (!text.equals("")) {
+	    /*
+	     * Prepare the message to be send
+	     */
+	    /* Message msg = new Message("barbu", Message.Type.chat); */
+	    /* msg.setBody(text); */
+	    /*
+	     * Rien a voir il faut changer le mContact.getJID() et remplacer
+	     * avec son pseudo cetait juste un test pour savoir qu'on recupere
+	     * bien le contact a qui envoyer les infos
+	     */
+	    mAdapter.add(mContact.getJID() + " "
+		    + getString(R.string.SendIMSays) + text);
+	    mToSend.setText(null);
 	}
-
-	/**
-	 * Abstract method inherited from OnClickListener
-	 */
-	public void onClick(View view) {
-		sendText();
-	}
+    }
 
-	/**
-	 * This method send a message to the server over the XMPP connection and
-	 * display it on activity view TODO : Exception si la connexion se coupe
-	 * pendant la conversation
-	 */
-	private void sendText() {
-		String text = mToSend.getText().toString();
-		if (!text.equals("")) {
-			/*
-			 * Prepare the message to be send
-			 */
-			/* Message msg = new Message("barbu", Message.Type.chat); */
-			/* msg.setBody(text); */
-			mAdapter.add(getString(R.string.PreferenceJID) + " " + getString(R.string.SendIMSays) + text);
-			mToSend.setText(null);
-		}
+    /**
+     * Abstract method inherited from OnKeyListener
+     */
+    public boolean onKey(View v, int keyCode, KeyEvent event) {
+	if (event.getAction() == KeyEvent.ACTION_DOWN) {
+	    switch (keyCode) {
+		case KeyEvent.KEYCODE_DPAD_CENTER:
+		case KeyEvent.KEYCODE_ENTER:
+		    sendText();
+		    return true;
+	    }
 	}
+	return false;
+    }
 
-	/**
-	 * Abstract method inherited from OnKeyListener
-	 */
-	public boolean onKey(View v, int keyCode, KeyEvent event) {
-		if (event.getAction() == KeyEvent.ACTION_DOWN) {
-			switch (keyCode) {
-			case KeyEvent.KEYCODE_DPAD_CENTER:
-			case KeyEvent.KEYCODE_ENTER:
-				sendText();
-				return true;
-			}
-		}
+    /**
+     * Callback for menu creation.
+     * 
+     * @param menu
+     *            the menu created
+     * @return true on success, false otherwise
+     */
+    @Override
+    public final boolean onCreateOptionsMenu(Menu menu) {
+	super.onCreateOptionsMenu(menu);
+	MenuInflater inflater = getMenuInflater();
+	inflater.inflate(R.menu.sendimmenu, menu);
+	return true;
+    }
+
+    @Override
+    public final boolean onOptionsItemSelected(MenuItem item) {
+	switch (item.getItemId()) {
+	    case R.id.sendim_smiley:
+		mSmyDialog.show();
+		return true;
+	    default:
 		return false;
 	}
-
-	/**
-	 * Callback for menu creation.
-	 * 
-	 * @param menu
-	 *            the menu created
-	 * @return true on success, false otherwise
-	 */
-	@Override
-	public final boolean onCreateOptionsMenu(Menu menu) {
-		super.onCreateOptionsMenu(menu);
-		MenuInflater inflater = getMenuInflater();
-		inflater.inflate(R.menu.sendimmenu, menu);
-		return true;
-	}
-
-	@Override
-	public final boolean onOptionsItemSelected(MenuItem item) {
-		switch (item.getItemId()) {
-		case R.id.sendim_smiley:
-			mSmyDialog.show();
-			return true;
-		default:
-			return false;
-		}
-	}
+    }
 }