Commits

Tobias Duehr committed b4e87b2

Create new issues - not ready yet!

Comments (0)

Files changed (9)

+glob:_assets/*
+glob:bin/*
+glob:.settings/

AndroidManifest.xml

         	<meta-data android:name="android.app.default_searchable" android:value=".SearchableActivity" />
         </activity>
         <activity android:name="ChangesetActivity"></activity>
-		<activity android:name="com.google.ads.AdActivity" android:configChanges="keyboard|keyboardHidden|orientation"/>
 		<activity android:name="SourceBrowserActivity"></activity>
 		<activity android:name="WikiActivity"></activity>
 		<activity android:name="SourceActivity"></activity>
 	        </intent-filter>
         	<meta-data android:name="android.app.searchable" android:resource="@xml/searchable"/>
    		</activity>
+		<activity android:name="NewIssueActivity"></activity>
     </application>
 </manifest>

gen/com/saibotd/bitbeaker/R.java

 package com.saibotd.bitbeaker;
 
 public final class R {
+    public static final class array {
+        public static final int type_of_issue=0x7f060000;
+    }
     public static final class attr {
     }
     public static final class drawable {
         public static final int top_search=0x7f020012;
     }
     public static final class id {
-        public static final int ad_space=0x7f070016;
-        public static final int bt_issues=0x7f07001c;
-        public static final int bt_search=0x7f070006;
-        public static final int bt_source_browser=0x7f07001b;
-        public static final int bt_wiki=0x7f07001d;
-        public static final int changeset_files=0x7f070002;
-        public static final int changeset_loading=0x7f07001a;
-        public static final int changeset_message=0x7f070000;
-        public static final int changeset_what=0x7f070009;
-        public static final int frameLayout1=0x7f070008;
-        public static final int header_title=0x7f070005;
-        public static final int icon=0x7f070018;
-        public static final int imageView1=0x7f070004;
-        public static final int is_locked=0x7f07000e;
-        public static final int issues_subtitle=0x7f07000c;
-        public static final int issues_title=0x7f07000a;
-        public static final int issues_what=0x7f07000b;
-        public static final int login_button=0x7f070014;
-        public static final int login_password=0x7f070013;
-        public static final int login_username=0x7f070012;
-        public static final int menu_logout=0x7f070021;
-        public static final int menu_refresh=0x7f070020;
-        public static final int owner_listitem_repositories=0x7f07000f;
-        public static final int repositories_list=0x7f070015;
-        public static final int repository_changesets=0x7f070019;
-        public static final int repository_description=0x7f070017;
-        public static final int source_title=0x7f070010;
-        public static final int source_webview=0x7f07001e;
-        public static final int source_what=0x7f070011;
-        public static final int subtitle=0x7f070007;
-        public static final int textView1=0x7f070001;
-        public static final int title=0x7f070003;
-        public static final int title_listitem_repositories=0x7f07000d;
-        public static final int wiki_webview=0x7f07001f;
+        public static final int TextView01=0x7f08001c;
+        public static final int TextView02=0x7f08001a;
+        public static final int ad_space=0x7f080008;
+        public static final int bt_issues=0x7f080024;
+        public static final int bt_new_issue=0x7f080009;
+        public static final int bt_save_new_issue=0x7f08001e;
+        public static final int bt_search=0x7f080006;
+        public static final int bt_source_browser=0x7f080023;
+        public static final int bt_wiki=0x7f080025;
+        public static final int changeset_files=0x7f080002;
+        public static final int changeset_loading=0x7f080022;
+        public static final int changeset_message=0x7f080000;
+        public static final int changeset_what=0x7f08000c;
+        public static final int editText1=0x7f080019;
+        public static final int editText2=0x7f08001b;
+        public static final int frameLayout1=0x7f08000b;
+        public static final int header_title=0x7f080005;
+        public static final int icon=0x7f080020;
+        public static final int imageView1=0x7f080004;
+        public static final int is_locked=0x7f080011;
+        public static final int issues_list=0x7f080007;
+        public static final int issues_subtitle=0x7f08000f;
+        public static final int issues_title=0x7f08000d;
+        public static final int issues_what=0x7f08000e;
+        public static final int login_button=0x7f080017;
+        public static final int login_password=0x7f080016;
+        public static final int login_username=0x7f080015;
+        public static final int menu_logout=0x7f080029;
+        public static final int menu_refresh=0x7f080028;
+        public static final int owner_listitem_repositories=0x7f080012;
+        public static final int repositories_list=0x7f08001f;
+        public static final int repository_changesets=0x7f080021;
+        public static final int repository_description=0x7f080018;
+        public static final int source_title=0x7f080013;
+        public static final int source_webview=0x7f080026;
+        public static final int source_what=0x7f080014;
+        public static final int spinner1=0x7f08001d;
+        public static final int subtitle=0x7f08000a;
+        public static final int textView1=0x7f080001;
+        public static final int title=0x7f080003;
+        public static final int title_listitem_repositories=0x7f080010;
+        public static final int wiki_webview=0x7f080027;
     }
     public static final class layout {
         public static final int changeset=0x7f030000;
         public static final int header=0x7f030001;
-        public static final int listitem=0x7f030002;
-        public static final int listitem_changeset=0x7f030003;
-        public static final int listitem_issues=0x7f030004;
-        public static final int listitem_repositories=0x7f030005;
-        public static final int listitem_source=0x7f030006;
-        public static final int login=0x7f030007;
-        public static final int repositories=0x7f030008;
-        public static final int repository=0x7f030009;
-        public static final int source=0x7f03000a;
-        public static final int wiki=0x7f03000b;
+        public static final int issues=0x7f030002;
+        public static final int listitem=0x7f030003;
+        public static final int listitem_changeset=0x7f030004;
+        public static final int listitem_issues=0x7f030005;
+        public static final int listitem_repositories=0x7f030006;
+        public static final int listitem_source=0x7f030007;
+        public static final int login=0x7f030008;
+        public static final int new_issue=0x7f030009;
+        public static final int repositories=0x7f03000a;
+        public static final int repository=0x7f03000b;
+        public static final int source=0x7f03000c;
+        public static final int wiki=0x7f03000d;
     }
     public static final class menu {
-        public static final int mainmenu=0x7f060000;
+        public static final int mainmenu=0x7f070000;
     }
     public static final class string {
         public static final int app_name=0x7f050001;
         public static final int changes=0x7f05000b;
         public static final int changesets=0x7f050005;
         public static final int clear_cache=0x7f050013;
+        public static final int content=0x7f050016;
         public static final int description=0x7f050006;
         public static final int files=0x7f05000a;
         public static final int hello=0x7f050000;
         public static final int issues=0x7f05000f;
         public static final int log_out=0x7f050010;
         public static final int login=0x7f050008;
+        public static final int new_issue=0x7f050014;
         public static final int nothing=0x7f050007;
         public static final int pleaseenterbitbucket=0x7f050009;
         public static final int refresh=0x7f050012;
         public static final int search_repo=0x7f050011;
         public static final int source=0x7f05000e;
         public static final int source_browser=0x7f05000d;
+        public static final int title=0x7f050015;
+        public static final int type=0x7f050017;
         public static final int website=0x7f050004;
         public static final int wiki=0x7f050002;
     }

res/layout/issues.xml

+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:orientation="vertical"
+    android:layout_width="fill_parent"
+    android:layout_height="fill_parent"
+    >
+    <include layout="@layout/header" android:layout_width="match_parent" android:layout_height="wrap_content"/>
+    <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>
+    <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/ad_space">
+        <Button android:id="@+id/bt_new_issue" android:layout_height="wrap_content" android:text="@string/new_issue" android:layout_width="match_parent"></Button>
+    </LinearLayout>
+</LinearLayout>

res/layout/new_issue.xml

+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout
+  xmlns:android="http://schemas.android.com/apk/res/android"
+  android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent">
+  <include layout="@layout/header" android:layout_width="match_parent" android:layout_height="wrap_content"/>
+    <LinearLayout android:layout_weight="1" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="wrap_content">
+        <TextView android:layout_height="wrap_content" android:autoLink="all" android:linksClickable="true" android:layout_marginRight="42dip" android:layout_width="match_parent" android:id="@+id/repository_description" android:text="@string/title"></TextView>
+        <EditText android:id="@+id/editText1" android:layout_width="match_parent" android:layout_height="wrap_content">
+            <requestFocus></requestFocus>
+        </EditText>
+        <TextView android:text="@string/content" android:autoLink="all" android:linksClickable="true" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginRight="42dip" android:id="@+id/TextView02"></TextView>
+        <EditText android:id="@+id/editText2" android:layout_width="match_parent" android:layout_height="wrap_content" android:inputType="textMultiLine" android:layout_weight="1"></EditText>
+        <TextView android:autoLink="all" android:linksClickable="true" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginRight="42dip" android:id="@+id/TextView01" android:text="@string/type"></TextView>
+        <Spinner android:id="@+id/spinner1" android:layout_width="match_parent" android:layout_height="wrap_content" android:entries="@array/type_of_issue"></Spinner>
+    </LinearLayout>
+    <LinearLayout android:layout_height="wrap_content" android:layout_width="match_parent" android:orientation="horizontal" >
+        <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content">
+            <Button android:layout_width="wrap_content" android:layout_weight="1" android:layout_height="wrap_content" android:id="@+id/bt_save_new_issue" android:text="@string/new_issue"></Button>
+        </LinearLayout>
+    </LinearLayout>
+  
+</LinearLayout>

res/values/strings.xml

     <string name="search_repo">Search for repositories</string>
     <string name="refresh">Refresh</string>
     <string name="clear_cache">Clear cache</string>
+    <string name="new_issue">Create new issue</string>
+    <string name="title">Title</string>
+    <string name="content">Content</string>
+    <string name="type">Type</string>
+    <string-array name="type_of_issue">
+        <item>bug</item>
+        <item>enhancement</item>
+        <item>proposal</item>
+    </string-array>
 </resources>

src/com/saibotd/bitbeaker/IssuesActivity.java

 
 import android.app.ProgressDialog;
 import android.content.Context;
+import android.content.Intent;
 import android.os.Bundle;
 import android.view.View;
 import android.view.View.OnClickListener;
 import android.view.ViewGroup;
+import android.widget.Button;
 import android.widget.ImageView;
 import android.widget.ListView;
 import android.widget.TextView;
         slug = b.getString("slug");
         owner = b.getString("owner");
         //setListAdapter(new IssuesAdapter(this, slug, owner));
-        setContentView(R.layout.repositories);
+        setContentView(R.layout.issues);
         ((TextView) findViewById(R.id.header_title)).setText(slug);
         AsyncLoader asyncLoader = new AsyncLoader();
         asyncLoader.execute("https://api.bitbucket.org/1.0/repositories/"+ owner +"/"+ slug +"/issues/");
         progressDialog = ProgressDialog.show(this, "", "Loading ...", true);
     }
     
+    private OnClickListener newIssueClickListener = new OnClickListener() {
+		public void onClick(View v) {
+	    	Intent intent = new Intent(v.getContext(), NewIssueActivity.class);
+			Bundle b = new Bundle();
+			b.putString("slug", slug);
+			b.putString("owner", owner);
+			intent.putExtras(b);
+			v.getContext().startActivity(intent);
+		}
+	};
+    
     protected void AsyncLoaderDone(String result) {
     	super.AsyncLoaderDone(result);
-    	ListView listView = (ListView) findViewById(R.id.repositories_list);
+    	ListView listView = (ListView) findViewById(R.id.issues_list);
 		try {
 			listView.setAdapter(new IssuesAdapter(this, new JSONObject(result).getJSONArray("issues")));
 		} catch (JSONException e) {
 			// TODO Auto-generated catch block
 			e.printStackTrace();
 		}
+		Button newIssue = (Button) findViewById(R.id.bt_new_issue);
+		newIssue.setOnClickListener(newIssueClickListener);
 	}
     
     protected class IssuesAdapter extends MyAdapter {

src/com/saibotd/bitbeaker/MyActivity.java

 
 import java.io.BufferedInputStream;
 import java.io.BufferedReader;
-import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.net.URL;
 import android.app.AlertDialog;
 import android.app.ProgressDialog;
 import android.content.DialogInterface;
+import android.content.DialogInterface.OnCancelListener;
 import android.content.Intent;
-import android.content.DialogInterface.OnCancelListener;
 import android.os.AsyncTask;
 import android.os.Bundle;
 import android.util.Base64;

src/com/saibotd/bitbeaker/NewIssueActivity.java

+package com.saibotd.bitbeaker;
+
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import android.app.ProgressDialog;
+import android.content.Context;
+import android.content.Intent;
+import android.os.Bundle;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.view.ViewGroup;
+import android.widget.Button;
+import android.widget.ImageView;
+import android.widget.ListView;
+import android.widget.TextView;
+
+public class NewIssueActivity extends MyActivity {
+	
+	private String slug;
+	private String owner;
+	
+    @Override
+    public void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        Bundle b = getIntent().getExtras();
+        slug = b.getString("slug");
+        owner = b.getString("owner");
+        //setListAdapter(new IssuesAdapter(this, slug, owner));
+        setContentView(R.layout.new_issue);
+        ((TextView) findViewById(R.id.header_title)).setText(slug);
+        //AsyncLoader asyncLoader = new AsyncLoader();
+        //asyncLoader.execute("https://api.bitbucket.org/1.0/repositories/"+ owner +"/"+ slug +"/issues/");
+        //progressDialog = ProgressDialog.show(this, "", "Loading ...", true);
+    }
+    
+    private OnClickListener saveNewIssueClickListener = new OnClickListener() {
+		public void onClick(View v) {
+	    	Intent intent = new Intent(v.getContext(), NewIssueActivity.class);
+			Bundle b = new Bundle();
+			b.putString("slug", slug);
+			b.putString("owner", owner);
+			intent.putExtras(b);
+			v.getContext().startActivity(intent);
+		}
+	};
+    
+    protected void AsyncLoaderDone(String result) {
+    	super.AsyncLoaderDone(result);
+    	ListView listView = (ListView) findViewById(R.id.issues_list);
+		try {
+			listView.setAdapter(new IssuesAdapter(this, new JSONObject(result).getJSONArray("issues")));
+		} catch (JSONException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+		Button newIssue = (Button) findViewById(R.id.bt_save_new_issue);
+		newIssue.setOnClickListener(saveNewIssueClickListener);
+	}
+    
+    protected class IssuesAdapter extends MyAdapter {
+
+
+    	
+    	public IssuesAdapter(Context context, JSONArray jsonArray) {
+    		super(context, jsonArray);
+    	}
+    	
+    	private OnClickListener clickListener = new OnClickListener() {
+    		public void onClick(View v) {
+    			try {
+    				int id = getItem(v.getId()).getInt("local_id");
+    				Bundle b = new Bundle();
+    				b.putString("slug", slug);
+    				b.putString("owner", owner);
+    				b.putInt("id", id);
+    				/*
+    				Intent intent = new Intent(v.getContext(), IssueActivity.class);
+    				intent.putExtras(b);
+    				v.getContext().startActivity(intent);
+    				*/
+    			} catch (JSONException e) {
+    				// TODO Auto-generated catch block
+    				e.printStackTrace();
+    			}
+    		}
+    	};
+    	
+    	public View getView(int position, View convertView, ViewGroup parent) {
+    		View view;
+    		if (convertView == null) {
+    			view = mFactory.inflate(R.layout.listitem_issues, null);
+    		} else {
+    			view = (View) convertView;
+    		}
+    		view.setId(position);
+    		TextView title = (TextView) view.findViewById(R.id.issues_title);
+    		TextView subtitle = (TextView) view.findViewById(R.id.issues_subtitle);
+    		ImageView icon = (ImageView) view.findViewById(R.id.issues_what);
+    		try {
+    			String type = this.getItem(position).getJSONObject("metadata").getString("kind");
+    			title.setText(this.getItem(position).getString("title"));
+    			subtitle.setText(this.getItem(position).getString("created_on") + " - " + this.getItem(position).getString("comment_count") + " comment(s)");
+    			if(type.equals("bug")) icon.setImageResource(R.drawable.bug);
+    			if(type.equals("enhancement")) icon.setImageResource(R.drawable.enhancement);
+    			if(type.equals("proposal")) icon.setImageResource(R.drawable.proposal);
+    		} catch (JSONException e) {
+    			// TODO Auto-generated catch block
+    			e.printStackTrace();
+    		}
+    		view.setOnClickListener(clickListener);
+    		return view;
+    	}
+
+    }
+
+    
+    
+}
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.