├── AnimatorMenu ├── .classpath ├── .project ├── AndroidManifest.xml ├── ic_launcher-web.png ├── proguard-project.txt ├── project.properties ├── res │ ├── drawable-hdpi │ │ ├── center_icon.png │ │ ├── ic_launcher.png │ │ ├── qf_search2.9.png │ │ └── qf_trig2.png │ ├── drawable-mdpi │ │ └── ic_launcher.png │ ├── drawable-xxhdpi │ │ ├── home_bottom_tab_bg.png │ │ ├── home_icon_normal.png │ │ ├── home_icon_selected.png │ │ ├── ic_launcher.png │ │ ├── image_a.png │ │ ├── image_a_content.png │ │ ├── image_a_icon.png │ │ ├── image_b.png │ │ ├── image_b_content.png │ │ ├── image_b_icon.png │ │ ├── image_c.png │ │ ├── image_c_content.png │ │ ├── image_c_icon.png │ │ ├── image_d.png │ │ ├── image_d_content.png │ │ ├── image_d_icon.png │ │ ├── image_e.png │ │ ├── image_e_content.png │ │ ├── image_e_icon.png │ │ ├── maintab_toolbar_bg.png │ │ ├── map_icon_normal.png │ │ ├── map_icon_selected.png │ │ ├── my_icon_normal.png │ │ ├── my_icon_selected.png │ │ ├── pull_down_icon.png │ │ ├── search_box_bg.9.png │ │ └── search_icon.png │ ├── drawable-xxxhdpi │ │ └── center_image_bg.png │ ├── drawable │ │ ├── home_icon.xml │ │ ├── map_icon.xml │ │ ├── my_icon.xml │ │ └── selector_tab_background.xml │ ├── layout │ │ ├── home_fragment.xml │ │ ├── home_list_item.xml │ │ ├── main_tab_item_view.xml │ │ ├── main_tab_layout.xml │ │ └── view_header_blank.xml │ └── values │ │ ├── attrs.xml │ │ ├── colors.xml │ │ ├── dimens.xml │ │ └── strings.xml └── src │ └── com │ └── clover │ └── menu │ ├── main │ ├── HomeActivity.java │ └── HomeFragment.java │ └── view │ ├── CenterImageView.java │ ├── MenuImageView.java │ ├── MenuLayout.java │ └── ViewPagerAD.java ├── README.md ├── download └── AnimatorMenu.apk └── image └── preview.gif /AnimatorMenu/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /AnimatorMenu/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | AnimatorMenu 4 | 5 | 6 | 7 | 8 | 9 | com.android.ide.eclipse.adt.ResourceManagerBuilder 10 | 11 | 12 | 13 | 14 | com.android.ide.eclipse.adt.PreCompilerBuilder 15 | 16 | 17 | 18 | 19 | org.eclipse.jdt.core.javabuilder 20 | 21 | 22 | 23 | 24 | com.android.ide.eclipse.adt.ApkBuilder 25 | 26 | 27 | 28 | 29 | 30 | com.android.ide.eclipse.adt.AndroidNature 31 | org.eclipse.jdt.core.javanature 32 | 33 | 34 | -------------------------------------------------------------------------------- /AnimatorMenu/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 9 | 10 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /AnimatorMenu/ic_launcher-web.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xuechinahb/AnimatorMenu/b31fe4d540d3cb2c1fcaa9a6712fb045c872b3a5/AnimatorMenu/ic_launcher-web.png -------------------------------------------------------------------------------- /AnimatorMenu/proguard-project.txt: -------------------------------------------------------------------------------- 1 | # To enable ProGuard in your project, edit project.properties 2 | # to define the proguard.config property as described in that file. 3 | # 4 | # Add project specific ProGuard rules here. 5 | # By default, the flags in this file are appended to flags specified 6 | # in ${sdk.dir}/tools/proguard/proguard-android.txt 7 | # You can edit the include path and order by changing the ProGuard 8 | # include property in project.properties. 9 | # 10 | # For more details, see 11 | # http://developer.android.com/guide/developing/tools/proguard.html 12 | 13 | # Add any project specific keep options here: 14 | 15 | # If your project uses WebView with JS, uncomment the following 16 | # and specify the fully qualified class name to the JavaScript interface 17 | # class: 18 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 19 | # public *; 20 | #} 21 | -------------------------------------------------------------------------------- /AnimatorMenu/project.properties: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by Android Tools. 2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED! 3 | # 4 | # This file must be checked in Version Control Systems. 5 | # 6 | # To customize properties used by the Ant build system edit 7 | # "ant.properties", and override values to adapt the script to your 8 | # project structure. 9 | # 10 | # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): 11 | #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt 12 | 13 | # Project target. 14 | target=android-20 15 | -------------------------------------------------------------------------------- /AnimatorMenu/res/drawable-hdpi/center_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xuechinahb/AnimatorMenu/b31fe4d540d3cb2c1fcaa9a6712fb045c872b3a5/AnimatorMenu/res/drawable-hdpi/center_icon.png -------------------------------------------------------------------------------- /AnimatorMenu/res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xuechinahb/AnimatorMenu/b31fe4d540d3cb2c1fcaa9a6712fb045c872b3a5/AnimatorMenu/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /AnimatorMenu/res/drawable-hdpi/qf_search2.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xuechinahb/AnimatorMenu/b31fe4d540d3cb2c1fcaa9a6712fb045c872b3a5/AnimatorMenu/res/drawable-hdpi/qf_search2.9.png -------------------------------------------------------------------------------- /AnimatorMenu/res/drawable-hdpi/qf_trig2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xuechinahb/AnimatorMenu/b31fe4d540d3cb2c1fcaa9a6712fb045c872b3a5/AnimatorMenu/res/drawable-hdpi/qf_trig2.png -------------------------------------------------------------------------------- /AnimatorMenu/res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xuechinahb/AnimatorMenu/b31fe4d540d3cb2c1fcaa9a6712fb045c872b3a5/AnimatorMenu/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /AnimatorMenu/res/drawable-xxhdpi/home_bottom_tab_bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xuechinahb/AnimatorMenu/b31fe4d540d3cb2c1fcaa9a6712fb045c872b3a5/AnimatorMenu/res/drawable-xxhdpi/home_bottom_tab_bg.png -------------------------------------------------------------------------------- /AnimatorMenu/res/drawable-xxhdpi/home_icon_normal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xuechinahb/AnimatorMenu/b31fe4d540d3cb2c1fcaa9a6712fb045c872b3a5/AnimatorMenu/res/drawable-xxhdpi/home_icon_normal.png -------------------------------------------------------------------------------- /AnimatorMenu/res/drawable-xxhdpi/home_icon_selected.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xuechinahb/AnimatorMenu/b31fe4d540d3cb2c1fcaa9a6712fb045c872b3a5/AnimatorMenu/res/drawable-xxhdpi/home_icon_selected.png -------------------------------------------------------------------------------- /AnimatorMenu/res/drawable-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xuechinahb/AnimatorMenu/b31fe4d540d3cb2c1fcaa9a6712fb045c872b3a5/AnimatorMenu/res/drawable-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /AnimatorMenu/res/drawable-xxhdpi/image_a.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xuechinahb/AnimatorMenu/b31fe4d540d3cb2c1fcaa9a6712fb045c872b3a5/AnimatorMenu/res/drawable-xxhdpi/image_a.png -------------------------------------------------------------------------------- /AnimatorMenu/res/drawable-xxhdpi/image_a_content.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xuechinahb/AnimatorMenu/b31fe4d540d3cb2c1fcaa9a6712fb045c872b3a5/AnimatorMenu/res/drawable-xxhdpi/image_a_content.png -------------------------------------------------------------------------------- /AnimatorMenu/res/drawable-xxhdpi/image_a_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xuechinahb/AnimatorMenu/b31fe4d540d3cb2c1fcaa9a6712fb045c872b3a5/AnimatorMenu/res/drawable-xxhdpi/image_a_icon.png -------------------------------------------------------------------------------- /AnimatorMenu/res/drawable-xxhdpi/image_b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xuechinahb/AnimatorMenu/b31fe4d540d3cb2c1fcaa9a6712fb045c872b3a5/AnimatorMenu/res/drawable-xxhdpi/image_b.png -------------------------------------------------------------------------------- /AnimatorMenu/res/drawable-xxhdpi/image_b_content.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xuechinahb/AnimatorMenu/b31fe4d540d3cb2c1fcaa9a6712fb045c872b3a5/AnimatorMenu/res/drawable-xxhdpi/image_b_content.png -------------------------------------------------------------------------------- /AnimatorMenu/res/drawable-xxhdpi/image_b_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xuechinahb/AnimatorMenu/b31fe4d540d3cb2c1fcaa9a6712fb045c872b3a5/AnimatorMenu/res/drawable-xxhdpi/image_b_icon.png -------------------------------------------------------------------------------- /AnimatorMenu/res/drawable-xxhdpi/image_c.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xuechinahb/AnimatorMenu/b31fe4d540d3cb2c1fcaa9a6712fb045c872b3a5/AnimatorMenu/res/drawable-xxhdpi/image_c.png -------------------------------------------------------------------------------- /AnimatorMenu/res/drawable-xxhdpi/image_c_content.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xuechinahb/AnimatorMenu/b31fe4d540d3cb2c1fcaa9a6712fb045c872b3a5/AnimatorMenu/res/drawable-xxhdpi/image_c_content.png -------------------------------------------------------------------------------- /AnimatorMenu/res/drawable-xxhdpi/image_c_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xuechinahb/AnimatorMenu/b31fe4d540d3cb2c1fcaa9a6712fb045c872b3a5/AnimatorMenu/res/drawable-xxhdpi/image_c_icon.png -------------------------------------------------------------------------------- /AnimatorMenu/res/drawable-xxhdpi/image_d.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xuechinahb/AnimatorMenu/b31fe4d540d3cb2c1fcaa9a6712fb045c872b3a5/AnimatorMenu/res/drawable-xxhdpi/image_d.png -------------------------------------------------------------------------------- /AnimatorMenu/res/drawable-xxhdpi/image_d_content.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xuechinahb/AnimatorMenu/b31fe4d540d3cb2c1fcaa9a6712fb045c872b3a5/AnimatorMenu/res/drawable-xxhdpi/image_d_content.png -------------------------------------------------------------------------------- /AnimatorMenu/res/drawable-xxhdpi/image_d_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xuechinahb/AnimatorMenu/b31fe4d540d3cb2c1fcaa9a6712fb045c872b3a5/AnimatorMenu/res/drawable-xxhdpi/image_d_icon.png -------------------------------------------------------------------------------- /AnimatorMenu/res/drawable-xxhdpi/image_e.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xuechinahb/AnimatorMenu/b31fe4d540d3cb2c1fcaa9a6712fb045c872b3a5/AnimatorMenu/res/drawable-xxhdpi/image_e.png -------------------------------------------------------------------------------- /AnimatorMenu/res/drawable-xxhdpi/image_e_content.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xuechinahb/AnimatorMenu/b31fe4d540d3cb2c1fcaa9a6712fb045c872b3a5/AnimatorMenu/res/drawable-xxhdpi/image_e_content.png -------------------------------------------------------------------------------- /AnimatorMenu/res/drawable-xxhdpi/image_e_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xuechinahb/AnimatorMenu/b31fe4d540d3cb2c1fcaa9a6712fb045c872b3a5/AnimatorMenu/res/drawable-xxhdpi/image_e_icon.png -------------------------------------------------------------------------------- /AnimatorMenu/res/drawable-xxhdpi/maintab_toolbar_bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xuechinahb/AnimatorMenu/b31fe4d540d3cb2c1fcaa9a6712fb045c872b3a5/AnimatorMenu/res/drawable-xxhdpi/maintab_toolbar_bg.png -------------------------------------------------------------------------------- /AnimatorMenu/res/drawable-xxhdpi/map_icon_normal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xuechinahb/AnimatorMenu/b31fe4d540d3cb2c1fcaa9a6712fb045c872b3a5/AnimatorMenu/res/drawable-xxhdpi/map_icon_normal.png -------------------------------------------------------------------------------- /AnimatorMenu/res/drawable-xxhdpi/map_icon_selected.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xuechinahb/AnimatorMenu/b31fe4d540d3cb2c1fcaa9a6712fb045c872b3a5/AnimatorMenu/res/drawable-xxhdpi/map_icon_selected.png -------------------------------------------------------------------------------- /AnimatorMenu/res/drawable-xxhdpi/my_icon_normal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xuechinahb/AnimatorMenu/b31fe4d540d3cb2c1fcaa9a6712fb045c872b3a5/AnimatorMenu/res/drawable-xxhdpi/my_icon_normal.png -------------------------------------------------------------------------------- /AnimatorMenu/res/drawable-xxhdpi/my_icon_selected.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xuechinahb/AnimatorMenu/b31fe4d540d3cb2c1fcaa9a6712fb045c872b3a5/AnimatorMenu/res/drawable-xxhdpi/my_icon_selected.png -------------------------------------------------------------------------------- /AnimatorMenu/res/drawable-xxhdpi/pull_down_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xuechinahb/AnimatorMenu/b31fe4d540d3cb2c1fcaa9a6712fb045c872b3a5/AnimatorMenu/res/drawable-xxhdpi/pull_down_icon.png -------------------------------------------------------------------------------- /AnimatorMenu/res/drawable-xxhdpi/search_box_bg.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xuechinahb/AnimatorMenu/b31fe4d540d3cb2c1fcaa9a6712fb045c872b3a5/AnimatorMenu/res/drawable-xxhdpi/search_box_bg.9.png -------------------------------------------------------------------------------- /AnimatorMenu/res/drawable-xxhdpi/search_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xuechinahb/AnimatorMenu/b31fe4d540d3cb2c1fcaa9a6712fb045c872b3a5/AnimatorMenu/res/drawable-xxhdpi/search_icon.png -------------------------------------------------------------------------------- /AnimatorMenu/res/drawable-xxxhdpi/center_image_bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xuechinahb/AnimatorMenu/b31fe4d540d3cb2c1fcaa9a6712fb045c872b3a5/AnimatorMenu/res/drawable-xxxhdpi/center_image_bg.png -------------------------------------------------------------------------------- /AnimatorMenu/res/drawable/home_icon.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /AnimatorMenu/res/drawable/map_icon.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /AnimatorMenu/res/drawable/my_icon.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /AnimatorMenu/res/drawable/selector_tab_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /AnimatorMenu/res/layout/home_fragment.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 15 | 16 | 26 | 27 | 28 | 47 | 48 | 49 | 50 | 59 | 60 | 61 | 68 | 74 | 81 | 92 | 93 | 102 | 111 | 112 | 121 | 122 | 131 | 132 | 141 | 142 | 143 | 150 | 151 | 159 | 160 | 161 | -------------------------------------------------------------------------------- /AnimatorMenu/res/layout/home_list_item.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 14 | 15 | -------------------------------------------------------------------------------- /AnimatorMenu/res/layout/main_tab_item_view.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /AnimatorMenu/res/layout/main_tab_layout.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 12 | 13 | 18 | 19 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /AnimatorMenu/res/layout/view_header_blank.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 15 | 22 | 23 | -------------------------------------------------------------------------------- /AnimatorMenu/res/values/attrs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /AnimatorMenu/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #ffffff 4 | 5 | -------------------------------------------------------------------------------- /AnimatorMenu/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 390dp 6 | 15dp 7 | 12sp 8 | 12dp 9 | 80dp 10 | 120dp 11 | 12 | -------------------------------------------------------------------------------- /AnimatorMenu/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | AnimatorMenu 4 | 5 | 6 | -------------------------------------------------------------------------------- /AnimatorMenu/src/com/clover/menu/main/HomeActivity.java: -------------------------------------------------------------------------------- 1 | package com.clover.menu.main; 2 | 3 | import com.clover.menu.R; 4 | 5 | import android.os.Bundle; 6 | import android.support.v4.app.FragmentActivity; 7 | import android.support.v4.app.FragmentTabHost; 8 | import android.view.LayoutInflater; 9 | import android.view.View; 10 | import android.widget.ImageView; 11 | import android.widget.TabHost.TabSpec; 12 | 13 | public class HomeActivity extends FragmentActivity { 14 | 15 | private FragmentTabHost mTabHost; 16 | private LayoutInflater layoutInflater; 17 | private Class fragmentArray[] = { HomeFragment.class, 18 | HomeFragment.class, HomeFragment.class, 19 | }; 20 | 21 | private int mImageViewArray[] = { R.drawable.home_icon, 22 | R.drawable.map_icon, R.drawable.my_icon }; 23 | 24 | @Override 25 | protected void onCreate(Bundle arg0) { 26 | super.onCreate(arg0); 27 | 28 | setContentView(R.layout.main_tab_layout); 29 | 30 | initView(); 31 | } 32 | 33 | private void initView() { 34 | layoutInflater = LayoutInflater.from(this); 35 | mTabHost = (FragmentTabHost) findViewById(android.R.id.tabhost); 36 | mTabHost.setup(this, getSupportFragmentManager(), R.id.realtabcontent); 37 | int count = fragmentArray.length; 38 | for (int i = 0; i < count; i++) { 39 | TabSpec tabSpec = mTabHost.newTabSpec("").setIndicator( 40 | getTabItemView(i)); 41 | mTabHost.addTab(tabSpec, fragmentArray[i], null); 42 | mTabHost.getTabWidget().getChildAt(i) 43 | .setBackgroundResource(R.drawable.selector_tab_background); 44 | } 45 | } 46 | 47 | private View getTabItemView(int index) { 48 | View view = layoutInflater.inflate(R.layout.main_tab_item_view, null); 49 | ImageView imageView = (ImageView) view.findViewById(R.id.imageview); 50 | imageView.setImageResource(mImageViewArray[index]); 51 | return view; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /AnimatorMenu/src/com/clover/menu/main/HomeFragment.java: -------------------------------------------------------------------------------- 1 | package com.clover.menu.main; 2 | 3 | 4 | import java.util.ArrayList; 5 | import java.util.List; 6 | 7 | import android.animation.Animator; 8 | import android.animation.Animator.AnimatorListener; 9 | import android.animation.AnimatorSet; 10 | import android.animation.ObjectAnimator; 11 | import android.animation.PropertyValuesHolder; 12 | import android.content.Context; 13 | import android.graphics.Color; 14 | import android.os.Bundle; 15 | import android.support.v4.app.Fragment; 16 | import android.support.v4.view.PagerAdapter; 17 | import android.support.v4.view.ViewPager.OnPageChangeListener; 18 | import android.util.DisplayMetrics; 19 | import android.util.SparseIntArray; 20 | import android.view.LayoutInflater; 21 | import android.view.MotionEvent; 22 | import android.view.View; 23 | import android.view.View.OnClickListener; 24 | import android.view.View.OnTouchListener; 25 | import android.view.ViewGroup; 26 | import android.view.ViewPropertyAnimator; 27 | import android.view.ViewTreeObserver; 28 | import android.view.ViewTreeObserver.OnGlobalLayoutListener; 29 | import android.view.WindowManager; 30 | import android.view.animation.LinearInterpolator; 31 | import android.widget.AbsListView; 32 | import android.widget.AbsListView.OnScrollListener; 33 | import android.widget.AdapterView; 34 | import android.widget.AdapterView.OnItemClickListener; 35 | import android.widget.ArrayAdapter; 36 | import android.widget.ListView; 37 | import android.widget.RelativeLayout; 38 | import android.widget.Toast; 39 | 40 | import com.clover.menu.R; 41 | import com.clover.menu.view.CenterImageView; 42 | import com.clover.menu.view.MenuLayout; 43 | import com.clover.menu.view.ViewPagerAD; 44 | 45 | 46 | /** 47 | * @author xuechinahb@gmail.com 48 | * 49 | */ 50 | public class HomeFragment extends Fragment implements OnClickListener{ 51 | /** 52 | * five menus 53 | */ 54 | private MenuLayout imageA, imageB, imageC, imageD, imageE; 55 | /** 56 | * round ImageView in this middle of five menus 57 | */ 58 | private CenterImageView mCenterImageView; 59 | /** 60 | * parent view of five menus 61 | */ 62 | private View mMenuParentView; 63 | 64 | 65 | /** 66 | * header view of {@link #mListView}, a empty view 67 | */ 68 | private View mListHeaderView; 69 | /** 70 | * height of {@link mPlaceHolderView} 71 | */ 72 | private int mListViewHeaderHeight; 73 | /** 74 | * default animation duration 75 | */ 76 | private int mDuration = 300; 77 | 78 | /** 79 | * menu expands or not. 80 | * true: menu expands,forming an arc,touch move {@link #mMenuParentView} left and right to switch menus. 81 | * false: menu collapses, five menus is at the same horizontal lines. at this time, you can't touch move {@link #mMenuParentView} left and right to switch menus. 82 | */ 83 | private boolean mExpandFlag = true; 84 | /** 85 | * scale animation value of the middle menu 86 | */ 87 | private float mScaleValue = 1.35f; 88 | private ListView mListView; 89 | 90 | /** 91 | * used to get coordinate, width and height of some views, {@link #onCreateView(LayoutInflater, ViewGroup, Bundle)}, only once 92 | */ 93 | private boolean mFlag; 94 | /** 95 | * ad. 96 | */ 97 | private ViewPagerAD mViewPager; 98 | /** 99 | * begin and end coordinate of {@link #mViewPager} animation. when scroll up an down {@link #mListView}, 100 | * {@link #mViewPager} load translate animation in the y direction. 101 | */ 102 | private float mViewPagerBeginY, mViewPagerEndY; 103 | 104 | /** 105 | * search box 106 | */ 107 | private View mLayoutSearch; 108 | 109 | /** 110 | * frame layout, it contains {@link #mMenuParentView}, {@link #blankView}, {@link #mViewPager} 111 | */ 112 | private View mLayoutFrame; 113 | /** 114 | * blank view, background is yellow 115 | */ 116 | private View blankView; 117 | /** 118 | * begin and end coordinate of {@link #mLayoutFrame} animation. 119 | */ 120 | private float layoutFrameBeginY, layoutFrameEndY; 121 | /** 122 | * scroll offset of {@link #mListView}, 123 | */ 124 | private float listScrollOffset; 125 | /** 126 | * touch flag. if false, block {@link #mListView} to call onScroll(AbsListView view, int firstVisibleItem, 127 | * int visibleItemCount, int totalItemCount) 128 | */ 129 | private boolean touchScrollFlag; 130 | @Override 131 | public View onCreateView(LayoutInflater inflater, ViewGroup container, 132 | Bundle savedInstanceState) { 133 | 134 | View view = inflater.inflate(R.layout.home_fragment, container, false); 135 | initView(view); 136 | ViewTreeObserver vto = view.getViewTreeObserver(); 137 | vto.addOnGlobalLayoutListener(new OnGlobalLayoutListener() { 138 | 139 | @Override 140 | public void onGlobalLayout() { 141 | if (!mFlag) { 142 | calCoordinate(); 143 | mListViewHeaderHeight = mListHeaderView.getHeight(); 144 | layoutFrameBeginY = mLayoutFrame.getY(); 145 | layoutFrameEndY = layoutFrameBeginY - blankView.getMeasuredHeight(); 146 | imageCircleAnim = ObjectAnimator.ofFloat(mCenterImageView, "y", -mCenterImageView.getMeasuredHeight()).setDuration(mDuration); 147 | imageCircleAnim.setInterpolator(new LinearInterpolator()); 148 | initTranslationYAnim(); 149 | mFlag = true; 150 | int offsetY = getResources().getDimensionPixelSize(R.dimen.ad_offsety); 151 | mViewPagerBeginY = mViewPager.getY(); 152 | 153 | mViewPagerEndY = blankView.getY() + blankView.getMeasuredHeight() + imageAEndY + imageA.getMeasuredHeight() + offsetY; 154 | listScrollOffset = imageAEndY + imageA.getMeasuredHeight()+ mViewPager.getMeasuredHeight() 155 | + offsetY; 156 | 157 | android.widget.RelativeLayout.LayoutParams layoutParam = new android.widget.RelativeLayout.LayoutParams(android.widget.RelativeLayout.LayoutParams.MATCH_PARENT, (int) (listScrollOffset - getResources().getDimensionPixelSize(R.dimen.blank_view_height))); 158 | layoutParam.addRule(RelativeLayout.BELOW, R.id.blank_view); 159 | getView().findViewById(R.id.blank_color_view). 160 | setLayoutParams(layoutParam); 161 | } 162 | 163 | } 164 | }); 165 | return view; 166 | } 167 | 168 | private ObjectAnimator imageCircleAnim; 169 | private boolean mSrollStopFlag = true; 170 | 171 | private void initView(View view) { 172 | 173 | WindowManager wm = (WindowManager) getActivity().getSystemService(Context.WINDOW_SERVICE); 174 | DisplayMetrics dm = new DisplayMetrics(); 175 | wm.getDefaultDisplay().getMetrics(dm); 176 | 177 | imageA = (MenuLayout) view.findViewById(R.id.img_a); 178 | imageA.setOnClickListener(this); 179 | imageB = (MenuLayout) view.findViewById(R.id.img_b); 180 | imageB.setOnClickListener(this); 181 | imageC = (MenuLayout) view.findViewById(R.id.img_c); 182 | imageC.setOnClickListener(this); 183 | imageD = (MenuLayout) view.findViewById(R.id.img_d); 184 | imageD.setOnClickListener(this); 185 | imageE = (MenuLayout) view.findViewById(R.id.img_e); 186 | imageE.setOnClickListener(this); 187 | mCenterImageView = (CenterImageView) view.findViewById(R.id.circle); 188 | mLayoutSearch = view.findViewById(R.id.layout_search); 189 | mMenuParentView = view.findViewById(R.id.layout_menu); 190 | mLayoutFrame = view.findViewById(R.id.layout_frame); 191 | blankView = view.findViewById(R.id.blank_view); 192 | mLayoutSearch.bringToFront(); 193 | 194 | mViewPager = (ViewPagerAD) view.findViewById(R.id.viewPager); 195 | View view1 = new View(getActivity()); 196 | view1.setBackgroundColor(Color.BLUE); 197 | View view2 = new View(getActivity()); 198 | view2.setBackgroundColor(Color.GREEN); 199 | View view3 = new View(getActivity()); 200 | view3.setBackgroundColor(Color.RED); 201 | final View[] views = {view1, view2, view3}; 202 | PagerAdapter pagerAdapter = new PagerAdapter() { 203 | 204 | @Override 205 | public boolean isViewFromObject(View arg0, Object arg1) { 206 | 207 | return arg0 == arg1; 208 | } 209 | 210 | @Override 211 | public int getCount() { 212 | 213 | return views.length; 214 | } 215 | 216 | @Override 217 | public void destroyItem(ViewGroup container, int position, 218 | Object object) { 219 | container.removeView(views[position]); 220 | 221 | } 222 | 223 | 224 | 225 | @Override 226 | public Object instantiateItem(ViewGroup container, int position) { 227 | container.addView(views[position]); 228 | return views[position]; 229 | } 230 | 231 | }; 232 | mViewPager.setAdapter(pagerAdapter); 233 | mViewPager.setOnPageChangeListener(new OnPageChangeListener() { 234 | 235 | @Override 236 | public void onPageSelected(int arg0) { 237 | mViewPager.setCurrentItem(arg0); 238 | } 239 | 240 | @Override 241 | public void onPageScrolled(int arg0, float arg1, int arg2) { 242 | 243 | } 244 | 245 | @Override 246 | public void onPageScrollStateChanged(int arg0) { 247 | } 248 | }); 249 | 250 | mListView = (ListView) view.findViewById(R.id.listview); 251 | mListHeaderView = getActivity().getLayoutInflater().inflate(R.layout.view_header_blank, mListView, false); 252 | mListView.addHeaderView(mListHeaderView); 253 | List list = new ArrayList(); 254 | for (int i = 0; i < 20; i++) { 255 | if(i == 0) list.add("scroll listview or touch move menu view " ); 256 | else list.add("Item " + i); 257 | 258 | } 259 | ArrayAdapter adapter = new ArrayAdapter(getActivity(),R.layout.home_list_item, android.R.id.text1, list); 260 | mListView.setAdapter(adapter); 261 | mListView.setOnTouchListener(new OnTouchListener() { 262 | 263 | @Override 264 | public boolean onTouch(View v, MotionEvent event) { 265 | if (mListView.getFirstVisiblePosition() == 0) { 266 | initTranslationYAnim(); 267 | } 268 | return false; 269 | } 270 | }); 271 | mListView.setOnScrollListener(new OnScrollListener() {// fill data at first time, although not use finger to scroll listview, onsroll(***) can be called. 272 | 273 | @Override 274 | public void onScrollStateChanged(AbsListView view, int scrollState) { 275 | mSrollStopFlag = false; 276 | if (scrollState == SCROLL_STATE_TOUCH_SCROLL) { 277 | touchScrollFlag = true; 278 | } 279 | if (!touchScrollFlag) { 280 | return; 281 | } 282 | 283 | if (scrollState == SCROLL_STATE_IDLE) { 284 | System.out.println("scrolling stopped..."); 285 | mSrollStopFlag = true; 286 | float scrollHeight = getScrollY(); 287 | // if (scrollHeight >= mListView.getChildAt(0).getHeight() - imageA.getHeight()) { 288 | // return; 289 | // } 290 | if (scrollHeight >= mListView.getChildAt(0).getHeight() - listScrollOffset) { 291 | mExpandFlag = false; 292 | return; 293 | } 294 | 295 | int tempHeight = (int) ((mViewPagerBeginY - mViewPagerEndY )/ 2); 296 | if (scrollHeight < tempHeight) {//distance of scroll up is small, revert previous location, menus is expanded. 297 | mExpandFlag = true; 298 | mListView.postDelayed(new Runnable() { 299 | 300 | @Override 301 | public void run() { 302 | mListView.smoothScrollToPositionFromTop(0, 0, 200); 303 | } 304 | }, 50); 305 | }else {//menu collapses 306 | 307 | mExpandFlag = false; 308 | mListView.postDelayed(new Runnable() { 309 | 310 | @Override 311 | public void run() { 312 | mListView.smoothScrollToPositionFromTop(1, (int) listScrollOffset, 200); 313 | } 314 | }, 50); 315 | } 316 | 317 | } 318 | 319 | } 320 | 321 | @Override 322 | public void onScroll(AbsListView view, int firstVisibleItem, 323 | int visibleItemCount, int totalItemCount) { 324 | if (!touchScrollFlag) { 325 | return; 326 | } 327 | float scrollY = getScrollY(); 328 | if (view.getFirstVisiblePosition() > 0) { 329 | return; 330 | } 331 | updateTranslationYAnim((int)(scrollY / (mListViewHeaderHeight - listScrollOffset ) * (mDuration))); 332 | } 333 | }); 334 | 335 | mMenuParentView.setOnTouchListener(new OnTouchListener() { 336 | 337 | boolean moveToLeftFlag; 338 | 339 | /** 340 | * move left or right, up or down. if true, block menu being clicked. 341 | */ 342 | boolean moveFlag; 343 | boolean moveHorizontalFlag, moveVerticalFlag; 344 | @Override 345 | public boolean onTouch(View v, MotionEvent event) { 346 | // if (!mExpandFlag) { 347 | // return false; 348 | // } 349 | touchScrollFlag = true; 350 | initMoveLeftAnim(); 351 | initMoveRightAnim(); 352 | initTranslationYAnim(); 353 | switch (event.getAction()) { 354 | case MotionEvent.ACTION_DOWN: 355 | lastX = event.getX(); 356 | lastY = event.getY(); 357 | moveToLeftFlag = false; 358 | moveFlag = false; 359 | moveHorizontalFlag = false; 360 | moveVerticalFlag = false; 361 | break; 362 | case MotionEvent.ACTION_MOVE: 363 | if (moveHorizontalFlag) { 364 | if((event.getX() - lastX) > 15){// move right 365 | moveFlag = true; 366 | moveToLeftFlag = false; 367 | moveHorizontalFlag = true; 368 | if(mExpandFlag){ 369 | updateMoveRightAnim((long)((event.getX() - lastX) / ( imageEBeginX - imageABeginX) * mDuration )); 370 | } 371 | }else if((lastX - event.getX()) >15){// move left 372 | moveFlag = true; 373 | moveToLeftFlag = true; 374 | moveHorizontalFlag = true; 375 | if(mExpandFlag){ 376 | updateMoveLeftAnim((long)((Math.abs(event.getX() - lastX)) / ( imageEBeginX - imageABeginX) * mDuration )); 377 | } 378 | } 379 | }else{ 380 | if(lastY - event.getY() > 15){ // move up 381 | if (!moveVerticalFlag) { 382 | moveVerticalFlag = true; 383 | moveFlag = true; 384 | if (!moveHorizontalFlag) { 385 | if (mExpandFlag) { 386 | mExpandFlag = false; 387 | mListView.smoothScrollBy( (int) (listScrollOffset), 500); 388 | } 389 | } 390 | } 391 | 392 | }else if(event.getY() - lastY > 15){ // move down 393 | if(mExpandFlag && mSrollStopFlag) moveHorizontalFlag = true;//will call updateMoveRightAnim(...) or updateMoveLeftAnim(...) 394 | else moveHorizontalFlag = false; 395 | 396 | if (!moveVerticalFlag) { 397 | moveVerticalFlag = true; 398 | moveFlag = true; 399 | if (!moveHorizontalFlag) { 400 | mExpandFlag = true; 401 | mListView.smoothScrollToPositionFromTop(0, 0, 200); 402 | } 403 | } 404 | }else { 405 | if(Math.abs((event.getX() - lastX)) > 15) moveHorizontalFlag = true; 406 | } 407 | } 408 | 409 | break; 410 | case MotionEvent.ACTION_UP: 411 | if (!moveFlag) { 412 | if (isClickMenuLayout(event, imageA)) { 413 | onClick(imageA); 414 | }else if(isClickMenuLayout(event, imageB)) { 415 | onClick(imageB); 416 | }else if(isClickMenuLayout(event, imageC)) { 417 | onClick(imageC); 418 | }else if(isClickMenuLayout(event, imageD)) { 419 | onClick(imageD); 420 | }else if(isClickMenuLayout(event, imageE)) { 421 | onClick(imageE); 422 | } 423 | }else if(moveHorizontalFlag){ 424 | if (moveToLeftFlag) { 425 | finishMoveLeftAnim(); 426 | }else{ 427 | finishMoveRightAnim(); 428 | } 429 | 430 | } 431 | break; 432 | default: 433 | break; 434 | } 435 | 436 | return true; 437 | } 438 | }); 439 | 440 | } 441 | private boolean isClickMenuLayout(MotionEvent event, MenuLayout menuLayout){ 442 | return event.getX() >= menuLayout.getX() && event.getX() <= menuLayout.getX() + menuLayout.getMeasuredWidth() 443 | && event.getY() >= menuLayout.getY() && event.getY() <= menuLayout.getY() + menuLayout.getMeasuredHeight(); 444 | } 445 | 446 | private SparseIntArray listViewItemHeights = new SparseIntArray(); 447 | 448 | private int getScrollY() { 449 | if (mListView.getChildAt(1) == null) { 450 | return 0; 451 | } 452 | View c = mListView.getChildAt(0); 453 | int scrollY = -c.getTop(); 454 | listViewItemHeights.put(mListView.getFirstVisiblePosition(), c.getHeight()); 455 | for (int i = 0; i < mListView.getFirstVisiblePosition(); ++i) { 456 | if (listViewItemHeights.get(i) != 0) 457 | scrollY += listViewItemHeights.get(i); 458 | } 459 | return scrollY; 460 | } 461 | 462 | private float lastX, lastY; 463 | 464 | private float imageABeginX, imageABeginY; 465 | private float imageBBeginX, imageBBeginY; 466 | private float imageCBeginX, imageCBeginY; 467 | private float imageDBeginX, imageDBeginY; 468 | private float imageEBeginX, imageEBeginY; 469 | 470 | private float imageAEndX, imageAEndY; 471 | private float imageBEndX, imageBEndY; 472 | private float imageCEndX, imageCEndY; 473 | private float imageDEndX, imageDEndY; 474 | private float imageEEndX, imageEEndY; 475 | 476 | /** 477 | * index is consistent with mIndexLable member variable of {@link MenuLayout} 478 | */ 479 | private float[] beginCoordinateXs,beginCoordinateYs, endCoordinateXs, endCoordinateYs; 480 | private float yOffset = 2f; 481 | 482 | void calCoordinate(){ 483 | float iconSize = imageA.getMeasuredWidth(); 484 | float width = mMenuParentView.getWidth(); 485 | float gap = (width - 5 * iconSize) / 4; 486 | imageBBeginX = iconSize + gap; 487 | imageCBeginX = imageBBeginX * 2; 488 | imageDBeginX = imageBBeginX * 3; 489 | float radius = imageCBeginX; 490 | imageABeginX = (float) (imageCBeginX - radius * Math.cos(20*Math.PI/180)); 491 | imageEBeginX = (float) (imageCBeginX + radius * Math.cos(20*Math.PI/180)); 492 | 493 | imageABeginY = (float) (radius * Math.sin(20*Math.PI/180)); 494 | imageEBeginY = imageDBeginY = imageCBeginY = imageBBeginY = imageABeginY; 495 | 496 | 497 | imageAEndX = imageABeginX; 498 | imageAEndY = imageABeginY; 499 | imageEEndY = imageEBeginY; 500 | imageBEndX = (float) (imageCBeginX - radius * Math.cos(55*Math.PI/180)); 501 | imageBEndY = (float)(radius * Math.sin(55*Math.PI/180)) - yOffset; 502 | 503 | 504 | imageCEndX = imageCBeginX; 505 | imageCEndY = radius - yOffset; 506 | imageDEndX = (float) (imageCBeginX + radius * Math.cos(55*Math.PI/180)); 507 | imageDEndY = imageBEndY; 508 | imageEEndX = imageEBeginX; 509 | 510 | float offsetY = (float) (radius * Math.sin(20*Math.PI/180)); 511 | imageABeginX = 0; 512 | imageABeginY = 0; 513 | imageAEndX = 0; 514 | imageAEndY = 0; 515 | imageEBeginY = 0; 516 | imageEEndY = 0; 517 | 518 | imageBBeginY = 0; 519 | imageBEndY -= offsetY; 520 | imageCBeginY = 0; 521 | imageCEndY -= offsetY; 522 | imageDBeginY = 0; 523 | imageDEndY -= offsetY; 524 | 525 | 526 | beginCoordinateXs = new float[]{imageABeginX,imageEBeginX,imageDBeginX,imageCBeginX, imageBBeginX}; 527 | beginCoordinateYs = new float[]{imageABeginY, imageEBeginY ,imageDBeginY,imageCBeginY ,imageBBeginY}; 528 | endCoordinateXs = new float[]{imageAEndX,imageEEndX,imageDEndX,imageCEndX, imageBEndX}; 529 | endCoordinateYs = new float[]{imageAEndY, imageEEndY ,imageDEndY,imageCEndY ,imageBEndY}; 530 | 531 | ObjectAnimator imageA_translate_x = ObjectAnimator.ofFloat(imageA, "x", imageCBeginX, 0); 532 | ObjectAnimator imageB_translate_x = ObjectAnimator.ofFloat(imageB, "x", imageCBeginX, imageBEndX); 533 | ObjectAnimator imageB_translate_y = ObjectAnimator.ofFloat(imageB, "y", 0, imageBEndY); 534 | ObjectAnimator imageC_translate_y = ObjectAnimator.ofFloat(imageC, "y", 0, imageCEndY); 535 | ObjectAnimator imageC_scale_x= ObjectAnimator.ofFloat(imageC, "scaleX", mScaleValue); 536 | ObjectAnimator imageC_scale_y= ObjectAnimator.ofFloat(imageC, "scaleY", mScaleValue); 537 | ObjectAnimator imageD_translate_x = ObjectAnimator.ofFloat(imageD, "x", imageCBeginX, imageDEndX); 538 | ObjectAnimator imageD_translate_y = ObjectAnimator.ofFloat(imageD, "y", 0, imageDEndY); 539 | ObjectAnimator imageE_translate_x = ObjectAnimator.ofFloat(imageE, "x", imageCBeginX, imageEBeginX); 540 | 541 | ObjectAnimator headerAlpha = ObjectAnimator.ofFloat(mMenuParentView, "alpha", 0, 0.65f); 542 | headerAlpha.setDuration(1200); 543 | 544 | 545 | AnimatorSet translateSet = new AnimatorSet(); 546 | translateSet.playTogether(imageA_translate_x, imageB_translate_x, imageB_translate_y, 547 | imageC_translate_y, imageC_scale_x, imageC_scale_y, 548 | imageD_translate_x, imageD_translate_y, 549 | imageE_translate_x); 550 | translateSet.setDuration(1000); 551 | AnimatorSet set = new AnimatorSet(); 552 | set.play(translateSet).with(headerAlpha); 553 | headerAlpha.addListener(new AnimatorListener() { 554 | 555 | @Override 556 | public void onAnimationStart(Animator animation) { 557 | 558 | } 559 | 560 | @Override 561 | public void onAnimationRepeat(Animator animation) { 562 | 563 | } 564 | 565 | @Override 566 | public void onAnimationEnd(Animator animation) { 567 | imageA.updateContent("Menu-1"); 568 | imageB.updateContent("Menu-2"); 569 | imageC.updateContent("Menu-3"); 570 | imageD.updateContent("Menu-4"); 571 | imageE.updateContent("Menu-5"); 572 | ViewPropertyAnimator amimator = mMenuParentView.animate().alpha(1).setDuration(400); 573 | amimator.start(); 574 | amimator.setListener(new AnimatorListener() { 575 | 576 | @Override 577 | public void onAnimationStart(Animator animation) { 578 | 579 | } 580 | 581 | @Override 582 | public void onAnimationRepeat(Animator animation) { 583 | 584 | } 585 | 586 | @Override 587 | public void onAnimationEnd(Animator animation) { 588 | } 589 | 590 | @Override 591 | public void onAnimationCancel(Animator animation) { 592 | 593 | 594 | } 595 | }); 596 | } 597 | 598 | @Override 599 | public void onAnimationCancel(Animator animation) { 600 | 601 | } 602 | }); 603 | 604 | set.start(); 605 | } 606 | 607 | @Override 608 | public void onClick(View v) { 609 | MenuLayout menuLayout = (MenuLayout) v; 610 | if (!mExpandFlag) { 611 | Toast.makeText(getActivity(), menuLayout.getTextView().getText(), Toast.LENGTH_SHORT).show(); 612 | return; 613 | } 614 | switch (menuLayout.getIndexLable()) { 615 | case 0: 616 | moveLeftAnim2(); 617 | break; 618 | case 1: 619 | moveRightAnim2(); 620 | break; 621 | case 2: 622 | moveRightAnim(); 623 | break; 624 | case 3: 625 | Toast.makeText(getActivity(), menuLayout.getTextView().getText(), Toast.LENGTH_SHORT).show(); 626 | break; 627 | case 4: 628 | moveLeftAnim(); 629 | break; 630 | default: 631 | break; 632 | } 633 | 634 | } 635 | 636 | 637 | /** 638 | * click menu, move to right, clockwise direction. 639 | */ 640 | public void moveRightAnim(){ 641 | PropertyValuesHolder imageA_translate_x = PropertyValuesHolder.ofFloat("x", endCoordinateXs[imageE.getIndexLable()]); 642 | PropertyValuesHolder imageA_translate_y = PropertyValuesHolder.ofFloat("y", endCoordinateYs[imageE.getIndexLable()]); 643 | ObjectAnimator imageAAnimator = null; 644 | if (imageA.getIndexLable() % 5 == 3) { 645 | PropertyValuesHolder imageA_scale_x = PropertyValuesHolder.ofFloat("scaleX", 1); 646 | PropertyValuesHolder imageA_scale_y = PropertyValuesHolder.ofFloat("scaleY", 1); 647 | imageAAnimator = ObjectAnimator.ofPropertyValuesHolder(imageA, imageA_translate_x, imageA_translate_y, imageA_scale_x, imageA_scale_y); 648 | }else if(imageA.getIndexLable() % 5 == 2){ 649 | PropertyValuesHolder imageA_scale_x = PropertyValuesHolder.ofFloat("scaleX", mScaleValue); 650 | PropertyValuesHolder imageA_scale_y = PropertyValuesHolder.ofFloat("scaleY", mScaleValue); 651 | imageAAnimator = ObjectAnimator.ofPropertyValuesHolder(imageA, imageA_translate_x, imageA_translate_y, imageA_scale_x, imageA_scale_y); 652 | }else{ 653 | imageAAnimator = ObjectAnimator.ofPropertyValuesHolder(imageA, imageA_translate_x, imageA_translate_y); 654 | } 655 | 656 | PropertyValuesHolder imageB_translate_x = PropertyValuesHolder.ofFloat("x", endCoordinateXs[imageA.getIndexLable()]); 657 | PropertyValuesHolder imageB_translate_y = PropertyValuesHolder.ofFloat("y",endCoordinateYs[imageA.getIndexLable()]); 658 | ObjectAnimator imageBAnimator = null; 659 | if (imageB.getIndexLable() % 5 == 3) { 660 | PropertyValuesHolder imageB_scale_x = PropertyValuesHolder.ofFloat("scaleX", 1); 661 | PropertyValuesHolder imageB_scale_y = PropertyValuesHolder.ofFloat("scaleY", 1); 662 | imageBAnimator = ObjectAnimator.ofPropertyValuesHolder(imageB, imageB_translate_x, imageB_translate_y, imageB_scale_x, imageB_scale_y); 663 | }else if(imageB.getIndexLable() % 5 == 2){ 664 | PropertyValuesHolder imageB_scale_x = PropertyValuesHolder.ofFloat("scaleX", mScaleValue); 665 | PropertyValuesHolder imageB_scale_y = PropertyValuesHolder.ofFloat("scaleY", mScaleValue); 666 | imageBAnimator = ObjectAnimator.ofPropertyValuesHolder(imageB, imageB_translate_x, imageB_translate_y, imageB_scale_x, imageB_scale_y); 667 | }else{ 668 | imageBAnimator = ObjectAnimator.ofPropertyValuesHolder(imageB, imageB_translate_x, imageB_translate_y); 669 | } 670 | 671 | PropertyValuesHolder imageC_translate_x = PropertyValuesHolder.ofFloat("x",endCoordinateXs[imageB.getIndexLable()]); 672 | PropertyValuesHolder imageC_translate_y = PropertyValuesHolder.ofFloat("y",endCoordinateYs[imageB.getIndexLable()]); 673 | ObjectAnimator imageCAnimator = null; 674 | if (imageC.getIndexLable() % 5 == 3) { 675 | PropertyValuesHolder imageC_scale_x = PropertyValuesHolder.ofFloat("scaleX", 1); 676 | PropertyValuesHolder imageC_scale_y = PropertyValuesHolder.ofFloat("scaleY", 1); 677 | imageCAnimator = ObjectAnimator.ofPropertyValuesHolder(imageC, imageC_translate_x, imageC_translate_y, imageC_scale_x, imageC_scale_y); 678 | }else if(imageC.getIndexLable() % 5 == 2){ 679 | PropertyValuesHolder imageC_scale_x = PropertyValuesHolder.ofFloat("scaleX", mScaleValue); 680 | PropertyValuesHolder imageC_scale_y = PropertyValuesHolder.ofFloat("scaleY", mScaleValue); 681 | imageCAnimator = ObjectAnimator.ofPropertyValuesHolder(imageC, imageC_translate_x, imageC_translate_y, imageC_scale_x, imageC_scale_y); 682 | }else{ 683 | imageCAnimator = ObjectAnimator.ofPropertyValuesHolder(imageC, imageC_translate_x, imageC_translate_y); 684 | } 685 | 686 | PropertyValuesHolder imageD_translate_x = PropertyValuesHolder.ofFloat("x" ,endCoordinateXs[imageC.getIndexLable()]); 687 | PropertyValuesHolder imageD_translate_y = PropertyValuesHolder.ofFloat("y", endCoordinateYs[imageC.getIndexLable()]); 688 | ObjectAnimator imageDAnimator = null; 689 | if (imageD.getIndexLable() % 5 == 3) { 690 | PropertyValuesHolder imageD_scale_x = PropertyValuesHolder.ofFloat("scaleX", 1); 691 | PropertyValuesHolder imageD_scale_y = PropertyValuesHolder.ofFloat("scaleY", 1); 692 | imageDAnimator = ObjectAnimator.ofPropertyValuesHolder(imageD, imageD_translate_x, imageD_translate_y, imageD_scale_x, imageD_scale_y); 693 | }else if(imageD.getIndexLable() % 5 == 2){ 694 | PropertyValuesHolder imageD_scale_x = PropertyValuesHolder.ofFloat("scaleX", mScaleValue); 695 | PropertyValuesHolder imageD_scale_y = PropertyValuesHolder.ofFloat("scaleY", mScaleValue); 696 | imageDAnimator = ObjectAnimator.ofPropertyValuesHolder(imageD, imageD_translate_x, imageD_translate_y, imageD_scale_x, imageD_scale_y); 697 | }else{ 698 | imageDAnimator = ObjectAnimator.ofPropertyValuesHolder(imageD, imageD_translate_x, imageD_translate_y); 699 | } 700 | 701 | PropertyValuesHolder imageE_translate_x = PropertyValuesHolder.ofFloat("x",endCoordinateXs[imageD.getIndexLable()]); 702 | PropertyValuesHolder imageE_translate_y = PropertyValuesHolder.ofFloat("y", endCoordinateYs[imageD.getIndexLable()]); 703 | ObjectAnimator imageEAnimator = null; 704 | if (imageE.getIndexLable() % 5 == 3) { 705 | PropertyValuesHolder imageE_scale_x = PropertyValuesHolder.ofFloat("scaleX", 1); 706 | PropertyValuesHolder imageE_scale_y = PropertyValuesHolder.ofFloat("scaleY", 1); 707 | imageEAnimator = ObjectAnimator.ofPropertyValuesHolder(imageE, imageE_translate_x, imageE_translate_y, imageE_scale_x, imageE_scale_y); 708 | }else if(imageE.getIndexLable() % 5 == 2){ 709 | PropertyValuesHolder imageE_scale_x = PropertyValuesHolder.ofFloat("scaleX", mScaleValue); 710 | PropertyValuesHolder imageE_scale_y = PropertyValuesHolder.ofFloat("scaleY", mScaleValue); 711 | imageEAnimator = ObjectAnimator.ofPropertyValuesHolder(imageE, imageE_translate_x, imageE_translate_y, imageE_scale_x, imageE_scale_y); 712 | }else{ 713 | imageEAnimator = ObjectAnimator.ofPropertyValuesHolder(imageE, imageE_translate_x, imageE_translate_y); 714 | } 715 | 716 | setRightIndex(); 717 | AnimatorSet set = new AnimatorSet(); 718 | set.setDuration(mDuration); 719 | set.playTogether(imageAAnimator, imageBAnimator, imageCAnimator, imageDAnimator, imageEAnimator); 720 | set.start(); 721 | 722 | } 723 | 724 | 725 | /** 726 | * move right twice 727 | */ 728 | public void moveRightAnim2(){ 729 | PropertyValuesHolder imageA_translate_x = PropertyValuesHolder.ofFloat("x", endCoordinateXs[imageE.getIndexLable()]); 730 | PropertyValuesHolder imageA_translate_y = PropertyValuesHolder.ofFloat("y", endCoordinateYs[imageE.getIndexLable()]); 731 | ObjectAnimator imageAAnimator = null; 732 | if (imageA.getIndexLable() == 3) { 733 | PropertyValuesHolder imageA_scale_x = PropertyValuesHolder.ofFloat("scaleX", 1); 734 | PropertyValuesHolder imageA_scale_y = PropertyValuesHolder.ofFloat("scaleY", 1); 735 | imageAAnimator = ObjectAnimator.ofPropertyValuesHolder(imageA, imageA_translate_x, imageA_translate_y, imageA_scale_x, imageA_scale_y); 736 | }else if(imageA.getIndexLable() == 2){ 737 | PropertyValuesHolder imageA_scale_x = PropertyValuesHolder.ofFloat("scaleX", mScaleValue); 738 | PropertyValuesHolder imageA_scale_y = PropertyValuesHolder.ofFloat("scaleY", mScaleValue); 739 | imageAAnimator = ObjectAnimator.ofPropertyValuesHolder(imageA, imageA_translate_x, imageA_translate_y, imageA_scale_x, imageA_scale_y); 740 | }else{ 741 | imageAAnimator = ObjectAnimator.ofPropertyValuesHolder(imageA, imageA_translate_x, imageA_translate_y); 742 | } 743 | 744 | 745 | PropertyValuesHolder imageB_translate_x = PropertyValuesHolder.ofFloat("x" , endCoordinateXs[imageA.getIndexLable()]); 746 | PropertyValuesHolder imageB_translate_y = PropertyValuesHolder.ofFloat("y", endCoordinateYs[imageA.getIndexLable()]); 747 | ObjectAnimator imageBAnimator = null; 748 | if (imageB.getIndexLable() == 3) { 749 | PropertyValuesHolder imageB_scale_x = PropertyValuesHolder.ofFloat("scaleX", 1); 750 | PropertyValuesHolder imageB_scale_y = PropertyValuesHolder.ofFloat("scaleY", 1); 751 | imageBAnimator = ObjectAnimator.ofPropertyValuesHolder(imageB, imageB_translate_x, imageB_translate_y, imageB_scale_x, imageB_scale_y); 752 | }else if(imageB.getIndexLable() == 2){ 753 | PropertyValuesHolder imageB_scale_x = PropertyValuesHolder.ofFloat("scaleX", mScaleValue); 754 | PropertyValuesHolder imageB_scale_y = PropertyValuesHolder.ofFloat("scaleY", mScaleValue); 755 | imageBAnimator = ObjectAnimator.ofPropertyValuesHolder(imageB, imageB_translate_x, imageB_translate_y, imageB_scale_x, imageB_scale_y); 756 | }else{ 757 | imageBAnimator = ObjectAnimator.ofPropertyValuesHolder(imageB, imageB_translate_x, imageB_translate_y); 758 | } 759 | 760 | PropertyValuesHolder imageC_translate_x = PropertyValuesHolder.ofFloat("x", endCoordinateXs[imageB.getIndexLable()]); 761 | PropertyValuesHolder imageC_translate_y = PropertyValuesHolder.ofFloat("y", endCoordinateYs[imageB.getIndexLable()]); 762 | ObjectAnimator imageCAnimator = null; 763 | if (imageC.getIndexLable() == 3) { 764 | PropertyValuesHolder imageC_scale_x = PropertyValuesHolder.ofFloat("scaleX", 1); 765 | PropertyValuesHolder imageC_scale_y = PropertyValuesHolder.ofFloat("scaleY", 1); 766 | imageCAnimator = ObjectAnimator.ofPropertyValuesHolder(imageC, imageC_translate_x, imageC_translate_y, imageC_scale_x, imageC_scale_y); 767 | }else if(imageC.getIndexLable() == 2){ 768 | PropertyValuesHolder imageC_scale_x = PropertyValuesHolder.ofFloat("scaleX", mScaleValue); 769 | PropertyValuesHolder imageC_scale_y = PropertyValuesHolder.ofFloat("scaleY", mScaleValue); 770 | imageCAnimator = ObjectAnimator.ofPropertyValuesHolder(imageC, imageC_translate_x, imageC_translate_y, imageC_scale_x, imageC_scale_y); 771 | }else{ 772 | imageCAnimator = ObjectAnimator.ofPropertyValuesHolder(imageC, imageC_translate_x, imageC_translate_y); 773 | } 774 | 775 | PropertyValuesHolder imageD_translate_x = PropertyValuesHolder.ofFloat("x" ,endCoordinateXs[imageC.getIndexLable()]); 776 | PropertyValuesHolder imageD_translate_y = PropertyValuesHolder.ofFloat("y",endCoordinateYs[imageC.getIndexLable()]); 777 | ObjectAnimator imageDAnimator = null; 778 | if (imageD.getIndexLable() == 3) { 779 | PropertyValuesHolder imageD_scale_x = PropertyValuesHolder.ofFloat("scaleX", 1); 780 | PropertyValuesHolder imageD_scale_y = PropertyValuesHolder.ofFloat("scaleY", 1); 781 | imageDAnimator = ObjectAnimator.ofPropertyValuesHolder(imageD, imageD_translate_x, imageD_translate_y, imageD_scale_x, imageD_scale_y); 782 | }else if(imageD.getIndexLable() == 2){ 783 | PropertyValuesHolder imageD_scale_x = PropertyValuesHolder.ofFloat("scaleX", mScaleValue); 784 | PropertyValuesHolder imageD_scale_y = PropertyValuesHolder.ofFloat("scaleY", mScaleValue); 785 | imageDAnimator = ObjectAnimator.ofPropertyValuesHolder(imageD, imageD_translate_x, imageD_translate_y, imageD_scale_x, imageD_scale_y); 786 | }else{ 787 | imageDAnimator = ObjectAnimator.ofPropertyValuesHolder(imageD, imageD_translate_x, imageD_translate_y); 788 | } 789 | 790 | PropertyValuesHolder imageE_translate_x = PropertyValuesHolder.ofFloat("x", endCoordinateXs[imageD.getIndexLable()]); 791 | PropertyValuesHolder imageE_translate_y = PropertyValuesHolder.ofFloat("y", endCoordinateYs[imageD.getIndexLable()]); 792 | ObjectAnimator imageEAnimator = null; 793 | if (imageE.getIndexLable() == 3) { 794 | PropertyValuesHolder imageE_scale_x = PropertyValuesHolder.ofFloat("scaleX", 1); 795 | PropertyValuesHolder imageE_scale_y = PropertyValuesHolder.ofFloat("scaleY", 1); 796 | imageEAnimator = ObjectAnimator.ofPropertyValuesHolder(imageE, imageE_translate_x, imageE_translate_y, imageE_scale_x, imageE_scale_y); 797 | }else if(imageE.getIndexLable() == 2){ 798 | PropertyValuesHolder imageE_scale_x = PropertyValuesHolder.ofFloat("scaleX", mScaleValue); 799 | PropertyValuesHolder imageE_scale_y = PropertyValuesHolder.ofFloat("scaleY", mScaleValue); 800 | imageEAnimator = ObjectAnimator.ofPropertyValuesHolder(imageE, imageE_translate_x, imageE_translate_y, imageE_scale_x, imageE_scale_y); 801 | }else{ 802 | imageEAnimator = ObjectAnimator.ofPropertyValuesHolder(imageE, imageE_translate_x, imageE_translate_y); 803 | } 804 | 805 | setRightIndex(); 806 | AnimatorSet set = new AnimatorSet(); 807 | set.setDuration(mDuration); 808 | set.playTogether(imageAAnimator, imageBAnimator, imageCAnimator, imageDAnimator, imageEAnimator); 809 | set.start(); 810 | 811 | set.addListener(new AnimatorListener() { 812 | 813 | @Override 814 | public void onAnimationStart(Animator animation) { 815 | } 816 | 817 | @Override 818 | public void onAnimationRepeat(Animator animation) { 819 | } 820 | 821 | @Override 822 | public void onAnimationEnd(Animator animation) { 823 | 824 | moveRightAnim(); 825 | } 826 | 827 | @Override 828 | public void onAnimationCancel(Animator animation) { 829 | 830 | } 831 | }); 832 | } 833 | private ObjectAnimator imageAAnimToRight ; 834 | private ObjectAnimator imageBAnimToRight ; 835 | private ObjectAnimator imageCAnimToRight ; 836 | private ObjectAnimator imageDAnimToRight ; 837 | private ObjectAnimator imageEAnimToRight ; 838 | 839 | /** 840 | * when move right, init animation 841 | */ 842 | public void initMoveRightAnim(){ 843 | 844 | PropertyValuesHolder imageA_translate_x = PropertyValuesHolder.ofFloat("x", endCoordinateXs[imageA.getIndexLable()], endCoordinateXs[imageE.getIndexLable()]); 845 | PropertyValuesHolder imageA_translate_y = PropertyValuesHolder.ofFloat("y", endCoordinateYs[imageA.getIndexLable()],endCoordinateYs[imageE.getIndexLable()]); 846 | 847 | if (imageA.getIndexLable() % 5 == 3) { 848 | PropertyValuesHolder imageA_scale_x = PropertyValuesHolder.ofFloat("scaleX", mScaleValue, 1); 849 | PropertyValuesHolder imageA_scale_y = PropertyValuesHolder.ofFloat("scaleY",mScaleValue, 1); 850 | imageAAnimToRight = ObjectAnimator.ofPropertyValuesHolder(imageA, imageA_translate_x, imageA_translate_y, imageA_scale_x, imageA_scale_y); 851 | }else if(imageA.getIndexLable() % 5 == 2){ 852 | PropertyValuesHolder imageA_scale_x = PropertyValuesHolder.ofFloat("scaleX",1, mScaleValue); 853 | PropertyValuesHolder imageA_scale_y = PropertyValuesHolder.ofFloat("scaleY",1, mScaleValue); 854 | imageAAnimToRight = ObjectAnimator.ofPropertyValuesHolder(imageA, imageA_translate_x, imageA_translate_y, imageA_scale_x, imageA_scale_y); 855 | }else{ 856 | imageAAnimToRight = ObjectAnimator.ofPropertyValuesHolder(imageA, imageA_translate_x, imageA_translate_y); 857 | } 858 | imageAAnimToRight.setDuration(mDuration); 859 | 860 | 861 | PropertyValuesHolder imageB_translate_x = PropertyValuesHolder.ofFloat("x",endCoordinateXs[imageB.getIndexLable()], endCoordinateXs[imageA.getIndexLable()]); 862 | PropertyValuesHolder imageB_translate_y = PropertyValuesHolder.ofFloat("y", endCoordinateYs[imageB.getIndexLable()],endCoordinateYs[imageA.getIndexLable()]); 863 | 864 | if (imageB.getIndexLable() % 5 == 3) { 865 | PropertyValuesHolder imageB_scale_x = PropertyValuesHolder.ofFloat("scaleX",mScaleValue, 1); 866 | PropertyValuesHolder imageB_scale_y = PropertyValuesHolder.ofFloat("scaleY",mScaleValue, 1); 867 | imageBAnimToRight = ObjectAnimator.ofPropertyValuesHolder(imageB, imageB_translate_x, imageB_translate_y, imageB_scale_x, imageB_scale_y); 868 | }else if(imageB.getIndexLable() % 5 == 2){ 869 | PropertyValuesHolder imageB_scale_x = PropertyValuesHolder.ofFloat("scaleX", 1,mScaleValue); 870 | PropertyValuesHolder imageB_scale_y = PropertyValuesHolder.ofFloat("scaleY",1, mScaleValue); 871 | imageBAnimToRight = ObjectAnimator.ofPropertyValuesHolder(imageB, imageB_translate_x, imageB_translate_y, imageB_scale_x, imageB_scale_y); 872 | }else{ 873 | imageBAnimToRight = ObjectAnimator.ofPropertyValuesHolder(imageB, imageB_translate_x, imageB_translate_y); 874 | } 875 | imageBAnimToRight.setDuration(mDuration); 876 | 877 | PropertyValuesHolder imageC_translate_x = PropertyValuesHolder.ofFloat("x", endCoordinateXs[imageC.getIndexLable()],endCoordinateXs[imageB.getIndexLable()]); 878 | PropertyValuesHolder imageC_translate_y = PropertyValuesHolder.ofFloat("y",endCoordinateYs[imageC.getIndexLable()], endCoordinateYs[imageB.getIndexLable()]); 879 | if (imageC.getIndexLable() % 5 == 3) { 880 | PropertyValuesHolder imageC_scale_x = PropertyValuesHolder.ofFloat("scaleX",mScaleValue, 1); 881 | PropertyValuesHolder imageC_scale_y = PropertyValuesHolder.ofFloat("scaleY",mScaleValue, 1); 882 | imageCAnimToRight = ObjectAnimator.ofPropertyValuesHolder(imageC, imageC_translate_x, imageC_translate_y, imageC_scale_x, imageC_scale_y); 883 | }else if(imageC.getIndexLable() % 5 == 2){ 884 | PropertyValuesHolder imageC_scale_x = PropertyValuesHolder.ofFloat("scaleX",1, mScaleValue); 885 | PropertyValuesHolder imageC_scale_y = PropertyValuesHolder.ofFloat("scaleY",1, mScaleValue); 886 | imageCAnimToRight = ObjectAnimator.ofPropertyValuesHolder(imageC, imageC_translate_x, imageC_translate_y, imageC_scale_x, imageC_scale_y); 887 | }else{ 888 | imageCAnimToRight = ObjectAnimator.ofPropertyValuesHolder(imageC, imageC_translate_x, imageC_translate_y); 889 | } 890 | imageCAnimToRight.setDuration(mDuration); 891 | 892 | PropertyValuesHolder imageD_translate_x = PropertyValuesHolder.ofFloat("x" , endCoordinateXs[imageD.getIndexLable()],endCoordinateXs[imageC.getIndexLable()]); 893 | PropertyValuesHolder imageD_translate_y = PropertyValuesHolder.ofFloat("y", endCoordinateYs[imageD.getIndexLable()],endCoordinateYs[imageC.getIndexLable()]); 894 | if (imageD.getIndexLable() % 5 == 3) { 895 | PropertyValuesHolder imageD_scale_x = PropertyValuesHolder.ofFloat("scaleX",mScaleValue,1); 896 | PropertyValuesHolder imageD_scale_y = PropertyValuesHolder.ofFloat("scaleY",mScaleValue, 1); 897 | imageDAnimToRight = ObjectAnimator.ofPropertyValuesHolder(imageD, imageD_translate_x, imageD_translate_y, imageD_scale_x, imageD_scale_y); 898 | }else if(imageD.getIndexLable() % 5 == 2){ 899 | PropertyValuesHolder imageD_scale_x = PropertyValuesHolder.ofFloat("scaleX", 1, mScaleValue); 900 | PropertyValuesHolder imageD_scale_y = PropertyValuesHolder.ofFloat("scaleY",1, mScaleValue); 901 | imageDAnimToRight = ObjectAnimator.ofPropertyValuesHolder(imageD, imageD_translate_x, imageD_translate_y, imageD_scale_x, imageD_scale_y); 902 | }else{ 903 | imageDAnimToRight = ObjectAnimator.ofPropertyValuesHolder(imageD, imageD_translate_x, imageD_translate_y); 904 | } 905 | imageDAnimToRight.setDuration(mDuration); 906 | 907 | PropertyValuesHolder imageE_translate_x = PropertyValuesHolder.ofFloat("x",endCoordinateXs[imageE.getIndexLable()], endCoordinateXs[imageD.getIndexLable()]); 908 | PropertyValuesHolder imageE_translate_y = PropertyValuesHolder.ofFloat("y", endCoordinateYs[imageE.getIndexLable()],endCoordinateYs[imageD.getIndexLable()]); 909 | 910 | if (imageE.getIndexLable() % 5 == 3) { 911 | PropertyValuesHolder imageE_scale_x = PropertyValuesHolder.ofFloat("scaleX",mScaleValue, 1); 912 | PropertyValuesHolder imageE_scale_y = PropertyValuesHolder.ofFloat("scaleY",mScaleValue, 1); 913 | imageEAnimToRight = ObjectAnimator.ofPropertyValuesHolder(imageE, imageE_translate_x, imageE_translate_y, imageE_scale_x, imageE_scale_y); 914 | }else if(imageE.getIndexLable() % 5 == 2){ 915 | PropertyValuesHolder imageE_scale_x = PropertyValuesHolder.ofFloat("scaleX",1, mScaleValue); 916 | PropertyValuesHolder imageE_scale_y = PropertyValuesHolder.ofFloat("scaleY", 1, mScaleValue); 917 | imageEAnimToRight = ObjectAnimator.ofPropertyValuesHolder(imageE, imageE_translate_x, imageE_translate_y, imageE_scale_x, imageE_scale_y); 918 | }else{ 919 | imageEAnimToRight = ObjectAnimator.ofPropertyValuesHolder(imageE, imageE_translate_x, imageE_translate_y); 920 | } 921 | imageEAnimToRight.setDuration(mDuration); 922 | } 923 | 924 | /** 925 | * when move right, finger move up, finish animation 926 | */ 927 | public void finishMoveRightAnim(){ 928 | if (!mExpandFlag) { 929 | return ; 930 | } 931 | ObjectAnimator imageAAnimator = null; 932 | PropertyValuesHolder imageA_translate_x = PropertyValuesHolder.ofFloat("x", endCoordinateXs[imageE.getIndexLable()]); 933 | PropertyValuesHolder imageA_translate_y = PropertyValuesHolder.ofFloat("y", endCoordinateYs[imageE.getIndexLable()]); 934 | if (imageA.getIndexLable() % 5 == 3) { 935 | PropertyValuesHolder imageA_scale_x = PropertyValuesHolder.ofFloat("scaleX", 1); 936 | PropertyValuesHolder imageA_scale_y = PropertyValuesHolder.ofFloat("scaleY", 1); 937 | imageAAnimator = ObjectAnimator.ofPropertyValuesHolder(imageA, imageA_translate_x, imageA_translate_y, imageA_scale_x, imageA_scale_y); 938 | }else if(imageA.getIndexLable() % 5 == 2){ 939 | PropertyValuesHolder imageA_scale_x = PropertyValuesHolder.ofFloat("scaleX", mScaleValue); 940 | PropertyValuesHolder imageA_scale_y = PropertyValuesHolder.ofFloat("scaleY", mScaleValue); 941 | imageAAnimator = ObjectAnimator.ofPropertyValuesHolder(imageA, imageA_translate_x, imageA_translate_y, imageA_scale_x, imageA_scale_y); 942 | }else{ 943 | imageAAnimator = ObjectAnimator.ofPropertyValuesHolder(imageA, imageA_translate_x, imageA_translate_y); 944 | } 945 | 946 | ObjectAnimator imageBAnimator = null; 947 | PropertyValuesHolder imageB_translate_x = PropertyValuesHolder.ofFloat("x", endCoordinateXs[imageA.getIndexLable()]); 948 | PropertyValuesHolder imageB_translate_y = PropertyValuesHolder.ofFloat("y", endCoordinateYs[imageA.getIndexLable()]); 949 | 950 | if (imageB.getIndexLable() % 5 == 3) { 951 | PropertyValuesHolder imageB_scale_x = PropertyValuesHolder.ofFloat("scaleX", 1); 952 | PropertyValuesHolder imageB_scale_y = PropertyValuesHolder.ofFloat("scaleY", 1); 953 | imageBAnimator = ObjectAnimator.ofPropertyValuesHolder(imageB, imageB_translate_x, imageB_translate_y, imageB_scale_x, imageB_scale_y); 954 | }else if(imageB.getIndexLable() % 5 == 2){ 955 | PropertyValuesHolder imageB_scale_x = PropertyValuesHolder.ofFloat("scaleX", mScaleValue); 956 | PropertyValuesHolder imageB_scale_y = PropertyValuesHolder.ofFloat("scaleY", mScaleValue); 957 | imageBAnimator = ObjectAnimator.ofPropertyValuesHolder(imageB, imageB_translate_x, imageB_translate_y, imageB_scale_x, imageB_scale_y); 958 | }else{ 959 | imageBAnimator = ObjectAnimator.ofPropertyValuesHolder(imageB, imageB_translate_x, imageB_translate_y); 960 | } 961 | 962 | ObjectAnimator imageCAnimator = null; 963 | PropertyValuesHolder imageC_translate_x = PropertyValuesHolder.ofFloat("x",endCoordinateXs[imageB.getIndexLable()]); 964 | PropertyValuesHolder imageC_translate_y = PropertyValuesHolder.ofFloat("y", endCoordinateYs[imageB.getIndexLable()]); 965 | if (imageC.getIndexLable() % 5 == 3) { 966 | PropertyValuesHolder imageC_scale_x = PropertyValuesHolder.ofFloat("scaleX", 1); 967 | PropertyValuesHolder imageC_scale_y = PropertyValuesHolder.ofFloat("scaleY", 1); 968 | imageCAnimator = ObjectAnimator.ofPropertyValuesHolder(imageC, imageC_translate_x, imageC_translate_y, imageC_scale_x, imageC_scale_y); 969 | }else if(imageC.getIndexLable() % 5 == 2){ 970 | PropertyValuesHolder imageC_scale_x = PropertyValuesHolder.ofFloat("scaleX", mScaleValue); 971 | PropertyValuesHolder imageC_scale_y = PropertyValuesHolder.ofFloat("scaleY", mScaleValue); 972 | imageCAnimator = ObjectAnimator.ofPropertyValuesHolder(imageC, imageC_translate_x, imageC_translate_y, imageC_scale_x, imageC_scale_y); 973 | }else{ 974 | imageCAnimator = ObjectAnimator.ofPropertyValuesHolder(imageC, imageC_translate_x, imageC_translate_y); 975 | } 976 | 977 | ObjectAnimator imageDAnimator = null; 978 | PropertyValuesHolder imageD_translate_x = PropertyValuesHolder.ofFloat("x" , endCoordinateXs[imageC.getIndexLable()]); 979 | PropertyValuesHolder imageD_translate_y = PropertyValuesHolder.ofFloat("y", endCoordinateYs[imageC.getIndexLable()]); 980 | if (imageD.getIndexLable() % 5 == 3) { 981 | PropertyValuesHolder imageD_scale_x = PropertyValuesHolder.ofFloat("scaleX", 1); 982 | PropertyValuesHolder imageD_scale_y = PropertyValuesHolder.ofFloat("scaleY", 1); 983 | imageDAnimator = ObjectAnimator.ofPropertyValuesHolder(imageD, imageD_translate_x, imageD_translate_y, imageD_scale_x, imageD_scale_y); 984 | }else if(imageD.getIndexLable() % 5 == 2){ 985 | PropertyValuesHolder imageD_scale_x = PropertyValuesHolder.ofFloat("scaleX", mScaleValue); 986 | PropertyValuesHolder imageD_scale_y = PropertyValuesHolder.ofFloat("scaleY", mScaleValue); 987 | imageDAnimator = ObjectAnimator.ofPropertyValuesHolder(imageD, imageD_translate_x, imageD_translate_y, imageD_scale_x, imageD_scale_y); 988 | }else{ 989 | imageDAnimator = ObjectAnimator.ofPropertyValuesHolder(imageD, imageD_translate_x, imageD_translate_y); 990 | } 991 | 992 | ObjectAnimator imageEAnimator = null; 993 | PropertyValuesHolder imageE_translate_x = PropertyValuesHolder.ofFloat("x", endCoordinateXs[imageD.getIndexLable()]); 994 | PropertyValuesHolder imageE_translate_y = PropertyValuesHolder.ofFloat("y", endCoordinateYs[imageD.getIndexLable()]); 995 | if (imageE.getIndexLable() % 5 == 3) { 996 | PropertyValuesHolder imageE_scale_x = PropertyValuesHolder.ofFloat("scaleX", 1); 997 | PropertyValuesHolder imageE_scale_y = PropertyValuesHolder.ofFloat("scaleY", 1); 998 | imageEAnimator = ObjectAnimator.ofPropertyValuesHolder(imageE, imageE_translate_x, imageE_translate_y, imageE_scale_x, imageE_scale_y); 999 | }else if(imageE.getIndexLable() % 5 == 2){ 1000 | PropertyValuesHolder imageE_scale_x = PropertyValuesHolder.ofFloat("scaleX", mScaleValue); 1001 | PropertyValuesHolder imageE_scale_y = PropertyValuesHolder.ofFloat("scaleY", mScaleValue); 1002 | imageEAnimator = ObjectAnimator.ofPropertyValuesHolder(imageE, imageE_translate_x, imageE_translate_y, imageE_scale_x, imageE_scale_y); 1003 | }else{ 1004 | imageEAnimator = ObjectAnimator.ofPropertyValuesHolder(imageE, imageE_translate_x, imageE_translate_y); 1005 | } 1006 | 1007 | setRightIndex(); 1008 | AnimatorSet set = new AnimatorSet(); 1009 | set.playTogether(imageAAnimator, imageBAnimator, imageCAnimator, imageDAnimator, imageEAnimator); 1010 | set.setDuration(mDuration); 1011 | set.start(); 1012 | 1013 | 1014 | 1015 | } 1016 | 1017 | /** 1018 | * when move right, update mIndexLable value of {@link MenuLayout} 1019 | */ 1020 | private void setRightIndex() { 1021 | imageA.setIndexLable(imageA.getIndexLable() + 1); 1022 | imageB.setIndexLable(imageB.getIndexLable() + 1); 1023 | imageC.setIndexLable(imageC.getIndexLable() + 1); 1024 | imageD.setIndexLable(imageD.getIndexLable() + 1); 1025 | imageE.setIndexLable(imageE.getIndexLable() + 1); 1026 | 1027 | // mCenterImageView.update(0, true); 1028 | } 1029 | 1030 | /** 1031 | * when move right, update animation progress 1032 | * @param playTime 1033 | */ 1034 | public void updateMoveRightAnim(long playTime){ 1035 | imageAAnimToRight.setCurrentPlayTime(playTime); 1036 | imageBAnimToRight.setCurrentPlayTime(playTime); 1037 | imageCAnimToRight.setCurrentPlayTime(playTime); 1038 | imageDAnimToRight.setCurrentPlayTime(playTime); 1039 | imageEAnimToRight.setCurrentPlayTime(playTime); 1040 | mCenterImageView.update(-mCenterImageView.getMeasuredWidth()*(1 - playTime* 1.0f/mDuration ), true); 1041 | } 1042 | 1043 | /** 1044 | * click menu, move to left, counterclockwise direction. 1045 | */ 1046 | public void moveLeftAnim(){ 1047 | PropertyValuesHolder imageA_translate_x = PropertyValuesHolder.ofFloat("x", endCoordinateXs[imageB.getIndexLable()]); 1048 | PropertyValuesHolder imageA_translate_y = PropertyValuesHolder.ofFloat("y", endCoordinateYs[imageB.getIndexLable()]); 1049 | ObjectAnimator imageAAnimator = null; 1050 | if (imageA.getIndexLable() == 3) { 1051 | PropertyValuesHolder imageA_scale_x = PropertyValuesHolder.ofFloat("scaleX", 1); 1052 | PropertyValuesHolder imageA_scale_y = PropertyValuesHolder.ofFloat("scaleY", 1); 1053 | imageAAnimator = ObjectAnimator.ofPropertyValuesHolder(imageA, imageA_translate_x, imageA_translate_y, imageA_scale_x, imageA_scale_y); 1054 | }else if(imageA.getIndexLable() == 4){ 1055 | PropertyValuesHolder imageA_scale_x = PropertyValuesHolder.ofFloat("scaleX", mScaleValue); 1056 | PropertyValuesHolder imageA_scale_y = PropertyValuesHolder.ofFloat("scaleY", mScaleValue); 1057 | imageAAnimator = ObjectAnimator.ofPropertyValuesHolder(imageA, imageA_translate_x, imageA_translate_y, imageA_scale_x, imageA_scale_y); 1058 | }else{ 1059 | imageAAnimator = ObjectAnimator.ofPropertyValuesHolder(imageA, imageA_translate_x, imageA_translate_y); 1060 | } 1061 | 1062 | 1063 | PropertyValuesHolder imageB_translate_x = PropertyValuesHolder.ofFloat("x" , endCoordinateXs[imageC.getIndexLable()]); 1064 | PropertyValuesHolder imageB_translate_y = PropertyValuesHolder.ofFloat("y", endCoordinateYs[imageC.getIndexLable()]); 1065 | ObjectAnimator imageBAnimator = null; 1066 | if (imageB.getIndexLable() == 3) { 1067 | PropertyValuesHolder imageB_scale_x = PropertyValuesHolder.ofFloat("scaleX", 1); 1068 | PropertyValuesHolder imageB_scale_y = PropertyValuesHolder.ofFloat("scaleY", 1); 1069 | imageBAnimator = ObjectAnimator.ofPropertyValuesHolder(imageB, imageB_translate_x, imageB_translate_y, imageB_scale_x, imageB_scale_y); 1070 | }else if(imageB.getIndexLable() == 4){ 1071 | PropertyValuesHolder imageB_scale_x = PropertyValuesHolder.ofFloat("scaleX", mScaleValue); 1072 | PropertyValuesHolder imageB_scale_y = PropertyValuesHolder.ofFloat("scaleY", mScaleValue); 1073 | imageBAnimator = ObjectAnimator.ofPropertyValuesHolder(imageB, imageB_translate_x, imageB_translate_y, imageB_scale_x, imageB_scale_y); 1074 | }else{ 1075 | imageBAnimator = ObjectAnimator.ofPropertyValuesHolder(imageB, imageB_translate_x, imageB_translate_y); 1076 | } 1077 | 1078 | PropertyValuesHolder imageC_translate_x = PropertyValuesHolder.ofFloat("x", endCoordinateXs[imageD.getIndexLable()]); 1079 | PropertyValuesHolder imageC_translate_y = PropertyValuesHolder.ofFloat("y", endCoordinateYs[imageD.getIndexLable()]); 1080 | ObjectAnimator imageCAnimator = null; 1081 | if (imageC.getIndexLable() == 3) { 1082 | PropertyValuesHolder imageC_scale_x = PropertyValuesHolder.ofFloat("scaleX", 1); 1083 | PropertyValuesHolder imageC_scale_y = PropertyValuesHolder.ofFloat("scaleY", 1); 1084 | imageCAnimator = ObjectAnimator.ofPropertyValuesHolder(imageC, imageC_translate_x, imageC_translate_y, imageC_scale_x, imageC_scale_y); 1085 | }else if(imageC.getIndexLable() == 4){ 1086 | PropertyValuesHolder imageC_scale_x = PropertyValuesHolder.ofFloat("scaleX", mScaleValue); 1087 | PropertyValuesHolder imageC_scale_y = PropertyValuesHolder.ofFloat("scaleY", mScaleValue); 1088 | imageCAnimator = ObjectAnimator.ofPropertyValuesHolder(imageC, imageC_translate_x, imageC_translate_y, imageC_scale_x, imageC_scale_y); 1089 | }else{ 1090 | imageCAnimator = ObjectAnimator.ofPropertyValuesHolder(imageC, imageC_translate_x, imageC_translate_y); 1091 | } 1092 | 1093 | PropertyValuesHolder imageD_translate_x = PropertyValuesHolder.ofFloat("x" ,endCoordinateXs[imageE.getIndexLable()]); 1094 | PropertyValuesHolder imageD_translate_y = PropertyValuesHolder.ofFloat("y",endCoordinateYs[imageE.getIndexLable()]); 1095 | ObjectAnimator imageDAnimator = null; 1096 | if (imageD.getIndexLable() == 3) { 1097 | PropertyValuesHolder imageD_scale_x = PropertyValuesHolder.ofFloat("scaleX", 1); 1098 | PropertyValuesHolder imageD_scale_y = PropertyValuesHolder.ofFloat("scaleY", 1); 1099 | imageDAnimator = ObjectAnimator.ofPropertyValuesHolder(imageD, imageD_translate_x, imageD_translate_y, imageD_scale_x, imageD_scale_y); 1100 | }else if(imageD.getIndexLable() == 4){ 1101 | PropertyValuesHolder imageD_scale_x = PropertyValuesHolder.ofFloat("scaleX", mScaleValue); 1102 | PropertyValuesHolder imageD_scale_y = PropertyValuesHolder.ofFloat("scaleY", mScaleValue); 1103 | imageDAnimator = ObjectAnimator.ofPropertyValuesHolder(imageD, imageD_translate_x, imageD_translate_y, imageD_scale_x, imageD_scale_y); 1104 | }else{ 1105 | imageDAnimator = ObjectAnimator.ofPropertyValuesHolder(imageD, imageD_translate_x, imageD_translate_y); 1106 | } 1107 | 1108 | PropertyValuesHolder imageE_translate_x = PropertyValuesHolder.ofFloat("x", endCoordinateXs[imageA.getIndexLable()]); 1109 | PropertyValuesHolder imageE_translate_y = PropertyValuesHolder.ofFloat("y", endCoordinateYs[imageA.getIndexLable()]); 1110 | ObjectAnimator imageEAnimator = null; 1111 | if (imageE.getIndexLable() == 3) { 1112 | PropertyValuesHolder imageE_scale_x = PropertyValuesHolder.ofFloat("scaleX", 1); 1113 | PropertyValuesHolder imageE_scale_y = PropertyValuesHolder.ofFloat("scaleY", 1); 1114 | imageEAnimator = ObjectAnimator.ofPropertyValuesHolder(imageE, imageE_translate_x, imageE_translate_y, imageE_scale_x, imageE_scale_y); 1115 | }else if(imageE.getIndexLable() == 4){ 1116 | PropertyValuesHolder imageE_scale_x = PropertyValuesHolder.ofFloat("scaleX", mScaleValue); 1117 | PropertyValuesHolder imageE_scale_y = PropertyValuesHolder.ofFloat("scaleY", mScaleValue); 1118 | imageEAnimator = ObjectAnimator.ofPropertyValuesHolder(imageE, imageE_translate_x, imageE_translate_y, imageE_scale_x, imageE_scale_y); 1119 | }else{ 1120 | imageEAnimator = ObjectAnimator.ofPropertyValuesHolder(imageE, imageE_translate_x, imageE_translate_y); 1121 | } 1122 | 1123 | setLeftIndex(); 1124 | AnimatorSet set = new AnimatorSet(); 1125 | set.setDuration(mDuration); 1126 | set.playTogether(imageAAnimator, imageBAnimator, imageCAnimator, imageDAnimator, imageEAnimator); 1127 | set.start(); 1128 | 1129 | } 1130 | 1131 | /** 1132 | * when move left, update mIndexLable value of {@link MenuLayout} 1133 | */ 1134 | private void setLeftIndex() { 1135 | imageA.setIndexLable(imageA.getIndexLable() - 1); 1136 | imageB.setIndexLable(imageB.getIndexLable() - 1); 1137 | imageC.setIndexLable(imageC.getIndexLable() - 1); 1138 | imageD.setIndexLable(imageD.getIndexLable() - 1); 1139 | imageE.setIndexLable(imageE.getIndexLable() - 1); 1140 | // mCenterImageView.update(0, false); 1141 | } 1142 | 1143 | /** 1144 | * move left twice 1145 | */ 1146 | public void moveLeftAnim2(){ 1147 | PropertyValuesHolder imageA_translate_x = PropertyValuesHolder.ofFloat("x", endCoordinateXs[imageB.getIndexLable()]); 1148 | PropertyValuesHolder imageA_translate_y = PropertyValuesHolder.ofFloat("y", endCoordinateYs[imageB.getIndexLable()]); 1149 | ObjectAnimator imageAAnimator = null; 1150 | if (imageA.getIndexLable() == 3) { 1151 | PropertyValuesHolder imageA_scale_x = PropertyValuesHolder.ofFloat("scaleX", 1); 1152 | PropertyValuesHolder imageA_scale_y = PropertyValuesHolder.ofFloat("scaleY", 1); 1153 | imageAAnimator = ObjectAnimator.ofPropertyValuesHolder(imageA, imageA_translate_x, imageA_translate_y, imageA_scale_x, imageA_scale_y); 1154 | }else if(imageA.getIndexLable() == 4){ 1155 | PropertyValuesHolder imageA_scale_x = PropertyValuesHolder.ofFloat("scaleX", mScaleValue); 1156 | PropertyValuesHolder imageA_scale_y = PropertyValuesHolder.ofFloat("scaleY", mScaleValue); 1157 | imageAAnimator = ObjectAnimator.ofPropertyValuesHolder(imageA, imageA_translate_x, imageA_translate_y, imageA_scale_x, imageA_scale_y); 1158 | }else{ 1159 | imageAAnimator = ObjectAnimator.ofPropertyValuesHolder(imageA, imageA_translate_x, imageA_translate_y); 1160 | } 1161 | 1162 | 1163 | PropertyValuesHolder imageB_translate_x = PropertyValuesHolder.ofFloat("x" , endCoordinateXs[imageC.getIndexLable()]); 1164 | PropertyValuesHolder imageB_translate_y = PropertyValuesHolder.ofFloat("y", endCoordinateYs[imageC.getIndexLable()]); 1165 | ObjectAnimator imageBAnimator = null; 1166 | if (imageB.getIndexLable() == 3) { 1167 | PropertyValuesHolder imageB_scale_x = PropertyValuesHolder.ofFloat("scaleX", 1); 1168 | PropertyValuesHolder imageB_scale_y = PropertyValuesHolder.ofFloat("scaleY", 1); 1169 | imageBAnimator = ObjectAnimator.ofPropertyValuesHolder(imageB, imageB_translate_x, imageB_translate_y, imageB_scale_x, imageB_scale_y); 1170 | }else if(imageB.getIndexLable() == 4){ 1171 | PropertyValuesHolder imageB_scale_x = PropertyValuesHolder.ofFloat("scaleX", mScaleValue); 1172 | PropertyValuesHolder imageB_scale_y = PropertyValuesHolder.ofFloat("scaleY", mScaleValue); 1173 | imageBAnimator = ObjectAnimator.ofPropertyValuesHolder(imageB, imageB_translate_x, imageB_translate_y, imageB_scale_x, imageB_scale_y); 1174 | }else{ 1175 | imageBAnimator = ObjectAnimator.ofPropertyValuesHolder(imageB, imageB_translate_x, imageB_translate_y); 1176 | } 1177 | 1178 | PropertyValuesHolder imageC_translate_x = PropertyValuesHolder.ofFloat("x", endCoordinateXs[imageD.getIndexLable()]); 1179 | PropertyValuesHolder imageC_translate_y = PropertyValuesHolder.ofFloat("y", endCoordinateYs[imageD.getIndexLable()]); 1180 | ObjectAnimator imageCAnimator = null; 1181 | if (imageC.getIndexLable() == 3) { 1182 | PropertyValuesHolder imageC_scale_x = PropertyValuesHolder.ofFloat("scaleX", 1); 1183 | PropertyValuesHolder imageC_scale_y = PropertyValuesHolder.ofFloat("scaleY", 1); 1184 | imageCAnimator = ObjectAnimator.ofPropertyValuesHolder(imageC, imageC_translate_x, imageC_translate_y, imageC_scale_x, imageC_scale_y); 1185 | }else if(imageC.getIndexLable() == 4){ 1186 | PropertyValuesHolder imageC_scale_x = PropertyValuesHolder.ofFloat("scaleX", mScaleValue); 1187 | PropertyValuesHolder imageC_scale_y = PropertyValuesHolder.ofFloat("scaleY", mScaleValue); 1188 | imageCAnimator = ObjectAnimator.ofPropertyValuesHolder(imageC, imageC_translate_x, imageC_translate_y, imageC_scale_x, imageC_scale_y); 1189 | }else{ 1190 | imageCAnimator = ObjectAnimator.ofPropertyValuesHolder(imageC, imageC_translate_x, imageC_translate_y); 1191 | } 1192 | 1193 | PropertyValuesHolder imageD_translate_x = PropertyValuesHolder.ofFloat("x" ,endCoordinateXs[imageE.getIndexLable()]); 1194 | PropertyValuesHolder imageD_translate_y = PropertyValuesHolder.ofFloat("y",endCoordinateYs[imageE.getIndexLable()]); 1195 | ObjectAnimator imageDAnimator = null; 1196 | if (imageD.getIndexLable() == 3) { 1197 | PropertyValuesHolder imageD_scale_x = PropertyValuesHolder.ofFloat("scaleX", 1); 1198 | PropertyValuesHolder imageD_scale_y = PropertyValuesHolder.ofFloat("scaleY", 1); 1199 | imageDAnimator = ObjectAnimator.ofPropertyValuesHolder(imageD, imageD_translate_x, imageD_translate_y, imageD_scale_x, imageD_scale_y); 1200 | }else if(imageD.getIndexLable() == 4){ 1201 | PropertyValuesHolder imageD_scale_x = PropertyValuesHolder.ofFloat("scaleX", mScaleValue); 1202 | PropertyValuesHolder imageD_scale_y = PropertyValuesHolder.ofFloat("scaleY", mScaleValue); 1203 | imageDAnimator = ObjectAnimator.ofPropertyValuesHolder(imageD, imageD_translate_x, imageD_translate_y, imageD_scale_x, imageD_scale_y); 1204 | }else{ 1205 | imageDAnimator = ObjectAnimator.ofPropertyValuesHolder(imageD, imageD_translate_x, imageD_translate_y); 1206 | } 1207 | 1208 | PropertyValuesHolder imageE_translate_x = PropertyValuesHolder.ofFloat("x", endCoordinateXs[imageA.getIndexLable()]); 1209 | PropertyValuesHolder imageE_translate_y = PropertyValuesHolder.ofFloat("y", endCoordinateYs[imageA.getIndexLable()]); 1210 | ObjectAnimator imageEAnimator = null; 1211 | if (imageE.getIndexLable() == 3) { 1212 | PropertyValuesHolder imageE_scale_x = PropertyValuesHolder.ofFloat("scaleX", 1); 1213 | PropertyValuesHolder imageE_scale_y = PropertyValuesHolder.ofFloat("scaleY", 1); 1214 | imageEAnimator = ObjectAnimator.ofPropertyValuesHolder(imageE, imageE_translate_x, imageE_translate_y, imageE_scale_x, imageE_scale_y); 1215 | }else if(imageE.getIndexLable() == 4){ 1216 | PropertyValuesHolder imageE_scale_x = PropertyValuesHolder.ofFloat("scaleX", mScaleValue); 1217 | PropertyValuesHolder imageE_scale_y = PropertyValuesHolder.ofFloat("scaleY", mScaleValue); 1218 | imageEAnimator = ObjectAnimator.ofPropertyValuesHolder(imageE, imageE_translate_x, imageE_translate_y, imageE_scale_x, imageE_scale_y); 1219 | }else{ 1220 | imageEAnimator = ObjectAnimator.ofPropertyValuesHolder(imageE, imageE_translate_x, imageE_translate_y); 1221 | } 1222 | 1223 | setLeftIndex(); 1224 | AnimatorSet set = new AnimatorSet(); 1225 | set.setDuration(mDuration); 1226 | set.playTogether(imageAAnimator, imageBAnimator, imageCAnimator, imageDAnimator, imageEAnimator); 1227 | set.start(); 1228 | 1229 | set.addListener(new AnimatorListener() { 1230 | 1231 | @Override 1232 | public void onAnimationStart(Animator animation) { 1233 | } 1234 | 1235 | @Override 1236 | public void onAnimationRepeat(Animator animation) { 1237 | } 1238 | 1239 | @Override 1240 | public void onAnimationEnd(Animator animation) { 1241 | 1242 | moveLeftAnim(); 1243 | } 1244 | 1245 | @Override 1246 | public void onAnimationCancel(Animator animation) { 1247 | 1248 | } 1249 | }); 1250 | } 1251 | 1252 | private ObjectAnimator imageAAnimToLeft ; 1253 | private ObjectAnimator imageBAnimToLeft ; 1254 | private ObjectAnimator imageCAnimToLeft ; 1255 | private ObjectAnimator imageDAnimToLeft ; 1256 | private ObjectAnimator imageEAnimToLeft ; 1257 | 1258 | /** 1259 | * when move left, init animation 1260 | */ 1261 | public void initMoveLeftAnim(){ 1262 | PropertyValuesHolder imageA_translate_x = PropertyValuesHolder.ofFloat("x", endCoordinateXs[imageA.getIndexLable()], endCoordinateXs[imageB.getIndexLable()]); 1263 | PropertyValuesHolder imageA_translate_y = PropertyValuesHolder.ofFloat("y", endCoordinateYs[imageA.getIndexLable()],endCoordinateYs[imageB.getIndexLable()]); 1264 | if (imageA.getIndexLable() % 5 == 3) { 1265 | PropertyValuesHolder imageA_scale_x = PropertyValuesHolder.ofFloat("scaleX", mScaleValue, 1); 1266 | PropertyValuesHolder imageA_scale_y = PropertyValuesHolder.ofFloat("scaleY",mScaleValue, 1); 1267 | imageAAnimToLeft = ObjectAnimator.ofPropertyValuesHolder(imageA, imageA_translate_x, imageA_translate_y, imageA_scale_x, imageA_scale_y); 1268 | }else if(imageA.getIndexLable() % 5 == 4){ 1269 | PropertyValuesHolder imageA_scale_x = PropertyValuesHolder.ofFloat("scaleX",1, mScaleValue); 1270 | PropertyValuesHolder imageA_scale_y = PropertyValuesHolder.ofFloat("scaleY",1, mScaleValue); 1271 | imageAAnimToLeft = ObjectAnimator.ofPropertyValuesHolder(imageA, imageA_translate_x, imageA_translate_y, imageA_scale_x, imageA_scale_y); 1272 | }else{ 1273 | imageAAnimToLeft = ObjectAnimator.ofPropertyValuesHolder(imageA, imageA_translate_x, imageA_translate_y); 1274 | } 1275 | imageAAnimToLeft.setDuration(mDuration); 1276 | 1277 | 1278 | PropertyValuesHolder imageB_translate_x = PropertyValuesHolder.ofFloat("x",endCoordinateXs[imageB.getIndexLable()], endCoordinateXs[imageC.getIndexLable()]); 1279 | PropertyValuesHolder imageB_translate_y = PropertyValuesHolder.ofFloat("y", endCoordinateYs[imageB.getIndexLable()],endCoordinateYs[imageC.getIndexLable()]); 1280 | 1281 | if (imageB.getIndexLable() % 5 == 3) { 1282 | PropertyValuesHolder imageB_scale_x = PropertyValuesHolder.ofFloat("scaleX",mScaleValue, 1); 1283 | PropertyValuesHolder imageB_scale_y = PropertyValuesHolder.ofFloat("scaleY",mScaleValue, 1); 1284 | imageBAnimToLeft = ObjectAnimator.ofPropertyValuesHolder(imageB, imageB_translate_x, imageB_translate_y, imageB_scale_x, imageB_scale_y); 1285 | }else if(imageB.getIndexLable() % 5 == 4){ 1286 | PropertyValuesHolder imageB_scale_x = PropertyValuesHolder.ofFloat("scaleX", 1,mScaleValue); 1287 | PropertyValuesHolder imageB_scale_y = PropertyValuesHolder.ofFloat("scaleY",1, mScaleValue); 1288 | imageBAnimToLeft = ObjectAnimator.ofPropertyValuesHolder(imageB, imageB_translate_x, imageB_translate_y, imageB_scale_x, imageB_scale_y); 1289 | }else{ 1290 | imageBAnimToLeft = ObjectAnimator.ofPropertyValuesHolder(imageB, imageB_translate_x, imageB_translate_y); 1291 | } 1292 | imageBAnimToLeft.setDuration(mDuration); 1293 | 1294 | PropertyValuesHolder imageC_translate_x = PropertyValuesHolder.ofFloat("x", endCoordinateXs[imageC.getIndexLable()],endCoordinateXs[imageD.getIndexLable()]); 1295 | PropertyValuesHolder imageC_translate_y = PropertyValuesHolder.ofFloat("y",endCoordinateYs[imageC.getIndexLable()], endCoordinateYs[imageD.getIndexLable()]); 1296 | if (imageC.getIndexLable() % 5 == 3) { 1297 | PropertyValuesHolder imageC_scale_x = PropertyValuesHolder.ofFloat("scaleX",mScaleValue, 1); 1298 | PropertyValuesHolder imageC_scale_y = PropertyValuesHolder.ofFloat("scaleY",mScaleValue, 1); 1299 | imageCAnimToLeft = ObjectAnimator.ofPropertyValuesHolder(imageC, imageC_translate_x, imageC_translate_y, imageC_scale_x, imageC_scale_y); 1300 | }else if(imageC.getIndexLable() % 5 == 4){ 1301 | PropertyValuesHolder imageC_scale_x = PropertyValuesHolder.ofFloat("scaleX",1, mScaleValue); 1302 | PropertyValuesHolder imageC_scale_y = PropertyValuesHolder.ofFloat("scaleY",1, mScaleValue); 1303 | imageCAnimToLeft = ObjectAnimator.ofPropertyValuesHolder(imageC, imageC_translate_x, imageC_translate_y, imageC_scale_x, imageC_scale_y); 1304 | }else{ 1305 | imageCAnimToLeft = ObjectAnimator.ofPropertyValuesHolder(imageC, imageC_translate_x, imageC_translate_y); 1306 | } 1307 | imageCAnimToLeft.setDuration(mDuration); 1308 | 1309 | PropertyValuesHolder imageD_translate_x = PropertyValuesHolder.ofFloat("x" , endCoordinateXs[imageD.getIndexLable()],endCoordinateXs[imageE.getIndexLable()]); 1310 | PropertyValuesHolder imageD_translate_y = PropertyValuesHolder.ofFloat("y", endCoordinateYs[imageD.getIndexLable()],endCoordinateYs[imageE.getIndexLable()]); 1311 | if (imageD.getIndexLable() % 5 == 3) { 1312 | PropertyValuesHolder imageD_scale_x = PropertyValuesHolder.ofFloat("scaleX",mScaleValue,1); 1313 | PropertyValuesHolder imageD_scale_y = PropertyValuesHolder.ofFloat("scaleY",mScaleValue, 1); 1314 | imageDAnimToLeft = ObjectAnimator.ofPropertyValuesHolder(imageD, imageD_translate_x, imageD_translate_y, imageD_scale_x, imageD_scale_y); 1315 | }else if(imageD.getIndexLable() % 5 == 4){ 1316 | PropertyValuesHolder imageD_scale_x = PropertyValuesHolder.ofFloat("scaleX", 1, mScaleValue); 1317 | PropertyValuesHolder imageD_scale_y = PropertyValuesHolder.ofFloat("scaleY",1, mScaleValue); 1318 | imageDAnimToLeft = ObjectAnimator.ofPropertyValuesHolder(imageD, imageD_translate_x, imageD_translate_y, imageD_scale_x, imageD_scale_y); 1319 | }else{ 1320 | imageDAnimToLeft = ObjectAnimator.ofPropertyValuesHolder(imageD, imageD_translate_x, imageD_translate_y); 1321 | } 1322 | imageDAnimToLeft.setDuration(mDuration); 1323 | 1324 | PropertyValuesHolder imageE_translate_x = PropertyValuesHolder.ofFloat("x",endCoordinateXs[imageE.getIndexLable()], endCoordinateXs[imageA.getIndexLable()]); 1325 | PropertyValuesHolder imageE_translate_y = PropertyValuesHolder.ofFloat("y", endCoordinateYs[imageE.getIndexLable()],endCoordinateYs[imageA.getIndexLable()]); 1326 | 1327 | if (imageE.getIndexLable() % 5 == 3) { 1328 | PropertyValuesHolder imageE_scale_x = PropertyValuesHolder.ofFloat("scaleX",mScaleValue, 1); 1329 | PropertyValuesHolder imageE_scale_y = PropertyValuesHolder.ofFloat("scaleY",mScaleValue, 1); 1330 | imageEAnimToLeft = ObjectAnimator.ofPropertyValuesHolder(imageE, imageE_translate_x, imageE_translate_y, imageE_scale_x, imageE_scale_y); 1331 | }else if(imageE.getIndexLable() % 5 == 4){ 1332 | PropertyValuesHolder imageE_scale_x = PropertyValuesHolder.ofFloat("scaleX",1, mScaleValue); 1333 | PropertyValuesHolder imageE_scale_y = PropertyValuesHolder.ofFloat("scaleY", 1, mScaleValue); 1334 | imageEAnimToLeft = ObjectAnimator.ofPropertyValuesHolder(imageE, imageE_translate_x, imageE_translate_y, imageE_scale_x, imageE_scale_y); 1335 | }else{ 1336 | imageEAnimToLeft = ObjectAnimator.ofPropertyValuesHolder(imageE, imageE_translate_x, imageE_translate_y); 1337 | } 1338 | imageEAnimToLeft.setDuration(mDuration); 1339 | 1340 | } 1341 | 1342 | /** 1343 | * when move left, update animation progress 1344 | * @param playTime 1345 | */ 1346 | private void updateMoveLeftAnim(long playTime){ 1347 | imageAAnimToLeft.setCurrentPlayTime(playTime); 1348 | imageBAnimToLeft.setCurrentPlayTime(playTime); 1349 | imageCAnimToLeft.setCurrentPlayTime(playTime); 1350 | imageDAnimToLeft.setCurrentPlayTime(playTime); 1351 | imageEAnimToLeft.setCurrentPlayTime(playTime); 1352 | 1353 | System.out.println("drawcircle----= " + -mCenterImageView.getMeasuredWidth()*(1 - playTime* 1.0f/mDuration )); 1354 | mCenterImageView.update(mCenterImageView.getMeasuredWidth()*(1 - playTime* 1.0f/mDuration ), false); 1355 | } 1356 | 1357 | 1358 | /** 1359 | * when move left, finger move up, finish animation 1360 | */ 1361 | public void finishMoveLeftAnim(){ 1362 | if (!mExpandFlag) { 1363 | return; 1364 | } 1365 | ObjectAnimator imageAAnimator = null; 1366 | PropertyValuesHolder imageA_translate_x = PropertyValuesHolder.ofFloat("x", endCoordinateXs[imageB.getIndexLable()]); 1367 | PropertyValuesHolder imageA_translate_y = PropertyValuesHolder.ofFloat("y", endCoordinateYs[imageB.getIndexLable()]); 1368 | 1369 | if (imageA.getIndexLable() % 5 == 3) { 1370 | PropertyValuesHolder imageA_scale_x = PropertyValuesHolder.ofFloat("scaleX", 1); 1371 | PropertyValuesHolder imageA_scale_y = PropertyValuesHolder.ofFloat("scaleY", 1); 1372 | imageAAnimator = ObjectAnimator.ofPropertyValuesHolder(imageA, imageA_translate_x, imageA_translate_y, imageA_scale_x, imageA_scale_y); 1373 | }else if(imageA.getIndexLable() % 5 == 4){ 1374 | PropertyValuesHolder imageA_scale_x = PropertyValuesHolder.ofFloat("scaleX", mScaleValue); 1375 | PropertyValuesHolder imageA_scale_y = PropertyValuesHolder.ofFloat("scaleY", mScaleValue); 1376 | imageAAnimator = ObjectAnimator.ofPropertyValuesHolder(imageA, imageA_translate_x, imageA_translate_y, imageA_scale_x, imageA_scale_y); 1377 | }else{ 1378 | imageAAnimator = ObjectAnimator.ofPropertyValuesHolder(imageA, imageA_translate_x, imageA_translate_y); 1379 | } 1380 | 1381 | ObjectAnimator imageBAnimator = null; 1382 | PropertyValuesHolder imageB_translate_x = PropertyValuesHolder.ofFloat("x", endCoordinateXs[imageC.getIndexLable()]); 1383 | PropertyValuesHolder imageB_translate_y = PropertyValuesHolder.ofFloat("y", endCoordinateYs[imageC.getIndexLable()]); 1384 | if (imageB.getIndexLable() % 5 == 3) { 1385 | PropertyValuesHolder imageB_scale_x = PropertyValuesHolder.ofFloat("scaleX", 1); 1386 | PropertyValuesHolder imageB_scale_y = PropertyValuesHolder.ofFloat("scaleY", 1); 1387 | imageBAnimator = ObjectAnimator.ofPropertyValuesHolder(imageB, imageB_translate_x, imageB_translate_y, imageB_scale_x, imageB_scale_y); 1388 | }else if(imageB.getIndexLable() % 5 == 4){ 1389 | PropertyValuesHolder imageB_scale_x = PropertyValuesHolder.ofFloat("scaleX", mScaleValue); 1390 | PropertyValuesHolder imageB_scale_y = PropertyValuesHolder.ofFloat("scaleY", mScaleValue); 1391 | imageBAnimator = ObjectAnimator.ofPropertyValuesHolder(imageB, imageB_translate_x, imageB_translate_y, imageB_scale_x, imageB_scale_y); 1392 | }else{ 1393 | imageBAnimator = ObjectAnimator.ofPropertyValuesHolder(imageB, imageB_translate_x, imageB_translate_y); 1394 | } 1395 | 1396 | ObjectAnimator imageCAnimator = null; 1397 | PropertyValuesHolder imageC_translate_x = PropertyValuesHolder.ofFloat("x",endCoordinateXs[imageD.getIndexLable()]); 1398 | PropertyValuesHolder imageC_translate_y = PropertyValuesHolder.ofFloat("y", endCoordinateYs[imageD.getIndexLable()]); 1399 | if (imageC.getIndexLable() % 5 == 3) { 1400 | PropertyValuesHolder imageC_scale_x = PropertyValuesHolder.ofFloat("scaleX", 1); 1401 | PropertyValuesHolder imageC_scale_y = PropertyValuesHolder.ofFloat("scaleY", 1); 1402 | imageCAnimator = ObjectAnimator.ofPropertyValuesHolder(imageC, imageC_translate_x, imageC_translate_y, imageC_scale_x, imageC_scale_y); 1403 | }else if(imageC.getIndexLable() % 5 == 4){ 1404 | PropertyValuesHolder imageC_scale_x = PropertyValuesHolder.ofFloat("scaleX", mScaleValue); 1405 | PropertyValuesHolder imageC_scale_y = PropertyValuesHolder.ofFloat("scaleY", mScaleValue); 1406 | imageCAnimator = ObjectAnimator.ofPropertyValuesHolder(imageC, imageC_translate_x, imageC_translate_y, imageC_scale_x, imageC_scale_y); 1407 | }else{ 1408 | imageCAnimator = ObjectAnimator.ofPropertyValuesHolder(imageC, imageC_translate_x, imageC_translate_y); 1409 | } 1410 | imageCAnimator.setDuration(mDuration); 1411 | 1412 | ObjectAnimator imageDAnimator = null; 1413 | PropertyValuesHolder imageD_translate_x = PropertyValuesHolder.ofFloat("x" , endCoordinateXs[imageE.getIndexLable()]); 1414 | PropertyValuesHolder imageD_translate_y = PropertyValuesHolder.ofFloat("y", endCoordinateYs[imageE.getIndexLable()]); 1415 | if (imageD.getIndexLable() % 5 == 3) { 1416 | PropertyValuesHolder imageD_scale_x = PropertyValuesHolder.ofFloat("scaleX", 1); 1417 | PropertyValuesHolder imageD_scale_y = PropertyValuesHolder.ofFloat("scaleY", 1); 1418 | imageDAnimator = ObjectAnimator.ofPropertyValuesHolder(imageD, imageD_translate_x, imageD_translate_y, imageD_scale_x, imageD_scale_y); 1419 | }else if(imageD.getIndexLable() % 5 == 4){ 1420 | PropertyValuesHolder imageD_scale_x = PropertyValuesHolder.ofFloat("scaleX", mScaleValue); 1421 | PropertyValuesHolder imageD_scale_y = PropertyValuesHolder.ofFloat("scaleY", mScaleValue); 1422 | imageDAnimator = ObjectAnimator.ofPropertyValuesHolder(imageD, imageD_translate_x, imageD_translate_y, imageD_scale_x, imageD_scale_y); 1423 | }else{ 1424 | imageDAnimator = ObjectAnimator.ofPropertyValuesHolder(imageD, imageD_translate_x, imageD_translate_y); 1425 | } 1426 | 1427 | ObjectAnimator imageEAnimator = null; 1428 | PropertyValuesHolder imageE_translate_x = PropertyValuesHolder.ofFloat("x", endCoordinateXs[imageA.getIndexLable()]); 1429 | PropertyValuesHolder imageE_translate_y = PropertyValuesHolder.ofFloat("y", endCoordinateYs[imageA.getIndexLable()]); 1430 | if (imageE.getIndexLable() % 5 == 3) { 1431 | PropertyValuesHolder imageE_scale_x = PropertyValuesHolder.ofFloat("scaleX", 1); 1432 | PropertyValuesHolder imageE_scale_y = PropertyValuesHolder.ofFloat("scaleY", 1); 1433 | imageEAnimator = ObjectAnimator.ofPropertyValuesHolder(imageE, imageE_translate_x, imageE_translate_y, imageE_scale_x, imageE_scale_y); 1434 | }else if(imageE.getIndexLable() % 5 == 4){ 1435 | PropertyValuesHolder imageE_scale_x = PropertyValuesHolder.ofFloat("scaleX", mScaleValue); 1436 | PropertyValuesHolder imageE_scale_y = PropertyValuesHolder.ofFloat("scaleY", mScaleValue); 1437 | imageEAnimator = ObjectAnimator.ofPropertyValuesHolder(imageE, imageE_translate_x, imageE_translate_y, imageE_scale_x, imageE_scale_y); 1438 | }else{ 1439 | imageEAnimator = ObjectAnimator.ofPropertyValuesHolder(imageE, imageE_translate_x, imageE_translate_y); 1440 | } 1441 | 1442 | setLeftIndex(); 1443 | AnimatorSet set = new AnimatorSet(); 1444 | set.playTogether(imageAAnimator, imageBAnimator, imageCAnimator, imageDAnimator, imageEAnimator); 1445 | set.setDuration(mDuration); 1446 | set.start(); 1447 | } 1448 | 1449 | 1450 | 1451 | private ObjectAnimator imageATranslationYAnim ; 1452 | private ObjectAnimator imageBTranslationYAnim ; 1453 | private ObjectAnimator imageCTranslationYAnim ; 1454 | private ObjectAnimator imageDTranslationYAnim ; 1455 | private ObjectAnimator imageETranslationYAnim ; 1456 | 1457 | 1458 | private ObjectAnimator viewPagerTranslationYAnim ; 1459 | private ObjectAnimator layoutFrameTranslationYAnim ; 1460 | /** 1461 | * when scroll {@link #mListView} up and down, init animation 1462 | */ 1463 | public void initTranslationYAnim(){ 1464 | 1465 | PropertyValuesHolder imageA_translate_x = PropertyValuesHolder.ofFloat("x", endCoordinateXs[imageA.getIndexLable()], beginCoordinateXs[imageA.getIndexLable()]); 1466 | PropertyValuesHolder imageA_translate_y = PropertyValuesHolder.ofFloat("y", endCoordinateYs[imageA.getIndexLable()],0); 1467 | 1468 | if (imageA.getIndexLable() == 3) { 1469 | PropertyValuesHolder imageA_scale_x = PropertyValuesHolder.ofFloat("scaleX", mScaleValue, 1); 1470 | PropertyValuesHolder imageA_scale_y = PropertyValuesHolder.ofFloat("scaleY",mScaleValue, 1); 1471 | imageATranslationYAnim = ObjectAnimator.ofPropertyValuesHolder(imageA, imageA_translate_x, imageA_translate_y, imageA_scale_x, imageA_scale_y); 1472 | }else{ 1473 | imageATranslationYAnim = ObjectAnimator.ofPropertyValuesHolder(imageA, imageA_translate_x, imageA_translate_y); 1474 | } 1475 | imageATranslationYAnim.setDuration(mDuration); 1476 | imageATranslationYAnim.setInterpolator(new LinearInterpolator()); 1477 | 1478 | 1479 | PropertyValuesHolder imageB_translate_x = PropertyValuesHolder.ofFloat("x",endCoordinateXs[imageB.getIndexLable()], beginCoordinateXs[imageB.getIndexLable()]); 1480 | PropertyValuesHolder imageB_translate_y = PropertyValuesHolder.ofFloat("y", endCoordinateYs[imageB.getIndexLable()],0); 1481 | 1482 | if (imageB.getIndexLable() == 3) { 1483 | PropertyValuesHolder imageB_scale_x = PropertyValuesHolder.ofFloat("scaleX",mScaleValue, 1); 1484 | PropertyValuesHolder imageB_scale_y = PropertyValuesHolder.ofFloat("scaleY",mScaleValue, 1); 1485 | imageBTranslationYAnim = ObjectAnimator.ofPropertyValuesHolder(imageB, imageB_translate_x, imageB_translate_y, imageB_scale_x, imageB_scale_y); 1486 | }else{ 1487 | imageBTranslationYAnim = ObjectAnimator.ofPropertyValuesHolder(imageB, imageB_translate_x, imageB_translate_y); 1488 | } 1489 | imageBTranslationYAnim.setDuration(mDuration); 1490 | imageBTranslationYAnim.setInterpolator(new LinearInterpolator()); 1491 | 1492 | PropertyValuesHolder imageC_translate_x = PropertyValuesHolder.ofFloat("x", endCoordinateXs[imageC.getIndexLable()],beginCoordinateXs[imageC.getIndexLable()]); 1493 | PropertyValuesHolder imageC_translate_y = PropertyValuesHolder.ofFloat("y",endCoordinateYs[imageC.getIndexLable()], 0); 1494 | if (imageC.getIndexLable() == 3) { 1495 | PropertyValuesHolder imageC_scale_x = PropertyValuesHolder.ofFloat("scaleX",mScaleValue, 1); 1496 | PropertyValuesHolder imageC_scale_y = PropertyValuesHolder.ofFloat("scaleY",mScaleValue, 1); 1497 | imageCTranslationYAnim = ObjectAnimator.ofPropertyValuesHolder(imageC, imageC_translate_x, imageC_translate_y, imageC_scale_x, imageC_scale_y); 1498 | }else{ 1499 | imageCTranslationYAnim = ObjectAnimator.ofPropertyValuesHolder(imageC, imageC_translate_x, imageC_translate_y); 1500 | } 1501 | imageCTranslationYAnim.setDuration(mDuration); 1502 | imageCTranslationYAnim.setInterpolator(new LinearInterpolator()); 1503 | 1504 | PropertyValuesHolder imageD_translate_x = PropertyValuesHolder.ofFloat("x" , endCoordinateXs[imageD.getIndexLable()],beginCoordinateXs[imageD.getIndexLable()]); 1505 | PropertyValuesHolder imageD_translate_y = PropertyValuesHolder.ofFloat("y", endCoordinateYs[imageD.getIndexLable()],0); 1506 | if (imageD.getIndexLable() == 3) { 1507 | PropertyValuesHolder imageD_scale_x = PropertyValuesHolder.ofFloat("scaleX",mScaleValue,1); 1508 | PropertyValuesHolder imageD_scale_y = PropertyValuesHolder.ofFloat("scaleY",mScaleValue, 1); 1509 | imageDTranslationYAnim = ObjectAnimator.ofPropertyValuesHolder(imageD, imageD_translate_x, imageD_translate_y, imageD_scale_x, imageD_scale_y); 1510 | }else{ 1511 | imageDTranslationYAnim = ObjectAnimator.ofPropertyValuesHolder(imageD, imageD_translate_x, imageD_translate_y); 1512 | } 1513 | imageDTranslationYAnim.setDuration(mDuration); 1514 | imageDTranslationYAnim.setInterpolator(new LinearInterpolator()); 1515 | 1516 | PropertyValuesHolder imageE_translate_x = PropertyValuesHolder.ofFloat("x",endCoordinateXs[imageE.getIndexLable()], beginCoordinateXs[imageE.getIndexLable()]); 1517 | PropertyValuesHolder imageE_translate_y = PropertyValuesHolder.ofFloat("y", endCoordinateYs[imageE.getIndexLable()],0); 1518 | 1519 | if (imageE.getIndexLable() == 3) { 1520 | PropertyValuesHolder imageE_scale_x = PropertyValuesHolder.ofFloat("scaleX",mScaleValue, 1); 1521 | PropertyValuesHolder imageE_scale_y = PropertyValuesHolder.ofFloat("scaleY",mScaleValue, 1); 1522 | imageETranslationYAnim = ObjectAnimator.ofPropertyValuesHolder(imageE, imageE_translate_x, imageE_translate_y, imageE_scale_x, imageE_scale_y); 1523 | }else{ 1524 | imageETranslationYAnim = ObjectAnimator.ofPropertyValuesHolder(imageE, imageE_translate_x, imageE_translate_y); 1525 | } 1526 | imageETranslationYAnim.setDuration(mDuration); 1527 | imageETranslationYAnim.setInterpolator(new LinearInterpolator()); 1528 | 1529 | 1530 | layoutFrameTranslationYAnim = ObjectAnimator.ofFloat(mLayoutFrame, "y",/*headerLayout.getY()*/layoutFrameBeginY, layoutFrameEndY).setDuration(mDuration); 1531 | layoutFrameTranslationYAnim.setInterpolator(new LinearInterpolator()); 1532 | 1533 | viewPagerTranslationYAnim = ObjectAnimator.ofFloat(mViewPager, "y", mViewPagerBeginY , mViewPagerEndY).setDuration(mDuration); 1534 | viewPagerTranslationYAnim.setInterpolator(new LinearInterpolator()); 1535 | } 1536 | 1537 | /** 1538 | * when scroll {@link #mListView} up and down, update animation progress 1539 | * @param playTime 1540 | */ 1541 | public void updateTranslationYAnim(long playTime){ 1542 | imageCircleAnim.setCurrentPlayTime(playTime); 1543 | imageATranslationYAnim.setCurrentPlayTime(playTime); 1544 | imageBTranslationYAnim.setCurrentPlayTime(playTime); 1545 | imageCTranslationYAnim.setCurrentPlayTime(playTime); 1546 | imageDTranslationYAnim.setCurrentPlayTime(playTime); 1547 | imageETranslationYAnim.setCurrentPlayTime(playTime); 1548 | layoutFrameTranslationYAnim.setCurrentPlayTime(playTime); 1549 | viewPagerTranslationYAnim.setCurrentPlayTime(playTime ); 1550 | } 1551 | 1552 | } -------------------------------------------------------------------------------- /AnimatorMenu/src/com/clover/menu/view/CenterImageView.java: -------------------------------------------------------------------------------- 1 | package com.clover.menu.view; 2 | 3 | 4 | 5 | 6 | import android.content.Context; 7 | import android.graphics.Bitmap; 8 | import android.graphics.BitmapFactory; 9 | import android.graphics.Canvas; 10 | import android.graphics.Color; 11 | import android.util.AttributeSet; 12 | import android.widget.ImageView; 13 | 14 | public class CenterImageView extends ImageView { 15 | 16 | private Bitmap mL2RBitmap; 17 | private Bitmap mR2LBitmap; 18 | private float xCoordinate; 19 | private boolean updateFlag; 20 | 21 | /** 22 | * draw bitmap from left to right 23 | */ 24 | private boolean l2rFlag; 25 | 26 | private boolean mClearFlag; 27 | public CenterImageView(Context context, AttributeSet attrs, int defStyle) { 28 | super(context, attrs, defStyle); 29 | } 30 | 31 | public CenterImageView(Context context, AttributeSet attrs) { 32 | super(context, attrs); 33 | } 34 | 35 | public CenterImageView(Context context) { 36 | super(context); 37 | } 38 | 39 | 40 | @Override 41 | protected void onDraw(Canvas canvas) { 42 | super.onDraw(canvas); 43 | if (isClearFlag()) { 44 | canvas.drawColor(Color.TRANSPARENT); 45 | setClearFlag(false); 46 | 47 | if (null != mL2RBitmap && !mL2RBitmap.isRecycled()) { 48 | mL2RBitmap.recycle(); 49 | } 50 | if (null != mR2LBitmap && !mR2LBitmap.isRecycled()) { 51 | mR2LBitmap.recycle(); 52 | } 53 | return; 54 | } 55 | try { 56 | if (updateFlag) { 57 | System.out.println("xCoordinate---= " + xCoordinate); 58 | if(l2rFlag){ 59 | if (Float.compare(xCoordinate, 0) > 0) { 60 | xCoordinate = 0; 61 | } 62 | if (null == mL2RBitmap) { 63 | return; 64 | } 65 | canvas.drawBitmap(mL2RBitmap, getXCoordinate() + getPaddingLeft(), getPaddingTop(), null); 66 | 67 | }else{ 68 | if (Float.compare(xCoordinate, 0) < 0) { 69 | xCoordinate = 0; 70 | } 71 | if (null == mR2LBitmap) { 72 | return; 73 | } 74 | canvas.drawBitmap(mR2LBitmap, getXCoordinate() + getPaddingLeft(), getPaddingTop(), null); 75 | } 76 | 77 | } 78 | } catch (Exception e) { 79 | e.printStackTrace(); 80 | } 81 | } 82 | 83 | 84 | public void update(float arg, boolean l2rFlagArg){ 85 | 86 | xCoordinate = arg; 87 | updateFlag = true; 88 | l2rFlag = l2rFlagArg; 89 | invalidate(); 90 | } 91 | 92 | 93 | public void update(float arg){ 94 | 95 | xCoordinate = arg; 96 | updateFlag = true; 97 | invalidate(); 98 | } 99 | 100 | public float getXCoordinate() { 101 | return xCoordinate; 102 | } 103 | 104 | public void clearBitmap(){ 105 | setClearFlag(true); 106 | invalidate(); 107 | } 108 | 109 | 110 | public void setL2RBitmap(int resId){ 111 | mL2RBitmap = BitmapFactory.decodeResource(getResources(), resId); 112 | } 113 | 114 | public void setR2LBitmap(int resId){ 115 | mR2LBitmap = BitmapFactory.decodeResource(getResources(), resId); 116 | } 117 | public boolean isClearFlag() { 118 | return mClearFlag; 119 | } 120 | 121 | public void setClearFlag(boolean mClearFlag) { 122 | this.mClearFlag = mClearFlag; 123 | } 124 | 125 | } 126 | -------------------------------------------------------------------------------- /AnimatorMenu/src/com/clover/menu/view/MenuImageView.java: -------------------------------------------------------------------------------- 1 | package com.clover.menu.view; 2 | 3 | 4 | 5 | import android.content.Context; 6 | import android.util.AttributeSet; 7 | import android.widget.ImageView; 8 | 9 | public class MenuImageView extends ImageView { 10 | 11 | 12 | private int imageResourceId; 13 | public MenuImageView(Context context, AttributeSet attrs, int defStyle) { 14 | super(context, attrs, defStyle); 15 | } 16 | 17 | public MenuImageView(Context context, AttributeSet attrs) { 18 | super(context, attrs); 19 | } 20 | 21 | public MenuImageView(Context context) { 22 | super(context); 23 | } 24 | 25 | public void updateContent(){ 26 | setImageResource(imageResourceId); 27 | } 28 | 29 | public int getImageResourceId() { 30 | return imageResourceId; 31 | } 32 | 33 | public void setImageResourceId(int imageResourceId) { 34 | this.imageResourceId = imageResourceId; 35 | } 36 | 37 | 38 | } 39 | -------------------------------------------------------------------------------- /AnimatorMenu/src/com/clover/menu/view/MenuLayout.java: -------------------------------------------------------------------------------- 1 | package com.clover.menu.view; 2 | 3 | 4 | 5 | import com.clover.menu.R; 6 | 7 | import android.content.Context; 8 | import android.content.res.TypedArray; 9 | import android.graphics.drawable.Drawable; 10 | import android.util.AttributeSet; 11 | import android.util.TypedValue; 12 | import android.view.Gravity; 13 | import android.view.MotionEvent; 14 | import android.view.View; 15 | import android.widget.ImageView.ScaleType; 16 | import android.widget.LinearLayout; 17 | import android.widget.TextView; 18 | 19 | public class MenuLayout extends LinearLayout { 20 | 21 | 22 | public MenuLayout(Context context, AttributeSet attrs) { 23 | super(context, attrs); 24 | init(context, attrs); 25 | } 26 | 27 | 28 | private int mIndexLable; 29 | 30 | private TextView textView; 31 | private MenuImageView menuImg; 32 | private void init(Context context, AttributeSet attrs){ 33 | 34 | 35 | TypedArray attr = context.obtainStyledAttributes(attrs, 36 | R.styleable.menuLayout); 37 | mIndexLable = attr.getInteger(R.styleable.menuLayout_indexLable, 0); 38 | int imageBackgroundId = attr.getResourceId(R.styleable.menuLayout_imageBackground, R.drawable.ic_launcher 39 | ); 40 | 41 | int imageResourceId = attr.getResourceId(R.styleable.menuLayout_imageContent, R.drawable.ic_launcher); 42 | float textSize = attr.getDimension(R.styleable.menuLayout_textSize, getResources().getDimension(R.dimen.menu_textsize)); 43 | // String label = attr.getString(R.styleable.menuLayout_text); 44 | attr.recycle(); 45 | 46 | setOrientation(LinearLayout.VERTICAL); 47 | setGravity(Gravity.CENTER_HORIZONTAL); 48 | 49 | menuImg = new MenuImageView(context); 50 | menuImg.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT )); 51 | menuImg.setBackgroundResource(imageBackgroundId); 52 | menuImg.setImageResourceId(imageResourceId); 53 | menuImg.setScaleType(ScaleType.CENTER); 54 | addView(menuImg); 55 | textView = new TextView(context); 56 | textView.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); 57 | textView.setGravity(Gravity.CENTER_HORIZONTAL); 58 | textView.setSingleLine(); 59 | addView(textView); 60 | 61 | } 62 | public int getIndexLable() { 63 | return mIndexLable; 64 | } 65 | public void setIndexLable(int mIndexLable) { 66 | if (mIndexLable > 4) { 67 | mIndexLable -= 5; 68 | }else if(mIndexLable < 0){ 69 | mIndexLable += 5; 70 | } 71 | this.mIndexLable = mIndexLable; 72 | } 73 | 74 | public void updateContent(String text){ 75 | menuImg.updateContent(); 76 | textView.setText(text); 77 | } 78 | @Override 79 | public boolean onInterceptTouchEvent(MotionEvent ev) { 80 | // TODO Auto-generated method stub 81 | return onTouchEvent(ev); 82 | } 83 | @Override 84 | public boolean onTouchEvent(MotionEvent event) { 85 | return false; 86 | } 87 | public TextView getTextView() { 88 | return textView; 89 | } 90 | 91 | 92 | 93 | 94 | } 95 | -------------------------------------------------------------------------------- /AnimatorMenu/src/com/clover/menu/view/ViewPagerAD.java: -------------------------------------------------------------------------------- 1 | package com.clover.menu.view; 2 | 3 | import android.content.Context; 4 | import android.graphics.Canvas; 5 | import android.support.v4.view.ViewPager; 6 | import android.util.AttributeSet; 7 | 8 | public class ViewPagerAD extends ViewPager { 9 | public ViewPagerAD(Context context, AttributeSet attrs) { 10 | super(context, attrs); 11 | } 12 | 13 | public ViewPagerAD(Context context) { 14 | super(context); 15 | } 16 | 17 | @Override 18 | protected void onDraw(Canvas canvas) { 19 | // TODO Auto-generated method stub 20 | super.onDraw(canvas); 21 | } 22 | 23 | @Override 24 | protected void onLayout(boolean arg0, int arg1, int arg2, int arg3, int arg4) { 25 | super.onLayout(arg0, arg1, arg2, arg3, arg4); 26 | } 27 | 28 | 29 | } 30 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # AnimatorMenu 2 | 3 | ![imag](https://github.com/xuechinahb/AnimatorMenu/raw/master/image/preview.gif) 4 | 5 | 6 | Notice 7 | ====== 8 | 9 | Resolution is 480X800px. 10 | 11 | The real device is smoother than the simulator. 12 | 13 | If your SDK is under 3.0, consider [NineOldAndroids](https://github.com/JakeWharton/NineOldAndroids) instead. 14 | 15 | 16 | Author 17 | ====== 18 | 19 | Clover Xue 20 | 21 | 22 | Copyright and License 23 | ===================== 24 | 25 | This module is licensed under the [GPLv3](http://gplv3.fsf.org/) license. 26 | 27 | Copyright (C) 2015, by Clover Xue. 28 | 29 | All rights reserved. 30 | -------------------------------------------------------------------------------- /download/AnimatorMenu.apk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xuechinahb/AnimatorMenu/b31fe4d540d3cb2c1fcaa9a6712fb045c872b3a5/download/AnimatorMenu.apk -------------------------------------------------------------------------------- /image/preview.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xuechinahb/AnimatorMenu/b31fe4d540d3cb2c1fcaa9a6712fb045c872b3a5/image/preview.gif --------------------------------------------------------------------------------