Commits

Juha Kuitunen committed d62483a

improved metadata layout in IssueActivity, no more \t in strings for alignment

Comments (0)

Files changed (3)

                 android:textStyle="bold">
             </TextView>
 
-            <TextView
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:id="@+id/issue_status"
-                android:text="@string/nothing"
-                android:paddingTop="4dip">
-            </TextView>
+            <TableLayout
+                android:id="@+id/issueStatusTable"
+                android:layout_width="fill_parent"
+                android:layout_height="wrap_content" >
+
+                <TableRow>
+
+                    <TextView
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:text="@string/issueStatusLabel"
+                        android:paddingRight="5dip" >
+                    </TextView>
+
+                    <TextView
+                        android:id="@+id/issueStatus"
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:text="@string/nothing" >
+                    </TextView>
+
+                </TableRow>
+
+               <TableRow>
+
+                    <TextView
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:text="@string/issueTypeLabel"
+                        android:paddingRight="5dip" >
+                    </TextView>
+
+                    <TextView
+                        android:id="@+id/issueType"
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:text="@string/nothing" >
+                    </TextView>
+
+                </TableRow>
+
+                <TableRow>
+
+                    <TextView
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:text="@string/issuePriorityLabel"
+                        android:paddingRight="5dip" >
+                    </TextView>
+
+                    <TextView
+                        android:id="@+id/issuePriority"
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:text="@string/nothing" >
+                    </TextView>
+
+                </TableRow>
+
+            </TableLayout>
 
         </LinearLayout>
 

res/values/strings.xml

     <string name="issue_priority">Priority:\t</string>
     <string name="issue_comments">Comments:</string>
     <string name="issue_details_unavailable">Contents updated: details not available via API</string>
+    <string name="issueStatusLabel">Status:</string>
+    <string name="issueTypeLabel">Type:</string>
+    <string name="issuePriorityLabel">Priority:</string>
     
     <!-- LauncherActivity.java -->
     <string name="changeset_not_found">Changeset not found!</string>

src/com/saibotd/bitbeaker/IssueActivity.java

 		actionBar.setSubtitle(String.format(this.getString(R.string.issue_id), id));
 		loadIssue();
 	}
-	
+
 	private void loadIssue(){
 		executeAsyncLoader(getIssueURL());
 	}
-	
+
 	private void loadComments(){
 		AsyncCommentsLoader asyncCommentsLoader = new AsyncCommentsLoader(this, bitbeaker.getUsername(), bitbeaker.getPassword());
 		asyncCommentsLoader.execute(getIssueCommentsURL());
 	}
-	
+
 	@Override
 	public boolean onCreateOptionsMenu(Menu menu) {
-        MenuInflater inflater = getSupportMenuInflater();
-        inflater.inflate(R.menu.menu_manage_issue, menu);
-        return true;
-    }
-	
+		MenuInflater inflater = getSupportMenuInflater();
+		inflater.inflate(R.menu.menu_manage_issue, menu);
+		return true;
+	}
+
 	@Override
-    public boolean onPrepareOptionsMenu (Menu menu) {
-        if (issue_loaded) menu.getItem(0).setVisible(true);
-        else menu.getItem(0).setVisible(false);
-        return true;
-    }
-    
-    @Override
-   	public boolean onOptionsItemSelected(MenuItem item) {
-   	    switch (item.getItemId()) {
-   	    
-   	    case R.id.menu_update: {
-   	    	Intent intent = new Intent(this, UpdateIssueActivity.class);
-   	    	Bundle b = new Bundle();
-   	 		b.putString("issue_data", issue_data);
-   	    	intent.putExtras(getIntent().getExtras());
-   	    	intent.putExtras(b);
-   	    	startActivityForResult(intent, UPDATE_ISSUE);
-   	    	return true;
-   	    }
-   	    case R.id.menu_add: {
-	    	Intent intent = new Intent(this, NewIssueCommentActivity.class);
+	public boolean onPrepareOptionsMenu (Menu menu) {
+		if (issue_loaded) menu.getItem(0).setVisible(true);
+		else menu.getItem(0).setVisible(false);
+		return true;
+	}
+
+	@Override
+	public boolean onOptionsItemSelected(MenuItem item) {
+		switch (item.getItemId()) {
+		case R.id.menu_update: {
+			Intent intent = new Intent(this, UpdateIssueActivity.class);
+			Bundle b = new Bundle();
+			b.putString("issue_data", issue_data);
+			intent.putExtras(getIntent().getExtras());
+			intent.putExtras(b);
+			startActivityForResult(intent, UPDATE_ISSUE);
+			return true;
+		}
+		case R.id.menu_add: {
+			Intent intent = new Intent(this, NewIssueCommentActivity.class);
 			intent.putExtras(getIntent().getExtras()); // Just passing the current bundle instead of creating a new one!
 			startActivityForResult(intent, NEW_ISSUE_COMMENT);
-	        return true;
-	    }
-	    default:
-	        return super.onOptionsItemSelected(item);
-   	    }
-   	}
-    
-    @Override
+			return true;
+		}
+		default:
+			return super.onOptionsItemSelected(item);
+		}
+	}
+
+	@Override
 	protected void onActivityResult(int requestCode, int resultCode, Intent data) {
 		switch (requestCode) {
 		case NEW_ISSUE_COMMENT:
 		}
 		bitbeaker.delKV(getIssueCommentsURL());
 		loadComments();
-    }
-    
-    private String getIssueURL() {
-    	return API_BASE_URL + "/repositories/"+ owner +"/"+ slug +"/issues/" + id; 
-    }
-    
-    private String getIssueCommentsURL() {
-    	return getIssueURL() + "/comments/";
-    }
+	}
 
-    @Override
+	private String getIssueURL() {
+		return API_BASE_URL + "/repositories/"+ owner +"/"+ slug +"/issues/" + id; 
+	}
+
+	private String getIssueCommentsURL() {
+		return getIssueURL() + "/comments/";
+	}
+
+	@Override
 	public void asyncLoaderDone(String result) {
 		super.asyncLoaderDone(result);
 		JSONObject jsonObject;
 		TextView issue_title = (TextView) findViewById(R.id.issue_title);
-		TextView issue_status = (TextView) findViewById(R.id.issue_status);
+		TextView issue_status = (TextView) findViewById(R.id.issueStatus);
+		TextView issue_type = (TextView) findViewById(R.id.issueType);
+		TextView issue_priority = (TextView) findViewById(R.id.issuePriority);
 		issue_data = result;
 		try {
 			jsonObject = new JSONObject(result);
-			
+
 			title = jsonObject.getString("title");
 			issue_title.setText(title);
 
-			String infotext = this.getString(R.string.issue_status) + jsonObject.getString("status") + "\n"
-			                + this.getString(R.string.issue_type) + jsonObject.getJSONObject("metadata").getString("kind") + "\n"
-			                + this.getString(R.string.issue_priority) + jsonObject.getString("priority");
-			issue_status.setText(infotext);
+			issue_status.setText(jsonObject.getString("status"));
+			issue_type.setText(jsonObject.getJSONObject("metadata").getString("kind"));
+			issue_priority.setText(jsonObject.getString("priority"));
 
 			TextView issue_content = (TextView) listViewHeader.findViewById(R.id.issue_content);
 			TextView comments_count = (TextView) listViewHeader.findViewById(R.id.issue_comments_count);
 			issue_content.setText(MarkupHelper.handleMarkup(jsonObject.getString("content"), owner, slug));
 			issue_content.setMovementMethod(LinkMovementMethod.getInstance());
 			comments_count.setText(this.getString(R.string.issue_comments) + " " + jsonObject.getString("comment_count"));
-			
+
 			loadComments();
 			issue_loaded = true;
 			invalidateOptionsMenu();