Food Donation App Review3-Converted (3) .. - Abhishek Datta

Download as pdf or txt
Download as pdf or txt
You are on page 1of 80

FOOD DONATION APP

A Report for the Evaluation 3 of Project 2

Submitted by
ABHISHEK DATTA
(1613101031)

in partial fulfilment for the award of the degree


of

BACHELOR OF TECHNOLOGY
IN
COMPUTER SCIENCE AND ENGINEERING

SCHOOL OF COMPUTING SCIENCE AND ENGINEERING

Under the Supervision of


Mr. S. P. RAMESH
Assistant Professor

APRIL / MAY- 2020


SCHOOL OF COMPUTING AND SCIENCE AND
ENGINEERING

BONAFIDE CERTIFICATE

Certified that this project report “ FOOD DONATION APP ” is the bonafide

work of “ ABHISHEK DATTA (1613101031) ” who carried out the project

work under my supervision.

Signature of the Head of the Department Signature of the Supervisor


SIGNATURE SIGNATURE
Dr. MUNISH SHABARWAL Mr. S. P. RAMEAH
PhD (Management), PhD (CS) B. Tech., M.E.,
Professor & Dean Assistant Professor

School of Computing Science &


School of Computing Science &
Engineering
Engineering
TABLE OF CONTENT

CHAPTER NO. TITLE PAGE NO.


1 ABSTRACT
2 INTRODUCTION 1

2.1 Scope and Objective 2


2.2 Modules and its Description 3

3 PROPOSRD SYSTEM 6

4 PROJECT LIFECYCLE 7

4.1 Project Lifecycle Details 7

5 PROJECT DESIGN 8

5.1 E-R Diagram 8


5.2 Use Case Diagram 9
5.3 Sequence Diagram 12
5.4 Activity Diagram 15
5.5 Data Flow Diagram 18
5.6 System Architecture 27
6 PROJECT IMPLEMENTATION 28

6.1 Project Implementation Technology 28


6.2 Feasibility Report 38

7 CODING 42

7.1 Project Coding 42

8 SNAPSHOTS 65

8.1 Project Snapshots 65


9 TESTING 67

9.1 Testing 67
9.2 Levels of Testing 68
9.3 Test Cases 71
10 ADVANTAGES & LIMITATIONS 72

10.1 Advantages 72
10.2 Limitations 72
10.3 Features 73
11 CONCLUSION 74

11.1 Project Conclusion 74

12 BIBIIOGRAPHY 75

12.1 Website Links 75


ABSTRAT

First Step capstone project objective is to handle donations and connect the
donators with the nearest/appropriate needy person through a social mobile
application. The application handles different services such as the reviews of
the searched needy person and displays their contacts and their location.

The application allows users to create a profile for themselves and the
information about a certain family that needs help. This profile will be shown
to donators who are looking for someone to donate to. Mainly only
information is exchanged. The donators are able to post/see reviews about
other people’s profiles.

This application is aimed to help the Moroccan society and create a sense of
solidarity through modern techniques. The social implications it will have after
being launched will certainly aim at closing the gap in terms of quality of life
for the less fortunate citizens.
INTRODUCTION

A single restaurant wastes about 1000 pounds of food in a month.


Restaurants, caterers, corporate dining rooms, hotels, and other food
establishments promptly distribute perishable and prepared foods to hungry
people in their communities. In this system hotels can provide food to NGO’s
by requesting them. NGO’s can also request hotels when they feel shortage of
food. No food waste is the mission of this system. In this system there are 3
major entity namely, Admin, Restaurant and NGO. Admin can login and
manage restaurants and NGO’s by adding them and update the list. Restaurant
can login and update their profiles. They can also view the accepted food list
which is yet to pick up. Restaurant can add access food details. They can also
accept request from NGO. Restaurant can also view the accepted, pending and
previous todays Access Food list which are accepted by NGO. They will be
getting notifications. NGO can login and update their profile by providing
details. They can view and accept the restaurants request and also food
details. They can accept and assign an employee for food pick up. In the time
of food shortage NGO can also raise request to the restaurants. And after
request been accepted by restaurant, they can assign an employee for delivery
purpose. They will get notifications.

1
Scope and Objective

Many people face starving because of food shortage. Food


shortages in developing countries are common. The people most
affected are smallholder. There are several ways and means to help
the needy but nothing works better than making a contribution to an
organization dedicated to helping poor communities to battle against
poverty. People living in NGO also faces food shortage issues. This
application can help needy people to eat food. With help of this
application restaurant can serve food to many people. NGO’s can
also contact restaurants for providing food in shortage of food. This
can feed many poor and needy people.

2
Modules and their Description

The system comprises of 2 major modules with their sub-modules as follows:

1. Admin
• Login: Admin can login using credentials.
• Manage Restaurant: Admin can manage restaurant by adding new
restaurant.
• Manage NGO: Admin can manage NGO’s

2. Restaurant
• Login: Restaurant can login using credentials.
• Profile: Restaurant can make their profile by their details.
• Change Password: Restaurant can also change their password in
case of emergency.
• Home: Todays Access food list accepted by NGO and yet to pick up.
• Food Access Request: Access Food details will be added here.
• Food History: Restaurant will show Pending/Accepted/Previous
food history.
• Pending: Todays Access Food list which are yet to accept by NGO
• Accepted: Todays Access Food list which are accepted by NGO
• Previous: Previous History for Access Food & details.
• Notification: They will get the notifications of request and accepted
request.

3
3. NGO
• Login: NGO can login using credentials.
• Profile: They can make their profile providing details of NGO
• Change Password: They can change their password.
• Restaurant Request: List of Access Food initiated by the
Restaurant, See the Restaurant and Food Details, Accept the
Request and Assign an Employee to Pick & Deliver it.
• NGO Request: NGO can view added request and the previous
accepted request, when it facing shortage of food.
• Manage Employee: NGO can add, update and delete the employee
details for NGO food pick and drop.
• History: NGO can see rest of the history of food delivered and
picked details.
• Notifications: NGO will get notify on new restaurant order, or
request accepted for food.

4
Existing System & Proposed System

❖ Problem with current scenario

• NGO are non-profit making agencies that are constituted with a


vision by a group of like-minded people, committed for the uplift
of the poor, marginalized, unprivileged, underprivileged,
impoverished, downtrodden and the needy and they are closer
and accessible to the target groups.
• Food surplus and shortage usually exist within a few miles of each
other.
• Increasing in populations led to food crisis, there are many people
in NGO’s and it become difficult to have food storage for all the
time.

Drawbacks of the existing system

• Maintenance of the system is very difficult.


• There is a possibility for getting inaccurate results.
• User friendliness is very less.
• It consumes more time for processing the task.

5
PROPOSED SYSTEM

• Considering the anomalies in the existing system computerization of the


whole activity is being suggested after initial analysis.
• The android application is developed using Android Studio with JAVA as a
programming language.
• Proposed system is accessed by one entity namely, and User.
• Admin need to login with their valid login credentials first in order to
access the android application.
• After successful login, admin can access all the modules and
perform/manage each task accurately.
• Admin can perform task such as can manage restaurants and NGO’s by
adding them and update the list.
• Restaurant can login and update their profiles. They can also view the
accepted food list which is yet to pick up. Restaurant can add access food
details. They can also accept request from NGO.
• Restaurant can also view the accepted, pending and previous todays
Access Food list which are accepted by NGO.
• They will be getting notifications. NGO can login and update their profile
by providing details.
• They can view and accept the restaurants request and also food details.
They can accept and assign an employee for food pick up.
• In the time of food shortage NGO can also raise request to the
restaurants. And after request been accepted by restaurant, they can
assign an employee for delivery purpose. They will get notifications.

6
Project Lifecycle Details

Waterfall Model

Description
The waterfall Model is a linear sequential flow. In which progress is seen
as flowing steadily downwards (like a waterfall) through the phases of software
implementation. This means that any phase in the development process begins
only if the previous phase is complete. The waterfall approach does not define
the process to go back to the previous phase to handle changes in
requirement. The waterfall approach is the earliest approach that was used for
software development.

7
PROJECT DESIGN
E-R Diagram

Gender Name

Address
Admin_id

Mobile No. Password


Register

Email id

User id Admin
Login
Password
has

User Food Donation


Login access Management

Manage Restaurant

Password
id Manage NGO

Food Access Request

Food History

NGO Request

8
Use Case Diagram

Fig. Use Case Diagram of Admin

9
Fig. Use Case Diagram of Restaurant

10
Fig. Use Case Diagram of NGO

11
Sequence Diagram

Fig. Sequence Diagram of Admin

12
Fig. Sequence Diagram of Restaurant

13
Fig. Sequence Diagram of NGO

14
Activity Diagram

Fig. Activity Diagram of Admin

Fig. Activity Diagram of Restaurant

15
Fig. Activity Diagram of NGO

16
Class Diagram

New Registration
Admin
- Name : String
- User_id : String - DOB : Int
- Password : String - Gender : String
- Address : String
+ Login() - Mobile No. : Int
+ btn_Click () - Email id : String
+ Logout () - User id : String
- Password : String
Restaurant
+ Submit ()
- User_id : String
+ btn_Click ()
- Password : String

+ Login()
+ btn_Click ()
+ Logout ()

NGO
- User_id : String
- Password : String

+ Login()
+ btn_Click ()
+ Logout ()

17
Data Flow Diagram (DFD’s)

A data flow diagram is graphical tool used to describe and analyze


movement of data through a system. These are the central tool and the basis
from which the other components are developed. The transformation of data
from input to output, through processed, may be described logically and
independently of physical components associated with the system. These are
known as the logical data flow diagrams. The physical data flow diagrams show
the actual implements and movement of data between people, departments
and workstations. A full description of a system actually consists of a set of data
flow diagrams. Using two familiar notations Yourdon, Gane and Sarson notation
develops the data flow diagrams. Each component in a DFD is labeled with a
descriptive name. Process is further identified with a number that will be used
for identification purpose. The development of DFD’s is done in several levels.
Each process in lower level diagrams can be broken down into a more detailed
DFD in the next level. The lop-level diagram is often called context diagram. It
consists a single process bit, which plays vital role in studying the current system.
The process in the context level diagram is exploded into other process at the
first level DFD.
The idea behind the explosion of a process into more process is that
understanding at one level of detail is exploded into greater detail at the next
level. This is done until further explosion is necessary and an adequate amount
of detail is described for analyst to understand the process.
Larry Constantine first developed the DFD as a way of expressing system
requirements in a graphical from, this lead to the modular design.

18
A DFD is also known as a “bubble Chart” has the purpose of clarifying
system requirements and identifying major transformations that will become
programs in system design. So it is the starting point of the design to the lowest
level of detail. A DFD consists of a series of bubbles joined by data flows in the
system.

DFD SYMBOLS:
In the DFD, there are four symbols
1. A square defines a source(originator) or destination of system data
2. An arrow identifies data flow. It is the pipeline through which the information
flows
3. A circle or a bubble represents a process that transforms incoming data flow
into outgoing data flows.
4. An open rectangle is a data store, data at rest or a temporary repository of
data

Process that transforms data flow.

Source or Destination of data

Data flow

Data Store

19
CONSTRUCTING A DFD:

Several rules of thumb are used in drawing DFD’s:


1. Process should be named and numbered for an easy reference. Each name
should be representative of the process.
2. The direction of flow is from top to bottom and from left to right. Data
traditionally flow from source to the destination although they may flow back
to the source. One way to indicate this is to draw long flow line back to a
source. An alternative way is to repeat the source symbol as a destination.
Since it is used more than once in the DFD it is marked with a short diagonal.
3. When a process is exploded into lower level details, they are numbered.
4. The names of data stores and destinations are written in capital letters.
Process and dataflow names have the first letter of each work capitalized

A DFD typically shows the minimum contents of data store. Each data
store should contain all the data elements that flow in and out.
Questionnaires should contain all the data elements that flow in and out.
Missing interfaces redundancies and like is then accounted for often through
interviews.

SAILENT FEATURES OF DFD’s

1. The DFD shows flow of data, not of control loops and decision are
controlled considerations do not appear on a DFD.
2. The DFD does not indicate the time factor involved in any process whether
the data flows take place daily, weekly, monthly or yearly.
3. The sequence of events is not brought out on the DFD.

20
TYPES OF DATA FLOW DIAGRAMS
1. Current Physical
2. Current Logical
3. New Logical
4. New Physical

CURRENT PHYSICAL:
In Current Physical DFD process label include the name of people or their
positions or the names of computer systems that might provide some of the
overall system-processing label includes an identification of the technology used
to process the data. Similarly, data flows and data stores are often labels with
the names of the actual physical media on which data are stored such as file
folders, computer files, business forms or computer tapes.

CURRENT LOGICAL:
The physical aspects at the system are removed as much as possible so
that the current system is reduced to its essence to the data and the processors
that transform them regardless of actual physical form.

NEW LOGICAL:
This is exactly like a current logical model if the user were completely
happy with the user were completely happy with the functionality of the current
system but had problems with how it was implemented typically through the
new logical model will differ from current logical model while having additional
functions, absolute function removal and inefficient flows recognized.

21
NEW PHYSICAL:
The new physical represents only the physical implementation of the new
system.

RULES GOVERNING THE DFD’S


PROCESS
1) No process can have only outputs.
2) No process can have only inputs. If an object has only inputs than it
must be a sink.
3) A process has a verb phrase label.

DATA STORE
1) Data cannot move directly from one data store to another data store,
a process must move data.
2) Data cannot move directly from an outside source to a data store, a
process, which receives, must move data from the source and place
the data into data store
3) A data store has a noun phrase label.

SOURCE OR SINK
The origin and /or destination of data.

1) Data cannot move direly from a source to sink it must be moved by a


process
2) A source and /or sink has a noun phrase land

22
DATA FLOW
1) A Data Flow has only one direction of flow between symbols. It may
flow in both directions between a process and a data store to show a
read before an update. The later it usually indicated however by two
separate arrows since these happen at different type.
2) A join in DFD means that exactly the same data comes from any of two
or more different processes data store or sink to a common location.
3) A data flow cannot go directly back to the same process it leads. There
must be at least one other process that handles the data flow produce
some other data flow returns the original data into the beginning
process.
4) A Data flow to a data store means update (delete or change).
5) A data Flow from a data store means retrieve or use.

23
Data Flow Diagrams (DFD’s)

Query 0.0
Food Donation
User Database
Management
DB

DATABASE DETAIL

24
1.0
Query
User Process Check for user
Request Requirement

User need

1.1

Feedback For
Relevant Database
User Data

LEVEL 1 DFD

25
Query 2.0

User Accept
Query

Give info about


2.1
DB
Give Check Availability
request of or for query
to user processing

2.2

Process Via Food Donation


Query Management DB

LEVEL 2 DFD: PREDICTION

26
System Architecture

27
PROJECT IMPLEMENTATION

Project Implementation Technology

The Project application is loaded in Android Studio. We used Android


Studio for Design and coding of project. Created and maintained all databases
into SQL Server, in that we create tables, write query for store data or record
of project.
❖ Hardware Requirement:

1. Laptop or PC

➢ i3 Processor Based Computer or higher


➢ 1GB RAM
➢ 5 GB Hard Disk
2. Android Phone or Tablet
➢ 1.2 Quad core Processor or higher
➢ 1 GB RAM

❖ Software Requirement:

1. Laptop or PC
➢ Windows 7 or higher.
➢ Java
➢ Android Studio
2. Android Phone or Tablet
➢ Android v5.0 or Higher

28
Introduction to Android
Android Studio is the official Integrated Development Environment (IDE) for
Android app development, based on IntelliJ IDEA . On top of IntelliJ's powerful
code editor and developer tools, Android Studio offers even more features
that enhance your productivity when building Android apps, such as:

• A flexible Gradle-based build system

• A fast and feature-rich emulator

• A unified environment where you can develop for all Android devices

• Instant Run to push changes to your running app without building a new
APK

• Code templates and GitHub integration to help you build common app
features and import sample code

• Extensive testing tools and frameworks

• Lint tools to catch performance, usability, version compatibility, and other


problems

• C++ and NDK support

• Built-in support for Google Cloud Platform, making it easy to integrate


Google Cloud Messaging and App Engine.

29
Project Structure

Each project in Android Studio contains one or more modules with source
code files and resource files. Types of modules include:

• Android app modules

• Library modules

• Google App Engine modules

By default, Android Studio displays your


project files in the Android project view, as
shown in figure 1. This view is organized by
modules to provide quick access to your
project's key source files.

All the build files are visible at the top level


under Gradle Scripts and each app module
contains the following folders:

• manifests: Contains
the AndroidManifest.xml file.

• java: Contains the Java source code files,


including JUnit test code.

• res: Contains all non-code resources, such as XML layouts, UI strings, and
bitmap images.

30
The Android project structure on disk differs from this flattened
representation. To see the actual file structure of the project,
select Project from the Project dropdown (in figure 1, it's showing asAndroid).

You can also customize the view of the


project files to focus on specific aspects
of your app development. For example,
selecting the Problems view of your
project displays links to the source files
containing any recognized coding and
syntax errors, such as a missing XML element closing tag in a layout file.

The User Interface


1. The toolbar lets you carry out a wide range of actions, including running
your app and launching Android tools.

2. The navigation bar helps you navigate through your project and open files
for editing. It provides a more compact view of the structure visible in
the Project window.

3. The editor window is where you create and modify code. Depending on
the current file type, the editor can change. For example, when viewing a
layout file, the editor displays the Layout Editor.

4. The tool window bar runs around the outside of the IDE window and
contains the buttons that allow you to expand or collapse individual tool
windows.

31
5. The tool windows give you access to specific tasks like project
management, search, version control, and more. You can expand them and
collapse them.

6. The status bar displays the status of your project and the IDE itself, as well
as any warnings or messages.

You can organize the main window to give yourself more screen space by
hiding or moving toolbars and tool windows. You can also use keyboard
shortcuts to access most IDE features.

At any time, you can search across your source code, databases, actions,
elements of the user interface, and so on, by double-pressing the Shift key, or
clicking the magnifying glass in the upper right-hand corner of the Android
Studio window. This can be very useful if, for example, you are trying to locate
a particular IDE action that you have forgotten how to trigger.

32
Tool Windows
Instead of using preset perspectives, Android Studio follows your
context and automatically brings up relevant tool windows as you work. By
default, the most commonly used tool windows are pinned to the tool window
bar at the edges of the application window.

• To expand or collapse a tool window, click the tool’s name in the tool
window bar. You can also drag, pin, unpin, attach, and detach tool windows.

• To return to the current default tool window layout, click Window > Restore
Default Layout or customize your default layout by clicking Window > Store
Current Layout as Default.

• To show or hide the entire tool window bar, click the window icon in the
bottom left-hand corner of the Android Studio window.

• To locate a specific tool window, hover over the window icon and select the
tool window from the menu.

Navigation
Here are some tips to help you move around Android Studio.

• Switch between your recently accessed files using the Recent Files action.
Press Control+E (Command+E on a Mac) to bring up the Recent Files action.
By default, the last accessed file is selected. You can also access any tool
window through the left column in this action.

• View the structure of the current file using the File Structure action. Bring up
the File Structure action by pressing Control+F12 (Command+F12 on a Mac).
Using this action, you can quickly navigate to any part of your current file.

33
• Search for and navigate to a specific class in your project using the Navigate
to Class action. Bring up the action by pressing Control+N(Command+O on a
Mac). Navigate to Class supports sophisticated expressions, including camel
humps, paths, line navigate to, middle name matching, and many more. If
you call it twice in a row, it shows you the results out of the project classes.

• Navigate to a file or folder using the Navigate to File action. Bring up the
Navigate to File action by pressing Control+Shift+N (Command+Shift+O on a
Mac). To search for folders rather than files, add a / at the end of your
expression.

• Navigate to a method or field by name using the Navigate to Symbol action.


Bring up the Navigate to Symbol action by
pressing Control+Shift+Alt+N(Command+Shift+Alt+O on a Mac).

• Find all the pieces of code referencing the class, method, field, parameter,
or statement at the current cursor position by pressing Alt+F7

Gradle Build System


Android Studio uses Gradle as the foundation of the build system, with
more Android-specific capabilities provided by the Android plugin for Gradle.
This build system runs as an integrated tool from the Android Studio menu,
and independently from the command line. You can use the features of the
build system to do the following:

• Customize, configure, and extend the build process.

• Create multiple APKs for your app, with different features using the same
project and modules.

• Reuse code and resources across sourcesets.

34
By employing the flexibility of Gradle, you can achieve all of this without
modifying your app's core source files. Android Studio build files are
namedbuild.gradle. They are plain text files that use Groovy syntax to
configure the build with elements provided by the Android plugin for Gradle.
Each project has one top-level build file for the entire project and separate
module-level build files for each module. When you import an existing project,
Android Studio automatically generates the necessary build files.

Multiple APK Support

Multiple APK support allows you to efficiently create multiple APKs


based on screen density or ABI. For example, you can create separate APKs of
an app for the hdpi and mdpi screen densities, while still considering them a
single variant and allowing them to share test APK, javac, dx, and ProGuard
settings.
Debug and Profile Tools
Android Studio assists you in debugging and improving the performance of
your code, including inline debugging and performance analysis tools.

Inline debugging
Use inline debugging to enhance your code walk-throughs in the debugger
view with inline verification of references, expressions, and variable values.
Inline debug information includes:

• Inline variable values

• Referring objects that reference a selected object

• Method return values

35
• Lambda and operator expressions

• Tooltip values

Performance monitors

Android Studio provides performance monitors so you can more easily


track your app’s memory and CPU usage, find deallocated objects, locate
memory leaks, optimize graphics performance, and analyze network requests.
With your app running on a device or emulator, open the Android Monitortool
window, and then click the Monitors tab.

Allocation tracker

Android Studio allows you to track memory allocation as it monitors


memory use. Tracking memory allocation allows you to monitor where objects
are being allocated when you perform certain actions. Knowing these
allocations enables you to optimize your app’s performance and memory use
by adjusting the method calls related to those actions.

36
Code inspections

Whenever you compile your program, Android Studio automatically runs


configured Lint and other IDE inspections to help you easily identify and
correct problems with the structural quality of your code.

The Lint tool checks your Android project source files for potential bugs and
optimization improvements for correctness, security, performance, usability,
accessibility, and internationalization.

37
FEASIBILITY REPORT

Feasibility Study is a high level capsule version of the entire process


intended to answer a number of questions like: What is the problem? Is there
any feasible solution to the given problem? Is the problem even worth solving?
Feasibility study is conducted once the problem clearly understood. Feasibility
study is necessary to determine that the proposed system is Feasible by
considering the technical, Operational, and Economical factors. By having a
detailed feasibility study the management will have a clear-cut view of the
proposed system.
The following feasibilities are considered for the project in order to ensure
that the project is variable and it does not have any major obstructions.
Feasibility study encompasses the following things:

➢ Technical Feasibility
➢ Economic Feasibility
➢ Operational Feasibility

In this phase, we study the feasibility of all proposed systems, and pick the
best feasible solution for the problem. The feasibility is studied based on three
main factors as follows.

38
❖ Technical Feasibility

In this step, we verify whether the proposed systems are technically


feasible or not. i.e., all the technologies required to develop the system
are available readily or not.
Technical Feasibility determines whether the organization has the
technology and skills necessary to carry out the project and how this
should be obtained. The system can be feasible because of the following
grounds:

➢ All necessary technology exists to develop the system.


➢ This system is too flexible and it can be expanded further.
➢ This system can give guarantees of accuracy, ease of use, reliability
and the data security.
➢ This system can give instant response to inquire.
Our project is technically feasible because, all the
technology needed for our project is readily available.

Operating System : Android v5.0


or Higher (For Android Devices)

Languages : JAVA

Database System : MS-SQL Server

Documentation Tool : MS - Word

39
❖ Economic Feasibility

Economically, this project is completely feasible because it requires


no extra financial investment and with respect to time, it’s completely
possible to complete this project in 6 months.

In this step, we verify which proposal is more economical. We


compare the financial benefits of the new system with the investment.
The new system is economically feasible only when the financial benefits
are more than the investments and expenditure. Economic Feasibility
determines whether the project goal can be within the resource limits
allocated to it or not. It must determine whether it is worthwhile to
process with the entire project or whether the benefits obtained from
the new system are not worth the costs. Financial benefits must be
equal or exceed the costs. In this issue, we should consider:

➢ The cost to conduct a full system investigation.


➢ The cost of h/w and s/w for the class of application being considered.
➢ The development tool.
➢ The cost of maintenance etc...

Our project is economically feasible because the cost of development is


very minimal when compared to financial benefits of the application.

40
❖ Operational Feasibility

In this step, we verify different operational factors of the proposed


systems like man-power, time etc., whichever solution uses less operational
resources, is the best operationally feasible solution. The solution should also be
operationally possible to implement. Operational Feasibility determines if the
proposed system satisfied user objectives could be fitted into the current system
operation.

➢ The methods of processing and presentation are completely accepted


by the clients since they can meet all user requirements.
➢ The clients have been involved in the planning and development of the
system.
➢ The proposed system will not cause any problem under any
circumstances.

Our project is operationally feasible because the time requirements and


personnel requirements are satisfied. We are a team of four members and we
worked on this project for three working months.

41
CODING

Admin (Login Activity):


package com.demo.fwm_admin;

import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.annotation.TargetApi;
import android.app.Dialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Log;
import android.util.Patterns;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.Toast;

42
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;

import com.demo.fwm_admin.util.LoginSharedPref;
import com.demo.fwm_admin.webservice.JSONParser;
import com.demo.fwm_admin.webservice.RestAPI;
import com.google.android.material.snackbar.Snackbar;

import org.json.JSONArray;
import org.json.JSONObject;

import java.util.ArrayList;
import java.util.Arrays;

public class LoginActivity extends AppCompatActivity {

Dialog cd;
private UserLoginTask mAuthTask = null;
String uid;
// UI references.
private EditText mUserNameView;
private EditText mPasswordView;

@Override
protected void onCreate(Bundle savedInstanceState) {

43
super.onCreate(savedInstanceState);
uid = LoginSharedPref.getUidKey(this);
if (uid.length()>0) {
Intent intentLogin = new Intent(this, MainActivity.class);
startActivity(intentLogin);
finish();
}
else {
setContentView(R.layout.login);
getSupportActionBar().hide();
mUserNameView = findViewById(R.id.user);
mPasswordView = (EditText) findViewById(R.id.pass);
Button mEmailSignInButton = (Button) findViewById(R.id.submit);
mEmailSignInButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
attemptLogin(view);
}
});
}
}

private void attemptLogin(View view) {


if(mUserNameView.getText().toString().length()>0)
{
if(mPasswordView.getText().toString().length()>0)

44
{
mAuthTask=new
UserLoginTask(mUserNameView.getText().toString(),mPasswordView.getText()
.toString());
mAuthTask.execute();
}
else
{
Snackbar.make(view,"Enter
Password",Snackbar.LENGTH_SHORT).show();
mPasswordView.requestFocus();
}
}
else
{
Snackbar.make(view,"Enter Email",Snackbar.LENGTH_SHORT).show();
mUserNameView.requestFocus();
}
}

public class UserLoginTask extends AsyncTask<Void, Void, String> {

private final String mUserName;


private final String mPassword;

UserLoginTask(String usrname, String password) {


mUserName = usrname;

45
mPassword = password;
dailog();
}

@Override
protected String doInBackground(Void... params) {
String result = null;
RestAPI restAPI = new RestAPI();
try {
JSONObject jsonObject = null;
jsonObject = restAPI.ALogin(mUserName, mPassword);
JSONParser jsonParser = new JSONParser();
result = jsonParser.parseJSON(jsonObject);
} catch (Exception e) {
e.printStackTrace();
result = e.getMessage();
}
return result;
}

@Override
protected void onPostExecute(final String result) {
cd.cancel();
Log.d("REPLY login", result);
if (result.contains("Unable to resolve host")) {
AlertDialog.Builder ad = new AlertDialog.Builder(LoginActivity.this);

46
ad.setTitle("Unable to Connect!");
ad.setMessage("Check your Internet Connection,Unable to connect
the Server");
ad.setNeutralButton("OK", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.cancel();
}
});
ad.show();
} else {
try {
JSONObject json = new JSONObject(result);
String ans = json.getString("status");
if (ans.compareTo("false") == 0) {
Snackbar.make(mUserNameView, "Login credentials Incorrect",
Snackbar.LENGTH_SHORT).show();
mPasswordView.requestFocus();
} else if (ans.compareTo("true") == 0) {
LoginSharedPref.setUidKey(LoginActivity.this,"uid");
startActivity(new Intent(LoginActivity.this, MainActivity.class));
finish();
} else if (ans.compareTo("error") == 0) {
String error = json.getString("Data");
Toast.makeText(LoginActivity.this, error,
Toast.LENGTH_SHORT).show();
}

47
} catch (Exception e) {
Toast.makeText(LoginActivity.this, e.getMessage(),
Toast.LENGTH_SHORT).show();
}
}
}
}

public void dailog()


{
cd=new Dialog(LoginActivity.this,R.style.AppTheme);
cd.requestWindowFeature(Window.FEATURE_NO_TITLE);
cd.getWindow().setBackgroundDrawable(new
ColorDrawable(Color.TRANSPARENT));
cd.setContentView(R.layout.loading);
cd.setCancelable(false);
cd.show();
}

}
Restaurant (Login Activity):
package com.demo.fwm_restaurant;

import android.app.Dialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Color;

48
import android.graphics.drawable.ColorDrawable;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import android.util.Patterns;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;

import com.demo.fwm_restaurant.util.LoginSharedPref;
import com.demo.fwm_restaurant.webservice.JSONParser;
import com.demo.fwm_restaurant.webservice.RestAPI;
import com.google.android.material.snackbar.Snackbar;

import org.json.JSONArray;
import org.json.JSONObject;

import java.util.regex.Pattern;

public class LoginActivity extends AppCompatActivity {

49
Dialog cd;
private UserLoginTask mAuthTask = null;
String uid;
// UI references.
private EditText mUserNameView;
private EditText mPasswordView;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
uid = LoginSharedPref.getUidKey(this);
if (uid.length()>0) {
Intent intentLogin = new Intent(this, MainActivity.class);
startActivity(intentLogin);
finish();
}
else {
setContentView(R.layout.login);
getSupportActionBar().hide();
mUserNameView = findViewById(R.id.user);
mPasswordView = (EditText) findViewById(R.id.pass);
Button mEmailSignInButton = (Button) findViewById(R.id.submit);
mEmailSignInButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {

50
attemptLogin(view);
}
});
}
}

private void attemptLogin(View view) {


if(mUserNameView.getText().toString().length()>0)
{

if(Patterns.EMAIL_ADDRESS.matcher(mUserNameView.getText().toString()).m
atches())
{
if(mPasswordView.getText().toString().length()>0)
{
mAuthTask=new
UserLoginTask(mUserNameView.getText().toString(),mPasswordView.getText()
.toString());
mAuthTask.execute();
}
else
{
Snackbar.make(view,"Enter
Password",Snackbar.LENGTH_SHORT).show();
mPasswordView.requestFocus();
}
}
else

51
{
Snackbar.make(view,"Invalid Email
Address",Snackbar.LENGTH_SHORT).show();
mUserNameView.requestFocus();
}
}
else
{
Snackbar.make(view,"Enter Email",Snackbar.LENGTH_SHORT).show();
mUserNameView.requestFocus();
}
}

public class UserLoginTask extends AsyncTask<Void, Void, String> {

private final String mUserName;


private final String mPassword;

UserLoginTask(String usrname, String password) {


mUserName = usrname;
mPassword = password;
dailog();
}

@Override
protected String doInBackground(Void... params) {
String result = null;
52
RestAPI restAPI = new RestAPI();
try {
JSONObject jsonObject = null;
jsonObject = restAPI.Rlogin(mUserName, mPassword);
JSONParser jsonParser = new JSONParser();
result = jsonParser.parseJSON(jsonObject);
} catch (Exception e) {
e.printStackTrace();
result = e.getMessage();
}
return result;
}

@Override
protected void onPostExecute(final String result) {
cd.cancel();
Log.d("REPLY login", result);
if (result.contains("Unable to resolve host")) {
AlertDialog.Builder ad = new AlertDialog.Builder(LoginActivity.this);
ad.setTitle("Unable to Connect!");
ad.setMessage("Check your Internet Connection,Unable to connect
the Server");
ad.setNeutralButton("OK", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.cancel();
}
53
});
ad.show();
} else {
try {
JSONObject json = new JSONObject(result);
String ans = json.getString("status");
if (ans.compareTo("false") == 0) {
Snackbar.make(mUserNameView, "Login credentials Incorrect",
Snackbar.LENGTH_SHORT).show();
mPasswordView.requestFocus();
} else if (ans.compareTo("ok") == 0) {

JSONArray jarr=json.getJSONArray("Data");
JSONObject jobj=jarr.getJSONObject(0);

LoginSharedPref.setUidKey(LoginActivity.this,jobj.getString("data0"));
startActivity(new Intent(LoginActivity.this, MainActivity.class));
finish();
} else if (ans.compareTo("error") == 0) {
String error = json.getString("Data");
Toast.makeText(LoginActivity.this, error,
Toast.LENGTH_SHORT).show();
}
} catch (Exception e) {
Toast.makeText(LoginActivity.this, e.getMessage(),
Toast.LENGTH_SHORT).show();

54
}
}
}
}

public void dailog()


{
cd=new Dialog(LoginActivity.this,R.style.AppTheme);
cd.requestWindowFeature(Window.FEATURE_NO_TITLE);
cd.getWindow().setBackgroundDrawable(new
ColorDrawable(Color.TRANSPARENT));
cd.setContentView(R.layout.loading);
cd.setCancelable(false);
cd.show();
}

}
NGO (Login Activity):
package com.android.foodwastage;

import android.Manifest;
import android.app.Activity;
import android.app.Dialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.graphics.Color;
55
import android.graphics.drawable.ColorDrawable;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.Toast;

import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;

import com.airbnb.lottie.LottieAnimationView;
import com.android.foodwastage.R;
import com.android.foodwastage.utils.EmailValidation;
import com.android.foodwastage.utils.LoginSharedPref;
import com.android.foodwastage.webservices.JSONParser;
import com.android.foodwastage.webservices.RestAPI;
import com.google.android.material.snackbar.Snackbar;
import com.google.android.material.textfield.TextInputEditText;

56
import com.google.android.material.textfield.TextInputLayout;

import org.json.JSONArray;
import org.json.JSONObject;

public class LoginActivity extends AppCompatActivity implements


View.OnClickListener {
private static final int RCODE_PERM = 19;
private TextInputEditText emailIdET, passET;
private FrameLayout frameLayout;
private Button loginBtn;
private String uName;
private Dialog dialogLoader;
private EmailValidation emailValidation;
private LinearLayout llLogin;
private TextInputLayout tilEmail;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//check for logged in or not
if (!LoginSharedPref.getNidKey(LoginActivity.this).isEmpty()) {
//already loggedin
Intent regIntent = new Intent(LoginActivity.this,
NavigationUserActivity.class);
startActivity(regIntent);
finish();

57
}
setContentView(R.layout.activity_login);
initUI();
}

private void initUI() {


emailIdET = findViewById(R.id.et_email_log);
tilEmail = findViewById(R.id.til_email);
passET = findViewById(R.id.et_pass_log);
loginBtn = findViewById(R.id.btn_login);
loginBtn.setOnClickListener(this);
frameLayout = findViewById(R.id.fl_login);
llLogin = findViewById(R.id.ll_login_bg);

emailValidation = new EmailValidation();


}

@Override
public void onClick(View v) {
int id = v.getId();
if (id == R.id.btn_login) {
permissionCheck();
}
hideKeyboard(v);
}

58
private void permissionCheck() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
//dynamic location permission
if (ContextCompat.checkSelfPermission(LoginActivity.this,
Manifest.permission.WRITE_EXTERNAL_STORAGE)
!= PackageManager.PERMISSION_GRANTED) {
//ask for permission since not granted
requestPerm();
Log.d("TAG", "onCreate: shouldShowReq else");
} else {
Log.d("TAG", "onCreate> persmissions granted");
validationAndLogin();
}
}else {
Log.d("TAG", "onCreate> persmissions granted, <M");
validationAndLogin();
}
}

@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[]
permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions,
grantResults);
if (requestCode == RCODE_PERM) {

59
if (grantResults.length == 1 && grantResults[0] ==
PackageManager.PERMISSION_GRANTED) {
//ok
validationAndLogin();
} else {
requestPerm();
}
}
}

private void validationAndLogin() {


EmailValidation validation = new EmailValidation();
if (emailIdET.getText().toString().isEmpty()) {
Snackbar.make(frameLayout, "Email id field cannot be empty",
Snackbar.LENGTH_SHORT).show();
return;
}
if (!validation.validateEmail(emailIdET.getText().toString())) {
Snackbar.make(frameLayout, "Enter a valid Email id",
Snackbar.LENGTH_SHORT).show();
return;
}
if (passET.getText().toString().isEmpty()) {
Snackbar.make(frameLayout, "Password field cannot be empty",
Snackbar.LENGTH_SHORT).show();
return;
}

60
loginSuccess();
}

private void requestPerm() {


ActivityCompat.requestPermissions(LoginActivity.this, new
String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, RCODE_PERM);
}

private void stopAnimation() {


if (dialogLoader.isShowing())
dialogLoader.cancel();
}

private void startAnimation() {


dialogLoader = new Dialog(LoginActivity.this,
R.style.AppTheme_NoActionBar);
dialogLoader.getWindow().setBackgroundDrawable(new
ColorDrawable(Color.parseColor("#8D000000")));
final View view =
LoginActivity.this.getLayoutInflater().inflate(R.layout.custom_dialog_loader,
null);
LottieAnimationView animationView = view.findViewById(R.id.loader);
animationView.playAnimation();
dialogLoader.setContentView(view);
dialogLoader.setCancelable(false);
dialogLoader.show();
}

61
public void hideKeyboard(View view) {
InputMethodManager inputMethodManager = (InputMethodManager)
getSystemService(Activity.INPUT_METHOD_SERVICE);

inputMethodManager.hideSoftInputFromWindow(view.getWindowToken(),
0);
}

private void loginSuccess() {


//LoginAPi succes->then
LoginTask task = new LoginTask();
Log.i("TAG", "loginSuccess: " + emailIdET.getText().toString() +
passET.getText().toString()
+ "type selected ");
task.execute(emailIdET.getText().toString(), passET.getText().toString());
}

private class LoginTask extends AsyncTask<String, Void, String> {

@Override
protected void onPreExecute() {
super.onPreExecute();
startAnimation();
}

@Override
protected String doInBackground(String... strings) {

62
String result;
RestAPI restAPI = new RestAPI();
try {
JSONObject jsonObject;
jsonObject = restAPI.Nlogin(strings[0], strings[1]);

JSONParser jsonParser = new JSONParser();


result = jsonParser.parseJSON(jsonObject);
} catch (Exception e) {
result = e.getMessage();
}
return result;
}

@Override
protected void onPostExecute(String s) {
super.onPostExecute(s);
Log.d("reply", s);
if (s.contains("Unable to resolve host")) {
AlertDialog.Builder ad = new AlertDialog.Builder(LoginActivity.this);
ad.setTitle("Unable to Connect!");
ad.setMessage("Check your Internet Connection,Unable to connect
the Server");
ad.setNeutralButton("OK", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.cancel();
63
}
});
ad.show();
} else {
try {
JSONObject json = new JSONObject(s);
String ans = json.getString("status");
Log.d("reply::", ans);
if (ans.compareTo("false") == 0) {
Snackbar.make(frameLayout, "Login credentials do not match",
Snackbar.LENGTH_SHORT).show();
} else if (ans.compareTo("ok") == 0) {
JSONArray array = json.getJSONArray("Data");
JSONObject jsonObject = array.getJSONObject(0);
LoginSharedPref.setNidKey(LoginActivity.this,
jsonObject.getString("data0"));
LoginSharedPref.setNameKey(LoginActivity.this,
jsonObject.getString("data1"));
Intent intentLogin = new Intent(LoginActivity.this,
NavigationUserActivity.class);
startActivity(intentLogin);
finish();
}
Log.i("TAG", "onPostExecute: " +
LoginSharedPref.getNameKey(LoginActivity.this) +
LoginSharedPref.getNidKey(LoginActivity.this));
if (ans.compareTo("error") == 0) {

64
String error = json.getString("Data");
Toast.makeText(LoginActivity.this, error,
Toast.LENGTH_SHORT).show();
}
} catch (Exception e) {
Toast.makeText(LoginActivity.this, "Error : " + e.getMessage(),
Toast.LENGTH_SHORT).show();
}
stopAnimation();
}
}
}
}
Snapshots

Admin Page

65
Resturant Page

NGO Page

66
TESTING

As the project is on bit large scale, we always need testing to make it


successful. If each components work properly in all respect and gives desired
output for all kind of inputs then project is said to be successful. So the
conclusion is-to make the project successful, it needs to be tested.

The testing done here was System Testing checking whether the user
requirements were satisfied. The code for the new system has been written
completely using JAVA as the coding language and Android Studio as the
interface for front-end designing. The new system has been tested well with the
help of the users and all the applications have been verified from every nook
and corner of the user.

Although some applications were found to be erroneous these


applications have been corrected before being implemented. The flow of the
forms has been found to be very much in accordance with the actual flow of
data.

67
Levels of Testing

In order to uncover the errors present in different phases we have the


concept of levels of testing. The basic levels of testing are:

Client Needs Acceptance Testing

Requirements System Testing

Design Integration Testing

Code Unit Testing

A series of testing is done for the proposed system before the system
is ready for the user acceptance testing.

The steps involved in Testing are:

✓ Unit Testing
Unit testing focuses verification efforts on the smallest unit of the
software design, the module. This is also known as “Module Testing”. The
modules are tested separately. This testing carried out during programming
stage itself. In this testing each module is found to be working satisfactorily as
regards to the expected output from the module.

68
✓ Integration Testing
Data can be grossed across an interface; one module can have adverse
efforts on another. Integration testing is systematic testing for construction the
program structure while at the same time conducting tests to uncover errors
associated with in the interface. The objective is to take unit tested modules and
build a program structure. All the modules are combined and tested as a whole.
Here correction is difficult because the isolation of cause is complicate by the
vast expense of the entire program. Thus in the integration testing stop, all the
errors uncovered are corrected for the text testing steps.

✓ System testing
System testing is the stage of implementation that is aimed at ensuring
that the system works accurately and efficiently for live operation commences.
Testing is vital to the success of the system. System testing makes a logical
assumption that if all the parts of the system are correct, then goal will be
successfully achieved.

✓ Validation Testing
At the conclusion of integration testing software is completely
assembled as a package, interfacing errors have been uncovered and corrected
and a final series of software tests begins, validation test begins. Validation test
can be defined in many ways. But the simple definition is that validation
succeeds when the software function in a manner that can reasonably expected
by the customer. After validation test has been conducted one of two possible
conditions exists.

69
One is the function or performance characteristics confirm to
specifications and are accepted and the other is deviation from specification is
uncovered and a deficiency list is created. Proposed system under consideration
has been tested by using validation testing and found to be working
satisfactorily.

✓ Output Testing
After performing validation testing, the next step is output testing of
the proposed system since no system could be useful if it does not produce the
required output in the specified format. Asking the users about the format
required by them tests the outputs generated by the system under
consideration. Here the output format is considered in two ways, one is on the
screen and other is the printed format. The output format on the screen is found
to be correct as the format was designed in the system designed phase
according to the user needs.
For the hard copy also the output comes as the specified requirements
by the users. Hence output testing does not result any corrections in the system.

✓ User Acceptance Testing


User acceptance of a system is the key factor of the success of any
system. The system under study is tested for the user acceptance by constantly
keeping in touch with the prospective system users at the time of developing
and making changes wherever required.

70
Test Cases

Registration: To begin with login, user need to register by filling up basic


registration details. There are multiple fields in registration page and every
field has to fill by user. User cannot use character in the login id field.

Login: - Login id and password are kept compulsory fields, and if the id or
password doesn’t match then it will show an error message.

VALIDATION CRITERIA

1. In each form, no field which is not null able should be left blank.
2. All numeric fields should be checked for non-numeric values. Similarly,
text fields like names should not contain any numeric characters.
3. All primary keys should be automatically generated to prevent the user
from entering any existing key.
4. Use of error handling for each Save, Edit, delete and other important
operations.
5. Whenever the user Tabs out or Enter from a text box, the data should be
validated and if it is invalid, focus should again be sent to the text box with
proper message.

71
ADVANTAGES OF PROJECT

Advantage:
• Needy people will get food to eat.
• Food will not get wasted.
• NGO’s will not be facing food shortage.

Limitations
• This application requires active internet connection.
• User need to put correct data or else it behaves abnormally.

72
Features

1) Load Balancing:
Since the system will be available only the admin logs in the
amount of load on server will be limited to time period of admin access.

2) Easy Accessibility:
Records can be easily accessed and store and other information
respectively.

3) User Friendly:
The application will be giving a very user-friendly approach for all
user.

4) Efficient and reliable:


Maintaining the all secured and database on the server which will be
accessible according the user requirement without any maintenance
cost will be a very efficient as compared to storing all the customer data
on the spreadsheet or in physically in the record books.

5) Easy maintenance:
Food Donation App is design as easy way. So maintenance is also
easy.

73
CONCLUSION

This was our project of System Design about “Food Donation App”
developed in Android based on Java language. The Development of this system
takes a lot of efforts from us. We think this system gave a lot of satisfaction to
all of us. Though every task is never said to be perfect in this development field
even more improvement may be possible in this application. We learned so
many things and gained a lot of knowledge about development field. We hope
this will prove fruitful to us.

74
BIBLIOGRAPHY

► Websites

✓ en.wikipedia.org

75

You might also like