
Hello, Habrasoobschestvo. Tonight, my first android app, HabraCitizen, was uploaded to the Play Market. The subject is a new habrachilku with many features and features. Asked for a convenient habra client for android devices? Meet :)
Features of the application (from the description in the market):
- Light and dark theme!
- Slide menu with the ability to customize the location (left or right);
- Swipe navigation!
- Authorization *;
- Authorized users can see the number of new comments to posts in the list of posts, as well as see new comments in the post (comments are highlighted in green) *;
- Ability to download posts for reading offline (with pictures!) *;
- pull-to-refresh technique for updating lists - to update comments or a list of posts, now just pull the list itself, and not press a button;
- Full-screen mode of reading posts and questions;
- Customizable font separately in the post and in the comments;
- Almost all possible sections of the site: the best posts (for the day, week, month, all the time), thematic and corporate (zahabrennye, new, otkhabrennye), questions, events, hubs, profiles of companies and users (with a list of published posts, questions, answers, etc.)
ribbon * favorites *;
- A full search on the resource - posts, questions, hubs, users, comments;
- Habrakat support
- View the full-size version of pictures by tap (with the possibility of resizing)!
- Running youtube-video in youtube application directly from posts and comments;
- The application does not "lose" the position when reading a post or comments when you rotate the screen, and is also able to restore a loaded post with comments or a list of posts even if the application was "killed" in the background
- The application is able to "catch" links leading to the domain habrahabr.ru and open the corresponding section automatically;
')
* - Authorization and download posts for reading offline are available in the full version of the application, which can be unlocked from the application. About this below.
Link to the application in the market:
play.google.com/store/apps/details?id=com.allesad.HabraCitizenInterested? I ask under the cat (carefully, a ton of pictures).
Prehistory
I have long been interested in the android platform and the market for android applications. For heating interest in January 2012, a smartphone was purchased on an android - Incredible S. There was an idea to take and write something like that. But, as usual, the availability of the device and the possibility of development did not generate the idea of ​​any application by themselves. Therefore, the development was postponed indefinitely, but in my free time I read the android literature and tried to set myself at least some objective goal.
At the same time I often read Habr a lot. And since I wanted to be able to read it not only sitting at the monitor, but also on the road from the phone, I climbed into the Android Market in search of a mobile client. What was my surprise when I found out that for the largest Russian-language IT resource of a sense there is not a single normal android application.
The customers in the store were buggy and had very limited functionality. Of these, only
HabReader stood out for the
better , which I decided to use. However, "stood out for the better" did not mean "was perfect." During use, I have accumulated a lot of complaints about work (please note that the author corrected many of the problems in the February update, but I started my development much earlier):
- The text in posts was not formatted to the width of the screen, adding a horizontal scroll;
- There was no dark theme;
- Comments were loaded separately and did not have a loading indicator (it was not clear whether they are loaded or not);
- Rotation of the device led to “dropping” the position of reading the post and comments;
- Search worked only by posts;
- An attempt to enter the "Events" section led to the launch of the application;
etc.
Thus, I had the idea to "finish" the application and upload the changes to the github into the project created by the author. So there was a specific goal.
Taking this opportunity, I want to convey to the author HabReader thank you so much for putting sorts on a githaba - if not for them, the development would be delayed indefinitely, because then I knew almost nothing about android and Java (all sorts of helloworld don't count). And since the available sources were the necessary foundation for me, and, downloading them, I began to study ...
Development
Directly development began only in January 2013 on the New Year holidays. Tired of drunkenness and rushing to idleness, I tried to think of what to do. And then I remembered the HabReader source code and my desire to dig deeper into them. I started by choosing IDE. And here it is worth making a small lyrical digression ...
small lyrical digression
The official Android guide from Google recommends Eclipse. The reasons are clear: gratuity, cross-platform, blah blah blah. “Okay,” I said, and set up Eclipse. Install ADT plugin and import project. “It's not so simple,” Eclipse happily reported and highlighted the whole project with blood-red. “Okay,” I said, recalling the legend of the incorrectly imported R being passed down from generation to generation, and, with the words “Stackoverflow to the rescue!”, Drove a request to Google. “OVER9000 results,” Google said in response. The 1st link didn’t help, the second one didn’t help, nth! - did not help! I optimized the imorts, re-imported the project, restarted Eclipse, rebooted the computer, rearranged the android-SDK and the ADT plugin - the butter and butter were the answer. Yes, I know what should have helped, but for some reason it did not help. New project? No problems. Import? Horseradish. New project with copy-paste files from existing project? Horseradish. Moreover, when I created the layout XML file and tried to edit it in text mode, Eclipse did something terrible - distorted the entire xml completely. The closing tags were higher than the opening ones, the color of the code flew to hell, an attempt to put the cursor in any place or select text led to a new combination of this mosaic. Restarting Eclips did not help. So much so that I had to open the xml file in a regular notepad and edit it there. “Damn you, damn it!” I said in anger after that, and I decided not to use this cunning IDE.
However, writing the code in a notebook and compiling it through the console did not smile at me, so I turned my attention to the IDE, which I had long wanted to try - Intellij IDEA.
By that time, IDEA had just acquired a layout editor and a dark theme. I installed Community Edition, I started it, I tried a little trying to import the project ... And then I began to see it clearly. After Eclips, it was just an IDE dream! The speed of work, really smart code-assist, user-friendly interface, bug-free, excellent refactoring ... My impressions of work in many ways can be described in one phrase: “Wow! Here and so you can? ". While I was driving home after work, I just itched my hands to sit down and just do something just to do it in IDEA. Isn't that the ideal IDE? A tool that does not have to be fought, and that really helps and speeds up work just at times. You can think of it as PR or advertising, somehow, but if it were not for the guys from JetBrains and their offspring, I would hardly have studied the android platform in such a time frame (as far as I could), and it’s unlikely you would read this post (maybe through the application;). Rays of good to them!So, choosing IDE, I started coding. I had to code only at night after work, starting at one in the morning when I came home (this is my floating schedule) and ending at 6-7 in the morning. On weekends, I just broke off, and, sober after Friday, I spent 15-16 hours in a row. It was all on the shock and powerful wave of enthusiasm that feeds better than any Red Bull, and I was thrilled. There was a goal, there was a canceled and clever IDE - the work was in full swing. Gradually, I realized that the list of features that I would like to implement, is quite a pull on a separate application, because the code has been rewritten almost completely. From this point on, development was carried out as the development of a separate project. Ideas for implementation and ideas for implementation were born one after another, but fatigue "nakasivala" and at some point I realized that it was time to stop. The ideal is unattainable and attempts to get closer to its radiance could easily lead to “burns” in the form of a hulking monster stuffed with glitches and bugs instead of an application.
Slamming myself on the arm that was trying to implement the next “mega-idea”, I began to polish my project, catch bugs and make round eyes at the sight of a fatal excursion with a wonderful stack-trace when testing with another device and another OS version. Oh, this android-zoo, O menagerie! Do nothing - you have to put up.
For a while, catching bugs, reading documentation on publishing applications, setting up an account and setting up a developer account, taking screenshots and here it is - the result. Phew
Below I would like to tell in more detail about the features and capabilities of the application.
Feature Overview
Dark and light theme
Yes! What was asked for a long time in comments and responses to other mobile habr-clients (and I regularly patrolled these responses).


Slide menu
Fashionable and very convenient menu on the swipe from the edge of the screen (in the settings you can specify the location - on the right or left):

Swipe Navigation
Another thing that was asked a lot. Now you can navigate between the list of posts, between the post and comments to it, between tabs in the company profile, a habra user, in hubs, you can simply swipe.




Pull-to-refresh
Technology pull-to-refresh (as in the application Vkontakte or pulse) to update the lists of posts, comments, questions, events, etc.


Authorization
Authorization is possible with the help of the usual habr-login or through the linked accounts of social networks (I, for example, go through G +, so as not to enter the captcha). Authorization gives access to the tape (posts, questions, events), favorites (posts, questions, comments), and also allows you to see the number of new comments to the post in the comment count (+ green dial), as well as see these most added comments in comments list (new comments are highlighted in green). You can remove the highlighting from the commentary by tap on it.




Almost all sections of the site are available.
Posts (best, thematic, corporate), questions (incoming, hot, unanswered), events (upcoming, current, past), tape (posts, questions, events), favorites (posts, questions, comments), hubs with specialized posts , questions and events, company profiles with blogs, questions / answers, events, subscribers, users profiles with blogs, questions, answers, comments, subscribers - all in one application.












Offline reading
And one more feature, about which very many people asked - saving posts locally on the device to read them, say, in the subway on the way to work. The application can save both posts and questions (all together with comments), however, posts can be downloaded in the "immediately pack" mode. You can specify a section - tape (for authorized), thematic, best, corporate, as well as the number of posts to upload (for the section "new" or "best for the day" you can download everything at once). This part is similar to the
lHabr iOS application. After clicking the “Download” button, the application will first collect information about URLs from which you need to download data, then add a new notification to the status bar with download progress (progress, unfortunately, is available only for Android 4+, in older versions you can add it is not in the notification). First, data is downloaded from the Internet, then saved on the device. After saving, the process of caching images is initiated, so reading posts and comments offline will be much more fun :) Just do not turn off the Internet immediately after saving posts (especially if you downloaded a lot at once).




Fullscreen reading
Now, no headers and tabs will interfere with your reading. To return to normal mode, tap the text in the post. Auto-opening in full screen mode can be set in the settings.


Setting the font in the post and comments
The font in the post and comments can now be configured separately - the result will be visible immediately. Settings are automatically saved for posts and questions - there is no need to set them every time.




Search as online
The result of a search query takes all the data provided by the search on the site - in posts, questions, hubs, user nicknames and comments.

Enlarging pictures and launching video
And again the feature often mentioned in requests. Now the pictures in the posts can be viewed in the full-size version - just tap on the picture. Full size version can be resized.


I had to suffer from the video - the launch of the video inside the WebView component, which is used for rendering web pages, is very heavy, inconvenient and buggy. The video did not start, then there was no sound, then there was sound, but instead of a picture there was a black screen, then when I tried to watch the video on the entire screen, the video was cut down ... I spat on this case and decided to run the video in the native player. 90-95% of the video on Habré is from YouTube. Youtube application is also available on almost all Android smartphones. Therefore, I acted as follows - parsil on loading the HTML-code of the page, cut out the iframe with the youtube-video, constructed the correct URL and inserted the div instead of the frame with a link and a picture. A tap on the picture in the youtube player opens youtube video. It seems convenient.


A bunch of nice little things
Shutdown habrakat


The ability to immediately open the post in the browser (from the list or from the "reading" of the post)


The name of the author of the post is highlighted in red in the comments (it is convenient - no need to remember the name or constantly watch it :))

Posts as well as on the site are marked with flags (translation, tutorial, from sandbox, recovery). Moreover, for fans of reading articles and translations in the original, I added a special item in the context menu - you can immediately open the source ;-)


The application is extremely tenacious and does not change its state, even if it was “killed” in the background :) This means that reading your post or comments will continue from the same place where it was interrupted. Lists of posts, questions, events, etc. will also be automatically restored. Also, the application is not afraid of turning the screen and does not lose the reading position at the same time :)
Such here came a squiggle.
Regarding monetization
If you remember, at first the application was planned as finishing the existing HabReader, which means it is completely free. Subsequently, I moved from the idea of ​​"finishing" to the idea of ​​"zapilivaniya" something of his own, still free. However, as time went on, the application grew along with fatigue and I began to think about the possibilities of monetization to increase, so to speak, motivation. It was of no less interest to me to study the Androids payment system, because for me everything in the platform was new. At first there was a crazy idea to make “unobtrusive” advertising, but the idea was rather quickly executed with extreme cruelty, because I myself cannot stand advertising in applications. I didn’t want to do the application by any means. And therefore there was only one way - the division of functionality into paid and free.
Total: in the free basic version, it is possible to read all sections of the habr (except, of course, tapes), but authorization and offline download are available through the activation of the full version from the application. However, for authorized users, I plan many further improvements:
- Writing comments to posts;
- Add posts and comments to favorites;
- Ability to vote for posts and comments;
so don't blame me for my shameless greed :)
Total
The application is ready, laid out for all to see. I, in turn, are ready for a stream of criticism and feedback (I hope it will be). Use, write reviews, thank you all for your attention. Enjoy!
Special thanks
Colleague
dj_raphael - for the help in testing;
Colleague
lilislilit - for an invite to Habr on his birthday;
NOSTRA
Habrayuzer - for the wonderful Universal-Image-Loader library for asynchronous loading of pictures;