bug ui status fix.
authorMarseille
Sun, 31 Jan 2010 16:02:49 +0100
changeset 651 92aff14fc1e7
parent 650 f98ef87c34b8
child 652 2e313f61c7e7
bug ui status fix.
src/com/beem/project/beem/ui/ChangeStatus.java
--- a/src/com/beem/project/beem/ui/ChangeStatus.java	Sun Jan 31 15:41:27 2010 +0100
+++ b/src/com/beem/project/beem/ui/ChangeStatus.java	Sun Jan 31 16:02:49 2010 +0100
@@ -180,7 +180,7 @@
      * @return the status index from status the settings.
      */
     private int getPreferenceStatusIndex() {
-	return mSettings.getInt("PreferenceStatus", 0);
+	return mSettings.getInt(getString(R.string.PreferenceStatus), AVAILABLE_IDX);
     }
 
     /**
@@ -276,24 +276,27 @@
 		    int status = getStatusForService((String) mSpinner.getSelectedItem());
 		    Editor edit = mSettings.edit();
 		    edit.putString(getString(R.string.PreferenceStatusText), msg);
-		    edit.putInt(getString(R.string.PreferenceStatus), mSpinner.getSelectedItemPosition());
-		    edit.commit();
+		    
 		    if (status == Status.CONTACT_STATUS_DISCONNECT) {
 			stopService(new Intent(ChangeStatus.this, BeemService.class));
+			edit.putInt(getString(R.string.PreferenceStatus), AVAILABLE_IDX);
 		    } else {
 			try {
 			    mXmppFacade.changeStatus(status, msg.toString());
+			    edit.putInt(getString(R.string.PreferenceStatus), mSpinner.getSelectedItemPosition());
 			} catch (RemoteException e) {
 			    e.printStackTrace();
 			}
 			mToast.show();
 		    }
+		    edit.commit();
 		}
 		ChangeStatus.this.finish();
 	    } else if (v == mClear) {
 		mStatusMessageEditText.setText(null);
 	    } else if (v == mContact) {
 		startActivity(new Intent(ChangeStatus.this, ContactList.class));
+		ChangeStatus.this.finish();
 	    }
 	}
     }