Some checkstyle rules
authordarisk@kaaliyah
Mon, 10 Aug 2009 05:32:45 +0200
changeset 342 2b489d4a7917
parent 341 df4a1a32b66e
child 343 e5f7b0c943e0
Some checkstyle rules
src/com/beem/project/beem/BeemService.java
src/com/beem/project/beem/service/BeemChatManager.java
src/com/beem/project/beem/service/Contact.java
src/com/beem/project/beem/service/RosterAdapter.java
src/com/beem/project/beem/ui/ContactList.java
src/com/beem/project/beem/ui/CreateAccount.java
src/com/beem/project/beem/ui/SendIM.java
src/com/beem/project/beem/utils/PresenceType.java
src/com/beem/project/beem/utils/Status.java
--- a/src/com/beem/project/beem/BeemService.java	Mon Aug 10 03:55:05 2009 +0200
+++ b/src/com/beem/project/beem/BeemService.java	Mon Aug 10 05:32:45 2009 +0200
@@ -98,7 +98,7 @@
 	    else
 		mConnectionConfiguration = new ConnectionConfiguration(mHost, mPort);
 	}
-	if (mSettings.getBoolean(getString(R.string.settings_key_xmpp_tls_use), false) == true) {
+	if (mSettings.getBoolean(getString(R.string.settings_key_xmpp_tls_use), false)) {
 	    mConnectionConfiguration.setSecurityMode(SecurityMode.required);
 	}
 	mConnectionConfiguration.setDebuggerEnabled(false);
@@ -152,7 +152,7 @@
 			public void processPacket(Packet packet) {
 			    String from = packet.getFrom();
 			    Notification notif = new Notification(com.beem.project.beem.R.drawable.signal,
-				"Demande d'ajout", System.currentTimeMillis());
+				    "Demande d'ajout", System.currentTimeMillis());
 			    notif.defaults = Notification.DEFAULT_ALL;
 			    notif.flags = Notification.FLAG_AUTO_CANCEL;
 			    Intent intent = new Intent(BeemService.this, Subscription.class);
--- a/src/com/beem/project/beem/service/BeemChatManager.java	Mon Aug 10 03:55:05 2009 +0200
+++ b/src/com/beem/project/beem/service/BeemChatManager.java	Mon Aug 10 05:32:45 2009 +0200
@@ -1,5 +1,5 @@
 /**
- * 
+ *
  */
 package com.beem.project.beem.service;
 
@@ -32,14 +32,14 @@
 
 /**
  * An adapter for smack's ChatManager. This class provides functionnality to handle chats.
- * 
+ *
  * @author darisk
  */
 public class BeemChatManager extends IChatManager.Stub {
 
     /**
      * A listener for all the chat creation event that happens on the connection.
-     * 
+     *
      * @author darisk
      */
     private class ChatListener implements ChatStateListener, ChatManagerListener, MessageListener {
@@ -74,7 +74,7 @@
 
 	/**
 	 * Set a notification of a new chat in android.
-	 * 
+	 *
 	 * @param chat
 	 *            The chat to access by the notification
 	 */
@@ -150,18 +150,18 @@
     /**
      * Tag to use with log methods.
      */
-    public static final String                             TAG                          = "BeemChatManager";
-    private final ChatManager                              mAdaptee;
-    private final Map<String, ChatAdapter>                 mChats                       = new HashMap<String, ChatAdapter>();
-    private final ChatListener                             mChatListener                = new ChatListener();
+    public static final String TAG = "BeemChatManager";
+    private final ChatManager mAdaptee;
+    private final Map<String, ChatAdapter> mChats = new HashMap<String, ChatAdapter>();
+    private final ChatListener mChatListener = new ChatListener();
     private final RemoteCallbackList<IChatManagerListener> mRemoteChatCreationListeners = new RemoteCallbackList<IChatManagerListener>();
-    private final RemoteCallbackList<IMessageListener>     mRemoteMessageListeners      = new RemoteCallbackList<IMessageListener>();
+    private final RemoteCallbackList<IMessageListener> mRemoteMessageListeners = new RemoteCallbackList<IMessageListener>();
 
-    private final BeemService                              mService;
+    private final BeemService mService;
 
     /**
      * Constructor.
-     * 
+     *
      * @param chatManager
      *            the smack ChatManager to adapt
      * @param service
@@ -183,7 +183,7 @@
 
     /**
      * Create a chat session.
-     * 
+     *
      * @param contact
      *            the contact you want to chat with
      * @param listener
@@ -197,7 +197,7 @@
 
     /**
      * Create a chat session.
-     * 
+     *
      * @param jid
      *            the jid of the contact you want to chat with
      * @param listener
@@ -229,7 +229,7 @@
 
     /**
      * Get an existing ChatAdapter or create it if necessary.
-     * 
+     *
      * @param chat
      *            The real instance of smack chat
      * @return a chat adapter register in the manager
--- a/src/com/beem/project/beem/service/Contact.java	Mon Aug 10 03:55:05 2009 +0200
+++ b/src/com/beem/project/beem/service/Contact.java	Mon Aug 10 05:32:45 2009 +0200
@@ -34,7 +34,7 @@
     /**
      * Parcelable.Creator needs by Android.
      */
-    public static final Parcelable.Creator<Contact> CREATOR = new Parcelable.Creator<Contact>() {
+    public final static Parcelable.Creator<Contact> CREATOR = new Parcelable.Creator<Contact>() {
 
 	@Override
 	public Contact createFromParcel(Parcel source) {
@@ -92,7 +92,7 @@
      *             if it is not a xmpp uri
      */
     public Contact(Uri uri) {
-	if (!uri.getScheme().equals("xmpp"))
+	if (!"xmpp".equals(uri.getScheme()))
 	    throw new IllegalArgumentException();
 	mJID = uri.getSchemeSpecificPart();
     }
@@ -208,11 +208,11 @@
 
     /**
      * Set the groups the contact is in.
-     * @param mGroups
+     * @param groups
      *            the mGroups to set
      */
-    public void setGroups(List<String> mGroups) {
-	this.mGroups = mGroups;
+    public void setGroups(List<String> groups) {
+	this.mGroups = groups;
     }
 
     /**
@@ -252,12 +252,12 @@
     }
 
     /**
-     * @param mName
+     * @param name
      *            the mName to set
      */
-    public void setName(String mName) {
-	if (mName != null)
-	    this.mName = mName;
+    public void setName(String name) {
+	if (name != null)
+	    this.mName = name;
     }
 
     /**
@@ -308,7 +308,7 @@
 	StringBuilder build = new StringBuilder("xmpp:");
 	String name = StringUtils.parseName(mJID);
 	build.append(name);
-	if (! "".equals(name))
+	if (!"".equals(name))
 	    build.append('@');
 	build.append(StringUtils.parseServer(mJID));
 	Uri u = Uri.parse(build.toString());
--- a/src/com/beem/project/beem/service/RosterAdapter.java	Mon Aug 10 03:55:05 2009 +0200
+++ b/src/com/beem/project/beem/service/RosterAdapter.java	Mon Aug 10 05:32:45 2009 +0200
@@ -70,14 +70,14 @@
 		RosterGroup group = mAdaptee.getGroup(groupStr);
 		if (group == null) {
 		    group = mAdaptee.createGroup(groupStr);
-		}		    
+		}
 		try {
 		    group.addEntry(contact);
 		} catch (XMPPException e) {
 		    e.printStackTrace();
 		    return null;
 		}
-	    }		
+	    }
 	}
 	return getContactFromRosterEntry(contact);
     }
@@ -128,7 +128,7 @@
     @Override
     public List<Contact> getContactList() throws RemoteException {
 	List<Contact> coList= new ArrayList<Contact> (mAdaptee.getEntries().size());
-	for(RosterEntry entry: mAdaptee.getEntries()){
+	for (RosterEntry entry : mAdaptee.getEntries()) {
 	    coList.add(getContactFromRosterEntry(entry));
 	}
 	return coList;
@@ -157,7 +157,7 @@
     }
 
     /**
-     * 
+     * {@inheritDoc}
      */
     @Override
     public void setContactName(String jid, String name) throws RemoteException {
--- a/src/com/beem/project/beem/ui/ContactList.java	Mon Aug 10 03:55:05 2009 +0200
+++ b/src/com/beem/project/beem/ui/ContactList.java	Mon Aug 10 05:32:45 2009 +0200
@@ -43,17 +43,17 @@
 
 public class ContactList extends ExpandableListActivity {
 
+    public static final String DEFAULT_GROUP = "Default";
     private static final String TAG = "CONTACTLIST_ACT";
-    public static final String DEFAULT_GROUP = "Default";
+    private static final int REQUEST_CODE = 1;
     private MyExpandableListAdapter mAdapter;
     private IRoster mRoster;
     private Map<String, List<Contact>> mGroupMap;
     private List<String> mGroupName;
     private List<Contact> mListContact;
     private Handler mHandler;
-    private IXmppFacade mXmppFacade = null;
+    private IXmppFacade mXmppFacade;
     private final ServiceConnection mServConn = new BeemServiceConnection();
-    private static final int REQUEST_CODE = 1;
 
     /**
      * Callback for menu creation.
@@ -502,7 +502,7 @@
     }
 
     private class BeemServiceConnection implements ServiceConnection {
-	BeemRosterListener mBeemRosterListener = new BeemRosterListener();
+	private BeemRosterListener mBeemRosterListener = new BeemRosterListener();
 
 	@Override
 	public void onServiceConnected(ComponentName name, IBinder service) {
--- a/src/com/beem/project/beem/ui/CreateAccount.java	Mon Aug 10 03:55:05 2009 +0200
+++ b/src/com/beem/project/beem/ui/CreateAccount.java	Mon Aug 10 05:32:45 2009 +0200
@@ -24,19 +24,19 @@
 import com.beem.project.beem.R;
 
 /**
- * This class represents an activity which allows the user to create an account on the XMPP server saved in settings
+ * This class represents an activity which allows the user to create an account on the XMPP server saved in settings.
  * @author dasilvj
  */
 public class CreateAccount extends Activity {
 
-    private final static boolean DEFAULT_BOOLEAN_VALUE = false;
-    private final static String DEFAULT_STRING_VALUE = "";
-    private final static int DEFAULT_INT_VALUE = 0;
+    private static final boolean DEFAULT_BOOLEAN_VALUE = false;
+    private static final String DEFAULT_STRING_VALUE = "";
+    private static final int DEFAULT_INT_VALUE = 0;
 
-    private final static int NOTIFICATION_DURATION = Toast.LENGTH_SHORT;
+    private static final int NOTIFICATION_DURATION = Toast.LENGTH_SHORT;
 
-    private SharedPreferences mSettings = null;
-    private Button mCreateAccountButton = null;
+    private SharedPreferences mSettings;
+    private Button mCreateAccountButton;
 
     /**
      * {@inheritDoc}
@@ -108,37 +108,37 @@
 	if (getRegisteredProxyUse()) {
 	    ProxyInfo proxyInfo = new ProxyInfo(getRegisteredProxyType(), getRegisteredProxyServer(),
 		getRegisteredProxyPort(), getRegisteredProxyUsername(), getRegisteredProxyPassword());
-	    return (proxyInfo);
+	    return proxyInfo;
 	}
-	return (null);
+	return null;
     }
 
     /**
-     * Retrieve proxy password from the preferences
+     * Retrieve proxy password from the preferences.
      * @return Registered proxy password
      */
     private String getRegisteredProxyPassword() {
-	return (mSettings.getString(getString(R.string.settings_key_proxy_password), DEFAULT_STRING_VALUE));
+	return mSettings.getString(getString(R.string.settings_key_proxy_password), DEFAULT_STRING_VALUE);
     }
 
     /**
-     * Retrieve proxy port from the preferences
+     * Retrieve proxy port from the preferences.
      * @return Registered proxy port
      */
     private int getRegisteredProxyPort() {
-	return (Integer.parseInt(mSettings.getString(getString(R.string.settings_key_proxy_port), DEFAULT_STRING_VALUE)));
+	return Integer.parseInt(mSettings.getString(getString(R.string.settings_key_proxy_port), DEFAULT_STRING_VALUE));
     }
 
     /**
-     * Retrieve proxy server from the preferences
+     * Retrieve proxy server from the preferences.
      * @return Registered proxy server
      */
     private String getRegisteredProxyServer() {
-	return (mSettings.getString(getString(R.string.settings_key_proxy_server), DEFAULT_STRING_VALUE));
+	return mSettings.getString(getString(R.string.settings_key_proxy_server), DEFAULT_STRING_VALUE);
     }
 
     /**
-     * Retrieve proxy type from the preferences
+     * Retrieve proxy type from the preferences.
      * @return Registered proxy type
      */
     private ProxyInfo.ProxyType getRegisteredProxyType() {
@@ -156,19 +156,19 @@
     }
 
     /**
-     * Retrieve proxy use from the preferences
+     * Retrieve proxy use from the preferences.
      * @return Registered proxy use
      */
     private boolean getRegisteredProxyUse() {
-	return (mSettings.getBoolean(getString(R.string.settings_key_proxy_use), DEFAULT_BOOLEAN_VALUE));
+	return mSettings.getBoolean(getString(R.string.settings_key_proxy_use), DEFAULT_BOOLEAN_VALUE);
     }
 
     /**
-     * Retrieve proxy username from the preferences
+     * Retrieve proxy username from the preferences.
      * @return Registered proxy username
      */
     private String getRegisteredProxyUsername() {
-	return (mSettings.getString(getString(R.string.settings_key_proxy_username), DEFAULT_STRING_VALUE));
+	return (Settings.getString(getString(R.string.settings_key_proxy_username), DEFAULT_STRING_VALUE);
     }
 
     /**
--- a/src/com/beem/project/beem/ui/SendIM.java	Mon Aug 10 03:55:05 2009 +0200
+++ b/src/com/beem/project/beem/ui/SendIM.java	Mon Aug 10 05:32:45 2009 +0200
@@ -49,6 +49,7 @@
 public class SendIM extends Activity implements OnClickListener, OnKeyListener {
 
     private static final String TAG = "SEND_IM";
+    public IRoster mRoster;
     private EditText mToSend;
     private SendIMDialogSmiley mSmyDialog;
     private SharedPreferences mSet;
@@ -67,7 +68,6 @@
 
     private final ServiceConnection mServConn = new BeemServiceConnection();
     private IXmppFacade mXmppFacade;
-    public IRoster mRoster;
     private TextView mStatusText;
 
     /**
@@ -256,7 +256,7 @@
     }
 
     private class BeemServiceConnection implements ServiceConnection {
-	BeemRosterListener mBeemRosterListener = new BeemRosterListener();
+	private BeemRosterListener mBeemRosterListener = new BeemRosterListener();
 
 	@Override
 	public void onServiceConnected(ComponentName name, IBinder service) {
@@ -298,7 +298,7 @@
      */
     private void sendText() {
 	String text = mToSend.getText().toString();
-	if (!text.equals("")) {
+	if (!"".equals(text)){
 	    Message msg = new Message(mContact.getJID(), Message.MSG_TYPE_CHAT);
 	    msg.setBody(text);
 	    try {
--- a/src/com/beem/project/beem/utils/PresenceType.java	Mon Aug 10 03:55:05 2009 +0200
+++ b/src/com/beem/project/beem/utils/PresenceType.java	Mon Aug 10 05:32:45 2009 +0200
@@ -8,7 +8,7 @@
 /**
  * @author nikita
  */
-public class PresenceType {
+public final class PresenceType {
 
     /**
      * The user is available to receive messages (default).
@@ -47,6 +47,12 @@
     public static final int ERROR = 701;
 
     /**
+     * Private default constructor.
+     */
+    private PresenceType() {
+    }
+
+    /**
      * Get the presence type from a presence packet.
      * @param presence the presence type
      * @return an int representing the presence type
@@ -113,10 +119,4 @@
 	}
 	return res;
     }
-
-    /**
-     * Private default constructor
-     */
-    private PresenceType() {
-    }
 }
--- a/src/com/beem/project/beem/utils/Status.java	Mon Aug 10 03:55:05 2009 +0200
+++ b/src/com/beem/project/beem/utils/Status.java	Mon Aug 10 05:32:45 2009 +0200
@@ -9,7 +9,7 @@
 /**
  * @author marseille
  */
-public class Status {
+public final class Status {
 
     /**
      * Status of a disconnected contact.
@@ -42,6 +42,12 @@
     public static final int CONTACT_STATUS_AVAILABLE_FOR_CHAT = 600;
 
     /**
+     * Default constructor masked.
+     */
+    private Status() {
+    }
+
+    /**
      * Get the smack presence mode for a status.
      * @param status the status in beem
      * @return the presence mode to use in presence packet or null if there is no mode to use
@@ -108,11 +114,4 @@
 	}
 	return res;
     }
-
-    /**
-     * Default constructor masked
-     */
-    private Status() {
-    }
-
 }