📜 ⬆️ ⬇️

Android application development on the example of Calculator ++. From idea to implementation




Idea


I, as a former student and now an engineer, often carry out any calculations on the fly: whether it is the calculation of the cost of goods per kg, the value of the effective annual interest on a loan or the scheduling of votes in elections.

After a few minutes of searching in the android.market (which simply swells from the programs presented on it), a dozen of the most popular calculators were installed. But the joy was not complete ... I did not like everything, everything was not convenient: where the design failed, where the input method was, where there were constant drops. Here the idea was born: why not write your calculator - I know java well. Suppose that the android did not work - but I’m gaining experience and pumping skills, and I’ll get a good tool.
')

Analysis


In more detail I will stop on the analysis of several applications on an android.market:

1. RealCalc Scientific Calculator ( anroid. Market )

The first on the list is RealCalc - a classic calculator with the number of installations 5-10 million. Average rating: 4.7.

Pros:
  1. Support site is good - there are both help and changes and FAQ
  2. Habitual design (everything is purely subjective here - I don't like it)


Obvious * (* in my opinion) shortcomings :
  1. Inability to enter expressions
  2. Poor design (I'll mention this at the end of the chapter)
  3. Scanty set of built-in functions
  4. Impossibility to build graphs
  5. Be sure to use the multiplication sign * (instead of 5sin (2PI) you need to write 5 * sin (2 * PI))


2. Cube Calculator Free ( android. Market )

The number of installations: 100-500 thousand. Average rating: 4.8

Pros:
  1. More thoughtful design (compared to RealCalc)
  2. Expressions calculation
  3. Calculation history
  4. Calculation of expressions "on the fly" (no need to press the '=' button)


Cons (some of them are one-to-one as in RealCalc):
  1. The functionality is divided into two screens and you need to constantly switch between them.
  2. Scanty set of built-in functions
  3. Impossibility to build graphs
  4. Be sure to use the multiplication sign * (instead of 5sin (2PI) you need to write 5 * sin (2 * PI))


3. Handy Calc ( Android Market )

The number of installations: 0.5 - 1 million. Average rating: 4.7

Pros:
  1. Powerful functionality (graphing, solving equations, etc.)
  2. Work with documents (saving, loading)


Minuses:
  1. Unclear interface - 2 screens, each with its own button = (perform different functions)
  2. In order to get to the screen of additional functions - you need to perform 3 steps (call up the application menu, select 'Tools', select 'Functions' in the menu that appears)


The overall result:
All the applications discussed above have one major drawback - they have a poorly crafted interface : somewhere it is not clear what to click, somewhere you need to switch between screens, somewhere to access the functionality you need to go through a sequence of actions, and somewhere on the screen does not fit the entire result of the calculations.

Having understood this simple truth, I decided that the main difference of my application would be exactly the thoughtful interface. At the end of the article I will give examples of what I was able to achieve.

Development


I started developing the application back in June 2011 in my free time. JSCL was selected as the calculation engine; GUI elements are mostly written by me, some are borrowed from the Internet; The graphing library is AChartEngine (although not perfect and has some rather strange solutions). It is probably worth adding here that even though I chose a third-party library for computing, I soon had to fork it and fix bugs / add the necessary functionality (by the way, it is now available on my github).

In general, there was a lot of fun, a lot of experience was gained, more than one cup of aromatic coffee was drunk and more than one night was spent in front of the computer.

Now the project is in the active phase - the functionality continues to be added, almost every week there are updates with new features, bugs are fixed.

At the time of writing, the total number of java classes in the project is 680 (including the inner classes), of which 222 are mostly the android module ( source ), 276 are in the module JSCL ( source ), 182 are in the general module ( source ).

Release


At some point in time, I realized that the application is already ready for release to the masses. And after testing on devices of colleagues and acquaintances Calculator ++ appeared in the android.market.
It was on October 16th.

What happened?




As I wrote above, the main feature of the Calculator ++ (hereinafter K ++) was a thoughtful interface.

I will list the points which features were added to the application to achieve this goal:
  1. In addition to pressing, each K ++ button can also handle the so-called “swipe”, i.e. the movement of a finger in some direction from its center (at the moment, the swipe is supported up and down, but in the next release I will add a direction to the right). What are the benefits of such a decision? First of all, thanks to this, it was possible to fit a very large number of actions on one screen - from managing history (see the “M” key) to simply entering additional functions and operators (sin (), cos (),%, etc.) ). This immediately solved the problem of multiple screens and switching between them.
  2. Syntax highlighting - none of the above calculators used a simple way to highlight mathematical terms - text formatting: in K ++, each nesting level is highlighted in darker color, the function is italicized, and a variable or constant is bold.
  3. Automatic formatting of numbers: 1 000 000.00 or 1'000'000.00.
  4. If the result does not fit into the output window, then its size is automatically reduced to the suitable one (fit screen, in other words).
  5. For frequent operations with the buffer (copy / paste), separate keys are highlighted.
  6. The output window has additional functionality - if an error occurred during the calculation, then by clicking on it, a window pops up with information about the error; if the result is a function of one variable, then a menu pops up with a choice of additional actions: plot / copy; in other cases, the result will simply be copied to the buffer.
  7. A simple and rarely used thing is the product of calculations without pressing the = button.
  8. When entering a function - positioning the cursor inside the parentheses.
  9. Support for landscape and portrait modes.



As you can see, there are quite a few simple things on the list. Together, they strongly influence the user interaction with the application, giving the first one the pleasure of working, without interfering with performing the necessary operations quickly and efficiently.

In addition to the interface, Calculator ++ has a number of functional advantages:
  1. A huge number of functions (trigonometric, hyperbolic, comparison functions, etc.).
  2. Symbolic integration (∫), differentiation (∂), summation (Σ), product ().
  3. Plotting.
  4. Calculations in the space of complex numbers.
  5. The ability to save your own variables (alas, I haven’t gotten to functions yet).
  6. The possibility of "lowering" the sign to multiply.
  7. Calculations with interest.
  8. Calculations in different number systems and different angular units (degrees, radians).


Promotion


Today it’s not enough to have a good app. Therefore, I spent some time on his promotion.
The following are key points in K ++ promotion:
  1. Laying out the application on w3bsit3-dns.com (in addition to simply increasing the number of installations, I received invaluable feedback from users of this glorious resource, for which, by the way, thanks to them).
  2. Overview of the application in the droider chart. Again, thanks to the creators of this wonderful review. For Kosh separate respect =).
  3. Translation into foreign languages: the application initially supported only English and Russian languages ​​of the interface, but thanks to the voluntary efforts of Gabriele Ravanetti and Jordi Luna, Italian and Spanish, respectively, were added. Many thanks to them for this!
  4. Topics on other forums dedicated to android devices + reddit.com.


App Installation Schedule:


Where
  1. Display application on w3bsit3-dns.com
  2. Droider Review
  3. Translation of the application into Italian


Note: Spanish will only appear with the next version.

In this chapter, I also note my surprise to the fact that for each country it is necessary to promote the application separately (it was a discovery for me that when I came to Europe and entered the android market from a local computer, I did not find Calculator ++ even in the first 500 new applications ). Of course, this is good for highly localized applications (schedules, translators, etc.), but for general purpose applications it is a kind of barrier.

What's next?


And then only one thing - the continuation of development; Improving and finishing the application, licking its code for even more convenient end-user work.
I believe that Calculator ++ is a worthy competitor in the market of calculators in the android.market, and I do not regret the beginning of its development.

For questions, comments, suggestions - related and unrelated to C ++ - contact in person or by mail, write comments. Be sure to answer =)

Thanks for attention!

References:
  1. Calculator ++ on android.market
  2. Github source code


UPD Thank you all for your comments, mistakes, suggestions and comments.
UPD 2 At the request of readers added QR-code
UPD 3 On github'e there is a small issue tracker . If it is not difficult, enter there bugs, desired features, etc., it will be easier for me to contact you + no request will be missed.

Source: https://habr.com/ru/post/134412/


All Articles