--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/.hgignore Tue Mar 17 22:02:07 2009 +0100
@@ -0,0 +1,2 @@
+bin/*
+R.java
--- a/AndroidManifest.xml Mon Mar 16 14:32:06 2009 +0100
+++ b/AndroidManifest.xml Tue Mar 17 22:02:07 2009 +0100
@@ -11,5 +11,6 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
- </application>
+ <service android:name="BeemService" android:enabled="true" android:permission="android.permission.INTERNET" android:label="Beem Service"></service>
+</application>
</manifest>
Binary file res/drawable/logo.jpg has changed
--- a/res/layout/main.xml Mon Mar 16 14:32:06 2009 +0100
+++ b/res/layout/main.xml Tue Mar 17 22:02:07 2009 +0100
@@ -1,13 +1,39 @@
<?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"
- >
-<TextView
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:text="Hello World, Beem"
- />
+ android:orientation="vertical"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent">
+
+ <ImageView android:id="@+id/logo"
+ android:src="@drawable/logo"
+ android:adjustViewBounds="true"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"/>
+
+ <TextView android:text="Jabber ID"
+ android:textSize="25sp"
+ android:paddingLeft="100sp"
+ android:paddingTop="50sp"
+ android:paddingBottom="15sp"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content" />
+
+ <EditText android:id="@+id/jid"
+ android:singleLine="true"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:scrollHorizontally="true" />
+
+ <TextView
+ android:layout_width="fill_parent"
+ android:layout_height="10sp"/>
+
+ <Button android:id="@+id/connection"
+ android:textSize="20sp"
+ android:singleLine="true"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:text="Connection" />
+
</LinearLayout>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/res/layout/settings.xml Tue Mar 17 22:02:07 2009 +0100
@@ -0,0 +1,90 @@
+<?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"
+ >
+ <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="horizontal"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ >
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="Host/Port:"
+ android:minWidth="70dp"
+ />
+
+ <EditText android:id="@+id/host"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:singleLine="true"
+ android:textSize="16sp"
+ android:autoText="false"
+ android:capitalize="none"
+ android:minWidth="150dp"
+ android:scrollHorizontally="true"/>
+ <EditText android:id="@+id/port"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:singleLine="true"
+ android:textSize="16sp"
+ android:autoText="false"
+ android:minWidth="80dp"
+ android:capitalize="none"
+ android:scrollHorizontally="true"/>
+ </LinearLayout>
+
+ <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="horizontal"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ >
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="Userid:"
+ android:minWidth="70dp"
+ />
+ <EditText android:id="@+id/userid"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:singleLine="true"
+ android:textSize="16sp"
+ android:autoText="false"
+ android:minWidth="250dp"
+ android:capitalize="none"
+ android:scrollHorizontally="true"/>
+ </LinearLayout>
+ <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="horizontal"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ >
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="Password:"
+ android:minWidth="70dp"
+ />
+ <EditText android:id="@+id/password"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:singleLine="true"
+ android:password="true"
+ android:textSize="16sp"
+ android:autoText="false"
+ android:minWidth="250dp"
+ android:capitalize="none"
+ android:scrollHorizontally="true"/>
+ </LinearLayout>
+
+ <Button android:id="@+id/ok"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:text="OK">
+ <requestFocus/>
+ </Button>
+</LinearLayout>
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/res/menu/account.xml Tue Mar 17 22:02:07 2009 +0100
@@ -0,0 +1,6 @@
+<menu xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:id="@+id/account_edit"
+ android:title="Create or Edit Account" />
+ <item android:id="@+id/account_about"
+ android:title="About Beem" />
+</menu>
\ No newline at end of file
--- a/res/values/strings.xml Mon Mar 16 14:32:06 2009 +0100
+++ b/res/values/strings.xml Tue Mar 17 22:02:07 2009 +0100
@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">Beem</string>
+
</resources>
--- a/src/com/beem/project/beem/Beem.java Mon Mar 16 14:32:06 2009 +0100
+++ b/src/com/beem/project/beem/Beem.java Tue Mar 17 22:02:07 2009 +0100
@@ -1,16 +1,67 @@
package com.beem.project.beem;
import android.app.Activity;
+import android.content.SharedPreferences;
import android.os.Bundle;
+import android.view.Menu;
+import android.view.MenuInflater;
+import android.view.MenuItem;
+import android.widget.EditText;
public class Beem extends Activity {
+<<<<<<< local
/** Called when the activity is first created.
* @param savedInstanceState toto
*/
+=======
+ public static final String jabberSettings = "Beem";
+ private SharedPreferences mSettings;
+ /**
+ * Called when the activity is first created. */
+>>>>>>> other
@Override
public void onCreate(Bundle savedInstanceState) {
+<<<<<<< local
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
+=======
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.main);
+
+ mSettings = getSharedPreferences(jabberSettings, MODE_PRIVATE);
+ showJID();
+>>>>>>> other
}
+
+
+ public boolean onCreateOptionsMenu(Menu menu) {
+ super.onCreateOptionsMenu(menu);
+ MenuInflater inflater = getMenuInflater();
+ inflater.inflate(R.menu.account, menu);
+ return true;
+ }
+
+ 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);
+ }
+
+
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/com/beem/project/beem/SettingsDialog.java Tue Mar 17 22:02:07 2009 +0100
@@ -0,0 +1,64 @@
+package com.beem.project.beem;
+
+import android.app.Dialog;
+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;
+ }
+
+ 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);
+ }
+
+ public void onClick(View v) {
+ SharedPreferences.Editor editor = mSettings.edit();
+ editor.putString("host", getText(R.id.host));
+ editor.putString("port", getText(R.id.port));
+ editor.putString("login", getText(R.id.userid));
+ editor.putString("password", getText(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 getText(int id) {
+ EditText widget = (EditText) this.findViewById(id);
+ return widget.getText().toString();
+ }
+}