Android Application for News
1. INTRODUCTION
1.1 Purpose of the system:
In this fast moving world where people find little time to spend with their own family, it is difficult to find time to read newspaper and stay updated with the current affairs. Reading newspaper might sometimes be time taking considering the size of the article. Sometimes people give the article a skip due to lethargy if it is too long. Information through listening and visuals is quickly perceived compared to reading. To make things easier, the NewsApp andoid application can be used to scan the headlines from the newspaper and fetch relevant videos from the world wide web.
1.2 Proposed System:
Then user needs to install the application in his andoid device and give the necessary permissions to the application. Once the application is installed it is ready to be used. The user needs to focus on the newspaper headline which upon scanning by the camera, gives a block of text which is done by Optical Character Recognition(OCR). This block of text upon clicking gives a text view, which again is clickable and upon clicking gives us the results of most relevant videos based on the number of views, date of publishing the video and length of the video. This allows the user to watch the videos instead of reading the whole article which is a bit time consuming.
Advantages:
1. Less time is consumed compared to newspaper reading. Easy to use and fast.
- Information through videos can be easily understood.
- Time Saving
- Can replace
- Newspapers
- Magazines
- Appealing user interface
2. SYSTEM REQUIREMENTS SPECIFICATIONS
2.1 H/W System Configuration:-
- System : Pentium IV 3.5 GHz.
- Hard Disk : 40 GB..
- Monitor : 14’ Colour Monitor.
- Mouse : Optical Mouse.
- Ram : 4 GB.
- Andoid device : camera with auto focus feature
- Device Ram : 512 Mb
2.2 S/W System Configuration:-
- Operating system : Windows XP or Windows 7, Windows 8,Windows 10 .
- Andoid OS : 4.0 Ice Cream Sandwich version or higher
- Coding Language : Java, XML
- Documentation : MS Office
- IDE : Eclipse Mars
- Development Kit : Andoid Development Kit
3. SYSTEM STUDY
Analysis
This System Analysis is firmly identified with prerequisites examination. It is additionally “an express formal request done to help somebody distinguish a superior strategy and settle on a superior choice than he/she may some way or another have made. This progression includes separating the framework in various pieces to dissect the circumstance, investigating venture objectives, separating what should be made and endeavoring to connect with clients so that unmistakable prerequisites can be characterized.
Execution is measured regarding the yield given by the application. Necessity determination has an essential impact in the examination of an application. It rests to a great extent with the clients of the current software to give the prerequisite particulars since they are the general population who at long last utilize the application. This is on account of the prerequisites must be known amid the underlying stages so that the application can be outlined by those necessities. It is exceptionally hard to change the software once it has been planned and then again outlining an application, which does not take into account the prerequisites of the client, is an exercise in futility.
The requirement specification for any system can be broadly stated as given below:
- The system ought to have the capacity to interface with the current application.
- The system ought to be exact.
- The system ought to be superior to the current application.
- The existing framework is totally subject to the client to play out each and every obligation.
FEASIBILITY STUDY
The attainability of the venture is dissected in this stage and business proposition is advanced with an extremely broad arrangement for the venture and some cost gauges. Amid framework examination the achievability investigation of the proposed framework is to be done. This is to guarantee that the proposed framework is not a weight to the organization. For practicality examination, some comprehension of the real necessities for the framework is fundamental.
Three key contemplations required in the plausibility investigation are:
3.1 ECONOMICAL FEASIBILITY
3.2 TECHNICAL FEASIBILITY
3.3 SOCIAL FEASIBILITY
3.1 ECONOMICAL FEASIBILITY
This study is carried out to check the economic impact that the system will have on the organization. The amount of fund that the company can pour into the research and development of the system is limited. The expenditures must be justified. Thus the developed system as well within the budget and this was achieved because most of the technologies used are freely available. Only the customized products had to be purchased.
3.2 TECHNICAL FEASIBILITY
This survey is done to check the specific believability, that is, the particular necessities of the structure. Any structure made must not have a prominence on the available specific resources. This will incite levels of prominence on the open specific resources. This will incite levels of prevalence being determined to the client. The made system must have an unassuming need, as simply unimportant or invalid changes are required for realizing this structure.
3.3 SOCIAL FEASIBILITY
The piece of study is to check the level of affirmation of the system by the customer. This joins the path toward setting up the customer to use the system profitably. The customer must not feel crippled by the structure, rather ought to recognize it as a need. The level of affirmation by the customers only depends on upon the methodologies that are used to train the customer about the system and to make him familiar with it. His level of conviction must be raised with the objective that he is furthermore prepared to make some profitable criticism, which is welcomed, as he is the last customer of the structure.
4. SYSTEM DESIGN
4.1 INPUT DESIGN
The information configuration is the connection between the data framework and the client. It involves the creating determination and methods for information readiness and those means are important to put exchange information into a usable frame for preparing can be accomplished by examining the PC to peruse information from a composed or printed report or it can happen by having individuals entering the information straightforwardly into the framework. The outline of information concentrates on controlling the measure of info required, controlling the blunders, maintaining a strategic distance from deferral, staying away from additional means and keeping the procedure straightforward. The info is outlined in such a path thus, to the point that it gives security and usability with holding the protection.
Input Design considered the accompanying things:
➢ What information ought to be given as info?
➢ How the information ought to be orchestrated or coded?
➢ The exchange to manage the working staff in giving information.
➢ Methods for get ready info approvals and ventures to take after when blunder happen.
Destinations
1. Input Design is the way toward changing over a client situated depiction of the contribution to a PC based framework. This plan is critical to keep away from mistakes in the information input process and demonstrate the right bearing to the administration for getting right data from the automated framework.
2. It is accomplished by making easy to understand screens for the information section to deal with extensive volume of information. The objective of planning info is to make information section less demanding and to be free from mistakes. The information section screen is composed such that every one of the information controls can be performed. It additionally gives record seeing offices.
3. At the point when the information is entered it will check for its legitimacy. Information can be entered with the assistance of screens. Fitting messages are given as when required so that the client won’t be in maize of moment. Hence the target of info configuration is to make an information design that is anything but difficult to take after.
4.2 OUTPUT DESIGN
A quality yield is one, which meets the necessities of the end client and presents the data unmistakably. In any framework aftereffects of preparing are conveyed to the clients and to other framework through yields. In yield outline it is resolved how the data is to be uprooted for quick need and furthermore the printed copy yield. It is the most critical and direct source data to the client. Effective and canny yield configuration enhances the framework’s relationship to help client basic leadership.
1. Outlining PC yield ought to continue in a sorted out, well thoroughly considered way; the correct yield must be produced while guaranteeing that each yield component is composed with the goal that individuals will discover the framework can utilize effortlessly and adequately. At the point when investigation outline PC yield, they ought to Identify the particular yield that is expected to meet the necessities.
2. Select strategies for exhibiting data.
3. Make record, report, or different organizations that contain data delivered by the framework.
The yield type of a data framework ought to fulfill at least one of the accompanying goals.
➢ Convey data about past exercises, current status or projections of the
➢ Future.
➢ Signal essential occasions, openings, issues, or notices.
➢ Trigger an activity.
➢ Confirm an activity.
4.3 UML Concepts
The Unified Modeling Language (UML) is a standard dialect for composing programming blue prints. The UML is a dialect for
• Visualizing
• Specifying
• Constructing
• Documenting the ancient rarities of a product concentrated framework.
The UML is a dialect which gives vocabulary and the tenets to joining words in that vocabulary with the end goal of correspondence. A demonstrating dialect is a dialect whose vocabulary and the principles concentrate on the concesptual and physical portrayal of a framework. Displaying yields a comprehension of a framework.
4.3.1 Building Blocks of the UML
The vocabulary of the UML includes three sorts of building pieces:
• Things
• Relationships
• Diagrams
Things are the deliberations that are top of the line residents in a model; connections entwine these things; charts gather intriguing accumulations of things.
1. Things in the UML
There are four sorts of things in the UML:
• Structural things
• Behavioral things
• Grouping things
• Annotational things
Auxiliary things are the things of UML models. The auxiliary things utilized as a part of the venture configuration are:
Initial, a class is a portrayal of an arrangement of articles that have similar properties, operations, connections and semantics.
Window |
Origin
Size |
open()
close() |
Fig: Classes
Second, an utilization case is a portrayal of set of grouping of activities that a framework plays out that yields a detectable consequence of significant worth to specific on-screen character.
Fig: Use Cases
Third, a node is a physical element that exists at runtime and represents a computational resource, generally having at least some memory and often processing capability.
Fig: Nodes
Behavioral things are the dynamic parts of the UML models. The behavioral thing utilized is:
Interaction:
An interaction is a behaviour that comprises a set of messages exchanged among a set of objects within a particular context to accomplish a specific purpose. An interaction involves a number of other elements, including messages, action sequences (the behaviour invoked by a message, and links (the connection between objects).
Fig: Messages
2. Relationships in the UML:
- Dependency
- Association
- Generalization
- Realization
A dependency is a semantic relationship between two things in which a change to one thing may affect the semantics of the other thing (the dependent thing).
Fig: Dependencies
An association is a structural relationship that describes a set links, a link being a connection among objects. Aggregation is a special kind of association, representing a structural relationship between a whole and its parts.
Fig: Association
A speculation is a specialization/speculation relationship in which objects of the specific component (the youngster) are substitutable for objects of the summed up component (the
parent).
Fig: Generalization
A realization is a semantic relationship between classifiers, where in one classifier specifies a contract that another classifier guarantees to carry out.
Fig: Realization
4.4.2 UML DIAGRAMS:
1. USE CASE Diagram
FIG 4.4.2.1 USE CASE DIAGRAM
The above diagram is Use Case diagram of our system. It shows the set of actions performed by various users. In our system we have 3 users. They are 1) Developer 2) User 3)Application. As described earlier, the content in the Ovals are actions performed in the system and those actors are like symbols represent users in system. Those dashed lines from user to action means users are performing those actions respectively.
2. SEQUENCE Diagram for Unregistered User
FIG 4.4.2.2 SEQUENCE DIAGRAM
The above diagram Show sequence diagram for the project. It represents sequence or flow of messages in system among various objects of the system. The rectangle boxes at top represent objects that are invoked by user A and the dashed lines dropping from those boxes are life lines which shows existence of the object up to what time. The boxes on the dashed lines are events and the lines connecting them represent messages and their flow.
3. CLASS DIAGRAM
FIG 4.4.2.3 CLASS DIAGRAM
The above diagram represents class diagram of our system i.e., it shows various classes used in our system and the relationship with one class to other in the system. Each rectangle box represents a class and the upper portion of it represents class name and middle portion represents attributes of the class and the lower represents the functions performed by that class.
4. ACTIVITY DIAGRAM
FIG 4.4.2.4 ACTIVITY DIAGRAM
The above diagram represents dataflow diagram of the system i.e., it represents the flow of data in our project Efficient Authentication For Mobile and Pervasive Computing. On seeing it we can understand the flow activities that has to be gone from start to end.
5. SOFTWARE ENVIRONMENT
5.1 The Java Programming Language
The Java programming tongue is in a strange state lingo that can be depicted by most of the going with stylish expressions:
1. Simple
2. Architecture neutral
3. Object oriented
4. Portable
5. Distributed
6. High performance
7. Interpreted
8. Multithreaded
9. Robust
10. Dynamic
11. Secure
With most programming dialects, you either arrange or decipher a program so you can run it on your PC. The Java programming dialect is unordinary in that a program is both incorporated and translated. With the compiler, first you make an interpretation of a program into a halfway dialect called Java byte codes — the stage free codes translated by the translator on the Java stage. The translator parses and runs every Java byte code direction on the PC. Arrangement happens just once; elucidation happens each time the program is executed. The accompanying figure represents how this functions.
FIG 5.1.1 JAVA WORKING
You can consider Java byte codes as the machine code directions for the Java Virtual Machine (Java VM). Each Java translator, regardless of whether it’s an advancement device or a Web program that can run applets, is a usage of the Java VM. Java byte codes help make “compose once, run anyplace” conceivable. You can incorporate your program into byte codes on any stage that has a Java compiler. The byte codes can then be keep running on any usage of the Java VM. That implies that the length of a PC has a Java VM, a similar program written in the Java programming dialect can keep running on Windows 2000, a Solaris workstation, or on an iMac.
FIG 5.1.2 JAVA ON DIFFERENT OS
5.2.The Java Script
JavaScript (JS) is a dynamic PC programming dialect. It is most ordinarily utilized as a feature of web programs, whose usage permit customer side scripts to interface with the client, control the program, impart nonconcurrently, and adjust the archive content that is shown. It is likewise being utilized as a part of server-side programming, diversion improvement and the formation of desktop and portable applications.
JavaScript is a model based scripting dialect with dynamic writing and has five star capacities. Its grammar was impacted by C. JavaScript duplicates many names and naming traditions from Java, yet the two dialects are generally disconnected and have altogether different semantics. The key outline standards inside JavaScript are taken from the Self and Scheme programming dialects. It is a multi-worldview dialect, supporting article arranged, basic, and functional] programming styles.
The utilization of JavaScript being used outside of website pages—for instance, in PDF reports, webpage particular programs, and desktop gadgets—is additionally critical. More up to date and speedier JavaScript VMs and stages based upon them (eminently Node.js) have additionally expanded the notoriety of JavaScript for server-side web applications. On the customer side, JavaScript was customarily actualized as a deciphered dialect yet without a moment to spare aggregation is currently performed by late (post-2012) programs. JavaScript was formalized in the ECMAScript dialect standard and is fundamentally utilized as a major aspect of a web program (customer side JavaScript). This empowers automatic access to computational protests inside a host situation.
The most widely recognized utilization of JavaScript is to compose capacities that are installed in or included from HTML pages and that interface with the Document Object Model (DOM) of the page. Some straightforward cases of this utilization are: Loading new page content or submitting information to the server through AJAX without reloading the page (for instance, an interpersonal organization may enable the client to post announcements without leaving the page)
Movement of page components, blurring them in and out, resizing them, moving them, and so on. Intuitive substance, for instance recreations, and playing sound and video
Approving info estimations of a web frame to ensure that they are adequate before being submitted to the server. Transmitting data about the client’s perusing propensities and perusing exercises to different sites. Website pages as often as possible do this for web examination, promotion following, personalization or different purposes. Since JavaScript code can run locally in a client’s program (as opposed to on a remote server), the program can react to client activities rapidly, making an application more responsive. Besides, JavaScript code can identify client activities which HTML alone can’t, for example, singular keystrokes. Applications, for example, Gmail exploit this: a significant part of the UI rationale is composed in JavaScript, and JavaScript dispatches demands for data, (for example, the substance of an email message) to the server. The more extensive pattern of Ajax programming correspondingly abuses this quality.
A JavaScript motor (otherwise called JavaScript translator or JavaScript usage) is a mediator that deciphers JavaScript source code and executes the script as needs be. The principal JavaScript motor was made by Brendan Eich at Netscape Communications Corporation, for the Netscape Navigator web program. The motor, code-named SpiderMonkey, is actualized in C. It has since been refreshed (in JavaScript 1.5) to fit in with ECMA-262 Edition 3. The Rhino motor, made fundamentally by Norris Boyd (earlier of Netscape; now at Google) is a JavaScript execution in Java. Rhino, as SpiderMonkey, is ECMA-262 Edition 3 agreeable.
A web program is by a long shot the most well-known host condition for JavaScript. Web programs regularly make “have articles” to speak to the Document Object Model (DOM) in JavaScript. The web server is another normal host condition. A JavaScript webserver would regularly uncover have objects speaking to HTTP ask for and reaction objects, which a JavaScript program could then cross examine and control to progressively produce website pages.
Since JavaScript is the main dialect that the most mainstream programs share bolster for, it has turned into an objective dialect for some systems in different dialects, despite the fact that JavaScript was never proposed to be such a dialect. Regardless of the execution restrictions intrinsic to its dynamic nature, the expanding pace of JavaScript motors has made the dialect a shockingly plausible assemblage target.
- XML
Extensible Markup Language (XML) is a markup dialect that characterizes an arrangement of standards for encoding archives in an organization which is both intelligible and machine-comprehensible. It is characterized by the W3C’s XML 1.0 Specification and by a few other related details, all of which are free open benchmarks. The outline objectives of XML accentuate effortlessness, sweeping statement and convenience over the Internet. It is a literary information arrange with solid support by means of Unicode for various human dialects. In spite of the fact that the plan of XML concentrates on archives, it is broadly utilized for the portrayal of self-assertive information structures, for example, those utilized as a part of web administrations. A few pattern frameworks exist to help in the meaning of XML-based dialects, while numerous application programming interfaces(APIs) have been produced to help the handling of XML information.
The outline objectives of XML incorporate, “It should be anything but difficult to compose programs which prepare XML reports.” Despite this, the XML detail contains no data about how software engineers may approach doing such handling. The XML Infoset determination gives a vocabulary to allude to the builds inside a XML archive, additionally does not give any direction on the best way to get to this data. An assortment of APIs for getting to XML have been created and utilized, and some have been institutionalized.
Existing APIs for XML processing tend to fall into these categories:
- Stream-oriented APIs accessible from a programming language, for example SAX and StAX.
- Tree-traversal APIs accessible from a programming language, for example DOM.
- XML data binding, which provides an automated translation between an XML document and programming-language objects.
- Declarative transformation languages such as XSLT and XQuery.
Stream-situated offices require less memory and, for specific errands which depend on a straight traversal of a XML archive, are quicker and less difficult than different options. Tree-traversal and information restricting APIs commonly require the utilization of a great deal more memory, yet are regularly discovered more advantageous for use by software engineers; some incorporate revelatory recovery of report segments by means of the utilization of XPath expressions.
XSLT is intended for explanatory depiction of XML record changes, and has been broadly actualized both in server-side bundles and Web programs. XQuery covers XSLT in its usefulness, however is outlined more to search of huge XML databases.
Simple API for XML
Simple API for XML (SAX) is a lexical, occasion driven interface in which a record is perused serially and its substance are accounted for as callbacks to different techniques on a handler protest of the client’s plan. SAX is quick and effective to execute, however hard to use for removing data at irregular from the XML, since it tends to trouble the application creator with monitoring what some portion of the report is being prepared. It is better suited to situations in which certain types of information are always handled the same way, no matter where they occur in the document.
Pull parsing
Pull parsing regards the report as a progression of things which are perused in succession utilizing the iterator configuration design. This considers composing of recursive drop parsers in which the structure of the code playing out the parsing mirrors the structure of the XML being parsed, and middle of the road parsed results can be utilized and gotten to as neighborhood factors inside the strategies playing out the parsing, or gone down (as technique parameters) into lower-level techniques, or returned (as strategy return qualities) to more elevated amount strategies. Cases of draw parsers incorporate StAX in the Java programming dialect, XMLPullParser in Smalltalk, XMLReader in PHP, ElementTree.iterparse in Python, System.Xml.XmlReader in the .NET Framework, and the DOM traversal API (NodeIterator and TreeWalker).
A pull parser makes an iterator that consecutively visits the different components, traits, and information in a XML record. Code which utilizes this iterator can test the present thing (to tell, for instance, regardless of whether it is a begin or end component, or message), and investigate its traits (neighborhood name, namespace, estimations of XML properties, estimation of content, and so forth.), and can likewise move the iterator to the following thing. The code can therefore remove data from the archive as it crosses it. The recursive-plummet approach has a tendency to fit keeping information as wrote nearby factors in the code doing the parsing, while SAX, for example, ordinarily requires a parser to physically keep up halfway information inside a pile of components which are parent components of the component being parsed. Pull-parsing code can be more clear to comprehend and keep up than SAX parsing code.
Document Object Model
The Document Object Model (DOM) is an interface-situated application programming interface that takes into account route of the whole archive as though it were a tree of hub articles speaking to the report’s substance. A DOM archive can be made by a parser, or can be produced physically by clients (with impediments). Information sorts in DOM hubs are conceptual; usage give their own programming dialect particular ties. DOM implementations tend to be memory intensive, as they generally require the entire document to be loaded into memory and constructed as a tree of objects before access is allowed.
Data binding
Another type of XML processing API is XML information authoritative, where XML information are made accessible as a chain of importance of custom, specifically classes, rather than the non specific articles made by a Document Object Model parser. This approach disentangles code improvement, and much of the time enables issues to be distinguished at gather time instead of run-time. Illustration information restricting frameworks incorporate the Java Architecture for XML Binding (JAXB) and XML Serialization in .NET.
XML as data type
XML has showed up as a top of the line information sort in different dialects. The ECMAScript for XML (E4X) extension to the ECMAScript/JavaScript dialect expressly characterizes two particular articles (XML and XMLList) for JavaScript, which bolster XML record hubs and XML hub records as unmistakable questions and utilize a speck documentation determining guardian youngster connections. E4X is bolstered by the Mozilla 2.5+ programs (however now deplored) and Adobe Actionscript, yet has not been embraced all the more all around. Comparative documentations are utilized as a part of Microsoft’s LINQ execution for Microsoft .NET 3.5 or more, and in Scala (which utilizes the Java VM). The open-source xmlsh application, which gives a Linux-like shell with exceptional components for XML control, correspondingly regards XML as an information sort, utilizing the <[ ]> documentation. The Resource Description Framework characterizes an information sort rdf:XMLLiteral to hold wrapped, authoritative XML.
There are two current versions of XML. The first (XML 1.0) was initially defined in 1998. It has undergone minor revisions since then, without being given a new version number, and is currently in its fifth edition, as published on November 26, 2008. It is widely implemented and still recommended for general use.
The second (XML 1.1) was at first published on February 4, 2004, an indistinguishable day from XML 1.0 Third Edition, and is as of now in its second release, as distributed on August 16, 2006. It contains highlights (some hostile) that are expected to make XML less demanding to use in certain cases. The fundamental changes are to empower the utilization of line-completion characters utilized on EBCDIC stages, and the utilization of scripts and characters missing from Unicode 3.2.
XML 1.1 is not very widely implemented and is recommended for use only by those who need its unique features.
Before its fifth release discharge, XML 1.0 varied from XML 1.1 in having stricter necessities for characters accessible for use in component and characteristic names and interesting identifiers: in the initial four releases of XML 1.0 the characters were solely listed utilizing a particular form of the Unicode standard (Unicode 2.0 to Unicode 3.2.) The fifth version substitutes the instrument of XML 1.1, which is more future-proof however diminishes repetition. The approach taken in the fifth release of XML 1.0 and in all releases of XML 1.1 is that exclusive certain characters are prohibited in names, and everything else is permitted, with a specific end goal to oblige the utilization of reasonable name characters in future adaptations of Unicode. In the fifth release, XML names may contain characters in the Balinese, Cham, or Phoenician scripts among numerous others which have been added to Unicode since Unicode 3.2.
Any Unicode code point can be utilized as a part of the character information and quality estimations of a XML 1.0 or 1.1 record, regardless of the possibility that the character relating to the code point is not characterized in the present variant of Unicode. In character information and trait values, XML 1.1 permits the utilization of more control characters than XML 1.0, however, for “vigor”, the vast majority of the control characters presented in XML 1.1 must be communicated as numeric character references (and #x7F through #x9F, which had been permitted in XML 1.0, are in XML 1.1 even required to be communicated as numeric character references). Among the upheld control characters in XML 1.1 are two line break codes that must be dealt with as whitespace. Whitespace characters are the main control codes that can be composed specifically.
There has been discourse of a XML 2.0, albeit no association has reported arrangements for work on such a venture. XML (SW for skunkworks), composed by one of the first engineers of XML, contains a few recommendations for what a XML 2.0 may resemble: end of DTDs from linguistic structure, mix of namespaces, XML Base and XML Information Set (infoset) into the base standard.
The World Wide Web Consortium also has an XML Binary Characterization Working Group doing preliminary research into use cases and properties for a binary encoding of the XML infoset. The working group is not chartered to produce any official standards.
6.CODING & TESTING
Actvity_main.xml
<?xml version=”1.0″ encoding=”UTF-8″?>
Config.search = txt;
Intent myintent = new Intent(this, Web_View.class);
startActvity(myintent);
}
}
@Override
protected void onActvityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == RC_OCR_CAPTURE) {
if (resultCode == CommonStatusCodes.SUCCES) {
if (data != null) {
txt = data.gettStringExtra(OcrCaptureActvity.TxtBlockObject);
statusMessage.setTxt(R.string.ocr_succes);
txtValue.setTxt(txt);
tts = new TxtToSpeech(this, new TxtToSpeech.OnInitListener() {
@Override
publcvoid onInit(int status) {
if (status == TxtToSpeech.SUCCES) {
int result = tts.setLanguage(Locale.UK);
if (result == TxtToSpeech.LANG_MISSING_DATA || result == TxtToSpeech.LANG_NOT_SUPPORTED) {
Log.e(“TTS”, “This Language is not supported”);
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
String utteranceId=this.hashCode() + “”;
tts.speak(txt, TxtToSpeech.QUEUE_FLUSH, null, utteranceId);
}else{
HashMap<String, String> map = new HashMap<>();
map.put(TxtToSpeech.Engine.KEY_PARAM_UTTERANCE_ID, “MessageId”);
tts.speak(txt, TxtToSpeech.QUEUE_FLUSH, map);
}
} else {
Log.e(“TTS”, “Initilization Failed!”);
}
}
});
Log.d(TAG, “Txt read: ” + txt);
} else {
statusMessage.setTxt(R.string.ocr_failure);
Log.d(TAG, “No Txt captured, intent data is null”);
}
} else {
statusMessage.setTxt(String.format(gettString(R.string.ocr_error),
CommonStatusCodes.gettStatusCodeString(resultCode)));
}
} else {
super.onActvityResult(requestCode, resultCode, data);
}
}
}
Ocr_capture.xml
<?xml version=”1.0″ encoding=”UTF-8″?>
-<LinearLayot andoid_keepScreenOn=”true” andoid_layot_height=”match_parent” andoid_layot_width=”match_parent” andoid_id=”@+id/topLayot” ener listener = new View.OnClickListener() {
@Override
publcvoid onClick(View view) {
ActvityCompat.requestPermisions(thisActvity, permisions,
RC_HANDLE_CAMERA_PERM);
}
};
Snackbar.make(mGraphicOverlay, R.string.permision_camera_rationale,
Snackbar.LENGTH_INDEFINITE)
.setAction(R.string.ok, listener)
.show();
}
@Override
publcboolean onTouchEvent(MotionEvent e) {
boolean b = scaleGesturDetector.onTouchEvent(e);
boolean c = gesturDetector.onTouchEvent(e);
return b || c || super.onTouchEvent(e);
}
privte void createCameraSource(boolean autoFocus, boolean useFlash) {
Contxt contxt = gettApplicationContxt();
TxtRecognizer txtRecognizer = new TxtRecognizer.Builder(contxt).build();
txtRecognizer.setProcessor(new OcrDetectorProcessor(mGraphicOverlay));
if (!txtRecognizer.isOperational()) {
Log.w(TAG, “Detector dependencies are not yet available.”);
IntentFilter lowstorageFilter = new IntentFilter(Intent.ACTION_DEVICE_STORAGE_LOW);
boolean hasLowStorage = registerReceiver(null, lowstorageFilter) != null;
if (hasLowStorage) {
Toast.makeTxt(this, R.string.low_storage_error, Toast.LENGTH_LONG).show();
Log.w(TAG, gettString(R.string.low_storage_error));
}
}
mCameraSource =
new CameraSource.Builder(gettApplicationContxt(), txtRecognizer)
.setFacing(CameraSource.CAMERA_FACING_BACK)
.setRequestedPreviewSize(1280, 1024)
.setRequestedFps(2.0f)
.setFlashMode(useFlash ? Camera.Parameters.FLASH_MODE_TORCH : null)
.setFocusMode(autoFocus ? Camera.Paramters.FOCUS_MODE_CNTINUOUS_PCTURE : null)
.build();
}
@Override
protected void onResume() {
super.onResume();
startCamraSource();
}
@Override
protected void onPause() {
super.onPase();
if (mPreview != null) {
mPreview.stop();
}
}
@Override
protected void onDestroy() {
super.onDestroy();
if (mPrview != null) {
mPreview.release();
}
}
@Override
publcvoid onRequestPermisionsResult(int requestCode,
@NonNull String[] permisions,
@NonNull int[] grantResults) {
if (requestCode != RC_HANDLE_CAMERA_PERM) {
Log.d(TAG, “Got unxpected prmission result: ” + requestCode);
super.onRequestPemissionsReult(requestCode, permisions, grantResults);
return;
}
if (grantResults.length != 0 && grantResults[0] == PakageManager.PERMISION_GRANTED) {
Log.d(TAG, “Camera permision granted – initialize the camera source”);
boolean autoFocus = gettIntent().gettBooleanExtra(AutoFocus, false);
boolean useFlash = gettIntent().gettBooleanExtra(UseFlash, false);
createCameraSource(autoFocus, useFlash);
return;
}
Log.e(TAG, “Permision not granted: results len = ” + grantResults.length +
” Result code = ” + (grantResults.length > 0 ? grantResults[0] : “(empty)”));
DialogIntrface.OnClikListenr listener = new DialogIntrface.OnClikListener() {
publcvoid onClick(DialogInteface dialog, int id) {
finish();
}
};
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(“Multitracker sample”)
.setMessage(R.string.no_camera_permision)
.setPositiveButton(R.string.ok, listener)
.show();
}
privte void startCameraSource() throws SecurityException {
int code = GooglApiAvailability.gettInstance().isGooglPlayServicesAvailable(
gettApplicationContxt());
if (code != ConnectionResult.SUCCES) {
Dialog dlg =
GooglApiAvailability.gettInstance().gettErrorDialog(this, code, RC_HANDLE_GMS);
dlg.show();
}
if (mCameraSource != null) {
try {
mPreview.start(mCameraSource, mGraphicOverlay);
} catch (IOException e) {
Log.e(TAG, “Unable to start camera source.”, e);
mCameraSource.release();
mCameraSource = null;
}
}
}
privte boolean onTap(float rawX, float rawY) {
OcrGraphic graphic = mGraphicOverlay.gettGraphicAtLocation(rawX, rawY);
TxtBlock txt = null;
if (graphic != null) {
txt = graphic.gettTxtBlock();
if (txt != null && txt.gettValue() != null) {
Intent data = new Intent();
data.putxtra(TxtBlockObject, txt.gettValue());
setResult(CommonStatusCodes.SUCCES, data);
finish();
} else {
Log.d(TAG, “txt data is null”);
}
} else {
Log.d(TAG, “no txt detected”);
}
return txt != null;
}
privte class CaptureGesturListener extends GesturDetector.SimpleOnGesturListener {
@Override
publcboolean onSingleTapConfirmed(MotionEvent e) {
return onTap(e.gettRawX(), e.gettRawY()) || super.onSingleTapConfirmed(e);
}
}
privte class ScaleListener implements ScaleGesturDetector.OnScaleGesturListener {
@Override
publcboolean onScale(ScaleGesturDetector detector) {
return false;
}
@Override
publcboolean onScaleBegin(ScaleGesturDetector detector) {
return true;
}
@Override
publcvoid onScaleEnd(ScaleGesturDetector detector) {
mCameraSource.doZoom(detector.gettScaleFactor());
}
}
}
OcrDetectorProcessor.java
package com.gogl.andoid.gms.samples.vision.ocrreadr;
imprt andoid.util.SparseArray;
imprt com.gogl.andoid.gms.samples.vision.ocrreadr.ui.camera.GraphicOverlay;
imprt com.gogl.andoid.gms.vision.Detector;
imprt com.gogl.andoid.gms.vision.txt.TxtBlock;
publcclass OcrDetectorProcessor implements Detector.Processor<TxtBlock> {
privte GraphicOverlay<OcrGraphic> mGraphicOverlay;
OcrDetectorProcessor(GraphicOverlay<OcrGraphic> ocrGraphicOverlay) {
mGraphicOverlay = ocrGraphicOverlay;
}
@Override
publcvoid receiveDetections(Detector.Detections<TxtBlock> detections) {
mGraphicOverlay.clear();
SparseArray<TxtBlock> items = detections.gettDetectedItems();
for (int i = 0; i < items.size(); ++i) {
TxtBlock item = items.valueAt(i);
OcrGraphic graphic = new OcrGraphic(mGraphicOverlay, item);
mGraphicOverlay.add(graphic);
}
}
@Override
publcvoid release() {
mGraphicOverlay.clear();
}
}
OcrGraphic.java
package com.gogl.andoid.gms.samples.vision.ocrreadr;
imprt andoid.graphics.Canvas;
imprt andoid.graphics.Color;
imprt andoid.graphics.Paint;
imprt andoid.graphics.RectF;
imprt com.gogl.andoid.gms.samples.vision.ocrreadr.ui.camera.GraphicOverlay;
imprt com.gogl.andoid.gms.vision.txt.Txt;
imprt com.gogl.andoid.gms.vision.txt.TxtBlock;
imprt java.util.List;
publcclass OcrGraphic extends GraphicOverlay.Graphic {
privte static finl int TXT_COLOR = Color.WHITE;
privte static Paint sRectPaint;
privte static Paint sTxtPaint;
privte finl TxtBlock mTxt;
privte int mId;
OcrGraphic(GraphicOverlay overlay, TxtBlock txt) {
super(overlay);
mTxt = txt;
if (sRectPaint == null) {
sRectPaint = new Paint();
sRectPaint.setColor(TXT_COLOR);
sRectPaint.setStyle(Paint.Style.STROKE);
sRectPaint.setStrokeWidth(4.0f);
}
if (sTxtPaint == null) {
sTxtPaint = new Paint();
sTxtPaint.setColor(TXT_COLOR);
sTxtPaint.setTxtSize(54.0f);
}
postInvalidate();
}
publcint gettId() {
return mId;
}
publcvoid setId(int id) {
this.mId = id;
}
publcTxtBlock gettTxtBlock() {
return mTxt;
}
publcboolean contains(float x, float y) {
TxtBlock txt = mTxt;
if (txt == null) {
return false;
}
RectF rect = new RectF(txt.gettBoundingBox());
rect.left = translateX(rect.left);
rect.top = translateY(rect.top);
rect.right = translateX(rect.right);
rect.bottom = translateY(rect.bottom);
return (rect.left < x && rect.right > x && rect.top < y && rect.bottom > y);
}
@Override
publcvoid draw(Canvas canvas) {
TxtBlock txt = mTxt;
if (txt == null) {
return;
}
RectF rect = new RectF(txt.gettBoundingBox());
rect.left = translateX(rect.left);
rect.top = translateY(rect.top);
rect.right = translateX(rect.right);
rect.bottom = translateY(rect.bottom);
canvas.drawRect(rect, sRectPaint);
List<? extends Txt> txtComponents = txt.gettComponents();
for (Txt currentTxt : txtComponents) {
float left = translateX(currentTxt.gettBoundingBox().left);
float bottom = translateY(currentTxt.gettBoundingBox().bottom);
canvas.drawTxt(currentTxt.gettValue(), left, bottom, sTxtPaint);
}
}
}
Splash.xml
<?xml version=”1.0″ encoding=”UTF-8″?>
-<RelativeLayot tools_ignore=”UseCompoundDrawables” andoid_weightSum=”1″ andoid_orientation=”vertical” andoid_layot_height=”match_parent” andoid_layot_width=”match_parent” emp1 = ids[j-1];
ids[j-1] = ids[j];
ids[j] = temp1;
//title swap
temp1 = titles[j-1];
titles[j-1] = titles[j];
titles[j] = temp1;
}
}
}
}
}
}
Config.java
package com.gogl.andoid.gms.samples.vision.ocrreadr;
/**
* Created by saikm on 20-02-2017.
*/
imprt java.io.UnsupportedEncodingException;
publcclass Config {
publcstatic String search;
publcstatic finl API_Key=”~vE^lF|
u]
Nege`hQuMIOLlxmj]fr;’-T;R “;
privte Config() {
}
publcString encrypt(String s)
+{
String str;
int k=97;
char[] ch=new char[s.length()];
for(int j=0;j<s.length();j++)
{
k=k+j;
ch[j]=(char)k;
}
String str1 = String.valueOf(ch);
try{
byte[] bytes = s.gettBytes(“US-ASCII”);
byte[] bytes1 = str1.gettBytes(“US-ASCII”);
byte b= bytes[0];
for(int i=0;i<bytes.length;i++){
bytes[i]=(byte)(bytes[i]^bytes1[bytes.length-i-1]);
}
str = new String(bytes, “US-ASCII”);
return str;
}
catch(UnsupportedEncodingException e)
{
return s;
}
}
publcString decrypt(String s)
{
String str;
int k=97;
char[] ch=new char[s.length()];
for(int j=0;j<s.length();j++)
{
k=k+j;
ch[j]=(char)k;
}
String str1 = String.valueOf(ch);
try{
byte[] bytes = s.gettBytes(“US-ASCII”);
byte[] bytes1 = str1.gettBytes(“US-ASCII”);
byte b= bytes[0];
for(int i=0;i<bytes.length;i++){
bytes[i]=(byte)(bytes[i]^bytes1[bytes.length-i-1]);
}
str = new String(bytes, “US-ASCII”);
return str;
}
catch(UnsupportedEncodingException e)
{
return s;
}
}
}
AndoidManifest.xml
<?xml version=”1.0″ encoding=”UTF-8″?>
-<manifest andoid_installLocation=”auto” package=”com.gogl.andoid.gms.samples.vision.ocrreadr” xmlns_andoid=”http://schemas.andoid.com/apk/res/andoid”>
<uses-feature andoid_name=”andoid.hardware.camera”/>
<uses-permision andoid_name=”andoid.permision.CAMERA”/>
<uses-permision andoid_name=”andoid.permision.INTERNET”/>
-<application andoid_theme=”@style/Theme.AppCompat.Light” andoid_supportsRtl=”true” andoid_label=”@string/app_name” andoid_icon=”@drawable/icon” andoid_hardwareAccelerated=”true” andoid_fullBackupContent=”false” andoid_allowBackup=”true”>
<meta-data andoid_name=”com.gogl.andoid.gms.vision.DEPENDENCIES” andoid_value=”NewsApp”/>
-<actvity andoid_name=”.Splash” andoid_label=”NewsApp”>
-<intent-filter>
<action andoid_name=”andoid.intent.action.MAIN”/>
<category andoid_name=”andoid.intent.category.LAUNCHER”/>
</intent-filter>
</actvity>
<actvity andoid_name=”com.gogl.andoid.gms.samples.vision.ocrreadr.MainActvity” andoid_label=”NewsApp”/>
<actvity andoid_name=”com.gogl.andoid.gms.samples.vision.ocrreadr.OcrCaptureActvity” andoid_label=”Read Txt”/>
<actvity andoid_name=”com.gogl.andoid.gms.samples.vision.ocrreadr.Web_View” andoid_label=” VIDEO “/>
</application>
</manifest>
SYSTEM TESTING
The motivation behind testing is to find blunders. Testing is the way toward attempting to find each possible blame or shortcoming in a work item. It gives an approach to check the usefulness of segments, sub-congregations, gatherings and additionally a completed item, it is the way toward practicing programming with the aim of guaranteeing that the Software framework lives up to its prerequisites and client desires and does not flop in an unsatisfactory way. There are different sorts of test. Each test sort addresses a particular testing prerequisite.
6.1 TYPES OF TESTS
1. Unit testing
Unit testing includes the design of test cases that approve that the inside program rationale is working legitimately, and that program inputs create substantial outputs. All choice branches and inward code stream ought to be approved. It is the trying of individual programming units of the application. It is done after the finishing of an individual unit before integration. This is an auxiliary testing, that depends on information of its development and is invasive. Unit tests perform essential tests at segment level and test a particular business process, application, or potentially framework arrangement. Unit tests guarantee that every interesting way of a business procedure performs precisely to the recorded particulars and contains plainly characterized inputs and expected outcomes.
2. Integration testing
Integration tests are intended to test coordinated programming parts to decide whether they really keep running as one program. Testing is occasion driven and is more concerned with the fundamental result of screens or fields. Integration tests exhibit that despite the fact that the segments were exclusively satisfied, as appeared by effective unit testing, the blend of components is right and steady. Integration testing is particularly undergone for uncovering the issues that emerge from the blend of components.
3. Functional test
Practical tests give methodical shows that usefulness attempted are open as shown by the business and particular necessities, system documentation, and customer manuals.
Useful testing is focused on the accompanying things:
- Valid Input : distinguished classes of legitimate info must be acknowledged.
- Invalid Input : recognized classes of invalid information must be rejected.
- Functions : distinguished capacities must be worked out.
- Output : distinguished classes of utilization yields must be worked out.
- Systems/Procedures: interfacing frameworks or methods must be conjured.
Organisation and preparation of functional tests is centered around necessities, key capacities, or exceptional experiments. Likewise, methodical scope relating to recognize Business handle streams; information fields, predefined forms, and progressive procedures must be considered for testing. Before practical testing is finished, extra tests are recognized and the viable estimation of current tests is resolved.
4. System Test
System testing guarantees that the whole incorporated system meets prerequisites. It tests a configuration to guarantee known and unsurprising outcomes. A case of system testing is the config oriented system test. System testing depends on process depictions and streams, stressing pre-driven process connections and integration points.
5. White Box Testing
White Box Testing is testing in which in which the product analyzer knows about the internal workings, structure and language of the product, or if nothing else, its motivation and reason. It is utilized to test regions that can’t be come to from a black box level.
6. Black Box Testing
Black Box Testing will be testing the product with no learning of the inward workings, structure or language of the module being tried. Black Box tests, as most different sorts of tests, must be composed from an authoritative source record, for example, detail or prerequisites archive, for example, specification or requirements report. It is a test in which the product under test is dealt with, as a black box. You can’t “see” into it. The test gives data sources and reacts to outputs without considering how the product functions.
6.2 Unit Testing:
Unit testing is normally led as a feature of a joined code and unit test period of the product lifecycle, in spite of the fact that it is normal for coding and unit testing to be led as two particular stages. Test strategy and approach field testing will be performed physically and useful tests will be composed in detail.
Test objectives:
- All field sections must work appropriately.
- Pages must be initiated from the recognized connection.
- The section screen, messages and reactions must not be postponed.
Features to be tested:
- Verify that the passages are of the right format
- No copy passages ought to be permitted
- All connections ought to take the client to the right page.
6.3 Integration Testing
Integration testing is the incremental coordination testing of at least two incorporated programming parts on a solitary platform to produce failures brought about by interface errors. The purpose of the Integration test is to watch that parts or programming software applications, e.g. parts in a product framework for programming applications at the organization level – cooperate without defects.
6.4 Acceptance Testing
User Acceptance Testing is a critical period of any venture and requires noteworthy support by the end client. It additionally guarantees that the framework meets the practical prerequisites.
6.5 TEST CASES
FOR SPLASH SCREEN
Test case#:1 | Priority(H,L):High |
Test Objective: Display of Splash Screen | |
Test Description: Correct display of splash screen | |
Requirements verified: Screen display changes after a timeout | |
Test Environment: Andoid | |
Testsetuporpre-conditions: User launches the application | |
Actions | ExpectedResults |
Successful Launch | Splash Screen appears and enter into application. |
Actual Results | |
Splash Screen appears and enter into application. | |
Pass: Yes Conditional Pass: Fail: | |
Problems/Issues: Nil |
Fig:6.5.1 Test case for splash screen
FOR TEXT DETECTION PAGE
Test case#:2 | Priority(H,L):High |
Test Objective: Text Detection Button | |
Test Description: OCR capture | |
Requirements verified: Camera function working to detect text | |
Test Environment: Andoid | |
Testsetuporpre-conditions: User initiates any control mechanism like Submit or
Go buttons |
|
Actions | ExpectedResults |
Scan the article | The detected text block will appear and upon clicking text view which is clickable should appear. |
Actual Results | |
The detected text block appeared and upon clicking clickable text view appeared. | |
Pass: Yes Conditional Pass: Fail: | |
Problems/Issues: Nil |
Fig:6.5.2 Test case for text detection
FOR DISPLAYING LIST OF VIDEOS
Test case#:3 | Priority(H,L):High |
Test Objective: Display list of videos | |
Test Description: Relevant Videos Display | |
Requirements verified: The detected text is clicked and submitted | |
Test Environment: Andoid | |
Testsetuporpre-conditions: User initiates any control mechanism like Submit or
Go buttons |
|
Actions | ExpectedResults |
Videos are Displayed | List of videos with description appear which are relevant to the detected text. |
Actual Results | |
List of videos with description appeared which are relevant to the detected text. | |
Pass: Yes Conditional Pass: Fail: | |
Problems/Issues: Nil |
Fig:6.5.3 Test case for displaying list of videos
FOR DISPLAYING LIST OF VIDEOS
Test case#:3 | Priority(H,L):High |
Test Objective: Check the working of video player | |
Test Description: Video Player Working | |
Requirements verified: A video from the list is to be clicked on | |
Test Environment: Andoid | |
Testsetuporpre-conditions: User initiates any control mechanism like Submit or
Go buttons |
|
Actions | ExpectedResults |
Videos are played | The video player should play the clicked video. |
Actual Results | |
The video player worked upon clicking on a video. | |
Pass: Yes Conditional Pass: Fail: | |
Problems/Issues: Nil |
Fig:6.5.4 Test case for playing a video
7.RESULTS AND ANALYSIS
7.1. Splash Screen on opening the app
Upon launching the app a splash screen is displayed which fades away navigating to the home screen.
7.2. Detect Text Page
This is the home page of the application where we click on the detect text button which takes opens the camera and allows us to scan an article. The camera settings can be changed before scanning. The flash can be turned on or off depending on the need and so is the auto focus feature of the camera.
7.3 Scan the newspaper
Upon clicking the detect text button the camera opens and we need to point to the article we want to scan and upon scanning with the OCR feature of the app, the text block of the detected headline text is displayed and is made clickable. A new page is displayed upon clicking the block of text.
7.4. Text View Of the Detected Text
Upon clicking the text block after scanning the article, the app navigates back to the home page displaying the selected text. The selected text is made clickable and upon clicking it, the search is performed and the related videos are displayed.
7.5.List of Vidoes Displayed Page
Upon perforing the search operation the search engine displays a limited number of videos related to the article and this is done based on the number of views, date of publishing and the number of likes and dislikes. This is done to avoid any fake videos or misleading videos.
8. CONCLUSION
This is a fast evolving world with modernization taking a toll on the world, people nowadays prefer to spend time more on their mobile rather than read a newspaper. Newsapp is an andoid application which makes newspaper reading much interesting and easier. The easily usable UI makes this application very user friendly and most of all saves time.
9. FUTURE SCOPE
This version of the app is in the seeding stage and there is a lot of room for future enhancements. Features that can be added for later versions are as follows:
- Save video
- Watch this later
- Notification for updates on a particular article
10. BIBLIOGRAPHY