Example usage for android.support.v4.app AlertDialogFragment setArguments

List of usage examples for android.support.v4.app AlertDialogFragment setArguments

Introduction

In this page you can find the example usage for android.support.v4.app AlertDialogFragment setArguments.

Prototype

public void setArguments(Bundle args) 

Source Link

Document

Supply the construction arguments for this fragment.

Usage

From source file:com.javielinux.fragments.MyActivityFragment.java

private void showDeleteUserDialog() {

    AlertDialogFragment frag = new AlertDialogFragment();
    Bundle args = new Bundle();
    args.putInt(AlertDialogFragment.KEY_ALERT_TITLE, R.string.title_question_delete);
    args.putInt(AlertDialogFragment.KEY_ALERT_MESSAGE, R.string.question_delete);
    frag.setArguments(args);
    frag.setAlertButtonListener(new AlertDialogFragment.AlertButtonListener() {
        @Override//from  w  w  w  . ja v  a 2  s  .c om
        public void OnAlertButtonOk() {
            deleteUser();
        }

        @Override
        public void OnAlertButtonCancel() {
        }

        @Override
        public void OnAlertButtonNeutral() {
        }

        @Override
        public void OnAlertItems(int witch) {
        }
    });
    frag.show(getFragmentManager(), "dialog");

}

From source file:com.javielinux.fragments.MyActivityFragment.java

public void longClickSearch(final Entity search) {
    AlertDialogFragment frag = new AlertDialogFragment();
    Bundle args = new Bundle();
    args.putInt(AlertDialogFragment.KEY_ALERT_TITLE, R.string.actions);
    args.putBoolean(AlertDialogFragment.KEY_ALERT_HAS_POSITIVE_BUTTON, false);
    args.putBoolean(AlertDialogFragment.KEY_ALERT_CANCELABLE, false);
    args.putInt(AlertDialogFragment.KEY_ALERT_ARRAY_ITEMS, R.array.actions_search);
    frag.setArguments(args);
    frag.setAlertButtonListener(new AlertDialogFragment.AlertButtonListener() {
        @Override//from w w  w  . j a  v  a 2  s  . c  om
        public void OnAlertButtonOk() {
        }

        @Override
        public void OnAlertButtonCancel() {
        }

        @Override
        public void OnAlertButtonNeutral() {
        }

        @Override
        public void OnAlertItems(int which) {
            if (which == 0) {
                openSearchColumn(search);
            } else if (which == 1) {
                editSearch(search);
            } else if (which == 2) {
                shareSearch(search);
            } else if (which == 3) {
                showDialogDeleteSearch(search);
            }
        }
    });
    frag.show(getFragmentManager(), "dialog");

}

From source file:com.javielinux.fragments.MyActivityFragment.java

private void showFacebookDialog() {

    AlertDialogFragment frag = new AlertDialogFragment();
    Bundle args = new Bundle();
    args.putInt(AlertDialogFragment.KEY_ALERT_TITLE, R.string.actions);
    args.putBoolean(AlertDialogFragment.KEY_ALERT_HAS_POSITIVE_BUTTON, false);
    args.putBoolean(AlertDialogFragment.KEY_ALERT_CANCELABLE, false);
    args.putInt(AlertDialogFragment.KEY_ALERT_ARRAY_ITEMS, R.array.actions_users_facebook);
    frag.setArguments(args);
    frag.setAlertButtonListener(new AlertDialogFragment.AlertButtonListener() {
        @Override/*from   w w  w. ja va  2  s .  co  m*/
        public void OnAlertButtonOk() {
        }

        @Override
        public void OnAlertButtonCancel() {
        }

        @Override
        public void OnAlertButtonNeutral() {
        }

        @Override
        public void OnAlertItems(int which) {
            if (which == 0) {
                showDeleteUserDialog();
            }
        }
    });
    frag.show(getFragmentManager(), "dialog");

}

From source file:com.javielinux.fragments.MyActivityFragment.java

private void showTwitterDialog() {

    AlertDialogFragment frag = new AlertDialogFragment();
    Bundle args = new Bundle();
    args.putInt(AlertDialogFragment.KEY_ALERT_TITLE, R.string.actions);
    args.putBoolean(AlertDialogFragment.KEY_ALERT_HAS_POSITIVE_BUTTON, false);
    args.putBoolean(AlertDialogFragment.KEY_ALERT_CANCELABLE, false);
    args.putInt(AlertDialogFragment.KEY_ALERT_ARRAY_ITEMS, R.array.actions_users);
    frag.setArguments(args);
    frag.setAlertButtonListener(new AlertDialogFragment.AlertButtonListener() {
        @Override/* w  w w.  j a v a2s .c  om*/
        public void OnAlertButtonOk() {
        }

        @Override
        public void OnAlertButtonCancel() {
        }

        @Override
        public void OnAlertButtonNeutral() {
        }

        @Override
        public void OnAlertItems(int which) {
            if (which == 0) {
                showUser();
            } else if (which == 1) {
                editUser();
            } else if (which == 2) {
                showSelectImageDialog();
            } else if (which == 3) {
                refreshAvatar();
            } else if (which == 4) {
                showDeleteUserDialog();
            } else if (which == 5) {
                showUserLists();
            } else if (which == 6) {
                createUserFavoritesColumn();
            } else if (which == 7) {
                createUserRetweetByUserColumn();
            } else if (which == 8) {
                createUserRetweetByOtherColumn();
            } else if (which == 9) {
                saveForUseForSearches();
            }

        }
    });
    frag.show(getFragmentManager(), "dialog");

}

From source file:com.javielinux.fragments.MyActivityFragment.java

private void showMenuMoreActions(View v) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        PopupMenu popupMenu = new PopupMenu(getActivity(), v);
        popupMenu.getMenuInflater().inflate(R.menu.my_activity_more_actions, popupMenu.getMenu());
        popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {

            @Override/*from  w ww. ja v a 2 s . c o  m*/
            public boolean onMenuItemClick(MenuItem item) {
                if (item.getItemId() == R.id.popupmenu_more_actions_saved_tweet) {
                    openSavedTweetColumn();
                } else if (item.getItemId() == R.id.popupmenu_more_actions_trending_topics) {
                    newTrending();
                }
                return true;
            }
        });
        popupMenu.show();
    } else {
        AlertDialogFragment frag = new AlertDialogFragment();
        Bundle args = new Bundle();
        args.putInt(AlertDialogFragment.KEY_ALERT_TITLE, R.string.actions);
        args.putBoolean(AlertDialogFragment.KEY_ALERT_HAS_POSITIVE_BUTTON, false);
        args.putBoolean(AlertDialogFragment.KEY_ALERT_CANCELABLE, false);
        args.putInt(AlertDialogFragment.KEY_ALERT_ARRAY_ITEMS, R.array.popupmenu_my_activity_more_actions);
        frag.setArguments(args);
        frag.setAlertButtonListener(new AlertDialogFragment.AlertButtonListener() {
            @Override
            public void OnAlertButtonOk() {
            }

            @Override
            public void OnAlertButtonCancel() {
            }

            @Override
            public void OnAlertButtonNeutral() {
            }

            @Override
            public void OnAlertItems(int which) {
                if (which == 0) {
                    openSavedTweetColumn();
                } else if (which == 1) {
                    newTrending();
                }
            }
        });
        frag.show(getFragmentManager(), "dialog");
    }
}

From source file:com.javielinux.fragments.MyActivityFragment.java

private void showMenuOptions(View v) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        PopupMenu popupMenu = new PopupMenu(getActivity(), v);
        popupMenu.getMenuInflater().inflate(R.menu.my_activity_more_options, popupMenu.getMenu());
        popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {

            @Override/*from   w w w .ja va  2 s .  c  o m*/
            public boolean onMenuItemClick(MenuItem item) {
                if (item.getItemId() == R.id.popupmenu_more_options_size) {
                    showSizeText();
                } else if (item.getItemId() == R.id.popupmenu_more_options_theme) {
                    showThemeDialog();
                } else if (item.getItemId() == R.id.popupmenu_more_options_preferences) {
                    Intent i = new Intent(getActivity(), Preferences.class);
                    startActivity(i);
                } else if (item.getItemId() == R.id.popupmenu_more_options_exit) {
                    showDialogExit();
                }
                return true;
            }
        });
        popupMenu.show();
    } else {
        AlertDialogFragment frag = new AlertDialogFragment();
        Bundle args = new Bundle();
        args.putInt(AlertDialogFragment.KEY_ALERT_TITLE, R.string.actions);
        args.putBoolean(AlertDialogFragment.KEY_ALERT_HAS_POSITIVE_BUTTON, false);
        args.putBoolean(AlertDialogFragment.KEY_ALERT_CANCELABLE, false);
        args.putInt(AlertDialogFragment.KEY_ALERT_ARRAY_ITEMS, R.array.popupmenu_my_activity_more_options);
        frag.setArguments(args);
        frag.setAlertButtonListener(new AlertDialogFragment.AlertButtonListener() {
            @Override
            public void OnAlertButtonOk() {
            }

            @Override
            public void OnAlertButtonCancel() {
            }

            @Override
            public void OnAlertButtonNeutral() {
            }

            @Override
            public void OnAlertItems(int which) {
                if (which == 0) {
                    showSizeText();
                } else if (which == 1) {
                    Intent i = new Intent(getActivity(), Preferences.class);
                    startActivity(i);
                } else if (which == 2) {
                    showThemeDialog();
                } else if (which == 3) {
                    showDialogExit();
                }
            }
        });
        frag.show(getFragmentManager(), "dialog");
    }
}

From source file:com.javielinux.fragments.MyActivityFragment.java

private void showDialogDeleteSearch(final Entity search) {
    AlertDialogFragment alertDialogFragment = new AlertDialogFragment();
    Bundle args = new Bundle();
    args.putInt(AlertDialogFragment.KEY_ALERT_TITLE, R.string.title_question_delete);
    args.putInt(AlertDialogFragment.KEY_ALERT_MESSAGE, R.string.question_delete);
    args.putBoolean(AlertDialogFragment.KEY_ALERT_HAS_NEGATIVE_BUTTON, true);
    args.putInt(AlertDialogFragment.KEY_ALERT_POSITIVE_LABEL, R.string.alert_dialog_ok);
    args.putInt(AlertDialogFragment.KEY_ALERT_NEGATIVE_LABEL, R.string.alert_dialog_cancel);
    alertDialogFragment.setArguments(args);
    alertDialogFragment.setAlertButtonListener(new AlertDialogFragment.AlertButtonListener() {
        @Override/*from w  w  w.  j av  a  2  s  .c  o  m*/
        public void OnAlertButtonOk() {
            deleteSearch(search);
        }

        @Override
        public void OnAlertButtonCancel() {
        }

        @Override
        public void OnAlertButtonNeutral() {
        }

        @Override
        public void OnAlertItems(int which) {
        }
    });
    alertDialogFragment.show(getFragmentManager(), "dialog");

}