First two wizard screens

This commit is contained in:
Sathyanarayanan Gunasekaran 2011-05-30 11:01:47 +05:30
parent 4ec721b73a
commit de5d9bfe46
6 changed files with 284 additions and 77 deletions

View File

@ -29,7 +29,8 @@
</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"/>

View File

@ -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>

View File

@ -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>

View File

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

View File

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

View File

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