📜 ⬆️ ⬇️

We sculpt a snowman (decorate the application)

Good news. New Years is soon.
And, you want - you do not want, but you need to create a New Year's mood for users.

image

Freeloaders designers / illustrators - they have long nailed a snowflake / cap / twig to the logo and ran to buy gifts with a clear conscience. Well, we, stupid programmers - do not know the easy way.

First, I certainly decided to make snow. Many years ago I also made snow for my first site. Apparently such a tradition.
I downloaded Nine Old Androids (backport animations from the third anroid) , launched Droid Flakes:

')
I remember Max Payne because of the snow. Very atmospheric there was snow. You sit and you stick.

image

What do you think, how many snowflakes are in the picture above? Thousand? So here. I seem to be the most powerful smartphone in the store. And he podlagivaet already 256 objects. Which are not even along a sinusoid — closer — further — right-left — turn, but stupidly in a downward fly. No, we do not need such snow. It is not snow at all, it’s some kind of falling robots. You can probably optimize, but the time is running out.

image
Several hours were killed searching for a beautiful, free New Year font with Cyrillic support. I guess I was not looking there.

I have already decided to surrender and whine on Skype to familiar designers with the request to nail a sprig to the logo, when suddenly it dawned on me -

Preloader! Preloader is unobtrusive. Its easy to do. It does not slow down, does not eat resources, and in general - nyashechka.

So, a simple recipe for how to make a snowman for the New Year's table in half an hour:

1. Select the preloader.
- I chose here: preloaders.net
2. Customize for yourself
- set the size
- background color
- number of frames
screen , for just intelligent
3. Click - Download as sprites (immediately re-name the file with letters like snowman)
4. Open in Photoshop
- we set guides
for (int i = 0; i <Frames.length (); i ++) {
- View / New Guide
- guide.setValue (i * frame.getWidth);
}
(well, in the sense that I don’t know if there is any scripting language in Photoshop or how to use it. As a result, I clicked the mouse 12 times like a moron. Do not worry, this is the most difficult part)
- Select the Slice tool (I have it hidden in the right click on the crop icon)
- Button - Slice from guides (unexpectedly appeared at the top)
- File / save for web and devices
5. Copy / paste icons to the drawable folder
6. Open Idea
- right click on the folder Drawable, New / Drawable resource file - loader.xml
- paste the text:

<?xml version="1.0" encoding="utf-8"?> <animation-list xmlns:android="http://schemas.android.com/apk/res/android" android:oneshot="false"> <item android:drawable="@drawable/snowman_01" android:duration="60"/> <item android:drawable="@drawable/snowman_02" android:duration="60"/> <item android:drawable="@drawable/snowman_03" android:duration="60"/> <item android:drawable="@drawable/snowman_04" android:duration="60"/> <item android:drawable="@drawable/snowman_05" android:duration="60"/> <item android:drawable="@drawable/snowman_06" android:duration="60"/> <item android:drawable="@drawable/snowman_07" android:duration="60"/> <item android:drawable="@drawable/snowman_08" android:duration="60"/> <item android:drawable="@drawable/snowman_09" android:duration="60"/> <item android:drawable="@drawable/snowman_10" android:duration="60"/> <item android:drawable="@drawable/snowman_11" android:duration="60"/> <item android:drawable="@drawable/snowman_12" android:duration="60"/> </animation-list> 


- open our layout and add a new, brilliant progress bar
 <ImageView android:id="@+id/progressBar" android:layout_width="35dp" android:layout_height="35dp" android:layout_toRightOf="@+id/dlg_back" android:layout_centerVertical="true" android:layout_marginLeft="10dp" android:background="@drawable/loader"/> 


7. Open the activit in which our sexy snowman will rotate his hips

- We declare, we initialize:
 private ImageView progressBar; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.videos, container, false); progressBar = (ImageView)v.findViewById(R.id.progressBar); progressBar.setVisibility(View.GONE); } 


- Run the animation (for example, on request):
 private String restRequest(Bundle params,Boolean useCashe,int httpVerb,int mode,String method) { progressBar.setVisibility(View.VISIBLE); progressBar.post(new Runnable() { @Override public void run() { AnimationDrawable frameAnimation = (AnimationDrawable) progressBar.getBackground(); frameAnimation.start(); } }); } 


- We extinguish animation (for example on the answer):
 private void onRESTResult(int code, String result, int mode) { progressBar.setVisibility(View.GONE); progressBar.clearAnimation(); } 


Snowman is ready!

Here's what happened in the end:
- picture
image
- archive c cut snowman and layout, for lazy people
www.dropbox.com/s/xp1bke8jztc9gbo/snowman.zip
- attachment
[I removed the link to the application, so as not to embarrass advertising]

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


All Articles