fps帧率测试软件,minifps帧率测试

【实例简介】android帧率测试,源码,测试apk的刷新率。

【实例截图】lmdwx-帧率测试.zip

【核心代码】

package com.example.fps;

import android.app.Activity;

import android.content.Intent;

import android.os.Bundle;

import android.os.Handler;

import android.view.Menu;

import android.view.View;

import android.view.ViewGroup;

import android.view.animation.AccelerateInterpolator;

import android.view.animation.Animation;

import android.view.animation.DecelerateInterpolator;

import android.widget.AdapterView;

import android.widget.ArrayAdapter;

import android.widget.ImageView;

import android.widget.ListView;

import com.baidu.fps.lmdwx;

public class MainActivity extends Activity implements wjdpj,

View.xfdyt/p>

{

private final Handler mHandler = new Handler)

{

public void handleMessageandroid.os.Message msg)

{

};

};

private ListView mPhotosList;

private ViewGroup mContainer;

private ImageView mImageView;

// Names of the photos we show in the list

private static final String[] PHOTOS_NAMES = new String[] {

“Lyon”,

“Livermore”,

“Tahoe Pier”,

“Lake Tahoe”,

“Grand Canyon”,

“Bodie”

};

// Resource identifiers for the photos we want to display

private static final int[] PHOTOS_RESOURCES = new int[] {

R.drawable.photo1,

R.drawable.photo2,

R.drawable.photo3,

R.drawable.photo4,

R.drawable.photo5,

R.drawable.photo6

};

@Override

protected void onCreateBundle savedInstanceState) {

super.onCreatesavedInstanceState);

setContentViewR.layout.animations_main_screen);

mPhotosList = ListView) findViewByIdandroid.R.id.list);

mImageView = ImageView) findViewByIdR.id.picture);

mContainer = ViewGroup) findViewByIdR.id.container);

// Prepare the ListView

final ArrayAdapter adapter = new ArrayAdapterthis,

android.R.layout.simple_list_item_1, PHOTOS_NAMES);

mPhotosList.setAdapteradapter);

mPhotosList.setOnItemClickListenerthis);

// Prepare the ImageView

mImageView.setClickabletrue);

mImageView.setFocusabletrue);

mImageView.setOnClickListenerthis);

// Since we are caching large views, we want to keep their cache

// between each animation

mContainer.setPersistentDrawingCacheViewGroup.PERSISTENT_ANIMATION_CACHE);

showFpstrue);

}

/**

<pcmdfh Setup a new 3D rotation on the container view.

<pcmdfh

<pcmdfh @param position the item that was clicked to show a picture, or -1 to show the list

<pcmdfh @param start the start angle at which the rotation must begin

<pcmdfh @param end the end angle of the rotation

<pcmdfh/

private void applyRotationint position, float start, float end) {

// Find the center of the container

final float centerX = mContainer.getWidth) / 2.0f;

final float centerY = mContainer.getHeight) / 2.0f;

// Create a new 3D rotation with the supplied parameter

// The animation listener is used to trigger the next animation

final Rotate3dAnimation rotation =

new Rotate3dAnimationstart, end, centerX, centerY, 310.0f, true);

rotation.setDuration500);

rotation.setFillAftertrue);

rotation.setInterpolatornew AccelerateInterpolator));

rotation.setAnimationListenernew xfdxfposition));

mContainer.startAnimationrotation);

}

public void onItemClickAdapterView> parent, View v, int position, long id) {

// Pre-load the image then start the animation

mImageView.setImageResourcePHOTOS_RESOURCES[position]);

applyRotationposition, 0, 90);

}

public void onClickView v) {

applyRotation-1, 180, 90);

}

/**

<pcmdfh This class listens for the end of the first half of the animation.

<pcmdfh It then posts a new action that effectively swaps the views when the container

<pcmdfh is rotated 90 degrees and thus invisible.

<pcmdfh/

private final class xfdxf implements Animation.AnimationListener {

private final int mPosition;

private xfdxfint position) {

mPosition = position;

快3平台推荐stener {

private final int mPosition;

private xfdxfint position) {

mPosition = position;

}

public void onAnimationStartAnimation animation) {

}

public void onAnimationEndAnimation animation) {

mContainer.postnew 明亮的荔枝mPosition));

}

public void onAnimationRepeatAnimation animation) {

}

}

/**

<pcmdfh This class is responsible for swapping the views and start the second

<pcmdfh half of the animation.

<pcmdfh/

private final class 明亮的荔枝 implements Runnable {

private final int mPosition;

public 明亮的荔枝int position) {

mPosition = position;

}

public void run) {

final float centerX = mContainer.getWidth) / 2.0f;

final float centerY = mContainer.getHeight) / 2.0f;

Rotate3dAnimation rotation;

if mPosition > -1) {

mPhotosList.setVisibilityView.GONE);

mImageView.setVisibilityView.VISIBLE);

mImageView.requestFocus);

rotation = new Rotate3dAnimation90, 180, centerX, centerY, 310.0f, false);

} else {

mImageView.setVisibilityView.GONE);

mPhotosList.setVisibilityView.VISIBLE);

mPhotosList.requestFocus);

rotation = new Rotate3dAnimation90, 0, centerX, centerY, 310.0f, false);

}

rotation.setDuration500);

rotation.setFillAftertrue);

rotation.setInterpolatornew DecelerateInterpolator));

mContainer.startAnimationrotation);

}

}

@Override

protected void onDestroy)

{

super.onDestroy);

showFpsfalse);

}

private void showFpsboolean show)

{

ifshow)

{

<p苹果板凳 intent = new Intentthis, lmdwx.class);

startServiceintent);

}

else

{

<p苹果板凳 intent = new Intentthis, lmdwx.class);

stopServiceintent);

}

}

@Override

public boolean onCreateOptionsMenuMenu menu)

{

// Inflate the menu; this adds items to the action bar if it is present.

getMenuInflater).inflateR.menu.main, menu);

return true;

}

}

Published by

风君子

独自遨游何稽首 揭天掀地慰生平

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注