Checkstyle rules
authordarisk@kaaliyah
Mon, 10 Aug 2009 07:17:15 +0200
changeset 349 84d45a88699f
parent 348 bf5fcec4bbfc
child 350 5bb849b49099
Checkstyle rules
src/com/beem/project/beem/service/Contact.java
src/com/beem/project/beem/service/RosterAdapter.java
src/com/beem/project/beem/ui/AddContact.java
src/com/beem/project/beem/ui/ContactList.java
src/com/beem/project/beem/ui/CreateAccount.java
src/com/beem/project/beem/ui/EditSettings.java
src/com/beem/project/beem/ui/Login.java
--- a/src/com/beem/project/beem/service/Contact.java	Mon Aug 10 06:46:02 2009 +0200
+++ b/src/com/beem/project/beem/service/Contact.java	Mon Aug 10 07:17:15 2009 +0200
@@ -1,5 +1,5 @@
 /**
- * 
+ *
  */
 package com.beem.project.beem.service;
 
@@ -22,7 +22,7 @@
  * @author darisk
  */
 public class Contact implements Parcelable {
-   
+
     private int mID;
     private int mStatus;
     private String mJID;
@@ -34,7 +34,7 @@
     /**
      * Parcelable.Creator needs by Android.
      */
-    public final static Parcelable.Creator<Contact> CREATOR = new Parcelable.Creator<Contact>() {
+    public static final Parcelable.Creator<Contact> CREATOR = new Parcelable.Creator<Contact>() {
 
 	@Override
 	public Contact createFromParcel(Parcel source) {
@@ -91,7 +91,7 @@
      * @throws IllegalArgumentException
      *             if it is not a xmpp uri
      */
-    public Contact(Uri uri) {
+    public Contact(final Uri uri) {
 	if (!"xmpp".equals(uri.getScheme()))
 	    throw new IllegalArgumentException();
 	mJID = uri.getSchemeSpecificPart();
@@ -107,6 +107,10 @@
 	    mGroups.add(group);
     }
 
+    /**
+     * Remove the contact from a group.
+     * @param group the group to delete the contact from.
+     */
     public void delGroup(String group) {
 	mGroups.remove(group);
     }
@@ -180,6 +184,7 @@
     }
 
     /**
+     * Get the name of the contact.
      * @return the mName
      */
     public String getName() {
@@ -252,6 +257,7 @@
     }
 
     /**
+     * Set the name of the contact.
      * @param name
      *            the mName to set
      */
--- a/src/com/beem/project/beem/service/RosterAdapter.java	Mon Aug 10 06:46:02 2009 +0200
+++ b/src/com/beem/project/beem/service/RosterAdapter.java	Mon Aug 10 07:17:15 2009 +0200
@@ -109,6 +109,7 @@
 	    mAdaptee.createGroup(groupname);
 	} catch (IllegalArgumentException e) {
 	    //pas grave, plus simple a gerer comme ca.
+	    ;
 	}
     }
 
@@ -127,7 +128,7 @@
      */
     @Override
     public List<Contact> getContactList() throws RemoteException {
-	List<Contact> coList= new ArrayList<Contact> (mAdaptee.getEntries().size());
+	List<Contact> coList = new ArrayList<Contact> mAdaptee.getEntries().size();
 	for (RosterEntry entry : mAdaptee.getEntries()) {
 	    coList.add(getContactFromRosterEntry(entry));
 	}
@@ -169,6 +170,9 @@
 	return new PresenceAdapter(mAdaptee.getPresence(jid));
     }
 
+    /**
+     * Get a contact from a RosterEntry.
+     */
     private Contact getContactFromRosterEntry(RosterEntry entry) {
 	String user = StringUtils.parseBareAddress(entry.getUser());
 	Contact c = new Contact(user);
--- a/src/com/beem/project/beem/ui/AddContact.java	Mon Aug 10 06:46:02 2009 +0200
+++ b/src/com/beem/project/beem/ui/AddContact.java	Mon Aug 10 07:17:15 2009 +0200
@@ -35,6 +35,11 @@
     private IXmppFacade mXmppFacade;
     private final ServiceConnection mServConn = new BeemServiceConnection();
 
+    /**
+     * Constructor.
+     */
+    public AddContact() { }
+
     @Override
     protected void onCreate(Bundle savedInstanceState) {
 	super.onCreate(savedInstanceState);
@@ -50,8 +55,16 @@
 	unbindService(mServConn);
     }
 
+    /**
+     * The ServiceConnection used to connect to the Beem service.
+     */
     private class BeemServiceConnection implements ServiceConnection {
 
+	/**
+	 * Constructor.
+	 */
+	public BeemServiceConnection() { }
+
 	@Override
 	public void onServiceConnected(ComponentName name, IBinder service) {
 	    mXmppFacade = IXmppFacade.Stub.asInterface(service);
@@ -63,6 +76,10 @@
 	}
     }
 
+    /**
+     * Get the text of a widget.
+     * @param id the id of the widget.
+     */
     private String getWidgetText(int id) {
 	EditText widget = (EditText) this.findViewById(id);
 	return widget.getText().toString();
@@ -92,7 +109,8 @@
 		if (mXmppFacade != null) {
 		    if (mXmppFacade.getRoster().getContact(login) != null)
 			mGroup.addAll(mXmppFacade.getRoster().getContact(login).getGroups());
-		    if (mXmppFacade.getRoster().addContact(login, alias, mGroup.toArray(new String[mGroup.size()])) == null) {
+		    if (mXmppFacade.getRoster().addContact(login, alias,
+				mGroup.toArray(new String[mGroup.size()])) == null) {
 			Toast.makeText(AddContact.this, getString(R.string.AddCContactAddedError), Toast.LENGTH_SHORT)
 			    .show();
 			return;
--- a/src/com/beem/project/beem/ui/ContactList.java	Mon Aug 10 06:46:02 2009 +0200
+++ b/src/com/beem/project/beem/ui/ContactList.java	Mon Aug 10 07:17:15 2009 +0200
@@ -41,6 +41,9 @@
 import com.beem.project.beem.service.aidl.IXmppFacade;
 import com.beem.project.beem.utils.Status;
 
+/**
+ * The contact list activity displays the roster of the user.
+ */
 public class ContactList extends ExpandableListActivity {
 
     public static final String DEFAULT_GROUP = "Default";
@@ -268,6 +271,9 @@
 
 	    private final Contact mContact;
 
+	    /**
+	     * Constructor.
+	     */
 	    public MyOnClickListener(Contact contact) {
 		mContact = contact;
 	    }
@@ -286,11 +292,17 @@
 	    private final Contact mContact;
 	    private final String mGroup;
 
+	    /**
+	     * Constructor.
+	     */
 	    public MyOnLongClickListener(Contact contact, String group) {
 		mContact = contact;
 		mGroup = group;
 	    }
 
+	    /**
+	     * @{inheritDoc}
+	     */
 	    @Override
 	    public boolean onLongClick(View v) {
 		createDialog(mContact, mGroup);
@@ -300,6 +312,9 @@
 
 	private final List<DataSetObserver> mObservers;
 
+	/**
+	 * Constructor.
+	 */
 	public MyExpandableListAdapter() {
 	    mObservers = new ArrayList<DataSetObserver>();
 	}
@@ -501,9 +516,16 @@
 	}
     }
 
+    /**
+     * The service connection used to connect to the Beem service.
+     */
     private class BeemServiceConnection implements ServiceConnection {
 	private BeemRosterListener mBeemRosterListener = new BeemRosterListener();
 
+	/**
+	 * Constructor.
+	 */
+	public BeemServiceConnection() { }
 	@Override
 	public void onServiceConnected(ComponentName name, IBinder service) {
 	    mXmppFacade = IXmppFacade.Stub.asInterface(service);
--- a/src/com/beem/project/beem/ui/CreateAccount.java	Mon Aug 10 06:46:02 2009 +0200
+++ b/src/com/beem/project/beem/ui/CreateAccount.java	Mon Aug 10 07:17:15 2009 +0200
@@ -39,6 +39,11 @@
     private Button mCreateAccountButton;
 
     /**
+     * Constructor.
+     */
+    public CreateAccount() { }
+
+    /**
      * {@inheritDoc}
      */
     @Override
@@ -50,7 +55,9 @@
     }
 
     /**
-     * Create an account on the XMPP server specified in settings
+     * Create an account on the XMPP server specified in settings.
+     * @param username the username of the account.
+     * @param password the password of the account.
      */
     private boolean createAccount(String username, String password) {
 	XMPPConnection xmppConnection = null;
@@ -82,7 +89,7 @@
     }
 
     /**
-     * Create a dialog containing an error message
+     * Create a dialog containing an error message.
      * @param errMsg the error message
      */
     private void createErrorDialog(String errMsg) {
@@ -101,7 +108,7 @@
     }
 
     /**
-     * Retrive proxy informations from the preferences
+     * Retrive proxy informations from the preferences.
      * @return Registered proxy informations
      */
     private ProxyInfo getRegisteredProxy() {
@@ -172,7 +179,7 @@
     }
 
     /**
-     * Retrieve xmpp server from the preferences
+     * Retrieve xmpp server from the preferences.
      * @return Registered xmpp server
      */
     private String getXMPPServer() {
@@ -182,15 +189,15 @@
     }
 
     /**
-     * Retrieve TLS use from the preferences
+     * Retrieve TLS use from the preferences.
      * @return Registered TLS use
      */
     private boolean getRegisteredXMPPTLSUse() {
-	return (mSettings.getBoolean(getString(R.string.settings_key_xmpp_tls_use), DEFAULT_BOOLEAN_VALUE));
+	return mSettings.getBoolean(getString(R.string.settings_key_xmpp_tls_use), DEFAULT_BOOLEAN_VALUE);
     }
 
     /**
-     * Check if the fields password and confirm password match
+     * Check if the fields password and confirm password match.
      * @return return true if password & confirm password fields match, else false
      */
     private boolean checkPasswords() {
@@ -198,18 +205,19 @@
 	final String passwordConfirmFielddValue = ((EditText) findViewById(R.id.create_account_confirm_password))
 	    .getText().toString();
 
-	if (passwordFieldValue.equals(passwordConfirmFielddValue))
-	    return (true);
-	return (false);
-    }
-
-    private boolean checkEmail() {
-	String email = ((TextView) findViewById(R.id.create_account_username)).getText().toString();
-	return (Pattern.matches("[a-zA-Z0-9._%+-]+@(?:[a-zA-Z0-9-]+.)+[a-zA-Z]{2,4}", email));
+	return passwordFieldValue.equals(passwordConfirmFielddValue)
     }
 
     /**
-     * Initialize the "Create this account" button which allows the user to create an account
+     * Check the format of the email.
+     */
+    private boolean checkEmail() {
+	String email = ((TextView) findViewById(R.id.create_account_username)).getText().toString();
+	return Pattern.matches("[a-zA-Z0-9._%+-]+@(?:[a-zA-Z0-9-]+.)+[a-zA-Z]{2,4}", email);
+    }
+
+    /**
+     * Initialize the "Create this account" button which allows the user to create an account.
      */
     private void initCreateAccountButton() {
 	mCreateAccountButton = (Button) findViewById(R.id.create_account_button);
--- a/src/com/beem/project/beem/ui/EditSettings.java	Mon Aug 10 06:46:02 2009 +0200
+++ b/src/com/beem/project/beem/ui/EditSettings.java	Mon Aug 10 07:17:15 2009 +0200
@@ -23,7 +23,7 @@
 import com.beem.project.beem.R;
 
 /**
- * This class represents an activity which allows the user to change his account or proxy parameters
+ * This class represents an activity which allows the user to change his account or proxy parameters.
  * @author dasilvj
  */
 public class EditSettings extends Activity {
@@ -58,6 +58,11 @@
     private EditText mProxyPasswordField;
 
     /**
+     * Constructor.
+     */
+    public EditSettings() { }
+
+    /**
      * Add a labeled "Account" tab on the tabbed window view passed by parameter.
      * @param tHost a tabbed window view
      */
@@ -113,6 +118,7 @@
 
     /**
      * Display a brief notification.
+     * @param msg the message to display.
      */
     private void displayNotification(CharSequence msg) {
 	Toast toast = Toast.makeText(getApplicationContext(), msg, NOTIFICATION_DURATION);
--- a/src/com/beem/project/beem/ui/Login.java	Mon Aug 10 06:46:02 2009 +0200
+++ b/src/com/beem/project/beem/ui/Login.java	Mon Aug 10 07:17:15 2009 +0200
@@ -129,10 +129,13 @@
     private class BeemConnectionListener extends IBeemConnectionListener.Stub {
 
 	/**
-	 * Constructor
+	 * Constructor.
 	 */
 	public BeemConnectionListener() { }
 
+	/**
+	 * Runnable to display error message.
+	 */
 	private class ErrorRunnable implements Runnable {
 
 	    private final String mErrorMsg;
@@ -189,6 +192,10 @@
 	    showToast(errorMsg);
 	}
 
+	/**
+	 * Show an error message with a toast.
+	 * @param errorMsg  The message to display.
+	 */
 	private void showToast(final String errorMsg) {
 	    mConnectionHandler.post(new Runnable() {
 		/**
@@ -203,6 +210,9 @@
 	    });
 	}
 
+	/**
+	 * Dismiss the progress dialog.
+	 */
 	private void dismissProgressDialog() {
 	    mConnectionHandler.post(new Runnable() {