diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..aa69733
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,49 @@
+.gradle
+/local.properties
+/.idea/workspace.xml
+/.idea/libraries
+.DS_Store
+/build
+
+## Old ^^
+
+## New vv
+
+# Gradle files
+.gradle/
+build/
+
+# Local configuration file (sdk path, etc)
+local.properties
+
+# Log/OS Files
+*.log
+
+# Android Studio generated files and folders
+captures/
+.externalNativeBuild/
+.cxx/
+*.apk
+output.json
+
+# IntelliJ
+*.iml
+.idea/
+misc.xml
+deploymentTargetDropDown.xml
+render.experimental.xml
+
+# Keystore files
+*.jks
+*.keystore
+
+# Google Services (e.g. APIs or Firebase)
+google-services.json
+
+# Android Profiling
+*.hprof
+/app/debug/output-metadata.json
+
+# Ha!
+keystore/*
+release
diff --git a/app/_gitignore b/app/_gitignore
new file mode 100755
index 0000000..796b96d
--- /dev/null
+++ b/app/_gitignore
@@ -0,0 +1 @@
+/build
diff --git a/app/build.gradle b/app/build.gradle
new file mode 100755
index 0000000..4784072
--- /dev/null
+++ b/app/build.gradle
@@ -0,0 +1,26 @@
+apply plugin: 'com.android.application'
+
+android {
+ compileSdkVersion 23
+ buildToolsVersion "23.0.2"
+
+ defaultConfig {
+ applicationId "com.hyperling.carbupbeta"
+ minSdkVersion 8
+ targetSdkVersion 23
+ versionCode 6
+ versionName "0.11"
+ }
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ }
+ }
+}
+
+dependencies {
+ compile fileTree(dir: 'libs', include: ['*.jar'])
+ compile 'com.android.support:appcompat-v7:23.1.1'
+ compile 'com.google.android.gms:play-services-ads:8.3.0'
+}
diff --git a/app/manifest-merger-release-report.txt b/app/manifest-merger-release-report.txt
new file mode 100755
index 0000000..961233d
--- /dev/null
+++ b/app/manifest-merger-release-report.txt
@@ -0,0 +1,81 @@
+-- Merging decision tree log ---
+manifest
+ADDED from AndroidManifest.xml:2:1
+ xmlns:android
+ ADDED from AndroidManifest.xml:2:11
+ package
+ ADDED from AndroidManifest.xml:3:5
+ INJECTED from AndroidManifest.xml:0:0
+ INJECTED from AndroidManifest.xml:0:0
+ android:versionName
+ INJECTED from AndroidManifest.xml:0:0
+ INJECTED from AndroidManifest.xml:0:0
+ android:versionCode
+ INJECTED from AndroidManifest.xml:0:0
+ INJECTED from AndroidManifest.xml:0:0
+application
+ADDED from AndroidManifest.xml:5:5
+MERGED from com.android.support:appcompat-v7:21.0.3:16:5
+MERGED from com.android.support:support-v4:21.0.3:16:5
+ android:label
+ ADDED from AndroidManifest.xml:8:9
+ android:allowBackup
+ ADDED from AndroidManifest.xml:6:9
+ android:icon
+ ADDED from AndroidManifest.xml:7:9
+ android:theme
+ ADDED from AndroidManifest.xml:9:9
+activity#carbupbeta.Splash
+ADDED from AndroidManifest.xml:10:9
+ android:screenOrientation
+ ADDED from AndroidManifest.xml:13:13
+ android:label
+ ADDED from AndroidManifest.xml:12:13
+ android:name
+ ADDED from AndroidManifest.xml:11:13
+intent-filter#android.intent.action.MAIN+android.intent.category.LAUNCHER
+ADDED from AndroidManifest.xml:14:13
+action#android.intent.action.MAIN
+ADDED from AndroidManifest.xml:15:17
+ android:name
+ ADDED from AndroidManifest.xml:15:25
+category#android.intent.category.LAUNCHER
+ADDED from AndroidManifest.xml:17:17
+ android:name
+ ADDED from AndroidManifest.xml:17:27
+activity#carbupbeta.Main
+ADDED from AndroidManifest.xml:20:9
+ android:screenOrientation
+ ADDED from AndroidManifest.xml:23:13
+ android:label
+ ADDED from AndroidManifest.xml:22:13
+ android:name
+ ADDED from AndroidManifest.xml:21:13
+activity#carbupbeta.Tab1
+ADDED from AndroidManifest.xml:25:9
+ android:label
+ ADDED from AndroidManifest.xml:27:13
+ android:name
+ ADDED from AndroidManifest.xml:26:13
+activity#carbupbeta.Tab2
+ADDED from AndroidManifest.xml:29:9
+ android:label
+ ADDED from AndroidManifest.xml:31:13
+ android:name
+ ADDED from AndroidManifest.xml:30:13
+activity#carbupbeta.Tab3
+ADDED from AndroidManifest.xml:33:9
+ android:label
+ ADDED from AndroidManifest.xml:35:13
+ android:name
+ ADDED from AndroidManifest.xml:34:13
+uses-sdk
+INJECTED from AndroidManifest.xml:0:0 reason: use-sdk injection requested
+MERGED from com.android.support:appcompat-v7:21.0.3:15:5
+MERGED from com.android.support:support-v4:21.0.3:15:5
+ android:targetSdkVersion
+ INJECTED from AndroidManifest.xml:0:0
+ INJECTED from AndroidManifest.xml:0:0
+ android:minSdkVersion
+ INJECTED from AndroidManifest.xml:0:0
+ INJECTED from AndroidManifest.xml:0:0
diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro
new file mode 100755
index 0000000..feea2c7
--- /dev/null
+++ b/app/proguard-rules.pro
@@ -0,0 +1,17 @@
+# Add project specific ProGuard rules here.
+# By default, the flags in this file are appended to flags specified
+# in /home/usb/android-sdk/tools/proguard/proguard-android.txt
+# You can edit the include path and order by changing the proguardFiles
+# directive in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# Add any project specific keep options here:
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
diff --git a/app/src/androidTest/java/com/hyperling/carbupbeta/ApplicationTest.java b/app/src/androidTest/java/com/hyperling/carbupbeta/ApplicationTest.java
new file mode 100755
index 0000000..f66e8e7
--- /dev/null
+++ b/app/src/androidTest/java/com/hyperling/carbupbeta/ApplicationTest.java
@@ -0,0 +1,13 @@
+package com.hyperling.carbupbeta;
+
+import android.app.Application;
+import android.test.ApplicationTestCase;
+
+/**
+ * Testing Fundamentals
+ */
+public class ApplicationTest extends ApplicationTestCase {
+ public ApplicationTest() {
+ super(Application.class);
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
new file mode 100755
index 0000000..edc1a42
--- /dev/null
+++ b/app/src/main/AndroidManifest.xml
@@ -0,0 +1,51 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/java/com/hyperling/carbupbeta/DALIH.java b/app/src/main/java/com/hyperling/carbupbeta/DALIH.java
new file mode 100755
index 0000000..2d7d763
--- /dev/null
+++ b/app/src/main/java/com/hyperling/carbupbeta/DALIH.java
@@ -0,0 +1,573 @@
+package com.hyperling.carbupbeta;
+
+import android.content.Context;
+import android.database.Cursor;
+import android.database.SQLException;
+import android.database.sqlite.SQLiteDatabase;
+import android.database.sqlite.SQLiteOpenHelper;
+
+import java.util.ArrayList;
+
+/**
+ * Created by usb on 12/24/14.
+ */
+
+// Database And ListItem Helper
+public class DALIH extends SQLiteOpenHelper{
+ public final boolean DEBUG = false;
+
+ // SQL objects
+ private static final String DB_NAME = "CARBUP.db";
+
+ private static final String list_table = "list"; // Saved List Table name (EX: 01, Schnuck's beans)
+ private static final String item_table = "item"; // Saved Item Table name (EG: 01, red beans, 70 carbs, 200 calories, etc)
+ private static final String setting_table = "settings";
+
+ private static final String list_id_col = "list_id";
+ private static final String list_name_col = "list_name";
+
+ private static final String item_id_col = "item_id";
+ private static final String item_name_col = "item_name";
+ private static final String item_cost_col = "cost";
+ private static final String item_servings_col = "servings";
+ private static final String item_calories_col = "calories";
+ private static final String item_carbs_col = "carbs";
+ private static final String item_fiber_col = "fiber";
+ private static final String item_list_id_col = list_id_col;
+
+ private static final String setting_last_list_col = "last_list";
+ private static final String setting_last_item_col = "last_item";
+ private static final String setting_ads_enabled_col = "ads_enabled";
+ private static final String setting_quick_load_col = "quick_load";
+ private static final String setting_open_tab_col = "open_tab";
+ private static final int settings_total = 5;
+ private static final int setting_last_list_index = 0;
+ private static final int setting_last_item_index = 1;
+ private static final int setting_ads_enabled_index = 2;
+ private static final int setting_quick_load_index = 3;
+ private static final int setting_open_tab_index = 4;
+ private static final int setting_last_list_default = -1;
+ private static final int setting_last_item_default = -1;
+ private static final int setting_ads_enabled_default = 1;
+ private static final int setting_quick_load_default = 0;
+ private static final int setting_open_tab_default = 1;
+
+ private static final String CREATESLTABLE = "CREATE TABLE " + list_table + "(" +
+ list_id_col + " INTEGER PRIMARY KEY AUTOINCREMENT, " +
+ list_name_col + " TEXT NOT NULL" +
+ "); ";
+
+ private static final String CREATESITABLE = "" +
+ "CREATE TABLE " + item_table + "( " +
+ item_id_col + " INTEGER PRIMARY KEY AUTOINCREMENT, " +
+ item_name_col + " TEXT NOT NULL, " +
+ item_cost_col + " REAL NOT NULL, " +
+ item_servings_col + " REAL NOT NULL, " +
+ item_calories_col + " REAL NOT NULL, " +
+ item_carbs_col + " REAL NOT NULL, " +
+ item_fiber_col + " REAL DEFAULT 0, " +
+ item_list_id_col + " INTEGER NOT NULL, " +
+ "FOREIGN KEY (" + item_list_id_col + ") REFERENCES " + list_table + "(" + list_id_col + ") ON DELETE CASCADE" +
+ "); ";
+
+ private static final String CREATESETTINGTABLE = "" +
+ "CREATE TABLE " + setting_table + "( " +
+ " " + setting_last_list_col + " INTEGER NOT NULL, " +
+ " " + setting_last_item_col + " INTEGER NOT NULL, " +
+ " " + setting_ads_enabled_col + " INTEGER NOT NULL, " +
+ " " + setting_quick_load_col + " INTEGER NOT NULL, " +
+ " " + setting_open_tab_col + " INTEGER NOT NULL " +
+ "); ";
+
+
+ SQLiteDatabase db;
+
+ public DALIH(Context context){
+ //4, add fiber column to list_item
+ super(context, DB_NAME, null, 4);
+ return;
+ }
+
+ // Open the database
+ public void open() throws SQLException{
+ if (DEBUG) System.out.println("Opening DB");
+
+ db = getWritableDatabase();
+ return;
+ }
+
+ // Close the database
+ public void close(){
+ if (DEBUG) System.out.println("Closing DB");
+
+ super.close();
+ return;
+ }
+
+ // Insert a ListItem into the DB
+ public void insertItem(ListItemInfo listItem){
+ if (DEBUG) System.out.println("Inserting item: " + listItem.getID() + " " + listItem.getName());
+
+ String query = "" +
+ "INSERT INTO "+item_table+"("+item_name_col+", "+item_cost_col+", "+item_calories_col+", " +
+ " "+item_carbs_col+", "+item_servings_col+", "+item_list_id_col+", " +
+ " "+item_fiber_col+") " +
+ "VALUES(\""+listItem.getName()+"\", "+listItem.getCost()+", "+listItem.getCalories()+", " +
+ " "+listItem.getCarbs()+", "+listItem.getServings()+", "+listItem.getListID() + ", " +
+ " "+listItem.getFiber()+"); ";
+
+ doQuery(query);
+ return;
+ }
+
+ public void updateItem(ListItemInfo listItem){
+ if (DEBUG) System.out.println("Updating item: " + listItem.getID() + " " + listItem.getName());
+
+ String query = "" +
+ "UPDATE "+item_table+" " +
+ " SET "+item_name_col+" = \""+listItem.getName()+"\", " +
+ " "+item_cost_col+" = "+listItem.getCost()+", " +
+ " "+item_calories_col+" = "+listItem.getCalories()+", " +
+ " "+item_carbs_col+" = "+listItem.getCarbs()+", " +
+ " "+item_servings_col+" = "+listItem.getServings()+", " +
+ " "+item_fiber_col+" = "+listItem.getFiber()+", " +
+ " "+item_list_id_col+" = "+listItem.getListID()+" " +
+ " WHERE "+item_id_col+" = "+listItem.getID() + "; ";
+
+ doQuery(query);
+ return;
+ }
+
+ // Remove a ListItem from the DB
+ public void deleteItem(ListItemInfo listItem){
+ if (DEBUG) System.out.println("Deleting item: " + listItem.getID() + " " + listItem.getName());
+
+ String query = "" +
+ "DELETE FROM "+item_table+" " +
+ " WHERE "+item_id_col+" = "+listItem.getID() + "; ";
+
+ doQuery(query);
+ return;
+ }
+
+ // This method will give tab2 current List's items to sort through
+ public ArrayList getItems(int list_id){
+ ArrayList items = new ArrayList();
+
+ String query = "" +
+ "SELECT "+item_id_col+", " +
+ " "+item_name_col+", " +
+ " "+item_cost_col+", " +
+ " "+item_servings_col+", " +
+ " "+item_calories_col+", " +
+ " "+item_carbs_col+", " +
+ " "+item_fiber_col+", " +
+ " "+item_list_id_col+" " +
+ " FROM "+item_table+" " +
+ " WHERE "+item_list_id_col+" = "+list_id+"; ";
+
+ if (DEBUG) System.out.println("Getting all items\n" + query);
+
+ Cursor c = db.rawQuery(query, null);
+
+ if (DEBUG) System.out.println("Cursor size: " + c.getCount());
+
+ c.moveToFirst();
+ while(!c.isAfterLast()){
+ ListItemInfo temp = new ListItemInfo();
+
+ temp.setID(c.getInt(0));
+ temp.setName(c.getString(1));
+ temp.setCost(c.getDouble(2));
+ temp.setServings(c.getDouble(3));
+ temp.setCalories(c.getDouble(4));
+ temp.setCarbs(c.getDouble(5));
+ temp.setFiber(c.getDouble(6));
+ temp.setListID(c.getInt(7));
+
+ items.add(temp);
+ c.moveToNext();
+ }
+ c.close();
+
+ return items;
+ }
+
+ public void insertList(ListInfo list){
+ if (DEBUG) System.out.println("Inserting list: " + list.getID() + " " + list.getName());
+
+ String query = "" +
+ "INSERT INTO "+list_table+"("+list_name_col+") " +
+ "VALUES(\""+list.getName()+"\"); ";
+
+ doQuery(query);
+ return;
+ }
+
+ public void updateList(ListInfo list){
+ if (DEBUG) System.out.println("Updating list: " + list.getID() + " " + list.getName());
+
+ String query = "" +
+ "UPDATE "+list_table+" " +
+ " SET "+list_name_col+" = \""+list.getName()+"\" " +
+ " WHERE "+list_id_col+" = "+list.getID()+"; ";
+
+ doQuery(query);
+ return;
+ }
+
+ public void deleteList(ListInfo list){
+ if (DEBUG) System.out.println("Deleting list: " + list.getID() + " " + list.getName());
+
+ String query = "" +
+ "DELETE FROM "+list_table+" " +
+ " WHERE "+list_id_col+" = "+list.getID()+"; ";
+
+ doQuery(query);
+
+ return;
+ }
+
+ public ArrayList getLists(){
+ // Return ALL lists in an ArrayList
+ ArrayList lists = new ArrayList();
+
+ String query = "" +
+ "SELECT "+list_id_col+", " +
+ " "+list_name_col+" " +
+ " FROM "+list_table+"; ";
+
+ if (DEBUG) System.out.println("Getting all lists\n" + query);
+
+ Cursor c = db.rawQuery(query, null);
+
+ if (DEBUG) System.out.println("Cursor size: " + c.getCount());
+
+ c.moveToFirst();
+ while(!c.isAfterLast()){
+ ListInfo temp = new ListInfo();
+
+ temp.setID(c.getInt(0));
+ temp.setName(c.getString(1));
+
+ lists.add(temp);
+
+ c.moveToNext();
+ }
+ c.close();
+
+ return lists;
+ }
+
+ private void setSettings(int[] settings){
+ if (DEBUG) System.out.println("Setting settings");
+
+ int last_list = settings[getLastListIndex()];
+ int last_item = settings[getLastItemIndex()];
+ int ads_enabled = settings[getAdsEnabledIndex()];
+ int quick_load = settings[getQuickLoadIndex()];
+ int open_tab = settings[getOpenTabIndex()];
+ String query = "" +
+ "UPDATE "+setting_table+"" +
+ " SET "+setting_last_list_col+" = "+last_list+", " +
+ " "+setting_last_item_col+" = "+last_item+", " +
+ " "+setting_ads_enabled_col+" = "+ads_enabled+", " +
+ " "+setting_quick_load_col+" = "+quick_load+", " +
+ " "+setting_open_tab_col+" = "+open_tab+"; ";
+
+ doQuery(query);
+ return;
+ }
+
+ private int[] getSettings(){
+ if (DEBUG) System.out.println("Getting settings");
+
+ String query = "" +
+ "SELECT "+setting_last_list_col+", " +
+ " "+setting_last_item_col+", " +
+ " "+setting_ads_enabled_col+", " +
+ " "+setting_quick_load_col+", " +
+ " "+setting_open_tab_col+" " +
+ " FROM "+setting_table+"; ";
+
+ int[] settings = null;
+ Cursor c = db.rawQuery(query, null);
+
+ if (DEBUG) System.out.println("Cursor size: " + c.getCount());
+
+ if (c.getCount() == 0){
+ setDefaults();
+
+ settings = new int[settings_total];
+ settings[getLastListIndex()] = setting_last_list_default;
+ settings[getLastItemIndex()] = setting_last_item_default;
+ settings[getAdsEnabledIndex()] = setting_ads_enabled_default;
+ settings[getQuickLoadIndex()] = setting_quick_load_default;
+ settings[getOpenTabIndex()] = setting_open_tab_default;
+ }
+ else {
+ if (DEBUG) System.out.println("Reading settings\n" + query);
+
+ c.moveToFirst();
+ while (!c.isAfterLast()) {
+ settings = new int[settings_total];
+ settings[getLastListIndex()] = c.getInt(0);
+ settings[getLastItemIndex()] = c.getInt(1);
+ settings[getAdsEnabledIndex()] = c.getInt(2);
+ settings[getQuickLoadIndex()] = c.getInt(3);
+ settings[getOpenTabIndex()] = c.getInt(4);
+ c.moveToNext();
+ }
+ }
+ c.close();
+
+ return settings;
+ }
+
+ private void setDefaults(){
+ if (DEBUG) System.out.println("Setting default settings");
+
+ String query = "" +
+ "INSERT INTO " + setting_table + "("+setting_last_list_col+", "+setting_last_item_col+", " +
+ " "+setting_ads_enabled_col+", "+setting_quick_load_col+", " +
+ " "+setting_open_tab_col+") " +
+ "VALUES("+setting_last_list_default+", "+setting_last_item_default+", " +
+ " "+setting_ads_enabled_default+", "+setting_quick_load_default+", " +
+ " "+setting_open_tab_default+"); ";
+
+ doQuery(query);
+ return;
+ }
+
+ private int getLastListIndex(){
+ if (DEBUG) System.out.println("Getting last list index");
+
+ return setting_last_list_index;
+ }
+
+ private int getLastItemIndex(){
+ if (DEBUG) System.out.println("Getting last item index");
+
+ return setting_last_item_index;
+ }
+
+ private int getAdsEnabledIndex(){
+ if (DEBUG) System.out.println("Getting ads enabled index");
+
+ return setting_ads_enabled_index;
+ }
+
+ private int getQuickLoadIndex(){
+ if (DEBUG) System.out.println("Getting quick load index");
+
+ return setting_quick_load_index;
+ }
+
+ private int getOpenTabIndex(){
+ if (DEBUG) System.out.println("Getting open tab index");
+
+ return setting_open_tab_index;
+ }
+
+ public int getLastList(){
+ if (DEBUG) System.out.println("Getting last list");
+
+ int[] settings = getSettings();
+
+ return settings[getLastListIndex()];
+ }
+
+ public void setLastList(int lastList){
+ if (DEBUG) System.out.println("Setting last list to " + lastList);
+
+ int[] settings = getSettings();
+
+ settings[getLastListIndex()] = lastList;
+
+ setSettings(settings);
+ return;
+ }
+
+ public void setLastList(){
+ if (DEBUG) System.out.println("Setting last list to default, " + setting_last_list_default);
+
+ int[] settings = getSettings();
+
+ settings[getLastListIndex()] = setting_last_list_default;
+
+ setSettings(settings);
+ return;
+ }
+
+ public int getLastItem(){
+ if (DEBUG) System.out.println("Getting last item");
+
+ int[] settings = getSettings();
+
+ return settings[getLastItemIndex()];
+ }
+
+ public void setLastItem(int lastItem){
+ if (DEBUG) System.out.println("Setting last item to " + lastItem);
+
+ int[] settings = getSettings();
+
+ settings[getLastItemIndex()] = lastItem;
+
+ setSettings(settings);
+ return;
+ }
+
+ public void setLastItem(){
+ if (DEBUG) System.out.println("Setting last item to default, " + setting_last_item_default);
+
+ int[] settings = getSettings();
+
+ settings[getLastItemIndex()] = setting_last_item_default;
+
+ setSettings(settings);
+ return;
+ }
+
+ public boolean getAdsEnabled(){
+ if (DEBUG) System.out.println("Getting ads enabled");
+
+ int[] settings = getSettings();
+
+ return (settings[getAdsEnabledIndex()] > 0);
+ }
+
+ public void setAdsEnabled(boolean adsEnabled){
+ if (DEBUG) System.out.println("Setting ads enabled to " + adsEnabled);
+
+ int[] settings = getSettings();
+
+ int setting;
+ if (adsEnabled){
+ setting = 1;
+ }
+ else{
+ setting = 0;
+ }
+
+ settings[getAdsEnabledIndex()] = setting;
+
+ setSettings(settings);
+ return;
+ }
+
+ public boolean getQuickLoad(){
+ if (DEBUG) System.out.println("Getting quick load");
+
+ int[] settings = getSettings();
+
+ return (settings[getQuickLoadIndex()] > 0);
+ }
+
+ public void setQuickLoad(boolean quickLoad){
+ if (DEBUG) System.out.println("Setting quick load to " + quickLoad);
+
+ int[] settings = getSettings();
+
+ int setting;
+ if (quickLoad){
+ setting = 1;
+ }
+ else{
+ setting = 0;
+ }
+
+ settings[getQuickLoadIndex()] = setting;
+
+ setSettings(settings);
+ return;
+ }
+
+ public int getOpenTab(){
+ if (DEBUG) System.out.println("Getting quick load");
+
+ int[] settings = getSettings();
+
+ return settings[getOpenTabIndex()];
+ }
+
+ public void setOpenTab(int tab){
+ if (DEBUG) System.out.println("Setting open tab to " + tab);
+
+ int[] settings = getSettings();
+
+ settings[getOpenTabIndex()] = tab;
+
+ setSettings(settings);
+ return;
+ }
+
+ private void doQuery(String query){
+ if (DEBUG) System.out.println("Executing SQL:\n" + query);
+
+ db.execSQL(query);
+ return;
+ }
+
+ public String filterString(String input){
+ if (DEBUG) System.out.println("Filtering string: " + input);
+ String output = input.trim().replace("\"","").replace("\n", "").replace("\b", "").replace("\t", "");
+ while(output.contains(" ")){
+ if (DEBUG) System.out.println("In the space killer loop: " + output);
+ output = output.replace(" ", " ");
+ }
+ return output;
+ }
+
+ private void printDML(){
+ System.out.println();
+ System.out.println(CREATESLTABLE);
+ System.out.println();
+ System.out.println(CREATESITABLE);
+ System.out.println();
+ System.out.println(CREATESETTINGTABLE);
+ System.out.println();
+ return;
+ }
+
+ @Override
+ public void onCreate(SQLiteDatabase database) {
+ if (DEBUG){
+ System.out.println("Creating the DB");
+ printDML();
+ }
+
+ database.execSQL(CREATESLTABLE);
+ database.execSQL(CREATESITABLE);
+ database.execSQL(CREATESETTINGTABLE);
+ return;
+ }
+
+ @Override
+ public void onUpgrade(SQLiteDatabase database, int oldVersion, int newVersion) {
+ if (DEBUG) System.out.println("Upgrading the DB");
+
+ switch(oldVersion){
+ case 2:
+ if (DEBUG) System.out.println("UPGRADING TO DBv3");
+ String DBv3 = "" +
+ " ALTER TABLE "+setting_table+" " +
+ " ADD "+setting_open_tab_col+" INTEGER; " +
+ "" +
+ "UPDATE TABLE "+setting_table+" " +
+ " SET "+setting_open_tab_col+" = "+setting_open_tab_default+"; " +
+ "" +
+ " ALTER TABLE "+setting_table+" " +
+ " ALTER COLUMN "+setting_open_tab_col+" INTEGER NOT NULL; ";
+ database.execSQL(DBv3);
+ case 3:
+ if (DEBUG) System.out.println("UPGRADING TO DBv4");
+ String DBv4 = "" +
+ " ALTER TABLE "+item_table+" " +
+ " ADD "+item_fiber_col+" REAL DEFAULT 0; ";
+ database.execSQL(DBv4);
+
+ }
+ return;
+ }
+}
diff --git a/app/src/main/java/com/hyperling/carbupbeta/Home.java b/app/src/main/java/com/hyperling/carbupbeta/Home.java
new file mode 100755
index 0000000..87afa90
--- /dev/null
+++ b/app/src/main/java/com/hyperling/carbupbeta/Home.java
@@ -0,0 +1,100 @@
+package com.hyperling.carbupbeta;
+
+import android.content.Intent;
+import android.content.res.Resources;
+import android.os.Build;
+import android.os.Bundle;
+import android.app.Activity;
+import android.support.v7.app.AppCompatActivity;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.view.View;
+import android.widget.Button;
+import android.widget.Toast;
+
+import com.google.android.gms.ads.AdRequest;
+import com.google.android.gms.ads.AdView;
+
+public class Home extends AppCompatActivity {
+
+ Resources recs;
+
+ Button btnCarbCalc, btnCalcHelp, btnWhyHCLF, btnWhyVegan;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_home);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ // Set up variables
+ recs = getResources();
+ ////////////////////////////////////////////////////////////////////////////////////////////
+
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ // Set up views
+ btnCarbCalc = (Button) findViewById(R.id.btnCarbCalc);
+ btnCalcHelp = (Button) findViewById(R.id.btnCalcHelp);
+ btnWhyHCLF = (Button) findViewById(R.id.btnWhyHCLF);
+ btnWhyVegan = (Button) findViewById(R.id.btnWhyVegan);
+ ////////////////////////////////////////////////////////////////////////////////////////////
+
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ // Set up button click listeners
+ btnCarbCalc.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ startActivity(new Intent(Home.this, Main.class));
+ }
+ });
+
+ btnCalcHelp = (Button) findViewById(R.id.btnCalcHelp);
+
+ btnWhyHCLF = (Button) findViewById(R.id.btnWhyHCLF);
+
+ btnWhyVegan = (Button) findViewById(R.id.btnWhyVegan);
+ ////////////////////////////////////////////////////////////////////////////////////////////
+
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ // Finally, load ads >:)
+ if (Build.VERSION.SDK_INT >= 9) {
+ // Load an ad into the AdMob banner view.
+ AdView adView = (AdView) findViewById(R.id.adViewHome);
+ AdRequest adRequest = new AdRequest.Builder()
+ .addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
+ .addTestDevice("C6A494DC6E7C9AC29102694D48487084") // nexus 7
+ .addTestDevice("B8B7561B850A9AB24E0D5B560FC50628") // Moto G
+ .addTestDevice("") // Cappy, even though it doesn't support ads
+ .setRequestAgent("android_studio:ad_template")
+ .build();
+ adView.loadAd(adRequest);
+ }
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ }
+
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ // Inflate the menu; this adds items to the action bar if it is present.
+ getMenuInflater().inflate(R.menu.menu_home, menu);
+ return true;
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ // Handle action bar item clicks here. The action bar will
+ // automatically handle clicks on the Home/Up button, so long
+ // as you specify a parent activity in AndroidManifest.xml.
+ int id = item.getItemId();
+
+ if (id == R.id.action_exit) {
+ finish();
+ return false;
+ }
+
+ return super.onOptionsItemSelected(item);
+ }
+
+}
diff --git a/app/src/main/java/com/hyperling/carbupbeta/List.java b/app/src/main/java/com/hyperling/carbupbeta/List.java
new file mode 100755
index 0000000..31103ea
--- /dev/null
+++ b/app/src/main/java/com/hyperling/carbupbeta/List.java
@@ -0,0 +1,125 @@
+package com.hyperling.carbupbeta;
+
+import android.content.Context;
+import android.graphics.Color;
+import android.widget.LinearLayout;
+import android.widget.LinearLayout.LayoutParams;
+import android.view.WindowManager;
+import android.widget.Button;
+
+/**
+ * Created by ling on 12/31/15.
+ */
+public class List extends ListInfo{
+
+ LinearLayout linearLayout;
+ Button btnDelete, btnEdit, btnItem;
+
+ private DALIH dalih;
+
+ private int textSize;
+
+ public List(Context context, ListInfo listInfo){
+ // Set attributes
+ setID(listInfo.getID());
+
+ dalih = new DALIH(context);
+
+ // Instantiate the Views
+ linearLayout = new LinearLayout(context);
+ btnDelete = new Button(context);
+ btnEdit = new Button(context);
+ btnItem = new Button(context);
+
+ // Give the views their required attributes (Wrap Content)
+ LinearLayout.LayoutParams lay_lp = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
+ LinearLayout.LayoutParams delete_lp = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT);
+ LinearLayout.LayoutParams edit_lp = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT);
+ LinearLayout.LayoutParams item_lp = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
+
+ lay_lp.setMargins(1, 1, 1, 1);
+ linearLayout.setLayoutParams(lay_lp);
+ linearLayout.setPadding(1, 1, 1, 1);
+
+ delete_lp.setMargins(1, 1, 1, 1);
+ btnDelete.setLayoutParams(delete_lp);
+
+ edit_lp.setMargins(1, 1, 1, 1);
+ btnEdit.setLayoutParams(edit_lp);
+
+ item_lp.setMargins(1, 1, 1, 1);
+ btnItem.setLayoutParams(item_lp);
+
+ // Add the values to the buttons
+ btnDelete.setText(R.string.delete_button); // TODO: Make this an image
+ btnEdit.setText(R.string.edit_button); // TODO: Make this a pencil image
+ setName(listInfo.getName());
+
+ // ========== Style the buttons ==========
+ // Color!
+ linearLayout.setBackgroundColor(Color.BLACK);
+ btnDelete.setBackgroundColor(Color.LTGRAY);
+ btnDelete.setTextColor(Color.BLACK);
+ btnEdit.setBackgroundColor(Color.LTGRAY);
+ btnEdit.setTextColor(Color.BLACK);
+ btnItem.setBackgroundColor(Color.WHITE);
+ btnItem.setTextColor(getRandomColor());
+ // Size!
+ //textSize = ((WindowManager) context.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay().getWidth()/30;
+ btnDelete.setTextSize(16); //textSize-10);
+ btnEdit.setTextSize(16); //textSize-10);
+ btnItem.setTextSize(18); //textSize-6);
+
+ // Add the buttons to the layout!
+ linearLayout.addView(btnDelete);
+ linearLayout.addView(btnEdit);
+ linearLayout.addView(btnItem);
+ }
+
+ public LinearLayout getView(){
+ return linearLayout;
+ }
+
+ @Override
+ public void setName(String name){
+ super.setName(name);
+ btnItem.setText(getName());
+ }
+
+ public int getRandomColor(){
+ // Make negative to turn feature off
+ int choice = (int) (Math.random()*12); // Highest case + 2 includes default
+
+ //if (dalih.DEBUG) System.out.println(getName() + " is color " + choice);
+
+ switch(choice){
+ // Random assortment of colors
+ case 0: return Color.rgb(250, 0, 0); // red
+ case 1: return Color.rgb(250, 150, 0); // orange
+ case 2: return Color.rgb(200, 200, 0); // yellow
+ case 3: return Color.rgb(0, 250, 0); // green
+ case 4: return Color.rgb(0, 150, 250); // aqua
+ case 5: return Color.rgb(0, 0, 250); // blue
+ case 6: return Color.rgb(150, 0, 250); // soft purple
+ case 7: return Color.rgb(200, 0, 200); // purple
+
+ // Unused colors
+ //case 8: return Color.rgb(0, 250, 250); // cyan
+ case 9: return Color.rgb(125, 250, 0); // lime
+ case 10: return Color.rgb(0, 250, 125); // turqoise?
+ case 11: return Color.rgb(250, 0, 125); // magenta
+
+ // Shades of grey
+ //case 12: return Color.rgb(200, 200, 200); // light grey
+ case 8: return Color.rgb(100, 100, 100); // dark grey
+
+ // Possible theme?
+ case 69: return Color.rgb(250, 250, 0); // yellow
+ case 70: return Color.rgb(125, 0, 250); // purple
+
+ // Catch
+ default: return Color.BLACK;
+ }
+ }
+
+}
diff --git a/app/src/main/java/com/hyperling/carbupbeta/ListInfo.java b/app/src/main/java/com/hyperling/carbupbeta/ListInfo.java
new file mode 100755
index 0000000..0c2affc
--- /dev/null
+++ b/app/src/main/java/com/hyperling/carbupbeta/ListInfo.java
@@ -0,0 +1,26 @@
+package com.hyperling.carbupbeta;
+
+/**
+ * Created by ling on 12/31/15.
+ */
+public class ListInfo {
+
+ private String name;
+ private int ID;
+
+ public String getName(){
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public int getID() {
+ return ID;
+ }
+
+ public void setID(int ID) {
+ this.ID = ID;
+ }
+}
diff --git a/app/src/main/java/com/hyperling/carbupbeta/ListItem.java b/app/src/main/java/com/hyperling/carbupbeta/ListItem.java
new file mode 100755
index 0000000..b57bc57
--- /dev/null
+++ b/app/src/main/java/com/hyperling/carbupbeta/ListItem.java
@@ -0,0 +1,151 @@
+package com.hyperling.carbupbeta;
+
+import android.content.Context;
+import android.graphics.Color;
+import android.widget.LinearLayout;
+import android.view.WindowManager;
+import android.widget.Button;
+import android.widget.LinearLayout.LayoutParams;
+
+import java.text.DecimalFormat;
+
+/**
+ * Created by usb on 9/28/14.
+ */
+public class ListItem extends ListItemInfo {
+
+ private double calPerDol, carbPerCal;
+
+ LinearLayout linearLayout;
+ Button btnDelete, btnEdit, btnItem;
+
+ private int textSize;
+
+ public ListItem(Context context, ListItemInfo listItemInfo){
+
+ // Instantiate the Views
+ linearLayout = new LinearLayout(context);
+ btnDelete = new Button(context);
+ btnEdit = new Button(context);
+ btnItem = new Button(context);
+
+ setID(listItemInfo.getID());
+ setName(listItemInfo.getName());
+ setCost(listItemInfo.getCost());
+ setServings(listItemInfo.getServings());
+ setCalories(listItemInfo.getCalories());
+ setCarbs(listItemInfo.getCarbs());
+ setFiber(listItemInfo.getFiber());
+ calPerDol = getCalPerDol();
+ carbPerCal = getCarbPerCal();
+
+ // Give the views their required attributes (Wrap Content)
+ LinearLayout.LayoutParams lay_lp = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
+ LinearLayout.LayoutParams delete_lp = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT);
+ LinearLayout.LayoutParams edit_lp = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT);
+ LinearLayout.LayoutParams item_lp = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
+
+ lay_lp.setMargins(1, 1, 1, 1);
+ linearLayout.setLayoutParams(lay_lp);
+ linearLayout.setPadding(1, 1, 1, 1);
+
+ delete_lp.setMargins(1, 1, 1, 1);
+ btnDelete.setLayoutParams(delete_lp);
+
+ edit_lp.setMargins(1, 1, 1, 1);
+ btnEdit.setLayoutParams(edit_lp);
+
+ item_lp.setMargins(1, 1, 1, 1);
+ btnItem.setLayoutParams(item_lp);
+
+ // Load values
+ btnDelete.setText(R.string.delete_button); // TODO: Make this an image?
+ btnEdit.setText(R.string.edit_button); // TODO: Make this a pencil?
+ setName(listItemInfo.getName ());
+
+ // ========== Style the buttons ==========
+ // Color!
+ linearLayout.setBackgroundColor(Color.BLACK);
+ btnDelete.setBackgroundColor(Color.LTGRAY);
+ btnDelete.setTextColor(Color.BLACK);
+ btnEdit.setBackgroundColor(Color.LTGRAY);
+ btnEdit.setTextColor(Color.BLACK);
+ btnItem.setBackgroundColor(Color.WHITE);
+ int[] colors = getColors(carbPerCal);
+ btnItem.setTextColor(Color.rgb(colors[0], colors[1], colors[2]));
+ // Size!
+ //textSize = ((WindowManager) context.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay().getWidth()/30;
+ btnDelete.setTextSize(16); //textSize-10);
+ btnEdit.setTextSize(16); //textSize-10);
+ btnItem.setTextSize(16); //textSize-8);
+
+ // Add the buttons to the layout!
+ linearLayout.addView(btnDelete);
+ linearLayout.addView(btnEdit);
+ linearLayout.addView(btnItem);
+ }
+
+ public LinearLayout getView(){
+ return linearLayout;
+ }
+
+ public int[] getColors(double carbPerCal){
+ int r, g, b;
+ b = 0;
+
+ // Find the ratio
+ double dRed = 1-carbPerCal;
+ double dGreen = carbPerCal;
+
+ // Find which is larger
+ double max;
+ if (dGreen > dRed){
+ max = dGreen;
+ } else {
+ max = dRed;
+ }
+
+ // Find the secret number (diff)
+ double diff = 1 - max;
+
+ // Brighten the colors with diff!
+ dRed += diff;
+ dGreen += diff;
+
+ // Bring the colors into spectrum!
+ dRed *= 255;
+ dGreen *= 255;
+
+ // Make the numbers integers, increase to color spectrum
+ r = (int) dRed;
+ g = (int) dGreen;
+
+ // Put them in an array to pack and ship away
+ int[] colors = {r, g, b};
+
+ if(carbPerCal >= 1){
+ colors = new int[] {0, 255, 0};
+ }
+
+ return colors;
+ }
+
+ public double getCalPerDol(){
+ // Total calories divided by $$$
+ return (getCalories()*getServings())/getCost();
+ }
+
+ public double getCarbPerCal(){
+ // Calories from carbs divided by calories from all sources
+ return ((getCarbs()-getFiber())*4)/getCalories();
+ }
+
+ @Override
+ public void setName(String name){
+ super.setName(name);
+ DecimalFormat format = new DecimalFormat("#.##");
+ String strCalPerDol = format.format(calPerDol);
+ strCalPerDol = getName() + "\n" + strCalPerDol + "Cal/$ " + format.format(carbPerCal * 100) + "%Carbs";
+ btnItem.setText(strCalPerDol);
+ }
+}
diff --git a/app/src/main/java/com/hyperling/carbupbeta/ListItemInfo.java b/app/src/main/java/com/hyperling/carbupbeta/ListItemInfo.java
new file mode 100755
index 0000000..0f99e4b
--- /dev/null
+++ b/app/src/main/java/com/hyperling/carbupbeta/ListItemInfo.java
@@ -0,0 +1,78 @@
+package com.hyperling.carbupbeta;
+
+/**
+ * Created by usb on 1/4/15.
+ */
+public class ListItemInfo {
+ private String name;
+ private int ID, ListID;
+ private double cost;
+ private double servings;
+ private double calories;
+ private double carbs;
+ private double fiber;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public int getID() {
+ return ID;
+ }
+
+ public void setID(int ID) {
+ this.ID = ID;
+ }
+
+ public int getListID() {
+ return ListID;
+ }
+
+ public void setListID(int listID) {
+ ListID = listID;
+ }
+
+ public double getCost() {
+ return cost;
+ }
+
+ public void setCost(double cost) {
+ this.cost = cost;
+ }
+
+ public double getServings() {
+ return servings;
+ }
+
+ public void setServings(double servings) {
+ this.servings = servings;
+ }
+
+ public double getCalories() {
+ return calories;
+ }
+
+ public void setCalories(double calories) {
+ this.calories = calories;
+ }
+
+ public double getCarbs() {
+ return carbs;
+ }
+
+ public void setCarbs(double carbs) {
+ this.carbs = carbs;
+ }
+
+ public double getFiber() {
+ return fiber;
+ }
+
+ public void setFiber(double fiber) {
+ this.fiber = fiber;
+ }
+}
diff --git a/app/src/main/java/com/hyperling/carbupbeta/Main.java b/app/src/main/java/com/hyperling/carbupbeta/Main.java
new file mode 100755
index 0000000..e4da804
--- /dev/null
+++ b/app/src/main/java/com/hyperling/carbupbeta/Main.java
@@ -0,0 +1,109 @@
+package com.hyperling.carbupbeta;
+
+import android.app.TabActivity;
+import android.content.Intent;
+import android.os.Build;
+import android.os.Bundle;
+import android.view.WindowManager;
+import android.widget.TabHost;
+
+import java.util.ArrayList;
+
+/**
+ * Created by usb on 9/29/14.
+ */
+public class Main extends TabActivity {
+
+ private DALIH dalih;
+
+ ArrayList lists;
+
+ boolean createTab2 = false;
+ int lastList, openTab, textSize;
+ String tab2Name;
+
+ @Override
+ public void onCreate(Bundle savedInstanceState){
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.main);
+ getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
+
+ // Instantiate DALIH
+ dalih = new DALIH(this);
+
+ dalih.open();
+ // THIS IS AN ASSIGNMENT STATEMENT. PLEASE READ IT CORRECTLY. #savecycles
+ if ((lastList = dalih.getLastList()) >= 0) {
+ openTab = dalih.getOpenTab();
+ lists = dalih.getLists();
+ }
+ dalih.close();
+
+ if (lastList >= 0){
+ createTab2 = true;
+
+ for (ListInfo list : lists){
+ if (list.getID() == lastList){
+ tab2Name = list.getName();
+ }
+ }
+ }
+
+ // Init the TabHost
+ TabHost tabHost = getTabHost();
+
+ // Create the tabs
+ // Tab1
+ TabHost.TabSpec createListSpec = tabHost.newTabSpec("Create List");
+ if (Build.VERSION.SDK_INT >= 21) {
+ createListSpec.setIndicator("Choose List", getDrawable(R.drawable.dr_face_straight2_circle));
+ }
+ else{
+ createListSpec.setIndicator("Choose List");
+ }
+ Intent createList = new Intent(this, Tab1.class);
+ createListSpec.setContent(createList);
+ // Add tab to TabHost
+ tabHost.addTab(createListSpec);
+
+ // Tab2
+ if (createTab2) {
+ if (dalih.DEBUG) System.out.println("Creating tab2");
+
+ TabHost.TabSpec createItemsSpec = tabHost.newTabSpec("Create Items");
+ if (Build.VERSION.SDK_INT >= 21) {
+ createItemsSpec.setIndicator(tab2Name);
+ }
+ else{
+ createItemsSpec.setIndicator(tab2Name);
+ }
+ Intent createItems = new Intent(this, Tab2.class);
+ createItemsSpec.setContent(createItems);
+
+ // Add tab to TabHost
+ tabHost.addTab(createItemsSpec);
+ }
+
+ // Settings/About Tab
+ TabHost.TabSpec mySettingsSpec = tabHost.newTabSpec("Settings");
+ if (Build.VERSION.SDK_INT >= 21) {
+ mySettingsSpec.setIndicator("Settings", getDrawable(R.drawable.figsy_grass_circle_small));
+ }
+ else{
+ mySettingsSpec.setIndicator("Settings");
+ }
+ Intent mySettingsList = new Intent(this, MySettings.class);
+ mySettingsSpec.setContent(mySettingsList);
+ // Add tab to TabHost
+ tabHost.addTab(mySettingsSpec);
+
+
+ // BEFORE FINAL, APP SHOULD OPEN ON TAB2
+ //tabHost.setCurrentTab(1);
+ // After app is final, app should open to tab1 if no previous lists exist
+ // Otherwise, the app will open on tab 2 with the last selected list in place
+ if (dalih.DEBUG) System.out.println("Opening tab " + openTab + ", index " + (openTab-1));
+ tabHost.setCurrentTab(openTab-1);
+ return;
+ }
+}
diff --git a/app/src/main/java/com/hyperling/carbupbeta/MySettingInfo.java b/app/src/main/java/com/hyperling/carbupbeta/MySettingInfo.java
new file mode 100755
index 0000000..f0c4377
--- /dev/null
+++ b/app/src/main/java/com/hyperling/carbupbeta/MySettingInfo.java
@@ -0,0 +1,25 @@
+package com.hyperling.carbupbeta;
+
+/**
+ * Created by ling on 1/1/16.
+ */
+public class MySettingInfo {
+ private String name;
+ private boolean enabled;
+
+ public String getName(){
+ return name;
+ }
+
+ public void setName(String name){
+ this.name = name;
+ }
+
+ public boolean getEnabled(){
+ return enabled;
+ }
+
+ public void setEnabled(boolean enabled){
+ this.enabled = enabled;
+ }
+}
diff --git a/app/src/main/java/com/hyperling/carbupbeta/MySettingItem.java b/app/src/main/java/com/hyperling/carbupbeta/MySettingItem.java
new file mode 100755
index 0000000..fe0469f
--- /dev/null
+++ b/app/src/main/java/com/hyperling/carbupbeta/MySettingItem.java
@@ -0,0 +1,108 @@
+package com.hyperling.carbupbeta;
+
+import android.content.Context;
+import android.graphics.Color;
+import android.os.Build;
+import android.view.View;
+import android.widget.LinearLayout;
+import android.widget.LinearLayout.LayoutParams;
+import android.widget.RelativeLayout;
+import android.view.WindowManager;
+import android.widget.Button;
+import android.widget.CheckBox;
+
+/**
+ * Created by ling on 1/1/16.
+ */
+public class MySettingItem extends MySettingInfo{
+
+ private LinearLayout linearLayout;
+ private RelativeLayout relativeLayout;
+ Button btnItem;
+ CheckBox checkBox;
+
+ private int textSize;
+
+ public MySettingItem(Context context, MySettingInfo info){
+ // Instantiate the Views
+ linearLayout = new LinearLayout(context);
+ relativeLayout = new RelativeLayout(context);
+ btnItem = new Button(context);
+ checkBox = new CheckBox(context);
+
+ // Give the views their required attributes (Wrap Content)
+ LayoutParams lay_lp = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
+ LayoutParams rel_lp = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
+ LayoutParams item_lp = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT);
+ RelativeLayout.LayoutParams check_lp = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT);
+
+ lay_lp.setMargins(1, 1, 1, 1);
+ linearLayout.setLayoutParams(lay_lp);
+ linearLayout.setOrientation(LinearLayout.HORIZONTAL);
+
+ relativeLayout.setLayoutParams(rel_lp);
+ if (Build.VERSION.SDK_INT >= 17) {
+ relativeLayout.setHorizontalGravity(RelativeLayout.ALIGN_PARENT_END);
+ }
+ else {
+ relativeLayout.setHorizontalGravity(RelativeLayout.ALIGN_PARENT_RIGHT);
+ }
+
+ btnItem.setLayoutParams(item_lp);
+ checkBox.setLayoutParams(check_lp);
+
+ // Add the values to the buttons
+ setName(info.getName());
+ setEnabled(info.getEnabled());
+
+ // ========== Style the buttons ==========
+ // Color!
+ linearLayout.setBackgroundColor(Color.LTGRAY);
+ relativeLayout.setBackgroundColor(Color.LTGRAY);
+ btnItem.setBackgroundColor(Color.LTGRAY);
+ btnItem.setTextColor(Color.BLACK);
+ // Size!
+ //textSize = ((WindowManager) context.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay().getWidth()/30;
+ btnItem.setTextSize(24); // textSize);
+
+ // Add the items to the layout!
+ relativeLayout.addView(checkBox);
+
+ linearLayout.addView(btnItem);
+ linearLayout.addView(relativeLayout);
+
+ linearLayout.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ if (Build.VERSION.SDK_INT >= 15) {
+ btnItem.callOnClick();
+ }
+ }
+ });
+
+ relativeLayout.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ if (Build.VERSION.SDK_INT >= 15) {
+ btnItem.callOnClick();
+ }
+ }
+ });
+ }
+
+ public LinearLayout getView(){
+ return linearLayout;
+ }
+
+ @Override
+ public void setName(String name){
+ super.setName(name);
+ btnItem.setText(getName());
+ }
+
+ @Override
+ public void setEnabled(boolean enabled){
+ super.setEnabled(enabled);
+ checkBox.setChecked(getEnabled());
+ }
+}
diff --git a/app/src/main/java/com/hyperling/carbupbeta/MySettings.java b/app/src/main/java/com/hyperling/carbupbeta/MySettings.java
new file mode 100755
index 0000000..1722806
--- /dev/null
+++ b/app/src/main/java/com/hyperling/carbupbeta/MySettings.java
@@ -0,0 +1,98 @@
+package com.hyperling.carbupbeta;
+
+import android.app.Activity;
+import android.content.Context;
+import android.os.Build;
+import android.os.Bundle;
+import android.view.View;
+import android.widget.LinearLayout;
+
+/**
+ * Created by ling on 1/1/16.
+ */
+public class MySettings extends Activity {
+
+ private DALIH dalih;
+
+ Context context;
+
+ LinearLayout settingsArea;
+ MySettingItem quickLoad, adsEnabled, rainbowLists, whiteOnBlack;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.my_settings);
+
+ // Set default context
+ context = this;
+
+ // Get DALIH ready to go!
+ dalih = new DALIH(context);
+
+ // Find the layout
+ settingsArea = (LinearLayout) findViewById(R.id.settingsArea);
+
+ // Instantiate settings
+ quickLoad = new MySettingItem(context, new MySettingInfo());
+ adsEnabled = new MySettingItem(context, new MySettingInfo());
+
+ // Name them
+ quickLoad.setName("Quick Load:");
+ adsEnabled.setName("Ads Enabled:");
+
+ // Set the checkboxes
+ dalih.open();
+ quickLoad.setEnabled(dalih.getQuickLoad());
+ adsEnabled.setEnabled(dalih.getAdsEnabled());
+ dalih.close();
+
+ // Set the checkbox actions
+ quickLoad.btnItem.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ dalih.setQuickLoad(!dalih.getQuickLoad());
+ quickLoad.checkBox.setChecked(dalih.getQuickLoad());
+ }
+ });
+ quickLoad.checkBox.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ dalih.setQuickLoad(quickLoad.checkBox.isChecked());
+ }
+ });
+
+ adsEnabled.btnItem.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ dalih.setAdsEnabled(!dalih.getAdsEnabled());
+ adsEnabled.checkBox.setChecked(dalih.getAdsEnabled());
+ }
+ });
+ adsEnabled.checkBox.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ dalih.setAdsEnabled(adsEnabled.checkBox.isChecked());
+ }
+ });
+
+ // Throw them onto the screen
+ settingsArea.addView(quickLoad.getView());
+
+ if (Build.VERSION.SDK_INT >= 9) {
+ settingsArea.addView(adsEnabled.getView());
+ }
+ }
+
+ @Override
+ protected void onResume() {
+ dalih.open();
+ super.onResume();
+ }
+
+ @Override
+ protected void onPause() {
+ dalih.close();
+ super.onPause();
+ }
+}
diff --git a/app/src/main/java/com/hyperling/carbupbeta/Splash.java b/app/src/main/java/com/hyperling/carbupbeta/Splash.java
new file mode 100755
index 0000000..0f1af7a
--- /dev/null
+++ b/app/src/main/java/com/hyperling/carbupbeta/Splash.java
@@ -0,0 +1,66 @@
+package com.hyperling.carbupbeta;
+
+import android.content.Intent;
+import android.app.Activity;
+import android.os.Bundle;
+import android.widget.TextView;
+
+import java.util.Timer;
+import java.util.TimerTask;
+
+//This class is simply the load screen to start Tabs.class
+
+
+public class Splash extends Activity {
+
+ private DALIH dalih;
+
+ TextView txtStatus;
+
+ int loadTime = 3000;
+ int quickTime = 500;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_splash);
+
+ dalih = new DALIH(this);
+
+ // Find the TextViews
+ txtStatus = (TextView) findViewById(R.id.txtLoadStatus);
+
+ // Create the TimerTask to launch main
+ TimerTask timerTask = new TimerTask() {
+ @Override
+ public void run() {
+ startActivity(new Intent(Splash.this, Main.class));
+ //startActivity(new Intent(Splash.this, Home.class));
+ finish();
+ }
+ };
+
+ dalih.open();
+ if (dalih.getQuickLoad()){
+ loadTime = quickTime;
+ }
+ dalih.close();
+
+ //Create and start the timer
+ Timer timer = new Timer();
+ timer.schedule(timerTask, loadTime);
+
+ }
+
+ @Override
+ protected void onResume() {
+ dalih.open();
+ super.onResume();
+ }
+
+ @Override
+ protected void onPause() {
+ dalih.close();
+ super.onPause();
+ }
+}
diff --git a/app/src/main/java/com/hyperling/carbupbeta/Tab1.java b/app/src/main/java/com/hyperling/carbupbeta/Tab1.java
new file mode 100755
index 0000000..416c41b
--- /dev/null
+++ b/app/src/main/java/com/hyperling/carbupbeta/Tab1.java
@@ -0,0 +1,320 @@
+package com.hyperling.carbupbeta;
+
+import android.app.Activity;
+import android.content.Context;
+import android.content.Intent;
+import android.os.Build;
+import android.os.Bundle;
+import android.view.View;
+import android.view.inputmethod.InputMethodManager;
+import android.widget.Button;
+import android.widget.EditText;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import java.util.ArrayList;
+
+import com.google.android.gms.ads.AdRequest;
+import com.google.android.gms.ads.AdView;
+
+/**
+ * Created by usb on 9/28/14.
+ *
+ * This class will:
+ * Create a new list then open tab2
+ */
+
+public class Tab1 extends Activity{
+
+ private DALIH dalih;
+
+ // Layout related
+ Context context;
+ EditText txtList;
+ Button btnCreate;
+ LinearLayout layListArea;
+ TextView tvLeft, tvRight, selectHeader;
+ AdView mAdView;
+
+ // The lists!
+ ArrayList lists = new ArrayList();
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.tab1);
+
+ // Set default context
+ context = this;
+
+ // Initiate DALIH
+ dalih = new DALIH(context);
+
+ // Connect to the layout
+ txtList = (EditText) findViewById(R.id.etListName);
+ btnCreate = (Button) findViewById(R.id.btnAddToList);
+ layListArea = (LinearLayout) findViewById(R.id.tab1ListArea);
+ tvLeft = (TextView) findViewById(R.id.leftEditView);
+ tvRight = (TextView) findViewById(R.id.rightEditView);
+ selectHeader = (TextView) findViewById(R.id.selectListHeader);
+ mAdView = (AdView) findViewById(R.id.adView);
+
+ return;
+ }
+
+ public void setButtonInsert(){
+ btnCreate.setText(R.string.list_create_button_insert);
+ tvLeft.setText("");
+ tvRight.setText("");
+
+ dalih.setLastItem();
+
+ createLists();
+
+ btnCreate.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ ListInfo newList = new ListInfo();
+ newList.setName(dalih.filterString(txtList.getText().toString()));
+
+ if (!testDuplicate(newList)) {
+ if (dalih.DEBUG) System.out.println("List not duplicate, inserting");
+
+ hideKeyboard();
+
+ dalih.insertList(newList);
+
+ createLists();
+
+ dalih.setOpenTab(2);
+ }
+ }
+ });
+
+ return;
+ }
+
+ public void setButtonUpdate(final List list){
+ btnCreate.setText(R.string.list_create_button_update);
+ String editing = getString(R.string.list_editing) + " "; // strings.xml must get trimmed, space is not appearing
+ tvLeft.setText(editing);
+ tvRight.setText(list.getName());
+
+ // Store the ID
+ dalih.setLastItem(list.getID());
+
+ // Recreate the lists
+ createLists();
+
+ // Pull the text
+ txtList.setText(list.getName());
+
+ showKeyboard();
+
+ btnCreate.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ list.setName(dalih.filterString(txtList.getText().toString()));
+
+ if (!testDuplicate(list)) {
+ if (dalih.DEBUG) System.out.println("List not duplicate, updating");
+
+ hideKeyboard();
+
+ dalih.updateList(list);
+
+ if (dalih.getLastList() == list.getID()) {
+ if (dalih.DEBUG) System.out.println("Last list renamed, resetting");
+
+ restart();
+ }
+
+ setButtonInsert();
+ }
+ }
+ });
+
+ return;
+ }
+
+ // Generate all lists and place in alphabetical order
+ private void createLists(){
+ if (dalih.DEBUG) System.out.println("Creating lists for Tab1");
+
+ txtList.setText("");
+
+ lists = new ArrayList();
+
+ for (ListInfo info : dalih.getLists()){
+ if (dalih.DEBUG) System.out.println("Found list: " + info.getID() + " " +info.getName());
+
+ if (info.getID() != dalih.getLastItem()) {
+ lists.add(new List(context, info));
+ }
+ }
+
+ if (lists.size() > 0){
+ selectHeader.setText(R.string.list_select_header);
+ }
+ else{
+ selectHeader.setText("");
+ }
+
+ lists = orderLists(lists);
+
+ layListArea.removeAllViews();
+ for (final List list : lists){
+ list.btnDelete.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ if (dalih.DEBUG) System.out.println("Clicked delete button: " + list.getID() + " " + list.getName());
+
+ dalih.deleteList(list);
+
+ if (dalih.getLastList() == list.getID()){
+ if (dalih.DEBUG) System.out.println("Last list deleted, resetting");
+
+ dalih.setLastList();
+
+ restart();
+ }
+
+ createLists();
+ }
+ });
+
+ list.btnEdit.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ if (dalih.DEBUG) System.out.println("Clicked edit button: " + list.getID() + " " + list.getName());
+
+ // Change to update mode
+ setButtonUpdate(list);
+ }
+ });
+
+ list.btnItem.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ if (dalih.DEBUG) System.out.println("Clicked main button: " + list.getID() + " " + list.getName());
+
+ dalih.setLastList(list.getID());
+
+ dalih.setOpenTab(2);
+
+ //restart();
+ startActivity(new Intent(Tab1.this, Main.class));
+ }
+ });
+
+ if (dalih.DEBUG) System.out.println("Creating list: " + list.getID() + " " + list.getName());
+
+ layListArea.addView(list.getView());
+ }
+
+ return;
+ }
+
+ private ArrayList orderLists(ArrayList unorderedLists){
+ if (dalih.DEBUG) System.out.println("Sorting lists");
+
+ ArrayList orderedLists = new ArrayList<>();
+
+ while (!unorderedLists.isEmpty()) {
+ String bestName = "z";
+ int index = 0;
+
+ for (List list : unorderedLists) {
+ if (list.getName().toUpperCase().compareTo(bestName.toUpperCase()) < 0) {
+ //if (dalih.DEBUG) System.out.println(list.getName() + " is better than " + bestName);
+
+ bestName = list.getName();
+ index = unorderedLists.indexOf(list);
+ }
+ }
+ if (dalih.DEBUG) System.out.println(bestName + " was the best");
+
+ orderedLists.add(unorderedLists.get(index));
+ unorderedLists.remove(index);
+ }
+
+ return orderedLists;
+ }
+
+ private boolean testDuplicate(ListInfo listInfo) {
+ for (List list : lists) {
+ if (listInfo.getName().equals(list.getName()) || listInfo.getName().equals("")) {
+ Toast.makeText(context, "Name must be unique!", Toast.LENGTH_SHORT).show();
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ private void restart(){
+ finish();
+ startActivity(new Intent(Tab1.this, Main.class));
+
+ return;
+ }
+
+ @Override
+ protected void onResume() {
+ if (dalih.DEBUG) System.out.println("***** Resuming Tab1 *****");
+
+ dalih.open();
+
+ if (Build.VERSION.SDK_INT >= 9) {
+ if (dalih.getAdsEnabled()) {
+ if (mAdView.getVisibility() != View.VISIBLE) {
+ AdRequest adRequest = new AdRequest.Builder()
+ .addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
+ .addTestDevice("C6A494DC6E7C9AC29102694D48487084") // nexus 7
+ .addTestDevice("B8B7561B850A9AB24E0D5B560FC50628") // Moto G
+ .addTestDevice("") // Cappy, even though it can't get ads
+ .build();
+ mAdView.setVisibility(View.VISIBLE);
+ mAdView.loadAd(adRequest);
+ }
+ }
+ else{
+ if (mAdView.getVisibility() == View.VISIBLE) {
+ mAdView.setVisibility(View.GONE);
+ }
+ }
+ }
+
+ setButtonInsert();
+
+ super.onResume();
+
+ return;
+ }
+
+ @Override
+ protected void onPause() {
+ if (dalih.DEBUG) System.out.println("***** Pausing Tab1 *****");
+
+ dalih.close();
+
+ hideKeyboard();
+
+ super.onPause();
+
+ return;
+ }
+
+ public void hideKeyboard(){
+ ((InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE)).hideSoftInputFromWindow(btnCreate.getWindowToken(), 0);
+
+ return;
+ }
+
+ public void showKeyboard(){
+ ((InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE)).showSoftInput(txtList, 0);
+
+ return;
+ }
+}
diff --git a/app/src/main/java/com/hyperling/carbupbeta/Tab2.java b/app/src/main/java/com/hyperling/carbupbeta/Tab2.java
new file mode 100755
index 0000000..7167174
--- /dev/null
+++ b/app/src/main/java/com/hyperling/carbupbeta/Tab2.java
@@ -0,0 +1,369 @@
+package com.hyperling.carbupbeta;
+
+import android.app.Activity;
+import android.content.Context;
+import android.os.Build;
+import android.os.Bundle;
+import android.view.View;
+import android.view.inputmethod.InputMethodManager;
+import android.widget.Button;
+import android.widget.EditText;
+import android.widget.LinearLayout;
+import android.widget.Toast;
+
+import com.google.android.gms.ads.AdRequest;
+import com.google.android.gms.ads.AdView;
+
+import java.util.ArrayList;
+
+/**
+ * Created by usb on 9/28/14.
+ *
+ * This class will:
+ * Add items to the current selected list
+ *
+ * DEEMED "GOOD ENOUGH" 13:45 2014-09-30 :D
+ * ListItems are created perfectly, ordered by Cal/$, and colored by Carb/Cal
+ */
+
+public class Tab2 extends Activity{
+
+ private DALIH dalih;
+
+ // Define the Views
+ Context context;
+ LinearLayout layListArea;
+ EditText txtName, txtCost, txtServings, txtCalories, txtCarbs, txtFiber;
+ Button btnClear, btnAdd;
+ AdView mAdView;
+
+ // List
+ ArrayList items = new ArrayList();
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.tab2);
+
+ // Set default context
+ context = this;
+
+ // Initiate DALIH
+ dalih = new DALIH(context);
+
+ // Load/Find the Views!
+ layListArea = (LinearLayout) findViewById(R.id.layTab2ListArea);
+ txtName = (EditText) findViewById(R.id.etItemName);
+ txtCost = (EditText) findViewById(R.id.etItemCost);
+ txtServings = (EditText) findViewById(R.id.etItemServs);
+ txtCalories = (EditText) findViewById(R.id.etItemCals);
+ txtCarbs = (EditText) findViewById(R.id.etItemCarbs);
+ txtFiber = (EditText) findViewById(R.id.etItemFiber);
+ btnClear = (Button) findViewById(R.id.btnClear);
+ btnAdd = (Button) findViewById(R.id.btnAddToList);
+ mAdView = (AdView) findViewById(R.id.adView);
+
+ // Give the Buttons their power
+ btnClear.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+
+ removeItem();
+
+ // Clear all fields!
+ txtName.setText("");
+ txtCost.setText("");
+ txtServings.setText("");
+ txtCalories.setText("");
+ txtCarbs.setText("");
+ txtFiber.setText("");
+
+ setButtonInsert();
+ }
+ });
+
+ return;
+ }// end onCreate
+
+ @Override
+ protected void onResume(){
+ if (dalih.DEBUG) System.out.println("***** Resuming Tab2 *****");
+
+ dalih.open();
+
+ if (Build.VERSION.SDK_INT >= 9) {
+ if (dalih.getAdsEnabled()) {
+ if (mAdView.getVisibility() != View.VISIBLE) {
+ AdRequest adRequest = new AdRequest.Builder()
+ .addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
+ .addTestDevice("C6A494DC6E7C9AC29102694D48487084") // nexus 7
+ .addTestDevice("B8B7561B850A9AB24E0D5B560FC50628") // Moto G
+ .addTestDevice("") // Cappy, even though it can't get ads
+ .build();
+ mAdView.setVisibility(View.VISIBLE);
+ mAdView.loadAd(adRequest);
+ }
+ }
+ else{
+ if (mAdView.getVisibility() == View.VISIBLE) {
+ mAdView.setVisibility(View.GONE);
+ }
+ }
+ }
+
+ setButtonInsert();
+
+ super.onResume();
+
+ return;
+ }
+
+ @Override
+ protected void onPause(){
+ if (dalih.DEBUG) System.out.println("***** Pausing Tab2 *****");
+
+ dalih.close();
+
+ hideKeyboard();
+
+ super.onPause();
+
+ return;
+ }
+
+ public boolean validateItem(ListItemInfo newItem){
+ // FIELDS MUST HAVE VALUES BEFORE CONVERTING!!!
+ if (txtName.getText().toString().equals("")){
+ Toast.makeText(context, "Item must have a name!", Toast.LENGTH_SHORT).show();
+ }
+ else if (txtCost.getText().toString().equals("") || txtCost.getText().toString().equals(".")){
+ Toast.makeText(context, "Item must have a cost!", Toast.LENGTH_SHORT).show();
+ }
+ else if (txtServings.getText().toString().equals("") || txtServings.getText().toString().equals(".")){
+ Toast.makeText(context, "Item must have servings!", Toast.LENGTH_SHORT).show();
+ }
+ else if (txtCalories.getText().toString().equals("") || txtCalories.getText().toString().equals(".")){
+ Toast.makeText(context, "Item must have calories!", Toast.LENGTH_SHORT).show();
+ }
+ else if (txtCarbs.getText().toString().equals("") || txtCarbs.getText().toString().equals(".")){
+ Toast.makeText(context, "Item must have carbohydrates!", Toast.LENGTH_SHORT).show();
+ }
+ else{
+
+ newItem.setName(txtName.getText().toString());
+ newItem.setCost(Double.parseDouble(txtCost.getText().toString()));
+ newItem.setServings(Double.parseDouble(txtServings.getText().toString()));
+ newItem.setCalories(Double.parseDouble(txtCalories.getText().toString()));
+ newItem.setCarbs(Double.parseDouble(txtCarbs.getText().toString()));
+ newItem.setFiber(Double.parseDouble(txtFiber.getText().toString()));
+ newItem.setListID(dalih.getLastList());
+
+ // NAME MUST BE UNIQUE, VALUES MUST BE GREATER THAN 0
+ boolean nameDuplicated = false;
+ for(ListItem li : items){
+ if(newItem.getName().equals(li.getName()) || newItem.getName().equals("")){
+ nameDuplicated = true;
+ }
+ }
+ if (nameDuplicated){
+ Toast.makeText(context, "Name must be unique!", Toast.LENGTH_SHORT).show();
+ }
+ else if (newItem.getCost() <= 0){
+ Toast.makeText(context, "Cost must be greater than 0!", Toast.LENGTH_SHORT).show();
+ }
+ else if (newItem.getServings() <= 0){
+ Toast.makeText(context, "Servings must be greater than 0!", Toast.LENGTH_SHORT).show();
+ }
+ else if (newItem.getCalories() <= 0){
+ Toast.makeText(context, "Calories must be greater than 0!", Toast.LENGTH_SHORT).show();
+ }
+ else if (newItem.getFiber() > newItem.getCarbs()){
+ Toast.makeText(context, "Cannot have more fiber than carbs!", Toast.LENGTH_SHORT).show();
+ }
+ else if ((newItem.getCarbs()-newItem.getFiber()) * 3.5 > newItem.getCalories()){
+ Toast.makeText(context, "Too many carbs, not enough calories!", Toast.LENGTH_SHORT).show();
+ }
+ else{
+ return true;
+ }// end else
+ }// end else
+
+ return false;
+ }// end validateItem()
+
+ public void setButtonInsert(){
+ btnAdd.setText(R.string.item_create_button_insert);
+
+ // Reset to default
+ dalih.setLastItem();
+
+ createItems();
+
+ if (dalih.DEBUG) System.out.println("Setting add button to insert");
+ btnAdd.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+
+ ListItemInfo newItem = new ListItemInfo();
+
+ if (validateItem(newItem)) {
+ hideKeyboard();
+
+ dalih.insertItem(newItem);
+
+ createItems();
+
+ dalih.setOpenTab(1);
+ }
+ }
+ });// end btnAdd.setOnClickListener
+
+ return;
+ }
+
+ public void setButtonUpdate(final ListItem listItem){
+ btnAdd.setText(R.string.item_create_button_update);
+
+ // Pull Item info into top boxes then remove the ListItem
+ // Save which item we are on
+ dalih.setLastItem(listItem.getID());
+
+ // Remove the item
+ createItems();
+
+ // Set all fields to the values
+ txtName.setText(listItem.getName());
+ txtCost.setText(Double.toString(listItem.getCost()));
+ txtServings.setText(Double.toString(listItem.getServings()));
+ txtCalories.setText(Double.toString(listItem.getCalories()));
+ txtCarbs.setText(Double.toString(listItem.getCarbs()));
+ txtFiber.setText(Double.toString(listItem.getFiber()));
+
+ showKeyboard();
+
+ if (dalih.DEBUG) System.out.println("");
+ btnAdd.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+
+ if (validateItem(listItem)) {
+ hideKeyboard();
+
+ dalih.updateItem(listItem);
+
+ setButtonInsert();
+ }
+ }
+ });// end btnAdd.setOnClickListener
+
+ return;
+ }
+
+ public void createItems(){
+ if (dalih.DEBUG) System.out.println("Creating items");
+
+ txtName.setText("");
+ txtCost.setText("");
+ txtServings.setText("");
+ txtCalories.setText("");
+ txtCarbs.setText("");
+ txtFiber.setText("");
+
+ items = new ArrayList();
+
+ for (ListItemInfo info : dalih.getItems(dalih.getLastList())){
+ if (dalih.DEBUG) System.out.println("Found item: " + info.getID() + " " + info.getName());
+
+ // Prevent item being edited from being displayed
+ if (info.getID() != dalih.getLastItem()) {
+ items.add(new ListItem(context, info));
+ }
+ }
+
+ // ========== Display the ListItems ==========
+ // Order the list
+ items = orderList(items);
+
+ // Give the Item Buttons functionality
+ for (final ListItem li : items){
+ li.btnEdit.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ // Change the create button to update instead of insert
+ setButtonUpdate(li);
+ }
+ });
+
+ li.btnDelete.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ dalih.deleteItem(li);
+
+ createItems();
+ }
+ });
+ }
+
+ // Replace old List with new ordered list
+ // Clear list
+ layListArea.removeAllViews();
+ // Add Views
+ for (ListItem li : items) {
+ layListArea.addView(li.getView());
+ }
+
+ return;
+ }
+
+ public ArrayList orderList(ArrayList unorderedList){
+ if (dalih.DEBUG) System.out.println("Sorting the items");
+
+ ArrayList orderedList = new ArrayList();
+
+ while (!unorderedList.isEmpty()) {
+ double max = 0;
+ int index = 0;
+
+ for (ListItem j : unorderedList) {
+ if (j.getCalPerDol() > max) {
+ //if (dalih.DEBUG) System.out.println(j.getCalPerDol()*100 + " is better than " + max*100);
+
+ max = j.getCalPerDol();
+ index = unorderedList.indexOf(j);
+ }
+ }
+ if (dalih.DEBUG) System.out.println(max*100 + " was the best");
+ orderedList.add(unorderedList.get(index));
+ unorderedList.remove(index);
+ }
+
+ return orderedList;
+ }
+
+ public void removeItem(){
+ int deleteID = dalih.getLastItem();
+
+ for (ListItemInfo item : dalih.getItems(dalih.getLastList())){
+ if (item.getID() == deleteID){
+ if (dalih.DEBUG) System.out.println("Deleting item " + item.getID() + " " + item.getName());
+ dalih.deleteItem(item);
+ break;
+ }
+ }
+
+ return;
+ }
+
+ public void hideKeyboard(){
+ ((InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE)).hideSoftInputFromWindow(btnAdd.getWindowToken(),0);
+
+ return;
+ }
+
+ public void showKeyboard(){
+ ((InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE)).showSoftInput(txtName, 0);
+
+ return;
+ }
+
+}// end Tab2
diff --git a/app/src/main/java/com/hyperling/carbupbeta/changelog.txt b/app/src/main/java/com/hyperling/carbupbeta/changelog.txt
new file mode 100755
index 0000000..eb9c982
--- /dev/null
+++ b/app/src/main/java/com/hyperling/carbupbeta/changelog.txt
@@ -0,0 +1,64 @@
+
+**********
+**********
+**********
+TODO:
+ - Implement a database (Moves project to Beta v1.00)
+ - Create 2 tables
+ - 1st is List, one attribute is ListID(PK)
+ - 2nd is Item, 2 primary keys per entry (ItemID, ListID(FK)), and attributes as Price, Servings, Calories, and Carbs
+ - Have Tab1 create a List entity
+ - Have Tab2 create Item entities with the correct ListID
+ - Have Tab3 display all Lists, with the current selected List at the top
+ - Finalize the app (Moves project to Final/Release/Something meaning it isn't beta/v1.00)
+ - All functionality is functional
+ - App is easy to understand for new users
+ - Visuals and audio are high quality
+**********
+**********
+**********
+$VERSION_NAME v$VERSION_NUMBER $DATE_STARTED - $DATE_FINISHED
+**********
+**********
+**********
+Beta v0.08 2016/01/06 - 2016/01/06
+ - Make the keyboard lower after adding a list or item
+Beta v0.07 2015/12/31 - 2016/01/03
+ - Changed names of tables and columns on DB
+ - Deleted tab 3, moved list of Lists to tab1 and selected list to tab2
+ - Always open on tab1
+ - Created List and ListInfo
+ - Finished DALIH, added methods for List
+ - Basically re-did the entire thing
+Aplha v0.06 2014/12/29 - Unfinished
+ - Created Data to hold dalih for all tabs
+ - Added Data to application in manifest
+ - Brought DALIH to life (with insert, delete, and get methods)
+ - Started preparing a toggle button on tab2 in case I add measuring by weight
+ - Got tab2 to work with DALIH
+Alpha v0.05 2014/12/24 - 2014/12/29 Uploaded as Version 1(0.05)
+ - Transfer project to Android Studio 1.0
+ - Add @string version_name
+ - Change @string my_version_number to version_number in all files
+ - Created DALIH
+ - Changed to circle icon
+Alpha v0.04 2014/10/16 - 2014/10/16
+ - Change carbs to return to double in edit text
+Alpha v0.03 2014/10/13 - 2014/10/13
+ - EditTexts adjust height if one grows
+Alpha v0.02 2014/10/07 - 2014/10/13
+ - ListItem entries editable
+ - Tab2 text edits need not be able to enter only a "."
+ - Add percentages
+ - Fix button text being displaced
+ - All Tab2 ListItem information is on its own line
+ - Renamed BETA TEST LIST to Unsaved Test LIst
+Alpha v0.01
+ - Added ScrollView around tab2's ListITemLayout
+Alpha v0.00
+ Designed entire app, got tab 2 "working"
+ - Now working on bringing to the app store
+ - Tab2 needs to be able to scroll
+ - v0.01
+ - Tab2 needs ListItems to be editable
+ - Tab2 needs to have color codes, or to display a % of carb/calorie (in addition to color)
\ No newline at end of file
diff --git a/app/src/main/res/drawable-hdpi/dr_face_straight2_circle.png b/app/src/main/res/drawable-hdpi/dr_face_straight2_circle.png
new file mode 100755
index 0000000..04a7f3f
Binary files /dev/null and b/app/src/main/res/drawable-hdpi/dr_face_straight2_circle.png differ
diff --git a/app/src/main/res/drawable-hdpi/dr_face_straight2_square.png b/app/src/main/res/drawable-hdpi/dr_face_straight2_square.png
new file mode 100755
index 0000000..5a9039d
Binary files /dev/null and b/app/src/main/res/drawable-hdpi/dr_face_straight2_square.png differ
diff --git a/app/src/main/res/drawable-hdpi/figsy_grass_circle_full.png b/app/src/main/res/drawable-hdpi/figsy_grass_circle_full.png
new file mode 100755
index 0000000..b8d7ad7
Binary files /dev/null and b/app/src/main/res/drawable-hdpi/figsy_grass_circle_full.png differ
diff --git a/app/src/main/res/drawable-hdpi/figsy_grass_circle_medium.png b/app/src/main/res/drawable-hdpi/figsy_grass_circle_medium.png
new file mode 100755
index 0000000..17e67ca
Binary files /dev/null and b/app/src/main/res/drawable-hdpi/figsy_grass_circle_medium.png differ
diff --git a/app/src/main/res/drawable-hdpi/figsy_grass_circle_small.png b/app/src/main/res/drawable-hdpi/figsy_grass_circle_small.png
new file mode 100755
index 0000000..dfdb1d8
Binary files /dev/null and b/app/src/main/res/drawable-hdpi/figsy_grass_circle_small.png differ
diff --git a/app/src/main/res/drawable-hdpi/figsy_grass_full.jpg b/app/src/main/res/drawable-hdpi/figsy_grass_full.jpg
new file mode 100755
index 0000000..22180a9
Binary files /dev/null and b/app/src/main/res/drawable-hdpi/figsy_grass_full.jpg differ
diff --git a/app/src/main/res/drawable-hdpi/ic_launcher.png b/app/src/main/res/drawable-hdpi/ic_launcher.png
new file mode 100755
index 0000000..96a442e
Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_launcher.png differ
diff --git a/app/src/main/res/drawable-mdpi/ic_launcher.png b/app/src/main/res/drawable-mdpi/ic_launcher.png
new file mode 100755
index 0000000..359047d
Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_launcher.png differ
diff --git a/app/src/main/res/drawable-xhdpi/ic_launcher.png b/app/src/main/res/drawable-xhdpi/ic_launcher.png
new file mode 100755
index 0000000..71c6d76
Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_launcher.png differ
diff --git a/app/src/main/res/drawable-xxhdpi/ic_launcher.png b/app/src/main/res/drawable-xxhdpi/ic_launcher.png
new file mode 100755
index 0000000..4df1894
Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_launcher.png differ
diff --git a/app/src/main/res/layout/activity_home.xml b/app/src/main/res/layout/activity_home.xml
new file mode 100755
index 0000000..e0c5551
--- /dev/null
+++ b/app/src/main/res/layout/activity_home.xml
@@ -0,0 +1,94 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/layout/activity_splash.xml b/app/src/main/res/layout/activity_splash.xml
new file mode 100755
index 0000000..3e8db1b
--- /dev/null
+++ b/app/src/main/res/layout/activity_splash.xml
@@ -0,0 +1,55 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/layout/list.xml b/app/src/main/res/layout/list.xml
new file mode 100755
index 0000000..743f5fd
--- /dev/null
+++ b/app/src/main/res/layout/list.xml
@@ -0,0 +1,41 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/list_item.xml b/app/src/main/res/layout/list_item.xml
new file mode 100755
index 0000000..52d3579
--- /dev/null
+++ b/app/src/main/res/layout/list_item.xml
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/main.xml b/app/src/main/res/layout/main.xml
new file mode 100755
index 0000000..4fac3d9
--- /dev/null
+++ b/app/src/main/res/layout/main.xml
@@ -0,0 +1,33 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/my_settings.xml b/app/src/main/res/layout/my_settings.xml
new file mode 100755
index 0000000..95fef2e
--- /dev/null
+++ b/app/src/main/res/layout/my_settings.xml
@@ -0,0 +1,53 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/tab1.xml b/app/src/main/res/layout/tab1.xml
new file mode 100755
index 0000000..e64f7e3
--- /dev/null
+++ b/app/src/main/res/layout/tab1.xml
@@ -0,0 +1,99 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/tab2.xml b/app/src/main/res/layout/tab2.xml
new file mode 100755
index 0000000..230e192
--- /dev/null
+++ b/app/src/main/res/layout/tab2.xml
@@ -0,0 +1,128 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/testing.xml b/app/src/main/res/layout/testing.xml
new file mode 100755
index 0000000..2e664f2
--- /dev/null
+++ b/app/src/main/res/layout/testing.xml
@@ -0,0 +1,50 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/menu/menu_home.xml b/app/src/main/res/menu/menu_home.xml
new file mode 100755
index 0000000..4c42a50
--- /dev/null
+++ b/app/src/main/res/menu/menu_home.xml
@@ -0,0 +1,13 @@
+
+
\ No newline at end of file
diff --git a/app/src/main/res/values-v21/styles.xml b/app/src/main/res/values-v21/styles.xml
new file mode 100755
index 0000000..429cb00
--- /dev/null
+++ b/app/src/main/res/values-v21/styles.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/values-w820dp/dimens.xml b/app/src/main/res/values-w820dp/dimens.xml
new file mode 100755
index 0000000..63fc816
--- /dev/null
+++ b/app/src/main/res/values-w820dp/dimens.xml
@@ -0,0 +1,6 @@
+
+
+ 64dp
+
diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml
new file mode 100755
index 0000000..26c438c
--- /dev/null
+++ b/app/src/main/res/values/colors.xml
@@ -0,0 +1,8 @@
+
+
+ #CCCC00
+ #333333
+ #330066
+ #FFFFFF
+ #FFFFFF
+
diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml
new file mode 100755
index 0000000..47c8224
--- /dev/null
+++ b/app/src/main/res/values/dimens.xml
@@ -0,0 +1,5 @@
+
+
+ 16dp
+ 16dp
+
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
new file mode 100755
index 0000000..896923f
--- /dev/null
+++ b/app/src/main/res/values/strings.xml
@@ -0,0 +1,65 @@
+
+
+
+ Carb Up! BETA
+ Carb Up! CTFU Helper
+ Carb Up!
+ Settings
+ Main
+ -=Version Banana=-
+ -=Beta v0.10=-
+
+ Hyperling
+
+
+
+ Create a New List:
+ List Name
+
+ Editing
+
+ Create
+ Rename
+
+ Click on a List\'s Name:
+
+
+
+ Create a New Item:
+ Add
+ Update
+
+ Item Name
+ Cost ($)
+ Servings
+ Calories per Serving
+ Carbs (g)
+ Fiber (g)
+
+ Clear
+
+
+
+
+
+
+ X
+ Edit
+
+ Are you sure?
+ This will delete the list permanently.
+ This will delete the item permanently.
+ Delete
+ Cancel
+
+
+
+ ca-app-pub-9712416021907617/1895014881
+ ca-app-pub-9712416021907617/1895014881
+ ca-app-pub-9712416021907617/6325214486
+ ca-app-pub-9712416021907617/4055112081
+ ca-app-pub-9712416021907617/9278680882
+ Home
+
+
+
diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml
new file mode 100755
index 0000000..64019fa
--- /dev/null
+++ b/app/src/main/res/values/styles.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
diff --git a/art/Screenshots/Phone/1_motoGSplash.png b/art/Screenshots/Phone/1_motoGSplash.png
new file mode 100755
index 0000000..51424b4
Binary files /dev/null and b/art/Screenshots/Phone/1_motoGSplash.png differ
diff --git a/art/Screenshots/Phone/2_motoGTab1.png b/art/Screenshots/Phone/2_motoGTab1.png
new file mode 100755
index 0000000..4612069
Binary files /dev/null and b/art/Screenshots/Phone/2_motoGTab1.png differ
diff --git a/art/Screenshots/Phone/3_motoGTab1_rename.png b/art/Screenshots/Phone/3_motoGTab1_rename.png
new file mode 100755
index 0000000..b0b1b09
Binary files /dev/null and b/art/Screenshots/Phone/3_motoGTab1_rename.png differ
diff --git a/art/Screenshots/Phone/4_motoGTab2_Starch.png b/art/Screenshots/Phone/4_motoGTab2_Starch.png
new file mode 100755
index 0000000..49b2e73
Binary files /dev/null and b/art/Screenshots/Phone/4_motoGTab2_Starch.png differ
diff --git a/art/Screenshots/Phone/5_motoGSettings.png b/art/Screenshots/Phone/5_motoGSettings.png
new file mode 100755
index 0000000..d0f5caa
Binary files /dev/null and b/art/Screenshots/Phone/5_motoGSettings.png differ
diff --git a/art/Screenshots/Tablet/1_Nexus7_Splash.png b/art/Screenshots/Tablet/1_Nexus7_Splash.png
new file mode 100755
index 0000000..a2905e7
Binary files /dev/null and b/art/Screenshots/Tablet/1_Nexus7_Splash.png differ
diff --git a/art/Screenshots/Tablet/2_Nexus7_Tab1.png b/art/Screenshots/Tablet/2_Nexus7_Tab1.png
new file mode 100755
index 0000000..c40e0f0
Binary files /dev/null and b/art/Screenshots/Tablet/2_Nexus7_Tab1.png differ
diff --git a/art/Screenshots/Tablet/3_Nexus7_Tab1_editing.png b/art/Screenshots/Tablet/3_Nexus7_Tab1_editing.png
new file mode 100755
index 0000000..17dcbf0
Binary files /dev/null and b/art/Screenshots/Tablet/3_Nexus7_Tab1_editing.png differ
diff --git a/art/Screenshots/Tablet/4_Nexus7_Tab2.png b/art/Screenshots/Tablet/4_Nexus7_Tab2.png
new file mode 100755
index 0000000..e309123
Binary files /dev/null and b/art/Screenshots/Tablet/4_Nexus7_Tab2.png differ
diff --git a/art/Screenshots/Tablet/5_Nexus7_Settings.png b/art/Screenshots/Tablet/5_Nexus7_Settings.png
new file mode 100755
index 0000000..e033f3f
Binary files /dev/null and b/art/Screenshots/Tablet/5_Nexus7_Settings.png differ
diff --git a/art/ctfu.png b/art/ctfu.png
new file mode 100755
index 0000000..89f9b84
Binary files /dev/null and b/art/ctfu.png differ
diff --git a/art/figsy.xcf b/art/figsy.xcf
new file mode 100755
index 0000000..d68186e
Binary files /dev/null and b/art/figsy.xcf differ
diff --git a/art/store_banner.xcf b/art/store_banner.xcf
new file mode 100755
index 0000000..ec250e5
Binary files /dev/null and b/art/store_banner.xcf differ
diff --git a/art/store_banner_blank.png b/art/store_banner_blank.png
new file mode 100755
index 0000000..178483e
Binary files /dev/null and b/art/store_banner_blank.png differ
diff --git a/build.gradle b/build.gradle
new file mode 100755
index 0000000..a6fcfe1
--- /dev/null
+++ b/build.gradle
@@ -0,0 +1,19 @@
+// Top-level build file where you can add configuration options common to all sub-projects/modules.
+
+buildscript {
+ repositories {
+ jcenter()
+ }
+ dependencies {
+ classpath 'com.android.tools.build:gradle:1.5.0'
+
+ // NOTE: Do not place your application dependencies here; they belong
+ // in the individual module build.gradle files
+ }
+}
+
+allprojects {
+ repositories {
+ jcenter()
+ }
+}
diff --git a/gradle.properties b/gradle.properties
new file mode 100755
index 0000000..1d3591c
--- /dev/null
+++ b/gradle.properties
@@ -0,0 +1,18 @@
+# Project-wide Gradle settings.
+
+# IDE (e.g. Android Studio) users:
+# Gradle settings configured through the IDE *will override*
+# any settings specified in this file.
+
+# For more details on how to configure your build environment visit
+# http://www.gradle.org/docs/current/userguide/build_environment.html
+
+# Specifies the JVM arguments used for the daemon process.
+# The setting is particularly useful for tweaking memory settings.
+# Default value: -Xmx10248m -XX:MaxPermSize=256m
+# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
+
+# When configured, Gradle will run in incubating parallel mode.
+# This option should only be used with decoupled projects. More details, visit
+# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
+# org.gradle.parallel=true
\ No newline at end of file
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
new file mode 100755
index 0000000..8c0fb64
Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
new file mode 100755
index 0000000..0c71e76
--- /dev/null
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,6 @@
+#Wed Apr 10 15:27:10 PDT 2013
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip
diff --git a/settings.gradle b/settings.gradle
new file mode 100755
index 0000000..e7b4def
--- /dev/null
+++ b/settings.gradle
@@ -0,0 +1 @@
+include ':app'