本文整理汇总了Java中android.view.Choreographer.getInstance方法的典型用法代码示例。如果您正苦于以下问题:Java Choreographer.getInstance方法的具体用法?Java Choreographer.getInstance怎么用?Java Choreographer.getInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.view.Choreographer
的用法示例。
在下文中一共展示了Choreographer.getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: startRecordingFps
import android.view.Choreographer; //导入方法依赖的package包/类
@ReactMethod
public void startRecordingFps() {
if (mCatalystSettings == null ||
!mCatalystSettings.isAnimationFpsDebugEnabled()) {
return;
}
if (mFrameCallback != null) {
throw new JSApplicationCausedNativeException("Already recording FPS!");
}
checkAPILevel();
mFrameCallback = new FpsDebugFrameCallback(
Choreographer.getInstance(),
getReactApplicationContext());
mFrameCallback.startAndRecordFpsAtEachFrame();
}
示例2: WallpaperOffsetInterpolator
import android.view.Choreographer; //导入方法依赖的package包/类
public WallpaperOffsetInterpolator(Workspace workspace) {
mChoreographer = Choreographer.getInstance();
mInterpolator = new DecelerateInterpolator(1.5f);
mWorkspace = workspace;
mWallpaperManager = WallpaperManager.getInstance(workspace.getContext());
mIsRtl = Utilities.isRtl(workspace.getResources());
}
示例3: start
import android.view.Choreographer; //导入方法依赖的package包/类
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
public void start() {
Log.d(TAG, "start vsync detect");
if (mRunning) {
return;
}
mRunning = true;
syncCheckThread = new Thread(new Runnable() {
@Override
public void run() {
for (;;) {
if (!mRunning) {
break;
}
syncCheckThread();
}
}
});
syncCheckThread.start();
Choreographer chor = Choreographer.getInstance();
Field field;
try {
field = chor.getClass().getDeclaredField("mFrameIntervalNanos");
field.setAccessible(true);
mFrameIntervalNanos = field.getLong(chor);
Log.d(TAG, "mFrameIntervalNanos " + mFrameIntervalNanos);
} catch (Exception e) {
Log.e(TAG, "error: " + e.getMessage());
}
chor.postFrameCallback(frameCallback);
}
示例4: onLooperPrepared
import android.view.Choreographer; //导入方法依赖的package包/类
@Override
protected void onLooperPrepared() {
mSampleChoreographer = Choreographer.getInstance();
mSampleCallback = new Choreographer.FrameCallback() {
@Override
public void doFrame(final long frameTimeNanos) {
final long delta = (frameTimeNanos - lastSampleTime) / 1000000;
if (lastSampleTime != 0 && delta > delay) {
//采样周期不准了,目前丢弃吧
//LogUtils.w("monitor", "sample doFrame " + delta);
// mCheckerHandler.post(new Runnable() {
// @Override
// public void run() {
// processInfo(lastSampleTime / 1000000,frameTimeNanos / 1000000);
// }
// });
} else {
mCheckerHandler.post(new Runnable() {
@Override
public void run() {
statisticsStack(frameTimeNanos / 1000000, delta, StackInfo.TYPE_SAMPLE);
}
});
}
lastSampleTime = frameTimeNanos;
if (mLoopFlag) {
mSampleChoreographer.postFrameCallback(mSampleCallback);
}
}
};
lock[0] = true;
}
示例5: FpsView
import android.view.Choreographer; //导入方法依赖的package包/类
public FpsView(ReactContext reactContext) {
super(reactContext);
inflate(reactContext, R.layout.fps_view, this);
mTextView = (TextView) findViewById(R.id.fps_text);
mFrameCallback = new FpsDebugFrameCallback(Choreographer.getInstance(), reactContext);
mFPSMonitorRunnable = new FPSMonitorRunnable();
setCurrentFPS(0, 0, 0, 0);
}
示例6: ReactChoreographer
import android.view.Choreographer; //导入方法依赖的package包/类
private ReactChoreographer() {
mChoreographer = Choreographer.getInstance();
mReactChoreographerDispatcher = new ReactChoreographerDispatcher();
mCallbackQueues = new ArrayDeque[CallbackType.values().length];
for (int i = 0; i < mCallbackQueues.length; i++) {
mCallbackQueues[i] = new ArrayDeque<>();
}
}
示例7: redraw
import android.view.Choreographer; //导入方法依赖的package包/类
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();
}
}
示例8: enable
import android.view.Choreographer; //导入方法依赖的package包/类
@Override
public void enable() {
haveSync = false;
if (usePrimaryDisplayVsync) {
sampledVsyncTimeNs = 0;
choreographer = Choreographer.getInstance();
choreographer.postFrameCallback(this);
}
}
示例9: FpsDataModule
import android.view.Choreographer; //导入方法依赖的package包/类
public FpsDataModule(int interval) {
this.interval = interval;
this.choreographer = Choreographer.getInstance();
}
示例10: Metronome
import android.view.Choreographer; //导入方法依赖的package包/类
public Metronome() {
choreographer = Choreographer.getInstance();
}
示例11: createChoreographerInstanceInternal
import android.view.Choreographer; //导入方法依赖的package包/类
private void createChoreographerInstanceInternal() {
choreographer = Choreographer.getInstance();
}
示例12: create
import android.view.Choreographer; //导入方法依赖的package包/类
/**
* @return an Android spring choreographer using the system {@link Choreographer}
*/
public static ChoreographerAndroidSpringLooper create() {
return new ChoreographerAndroidSpringLooper(Choreographer.getInstance());
}
示例13: getChoreographer
import android.view.Choreographer; //导入方法依赖的package包/类
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
private Choreographer getChoreographer() {
return Choreographer.getInstance();
}
示例14: create
import android.view.Choreographer; //导入方法依赖的package包/类
public static ChoreographerAndroidSpringLooper create() {
return new ChoreographerAndroidSpringLooper(Choreographer.getInstance());
}
示例15: getChoreographer
import android.view.Choreographer; //导入方法依赖的package包/类
@TargetApi(16)
private Choreographer getChoreographer() {
return Choreographer.getInstance();
}