Search in sources :

Example 71 with WindowManager

use of android.view.WindowManager in project platform_frameworks_base by android.

the class SurfaceCompositionMeasuringActivity method detectRefreshRate.

private void detectRefreshRate() {
    WindowManager wm = (WindowManager) getSystemService(Context.WINDOW_SERVICE);
    mRefreshRate = wm.getDefaultDisplay().getRefreshRate();
    if (mRefreshRate < MIN_REFRESH_RATE_SUPPORTED)
        throw new RuntimeException("Unsupported display refresh rate: " + mRefreshRate);
    mTargetFPS = mRefreshRate - 2.0f;
}
Also used : WindowManager(android.view.WindowManager)

Example 72 with WindowManager

use of android.view.WindowManager in project platform_frameworks_base by android.

the class WallpaperManagerService method getMaximumSizeDimension.

private int getMaximumSizeDimension() {
    WindowManager wm = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE);
    Display d = wm.getDefaultDisplay();
    return d.getMaximumSizeDimension();
}
Also used : WindowManager(android.view.WindowManager) IWindowManager(android.view.IWindowManager) Display(android.view.Display)

Example 73 with WindowManager

use of android.view.WindowManager in project platform_frameworks_base by android.

the class ActivityThread method handleDestroyActivity.

private void handleDestroyActivity(IBinder token, boolean finishing, int configChanges, boolean getNonConfigInstance) {
    ActivityClientRecord r = performDestroyActivity(token, finishing, configChanges, getNonConfigInstance);
    if (r != null) {
        cleanUpPendingRemoveWindows(r, finishing);
        WindowManager wm = r.activity.getWindowManager();
        View v = r.activity.mDecor;
        if (v != null) {
            if (r.activity.mVisibleFromServer) {
                mNumVisibleActivities--;
            }
            IBinder wtoken = v.getWindowToken();
            if (r.activity.mWindowAdded) {
                if (r.mPreserveWindow) {
                    // Hold off on removing this until the new activity's
                    // window is being added.
                    r.mPendingRemoveWindow = r.window;
                    r.mPendingRemoveWindowManager = wm;
                    // We can only keep the part of the view hierarchy that we control,
                    // everything else must be removed, because it might not be able to
                    // behave properly when activity is relaunching.
                    r.window.clearContentView();
                } else {
                    wm.removeViewImmediate(v);
                }
            }
            if (wtoken != null && r.mPendingRemoveWindow == null) {
                WindowManagerGlobal.getInstance().closeAll(wtoken, r.activity.getClass().getName(), "Activity");
            } else if (r.mPendingRemoveWindow != null) {
                // We're preserving only one window, others should be closed so app views
                // will be detached before the final tear down. It should be done now because
                // some components (e.g. WebView) rely on detach callbacks to perform receiver
                // unregister and other cleanup.
                WindowManagerGlobal.getInstance().closeAllExceptView(token, v, r.activity.getClass().getName(), "Activity");
            }
            r.activity.mDecor = null;
        }
        if (r.mPendingRemoveWindow == null) {
            // If we are delaying the removal of the activity window, then
            // we can't clean up all windows here.  Note that we can't do
            // so later either, which means any windows that aren't closed
            // by the app will leak.  Well we try to warning them a lot
            // about leaking windows, because that is a bug, so if they are
            // using this recreate facility then they get to live with leaks.
            WindowManagerGlobal.getInstance().closeAll(token, r.activity.getClass().getName(), "Activity");
        }
        // Mocked out contexts won't be participating in the normal
        // process lifecycle, but if we're running with a proper
        // ApplicationContext we need to have it tear down things
        // cleanly.
        Context c = r.activity.getBaseContext();
        if (c instanceof ContextImpl) {
            ((ContextImpl) c).scheduleFinalCleanup(r.activity.getClass().getName(), "Activity");
        }
    }
    if (finishing) {
        try {
            ActivityManagerNative.getDefault().activityDestroyed(token);
        } catch (RemoteException ex) {
            throw ex.rethrowFromSystemServer();
        }
    }
    mSomeActivitiesChanged = true;
}
Also used : Context(android.content.Context) IBinder(android.os.IBinder) RemoteException(android.os.RemoteException) View(android.view.View) WebView(android.webkit.WebView) WindowManager(android.view.WindowManager)

Example 74 with WindowManager

use of android.view.WindowManager in project platform_frameworks_base by android.

the class MenuPopupHelper method createPopup.

/**
     * Creates the popup and assigns cached properties.
     *
     * @return an initialized popup
     */
@NonNull
private MenuPopup createPopup() {
    final WindowManager windowManager = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE);
    final Display display = windowManager.getDefaultDisplay();
    final Point displaySize = new Point();
    display.getRealSize(displaySize);
    final int smallestWidth = Math.min(displaySize.x, displaySize.y);
    final int minSmallestWidthCascading = mContext.getResources().getDimensionPixelSize(com.android.internal.R.dimen.cascading_menus_min_smallest_width);
    final boolean enableCascadingSubmenus = smallestWidth >= minSmallestWidthCascading;
    final MenuPopup popup;
    if (enableCascadingSubmenus) {
        popup = new CascadingMenuPopup(mContext, mAnchorView, mPopupStyleAttr, mPopupStyleRes, mOverflowOnly);
    } else {
        popup = new StandardMenuPopup(mContext, mMenu, mAnchorView, mPopupStyleAttr, mPopupStyleRes, mOverflowOnly);
    }
    // Assign immutable properties.
    popup.addMenu(mMenu);
    popup.setOnDismissListener(mInternalOnDismissListener);
    // Assign mutable properties. These may be reassigned later.
    popup.setAnchorView(mAnchorView);
    popup.setCallback(mPresenterCallback);
    popup.setForceShowIcon(mForceShowIcon);
    popup.setGravity(mDropDownGravity);
    return popup;
}
Also used : Point(android.graphics.Point) Point(android.graphics.Point) WindowManager(android.view.WindowManager) Display(android.view.Display) NonNull(android.annotation.NonNull)

Example 75 with WindowManager

use of android.view.WindowManager in project Talon-for-Twitter by klinker24.

the class EmojiKeyboard method onFinishInflate.

@Override
protected void onFinishInflate() {
    try {
        try {
            getContext().getPackageManager().getPackageInfo("com.klinker.android.emoji_keyboard_trial", PackageManager.GET_META_DATA);
        } catch (Exception e) {
            getContext().getPackageManager().getPackageInfo("com.klinker.android.emoji_keyboard_trial_ios", PackageManager.GET_META_DATA);
        }
        emojiPager = (ViewPager) findViewById(R.id.emojiKeyboardPager);
        backspace = (ImageButton) findViewById(R.id.delete);
        Display d = ((WindowManager) getContext().getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
        keyboardHeight = (int) (d.getHeight() / 3.0);
        dataSource = new EmojiDataSource(getContext());
        dataSource.open();
        recents = (ArrayList<Recent>) dataSource.getAllRecents();
        emojiPager.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, keyboardHeight));
        tabs = (PagerSlidingTabStrip) findViewById(R.id.emojiTabs);
        tabs.setIndicatorColor(getResources().getColor(R.color.app_color));
        emojiPagerAdapter = new EmojiPagerAdapter(getContext(), emojiPager);
        emojiPager.setAdapter(emojiPagerAdapter);
        tabs.setViewPager(emojiPager);
        emojiPager.setCurrentItem(1);
        backspace.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                removeText();
            }
        });
    } catch (Exception e) {
    }
}
Also used : Recent(com.klinker.android.twitter.data.sq_lite.Recent) EmojiDataSource(com.klinker.android.twitter.data.sq_lite.EmojiDataSource) GridView(android.widget.GridView) View(android.view.View) LinearLayout(android.widget.LinearLayout) Display(android.view.Display) WindowManager(android.view.WindowManager)

Aggregations

WindowManager (android.view.WindowManager)394 Display (android.view.Display)177 Point (android.graphics.Point)121 DisplayMetrics (android.util.DisplayMetrics)100 View (android.view.View)42 IWindowManager (android.view.IWindowManager)37 Context (android.content.Context)34 Resources (android.content.res.Resources)25 ImageView (android.widget.ImageView)23 Configuration (android.content.res.Configuration)19 SuppressLint (android.annotation.SuppressLint)17 Camera (android.hardware.Camera)17 Intent (android.content.Intent)16 Rect (android.graphics.Rect)16 RemoteException (android.os.RemoteException)15 LayoutParams (android.view.WindowManager.LayoutParams)15 Dialog (android.app.Dialog)14 TextView (android.widget.TextView)14 Bitmap (android.graphics.Bitmap)10 PointerLocationView (com.android.internal.widget.PointerLocationView)10