Professional Documents
Culture Documents
Safety App
PROJECT
RECORD
Submitted By:
JuvinWilsonT
Reg.No:DSAT
BCA021
March 2022
DEPARTMENT OF COMPUTER APPLICATION
MAR DIONYSIUS COLLEGE
PAZHANJI
CERTIFICATE
This is to certify that the project report, ”WOMEN SAFETY APP” is the bonafide work of
JUVIN WILSON T (DSATBCAO21) in partial fullfillment of the requirements for the award of
the Degree of Bachelor of Computer Application under University of Calicut during the year
2021-2022.
Internal Guide
Head of the Department
DECLARATION
We hereby declare that this submission is our own work and that, to the best of our knowledge
and belief, it contains no material previously published or written by another person or material
which has been accepted for the award of any other degree or diploma of the university or other
institute of higher learning, except where due acknowledgement has been made in the text.
Date :
Reg No :DSATBCA031
Signature :
Name : Juvin Signature :
Wilson t Name :
Reg No : Athul V Jiju
DSATBCA021
Reg No
: DSATBCA019
Signature :
N
a
m
e
:
R
i
g
i
l
C
ABSTRACT
The main actors in the use of the proposed website will be the administrator, women and
police. In this WOMEN SAFETY you will be able to add a contact list , emergency alert, view
complaints, add police stations, submit complaint and view the emergency alert. This project will
contain a lot of advanced modules whichmakes the backend system very powerful. The list of
requirements for this project was also influenced by the work done in the background research
section above. TABLE 1 below gives a description of the modules proposed for the WOMEN
SAFETY.
CLASS Tracks all the information and ● Admin can add new
details of classes. classes
● Admin can see the list
of classes details
● Only admin can edit
and update the record
of the classes
● Admin will be able to
delete the records of
the classes
● All classes forms are
validated on client
side using JavaScript
I am glad to present the project report entitled “WOMEN SAFETY APP” prepared asa part of
our final year Bachelor of Computer Application course. First and foremost we are
extremely grateful to God Almighty, whose blessings have given us courage and strength to
complete this project successfully.
I express my heartiest gratitude to DR.THOMAS MATHEW,
Principal of, Mar Dionysius College Pazhanji Thrissur for his inspiration and encouragement
throughout our project. We would like to express our gratitude to DR.BENSON , Head of the
Department of Computer Application, who has served as a host of valuable encouragement. It is
wordless to say thanks to our internal guide DR.MANJU K MATHAI & DR.MANJUSHA K
K , Assistant Professor, Department of Computer Application, for her proper guidance and
support. We extend our sincere gratitude to all other faculties in the department, who have
contributed to fulfill our attempt.
We thank all our family members, friends and all other working staff
who helped us in successful completion of our project.
Place: Thrissur
Date:
CONTENTS
1. INTRODUCTION
2.SYSTEM STUDY
2.1 Existing system
2.2 Objective of the Project
2.3 Proposed System
3.SYSTEM ANALYSIS
3.1 Software Requirement Specification
3.1.1 Significance & Scope
3.1.2 Technologies & Tools
3.1.3 Software and Hardware Configuration
3.2 Feasibility study
4.SYSTEM DESIGN
4.1 Module description
4.1.1 modules
4.1.1.1 Admin Module
4.1.1.2 Student Module
4.1.1.3 Teacher Module
4.2 Conceptual Models
4.2.1 Data Flow diagram
4.2.2 ER diagram
4.3 Database Design
4.3.1 Normalization
4.4 Table Design
4.4.1 Users Table
4.5 Interface Design
4.5.1 Input Design
4.5.2 Output Design
5. SYSTEM DEVELOPMENT
5.1 Front End
5.2 Back End
6. SYSTEM TESTING
6.1 Modular Integration Testing
6.1.1 Test Case Design Method
6.1.1.1 Blackbox Testing
6.1.1.2 Whitebox Testing
7. SYSTEM IMPLEMENTATION
8. SYSTEM MAINTENANCE AND SECURITY
8.1 System Maintenance
8.2 System Security
9. CONCLUSION
10. APPENDIX
10.1 Coding Details
10.2 User Interface Design
!0.2.1 Input Form Design
10.2.2 Output Form Design
INTRODUCTION
The web has become a public square, a library, a doctor’s office, a shop, a
school, a design studio, an office, a cinema, a bank, and so much more. (Berners-Lee, 2018).
Trinidad and Tobago’s education system has a real opportunity to move forward in terms of
digital infrastructure and digital education as smaller countries have the greatest chance of
achieving system wide transformations. E-learning is a fairly new concept for Trinidad and
Tobago’s education system and with proper design and implementation using ideas from existing
e-learning applications, a world-class digital education programme can be established and
executed right here in Trinidad and Tobago.
EXISTING SYSTEM
In the existing system there is no monitoring system for girls in kerala, it should create many
problems for them and the no safety mechanism to protect the girls from the misbehaviour
activities.
In addition, in the existing system there is no alert mechanism for the girl’s safety, it
should be done by manually only.
Disadvantages
• All the existing systems must be connected to the GPS service to work properly, hence cannot be
used during emergency if there is no internet connectivity.
• here is no hidden camera detector which is portable to ensure our privacy.
• Monitoring was tedious.
• Mischance in arriving rate.
PROPOSED SYSTEM
In this Android Application is used to find the location and send the location to the group of
people stored in the phone , sos, message, track your phone.
ADVANTAGES
• It is an all-in-one system. Hence no need to carry multiple devices.
• GPS tracking feature tracks the user lively when you are the move after triggering the emergency
button.
• It records audio, which can be used for further investigations
The device works without internet connectivity
SYSTEM ANALYSIS
■ Physically disabled people can procure degrees and build their career
through online learning effortless
○ Scope
○ Android studio
○ Java
○ Firebase(Realtime database)
○ JSON
HARDWARE CONFIGURATION
Processor : Pentium IV or above
RAM :512MB
HDD : 50GB
KeyBoard/Mouse : Any standard KeyBoard/Mouse
Monitor : Any standard Monitor
SOFTWARE CONFIGURATION
Front End : Android studio
Back End : Fire base
Operating System : Windows 10 OR above
Feasibility Study
The best LMS solution is defined in this study as one in which all LMS components are
considered within the total learning infrastructure of Zanzibar University such that maximum
student success is ensured from both an institutional and System perspective. Aspects of these
components within the framework of student success were assessed by the following attributes:
•Cost effectiveness
The total cost figures included in this report represent a current snapshot of the LMS
expenditures excluding self-hosting and migration cost, reported to the Assessment team. The
benefits of the LMS is expected to be more than cost such as hosting maintenance and other
costs that may be incurred.
•Support and Training
The system must have a virtual learning community that provides students orientated templates
and professionals, development resources for faculty by providing online help desk services for
students and faculty that includes chat, email, telephone and a personalized support portal
available 24/7/365.
•Ease of Use
The LMS must have ease of use components and no additional instrument questions were
developed; the system should have a higher level of instructor and administrator perceived
application functionality.
•Scalability
The LMS must be able to report on the number of active courses, users, and average course size
and storage capacity on their LMS. It should be able to hold a lot of activities but still be able to
use less storage capacity.
•Sustainability
The sustainability of an LMS is paramount to the future growth of distance learning in the
university. The system-wide capability to support LMS-centric learning technology is
challenging in both the short and long terms. Information from the success NC listening tour
notes indicate that: -
(1) Colleges differ on LMS preferences but want continued support from the System Office.
(2) Learning technology offers an effective and flexible means to facilitate learning.
la Firefox, Internet Explorer
(3) Increased enrollments have negatively affected instructors, strained facilities, and encouraged
creative interventions to maximize resources
SYSTEM DESIGN
The system design is the second of the four system development life cycle phases. It is the phase
in which the detailed design of the system selected in the study phase is accomplished and the
users oriented performance specification is converted into a technical design specification. The
principal activity performed during the design phase includes the general system design and the
design of all outputs, input design phase reports and user review. At this point in the system
development life cycle, the problems have been identified, alternative solutions have been
studied, and also a management review has been ended with an authorization to proceed with a
recommended solution. The first design step, the system design involves the selection of those
system functions to be performed by either the people in the system, the equipment, or computer
programs. These functions are usually identified by decomposing the data flow diagrams into
low levels, more detailed DFD‟s, or drawing expanded system flow charts in the course of the
design phase, the performance specification is expanded into design specification.
The goal of the design process is to produce a model which can be used later
to develop a system. Produced model is called design of the system. The user oriented baseline
document prepared in the study phase becomes a baseline document oriented to the needs of the
programmers and other professional personals, which are actually developing the system. A
smooth traction for the study phase to the design phase is necessary because the design phase
continues the activities begun in the earlier phase. However, the project becomes enlarged in
scope, and the personnel are added. The system design phase provides details on how to meet the
requirements.
This phase converts the alternative solutions into logical and then physical
system solutions. In this phase we must design all the aspects from input and output to reports,
database and computer process. There are two types of design possible. They are logical design
and physical design. In logical design, concentrate on the business aspect of the system to be
obtained to a high level of specificity. In a physical system, analysts will design the various parts
of the system to perform physical operations. The analyst must design the following elements of
a system, that are files and database, input design, output design, forms and reports, dialogue an
interface, system and program structure, distributed system
System design consists of two major steps:-
1. Initiation of the detailed design by allocating system function between manual tasks, the
equipment functions and computer program functions
2. The identification of the test requirements for the system and each of the parts.
Module description
The main actors in the use of the proposed website will be the administrator, teacher and student.
In this E-Learning system you will be able to add a student in a class, upload a file, a course,
department, subject and video. This project will contain a lot of advanced modules which makes
the backend system very powerful. The list of requirements for this project was also influenced
by the work done in the background research section above.
MODULES
Conceptual Models
The DFD is also known as a data flow graph or a bubble chart. The following
observations about DFDs are important:
1. All names should be unique. This makes it easier to refer to items in the DFD.
Remember that a DFD is not a flow chart.
2. Arrows in a flow chart represent the order of events; arrows in DFD represent flowing
data. A DFD doesn’t imply any order of events.
3. Suppress logical decisions (A diamond shape box is used in flowchart to represent
decision points with multiple exit paths of which only one is taken).This implies an
ordering of events, which makes no sense in DFD.
Standard symbols:
1. Data Flow :
Used to connect processes to each other, to sources of sinks; the arrow head indicates
direction of data flow.
2. Process :
Performs some transformation of input data to yield output data.
3. Source/Suit (external entity) :
A source of system inputs or sinks of system output.
4. Data store :
A logical file in which it is used to store table details.
ER DIAGRAM
the entities and the list of data that would need to be stored must be represented. The
requirements analysis provided most of the information for this phase in the
development process, as functional requirements formed the basis of the data required.
The Entity Relationship Model is frequently used for the conceptual design of database
application and many database design tools employ its concept. An entity relationship
diagram was created based on the functional requirements outlined above. Images
below show draft ERD’s which need to be completed to align with the final database
design.
Database Design
Database design is the process of producing a detailed data model of a database. This data
model contains all the needed logical and physical design choices and physical storage
parameters needed to generate a design in a data definition language, which can then be
used to create a database. A fully attributed data model contains detailed attributes for
each entity. The term database design can be used to describe many different parts of the
design of an overall database system. Principally, and most correctly, it can be thought of
as the logical design of the base data structures used to store the data. In the relational
model these are the tables and views. In an object database the entities and relationships
map directly to object classes and named relationships. However, the term database
design could also be used to apply to the overall process of designing, not just the base
data structures, but also the forms and queries used as part of the overall database
application within the database management system (DBMS). Database Management is
the key to effective handling of data within an organization and between different
functional entities. The storage of all the data in a standardized and streamlined manner is
important.
NORMALIZATION
The term normalization refers to a technique of separating redundant fields and breaking up
large tables into smaller ones. After the conceptual level, the next level process of the database
designed to organize the database structure into a good shape is called normalization.
TABLE DESIGN
Users Table
The users table is used to manage the user information. The table is made up of 8
columns to store uid, unique_id, firstname, surname, email, encrypted_password, salt and
created_at. The primary key for the table is the user id which is represented in the table by uid. It
is an integer and its value is set to auto increment.
The unique user id is generated by using the function uniqid('', true). The sample uniqid
generated is 53682b0ba49121.72753406.
The firstname and the surname columns of the table store the user first and last names
respectively. The email column stores the email address of the user and this should be unique for
every user.
The encrypted_password column is needed for security purposes to encrypt user passwords in
the database so that it is not saved in plain text. It uses the base64_encoding method. The salt
column is used to store the value with which the password was encrypted. 27 The column
created_at is included to be able to track when the user account was created.
The column is saved in datetime format and uses NOW() function while saving user information
into the database table.
SYSTEM DEVELOPMENT
There are several technologies and tools used in the development of this project
work. These tools and technologies include: Android, Java, PHP, MySQL, JSON, phpMyAdmin
and Android mobile phone.Here we use android studio as front end and firebase as back end.
BACKEND-FIREBASE
Firebase is an integral part of Google Cloud. Its benefits include scalability, faster time to
market, and comprehensive app development and deployment functions. A few drawbacks
include its closed-source status, lack of SQL databases and users getting locked-in on
vendor’s platform
Firebase offers the free Spark Plan and the premium Blaze Plan. The free plan offers limited
server resources that cover most Firebase services, while the Blaze Plan charges users based
on the server resources used.
The features of Firebase provide value all through an app development cycle, from building
to deployment through monitoring and engaging users. Viable alternatives to Firebase
include Back4app, AWS Amplify and Backendless.
SYSTEM TESTING
UNIT TESTING
Unit testing focuses verification effort on the smallest unit of the software design, the module
this is known as module testing. Since the proposed system has modules the testing is
individually performed on each module. Using the detailed design description as a guide,
important control paths are tested to uncover errors within the boundary of the module. This
testing was carried out during the programming stage itself. In this testing step, each module is
found to be working satisfactorily as regards to the expected output from the module.
INTEGRATION TESTING
Data can be tested across an interface, one module can have effect on another, sub-function
when combined may not produce the desired function. Integration P a g e | 26 testing is a
systematic technique for constructing the program structure while at the same time conducting
tests to uncover errors associated within the interface.
VALIDATION TESTING
Validation testing can be defined in many ways, but a simple definition is that validation
succeeds in the software functions in a manner that is reasonably expected by the customer.
Software validation is achieved through a series of black box tests that demonstrates conformity
with requirements. After validation test has been conducted, one of the two conditions exists;
Deviation of errors discovered at this step in this project is corrected prior to completion of the
project with the help of the user by negotiating to establish a method for resolving deficiencies.
Thus the proposed system under consideration has been tested by using validation testing and
found to be working satisfactorily.
OUTPUT TESTING
After performing the validation testing, the next step is output testing of the proposed system.
Since no system could be useful if it does not produce the required output in the specific format.
The output generator displayed by the system under consideration is tested by asking the users
about the format required by them. Here the output is considered in two ways; One is on screen
and the other is printed format. The output format on the screen is found to be correct as the
format was designed in the system design phase according to the user needs. As far as hardcopies
are considered, it goes in terms with the user requirement. Hence output testing does not result in
any correction in the system.
ACCEPTANCE TESTING
User acceptance of the system is a key factor for the success of any system. The system under
consideration is tested for user acceptance by constantly keeping in touch with prospective
system and user at the time of developing and making changes whenever required.
SYSTEM MAINTENANCE
The maintenance phase of the software cycle is the time in which a software
product forms useful work. After a system is successfully implemented, it should be maintained
in a proper manner. System maintenance is an important aspect in the software development life
cycle. The need for maintenance is to make it adaptable to the changes in the environment. There
may be social, technical, and other environmental changes, which affects a system to be
implemented. Software produces enhancement that may provide new functional capabilities,
improving administrator displays and mode of interaction, upgrading the performance
characteristics of the system. So only through proper system maintenance procedures, the system
can be adapted to cope up with these changes.
Software maintenance is of course far more than “Finding mistakes' '. We
may define maintenance by describing four activities. Those are undertaken after a program is
released for use. The first maintenance activity occurs because it is unreasonable to assume that
software testing will uncover all latent errors in a large software system. During the use of any
large program, errors will occur and be reported to the developer.
The process that includes the diagnosis and correction of one or more errors is
called corrective maintenance. The second activity that contributes to a definition of maintenance
occurs because of the rapid change that is encountered in every aspect of computing. Therefore
adaptive maintenance is an activity that modifies software interfaces with a changing
environment is so common.
After a system is successfully implemented, it should be maintained in a proper
manner. System maintenance is performed to make the system adaptable to the changing
environment. Maintenance is in three ways;
• Corrective Maintenance
• Adaptive Maintenance
• Perfective Maintenance
CORRECTIVE MAINTENANCE
In software testing users will not uncover the errors in the system. During the use of any
large program errors will occur and be reported to the developer.
ADAPTIVE MAINTENANCE
It is an activity that modifies the entire system to properly interact with the changing
environment.
PERFECTIVE MAINTENANCE
It is performed to enhance the system by making modifications in the program to meet
the users changing needs.
SYSTEM SECURITY
Security involves both policies and mechanisms to protect the data and ensures that it
is not accessed, altered or deleted without proper authorization. There are two dimensions for the
protection of data in the database. The logged user can only perform the operations. This ensures
that the confidentiality of the data is maintained, second, the data must be protected from
accidental or intentional corruption or destruction.
The security features are considered while developing the system, so as to avoid the
errors and omissions that may lead to serious problems. The system may have to face the
unwanted events called threats. A threat to a computer system is any events that adversely affect
the one or more assets or resources, which make up the system. An event can be any of the
following:
• Interruption of communication.
• Destruction of hardware.
• Modification of software.
• Removal of programs.
• Disclosure of information.
LoginActivity
Xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:padding="16dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center">
<androidx.cardview.widget.CardView
xmlns:Card_View="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="350dp"
android:layout_margin="5dp"
android:padding="10dp"
Card_View:cardCornerRadius="5dp"
Card_View:cardElevation="10dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="5dp"
android:orientation="vertical">
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/emailError"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp">
<EditText
android:id="@+id/email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:hint="@string/prompt_email"
android:inputType="textEmailAddress"
android:maxLines="1"
android:paddingStart="5dp"
android:singleLine="true"
android:paddingLeft="5dp" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/passError"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
app:passwordToggleEnabled="true">
<EditText
android:id="@+id/password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:hint="@string/prompt_password"
android:inputType="textPassword"
android:maxLines="1"
android:paddingStart="5dp"
android:singleLine="true"
android:paddingLeft="5dp" />
</com.google.android.material.textfield.TextInputLayout>
<Button
android:id="@+id/login"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_margin="20dp"
android:background="@color/purple_200"
android:text="@string/login"
android:textColor="@android:color/white"
android:textSize="16sp"/>
<TextView
android:id="@+id/register"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:gravity="center"
android:text="@string/create_new"
android:textColor="@color/design_default_color_primary"
android:textSize="16sp"/>
</LinearLayout>
</androidx.cardview.widget.CardView>
</RelativeLayout>
<ImageView
android:id="@+id/profile"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_centerHorizontal="true"
android:layout_marginTop="-50dp"
android:background="@drawable/users"
android:padding="15dp"/>
</RelativeLayout>
Java
package com.example.blooddonation.Student;
import android.app.ProgressDialog;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import com.example.blooddonation.Admin.AdminHome;
import com.example.blooddonation.R;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.AuthResult;
import com.google.firebase.auth.FirebaseAuth;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
email = findViewById(R.id.email);
password = findViewById(R.id.password);
login = findViewById(R.id.login);
register = findViewById(R.id.register);
progressDialog = new ProgressDialog(this);
auth = FirebaseAuth.getInstance();
if (auth.getCurrentUser() != null) {
try{
Intent j=getIntent();
String logout = j.getStringExtra("logout");
if(logout.equals("logout")){
startActivity(new Intent(MainActivity.this,
MainActivity.class));
finish();
}
}
catch (Exception e) {
startActivity(new Intent(MainActivity.this, Home.class));
finish();
}
register.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent i = new Intent(MainActivity.this, Register.class);
startActivity(i);
}
});
login.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
emailid = email.getText().toString();
pass = password.getText().toString();
if (TextUtils.isEmpty(emailid)) {
Toast.makeText(getApplicationContext(), "Enter email
address!", Toast.LENGTH_SHORT).show();
return;
}
if (TextUtils.isEmpty(pass)) {
Toast.makeText(getApplicationContext(), "Enter password!",
Toast.LENGTH_SHORT).show();
return;
}
progressDialog.setMessage("Logging....... ");
progressDialog.show();
if(emailid.equals("admin") && pass.equals("admin")){
progressDialog.dismiss();
Intent j = new Intent(MainActivity.this, AdminHome.class);
startActivity(j);
}
else{
auth.signInWithEmailAndPassword(emailid, pass)
.addOnCompleteListener(MainActivity.this, new
OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult>
task) {
if (!task.isSuccessful()) {
// there was an error
if (password.length() < 6) {
progressDialog.dismiss();
password.setError(getString(R.string.error_invalid_password));
} else {
progressDialog.dismiss();
Toast.makeText(MainActivity.this,
getString(R.string.auth_failed), Toast.LENGTH_LONG).show();
}
} else {
progressDialog.dismiss();
Intent intent = new
Intent(MainActivity.this, Home.class);
startActivity(intent);
finish();
}
}
});
}
}
});
}
@Override
public void onBackPressed(){
moveTaskToBack(true);
}
}
RegisterActivity
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"
android:padding="16dp"
android:scrollbarThumbVertical="@null"
tools:context=".Student.Register">
<androidx.cardview.widget.CardView
xmlns:Card_View="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="5dp"
android:padding="10dp"
Card_View:cardCornerRadius="5dp"
Card_View:cardElevation="5dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="5dp"
android:orientation="vertical">
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/nameError"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp">
<EditText
android:id="@+id/name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:hint="@string/name"
android:inputType="textNoSuggestions"
android:maxLines="1"
android:paddingStart="5dp"
android:singleLine="true"
android:paddingLeft="5dp" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/emailError"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp">
<EditText
android:id="@+id/email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:hint="@string/prompt_email"
android:inputType="textEmailAddress"
android:maxLines="1"
android:paddingStart="5dp"
android:singleLine="true"
android:paddingLeft="5dp" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/phoneError"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp">
<EditText
android:id="@+id/phone"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:hint="@string/phone_number"
android:maxLength="12"
android:inputType="number"
android:maxLines="1"
android:paddingStart="5dp"
android:singleLine="true"
android:paddingLeft="5dp" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/passError"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:passwordToggleEnabled="true"
android:layout_marginTop="5dp">
<EditText
android:id="@+id/password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:hint="@string/prompt_password"
android:inputType="textPassword"
android:maxLines="1"
android:paddingStart="5dp"
android:singleLine="true"
android:paddingLeft="5dp" />
</com.google.android.material.textfield.TextInputLayout>
<Button
android:id="@+id/register"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_margin="20dp"
android:background="@color/purple_200"
android:text="@string/register"
android:textColor="@android:color/white"
android:textSize="16sp"/>
<TextView
android:id="@+id/login"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:gravity="center"
android:text="@string/not_register"
android:textColor="@color/purple_200"
android:textSize="16sp"/>
</LinearLayout>
</androidx.cardview.widget.CardView>
</ScrollView>
Java
package com.example.blooddonation.Student;
import android.app.ProgressDialog;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import com.example.blooddonation.R;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.AuthResult;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_register);
na = findViewById(R.id.name);
em = findViewById(R.id.email);
ph = findViewById(R.id.phone);
pass = findViewById(R.id.password);
register = findViewById(R.id.register);
login = findViewById(R.id.login);
progressDialog = new ProgressDialog(this);
auth = FirebaseAuth.getInstance();
databaseReference =
FirebaseDatabase.getInstance().getReference("users");
// below line is used to get reference for our database.
user = new User();
login.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent i = new Intent(Register.this, MainActivity.class);
startActivity(i);
}
});
register.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
name = na.getText().toString();
email = em.getText().toString();
phone = ph.getText().toString();
password = pass.getText().toString();
if (TextUtils.isEmpty(name)) {
Toast.makeText(getApplicationContext(), "Enter your name!",
Toast.LENGTH_SHORT).show();
return;
}
if (TextUtils.isEmpty(email)) {
Toast.makeText(getApplicationContext(), "Enter email
address!", Toast.LENGTH_SHORT).show();
return;
}
if (TextUtils.isEmpty(phone)) {
Toast.makeText(getApplicationContext(), "Enter your phone!",
Toast.LENGTH_SHORT).show();
return;
}
if (password.length() < 6) {
Toast.makeText(getApplicationContext(), "Password too short,
enter minimum 6 characters!", Toast.LENGTH_SHORT).show();
return;
}
progressDialog.setMessage("Registering ......... ");
progressDialog.show();
auth.createUserWithEmailAndPassword(email, password)
.addOnCompleteListener(Register.this, new
OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult>
task) {
if (!task.isSuccessful()) {
progressDialog.dismiss();
Toast.makeText(Register.this,
"Authentication failed.",
Toast.LENGTH_SHORT).show();
} else {
progressDialog.dismiss();
DatabaseReference databaseReference=
FirebaseDatabase.getInstance().getReference("users");
String id =
databaseReference.push().getKey();
user = new User(id, name, email, phone,
password);
databaseReference.child(id).setValue(user);
startActivity(new Intent(Register.this,
MainActivity.class));
Toast.makeText(getApplicationContext(),"User
Registered Successfully",Toast.LENGTH_SHORT).show();
}
}
});
}
});
HomeActivity
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=".Student.Home">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FFFFFF">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="0dp"
android:layout_height="1dp"
android:background="#00008577"
android:minHeight="?attr/actionBarSize"
android:theme="?attr/actionBarTheme"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/textView"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginLeft="16dp"
android:layout_marginTop="24dp"
android:text="eduClass"
android:textStyle="bold"
android:textColor="@color/design_default_color_primary"
android:fontFamily="sans-serif"
android:textSize="26sp"
app:layout_constraintEnd_toStartOf="@+id/imageView"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/toolbar" />
<TextView
android:id="@+id/textView2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginLeft="16dp"
android:text="Start a new career"
android:fontFamily="sans-serif"
app:layout_constraintEnd_toStartOf="@+id/imageView"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView" />
<ImageView
android:id="@+id/imageView"
android:layout_width="204dp"
android:layout_height="142dp"
android:layout_marginEnd="16dp"
android:layout_marginRight="16dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/textView"
app:layout_constraintTop_toBottomOf="@+id/toolbar"
app:srcCompat="@drawable/college" />
<LinearLayout
android:id="@+id/linearLayout"
android:layout_width="0dp"
android:layout_height="175dp"
android:orientation="horizontal"
android:padding="10dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/imageView">
<androidx.cardview.widget.CardView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_margin="10dp"
app:cardElevation="20dp"
app:cardCornerRadius="25dp"
android:layout_weight="1">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/meeting"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp"
android:text="Meeting"
android:textSize="20sp" />
<ImageView
android:id="@+id/meeting"
android:layout_width="75dp"
android:layout_height="75dp"
android:layout_centerHorizontal="true"
android:layout_marginTop="15dp"
app:srcCompat="@drawable/meeting" />
<!-- <TextView-->
<!-- android:layout_width="30dp"-->
<!-- android:layout_height="30dp"-->
<!-- android:layout_marginLeft="90dp"-->
<!-- android:text="0"-->
<!-- android:textStyle="bold"-->
<!-- android:textAlignment="gravity"-->
<!-- android:padding="4dp"-->
<!-- android:textSize="17dp"-->
<!--
android:textColorHighlight="@color/design_default_color_primary"-->
<!-- android:textColor="#ffff"-->
<!-- android:background="@drawable/rounded_corner"-->
<!-- android:gravity="center_horizontal" />-->
</RelativeLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_margin="10dp"
app:cardElevation="20dp"
app:cardCornerRadius="25dp"
android:layout_weight="1">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/learning"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp"
android:text="Learning"
android:textSize="20sp" />
<ImageView
android:id="@+id/learning"
android:layout_width="75dp"
android:layout_height="75dp"
android:layout_centerHorizontal="true"
android:layout_marginTop="15dp"
app:srcCompat="@drawable/learn" />
</RelativeLayout>
</androidx.cardview.widget.CardView>
</LinearLayout>
<LinearLayout
android:id="@+id/linearLayout2"
android:layout_width="0dp"
android:layout_height="175dp"
android:orientation="horizontal"
android:padding="10dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/linearLayout">
<androidx.cardview.widget.CardView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_margin="10dp"
app:cardElevation="20dp"
app:cardCornerRadius="25dp"
android:layout_weight="1">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/textView6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/notes"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp"
android:text="Notes"
android:textSize="20sp" />
<ImageView
android:id="@+id/notes"
android:layout_width="75dp"
android:layout_height="75dp"
android:layout_centerHorizontal="true"
android:layout_marginTop="15dp"
app:srcCompat="@drawable/note" />
</RelativeLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_margin="10dp"
app:cardElevation="20dp"
app:cardCornerRadius="25dp"
android:layout_weight="1">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/textView7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/syllabus"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp"
android:text="SYllabus"
android:textSize="20sp"/>
<ImageView
android:id="@+id/syllabus"
android:layout_width="75dp"
android:layout_height="75dp"
android:layout_centerHorizontal="true"
android:layout_marginTop="15dp"
app:srcCompat="@drawable/syllabus" />
</RelativeLayout>
</androidx.cardview.widget.CardView>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="175dp"
android:orientation="horizontal"
android:padding="10dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/linearLayout2">
<androidx.cardview.widget.CardView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_margin="10dp"
app:cardElevation="20dp"
app:cardCornerRadius="25dp"
android:layout_weight="1">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/textView8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/doubt"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp"
android:text="Doubt Hub"
android:textSize="20sp"/>
<ImageView
android:id="@+id/doubt"
android:layout_width="75dp"
android:layout_height="75dp"
android:layout_centerHorizontal="true"
android:layout_marginTop="15dp"
app:srcCompat="@drawable/doubt" />
</RelativeLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_margin="10dp"
app:cardElevation="20dp"
app:cardCornerRadius="25dp"
android:layout_weight="1">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/textView9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/announ"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp"
android:text="Announcements"
android:textSize="20sp" />
<ImageView
android:id="@+id/announ"
android:layout_width="75dp"
android:layout_height="75dp"
android:layout_centerHorizontal="true"
android:layout_marginTop="15dp"
app:srcCompat="@drawable/announcements" />
</RelativeLayout>
</androidx.cardview.widget.CardView>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView>
JAVA
package com.example.blooddonation.Student;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.ImageView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import com.example.blooddonation.Admin.AddLearning;
import com.example.blooddonation.R;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_home);
meet = findViewById(R.id.meeting);
notes = findViewById(R.id.notes);
learning = findViewById(R.id.learning);
syllabus = findViewById(R.id.syllabus);
doubthub = findViewById(R.id.doubt);
ann = findViewById(R.id.announ);
FirebaseAuth.AuthStateListener mAuthListener;
firebaseAuth = FirebaseAuth.getInstance();
}
};
meet.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent i = new Intent(Home.this, MeetView.class);
startActivity(i);
}
});
notes.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent i = new Intent(Home.this, NotesView.class);
startActivity(i);
}
});
learning.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent i = new Intent(Home.this, ViewLearning.class);
startActivity(i);
}
});
syllabus.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent i = new Intent(Home.this, ViewSyllabus.class);
startActivity(i);
}
});
doubthub.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if(email==null){
Intent i = new Intent(Home.this, DoubtHub.class);
i.putExtra("email",email);
startActivity(i);
}
else{
Toast.makeText(getApplicationContext(),"Login expired.Please
login",Toast.LENGTH_LONG).show();
}
}
});
ann.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent i = new Intent(Home.this, ViewAnnnouncement.class);
startActivity(i);
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
if (id == R.id.logout) {
FirebaseAuth.getInstance().signOut();
Intent i = new Intent(getApplicationContext(), MainActivity.class);
i.putExtra("logout","logout");
startActivity(i);
finish();
return true;
}
return super.onOptionsItemSelected(item);
}
}
ViewMeetingsActivity
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">
<LinearLayout
android:id="@+id/bottom_layout"
android:layout_width="match_parent"
android:background="@color/gray"
android:layout_height="wrap_content"
android:orientation="vertical">
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp">
<TextView
android:textStyle="bold|italic"
android:textColor="@color/black"
android:textAlignment="center"
android:textSize="20dp"
android:fontFamily="serif"
android:gravity="center"
android:text="Meetings"
android:id="@+id/select_btn"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</androidx.cardview.widget.CardView>
</LinearLayout>
<LinearLayout
android:layout_marginTop="10dp"
android:layout_below="@+id/bottom_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerview"
android:layout_width="match_parent"
android:layout_height="match_parent">
</androidx.recyclerview.widget.RecyclerView>
</LinearLayout>
</RelativeLayout>
JAVA
package com.example.blooddonation.Student;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.example.blooddonation.Adapter.LinkAdapter;
import com.example.blooddonation.Admin.Link;
import com.example.blooddonation.R;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.List;
recyclerView = (RecyclerView)findViewById(R.id.recyclerview);
recyclerView.setHasFixedSize(true);
recyclerView.setLayoutManager(new
LinearLayoutManager(getApplicationContext()));
list_data = new ArrayList<>();
db = FirebaseDatabase.getInstance().getReference("meeting_link");
db.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(@NonNull @NotNull DataSnapshot snapshot) {
for (DataSnapshot datas:snapshot.getChildren()){
Link listData = datas.getValue(Link.class);
list_data.add(listData);
}
adapter = new LinkAdapter(list_data, getApplicationContext());
recyclerView.setAdapter(adapter);
}
@Override
public void onCancelled(@NonNull @NotNull DatabaseError error) {
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.logout) {
FirebaseAuth.getInstance().signOut();
Intent i = new Intent(getApplicationContext(), MainActivity.class);
i.putExtra("logout","logout");
startActivity(i);
finish();
return true;
}
return super.onOptionsItemSelected(item);
}
MeetAdapterClass
package com.example.blooddonation.Adapter;
import android.content.Context;
import android.content.Intent;
import android.graphics.Paint;
import android.net.Uri;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.example.blooddonation.Admin.Link;
import com.example.blooddonation.R;
import java.util.List;
@NonNull
@Override
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int
viewType) {
View view=
LayoutInflater.from(parent.getContext()).inflate(R.layout.row_link,parent,false
);
return new ViewHolder(view);
}
@Override
public void onBindViewHolder(@NonNull final ViewHolder holder, final int
position) {
final Link ld=list_data.get(position);
holder.link.setText(ld.getLink());
holder.date.setText(ld.getMeeting_date());
holder.time.setText(ld.getMeeting_time());
holder.dep.setText(ld.getDepartment());
holder.year.setText(ld.getYear());
holder.link.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Uri uri = Uri.parse(ld.getLink());
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
ct.startActivity(intent);
}
});
}
@Override
public int getItemCount() {
return list_data.size();
}
link.setPaintFlags(link.getPaintFlags() |
Paint.UNDERLINE_TEXT_FLAG);
}
}
ViewLearningActivity
xml
package com.example.blooddonation.Student;
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.view.Menu;
import android.view.MenuItem;
import android.view.View;
import com.example.blooddonation.Adapter.LessonsAdapter;
import com.example.blooddonation.Adapter.LinkAdapter;
import com.example.blooddonation.R;
import com.example.blooddonation.table.Lesson;
import com.example.blooddonation.table.Topic;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.List;
recyclerView = (RecyclerView)findViewById(R.id.recyclerview);
recyclerView.setHasFixedSize(true);
recyclerView.setLayoutManager(new
LinearLayoutManager(getApplicationContext()));
list_data = new ArrayList<>();
db = FirebaseDatabase.getInstance().getReference("topics");
db.addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(@NonNull @NotNull DataSnapshot snapshot) {
for (DataSnapshot datas:snapshot.getChildren()){
Topic listData = datas.getValue(Topic.class);
list_data.add(listData);
}
adapter = new StudentLessonAdapter(list_data,
getApplicationContext());
recyclerView.setAdapter(adapter);
adapter.notifyDataSetChanged();
}
@Override
public void onCancelled(@NonNull @NotNull DatabaseError error) {
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.logout) {
FirebaseAuth.getInstance().signOut();
Intent i = new Intent(getApplicationContext(), MainActivity.class);
i.putExtra("logout","logout");
startActivity(i);
finish();
return true;
}
return super.onOptionsItemSelected(item);
}
}
LessonAdapterClass
package com.example.blooddonation.Student;
import android.content.Context;
import android.content.Intent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.example.blooddonation.R;
import com.example.blooddonation.table.Topic;
import com.example.blooddonation.table.View_video;
import com.google.firebase.database.DatabaseReference;
import java.util.List;
@NonNull
@Override
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int
viewType) {
View view=
LayoutInflater.from(parent.getContext()).inflate(R.layout.activity_row_student_
lessons,parent,false);
return new ViewHolder(view);
}
@Override
public void onBindViewHolder(@NonNull final ViewHolder holder, final int
position) {
final Topic ld=list_data.get(position);
holder.lesson.setText(ld.getLesson());
holder.duration.setText(ld.getDuration());
holder.lesson.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String video = ld.getVideo_link();
Intent intent = new Intent(ct, View_video.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.putExtra("lesson", ld.getLesson());
ct.startActivity(intent);
}
});
}
@Override
public int getItemCount() {
return list_data.size();
NotesActivity
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:id="@+id/rl"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/gre">
<TextView
android:id="@+id/txt"
android:textStyle="bold"
android:textColor="#110101"
android:background="#ffff"
android:textSize="20sp"
android:gravity="center"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="introduction"
/>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_below="@id/txt"
android:layout_marginBottom="50dp"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</RelativeLayout>
JAVA
package com.example.blooddonation.Student;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.RelativeLayout;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.example.blooddonation.Adapter.NoteAdapter;
import com.example.blooddonation.R;
import com.example.blooddonation.table.NoteUploadInfo;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;
import java.util.ArrayList;
import java.util.List;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_notes_view);
databaseReference =
FirebaseDatabase.getInstance().getReference("notes");
databaseReference.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot snapshot) {
for (DataSnapshot postSnapshot : snapshot.getChildren()) {
NoteUploadInfo noteUploadInfo =
postSnapshot.getValue(NoteUploadInfo.class);
list.add(noteUploadInfo);
}
adapter = new NoteAdapter(getApplicationContext(), list);
recyclerView.setAdapter(adapter);
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
if (id == R.id.logout) {
FirebaseAuth.getInstance().signOut();
Intent i = new Intent(getApplicationContext(), MainActivity.class);
i.putExtra("logout","logout");
startActivity(i);
finish();
return true;
}
return super.onOptionsItemSelected(item);
}
}
NoteAdapterClass
package com.example.blooddonation.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.cardview.widget.CardView;
import androidx.recyclerview.widget.RecyclerView;
import com.example.blooddonation.R;
import com.example.blooddonation.Student.pdf;
import com.example.blooddonation.table.NoteUploadInfo;
import java.util.List;
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view =
LayoutInflater.from(parent.getContext()).inflate(R.layout.row_notes, parent,
false);
ViewHolder viewHolder = new ViewHolder(view);
return viewHolder;
}
@Override
public void onBindViewHolder(ViewHolder holder, int position) {
NoteUploadInfo UploadInfo = productList.get(position);
holder.textViewTitle.setText(UploadInfo.getNoteName());
holder.imageView.setImageDrawable(mCtx.getResources().getDrawable(R.drawable.ic
_baseline_picture_as_pdf_24));
holder.cardView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent i = new Intent(v.getContext(), pdf.class);
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
i.putExtra("link", productList.get(position).getNoteURL());
i.putExtra("productList",
productList.get(position).getSubject());
mCtx.startActivity(i);
}
});
}
@Override
public int getItemCount() {
return productList.size();
}
class ViewHolder extends RecyclerView.ViewHolder {
TextView textViewTitle;
ImageView imageView;
CardView cardView;
SyllabusActivity
xml
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<TableLayout
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:stretchColumns="0,1,2"
android:gravity="center">
<TextView
android:layout_width="wrap_content"
android:layout_height="48dp"
android:layout_column="0"
android:layout_margin="1dp"
android:background="#FFFFFF"
android:gravity="center"
android:text="BCA First semester"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textStyle="bold" />
<TableRow
android:background="#000000"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_margin="1dp"
>
<TextView
android:layout_width="15dp"
android:layout_height="match_parent"
android:layout_column="0"
android:layout_margin="1dp"
android:background="#FFFFFF"
android:gravity="center"
android:text="Paper No"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textStyle="bold" />
<TextView
android:layout_width="192dp"
android:layout_height="match_parent"
android:layout_column="1"
android:layout_margin="1dp"
android:background="#FFFFFF"
android:gravity="center"
android:text="Paper"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Marks"
android:layout_margin="1dp"
android:background="#FFFFFF"
android:gravity="center"
android:textStyle="bold"
android:layout_column="2"
/>
</TableRow>
<TableRow
android:background="#000000"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_margin="1dp"
>
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="1"
android:layout_margin="1dp"
android:layout_column="0"
android:background="#FFFFFF"
android:gravity="center"
/>
<TextView
android:layout_width="237dp"
android:layout_height="64dp"
android:layout_column="1"
android:layout_margin="1dp"
android:background="#FFFFFF"
android:gravity="center"
android:text="Computer Fundamentals"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="75"
android:layout_margin="1dp"
android:background="#FFFFFF"
android:gravity="center"
android:layout_column="2" />
</TableRow>
<TableRow
android:layout_width="309dp"
android:layout_height="0dp"
android:layout_margin="1dp"
android:background="#000000">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_column="0"
android:layout_margin="1dp"
android:background="#FFFFFF"
android:gravity="center"
android:text="2"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:layout_width="250dp"
android:layout_height="123dp"
android:layout_column="1"
android:layout_margin="1dp"
android:background="#FFFFFF"
android:gravity="center"
android:text="Mathematical Foundation for Computer Applications"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_column="2"
android:layout_margin="1dp"
android:background="#FFFFFF"
android:gravity="center"
android:text="75"
android:textAppearance="?android:attr/textAppearanceLarge" />
</TableRow>
<TableRow
android:background="#000000"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_margin="1dp"
>
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="3"
android:layout_margin="1dp"
android:layout_column="0"
android:background="#FFFFFF"
android:gravity="center"
/>
<TextView
android:layout_width="250dp"
android:layout_height="76dp"
android:layout_column="1"
android:layout_margin="1dp"
android:background="#FFFFFF"
android:gravity="center"
android:text=" Discrete Mathematics"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="75"
android:layout_margin="1dp"
android:background="#FFFFFF"
android:gravity="center"
android:layout_column="2" />
</TableRow>
<TableRow
android:background="#000000"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_margin="1dp"
>
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="4"
android:layout_margin="1dp"
android:layout_column="0"
android:background="#FFFFFF"
android:gravity="center"
/>
<TextView
android:layout_width="250dp"
android:layout_height="76dp"
android:layout_column="1"
android:layout_margin="1dp"
android:background="#FFFFFF"
android:gravity="center"
android:text="Common Course (English)"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="50"
android:layout_margin="1dp"
android:background="#FFFFFF"
android:gravity="center"
android:layout_column="2" />
</TableRow>
<TableRow
android:background="#000000"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_margin="1dp"
>
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="5"
android:layout_margin="1dp"
android:layout_column="0"
android:background="#FFFFFF"
android:gravity="center"
/>
<TextView
android:layout_width="250dp"
android:layout_height="76dp"
android:layout_column="1"
android:layout_margin="1dp"
android:background="#FFFFFF"
android:gravity="center"
android:text="Second Language (other than English)"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="50"
android:layout_margin="1dp"
android:background="#FFFFFF"
android:gravity="center"
android:layout_column="2" />
</TableRow>
<TextView
android:layout_width="wrap_content"
android:layout_height="48dp"
android:layout_column="0"
android:layout_margin="1dp"
android:background="#FFFFFF"
android:gravity="center"
android:text="BCA Second semester"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textStyle="bold" />
<TableRow
android:background="#000000"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_margin="1dp"
>
<TextView
android:layout_width="27dp"
android:layout_height="match_parent"
android:layout_column="0"
android:layout_margin="1dp"
android:background="#FFFFFF"
android:gravity="center"
android:text="Paper No"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textStyle="bold" />
<TextView
android:layout_width="192dp"
android:layout_height="match_parent"
android:layout_column="1"
android:layout_margin="1dp"
android:background="#FFFFFF"
android:gravity="center"
android:text="Paper"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Marks"
android:layout_margin="1dp"
android:background="#FFFFFF"
android:gravity="center"
android:textStyle="bold"
android:layout_column="2"
/>
</TableRow>
<TableRow
android:background="#000000"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_margin="1dp"
>
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="1"
android:layout_margin="1dp"
android:layout_column="0"
android:background="#FFFFFF"
android:gravity="center"
/>
<TextView
android:layout_width="237dp"
android:layout_height="64dp"
android:layout_column="1"
android:layout_margin="1dp"
android:background="#FFFFFF"
android:gravity="center"
android:text="Problem Solving using C"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="75"
android:layout_margin="1dp"
android:background="#FFFFFF"
android:gravity="center"
android:layout_column="2" />
</TableRow>
<TableRow
android:layout_width="309dp"
android:layout_height="0dp"
android:layout_margin="1dp"
android:background="#000000">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_column="0"
android:layout_margin="1dp"
android:background="#FFFFFF"
android:gravity="center"
android:text="2"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:layout_width="250dp"
android:layout_height="123dp"
android:layout_column="1"
android:layout_margin="1dp"
android:background="#FFFFFF"
android:gravity="center"
android:text="Programming Laboratory I: HTML and Programming in C"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_column="2"
android:layout_margin="1dp"
android:background="#FFFFFF"
android:gravity="center"
android:text="75"
android:textAppearance="?android:attr/textAppearanceLarge" />
</TableRow>
<TableRow
android:background="#000000"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_margin="1dp"
>
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="3"
android:layout_margin="1dp"
android:layout_column="0"
android:background="#FFFFFF"
android:gravity="center"
/>
<TextView
android:layout_width="250dp"
android:layout_height="76dp"
android:layout_column="1"
android:layout_margin="1dp"
android:background="#FFFFFF"
android:gravity="center"
android:text=" Financial and Management Accounting"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="75"
android:layout_margin="1dp"
android:background="#FFFFFF"
android:gravity="center"
android:layout_column="2" />
</TableRow>
<TableRow
android:background="#000000"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_margin="1dp"
>
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="4"
android:layout_margin="1dp"
android:layout_column="0"
android:background="#FFFFFF"
android:gravity="center"
/>
<TextView
android:layout_width="250dp"
android:layout_height="76dp"
android:layout_column="1"
android:layout_margin="1dp"
android:background="#FFFFFF"
android:gravity="center"
android:text="Operations Research"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="50"
android:layout_margin="1dp"
android:background="#FFFFFF"
android:gravity="center"
android:layout_column="2" />
</TableRow>
<TableRow
android:background="#000000"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_margin="1dp"
>
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="5"
android:layout_margin="1dp"
android:layout_column="0"
android:background="#FFFFFF"
android:gravity="center"
/>
<TextView
android:layout_width="250dp"
android:layout_height="76dp"
android:layout_column="1"
android:layout_margin="1dp"
android:background="#FFFFFF"
android:gravity="center"
android:text="Common Course"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="50"
android:layout_margin="1dp"
android:background="#FFFFFF"
android:gravity="center"
android:layout_column="2" />
</TableRow>
<TableRow
android:background="#000000"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_margin="1dp"
>
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="6"
android:layout_margin="1dp"
android:layout_column="0"
android:background="#FFFFFF"
android:gravity="center"
/>
<TextView
android:layout_width="250dp"
android:layout_height="76dp"
android:layout_column="1"
android:layout_margin="1dp"
android:background="#FFFFFF"
android:gravity="center"
android:text="Second Language (other than English)"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="50"
android:layout_margin="1dp"
android:background="#FFFFFF"
android:gravity="center"
android:layout_column="2" />
</TableRow>
<TextView
android:layout_width="wrap_content"
android:layout_height="48dp"
android:layout_column="0"
android:layout_margin="1dp"
android:background="#FFFFFF"
android:gravity="center"
android:text="BCA Third semester"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textStyle="bold" />
<TableRow
android:background="#000000"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_margin="1dp"
>
<TextView
android:layout_width="27dp"
android:layout_height="match_parent"
android:layout_column="0"
android:layout_margin="1dp"
android:background="#FFFFFF"
android:gravity="center"
android:text="Paper No"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textStyle="bold" />
<TextView
android:layout_width="192dp"
android:layout_height="match_parent"
android:layout_column="1"
android:layout_margin="1dp"
android:background="#FFFFFF"
android:gravity="center"
android:text="Paper"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Marks"
android:layout_margin="1dp"
android:background="#FFFFFF"
android:gravity="center"
android:textStyle="bold"
android:layout_column="2"
/>
</TableRow>
<TableRow
android:background="#000000"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_margin="1dp"
>
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="1"
android:layout_margin="1dp"
android:layout_column="0"
android:background="#FFFFFF"
android:gravity="center"
/>
<TextView
android:layout_width="237dp"
android:layout_height="64dp"
android:layout_column="1"
android:layout_margin="1dp"
android:background="#FFFFFF"
android:gravity="center"
android:text="Python Programming"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="75"
android:layout_margin="1dp"
android:background="#FFFFFF"
android:gravity="center"
android:layout_column="2" />
</TableRow>
<TableRow
android:layout_width="309dp"
android:layout_height="0dp"
android:layout_margin="1dp"
android:background="#000000">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_column="0"
android:layout_margin="1dp"
android:background="#FFFFFF"
android:gravity="center"
android:text="2"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:layout_width="250dp"
android:layout_height="123dp"
android:layout_column="1"
android:layout_margin="1dp"
android:background="#FFFFFF"
android:gravity="center"
android:text="Data Structures using C"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_column="2"
android:layout_margin="1dp"
android:background="#FFFFFF"
android:gravity="center"
android:text="75"
android:textAppearance="?android:attr/textAppearanceLarge" />
</TableRow>
<TableRow
android:background="#000000"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_margin="1dp"
>
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="3"
android:layout_margin="1dp"
android:layout_column="0"
android:background="#FFFFFF"
android:gravity="center"
/>
<TextView
android:layout_width="250dp"
android:layout_height="76dp"
android:layout_column="1"
android:layout_margin="1dp"
android:background="#FFFFFF"
android:gravity="center"
android:text="Computer Oriented Numerical and Statistical Methods"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="75"
android:layout_margin="1dp"
android:background="#FFFFFF"
android:gravity="center"
android:layout_column="2" />
</TableRow>
<TableRow
android:background="#000000"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_margin="1dp"
>
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="4"
android:layout_margin="1dp"
android:layout_column="0"
android:background="#FFFFFF"
android:gravity="center"
/>
<TextView
android:layout_width="250dp"
android:layout_height="76dp"
android:layout_column="1"
android:layout_margin="1dp"
android:background="#FFFFFF"
android:gravity="center"
android:text="Theory of Computation"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="50"
android:layout_margin="1dp"
android:background="#FFFFFF"
android:gravity="center"
android:layout_column="2" />
</TableRow>
<TableRow
android:background="#000000"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_margin="1dp"
>
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="5"
android:layout_margin="1dp"
android:layout_column="0"
android:background="#FFFFFF"
android:gravity="center"
/>
<TextView
android:layout_width="250dp"
android:layout_height="76dp"
android:layout_column="1"
android:layout_margin="1dp"
android:background="#FFFFFF"
android:gravity="center"
android:text="Sensors and Transducers"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="50"
android:layout_margin="1dp"
android:background="#FFFFFF"
android:gravity="center"
android:layout_column="2" />
</TableRow>
<TextView
android:layout_width="wrap_content"
android:layout_height="48dp"
android:layout_column="0"
android:layout_margin="1dp"
android:background="#FFFFFF"
android:gravity="center"
android:text="BCA Fourth semester"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textStyle="bold" />
<TableRow
android:background="#000000"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_margin="1dp"
>
<TextView
android:layout_width="27dp"
android:layout_height="match_parent"
android:layout_column="0"
android:layout_margin="1dp"
android:background="#FFFFFF"
android:gravity="center"
android:text="Paper No"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textStyle="bold" />
<TextView
android:layout_width="192dp"
android:layout_height="match_parent"
android:layout_column="1"
android:layout_margin="1dp"
android:background="#FFFFFF"
android:gravity="center"
android:text="Paper"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Marks"
android:layout_margin="1dp"
android:background="#FFFFFF"
android:gravity="center"
android:textStyle="bold"
android:layout_column="2"
/>
</TableRow>
<TableRow
android:background="#000000"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_margin="1dp"
>
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="1"
android:layout_margin="1dp"
android:layout_column="0"
android:background="#FFFFFF"
android:gravity="center"
/>
<TextView
android:layout_width="237dp"
android:layout_height="64dp"
android:layout_column="1"
android:layout_margin="1dp"
android:background="#FFFFFF"
android:gravity="center"
android:text="Data Communication and Optical Fibers"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="75"
android:layout_margin="1dp"
android:background="#FFFFFF"
android:gravity="center"
android:layout_column="2" />
</TableRow>
<TableRow
android:layout_width="309dp"
android:layout_height="0dp"
android:layout_margin="1dp"
android:background="#000000">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_column="0"
android:layout_margin="1dp"
android:background="#FFFFFF"
android:gravity="center"
android:text="2"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:layout_width="250dp"
android:layout_height="123dp"
android:layout_column="1"
android:layout_margin="1dp"
android:background="#FFFFFF"
android:gravity="center"
android:text="Microprocessors-Architecture and Programming"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_column="2"
android:layout_margin="1dp"
android:background="#FFFFFF"
android:gravity="center"
android:text="75"
android:textAppearance="?android:attr/textAppearanceLarge" />
</TableRow>
<TableRow
android:background="#000000"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_margin="1dp"
>
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="3"
android:layout_margin="1dp"
android:layout_column="0"
android:background="#FFFFFF"
android:gravity="center"
/>
<TextView
android:layout_width="250dp"
android:layout_height="76dp"
android:layout_column="1"
android:layout_margin="1dp"
android:background="#FFFFFF"
android:gravity="center"
android:text="Database Management System and RDBMS"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="75"
android:layout_margin="1dp"
android:background="#FFFFFF"
android:gravity="center"
android:layout_column="2" />
</TableRow>
<TableRow
android:background="#000000"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_margin="1dp"
>
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="4"
android:layout_margin="1dp"
android:layout_column="0"
android:background="#FFFFFF"
android:gravity="center"
/>
<TextView
android:layout_width="250dp"
android:layout_height="76dp"
android:layout_column="1"
android:layout_margin="1dp"
android:background="#FFFFFF"
android:gravity="center"
android:text="Programming Laboratory II: Data Structures and RDBMS"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="50"
android:layout_margin="1dp"
android:background="#FFFFFF"
android:gravity="center"
android:layout_column="2" />
</TableRow>
<TableRow
android:background="#000000"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_margin="1dp"
>
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="5"
android:layout_margin="1dp"
android:layout_column="0"
android:background="#FFFFFF"
android:gravity="center"
/>
<TextView
android:layout_width="250dp"
android:layout_height="76dp"
android:layout_column="1"
android:layout_margin="1dp"
android:background="#FFFFFF"
android:gravity="center"
android:text="Computer Graphics"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="50"
android:layout_margin="1dp"
android:background="#FFFFFF"
android:gravity="center"
android:layout_column="2" />
</TableRow>
</TableLayout>
</ScrollView>
DoubtHubActivity
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:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin">
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clickable="true"
android:src="@drawable/ic_baseline_send_24"
android:id="@+id/fab"
android:tint="@android:color/white"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
app:fabSize="mini"
android:layout_alignParentRight="true" />
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_toLeftOf="@id/fab"
android:layout_alignParentBottom="true"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Input"
android:id="@+id/input"
/>
</com.google.android.material.textfield.TextInputLayout>
<ListView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentTop="true"
android:layout_alignParentStart="true"
android:layout_above="@id/fab"
android:dividerHeight="16dp"
android:divider="@android:color/transparent"
android:id="@+id/list_of_messages"
android:layout_marginBottom="16dp"
android:layout_alignParentLeft="true" />
</RelativeLayout>
JAVA
package com.example.blooddonation.Student;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.text.format.DateFormat;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import com.example.blooddonation.R;
import com.example.blooddonation.table.ChatMessage;
import com.facebook.internal.AnalyticsEvents;
import com.firebase.ui.database.FirebaseListAdapter;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
import com.google.firebase.database.ChildEventListener;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;
import com.google.firebase.ktx.Firebase;
import org.jetbrains.annotations.NotNull;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Locale;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_doubt_hub);
FloatingActionButton fab =
(FloatingActionButton)findViewById(R.id.fab);
Intent j=getIntent();
emails = j.getStringExtra("email");
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
EditText input = (EditText)findViewById(R.id.input);
db.orderByChild("email").equalTo(user).addValueEventListener(new
ValueEventListener() {
@Override
public void onDataChange(@NonNull @NotNull DataSnapshot
snapshot) {
for (DataSnapshot datas : snapshot.getChildren()) {
User user = datas.getValue(User.class);
SimpleDateFormat sdf = new
SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.getDefault());
String currentDateandTime = sdf.format(new
Date());
username = user.getName().toString();
DatabaseReference databaseReference =
FirebaseDatabase.getInstance().getReference("chat");
Date currentTime =
Calendar.getInstance().getTime();
String id = databaseReference.push().getKey();
String date = currentTime.toString();
ChatMessage chatMessage = new
ChatMessage(message, username, currentDateandTime);
databaseReference.child(id).setValue(chatMessage);
}
}
@Override
public void onCancelled(@NonNull @NotNull DatabaseError
error) {
}
});
}
else{
db.orderByChild("email").equalTo(emails).addValueEventListener(new
ValueEventListener() {
@Override
public void onDataChange(@NonNull @NotNull DataSnapshot
snapshot) {
for (DataSnapshot datas : snapshot.getChildren()) {
User user = datas.getValue(User.class);
SimpleDateFormat sdf = new
SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.getDefault());
String currentDateandTime = sdf.format(new
Date());
username = user.getName().toString();
if (user == null) {
}
DatabaseReference databaseReference =
FirebaseDatabase.getInstance().getReference("chat");
Date currentTime =
Calendar.getInstance().getTime();
String id = databaseReference.push().getKey();
String date = currentTime.toString();
ChatMessage chatMessage = new
ChatMessage(message, username, currentDateandTime);
databaseReference.child(id).setValue(chatMessage);
}
}
@Override
public void onCancelled(@NonNull @NotNull DatabaseError
error) {
}
});
input.setText("");
}
});
ListView listOfMessages = (ListView)findViewById(R.id.list_of_messages);
db = FirebaseDatabase.getInstance().getReference("chat");
adapter = new FirebaseListAdapter<ChatMessage>(this, ChatMessage.class,
R.layout.message_area, db) {
@Override
protected void populateView(View v, ChatMessage model, int position)
{
// Get references to the views of message.xml
TextView messageText =
(TextView)v.findViewById(R.id.message_text);
TextView messageUser =
(TextView)v.findViewById(R.id.message_user);
TextView messageTime =
(TextView)v.findViewById(R.id.message_time);
listOfMessages.setAdapter(adapter);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.student_menu, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.logout) {
FirebaseAuth.getInstance().signOut();
Intent i = new Intent(getApplicationContext(), MainActivity.class);
i.putExtra("logout","logout");
startActivity(i);
finish();
return true;
}
return super.onOptionsItemSelected(item);
}
}
ViewAnnouncementActivity
xml
</RelativeLayout>
Java
package com.example.blooddonation.Student;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.app.ProgressDialog;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import com.example.blooddonation.Adapter.Announcementadapter;
import com.example.blooddonation.R;
import com.example.blooddonation.table.ImageUploadInfo;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;
import java.util.ArrayList;
import java.util.List;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_view_annnouncement);
databaseReference =
FirebaseDatabase.getInstance().getReference("announcements");
databaseReference.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot snapshot) {
for (DataSnapshot postSnapshot : snapshot.getChildren()) {
ImageUploadInfo imageUploadInfo =
postSnapshot.getValue(ImageUploadInfo.class);
list.add(imageUploadInfo);
}
adapter = new Announcementadapter(getApplicationContext(),
list);
recyclerView.setAdapter(adapter);
progressDialog.dismiss();
}
@Override
public void onCancelled(DatabaseError databaseError) {
progressDialog.dismiss();
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
if (id == R.id.logout) {
FirebaseAuth.getInstance().signOut();
Intent i = new Intent(getApplicationContext(), MainActivity.class);
i.putExtra("logout","logout");
startActivity(i);
finish();
return true;
}
return super.onOptionsItemSelected(item);
}
}
AnnouncementAdapterClass
package com.example.blooddonation.Adapter;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.recyclerview.widget.RecyclerView;
import com.bumptech.glide.Glide;
import com.example.blooddonation.R;
import com.example.blooddonation.table.ImageUploadInfo;
import java.util.List;
Context context;
List<ImageUploadInfo> MainImageUploadInfoList;
public Announcementadapter(Context context, List<ImageUploadInfo> TempList)
{
this.MainImageUploadInfoList = TempList;
this.context = context;
}
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view =
LayoutInflater.from(parent.getContext()).inflate(R.layout.row_announcements,
parent, false);
ViewHolder viewHolder = new ViewHolder(view);
return viewHolder;
}
@Override
public void onBindViewHolder(ViewHolder holder, int position) {
ImageUploadInfo UploadInfo = MainImageUploadInfoList.get(position);
holder.imageNameTextView.setText(UploadInfo.getImageName());
if(UploadInfo.getImageURL().equals("null")){
holder.imageView.getLayoutParams().height = 0;
holder.relative.getLayoutParams().height = 150;
}
else{
holder.imageNameTextView.setText(UploadInfo.getImageName());
}
Glide.with(context).load(UploadInfo.getImageURL()).into(holder.imageView);
}
@Override
public int getItemCount() {
return MainImageUploadInfoList.size();
}