android.view.Window#setWindowAnimations ( )源码实例Demo

下面列出了android.view.Window#setWindowAnimations ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: HappyBubble   文件: CustomOperateDialog.java
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);

}
 
源代码2 项目: Simpler   文件: ImageFolderDialog.java
@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();
        }
    });

}
 
源代码3 项目: Common   文件: AbstractAlertDialog.java
/**
 * 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);
}
 
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);
}
 
源代码5 项目: DMusic   文件: AbstractDialog.java
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);
}
 
源代码6 项目: DialogUtil   文件: MyDialogBuilder.java
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;
}
 
源代码7 项目: DialogUtils   文件: MainActivity.java
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();
    }
 
源代码8 项目: cloudflare-scrape-Android   文件: WebViewDialog.java
@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);
}
 
源代码9 项目: Android   文件: PaymentPwd.java
/**
 * 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;
}
 
@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);
    }
}
 
源代码11 项目: BetterWay   文件: LocationDialogFragment.java
@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;
}
 
源代码12 项目: Common   文件: AbstractAlertDialog.java
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);
}
 
源代码13 项目: DialogUtil   文件: WindowAdjuster.java
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);
    }
}
 
源代码14 项目: PictureSelector   文件: PictureLoadingDialog.java
public PictureLoadingDialog(Context context) {
    super(context, R.style.Picture_Theme_AlertDialog);
    setCancelable(true);
    setCanceledOnTouchOutside(false);
    Window window = getWindow();
    window.setWindowAnimations(R.style.PictureThemeDialogWindowStyle);
}
 
@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);
        }
    }
}
 
源代码16 项目: DialogUtil   文件: DialogViewBuilder.java
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;
}
 
源代码17 项目: Simpler   文件: OptionsDialog.java
@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));
}
 
@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;
}
 
源代码19 项目: SprintNBA   文件: BaseDialog.java
/** dialog anim by styles(动画弹出对话框,style动画资源) */
public void show(int animStyle) {
    Window window = getWindow();
    window.setWindowAnimations(animStyle);
    show();
}
 
源代码20 项目: AutoTest   文件: BaseDialog.java
/** dialog anim by styles(动画弹出对话框,style动画资源) */
public void show(int animStyle) {
    Window window = getWindow();
    window.setWindowAnimations(animStyle);
    show();
}