Java Code Examples for android.view.Window#setWindowAnimations()
The following examples show how to use
android.view.Window#setWindowAnimations() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DialogSearching.java From BigApp_WordPress_Android with Apache License 2.0 | 6 votes |
private void init(Context context) { View view = LayoutInflater.from(context).inflate( R.layout.z_dialog_searching, null); mEt_content = (TextView) view.findViewById(R.id.tv_content); dialog = new Dialog(context, R.style.DialogStyle); dialog.setCancelable(false); dialog.setCanceledOnTouchOutside(false); dialog.setContentView(view); Window window = dialog.getWindow(); WindowManager.LayoutParams lp = window.getAttributes(); lp.width = ScreenTools.getScreenParams(context).width / 3; lp.height = lp.width; window.setBackgroundDrawableResource(R.drawable.z_shape_searching); window.setWindowAnimations(R.style.AnimEnterExit); }
Example 2
Source File: ImageFolderDialog.java From Simpler with Apache License 2.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.dialog_image_folder); Window window = getWindow(); // 在5.0以上手机必须加上这句代码 window.setBackgroundDrawableResource(android.R.color.transparent); window.setGravity(Gravity.BOTTOM); //此处可以设置dialog显示的位置 window.setWindowAnimations(R.style.BottomDialogStyle); //添加动画 tvCancel = (TextView) findViewById(R.id.tvCancel); rvFolderList = (RecyclerView) findViewById(R.id.rvFolderList); rvFolderList.setLayoutManager(new LinearLayoutManager(mContext)); rvFolderList.setAdapter(mAdapter); tvCancel.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { dismiss(); } }); }
Example 3
Source File: CustomOperateDialog.java From HappyBubble with Apache License 2.0 | 6 votes |
public CustomOperateDialog(Context context) { super(context); setPosition(Position.BOTTOM); setTransParentBackground(); BubbleLayout bubbleLayout = new BubbleLayout(context); bubbleLayout.setBubbleColor(Color.YELLOW); setBubbleLayout(bubbleLayout); View rootView = LayoutInflater.from(context).inflate(R.layout.dialog_view4, null); mViewHolder = new ViewHolder(rootView); addContentView(rootView); mViewHolder.btn13.setOnClickListener(this); mViewHolder.btn14.setOnClickListener(this); mViewHolder.btn15.setOnClickListener(this); Window window = getWindow(); window.setWindowAnimations(R.style.dialogWindowAnim); }
Example 4
Source File: AbstractAlertDialog.java From Common with Apache License 2.0 | 6 votes |
/** * Creates a dialog window that uses a custom dialog style. * * @param context Context * @param themeResId The dialog's layout resource * @param isSetWin Set the gravity of the window * @param gravity The desired gravity constant * @param width The dialog's width * @param heith The dialog's height */ protected AbstractAlertDialog(@NonNull Context context, @StyleRes int themeResId, boolean isSetWin, int gravity, int width, int heith) { super(context, themeResId); this.mContext = context; this.mRootView = LayoutInflater.from(context).inflate(getLayoutRes(), null); setContentView(this.mRootView); setCanceledOnTouchOutside(true); setCancelable(true); if (isSetWin) { Window dialogWindow = getWindow(); if (dialogWindow != null) { dialogWindow.setWindowAnimations(-1); dialogWindow.setBackgroundDrawableResource(android.R.color.transparent); dialogWindow.getDecorView().setPadding(0, 0, 0, 0); dialogWindow.setGravity(gravity); // Get the current layout param of the dialog WindowManager.LayoutParams p = dialogWindow.getAttributes(); // Set dialog's width p.width = width; // Set dialog's height p.height = heith; dialogWindow.setAttributes(p); } } init(this.mRootView); }
Example 5
Source File: LocationDialogFragment.java From BetterWay with Apache License 2.0 | 5 votes |
@NonNull @Override public Dialog onCreateDialog(Bundle savedInstanceState) { View view = LayoutInflater.from(getContext()) .inflate(R.layout.location_dialog_fragment, mViewGroup, false); initView(view); AlertDialog.Builder builder = new AlertDialog.Builder(getContext()) .setIcon(R.drawable.ic_action_item_dialog) .setView(view) .setTitle("请输入信息") .setPositiveButton("确定", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { if (TextUtils.isEmpty(mEditLocation.getText())) { ToastUtil.show(getContext(), "未选择地点"); } else { getLocationPlanData(); postSureCode(MapMarker.ADD); } } }) .setNegativeButton("取消", null); AlertDialog alertDialog = builder.create(); alertDialog.setOnCancelListener(null); if (alertDialog.getWindow() != null) { Window window = alertDialog.getWindow(); window.setWindowAnimations(R.style.dialogAnim); } return alertDialog; }
Example 6
Source File: RestartDialogFragment.java From openshop.io-android with MIT License | 5 votes |
@NonNull @Override public Dialog onCreateDialog(Bundle savedInstanceState) { Dialog dialog = super.onCreateDialog(savedInstanceState); Window window = dialog.getWindow(); if (window != null) { window.setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT)); window.setWindowAnimations(R.style.dialogFragmentAnimation); } return dialog; }
Example 7
Source File: OptionsDialog.java From Simpler with Apache License 2.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.dialog_option_list); ButterKnife.bind(this); Window window = getWindow(); // 在5.0以上手机必须加上这句代码 window.setBackgroundDrawableResource(android.R.color.transparent); window.setGravity(Gravity.BOTTOM); //此处可以设置dialog显示的位置 window.setWindowAnimations(R.style.BottomDialogStyle); //添加动画 mRvOptions.setLayoutManager(new LinearLayoutManager(mContext)); }
Example 8
Source File: DialogViewBuilder.java From DialogUtil with Apache License 2.0 | 5 votes |
protected ConfigBean buildBottomItemDialog(ConfigBean bean){ IosActionSheetHolder holder = new IosActionSheetHolder(bean.context); bean.viewHolder = holder; bean.dialog.setContentView(holder.rootView); holder.assingDatasAndEvents(bean.context,bean); bean.viewHeight = Tool.mesureHeight(holder.rootView,holder.lv); Window window = bean.dialog.getWindow(); window.setGravity(Gravity.BOTTOM); window.setWindowAnimations(R.style.mystyle); return bean; }
Example 9
Source File: ShippingDialogFragment.java From openshop.io-android with MIT License | 5 votes |
@Override public void onStart() { super.onStart(); Dialog d = getDialog(); if (d != null) { int width = ViewGroup.LayoutParams.MATCH_PARENT; int height = ViewGroup.LayoutParams.MATCH_PARENT; Window window = d.getWindow(); if (window != null) { window.setLayout(width, height); window.setWindowAnimations(R.style.alertDialogAnimation); } } }
Example 10
Source File: PictureLoadingDialog.java From PictureSelector with Apache License 2.0 | 5 votes |
public PictureLoadingDialog(Context context) { super(context, R.style.Picture_Theme_AlertDialog); setCancelable(true); setCanceledOnTouchOutside(false); Window window = getWindow(); window.setWindowAnimations(R.style.PictureThemeDialogWindowStyle); }
Example 11
Source File: WindowAdjuster.java From DialogUtil with Apache License 2.0 | 5 votes |
private static void setAnimation(Window window, ConfigBean bean) { if(bean.showAsActivity){ return; } int gravity = bean.gravity; if(gravity == Gravity.BOTTOM || gravity == (Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL)){ window.setWindowAnimations(R.style.ani_bottom); }else if(gravity == Gravity.CENTER){ //window.setWindowAnimations(R.style.dialog_center); } }
Example 12
Source File: AbstractAlertDialog.java From Common with Apache License 2.0 | 5 votes |
protected AbstractAlertDialog(Context context, int themeResId, ViewGroup.LayoutParams params) { super(context, themeResId); this.mContext = context; this.mRootView = LayoutInflater.from(context).inflate(getLayoutRes(), null); setContentView(this.mRootView, params); setCanceledOnTouchOutside(true); setCancelable(true); Window dialogWindow = getWindow(); if (dialogWindow != null) { dialogWindow.setWindowAnimations(-1); dialogWindow.setBackgroundDrawableResource(android.R.color.transparent); dialogWindow.getDecorView().setPadding(0, 0, 0, 0); } init(this.mRootView); }
Example 13
Source File: ProductImagesDialogFragment.java From openshop.io-android with MIT License | 5 votes |
@Override public void onStart() { super.onStart(); Dialog d = getDialog(); if (d != null) { int width = ViewGroup.LayoutParams.MATCH_PARENT; int height = ViewGroup.LayoutParams.MATCH_PARENT; Window window = d.getWindow(); window.setLayout(width, height); window.setWindowAnimations(R.style.dialogFragmentAnimation); } }
Example 14
Source File: PaymentPwd.java From Android with MIT License | 5 votes |
/** * show pay the password box */ public Dialog showPaymentPwd(Activity activity, final OnTrueListener onTrueListener) { this.activity = activity; paySetBean = ParamManager.getInstance().getPaySet(); this.onTrueListener = onTrueListener; dialog = new Dialog(activity, R.style.Dialog); LayoutInflater inflater = LayoutInflater.from(activity); View view = inflater.inflate(R.layout.dialog_pay_password, null); dialog.setContentView(view); viewPager = (ControlScrollViewPager) view.findViewById(R.id.view_pager); closeImg = (ImageView) view.findViewById(R.id.close_img); closeImg.setOnClickListener(this); initViewPage(); Window mWindow = dialog.getWindow(); WindowManager.LayoutParams lp = mWindow.getAttributes(); lp.width = SystemDataUtil.getScreenWidth(); mWindow.setGravity(Gravity.BOTTOM); mWindow.setWindowAnimations(R.style.DialogAnim); mWindow.setAttributes(lp); dialog.show(); titleTv = (TextView)view.findViewById(R.id.title_tv); if(paySetBean != null && paySetBean.getNoSecretPay()){ statusChange(5); onTrueListener.onTrue(); } if (paySetBean == null || TextUtils.isEmpty(paySetBean.getPayPin())) { titleTv.setText(R.string.Set_Set_Payment_Password); statusChange(1); } return dialog; }
Example 15
Source File: WebViewDialog.java From cloudflare-scrape-Android with MIT License | 5 votes |
@Override protected void setWindowAttributes(Window window) { window.setWindowAnimations(R.style.bottomToTopAnim); WindowManager.LayoutParams params = window.getAttributes(); params.width = WindowManager.LayoutParams.MATCH_PARENT; params.height = WindowManager.LayoutParams.MATCH_PARENT; params.gravity = Gravity.CENTER; window.setAttributes(params); }
Example 16
Source File: MainActivity.java From DialogUtils with Apache License 2.0 | 5 votes |
private void showDialog() { // AlertDialog dialog = new AlertDialog(this); AppCompatDialog dialog = new AppCompatDialog(this); dialog.supportRequestWindowFeature(Window.FEATURE_NO_TITLE);//key code to remove title Window window = dialog.getWindow(); window.setGravity(Gravity.BOTTOM); window.setWindowAnimations(R.style.mystyle); window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));//round corner // window.setBackgroundDrawableResource(R.drawable.bg_ios_roundcorner); // window.requestFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.dialog_ios_alert_bottom); // AlertDialog.Builder builder = new AlertDialog.Builder(this); // 可以在此设置显示动画 WindowManager.LayoutParams wl = window.getAttributes(); /* wl.x = 0; wl.y = getWindowManager().getDefaultDisplay().getHeight();*/ // 以下这两句是为了保证按钮可以水平满屏 int width = getWindowManager().getDefaultDisplay().getWidth(); // wl.width = ViewGroup.LayoutParams.MATCH_PARENT; wl.width = (int) (width * 0.85); // todo keycode gap wl.height = ViewGroup.LayoutParams.WRAP_CONTENT; //wl.horizontalMargin= 0.2f; // 设置显示位置 // wl.gravity = Gravity.CENTER_HORIZONTAL; dialog.onWindowAttributesChanged(wl); dialog.show(); }
Example 17
Source File: MyDialogBuilder.java From DialogUtil with Apache License 2.0 | 5 votes |
protected ConfigBean buildBottomItemDialog(ConfigBean bean){ IosActionSheetHolder holder = new IosActionSheetHolder(bean.context); bean.viewHolder = holder; bean.dialog.setContentView(holder.rootView); holder.assingDatasAndEvents(bean.context,bean); bean.viewHeight = Tool.mesureHeight(holder.rootView,holder.lv); Window window = bean.dialog.getWindow(); window.setGravity(Gravity.BOTTOM); window.setWindowAnimations(R.style.mystyle); return bean; }
Example 18
Source File: AbstractDialog.java From DMusic with Apache License 2.0 | 5 votes |
protected AbstractDialog(Context context, int themeResId, ViewGroup.LayoutParams params) { super(context, themeResId); this.mContext = context; this.mRootView = LayoutInflater.from(context).inflate(getLayoutRes(), null); setContentView(this.mRootView, params); setCanceledOnTouchOutside(true); setCancelable(true); Window dialogWindow = getWindow(); if (dialogWindow != null) { dialogWindow.setWindowAnimations(-1); dialogWindow.setBackgroundDrawableResource(android.R.color.transparent); dialogWindow.getDecorView().setPadding(0, 0, 0, 0); } init(this.mRootView); }
Example 19
Source File: BaseDialog.java From AutoTest with MIT License | 4 votes |
/** dialog anim by styles(动画弹出对话框,style动画资源) */ public void show(int animStyle) { Window window = getWindow(); window.setWindowAnimations(animStyle); show(); }
Example 20
Source File: BaseDialog.java From SprintNBA with Apache License 2.0 | 4 votes |
/** dialog anim by styles(动画弹出对话框,style动画资源) */ public void show(int animStyle) { Window window = getWindow(); window.setWindowAnimations(animStyle); show(); }