saiwu-bigkoo / Android-AlertView

仿iOS的AlertViewController
1.39k stars 366 forks source link

Update AlertView.java #12

Closed NianyiYang closed 8 years ago

NianyiYang commented 8 years ago

支持Builder模式

new AlertView.Builder().setContext(context)
                .setStyle(AlertView.Style.ActionSheet)
                .setTitle("选择操作")
                .setMessage(null)
                .setCancelText("取消")
                .setDestructive(new String[]{"拍照", "从相册中选择"})
                .setOthers(null)
                .setOnItemClickListener(listener)
                .build()
                .show();

原来的构造方法未修改,仍然保留

xiaolongyuan commented 8 years ago

+1

xiaolongyuan commented 8 years ago
        public Builder setDestructive(String[] destructive) {
            this.destructive = destructive;
            return this;
        }

改为

        public Builder setDestructive(String... destructive) {
            this.destructive = destructive;
            return this;
        }

这样比较好构建些