Example usage for android.view Window requestFeature

List of usage examples for android.view Window requestFeature

Introduction

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

Prototype

public boolean requestFeature(int featureId) 

Source Link

Document

Enable extended screen features.

Usage

From source file:Main.java

public static void requestFullscreen(final Activity pActivity) {
    final Window window = pActivity.getWindow();
    window.addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
    window.clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
    window.requestFeature(Window.FEATURE_NO_TITLE);
}

From source file:Main.java

public static void requestFullscreen(final Activity mActivity) {
    final Window window = mActivity.getWindow();
    window.addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
    window.clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
    window.requestFeature(Window.FEATURE_NO_TITLE);
}

From source file:com.tdispatch.passenger.core.TDDialogFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    mFragmentView = getActivity().getLayoutInflater().inflate(getLayoutId(), null);

    mFragmentView.setMinimumWidth(getResources().getDimensionPixelSize(R.dimen.dialog_min_width));

    Window w = getDialog().getWindow();
    w.requestFeature(Window.FEATURE_NO_TITLE);
    w.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);

    getDialog().setCanceledOnTouchOutside(false);

    setCustomFonts((ViewGroup) mFragmentView);

    onPostCreateView();//from  w w  w . j  ava 2  s .co m

    return mFragmentView;
}

From source file:com.github.rutvijkumar.twittfuse.fragments.ComposeDialog.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    Dialog dialog = getDialog();//from   w  w  w  .  j  av a  2  s  . c om
    Window window = dialog.getWindow();
    View view = inflater.inflate(R.layout.compose_dialog, container);
    window.requestFeature(Window.FEATURE_NO_TITLE);
    window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
    window.setLayout(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
    setUpUI(view);
    getUserAccountDetails();
    return view;
}

From source file:com.robopupu.api.mvp.ViewCompatDialogFragment.java

@NonNull
@Override//  w  w  w.  java 2s  .  com
public Dialog onCreateDialog(final Bundle inState) {
    final Dialog dialog = createDialog(inState);
    final Window window = dialog.getWindow();

    window.requestFeature(Window.FEATURE_NO_TITLE);
    return dialog;
}

From source file:org.catrobat.catroid.ui.dialogs.AddBrickDialog.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.dialog_brick_add, null);

    ImageButton closeButton = (ImageButton) rootView.findViewById(R.id.dialog_brick_title_button_close);
    TextView textView = (TextView) rootView.findViewById(R.id.dialog_brick_title_text_view_title);
    listView = (ListView) rootView.findViewById(R.id.dialog_brick_add_list_view);

    closeButton.setOnClickListener(new View.OnClickListener() {
        @Override/*from  w  w  w  .  j  ava2  s  .  c  o  m*/
        public void onClick(View v) {
            dismiss();
        }
    });

    textView.setText(selectedCategory);

    Window window = getDialog().getWindow();
    window.requestFeature(Window.FEATURE_NO_TITLE);
    window.setGravity(Gravity.CENTER | Gravity.FILL_HORIZONTAL | Gravity.FILL_VERTICAL);
    window.setLayout(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
    window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);

    return rootView;
}

From source file:com.nextgis.ngm_clink_monitoring.dialogs.YesNoDialog.java

@NonNull
@Override//w w w  .j  a  v  a 2  s  .  c om
public Dialog onCreateDialog(Bundle savedInstanceState) {
    // Idea from here
    // http://thanhcs.blogspot.ru/2014/10/android-custom-dialog-fragment.html
    Dialog dialog = new Dialog(getActivity());

    Window window = dialog.getWindow();
    window.requestFeature(Window.FEATURE_NO_TITLE);
    window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN);
    window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));

    dialog.setContentView(R.layout.dialog_yes_no);

    mIcon = (ImageView) dialog.findViewById(R.id.title_icon);
    mTitle = (TextView) dialog.findViewById(R.id.title_text);

    mDialogBodyScroll = (ScrollView) dialog.findViewById(R.id.dialog_body_scroll);
    mDialogBodyLayoutScrolled = (LinearLayout) dialog.findViewById(R.id.dialog_body_scrolled);
    mDialogBodyLayout = (LinearLayout) dialog.findViewById(R.id.dialog_body);

    mButtons = (TableLayout) dialog.findViewById(R.id.dialog_buttons_yn);
    mBtnPositive = (Button) dialog.findViewById(R.id.dialog_btn_positive_yn);
    mBtnNegative = (Button) dialog.findViewById(R.id.dialog_btn_negative_yn);

    if (null != mIconId) {
        mIcon.setVisibility(View.VISIBLE);
        mIcon.setImageResource(mIconId);
    }

    if (null != mTitleId) {
        mTitle.setText(mTitleId);
    }
    if (null != mTitleText) {
        mTitle.setText(mTitleText);
    }

    if (null != mMessageId) {
        setMessageView();
        mMessage.setText(mMessageId);
    }
    if (null != mMessageText) {
        setMessageView();
        mMessage.setText(mMessageText);
    }

    if (null != mView) {
        if (mAddScrollForView) {
            mDialogBodyScroll.setVisibility(View.VISIBLE);
            mDialogBodyLayoutScrolled.addView(mView);
        } else {
            mDialogBodyLayout.setVisibility(View.VISIBLE);
            mDialogBodyLayout.addView(mView);
        }
    }

    if (null != mPositiveTextId) {
        mButtons.setVisibility(View.VISIBLE);
        mBtnPositive.setVisibility(View.VISIBLE);
        mBtnPositive.setText(mPositiveTextId);
    }
    if (null != mPositiveText) {
        mButtons.setVisibility(View.VISIBLE);
        mBtnPositive.setVisibility(View.VISIBLE);
        mBtnPositive.setText(mPositiveText);
    }

    if (null != mNegativeTextId) {
        mButtons.setVisibility(View.VISIBLE);
        mBtnNegative.setVisibility(View.VISIBLE);
        mBtnNegative.setText(mNegativeTextId);
    }
    if (null != mNegativeText) {
        mButtons.setVisibility(View.VISIBLE);
        mBtnNegative.setVisibility(View.VISIBLE);
        mBtnNegative.setText(mNegativeText);
    }

    if (null != mOnPositiveClickedListener) {
        mButtons.setVisibility(View.VISIBLE);
        mBtnPositive.setVisibility(View.VISIBLE);
        mBtnPositive.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (null != mOnPositiveClickedListener) {
                    mOnPositiveClickedListener.onPositiveClicked();
                }
                dismiss();
            }
        });
    }

    if (null != mOnNegativeClickedListener) {
        mButtons.setVisibility(View.VISIBLE);
        mBtnNegative.setVisibility(View.VISIBLE);
        mBtnNegative.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (null != mOnNegativeClickedListener) {
                    mOnNegativeClickedListener.onNegativeClicked();
                }
                dismiss();
            }
        });
    }

    return dialog;
}

From source file:com.nextgis.libngui.dialog.StyledDialogFragment.java

@NonNull
@Override//from  www.j a v  a 2  s.  c o  m
public Dialog onCreateDialog(Bundle savedInstanceState) {
    // Idea from here
    // http://thanhcs.blogspot.ru/2014/10/android-custom-dialog-fragment.html

    Dialog dialog = new Dialog(mContext);

    Window window = dialog.getWindow();
    window.requestFeature(Window.FEATURE_NO_TITLE);
    window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN);
    window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));

    return dialog;
}

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

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Window win = getWindow();
    win.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS,
            WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
    win.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION,
            WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
    win.requestFeature(Window.FEATURE_ACTION_BAR_OVERLAY);
    mUiHider = new UiHider(this);
    getWindow().getDecorView().setOnSystemUiVisibilityChangeListener(mUiHider);
    mCacheManager = ThumbnailCacheManager.getInstance(this);
    SlideShowActivity.debug(1, TAG, "onCreate: %s",
            savedInstanceState == null ? "null" : savedInstanceState.toString());
    setContentView(R.layout.activity_slide_show);
    PreferenceManager.setDefaultValues(this, R.xml.view_preferences, false);
    PreferenceManager.setDefaultValues(this, R.xml.slideshow_preferences, false);
    PreferenceManager.setDefaultValues(this, R.xml.cache_preferences, false);
    PreferenceManager.setDefaultValues(this, R.xml.wallpaper_preferences, false);
    PreferenceManager.setDefaultValues(this, R.xml.other_preferences, false);
    mSlideshowSettings = PreferenceManager.getDefaultSharedPreferences(this);
    int thumbSize = Integer.parseInt(mSlideshowSettings.getString(getString(R.string.PREFS_THUMBSIZE), "1"));
    // Hack to convert old hard-coded thumbsize settings to platform dependent sizes
    if (thumbSize > 2) {
        thumbSize = thumbSize / 90;/* w w w .  j av  a 2 s  .  co m*/
        SharedPreferences.Editor editor = mSlideshowSettings.edit();
        editor.putString(getString(R.string.PREFS_THUMBSIZE), Integer.toString(thumbSize));
        editor.apply();
    }
    FragmentManager fm = getFragmentManager();
    int cacheLimit = Integer
            .parseInt(mSlideshowSettings.getString(getString(R.string.PREFS_CACHE_LIMIT), "10"));
    mPreviewButton = (ImageView) findViewById(R.id.slideShowImageButton);
    mPreviewView = (FrameLayout) findViewById(R.id.previewContainer);
    RelativeLayout divider = (RelativeLayout) findViewById(R.id.frameDivider);
    if (divider != null) {
        divider.setOnTouchListener(new OnTouchListener() {
            @Override
            public boolean onTouch(View view, MotionEvent event) {
                return mGestureDetector.onTouchEvent(event) || view.onTouchEvent(event);
            }
        });
    }
    mPreviewFragment = (PreviewFragment) fm.findFragmentByTag(PreviewFragment.TAG);
    if (mPreviewView != null && mPreviewFragment == null) {
        mPreviewFragment = new PreviewFragment();
        fm.beginTransaction().replace(R.id.previewContainer, mPreviewFragment, PreviewFragment.TAG).commit();
    }
    mGridViewFragment = (GridViewFragment) fm.findFragmentByTag(GridViewFragment.TAG);
    if (mGridViewFragment == null) {
        mGridViewFragment = new GridViewFragment();
        FragmentTransaction ft = fm.beginTransaction();
        ft.replace(R.id.fragmentContainer, mGridViewFragment, GridViewFragment.TAG);
        ft.commit();
    }
    mGestureDetector = new GestureDetector(this, new DividerGestureListener());
    // restart/stop service as required
    Intent intent = getIntent();
    if (intent != null && intent.getAction() != null && intent.getAction().equals(ACTION_STOP_WALLPAPER)
            && isServiceRunning()) {
        stopWallpaperService();
        finish();
    } else {
        if (!mSlideshowSettings.getBoolean(getString(R.string.PREFS_WALLPAPER_ENABLE), false)) {
            if (isServiceRunning()) {
                stopWallpaperService();
            }
        } else {
            if (!isServiceRunning()) {
                Intent startIntent = new Intent(SlideShowActivity.this, WallpaperService.class);
                startService(startIntent);
                invalidateOptionsMenu();
            }
        }
    }
    mCacheManager.tidyCache(cacheLimit);
    BitmapManager.setDisplayMetrics(getResources().getDisplayMetrics());
}