Example usage for android.app AlertDialog.Builder getContext

List of usage examples for android.app AlertDialog.Builder getContext

Introduction

In this page you can find the example usage for android.app AlertDialog.Builder getContext.

Prototype

public final @NonNull Context getContext() 

Source Link

Document

Retrieve the Context this Dialog is running in.

Usage

From source file:com.ruesga.rview.fragments.SetAccountStatusDialogFragment.java

@Override
public void buildDialog(AlertDialog.Builder builder, Bundle savedInstanceState) {
    LayoutInflater inflater = LayoutInflater.from(builder.getContext());
    mBinding = DataBindingUtil.inflate(inflater, R.layout.set_account_status_dialog, null, true);
    mBinding.status.addTextChangedListener(mTextWatcher);
    mBinding.suggestions.listenTo(this::updateModel);
    mBinding.setModel(mModel);/*from  ww  w  . j  a v a2s  .  c  o  m*/
    mBinding.setHandlers(mEventHandlers);

    builder.setTitle(R.string.account_status_dialog_title).setView(mBinding.getRoot())
            .setNegativeButton(R.string.action_cancel, null).setPositiveButton(R.string.action_set, null);
    startLoadersWithValidContext(savedInstanceState);
}

From source file:com.ruesga.rview.fragments.FilterableDialogFragment.java

@Override
public void buildDialog(AlertDialog.Builder builder, Bundle savedInstanceState) {
    LayoutInflater inflater = LayoutInflater.from(builder.getContext());
    ViewDataBinding binding = inflateView(inflater, null, savedInstanceState);

    int count = getFilterableItems();
    for (int i = 0; i < count; i++) {
        final int item = i;
        getFilterView()[i].addTextChangedListener(new TextWatcher() {
            @Override//from  w  ww  .j  a v a 2 s . co m
            public void beforeTextChanged(CharSequence s, int start, int count, int after) {
            }

            @Override
            public void onTextChanged(CharSequence s, int start, int before, int count) {
            }

            @Override
            public void afterTextChanged(Editable s) {
                mUserSelection[item] = null;
                mIsUserSelection[item] = false;
                enabledOrDisableButtons();
            }
        });
        getFilterView()[i].setOnItemClickListener((parent, view, position, id) -> {
            mUserSelection[item] = parent.getAdapter().getItem(position).toString();
            mIsUserSelection[item] = true;
            enabledOrDisableButtons();
            AndroidHelper.hideSoftKeyboard(getContext(), getDialog().getWindow());
            onItemSelected(item, mUserSelection[item]);
        });
        getFilterView()[i].setAdapter(getAdapter()[i]);
    }

    builder.setTitle(getDialogTitle()).setView(binding.getRoot())
            .setNegativeButton(R.string.action_cancel, null)
            .setPositiveButton(getDialogActionLabel(), (dialog, which) -> performNotifyFilterSelected());
}

From source file:org.mariotaku.twidere.fragment.support.RetweetQuoteDialogFragment.java

@NonNull
@Override//www  .ja v a2 s .c o m
public Dialog onCreateDialog(final Bundle savedInstanceState) {
    final Context wrapped = ThemeUtils.getDialogThemedContext(getActivity());
    final AlertDialog.Builder builder = new AlertDialog.Builder(wrapped);
    final Context context = builder.getContext();
    mValidator = new TwidereValidator(context);
    mPreferences = SharedPreferencesWrapper.getInstance(context, SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE,
            SharedPreferenceConstants.class);
    final LayoutInflater inflater = LayoutInflater.from(context);
    @SuppressLint("InflateParams")
    final View view = inflater.inflate(R.layout.dialog_status_quote_retweet, null);
    final StatusViewHolder holder = new StatusViewHolder(new DummyStatusHolderAdapter(context),
            view.findViewById(R.id.item_content));
    final ParcelableStatus status = getStatus();

    assert status != null;

    builder.setView(view);
    builder.setTitle(R.string.retweet_quote_confirm_title);
    if (isMyRetweet(status)) {
        builder.setPositiveButton(R.string.cancel_retweet, this);
    } else if (!status.user_is_protected) {
        builder.setPositiveButton(R.string.retweet, this);
    }
    builder.setNeutralButton(R.string.quote, this);
    builder.setNegativeButton(android.R.string.cancel, null);

    holder.displayStatus(status, null, false, true);

    view.findViewById(R.id.item_menu).setVisibility(View.GONE);
    view.findViewById(R.id.action_buttons).setVisibility(View.GONE);
    view.findViewById(R.id.item_content).setFocusable(false);
    view.findViewById(R.id.comment_container)
            .setVisibility(status.user_is_protected ? View.GONE : View.VISIBLE);
    mEditComment = (UserHashtagAutoCompleteEditText) view.findViewById(R.id.edit_comment);
    mEditComment.setAccountId(status.account_id);
    mEditComment.setLengthChecker(new METLengthChecker() {

        final String statusLink = LinkCreator.getTwitterStatusLink(status.user_screen_name, status.quote_id)
                .toString();

        @Override
        public int getLength(CharSequence text) {
            return mValidator.getTweetLength(text + " " + statusLink);
        }
    });
    mEditComment.setMaxCharacters(mValidator.getMaxTweetLength());

    final boolean sendByEnter = mPreferences.getBoolean(KEY_QUICK_SEND);
    final EditTextEnterHandler enterHandler = EditTextEnterHandler.attach(mEditComment,
            new EditTextEnterHandler.EnterListener() {
                @Override
                public void onHitEnter() {
                    final AsyncTwitterWrapper twitter = getTwitterWrapper();
                    final ParcelableStatus status = getStatus();
                    if (twitter == null || status == null)
                        return;
                    retweetOrQuote(twitter, status);
                    dismiss();
                }
            }, sendByEnter);
    enterHandler.addTextChangedListener(new TextWatcher() {
        @Override
        public void beforeTextChanged(CharSequence s, int start, int count, int after) {

        }

        @Override
        public void onTextChanged(CharSequence s, int start, int before, int count) {
            final Dialog dialog = getDialog();
            if (!(dialog instanceof AlertDialog))
                return;
            final Button positiveButton = ((AlertDialog) dialog).getButton(AlertDialog.BUTTON_POSITIVE);
            if (positiveButton == null)
                return;
            positiveButton.setText(s.length() > 0 ? R.string.comment : R.string.retweet);
        }

        @Override
        public void afterTextChanged(Editable s) {

        }
    });
    mCommentMenu = view.findViewById(R.id.comment_menu);

    mPopupMenu = new PopupMenu(context, mCommentMenu, Gravity.NO_GRAVITY, R.attr.actionOverflowMenuStyle, 0);
    mCommentMenu.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            mPopupMenu.show();
        }
    });
    mCommentMenu.setOnTouchListener(mPopupMenu.getDragToOpenListener());
    mPopupMenu.inflate(R.menu.menu_dialog_comment);
    final Menu menu = mPopupMenu.getMenu();
    MenuUtils.setMenuItemAvailability(menu, R.id.quote_original_status,
            status.retweet_id > 0 || status.quote_id > 0);
    mPopupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
        @Override
        public boolean onMenuItemClick(MenuItem item) {
            if (item.isCheckable()) {
                item.setChecked(!item.isChecked());
                return true;
            }
            return false;
        }
    });

    return builder.create();
}

From source file:de.anycook.einkaufszettel.activities.AddIngredientsActivity.java

public void onNumberPickerClick(View view) {

    final EditText personsEditText = (EditText) view;
    int numPersons = Integer.parseInt(personsEditText.getText().toString());

    AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this);
    alertDialogBuilder.setMessage(R.string.for_x_people);

    View alertDialogContent = LayoutInflater.from(alertDialogBuilder.getContext())
            .inflate(R.layout.number_picker_dialog, this.ingredientListView, false);

    final NumberPicker numberPicker = (NumberPicker) alertDialogContent
            .findViewById(R.id.number_picker_dialog_numberpicker);
    numberPicker.setMaxValue(MAX_PERSONS);
    numberPicker.setValue(numPersons);//from w w w  .  j  av a 2  s  .com
    numberPicker.setMinValue(MIN_PERSONS);

    alertDialogBuilder.setView(alertDialogContent);

    alertDialogBuilder.setPositiveButton(R.string.set, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            String personsString = Integer.toString(numberPicker.getValue());
            personsEditText.setText(personsString);
            if (personsString.length() == 0) {
                return;
            }
            int numPersons = Integer.parseInt(personsEditText.getText().toString());
            ((IngredientRowAdapter) ingredientListView.getAdapter()).setCurrentPersons(numPersons);
        }
    });
    alertDialogBuilder.setNegativeButton(R.string.cancel, null);

    AlertDialog alertDialog = alertDialogBuilder.create();
    alertDialog.show();

}

From source file:com.ruesga.rview.fragments.TagEditDialogFragment.java

@Override
public void buildDialog(AlertDialog.Builder builder, Bundle savedInstanceState) {
    String title = getArguments().getString(EXTRA_TITLE);
    String action = getArguments().getString(EXTRA_ACTION);
    if (TextUtils.isEmpty(action)) {
        action = getString(R.string.action_save);
    }//from  w  ww.j  a va2s.  co m

    LayoutInflater inflater = LayoutInflater.from(builder.getContext());
    mBinding = DataBindingUtil.inflate(inflater, R.layout.tag_edit_dialog, null, true);
    if (savedInstanceState == null) {
        ArrayList<String> tags = getArguments().getStringArrayList(EXTRA_TAGS);
        if (tags != null) {
            int count = tags.size();
            Tag[] t = new Tag[count];
            for (int i = 0; i < count; i++) {
                t[i] = new Tag(TagEditTextView.TAG_MODE.HASH, tags.get(i));
            }
            mBinding.tagsEditor.setTags(t);
        }
    } else {
        mBinding.tagsEditor.fromPlainTags(savedInstanceState.getString(STATE_TAGS));
    }
    mBinding.setModel(mModel);

    builder.setTitle(title).setView(mBinding.getRoot()).setNegativeButton(R.string.action_cancel, null)
            .setPositiveButton(action, (dialog, which) -> performEditChanged());
}

From source file:com.peppermint.peppermint.ui.AnswerFragment.java

/**
 * Shows the custom message entry dialog.
 *//*from  w  w w .j  a  va  2  s .c  om*/
public void showCustomMessageDialog() {
    // Create an alert dialog containing an EditText
    final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
    final EditText et = new EditText(builder.getContext());
    builder.setCancelable(true).setView(et)
            .setPositiveButton(R.string.custom_message_send, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    // The order is arranged in a way that the popup will be destroyed when the
                    // InCallActivity is about to finish.
                    final String textMessage = et.getText().toString().trim();
                    dismissCustomMessagePopup();
                    //                        getPresenter().rejectCallWithMessage(textMessage);
                    Log.d(this, "Call rejected with message");
                    LOGD(TAG, "Call rejected with mesage" + textMessage);
                    MainActivity.hangupCall();
                    callActivity.finish();

                }
            }).setNegativeButton(R.string.custom_message_cancel, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    dismissCustomMessagePopup();
                    Log.d(this, "Dismiss with custom message");

                    //        getPresenter().onDismissDialog();
                }
            }).setOnCancelListener(new DialogInterface.OnCancelListener() {
                @Override
                public void onCancel(DialogInterface dialogInterface) {
                    dismissCustomMessagePopup();
                    Log.d(this, "Dismiss with custom message");
                    //                        getPresenter().onDismissDialog();
                }
            }).setTitle(R.string.respond_via_sms_custom_message);
    mCustomMessagePopup = builder.create();

    // Enable/disable the send button based on whether there is a message in the EditText
    et.addTextChangedListener(new TextWatcher() {
        @Override
        public void beforeTextChanged(CharSequence s, int start, int count, int after) {
        }

        @Override
        public void onTextChanged(CharSequence s, int start, int before, int count) {
        }

        @Override
        public void afterTextChanged(Editable s) {
            final Button sendButton = mCustomMessagePopup.getButton(DialogInterface.BUTTON_POSITIVE);
            sendButton.setEnabled(s != null && s.toString().trim().length() != 0);
        }
    });

    // Keyboard up, show the dialog
    mCustomMessagePopup.getWindow()
            .setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
    mCustomMessagePopup.getWindow().addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);
    mCustomMessagePopup.show();

    // Send button starts out disabled
    final Button sendButton = mCustomMessagePopup.getButton(DialogInterface.BUTTON_POSITIVE);
    sendButton.setEnabled(false);
}

From source file:com.ruesga.rview.fragments.DownloadDialogFragment.java

@Override
public void buildDialog(AlertDialog.Builder builder, Bundle savedInstanceState) {
    LayoutInflater inflater = LayoutInflater.from(builder.getContext());
    mBinding = DataBindingUtil.inflate(inflater, R.layout.download_dialog, null, true);
    mBinding.downloadCommands.from(mDownloadCommands.get(mModel.downloadType)).with(mHandlers).update();
    mBinding.setModel(mModel);//from w  w  w  . j  a v a  2s .c  o m
    mBinding.setHandlers(mHandlers);

    builder.setTitle(R.string.download_commands_dialog_title).setView(mBinding.getRoot())
            .setPositiveButton(R.string.action_close, null);
}

From source file:net.simonvt.cathode.ui.dialog.CheckInDialog.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    final SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(getActivity());
    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()).setTitle(R.string.action_checkin);

    Bundle args = getArguments();//from   w  w  w . ja  va 2  s . com
    final Type type = (Type) args.getSerializable(ARG_TYPE);
    final String titleArg = args.getString(ARG_TITLE);
    final long id = args.getLong(ARG_ID);

    View view = LayoutInflater.from(builder.getContext()).inflate(R.layout.dialog_check_in, null);
    TextView title = (TextView) view.findViewById(R.id.title);
    final EditText message = (EditText) view.findViewById(R.id.message);
    final CheckBox facebook = (CheckBox) view.findViewById(R.id.facebook);
    final CheckBox twitter = (CheckBox) view.findViewById(R.id.twitter);
    final CheckBox tumblr = (CheckBox) view.findViewById(R.id.tumblr);

    title.setText(titleArg);
    final boolean facebookShare = settings.getBoolean(Settings.PROFILE_CONNECTION_FACEBOOK, false);
    final boolean twitterShare = settings.getBoolean(Settings.PROFILE_CONNECTION_TWITTER, false);
    final boolean tumblrShare = settings.getBoolean(Settings.PROFILE_CONNECTION_TUMBLR, false);
    facebook.setVisibility(facebookShare ? View.VISIBLE : View.GONE);
    twitter.setVisibility(twitterShare ? View.VISIBLE : View.GONE);
    tumblr.setVisibility(tumblrShare ? View.VISIBLE : View.GONE);

    if (facebookShare || twitterShare || tumblrShare) {
        view.findViewById(R.id.message_title).setVisibility(View.VISIBLE);
        message.setVisibility(View.VISIBLE);
        view.findViewById(R.id.share_title).setVisibility(View.VISIBLE);
    } else {
        view.findViewById(R.id.message_title).setVisibility(View.GONE);
        message.setVisibility(View.GONE);
        view.findViewById(R.id.share_title).setVisibility(View.GONE);
    }

    String shareMessage = settings.getString(Settings.PROFILE_SHARING_TEXT_WATCHING,
            getString(R.string.checkin_message_default));
    shareMessage = shareMessage.replace("[item]", titleArg);
    message.setText(shareMessage);

    builder.setView(view).setPositiveButton(R.string.action_checkin, new OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            final boolean facebookShare = facebook.isChecked();
            final boolean twitterShare = twitter.isChecked();
            final boolean tumblrShare = tumblr.isChecked();
            final String shareMessage = message.getText().toString();

            settings.edit().putBoolean(Settings.PROFILE_CONNECTION_FACEBOOK, facebookShare)
                    .putBoolean(Settings.PROFILE_CONNECTION_TWITTER, twitterShare)
                    .putBoolean(Settings.PROFILE_CONNECTION_TUMBLR, tumblrShare)
                    .putString(Settings.PROFILE_SHARING_TEXT_WATCHING, shareMessage).apply();

            if (type == Type.SHOW) {
                episodeScheduler.checkin(id, shareMessage, facebookShare, twitterShare, tumblrShare);
            } else {
                movieScheduler.checkin(id, shareMessage, facebookShare, twitterShare, tumblrShare);
            }
        }
    });

    return builder.create();
}

From source file:org.mariotaku.twidere.fragment.RetweetQuoteDialogFragment.java

@NonNull
@Override/*from   ww  w .j  a  v a2 s.com*/
public Dialog onCreateDialog(final Bundle savedInstanceState) {
    final AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
    final Context context = builder.getContext();
    final ParcelableStatus status = getStatus();
    assert status != null;
    final ParcelableCredentials credentials = ParcelableCredentialsUtils.getCredentials(getContext(),
            status.account_key);
    assert credentials != null;

    builder.setView(R.layout.dialog_status_quote_retweet);
    builder.setTitle(R.string.retweet_quote_confirm_title);
    builder.setPositiveButton(R.string.retweet, null);
    builder.setNegativeButton(android.R.string.cancel, null);
    builder.setNeutralButton(R.string.quote, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            final Intent intent = new Intent(INTENT_ACTION_QUOTE);
            final Menu menu = mPopupMenu.getMenu();
            final MenuItem quoteOriginalStatus = menu.findItem(R.id.quote_original_status);
            intent.putExtra(EXTRA_STATUS, status);
            intent.putExtra(EXTRA_QUOTE_ORIGINAL_STATUS, quoteOriginalStatus.isChecked());
            startActivity(intent);
        }
    });

    final Dialog dialog = builder.create();
    dialog.setOnShowListener(new DialogInterface.OnShowListener() {
        @Override
        public void onShow(DialogInterface dialogInterface) {
            final AlertDialog dialog = (AlertDialog) dialogInterface;

            final View itemContent = dialog.findViewById(R.id.item_content);
            final StatusTextCountView textCountView = (StatusTextCountView) dialog
                    .findViewById(R.id.comment_text_count);
            final View itemMenu = dialog.findViewById(R.id.item_menu);
            final View actionButtons = dialog.findViewById(R.id.action_buttons);
            final View commentContainer = dialog.findViewById(R.id.comment_container);
            final ComposeEditText editComment = (ComposeEditText) dialog.findViewById(R.id.edit_comment);
            final View commentMenu = dialog.findViewById(R.id.comment_menu);
            assert itemContent != null && textCountView != null && itemMenu != null && actionButtons != null
                    && commentContainer != null && editComment != null && commentMenu != null;

            final DummyItemAdapter adapter = new DummyItemAdapter(context);
            adapter.setShouldShowAccountsColor(true);
            final IStatusViewHolder holder = new StatusViewHolder(adapter, itemContent);
            holder.displayStatus(status, false, true);

            textCountView.setMaxLength(TwidereValidator.getTextLimit(credentials));

            itemMenu.setVisibility(View.GONE);
            actionButtons.setVisibility(View.GONE);
            itemContent.setFocusable(false);
            final boolean useQuote = useQuote(!status.user_is_protected, credentials);

            commentContainer.setVisibility(useQuote ? View.VISIBLE : View.GONE);
            editComment.setAccountKey(status.account_key);

            final boolean sendByEnter = mPreferences.getBoolean(KEY_QUICK_SEND);
            final EditTextEnterHandler enterHandler = EditTextEnterHandler.attach(editComment,
                    new EditTextEnterHandler.EnterListener() {
                        @Override
                        public boolean shouldCallListener() {
                            return true;
                        }

                        @Override
                        public boolean onHitEnter() {
                            final ParcelableStatus status = getStatus();
                            if (status == null)
                                return false;
                            if (retweetOrQuote(credentials, status, SHOW_PROTECTED_CONFIRM)) {
                                dismiss();
                                return true;
                            }
                            return false;
                        }
                    }, sendByEnter);
            enterHandler.addTextChangedListener(new TextWatcher() {
                @Override
                public void beforeTextChanged(CharSequence s, int start, int count, int after) {

                }

                @Override
                public void onTextChanged(CharSequence s, int start, int before, int count) {
                    updateTextCount(getDialog(), s, status, credentials);
                }

                @Override
                public void afterTextChanged(Editable s) {

                }
            });

            mPopupMenu = new PopupMenu(context, commentMenu, Gravity.NO_GRAVITY, R.attr.actionOverflowMenuStyle,
                    0);
            commentMenu.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    mPopupMenu.show();
                }
            });
            commentMenu.setOnTouchListener(mPopupMenu.getDragToOpenListener());
            mPopupMenu.inflate(R.menu.menu_dialog_comment);
            final Menu menu = mPopupMenu.getMenu();
            MenuUtils.setMenuItemAvailability(menu, R.id.quote_original_status,
                    status.retweet_id != null || status.quoted_id != null);
            mPopupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
                @Override
                public boolean onMenuItemClick(MenuItem item) {
                    if (item.isCheckable()) {
                        item.setChecked(!item.isChecked());
                        return true;
                    }
                    return false;
                }
            });

            dialog.getButton(DialogInterface.BUTTON_POSITIVE).setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    boolean dismissDialog = false;
                    if (editComment.length() > 0) {
                        dismissDialog = retweetOrQuote(credentials, status, SHOW_PROTECTED_CONFIRM);
                    } else if (isMyRetweet(status)) {
                        mTwitterWrapper.cancelRetweetAsync(status.account_key, status.id, status.my_retweet_id);
                        dismissDialog = true;
                    } else if (useQuote(!status.user_is_protected, credentials)) {
                        dismissDialog = retweetOrQuote(credentials, status, SHOW_PROTECTED_CONFIRM);
                    } else {
                        TwidereBugReporter.logException(new IllegalStateException(status.toString()));
                    }
                    if (dismissDialog) {
                        dismiss();
                    }
                }
            });

            updateTextCount(dialog, editComment.getText(), status, credentials);
        }
    });
    return dialog;
}

From source file:de.dmxcontrol.fragment.ActionSelectorFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    Log.d(TAG, "onCreateView");

    LinearLayout actionButtons = (LinearLayout) inflater.inflate(R.layout.action_selector_fragment, container,
            false);/*  w ww. ja  v  a 2s. c  o m*/

    ViewGroup vg = (ViewGroup) actionButtons.findViewById(R.id.action_selector_scroll);
    scrollView = vg;

    bDeviceAction = (Button) actionButtons.findViewById(R.id.button_device_action);
    bDeviceAction.setOnClickListener(this);
    bDeviceAction.setOnLongClickListener(new View.OnLongClickListener() {
        @Override
        public boolean onLongClick(View v) {
            try {
                AlertDialog.Builder alert = new AlertDialog.Builder(v.getContext());
                alert.setTitle("Parameter");
                final DeviceManagerDialog view = new DeviceManagerDialog(alert.getContext());
                alert.setView(view);
                alert.setPositiveButton("OK", new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int whichButton) {
                        try {
                            ServiceFrontend.get().sendMessage(view.GetDeviceMetadata().getBytes());
                        } catch (JSONException e) {
                            e.printStackTrace();
                        }
                    }
                });
                AlertDialog alertDialog = alert.create();
                alertDialog.show();
                return true;
            } catch (Exception e) {
                return false;
            }
        }
    });

    bColorAction = (Button) actionButtons.findViewById(R.id.button_color_action);
    bColorAction.setOnClickListener(this);

    bIntensityAction = (Button) actionButtons.findViewById(R.id.button_intensity_action);
    bIntensityAction.setOnClickListener(this);

    bPanTiltAction = (Button) actionButtons.findViewById(R.id.button_pantilt_action);
    bPanTiltAction.setOnClickListener(this);

    bGoboAction = (Button) actionButtons.findViewById(R.id.button_gobo_action);
    bGoboAction.setOnClickListener(this);

    bOpticAction = (Button) actionButtons.findViewById(R.id.button_optic_action);
    bOpticAction.setOnClickListener(this);

    bPrismAction = (Button) actionButtons.findViewById(R.id.button_prism_action);
    bPrismAction.setOnClickListener(this);
    //bOpticAction.setVisibility(View.INVISIBLE);
    //actionButtons.removeView(bOpticAction);

    bRawAction = (Button) actionButtons.findViewById(R.id.button_raw_action);
    bRawAction.setOnClickListener(this);
    //bRawAction.setVisibility(View.INVISIBLE);
    //actionButtons.removeView(bRawAction);

    bEffectAction = (Button) actionButtons.findViewById(R.id.button_effect_action);
    bEffectAction.setOnClickListener(this);
    //bEffectAction.setVisibility(View.INVISIBLE);
    //actionButtons.removeView(bEffectAction);

    bPresetAction = (Button) actionButtons.findViewById(R.id.button_preset_action);
    bPresetAction.setOnClickListener(this);

    bProgrammerAction = (Button) actionButtons.findViewById(R.id.button_programmer_action);
    bProgrammerAction.setOnClickListener(this);

    updateStateSelected();
    return actionButtons;
}