Commits

Tobias Duehr  committed 49ac9c4

- Implemented Actionbar Spinner Navigation for issues Actvity
- Some work on the icons

  • Participants
  • Parent commits b2db2c0

Comments (0)

Files changed (17)

File res/drawable-mdpi/chat_alt_fill_32x32.png

Old
Old image
New
New image

File res/drawable-mdpi/document_alt_fill_24x32.png

Added
New image

File res/drawable-mdpi/document_alt_stroke_24x32.png

Old
Old image
New
New image

File res/drawable-mdpi/eye_32x24.png

Old
Old image
New
New image

File res/drawable-mdpi/folder_fill_32x32.png

Added
New image

File res/drawable-mdpi/lock_fill_24x32.png

Added
New image

File res/drawable-mdpi/magnifying_glass_32x32.png

Old
Old image
New
New image

File res/layout/issues.xml

     android:layout_width="fill_parent"
     android:layout_height="fill_parent"
     >
-    <Spinner
-        android:id="@+id/issueSpinner"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:entries="@array/status_of_issue"
-        android:prompt="@string/issue_filter_prompt"
-    />
     <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="1">
         <ListView android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/issues_list"></ListView>
     </LinearLayout>

File res/layout/listitem_repositories.xml

   android:padding="5dip" android:orientation="horizontal" android:layout_height="wrap_content">
     <FrameLayout android:layout_height="wrap_content" android:layout_width="match_parent">
         <TextView android:layout_height="wrap_content" android:text="TextView" android:id="@+id/title_listitem_repositories" android:textSize="20dip" android:layout_width="wrap_content" android:paddingBottom="18dip"></TextView>
-        <ImageView android:layout_width="wrap_content" android:src="@drawable/lock" android:id="@+id/is_locked" android:layout_height="match_parent" android:layout_gravity="right|center_vertical"></ImageView>
+        <ImageView android:layout_width="wrap_content" android:src="@drawable/lock_fill_24x32" android:id="@+id/is_locked" android:layout_height="32dip" android:layout_gravity="right|center_vertical"></ImageView>
         <TextView android:layout_height="wrap_content" android:layout_width="wrap_content" android:textAppearance="?android:attr/textAppearanceSmall" android:text="TextView" android:layout_gravity="bottom" android:id="@+id/owner_listitem_repositories"></TextView>
     </FrameLayout>
 </LinearLayout>

File res/layout/listitem_source.xml

   android:layout_height="match_parent" android:orientation="vertical" android:padding="4dip">
     <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content">
         <FrameLayout android:layout_height="match_parent" android:layout_width="match_parent">
-            <TextView android:id="@+id/source_title" android:layout_height="wrap_content" android:text="TextView" android:textSize="18dip" android:layout_width="match_parent" android:paddingRight="20dip"></TextView>
-            <ImageView android:layout_width="wrap_content" android:layout_gravity="center_vertical|right" android:layout_height="match_parent" android:layout_marginRight="5dip" android:id="@+id/source_what" android:src="@drawable/folder"></ImageView>
+            <TextView android:id="@+id/source_title" android:layout_height="wrap_content" android:text="TextView" android:textSize="18dip" android:layout_width="match_parent" android:paddingRight="20dip" android:layout_gravity="center_vertical"></TextView>
+            <ImageView android:layout_width="wrap_content" android:layout_gravity="center_vertical|right" android:layout_height="28dip" android:layout_marginRight="5dip" android:id="@+id/source_what" android:src="@drawable/folder_fill_32x32"></ImageView>
         </FrameLayout>
     </LinearLayout>
 </LinearLayout>

File res/layout/spinner_item.xml

+<TextView xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@+id/text1"
+    android:layout_width="fill_parent"
+    android:layout_height="wrap_content"
+    android:gravity="center_vertical"
+    android:maxLines="1"
+    android:paddingLeft="12dip"
+    android:textSize="18dip" android:minHeight="48dip" android:textColor="#EEEEEE" android:textColorHighlight="#FFFFFF"/>

File res/menu/mainmenu.xml

 <?xml version="1.0" encoding="utf-8"?>
 <menu
   xmlns:android="http://schemas.android.com/apk/res/android">
-  <item android:id="@+id/menu_search" android:showAsAction="always|collapseActionView" android:icon="@drawable/magnifying_glass_32x32" android:actionViewClass="android.widget.SearchView"></item><item android:icon="@drawable/ic_menu_refresh" android:id="@+id/menu_refresh" android:title="@string/clear_cache"></item>
+  <item android:id="@+id/menu_search" android:showAsAction="always" android:icon="@drawable/magnifying_glass_32x32"></item><item android:icon="@drawable/ic_menu_refresh" android:id="@+id/menu_refresh" android:title="@string/clear_cache"></item>
     <item android:title="@string/log_out" android:id="@+id/menu_logout" android:icon="@drawable/ic_menu_stop"></item>
     
 </menu>

File res/values/strings.xml

 
     <string name="issue_filter_prompt">Filter issues</string>
     <string-array name="status_of_issue">
-        <item>Show all</item>
+        <item>Show all issues</item>
         <item>new &amp; open</item>
         <item>resolved</item>
         <item>on hold</item>

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

 import org.json.JSONException;
 import org.json.JSONObject;
 
-import com.actionbarsherlock.view.Menu;
-
 import android.app.ProgressDialog;
 import android.content.Context;
 import android.content.Intent;
 import android.view.View;
 import android.view.View.OnClickListener;
 import android.view.ViewGroup;
-import android.widget.AdapterView;
-import android.widget.AdapterView.OnItemSelectedListener;
+import android.widget.ArrayAdapter;
 import android.widget.Button;
 import android.widget.ImageView;
 import android.widget.ListView;
-import android.widget.Spinner;
+import android.widget.SpinnerAdapter;
 import android.widget.TextView;
 
+import com.actionbarsherlock.app.ActionBar;
+import com.actionbarsherlock.app.ActionBar.OnNavigationListener;
+import com.actionbarsherlock.view.Menu;
+
 public class IssuesActivity extends MyActivity {
 
+	private SpinnerAdapter mSpinnerAdapter;
 	private String slug;
 	private String owner;
-	private Spinner filterSpinner;
 	private String filter = "?status=new&status=open";//default issue filtering
 	private boolean spinnerFirstTime = true;
+	ActionBar actionBar;
 
     @Override
     public void onCreate(Bundle savedInstanceState) {
         setContentView(R.layout.issues);
         setTitle(slug);
 
-        filterSpinner = (Spinner) findViewById(R.id.issueSpinner);
-        filterSpinner.setSelection(1);// default open & new instead of show all
-        filterSpinner.setOnItemSelectedListener(new filterListener());
+        mSpinnerAdapter = ArrayAdapter.createFromResource(this, R.array.status_of_issue, R.layout.spinner_item);
+        
+        actionBar = getSupportActionBar();
+        actionBar.setDisplayShowTitleEnabled(false);
+        actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
+        actionBar.setListNavigationCallbacks(mSpinnerAdapter, mNavigationCallback);
+        actionBar.setSelectedNavigationItem(1); // default open & new instead of show all
 
         //AsyncLoader asyncLoader = new AsyncLoader();
         //asyncLoader.execute("https://api.bitbucket.org/1.0/repositories/"+ owner +"/"+ slug +"/issues/");
 		progressDialog = ProgressDialog.show(this, "", "Loading ...", true);
 	}
 
-	private class filterListener implements OnItemSelectedListener {
-		public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {
+	private OnNavigationListener mNavigationCallback = new OnNavigationListener() {
+
+		@Override
+		public boolean onNavigationItemSelected(int pos, long itemId) {
 			if (spinnerFirstTime) spinnerFirstTime = false;
 			else {
 				if (pos == 0) filter = "";
 				else if (pos == 1) filter = "?status=new&status=open";
-				else filter = "?status="+URLEncoder.encode(parent.getItemAtPosition(pos).toString());
+				else filter = "?status="+URLEncoder.encode(mSpinnerAdapter.getItem((int) itemId).toString());
 				onResume();
 			}
+			return false;
 		}
-		public void onNothingSelected(AdapterView<?> parent) {
-			// Do nothing.
-		}
-	}
+
+		
+	};
 
 	private OnClickListener newIssueClickListener = new OnClickListener() {
 		public void onClick(View v) {

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

         owner = b.getString("owner");
         bitbeaker.delKV("https://api.bitbucket.org/1.0/repositories/"+ owner +"/"+ slug +"/issues/");
         setContentView(R.layout.new_issue);
-        //((TextView) findViewById(R.id.header_title)).setText(slug);
+        setTitle(slug);
         Button newIssue = (Button) findViewById(R.id.bt_save_new_issue);
 		newIssue.setOnClickListener(saveNewIssueClickListener);
     }

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

 package com.saibotd.bitbeaker;
 
+import com.actionbarsherlock.app.ActionBar;
 import com.actionbarsherlock.view.Menu;
 
 import android.app.ProgressDialog;
         AsyncLoader asyncLoader = new AsyncLoader();
         if(scm.equals("git")) asyncLoader.execute("https://api.bitbucket.org/1.0/repositories/"+ owner +"/"+slug+"/raw/master" + replace_whitespace(file));
         else asyncLoader.execute("https://api.bitbucket.org/1.0/repositories/"+ owner +"/"+slug+"/raw/tip" + replace_whitespace(file));
-        setTitle(slug + file);
+        ActionBar actionBar = getSupportActionBar();
+        setTitle(slug);
+        actionBar.setSubtitle(file);
     }
     
     @Override

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

 import org.json.JSONException;
 import org.json.JSONObject;
 
-import com.actionbarsherlock.view.Menu;
-
 import android.app.ProgressDialog;
 import android.content.Context;
 import android.content.Intent;
 import android.widget.ListView;
 import android.widget.TextView;
 
+import com.actionbarsherlock.app.ActionBar;
+import com.actionbarsherlock.view.Menu;
+
 public class SourceBrowserActivity extends MyActivity {
 	
 	private String slug;
         subdir = b.getString("subdir");
         //setListAdapter(new SourceBrowserAdapter(this, slug, owner, subdir));
         setContentView(R.layout.repositories);
-        setTitle(slug + subdir);
+        ActionBar actionBar = getSupportActionBar();
+        setTitle(slug);
+        actionBar.setSubtitle(subdir);
         AsyncLoader asyncLoader = new AsyncLoader();
         if(scm.equals("git")) asyncLoader.execute("https://api.bitbucket.org/1.0/repositories/" + owner + "/"+slug+"/src/master" + replace_whitespace(subdir));
         else asyncLoader.execute("https://api.bitbucket.org/1.0/repositories/" + owner + "/"+slug+"/src/tip" + replace_whitespace(subdir));
     		ImageView icon = (ImageView) view.findViewById(R.id.source_what);
     		try {
     			if(this.getItem(position).getString("name").startsWith("dir_")){
-    				icon.setImageResource(R.drawable.folder);
+    				icon.setImageResource(R.drawable.folder_fill_32x32);
     			} else {
-    				icon.setImageResource(R.drawable.file);
+    				icon.setImageResource(R.drawable.document_alt_fill_24x32);
     			}
     			title.setText(this.getItem(position).getString("name").substring(4));
     		} catch (JSONException e) {