0% found this document useful (0 votes)
66 views70 pages

NGO Management System Report From Digicoders 2023

This document is a project report for an NGO Management System submitted in partial fulfillment of a diploma in computer science and engineering. It includes sections on introducing the project objectives and problem definition, analyzing the system requirements and design, specifying the hardware and software needs, and describing the testing and input/output forms. Screenshots and code snippets from the project are provided. The report acknowledges the contributions of the student's supervisor and examines potential future work and conclusions.

Uploaded by

akkivish37
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
66 views70 pages

NGO Management System Report From Digicoders 2023

This document is a project report for an NGO Management System submitted in partial fulfillment of a diploma in computer science and engineering. It includes sections on introducing the project objectives and problem definition, analyzing the system requirements and design, specifying the hardware and software needs, and describing the testing and input/output forms. Screenshots and code snippets from the project are provided. The report acknowledges the contributions of the student's supervisor and examines potential future work and conclusions.

Uploaded by

akkivish37
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 70

A

PROJECT REPORT

On

“Project Name Here”

Submitted in partial fulfillment of the requirements for award the

DIPLOMA

In

COMPUTER SCIENCE & ENGINEERING

SUBMITTED TO: SUBMITTED BY:

College Name Here Student Name Here

Enrollment No. Here

DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING

DigiCoders Technologies Pvt. Ltd. Lucknow(U.P)


Under the Supervision of (Er. Himanshu Kashyap Sr. Project Manager)
1 Ltd. Lucknow (U.P)
DigiCoders Technologies Pvt.
BOARD OF TECHNICAL EDUCATION, UTTAR PRADESH

Session:2023-2024

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING


DigiCoders Technologies Pvt. Ltd. Lucknow (U.P.)

2 Ltd. Lucknow (U.P)


DigiCoders Technologies Pvt.
CERTIFICATE
This is to certify that Student Name Here has carried out the Project work report entitled the “Project Name
Here” submitted in partial fulfillment of the requirements for the award of the degree of Diploma in
Computer Science and Engineering in College Name Here under my supervision during the academic
session 2023-2024.

External Examiner Internal Examiner

3 Ltd. Lucknow (U.P)


DigiCoders Technologies Pvt.
ACKNOWLEDGEMENT
I express my deepest sense of gratitude towards my supervisor College Name Here , for his
valuable advice at every stage of this work, his patience, inspiration, guidance,
constant encouragement, moral support, keen interest and valuable suggestion during the
preparation of this Project report.

My early gratitude goes to HOD of College and all other faculty members of
Computer Science and Engineering Department who, with their encouraging and caring words
and most valuable suggestion have contributed directly or indirectly in a significant way
towards completion of this project report.

I am indebted to all my classmates from Computer Science and Engineering, for taking
an interest in discussing my problems and encouraging me.

Last but not least, I owe a debt of gratitude to my family for their consistent
support, sacrifice, candid views, and meaningful suggestions at the different stages of my work.

Student Name Here

VIth Semester
Department of Computer Science and Engineering

4 Ltd. Lucknow (U.P)


DigiCoders Technologies Pvt.
5 Ltd. Lucknow (U.P)
DigiCoders Technologies Pvt.
DECLARATION

This is to certify that the project report entitled “NGO Management System” is done by me is an
authentic work carried out for the partial fulfillment of the requirements for the award of the Diploma
in “(Computer Science & Engineering)”under the guidance of Mr. Er. Himanshu Kashyap. The
matter embodied in this project work has not been submitted earlier for award of any degree or
diploma to the best of my knowledge and belief.

Student Name Here

6 Ltd. Lucknow (U.P)


DigiCoders Technologies Pvt.
INDEX

Page

1. Introduction…................................................................................................10-12
1.1. Overview of Organization......................................................................................................10-10
1.2. Project Introduction...............................................................................................................10-10
1.3. Objectives...............................................................................................................................10-11
1.4. Problem Definition.................................................................................................................11-12

2. System Analysis.............................................................................................12-21
2.1. Objective................................................................................................................................12-12
2.2. SDLC Phases..........................................................................................................................12-12
2.2.1. Preliminary Investigation.......................................................................................................12-14
2.2.2. System Analysis.....................................................................................................................14-14
2.2.3. System Design........................................................................................................................14-14
2.2.4. Coding....................................................................................................................................14-15
2.2.5. Testing....................................................................................................................................15-15
2.2.6. Implementation......................................................................................................................15-15
2.2.7. Maintenance...........................................................................................................................15-15
2.3. Process Description................................................................................................................16-16
2.4. Project Model Used................................................................................................................16-17
2.5. ER-Diagram...........................................................................................................................18-19
2.6. Data Flow Diagram...............................................................................................................20-20

3. Software Hardware Requirement Specification.........................................22-23


3.1. Hardware Requirement..........................................................................................................22-22
3.2. Server side Software Requirement.......................................................................................22-22
3.3. Client side Software Requirement........................................................................................22-22
3.4. Support Maintenance.............................................................................................................23-23

7 Ltd. Lucknow (U.P)


DigiCoders Technologies Pvt.
4. System Design Approach…...........................................................................23-24
4.1. Top-Down Designing.............................................................................................................23-23
4.2. Bottom –Up Designing..........................................................................................................24-24
4.3. Following Approach..............................................................................................................24-24

5. Configuration Design (manifest.xml)…........................................................25-33


6. Data Modeling................................................................................................34-36

6.1. List of Tables.......................................................................................................................34-34


6.2. Structure of Tables............................................................................................................34-36
7. Testing.............................................................................................................37-41

8. Input-Output Forms......................................................................................42-65

8.1. Project Screenshot................................................................................................................42-48

8.2. Project Coding (XML & Java)............................................................................................49-65

9. Future Scope…...............................................................................................66-66

10. Conclusion......................................................................................................66-66

8 Ltd. Lucknow (U.P)


DigiCoders Technologies Pvt.
LIST OF TABLES

Page

1. Screenshot of Firebase Real time Database...........................................................34


2. Message Table....................................................................................................35
3. Story Table........................................................................................................36
4. User Table...........................................................................................................36

9 Ltd. Lucknow (U.P)


DigiCoders Technologies Pvt.
LIST OF FIGURES&SCREENSHOTS

Page

1. SOFTWARE DEVELOPMENT LIFE CYCLE..................................................16


2. DEVELOPMENT PHASES...................................................................................18
3. E-R DIAGRAM.......................................................................................................19
4. ZERO LEVEL DATA FLOW DIAGRAM..........................................................21

5. ONE LEVEL DATA FLOW DIAGRAM............................................................21

6. TOP-DOWN DESIGNING….................................................................................23

7. BOTTOM-UP DESIGNING…...............................................................................24

10 Ltd. Lucknow (U.P)


DigiCoders Technologies Pvt.
1. INTROUCTION

1.1. Overview of Organization


Digicoders is founded by some young engineers who have mastered the IT sector, whose objective is
to achieve the highest position in the IT sector across the country, who are trying to achieve this
objective by cooperating in various fields.

Digicoders is an organization working in both software development and software training, which
aims to make all the specials of its client successful through their coding as well as to make students
more competent to work with a well reputed organization.

We are proud of our high-quality standards. These standards allow us to provide our customers with
reliable and error-free software applications, regardless of complexity. Our top-notch developers use
the latest software methodologies and technologies. This means that they can concentrate on our
clients' business goals and keep them involved in every stage through the entire project. Our
meticulous approach has helped us build our excellent track record with no failed or aborted projects.
We are in the business of change, managing complexity with an unparalleled insight, looking beyond
the horizon of IT with resources focused on solutions. Becoming successful is a skill but one cannot
perfect it without practice.

11 Ltd. Lucknow (U.P)


DigiCoders Technologies Pvt.
1.2. PROJECT INTRODUCTION:--

Our NGO Management System website aims to streamline and enhance the operations of non-profit organizations.

It provides a user-friendly platform for NGOs to manage volunteers, donations, projects, and communication

efficiently. This web-based solution empowers NGOs to make a more significant impact on their mission while

ensuring transparency and accountability.

1.3. OBJECTIVE
The objectives of the NGO Management System website are:

1. **Streamline Operations:** Simplify administrative processes to increase efficiency within the organization.

2. **Volunteer Management:** Facilitate the recruitment, scheduling, and coordination of volunteers.

3. **Donation Management:** Improve the tracking and management of donations, including online fundraising
capabilities.

4. **Project Management:** Enhance project planning, monitoring, and reporting for better project outcomes.

5. **Communication:** Foster improved communication and collaboration within the organization and
With external stakeholders.

6. **Transparency and Accountability:** Ensure transparent financial tracking and reporting to enhance
organizational credibility.

7. **Empower NGOs:** Provide user-friendly tools that empower NGOs to make a more significant
impact on their missions and communities.

12 Ltd. Lucknow (U.P)


DigiCoders Technologies Pvt.
1.4. PROBLEM DEFINITION
In this section we shall discuss the limitation and drawback of the existing system that forced us to
take up this project. Really that work was very typical to manage the daily errors free records and
adding or removing any node from server. This problem produces a need to change the existing
system. Some of these shortcomings are being discussed below: -

 Low Functionality

With the existing system, the biggest problem was the low functionality. The problem faced
hampered the work. For small task like adding any new node to server or deleting a node or keeping
daily record we have to appoint minimum two or three employee.

 Erroneous Input and Output

In the existing system, humans performed all the tasks. As in the human tendency, error is also a
possibility. Therefore, the inputs entered by the person who is working in the Company, in the
registers may not be absolutely foolproof and may be erroneous. As a result of wrong input, the
output reports etc. Will also be wrong which would in turn affect the performance.

 Portability Problem
System that existed previously was manual. As a result, the system was less portable. One has to
carry the loads of many registers to take the data from one place to another. A big problem was that
the system was less flexible and if we wanted to calculate yearly or monthly maintenance
report or

13 Ltd. Lucknow (U.P)


DigiCoders Technologies Pvt.
efficiency report, then it was a big headache.

 Security-

Security concerns were also one of the motives of the Company for the need of software. In the
registers, the data is not secure as anybody can tamper with the data written in the registers. While in
this software, just a password makes it absolutely secure from the reach of unauthorized persons.

 Data Redundancy
In the case of manual system, the registers are maintained in which, a lot of data is written.

 Processing Speed
In manual system maintaining a register and performing the necessary calculation has proved to be a
troublesome job, which takes a lot of time and may affect the performance of the Company. But with
this software we can have all the tasks performed in a fraction of second by a single click thus
making the troublesome job much easier.

 Manual Errors
When a number of tough tasks are prepared by the humans like preparation of reports, performing
long calculation then some human error are obvious due to a number of factors like mental strain,
tiredness etc. But as we all know that computer never get tired irrespective of the amount of work it
has to do. So this software can nullify the probability of manual error that improve the performance.

 Complexity in Work

In manual system whenever a record is to be updated or to be deleted a lot of cutting and overwriting
needs to be done on the registers that are concerned that are deleted or updated record, which makes
the work very complex.

2. SYSTEM ANALYSIS
2.1. Objective:

14 Ltd. Lucknow (U.P)


DigiCoders Technologies Pvt.
It is a process of collecting and interpreting facts, identifying the problems, and decomposition of a
system into its components.

System analysis is conducted for the purpose of studying a system or its parts in order to identify its
objectives. It is a problem solving technique that improves the system and ensures that all the
components of the system work efficiently to accomplish their purpose.

Analysis specifies what the system should do.

2.2. SDLC Phases:


System Development Life Cycle (SDLC) mainly consists of the following 7 phases which can be
detailed: -

2.2.1. Preliminary Investigation: -

This is the first phase of the system development life cycle. In this phase we tend to find out the
needs of the client –what exactly does the client want? Before the development of any system the
important point is to know the needs, objectives and scope of the system.

 Feasibility Study: -
Feasibility study is the step of preliminary study of the system development life cycle. Things are
always easy at the beginning in any software process. In fact nothing is in feasible with unlimited
time and resources. But it is not the fact. So, practically we have to do in limited resources in a
restricted time margin. So for the system to be feasible, following points we have to consider.

The feasibility study is conducted to check whether the candidate system is feasible. The system
which is selected to be the best against the criteria is there after designed and developed. The
feasibility study takes in to consideration, the risks involved in the project development beforehand.
Therefore in this phase we have to do feasibility study which is the test of the website according to its
work ability, impact on the organization, ability to meet user need and effective use of resources. We
do the feasibility study for website to analyze the risks, costs and benefits relating to economics,
technology and user organization. There are several types of feasibility depending on the aspect they
cover. Import of these includes:

15 Ltd. Lucknow (U.P)


DigiCoders Technologies Pvt.
Technical Feasibility:
This is an important outcome of preliminary investigation. It comprise of following questions:-
 Can the work of project bed one with the current equipment, existing software and available man
power resource?
 If Technology is required what are the possibilities that it can be developed?

Economic Feasibility:
It deals with question related to the economy. It comprise of the following questions:-

 Are there sufficient benefits in creating the system to make the cost acceptable?

 Are the costs of not creating the system so great that the project must be undertaken?

Legal Feasibility:
It deals with the question related to the legal issues. It comprise of the following questions: -

 Contract Signing

 Software License agreement

 Issues related to cyber laws.

 Legal issues relating to the man power contract.

Operational Feasibility:
The operational feasibility consists of the following activity:
 Will the system be useful if it is developed &implemented?
 Will there be resistance from employee?

Social & Behavioral Feasibility:


It deals with the various issues related to the human behavior like: -
 Whether the user be able to adapt a new change or not?
 Whether the ambiance we are providing suits the user or not?

 Request Approval: -

16 Ltd. Lucknow (U.P)


DigiCoders Technologies Pvt.
Request approval is the preliminary investigation phase of system development lifecycle.Request
approval is the phase in which all the requirements which would be provide in the system are stated.
The request approval is a sort of agreement between the client and the company which is building
this software.
Both the parties should be mutually agreed on the statedrequirements.

2.2.2. System Analysis:-


System analysis is the phase following the phase of the request approval. In this phase we tend to
analyze the overall system which we have to build. System analysis is the crucial part in SDLC.

2.2.3. System Design:-


System design means the designing of the system. The System can be done in either of the following
two ways:-
 Logical SystemDesign

 Physical SystemDesign
2.2.4. Coding:-
Coding is the phase in which a developer codes using any programming languages. Coding
constitutes only 20% of the whole project and which is easier to write. The coding work is also done
in the teams; development of the system is usually done under the modular programming style, which
can be either top-down approach or bottom-up approach.

2.2.5. Testing:-
Testing is the phase in which the system that has been developed is tested. Testing comprises of the
60% of the overall development of the system. Testing of the system is important because testing
aims to uncover the different errors in the system. There are various different testing techniques that
can be used for the testing of the system.

2.2.6. Implementation:-
Implementation process involved the installation of software on user’s side. Implementation process
actually depends on type of a system & various. Opting for suitable conversion approach is a step
implementation. The conversion processes are as follows:-

 ParallelConversion

17 Ltd. Lucknow (U.P)


DigiCoders Technologies Pvt.
 Direct ConversionApproach

 Pilot ConversionApproach

 Phase In ConversionApproach

2.2.7. Maintenance: -
Merely developing the system is not important but also maintenance is important. The company that
has built the system provides for some time free of cost maintenance to the client and after that period
it is usually a paid service.

2.3. Process Description


Gantt charts mainly used to allocate resources to activities. The resources allocated to activities
include staff, hardware, and software. Gantt charts (named after its developer Henry Gantt) are useful
for resource planning. A Gantt chart is special type of bar chart where each bar represents an activity.
The bars are drawn along a timeline. The length of each bar is proportional to the duration of the time
planned for the corresponding activity.
Gantt chart is a project scheduling technique. Progress can be represented easily in a Gantt chart, by
coloring each milestone when completed. The project will start in the month of January and end after
18 Ltd. Lucknow (U.P)
DigiCoders Technologies Pvt.
4 months at the beginning of April.

2.4. PROJECT MODEL USED

Iterative Enhancement Model

 This model has the same phases as the waterfall model, but with fewer restrictions. Generally
the phases occur in the same order as in the waterfall model, but they may be conducted in several
cycles.
 Useable product is released at the end of the each cycle, with each release providing additional
functionality. Customers and developers specify as many requirements as possible and prepare a SRS
document. Developers and customers then prioritize these requirements. Developers implement the
specified requirements in one or more cycles of design, implementation and test based on the
definedpriorities.
The procedure itself consists of the initialization step, the iteration step, and the Project Control List.
The initialization step creates a base version of the system. The goal for this initial implementation is
to create a product to which the user can react. It should offer a sampling of the key aspects of the
problem and provide a solution that is simple enough to understand and implement easily. To guide
the iteration process, a project control list is created that contains a record of all tasks that need to be
performed. It includes such items as new features to be implemented and areas of redesign of the
existing solution. The control list is constantly being revised as a result of the analysisphase.
The iteration involves the redesign and implementation of iteration is to be simple, straightforward,
and modular, supporting redesign at that stage or as a task added to the project control list. The
level of design detail is not dictated by the iterative approach. In a light-weight iterative project the
code may represent the major source of documentationof the system; however, in a
critical iterative project a formal Software Design Documentmay be used. The analysis of iteration
is based upon user feedback, and the program analysis facilities available. It involves analysis of the
structure, modularity, usability, reliability, efficiency, & achievement of goals. The project control
list is modified in light of the analysis results.
PHASES:
Incremental development slices the system functionality into increments (portions). In each
increment, a slice of functionality is delivered through cross- discipline work, from the

19 Ltd. Lucknow (U.P)


DigiCoders Technologies Pvt.
requirements to the

20 Ltd. Lucknow (U.P)


DigiCoders Technologies Pvt.
deployment. The unified process groups increments/iterations into phases: inception, elaboration,
construction, and transition.
Inception identifies project scope, requirements (functional and non-functional) and risks at a high
level but in enough detail that work can be estimated.
Elaboration delivers a working architecture that mitigates the top risks and fulfills the non-
functional requirements.
Construction incrementally fills-in the architecture with production-ready code produced from
analysis, design, implementation, and testing of the functional requirements.
Transition delivers the system into the production operating environment.

2.5. ER-Diagram

Introduction: -
In software engineering, an entity-relationship model (ERM) is an abstract and conceptual
representation of data. Entity-relationship modeling is a database modelingmethod, used to produce a
type of conceptual schema or semantic data model of a system, often a relational database, and its
requirements in a top-down fashion. Diagrams created by this process are called entity-relationship
diagrams, ER diagrams, or ERDs. ER Diagrams depicts relationship between data objects. The

21 Ltd. Lucknow (U.P)


DigiCoders Technologies Pvt.
attribute

22 Ltd. Lucknow (U.P)


DigiCoders Technologies Pvt.
of each data objects noted in the entity-relationship diagram can be described using a data object
description. Entity relationship diagram is very basic, conceptual model of data and it is fundamental
to the physical database design. This analysis is then used to organize data as relations, normalizing
relations, and obtaining a Relationaldatabase.
The entity-relationship model for data uses three features to describe data. Theseare:
1. Entities which specify distinct real-world items in anapplication.

2. Relationship, which connect entities and represent meaningful dependencies betweenthem.

3. Attributes which specify properties of entities &relationships.

E-R Diagram

23 Ltd. Lucknow (U.P)


DigiCoders Technologies Pvt.
2.6. Data Flow Diagram

Introduction:-
DFD is an acronym for the word Data Flow Diagram. DFD is a pictorial representation of the system.
DFD is a graphical representation of the flow of data through the information system. DFD are also
used for the visualization of data processing (structured design). ADFD provides no information about
the timings of the process, or about whether process will operate in parallel or sequence. DFD is an
important technique for modeling system’s high-level detail by showing how input data is transformed
to output results through a sequence of functional transformations. DFD reveal relationships among
between the various components in a program or system. The strength of DFD lies in the fact that
using few symbols we are able to express program design in an easier manner. ADFD can be used to
represent the following:-

External Entity sending and receiving data. Process that change the data.
Flow of data within the system. Data Storage locations.

Uses of DFD:-
The main uses of data flow diagrams are as follows: -
DFD is a method of choice for representation of showing of information through a system because of
the following reasons:-

DFDs are easier to understand by technical and non-technical audiences.


DFDs can provide a high level system overview, complete with boundaries and connections to
other system.
DFDs can provide a detailed representation of system components.

0. Level DFD

24 Ltd. Lucknow (U.P)


DigiCoders Technologies Pvt.
1. Level DFD:

25 Ltd. Lucknow (U.P)


DigiCoders Technologies Pvt.
3. SOFTWARE HARWARE REQUIREMENT SPECIFICATION
A requirements specification for a software system is a complete description of the behavior of a
system to be developed and it includes a set of use cases that describe all the interactions the users will
have with the software. In addition to use cases, the SRS also contains non-functional requirements.

Non-functional requirements are requirements which impose constraints on the design or


implementation (such as performance engineering requirements, quality standards, or design
constraints).Requirements are a sub-field of software engineering that deals with the elicitation,
analysis, specification, and validation of requirements for software.

The software requirement specification document enlists all necessary requirements for project
development. To derive the requirements we need to have clear and thorough understanding of the
products to be developed. This is prepared after detailed communications with project team and the
customer.

3.1. Hardware Requirement:

 Microsoft Windows 7/8/10 (32 or 64 bit)


 2 GB RAM minimum, 8 GB recommended
 2 GB of available disk space minimum, 4 GB recommended (500 MB for IDE + 1.5
for Android SDK and emulator system image)
 1280 x 800 minimum screen resolution
 Graphics - none (Integrated graphics 64MB)
 250GB SSD (the main reason for a laptop to run as fast as light)

3.2. Server side Software Requirement:


 Java Development Kit (JDK) 8
 Android Studio | 2020.3.1
 Firebase Database

3.3. Client side Hardware requirements:


 A fast speed USB cable
 Android Phone for Testing (Version 11 / 10 / 9)

26 Ltd. Lucknow (U.P)


DigiCoders Technologies Pvt.
To develop this project the various Software resources are used:
o Front End : XML
o Back End : Firebase Browser Based
o Technology : Android
o Code-Behind Language : Java
o IDE : Android Studio

3.4. SUPPORT AND MAINTENANCE:-

One year free support for rectifying system bugs including front end and beck end will be provided.
During warranty period Software Engineers will be responsible for removing bugs and improving it.
After one year support can be extended @ 20% of the total product deployment cost.

4. SYSTEM DESIGN APPROACH

4.1. Top – Down designing:

The top - down designing approach started with major components of the system. It is a stepwise
refinement which starts from an abstract design, in each steps the design is refined two or more
concrete levels until we reach a level where no – more refinement is possible or not needed.

4.2. Bottom – Up designing:

In bottom – up designing the most basic and primitive components are designed first, and we proceed
to higher level components. We work with layers of abstractions and abstraction are implemented until
the stage is reached where the operations supported by the layer is complete.

27 Ltd. Lucknow (U.P)


DigiCoders Technologies Pvt.
4.3. Following Approach:

In this project we are following Mixed Approach i.e. A combination of top – down and bottom – up.
We are developing some of the components using top – down designing approach (e.g. the WebPages)
and the some components in bottom – up designing approach (e.g. the middle tier classes)

28 Ltd. Lucknow (U.P)


DigiCoders Technologies Pvt.
5. CONFIGURATION DESIGN(manifest.xml)

MessageList Adapter.java
package com.example.tptchatroom.Adapter;

import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import android.widget.Toast;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import com.example.tptchatroom.MessageDetail;
import com.example.tptchatroom.R;
import com.example.tptchatroom.model.messagemodel;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.database.FirebaseDatabase;

import java.util.ArrayList;

public class MessageListAdapter extends RecyclerView.Adapter {


Context context;
ArrayList<messagemodel> msglist;
String senderreceiver;
29 Ltd. Lucknow (U.P)
DigiCoders Technologies Pvt.
public MessageListAdapter(Context context, ArrayList<messagemodel> msglist, String
senderreceiver) {
this.context = context;
this.msglist = msglist;
this.senderreceiver=senderreceiver;
}

// public MessageListAdapter(MessageDetail context, ArrayList<messagemodel> msglist)


{}

@NonNull
@Override
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int
viewType) {
if (viewType == 1) {
View v = LayoutInflater.from(context).inflate(R.layout.sendersimpldesegin,
parent, false);
return new SenderViewHolder(v);
} else {
View v = LayoutInflater.from(context).inflate(R.layout.receviersimpledegin,
parent, false);
return new ReceiverViewHolder(v);

}
@Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
if (holder.getClass() == SenderViewHolder.class) {
((SenderViewHolder) holder).sendermsg.setText(msglist.get(position).msg);
((SenderViewHolder)
holder).sendermsgtime.setText(msglist.get(position).msgtime);
}
else {
((ReceiverViewHolder) holder).receivermsg.setText(msglist.get(position).msg);
((ReceiverViewHolder)
holder).receivermsgtime.setText(msglist.get(position).msgtime);
}

holder.itemView.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View view) {
AlertDialog.Builder alert=new AlertDialog.Builder(context);
alert.setTitle("Delete Message");
alert.setMessage("Do You Want To Delete the Message");
alert.setPositiveButton("yes", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
//Toast.makeText(context,senderreceiver ,
Toast.LENGTH_SHORT).show();
// Toast.makeText(context, "msglist".get,
Toast.LENGTH_SHORT).show();

30 Ltd. Lucknow (U.P)


DigiCoders Technologies Pvt.
FirebaseDatabase.getInstance().getReference().child("message").child( senderreceiver).child(msgli
st.get(holder.getAdapterPosition()).messagekey).setValue(null)
;
}
});
alert.setNegativeButton("no", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
dialogInterface.dismiss();
}
});
alert.show();
return false;
}
});
}

@Override
public int getItemViewType(int position) {

if(msglist.get(position).senderid.equals(FirebaseAuth.getInstance().getCurrentUser().getU
id()))
return 1;
else
return 2;
}

@Override
public int getItemCount() {
return msglist.size();
}

//refernce of sender message and sender message time Textview from sendermsgsample
class SenderViewHolder extends RecyclerView.ViewHolder
{
TextView sendermsg,sendermsgtime;
public SenderViewHolder(@NonNull View itemView) {
super(itemView);
sendermsg=itemView.findViewById(R.id.sendermsg);
sendermsgtime=itemView.findViewById(R.id.sendermsgtime);
}
}
class ReceiverViewHolder extends RecyclerView.ViewHolder
{
TextView receivermsg,receivermsgtime;
public ReceiverViewHolder(@NonNull View itemView) {
super(itemView);
receivermsg=itemView.findViewById(R.id.receivermsg);
receivermsgtime=itemView.findViewById(R.id.receivermsgtime);
}
}
}
31 Ltd. Lucknow (U.P)
DigiCoders Technologies Pvt.
StatusListAdapter.java
package com.example.tptchatroom.Adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import com.example.tptchatroom.ChatFragment;
import com.example.tptchatroom.R;
import com.example.tptchatroom.chatRoom;
import com.example.tptchatroom.model.statusmodel;
import com.example.tptchatroom.model.statusmodel;
import com.devlomi.circularstatusview.CircularStatusView;
import com.example.tptchatroom.model.statusmodel;
import com.squareup.picasso.Picasso;

import java.util.ArrayList;

import omari.hamza.storyview.StoryView;
import omari.hamza.storyview.callback.StoryClickListeners;
import omari.hamza.storyview.model.MyStory;

public class StatusListAdapter extends


RecyclerView.Adapter<StatusListAdapter.ViewHolder>{ Conte
xt context;
ArrayList<statusmodel> statuslist;

public StatusListAdapter(Context context) {


this.context = context;
}

public StatusListAdapter(Context context, ArrayList<statusmodel> statuslist) {


this.context = context;
this.statuslist = statuslist;
}

@NonNull
@Override
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View v= LayoutInflater.from(context).
inflate(R.layout.statussampledesign,parent,false);
return new ViewHolder(v);
}

@Override
public void onBindViewHolder(@NonNull ViewHolder holder,int position) {
32 Ltd. Lucknow (U.P)
DigiCoders Technologies Pvt.
holder.statususername.setText(statuslist.get(position).username);
holder.statususertime.setText(statuslist.get(position).statusdate);
holder.circularstatus.setPortionsCount(statuslist.get(position).status.size()); int
statussize=statuslist.get(position).status.size();
Picasso.get().load(statuslist.get(position).status.get(statussize-
1)).placeholder(R.drawable.user).
into(holder.statususerimg);
//show stories on click of user status icon
holder.statususerimg.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {

ArrayList<MyStory> myStories = new ArrayList<>();

for(String story: statuslist.get(position).status){


myStories.add(new MyStory(
story
));
}
new StoryView.Builder(((chatRoom) context).getSupportFragmentManager())
.setStoriesList(myStories) // Required
.setStoryDuration(5000) // Default is 2000 Millis (2 Seconds)
.setTitleText(statuslist.get(position).username) // Default is
Hidden
.setSubtitleText(statuslist.get(position).statusdate) // Default
is Hidden
.setTitleLogoUrl(statuslist.get(position).status.get(statussize-
1))
.setStoryClickListeners(new StoryClickListeners() {
@Override
public void onDescriptionClickListener(int position) {
//your action
}

@Override
public void onTitleIconClickListener(int position) {
//your action
}
}) // Optional Listeners
.build() // Must be called before calling show method
.show();

}
});
}

@Override
public int getItemCount() {
return statuslist.size();
}

class ViewHolder extends RecyclerView.ViewHolder


{
TextView statususername,statususertime;
CircularStatusView circularstatus;
ImageView statususerimg;
public ViewHolder(@NonNull View itemView) {
super(itemView);
33 Ltd. Lucknow (U.P)
DigiCoders Technologies Pvt.
statususername=itemView.findViewById(R.id.statususername);
statususertime=itemView.findViewById(R.id.statususertime);
circularstatus=itemView.findViewById(R.id.circular_status_view);
statususerimg=itemView.findViewById(R.id.statususerimg);
}
}
}

UserList.Adapter.java
package com.example.tptchatroom.Adapter;

import android.content.Context;
import android.content.Intent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import com.example.tptchatroom.MessageDetail;
import com.example.tptchatroom.R;
import com.example.tptchatroom.model.Usermodel;
import com.squareup.picasso.Picasso;

import java.util.ArrayList;

public class UserListAdapter extends RecyclerView.Adapter<UserListAdapter.ViewHolder>{


Context context;
ArrayList<Usermodel> list;
ImageView userprofilepic;
TextView username,userlastmsg;
public UserListAdapter(Context context, ArrayList<Usermodel> list)
{
this.context=context;
this.list=list;

@NonNull
@Override
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View v=LayoutInflater.from(context).inflate(R.layout.sampleuserdesign,parent,false);
return new ViewHolder(v);
}

@Override
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
Usermodel user=list.get(position);
username.setText(user.name);
34 Ltd. Lucknow (U.P)
DigiCoders Technologies Pvt.
userlastmsg.setText(user.email);
Picasso.get().load(user.profilepic).placeholder
(R.drawable.ic_baseline_account_circle_24).into(userprofilepic);

holder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent=new Intent(context, MessageDetail.class);
intent.putExtra("name",user.name);
intent.putExtra("uid",user.uid);
intent.putExtra("profilpic",user.profilepic);
context.startActivity(intent);
}
});
}

@Override
public int getItemCount() {

return list.size();
}

class ViewHolder extends RecyclerView.ViewHolder


{
public ViewHolder(@NonNull View itemView) {

super(itemView);
userprofilepic=itemView.findViewById(R.id.userprofiepic);
username=itemView.findViewById(R.id.username);
userlastmsg=itemView.findViewById(R.id.userlastmsg);
}
}
}

Chat menu.xml
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:title="Setting"
android:id="@+id/menu_setting"></item>
<item android:title="Logout"
android:id="@+id/menu_logout"></item>

</menu>

Manifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"

35 Ltd. Lucknow (U.P)


DigiCoders Technologies Pvt.
xmlns:tools="http://schemas.android.com/tools"
package="com.example.tptchatroom">

<application
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@drawable/app1"
android:label="CHAT NOW"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.TPTCHATROOM"
tools:targetApi="31">
<activity
android:name=".MessageDetail"
android:exported="false" />
<activity
android:name=".chatRoom"
android:exported="false" />
<activity
android:name=".MainActivity"
android:exported="false" />
<activity
android:name=".SignIn"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

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


</intent-filter>
</activity>
</application>

</manifest>

Color.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="purple_200">#21a6a5</color>
<color name="purple_500">#21a6a5</color>
<color name="purple_700">#21a6a5</color>
<color name="green">#21a6a5</color>
<color name="teal_200">#FF03DAC5</color>
<color name="darkgreen">#ff018786</color>
<color name="teal_700">#FF018786</color>
<color name="black">#FF000000</color>
<color name="white">#FFFFFFFF</color>
</resources>

Strings.xml

36 Ltd. Lucknow (U.P)


DigiCoders Technologies Pvt.
<resources>
<string name="app_name">TPTCHATROOM</string>
<!-- TODO: Remove or change this placeholder text -->
<string name="hello_blank_fragment">Hello blank fragment</string>
</resources>

Themes.xml
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Theme.TPTCHATROOM"
parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<!-- Primary brand color. -->
<item name="colorPrimary">@color/green</item>
<item name="colorPrimaryVariant">@color/darkgreen</item>
<item name="colorOnPrimary">@color/white</item>
<!-- Secondary brand color. -->
<item name="colorSecondary">@color/teal_200</item>
<item name="colorSecondaryVariant">@color/teal_700</item>
<item name="colorOnSecondary">@color/black</item>
<!-- Status bar color. -->
<item name="android:statusBarColor"
tools:targetApi="l">?attr/colorPrimaryVariant</item>
<!-- Customize your theme here. -->
</style>
<style name="roundborder" parent="">
<item name="cornerFamily">rounded</item>
<item name="cornerSize">20dp</item>
<item name="color">@color/black</item>
</style>
</resources>

6. DATA MODELING
6.1 List of Table
37 Ltd. Lucknow (U.P)
DigiCoders Technologies Pvt.
1. RealTime Database
2. Message Table
3. Story Table
4. User Table

6.2 Structure of Table

6.2.1 SCREENSHOT OF FIREBASE REALTIME DATABASE

38 Ltd. Lucknow (U.P)


DigiCoders Technologies Pvt.
6.2.2 Message Table

6.2.3 Story Table

39 Ltd. Lucknow (U.P)


DigiCoders Technologies Pvt.
6.2.4 User Table

40 Ltd. Lucknow (U.P)


DigiCoders Technologies Pvt.
7. TESTING
Testing is the integral part of any System Development Life Cycle insufficient and interested
application tends to crash and result in loss of economic and manpower investment besides user’s
dissatisfaction and downfall of reputation.

“Software Testing can be looked upon as one among much process, an organization performs, and that
provides the last opportunity to correct any flaws in the developed system. Software Testing includes
selecting test data that have more probability of giving errors.” The first step in System testing is to
develop the plan that all aspect of system .Complements, Correctness, Reliability and Maintainability.
Software is to be tested for the best quality assurance, an assurance that system meets the specification
and requirement for its intended use and performance.
System Testing is the most useful practical process of executing the program with the implicit
intention of finding errors that makes the programfail.

Types of Testing:

Black Box (Functional) Testing:

Testing against specification of system or component. Study it by examining its inputs and related
outputs. Key is to devise inputs that have a higher likelihood of causing outputs that reveal the
presence of defects. Use experience and knowledge of domain to identify such test cases. Failing this a
systematic approach may be necessary. Equivalence partitioning is where the input to a program falls
into a number of classes,

41 Ltd. Lucknow (U.P)


DigiCoders Technologies Pvt.
e.g. positive numbers vs. negative numbers. Programs normally behave the same way for each member
of a class. Partitions exist for both input and output. Partitions may be discrete or overlap. Invalid data
(i.e. outside the normal partitions) is one or more partitions that should be tested.
Internal System design is not considered in this type of testing. Tests are based on requirements
andfunctionality.
This type of test case design method focuses on the functional requirements of the software, ignoring
the control structure of the program. Black box testing attempts to find errors in the following
categories:

 Incorrect or missing functions.

 Interface errors.

 Errors in data structures or external database access.

 Performance errors.

 Initialization and termination errors.

White Box (Structural) Testing:

Testing based on knowledge of the structure of component (e.g. by looking at source code). The
advantage is that structure of the code can be used to find out how many test cases need to be
performed. Knowledge of the algorithm (examination of the code) can be used to identify the
equivalence partitions. Path testing is where the tester aims to exercise every independent execution
path through the component. All conditional statements were tested for both true and false cases.

42 Ltd. Lucknow (U.P)


DigiCoders Technologies Pvt.
program units than large ones. Flow graphs are a pictorial representation of the paths of control
through a program (ignoring assignments, procedure calls and I/O statements). Use flow graph to
design test cases that execute each path. Static tools may be used to make this easier in programs that
have a complex branching structure. Tools support. Dynamic program analysers instrument a program
with additional code. Typically this will count how many times each statement is executed. At end
print out report showing which statements have and have not been executed. Problems with flow graph
derived testing:
 Data complexity could not take intoaccount.
 We cannot test all paths incombination.
 In really only possible at unit and module testing stages because beyond that complexity is
toohigh.
This testing is based on knowledge of the internal logic of an application’s code. Also known as a
Glass Box Testing .Internal software and code working should be known for this type of testing. Tests
are based on coverage of code statements, branches, paths, conditions.

Unit Testing:

Unit testing concentrates on each unit of the software as implemented in the code. This is done to
check syntax and logical errors in programs. At this stage, the test focuses on each module
individually, assuring that it functions properly as a unit. In our case, we used extensive white-box
testing at the unit testing stage.
A developer and his team typically do the unit testing do the unit testing is done in parallel with
coding; it includes testing each function and procedure.

Incremental Integration Testing:

Bottom up approach for testing i.e. continuous testing of an application as new functionality is
added; Application functionality and modules should be independent enough to test separately done
by programmers or by testers.

43 Ltd. Lucknow (U.P)


DigiCoders Technologies Pvt.
Integration Testing:

Testing of integration modules to verify combined functionality after integration


.Modules are typically code modules, individual applications, client and server and distributed
systems.

FunctionalTesting:

This type of testing ignores the internal parts and focus on the output is as per requirement or not
.Black box type testing geared to functionality requirements of an application.

System Testing:

Entire system is tested as per the requirements. Black box type test that is based on overall requirement
specifications covers all combined parts of a system.

End-to-End Testing:

Similar to system testing ,involves testing of a complete application environment in a situation that
mimics real-world use, such as interacting with a database ,using network communications, or
interacting with hardware, applications, or system if appropriate.

Regression Testing:

Testing the application as a whole for the modification in any module or


functionality.Difficult to cover all the system in regression testing so typically automation tools are
used for these testing types.

44 Ltd. Lucknow (U.P)


DigiCoders Technologies Pvt.
Acceptance Testing:

Normally this type of testing is done to verify if system meets the customer specified requirements.
User or customers do this testing to determine whether to accept application.

Performance Testing:

Term often used interchangeably with “stress” and “load” testing, To check whether system meets
performance requirements, Used different performance and load tools to do this.

Alpha Testing:

In house virtual user environment can be created for this type of testing. Testing is done at the end of
development .Still minor design changes may be made as a result of such testing.

Beta Testing:

Testing typically done by end-users or others. This is final testing before releasing application for
commercial purpose.

45 Ltd. Lucknow (U.P)


DigiCoders Technologies Pvt.
8. Input Output Forms
8.1 Project screenshot

46 Ltd. Lucknow (U.P)


DigiCoders Technologies Pvt.
47 Ltd. Lucknow (U.P)
DigiCoders Technologies Pvt.
48 Ltd. Lucknow (U.P)
DigiCoders Technologies Pvt.
49 Ltd. Lucknow (U.P)
DigiCoders Technologies Pvt.
50 Ltd. Lucknow (U.P)
DigiCoders Technologies Pvt.
51 Ltd. Lucknow (U.P)
DigiCoders Technologies Pvt.
52 Ltd. Lucknow (U.P)
DigiCoders Technologies Pvt.
8.2 Project Coding (XML & Java)
activity_chat.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".chatRoom"
android:orientation="vertical"
android:background="@drawable/chitchat2">

<com.google.android.material.tabs.TabLayout
android:id="@+id/chattab"
android:layout_width="match_parent"
android:layout_height="50sp"
android:background="@color/purple_700"
app:tabTextColor="@color/black"
app:tabSelectedTextColor="@color/black"
app:tabIndicator="@color/white"
app:tabIndicatorHeight="2sp"
android:elevation="5sp"
>
<com.google.android.material.tabs.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Chat" />

<com.google.android.material.tabs.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="stories" />

<com.google.android.material.tabs.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="profile" />
</com.google.android.material.tabs.TabLayout>
<!--View pager to hold fragments-->
<androidx.viewpager2.widget.ViewPager2
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/viewpager">
</androidx.viewpager2.widget.ViewPager2>

</LinearLayout>

ChatActivity.java
package com.example.tptchatroom;

import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
53 Ltd. Lucknow (U.P)
DigiCoders Technologies Pvt.
import androidx.viewpager2.widget.ViewPager2;

import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;

import com.google.android.material.tabs.TabLayout;
import com.google.firebase.auth.FirebaseAuth;

public class chatRoom extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_chat_room);

//lets display email id of a current user in action bar


FirebaseAuth auth=FirebaseAuth.getInstance();
String email=auth.getCurrentUser().getEmail();
getSupportActionBar().setTitle("New whatsapp");

//bind FragmentstateAdapter to the Viewpager


ViewPager2 view = findViewById(R.id.viewpager);
ChatFragmentAdapter adapter = new ChatFragmentAdapter
(getSupportFragmentManager(), getLifecycle());
view.setAdapter(adapter);

//replace viewpager position on change of tabs


TabLayout Tab=findViewById(R.id.chattab);
Tab.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
@Override
public void onTabSelected(TabLayout.Tab tab) {

view.setCurrentItem(tab.getPosition());
}

@Override
public void onTabUnselected(TabLayout.Tab tab) {

@Override
public void onTabReselected(TabLayout.Tab tab) {

}
});
//change position oftab or chnge of viewpager position
view.registerOnPageChangeCallback(new ViewPager2.OnPageChangeCallback() {
@Override
public void onPageScrolled(int position, float positionOffset, int
positionOffsetPixels) {
super.onPageScrolled(position, positionOffset, positionOffsetPixels);
Tab.getTabAt(position).select();
}
});
54 Ltd. Lucknow (U.P)
DigiCoders Technologies Pvt.
}

@Override
protected void onStart() {
super.onStart();
FirebaseAuth auth=FirebaseAuth.getInstance();
if(auth.getCurrentUser()==null)
{
Intent i=new Intent(this,SignIn.class);startActivity(i);
}
}
//lets bind option menu in this activity

@Override
public boolean onCreateOptionsMenu(@NonNull Menu menu) {
getMenuInflater().inflate(R.menu.chat_menu, menu);
return super.onCreateOptionsMenu(menu);
}
@Override
public boolean onOptionsItemSelected(@NonNull MenuItem item){
switch (item.getItemId())
{
case R.id.menu_setting:
break;
case R.id.menu_logout:
FirebaseAuth auth= FirebaseAuth.getInstance();
auth.signOut();
Intent intent=new Intent(this,SignIn.class);
startActivity(intent);
break;
}
return super.onOptionsItemSelected(item);
}
}

activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity"
android:orientation="vertical"
android:background="@drawable/chitchat2"
android:padding="20sp"
android:paddingTop="50sp">
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
55 Ltd. Lucknow (U.P)
DigiCoders Technologies Pvt.
android:layout_height="match_parent"
android:orientation="vertical">

<ImageView
android:layout_width="120sp"
android:layout_height="120sp"
android:src="@drawable/what"
android:layout_gravity="center"
android:layout_marginTop="80sp"></ImageView>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Whatsapp"
android:textSize="26sp"
android:fontFamily="cursive"
android:layout_marginTop="10sp"
android:gravity="center"
android:textStyle="bold"
android:textColor="@color/white"></TextView>

<EditText
android:layout_width="match_parent"
android:layout_height="40sp"
android:layout_marginTop="15sp"
android:hint="your name..."
android:background="@drawable/textcolor"
android:id="@+id/txtname"
android:paddingLeft="10dp"
android:textColorHint="@color/black"></EditText>
<EditText
android:layout_width="match_parent"
android:layout_height="40sp"
android:layout_marginTop="15sp"
android:hint="your email.."
android:background="@drawable/textcolor"
android:id="@+id/txtemail"
android:paddingLeft="10dp"
android:textColorHint="@color/black"></EditText>
<EditText
android:layout_width="match_parent"
android:layout_height="40sp"
android:layout_marginTop="15sp"
android:hint="Password"
android:background="@drawable/textcolor"
android:id="@+id/pass"
android:paddingLeft="10dp"
android:textColorHint="@color/black"></EditText>
<TextView
android:layout_width="150dp"
android:layout_height="wrap_content"
android:text="Already have account?"
android:gravity="center"
android:layout_margin="10sp"
android:layout_gravity="center"
android:textStyle="bold"
android:background="@drawable/passwordbg"
android:textColor="@color/black"
android:onClick="openSignIn"></TextView>
56 Ltd. Lucknow (U.P)
DigiCoders Technologies Pvt.
<Button
android:layout_width="100sp"
android:layout_height="wrap_content"
android:padding="10sp"
android:text="Sign UP"
android:background="@drawable/textcolor"
android:id="@+id/btnregister"
android:layout_gravity="center"
android:shadowColor="@color/white"></Button>
</LinearLayout>

</ScrollView>
</LinearLayout>

MainActivity.java
package com.example.tptchatroom;

import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;

import android.app.ProgressDialog;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.AuthResult;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.database.FirebaseDatabase;

import java.util.Calendar;
import java.util.HashMap;

public class MainActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//create a progree dialog
ProgressDialog pr=new ProgressDialog(this);
pr.setTitle("please wait..");
pr.setMessage("we are creating your account");
// get refernce of all element

EditText txtname=findViewById(R.id.txtname);
EditText txtemail=findViewById(R.id.txtemail);
EditText txtpass=findViewById(R.id.pass);
Button btn=findViewById(R.id.btnregister);
//click event of button
btn.setOnClickListener(new View.OnClickListener() {

57 Ltd. Lucknow (U.P)


DigiCoders Technologies Pvt.
@Override
public void onClick(View view) {
//show the progree dialogue at activity
pr.show();
FirebaseAuth auth= FirebaseAuth.getInstance();
auth.createUserWithEmailAndPassword(txtemail.getText().toString(),
txtpass.getText().toString()).addOnCompleteListener(new
OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
pr.dismiss();
if(task.isSuccessful())
{
String id=task.getResult().getUser().getUid();
HashMap<String,String>hashMap=new HashMap<>();
hashMap.put("name",txtname.getText().toString());
hashMap.put("email",txtemail.getText().toString());
hashMap.put("password",txtpass.getText().toString());
Calendar firebaseDatabase;

FirebaseDatabase.getInstance().getReference().child("user").child(id).setValue(hashMap);
Toast.makeText(MainActivity.this, "Account Created
Successfully", Toast.LENGTH_SHORT).show();
Intent intent=new Intent(MainActivity.this,SignIn.class);
startActivity(intent);
}
else
{
Toast.makeText(MainActivity.this,
task.getException().getMessage()+"", Toast.LENGTH_LONG).show();
}

}
});
}
});

//redirect to Login onclick of create new account


public void openSignIn(View v)
{
Intent i=new Intent(this,SignIn.class);
startActivity(i);
}

Activity_sign_in.xml

58 Ltd. Lucknow (U.P)


DigiCoders Technologies Pvt.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".SignIn"
android:orientation="vertical"
android:padding="20sp"
android:background="@drawable/chitchat2">

<ScrollView
android:layout_width="match_parent"
android:layout_height="700dp">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
>

<ImageView
android:layout_width="120sp"
android:layout_height="150sp"
android:layout_marginVertical="10dp"
android:layout_marginTop="100sp"
android:layout_gravity="center"
android:layout_marginHorizontal="108dp"
android:src="@drawable/what"></ImageView>

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="cursive"
android:gravity="center"
android:text="Let's Talk"
android:textSize="30sp"
android:textStyle="italic"
android:textColor="@color/white"
android:layout_marginBottom="30dp"></TextView>

<EditText
android:id="@+id/txtemail"
android:layout_width="match_parent"
android:layout_height="40sp"
android:layout_marginTop="15sp"
android:background="@drawable/textcolor"
android:hint="Your Email.."
android:paddingLeft="10dp"
android:textStyle="bold"
android:textColorHint="@color/black"
android:textColor="@color/white"></EditText>

<EditText
android:id="@+id/pass"
android:layout_width="match_parent"
59 Ltd. Lucknow (U.P)
DigiCoders Technologies Pvt.
android:layout_height="40sp"
android:layout_marginTop="30sp"
android:background="@drawable/textcolor"
android:hint="Password"
android:textStyle="bold"
android:paddingLeft="10dp"
android:inputType="textPassword"
android:textColorHint="@color/black"
android:textColor="@color/white"></EditText>

<TextView
android:layout_width="80dp"
android:layout_height="wrap_content"
android:layout_margin="20sp"
android:layout_marginTop="300dp"
android:gravity="center"
android:layout_gravity="center"
android:background="@drawable/textcolor"
android:text="New User"
android:textColor="@color/black"
android:textStyle="bold"
android:onClick="openSignIn"></TextView>

<Button
android:layout_width="100sp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:id="@+id/button_sign"
android:padding="15sp"
android:background="@drawable/textcolor"
android:text="Sign In"
android:layout_marginTop="50dp"
android:layout_marginRight="80dp"></Button>
</LinearLayout>

</ScrollView>
</LinearLayout>

SignInActivity.java
package com.example.tptchatroom;

import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.AuthResult;
import com.google.firebase.auth.FirebaseAuth;
60 Ltd. Lucknow (U.P)
DigiCoders Technologies Pvt.
import com.google.firebase.database.FirebaseDatabase;

import java.util.Calendar;
import java.util.HashMap;

public class SignIn extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_sign_in);
//get reference of all element
EditText txtemail = findViewById(R.id.txtemail);
EditText txtpass = findViewById(R.id.pass);
Button btnsignin = findViewById(R.id.button_sign);
//create onclicklistener of button signin
btnsignin.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
//show the progree dialogue at activity

FirebaseAuth auth= FirebaseAuth.getInstance();


auth.signInWithEmailAndPassword(txtemail.getText().toString(),
txtpass.getText().toString()).addOnCompleteListener(new
OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {

if(task.isSuccessful())
{
//Toast.makeText(SignIn.this, "welcome",
Toast.LENGTH_SHORT).show();
Intent intent=new Intent(SignIn.this,chatRoom.class);
startActivity(intent);
}
else
{
//Toast.makeText(SignIn.this,
task.getException().getMessage()+"", Toast.LENGTH_LONG).show();
}

}
});
}
});
}

public void openSignIn(View v) {


Intent i = new Intent(this, MainActivity.class);
startActivity(i);
}

Fragment_stories.xml
61 Ltd. Lucknow (U.P)
DigiCoders Technologies Pvt.
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".StoriesFragment">

<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="@drawable/chitchat2"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="100dp"
android:orientation="horizontal"
android:padding="10sp"
android:id="@+id/addstory"
>
<ImageView
android:layout_width="45sp"
android:layout_height="45sp"
android:src="@drawable/ic_baseline_update_24"
android:id="@+id/addstory"
></ImageView>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginLeft="5dp"
android:textColor="@color/white"
android:textSize="30sp"
android:textStyle="normal"
android:text="Update Story"></TextView>
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/storyrecycle"></androidx.recyclerview.widget.RecyclerView>

</LinearLayout>

</FrameLayout>

StoriesFragment.java
package com.example.tptchatroom;

import android.content.Intent;
import android.icu.text.SimpleDateFormat;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
62 Ltd. Lucknow (U.P)
DigiCoders Technologies Pvt.
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.Toast;

import com.example.tptchatroom.Adapter.StatusListAdapter;
import com.example.tptchatroom.model.statusmodel;
import com.google.android.gms.tasks.OnSuccessListener;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;
import com.google.firebase.storage.FirebaseStorage;
import com.google.firebase.storage.StorageReference;
import com.google.firebase.storage.UploadTask;

import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Random;

public class StoriesFragment extends Fragment {

public StoriesFragment() {
// Required empty public constructor
}

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View v= inflater.inflate(R.layout.fragment_stories, container, false);
//let's add story of user to firebase
LinearLayout layout=v.findViewById(R.id.addstory);
layout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.setType("image/*");
startActivityForResult(intent, 2);
}
});
//select all stories and bind in Recyclerview
ArrayList<statusmodel> statuslist=new ArrayList<statusmodel>();
RecyclerView statusrecycler=v.findViewById(R.id.storyrecycle);
StatusListAdapter adapter=new StatusListAdapter(getContext(),statuslist);
63 Ltd. Lucknow (U.P)
DigiCoders Technologies Pvt.
statusrecycler.setAdapter(adapter);
statusrecycler.setLayoutManager(new LinearLayoutManager(getContext()));

FirebaseDatabase.getInstance().getReference().child("story").addValueEventListener(new
ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot snapshot) {
statuslist.clear();
for (DataSnapshot ds : snapshot.getChildren())
{
statusmodel s=new statusmodel();
s.username=ds.child("name").getValue(String.class);
s.statusdate=ds.child("date").getValue(String.class);
ArrayList<String> status=new ArrayList<>();
for (DataSnapshot spic : ds.child("status").getChildren())
{
status.add(spic.child("pic").getValue(String.class));
}
s.status=status;
statuslist.add(s);
}

Toast.makeText(getContext(), ""+statuslist.size(),
Toast.LENGTH_SHORT).show();
adapter.notifyDataSetChanged();
}

@Override
public void onCancelled(@NonNull DatabaseError error) {

}
});

return v;
}

@Override
public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data)
{
super.onActivityResult(requestCode, resultCode, data);
Uri img=data.getData();
Random r=new Random();
int random=r.nextInt();
StorageReference ref=FirebaseStorage.getInstance().getReference().
child("story").child(FirebaseAuth.getInstance().getUid()+random);
ref.putFile(img).addOnSuccessListener(new
OnSuccessListener<UploadTask.TaskSnapshot>() {
@Override
public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {
try {
taskSnapshot.getStorage().getDownloadUrl().addOnSuccessListener(new
OnSuccessListener<Uri>() {
@Override
public void onSuccess(Uri uri) {
String status = uri.toString();

64 Ltd. Lucknow (U.P)


DigiCoders Technologies Pvt.
FirebaseDatabase.getInstance().getReference().child("user").child(FirebaseAuth.getInstanc
e().getUid()).
addListenerForSingleValueEvent(new
ValueEventListener() {
@RequiresApi(api = Build.VERSION_CODES.N)
@Override
public void onDataChange(@NonNull DataSnapshot
snapshot) {
String username =
snapshot.child("name").getValue(String.class);
//save data of status to the story table
HashMap<String, Object> userdata = new
HashMap<>();
userdata.put("name", username);
SimpleDateFormat df = new
SimpleDateFormat("hh:mm aa");
Date d = new Date();
userdata.put("date", df.format(d));

HashMap<String, Object> statusdata = new


HashMap<>();
statusdata.put("pic", status);

FirebaseDatabase.getInstance().getReference().child("story").

child(FirebaseAuth.getInstance().getUid()).updateChildren(userdata);

FirebaseDatabase.getInstance().getReference().child("story").

child(FirebaseAuth.getInstance().getUid()).child("status").push().setValue(statusdata);

Toast.makeText(getContext(), "Story Updated",


Toast.LENGTH_LONG).show();
}

@Override
public void onCancelled(@NonNull DatabaseError
error) {
}
});
}
});

}
catch (Exception ex)
{
Toast.makeText(getContext(),"Error"
+ex.getMessage(),Toast.LENGTH_LONG).show();
}

}
});
}
}

65 Ltd. Lucknow (U.P)


DigiCoders Technologies Pvt.
Activity_message_detail.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=".MessageDetail" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="70sp"
android:orientation="horizontal"
android:background="@color/purple_700"
android:gravity="center_vertical"
android:padding="10sp"
android:id="@+id/linear1">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_baseline_arrow_back_24"
android:id="@+id/btnback">
</ImageView>
<de.hdodenhof.circleimageview.CircleImageView
android:layout_width="50sp"
android:layout_height="50sp"
android:src="@drawable/tulip"
app:civ_border_color="@color/black"
android:padding="5sp"
android:id="@+id/userprofile">

</de.hdodenhof.circleimageview.CircleImageView>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/username"
android:text="Akanksha Giri"
android:textColor="@color/white"
android:textSize="22sp">

</TextView>
</LinearLayout>

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclemsg"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/linear2"
android:layout_below="@+id/linear1"
android:background="@drawable/chitchat2">

</androidx.recyclerview.widget.RecyclerView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_alignParentBottom="true"
android:id="@+id/linear2">

66 Ltd. Lucknow (U.P)


DigiCoders Technologies Pvt.
<EditText
android:layout_width="0sp"
android:layout_height="50sp"
android:background="@drawable/reccivermsgbg"
android:layout_weight="6"
android:id="@+id/usermsg"
android:textColorHint="@color/white"
android:textColor="@color/white"
android:hint="Type msg here.. . .">
</EditText>
<de.hdodenhof.circleimageview.CircleImageView
android:layout_width="0sp"
android:layout_height="50sp"
android:layout_weight="1"
android:src="@drawable/ic_baseline_send_24"
android:background="@color/purple_700"
app:civ_border_color="@color/purple_700"
android:id="@+id/sendmsg">

</de.hdodenhof.circleimageview.CircleImageView>

</LinearLayout>
</RelativeLayout>

MessageDetail.java
package com.example.tptchatroom;

import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;

import com.example.tptchatroom.Adapter.MessageListAdapter;
import com.example.tptchatroom.model.messagemodel;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;
import com.squareup.picasso.Picasso;
67 Ltd. Lucknow (U.P)
DigiCoders Technologies Pvt.
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;

public class MessageDetail extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_message_detail);

getSupportActionBar().hide();

Intent intent = getIntent();


TextView username = findViewById(R.id.username);
username.setText(intent.getStringExtra("name"));
ImageView userprofile=findViewById(R.id.userprofile);

Picasso.get().load(intent.getStringExtra("profilepic")).placeholder(R.drawable.horse).int
o(userprofile);

String receiveruid = intent.getStringExtra("uid");


String senderuid = FirebaseAuth.getInstance().getCurrentUser().getUid();

Toast.makeText(this, receiveruid + " " + senderuid,


Toast.LENGTH_SHORT).show();

//Lets create back button click event


ImageView back = findViewById(R.id.btnback);
back.setOnClickListener(new View.OnClickListener() {

@Override

public void onClick(View view) {


Intent in = new Intent(MessageDetail.this, chatRoom.class);
startActivity(in);
}
});
//Let's save messages in Firebase Database on click of send button.
ImageView sendbtn = findViewById(R.id.sendmsg);
EditText message = findViewById(R.id.usermsg);
sendbtn.setOnClickListener(new View.OnClickListener() {

@Override
public void onClick(View view) {
if (!message.getText().toString().trim().isEmpty())
{
messagemodel md=new messagemodel();
md.msg=message.getText().toString();
SimpleDateFormat format=new SimpleDateFormat("hh:mm aa");
Date date=new Date();
md.msgtime=String.valueOf(format.format(date));
md.senderid=senderuid;

68 Ltd. Lucknow (U.P)


DigiCoders Technologies Pvt.
FirebaseDatabase.getInstance().getReference().child("message").child(senderuid+receiverui
d).push()
.setValue(md).addOnCompleteListener(new
OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {

FirebaseDatabase.getInstance().getReference().child("message").

child(receiveruid+senderuid).push().setValue(md);
message.setText("");
}
});
}
else
{
Toast.makeText(MessageDetail.this, "Enter Message",
Toast.LENGTH_LONG).show();
}
}
});
ArrayList<messagemodel> msglist=new ArrayList<>();
//Let's bind MessageListAdapter to the recyclerview
RecyclerView recycle=findViewById(R.id.recyclemsg);
MessageListAdapter adapter=new
MessageListAdapter(this,msglist,senderuid+receiveruid);
recycle.setAdapter(adapter);
recycle.setLayoutManager(new LinearLayoutManager(this));

//Let's select all message of sender and receiver from database


FirebaseDatabase.getInstance().getReference().child("message").child(senderuid+receiverui
d).addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot snapshot)
{
msglist.clear();
for(DataSnapshot ds:snapshot.getChildren())
{
messagemodel m=new messagemodel();
m.msg=ds.child("msg").getValue(String.class);
m.msgtime=ds.child("msgtime").getValue(String.class);
m.senderid=ds.child("senderid").getValue(String.class);
m.messagekey=ds.getKey();
msglist.add(m);
}
adapter.notifyDataSetChanged();
if(msglist.size()>2)
recycle.smoothScrollToPosition(msglist.size()-1);
// Log.v("data",snapshot+"");
}

@Override
public void onCancelled(@NonNull DatabaseError error) {

}
});
}
}
69 Ltd. Lucknow (U.P)
DigiCoders Technologies Pvt.
9. FUTURE SCOPE

Following modification or upgrades can be done in system.


1. More than one company can be integrated through this software.
2. Web services can be used to know exact donation status of packets.
3. Client can check there donation delivery status online.

10. CONCLUSION:

At the last the Conclusion of project from a cultural standpoint is that COFFFEE SHOP largely serves
as centres of social interaction:a Coffee Shop provides patrons with a place to
congregate,talk,read,write,entertain one another , or pass the time,whether individually or in small
groups.

70 Ltd. Lucknow (U.P)


DigiCoders Technologies Pvt.

You might also like