Correction checkstyle
authorVincent Veronis <veroni_v@epitech.net>
Thu, 17 Sep 2009 17:17:16 +0200
changeset 364 ed2f2e30c2fc
parent 363 c7ee14b65f39
child 365 c90f06cae09e
Correction checkstyle
src/com/beem/project/beem/ui/ContactList.java
src/com/beem/project/beem/ui/Login.java
--- a/src/com/beem/project/beem/ui/ContactList.java	Thu Sep 17 16:33:18 2009 +0200
+++ b/src/com/beem/project/beem/ui/ContactList.java	Thu Sep 17 17:17:16 2009 +0200
@@ -46,12 +46,11 @@
  */
 public class ContactList extends Activity {
 
-    public static final String DEFAULT_GROUP = "Default";
     private static final String TAG = "CONTACTLIST_ACT";
     private static final int REQUEST_CODE = 1;
     private BeemContactList mAdapter;
     private IRoster mRoster;
-    private List<Contact> mListContact = null;
+    private List<Contact> mListContact;
     private List<String> mListGroup;
     private int mPosCurGroup = -1;
     private Handler mHandler;
@@ -59,6 +58,13 @@
     private final ServiceConnection mServConn = new BeemServiceConnection();
 
     /**
+     * Constructor.
+     */
+    public ContactList() {
+
+    }
+
+    /**
      * Callback for menu creation.
      * @param menu the menu created
      * @return true on success, false otherwise
@@ -117,14 +123,34 @@
 
     }
 
+    /**
+     * Event on middle groupe name.
+     */
     private class OnClickGroupName implements View.OnClickListener {
+	/**
+	 * Constructor.
+	 */
+	public OnClickGroupName() {
+
+	}
+
 	@Override
 	public void onClick(View arg0) {
 
 	}
     }
 
+    /**
+     * Event on left groupe name.
+     */
     private class OnClickLeft implements View.OnClickListener {
+	/**
+	 * Constructor.
+	 */
+	public OnClickLeft() {
+
+	}
+
 	@Override
 	public void onClick(View arg0) {
 	    mPosCurGroup--;
@@ -145,9 +171,23 @@
 	}
     }
 
+    /**
+     * Event on right groupe name.
+     */
     private class OnClickRight implements View.OnClickListener {
+
+	/**
+	 * Constructor.
+	 */
+	public OnClickRight() {
+
+	}
+
+	/**
+	 * {@inheritDoc}
+	 */
 	@Override
-	public void onClick(View arg0) {
+	public void onClick(View v) {
 	    mPosCurGroup++;
 	    if (mPosCurGroup == mListGroup.size())
 		mPosCurGroup = -1;
@@ -165,12 +205,18 @@
 	}
     }
 
+    /**
+     * {@inheritDoc}
+     */
     @Override
     protected void onStart() {
 	super.onStart();
 	bindService(new Intent(this, BeemService.class), mServConn, BIND_AUTO_CREATE);
     }
 
+    /**
+     * {@inheritDoc}
+     */
     @Override
     protected void onStop() {
 	Log.e(TAG, "UNBINSERVICE");
@@ -178,14 +224,40 @@
 	unbindService(mServConn);
     }
 
+    /**
+     * Comparator Contact by Name.
+     */
     class ComparatorContactListByName<T> implements Comparator<T> {
+	/**
+	 * Constructor.
+	 */
+	public ComparatorContactListByName() {
+
+	}
+
+	/**
+	 * {@inheritDoc}
+	 */
 	@Override
 	public int compare(T c1, T c2) {
 	    return ((Contact) c1).getName().compareToIgnoreCase(((Contact) c2).getName());
 	}
     }
 
+    /**
+     * Comparator Contact by status and name.
+     */
     class ComparatorContactListByStatusAndName<T> implements Comparator<T> {
+	/**
+	 * Constructor.
+	 */
+	public ComparatorContactListByStatusAndName() {
+
+	}
+
+	/**
+	 * {@inheritDoc}
+	 */
 	@Override
 	public int compare(T c1, T c2) {
 	    if (((Contact) c1).getStatus() < ((Contact) c2).getStatus()) {
@@ -197,16 +269,14 @@
 	}
     }
 
-    class ComparatorString implements Comparator<String> {
-	@Override
-	public int compare(String g1, String g2) {
-	    return (g1.compareToIgnoreCase(g2));
-	}
-    }
-
+    /**
+     * Contact List construction.
+     * @param listContact Contact list.
+     * @param listGroup Group list.
+     */
     private void buildContactList(List<Contact> listContact, List<String> listGroup) {
 	mListGroup = listGroup;
-	Collections.sort(mListGroup);// , new ComparatorString());
+	Collections.sort(mListGroup);
 	if (mListContact != null)
 	    mListContact.clear();
 	if (mPosCurGroup == -1)
@@ -220,7 +290,7 @@
 	    }
 	}
 
-	BeemContactListSort();
+	sortBeemContactList();
 
 	ListView listView = (ListView) findViewById(R.id.contactlist);
 	listView.setOnItemClickListener(new BeemContactListOnClick());
@@ -228,7 +298,20 @@
 	listView.setAdapter(mAdapter);
     }
 
+    /**
+     * Event simple click on item of the contact list.
+     */
     public class BeemContactListOnClick implements OnItemClickListener {
+	/**
+	 * Constructor.
+	 */
+	public BeemContactListOnClick() {
+
+	}
+
+	/**
+	 * {@inheritDoc}
+	 */
 	@Override
 	public void onItemClick(AdapterView<?> arg0, View v, int pos, long lpos) {
 	    Contact c = mListContact.get(pos);
@@ -238,8 +321,20 @@
 	}
     }
 
+    /**
+     * Event long click on item of the contact list.
+     */
     public class BeemContactListOnLongClick implements OnItemLongClickListener {
+	/**
+	 * Constructor.
+	 */
+	public BeemContactListOnLongClick() {
 
+	}
+
+	/**
+	 * {@inheritDoc}
+	 */
 	@Override
 	public boolean onItemLongClick(AdapterView<?> arg0, View v, int pos, long lpos) {
 	    Contact c = mListContact.get(pos);
@@ -250,19 +345,48 @@
 	}
     }
 
-    private void BeemContactListSort() {
+    /**
+     * Sort the contact list.
+     */
+    private void sortBeemContactList() {
 	Collections.sort(mListContact, new ComparatorContactListByStatusAndName<Contact>());
     }
 
+    /**
+     * Listener on service event.
+     */
     private class BeemRosterListener extends IBeemRosterListener.Stub {
+	/**
+	 * Constructor.
+	 */
+	public BeemRosterListener() {
+
+	}
+
+	/**
+	 * Refresh the contact list.
+	 */
 	private class RunnableChange implements Runnable {
+	    /**
+	     * Constructor.
+	     */
+	    public RunnableChange() {
+
+	    }
+
+	    /**
+	     * {@inheritDoc}
+	     */
 	    @Override
 	    public void run() {
-		BeemContactListSort();
+		sortBeemContactList();
 		mAdapter.notifyDataSetChanged();
 	    }
 	}
 
+	/**
+	 * {@inheritDoc}
+	 */
 	@Override
 	public void onEntriesAdded(List<String> addresses) throws RemoteException {
 	    for (String newName : addresses) {
@@ -272,6 +396,9 @@
 	    mHandler.post(new RunnableChange());
 	}
 
+	/**
+	 * {@inheritDoc}
+	 */
 	@Override
 	public void onEntriesDeleted(List<String> addresses) throws RemoteException {
 	    for (String cToDelete : addresses) {
@@ -285,14 +412,17 @@
 	    mHandler.post(new RunnableChange());
 	}
 
+	/**
+	 * {@inheritDoc}
+	 */
 	@Override
 	public void onEntriesUpdated(List<String> addresses) throws RemoteException {
-	    /*
-	     * TODO:
-	     */
 	    mHandler.post(new RunnableChange());
 	}
 
+	/**
+	 * {@inheritDoc}
+	 */
 	@Override
 	public void onPresenceChanged(PresenceAdapter presence) throws RemoteException {
 	    for (Contact curContact : mListContact) {
@@ -305,39 +435,60 @@
 	}
     }
 
+    /**
+     * Adapter contact list.
+     */
     private class BeemContactList extends BaseAdapter {
 	private LayoutInflater mInflater;
 
-	public BeemContactList(Context context) {
+	/**
+	 * Constructor.
+	 * @param context context activity.
+	 */
+	public BeemContactList(final Context context) {
 	    mInflater = LayoutInflater.from(context);
 	}
-
+	/**
+	 * {@inheritDoc}
+	 */
 	@Override
 	public int getCount() {
 	    return mListContact.size();
 	}
-
+	/**
+	 * {@inheritDoc}
+	 */
 	@Override
 	public Object getItem(int position) {
 	    return position;
 	}
-
+	/**
+	 * {@inheritDoc}
+	 */
 	@Override
 	public long getItemId(int position) {
 	    return position;
 	}
-
+	/**
+	 * {@inheritDoc}
+	 */
 	@Override
 	public View getView(int position, View convertView, ViewGroup parent) {
+	    View v = convertView;
 	    if (convertView == null) {
-		convertView = mInflater.inflate(R.layout.contactlistcontact, null);
+		v = mInflater.inflate(R.layout.contactlistcontact, null);
 	    }
 
 	    Contact c = mListContact.get(position);
-	    bindView(convertView, c);
-	    return convertView;
+	    bindView(v, c);
+	    return v;
 	}
 
+	/**
+	 * Adapte curContact to the view.
+	 * @param view the row view.
+	 * @param curContact the current contact.
+	 */
 	private void bindView(View view, Contact curContact) {
 
 	    if (curContact != null) {
@@ -385,7 +536,7 @@
 		}
 
 		/*
-		 * TODO: Rajouter l'avatar du contact getAvatar() dans la classe imgV = (ImageView)
+		 * Rajouter l'avatar du contact getAvatar() dans la classe imgV = (ImageView)
 		 * view.findViewById(R.id.contactlistavatar); if (imgV != null) { imageDrawable =
 		 * getResources().getDrawable(R.drawable.avatar); imgV.setImageDrawable(imageDrawable); }
 		 */
--- a/src/com/beem/project/beem/ui/Login.java	Thu Sep 17 16:33:18 2009 +0200
+++ b/src/com/beem/project/beem/ui/Login.java	Thu Sep 17 17:17:16 2009 +0200
@@ -16,9 +16,6 @@
 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.TextView;
 import android.widget.Toast;
 
@@ -34,7 +31,7 @@
  */
 public class Login extends Activity {
 
-    //private static final String TAG = "LOG_AS";
+    // private static final String TAG = "LOG_AS";
     private static final Intent SERVICE_INTENT = new Intent();
     static {
 	SERVICE_INTENT.setComponent(new ComponentName("com.beem.project.beem", "com.beem.project.beem.BeemService"));
@@ -50,12 +47,11 @@
     private SharedPreferences mSettings;
     private boolean mIsConfigured;
 
-    private Button mButtonLogin;
-
     /**
      * Constructor.
      */
-    public Login() { }
+    public Login() {
+    }
 
     /**
      * Create an about "BEEM" dialog.
@@ -74,7 +70,7 @@
     }
 
     /**
-     * @{inheritDoc}
+     * {@inheritDoc}
      */
     @Override
     public void onCreate(Bundle savedInstanceState) {
@@ -104,7 +100,7 @@
 	    bindService(Login.SERVICE_INTENT, mServConn, BIND_AUTO_CREATE);
 
     }
-    
+
     /**
      * {@inheritDoc}
      */
@@ -116,7 +112,6 @@
 	return true;
     }
 
-    
     /**
      * Callback for menu item selected.
      * @param item the item selected
@@ -130,7 +125,7 @@
 		return true;
 	    case R.id.login_menu_about:
 		createAboutDialog();
-		return true;	
+		return true;
 	    default:
 		return false;
 	}
@@ -144,7 +139,8 @@
 	/**
 	 * Constructor.
 	 */
-	public BeemConnectionListener() { }
+	public BeemConnectionListener() {
+	}
 
 	/**
 	 * Runnable to display error message.
@@ -162,7 +158,7 @@
 	    }
 
 	    /**
-	     * @{inheritDoc}
+	     * {@inheritDoc}
 	     */
 	    @Override
 	    public void run() {
@@ -172,11 +168,10 @@
 	}
 
 	/**
-	 * @{inheritDoc}
+	 * {@inheritDoc}
 	 */
 	@Override
 	public void connectionClosed() throws RemoteException {
-	    Log.e("Login", "CONNECTIONCLOSED");
 	    mIsConnected = false;
 	    if (mXmppFacade != null) {
 		Login.this.unbindService(mServConn);
@@ -187,8 +182,6 @@
 
 	@Override
 	public void connectionClosedOnError() throws RemoteException {
-	    Log.e("Login", "CONNECTIONCLOSEONERROR");
-
 	}
 
 	@Override
@@ -207,12 +200,12 @@
 
 	/**
 	 * Show an error message with a toast.
-	 * @param errorMsg  The message to display.
+	 * @param errorMsg The message to display.
 	 */
 	private void showToast(final String errorMsg) {
 	    mConnectionHandler.post(new Runnable() {
 		/**
-		 * @{inheritDoc}
+		 * @{inheritDoc
 		 */
 		@Override
 		public void run() {
@@ -230,7 +223,7 @@
 	    mConnectionHandler.post(new Runnable() {
 
 		/**
-		 * @{inheritDoc}
+		 * @{inheritDoc
 		 */
 		@Override
 		public void run() {
@@ -275,7 +268,8 @@
 	/**
 	 * Constructor.
 	 */
-	public BeemServiceConnection() { }
+	public BeemServiceConnection() {
+	}
 
 	@Override
 	public void onServiceConnected(ComponentName name, IBinder service) {