├── README.md
├── android-animation-sample
├── .gitignore
├── .idea
│ ├── .name
│ ├── compiler.xml
│ ├── copyright
│ │ └── profiles_settings.xml
│ ├── encodings.xml
│ ├── gradle.xml
│ ├── misc.xml
│ ├── modules.xml
│ ├── runConfigurations.xml
│ └── vcs.xml
├── android-animation-sample.iml
├── app
│ ├── .gitignore
│ ├── app.iml
│ ├── build.gradle
│ └── src
│ │ └── main
│ │ ├── AndroidManifest.xml
│ │ ├── java
│ │ └── com
│ │ │ └── mobapphome
│ │ │ └── animation
│ │ │ └── sample
│ │ │ ├── AboutFragment.java
│ │ │ ├── MainActivity.java
│ │ │ ├── SecondFragment.java
│ │ │ ├── StartFragment.java
│ │ │ └── UIMethods.java
│ │ └── res
│ │ ├── anim
│ │ ├── a1_fade_in_scale.xml
│ │ ├── a1_fade_out_scale.xml
│ │ ├── a2_fade_in.xml
│ │ ├── a2_fade_out.xml
│ │ ├── a3_slide_down_fade.xml
│ │ └── a3_slide_up_fade.xml
│ │ ├── drawable-hdpi
│ │ ├── button_info_normal.png
│ │ ├── button_sound_muted.png
│ │ └── button_sound_normal.png
│ │ ├── drawable
│ │ ├── icon_large.png
│ │ ├── mah_btn_background_selector.xml
│ │ ├── mah_btn_main_pressed_state.xml
│ │ ├── mah_btn_main_state.xml
│ │ ├── mah_btn_ripple_effect.xml
│ │ └── mah_btn_text_selector.xml
│ │ ├── layout
│ │ ├── activity_main.xml
│ │ ├── fragment_about.xml
│ │ ├── fragment_second.xml
│ │ └── fragment_start.xml
│ │ ├── mipmap-hdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-mdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-xhdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-xxhdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-xxxhdpi
│ │ └── ic_launcher.png
│ │ ├── raw
│ │ ├── explosion.mp3
│ │ ├── space_drifter.mp3
│ │ └── whoosh.mp3
│ │ ├── values-v21
│ │ └── styles.xml
│ │ └── values
│ │ ├── attrs.xml
│ │ ├── colors.xml
│ │ ├── dimens.xml
│ │ ├── strings.xml
│ │ └── styles.xml
├── build.gradle
├── gradle
│ └── wrapper
│ │ ├── gradle-wrapper.jar
│ │ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
└── settings.gradle
├── imgs
└── img_create
│ ├── android_animation_sample_logo.ai
│ ├── android_animation_sample_logo.png
│ └── ic_launcher
│ ├── res
│ ├── mipmap-hdpi
│ │ └── ic_launcher.png
│ ├── mipmap-mdpi
│ │ └── ic_launcher.png
│ ├── mipmap-xhdpi
│ │ └── ic_launcher.png
│ ├── mipmap-xxhdpi
│ │ └── ic_launcher.png
│ └── mipmap-xxxhdpi
│ │ └── ic_launcher.png
│ └── web_hi_res_512.png
└── screenshots
├── open_animation.gif
└── start_animation.gif
/README.md:
--------------------------------------------------------------------------------
1 | # android-open-animation
2 | ### Sample opening animation for android
3 |
4 | This application has created by [Sttar Hummatli](https://www.linkedin.com/in/hummatli) in test prosess.
5 |
6 | It contains opening animation tips. You can use it freely in your apps.
7 |
8 | Application has build on IDE `Android Studio`
9 |
10 | ### Images
11 |
12 |
13 |
14 | ### Contribution
15 | * Fork it
16 | * Create your feature branch (git checkout -b my-new-feature)
17 | * Commit your changes (git commit -am 'Added some feature')
18 | * Push to the branch (git push origin my-new-feature)
19 | * Create new Pull Request
20 | * Star it
21 |
22 | If you have any question about application please let me know. Write to settarxan@gmail.com. I will help.
23 |
24 | ### Developed By
25 | Sattar Hummatli - settarxan@gmail.com
26 |
27 |
28 | ### License
29 | MIT License
30 |
31 | Copyright (c) 2017 [Sattar Hummatli](https://www.linkedin.com/in/hummatli)
32 |
33 | Permission is hereby granted, free of charge, to any person obtaining a copy
34 | of this software and associated documentation files (the "Software"), to deal
35 | in the Software without restriction, including without limitation the rights
36 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
37 | copies of the Software, and to permit persons to whom the Software is
38 | furnished to do so, subject to the following conditions:
39 |
40 | The above copyright notice and this permission notice shall be included in all
41 | copies or substantial portions of the Software.
42 |
43 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
44 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
45 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
46 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
47 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
48 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
49 | SOFTWARE.
50 |
51 |
--------------------------------------------------------------------------------
/android-animation-sample/.gitignore:
--------------------------------------------------------------------------------
1 | .gradle
2 | /local.properties
3 | /.idea/workspace.xml
4 | /.idea/libraries
5 | .DS_Store
6 | /build
7 | /captures
8 |
--------------------------------------------------------------------------------
/android-animation-sample/.idea/.name:
--------------------------------------------------------------------------------
1 | android-animation-sample
--------------------------------------------------------------------------------
/android-animation-sample/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/android-animation-sample/.idea/copyright/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/android-animation-sample/.idea/encodings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/android-animation-sample/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
22 |
23 |
--------------------------------------------------------------------------------
/android-animation-sample/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 | 1.8
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
--------------------------------------------------------------------------------
/android-animation-sample/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/android-animation-sample/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/android-animation-sample/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/android-animation-sample/android-animation-sample.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/android-animation-sample/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/android-animation-sample/app/app.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 | generateDebugSources
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
--------------------------------------------------------------------------------
/android-animation-sample/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 24
5 | buildToolsVersion "24.0.1"
6 |
7 | defaultConfig {
8 | applicationId "com.mobapphome.animation.sample"
9 | minSdkVersion 14
10 | targetSdkVersion 24
11 | versionCode 1
12 | versionName "1.0"
13 | }
14 |
15 | buildTypes {
16 | release {
17 | minifyEnabled false
18 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
19 | }
20 | }
21 | }
22 |
23 | dependencies {
24 | compile 'com.android.support:appcompat-v7:24.2.1'
25 | }
26 |
--------------------------------------------------------------------------------
/android-animation-sample/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
13 |
14 |
15 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/android-animation-sample/app/src/main/java/com/mobapphome/animation/sample/AboutFragment.java:
--------------------------------------------------------------------------------
1 | package com.mobapphome.animation.sample;
2 |
3 |
4 | import android.os.Bundle;
5 | import android.support.v4.app.Fragment;
6 | import android.view.LayoutInflater;
7 | import android.view.View;
8 | import android.view.ViewGroup;
9 | import android.widget.LinearLayout;
10 |
11 | public class AboutFragment extends Fragment implements View.OnClickListener {
12 |
13 | @Override
14 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
15 | LinearLayout lytMain = (LinearLayout) inflater.inflate(R.layout.fragment_about, container, false);
16 | lytMain.findViewById(R.id.btnBack).setOnClickListener(this);
17 | return lytMain;
18 | }
19 |
20 | @Override
21 | public void onClick(View v) {
22 | // TODO Auto-generated method stub
23 | if (v.getId() == R.id.btnBack) {
24 | try {
25 | getActivity().getSupportFragmentManager().popBackStack();
26 | } catch (NullPointerException npe) {
27 | return;
28 | }
29 | }
30 | }
31 | }
--------------------------------------------------------------------------------
/android-animation-sample/app/src/main/java/com/mobapphome/animation/sample/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.mobapphome.animation.sample;
2 |
3 | import java.util.List;
4 |
5 | import android.content.Context;
6 | import android.content.SharedPreferences;
7 | import android.graphics.Typeface;
8 | import android.media.AudioManager;
9 | import android.media.MediaPlayer;
10 | import android.os.Bundle;
11 | import android.support.v4.app.Fragment;
12 | import android.support.v4.app.FragmentTransaction;
13 | import android.support.v7.app.AppCompatActivity;
14 | import android.util.Log;
15 | import android.widget.TextView;
16 |
17 | public class MainActivity extends AppCompatActivity {
18 |
19 | static public final String START_FARGMENT = "startFragment";
20 | static public final String SECOND_FARGMENT = "secondFragment";
21 | static public final String ABOUT_FARGMENT = "aboutFragment";
22 |
23 | final public static String PREF_KEY_SOUND = "sound";
24 |
25 | public MediaPlayer mpFonStart;
26 |
27 | SharedPreferences prefs;
28 | private boolean soundOn = false;
29 |
30 | FragmentTransaction transactionForCommitOnPostResume = null;
31 | FragmentTransaction transactionForCommitOnPostResumeForAdd = null;
32 |
33 | public void soundOn(boolean soundOn){
34 | this.soundOn = soundOn;
35 | if (soundOn) {
36 | setVolume(1);
37 | } else {
38 | setVolume(0);
39 | }
40 | saveSoundOnPref();
41 | }
42 |
43 | public void setVolume(float volume){
44 | if(mpFonStart != null) mpFonStart.setVolume(volume, volume);
45 | }
46 |
47 | public boolean getSoundOn(){
48 | return soundOn;
49 | }
50 |
51 |
52 | static public void setFontTextView(Context context, TextView tv, String fontName) {
53 | try{
54 | Typeface font = Typeface.createFromAsset(context.getAssets(),fontName);
55 | tv.setTypeface(font);
56 | }catch(RuntimeException r){
57 | Log.e("test", "Error " + r.getMessage());
58 | }
59 | }
60 |
61 | @Override
62 | protected void onCreate(Bundle savedInstanceState) {
63 |
64 | super.onCreate(savedInstanceState);
65 |
66 | Log.i("test", "Main act on create called");
67 |
68 | setContentView(R.layout.activity_main);
69 |
70 | prefs = getSharedPreferences(
71 | getApplicationContext().getPackageName(), Context.MODE_PRIVATE);
72 | soundOn = prefs.getBoolean(PREF_KEY_SOUND, false);
73 |
74 | if (savedInstanceState == null) {
75 | FragmentTransaction transaction = getSupportFragmentManager()
76 | .beginTransaction();
77 | StartFragment fragment = StartFragment.newInstance();
78 |
79 | transaction.setCustomAnimations(android.R.anim.fade_in, android.R.anim.fade_out,android.R.anim.fade_in, android.R.anim.fade_out);
80 | transaction.add(R.id.container, fragment, START_FARGMENT);
81 | transaction.commit();
82 | }
83 | }
84 |
85 |
86 | public void startAudioFonStart(){
87 | new Thread(new Runnable() {
88 |
89 | @Override
90 | public void run() {
91 | stopAudioFonStart();
92 | mpFonStart = MediaPlayer.create(MainActivity.this, R.raw.space_drifter);
93 | mpFonStart.setLooping(true);
94 | mpFonStart.setAudioStreamType(AudioManager.STREAM_MUSIC);
95 |
96 | if(soundOn){
97 | mpFonStart.setVolume(1, 1);
98 | }else{
99 | mpFonStart.setVolume(0, 0);
100 | }
101 | mpFonStart.start();
102 | }
103 | }).start();
104 | }
105 |
106 | public void stopAudioFonStart(){
107 | if(mpFonStart != null && mpFonStart.isPlaying()){
108 | mpFonStart.stop();
109 | }
110 | }
111 |
112 | @Override
113 | protected void onStart() {
114 | // TODO Auto-generated method stub
115 | if(soundOn){
116 | setVolume(1);
117 | }
118 | Log.i("test", "-----Main act on start called");
119 | super.onStart();
120 | }
121 |
122 |
123 | @Override
124 | protected void onPostResume() {
125 | super.onPostResume();
126 | if(transactionForCommitOnPostResume != null){
127 | transactionForCommitOnPostResume.commit();
128 | }
129 | transactionForCommitOnPostResume = null;
130 | Log.i("test", "On resume post 1 = transactionForCommitOnPostResume = " + transactionForCommitOnPostResume);
131 | if(transactionForCommitOnPostResumeForAdd != null){
132 | Log.i("test", "On resume post 2");
133 | transactionForCommitOnPostResumeForAdd.commit();
134 | }
135 | transactionForCommitOnPostResumeForAdd = null;
136 | }
137 |
138 | public void saveSoundOnPref(){
139 | prefs.edit().putBoolean(PREF_KEY_SOUND, soundOn).apply();
140 | }
141 |
142 |
143 | @Override
144 | protected void onStop() {
145 | // TODO Auto-generated method stub
146 | setVolume(0);
147 | saveSoundOnPref();
148 | Log.i("test", "----Main act on stop called");
149 | super.onStop();
150 | }
151 |
152 |
153 |
154 | public void replaceFragments(int conatinerId, Fragment fragment, String fragmentTag, int enter, int exit, int popEnter, int popExit){
155 | replaceFragments(conatinerId, fragment, fragmentTag, enter, exit, popEnter, popExit, false);
156 | }
157 |
158 | public void replaceFragments(int conatinerId, Fragment fragment, String fragmentTag, int enter, int exit, int popEnter, int popExit, boolean commitOnPostResume){
159 | FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
160 | transaction.setCustomAnimations(enter, exit, popEnter, popExit);
161 | transaction.replace(conatinerId, fragment, fragmentTag);
162 | transaction.addToBackStack(null);
163 | if(!commitOnPostResume) {
164 | transaction.commit();
165 | transactionForCommitOnPostResume = null;
166 | }else{
167 | transactionForCommitOnPostResume = transaction;
168 | }
169 | }
170 |
171 |
172 | @Override
173 | public void onBackPressed() {
174 | List fragments = getSupportFragmentManager().getFragments();
175 | Log.i("test", "Fragment size = " + fragments.size());
176 | for(int i = 0;i < fragments.size() ; ++i){
177 | Fragment frag = fragments.get(i);
178 | if(frag != null){
179 | Log.i("test", "frag " + i + " = " + fragments.get(i).getTag() + " isvisible = " + fragments.get(i).isVisible());
180 | if(frag.isVisible()){
181 | if(frag instanceof AboutFragment){
182 | Log.i("test", "Current frag is About fragment");
183 | }else if(frag instanceof StartFragment){
184 | Log.i("test", "Current frag is Start fragment");
185 | finish();
186 | }else if(frag instanceof SecondFragment){
187 | Log.i("test", "Current frag is Second fragment");
188 | }
189 | }
190 | }else{
191 | Log.i("test", "frag " + frag);
192 | }
193 | }
194 |
195 | super.onBackPressed();
196 |
197 |
198 | }
199 | }
--------------------------------------------------------------------------------
/android-animation-sample/app/src/main/java/com/mobapphome/animation/sample/SecondFragment.java:
--------------------------------------------------------------------------------
1 | package com.mobapphome.animation.sample;
2 |
3 |
4 | import android.os.Bundle;
5 | import android.support.v4.app.Fragment;
6 | import android.view.LayoutInflater;
7 | import android.view.View;
8 | import android.view.ViewGroup;
9 | import android.widget.LinearLayout;
10 |
11 |
12 | public class SecondFragment extends Fragment implements View.OnClickListener {
13 |
14 |
15 | public static SecondFragment newInstance() {
16 | SecondFragment myFragment = new SecondFragment();
17 | return myFragment;
18 | }
19 |
20 |
21 | @Override
22 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
23 |
24 | LinearLayout lytMain = (LinearLayout) inflater.inflate(R.layout.fragment_second, container, false);
25 | lytMain.findViewById(R.id.btnBack).setOnClickListener(this);
26 | return lytMain;
27 | }
28 |
29 | @Override
30 | public void onClick(View v) {
31 | // TODO Auto-generated method stub
32 | if (v.getId() == R.id.btnBack) {
33 | try {
34 | getActivity().getSupportFragmentManager().popBackStack();
35 | } catch (NullPointerException npe) {
36 | return;
37 | }
38 | }
39 | }
40 | }
--------------------------------------------------------------------------------
/android-animation-sample/app/src/main/java/com/mobapphome/animation/sample/StartFragment.java:
--------------------------------------------------------------------------------
1 | package com.mobapphome.animation.sample;
2 |
3 | import android.animation.Animator;
4 | import android.animation.AnimatorListenerAdapter;
5 | import android.animation.AnimatorSet;
6 | import android.animation.ObjectAnimator;
7 | import android.content.Context;
8 | import android.graphics.Point;
9 | import android.media.AudioManager;
10 | import android.media.MediaPlayer;
11 | import android.os.Bundle;
12 | import android.os.Vibrator;
13 | import android.support.annotation.Nullable;
14 | import android.support.v4.app.Fragment;
15 | import android.util.Log;
16 | import android.view.Display;
17 | import android.view.LayoutInflater;
18 | import android.view.MenuItem;
19 | import android.view.View;
20 | import android.view.ViewGroup;
21 | import android.view.ViewTreeObserver;
22 | import android.view.animation.AnticipateInterpolator;
23 | import android.view.animation.DecelerateInterpolator;
24 | import android.view.animation.LinearInterpolator;
25 | import android.view.animation.OvershootInterpolator;
26 | import android.widget.Button;
27 | import android.widget.ImageView;
28 | import android.widget.RelativeLayout;
29 |
30 | public class StartFragment extends Fragment implements View.OnClickListener {
31 |
32 | RelativeLayout lytMain;
33 | ImageView imgView;
34 | Button btn1;
35 | Button btn2;
36 | ImageView btnSound;
37 | ImageView btnInfo;
38 |
39 | int scrWidth;
40 | int scrHeight;
41 |
42 | float imgViewInitX;
43 | float btn1InitX;
44 | float btn2InitX;
45 | float btnSoundInitX;
46 | float btnInfoInitX;
47 |
48 | float imgViewInitY;
49 | float btn1InitY;
50 | float btn2InitY;
51 | float btnSoundInitY;
52 | float btnInfoInitY;
53 |
54 | float imgViewNewY;
55 | float btn1NewY;
56 | float btn2NewY;
57 | float btnSoundNewY;
58 | float btnInfoNewY;
59 |
60 | boolean firstTime = true;
61 | boolean startOpenAnimately = false;
62 | boolean startEnded = false;
63 |
64 | SecondFragment secondFragment;
65 |
66 |
67 | private void playWhoosh(){
68 | new Thread(new Runnable() {
69 |
70 | @Override
71 | public void run() {
72 |
73 | MediaPlayer mp = MediaPlayer.create(lytMain.getContext(),
74 | R.raw.whoosh);
75 | mp.setAudioStreamType(AudioManager.STREAM_MUSIC);
76 | mp.start();
77 | }
78 | }).start();
79 | }
80 |
81 | public void enableButtons(boolean enable){
82 | btn1.setEnabled(enable);
83 | btn2.setEnabled(enable);
84 | btnInfo.setEnabled(enable);
85 | btnSound.setEnabled(enable);
86 | }
87 |
88 | private void startAnimation(){
89 | //set initial coordinates
90 |
91 | enableButtons(false);
92 |
93 | imgView.setX(UIMethods.mapToLocCordX((scrWidth - imgView.getWidth()) / 2, imgView));
94 | imgView.setY(UIMethods.mapToLocCordY((scrHeight - imgView.getHeight()) / 2, imgView));
95 | btn1.setX(UIMethods.mapToLocCordX(-btn1.getWidth(), btn1));
96 | btn2.setX(UIMethods.mapToLocCordX(scrWidth, btn2));
97 | btnSound.setY(UIMethods.mapToLocCordX(-btnSound.getHeight(), btnSound));
98 | btnInfo.setY(UIMethods.mapToLocCordX(-btnInfo.getHeight(), btnInfo));
99 |
100 | //Animation first
101 | ObjectAnimator animScaleX = ObjectAnimator.ofFloat(imgView, "scaleX", 3, 1);
102 | ObjectAnimator animScaleY = ObjectAnimator.ofFloat(imgView, "scaleY", 3, 1);
103 | ObjectAnimator animAlpha = ObjectAnimator.ofFloat(imgView, "alpha", 0, 1);
104 |
105 | AnimatorSet animSetFirst = new AnimatorSet();
106 | animSetFirst.setDuration(500);
107 | animSetFirst.playTogether(animScaleX, animScaleY, animAlpha);
108 | animSetFirst.addListener(new AnimatorListenerAdapter() {
109 |
110 | @Override
111 | public void onAnimationStart(Animator animation) {
112 |
113 | try{
114 | if (((MainActivity)getActivity()).getSoundOn()) {
115 | playWhoosh();
116 | }
117 | }catch(NullPointerException npe){
118 | return;
119 | }
120 | super.onAnimationStart(animation);
121 | }
122 |
123 | });
124 |
125 | //Animation second
126 | ObjectAnimator animShakeX = ObjectAnimator.ofFloat(imgView, "x", imgView.getX() - 10, imgView.getX() + 10);
127 | animShakeX.setRepeatCount(17);
128 | animShakeX.setRepeatMode(ObjectAnimator.RESTART);
129 | animShakeX.setInterpolator(new LinearInterpolator());
130 |
131 |
132 | ObjectAnimator animShakeY = ObjectAnimator.ofFloat(imgView, "y",imgView.getY() -10, imgView.getY() +10);
133 | animShakeY.setRepeatCount(16);
134 | animShakeY.setRepeatMode(ObjectAnimator.REVERSE);
135 | animShakeX.setInterpolator(new LinearInterpolator());
136 |
137 | AnimatorSet animSetSecond = new AnimatorSet();
138 | animSetSecond.playTogether(animShakeX, animShakeY);
139 | animSetSecond.setDuration(50);
140 | long datest = 0;
141 | animSetSecond.addListener(new AnimatorListenerAdapter() {
142 | MediaPlayer mp = null;
143 | Vibrator v = null;
144 | @Override
145 | public void onAnimationStart(Animator animation) {
146 |
147 | try{
148 | if (((MainActivity)getActivity()).getSoundOn()) {
149 | new Thread(new Runnable() {
150 |
151 | @Override
152 | public void run() {
153 | mp = MediaPlayer.create(lytMain.getContext(), R.raw.explosion);
154 | mp.setVolume(0.3f, 0.3f);
155 | mp.setAudioStreamType(AudioManager.STREAM_MUSIC);
156 | mp.start();
157 | v = (Vibrator) lytMain.getContext().getSystemService(Context.VIBRATOR_SERVICE);
158 | v.vibrate(5000);
159 | }
160 | }).start();
161 | }
162 | }catch(NullPointerException npe){
163 | return;
164 | }
165 | super.onAnimationStart(animation);
166 | }
167 |
168 | @Override
169 | public void onAnimationEnd(Animator animation) {
170 | // TODO Auto-generated method stub
171 | if (mp != null && mp.isPlaying()) mp.stop();
172 | if (v !=null) v.cancel();
173 | super.onAnimationEnd(animation);
174 | }
175 | });
176 |
177 | //Animation third
178 | ObjectAnimator animThird = ObjectAnimator.ofFloat(imgView, "y", imgView.getY(), imgViewInitY);
179 | animThird.setDuration(500);
180 | animThird.setInterpolator(new OvershootInterpolator());
181 | animThird.setStartDelay(500);
182 | animThird.addListener(new AnimatorListenerAdapter() {
183 | @Override
184 | public void onAnimationStart(Animator animation) {
185 |
186 | try{
187 | if (((MainActivity)getActivity()).getSoundOn()) {
188 | playWhoosh();
189 | }
190 | }catch(NullPointerException npe){
191 | return;
192 | }
193 | super.onAnimationStart(animation);
194 | }
195 | });
196 |
197 |
198 | //Animation forth
199 | ObjectAnimator animForth = ObjectAnimator.ofFloat(btn1, "x", btn1.getX(), btn1InitX);
200 | animForth.setDuration(300);
201 | animForth.setInterpolator(new DecelerateInterpolator());
202 | animForth.addListener(new AnimatorListenerAdapter() {
203 | @Override
204 | public void onAnimationStart(Animator animation) {
205 |
206 | try{
207 | if ((( MainActivity)getActivity()).getSoundOn()) {
208 | playWhoosh();
209 | }
210 | }catch(NullPointerException npe){
211 | return;
212 | }
213 | super.onAnimationStart(animation);
214 | }
215 |
216 | });
217 |
218 | //Animation fifth
219 | ObjectAnimator animFifth = ObjectAnimator.ofFloat(btn2, "x", btn2.getX(), btn2InitX);
220 | animFifth.setDuration(300);
221 | animFifth.setInterpolator(new DecelerateInterpolator());
222 | animFifth.addListener(new AnimatorListenerAdapter() {
223 | @Override
224 | public void onAnimationStart(Animator animation) {
225 |
226 | try{
227 | if (((MainActivity)getActivity()).getSoundOn()) {
228 | playWhoosh();
229 | }
230 | }catch(NullPointerException npe){
231 | return;
232 | }
233 | super.onAnimationStart(animation);
234 | }
235 |
236 | });
237 |
238 | //Animation sixth
239 | ObjectAnimator animSound = ObjectAnimator.ofFloat(btnSound, "y", btnSound.getY(), btnSoundInitY);
240 | animSound.setInterpolator(new DecelerateInterpolator());
241 |
242 | ObjectAnimator animInfo = ObjectAnimator.ofFloat(btnInfo, "y", btnInfo.getY(), btnInfoInitY);
243 | animInfo.setInterpolator(new DecelerateInterpolator());
244 |
245 | AnimatorSet animSixth = new AnimatorSet();
246 | animSixth.playTogether(animSound, animInfo);
247 | animSixth.setDuration(300);
248 | animSixth.addListener(new AnimatorListenerAdapter() {
249 | //Listineri sonuncu animasiyaya atmaqda veziyyet donmain
250 | //qarshisin almaqdir. animSetAll -a atanda gecikme bas veririr
251 | @Override
252 | public void onAnimationEnd(Animator animation) {
253 | // TODO Auto-generated method stub
254 | enableButtons(true);
255 | startEnded = true;
256 | super.onAnimationStart(animation);
257 | }
258 |
259 | });
260 |
261 |
262 | //Animation all starter
263 | AnimatorSet animSetAll = new AnimatorSet();
264 | animSetAll.playSequentially(animSetFirst, animSetSecond, animThird, animForth, animFifth, animSixth);
265 | animSetAll.start();
266 |
267 | }
268 |
269 | private void openAnimation() {
270 | startOpenAnimately = true;
271 | enableButtons(false);
272 | imgViewNewY = imgView.getY() - UIMethods.getRelativeTop(imgView)
273 | - imgView.getHeight();
274 | btn1NewY = scrHeight;
275 | btn2NewY = scrHeight + btn2.getY() - btn1.getY();
276 | btnSoundNewY = btnSound.getY() - UIMethods.getRelativeTop(btnSound)
277 | - btnSound.getHeight();
278 | btnInfoNewY = btnInfo.getY() - UIMethods.getRelativeTop(btnInfo)
279 | - btnInfo.getHeight();
280 |
281 | ObjectAnimator animImgViewY = ObjectAnimator.ofFloat(imgView, "y",
282 | imgView.getY(), imgViewNewY);
283 | ObjectAnimator animBtn1 = ObjectAnimator.ofFloat(btn1, "y",
284 | btn1.getY(), btn1NewY);
285 | ObjectAnimator animBtn2 = ObjectAnimator.ofFloat(btn2, "y",
286 | btn2.getY(), btn2NewY);
287 | ObjectAnimator animBtnSound = ObjectAnimator.ofFloat(btnSound, "y",
288 | btnSound.getY(), btnSoundNewY);
289 | ObjectAnimator animBtnInfo = ObjectAnimator.ofFloat(btnInfo, "y",
290 | btnInfo.getY(), btnInfoNewY);
291 |
292 | AnimatorSet animatorSet = new AnimatorSet();
293 | animatorSet.setDuration(500);
294 | animatorSet.setInterpolator(new AnticipateInterpolator(1));
295 | animatorSet.playTogether(animImgViewY, animBtnSound, animBtnInfo,
296 | animBtn1, animBtn2);
297 | animatorSet.addListener(new AnimatorListenerAdapter() {
298 |
299 | @Override
300 | public void onAnimationEnd(Animator arg0) {
301 | // TODO Auto-generated method stub
302 |
303 | Log.i("test", "Open animation end");
304 | ((MainActivity) getActivity()).replaceFragments(R.id.container,
305 | secondFragment, MainActivity.SECOND_FARGMENT, R.anim.a2_fade_in, 0, 0, R.anim.a2_fade_out);
306 | enableButtons(true);
307 | }
308 |
309 | });
310 | animatorSet.start();
311 |
312 | }
313 |
314 | private void closeAnimation() {
315 | if(!startOpenAnimately){
316 | return;
317 | }
318 | startOpenAnimately = false;
319 | enableButtons(false);
320 |
321 | ObjectAnimator animImgViewY = ObjectAnimator.ofFloat(imgView, "y",
322 | imgViewNewY, imgViewInitY);
323 | ObjectAnimator animBtnSound = ObjectAnimator.ofFloat(btnSound, "y",
324 | btnSoundNewY, btnSoundInitY);
325 | ObjectAnimator animBtnInfo = ObjectAnimator.ofFloat(btnInfo, "y",
326 | btnInfoNewY, btnInfoInitY);
327 | ObjectAnimator animBtn1 = ObjectAnimator.ofFloat(btn1, "y",
328 | btn1NewY, btn1InitY);
329 | ObjectAnimator animBtn2 = ObjectAnimator.ofFloat(btn2, "y",
330 | btn2NewY, btn2InitY);
331 |
332 | AnimatorSet animatorSet = new AnimatorSet();
333 | animatorSet.setDuration(500);
334 | animatorSet.setInterpolator(new OvershootInterpolator(1));
335 | animatorSet.playTogether(animImgViewY, animBtnSound, animBtnInfo,
336 | animBtn1, animBtn2);
337 | animatorSet.addListener(new AnimatorListenerAdapter() {
338 | @Override
339 | public void onAnimationEnd(Animator animation) {
340 | enableButtons(true);
341 | super.onAnimationEnd(animation);
342 | }
343 | });
344 |
345 | animatorSet.start();
346 | }
347 |
348 | @Override
349 | public void onClick(View v) {
350 | // TODO Auto-generated method stub
351 | if (v.getId() == R.id.btn1) {
352 | openAnimation();
353 | } else if (v.getId() == R.id.btn2) {
354 | openAnimation();
355 | } else if (v.getId() == R.id.btnSound) {
356 |
357 | try{
358 | if (((MainActivity)getActivity()).getSoundOn()) {
359 | btnSound.setBackgroundResource(R.drawable.button_sound_muted);
360 | } else {
361 | btnSound.setBackgroundResource(R.drawable.button_sound_normal);
362 | }
363 | ((MainActivity)getActivity()).soundOn(!((MainActivity)getActivity()).getSoundOn());
364 | }catch(NullPointerException npe){
365 | return;
366 | }
367 |
368 | } else if (v.getId() == R.id.btnInfo) {
369 | final AboutFragment fragment = new AboutFragment();
370 | ((MainActivity) getActivity()).replaceFragments(R.id.container, fragment,
371 | MainActivity.ABOUT_FARGMENT, R.anim.a3_slide_up_fade, R.anim.a1_fade_out_scale, R.anim.a1_fade_in_scale, R.anim.a3_slide_down_fade);
372 | }
373 |
374 | }
375 |
376 |
377 | public static StartFragment newInstance(){
378 | StartFragment myFragment = new StartFragment();
379 | return myFragment;
380 | }
381 |
382 | @Override
383 | public void onCreate(@Nullable Bundle savedInstanceState) {
384 | firstTime = true;
385 | secondFragment = SecondFragment.newInstance();
386 | super.onCreate(savedInstanceState);
387 | }
388 |
389 | @Override
390 | public View onCreateView(LayoutInflater inflater, ViewGroup container,
391 | Bundle savedInstanceState) {
392 |
393 | Log.i("test", "Start frag cretate view ---");
394 |
395 | setHasOptionsMenu(true);
396 | lytMain = (RelativeLayout) inflater.inflate(R.layout.fragment_start,container, false);
397 |
398 | imgView = (ImageView) lytMain.findViewById(R.id.imgStart);
399 | btn1 = (Button) lytMain.findViewById(R.id.btn1);
400 | btn2 = (Button) lytMain.findViewById(R.id.btn2);
401 | btnSound = (ImageView) lytMain.findViewById(R.id.btnSound);
402 | btnInfo = (ImageView) lytMain.findViewById(R.id.btnInfo);
403 | // btnSound.bringToFront();
404 | // btnInfo.bringToFront();
405 |
406 | btn1.setOnClickListener(this);
407 | btn2.setOnClickListener(this);
408 | btnSound.setOnClickListener(this);
409 | btnInfo.setOnClickListener(this);
410 |
411 |
412 | try{
413 | if (((MainActivity)getActivity()).getSoundOn()) {
414 | btnSound.setBackgroundResource(R.drawable.button_sound_normal);
415 | } else {
416 | btnSound.setBackgroundResource(R.drawable.button_sound_muted);
417 | }
418 | }catch(NullPointerException npe){
419 | return null;
420 | }
421 |
422 | lytMain.getViewTreeObserver().addOnGlobalLayoutListener(
423 | new ViewTreeObserver.OnGlobalLayoutListener() {
424 |
425 | @Override
426 | public void onGlobalLayout() {
427 | // now we can retrieve the width and height
428 | Display display = null;
429 | try{
430 | display = getActivity().getWindowManager()
431 | .getDefaultDisplay();
432 | }catch(NullPointerException npe){
433 | return;
434 | }
435 |
436 | Point size = new Point();
437 | display.getSize(size);
438 | scrWidth = size.x;
439 | scrHeight = size.y;
440 | // Getting actual coordinates
441 | imgViewInitX = imgView.getX();
442 | btn1InitX = btn1.getX();
443 | btn2InitX = btn2.getX();
444 | btnSoundInitX = btnSound.getX();
445 | btnInfoInitX = btnInfo.getX();
446 |
447 | imgViewInitY = imgView.getY();
448 | btn1InitY = btn1.getY();
449 | btn2InitY = btn2.getY();
450 | btnSoundInitY = btnSound.getY();
451 | btnInfoInitY = btnInfo.getY();
452 |
453 | Log.i("test", "StartFrag First time = " + firstTime);
454 | if (firstTime) {
455 | firstTime = false;
456 | startAnimation();
457 | } else {
458 | closeAnimation();
459 | }
460 |
461 | // ...
462 | // do whatever you want with them
463 | // ...
464 | // this is an important step not to keep receiving
465 | // callbacks:
466 | // we should remove this listener
467 | // I use the function to remove it based on the api
468 | // level!
469 |
470 | if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN)
471 | imgView.getViewTreeObserver()
472 | .removeOnGlobalLayoutListener(this);
473 | else
474 | imgView.getViewTreeObserver()
475 | .removeGlobalOnLayoutListener(this);
476 | }
477 | });
478 | try{
479 | ((MainActivity)getActivity()).startAudioFonStart();
480 | }catch(NullPointerException npe){
481 | return null;
482 | }
483 | return lytMain;
484 | }
485 |
486 |
487 |
488 | @Override
489 | public void onDestroyView() {
490 |
491 | try{
492 | ((MainActivity)getActivity()).stopAudioFonStart();
493 | }catch(NullPointerException npe){
494 | return;
495 | }
496 | Log.i("test", "Start frag destroyed view ------");
497 | super.onDestroyView();
498 | }
499 |
500 |
501 | @Override
502 | public boolean onOptionsItemSelected(MenuItem item) {
503 | // TODO Auto-generated method stub
504 | int id = item.getItemId();
505 | // if (id == R.id.action_capitaine_frag) {
506 | // return true;
507 | // }
508 | return super.onOptionsItemSelected(item);
509 | }
510 |
511 | }
--------------------------------------------------------------------------------
/android-animation-sample/app/src/main/java/com/mobapphome/animation/sample/UIMethods.java:
--------------------------------------------------------------------------------
1 | package com.mobapphome.animation.sample;
2 |
3 | import android.view.View;
4 |
5 | public class UIMethods {
6 | static public int getRelativeLeft(View myView) {
7 | if (myView.getParent() == myView.getRootView())
8 | return myView.getLeft();
9 | else
10 | return myView.getLeft() + getRelativeLeft((View) myView.getParent());
11 | }
12 |
13 | static public int getRelativeTop(View myView) {
14 | if (myView.getParent() == myView.getRootView())
15 | return myView.getTop();
16 | else
17 | return myView.getTop() + getRelativeTop((View) myView.getParent());
18 | }
19 |
20 | static private float getCordSysDiffY(View myView) {
21 | return getRelativeTop(myView) - myView.getY();
22 | }
23 |
24 | static private float getCordSysDiffX(View myView) {
25 | return getRelativeLeft(myView) - myView.getX();
26 | }
27 |
28 | static public float mapToLocCordY(float yGlobal, View myView) {
29 | return yGlobal - getCordSysDiffY(myView);
30 | }
31 |
32 | static public float mapToLocCordX(float xGlobal, View myView) {
33 | return xGlobal - getCordSysDiffX(myView);
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/android-animation-sample/app/src/main/res/anim/a1_fade_in_scale.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
10 |
19 |
20 |
--------------------------------------------------------------------------------
/android-animation-sample/app/src/main/res/anim/a1_fade_out_scale.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
10 |
19 |
20 |
--------------------------------------------------------------------------------
/android-animation-sample/app/src/main/res/anim/a2_fade_in.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
10 |
--------------------------------------------------------------------------------
/android-animation-sample/app/src/main/res/anim/a2_fade_out.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
10 |
--------------------------------------------------------------------------------
/android-animation-sample/app/src/main/res/anim/a3_slide_down_fade.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
10 |
15 |
16 |
--------------------------------------------------------------------------------
/android-animation-sample/app/src/main/res/anim/a3_slide_up_fade.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
10 |
15 |
16 |
--------------------------------------------------------------------------------
/android-animation-sample/app/src/main/res/drawable-hdpi/button_info_normal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hummatli/android-open-animation/7e12e31438c0f259ca276998adb0cb88cba40f9e/android-animation-sample/app/src/main/res/drawable-hdpi/button_info_normal.png
--------------------------------------------------------------------------------
/android-animation-sample/app/src/main/res/drawable-hdpi/button_sound_muted.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hummatli/android-open-animation/7e12e31438c0f259ca276998adb0cb88cba40f9e/android-animation-sample/app/src/main/res/drawable-hdpi/button_sound_muted.png
--------------------------------------------------------------------------------
/android-animation-sample/app/src/main/res/drawable-hdpi/button_sound_normal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hummatli/android-open-animation/7e12e31438c0f259ca276998adb0cb88cba40f9e/android-animation-sample/app/src/main/res/drawable-hdpi/button_sound_normal.png
--------------------------------------------------------------------------------
/android-animation-sample/app/src/main/res/drawable/icon_large.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hummatli/android-open-animation/7e12e31438c0f259ca276998adb0cb88cba40f9e/android-animation-sample/app/src/main/res/drawable/icon_large.png
--------------------------------------------------------------------------------
/android-animation-sample/app/src/main/res/drawable/mah_btn_background_selector.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/android-animation-sample/app/src/main/res/drawable/mah_btn_main_pressed_state.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/android-animation-sample/app/src/main/res/drawable/mah_btn_main_state.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/android-animation-sample/app/src/main/res/drawable/mah_btn_ripple_effect.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 | -
7 |
8 |
--------------------------------------------------------------------------------
/android-animation-sample/app/src/main/res/drawable/mah_btn_text_selector.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/android-animation-sample/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
15 |
16 |
17 |
23 |
24 |
--------------------------------------------------------------------------------
/android-animation-sample/app/src/main/res/layout/fragment_about.xml:
--------------------------------------------------------------------------------
1 |
2 |
13 |
14 |
15 |
24 |
33 |
34 |
35 |
42 |
43 |
44 |
51 |
52 |
53 |
54 |
--------------------------------------------------------------------------------
/android-animation-sample/app/src/main/res/layout/fragment_second.xml:
--------------------------------------------------------------------------------
1 |
2 |
13 |
14 |
15 |
24 |
33 |
34 |
35 |
42 |
43 |
44 |
51 |
52 |
53 |
54 |
--------------------------------------------------------------------------------
/android-animation-sample/app/src/main/res/layout/fragment_start.xml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
15 |
16 |
20 |
21 |
22 |
31 |
32 |
37 |
38 |
39 |
43 |
44 |
45 |
53 |
54 |
62 |
63 |
67 |
68 |
69 |
81 |
82 |
86 |
87 |
88 |
89 |
96 |
97 |
101 |
102 |
103 |
115 |
116 |
120 |
121 |
122 |
123 |
124 |
125 |
133 |
134 |
142 |
143 |
--------------------------------------------------------------------------------
/android-animation-sample/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hummatli/android-open-animation/7e12e31438c0f259ca276998adb0cb88cba40f9e/android-animation-sample/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android-animation-sample/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hummatli/android-open-animation/7e12e31438c0f259ca276998adb0cb88cba40f9e/android-animation-sample/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android-animation-sample/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hummatli/android-open-animation/7e12e31438c0f259ca276998adb0cb88cba40f9e/android-animation-sample/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android-animation-sample/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hummatli/android-open-animation/7e12e31438c0f259ca276998adb0cb88cba40f9e/android-animation-sample/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android-animation-sample/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hummatli/android-open-animation/7e12e31438c0f259ca276998adb0cb88cba40f9e/android-animation-sample/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android-animation-sample/app/src/main/res/raw/explosion.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hummatli/android-open-animation/7e12e31438c0f259ca276998adb0cb88cba40f9e/android-animation-sample/app/src/main/res/raw/explosion.mp3
--------------------------------------------------------------------------------
/android-animation-sample/app/src/main/res/raw/space_drifter.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hummatli/android-open-animation/7e12e31438c0f259ca276998adb0cb88cba40f9e/android-animation-sample/app/src/main/res/raw/space_drifter.mp3
--------------------------------------------------------------------------------
/android-animation-sample/app/src/main/res/raw/whoosh.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hummatli/android-open-animation/7e12e31438c0f259ca276998adb0cb88cba40f9e/android-animation-sample/app/src/main/res/raw/whoosh.mp3
--------------------------------------------------------------------------------
/android-animation-sample/app/src/main/res/values-v21/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
17 |
18 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/android-animation-sample/app/src/main/res/values/attrs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/android-animation-sample/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | #0782f4
5 | #0773d8
6 | #FFFFFF
7 |
8 | #0782f4
9 | #d6cf02
10 |
11 | #0e73ba
12 | #4cb0f6
13 | #d6cf02
14 | #f6f7f8
15 | #f6f7f8
16 |
17 |
--------------------------------------------------------------------------------
/android-animation-sample/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 70dp
4 | 23sp
5 | 20sp
6 | 15dp
7 | 80dp
8 | 10dp
9 | 10dp
10 |
11 | 20dp
12 | 20dp
13 |
14 | 100dp
15 | 60dp
16 | 10dp
17 | 18sp
18 |
19 | 230dp
20 | 15dp
21 | 50sp
22 |
23 | 35sp
24 |
25 |
26 |
27 | 55dp
28 | 18sp
29 | 18sp
30 | 15dp
31 | 80dp
32 | 10dp
33 | 10dp
34 |
35 | 15dp
36 | 15dp
37 |
38 | 90dp
39 | 55dp
40 | 7dp
41 | 18sp
42 |
43 | 200dp
44 | 12dp
45 | 40sp
46 |
47 | 35sp
48 |
49 |
50 | 45dp
51 | 15sp
52 | 14sp
53 | 10dp
54 | 60dp
55 | 7dp
56 | 7dp
57 |
58 | 8dp
59 | 8dp
60 |
61 | 70dp
62 | 45dp
63 | 5dp
64 | 15sp
65 |
66 | 140dp
67 | 10dp
68 | 25sp
69 |
70 | 25sp
71 |
72 | 35dp
73 | 14sp
74 | 14sp
75 | 5dp
76 | 50dp
77 | 4dp
78 | 4dp
79 |
80 | 5dp
81 | 5dp
82 |
83 | 50dp
84 | 35dp
85 | 4dp
86 | 13sp
87 |
88 | 100dp
89 | 8dp
90 | 20sp
91 |
92 | 20sp
93 |
94 | 25dp
95 | 9sp
96 | 9sp
97 | 3dp
98 | 40dp
99 | 3dp
100 | 3dp
101 |
102 | 3dp
103 | 3dp
104 |
105 | 40dp
106 | 25dp
107 | 3dp
108 | 10sp
109 |
110 | 80dp
111 | 6dp
112 | 15sp
113 |
114 | 17sp
115 |
116 |
117 |
--------------------------------------------------------------------------------
/android-animation-sample/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | android-animation-sample
5 | About
6 | This is android sample for opening new fragment with animation.
7 | \nYou can use code freely in your production.
8 | \nIt contains intersting animation tips.
9 | \nIt would be nice skeleton for your simple Android game.
10 |
11 |
12 | Second fragment
13 | You can add your content here.
14 |
15 | Open animation
16 | Open animation
17 | Back
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/android-animation-sample/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
8 |
33 |
34 |
35 |
36 |
40 |
41 |
42 |
47 |
48 |
64 |
65 |
69 |
70 |
--------------------------------------------------------------------------------
/android-animation-sample/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 | buildscript {
3 | repositories {
4 | jcenter()
5 | }
6 | dependencies {
7 | classpath 'com.android.tools.build:gradle:2.1.3'
8 | }
9 | }
10 |
11 | allprojects {
12 | repositories {
13 | jcenter()
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/android-animation-sample/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hummatli/android-open-animation/7e12e31438c0f259ca276998adb0cb88cba40f9e/android-animation-sample/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/android-animation-sample/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Sun Sep 18 19:46:35 AZST 2016
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
7 |
--------------------------------------------------------------------------------
/android-animation-sample/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # For Cygwin, ensure paths are in UNIX format before anything is touched.
46 | if $cygwin ; then
47 | [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
48 | fi
49 |
50 | # Attempt to set APP_HOME
51 | # Resolve links: $0 may be a link
52 | PRG="$0"
53 | # Need this for relative symlinks.
54 | while [ -h "$PRG" ] ; do
55 | ls=`ls -ld "$PRG"`
56 | link=`expr "$ls" : '.*-> \(.*\)$'`
57 | if expr "$link" : '/.*' > /dev/null; then
58 | PRG="$link"
59 | else
60 | PRG=`dirname "$PRG"`"/$link"
61 | fi
62 | done
63 | SAVED="`pwd`"
64 | cd "`dirname \"$PRG\"`/" >&-
65 | APP_HOME="`pwd -P`"
66 | cd "$SAVED" >&-
67 |
68 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
69 |
70 | # Determine the Java command to use to start the JVM.
71 | if [ -n "$JAVA_HOME" ] ; then
72 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
73 | # IBM's JDK on AIX uses strange locations for the executables
74 | JAVACMD="$JAVA_HOME/jre/sh/java"
75 | else
76 | JAVACMD="$JAVA_HOME/bin/java"
77 | fi
78 | if [ ! -x "$JAVACMD" ] ; then
79 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
80 |
81 | Please set the JAVA_HOME variable in your environment to match the
82 | location of your Java installation."
83 | fi
84 | else
85 | JAVACMD="java"
86 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
87 |
88 | Please set the JAVA_HOME variable in your environment to match the
89 | location of your Java installation."
90 | fi
91 |
92 | # Increase the maximum file descriptors if we can.
93 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
94 | MAX_FD_LIMIT=`ulimit -H -n`
95 | if [ $? -eq 0 ] ; then
96 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
97 | MAX_FD="$MAX_FD_LIMIT"
98 | fi
99 | ulimit -n $MAX_FD
100 | if [ $? -ne 0 ] ; then
101 | warn "Could not set maximum file descriptor limit: $MAX_FD"
102 | fi
103 | else
104 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
105 | fi
106 | fi
107 |
108 | # For Darwin, add options to specify how the application appears in the dock
109 | if $darwin; then
110 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
111 | fi
112 |
113 | # For Cygwin, switch paths to Windows format before running java
114 | if $cygwin ; then
115 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
116 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
117 |
118 | # We build the pattern for arguments to be converted via cygpath
119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120 | SEP=""
121 | for dir in $ROOTDIRSRAW ; do
122 | ROOTDIRS="$ROOTDIRS$SEP$dir"
123 | SEP="|"
124 | done
125 | OURCYGPATTERN="(^($ROOTDIRS))"
126 | # Add a user-defined pattern to the cygpath arguments
127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129 | fi
130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
131 | i=0
132 | for arg in "$@" ; do
133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135 |
136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138 | else
139 | eval `echo args$i`="\"$arg\""
140 | fi
141 | i=$((i+1))
142 | done
143 | case $i in
144 | (0) set -- ;;
145 | (1) set -- "$args0" ;;
146 | (2) set -- "$args0" "$args1" ;;
147 | (3) set -- "$args0" "$args1" "$args2" ;;
148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154 | esac
155 | fi
156 |
157 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
158 | function splitJvmOpts() {
159 | JVM_OPTS=("$@")
160 | }
161 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
162 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
163 |
164 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
165 |
--------------------------------------------------------------------------------
/android-animation-sample/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/android-animation-sample/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------
/imgs/img_create/android_animation_sample_logo.ai:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hummatli/android-open-animation/7e12e31438c0f259ca276998adb0cb88cba40f9e/imgs/img_create/android_animation_sample_logo.ai
--------------------------------------------------------------------------------
/imgs/img_create/android_animation_sample_logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hummatli/android-open-animation/7e12e31438c0f259ca276998adb0cb88cba40f9e/imgs/img_create/android_animation_sample_logo.png
--------------------------------------------------------------------------------
/imgs/img_create/ic_launcher/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hummatli/android-open-animation/7e12e31438c0f259ca276998adb0cb88cba40f9e/imgs/img_create/ic_launcher/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/imgs/img_create/ic_launcher/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hummatli/android-open-animation/7e12e31438c0f259ca276998adb0cb88cba40f9e/imgs/img_create/ic_launcher/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/imgs/img_create/ic_launcher/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hummatli/android-open-animation/7e12e31438c0f259ca276998adb0cb88cba40f9e/imgs/img_create/ic_launcher/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/imgs/img_create/ic_launcher/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hummatli/android-open-animation/7e12e31438c0f259ca276998adb0cb88cba40f9e/imgs/img_create/ic_launcher/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/imgs/img_create/ic_launcher/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hummatli/android-open-animation/7e12e31438c0f259ca276998adb0cb88cba40f9e/imgs/img_create/ic_launcher/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/imgs/img_create/ic_launcher/web_hi_res_512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hummatli/android-open-animation/7e12e31438c0f259ca276998adb0cb88cba40f9e/imgs/img_create/ic_launcher/web_hi_res_512.png
--------------------------------------------------------------------------------
/screenshots/open_animation.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hummatli/android-open-animation/7e12e31438c0f259ca276998adb0cb88cba40f9e/screenshots/open_animation.gif
--------------------------------------------------------------------------------
/screenshots/start_animation.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hummatli/android-open-animation/7e12e31438c0f259ca276998adb0cb88cba40f9e/screenshots/start_animation.gif
--------------------------------------------------------------------------------