# HG changeset patch # User nikita@nikita-laptop # Date 1257642079 -3600 # Node ID 973f28f405bc1730de4d0e8d6fcc861b03c93d5c # Parent 6c2a766f2297e945e1488b39289f0e3cde9e9e1f divers petites opti et un petit debug dans Login diff -r 6c2a766f2297 -r 973f28f405bc res/layout/contactlist_group.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/res/layout/contactlist_group.xml Sun Nov 08 02:01:19 2009 +0100 @@ -0,0 +1,4 @@ + + \ No newline at end of file diff -r 6c2a766f2297 -r 973f28f405bc res/layout/contactlistcontact.xml --- a/res/layout/contactlistcontact.xml Sat Nov 07 07:06:17 2009 +0100 +++ b/res/layout/contactlistcontact.xml Sun Nov 08 02:01:19 2009 +0100 @@ -1,12 +1,9 @@ + android:layout_height="wrap_content" android:paddingLeft="10px" + android:paddingRight="10px" android:paddingTop="4px" + android:paddingBottom="4px" android:gravity="center_vertical"> + android:maxLines="1" android:textColor="@color/white" + android:textSize="14px" android:textStyle="bold" /> + android:maxLines="1" android:linksClickable="false" android:autoLink="all" + android:scrollHorizontally="true" android:textColor="@color/white" + android:textSize="12px" /> diff -r 6c2a766f2297 -r 973f28f405bc res/values-fr/strings.xml --- a/res/values-fr/strings.xml Sat Nov 07 07:06:17 2009 +0100 +++ b/res/values-fr/strings.xml Sun Nov 08 02:01:19 2009 +0100 @@ -169,7 +169,6 @@ Créer un compte Se connecter Les paramètres ont été enregistrés avec succès. - beem_settings beem_account_username beem_account_password diff -r 6c2a766f2297 -r 973f28f405bc res/values/colors.xml --- a/res/values/colors.xml Sat Nov 07 07:06:17 2009 +0100 +++ b/res/values/colors.xml Sun Nov 08 02:01:19 2009 +0100 @@ -3,4 +3,5 @@ #A0C8FF #000000 #FFFFFF + #FF0000 \ No newline at end of file diff -r 6c2a766f2297 -r 973f28f405bc res/values/strings.xml --- a/res/values/strings.xml Sat Nov 07 07:06:17 2009 +0100 +++ b/res/values/strings.xml Sun Nov 08 02:01:19 2009 +0100 @@ -157,7 +157,6 @@ Create an account Login The settings have been saved successfully. - beem_settings beem_account_username beem_account_password diff -r 6c2a766f2297 -r 973f28f405bc src/com/beem/project/beem/ui/ContactList.java --- a/src/com/beem/project/beem/ui/ContactList.java Sat Nov 07 07:06:17 2009 +0100 +++ b/src/com/beem/project/beem/ui/ContactList.java Sun Nov 08 02:01:19 2009 +0100 @@ -18,14 +18,11 @@ import android.content.SharedPreferences; import android.graphics.Bitmap; import android.graphics.BitmapFactory; -import android.graphics.Color; -import android.graphics.Typeface; import android.os.Bundle; import android.os.Handler; import android.os.IBinder; import android.os.RemoteException; import android.preference.PreferenceManager; -import android.util.Log; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuInflater; @@ -71,6 +68,7 @@ private final ServiceConnection mServConn = new BeemServiceConnection(); private BeemBroadcastReceiver mReceiver; private Map mIconsMap = new HashMap(); + private LayoutInflater mInflater; static { SERVICE_INTENT.setComponent(new ComponentName("com.beem.project.beem", "com.beem.project.beem.BeemService")); @@ -96,6 +94,7 @@ mHandler = new Handler(); mReceiver = new BeemBroadcastReceiver(mServConn); this.registerReceiver(mReceiver, new IntentFilter(BeemBroadcastReceiver.BEEM_CONNECTION_CLOSED)); + mInflater = LayoutInflater.from(this); prepareIconsStatus(); } @@ -461,11 +460,9 @@ } curContact.setStatus(mRoster.getPresence(StringUtils.parseBareAddress(presence.getFrom()))); int status = presence.getStatus(); - if (!resfound && status != Status.CONTACT_STATUS_DISCONNECT - && status != Status.CONTACT_STATUS_UNAVAILABLE) + if (!resfound && !Status.statusOnline(status)) curContact.addRes(pres); - else if (resfound && status == Status.CONTACT_STATUS_DISCONNECT - && status == Status.CONTACT_STATUS_UNAVAILABLE) + else if (resfound && Status.statusOnline(status)) curContact.delRes(pres); mHandler.post(new RunnableChange()); return; @@ -478,14 +475,12 @@ * Adapter contact list. */ private class BeemContactList extends BaseAdapter { - private final LayoutInflater mInflater; /** * Constructor. * @param context context activity. */ public BeemContactList(final Context context) { - mInflater = LayoutInflater.from(context); } /** @@ -550,11 +545,8 @@ e.printStackTrace(); } } - Log.d("ContactList", "hide " + mSettings.getBoolean("settings_key_hidden_contact", false)); - if (mSettings.getBoolean("settings_key_hidden_contact", false) && !Status.statusOnline(c.getStatus())) { v.setVisibility(View.GONE); - Log.d("ContactList", "hide " + c.getJID()); } else { bindView(v, c); } @@ -573,17 +565,8 @@ TextView v = (TextView) view.findViewById(R.id.contactlistpseudo); imgV.setImageBitmap(mIconsMap.get(curContact.getStatus())); v.setText(curContact.getName()); - v.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD)); - v.setTextColor(Color.WHITE); - v.setTextSize(14); - v = (TextView) view.findViewById(R.id.contactlistmsgperso); - if (v != null) { - v.setText(curContact.getMsgState()); - v.setTextColor(Color.WHITE); - v.setTextSize(12); - v.setHorizontallyScrolling(isFinishing()); - } + v.setText(curContact.getMsgState()); } } } @@ -592,14 +575,11 @@ * Adapter banner list. */ public class BeemBanner extends BaseAdapter { - private final Context mContext; - /** * Constructor. * @param c context activity. */ public BeemBanner(final Context c) { - mContext = c; } /** @@ -631,12 +611,12 @@ */ @Override public View getView(int position, View convertView, ViewGroup parent) { - TextView i = new TextView(mContext); - i.setText(mListGroup.get(position)); - i.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD)); - i.setTextColor(Color.WHITE); - i.setHighlightColor(Color.RED); - return i; + View v = convertView; + if (convertView == null) { + v = mInflater.inflate(R.layout.contactlist_group, null); + } + ((TextView) v).setText(mListGroup.get(position)); + return v; } } diff -r 6c2a766f2297 -r 973f28f405bc src/com/beem/project/beem/ui/CreateAccount.java --- a/src/com/beem/project/beem/ui/CreateAccount.java Sat Nov 07 07:06:17 2009 +0100 +++ b/src/com/beem/project/beem/ui/CreateAccount.java Sun Nov 08 02:01:19 2009 +0100 @@ -14,6 +14,7 @@ import android.content.DialogInterface; import android.content.SharedPreferences; import android.os.Bundle; +import android.preference.PreferenceManager; import android.util.Log; import android.view.View; import android.widget.Button; @@ -53,7 +54,7 @@ super.onCreate(savedInstanceState); setContentView(R.layout.create_account); initCreateAccountButton(); - mSettings = getSharedPreferences(getString(R.string.settings_filename), MODE_PRIVATE); + mSettings = PreferenceManager.getDefaultSharedPreferences(this); } /** diff -r 6c2a766f2297 -r 973f28f405bc src/com/beem/project/beem/ui/Login.java --- a/src/com/beem/project/beem/ui/Login.java Sat Nov 07 07:06:17 2009 +0100 +++ b/src/com/beem/project/beem/ui/Login.java Sun Nov 08 02:01:19 2009 +0100 @@ -6,7 +6,6 @@ import android.content.ComponentName; import android.content.DialogInterface; import android.content.Intent; -import android.content.IntentFilter; import android.content.ServiceConnection; import android.content.SharedPreferences; import android.os.Bundle; @@ -26,7 +25,6 @@ import com.beem.project.beem.service.aidl.IBeemConnectionListener; import com.beem.project.beem.service.aidl.IXmppConnection; import com.beem.project.beem.service.aidl.IXmppFacade; -import com.beem.project.beem.utils.BeemBroadcastReceiver; import com.beem.project.beem.utils.Status; /** @@ -53,7 +51,6 @@ private SharedPreferences mSettings; private boolean mIsConfigured; private int mRetry; - private BeemBroadcastReceiver mReceiver; private IXmppConnection mXmppConnection; /** @@ -88,7 +85,6 @@ mSettings = PreferenceManager.getDefaultSharedPreferences(this); setContentView(R.layout.login); mProgressDialog = new ProgressDialog(this); - mReceiver = new BeemBroadcastReceiver(mServConn); } /** @@ -99,7 +95,6 @@ super.onStop(); Log.d(TAG, "onStop " + mIsConnectedService); if (mIsConfigured && (mIsConnectedService || mXmppFacade != null)) { - mReceiver.setBinded(false); boolean isConnected = false; if (mXmppConnection != null) { try { @@ -123,7 +118,6 @@ protected void onPause() { super.onPause(); Log.d(TAG, "onPause"); - this.unregisterReceiver(mReceiver); mConnectionHandler.removeCallbacks(mConnectionRunnable); mProgressDialog.dismiss(); } @@ -135,7 +129,6 @@ protected void onResume() { super.onResume(); Log.d(TAG, "onResume"); - this.registerReceiver(mReceiver, new IntentFilter(BeemBroadcastReceiver.BEEM_CONNECTION_CLOSED)); } /** @@ -153,7 +146,6 @@ e.printStackTrace(); } bindService(Login.SERVICE_INTENT, mServConn, BIND_AUTO_CREATE); - mReceiver.setBinded(true); mIsConnectedService = true; } } @@ -225,7 +217,6 @@ mIsConfigured = mSettings.getBoolean("PreferenceIsConfigured", false); if (mIsConfigured) { bindService(Login.SERVICE_INTENT, mServConn, BIND_AUTO_CREATE); - mReceiver.setBinded(true); } } @@ -266,7 +257,6 @@ public void connectionFailed(String errorMsg) throws RemoteException { Log.d(TAG, "CONNECTIONFAILLED"); if (mXmppFacade != null) { - mReceiver.setBinded(false); Login.this.unbindService(mServConn); Login.this.stopService(SERVICE_INTENT); mIsConnectedService = false;