Search in sources :

Example 11 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 12 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 13 with Window

use of android.view.Window in project material-intro-screen by TangoAgency.

the class MaterialIntroActivity method onCreate.

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        Window window = getWindow();
        window.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
    }
    setContentView(R.layout.activity_material_intro);
    overScrollLayout = (OverScrollViewPager) findViewById(R.id.view_pager_slides);
    viewPager = overScrollLayout.getOverScrollView();
    pageIndicator = (InkPageIndicator) findViewById(R.id.indicator);
    backButton = (ImageButton) findViewById(R.id.button_back);
    nextButton = (ImageButton) findViewById(R.id.button_next);
    skipButton = (ImageButton) findViewById(R.id.button_skip);
    messageButton = (Button) findViewById(R.id.button_message);
    coordinatorLayout = (CoordinatorLayout) findViewById(R.id.coordinator_layout_slide);
    navigationView = (LinearLayout) findViewById(R.id.navigation_view);
    adapter = new SlidesAdapter(getSupportFragmentManager());
    viewPager.setAdapter(adapter);
    viewPager.setOffscreenPageLimit(2);
    pageIndicator.setViewPager(viewPager);
    nextButtonTranslationWrapper = new NextButtonTranslationWrapper(nextButton);
    initOnPageChangeListeners();
    permissionNotGrantedClickListener = new PermissionNotGrantedClickListener(this, nextButtonTranslationWrapper);
    finishScreenClickListener = new FinishScreenClickListener();
    setBackButtonVisible();
    viewPager.post(new Runnable() {

        @Override
        public void run() {
            if (adapter.getCount() == 0) {
                finish();
            } else {
                int currentItem = viewPager.getCurrentItem();
                messageButtonBehaviourOnPageSelected.pageSelected(currentItem);
                nextButtonBehaviour(currentItem, adapter.getItem(currentItem));
            }
        }
    });
}
Also used : Window(android.view.Window) NextButtonTranslationWrapper(agency.tango.materialintroscreen.animations.wrappers.NextButtonTranslationWrapper) PermissionNotGrantedClickListener(agency.tango.materialintroscreen.listeners.clickListeners.PermissionNotGrantedClickListener) SlidesAdapter(agency.tango.materialintroscreen.adapter.SlidesAdapter)

Example 14 with Window

use of android.view.Window in project android-extendedactionbar by Takhion.

the class ExtendedActionBarActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_test);
    final Resources res = getResources();
    final boolean isKitkat = Build.VERSION.SDK_INT >= 19;
    // replace window background to reduce overdraw
    final Window window = getWindow();
    final ViewGroup contentView = (ViewGroup) findViewById(android.R.id.content);
    final View content = contentView.getChildAt(0);
    final Drawable extendedWindowBackground = window.getDecorView().getBackground();
    final Drawable windowBackground = !isKitkat ? extendedWindowBackground : getWindowBackgroundLayer(extendedWindowBackground, R.id.window_background, "window_background");
    window.setBackgroundDrawable(null);
    setBackground(content, windowBackground);
    // add statusbar background
    if (isKitkat) {
        // check if translucent bars are enabled
        final int config_enableTranslucentDecor_id = res.getIdentifier("config_enableTranslucentDecor", "bool", "android");
        if (config_enableTranslucentDecor_id > 0 && res.getBoolean(config_enableTranslucentDecor_id)) {
            // get ActionBar container
            final View actionBarContainer = findViewById("action_bar_container", "android");
            if (actionBarContainer != null) {
                // add layout listener (can't get margin before layout)
                //noinspection ConstantConditions
                actionBarContainer.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {

                    @SuppressWarnings("ConstantConditions")
                    @Override
                    public void onGlobalLayout() {
                        // remove layout listener
                        final ViewTreeObserver vto = actionBarContainer.getViewTreeObserver();
                        if (Build.VERSION.SDK_INT < 16)
                            vto.removeGlobalOnLayoutListener(this);
                        else
                            vto.removeOnGlobalLayoutListener(this);
                        // create and add statusbar background view
                        final Drawable statusBarBackground = getWindowBackgroundLayer(extendedWindowBackground, R.id.statusbar_background, "statusbar_background");
                        final int statusBarHeight = ((ViewGroup.MarginLayoutParams) actionBarContainer.getLayoutParams()).topMargin;
                        final View statusBarView = new View(ExtendedActionBarActivity.this);
                        setBackground(statusBarView, statusBarBackground);
                        final FrameLayout.LayoutParams statusBarBackground_lp = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, statusBarHeight, Gravity.TOP | Gravity.FILL_HORIZONTAL);
                        contentView.addView(statusBarView, 0, statusBarBackground_lp);
                        // shift content under actionbar
                        final ViewGroup.MarginLayoutParams content_lp = (ViewGroup.MarginLayoutParams) content.getLayoutParams();
                        content_lp.topMargin = getActionBar().getHeight() + statusBarHeight;
                        content.setLayoutParams(content_lp);
                    }
                });
            }
        }
    }
}
Also used : Window(android.view.Window) ViewGroup(android.view.ViewGroup) LayerDrawable(android.graphics.drawable.LayerDrawable) Drawable(android.graphics.drawable.Drawable) View(android.view.View) FrameLayout(android.widget.FrameLayout) Resources(android.content.res.Resources) ViewTreeObserver(android.view.ViewTreeObserver)

Example 15 with Window

use of android.view.Window in project Notes by MiCode.

the class AlarmAlertActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    final Window win = getWindow();
    win.addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);
    if (!isScreenOn()) {
        win.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON | WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON | WindowManager.LayoutParams.FLAG_ALLOW_LOCK_WHILE_SCREEN_ON | WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR);
    }
    Intent intent = getIntent();
    try {
        mNoteId = Long.valueOf(intent.getData().getPathSegments().get(1));
        mSnippet = DataUtils.getSnippetById(this.getContentResolver(), mNoteId);
        mSnippet = mSnippet.length() > SNIPPET_PREW_MAX_LEN ? mSnippet.substring(0, SNIPPET_PREW_MAX_LEN) + getResources().getString(R.string.notelist_string_info) : mSnippet;
    } catch (IllegalArgumentException e) {
        e.printStackTrace();
        return;
    }
    mPlayer = new MediaPlayer();
    if (DataUtils.visibleInNoteDatabase(getContentResolver(), mNoteId, Notes.TYPE_NOTE)) {
        showActionDialog();
        playAlarmSound();
    } else {
        finish();
    }
}
Also used : Window(android.view.Window) Intent(android.content.Intent) MediaPlayer(android.media.MediaPlayer)

Aggregations

Window (android.view.Window)310 View (android.view.View)69 WindowManager (android.view.WindowManager)56 TextView (android.widget.TextView)34 TargetApi (android.annotation.TargetApi)26 ImageView (android.widget.ImageView)25 Activity (android.app.Activity)17 Dialog (android.app.Dialog)17 ViewGroup (android.view.ViewGroup)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