Reorganisation des fichiers de linterface.
--- a/AndroidManifest.xml Thu Mar 19 22:27:28 2009 +0100
+++ b/AndroidManifest.xml Fri Mar 20 22:23:35 2009 +0100
@@ -1,24 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.beem.project.beem"
- android:versionCode="1"
- android:versionName="1.0">
- <application android:label="@string/app_name">
- <activity android:name=".Beem"
- android:label="@string/app_name">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
- </activity>
- <activity android:name=".UIContactList" 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><action android:name="com.beem.project.beem.BeemService"></action>
-</intent-filter>
-</service>
-</application>
-<permission android:permissionGroup="android.permission-group.NETWORK" android:label="BeemService" android:description="@string/BeemServiceDescription" android:name="com.beem.project.beem.BEEM_SERVICE"></permission>
-<uses-permission android:name="android.permission.INTERNET"></uses-permission>
-<uses-permission android:name="android.permission.VIBRATE"></uses-permission>
-<uses-permission android:name="com.beem.project.beem.BEEM_SERVICE"></uses-permission>
+ package="com.beem.project.beem" android:versionCode="1"
+ android:versionName="1.0">
+ <application android:label="@string/app_name">
+ <activity android:name=".ui.Beem" android:label="@string/app_name">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+ <activity android:name=".ui.ContactList" 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>
+ <action android:name="com.beem.project.beem.BeemService"></action>
+ </intent-filter>
+ </service>
+ </application>
+ <permission android:permissionGroup="android.permission-group.NETWORK"
+ android:label="BeemService" android:description="@string/BeemServiceDescription"
+ android:name="com.beem.project.beem.BEEM_SERVICE"></permission>
+ <uses-permission android:name="android.permission.INTERNET"></uses-permission>
+ <uses-permission android:name="android.permission.VIBRATE"></uses-permission>
+ <uses-permission android:name="com.beem.project.beem.BEEM_SERVICE"></uses-permission>
</manifest>
--- a/src/com/beem/project/beem/Beem.java Thu Mar 19 22:27:28 2009 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,71 +0,0 @@
-package com.beem.project.beem;
-
-import android.app.Activity;
-import android.content.Intent;
-import android.content.SharedPreferences;
-import android.os.Bundle;
-import android.util.Log;
-import android.view.Menu;
-import android.view.MenuInflater;
-import android.view.MenuItem;
-import android.view.View;
-import android.view.View.OnClickListener;
-import android.widget.Button;
-import android.widget.EditText;
-
-public class Beem extends Activity {
-
- private SharedPreferences mSettings;
-
- /**
- * Called when the activity is first created.
- */
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.main);
- mSettings = getSharedPreferences(getString(R.string.PreferenceFileName), MODE_PRIVATE);
- showJID();
-
- Button btConnection = (Button) findViewById(R.id.connection);
- btConnection.setOnClickListener(new OnClickListener() {
-;
- @Override
- public void onClick(View v) {
- startActivity(new Intent(Beem.this, UIContactList.class));
- }
- });
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- super.onCreateOptionsMenu(menu);
- MenuInflater inflater = getMenuInflater();
- inflater.inflate(R.menu.account, menu);
- return true;
- }
-
- @Override
- public boolean onOptionsItemSelected(MenuItem item) {
- SettingsDialog Dialog = new SettingsDialog(this, mSettings);
- switch (item.getItemId()) {
- case R.id.account_edit:
- Dialog.show();
- return true;
- case R.id.account_about:
- return true;
- }
- return false;
- }
-
- public void showJID() {
- EditText ejid = (EditText) findViewById(R.id.jid);
- String jid = mSettings.getString("login", "") +
- "@" + mSettings.getString("host", "") ;
- if (jid.length() == 1)
- jid = "Enter Jabber ID / Create New Account";
- ejid.setText(jid);
- }
-
-
-}
--- a/src/com/beem/project/beem/SettingsDialog.java Thu Mar 19 22:27:28 2009 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,67 +0,0 @@
-package com.beem.project.beem;
-
-import android.app.Dialog;
-import android.content.Context;
-import android.content.SharedPreferences;
-import android.view.View;
-import android.widget.Button;
-import android.widget.EditText;
-
-/**
- *
- */
-public class SettingsDialog extends Dialog implements android.view.View.OnClickListener {
-
- private Beem mbeem;
- private SharedPreferences mSettings;
- public SettingsDialog(Beem beem, SharedPreferences settings) {
- super(beem);
- this.mbeem = beem;
- this.mSettings = settings;
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- setContentView(R.layout.settings);
- getWindow().setFlags(4, 4);
- setTitle("Jabber Account Settings");
- showSettings();
- Button ok = (Button) findViewById(R.id.ok);
- ok.setOnClickListener(this);
- }
-
- @Override
- public void onClick(View v) {
- SharedPreferences.Editor editor = mSettings.edit();
- Context ctx = getContext();
- editor.putString(ctx.getString(R.string.PreferenceHostKey), getWidgetText(R.id.host));
- editor.putString(ctx.getString(R.string.PreferencePortKey), getWidgetText(R.id.port));
- editor.putString(ctx.getString(R.string.PreferenceLoginKey), getWidgetText(R.id.userid));
- editor.putString(ctx.getString(R.string.PreferencePasswordKey), getWidgetText(R.id.password));
- editor.commit();
- this.mbeem.showJID();
- dismiss();
- }
-
- private void showSettings() {
- String tmp;
- EditText eHost = (EditText) findViewById(R.id.host);
- if ((tmp = mSettings.getString("host","")) != "")
- eHost.setText(tmp);
- EditText ePort = (EditText) findViewById(R.id.port);
- if ((tmp = mSettings.getString("port","")) != "")
- ePort.setText(tmp);
- EditText eLogin = (EditText) findViewById(R.id.userid);
- if ((tmp = mSettings.getString("login","")) != "")
- eLogin.setText(tmp);
- EditText ePwd = (EditText) findViewById(R.id.password);
- if ((tmp = mSettings.getString("password","")) != "")
- ePwd.setText(tmp);
- }
-
- private String getWidgetText(int id) {
- EditText widget = (EditText) this.findViewById(id);
- return widget.getText().toString();
- }
-}
--- a/src/com/beem/project/beem/UIContactList.java Thu Mar 19 22:27:28 2009 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,81 +0,0 @@
-package com.beem.project.beem;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import com.beem.project.beem.service.IXMPPFacade;
-
-import android.app.ExpandableListActivity;
-import android.content.ComponentName;
-import android.content.Intent;
-import android.content.ServiceConnection;
-import android.os.Bundle;
-import android.os.IBinder;
-import android.util.Log;
-import android.widget.ExpandableListAdapter;
-import android.widget.SimpleExpandableListAdapter;
-
-public class UIContactList extends ExpandableListActivity {
-
- private IXMPPFacade mService = null;
-
- @Override
- public void onCreate(Bundle saveBundle) {
- super.onCreate(saveBundle);
- bindService(new Intent(this, BeemService.class), mConnection,
- BIND_AUTO_CREATE | BIND_DEBUG_UNBIND);
- showContactList();
- }
-
- 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>>>();
-
- for (int i = 0; i < 2; i++) {
- Map<String, String> curGroupMap = new HashMap<String, String>();
- groupData.add(curGroupMap);
- curGroupMap.put("NAME", "Group " + i);
-
- List<Map<String, String>> children = new ArrayList<Map<String, String>>();
- for (int j = 0; j < 5; j++) {
- Map<String, String> curChildMap = new HashMap<String, String>();
- children.add(curChildMap);
- curChildMap.put("NAME CHILD", "Child " + j);
- }
- childData.add(children);
- }
-
- Adapter = new SimpleExpandableListAdapter(this,
- groupData, R.layout.contactlistgroup,
- new String[] {"NAME"}, new int[] {R.id.textgroup},
- childData, R.layout.contactlist,
- new String[] {"NAME CHILD"}, new int[] {R.id.textchild});
- setListAdapter(Adapter);
- }
-
- private ServiceConnection mConnection = new ServiceConnection() {
- @Override
- public void onServiceConnected(ComponentName name, IBinder service) {
- mService = IXMPPFacade.Stub.asInterface(service);
- /*
- * mService.getGroupList(); mService.getContactList();
- */
- showContactList();
- }
-
- @Override
- public void onServiceDisconnected(ComponentName name) {
- }
-
- };
-
- @Override
- public void onDestroy() {
- super.onDestroy();
- unbindService(mConnection);
- }
-
-}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/com/beem/project/beem/ui/Beem.java Fri Mar 20 22:23:35 2009 +0100
@@ -0,0 +1,71 @@
+package com.beem.project.beem.ui;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.content.SharedPreferences;
+import android.os.Bundle;
+import android.view.Menu;
+import android.view.MenuInflater;
+import android.view.MenuItem;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.widget.Button;
+import android.widget.EditText;
+
+import com.beem.project.beem.R;
+
+public class Beem extends Activity {
+
+ private SharedPreferences mSettings;
+
+ /**
+ * Called when the activity is first created.
+ */
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.main);
+ mSettings = getSharedPreferences(
+ getString(R.string.PreferenceFileName), MODE_PRIVATE);
+ showJID();
+
+ Button btConnection = (Button) findViewById(R.id.connection);
+ btConnection.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ startActivity(new Intent(Beem.this, ContactList.class));
+ }
+ });
+ }
+
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ super.onCreateOptionsMenu(menu);
+ MenuInflater inflater = getMenuInflater();
+ inflater.inflate(R.menu.account, menu);
+ return true;
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ BeemDialogSettings Dialog = new BeemDialogSettings(this, mSettings);
+ switch (item.getItemId()) {
+ case R.id.account_edit:
+ Dialog.show();
+ return true;
+ case R.id.account_about:
+ return true;
+ }
+ return false;
+ }
+
+ public void showJID() {
+ EditText ejid = (EditText) findViewById(R.id.jid);
+ String jid = mSettings.getString("login", "") + "@"
+ + mSettings.getString("host", "");
+ if (jid.length() == 1)
+ jid = "Enter Jabber ID / Create New Account";
+ ejid.setText(jid);
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/com/beem/project/beem/ui/BeemDialogSettings.java Fri Mar 20 22:23:35 2009 +0100
@@ -0,0 +1,70 @@
+package com.beem.project.beem.ui;
+
+
+import android.app.Dialog;
+import android.content.Context;
+import android.content.SharedPreferences;
+import android.view.View;
+import android.widget.Button;
+import android.widget.EditText;
+
+import com.beem.project.beem.R;
+
+/**
+ *
+ */
+public class BeemDialogSettings extends Dialog implements android.view.View.OnClickListener {
+
+ private Beem mbeem;
+ private SharedPreferences mSettings;
+ public BeemDialogSettings(Beem beem, SharedPreferences settings) {
+ super(beem);
+ this.mbeem = beem;
+ this.mSettings = settings;
+ }
+
+ @Override
+ protected void onStart() {
+ super.onStart();
+ setContentView(R.layout.settings);
+ getWindow().setFlags(4, 4);
+ setTitle("Jabber Account Settings");
+ showSettings();
+ Button ok = (Button) findViewById(R.id.ok);
+ ok.setOnClickListener(this);
+ }
+
+ @Override
+ public void onClick(View v) {
+ SharedPreferences.Editor editor = mSettings.edit();
+ Context ctx = getContext();
+ editor.putString(ctx.getString(R.string.PreferenceHostKey), getWidgetText(R.id.host));
+ editor.putString(ctx.getString(R.string.PreferencePortKey), getWidgetText(R.id.port));
+ editor.putString(ctx.getString(R.string.PreferenceLoginKey), getWidgetText(R.id.userid));
+ editor.putString(ctx.getString(R.string.PreferencePasswordKey), getWidgetText(R.id.password));
+ editor.commit();
+ this.mbeem.showJID();
+ dismiss();
+ }
+
+ private void showSettings() {
+ String tmp;
+ EditText eHost = (EditText) findViewById(R.id.host);
+ if ((tmp = mSettings.getString("host","")) != "")
+ eHost.setText(tmp);
+ EditText ePort = (EditText) findViewById(R.id.port);
+ if ((tmp = mSettings.getString("port","")) != "")
+ ePort.setText(tmp);
+ EditText eLogin = (EditText) findViewById(R.id.userid);
+ if ((tmp = mSettings.getString("login","")) != "")
+ eLogin.setText(tmp);
+ EditText ePwd = (EditText) findViewById(R.id.password);
+ if ((tmp = mSettings.getString("password","")) != "")
+ ePwd.setText(tmp);
+ }
+
+ private String getWidgetText(int id) {
+ EditText widget = (EditText) this.findViewById(id);
+ return widget.getText().toString();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/com/beem/project/beem/ui/ContactList.java Fri Mar 20 22:23:35 2009 +0100
@@ -0,0 +1,82 @@
+package com.beem.project.beem.ui;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import android.app.ExpandableListActivity;
+import android.content.ComponentName;
+import android.content.Intent;
+import android.content.ServiceConnection;
+import android.os.Bundle;
+import android.os.IBinder;
+import android.widget.ExpandableListAdapter;
+import android.widget.SimpleExpandableListAdapter;
+
+import com.beem.project.beem.BeemService;
+import com.beem.project.beem.R;
+import com.beem.project.beem.service.IXMPPFacade;
+
+public class ContactList extends ExpandableListActivity {
+
+ private IXMPPFacade mService = null;
+
+ @Override
+ public void onCreate(Bundle saveBundle) {
+ super.onCreate(saveBundle);
+ bindService(new Intent(this, BeemService.class), mConnection,
+ BIND_AUTO_CREATE | BIND_DEBUG_UNBIND);
+ showContactList();
+ }
+
+ 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>>>();
+
+ for (int i = 0; i < 2; i++) {
+ Map<String, String> curGroupMap = new HashMap<String, String>();
+ groupData.add(curGroupMap);
+ curGroupMap.put("NAME", "Group " + i);
+
+ List<Map<String, String>> children = new ArrayList<Map<String, String>>();
+ for (int j = 0; j < 5; j++) {
+ Map<String, String> curChildMap = new HashMap<String, String>();
+ children.add(curChildMap);
+ curChildMap.put("NAME CHILD", "Child " + j);
+ }
+ childData.add(children);
+ }
+
+ Adapter = new SimpleExpandableListAdapter(this,
+ groupData, R.layout.contactlistgroup,
+ new String[] {"NAME"}, new int[] {R.id.textgroup},
+ childData, R.layout.contactlist,
+ new String[] {"NAME CHILD"}, new int[] {R.id.textchild});
+ setListAdapter(Adapter);
+ }
+
+ private ServiceConnection mConnection = new ServiceConnection() {
+ @Override
+ public void onServiceConnected(ComponentName name, IBinder service) {
+ mService = IXMPPFacade.Stub.asInterface(service);
+ /*
+ * mService.getGroupList(); mService.getContactList();
+ */
+ showContactList();
+ }
+
+ @Override
+ public void onServiceDisconnected(ComponentName name) {
+ }
+
+ };
+
+ @Override
+ public void onDestroy() {
+ super.onDestroy();
+ unbindService(mConnection);
+ }
+
+}