Browse Source

Initial Commit

Thomas Ross 4 years ago
commit
25e64eebed
55 changed files with 1379 additions and 0 deletions
  1. 16
    0
      .gitignore
  2. 1
    0
      app/.gitignore
  3. 33
    0
      app/build.gradle
  4. 17
    0
      app/proguard-rules.pro
  5. 15
    0
      app/src/androidTest/java/io/thomasross/frcscout/ApplicationTest.java
  6. 22
    0
      app/src/main/AndroidManifest.xml
  7. BIN
      app/src/main/ic_add_white-web.png
  8. BIN
      app/src/main/ic_launcher-web.png
  9. 67
    0
      app/src/main/java/io/thomasross/frcscout/AddTeam.java
  10. 281
    0
      app/src/main/java/io/thomasross/frcscout/EditTeam.java
  11. 6
    0
      app/src/main/java/io/thomasross/frcscout/FinishedCallback.java
  12. 129
    0
      app/src/main/java/io/thomasross/frcscout/Main.java
  13. 17
    0
      app/src/main/java/io/thomasross/frcscout/Team.java
  14. 35
    0
      app/src/main/java/io/thomasross/frcscout/TeamsOpenHelper.java
  15. 43
    0
      app/src/main/java/io/thomasross/frcscout/loaders/TeamLoader.java
  16. 55
    0
      app/src/main/java/io/thomasross/frcscout/tasks/DeleteTeamTask.java
  17. 60
    0
      app/src/main/java/io/thomasross/frcscout/tasks/InsertTeamTask.java
  18. 60
    0
      app/src/main/java/io/thomasross/frcscout/tasks/UpdateTeamTask.java
  19. BIN
      app/src/main/res/drawable-hdpi/ic_add_white.png
  20. BIN
      app/src/main/res/drawable-hdpi/ic_check_white.png
  21. BIN
      app/src/main/res/drawable-hdpi/ic_delete_white.png
  22. BIN
      app/src/main/res/drawable-mdpi/ic_add_white.png
  23. BIN
      app/src/main/res/drawable-mdpi/ic_check_white.png
  24. BIN
      app/src/main/res/drawable-mdpi/ic_delete_white.png
  25. BIN
      app/src/main/res/drawable-xhdpi/ic_add_white.png
  26. BIN
      app/src/main/res/drawable-xhdpi/ic_check_white.png
  27. BIN
      app/src/main/res/drawable-xhdpi/ic_delete_white.png
  28. BIN
      app/src/main/res/drawable-xxhdpi/ic_add_white.png
  29. BIN
      app/src/main/res/drawable-xxhdpi/ic_check_white.png
  30. BIN
      app/src/main/res/drawable-xxhdpi/ic_delete_white.png
  31. 29
    0
      app/src/main/res/layout/activity_addteam.xml
  32. 62
    0
      app/src/main/res/layout/activity_editteam.xml
  33. 33
    0
      app/src/main/res/layout/activity_main.xml
  34. 9
    0
      app/src/main/res/layout/simpletextview.xml
  35. 18
    0
      app/src/main/res/layout/tasklistitem.xml
  36. 10
    0
      app/src/main/res/menu/menu_addteam.xml
  37. 15
    0
      app/src/main/res/menu/menu_editteam.xml
  38. BIN
      app/src/main/res/mipmap-hdpi/ic_launcher.png
  39. BIN
      app/src/main/res/mipmap-mdpi/ic_launcher.png
  40. BIN
      app/src/main/res/mipmap-xhdpi/ic_launcher.png
  41. BIN
      app/src/main/res/mipmap-xxhdpi/ic_launcher.png
  42. BIN
      app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
  43. 6
    0
      app/src/main/res/values-w820dp/dimens.xml
  44. 5
    0
      app/src/main/res/values/colors.xml
  45. 5
    0
      app/src/main/res/values/dimens.xml
  46. 9
    0
      app/src/main/res/values/strings.xml
  47. 6
    0
      app/src/main/res/values/styles.xml
  48. 17
    0
      app/src/test/java/io/thomasross/frcscout/ExampleUnitTest.java
  49. 23
    0
      build.gradle
  50. 18
    0
      gradle.properties
  51. BIN
      gradle/wrapper/gradle-wrapper.jar
  52. 6
    0
      gradle/wrapper/gradle-wrapper.properties
  53. 160
    0
      gradlew
  54. 90
    0
      gradlew.bat
  55. 1
    0
      settings.gradle

+ 16
- 0
.gitignore View File

@@ -0,0 +1,16 @@
1
+*.iml
2
+.gradle
3
+/local.properties
4
+/.idea/workspace.xml
5
+/.idea/libraries
6
+.DS_Store
7
+/build
8
+/captures
9
+*.apk
10
+*.ap_
11
+./idea/
12
+.idea
13
+*.iml
14
+/captures
15
+/build
16
+

+ 1
- 0
app/.gitignore View File

@@ -0,0 +1 @@
1
+/build

+ 33
- 0
app/build.gradle View File

@@ -0,0 +1,33 @@
1
+apply plugin: 'com.android.application'
2
+
3
+android {
4
+    compileSdkVersion 23
5
+    buildToolsVersion "23.0.2"
6
+
7
+    defaultConfig {
8
+        applicationId "io.thomasross.frcscout"
9
+        minSdkVersion 21
10
+        targetSdkVersion 23
11
+        versionCode 3
12
+        versionName "1.0.2"
13
+    }
14
+    buildTypes {
15
+        release {
16
+            minifyEnabled false
17
+            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18
+        }
19
+    }
20
+
21
+    lintOptions {
22
+        checkReleaseBuilds false
23
+        abortOnError false
24
+    }
25
+}
26
+
27
+dependencies {
28
+    compile fileTree(dir: 'libs', include: ['*.jar'])
29
+    testCompile 'junit:junit:4.12'
30
+    compile 'com.android.support:appcompat-v7:+'
31
+    compile 'com.google.code.gson:gson:2.4'
32
+    compile 'com.android.support:design:23.2.0'
33
+}

+ 17
- 0
app/proguard-rules.pro View File

@@ -0,0 +1,17 @@
1
+# Add project specific ProGuard rules here.
2
+# By default, the flags in this file are appended to flags specified
3
+# in /media/data/android-sdk-linux/tools/proguard/proguard-android.txt
4
+# You can edit the include path and order by changing the proguardFiles
5
+# directive in build.gradle.
6
+#
7
+# For more details, see
8
+#   http://developer.android.com/guide/developing/tools/proguard.html
9
+
10
+# Add any project specific keep options here:
11
+
12
+# If your project uses WebView with JS, uncomment the following
13
+# and specify the fully qualified class name to the JavaScript interface
14
+# class:
15
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16
+#   public *;
17
+#}

+ 15
- 0
app/src/androidTest/java/io/thomasross/frcscout/ApplicationTest.java View File

@@ -0,0 +1,15 @@
1
+package io.thomasross.frcscout;
2
+
3
+import android.app.Application;
4
+import android.test.ApplicationTestCase;
5
+
6
+/**
7
+ * <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
8
+ */
9
+public class ApplicationTest extends ApplicationTestCase<Application>
10
+{
11
+    public ApplicationTest()
12
+    {
13
+        super(Application.class);
14
+    }
15
+}

+ 22
- 0
app/src/main/AndroidManifest.xml View File

@@ -0,0 +1,22 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3
+          package="io.thomasross.frcscout">
4
+    <application
5
+            android:allowBackup="true"
6
+            android:icon="@mipmap/ic_launcher"
7
+            android:label="@string/app_name"
8
+            android:supportsRtl="true"
9
+            android:theme="@style/FrcScoutTheme">
10
+        <activity android:name=".Main"
11
+                  android:screenOrientation="portrait"> // TODO: Don't do this!
12
+            <intent-filter>
13
+                <action android:name="android.intent.action.MAIN"/>
14
+                <category android:name="android.intent.category.LAUNCHER"/>
15
+            </intent-filter>
16
+        </activity>
17
+        <activity android:name=".AddTeam"
18
+                  android:screenOrientation="portrait"/> // TODO: Don't do this!
19
+        <activity android:name=".EditTeam"
20
+                  android:screenOrientation="portrait"/> // TODO: Don't do this!
21
+    </application>
22
+</manifest>

BIN
app/src/main/ic_add_white-web.png View File


BIN
app/src/main/ic_launcher-web.png View File


+ 67
- 0
app/src/main/java/io/thomasross/frcscout/AddTeam.java View File

@@ -0,0 +1,67 @@
1
+package io.thomasross.frcscout;
2
+
3
+import android.os.Bundle;
4
+import android.support.v7.app.AppCompatActivity;
5
+import android.view.Menu;
6
+import android.view.MenuItem;
7
+import android.widget.EditText;
8
+import io.thomasross.frcscout.tasks.InsertTeamTask;
9
+
10
+public class AddTeam extends AppCompatActivity implements FinishedCallback
11
+{
12
+    @Override
13
+    public void onCreate(Bundle savedInstanceState)
14
+    {
15
+        super.onCreate(savedInstanceState);
16
+        setContentView(R.layout.activity_addteam);
17
+    }
18
+
19
+    @Override
20
+    public boolean onCreateOptionsMenu(Menu menu)
21
+    {
22
+        final AddTeam us = this;
23
+
24
+        getMenuInflater().inflate(R.menu.menu_addteam, menu);
25
+
26
+        MenuItem doneBtn = menu.findItem(R.id.action_checkmark_AT);
27
+        doneBtn.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener()
28
+        {
29
+            @Override
30
+            public boolean onMenuItemClick(MenuItem item)
31
+            {
32
+                us.onDoneClicked();
33
+                return false;
34
+            }
35
+        });
36
+
37
+        return super.onCreateOptionsMenu(menu);
38
+    }
39
+
40
+    public void onDoneClicked()
41
+    {
42
+        InsertTeamTask task = new InsertTeamTask(this);
43
+        task.addFinishCallback(this);
44
+
45
+        String teamNumText = ((EditText) findViewById(R.id.teamnumber_edit_AT)).getText().toString();
46
+        String teamNameText = ((EditText) findViewById(R.id.teamname_edit_AT)).getText().toString();
47
+
48
+        if (teamNumText.isEmpty())
49
+        {
50
+            finish();
51
+            return;
52
+        }
53
+
54
+        Team team = new Team(
55
+                Integer.parseInt(teamNumText),
56
+                teamNameText,
57
+                "{}",
58
+                0
59
+        );
60
+        task.execute(team);
61
+    }
62
+
63
+    public void done()
64
+    {
65
+        finish();
66
+    }
67
+}

+ 281
- 0
app/src/main/java/io/thomasross/frcscout/EditTeam.java View File

@@ -0,0 +1,281 @@
1
+package io.thomasross.frcscout;
2
+
3
+import android.app.AlertDialog;
4
+import android.app.LoaderManager;
5
+import android.content.Context;
6
+import android.content.DialogInterface;
7
+import android.content.Intent;
8
+import android.content.Loader;
9
+import android.database.Cursor;
10
+import android.os.Bundle;
11
+import android.support.v7.app.AppCompatActivity;
12
+import android.view.*;
13
+import android.widget.*;
14
+import com.google.gson.Gson;
15
+import com.google.gson.GsonBuilder;
16
+import com.google.gson.reflect.TypeToken;
17
+import io.thomasross.frcscout.loaders.TeamLoader;
18
+import io.thomasross.frcscout.tasks.DeleteTeamTask;
19
+import io.thomasross.frcscout.tasks.UpdateTeamTask;
20
+
21
+import java.lang.reflect.Type;
22
+import java.util.ArrayList;
23
+import java.util.HashMap;
24
+import java.util.List;
25
+
26
+public class EditTeam extends AppCompatActivity implements LoaderManager.LoaderCallbacks<Cursor>,FinishedCallback
27
+{
28
+    int teamNumber;
29
+    TaskListAdapter tasksListAdapter;
30
+
31
+    @Override
32
+    public void onCreate(Bundle savedInstanceState)
33
+    {
34
+        super.onCreate(savedInstanceState);
35
+        setContentView(R.layout.activity_editteam);
36
+
37
+        Intent intent = getIntent();
38
+        teamNumber = intent.getIntExtra("io.thomasross.frcscout.teamnumber", -1);
39
+
40
+        Bundle bundle = new Bundle();
41
+        bundle.putInt("teamnumber", teamNumber);
42
+        getLoaderManager().initLoader(0, bundle, this).forceLoad();
43
+
44
+        EditText teamNumberET = (EditText) findViewById(R.id.teamnumber_edit_ET);
45
+        teamNumberET.setKeyListener(null);
46
+    }
47
+
48
+    @Override
49
+    public boolean onCreateOptionsMenu(Menu menu)
50
+    {
51
+        final EditTeam us = this;
52
+
53
+        getMenuInflater().inflate(R.menu.menu_editteam, menu);
54
+
55
+        MenuItem doneBtn = menu.findItem(R.id.action_checkmark_ET);
56
+        doneBtn.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener()
57
+        {
58
+            @Override
59
+            public boolean onMenuItemClick(MenuItem item)
60
+            {
61
+                us.onDoneClicked();
62
+                return false;
63
+            }
64
+        });
65
+
66
+        MenuItem deleteBtn = menu.findItem(R.id.action_delete_ET);
67
+        deleteBtn.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener()
68
+        {
69
+            @Override
70
+            public boolean onMenuItemClick(MenuItem item)
71
+            {
72
+                us.onDeleteClicked();
73
+                return false;
74
+            }
75
+        });
76
+
77
+        return super.onCreateOptionsMenu(menu);
78
+    }
79
+
80
+    private void onDoneClicked()
81
+    {
82
+        ArrayList<Task> tasks = tasksListAdapter.getTaskList();
83
+        HashMap<String, Boolean> tasksMap = new HashMap<>();
84
+        for (Task task : tasks)
85
+        {
86
+            tasksMap.put(task.code, task.isTeamAble);
87
+        }
88
+
89
+        Gson gson = new GsonBuilder().create();
90
+        String tasksJSON = gson.toJson(tasksMap);
91
+
92
+        EditText teamNameET = (EditText) findViewById(R.id.teamname_edit_ET);
93
+
94
+        EditText autoPtsET = (EditText) findViewById(R.id.autonomouspoints_edit_ET);
95
+        int autoPts = Integer.parseInt(autoPtsET.getText().toString());
96
+
97
+        UpdateTeamTask task = new UpdateTeamTask(this);
98
+        task.addFinishCallback(this);
99
+        task.execute(new Team(teamNumber, teamNameET.getText().toString(), tasksJSON, autoPts));
100
+    }
101
+
102
+    private void onDeleteClicked()
103
+    {
104
+        final EditTeam us = this;
105
+        DialogInterface.OnClickListener dialogClickListener = new DialogInterface.OnClickListener()
106
+        {
107
+            @Override
108
+            public void onClick(DialogInterface dialog, int which)
109
+            {
110
+                switch (which)
111
+                {
112
+                    case DialogInterface.BUTTON_POSITIVE:
113
+                        DeleteTeamTask task = new DeleteTeamTask(us);
114
+                        task.addFinishCallback(us);
115
+
116
+                        task.execute(teamNumber);
117
+
118
+                        break;
119
+                }
120
+            }
121
+        };
122
+
123
+        AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(this);
124
+        dialogBuilder.setMessage("Are you sure?")
125
+                     .setPositiveButton("Yes", dialogClickListener)
126
+                     .setNegativeButton("No", dialogClickListener)
127
+                     .show();
128
+    }
129
+
130
+    @Override
131
+    public Loader<Cursor> onCreateLoader(int id, Bundle args)
132
+    {
133
+        String where = "TEAMNUMBER = ?";
134
+        String[] whereArgs = {"" + args.getInt("teamnumber")};
135
+        return new TeamLoader(this, null, where, whereArgs);
136
+    }
137
+
138
+    private class Task //TODO: move to its own file
139
+    {
140
+        String code;
141
+        String name;
142
+        boolean isTeamAble;
143
+
144
+        public Task(String code, String name, boolean isTeamAble)
145
+        {
146
+            this.code = code;
147
+            this.name = name;
148
+            this.isTeamAble = isTeamAble;
149
+        }
150
+    }
151
+
152
+    @Override
153
+    public void onLoadFinished(Loader<Cursor> loader, Cursor data)
154
+    {
155
+        if (data.getCount() > 0)
156
+        {
157
+            data.moveToNext();
158
+
159
+            EditText teamNumberET = (EditText) findViewById(R.id.teamnumber_edit_ET);
160
+            EditText teamNameET = (EditText) findViewById(R.id.teamname_edit_ET);
161
+            EditText autoPointsET = (EditText) findViewById(R.id.autonomouspoints_edit_ET);
162
+
163
+            teamNumberET.setText("" + data.getInt(0));
164
+            teamNameET.setText(data.getString(1));
165
+            autoPointsET.setText("" + data.getInt(3));
166
+
167
+            String tasksJSON = data.getString(2);
168
+
169
+            Type jsonType = new TypeToken<HashMap<String, Boolean>>(){}.getType();
170
+            Gson gson = new GsonBuilder().create();
171
+            HashMap<String, Boolean> tasksMap = gson.fromJson(tasksJSON, jsonType);
172
+
173
+            HashMap<String, String> taskDetails = new HashMap<>();
174
+            taskDetails.put("portcullis", "Portcullis");
175
+            taskDetails.put("cheval", "Cheval de Frise");
176
+            taskDetails.put("moat", "Moat");
177
+            taskDetails.put("ramparts", "Ramparts");
178
+            taskDetails.put("drawbridge", "Drawbridge");
179
+            taskDetails.put("sallyport", "Sally Port");
180
+            taskDetails.put("rockwall", "Rock Wall");
181
+            taskDetails.put("roughterrain", "Rough Terrain");
182
+            taskDetails.put("lowbar", "Low Bar");
183
+            taskDetails.put("lowgoal", "Low Goal");
184
+            taskDetails.put("highgoal", "High Goal");
185
+            taskDetails.put("scaletower", "Scale Tower");
186
+
187
+            ArrayList<Task> teamAbleTasks = new ArrayList<>();
188
+            for (String key : taskDetails.keySet())
189
+            {
190
+                if (!tasksMap.containsKey(key))
191
+                {
192
+                    teamAbleTasks.add(new Task(key, taskDetails.get(key), false));
193
+                    continue;
194
+                }
195
+                if (tasksMap.get(key))
196
+                {
197
+                    teamAbleTasks.add(new Task(key, taskDetails.get(key), true));
198
+                }
199
+                else
200
+                {
201
+                    teamAbleTasks.add(new Task(key, taskDetails.get(key), false));
202
+                }
203
+            }
204
+
205
+            tasksListAdapter = new TaskListAdapter(this, R.layout.tasklistitem, teamAbleTasks);
206
+            ListView listView = (ListView) findViewById(R.id.tasksList);
207
+            listView.setAdapter(tasksListAdapter);
208
+        }
209
+    }
210
+
211
+    @Override
212
+    public void onLoaderReset(Loader<Cursor> loader) {}
213
+
214
+    @Override
215
+    public void done()
216
+    {
217
+        finish();
218
+    }
219
+
220
+    private class TaskListAdapter extends ArrayAdapter<Task>
221
+    {
222
+        private ArrayList<Task> taskList;
223
+
224
+        public TaskListAdapter(Context context, int resource, List<Task> objects)
225
+        {
226
+            super(context, resource, objects);
227
+
228
+            this.taskList = new ArrayList<>();
229
+            this.taskList.addAll(objects);
230
+        }
231
+
232
+        private class ViewHolder
233
+        {
234
+            CheckBox able;
235
+        }
236
+
237
+
238
+        @Override
239
+        public View getView(int position, View convertView, ViewGroup parent)
240
+        {
241
+            ViewHolder holder;
242
+
243
+            if (convertView == null)
244
+            {
245
+                LayoutInflater vi = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
246
+                convertView = vi.inflate(R.layout.tasklistitem, null);
247
+
248
+                holder = new ViewHolder();
249
+                holder.able = (CheckBox) convertView.findViewById(R.id.checkBox);
250
+                convertView.setTag(holder);
251
+
252
+                holder.able.setOnClickListener(new View.OnClickListener()
253
+                {
254
+                    @Override
255
+                    public void onClick(View v)
256
+                    {
257
+                        CheckBox checkBox = (CheckBox) v;
258
+                        Task task = (Task) v.getTag();
259
+                        task.isTeamAble = checkBox.isChecked();
260
+                    }
261
+                });
262
+            }
263
+            else
264
+            {
265
+                holder = (ViewHolder) convertView.getTag();
266
+            }
267
+
268
+            Task task = taskList.get(position);
269
+            holder.able.setChecked(task.isTeamAble);
270
+            holder.able.setText(task.name);
271
+            holder.able.setTag(task);
272
+
273
+            return convertView;
274
+        }
275
+
276
+        public ArrayList<Task> getTaskList()
277
+        {
278
+            return taskList;
279
+        }
280
+    }
281
+}

+ 6
- 0
app/src/main/java/io/thomasross/frcscout/FinishedCallback.java View File

@@ -0,0 +1,6 @@
1
+package io.thomasross.frcscout;
2
+
3
+public interface FinishedCallback
4
+{
5
+    void done();
6
+}

+ 129
- 0
app/src/main/java/io/thomasross/frcscout/Main.java View File

@@ -0,0 +1,129 @@
1
+package io.thomasross.frcscout;
2
+
3
+import android.app.Activity;
4
+import android.app.LoaderManager;
5
+import android.content.Intent;
6
+import android.content.Loader;
7
+import android.database.Cursor;
8
+import android.os.Bundle;
9
+import android.support.design.widget.FloatingActionButton;
10
+import android.support.v7.app.AppCompatActivity;
11
+import android.view.View;
12
+import android.widget.*;
13
+import com.google.gson.Gson;
14
+import com.google.gson.GsonBuilder;
15
+import com.google.gson.reflect.TypeToken;
16
+import io.thomasross.frcscout.loaders.TeamLoader;
17
+
18
+import java.lang.reflect.Type;
19
+import java.util.ArrayList;
20
+import java.util.HashMap;
21
+
22
+public class Main extends AppCompatActivity implements LoaderManager.LoaderCallbacks<Cursor>
23
+{
24
+    @Override
25
+    public void onCreate(Bundle savedInstanceState)
26
+    {
27
+        super.onCreate(savedInstanceState);
28
+        setContentView(R.layout.activity_main);
29
+
30
+        final Activity us = this;
31
+
32
+        ListView listView = (ListView) findViewById(R.id.teamListView);
33
+        listView.setOnItemClickListener(new AdapterView.OnItemClickListener()
34
+        {
35
+            @Override
36
+            public void onItemClick(AdapterView<?> parent, View view, int position, long id)
37
+            {
38
+                TextView textView = (TextView) view;
39
+                String tvText = textView.getText().toString();
40
+                int teamNumber = Integer.parseInt(tvText.substring(0, tvText.indexOf(" "))); // TODO
41
+
42
+                Intent intent = new Intent(us, EditTeam.class);
43
+                intent.putExtra("io.thomasross.frcscout.teamnumber", teamNumber);
44
+                startActivity(intent);
45
+            }
46
+        });
47
+
48
+        FloatingActionButton addTeamBtn = (FloatingActionButton) findViewById(R.id.addTeam);
49
+        addTeamBtn.setOnClickListener(new View.OnClickListener()
50
+        {
51
+            @Override
52
+            public void onClick(View v)
53
+            {
54
+                Intent addTeamIntent = new Intent(us, AddTeam.class);
55
+                startActivity(addTeamIntent);
56
+            }
57
+        });
58
+    }
59
+
60
+    @Override
61
+    protected void onStart()
62
+    {
63
+        super.onStart();
64
+
65
+        getLoaderManager().initLoader(0, null, this).forceLoad();
66
+    }
67
+
68
+    @Override
69
+    public Loader<Cursor> onCreateLoader(int id, Bundle args)
70
+    {
71
+        return new TeamLoader(this, null, null, null);
72
+    }
73
+
74
+    @Override
75
+    public void onLoadFinished(Loader<Cursor> loader, Cursor data)
76
+    {
77
+        ArrayList<String> teamNumbers = new ArrayList<>();
78
+
79
+        if (data.getCount() == 0) { return; }
80
+
81
+        while (data.moveToNext())
82
+        {
83
+            String tasksJSON = data.getString(2);
84
+
85
+            Type jsonType = new TypeToken<HashMap<String, Boolean>>(){}.getType();
86
+            Gson gson = new GsonBuilder().create();
87
+            HashMap<String, Boolean> tasksMap = gson.fromJson(tasksJSON, jsonType);
88
+
89
+            ArrayList<String> tasks = new ArrayList<String>();
90
+            tasks.add("portcullis");
91
+            tasks.add("cheval");
92
+            tasks.add("moat");
93
+            tasks.add("ramparts");
94
+            tasks.add("drawbridge");
95
+            tasks.add("sallyport");
96
+            tasks.add("rockwall");
97
+            tasks.add("roughterrain");
98
+            tasks.add("lowbar");
99
+            tasks.add("lowgoal");
100
+            tasks.add("highgoal");
101
+            tasks.add("scaletower");
102
+
103
+            int numTasksAble = 0;
104
+            for (String key : tasks)
105
+            {
106
+                if (!tasksMap.containsKey(key))
107
+                {
108
+                    continue;
109
+                }
110
+                if (tasksMap.get(key))
111
+                {
112
+                    numTasksAble++;
113
+                }
114
+            }
115
+
116
+            teamNumbers.add("" + data.getInt(0) + " - " + data.getString(1) + "\n\t"
117
+                    + numTasksAble + "/" + tasks.size() + " tasks, " + data.getInt(3) + " auto points");
118
+        }
119
+
120
+        String[] teamNumbersArr = teamNumbers.toArray(new String[teamNumbers.size()]);
121
+
122
+        ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, R.layout.simpletextview, teamNumbersArr);
123
+        ListView listView = (ListView) findViewById(R.id.teamListView);
124
+        listView.setAdapter(adapter);
125
+    }
126
+
127
+    @Override
128
+    public void onLoaderReset(Loader<Cursor> loader) {}
129
+}

+ 17
- 0
app/src/main/java/io/thomasross/frcscout/Team.java View File

@@ -0,0 +1,17 @@
1
+package io.thomasross.frcscout;
2
+
3
+public class Team
4
+{
5
+    public int number;
6
+    public String name;
7
+    public String tasks;
8
+    public int autoPoints;
9
+
10
+    public Team(int number, String name, String tasks, int autoPoints)
11
+    {
12
+        this.number = number;
13
+        this.name = name;
14
+        this.tasks = tasks;
15
+        this.autoPoints = autoPoints;
16
+    }
17
+}

+ 35
- 0
app/src/main/java/io/thomasross/frcscout/TeamsOpenHelper.java View File

@@ -0,0 +1,35 @@
1
+package io.thomasross.frcscout;
2
+
3
+import android.content.Context;
4
+import android.database.sqlite.SQLiteDatabase;
5
+import android.database.sqlite.SQLiteOpenHelper;
6
+
7
+public class TeamsOpenHelper extends SQLiteOpenHelper
8
+{
9
+    private static final int DATABASE_VERSION = 4;
10
+    private static final String DATABASE_NAME = "Teams";
11
+    private static final String DATABASE_TABLE_NAME = "Teams";
12
+
13
+    public TeamsOpenHelper(Context context)
14
+    {
15
+        super(context, DATABASE_NAME, null, DATABASE_VERSION);
16
+    }
17
+
18
+    @Override
19
+    public void onCreate(SQLiteDatabase db)
20
+    {
21
+        db.execSQL("CREATE TABLE " + DATABASE_TABLE_NAME + " (" +
22
+                "TEAMNUMBER INT NOT NULL, " +
23
+                "TEAMNAME TEXT, " +
24
+                "TASKS TEXT, " +
25
+                "AUTOPTS INT" +
26
+                ");");
27
+    }
28
+
29
+    @Override
30
+    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion)
31
+    {
32
+        db.execSQL("ALTER TABLE " + DATABASE_TABLE_NAME + " " +
33
+                "ADD COLUMN AUTOPTS INT;");
34
+    }
35
+}

+ 43
- 0
app/src/main/java/io/thomasross/frcscout/loaders/TeamLoader.java View File

@@ -0,0 +1,43 @@
1
+package io.thomasross.frcscout.loaders;
2
+
3
+import android.content.AsyncTaskLoader;
4
+import android.content.Context;
5
+import android.database.Cursor;
6
+import android.database.sqlite.SQLiteDatabase;
7
+import io.thomasross.frcscout.TeamsOpenHelper;
8
+
9
+public class TeamLoader extends AsyncTaskLoader<Cursor>
10
+{
11
+    TeamsOpenHelper teamsDatabase;
12
+
13
+    String[] columns;
14
+    String where;
15
+    String[] whereArgs;
16
+
17
+    public TeamLoader(Context context, String[] columns, String where, String[] whereArgs)
18
+    {
19
+        super(context);
20
+
21
+        teamsDatabase = new TeamsOpenHelper(context);
22
+
23
+        this.columns = columns;
24
+        this.where = where;
25
+        this.whereArgs = whereArgs;
26
+    }
27
+
28
+    @Override
29
+    public Cursor loadInBackground()
30
+    {
31
+        SQLiteDatabase readableDB = teamsDatabase.getReadableDatabase();
32
+
33
+        Cursor results = readableDB.query("Teams",
34
+                columns,
35
+                where,
36
+                whereArgs,
37
+                null,
38
+                null,
39
+                null);
40
+
41
+        return results;
42
+    }
43
+}

+ 55
- 0
app/src/main/java/io/thomasross/frcscout/tasks/DeleteTeamTask.java View File

@@ -0,0 +1,55 @@
1
+package io.thomasross.frcscout.tasks;
2
+
3
+import android.content.Context;
4
+import android.database.sqlite.SQLiteDatabase;
5
+import android.os.AsyncTask;
6
+import io.thomasross.frcscout.FinishedCallback;
7
+import io.thomasross.frcscout.TeamsOpenHelper;
8
+
9
+import java.util.ArrayList;
10
+
11
+public class DeleteTeamTask extends AsyncTask<Integer, Void, Void>
12
+{
13
+    Context context;
14
+    ArrayList<FinishedCallback> finishedCallbacks = new ArrayList<>();
15
+
16
+    public DeleteTeamTask(Context context)
17
+    {
18
+        this.context = context;
19
+    }
20
+
21
+    public void addFinishCallback(FinishedCallback callback)
22
+    {
23
+        finishedCallbacks.add(callback);
24
+    }
25
+
26
+    @Override
27
+    protected void onPostExecute(Void aVoid)
28
+    {
29
+        for (FinishedCallback callback : finishedCallbacks)
30
+        {
31
+            callback.done();
32
+        }
33
+
34
+        super.onPostExecute(aVoid);
35
+    }
36
+
37
+    @Override
38
+    protected Void doInBackground(Integer... params)
39
+    {
40
+        TeamsOpenHelper teamsDatabase = new TeamsOpenHelper(context);
41
+
42
+        SQLiteDatabase writeableDB = teamsDatabase.getWritableDatabase();
43
+
44
+        for (int teamNumber : params)
45
+        {
46
+            String where = "TEAMNUMBER = ?";
47
+            String[] whereArgs = {"" + teamNumber};
48
+            writeableDB.delete("Teams", where, whereArgs);
49
+        }
50
+
51
+        writeableDB.close();
52
+
53
+        return null;
54
+    }
55
+}

+ 60
- 0
app/src/main/java/io/thomasross/frcscout/tasks/InsertTeamTask.java View File

@@ -0,0 +1,60 @@
1
+package io.thomasross.frcscout.tasks;
2
+
3
+import android.content.ContentValues;
4
+import android.content.Context;
5
+import android.database.sqlite.SQLiteDatabase;
6
+import android.os.AsyncTask;
7
+import io.thomasross.frcscout.FinishedCallback;
8
+import io.thomasross.frcscout.Team;
9
+import io.thomasross.frcscout.TeamsOpenHelper;
10
+
11
+import java.util.ArrayList;
12
+
13
+public class InsertTeamTask extends AsyncTask<Team, Void, Void>
14
+{
15
+    Context context;
16
+    ArrayList<FinishedCallback> finishedCallbacks = new ArrayList<>();
17
+
18
+    public InsertTeamTask(Context context)
19
+    {
20
+        this.context = context;
21
+    }
22
+
23
+    public void addFinishCallback(FinishedCallback callback)
24
+    {
25
+        finishedCallbacks.add(callback);
26
+    }
27
+
28
+    @Override
29
+    protected void onPostExecute(Void aVoid)
30
+    {
31
+        for (FinishedCallback callback : finishedCallbacks)
32
+        {
33
+            callback.done();
34
+        }
35
+
36
+        super.onPostExecute(aVoid);
37
+    }
38
+
39
+    @Override
40
+    protected Void doInBackground(Team... teams)
41
+    {
42
+        TeamsOpenHelper teamsDatabase = new TeamsOpenHelper(context);
43
+
44
+        SQLiteDatabase writeableDB = teamsDatabase.getWritableDatabase();
45
+
46
+        for (Team team : teams)
47
+        {
48
+            ContentValues values = new ContentValues();
49
+            values.put("TEAMNUMBER", team.number);
50
+            values.put("TEAMNAME", team.name);
51
+            values.put("TASKS", team.tasks);
52
+            values.put("AUTOPTS", team.autoPoints);
53
+            writeableDB.insert("Teams", null, values);
54
+        }
55
+
56
+        writeableDB.close();
57
+
58
+        return null;
59
+    }
60
+}

+ 60
- 0
app/src/main/java/io/thomasross/frcscout/tasks/UpdateTeamTask.java View File

@@ -0,0 +1,60 @@
1
+package io.thomasross.frcscout.tasks;
2
+
3
+import android.content.ContentValues;
4
+import android.content.Context;
5
+import android.database.sqlite.SQLiteDatabase;
6
+import android.os.AsyncTask;
7
+import io.thomasross.frcscout.FinishedCallback;
8
+import io.thomasross.frcscout.Team;
9
+import io.thomasross.frcscout.TeamsOpenHelper;
10
+
11
+import java.util.ArrayList;
12
+
13
+public class UpdateTeamTask extends AsyncTask<Team, Void, Void>
14
+{
15
+    Context context;
16
+    ArrayList<FinishedCallback> finishedCallbacks = new ArrayList<>();
17
+
18
+    public UpdateTeamTask(Context context)
19
+    {
20
+        this.context = context;
21
+    }
22
+
23
+    public void addFinishCallback(FinishedCallback callback)
24
+    {
25
+        finishedCallbacks.add(callback);
26
+    }
27
+
28
+    @Override
29
+    protected void onPostExecute(Void aVoid)
30
+    {
31
+        for (FinishedCallback callback : finishedCallbacks)
32
+        {
33
+            callback.done();
34
+        }
35
+
36
+        super.onPostExecute(aVoid);
37
+    }
38
+
39
+    @Override
40
+    protected Void doInBackground(Team... params)
41
+    {
42
+        TeamsOpenHelper teamsDatabase = new TeamsOpenHelper(context);
43
+
44
+        SQLiteDatabase writeableDB = teamsDatabase.getWritableDatabase();
45
+
46
+        for (Team team : params)
47
+        {
48
+            ContentValues values = new ContentValues();
49
+            values.put("TEAMNAME", team.name);
50
+            values.put("TASKS", team.tasks);
51
+            values.put("AUTOPTS", team.autoPoints);
52
+            String[] whereArgs = {"" + team.number};
53
+            writeableDB.update("Teams", values, "TEAMNUMBER = ?", whereArgs);
54
+        }
55
+
56
+        writeableDB.close();
57
+
58
+        return null;
59
+    }
60
+}

BIN
app/src/main/res/drawable-hdpi/ic_add_white.png View File


BIN
app/src/main/res/drawable-hdpi/ic_check_white.png View File


BIN
app/src/main/res/drawable-hdpi/ic_delete_white.png View File


BIN
app/src/main/res/drawable-mdpi/ic_add_white.png View File


BIN
app/src/main/res/drawable-mdpi/ic_check_white.png View File


BIN
app/src/main/res/drawable-mdpi/ic_delete_white.png View File


BIN
app/src/main/res/drawable-xhdpi/ic_add_white.png View File


BIN
app/src/main/res/drawable-xhdpi/ic_check_white.png View File


BIN
app/src/main/res/drawable-xhdpi/ic_delete_white.png View File


BIN
app/src/main/res/drawable-xxhdpi/ic_add_white.png View File


BIN
app/src/main/res/drawable-xxhdpi/ic_check_white.png View File


BIN
app/src/main/res/drawable-xxhdpi/ic_delete_white.png View File


+ 29
- 0
app/src/main/res/layout/activity_addteam.xml View File

@@ -0,0 +1,29 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3
+              android:orientation="vertical"
4
+              android:layout_width="match_parent"
5
+              android:layout_height="match_parent">
6
+
7
+    <TextView
8
+            android:layout_width="wrap_content"
9
+            android:layout_height="wrap_content"
10
+            android:textAppearance="?android:attr/textAppearanceMedium"
11
+            android:text="@string/teamnumber_lbl"
12
+            android:id="@+id/teamnumber_lbl_AT" android:labelFor="@+id/teamnumber_edit_AT"/>
13
+    <EditText
14
+            android:layout_width="match_parent"
15
+            android:layout_height="wrap_content"
16
+            android:inputType="number"
17
+            android:ems="10"
18
+            android:id="@+id/teamnumber_edit_AT"/>
19
+    <TextView
20
+            android:layout_width="wrap_content"
21
+            android:layout_height="wrap_content"
22
+            android:textAppearance="?android:attr/textAppearanceMedium"
23
+            android:text="@string/teamname_lbl"
24
+            android:id="@+id/teamname_lbl_AT" android:labelFor="@+id/teamname_edit_AT"/>
25
+    <EditText
26
+            android:layout_width="match_parent"
27
+            android:layout_height="wrap_content"
28
+            android:id="@+id/teamname_edit_AT" android:inputType="text"/>
29
+</LinearLayout>

+ 62
- 0
app/src/main/res/layout/activity_editteam.xml View File

@@ -0,0 +1,62 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3
+              xmlns:tools="http://schemas.android.com/tools"
4
+              android:orientation="vertical"
5
+              android:layout_width="match_parent"
6
+              android:layout_height="match_parent" android:weightSum="1">
7
+
8
+    <TextView
9
+            android:layout_width="wrap_content"
10
+            android:layout_height="wrap_content"
11
+            android:textAppearance="?android:attr/textAppearanceMedium"
12
+            android:text="@string/teamnumber_lbl"
13
+            android:id="@+id/teamnumber_lbl_ET" android:labelFor="@+id/teamnumber_edit_ET"
14
+            android:textSize="18sp"/>
15
+    <EditText
16
+            android:layout_width="match_parent"
17
+            android:layout_height="wrap_content"
18
+            android:inputType="number"
19
+            android:ems="10"
20
+            android:id="@+id/teamnumber_edit_ET"
21
+            android:clickable="false"
22
+            android:editable="false"/>
23
+    <TextView android:layout_width="wrap_content" android:layout_height="wrap_content"
24
+              android:textAppearance="?android:attr/textAppearanceMedium" android:text="@string/teamname_lbl"
25
+              android:id="@+id/teamname_lbl_ET" android:labelFor="@+id/teamname_edit_ET"
26
+              android:textIsSelectable="false"
27
+              android:textSize="18sp"/>
28
+    <EditText android:layout_width="match_parent" android:layout_height="wrap_content"
29
+              android:ems="10" android:id="@+id/teamname_edit_ET" android:inputType="text"
30
+    />
31
+
32
+    <LinearLayout
33
+            android:orientation="horizontal"
34
+            android:layout_width="match_parent"
35
+            android:layout_height="wrap_content">
36
+
37
+        <TextView
38
+                android:layout_width="wrap_content"
39
+                android:layout_height="wrap_content"
40
+                android:text="@string/autonomouspoints_lbl"
41
+                android:id="@+id/autonomouspoints_lbl_ET"
42
+                android:textSize="18sp"
43
+                android:labelFor="@+id/autonomouspoints_edit_ET"/>
44
+
45
+        <EditText
46
+                android:layout_width="0dp"
47
+                android:layout_height="wrap_content"
48
+                android:inputType="numberSigned"
49
+                android:ems="10"
50
+                android:id="@+id/autonomouspoints_edit_ET"
51
+                android:layout_weight="1"/>
52
+
53
+    </LinearLayout>
54
+
55
+    <ListView
56
+            android:layout_width="match_parent"
57
+            android:layout_height="0dp"
58
+            android:id="@+id/tasksList"
59
+            android:layout_weight="1"
60
+            tools:listitem="@layout/tasklistitem"/>
61
+
62
+</LinearLayout>

+ 33
- 0
app/src/main/res/layout/activity_main.xml View File

@@ -0,0 +1,33 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<android.support.design.widget.CoordinatorLayout
3
+        xmlns:android="http://schemas.android.com/apk/res/android"
4
+        xmlns:app="http://schemas.android.com/apk/res-auto"
5
+        android:layout_width="match_parent"
6
+        android:layout_height="match_parent">
7
+
8
+    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
9
+                  xmlns:tools="http://schemas.android.com/tools"
10
+                  android:orientation="vertical"
11
+                  android:layout_width="fill_parent"
12
+                  android:layout_height="fill_parent">
13
+
14
+        <ListView
15
+                android:layout_width="match_parent"
16
+                android:layout_height="wrap_content"
17
+                android:id="@+id/teamListView"
18
+                android:clickable="true"
19
+                tools:listitem="@android:layout/simple_list_item_2"/>
20
+
21
+    </LinearLayout>
22
+
23
+    <android.support.design.widget.FloatingActionButton
24
+            android:layout_height="wrap_content"
25
+            android:layout_width="wrap_content"
26
+            android:layout_margin="16dp"
27
+            android:clickable="true"
28
+            android:src="@drawable/ic_add_white"
29
+            android:id="@+id/addTeam"
30
+            android:layout_gravity="bottom|end"
31
+            app:backgroundTint="@color/primary"/>
32
+
33
+</android.support.design.widget.CoordinatorLayout>

+ 9
- 0
app/src/main/res/layout/simpletextview.xml View File

@@ -0,0 +1,9 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<TextView xmlns:android="http://schemas.android.com/apk/res/android"
3
+          android:padding="6dip"
4
+          android:orientation="vertical"
5
+          android:layout_width="match_parent"
6
+          android:layout_height="match_parent"
7
+          android:textColor="#212121"
8
+          android:textSize="15sp">
9
+</TextView>

+ 18
- 0
app/src/main/res/layout/tasklistitem.xml View File

@@ -0,0 +1,18 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
3
+                android:orientation="vertical"
4
+                android:layout_width="match_parent"
5
+                android:layout_height="match_parent"
6
+                android:padding="6dip">
7
+
8
+    <CheckBox
9
+            xmlns:android="http://schemas.android.com/apk/res/android"
10
+            android:layout_width="fill_parent"
11
+            android:layout_height="wrap_content"
12
+            android:text="Hello, World!"
13
+            android:textColor="#212121"
14
+            android:textSize="20sp"
15
+            android:id="@+id/checkBox"
16
+    />
17
+
18
+</RelativeLayout>

+ 10
- 0
app/src/main/res/menu/menu_addteam.xml View File

@@ -0,0 +1,10 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<menu xmlns:android="http://schemas.android.com/apk/res/android"
3
+      xmlns:app="http://schemas.android.com/apk/res-auto">
4
+
5
+    <item android:id="@+id/action_checkmark_AT"
6
+          android:icon="@drawable/ic_check_white"
7
+          android:title="@string/done_btn"
8
+          app:showAsAction="ifRoom"/>
9
+
10
+</menu>

+ 15
- 0
app/src/main/res/menu/menu_editteam.xml View File

@@ -0,0 +1,15 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<menu xmlns:android="http://schemas.android.com/apk/res/android"
3
+      xmlns:app="http://schemas.android.com/apk/res-auto">
4
+
5
+    <item android:id="@+id/action_checkmark_ET"
6
+          android:icon="@drawable/ic_check_white"
7
+          android:title="@string/done_btn"
8
+          app:showAsAction="ifRoom"/>
9
+
10
+    <item android:id="@+id/action_delete_ET"
11
+          android:icon="@drawable/ic_delete_white"
12
+          android:title="@string/delete_btn"
13
+          app:showAsAction="ifRoom"/>
14
+
15
+</menu>

BIN
app/src/main/res/mipmap-hdpi/ic_launcher.png View File


BIN
app/src/main/res/mipmap-mdpi/ic_launcher.png View File


BIN
app/src/main/res/mipmap-xhdpi/ic_launcher.png View File


BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher.png View File


BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher.png View File


+ 6
- 0
app/src/main/res/values-w820dp/dimens.xml View File

@@ -0,0 +1,6 @@
1
+<resources>
2
+    <!-- Example customization of dimensions originally defined in res/values/dimens.xml
3
+         (such as screen margins) for screens with more than 820dp of available width. This
4
+         would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively). -->
5
+    <dimen name="activity_horizontal_margin">64dp</dimen>
6
+</resources>

+ 5
- 0
app/src/main/res/values/colors.xml View File

@@ -0,0 +1,5 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<resources>
3
+    <color name="primary">#1565c0</color>
4
+    <color name="primaryDark">#0d47a1</color>
5
+</resources>

+ 5
- 0
app/src/main/res/values/dimens.xml View File

@@ -0,0 +1,5 @@
1
+<resources>
2
+    <!-- Default screen margins, per the Android Design guidelines. -->
3
+    <dimen name="activity_horizontal_margin">16dp</dimen>
4
+    <dimen name="activity_vertical_margin">16dp</dimen>
5
+</resources>

+ 9
- 0
app/src/main/res/values/strings.xml View File

@@ -0,0 +1,9 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<resources>
3
+    <string name="app_name">FRC Scout</string>
4
+    <string name="teamnumber_lbl">Team Number</string>
5
+    <string name="teamname_lbl">Team Name</string>
6
+    <string name="done_btn">Done</string>
7
+    <string name="delete_btn">Delete</string>
8
+    <string name="autonomouspoints_lbl">Autonomous Points</string>
9
+</resources>

+ 6
- 0
app/src/main/res/values/styles.xml View File

@@ -0,0 +1,6 @@
1
+<resources>
2
+    <style name="FrcScoutTheme" parent="Theme.AppCompat.Light.DarkActionBar">
3
+        <item name="colorPrimary">@color/primary</item>
4
+        <item name="colorPrimaryDark">@color/primaryDark</item>
5
+    </style>
6
+</resources>

+ 17
- 0
app/src/test/java/io/thomasross/frcscout/ExampleUnitTest.java View File

@@ -0,0 +1,17 @@
1
+package io.thomasross.frcscout;
2
+
3
+import org.junit.Test;
4
+
5
+import static org.junit.Assert.*;
6
+
7
+/**
8
+ * To work on unit tests, switch the Test Artifact in the Build Variants view.
9
+ */
10
+public class ExampleUnitTest
11
+{
12
+    @Test
13
+    public void addition_isCorrect() throws Exception
14
+    {
15
+        assertEquals(4, 2 + 2);
16
+    }
17
+}

+ 23
- 0
build.gradle View File

@@ -0,0 +1,23 @@
1
+// Top-level build file where you can add configuration options common to all sub-projects/modules.
2
+
3
+buildscript {
4
+    repositories {
5
+        jcenter()
6
+    }
7
+    dependencies {
8
+        classpath 'com.android.tools.build:gradle:2.0.0'
9
+
10
+        // NOTE: Do not place your application dependencies here; they belong
11
+        // in the individual module build.gradle files
12
+    }
13
+}
14
+
15
+allprojects {
16
+    repositories {
17
+        jcenter()
18
+    }
19
+}
20
+
21
+task clean(type: Delete) {
22
+    delete rootProject.buildDir
23
+}

+ 18
- 0
gradle.properties View File

@@ -0,0 +1,18 @@
1
+# Project-wide Gradle settings.
2
+
3
+# IDE (e.g. Android Studio) users:
4
+# Gradle settings configured through the IDE *will override*
5
+# any settings specified in this file.
6
+
7
+# For more details on how to configure your build environment visit
8
+# http://www.gradle.org/docs/current/userguide/build_environment.html
9
+
10
+# Specifies the JVM arguments used for the daemon process.
11
+# The setting is particularly useful for tweaking memory settings.
12
+# Default value: -Xmx10248m -XX:MaxPermSize=256m
13
+# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
14
+
15
+# When configured, Gradle will run in incubating parallel mode.
16
+# This option should only be used with decoupled projects. More details, visit
17
+# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18
+# org.gradle.parallel=true

BIN
gradle/wrapper/gradle-wrapper.jar View File


+ 6
- 0
gradle/wrapper/gradle-wrapper.properties View File

@@ -0,0 +1,6 @@
1
+#Mon Dec 28 10:00:20 PST 2015
2
+distributionBase=GRADLE_USER_HOME
3
+distributionPath=wrapper/dists
4
+zipStoreBase=GRADLE_USER_HOME
5
+zipStorePath=wrapper/dists
6
+distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip

+ 160
- 0
gradlew View File

@@ -0,0 +1,160 @@
1
+#!/usr/bin/env bash
2
+
3
+##############################################################################
4
+##
5
+##  Gradle start up script for UN*X
6
+##
7
+##############################################################################
8
+
9
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10
+DEFAULT_JVM_OPTS=""
11
+
12
+APP_NAME="Gradle"
13
+APP_BASE_NAME=`basename "$0"`
14
+
15
+# Use the maximum available, or set MAX_FD != -1 to use that value.
16
+MAX_FD="maximum"
17
+
18
+warn ( ) {
19
+    echo "$*"
20
+}
21
+
22
+die ( ) {
23
+    echo
24
+    echo "$*"
25
+    echo
26
+    exit 1
27
+}
28
+
29
+# OS specific support (must be 'true' or 'false').
30
+cygwin=false
31
+msys=false
32
+darwin=false
33
+case "`uname`" in
34
+  CYGWIN* )
35
+    cygwin=true
36
+    ;;
37
+  Darwin* )
38
+    darwin=true
39
+    ;;
40
+  MINGW* )
41
+    msys=true
42
+    ;;
43
+esac
44
+
45
+# Attempt to set APP_HOME
46
+# Resolve links: $0 may be a link
47
+PRG="$0"
48
+# Need this for relative symlinks.
49
+while [ -h "$PRG" ] ; do
50
+    ls=`ls -ld "$PRG"`
51
+    link=`expr "$ls" : '.*-> \(.*\)$'`
52
+    if expr "$link" : '/.*' > /dev/null; then
53
+        PRG="$link"
54
+    else
55
+        PRG=`dirname "$PRG"`"/$link"
56
+    fi
57
+done
58
+SAVED="`pwd`"
59
+cd "`dirname \"$PRG\"`/" >/dev/null
60
+APP_HOME="`pwd -P`"
61
+cd "$SAVED" >/dev/null
62
+
63
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
64
+
65
+# Determine the Java command to use to start the JVM.
66
+if [ -n "$JAVA_HOME" ] ; then
67
+    if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
68
+        # IBM's JDK on AIX uses strange locations for the executables
69
+        JAVACMD="$JAVA_HOME/jre/sh/java"
70
+    else
71
+        JAVACMD="$JAVA_HOME/bin/java"
72
+    fi
73
+    if [ ! -x "$JAVACMD" ] ; then
74
+        die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
75
+
76
+Please set the JAVA_HOME variable in your environment to match the
77
+location of your Java installation."
78
+    fi
79
+else
80
+    JAVACMD="java"
81
+    which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
82
+
83
+Please set the JAVA_HOME variable in your environment to match the
84
+location of your Java installation."
85
+fi
86
+
87
+# Increase the maximum file descriptors if we can.
88
+if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
89
+    MAX_FD_LIMIT=`ulimit -H -n`
90
+    if [ $? -eq 0 ] ; then
91
+        if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
92
+            MAX_FD="$MAX_FD_LIMIT"
93
+        fi
94
+        ulimit -n $MAX_FD
95
+        if [ $? -ne 0 ] ; then
96
+            warn "Could not set maximum file descriptor limit: $MAX_FD"
97
+        fi
98
+    else
99
+        warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
100
+    fi
101
+fi
102
+
103
+# For Darwin, add options to specify how the application appears in the dock
104
+if $darwin; then
105
+    GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
106
+fi
107
+
108
+# For Cygwin, switch paths to Windows format before running java
109
+if $cygwin ; then
110
+    APP_HOME=`cygpath --path --mixed "$APP_HOME"`
111
+    CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
112
+    JAVACMD=`cygpath --unix "$JAVACMD"`
113
+
114
+    # We build the pattern for arguments to be converted via cygpath
115
+    ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
116
+    SEP=""
117
+    for dir in $ROOTDIRSRAW ; do
118
+        ROOTDIRS="$ROOTDIRS$SEP$dir"
119
+        SEP="|"
120
+    done
121
+    OURCYGPATTERN="(^($ROOTDIRS))"
122
+    # Add a user-defined pattern to the cygpath arguments
123
+    if [ "$GRADLE_CYGPATTERN" != "" ] ; then
124
+        OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
125
+    fi
126
+    # Now convert the arguments - kludge to limit ourselves to /bin/sh
127
+    i=0
128
+    for arg in "$@" ; do
129
+        CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
130
+        CHECK2=`echo "$arg"|egrep -c "^-"`                                 ### Determine if an option
131
+
132
+        if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then                    ### Added a condition
133
+            eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
134
+        else
135
+            eval `echo args$i`="\"$arg\""
136
+        fi
137
+        i=$((i+1))
138
+    done
139
+    case $i in
140
+        (0) set -- ;;
141
+        (1) set -- "$args0" ;;
142
+        (2) set -- "$args0" "$args1" ;;
143
+        (3) set -- "$args0" "$args1" "$args2" ;;
144
+        (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
145
+        (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
146
+        (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
147
+        (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
148
+        (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
149
+        (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
150
+    esac
151
+fi
152
+
153
+# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
154
+function splitJvmOpts() {
155
+    JVM_OPTS=("$@")
156
+}
157
+eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
158
+JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
159
+
160
+exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"

+ 90
- 0
gradlew.bat View File

@@ -0,0 +1,90 @@
1
+@if "%DEBUG%" == "" @echo off
2
+@rem ##########################################################################
3
+@rem
4
+@rem  Gradle startup script for Windows
5
+@rem
6
+@rem ##########################################################################
7
+
8
+@rem Set local scope for the variables with windows NT shell
9
+if "%OS%"=="Windows_NT" setlocal
10
+
11
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12
+set DEFAULT_JVM_OPTS=
13
+
14
+set DIRNAME=%~dp0
15
+if "%DIRNAME%" == "" set DIRNAME=.
16
+set APP_BASE_NAME=%~n0
17
+set APP_HOME=%DIRNAME%
18
+
19
+@rem Find java.exe
20
+if defined JAVA_HOME goto findJavaFromJavaHome
21
+
22
+set JAVA_EXE=java.exe
23
+%JAVA_EXE% -version >NUL 2>&1
24
+if "%ERRORLEVEL%" == "0" goto init
25
+
26
+echo.
27
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28
+echo.
29
+echo Please set the JAVA_HOME variable in your environment to match the
30
+echo location of your Java installation.
31
+
32
+goto fail
33
+
34
+:findJavaFromJavaHome
35
+set JAVA_HOME=%JAVA_HOME:"=%
36
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37
+
38
+if exist "%JAVA_EXE%" goto init
39
+
40
+echo.
41
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42
+echo.
43
+echo Please set the JAVA_HOME variable in your environment to match the
44
+echo location of your Java installation.
45
+
46
+goto fail
47
+
48
+:init
49
+@rem Get command-line arguments, handling Windowz variants
50
+
51
+if not "%OS%" == "Windows_NT" goto win9xME_args
52
+if "%@eval[2+2]" == "4" goto 4NT_args
53
+
54
+:win9xME_args
55
+@rem Slurp the command line arguments.
56
+set CMD_LINE_ARGS=
57
+set _SKIP=2
58
+
59
+:win9xME_args_slurp
60
+if "x%~1" == "x" goto execute
61
+
62
+set CMD_LINE_ARGS=%*
63
+goto execute
64
+
65
+:4NT_args
66
+@rem Get arguments from the 4NT Shell from JP Software
67
+set CMD_LINE_ARGS=%$
68
+
69
+:execute
70
+@rem Setup the command line
71
+
72
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73
+
74
+@rem Execute Gradle
75
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76
+
77
+:end
78
+@rem End local scope for the variables with windows NT shell
79
+if "%ERRORLEVEL%"=="0" goto mainEnd
80
+
81
+:fail
82
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83
+rem the _cmd.exe /c_ return code!
84
+if  not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85
+exit /b 1
86
+
87
+:mainEnd
88
+if "%OS%"=="Windows_NT" endlocal
89
+
90
+:omega

+ 1
- 0
settings.gradle View File

@@ -0,0 +1 @@
1
+include ':app'