0% found this document useful (0 votes)
103 views

Journal App Report

This document is a mini-project report submitted to Visvesvaraya Technological University for the degree of Bachelor of Engineering in Computer Science and Engineering. It describes the development of a mobile application called "Relive-The Journal App" using Android Studio and Firebase for backend services. The app allows users to create an account, login, and maintain a digital journal by writing and reading entries. Firebase is used for authentication, database storage via Firestore, and image storage. The report includes sections on implementation details, testing, screenshots and a conclusion.

Uploaded by

Aditya S
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
103 views

Journal App Report

This document is a mini-project report submitted to Visvesvaraya Technological University for the degree of Bachelor of Engineering in Computer Science and Engineering. It describes the development of a mobile application called "Relive-The Journal App" using Android Studio and Firebase for backend services. The app allows users to create an account, login, and maintain a digital journal by writing and reading entries. Firebase is used for authentication, database storage via Firestore, and image storage. The report includes sections on implementation details, testing, screenshots and a conclusion.

Uploaded by

Aditya S
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 37

VISVESVARAYA TECHNOLOGICAL UNIVERSITY

Jnana Sangama, Belgaum – 590 014

A MINI-PROJECT REPORT
Mobile Application Development (18CSMP68)
On
RELIVE-THE JOURNAL APP
Submitted in partial fulfilment for the award of the degree of Bachelor of
Engineering
in

COMPUTER SCIENCE AND ENGINEERING


For the academic year 2020-2021

By
VENNALA M REDDY (1GD18CS055)
VISHNU A(1GD18CS056)

Under the guidance of

GIRISH M
Assistant Professor,
Department of CSE, GCEM

GOPALAN COLLEGE OF ENGINEERING & MANAGEMENT


DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
BANGALORE-560 048

i
GOPALAN COLLEGE OF ENGINEERING AND MANAGEMENT
(Accredited by NAAC, 2(f) status by UGC & ISO 9001:2015 certified)
Approved by All India Council for Technical Education (AICTE), New Delhi
Affiliated to Visvesvaraya Technological University (VTU), Belagavi, Karnataka
Recognised by Govt. of Karnataka

DEPARTMENT OF COMPUTER SCIENCE ENGINEERING

CERTIFICATE

This is to certify that the mini-project report entitled “RELIVE-THE JOURNAL APP”
is a bonafide work carried out by VENNALA M REDDY (1GD18CS055) & VISHNU
A(1GD18CS056) in partial fulfilment of requirement of VI semester, Bachelor of
Engineering in Computer Science and Engineering of the Visvesvaraya Technological
University, Belgaum during the year, 2020-21. The project report has been approved as it
satisfies the academic requirement in respect of project work prescribed for the said degree.

Signature of the Guide Signature of the HOD

GIRISH M Dr. J SOMASEKAR

ii
DECLARATION

We, VENNALA M REDDY (1GD18CS055) & VISHNU A (1GD18CS056), students of


VI semester B.E. in Computer Science and Engineering, Gopalan College of Engineering
and Management, Bangalore, hereby declare that the project work entitled “RELIVE-THE
JOURNAL APP” submitted to the Visvesvaraya Technological University during the
academic year 2020-21, is a record of an original work done by us under the guidance of,
GIRISH M , Assistant Professor, Department Computer Science and Engineering,
Gopalan College of Engineering and Management, Bangalore. This project work is
submitted in partial fulfilment of the requirements for the award of the degree of Bachelor
of Engineering in Computer Science and Engineering. The results embodied in this project
have not been submitted to any other University or Institute for the award of any degree.

Date: VENNALA M REDDY(1GD18CS055)

Place: Bengaluru VISHNU A (1GD18CS056)

iii
ACKNOWLEDGEMENT

Our mini-project report is the result of the encouragement of many people who
helped shape it and provided feedback, direction and valuable support. It is with hearty
gratitude that I acknowledge their contribution to my project.

We express gratitude towards Dr. C. PRABHAKAR, Director, Gopalan


Foundation and Dr. N. SENGOTTAIYAN, Principal, Gopalan College of Engineering
and Management, for providing us with the infrastructure and resources that helped in
making this project a success.

We are really thankful to our guide Dr. J. SOMASEKAR, Professor and Head of
Computer Science and engineering, GCEM for constant support extended towards me
during the course of this technical seminar. Help and advice instilled the drive in me to
complete the technical seminar on time.

We are thankful to GIRISH M, Assistant Professor, our guide, Computer Science


& Engineering department, GCEM for constant guidance and encouragement throughout
the period of the technical project. He pushed us to our maximum capabilities.

Finally, we would like to extend our thanks to Almighty, friends and family who supported
us and provided us with suggestions to make the project better.

VENNALA M REDDY (1GD18CS055)


VISHNU A (1GD18CS056)

iv
ABSTRACT

This is a basic Journal (android) app developed in android studio. We use firebase
authentication, database and storage facilities. The user can login using their credentials
and update their dairy. Being a mobile application influences not only the type of
information people seek, but also the way they attempt to access it. It provides an easy and
simple interface for the user.

A personal diary may include the person's experiences, thoughts or feelings. Diaries have
made it more convenient to write down the events happening to the author as it happens. In
this paper, a diary application was developed for an Android Smartphone. The application
is developed using Java language in Android Studio and Firebase for backend database and
storage facilities. Firebase is a cloud computing and development platform of google. The
user has the ability to write entries and read entries. In order to store data, we use firebase’s
firestore which is a storage facility provided by firebase. User authentication is done using
email/password. Any number of users can create an account using valid credentials and can
log in to their account. Authentication is also provided by firebase. It is also used as the
database and as storage for the images the user loads.

v
LIST OF FIGURES

FIG.NO FIGURE NAME PAGE NO


1 Firebase Data Structure 6
2 Data Flow Diagram 8
3 Front Page 24
4 Login Page 24
5 Signup Page 25
6 Journal Entry Page 25
9 Activity Page 26

vi
LIST OF TABLES

SL.NO TABLE NAMES PAGE NO

1 SOFTWARE REQUIREMENTS 3
2 HARDWARE REQUIRMENTS 3
3 TEST CASES 23

vii
TABLE OF CONTENTS

ACKNOWLEDGEMENT…………………………………………………………iv
ABSTRACT………………………………………………………………………...v
LIST OF FIGURES………………………………………………………………..vi
LIST OF TABLES…………………………………………………………………vii

CHAPTERS PAGE NO

Chapter 1

INTRODUCTION.............................................................................................................. 1

1.1 JAVA……………………………………………………........................................ 1

1.2 ANDROID STUDIO……………………………..…………………….................. 1

1.3 PROJECT SCOPE…………………………………………………........................ 1

1.4 PROBLEM STATEMENT……………………………………………………........ 2

1.5 OBJECTIVES OF THE PROJECT………………………………………………... 2

Chapter 2

SOFTWARE AND HARDWARE REQUIREMENTS .................................................. 3

2.1 SOFTWARE REQUIREMENTS: ………………………………………………... 3

2.2 HARDWARE REQUIRMENTS: ……………………………………………….... 3

viii
Chapter 3

ANALYSIS AND DESIGN ............................................................................................... 4

3.1 DATABASE IMPLEMENTATION-FIREBASE……………………………….... 5

3.2 FLOW CHART………………………………………………………..…….……. 8.

Chapter 4

IMPLEMENTATION ....................................................................................................... 9

4.1 SETTING UP THE RELIVE’S SDKS…………………………………………… 9

4.2 DEVELOPING THE LOGIN & SIGN-UP FLOW……………………………… 9

4.3 BUILDING POST SCREENS…………………………………………………… 9

4.4 BUILT IN FUNCTIONS……………………………………………………..…. 10

4.5 ANDROID MANIFEST AND SPECIAL PERMISSIONS………………..…… 13

Chapter 5

TESTING ................................................................................................................................... 23

Chapter 6

SCREENSHOTS ........................................................................................................................ 24

CONCLUSION .......................................................................................................................... 27

REFRENCES ............................................................................................................................. 28

ix
Relive – The Journal App

CHAPTER-1
INTRODUCTION

1.1 Java

Java is a programming language originally developed by James Gosling at Sun


Microsystems. The language derives much of its syntax from C and C++ but has a simpler
object model and fewer low- level facilities. Java applications are typically compiled to
byte code (class file) that can run on any Java Virtual Machine (JVM) regardless of
computer architecture. Java programming is object-oriented programming language. Like
C++ java provides most of the object-oriented features. Java is pure OOP. Language. (while
C++ is semi object oriented). Java is Easy to write and more readable and eye catching.
Java has a concise, cohesive set of features that makes it easy to learn and use.

1.2 Android Studio

Android is one of the most popular mobile device platforms. The Android platform allows
developers to write managed code using Java to manage and control the Android device.
Android Studio is a popular IDE developed by Google for developing applications that are
targeted at the Android platform. Note that Android Studio has replaced Eclipse as the IDE
of choice for developing Android applications. This article presents a discussion on how to
get started using the Android Studio for developing Android applications. Android Studio
contains tools such as the Android Virtual Device Manager and the Android Device
Monitor. It also contains Gradle, which helps you configure your Android application
seamlessly.

1.3 Project Scope


The purpose of the journal application is to allow users be able to add entries of day-to-day
activities, like a normal note application. The users will be able to create an entry by adding
a picture of their choice. Number of users can login and out using their credentials thus
provides more security for their data. The users can also use the application as their note
app.

Dept. of CSE 2020-21 Page 1


Relive – The Journal App

1.4 Problem Statement

This project is to create a journal application with a cloud server and users to enable the
users to add entries. To develop an instant diary solution to enable users to seamlessly
create an entry in form of a post, which can serve as a remainder or as a note. The project
should be very easy to use enabling even a novice person to use it.

1.5 Objectives of the Project

The objective of this process is as follows:

1. To develop an instant diary solution to enable users to seamlessly create an entry in form
of a post, which can serve as a remainder or as a note.

2. The project should be very easy to use enabling even a novice person to use it.

Dept. of CSE 2020-21 Page 2


Relive – The Journal App

CHAPTER-2
SOFTWARE AND HARDWARE REQUIREMENTS

Requirement analysis, also called requirements engineering, is the process of


determining user expectations for a new or modified product. These features, called
requirements, must be quantifiable, relevant and detailed. In software engineering, such
requirements are often called functional specifications.

2.1 SOFTWARE REQUIREMENTS:

Operating Windows 10 or Linux (Fedora) or macOS


System
Language Java
used
Toolkit Android Studio 4.1

Size 727 to 877 MB

Resolution 1280 x 800 minimum screen resolution

Database Firebase

Disk 8 GB of available disk space minimum (IDE + Android SDK + Android


space Emulator)

2.2 HARDWARE REQUIRMENTS:

Computer Processor Intel® Core™ i5 processor

Processor Speed 1.70 GHz Processor

Hard Disk 64GB

RAM 8.00 GB

Dept. of CSE 2020-21 Page 3


Relive – The Journal App

CHAPTER-3
ANALYSIS AND DESIGN

Project design is a crucial stage in a project’s life cycle because it identifies key elements
and sets the overall tone. For your project to be successful, you must first understand the
steps involved in project design, as well as how to document them.

Creating a project design can help you avoid pitfalls down the road and also set a reasonable
budget from the outset. Software development projects can be highly technical and
complex. These project designs have a broad range: from simple diagrams or descriptions
of requirements and functions to long, detailed documents outlining every technical
specification of the application or system.

We have used the following attributes:

 LinearLayout
 RelativeLayout
 Button
 EditText
 ProgressBar
 AutoCompleteTextView
 CardView
 RecyclerView
 ContraintLayout
 ImageView

These are the attributes that we used. They helped in the login, sign up and to view the
posts in the list view. We added a separate menu file to create the menu which had the
logout option. On clicking which the user will be able to logout.

Dept. of CSE 2020-21 Page 4


Relive – The Journal App

3.1 DATABASE IMPLEMENTATION-FIREBASE

Monitor rules for firebase

rules_version = '2';

service cloud.firestore {

match /databases/{database}/documents {

match /{document=**} {

allow read, write;

Authentication:

After adding firebase and authentication dependency to the Android application, the user
can create login id by the following code [6]:

FirebaseAuth auth=FirebaseAuth.getInstance();

auth.signInWithEmailAndPassword(email, password)

.addOnCompleteListener(new OnCompleteListener())

@Override

public void onComplete (Task task)

if(task.isSuccessful())

Dept. of CSE 2020-21 Page 5


Relive – The Journal App

FirebaseUser user=task.getResult().getUser();

String email=user.getEmail();

//…

});

Database:

Firebase real-time database feature is very easy to use. Once the Firebase and database dependency
added to the app,unstructured data can be added to database by the following code [7]:

//Write a message to the database

FirebaseDatabase database= FirebaseDatabase.getInstance;

DatabaseReference myref=database.getReference(“node”);

myRef.setValue (“Hello, World”);

Fig 3.1: Firebase Data Structure.

Dept. of CSE 2020-21 Page 6


Relive – The Journal App

Storage

The files like images, audio, video etc can be stored in the app. The data stored is highly secured
and is robust in nature means it resumes from the last point if any network error occurs. The steps
below are to be followed to use storage feature in Android application:

 Once the Firebase and storage dependency are added to the application, create instance of
FirebaseStorage storageobject =FirebaseStorage.getInstance();

 Second, create the reference to location by:


StorageReference FileRef =storageRef.child("filePath");

 The file can be uploaded by using one of putBytes(),putFile(), putData() or putStream()


method which returns to UploadTask.

Inserting New Data:

An object class or a map can be used to insert new data .Once the object is created, navigate
the Firebase reference tothe position where a child can be added.

If a list is created and does not have a specific names for each child, the push() method can
be used before the setValue() is called.

Call: ref.push().setValue(object) or ref.setValue(object).

Dept. of CSE 2020-21 Page 7


Relive – The Journal App

3.2 FLOW CHART

Fig 3.2: Data Flow Diagram

Dept. of CSE 2020-21 Page 8


Relive – The Journal App

CHAPTER-4
IMPLEMENTATION

4.1 Setting Up the ReLive’s SDKs

Before starting with ReLive, it is important to understand how the app works! The Key
Concepts page of the application’s documentation can help you with that:

4.2 Developing the Login & Sign-up Flow


Here, the user will be identified by a unique identifier called UID which was created during
the creation of the account itself. For creating an account, the user is required to input
username, email and password. We use the email/password authentication in Firebase to
authenticate our user credentials. Once an account is created, a unique UID is created for
each user by means of which they will be identified in the database as well as the storage.

Now that we have both username and UID, a collection is created in the database named as
User’s where each UID and its associated username is saved. The UID can be found by
means of email in the authentication area of the FireBase.

You can also view all the registered users in the ReLive’ Dashboard.

4.3 Building Post Screens

1. Setting Up the List of Journal Posts Screen


Once the user logs in to the app, we would be showing the user’s latest posts along with
its timestamp as how long since it’s been posted. This screen contains a list of all the post
horizontally. The screen is connection to storage and database to show all posts made by
the user in order from latest post to earlier ones.

Dept. of CSE 2020-21 Page 9


Relive – The Journal App

2. Setting Up Journal Post Screen to post new journals


We use a button from the List of Journals screen to add an new post. This screen allows the
user to create a new post – the user can add an image, a title and a little bit written info
about their day. All of the written part is saved in the database in collection called Journals
which can be identified by UID. The image is saved the storage as part of the Journal_image
collection, here too, each image is associated with a UID.

4.4 Built in Functions

1. getSupportActionBar()
Support library version of android.app.Activity.getActionBar. Retrieve a reference to this
activity's ActionBar.

2. setDisplayHomeAsUpEnabled(boolean showHomeAsUp)
Set whether home should be displayed as an "up" affordance. Set this to true if selecting
"home" returns up by a single level in your UI rather than back to the top level or front
page. To set several display options at once, see the setDisplayOptions methods.

3. Init()
Init method is a predefined method to initialize an object after its creation. Init method is
a life cycle method for servlets for java. It is started by the browser when java program is
loaded and run by the browser. Init method is a predefine method to initialize an object
after its creation.

4. FetchCountryWiseData()
Method to retriew country wise data JSON from the URL

5. OnRefreshListener()
Classes that wish to be notified when the swipe gesture correctly triggers a refresh should
implement this interface.

Dept. of CSE 2020-21 Page 10


Relive – The Journal App

6. setRefreshing(boolean refreshing)
Notify the widget that refresh state has changed. Do not call this when refresh is triggered
by a swipe gesture. Refreshing-Whether or not the view should show refresh progress.

7. LinearLayoutManager(@Nullable android.content.Context context)


Creates a vertical LinearLayoutManager

8. toLowerCase()
The java string toLowerCase() method converts all characters of the string into lowercase
letter. There are two types of toLowerCase() method. Signature: public String
toLowerCase(Locale loc) and public String toLowerCase() Parameter: loc- locale value to
be applied.

9. Handler()
A handler is basically a message queue. You post a message to it, and it will eventually
process it by calling its run method and passing the message to it. Since these run calls will
always occur in the order of messages received on the same thread, it allows you to serialize
events.

10. getIntent()
when called in an Activity, gives you a reference to the Intent which was used to launch
this Activity. There are two primary forms of intents you will use. Explicit Intents have
specified a component (via setComponent(ComponentName) or setClass(Context, Class)),
which provides the exact class to be run.

11. setDisplayShowHomeEnabled(boolean showHome)


Set whether to include the application home affordance in the action bar. Home is presented
as either an activity icon or logo. To set several display options at once, see the
setDisplayOptions methods. showHome – true to show home, false otherwise.

12. startAnimation()
Android Animation is used to give the UI a rich look and feel. Animations in android apps
can be performed through XML or android code.

13. onListItemClick()
The method is used to process the clicks on android ListView item.

Dept. of CSE 2020-21 Page 11


Relive – The Journal App

14. finish()
Method is called to kill your activity instance after you did what you have to do with the
activity.

15. LoadStateData()
Method to retriew country wise data JSON from the URL

16. onCreate(Bundle savedInstanceState)


The method onSaveInstanceState(Bundle) is called before placing the activity in such a
background state, allowing you to save away any dynamic instance state in your activity
into the given Bundle, to be later received in onCreate(Bundle) if the activity needs to be
re-created.

17. setOnClickListener()
One of the most usable methods in android is setOnClickListener method which helps us
to link a listener with certain attributes. setOnClickListener is a method in Android
basically used with buttons, image buttons etc. You can initiate this method easily like,
public void setOnClickListener(View.OnClickListner)

18. CheckForUpdate()
This plugin checks whether updates are available, and prompts the user to launch the
updater if so.

19. getPackageManager()
It is a method of Context. You can use this method inside an Activity (because an Activity
is a Context), but if you are calling it elsewhere, you need to pass a Context. In a fragment
you may also have access to the getActivity() function, which returns the Acitivity-Context.

20. create()
Creates an AlertDialog with the arguments supplied to this builder. Calling this method
does not display the dialog. If no additional processing is needed, show() may be called
instead to both create and display the dialog.

21. clearChart()
Resets and clears the data object. Specified by clearChart in class BaseChart.

Dept. of CSE 2020-21 Page 12


Relive – The Journal App

22. onBackPressed():
If we have Override onBackPressed() method then we have to call finish() explicitly to
destroy activity. Finish: If we implement finish() method it intended to close current
Activity. If our application don't have top backstack will redirect to android Home Screen.

23. getWindow()
We have a managed reference to our activity in a view, which we can retrieve using
getContext(). Cast it to Activity and can use any methods from the activity, such as
getWindow().

To connect APIs to the firebase database application needs supporting libraries to be


defined in the app, the libraries imported into the application are listed below:

• Volley- To load JSON data from the API into the Android app.

• Ease Graph- It is used to implement the pie chart.

• Glide- To use the flag symbolic signs as country images.

• Circular Image View- Used to make the images to be in circular.

• Card View- It represented within the grid layout to create a separate card into four
sections.

• Recycler View- To show data in form list that is to display various state and district cases.

• Swipe Refresh Layout- To refresh the page or the layout to the current running data to
progress and to update the app to recent track.

• Firebase- To implement the versioning feature and to update real-time database whenever
app updates the version name will directly appear in the app.

4.5 Android Manifest and Special Permissions

Every app project must have an AndroidManifest.xml file (with precisely that name) at the
root of the project source set. The manifest file describes essential information about your
app to the Android build tools, the Android operating system, and Google Play.

Dept. of CSE 2020-21 Page 13


Relive – The Journal App

While building our app into the final application package (APK), the Android build tools
use the package attribute for two things:

• It applies this name as the namespace for our app's generated covid19tracker.java class
(used to access our app resources).

• It uses this name to resolve any relative class names that are declared in the manifest file.

4.5.1 App Components

For each app component that we created in our app, must declare a corresponding XML
element in the manifest file:

• <activity> for each subclass of Activity.

• <service> for each subclass of Service.

• <receiver> for each subclass of Broadcast Receiver.

• <provider> for each subclass of Content Provider.

An app component can have any number of intent filters (defined with the <intent- filter>
element), each one describing a different capability of that component. A number of
manifest elements have icon and label attributes for displaying a small iconand a text label,
respectively, to users for the corresponding app component.

4.5.2 Special Permissions

To perform network operations in our application, our manifest must include the following
permissions:

<uses-permission android:name="android.permission.INTERNET"/>

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>

Before adding networking functionality to our app, we need to ensure that data and
information within our app stays safe when transmitting it over a network. To do so, follow
these networking security best practices:

Dept. of CSE 2020-21 Page 14


Relive – The Journal App

• Minimize the amount of sensitive or personal user data that we transmit over the network.

• Send all network traffic from your app over SSL.

• Consider creating a network security configuration, which lets our app trust custom
certificate authorities (CAs) or restrict the set of system CAs that it trusts for secure
communication.

4.5.3 Android Manifest.xml

<?xml version="1.0" encoding="utf-8"?>

<manifest xmlns:android="http://schemas.android.com/apk/res/android"

package="com.aar.dairio">

<uses-permission android:name="android.permission.INTERNET" />

<application

android:allowBackup="true"

android:icon="@mipmap/ic_launcher2_round"

android:label="@string/app_name"

android:roundIcon="@mipmap/ic_launcher2_round"

android:supportsRtl="true"

android:theme="@style/Theme.Dairio">

<activity android:name=".PostJournalActivity"></activity>

<activity android:name=".JournalListActivity" />

<activity android:name=".CreateAccountActivity" />

<activity android:name=".LoginActivity" />

<activity android:name=".MainActivity">

<intent-filter>

Dept. of CSE 2020-21 Page 15


Relive – The Journal App

<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />

</intent-filter>

</activity>

<meta-data

android:name="preloaded_fonts"

android:resource="@array/preloaded_fonts" />

</application>

</manifest>

4.5.4 Source code – xml (activity_main.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"

android:layout_width="match_parent"

android:layout_height="match_parent"

android:gravity="center"

android:orientation="vertical"

android:padding="18dp"

xmlns:tools="http://schemas.android.com/tools"

Dept. of CSE 2020-21 Page 16


Relive – The Journal App

android:background="@drawable/grad_bg"

tools:context=".MainActivity">

<TextView

android:id="@+id/Title"

android:layout_width="371dp"

android:layout_height="wrap_content"

android:fontFamily="@font/almendra_display"

android:text="@string/Title3"

android:textAlignment="center"

android:textAllCaps="false"

android:textColor="@color/white"

android:textSize="46sp"

android:textStyle="bold" />

<RelativeLayout

android:id="@+id/relayout"

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:gravity="center_horizontal">

<androidx.cardview.widget.CardView

android:layout_width="match_parent"

android:layout_height="90dp"

app:cardCornerRadius="8dp"

app:cardElevation="6dp"

Dept. of CSE 2020-21 Page 17


Relive – The Journal App

app:cardUseCompatPadding="true">

<TextView

android:id="@+id/tag"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_gravity="center"

android:text="@string/tagtext2"

android:textSize="19sp" />

</androidx.cardview.widget.CardView>

</RelativeLayout>

<Button

android:id="@+id/startButton"

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:text="@string/letsgo"

android:background="@android:color/transparent"

android:textColor="@color/ecolor4b"/>

</LinearLayout>

4.5.5 Source code – java (main_activity.java)

package com.aar.dairio;

import androidx.appcompat.app.AppCompatActivity;

Dept. of CSE 2020-21 Page 18


Relive – The Journal App

import android.content.Intent;

import android.os.Bundle;

import android.view.View;

import android.widget.Button;

import com.google.firebase.auth.FirebaseAuth;

import com.google.firebase.auth.FirebaseUser;

import com.google.firebase.firestore.CollectionReference;

import com.google.firebase.firestore.EventListener;

import com.google.firebase.firestore.FirebaseFirestore;

import com.google.firebase.firestore.FirebaseFirestoreException;

import com.google.firebase.firestore.QueryDocumentSnapshot;

import com.google.firebase.firestore.QuerySnapshot;

import java.util.Objects;

import util.JournalApi;

import javax.annotation.Nullable;

public class MainActivity extends AppCompatActivity {

private FirebaseAuth firebaseAuth;

private FirebaseAuth.AuthStateListener authStateListener;

private FirebaseUser currentUser;

private FirebaseFirestore db = FirebaseFirestore.getInstance();

private CollectionReference collectionReference = db.collection("Users");

@Override

protected void onCreate(Bundle savedInstanceState) {

Dept. of CSE 2020-21 Page 19


Relive – The Journal App

super.onCreate(savedInstanceState);

setContentView(R.layout.activity_main);

Button getStartedButton = findViewById(R.id.startButton);

Objects.requireNonNull(getSupportActionBar()).setElevation(0);

firebaseAuth = FirebaseAuth.getInstance();

authStateListener = new FirebaseAuth.AuthStateListener() {

@Override

public void onAuthStateChanged(FirebaseAuth firebaseAuth) {

currentUser = firebaseAuth.getCurrentUser();

if (currentUser != null) {

currentUser = firebaseAuth.getCurrentUser();

final String currentUserId = currentUser.getUid();

collectionReference

.whereEqualTo("userId", currentUserId)

.addSnapshotListener(new EventListener<QuerySnapshot>() {

@Override

public void onEvent(@Nullable QuerySnapshot


queryDocumentSnapshots,

@Nullable FirebaseFirestoreException e) {

if (e != null) {

return;

String name;

if (!queryDocumentSnapshots.isEmpty()) {

Dept. of CSE 2020-21 Page 20


Relive – The Journal App

for (QueryDocumentSnapshot snapshot :


queryDocumentSnapshots) {

JournalApi journalApi = JournalApi.getInstance();

journalApi.setUserId(snapshot.getString("userId"));

journalApi.setUsername(snapshot.getString("username"));

startActivity(new Intent(MainActivity.this,

JournalListActivity.class));

finish();

});

}else {

};

getStartedButton.setOnClickListener(new View.OnClickListener() {

@Override

public void onClick(View v) {

//we go to LoginActivity

startActivity(new Intent(MainActivity.this,

LoginActivity.class));

finish();

Dept. of CSE 2020-21 Page 21


Relive – The Journal App

});

@Override

protected void onStart() {

super.onStart();

currentUser = firebaseAuth.getCurrentUser();

firebaseAuth.addAuthStateListener(authStateListener);

@Override

protected void onPause() {

super.onPause();

if (firebaseAuth != null) {

firebaseAuth.removeAuthStateListener(authStateListener);

Dept. of CSE 2020-21 Page 22


Relive – The Journal App

CHAPTER 5
TESTING

System testing is the stage of implementation, which is aimed at ensuring that the system
works accurately and efficiently before live operation commences. Testing is vital to the
success of the system. Testing is the process of executing a program with the explicit
intention of finding errors that is making the program fail. The tester may analysts,
programmer or a specialist trained for software testing, is actually trying to make the
program fail. Analysts know that an effective testing program does not guarantee system
reliability. Therefore, reliability must be designed into the system.

Test cases:

SL. Description Input Expected output Actual output Remarks


NO
1. Submit user Details of Prompt the user Alert Pass
Credentials the user after insertion. Observed.

2. Submit user Login Details of Activity Page. Activity Page. Pass


the user

3 Journal Entry Photo, title, Displaying the Displaying Pass


descriptions entry. the entry.

Dept. of CSE 2020-21 Page 23


Relive – The Journal App

CHAPTER 6
SCREENSHOTS

Fig 6.1 Front Page

Fig 6.2 Login Page

Dept. of CSE 2020-21 Page 24


Relive – The Journal App

Fig 6.3 Signup Page

Fig 6.4 Journal Entry Page

Dept. of CSE 2020-21 Page 25


Relive – The Journal App

Fig 6.5 Activity Page

Dept. of CSE 2020-21 Page 26


Relive – The Journal App

CONCLUSION

It has been an interesting journey through the development of this project. At the beginning
we used our limited knowledge to implement only the basic features. However, through the
months of development, new issues and bugs led to new ideas which led to newer methods
of implementation which, in turn, led to us learning even more features of the Android
Studio and apply more creative and efficient ways to perform the functions. We used Oreo
version of android which helped us in adding flexibility to the various parts of the program,
making the further addition of newer features easier and less time consuming which, again,
led to the possibility of adding even more features. This sequential chain reaction of
progress and ideas has enabled to learn so much through the months of working on this
project and we have done our best to add as many features as we could and provide a user
interface that is easy and intuitive to use.

Before concluding, it is worth mentioning that this project would never have been possible
without the tremendous amount of encouragement by the staff and guides of our
department.

Dept. of CSE 2020-21 Page 27


Relive – The Journal App

REFRENCES

1. Erik Hellman, "Android Programming - Pushing the Limits", 1" Edition, Wiley India

2014.

2. Dawn Griffiths and David Griffiths, "Head First Android Development", 1" Edition

O’Reilly SPD Publishers, 2015.

3.Bill Phillips, Chris Stewart and Kristin Marsicano. "Android Programming: The Big

Nerd Ranch Guide", 3rd Edition, Big Nerd Ranch Guides, 2017.

4. http://developerfirebase/android.com.

Dept. of CSE 2020-21 Page 28

You might also like