Skip to content

Instantly share code, notes, and snippets.

@gsathya
Created September 2, 2011 15:04
Show Gist options
  • Save gsathya/1188853 to your computer and use it in GitHub Desktop.
Save gsathya/1188853 to your computer and use it in GitHub Desktop.
GSoC work on Orbot
commit c732680861e7f9f8a6983c21d5eeaf0bd3c5491a
Author: Sathyanarayanan Gunasekaran <gsathya.ceg@gmail.com>
Date: Sat Aug 13 14:40:19 2011 +0530
Added progress bar dialog + new home screen
diff --git a/bin/BlipTVUploader.apk b/bin/BlipTVUploader.apk
index 37b1515..c81658b 100644
Binary files a/bin/BlipTVUploader.apk and b/bin/BlipTVUploader.apk differ
diff --git a/bin/classes.dex b/bin/classes.dex
index df76b9c..b5155ce 100644
Binary files a/bin/classes.dex and b/bin/classes.dex differ
diff --git a/bin/com/apress/proandroidmedia/ch12/blipuploader/BlipTVUploader$BlipResponseXMLHandler.class b/bin/com/apress/proandroidmedia/ch12/blipuploader/BlipTVUploader$BlipResponseXMLHandler.class
index 87f05b6..add968f 100644
Binary files a/bin/com/apress/proandroidmedia/ch12/blipuploader/BlipTVUploader$BlipResponseXMLHandler.class and b/bin/com/apress/proandroidmedia/ch12/blipuploader/BlipTVUploader$BlipResponseXMLHandler.class differ
diff --git a/bin/com/apress/proandroidmedia/ch12/blipuploader/BlipTVUploader$BlipTVFilePoster.class b/bin/com/apress/proandroidmedia/ch12/blipuploader/BlipTVUploader$BlipTVFilePoster.class
index d0afc09..1487f53 100644
Binary files a/bin/com/apress/proandroidmedia/ch12/blipuploader/BlipTVUploader$BlipTVFilePoster.class and b/bin/com/apress/proandroidmedia/ch12/blipuploader/BlipTVUploader$BlipTVFilePoster.class differ
diff --git a/bin/com/apress/proandroidmedia/ch12/blipuploader/BlipTVUploader$ProgressMultipartEntity.class b/bin/com/apress/proandroidmedia/ch12/blipuploader/BlipTVUploader$ProgressMultipartEntity.class
index d5dcaa7..1cd9b58 100644
Binary files a/bin/com/apress/proandroidmedia/ch12/blipuploader/BlipTVUploader$ProgressMultipartEntity.class and b/bin/com/apress/proandroidmedia/ch12/blipuploader/BlipTVUploader$ProgressMultipartEntity.class differ
diff --git a/bin/com/apress/proandroidmedia/ch12/blipuploader/BlipTVUploader$ProgressOutputStream.class b/bin/com/apress/proandroidmedia/ch12/blipuploader/BlipTVUploader$ProgressOutputStream.class
index 4388e23..c280f4e 100644
Binary files a/bin/com/apress/proandroidmedia/ch12/blipuploader/BlipTVUploader$ProgressOutputStream.class and b/bin/com/apress/proandroidmedia/ch12/blipuploader/BlipTVUploader$ProgressOutputStream.class differ
diff --git a/bin/com/apress/proandroidmedia/ch12/blipuploader/BlipTVUploader.class b/bin/com/apress/proandroidmedia/ch12/blipuploader/BlipTVUploader.class
index b764dbb..1887711 100644
Binary files a/bin/com/apress/proandroidmedia/ch12/blipuploader/BlipTVUploader.class and b/bin/com/apress/proandroidmedia/ch12/blipuploader/BlipTVUploader.class differ
diff --git a/bin/com/apress/proandroidmedia/ch12/blipuploader/R$drawable.class b/bin/com/apress/proandroidmedia/ch12/blipuploader/R$drawable.class
index 7e0596c..95cd384 100644
Binary files a/bin/com/apress/proandroidmedia/ch12/blipuploader/R$drawable.class and b/bin/com/apress/proandroidmedia/ch12/blipuploader/R$drawable.class differ
diff --git a/bin/com/apress/proandroidmedia/ch12/blipuploader/R$id.class b/bin/com/apress/proandroidmedia/ch12/blipuploader/R$id.class
index a1e7c01..cf958b4 100644
Binary files a/bin/com/apress/proandroidmedia/ch12/blipuploader/R$id.class and b/bin/com/apress/proandroidmedia/ch12/blipuploader/R$id.class differ
diff --git a/bin/com/apress/proandroidmedia/ch12/blipuploader/R$layout.class b/bin/com/apress/proandroidmedia/ch12/blipuploader/R$layout.class
index a8b8889..078b33b 100644
Binary files a/bin/com/apress/proandroidmedia/ch12/blipuploader/R$layout.class and b/bin/com/apress/proandroidmedia/ch12/blipuploader/R$layout.class differ
diff --git a/bin/com/apress/proandroidmedia/ch12/blipuploader/R$string.class b/bin/com/apress/proandroidmedia/ch12/blipuploader/R$string.class
index f5ab7d7..89c11bb 100644
Binary files a/bin/com/apress/proandroidmedia/ch12/blipuploader/R$string.class and b/bin/com/apress/proandroidmedia/ch12/blipuploader/R$string.class differ
diff --git a/bin/resources.ap_ b/bin/resources.ap_
index 23b501a..380bc3d 100644
Binary files a/bin/resources.ap_ and b/bin/resources.ap_ differ
diff --git a/gen/com/apress/proandroidmedia/ch12/blipuploader/R.java b/gen/com/apress/proandroidmedia/ch12/blipuploader/R.java
index c032e55..8ef4a11 100644
--- a/gen/com/apress/proandroidmedia/ch12/blipuploader/R.java
+++ b/gen/com/apress/proandroidmedia/ch12/blipuploader/R.java
@@ -11,15 +11,21 @@ public final class R {
public static final class attr {
}
public static final class drawable {
- public static final int icon=0x7f020000;
+ public static final int ic_camera=0x7f020000;
+ public static final int ic_gallery=0x7f020001;
+ public static final int ic_ssc=0x7f020002;
+ public static final int icon=0x7f020003;
+ public static final int sscbg=0x7f020004;
}
public static final class id {
+ public static final int FrameLayout=0x7f050003;
public static final int captureVideo=0x7f050002;
public static final int selectVideo=0x7f050001;
public static final int textview=0x7f050000;
}
public static final class layout {
public static final int main=0x7f030000;
+ public static final int mainmenu=0x7f030001;
}
public static final class string {
public static final int app_name=0x7f040001;
diff --git a/res/drawable-hdpi/ic_camera.png b/res/drawable-hdpi/ic_camera.png
new file mode 100644
index 0000000..8dd5618
Binary files /dev/null and b/res/drawable-hdpi/ic_camera.png differ
diff --git a/res/drawable-hdpi/ic_gallery.png b/res/drawable-hdpi/ic_gallery.png
new file mode 100644
index 0000000..6ac4945
Binary files /dev/null and b/res/drawable-hdpi/ic_gallery.png differ
diff --git a/res/drawable/ic_ssc.png b/res/drawable/ic_ssc.png
new file mode 100644
index 0000000..2d98eea
Binary files /dev/null and b/res/drawable/ic_ssc.png differ
diff --git a/res/drawable/sscbg.jpg b/res/drawable/sscbg.jpg
new file mode 100644
index 0000000..dd73efd
Binary files /dev/null and b/res/drawable/sscbg.jpg differ
diff --git a/res/layout/main.xml b/res/layout/main.xml
deleted file mode 100644
index 267d4df..0000000
--- a/res/layout/main.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-<?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"
- >
-<TextView
- android:id="@+id/textview"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:text=""
- />
-<Button android:text="Select Video" android:id="@+id/selectVideo" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>
-<Button android:text="Capture Video" android:id="@+id/captureVideo" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>
-</LinearLayout>
diff --git a/res/layout/mainmenu.xml b/res/layout/mainmenu.xml
new file mode 100644
index 0000000..ec77d60
--- /dev/null
+++ b/res/layout/mainmenu.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:background="@drawable/sscbg" android:id="@+id/FrameLayout" android:layout_width="fill_parent" android:layout_height="fill_parent">
+ <LinearLayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent">
+
+ <ImageView android:src="@drawable/ic_ssc" android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:gravity="center_horizontal"
+
+ />
+
+ <LinearLayout android:orientation="horizontal" android:gravity="center_horizontal" android:layout_width="fill_parent" android:layout_height="fill_parent">
+
+ <Button android:id="@+id/captureVideo"
+ android:text="Capture Video"
+ android:layout_width="150dp"
+ android:layout_height="90dp"
+ android:drawableTop="@drawable/ic_camera">
+ </Button>
+ <Button android:id="@+id/selectVideo"
+ android:text="Select Video"
+ android:layout_width="150dp"
+ android:layout_height="90dp"
+ android:drawableTop="@drawable/ic_gallery">
+ </Button>
+ </LinearLayout>
+
+ </LinearLayout>
+</FrameLayout>
\ No newline at end of file
diff --git a/src/com/apress/proandroidmedia/ch12/blipuploader/BlipTVUploader.java b/src/com/apress/proandroidmedia/ch12/blipuploader/BlipTVUploader.java
index 9594ab6..6984b52 100644
--- a/src/com/apress/proandroidmedia/ch12/blipuploader/BlipTVUploader.java
+++ b/src/com/apress/proandroidmedia/ch12/blipuploader/BlipTVUploader.java
@@ -28,6 +28,10 @@ import org.xml.sax.XMLReader;
import org.xml.sax.helpers.DefaultHandler;
import android.app.Activity;
+import android.app.AlertDialog;
+import android.app.ProgressDialog;
+import android.content.Context;
+import android.content.DialogInterface;
import android.content.Intent;
import android.database.Cursor;
import android.net.Uri;
@@ -58,16 +62,17 @@ public class BlipTVUploader extends Activity implements OnClickListener {
long fileLength = 0;
- TextView textview;
Button selectVideo;
Button captureVideo;
+ Context context = this;
+ ProgressDialog dialog;
+
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- setContentView(R.layout.main);
+ setContentView(R.layout.mainmenu);
- textview = (TextView) findViewById(R.id.textview);
selectVideo = (Button) findViewById(R.id.selectVideo);
captureVideo = (Button) findViewById(R.id.captureVideo);
selectVideo.setOnClickListener(this);
@@ -140,7 +145,16 @@ public class BlipTVUploader extends Activity implements OnClickListener {
ProgressListener, BlipXMLParserListener {
String videoUrl;
-
+
+ protected void onPreExecute(){
+
+ dialog = new ProgressDialog(context);
+ dialog.setMessage("Uploading..");
+ dialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
+ dialog.setCancelable(false);
+ dialog.setProgress(0);
+ dialog.show();
+ }
@Override
protected Void doInBackground(Void... params) {
@@ -200,25 +214,29 @@ public class BlipTVUploader extends Activity implements OnClickListener {
return null;
}
-
- protected void onProgressUpdate(String... textToDisplay) {
- textview.setText(textToDisplay[0]);
- }
-
+
protected void onPostExecute(Void result) {
- if (videoUrl != null) {
- Intent viewVideoIntent = new Intent(Intent.ACTION_VIEW);
- Uri uri = Uri.parse("http://blip.tv/file/get/" + videoUrl);
- viewVideoIntent.setDataAndType(uri, "video/3gpp");
- startActivityForResult(viewVideoIntent, VIDEO_PLAYED);
- }
+
+ //Dismiss progressbar dialog
+ dialog.dismiss();
+
+ //Display alert dialog
+ String msg = null;
+ msg = "Your video has been uploaded.";
+
+ new AlertDialog.Builder(context)
+ .setPositiveButton("OK", null)
+ .setMessage(msg)
+ .show();
}
public void transferred(long num) {
double percent = (double) num / (double) fileLength;
int percentInt = (int) (percent * 100);
-
- publishProgress("" + percentInt + "% Transferred");
+
+ //Update progressbar dialog
+ dialog.setProgress(percentInt);
+
}
public void parseResult(String result) {
commit c5e3527923bd7bd96002b042b661de7b1b89da85
Author: Sathyanarayanan Gunasekaran <gsathya.ceg@gmail.com>
Date: Sat Aug 13 08:17:11 2011 +0530
updated .apk in /bin
diff --git a/.DS_Store b/.DS_Store
index 20ca88d..41ec140 100644
Binary files a/.DS_Store and b/.DS_Store differ
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..cb5b286
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,2 @@
+.DS_Store
+.class
diff --git a/bin/BlipTVUploader.apk b/bin/BlipTVUploader.apk
index ce1db00..37b1515 100644
Binary files a/bin/BlipTVUploader.apk and b/bin/BlipTVUploader.apk differ
diff --git a/bin/classes.dex b/bin/classes.dex
index 67a9cb1..df76b9c 100644
Binary files a/bin/classes.dex and b/bin/classes.dex differ
diff --git a/bin/com/apress/proandroidmedia/ch12/blipuploader/BlipTVUploader$BlipResponseXMLHandler.class b/bin/com/apress/proandroidmedia/ch12/blipuploader/BlipTVUploader$BlipResponseXMLHandler.class
index f00be62..87f05b6 100644
Binary files a/bin/com/apress/proandroidmedia/ch12/blipuploader/BlipTVUploader$BlipResponseXMLHandler.class and b/bin/com/apress/proandroidmedia/ch12/blipuploader/BlipTVUploader$BlipResponseXMLHandler.class differ
diff --git a/bin/com/apress/proandroidmedia/ch12/blipuploader/BlipTVUploader$BlipTVFilePoster.class b/bin/com/apress/proandroidmedia/ch12/blipuploader/BlipTVUploader$BlipTVFilePoster.class
index 872a1d0..d0afc09 100644
Binary files a/bin/com/apress/proandroidmedia/ch12/blipuploader/BlipTVUploader$BlipTVFilePoster.class and b/bin/com/apress/proandroidmedia/ch12/blipuploader/BlipTVUploader$BlipTVFilePoster.class differ
diff --git a/bin/com/apress/proandroidmedia/ch12/blipuploader/BlipTVUploader$ProgressMultipartEntity.class b/bin/com/apress/proandroidmedia/ch12/blipuploader/BlipTVUploader$ProgressMultipartEntity.class
index 02e0bd2..d5dcaa7 100644
Binary files a/bin/com/apress/proandroidmedia/ch12/blipuploader/BlipTVUploader$ProgressMultipartEntity.class and b/bin/com/apress/proandroidmedia/ch12/blipuploader/BlipTVUploader$ProgressMultipartEntity.class differ
diff --git a/bin/com/apress/proandroidmedia/ch12/blipuploader/BlipTVUploader$ProgressOutputStream.class b/bin/com/apress/proandroidmedia/ch12/blipuploader/BlipTVUploader$ProgressOutputStream.class
index e25cd89..4388e23 100644
Binary files a/bin/com/apress/proandroidmedia/ch12/blipuploader/BlipTVUploader$ProgressOutputStream.class and b/bin/com/apress/proandroidmedia/ch12/blipuploader/BlipTVUploader$ProgressOutputStream.class differ
diff --git a/bin/com/apress/proandroidmedia/ch12/blipuploader/BlipTVUploader.class b/bin/com/apress/proandroidmedia/ch12/blipuploader/BlipTVUploader.class
index d6da2db..b764dbb 100644
Binary files a/bin/com/apress/proandroidmedia/ch12/blipuploader/BlipTVUploader.class and b/bin/com/apress/proandroidmedia/ch12/blipuploader/BlipTVUploader.class differ
diff --git a/bin/com/apress/proandroidmedia/ch12/blipuploader/R$id.class b/bin/com/apress/proandroidmedia/ch12/blipuploader/R$id.class
index 793ef20..a1e7c01 100644
Binary files a/bin/com/apress/proandroidmedia/ch12/blipuploader/R$id.class and b/bin/com/apress/proandroidmedia/ch12/blipuploader/R$id.class differ
diff --git a/bin/com/apress/proandroidmedia/ch12/blipuploader/R$layout.class b/bin/com/apress/proandroidmedia/ch12/blipuploader/R$layout.class
index c289425..a8b8889 100644
Binary files a/bin/com/apress/proandroidmedia/ch12/blipuploader/R$layout.class and b/bin/com/apress/proandroidmedia/ch12/blipuploader/R$layout.class differ
diff --git a/bin/com/apress/proandroidmedia/ch12/blipuploader/R$string.class b/bin/com/apress/proandroidmedia/ch12/blipuploader/R$string.class
index 79f4bbf..f5ab7d7 100644
Binary files a/bin/com/apress/proandroidmedia/ch12/blipuploader/R$string.class and b/bin/com/apress/proandroidmedia/ch12/blipuploader/R$string.class differ
diff --git a/bin/resources.ap_ b/bin/resources.ap_
index 3b96378..23b501a 100644
Binary files a/bin/resources.ap_ and b/bin/resources.ap_ differ
diff --git a/gen/com/apress/proandroidmedia/ch12/blipuploader/R.java b/gen/com/apress/proandroidmedia/ch12/blipuploader/R.java
index 26c4561..c032e55 100644
--- a/gen/com/apress/proandroidmedia/ch12/blipuploader/R.java
+++ b/gen/com/apress/proandroidmedia/ch12/blipuploader/R.java
@@ -14,6 +14,8 @@ public final class R {
public static final int icon=0x7f020000;
}
public static final class id {
+ public static final int captureVideo=0x7f050002;
+ public static final int selectVideo=0x7f050001;
public static final int textview=0x7f050000;
}
public static final class layout {
commit f45c01937394458fb37ac574432266377c4fef54
Author: Sathyanarayanan Gunasekaran <gsathya.ceg@gmail.com>
Date: Sat Aug 13 08:15:03 2011 +0530
Added option to select video from SDCard
diff --git a/res/layout/main.xml b/res/layout/main.xml
index a341923..267d4df 100644
--- a/res/layout/main.xml
+++ b/res/layout/main.xml
@@ -10,4 +10,6 @@
android:layout_height="wrap_content"
android:text=""
/>
+<Button android:text="Select Video" android:id="@+id/selectVideo" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>
+<Button android:text="Capture Video" android:id="@+id/captureVideo" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>
</LinearLayout>
diff --git a/src/com/apress/proandroidmedia/ch12/blipuploader/BlipTVUploader.java b/src/com/apress/proandroidmedia/ch12/blipuploader/BlipTVUploader.java
index 79b64a2..9594ab6 100644
--- a/src/com/apress/proandroidmedia/ch12/blipuploader/BlipTVUploader.java
+++ b/src/com/apress/proandroidmedia/ch12/blipuploader/BlipTVUploader.java
@@ -34,14 +34,20 @@ import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.widget.Button;
import android.widget.TextView;
+import android.widget.Toast;
-public class BlipTVUploader extends Activity {
+public class BlipTVUploader extends Activity implements OnClickListener {
final static int VIDEO_CAPTURED = 0;
final static int VIDEO_PLAYED = 1;
+ private static final int GALLERY_RESULT = 2;
File videoFile;
+ String TAG = "BlipTVUploader";
String title = "A Video";
String username = "bliptest123";
String password = "bliptest123";
@@ -53,40 +59,79 @@ public class BlipTVUploader extends Activity {
long fileLength = 0;
TextView textview;
-
+ Button selectVideo;
+ Button captureVideo;
+
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
textview = (TextView) findViewById(R.id.textview);
+ selectVideo = (Button) findViewById(R.id.selectVideo);
+ captureVideo = (Button) findViewById(R.id.captureVideo);
+ selectVideo.setOnClickListener(this);
+ captureVideo.setOnClickListener(this);
+
- Intent captureVideoIntent = new Intent(
- android.provider.MediaStore.ACTION_VIDEO_CAPTURE);
- startActivityForResult(captureVideoIntent, VIDEO_CAPTURED);
+
}
-
+
+ public void onClick(View v){
+
+ if(v == captureVideo){
+ Intent captureVideoIntent = new Intent(
+ android.provider.MediaStore.ACTION_VIDEO_CAPTURE);
+ startActivityForResult(captureVideoIntent, VIDEO_CAPTURED);
+ }
+ else if(v == selectVideo){
+ Intent i = new Intent(Intent.ACTION_GET_CONTENT, android.provider.MediaStore.Video.Media.EXTERNAL_CONTENT_URI);
+ startActivityForResult(i, GALLERY_RESULT);
+ }
+ }
+
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
- if (resultCode == RESULT_OK && requestCode == VIDEO_CAPTURED) {
- Uri videoFileUri = data.getData();
-
- String[] columns = { android.provider.MediaStore.Video.Media.DATA };
- Cursor cursor = managedQuery(videoFileUri, columns, null, null,
- null);
- int fileColumn = cursor
- .getColumnIndexOrThrow(android.provider.MediaStore.Video.Media.DATA);
- if (cursor.moveToFirst()) {
- String videoFilePath = cursor.getString(fileColumn);
- Log.v("VIDEO FILE PATH", videoFilePath);
-
- videoFile = new File(videoFilePath);
- fileLength = videoFile.length();
- BlipTVFilePoster btvfp = new BlipTVFilePoster();
- btvfp.execute();
+ if (resultCode == RESULT_OK)
+ {
+ String videoFilePath = null;
+ Uri videoFileUri = null;
+ if(requestCode == VIDEO_CAPTURED) {
+ videoFileUri = data.getData();
+
+ String[] columns = { android.provider.MediaStore.Video.Media.DATA };
+ Cursor cursor = managedQuery(videoFileUri, columns, null, null,
+ null);
+ int fileColumn = cursor
+ .getColumnIndexOrThrow(android.provider.MediaStore.Video.Media.DATA);
+ if (cursor.moveToFirst()) {
+ videoFilePath = cursor.getString(fileColumn);
+ Log.d(TAG,"CAPTURED VIDEO FILE PATH"+videoFilePath);
+
+
+ }
+
+ }
+ else if(requestCode == GALLERY_RESULT){
+ videoFileUri = data.getData();
+
+ String[] columns = { android.provider.MediaStore.Video.Media.DATA };
+ Cursor cursor = managedQuery(videoFileUri, columns, null, null,
+ null);
+ int fileColumn = cursor
+ .getColumnIndexOrThrow(android.provider.MediaStore.Video.Media.DATA);
+ if (cursor.moveToFirst()) {
+ videoFilePath = cursor.getString(fileColumn);
+ Log.v(TAG,"SELECTED VIDEO FILE PATH"+videoFilePath);
+ }
}
-
- } else if (requestCode == VIDEO_PLAYED) {
+
+ videoFile = new File(videoFilePath);
+ fileLength = videoFile.length();
+ BlipTVFilePoster btvfp = new BlipTVFilePoster();
+ btvfp.execute();
+ }
+ else if (requestCode == VIDEO_PLAYED) {
finish();
}
}
@@ -100,7 +145,7 @@ public class BlipTVUploader extends Activity {
protected Void doInBackground(Void... params) {
HttpClient httpclient = new DefaultHttpClient();
- HttpPost httppost = new HttpPost("http://xl6dxqeq7qw3gqgf.onion/file/post");
+ HttpPost httppost = new HttpPost("http://blip.tv/file/post");
HttpHost proxy = new HttpHost(host, port);
httpclient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy);
@@ -163,7 +208,7 @@ public class BlipTVUploader extends Activity {
protected void onPostExecute(Void result) {
if (videoUrl != null) {
Intent viewVideoIntent = new Intent(Intent.ACTION_VIEW);
- Uri uri = Uri.parse("http://xl6dxqeq7qw3gqgf.onion/file/get/" + videoUrl);
+ Uri uri = Uri.parse("http://blip.tv/file/get/" + videoUrl);
viewVideoIntent.setDataAndType(uri, "video/3gpp");
startActivityForResult(viewVideoIntent, VIDEO_PLAYED);
}
commit 55f8a99fe9a927dcc9f11d7428955ae24660061d
Author: Sathyanarayanan Gunasekaran <gsathya.ceg@gmail.com>
Date: Sat Aug 6 00:01:51 2011 +0530
Updated to use Hidden Service
diff --git a/src/com/apress/proandroidmedia/ch12/blipuploader/BlipTVUploader.java b/src/com/apress/proandroidmedia/ch12/blipuploader/BlipTVUploader.java
index c66cb33..79b64a2 100644
--- a/src/com/apress/proandroidmedia/ch12/blipuploader/BlipTVUploader.java
+++ b/src/com/apress/proandroidmedia/ch12/blipuploader/BlipTVUploader.java
@@ -100,7 +100,7 @@ public class BlipTVUploader extends Activity {
protected Void doInBackground(Void... params) {
HttpClient httpclient = new DefaultHttpClient();
- HttpPost httppost = new HttpPost("http://blip.tv/file/post");
+ HttpPost httppost = new HttpPost("http://xl6dxqeq7qw3gqgf.onion/file/post");
HttpHost proxy = new HttpHost(host, port);
httpclient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy);
@@ -163,7 +163,7 @@ public class BlipTVUploader extends Activity {
protected void onPostExecute(Void result) {
if (videoUrl != null) {
Intent viewVideoIntent = new Intent(Intent.ACTION_VIEW);
- Uri uri = Uri.parse("http://blip.tv/file/get/" + videoUrl);
+ Uri uri = Uri.parse("http://xl6dxqeq7qw3gqgf.onion/file/get/" + videoUrl);
viewVideoIntent.setDataAndType(uri, "video/3gpp");
startActivityForResult(viewVideoIntent, VIDEO_PLAYED);
}
commit e53deff3889e8e10df90adaff53e2883a8876c20
Author: Sathyanarayanan Gunasekaran <gsathya.ceg@gmail.com>
Date: Thu Aug 4 19:03:46 2011 +0530
removed orlib
diff --git a/.DS_Store b/.DS_Store
new file mode 100644
index 0000000..20ca88d
Binary files /dev/null and b/.DS_Store differ
diff --git a/.classpath b/.classpath
new file mode 100644
index 0000000..c2fb307
--- /dev/null
+++ b/.classpath
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
+ <classpathentry kind="lib" path="apache-mime4j-0.6.jar"/>
+ <classpathentry kind="lib" path="httpmime-4.0.3.jar"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="src" path="gen"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/.project b/.project
new file mode 100644
index 0000000..830f465
--- /dev/null
+++ b/.project
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>Pro Android Media Ch 12 - Blip Uploader</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>com.android.ide.eclipse.adt.ApkBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>com.android.ide.eclipse.adt.AndroidNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
new file mode 100644
index 0000000..d3db3e9
--- /dev/null
+++ b/AndroidManifest.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.apress.proandroidmedia.ch12.blipuploader"
+ android:versionCode="1"
+ android:versionName="1.0">
+ <application android:icon="@drawable/icon" android:label="@string/app_name">
+ <activity android:name=".BlipTVUploader"
+ android:label="@string/app_name">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+ </application>
+ <uses-sdk android:minSdkVersion="4" />
+ <uses-permission android:name="android.permission.INTERNET"></uses-permission>
+</manifest>
diff --git a/README b/README
new file mode 100644
index 0000000..efbe793
--- /dev/null
+++ b/README
@@ -0,0 +1,2 @@
+Anon Blip.tv uploader for android to be used along with Orbot.
+Forked from https://github.com/vanevery/Pro-Android-Media
diff --git a/apache-mime4j-0.6.jar b/apache-mime4j-0.6.jar
new file mode 100644
index 0000000..314573b
Binary files /dev/null and b/apache-mime4j-0.6.jar differ
diff --git a/bin/BlipTVUploader.apk b/bin/BlipTVUploader.apk
new file mode 100644
index 0000000..ce1db00
Binary files /dev/null and b/bin/BlipTVUploader.apk differ
diff --git a/bin/classes.dex b/bin/classes.dex
new file mode 100644
index 0000000..67a9cb1
Binary files /dev/null and b/bin/classes.dex differ
diff --git a/bin/com/apress/proandroidmedia/ch12/blipuploader/BlipTVUploader$BlipResponseXMLHandler.class b/bin/com/apress/proandroidmedia/ch12/blipuploader/BlipTVUploader$BlipResponseXMLHandler.class
new file mode 100644
index 0000000..f00be62
Binary files /dev/null and b/bin/com/apress/proandroidmedia/ch12/blipuploader/BlipTVUploader$BlipResponseXMLHandler.class differ
diff --git a/bin/com/apress/proandroidmedia/ch12/blipuploader/BlipTVUploader$BlipTVFilePoster.class b/bin/com/apress/proandroidmedia/ch12/blipuploader/BlipTVUploader$BlipTVFilePoster.class
new file mode 100644
index 0000000..872a1d0
Binary files /dev/null and b/bin/com/apress/proandroidmedia/ch12/blipuploader/BlipTVUploader$BlipTVFilePoster.class differ
diff --git a/bin/com/apress/proandroidmedia/ch12/blipuploader/BlipTVUploader$BlipXMLParserListener.class b/bin/com/apress/proandroidmedia/ch12/blipuploader/BlipTVUploader$BlipXMLParserListener.class
new file mode 100644
index 0000000..675fc35
Binary files /dev/null and b/bin/com/apress/proandroidmedia/ch12/blipuploader/BlipTVUploader$BlipXMLParserListener.class differ
diff --git a/bin/com/apress/proandroidmedia/ch12/blipuploader/BlipTVUploader$ProgressListener.class b/bin/com/apress/proandroidmedia/ch12/blipuploader/BlipTVUploader$ProgressListener.class
new file mode 100644
index 0000000..ca2e981
Binary files /dev/null and b/bin/com/apress/proandroidmedia/ch12/blipuploader/BlipTVUploader$ProgressListener.class differ
diff --git a/bin/com/apress/proandroidmedia/ch12/blipuploader/BlipTVUploader$ProgressMultipartEntity.class b/bin/com/apress/proandroidmedia/ch12/blipuploader/BlipTVUploader$ProgressMultipartEntity.class
new file mode 100644
index 0000000..02e0bd2
Binary files /dev/null and b/bin/com/apress/proandroidmedia/ch12/blipuploader/BlipTVUploader$ProgressMultipartEntity.class differ
diff --git a/bin/com/apress/proandroidmedia/ch12/blipuploader/BlipTVUploader$ProgressOutputStream.class b/bin/com/apress/proandroidmedia/ch12/blipuploader/BlipTVUploader$ProgressOutputStream.class
new file mode 100644
index 0000000..e25cd89
Binary files /dev/null and b/bin/com/apress/proandroidmedia/ch12/blipuploader/BlipTVUploader$ProgressOutputStream.class differ
diff --git a/bin/com/apress/proandroidmedia/ch12/blipuploader/BlipTVUploader.class b/bin/com/apress/proandroidmedia/ch12/blipuploader/BlipTVUploader.class
new file mode 100644
index 0000000..d6da2db
Binary files /dev/null and b/bin/com/apress/proandroidmedia/ch12/blipuploader/BlipTVUploader.class differ
diff --git a/bin/com/apress/proandroidmedia/ch12/blipuploader/R$attr.class b/bin/com/apress/proandroidmedia/ch12/blipuploader/R$attr.class
new file mode 100644
index 0000000..fd667b3
Binary files /dev/null and b/bin/com/apress/proandroidmedia/ch12/blipuploader/R$attr.class differ
diff --git a/bin/com/apress/proandroidmedia/ch12/blipuploader/R$drawable.class b/bin/com/apress/proandroidmedia/ch12/blipuploader/R$drawable.class
new file mode 100644
index 0000000..7e0596c
Binary files /dev/null and b/bin/com/apress/proandroidmedia/ch12/blipuploader/R$drawable.class differ
diff --git a/bin/com/apress/proandroidmedia/ch12/blipuploader/R$id.class b/bin/com/apress/proandroidmedia/ch12/blipuploader/R$id.class
new file mode 100644
index 0000000..793ef20
Binary files /dev/null and b/bin/com/apress/proandroidmedia/ch12/blipuploader/R$id.class differ
diff --git a/bin/com/apress/proandroidmedia/ch12/blipuploader/R$layout.class b/bin/com/apress/proandroidmedia/ch12/blipuploader/R$layout.class
new file mode 100644
index 0000000..c289425
Binary files /dev/null and b/bin/com/apress/proandroidmedia/ch12/blipuploader/R$layout.class differ
diff --git a/bin/com/apress/proandroidmedia/ch12/blipuploader/R$string.class b/bin/com/apress/proandroidmedia/ch12/blipuploader/R$string.class
new file mode 100644
index 0000000..79f4bbf
Binary files /dev/null and b/bin/com/apress/proandroidmedia/ch12/blipuploader/R$string.class differ
diff --git a/bin/com/apress/proandroidmedia/ch12/blipuploader/R.class b/bin/com/apress/proandroidmedia/ch12/blipuploader/R.class
new file mode 100644
index 0000000..3161902
Binary files /dev/null and b/bin/com/apress/proandroidmedia/ch12/blipuploader/R.class differ
diff --git a/bin/resources.ap_ b/bin/resources.ap_
new file mode 100644
index 0000000..3b96378
Binary files /dev/null and b/bin/resources.ap_ differ
diff --git a/default.properties b/default.properties
new file mode 100644
index 0000000..0b9250e
--- /dev/null
+++ b/default.properties
@@ -0,0 +1,11 @@
+# This file is automatically generated by Android Tools.
+# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
+#
+# This file must be checked in Version Control Systems.
+#
+# To customize properties used by the Ant build system use,
+# "build.properties", and override values to adapt the script to your
+# project structure.
+
+# Project target.
+target=android-8
diff --git a/gen/com/apress/proandroidmedia/ch12/blipuploader/R.java b/gen/com/apress/proandroidmedia/ch12/blipuploader/R.java
new file mode 100644
index 0000000..26c4561
--- /dev/null
+++ b/gen/com/apress/proandroidmedia/ch12/blipuploader/R.java
@@ -0,0 +1,26 @@
+/* AUTO-GENERATED FILE. DO NOT MODIFY.
+ *
+ * This class was automatically generated by the
+ * aapt tool from the resource data it found. It
+ * should not be modified by hand.
+ */
+
+package com.apress.proandroidmedia.ch12.blipuploader;
+
+public final class R {
+ public static final class attr {
+ }
+ public static final class drawable {
+ public static final int icon=0x7f020000;
+ }
+ public static final class id {
+ public static final int textview=0x7f050000;
+ }
+ public static final class layout {
+ public static final int main=0x7f030000;
+ }
+ public static final class string {
+ public static final int app_name=0x7f040001;
+ public static final int hello=0x7f040000;
+ }
+}
diff --git a/httpmime-4.0.3.jar b/httpmime-4.0.3.jar
new file mode 100644
index 0000000..0dfd331
Binary files /dev/null and b/httpmime-4.0.3.jar differ
diff --git a/res/drawable-hdpi/icon.png b/res/drawable-hdpi/icon.png
new file mode 100644
index 0000000..8074c4c
Binary files /dev/null and b/res/drawable-hdpi/icon.png differ
diff --git a/res/drawable-ldpi/icon.png b/res/drawable-ldpi/icon.png
new file mode 100644
index 0000000..1095584
Binary files /dev/null and b/res/drawable-ldpi/icon.png differ
diff --git a/res/drawable-mdpi/icon.png b/res/drawable-mdpi/icon.png
new file mode 100644
index 0000000..a07c69f
Binary files /dev/null and b/res/drawable-mdpi/icon.png differ
diff --git a/res/layout/main.xml b/res/layout/main.xml
new file mode 100644
index 0000000..a341923
--- /dev/null
+++ b/res/layout/main.xml
@@ -0,0 +1,13 @@
+<?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"
+ >
+<TextView
+ android:id="@+id/textview"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:text=""
+ />
+</LinearLayout>
diff --git a/res/values/strings.xml b/res/values/strings.xml
new file mode 100644
index 0000000..b43950d
--- /dev/null
+++ b/res/values/strings.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <string name="hello">Hello World, BlipTVUploader!</string>
+ <string name="app_name">BlipTV Uploader</string>
+</resources>
diff --git a/src/com/apress/proandroidmedia/ch12/blipuploader/BlipTVUploader.java b/src/com/apress/proandroidmedia/ch12/blipuploader/BlipTVUploader.java
new file mode 100644
index 0000000..c66cb33
--- /dev/null
+++ b/src/com/apress/proandroidmedia/ch12/blipuploader/BlipTVUploader.java
@@ -0,0 +1,319 @@
+package com.apress.proandroidmedia.ch12.blipuploader;
+
+import java.io.File;
+import java.io.FilterOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+
+import org.apache.http.HttpEntity;
+import org.apache.http.HttpHost;
+import org.apache.http.HttpResponse;
+import org.apache.http.client.ClientProtocolException;
+import org.apache.http.client.HttpClient;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.conn.params.ConnRoutePNames;
+import org.apache.http.entity.mime.MultipartEntity;
+import org.apache.http.entity.mime.content.FileBody;
+import org.apache.http.entity.mime.content.StringBody;
+import org.apache.http.impl.client.DefaultHttpClient;
+import org.xml.sax.Attributes;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
+import org.xml.sax.helpers.DefaultHandler;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.database.Cursor;
+import android.net.Uri;
+import android.os.AsyncTask;
+import android.os.Bundle;
+import android.util.Log;
+import android.widget.TextView;
+
+public class BlipTVUploader extends Activity {
+
+ final static int VIDEO_CAPTURED = 0;
+ final static int VIDEO_PLAYED = 1;
+
+ File videoFile;
+ String title = "A Video";
+ String username = "bliptest123";
+ String password = "bliptest123";
+ String host = "localhost";
+ int port = 8118;
+
+ String postingResult = "";
+
+ long fileLength = 0;
+
+ TextView textview;
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.main);
+
+ textview = (TextView) findViewById(R.id.textview);
+
+ Intent captureVideoIntent = new Intent(
+ android.provider.MediaStore.ACTION_VIDEO_CAPTURE);
+ startActivityForResult(captureVideoIntent, VIDEO_CAPTURED);
+ }
+
+ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
+
+ if (resultCode == RESULT_OK && requestCode == VIDEO_CAPTURED) {
+ Uri videoFileUri = data.getData();
+
+ String[] columns = { android.provider.MediaStore.Video.Media.DATA };
+ Cursor cursor = managedQuery(videoFileUri, columns, null, null,
+ null);
+ int fileColumn = cursor
+ .getColumnIndexOrThrow(android.provider.MediaStore.Video.Media.DATA);
+ if (cursor.moveToFirst()) {
+ String videoFilePath = cursor.getString(fileColumn);
+ Log.v("VIDEO FILE PATH", videoFilePath);
+
+ videoFile = new File(videoFilePath);
+ fileLength = videoFile.length();
+ BlipTVFilePoster btvfp = new BlipTVFilePoster();
+ btvfp.execute();
+ }
+
+ } else if (requestCode == VIDEO_PLAYED) {
+ finish();
+ }
+ }
+
+ class BlipTVFilePoster extends AsyncTask<Void, String, Void> implements
+ ProgressListener, BlipXMLParserListener {
+
+ String videoUrl;
+
+ @Override
+ protected Void doInBackground(Void... params) {
+
+ HttpClient httpclient = new DefaultHttpClient();
+ HttpPost httppost = new HttpPost("http://blip.tv/file/post");
+ HttpHost proxy = new HttpHost(host, port);
+ httpclient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy);
+
+ ProgressMultipartEntity multipartentity = new ProgressMultipartEntity(
+ this);
+
+ try {
+ multipartentity.addPart("file", new FileBody(videoFile));
+
+ multipartentity.addPart("userlogin", new StringBody(username));
+ multipartentity.addPart("password", new StringBody(password));
+ multipartentity.addPart("title", new StringBody(title));
+ multipartentity.addPart("post", new StringBody("1"));
+ multipartentity.addPart("skin", new StringBody("api"));
+
+ httppost.setEntity(multipartentity);
+ HttpResponse httpresponse = httpclient.execute(httppost);
+
+ HttpEntity responseentity = httpresponse.getEntity();
+ if (responseentity != null) {
+
+ InputStream inputstream = responseentity.getContent();
+
+ SAXParserFactory aSAXParserFactory = SAXParserFactory
+ .newInstance();
+ try {
+
+ SAXParser aSAXParser = aSAXParserFactory.newSAXParser();
+ XMLReader anXMLReader = aSAXParser.getXMLReader();
+
+ BlipResponseXMLHandler xmlHandler = new BlipResponseXMLHandler(
+ this);
+ anXMLReader.setContentHandler(xmlHandler);
+ anXMLReader.parse(new InputSource(inputstream));
+
+ } catch (ParserConfigurationException e) {
+ e.printStackTrace();
+ } catch (SAXException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ inputstream.close();
+
+ }
+ } catch (ClientProtocolException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ return null;
+ }
+
+ protected void onProgressUpdate(String... textToDisplay) {
+ textview.setText(textToDisplay[0]);
+ }
+
+ protected void onPostExecute(Void result) {
+ if (videoUrl != null) {
+ Intent viewVideoIntent = new Intent(Intent.ACTION_VIEW);
+ Uri uri = Uri.parse("http://blip.tv/file/get/" + videoUrl);
+ viewVideoIntent.setDataAndType(uri, "video/3gpp");
+ startActivityForResult(viewVideoIntent, VIDEO_PLAYED);
+ }
+ }
+
+ public void transferred(long num) {
+ double percent = (double) num / (double) fileLength;
+ int percentInt = (int) (percent * 100);
+
+ publishProgress("" + percentInt + "% Transferred");
+ }
+
+ public void parseResult(String result) {
+ publishProgress(result);
+ }
+
+ public void setVideoUrl(String url) {
+ videoUrl = url;
+ }
+ }
+
+ class ProgressMultipartEntity extends MultipartEntity {
+ ProgressListener progressListener;
+
+ public ProgressMultipartEntity(ProgressListener pListener) {
+ super();
+ this.progressListener = pListener;
+ }
+
+ @Override
+ public void writeTo(OutputStream outstream) throws IOException {
+ super.writeTo(new ProgressOutputStream(outstream,
+ this.progressListener));
+ }
+ }
+
+ interface ProgressListener {
+ void transferred(long num);
+ }
+
+ static class ProgressOutputStream extends FilterOutputStream {
+
+ ProgressListener listener;
+ int transferred;
+
+ public ProgressOutputStream(final OutputStream out,
+ ProgressListener listener) {
+ super(out);
+ this.listener = listener;
+ this.transferred = 0;
+ }
+
+ public void write(byte[] b, int off, int len) throws IOException {
+ out.write(b, off, len);
+ this.transferred += len;
+ this.listener.transferred(this.transferred);
+ }
+
+ public void write(int b) throws IOException {
+ out.write(b);
+ this.transferred++;
+ this.listener.transferred(this.transferred);
+ }
+ }
+
+ interface BlipXMLParserListener {
+ void parseResult(String result);
+
+ void setVideoUrl(String url);
+ }
+
+ class BlipResponseXMLHandler extends DefaultHandler {
+
+ int NONE = 0;
+ int ONSTATUS = 1;
+ int ONFILE = 2;
+ int ONERRORMESSAGE = 3;
+
+ int state = NONE;
+
+ int STATUS_UNKNOWN = 0;
+ int STATUS_OK = 1;
+ int STATUS_ERROR = 2;
+
+ int status = STATUS_UNKNOWN;
+
+ String message = "";
+
+ BlipXMLParserListener listener;
+
+ public BlipResponseXMLHandler(BlipXMLParserListener bxpl) {
+ super();
+ listener = bxpl;
+ }
+
+ @Override
+ public void startDocument() throws SAXException {
+ }
+
+ @Override
+ public void endDocument() throws SAXException {
+ }
+
+ @Override
+ public void startElement(String uri, String localName, String qName,
+ Attributes attributes) throws SAXException {
+ if (localName.equalsIgnoreCase("status")) {
+ state = ONSTATUS;
+ } else if (localName.equalsIgnoreCase("file")) {
+ state = ONFILE;
+
+ listener.parseResult("onFile");
+ message = attributes.getValue("src");
+ listener.parseResult("filemessage:" + message);
+
+ listener.setVideoUrl(message);
+ } else if (localName.equalsIgnoreCase("message")) {
+ state = ONERRORMESSAGE;
+ listener.parseResult("onErrorMessage");
+ }
+ }
+
+ @Override
+ public void endElement(String uri, String localName, String qName)
+ throws SAXException {
+ if (localName.equalsIgnoreCase("status")) {
+ state = NONE;
+ } else if (localName.equalsIgnoreCase("file")) {
+ state = NONE;
+ } else if (localName.equalsIgnoreCase("message")) {
+ state = NONE;
+ }
+ }
+
+ @Override
+ public void characters(char[] ch, int start, int length)
+ throws SAXException {
+ String stringChars = new String(ch, start, length);
+ if (state == ONSTATUS) {
+ if (stringChars.equalsIgnoreCase("OK")) {
+ status = STATUS_OK;
+ } else if (stringChars.equalsIgnoreCase("ERROR")) {
+ status = STATUS_ERROR;
+ } else {
+ status = STATUS_UNKNOWN;
+ }
+ } else if (state == ONERRORMESSAGE) {
+ message += stringChars.trim();
+ listener.parseResult(message);
+ }
+ }
+ }
+}
commit 2d857aff3bd395a48bf979854f08c2c473369603
Author: Sathyanarayanan Gunasekaran <gsathya.ceg@gmail.com>
Date: Tue Jul 26 13:16:30 2011 -0400
Total Bandwidth prep code
diff --git a/res/layout/layout_main.xml b/res/layout/layout_main.xml
index 2a770f8..694c38e 100644
--- a/res/layout/layout_main.xml
+++ b/res/layout/layout_main.xml
@@ -106,7 +106,7 @@
android:gravity="center_vertical|center_horizontal"
android:textStyle="bold" />
</RelativeLayout>
-
+</RelativeLayout>
</LinearLayout>
diff --git a/src/org/torproject/android/Orbot.java b/src/org/torproject/android/Orbot.java
index 6f251af..c5952cc 100644
--- a/src/org/torproject/android/Orbot.java
+++ b/src/org/torproject/android/Orbot.java
@@ -813,7 +813,18 @@ public class Orbot extends Activity implements OnLongClickListener, TorConstants
uploadText.setText(formatCount(datacount.Upload));
downloadText.invalidate();
uploadText.invalidate();
-
+
+ try {
+ String TotalUpload = mService.getInfo("traffic/written");
+ String TotalDownload = mService.getInfo("traffic/read");
+ StringBuilder sb = new StringBuilder();
+ sb.append("Total Upload " + TotalUpload);
+ sb.append("Total Download" + TotalDownload);
+ Log.d(TAG,sb.toString());
+ } catch (RemoteException e) {
+ Log.d(TAG,"Total bandwidth error"+e.getMessage());
+ }
+
break;
default:
super.handleMessage(msg);
diff --git a/src/org/torproject/android/service/ITorService.aidl b/src/org/torproject/android/service/ITorService.aidl
index e643b4d..07fa808 100644
--- a/src/org/torproject/android/service/ITorService.aidl
+++ b/src/org/torproject/android/service/ITorService.aidl
@@ -48,4 +48,9 @@ interface ITorService {
*/
String getConfiguration (String name);
+ /**
+ * Get information
+ */
+ String getInfo (String args);
+
}
diff --git a/src/org/torproject/android/service/TorService.java b/src/org/torproject/android/service/TorService.java
index a64ccd2..41b0cae 100644
--- a/src/org/torproject/android/service/TorService.java
+++ b/src/org/torproject/android/service/TorService.java
@@ -11,6 +11,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
+import java.util.Map;
import java.util.StringTokenizer;
import net.freehaven.tor.control.ConfigEntry;
@@ -998,14 +999,7 @@ public class TorService extends Service implements TorServiceConstants, Runnable
sb.append("kb read / ");
sb.append(written/1000);
sb.append("kb written");
- /* try {
- sb.append("Total upload :"+conn.getInfo("traffic/written"));
- sb.append("Total Download "+conn.getInfo("traffic/read"));
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- */
+
logNotice(sb.toString());
}
@@ -1014,7 +1008,7 @@ public class TorService extends Service implements TorServiceConstants, Runnable
}
-
+
public void circuitStatus(String status, String circID, String path) {
@@ -1107,8 +1101,25 @@ public class TorService extends Service implements TorServiceConstants, Runnable
}
}
-
-
+
+
+ public String getInfo (String key) {
+ try
+ {
+ if(conn !=null)
+ {
+ String m = conn.getInfo(key);
+ return m;
+
+ }
+ }
+ catch(IOException ioe)
+ {
+ Log.e(TAG,"Unable to get Tor information",ioe);
+ logNotice("Unable to get Tor information"+ioe.getMessage());
+ }
+ return null;
+ }
public String getConfiguration (String name)
{
commit 865d56150003e089c740f005c906c95840b16655
Merge: 41bed40 e86e1d9
Author: Sathyanarayanan Gunasekaran <gsathya.ceg@gmail.com>
Date: Mon Jul 25 17:55:10 2011 -0400
Merge branch 'master' of git://git.torproject.org/n8fr8/orbot into datastats
Conflicts:
AndroidManifest.xml
res/layout/layout_main.xml
src/org/torproject/android/Orbot.java
commit 41bed40999e21c92186d5432f1679c03cdf6bd14
Author: Sathyanarayanan Gunasekaran <gsathya.ceg@gmail.com>
Date: Mon Jul 25 17:49:03 2011 -0400
Adding neccessary prep code for Total BW
diff --git a/src/org/torproject/android/service/TorService.java b/src/org/torproject/android/service/TorService.java
index 5fc7695..496be97 100644
--- a/src/org/torproject/android/service/TorService.java
+++ b/src/org/torproject/android/service/TorService.java
@@ -980,7 +980,7 @@ public class TorService extends Service implements TorServiceConstants, Runnable
}
}
-
+
public void bandwidthUsed(long read, long written) {
if (ENABLE_DEBUG_LOG)
@@ -991,7 +991,14 @@ public class TorService extends Service implements TorServiceConstants, Runnable
sb.append("kb read / ");
sb.append(written/1000);
sb.append("kb written");
-
+ /* try {
+ sb.append("Total upload :"+conn.getInfo("traffic/written"));
+ sb.append("Total Download "+conn.getInfo("traffic/read"));
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ */
logNotice(sb.toString());
}
commit a9a0e64dc7814b48aa6bf0d973edd4c3e0b8664c
Author: Sathyanarayanan Gunasekaran <gsathya.ceg@gmail.com>
Date: Thu Jul 7 19:34:22 2011 +0530
ENABLE_DEBUG_TOGGLE update, proper AIDL implementation
Data stats are now shown irrespective of
whether ENABLE_DEBUG_TOGGLE is toggled or not.
ITorServiceCallback.aidl has been updated to
include a new method updateBandwidth(long ,long)
to hook the data passed from the service into
the GUI.
diff --git a/src/org/torproject/android/Orbot.java b/src/org/torproject/android/Orbot.java
index 2bb21e6..fab02a7 100644
--- a/src/org/torproject/android/Orbot.java
+++ b/src/org/torproject/android/Orbot.java
@@ -713,6 +713,23 @@ public class Orbot extends Activity implements OnLongClickListener, TorConstants
mHandler.sendMessage(msg);
}
+
+ @Override
+ public void updateBandwidth(long upload, long download)
+ throws RemoteException {
+
+ Message msg = Message.obtain();
+ msg.what = TorServiceConstants.MESSAGE_TRAFFIC_COUNT;
+
+
+ Bundle data = new Bundle();
+ data.putLong("upload", upload);
+ data.putLong("download", download);
+
+ msg.setData(data);
+ mHandler.sendMessage(msg);
+
+ }
};
diff --git a/src/org/torproject/android/service/ITorServiceCallback.aidl b/src/org/torproject/android/service/ITorServiceCallback.aidl
index 86fe28f..2492206 100644
--- a/src/org/torproject/android/service/ITorServiceCallback.aidl
+++ b/src/org/torproject/android/service/ITorServiceCallback.aidl
@@ -12,6 +12,11 @@ oneway interface ITorServiceCallback {
void statusChanged(String value);
/**
+ * Called when the service returns the bandwidth user to display to the user
+ */
+ void updateBandwidth(long value, long value2);
+
+ /**
* Called when the service has something to add to the log
*/
void logMessage(String value);
diff --git a/src/org/torproject/android/service/TorService.java b/src/org/torproject/android/service/TorService.java
index c0fa560..5fc7695 100644
--- a/src/org/torproject/android/service/TorService.java
+++ b/src/org/torproject/android/service/TorService.java
@@ -993,37 +993,14 @@ public class TorService extends Service implements TorServiceConstants, Runnable
sb.append("kb written");
logNotice(sb.toString());
- DataCount datacount = new DataCount(written,read);
-
- Message msg = Message.obtain();
- msg.what = MESSAGE_TRAFFIC_COUNT;
- //msg.obj = datacount;
- Bundle data = new Bundle();
- data.putLong("upload", datacount.Upload);
- data.putLong("download", datacount.Download);
-
- msg.setData(data);
-
- Orbot.currentInstance.mHandler.sendMessage(msg);
-
- //sendCallbackStatusMessage(message);
-
}
+
+ sendCallbackStatusMessage(written, read);
+
+
}
- public class DataCount {
- // data uploaded
- public long Upload;
- // data downloaded
- public long Download;
-
-
- DataCount(long Upload, long Download){
- this.Upload = Upload;
- this.Download = Download;
- }
- }
public void circuitStatus(String status, String circID, String path) {
@@ -1254,6 +1231,36 @@ public class TorService extends Service implements TorServiceConstants, Runnable
mCallbacks.finishBroadcast();
inCallback = false;
}
+
+ private synchronized void sendCallbackStatusMessage (long upload, long download)
+ {
+
+ if (mCallbacks == null)
+ return;
+
+ // Broadcast to all clients the new value.
+ final int N = mCallbacks.beginBroadcast();
+
+ inCallback = true;
+
+ if (N > 0)
+ {
+ for (int i=0; i<N; i++) {
+ try {
+ mCallbacks.getBroadcastItem(i).updateBandwidth(upload, download);
+
+
+ } catch (RemoteException e) {
+ // The RemoteCallbackList will take care of removing
+ // the dead object for us.
+ }
+ }
+ }
+
+ mCallbacks.finishBroadcast();
+ inCallback = false;
+ }
+
private synchronized void sendCallbackLogMessage (String logMessage)
{
commit 2f2cf9c72d49f2426f62b2429a76145e53018be3
Author: Sathyanarayanan Gunasekaran <gsathya.ceg@gmail.com>
Date: Wed Jul 6 21:31:36 2011 +0530
Bugfixes + improved formatting
diff --git a/src/org/torproject/android/Orbot.java b/src/org/torproject/android/Orbot.java
index 6f2ad1a..2bb21e6 100644
--- a/src/org/torproject/android/Orbot.java
+++ b/src/org/torproject/android/Orbot.java
@@ -631,7 +631,6 @@ public class Orbot extends Activity implements OnLongClickListener, TorConstants
Message msg = mHandler.obtainMessage(TorServiceConstants.ENABLE_TOR_MSG);
mHandler.sendMessage(msg);
- trafficRow.setVisibility(RelativeLayout.VISIBLE);
}
@@ -745,7 +744,8 @@ public class Orbot extends Activity implements OnLongClickListener, TorConstants
case TorServiceConstants.MESSAGE_TRAFFIC_COUNT :
-
+
+ trafficRow.setVisibility(RelativeLayout.VISIBLE);
Bundle data = msg.getData();
DataCount datacount = new DataCount(data.getLong("upload"),data.getLong("download"));
downloadText.setText(formatCount(datacount.Download));
@@ -888,8 +888,8 @@ public class Orbot extends Activity implements OnLongClickListener, TorConstants
// Under 2Mb, returns "xxx.xKb"
// Over 2Mb, returns "xxx.xxMb"
if (count < 1e6 * 2)
- return ((float)((int)(count*10/1024))/10 + "kB");
- return ((float)((int)(count*100/1024/1024))/100 + "MB");
+ return ((float)((int)(count*10/1024))/10 + " kbps");
+ return ((float)((int)(count*100/1024/1024))/100 + " mbps");
//return count+" kB";
}
commit 1ef51091f7c7cb5899b71b1a2718ffbe2eff889d
Author: Sathyanarayanan Gunasekaran <gsathya.ceg@gmail.com>
Date: Sun Jul 3 17:41:43 2011 +0530
Improved Formatting
Now shows the data with upto 2 decimal places.
If under 2Mb, shows "xxx.xKb", else shows "xxx.xxMb"
diff --git a/src/org/torproject/android/Orbot.java b/src/org/torproject/android/Orbot.java
index 6da6f12..6f2ad1a 100644
--- a/src/org/torproject/android/Orbot.java
+++ b/src/org/torproject/android/Orbot.java
@@ -750,7 +750,8 @@ public class Orbot extends Activity implements OnLongClickListener, TorConstants
DataCount datacount = new DataCount(data.getLong("upload"),data.getLong("download"));
downloadText.setText(formatCount(datacount.Download));
uploadText.setText(formatCount(datacount.Upload));
-
+ downloadText.invalidate();
+ uploadText.invalidate();
break;
@@ -883,8 +884,14 @@ public class Orbot extends Activity implements OnLongClickListener, TorConstants
}
private String formatCount(long count) {
-
- return count+" kB";
+ // Converts the supplied argument into a string.
+ // Under 2Mb, returns "xxx.xKb"
+ // Over 2Mb, returns "xxx.xxMb"
+ if (count < 1e6 * 2)
+ return ((float)((int)(count*10/1024))/10 + "kB");
+ return ((float)((int)(count*100/1024/1024))/100 + "MB");
+
+ //return count+" kB";
}
}
diff --git a/src/org/torproject/android/service/TorService.java b/src/org/torproject/android/service/TorService.java
index 6d10f19..c0fa560 100644
--- a/src/org/torproject/android/service/TorService.java
+++ b/src/org/torproject/android/service/TorService.java
@@ -993,10 +993,7 @@ public class TorService extends Service implements TorServiceConstants, Runnable
sb.append("kb written");
logNotice(sb.toString());
- DataCount datacount = new DataCount();
-
- datacount.Download = read/1000;
- datacount.Upload = written/1000;
+ DataCount datacount = new DataCount(written,read);
Message msg = Message.obtain();
msg.what = MESSAGE_TRAFFIC_COUNT;
@@ -1020,6 +1017,12 @@ public class TorService extends Service implements TorServiceConstants, Runnable
public long Upload;
// data downloaded
public long Download;
+
+
+ DataCount(long Upload, long Download){
+ this.Upload = Upload;
+ this.Download = Download;
+ }
}
public void circuitStatus(String status, String circID, String path) {
commit e0f642b304b6cf27488d2e1b482adb81ece0336d
Author: Sathyanarayanan Gunasekaran <gsathya.ceg@gmail.com>
Date: Sun Jul 3 17:11:11 2011 +0530
Traffic is shown in the main UI
diff --git a/res/layout/layout_main.xml b/res/layout/layout_main.xml
index db2bf0e..8589e14 100644
--- a/res/layout/layout_main.xml
+++ b/res/layout/layout_main.xml
@@ -38,7 +38,7 @@
android:id="@+id/imgStatus"
android:layout_margin="5dip"
android:layout_width="320dip"
- android:layout_height="320dip"
+ android:layout_height="280dip"
android:src="@drawable/toroff"
android:layout_gravity="center_horizontal"
/>
diff --git a/src/org/torproject/android/Orbot.java b/src/org/torproject/android/Orbot.java
index 318531d..6da6f12 100644
--- a/src/org/torproject/android/Orbot.java
+++ b/src/org/torproject/android/Orbot.java
@@ -46,8 +46,6 @@ import android.widget.TextView;
public class Orbot extends Activity implements OnLongClickListener, TorConstants
{
-
- private static final int VISIBLE = 0;
/* Useful UI bits */
private TextView lblStatus = null; //the main text display widget
private ImageView imgStatus = null; //the main touchable image for activating Orbot
@@ -633,7 +631,7 @@ public class Orbot extends Activity implements OnLongClickListener, TorConstants
Message msg = mHandler.obtainMessage(TorServiceConstants.ENABLE_TOR_MSG);
mHandler.sendMessage(msg);
- trafficRow.setVisibility(VISIBLE);
+ trafficRow.setVisibility(RelativeLayout.VISIBLE);
}
@@ -644,6 +642,8 @@ public class Orbot extends Activity implements OnLongClickListener, TorConstants
mService.setProfile(TorServiceConstants.PROFILE_OFF);
Message msg = mHandler.obtainMessage(TorServiceConstants.DISABLE_TOR_MSG);
mHandler.sendMessage(msg);
+ trafficRow.setVisibility(RelativeLayout.GONE);
+
}
@@ -746,11 +746,11 @@ public class Orbot extends Activity implements OnLongClickListener, TorConstants
case TorServiceConstants.MESSAGE_TRAFFIC_COUNT :
- DataCount datacount = (DataCount) msg.obj;
+ Bundle data = msg.getData();
+ DataCount datacount = new DataCount(data.getLong("upload"),data.getLong("download"));
downloadText.setText(formatCount(datacount.Download));
uploadText.setText(formatCount(datacount.Upload));
- downloadText.invalidate();
- uploadText.invalidate();
+
break;
@@ -875,15 +875,16 @@ public class Orbot extends Activity implements OnLongClickListener, TorConstants
public long Upload;
// data downloaded
public long Download;
+
+ DataCount(long Upload, long Download){
+ this.Upload = Upload;
+ this.Download = Download;
+ }
}
private String formatCount(long count) {
- // Converts the supplied argument into a string.
- // Under 2Mb, returns "xxx.xKb"
- // Over 2Mb, returns "xxx.xxMb"
- if (count < 1e6 * 2)
- return ((float)((int)(count*10/1024))/10 + "kB");
- return ((float)((int)(count*100/1024/1024))/100 + "MB");
+
+ return count+" kB";
}
}
diff --git a/src/org/torproject/android/service/TorService.java b/src/org/torproject/android/service/TorService.java
index 052384d..6d10f19 100644
--- a/src/org/torproject/android/service/TorService.java
+++ b/src/org/torproject/android/service/TorService.java
@@ -33,9 +33,11 @@ import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
+import android.os.Bundle;
import android.os.IBinder;
import android.os.Looper;
import android.os.Message;
+import android.os.Parcelable;
import android.os.RemoteCallbackList;
import android.os.RemoteException;
import android.preference.PreferenceManager;
@@ -996,10 +998,16 @@ public class TorService extends Service implements TorServiceConstants, Runnable
datacount.Download = read/1000;
datacount.Upload = written/1000;
- Message message = Message.obtain();
- message.what = MESSAGE_TRAFFIC_COUNT;
- message.obj = datacount;
- Orbot.currentInstance.mHandler.sendMessage(message);
+ Message msg = Message.obtain();
+ msg.what = MESSAGE_TRAFFIC_COUNT;
+ //msg.obj = datacount;
+ Bundle data = new Bundle();
+ data.putLong("upload", datacount.Upload);
+ data.putLong("download", datacount.Download);
+
+ msg.setData(data);
+
+ Orbot.currentInstance.mHandler.sendMessage(msg);
//sendCallbackStatusMessage(message);
commit 830b8fcd8cf9f090432df1b4ccb1e8c9e8d47762
Author: Sathyanarayanan Gunasekaran <gsathya.ceg@gmail.com>
Date: Sun Jul 3 14:09:49 2011 +0530
Data stats - ARRRRRRRR not working
diff --git a/res/layout/layout_main.xml b/res/layout/layout_main.xml
index 6e51cba..db2bf0e 100644
--- a/res/layout/layout_main.xml
+++ b/res/layout/layout_main.xml
@@ -51,7 +51,54 @@
android:layout_height="30dip"
android:textColor="#ffffff"
/>
-
+ <RelativeLayout android:id="@+id/trafficRow"
+ android:gravity="bottom"
+ android:layout_width="fill_parent"
+ android:layout_alignParentBottom="true"
+ android:visibility="invisible"
+ android:layout_height="80dp"
+ android:background="#A0909090">
+ <TextView
+ android:id="@+id/trafficDownLabel"
+ android:textColor="#FFFFFFFF"
+ android:layout_width="150dp"
+ android:layout_height="wrap_content"
+ android:layout_alignParentLeft="true"
+ android:textSize="16sp"
+ android:text="@string/main_layout_download"
+ android:gravity="center_vertical|center_horizontal"
+ android:textStyle="bold" />
+ <TextView
+ android:id="@+id/trafficUpLabel"
+ android:textColor="#FFFFFFFF"
+ android:layout_width="150dp"
+ android:layout_height="wrap_content"
+ android:layout_alignParentRight="true"
+ android:text="@string/main_layout_upload"
+ android:textSize="16sp"
+ android:gravity="center_vertical|center_horizontal"
+ android:textStyle="bold" />
+ <TextView
+ android:id="@+id/trafficDown"
+ android:textColor="#FF00B627"
+ android:layout_width="150dp"
+ android:layout_height="wrap_content"
+ android:layout_alignParentLeft="true"
+ android:layout_below="@+id/trafficDownLabel"
+ android:textSize="24sp"
+ android:gravity="center_vertical|center_horizontal"
+ android:textStyle="bold" />
+ <TextView
+ android:id="@+id/trafficUp"
+ android:textColor="#FFFF2211"
+ android:layout_width="150dp"
+ android:layout_height="wrap_content"
+ android:layout_alignParentRight="true"
+ android:layout_below="@+id/trafficUpLabel"
+ android:textSize="24sp"
+ android:gravity="center_vertical|center_horizontal"
+ android:textStyle="bold" />
+ </RelativeLayout>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 2a974f1..4c30b25 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -33,6 +33,8 @@
<string name="menu_about">About</string>
<string name="menu_wizard">Wizard</string>
+<string name="main_layout_download">Download</string>
+<string name="main_layout_upload">Upload</string>
<string name="button_help">Help</string>
diff --git a/src/org/torproject/android/Orbot.java b/src/org/torproject/android/Orbot.java
index 4bc5695..318531d 100644
--- a/src/org/torproject/android/Orbot.java
+++ b/src/org/torproject/android/Orbot.java
@@ -41,17 +41,22 @@ import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnLongClickListener;
import android.widget.ImageView;
+import android.widget.RelativeLayout;
import android.widget.TextView;
public class Orbot extends Activity implements OnLongClickListener, TorConstants
{
-
+
+ private static final int VISIBLE = 0;
/* Useful UI bits */
private TextView lblStatus = null; //the main text display widget
private ImageView imgStatus = null; //the main touchable image for activating Orbot
private ProgressDialog progressDialog;
private MenuItem mItemOnOff = null;
-
+ private RelativeLayout trafficRow = null; // the row showing the traffic
+ private TextView downloadText = null;
+ private TextView uploadText = null;
+
/* Some tracking bits */
private int torStatus = STATUS_READY; //latest status reported from the tor service
@@ -62,14 +67,21 @@ public class Orbot extends Activity implements OnLongClickListener, TorConstants
SharedPreferences prefs;
+ public static Orbot currentInstance = null;
+
+ private static void setCurrent(Orbot current){
+ Orbot.currentInstance = current;
+ }
+
/** Called when the activity is first created. */
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
+ Orbot.setCurrent(this);
+
//if Tor binary is not running, then start the service up
startService(new Intent(INTENT_TOR_SERVICE));
-
setTheme(android.R.style.Theme_Black_NoTitleBar);
prefs = PreferenceManager.getDefaultSharedPreferences(this);
@@ -80,8 +92,11 @@ public class Orbot extends Activity implements OnLongClickListener, TorConstants
lblStatus.setOnLongClickListener(this);
imgStatus = (ImageView)findViewById(R.id.imgStatus);
imgStatus.setOnLongClickListener(this);
-
-
+ trafficRow = (RelativeLayout)findViewById(R.id.trafficRow);
+ downloadText = (TextView)findViewById(R.id.trafficDown);
+ uploadText = (TextView)findViewById(R.id.trafficUp);
+
+
}
@@ -618,7 +633,7 @@ public class Orbot extends Activity implements OnLongClickListener, TorConstants
Message msg = mHandler.obtainMessage(TorServiceConstants.ENABLE_TOR_MSG);
mHandler.sendMessage(msg);
-
+ trafficRow.setVisibility(VISIBLE);
}
@@ -702,7 +717,7 @@ public class Orbot extends Activity implements OnLongClickListener, TorConstants
};
- private Handler mHandler = new Handler() {
+ public Handler mHandler = new Handler() {
public void handleMessage(Message msg) {
switch (msg.what) {
case TorServiceConstants.STATUS_MSG:
@@ -727,6 +742,17 @@ public class Orbot extends Activity implements OnLongClickListener, TorConstants
updateStatus((String)msg.getData().getString(HANDLER_TOR_MSG));
break;
+
+
+ case TorServiceConstants.MESSAGE_TRAFFIC_COUNT :
+
+ DataCount datacount = (DataCount) msg.obj;
+ downloadText.setText(formatCount(datacount.Download));
+ uploadText.setText(formatCount(datacount.Upload));
+ downloadText.invalidate();
+ uploadText.invalidate();
+
+ break;
default:
super.handleMessage(msg);
@@ -843,4 +869,21 @@ public class Orbot extends Activity implements OnLongClickListener, TorConstants
}
+
+ public class DataCount {
+ // data uploaded
+ public long Upload;
+ // data downloaded
+ public long Download;
+ }
+
+ private String formatCount(long count) {
+ // Converts the supplied argument into a string.
+ // Under 2Mb, returns "xxx.xKb"
+ // Over 2Mb, returns "xxx.xxMb"
+ if (count < 1e6 * 2)
+ return ((float)((int)(count*10/1024))/10 + "kB");
+ return ((float)((int)(count*100/1024/1024))/100 + "MB");
+ }
+
}
diff --git a/src/org/torproject/android/service/TorService.java b/src/org/torproject/android/service/TorService.java
index fba41e1..052384d 100644
--- a/src/org/torproject/android/service/TorService.java
+++ b/src/org/torproject/android/service/TorService.java
@@ -35,6 +35,7 @@ import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.os.IBinder;
import android.os.Looper;
+import android.os.Message;
import android.os.RemoteCallbackList;
import android.os.RemoteException;
import android.preference.PreferenceManager;
@@ -43,7 +44,7 @@ import android.util.Log;
public class TorService extends Service implements TorServiceConstants, Runnable, EventHandler
{
- public static boolean ENABLE_DEBUG_LOG = false;
+ public static boolean ENABLE_DEBUG_LOG = true;
private static int currentStatus = STATUS_OFF;
@@ -838,7 +839,7 @@ public class TorService extends Service implements TorServiceConstants, Runnable
conn.setEventHandler(this);
conn.setEvents(Arrays.asList(new String[]{
- "ORCONN", "CIRC", "NOTICE", "WARN", "ERR"}));
+ "ORCONN", "CIRC", "NOTICE", "WARN", "ERR","BW"}));
// conn.setEvents(Arrays.asList(new String[]{
// "DEBUG", "INFO", "NOTICE", "WARN", "ERR"}));
@@ -990,10 +991,29 @@ public class TorService extends Service implements TorServiceConstants, Runnable
sb.append("kb written");
logNotice(sb.toString());
+ DataCount datacount = new DataCount();
+
+ datacount.Download = read/1000;
+ datacount.Upload = written/1000;
+
+ Message message = Message.obtain();
+ message.what = MESSAGE_TRAFFIC_COUNT;
+ message.obj = datacount;
+ Orbot.currentInstance.mHandler.sendMessage(message);
+
+ //sendCallbackStatusMessage(message);
+
}
}
+ public class DataCount {
+ // data uploaded
+ public long Upload;
+ // data downloaded
+ public long Download;
+ }
+
public void circuitStatus(String status, String circID, String path) {
if (ENABLE_DEBUG_LOG)
@@ -1275,7 +1295,7 @@ public class TorService extends Service implements TorServiceConstants, Runnable
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
- ENABLE_DEBUG_LOG = prefs.getBoolean("pref_enable_logging",false);
+ ENABLE_DEBUG_LOG = prefs.getBoolean("pref_enable_logging",true);
Log.i(TAG,"debug logging:" + ENABLE_DEBUG_LOG);
boolean useBridges = prefs.getBoolean(TorConstants.PREF_BRIDGES_ENABLED, false);
diff --git a/src/org/torproject/android/service/TorServiceConstants.java b/src/org/torproject/android/service/TorServiceConstants.java
index 4f58dde..ec9558c 100644
--- a/src/org/torproject/android/service/TorServiceConstants.java
+++ b/src/org/torproject/android/service/TorServiceConstants.java
@@ -81,4 +81,6 @@ public interface TorServiceConstants {
public static final int ENABLE_TOR_MSG = 2;
public static final int DISABLE_TOR_MSG = 3;
public static final int LOG_MSG = 4;
+ public static final int MESSAGE_TRAFFIC_COUNT = 5;
+
}
commit d7c15dd81bead96956cd5164c287c2729b60f409
Author: Sathyanarayanan Gunasekaran <gsathya.ceg@gmail.com>
Date: Tue Jun 28 09:20:01 2011 +0530
Minor changes to LotsaText.java
Now shows "Introduction" screen when the
app is installed for the first time.
diff --git a/src/org/torproject/android/LotsaText.java b/src/org/torproject/android/LotsaText.java
index 9f845db..1b0656b 100644
--- a/src/org/torproject/android/LotsaText.java
+++ b/src/org/torproject/android/LotsaText.java
@@ -34,7 +34,7 @@ public class LotsaText extends Activity implements TorConstants{
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
- boolean wizardScreen1 = prefs.getBoolean("wizardscreen1",false);
+ boolean wizardScreen1 = prefs.getBoolean("wizardscreen1",true);
if(wizardScreen1)
stepOne();
else
commit d9e0ede79743ee65ab10f1036c3ee003fa023078
Author: Sathyanarayanan Gunasekaran <gsathya.ceg@gmail.com>
Date: Tue Jun 28 09:14:43 2011 +0530
Updated Permissions
Asks for superuser privileges after user clicks
"Grant Permissions" and checks for iptables OWNER
module
diff --git a/src/org/torproject/android/Permissions.java b/src/org/torproject/android/Permissions.java
index 1c5b10c..2ee4f7e 100644
--- a/src/org/torproject/android/Permissions.java
+++ b/src/org/torproject/android/Permissions.java
@@ -51,27 +51,6 @@ public class Permissions extends Activity implements TorConstants {
private void stepThree(){
boolean hasRoot = TorServiceUtils.checkRootAccess();
-
- if (hasRoot)
- {
- try {
- int resp = TorTransProxy.testOwnerModule(context);
-
- if (resp < 0)
- {
- hasRoot = false;
- Toast.makeText(context, "ERROR: IPTables OWNER module not available", Toast.LENGTH_LONG).show();
-
- Log.i(TorService.TAG,"ERROR: IPTables OWNER module not available");
- }
-
- } catch (Exception e) {
-
- hasRoot = false;
- Log.d(TorService.TAG,"ERROR: IPTables OWNER module not available",e);
- }
- }
-
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
Editor pEdit = prefs.edit();
@@ -149,6 +128,31 @@ public class Permissions extends Activity implements TorConstants {
@Override
public void onClick(View v) {
//Check and Install iptables - TorTransProxy.testOwnerModule(this)
+
+ SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
+ boolean hasRoot = prefs.getBoolean("has_root",false);
+
+ if (hasRoot)
+ {
+ try {
+ int resp = TorTransProxy.testOwnerModule(context);
+
+ if (resp < 0)
+ {
+ hasRoot = false;
+ Toast.makeText(context, "ERROR: IPTables OWNER module not available", Toast.LENGTH_LONG).show();
+
+ Log.i(TorService.TAG,"ERROR: IPTables OWNER module not available");
+ stepFour();
+ }
+
+ } catch (Exception e) {
+
+ hasRoot = false;
+ Log.d(TorService.TAG,"ERROR: IPTables OWNER module not available",e);
+ }
+ }
+
startActivityForResult(new Intent(getBaseContext(), ConfigureTransProxy.class), 1);
@@ -185,12 +189,24 @@ public class Permissions extends Activity implements TorConstants {
TextView txtTitle = ((TextView)findViewById(R.id.WizardTextTitle));
txtTitle.setText(title);
- TextView txtBody = ((TextView)findViewById(R.id.WizardTextBody));
+ TextView txtBody = ((TextView)findViewById(R.id.WizardTextBody1));
txtBody.setText(msg);
Button btn1 = ((Button)findViewById(R.id.btnWizard1));
Button btn2 = ((Button)findViewById(R.id.btnWizard2));
-
+ btn2.setEnabled(true);
+
+
+ TextView txtBody2 = ((TextView)findViewById(R.id.WizardTextBody2));
+ txtBody2.setVisibility(TextView.GONE);
+
+ Button grantPermissions = ((Button)findViewById(R.id.grantPermissions));
+ grantPermissions.setVisibility(Button.GONE);
+
+
+ CheckBox consent = (CheckBox)findViewById(R.id.checkBox);
+ consent.setVisibility(CheckBox.GONE);
+
btn1.setOnClickListener(new View.OnClickListener() {
@Override
commit e63c745808ac9020983e872c5deac190d4f884de
Author: Sathyanarayanan Gunasekaran <gsathya.ceg@gmail.com>
Date: Tue Jun 28 09:12:52 2011 +0530
Updated TorServiceUtils.checkRootAccess()
checkRootAccess() now checks if 'su' binary and
Superuser.apk exist to check if the phone has
root access
diff --git a/src/org/torproject/android/service/TorServiceUtils.java b/src/org/torproject/android/service/TorServiceUtils.java
index 2aa58e6..657d525 100644
--- a/src/org/torproject/android/service/TorServiceUtils.java
+++ b/src/org/torproject/android/service/TorServiceUtils.java
@@ -17,7 +17,9 @@ public class TorServiceUtils implements TorServiceConstants {
* Check if we have root access
* @return boolean true if we have root
*/
- public static boolean checkRootAccess() {
+ /*
+ public static boolean checkRootAccess() {
+
StringBuilder log = new StringBuilder();
@@ -45,7 +47,40 @@ public class TorServiceUtils implements TorServiceConstants {
TorService.logMessage("Could not acquire root permissions");
return false;
}
+ */
+ public static boolean checkRootAccess(){
+
+ StringBuilder log = new StringBuilder();
+
+ try {
+
+ // Check if Superuser.apk exists
+ File file = new File("/system/app/Superuser.apk");
+
+ //Check for 'su' binary
+ String[] cmd = {"which su"};
+ int exitCode = TorServiceUtils.doShellCommand(cmd, log, false, true);
+
+ if (file.exists() && exitCode == 0) {
+ TorService.logMessage("Can acquire root permissions");
+ return true;
+
+ }
+
+ } catch (IOException e) {
+ //this means that there is no root to be had (normally) so we won't log anything
+ TorService.logException("Error checking for root access",e);
+
+ }
+ catch (Exception e) {
+ TorService.logException("Error checking for root access",e);
+ //this means that there is no root to be had (normally)
+ }
+
+ TorService.logMessage("Could not acquire root permissions");
+ return false;
+ }
public static int findProcessId(String command)
commit 99fa4dbfed8f20faa7243797d6a25d37496d6f79
Author: Sathyanarayanan Gunasekaran <gsathya.ceg@gmail.com>
Date: Wed Jun 15 17:47:41 2011 +0530
Added GSoC plan
diff --git a/GSoC.txt b/GSoC.txt
new file mode 100644
index 0000000..d1d851e
--- /dev/null
+++ b/GSoC.txt
@@ -0,0 +1,45 @@
+GSoC Plan
+=========
+
+A tl;dr version
+---------------
+I will be improving the Orbot UI/UX, and adding several features such as data statistics and also
+implementing the TorCheck API. I plan on extending the ORLib library and also creating an ORLib enabled
+app as a sort of primer for other third party apps to follow
+
+The full version
+----------------
+
+Orbot UI/UX
+===========
+At the moment, the Orbot UI/UX is clustered and not very intuitive. I plan on improving the existing
+elements of the UI and also add a variety of new features such as
+
+* A new Set – up Wizard ( which checks for iptables )
+* Changes to the preferences ( should be made to follow the Android guidelines)
+
+Orbot Core app work
+===================
+At the moment, Orbot displays a successful connection without actually checking the connection. This is a
+pressing issue, because the user is not notified if the set-up has failed, unless he/she manually checks
+the torcheck web service. This should be made automatic by making using of the TorCheck API. Also, Orbot
+should be configured to show more information about the data being transmitted such as -
+
+* Amount of data transferred
+* Quality of the connection
+* Number of circuits connected
+
+ORLib
+=====
+Currently, ORLib is very minimal at the moment, both in term of features and support/documentation. ORLib
+is very critical to the use of Orbot as it provides transparent proxying on non-rooted devices ( A major
+chunk of android phones are un-rooted). I intend to -
+
+* Improve the existing library by adding additional features
+ * Check for existing of Orbot
+ * Check status of connection to Tor
+ * Provide option to start Orbot via intent
+* Request hidden service by port, and get return hidden service .onion address
+* Create an ORLib enabled “Twitter, Status.net or other micro blogging Client” – A sort of primer for
+ third-party apps
+* Improve the documentation
commit 322284ef9b3b6af758ddab115685a7d688769c50
Author: Sathyanarayanan Gunasekaran <gsathya.ceg@gmail.com>
Date: Tue Jun 14 22:38:14 2011 +0530
Added warning icon to Warning screen
diff --git a/res/drawable/warning.png b/res/drawable/warning.png
new file mode 100644
index 0000000..42dc6d6
Binary files /dev/null and b/res/drawable/warning.png differ
diff --git a/res/layout/scrollingtext_buttons_view.xml b/res/layout/scrollingtext_buttons_view.xml
index 930bf72..ebecfad 100644
--- a/res/layout/scrollingtext_buttons_view.xml
+++ b/res/layout/scrollingtext_buttons_view.xml
@@ -14,12 +14,12 @@
android:background="#000000"
>
<ImageView
- android:src="@drawable/tor"
+ android:src="@drawable/warning"
android:id="@+id/orbot_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
- android:paddingLeft="20px" android:paddingRight="20px" >
+ android:paddingLeft="20px" android:layout_marginLeft="10dip" android:layout_marginTop="8dip">
</ImageView>
<TextView
android:textColor="#FFFFFF"
@@ -37,7 +37,9 @@
android:layout_centerInParent="true"
- android:padding="20px">
+ android:paddingLeft="5px"
+ android:padding="20px"
+ >
</TextView>
</RelativeLayout>
<TableLayout android:id="@+id/TableLayout01" android:stretchColumns="*" android:layout_height="fill_parent" android:layout_width="wrap_content" >
diff --git a/src/org/torproject/android/LotsaText.java b/src/org/torproject/android/LotsaText.java
index 43e6d16..9f845db 100644
--- a/src/org/torproject/android/LotsaText.java
+++ b/src/org/torproject/android/LotsaText.java
@@ -73,8 +73,8 @@ public class LotsaText extends Activity implements TorConstants{
ImageView img = (ImageView) findViewById(R.id.orbot_image);
btn1.setVisibility(Button.INVISIBLE);
- img.setVisibility(ImageView.VISIBLE);
-
+ img.setImageResource(R.drawable.tor);
+
btn2.setOnClickListener(new View.OnClickListener() {
@Override
@@ -108,7 +108,7 @@ public class LotsaText extends Activity implements TorConstants{
ImageView img = (ImageView) findViewById(R.id.orbot_image);
btn1.setVisibility(Button.VISIBLE);
- img.setVisibility(ImageView.INVISIBLE);
+ img.setImageResource(R.drawable.warning);
btn1.setOnClickListener(new View.OnClickListener() {
commit fbdeb71974a4ea3567b5f6cb7b6962ab9c5a19cf
Author: Sathyanarayanan Gunasekaran <gsathya.ceg@gmail.com>
Date: Mon Jun 13 15:40:34 2011 +0530
Updated RadioButtons in ConfigureTransProxy
All the RadioButtons are unchecked by default. The next button
is disabled until a RadioButton is checked.
diff --git a/res/layout/layout_wizard_root.xml b/res/layout/layout_wizard_root.xml
index 4c64035..443106e 100644
--- a/res/layout/layout_wizard_root.xml
+++ b/res/layout/layout_wizard_root.xml
@@ -42,7 +42,7 @@
android:padding="3px">
<TextView android:text="@string/wizard_transproxy_msg" android:layout_width="wrap_content" android:textColor="#ffffff" android:layout_height="wrap_content" android:textSize="8pt" android:id="@+id/WizardTextBody1" android:padding="20dip"></TextView>
<RadioGroup android:id="@+id/radioGroup" android:layout_height="wrap_content" android:layout_width="wrap_content" android:paddingLeft="15dip">
- <RadioButton android:checked="true" android:text="@string/wizard_configure_all" android:id="@+id/radio0" android:layout_height="wrap_content" android:layout_width="wrap_content"></RadioButton>
+ <RadioButton android:text="@string/wizard_configure_all" android:id="@+id/radio0" android:layout_height="wrap_content" android:layout_width="wrap_content"></RadioButton>
<TextView android:layout_height="wrap_content"
android:text="@string/wizard_transproxy_hint"
android:layout_width="wrap_content"
diff --git a/src/org/torproject/android/ConfigureTransProxy.java b/src/org/torproject/android/ConfigureTransProxy.java
index 4e9405b..d515aae 100644
--- a/src/org/torproject/android/ConfigureTransProxy.java
+++ b/src/org/torproject/android/ConfigureTransProxy.java
@@ -57,6 +57,32 @@ public class ConfigureTransProxy extends Activity implements TorConstants {
String title = context.getString(R.string.wizard_transproxy_title);
TextView txtTitle = ((TextView)findViewById(R.id.WizardTextTitle));
txtTitle.setText(title);
+
+ Button back = ((Button)findViewById(R.id.btnWizard1));
+ Button next = ((Button)findViewById(R.id.btnWizard2));
+ next.setEnabled(false);
+
+ back.setOnClickListener(new View.OnClickListener() {
+
+ @Override
+ public void onClick(View v) {
+
+ startActivityForResult(new Intent(getBaseContext(), Permissions.class), 1);
+ }
+ });
+
+ next.setOnClickListener(new View.OnClickListener() {
+
+ //Dirty flag variable - improve logic
+ @Override
+ public void onClick(View v) {
+ if( flag == 1 )
+ context.startActivity(new Intent(context, AppManager.class));
+
+ else
+ showWizardFinal();
+ }
+ });
RadioGroup mRadioGroup = (RadioGroup)findViewById(R.id.radioGroup);
mRadioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener (){
@@ -65,6 +91,7 @@ public class ConfigureTransProxy extends Activity implements TorConstants {
@Override
public void onCheckedChanged(RadioGroup group, int checkedId){
Button next = ((Button)findViewById(R.id.btnWizard2));
+ next.setEnabled(true);
next.setOnClickListener(new View.OnClickListener() {
@Override
@@ -120,30 +147,7 @@ public class ConfigureTransProxy extends Activity implements TorConstants {
}
});
- Button back = ((Button)findViewById(R.id.btnWizard1));
- Button next = ((Button)findViewById(R.id.btnWizard2));
-
- back.setOnClickListener(new View.OnClickListener() {
-
- @Override
- public void onClick(View v) {
-
- startActivityForResult(new Intent(getBaseContext(), Permissions.class), 1);
- }
- });
-
- next.setOnClickListener(new View.OnClickListener() {
-
- //Dirty flag variable - improve logic
- @Override
- public void onClick(View v) {
- if( flag == 1 )
- context.startActivity(new Intent(context, AppManager.class));
-
- else
- showWizardFinal();
- }
- });
+
}
private void showWizardFinal ()
commit eb3a09ae06cd7b822d1105815663a0ad254b59a6
Author: Sathyanarayanan Gunasekaran <gsathya.ceg@gmail.com>
Date: Mon Jun 13 01:15:44 2011 +0530
Added the AndroidManifest
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 030bbff..a27e2c1 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -5,7 +5,7 @@
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
- <application android:icon="@drawable/icon" android:label="@string/app_name" android:debuggable="false">
+ <application android:theme="@style/DefaultTheme" android:icon="@drawable/icon" android:label="@string/app_name" android:debuggable="false">
<activity android:name=".Orbot"
android:theme="@android:style/Theme.NoTitleBar">
commit d937ee3ca96af9d383f1f1f8ab100ac59a9abd9d
Author: Sathyanarayanan Gunasekaran <gsathya.ceg@gmail.com>
Date: Mon Jun 13 01:11:46 2011 +0530
Wizard UI/UX Refresh
Added theme.xml, updated all the views. Changed radiobutton logic
diff --git a/res/layout/layout_apps_item.xml b/res/layout/layout_apps_item.xml
index 8b4fc34..9d16efd 100644
--- a/res/layout/layout_apps_item.xml
+++ b/res/layout/layout_apps_item.xml
@@ -12,5 +12,6 @@
<CheckBox android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/itemcheck" ></CheckBox>
</TableRow>
+
</TableLayout>
diff --git a/res/layout/layout_wizard_permissions.xml b/res/layout/layout_wizard_permissions.xml
index 7926750..151bb3e 100644
--- a/res/layout/layout_wizard_permissions.xml
+++ b/res/layout/layout_wizard_permissions.xml
@@ -3,49 +3,49 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:background="@drawable/background">
+ android:layout_height="fill_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/relativeLayout1"
- android:layout_gravity="center_horizontal">
+ android:layout_gravity="center_horizontal"
+ android:background="#000000">
<TextView android:textSize="10pt"
-
+ android:textColor="#FFFFFF"
android:layout_alignParentTop="true"
android:layout_height="wrap_content"
android:id="@+id/WizardTextTitle"
android:layout_width="wrap_content"
android:fadingEdge="vertical"
android:text="TITLE"
- android:textColor="#00ff00"
android:singleLine="true"
android:padding="20px" android:layout_centerInParent="true">
</TextView>
</RelativeLayout>
<TableLayout android:id="@+id/TableLayout01" android:stretchColumns="*" android:layout_height="fill_parent" android:layout_width="wrap_content">
-<TableRow android:id="@+id/TableRow01" android:layout_weight="1" android:layout_width="fill_parent" android:layout_height="fill_parent">
+<TableRow android:layout_margin="10dip" android:id="@+id/TableRow01" android:layout_weight="1" android:layout_width="fill_parent" android:layout_height="fill_parent">
<ScrollView android:id="@+id/helpscrollview"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
- android:layout_span="3">
- <LinearLayout android:layout_width="wrap_content" android:id="@+id/linearLayout1" android:layout_height="wrap_content" android:orientation="vertical">
- <TextView android:layout_width="wrap_content" android:textColor="#ffffff" android:layout_height="wrap_content" android:background="#222222" android:textSize="8pt" android:id="@+id/WizardTextBody1" android:text="this is sample text this is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample text" android:padding="20dip"></TextView>
+ android:layout_span="3"
+ >
+ <LinearLayout android:background="#575757" android:layout_width="wrap_content" android:id="@+id/linearLayout1" android:layout_height="wrap_content" android:orientation="vertical">
+ <TextView android:layout_width="wrap_content" android:textColor="#ffffff" android:layout_height="wrap_content" android:textSize="8pt" android:id="@+id/WizardTextBody1" android:text="this is sample text this is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample text" android:padding="20dip"></TextView>
<Button android:layout_width="wrap_content" android:visibility="gone" android:layout_height="wrap_content" android:gravity="center" android:text="Grant Permission" android:id="@+id/grantPermissions" android:layout_gravity="center"></Button>
- <TextView android:layout_width="wrap_content" android:visibility="gone" android:textColor="#ffffff" android:layout_height="wrap_content" android:background="#222222" android:textSize="8pt" android:id="@+id/WizardTextBody2" android:text="this is sample text this is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample text" android:padding="20dip"></TextView>
- <CheckBox android:id="@+id/checkBox" android:visibility="gone" android:layout_gravity="center" android:text="@string/wizard_permissions_consent" android:layout_height="wrap_content" android:layout_width="wrap_content"></CheckBox>
+ <TextView android:layout_width="wrap_content" android:visibility="gone" android:textColor="#ffffff" android:layout_height="wrap_content" android:textSize="8pt" android:id="@+id/WizardTextBody2" android:text="this is sample text this is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample text" android:padding="20dip"></TextView>
+ <CheckBox android:id="@+id/checkBox" android:layout_gravity="center" android:text="@string/wizard_permissions_consent" android:layout_height="wrap_content" android:layout_width="wrap_content" android:gravity="center" android:visibility="visible"></CheckBox>
</LinearLayout>
</ScrollView>
</TableRow>
-<TableRow android:id="@+id/TableRow01" android:textColor="#00ff00" android:layout_width="fill_parent" android:layout_height="30px">
+<TableRow android:background="#000000" android:layout_marginTop="10dip" android:paddingTop="10dip" android:id="@+id/TableRow01" android:textColor="#00ff00" android:layout_width="fill_parent" android:layout_height="30px">
<Button android:text="Back" android:id="@+id/btnWizard1" android:layout_weight="1" android:layout_width="fill_parent" android:layout_height="wrap_content"></Button>
<Button android:text="Next" android:id="@+id/btnWizard2" android:layout_weight="1" android:layout_width="fill_parent" android:layout_height="wrap_content"></Button>
</TableRow>
diff --git a/res/layout/layout_wizard_root.xml b/res/layout/layout_wizard_root.xml
index d038a96..4c64035 100644
--- a/res/layout/layout_wizard_root.xml
+++ b/res/layout/layout_wizard_root.xml
@@ -3,30 +3,29 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:background="@drawable/background">
+ android:layout_height="fill_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/relativeLayout1"
- android:layout_gravity="center_horizontal">
+ android:layout_gravity="center_horizontal"
+ android:background="#000000">
<TextView android:textSize="10pt"
-
+ android:textColor="#FFFFFF"
android:layout_alignParentTop="true"
android:layout_height="wrap_content"
android:id="@+id/WizardTextTitle"
android:layout_width="wrap_content"
android:fadingEdge="vertical"
android:text="TITLE"
- android:textColor="#00ff00"
android:singleLine="true"
android:padding="20px" android:layout_centerInParent="true">
</TextView>
</RelativeLayout>
<TableLayout android:id="@+id/TableLayout01" android:stretchColumns="*" android:layout_height="fill_parent" android:layout_width="wrap_content">
-<TableRow android:id="@+id/TableRow01" android:layout_weight="1" android:layout_width="fill_parent" android:layout_height="fill_parent">
+<TableRow android:layout_margin="10dip" android:id="@+id/TableRow01" android:layout_weight="1" android:layout_width="fill_parent" android:layout_height="fill_parent">
<ScrollView android:id="@+id/helpscrollview"
@@ -36,18 +35,19 @@
android:layout_span="3">
<LinearLayout
+ android:background="#575757"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="3px">
-<TextView android:text="@string/wizard_transproxy_msg" android:layout_width="wrap_content" android:textColor="#ffffff" android:layout_height="wrap_content" android:background="#222222" android:textSize="8pt" android:id="@+id/WizardTextBody1" android:padding="20dip"></TextView>
-<RadioGroup android:id="@+id/radioGroup" android:layout_height="wrap_content" android:layout_width="wrap_content">
+<TextView android:text="@string/wizard_transproxy_msg" android:layout_width="wrap_content" android:textColor="#ffffff" android:layout_height="wrap_content" android:textSize="8pt" android:id="@+id/WizardTextBody1" android:padding="20dip"></TextView>
+<RadioGroup android:id="@+id/radioGroup" android:layout_height="wrap_content" android:layout_width="wrap_content" android:paddingLeft="15dip">
<RadioButton android:checked="true" android:text="@string/wizard_configure_all" android:id="@+id/radio0" android:layout_height="wrap_content" android:layout_width="wrap_content"></RadioButton>
<TextView android:layout_height="wrap_content"
android:text="@string/wizard_transproxy_hint"
android:layout_width="wrap_content"
android:textSize="15sp"
- android:paddingBottom="10dip">
+ android:paddingBottom="10dip" android:paddingRight="20dip">
</TextView>
<RadioButton android:text="@string/wizard_configure_select_apps" android:id="@+id/radio1" android:layout_height="wrap_content" android:layout_width="wrap_content"></RadioButton>
<RadioButton android:text="@string/wizard_transproxy_none" android:id="@+id/radio2" android:layout_height="wrap_content" android:layout_width="wrap_content"></RadioButton>
@@ -58,7 +58,7 @@
</ScrollView>
</TableRow>
-<TableRow android:id="@+id/TableRow01" android:textColor="#00ff00" android:layout_width="fill_parent" android:layout_height="30px">
+<TableRow android:background="#000000" android:layout_marginTop="10dip" android:paddingTop="10dip" android:id="@+id/TableRow01" android:textColor="#00ff00" android:layout_width="fill_parent" android:layout_height="30px">
<Button android:text="Back" android:id="@+id/btnWizard1" android:layout_weight="1" android:layout_width="fill_parent" android:layout_height="wrap_content"></Button>
<Button android:text="Next" android:id="@+id/btnWizard2" android:layout_weight="1" android:layout_width="fill_parent" android:layout_height="wrap_content"></Button>
</TableRow>
diff --git a/res/layout/layout_wizard_tips.xml b/res/layout/layout_wizard_tips.xml
index a9c4d0b..1b7b50b 100644
--- a/res/layout/layout_wizard_tips.xml
+++ b/res/layout/layout_wizard_tips.xml
@@ -3,30 +3,29 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:background="@drawable/background">
+ android:layout_height="fill_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/relativeLayout1"
- android:layout_gravity="center_horizontal">
+ android:layout_gravity="center_horizontal"
+ android:background="#000000">
<TextView android:textSize="10pt"
-
+ android:textColor="#FFFFFF"
android:layout_alignParentTop="true"
android:layout_height="wrap_content"
android:id="@+id/WizardTextTitle"
android:layout_width="wrap_content"
android:fadingEdge="vertical"
android:text="TITLE"
- android:textColor="#00ff00"
android:singleLine="true"
android:padding="20px" android:layout_centerInParent="true">
</TextView>
</RelativeLayout>
-<TableLayout android:id="@+id/TableLayout01" android:stretchColumns="*" android:layout_height="fill_parent" android:layout_width="wrap_content">
+<TableLayout android:id="@+id/TableLayout01" android:stretchColumns="*" android:layout_height="fill_parent" android:layout_width="wrap_content">
-<TableRow android:id="@+id/TableRow01" android:layout_weight="1" android:layout_width="fill_parent" android:layout_height="fill_parent">
+<TableRow android:layout_margin="10dip" android:id="@+id/TableRow01" android:layout_weight="1" android:layout_width="fill_parent" android:layout_height="fill_parent">
<ScrollView android:id="@+id/helpscrollview"
@@ -36,12 +35,14 @@
android:layout_span="3">
<LinearLayout
+ android:background="#575757"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
- android:padding="3px">
+ android:paddingRight="20dip"
+ >
-<TextView android:text="@string/wizard_tips_msg" android:layout_width="wrap_content" android:textColor="#ffffff" android:layout_height="wrap_content" android:background="#222222" android:textSize="8pt" android:id="@+id/WizardTextBody1" android:padding="20dip"></TextView>
+<TextView android:text="@string/wizard_tips_msg" android:layout_width="wrap_content" android:textColor="#ffffff" android:layout_height="wrap_content" android:textSize="8pt" android:id="@+id/WizardTextBody1" android:padding="20dip"></TextView>
<Button android:text="@string/wizard_tips_gibberbot" android:layout_gravity="left" android:drawableLeft="@drawable/ic_launcher_gibberbot" android:layout_marginTop="10px" android:id="@+id/WizardRootButtonInstallGibberbot" android:layout_width="wrap_content" android:layout_height="wrap_content"/>
<Button android:text="@string/wizard_tips_firefox" android:layout_gravity="left" android:drawableLeft="@drawable/icon_firefox" android:layout_marginTop="10px" android:id="@+id/WizardRootButtonInstallFirefox" android:layout_width="wrap_content" android:layout_height="wrap_content"/>
@@ -52,7 +53,7 @@
</ScrollView>
</TableRow>
-<TableRow android:id="@+id/TableRow01" android:textColor="#00ff00" android:layout_width="fill_parent" android:layout_height="30px">
+<TableRow android:background="#000000" android:layout_marginTop="10dip" android:paddingTop="10dip" android:id="@+id/TableRow01" android:textColor="#00ff00" android:layout_width="fill_parent" android:layout_height="30px">
<Button android:text="Back" android:id="@+id/btnWizard1" android:layout_weight="1" android:layout_width="fill_parent" android:layout_height="wrap_content"></Button>
<Button android:text="Next" android:id="@+id/btnWizard2" android:layout_weight="1" android:layout_width="fill_parent" android:layout_height="wrap_content"></Button>
</TableRow>
diff --git a/res/layout/scrollingtext_buttons_view.xml b/res/layout/scrollingtext_buttons_view.xml
index 04023ff..930bf72 100644
--- a/res/layout/scrollingtext_buttons_view.xml
+++ b/res/layout/scrollingtext_buttons_view.xml
@@ -4,13 +4,15 @@
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
- android:background="@drawable/background">
+ >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/relativeLayout1"
- android:layout_gravity="center_horizontal">
+ android:layout_gravity="center_horizontal"
+ android:background="#000000"
+ >
<ImageView
android:src="@drawable/tor"
android:id="@+id/orbot_image"
@@ -19,7 +21,9 @@
android:layout_alignParentLeft="true"
android:paddingLeft="20px" android:paddingRight="20px" >
</ImageView>
- <TextView android:textSize="10pt"
+ <TextView
+ android:textColor="#FFFFFF"
+ android:textSize="10pt"
android:layout_toRightOf="@id/orbot_image"
android:layout_alignParentTop="true"
android:gravity="center_vertical"
@@ -27,8 +31,7 @@
android:id="@+id/WizardTextTitle"
android:layout_width="wrap_content"
android:fadingEdge="vertical"
- android:text="TITLE"
- android:textColor="#00ff00"
+ android:text="TITLE"
android:singleLine="true"
@@ -37,9 +40,9 @@
android:padding="20px">
</TextView>
</RelativeLayout>
-<TableLayout android:id="@+id/TableLayout01" android:stretchColumns="*" android:layout_height="fill_parent" android:layout_width="wrap_content">
+<TableLayout android:id="@+id/TableLayout01" android:stretchColumns="*" android:layout_height="fill_parent" android:layout_width="wrap_content" >
-<TableRow android:id="@+id/TableRow01" android:layout_weight="1" android:layout_width="fill_parent" android:layout_height="fill_parent">
+<TableRow android:id="@+id/TableRow01" android:layout_weight="1" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_margin="10dip">
<ScrollView android:id="@+id/helpscrollview"
@@ -48,12 +51,12 @@
android:layout_height="fill_parent"
android:layout_span="3">
- <TextView android:text="this is sample text this is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample text" android:background="#222222" android:textColor="#ffffff" android:id="@+id/WizardTextBody" android:textSize="8pt" android:layout_width="wrap_content" android:layout_height="wrap_content" android:padding="20dip"></TextView>
+ <TextView android:background="#575757" android:text="this is sample text this is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample text" android:textColor="#ffffff" android:id="@+id/WizardTextBody" android:textSize="8pt" android:layout_width="wrap_content" android:layout_height="wrap_content" android:padding="20dip"></TextView>
</ScrollView>
</TableRow>
-<TableRow android:id="@+id/TableRow01" android:textColor="#00ff00" android:layout_width="fill_parent" android:layout_height="30px">
+<TableRow android:background="#000000" android:id="@+id/TableRow01" android:textColor="#00ff00" android:layout_width="fill_parent" android:layout_height="30px" android:layout_marginTop="10dip" android:paddingTop="10dip">
<Button android:text="Back" android:id="@+id/btnWizard1" android:layout_weight="1" android:layout_width="fill_parent" android:layout_height="wrap_content"></Button>
<Button android:text="Next" android:id="@+id/btnWizard2" android:layout_weight="1" android:layout_width="fill_parent" android:layout_height="wrap_content"></Button>
</TableRow>
diff --git a/res/values/theme.xml b/res/values/theme.xml
new file mode 100644
index 0000000..efc15c4
--- /dev/null
+++ b/res/values/theme.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<resources>
+ <color name="custom_theme_color">#333</color>
+ <style name="DefaultTheme" parent="@android:style/Theme.Black.NoTitleBar">
+ <item name="android:windowBackground">@drawable/bgtitanium</item>
+ <item name="android:windowNoTitle">true</item>
+ </style>
+</resources>
diff --git a/src/org/torproject/android/ConfigureTransProxy.java b/src/org/torproject/android/ConfigureTransProxy.java
index 3f0f31c..4e9405b 100644
--- a/src/org/torproject/android/ConfigureTransProxy.java
+++ b/src/org/torproject/android/ConfigureTransProxy.java
@@ -81,22 +81,24 @@ public class ConfigureTransProxy extends Activity implements TorConstants {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
Editor pEdit = prefs.edit();
-
pEdit.putBoolean(PREF_TRANSPARENT, rb0.isChecked());
pEdit.putBoolean(PREF_TRANSPARENT_ALL, rb0.isChecked());
-
pEdit.commit();
+
+ if(rb0.isChecked())
+ {
+ pEdit.putString("radiobutton","rb0");
+ pEdit.commit();
+ }
-
- if(rb1.isChecked())
+ else if(rb1.isChecked())
{
flag = 1;
- SharedPreferences prefs1 = PreferenceManager.getDefaultSharedPreferences(context);
-
- Editor pEdit1 = prefs1.edit();
- pEdit1.putBoolean(PREF_TRANSPARENT, true);
- pEdit1.putBoolean(PREF_TRANSPARENT_ALL, false);
- pEdit1.commit();
+
+ pEdit.putBoolean(PREF_TRANSPARENT, true);
+ pEdit.putBoolean(PREF_TRANSPARENT_ALL, false);
+ pEdit.putString("radiobutton","rb1");
+ pEdit.commit();
next.setOnClickListener(new View.OnClickListener() {
@@ -109,7 +111,11 @@ public class ConfigureTransProxy extends Activity implements TorConstants {
}
});
}
-
+ else if(rb2.isChecked())
+ {
+ pEdit.putString("radiobutton", "rb2");
+ pEdit.commit();
+ }
}
});
@@ -127,7 +133,8 @@ public class ConfigureTransProxy extends Activity implements TorConstants {
});
next.setOnClickListener(new View.OnClickListener() {
-
+
+ //Dirty flag variable - improve logic
@Override
public void onClick(View v) {
if( flag == 1 )
@@ -152,8 +159,8 @@ public class ConfigureTransProxy extends Activity implements TorConstants {
@Override
public void onClick(DialogInterface dialog, int which) {
- //close wizard - return to orbot
-
+ context.startActivity(new Intent(context, Orbot.class));
+
}
};
@@ -164,7 +171,6 @@ public class ConfigureTransProxy extends Activity implements TorConstants {
.setPositiveButton(R.string.button_close, ocListener)
.setMessage(msg)
.show();
-
diff --git a/src/org/torproject/android/Permissions.java b/src/org/torproject/android/Permissions.java
index 4b74c55..1c5b10c 100644
--- a/src/org/torproject/android/Permissions.java
+++ b/src/org/torproject/android/Permissions.java
@@ -80,12 +80,10 @@ public class Permissions extends Activity implements TorConstants {
if (hasRoot)
{
- Toast.makeText(context, "Has Root", Toast.LENGTH_SHORT).show();
stepFourRoot();
}
else
{
- Toast.makeText(context, "Unable to get root access", Toast.LENGTH_LONG).show();
stepFour();
}
diff --git a/src/org/torproject/android/TipsAndTricks.java b/src/org/torproject/android/TipsAndTricks.java
index a3aa1ef..ebb5ad3 100644
--- a/src/org/torproject/android/TipsAndTricks.java
+++ b/src/org/torproject/android/TipsAndTricks.java
@@ -1,7 +1,9 @@
package org.torproject.android;
import android.app.Activity;
+import android.app.AlertDialog;
import android.content.Context;
+import android.content.DialogInterface;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
@@ -98,9 +100,40 @@ public class TipsAndTricks extends Activity implements TorConstants {
@Override
public void onClick(View v) {
- //Finsh Screen
+ showWizardFinal();
}
});
}
+
+ private void showWizardFinal ()
+ {
+ String title = null;
+ String msg = null;
+
+
+ title = context.getString(R.string.wizard_final);
+ msg = context.getString(R.string.wizard_final_msg);
+
+ DialogInterface.OnClickListener ocListener = new DialogInterface.OnClickListener() {
+
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ context.startActivity(new Intent(context, Orbot.class));
+
+ }
+ };
+
+
+ new AlertDialog.Builder(context)
+ .setIcon(R.drawable.icon)
+ .setTitle(title)
+ .setPositiveButton(R.string.button_close, ocListener)
+ .setMessage(msg)
+ .show();
+
+
+
+
+ }
}
\ No newline at end of file
commit 457bd78a46e52fbeae804b67b6f55501414f2f0b
Author: Sathyanarayanan Gunasekaran <gsathya.ceg@gmail.com>
Date: Sat Jun 11 03:45:32 2011 +0530
Calls new wizard onResume
diff --git a/src/org/torproject/android/Orbot.java b/src/org/torproject/android/Orbot.java
index 7f8af3b..f5f5f03 100644
--- a/src/org/torproject/android/Orbot.java
+++ b/src/org/torproject/android/Orbot.java
@@ -410,7 +410,7 @@ public class Orbot extends Activity implements OnLongClickListener, TorConstants
pEdit.commit();
- new WizardHelper(this).showWizard();
+ startActivityForResult(new Intent(getBaseContext(), LotsaText.class), 1);
}
commit 4ec2d483757016397b0bed92afdf7b14aab1af74
Author: Sathyanarayanan Gunasekaran <gsathya.ceg@gmail.com>
Date: Sat Jun 11 03:37:42 2011 +0530
Fixed resizing issues in AppManager activity
Fixed the sizes of the icons to be 50 dip in length
and width to prevent icons to be of different sizes.
diff --git a/res/layout/layout_apps_item.xml b/res/layout/layout_apps_item.xml
index 4993964..8b4fc34 100644
--- a/res/layout/layout_apps_item.xml
+++ b/res/layout/layout_apps_item.xml
@@ -5,7 +5,7 @@
android:layout_height="fill_parent"
android:stretchColumns="1">
<TableRow>
- <ImageView android:id="@+id/itemicon" android:layout_width="wrap_content" android:layout_height="wrap_content" android:padding="3dip"></ImageView>
+ <ImageView android:id="@+id/itemicon" android:layout_width="50dip" android:layout_height="50dip" android:padding="3dip"></ImageView>
<TextView android:layout_height="wrap_content" android:id="@+id/itemtext" android:text="uid:packages" android:textSize="18sp" android:padding="3dip"></TextView>
commit 870ce6a91d8072aa8169c7ce9bd6aadc9cb6a793
Author: Sathyanarayanan Gunasekaran <gsathya.ceg@gmail.com>
Date: Sat Jun 11 02:53:02 2011 +0530
Fixed CheckBox BUG
Previously, the "next" button was not disabled when the CheckBox
was unchecked. Changed it. Also, updated the logic inside the
CheckBox's listener.
diff --git a/src/org/torproject/android/Permissions.java b/src/org/torproject/android/Permissions.java
index 3b782df..4b74c55 100644
--- a/src/org/torproject/android/Permissions.java
+++ b/src/org/torproject/android/Permissions.java
@@ -113,7 +113,7 @@ public class Permissions extends Activity implements TorConstants {
Button back = ((Button)findViewById(R.id.btnWizard1));
Button next = ((Button)findViewById(R.id.btnWizard2));
- next.setClickable(false);
+ next.setEnabled(false);
CheckBox consent = (CheckBox)findViewById(R.id.checkBox);
consent.setVisibility(CheckBox.VISIBLE);
@@ -129,16 +129,16 @@ public class Permissions extends Activity implements TorConstants {
Editor pEdit = prefs.edit();
- pEdit.putBoolean(PREF_TRANSPARENT, isChecked);
- pEdit.putBoolean(PREF_TRANSPARENT_ALL, isChecked);
+ pEdit.putBoolean(PREF_TRANSPARENT, !isChecked);
+ pEdit.putBoolean(PREF_TRANSPARENT_ALL, !isChecked);
pEdit.commit();
Button next = ((Button)findViewById(R.id.btnWizard2));
if(isChecked)
- next.setClickable(true);
+ next.setEnabled(true);
else
- next.setClickable(false);
+ next.setEnabled(false);
}
@@ -166,7 +166,9 @@ public class Permissions extends Activity implements TorConstants {
}
});
- next.setOnClickListener(new View.OnClickListener() {
+
+ next.setOnClickListener(new View.OnClickListener() {
+
@Override
public void onClick(View v) {
@@ -178,7 +180,7 @@ public class Permissions extends Activity implements TorConstants {
private void stepFour(){
-
+ Toast.makeText(context, "NON ROOT FUNC", Toast.LENGTH_SHORT).show();
String title = context.getString(R.string.wizard_permissions_title);
String msg = context.getString(R.string.wizard_permissions_msg);
commit 0eb64792bf5911412758d0b73eff486c27172bb8
Author: Sathyanarayanan Gunasekaran <gsathya.ceg@gmail.com>
Date: Sat Jun 11 02:32:39 2011 +0530
Fixed wizard restart on rotation
Added a SharedPreference - "wizardscreen1" which when set to true
shows stepOne()(Intro screen) and shows stepTwo()(Warning screen)
when set to palse
diff --git a/src/org/torproject/android/LotsaText.java b/src/org/torproject/android/LotsaText.java
index e9fc556..43e6d16 100644
--- a/src/org/torproject/android/LotsaText.java
+++ b/src/org/torproject/android/LotsaText.java
@@ -3,7 +3,10 @@ package org.torproject.android;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
+import android.content.SharedPreferences;
+import android.content.SharedPreferences.Editor;
import android.os.Bundle;
+import android.preference.PreferenceManager;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
@@ -12,12 +15,14 @@ import android.widget.TextView;
public class LotsaText extends Activity implements TorConstants{
private Context context;
- private int step = -1;
protected void onCreate(Bundle savedInstanceState)
- {
+ {
+
+
super.onCreate(savedInstanceState);
context = this;
+
}
@@ -27,7 +32,13 @@ public class LotsaText extends Activity implements TorConstants{
super.onStart();
setContentView(R.layout.scrollingtext_buttons_view);
- stepOne();
+ SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
+
+ boolean wizardScreen1 = prefs.getBoolean("wizardscreen1",false);
+ if(wizardScreen1)
+ stepOne();
+ else
+ stepTwo();
}
@@ -39,19 +50,15 @@ public class LotsaText extends Activity implements TorConstants{
}
- /*public void startWizard(){
-
- switch(step){
-
- case -1 : stepOne();break;
-
- }
- }
- */
+
private void stepOne() {
+ SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
+
+ Editor pEdit = prefs.edit();
+ pEdit.putBoolean("wizardscreen1",true);
+ pEdit.commit();
- //setContentView(R.layout.scrollingtext_buttons_view);
String title = context.getString(R.string.wizard_title);
String msg = context.getString(R.string.wizard_title_msg);
@@ -79,7 +86,12 @@ public class LotsaText extends Activity implements TorConstants{
}
private void stepTwo() {
- step=0;
+
+ SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
+
+ Editor pEdit = prefs.edit();
+ pEdit.putBoolean("wizardscreen1",false);
+ pEdit.commit();
setContentView(R.layout.scrollingtext_buttons_view);
String title = context.getString(R.string.wizard_warning_title);
diff --git a/src/org/torproject/android/Orbot.java b/src/org/torproject/android/Orbot.java
index 383929d..7f8af3b 100644
--- a/src/org/torproject/android/Orbot.java
+++ b/src/org/torproject/android/Orbot.java
@@ -455,7 +455,12 @@ public class Orbot extends Activity implements OnLongClickListener, TorConstants
*/
private void showHelp ()
{
-
+
+ SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
+
+ Editor pEdit = prefs.edit();
+ pEdit.putBoolean("wizardscreen1",true);
+ pEdit.commit();
startActivityForResult(new Intent(getBaseContext(), LotsaText.class), 1);
}
diff --git a/src/org/torproject/android/Permissions.java b/src/org/torproject/android/Permissions.java
index a29b04a..3b782df 100644
--- a/src/org/torproject/android/Permissions.java
+++ b/src/org/torproject/android/Permissions.java
@@ -150,7 +150,7 @@ public class Permissions extends Activity implements TorConstants {
@Override
public void onClick(View v) {
- //Check and Install iptables - orTransProxy.testOwnerModule(this)
+ //Check and Install iptables - TorTransProxy.testOwnerModule(this)
startActivityForResult(new Intent(getBaseContext(), ConfigureTransProxy.class), 1);
diff --git a/src/org/torproject/android/WizardHelper.java b/src/org/torproject/android/WizardHelper.java
index 684a730..c85c50a 100644
--- a/src/org/torproject/android/WizardHelper.java
+++ b/src/org/torproject/android/WizardHelper.java
@@ -277,7 +277,7 @@ public class WizardHelper implements TorConstants {
public void showWizardRootConfigureTorification()
{
-
+ /*
LayoutInflater li = LayoutInflater.from(context);
View view = li.inflate(R.layout.layout_wizard_root, null);
@@ -347,7 +347,7 @@ public class WizardHelper implements TorConstants {
}
});
-
+ */
}
commit 791a6267df0b4e001cefea9a784de00b225676a5
Author: Sathyanarayanan Gunasekaran <gsathya.ceg@gmail.com>
Date: Fri Jun 10 01:25:01 2011 +0530
Updated Views
Added padding, formatting, etc to improve the design
of the various views.
diff --git a/res/layout/layout_wizard_permissions.xml b/res/layout/layout_wizard_permissions.xml
index 168968b..7926750 100644
--- a/res/layout/layout_wizard_permissions.xml
+++ b/res/layout/layout_wizard_permissions.xml
@@ -36,9 +36,9 @@
android:layout_height="fill_parent"
android:layout_span="3">
<LinearLayout android:layout_width="wrap_content" android:id="@+id/linearLayout1" android:layout_height="wrap_content" android:orientation="vertical">
- <TextView android:layout_width="wrap_content" android:textColor="#ffffff" android:layout_height="wrap_content" android:background="#222222" android:textSize="8pt" android:padding="6px" android:id="@+id/WizardTextBody1" android:text="this is sample text this is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample text"></TextView>
+ <TextView android:layout_width="wrap_content" android:textColor="#ffffff" android:layout_height="wrap_content" android:background="#222222" android:textSize="8pt" android:id="@+id/WizardTextBody1" android:text="this is sample text this is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample text" android:padding="20dip"></TextView>
<Button android:layout_width="wrap_content" android:visibility="gone" android:layout_height="wrap_content" android:gravity="center" android:text="Grant Permission" android:id="@+id/grantPermissions" android:layout_gravity="center"></Button>
- <TextView android:layout_width="wrap_content" android:visibility="gone" android:textColor="#ffffff" android:layout_height="wrap_content" android:background="#222222" android:textSize="8pt" android:padding="6px" android:id="@+id/WizardTextBody2" android:text="this is sample text this is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample text"></TextView>
+ <TextView android:layout_width="wrap_content" android:visibility="gone" android:textColor="#ffffff" android:layout_height="wrap_content" android:background="#222222" android:textSize="8pt" android:id="@+id/WizardTextBody2" android:text="this is sample text this is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample text" android:padding="20dip"></TextView>
<CheckBox android:id="@+id/checkBox" android:visibility="gone" android:layout_gravity="center" android:text="@string/wizard_permissions_consent" android:layout_height="wrap_content" android:layout_width="wrap_content"></CheckBox>
</LinearLayout>
diff --git a/res/layout/layout_wizard_root.xml b/res/layout/layout_wizard_root.xml
index afe6005..d038a96 100644
--- a/res/layout/layout_wizard_root.xml
+++ b/res/layout/layout_wizard_root.xml
@@ -40,7 +40,7 @@
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="3px">
-<TextView android:text="@string/wizard_transproxy_msg" android:textColor="#ffffff" android:id="@+id/WizardRootTextView01" android:layout_width="wrap_content" android:layout_height="wrap_content"></TextView>
+<TextView android:text="@string/wizard_transproxy_msg" android:layout_width="wrap_content" android:textColor="#ffffff" android:layout_height="wrap_content" android:background="#222222" android:textSize="8pt" android:id="@+id/WizardTextBody1" android:padding="20dip"></TextView>
<RadioGroup android:id="@+id/radioGroup" android:layout_height="wrap_content" android:layout_width="wrap_content">
<RadioButton android:checked="true" android:text="@string/wizard_configure_all" android:id="@+id/radio0" android:layout_height="wrap_content" android:layout_width="wrap_content"></RadioButton>
<TextView android:layout_height="wrap_content"
diff --git a/res/layout/layout_wizard_tips.xml b/res/layout/layout_wizard_tips.xml
index 420bc3c..a9c4d0b 100644
--- a/res/layout/layout_wizard_tips.xml
+++ b/res/layout/layout_wizard_tips.xml
@@ -41,8 +41,7 @@
android:layout_height="fill_parent"
android:padding="3px">
-<TextView android:text="@string/wizard_tips_msg" android:layout_gravity="left" android:textColor="#ffffff" android:id="@+id/TextView01" android:layout_width="wrap_content" android:layout_height="wrap_content"></TextView>
-
+<TextView android:text="@string/wizard_tips_msg" android:layout_width="wrap_content" android:textColor="#ffffff" android:layout_height="wrap_content" android:background="#222222" android:textSize="8pt" android:id="@+id/WizardTextBody1" android:padding="20dip"></TextView>
<Button android:text="@string/wizard_tips_gibberbot" android:layout_gravity="left" android:drawableLeft="@drawable/ic_launcher_gibberbot" android:layout_marginTop="10px" android:id="@+id/WizardRootButtonInstallGibberbot" android:layout_width="wrap_content" android:layout_height="wrap_content"/>
<Button android:text="@string/wizard_tips_firefox" android:layout_gravity="left" android:drawableLeft="@drawable/icon_firefox" android:layout_marginTop="10px" android:id="@+id/WizardRootButtonInstallFirefox" android:layout_width="wrap_content" android:layout_height="wrap_content"/>
diff --git a/res/layout/scrollingtext_buttons_view.xml b/res/layout/scrollingtext_buttons_view.xml
index 75b7925..04023ff 100644
--- a/res/layout/scrollingtext_buttons_view.xml
+++ b/res/layout/scrollingtext_buttons_view.xml
@@ -48,7 +48,7 @@
android:layout_height="fill_parent"
android:layout_span="3">
- <TextView android:text="this is sample text this is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample text" android:padding="6px" android:background="#222222" android:textColor="#ffffff" android:id="@+id/WizardTextBody" android:textSize="8pt" android:layout_width="wrap_content" android:layout_height="wrap_content"></TextView>
+ <TextView android:text="this is sample text this is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample text" android:background="#222222" android:textColor="#ffffff" android:id="@+id/WizardTextBody" android:textSize="8pt" android:layout_width="wrap_content" android:layout_height="wrap_content" android:padding="20dip"></TextView>
</ScrollView>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index af22a49..720c03c 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -127,10 +127,10 @@
<!-- New Wizard Strings -->
<!-- Title Screen -->
<string name="wizard_title">Orbot</string>
- <string name="wizard_title_msg">Orbot brings Tor to Android \nTor helps you defend against a form of network surveillance that threatens privacy, confidential business activity and relationships, and state security known as traffic analysis</string>
+ <string name="wizard_title_msg">Orbot brings Tor to Android \n\nTor helps you defend against a form of network surveillance that threatens privacy, confidential business activity and relationships, and state security known as traffic analysis</string>
<!-- Warning screen -->
<string name="wizard_warning_title">Warning</string>
- <string name="wizard_warning_msg">Simply installing Orbot will not automatically anonymize your mobile traffic.\nPlease follow the following steps to get started</string>
+ <string name="wizard_warning_msg">Simply installing Orbot will not automatically anonymize your mobile traffic.\n\nPlease follow the following steps to get started</string>
<!-- Permissions screen -->
<string name="wizard_permissions_title">Permissions</string>
<string name="wizard_permissions_root_msg1">Orbot has detected that you have root permissions enabled. To enable \'Transparent Proxying\', please grant superuser privileges to Orbot</string>
commit 4f333e370d68a3606a0f39c5a610276d959ce00d
Author: Sathyanarayanan Gunasekaran <gsathya.ceg@gmail.com>
Date: Fri Jun 10 00:31:35 2011 +0530
Updated Permissions and Transproxy screens
Included a checkbox in Permission screen to account for
users who do not wish to grant root permissions.
Updated radio buttons in Transproxy screen
diff --git a/res/layout/layout_wizard_permissions.xml b/res/layout/layout_wizard_permissions.xml
index f7ecab8..168968b 100644
--- a/res/layout/layout_wizard_permissions.xml
+++ b/res/layout/layout_wizard_permissions.xml
@@ -39,6 +39,7 @@
<TextView android:layout_width="wrap_content" android:textColor="#ffffff" android:layout_height="wrap_content" android:background="#222222" android:textSize="8pt" android:padding="6px" android:id="@+id/WizardTextBody1" android:text="this is sample text this is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample text"></TextView>
<Button android:layout_width="wrap_content" android:visibility="gone" android:layout_height="wrap_content" android:gravity="center" android:text="Grant Permission" android:id="@+id/grantPermissions" android:layout_gravity="center"></Button>
<TextView android:layout_width="wrap_content" android:visibility="gone" android:textColor="#ffffff" android:layout_height="wrap_content" android:background="#222222" android:textSize="8pt" android:padding="6px" android:id="@+id/WizardTextBody2" android:text="this is sample text this is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample text"></TextView>
+ <CheckBox android:id="@+id/checkBox" android:visibility="gone" android:layout_gravity="center" android:text="@string/wizard_permissions_consent" android:layout_height="wrap_content" android:layout_width="wrap_content"></CheckBox>
</LinearLayout>
</ScrollView>
diff --git a/res/layout/layout_wizard_root.xml b/res/layout/layout_wizard_root.xml
index 62afa38..afe6005 100644
--- a/res/layout/layout_wizard_root.xml
+++ b/res/layout/layout_wizard_root.xml
@@ -41,12 +41,17 @@
android:layout_height="fill_parent"
android:padding="3px">
<TextView android:text="@string/wizard_transproxy_msg" android:textColor="#ffffff" android:id="@+id/WizardRootTextView01" android:layout_width="wrap_content" android:layout_height="wrap_content"></TextView>
-
-
-<CheckBox android:layout_marginTop="20px" android:text="@string/wizard_configure_all" android:id="@+id/WizardRootCheckBox01" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center"></CheckBox>
-<TextView android:text="@string/wizard_transproxy_hint" android:textColor="#ffffff" android:layout_width="wrap_content" android:layout_height="wrap_content" android:paddingBottom="20dip"></TextView>
-
-<Button android:text="@string/wizard_configure_select_apps" android:id="@+id/WizardRootButton01" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center"/>
+<RadioGroup android:id="@+id/radioGroup" android:layout_height="wrap_content" android:layout_width="wrap_content">
+ <RadioButton android:checked="true" android:text="@string/wizard_configure_all" android:id="@+id/radio0" android:layout_height="wrap_content" android:layout_width="wrap_content"></RadioButton>
+ <TextView android:layout_height="wrap_content"
+ android:text="@string/wizard_transproxy_hint"
+ android:layout_width="wrap_content"
+ android:textSize="15sp"
+ android:paddingBottom="10dip">
+ </TextView>
+ <RadioButton android:text="@string/wizard_configure_select_apps" android:id="@+id/radio1" android:layout_height="wrap_content" android:layout_width="wrap_content"></RadioButton>
+ <RadioButton android:text="@string/wizard_transproxy_none" android:id="@+id/radio2" android:layout_height="wrap_content" android:layout_width="wrap_content"></RadioButton>
+</RadioGroup>
</LinearLayout>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index daf8f3c..af22a49 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -88,7 +88,6 @@
<string name="wizard_permissions_msg_stock"> While it is not required, Orbot can become a more powerful tool if your device has root access. Use the button below to grant Orbot superpowers! </string>
<string name="wizard_permissions_no_root">If you don\'t have root access or have no idea what we\'re talking about, just be sure to use apps made to work with Orbot.</string>
- <string name="wizard_permissions_consent">I understand and would like to continue without root</string>
<string name="wizard_permission_enable_root">Grant Root for Orbot</string>
<string name="wizard_configure">Configure Torification</string>
@@ -137,6 +136,7 @@
<string name="wizard_permissions_root_msg1">Orbot has detected that you have root permissions enabled. To enable \'Transparent Proxying\', please grant superuser privileges to Orbot</string>
<string name="wizard_permissions_root_msg2">If you choose to continue without providing superuser privileges, make sure to use apps made to work with orbot</string>
<string name="wizard_permissions_msg">Orbot has detected that you do not have root permissions.\nTransparent Proxying is not possible without superuser privileges.\nMake sure to use apps that have been configured to work with Orbot</string>
+ <string name="wizard_permissions_consent">I understand and would like to continue without root</string>
<!-- TipsAndTricks screen -->
<string name="wizard_tips_title">Orbot configured Apps</string>
<string name="wizard_tips_gibberbot">Gibberbot - Secure instant messaging client for Android</string>
diff --git a/src/org/torproject/android/ConfigureTransProxy.java b/src/org/torproject/android/ConfigureTransProxy.java
index 3969dbb..3f0f31c 100644
--- a/src/org/torproject/android/ConfigureTransProxy.java
+++ b/src/org/torproject/android/ConfigureTransProxy.java
@@ -24,7 +24,8 @@ import android.widget.Toast;
public class ConfigureTransProxy extends Activity implements TorConstants {
private Context context;
- private int flag =0;
+ private int flag = 0;
+
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
@@ -63,8 +64,15 @@ public class ConfigureTransProxy extends Activity implements TorConstants {
@Override
public void onCheckedChanged(RadioGroup group, int checkedId){
-
- flag = 0;
+ Button next = ((Button)findViewById(R.id.btnWizard2));
+ next.setOnClickListener(new View.OnClickListener() {
+
+ @Override
+ public void onClick(View v) {
+
+ showWizardFinal();
+ }
+ });
RadioButton rb0 = (RadioButton)findViewById(R.id.radio0);
RadioButton rb1 = (RadioButton)findViewById(R.id.radio1);
@@ -90,6 +98,16 @@ public class ConfigureTransProxy extends Activity implements TorConstants {
pEdit1.putBoolean(PREF_TRANSPARENT_ALL, false);
pEdit1.commit();
+ next.setOnClickListener(new View.OnClickListener() {
+
+ @Override
+ public void onClick(View v) {
+
+ context.startActivity(new Intent(context, AppManager.class));
+
+
+ }
+ });
}
diff --git a/src/org/torproject/android/Permissions.java b/src/org/torproject/android/Permissions.java
index a37d3c3..a29b04a 100644
--- a/src/org/torproject/android/Permissions.java
+++ b/src/org/torproject/android/Permissions.java
@@ -14,6 +14,9 @@ import android.preference.PreferenceManager;
import android.util.Log;
import android.view.View;
import android.widget.Button;
+import android.widget.CheckBox;
+import android.widget.CompoundButton;
+import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.TextView;
import android.widget.Toast;
@@ -110,6 +113,38 @@ public class Permissions extends Activity implements TorConstants {
Button back = ((Button)findViewById(R.id.btnWizard1));
Button next = ((Button)findViewById(R.id.btnWizard2));
+ next.setClickable(false);
+
+ CheckBox consent = (CheckBox)findViewById(R.id.checkBox);
+ consent.setVisibility(CheckBox.VISIBLE);
+
+ consent.setOnCheckedChangeListener(new OnCheckedChangeListener (){
+
+ @Override
+ public void onCheckedChanged(CompoundButton buttonView,
+ boolean isChecked) {
+
+
+ SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
+
+ Editor pEdit = prefs.edit();
+
+ pEdit.putBoolean(PREF_TRANSPARENT, isChecked);
+ pEdit.putBoolean(PREF_TRANSPARENT_ALL, isChecked);
+
+ pEdit.commit();
+
+ Button next = ((Button)findViewById(R.id.btnWizard2));
+ if(isChecked)
+ next.setClickable(true);
+ else
+ next.setClickable(false);
+
+
+ }
+
+ });
+
grantPermissions.setOnClickListener(new View.OnClickListener() {
commit 026a7ca4c91b2cb56008d46ac0d6b612d7f58681
Author: Sathyanarayanan Gunasekaran <gsathya.ceg@gmail.com>
Date: Thu Jun 9 20:35:56 2011 +0530
Added proxymob icon for TipsAndTricks Screen
diff --git a/res/drawable/proxymob.png b/res/drawable/proxymob.png
new file mode 100644
index 0000000..6e23219
Binary files /dev/null and b/res/drawable/proxymob.png differ
diff --git a/res/layout/layout_wizard_tips.xml b/res/layout/layout_wizard_tips.xml
index 6a304ca..420bc3c 100644
--- a/res/layout/layout_wizard_tips.xml
+++ b/res/layout/layout_wizard_tips.xml
@@ -47,7 +47,7 @@
<Button android:text="@string/wizard_tips_firefox" android:layout_gravity="left" android:drawableLeft="@drawable/icon_firefox" android:layout_marginTop="10px" android:id="@+id/WizardRootButtonInstallFirefox" android:layout_width="wrap_content" android:layout_height="wrap_content"/>
-<Button android:text="@string/wizard_tips_proxymob" android:layout_marginTop="10px" android:id="@+id/WizardRootButtonInstallProxyMob" android:layout_width="wrap_content" android:layout_height="wrap_content"/>
+<Button android:text="@string/wizard_tips_proxymob" android:layout_marginTop="10px" android:drawableLeft="@drawable/proxymob" android:id="@+id/WizardRootButtonInstallProxyMob" android:layout_width="wrap_content" android:layout_height="wrap_content"/>
</LinearLayout>
</ScrollView>
commit 86727d6298766816bccbd5f58e91fd58f6846786
Author: Sathyanarayanan Gunasekaran <gsathya.ceg@gmail.com>
Date: Thu Jun 9 01:31:32 2011 +0530
Updated Transproxy screen
diff --git a/res/values/strings.xml b/res/values/strings.xml
index da4cca3..daf8f3c 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -149,4 +149,5 @@
<string name="wizard_transproxy_title">Transparent Proxy</string>
<string name="wizard_transproxy_msg">Transparent Proxying allows you to redirect client requests without any special configuration or knowledge at the client.</string>
<string name="wizard_transproxy_hint">(Check this box if you have no idea what we are talking about)</string>
+ <string name="wizard_transproxy_none">None</string>
</resources>
diff --git a/src/org/torproject/android/ConfigureTransProxy.java b/src/org/torproject/android/ConfigureTransProxy.java
index 8ff6dad..3969dbb 100644
--- a/src/org/torproject/android/ConfigureTransProxy.java
+++ b/src/org/torproject/android/ConfigureTransProxy.java
@@ -15,13 +15,16 @@ import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
+import android.widget.RadioButton;
+import android.widget.RadioGroup;
import android.widget.TextView;
import android.widget.CompoundButton.OnCheckedChangeListener;
+import android.widget.Toast;
public class ConfigureTransProxy extends Activity implements TorConstants {
private Context context;
-
+ private int flag =0;
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
@@ -46,55 +49,53 @@ public class ConfigureTransProxy extends Activity implements TorConstants {
}
+
+
private void stepSix(){
String title = context.getString(R.string.wizard_transproxy_title);
TextView txtTitle = ((TextView)findViewById(R.id.WizardTextTitle));
txtTitle.setText(title);
- CheckBox cb1 = (CheckBox)findViewById(R.id.WizardRootCheckBox01);
- Button btn1 = (Button)findViewById(R.id.WizardRootButton01);
+ RadioGroup mRadioGroup = (RadioGroup)findViewById(R.id.radioGroup);
+ mRadioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener (){
+
- cb1.setOnCheckedChangeListener(new OnCheckedChangeListener (){
+ @Override
+ public void onCheckedChanged(RadioGroup group, int checkedId){
+
+ flag = 0;
+
+ RadioButton rb0 = (RadioButton)findViewById(R.id.radio0);
+ RadioButton rb1 = (RadioButton)findViewById(R.id.radio1);
+ RadioButton rb2 = (RadioButton)findViewById(R.id.radio2);
- @Override
- public void onCheckedChanged(CompoundButton buttonView,
- boolean isChecked) {
-
-
- SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
+ SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
Editor pEdit = prefs.edit();
-
- pEdit.putBoolean(PREF_TRANSPARENT, isChecked);
- pEdit.putBoolean(PREF_TRANSPARENT_ALL, isChecked);
-
+
+ pEdit.putBoolean(PREF_TRANSPARENT, rb0.isChecked());
+ pEdit.putBoolean(PREF_TRANSPARENT_ALL, rb0.isChecked());
+
pEdit.commit();
-
- }
-
+
+
+ if(rb1.isChecked())
+ {
+ flag = 1;
+ SharedPreferences prefs1 = PreferenceManager.getDefaultSharedPreferences(context);
+
+ Editor pEdit1 = prefs1.edit();
+ pEdit1.putBoolean(PREF_TRANSPARENT, true);
+ pEdit1.putBoolean(PREF_TRANSPARENT_ALL, false);
+ pEdit1.commit();
+
+ }
+
+
+ }
});
-
-
-
- btn1.setOnClickListener(new OnClickListener() {
-
- @Override
- public void onClick(View view) {
-
-
- SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
- Editor pEdit = prefs.edit();
- pEdit.putBoolean(PREF_TRANSPARENT, true);
- pEdit.putBoolean(PREF_TRANSPARENT_ALL, false);
- pEdit.commit();
-
- context.startActivity(new Intent(context, AppManager.class));
-
- }
- });
-
Button back = ((Button)findViewById(R.id.btnWizard1));
Button next = ((Button)findViewById(R.id.btnWizard2));
@@ -111,7 +112,11 @@ public class ConfigureTransProxy extends Activity implements TorConstants {
@Override
public void onClick(View v) {
- showWizardFinal();
+ if( flag == 1 )
+ context.startActivity(new Intent(context, AppManager.class));
+
+ else
+ showWizardFinal();
}
});
}
diff --git a/src/org/torproject/android/Permissions.java b/src/org/torproject/android/Permissions.java
index 248fd96..a37d3c3 100644
--- a/src/org/torproject/android/Permissions.java
+++ b/src/org/torproject/android/Permissions.java
@@ -115,7 +115,7 @@ public class Permissions extends Activity implements TorConstants {
@Override
public void onClick(View v) {
- //Check and Install iptables
+ //Check and Install iptables - orTransProxy.testOwnerModule(this)
startActivityForResult(new Intent(getBaseContext(), ConfigureTransProxy.class), 1);
commit e7453b7f0be28c84c2f89da0ec321ad33c8a1719
Author: Sathyanarayanan Gunasekaran <gsathya.ceg@gmail.com>
Date: Wed Jun 8 00:32:59 2011 +0530
TransProxy screen added
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index ad48d9d..030bbff 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -32,6 +32,7 @@
<activity android:name=".LotsaText"/>
<activity android:name=".Permissions"/>
<activity android:name=".TipsAndTricks"/>
+ <activity android:name=".ConfigureTransProxy"/>
<activity android:name=".SettingsPreferences" android:label="@string/app_name"/>
<activity android:name=".AppManager" android:label="@string/app_name"/>
<activity android:name=".WizardActivity" android:label="@string/app_name"/>
diff --git a/res/layout/layout_wizard_permissions.xml b/res/layout/layout_wizard_permissions.xml
index b861d7a..f7ecab8 100644
--- a/res/layout/layout_wizard_permissions.xml
+++ b/res/layout/layout_wizard_permissions.xml
@@ -11,19 +11,10 @@
android:layout_height="wrap_content"
android:id="@+id/relativeLayout1"
android:layout_gravity="center_horizontal">
- <ImageView
- android:src="@drawable/tor"
- android:visibility="invisible"
- android:id="@+id/orbot_image"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_alignParentLeft="true"
- android:paddingLeft="20px" android:paddingRight="20px" >
- </ImageView>
+
<TextView android:textSize="10pt"
- android:layout_toRightOf="@id/orbot_image"
+
android:layout_alignParentTop="true"
- android:gravity="center_vertical"
android:layout_height="wrap_content"
android:id="@+id/WizardTextTitle"
android:layout_width="wrap_content"
@@ -31,11 +22,7 @@
android:text="TITLE"
android:textColor="#00ff00"
android:singleLine="true"
-
-
-
- android:layout_centerInParent="true"
- android:padding="20px">
+ android:padding="20px" android:layout_centerInParent="true">
</TextView>
</RelativeLayout>
<TableLayout android:id="@+id/TableLayout01" android:stretchColumns="*" android:layout_height="fill_parent" android:layout_width="wrap_content">
diff --git a/res/layout/layout_wizard_root.xml b/res/layout/layout_wizard_root.xml
index f71c284..62afa38 100644
--- a/res/layout/layout_wizard_root.xml
+++ b/res/layout/layout_wizard_root.xml
@@ -1,29 +1,64 @@
<?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="wrap_content">
+ android:layout_height="fill_parent"
+ android:background="@drawable/background">
+
+<RelativeLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:id="@+id/relativeLayout1"
+ android:layout_gravity="center_horizontal">
+ <TextView android:textSize="10pt"
+
+ android:layout_alignParentTop="true"
+ android:layout_height="wrap_content"
+ android:id="@+id/WizardTextTitle"
+ android:layout_width="wrap_content"
+ android:fadingEdge="vertical"
+ android:text="TITLE"
+ android:textColor="#00ff00"
+ android:singleLine="true"
+ android:padding="20px" android:layout_centerInParent="true">
+ </TextView>
+ </RelativeLayout>
+<TableLayout android:id="@+id/TableLayout01" android:stretchColumns="*" android:layout_height="fill_parent" android:layout_width="wrap_content">
+
+<TableRow android:id="@+id/TableRow01" android:layout_weight="1" android:layout_width="fill_parent" android:layout_height="fill_parent">
+
+
<ScrollView android:id="@+id/helpscrollview"
android:orientation="vertical"
android:layout_width="fill_parent"
- android:layout_height="fill_parent">
- <LinearLayout
+ android:layout_height="fill_parent"
+ android:layout_span="3">
+
+<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="3px">
-<TextView android:text="@string/wizard_configure_msg" android:textColor="#ffffff" android:id="@+id/WizardRootTextView01" android:layout_width="wrap_content" android:layout_height="wrap_content"></TextView>
+<TextView android:text="@string/wizard_transproxy_msg" android:textColor="#ffffff" android:id="@+id/WizardRootTextView01" android:layout_width="wrap_content" android:layout_height="wrap_content"></TextView>
-<CheckBox android:layout_marginTop="20px" android:text="@string/wizard_configure_all" android:id="@+id/WizardRootCheckBox01" android:layout_width="wrap_content" android:layout_height="wrap_content"></CheckBox>
-<TextView android:text=" or " android:textColor="#ffffff" android:layout_width="wrap_content" android:layout_height="wrap_content"></TextView>
+<CheckBox android:layout_marginTop="20px" android:text="@string/wizard_configure_all" android:id="@+id/WizardRootCheckBox01" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center"></CheckBox>
+<TextView android:text="@string/wizard_transproxy_hint" android:textColor="#ffffff" android:layout_width="wrap_content" android:layout_height="wrap_content" android:paddingBottom="20dip"></TextView>
-<Button android:text="@string/wizard_configure_select_apps" android:id="@+id/WizardRootButton01" android:layout_width="wrap_content" android:layout_height="wrap_content"/>
+<Button android:text="@string/wizard_configure_select_apps" android:id="@+id/WizardRootButton01" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center"/>
</LinearLayout>
- </ScrollView>
+ </ScrollView>
+
+</TableRow>
+<TableRow android:id="@+id/TableRow01" android:textColor="#00ff00" android:layout_width="fill_parent" android:layout_height="30px">
+ <Button android:text="Back" android:id="@+id/btnWizard1" android:layout_weight="1" android:layout_width="fill_parent" android:layout_height="wrap_content"></Button>
+ <Button android:text="Next" android:id="@+id/btnWizard2" android:layout_weight="1" android:layout_width="fill_parent" android:layout_height="wrap_content"></Button>
+</TableRow>
+</TableLayout>
</LinearLayout>
+
+
diff --git a/res/layout/layout_wizard_tips.xml b/res/layout/layout_wizard_tips.xml
index 60cba51..6a304ca 100644
--- a/res/layout/layout_wizard_tips.xml
+++ b/res/layout/layout_wizard_tips.xml
@@ -11,18 +11,9 @@
android:layout_height="wrap_content"
android:id="@+id/relativeLayout1"
android:layout_gravity="center_horizontal">
- <ImageView
- android:src="@drawable/tor"
- android:id="@+id/orbot_image"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_alignParentLeft="true"
- android:paddingLeft="20px" android:paddingRight="20px" >
- </ImageView>
- <TextView android:textSize="10pt"
- android:layout_toRightOf="@id/orbot_image"
+ <TextView android:textSize="10pt"
+
android:layout_alignParentTop="true"
- android:gravity="center_vertical"
android:layout_height="wrap_content"
android:id="@+id/WizardTextTitle"
android:layout_width="wrap_content"
@@ -30,11 +21,7 @@
android:text="TITLE"
android:textColor="#00ff00"
android:singleLine="true"
-
-
-
- android:layout_centerInParent="true"
- android:padding="20px">
+ android:padding="20px" android:layout_centerInParent="true">
</TextView>
</RelativeLayout>
<TableLayout android:id="@+id/TableLayout01" android:stretchColumns="*" android:layout_height="fill_parent" android:layout_width="wrap_content">
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 0bf8286..da4cca3 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -145,5 +145,8 @@
<string name="gibberbot_apk_url">https://market.android.com/details?id=info.guardianproject.otr.app.im</string>
<string name="firefox_apk_url">https://market.android.com/details?id=org.mozilla.firefox</string>
<string name="proxymob_url">https://addons.mozilla.org/mobile/downloads/latest/251558/type:attachment/addon-251558-latest.xpi?src=addon-detail</string>
-
+ <!-- Transparent Proxy screen -->
+ <string name="wizard_transproxy_title">Transparent Proxy</string>
+ <string name="wizard_transproxy_msg">Transparent Proxying allows you to redirect client requests without any special configuration or knowledge at the client.</string>
+ <string name="wizard_transproxy_hint">(Check this box if you have no idea what we are talking about)</string>
</resources>
diff --git a/src/org/torproject/android/ConfigureTransProxy.java b/src/org/torproject/android/ConfigureTransProxy.java
new file mode 100644
index 0000000..8ff6dad
--- /dev/null
+++ b/src/org/torproject/android/ConfigureTransProxy.java
@@ -0,0 +1,150 @@
+package org.torproject.android;
+
+import android.app.Activity;
+import android.app.AlertDialog;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.content.Intent;
+import android.content.SharedPreferences;
+import android.content.SharedPreferences.Editor;
+import android.net.Uri;
+import android.os.Bundle;
+import android.preference.PreferenceManager;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.widget.Button;
+import android.widget.CheckBox;
+import android.widget.CompoundButton;
+import android.widget.TextView;
+import android.widget.CompoundButton.OnCheckedChangeListener;
+
+public class ConfigureTransProxy extends Activity implements TorConstants {
+
+ private Context context;
+
+ protected void onCreate(Bundle savedInstanceState)
+ {
+ super.onCreate(savedInstanceState);
+ context = this;
+
+ }
+
+ @Override
+ protected void onStart() {
+
+ super.onStart();
+ setContentView(R.layout.layout_wizard_root);
+
+ stepSix();
+
+ }
+
+ @Override
+ protected void onResume() {
+ super.onResume();
+
+
+ }
+
+ private void stepSix(){
+
+ String title = context.getString(R.string.wizard_transproxy_title);
+ TextView txtTitle = ((TextView)findViewById(R.id.WizardTextTitle));
+ txtTitle.setText(title);
+
+ CheckBox cb1 = (CheckBox)findViewById(R.id.WizardRootCheckBox01);
+ Button btn1 = (Button)findViewById(R.id.WizardRootButton01);
+
+ cb1.setOnCheckedChangeListener(new OnCheckedChangeListener (){
+
+ @Override
+ public void onCheckedChanged(CompoundButton buttonView,
+ boolean isChecked) {
+
+
+ SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
+
+ Editor pEdit = prefs.edit();
+
+ pEdit.putBoolean(PREF_TRANSPARENT, isChecked);
+ pEdit.putBoolean(PREF_TRANSPARENT_ALL, isChecked);
+
+ pEdit.commit();
+
+ }
+
+ });
+
+
+
+ btn1.setOnClickListener(new OnClickListener() {
+
+ @Override
+ public void onClick(View view) {
+
+
+ SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
+
+ Editor pEdit = prefs.edit();
+ pEdit.putBoolean(PREF_TRANSPARENT, true);
+ pEdit.putBoolean(PREF_TRANSPARENT_ALL, false);
+ pEdit.commit();
+
+ context.startActivity(new Intent(context, AppManager.class));
+
+ }
+ });
+
+ Button back = ((Button)findViewById(R.id.btnWizard1));
+ Button next = ((Button)findViewById(R.id.btnWizard2));
+
+ back.setOnClickListener(new View.OnClickListener() {
+
+ @Override
+ public void onClick(View v) {
+
+ startActivityForResult(new Intent(getBaseContext(), Permissions.class), 1);
+ }
+ });
+
+ next.setOnClickListener(new View.OnClickListener() {
+
+ @Override
+ public void onClick(View v) {
+ showWizardFinal();
+ }
+ });
+ }
+
+ private void showWizardFinal ()
+ {
+ String title = null;
+ String msg = null;
+
+
+ title = context.getString(R.string.wizard_final);
+ msg = context.getString(R.string.wizard_final_msg);
+
+ DialogInterface.OnClickListener ocListener = new DialogInterface.OnClickListener() {
+
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ //close wizard - return to orbot
+
+ }
+ };
+
+
+ new AlertDialog.Builder(context)
+ .setIcon(R.drawable.icon)
+ .setTitle(title)
+ .setPositiveButton(R.string.button_close, ocListener)
+ .setMessage(msg)
+ .show();
+
+
+
+
+
+ }
+}
\ No newline at end of file
diff --git a/src/org/torproject/android/Permissions.java b/src/org/torproject/android/Permissions.java
index 996a1dc..248fd96 100644
--- a/src/org/torproject/android/Permissions.java
+++ b/src/org/torproject/android/Permissions.java
@@ -116,6 +116,8 @@ public class Permissions extends Activity implements TorConstants {
@Override
public void onClick(View v) {
//Check and Install iptables
+ startActivityForResult(new Intent(getBaseContext(), ConfigureTransProxy.class), 1);
+
}
});
commit 991b2d72706f093852ddbf54cef5a27b6d53dc99
Author: Sathyanarayanan Gunasekaran <gsathya.ceg@gmail.com>
Date: Tue Jun 7 13:04:09 2011 +0530
Added missing icons
diff --git a/res/drawable/icon_firefox.png b/res/drawable/icon_firefox.png
new file mode 100644
index 0000000..27b0cf4
Binary files /dev/null and b/res/drawable/icon_firefox.png differ
diff --git a/res/drawable/icon_orweb.png b/res/drawable/icon_orweb.png
deleted file mode 100755
index 679986f..0000000
Binary files a/res/drawable/icon_orweb.png and /dev/null differ
commit c9c35ead48b0453458e91b64810bb3971ff195d1
Author: Sathyanarayanan Gunasekaran <gsathya.ceg@gmail.com>
Date: Mon Jun 6 02:39:52 2011 +0530
Updated AndroidManifest, Tips Screen
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index be3c43f..ad48d9d 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -31,6 +31,7 @@
<activity android:name=".LotsaText"/>
<activity android:name=".Permissions"/>
+ <activity android:name=".TipsAndTricks"/>
<activity android:name=".SettingsPreferences" android:label="@string/app_name"/>
<activity android:name=".AppManager" android:label="@string/app_name"/>
<activity android:name=".WizardActivity" android:label="@string/app_name"/>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 25e253d..0bf8286 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -138,6 +138,7 @@
<string name="wizard_permissions_root_msg2">If you choose to continue without providing superuser privileges, make sure to use apps made to work with orbot</string>
<string name="wizard_permissions_msg">Orbot has detected that you do not have root permissions.\nTransparent Proxying is not possible without superuser privileges.\nMake sure to use apps that have been configured to work with Orbot</string>
<!-- TipsAndTricks screen -->
+ <string name="wizard_tips_title">Orbot configured Apps</string>
<string name="wizard_tips_gibberbot">Gibberbot - Secure instant messaging client for Android</string>
<string name="wizard_tips_firefox">Firefox - Android browser - To be used along with ProxyMob Add-on </string>
<string name="wizard_tips_proxymob">ProxyMob - Simple Firefox Add-on for setting HTTP, SOCKS and SSL proxy settings</string>
diff --git a/src/org/torproject/android/TipsAndTricks.java b/src/org/torproject/android/TipsAndTricks.java
index c4aba96..a3aa1ef 100644
--- a/src/org/torproject/android/TipsAndTricks.java
+++ b/src/org/torproject/android/TipsAndTricks.java
@@ -8,6 +8,7 @@ import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
+import android.widget.TextView;
public class TipsAndTricks extends Activity implements TorConstants {
@@ -26,7 +27,7 @@ public class TipsAndTricks extends Activity implements TorConstants {
super.onStart();
setContentView(R.layout.layout_wizard_tips);
- //stepFive();
+ stepFive();
}
@@ -39,8 +40,10 @@ public class TipsAndTricks extends Activity implements TorConstants {
void stepFive(){
-
-
+ String title = context.getString(R.string.wizard_tips_title);
+ TextView txtTitle = ((TextView)findViewById(R.id.WizardTextTitle));
+ txtTitle.setText(title);
+
Button btn1 = (Button)findViewById(R.id.WizardRootButtonInstallGibberbot);
btn1.setOnClickListener(new OnClickListener() {
diff --git a/src/org/torproject/android/WizardHelper.java b/src/org/torproject/android/WizardHelper.java
index c3fa3c0..684a730 100644
--- a/src/org/torproject/android/WizardHelper.java
+++ b/src/org/torproject/android/WizardHelper.java
@@ -215,7 +215,7 @@ public class WizardHelper implements TorConstants {
LayoutInflater li = LayoutInflater.from(context);
View view = li.inflate(R.layout.layout_wizard_tips, null);
- Button btn1 = (Button)view.findViewById(R.id.WizardRootButtonInstallOtrchat);
+ Button btn1 = (Button)view.findViewById(R.id.WizardRootButtonInstallGibberbot);
btn1.setOnClickListener(new OnClickListener() {
@@ -228,7 +228,7 @@ public class WizardHelper implements TorConstants {
}
});
- Button btn2 = (Button)view.findViewById(R.id.WizardRootButtonInstallOrweb);
+ Button btn2 = (Button)view.findViewById(R.id.WizardRootButtonInstallFirefox);
btn2.setOnClickListener(new OnClickListener() {
@@ -241,7 +241,7 @@ public class WizardHelper implements TorConstants {
}
});
- Button btn3 = (Button)view.findViewById(R.id.WizardRootButtonProxyHelp);
+ Button btn3 = (Button)view.findViewById(R.id.WizardRootButtonInstallProxyMob);
btn3.setOnClickListener(new OnClickListener() {
commit 22118bc38280bdf3d375018dac1c0de743b75ec0
Author: Sathyanarayanan Gunasekaran <gsathya.ceg@gmail.com>
Date: Mon Jun 6 02:25:18 2011 +0530
Tips and Tricks screen added
diff --git a/res/drawable/icon_otrchat.png b/res/drawable/icon_otrchat.png
deleted file mode 100755
index 08171ab..0000000
Binary files a/res/drawable/icon_otrchat.png and /dev/null differ
diff --git a/res/layout/layout_wizard_tips.xml b/res/layout/layout_wizard_tips.xml
index 19aaef0..60cba51 100644
--- a/res/layout/layout_wizard_tips.xml
+++ b/res/layout/layout_wizard_tips.xml
@@ -1,15 +1,54 @@
<?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="wrap_content">
+ android:layout_height="fill_parent"
+ android:background="@drawable/background">
+
+<RelativeLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:id="@+id/relativeLayout1"
+ android:layout_gravity="center_horizontal">
+ <ImageView
+ android:src="@drawable/tor"
+ android:id="@+id/orbot_image"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_alignParentLeft="true"
+ android:paddingLeft="20px" android:paddingRight="20px" >
+ </ImageView>
+ <TextView android:textSize="10pt"
+ android:layout_toRightOf="@id/orbot_image"
+ android:layout_alignParentTop="true"
+ android:gravity="center_vertical"
+ android:layout_height="wrap_content"
+ android:id="@+id/WizardTextTitle"
+ android:layout_width="wrap_content"
+ android:fadingEdge="vertical"
+ android:text="TITLE"
+ android:textColor="#00ff00"
+ android:singleLine="true"
+
+
+
+ android:layout_centerInParent="true"
+ android:padding="20px">
+ </TextView>
+ </RelativeLayout>
+<TableLayout android:id="@+id/TableLayout01" android:stretchColumns="*" android:layout_height="fill_parent" android:layout_width="wrap_content">
+
+<TableRow android:id="@+id/TableRow01" android:layout_weight="1" android:layout_width="fill_parent" android:layout_height="fill_parent">
+
+
<ScrollView android:id="@+id/helpscrollview"
android:orientation="vertical"
android:layout_width="fill_parent"
- android:layout_height="fill_parent">
- <LinearLayout
+ android:layout_height="fill_parent"
+ android:layout_span="3">
+
+<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
@@ -17,13 +56,21 @@
<TextView android:text="@string/wizard_tips_msg" android:layout_gravity="left" android:textColor="#ffffff" android:id="@+id/TextView01" android:layout_width="wrap_content" android:layout_height="wrap_content"></TextView>
-<Button android:text="@string/wizard_tips_otrchat" android:layout_gravity="left" android:drawableLeft="@drawable/ic_launcher_gibberbot" android:layout_marginTop="10px" android:id="@+id/WizardRootButtonInstallOtrchat" android:layout_width="wrap_content" android:layout_height="wrap_content"/>
+<Button android:text="@string/wizard_tips_gibberbot" android:layout_gravity="left" android:drawableLeft="@drawable/ic_launcher_gibberbot" android:layout_marginTop="10px" android:id="@+id/WizardRootButtonInstallGibberbot" android:layout_width="wrap_content" android:layout_height="wrap_content"/>
-<Button android:text="@string/wizard_tips_orweb" android:drawableLeft="@drawable/icon_orweb" android:layout_marginTop="10px" android:id="@+id/WizardRootButtonInstallOrweb" android:layout_width="wrap_content" android:layout_height="wrap_content"/>
+<Button android:text="@string/wizard_tips_firefox" android:layout_gravity="left" android:drawableLeft="@drawable/icon_firefox" android:layout_marginTop="10px" android:id="@+id/WizardRootButtonInstallFirefox" android:layout_width="wrap_content" android:layout_height="wrap_content"/>
-<Button android:text="@string/wizard_tips_proxy" android:layout_marginTop="10px" android:id="@+id/WizardRootButtonProxyHelp" android:layout_width="wrap_content" android:layout_height="wrap_content"/>
+<Button android:text="@string/wizard_tips_proxymob" android:layout_marginTop="10px" android:id="@+id/WizardRootButtonInstallProxyMob" android:layout_width="wrap_content" android:layout_height="wrap_content"/>
</LinearLayout>
- </ScrollView>
+ </ScrollView>
+
+</TableRow>
+<TableRow android:id="@+id/TableRow01" android:textColor="#00ff00" android:layout_width="fill_parent" android:layout_height="30px">
+ <Button android:text="Back" android:id="@+id/btnWizard1" android:layout_weight="1" android:layout_width="fill_parent" android:layout_height="wrap_content"></Button>
+ <Button android:text="Next" android:id="@+id/btnWizard2" android:layout_weight="1" android:layout_width="fill_parent" android:layout_height="wrap_content"></Button>
+</TableRow>
+</TableLayout>
</LinearLayout>
+
diff --git a/res/values/strings.xml b/res/values/strings.xml
index f4ca03c..25e253d 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -99,7 +99,6 @@
<string name="wizard_tips_tricks">Orbot-enabled Apps</string>
<string name="wizard_tips_msg">We encourage you to download &amp; use apps that know how to connect directly to Orbot. Click on the buttons below to install.</string>
- <string name="wizard_tips_otrchat">Gibberbot - Secure instant messaging client for Android</string>
<string name="wizard_tips_orweb">ORWEB (Android 1.x Only) - Browser designed for privacy &amp; for Orbot</string>
<string name="wizard_tips_proxy">Proxy Settings - Learn how to configure apps to work with Orbot</string>
@@ -113,8 +112,6 @@
<string name="wizard_final">Orbot is ready!</string>
<string name="wizard_final_msg">Hundreds of thousands of people around the world use Tor for a wide variety of reasons: journalists and bloggers, human rights workers, law enforcement officers, soldiers, corporations, citizens of repressive regimes, and just ordinary citizens... and now you are ready to, as well!</string>
- <string name="otrchat_apk_url">market://search?q=pname:info.guardianproject.otr.app.im</string>
- <string name="orweb_apk_url">market://search?q=pname:nfo.guardianproject.browser</string>
<!-- END Welcome Wizard strings (DJH) -->
@@ -140,6 +137,12 @@
<string name="wizard_permissions_root_msg1">Orbot has detected that you have root permissions enabled. To enable \'Transparent Proxying\', please grant superuser privileges to Orbot</string>
<string name="wizard_permissions_root_msg2">If you choose to continue without providing superuser privileges, make sure to use apps made to work with orbot</string>
<string name="wizard_permissions_msg">Orbot has detected that you do not have root permissions.\nTransparent Proxying is not possible without superuser privileges.\nMake sure to use apps that have been configured to work with Orbot</string>
-
-
+ <!-- TipsAndTricks screen -->
+ <string name="wizard_tips_gibberbot">Gibberbot - Secure instant messaging client for Android</string>
+ <string name="wizard_tips_firefox">Firefox - Android browser - To be used along with ProxyMob Add-on </string>
+ <string name="wizard_tips_proxymob">ProxyMob - Simple Firefox Add-on for setting HTTP, SOCKS and SSL proxy settings</string>
+ <string name="gibberbot_apk_url">https://market.android.com/details?id=info.guardianproject.otr.app.im</string>
+ <string name="firefox_apk_url">https://market.android.com/details?id=org.mozilla.firefox</string>
+ <string name="proxymob_url">https://addons.mozilla.org/mobile/downloads/latest/251558/type:attachment/addon-251558-latest.xpi?src=addon-detail</string>
+
</resources>
diff --git a/src/org/torproject/android/Permissions.java b/src/org/torproject/android/Permissions.java
index bd96e56..996a1dc 100644
--- a/src/org/torproject/android/Permissions.java
+++ b/src/org/torproject/android/Permissions.java
@@ -133,7 +133,7 @@ public class Permissions extends Activity implements TorConstants {
@Override
public void onClick(View v) {
- //Tips Screen
+ startActivityForResult(new Intent(getBaseContext(), TipsAndTricks.class), 1);
}
});
@@ -167,7 +167,7 @@ public class Permissions extends Activity implements TorConstants {
@Override
public void onClick(View v) {
- //Tips Screen
+ startActivityForResult(new Intent(getBaseContext(), TipsAndTricks.class), 1);
}
});
}
diff --git a/src/org/torproject/android/TipsAndTricks.java b/src/org/torproject/android/TipsAndTricks.java
new file mode 100644
index 0000000..c4aba96
--- /dev/null
+++ b/src/org/torproject/android/TipsAndTricks.java
@@ -0,0 +1,103 @@
+package org.torproject.android;
+
+import android.app.Activity;
+import android.content.Context;
+import android.content.Intent;
+import android.net.Uri;
+import android.os.Bundle;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.widget.Button;
+
+public class TipsAndTricks extends Activity implements TorConstants {
+
+ private Context context;
+
+ protected void onCreate(Bundle savedInstanceState)
+ {
+ super.onCreate(savedInstanceState);
+ context = this;
+
+ }
+
+ @Override
+ protected void onStart() {
+
+ super.onStart();
+ setContentView(R.layout.layout_wizard_tips);
+
+ //stepFive();
+
+ }
+
+ @Override
+ protected void onResume() {
+ super.onResume();
+
+
+ }
+
+ void stepFive(){
+
+
+
+ Button btn1 = (Button)findViewById(R.id.WizardRootButtonInstallGibberbot);
+
+ btn1.setOnClickListener(new OnClickListener() {
+
+ @Override
+ public void onClick(View view) {
+
+ String url = context.getString(R.string.gibberbot_apk_url);
+ context.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
+
+ }
+ });
+
+ Button btn2 = (Button)findViewById(R.id.WizardRootButtonInstallFirefox);
+
+ btn2.setOnClickListener(new OnClickListener() {
+
+ @Override
+ public void onClick(View view) {
+
+ String url = context.getString(R.string.firefox_apk_url);
+ context.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
+
+ }
+ });
+
+ Button btn3 = (Button)findViewById(R.id.WizardRootButtonInstallProxyMob);
+
+ btn3.setOnClickListener(new OnClickListener() {
+
+ @Override
+ public void onClick(View view) {
+
+ String url = context.getString(R.string.proxymob_url);
+ context.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
+ }
+ });
+
+ Button back = ((Button)findViewById(R.id.btnWizard1));
+ Button next = ((Button)findViewById(R.id.btnWizard2));
+
+ back.setOnClickListener(new View.OnClickListener() {
+
+ @Override
+ public void onClick(View v) {
+
+ startActivityForResult(new Intent(getBaseContext(), Permissions.class), 1);
+ }
+ });
+
+ next.setOnClickListener(new View.OnClickListener() {
+
+ @Override
+ public void onClick(View v) {
+ //Finsh Screen
+ }
+ });
+
+ }
+}
\ No newline at end of file
commit 6af2989ab82bff30ad45f14a40dfe15a4f787ddc
Author: Sathyanarayanan Gunasekaran <gsathya.ceg@gmail.com>
Date: Sat Jun 4 02:12:06 2011 +0530
Permissions screen added
diff --git a/AUTHORS b/AUTHORS
index f99ac6f..135d9b4 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -27,7 +27,7 @@ provided guidance in the entire effort.
Adam Langley made the original valiant effort to port Tor to Android.
-Sathyanarayanan <gsathya.ceg@gmail.com> created a patch for the wizard
+Sathyanarayanan <me@gsathya.in> created a patch for the wizard
which updated the icon and link for the secure chat app info to point
to Gibberbot, and hopefully will continue to contribute useful patches.
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 59c2cca..be3c43f 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -30,6 +30,7 @@
</activity>
<activity android:name=".LotsaText"/>
+ <activity android:name=".Permissions"/>
<activity android:name=".SettingsPreferences" android:label="@string/app_name"/>
<activity android:name=".AppManager" android:label="@string/app_name"/>
<activity android:name=".WizardActivity" android:label="@string/app_name"/>
diff --git a/res/layout/layout_wizard_permissions.xml b/res/layout/layout_wizard_permissions.xml
new file mode 100644
index 0000000..b861d7a
--- /dev/null
+++ b/res/layout/layout_wizard_permissions.xml
@@ -0,0 +1,67 @@
+<?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"
+ android:background="@drawable/background">
+
+<RelativeLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:id="@+id/relativeLayout1"
+ android:layout_gravity="center_horizontal">
+ <ImageView
+ android:src="@drawable/tor"
+ android:visibility="invisible"
+ android:id="@+id/orbot_image"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_alignParentLeft="true"
+ android:paddingLeft="20px" android:paddingRight="20px" >
+ </ImageView>
+ <TextView android:textSize="10pt"
+ android:layout_toRightOf="@id/orbot_image"
+ android:layout_alignParentTop="true"
+ android:gravity="center_vertical"
+ android:layout_height="wrap_content"
+ android:id="@+id/WizardTextTitle"
+ android:layout_width="wrap_content"
+ android:fadingEdge="vertical"
+ android:text="TITLE"
+ android:textColor="#00ff00"
+ android:singleLine="true"
+
+
+
+ android:layout_centerInParent="true"
+ android:padding="20px">
+ </TextView>
+ </RelativeLayout>
+<TableLayout android:id="@+id/TableLayout01" android:stretchColumns="*" android:layout_height="fill_parent" android:layout_width="wrap_content">
+
+<TableRow android:id="@+id/TableRow01" android:layout_weight="1" android:layout_width="fill_parent" android:layout_height="fill_parent">
+
+
+ <ScrollView android:id="@+id/helpscrollview"
+ android:orientation="vertical"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:layout_span="3">
+ <LinearLayout android:layout_width="wrap_content" android:id="@+id/linearLayout1" android:layout_height="wrap_content" android:orientation="vertical">
+ <TextView android:layout_width="wrap_content" android:textColor="#ffffff" android:layout_height="wrap_content" android:background="#222222" android:textSize="8pt" android:padding="6px" android:id="@+id/WizardTextBody1" android:text="this is sample text this is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample text"></TextView>
+ <Button android:layout_width="wrap_content" android:visibility="gone" android:layout_height="wrap_content" android:gravity="center" android:text="Grant Permission" android:id="@+id/grantPermissions" android:layout_gravity="center"></Button>
+ <TextView android:layout_width="wrap_content" android:visibility="gone" android:textColor="#ffffff" android:layout_height="wrap_content" android:background="#222222" android:textSize="8pt" android:padding="6px" android:id="@+id/WizardTextBody2" android:text="this is sample text this is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample text"></TextView>
+ </LinearLayout>
+
+ </ScrollView>
+
+</TableRow>
+<TableRow android:id="@+id/TableRow01" android:textColor="#00ff00" android:layout_width="fill_parent" android:layout_height="30px">
+ <Button android:text="Back" android:id="@+id/btnWizard1" android:layout_weight="1" android:layout_width="fill_parent" android:layout_height="wrap_content"></Button>
+ <Button android:text="Next" android:id="@+id/btnWizard2" android:layout_weight="1" android:layout_width="fill_parent" android:layout_height="wrap_content"></Button>
+</TableRow>
+</TableLayout>
+</LinearLayout>
+
+
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 2212f49..f4ca03c 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -137,6 +137,9 @@
<string name="wizard_warning_msg">Simply installing Orbot will not automatically anonymize your mobile traffic.\nPlease follow the following steps to get started</string>
<!-- Permissions screen -->
<string name="wizard_permissions_title">Permissions</string>
+ <string name="wizard_permissions_root_msg1">Orbot has detected that you have root permissions enabled. To enable \'Transparent Proxying\', please grant superuser privileges to Orbot</string>
+ <string name="wizard_permissions_root_msg2">If you choose to continue without providing superuser privileges, make sure to use apps made to work with orbot</string>
+ <string name="wizard_permissions_msg">Orbot has detected that you do not have root permissions.\nTransparent Proxying is not possible without superuser privileges.\nMake sure to use apps that have been configured to work with Orbot</string>
</resources>
diff --git a/src/org/torproject/android/LotsaText.java b/src/org/torproject/android/LotsaText.java
index d044c57..e9fc556 100644
--- a/src/org/torproject/android/LotsaText.java
+++ b/src/org/torproject/android/LotsaText.java
@@ -2,6 +2,7 @@ package org.torproject.android;
import android.app.Activity;
import android.content.Context;
+import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
@@ -24,13 +25,10 @@ public class LotsaText extends Activity implements TorConstants{
protected void onStart() {
super.onStart();
+ setContentView(R.layout.scrollingtext_buttons_view);
-
- if (step == -1)
- {
- setContentView(R.layout.scrollingtext_buttons_view);
- stepOne();
- }
+ stepOne();
+
}
@Override
@@ -52,7 +50,6 @@ public class LotsaText extends Activity implements TorConstants{
*/
private void stepOne() {
- step++;
//setContentView(R.layout.scrollingtext_buttons_view);
String title = context.getString(R.string.wizard_title);
@@ -82,7 +79,7 @@ public class LotsaText extends Activity implements TorConstants{
}
private void stepTwo() {
- step++;
+ step=0;
setContentView(R.layout.scrollingtext_buttons_view);
String title = context.getString(R.string.wizard_warning_title);
@@ -114,9 +111,11 @@ public class LotsaText extends Activity implements TorConstants{
@Override
public void onClick(View v) {
- //stepThree();
+ startActivityForResult(new Intent(getBaseContext(), Permissions.class), 1);
}
});
}
+
+
}
\ No newline at end of file
diff --git a/src/org/torproject/android/Permissions.java b/src/org/torproject/android/Permissions.java
new file mode 100644
index 0000000..bd96e56
--- /dev/null
+++ b/src/org/torproject/android/Permissions.java
@@ -0,0 +1,176 @@
+package org.torproject.android;
+
+import org.torproject.android.service.TorService;
+import org.torproject.android.service.TorServiceUtils;
+import org.torproject.android.service.TorTransProxy;
+
+import android.app.Activity;
+import android.content.Context;
+import android.content.Intent;
+import android.content.SharedPreferences;
+import android.content.SharedPreferences.Editor;
+import android.os.Bundle;
+import android.preference.PreferenceManager;
+import android.util.Log;
+import android.view.View;
+import android.widget.Button;
+import android.widget.TextView;
+import android.widget.Toast;
+
+public class Permissions extends Activity implements TorConstants {
+
+ private Context context;
+
+ protected void onCreate(Bundle savedInstanceState)
+ {
+ super.onCreate(savedInstanceState);
+ context = this;
+
+ }
+
+ @Override
+ protected void onStart() {
+
+ super.onStart();
+ setContentView(R.layout.layout_wizard_permissions);
+
+ stepThree();
+
+ }
+
+ @Override
+ protected void onResume() {
+ super.onResume();
+
+
+ }
+
+ private void stepThree(){
+
+ boolean hasRoot = TorServiceUtils.checkRootAccess();
+
+ if (hasRoot)
+ {
+ try {
+ int resp = TorTransProxy.testOwnerModule(context);
+
+ if (resp < 0)
+ {
+ hasRoot = false;
+ Toast.makeText(context, "ERROR: IPTables OWNER module not available", Toast.LENGTH_LONG).show();
+
+ Log.i(TorService.TAG,"ERROR: IPTables OWNER module not available");
+ }
+
+ } catch (Exception e) {
+
+ hasRoot = false;
+ Log.d(TorService.TAG,"ERROR: IPTables OWNER module not available",e);
+ }
+ }
+
+ SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
+
+ Editor pEdit = prefs.edit();
+ pEdit.putBoolean("has_root",hasRoot);
+ pEdit.commit();
+
+ if (hasRoot)
+ {
+ Toast.makeText(context, "Has Root", Toast.LENGTH_SHORT).show();
+ stepFourRoot();
+ }
+ else
+ {
+ Toast.makeText(context, "Unable to get root access", Toast.LENGTH_LONG).show();
+ stepFour();
+ }
+
+ }
+
+ private void stepFourRoot(){
+
+ String title = context.getString(R.string.wizard_permissions_title);
+ String msg1 = context.getString(R.string.wizard_permissions_root_msg1);
+ String msg2 = context.getString(R.string.wizard_permissions_root_msg2);
+
+ TextView txtTitle = ((TextView)findViewById(R.id.WizardTextTitle));
+ txtTitle.setText(title);
+
+ TextView txtBody1 = ((TextView)findViewById(R.id.WizardTextBody1));
+ txtBody1.setText(msg1);
+
+
+ TextView txtBody2 = ((TextView)findViewById(R.id.WizardTextBody2));
+ txtBody2.setText(msg2);
+ txtBody2.setVisibility(TextView.VISIBLE);
+
+ Button grantPermissions = ((Button)findViewById(R.id.grantPermissions));
+ grantPermissions.setVisibility(Button.VISIBLE);
+
+ Button back = ((Button)findViewById(R.id.btnWizard1));
+ Button next = ((Button)findViewById(R.id.btnWizard2));
+
+ grantPermissions.setOnClickListener(new View.OnClickListener() {
+
+ @Override
+ public void onClick(View v) {
+ //Check and Install iptables
+
+ }
+ });
+
+ back.setOnClickListener(new View.OnClickListener() {
+
+ @Override
+ public void onClick(View v) {
+
+ startActivityForResult(new Intent(getBaseContext(), LotsaText.class), 1);
+ }
+ });
+
+ next.setOnClickListener(new View.OnClickListener() {
+
+ @Override
+ public void onClick(View v) {
+ //Tips Screen
+ }
+ });
+
+ }
+
+ private void stepFour(){
+
+
+ String title = context.getString(R.string.wizard_permissions_title);
+ String msg = context.getString(R.string.wizard_permissions_msg);
+
+ TextView txtTitle = ((TextView)findViewById(R.id.WizardTextTitle));
+ txtTitle.setText(title);
+
+ TextView txtBody = ((TextView)findViewById(R.id.WizardTextBody));
+ txtBody.setText(msg);
+
+ Button btn1 = ((Button)findViewById(R.id.btnWizard1));
+ Button btn2 = ((Button)findViewById(R.id.btnWizard2));
+
+ btn1.setOnClickListener(new View.OnClickListener() {
+
+ @Override
+ public void onClick(View v) {
+
+ startActivityForResult(new Intent(getBaseContext(), LotsaText.class), 1);
+ }
+ });
+
+ btn2.setOnClickListener(new View.OnClickListener() {
+
+ @Override
+ public void onClick(View v) {
+ //Tips Screen
+ }
+ });
+ }
+
+
+}
\ No newline at end of file
commit 3181d00c1d8a5b5e78dbe26da548bdb177481b04
Author: Sathyanarayanan Gunasekaran <gsathya.ceg@gmail.com>
Date: Fri Jun 3 23:07:30 2011 +0530
First two screens - rewrite
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index f11a63e..59c2cca 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -29,7 +29,7 @@
</intent-filter>
</activity>
- <activity android:name=".AboutActivity"/>
+ <activity android:name=".LotsaText"/>
<activity android:name=".SettingsPreferences" android:label="@string/app_name"/>
<activity android:name=".AppManager" android:label="@string/app_name"/>
<activity android:name=".WizardActivity" android:label="@string/app_name"/>
diff --git a/res/layout/scrollingtext_buttons_view.xml b/res/layout/scrollingtext_buttons_view.xml
index 623f59c..75b7925 100644
--- a/res/layout/scrollingtext_buttons_view.xml
+++ b/res/layout/scrollingtext_buttons_view.xml
@@ -13,14 +13,14 @@
android:layout_gravity="center_horizontal">
<ImageView
android:src="@drawable/tor"
- android:id="@+id/gibber_image"
+ android:id="@+id/orbot_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:paddingLeft="20px" android:paddingRight="20px" >
</ImageView>
<TextView android:textSize="10pt"
- android:layout_toRightOf="@id/gibber_image"
+ android:layout_toRightOf="@id/orbot_image"
android:layout_alignParentTop="true"
android:gravity="center_vertical"
android:layout_height="wrap_content"
@@ -54,8 +54,8 @@
</TableRow>
<TableRow android:id="@+id/TableRow01" android:textColor="#00ff00" android:layout_width="fill_parent" android:layout_height="30px">
- <Button android:text="button1" android:id="@+id/btnWizard1" android:layout_weight="1" android:layout_width="fill_parent" android:layout_height="wrap_content"></Button>
- <Button android:text="button2" android:id="@+id/btnWizard2" android:layout_weight="1" android:layout_width="fill_parent" android:layout_height="wrap_content"></Button>
+ <Button android:text="Back" android:id="@+id/btnWizard1" android:layout_weight="1" android:layout_width="fill_parent" android:layout_height="wrap_content"></Button>
+ <Button android:text="Next" android:id="@+id/btnWizard2" android:layout_weight="1" android:layout_width="fill_parent" android:layout_height="wrap_content"></Button>
</TableRow>
</TableLayout>
</LinearLayout>
diff --git a/src/org/torproject/android/AboutActivity.java b/src/org/torproject/android/AboutActivity.java
deleted file mode 100644
index a03314b..0000000
--- a/src/org/torproject/android/AboutActivity.java
+++ /dev/null
@@ -1,204 +0,0 @@
-package org.torproject.android;
-
-import android.app.Activity;
-import android.app.AlertDialog;
-import android.content.DialogInterface;
-import android.content.Intent;
-import android.content.DialogInterface.OnClickListener;
-import android.os.Bundle;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.widget.Button;
-import android.widget.ImageView;
-import android.widget.TextView;
-
-public class AboutActivity extends Activity implements OnClickListener
-{
- //WizardHelper wizard = null;
-
- private int title[] = {
- R.string.wizard_title,
- R.string.wizard_warning_title,
- R.string.wizard_permissions_title
- };
-
- private int msg[] = {
- R.string.wizard_title_msg,
- R.string.wizard_warning_msg,
- };
-
- private String buttons[][] =
- {
- {null,"Next"},
- {"Back","Next"},
- {"Back","Next"},
- {"Back","Next"},
-
- };
-
- private View.OnClickListener listener[][] =
- {
- {
- null,
- new View.OnClickListener() {
-
- @Override
- public void onClick(View v) {
-
- nextContent();
-
- }
- }
- },
-
- {
- new View.OnClickListener() {
-
- @Override
- public void onClick(View v) {
- prevContent();
-
- }
- },
- new View.OnClickListener() {
-
- @Override
- public void onClick(View v) {
-
- nextContent();
-
- }
- }
- },
-
- {
- new View.OnClickListener() {
-
- @Override
- public void onClick(View v) {
- prevContent();
-
- }
- },
- new View.OnClickListener() {
-
- @Override
- public void onClick(View v) {
-
-
- //Intent intent = new Intent(getBaseContext(), AccountWizardActivity.class);
-
-
- //startActivity(intent);
-
- }
- }
- },
-
-
-
- };
-
-
- private int contentIdx = -1;
-
- protected void onCreate(Bundle savedInstanceState)
- {
- super.onCreate(savedInstanceState);
-
- }
-
- @Override
- protected void onStart() {
-
- super.onStart();
-
- if (contentIdx == -1)
- {
- setContentView(R.layout.scrollingtext_buttons_view);
-
- nextContent ();
- }
- }
-
- private void prevContent ()
- {
- contentIdx--;
- showContent(contentIdx);
- }
-
- private void nextContent ()
- {
- contentIdx++;
- showContent(contentIdx);
- }
-
- private void showContent (int contentIdx)
- {
- TextView txtTitle = ((TextView)findViewById(R.id.WizardTextTitle));
- txtTitle.setText(getString(title[contentIdx]));
-
- TextView txtBody = ((TextView)findViewById(R.id.WizardTextBody));
- txtBody.setText(getString(msg[contentIdx]));
-
- Button btn1 = ((Button)findViewById(R.id.btnWizard1));
-
- ImageView img = (ImageView) findViewById(R.id.gibber_image);
-
- if (buttons[contentIdx][0] != null)
- {
- btn1.setText(buttons[contentIdx][0]);
- btn1.setOnClickListener(listener[contentIdx][0]);
- btn1.setVisibility(Button.VISIBLE);
-
- }
- else
- {
- btn1.setVisibility(Button.INVISIBLE);
- }
-
- Button btn2 = ((Button)findViewById(R.id.btnWizard2));
- if (buttons[contentIdx][1] != null)
- {
- btn2.setText(buttons[contentIdx][1]);
- btn2.setOnClickListener(listener[contentIdx][1]);
- btn2.setVisibility(Button.VISIBLE);
-
- }
- else
- {
- btn2.setVisibility(Button.INVISIBLE);
- }
-
- if(contentIdx !=0)
- {
- img.setVisibility(ImageView.GONE);
- }
- else
- {
- img.setVisibility(ImageView.VISIBLE);
- }
-
- }
-
-
-
- @Override
- protected void onResume() {
- super.onResume();
-
-
- }
-
-
-
-
- @Override
- public void onClick(DialogInterface arg0, int arg1) {
-
-
- }
-
-
-
-}
diff --git a/src/org/torproject/android/LotsaText.java b/src/org/torproject/android/LotsaText.java
new file mode 100644
index 0000000..d044c57
--- /dev/null
+++ b/src/org/torproject/android/LotsaText.java
@@ -0,0 +1,122 @@
+package org.torproject.android;
+
+import android.app.Activity;
+import android.content.Context;
+import android.os.Bundle;
+import android.view.View;
+import android.widget.Button;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+public class LotsaText extends Activity implements TorConstants{
+
+ private Context context;
+ private int step = -1;
+
+ protected void onCreate(Bundle savedInstanceState)
+ {
+ super.onCreate(savedInstanceState);
+ context = this;
+
+ }
+
+ @Override
+ protected void onStart() {
+
+ super.onStart();
+
+
+ if (step == -1)
+ {
+ setContentView(R.layout.scrollingtext_buttons_view);
+ stepOne();
+ }
+ }
+
+ @Override
+ protected void onResume() {
+ super.onResume();
+
+
+ }
+
+
+ /*public void startWizard(){
+
+ switch(step){
+
+ case -1 : stepOne();break;
+
+ }
+ }
+ */
+ private void stepOne() {
+
+ step++;
+
+ //setContentView(R.layout.scrollingtext_buttons_view);
+ String title = context.getString(R.string.wizard_title);
+ String msg = context.getString(R.string.wizard_title_msg);
+
+ TextView txtTitle = ((TextView)findViewById(R.id.WizardTextTitle));
+ txtTitle.setText(title);
+
+ TextView txtBody = ((TextView)findViewById(R.id.WizardTextBody));
+ txtBody.setText(msg);
+
+ Button btn1 = ((Button)findViewById(R.id.btnWizard1));
+ Button btn2 = ((Button)findViewById(R.id.btnWizard2));
+ ImageView img = (ImageView) findViewById(R.id.orbot_image);
+
+ btn1.setVisibility(Button.INVISIBLE);
+ img.setVisibility(ImageView.VISIBLE);
+
+ btn2.setOnClickListener(new View.OnClickListener() {
+
+ @Override
+ public void onClick(View v) {
+ stepTwo();
+ }
+ });
+
+ }
+
+ private void stepTwo() {
+ step++;
+
+ setContentView(R.layout.scrollingtext_buttons_view);
+ String title = context.getString(R.string.wizard_warning_title);
+ String msg = context.getString(R.string.wizard_warning_msg);
+
+ TextView txtTitle = ((TextView)findViewById(R.id.WizardTextTitle));
+ txtTitle.setText(title);
+
+ TextView txtBody = ((TextView)findViewById(R.id.WizardTextBody));
+ txtBody.setText(msg);
+
+ Button btn1 = ((Button)findViewById(R.id.btnWizard1));
+ Button btn2 = ((Button)findViewById(R.id.btnWizard2));
+ ImageView img = (ImageView) findViewById(R.id.orbot_image);
+
+ btn1.setVisibility(Button.VISIBLE);
+ img.setVisibility(ImageView.INVISIBLE);
+
+ btn1.setOnClickListener(new View.OnClickListener() {
+
+ @Override
+ public void onClick(View v) {
+
+ stepOne();
+ }
+ });
+
+ btn2.setOnClickListener(new View.OnClickListener() {
+
+ @Override
+ public void onClick(View v) {
+ //stepThree();
+ }
+ });
+
+ }
+}
\ No newline at end of file
diff --git a/src/org/torproject/android/Orbot.java b/src/org/torproject/android/Orbot.java
index eb26960..383929d 100644
--- a/src/org/torproject/android/Orbot.java
+++ b/src/org/torproject/android/Orbot.java
@@ -456,7 +456,7 @@ public class Orbot extends Activity implements OnLongClickListener, TorConstants
private void showHelp ()
{
- startActivityForResult(new Intent(getBaseContext(), AboutActivity.class), 1);
+ startActivityForResult(new Intent(getBaseContext(), LotsaText.class), 1);
}
commit de5d9bfe464be1960cbd5be194c65cf685572b51
Author: Sathyanarayanan Gunasekaran <gsathya.ceg@gmail.com>
Date: Mon May 30 11:01:47 2011 +0530
First two wizard screens
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index d01b58e..f11a63e 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -28,8 +28,9 @@
<action android:name="org.torproject.android.START_TOR" />
</intent-filter>
</activity>
-
- <activity android:name=".SettingsPreferences" android:label="@string/app_name"/>
+
+ <activity android:name=".AboutActivity"/>
+ <activity android:name=".SettingsPreferences" android:label="@string/app_name"/>
<activity android:name=".AppManager" android:label="@string/app_name"/>
<activity android:name=".WizardActivity" android:label="@string/app_name"/>
diff --git a/res/layout/scrollingtext_buttons_view.xml b/res/layout/scrollingtext_buttons_view.xml
new file mode 100644
index 0000000..623f59c
--- /dev/null
+++ b/res/layout/scrollingtext_buttons_view.xml
@@ -0,0 +1,63 @@
+<?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"
+ android:background="@drawable/background">
+
+<RelativeLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:id="@+id/relativeLayout1"
+ android:layout_gravity="center_horizontal">
+ <ImageView
+ android:src="@drawable/tor"
+ android:id="@+id/gibber_image"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_alignParentLeft="true"
+ android:paddingLeft="20px" android:paddingRight="20px" >
+ </ImageView>
+ <TextView android:textSize="10pt"
+ android:layout_toRightOf="@id/gibber_image"
+ android:layout_alignParentTop="true"
+ android:gravity="center_vertical"
+ android:layout_height="wrap_content"
+ android:id="@+id/WizardTextTitle"
+ android:layout_width="wrap_content"
+ android:fadingEdge="vertical"
+ android:text="TITLE"
+ android:textColor="#00ff00"
+ android:singleLine="true"
+
+
+
+ android:layout_centerInParent="true"
+ android:padding="20px">
+ </TextView>
+ </RelativeLayout>
+<TableLayout android:id="@+id/TableLayout01" android:stretchColumns="*" android:layout_height="fill_parent" android:layout_width="wrap_content">
+
+<TableRow android:id="@+id/TableRow01" android:layout_weight="1" android:layout_width="fill_parent" android:layout_height="fill_parent">
+
+
+ <ScrollView android:id="@+id/helpscrollview"
+ android:orientation="vertical"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:layout_span="3">
+
+ <TextView android:text="this is sample text this is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample text" android:padding="6px" android:background="#222222" android:textColor="#ffffff" android:id="@+id/WizardTextBody" android:textSize="8pt" android:layout_width="wrap_content" android:layout_height="wrap_content"></TextView>
+
+ </ScrollView>
+
+</TableRow>
+<TableRow android:id="@+id/TableRow01" android:textColor="#00ff00" android:layout_width="fill_parent" android:layout_height="30px">
+ <Button android:text="button1" android:id="@+id/btnWizard1" android:layout_weight="1" android:layout_width="fill_parent" android:layout_height="wrap_content"></Button>
+ <Button android:text="button2" android:id="@+id/btnWizard2" android:layout_weight="1" android:layout_width="fill_parent" android:layout_height="wrap_content"></Button>
+</TableRow>
+</TableLayout>
+</LinearLayout>
+
+
diff --git a/res/values/strings.xml b/res/values/strings.xml
index bca3df9..2212f49 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -69,8 +69,6 @@
<string name="title_error">Application Error</string>
-<string name="wizard_title">Welcome to Orbot</string>
-
<string name="wizard_btn_tell_me_more">About Orbot</string>
<string name="btn_next">Next</string>
<string name="btn_back">Back</string>
@@ -130,5 +128,15 @@
<string name="pref_general_group">General</string>
<string name="pref_start_boot_title">Start Orbot on Boot</string>
<string name="pref_start_boot_summary">Automatically start Orbot and connect Tor when your Android device boots</string>
-
+ <!-- New Wizard Strings -->
+ <!-- Title Screen -->
+ <string name="wizard_title">Orbot</string>
+ <string name="wizard_title_msg">Orbot brings Tor to Android \nTor helps you defend against a form of network surveillance that threatens privacy, confidential business activity and relationships, and state security known as traffic analysis</string>
+ <!-- Warning screen -->
+ <string name="wizard_warning_title">Warning</string>
+ <string name="wizard_warning_msg">Simply installing Orbot will not automatically anonymize your mobile traffic.\nPlease follow the following steps to get started</string>
+ <!-- Permissions screen -->
+ <string name="wizard_permissions_title">Permissions</string>
+
+
</resources>
diff --git a/src/org/torproject/android/AboutActivity.java b/src/org/torproject/android/AboutActivity.java
new file mode 100644
index 0000000..a03314b
--- /dev/null
+++ b/src/org/torproject/android/AboutActivity.java
@@ -0,0 +1,204 @@
+package org.torproject.android;
+
+import android.app.Activity;
+import android.app.AlertDialog;
+import android.content.DialogInterface;
+import android.content.Intent;
+import android.content.DialogInterface.OnClickListener;
+import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.widget.Button;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+public class AboutActivity extends Activity implements OnClickListener
+{
+ //WizardHelper wizard = null;
+
+ private int title[] = {
+ R.string.wizard_title,
+ R.string.wizard_warning_title,
+ R.string.wizard_permissions_title
+ };
+
+ private int msg[] = {
+ R.string.wizard_title_msg,
+ R.string.wizard_warning_msg,
+ };
+
+ private String buttons[][] =
+ {
+ {null,"Next"},
+ {"Back","Next"},
+ {"Back","Next"},
+ {"Back","Next"},
+
+ };
+
+ private View.OnClickListener listener[][] =
+ {
+ {
+ null,
+ new View.OnClickListener() {
+
+ @Override
+ public void onClick(View v) {
+
+ nextContent();
+
+ }
+ }
+ },
+
+ {
+ new View.OnClickListener() {
+
+ @Override
+ public void onClick(View v) {
+ prevContent();
+
+ }
+ },
+ new View.OnClickListener() {
+
+ @Override
+ public void onClick(View v) {
+
+ nextContent();
+
+ }
+ }
+ },
+
+ {
+ new View.OnClickListener() {
+
+ @Override
+ public void onClick(View v) {
+ prevContent();
+
+ }
+ },
+ new View.OnClickListener() {
+
+ @Override
+ public void onClick(View v) {
+
+
+ //Intent intent = new Intent(getBaseContext(), AccountWizardActivity.class);
+
+
+ //startActivity(intent);
+
+ }
+ }
+ },
+
+
+
+ };
+
+
+ private int contentIdx = -1;
+
+ protected void onCreate(Bundle savedInstanceState)
+ {
+ super.onCreate(savedInstanceState);
+
+ }
+
+ @Override
+ protected void onStart() {
+
+ super.onStart();
+
+ if (contentIdx == -1)
+ {
+ setContentView(R.layout.scrollingtext_buttons_view);
+
+ nextContent ();
+ }
+ }
+
+ private void prevContent ()
+ {
+ contentIdx--;
+ showContent(contentIdx);
+ }
+
+ private void nextContent ()
+ {
+ contentIdx++;
+ showContent(contentIdx);
+ }
+
+ private void showContent (int contentIdx)
+ {
+ TextView txtTitle = ((TextView)findViewById(R.id.WizardTextTitle));
+ txtTitle.setText(getString(title[contentIdx]));
+
+ TextView txtBody = ((TextView)findViewById(R.id.WizardTextBody));
+ txtBody.setText(getString(msg[contentIdx]));
+
+ Button btn1 = ((Button)findViewById(R.id.btnWizard1));
+
+ ImageView img = (ImageView) findViewById(R.id.gibber_image);
+
+ if (buttons[contentIdx][0] != null)
+ {
+ btn1.setText(buttons[contentIdx][0]);
+ btn1.setOnClickListener(listener[contentIdx][0]);
+ btn1.setVisibility(Button.VISIBLE);
+
+ }
+ else
+ {
+ btn1.setVisibility(Button.INVISIBLE);
+ }
+
+ Button btn2 = ((Button)findViewById(R.id.btnWizard2));
+ if (buttons[contentIdx][1] != null)
+ {
+ btn2.setText(buttons[contentIdx][1]);
+ btn2.setOnClickListener(listener[contentIdx][1]);
+ btn2.setVisibility(Button.VISIBLE);
+
+ }
+ else
+ {
+ btn2.setVisibility(Button.INVISIBLE);
+ }
+
+ if(contentIdx !=0)
+ {
+ img.setVisibility(ImageView.GONE);
+ }
+ else
+ {
+ img.setVisibility(ImageView.VISIBLE);
+ }
+
+ }
+
+
+
+ @Override
+ protected void onResume() {
+ super.onResume();
+
+
+ }
+
+
+
+
+ @Override
+ public void onClick(DialogInterface arg0, int arg1) {
+
+
+ }
+
+
+
+}
diff --git a/src/org/torproject/android/Orbot.java b/src/org/torproject/android/Orbot.java
index 4bc5695..eb26960 100644
--- a/src/org/torproject/android/Orbot.java
+++ b/src/org/torproject/android/Orbot.java
@@ -4,6 +4,8 @@
package org.torproject.android;
+
+
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
@@ -454,7 +456,7 @@ public class Orbot extends Activity implements OnLongClickListener, TorConstants
private void showHelp ()
{
- new WizardHelper(this).showWizard();
+ startActivityForResult(new Intent(getBaseContext(), AboutActivity.class), 1);
}
diff --git a/src/org/torproject/android/WizardActivity.java b/src/org/torproject/android/WizardActivity.java
deleted file mode 100644
index 2a8bf33..0000000
--- a/src/org/torproject/android/WizardActivity.java
+++ /dev/null
@@ -1,71 +0,0 @@
-package org.torproject.android;
-
-import android.app.Activity;
-import android.app.AlertDialog;
-import android.content.DialogInterface;
-import android.content.DialogInterface.OnClickListener;
-import android.os.Bundle;
-import android.view.LayoutInflater;
-import android.view.View;
-
-public class WizardActivity extends Activity implements OnClickListener
-{
-
- protected void onCreate(Bundle savedInstanceState)
- {
-
- this.setContentView(R.layout.layout_help);
-
- }
-
-
-
- @Override
- protected void onStart() {
-
- super.onStart();
-
-
- }
-
-
-
- @Override
- protected void onResume() {
- super.onResume();
-
- showStep1();
- }
-
-
-
- public void showStep1()
- {
- showDialog("Test","","foo","bar",this);
- }
-
- private void showDialog (String title, String msg, String button1, String button2, OnClickListener ocListener)
- {
-
- new AlertDialog.Builder(this)
- .setInverseBackgroundForced(true)
- .setTitle(title)
- .setMessage(msg)
- .setNeutralButton(button1, ocListener)
- .setNegativeButton(button2, ocListener)
- .show();
-
-
- }
-
-
-
- @Override
- public void onClick(DialogInterface arg0, int arg1) {
-
-
- }
-
-
-
-}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment