GenericDialog

public abstract class GenericDialog extends DialogFragment

A generic class that makes it easy to customize dialog boxes. example usage of an implementation AlertboxDialog

AlertboxDialog alertboxDialog = new AlertboxDialog();
alertboxDialog.disableButtons(true);
alertboxDialog.setTitle("NETWORK ERROR");
alertboxDialog.setIcon(R.drawable.fail);
alertboxDialog.setMessage(activity.getString(R.string.network_error));
alertboxDialog.show(activity.getSupportFragmentManager(), "network_error");

Fields

layout

protected View layout

leftButton

protected Button leftButton

rightButton

protected Button rightButton

Constructors

GenericDialog

public GenericDialog()

Methods

disableButtons

public void disableButtons(boolean b)

getContentLayout

protected int getContentLayout()

onCreateView

public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)

onViewCreated

public void onViewCreated(View view, Bundle savedInstanceState)

onViewReady

protected abstract void onViewReady(View view, Bundle savedInstanceState)

Add your logic to this method since at this point most of the work is done for you and the base layout has been polutated with your content layout

setContentLayout

public void setContentLayout(int layoutID)

setIcon

public void setIcon(int drawable)

setLeftButton

public void setLeftButton(String label, ButtonClickedListener clickListener)

SEt the listner to be invoked when the left button is clicked

Parameters:
  • label
  • clickListener

setRightButton

public void setRightButton(String label, ButtonClickedListener clickListener)

set listener to be invoked when the right button is cliked.

Parameters:
  • label
  • clickListener

setTitle

public void setTitle(String title)

setTitleBackground

public void setTitleBackground(int titleBgColor)

setTitleTextColor

public void setTitleTextColor(int titleBgColor)