[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

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



commit 3181d00c1d8a5b5e78dbe26da548bdb177481b04
Author: Sathyanarayanan Gunasekaran <gsathya.ceg@xxxxxxxxx>
Date:   Fri Jun 3 23:07:30 2011 +0530

    First two screens - rewrite
---
 AndroidManifest.xml                           |    2 +-
 res/layout/scrollingtext_buttons_view.xml     |    8 +-
 src/org/torproject/android/AboutActivity.java |  204 -------------------------
 src/org/torproject/android/LotsaText.java     |  122 +++++++++++++++
 src/org/torproject/android/Orbot.java         |    2 +-
 5 files changed, 128 insertions(+), 210 deletions(-)

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



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits