Attendance
Attendance
Attendance
NAME: SREEHARI P
GUIDE HOD
PRINCIPAL
APRIL-2019
CONTENTS
PAGE.NO
ACKNOWLEDGEMENT
SYNOPSIS
CONTENTS
1. INTRODUCTION 1
1.1 ORGANIZATION PROFILE 3
1.2 SYSTEM SPECIFICATION 5
1.2.1 HARDWARE CONFIGURATION 6
1.2.2 SOFTWARE SPECIFICATION 6
2. SYSTEM STUDY 15
2.1 EXISTING SYSTEM 17
2.1.1 DRAWBACKS 17
2.2 PROPOSED SYSTEM 17
2.2.1 FEATURES 17
3. SYSTEM DESIGN AND DEVELOPMENT 18
3.1 FILE DESIGN 20
3.2 INPUT DESIGN 21
3.3 OUTPUT DESIGN 21
3.4 DATABASE DESIGN 22
3.5 SYSTEM DEVELOPMENT 23
3.5.1 DESCRIPTION OF MODULES 25
4. TESTING AND IMPLEMENTATION 25
5. CONCLUSION 26
BIBLIOGRAPHY 32
APPENDICES 36
A. DATA FLOW DIAGRAM 37
B. TABLE STRUCTURE 44
C. SAMPLE CODING 48
D. SAMPLE INPUT 68
E. SAMPLE OUTPUT 71
ACKNOWLEDGEMENT
ACKNOWLEDGEMENT
Thanks to all the teaching and non teaching staff of NES COLLEGE THRIPRAYAR,
for their support and also to our team-mates for their valuable co-operation.
SYNOPSIS
ATTENDANCE MANAGEMENT SYSTEM
Android technology has been influencing all kinds of fields and it is in making sharing
information so easy, with our project ‘Attendance management’ we are taking the currently
existing web technology to mobile application. Project is basically automation for
maintaining total control over data existing in papers in schools or colleges to be available
online and to manage these data in a structured manner. Parent’s teachers and students will be
using this application. Teachers can upload student details like attendance, marks ,exam
details online, so that parents and students can view all contents. Parents can view details of
their child and can make themselves aware of information from the college. This can help
parents to take care of their child.
Students can use this system to get regular updates directly into their phone like notifications
in their notice board, time table, study material, fee payments. Whole system will be helpful
in keeping college information available to all, making everything faster.
Application solution with backend system for content management. It is not only for a single
city but also support smart school for multiplicities. Cities Directory is android application by
using java with android studio take advantage of Google design language and responsive
solution for phone and tablet
MODULES
The Attendance Management System consists of four main modules
1. Admin
2. Student
3. parent
4. Staff
INTRODUCTION
INTRODUCTION
Attendance Management System is software developed for daily student attendance in
schools, colleges and institutes.it facilitates to access the attendance information of a
particular student in a particular class. The information is sorted by the operators, which will
be provides by the teacher for a particular class. This system will also help in evaluating
attendance
eligibility criteria of a student.
PURPOSE
The purpose of developing attendance management system is to computerized the traditional
way of taking attendance. Another purpose for developing this software is to generate the
report automatically at the end of the session or in the between of the session
ORGANIZATION PROFILE
ORGANIZATION PROFILE
The nattika Educational Society(NES) is a charitable Society registered under the “Thiru-
Kochi Ssahithya Dharma Sanghams Registration Act.21,1860”,Kerala,India.The Society
came into existence on 28-06-2003 with it’s Head Quarters at triprayar,the “Temple Town
“bestowed with the grace of Lord sreerama”.The society bears the register number
436/03,triprayar ,P.O Valapad ,Thrissur District, Kerala ,Pin 680567.
The NES,in its entirety ,would be a state of the art institution in the scenario of Higher
education of the nation when it blooms-full,according to the whims of it’s visionary leaders.it
may spread its fragrance across the oriental occidental horizons,alike.
The main aim of the society is to render “Quality of education “,inter alia,to the student’s
fraternity of triprayar .As the name suggests, the society would be the beacon of knowledge
and the seat of higher education in IT and Management Studies of International standard.
SYSTEM SPECIFICATION
HARDWARE SPECIFICATION
RAM: 4.00GB
SOFTWARE CONFIGURATION
Front end:
Back end :
• Rich layout editor with support for drag and drop theme editing
• Lint tools to catch performance, usability, version compatibility, and other problems
• Built-in support for Google Cloud Platform, making it easy to integrate Google Cloud
Messaging and App Engine
Java
The latest version is Java 8, which is the only version currently supported for free by
Oracle, although earlier versions are supported both by Oracle and other companies on a
commercial basis.
Application of XML
As of 2009, hundreds of document formats using XML syntax have been developed,
including RSS, Atom, SOAP, and XHTML. XML-based formats have become the default for
many office-productivity tools, including Microsoft Office (Office Open XML),
OpenOffice.org and LibreOffice (Open Document), and Apple's iWork. XML has also
been employed as the base language for communication protocols, such as XMPP and UI
designing for native android programming. Applications for the Microsoft.NET Framework
use XML files for configuration. Apple has an implementation of a registry based on XML.
XML has come into common use for the interchange of data over the Internet.
IETFRFC 7303 gives rules for the construction of Internet Media Types for use when sending
XML. It also defines the media types application/xml and text/xml, which say only that the
data is in XML, and nothing about its semantics. The use of text/xml has been criticized as a
potential source of encoding problems and it has been suggested that it should be deprecated.
RFC 7303 also recommends that XML-based languages be given media types ending in
+xml; for example image/svg+xml for SVG.
Further guidelines for the use of XML in a networked context may be found in RFC
3470, also known as IETF BCP 70, a document covering many aspects of designing and
deploying an XML-based language.
SQLite
SQLite is an embedded SQL database engine. Unlike most other SQL databases,
SQLite does not have a separate server process. SQLite reads and writes directly to ordinary
disk files. A complete SQL database with multiple tables, indices, triggers, and views, is
contained in a single disk file. The database file format is cross-platform - you can freely
copy a database between 32-bit and 64-bit systems or between big-endian and little-endian
architectures. These features make SQLite a popular choice as an Application File Format.
Think of SQLite not as a replacement for Oracle but as a replacement for fopen()
SQLite is a compact library. With all features enabled, the library size can be less than
500KiB, depending on the target platform and compiler optimization settings. (64-bit code is
larger. And some compiler optimizations such as aggressive function inlining and loop
unrolling can cause the object code to be much larger.) If optional features are omitted, the
size of the SQLite library can be reduced below 300KiB. SQLite can also be made to run in
minimal stack space (4KiB) and very little heap (100KiB), making SQLite a popular database
engine choice on memory constrained gadgets such as cellphones, PDAs, and MP3 players.
There is a tradeoff between memory usage and speed. SQLite generally runs faster the more
memory you give it. Nevertheless, performance is usually quite good even in low-memory
environments.
SQLite is very carefully tested prior to every release and has a reputation for being
very reliable. Most of the SQLite source code is devoted purely to testing and verification.
An automated test suite runs millions and millions of test cases involving hundreds of
millions of individual SQL statements and achieves 100% branch test coverage. SQLite
responds gracefully to memory allocation failures and disk I/O errors. Transactions are ACID
even if interrupted by system crashes or power failures. All of this is verified by the
automated tests using special test harnesses which simulate system failures. Of course, even
with all this testing, there are still bugs. But unlike some similar projects (especially
commercial competitors) SQLite is open and honest about all bugs and provides bugs lists
and minute-by-minute chronologies of bug reports and code changes.
The SQLite code base is supported by an international team of developers who work on
SQLite full-time. The developers continue to expand the capabilities of SQLite and enhance
its reliability and performance while maintaining backwards compatibility with the published
interface spec, SQL syntax, and database file format. The source code is absolutely free to
anybody who wants it, but professional support is also available.
By default, Android Studio displays your project files in the Android project view. This
view shows a flattened version of your project's structure that provides quick access to the
key source files of Android projects and helps you work with the Gradle-based build system.
• Shows the most important source directories at the top level of the module hierarchy.
• Groups all the manifest files for each module in a common folder.
The Android build system is the toolkit you use to build, test, run and package your apps.
This build system replaces the Ant system used with Eclipse ADT. It can run as an integrated
tool from the Android Studio menu and independently from the command line. You can use
the features of the build system to:
• Create multiple APKs for your app with different features using the same project and
modules.
The flexibility of the Android build system enables you to achieve all of this without
modifying your app's core source files. To build an Android Studio project, see Building and
Running from Android Studio. To configure custom build settings in an Android Studio
project, see Configuring Gradle Builds.
AVD Manager has updated screens with links to help you select the most popular
device configurations, screen sizes and resolutions for your app previews. Click the Android
Virtual Device Manager in the toolbar to open it and create new virtual devices for running
your app in the emulator.
The AVD Manager comes with emulators for Nexus 6 and Nexus 9 devices and also
supports creating custom Android device skins based on specific emulator properties and
assigning those skins to hardware profiles. Android Studio installs the Intel® x86 Hardware
Accelerated Execution Manager (HAXM) emulator accelerator and creates a default emulator
for quick app prototyping.
Inline debugging
Use inline debugging to enhance your code walk-throughs in the debugger view with
inline verification of references, expressions, and variable values. Inline debug information
includes:
PHP
PHP stands for hypertext preprocessor. Earlier it was known as personal home pages.PHP is a
server side scripting language suited for web based technologies and it can be embedded into
HTML. PHP runs on server side, so we can say that PHP is a “Server side HTML embedded
scripting language”.
1. Client side
2. Server side
Client side scripting languages run on client’s web browser. E.g. JavaScript, Visual basic
Script. We use client side scripting languages for form validation. Nowadays JavaScript is
widely used in jQuery to add additional text, background effects & menus.
Server side scripting languages run on the web server. Server-side scripting is used for
database operations and to generate dynamic web pages. The server side scripts are not
visible on browsers. No one can see the source code of server script language whereas as you
can use, download client side scripts.PHP is very popular server side scripting language. It is
widely used in website development due to its ease of use. The syntax of PHP is very similar
to other programming languages. OOPS concept can be used in PHP.
SYSTEM STUDY
SYSTEM STUDY
EXISTING SYSTEMS
In this existing system, the overall process are not covering all the system of a college or
institution. The process in the current attendance system is not proper.
DRAWBACKS
➢ Time consuming.
PROPOSED SYSTEM
In this proposed system, there will be mainly four modules.Admin, Parent, Teacher ,and
Student will be having access to the system. So there will be mutual understanding with each
other. This will helpful to provide more
efficiency to the proposed system.
FEATURES
* The project is created as a mobile application and hence more than one terminal point
for user access is possible.
* Better service.
After designing input and output, file design is performed or how data should be
organize around user requirements. An integrated approach to the file design is the database.
The objective of the database is accuracy and integrity.
Recovery from failure, privacy and security of data and would overall performance.
Data files are grouped together to form a table space. All database objects are stored in
table space.
INPUT DESIGN
The input design is the link between the application and the user. It comprises the
developing specification and procedures for data preparation and those steps are necessary to
put transaction data in to a usable form for processing can be achieved by inspecting the
mobile to read data from document or it can occur by having people keying the data directly
into the application. The design of input focuses on controlling the amount of input required,
controlling the errors, avoiding delay, avoiding extra steps and keeping the process simple.
The input is designed in such a way so that it provides security and ease of use with retaining
the privacy. Input Design considered the following things:
• Methods for preparing input validations and steps to follow when error occur.
Input Design is the process of converting a user-oriented description of the input into
a mobile application. This design is important to avoid errors in the data input process and
show the correct direction to the management for getting correct information from the mobile
application. It is achieved by creating user-friendly screens for the data entry to handle large
volume of data. The goal of designing input is to make data entry easier and to be free from
errors. The data entry screen is designed in such a way that all the data manipulates can be
performed. It also provides record viewing facilities.
OUTPUT DESIGN
A quality output is one, which meets the requirements of the end user and presents the
information clearly. In any system results of processing are communicated to the users and to
other system through outputs. In output design it is determined how the information is to be
displaced for immediate need and also the hard copy output. It is the most important and
direct source information to the user. Efficient and intelligent output design improves the
system’s relationship to help user decision-making.
Designing output should proceed in an organized, well thought out manner; the right
output must be developed while ensuring that each output element is designed so that people
will find the system can use easily and effectively. When analysis design output, they should
Identify the specific output that is needed to meet the requirements. Select methods for
presenting information. Create document, report, or other formats that contain information
produced by the system
.
The output form of an information system should accomplish one or more of the
following objectives.
The “Attendance management system” data has been design using SQLite, which
is used to keep all the information in a data update management system proper care has been
taken in designing the database to achieve the objectives listed below
• Data independence.
• Data integrity.
• Data consistency.
Normalization is a process of simplifying the database design to achieve the optimum
structure. The steps in this process are known as normal form. These normal forms are a
sequence of rules that are applied to progressively a database design. The higher the normal
form of a database, the more efficient its underlying design. This is because, for a database to
be simplified into third normal form, it must meet the criteria of first and second normal
forms.
The Second Normal Form is used in this project. Because, we must make sure that the
non key fields depends on all the field in primary key every field in the table should be
depend upon the entire primary key so that when new records are added, same value will not
be repeated from records to records unnecessarily.
Second normal form (2NF) is a relation that is in first normal form and every non-
primary-key attribute is fully functionally dependent on the primary key. The normalization
of 1NF relations to 2NF involves the removal of partial dependencies. If a partial dependency
exists, we remove the function dependent attributes from the relation by placing them in a
new relation along with a copy of their determinant.
SYSTEM DEVELOPMENT
DESCRIPTION OF MODULUS
In this project we have mainly four modules, they are
• Admin
• Teacher
• Student
• Parents
MODULES DESCRIPTION
Administrator
Teacher
The main idea of implementing teacher module is that to make communication
between the students and the administrator .The teacher will be having permission to
communicate with parents of the respective students .Teacher can inform the students about
the exams and result. Also there are facilities upload study materials like books ,can add
subjects details ,also update notice board .
Student
In this attendance management system, student also will have a login. By having
student login he/she can know the events that are taking place in their college. They will be
also available to know the details of their exams, timetable etc. Student will be able to receive
the sms from the teacher or admin about the details of exam result. They are also available to
know the the books that will be in the library. The facility of available dormitory can be
viewed by the student.
Parent
By having the parent module in the attendance management system, the parent will be
able to know the details of their child. All the information about the Exam and result of the
exam will be sent to the parent by the respective teachers of their children. Parents will be
also available to know about the funds that are been collected from the students by the
college authority.
TESTING AND IMPLEMENTATION
TESTING
System testing is executing a program to check logic changes made in it and within
the intention of finding the errors. Testing is the stage, which ensures that the application
“Attendance Management system ” works accurately and efficiently before original operation
commences. It is the confirmation to show the users that the application works accurately and
efficiently.
The proper choice of test data is as important as the test itself. Properly created test
data provides all combination of values and formats and make it possible to test all logic and
transaction path subroutine. A test plan has been prepared and the conditions for each
testing have been mentioned.
Program testing is a testing technique for each program in the component was tested
individually for logical errors, by using different kinds of data when there exists a
discrepancy a sequence of instructions was traced to determine the problem. The result of
testing should be carried out in conjunction with the appropriate user.
Black box testing also called behavioral testing, focuses on the functional
requirements of the application. That is, black box testing enable the application developers
to derive set of input conditions that will fully exercise all functional requirements for a
program. Black box testing is not an alternative to white box techniques. Rather it is a
complementary approach that is likely to uncover a different class of errors than white box
methods.
Functional requirement for the Easy travel to view to users, and while we do black
box testing they focus on functional requirement of the application from codes side and
database side.
Black box testing attempts to find error in the following categories:
• Incorrect or missing functions of updating information.
• Interface errors between user and application.
• Errors in a data structures or external database access.
• Behavior or performance errors.
• Initialization and terminating errors.
White box test of application is predicted on a close examination of procedural detail. The
status of the project may be tested at various points to determine whether the expected or
asserted status is corresponding to the actual status. Using these following test cases can be
derived:
• Exercise all loops within their boundaries and their operation bounds.
• Exercise internal data structure to ensure their validity.
UNIT TESTING
Unit testing focuses on verification effort on the smallest limit of application design.
Using the unit test plan prepared in the design phase of the application, important control
paths are tested to uncover the errors within the module. This testing was carried out during
the coding itself. In this testing step each module is going to be working satisfactorily as the
expected output from the module.
INTEGRATION TESTING
VALIDATION TESTING
All the end of the integration testing, software is completely assembled as package,
interfacing errors have been uncovered and corrected and final series of software validation
testing begins. Validation testing can be defined in any ways, but a simple definition is that
validation succeeds when the software function is a manner that can be reasonably accepted
by the user. Software validation is achieved through a serious of black box test that
demonstrate conformity with requirements.
OUTPUT TESTING
The output generated by the system under consideration is in the format required by
the user and the information’s in the reports are accurate. It is possible to generate timely
reports without any errors
IMPLEMENTATION
Implementation is the process of bringing a revised or newly developed system in to
an operational one. This is an important phase in the system life cycle. The implementation
phase constructs and installs the new system. The most crucial stage in giving confidence on
the new system for the users that it will work efficiently and effectively. It involves careful
planning and investigation of the current system and its constraints on implementation. Two
major tasks of preparing the implementation are education and training of users and testing of
the system.
The major complex the system being implemented the more involved will be the system
analysis and design effort required just for implementation. The implementation phase
comprises of several activities. The required hardware and software acquisition is carried out.
The system requires some software to be developed. For this, programs are written and
tested. The system is then tested as a whole. Training of the user is considered as one of the
major issues in system implementation and primary constraint is that it should be user
friendly. After training user how to use the package effectively, the user changes over to this
newly fully tested system and the old system is continued.
CONCLUSION
CONCLUSION
The project was designed, implemented and tested successfully. The project manages all
details without any risk. All the objectives were met with satisfaction. The performance of the
system is found to be efficiently, effectively and satisfactory.The project provides much more
security. The simplicity and friendliness are the advantages of this project. The system is
made user friendly to the maximum so that anyone can run the project provided he could
access to the system via the login password.
Error correction and modification for enhancement could be made very easy. The
system resulted in regular and timely preparations of the required outputs. In comparison with
manual system, the benefits under a computerized system were considerable in saving of
manpower, working hours and effort.
It can be observed that the information required can be obtained with ease and accuracy
in the computerized system. The system is feasible enough for amendments and
modifications that may arrive in future. I believe that the system will remain good for
reasonable period for time. Once again I am expressing my thanks to those who helped to
make this a successful one.
BIBLIOGRAPHY
BIBLIOGRAPHY
*www.Tutorialspoint.com
*Http://developer.android.com
REFERENCES
A Data flow diagram is a network which describes the flow of data and process
that transformed data through the system the points, which transform the data, are
the nodes of the network. The principle processes that take place at the nodes are
combining, splitting and modifying data streams. Unlike flow charts, dataflow
nodes in the diagram might be activated. Dataflow diagram can be expressed
using information notation. Like other types of the system flow charts, data flow
diagrams can be expanded into successively lower level details. This process is
called decomposition and it can be continued until modules are arrived into that
extend of clarification that the origin and use of every data element in the system
quite evident.
DFD Symbols
Data Flow Diagram is composed of the four bases shown below:-
A dataflow is a root, which enables Packet of data to travel from one
pointer to another. Data may flow from a source to a processor and from
data source or process. An arrow line depicts the flow, with arrow head
pointing in the direction of the flow.
attendance
book
ci_sessions
document
dormitory
exam
expense_category
grade
invoice
mark
message_thread
message
notice_board
noticeboard
parent
payment
section
settings
subject
transport
SAMPLE CODING
SAMPLE CODING
package com.example.atees.attendance;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
Thread splashTread;
@Override
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splashscreen);
@Override
try {
int waited = 0;
sleep(100);
waited += 100;
MainActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
startActivity(intent);
Splashscreen.this.finish();
} catch (InterruptedException e) {
// do nothing
} finally {
Splashscreen.this.finish();
};
splashTread.start();
MAIN ACTIVITY
package com.example.atees.attendance;
import java.io.File;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.DownloadManager;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Bitmap;
import android.media.MediaPlayer;
import android.media.MediaPlayer.OnCompletionListener;
import android.media.MediaPlayer.OnErrorListener;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.view.Gravity;
import android.view.Menu;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.JsPromptResult;
import android.webkit.JsResult;
import android.webkit.MimeTypeMap;
import android.webkit.ValueCallback;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings.PluginState;
import android.webkit.WebSettings.RenderPriority;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.VideoView;
@SuppressWarnings("deprecation")
@SuppressLint({"CutPasteId","NewApi", "SetJavaScriptEnabled"})
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// ========================Create adView
// Add adView
layout.addView(adView);*/
//Webview scroll
mainWebView.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
//Cache enable
mainWebView.getSettings().setAppCacheEnabled(true);
mainWebView.getSettings().setRenderPriority(RenderPriority.HIGH);
mainWebView.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
case MotionEvent.ACTION_UP:
if (!v.hasFocus()) {
v.requestFocus();
v.requestFocusFromTouch();
}
break;
}
return false;
}
});
// Menu category
ImageView text1= (ImageView) findViewById(R.id.title_bar_home);
text1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Intent reInt = new
Intent(getApplicationContext(),MainActivity.class);
startActivity(reInt);
mainWebView.loadUrl(HomeUrl);
}
});
// Menu category
ImageView text2= (ImageView) findViewById(R.id.title_bar_share);
text2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_TEXT, ShareUrl);
intent.putExtra(Intent.EXTRA_SUBJECT, "Interesting for you!");
startActivity(Intent.createChooser(intent, "Share via"));
}
});
}
@Override
public void onPageStarted(WebView view, String url, Bitmap favicon) {
// TODO Auto-generated method stub
super.onPageStarted(view, url, favicon);
//@SuppressWarnings("deprecation")
@Override
public void onPageFinished(WebView view, String url) {
// TODO Auto-generated method stub
super.onPageFinished(view, url);
@SuppressLint("NewApi")
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
//share page or link
ShareUrl = url;
else
} catch
(UnsupportedEncodingException e) {
// TODO Auto-generated
catch block
e.printStackTrace();
}
}
// One touch image link <a href="test.jpg">Image</a>
else
if(url.startsWith("download")){
String[] download_link = url.split(":");
try {
//<a
href="download:http://mosaicdesign.uz/test.mp4">Download mp4</a>
sdrUrl=
URLDecoder.decode(download_link[1], "UTF-
8")+":"+URLDecoder.decode(download_link[2], "UTF-8");
ext =
MimeTypeMap.getFileExtensionFromUrl(sdrUrl);
if (ext != null) {
MimeTypeMap mime =
MimeTypeMap.getSingleton();
String mimeType =
mime.getMimeTypeFromExtension(ext);
if (mimeType != null) {
if (ext.toLowerCase().contains("mp4")) {
DownloadManager mdDownloadManager =
(DownloadManager) MainActivity.this
.getSystemService(Context.DOWNLOAD_SERVICE);
DownloadManager.Request request = new
DownloadManager.Request(
Uri.parse(sdrUrl));
request.setAllowedNetworkTypes(DownloadManager.Request.NETWORK_MOBILE);
request.setAllowedNetworkTypes(DownloadManager.Request.NETWORK_WIFI);
request.setAllowedOverRoaming(true);
File destinationFile = new File(
Environment.getExternalStorageDirectory(),
getFileName(sdrUrl, ext));
request.setDestinationUri(Uri.fromFile(destinationFile));
mdDownloadManager.enqueue(request);
}
}
}
return true;
} catch
(UnsupportedEncodingException e) {
// TODO Auto-generated
catch block
e.printStackTrace();
}
}
else
{
Uri uri = Uri.parse(url);
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(uri, "video/mp4");
startActivity(intent);
return true;
}
else
if(url.startsWith("download")){
String[] download_link = url.split(":");
try {
//<a
href="download:http://mosaicdesign.uz/test.mp3">Download mp3</a>
sdrUrl=
URLDecoder.decode(download_link[1], "UTF-
8")+":"+URLDecoder.decode(download_link[2], "UTF-8");
//ext=url.substring(url.lastIndexOf("."));
ext =
MimeTypeMap.getFileExtensionFromUrl(sdrUrl);
if (ext != null) {
MimeTypeMap mime =
MimeTypeMap.getSingleton();
String mimeType =
mime.getMimeTypeFromExtension(ext);
if (mimeType != null) {
if (ext.toLowerCase().contains("mp3")) {
DownloadManager mdDownloadManager =
(DownloadManager) MainActivity.this
.getSystemService(Context.DOWNLOAD_SERVICE);
DownloadManager.Request request = new
DownloadManager.Request(
Uri.parse(sdrUrl));
request.setAllowedNetworkTypes(DownloadManager.Request.NETWORK_MOBILE);
request.setAllowedNetworkTypes(DownloadManager.Request.NETWORK_WIFI);
request.setAllowedOverRoaming(true);
File destinationFile = new File(
Environment.getExternalStorageDirectory(),
getFileName(sdrUrl, ext));
request.setDestinationUri(Uri.fromFile(destinationFile));
mdDownloadManager.enqueue(request);
}
}
}
return true;
} catch
(UnsupportedEncodingException e) {
// TODO Auto-generated
catch block
e.printStackTrace();
}
}
else
{
Uri uri = Uri.parse(url);
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(uri, "audio/mp3");
startActivity(intent);
return true;
}
url.endsWith(".pdf")
|| url.endsWith(".txt")
|| url.endsWith(".doc")
|| url.endsWith(".docx")
|| url.endsWith(".xls")
|| url.endsWith(".xlsx")
|| url.endsWith(".ppt")
|| url.endsWith(".pptx")
|| url.endsWith(".pages")
|| url.endsWith(".ai")
|| url.endsWith(".psd")
|| url.endsWith(".tiff")
|| url.endsWith(".dxf")
|| url.endsWith(".svg")
|| url.endsWith(".eps")
|| url.endsWith(".ps")
|| url.endsWith(".ttf")
|| url.endsWith(".xps")
|| url.endsWith(".zip")
|| url.endsWith(".rar")
)
{
if(url.startsWith("download")){
String[] download_link = url.split(":");
try {
sdrUrl=
URLDecoder.decode(download_link[1], "UTF-
8")+":"+URLDecoder.decode(download_link[2], "UTF-8");
ext =
MimeTypeMap.getFileExtensionFromUrl(sdrUrl);
if (ext != null) {
MimeTypeMap mime =
MimeTypeMap.getSingleton();
String mimeType =
mime.getMimeTypeFromExtension(ext);
if (mimeType != null) {
DownloadManager mdDownloadManager =
(DownloadManager) MainActivity.this
.getSystemService(Context.DOWNLOAD_SERVICE);
DownloadManager.Request request = new
DownloadManager.Request(
Uri.parse(sdrUrl));
request.setAllowedNetworkTypes(DownloadManager.Request.NETWORK_MOBILE);
request.setAllowedNetworkTypes(DownloadManager.Request.NETWORK_WIFI);
request.setAllowedOverRoaming(true);
File destinationFile = new File(
Environment.getExternalStorageDirectory(),
getFileName(sdrUrl, ext));
request.setDestinationUri(Uri.fromFile(destinationFile));
mdDownloadManager.enqueue(request);
}
}
return true;
} catch
(UnsupportedEncodingException e) {
// TODO Auto-generated
catch block
e.printStackTrace();
}
}
else
{
String googleDocs = "https://docs.google.com/viewer?url=";
mainWebView.loadUrl(googleDocs + url);
return true;
}
}
else
if(url.startsWith("http:") || url.startsWith("https:"))
{view.loadUrl(url); }
return true;
}
@Override
public void onReceivedError(WebView view, int errorCode, String description, String
failingUrl) {
view.loadUrl("file:///android_asset/error.html");
}
}
@Override
public void onShowCustomView(View view, int requestedOrientation,
CustomViewCallback callback) // Available in API level 14+,
deprecated in API level 18+
{
onShowCustomView(view, callback);
if(Build.VERSION.SDK_INT >=14) {
if (view instanceof FrameLayout) {
mainWebView.addView(view, new FrameLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT,
Gravity.CENTER));
mainWebView.setVisibility(View.VISIBLE);
}
}
}
@Override
public void onShowCustomView(View view, CustomViewCallback callback) {
// mainLayout is the root layout that (ex. the layout that contains the webview)
mContentView = (RelativeLayout)findViewById(R.id.RootLayout);
if (mCustomViewContainer.getFocusedChild() instanceof VideoView) {
mVideoView = (VideoView) mCustomViewContainer.getFocusedChild();
// frame.removeView(video);
mContentView.setVisibility(View.GONE);
mCustomViewContainer.setVisibility(View.VISIBLE);
setContentView(mCustomViewContainer);
mVideoView.setOnCompletionListener((OnCompletionListener) this);
mVideoView.setOnErrorListener((OnErrorListener) this);
mVideoView.start();
}
}
}
mCustomViewCallback.onCustomViewHidden();
}
public boolean onError(MediaPlayer arg0, int arg1, int arg2) {
setContentView(mContentView);
return true;
}
//Java script alert dialog
@Override
public boolean onJsAlert(WebView view, String url, String message,
final JsResult result) {
new AlertDialog.Builder(MainActivity.this)
.setTitle("Attention !")
.setMessage(message)
.setPositiveButton(R.string.ok,
new AlertDialog.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
// do your stuff here
result.confirm();
}
}).setCancelable(false).create().show();
return true;
}
};
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.mainmenu, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.action_refresh:
mainWebView.loadUrl( "javascript:window.location.reload( true )" );
break;
case R.id.action_exit:
finish();
break;
default:
break;
}
return true;
}
@Override
protected void onPause() {
if(mCustomViewContainer != null){
vidPosition = mVideoView.getCurrentPosition();
}
super.onPause();
}
@Override
protected void onResume() {
if(mCustomViewContainer != null){
mVideoView.seekTo(vidPosition);
}
super.onResume();
}
@Override
public void onBackPressed() {
if(mCustomViewContainer != null){
mVideoView.stopPlayback();
mCustomViewContainer.setVisibility(View.GONE);
if (mVideoView == null){
return;
}else{
mainWebView.goBack();
}else{
// super.onBackPressed();
exti_function();
}
MainActivity.this.finish();
}
})
.setNegativeButton("No", new
DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,
int id) {
dialog.cancel();
}
});
AlertDialog alert = builder.create();
alert.show();
return filenameWithoutExtension;
}
}
.
SAMPLE INPUT
Home Page
Add Student
Daily Attendance
Add books
SAMPLE OUTPUT
Login
Manage exam
Manage teacher