Professional Documents
Culture Documents
ToDo App is an Effective and Flexible Way to Keep on Top of Your Tasks. This is an intuitive
android application that will help users remember the important things in a day. It is a reminder
system that is quite helpful for people.
As of now, people have less time to remember anything on a daily basis. And sometimes it can
be difficult to manage and remember every running task. So, using this system people can have
easier tasks somehow. If people set and save their events and other tasks that are important ahead
in this system, it reminds them of the exact time about their work.
FEATURES
Login/Sign up using email and password
Add task
Add task description
Update task
Delete task
Real time database using Firebase
PAGE 2
SOURCE CODE
MainActivity.java
package com.example.todoapp;
import androidx.appcompat.app.AppCompatActivity;
import com.example.todoapp.R;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.view.Window;
import android.view.WindowManager;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.ImageView;
import android.widget.TextView;
@Override
protected void onCreate(Bundle savedInstanceState) {
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
imageView.setAnimation(topAnim);
textView.setAnimation(bottomAnim);
}
}
PAGE 3
Registration.java
package com.example.todoapp;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import android.app.ProgressDialog;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import com.google.android.gms.dynamic.IFragmentWrapper;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.AuthResult;
import com.google.firebase.auth.FirebaseAuth;
@Override
protected void onCreate(Bundle savedInstanceState) {
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_registration);
toolbar = findViewById(R.id.RegistrationToolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setTitle("Registration");
mAuth =FirebaseAuth.getInstance();
loader = new ProgressDialog(this);
RegEmail = findViewById(R.id.RegistrationEmail);
RegPwd = findViewById(R.id.RegistrationPassword);
RegBtn = findViewById(R.id.RegistrationButton);
RegnQn = findViewById(R.id.RegistrationPageQuestion);
RegnQn.setOnClickListener(new View.OnClickListener() {
PAGE 4
@Override
public void onClick(View v) {
Intent intent = new Intent(RegistrationActivity.this, LoginActivity.class);
startActivity(intent);
}
});
RegBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String email = RegEmail.getText().toString().trim();
String password = RegPwd.getText().toString().trim();
if (TextUtils.isEmpty(email)){
RegEmail.setError("email is required");
return;
}
if (TextUtils.isEmpty(password)){
RegPwd.setError("Password required");
return;
}else {
loader.setMessage("Registration in progress");
loader.setCanceledOnTouchOutside(false);
loader.show();
mAuth.createUserWithEmailAndPassword(email,password).addOnCompleteListener(new
OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if (task.isSuccessful()){
Intent intent = new Intent(RegistrationActivity.this,
HomeActivity.class);
startActivity(intent);
finish();
loader.dismiss();
}else {
String error = task.getException().toString();
Toast.makeText(RegistrationActivity.this, "Registration failed" +
error, Toast.LENGTH_SHORT).show();
loader.dismiss();
}
}
});
}
}
});
}
}
PAGE 5
LoginActivity.java
package com.example.todoapp;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import android.app.ProgressDialog;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import com.example.todoapp.R;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.AuthResult;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_login);
mAuth = FirebaseAuth.getInstance();
PAGE 6
toolbar = findViewById(R.id.loginToolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setTitle("Login");
loader = new ProgressDialog(this);
loginEmail = findViewById(R.id.loginEmail);
loginPwd = findViewById(R.id.loginPassword);
loginBtn = findViewById(R.id.loginButton);
loginQn = findViewById(R.id.loginPageQuestion);
loginQn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(LoginActivity.this, RegistrationActivity.class);
startActivity(intent);
}
});
loginBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
final String email = loginEmail.getText().toString().trim();
String password = loginPwd.getText().toString().trim();
if (TextUtils.isEmpty(email)){
loginEmail.setError("Email is required");
return;
}
if (TextUtils.isEmpty(password)){
loginPwd.setError("Password is required");
return;
}else {
loader.setMessage("Login in progress");
loader.setCanceledOnTouchOutside(false);
loader.show();
mAuth.signInWithEmailAndPassword(email, password).addOnCompleteListener(new
OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if (task.isSuccessful()){
Intent intent = new Intent(LoginActivity.this,
HomeActivity.class);
startActivity(intent);
finish();
loader.dismiss();
}else {
String error = task.getException().toString();
Toast.makeText(LoginActivity.this, "Login failed" + error,
Toast.LENGTH_SHORT).show();
loader.dismiss();
}
}
});
PAGE 7
}
}
});
}
@Override
protected void onStart() {
super.onStart();
mAuth.addAuthStateListener(authStateListener);
}
@Override
protected void onStop() {
super.onStop();
mAuth.removeAuthStateListener(authStateListener);
}
}
ActivityMain.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@drawable/background_design"
tools:context=".MainActivity">
<ImageView
android:id="@+id/imageView"
android:layout_width="300dp"
android:layout_height="300dp"
android:src="@drawable/logo"
android:layout_gravity="center"
android:layout_marginTop="100dp"
/>
<TextView
android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="My Todo App"
android:textStyle="bold"
android:layout_gravity="center"
android:textColor="#fff"
android:textSize="30sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
</LinearLayout>
PAGE 8
activity_registration.xml
<androidx.appcompat.widget.Toolbar
android:id="@+id/RegistrationToolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#000"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
/>
<ImageView
android:layout_width="200dp"
android:layout_height="200dp"
android:src="@drawable/logo"
android:layout_marginTop="50dp"
android:layout_gravity="center"/>
<EditText
android:id="@+id/RegistrationEmail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Enter Email.."
android:layout_marginBottom="10dp"
android:layout_marginRight="10dp"
android:layout_marginLeft="10dp"
android:textColor="#fff"
android:textColorHint="#fff"
android:inputType="textEmailAddress"
android:background="@drawable/inputs"
android:drawableStart="@drawable/ic_baseline_email_24"
android:drawablePadding="10dp"
android:padding="10dp"/>
<EditText
android:id="@+id/RegistrationPassword"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Enter password..."
android:layout_margin="10dp"
android:textColor="#fff"
android:textColorHint="#fff"
android:inputType="textPassword"
android:background="@drawable/inputs"
android:drawableStart="@drawable/ic_lock"
android:drawablePadding="10dp"
android:padding="10dp"/>
PAGE 9
<Button
android:id="@+id/RegistrationButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Register"
android:textAllCaps="false"
android:layout_margin="10dp"
android:textColor="#000"
android:textSize="20sp"
android:background="#fff"/>
<TextView
android:id="@+id/RegistrationPageQuestion"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Login Here!"
android:textColor="#fff"
android:layout_gravity="center"
android:gravity="center"
android:layout_marginTop="10dp"/>
</LinearLayout>
Activity_login.xml
<androidx.appcompat.widget.Toolbar
android:id="@+id/loginToolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#000"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
/>
<ImageView
android:layout_width="200dp"
android:layout_height="200dp"
android:src="@drawable/logo"
android:layout_marginTop="50dp"
android:layout_gravity="center"/>
<EditText
android:id="@+id/loginEmail"
PAGE 10
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Enter Email"
android:layout_marginBottom="10dp"
android:layout_marginRight="10dp"
android:layout_marginLeft="10dp"
android:textColor="#fff"
android:textColorHint="#fff"
android:inputType="textEmailAddress"
android:background="@drawable/inputs"
android:drawableStart="@drawable/ic_baseline_email_24"
android:drawablePadding="10dp"
android:padding="10dp" />
<EditText
android:id="@+id/loginPassword"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Enter Password"
android:layout_margin="10dp"
android:textColor="#fff"
android:textColorHint="#fff"
android:inputType="textPassword"
android:background="@drawable/inputs"
android:drawableStart="@drawable/ic_lock"
android:drawablePadding="10dp"
android:padding="10dp" />
<Button
android:id="@+id/loginButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Login"
android:textAllCaps="false"
android:layout_margin="10dp"
android:textColor="#000"
android:textSize="20sp"
android:background="#fff"/>
<TextView
android:id="@+id/loginPageQuestion"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Don't have an account? Register"
android:textColor="#fff"
android:layout_gravity="center"
android:gravity="center"
android:layout_marginTop="10dp"/>
</LinearLayout>
PAGE 11
OUTPUT SCREENSHOTS
MainActivity Page
Splash Screen
will display
anytime the
App is
launched
Login Page
When a user launches the ToDo App, the first page to get displayed is the splash screen. Then
login page will display next. New users are allowed to Register when they click” Don’t have an
account? Register”.
PAGE 12
Registering New User
Registration
Page
Enter Email
and Password
to register
Adding new user
into Firebase
All registration data are stored in Firebase Application (real time database).
PAGE 13
Testing validation on login
Home Page
Click to Add
Login Error task
Validation was tested by inputting wrong password when trying to login. A user can only access
the app after successful login (Correct User details).
PAGE 14
Adding New Task
Add new
task with
description
Click Save
button after
adding new task
PAGE 15
Updating A Task
Task added
successfully
Updating a task
To update a task, tap on the task and make your modification then click on update button.
PAGE 16
Deleting A Task
Update
successful Task Deleted
To delete a task, tap on the particular task and click delete button.
PAGE 17
Logging Out
PAGE 18
REFERENCES
DataFlair – ToDo List App
https://github.com/willteksoftwares/TODO-list-app-using-android-studio-and-Firebase
PAGE 19