![](http://habrastorage.org/getpro/habr/avatars/fd6/b22/2a2/fd6b222a22dc13f1a21c32c24a33b127.jpg)
Sculpt a snowman (decorate the application)
Good news. New Years is soon.
And if you want, you don’t want to, but users need to create a New Year mood.
![image](https://habrastorage.org/getpro/habr/post_images/43e/e17/247/43ee1724782723e8f3e7c157f2b3c886.png)
Freeloaders designers / illustrators - they nailed a snowflake / hat / twig to the logo a long time ago and ran to buy gifts with a clear conscience. Well, we, stupid programmers - do not know how easy.
First, of course, I 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 of animations from the third anroid) , launched Droid Flakes:
![](https://habrastorage.org/getpro/habr/post_images/cf0/277/d3f/cf0277d3fa00c2f4426463f7b34b727b.png)
I remember Max Payne because of the snow. It was very atmospheric there was snow. You used to sit and stick.
![image](https://habrastorage.org/getpro/habr/post_images/b64/c4c/f83/b64c4cf83479f0a0740a439ac91d7206.jpg)
How many snowflakes do you think are in the picture above? One thousand? So here. I seem to have the most powerful smartphone from what was in the store. And he already crashes on 256 objects. Which are not even in a sinusoid-closer-farther-right-left-turn, but fly stupidly down. No, we don’t need such snow. It’s not snow at all, it’s some falling robots. You can probably optimize, but time is running out.
![image](https://habrastorage.org/getpro/habr/post_images/152/397/fc1/152397fc14bcb15b31f3b173866d74e9.png)
Several hours were killed in search of a beautiful, free New Year font with Cyrillic support. I guess I was not looking there.
I already decided to give up and whine on Skype to familiar designers with a request to nail a twig to the logo, when it dawned on me -
Preloader! The preloader is unobtrusive. Its easy to do. It does not slow down, does not consume resources, and in general is a nanny.
So, a simple recipe, how to mold a snowman in half an hour to the New Year's table:
1. Choose a preloader.
- I chose here: preloaders.net
2. Customize for myself
- set the size
- background color
- number of
screen frames , for just plain
3. Click - Download as sprites (immediately rename the file with letters like snowman)
4. Open in Photoshop
- set guides
for (int i = 0; i
- View / New Guide
- guide.setValue (i * frame.getWidth);
}
(well, in the sense I don’t know if there is any scripting language in Photoshop and how to use it. As a result, I clicked a moron 12 times. Do not worry, this is the most difficult part)
- Select the Slice tool (I hid it 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 the icons to the drawable folder
6. Open Idea
- right-click on the Drawable folder, New / Drawable resource file - loader .xml
- paste the text:
- open our layout and add a new, brilliant progress bar
7. Open the activity in which our sexy snowman will rotate the hips
- Declare, initialize:
- Run the animation (for example, on request):
- Extinguish the animation (for example, to the answer):
The snowman is ready!
Here is the result:
- a picture
![image](https://habrastorage.org/getpro/habr/post_images/7b1/5b9/4f1/7b15b94f17cddf6517bcca29b0e8b1b9.png)
- an archive with a cut snowman and a layout, for lazy people
www.dropbox.com/s/xp1bke8jztc9gbo/snowman.zip
- application
[I removed the link to applications, so as not to confuse advertising]
And if you want, you don’t want to, but users need to create a New Year mood.
![image](https://habrastorage.org/getpro/habr/post_images/43e/e17/247/43ee1724782723e8f3e7c157f2b3c886.png)
Freeloaders designers / illustrators - they nailed a snowflake / hat / twig to the logo a long time ago and ran to buy gifts with a clear conscience. Well, we, stupid programmers - do not know how easy.
First, of course, I 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 of animations from the third anroid) , launched Droid Flakes:
![](https://habrastorage.org/getpro/habr/post_images/cf0/277/d3f/cf0277d3fa00c2f4426463f7b34b727b.png)
I remember Max Payne because of the snow. It was very atmospheric there was snow. You used to sit and stick.
![image](https://habrastorage.org/getpro/habr/post_images/b64/c4c/f83/b64c4cf83479f0a0740a439ac91d7206.jpg)
How many snowflakes do you think are in the picture above? One thousand? So here. I seem to have the most powerful smartphone from what was in the store. And he already crashes on 256 objects. Which are not even in a sinusoid-closer-farther-right-left-turn, but fly stupidly down. No, we don’t need such snow. It’s not snow at all, it’s some falling robots. You can probably optimize, but time is running out.
![image](https://habrastorage.org/getpro/habr/post_images/152/397/fc1/152397fc14bcb15b31f3b173866d74e9.png)
Several hours were killed in search of a beautiful, free New Year font with Cyrillic support. I guess I was not looking there.
I already decided to give up and whine on Skype to familiar designers with a request to nail a twig to the logo, when it dawned on me -
Preloader! The preloader is unobtrusive. Its easy to do. It does not slow down, does not consume resources, and in general is a nanny.
So, a simple recipe, how to mold a snowman in half an hour to the New Year's table:
1. Choose a preloader.
- I chose here: preloaders.net
2. Customize for myself
- set the size
- background color
- number of
screen frames , for just plain
3. Click - Download as sprites (immediately rename the file with letters like snowman)
4. Open in Photoshop
- set guides
for (int i = 0; i
- guide.setValue (i * frame.getWidth);
}
(well, in the sense I don’t know if there is any scripting language in Photoshop and how to use it. As a result, I clicked a moron 12 times. Do not worry, this is the most difficult part)
- Select the Slice tool (I hid it 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 the icons to the drawable folder
6. Open Idea
- right-click on the Drawable folder, New / Drawable resource file - loader .xml
- paste the text:
- open our layout and add a new, brilliant progress bar
7. Open the activity in which our sexy snowman will rotate the hips
- Declare, 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();
}
});
}
- Extinguish the animation (for example, to the answer):
private void onRESTResult(int code, String result, int mode) {
progressBar.setVisibility(View.GONE);
progressBar.clearAnimation();
}
The snowman is ready!
Here is the result:
- a picture
![image](https://habrastorage.org/getpro/habr/post_images/7b1/5b9/4f1/7b15b94f17cddf6517bcca29b0e8b1b9.png)
- an archive with a cut snowman and a layout, for lazy people
www.dropbox.com/s/xp1bke8jztc9gbo/snowman.zip
- application
[I removed the link to applications, so as not to confuse advertising]