Skip to content

Instantly share code, notes, and snippets.

@Camden5S
Created March 31, 2019 10:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Camden5S/87bc7bb686640e98888dbbbbed12efc9 to your computer and use it in GitHub Desktop.
Save Camden5S/87bc7bb686640e98888dbbbbed12efc9 to your computer and use it in GitHub Desktop.
now we need to create the order button that shows the popup for the final order. here you can select the size of the drink.
//BUTTON TO INITIATE POPUP
public void ShowPopup(View v) {
TextView txtclose;
Button btnOrder;
myDialog.setContentView(R.layout.custompopup);
txtclose = (TextView) myDialog.findViewById(R.id.txtclose);
btnOrder = (Button) myDialog.findViewById(R.id.btnorder);
txtclose.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
myDialog.dismiss();
}
});
myDialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
myDialog.show();
TextView DrinkNameText;
DrinkNameText = (TextView) myDialog.findViewById(R.id.DrinkNameText);
DrinkNameText.setText(DrinkName);
TextView DrinkTypeText;
DrinkTypeText = (TextView) myDialog.findViewById(R.id.DrinkNameTypeText);
DrinkTypeText.setText(DrinkType);
/**
TextView SetDrinkNameText = (TextView) findViewById(R.id.DrinkNameText);
SetDrinkNameText.setText(DrinkName);
TextView SetDrinkTypeText = (TextView) findViewById(R.id.DrinkNameTypeText);
SetDrinkTypeText.setText(DrinkType);
**/
LinearLayout SetDrinkSizeSmall;
SetDrinkSizeSmall = (LinearLayout) myDialog.findViewById(R.id.SetDrinkSize_Small);
SetDrinkSizeSmall.setOnClickListener(new View.OnClickListener() {
//SETTING THE SIZE OF THE DRINK USING THE 3 BUTTONS IN THE POP UP! THIS IS ONE VALUE OF THE DRINK ORDER
@Override
public void onClick(View v) {
DrinkSize = 1;
DrinkSizeText = "Small";
Toast Small = Toast.makeText(getApplicationContext(),
"Drink Size Set To Small",
Toast.LENGTH_SHORT);
Small.show();
}
});
LinearLayout SetDrinkSizeMedium;
SetDrinkSizeMedium = (LinearLayout) myDialog.findViewById(R.id.SetDrinkSize_Medium);
SetDrinkSizeMedium.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
DrinkSize = 2;
DrinkSizeText = "Medium";
Toast Medium = Toast.makeText(getApplicationContext(),
"Drink Size Set To Medium",
Toast.LENGTH_SHORT);
Medium.show();
}
});
LinearLayout SetDrinkSizeLarge;
SetDrinkSizeLarge = (LinearLayout) myDialog.findViewById(R.id.SetDrinkSize_Large);
SetDrinkSizeLarge.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
DrinkSize = 3;
DrinkSizeText = "Large";
Toast Large = Toast.makeText(getApplicationContext(),
"Drink Size Set To Large",
Toast.LENGTH_SHORT);
Large.show();
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment