Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View CWrecker's full-sized avatar
🎯
Focusing

Camden Shultz CWrecker

🎯
Focusing
View GitHub Profile
<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"
<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" />
<?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"
@CWrecker
CWrecker / MainActivity.java
Last active March 31, 2019 09:43
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.
public class MainActivity extends AppCompatActivity {
//--------------------------------
// Serial Connection
//-------------------------------
@CWrecker
CWrecker / MainActivity.java
Created March 31, 2019 09:45
Here we are adding the buttons to force serial-connection related functions.
//-------------------------------
//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
Created March 31, 2019 09:48
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)
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
Last active March 31, 2019 09:51
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.
//---------------------------------------------
// DRINK ITEMS / IMAGES ON CAROUSEL!
//---------------------------------------------
carouselPicker1 = findViewById(R.id.carouselPicker1);
carouselPicker2 = findViewById(R.id.carouselPicker2);
carouselPicker3 = findViewById(R.id.carouselPicker3);
//VODKA BASED DRINKS
//---------------------------------------------
// DRINK ITEMS / IMAGES ON CAROUSEL!
//---------------------------------------------
carouselPicker1 = findViewById(R.id.carouselPicker1);
carouselPicker2 = findViewById(R.id.carouselPicker2);
carouselPicker3 = findViewById(R.id.carouselPicker3);
@CWrecker
CWrecker / popup.java
Created March 31, 2019 10:39
this is the custom pop up.
gkyf