Tobias Duehr avatar Tobias Duehr committed af15ddb

- The icons where in the wrong folder - thats why they looked so bad
- The Login boxes don't autofocus anymore
- New Issue has its submit button at the top now - this is canon with gmail and
ICS in general
- Issues now reloads automatically when a new issue is submitted
- Login is now faster - found a API hook that loads less data
- Fixed bugs where ProgressBarIntetermidate is visible on login, new issue

Comments (0)

Files changed (34)

project.properties

 #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
 
 # Project target.
-target=android-16
+target=android-15
 android.library.reference.1=../../Apps/JakeWharton-ActionBarSherlock-2eabf25/library
Add a comment to this file

res/drawable-hdpi/book_alt2_32x28.png

Added
New image
Add a comment to this file

res/drawable-hdpi/chat_alt_fill_32x32.png

Added
New image
Add a comment to this file

res/drawable-hdpi/cog_32x32.png

Added
New image
Add a comment to this file

res/drawable-hdpi/document_alt_fill_24x32.png

Added
New image
Add a comment to this file

res/drawable-hdpi/document_alt_stroke_24x32.png

Added
New image
Add a comment to this file

res/drawable-hdpi/eye_32x24.png

Added
New image
Add a comment to this file

res/drawable-hdpi/folder_fill_32x32.png

Added
New image
Add a comment to this file

res/drawable-hdpi/lightbulb_20x32.png

Added
New image
Add a comment to this file

res/drawable-hdpi/lock_fill_24x32.png

Added
New image
Add a comment to this file

res/drawable-hdpi/magnifying_glass_32x32.png

Added
New image
Add a comment to this file

res/drawable-hdpi/plus_alt_32x32.png

Added
New image
Add a comment to this file

res/drawable-hdpi/submit.png

Added
New image
Add a comment to this file

res/drawable-mdpi/book_alt2_32x28.png

Removed
Old image
Add a comment to this file

res/drawable-mdpi/chat_alt_fill_32x32.png

Removed
Old image
Add a comment to this file

res/drawable-mdpi/cog_32x32.png

Removed
Old image
Add a comment to this file

res/drawable-mdpi/document_alt_fill_24x32.png

Removed
Old image
Add a comment to this file

res/drawable-mdpi/document_alt_stroke_24x32.png

Removed
Old image
Add a comment to this file

res/drawable-mdpi/eye_32x24.png

Removed
Old image
Add a comment to this file

res/drawable-mdpi/folder_fill_32x32.png

Removed
Old image
Add a comment to this file

res/drawable-mdpi/lightbulb_20x32.png

Removed
Old image
Add a comment to this file

res/drawable-mdpi/lock_fill_24x32.png

Removed
Old image
Add a comment to this file

res/drawable-mdpi/magnifying_glass_32x32.png

Removed
Old image
Add a comment to this file

res/drawable-mdpi/plus_alt_32x32.png

Removed
Old image

res/layout/login.xml

   xmlns:android="http://schemas.android.com/apk/res/android"
   android:layout_width="match_parent"
   android:orientation="vertical" android:layout_height="match_parent">
-    <LinearLayout android:layout_height="0dip" android:layout_width="match_parent" android:layout_weight="1" android:orientation="vertical" android:background="@drawable/bg">
+    <LinearLayout android:focusableInTouchMode="true" android:focusable="true" android:layout_height="0dip" android:layout_width="match_parent" android:layout_weight="1" android:orientation="vertical" android:background="@drawable/bg">
         <ImageView android:layout_height="wrap_content" android:layout_width="match_parent" android:src="@drawable/logo_big" android:layout_margin="10dip" android:padding="16dip"></ImageView>
     </LinearLayout>
     <ScrollView android:id="@+id/scrollView1" android:layout_height="wrap_content" android:layout_width="match_parent">

res/layout/new_issue.xml

           <EditText android:inputType="textMultiLine" android:layout_height="wrap_content" android:layout_width="match_parent" android:id="@+id/new_issue_content" android:lines="3"></EditText>
           <TextView android:text="@string/type" android:autoLink="all" android:layout_margin="5dip" android:layout_height="wrap_content" android:id="@+id/TextView01" android:layout_width="match_parent" android:linksClickable="true"></TextView>
           <Spinner android:layout_width="match_parent" android:id="@+id/new_issue_type" android:layout_height="wrap_content" android:entries="@array/type_of_issue"></Spinner>
-          <Button android:layout_height="wrap_content" android:text="@string/submit_new_issue" android:layout_weight="1" android:id="@+id/bt_save_new_issue" android:layout_width="match_parent"></Button>
       </LinearLayout>
   </ScrollView>
   

res/menu/menu_add.xml

-<?xml version="1.0" encoding="utf-8"?>
-<menu xmlns:android="http://schemas.android.com/apk/res/android" >
-    <item android:id="@+id/menu_add" android:title="@string/add" android:showAsAction="always|withText" android:icon="@drawable/plus_alt_32x32"></item>
-    
-
-</menu>

res/menu/menu_simple_add.xml

+<?xml version="1.0" encoding="utf-8"?>
+<menu xmlns:android="http://schemas.android.com/apk/res/android" >
+    <item android:id="@+id/menu_add" android:title="@string/add" android:showAsAction="always" android:icon="@drawable/plus_alt_32x32"></item>
+    
+
+</menu>

res/menu/menu_simple_submit.xml

+<?xml version="1.0" encoding="utf-8"?>
+<menu xmlns:android="http://schemas.android.com/apk/res/android" >
+    <item android:id="@+id/menu_submit" android:title="@string/submit" android:showAsAction="always|withText" android:icon="@drawable/submit"></item>
+    
+
+</menu>

res/values/strings.xml

         <string name="submit_comment">Submit</string>
         <string name="new_comment_hint">Leave a comment</string>
         <string name="add">Add</string>
+        <string name="proceed">Proceed</string>
+        <string name="submit">Submit</string>
 
 </resources>

src/com/saibotd/bitbeaker/IssuesActivity.java

 import android.content.Context;
 import android.content.Intent;
 import android.os.Bundle;
+import android.util.Log;
 import android.view.View;
 import android.view.View.OnClickListener;
 import android.view.ViewGroup;
 	private String filter = "?status=new&status=open";//default issue filtering
 	private boolean spinnerFirstTime = true;
 	ActionBar actionBar;
+	static final int NEW_ISSUE = 0;
 
     @Override
     public void onCreate(Bundle savedInstanceState) {
         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);
+        loadIssuesByFilter();
+    }
+    
+    private void loadIssuesByFilter(){
+    	bitbeaker.delKV("https://api.bitbucket.org/1.0/repositories/"+ owner +"/"+ slug +"/issues/" + filter);
+    	AsyncLoader asyncLoader = new AsyncLoader();
+		asyncLoader.execute("https://api.bitbucket.org/1.0/repositories/"+ owner +"/"+ slug +"/issues/" + filter);
     }
     
     public boolean onCreateOptionsMenu(Menu menu) {
    		    case R.id.menu_add:
    		    	Intent intent = new Intent(this, NewIssueActivity.class);
    				intent.putExtras(b);
-   				startActivity(intent);
+   				startActivityForResult(intent, NEW_ISSUE);
    		        return true;
    		    default:
    		        return super.onOptionsItemSelected(item);
    	    }
    	}
-
-	public void onResume(){
-		super.onResume();
-		AsyncLoader asyncLoader = new AsyncLoader();
-		asyncLoader.execute("https://api.bitbucket.org/1.0/repositories/"+ owner +"/"+ slug +"/issues/" + filter);
-	}
+    
+    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
+        if (requestCode == NEW_ISSUE) {
+        	Log.d("RESULT", "EWEQ");
+        	loadIssuesByFilter();
+        }
+    }
 
 	private OnNavigationListener mNavigationCallback = new OnNavigationListener() {
 
 				if (pos == 0) filter = "";
 				else if (pos == 1) filter = "?status=new&status=open";
 				else filter = "?status="+URLEncoder.encode(mSpinnerAdapter.getItem((int) itemId).toString());
-				onResume();
+				loadIssuesByFilter();
 			}
 			return false;
 		}

src/com/saibotd/bitbeaker/LoginActivity.java

 
 	public void onCreate(Bundle savedInstanceState) {
 		super.onCreate(savedInstanceState);
-
+		setSupportProgressBarIndeterminateVisibility(false);
 		try {
 			Bundle b = getIntent().getExtras();
 			if (b.containsKey("logout"))
 				/* This is an awful way to check the login! */
 
 				URL url = new URL(
-						"https://api.bitbucket.org/1.0/user/repositories/");
+						"https://api.bitbucket.org/1.0/emails/");
 				HttpsURLConnection urlConnection;
 				urlConnection = (HttpsURLConnection) url.openConnection();
 				String loginString = bitbeaker.getUsername() + ":"

src/com/saibotd/bitbeaker/NewIssueActivity.java

 
 import java.net.URLEncoder;
 
-import android.app.ProgressDialog;
+import android.app.Activity;
 import android.os.Bundle;
-import android.view.View;
-import android.view.View.OnClickListener;
-import android.widget.Button;
 import android.widget.EditText;
 import android.widget.Spinner;
 import android.widget.Toast;
 
 import com.actionbarsherlock.view.Menu;
+import com.actionbarsherlock.view.MenuInflater;
+import com.actionbarsherlock.view.MenuItem;
 
 public class NewIssueActivity extends MyActivity {
 	
     @Override
     public void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
+        setSupportProgressBarIndeterminateVisibility(false);
         Bundle b = getIntent().getExtras();
         slug = b.getString("slug");
         owner = b.getString("owner");
         setContentView(R.layout.new_issue);
         setTitle(slug);
         getSupportActionBar().setSubtitle("Report new issue");
-        Button newIssue = (Button) findViewById(R.id.bt_save_new_issue);
-		newIssue.setOnClickListener(saveNewIssueClickListener);
+    }
+    
+    public boolean onCreateOptionsMenu(Menu menu) {
+        MenuInflater inflater = getSupportMenuInflater();
+        inflater.inflate(R.menu.menu_simple_submit, menu);
+        return true;
     }
     
     @Override
-   	public boolean onCreateOptionsMenu(Menu menu) {
-   		return false;
-   	}
-    
-    private void showLoading(){
-    	progressDialog = ProgressDialog.show(this, "", "Submitting ...", true);
-    }
+  	public boolean onOptionsItemSelected(MenuItem item) {
+  	    switch (item.getItemId()) {
+  		    case R.id.menu_submit:
+  		    	String title = ((EditText) findViewById(R.id.new_issue_title)).getText().toString();
+  				String content = ((EditText) findViewById(R.id.new_issue_content)).getText().toString();
+  				String type = ((Spinner) findViewById(R.id.new_issue_type)).getSelectedItem().toString(); 
+  		        AsyncLoader asyncLoader = new AsyncLoader();
+  		        asyncLoader.execute("https://api.bitbucket.org/1.0/repositories/"+ owner +"/"+ slug +"/issues/", "title=" + URLEncoder.encode(title) + "&content=" + URLEncoder.encode(content) + "&kind=" + URLEncoder.encode(type));
+  		    default:
+  		        return super.onOptionsItemSelected(item);
+  	    }
+  	}
     
     private void done(){
-    	bitbeaker.delKV("https://api.bitbucket.org/1.0/repositories/"+ owner +"/"+ slug +"/issues/");
-    	Toast.makeText(this, "New issue submitted!", 1000);
+    	Toast.makeText(this, "New issue submitted!", Toast.LENGTH_LONG).show();
+    	setResult(Activity.RESULT_OK, getIntent());
     	finish();
     }
-    
-    
-    
-    private OnClickListener saveNewIssueClickListener = new OnClickListener() {
-		public void onClick(View v) {
-			showLoading();
-			String title = ((EditText) findViewById(R.id.new_issue_title)).getText().toString();
-			String content = ((EditText) findViewById(R.id.new_issue_content)).getText().toString();
-			String type = ((Spinner) findViewById(R.id.new_issue_type)).getSelectedItem().toString(); 
-	        AsyncLoader asyncLoader = new AsyncLoader();
-	        asyncLoader.execute("https://api.bitbucket.org/1.0/repositories/"+ owner +"/"+ slug +"/issues/", "title=" + URLEncoder.encode(title) + "&content=" + URLEncoder.encode(content) + "&kind=" + URLEncoder.encode(type));
-		}
-	};
 	
     protected void AsyncLoaderDone(String result) {
     	super.AsyncLoaderDone(result);

src/com/saibotd/bitbeaker/RepositoriesActivity.java

         super.onCreate(savedInstanceState);
         
         setContentView(R.layout.repositories);
-        //ImageButton search = (ImageButton) findViewById(R.id.bt_search);
-        //search.setVisibility(ImageButton.VISIBLE);
-        //search.setOnClickListener(searchClickListener);
         
         AsyncLoader asyncLoader = new AsyncLoader();
         asyncLoader.execute("https://api.bitbucket.org/1.0/user/repositories/");
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.