📜 ⬆️ ⬇️

Android to the State Duma will bring or mobilization of civic consciousness



As Habr's regulars probably know, I am interested in books about politics . And I am interested in programming, especially on those platforms on which I have not previously programmed - almost like about the mountains at Vysotsky. Coincidentally, at that time, when I began to study Android, it turned out that on the nose - the elections to the State Duma - the very state body that passes those wonderful laws that we all read and heard about. To combine business with pleasure, I decided to write a simple program for Android that builds their rating based on the voting statistics of party factions, taking into account the user's opinion: if the user does not approve of the law, and almost the entire party faction voted for this law, then the party is not fits, and choose it in the next convocation of the State Duma is not worth it. Initially, these were only sluggish ideas, but then I came across an article , and I was finally convinced that such a program would be useful not only for my self-education.

For a start, I looked at whether there are similar applications in more politically developed countries. There were very few of these, literally units, for example . All of them were more like aggregators of near-political news. The rest, found on Google Play for the word “politics”, was either a game like a political simulator, or electronic books having this word in the title. Thus, there was no one to learn from.
')
Next, I started getting data on the vote. Oddly enough, it turned out that they should be searched on the website of the State Duma. The data format on the results page turned out to be quite simple, only the vote “For” was somehow indicated by the constant “-1” - which is suggestive about what the State Duma thinks about its “Za”.

In a hurry, site scraper was written - a program that automatically reads the data from the site, walking along it as a regular user, and launched it the same evening. The data was downloaded all night, I don’t know what the administrators of the State Duma server thought. After that, there were several .csv-files, the most voluminous of which occupied 89Mb on the disk - it contained the votes of the deputies, according to all the polls held in the State Duma of this convocation, there were several tens of thousands.

It was necessary to thin them out - select only the most significant votes and laws. I had to do it manually, automation here will not help. As a result, I chose the 19 most resonant bills adopted by the State Duma, and the voting results of the reading of the bill, where it was finally adopted. All of this was added to the Sqlite database tables. Only after that I learned that the State Duma has its own API, which I could use without downloading data in such a bicycle-barbaric way, but it was too late.

After creating the tabbed interface project in Android Studio, I started writing the application itself. I’ll omit the details of the twists and turns with Android, Java, terribly inhibitory Gradle and Android Studio, encoded in SQLite, and with a ListFragment that stubbornly hid the last line of the scrollable list under the navigation bar, although I set the appbar_scrolling_view_behavior sign. The main thing is that after 5 days the application was ready. Here are a couple of screenshots of its screens (there are 3 of them all):



image

Now the application had to be put somewhere. The well-known Google Play for registration of a developer account asks for $ 15. I didn’t really want to spend this amount, and I decided to post the application in the Amazon App Store - it places Android applications for free, although in order to post an application, you will have to sweat considerably over input forms that you have to fill in and for some reason don’t Russian language in the list of localization choices.

The result was a small, maybe a bit boring, but still pretty application “Robogist 2016”, which, I hope, will soon appear in the Amazon App Store when it is moderated. For the most impatient - I posted .apk here .

And as an afterword to the article, I will quote a part of the text from the “About the Program” window: “The author of the program did not invest in it any attachment to any of the parties, and set as its goal not agitation, but to attract the attention of the IT community and all other Russian citizens for the upcoming elections to the Duma. "

»Application repository here
»The downloaded voting data is posted here.

And yes, if someone has the opportunity to put the application on Google Play - I do not mind.

UPD Application posted in Amazon Appstore: www.amazon.com/s/ref=nb_sb_ss_i_2_5?url=search-alias%3Dmobile-apps&field-keywords=%D1%80%D0Be%D0%B1%D0%BE%D0% B8% D0% B7% D0% B1% D0% B8% D1% 80% D0% B0% D1% 82% D0% B5% D0% BB% D1% 8C-2016 & sprefix =% D1% 80% D0% BE% D0 % B1% D0% BE% D0% B8% 2Cmobile-apps% 2C267

He was away, only returned, corrected errors in the links, and uploaded the corrected MaxF version on the Amazon Appstore, although, of course, it is no longer so relevant.

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


All Articles