Home | History | Annotate | Download | only in hwui
      1 /*
      2  * Copyright (C) 2010 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 package com.android.test.hwui;
     18 
     19 import android.animation.ObjectAnimator;
     20 import android.app.Activity;
     21 import android.content.Context;
     22 import android.graphics.Bitmap;
     23 import android.graphics.BitmapFactory;
     24 import android.graphics.Camera;
     25 import android.graphics.Canvas;
     26 import android.graphics.Matrix;
     27 import android.os.Bundle;
     28 import android.view.View;
     29 import android.widget.FrameLayout;
     30 import android.widget.ImageView;
     31 
     32 @SuppressWarnings({"UnusedDeclaration"})
     33 public class Animated3dActivity extends Activity {
     34     @Override
     35     protected void onCreate(Bundle savedInstanceState) {
     36         super.onCreate(savedInstanceState);
     37 
     38         ImageView view = new ImageView(this);
     39         view.setImageResource(R.drawable.large_photo);
     40 
     41         setContentView(view, new FrameLayout.LayoutParams(
     42                 FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT
     43         ));
     44 
     45         ObjectAnimator animator = ObjectAnimator.ofFloat(view, "rotationY", 0.0f, 360.0f);
     46         animator.setDuration(4000);
     47         animator.setRepeatCount(ObjectAnimator.INFINITE);
     48         animator.setRepeatMode(ObjectAnimator.REVERSE);
     49         animator.start();
     50     }
     51 }
     52