1. German Larrain
  2. bitbeaker

Commits

Ville Saalo  committed eccf8c3

Strings must be compared with the .equals(String) method, not with "==" or "!=".

  • Participants
  • Parent commits 418549d
  • Branches default

Comments (0)

Files changed (8)

File src/com/saibotd/bitbeaker/IssueActivity.java

View file
    	}
     
     @Override
-    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
-        if (requestCode == NEW_ISSUE_COMMENT) {
-        	bitbeaker.delKV(getIssueCommentsURL());
-        	loadComments();
-        }
-        if (requestCode == UPDATE_ISSUE) {
-        	bitbeaker.delKV(getIssueURL());
-        	loadIssue();
-        	bitbeaker.delKV(getIssueCommentsURL());
-        	loadComments();
-        }
+	protected void onActivityResult(int requestCode, int resultCode, Intent data) {
+		switch (requestCode) {
+		case NEW_ISSUE_COMMENT:
+			break;
+		case UPDATE_ISSUE:
+			bitbeaker.delKV(getIssueURL());
+			loadIssue();
+			break;
+		}
+		bitbeaker.delKV(getIssueCommentsURL());
+		loadComments();
     }
     
     private String getIssueURL() {
 			TextView content = (TextView) view.findViewById(R.id.issue_comment_content);
 
 			try {
-				String contents = this.getItem(position).getString("content")=="null" ? getResources().getString(R.string.issue_details_unavailable) : this.getItem(position).getString("content");
+				String contents = "null".equals(this.getItem(position).getString("content")) ? 
+						getResources().getString(R.string.issue_details_unavailable) : 
+						this.getItem(position).getString("content");
 				header.setText(
 					this.getItem(position).getJSONObject("author_info").getString("username") + " - " +
 					Helper.dateFormat(this.getItem(position).getString("utc_created_on"))

File src/com/saibotd/bitbeaker/LoginActivity.java

View file
 	
 	@Override
     public boolean onPrepareOptionsMenu (Menu menu) {
-        if (bitbeaker.getUsername() == ""){
+		if (Helper.isEmpty(bitbeaker.getUsername())) {
         	menu.getItem(1).setVisible(false);
         	menu.getItem(2).setVisible(false);
         }

File src/com/saibotd/bitbeaker/NewIssueActivity.java

View file
 	@Override
 	protected void asyncLoaderDone(String result) {
 		super.asyncLoaderDone(result);
-		if (result != null && result != "")
+		if (!Helper.isEmpty(result)) {
 			done();
+		}
 	}
 
 }

File src/com/saibotd/bitbeaker/NewIssueCommentActivity.java

View file
     @Override
     protected void asyncLoaderDone(String result) {
     	super.asyncLoaderDone(result);
-    	if(result != null && result != "") done();
+		if (!Helper.isEmpty(result)) {
+			done();
+		}
 	}
 
 

File src/com/saibotd/bitbeaker/RepositoriesActivity.java

View file
 	
 	@Override
     public boolean onPrepareOptionsMenu (Menu menu) {
-        if (bitbeaker.getUsername() == ""){
+		if (Helper.isEmpty(bitbeaker.getUsername())) {
         	menu.getItem(1).setVisible(true);
         	menu.getItem(2).setVisible(false);
         }

File src/com/saibotd/bitbeaker/RepositoryActivity.java

View file
 				if(!Helper.isEmpty(jsonObject.getString("description"))) desc += jsonObject.getString("description");
 				if(!Helper.isEmpty(jsonObject.getString("website")) && !jsonObject.getString("website").trim().equals("null")) desc += "<br><a href='"+ jsonObject.getString("website") +"'>" + jsonObject.getString("website") + "</a>";
 				description.setText(Html.fromHtml(desc));
-				if(jsonObject.getString("logo") != "null"){
+				if (!"null".equals(jsonObject.getString("logo"))) {
 					executeAsyncImageLoader(icon, jsonObject.getString("logo"));
 				}
 			} catch (JSONException e) {

File src/com/saibotd/bitbeaker/SearchableActivity.java

View file
 	
 	@Override
     public boolean onPrepareOptionsMenu (Menu menu) {
-        if (bitbeaker.getUsername() == ""){
+		if (Helper.isEmpty(bitbeaker.getUsername())) {
         	menu.getItem(1).setVisible(true);
         	menu.getItem(2).setVisible(false);
         }

File src/com/saibotd/bitbeaker/UserProfileActivity.java

View file
 			JSONObject user = jsonObject.getJSONObject("user");
 			JSONArray repositories = jsonObject.getJSONArray("repositories");
 			real_name.setText(user.getString("first_name") + " " + user.getString("last_name"));
-			if(user.getString("avatar") != "null"){
+			if (!"null".equals(user.getString("avatar"))) {
 				executeAsyncImageLoader(avatar, user.getString("avatar"));
 			}
 			listView.setAdapter(new RepositoriesAdapter(this, repositories));