1. osaatcioglu
  2. bitbeaker

Commits

osaatcioglu  committed bdccbd6

The first version with Sherlock Action Bar

  • Participants
  • Parent commits cbab705
  • Branches default

Comments (0)

Files changed (17)

File AndroidManifest.xml

View file
  • Ignore whitespace
     <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
 
     <application android:label="@string/app_name" android:theme="@style/bbTheme" android:icon="@drawable/icon" android:name="Bitbeaker">
-        <activity android:label="@string/app_name" android:name="LoginActivity" android:noHistory="true">
+        <activity android:label="@string/app_name" android:name="LoginActivity" android:noHistory="true"
+            android:launchMode="singleTask">
         	<meta-data android:name="android.app.default_searchable" android:value=".SearchableActivity" />
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <category android:name="android.intent.category.LAUNCHER" />
             </intent-filter>
         </activity>
-        <activity android:name="RepositoryActivity">
+        <activity android:name="RepositoryActivity"
+            android:launchMode="singleTask">
         	<meta-data android:name="android.app.default_searchable" android:value=".SearchableActivity" />
         </activity>
-        <activity android:name="EventsActivity"></activity>
-        <activity android:name="RepositoriesActivity">
+        <activity android:name="EventsActivity"
+            android:launchMode="singleTask"></activity>
+        <activity android:name="RepositoriesActivity"
+            android:launchMode="singleTask">
         	<meta-data android:name="android.app.default_searchable" android:value=".SearchableActivity" />
         </activity>
         <activity android:name="ChangesetActivity"></activity>
-		<activity android:name="SourceBrowserActivity"></activity>
-		<activity android:name="WikiActivity"></activity>
+		<activity android:name="SourceBrowserActivity"
+		    android:launchMode="singleTask"></activity>
+		<activity android:name="WikiActivity"
+		    android:launchMode="singleTask"></activity>
 		<activity android:name="SourceActivity"></activity>
-		<activity android:name="IssuesActivity"></activity>
+		<activity android:name="IssuesActivity"
+		    android:launchMode="singleTask"></activity>
 		<activity android:name=".SearchableActivity">
 	        <intent-filter>
 	            <action android:name="android.intent.action.SEARCH" />

File res/layout/issues.xml

View file
  • Ignore whitespace
     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>

File res/layout/login.xml

View file
  • Ignore whitespace
   xmlns:android="http://schemas.android.com/apk/res/android"
   android:layout_width="match_parent"
   android:orientation="vertical" android:layout_height="match_parent" android:background="@drawable/bg">
-  <include layout="@layout/header" android:layout_width="match_parent" android:layout_height="wrap_content"/>
     <LinearLayout android:layout_height="wrap_content" android:layout_width="match_parent" android:layout_weight="1" android:orientation="vertical">
         <ImageView android:layout_height="wrap_content" android:layout_width="match_parent" android:src="@drawable/logo_big" android:layout_margin="10dip"></ImageView>
     </LinearLayout>

File res/layout/repositories.xml

View file
  • Ignore whitespace
     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/repositories_list"></ListView>
     </LinearLayout>

File res/layout/repository.xml

View file
  • Ignore whitespace
 <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">
         <FrameLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:padding="4dip">
             <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/repository_description" android:text="@string/nothing" android:layout_marginRight="42dip" android:autoLink="all" android:linksClickable="true"></TextView>
         <ListView android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/repository_changesets"></ListView>
         <ProgressBar android:id="@+id/changeset_loading" android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_gravity="center|center_vertical" android:layout_marginTop="30dip"></ProgressBar>
     </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:text="@string/source" android:id="@+id/bt_source_browser"></Button>
-            <Button android:layout_weight="1" android:layout_height="wrap_content" android:layout_width="wrap_content" android:enabled="false" android:text="@string/issues" android:id="@+id/bt_issues"></Button>
-            <Button android:layout_width="wrap_content" android:layout_weight="1" android:layout_height="wrap_content" android:text="@string/wiki" android:id="@+id/bt_wiki" android:enabled="false"></Button>
-        </LinearLayout>
-    </LinearLayout>
   
 </LinearLayout>

File res/layout/source.xml

View file
  • Ignore whitespace
   xmlns:android="http://schemas.android.com/apk/res/android"
   android:layout_width="match_parent"
   android:layout_height="match_parent" android:orientation="vertical">
-    <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content">
-        <include layout="@layout/header" android:layout_height="wrap_content" android:layout_width="match_parent"></include>
-    </LinearLayout>
     <WebView android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/source_webview"></WebView>
 </LinearLayout>

File res/layout/wiki.xml

View file
  • Ignore whitespace
   xmlns:android="http://schemas.android.com/apk/res/android"
   android:layout_width="match_parent"
   android:layout_height="match_parent" android:orientation="vertical">
-    <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content">
-        <include layout="@layout/header" android:layout_height="wrap_content" android:layout_width="match_parent"></include>
-    </LinearLayout>
     <WebView android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/wiki_webview"></WebView>
 </LinearLayout>

File res/values/arrays.xml

View file
  • Ignore whitespace
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+    <string-array name="locations">
+        <item>Overview</item>
+        <item>Source</item>
+        <item>Wiki</item>
+        <item>Issues</item>
+	</string-array>
+</resources>

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

View file
  • Ignore whitespace
 import android.widget.ListView;
 import android.widget.TextView;
 
-public class IssuesActivity extends MyActivity {
-	
-	private String slug;
-	private String owner;
+public class IssuesActivity extends RepositoryBaseActivity {
 	
     @Override
     public void onCreate(Bundle savedInstanceState) {
+    	setTheme(R.style.Theme_Sherlock_Light);
         super.onCreate(savedInstanceState);
         Bundle b = getIntent().getExtras();
         slug = b.getString("slug");
         owner = b.getString("owner");
         //setListAdapter(new IssuesAdapter(this, slug, owner));
         setContentView(R.layout.issues);
-        ((TextView) findViewById(R.id.header_title)).setText(slug);
+//        ((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);
     }
     
+	@Override
+	protected void onStart() {
+        setUpActionBar(3);
+		super.onStart();
+	}
+
     public void onResume(){
     	super.onResume();
     	AsyncLoader asyncLoader = new AsyncLoader();

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

View file
  • Ignore whitespace
         }
         setContentView(R.layout.login);
     	findViewById(R.id.login_button).setOnClickListener(clickListener);
-    	ImageButton search = (ImageButton) findViewById(R.id.bt_search);
-        search.setVisibility(ImageButton.VISIBLE);
-        search.setOnClickListener(searchClickListener);
-        search.requestFocus();
+//    	ImageButton search = (ImageButton) findViewById(R.id.bt_search);
+//        search.setVisibility(ImageButton.VISIBLE);
+//        search.setOnClickListener(searchClickListener);
+//        search.requestFocus();
     }
     
-    public boolean onCreateOptionsMenu(Menu menu) {
-	    return false;
-	}
+//    public boolean onCreateOptionsMenu(Menu menu) {
+//	    return false;
+//	}
     
     private void logOut(Boolean isError){
     	if(progressDialog != null) progressDialog.dismiss();

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

View file
  • Ignore whitespace
 
 import javax.net.ssl.HttpsURLConnection;
 
-import android.app.Activity;
 import android.app.AlertDialog;
 import android.app.ProgressDialog;
 import android.content.DialogInterface;
 import android.content.DialogInterface.OnCancelListener;
-import android.content.Intent;
 import android.os.AsyncTask;
 import android.os.Bundle;
 import android.util.Base64;
 import android.util.Log;
-import android.view.Menu;
-import android.view.MenuInflater;
-import android.view.MenuItem;
 import android.view.View;
 import android.view.View.OnClickListener;
 
-public class MyActivity extends Activity {
+import com.actionbarsherlock.app.SherlockActivity;
+
+public class MyActivity extends SherlockActivity {
 	
 	protected Bitbeaker bitbeaker;
 	protected ProgressDialog progressDialog;
 		}
 	};
 	
-	public boolean onCreateOptionsMenu(Menu menu) {
-	    MenuInflater inflater = getMenuInflater();
-	    inflater.inflate(R.menu.mainmenu, menu);
-	    return true;
-	}
-	
-	@Override
-	public boolean onOptionsItemSelected(MenuItem item) {
-	    // Handle item selection
-	    switch (item.getItemId()) {
-	    case R.id.menu_refresh:
-	        bitbeaker.clearKV();
-	        return true;
-	    case R.id.menu_logout:
-	    	Intent intent = new Intent(this, LoginActivity.class);
-			Bundle b = new Bundle();
-			b.putBoolean("logout", true);
-			intent.putExtras(b);
-			startActivity(intent);
-			finish();
-			return true;
-	    default:
-	        return super.onOptionsItemSelected(item);
-	    }
-	}
+//	public boolean onCreateOptionsMenu(Menu menu) {
+//	    MenuInflater inflater = getMenuInflater();
+//	    inflater.inflate(R.menu.mainmenu, menu);
+//	    return true;
+//	}
+//	
+//	@Override
+//	public boolean onOptionsItemSelected(MenuItem item) {
+//	    // Handle item selection
+//	    switch (item.getItemId()) {
+//	    case R.id.menu_refresh:
+//	        bitbeaker.clearKV();
+//	        return true;
+//	    case R.id.menu_logout:
+//	    	Intent intent = new Intent(this, LoginActivity.class);
+//			Bundle b = new Bundle();
+//			b.putBoolean("logout", true);
+//			intent.putExtras(b);
+//			startActivity(intent);
+//			finish();
+//			return true;
+//	    default:
+//	        return super.onOptionsItemSelected(item);
+//	    }
+//	}
 	
 	protected void AsyncLoaderDone(String result) {
 		Log.d("RESULT", result);

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

View file
  • Ignore whitespace
 import org.json.JSONException;
 import org.json.JSONObject;
 
+import com.actionbarsherlock.app.ActionBar;
+
 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.ImageButton;
 import android.widget.ListView;
 import android.widget.TextView;
 
 	
     @Override
     public void onCreate(Bundle savedInstanceState) {
+    	setTheme(R.style.Theme_Sherlock_Light);
         super.onCreate(savedInstanceState);
         
         setContentView(R.layout.repositories);
-        ImageButton search = (ImageButton) findViewById(R.id.bt_search);
-        search.setVisibility(ImageButton.VISIBLE);
-        search.setOnClickListener(searchClickListener);
+//        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/");
         progressDialog = ProgressDialog.show(this, "", "Loading ...", true);
+        getSupportActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
     }
     
     protected void AsyncLoaderDone(String result){

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

View file
  • Ignore whitespace
 import android.app.ProgressDialog;
 import android.content.Intent;
 import android.os.Bundle;
-import android.text.Html;
 import android.util.Log;
 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 RepositoryActivity extends MyActivity {
-    
-	private String slug;
-	private String owner;
-	private String scm;
+import com.actionbarsherlock.view.Menu;
+import com.actionbarsherlock.view.MenuItem;
+
+public class RepositoryActivity extends RepositoryBaseActivity {
 	private Boolean firstCall;
 	
     public void onCreate(Bundle savedInstanceState) {
+    	setTheme(R.style.Theme_Sherlock_Light);
         super.onCreate(savedInstanceState);
         setContentView(R.layout.repository);
         Bundle b = getIntent().getExtras();
         progressDialog = ProgressDialog.show(this, "", "Loading ...", true);
     }
     
-	private OnClickListener sourceBrowserClickListener = new OnClickListener() {
-		public void onClick(View v) {
-	    	Intent intent = new Intent(v.getContext(), SourceBrowserActivity.class);
-			Bundle b = new Bundle();
-			b.putString("slug", slug);
-			b.putString("owner", owner);
-			b.putString("scm", scm);
-			b.putString("subdir", "/");
-			intent.putExtras(b);
-			v.getContext().startActivity(intent);
-		}
-	};
-	
-	private OnClickListener wikiBrowserClickListener = new OnClickListener() {
-		public void onClick(View v) {
-	    	Intent intent = new Intent(v.getContext(), WikiActivity.class);
-			Bundle b = new Bundle();
-			b.putString("slug", slug);
-			b.putString("owner", owner);
-			intent.putExtras(b);
-			v.getContext().startActivity(intent);
-		}
-	};
-	
-	private OnClickListener issuesBrowserClickListener = new OnClickListener() {
-		public void onClick(View v) {
-	    	Intent intent = new Intent(v.getContext(), IssuesActivity.class);
-			Bundle b = new Bundle();
-			b.putString("slug", slug);
-			b.putString("owner", owner);
-			intent.putExtras(b);
-			v.getContext().startActivity(intent);
-		}
-	};
-	
+    @Override
+    public boolean onCreateOptionsMenu(Menu menu) {
+        //Used to put dark icons on light action bar
+        menu.add("Search")
+        	.setIcon(R.drawable.ic_menu_search_holo_dark)
+            .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
+
+        return true;
+    }
+
+    @Override
+	protected void onStart() {
+        setUpActionBar(0);
+		super.onStart();
+	}
+
 	private JSONArray reverse(JSONArray a) throws JSONException{
 		JSONArray _a = new JSONArray();
 		for(int i = a.length()-1; i >= 0; i--){
 		super.AsyncLoaderDone(result);
 		if(firstCall){
 			firstCall = false;
-			Button sourceBrowser = (Button) findViewById(R.id.bt_source_browser);
-			sourceBrowser.setOnClickListener(sourceBrowserClickListener);
+//			Button sourceBrowser = (Button) findViewById(R.id.bt_source_browser);
+//			sourceBrowser.setOnClickListener(sourceBrowserClickListener);
+//			
+//			Button wiki = (Button) findViewById(R.id.bt_wiki);
+//			wiki.setOnClickListener(wikiBrowserClickListener);
+//			
+//			Button issues = (Button) findViewById(R.id.bt_issues);
+//			issues.setOnClickListener(issuesBrowserClickListener);
 			
-			Button wiki = (Button) findViewById(R.id.bt_wiki);
-			wiki.setOnClickListener(wikiBrowserClickListener);
-			
-			Button issues = (Button) findViewById(R.id.bt_issues);
-			issues.setOnClickListener(issuesBrowserClickListener);
-			
-			TextView name = (TextView) findViewById(R.id.header_title);
-			TextView description = (TextView) findViewById(R.id.repository_description);
-			
-			ImageView icon = (ImageView) findViewById(R.id.icon);
+//			TextView name = (TextView) findViewById(R.id.header_title);
+//			TextView description = (TextView) findViewById(R.id.repository_description);
+//			
+//			ImageView icon = (ImageView) findViewById(R.id.icon);
 			
 			try {
 				JSONObject jsonObject = new JSONObject(result);
-				if(jsonObject.has("has_wiki") && jsonObject.getBoolean("has_wiki")) wiki.setEnabled(true);
-				else wiki.setEnabled(false);
-				if(jsonObject.has("has_issues") && jsonObject.getBoolean("has_issues")) issues.setEnabled(true);
-				else issues.setEnabled(false);
-				name.setText(jsonObject.getString("name"));
+//				if(jsonObject.has("has_wiki") && jsonObject.getBoolean("has_wiki")) wiki.setEnabled(true);
+//				else wiki.setEnabled(false);
+//				if(jsonObject.has("has_issues") && jsonObject.getBoolean("has_issues")) issues.setEnabled(true);
+//				else issues.setEnabled(false);
+//				name.setText(jsonObject.getString("name"));
 				String desc = "<b>" + jsonObject.getString("owner") + " / " + jsonObject.getString("slug") + "</b>";
 				if(!jsonObject.getString("description").trim().equals("")) desc += "<br>" + jsonObject.getString("description");
-				if(!jsonObject.getString("website").trim().equals("") && !jsonObject.getString("website").trim().equals("null")) desc += "<br><a href='"+ jsonObject.getString("website") +"'>" + jsonObject.getString("website") + "</a>";
-				description.setText(Html.fromHtml(desc));
-				if(jsonObject.getString("logo") != "null"){
-					AsyncImageLoader imgLoader = new AsyncImageLoader(icon);
-					imgLoader.execute(jsonObject.getString("logo"));
-				}
+//				if(!jsonObject.getString("website").trim().equals("") && !jsonObject.getString("website").trim().equals("null")) desc += "<br><a href='"+ jsonObject.getString("website") +"'>" + jsonObject.getString("website") + "</a>";
+//				description.setText(Html.fromHtml(desc));
+//				if(jsonObject.getString("logo") != "null"){
+//					AsyncImageLoader imgLoader = new AsyncImageLoader(icon);
+//					imgLoader.execute(jsonObject.getString("logo"));
+//				}
 			} catch (JSONException e) {
 				// TODO Auto-generated catch block
 				e.printStackTrace();

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

View file
  • Ignore whitespace
+package com.saibotd.bitbeaker;
+
+import android.content.Intent;
+import android.os.Bundle;
+import android.widget.ArrayAdapter;
+
+import com.actionbarsherlock.app.ActionBar;
+import com.actionbarsherlock.app.ActionBar.OnNavigationListener;
+import com.actionbarsherlock.view.MenuItem;
+
+public class RepositoryBaseActivity extends MyActivity implements OnNavigationListener{
+	protected String slug = null; 
+	protected String owner = null; 
+	protected String scm = null;
+	
+	protected void setUpActionBar(int item){
+        ArrayAdapter<CharSequence> list = ArrayAdapter.createFromResource(this, R.array.locations, R.layout.sherlock_spinner_item);
+        list.setDropDownViewResource(R.layout.sherlock_spinner_dropdown_item);
+        getSupportActionBar().setListNavigationCallbacks(list, this);
+        getSupportActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
+        getSupportActionBar().setSelectedNavigationItem(item);
+        getSupportActionBar().setDisplayShowTitleEnabled(false);
+        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
+	}
+
+    @Override
+	public boolean onOptionsItemSelected(MenuItem item) {
+    	switch(item.getOrder()){
+    	case 0:
+    		onSearchRequested();
+    		return true;
+    	case 1:
+    		if (this.getClass().equals(RepositoryActivity.class)
+    				|| this.getClass().equals(SourceBrowserActivity.class)
+    				|| this.getClass().equals(IssuesActivity.class)
+    				|| this.getClass().equals(WikiActivity.class)){
+    			startActivity(new Intent(this, RepositoriesActivity.class));
+    		} else {
+        		onBackPressed();
+    		}
+    		return true;
+    	}
+		return super.onOptionsItemSelected(item);
+	}
+
+    @Override
+    public boolean onNavigationItemSelected(int itemPosition, long itemId) {
+		Intent intent = new Intent();
+    	Bundle b = new Bundle();
+    	if (slug != null) {
+    		b.putString("slug", slug);
+    	}
+    	if (owner != null) {
+    		b.putString("owner", owner);
+    	}
+    	if (scm != null) {
+    		b.putString("scm", scm);
+    	}
+    	switch(itemPosition){
+    	case 0:
+    		if (!this.getClass().equals(RepositoryActivity.class)){
+    	    	intent.setClass(this, RepositoryActivity.class);
+    	    	intent.putExtras(b);
+    			startActivity(intent);
+    		}
+    		break;
+    	case 1:
+    		if (!this.getClass().equals(SourceBrowserActivity.class)){
+        		intent.setClass(this, SourceBrowserActivity.class);
+    			b.putString("subdir", "/");
+    			intent.putExtras(b);
+    			startActivity(intent);
+    		}
+			break;
+    	case 2:
+    		if (!this.getClass().equals(WikiActivity.class)){
+    	    	intent.setClass(this, WikiActivity.class);
+    			intent.putExtras(b);
+    			startActivity(intent);
+    		}
+			break;
+    	case 3:
+    		if (!this.getClass().equals(IssuesActivity.class)){
+    	    	intent.setClass(this, IssuesActivity.class);
+    			intent.putExtras(b);
+    			startActivity(intent);
+    		}
+			break;
+    	}
+        return true;
+	}
+}

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

View file
  • Ignore whitespace
 import android.webkit.JsResult;
 import android.webkit.WebChromeClient;
 import android.webkit.WebView;
-import android.widget.TextView;
 
-public class SourceActivity extends MyActivity {
-    
-	private String slug;
-	private String scm;	
-	private String owner;
+public class SourceActivity extends RepositoryBaseActivity {
 	private String file;
 	private String code;
 	
     public void onCreate(Bundle savedInstanceState) {
+    	setTheme(R.style.Theme_Sherlock_Light);
         super.onCreate(savedInstanceState);
         setContentView(R.layout.source);
         Bundle b = getIntent().getExtras();
         AsyncLoader asyncLoader = new AsyncLoader();
         if(scm.equals("git")) asyncLoader.execute("https://api.bitbucket.org/1.0/repositories/"+ owner +"/"+slug+"/raw/master" + file);
         else asyncLoader.execute("https://api.bitbucket.org/1.0/repositories/"+ owner +"/"+slug+"/raw/tip" + file);
-        ((TextView) findViewById(R.id.header_title)).setText(slug + file);
+//        ((TextView) findViewById(R.id.header_title)).setText(slug + file);
     }
 	
+	@Override
+	protected void onStart() {
+        setUpActionBar(1);
+		super.onStart();
+	}
+
 	public void AsyncLoaderDone(String result) {
 		super.AsyncLoaderDone(result);
 		code = TextUtils.htmlEncode(result.replace("\t", "  "));

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

View file
  • Ignore whitespace
 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;
 import android.widget.ListView;
 import android.widget.TextView;
 
-public class SourceBrowserActivity extends MyActivity {
-	
-	private String slug;
-	private String scm;
-	private String owner;
+public class SourceBrowserActivity extends RepositoryBaseActivity {
 	private String subdir;
 	
     @Override
     public void onCreate(Bundle savedInstanceState) {
+    	setTheme(R.style.Theme_Sherlock_Light);
         super.onCreate(savedInstanceState);
         Bundle b = getIntent().getExtras();
         slug = b.getString("slug");
         subdir = b.getString("subdir");
         //setListAdapter(new SourceBrowserAdapter(this, slug, owner, subdir));
         setContentView(R.layout.repositories);
-        ((TextView) findViewById(R.id.header_title)).setText(slug + subdir);
+//        ((TextView) findViewById(R.id.header_title)).setText(slug + subdir);
         AsyncLoader asyncLoader = new AsyncLoader();
         if(scm.equals("git")) asyncLoader.execute("https://api.bitbucket.org/1.0/repositories/" + owner + "/"+slug+"/src/master" + subdir);
         else asyncLoader.execute("https://api.bitbucket.org/1.0/repositories/" + owner + "/"+slug+"/src/tip" + subdir);
         progressDialog = ProgressDialog.show(this, "", "Loading ...", true);
     }
     
+	@Override
+	protected void onStart() {
+        setUpActionBar(1);
+		super.onStart();
+	}
+
     protected void AsyncLoaderDone(String result) {
     	super.AsyncLoaderDone(result);
     	JSONArray jsonArray = new JSONArray();

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

View file
  • Ignore whitespace
 import android.webkit.WebViewClient;
 import android.widget.TextView;
 
-public class WikiActivity extends MyActivity {
+public class WikiActivity extends RepositoryBaseActivity {
     
-	private String slug;
-	private String owner;
 	private String data; 
 	
     public void onCreate(Bundle savedInstanceState) {
+    	setTheme(R.style.Theme_Sherlock_Light);
         super.onCreate(savedInstanceState);
         setContentView(R.layout.wiki);
         Bundle b = getIntent().getExtras();
         slug = b.getString("slug");
         owner = b.getString("owner");
         progressDialog = ProgressDialog.show(this, "", "Loading ...", true);
-        ((TextView) findViewById(R.id.header_title)).setText(slug + "/wiki");
+//        ((TextView) findViewById(R.id.header_title)).setText(slug + "/wiki");
         AsyncLoader asyncLoader = new AsyncLoader();
         asyncLoader.execute("https://api.bitbucket.org/1.0/repositories/"+ owner +"/"+ slug +"/wiki/");
     }
+    
+	@Override
+	protected void onStart() {
+        setUpActionBar(2);
+		super.onStart();
+	}
 
 	public void AsyncLoaderDone(String result) {
 		super.AsyncLoaderDone(result);