Search in sources :

Example 61 with Window

use of android.view.Window in project android_frameworks_base by ParanoidAndroid.

the class PhoneWindowManager method addStartingWindow.

/** {@inheritDoc} */
@Override
public View addStartingWindow(IBinder appToken, String packageName, int theme, CompatibilityInfo compatInfo, CharSequence nonLocalizedLabel, int labelRes, int icon, int windowFlags) {
    if (!SHOW_STARTING_ANIMATIONS) {
        return null;
    }
    if (packageName == null) {
        return null;
    }
    WindowManager wm = null;
    View view = null;
    try {
        Context context = mContext;
        if (DEBUG_STARTING_WINDOW)
            Slog.d(TAG, "addStartingWindow " + packageName + ": nonLocalizedLabel=" + nonLocalizedLabel + " theme=" + Integer.toHexString(theme));
        try {
            context = context.createPackageContext(packageName, 0);
            if (theme != context.getThemeResId()) {
                context.setTheme(theme);
            }
        } catch (PackageManager.NameNotFoundException e) {
        // Ignore
        }
        Window win = PolicyManager.makeNewWindow(context);
        final TypedArray ta = win.getWindowStyle();
        if (ta.getBoolean(com.android.internal.R.styleable.Window_windowDisablePreview, false) || ta.getBoolean(com.android.internal.R.styleable.Window_windowShowWallpaper, false)) {
            return null;
        }
        Resources r = context.getResources();
        win.setTitle(r.getText(labelRes, nonLocalizedLabel));
        win.setType(WindowManager.LayoutParams.TYPE_APPLICATION_STARTING);
        // Force the window flags: this is a fake window, so it is not really
        // touchable or focusable by the user.  We also add in the ALT_FOCUSABLE_IM
        // flag because we do know that the next window will take input
        // focus, so we want to get the IME window up on top of us right away.
        win.setFlags(windowFlags | WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM, windowFlags | WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
        if (!compatInfo.supportsScreen()) {
            win.addFlags(WindowManager.LayoutParams.FLAG_COMPATIBLE_WINDOW);
        }
        win.setLayout(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT);
        final WindowManager.LayoutParams params = win.getAttributes();
        params.token = appToken;
        params.packageName = packageName;
        params.windowAnimations = win.getWindowStyle().getResourceId(com.android.internal.R.styleable.Window_windowAnimationStyle, 0);
        params.privateFlags |= WindowManager.LayoutParams.PRIVATE_FLAG_FAKE_HARDWARE_ACCELERATED;
        params.privateFlags |= WindowManager.LayoutParams.PRIVATE_FLAG_SHOW_FOR_ALL_USERS;
        params.setTitle("Starting " + packageName);
        wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
        view = win.getDecorView();
        if (win.isFloating()) {
            // earlier.)
            return null;
        }
        if (DEBUG_STARTING_WINDOW)
            Slog.d(TAG, "Adding starting window for " + packageName + " / " + appToken + ": " + (view.getParent() != null ? view : null));
        wm.addView(view, params);
        // window manager... which we can tell by it having a parent.
        return view.getParent() != null ? view : null;
    } catch (WindowManager.BadTokenException e) {
        // ignore
        Log.w(TAG, appToken + " already running, starting window not displayed");
    } catch (RuntimeException e) {
        // don't crash if something else bad happens, for example a
        // failure loading resources because we are loading from an app
        // on external storage that has been unmounted.
        Log.w(TAG, appToken + " failed creating starting window", e);
    } finally {
        if (view != null && view.getParent() == null) {
            Log.w(TAG, "view not successfully added to wm, removing view");
            wm.removeViewImmediate(view);
        }
    }
    return null;
}
Also used : Context(android.content.Context) Window(android.view.Window) PackageManager(android.content.pm.PackageManager) TypedArray(android.content.res.TypedArray) LayoutParams(android.view.WindowManager.LayoutParams) Resources(android.content.res.Resources) PointerLocationView(com.android.internal.widget.PointerLocationView) View(android.view.View) IWindowManager(android.view.IWindowManager) WindowManager(android.view.WindowManager)

Example 62 with Window

use of android.view.Window in project HoloEverywhere by Prototik.

the class DialogPreference method requestInputMethod.

private void requestInputMethod(Dialog dialog) {
    Window window = dialog.getWindow();
    window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
}
Also used : Window(android.view.Window)

Example 63 with Window

use of android.view.Window in project HoloEverywhere by Prototik.

the class ActionBarActivityDelegateICS method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    // Set framework uiOptions from the support metadata value
    if (UIOPTION_SPLIT_ACTION_BAR_WHEN_NARROW.equals(getUiOptionsFromMetadata())) {
        mActivity.getWindow().setUiOptions(ActivityInfo.UIOPTION_SPLIT_ACTION_BAR_WHEN_NARROW, ActivityInfo.UIOPTION_SPLIT_ACTION_BAR_WHEN_NARROW);
    }
    super.onCreate(savedInstanceState);
    if (mHasActionBar) {
        // If action bar is requested by inheriting from the appcompat theme,
        // the system will not know about that. So explicitly request for an action bar.
        mActivity.requestWindowFeature(WindowCompat.FEATURE_ACTION_BAR);
    }
    if (mOverlayActionBar) {
        mActivity.requestWindowFeature(WindowCompat.FEATURE_ACTION_BAR_OVERLAY);
    }
    /*
         * This goofy move needs some explanation.
         *
         * The verifier on older platform versions has some interesting side effects if
         * a class defines a method that takes a parameter of a type that doesn't exist.
         * In this case, that type is android.view.ActionMode. Therefore, ActionBarActivity
         * cannot override the onActionModeStarted/Finished methods without causing nastiness
         * when it is loaded on older platform versions.
         *
         * Since these methods are actually part of the window callback and not intrinsic to
         * Activity itself, we can install a little shim with the window instead that knows
         * about the ActionMode class. Note that this means that any new methods added to
         * Window.Callback in the future won't get proxied without updating the support lib,
         * but we shouldn't be adding new methods to public interfaces that way anyway...right? ;)
         */
    final Window w = mActivity.getWindow();
    w.setCallback(createWindowCallbackWrapper(w.getCallback()));
}
Also used : Window(android.view.Window)

Example 64 with Window

use of android.view.Window in project Anki-Android by Ramblurr.

the class DeckPicker method onAttachedToWindow.

@Override
public void onAttachedToWindow() {
    if (!mFragmented) {
        Window window = getWindow();
        window.setFormat(PixelFormat.RGBA_8888);
    }
}
Also used : Window(android.view.Window)

Example 65 with Window

use of android.view.Window in project android_frameworks_base by ParanoidAndroid.

the class Activity method dispatchKeyEvent.

/**
     * Called to process key events.  You can override this to intercept all 
     * key events before they are dispatched to the window.  Be sure to call 
     * this implementation for key events that should be handled normally.
     * 
     * @param event The key event.
     * 
     * @return boolean Return true if this event was consumed.
     */
public boolean dispatchKeyEvent(KeyEvent event) {
    onUserInteraction();
    Window win = getWindow();
    if (win.superDispatchKeyEvent(event)) {
        return true;
    }
    View decor = mDecor;
    if (decor == null)
        decor = win.getDecorView();
    return event.dispatch(this, decor != null ? decor.getKeyDispatcherState() : null, this);
}
Also used : Window(android.view.Window) View(android.view.View) AdapterView(android.widget.AdapterView)

Aggregations

Window (android.view.Window)322 View (android.view.View)72 WindowManager (android.view.WindowManager)58 TextView (android.widget.TextView)34 TargetApi (android.annotation.TargetApi)29 ImageView (android.widget.ImageView)25 ViewGroup (android.view.ViewGroup)22 Activity (android.app.Activity)17 Dialog (android.app.Dialog)17 ColorDrawable (android.graphics.drawable.ColorDrawable)16 AdapterView (android.widget.AdapterView)16 PhoneWindow (com.android.internal.policy.PhoneWindow)15 Intent (android.content.Intent)11 Context (android.content.Context)10 LayoutInflater (android.view.LayoutInflater)10 WindowDecorActionBar (com.android.internal.app.WindowDecorActionBar)10 RemoteException (android.os.RemoteException)9 DisplayMetrics (android.util.DisplayMetrics)9 LinearLayout (android.widget.LinearLayout)9 PopupWindow (android.widget.PopupWindow)8