org.chromium.ui.gfx.DeviceDisplayInfo Java Examples

The following examples show how to use org.chromium.ui.gfx.DeviceDisplayInfo. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ProfileDataCache.java    From delion with Apache License 2.0 6 votes vote down vote up
public ProfileDataCache(Context context, Profile profile) {
    ProfileDownloader.addObserver(this);

    mContext = context;
    mProfile = profile;

    final DeviceDisplayInfo info = DeviceDisplayInfo.create(context);
    mImageSizePx = (int) Math.ceil(PROFILE_IMAGE_SIZE_DP * info.getDIPScale());
    mImageStrokePx = (int) Math.ceil(PROFILE_IMAGE_STROKE_DP * info.getDIPScale());
    mImageStrokeColor = Color.WHITE;

    Bitmap placeHolder = BitmapFactory.decodeResource(mContext.getResources(),
            R.drawable.fre_placeholder);
    mPlaceholderImage = getCroppedBitmap(placeHolder);

    update();
}
 
Example #2
Source File: AwContents.java    From android-chromium with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public AwContents(AwBrowserContext browserContext, ViewGroup containerView,
        InternalAccessDelegate internalAccessAdapter, AwContentsClient contentsClient,
        AwLayoutSizer layoutSizer, AwSettings settings) {
    mBrowserContext = browserContext;
    mContainerView = containerView;
    mInternalAccessAdapter = internalAccessAdapter;
    mContentsClient = contentsClient;
    mLayoutSizer = layoutSizer;
    mSettings = settings;
    mDIPScale = DeviceDisplayInfo.create(mContainerView.getContext()).getDIPScale();
    mLayoutSizer.setDelegate(new AwLayoutSizerDelegate());
    mLayoutSizer.setDIPScale(mDIPScale);
    mWebContentsDelegate = new AwWebContentsDelegateAdapter(contentsClient, mContainerView);
    mContentsClientBridge = new AwContentsClientBridge(contentsClient);
    mZoomControls = new AwZoomControls(this);
    mIoThreadClient = new IoThreadClientImpl();
    mInterceptNavigationDelegate = new InterceptNavigationDelegateImpl();

    AwSettings.ZoomSupportChangeListener zoomListener =
            new AwSettings.ZoomSupportChangeListener() {
                @Override
                public void onGestureZoomSupportChanged(boolean supportsGestureZoom) {
                    mContentViewCore.updateMultiTouchZoomSupport(supportsGestureZoom);
                    mContentViewCore.updateDoubleTapSupport(supportsGestureZoom);
                }

            };
    mSettings.setZoomListener(zoomListener);
    mDefaultVideoPosterRequestHandler = new DefaultVideoPosterRequestHandler(mContentsClient);
    mSettings.setDefaultVideoPosterURL(
            mDefaultVideoPosterRequestHandler.getDefaultVideoPosterURL());
    mSettings.setDIPScale(mDIPScale);
    mScrollOffsetManager = new AwScrollOffsetManager(new AwScrollOffsetManagerDelegate(),
            new OverScroller(mContainerView.getContext()));
    mScrollAccessibilityHelper = new ScrollAccessibilityHelper(mContainerView);

    setOverScrollMode(mContainerView.getOverScrollMode());
    setScrollBarStyle(mInternalAccessAdapter.super_getScrollBarStyle());
    mContainerView.addOnLayoutChangeListener(new AwLayoutChangeListener());

    setNewAwContents(nativeInit(mBrowserContext));

    onVisibilityChanged(mContainerView, mContainerView.getVisibility());
    onWindowVisibilityChanged(mContainerView.getWindowVisibility());
}
 
Example #3
Source File: AwContents.java    From android-chromium with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public AwContents(AwBrowserContext browserContext, ViewGroup containerView,
        InternalAccessDelegate internalAccessAdapter, AwContentsClient contentsClient,
        AwLayoutSizer layoutSizer, AwSettings settings) {
    mBrowserContext = browserContext;
    mContainerView = containerView;
    mInternalAccessAdapter = internalAccessAdapter;
    mContentsClient = contentsClient;
    mLayoutSizer = layoutSizer;
    mSettings = settings;
    mDIPScale = DeviceDisplayInfo.create(mContainerView.getContext()).getDIPScale();
    mLayoutSizer.setDelegate(new AwLayoutSizerDelegate());
    mLayoutSizer.setDIPScale(mDIPScale);
    mWebContentsDelegate = new AwWebContentsDelegateAdapter(contentsClient, mContainerView);
    mContentsClientBridge = new AwContentsClientBridge(contentsClient);
    mZoomControls = new AwZoomControls(this);
    mIoThreadClient = new IoThreadClientImpl();
    mInterceptNavigationDelegate = new InterceptNavigationDelegateImpl();

    AwSettings.ZoomSupportChangeListener zoomListener =
            new AwSettings.ZoomSupportChangeListener() {
                @Override
                public void onGestureZoomSupportChanged(boolean supportsGestureZoom) {
                    mContentViewCore.updateMultiTouchZoomSupport(supportsGestureZoom);
                    mContentViewCore.updateDoubleTapSupport(supportsGestureZoom);
                }

            };
    mSettings.setZoomListener(zoomListener);
    mDefaultVideoPosterRequestHandler = new DefaultVideoPosterRequestHandler(mContentsClient);
    mSettings.setDefaultVideoPosterURL(
            mDefaultVideoPosterRequestHandler.getDefaultVideoPosterURL());
    mSettings.setDIPScale(mDIPScale);
    mScrollOffsetManager = new AwScrollOffsetManager(new AwScrollOffsetManagerDelegate(),
            new OverScroller(mContainerView.getContext()));
    mScrollAccessibilityHelper = new ScrollAccessibilityHelper(mContainerView);

    setOverScrollMode(mContainerView.getOverScrollMode());
    setScrollBarStyle(mInternalAccessAdapter.super_getScrollBarStyle());
    mContainerView.addOnLayoutChangeListener(new AwLayoutChangeListener());

    setNewAwContents(nativeInit(mBrowserContext));

    onVisibilityChanged(mContainerView, mContainerView.getVisibility());
    onWindowVisibilityChanged(mContainerView.getWindowVisibility());
}