Final Thesis Smart Home Food Delivery App
Final Thesis Smart Home Food Delivery App
Final Thesis Smart Home Food Delivery App
GUIDED BY: -
Prof. H.P.Gathode
(Lecturer in Computer Engineering)
SUBMITTED BY:-
We take this opportunity to express our profound gratitude and the whole
hearted thanks to our project guide, Prof H.P.Gathode, LECTURER,
DEPARTMENT OF COMPUTER ENGINEERING, for her valuable guidance,
kind suggestions and constant encouragement and providing us the opportunity
to work in an exciting and challenging field of Android Application. Our in
interaction with him has been of immense help in defining our project goal and
in identifying ways to achieve the goal.
We are also very much indebted to, head Prof V.D.KALE HEAD OF
DEPARTMENT OF COMPUTER ENGINEERING for motivation and effective
support. We also thank all Non- Teaching Staff of the Department for their
comment and opinions and above all valuable guidance and timely
suggestion to accomplish the project dissertation .
Last but not the least, we would like to thank all our friend who helped us
directly or indirectly for the success of our project and the team spirit shown by
all has made a project report work successful.
1.1. Preface
1.2. Motivation
1.3. Problem Statement
1 Chapter 1: 1.4. Objectives of project
INTRODUCTION 1.5. Scope and
Limitations of project
1.6. Organization of
Report
3.1Software Requirements
3.2 Functional
Requirement
Chapter 3:
3.3 Non-Functional
3 REQUIREMENTS Requirements
3.4 Hardware
Requirements
3.5Database
3.6 Programming
Language
4 Chapter 4: 4.1. Methodology
METHODOLOGY
5.1. 5.1 Working Module
5.2. 5.2 Working Of Drone
Base
5.3. 5.3 User System
Interaction
5.4. 5.4 Location Tracking
5.5. 5.5 Route
5.6. 5.6 Advantages Of
Proposed System
5 Chapter 5 :
5.7. 5.7 Software Platform
RELATED WORK Used
5.8. 5.7.1 Smart Food
Shopping App Android
Application
5.9. 5.7.2 Admin/Restaurant
Android Application.
5.7.3 Code: XML Code
Chapter 1
INTRODUCTION
This chapter deals with the problem statement that we are intending to solve, the
objectives of our project, the future work that can be done and the limitations of our
project.
1.1 Preface
Most cities in India, suffers from the day-to-day nightmare of traffic congestion.
Currently, the ongoing construction in various parts of the city is makingit difficult for
delivery executives to reach their destination on time, and this isespecially turning out
to be the proverbial Achilles’ heel for many of food-related startups in the city
.However, a company has decided to tackle this problem by flying right over it [1]
They have decided to implement drones to make sure that the food you have
ordered, reaches you hot and fresh! The company has divided Lucknow into 4 zones,
and each zone has its own hub. The food reaches the hub from the restaurant via road,
and the drone then takes the package from one hub to the destination hub, from where
another delivery executive takes the food to the Smart Food Shopping App’s house. But
in theseprocess authentication is not provided.[1]
The proposed method as we call it the “Smart Food Shopping App” uses IOT
and android application and overcomes almost all the limitations of the existing
methods.
Provide authentication
In the first module, by using GPS system, admin will track the location of Smart Food
Shopping App.
In the second module, to reach the parcel of food to the right Smart Food
Shopping App we have provided an authentication by using Location verification.
In the final module, after releasing the parcel of food to the authenticated Smart
Food Shopping App, the driver will return to its original position.
1.2 Motivation
Polytechnic and Engineering as we all know is the application of science to the
optimum conversion of the resources of nature to the uses of human kind. Engineering
has evolved a lot since its inception and lots of problems has been solved by creating its
applications. But there are still many problems unsolved and so we started our research
to find that one problem which really needed development. During this investigation,
we came across the problem of “authentication” and how it is still an unresolved issue.
Therefore, we started to explore more about it and got to know that the existing solution
is quite ineffective and costly too. This made us think that how can we propose a
system that will be both efficient and cost effective?
Finally, we came up with the idea that we call the “SMART FOOD SHOPPING
APP” which works on Android App. Though there’s much work needed to make the
proposed system more efficient, however it will surely be an immense improvement
in the existing solutions.
Drones have recently become a promising solution for rapid parcel delivery due
to advances in battery technology and navigation systems. Drones have inherited
limitations in battery capacity and payload, which make their efficient operation and
management a critical problem for a successful delivery system. Adopting modularity
in the drone design can provide operational benefits to increase overall fleet readiness
Government Polytechnic, Murtizapur Page | 2
Smart Home Food Delivery App
and reduce overall fleet size. We propose an optimization method for security purpose.
Drones can save delivery time and energy consumption during a delivery operation over
manual delivery system.
Smart Food Shopping App’s current location is important for sending the parcel
by drone using navigation System. In this project our main objectives is based on
security. Aim of the project is to deliver the parcel to authenticate Smart Food
Shopping App. Authentication will be done by security parameters. By taking feedback
of authenticate user the drone will return back to its location.
B] Limitations
i. Non-modular drone is unavailable for delivery for more than one hour
whenrecharging the battery.
ii. Drones can carry products up to 2 kg.
iii. If the drone strike is happened then it will affect public health due to
theirchemical contents.
iv. Heavy rain resilient and withstand damage from bad weather and animals.
Chapter 2
A Hardware/
Software Pablo royo IEEE This paper presents an
Architecture for Enrich pastor embedded
2 Conference
UAV Payload and hardware/software
paper
Mission Control architecture specially
designed to be applied on
mini/micro unmanned
aerial vehicles
3
Delivery Services Tan, P.-S., & on Intelligent delivery service
Wang, P. Transportatio optimization and
(2018). n Systems planning (GADOP)
framework.
Vishal
Raithatha
George Runcie
Andrew Yu
Analysis of Faculty of This study proposes an
environmental Engineering, alternative
impacts of drone King implementation of online
delivery on an Jarotwan Mongkut's Shopping delivery
5 online shopping Koiwanit Institute of systems in which
System Technology Smart Food Shopping
Apps can get their
Ladkrabang, groceries at their
Bangkok doorstep within a short
10520, period of time.
Thailand
Chapter 3
REQUIREMENTS
3.1. Software Requirements:
Window 8.1 or above
RAM 4 GM Minimum
HDD 500
SDD 256
XAMPP
POSTMAN
Android Studio
NotePad++
3.5 Database
1. My SQL
2. PHP Web Service
1. Java
2. XML
3. CPP
4. C
5. PHP
6. MYSQL
Chapter 4
4.1 METHODOLOGY
The process used to collect data and information for the purpose of making decision.
Methodology includes research, questionnaire, interviews, observation, survey, case studies and
etc. suitable methodology should be identify for the successful implementation of system since
involves development process and phases. The aim of the research is to collect data and
information from the user (Customer) by direct interview session and distribute the questionnaire
about proposed system which is Child Tracking System. By conducting this method some
problem could be clarified. This research will be focus on analyses user.
Information gather can come from a range of sources. There are variety of techniques to use
when gathering primary data and information. The method used to propose systems are interview
and questionnaire. The questionnaire is distributed to several parents through by hand since this
system proposed for parents themselves. The result from the questionnaires collect generates it
into graph. Interview is involves direct questioning to certain parents.
In this project, all the data were collected from user (Customer) will be analyze to get the
solution for the problem and design the solution they need as the information gather from
interview and questionnaire. The method for analyses data is by using Google Docs. Google
Docs can import, create, edit and update documents in various fonts and file formats, combining
text with formulas, lists, tables and images. By using Google Docs, the questionnaire has been
done smoothly. Using Google Docs can analyze the result by statistics, pie chart, graph and
comment.
Chapter 5
RELATED WORK
The user system interaction Long distance vehicles carrying more payloads require
more energy and batteries for each unit of travel. Larger multi-stop vehicles carry more
battery and payload and pay for it in drag. Vehicles are conservatively sized to be able
to traverse the entire delivery route and return to the fulfillment centerwith all packages.
The burden of irreversible packages increases with each additional package and with
compounds. On the delivery date the information is sent to the Smart Food Shopping
App’s phone and he updates the system with either his live location. If the payment is
received on delivery the drone collects the payment in a safe-box installedin the central
controlling head. The drone reached the users location but before lowering itself, the
OTP is confirmed. The drone has to be provided with a unique feature so that there is
no interchange with some other Smart Food Shopping App's packages to ensure that the
Smart Food Shopping App will be provided with a code during the creation of the
package on its designated route. As soon as the package reaches the Smart Food
Shopping App, the code will be asked and matched to the number given in the drone. In
this way delivery of the correct package will be assured.[1]
5.5 Route
In Food delivery system, the drones will not be travelling on the present features of the
map because they only provide navigation through the road but drones requires a
different route that is it have to fly over buildings and reach location as fastas they can.
The drones will be provided with different route just like flights. Flights have their own
route to travel from one city to another. The drones will be provided with same route as
flight but on small scale that is within the city. They will fly over buildings and cover
the shortest distance to reach their Smart Food Shopping App.[4]
It will avoid thefts and hassle faced by Smart Food Shopping App
Smart Food Shopping App will not have to wait in a fixed location to collect the parcel
Process to Order:
5.7.1.1 Create account
activity_splash.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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"
tools:context=".SplashScreen"
android:background="@drawable/backgroundsplash"
>
<ImageView
android:layout_width="150dp"
android:layout_height="150dp"
android:id="@+id/circle1"
android:src="@drawable/circle"
android:layout_marginLeft="-50dp"
android:layout_marginTop="-20dp"/>
<ImageView
android:layout_width="120dp"
android:layout_height="120dp"
android:id="@+id/circle2"
android:src="@drawable/circletransparant"
android:layout_toRightOf="@+id/circle1"
android:layout_marginTop="-20dp"
android:layout_marginLeft="-50dp"
android:background="@drawable/circletransparant"/>
<ImageView
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_centerInParent="true"
android:id="@+id/img_logo"
android:src="@drawable/logo"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/txt_title"
android:layout_below="@+id/img_logo"
android:gravity="center"
android:text="Smart Home Delivery"
android:textSize="24dp"
android:textColor="@color/mehdi_color"
android:textStyle="bold"
android:fontFamily="sans-serif-condensed-medium"/>
<ImageView
android:layout_width="150dp"
android:layout_height="150dp"
android:id="@+id/circle3"
android:src="@drawable/circle"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_marginRight="-50dp"
android:layout_marginBottom="-20dp"/>
<ImageView
android:layout_width="120dp"
android:layout_height="120dp"
android:id="@+id/circle4"
android:src="@drawable/circletransparant"
android:layout_alignParentBottom="true"
android:layout_toLeftOf="@+id/circle3"
android:layout_marginBottom="-20dp"
android:layout_marginRight="-50dp"/>
</RelativeLayout>
activity_login.xml
<androidx.appcompat.widget.Toolbar
android:id="@+id/bgHeader"
android:layout_width="match_parent"
android:layout_height="220dp"
android:background="@drawable/header_login"
android:elevation="5dp" />
<TextView
android:id="@+id/tvDesc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="30dp"
android:layout_marginTop="40dp"
android:elevation="5dp"
android:text="Welcome"
android:textColor="@color/colorWhite"
android:textSize="17sp" />
<TextView
android:id="@+id/tvLogin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/tvDesc"
android:transitionName="tvLogin"
android:layout_alignLeft="@+id/tvDesc"
android:elevation="5dp"
android:text="Login to unloack awesome food"
android:textColor="@color/colorWhite"
android:textSize="16sp"
android:textStyle="bold" />
<ImageView
android:layout_width="16dp"
android:layout_height="16dp"
android:src="@drawable/logo_16"
android:layout_below="@+id/bgHeader"
android:layout_marginTop="-70dp"
android:layout_marginLeft="100dp"/>
<TextView
android:layout_width="match_parent"
android:layout_height="30dp"
android:text="Smart Home Delivery"
android:textColor="@color/mehdi_color"
android:textStyle="bold"
android:textSize="18dp"
android:layout_below="@+id/bgHeader"
android:layout_marginTop="-70dp"
android:layout_marginLeft="125dp"/>
<ImageView
android:layout_width="32dp"
android:layout_height="32dp"
android:src="@drawable/foodicon"
android:layout_below="@+id/bgHeader"
android:layout_marginTop="-30dp"
android:layout_marginLeft="70dp"/>
<TextView
android:layout_width="match_parent"
android:layout_height="30dp"
android:text="Great \nFood"
android:textColor="@color/black"
android:textStyle="bold"
android:textSize="12dp"
android:layout_below="@+id/bgHeader"
android:layout_marginTop="-30dp"
android:layout_marginLeft="110dp"/>
<ImageView
android:layout_width="32dp"
android:layout_height="32dp"
android:src="@drawable/droneicon"
android:layout_below="@+id/bgHeader"
android:layout_marginTop="-30dp"
android:layout_marginLeft="180dp"/>
<TextView
android:layout_width="match_parent"
android:layout_height="30dp"
android:text="Drone \nDelivery"
android:textColor="@color/black"
android:textStyle="bold"
android:textSize="12dp"
android:layout_below="@+id/bgHeader"
android:layout_marginTop="-30dp"
android:layout_marginLeft="220dp"/>
<ImageView
android:id="@+id/circle1"
android:layout_width="134dp"
android:layout_height="134dp"
android:layout_below="@+id/bgHeader"
android:layout_alignParentRight="true"
android:layout_marginTop="-80dp"
android:layout_marginRight="-100dp"
android:src="@drawable/circletransparant1" />
<ImageView
android:id="@+id/circle2"
android:layout_width="134dp"
android:layout_height="134dp"
android:layout_alignParentBottom="true"
android:layout_marginLeft="-100dp"
android:layout_marginBottom="50dp"
android:src="@drawable/circletransparant1" />
<ImageView
android:id="@+id/circle3"
android:layout_width="182dp"
android:layout_height="182dp"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:layout_marginRight="-80dp"
android:layout_marginBottom="-30dp"
android:src="@drawable/circle1" />
<ImageView
android:id="@+id/circle4"
android:layout_width="134dp"
android:layout_height="134dp"
android:layout_alignParentBottom="true"
android:layout_marginRight="-50dp"
android:layout_marginBottom="-50dp"
android:layout_toLeftOf="@+id/circle3"
android:src="@drawable/circletransparant1" />
<ScrollView
android:id="@+id/sv"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/bgHeader">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.cardview.widget.CardView
android:id="@+id/cv"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="20dp"
app:cardCornerRadius="10dp"
app:cardElevation="4dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingBottom="50dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:text="Username"
android:textColor="@color/mehdi_color"
android:textSize="14sp"
android:textStyle="bold" />
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/edt_username"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:drawableLeft="@drawable/usernameicon"
android:inputType="text" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:text="Password"
android:textColor="@color/mehdi_color"
android:textSize="14sp"
android:textStyle="bold" />
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/til_password"
app:passwordToggleEnabled="true"
app:passwordToggleDrawable="@drawable/icon_selector"
app:passwordToggleTint="@color/colorPurple"
>
<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/edt_password"
android:layout_below="@+id/txt_password"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:inputType="textPassword"
android:drawableLeft="@drawable/passwordicon"
android:paddingRight="10dp"/>
</com.google.android.material.textfield.TextInputLayout>
</LinearLayout>
</androidx.cardview.widget.CardView>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/cv"
android:layout_alignLeft="@+id/cv"
android:layout_alignRight="@+id/cv"
android:layout_marginTop="-50dp"
android:layout_marginLeft="35dp"
android:layout_marginRight="35dp"
android:elevation="10dp">
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/btn_login"
android:background="@drawable/btn_fb_bg"
android:text="Login"
android:textAllCaps="false"
android:textColor="@color/colorWhite" />
</RelativeLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@+id/cv"
android:layout_alignRight="@+id/cv"
android:layout_marginTop="-20dp"
android:layout_marginRight="-20dp"
android:elevation="10dp">
<ImageButton
android:id="@+id/img_btn_register"
android:layout_width="50dp"
android:layout_height="50dp"
android:background="@drawable/bg_ui"
android:src="@drawable/ic_add" />
</RelativeLayout>
<TextView
android:id="@+id/txt_forgot_password"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/cv"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp"
android:elevation="5dp"
android:text="Forgot your password?"
android:textSize="14sp" />
</RelativeLayout>
</ScrollView>
<ProgressBar
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/progress"
android:layout_centerInParent="true"
android:visibility="gone"/>
</RelativeLayout>
activity_registration.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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"
tools:context=".LoginScreen"
tools:ignore="VectorDrawableCompat">
<androidx.appcompat.widget.Toolbar
android:id="@+id/bgHeader"
android:layout_width="match_parent"
android:layout_height="220dp"
android:background="@drawable/header_login"
android:elevation="5dp" />
<TextView
android:id="@+id/tvDesc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="30dp"
android:layout_marginTop="40dp"
android:elevation="5dp"
android:text="Welcome"
android:textColor="@color/colorWhite"
android:textSize="17sp" />
<TextView
android:id="@+id/tvLogin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/tvDesc"
android:transitionName="tvLogin"
android:layout_alignLeft="@+id/tvDesc"
android:elevation="5dp"
android:text="Login to unloack awesome food"
android:textColor="@color/colorWhite"
android:textSize="16sp"
android:textStyle="bold" />
<ImageView
android:layout_width="16dp"
android:layout_height="16dp"
android:src="@drawable/logo_16"
android:layout_below="@+id/bgHeader"
android:layout_marginTop="-70dp"
android:layout_marginLeft="100dp"/>
<TextView
android:layout_width="match_parent"
android:layout_height="30dp"
android:text="Smart Home Delivery"
android:textColor="@color/mehdi_color"
android:textStyle="bold"
android:textSize="18dp"
android:layout_below="@+id/bgHeader"
android:layout_marginTop="-70dp"
android:layout_marginLeft="125dp"/>
<ImageView
android:layout_width="32dp"
android:layout_height="32dp"
android:src="@drawable/foodicon"
android:layout_below="@+id/bgHeader"
android:layout_marginTop="-30dp"
android:layout_marginLeft="70dp"/>
<TextView
android:layout_width="match_parent"
android:layout_height="30dp"
android:text="Great \nFood"
android:textColor="@color/black"
android:textStyle="bold"
android:textSize="12dp"
android:layout_below="@+id/bgHeader"
android:layout_marginTop="-30dp"
android:layout_marginLeft="110dp"/>
<ImageView
android:layout_width="32dp"
android:layout_height="32dp"
android:src="@drawable/droneicon"
android:layout_below="@+id/bgHeader"
android:layout_marginTop="-30dp"
android:layout_marginLeft="180dp"/>
<TextView
android:layout_width="match_parent"
android:layout_height="30dp"
android:text="Drone \nDelivery"
android:textColor="@color/black"
android:textStyle="bold"
android:textSize="12dp"
android:layout_below="@+id/bgHeader"
android:layout_marginTop="-30dp"
android:layout_marginLeft="220dp"/>
<ImageView
android:id="@+id/circle1"
android:layout_width="134dp"
android:layout_height="134dp"
android:layout_below="@+id/bgHeader"
android:layout_alignParentRight="true"
android:layout_marginTop="-80dp"
android:layout_marginRight="-100dp"
android:src="@drawable/circletransparant1" />
<ImageView
android:id="@+id/circle2"
android:layout_width="134dp"
android:layout_height="134dp"
android:layout_alignParentBottom="true"
android:layout_marginLeft="-100dp"
android:layout_marginBottom="50dp"
android:src="@drawable/circletransparant1" />
<ImageView
android:id="@+id/circle3"
android:layout_width="182dp"
android:layout_height="182dp"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:layout_marginRight="-80dp"
android:layout_marginBottom="-30dp"
android:src="@drawable/circle1" />
<ImageView
android:id="@+id/circle4"
android:layout_width="134dp"
android:layout_height="134dp"
android:layout_alignParentBottom="true"
android:layout_marginRight="-50dp"
android:layout_marginBottom="-50dp"
android:layout_toLeftOf="@+id/circle3"
android:src="@drawable/circletransparant1" />
<ScrollView
android:id="@+id/sv"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/bgHeader">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.cardview.widget.CardView
android:id="@+id/cv"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="20dp"
app:cardCornerRadius="10dp"
app:cardElevation="4dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingBottom="50dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:text="Username"
android:textColor="@color/mehdi_color"
android:textSize="14sp"
android:textStyle="bold" />
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/edt_username"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:drawableLeft="@drawable/usernameicon"
android:inputType="text" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:text="Password"
android:textColor="@color/mehdi_color"
android:textSize="14sp"
android:textStyle="bold" />
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/til_password"
app:passwordToggleEnabled="true"
app:passwordToggleDrawable="@drawable/icon_selector"
app:passwordToggleTint="@color/colorPurple"
>
<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/edt_password"
android:layout_below="@+id/txt_password"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:inputType="textPassword"
android:drawableLeft="@drawable/passwordicon"
android:paddingRight="10dp"/>
</com.google.android.material.textfield.TextInputLayout>
</LinearLayout>
</androidx.cardview.widget.CardView>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/cv"
android:layout_alignLeft="@+id/cv"
android:layout_alignRight="@+id/cv"
android:layout_marginTop="-50dp"
android:layout_marginLeft="35dp"
android:layout_marginRight="35dp"
android:elevation="10dp">
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/btn_login"
android:background="@drawable/btn_fb_bg"
android:text="Login"
android:textAllCaps="false"
android:textColor="@color/colorWhite" />
</RelativeLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@+id/cv"
android:layout_alignRight="@+id/cv"
android:layout_marginTop="-20dp"
android:layout_marginRight="-20dp"
android:elevation="10dp">
<ImageButton
android:id="@+id/img_btn_register"
android:layout_width="50dp"
android:layout_height="50dp"
android:background="@drawable/bg_ui"
android:src="@drawable/ic_add" />
</RelativeLayout>
<TextView
android:id="@+id/txt_forgot_password"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/cv"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp"
android:elevation="5dp"
android:text="Forgot your password?"
android:textSize="14sp" />
</RelativeLayout>
</ScrollView>
<ProgressBar
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/progress"
android:layout_centerInParent="true"
android:visibility="gone"/>
</RelativeLayout>
activity_home.xml
<?xml version="1.0" encoding="utf-8"?>
<androidx.drawerlayout.widget.DrawerLayout
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:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:openDrawer="start">
<include
layout="@layout/app_bar_home_page"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<com.google.android.material.navigation.NavigationView
android:id="@+id/nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:fitsSystemWindows="true"
app:headerLayout="@layout/nav_header_home_page"
app:menu="@menu/activity_home_page_drawer" />
</androidx.drawerlayout.widget.DrawerLayout>
content_home_page.xml
<?xml version="1.0" encoding="utf-8"?>
<ScrollView 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"
tools:context=".Activity.HomePage"
android:orientation="vertical"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:id="@+id/l1">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="139dp"
>
<ImageView
android:id="@+id/image_view_flip1"
android:layout_width="match_parent"
android:layout_height="139dp"
android:contentDescription=""
android:src="@drawable/pic1" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="200dp"
android:orientation="vertical">
<ImageView
android:id="@+id/image_view_flip2"
android:layout_width="match_parent"
android:layout_height="139dp"
android:layout_gravity="center_vertical"
android:contentDescription=""
android:src="@drawable/pic1" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="139dp" >
<ImageView
android:id="@+id/image_view_flip3"
android:layout_width="match_parent"
android:layout_height="139dp"
android:layout_gravity="center_vertical"
android:contentDescription=""
android:src="@drawable/pic1" />
</LinearLayout>
</ViewFlipper>
<!-- rest of your layout -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:background="@color/light_grey"
android:layout_marginTop="4dp"
android:scrollbars="horizontal"
>
<androidx.cardview.widget.CardView
android:layout_width="100dp"
android:layout_height="120dp"
android:id="@+id/hori_cardview1"
android:elevation="10dp"
app:cardCornerRadius="10dp"
app:cardBackgroundColor="@color/white"
android:layout_marginLeft="5dp"
android:layout_marginBottom="5dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="10dp"
android:layout_margin="10dp"
android:gravity="center"
android:layout_gravity="center">
<ImageView
android:layout_width="50dp"
android:layout_height="50dp"
android:id="@+id/img_vegeterian"
android:src="@drawable/veg"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/txt_vegeterian"
android:text="Pure Veg Place"
android:textSize="10dp"
android:textAlignment="center"
android:layout_marginTop="5dp"
android:fontFamily="sans-serif-condensed-medium"/>
</LinearLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:layout_width="100dp"
android:layout_height="120dp"
android:id="@+id/hori_cardview2"
android:elevation="10dp"
app:cardCornerRadius="10dp"
app:cardBackgroundColor="@color/light_grey"
android:layout_marginLeft="5dp"
android:layout_marginBottom="5dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="10dp"
android:layout_margin="10dp"
android:gravity="center"
android:layout_gravity="center">
<ImageView
android:layout_width="50dp"
android:layout_height="50dp"
android:id="@+id/img_non_veg"
android:src="@drawable/non_veg"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/txt_non_veg"
android:text="Non Veg Place"
android:textSize="10dp"
android:textAlignment="center"
android:layout_marginTop="5dp"
android:fontFamily="sans-serif-condensed-medium"/>
</LinearLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:layout_width="100dp"
android:layout_height="120dp"
android:id="@+id/hori_cardview3"
android:elevation="10dp"
app:cardCornerRadius="10dp"
app:cardBackgroundColor="@color/white"
android:layout_marginLeft="5dp"
android:layout_marginBottom="5dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="10dp"
android:layout_margin="10dp"
android:gravity="center"
android:layout_gravity="center">
<ImageView
android:layout_width="50dp"
android:layout_height="50dp"
android:id="@+id/img_south_indian"
android:src="@drawable/south_indian"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/txt_south_indian"
android:text="South Indian"
android:textSize="10dp"
android:textAlignment="center"
android:layout_marginTop="5dp"
android:fontFamily="sans-serif-condensed-medium"
/>
</LinearLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:layout_width="100dp"
android:layout_height="120dp"
android:id="@+id/hori_cardview4"
android:elevation="10dp"
app:cardCornerRadius="10dp"
app:cardBackgroundColor="@color/light_grey"
android:layout_marginLeft="5dp"
android:layout_marginBottom="5dp"
android:layout_marginRight="5dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="10dp"
android:layout_margin="10dp"
android:gravity="center"
android:layout_gravity="center">
<ImageView
android:layout_width="50dp"
android:layout_height="50dp"
android:id="@+id/img_pizza"
android:src="@drawable/pizza"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/txt_pizza"
android:text="Pizza"
android:textSize="10dp"
android:textAlignment="center"
android:layout_marginTop="5dp"
android:fontFamily="sans-serif-condensed-medium"/>
</LinearLayout>
</androidx.cardview.widget.CardView>
</LinearLayout>
</HorizontalScrollView>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/tv_no_record"
android:text="No Record"
android:visibility="gone"/>
<ProgressBar
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/progress"
android:visibility="gone"
android:layout_centerInParent="true"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:layout_width="150dp"
android:layout_height="wrap_content"
android:id="@+id/txt_category_type_pure_veg"
android:textSize="16dp"
android:textStyle="bold"
android:textColor="@color/black"
android:layout_margin="16dp"
android:layout_alignParentLeft="true"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/btn_view_all1"
android:text="View All"
android:textColor="@color/white"
android:textSize="14dp"
android:textStyle="bold"
android:textAlignment="center"
android:layout_marginTop="4dp"
android:layout_marginRight="16dp"
android:layout_alignParentRight="true"
android:background="@drawable/bg_ui"
/>
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:layout_width="120dp"
android:layout_height="120dp"
android:id="@+id/img_veg_restaurant_image"
android:src="@drawable/profileimage"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/txt_veg_restaurant_name"
android:textColor="@color/black"
android:textSize="14dp"
android:textStyle="bold"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/txt_veg_restaurant_desc"
android:textSize="12dp"
android:textStyle="bold"
android:layout_marginTop="3dp"/>
<RatingBar
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/rating_veg_restaurant"
android:numStars="5"
android:layout_marginTop="4dp"
android:scaleX="0.5"
android:scaleY="0.5"
android:isIndicator="true"
/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</androidx.cardview.widget.CardView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/txt_category_type_non_veg"
android:textSize="16dp"
android:textStyle="bold"
android:textColor="@color/black"
android:layout_gravity="left"
android:gravity="left"
android:layout_margin="16dp"
android:layout_alignParentLeft="true"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/btn_view_all2"
android:text="View All"
android:textColor="@color/white"
android:textSize="14dp"
android:textStyle="bold"
android:textAlignment="center"
android:layout_marginTop="4dp"
android:layout_marginRight="16dp"
android:layout_alignParentRight="true"
android:background="@drawable/bg_ui"
/>
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:layout_width="120dp"
android:layout_height="120dp"
android:id="@+id/img_non_veg_restaurant_image"
android:src="@drawable/profileimage"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/txt_non_veg_restaurant_name"
android:textColor="@color/black"
android:textSize="14dp"
android:textStyle="bold"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/txt_non_veg_restaurant_desc"
android:textSize="12dp"
android:textStyle="bold"
android:layout_marginTop="3dp"/>
<RatingBar
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/rating_non_veg"
android:numStars="5"
android:layout_marginTop="4dp"
android:scaleX="0.5"
android:scaleY="0.5"
android:isIndicator="true"
/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</androidx.cardview.widget.CardView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/txt_category_type_south_indian"
android:textSize="16dp"
android:textStyle="bold"
android:textColor="@color/black"
android:layout_margin="16dp"
android:layout_alignParentLeft="true"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/btn_view_all3"
android:text="View All"
android:textColor="@color/white"
android:textSize="14dp"
android:textStyle="bold"
android:textAlignment="center"
android:layout_marginTop="4dp"
android:layout_marginRight="16dp"
android:layout_alignParentRight="true"
android:background="@drawable/bg_ui"
/>
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:layout_width="120dp"
android:layout_height="120dp"
android:id="@+id/img_south_indian_restaurant_image"
android:src="@drawable/profileimage"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/txt_south_indian_restaurant_name"
android:textColor="@color/black"
android:textSize="14dp"
android:textStyle="bold"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/txt_south_indian_restaurant_desc"
android:textSize="12dp"
android:textStyle="bold"
android:layout_marginTop="3dp"/>
<RatingBar
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/rating_south_indian"
android:numStars="5"
android:layout_marginTop="4dp"
android:scaleX="0.5"
android:scaleY="0.5"
android:isIndicator="true"
/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</androidx.cardview.widget.CardView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/txt_category_type_fast_food"
android:textSize="16dp"
android:textStyle="bold"
android:textColor="@color/black"
android:layout_margin="16dp"
android:layout_alignParentLeft="true"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/btn_view_all4"
android:text="View All"
android:textColor="@color/white"
android:textSize="14dp"
android:textStyle="bold"
android:textAlignment="center"
android:layout_marginTop="4dp"
android:layout_marginRight="16dp"
android:layout_alignParentRight="true"
android:background="@drawable/bg_ui"
/>
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:layout_width="120dp"
android:layout_height="120dp"
android:id="@+id/img_fast_food_restaurant_image"
android:src="@drawable/profileimage"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/txt_fast_food_restaurant_name"
android:textColor="@color/black"
android:textSize="14dp"
android:textStyle="bold"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/txt_fast_food_restaurant_desc"
android:textSize="12dp"
android:textStyle="bold"
android:layout_marginTop="3dp"/>
<RatingBar
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/rating_fast_food"
android:numStars="5"
android:layout_marginTop="4dp"
android:scaleX="0.5"
android:scaleY="0.5"
android:isIndicator="true"
/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</androidx.cardview.widget.CardView>
<!-- </RelativeLayout>-->
</ScrollView>
Java Code
SplashActivity.Java
package com.niksample.smarthomedelivery;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.content.ContextCompat;
import android.Manifest;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Bundle;
import android.provider.Settings;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import com.karumi.dexter.Dexter;
import com.karumi.dexter.PermissionToken;
import com.karumi.dexter.listener.PermissionDeniedResponse;
import com.karumi.dexter.listener.PermissionGrantedResponse;
import com.karumi.dexter.listener.PermissionRequest;
import com.karumi.dexter.listener.single.PermissionListener;
ImageView img_logo;
TextView txt_title;
Animation lefttoright;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash);
img_logo = findViewById(R.id.img_logo);
txt_title = findViewById(R.id.txt_title);
lefttoright = AnimationUtils.loadAnimation(this,R.anim.lefttoright);
img_logo.setAnimation(lefttoright);
new Thread()
{
public void run()
{
try {
sleep(3000);
} catch (InterruptedException e) {
e.printStackTrace();
}
finally {
startActivity(new Intent(SplashScreen.this,LoginScreen.class));
finish();
}
}
}.start();
}
}
LoginActivity.java
package com.niksample.smarthomedelivery;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
import com.google.android.material.textfield.TextInputEditText;
import com.loopj.android.http.AsyncHttpClient;
import com.loopj.android.http.JsonHttpResponseHandler;
import com.loopj.android.http.RequestParams;
import com.niksample.smarthomedelivery.Activity.HomePage;
import com.niksample.smarthomedelivery.Comman.Config;
import org.json.JSONException;
import org.json.JSONObject;
import cz.msebera.android.httpclient.Header;
EditText edt_username;
TextInputEditText edt_password;
Button btn_login;
ImageButton img_btn_register;
TextView txt_forgot_password;
ProgressBar progress;
SharedPreferences preferences;
SharedPreferences.Editor editor;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login_screen);
preferences = PreferenceManager.getDefaultSharedPreferences(this);
editor = preferences.edit();
edt_username = findViewById(R.id.edt_username);
edt_password = findViewById(R.id.edt_password);
btn_login = findViewById(R.id.btn_login);
img_btn_register = findViewById(R.id.img_btn_register);
txt_forgot_password = findViewById(R.id.txt_forgot_password);
progress = findViewById(R.id.progress);
edt_password.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i1,
int i2) {
@Override
public void onTextChanged(CharSequence charSequence, int i, int i1, int
i2) {
if (edt_password.getText().toString().length() > 4)
{
Drawable imageView= getDrawable(R.drawable.visibility_on);
imageView.setVisible(true,true);
}
}
@Override
public void afterTextChanged(Editable editable) {
}
});
img_btn_register.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
startActivity(new Intent(LoginScreen.this,RegistrationScreen.class));
finish();
}
});
btn_login.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (edt_username.getText().toString().isEmpty())
{
edt_username.setError("Please Enter Valid Username");
}
else if (edt_password.getText().toString().isEmpty())
{
edt_password.setError("Please Enter Valid Password");
}
else
{
login();
}
}
});
}
params.put("username",edt_username.getText().toString());
params.put("password",edt_password.getText().toString());
client.post(Config.url_login,params,new JsonHttpResponseHandler() {
@Override
public void onStart() {
progress.setVisibility(View.VISIBLE);
super.onStart();
}
@Override
public void onSuccess(int statusCode, Header[] headers, JSONObject
response) {
progress.setVisibility(View.GONE);
try {
editor.putString("username",edt_username.getText().toString()).commit();
String aa = response.getString("success");
if (aa.equals("1"))
{
Toast.makeText(LoginScreen.this, "Login Successfully Done",
Toast.LENGTH_SHORT).show();
startActivity(new Intent(LoginScreen.this,HomePage.class));
finish();
}
else
{
Toast.makeText(LoginScreen.this, "Incorrect Username or
Password", Toast.LENGTH_SHORT).show();
}
} catch (JSONException e) {
e.printStackTrace();
}
}
@Override
RegistrationActivity.java
package com.niksample.smarthomedelivery;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ProgressBar;
import android.widget.Toast;
import com.google.android.material.textfield.TextInputEditText;
import com.loopj.android.http.AsyncHttpClient;
import com.loopj.android.http.JsonHttpResponseHandler;
import com.loopj.android.http.RequestParams;
import com.niksample.smarthomedelivery.Comman.Config;
import org.json.JSONException;
import org.json.JSONObject;
import cz.msebera.android.httpclient.Header;
EditText edt_name,edt_email,edt_mobile_no,edt_username,edt_retype_password;
TextInputEditText edt_password;
Button btn_sign_up;
ProgressBar progress;
SharedPreferences preferences;
SharedPreferences.Editor editor;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_registration_screen);
preferences = PreferenceManager.getDefaultSharedPreferences(this);
editor = preferences.edit();
progress = findViewById(R.id.progress);
edt_name = findViewById(R.id.edt_name);
edt_email = findViewById(R.id.edt_email);
edt_mobile_no = findViewById(R.id.edt_mobile_no);
edt_username = findViewById(R.id.edt_username);
edt_retype_password = findViewById(R.id.edt_retype_password);
edt_password = findViewById(R.id.edt_password);
btn_sign_up = findViewById(R.id.btn_sign_up);
btn_sign_up.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if(edt_name.getText().toString().isEmpty())
{
edt_name.setError("Please Enter Your Name");
}
else if(edt_mobile_no.getText().toString().isEmpty())
{
edt_mobile_no.setError("Please Enter Your Mobile Number");
}
else if (edt_email.getText().toString().isEmpty())
{
edt_email.setError("Please Enter Your Mail Id");
}
else if (edt_username.getText().toString().isEmpty())
{
edt_username.setError("Enter Username");
}
else if (edt_password.getText().toString().isEmpty())
{
edt_password.setError("Enter Strong Password");
}
else
{
addUsers();
}
}
});
}
params.put("name",edt_name.getText().toString());
params.put("mobile_no",edt_mobile_no.getText().toString());
params.put("email",edt_email.getText().toString());
params.put("username",edt_username.getText().toString());
params.put("password",edt_password.getText().toString());
client.post(Config.url_addusers,params,new JsonHttpResponseHandler() {
@Override
public void onStart() {
progress.setVisibility(View.VISIBLE);
super.onStart();
}
@Override
public void onSuccess(int statusCode, Header[] headers,
JSONObject response) {
progress.setVisibility(View.GONE);
try {
String aa = response.getString("success");
if (aa.equals("1"))
{
Toast.makeText(RegistrationScreen.this, "Registration
Succesfully Done", Toast.LENGTH_SHORT).show();
startActivity(new
Intent(RegistrationScreen.this,LoginScreen.class));
finish();
}
else
{
Toast.makeText(RegistrationScreen.this, "Already
Register", Toast.LENGTH_SHORT).show();
}
} catch (JSONException e) {
e.printStackTrace();
}
}
@Override
public void onFailure(int statusCode, Header[] headers, Throwable
throwable, JSONObject errorResponse) {
Toast.makeText(RegistrationScreen.this, "Could not Connect",
Toast.LENGTH_SHORT).show();
}
});
}
@Override
public void onBackPressed() {
startActivity(new Intent(RegistrationScreen.this,LoginScreen.class));
finish();
}
}
HomeActivity.java
package com.niksample.smarthomedelivery.Activity;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.os.Handler;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.widget.SearchView;
import androidx.cardview.widget.CardView;
import androidx.navigation.ui.AppBarConfiguration;
import com.google.android.material.navigation.NavigationView;
import com.loopj.android.http.AsyncHttpClient;
import com.loopj.android.http.JsonHttpResponseHandler;
import com.loopj.android.http.RequestParams;
import com.niksample.smarthomedelivery.Comman.Config;
import com.niksample.smarthomedelivery.LoginScreen;
import com.niksample.smarthomedelivery.R;
import com.squareup.picasso.Picasso;
import androidx.drawerlayout.widget.DrawerLayout;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import android.view.Menu;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.RatingBar;
import android.widget.TextView;
import android.widget.Toast;
import android.widget.ViewFlipper;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import cz.msebera.android.httpclient.Header;
ViewFlipper flipper;
private static Handler handler = new Handler();
CardView hori_cardview1,hori_cardview2,hori_cardview3,hori_cardview4;
TextView tv_no_record;
ProgressBar progress;
SharedPreferences preferences;
SharedPreferences.Editor editor;
ImageView
img_veg_restaurant_image,img_non_veg_restaurant_image,img_south_indian_restaurant_ima
ge,img_fast_food_restaurant_image;
TextView
txt_category_type_pure_veg,txt_category_type_non_veg,txt_category_type_south_indian,t
xt_category_type_fast_food;
TextView
txt_veg_restaurant_name,txt_non_veg_restaurant_name,txt_south_indian_restaurant_name,
txt_fast_food_restaurant_name;
TextView
txt_veg_restaurant_desc,txt_non_veg_restaurant_desc,txt_south_indian_restaurant_desc,
txt_fast_food_restaurant_desc;
RatingBar
rating_veg_restaurant,rating_non_veg_restaurant,rating_south_indian_restaurant,rating
_fast_food_restaurant;
Button
btn_view_veg_restaurant,btn_view_non_veg_restaurant,btn_view_south_indian_restaurant,
btn_view_fast_food_restaurant;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_home_page);
SharedPreferences sharedPreferences =
getSharedPreferences("prefs",MODE_PRIVATE);
boolean firsttime = sharedPreferences.getBoolean("firsttime",true);
if (firsttime)
{
welcome();
}
// searchView = findViewById(R.id.home_searchview);
hori_cardview1 = findViewById(R.id.hori_cardview1);
hori_cardview2 = findViewById(R.id.hori_cardview2);
hori_cardview3 = findViewById(R.id.hori_cardview3);
hori_cardview4 = findViewById(R.id.hori_cardview4);
hori_cardview1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
startActivity(new Intent(HomePage.this,
Pure_Veg_Restaurant_Screen.class));
finish();
}
});
hori_cardview2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
startActivity(new Intent(HomePage.this,
Non_Veg_Restaurant_Screen.class));
finish();
}
});
hori_cardview3.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
startActivity(new Intent(HomePage.this,
South_indian_Restaurant_Screen.class));
finish();
}
});
hori_cardview4.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
startActivity(new Intent(HomePage.this,
Fast_Food_Restaurant_Screen.class));
finish();
}
});
//slideshow start
flipper = (ViewFlipper) findViewById(R.id.viewFlipper1);
flipper.setOnTouchListener(new View.OnTouchListener() {
float x1 = 0, x2, y1 = 0, y2, dx, dy;
@Override
public boolean onTouch(View v, MotionEvent event) {
String direction;
switch(event.getAction()) {
case(MotionEvent.ACTION_DOWN):
x1 = event.getX();
y1 = event.getY();
break;
case(MotionEvent.ACTION_UP): {
x2 = event.getX();
y2 = event.getY();
dx = x2-x1;
dy = y2-y1;
// Use dx and dy to determine the direction
if(Math.abs(dx) > Math.abs(dy)) {
if(dx>0) {
direction = "right";
} else {
direction = "left";
}
slideFipper(direction);
} else {
if(dy>0) direction = "down";
else direction = "up";
}
}
}
v.performClick();
return true;
}
});
img_veg_restaurant_image = findViewById(R.id.img_veg_restaurant_image);
img_non_veg_restaurant_image =
findViewById(R.id.img_non_veg_restaurant_image);
img_south_indian_restaurant_image =
findViewById(R.id.img_south_indian_restaurant_image);
img_fast_food_restaurant_image =
findViewById(R.id.img_fast_food_restaurant_image);
txt_category_type_pure_veg = findViewById(R.id.txt_category_type_pure_veg);
txt_veg_restaurant_name = findViewById(R.id.txt_veg_restaurant_name);
txt_veg_restaurant_desc = findViewById(R.id.txt_veg_restaurant_desc);
rating_veg_restaurant = findViewById(R.id.rating_veg_restaurant);
btn_view_veg_restaurant = findViewById(R.id.btn_view_all1);
getpurevegrestaurant();
txt_category_type_non_veg = findViewById(R.id.txt_category_type_non_veg);
txt_non_veg_restaurant_name = findViewById(R.id.txt_non_veg_restaurant_name);
txt_non_veg_restaurant_desc = findViewById(R.id.txt_non_veg_restaurant_desc);
rating_non_veg_restaurant = findViewById(R.id.rating_non_veg);
btn_view_non_veg_restaurant = findViewById(R.id.btn_view_all2);
getnonvegrestaurant();
txt_category_type_south_indian =
findViewById(R.id.txt_category_type_south_indian);
txt_south_indian_restaurant_name =
findViewById(R.id.txt_south_indian_restaurant_name);
txt_south_indian_restaurant_desc =
findViewById(R.id.txt_south_indian_restaurant_desc);
rating_south_indian_restaurant = findViewById(R.id.rating_south_indian);
btn_view_south_indian_restaurant = findViewById(R.id.btn_view_all3);
getsouthindianrestaurant();
txt_category_type_fast_food = findViewById(R.id.txt_category_type_fast_food);
txt_fast_food_restaurant_name =
findViewById(R.id.txt_fast_food_restaurant_name);
txt_fast_food_restaurant_desc =
findViewById(R.id.txt_fast_food_restaurant_desc);
rating_fast_food_restaurant = findViewById(R.id.rating_fast_food);
btn_view_fast_food_restaurant = findViewById(R.id.btn_view_all4);
getfastfoodrestaurant();
tv_no_record = findViewById(R.id.tv_no_record);
progress = findViewById(R.id.progress);
btn_view_veg_restaurant.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new
Intent(HomePage.this,Pure_Veg_Restaurant_Screen.class));
finish();
}
});
btn_view_non_veg_restaurant.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new
Intent(HomePage.this,Non_Veg_Restaurant_Screen.class));
finish();
}
});
btn_view_south_indian_restaurant.setOnClickListener(new
View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new
Intent(HomePage.this,South_indian_Restaurant_Screen.class));
finish();
}
});
btn_view_fast_food_restaurant.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new
Intent(HomePage.this,Fast_Food_Restaurant_Screen.class));
finish();
}
});
client.post(Config.url_pure_veg_restaurant, params,new
JsonHttpResponseHandler() {
@Override
public void onStart() {
progress.setVisibility(View.VISIBLE);
super.onStart();
}
@Override
public void onSuccess(int statusCode, Header[] headers, JSONObject
response) {
progress.setVisibility(View.GONE);
try {
JSONArray jsonArray =
response.getJSONArray("getPureVegRestaurant");
for (int i= 0 ; i<jsonArray.length(); i++)
{
JSONObject jsonObject = jsonArray.getJSONObject(i);
String category_type_veg =
jsonObject.getString("category_type_veg");
String pure_veg_restaurant_image =
jsonObject.getString("pure_veg_restaurant_image");
String pure_veg_restaurant_name =
jsonObject.getString("pure_veg_restaurant_name");
String pure_veg_restaurant_desc =
jsonObject.getString("pure_veg_restaurant_desc");
String pure_veg_restaurant_rating =
jsonObject.getString("pure_veg_restaurant_rating");
txt_category_type_pure_veg.setText(category_type_veg);
Picasso.with(HomePage.this).load(Config.OnlineImageAddress+""+pure_veg_restaurant_ima
ge).placeholder(R.drawable.profileimage)
.error(R.drawable.image_not_load).into(img_veg_restaurant_image);
txt_veg_restaurant_name.setText(pure_veg_restaurant_name);
txt_veg_restaurant_desc.setText(pure_veg_restaurant_desc);
rating_veg_restaurant.setRating(Float.parseFloat(pure_veg_restaurant_rating));
} catch (JSONException e) {
e.printStackTrace();
}
}
@Override
public void onFailure(int statusCode, Header[] headers, Throwable
throwable, JSONObject errorResponse) {
Toast.makeText(HomePage.this, "Could Not Connect",
Toast.LENGTH_SHORT).show();
}
});
// params.put("election_state",preferences.getString("election_state",""));
client.post(Config.url_non_veg_restaurant, params,new
JsonHttpResponseHandler() {
@Override
public void onStart() {
progress.setVisibility(View.VISIBLE);
super.onStart();
}
@Override
public void onSuccess(int statusCode, Header[] headers, JSONObject
response) {
progress.setVisibility(View.GONE);
try {
JSONArray jsonArray =
response.getJSONArray("getNonVegRestaurant");
for (int i= 0 ; i<jsonArray.length(); i++)
{
JSONObject jsonObject = jsonArray.getJSONObject(i);
String category_type_non_veg =
jsonObject.getString("category_type_non_veg");
String non_veg_restaurant_image =
jsonObject.getString("non_veg_restaurant_image");
String non_veg_restaurant_name =
jsonObject.getString("non_veg_restaurant_name");
String non_veg_restaurant_desc =
jsonObject.getString("non_veg_restaurant_desc");
String non_veg_restaurant_rating =
jsonObject.getString("non_veg_restaurant_rating");
txt_category_type_non_veg.setText(category_type_non_veg);
Picasso.with(HomePage.this).load(Config.OnlineImageAddress+""+non_veg_restaurant_imag
e).placeholder(R.drawable.profileimage)
.error(R.drawable.image_not_load).into(img_non_veg_restaurant_image);
txt_non_veg_restaurant_name.setText(non_veg_restaurant_name);
txt_non_veg_restaurant_desc.setText(non_veg_restaurant_desc);
rating_non_veg_restaurant.setRating(Float.parseFloat(non_veg_restaurant_rating));
} catch (JSONException e) {
e.printStackTrace();
}
}
@Override
public void onFailure(int statusCode, Header[] headers, Throwable
throwable, JSONObject errorResponse) {
Toast.makeText(HomePage.this, "Could Not Connect",
Toast.LENGTH_SHORT).show();
}
});
// params.put("election_state",preferences.getString("election_state",""));
client.post(Config.url_south_indian_restaurant, params,new
JsonHttpResponseHandler() {
@Override
public void onStart() {
progress.setVisibility(View.VISIBLE);
super.onStart();
}
@Override
public void onSuccess(int statusCode, Header[] headers, JSONObject
response) {
progress.setVisibility(View.GONE);
try {
JSONArray jsonArray =
response.getJSONArray("getSouthIndianRestaurant");
for (int i= 0 ; i<jsonArray.length(); i++)
{
JSONObject jsonObject = jsonArray.getJSONObject(i);
String category_type_south_indian =
jsonObject.getString("category_type_south_indian");
String south_indian_restaurant_image =
jsonObject.getString("south_indian_restaurant_image");
String south_indian_restaurant_name =
jsonObject.getString("south_indian_restaurant_name");
String south_indian_restaurant_desc =
jsonObject.getString("south_indian_restaurant_desc");
String south_indian_restaurant_rating =
jsonObject.getString("south_indian_restaurant_rating");
txt_category_type_south_indian.setText(category_type_south_indian);
Picasso.with(HomePage.this).load(Config.OnlineImageAddress+""+south_indian_restaurant
_image).placeholder(R.drawable.profileimage)
.error(R.drawable.image_not_load).into(img_south_indian_restaurant_image);
txt_south_indian_restaurant_name.setText(south_indian_restaurant_name);
txt_south_indian_restaurant_desc.setText(south_indian_restaurant_desc);
rating_south_indian_restaurant.setRating(Float.parseFloat(south_indian_restaurant_rat
ing));
} catch (JSONException e) {
e.printStackTrace();
}
}
@Override
public void onFailure(int statusCode, Header[] headers, Throwable
throwable, JSONObject errorResponse) {
Toast.makeText(HomePage.this, "Could Not Connect",
Toast.LENGTH_SHORT).show();
}
});
// params.put("election_state",preferences.getString("election_state",""));
client.post(Config.url_fast_food_restaurant, params,new
JsonHttpResponseHandler() {
@Override
public void onStart() {
progress.setVisibility(View.VISIBLE);
super.onStart();
}
@Override
public void onSuccess(int statusCode, Header[] headers, JSONObject
response) {
progress.setVisibility(View.GONE);
try {
JSONArray jsonArray =
response.getJSONArray("getFastFoodRestaurant");
for (int i= 0 ; i<jsonArray.length(); i++)
{
JSONObject jsonObject = jsonArray.getJSONObject(i);
String category_type_fast_food =
jsonObject.getString("category_type_fast_food");
String fast_food_restaurant_image =
jsonObject.getString("fast_food_restaurant_image");
String fast_food_restaurant_name =
jsonObject.getString("fast_food_restaurant_name");
String fast_food_restaurant_desc =
jsonObject.getString("fast_food_restaurant_desc");
String fast_food_restaurant_rating =
jsonObject.getString("fast_food_restaurant_rating");
txt_category_type_fast_food.setText(category_type_fast_food);
Picasso.with(HomePage.this).load(Config.OnlineImageAddress+""+fast_food_restaurant_im
age).placeholder(R.drawable.profileimage)
.error(R.drawable.image_not_load).into(img_fast_food_restaurant_image);
txt_fast_food_restaurant_name.setText(fast_food_restaurant_name);
txt_fast_food_restaurant_desc.setText(fast_food_restaurant_desc);
rating_fast_food_restaurant.setRating(Float.parseFloat(fast_food_restaurant_rating));
} catch (JSONException e) {
e.printStackTrace();
}
}
@Override
public void onFailure(int statusCode, Header[] headers, Throwable
throwable, JSONObject errorResponse) {
Toast.makeText(HomePage.this, "Could Not Connect",
Toast.LENGTH_SHORT).show();
}
});
flipper.setOutAnimation(getApplicationContext(),
R.anim.exit);
flipper.showNext();
} else {
flipper.startAnimation(no_next);
}
} else {
//right
if (currentView > 0) {
flipper.setInAnimation(getApplicationContext(),R.anim.pop_enter);
flipper.setOutAnimation(getApplicationContext(),
R.anim.pop_exit);
flipper.showPrevious();
} else {
flipper.startAnimation(no_previuos);
}
}
}
});
}
//slideshow end
SharedPreferences sharedPreferences =
getSharedPreferences("prefs",MODE_PRIVATE);
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.putBoolean("firsttime",false);
editor.apply();
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.home_page, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
switch (item.getItemId())
{
case R.id.menu_action_my_profile:
startActivity(new Intent(HomePage.this,MyProfileScreen.class));
finish();
return true;
case R.id.menu_action_my_order:
startActivity(new Intent(HomePage.this,MyOrderActivity.class));
finish();
return true;
case R.id.menu_action_my_address:
startActivity(new Intent(HomePage.this,ShowMyAddressActivity.class));
finish();
return true;
case R.id.menu_action_logout:
logout();
return true;
default:
return super.onOptionsItemSelected(item);
}
}
@Override
public void onBackPressed() {
if (doubletap)
{
super.onBackPressed();
}
else
{
Toast.makeText(this, "Please Press again to exit the app",
Toast.LENGTH_SHORT).show();
doubletap = true;
Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
doubletap = false;
}
},2000);
}
}
}
Chapter 6
There are 2 Android application in which first is for the restaurant/Admin and second is
for Smart Food Shopping App or common people. Smart Food Shopping App
application includes registration, login, selection of dishes, payment, etc. After all
this method Smart Food Shopping App can track drone location from that app.
Restaurant/Admin app can see the Smart Food Shopping App details and the order
details.[6]
This project can extend by doing some work on drone design which can deliver parcel
at door step in multistoried buildings also. This work is quite difficult todo but can be
done by using Image Processing and Artificial Intelligence. Stability of the drone can be
managed by using Artificial intelligence, it will help to manage parcel to keep it
balanced at the center of the mass of drone.[7]
Chapter 7
This order food online system project aimed at developing an online food
ordering system that can be used in small places, and medium cities firstly and then on
a large scale.
The system enables staff to let update and make changes to their food and
beverage list information based on the orders placed and the orders completed.
Chapter 8
All over the world drones are being used in other ways than by the military, and we
implement the use of drone in Smart Food Shopping App purpose in order to save time.
The proposed System can be helpful in order to deliver the food at the time of disaster
such as flood, earthquake etc. It can also be used in medical emergencies in order to
supply medicines. The service doesn't just ease operational burdens — it brings benefits
to Smart Food Shopping Apps too. Drone-based delivery reduces food degradation and
improves the Smart Food Shopping App experience. Drone can also help to deliver
food packets to the people stuck in the flood. In medical emergencies, if there is urgent
need of blood and its huge traffic in the city it is not possible to deliver that in small
time, so we can use drone to deliver blood to hospital from blood bank.[6][7][8][9]
Chapter 9
9.1 REFERENCES
[1]. Wireless Communication with Unmanned Aerial Vehicles: Opportunities and
challenges. Yong Zeng, Rui Zhang and Teng Joon Lim (Published on 11 Feb 2016)
[3] Planning and Evaluation of UAV Mission Planner for Intralogistics Problems,
Thiago R. F. Cavalcante, Iury Bessa, Lucas C. Cordeiro, Federal University of
Amazonas, Manaus, Brazil (University of Oxford, Oxford, United Kingdom, 2017)
[4] Enabling secure location authentication in drone. By-Xiao, F., Zhou, M.,
Liye,Y., Yang, J., and Wang, Q. Poster. Research Gate.
[6] Radiant Insights. “Commercial Drones Market to Reach $4.8 Billion From
2015 to2012: Radiant Insights”, January 12, 2015.
[7] Drones for Deliveries, Simran Brar, Ralph Rabbat, Vishal Raithatha, George
Runcie, Andrew Yu,Sutardja Center for Entrepreneurship & Technology Technical
Report , Berkeley, University of California. (November 8, 2015)
[8] Anis Koubˆaa, Azza Allouch, Maram Alajlan, Yasir Javed, Abdelfettah
Belghith, and Mohamed Khalgui, "MICRO AIR VEHICLE LINK (MAVLINK) IN A
NUTSHELL: A SURVEY", Journal Of Latex Class Files, Vol. 14, No. 8, August 2015,
The paper is accepted for publication in IEEE Access, June 2019.