Skip to content

Instantly share code, notes, and snippets.

CWrecker

Block or report user

Report or block CWrecker

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@CWrecker
CWrecker / popup.java
Created Mar 31, 2019
this is the custom pop up.
View mainactivity.java
//---------------------------------------------
// DRINK ITEMS / IMAGES ON CAROUSEL!
//---------------------------------------------
carouselPicker1 = findViewById(R.id.carouselPicker1);
carouselPicker2 = findViewById(R.id.carouselPicker2);
carouselPicker3 = findViewById(R.id.carouselPicker3);
@CWrecker
CWrecker / MainActivity.java
Last active Mar 31, 2019
Here we are actually creating the carousels. There are three in total. One for Gin, Rum and wisky. an item is then added to a carousel, with an image attached. This is what will show up on the screen. The images already have the names written on them so it makes it easy to find a drink.
View MainActivity.java
//---------------------------------------------
// DRINK ITEMS / IMAGES ON CAROUSEL!
//---------------------------------------------
carouselPicker1 = findViewById(R.id.carouselPicker1);
carouselPicker2 = findViewById(R.id.carouselPicker2);
carouselPicker3 = findViewById(R.id.carouselPicker3);
//VODKA BASED DRINKS
@CWrecker
CWrecker / mainactivity.java
Created Mar 31, 2019
These variables are the characteristics of any given drink. Changing these will change the drink produced. These are also the values that are sent to the arduino in a string of numbers. (i call that the DrinkID)
View mainactivity.java
Dialog myDialog;
String DrinkName="A Drink"; //Note these strings should never appear
String DrinkType="A Drink Type"; //Note these strings should never appear
public int Vodka_Measure;
public int Rum_Measure;
public int Gin_Measure;
public int Whiskey_Measure;
public int TonicWater_Measure;
@CWrecker
CWrecker / MainActivity.java
Created Mar 31, 2019
Here we are adding the buttons to force serial-connection related functions.
View MainActivity.java
//-------------------------------
//Serial Connection Functions
//----------------------
usbManager = (UsbManager) getSystemService(this.USB_SERVICE);
startButton = (Button) findViewById(R.id.buttonStart);
sendButton = (Button) findViewById(R.id.buttonSend);
orderButton = (Button) findViewById(R.id.btnorder);
clearButton = (Button) findViewById(R.id.buttonClear);
@CWrecker
CWrecker / MainActivity.java
Last active Mar 31, 2019
In this step we will create the serial connection that attaches the android app and the arduino together. In addition there will be buttons that will call functions to initiate specific tasks like sending, closing, and opening the connection.
View MainActivity.java
public class MainActivity extends AppCompatActivity {
//--------------------------------
// Serial Connection
//-------------------------------
View Step 3) This is what your file should look like
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorPrimaryDark"
View Activity_Main.xml
<TextView
android:layout_width="match_parent"
android:layout_height="30dp"
android:layout_gravity="center"
android:gravity="center"
android:text="Vodka Drinks"
android:textColor="@color/White"
android:textSize="20dp"
android:textStyle="bold" />
View activity_main.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="200dp"
android:layout_gravity="top"
tools:context=".MainActivity">
<EditText
android:id="@+id/editText"
android:layout_width="wrap_content"
You can’t perform that action at this time.