1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-11 12:05:06 -05:00

Used traditional cancel/next buttons on confirm screens. Implemented the Cancel action.

This commit is contained in:
Sander Bogaert 2012-04-30 14:38:52 +02:00 committed by Andrew Chen
parent 44fae8bbdb
commit 92cd70c068
2 changed files with 213 additions and 178 deletions

View File

@ -1,199 +1,228 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
android:layout_height="fill_parent"
android:orientation="vertical" >
<LinearLayout
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<TableLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/confirm_options"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:padding="15dp"
android:stretchColumns="3" >
<TableRow>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_column="1"
android:paddingRight="40dp"
android:text="Type:"
android:textSize="14sp" />
<Spinner
android:id="@+id/spinner_protocol"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_column="2"
android:drawSelectorOnTop="true"
android:prompt="@string/account_setup_basics_email_hint" />
<!--<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_column="3"
android:gravity="center_vertical|center_horizontal"
android:text="Extra information" />-->
</TableRow>
<TableRow>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_column="1"
android:text="Security:"
android:textSize="16sp" />
<Spinner
android:id="@+id/spinner_sockettype"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_column="2"
android:drawSelectorOnTop="true"
android:prompt="@string/account_setup_basics_email_hint" />
<!--<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_column="3"
android:gravity="center_vertical|center_horizontal"
android:text="Extra information" />-->
</TableRow>
</TableLayout>
<RelativeLayout
android:id="@+id/server_information_header"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/confirm_options"
android:layout_marginTop="3dp"
android:background="#AAA"
android:padding="9dp"
android:textSize="16sp" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:text="Server information" />
<TextView
android:id="@+id/server_count_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true" />
</RelativeLayout>
<TextView
android:id="@+id/server_information"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/server_information_header"
android:paddingLeft="8dp"
android:paddingTop="8dp" />
<!-- ONLY SHOW WHEN USER HAS TO ENTER A USERNAME HIMSELF -->
android:layout_marginBottom="54dip" >
<LinearLayout
android:id="@+id/account_custom_username"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="8dp" >
android:layout_height="fill_parent"
android:orientation="vertical" >
<TextView
android:id="@+id/account_username_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Please enter your username: " />
<EditText
android:id="@+id/account_username_field"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:hint="Username...... "
android:singleLine="true" />
</LinearLayout>
<!--
SHOULD ONLY BE MADE VISIBLE WHEN THERE ARE MULTIPLE MATCHING SERVERS
NOTE: see note at beginning of AbstractSetupConfirmActivity class
-->
<RelativeLayout
android:id="@+id/confirm_serverbrowse_buttons"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_below="@id/server_information" >
<Button
android:id="@+id/confirm_prev_server_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:text="Previous" />
<Button
android:id="@+id/confirm_next_server_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_toRightOf="@id/confirm_prev_server_button"
android:text="Next" />
</RelativeLayout>
<!-- SHOULD ONLY BE MADE VISIBLE WHEN THE XML PROVIDES EXTRA INFORMATION LINKS -->
<RelativeLayout
android:id="@+id/confirm_documentation_part"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/confirm_serverbrowse_buttons"
android:layout_marginTop="8dp"
android:visibility="gone" >
<TextView
android:id="@+id/server_documentation_header"
<TableLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/confirm_options"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerHorizontal="true"
android:padding="15dp"
android:stretchColumns="3" >
<TableRow>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_column="1"
android:paddingRight="40dp"
android:text="Type:"
android:textSize="14sp" />
<Spinner
android:id="@+id/spinner_protocol"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_column="2"
android:drawSelectorOnTop="true"
android:prompt="@string/account_setup_basics_email_hint" />
<!--
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_column="3"
android:gravity="center_vertical|center_horizontal"
android:text="Extra information" />
-->
</TableRow>
<TableRow>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_column="1"
android:text="Security:"
android:textSize="16sp" />
<Spinner
android:id="@+id/spinner_sockettype"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_column="2"
android:drawSelectorOnTop="true"
android:prompt="@string/account_setup_basics_email_hint" />
<!--
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_column="3"
android:gravity="center_vertical|center_horizontal"
android:text="Extra information" />
-->
</TableRow>
</TableLayout>
<RelativeLayout
android:id="@+id/server_information_header"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/confirm_options"
android:layout_marginTop="3dp"
android:background="#AAA"
android:padding="9dp"
android:text="Server documentation"
android:textSize="14sp" />
android:textSize="16sp" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:text="Server information" />
<TextView
android:id="@+id/server_count_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true" />
</RelativeLayout>
<TextView
android:id="@+id/server_documentation_content"
android:layout_width="wrap_content"
android:id="@+id/server_information"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/server_documentation_header"
android:padding="8dp" />
</RelativeLayout>
android:layout_below="@id/server_information_header"
android:paddingLeft="8dp"
android:paddingTop="8dp" />
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<!-- ONLY SHOW WHEN USER HAS TO ENTER A USERNAME HIMSELF -->
<Button
android:id="@+id/confirm_ok_button"
android:layout_width="wrap_content"
<LinearLayout
android:id="@+id/account_custom_username"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="10dp"
android:text="Ok go" />
</RelativeLayout>
</LinearLayout>
android:orientation="vertical"
android:padding="8dp" >
</ScrollView>
<TextView
android:id="@+id/account_username_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Please enter your username: " />
<EditText
android:id="@+id/account_username_field"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:hint="Username...... "
android:singleLine="true" />
</LinearLayout>
<!--
SHOULD ONLY BE MADE VISIBLE WHEN THERE ARE MULTIPLE MATCHING SERVERS
NOTE: see note at beginning of AbstractSetupConfirmActivity class
-->
<RelativeLayout
android:id="@+id/confirm_serverbrowse_buttons"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_below="@id/server_information" >
<Button
android:id="@+id/confirm_prev_server_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:text="Previous" />
<Button
android:id="@+id/confirm_next_server_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_toRightOf="@id/confirm_prev_server_button"
android:text="Next" />
</RelativeLayout>
<!-- SHOULD ONLY BE MADE VISIBLE WHEN THE XML PROVIDES EXTRA INFORMATION LINKS -->
<RelativeLayout
android:id="@+id/confirm_documentation_part"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/confirm_serverbrowse_buttons"
android:layout_marginTop="8dp"
android:visibility="gone" >
<TextView
android:id="@+id/server_documentation_header"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:background="#AAA"
android:padding="9dp"
android:text="Server documentation"
android:textSize="14sp" />
<TextView
android:id="@+id/server_documentation_content"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/server_documentation_header"
android:padding="8dp" />
</RelativeLayout>
</LinearLayout>
</ScrollView>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentBottom="true"
android:layout_marginTop="-45dip"
android:background="@android:drawable/bottom_bar"
android:gravity="bottom|right"
android:padding="0dip" >
<Button
android:id="@+id/confirm_cancel_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="false"
android:layout_marginBottom="-4dip"
android:minWidth="@dimen/button_minWidth"
android:text="@string/cancel_action" />
<Button
android:id="@+id/confirm_ok_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="false"
android:layout_marginBottom="-4dip"
android:drawableRight="@drawable/button_indicator_next"
android:minWidth="@dimen/button_minWidth"
android:text="@string/next_action" />
</RelativeLayout>
</LinearLayout>

View File

@ -130,6 +130,7 @@ public abstract class AbstractSetupConfirmActivity extends K9Activity implements
mProtocolSpinner.setOnItemSelectedListener(this);
mSocketTypeSpinner.setOnItemSelectedListener(this);
mOkButton.setOnClickListener(this);
((Button)findViewById(R.id.confirm_cancel_button)).setOnClickListener(this);
mUsernameField.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {}
@ -150,6 +151,11 @@ public abstract class AbstractSetupConfirmActivity extends K9Activity implements
case R.id.confirm_ok_button:
finishAction();
break;
case R.id.confirm_cancel_button:
// by deleting we make sure the user ends up in the init screen again instead of a useless accountlist
Preferences.getPreferences(this).deleteAccount(mAccount);
finish();
return;
case R.id.confirm_next_server_button:
// TODO: write this,... it will probably never be used since no isp has 2 host for exact the same thing
break;