Example usage for android.view Window getDecorView

List of usage examples for android.view Window getDecorView

Introduction

In this page you can find the example usage for android.view Window getDecorView.

Prototype

public abstract View getDecorView();

Source Link

Document

Retrieve the top-level window decor view (containing the standard window frame/decorations and the client's content inside of that), which can be added as a window to the window manager.

Usage

From source file:jp.co.noxi.app.NXDatePickerDialog.java

/**
 * Gets the {@link DatePicker} contained in this dialog.
 * /*from w ww . j  ava 2 s. c o m*/
 * @return The calendar view.
 */
public DatePicker getDatePicker() {
    if (mDialog == null) {
        return null;
    }
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        return getDatePickerHC();
    }

    final Window window = mDialog.getWindow();
    if (window == null) {
        return null;
    }
    return findDatePicker(window.getDecorView());
}

From source file:com.achep.acdisplay.acdisplay.AcDisplayActivity.java

@SuppressLint("NewApi")
private void populateFlags(boolean windowHasFocus) {
    Window window = getWindow();
    View decorView = window.getDecorView();

    int windowFlags = WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON;

    if (windowHasFocus) {
        int visibilityUi = View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
                | View.SYSTEM_UI_FLAG_LOW_PROFILE;

        if (mConfig.isFullScreen()) {
            // Hide status bar if fullscreen mode is enabled.
            visibilityUi = visibilityUi | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                    | View.SYSTEM_UI_FLAG_FULLSCREEN;
        }/* w  ww  .  j a  v  a2  s.  c  o  m*/

        if (Device.hasKitKatApi()) {
            // Hide navigation bar and flag sticky.
            visibilityUi = visibilityUi | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
                    | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
        }

        decorView.setSystemUiVisibility(visibilityUi);
        window.addFlags(windowFlags);

        mTimeout.resume();
        mTimeout.setTimeoutDelayed(mConfig.getTimeoutNormal(), true);
    } else {
        int visibilityUi = decorView.getSystemUiVisibility();
        if (Device.hasKitKatApi()) {
            // Clear immersive sticky flag.
            // Hopefully it will fix annoying Android feature: IMMERSIVE_PANIC
            visibilityUi ^= View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
        }

        decorView.setSystemUiVisibility(visibilityUi);
        window.clearFlags(windowFlags);

        mTimeout.setTimeoutDelayed(mConfig.getTimeoutNormal(), true);
        mTimeout.pause();
    }
}

From source file:org.liberty.android.fantastischmemo.ui.QuizLauncherDialogFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    getDialog().setCanceledOnTouchOutside(true);
    getDialog().setTitle(R.string.quiz_text);
    View v = inflater.inflate(R.layout.quiz_launcher_dialog, container, false);

    startQuizButton = (Button) v.findViewById(R.id.start_quiz_button);

    startQuizButton.setOnClickListener(startQuizButtonOnClickListener);

    quizByGroupRadio = (RadioButton) v.findViewById(R.id.quiz_by_group_radio);

    quizByCategoryRadio = (RadioButton) v.findViewById(R.id.quiz_by_category_radio);

    quizGroupSizeTitle = (TextView) v.findViewById(R.id.quiz_group_size_title);

    quizGroupSizeEdit = (EditText) v.findViewById(R.id.quiz_group_size);
    // Make sure the text value is sanity and update other information
    // about the group size and etc accordingly.
    quizGroupSizeEdit.addTextChangedListener(editTextWatcher);
    quizGroupSizeEdit.setOnFocusChangeListener(sanitizeInputListener);

    quizGroupNumberTitle = (TextView) v.findViewById(R.id.quiz_group_number_title);

    quizGroupNumberEdit = (EditText) v.findViewById(R.id.quiz_group_number);
    quizGroupNumberEdit.addTextChangedListener(editTextWatcher);
    quizGroupNumberEdit.setOnFocusChangeListener(sanitizeInputListener);

    categoryButton = (Button) v.findViewById(R.id.category_button);
    categoryButton.setOnClickListener(categoryButtonListener);

    Rect displayRectangle = new Rect();
    Window window = mActivity.getWindow();
    window.getDecorView().getWindowVisibleDisplayFrame(displayRectangle);

    v.setMinimumWidth((int) (displayRectangle.width() * 0.9f));

    return v;/*  ww w  .ja  v  a 2s .  c  o m*/
}

From source file:org.androidui.app.ActionBarImpl.java

public ActionBarImpl(Activity activity) {
    Window window = activity.getWindow();
    View decor = window.getDecorView();
    init(decor);
}

From source file:com.github.mobile.ui.user.HomeActivity.java

private void reloadOrgs() {
    getSupportLoaderManager().restartLoader(0, null, new LoaderCallbacks<List<User>>() {

        @Override/* www .j  a  va2 s  .c  om*/
        public Loader<List<User>> onCreateLoader(int id, Bundle bundle) {
            return HomeActivity.this.onCreateLoader(id, bundle);
        }

        @Override
        public void onLoadFinished(Loader<List<User>> loader, final List<User> users) {
            HomeActivity.this.onLoadFinished(loader, users);
            if (users.isEmpty())
                return;

            Window window = getWindow();
            if (window == null)
                return;
            View view = window.getDecorView();
            if (view == null)
                return;

            view.post(new Runnable() {

                @Override
                public void run() {
                    isDefaultUser = false;
                    setOrg(users.get(0));
                }
            });
        }

        @Override
        public void onLoaderReset(Loader<List<User>> loader) {
            HomeActivity.this.onLoaderReset(loader);
        }
    });
}

From source file:com.github.pockethub.android.ui.MainActivity.java

@Override
public void onLoadFinished(Loader<List<User>> listLoader, final List<User> orgs) {
    if (orgs.isEmpty()) {
        return;//from w  w w  .j a v  a2 s  . c o  m
    }

    org = orgs.get(0);
    this.orgs = orgs;

    setUpNavigationView();

    Window window = getWindow();
    if (window == null) {
        return;
    }
    View view = window.getDecorView();
    if (view == null) {
        return;
    }

    view.post(() -> {
        switchFragment(new HomePagerFragment(), org);
        if (!userLearnedDrawer) {
            drawerLayout.openDrawer(GravityCompat.START);
        }
    });

}

From source file:edu.cmu.android.restaurant.MapFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    Intent intent = new Intent(getActivity(), MyMapActivity.class);

    final Window w = getLocalActivityManager().startActivity("tag", intent);
    final View wd = w != null ? w.getDecorView() : null;

    if (wd != null) {
        ViewParent parent = wd.getParent();
        if (parent != null) {
            ViewGroup v = (ViewGroup) parent;
            v.removeView(wd);//  ww w.ja va 2  s.  c o m
        }

        wd.setVisibility(View.VISIBLE);
        wd.setFocusableInTouchMode(true);
        if (wd instanceof ViewGroup) {
            ((ViewGroup) wd).setDescendantFocusability(ViewGroup.FOCUS_AFTER_DESCENDANTS);
        }
    }

    ((MyMapActivity) mLocalActivityManager.getActivity("tag")).registerListener(mListener);

    setHasOptionsMenu(true); // add menu in fragment
    sensorManager = (SensorManager) getActivity().getSystemService(Activity.SENSOR_SERVICE);
    vibrator = (Vibrator) getActivity().getSystemService(Service.VIBRATOR_SERVICE);
    dealList = mListener.onDealsRequested();

    return wd;

}

From source file:potboiler.client.PotsActivity.java

License:asdf

public View getActionBarView() {
    Window window = this.getWindow();
    final View decorView = window.getDecorView();
    final String packageName = getPackageName();
    final int resId = this.getResources().getIdentifier("action_bar_container", "id", packageName);
    final View actionBarView = decorView.findViewById(resId);
    return actionBarView;
}

From source file:uk.org.downiesoft.slideshow.SlidesFragment.java

/**
 * {@inheritDoc}//from w ww . j av a  2s  .  c  om
 */
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    super.onCreateView(inflater, container, savedInstanceState);
    Point displaySize = new Point();
    getActivity().getWindowManager().getDefaultDisplay().getRealSize(displaySize);
    mDisplaySize.set(displaySize.x, displaySize.y);
    mUiHider = new UiHider(getActivity());
    mUiHider.showUi(true);
    /* Reference to main layout. */
    View view = inflater.inflate(R.layout.imageview_fragment, container, false);
    this.setHasOptionsMenu(true);
    mImageViews[mCurrentView] = (ScaleableImageView) view.findViewById(R.id.fullscreen_content);
    mImageViews[mPrevView] = (ScaleableImageView) view.findViewById(R.id.fullscreen_prevbmp);
    mImageViews[mNextView] = (ScaleableImageView) view.findViewById(R.id.fullscreen_nextbmp);
    mFilenameText = (TextView) view.findViewById(R.id.fullscreen_text);
    mProgress = (ProgressBar) view.findViewById(R.id.imageviewProgressBar);
    mEmptyText = (TextView) view.findViewById(R.id.slideEmptyText);
    setViewPositions();
    Window window = getActivity().getWindow();
    window.getDecorView().setOnSystemUiVisibilityChangeListener(mUiHider);
    return view;
}

From source file:com.bottomsheetbehavior.MergedAppBarLayoutBehavior.java

public void setStatusBarBackgroundVisible(boolean visible) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && mStatusBarColor != 0) {
        if (visible) {
            Window window = ((ThemedReactContext) mContext).getCurrentActivity().getWindow();
            window.getDecorView().setSystemUiVisibility(mBarStyle);
            window.setStatusBarColor(mStatusBarColor);
        } else {//  w w w .j ava 2  s .c om
            Window window = ((ThemedReactContext) mContext).getCurrentActivity().getWindow();
            window.getDecorView().setSystemUiVisibility(mBarStyleTransparent);
            window.setStatusBarColor(ContextCompat.getColor(mContext, android.R.color.transparent));
        }
    }
}