Commits

Tobias Duehr committed 5dd0618

Implemented path fix from Cheryl (thanks), Issues can now be tapped on

Comments (0)

Files changed (9)

         	<meta-data android:name="android.app.searchable" android:resource="@xml/searchable"/>
    		</activity>
 		<activity android:name="NewIssueActivity"></activity>
+		<activity android:name="IssueActivity"></activity>
     </application>
 </manifest>

gen/com/saibotd/bitbeaker/R.java

         public static final int lock=0x7f02000e;
         public static final int logo_big=0x7f02000f;
         public static final int proposal=0x7f020010;
-        public static final int top_bg=0x7f020011;
-        public static final int top_search=0x7f020012;
+        public static final int selectors=0x7f020011;
+        public static final int top_bg=0x7f020012;
+        public static final int top_search=0x7f020013;
     }
     public static final class id {
-        public static final int TextView01=0x7f08001d;
-        public static final int TextView02=0x7f08001b;
-        public static final int ad_space=0x7f080008;
-        public static final int bt_issues=0x7f080025;
-        public static final int bt_new_issue=0x7f080009;
-        public static final int bt_save_new_issue=0x7f08001f;
+        public static final int TextView01=0x7f080020;
+        public static final int TextView02=0x7f08001e;
+        public static final int ad_space=0x7f08000b;
+        public static final int bt_issues=0x7f080028;
+        public static final int bt_new_issue=0x7f08000c;
+        public static final int bt_save_new_issue=0x7f080022;
         public static final int bt_search=0x7f080006;
-        public static final int bt_source_browser=0x7f080024;
-        public static final int bt_wiki=0x7f080026;
+        public static final int bt_source_browser=0x7f080027;
+        public static final int bt_wiki=0x7f080029;
         public static final int changeset_files=0x7f080002;
-        public static final int changeset_loading=0x7f080023;
+        public static final int changeset_loading=0x7f080026;
         public static final int changeset_message=0x7f080000;
-        public static final int changeset_what=0x7f08000c;
-        public static final int frameLayout1=0x7f08000b;
+        public static final int changeset_what=0x7f08000e;
+        public static final int frameLayout1=0x7f08000f;
         public static final int header_title=0x7f080005;
-        public static final int icon=0x7f080021;
+        public static final int icon=0x7f080024;
         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=0x7f080018;
-        public static final int login_password=0x7f080017;
-        public static final int login_username=0x7f080016;
-        public static final int menu_logout=0x7f08002a;
-        public static final int menu_refresh=0x7f080029;
-        public static final int new_issue_content=0x7f08001c;
-        public static final int new_issue_title=0x7f08001a;
-        public static final int new_issue_type=0x7f08001e;
-        public static final int owner_listitem_repositories=0x7f080012;
-        public static final int repositories_list=0x7f080020;
-        public static final int repository_changesets=0x7f080022;
-        public static final int repository_description=0x7f080019;
-        public static final int scrollView1=0x7f080015;
-        public static final int source_title=0x7f080013;
-        public static final int source_webview=0x7f080027;
-        public static final int source_what=0x7f080014;
-        public static final int subtitle=0x7f08000a;
+        public static final int is_locked=0x7f080014;
+        public static final int issue_content=0x7f080009;
+        public static final int issue_status=0x7f080008;
+        public static final int issue_title=0x7f080007;
+        public static final int issues_list=0x7f08000a;
+        public static final int issues_subtitle=0x7f080012;
+        public static final int issues_title=0x7f080010;
+        public static final int issues_what=0x7f080011;
+        public static final int login_button=0x7f08001b;
+        public static final int login_password=0x7f08001a;
+        public static final int login_username=0x7f080019;
+        public static final int menu_logout=0x7f08002d;
+        public static final int menu_refresh=0x7f08002c;
+        public static final int new_issue_content=0x7f08001f;
+        public static final int new_issue_title=0x7f08001d;
+        public static final int new_issue_type=0x7f080021;
+        public static final int owner_listitem_repositories=0x7f080015;
+        public static final int repositories_list=0x7f080023;
+        public static final int repository_changesets=0x7f080025;
+        public static final int repository_description=0x7f08001c;
+        public static final int scrollView1=0x7f080018;
+        public static final int source_title=0x7f080016;
+        public static final int source_webview=0x7f08002a;
+        public static final int source_what=0x7f080017;
+        public static final int subtitle=0x7f08000d;
         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=0x7f080028;
+        public static final int title_listitem_repositories=0x7f080013;
+        public static final int wiki_webview=0x7f08002b;
     }
     public static final class layout {
         public static final int changeset=0x7f030000;
         public static final int header=0x7f030001;
-        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 int issue=0x7f030002;
+        public static final int issues=0x7f030003;
+        public static final int listitem=0x7f030004;
+        public static final int listitem_changeset=0x7f030005;
+        public static final int listitem_issues=0x7f030006;
+        public static final int listitem_repositories=0x7f030007;
+        public static final int listitem_source=0x7f030008;
+        public static final int login=0x7f030009;
+        public static final int new_issue=0x7f03000a;
+        public static final int repositories=0x7f03000b;
+        public static final int repository=0x7f03000c;
+        public static final int source=0x7f03000d;
+        public static final int wiki=0x7f03000e;
     }
     public static final class menu {
         public static final int mainmenu=0x7f070000;

res/drawable-mdpi/selectors.xml

+<?xml version="1.0" encoding="utf-8"?>
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+    <item android:state_selected="true" android:color="#FFF" android:drawable="@drawable/top_bg" />
+    <item android:state_focused="true" android:color="#FFF" android:drawable="@drawable/top_bg" />
+    <item android:state_pressed="true" android:color="#FFF" android:drawable="@drawable/top_bg" />
+    <item android:color="#FFF" android:drawable="@drawable/top_bg" />
+</selector>
+<?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_width="match_parent" android:layout_height="wrap_content" android:layout_margin="4dip">
+        <TextView android:layout_width="wrap_content" android:layout_height="match_parent" android:id="@+id/issue_title" android:textSize="18dip" android:text="@string/description"></TextView>
+    </LinearLayout>
+    <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margin="4dip">
+        <TextView android:layout_width="wrap_content" android:layout_height="match_parent" android:id="@+id/issue_status" android:text="@string/description"></TextView>
+    </LinearLayout>
+    <LinearLayout android:layout_height="wrap_content" android:layout_weight="1" android:orientation="vertical" android:layout_width="match_parent" android:layout_margin="4dip">
+        <ScrollView android:layout_height="match_parent" android:layout_width="match_parent">
+            <TextView android:layout_width="match_parent" android:textSize="18dip" android:text="@string/changes" android:id="@+id/issue_content" android:layout_height="wrap_content"></TextView>
+        </ScrollView>
+    </LinearLayout>
+  
+</LinearLayout>

res/layout/listitem_changeset.xml

   android:layout_width="match_parent"
   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:id="@+id/frameLayout1" android:layout_width="match_parent">
+        <FrameLayout android:layout_height="match_parent" android:layout_width="match_parent">
             <TextView android:id="@+id/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:id="@+id/changeset_what" android:src="@drawable/edit" android:layout_marginRight="5dip"></ImageView>
         </FrameLayout>

res/layout/listitem_repositories.xml

   xmlns:android="http://schemas.android.com/apk/res/android"
   android:layout_width="match_parent"
   android:padding="5dip" android:orientation="horizontal" android:layout_height="wrap_content">
-    <FrameLayout android:id="@+id/frameLayout1" android:layout_height="wrap_content" android:layout_width="match_parent">
+    <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>
         <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>

src/com/saibotd/bitbeaker/IssueActivity.java

+package com.saibotd.bitbeaker;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import android.app.ProgressDialog;
+import android.os.Bundle;
+import android.util.Log;
+import android.widget.TextView;
+
+public class IssueActivity extends MyActivity {
+    
+	private String slug;
+	private String owner;
+	private String title;
+	private int id;
+	
+    public void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.issue);
+        Bundle b = getIntent().getExtras();
+        slug = b.getString("slug");
+        owner = b.getString("owner");
+        title = b.getString("title");
+        id = b.getInt("id");
+        ((TextView) findViewById(R.id.issue_title)).setText(title);
+        progressDialog = ProgressDialog.show(this, "", "Loading ...", true);
+        AsyncLoader asyncLoader = new AsyncLoader();
+        asyncLoader.execute("https://api.bitbucket.org/1.0/repositories/"+ owner +"/"+ slug +"/issues/" + id);
+    }
+	
+	public void AsyncLoaderDone(String result) {
+		super.AsyncLoaderDone(result);
+		JSONObject jsonObject;
+		TextView status = (TextView) findViewById(R.id.issue_status);
+		TextView content = (TextView) findViewById(R.id.issue_content);
+		try {
+			jsonObject = new JSONObject(result);
+			status.setText("Status: " + jsonObject.getString("status"));
+			content.setText(jsonObject.getString("content"));
+			Log.d("TEST", jsonObject.toString());
+		} catch (JSONException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+	}
+	
+	
+}

src/com/saibotd/bitbeaker/IssuesActivity.java

     		public void onClick(View v) {
     			try {
     				int id = getItem(v.getId()).getInt("local_id");
+    				String title = getItem(v.getId()).getString("title");
     				Bundle b = new Bundle();
     				b.putString("slug", slug);
     				b.putString("owner", owner);
+    				b.putString("title", title);
     				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();

src/com/saibotd/bitbeaker/SourceBrowserActivity.java

     	ListView listView = (ListView) findViewById(R.id.repositories_list);
 		try {
 			JSONObject jsonObject = new JSONObject(result);
-			String path = jsonObject.getString("path");
 			JSONArray dirs = jsonObject.getJSONArray("directories");
 			for(int i = 0; i < dirs.length(); i++){
 				jsonArray.put("dir_" + dirs.get(i));
 			JSONArray files = jsonObject.getJSONArray("files");
 			for(int i = 0; i < files.length(); i++){
 				String filePath = files.getJSONObject(i).getString("path");
-				jsonArray.put("fil_" + filePath.replace(path, ""));
+				int lastSlashIndex = filePath.lastIndexOf("/");
+				jsonArray.put("fil_" + filePath.substring(lastSlashIndex+1));
 			}
 		} catch (JSONException e) {
 			// TODO Auto-generated catch block