Skip to content

Commit

Permalink
Sign In Button Works
Browse files Browse the repository at this point in the history
  • Loading branch information
DrewDahl committed Apr 7, 2010
1 parent 5cb2ab7 commit 7a47cb8
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 6 deletions.
Binary file modified bin/ToDoist.apk
Binary file not shown.
Binary file modified bin/classes.dex
Binary file not shown.
Binary file modified bin/resources.ap_
Binary file not shown.
8 changes: 4 additions & 4 deletions res/layout/login.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
android:background="#ffffff">


<RelativeLayout android:id="@+id/RelativeLayout03" android:layout_width="wrap_content" android:layout_height="wrap_content"><ImageView android:id="@+id/ImageView01" android:layout_above="@+id/EditText01" android:layout_width="wrap_content" android:layout_toRightOf="@+id/TextView01" android:src="@drawable/todoist_logo" android:layout_centerHorizontal="true" android:layout_centerVertical="true" android:layout_height="wrap_content" android:paddingTop="15px"></ImageView></RelativeLayout><RelativeLayout android:id="@+id/RelativeLayout07" android:layout_width="wrap_content" android:layout_height="wrap_content"><RelativeLayout android:layout_height="wrap_content" android:id="@+id/RelativeLayout08" android:layout_width="fill_parent"><TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="#000000" android:id="@+id/TextView02" android:text="E-Mail:"></TextView></RelativeLayout><RelativeLayout android:id="@+id/RelativeLayout01" android:layout_width="wrap_content" android:layout_height="wrap_content" android:paddingLeft="2px" android:layout_below="@+id/RelativeLayout08"><EditText android:id="@+id/EditText01" android:layout_height="wrap_content" android:layout_toRightOf="@+id/TextView02" android:layout_alignTop="@+id/TextView02" android:layout_width="fill_parent" android:inputType="textEmailAddress"></EditText>
<RelativeLayout android:id="@+id/RelativeLayout03" android:layout_width="wrap_content" android:layout_height="wrap_content"><ImageView android:id="@+id/ImageView01" android:layout_above="@+id/EditText01" android:layout_width="wrap_content" android:layout_toRightOf="@+id/TextView01" android:src="@drawable/todoist_logo" android:layout_centerHorizontal="true" android:layout_centerVertical="true" android:layout_height="wrap_content" android:paddingTop="15px"></ImageView></RelativeLayout><RelativeLayout android:id="@+id/RelativeLayout07" android:layout_width="wrap_content" android:layout_height="wrap_content"><RelativeLayout android:layout_height="wrap_content" android:id="@+id/RelativeLayout08" android:layout_width="fill_parent"><TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="#000000" android:text="E-Mail:" android:id="@+id/txt_email"></TextView></RelativeLayout><RelativeLayout android:id="@+id/RelativeLayout01" android:layout_width="wrap_content" android:layout_height="wrap_content" android:paddingLeft="2px" android:layout_below="@+id/RelativeLayout08"><EditText android:layout_height="wrap_content" android:layout_toRightOf="@+id/TextView02" android:layout_alignTop="@+id/TextView02" android:layout_width="fill_parent" android:inputType="textEmailAddress" android:id="@+id/edit_email"></EditText>




</RelativeLayout><RelativeLayout android:layout_width="wrap_content" android:id="@+id/RelativeLayout06" android:layout_height="wrap_content" android:layout_below="@+id/RelativeLayout01"><TextView android:id="@+id/TextView01" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="#000000" android:text="Password:" android:layout_centerVertical="true"></TextView></RelativeLayout><RelativeLayout android:layout_height="wrap_content" android:layout_width="wrap_content" android:id="@+id/RelativeLayout09" android:paddingLeft="2px" android:layout_below="@+id/RelativeLayout06"><EditText android:id="@+id/EditText02" android:layout_height="wrap_content" android:layout_below="@+id/EditText01" android:layout_width="fill_parent" android:paddingTop="4px" android:inputType="textPassword"></EditText></RelativeLayout>
</RelativeLayout><RelativeLayout android:layout_width="wrap_content" android:id="@+id/RelativeLayout06" android:layout_height="wrap_content" android:layout_below="@+id/RelativeLayout01"><TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="#000000" android:text="Password:" android:layout_centerVertical="true" android:id="@+id/txt_pass"></TextView></RelativeLayout><RelativeLayout android:layout_height="wrap_content" android:layout_width="wrap_content" android:id="@+id/RelativeLayout09" android:paddingLeft="2px" android:layout_below="@+id/RelativeLayout06"><EditText android:layout_height="wrap_content" android:layout_below="@+id/EditText01" android:layout_width="fill_parent" android:paddingTop="4px" android:inputType="textPassword" android:id="@+id/edit_pass"></EditText></RelativeLayout>

</RelativeLayout><TableRow android:id="@+id/TableRow01" android:layout_width="wrap_content" android:layout_height="wrap_content">

Expand All @@ -23,8 +23,8 @@



<RelativeLayout android:id="@+id/RelativeLayout04" android:layout_width="wrap_content" android:layout_height="wrap_content"><CheckBox android:id="@+id/CheckBox01" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="#000000" android:layout_centerHorizontal="true" android:text="Remember Password"></CheckBox></RelativeLayout>
<RelativeLayout android:id="@+id/RelativeLayout04" android:layout_width="wrap_content" android:layout_height="wrap_content"><CheckBox android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="#000000" android:layout_centerHorizontal="true" android:text="Remember Password" android:id="@+id/check_rememberPass"></CheckBox></RelativeLayout>

<RelativeLayout android:id="@+id/RelativeLayout05" android:layout_width="wrap_content" android:layout_height="wrap_content"><Button android:id="@+id/Button01" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Sign In" android:layout_centerHorizontal="true" android:minWidth="120px"></Button></RelativeLayout>
<RelativeLayout android:id="@+id/RelativeLayout05" android:layout_width="wrap_content" android:layout_height="wrap_content"><Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Sign In" android:layout_centerHorizontal="true" android:minWidth="120px" android:clickable="true" android:id="@+id/btn_signIn"></Button></RelativeLayout>

</TableLayout>
57 changes: 55 additions & 2 deletions src/com/android/applications/todoist/TasksList.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,71 @@
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.app.AlertDialog;

public class TasksList extends Activity {
private ProgressDialog m_ProgressDialog = null;
private ArrayList<Project> projectArray = null;
private ItemAdapter adapter;
private Runnable viewProjects;
private Button signInButton;
private EditText emailText;
private EditText passText;
private TodoistAPIHandler handler;

@Override
public void onCreate(Bundle savedInstanceState) {
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.login);
initControls();
}

private void initControls()
{
//TextView
//EditText
handler = new TodoistAPIHandler("TOKEN");
emailText = (EditText)findViewById(R.id.edit_email);
passText = (EditText)findViewById(R.id.edit_pass);
signInButton = (Button)findViewById(R.id.btn_signIn);
signInButton.setOnClickListener(new Button.OnClickListener() { public void onClick (View view){ signIn(); } } );
}

private void signIn()
{
String email = emailText.getText().toString();
String password = passText.getText().toString();
if(email.length() == 0)
{
//email is empty.. problem
}
else if(password.length() == 0)
{
//password is empty.. problem
}
else
{
//Attempt Login...
User user = handler.login(email, password);
AlertDialog alert = new AlertDialog.Builder(this).create();
if(user.isValid())
{
alert.setTitle("Success!");
alert.show();
}
else
{
//Login Failure...
alert.setTitle("Failure!");
alert.show();
}
}
}

/*
projectArray = new ArrayList<Project>();
this.adapter = new ItemAdapter(this, R.layout.row, projectArray);
Expand All @@ -36,7 +89,7 @@ public void run() {
Thread thread = new Thread(null, viewProjects, "MagentoBackground");
thread.start();
m_ProgressDialog = ProgressDialog.show(TasksList.this,
"Please wait...", "Retrieving data ...", true);*/
"Please wait...", "Retrieving data ...", true);
}
/*private Runnable returnRes = new Runnable() {
Expand Down
9 changes: 9 additions & 0 deletions src/com/android/applications/todoist/User.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,15 @@ public void setValues(String email, String full_name, String id, String api_toke
this.mobile_host = mobile_host;
}

public Boolean isValid()
{
if( this.api_token == "")
{
return false;
}
return true;
}

/**
* @param email the email to set
*/
Expand Down

0 comments on commit 7a47cb8

Please sign in to comment.