Вы находитесь на странице: 1из 165

PRELIMINARY

INVESTIGATION

1
1.1 Introduction
The main objective of the project is to create a platform where the Students get updated about the
notices that are put up on notice board ,and also all the communication by the hod or he faculty
members can be done with the help of this app.
A platform for all where Students will get updates regarding the notices,events in college.
Stay in touch with the departmental activities .
Get all the notices of a particular department in the app.

• Advantages:

- The proposed system is user friendly, easy to use and efficient.

- It is a platform so that all college student can connect with college.

- Paper-less communication.

- Can see Expired Notices.

- Urgent notices can be sent immediately.

- Users can Register whenever they want.

• Disadvantages:
- This requires an active internet connection
- The system will be only text based currently cannot upload pdf or images.
- The app is currently supported in android only.

2
1.2 Existing System & Its Limitation

• Existing system in college is a manually handled system.


• Notices are printed and sent to put up on notice board.
• Sometimes notices are not seen on the notice board.
• Urgent messages were not sent immediately.
• Also there was loss of information when sent from one source till it reached its destination
when using whatsapp.

1.3 Proposed System

• Proposed system is an android based system which will allow students to receive notices any
time .
• HOD/Staff/Office/Library can send notice at any time.
• Notice by the office will be sent to all.
• Notice by HOD/Teacher will be sent to respective department’s student.
• Students can see the users(other students and staff) of the same department.
• HOD can view students and staff of their department and other departments.
• Each notice will have a till date (time till which the notice will be shown on on-going notices
screen)
• It will have a registration screen where user can register for their particular course and as a
student/staff/hod etc.
• Only faculty members will post notice. The students will receive notice from their respective
department only. For example, the student studying in BVOC can receive notice from BVOC
department only, not from other academic department.
• In addition to that, students will receive notice from non academic department like, library,
Office, Gymkhana, etc.

3
1.4 Hardware and Software to be used

o Hardware Requirement: -
- Laptop or PC: -
1. I5 Processor Based Computer or higher
2. 8GB RAM
3. 15 GB Hard Disk

- Android: -
1. 1.2 Quad core Processor or higher
2. 1GB RAM

o Software Requirement: -
- Laptop or PC: -
1. Windows 7 or higher
2. Java
3. Android Studio
4. Node JS

- Android: -
1. Android v5.0 or higher

4
1.5 Fact Finding Technique

1. Do you read notice on app based notice-board ?

_______________________________________________________________________
2. How often do you read notice from physical notice-board?

_______________________________________________________________________
3. In your opinion, the app interface is?

_______________________________________________________________________
4. In your opinion, moving from the paper based and location restricted model to app
Based model is good or bad?

________________________________________________________________________
5. Should the app based notice board replicate the information from the paper based
version or should it be easy to update notice by user?

________________________________________________________________________
6. How easy would you it be posting notice on app compare to posting it on physical
notice board?

________________________________________________________________________
7. In your opinion how can we make notice posting process an easy and time saving
one?

________________________________________________________________________
8. In your opinion, how can this College app be improved?

________________________________________________________________________

5
1.6 Feasibility study

What Is a Feasibility Study?


As the name implies, a feasibility study is used to determine the viability of an idea, such as
ensuring a project is legally and technically feasible as well as economically justifiable. It
tells us whether a project is worth the investment—in some cases, a project may not be
doable. There can be many reasons for this, including requiring too many resources, which
not only prevents those resources from performing other tasks but also may cost more than an
organization would earn back by taking on a project that isn’t profitable.
A well-designed study should offer a historical background of the business or project, such as
a description of the product or service, accounting statements, details of operations and
management, marketing research and policies, financial data, legal requirements, and tax
obligations. Generally, such studies precede technical development and project
implementation.

Benefits of feasibility study:


The importance of a feasibility study is based on organizational desire to “get it right” before
committing resources, time, or budget. A feasibility study might uncover new ideas that could
completely change a project’s scope. It’s best to make these determinations in advance, rather
than to jump in and to learn that the project won’t work. Conducting a feasibility study is
always beneficial to the project as it gives you and other stakeholders a clear picture of the
proposed project.

Five Areas of Project Feasibility


A feasibility study evaluates the project’s potential for success; therefore, perceived
objectivity is an essential factor in the credibility of the study for potential investors and
lending institutions. There are five types of feasibility study—separate areas that a feasibility
study examines, described below.

1. Technical Feasibility:
This assessment focuses on the technical resources available to the organization. It helps
organizations determine whether the technical resources meet capacity and whether the

6
technical team is capable of converting the ideas into working systems. Technical feasibility
also involves evaluation of the hardware, software, and other technical requirements of the
proposed system. As an exaggerated example, an organization wouldn’t want to try to put
Star Trek’s transporters in their building—currently, this project is not technically feasible.

2. Economic Feasibility:
This assessment typically involves a cost/ benefits analysis of the project, helping
organizations determine the viability, cost, and benefits associated with a project before
financial resources are allocated. It also serves as an independent project assessment and
enhances project credibility—helping decision-makers determine the positive economic
benefits to the organization that the proposed project will provide.

3. Legal Feasibility:
This assessment investigates whether any aspect of the proposed project conflicts with legal
requirements like zoning laws, data protection acts or social media laws. Let’s say an
organization wants to construct a new office building in a specific location. A feasibility
study might reveal the organization’s ideal location isn’t zoned for that type of business. That
organization has just saved considerable time and effort by learning that their project was not
feasible right from the beginning.

4. Operational Feasibility:
This assessment involves undertaking a study to analyze and determine whether—and how
well—the organization’s needs can be met by completing the project. Operational feasibility
studies also examine how a project plan satisfies the requirements identified in the
requirements analysis phase of system development.

5. Scheduling Feasibility:
This assessment is the most important for project success; after all, a project will fail if not
completed on time. In scheduling feasibility, an organization estimates how much time the
project will take to complete.

When these areas have all been examined, the feasibility study helps identify any constraints
the proposed project may face, including:

7
- Internal Project Constraints: Technical, Technology, Budget, Resource, etc.
- Internal Corporate Constraints: Financial, Marketing, Export, etc.
- External Constraints: Logistics, Environment, Laws and Regulations, etc.

8
1.7 Project Schedule

Sr. No. Task From To Time


1 Build 1 1st July, 2019 11th July, 2019 11 days
2 Build 2 12th July, 2019 16th August, 2019 35 days
3 Build 3 17th August, 2019 19th September, 2019 33 days
4 Build 4 20th September, 2019 30th September, 2019 10 days

9
1.8 SDLC Model:

Iterative Model

In the Iterative model, iterative process starts with a simple implementation of a small set of
the software requirements and iteratively enhances the evolving versions until the complete
system is implemented and ready to be deployed.

An iterative life cycle model does not attempt to start with a full specification of
requirements. Instead, development begins by specifying and implementing just part of the
software, which is then reviewed to identify further requirements. This process is then
repeated, producing a new version of the software at the end of each iteration of the model.

Advantages:

The advantage of this model is that there is a working model of the system at a very early
stage of development, which makes it easier to find functional or design flaws. Finding issues
at an early stage of development enables to take corrective measures in a limited budget.

The advantages of the Iterative and Incremental SDLC Model are as follows −

• Some working functionality can be developed quickly and early in the life cycle.

• Results are obtained early and periodically.

• Parallel development can be planned.

• Progress can be measured.

• Less costly to change the scope/requirements.

• Testing and debugging during smaller iteration is easy.

• Risks are identified and resolved during iteration; and each iteration is an easily
managed milestone.

• Easier to manage risk - High risk part is done first.

10
• With every increment, operational product is delivered.

• Issues, challenges and risks identified from each increment can be utilized/applied to
the next increment.

• Risk analysis is better.

• It supports changing requirements.

• Initial Operating time is less.

• Better suited for large and mission-critical projects.

• During the life cycle, software is produced early which facilitates customer evaluation
and feedback.

Disadvantages:

The disadvantage with this SDLC model is that it is applicable only to large and bulky
software development projects. This is because it is hard to break a small software system
into further small serviceable increments/modules.

The disadvantages of the Iterative and Incremental SDLC Model are as follows −

• More resources may be required.

• Although cost of change is lesser, but it is not very suitable for changing
requirements.

• System architecture or design issues may arise because not all requirements are
gathered in the beginning of the entire life cycle.

• Defining increments may require definition of the complete system.

• Not suitable for smaller projects

• Management complexity is more.

• End of project may not be known which is a risk.

11
• Highly skilled resources are required for risk analysis.

• Projects progress is highly dependent upon the risk analysis phase.

Application:

Like other SDLC models, Iterative and incremental development has some specific
applications in the software industry. This model is most often used in the following
scenarios −

• Requirements of the complete system are clearly defined and understood.

• Major requirements must be defined; however, some functionalities or requested


enhancements may evolve with time.

• There is a time to the market constraint.

• A new technology is being used and is being learnt by the development team while
working on the project.

• Resources with needed skill sets are not available and are planned to be used on
contract basis for specific iterations.

• There are some high-risk features and goals which may change in the future.

12
SYSTEM ANALYSIS

13
2.1 Event Table
EVENT TRIGGER SOURCE ACTIVITY RESPONSE DESTINATION

User Registration User Registration of Login Page User


Registration Detail user

User Login Email id User Login Home Page User


Password

Enter into create User creates notice View the notice User
Home Page

Profile tab User Details User View the Get the info of User
profile the logged in
user

Expired notice Expired notice User View notices View notice User
after date

My notices Shows my User Display the View notices User


notice notice of the
user logged in

14
2.2 Entity Relation Diagram

15
2.3 Class Diagram

16
2.4 Object Diagram

17
2.5 Use Case

18
2.6 Activity Diagram

19
2.7 Sequence Diagram

20
2.8 State Flow

21
SYSTEM DESIGN

22
3.1 Component Diagram

23
4.2 Deployment Diagram

24
4.3 Package Diagram

25
SYSTEM CODING

26
4.1 Code
Android_Manifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:dist="http://schemas.android.com/apk/distribution"
package="com.kalpesh.collegeapp">
<application
android:allowBackup="true"
android:icon="@drawable/jhclogostroke"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name=".ProfileActivity"
android:label="@string/title_activity_profile"
android:parentActivityName=".Nav"
android:theme="@style/AppTheme.NoActionBar">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.kalpesh.collegeapp.Nav" />
</activity>
<activity
android:name=".Mynoticedetail"
android:label="@string/title_activity_mynoticedetail"
android:parentActivityName=".MynoticesActivity"
android:theme="@style/AppTheme.NoActionBar">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.kalpesh.collegeapp.MynoticesActivity" />
</activity>
<activity

27
android:name=".MynoticesActivity"
android:label="@string/title_activity_mynotices"
android:parentActivityName=".Nav"
android:theme="@style/AppTheme.NoActionBar">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.kalpesh.collegeapp.Nav" />
</activity>
<activity
android:name=".userdetailActivity"
android:label="@string/title_activity_userdetail"
android:parentActivityName=".UsersActivity"
android:theme="@style/AppTheme.NoActionBar">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.kalpesh.collegeapp.UsersActivity" />
</activity>
<activity
android:name=".UsersActivity"
android:label="@string/title_activity_users"
android:parentActivityName=".Nav"
android:theme="@style/AppTheme.NoActionBar">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.kalpesh.collegeapp.Nav" />
</activity>
<activity
android:name=".viewNotice"
android:label="@string/title_activity_view_notice"
android:parentActivityName=".Nav"
android:theme="@style/AppTheme.NoActionBar">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.kalpesh.collegeapp.Nav" />
28
</activity> <activity
android:name=".createnotice"
android:label="@string/title_activity_createnotice"
android:parentActivityName=".Nav"
android:theme="@style/AppTheme.NoActionBar">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.kalpesh.collegeapp.Nav" />
</activity> <activity
android:name=".Nav"
android:label="@string/title_activity_nav"
android:theme="@style/AppTheme.NoActionBar" />
<activity android:name=".forgot_passwordActivity" />
<activity android:name=".Register_activity" />
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service
android:name=".MyFirebaseMessagingService"
android:exported="false">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
</application>
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.INTERNET" />
<dist:module dist:instant="true" />
</manifest>

29
Data.java:
package com.kalpesh.collegeapp.model;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
public class Data {
private String title;
private String toDate;
private String date;
private String description;
private String id;
private String name;
private String Department;
private String pdfDoc;
private List<String> adepartment;
public Data() {
}
public Data(String title, String date, String toDate, String description, String id, String
name, String Department,String pdfDoc, List<String> adepartment) {
this.title = title;
this.date = date;
this.toDate = toDate;
this.description = description;
this.id = id;
this.name=name;
this.Department=Department;
this.pdfDoc=pdfDoc;
this.adepartment=adepartment;
}
public String getTitle() {
return title;
}

30
public void setTitle(String title) {
this.title = title;
}

public String getToDate() {


return toDate;
}

public void setToDate(String toDate) {


this.toDate = toDate;
}

public String getDate() {


return date;
}

public void setDate(String date) {


this.date = date;
}

public String getDescription() {


return description;
}

public void setDescription(String description) {


this.description = description;
}

public String getId() {


return id;
}

public void setId(String id) {


this.id = id;
31
}

public String getName() {


return name;
}

public void setName(String name) {


this.name = name;
}
public String getDepartment() {
return Department;
}

public void setDepartment(String department) {


this.Department = department;
}
public String getPdfDoc() {
return pdfDoc;
}

public void setPdfDoc(String pdfDoc) {


this.pdfDoc = pdfDoc;
}
public List<String> getAdepartment() {
return adepartment;
}
public void setAdepartment(List<String> Adepartment)
{
this.adepartment=adepartment;
}

32
user.java:
package com.kalpesh.collegeapp.model;
public class user {
private String name;
private String phone;
private String department;
private String post;
public user()
{ }
public user(String name, String phone, String department, String post) {
this.name = name;
this.phone = phone;
this.department = department;
this.post = post;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getDepartment() {
return department;
}
public void setDepartment(String department) {
this.department = department; }

33
public String getPost() {
return post;
}

public void setPost(String post) {


this.post = post;
}
}

Constants.java
package com.kalpesh.collegeapp;

public class Constants {

public static final String CHANNEL_ID = "my_channel_01";


public static final String CHANNEL_NAME = "College App Notification";
public static final String CHANNEL_DESCRIPTION = "College App";
}

34
Activity_main.xml:
<?xml version="1.0" encoding="utf-8"?>
<androidx.appcompat.widget.LinearLayoutCompat
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/backdesign"
tools:context=".MainActivity">
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_gravity="center_vertical">
<androidx.appcompat.widget.AppCompatTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="College APP"
android:textAppearance="@style/TextAppearance.AppCompat.Large"
android:textSize="50dp"
android:layout_marginBottom="10dp"
android:textColor="@android:color/white" />
<androidx.appcompat.widget.AppCompatImageView
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_marginTop="10dp"
android:layout_gravity="center"
android:src="@drawable/jhclogostroke"
></androidx.appcompat.widget.AppCompatImageView>

35
<androidx.appcompat.widget.AppCompatEditText
android:id="@+id/email_login"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:layout_gravity="end"
android:hint="Email:"
android:inputType="textEmailAddress"
android:textColor="@android:color/white"
android:textColorHint="@android:color/white" />

<androidx.appcompat.widget.AppCompatEditText
android:id="@+id/password_login"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:hint="Password:"
android:inputType="textPassword"
android:textColor="@android:color/white"
android:textColorHint="@android:color/white" />
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/btn_login"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:text="Sign in"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
android:background="@drawable/button_design"
android:textColor="@android:color/white"
/>
<androidx.appcompat.widget.AppCompatTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
36
android:gravity="center"
android:text="OR"
android:textAppearance="@style/TextAppearance.AppCompat.Large"
android:textColor="@android:color/black" />
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/btn_Register"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:text="Register"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
android:background="@drawable/button_design"
android:textColor="@android:color/white"
/>
<androidx.appcompat.widget.AppCompatTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/fplabel"
android:text="Forgot Password?"
android:textColor="@android:color/white"
android:gravity="center"
android:layout_margin="10dp"

android:textAppearance="@style/TextAppearance.AppCompat.Large"></androidx.appcomp
at.widget.AppCompatTextView>
</androidx.appcompat.widget.LinearLayoutCompat>
</androidx.appcompat.widget.LinearLayoutCompat>

37
MyActivity.java:

package com.kalpesh.collegeapp;
import android.app.ProgressDialog;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.AuthResult;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.firestore.FirebaseFirestore;
public class MainActivity extends AppCompatActivity {
private EditText email;
private EditText password;
private Button btnLogin;
private Button btnRegister;
private FirebaseAuth mAuth;
private ProgressDialog mdialog;
private TextView fp;
private FirebaseFirestore db;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
db = FirebaseFirestore.getInstance();

38
mAuth = FirebaseAuth.getInstance();
mdialog = new ProgressDialog(this);
email = findViewById(R.id.email_login);
password = findViewById(R.id.password_login);
btnLogin = findViewById(R.id.btn_login);
btnRegister = findViewById(R.id.btn_Register);
fp = findViewById(R.id.fplabel);
if (mAuth.getCurrentUser() != null) {
startActivity(new Intent(getApplicationContext(), Nav.class));
}
btnLogin.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
String memail = email.getText().toString().trim();
String mpass = password.getText().toString().trim();
if (TextUtils.isEmpty(memail)) {
email.setError("required Field...");
return;
} else if (TextUtils.isEmpty(mpass)) {
password.setError("Required Field");
return;
} else {
mdialog.setMessage("Processing..");
mdialog.show();
mAuth.signInWithEmailAndPassword(memail,
mpass).addOnCompleteListener(new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if (task.isSuccessful()) {
mdialog.dismiss();
startActivity(new Intent(getApplicationContext(), Nav.class));
Toast.makeText(getApplicationContext(), "login complete",
Toast.LENGTH_SHORT).show();
} else {
39
mdialog.dismiss();
Toast.makeText(getApplicationContext(), "problem",
Toast.LENGTH_SHORT).show();

}
}
});
}
}
});
//going to registration page
btnRegister.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
startActivity(new Intent(getApplicationContext(), Register_activity.class));
}
});

fp.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
startActivity(new Intent(getApplicationContext(), forgot_passwordActivity.class));
}
});

}
}

40
activity_register_activity.xml:
<?xml version="1.0" encoding="utf-8"?>
<androidx.appcompat.widget.LinearLayoutCompat
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/backdesign"
tools:context=".Register_activity">
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_gravity="center_vertical">
<androidx.appcompat.widget.AppCompatTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="Registration"
android:textAppearance="@style/TextAppearance.AppCompat.Large"
android:textSize="50dp"
android:layout_marginBottom="10dp"
android:textColor="@android:color/white" />
<ImageView
android:id="@+id/regUserPhoto"
android:layout_width="125dp"
android:layout_height="120dp"
android:layout_gravity="center"
android:src="@drawable/userphoto" />

41
<androidx.appcompat.widget.AppCompatEditText
android:id="@+id/name_registration"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:layout_gravity="end"
android:hint="Name:"
android:textColor="@android:color/white"
android:textColorHint="@android:color/white"
></androidx.appcompat.widget.AppCompatEditText>
<androidx.appcompat.widget.AppCompatEditText
android:id="@+id/email_registration"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:layout_gravity="end"
android:hint="Email:"
android:textColor="@android:color/white"
android:textColorHint="@android:color/white" />
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Phone no:"
android:id="@+id/phone_register"
android:textColor="@android:color/white"
android:textColorHint="@android:color/white"
android:layout_margin="10dp"
android:inputType="number" />
<com.google.android.material.circularreveal.CircularRevealRelativeLayout
android:layout_width="match_parent"
android:layout_margin="10dp"
android:layout_height="wrap_content">

42
<Spinner
android:id="@+id/department"
android:outlineAmbientShadowColor="@android:color/white"
android:layout_width="match_parent"
android:layout_margin="10dp"
android:layout_alignParentRight="true"
android:backgroundTint="@android:color/white"
android:layout_height="wrap_content" />
</com.google.android.material.circularreveal.CircularRevealRelativeLayout>
<com.google.android.material.circularreveal.CircularRevealRelativeLayout
android:layout_width="match_parent"
android:layout_margin="10dp"
android:layout_height="wrap_content">
<Spinner
android:id="@+id/type"
android:outlineAmbientShadowColor="@android:color/white"
android:layout_width="match_parent"
android:layout_margin="10dp"
android:foregroundTint="@android:color/white"
android:backgroundTint="@android:color/white"
android:layout_height="wrap_content" />
</com.google.android.material.circularreveal.CircularRevealRelativeLayout>
<androidx.appcompat.widget.AppCompatEditText
android:id="@+id/password_registration"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:hint="Password:"
android:inputType="textPassword"
android:textColor="@android:color/white"
android:textColorHint="@android:color/white" />
<androidx.appcompat.widget.AppCompatEditText
android:id="@+id/confirm_password_registration"
android:layout_width="match_parent"
43
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:hint=" Confirm Password:"
android:inputType="textPassword"
android:textColor="@android:color/white"
android:textColorHint="@android:color/white" /> />
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/btn_Register_reg"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:text="Register"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
android:background="@drawable/button_design"
android:textColor="@android:color/white" />
<androidx.appcompat.widget.AppCompatTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="OR"
android:textAppearance="@style/TextAppearance.AppCompat.Large"
android:textColor="@android:color/white" />
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/btn_login_reg"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:text="Sign In"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
android:background="@drawable/button_design"
android:textColor="@android:color/white"/>
</androidx.appcompat.widget.LinearLayoutCompat>
</androidx.core.widget.NestedScrollView>
</androidx.appcompat.widget.LinearLayoutCompat>
44
Register_activity.java:

package com.kalpesh.collegeapp;
import android.app.ProgressDialog;
import android.content.Intent;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Bundle;
import android.provider.MediaStore;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.Spinner;
import android.widget.Toast;

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

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.auth.AuthResult;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
import com.google.firebase.firestore.DocumentReference;
import com.google.firebase.firestore.FirebaseFirestore;

45
import com.google.firebase.storage.FirebaseStorage;
import com.google.firebase.storage.StorageReference;
import com.google.firebase.storage.UploadTask;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;

public class Register_activity extends AppCompatActivity {


ImageView ImgUserPhoto;
static int PReqCode = 1;
static int REQUESCODE = 1;
private StorageReference mStorageRef;
Uri pickedImgUrl;
private FirebaseFirestore db;
private EditText email, phone, name;
private EditText password, confirm_pass;
private Button btnLoginreg;
private Button btnRegisterreg;
String profileImgUrl;
String UID;
private FirebaseAuth mAuth;
private ProgressDialog mdialog;
private String department;
private String position1;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_register_activity);
mAuth = FirebaseAuth.getInstance();
db = FirebaseFirestore.getInstance();
mdialog = new ProgressDialog(this);
email = findViewById(R.id.email_registration);
password = findViewById(R.id.password_registration);
46
confirm_pass = findViewById(R.id.confirm_password_registration);
name = findViewById(R.id.name_registration);
phone = findViewById(R.id.phone_register);
btnLoginreg = findViewById(R.id.btn_login_reg);
btnRegisterreg = findViewById(R.id.btn_Register_reg);
final Spinner spinner = findViewById(R.id.department);
Spinner spinner1 = findViewById(R.id.type);
ArrayList<String> arrayList = new ArrayList<>();
ArrayList<String> arrayList1 = new ArrayList<>();
arrayList1.add("Post");
arrayList1.add("Student");
arrayList1.add("HOD");
arrayList1.add("Preoffesor");
arrayList.add("Department");
arrayList.add("BVOC");
arrayList.add("IT");
arrayList.add("BCOM");
arrayList.add("BSC");
arrayList.add("JC");
arrayList.add("Office");
ArrayAdapter<String> arrayAdapter = new ArrayAdapter<String>(this,
android.R.layout.simple_spinner_item, arrayList);
arrayAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item)
;
spinner.setAdapter(arrayAdapter);
spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id)
{
department = parent.getItemAtPosition(position).toString();
Toast.makeText(parent.getContext(), "Selected: " + department,
Toast.LENGTH_LONG).show();
}

47
@Override
public void onNothingSelected(AdapterView<?> parent) {
}
});
ArrayAdapter<String> arrayAdapter1 = new ArrayAdapter<String>(this,
android.R.layout.simple_spinner_item, arrayList1);
arrayAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item)
;
spinner1.setAdapter(arrayAdapter1);
spinner1.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id)
{
position1 = parent.getItemAtPosition(position).toString();
Toast.makeText(parent.getContext(), "Selected: " + position1,
Toast.LENGTH_LONG).show();
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
}
});
ImgUserPhoto = findViewById(R.id.regUserPhoto);
ImgUserPhoto.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Toast.makeText(getApplicationContext(), "image",
Toast.LENGTH_SHORT).show();
openGallery();
}
});
btnRegisterreg.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
String mEmail = email.getText().toString().trim();
48
String mpass = password.getText().toString().trim();
if (TextUtils.isEmpty(mEmail)) {
email.setError("required Field...");
return;
}
if (TextUtils.isEmpty(mpass)) {
password.setError("Required Field");
return;
}
if (department.contentEquals("Department")) {
Toast.makeText(getApplicationContext(), "select a department",
Toast.LENGTH_SHORT).show();
}
if (position1.contentEquals("Post")) {
Toast.makeText(getApplicationContext(), "select a Post",
Toast.LENGTH_SHORT).show();
}
if (phone.getText().toString().isEmpty()) {
Toast.makeText(getApplicationContext(), "Enter a phone no.",
Toast.LENGTH_SHORT).show();
}
mdialog.setMessage("processing...");
mdialog.show();
mAuth.createUserWithEmailAndPassword(mEmail,
mpass).addOnCompleteListener(new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if (task.isSuccessful()) {
startActivity(new Intent(getApplicationContext(), Nav.class));
FirebaseUser mUser = mAuth.getCurrentUser();
UID = mUser.getUid();
Saveuserinfo();
Toast.makeText(getApplicationContext(), "Registration complete",
Toast.LENGTH_SHORT).show();
49
mdialog.dismiss();
} else {
mdialog.dismiss();
Toast.makeText(getApplicationContext(), "problem",
Toast.LENGTH_SHORT).show();

}
}
});
}

});

//Redirect to login page


btnLoginreg.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
startActivity(new Intent(getApplicationContext(), MainActivity.class));
}
});
}
private void Saveuserinfo() {
String mName = name.getText().toString().trim();
String mDepartment = department.toString().trim();
String mPhone = phone.getText().toString();
String mtype = position1.toString().trim();
Map<String, Object> user = new HashMap<>();
user.put("name", mName);
user.put("Department", mDepartment);
user.put("phone", mPhone);
user.put("type", mtype);
user.put("profile", profileImgUrl);
user.put("uid", UID);
db.collection("Users")
50
.add(user)
.addOnSuccessListener(new OnSuccessListener<DocumentReference>() {
@Override
public void onSuccess(DocumentReference documentReference) {
Log.d("kalpeshFS", "DocumentSnapshot added with ID: " +
documentReference.getId());
}
})
.addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
Log.d("kalpeshFSE", "Error adding document", e);
}
});
}
private void openGallery() {
Intent galleryIntent = new Intent();
galleryIntent.setType("image/*");
galleryIntent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(galleryIntent, "select profile image"),
REQUESCODE);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == REQUESCODE && resultCode == RESULT_OK && data != null
&& data.getData() != null) {
pickedImgUrl = data.getData();
try {
Bitmap bitmap = MediaStore.Images.Media.getBitmap(getContentResolver(),
pickedImgUrl);
ImgUserPhoto.setImageBitmap(bitmap);
uploadImagetoFirebase();
} catch (IOException e) {
51
e.printStackTrace();
}
}
}
private void uploadImagetoFirebase() {
final StorageReference profilepicRef =
FirebaseStorage.getInstance().getReference("profilepics/" + System.currentTimeMillis() +
".jpg");
if (pickedImgUrl != null) {
profilepicRef.putFile(pickedImgUrl).addOnSuccessListener(new
OnSuccessListener<UploadTask.TaskSnapshot>() {
@Override
public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {
Toast.makeText(getApplicationContext(), "success",
Toast.LENGTH_SHORT).show();
profilepicRef.getDownloadUrl().addOnSuccessListener(new
OnSuccessListener<Uri>() {
@Override
public void onSuccess(Uri uri) {
Uri downloadUrl = uri;
profileImgUrl = downloadUrl.toString();
}
});
}
}).addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
Toast.makeText(getApplicationContext(), "problem" + e,
Toast.LENGTH_SHORT).show();
}
});
}
}
}
52
activity_forgot_password.xml:

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


<androidx.appcompat.widget.LinearLayoutCompat
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/backdesign"
tools:context=".forgot_passwordActivity">
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_gravity="center_vertical">
<androidx.appcompat.widget.AppCompatTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="Forgot Password"
android:textAppearance="@style/TextAppearance.AppCompat.Large"
android:textSize="40dp"
android:layout_marginBottom="10dp"
android:textColor="@android:color/white" />
<androidx.appcompat.widget.AppCompatEditText
android:id="@+id/email_fp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:layout_gravity="end"
android:hint="Email:"
android:inputType="textEmailAddress"

53
android:textColor="@android:color/white"
android:textColorHint="@android:color/white" />
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/btn_fp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:text="Send reset link"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
android:background="@drawable/button_design"
android:textColor="@android:color/white"
/>
android:textColor="@android:color/black" />
</androidx.appcompat.widget.LinearLayoutCompat>
</androidx.appcompat.widget.LinearLayoutCompat>

54
forgot_passwordActivity.java:

package com.kalpesh.collegeapp;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.FirebaseAuth;
public class forgot_passwordActivity extends AppCompatActivity {
private Button Forgotpassword;
private EditText email;
private FirebaseAuth mAuth;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_forgot_password);
Forgotpassword = findViewById(R.id.btn_fp);
email = findViewById(R.id.email_fp);
mAuth = FirebaseAuth.getInstance();
Forgotpassword.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
String fpemail = email.getText().toString().trim();
if (TextUtils.isEmpty(fpemail)) {
email.setError("Required Field");
Toast.makeText(getApplicationContext(), "Enter Proper Email",

55
Toast.LENGTH_SHORT).show();
}
mAuth.sendPasswordResetEmail(fpemail).addOnCompleteListener(new
OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
if (task.isSuccessful()) {
Toast.makeText(getApplicationContext(), "Mail has been sent to your mail
id to reset your Password", Toast.LENGTH_SHORT).show();
startActivity(new Intent(getApplicationContext(), MainActivity.class));
} else {
String message = task.getException().getMessage();
Toast.makeText(getApplicationContext(), "Error Occured" + message,
Toast.LENGTH_SHORT).show();
}
}
});
}
});
}
}

56
activity_nav.xml:
<?xml version="1.0" encoding="utf-8"?>
<androidx.drawerlayout.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:openDrawer="start">
<include
layout="@layout/app_bar_nav"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<com.google.android.material.navigation.NavigationView
android:id="@+id/nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:fitsSystemWindows="true"
app:headerLayout="@layout/nav_header_nav"
app:menu="@menu/activity_nav_drawer" />
</androidx.drawerlayout.widget.DrawerLayout>
app_bar_nav.xml:
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout
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=".Nav">

57
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/AppTheme.PopupOverlay" />
<com.google.android.material.tabs.TabLayout
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.google.android.material.tabs.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="On-Going" />
<com.google.android.material.tabs.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Expired" />
</com.google.android.material.tabs.TabLayout>
</com.google.android.material.appbar.AppBarLayout>
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="@dimen/fab_margin"
app:srcCompat="@android:drawable/ic_input_add" />
<include layout="@layout/content_nav" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>

58
Content_nav.xml:
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.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"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:showIn="@layout/app_bar_nav">
<fragment
android:id="@+id/nav_host_fragment"
android:name="androidx.navigation.fragment.NavHostFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:defaultNavHost="true"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:navGraph="@navigation/mobile_navigation">
</fragment>
<androidx.viewpager.widget.ViewPager
android:id="@+id/viewpager"
android:layout_width="wrap_content"
android:layout_height="match_parent"
app:layout_constraintStart_toStartOf="parent"
tools:layout_editor_absoluteY="223dp"></androidx.viewpager.widget.ViewPager>
</androidx.constraintlayout.widget.ConstraintLayout>
nav_header_nav.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"

59
android:layout_height="@dimen/nav_header_height"
android:background="@drawable/side_nav_bar"
android:gravity="bottom"
android:orientation="vertical"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
android:theme="@style/ThemeOverlay.AppCompat.Dark">
<ImageView
android:id="@+id/profileImage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/nav_header_desc"
android:paddingTop="@dimen/nav_header_vertical_spacing"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="@dimen/nav_header_vertical_spacing"
android:text="College App"
android:textAppearance="@style/TextAppearance.AppCompat.Body1" />
<TextView
android:id="@+id/uname_header"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="" />
</LinearLayout>
Menu/activity_nav_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">

60
<group android:checkableBehavior="single">
<item
android:id="@+id/nav_home"
android:icon="@drawable/ic_menu_camera"
android:title="@string/menu_home" />
<item
android:id="@+id/nav_users"
android:icon="@drawable/ic_menu_gallery"
android:title="Users" />
<item
android:id="@+id/myprofile"
android:icon="@drawable/ic_menu_slideshow"
android:title="My Profile" />
<item
android:id="@+id/nav_tools"
android:icon="@drawable/ic_menu_manage"
android:title="@string/menu_tools" />
</group>
<item android:title="">
<menu>
<item
android:id="@+id/Mynotices"
android:icon="@drawable/ic_menu_share"
android:title="My Notices" />
<item
android:id="@+id/nav_send"
android:icon="@drawable/ic_menu_send"
android:title="@string/menu_send" />
</menu>
</item
</menu>

61
Menu/menu.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">
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
tools:context=".MainActivity">
<item
android:id="@+id/action_more"
android:title=""
app:showAsAction="always"/>
<item
android:id="@+id/logout"
android:title="Logout"
app:showAsAction="never" />
/>
</menu>
Menu/nav.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/log"
android:orderInCategory="100"
android:title="logout"
app:showAsAction="never" />
</menu>
nav_header_nav.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"

62
android:background="@drawable/side_nav_bar"
android:gravity="bottom"
android:orientation="vertical"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
android:theme="@style/ThemeOverlay.AppCompat.Dark">

<ImageView
android:id="@+id/profileImage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/nav_header_desc"
android:paddingTop="@dimen/nav_header_vertical_spacing"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="@dimen/nav_header_vertical_spacing"
android:text="College App"
android:textAppearance="@style/TextAppearance.AppCompat.Body1" />
<TextView
android:id="@+id/uname_header"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="" />
</LinearLayout>

63
Nav.java:
package com.kalpesh.collegeapp;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.appcompat.app.ActionBarDrawerToggle;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import androidx.drawerlayout.widget.DrawerLayout;
import androidx.navigation.NavController;
import androidx.navigation.Navigation;
import androidx.navigation.ui.AppBarConfiguration;
import androidx.navigation.ui.NavigationUI;
import androidx.recyclerview.widget.RecyclerView;
import androidx.viewpager.widget.ViewPager;
import com.bumptech.glide.Glide;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.google.android.material.navigation.NavigationView;
import com.google.android.material.tabs.TabLayout;
import com.google.firebase.auth.FirebaseAuth;

64
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.firestore.FirebaseFirestore;
import com.google.firebase.firestore.QueryDocumentSnapshot;
import com.google.firebase.firestore.QuerySnapshot;
import com.google.firebase.iid.FirebaseInstanceId;
import com.google.firebase.iid.InstanceIdResult;
import com.google.firebase.messaging.FirebaseMessaging;

public class Nav extends AppCompatActivity implements


NavigationView.OnNavigationItemSelectedListener {
private EditText selectDate;
private TextView uname;
private ImageView profile;
String name;
String UID;
String url1;
private NavigationView navigationView;
private RecyclerView recyclerView;
private AppBarConfiguration mAppBarConfiguration;
//firebase
private FloatingActionButton floatingActionButton;
private FirebaseAuth mAuth;
private String Dept;
private DatabaseReference mDatabase;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_nav);
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
profile = findViewById(R.id.profileImage);
mAuth = FirebaseAuth.getInstance();
floatingActionButton = findViewById(R.id.fab);
65
UID = mAuth.getCurrentUser().getUid();
FirebaseInstanceId.getInstance().getInstanceId()
.addOnCompleteListener(new OnCompleteListener<InstanceIdResult>() {
@Override
public void onComplete(@NonNull Task<InstanceIdResult> task) {
if (!task.isSuccessful()) {
Log.w("token", "getInstanceId failed", task.getException());
return;
}
// Get new Instance ID token
String token = task.getResult().getToken();

// Log and toast


Log.d("token my", "onComplete: " + token);
// Toast.makeText(Nav.this,token, Toast.LENGTH_SHORT).show();
}
});
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
NotificationManager mNotificationManager =
(NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
int importance = NotificationManager.IMPORTANCE_HIGH;
NotificationChannel mChannel = new NotificationChannel(Constants.CHANNEL_ID,
Constants.CHANNEL_NAME, importance);
mChannel.setDescription(Constants.CHANNEL_DESCRIPTION);
mChannel.enableLights(true);
mChannel.setLightColor(Color.RED);
mChannel.enableVibration(true);
mChannel.setVibrationPattern(new long[]{100, 200, 300, 400, 500, 400, 300, 200,
400});
mNotificationManager.createNotificationChannel(mChannel);
}
/*
* Displaying a notification locally
*/
66
//MyNotificationManager.getInstance(this).displayNotification("Greetings", "Hello how
are you?");
FirebaseFirestore db = FirebaseFirestore.getInstance();
db.collection("Users")
.whereEqualTo("uid", UID)
.get()
.addOnCompleteListener(new OnCompleteListener<QuerySnapshot>() {
@Override
public void onComplete(@NonNull Task<QuerySnapshot> task) {
if (task.isSuccessful()) {
for (QueryDocumentSnapshot document : task.getResult()) {
name = (String) document.get("name");
Dept = document.get("Department").toString();
FirebaseMessaging.getInstance().subscribeToTopic(Dept);
// Toast.makeText(getApplicationContext(), "Topic Subscribed",
Toast.LENGTH_LONG).show();
try {
url1 = document.get("profile").toString();
} catch (Exception e) {
e.printStackTrace();
}
Log.d("kalpeshfs", document.getId() + " => " + name);
View header = navigationView.getHeaderView(0);
uname = header.findViewById(R.id.uname_header);
uname.setText(name);
String ty = document.get("type").toString().trim();
if (ty.contentEquals("Student")) {
floatingActionButton.hide();
}
try {
Glide.with(getApplicationContext()).load(url1).into(profile);
} catch (Exception e) {
e.printStackTrace();
}
67
uname.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
startActivity(new Intent(getApplicationContext(),
MainActivity.class));
}
});
Log.d("kalpeshfs", document.getId() + " => " + document.getData());
}
} else {
Log.d("kalpeshfs", "Error getting documents: ", task.getException());
}
}
});
TabLayout tabLayout = findViewById(R.id.tabs);
ViewPager Pager = findViewById(R.id.viewpager);
tabpagerAdapter TabpagerAdapter = new
tabpagerAdapter(getSupportFragmentManager());
Pager.setAdapter(TabpagerAdapter);
tabLayout.setupWithViewPager(Pager);
//firebase
mDatabase =
FirebaseDatabase.getInstance().getReference().child("Notices").child(UID);
floatingActionButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
// Click action
startActivity(new Intent(getApplicationContext(), createnotice.class));
}
});
DrawerLayout drawer = findViewById(R.id.drawer_layout);
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
this, drawer, toolbar, R.string.navigation_drawer_open,
R.string.navigation_drawer_close);
68
drawer.addDrawerListener(toggle);
toggle.syncState();
navigationView = findViewById(R.id.nav_view);
NavigationView navigationView = findViewById(R.id.nav_view);
Menu menu = navigationView.getMenu();
// Passing each menu ID as a set of Ids because each
// menu should be considered as top level destinations.
mAppBarConfiguration = new AppBarConfiguration.Builder(
R.id.nav_home, R.id.nav_gallery, R.id.nav_slideshow,
R.id.nav_tools, R.id.nav_share, R.id.nav_send)
.setDrawerLayout(drawer)
.build();
NavController navController = Navigation.findNavController(this,
R.id.nav_host_fragment);
NavigationUI.setupActionBarWithNavController(this, navController,
mAppBarConfiguration);
NavigationUI.setupWithNavController(navigationView, navController);
navigationView.setNavigationItemSelectedListener(new
NavigationView.OnNavigationItemSelectedListener() {
@Override
public boolean onNavigationItemSelected(MenuItem menuItem) {
int id = menuItem.getItemId();
switch (id) {
case R.id.nav_home:
//Do some thing here
// add navigation drawer item onclick method here
break;
case R.id.nav_users:
Intent i = new Intent(getApplicationContext(), UsersActivity.class);
startActivity(i);
break;
case R.id.Mynotices:
Intent a = new Intent(getApplicationContext(), MynoticesActivity.class);
startActivity(a);
69
break;
case R.id.myprofile:
Intent b = new Intent(getApplicationContext(), ProfileActivity.class);
startActivity(b);
break;
}
return false;
}
});

}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.nav, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
switch (item.getItemId()) {
case R.id.log: {
FirebaseMessaging.getInstance().unsubscribeFromTopic(Dept);
//
Toast.makeText(getApplicationContext(),"unsubscribed"+Dept,Toast.LENGTH_SHORT).sho
w();
mAuth.signOut();
startActivity(new Intent(getApplicationContext(), MainActivity.class));
}
}
return super.onOptionsItemSelected(item);
}
@Override
public boolean onSupportNavigateUp() {
NavController navController = Navigation.findNavController(this,
70
R.id.nav_host_fragment);
return NavigationUI.navigateUp(navController, mAppBarConfiguration)
|| super.onSupportNavigateUp();
}
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem menuItem) {
return false;
}
}

71
fragment_on_going.xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_height="match_parent"
tools:context=".OnGoing">
<!-- TODO: Update blank fragment layout -->
<TextView
android:id="@+id/temp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="Department"
android:textAppearance="@style/TextAppearance.AppCompat.Medium">
</TextView>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_ongoing"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>

72
OnGoing.java:
package com.kalpesh.collegeapp;
import android.app.ProgressDialog;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.firebase.ui.firestore.FirestoreRecyclerAdapter;
import com.firebase.ui.firestore.FirestoreRecyclerOptions;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.firestore.DocumentSnapshot;
import com.google.firebase.firestore.FirebaseFirestore;
import com.google.firebase.firestore.FirebaseFirestoreException;
import com.google.firebase.firestore.Query;
import com.google.firebase.firestore.QueryDocumentSnapshot;
import com.google.firebase.firestore.QuerySnapshot;
import com.kalpesh.collegeapp.model.Data;
import java.text.SimpleDateFormat;
import java.util.Date;
public class OnGoing extends Fragment {
private FirebaseAuth mAuth;
public LinearLayoutManager linearLayoutManager;
private FirebaseFirestore db;

73
private TextView temp;
private FirestoreRecyclerAdapter adapter;
private String UID;
private ProgressDialog mdialog;
String tempo;
private Query query;
private String Department;
public RecyclerView recyclerView1;
// Required empty public constructor
public OnGoing() {
}
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mAuth = FirebaseAuth.getInstance();
UID = mAuth.getCurrentUser().getUid();
db = FirebaseFirestore.getInstance();
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_on_going, container, false);
recyclerView1 = view.findViewById(R.id.recycler_ongoing);
temp = view.findViewById(R.id.temp);
mdialog = new ProgressDialog(getContext());
// Inflate the layout for this fragment;
init();
getNotices();
recyclerView1.setHasFixedSize(true);
return view;
}
private void init() {
linearLayoutManager = new LinearLayoutManager(getContext(),
LinearLayoutManager.VERTICAL, false);
74
recyclerView1.setLayoutManager(linearLayoutManager);
linearLayoutManager.setReverseLayout(true);
linearLayoutManager.setStackFromEnd(true);
db = FirebaseFirestore.getInstance();
}
private void getNotices() {
// DocumentReference docRef = db.collection("cities").document(Department);
// Query query = db.collection("Notices/"+Department);
mdialog.setMessage("Processing..");
mdialog.show();
db.collection("Users")
.whereEqualTo("uid", UID)
.get()
.addOnCompleteListener(new OnCompleteListener<QuerySnapshot>() {
@Override
public void onComplete(@NonNull Task<QuerySnapshot> task) {
if (task.isSuccessful()) {
for (QueryDocumentSnapshot document : task.getResult()) {
Department = document.get("Department").toString().trim();
// Query query = db.collection("Notices")
//.whereEqualTo("department",Department);
temp.setText(Department);
temp.setText(document.get("Department").toString());
Log.d("kalpeshDepartment", document.getId() + " => " + Department);
}
String pattern = "dd-MM-yyyy";
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(pattern);
String date1 = simpleDateFormat.format(new Date());
Log.d("date", "check todays date" + date1);
Log.d("Dep", "Department inside if" + Department);
query = db.collection("Notices").whereArrayContains("adepartment",
Department).whereGreaterThanOrEqualTo("toDate", date1).orderBy("toDate",
Query.Direction.DESCENDING);
FirestoreRecyclerOptions<Data> response = new
75
FirestoreRecyclerOptions.Builder<Data>()
.setQuery(query, Data.class)
.build();
mdialog.dismiss();
adapter = new FirestoreRecyclerAdapter<Data,
OnGoing.FriendsHolder>(response) {
@Override
public void onBindViewHolder(final OnGoing.FriendsHolder holder,
final int position, Data model) {
holder.title.setText("Title:- " + model.getTitle());
holder.description.setText("Description:- " + model.getDescription());
holder.author.setText("By:- " + model.getName());
holder.date.setText(model.getDate());
holder.toDate.setText("Valid till:- " + model.getToDate());
holder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
DocumentSnapshot snapshot =
getSnapshots().getSnapshot(holder.getAdapterPosition());
snapshot.getId();
Log.d("kalpesh fs", "onClick get id: " + snapshot.getId());
Intent ViewNotice1 = new Intent(getContext(), viewNotice.class);
Log.d("kalpesh kh", "onClick: " + snapshot.getId());
ViewNotice1.putExtra("noticeid", snapshot.getId());
startActivity(ViewNotice1);
}
});

}
@Override
public OnGoing.FriendsHolder onCreateViewHolder(ViewGroup group,
int i) {
View view = LayoutInflater.from(group.getContext())
.inflate(R.layout.item_layout, group, false);
76
return new FriendsHolder(view);
}
@Override
public void onError(FirebaseFirestoreException e) {
Log.e("KalpeshError", e.getMessage());
}
};
adapter.notifyDataSetChanged();
recyclerView1.setAdapter(adapter);
adapter.startListening();
} else {
Log.d("Dep", "Department" + Department);
Log.d("kalpeshfs", "Error getting documents: ", task.getException());
}
}
});
tempo = temp.getText().toString().trim();
Log.d("depvalue", "getNotices: " + tempo);
Log.d("Query", "Query: " + query);
}
public static class FriendsHolder extends RecyclerView.ViewHolder {
TextView title;
TextView description;
TextView author;
TextView date;
TextView toDate;
public FriendsHolder(View itemView) {
super(itemView);
title = itemView.findViewById(R.id.title_ongoing);
description = itemView.findViewById(R.id.description_ongoing);
author = itemView.findViewById(R.id.id_ongoing);
date = itemView.findViewById(R.id.date_ongoing);
77
toDate = itemView.findViewById(R.id.todate_ongoing);
}
}
/* @Override
public void onStart() {
super.onStart();
adapter.startListening();
}
@Override
public void onStop() {
super.onStop();
adapter.stopListening();
} */
}

78
fragment_expired.xml:

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


<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:orientation="vertical"
tools:context=".Expired">
<androidx.recyclerview.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/recycle_expired" />
</LinearLayout>

79
Expired.java:

package com.kalpesh.collegeapp;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.firebase.ui.firestore.FirestoreRecyclerAdapter;
import com.firebase.ui.firestore.FirestoreRecyclerOptions;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.firestore.DocumentSnapshot;
import com.google.firebase.firestore.FirebaseFirestore;
import com.google.firebase.firestore.FirebaseFirestoreException;
import com.google.firebase.firestore.Query;
import com.google.firebase.firestore.QueryDocumentSnapshot;
import com.google.firebase.firestore.QuerySnapshot;
import com.kalpesh.collegeapp.model.Data;
import java.text.SimpleDateFormat;
import java.util.Date;
public class Expired extends Fragment {
private FirebaseAuth mAuth;
public LinearLayoutManager linearLayoutManager;
private FirebaseFirestore db;

80
private TextView temp;
private FirestoreRecyclerAdapter adapter;
private String UID;
Query query;
private String Department;
public RecyclerView recyclerView1;
// Required empty public constructor
public Expired() {
}
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mAuth = FirebaseAuth.getInstance();
UID = mAuth.getCurrentUser().getUid();
db = FirebaseFirestore.getInstance();
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_expired, container, false);
recyclerView1 = view.findViewById(R.id.recycle_expired);
init();
getNotices();
recyclerView1.setHasFixedSize(true);
return view;
}
private void init() {
linearLayoutManager = new LinearLayoutManager(getContext(),
LinearLayoutManager.VERTICAL, false);
recyclerView1.setLayoutManager(linearLayoutManager);
linearLayoutManager.setReverseLayout(true);
linearLayoutManager.setStackFromEnd(true);
db = FirebaseFirestore.getInstance();
81
}
private void getNotices() {
// DocumentReference docRef = db.collection("cities").document(Department);
// Query query = db.collection("Notices/"+Department);
db.collection("Users")
.whereEqualTo("uid", UID)
.get()
.addOnCompleteListener(new OnCompleteListener<QuerySnapshot>() {
@Override
public void onComplete(@NonNull Task<QuerySnapshot> task) {
if (task.isSuccessful()) {
for (QueryDocumentSnapshot document : task.getResult()) {
Department = document.get("Department").toString().trim();
// Query query = db.collection("Notices")
//.whereEqualTo("department",Department);
Log.d("kalpeshDepartment", document.getId() + " => " + Department);
}
String pattern = "dd-MM-yyyy";
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(pattern);
String date1 = simpleDateFormat.format(new Date());
System.out.println(date1);
Log.d("date", "check todays date" + date1);
Log.d("Dep", "Department inside if" + Department);
Query query =
db.collection("Notices").whereArrayContains("adepartment",
Department).whereLessThan("toDate", date1).orderBy("toDate",
Query.Direction.DESCENDING);
FirestoreRecyclerOptions<Data> response = new
FirestoreRecyclerOptions.Builder<Data>()
.setQuery(query, Data.class)
.build();
adapter = new FirestoreRecyclerAdapter<Data,
Expired.FriendsHolder>(response) {
@Override
82
public void onBindViewHolder(final Expired.FriendsHolder holder, int
position, Data model) {
holder.title.setText("Title:- " + model.getTitle());
holder.description.setText("Description:- " + model.getDescription());
holder.author.setText("By:- " + model.getName());
holder.date.setText(model.getDate());
holder.toDate.setText("Valid till:- " + model.getToDate());
holder.itemView
.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
DocumentSnapshot snapshot =
getSnapshots().getSnapshot(holder.getAdapterPosition());
snapshot.getId();
Log.d("kalpesh fs", "onClick get id: " + snapshot.getId());
Intent ViewNotice = new Intent(getContext(),
viewNotice.class);
ViewNotice.putExtra("noticeid", snapshot.getId());
startActivity(ViewNotice);
}
});
}

@Override
public Expired.FriendsHolder onCreateViewHolder(ViewGroup group,
int i) {
View view = LayoutInflater.from(group.getContext())
.inflate(R.layout.item_layout, group, false);
return new FriendsHolder(view);
}
@Override
public void onError(FirebaseFirestoreException e) {
Log.e("KalpeshError", e.getMessage());
}
83
};
adapter.notifyDataSetChanged();
recyclerView1.setAdapter(adapter);
adapter.startListening();
} else {
Log.d("Dep", "Department" + Department);
Log.d("kalpeshfs", "Error getting documents: ", task.getException());
}
}
});
Log.d("Query", "Query: " + query);
}
public class FriendsHolder extends RecyclerView.ViewHolder {
TextView title;
TextView description;
TextView author;
TextView date;
TextView toDate;
public FriendsHolder(View itemView) {
super(itemView);
title = itemView.findViewById(R.id.title_ongoing);
description = itemView.findViewById(R.id.description_ongoing);
author = itemView.findViewById(R.id.id_ongoing);
date = itemView.findViewById(R.id.date_ongoing);
toDate = itemView.findViewById(R.id.todate_ongoing);
}
}
}

84
tabpagerAdapter.java

package com.kalpesh.collegeapp;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;
public class tabpagerAdapter extends FragmentPagerAdapter {
String[] tabarray = new String[]{"On-going", "Expired"};
public tabpagerAdapter(FragmentManager fm) {
super(fm);
}
@Nullable
@Override
public CharSequence getPageTitle(int position) {
return tabarray[position];
}
@Override
public Fragment getItem(int position) {
switch (position) {
case 0:
OnGoing ongoing1 = new OnGoing();
return ongoing1;
case 1:
Expired expired1 = new Expired();
return expired1;
}
return null;
}
@Override
public int getCount() {
return 2; }
}

85
item_layout.xml:

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


<androidx.cardview.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:elevation="10dp"
android:layout_margin="10dp"
android:id="@+id/cardview"
app:cardElevation="10dp"
android:layout_height="wrap_content">
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:orientation="vertical">
<androidx.appcompat.widget.LinearLayoutCompat
android:id="@+id/root"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center">
<TextView
android:id="@+id/title_ongoing"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:padding="10dp"
android:text="title"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"></TextView>
</androidx.appcompat.widget.LinearLayoutCompat>

86
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:orientation="vertical">
<TextView
android:id="@+id/description_ongoing"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:maxLines="1"
android:padding="5dp"
android:text="description"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"></TextView>
<TextView
android:id="@+id/id_ongoing"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:maxLines="1"
android:padding="5dp"
android:text="author"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"></TextView>
<TextView
android:id="@+id/date_ongoing"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:maxLines="2"
android:padding="5dp"
android:text="published date"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"></TextView>
<TextView
android:id="@+id/todate_ongoing"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:maxLines="2"
87
android:padding="5dp"
android:text="to date"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"></TextView>
</androidx.appcompat.widget.LinearLayoutCompat>
</androidx.appcompat.widget.LinearLayoutCompat>
</androidx.cardview.widget.CardView>

88
activity_createnotice.xml:

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


<androidx.coordinatorlayout.widget.CoordinatorLayout
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=".createnotice">
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbarCreatenotice"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/AppTheme.PopupOverlay" />
</com.google.android.material.appbar.AppBarLayout>
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<include layout="@layout/content_createnotice" />
</androidx.core.widget.NestedScrollView>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
content_createnotice.xml:
<?xml version="1.0" encoding="utf-8"?>
<androidx.appcompat.widget.LinearLayoutCompat
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"

89
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context=".createnotice"
tools:showIn="@layout/activity_createnotice">
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_marginTop="70dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<com.google.android.material.circularreveal.CircularRevealRelativeLayout
android:layout_width="0dp"
android:layout_weight="2"
android:layout_height="wrap_content"
>
<androidx.appcompat.widget.AppCompatTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Title"
android:layout_margin="10dp"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
/>
</com.google.android.material.circularreveal.CircularRevealRelativeLayout>
<com.google.android.material.circularreveal.CircularRevealRelativeLayout
android:layout_width="0dp"
android:layout_weight="3"
android:layout_height="wrap_content"
>
<androidx.appcompat.widget.AppCompatEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/title"
90
android:layout_margin="10dp"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
/>
</com.google.android.material.circularreveal.CircularRevealRelativeLayout>

</androidx.appcompat.widget.LinearLayoutCompat>
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<com.google.android.material.circularreveal.CircularRevealRelativeLayout
android:layout_width="0dp"
android:layout_weight="2"
android:layout_height="wrap_content"
>
<androidx.appcompat.widget.AppCompatTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Last Date"
android:layout_margin="10dp"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
/>
</com.google.android.material.circularreveal.CircularRevealRelativeLayout>
<com.google.android.material.circularreveal.CircularRevealRelativeLayout
android:layout_width="0dp"
android:layout_weight="3"
android:layout_height="wrap_content"
>
<androidx.appcompat.widget.AppCompatEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="datetime"
android:id="@+id/date"
91
android:focusable="false"
android:layout_margin="10dp"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
/>
</com.google.android.material.circularreveal.CircularRevealRelativeLayout>
</androidx.appcompat.widget.LinearLayoutCompat>
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
>
<EditText
android:id="@+id/description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textLongMessage"
android:hint="Description"/>
</androidx.appcompat.widget.LinearLayoutCompat>
<androidx.appcompat.widget.AppCompatButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="upload a pdf"
android:gravity="center"
android:id="@+id/upload"
android:layout_gravity="center"
android:layout_margin="10dp"
/>
<TextView
android:id="@+id/acknoledgement"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="10dp"
android:gravity="center"
92
android:text="selected file will be seen hare"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
android:textColor="@android:color/black"
>
</TextView>
<TextView
android:id="@+id/durl"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="10dp"
android:gravity="center"
android:text="empty"
android:visibility="invisible"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
android:textColor="@android:color/black"
>
</TextView>
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/send"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:background="@drawable/button_design"
android:layout_gravity="center"
android:text="send"
android:textAppearance="@style/TextAppearance.AppCompat.Large" />
</androidx.appcompat.widget.LinearLayoutCompat>

93
createnotice.java:

package com.kalpesh.collegeapp;
import android.Manifest;
import android.app.DatePickerDialog;
import android.app.ProgressDialog;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.DatePicker;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
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.auth.FirebaseAuth;
import com.google.firebase.firestore.FirebaseFirestore;
import com.google.firebase.firestore.QueryDocumentSnapshot;
import com.google.firebase.firestore.QuerySnapshot;
import com.google.firebase.storage.FirebaseStorage;

94
import com.google.firebase.storage.StorageReference;
import com.google.firebase.storage.UploadTask;
import com.kalpesh.collegeapp.model.Data;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
public class createnotice extends AppCompatActivity {
//firebase
FirebaseAuth mAuth;
private FirebaseFirestore db;
private DatePickerDialog picker;
private EditText title;
private EditText date;
private EditText description;
private String UID;
private Button upload;
private TextView notify, durl;
private Uri pdfUri;
String pdflink;
List<String> mADepartment;
private String acctodate;
private String name;
ProgressDialog mdialog;
private String Department;
static final SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
//notification
final private String FCM_API = "https://fcm.googleapis.com/fcm/send";
final private String serverKey = "key=" + "AAAAcz7I-Ls:APA91bFh_6HO-
iTXwTnu55KFZCSba-
mYN53vSmJRD94MnPjDocQfS3aMWO6Zkq5PPLqCJ2rVHXtqhNrHdsVg08_qciOCazmK
oIFJ1diH4fsC0U6DNUXIYPImNywYnLMSiBGzwW2gt5Xl";
final private String contentType = "application/json";
95
final String TAG = "NOTIFICATION TAG";
String NOTIFICATION_TITLE;
String NOTIFICATION_MESSAGE;
String TOPIC;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_createnotice);
Toolbar toolbar = findViewById(R.id.toolbarCreatenotice);
toolbar.setTitle("Create Notice");
setSupportActionBar(toolbar);
mdialog = new ProgressDialog(this);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
//firebase
FirebaseStorage firebaseStorage;
upload = findViewById(R.id.upload);
notify = findViewById(R.id.acknoledgement);
title = findViewById(R.id.title);
date = findViewById(R.id.date);
description = findViewById(R.id.description);
durl = findViewById(R.id.durl);
Button btnSave = findViewById(R.id.send);
mAuth = FirebaseAuth.getInstance();
UID = mAuth.getCurrentUser().getUid();
db = FirebaseFirestore.getInstance();
db.collection("Users")
.whereEqualTo("uid", UID)
.get()
.addOnCompleteListener(new OnCompleteListener<QuerySnapshot>() {
@Override
public void onComplete(@NonNull Task<QuerySnapshot> task) {
if (task.isSuccessful()) {
for (QueryDocumentSnapshot document : task.getResult()) {
name = (String) document.get("name");
96
Department = (String) document.get("Department");
Log.d("kalpeshfs", document.getId() + " => " + name);
Log.d("kalpeshfs", document.getId() + " => " + Department);
}
} else {
Log.d("kalpeshfs", "Error getting documents: ", task.getException());
}
}
});
date.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
final Calendar cldr = Calendar.getInstance();
int day = cldr.get(Calendar.DAY_OF_MONTH);
int month = cldr.get(Calendar.MONTH);
int year = cldr.get(Calendar.YEAR);
/* // date picker dialog
picker = new DatePickerDialog(createnotice.this,
new DatePickerDialog.OnDateSetListener() {
@Override
public void onDateSet(DatePicker view, int year, int monthOfYear, int
dayOfMonth) {
date.setText(dayOfMonth + "-" + (monthOfYear + 1) + "-" + year);
}
}, year, month, day);
picker.show(); */
picker = new DatePickerDialog(createnotice.this,
new DatePickerDialog.OnDateSetListener() {
@Override
public void onDateSet(DatePicker view, int year,
int monthOfYear, int dayOfMonth) {
Calendar calendar = Calendar.getInstance();
calendar.set(year, monthOfYear, dayOfMonth);
SimpleDateFormat format = new SimpleDateFormat("dd-MM-yyyy");
97
String dateString = format.format(calendar.getTime());
date.setText(dateString);
}
}, year, month, day);
picker.show();
}
});
upload.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (ContextCompat.checkSelfPermission(createnotice.this,
Manifest.permission.READ_EXTERNAL_STORAGE) ==
PackageManager.PERMISSION_GRANTED) {
selectPdf();
} else {
ActivityCompat.requestPermissions(createnotice.this, new
String[]{Manifest.permission.READ_EXTERNAL_STORAGE}, 9);
}
}
});
btnSave.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
final String mTitle = title.getText().toString().trim();
String currdate = date.getText().toString().trim();
String mDescription = description.getText().toString().trim();
String mname = name;
Log.d("fs", "onClick: " + mname);
final String mDepartment = Department.trim();
if (Department.contentEquals("Office")) {
mADepartment = Arrays.asList(Department, "BVOC", "IT", "BCOM", "BSC",
"JC");
} else {
mADepartment = Arrays.asList(Department);
98
}
if (TextUtils.isEmpty(mTitle)) {
title.setError("Required Field");
} else if (TextUtils.isEmpty(currdate)) {
date.setError("Required Field");
} else if (TextUtils.isEmpty(mDescription)) {
description.setError("Required Field");
} else if (name.isEmpty()) {
Toast.makeText(getApplicationContext(), "name is " + name,
Toast.LENGTH_SHORT).show();
} else {
String pattern = "dd-MM-yyyy";
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(pattern);

String mDate = simpleDateFormat.format(new Date());


mdialog.setMessage("processing...");
mdialog.show();
Data data = new Data(mTitle, mDate, currdate, mDescription, mAuth.getUid(),
mname, mDepartment, durl.getText().toString(), mADepartment);
db.collection("Notices").document()
.set(data)
.addOnSuccessListener(new OnSuccessListener<Void>() {
@Override
public void onSuccess(Void aVoid) {
Log.d("kalpeshfs", "DocumentSnapshot successfully written!");
title.setText("");
description.setText("");
date.setText("");
mdialog.dismiss();
}
})
.addOnFailureListener(new OnFailureListener() {
@Override
99
public void onFailure(@NonNull Exception e) {
Log.w("kalpeshfs", "Error writing document", e);
}
});
Toast.makeText(getApplicationContext(), "Data Uploaded",
Toast.LENGTH_SHORT).show();
}
}
});
}
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions,
@NonNull int[] grantResults) {
if (requestCode == 9 && grantResults[0] ==
PackageManager.PERMISSION_GRANTED) {
selectPdf();
} else {
Toast.makeText(getApplicationContext(), "please give permission",
Toast.LENGTH_SHORT).show();
}
}
private void selectPdf() {
Intent intent = new Intent();
intent.setType("application/pdf");
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(intent, 86);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == 86 && resultCode == RESULT_OK && data != null) {
pdfUri = data.getData();
notify.setText("A file is selected");
mdialog.setMessage("processing...");
100
mdialog.show();
uploadpdf();
} else {
Toast.makeText(getApplicationContext(), "please select file",
Toast.LENGTH_SHORT).show();
}
}
private void uploadpdf() {
final StorageReference storageReference =
FirebaseStorage.getInstance().getReference("NoticesPDF/" + System.currentTimeMillis() +
".pdf");
if (pdfUri != null) {
storageReference.putFile(pdfUri).addOnSuccessListener(new
OnSuccessListener<UploadTask.TaskSnapshot>() {
@Override
public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {
Toast.makeText(getApplicationContext(), "success",
Toast.LENGTH_SHORT).show();
storageReference.getDownloadUrl().addOnSuccessListener(new
OnSuccessListener<Uri>() {
@Override
public void onSuccess(Uri uri) {
Uri downloadUrl = uri;
pdflink = downloadUrl.toString();
durl.setText(downloadUrl.toString());
mdialog.dismiss();
notify.setText("file uploaded");
} }); }
}).addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
Toast.makeText(getApplicationContext(), "problem" + e,
Toast.LENGTH_SHORT).show();
} }); }}}
101
activity_view_notice.xml:

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


<androidx.coordinatorlayout.widget.CoordinatorLayout
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=".viewNotice">
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/AppTheme.PopupOverlay" />
</com.google.android.material.appbar.AppBarLayout>
<include layout="@layout/content_view_notice" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>

102
content_view_notice.xml:

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


<androidx.appcompat.widget.LinearLayoutCompat
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"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context=".viewNotice"
tools:showIn="@layout/activity_view_notice">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:layout_margin="10dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/view_title"
android:text="Title"
android:textColor="@android:color/black"
android:gravity="center"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
android:textSize="40sp">
</TextView>
<TextView
android:id="@+id/view_date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"

103
android:gravity="right"
android:layout_gravity="right"
android:text="date of notice"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
android:textIsSelectable="true"
android:textSize="20sp"></TextView>
<TextView
android:id="@+id/view_Description"
android:layout_width="match_parent"
android:layout_height="209dp"
android:layout_margin="10dp"
android:text="Description"
android:textIsSelectable="true"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
android:textSize="20sp">
</TextView>
<TextView
android:id="@+id/view_todate"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:text="Validity"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
android:textIsSelectable="true"
android:textSize="20sp">
</TextView>
<TextView
android:layout_margin="10dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/view_author"
android:text="Name of author"
android:textIsSelectable="true"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
104
android:textSize="20sp">
</TextView>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Download pdf"
android:layout_gravity="center"
android:gravity="center"
android:id="@+id/fetchpdf"
android:layout_margin="10dp"
></Button>
</LinearLayout>
</androidx.appcompat.widget.LinearLayoutCompat>

105
viewNotice.java:

package com.kalpesh.collegeapp;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.firestore.DocumentSnapshot;
import com.google.firebase.firestore.FirebaseFirestore;
import com.google.firebase.firestore.QueryDocumentSnapshot;
import com.google.firebase.firestore.QuerySnapshot;
public class viewNotice extends AppCompatActivity {
private TextView vTitle, vAuthor, vDate, vTodate, vDescription;
private String id, url, type, UID;
private Button fetch, del;
private FirebaseAuth mAuth;
private FirebaseFirestore db;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_view_notice);
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
vTitle = findViewById(R.id.view_title);

106
vAuthor = findViewById(R.id.view_author);
vDate = findViewById(R.id.view_date);
vTodate = findViewById(R.id.view_todate);
vDescription = findViewById(R.id.view_Description);
fetch = findViewById(R.id.fetchpdf);
db = FirebaseFirestore.getInstance();
mAuth = FirebaseAuth.getInstance();
UID = mAuth.getCurrentUser().getUid();
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
try {
id = getIntent().getExtras().get("noticeid").toString();
Log.d("kalpesh fs", "check notice id " + id);
} catch (Exception e) {
e.printStackTrace();
}
db.collection("Users")
.whereEqualTo("uid", UID)
.get()
.addOnCompleteListener(new OnCompleteListener<QuerySnapshot>() {
@Override
public void onComplete(@NonNull Task<QuerySnapshot> task) {
if (task.isSuccessful()) {
for (QueryDocumentSnapshot document : task.getResult()) {
type = document.get("type").toString().trim();
// Query query = db.collection("Notices")
//.whereEqualTo("department",Department);
}
} else {
Log.d("Failed", "get failed with ", task.getException());
}
}
});
db.collection("Notices").document(id)
.get().addOnCompleteListener(new OnCompleteListener<DocumentSnapshot>() {
107
@Override
public void onComplete(@NonNull Task<DocumentSnapshot> task) {
if (task.isSuccessful()) {
DocumentSnapshot document = task.getResult();
if (document.exists()) {
Log.d("ViewNotice", "DocumentSnapshot data: " + document.getData());
vDate.setText(document.get("date").toString());
vTitle.setText(document.get("title").toString());
vAuthor.setText(document.get("name").toString());
vTodate.setText(document.get("toDate").toString());
vDescription.setText(document.get("description").toString());
url = document.get("pdfDoc").toString();
if (url.contentEquals("empty")) {
fetch.setVisibility(View.INVISIBLE);
}
fetch.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent i = new Intent(Intent.ACTION_VIEW,
Uri.parse(url));
startActivity(i);
}
});
} else {
Log.d("ViewNotice", "No such document");
}
} else {
Log.d("ViewNotice", "get failed with ", task.getException());
}
}
});
}
}

108
activity_mynotices.xml:

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


<androidx.coordinatorlayout.widget.CoordinatorLayout
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=".MynoticesActivity">
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/AppTheme.PopupOverlay" />
</com.google.android.material.appbar.AppBarLayout>
<include layout="@layout/content_mynotices" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>

109
content_mynotices.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"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context=".MynoticesActivity"
tools:showIn="@layout/activity_mynotices">
<androidx.recyclerview.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/recycler_viewnotice"></androidx.recyclerview.widget.RecyclerView>
</LinearLayout>

110
MynoticesActivity.java:

package com.kalpesh.collegeapp;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.firebase.ui.firestore.FirestoreRecyclerAdapter;
import com.firebase.ui.firestore.FirestoreRecyclerOptions;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.firestore.DocumentSnapshot;
import com.google.firebase.firestore.FirebaseFirestore;
import com.google.firebase.firestore.FirebaseFirestoreException;
import com.google.firebase.firestore.Query;
import com.kalpesh.collegeapp.model.Data;
public class MynoticesActivity extends AppCompatActivity {
private RecyclerView recyclerView;
private static FirebaseFirestore mDatabase;
private Query query;
private LinearLayoutManager linearLayoutManager;
String id;
String URL;
private FirestoreRecyclerAdapter adapter;
private FirebaseAuth mAuth;
private FirebaseFirestore db;

111
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_mynotices);
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
recyclerView = findViewById(R.id.recycler_viewnotice);
linearLayoutManager = new LinearLayoutManager(getApplicationContext(),
LinearLayoutManager.VERTICAL, false);
recyclerView.setLayoutManager(linearLayoutManager);
linearLayoutManager.setReverseLayout(true);
linearLayoutManager.setStackFromEnd(true);
mDatabase = FirebaseFirestore.getInstance();
mAuth = FirebaseAuth.getInstance();
id = mAuth.getCurrentUser().getUid();
db = FirebaseFirestore.getInstance();
// mdialog.setMessage("Processing..");
//mdialog.show();
query = db.collection("Notices").whereEqualTo("id", id);
FirestoreRecyclerOptions<Data> response = new
FirestoreRecyclerOptions.Builder<Data>()
.setQuery(query, Data.class)
.build();
// mdialog.dismiss();
adapter = new FirestoreRecyclerAdapter<Data,
MynoticesActivity.FriendsHolder>(response) {
@Override
public void onBindViewHolder(final MynoticesActivity.FriendsHolder holder, final
int position, Data model) {
holder.title.setText("Title:- " + model.getTitle());
holder.description.setText("Description:- " + model.getDescription());
holder.author.setText("By:- " + model.getName());
holder.date.setText(model.getDate());
112
holder.toDate.setText("Valid till:- " + model.getToDate());
holder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
DocumentSnapshot snapshot =
getSnapshots().getSnapshot(holder.getAdapterPosition());
snapshot.getId();
Log.d("kalpesh fs", "onClick get id: " + snapshot.getId());
Intent ViewNotice1 = new Intent(getApplicationContext(),
Mynoticedetail.class);
Log.d("kalpesh kh", "onClick: " + snapshot.getId());
ViewNotice1.putExtra("noticeid", snapshot.getId());
startActivity(ViewNotice1);
}
});
}
@Override
public MynoticesActivity.FriendsHolder onCreateViewHolder(ViewGroup group, int
i) {
View view = LayoutInflater.from(group.getContext())
.inflate(R.layout.item_layout, group, false);
return new MynoticesActivity.FriendsHolder(view);
}
@Override
public void onError(FirebaseFirestoreException e) {
Log.e("KalpeshError", e.getMessage());
}
};
adapter.notifyDataSetChanged();
recyclerView.setAdapter(adapter);
adapter.startListening();
}

113
public static class FriendsHolder extends RecyclerView.ViewHolder {
TextView title;
TextView description;
TextView author;
TextView date;
TextView toDate;
public FriendsHolder(View itemView) {
super(itemView);
title = itemView.findViewById(R.id.title_ongoing);
description = itemView.findViewById(R.id.description_ongoing);
author = itemView.findViewById(R.id.id_ongoing);
date = itemView.findViewById(R.id.date_ongoing);
toDate = itemView.findViewById(R.id.todate_ongoing);

}
}
}

114
activity_mynoticedetail.xml:
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout
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=".Mynoticedetail">
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/AppTheme.PopupOverlay" />
</com.google.android.material.appbar.AppBarLayout>
<include layout="@layout/content_mynoticedetail" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>

115
content_mynoticedetail.xml:

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


<androidx.appcompat.widget.LinearLayoutCompat
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"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context=".Mynoticedetail"
tools:showIn="@layout/activity_mynoticedetail">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:layout_margin="10dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/view_title1"
android:text="Title"
android:textColor="@android:color/black"
android:gravity="center"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
android:textSize="40sp"
>
</TextView>
<TextView
android:id="@+id/view_date1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"

116
android:gravity="right"
android:layout_gravity="right"
android:text="date of notice"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
android:textIsSelectable="true"
android:textSize="20sp"></TextView>
<TextView
android:id="@+id/view_Description1"
android:layout_width="match_parent"
android:layout_height="209dp"
android:layout_margin="10dp"
android:text="Description"
android:textIsSelectable="true"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
android:textSize="20sp">
</TextView>
<TextView
android:id="@+id/view_todate1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:text="Validity"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
android:textIsSelectable="true"
android:textSize="20sp">
</TextView>
<TextView
android:layout_margin="10dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/view_author1"
android:text="Name of author"
android:textIsSelectable="true"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
117
android:textSize="20sp">
</TextView>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Download pdf"
android:layout_gravity="center"
android:gravity="center"
android:id="@+id/fetchpdf1"
android:layout_margin="10dp"
></Button>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Delete Notice"
android:layout_gravity="center"
android:gravity="center"
android:id="@+id/deleteNotice1"
android:layout_margin="10dp"
></Button>
</LinearLayout>
</androidx.appcompat.widget.LinearLayoutCompat>

118
Mynoticedetail.java:

package com.kalpesh.collegeapp;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
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.auth.FirebaseAuth;
import com.google.firebase.firestore.DocumentSnapshot;
import com.google.firebase.firestore.FirebaseFirestore;
import com.google.firebase.firestore.QueryDocumentSnapshot;
import com.google.firebase.firestore.QuerySnapshot;
public class Mynoticedetail extends AppCompatActivity {
private TextView vTitle, vAuthor, vDate, vTodate, vDescription;
private String id, url, type, UID;
private Button fetch, del;
private FirebaseAuth mAuth;
private FirebaseFirestore db;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_mynoticedetail);

119
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
vTitle = findViewById(R.id.view_title1);
vAuthor = findViewById(R.id.view_author1);
vDate = findViewById(R.id.view_date1);
vTodate = findViewById(R.id.view_todate1);
vDescription = findViewById(R.id.view_Description1);
fetch = findViewById(R.id.fetchpdf1);
del = findViewById(R.id.deleteNotice1);
db = FirebaseFirestore.getInstance();
mAuth = FirebaseAuth.getInstance();
UID = mAuth.getCurrentUser().getUid();
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
try {
id = getIntent().getExtras().get("noticeid").toString();
Log.d("kalpesh fs", "check notice id " + id);
} catch (Exception e) {
e.printStackTrace();
}
db.collection("Users")
.whereEqualTo("uid", UID)
.get()
.addOnCompleteListener(new OnCompleteListener<QuerySnapshot>() {
@Override
public void onComplete(@NonNull Task<QuerySnapshot> task) {
if (task.isSuccessful()) {
for (QueryDocumentSnapshot document : task.getResult()) {
type = document.get("type").toString().trim();
// Query query = db.collection("Notices")
//.whereEqualTo("department",Department);
}
if (type.contentEquals("Student")) {
del.setVisibility(View.INVISIBLE);
}
120
} else {
Log.d("Failed", "get failed with ", task.getException());
}
}
});
db.collection("Notices").document(id)
.get().addOnCompleteListener(new OnCompleteListener<DocumentSnapshot>() {
@Override
public void onComplete(@NonNull Task<DocumentSnapshot> task) {
if (task.isSuccessful()) {
DocumentSnapshot document = task.getResult();
if (document.exists()) {
Log.d("ViewNotice", "DocumentSnapshot data: " + document.getData());
vDate.setText(document.get("date").toString());
vTitle.setText(document.get("title").toString());
vAuthor.setText(document.get("name").toString());
vTodate.setText(document.get("toDate").toString());
vDescription.setText(document.get("description").toString());
url = document.get("pdfDoc").toString();
if (url.contentEquals("empty")) {
fetch.setVisibility(View.INVISIBLE);
}
fetch.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent i = new Intent(Intent.ACTION_VIEW,
Uri.parse(url));
startActivity(i);
}
});
} else {
Log.d("ViewNotice", "No such document");
}
} else {
121
Log.d("ViewNotice", "get failed with ", task.getException());
}
}
});
del.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
db.collection("Notices").document(id)
.delete()
.addOnSuccessListener(new OnSuccessListener<Void>() {
@Override
public void onSuccess(Void aVoid) {
Log.d("Del", "DocumentSnapshot successfully deleted!");
startActivity(new Intent(getApplicationContext(), Nav.class));
Toast.makeText(getApplicationContext(), "Notice deleted",
Toast.LENGTH_SHORT).show();
}
})
.addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
Log.w("Del", "Error deleting document", e);
Toast.makeText(getApplicationContext(), "Notice cannot be deleted",
Toast.LENGTH_SHORT).show();
}
});
}
});
}
}

122
activity_profile.xml

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


<androidx.coordinatorlayout.widget.CoordinatorLayout
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=".ProfileActivity">
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/AppTheme.PopupOverlay" />
</com.google.android.material.appbar.AppBarLayout>
<include layout="@layout/content_profile" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>

123
content_profile.xml:

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


<androidx.appcompat.widget.LinearLayoutCompat
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"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context=".ProfileActivity"
tools:showIn="@layout/activity_profile">
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<androidx.appcompat.widget.AppCompatTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="Profile"
android:textAppearance="@style/TextAppearance.AppCompat.Large"
android:textSize="50dp"
android:layout_marginBottom="10dp"
android:textColor="@android:color/black" />
<ImageView
android:id="@+id/UserPhoto1"
android:layout_width="125dp"
android:layout_height="120dp"
android:layout_gravity="center"

124
android:src="@drawable/userphoto"
></ImageView>
<TextView
android:id="@+id/name1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:layout_gravity="end"
android:text="Name:"
android:textColor="@android:color/black"
></TextView>
<TextView
android:id="@+id/email1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:layout_gravity="end"
android:text="Email:"
android:textColor="@android:color/black"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Phone no:"
android:id="@+id/phone1"
android:textColor="@android:color/black"
android:layout_margin="10dp" />
<com.google.android.material.circularreveal.CircularRevealRelativeLayout
android:layout_width="match_parent"
android:layout_margin="10dp"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
125
android:textColor="@android:color/black"
android:text="Department"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"/>
<TextView
android:id="@+id/department1"
android:layout_width="match_parent"
android:layout_margin="10dp"
android:gravity="right"
android:text="Display department"
android:layout_height="wrap_content" />
</com.google.android.material.circularreveal.CircularRevealRelativeLayout>
<com.google.android.material.circularreveal.CircularRevealRelativeLayout
android:layout_width="match_parent"
android:layout_margin="10dp"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/black"
android:text="user type"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"/>
<TextView
android:id="@+id/post1"
android:layout_width="match_parent"
android:layout_margin="10dp"
android:gravity="right"
android:text="post"
android:backgroundTint="@android:color/black"
android:layout_height="wrap_content" />
</com.google.android.material.circularreveal.CircularRevealRelativeLayout>
</androidx.appcompat.widget.LinearLayoutCompat>
</androidx.core.widget.NestedScrollView>
</androidx.appcompat.widget.LinearLayoutCompat>

126
ProfileActivity.java:
package com.kalpesh.collegeapp;
import android.os.Bundle;
import android.util.Log;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import com.bumptech.glide.Glide;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.firestore.FirebaseFirestore;
import com.google.firebase.firestore.QueryDocumentSnapshot;
import com.google.firebase.firestore.QuerySnapshot;
public class ProfileActivity extends AppCompatActivity {
private TextView vName, vEmail, vPhone, vDepartment, vPost;
private ImageView imageView;
String id;
String URL;
private FirebaseAuth mAuth;
private FirebaseFirestore db;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_profile);
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
vName = findViewById(R.id.name1);
vEmail = findViewById(R.id.email1);
vPhone = findViewById(R.id.phone1);
imageView = findViewById(R.id.UserPhoto1);
127
vDepartment = findViewById(R.id.department1);
vPost = findViewById(R.id.post1);
mAuth = FirebaseAuth.getInstance();
vEmail.setText(mAuth.getCurrentUser().getEmail());
id = mAuth.getCurrentUser().getUid();
try {
db = FirebaseFirestore.getInstance();
db.collection("Users")
.whereEqualTo("uid", id).get()
.addOnCompleteListener(new OnCompleteListener<QuerySnapshot>() {
@Override
public void onComplete(@NonNull Task<QuerySnapshot> task) {
if (task.isSuccessful()) {
for (QueryDocumentSnapshot document : task.getResult()) {
vName.setText(document.get("name").toString().trim());
vPost.setText(document.get("type").toString().trim());
vDepartment.setText(document.get("Department").toString().trim());
vPhone.setText(document.get("phone").toString());
try {
URL = document.get("profile").toString();
} catch (Exception e) {
e.printStackTrace();
}
Log.d("fs", "onComplete: " + URL);
try {
Glide.with(getApplicationContext()).load(URL).into(imageView);
} catch (Exception e) {
e.printStackTrace(); } }
} else {
Log.d("Failed", "get failed with ", task.getException());
}} });
} catch (Exception e) {
e.printStackTrace();
}}}
128
Activity_users.xml:

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


<androidx.coordinatorlayout.widget.CoordinatorLayout
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=".UsersActivity">
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/AppTheme.PopupOverlay" />
</com.google.android.material.appbar.AppBarLayout>
<include layout="@layout/content_users" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>

129
content_users.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:orientation="vertical"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context=".UsersActivity"
tools:showIn="@layout/activity_users">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_user"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>

130
UsersActivity.java
package com.kalpesh.collegeapp;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.firebase.ui.firestore.FirestoreRecyclerAdapter;
import com.firebase.ui.firestore.FirestoreRecyclerOptions;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.firestore.CollectionReference;
import com.google.firebase.firestore.DocumentSnapshot;
import com.google.firebase.firestore.FirebaseFirestore;
import com.google.firebase.firestore.Query;
import com.google.firebase.firestore.QueryDocumentSnapshot;
import com.google.firebase.firestore.QuerySnapshot;
import com.kalpesh.collegeapp.model.user;
public class UsersActivity extends AppCompatActivity {
private RecyclerView recyclerView;
private static FirebaseFirestore mDatabase;
private FirestoreRecyclerAdapter<user, UserViewHolder> adapter;
private Query query;
private LinearLayoutManager linearLayoutManager;
String id;

131
String URL;
private FirebaseAuth mAuth;
private FirebaseFirestore db;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_users);
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
recyclerView = (RecyclerView) findViewById(R.id.recycler_user);
linearLayoutManager = new LinearLayoutManager(getApplicationContext(),
LinearLayoutManager.VERTICAL, false);
recyclerView.setLayoutManager(linearLayoutManager);
linearLayoutManager.setReverseLayout(true);
linearLayoutManager.setStackFromEnd(true);
mDatabase = FirebaseFirestore.getInstance();
mAuth = FirebaseAuth.getInstance();
id = mAuth.getCurrentUser().getUid();
final CollectionReference datasRef = mDatabase.collection("Users");
db = FirebaseFirestore.getInstance();
db.collection("Users")
.whereEqualTo("uid", id)
.get()
.addOnCompleteListener(new OnCompleteListener<QuerySnapshot>() {
@Override
public void onComplete(@NonNull Task<QuerySnapshot> task) {
if (task.isSuccessful()) {
for (QueryDocumentSnapshot document : task.getResult()) {
String Department = document.get("Department").toString().trim();
query = datasRef.orderBy("name",
Query.Direction.ASCENDING).whereEqualTo("Department", Department);
FirestoreRecyclerOptions<user> options = new
FirestoreRecyclerOptions.Builder<user>()
132
.setQuery(query, user.class)
.build();
adapter = new FirestoreRecyclerAdapter<user,
UserViewHolder>(options) {
@Override
protected void onBindViewHolder(@NonNull final UserViewHolder
userViewHolder, int i, @NonNull user data) {
userViewHolder.setData(data.getName(), data.getPost());
userViewHolder.itemView
.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
DocumentSnapshot snapshot =
getSnapshots().getSnapshot(userViewHolder.getAdapterPosition());
snapshot.getId();
Log.d("kalpesh fs", "onClick get id: " + snapshot.getId());
Intent UserDetail = new Intent(getApplicationContext(),
userdetailActivity.class);
UserDetail.putExtra("UserID", snapshot.getId());
startActivity(UserDetail);
}
});
}
@NonNull
@Override
public UserViewHolder onCreateViewHolder(@NonNull ViewGroup
parent, int viewType) {
View view =
LayoutInflater.from(parent.getContext()).inflate(R.layout.users_layout, parent, false);

return new UserViewHolder(view);


}
};
recyclerView.setAdapter(adapter);
133
adapter.startListening();
// Query query = db.collection("Notices")
//.whereEqualTo("department",Department);
Log.d("kalpeshDepartment", document.getId() + " => " + Department);
}
} else {
Log.d("kalpeshfs", "Error getting documents: ", task.getException());
}
}
});
}
private class UserViewHolder extends RecyclerView.ViewHolder {
private View view;
UserViewHolder(View itemView) {
super(itemView);
view = itemView;
}
void setData(String name1, String post1) {
TextView name = view.findViewById(R.id.user_name);
TextView post = view.findViewById(R.id.user_post);
name.setText(name1);
post.setText(post1);
}
}
}

134
activity_userdetail.xml:

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


<androidx.coordinatorlayout.widget.CoordinatorLayout
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=".userdetailActivity">
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/AppTheme.PopupOverlay" />
</com.google.android.material.appbar.AppBarLayout>
<include layout="@layout/content_userdetail" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>

135
content_userdetail.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"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context=".userdetailActivity"
tools:showIn="@layout/activity_userdetail">
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<androidx.appcompat.widget.AppCompatTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="Profile"
android:textAppearance="@style/TextAppearance.AppCompat.Large"
android:textSize="50dp"
android:layout_marginBottom="10dp"
android:textColor="@android:color/black" />
<ImageView
android:id="@+id/UserPhoto"
android:layout_width="125dp"
android:layout_height="120dp"
android:layout_gravity="center"
android:src="@drawable/userphoto"

136
></ImageView>
<TextView
android:id="@+id/name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:layout_gravity="end"
android:text="Name:"
android:textColor="@android:color/black"
></TextView>
<TextView
android:id="@+id/email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:layout_gravity="end"
android:text="Email:"
android:textColor="@android:color/black"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Phone no:"
android:id="@+id/phone"
android:textColor="@android:color/black"
android:layout_margin="10dp"
/>
<com.google.android.material.circularreveal.CircularRevealRelativeLayout
android:layout_width="match_parent"
android:layout_margin="10dp"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
137
android:textColor="@android:color/black"
android:text="Department"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"/>
<TextView
android:id="@+id/department"
android:layout_width="match_parent"
android:layout_margin="10dp"
android:gravity="right"
android:text="Display department"
android:layout_height="wrap_content" />
</com.google.android.material.circularreveal.CircularRevealRelativeLayout>
<com.google.android.material.circularreveal.CircularRevealRelativeLayout
android:layout_width="match_parent"
android:layout_margin="10dp"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/black"
android:text="user type"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"/>
<TextView
android:id="@+id/post"
android:layout_width="match_parent"
android:layout_margin="10dp"
android:gravity="right"
android:text="post"
android:backgroundTint="@android:color/black"
android:layout_height="wrap_content" />
</com.google.android.material.circularreveal.CircularRevealRelativeLayout>
</androidx.appcompat.widget.LinearLayoutCompat>
</androidx.core.widget.NestedScrollView>
</LinearLayout>

138
userdetailActivity.java:

package com.kalpesh.collegeapp;
import android.os.Bundle;
import android.util.Log;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import com.bumptech.glide.Glide;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.firestore.DocumentSnapshot;
import com.google.firebase.firestore.FirebaseFirestore;
public class userdetailActivity extends AppCompatActivity {
private TextView vName, vEmail, vPhone, vDepartment, vPost;
private ImageView imageView;
String id;
String URL;
private FirebaseAuth mAuth;
private FirebaseFirestore db;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_userdetail);
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
vName = findViewById(R.id.name);
vEmail = findViewById(R.id.email);
vPhone = findViewById(R.id.phone);

139
imageView = findViewById(R.id.UserPhoto);
vDepartment = findViewById(R.id.department);
vPost = findViewById(R.id.post);
mAuth = FirebaseAuth.getInstance();
vEmail.setText(mAuth.getCurrentUser().getEmail());
id = getIntent().getExtras().get("UserID").toString();
String url = "https://www.gstatic.com/webp/gallery3/1.png";
Log.d("kalpesh fs", "check User id " + id);
try {
db = FirebaseFirestore.getInstance();
db.collection("Users")
.document(id)
.get().addOnCompleteListener(new OnCompleteListener<DocumentSnapshot>()
{
@Override
public void onComplete(@NonNull Task<DocumentSnapshot> task) {
String TAG = "kalpesh fs";
if (task.isSuccessful()) {
DocumentSnapshot document = task.getResult();
if (document.exists()) {
Log.d(TAG, "DocumentSnapshot data: " + document.getData());
vName.setText(document.get("name").toString().trim());
vPost.setText(document.get("type").toString().trim());
vDepartment.setText(document.get("Department").toString().trim());
try {
URL = document.get("profile").toString();
} catch (Exception e) {
e.printStackTrace();
}
Log.d(TAG, "onComplete: " + URL);
try {
Glide.with(getApplicationContext()).load(URL).into(imageView);
} catch (Exception e) {
e.printStackTrace();
140
}
} else {
Log.d(TAG, "No such document");
}
} else {
Log.d(TAG, "get failed with ", task.getException());
}
}
});
} catch (Exception e) {
e.printStackTrace();
}

141
users_layout.xml:
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:elevation="10dp"
android:layout_margin="10dp"
android:id="@+id/cardview"
app:cardElevation="10dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:orientation="vertical"
android:textAppearance="@style/TextAppearance.AppCompat.Medium">
<TextView
android:id="@+id/user_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:text="Name"
android:textAppearance="@style/TextAppearance.AppCompat.Medium" />
<TextView
android:id="@+id/user_post"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:text="post"
android:textAppearance="@style/TextAppearance.AppCompat.Medium" />
</LinearLayout>
</androidx.cardview.widget.CardView>

142
MyFirebaseMessagingService.java:
package com.kalpesh.collegeapp;
import android.util.Log;
import com.google.firebase.messaging.FirebaseMessagingService;
import com.google.firebase.messaging.RemoteMessage;
public class MyFirebaseMessagingService extends FirebaseMessagingService {
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
super.onMessageReceived(remoteMessage);
Log.d("notifyyy", "from: " + remoteMessage.getFrom());
Log.d("notifyyy", "from: " + remoteMessage.getNotification().getTitle());
//if the message contains data payload
//It is a map of custom keyvalues
//we can read it easily
if (remoteMessage.getData().size() > 0) {
//handle the data message here
}
//getting the title and the body
String title = remoteMessage.getNotification().getTitle();
String body = remoteMessage.getNotification().getBody();
//then here we can use the title and body to build a notification
MyNotificationManager.getInstance(this).displayNotification(title, body);
}
}
MyNotificationManager.java
package com.kalpesh.collegeapp;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import androidx.core.app.NotificationCompat;
import static android.content.Context.NOTIFICATION_SERVICE;

143
public class MyNotificationManager {
private Context mCtx;
private static MyNotificationManager mInstance;
private MyNotificationManager(Context context) {
mCtx = context;
}
public static synchronized MyNotificationManager getInstance(Context context) {
if (mInstance == null) {
mInstance = new MyNotificationManager(context);
}
return mInstance;
}
public void displayNotification(String title, String body) {
NotificationCompat.Builder mBuilder =
new NotificationCompat.Builder(mCtx, Constants.CHANNEL_ID)
.setSmallIcon(R.drawable.common_google_signin_btn_icon_dark)
.setContentTitle(title)
.setContentText(body);
/*
* Clicking on the notification will take us to this intent
* Right now we are using the MainActivity as this is the only activity we have in our
application
* But for your project you can customize it as you want
* */
Intent resultIntent = new Intent(mCtx, MainActivity.class);
/*
* Now we will create a pending intent
* The method getActivity is taking 4 parameters
* All paramters are describing themselves
* 0 is the request code (the second parameter)
* We can detect this code in the activity that will open by this we can get
* Which notification opened the activity
* */

144
PendingIntent pendingIntent = PendingIntent.getActivity(mCtx, 0, resultIntent,
PendingIntent.FLAG_UPDATE_CURRENT);

/*
* Setting the pending intent to notification builder
* */

mBuilder.setContentIntent(pendingIntent);

NotificationManager mNotifyMgr =
(NotificationManager) mCtx.getSystemService(NOTIFICATION_SERVICE);

/*
* The first parameter is the notification id
* better don't give a literal here (right now we are giving a int literal)
* because using this id we can modify it later
* */
if (mNotifyMgr != null) {
mNotifyMgr.notify(1, mBuilder.build());
}
}

145
backdesign.xml:

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


<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient android:angle="45"
android:startColor="#003973"
android:endColor="#E5E5BE"/>
</shape>

Button_design.xml:

<shape xmlns:android="http://schemas.android.com/apk/res/android">
<?xml version="1.0" encoding="utf-8"?>
<gradient android:angle="45"
android:startColor="#e52d27"
android:endColor="#b31217"/>
<corners android:bottomRightRadius="90dp"
android:bottomLeftRadius="90dp"
android:topRightRadius="90dp"
android:topLeftRadius="90dp"/>
</shape>

146
build.gradle (Module:app)
apply plugin: 'com.android.application'

android {
compileSdkVersion 29
buildToolsVersion "29.0.0"
defaultConfig {
applicationId "com.kalpesh.collegeapp"
minSdkVersion 24
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-
rules.pro'
}
}
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:23.1.1'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.firebase:firebase-auth:19.0.0'
implementation 'com.google.firebase:firebase-database:19.0.0'
implementation 'com.firebaseui:firebase-ui-database:5.1.0'
implementation 'com.firebaseui:firebase-ui-firestore:5.1.0'
implementation 'com.google.android.material:material:1.0.0'

147
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'androidx.navigation:navigation-fragment:2.1.0'
implementation 'androidx.navigation:navigation-ui:2.1.0'
implementation 'androidx.lifecycle:lifecycle-extensions:2.1.0'
implementation 'com.github.bumptech.glide:glide:4.9.0'
implementation 'com.google.firebase:firebase-storage:19.0.0'
implementation 'com.google.firebase:firebase-messaging:20.0.0'
implementation 'com.squareup.retrofit2:retrofit:2.6.1'
implementation 'com.squareup.retrofit2:converter-gson:2.6.1'
implementation 'com.android.volley:volley:1.1.1'

annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'

testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'

}
apply plugin: 'com.google.gms.google-services'

148
Index.js

'use strict'
const functions = require('firebase-functions');
const admin = require('firebase-admin');
admin.initializeApp(functions.config().firebase);
exports.createNotice = functions.firestore
.document('Notices/{NoticeId}')
.onCreate((snap, context) => {
// Get an object representing the document
// e.g. {'name': 'Marie', 'age': 66}
const newValue = snap.data();
// access a particular field as you would any JS property
const department= newValue.department;
const noticeTitle= newValue.title;
console.log('Department is: ', department);
// The topic name can be optionally prefixed with "/topics/".
const payload = {notification: {
title: 'New Notice',
body: `${noticeTitle}`
}
};
admin.messaging().sendToTopic(department,payload)
.then(function(response){
console.log('Notification sent successfully:',response);
return null;
})
.catch(function(error){
console.log('Notification sent failed:',error);
});

// perform desired operations ...


});

149
4.2 Data Dictionary

150
4.3 Programming Description
Sr. No. Name Description
1 Nav.java This is the home screen and shows the navigation
screen , also it has a fab button to create the notice.
2 MainActivity.java This is the start activity , also known as login
screen . User can login from here, if not registered
can go to registration page, also if user forgets the
password ,user can click on forget password.
3 Register_activity.java The register activity allows the user to register with
the app. User can select image and enter their
information ,also select the department and their
post.
4 ongoing.java This is a fragment where the notices, which are not
expired are shown. Notices from the same dept.
and office is are displayed. On clicking the notice
the , full notice will be opened.
5 Expired.java This is a fragment where the notices, which are
expired are shown. Notices from the same dept.
and office is are displayed. On clicking the notice
the , full notice will be opened.
6 CreateNotice.java In this activity user can create (student cannot
create)a notice. User has to enter title ,description,
valid to date .If user wants he can attach a pdf too.
7 UsersActivity.java In this user can see other users of the same
department. When clicked on that they can view
their profile.
8 ProfileActivity.java In this activity user can see his profile
9 Forgotpass.java In this activity user has to enter his email, and
password reset link will be sent to his email id.
10 Index.js Node.js function on cloud to send notification.
11 NoticeDetail.java Shows the notice in detail. In different screen

151
4.4 Naming Conventions
Sr No. Controls Naming
1 TextView Text
2 EditText editText
3 Button Btn
4 ImageView imageView

4.5 Validation

Sr No. Controls Naming


1 Required This validation is applied to email,
password, name,department,post,
confirm password, Notice title, Notice
description.
2 User Verification User verification is done by verifying
the email address of the user.

152
PROGRAM LISTING

153
5.1 Cost Estimation

Cocomo (Constructive Cost Model) is a regression model based on LOC, i.e number of
Lines of Code. It is a procedural cost estimate model for software projects and often used as
a process of reliably predicting the various parameters associated with making a project such
as size, effort, cost, time and quality. It was proposed by Barry Boehm in 1970 and is based
on the study of 63 projects, which make it one of the best-documented models.

The key parameters which define the quality of any software products, which are also an
outcome of the Cocomo are primarily Effort & Schedule:

• Effort: Amount of labor that will be required to complete a task. It is measured in


person-months units.
• Schedule: Simply means the amount of time required for the completion of the job,
which is, of course, proportional to the effort put. It is measured in the units of time
such as weeks, months.

Different models of Cocomo have been proposed to predict the cost estimation at different
levels, based on the amount of accuracy and correctness required. All of these models can be
applied to a variety of projects, whose characteristics determine the value of constant to be
used in subsequent calculations. These characteristics pertaining to different system types are
mentioned below.

Boehm’s definition of organic, semidetached, and embedded systems:

1. Organic – A software project is said to be an organic type if the team size required is
adequately small, the problem is well understood and has been solved in the past and
also the team members have a nominal experience regarding the problem.
2. Semi-detached – A software project is said to be a Semi-detached type if the vital
characteristics such as team-size, experience, knowledge of the various programming
environment lie in between that of organic and Embedded. The projects classified as
Semi-Detached are comparatively less familiar and difficult to develop compared to
the organic ones and require more experience and better guidance and creativity. Eg:
Compilers or different Embedded Systems can be considered of Semi-Detached type.

154
3. Embedded – A software project with requiring the highest level of complexity,
creativity, and experience requirement fall under this category. Such software requires
a larger team size than the other two models and also the developers need to be
sufficiently experienced and creative to develop such complex models.

All the above system types utilize different values of the constants used in Effort
Calculations.

Types of Models: COCOMO consists of a hierarchy of three increasingly detailed


and accurate forms. Any of the three forms can be adopted according to our
requirements. These are types of COCOMO model:

1. Basic COCOMO Model


2. Intermediate COCOMO Model
3. Detailed COCOMO Model

The first level, Basic COCOMO can be used for quick and slightly rough
calculations of Software Costs. Its accuracy is somewhat restricted due to the absence
of sufficient factor considerations.

Intermediate COCOMO takes these Cost Drivers into account and Detailed
COCOMO additionally accounts for the influence of individual project phases, i.e in
case of Detailed it accounts for both these cost drivers and also calculations are
performed phase wise henceforth producing a more accurate result. These two models
are further discussed below.

Estimation of Effort: Calculations –

1) Basic Model –

The above formula is used for the cost estimation of for the basic COCOMO model, and also
is used in the subsequent models. The constant values a and b for the Basic Model for the
different categories of system:

155
· The effort is measured in Person-Months and as evident from the formula is dependent on
Kilo-Lines of code. These formulas are used as such in the Basic Model calculations, as not
much consideration of different factors such as reliability, expertise is taken into account,
henceforth the estimate is rough.

· · Intermediate Model –

The basic Cocomo model assumes that the effort is only a function of the number of lines of
code and some constants evaluated according to the different software system. However, in
reality, no system’s effort and schedule can be solely calculated on the basis of Lines of
Code. For that, various other factors such as reliability, experience, Capability. These factors
are known as Cost Drivers and the Intermediate Model utilizes 15 such drivers for cost
estimation. Classification of Cost Drivers and their attributes:

(i) Product attributes –

• Required software reliability extent


• Size of the application database
• The complexity of the product

(ii) Hardware attributes –

• Run-time performance constraints


• Memory constraints
• The volatility of the virtual machine environment
• Required turnabout time

156
(iii) Personnel attributes –

• Analyst capability
• Software engineering capability
• Applications experience
• Virtual machine experience
• Programming language experience

(iv) Project attributes –

• Use of software tools


• Application of software engineering methods
• Required development schedule

157
The project manager is to rate these 15 different parameters for a particular project on a scale
of one to three. Then, depending on these ratings, appropriate cost driver values are taken
from the above table. These 15 values are then multiplied to calculate the EAF (Effort
Adjustment Factor). The Intermediate COCOMO formula now takes the form:

The values of a and b in case of the intermediate model are as follows:

158
Detailed Model –
Detailed COCOMO incorporates all characteristics of the intermediate version with an
assessment of the cost driver’s impact on each step of the software engineering process. The
detailed model uses different effort multipliers for each cost driver attribute. In detailed
cocomo, the whole software is divided into different modules and then we apply COCOMO
in different modules to estimate effort and then sum the effort.

The Six phases of detailed COCOMO are:

1. Planning and requirements


2. System design
3. Detailed design
4. Module code and test
5. Integration and test
6. Cost Constructive model

The effort is calculated as a function of program size and a set of cost drivers are given
according to each phase of the software lifecycle.

Calculations:

a b c d
Organic 2.4 1.05 2.5 0.38

Semi-Detached 3.0 1.12 2.5 0.35

Embedded 3.6 1.20 2.5 0.35

Formulae:

Effort = a(KLOC)b person-month

Development = c(KLOC)d months

Average Staff Cycle = Effort/Development persons

Productivity = (KLOC/Effort) * 1000 no. of lines of code

159
No. of lines of code = 4158 = 4.158KLOC

o Organic
Effort = 2.4 * (4.158)1.05 = 10.7162 person-month
Development = 2.5 * (4.158)0.38 = 4.2965 months
Average Staff Cycle = 10.7162 / 4.2965 = 2.4941 persons
Productivity = (4.158 /10.7162) * 1000 = 388.017 no. of lines of code
o Semi- Detached
Effort = 3.0 * (4.158)1.12 = 14.800 person-month
Development = 2.5 * (4.158)0.35 = 4.1167 months
Average Staff Cycle = 14.800 / 4.1167 =3.5951 persons
Productivity = (4.158 / 14.800) * 1000 = 280.945 no. of lines of code
o Embedded
Effort = 3.6 * (4.158)1.20 = 19.9050 person-month
Development = 2.5 * (4.158)0.35 = 4.1167 months
Average Staff Cycle = 19.9050 / 4.1167 = 4.8351 persons
Productivity = (4.158 /19.9050) * 1000 = 208.8922 no. of lines of code

Organic Semi-Detached Embedded


Effort 10.7162 person-month 14.800 person-month 19.9050 person-month

Development 4.2965 months 4.1167 months 4.1167 months

Average Staff 2.4941 persons 3.5951 persons 4.8351 persons

Cycle
Productivity 388.017 no. of lines of 280.945 no. of lines of 208.8922 no. of lines of
code code code

160
5.2 Test Cases
Test Conditions Input Specified Expected Result Actual Result
User Name=”” Tells the user to Tells the user to
Registration email=”” enter all the enter all the
Phone=”” details to details to register
Department=”” register the the account
Type=”” account
Password=””
Confirm Password=””
Name=”kalpesh”
email=kalpesh11@gmail.com Successfully Successfully
Phone=9022022532 registers a new registers a new
Department=”BVOC” user user
Type=”Student”
Password=”test@1234”
Confirm Password=”test@1234”
User Login email=”” Tells the user to Tells the user to
Password=”” enter all details enter all details
properly properly
Mail=kalpesh11@gmail.com If the details are If the details are
Password=”test@1234” correct correct
Successfully Successfully
logins the user logins the user
Forgot Password Mail=”” Tells the user to Tells the user to
provide email. provide email.

Mail=”kalpesh11@gmail.com” Sends the reset Sends the reset


Password email Password email to
to the registered the registered
email. email.
Add title Title=”” Title cannot be Title cannot be
blank blank

161
5.3 User Manual with Screen Shots

Login Screen Registration Screen Forgot Password


Screen

Menu Ongoing Notices View Notice

162
Expired Notices Users Activity Profile Activity

My Notices MyNotice Detail

163
5. Future Enhancement

• Create Same app for IOS.


• Option to upload result.
• Implementing world chat .

164
7. Bibliography

• https://www.simplifiedcoding.net
• https://www.stackoverflow.com
• https://firebase.google.com
• https://codinginflow.com
• https://medium.com/topic/programming
• https://developer.android.com

165

Вам также может понравиться