码迷,mamicode.com
首页 > 其他好文 > 详细

Launcher定制之 应用分发--高仿APUS桌面,上拉加载应用分发雷达效果

时间:2015-06-08 19:37:22      阅读:122      评论:0      收藏:0      [点我收藏+]

标签:

直接上代码,

需要图片资源请到APUS里面去提取。


xml:

<?xml version="1.0" encoding="utf-8"?>
<merge android:layout_width="fill_parent" android:layout_height="100.0dip"
  xmlns:android="http://schemas.android.com/apk/res/android">
    <TextView 
        android:textSize="16.0sp" 
        android:textColor="#ffffffff" 
        android:gravity="bottom|center" 
        android:id="@+id/intro" 
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content" 
        android:minHeight="40.0dip" 
        android:text="加载更多" android:singleLine="false" />
    <FrameLayout 
        android:layout_gravity="bottom|center" 
        android:id="@+id/anim_view" 
        android:clipChildren="true" 
        android:layout_width="fill_parent" 
        android:layout_height="100.0dip">
        <ImageView 
            android:layout_gravity="top|center" 
            android:id="@+id/scan_meter" 
            android:layout_width="210.0dip" 
            android:layout_height="210.0dip" 
            android:layout_marginTop="-5.0dip" 
            android:src="@drawable/folder_radar_center_meter" 
            android:scaleType="fitXY" 
            android:contentDescription="nil" />
        <ImageView 
            android:layout_gravity="bottom|center" 
            android:id="@+id/scan_indicator" 
            android:layout_width="146.0dip" 
            android:layout_height="73.0dip" 
            android:src="@drawable/radar_scan_indicator"
			android:scaleType="fitXY" 
			android:contentDescription="nil" />
    </FrameLayout>
</merge>


package com.xyz.workspace;

import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ValueAnimator;
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.view.animation.LinearInterpolator;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.TextView;

public class PromotionLoadingFooter extends FrameLayout {
	public PromotionLoadingFooter(Context context) {
		super(context);
		// TODO Auto-generated constructor stub
		init();
	}
	
	public PromotionLoadingFooter(Context context, AttributeSet attrs) {
		super(context, attrs);
		init();
	}
	
	
	
	ValueAnimator valueAnimator;
	View anim_view = null;
	ImageView scan_meter = null;
	ImageView scan_indicator = null;
	TextView intro;

	
	
	private void init() {
		inflate(getContext(), R.layout.folder_promotion_loading_footer, this);
		 anim_view = findViewById(R.id.anim_view);
		 scan_meter = ((ImageView) findViewById(R.id.scan_meter));
		 scan_indicator = ((ImageView) findViewById(R.id.scan_indicator));
		 intro = ((TextView) findViewById(R.id.intro));
		
	}
	
	public void startAnima(){
		
		anim_view.clearAnimation();
		scan_meter.clearAnimation();
		scan_indicator.clearAnimation();
		intro.clearAnimation();
		
		valueAnimator= ValueAnimator.ofFloat(new float[] { 0.0F, 1.0F });
		valueAnimator.setDuration(1200L);
		valueAnimator.setInterpolator(new LinearInterpolator());
		valueAnimator.setRepeatCount(6);
		valueAnimator.setRepeatMode(1);
		AnimatorListenerAdapter local1 = new AnimatorListenerAdapter() {
			public void onAnimationEnd(Animator paramAnimator) {

			}

			public void onAnimationRepeat(Animator paramAnimator) {
				
			}

			public void onAnimationStart(Animator paramAnimator) {
				scan_meter.setPivotX(scan_meter.getWidth() / 2);
				scan_meter.setPivotY(scan_meter.getHeight());
				scan_indicator.setPivotX(scan_indicator.getWidth() / 2);
				scan_indicator.setPivotY(scan_indicator.getHeight());
			}
		};
		ValueAnimator.AnimatorUpdateListener local2 = new ValueAnimator.AnimatorUpdateListener() {
			public void onAnimationUpdate(ValueAnimator paramValueAnimator) {
				float f = ((Float) paramValueAnimator.getAnimatedValue())
						.floatValue();
				scan_indicator.setRotation(f * 360.0F);
			}
		};
		valueAnimator.addListener(local1);
		valueAnimator.addUpdateListener(local2);
		
		intro.setVisibility(View.GONE);
		
		
		 valueAnimator.start();
	}

}


技术分享

Launcher定制之 应用分发--高仿APUS桌面,上拉加载应用分发雷达效果

标签:

原文地址:http://blog.csdn.net/xufeifandj/article/details/46416393

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!