Hola, you can f1nd F1nd here,

F1nd originally was born when myself and some of my roommates had trouble switching between the apps to F1nd the meaning of words in the article we read / wiki’s we skimmed and news feeds we scrolled. There were plenty of apps in the play store that could F1nd the meaning in the same window but I decided to make one in my leisure time. I did a crude version of the app which would popup the meaning on copying a word , needed you should run my app in the background. The app would just listen to the clipboard changes and would get the meaning of the word from the database, which made it completely offline. The initial data-set was so restricted it didn’t have much of the day2day words in it, more on it later. As time progressed I was in a stage to release the app on the play store from my friend’s developer account.

A sudden spark ignited , copying a single word was not feasible in many modern day apps such as Whatsapp / Facebook / Twitter,

so that kept me thinking on for hours and I was randomly going through the repos of my app for college symposium where we have used a pie chart library to display the events / workshops, so i thought of taking the same chart concept and making into a parser pie cart and thus by selecting any one of the pie(which would contain a word) the meaning of the word would popup. For eg:

Copy a tweet and the pie chart would separate the words in individual pies.

One can actually cycle back / forward through the copied words, at any point of time, there would be 8 or less words in a pie chart. Once the current pie has the user desired word among the 8 pies, user can click on the word and know the meaning that would popup.

The parser wheel color are designed different shades of single VIBGYOR color. The colors come from an random function.
This kind of parser wheel for sentence is first of its kind in the android market, so I wanted to describe it first on my parithabangal :-)

The blog will be of the following order,

  1. Explaining the features of F1nd
  2. Basics of the android app structure — in development
  3. Building F1nd

Features of F1nd :

Features of F1nd

F1nd is broadly categorised into three main features,

  1. It acts as a normal dictionary where you can search for words, the meanings displayed will have examples too. One can make list of favorite words and can view later. F1nd also lists the history of words you searched & found.
F1nd — Favorites

2. One can start the F1nd service that would run in the background and can know meaning of any word just by copying it. If the copied is a sentence, then the parser would popup asking to choose a word and the meaning will be popped up on choosing word, in popup. The popup also allows users to search for words, without switching to the main F1nd app, just touch outside to close the popup parser / meaning. Btw, you can favorite your words from favorite too & these word searches are also logged in history 😉 , so beware.

F1nd-Popup meaning with search

3. This is my favorite feature and I kind of designed it for my own purpose and it turned out to be very useful for me for the past one week for Learning a Word, yeah & that’s what i call it “LaW” or Learn a Word.

First of all you need to set a time interval for this feature to be enabled, by default it would have been set to 5minutes. On starting F1nd from settings page after setting the time interval,

User will get a new word every ‘n’-minutes*, in the notification. Don’t worry if you have missed out the notification, we have cat(c)hed it under the LaW tab in the app so that you learn a word .

*= n is the time you have set.

F2nd-Learn a Word feature

Note

One can actually select a word to know the meaning in two ways,

  1. If you are using Android 6.0+ i.e Marshmallow or higher versions, you can just select a word and click on the three icons at the end to see F1nd option, pressing it would popup the meaning.
F1nd-popup by selecting

2. If you want to know meaning of a word in a sentence or using lower versions of Android then you may need to copy the sentence which would popup the parser or the meaning.

F1nd-popup by copying

3. There are also pretty cool features such as, long pressing on a word to get the meaning on a popup, acting as a quickview. One can also favorite a word by clicking on ❤️icon to the right of the word or to bottom right in the meaning. There is also history of searched words in the home, which can be removed by double tapping on the word.

Basics of android app :

Disclaimer : This would be a very lame version of basics 101, I would do yet still basic tutorial on further stories 😉 Brb

Android apps can be created in various ways such as native — using Android studio, hybrid methods-make cross platform apps, convert a webpage into mobile app. We will be concentrating on the native method. I completely built the app using android studio. The below is the android structure,

Android project structure

Android is a mixture of Java & XML, where the former is used for backend and the latter is used for UI designs. All the sub tress shown above will have files coded in any one of the above language. I’ll explain the structure one by one.

  1. The manifest file is one where the detail of the app such as activities, icons for our app and especially the permissions needed by the app such as accessing internet(F1nd is offline 😉) , using camera, etc. The permission requirements should be defined here or else the functionalities would not work as expected.
  2. The java folder contains all the java classes under one hood.
  3. The res folder contains the layout files which will make up the UI, the images, icons used inside the app, and raw files such as predefined databases, audio files are put under raw folder
  4. The gradle would be containing the settings , such as the min-sdk the app should run on and so on and so forth.
  5. Android uses Sqlite, a relational database.
Every android app would be having an activity which is combination of a layout file & java to do the backend work
  1. The UI can be dragged and dropped or coded via XML, it has elements such as TextView for rendering text, EditText for getting user input, Buttons, Calendars, etc, etc.
  2. The Java is where the UI elements are attached dynamic properties and the listeners are added.

Android is basically divided into four main components,

  1. Activity — This is where we have all the UI elements & is a combination of an XML and Java.
  2. Services — This will be running in the background and will be handling all the background activities like handling network calls, in our case our background service will be listening to the clipboard changes and will popup the meaning on copying a word / if sentence it would popup the parser.
  3. Broadcast listener — These are similar to Action servlets that handle call backs on a struts framework and will behave accordingly. They can also be used to respond to system calls, such as you can say your app to automatically start when the phone reboots.
  4. Fragments — Fragments are Android’s solution to creating reusable user interfaces. You can achieve some of the same things using activities and layouts (for example by using includes). However; fragments are wired in to the Android API, from HoneyComb, and up

Making F1nd :

I’ll explain in the detail about designing F1nd from basic home page to LaW & parser too. So keep scrolling down,

F1nd was built in two different parts,

  1. The main app
  2. Popup services — LaW & Popup meaning + parser

Building F1nd main app:

F1nd is build like Instagram app, having the bottom navigation bar for easy & quick accessibility. It has 5 bottom tabs such as,

  1. Home — For searching words like normal dictionary & displaying the history of searches, double tap to remove from history.
  2. Favorites — For making a collection of favorite words, click on ❤️ again to remove from the list.
  3. LaW — Incase if you have missed any word from notification from LaW, you can catch it here, this is sorted in Last In First order.
  4. Settings — This page is used to start the services that would listen to clipboard changes & you can make set time for LaW here.
  5. Help — This is kind of a help activity where a tutorial is given for the user, for this a predefined library is used. Below is the UI of the mentioned,
F1nd — Home
F1nd-Favorites
F1nd-LaW

I have choose to go with the fragments, on changing the tabs form the bottom navigation bar, a fragment corresponding to one of above would be loaded into the list view of the main activity.

I will explain one of Home / Favorites / LaW as they are similar.We will go with home. This is how the structure(UI) of main activity will be,

activity_main

The activity_main would have a Frame layout which would insert dynamically from fragments such as home / fav / LaW / Settings & Help is a separate activity. The bottom navigation bar is fixed to the bottom of the screen and only the contents of the frame layout keeps changing. Below are the individual setup of home, fav & Law fragments separately,

F1nd — Home
F1nd — LaW
The above fragments contain list views, which would be populated with custom adapters. The items in the list are words which would have the following structure,
F1nd — Single word view

The single word view is an xml which contains the following vlaues,

  1. The word
  2. Word type — noun/verb/
  3. Heart — Heart would be filled if the word is liked by the user or would be gray.

We would use this single word view and populate the entire list with the words got from the database.

Once a bottom tab is pressed, the java class attached with the fragment would be called, which would query the database with the help of databaseHandler-db helper class.

There are 2 main concepts to be discussed here,

  1. Custom adapter
  2. Bean class

Our list view would contain a custom defined items, i.e the word view discussed above and the list would be populated with the data from the database. Custom adapter is our own defined adapter, we need an adapter to be set to the list view and our word is one such.

We would have our own adapter class extending the ArrayAdapter inside which we have database transactions. We will also have a bean class that acts as a getter / setter containing the word, word type, meaning for quick view and favorite state as variables in it. This would be common for all the items in the list view.

We have four tables,

  1. Main table with words , type, meaning & examples
  2. Favorites mapping
  3. LaW mapping
  4. History mapping

All the database transactions occurs with the help of the dbHelper class. Below is the schema of the main table,

F1nd-Main table schema + values
You can find the database here, the best and feasible option was to ship the database with the apk, as the online API would need network access, and creating the database on first run would be time and memory intensive. So i would ship the sqlite database with the app & on the first run, the app would copy this db to app folder and all the links from the dbHandler class would be to this location. You can F1nd this db under /Android/F1nd_package/data
F1nd-History mapping

We have a time column which would be used to query by latest first.

We would actually be joining two or three tables for getting all the info,

Home — dict + favorites_mapping + history_mapping
Favorites — dict +favorites_mapping
LaW — dict + favorites_mapping + wod_mapping

The other minor details such as interval for LaW are stored in the shared preferences.

The similar kind is used to show the meaning,

F1nd- Meaning view

Building popup— LaW & Popup meaning + parser :

LaW & popup are separated as two services,

clipboardService
bgService

Clipboard service will be running in the background which will be continuously listening to your clipboard.

Parser activity & meaning view are 2 dialog activities which would have half the height of your phone & 3/4th the width.

On enabling the Law, the app would register an alarm for your specified time and there would be a broadcast listener class that would be listening to the alarm and the core logic in the BC listener would put that word in the database and would make a notification.

LaW flow
Android 6.0+ has a feature called process text which would allow one to use the selected text and process with it, this is the core logic behind the select to F1nd.

The parser & popup were explained earlier itself, & if you have come this far, here is a cookie 😉

F1nd

Until next parithaabangal,

F1nd- Goodbye

Copy. Select. Search. F1nd. Share 😃