[tor-commits] [orbot/master] First two wizard screens

n8fr8 at torproject.org n8fr8 at torproject.org
Fri Oct 28 15:28:25 UTC 2011


commit de5d9bfe464be1960cbd5be194c65cf685572b51
Author: Sathyanarayanan Gunasekaran <gsathya.ceg at gmail.com>
Date:   Mon May 30 11:01:47 2011 +0530

    First two wizard screens
---
 AndroidManifest.xml                            |    5 +-
 res/layout/scrollingtext_buttons_view.xml      |   63 ++++++++
 res/values/strings.xml                         |   14 ++-
 src/org/torproject/android/AboutActivity.java  |  204 ++++++++++++++++++++++++
 src/org/torproject/android/Orbot.java          |    4 +-
 src/org/torproject/android/WizardActivity.java |   71 --------
 6 files changed, 284 insertions(+), 77 deletions(-)

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) {
-		
-		
-	}
-	
-	
-	
-}





More information about the tor-commits mailing list