List of usage examples for android.view Window getAttributes
public final WindowManager.LayoutParams getAttributes()
From source file:com.example.deii.Fragments.UpdateProfileFragment.java
private void showPicSelectDialog(final Context ctx) { dialog = new Dialog(ctx, R.style.DialogSlideAnim1); dialog.setContentView(R.layout.dialog_select_image); dialog.getWindow().setBackgroundDrawableResource(android.R.color.transparent); Window window = dialog.getWindow(); WindowManager.LayoutParams wlp = window.getAttributes(); wlp.gravity = Gravity.BOTTOM;/*from www.ja v a 2s . co m*/ wlp.flags &= ~WindowManager.LayoutParams.FLAG_DIM_BEHIND; window.setAttributes(wlp); TextView chooseFromGallery = (TextView) dialog.findViewById(R.id.text_fromGallery); chooseFromGallery.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { loadPermissions(Manifest.permission.READ_EXTERNAL_STORAGE, GALLERY_REQUEST); } else startGallery(); } }); TextView takeFromCamera = (TextView) dialog.findViewById(R.id.text_fromCamera); takeFromCamera.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) loadPermissions(Manifest.permission.CAMERA, CAMERA_REQUEST); else startCamera(); } }); TextView imgCancel = (TextView) dialog.findViewById(R.id.text_dialogClose); imgCancel.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); } }); dialog.show(); }
From source file:com.example.caique.educam.Activities.TimelineActivity.java
@TargetApi(19) private void setTranslucentStatus(boolean on) { Window win = getWindow(); WindowManager.LayoutParams winParams = win.getAttributes(); win.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION, WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION); /* win.setFlags(//from w w w.j a v a 2 s . c om WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); */ final int bits = WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS; if (on) { winParams.flags |= bits; } else { winParams.flags &= ~bits; } win.setAttributes(winParams); }
From source file:com.heneryh.aquanotes.ui.livestock.ContentFragment.java
/** Toggle whether the system UI (status bar / system bar) is visible. * This also toggles the action bar visibility. * @param show True to show the system UI, false to hide it. *///from www. j a v a 2s .co m void setSystemUiVisible(boolean show) { mSystemUiVisible = show; Window window = getActivity().getWindow(); WindowManager.LayoutParams winParams = window.getAttributes(); View view = getView(); // ActionBar actionBar = getActivity().getActionBar(); if (show) { // Show status bar (remove fullscreen flag) window.setFlags(0, WindowManager.LayoutParams.FLAG_FULLSCREEN); // Show system bar view.setSystemUiVisibility(View.STATUS_BAR_VISIBLE); // Show action bar // actionBar.show(); } else { // Add fullscreen flag (hide status bar) window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); // Hide system bar view.setSystemUiVisibility(View.STATUS_BAR_HIDDEN); // Hide action bar // actionBar.hide(); } window.setAttributes(winParams); }
From source file:com.timothy.android.api.fragment.PageFragmentNew.java
public void openDialog(String content) { CustomDialog cusDialog = new CustomDialog(activity, R.style.custom_dialog_style, content); Window wd = cusDialog.getWindow(); WindowManager.LayoutParams lp = wd.getAttributes(); lp.alpha = 1.0f;//w w w . j a v a 2s . c o m wd.setAttributes(lp); cusDialog.show(); }
From source file:com.z299studio.pb.Snackbar.java
@Override public void onStart() { super.onStart(); if (getDialog() != null) { Window window = getDialog().getWindow(); window.setWindowAnimations(R.style.SnackbarAnimation); Resources res = getResources(); int height = (int) (res.getDimension(R.dimen.snackbar_height_single) + 0.5f); boolean leftAlign = res.getBoolean(R.bool.snackbar_left_align); WindowManager.LayoutParams lp = window.getAttributes(); lp.gravity = Gravity.BOTTOM | Gravity.START; lp.x = 0;/*from ww w . j a va 2 s. c o m*/ lp.y = 0; lp.height = height; if (!leftAlign) { Point windowSize = new Point(); ((WindowManager) getActivity().getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay() .getSize(windowSize); lp.width = windowSize.x; } else { lp.height += (int) (res.getDimension(R.dimen.snackbar_horizontal_margin) + 0.5f); } window.setAttributes(lp); } }
From source file:com.example.deii.trustone.SignUpActivity.java
private void showPicSelectDialog(final Context ctx) { dialog = new Dialog(ctx, R.style.DialogSlideAnim1); dialog.setContentView(R.layout.dialog_select_image); dialog.getWindow().setBackgroundDrawableResource(android.R.color.transparent); Window window = dialog.getWindow(); WindowManager.LayoutParams wlp = window.getAttributes(); wlp.gravity = Gravity.BOTTOM;/* w ww. j a v a2s. c o m*/ wlp.flags &= ~WindowManager.LayoutParams.FLAG_DIM_BEHIND; window.setAttributes(wlp); TextView chooseFromGallery = (TextView) dialog.findViewById(R.id.text_fromGallery); chooseFromGallery.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { loadPermissions(Manifest.permission.READ_EXTERNAL_STORAGE, GALLERY_REQUEST); } else startGallery(); } }); TextView takeFromCamera = (TextView) dialog.findViewById(R.id.text_fromCamera); takeFromCamera.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) loadPermissions(Manifest.permission.CAMERA, CAMERA_REQUEST); else startCamera(); } }); TextView imgCancel = (TextView) dialog.findViewById(R.id.text_dialogClose); imgCancel.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); } }); dialog.show(); }
From source file:cn.robertzhang.libraries.base.BaseFragmentActivity.java
/** * set status bar translucency/* w w w .j a v a2 s . com*/ * * @param on */ protected void setTranslucentStatus(boolean on) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { Window win = getWindow(); WindowManager.LayoutParams winParams = win.getAttributes(); final int bits = WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS; if (on) { winParams.flags |= bits; } else { winParams.flags &= ~bits; } win.setAttributes(winParams); } }
From source file:com.ovrhere.android.careerstack.ui.fragments.dialogs.SearchBarDialogFragment.java
/** Initializes the dialogs animations and dim. */ private void initAnimationAndDim() { Window win = getDialog().getWindow(); win.setGravity(Gravity.TOP);/*from w ww . j a v a 2 s . co m*/ win.setWindowAnimations(R.style.SearchBarAnimation); WindowManager.LayoutParams lp = win.getAttributes(); lp.dimAmount = 0.3f; //TODO abstract? is it necessary? win.setAttributes(lp); win.addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND); }
From source file:de.vanita5.twittnuker.activity.support.QuickSearchBarActivity.java
private void updateWindowAttributes() { final Window window = getWindow(); final WindowManager.LayoutParams attributes = window.getAttributes(); attributes.gravity = Gravity.TOP | Gravity.CENTER_HORIZONTAL; window.setAttributes(attributes);/*from w ww . j av a 2s . com*/ }
From source file:com.cloverstudio.spika.CreateGroupActivity.java
@Override protected Dialog onCreateDialog(int id) { switch (id) { case GET_IMAGE_DIALOG: mGetImageDialog = new Dialog(CreateGroupActivity.this, R.style.TransparentDialogTheme); mGetImageDialog.getWindow().setGravity(Gravity.BOTTOM); mGetImageDialog.setContentView(R.layout.dialog_get_image); // Grab the window of the dialog, and change the width WindowManager.LayoutParams lp = new WindowManager.LayoutParams(); Window window = mGetImageDialog.getWindow(); lp.copyFrom(window.getAttributes()); // This makes the dialog take up the full width lp.width = WindowManager.LayoutParams.MATCH_PARENT; lp.height = WindowManager.LayoutParams.WRAP_CONTENT; window.setAttributes(lp);//from ww w . j a v a 2 s .c om final Button btnGallery = (Button) mGetImageDialog.findViewById(R.id.btnGallery); btnGallery.setTypeface(SpikaApp.getTfMyriadProBold(), Typeface.BOLD); btnGallery.setOnClickListener(new OnClickListener() { public void onClick(View v) { Intent galleryIntent = new Intent(CreateGroupActivity.this, CameraCropActivity.class); galleryIntent.putExtra("type", "gallery"); galleryIntent.putExtra("createGroup", true); CreateGroupActivity.this.startActivity(galleryIntent); mGetImageDialog.dismiss(); } }); final Button btnCamera = (Button) mGetImageDialog.findViewById(R.id.btnCamera); btnCamera.setTypeface(SpikaApp.getTfMyriadProBold(), Typeface.BOLD); btnCamera.setOnClickListener(new OnClickListener() { public void onClick(View v) { Intent cameraIntent = new Intent(CreateGroupActivity.this, CameraCropActivity.class); cameraIntent.putExtra("type", "camera"); cameraIntent.putExtra("createGroup", true); CreateGroupActivity.this.startActivity(cameraIntent); mGetImageDialog.dismiss(); } }); final Button btnRemovePhoto = (Button) mGetImageDialog.findViewById(R.id.btnRemovePhoto); btnRemovePhoto.setTypeface(SpikaApp.getTfMyriadProBold(), Typeface.BOLD); btnRemovePhoto.setOnClickListener(new OnClickListener() { public void onClick(View v) { mGroupAvatarId = ""; gGroupImage = null; Utils.displayImage(mGroupAvatarId, mIvGroupImage, ImageLoader.LARGE, R.drawable.group_stub_large, false); mGetImageDialog.dismiss(); } }); return mGetImageDialog; default: return null; } }