📜 ⬆️ ⬇️

Metro.Prosto scheme


Week on Habré are raging passions on the Yandex.Metro program. I did not turn it on for a long time, I decided to look again. And suddenly I caught myself thinking that the application annoys me.

I do not argue, this is an excellent application for couriers, guests and a certain category of passengers who are comfortable with automatic location determination, station search, calculation of travel time, etc.
But native Muscovites who travel their entire adult life by metro from their sleeping areas to work, to visit, to a date and football, know about the location of the stations and use the scheme only to refresh the memory and to clarify where it is better to change. Everything!
What happens with Yandex. Metro. I launch the application and first of all it starts looking for updates. What for? Like the metro station does not open every hour, why such a rush. Okay, a couple of seconds has passed. Next, run the program. One careless touch of a finger and some buttons appear on the screen: Show on map (???), Station name, From here, Here. Reminds behavior of some sites, hung with ads and pop-up windows. In this case, it turns out, they are still sending something to their servers, taking resources from my device.

Realizing that I use 1% of all the functionality of a good application, I came across a few comments from geeks who just took a picture and used it. I remembered that before the appearance of Yandex.Metro, and maybe even earlier, on Windows Mobile 5.0, I did the same. I was not satisfied with only one detail - I didn’t want to look for the metro scheme in the Gallery among the many pictures.
And then I decided to write my simple program with the straightforward name Metro. Just a scheme for Android. The funny thing is, I didn't even have to write code for it. Copy paste. It took about 30 minutes from creating a project to placing an application on Google Play.
I took the subway map and logo in vector on the A.Lebedev Studio website. About the scheme there it is clearly written - take it and use it. I did not find the terms of use for the logo. I wrote it personally to Artemy, since he doesn’t hide his email. Fifteen minutes later I received an answer - you can.
Convert vector images to PNG. On the site Android Asset Studio created icons. Launched the project and placed the icons in the right subfolders. Next, I chose a topic without a title to increase the usable space.
To place pictures on Android, the ImageView component is used. But out of the box, he does not support scaling and processing gestures. But at one time I saved a bookmark link to the TouchImageView library. Yesterday, looking through my bookmarks, I saw a forgotten link and thought that I should study it. Today I decided to check if it would fit my application. The library was too loud. It is enough to copy the class that extends ImageView , and paste it into your project.
Place the component in the markup
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity"> <ru.alexanderklimov.metrosimpeschema.TouchImageView android:id="@+id/imageViewSchema" android:src="@drawable/moscow_metro" android:layout_width="match_parent" android:layout_height="match_parent" /> </FrameLayout> 

Everything! Run the program and admire. The component out of the box supports two-finger taping, double tap and movement of the image under the finger. All the same as Yandex. Maps.
I checked on an old Samsung S2, then on a tablet and a new phone. It suits me completely. The screenshots squeezed a lot to save, so they are a bit nondescript.




If someone needs, the address on Google Play is Metro . Just a scheme .
')
I don’t give the source code; any programmer will be able to reproduce my actions independently.

Upd. Habr does not allow to write two articles in a row under the heading "I am promoting". Therefore, the continuation had to be published in his blog.
Metro.Moskva.Chast second

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


All Articles