@@ -0,0 +1,3435 @@
+package cn.diaovision.omnicontrol.widget;%0A%0Aimport android.app.Dialog;%0Aimport android.content.Context;%0Aimport android.os.Bundle;%0Aimport android.support.annotation.NonNull;%0Aimport android.support.annotation.StyleRes;%0Aimport android.view.Display;%0Aimport android.view.LayoutInflater;%0Aimport android.view.View;%0Aimport android.view.Window;%0Aimport android.view.WindowManager;%0Aimport android.widget.Button;%0Aimport android.widget.EditText;%0Aimport android.widget.ImageView;%0A%0Aimport butterknife.BindView;%0Aimport butterknife.ButterKnife;%0Aimport cn.diaovision.omnicontrol.MainControlActivity;%0Aimport cn.diaovision.omnicontrol.R;%0Aimport cn.diaovision.omnicontrol.core.model.device.endpoint.HiCamera;%0A%0A/**%0A * Created by TaoYimin on 2017/6/7.%0A */%0A%0Apublic class PresetDialog extends Dialog %7B%0A    @BindView(R.id.button_go_back)%0A    ImageView buttonGoBack;%0A    @BindView(R.id.alias_edit)%0A    EditText aliasEdit;%0A    @BindView(R.id.dialog_button_confirm)%0A    Button buttonConfirm;%0A    @BindView(R.id.dialog_button_delete)%0A    Button buttonDelete;%0A%0A    Context context;%0A    HiCamera.Preset preset;%0A    OnButtonClickListener onButtonClickListener;%0A%0A    public PresetDialog(@NonNull Context context, HiCamera.Preset preset) %7B%0A        this(context, R.style.dialog, preset);%0A    %7D%0A%0A    public PresetDialog(@NonNull Context context, @StyleRes int themeResId, HiCamera.Preset preset) %7B%0A        super(context, themeResId);%0A        this.context = context;%0A        this.preset = preset;%0A    %7D%0A%0A    @Override%0A    protected void onCreate(Bundle savedInstanceState) %7B%0A        super.onCreate(savedInstanceState);%0A        LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);%0A        View layout = inflater.inflate(R.layout.dialog_preset, null);%0A        this.setContentView(layout);%0A        ButterKnife.bind(this);%0A        //%E8%AE%BE%E7%BD%AE%E7%AB%AF%E5%8F%A3%E5%90%8D%E7%A7%B0%E7%BC%96%E8%BE%91%E6%A1%86%E9%BB%98%E8%AE%A4%E6%96%87%E5%AD%97%0A        aliasEdit.setText(preset.getName());%0A        buttonGoBack.setOnClickListener(new View.OnClickListener() %7B%0A            @Override%0A            public void onClick(View v) %7B%0A                dismiss();%0A            %7D%0A        %7D);%0A        buttonConfirm.setOnClickListener(new View.OnClickListener() %7B%0A            @Override%0A            public void onClick(View v) %7B%0A                preset.setName(aliasEdit.getText().toString());%0A                if(onButtonClickListener!=null)%7B%0A                    onButtonClickListener.onConfirmClick();%0A                %7D%0A            %7D%0A        %7D);%0A        buttonDelete.setOnClickListener(new View.OnClickListener() %7B%0A            @Override%0A            public void onClick(View v) %7B%0A                if(onButtonClickListener!=null)%7B%0A                    onButtonClickListener.onDeleteClick();%0A                %7D%0A            %7D%0A        %7D);%0A    %7D%0A%0A    @Override%0A    protected void onStart() %7B%0A        super.onStart();%0A        Window window = this.getWindow();%0A        WindowManager.LayoutParams params = window.getAttributes();%0A        Display display = ((MainControlActivity) context).getWindowManager().getDefaultDisplay();%0A        params.width = (int) (display.getWidth() * 0.35);%0A        params.height = (int) (display.getHeight() * 0.45);%0A        window.setAttributes(params);%0A    %7D%0A%0A    public interface OnButtonClickListener%7B%0A        void onConfirmClick();%0A        void onDeleteClick();%0A    %7D%0A%0A    public void setOnButtonClickListener(OnButtonClickListener onButtonClickListener) %7B%0A        this.onButtonClickListener = onButtonClickListener;%0A    %7D%0A%7D%0A

add preset dialog widget