下面列出了android.view.Choreographer#getInstance ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
public DisplayPowerState(DisplayBlanker blanker, ColorFade colorFade) {
mHandler = new Handler(true /*async*/);
mChoreographer = Choreographer.getInstance();
mBlanker = blanker;
mColorFade = colorFade;
mPhotonicModulator = new PhotonicModulator();
mPhotonicModulator.start();
// At boot time, we know that the screen is on and the electron beam
// animation is not playing. We don't know the screen's brightness though,
// so prepare to set it to a known state when the state is next applied.
// Although we set the brightness to full on here, the display power controller
// will reset the brightness to a new level immediately before the changes
// actually have a chance to be applied.
mScreenState = Display.STATE_ON;
mScreenBrightness = PowerManager.BRIGHTNESS_ON;
scheduleScreenUpdate();
mColorFadePrepared = false;
mColorFadeLevel = 1.0f;
mColorFadeReady = true;
}
@Override
public void onCreate() {
super.onCreate();
mContext = this;
Tips.init(this);
DataCenter.init(this, "zhuanlan.db");
// StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
// .detectDiskReads()
// .detectDiskWrites()
// .detectNetwork()
// .penaltyLog()
// .build());
//
// StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder()
// .detectActivityLeaks()
// .detectLeakedSqlLiteObjects()
// .penaltyLog()
// .penaltyDeath()
// .build());
initStetho();
Choreographer choreographer = Choreographer.getInstance();
choreographer.postFrameCallback(FRAME_CALLBACK);
}
protected void redraw() {
log("redraw()");
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
// stay in sync with display updates
Choreographer choreographer = Choreographer.getInstance();
choreographer.removeFrameCallback(redrawCallback);
choreographer.postFrameCallback(redrawCallback);
} else {
redrawInternal();
}
}
@Override
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
public void onTaskInit() {
this.mFpsChecker = new FPSSampler(Choreographer.getInstance());
mFpsChecker.reset();
mFpsChecker.start();
}
private void createChoreographerInstanceInternal() {
choreographer = Choreographer.getInstance();
}
public RampAnimator(T object, IntProperty<T> property) {
mObject = object;
mProperty = property;
mChoreographer = Choreographer.getInstance();
}
private void createChoreographerInstanceInternal() {
choreographer = Choreographer.getInstance();
}
public Metronome() {
choreographer = Choreographer.getInstance();
}
private void createChoreographerInstanceInternal() {
choreographer = Choreographer.getInstance();
}
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
private Choreographer getChoreographer() {
return Choreographer.getInstance();
}
public FpsDataModule(int interval) {
this.interval = interval;
this.choreographer = Choreographer.getInstance();
}
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
private Choreographer getChoreographer() {
return Choreographer.getInstance();
}
public WallpaperOffsetInterpolator() {
mChoreographer = Choreographer.getInstance();
mInterpolator = new DecelerateInterpolator(1.5f);
}
/**
* @return an Android spring choreographer using the system {@link android.view.Choreographer}
*/
public static ChoreographerAndroidSpringLooper create() {
return new ChoreographerAndroidSpringLooper(Choreographer.getInstance());
}
public MouseCursor(GameActivity activity, Osc osc) {
this.osc = osc;
Resources r = activity.getResources();
int height = (int)TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 30, r.getDisplayMetrics());
int width = (int) Math.round(height / 1.5);
cursor = new FixedSizeImageView(activity, width, height);
cursor.setImageResource(R.drawable.pointer_arrow);
cursor.setLayoutParams(new RelativeLayout.LayoutParams(width, height));
layout = activity.getLayout();
layout.addView(cursor);
choreographer = Choreographer.getInstance();
choreographer.postFrameCallback(this);
}
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
private Choreographer getChoreographer() {
return Choreographer.getInstance();
}
@Override
public Choreographer getChoreographer() {
return Choreographer.getInstance();
}
/**
* @return an Android spring choreographer using the system {@link Choreographer}
*/
public static ChoreographerAndroidSpringLooper create() {
return new ChoreographerAndroidSpringLooper(Choreographer.getInstance());
}
public Metronome() {
choreographer = Choreographer.getInstance();
}
private void createChoreographerInstanceInternal() {
choreographer = Choreographer.getInstance();
}