Commits

Tobias Duehr committed bafd2e7 Merge

Merged in ZeroOne3010/bitbeaker_with_tests (pull request #21)

  • Participants
  • Parent commits ed345d9, 1a4e285

Comments (0)

Files changed (5)

File res/drawable-hdpi/ab_icon_branch.png

Added
New image

File res/drawable-hdpi/ab_icon_fork.png

Removed
Old image

File res/drawable-hdpi/icon_fork.png

Added
New image

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

 import android.os.Bundle;
 import android.view.View;
 import android.view.ViewGroup;
+import android.widget.ImageView;
 import android.widget.ListView;
 import android.widget.TextView;
 
     	public View getView(int position, View convertView, ViewGroup parent) {
     		View view;
     		if (convertView == null) {
-    			view = mFactory.inflate(R.layout.listitem_two_rows, null);
+    			view = mFactory.inflate(R.layout.listitem_two_rows_icon, null);
     		} else {
     			view = (View) convertView;
     		}
     		view.setId(position);
     		TextView title = (TextView) view.findViewById(R.id.title);
     		TextView subtitle = (TextView) view.findViewById(R.id.subtitle);
+    		ImageView icon = (ImageView) view.findViewById(R.id.icon);
     		try {
+    			final JSONObject item = getItem(position);
     			final String lastUpdated = getString(R.string.last_updated) + ": " 
-    			                         + Helper.dateFormat(getItem(position).getString("utc_last_updated"));
-    			final String description = getItem(position).getString("description");
-    			title.setText(this.getItem(position).getString("owner") + " / " + this.getItem(position).getString("name"));
+    			                         + Helper.dateFormat(item.getString("utc_last_updated"));
+    			final String description = item.getString("description");
+    			title.setText(item.getString("owner") + " / " + item.getString("name"));
     			subtitle.setText(lastUpdated + (Helper.isJsonEmpty(description) ? "" : "\n" + description));
+				if (Boolean.parseBoolean(item.getString("is_fork"))) {
+					icon.setImageResource(R.drawable.icon_fork);
+					icon.setVisibility(View.VISIBLE);
+    			} else {
+    				icon.setVisibility(View.GONE);
+    			}
     		} catch (Exception e) {
     			// TODO Auto-generated catch block
     			e.printStackTrace();

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

 		setBranchesMenuItems(mainMenu);
 
 		MenuItem branchesMenuItem = branchesMenu.getItem();
-		branchesMenuItem.setIcon(R.drawable.ab_icon_fork);
+		branchesMenuItem.setIcon(R.drawable.ab_icon_branch);
 		branchesMenuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_WITH_TEXT);
 
 		return super.onCreateOptionsMenu(mainMenu);