You are on page 1of 168

PROJECT REPORT

On
SCD Notice Board

Submitted To

PANJAB UNIVERSITY, CHANDIGARH

In Partial fulfillment of the requirements for the Degree of

Masters of Computer Science

(Information Technology 4 Th Semester)

Project Guide: Submitted by:

Mr.Varun Jain Payal

SCD GOVT. COLLEGE, Ludhiana


1
Acknowledgement

“The relish of achievement is not so sweet


as is the way you reach the coveted feat!”

First of all we would like to thank the almighty,who has always guided us to work
on the right path of the life.We take immense pleasure in thanking everyone who
has helped us to conceive and develop the project.We acknowledge with deep
sense of gratitude and most sincere appreciation,the valueable guidance and
unfailing encouragement rendered to us by Mr.Ishant kumar,”Technical Lead
and director of Auribises Technologies Pvt Ltd” for their proficient and
enthusiastic guidance,useful encouragement and immense help.We express our
heartfelt gratitude to the Principal, Dr. Dharam Singh Sandhu and HOD
Dr.Gursharan Singh sandhu, SCD Govt. College, Ludhiana and the management
for providing the needed infrastructure.We wish to express our deep sense of
gratitude to Our Internal Guide and Project Leader, Mr. Varun Jain and
Mr.Vijay Sehgal for their able guidance and useful suggestions, which helped us
in completing the project work, in time. Without them the project could not have
been materialized.Finally, yet importantly, we would like to express our heartfelt
thanks to our beloved parents for their blessings, friends/classmates for their help
and wishes for the successful completion of this project.
We thank all these people fervently as these were the leaders and we simply
followed them.

Payal

2
Preface
The well planned properly executed and evaluated training helps a lot in including
good culture. It provides linkage between the student and the institution in order to
develop the awareness of approach to problem solving based on broad
understanding of process and mode of operation of an organization.

This report serves the purpose of elaborating the analysis and the implementation
phases of the above-mentioned project. All the features that have been clearly
explained to make the project easy to understand. It has been taken care that this
document elicits the system development process in a clear and well-documented
manner.

In the beginning we have provided an abstract into the general features of the
project. During our stay here we learnt how an actual project progress, what sort of
problems actually occur during the development of such projects, how to produce
quality products and so on.

3
Student Declaration
Payal hereby declare that the project report submitted to the PANJAB
UNIVERSITY in partial fulfillment for the reward of degree in Master of Science
in information Technology entitled “SCD Notice Board” is original piece of
research work carried out by me under the supervision of Mr.Varun Jain and Vijay
Sehgal. I further declare that information has been collected from genuine and
authentic resource. It has not been submitted before for any degree or examination
to any other University

Date: Name of the Student:

Payal

Place:

4
Certificate

This is to certify that this Project Report entitled“SCD Notice Board”Has been
submitted for the partial fulfillment of the requirement of the degree of Masters of
Computer Science (Information Technology 4th semester) of PANJAB
UNIVERSITY, CHANDIGARH. .

This project is bonafide work ofPayal Under supervision and no part of it has been
submitted for any other degrees.

______________

Mr. Varun Jain


(Internal Guide)

5
Certificate

This is to certify that this Project Report entitled“SCD Notice Board”Has been
submitted for the partial fulfillment of the requirement of the degree of Masters of
Computer Science (Information Technology 4th semester) of PANJAB
UNIVERSITY, CHANDIGARH. .

This project is bonafide work ofPayal Under supervision and no part of it has been
submitted for any other degrees.

______________

Mr. Vijay Sehgal


(Internal Guide)

6
Table of Contents
Sr. No Topic Pg. No Rema
rks
1. Introduction to Company 8

2. Introduction to Project 9-11

3. SDLC 12-13

4. System Analysis need 14

5. Requirements need 14

6. DFD 15
7. Introduction to Android 16

8. Features of Android 16-18

9. Technology used (Front End) 19-21

10. Tools used for Android 22-23

11. Android Emulator, Manifest 24-25

12. Android Studio 26-28

13. Android Layouts ,UI 28-30


Controls
14. Additional Components 31-32

15. Coding 33-155

16. Screenshots 156-166


17. Hardware and Software 167
Requirements
18. Bibliography 168

7
Introduction to Company
Auribises offers a suite of mobile, web and software applications as a solution to
industry. The company was founded in November 2011. With unparalleled domain
competencies in mobile and web, Auribises is poised to take on critical challenges
that the industry manifests. Our culture is values based, and we assure the highest
ethical standards of integrity, transparency and corporate governance. Our value
system is driven by STAR, the acronym for our core values of Share, Time,
Achieve, and Respect. Auribises just not only develop, but also provide
educational services that help students to hone their technical skills. Auribises
offers a unique combination of technical competencies with practical exposure on
ongoing projects to its students. Auribises has a core vision for lightening
thousands of candles with a single candle and hence we believe that it is our
endeavor to continually share our learning’s with the larger world.

Services Offered by Company:

 Web Development
 Mobile Apps
 Technical Training
 Corporate Training

Training Programs:

Fundamentals - At Auribises we believe in making the strong base for any


competency. Stronger the base higher the altitude.
Practical - Achieving a concept without the practical implementation means
transferring the half knowledge. The fundamentals and the concepts are taught in a
practical fashion.
Balance - Balancing refers to create equilibrium between the knowledge
transferred and retain ability for a trainee.
Fulfillment - Until and unless the doubts are not clarified, moving ahead is
useless. Special sessions on doubt clearing are the key points where trainees may
get their queries resolved.

8
Introduction To Project
The Android Based college campus application is developed to provide students
information regarding college activities such as events organized at college level
and departmental level as well, curricular activities, general notices, placement
activities etc. This information should be provided to students in an effective way.

In a real world scenario such as college campus, information is provided in the


form of notices, hand written manuals, oral communication is spread among the
students .So to provide all this information at ease, we are developing this
application wherein students can access this information using their Android
enabled mobiles. So now students need not queue up near the notice board or log o
n to college website for any of the above mentioned details.

Today it is imperative to not only use the traditional forms of communication, but
also newer forms such as mobile technology for quicker and easier communication
among the students.
An android based college campus is an application that can be accessed throughout
the organization and especially by the students in a well manner with proper login
provided when needed. Using this application students will able to stay updated
with their assignments provided in the class, timetables of examinations,
attendance, etc.
An android based college campus to share the college campus activities application
will provide updates to the students of their respective departments, notices
regarding the recruiting company, campus interview date and other placement
activities.

Taking the manual work in the consideration, we can find that the Student has to
interact with the person in Office, brief on the requirements they expect and so on.
All these require more time and labour. The data collected may be inconsistent,
redundant and getting in touch with a remotes student will become impossible.
Instead of manual Notice Board College can use the electronic flow of data, at the
time of manual notice may occurs the errors but in the electronic flow system low
errors are occurs. Now a day’s everybody is using high quality and Android
supported mobiles. So in this project we are using Android for communication
between college and students.

9
Objective
The proposed system’s objectives are to overcome all the limitations and
drawbacks of the existing system. The online GCG application is user-friendly and
application. The main objective of the application is its simplicity of design and
ease of implementation that shows and helps to collect most of the information
about events going on in college premises. The interface will be very user-friendly.

The main objectives of the proposed system can be enumerated as follows:

 Faster dissemination of notices regarding education, technical events,


cultural events.
 Any lost/found going in college.
 Easy way to broadcast your messages.
 Helps you to be updated with whats going on College.
 Good way to advertise about Tuitions/Coaching and Courses.

Project Formulation
To develop a mobile application that will help you receiving the notices from the
college, anywhere, anytime. Earlier their problem that notices were pasted on the
notice board. If there is a holiday on the next day, nobody will be able to read it.
Moreover any update on website is also difficult. Everyone feels lazy to go and
update the website data. The more easy way is, just type in message sitting
wherever and post by pressing a button. It will notify all the staff and students,
registered with that application.

10
Identification of Need
 As we discussed earlier that manual maintenance of a notice is a tedious job.
So to enhance the ease of working, we go for this package.
 Giving the facility to convey message to all the students anytime and
anywhere.
 Making students updated about all the events and activities going on the
college.
 The student will not require standing in the crowd to see the notice. There
will be no issue of fighting in order to see the notice first. Everyone is first to
see that notice inside their own mobile phone anywhere and anytime.
 The least but most important it saves time.
 Utilizing less man power. As there are many persons involved in circulating
the message. With this application, only one person is required to post the
notice. Rest of the man power is saved in the entire process.

11
Software Development Life Cycle
Overview:

Software Development Life Cycle (SDLC) is a process used by the software


industry to design, develop and test high quality software. The SDLC aims to
produce high-quality software that meets or exceeds customer expectations,
reaches completion within times and cost estimates.

SDLC is a process followed for a software project, within a software organization.


It consists of a detailed plan describing how to develop, maintain, replace and alter
or enhance specific software. The life cycle defines a methodology for improving
the quality of software and the overall development process.

12
Purpose:
The purpose of a System Development Life Cycle methodology is to provide IT
Project Managers with the tools to help ensure successful implementation of
systems that satisfy Agency strategic and business objectives. The documentation
provides a mechanism to ensure leadership, functional managers and users sign-off
on the requirements and implementation of the system. The process provides
Agency managers and the project manager with the visibility of design,
development and implementation status needed to ensure delivery on-time and
within budget.

Goals:
 Deliver quality systems which meet or exceed customer expectations when
promised and within cost estimates.
 Provide a framework for developing quality systems using an identifiable,
measureable, and repeatable process.
 Establish a project management structure to ensure that each system
development project is effectively managed throughout its life lifecycle.
 Identify and assign the roles and responsibilities of all involved parties,
including functional and technical managers, throughout the system
development life cycle.
 Ensure that system development requirements are well defined and
subsequently satisfied.

Objectives
The System Development Life Cycle methodology will help to achieve these goals
by:

 Ensure the delivery of high quality systems.


 Provide strong management controls.
 Maximize productivity.
 To reduce the risk of project failure.
 To identify technical and management issues early.

13
System Analysis need
 The software we have on our home computers is very different to that
used on company computers
 The software is more complex hence problems that may arise are much
bigger, hence it would be too difficult for one person to manage alone,
we would need team of people
 In order to create and maintain a software for a company there would
need to be a formal plan
 System analysis is essential, to plan the software and to enable members
of the team to communicate during development and also afterwards.

Requirements Analysis:
When it comes to the success of life there needs to be perfection and the quality
of development and the strength of achievement. Success comes only when we
have all the above factors, and when talking about the software development
you need the analysis. Analysis of what is being introduced in the society, how
is it going to work and how will the market respond to it. This analysis is really
very important if you don't want failure at the first attempt of your introduction
to software. So you need software requirement analysis which will definitely
lead you to the heights of perfection when your software is introduced.

14
DFD
A data flow diagram is a graphical representation of the “flow” of data through an
information system, modeling its process aspects. A Data Flow Diagram is a
structured analysis and design tool that can be used for flowcharting in place of, or
in association with, information-oriented systems flowcharts. A DFD is often used
as a preliminary step to create an overview of the system, which can later be
elaborated. DFDs can also be used for the utilizing of data processing.

A DFD shows what kind of information will be input to and output from the
system, where the data will come from and go to, and where the data will be
stored. It does not show information about the timing of process or information
about whether processes will operate in sequence or in parallel.

Splash

Admin User

Login Login Registration

Add notice Home Activities

Delete notice
Contact us
Update notice
About Us
View all users
Home

Notice

15
Introduction to Android

Android is an open source and Linux-based Operating System for mobile devices
such as smart phones and tablet computers.

Android was developed by the Open Handset Alliance, led by Google, and other
companies.

Android offers a unified approach to application development for mobile devices


which means developers need only develop for Android, and their applications
should be able to run on different devices powered by Android.

The first beta version of the Android Software Development Kit(SDK) was released
by Google in 2007 where as the first commercial version ,Android 1.0 was released
in September 2008.

On June 27, 2012, at the Google I/O conference, Google announced the next
Android version 4.1 Jelly Bean. Jelly Bean is an incredible update, with the primary
aim of improving the user interface, both in terms of functionality and performance.

The source code for Android is available under free and open source software
licenses. Google publishes most of the code under the Apache License version 2.0
and the rest, Linux kernel changes, under the GNU General Public License version2.

Features of Android
With Android operating system (OS) Kit Kat version 4.4 rolling out to mobile
devices across the globe, Google is on to something—Android is now more
popular than iOS or the Windows phone. The OS tends to garner rave reviews for
its ease of use and open source, but many iOS or Windows phone users argue that
their preferred operating system can do just as much. In some respects that’s true,
but here are 10 features unique to Android’s OS.

1) Near Field Communication (NFC)


Most Android devices support NFC, which allows electronic devices to easily
interact across short distances. The main aim here is to create a payment option
that is simpler than carrying credit cards or cash, and while the market hasn’t
exploded as many experts had predicted, there may be an alternative in the works,
in the form of Bluetooth Low Energy (BLE).

16
2) Alternate Keyboards
Android supports multiple keyboards and makes them easy to install; the Swift
Key, Skype, and 8pen apps all offer ways to quickly change up your keyboard
style. Other mobile operating systems either don’t permit extra keyboards at all, or
the process to install and use them is tedious and time-consuming.

3) Infrared Transmission
The Android operating system supports a built-in infrared transmitter, allowing
you to use your phone or tablet as a remote control.

4) No-Touch Control
Using Android apps such as Wave Control, users can control their phones touch-
free, using only gestures. Have messy hands but need to turn off your screen or
change a song? Simple. This could prove especially useful if you’re driving, so you
can keep both eyes on the road.

5) Automation
The Tasker app lets you not only control app permissions but also automate them.
Do you only want your location services to be active during the day? Want to
create a customized way to start your music—for example, with a voice command
and at a certain volume? Tasker can help.

6) Wireless App Downloads


Accessing app stores on any mobile device can be frustrating, but iOS makes it a
little more difficult—download an app on your computer, and it won’t sync to your
mobile device until you plug in and access iTunes. Using the Android Market or
third-party options like AppBrain, meanwhile, let you download apps on your PC
and then automatically sync them your Droid, no plugging required.

7) Storage and Battery Swap


Android phones also have unique hardware capabilities. Google’s OS makes it
possible to remove and upgrade your battery or to replace one that no longer holds
a charge. In addition, Android phones come with SD card slots for expandable
storage.

8) Custom Home Screens


While it’s possible to hack certain phones to customize the home screen, Android
comes with this capability from the get-go. Download a third-party launcher like

17
Nova, Apex or Slide and you can add gestures, new shortcuts, or even performance
enhancements for older-model devices.

9) Widgets
Apps are versatile, but sometimes you want information at a glance instead of
having to open an app and wait for it to load. Android widgets let you display just
about any feature you choose, right on the home screen—including weather apps,
music widgets, or productivity tools that helpfully remind you of upcoming
meetings or approaching deadlines.

10) Custom ROMs


This is a big one. Because the Android operating system is open source, developers
can tweak the current OS and build their own versions, which users can download
and install in place of the stock OS. Some are filled with features, while others
change the look and feel of a device. Chances are if there’s a feature you want,
someone has already built a custom ROM for it.

Android Applications:
Android applications are usually developed in the Java language using the Android
Software Development Kit. Once developed, Android applications can be packaged
easily and sold out either through a store such as Google Play or the Amazon
Appstore. Android powers hundreds of millions of mobile devices in more than 190
countries around the world. It’s the largest installed base of any mobile platform and
growing fast. Every day more than 1 million new Android devices are activated
worldwide.

18
Technology Used
Front End

 Android software development kit

The android software development kit (SDK) includes a comprehensive set of


development tools. These include a debugger, libraries, a handset emulator based
on QEMU, documentation, sample code and tutorials. Currently supported
development platforms include computers running Linux, Mac OS X 10.5.8 or
later, and Windows XP or later. As of March 2015, the SDK is not available on
Android itself, but the software development is possible by using specialized
Android applications.

Android Studio, made by Google and powered by IntelliJ, is the official IDE;
however, developers are free to use others. Additionally, developers may use any
text editor to edit Java and XML files ,then use command line tools(Java
Development Kit and Apache Ant are required) to create ,build and debug Android
applications as well as control attached Android devices

 Java development Kit

The Android build process depends on a number of tools from the JDK. Check out
the build system overview documentation. The first big piece we need from JDK is
javac all your source code written in Java needs to be completed before it can be
converted to the DEX format.

Once your code has been compiled, dexed, and packaged into an APK, we need jar
signer to sign the APK.

There are some efforts out there to bring Java 8 features to Android, most notably
gradle. Some of these require JDK 8 to compile properly.

19
Back End:

Firebase Connectivity:

Firebase is also a database backend for android, iOS and web applications.
Firebase is Google provided API to create a database and fetch from it in real time
with only a few lines of code. Data is stored as JSON and is accessible from all the
platforms. Firebase is a paid service and you get 200 MB of storage space for free.

Firebase Features: Once firebase API included into android or iOS application,
one can you firebase features with simple lines of code. How to add firebase to the
android application is covered in next section. Firebase provided features are listed
below:

1. Analytics: This feature enables the application developer to understand how


users are using his application. The SDK capture events and properties on its own
and also allows you to get custom data. The dashboard provides details like your
most active user or what feature of your application is used most. It also provides
you with summarized data.

2. Authentication: Auth feature in firebase let you let only authorized users access
your application. Firebase provides login through Gmail, Github, twitter, facebook
and also let the developer create custom authentication.

3. Messaging: Firebase cloud messaging lets you to deliver messages to different


platforms at no cost. Messaging is also used for notifications purposes.

4. Real-time Database: Database in firebase is a cloud-based database and does


not need SQL-based queries to store and fetch data. Database is highly reliable and
superfast means that data is updated and synchronized in no time and data is
maintained even user lose internet connection

5. Storage: Firebase also provides storage facility. It can store and retrieve content
like images, videos and audio directly from client SDK. Uploading and
downloading is done in the background. Data stores are safe and the only
authorized user can access it.

6. Hosting: firebase is also used for hosting purposes. Firebase delivers web
content very fast and content is always delivered securely
20
7. Crash reporting: crash reporting feature on firebase creates reports of error in
your app after its release. Errors are grouped into different groups according to
how severe error is. You can also create custom events to catch steps leading to the
crashing of the application.

Adding Firebase to Your Project

You can add firebase API to any project intended for Android 2.3 (Gingerbread) or
newer and have Google Play services 9.6.1 or newer. Following steps are followed
next:

1. You have to create a project in firebase console. Enter project name and your
location. Project name under firebase console can be anything and can also be
different from your application name.

2. Click on Add Firebase to your Android app and follow steps mentioned there.

3. You will be prompted with a page asking your package name and optional
SHA-1 certificate. You can get your SHA-1 code from android studio easily.

4. After completion of above steps a google-services.json file will be downloaded.


You can also download this file again at any time. 5. Copy this downloaded file
into your project’s app/ module folder. After these steps, firebase is added to your
project.

After adding firebase to your android project you have to integrate Firebase
libraries into your project by following steps:

1. Add rules to your build.gradlefile, to include google-services plugin: build script


{ // …. dependencies { //…. class path ‘ com.google.gms:google-services:3.0.0’ }
}

2. Then in app/build.gradle file add: apply plugin: ‘com.google.gms.google-


services’

21
Tools used for project
 Android Studio

Android Studio is the official integrated development environment (IDE) for


Android platform development.

It was announced on May 16, 2013 at the Google I/O conference. Android Studio
is freely available under the Apache License 2.0.

Android Studio was in early access preview stage starting from version 0.1 in May
2013, then entered beta stage starting from version 0.8 which was released in June
2014.

Based on Jet Brains IntelliJ IDEA software, Android studio is designed specifically
for Android development. It is available for download on Windows, Mac OS X
and Linux, and replaced Eclipse Android Development Tools (ADT) as Google’s
primary IDE for native Android application development

Android Tool 1: Eclipse W/ADT

Although Eclipse is not the only Java development environment that can be used to
develop Android applications, it is by far the most popular. This is partially due to
its cost (free) but mostly due the strong integration of the Android tools with
Eclipse. This integration is achieved with the Android Development Tools (ADT)
plug-in for Eclipse, which can be downloaded from the Android website.

22
Android Tool 2: The SDK and AVD Manager

This tool serves a number of important functions. It manages the different versions
of the Android SDKs that you can develop for, as well as third-party add-ons,
tools, devices drivers, and documentation. Its second function is to manage the
Android Virtual Device configuration (AVDs) you use to configure emulator
instances.

Android Tool 3: Android Debug Bridge

The Android Debug Bridge (ADB) connects other tools with the emulator and
devices. Besides being critical for the other tools to function, you can use it
yourself from the command line to upload and download files, install and uninstall
packages, and access many other features via the shell on the device or emulator.

Emulator in Android
An Android emulator is an Android Virtual Device (AVD) that represents a
specific Android device. You can use an Android emulator as a target platform to
run and test your Android applications on your PC.

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

<manifest ... >


<application ... >
<activity android: name="com.example.myapp.MainActivity" ... >
</activity>
</application>
</manifest>

Android Studio:

Android Studio replaced Eclipse as the main IDE for Android development in
2014. With this change Google has revamped the way developers can take
advantage of all the Android development tools.
Creating a new application:

24
25
26
Android Layout Types
There are number of Layouts provided by Android which you will use in almost
all the Android applications to provide different view, look and feel.

Sr.No Layout & Description

1 Linear Layout

Linear Layout is a view group that aligns all children in a single


direction, vertically or horizontally.

2 Relative Layout

Relative Layout is a view group that displays child views in relative


positions.

3 Table Layout

Table Layout is a view that groups views into rows and columns.

4 Absolute Layout

Absolute Layout enables you to specify the exact location of its


children.

5 List View

List View is a view group that displays a list of scrollable items.

27
Layout Attributes
Each layout has a set of attributes which define the visual properties of that layout.
There are few common attributes among all the layouts and their are other
attributes which are specific to that layout. Following are common attributes and
will be applied to all the layouts:

Sr.No Attribute & Description

1 android:id
This is the ID which uniquely identifies the view.

2 android:layout_width
This is the width of the layout.

3 android:layout_height
This is the height of the layout

4 android:layout_marginTop
This is the extra space on the top side of the layout.

5 android:layout_marginBottom
This is the extra space on the bottom side of the layout.

6 android:layout_marginLeft
This is the extra space on the left side of the layout.

7 android:layout_marginRight
This is the extra space on the right side of the layout.

28
8 android:layout_gravity
This specifies how child Views are positioned.

9 android:layout_weight
This specifies how much of the extra space in the layout should
be allocated to the View.

10 android:layout_x
This specifies the x-coordinate of the layout.

11 android:layout_y
This specifies the y-coordinate of the layout.

12 android:layout_width
This is the width of the layout.

13 android:layout_width
This is the width of the layout.

14 android:paddingLeft
This is the left padding filled for the layout.

15 android:paddingRight
This is the right padding filled for the layout.

16 android:paddingTop
This is the top padding filled for the layout.

29
Android UI Controls
There are number of UI controls provided by Android that allow you to build the
graphical user interface for your app.

Sr.No. UI Control & Description

1 TextView

This control is used to display text to the user.

2 EditText

EditText is a predefined subclass of TextView that includes rich


editing capabilities.

3 AutoCompleteTextView

The AutoCompleteTextView is a view that is similar to EditText,


except that it shows a list of completion suggestions automatically
while the user is typing.

4 Button

A push-button that can be pressed, or clicked, by the user to perform


an action.

5 ImageButton

An ImageButton is an Absolute Layout which enables you to


specify the exact location of its children. This shows a button with
an image (instead of text) that can be pressed or clicked by the user.

6 CheckBox

An on/off switch that can be toggled by the user. You should use
check box when presenting users with a group of selectable options

30
that are not mutually exclusive.

7 ToggleButton

An on/off button with a light indicator.

8 RadioButton

The RadioButton has two states: either checked or unchecked.

9 RadioGroup

A RadioGroup is used to group together one or more Radio Buttons.

10 ProgressBar

The ProgressBar view provides visual feedback about some ongoing


tasks, such as when you are performing a task in the background.

11 Spinner

A drop-down list that allows users to select one value from a set.

12 TimePicker

The TimePicker view enables users to select a time of the day, in


either 24-hour mode or AM/PM mode.

13 DatePicker

The DatePicker view enables users to select a date of the day.

31
Additional Components
There are additional components which will be used in the construction of above
mentioned entities, their logic, and wiring between them. These components are –

Sr.No Components & Description

1 Fragments
Represents a portion of user interface in an Activity.

Views
2
UI elements that are drawn on-screen including buttons, lists forms
etc.

Layouts
3
View hierarchies that control screen format and appearance of the
views.

Intents
4
Messages wiring components together.

Resources
5
External elements, such as strings, constants and drawable pictures.

Manifest
6
Configurations file for the application.

32
CODING:

Notice Adapter

package com.example.scdapp.adapter;
import android.content.Context;
import android.support.annotation.NonNull;
import android.support.v4.app.FragmentActivity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.example.scdapp.R;
import com.example.scdapp.holder.NoticeHolder;
import com.example.scdapp.listener.OnRecyclerItemClickListener;
import com.example.scdapp.listener.RecyclerAdapterClickListener;
import com.example.scdapp.model.Notice;
import com.example.scdapp.model.User;
import com.example.scdapp.ui.NoticeBoard;
import com.firebase.ui.firestore.FirestoreRecyclerAdapter;
import com.firebase.ui.firestore.FirestoreRecyclerOptions;
public class NoticeAdapter extends
FirestoreRecyclerAdapter<Notice,NoticeHolder> implements
OnRecyclerItemClickListener {
RecyclerAdapterClickListener recyclerAdapterClickListener;
public void setRecyclerAdapterClickListener(RecyclerAdapterClickListener
recyclerAdapterClickListener) {
this.recyclerAdapterClickListener = recyclerAdapterClickListener;
}

public NoticeAdapter(FirestoreRecyclerOptions<Notice> options) {


super(options);
}

@Override
protected void onBindViewHolder(NoticeHolder holder, int position, Notice
model) {

holder.txtName.setText(model.title);
holder.txtEmail.setText(model.body);
holder.txtdate.setText(model.date);

33
}

@NonNull
@Override
public NoticeHolder onCreateViewHolder(@NonNull ViewGroup parent, int
viewType) {

View view =
LayoutInflater.from(parent.getContext()).inflate(R.layout.list_item1, parent, false);

NoticeHolder noticeHolder = new NoticeHolder(view);


noticeHolder.setOnRecyclerItemClickListener(this);

return noticeHolder;
}

// If any data shall be changed on server, this method will be executed


@Override
public void onDataChanged() {
super.onDataChanged();

@Override
public void onRecyclerItemClicked() {
recyclerAdapterClickListener.onRecyclerAdapterClicked(0);
}
}

PrincipalAdapter

package com.example.scdapp.adapter;
import android.content.Context;
import android.support.annotation.NonNull;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;

34
import com.example.scdapp.R;
import com.example.scdapp.holder.NoticeHolder;
import com.example.scdapp.holder.PrincipalHolder;
import com.example.scdapp.listener.OnRecyclerItemClickListener;
import com.example.scdapp.listener.RecyclerAdapterClickListener;
import com.example.scdapp.model.Notice;
import com.example.scdapp.model.PrincipalNotice;
import com.firebase.ui.firestore.FirestoreRecyclerAdapter;
import com.firebase.ui.firestore.FirestoreRecyclerOptions;
import com.google.android.gms.tasks.OnFailureListener;
import com.google.android.gms.tasks.OnSuccessListener;
import com.google.firebase.firestore.FirebaseFirestore;

/**
* Created by admin on 4/22/2018.
*/

public class PrincipalAdapter extends


FirestoreRecyclerAdapter<PrincipalNotice,PrincipalHolder> implements
OnRecyclerItemClickListener {

Context context;
PrincipalNotice notice;
FirebaseFirestore firestore;
RecyclerAdapterClickListener recyclerAdapterClickListener;

public void setRecyclerAdapterClickListener(RecyclerAdapterClickListener


recyclerAdapterClickListener) {
this.recyclerAdapterClickListener = recyclerAdapterClickListener;
}
public PrincipalAdapter(FirestoreRecyclerOptions<PrincipalNotice> options) {
super(options);
this.context = context;
firestore = FirebaseFirestore.getInstance();
notice=new PrincipalNotice();
}

@Override
protected void onBindViewHolder(PrincipalHolder holder, int position,
PrincipalNotice model) {
35
holder.txtName.setText(model.title);
holder.txtEmail.setText(model.body);
holder.txtdate.setText(model.date);
}

@NonNull
@Override
public PrincipalHolder onCreateViewHolder(@NonNull ViewGroup parent, int
viewType) {

View view =
LayoutInflater.from(parent.getContext()).inflate(R.layout.list_item2, parent, false);

PrincipalHolder noticeHolder = new PrincipalHolder(view);


noticeHolder.setOnRecyclerItemClickListener(this);
return noticeHolder;
}

// If any data shall be changed on server, this method will be executed


@Override
public void onDataChanged() {
super.onDataChanged();

@Override
public void onRecyclerItemClicked() {
firestore.collection("principalnotice").document(String.valueOf(notice)).delete().ad
dOnSuccessListener(new OnSuccessListener<Void>() {
@Override
public void onSuccess(Void aVoid) {
Toast.makeText(context,"deleted
successfully",Toast.LENGTH_LONG).show();
}
}).addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
Toast.makeText(context,"deleted not
successfully",Toast.LENGTH_LONG).show();
36
}
});
recyclerAdapterClickListener.onRecyclerAdapterClicked(0);
}
}

UserAdapter

package com.example.scdapp.adapter;
import android.support.annotation.NonNull;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.example.scdapp.R;
import com.example.scdapp.holder.UserHolder;
import com.example.scdapp.listener.OnRecyclerItemClickListener;
import com.example.scdapp.listener.RecyclerAdapterClickListener;
import com.example.scdapp.model.User;
import com.firebase.ui.firestore.FirestoreRecyclerAdapter;
import com.firebase.ui.firestore.FirestoreRecyclerOptions;

public class UserAdapter extends FirestoreRecyclerAdapter<User,UserHolder>


implements OnRecyclerItemClickListener{

RecyclerAdapterClickListener recyclerAdapterClickListener;

public void setRecyclerAdapterClickListener(RecyclerAdapterClickListener


recyclerAdapterClickListener){
this.recyclerAdapterClickListener = recyclerAdapterClickListener;
}

public UserAdapter(FirestoreRecyclerOptions<User> options) {


super(options);
}

@Override
protected void onBindViewHolder(UserHolder holder, int position, User model)
{

37
holder.txtName.setText(model.name);
holder.txtEmail.setText(model.email);
}

@NonNull
@Override
public UserHolder onCreateViewHolder(@NonNull ViewGroup parent, int
viewType) {

View view =
LayoutInflater.from(parent.getContext()).inflate(R.layout.list_item,parent,false);

UserHolder userHolder = new UserHolder(view);


userHolder.setOnRecyclerItemClickListener(this);

return userHolder;
}

// If any data shall be changed on server, this method will be executed


@Override
public void onDataChanged() {
super.onDataChanged();

@Override
public void onRecyclerItemClicked() {
recyclerAdapterClickListener.onRecyclerAdapterClicked(0);
}
}

NoticeHolder

package com.example.scdapp.holder;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.TextView;

38
import com.example.scdapp.R;
import com.example.scdapp.listener.OnRecyclerItemClickListener;
public class NoticeHolder extends RecyclerView.ViewHolder implements
View.OnClickListener {

public TextView txtName;


public TextView txtEmail;
public TextView txtdate;

OnRecyclerItemClickListener recyclerItemClickListener = null;

public void setOnRecyclerItemClickListener(OnRecyclerItemClickListener


recyclerItemClickListener) {
this.recyclerItemClickListener = recyclerItemClickListener;
}

public NoticeHolder(@NonNull View itemView) {


super(itemView);

txtName = itemView.findViewById(R.id.textViewName7);
txtEmail = itemView.findViewById(R.id.textViewEmail7);
txtdate=itemView.findViewById(R.id.textdate);

itemView.setOnClickListener(this);
}

@Override
public void onClick(View v) {

recyclerItemClickListener.onRecyclerItemClicked();

}
}

PrincipalHolder

package com.example.scdapp.holder;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;

39
import android.view.View;
import android.widget.TextView;
import com.example.scdapp.R;
import com.example.scdapp.listener.OnRecyclerItemClickListener;
public class PrincipalHolder extends RecyclerView.ViewHolder implements
View.OnClickListener {
public TextView txtName;
public TextView txtEmail;
public TextView txtdate;

OnRecyclerItemClickListener recyclerItemClickListener = null;

public void setOnRecyclerItemClickListener(OnRecyclerItemClickListener


recyclerItemClickListener) {
this.recyclerItemClickListener = recyclerItemClickListener;
}

public PrincipalHolder(@NonNull View itemView) {


super(itemView);

txtName = itemView.findViewById(R.id.textViewName8);
txtEmail = itemView.findViewById(R.id.textViewEmail8);
txtdate=itemView.findViewById(R.id.textdate8);

itemView.setOnClickListener(this);
}

@Override
public void onClick(View v) {
recyclerItemClickListener.onRecyclerItemClicked();
}
}

UserHolder

package com.example.scdapp.holder;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.view.View;

40
import android.widget.TextView;
import com.example.scdapp.R;
import com.example.scdapp.listener.OnRecyclerItemClickListener;
import com.example.scdapp.adapter.UserAdapter;

public class UserHolder extends RecyclerView.ViewHolder implements


View.OnClickListener{

public TextView txtName;


public TextView txtEmail;

OnRecyclerItemClickListener recyclerItemClickListener = null;

public void setOnRecyclerItemClickListener(UserAdapter


recyclerItemClickListener){
this.recyclerItemClickListener = recyclerItemClickListener;
}

public UserHolder(@NonNull View itemView) {


super(itemView);

txtName = itemView.findViewById(R.id.textViewName);
txtEmail = itemView.findViewById(R.id.textViewEmail);

itemView.setOnClickListener(this);
}

@Override
public void onClick(View v) {

recyclerItemClickListener.onRecyclerItemClicked();

}
}

OnRecyclerItemClickListener

package com.example.scdapp.listener;
public interface OnRecyclerItemClickListener {

41
void onRecyclerItemClicked();
}

OnRecyclerAdapterClickListener

package com.example.scdapp.listener;

public interface RecyclerAdapterClickListener {


void onRecyclerAdapterClicked(int position);
}

Grid

package com.example.scdapp.model;
public class Grid {
int icon;
String name;
public Grid(){
}

public Grid(int icon, String name) {


this.icon = icon;
this.name = name;
}

public int getIcon() {


return icon;
}

public String getName() {


return name;
}
}

GridAdapter

package com.example.scdapp.model;
import android.content.Context;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;

42
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import com.example.scdapp.R;
import android.widget.ImageView;
import android.widget.TextView;
import java.util.ArrayList;
import java.util.List;

public class GridAdapter extends ArrayAdapter<Grid> {

Context context;
int resource;
ArrayList<Grid> gridList;
public GridAdapter(Context context, int resource, ArrayList<Grid> objects) {
super(context, resource, objects);
this.context=context;
this.resource=resource;
this.gridList=objects;
}

@Override
public View getView(int position, @Nullable View convertView, @NonNull
ViewGroup parent) {

View view=null;
view= LayoutInflater.from(context).inflate(resource,parent,false);
ImageView imageView=view.findViewById(R.id.imageView);
TextView textView=view.findViewById(R.id.textName);

Grid grid=gridList.get(position);
imageView.setBackgroundResource(grid.getIcon());
textView.setText(grid.getName());

return view;
}
}

43
ModelClass

package com.example.scdapp.model;
public class ModelClass {

String title,image;
public ModelClass(){

}
public ModelClass(String title, String image) {
this.title = title;
this.image = image;
}

public String getTitle() {


return title;
}

public void setTitle(String title) {


this.title = title;
}

public String getImage() {


return image;
}

public void setImage(String image) {


this.image = image;
}
}

Notice

package com.example.scdapp.model;
public class Notice {
public String title;
public String body;
public String date;

44
public Notice(){

}
public Notice(String title, String body, String date) {
this.title = title;
this.body = body;
this.date = date;
}
}

PrincipalNotice

package com.example.scdapp.model;
public class PrincipalNotice {

public String title;


public String body;
public String date;
public PrincipalNotice(){

}
public PrincipalNotice(String title, String body, String date) {
this.title = title;
this.body = body;
this.date = date;
}
}

User

package com.example.scdapp.model;
public class User {

public String email;


public String password;
public String city;
public String class1;
45
public String gender;
public String name;
public String phoneno;
public String rollno;
public User(){

public User(String email, String password, String city, String class1, String
gender, String name, String phoneno, String rollno) {
this.email = email;
this.password = password;
this.city = city;
this.class1 = class1;
this.gender = gender;
this.name = name;
this.phoneno = phoneno;
this.rollno = rollno;
}
}

MybaseTaskService

package com.example.scdapp.storage;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.support.v4.app.NotificationCompat;
import android.util.Log;
import com.example.scdapp.R;
public abstract class MyBaseTaskService extends Service {

private static final String CHANNEL_ID_DEFAULT = "default";

46
static final int PROGRESS_NOTIFICATION_ID = 0;
static final int FINISHED_NOTIFICATION_ID = 1;
private static final String TAG = "MyBaseTaskService";
private int mNumTasks = 0;

public void taskStarted() {


changeNumberOfTasks(1);
}

public void taskCompleted() {


changeNumberOfTasks(-1);
}

private synchronized void changeNumberOfTasks(int delta) {


Log.d(TAG, "changeNumberOfTasks:" + mNumTasks + ":" + delta);
mNumTasks += delta;

// If there are no tasks left, stop the service


if (mNumTasks <= 0) {
Log.d(TAG, "stopping");
stopSelf();
}
}

private void createDefaultChannel() {


// Since android Oreo notification channel is needed.
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
NotificationManager nm = (NotificationManager)
getSystemService(NOTIFICATION_SERVICE);

NotificationChannel channel = new


NotificationChannel(CHANNEL_ID_DEFAULT,
"Default",
NotificationManager.IMPORTANCE_DEFAULT);
nm.createNotificationChannel(channel);
}
}

47
/**
* Show notification with a progress bar.
*/
protected void showProgressNotification(String caption, long completedUnits,
long totalUnits) {
int percentComplete = 0;
if (totalUnits > 0) {
percentComplete = (int) (100 * completedUnits / totalUnits);
}

createDefaultChannel();
NotificationCompat.Builder builder = new NotificationCompat.Builder(this,
CHANNEL_ID_DEFAULT)
.setSmallIcon(R.drawable.ic_file_upload_white_24dp)
.setContentTitle(getString(R.string.app_name))
.setContentText(caption)
.setProgress(100, percentComplete, false)
.setOngoing(true)
.setAutoCancel(false);

NotificationManager manager =
(NotificationManager)
getSystemService(Context.NOTIFICATION_SERVICE);

manager.notify(PROGRESS_NOTIFICATION_ID, builder.build());
}

/**
* Show notification that the activity finished.
*/
protected void showFinishedNotification(String caption, Intent intent, boolean
success) {
// Make PendingIntent for notification
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0 /*
requestCode */, intent,
PendingIntent.FLAG_UPDATE_CURRENT);

int icon = success ? R.drawable.ic_check_white_24 :


R.drawable.ic_error_white_24dp;

48
createDefaultChannel();
NotificationCompat.Builder builder = new NotificationCompat.Builder(this,
CHANNEL_ID_DEFAULT)
.setSmallIcon(icon)
.setContentTitle(getString(R.string.app_name))
.setContentText(caption)
.setAutoCancel(true)
.setContentIntent(pendingIntent);

NotificationManager manager =
(NotificationManager)
getSystemService(Context.NOTIFICATION_SERVICE);

manager.notify(FINISHED_NOTIFICATION_ID, builder.build());
}

/**
* Dismiss the progress notification.
*/
protected void dismissProgressNotification() {
NotificationManager manager =
(NotificationManager)
getSystemService(Context.NOTIFICATION_SERVICE);

manager.cancel(PROGRESS_NOTIFICATION_ID);
}
}
MyDownloadService /**
* Copyright 2016 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
or implied.
49
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.example.scdapp.storage;

import android.content.Intent;
import android.content.IntentFilter;
import android.os.IBinder;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.content.LocalBroadcastManager;
import android.util.Log;
import com.example.scdapp.R;
import com.example.scdapp.ui.MainActivity;
import com.google.android.gms.tasks.OnFailureListener;
import com.google.android.gms.tasks.OnSuccessListener;
import com.google.firebase.storage.FirebaseStorage;
import com.google.firebase.storage.StorageReference;
import com.google.firebase.storage.StreamDownloadTask;

import java.io.IOException;
import java.io.InputStream;

/**
* Service to handle downloading files from Firebase Storage.
*/
public class MyDownloadService extends MyBaseTaskService {

private static final String TAG = "Storage#DownloadService";

/** Actions **/


public static final String ACTION_DOWNLOAD = "action_download";
public static final String DOWNLOAD_COMPLETED =
"download_completed";
public static final String DOWNLOAD_ERROR = "download_error";

/** Extras **/


public static final String EXTRA_DOWNLOAD_PATH =
"extra_download_path";
50
public static final String EXTRA_BYTES_DOWNLOADED =
"extra_bytes_downloaded";

private StorageReference mStorageRef;

@Override
public void onCreate() {
super.onCreate();

// Initialize Storage
mStorageRef = FirebaseStorage.getInstance().getReference();
}

@Nullable
@Override
public IBinder onBind(Intent intent) {
return null;
}

@Override
public int onStartCommand(Intent intent, int flags, int startId) {
Log.d(TAG, "onStartCommand:" + intent + ":" + startId);

if (ACTION_DOWNLOAD.equals(intent.getAction())) {
// Get the path to download from the intent
String downloadPath =
intent.getStringExtra(EXTRA_DOWNLOAD_PATH);
downloadFromPath(downloadPath);
}

return START_REDELIVER_INTENT;
}

private void downloadFromPath(final String downloadPath) {


Log.d(TAG, "downloadFromPath:" + downloadPath);

// Mark task started


taskStarted();
showProgressNotification(getString(R.string.progress_downloading), 0, 0);

51
// Download and get total bytes
mStorageRef.child(downloadPath).getStream(
new StreamDownloadTask.StreamProcessor() {
@Override
public void doInBackground(StreamDownloadTask.TaskSnapshot
taskSnapshot,
InputStream inputStream) throws IOException {
long totalBytes = taskSnapshot.getTotalByteCount();
long bytesDownloaded = 0;

byte[] buffer = new byte[1024];


int size;

while ((size = inputStream.read(buffer)) != -1) {


bytesDownloaded += size;

showProgressNotification(getString(R.string.progress_downloading),
bytesDownloaded, totalBytes);
}

// Close the stream at the end of the Task


inputStream.close();
}
})
.addOnSuccessListener(new
OnSuccessListener<StreamDownloadTask.TaskSnapshot>() {
@Override
public void onSuccess(StreamDownloadTask.TaskSnapshot
taskSnapshot) {
Log.d(TAG, "download:SUCCESS");

// Send success broadcast with number of bytes downloaded


broadcastDownloadFinished(downloadPath,
taskSnapshot.getTotalByteCount());
showDownloadFinishedNotification(downloadPath, (int)
taskSnapshot.getTotalByteCount());

// Mark task completed


taskCompleted();
}
52
})
.addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception exception) {
Log.w(TAG, "download:FAILURE", exception);

// Send failure broadcast


broadcastDownloadFinished(downloadPath, -1);
showDownloadFinishedNotification(downloadPath, -1);

// Mark task completed


taskCompleted();
}
});
}

/**
* Broadcast finished download (success or failure).
* @return true if a running receiver received the broadcast.
*/
private boolean broadcastDownloadFinished(String downloadPath, long
bytesDownloaded) {
boolean success = bytesDownloaded != -1;
String action = success ? DOWNLOAD_COMPLETED :
DOWNLOAD_ERROR;

Intent broadcast = new Intent(action)


.putExtra(EXTRA_DOWNLOAD_PATH, downloadPath)
.putExtra(EXTRA_BYTES_DOWNLOADED, bytesDownloaded);
return LocalBroadcastManager.getInstance(getApplicationContext())
.sendBroadcast(broadcast);
}

/**
* Show a notification for a finished download.
*/
private void showDownloadFinishedNotification(String downloadPath, int
bytesDownloaded) {
// Hide the progress notification
dismissProgressNotification();
53
// Make Intent to MainActivity
Intent intent = new Intent(this, MainActivity.class)
.putExtra(EXTRA_DOWNLOAD_PATH, downloadPath)
.putExtra(EXTRA_BYTES_DOWNLOADED, bytesDownloaded)
.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP |
Intent.FLAG_ACTIVITY_SINGLE_TOP);

boolean success = bytesDownloaded != -1;


String caption = success ? getString(R.string.download_success) :
getString(R.string.download_failure);
showFinishedNotification(caption, intent, true);
}

public static IntentFilter getIntentFilter() {


IntentFilter filter = new IntentFilter();
filter.addAction(DOWNLOAD_COMPLETED);
filter.addAction(DOWNLOAD_ERROR);

return filter;
}
}

MyUploadService

package com.example.scdapp.storage;
import android.content.Intent;
import android.content.IntentFilter;
import android.net.Uri;
import android.os.IBinder;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.content.LocalBroadcastManager;
import android.util.Log;
import com.example.scdapp.R;
import com.example.scdapp.ui.MainActivity;
import com.google.android.gms.tasks.OnFailureListener;
import com.google.android.gms.tasks.OnSuccessListener;
import com.google.firebase.storage.FirebaseStorage;

54
import com.google.firebase.storage.OnProgressListener;
import com.google.firebase.storage.StorageReference;
import com.google.firebase.storage.UploadTask;

/**
* Service to handle uploading files to Firebase Storage.
*/
public class MyUploadService extends MyBaseTaskService {

private static final String TAG = "MyUploadService";

/** Intent Actions **/


public static final String ACTION_UPLOAD = "action_upload";
public static final String UPLOAD_COMPLETED = "upload_completed";
public static final String UPLOAD_ERROR = "upload_error";

/** Intent Extras **/


public static final String EXTRA_FILE_URI = "extra_file_uri";
public static final String EXTRA_DOWNLOAD_URL = "extra_download_url";

// [START declare_ref]
private StorageReference mStorageRef;
// [END declare_ref]

@Override
public void onCreate() {
super.onCreate();

// [START get_storage_ref]
mStorageRef = FirebaseStorage.getInstance().getReference();
// [END get_storage_ref]
}

@Nullable
@Override
public IBinder onBind(Intent intent) {
return null;
}

@Override
55
public int onStartCommand(Intent intent, int flags, int startId) {
Log.d(TAG, "onStartCommand:" + intent + ":" + startId);
if (ACTION_UPLOAD.equals(intent.getAction())) {
Uri fileUri = intent.getParcelableExtra(EXTRA_FILE_URI);
uploadFromUri(fileUri);
}

return START_REDELIVER_INTENT;
}

// [START upload_from_uri]
private void uploadFromUri(final Uri fileUri) {
Log.d(TAG, "uploadFromUri:src:" + fileUri.toString());

// [START_EXCLUDE]
taskStarted();
showProgressNotification(getString(R.string.progress_uploading), 0, 0);
// [END_EXCLUDE]

// [START get_child_ref]
// Get a reference to store file at photos/<FILENAME>.jpg
final StorageReference photoRef = mStorageRef.child("photos")
.child(fileUri.getLastPathSegment());
// [END get_child_ref]

// Upload file to Firebase Storage


Log.d(TAG, "uploadFromUri:dst:" + photoRef.getPath());
photoRef.putFile(fileUri).
addOnProgressListener(new
OnProgressListener<UploadTask.TaskSnapshot>() {
@Override
public void onProgress(UploadTask.TaskSnapshot taskSnapshot) {
showProgressNotification(getString(R.string.progress_uploading),
taskSnapshot.getBytesTransferred(),
taskSnapshot.getTotalByteCount());
}
})
.addOnSuccessListener(new
OnSuccessListener<UploadTask.TaskSnapshot>() {
@Override

56
public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {
// Upload succeeded
Log.d(TAG, "uploadFromUri:onSuccess");

// Get the public download URL


Uri downloadUri = taskSnapshot.getMetadata().getDownloadUrl();

// [START_EXCLUDE]
broadcastUploadFinished(downloadUri, fileUri);
showUploadFinishedNotification(downloadUri, fileUri);
taskCompleted();
// [END_EXCLUDE]
}
})
.addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception exception) {
// Upload failed
Log.w(TAG, "uploadFromUri:onFailure", exception);

// [START_EXCLUDE]
broadcastUploadFinished(null, fileUri);
showUploadFinishedNotification(null, fileUri);
taskCompleted();
// [END_EXCLUDE]
}
});
}
// [END upload_from_uri]

/**
* Broadcast finished upload (success or failure).
* @return true if a running receiver received the broadcast.
*/
private boolean broadcastUploadFinished(@Nullable Uri downloadUrl,
@Nullable Uri fileUri) {
boolean success = downloadUrl != null;

String action = success ? UPLOAD_COMPLETED : UPLOAD_ERROR;

57
Intent broadcast = new Intent(action)
.putExtra(EXTRA_DOWNLOAD_URL, downloadUrl)
.putExtra(EXTRA_FILE_URI, fileUri);
return LocalBroadcastManager.getInstance(getApplicationContext())
.sendBroadcast(broadcast);
}

/**
* Show a notification for a finished upload.
*/
private void showUploadFinishedNotification(@Nullable Uri downloadUrl,
@Nullable Uri fileUri) {
// Hide the progress notification
dismissProgressNotification();

// Make Intent to MainActivity


Intent intent = new Intent(this, MainActivity.class)
.putExtra(EXTRA_DOWNLOAD_URL, downloadUrl)
.putExtra(EXTRA_FILE_URI, fileUri)
.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP |
Intent.FLAG_ACTIVITY_SINGLE_TOP);

boolean success = downloadUrl != null;


String caption = success ? getString(R.string.upload_success) :
getString(R.string.upload_failure);
showFinishedNotification(caption, intent, success);
}

public static IntentFilter getIntentFilter() {


IntentFilter filter = new IntentFilter();
filter.addAction(UPLOAD_COMPLETED);
filter.addAction(UPLOAD_ERROR);

return filter;
}

58
AboutUs

package com.example.scdapp.ui;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.example.scdapp.R;
public class AboutUs extends Fragment {
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup
container, @Nullable Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_about_us,null);
}

@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState)
{
super.onViewCreated(view, savedInstanceState);
}
}

AddNoticeActivity

package com.example.scdapp.ui;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import com.example.scdapp.R;
public class AddNoticeActivity extends AppCompatActivity {
Button btn1,btn2;
ImageView imgnotice,imgnotice2;

59
void initviews(){
btn1=findViewById(R.id.button9);
imgnotice=findViewById(R.id.imagedailynotice);
imgnotice2=findViewById(R.id.imageView5);
btn1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent=new Intent(AddNoticeActivity.this,MainActivity.class);
startActivity(intent);
}
});
imgnotice.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent=new
Intent(AddNoticeActivity.this,TextNoticeActivity.class);
startActivity(intent);
}
});
imgnotice2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent=new
Intent(AddNoticeActivity.this,TextNotice1Activity.class);
startActivity(intent);
}
});
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_add_notice);
initviews();
}
}

60
AdminLoginActivity

package com.example.scdapp.ui;
import android.app.ProgressDialog;
import android.content.Intent;
import android.graphics.Paint;
import android.support.annotation.NonNull;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import com.example.scdapp.R;
import com.example.scdapp.model.User;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.OnFailureListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.AuthResult;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.firestore.CollectionReference;
import com.google.firebase.firestore.FirebaseFirestore;

public class AdminLoginActivity extends AppCompatActivity implements


View.OnClickListener{

Button btn;
TextView textView;
EditText email,password;
FirebaseAuth auth;
User user;
FirebaseFirestore firestore;
CollectionReference userColection;
ProgressDialog progressDialog;
void initview(){
btn=findViewById(R.id.buttonLogin);
email=findViewById(R.id.editTextEmailAdmin);

61
password=findViewById(R.id.editTextPassAdmin);
textView=findViewById(R.id.forgetPassword);
textView.setPaintFlags(textView.getPaintFlags()|
Paint.UNDERLINE_TEXT_FLAG);
btn.setOnClickListener(this);
}

void loginUser(){
progressDialog.show();

auth.signInWithEmailAndPassword(user.email,user.password).addOnCompleteLis
tener(this, new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if (task.isSuccessful()){
Toast.makeText(AdminLoginActivity.this,"Login Success
!!",Toast.LENGTH_LONG).show();
Intent intent=new Intent(AdminLoginActivity.this,gridActivity.class);
startActivity(intent);
finish();
progressDialog.dismiss();
}
}
}
).addOnFailureListener(this, new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
Log.i("User","User Login failed:"+e.getMessage());
e.printStackTrace();
progressDialog.dismiss();
}
});
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_admin_login);
// ActionBar actionBar=getSupportActionBar();

// actionBar.setDisplayShowHomeEnabled(true);
62
//actionBar.setIcon(R.drawable.admin);
// actionBar.setDisplayShowTitleEnabled(true);
// actionBar.setTitle("Admin Login");
initview();
auth=FirebaseAuth.getInstance();
firestore=FirebaseFirestore.getInstance();
userColection=firestore.collection("admin");
user=new User();
progressDialog=new ProgressDialog(this);
progressDialog.setMessage("Please Wait...");
progressDialog.setCancelable(false);
}

@Override
public void onClick(View view) {
user.email=email.getText().toString().trim();
user.password=password.getText().toString().trim();
loginUser();
}

public void text_msg(){

Toast.makeText(this,"text view clicked",Toast.LENGTH_LONG).show();


}
}

ContactUs

package com.example.scdapp.ui;
import android.Manifest;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.graphics.Paint;
import android.net.Uri;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.ActivityCompat;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;

63
import android.view.ViewGroup;
import android.widget.TextView;

import com.example.scdapp.R;
public class ContactUs extends Fragment {

TextView textView;
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup
container, @Nullable Bundle savedInstanceState) {
return inflater.inflate(R.layout.contact_us,null);
}

@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState)
{
super.onViewCreated(view, savedInstanceState);
textView=view.findViewById(R.id.textView2);
textView.setPaintFlags(textView.getPaintFlags()|
Paint.UNDERLINE_TEXT_FLAG);
view.findViewById(R.id.imageView9).setOnClickListener(new
View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(Intent.ACTION_CALL);
intent.setData(Uri.parse("tel:8557039419"));
if (ActivityCompat.checkSelfPermission(getActivity(),
Manifest.permission.CALL_PHONE) !=
PackageManager.PERMISSION_GRANTED) {
return;
}
startActivity(intent);
}
});
}
}

64
DailyNoticeActivity

package com.example.scdapp.ui;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.DividerItemDecoration;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import com.example.scdapp.R;
import com.example.scdapp.adapter.NoticeAdapter;
import com.example.scdapp.listener.RecyclerAdapterClickListener;
import com.example.scdapp.model.Notice;
import com.firebase.ui.firestore.FirestoreRecyclerOptions;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.firestore.FirebaseFirestore;
import com.google.firebase.firestore.Query;

import java.util.ArrayList;

public class DailyNoticeActivity extends AppCompatActivity implements


RecyclerAdapterClickListener {

FirebaseFirestore firestore;
FirebaseAuth auth;

String uid;

RecyclerView recyclerView;
LinearLayoutManager linearLayoutManager;

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

firestore = FirebaseFirestore.getInstance();
auth = FirebaseAuth.getInstance();

recyclerView = findViewById(R.id.recyclerView1);

65
linearLayoutManager = new LinearLayoutManager(this);

recyclerView.setLayoutManager(linearLayoutManager);
final ArrayList<Notice> userList = new ArrayList<>();

Query query = firestore.collection("notice").orderBy("date",


Query.Direction.ASCENDING);
FirestoreRecyclerOptions<Notice> options = new
FirestoreRecyclerOptions.Builder<Notice>()
.setQuery(query, Notice.class)
.build();

noticeAdapter = new NoticeAdapter(options);


noticeAdapter.setRecyclerAdapterClickListener(this);
noticeAdapter.startListening();
recyclerView.setAdapter (noticeAdapter);
DividerItemDecoration dividerItemDecoration = new
DividerItemDecoration(recyclerView.getContext(),linearLayoutManager.getOrient
ation());
recyclerView.addItemDecoration(dividerItemDecoration);
}

@Override
public void onRecyclerAdapterClicked(int position) {

}
}

GridActivity

package com.example.scdapp.ui;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.Toast;

66
import com.example.scdapp.R;
import com.example.scdapp.model.Grid;
import com.example.scdapp.model.GridAdapter;
import java.util.ArrayList;
public class gridActivity extends AppCompatActivity {

ListView listView;
ArrayList<Grid> gridList;
GridAdapter adapter;
void initViews(){

listView=findViewById(R.id.listView);
Grid g1=new Grid(R.drawable.add,"Add Notice");
Grid g2=new Grid(R.drawable.delete,"Delete Notice");
Grid g3=new Grid(R.drawable.update,"Update Notice");
Grid g4=new Grid(R.drawable.usersicon,"View All Users");

gridList=new ArrayList<Grid>();
gridList.add(g1);
gridList.add(g2);
gridList.add(g3);
gridList.add(g4);

adapter=new GridAdapter(this,R.layout.grid1,gridList);
listView.setAdapter(adapter);
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position,
long id) {
Grid notice = adapter.getItem(position);
Toast.makeText(gridActivity.this,"you
selected"+notice,Toast.LENGTH_LONG).show();

switch (position){
case 0:
Intent intent=new Intent(gridActivity.this,AddNoticeActivity.class);
startActivity(intent);
Toast.makeText(gridActivity.this,"Add Notice
Selected",Toast.LENGTH_LONG).show();
break;
67
case 1:
Toast.makeText(gridActivity.this,"Delete Notice
Selected",Toast.LENGTH_LONG).show();
break;
case 2:
Toast.makeText(gridActivity.this,"Update Notice
Selected",Toast.LENGTH_LONG).show();
break;
case 3:
Intent intent1=new
Intent(gridActivity.this,ViewAllUsersActivity.class);
startActivity(intent1);
Toast.makeText(gridActivity.this,"View All Users
Selected",Toast.LENGTH_LONG).show();
break;

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

HomeFragment

package com.example.scdapp.ui;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

68
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.widget.Toast;

import com.example.scdapp.R;

/**
* Created by admin on 4/17/2018.
*/

public class HomeFragment extends Fragment {

WebView webView;
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup
container, @Nullable Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_home,null);
}

@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState)
{
super.onViewCreated(view, savedInstanceState);

webView=view.findViewById(R.id.webview1);
WebSettings webSettings=webView.getSettings();
webSettings.setJavaScriptEnabled(true);
webView.loadUrl("http://www.scdgovtcollege.ac.in/");
}
}

MainActivity

package com.example.scdapp.ui;
import android.app.ProgressDialog;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;

69
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.content.LocalBroadcastManager;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;
import com.example.scdapp.storage.MyDownloadService;
import com.example.scdapp.storage.MyUploadService;
import com.google.android.gms.tasks.OnFailureListener;
import com.google.android.gms.tasks.OnSuccessListener;
import com.google.firebase.auth.AuthResult;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;

import java.util.Locale;
import com.example.scdapp.R;

/**
* Activity to upload and download photos from Firebase Storage.
*
* See {@link MyUploadService} for upload example.
* See {@link MyDownloadService} for download example.
*/
public class MainActivity extends AppCompatActivity implements
View.OnClickListener {

private static final String TAG = "Storage#MainActivity";

private static final int RC_TAKE_PICTURE = 101;

private static final String KEY_FILE_URI = "key_file_uri";


private static final String KEY_DOWNLOAD_URL = "key_download_url";

private BroadcastReceiver mBroadcastReceiver;


private ProgressDialog mProgressDialog;
70
private FirebaseAuth mAuth;

private Uri mDownloadUrl = null;


private Uri mFileUri = null;

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

// Initialize Firebase Auth


mAuth = FirebaseAuth.getInstance();

// Click listeners
findViewById(R.id.button_camera).setOnClickListener(this);
findViewById(R.id.button_sign_in).setOnClickListener(this);
findViewById(R.id.button_download).setOnClickListener(this);

// Restore instance state


if (savedInstanceState != null) {
mFileUri = savedInstanceState.getParcelable(KEY_FILE_URI);
mDownloadUrl =
savedInstanceState.getParcelable(KEY_DOWNLOAD_URL);
}
onNewIntent(getIntent());

// Local broadcast receiver


mBroadcastReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
Log.d(TAG, "onReceive:" + intent);
hideProgressDialog();

switch (intent.getAction()) {
case MyDownloadService.DOWNLOAD_COMPLETED:
// Get number of bytes downloaded
long numBytes =
intent.getLongExtra(MyDownloadService.EXTRA_BYTES_DOWNLOADED,
0);

71
// Alert success
showMessageDialog(getString(R.string.success),
String.format(Locale.getDefault(),
"%d bytes downloaded from %s",
numBytes,

intent.getStringExtra(MyDownloadService.EXTRA_DOWNLOAD_PATH)));
break;
case MyDownloadService.DOWNLOAD_ERROR:
// Alert failure
showMessageDialog("Error", String.format(Locale.getDefault(),
"Failed to download from %s",

intent.getStringExtra(MyDownloadService.EXTRA_DOWNLOAD_PATH)));
break;
case MyUploadService.UPLOAD_COMPLETED:
case MyUploadService.UPLOAD_ERROR:
onUploadResultIntent(intent);
break;
}
}
};
}

@Override
public void onNewIntent(Intent intent) {
super.onNewIntent(intent);

// Check if this Activity was launched by clicking on an upload notification


if (intent.hasExtra(MyUploadService.EXTRA_DOWNLOAD_URL)) {
onUploadResultIntent(intent);
}

@Override
public void onStart() {
super.onStart();
updateUI(mAuth.getCurrentUser());

72
// Register receiver for uploads and downloads
LocalBroadcastManager manager =
LocalBroadcastManager.getInstance(this);
manager.registerReceiver(mBroadcastReceiver,
MyDownloadService.getIntentFilter());
manager.registerReceiver(mBroadcastReceiver,
MyUploadService.getIntentFilter());
}

@Override
public void onStop() {
super.onStop();

// Unregister download receiver

LocalBroadcastManager.getInstance(this).unregisterReceiver(mBroadcastReceiver
);
}

@Override
public void onSaveInstanceState(Bundle out) {
super.onSaveInstanceState(out);
out.putParcelable(KEY_FILE_URI, mFileUri);
out.putParcelable(KEY_DOWNLOAD_URL, mDownloadUrl);
}

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
Log.d(TAG, "onActivityResult:" + requestCode + ":" + resultCode + ":" +
data);
if (requestCode == RC_TAKE_PICTURE) {
if (resultCode == RESULT_OK) {
mFileUri = data.getData();

if (mFileUri != null) {
uploadFromUri(mFileUri);
} else {
Log.w(TAG, "File URI is null");
}
} else {
73
Toast.makeText(this, "Taking picture failed.",
Toast.LENGTH_SHORT).show();
}
}
}

private void uploadFromUri(Uri fileUri) {


Log.d(TAG, "uploadFromUri:src:" + fileUri.toString());

// Save the File URI


mFileUri = fileUri;

// Clear the last download, if any


updateUI(mAuth.getCurrentUser());
mDownloadUrl = null;

// Start MyUploadService to upload the file, so that the file is uploaded


// even if this Activity is killed or put in the background
startService(new Intent(this, MyUploadService.class)
.putExtra(MyUploadService.EXTRA_FILE_URI, fileUri)
.setAction(MyUploadService.ACTION_UPLOAD));

// Show loading spinner


showProgressDialog(getString(R.string.progress_uploading));
}

private void beginDownload() {


// Get path
String path = "photos/" + mFileUri.getLastPathSegment();

// Kick off MyDownloadService to download the file


Intent intent = new Intent(this, MyDownloadService.class)
.putExtra(MyDownloadService.EXTRA_DOWNLOAD_PATH, path)
.setAction(MyDownloadService.ACTION_DOWNLOAD);
startService(intent);

// Show loading spinner


showProgressDialog(getString(R.string.progress_downloading));
}

74
private void launchCamera() {
Log.d(TAG, "launchCamera");

// Pick an image from storage


Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.setType("image/*");
startActivityForResult(intent, RC_TAKE_PICTURE);
}

private void signInAnonymously() {


// Sign in anonymously. Authentication is required to read or write from
Firebase Storage.
showProgressDialog(getString(R.string.progress_auth));
mAuth.signInAnonymously()
.addOnSuccessListener(this, new OnSuccessListener<AuthResult>() {
@Override
public void onSuccess(AuthResult authResult) {
Log.d(TAG, "signInAnonymously:SUCCESS");
hideProgressDialog();
updateUI(authResult.getUser());
}
})
.addOnFailureListener(this, new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception exception) {
Log.e(TAG, "signInAnonymously:FAILURE", exception);
hideProgressDialog();
updateUI(null);
}
});
}

private void onUploadResultIntent(Intent intent) {


// Got a new intent from MyUploadService with a success or failure
mDownloadUrl =
intent.getParcelableExtra(MyUploadService.EXTRA_DOWNLOAD_URL);
mFileUri =
intent.getParcelableExtra(MyUploadService.EXTRA_FILE_URI);

updateUI(mAuth.getCurrentUser());
75
}

private void updateUI(FirebaseUser user) {


// Signed in or Signed out
if (user != null) {
findViewById(R.id.layout_signin).setVisibility(View.GONE);
findViewById(R.id.layout_storage).setVisibility(View.VISIBLE);
} else {
findViewById(R.id.layout_signin).setVisibility(View.VISIBLE);
findViewById(R.id.layout_storage).setVisibility(View.GONE);
}

// Download URL and Download button


if (mDownloadUrl != null) {
((TextView) findViewById(R.id.picture_download_uri))
.setText(mDownloadUrl.toString());

String url = mDownloadUrl.toString();


Toast.makeText(this,"Save URL",Toast.LENGTH_LONG).show();

findViewById(R.id.layout_download).setVisibility(View.VISIBLE);
} else {
((TextView) findViewById(R.id.picture_download_uri))
.setText(null);
findViewById(R.id.layout_download).setVisibility(View.GONE);
}
}

private void showMessageDialog(String title, String message) {


AlertDialog ad = new AlertDialog.Builder(this)
.setTitle(title)
.setMessage(message)
.create();
ad.show();
}

private void showProgressDialog(String caption) {


if (mProgressDialog == null) {
mProgressDialog = new ProgressDialog(this);
mProgressDialog.setIndeterminate(true);
76
}

mProgressDialog.setMessage(caption);
mProgressDialog.show();
}

private void hideProgressDialog() {


if (mProgressDialog != null && mProgressDialog.isShowing()) {
mProgressDialog.dismiss();
}
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
int i = item.getItemId();
if (i == R.id.action_logout) {
FirebaseAuth.getInstance().signOut();
updateUI(null);
return true;
} else {
return super.onOptionsItemSelected(item);
}
}

@Override
public void onClick(View v) {
int i = v.getId();
if (i == R.id.button_camera) {
launchCamera();
} else if (i == R.id.button_sign_in) {
signInAnonymously();
} else if (i == R.id.button_download) {
beginDownload();
}
77
}
}

NoticeBoard

package com.example.scdapp.ui;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.example.scdapp.R;
import com.example.scdapp.listener.RecyclerAdapterClickListener;

/**
* Created by admin on 4/18/2018.
*/
public class NoticeBoard extends Fragment implements
RecyclerAdapterClickListener {

@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup
container, @Nullable Bundle savedInstanceState) {
return inflater.inflate(R.layout.boad_notice,null);
}

@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState)
{
super.onViewCreated(view, savedInstanceState);

view.findViewById(R.id.imageView4).setOnClickListener(new
View.OnClickListener() {

78
@Override
public void onClick(View v) {
Intent intent=new Intent(getContext(),DailyNoticeActivity.class);
startActivity(intent);
}
});
view.findViewById(R.id.imageView15).setOnClickListener(new
View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent=new Intent(getContext(),PrincipalNoticeActivity.class);
startActivity(intent);
}
});
}

@Override
public void onRecyclerAdapterClicked(int position) {

}
}

PasswordActivity

package com.example.scdapp.ui;

import android.content.Intent;
import android.support.annotation.NonNull;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import com.example.scdapp.R;
import com.example.scdapp.model.User;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.FirebaseAuth;

79
public class PasswordActivity extends AppCompatActivity {

EditText resetText;
Button resetPassword;
FirebaseAuth auth;
User user;

void initViews(){
resetText=findViewById(R.id.passwordEmail);
resetPassword=findViewById(R.id.resetPassword);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_password);
initViews();
auth=FirebaseAuth.getInstance();
user=new User();

resetPassword.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {

user.email=resetText.getText().toString().trim();
if(user.email.equals("")){
Toast.makeText(PasswordActivity.this,"please enter your registered
email id",Toast.LENGTH_LONG).show();
}else {

auth.sendPasswordResetEmail(user.email).addOnCompleteListener(new
OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
if(task.isSuccessful()){
Toast.makeText(PasswordActivity.this,"password reset email
sent! ",Toast.LENGTH_LONG).show();
Intent intent=new
Intent(PasswordActivity.this,UserLoginActivity.class);
startActivity(intent);
finish();
80
}else {
Toast.makeText(PasswordActivity.this," Erroe in sending
password reset email ",Toast.LENGTH_LONG).show();
}
}
});
}

}
});
}
}

PrincipalNoticeActivity

package com.example.scdapp.ui;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.DividerItemDecoration;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import com.example.scdapp.R;
import com.example.scdapp.adapter.NoticeAdapter;
import com.example.scdapp.adapter.PrincipalAdapter;
import com.example.scdapp.listener.RecyclerAdapterClickListener;
import com.example.scdapp.model.Notice;
import com.example.scdapp.model.PrincipalNotice;
import com.firebase.ui.firestore.FirestoreRecyclerOptions;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.firestore.FirebaseFirestore;
import com.google.firebase.firestore.Query;

import java.util.ArrayList;

public class PrincipalNoticeActivity extends AppCompatActivity implements


RecyclerAdapterClickListener {

FirebaseFirestore firestore;

81
FirebaseAuth auth;
String uid;

RecyclerView recyclerView;
LinearLayoutManager linearLayoutManager;
PrincipalAdapter principalAdapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_principal_notice);

firestore = FirebaseFirestore.getInstance();
auth = FirebaseAuth.getInstance();

recyclerView = findViewById(R.id.recyclerView2);

linearLayoutManager = new LinearLayoutManager(this);

/*firestore.collection("users").document(uid).delete().addOnSuccessListener(new
OnSuccessListener<Void>() {
@Override
public void onSuccess(Void aVoid) {

}
});*/

recyclerView.setLayoutManager(linearLayoutManager);
final ArrayList<PrincipalNotice> userList = new ArrayList<>();

Query query = firestore.collection("principalnotice").orderBy("date",


Query.Direction.ASCENDING);

FirestoreRecyclerOptions<PrincipalNotice> options = new


FirestoreRecyclerOptions.Builder<PrincipalNotice>()
.setQuery(query, PrincipalNotice.class)
.build();

principalAdapter = new PrincipalAdapter(options);


82
principalAdapter.setRecyclerAdapterClickListener(this);

principalAdapter.startListening();

recyclerView.setAdapter(principalAdapter);

DividerItemDecoration dividerItemDecoration = new


DividerItemDecoration(recyclerView.getContext(),linearLayoutManager.getOrient
ation());
recyclerView.addItemDecoration(dividerItemDecoration);

@Override
public void onRecyclerAdapterClicked(int position) {

}
}

SelectActivity

package com.example.scdapp.ui;

import android.content.Intent;
import android.graphics.Paint;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import com.example.scdapp.R;

public class SelectActivity extends AppCompatActivity{

TextView text1,text2;
void initviews(){
text1=findViewById(R.id.text5);

83
text2=findViewById(R.id.text6);
text1.setPaintFlags(text1.getPaintFlags()|
Paint.UNDERLINE_TEXT_FLAG);
text2.setPaintFlags(text2.getPaintFlags()|
Paint.UNDERLINE_TEXT_FLAG);
text1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent=new Intent(SelectActivity.this,AdminLoginActivity.class);
startActivity(intent);
}
});
text2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent=new Intent(SelectActivity.this,UserSelectActivity.class);
startActivity(intent);
}
});
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_select);
initviews();

}
}

SelectUserActivity

package com.example.scdapp.ui;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;

import com.example.scdapp.R;

public class SelectUserActivity extends AppCompatActivity {

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

SplashActivity

package com.example.scdapp.ui;

import android.content.Intent;
import android.os.Handler;
import android.os.Message;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;

import com.example.scdapp.R;

public class SplashActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash);
// getSupportActionBar().hide();

handler.sendEmptyMessageDelayed(101,3000);
}
Handler handler = new Handler(){
@Override
public void handleMessage(Message msg) {
if(msg.what == 101){
Intent intent = new Intent(SplashActivity.this,SelectActivity.class);
startActivity(intent);
finish();
}
}

85
};
}

TextNotice1Activity

package com.example.scdapp.ui;

import android.app.DatePickerDialog;
import android.app.ProgressDialog;
import android.support.annotation.NonNull;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.DatePicker;
import android.widget.EditText;
import android.widget.Toast;
import com.example.scdapp.R;
import com.example.scdapp.model.Notice;
import com.example.scdapp.model.PrincipalNotice;
import com.google.android.gms.tasks.OnFailureListener;
import com.google.android.gms.tasks.OnSuccessListener;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.firestore.CollectionReference;
import com.google.firebase.firestore.FirebaseFirestore;
import java.util.Calendar;

public class TextNotice1Activity extends AppCompatActivity implements


View.OnClickListener {

EditText editText1,editText2,editText3;
Button btnDate,btnPost;
DatePickerDialog datePickerDialog;
String date;
FirebaseAuth auth;
PrincipalNotice notice;
FirebaseFirestore firestore;
CollectionReference usercollection;
ProgressDialog progressDialog;

86
void initViews(){

editText1=findViewById(R.id.editTextTitle1);
editText2=findViewById(R.id.editTextBody1);
editText3=findViewById(R.id.editTextDate1);
btnDate=findViewById(R.id.buttonDate1);
btnPost=findViewById(R.id.buttonPost1);

btnPost.setOnClickListener(this);
btnDate.setOnClickListener(clickListener);

Calendar calendar = Calendar.getInstance();


int dd = calendar.get(Calendar.DAY_OF_MONTH);
int mm = calendar.get(Calendar.MONTH);
int yy = calendar.get(Calendar.YEAR);

datePickerDialog=new DatePickerDialog(this,dateSetListener,yy,mm,dd);

auth=FirebaseAuth.getInstance();
firestore=FirebaseFirestore.getInstance();
usercollection=firestore.collection("principalnotice");
notice=new PrincipalNotice();
progressDialog=new ProgressDialog(this);
progressDialog.setMessage("Please wait...");
progressDialog.setCancelable(false);

void saveNotice(){

usercollection.document().set(notice).addOnSuccessListener(new
OnSuccessListener<Void>() {
@Override
public void onSuccess(Void aVoid) {
Toast.makeText(TextNotice1Activity.this,"notice saved in
DB",Toast.LENGTH_LONG).show();
}
}).addOnFailureListener(new OnFailureListener() {
@Override
87
public void onFailure(@NonNull Exception e) {
Toast.makeText(TextNotice1Activity.this,"notice not saved in
DB",Toast.LENGTH_LONG).show();
}
});
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_text_notice1);
initViews();
}

@Override
public void onClick(View v) {
notice.title=editText1.getText().toString().trim();
notice.body=editText2.getText().toString().trim();
notice.date=editText3.getText().toString().trim();
saveNotice();
}
View.OnClickListener clickListener=new View.OnClickListener() {
@Override
public void onClick(View v) {
datePickerDialog.show();

}
};
DatePickerDialog.OnDateSetListener dateSetListener=new
DatePickerDialog.OnDateSetListener() {
@Override
public void onDateSet(DatePicker view, int y, int m, int d) {
date=d+"/"+(m+1)+"/"+y;
editText3.setText(date);
}

};
}

88
TextNoticeActivity

package com.example.scdapp.ui;

import android.app.DatePickerDialog;
import android.app.ProgressDialog;
import android.support.annotation.NonNull;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.DatePicker;
import android.widget.EditText;
import android.widget.Toast;
import com.example.scdapp.R;
import com.example.scdapp.model.Notice;
import com.google.android.gms.tasks.OnFailureListener;
import com.google.android.gms.tasks.OnSuccessListener;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.firestore.CollectionReference;
import com.google.firebase.firestore.FirebaseFirestore;
import java.util.Calendar;

public class TextNoticeActivity extends AppCompatActivity implements


View.OnClickListener {
EditText editText1,editText2,editText3;
Button btnDate,btnPost;
DatePickerDialog datePickerDialog;
String date;
FirebaseAuth auth;
Notice notice;
FirebaseFirestore firestore;
CollectionReference usercollection;
ProgressDialog progressDialog;
void initViews(){

editText1=findViewById(R.id.editTextTitle);
editText2=findViewById(R.id.editTextBody);
editText3=findViewById(R.id.editTextDate);
btnDate=findViewById(R.id.buttonDate);

89
btnPost=findViewById(R.id.buttonPost);

btnPost.setOnClickListener(this);
btnDate.setOnClickListener(clickListener);

Calendar calendar = Calendar.getInstance();


int dd = calendar.get(Calendar.DAY_OF_MONTH);
int mm = calendar.get(Calendar.MONTH);
int yy = calendar.get(Calendar.YEAR);

datePickerDialog=new DatePickerDialog(this,dateSetListener,yy,mm,dd);

auth=FirebaseAuth.getInstance();
firestore=FirebaseFirestore.getInstance();
usercollection=firestore.collection("notice");
notice=new Notice();
progressDialog=new ProgressDialog(this);
progressDialog.setMessage("Please wait...");
progressDialog.setCancelable(false);

void saveNotice(){

usercollection.document().set(notice).addOnSuccessListener(new
OnSuccessListener<Void>() {
@Override
public void onSuccess(Void aVoid) {
Toast.makeText(TextNoticeActivity.this,"notice saved in
DB",Toast.LENGTH_LONG).show();
}
}).addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
Toast.makeText(TextNoticeActivity.this,"notice not saved in
DB",Toast.LENGTH_LONG).show();
}
});
}
@Override
90
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_text_notice);
initViews();
}

View.OnClickListener clickListener=new View.OnClickListener() {


@Override
public void onClick(View v) {
datePickerDialog.show();

}
};
DatePickerDialog.OnDateSetListener dateSetListener=new
DatePickerDialog.OnDateSetListener() {
@Override
public void onDateSet(DatePicker view, int y, int m, int d) {
date=d+"/"+(m+1)+"/"+y;
editText3.setText(date);
}

};

@Override
public void onClick(View v) {

notice.title=editText1.getText().toString().trim();
notice.body=editText2.getText().toString().trim();
notice.date=editText3.getText().toString().trim();
saveNotice();

}
}

UpdateNoticeActivity

package com.example.scdapp.ui;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;

91
import com.example.scdapp.R;

public class UpdateNoticeActivity extends AppCompatActivity {

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

UserHomeActivity

package com.example.scdapp.ui;
import android.app.ProgressDialog;
import android.content.Intent;
import android.os.Bundle;;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.support.design.widget.NavigationView;
import android.support.v4.view.GravityCompat;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;
import android.webkit.WebSettings;
import android.webkit.WebView;
import com.example.scdapp.R;
import com.google.firebase.auth.FirebaseAuth;

public class UserHomeActivity extends AppCompatActivity


implements NavigationView.OnNavigationItemSelectedListener {

HomeFragment homeFragment;
NoticeBoard noticeBoard;
ContactUs contactUs;
AboutUs aboutUs;

92
Fragment fragment;
FragmentTransaction fragmentTransaction;
FragmentManager fragmentManager;
FirebaseAuth auth;
WebView webView;
ProgressDialog progressDialog;
void initViews(){
homeFragment=new HomeFragment();
noticeBoard=new NoticeBoard();
contactUs=new ContactUs();
aboutUs=new AboutUs();
auth=FirebaseAuth.getInstance();
webView=findViewById(R.id.webView);
WebSettings webSettings=webView.getSettings();
webSettings.setJavaScriptEnabled(true);
webView.loadUrl("http://www.scdgovtcollege.ac.in/");
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_user_home);
progressDialog=new ProgressDialog(this);
progressDialog.setMessage("Please Wait... ");
progressDialog.setCancelable(false);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
this, drawer, toolbar, R.string.navigation_drawer_open,
R.string.navigation_drawer_close);
drawer.addDrawerListener(toggle);
toggle.syncState();
NavigationView navigationView = (NavigationView)
findViewById(R.id.nav_view);
navigationView.setNavigationItemSelectedListener(this);
initViews();
}
@Override
public void onBackPressed() {
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
93
if (drawer.isDrawerOpen(GravityCompat.START)) {
drawer.closeDrawer(GravityCompat.START);
} else {
super.onBackPressed();
}
}
void Logout(){
progressDialog.show();
auth.signOut();
finish();

Intent intent=new Intent(UserHomeActivity.this,UserLoginActivity.class);


startActivity(intent);
progressDialog.dismiss();
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.user_home, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
if (id == R.id.action_settings) {
Logout();
return true;
}
return super.onOptionsItemSelected(item);
}
@SuppressWarnings("StatementWithEmptyBody")
@Override
public boolean onNavigationItemSelected(MenuItem item) {
int id = item.getItemId();

if (id == R.id.user_home) {
setFragment(homeFragment);
getSupportActionBar().setTitle("Home");

} else if (id == R.id.nav_gallery) {


94
setFragment(aboutUs);
getSupportActionBar().setTitle("About Us");

} else if (id == R.id.user_notice) {


setFragment(noticeBoard);
getSupportActionBar().setTitle("Notice Board");

} else if (id == R.id.contact_us) {


setFragment(contactUs);
getSupportActionBar().setTitle("Contact Us");

} else if (id == R.id.nav_share) {

} else if (id == R.id.nav_send) {

DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);


drawer.closeDrawer(GravityCompat.START);
return true;
}

private void setFragment(Fragment fragment){


fragmentTransaction=getSupportFragmentManager().beginTransaction();
fragmentTransaction.replace(R.id.frameLayout,fragment);
fragmentTransaction.commit();
}
}

UserLoginActivity

package com.example.scdapp.ui;

import android.app.ProgressDialog;
import android.content.Intent;
import android.graphics.Paint;
import android.support.annotation.NonNull;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;

95
import android.view.View;
import android.widget.Button;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.RadioButton;
import android.widget.TextView;
import android.widget.Toast;
import com.example.scdapp.R;
import com.example.scdapp.model.User;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.OnFailureListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.AuthResult;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
import com.google.firebase.firestore.CollectionReference;
import com.google.firebase.firestore.FirebaseFirestore;

public class UserLoginActivity extends AppCompatActivity implements


View.OnClickListener {

TextView signUp,forgetPass;
FirebaseAuth auth;
User user;
EditText editemail,editpassword;
FirebaseFirestore firestore;
CollectionReference userCollection;
ProgressDialog progressDialog;
Button btn;
void initViews(){
btn=findViewById(R.id.button3);
btn.setOnClickListener(this);
editemail=findViewById(R.id.editTextEmail11);
editpassword=findViewById(R.id.editTextPass11);
signUp=findViewById(R.id.signUp);
signUp.setPaintFlags(signUp.getPaintFlags()|
Paint.UNDERLINE_TEXT_FLAG);
forgetPass=findViewById(R.id.forgetPass);
forgetPass.setPaintFlags(forgetPass.getPaintFlags()|
Paint.UNDERLINE_TEXT_FLAG);
96
signUp.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent=new
Intent(UserLoginActivity.this,UserRegistrationActivity.class);
startActivity(intent);
}
});

forgetPass.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent=new Intent(UserLoginActivity.this,PasswordActivity.class);
startActivity(intent);
}
});
}

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_user_login);
// getSupportActionBar().setTitle("User Login");
initViews();

auth=FirebaseAuth.getInstance();
firestore=FirebaseFirestore.getInstance();
userCollection=firestore.collection("users");
user=new User();
progressDialog=new ProgressDialog(this);
progressDialog.setMessage("Please Wait...");
progressDialog.setCancelable(false);
}

void loginUser(){
progressDialog.show();

auth.signInWithEmailAndPassword(user.email,user.password).addOnCompleteLis
tener(this, new OnCompleteListener<AuthResult>() {
97
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if(task.isSuccessful()){
//Toast.makeText(UserLoginActivity.this,"Login
Successfully",Toast.LENGTH_LONG).show();
chechEmailVerification();
progressDialog.dismiss();
}
}
}).addOnFailureListener(this, new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
Log.i("User","User Login Failed"+e.getMessage());
e.printStackTrace();
progressDialog.dismiss();

}
});
}

@Override
public void onClick(View v) {
user.email=editemail.getText().toString().trim();
user.password=editpassword.getText().toString().trim();
loginUser();

void chechEmailVerification(){
FirebaseUser firebaseUser=auth.getInstance().getCurrentUser();
boolean emailflag=firebaseUser.isEmailVerified();
if(emailflag){
Toast.makeText(UserLoginActivity.this,"Login
Successfully",Toast.LENGTH_LONG).show();
Intent intent=new Intent(UserLoginActivity.this,UserHomeActivity.class);

startActivity(intent);
finish();
}else {
98
Toast.makeText(this,"Verify your Email",Toast.LENGTH_LONG).show();
auth.signOut();
}
}
}

UserRegistrationActivity

package com.example.scdapp.ui;

import android.app.ProgressDialog;
import android.content.Intent;
import android.graphics.Paint;
import android.support.annotation.NonNull;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.RadioButton;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.Toast;
import com.example.scdapp.R;
import com.example.scdapp.model.User;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.OnFailureListener;
import com.google.android.gms.tasks.OnSuccessListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.FirebaseException;
import com.google.firebase.auth.AuthResult;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
import com.google.firebase.auth.PhoneAuthCredential;
import com.google.firebase.auth.PhoneAuthProvider;
import com.google.firebase.firestore.CollectionReference;

99
import com.google.firebase.firestore.FirebaseFirestore;
import java.util.concurrent.TimeUnit;

public class UserRegistrationActivity extends AppCompatActivity implements


CompoundButton.OnCheckedChangeListener,View.OnClickListener{

EditText editname,editemail,editpassword,editrollno,editphone;
TextView login;
Button btn;
FirebaseAuth auth;
User user;
FirebaseFirestore firestore;
CollectionReference userCollection;
ProgressDialog progressDialog;
String uid;

RadioButton rMale,rFemale;
Spinner spClass,spCity;
ArrayAdapter<String> adapter,adapterCity;

void initViews(){

editname=findViewById(R.id.editTextName12);
editemail=findViewById(R.id.editTextEmail12);
editpassword=findViewById(R.id.editTextPassword12);
editrollno=findViewById(R.id.editTextRollNo12);
editphone=findViewById(R.id.editTextPhoneNo12);
btn=findViewById(R.id.button4);
login=findViewById(R.id.loggedIn);
login.setPaintFlags(login.getPaintFlags()|
Paint.UNDERLINE_TEXT_FLAG);
rMale=findViewById(R.id.radioMale);
rFemale=findViewById(R.id.radioFemale);
rMale.setOnCheckedChangeListener(this);
rFemale.setOnCheckedChangeListener(this);
spClass=findViewById(R.id.spinClass);
spCity=findViewById(R.id.selectCity);

adapter=new
100
ArrayAdapter<String>(this,android.R.layout.simple_spinner_dropdown_item);
adapter.add("--Select Class--");
adapter.add("BCA");
adapter.add("BCom");
adapter.add("Ba");
adapter.add("BTech");
adapter.add("MA");
adapter.add("BBA");
adapter.add("PGDCA");
adapter.add("Msc.IT");
spClass.setAdapter(adapter);

adapterCity=new
ArrayAdapter<String>(this,android.R.layout.simple_spinner_dropdown_item);
adapterCity.add("--Select City--");
adapterCity.add("Ludhiana");
adapterCity.add("Phillur");
adapterCity.add("Jalandhar");
adapterCity.add("Chandigarh");
spCity.setAdapter(adapterCity);

spClass.setOnItemSelectedListener(new
AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int
position, long id) {
user.class1=adapter.getItem(position);
}

@Override
public void onNothingSelected(AdapterView<?> parent) {

}
});
spCity.setOnItemSelectedListener(new
AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int
101
position, long id) {
user.city=adapterCity.getItem(position);
}

@Override
public void onNothingSelected(AdapterView<?> parent) {

}
});
btn.setOnClickListener(this);
login.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent=new
Intent(UserRegistrationActivity.this,UserLoginActivity.class);
startActivity(intent);
}
});

}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_user_registration);
initViews();
auth=FirebaseAuth.getInstance();
firestore=FirebaseFirestore.getInstance();
userCollection=firestore.collection("users");
user=new User();
progressDialog=new ProgressDialog(this);
progressDialog.setMessage("Please Wait... ");
progressDialog.setCancelable(false);
}

@Override
public void onCheckedChanged(CompoundButton buttonView, boolean
isChecked) {
int id=buttonView.getId();
if(isChecked){
if(id==R.id.radioMale){
102
user.gender="Male";
}else {
user.gender="Female";
}
}
}

void saveUser(){
userCollection.document(uid).set(user).addOnSuccessListener(this, new
OnSuccessListener<Void>() {
@Override
public void onSuccess(Void aVoid) {
Toast.makeText(UserRegistrationActivity.this,"User Saved in
DB",Toast.LENGTH_LONG).show();
Intent intent=new
Intent(UserRegistrationActivity.this,UserHomeActivity.class);
startActivity(intent);
finish();
progressDialog.dismiss();
}
}).addOnFailureListener(this, new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
Toast.makeText(UserRegistrationActivity.this,"Error While Saving
User",Toast.LENGTH_LONG).show();
progressDialog.dismiss();
}
});
}

void registerUser(){
progressDialog.show();

auth.createUserWithEmailAndPassword(user.email,user.password).addOnComplet
eListener(this, new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if(task.isSuccessful()){
uid=task.getResult().getUser().getUid();
sendEmailverification();
103
// Toast.makeText(UserRegistrationActivity.this,user.name+"Registere
Successfully",Toast.LENGTH_LONG).show();
Log.i("User","User Registered: "+uid);

}
}
}).addOnFailureListener(this, new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
Log.i("User","User Registration Failed: "+e.getMessage());
e.printStackTrace();
progressDialog.dismiss();
}
});
}

boolean validateFields(){
boolean flag=true;
if(user.name.isEmpty()){
flag=false;
}
if(user.email.isEmpty()){
flag=false;
}
if(user.password.isEmpty()){
flag=false;
}else {
if(user.password.length()!=6){
flag=false;
}
}
if(user.rollno.isEmpty()){
flag=false;
}
if(user.phoneno.isEmpty()){
flag=false;
}else {
if(user.phoneno.length()!=10){
flag=false;
}
104
}
if(user.gender.isEmpty()){
flag=false;
}
if(user.class1.isEmpty()){
flag=false;
}
if(user.city.isEmpty()){
flag=false;
}
return flag;
}

@Override
public void onClick(View v) {
user.name=editname.getText().toString().trim();
user.email=editemail.getText().toString().trim();
user.password=editpassword.getText().toString().trim();
user.phoneno=editphone.getText().toString().trim();
user.rollno=editrollno.getText().toString().trim();

if(validateFields()){
registerUser();
}
else {
Toast.makeText(this,"Please Enter Correct
Details..",Toast.LENGTH_LONG).show();
}
}

void sendEmailverification(){
FirebaseUser firebaseUser=auth.getCurrentUser();
if(firebaseUser!=null){
firebaseUser.sendEmailVerification().addOnCompleteListener(new
OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
if(task.isSuccessful()){
saveUser();
Toast.makeText(UserRegistrationActivity.this,"successfully

105
registered,verfication mail sent",Toast.LENGTH_LONG).show();
auth.signOut();
Intent intent=new
Intent(UserRegistrationActivity.this,UserLoginActivity.class);
startActivity(intent);
finish();
}else {
Toast.makeText(UserRegistrationActivity.this,"verification email
has not been sent",Toast.LENGTH_LONG).show();
}
}
});
}
}
}

UserSelectActivity

package com.example.scdapp.ui;

import android.content.Intent;
import android.graphics.Paint;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;

import com.example.scdapp.R;

public class UserSelectActivity extends AppCompatActivity {


TextView textView1,textView2;
ImageView imageView1,imageView2;
void initviews(){
textView1=findViewById(R.id.userlogin);
textView2=findViewById(R.id.userregiter);
textView1.setPaintFlags(textView1.getPaintFlags()|
Paint.UNDERLINE_TEXT_FLAG);
textView2.setPaintFlags(textView2.getPaintFlags()|

106
Paint.UNDERLINE_TEXT_FLAG);
imageView1=findViewById(R.id.imageLogin);
imageView2=findViewById(R.id.imageRegistration);
textView1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent=new Intent(UserSelectActivity.this,UserLoginActivity.class);
startActivity(intent);
}
});
textView2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent=new
Intent(UserSelectActivity.this,UserRegistrationActivity.class);
startActivity(intent);
}
});
}

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_user_select);
initviews();
}
}
ViewAllUserActivity

package com.example.scdapp.ui;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.DividerItemDecoration;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import com.example.scdapp.R;
import com.example.scdapp.adapter.UserAdapter;
import com.example.scdapp.listener.RecyclerAdapterClickListener;
import com.example.scdapp.model.User;
import com.firebase.ui.firestore.FirestoreRecyclerOptions;

107
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.firestore.FirebaseFirestore;
import com.google.firebase.firestore.Query;
import java.util.ArrayList;

public class ViewAllUsersActivity extends AppCompatActivity implements


RecyclerAdapterClickListener{

FirebaseFirestore firestore;
FirebaseAuth auth;
String uid;
RecyclerView recyclerView;
LinearLayoutManager linearLayoutManager;
UserAdapter userAdapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_view_all_users);

firestore = FirebaseFirestore.getInstance();
auth = FirebaseAuth.getInstance();

uid = auth.getCurrentUser().getUid();

recyclerView = findViewById(R.id.recyclerView);

linearLayoutManager = new LinearLayoutManager(this);

recyclerView.setLayoutManager(linearLayoutManager)
final ArrayList<User> userList = new ArrayList<>();

Query query = firestore.collection("users").orderBy("name",


Query.Direction.ASCENDING);

FirestoreRecyclerOptions<User> options = new


FirestoreRecyclerOptions.Builder<User>()
.setQuery(query, User.class)
.build();

userAdapter = new UserAdapter(options);


108
userAdapter.setRecyclerAdapterClickListener(this);

userAdapter.startListening();

recyclerView.setAdapter(userAdapter);
DividerItemDecoration dividerItemDecoration = new
DividerItemDecoration(recyclerView.getContext(),linearLayoutManager.getOrient
ation());
recyclerView.addItemDecoration(dividerItemDecoration);
}

@Override
public void onRecyclerAdapterClicked(int position) {

}
}
Xml Coding

Activity_add_notice.xml

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


<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="10dp"
android:background="@drawable/back"
android:orientation="vertical"
tools:context="com.example.scdapp.ui.AddNoticeActivity">

<android.support.v7.widget.Toolbar
android:layout_width="match_parent"
android:layout_height="57dp"
android:background="@drawable/back">

<TextView
android:layout_width="wrap_content"

109
android:layout_height="wrap_content"
android:gravity="center"
android:paddingLeft="10dp"
android:text="ADD NOTICE ACTIVITY"
android:textColor="@color/white"
android:textSize="30dp"
android:textStyle="bold" />
</android.support.v7.widget.Toolbar>

<Button
android:id="@+id/button9"
android:layout_width="match_parent"
android:layout_height="63dp"
android:layout_marginTop="10dp"
android:text="Add Image" />

<LinearLayout
android:layout_width="184dp"
android:layout_height="149dp"
android:layout_gravity="center"
android:layout_marginTop="10dp"
android:background="@color/colorLavanderDark"
android:orientation="vertical">

<ImageView
android:id="@+id/imagedailynotice"
android:layout_width="268dp"
android:layout_height="match_parent"
android:layout_gravity="center"
app:srcCompat="@drawable/logo" />
</LinearLayout>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="30dp"
android:textStyle="bold"
android:layout_marginTop="10dp"
android:textColor="@color/white"
110
android:layout_gravity="center"
android:text="DAILY NOTICE" />

<LinearLayout
android:layout_width="184dp"
android:layout_height="149dp"
android:layout_gravity="center"
android:layout_marginTop="10dp"
android:background="@color/colorPinkRoseDark"
android:orientation="vertical">

<ImageView
android:id="@+id/imageView5"
android:layout_width="268dp"
android:layout_height="match_parent"
android:layout_gravity="center"
app:srcCompat="@drawable/logo" />
</LinearLayout>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="30dp"
android:layout_marginTop="10dp"
android:textStyle="bold"
android:textColor="@color/white"
android:layout_gravity="center"
android:text="PRINCIPAL NOTICE" />

</LinearLayout>

Activity_Admin_Login.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"

111
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/back">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="16dp"
tools:context="com.example.scdapp.ui.AdminLoginActivity">

<android.support.v7.widget.Toolbar
android:layout_width="match_parent"
android:layout_height="59dp"
android:background="@drawable/back">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="90dp"
android:gravity="center"
android:text="ADMIN LOGIN "
android:textColor="@color/white"
android:textSize="30dp"
android:textStyle="bold" />
</android.support.v7.widget.Toolbar>

<ImageView
android:id="@+id/imageView2"
android:layout_width="wrap_content"
android:layout_height="131dp"
android:layout_gravity="center"
android:layout_marginTop="5dp"
app:srcCompat="@drawable/logo" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="15dp"
112
android:text="@string/admin"
android:textColor="@color/white"
android:textSize="40dp"
android:textStyle="bold" />

<EditText
android:id="@+id/editTextEmailAdmin"
android:layout_width="match_parent"
android:layout_height="45dp"
android:layout_marginTop="15dp"
android:background="@drawable/round_edittext"
android:ems="10"
android:hint="@string/admin_email"
android:inputType="textPersonName"
android:paddingLeft="10dp" />

<EditText
android:id="@+id/editTextPassAdmin"
android:layout_width="match_parent"
android:layout_height="45dp"
android:layout_marginTop="15dp"
android:background="@drawable/round_edittext"
android:ems="10"
android:hint="@string/admin_password"
android:inputType="textPassword"
android:paddingLeft="10dp" />

<Button
android:id="@+id/buttonLogin"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="20dp"
android:background="@drawable/rounded_button"
android:text="@string/admin_login"
android:textColor="@color/white"
android:textSize="20dp"
android:textStyle="bold" />

<TextView
113
android:id="@+id/forgetPassword"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="25dp"
android:text="@string/admin_forget_password"
android:textSize="20dp" />

</LinearLayout>
</ScrollView>

Activity_daily_notice.xml

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


<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:orientation="vertical">

<android.support.v7.widget.Toolbar
android:layout_width="match_parent"
android:layout_height="57dp"
android:background="@drawable/back">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:paddingLeft="70dp"
android:text="DAILY NOTICE"
android:textColor="@color/white"
android:textSize="30dp"
android:textStyle="bold" />
</android.support.v7.widget.Toolbar>

<android.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="match_parent"

114
android:id="@+id/recyclerView1"
android:padding="5dp"
android:orientation="vertical"
android:background="@drawable/back"
tools:context="com.example.scdapp.ui.DailyNoticeActivity">
</android.support.v7.widget.RecyclerView>
</LinearLayout>

Activity_grid.xml

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


<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:orientation="vertical">

<android.support.v7.widget.Toolbar
android:layout_width="match_parent"
android:layout_height="70dp"
android:background="@drawable/back">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="95dp"
android:gravity="center"
android:text="ADMIN LEVEL "
android:textColor="@color/white"
android:textSize="30dp"
android:textStyle="bold" />
</android.support.v7.widget.Toolbar>
<ListView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="16dp"
android:id="@+id/listView"
android:background="@drawable/back"

115
tools:context="com.example.scdapp.ui.gridActivity">
</ListView>
</LinearLayout>

Activity_main.xml

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


<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fillViewport="true"
android:scrollbars="vertical"
tools:context="com.google.firebase.quickstart.firebasestorage.MainActivity">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:orientation="vertical">

<ImageView
android:id="@+id/firebase_logo"
android:layout_width="196dp"
android:layout_height="143dp"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="@dimen/margin_2"
android:src="@drawable/logo" />

<LinearLayout
android:id="@+id/layout_signin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
tools:visibility="gone">

<TextView

116
android:id="@+id/status_sign_in"
style="@style/TextAppearance.AppCompat.Medium"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/margin_1"
android:text="@string/sign_in_prompt" />

<Button
android:id="@+id/button_sign_in"
android:layout_width="@dimen/standard_field_width"
android:layout_height="wrap_content"
android:text="@string/sign_in_anonymously" />

</LinearLayout>

<LinearLayout
android:id="@+id/layout_storage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:visibility="gone"
tools:visibility="visible">

<TextView
style="@style/TextAppearance.AppCompat.Medium"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/margin_1"
android:text="@string/take_photo_prompt" />

<Button
android:id="@+id/button_camera"
android:layout_width="@dimen/standard_field_width"
android:layout_height="wrap_content"
android:text="@string/camera_button_text" />

</LinearLayout>

<LinearLayout
android:id="@+id/layout_download"
117
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:visibility="gone"
tools:visibility="visible">

<TextView
style="@style/TextAppearance.AppCompat.Medium"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/margin_1"
android:layout_marginTop="@dimen/margin_2"
android:text="@string/label_link" />

<TextView
android:id="@+id/picture_download_uri"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:autoLink="web"

<TextView
style="@style/TextAppearance.AppCompat.Medium"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/margin_1"
android:layout_marginTop="@dimen/margin_2"
android:text="@string/label_download" />

<Button
android:id="@+id/button_download"
android:layout_width="@dimen/standard_field_width"
android:layout_height="wrap_content"
android:text="@string/download" />
</LinearLayout>
</LinearLayout>

</ScrollView>

118
Activity_password.xml

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


<android.support.constraint.ConstraintLayout
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:background="@drawable/back"
android:padding="10dp"
tools:context="com.example.scdapp.ui.PasswordActivity">

<android.support.v7.widget.Toolbar
android:layout_width="match_parent"
android:layout_height="59dp"
android:background="@drawable/back">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="65dp"
android:gravity="center"
android:text="FORGET PASSWORD "
android:textColor="@color/white"
android:textSize="25dp"
android:textStyle="bold" />
</android.support.v7.widget.Toolbar>
<EditText
android:id="@+id/passwordEmail"
android:layout_width="263dp"
android:layout_height="35dp"
android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:background="@drawable/round_edittext"
android:ems="10"
android:paddingLeft="10dp"
android:inputType="textEmailAddress"

119
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.504"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.414" />

<Button
android:id="@+id/resetPassword"
android:layout_width="185dp"
android:layout_height="51dp"
android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:background="@drawable/rounded_button"
android:text="RESET PASSWORD"
android:textColor="@color/white"
android:textSize="20dp"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.502"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/passwordEmail"
app:layout_constraintVertical_bias="0.354" />
</android.support.constraint.ConstraintLayout>

Activity_principal_notice.xml

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


<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context="com.example.scdapp.ui.PrincipalNoticeActivity">
<android.support.v7.widget.Toolbar
android:layout_width="match_parent"
android:layout_height="57dp"

120
android:background="@drawable/back">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:paddingLeft="43dp"
android:text="PRINCIPAL NOTICE"
android:textColor="@color/white"
android:textSize="30dp"
android:textStyle="bold" />
</android.support.v7.widget.Toolbar>

<android.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="5dp"
android:id="@+id/recyclerView2"
android:background="@drawable/back">
</android.support.v7.widget.RecyclerView>
</LinearLayout>

Activity_select.xml

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


<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/back"
android:padding="10dp"
android:orientation="vertical"
tools:context="com.example.scdapp.ui.SelectActivity"
tools:layout_editor_absoluteY="81dp">

<android.support.v7.widget.Toolbar
android:layout_width="match_parent"
android:layout_height="59dp"
android:background="@drawable/back">

121
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="90dp"
android:gravity="center"
android:text="SELECT USER"
android:textColor="@color/white"
android:textSize="30dp"
android:textStyle="bold" />
</android.support.v7.widget.Toolbar>

<ImageView
android:id="@+id/imageView6"
android:layout_width="251dp"
android:layout_height="136dp"
android:layout_marginTop="40dp"
android:layout_gravity="center"
app:srcCompat="@drawable/admin" />

<TextView
android:id="@+id/text5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_gravity="center"
android:textSize="30dp"
android:textStyle="bold"
android:textColor="@color/white"
android:text="@string/admin_level" />

<ImageView
android:id="@+id/imageView7"
android:layout_width="251dp"
android:layout_height="136dp"
android:layout_gravity="center"
android:layout_marginTop="40dp"
app:srcCompat="@drawable/usergroup" />

122
<TextView
android:id="@+id/text6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/white"
android:layout_gravity="center"
android:textStyle="bold"
android:textSize="30dp"
android:layout_marginTop="10dp"
android:text="@string/user_level" />
</LinearLayout>

Activity_select_user.xml

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


<android.support.constraint.ConstraintLayout
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="com.example.scdapp.ui.UserSelectActivity">
</android.support.constraint.ConstraintLayout>

Activity_splash.xml

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


<android.support.constraint.ConstraintLayout
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:background="@drawable/clg"
tools:context="com.example.scdapp.ui.SplashActivity">
</android.support.constraint.ConstraintLayout>

123
Activity_text_notice.xml

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


<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="16dp"
android:background="@drawable/back"
tools:context="com.example.scdapp.ui.TextNoticeActivity">

<TextView
android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="40dp"
android:layout_gravity="center"
android:text="Add Notice" />

<EditText
android:id="@+id/editTextTitle"
android:layout_marginTop="30dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="textMultiLine"
android:hint="Title" />

<EditText
android:id="@+id/editTextBody"
android:layout_marginTop="10dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="textPersonName"
android:hint="Body" />

124
<EditText
android:id="@+id/editTextDate"
android:layout_marginTop="10dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="textPersonName"
android:hint="01/01/2018" />

<Button
android:id="@+id/buttonDate"
android:layout_marginTop="10dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Select Date" />

<Button
android:id="@+id/buttonPost"
android:layout_marginTop="10dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Post Notice" />
</LinearLayout>

Activity_text_notice1.xml

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


<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="16dp"
android:background="@drawable/back"
tools:context="com.example.scdapp.ui.TextNotice1Activity">

125
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="40dp"
android:layout_gravity="center"
android:text="Add Notice" />

<EditText
android:id="@+id/editTextTitle1"
android:layout_marginTop="30dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="textMultiLine"
android:hint="Title" />

<EditText
android:id="@+id/editTextBody1"
android:layout_marginTop="10dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="textPersonName"
android:hint="Body" />

<EditText
android:id="@+id/editTextDate1"
android:layout_marginTop="10dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="textPersonName"
android:hint="01/01/2018" />

<Button
android:id="@+id/buttonDate1"
android:layout_marginTop="10dp"
126
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Select Date" />

<Button
android:id="@+id/buttonPost1"
android:layout_marginTop="10dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Post Notice" />
</LinearLayout>

Activity_user_home.xml

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


<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:openDrawer="start">

<include
layout="@layout/app_bar_user_home"
android:layout_width="match_parent"
android:layout_height="match_parent" />

<android.support.design.widget.NavigationView
android:id="@+id/nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:fitsSystemWindows="true"
app:headerLayout="@layout/nav_header_user_home"
app:menu="@menu/activity_user_home_drawer" />

</android.support.v4.widget.DrawerLayout>

127
Activity_user_login.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_height="match_parent"
android:layout_width="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="16dp"
android:background="@drawable/back"
android:orientation="vertical"
tools:context="com.example.scdapp.ui.UserLoginActivity">
<android.support.v7.widget.Toolbar
android:layout_width="match_parent"
android:layout_height="59dp"
android:background="@drawable/back">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="95dp"
android:gravity="center"
android:text="USER LOGIN "
android:textColor="@color/white"
android:textSize="30dp"
android:textStyle="bold" />
</android.support.v7.widget.Toolbar>

<ImageView
android:id="@+id/imageView3"
android:layout_width="wrap_content"
android:layout_height="131dp"
android:layout_gravity="center"
android:layout_marginTop="40dp"
app:srcCompat="@drawable/logo" />

<EditText

128
android:id="@+id/editTextEmail11"
android:layout_width="match_parent"
android:layout_height="45dp"
android:layout_marginTop="20dp"
android:paddingLeft="10dp"
android:background="@drawable/rounded_edittext"
android:ems="10"
android:hint="@string/user_email"
android:inputType="textEmailAddress" />

<EditText
android:id="@+id/editTextPass11"
android:layout_marginTop="20dp"
android:layout_width="match_parent"
android:layout_height="45dp"
android:ems="10"
android:paddingLeft="10dp"
android:background="@drawable/rounded_edittext"
android:hint="@string/user_password"
android:inputType="textPassword" />

<Button
android:id="@+id/button3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:textColor="@color/white"
android:layout_marginTop="20dp"
android:background="@drawable/rounded_button2"
android:text="@string/user_signin"
android:textSize="20dp"
android:textStyle="bold" />

<LinearLayout
android:layout_width="match_parent"
android:layout_height="94dp"
android:orientation="horizontal"
android:padding="10dp">

<TextView
129
android:id="@+id/signUp"
android:layout_width="112dp"
android:layout_marginLeft="15dp"
android:layout_height="wrap_content"
android:layout_marginTop="25dp"
android:text="@string/user_signup"
android:textStyle="bold"
android:textSize="20dp" />

<TextView
android:id="@+id/forgetPass"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:paddingLeft="8dp"
android:layout_marginTop="25dp"
android:layout_weight="1"
android:textStyle="bold"
android:text="@string/user_forget_password"
android:textSize="20dp" />
</LinearLayout>
</LinearLayout>
</ScrollView>

Activity_user_registration.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:background="@drawable/back">
<LinearLayout
android:layout_width="match_parent"
android:padding="16dp"
android:orientation="vertical"
android:layout_height="match_parent"
tools:context="com.example.scdapp.ui.UserRegistrationActivity">

130
<android.support.v7.widget.Toolbar
android:layout_width="match_parent"
android:layout_height="59dp"
android:background="@drawable/back">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="23dp"
android:gravity="center"
android:text="USER REGISTRATION "
android:textColor="@color/white"
android:textSize="30dp"
android:textStyle="bold" />
</android.support.v7.widget.Toolbar>
<ImageView
android:id="@+id/imageView5"
android:layout_width="wrap_content"
android:layout_height="131dp"
android:layout_gravity="center"
android:layout_marginTop="20dp"
app:srcCompat="@drawable/logo" />

<EditText
android:id="@+id/editTextName12"
android:layout_marginTop="15dp"
android:layout_width="match_parent"
android:layout_height="40dp"
android:ems="10"
android:background="@drawable/rounded_edittext"
android:paddingLeft="10dp"
android:inputType="textPersonName"
android:hint="Enter Your Name" />
<EditText
android:id="@+id/editTextEmail12"
android:layout_marginTop="10dp"
android:layout_width="match_parent"
android:layout_height="40dp"
android:ems="10"
android:paddingLeft="10dp"
131
android:background="@drawable/rounded_edittext"
android:inputType="textPersonName"
android:hint="Enter Your Email" />

<EditText
android:id="@+id/editTextPassword12"
android:layout_marginTop="10dp"
android:layout_width="match_parent"
android:layout_height="40dp"
android:ems="10"
android:paddingLeft="10dp"
android:background="@drawable/rounded_edittext"
android:hint="Enter Your Password"
android:inputType="textPassword" />
<EditText
android:id="@+id/editTextRollNo12"
android:layout_marginTop="10dp"
android:layout_width="match_parent"
android:layout_height="40dp"
android:ems="10"
android:background="@drawable/rounded_edittext"
android:paddingLeft="10dp"
android:inputType="number"
android:hint="Enter Your RollNo" />

<EditText
android:id="@+id/editTextPhoneNo12"
android:layout_marginTop="10dp"
android:layout_width="match_parent"
android:layout_height="40dp"
android:ems="10"
android:background="@drawable/rounded_edittext"
android:paddingLeft="10dp"
android:inputType="textPersonName"
android:hint="Enter Your Phone Number" />

<RadioGroup
android:layout_width="wrap_content"
android:layout_height="40dp"
android:orientation="horizontal"
132
android:layout_marginTop="10dp">

<RadioButton
android:id="@+id/radioMale"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/male"
android:textColor="@color/white"
android:textSize="20dp"
android:layout_marginTop="10dp"/>

<RadioButton
android:id="@+id/radioFemale"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/female"
android:textColor="@color/white"
android:textSize="20dp"
android:layout_marginTop="10dp"/>
</RadioGroup>

<Spinner
android:id="@+id/spinClass"
android:layout_width="match_parent"
android:layout_height="40dp"
android:background="@drawable/rounded_edittext"
android:layout_marginTop="10dp" />

<Spinner
android:id="@+id/selectCity"
android:layout_marginTop="10dp"
android:background="@drawable/rounded_edittext"
android:layout_width="match_parent"
android:layout_height="40dp" />

<Button
android:id="@+id/button4"
android:layout_marginTop="10dp"
android:background="@drawable/rounded_button2"
133
android:layout_width="match_parent"
android:textSize="20dp"
android:layout_gravity="center"
android:textStyle="bold"
android:textColor="@color/white"
android:layout_height="wrap_content"
android:text="Register" />

<TextView
android:id="@+id/loggedIn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:textStyle="bold"
android:textSize="20dp"
android:layout_marginTop="10dp"
android:text="Already Have An Account?Login" />
</LinearLayout>
</ScrollView>

Activity_user_select.xml

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


<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="10dp"
android:background="@drawable/back"
tools:context="com.example.scdapp.ui.UserSelectActivity">

<android.support.v7.widget.Toolbar
android:layout_width="match_parent"
android:layout_height="59dp"
android:background="@drawable/back">

<TextView
android:layout_width="wrap_content"

134
android:layout_height="wrap_content"
android:layout_marginLeft="95dp"
android:gravity="center"
android:text="USER LOGIN "
android:textColor="@color/white"
android:textSize="30dp"
android:textStyle="bold" />
</android.support.v7.widget.Toolbar>
<ImageView
android:id="@+id/imageLogin"
android:layout_width="177dp"
android:layout_height="138dp"
android:layout_marginTop="50dp"
android:layout_gravity="center"
app:srcCompat="@drawable/login" />

<TextView
android:id="@+id/userlogin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:textStyle="bold"
android:layout_gravity="center"
android:textColor="@color/white"
android:textSize="30dp"
android:text="LOGIN" />

<ImageView
android:id="@+id/imageRegistration"
android:layout_width="177dp"
android:layout_height="138dp"
android:layout_marginTop="30dp"
android:layout_gravity="center"
app:srcCompat="@drawable/registration" />

<TextView
android:id="@+id/userregiter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
135
android:textStyle="bold"
android:layout_gravity="center"
android:textColor="@color/white"
android:textSize="30dp"
android:text="REGISTRATION" />
</LinearLayout>

Activity_view_all_user.xml

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


<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:orientation="vertical">
<android.support.v7.widget.Toolbar
android:layout_width="match_parent"
android:layout_height="57dp"
android:background="@drawable/back">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:paddingLeft="60dp"
android:text="VIEW ALL USERS"
android:textColor="@color/white"
android:textSize="30dp"
android:textStyle="bold" />
</android.support.v7.widget.Toolbar>

<android.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/recyclerView"
android:padding="16dp"
android:background="@drawable/back"
tools:context="com.example.scdapp.ui.ViewAllUsersActivity">

136
</android.support.v7.widget.RecyclerView>
</LinearLayout>

Board_notice.xml

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


<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/recyclerView1"
android:padding="16dp"
android:background="@drawable/back"
android:orientation="vertical">

<LinearLayout
android:layout_width="184dp"
android:layout_height="149dp"
android:layout_gravity="center"
android:layout_marginTop="40dp"
android:background="@color/colorLavanderDark"
android:orientation="vertical">

<ImageView
android:id="@+id/imageView4"
android:layout_width="268dp"
android:layout_height="match_parent"
android:layout_gravity="center"
app:srcCompat="@drawable/logo" />
</LinearLayout>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="30dp"
android:layout_marginTop="10dp"
android:textStyle="bold"
android:textColor="@color/white"
android:layout_gravity="center"

137
android:text="DAILY NOTICE" />

<LinearLayout
android:layout_width="184dp"
android:layout_height="149dp"
android:layout_gravity="center"
android:layout_marginTop="30dp"
android:background="@color/colorPinkRoseDark"
android:orientation="vertical">

<ImageView
android:id="@+id/imageView15"
android:layout_width="268dp"
android:layout_height="match_parent"
android:layout_gravity="center"
app:srcCompat="@drawable/logo" />
</LinearLayout>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="30dp"
android:textStyle="bold"
android:layout_marginTop="10dp"
android:textColor="@color/white"
android:layout_gravity="center"
android:text="PRINCIPAL NOTICE" />
</LinearLayout>

Contact_us.xml

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


<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="10dp"

138
android:background="@drawable/back">
<TextView
android:id="@+id/textView2"
android:layout_marginTop="30dp"
android:layout_width="wrap_content"
android:layout_gravity="center"
android:textColor="@color/white"
android:textSize="22dp"
android:textStyle="bold"
android:layout_height="wrap_content"
android:text="GCG GOVT.COLLEGE,LUDHIANA" />

<ImageView
android:id="@+id/imageView8"
android:layout_width="156dp"
android:layout_height="133dp"
android:layout_gravity="center"
android:layout_marginTop="30dp"
app:srcCompat="@drawable/logo" />
<TextView
android:id="@+id/textView4"
android:layout_marginTop="50dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="@color/white"
android:textSize="20dp"
android:text="Civil Lines, Ludhiana" />

<TextView
android:id="@+id/textView5"
android:layout_marginTop="10dp"
android:textSize="20dp"
android:textColor="@color/white"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Website: www.scdgovtcollege.ac.in" />

<TextView
android:id="@+id/textView6"
android:textColor="@color/white"
139
android:textSize="20dp"
android:layout_marginTop="10dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Email: scdldhhelp@gmail.com" />

<TextView
android:id="@+id/textView7"
android:layout_marginTop="10dp"
android:textColor="@color/white"
android:textSize="20dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Contact Us: 0161-2448899,2444988" />

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">

<ImageView
android:id="@+id/imageView9"
android:layout_width="50dp"
android:layout_height="68dp"
android:layout_gravity="center"
android:layout_margin="30dp"
android:layout_marginTop="10dp"
app:srcCompat="@drawable/callnow" />

<TextView
android:id="@+id/call"
android:layout_width="157dp"
android:layout_height="wrap_content"
android:layout_marginTop="40dp"
android:text="call now"
android:textColor="@color/black"
android:textSize="30dp" />
</LinearLayout>
</LinearLayout>

140
Fragment_about_us.xml

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="16dp"
android:background="@drawable/back"
android:orientation="vertical">

<!-- TODO: Update blank fragment layout -->


<TextView
android:id="@+id/textView4"
android:layout_marginTop="20dp"
android:layout_width="wrap_content"
android:textSize="25dp"
android:layout_gravity="center"
android:textColor="@color/black"
android:layout_height="wrap_content"
android:text="About App" />

<EditText
android:id="@+id/editText"
android:layout_marginTop="5dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:textColor="@color/white"
android:text="This App is Based on college campus application that provide
infromation regarding college activies such as events,gernral notices, placement
activites etc.
This information should be provided to student in an effective way."
android:inputType="textMultiLine" />
<TextView
android:id="@+id/textView5"
android:layout_width="wrap_content"
android:textSize="25dp"
android:layout_gravity="center"
android:textColor="@color/black"
android:layout_height="wrap_content"

141
android:text="App Objective" />

<EditText
android:id="@+id/editText6"
android:layout_width="340dp"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="textMultiLine"
android:text="The proposed system objective are to overcome all the
limitations and drwabacks of the exiting system.
The online GCG application is user friendly.
The main obhective of the application is its simplicity of design and ease of
implementation that shows and helps to collect the information about events going
on in the college."
android:textColor="@color/white" />
</LinearLayout>

Grid1.xml

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


<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="16dp">
<ImageView
android:id="@+id/imageView"
android:layout_width="80dp"
android:layout_height="74dp"
android:background="@drawable/add" />
<TextView
android:id="@+id/textName"
android:layout_width="wrap_content"
android:layout_height="74dp"
android:layout_weight="1"
android:paddingLeft="20dp"
android:text="Add Notice"
android:textSize="30dp"
142
android:paddingTop="20dp"
android:textColor="@color/white"
android:textStyle="bold" />
</LinearLayout>

List_item.xml

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


<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:padding="16dp"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/textViewName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="20dp"
android:textColor="@color/colorPrimaryDark"
android:text="Name" />

<TextView
android:id="@+id/textViewEmail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="18dp"
android:textColor="@color/colorAccent"
android:text="Email" />
</LinearLayout>

List_item1.xml

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


<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="horizontal"
android:padding="2dp"
143
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:layout_width="57dp"
android:layout_height="101dp"
android:layout_gravity="center"
app:srcCompat="@drawable/logo" />

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

<TextView
android:id="@+id/textViewName7"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="title"
android:textColor="@color/colorPrimaryDark"
android:textSize="25dp" />

<TextView
android:id="@+id/textViewEmail7"
android:layout_width="match_parent"
android:layout_height="41dp"
android:text="body"
android:textColor="@color/colorAccent"
android:textSize="18dp" />

<TextView
android:id="@+id/textdate"
android:layout_width="match_parent"
android:layout_height="31dp"
android:text="01/01/2018" />
</LinearLayout>

</LinearLayout>

144
List_item2.xml

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


<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="horizontal"
android:padding="2dp"
android:layout_width="match_parent"
android:layout_height="wrap_content">

<ImageView
android:layout_width="57dp"
android:layout_height="101dp"
android:layout_gravity="center"
app:srcCompat="@drawable/logo" />

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

<TextView
android:id="@+id/textViewName8"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="title"
android:textColor="@color/colorPrimaryDark"
android:textSize="25dp" />

<TextView
android:id="@+id/textViewEmail8"
android:layout_width="match_parent"
android:layout_height="41dp"
android:text="body"
android:textColor="@color/colorAccent"
android:textSize="18dp" />

145
<TextView
android:id="@+id/textdate8"
android:layout_width="match_parent"
android:layout_height="31dp"
android:text="01/01/2018" />
</LinearLayout>
</LinearLayout>

Nav_header_user_home.xml

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


<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="@dimen/nav_header_height"
android:background="@drawable/side_nav_bar"
android:gravity="bottom"
android:orientation="vertical"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:theme="@style/ThemeOverlay.AppCompat.Dark">

<ImageView
android:id="@+id/imageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="@dimen/nav_header_vertical_spacing"
app:srcCompat="@mipmap/ic_launcher_round" />

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="@dimen/nav_header_vertical_spacing"
android:text="Android Studio"
android:textAppearance="@style/TextAppearance.AppCompat.Body1" />

146
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="android.studio@android.com" />
</LinearLayout>

Activity_user_home_drawer.xml

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


<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
tools:showIn="navigation_view">

<group android:checkableBehavior="single">
<item
android:id="@+id/user_home"
android:icon="@drawable/ic_menu_camera"
android:title="Home" />
<item
android:id="@+id/nav_gallery"
android:icon="@drawable/ic_menu_gallery"
android:title="About Us" />
<item
android:id="@+id/user_notice"
android:icon="@drawable/ic_menu_slideshow"
android:title="Notice Board" />
<item
android:id="@+id/contact_us"
android:icon="@drawable/ic_menu_manage"
android:title="Contact Us" />
</group>
</menu>

Menu_home.xml

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


<menu xmlns:app="http://schemas.android.com/apk/res-auto"
147
xmlns:android="http://schemas.android.com/apk/res/android">

<item android:title="Sign Out"


app:showAsAction="ifRoom"
android:id="@+id/signOut"
android:icon="@android:drawable/ic_lock_power_off"/>
</menu>
menu_main.xml
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item android:id="@+id/action_logout"
android:title="@string/log_out"
app:showAsAction="never" />
</menu>

Navigation.xml

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


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

<item
android:id="@+id/navigation_home"
android:icon="@drawable/ic_home_black_24dp"
android:title="@string/title_home" />

<item
android:id="@+id/navigation_dashboard"
android:icon="@drawable/ic_dashboard_black_24dp"
android:title="@string/title_dashboard" />

<item
android:id="@+id/navigation_notifications"
android:icon="@drawable/ic_notifications_black_24dp"
android:title="@string/title_notifications" />

</menu>
user_home.xml
148
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/action_settings"
android:orderInCategory="100"
android:icon="@drawable/logout"
android:title="@string/action_signout"
app:showAsAction="always" />
</menu>

AndroidManifest.xml

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


<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.scdapp">

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


<uses-permission
android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission
android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.CALL_PHONE" />

<application
android:allowBackup="true"
android:icon="@mipmap/logo"
android:label="@string/app_name"
android:roundIcon="@mipmap/logo"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".ui.SplashActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

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


</intent-filter>
</activity>
<activity android:name=".ui.SelectActivity" />
149
<activity android:name=".ui.SelectUserActivity" />
<activity android:name=".ui.UserLoginActivity" />
<activity android:name=".ui.UserRegistrationActivity" />
<activity android:name=".ui.UserSelectActivity" />
<activity android:name=".ui.AdminLoginActivity" />
<activity
android:name=".ui.UserHomeActivity"
android:label="@string/title_activity_user_home"
android:theme="@style/AppTheme.NoActionBar">

</activity>
<activity android:name=".ui.gridActivity" />
<activity android:name=".ui.AddNoticeActivity" />
<activity android:name=".ui.MainActivity" />

<service
android:name=".storage.MyDownloadService"
android:exported="false" />
<service
android:name=".storage.MyUploadService"
android:exported="false" />

<activity android:name=".ui.UpdateNoticeActivity" />


<activity android:name=".ui.PasswordActivity" />
<activity android:name=".ui.ViewAllUsersActivity" />
<activity android:name=".ui.TextNoticeActivity" />
<activity android:name=".ui.DailyNoticeActivity" />
<activity android:name=".ui.PrincipalNoticeActivity" />
<activity android:name=".ui.TextNotice1Activity"></activity>
</application>

</manifest>

Color.xml

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


<resources>
<color name="colorPrimary">#3F51B5</color>
<color name="colorPrimaryDark">#303F9F</color>
<color name="colorAccent">#FF4081</color>
150
<color name="colorWhite">#FFFFFF</color>
<color name="Pink">#ef89e5</color>
<color name="blue">#89efd6</color>
<color name="white">#ebf7f4</color>
<color name="color">#969899</color>
<color name="black">#0b0b0b</color>
<color name="lightblue">#76bbf9</color>
<color name="color1">#dd3333</color>
<color name="color2">#d11616</color>
<color name="colorgrapefruit">#ED5565</color>
<color name="color3">#DA4453</color>
<color name="color4">#FC6E51</color>
<color name="colorGrapeFruit">#ED5565</color>
<color name="colorGrapeFruitDark">#DA4453</color>
<color name="colorBitterSweet">#FC6E51</color>
<color name="colorBitterSweetDark">#E9573F</color>
<color name="colorFlower">#FFCE54</color>
<color name="colorFlowerDark">#F68B42</color>
<color name="colorGrass">#A0D468</color>
<color name="colorGrassDark">#8CC152</color>
<color name="colorBlueJeans">#509CEC</color>
<color name="colorBlueJeansDark">#4A89DC</color>
<color name="colorLavander">#AC92EC</color>
<color name="colorLavanderDark">#967ADC</color>
<color name="colorMint">#48CFAD</color>
<color name="colorMintDark">#37BC9B</color>
<color name="colorAqua">#4FC1E9</color>
<color name="colorAquaDark">#3BAFDA</color>
<color name="colorPinkRose">#EC87C0</color>
<color name="colorPinkRoseDark">#D770AD</color>
</resources>

Dimens.xml

<resources>
<!-- Default screen margins, per the Android Design guidelines. -->
<dimen name="activity_horizontal_margin">16dp</dimen>
<dimen name="activity_vertical_margin">16dp</dimen>
<dimen name="fab_margin">16dp</dimen>
<dimen name="appbar_padding_top">8dp</dimen>
151
<dimen name="nav_header_vertical_spacing">8dp</dimen>
<dimen name="nav_header_height">176dp</dimen>
<dimen name="standard_field_width">160dp</dimen>
<dimen name="margin_1">8dp</dimen>
<dimen name="margin_2">16dp</dimen>
</resources>

Drawables.xml

<resources xmlns:android="http://schemas.android.com/apk/res/android">
<item name="ic_menu_camera"
type="drawable">@android:drawable/ic_menu_camera</item>
<item name="ic_menu_gallery"
type="drawable">@android:drawable/ic_menu_gallery</item>
<item name="ic_menu_slideshow"
type="drawable">@android:drawable/ic_menu_slideshow</item>
<item name="ic_menu_manage"
type="drawable">@android:drawable/ic_menu_manage</item>
<item name="ic_menu_share"
type="drawable">@android:drawable/ic_menu_share</item>
<item name="ic_menu_send"
type="drawable">@android:drawable/ic_menu_send</item>
</resources>

Strings.xml

<resources>
<string name="app_name">ScdApp</string>
<string name="admin">Admin Login</string>
<string name="admin_email">Enter Your Email</string>
<string name="admin_password">Enter Your Password</string>
<string name="admin_login">Login</string>
<string name="admin_forget_password">Forget Password?</string>
<string name="admin_level">Admin Level</string>
<string name="user_level">User Level</string>
<string name="user_login">User Login</string>
<string name="user_email">Enter Your Email</string>
<string name="user_password">Enter Your Password</string>
<string name="user_signin">Sign In</string>
<string name="user_signup">Sign Up?</string>
152
<string name="user_forget_password">Forget Password?</string>
<string name="male">Male</string>
<string name="female">Female</string>
<string name="title_activity_user_home">UserHomeActivity</string>
<string name="action_signout">Sign Out</string>
<string name="section_format">Hello World from section: %1$d</string>
<string name="navigation_drawer_open">Open navigation drawer</string>
<string name="navigation_drawer_close">Close navigation drawer</string>
<string name="hello_blank_fragment">Hello blank fragment</string>
<string name="title_activity_user_home1">UserHome1Activity</string>
<string name="camera_button_text">Upload</string>
<string name="sign_in_prompt">Sign In to begin</string>
<string name="take_photo_prompt">Upload a Photo</string>
<string name="download">Download</string>
<string name="sign_in_anonymously">Sign In</string>
<string name="label_link">Link to Uploaded File</string>
<string name="label_download">Download File</string>
<string name="log_out">Log out</string>
<string name="success">Success</string>
<string name="progress_downloading">Downloading…</string>
<string name="progress_uploading">Uploading…</string>
<string name="progress_auth">Signing In…</string>
<string name="upload_success">Upload finished</string>
<string name="upload_failure">Upload failed</string>
<string name="download_success">Download finished</string>
<string name="download_failure">Download failure</string>
<string name="login">Log In</string>
<string name="action_settings">Settings</string>
<string name="title_activity_bottom">BottomActivity</string>
<string name="title_home">Home</string>
<string name="title_dashboard">Dashboard</string>
<string name="title_notifications">Notifications</string>

</resources>

Styles.xml

<resources>

<!-- Base application theme. -->


153
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>

<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>

<style name="AppTheme.AppBarOverlay"
parent="ThemeOverlay.AppCompat.Dark.ActionBar" />

<style name="AppTheme.PopupOverlay"
parent="ThemeOverlay.AppCompat.Light" />

</resources>

Build.Gradle

apply plugin: 'com.android.application'

android {
compileSdkVersion 26
defaultConfig {
applicationId "com.example.scdapp"
minSdkVersion 19
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
minifyEnabled false

154
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-
rules.pro'
}
}
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:design:26.1.0'
implementation 'com.android.support:support-vector-drawable:26.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-
core:3.0.1'

implementation 'de.hdodenhof:circleimageview:2.2.0'
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
implementation 'com.google.firebase:firebase-auth:11.4.2'
implementation 'com.firebaseui:firebase-ui-auth:3.0.0'
implementation 'com.google.firebase:firebase-storage:11.4.2'
implementation 'com.google.firebase:firebase-firestore:11.4.2'
implementation 'com.firebaseui:firebase-ui-firestore:3.0.0'
implementation 'com.android.support:recyclerview-v7:26.1.0'
implementation 'com.android.support:cardview-v7:26.1.0'
}
apply plugin: 'com.google.gms.google-services'

155
Screenshots

156
157
158
159
160
161
162
163
164
165
166
Hardware and Software Requirements:

Components Minimum Recommended


Requirements

Processor Core 2 Duo Core 2 Duo and Higher


Memory(RAM) 1 GB 1 GB or More
Hard Disk 4 GB 4 GB or More
Display(Resolution) VGA having 1024*800 VGA having 1024*800
resolution resolution

167
Bibliography:

www.Google.com

www.Wikipedia.com

www.Tutorialpoint.com

www.stackoverflow.com

www.github.com

168

You might also like