This source file includes following definitions.
- JNINamespace
- getViewAndroidDelegate
- destroy
- getNativePointer
- incrementKeepScreenOnCount
- decrementKeepScreenOnCount
- nativeInit
- nativeDestroy
package org.chromium.ui.base;
import android.view.View;
import org.chromium.base.JNINamespace;
@JNINamespace("ui")
public class ViewAndroid {
private long mNativeViewAndroid = 0;
private final ViewAndroidDelegate mViewAndroidDelegate;
private final WindowAndroid mWindowAndroid;
private int mKeepScreenOnCount;
private View mKeepScreenOnView;
public ViewAndroid(WindowAndroid nativeWindow, ViewAndroidDelegate viewAndroidDelegate) {
mWindowAndroid = nativeWindow;
mViewAndroidDelegate = viewAndroidDelegate;
mNativeViewAndroid = nativeInit(mWindowAndroid.getNativePointer());
}
public ViewAndroidDelegate getViewAndroidDelegate() {
return mViewAndroidDelegate;
}
public void destroy() {
if (mNativeViewAndroid != 0) {
nativeDestroy(mNativeViewAndroid);
mNativeViewAndroid = 0;
}
}
public long getNativePointer() {
return mNativeViewAndroid;
}
public void incrementKeepScreenOnCount() {
mKeepScreenOnCount++;
if (mKeepScreenOnCount == 1) {
mKeepScreenOnView = mViewAndroidDelegate.acquireAnchorView();
mKeepScreenOnView.setKeepScreenOn(true);
}
}
public void decrementKeepScreenOnCount() {
assert mKeepScreenOnCount > 0;
mKeepScreenOnCount--;
if (mKeepScreenOnCount == 0) {
mViewAndroidDelegate.releaseAnchorView(mKeepScreenOnView);
mKeepScreenOnView = null;
}
}
private native long nativeInit(long windowPtr);
private native void nativeDestroy(long nativeViewAndroid);
}