First two screens - rewrite

This commit is contained in:
Sathyanarayanan Gunasekaran 2011-06-03 23:07:30 +05:30
parent de5d9bfe46
commit 3181d00c1d
5 changed files with 128 additions and 210 deletions

View File

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

View File

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

View File

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

View File

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

View File

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