aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Android_Studio
diff options
context:
space:
mode:
Diffstat (limited to 'Software/Android_Studio')
-rw-r--r--Software/Android_Studio/Tango.BL/src/androidTest/java/com/twine/tango/bl/ExampleInstrumentedTest.java29
-rw-r--r--Software/Android_Studio/Tango.BL/src/test/java/com/twine/tango/bl/ExampleUnitTest.java17
-rw-r--r--Software/Android_Studio/Tango.Core/src/androidTest/java/com/twine/tango/core/ExampleInstrumentedTest.java26
-rw-r--r--Software/Android_Studio/Tango.Core/src/main/java/com/twine/tango/core/ContextHelper.java7
-rw-r--r--Software/Android_Studio/Tango.Core/src/main/java/com/twine/tango/core/Event.java38
-rw-r--r--Software/Android_Studio/Tango.Core/src/main/java/com/twine/tango/core/IAction.java2
-rw-r--r--Software/Android_Studio/Tango.Core/src/main/java/com/twine/tango/core/IAction1.java2
-rw-r--r--Software/Android_Studio/Tango.Core/src/main/java/com/twine/tango/core/IEventHandler.java20
-rw-r--r--Software/Android_Studio/Tango.Core/src/main/java/com/twine/tango/core/ObjectDisposedException.java15
-rw-r--r--Software/Android_Studio/Tango.Core/src/main/java/com/twine/tango/core/ObservableCollection.java12
-rw-r--r--Software/Android_Studio/Tango.Core/src/main/java/com/twine/tango/core/ReflectionsHelper.java18
-rw-r--r--Software/Android_Studio/Tango.Core/src/test/java/com/twine/tango/core/ExampleUnitTest.java17
-rw-r--r--Software/Android_Studio/Tango.DAL/src/androidTest/java/com/twine/tango/dal/ExampleInstrumentedTest.java28
-rw-r--r--Software/Android_Studio/Tango.DAL/src/main/java/com/twine/tango/dal/MyOpenHelper.java28
-rw-r--r--Software/Android_Studio/Tango.DAL/src/main/java/com/twine/tango/dal/TangoDB.java152
-rw-r--r--Software/Android_Studio/Tango.DAL/src/main/java/com/twine/tango/dal/entities/Address.java74
-rw-r--r--Software/Android_Studio/Tango.DAL/src/main/java/com/twine/tango/dal/entities/Contact.java64
-rw-r--r--Software/Android_Studio/Tango.DAL/src/main/java/com/twine/tango/dal/entities/DateConverter.java4
-rw-r--r--Software/Android_Studio/Tango.DAL/src/main/java/com/twine/tango/dal/entities/Entity.java47
-rw-r--r--Software/Android_Studio/Tango.DAL/src/main/java/com/twine/tango/dal/entities/Organization.java34
-rw-r--r--Software/Android_Studio/Tango.DAL/src/main/res/raw/tangodbbin516096 -> 516096 bytes
-rw-r--r--Software/Android_Studio/Tango.DAL/src/test/java/com/twine/tango/dal/ExampleUnitTest.java19
-rw-r--r--Software/Android_Studio/Tango.Integration/src/main/java/com/twine/tango/integration/IMachineIdentityProvider.java9
-rw-r--r--Software/Android_Studio/Tango.Integration/src/main/java/com/twine/tango/integration/MachineIdentityProvider.java5
-rw-r--r--Software/Android_Studio/Tango.PMR/src/main/java/com/twine/tango/pmr/MessageFactory.java67
-rw-r--r--Software/Android_Studio/Tango.PMR/src/main/java/com/twine/tango/pmr/TangoMessage.java31
-rw-r--r--Software/Android_Studio/Tango.SharedUI/build.gradle1
-rw-r--r--Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/TangoApplication.java (renamed from Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/AppInitializer.java)45
-rw-r--r--Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/binding_adapters/BindingAdapters.java59
-rw-r--r--Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/binding_converters/ObjectToIntConverter.java4
-rw-r--r--Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/containers/ActivityBase.java46
-rw-r--r--Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/containers/ActivityCallbackService.java59
-rw-r--r--Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/containers/FragmentBase.java48
-rw-r--r--Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/containers/FragmentBaseV4.java35
-rw-r--r--Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/editors/IParameterized.java9
-rw-r--r--Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/editors/ParameterAnnotation.java33
-rw-r--r--Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/editors/ParameterItem.java85
-rw-r--r--Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/editors/ParameterizedEditor.java34
-rw-r--r--Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/mvvm/DependencyProperty.java41
-rw-r--r--Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/mvvm/FieldUtils.java16
-rw-r--r--Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/mvvm/IView.java12
-rw-r--r--Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/mvvm/ReadOnlyField.java23
-rw-r--r--Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/mvvm/RelayCommand.java70
-rw-r--r--Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/mvvm/ViewModelBase.java28
-rw-r--r--Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/navigation/AndroidNavigationProvider.java9
-rw-r--r--Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/navigation/INavigationProvider.java35
-rw-r--r--Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/notifications/AndroidNotificationProvider.java14
-rw-r--r--Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/notifications/INotificationProvider.java26
-rw-r--r--Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/paging/PagerAdapter.java33
-rw-r--r--Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/paging/PagerZoomTransform.java3
-rw-r--r--Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/validation/IViewValidator.java4
-rw-r--r--Software/Android_Studio/Tango.Stubs.UI/src/main/java/com/twine/tango/stubs/ui/App.java42
-rw-r--r--Software/Android_Studio/Tango.Stubs/src/main/java/com/twine/tango/stubs/AvailableStub.java47
-rw-r--r--Software/Android_Studio/Tango.Stubs/src/main/java/com/twine/tango/stubs/IStub.java21
-rw-r--r--Software/Android_Studio/Tango.Stubs/src/main/java/com/twine/tango/stubs/StubAnnotation.java24
-rw-r--r--Software/Android_Studio/Tango.Stubs/src/main/java/com/twine/tango/stubs/StubBase.java51
-rw-r--r--Software/Android_Studio/Tango.Stubs/src/main/java/com/twine/tango/stubs/StubDirection.java13
-rw-r--r--Software/Android_Studio/Tango.Stubs/src/main/java/com/twine/tango/stubs/StubState.java19
-rw-r--r--Software/Android_Studio/Tango.Stubs/src/main/java/com/twine/tango/stubs/stubs/Calculate.java16
-rw-r--r--Software/Android_Studio/Tango.Stubs/src/main/java/com/twine/tango/stubs/stubs/Progress.java15
-rw-r--r--Software/Android_Studio/Tango.Synchronization/src/main/java/com/twine/tango/synchronization/ITangoSynchronizer.java13
-rw-r--r--Software/Android_Studio/Tango.Synchronization/src/main/java/com/twine/tango/synchronization/TangoSynchronizer.java26
-rw-r--r--Software/Android_Studio/Tango.Transport/src/main/java/com/twine/tango/transport/ITransportAdapter.java6
-rw-r--r--Software/Android_Studio/Tango.Transport/src/main/java/com/twine/tango/transport/ITransportComponent.java9
-rw-r--r--Software/Android_Studio/Tango.Transport/src/main/java/com/twine/tango/transport/ITransporter.java97
-rw-r--r--Software/Android_Studio/Tango.Transport/src/main/java/com/twine/tango/transport/TransportAdapterBase.java45
-rw-r--r--Software/Android_Studio/Tango.Transport/src/main/java/com/twine/tango/transport/TransportMessage.java16
-rw-r--r--Software/Android_Studio/Tango.Transport/src/main/java/com/twine/tango/transport/TransportMessageBase.java84
-rw-r--r--Software/Android_Studio/Tango.Transport/src/main/java/com/twine/tango/transport/TransportMessageDirection.java10
-rw-r--r--Software/Android_Studio/Tango.Transport/src/main/java/com/twine/tango/transport/TransporterBase.java81
-rw-r--r--Software/Android_Studio/Tango.Transport/src/main/java/com/twine/tango/transport/transporters/ProtoTransporter.java16
-rw-r--r--Software/Android_Studio/Tango.UnitTesting/src/androidTest/java/com/twine/tango/unittesting/Synchronization_TST.java33
-rw-r--r--Software/Android_Studio/Tango.UnitTesting/src/main/java/com/twine/tango/unittesting/App.java9
-rw-r--r--Software/Android_Studio/Tango.UnitTesting/src/main/res/layout/activity_main.xml3
-rw-r--r--Software/Android_Studio/Tango.Web/src/main/java/com/twine/tango/web/WebApiFactory.java35
-rw-r--r--Software/Android_Studio/app/.gitignore1
-rw-r--r--Software/Android_Studio/app/CMakeLists.txt44
-rw-r--r--Software/Android_Studio/app/build.gradle41
-rw-r--r--Software/Android_Studio/app/proguard-rules.pro25
-rw-r--r--Software/Android_Studio/app/src/androidTest/java/com/twine/tango/ExampleInstrumentedTest.java29
-rw-r--r--Software/Android_Studio/app/src/main/AndroidManifest.xml21
-rw-r--r--Software/Android_Studio/app/src/main/cpp/Android.mk0
-rw-r--r--Software/Android_Studio/app/src/main/cpp/native-lib.cpp13
-rw-r--r--Software/Android_Studio/app/src/main/java/com/twine/tango/MainActivity.java34
-rw-r--r--Software/Android_Studio/app/src/main/res/drawable/ic_launcher_background.xml113
-rw-r--r--Software/Android_Studio/app/src/main/res/layout/activity_main.xml19
-rw-r--r--Software/Android_Studio/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml5
-rw-r--r--Software/Android_Studio/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml5
-rw-r--r--Software/Android_Studio/app/src/main/res/mipmap-hdpi/ic_launcher.pngbin3358 -> 0 bytes
-rw-r--r--Software/Android_Studio/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.pngbin5117 -> 0 bytes
-rw-r--r--Software/Android_Studio/app/src/main/res/mipmap-hdpi/ic_launcher_round.pngbin5084 -> 0 bytes
-rw-r--r--Software/Android_Studio/app/src/main/res/mipmap-mdpi/ic_launcher.pngbin2386 -> 0 bytes
-rw-r--r--Software/Android_Studio/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.pngbin2652 -> 0 bytes
-rw-r--r--Software/Android_Studio/app/src/main/res/mipmap-mdpi/ic_launcher_round.pngbin3179 -> 0 bytes
-rw-r--r--Software/Android_Studio/app/src/main/res/mipmap-xhdpi/ic_launcher.pngbin4648 -> 0 bytes
-rw-r--r--Software/Android_Studio/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.pngbin7011 -> 0 bytes
-rw-r--r--Software/Android_Studio/app/src/main/res/mipmap-xhdpi/ic_launcher_round.pngbin7381 -> 0 bytes
-rw-r--r--Software/Android_Studio/app/src/main/res/mipmap-xxhdpi/ic_launcher.pngbin7008 -> 0 bytes
-rw-r--r--Software/Android_Studio/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.pngbin14578 -> 0 bytes
-rw-r--r--Software/Android_Studio/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.pngbin11545 -> 0 bytes
-rw-r--r--Software/Android_Studio/app/src/main/res/mipmap-xxxhdpi/ic_launcher.pngbin9442 -> 0 bytes
-rw-r--r--Software/Android_Studio/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.pngbin21908 -> 0 bytes
-rw-r--r--Software/Android_Studio/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.pngbin16109 -> 0 bytes
-rw-r--r--Software/Android_Studio/app/src/main/res/values/colors.xml6
-rw-r--r--Software/Android_Studio/app/src/main/res/values/strings.xml3
-rw-r--r--Software/Android_Studio/app/src/main/res/values/styles.xml11
-rw-r--r--Software/Android_Studio/app/src/test/java/com/twine/tango/ExampleUnitTest.java20
-rw-r--r--Software/Android_Studio/app/src/test/java/com/twine/tango/PMR_TST.java73
-rw-r--r--Software/Android_Studio/settings.gradle2
109 files changed, 1652 insertions, 1081 deletions
diff --git a/Software/Android_Studio/Tango.BL/src/androidTest/java/com/twine/tango/bl/ExampleInstrumentedTest.java b/Software/Android_Studio/Tango.BL/src/androidTest/java/com/twine/tango/bl/ExampleInstrumentedTest.java
deleted file mode 100644
index 53e0be06b..000000000
--- a/Software/Android_Studio/Tango.BL/src/androidTest/java/com/twine/tango/bl/ExampleInstrumentedTest.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package com.twine.tango.bl;
-
-import android.content.Context;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import static org.junit.Assert.*;
-
-/**
- * Instrumented test, which will execute on an Android device.
- *
- * @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
- */
-@RunWith(AndroidJUnit4.class)
-public class ExampleInstrumentedTest {
- @Test
- public void useAppContext() throws Exception {
- // Context of the app under test.
- Context appContext = InstrumentationRegistry.getTargetContext();
-
- Example e = new Example();
- e.Do();
-
- assertEquals("com.twine.tango.bl.test", appContext.getPackageName());
- }
-}
diff --git a/Software/Android_Studio/Tango.BL/src/test/java/com/twine/tango/bl/ExampleUnitTest.java b/Software/Android_Studio/Tango.BL/src/test/java/com/twine/tango/bl/ExampleUnitTest.java
deleted file mode 100644
index 5db76b579..000000000
--- a/Software/Android_Studio/Tango.BL/src/test/java/com/twine/tango/bl/ExampleUnitTest.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package com.twine.tango.bl;
-
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-/**
- * Example local unit test, which will execute on the development machine (host).
- *
- * @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
- */
-public class ExampleUnitTest {
- @Test
- public void addition_isCorrect() throws Exception {
- assertEquals(4, 2 + 2);
- }
-} \ No newline at end of file
diff --git a/Software/Android_Studio/Tango.Core/src/androidTest/java/com/twine/tango/core/ExampleInstrumentedTest.java b/Software/Android_Studio/Tango.Core/src/androidTest/java/com/twine/tango/core/ExampleInstrumentedTest.java
deleted file mode 100644
index dd94a8561..000000000
--- a/Software/Android_Studio/Tango.Core/src/androidTest/java/com/twine/tango/core/ExampleInstrumentedTest.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package com.twine.tango.core;
-
-import android.content.Context;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import static org.junit.Assert.*;
-
-/**
- * Instrumented test, which will execute on an Android device.
- *
- * @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
- */
-@RunWith(AndroidJUnit4.class)
-public class ExampleInstrumentedTest {
- @Test
- public void useAppContext() throws Exception {
- // Context of the app under test.
- Context appContext = InstrumentationRegistry.getTargetContext();
-
- assertEquals("com.twine.tango.core.test", appContext.getPackageName());
- }
-}
diff --git a/Software/Android_Studio/Tango.Core/src/main/java/com/twine/tango/core/ContextHelper.java b/Software/Android_Studio/Tango.Core/src/main/java/com/twine/tango/core/ContextHelper.java
index 73466a093..768376d9d 100644
--- a/Software/Android_Studio/Tango.Core/src/main/java/com/twine/tango/core/ContextHelper.java
+++ b/Software/Android_Studio/Tango.Core/src/main/java/com/twine/tango/core/ContextHelper.java
@@ -6,12 +6,13 @@ import android.content.Context;
/**
* Represents a context helper used by all libraries in the project.
*/
-public class ContextFactory
+public class ContextHelper
{
private static Context appContext;
/**
- * Init.
+ * Initializes the helper with the application context.
+ * Do this in application onCreate.
*
* @param context the context
*/
@@ -21,7 +22,7 @@ public class ContextFactory
}
/**
- * Gets application context.
+ * Gets the application context.
*
* @return the application context
*/
diff --git a/Software/Android_Studio/Tango.Core/src/main/java/com/twine/tango/core/Event.java b/Software/Android_Studio/Tango.Core/src/main/java/com/twine/tango/core/Event.java
index ab651601a..74c94c067 100644
--- a/Software/Android_Studio/Tango.Core/src/main/java/com/twine/tango/core/Event.java
+++ b/Software/Android_Studio/Tango.Core/src/main/java/com/twine/tango/core/Event.java
@@ -1,29 +1,44 @@
package com.twine.tango.core;
import java.util.ArrayList;
-import java.util.HashSet;
import java.util.List;
-import java.util.Set;
/**
- * Created by Roy on 11/20/2017.
+ * Represents C# like event simulation by holding a collection of event handlers.
+ *
+ * @param <T> the event handler type parameter
*/
-
public class Event<T>
{
- private List<EventHandler<T>> listeners = new ArrayList<>();
+ private List<IEventHandler<T>> listeners = new ArrayList<>();
- public void removeListener(EventHandler<T> listener)
+ /**
+ * Remove listener.
+ *
+ * @param listener the listener
+ */
+ public void removeListener(IEventHandler<T> listener)
{
listeners.remove(listener);
}
- public void addListener(EventHandler<T> listener)
+ /**
+ * Add listener.
+ *
+ * @param listener the listener
+ */
+ public void addListener(IEventHandler<T> listener)
{
listeners.add(listener);
}
+ /**
+ * Invoke the event for all listeners.
+ *
+ * @param sender the sender
+ * @param e the e
+ */
public void invoke(Object sender, T e)
{
@@ -32,4 +47,13 @@ public class Event<T>
listeners.get(i).invoke(sender, e);
}
}
+
+
+ /**
+ * Clears the collection of event handlers.
+ */
+ public void reset()
+ {
+ listeners.clear();
+ }
}
diff --git a/Software/Android_Studio/Tango.Core/src/main/java/com/twine/tango/core/IAction.java b/Software/Android_Studio/Tango.Core/src/main/java/com/twine/tango/core/IAction.java
index 1ecce493c..94a16da40 100644
--- a/Software/Android_Studio/Tango.Core/src/main/java/com/twine/tango/core/IAction.java
+++ b/Software/Android_Studio/Tango.Core/src/main/java/com/twine/tango/core/IAction.java
@@ -4,7 +4,7 @@ package com.twine.tango.core;
/**
* Represents an void Action delegate.
*/
-public interface Action
+public interface IAction
{
/**
* Invokes the action.
diff --git a/Software/Android_Studio/Tango.Core/src/main/java/com/twine/tango/core/IAction1.java b/Software/Android_Studio/Tango.Core/src/main/java/com/twine/tango/core/IAction1.java
index cfd2f9213..51770d087 100644
--- a/Software/Android_Studio/Tango.Core/src/main/java/com/twine/tango/core/IAction1.java
+++ b/Software/Android_Studio/Tango.Core/src/main/java/com/twine/tango/core/IAction1.java
@@ -6,7 +6,7 @@ package com.twine.tango.core;
*
* @param <T> the type parameter
*/
-public interface Action1<T> {
+public interface IAction1<T> {
/**
diff --git a/Software/Android_Studio/Tango.Core/src/main/java/com/twine/tango/core/IEventHandler.java b/Software/Android_Studio/Tango.Core/src/main/java/com/twine/tango/core/IEventHandler.java
index cb455ab4e..388e0d3ae 100644
--- a/Software/Android_Studio/Tango.Core/src/main/java/com/twine/tango/core/IEventHandler.java
+++ b/Software/Android_Studio/Tango.Core/src/main/java/com/twine/tango/core/IEventHandler.java
@@ -1,11 +1,19 @@
package com.twine.tango.core;
+
/**
- * Created by Roy on 11/13/2017.
+ * Represents an {@link Event} handler delegate.
+ *
+ * @param <T> the type parameter
*/
-
-public interface EventHandler<T> {
-
- void invoke(Object sender,T e);
-
+public interface IEventHandler<T>
+{
+
+ /**
+ * Invokes the handler callback.
+ *
+ * @param sender the sender
+ * @param args the event arguments.
+ */
+ void invoke(Object sender, T args);
}
diff --git a/Software/Android_Studio/Tango.Core/src/main/java/com/twine/tango/core/ObjectDisposedException.java b/Software/Android_Studio/Tango.Core/src/main/java/com/twine/tango/core/ObjectDisposedException.java
index 5cd676c7e..d3995e7b2 100644
--- a/Software/Android_Studio/Tango.Core/src/main/java/com/twine/tango/core/ObjectDisposedException.java
+++ b/Software/Android_Studio/Tango.Core/src/main/java/com/twine/tango/core/ObjectDisposedException.java
@@ -1,12 +1,17 @@
package com.twine.tango.core;
+
/**
- * Created by Roy on 11/13/2017.
+ * Represents an exception which indicates about an illegal access to an already disposed object.
*/
-
public class ObjectDisposedException extends IllegalAccessException {
-
- public ObjectDisposedException(String s) {
- super(s);
+
+ /**
+ * Instantiates a new Object disposed exception.
+ *
+ * @param message the message
+ */
+ public ObjectDisposedException(String message) {
+ super(message);
}
}
diff --git a/Software/Android_Studio/Tango.Core/src/main/java/com/twine/tango/core/ObservableCollection.java b/Software/Android_Studio/Tango.Core/src/main/java/com/twine/tango/core/ObservableCollection.java
index 7775a55ee..cb5bfcb9f 100644
--- a/Software/Android_Studio/Tango.Core/src/main/java/com/twine/tango/core/ObservableCollection.java
+++ b/Software/Android_Studio/Tango.Core/src/main/java/com/twine/tango/core/ObservableCollection.java
@@ -14,7 +14,7 @@ import java.util.ListIterator;
* @param <T> the type parameter
*/
public class ObservableCollection<T> implements List<T> {
-
+
/**
* The interface On changed listener.
*/
@@ -27,7 +27,7 @@ public class ObservableCollection<T> implements List<T> {
private List<T> list;
private OnChangedListener onChangedListener;
-
+
/**
* Sets on change listener.
*
@@ -36,8 +36,8 @@ public class ObservableCollection<T> implements List<T> {
public void setOnChangeListener(OnChangedListener listener) {
this.onChangedListener = listener;
}
-
-
+
+
/**
* Clear on change listener.
*/
@@ -45,7 +45,7 @@ public class ObservableCollection<T> implements List<T> {
{
this.onChangedListener = null;
}
-
+
/**
* On change.
*/
@@ -54,7 +54,7 @@ public class ObservableCollection<T> implements List<T> {
this.onChangedListener.onChange();
}
}
-
+
/**
* Instantiates a new Observable collection.
*/
diff --git a/Software/Android_Studio/Tango.Core/src/main/java/com/twine/tango/core/ReflectionsHelper.java b/Software/Android_Studio/Tango.Core/src/main/java/com/twine/tango/core/ReflectionsHelper.java
index a271c8d32..efa8c70a3 100644
--- a/Software/Android_Studio/Tango.Core/src/main/java/com/twine/tango/core/ReflectionsHelper.java
+++ b/Software/Android_Studio/Tango.Core/src/main/java/com/twine/tango/core/ReflectionsHelper.java
@@ -6,13 +6,21 @@ import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
+
/**
- * Created by Roy on 11/13/2017.
+ * Contains helper methods for code reflection.
*/
-
-public class Reflections {
-
- public static List<String> getReflectionListFromResource(int id)
+public class ReflectionsHelper
+{
+
+ /**
+ * Gets a collections of class names from a text file resource.
+ * This text file is generated using a gradle pre-build task.
+ *
+ * @param id the resource id
+ * @return list of class names
+ */
+ public static List<String> getReflectionListFromResource(int id)
{
List<String> list = new ArrayList<>();
diff --git a/Software/Android_Studio/Tango.Core/src/test/java/com/twine/tango/core/ExampleUnitTest.java b/Software/Android_Studio/Tango.Core/src/test/java/com/twine/tango/core/ExampleUnitTest.java
deleted file mode 100644
index b6f700635..000000000
--- a/Software/Android_Studio/Tango.Core/src/test/java/com/twine/tango/core/ExampleUnitTest.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package com.twine.tango.core;
-
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-/**
- * Example local unit test, which will execute on the development machine (host).
- *
- * @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
- */
-public class ExampleUnitTest {
- @Test
- public void addition_isCorrect() throws Exception {
- assertEquals(4, 2 + 2);
- }
-} \ No newline at end of file
diff --git a/Software/Android_Studio/Tango.DAL/src/androidTest/java/com/twine/tango/dal/ExampleInstrumentedTest.java b/Software/Android_Studio/Tango.DAL/src/androidTest/java/com/twine/tango/dal/ExampleInstrumentedTest.java
deleted file mode 100644
index 372af6ec5..000000000
--- a/Software/Android_Studio/Tango.DAL/src/androidTest/java/com/twine/tango/dal/ExampleInstrumentedTest.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package com.twine.tango.dal;
-
-import android.content.Context;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import static org.junit.Assert.*;
-
-/**
- * Instrumented test, which will execute on an Android device.
- *
- * @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
- */
-@RunWith(AndroidJUnit4.class)
-public class ExampleInstrumentedTest
-{
- @Test
- public void useAppContext() throws Exception
- {
- // Context of the app under test.
- Context appContext = InstrumentationRegistry.getTargetContext();
-
- assertEquals("com.twine.tango.dal.test", appContext.getPackageName());
- }
-}
diff --git a/Software/Android_Studio/Tango.DAL/src/main/java/com/twine/tango/dal/MyOpenHelper.java b/Software/Android_Studio/Tango.DAL/src/main/java/com/twine/tango/dal/MyOpenHelper.java
deleted file mode 100644
index 1a73883d3..000000000
--- a/Software/Android_Studio/Tango.DAL/src/main/java/com/twine/tango/dal/MyOpenHelper.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package com.twine.tango.dal;
-
-import android.content.Context;
-import android.database.sqlite.SQLiteDatabase;
-import android.database.sqlite.SQLiteOpenHelper;
-
-/**
- * Created by Roy on 12/3/2017.
- */
-
-public class MyOpenHelper extends SQLiteOpenHelper
-{
- MyOpenHelper(Context context,String database_path) {
- super(context, database_path, null, 1);
- }
-
- @Override
- public void onCreate(SQLiteDatabase sqLiteDatabase)
- {
-
- }
-
- @Override
- public void onUpgrade(SQLiteDatabase sqLiteDatabase, int i, int i1)
- {
-
- }
-}
diff --git a/Software/Android_Studio/Tango.DAL/src/main/java/com/twine/tango/dal/TangoDB.java b/Software/Android_Studio/Tango.DAL/src/main/java/com/twine/tango/dal/TangoDB.java
index 4f81cc74d..367cbc088 100644
--- a/Software/Android_Studio/Tango.DAL/src/main/java/com/twine/tango/dal/TangoDB.java
+++ b/Software/Android_Studio/Tango.DAL/src/main/java/com/twine/tango/dal/TangoDB.java
@@ -1,49 +1,54 @@
package com.twine.tango.dal;
-import android.content.res.Resources;
import android.os.Environment;
import com.elvishew.xlog.XLog;
import com.raizlabs.android.dbflow.annotation.Database;
import com.raizlabs.android.dbflow.config.DatabaseConfig;
-import com.raizlabs.android.dbflow.config.DatabaseConfig.OpenHelperCreator;
import com.raizlabs.android.dbflow.config.DatabaseDefinition;
import com.raizlabs.android.dbflow.config.FlowConfig;
import com.raizlabs.android.dbflow.config.FlowManager;
-import com.raizlabs.android.dbflow.sql.language.SQLite;
-import com.raizlabs.android.dbflow.structure.database.DatabaseHelperListener;
-import com.raizlabs.android.dbflow.structure.database.OpenHelper;
import com.snatik.storage.Storage;
-import com.twine.tango.core.ContextFactory;
-import com.twine.tango.dal.entities.Organization;
+import com.twine.tango.core.ContextHelper;
import org.apache.commons.io.IOUtils;
-import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
-import java.util.List;
+
/**
- * Created by Roy on 11/30/2017.
+ * Represents the Tango database wrapper object.
+ * Must be initialized before use.
*/
-
-@Database(name = "Tango",version = 1)
+@Database(name = "Tango", version = 1)
public class TangoDB
{
private static DatabaseDefinition database;
private static String database_path;
private static String database_name;
+ private static String database_backup_path;
+ /**
+ * Initializes the data base interaction.
+ */
public static void init()
{
database_name = "Tango.db";
- database_path = Environment.getExternalStorageDirectory() + "/" + database_name;
-
- createIfNotFound();
-
- FlowManager.init(FlowConfig.builder(ContextFactory.getApplicationContext())
+ database_path = ContextHelper.getApplicationContext().getDatabasePath(database_name).getPath();
+ database_backup_path = Environment.getExternalStorageDirectory() + "/BACKUP/" + "backup.db";
+
+ try
+ {
+ createIfNotFound();
+ } catch (Exception e)
+ {
+ XLog.e("Application failed on 'create database if not' found. will run in DBFlow default mode.");
+ XLog.e(e);
+ }
+
+ FlowManager.init(FlowConfig.builder(ContextHelper.getApplicationContext())
.addDatabaseConfig(
DatabaseConfig.builder(
TangoDB.class)
@@ -53,77 +58,102 @@ public class TangoDB
database = FlowManager.getDatabase(TangoDB.class);
- List<Organization> orgs = SQLite.select().from(Organization.class).queryList();
-
- for (Organization org : orgs)
+ try
{
- XLog.i(org.getName());
+ backup();
+ } catch (IOException e)
+ {
+ XLog.e(e);
}
-
- backup();
}
+ /**
+ * Gets data base file path.
+ *
+ * @return the data base path
+ */
public static String getDataBasePath()
{
return database_path;
}
- public static String getDataBasePath(String name)
- {
- return Environment.getExternalStorageDirectory() + "/" + name;
- }
-
+ /**
+ * Closes the data base connection.
+ */
public static void close()
{
database.close();
FlowManager.close();
}
- public static void backup()
+ /**
+ * Copies the current database file to the backup location on the SD card.
+ *
+ * @throws IOException the io exception
+ */
+ public static void backup() throws IOException
{
- Storage storage = new Storage(ContextFactory.getApplicationContext());
- storage.copy(database_path,storage.getExternalStorageDirectory() + "/" + "backup.db");
+ Storage storage = new Storage(ContextHelper.getApplicationContext());
+ File f = new File(database_backup_path);
+ boolean ok = f.getParentFile().mkdirs();
+ if (!storage.copy(database_path, database_backup_path))
+ {
+ throw new IOException("Could not copy database file to backup location.");
+ }
}
- public static void replace(byte[] data)
+ /**
+ * Restores the database backup.
+ *
+ * @throws IOException the io exception
+ */
+ public static void restore() throws IOException
{
- close();
- Storage storage = new Storage(ContextFactory.getApplicationContext());
- storage.createFile(database_path,data);
- init();
+ try
+ {
+ Storage storage = new Storage(ContextHelper.getApplicationContext());
+ byte[] data = storage.readFile(database_backup_path);
+ replace(data);
+ } catch (Exception e)
+ {
+ throw new IOException("Could not restore database backup.");
+ }
}
- private static void createIfNotFound()
+ /**
+ * Replaces the current database file with the specified byte array of another database file.
+ * Re-initializes DBFlow after replace.
+ *
+ * @param data the data
+ * @throws IOException the io exception
+ */
+ public static void replace(byte[] data) throws IOException
{
- Storage storage = new Storage(ContextFactory.getApplicationContext());
- if (!storage.isFileExist(database_path))
+ try
+ {
+ close();
+ Storage storage = new Storage(ContextHelper.getApplicationContext());
+ storage.createFile(database_path, data);
+ init();
+ } catch (Exception e)
{
- try
- {
- InputStream inputStream = ContextFactory.getApplicationContext().getResources().openRawResource(R.raw.tangodb);
- boolean b = storage.createFile(database_path,IOUtils.toByteArray(inputStream));
- if (b)
- {
- XLog.i("success");
- }
- inputStream.close();
-
- } catch (Exception e)
- {
- e.printStackTrace();
- }
+ throw new IOException("Could not replace the database file.");
}
}
- public static byte[] convertStreamToByteArray(InputStream is) throws IOException
+ /**
+ * Checks if the database file exist. If not, will copy the default database from raw resources folder.
+ */
+ private static void createIfNotFound() throws Exception
{
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- byte[] buff = new byte[10240];
- int i = Integer.MAX_VALUE;
- while ((i = is.read(buff, 0, buff.length)) > 0) {
- baos.write(buff, 0, i);
+ Storage storage = new Storage(ContextHelper.getApplicationContext());
+ if (!storage.isFileExist(database_path))
+ {
+ InputStream inputStream = ContextHelper.getApplicationContext().getResources().openRawResource(R.raw.tangodb);
+ File dir = new File(database_path);
+ boolean ok = dir.getParentFile().mkdirs();
+ boolean b = storage.createFile(database_path, IOUtils.toByteArray(inputStream));
+ inputStream.close();
}
-
- return baos.toByteArray(); // be sure to close InputStream in calling function
}
}
diff --git a/Software/Android_Studio/Tango.DAL/src/main/java/com/twine/tango/dal/entities/Address.java b/Software/Android_Studio/Tango.DAL/src/main/java/com/twine/tango/dal/entities/Address.java
index f808d933b..116f1af88 100644
--- a/Software/Android_Studio/Tango.DAL/src/main/java/com/twine/tango/dal/entities/Address.java
+++ b/Software/Android_Studio/Tango.DAL/src/main/java/com/twine/tango/dal/entities/Address.java
@@ -4,10 +4,10 @@ import com.raizlabs.android.dbflow.annotation.Column;
import com.raizlabs.android.dbflow.annotation.Table;
import com.twine.tango.dal.TangoDB;
+
/**
- * Created by Roy on 11/30/2017.
+ * Represents the DAL Address entity.
*/
-
@Table(name = "ADDRESSES", database = TangoDB.class)
public class Address extends Entity
{
@@ -32,71 +32,141 @@ public class Address extends Entity
@Column(name = "POSTAL_CODE")
private String postal_code;
+ /**
+ * Gets the address.
+ *
+ * @return the address
+ */
public String getAddress()
{
return address;
}
+ /**
+ * Sets address.
+ *
+ * @param address the address
+ */
public void setAddress(String address)
{
this.address = address;
}
+ /**
+ * Gets locality.
+ *
+ * @return the locality
+ */
public String getLocality()
{
return locality;
}
+ /**
+ * Sets locality.
+ *
+ * @param locality the locality
+ */
public void setLocality(String locality)
{
this.locality = locality;
}
+ /**
+ * Gets country.
+ *
+ * @return the country
+ */
public String getCountry()
{
return country;
}
+ /**
+ * Sets country.
+ *
+ * @param country the country
+ */
public void setCountry(String country)
{
this.country = country;
}
+ /**
+ * Gets city.
+ *
+ * @return the city
+ */
public String getCity()
{
return city;
}
+ /**
+ * Sets city.
+ *
+ * @param city the city
+ */
public void setCity(String city)
{
this.city = city;
}
+ /**
+ * Gets state.
+ *
+ * @return the state
+ */
public String getState()
{
return state;
}
+ /**
+ * Sets state.
+ *
+ * @param state the state
+ */
public void setState(String state)
{
this.state = state;
}
+ /**
+ * Gets country code.
+ *
+ * @return the country code
+ */
public String getCountry_code()
{
return country_code;
}
+ /**
+ * Sets country code.
+ *
+ * @param country_code the country code
+ */
public void setCountry_code(String country_code)
{
this.country_code = country_code;
}
+ /**
+ * Gets postal code.
+ *
+ * @return the postal code
+ */
public String getPostal_code()
{
return postal_code;
}
+ /**
+ * Sets postal code.
+ *
+ * @param postal_code the postal code
+ */
public void setPostal_code(String postal_code)
{
this.postal_code = postal_code;
diff --git a/Software/Android_Studio/Tango.DAL/src/main/java/com/twine/tango/dal/entities/Contact.java b/Software/Android_Studio/Tango.DAL/src/main/java/com/twine/tango/dal/entities/Contact.java
index a4ad77572..a8a1bddac 100644
--- a/Software/Android_Studio/Tango.DAL/src/main/java/com/twine/tango/dal/entities/Contact.java
+++ b/Software/Android_Studio/Tango.DAL/src/main/java/com/twine/tango/dal/entities/Contact.java
@@ -4,10 +4,10 @@ import com.raizlabs.android.dbflow.annotation.Column;
import com.raizlabs.android.dbflow.annotation.Table;
import com.twine.tango.dal.TangoDB;
+
/**
- * Created by Roy on 11/30/2017.
+ * Represents the DAL Contact entity.
*/
-
@Table(name = "CONTACTS", database = TangoDB.class)
public class Contact extends Entity
{
@@ -29,61 +29,121 @@ public class Contact extends Entity
@Column(name = "FAX")
private String fax;
+ /**
+ * Gets first name.
+ *
+ * @return the first name
+ */
public String getFirst_name()
{
return first_name;
}
+ /**
+ * Sets first name.
+ *
+ * @param first_name the first name
+ */
public void setFirst_name(String first_name)
{
this.first_name = first_name;
}
+ /**
+ * Gets last name.
+ *
+ * @return the last name
+ */
public String getLast_name()
{
return last_name;
}
+ /**
+ * Sets last name.
+ *
+ * @param last_name the last name
+ */
public void setLast_name(String last_name)
{
this.last_name = last_name;
}
+ /**
+ * Gets full name.
+ *
+ * @return the full name
+ */
public String getFull_name()
{
return full_name;
}
+ /**
+ * Sets full name.
+ *
+ * @param full_name the full name
+ */
public void setFull_name(String full_name)
{
this.full_name = full_name;
}
+ /**
+ * Gets email.
+ *
+ * @return the email
+ */
public String getEmail()
{
return email;
}
+ /**
+ * Sets email.
+ *
+ * @param email the email
+ */
public void setEmail(String email)
{
this.email = email;
}
+ /**
+ * Gets phone number.
+ *
+ * @return the phone number
+ */
public String getPhone_number()
{
return phone_number;
}
+ /**
+ * Sets phone number.
+ *
+ * @param phone_number the phone number
+ */
public void setPhone_number(String phone_number)
{
this.phone_number = phone_number;
}
+ /**
+ * Gets fax.
+ *
+ * @return the fax
+ */
public String getFax()
{
return fax;
}
+ /**
+ * Sets fax.
+ *
+ * @param fax the fax
+ */
public void setFax(String fax)
{
this.fax = fax;
diff --git a/Software/Android_Studio/Tango.DAL/src/main/java/com/twine/tango/dal/entities/DateConverter.java b/Software/Android_Studio/Tango.DAL/src/main/java/com/twine/tango/dal/entities/DateConverter.java
index 8e74df283..71d5d5301 100644
--- a/Software/Android_Studio/Tango.DAL/src/main/java/com/twine/tango/dal/entities/DateConverter.java
+++ b/Software/Android_Studio/Tango.DAL/src/main/java/com/twine/tango/dal/entities/DateConverter.java
@@ -5,10 +5,10 @@ import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
+
/**
- * Created by Roy on 11/30/2017.
+ * Represents a DBFlow string to date converter used to parse and store SQLite dates.
*/
-
@com.raizlabs.android.dbflow.annotation.TypeConverter
public class DateConverter extends TypeConverter<String,Date>
{
diff --git a/Software/Android_Studio/Tango.DAL/src/main/java/com/twine/tango/dal/entities/Entity.java b/Software/Android_Studio/Tango.DAL/src/main/java/com/twine/tango/dal/entities/Entity.java
index 58a20a59d..64b24b00c 100644
--- a/Software/Android_Studio/Tango.DAL/src/main/java/com/twine/tango/dal/entities/Entity.java
+++ b/Software/Android_Studio/Tango.DAL/src/main/java/com/twine/tango/dal/entities/Entity.java
@@ -9,9 +9,9 @@ import java.util.UUID;
/**
- * Created by Roy on 11/30/2017.
+ * Represents a DAL base entity.
+ * contains the basic columns/properties which are in common to all entities.
*/
-
public class Entity extends BaseRXModel
{
@Column(name = "ID")
@@ -27,46 +27,89 @@ public class Entity extends BaseRXModel
@Column(name = "DELETED")
private boolean deleted;
+ /**
+ * Gets id.
+ *
+ * @return the id
+ */
public int getId()
{
return id;
}
+ /**
+ * Sets id.
+ *
+ * @param id the id
+ */
public void setId(int id)
{
this.id = id;
}
+ /**
+ * Gets guid.
+ *
+ * @return the guid
+ */
public String getGuid()
{
return guid;
}
+ /**
+ * Sets guid.
+ *
+ * @param guid the guid
+ */
public void setGuid(String guid)
{
this.guid = guid;
}
+ /**
+ * Gets last updated.
+ *
+ * @return the last updated
+ */
public Date getLast_updated()
{
return last_updated;
}
+ /**
+ * Sets last updated.
+ *
+ * @param last_updated the last updated
+ */
public void setLast_updated(Date last_updated)
{
this.last_updated = last_updated;
}
+ /**
+ * Is deleted boolean.
+ *
+ * @return the boolean
+ */
public boolean isDeleted()
{
return deleted;
}
+ /**
+ * Sets deleted.
+ *
+ * @param deleted the deleted
+ */
public void setDeleted(boolean deleted)
{
this.deleted = deleted;
}
+ /**
+ * Instantiates a new Entity.
+ */
public Entity()
{
setGuid(UUID.randomUUID().toString());
diff --git a/Software/Android_Studio/Tango.DAL/src/main/java/com/twine/tango/dal/entities/Organization.java b/Software/Android_Studio/Tango.DAL/src/main/java/com/twine/tango/dal/entities/Organization.java
index d39490674..870b80ad3 100644
--- a/Software/Android_Studio/Tango.DAL/src/main/java/com/twine/tango/dal/entities/Organization.java
+++ b/Software/Android_Studio/Tango.DAL/src/main/java/com/twine/tango/dal/entities/Organization.java
@@ -6,10 +6,10 @@ import com.raizlabs.android.dbflow.annotation.ForeignKeyReference;
import com.raizlabs.android.dbflow.annotation.Table;
import com.twine.tango.dal.TangoDB;
+
/**
- * Created by Roy on 11/30/2017.
+ * Represents the DAL Organization entity.
*/
-
@Table(name = "ORGANIZATIONS", database = TangoDB.class)
public class Organization extends Entity
{
@@ -22,31 +22,61 @@ public class Organization extends Entity
@ForeignKey(references = {@ForeignKeyReference(columnName = "ADDRESS_GUID", foreignKeyColumnName = "GUID")})
private Address address;
+ /**
+ * Gets name.
+ *
+ * @return the name
+ */
public String getName()
{
return name;
}
+ /**
+ * Sets name.
+ *
+ * @param name the name
+ */
public void setName(String name)
{
this.name = name;
}
+ /**
+ * Gets contact.
+ *
+ * @return the contact
+ */
public Contact getContact()
{
return contact;
}
+ /**
+ * Sets contact.
+ *
+ * @param contact the contact
+ */
public void setContact(Contact contact)
{
this.contact = contact;
}
+ /**
+ * Gets address.
+ *
+ * @return the address
+ */
public Address getAddress()
{
return address;
}
+ /**
+ * Sets address.
+ *
+ * @param address the address
+ */
public void setAddress(Address address)
{
this.address = address;
diff --git a/Software/Android_Studio/Tango.DAL/src/main/res/raw/tangodb b/Software/Android_Studio/Tango.DAL/src/main/res/raw/tangodb
index f162394c0..f27e1a63f 100644
--- a/Software/Android_Studio/Tango.DAL/src/main/res/raw/tangodb
+++ b/Software/Android_Studio/Tango.DAL/src/main/res/raw/tangodb
Binary files differ
diff --git a/Software/Android_Studio/Tango.DAL/src/test/java/com/twine/tango/dal/ExampleUnitTest.java b/Software/Android_Studio/Tango.DAL/src/test/java/com/twine/tango/dal/ExampleUnitTest.java
deleted file mode 100644
index a6ab77002..000000000
--- a/Software/Android_Studio/Tango.DAL/src/test/java/com/twine/tango/dal/ExampleUnitTest.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package com.twine.tango.dal;
-
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-/**
- * Example local unit test, which will execute on the development machine (host).
- *
- * @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
- */
-public class ExampleUnitTest
-{
- @Test
- public void addition_isCorrect() throws Exception
- {
- assertEquals(4, 2 + 2);
- }
-} \ No newline at end of file
diff --git a/Software/Android_Studio/Tango.Integration/src/main/java/com/twine/tango/integration/IMachineIdentityProvider.java b/Software/Android_Studio/Tango.Integration/src/main/java/com/twine/tango/integration/IMachineIdentityProvider.java
index e4b033eb6..3e35be9d0 100644
--- a/Software/Android_Studio/Tango.Integration/src/main/java/com/twine/tango/integration/IMachineIdentityProvider.java
+++ b/Software/Android_Studio/Tango.Integration/src/main/java/com/twine/tango/integration/IMachineIdentityProvider.java
@@ -1,10 +1,15 @@
package com.twine.tango.integration;
+
/**
- * Created by Roy on 12/2/2017.
+ * Represents a Tabgo machine identity provider.
*/
-
public interface IMachineIdentityProvider
{
+ /**
+ * Gets tango machine unique serial number.
+ *
+ * @return the serial number
+ */
String getSerialNumber();
}
diff --git a/Software/Android_Studio/Tango.Integration/src/main/java/com/twine/tango/integration/MachineIdentityProvider.java b/Software/Android_Studio/Tango.Integration/src/main/java/com/twine/tango/integration/MachineIdentityProvider.java
index 7490908c6..29cb0c30c 100644
--- a/Software/Android_Studio/Tango.Integration/src/main/java/com/twine/tango/integration/MachineIdentityProvider.java
+++ b/Software/Android_Studio/Tango.Integration/src/main/java/com/twine/tango/integration/MachineIdentityProvider.java
@@ -1,11 +1,12 @@
package com.twine.tango.integration;
+
/**
- * Created by Roy on 12/2/2017.
+ * Represents the default machine identity provider implementation.
*/
-
public class MachineIdentityProvider implements IMachineIdentityProvider
{
+
@Override
public String getSerialNumber()
{
diff --git a/Software/Android_Studio/Tango.PMR/src/main/java/com/twine/tango/pmr/MessageFactory.java b/Software/Android_Studio/Tango.PMR/src/main/java/com/twine/tango/pmr/MessageFactory.java
index 9e2a88194..55a0de4dd 100644
--- a/Software/Android_Studio/Tango.PMR/src/main/java/com/twine/tango/pmr/MessageFactory.java
+++ b/Software/Android_Studio/Tango.PMR/src/main/java/com/twine/tango/pmr/MessageFactory.java
@@ -1,17 +1,12 @@
package com.twine.tango.pmr;
-import android.content.Context;
-
import com.elvishew.xlog.XLog;
import com.google.protobuf.InvalidProtocolBufferException;
import com.google.protobuf.Parser;
-import com.twine.tango.core.Reflections;
+import com.twine.tango.core.ReflectionsHelper;
import com.twine.tango.pmr.common.MessageContainerOuterClass.MessageContainer;
import com.twine.tango.pmr.common.MessageTypeOuterClass.MessageType;
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStreamReader;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
@@ -20,7 +15,7 @@ import java.util.List;
import java.util.Map;
/**
- * Contains helper method for generating {@link TangoMessage} messages.
+ * Contains helper method for generating and parsing {@link TangoMessage} messages.
*/
public class MessageFactory
{
@@ -28,7 +23,9 @@ public class MessageFactory
private static List<String> packages;
private static Map<String, Class> knownClasses;
-
+ /**
+ * Initializes the message factory by retrieving all possible PMR message names from the text resource file.
+ */
public static void init()
{
if (!initialized)
@@ -36,7 +33,7 @@ public class MessageFactory
packages = new ArrayList<>();
knownClasses = new HashMap<>();
- List<String> names = Reflections.getReflectionListFromResource(R.raw.packages);
+ List<String> names = ReflectionsHelper.getReflectionListFromResource(R.raw.packages);
for (String name : names)
{
@@ -47,6 +44,9 @@ public class MessageFactory
}
}
+ /**
+ * Gets the PMR message class type by the specified name.
+ */
private static Class<?> getClassForName(String name)
{
init();
@@ -75,8 +75,8 @@ public class MessageFactory
/**
* Creates a new {@link TangoMessage} message wrapper.
*
- * @param typeName The inner message class.
* @param <T> Type of message.
+ * @param typeName The inner message class.
* @return New instance of {@link TangoMessage}.
*/
public static <T extends com.google.protobuf.GeneratedMessageV3> TangoMessage<T> createTangoMessage(Class<T> typeName)
@@ -100,6 +100,14 @@ public class MessageFactory
}
}
+ /**
+ * Creates a new {@link TangoMessage} wrapper with an existing PMR message.
+ *
+ * @param <T> the type parameter
+ * @param typeName the type name
+ * @param message the message
+ * @return the tango message
+ */
public static <T extends com.google.protobuf.GeneratedMessageV3> TangoMessage<T> createTangoMessage(Class<T> typeName, T message)
{
TangoMessage<T> tangoMessage = createTangoMessage(typeName);
@@ -107,6 +115,14 @@ public class MessageFactory
return tangoMessage;
}
+ /**
+ * Creates a new tango message with the specified message token.
+ *
+ * @param <T> the type parameter
+ * @param typeName the type name
+ * @param token the token
+ * @return the tango message
+ */
public static <T extends com.google.protobuf.GeneratedMessageV3> TangoMessage<T> createTangoMessage(Class<T> typeName, String token)
{
TangoMessage<T> tangoMessage = createTangoMessage(typeName);
@@ -117,8 +133,8 @@ public class MessageFactory
/**
* Parses a {@link MessageContainer} byte array to a new {@link TangoMessage}.
*
- * @param data MessageContainer bytes.
* @param <T> Type of expected inner message.
+ * @param data MessageContainer bytes.
* @return New instance of {@link TangoMessage}.
*/
@SuppressWarnings("unchecked")
@@ -139,6 +155,18 @@ public class MessageFactory
}
}
+ /**
+ * Parses the internal PMR message from the message container.
+ *
+ * @param <T> the type parameter
+ * @param container the container
+ * @return the t
+ * @throws ClassNotFoundException the class not found exception
+ * @throws NoSuchMethodException the no such method exception
+ * @throws InvocationTargetException the invocation target exception
+ * @throws IllegalAccessException the illegal access exception
+ * @throws InvalidProtocolBufferException the invalid protocol buffer exception
+ */
public static <T extends com.google.protobuf.GeneratedMessageV3> T parseMessageFromContainer(MessageContainer container) throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, IllegalAccessException, InvalidProtocolBufferException
{
@@ -147,6 +175,16 @@ public class MessageFactory
return (T) parser.parseFrom(container.getData());
}
+ /**
+ * Parses the internal PMR message from the message container and returns the basic protobuf message interface.
+ *
+ * @param container the container
+ * @return GeneratedMessageV3
+ * @throws NoSuchMethodException the no such method exception
+ * @throws InvocationTargetException the invocation target exception
+ * @throws IllegalAccessException the illegal access exception
+ * @throws InvalidProtocolBufferException the invalid protocol buffer exception
+ */
public static com.google.protobuf.GeneratedMessageV3 parseMessageFromContainerAgnostic(MessageContainer container) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException, InvalidProtocolBufferException
{
Class<?> type = getClassForName(container.getType().toString());
@@ -154,6 +192,13 @@ public class MessageFactory
return (com.google.protobuf.GeneratedMessageV3) parser.parseFrom(container.getData());
}
+ /**
+ * Parses the specified byte array to a PMR message container.
+ *
+ * @param data the data
+ * @return the message container
+ * @throws InvalidProtocolBufferException the invalid protocol buffer exception
+ */
public static MessageContainer parseContainer(byte[] data) throws InvalidProtocolBufferException
{
MessageContainer container = MessageContainer.parseFrom(data);
diff --git a/Software/Android_Studio/Tango.PMR/src/main/java/com/twine/tango/pmr/TangoMessage.java b/Software/Android_Studio/Tango.PMR/src/main/java/com/twine/tango/pmr/TangoMessage.java
index 48422575d..8403f2cab 100644
--- a/Software/Android_Studio/Tango.PMR/src/main/java/com/twine/tango/pmr/TangoMessage.java
+++ b/Software/Android_Studio/Tango.PMR/src/main/java/com/twine/tango/pmr/TangoMessage.java
@@ -9,18 +9,20 @@ import java.util.UUID;
/**
* Generic Tango message wrapper.
- * @param <T>
+ *
+ * @param <T> the type parameter
*/
public class TangoMessage<T extends com.google.protobuf.GeneratedMessageV3> {
private T message;
private MessageType type;
private MessageContainer.Builder container;
-
+
/**
* Initialize a new instance of Tango message.
+ *
* @param message The message.
- * @param type The message type.
+ * @param type The message type.
*/
public TangoMessage(T message, MessageType type) {
this.message = message;
@@ -30,57 +32,64 @@ public class TangoMessage<T extends com.google.protobuf.GeneratedMessageV3> {
.setToken(UUID.randomUUID().toString())
.setType(type);
}
-
+
/**
* Gets the inner message.
+ *
* @return The inner message.
*/
public T getMessage() {
return message;
}
-
+
/**
* Sets the inner message.
+ *
* @param message The inner message.
*/
public void setMessage(T message) {
this.message = message;
}
-
+
/**
* Gets the inner message type.
+ *
* @return The inner message type.
*/
public MessageType getType() {
return type;
}
-
+
/**
* Sets the inner message type.
+ *
* @param type Inner message type.
*/
public void setType(MessageType type) {
this.type = type;
}
-
+
/**
* Gets the message container.
+ *
* @return the message container.
*/
public MessageContainer.Builder getContainer() {
return container;
}
-
+
/**
* Sets the message container.
- * @param container
+ *
+ * @param container the container
*/
public void setContainer(MessageContainer.Builder container) {
this.container = container;
}
-
+
/**
* Serializes the container and message to byte array.
+ *
* @return Container and message byte array.
*/
public byte[] toBytes()
diff --git a/Software/Android_Studio/Tango.SharedUI/build.gradle b/Software/Android_Studio/Tango.SharedUI/build.gradle
index 7eadccff2..00bf0b351 100644
--- a/Software/Android_Studio/Tango.SharedUI/build.gradle
+++ b/Software/Android_Studio/Tango.SharedUI/build.gradle
@@ -58,4 +58,5 @@ dependencies {
implementation project(':Tango.DAL')
compile globalDependencies.protobuf
implementation project(':Tango.PMR')
+ implementation project(':Tango.Web')
}
diff --git a/Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/AppInitializer.java b/Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/TangoApplication.java
index a177517db..a2a48ae43 100644
--- a/Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/AppInitializer.java
+++ b/Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/TangoApplication.java
@@ -1,5 +1,7 @@
package com.twine.tango.sharedui;
+import android.annotation.SuppressLint;
+import android.app.Application;
import android.content.Context;
import com.elvishew.xlog.LogConfiguration;
@@ -11,24 +13,35 @@ import com.elvishew.xlog.printer.file.FilePrinter;
import com.elvishew.xlog.printer.file.backup.FileSizeBackupStrategy;
import com.elvishew.xlog.printer.file.naming.DateFileNameGenerator;
import com.google.protobuf.GeneratedMessageV3;
-import com.twine.tango.core.ContextFactory;
+import com.twine.tango.core.ContextHelper;
import com.twine.tango.dal.TangoDB;
import com.twine.tango.pmr.MessageFactory;
+import com.twine.tango.web.WebApiFactory;
import net.danlew.android.joda.JodaTimeAndroid;
import java.io.File;
+
/**
- * Created by Roy on 12/2/2017.
+ * Represents a base application structure for all Tango application.
*/
-
-public class AppInitializer
+public class TangoApplication extends Application
{
- public static void init(Context context)
+ @SuppressLint("StaticFieldLeak")
+ protected static Context context;
+
+ @Override
+ public void onCreate()
{
+ super.onCreate();
+
+ context = getApplicationContext();
+
+
JodaTimeAndroid.init(context);
- ContextFactory.init(context);
+
+ ContextHelper.init(context);
LogConfiguration config = new LogConfiguration.Builder()
.logLevel(LogLevel.ALL)
@@ -51,8 +64,26 @@ public class AppInitializer
XLog.init(config, androidPrinter, filePrinter);
XLog.i("Logger Initialized. logs will be saved to: " + dir.getAbsolutePath());
-
+
TangoDB.init();
MessageFactory.init();
+ WebApiFactory.init("http://10.0.2.2:45455/api/");
+
+ Thread.setDefaultUncaughtExceptionHandler((thread, throwable) -> {
+
+ throwable.printStackTrace();
+ XLog.e(throwable);
+ System.exit(1);
+ //TODO: What to do on application crash ?
+ });
+ }
+
+ /**
+ * Gets the application context.
+ *
+ * @return the context
+ */
+ public static Context getContext() {
+ return context;
}
}
diff --git a/Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/binding_adapters/BindingAdapters.java b/Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/binding_adapters/BindingAdapters.java
index daec8892a..6b6d4b6e9 100644
--- a/Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/binding_adapters/BindingAdapters.java
+++ b/Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/binding_adapters/BindingAdapters.java
@@ -4,28 +4,30 @@ import android.databinding.BindingAdapter;
import android.databinding.Observable;
import android.databinding.Observable.OnPropertyChangedCallback;
import android.graphics.Bitmap;
-import android.support.v7.widget.AppCompatSeekBar;
import android.text.method.ScrollingMovementMethod;
-import android.widget.EditText;
import android.widget.ImageView;
import android.widget.ListView;
-import android.widget.NumberPicker;
-import android.widget.NumberPicker.OnValueChangeListener;
-import android.widget.SeekBar;
-import android.widget.SeekBar.OnSeekBarChangeListener;
import android.widget.TextView;
import com.hrules.horizontalnumberpicker.HorizontalNumberPicker;
+import com.twine.tango.sharedui.editors.IParameterized;
import com.twine.tango.sharedui.editors.ParameterItem;
-import com.twine.tango.sharedui.mvvm.DependencyProperty;
+import com.twine.tango.sharedui.editors.ParameterizedEditor;
+
/**
- * Created by Roy on 11/7/2017.
+ * Contains data binding adapters used by android data binding engine.
+ * Methods will be auto detected by android.
*/
-
public class BindingAdapters
{
+ /**
+ * Binds an {@link ImageView} source to bitmap on memory.
+ *
+ * @param view the view
+ * @param bitmap the bitmap
+ */
@BindingAdapter("android:memory_bitmap")
public static void bitmapAdapter(ImageView view, Bitmap bitmap)
{
@@ -35,6 +37,12 @@ public class BindingAdapters
}
}
+ /**
+ * Binds a {@link ListView} item click to a listener.
+ *
+ * @param view the view
+ * @param listener the listener
+ */
@BindingAdapter("android:onItemClick")
public static void listViewClickAdapter(ListView view, ListView.OnItemClickListener listener)
{
@@ -44,6 +52,12 @@ public class BindingAdapters
}
}
+ /**
+ * Binds a {@link ListView} selected item position.
+ *
+ * @param view the view
+ * @param position the position
+ */
@BindingAdapter("android:selectedItemPosition")
public static void listViewSelectedItemPosition(ListView view, int position)
{
@@ -53,6 +67,12 @@ public class BindingAdapters
}
}
+ /**
+ * Applies an auto 'scroll to bottom' behavior to a {@link TextView}.
+ *
+ * @param view the view
+ * @param scroll the scroll
+ */
@BindingAdapter("android:autoScrollToBottom")
public static void scrollToBottomAdapter(TextView view, Boolean scroll)
{
@@ -62,6 +82,12 @@ public class BindingAdapters
}
}
+ /**
+ * Binds a {@link HorizontalNumberPicker} value to a {@link ParameterItem}.
+ *
+ * @param view the view
+ * @param item the item
+ */
@BindingAdapter("android:editor_range_adapter")
public static void editorSeekBarAdapter(HorizontalNumberPicker view, ParameterItem item)
{
@@ -88,4 +114,19 @@ public class BindingAdapters
}
}
+ /**
+ * Binds a {@link ParameterizedEditor} to an {@link IParameterized} object.
+ *
+ * @param view the view
+ * @param object the object
+ */
+ @BindingAdapter("android:parameterizedObject")
+ public static void parameterizedObjectAdapter(ParameterizedEditor view, IParameterized object)
+ {
+ if (view != null && object != null)
+ {
+ view.setParameterizedObject(object);
+ }
+ }
+
}
diff --git a/Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/binding_converters/ObjectToIntConverter.java b/Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/binding_converters/ObjectToIntConverter.java
index f571e4561..ee6de2b66 100644
--- a/Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/binding_converters/ObjectToIntConverter.java
+++ b/Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/binding_converters/ObjectToIntConverter.java
@@ -4,10 +4,10 @@ import android.databinding.BindingConversion;
import android.databinding.InverseBindingMethod;
import android.databinding.InverseMethod;
+
/**
- * Created by Roy on 11/20/2017.
+ * Contains binding converters which will be auto detected by the android data binding engine.
*/
-
public class ObjectToIntConverter
{
// @InverseBindingMethod()
diff --git a/Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/containers/ActivityBase.java b/Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/containers/ActivityBase.java
index d8360f485..4526a4f09 100644
--- a/Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/containers/ActivityBase.java
+++ b/Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/containers/ActivityBase.java
@@ -22,16 +22,32 @@ import javax.inject.Inject;
import butterknife.ButterKnife;
import io.reactivex.functions.Consumer;
-public abstract class ActivityBase<BindingView extends ViewDataBinding, VM extends ViewModelBase> extends AppCompatActivity implements IView, Validator.ValidationListener {
+/**
+ * Represents a base activity with extra features.
+ *
+ * @param <BindingView> the type parameter
+ * @param <VM> the type parameter
+ */
+public abstract class ActivityBase<BindingView extends ViewDataBinding, VM extends ViewModelBase> extends AppCompatActivity implements IView, Validator.ValidationListener {
+
+ /**
+ * The constant ACTIVITY_CALLBACK_INTENT.
+ */
protected static final String ACTIVITY_CALLBACK_INTENT = "ACTIVITY_CALLBACK_INTENT";
private Consumer<Boolean> lastValidationConsumer;
private Validator validator;
-
+
+ /**
+ * Holds the standard View Model instance.
+ */
@Inject
public VM vm;
-
+
+ /**
+ * Holds the activity data binding instance.
+ */
public BindingView binding;
@Override
@@ -54,7 +70,7 @@ public abstract class ActivityBase<BindingView extends ViewDataBinding, VM exten
String key = getIntent().getStringExtra(ACTIVITY_CALLBACK_INTENT);
if (key != null && !key.isEmpty()) {
- ActivityCallbackEngine.getInstance().runAndRemove(key);
+ ActivityCallbackService.getInstance().runAndRemove(key);
}
} catch (Exception e) {
@@ -105,14 +121,28 @@ public abstract class ActivityBase<BindingView extends ViewDataBinding, VM exten
}
}
}
-
+
+ /**
+ * Gets the activity layout resource id.
+ *
+ * @return the layout id
+ */
protected abstract int getLayoutId();
-
+
+ /**
+ * Performs dagger dependency injection.
+ */
protected abstract void inject();
-
+
+ /**
+ * Starts an activity and receive a callback from the new activity onCreate method.
+ *
+ * @param activity the activity
+ * @param callback the callback
+ */
public void startActivityNotify(Class<?> activity, Runnable callback) {
- String key = ActivityCallbackEngine.getInstance().putCallback(callback);
+ String key = ActivityCallbackService.getInstance().putCallback(callback);
Intent i = new Intent(getApplicationContext(), activity);
i.putExtra(ACTIVITY_CALLBACK_INTENT, key);
startActivity(i);
diff --git a/Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/containers/ActivityCallbackService.java b/Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/containers/ActivityCallbackService.java
index 5aec7852a..842d49561 100644
--- a/Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/containers/ActivityCallbackService.java
+++ b/Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/containers/ActivityCallbackService.java
@@ -4,49 +4,82 @@ import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
+
/**
- * Created by Roy on 11/7/2017.
+ * Represents an MVVM activity callback service that is responsible for notifying when activities are loaded and ready.
*/
+public class ActivityCallbackService
+{
-public class ActivityCallbackEngine {
-
- private static ActivityCallbackEngine instance;
+ private static ActivityCallbackService instance;
private Map<String, Runnable> callbacks;
- private ActivityCallbackEngine() {
+ private ActivityCallbackService() {
callbacks = new HashMap<>();
}
-
- public static ActivityCallbackEngine getInstance() {
+
+ /**
+ * Gets instance.
+ *
+ * @return the instance
+ */
+ public static ActivityCallbackService getInstance() {
if (instance == null) {
- instance = new ActivityCallbackEngine();
+ instance = new ActivityCallbackService();
}
return instance;
}
-
+
+ /**
+ * Put callback.
+ *
+ * @param key the key
+ * @param callback the callback
+ */
public void putCallback(String key, Runnable callback) {
callbacks.put(key,callback);
}
-
+
+ /**
+ * Put callback string.
+ *
+ * @param callback the callback
+ * @return the string
+ */
public String putCallback(Runnable callback) {
String key = UUID.randomUUID().toString();
callbacks.put(key,callback);
return key;
}
-
+
+ /**
+ * Remove callback.
+ *
+ * @param key the key
+ */
public void removeCallback(String key)
{
callbacks.remove(key);
}
-
+
+ /**
+ * Run.
+ *
+ * @param key the key
+ */
public void run(String key)
{
callbacks.get(key).run();
}
-
+
+ /**
+ * Run and remove.
+ *
+ * @param key the key
+ */
public void runAndRemove(String key)
{
callbacks.get(key).run();
diff --git a/Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/containers/FragmentBase.java b/Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/containers/FragmentBase.java
index a65b09a7f..61ed42764 100644
--- a/Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/containers/FragmentBase.java
+++ b/Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/containers/FragmentBase.java
@@ -12,7 +12,7 @@ import android.widget.Toast;
import com.mobsandgeeks.saripaar.ValidationError;
import com.mobsandgeeks.saripaar.Validator;
-import com.twine.tango.core.Action1;
+import com.twine.tango.core.IAction1;
import com.twine.tango.sharedui.mvvm.IView;
import com.twine.tango.sharedui.mvvm.ViewModelBase;
@@ -24,15 +24,27 @@ import javax.inject.Inject;
import butterknife.ButterKnife;
import io.reactivex.functions.Consumer;
+/**
+ * Represents a an MVVM fragment with extra features.
+ *
+ * @param <BindingView> the type parameter
+ * @param <VM> the type parameter
+ */
public abstract class FragmentBase<BindingView extends ViewDataBinding, VM extends ViewModelBase> extends Fragment implements IView, Validator.ValidationListener {
private Consumer<Boolean> lastValidationConsumer;
private Validator validator;
- private Action1<FragmentBase> onCreateListener;
-
+ private IAction1<FragmentBase> onCreateListener;
+
+ /**
+ * The Vm.
+ */
@Inject
VM vm;
-
+
+ /**
+ * The Binding.
+ */
BindingView binding;
@Override
@@ -66,8 +78,13 @@ public abstract class FragmentBase<BindingView extends ViewDataBinding, VM exten
return null;
}
}
-
- public void setOnCreateListener(Action1<FragmentBase> listener)
+
+ /**
+ * Sets on create listener.
+ *
+ * @param listener the listener
+ */
+ public void setOnCreateListener(IAction1<FragmentBase> listener)
{
onCreateListener = listener;
}
@@ -115,10 +132,23 @@ public abstract class FragmentBase<BindingView extends ViewDataBinding, VM exten
}
}
}
-
+
+ /**
+ * Gets layout id.
+ *
+ * @return the layout id
+ */
protected abstract int getLayoutId();
-
+
+ /**
+ * Inject.
+ */
protected abstract void inject();
-
+
+ /**
+ * Gets title.
+ *
+ * @return the title
+ */
public abstract String getTitle();
}
diff --git a/Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/containers/FragmentBaseV4.java b/Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/containers/FragmentBaseV4.java
index 15a7f4022..5050a64fc 100644
--- a/Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/containers/FragmentBaseV4.java
+++ b/Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/containers/FragmentBaseV4.java
@@ -19,14 +19,26 @@ import javax.inject.Inject;
import butterknife.ButterKnife;
import io.reactivex.functions.Consumer;
+/**
+ * Represents an MVVM fragment that supports tab navigation.
+ *
+ * @param <BindingView> the type parameter
+ * @param <VM> the type parameter
+ */
public abstract class FragmentBaseV4<BindingView extends ViewDataBinding, VM extends ViewModelBase> extends Fragment implements IView, Validator.ValidationListener {
private Consumer<Boolean> lastValidationConsumer;
private Validator validator;
-
+
+ /**
+ * The Vm.
+ */
@Inject
VM vm;
-
+
+ /**
+ * The Binding.
+ */
BindingView binding;
@Override
@@ -98,10 +110,23 @@ public abstract class FragmentBaseV4<BindingView extends ViewDataBinding, VM ext
}
}
}
-
+
+ /**
+ * Gets layout id.
+ *
+ * @return the layout id
+ */
protected abstract int getLayoutId();
-
+
+ /**
+ * Inject.
+ */
protected abstract void inject();
-
+
+ /**
+ * Gets title.
+ *
+ * @return the title
+ */
public abstract String getTitle();
}
diff --git a/Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/editors/IParameterized.java b/Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/editors/IParameterized.java
index c400f844a..95b352987 100644
--- a/Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/editors/IParameterized.java
+++ b/Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/editors/IParameterized.java
@@ -8,11 +8,16 @@ import java.util.ArrayList;
import java.util.List;
/**
- * Created by Roy on 11/20/2017.
+ * Represents an object that supports binding of it's parameters through the {@link ParameterizedEditor} view.
*/
-
public interface IParameterized
{
+
+ /**
+ * Gets the object bind-able parameters.
+ *
+ * @return the parameters
+ */
default List<ParameterItem> getParameters()
{
List<ParameterItem> parameters = new ArrayList<>();
diff --git a/Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/editors/ParameterAnnotation.java b/Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/editors/ParameterAnnotation.java
index 32d15ad46..102bb0b4f 100644
--- a/Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/editors/ParameterAnnotation.java
+++ b/Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/editors/ParameterAnnotation.java
@@ -5,18 +5,47 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
+
/**
- * Created by Roy on 11/20/2017.
+ * Represents a {@link ParameterItem} property annotation.
*/
-
@Target(ElementType.FIELD)
@Retention(RetentionPolicy.RUNTIME)
public @interface ParameterAnnotation
{
+ /**
+ * Parameter display name.
+ *
+ * @return the string
+ */
String name() default "";
+
+ /**
+ * Minimum value.
+ *
+ * @return the double
+ */
double minimum() default 0;
+
+ /**
+ * Maximum value.
+ *
+ * @return the double
+ */
double maximum() default 100;
+
+ /**
+ * Default value.
+ *
+ * @return the double
+ */
double defaultValue() default 0;
+
+ /**
+ * Type of parameter.
+ *
+ * @return the class
+ */
Class<?> type() default double.class;
}
diff --git a/Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/editors/ParameterItem.java b/Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/editors/ParameterItem.java
index 96ae45caf..a89b1c671 100644
--- a/Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/editors/ParameterItem.java
+++ b/Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/editors/ParameterItem.java
@@ -3,7 +3,7 @@ package com.twine.tango.sharedui.editors;
import com.twine.tango.sharedui.mvvm.DependencyProperty;
/**
- * Created by Roy on 11/20/2017.
+ * Represents a bind-able parameter which links an {@link IParameterized} object property to an android xml view.
*/
public class ParameterItem
{
@@ -11,74 +11,155 @@ public class ParameterItem
private double minimum;
private double maximum;
private double defaultValue;
+ private Class<?> type;
+
+ /**
+ * The Property.
+ */
public DependencyProperty property;
+
+ /**
+ * The Number.
+ */
public DependencyProperty<Integer> number;
- private Class<?> type;
+ /**
+ * Gets name.
+ *
+ * @return the name
+ */
public String getName()
{
return name;
}
+ /**
+ * Sets name.
+ *
+ * @param name the name
+ */
public void setName(String name)
{
this.name = name;
}
+ /**
+ * Gets property.
+ *
+ * @return the property
+ */
public DependencyProperty getProperty()
{
return property;
}
+ /**
+ * Sets property.
+ *
+ * @param property the property
+ */
public void setProperty(DependencyProperty property)
{
this.property = property;
}
+ /**
+ * Gets minimum.
+ *
+ * @return the minimum
+ */
public double getMinimum()
{
return minimum;
}
+ /**
+ * Sets minimum.
+ *
+ * @param minimum the minimum
+ */
public void setMinimum(double minimum)
{
this.minimum = minimum;
}
+ /**
+ * Gets maximum.
+ *
+ * @return the maximum
+ */
public double getMaximum()
{
return maximum;
}
+ /**
+ * Sets maximum.
+ *
+ * @param maximum the maximum
+ */
public void setMaximum(double maximum)
{
this.maximum = maximum;
}
+ /**
+ * Gets default value.
+ *
+ * @return the default value
+ */
public double getDefaultValue()
{
return defaultValue;
}
+ /**
+ * Sets default value.
+ *
+ * @param defaultValue the default value
+ */
public void setDefaultValue(double defaultValue)
{
this.defaultValue = defaultValue;
}
+ /**
+ * Gets type.
+ *
+ * @return the type
+ */
public Class<?> getType()
{
return type;
}
+ /**
+ * Sets type.
+ *
+ * @param type the type
+ */
public void setType(Class<?> type)
{
this.type = type;
}
+ /**
+ * Instantiates a new Parameter item.
+ */
public ParameterItem()
{
}
+ /**
+ * Instantiates a new Parameter item.
+ *
+ * @param name the name
+ * @param minimum the minimum
+ * @param maximum the maximum
+ * @param defaultValue the default value
+ * @param property the property
+ * @param type the type
+ */
public ParameterItem(String name, double minimum, double maximum, double defaultValue, DependencyProperty property, Class<?> type)
{
this.name = name;
diff --git a/Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/editors/ParameterizedEditor.java b/Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/editors/ParameterizedEditor.java
index 92e4f9305..64ab322b9 100644
--- a/Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/editors/ParameterizedEditor.java
+++ b/Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/editors/ParameterizedEditor.java
@@ -1,13 +1,8 @@
package com.twine.tango.sharedui.editors;
import android.content.Context;
-import android.content.res.TypedArray;
-import android.databinding.BindingAdapter;
import android.databinding.DataBindingUtil;
import android.databinding.ViewDataBinding;
-import android.graphics.drawable.GradientDrawable.Orientation;
-import android.support.v7.widget.LinearLayoutCompat.OrientationMode;
-import android.text.method.ScrollingMovementMethod;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
@@ -15,30 +10,44 @@ import android.widget.LinearLayout;
import android.widget.ScrollView;
import android.widget.TextView;
-import com.twine.tango.core.ContextFactory;
import com.twine.tango.sharedui.BR;
import com.twine.tango.sharedui.R;
import java.util.List;
/**
- * Created by Roy on 11/20/2017.
+ * Represents a view capable of presenting and controlling an {@link IParameterized} object.
*/
-
public class ParameterizedEditor extends ScrollView
{
private IParameterized parameterizedObject;
+ /**
+ * Instantiates a new Parameterized editor.
+ *
+ * @param context the context
+ * @param attrs the attrs
+ */
public ParameterizedEditor(Context context, AttributeSet attrs)
{
super(context, attrs);
}
+ /**
+ * Gets parameterized object.
+ *
+ * @return the parameterized object
+ */
public IParameterized getParameterizedObject()
{
return parameterizedObject;
}
+ /**
+ * Sets parameterized object.
+ *
+ * @param parameterizedObject the parameterized object
+ */
public void setParameterizedObject(IParameterized parameterizedObject)
{
this.parameterizedObject = parameterizedObject;
@@ -67,13 +76,4 @@ public class ParameterizedEditor extends ScrollView
layout.addView(binding.getRoot());
}
}
-
- @BindingAdapter("android:parameterizedObject")
- public static void parameterizedObjectAdapter(ParameterizedEditor view, IParameterized object)
- {
- if (view != null && object != null)
- {
- view.setParameterizedObject(object);
- }
- }
}
diff --git a/Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/mvvm/DependencyProperty.java b/Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/mvvm/DependencyProperty.java
index 15361515a..95b42f357 100644
--- a/Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/mvvm/DependencyProperty.java
+++ b/Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/mvvm/DependencyProperty.java
@@ -2,28 +2,52 @@ package com.twine.tango.sharedui.mvvm;
import android.databinding.ObservableField;
+
/**
- * Created by Roy on 7/27/2017.
+ * Represents a property with support for change notification and data binding.
+ *
+ * @param <T> the type parameter
*/
-
public class DependencyProperty<T> extends ObservableField<T>
{
private boolean blockNotify;
+ /**
+ * The interface On property changed callback.
+ *
+ * @param <T> the type parameter
+ */
public interface OnPropertyChangedCallback<T>
{
+ /**
+ * On property changed.
+ *
+ * @param dp the dp
+ * @param value the value
+ */
void onPropertyChanged(DependencyProperty<T> dp, T value);
}
private OnPropertyChangedCallback<T> callback;
+ /**
+ * Instantiates a new Dependency property.
+ *
+ * @param callback the callback
+ */
public DependencyProperty(OnPropertyChangedCallback<T> callback)
{
this.callback = callback;
init();
}
+ /**
+ * Instantiates a new Dependency property.
+ *
+ * @param defaultValue the default value
+ * @param callback the callback
+ */
public DependencyProperty(T defaultValue, OnPropertyChangedCallback<T> callback)
{
this.set(defaultValue);
@@ -31,17 +55,30 @@ public class DependencyProperty<T> extends ObservableField<T>
init();
}
+ /**
+ * Instantiates a new Dependency property.
+ *
+ * @param defaultValue the default value
+ */
public DependencyProperty(T defaultValue)
{
this.set(defaultValue);
init();
}
+ /**
+ * Instantiates a new Dependency property.
+ */
public DependencyProperty()
{
init();
}
+ /**
+ * Sets no change.
+ *
+ * @param value the value
+ */
public void setNoChange(T value)
{
blockNotify = true;
diff --git a/Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/mvvm/FieldUtils.java b/Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/mvvm/FieldUtils.java
index 94f99359a..8ec2fe33b 100644
--- a/Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/mvvm/FieldUtils.java
+++ b/Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/mvvm/FieldUtils.java
@@ -1,18 +1,4 @@
-package com.twine.tango.sharedui.mvvm;/*
- * Copyright 2016 Manas Chaudhari
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
+package com.twine.tango.sharedui.mvvm;
import android.databinding.Observable.OnPropertyChangedCallback;
import android.databinding.ObservableField;
diff --git a/Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/mvvm/IView.java b/Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/mvvm/IView.java
index 24597b4c5..9f0ef2b9f 100644
--- a/Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/mvvm/IView.java
+++ b/Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/mvvm/IView.java
@@ -2,8 +2,20 @@ package com.twine.tango.sharedui.mvvm;
import io.reactivex.functions.Consumer;
+/**
+ * Represents a supervising controller pattern view.
+ */
public interface IView
{
+ /**
+ * Attach view.
+ */
void attachView();
+
+ /**
+ * Validate fields.
+ *
+ * @param consumer the consumer
+ */
void validateFields(Consumer<Boolean> consumer);
}
diff --git a/Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/mvvm/ReadOnlyField.java b/Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/mvvm/ReadOnlyField.java
index cf6f8abd8..067dd953b 100644
--- a/Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/mvvm/ReadOnlyField.java
+++ b/Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/mvvm/ReadOnlyField.java
@@ -1,18 +1,4 @@
-package com.twine.tango.sharedui.mvvm;/*
- * Copyright 2016 Manas Chaudhari
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
+package com.twine.tango.sharedui.mvvm;
import android.databinding.ObservableField;
import android.support.annotation.NonNull;
@@ -47,12 +33,7 @@ public class ReadOnlyField<T> extends ObservableField<T> {
}
}).onErrorResumeNext(Observable.<T>empty()).share();
}
-
- /**
- * @deprecated Setter of com.sirilix.mvvm.ReadOnlyField does nothing. Merge with the source Observable instead.
- * See <a href="https://github.com/manas-chaudhari/android-mvvm/tree/master/Documentation/ObservablesAndSetters.md">Documentation/ObservablesAndSetters.md</a>
- */
- @Deprecated
+
@Override
public void set(T value) {
}
diff --git a/Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/mvvm/RelayCommand.java b/Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/mvvm/RelayCommand.java
index 586ef9ef6..e6d638678 100644
--- a/Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/mvvm/RelayCommand.java
+++ b/Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/mvvm/RelayCommand.java
@@ -3,28 +3,54 @@ package com.twine.tango.sharedui.mvvm;
import android.databinding.BindingAdapter;
import android.view.View;
+
/**
- * Created by Roy on 7/27/2017.
+ * Represents bind-able relay command.
*/
-
public class RelayCommand {
-
+
+ /**
+ * The interface On command execute.
+ */
public interface OnCommandExecute
{
+ /**
+ * Execute.
+ */
void execute();
}
-
+
+ /**
+ * The interface Command can execute.
+ */
public interface CommandCanExecute
{
+ /**
+ * Can execute boolean.
+ *
+ * @return the boolean
+ */
boolean canExecute();
}
-
+
+ /**
+ * The On command execute.
+ */
public OnCommandExecute onCommandExecute;
-
+
+ /**
+ * The Command can execute.
+ */
public CommandCanExecute commandCanExecute;
private View bindedView;
-
+
+ /**
+ * Command binding.
+ *
+ * @param view the view
+ * @param command the command
+ */
@BindingAdapter("android:command")
public static void CommandBinding(View view, RelayCommand command)
{
@@ -39,25 +65,45 @@ public class RelayCommand {
command.invalidateCommand();
}
-
+
+ /**
+ * Instantiates a new Relay command.
+ *
+ * @param onCommandExecute the on command execute
+ */
public RelayCommand(OnCommandExecute onCommandExecute) {
this.onCommandExecute = onCommandExecute;
}
-
+
+ /**
+ * Instantiates a new Relay command.
+ *
+ * @param onCommandExecute the on command execute
+ * @param commandCanExecute the command can execute
+ */
public RelayCommand(OnCommandExecute onCommandExecute, CommandCanExecute commandCanExecute) {
this.onCommandExecute = onCommandExecute;
this.commandCanExecute = commandCanExecute;
}
-
+
+ /**
+ * Instantiates a new Relay command.
+ */
public RelayCommand() {
}
-
+
+ /**
+ * Execute.
+ */
public void execute()
{
onCommandExecute.execute();
}
-
+
+ /**
+ * Invalidate command.
+ */
public void invalidateCommand()
{
if (commandCanExecute != null)
diff --git a/Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/mvvm/ViewModelBase.java b/Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/mvvm/ViewModelBase.java
index d8aa18081..60886b7e7 100644
--- a/Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/mvvm/ViewModelBase.java
+++ b/Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/mvvm/ViewModelBase.java
@@ -4,23 +4,41 @@ import android.util.Log;
import java.lang.reflect.Field;
+
/**
- * Created by Roy on 7/26/2017.
+ * Represents a base View Model.
+ *
+ * @param <T> the type parameter
*/
-
public abstract class ViewModelBase<T extends IView> {
-
+
+ /**
+ * The View.
+ */
public T view; //TODO: Maybe use WeakReference<T> to not prevent garbage collector from disposing the activity ?
-
+
+ /**
+ * Attach view.
+ *
+ * @param view the view
+ */
public void attachView(T view) {
this.view = view;
onViewAttached(view);
}
-
+
+ /**
+ * On view attached.
+ *
+ * @param view the view
+ */
protected void onViewAttached(T view) {
Log.i("MVVM",view.getClass().getSimpleName() + " attached to " + this.getClass().getSimpleName());
}
+ /**
+ * Invalidate commands.
+ */
protected void invalidateCommands()
{
for (Field field : this.getClass().getDeclaredFields())
diff --git a/Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/navigation/AndroidNavigationProvider.java b/Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/navigation/AndroidNavigationProvider.java
index 317e70637..dcdf4160f 100644
--- a/Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/navigation/AndroidNavigationProvider.java
+++ b/Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/navigation/AndroidNavigationProvider.java
@@ -5,10 +5,13 @@ import android.app.FragmentTransaction;
import android.support.v7.app.AppCompatActivity;
import com.elvishew.xlog.XLog;
-import com.twine.tango.core.Action1;
+import com.twine.tango.core.IAction1;
import com.twine.tango.sharedui.R;
import com.twine.tango.sharedui.containers.FragmentBase;
+/**
+ * Represents an android navigation provider.
+ */
public class AndroidNavigationProvider implements INavigationProvider
{
private AppCompatActivity activity;
@@ -32,7 +35,7 @@ public class AndroidNavigationProvider implements INavigationProvider
}
@Override
- public void navigateTo(Enum fragmentValue, Action1<FragmentBase> onCreateListener)
+ public void navigateTo(Enum fragmentValue, IAction1<FragmentBase> onCreateListener)
{
navigateTo(fragmentValue.name(), onCreateListener);
}
@@ -44,7 +47,7 @@ public class AndroidNavigationProvider implements INavigationProvider
}
@Override
- public void navigateTo(String fragmentName, Action1<FragmentBase> onCreateListener)
+ public void navigateTo(String fragmentName, IAction1<FragmentBase> onCreateListener)
{
if (activity == null)
{
diff --git a/Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/navigation/INavigationProvider.java b/Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/navigation/INavigationProvider.java
index fda6db70a..cc333cfd8 100644
--- a/Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/navigation/INavigationProvider.java
+++ b/Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/navigation/INavigationProvider.java
@@ -2,7 +2,7 @@ package com.twine.tango.sharedui.navigation;
import android.support.v7.app.AppCompatActivity;
-import com.twine.tango.core.Action1;
+import com.twine.tango.core.IAction1;
import com.twine.tango.sharedui.containers.FragmentBase;
/**
@@ -10,13 +10,42 @@ import com.twine.tango.sharedui.containers.FragmentBase;
*/
public interface INavigationProvider
{
+ /**
+ * Register navigation activity.
+ *
+ * @param activity the activity
+ * @param fragmentContainerId the fragment container id
+ * @param basePackagePath the base package path
+ */
void registerNavigationActivity(AppCompatActivity activity, int fragmentContainerId, String basePackagePath);
+ /**
+ * Navigate to the specified fragment name.
+ *
+ * @param fragmentName the fragment name
+ */
void navigateTo(String fragmentName);
- void navigateTo(String fragmentName, Action1<FragmentBase> onCreateListener);
+ /**
+ * Navigate to to the specified fragment name.
+ *
+ * @param fragmentName the fragment name
+ * @param onCreateListener the on create listener
+ */
+ void navigateTo(String fragmentName, IAction1<FragmentBase> onCreateListener);
+ /**
+ * Navigate to to the specified enum value fragment name.
+ *
+ * @param fragmentValue the fragment value
+ */
void navigateTo(Enum fragmentValue);
- void navigateTo(Enum fragmentValue, Action1<FragmentBase> onCreateListener);
+ /**
+ * Navigate to to the specified enum value fragment name.
+ *
+ * @param fragmentValue the fragment value
+ * @param onCreateListener the on create listener
+ */
+ void navigateTo(Enum fragmentValue, IAction1<FragmentBase> onCreateListener);
}
diff --git a/Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/notifications/AndroidNotificationProvider.java b/Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/notifications/AndroidNotificationProvider.java
index e1e86efe9..e1a099093 100644
--- a/Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/notifications/AndroidNotificationProvider.java
+++ b/Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/notifications/AndroidNotificationProvider.java
@@ -1,22 +1,26 @@
package com.twine.tango.sharedui.notifications;
import android.content.Context;
-import android.content.DialogInterface;
import android.support.v7.app.AlertDialog;
import android.widget.Toast;
-import com.twine.tango.core.Action;
+import com.twine.tango.core.IAction;
import com.twine.tango.sharedui.mvvm.IView;
+
/**
- * Created by Roy on 7/29/2017.
+ * Represents the default {@link INotificationProvider}.
*/
-
public class AndroidNotificationProvider implements INotificationProvider
{
private Context context;
+ /**
+ * Instantiates a new Android notification provider.
+ *
+ * @param context the context
+ */
public AndroidNotificationProvider(Context context)
{
this.context = context;
@@ -35,7 +39,7 @@ public class AndroidNotificationProvider implements INotificationProvider
}
@Override
- public void showMessage(IView view, String message, Action action)
+ public void showMessage(IView view, String message, IAction action)
{
AlertDialog.Builder builder = new AlertDialog.Builder((Context) view);
builder.setMessage("Look at this dialog!")
diff --git a/Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/notifications/INotificationProvider.java b/Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/notifications/INotificationProvider.java
index 191f8ffcb..241c8a49c 100644
--- a/Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/notifications/INotificationProvider.java
+++ b/Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/notifications/INotificationProvider.java
@@ -1,19 +1,37 @@
package com.twine.tango.sharedui.notifications;
-import com.twine.tango.core.Action;
+import com.twine.tango.core.IAction;
import com.twine.tango.sharedui.mvvm.IView;
+
/**
- * Created by Roy on 7/29/2017.
+ * Represents a notifications provider service.
*/
-
public interface INotificationProvider
{
+ /**
+ * Toast.
+ *
+ * @param message the message
+ */
void toast(String message);
+ /**
+ * Show message.
+ *
+ * @param view the view
+ * @param message the message
+ */
void showMessage(IView view, String message);
- void showMessage(IView view, String message, Action action);
+ /**
+ * Show message.
+ *
+ * @param view the view
+ * @param message the message
+ * @param action the action
+ */
+ void showMessage(IView view, String message, IAction action);
}
diff --git a/Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/paging/PagerAdapter.java b/Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/paging/PagerAdapter.java
index 2e151cc01..a74848816 100644
--- a/Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/paging/PagerAdapter.java
+++ b/Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/paging/PagerAdapter.java
@@ -9,26 +9,41 @@ import com.twine.tango.sharedui.containers.FragmentBaseV4;
import java.util.ArrayList;
import java.util.List;
+
/**
- * Created by Roy on 7/24/2017.
+ * Represents a fragments paging adapter.
*/
-
public class PagerAdapter extends FragmentPagerAdapter {
private List<FragmentBaseV4> fragments;
private int currentPosition;
-
+
+ /**
+ * Instantiates a new Pager adapter.
+ *
+ * @param fm the fm
+ */
public PagerAdapter(FragmentManager fm) {
super(fm);
fragments = new ArrayList<>();
}
-
+
+ /**
+ * Add fragment.
+ *
+ * @param fragment the fragment
+ */
public void addFragment(FragmentBaseV4 fragment)
{
fragments.add(fragment);
}
-
+
+ /**
+ * Remove fragment.
+ *
+ * @param fragment the fragment
+ */
public void removeFragment(FragmentBaseV4 fragment)
{
fragments.remove(fragment);
@@ -39,7 +54,13 @@ public class PagerAdapter extends FragmentPagerAdapter {
currentPosition = position;
return fragments.get(position);
}
-
+
+ /**
+ * Gets current fragment.
+ *
+ * @param <T> the type parameter
+ * @return the current fragment
+ */
@SuppressWarnings("unchecked")
public <T> T getCurrentFragment() {
return (T) getItem(currentPosition);
diff --git a/Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/paging/PagerZoomTransform.java b/Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/paging/PagerZoomTransform.java
index 9c114c01c..4fefcff13 100644
--- a/Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/paging/PagerZoomTransform.java
+++ b/Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/paging/PagerZoomTransform.java
@@ -3,6 +3,9 @@ package com.twine.tango.sharedui.paging;
import android.support.v4.view.ViewPager;
import android.view.View;
+/**
+ * Represents an interactive view pager transformer.
+ */
public class PagerZoomTransform implements ViewPager.PageTransformer {
private static final float MIN_SCALE = 0.85f;
private static final float MIN_ALPHA = 0.5f;
diff --git a/Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/validation/IViewValidator.java b/Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/validation/IViewValidator.java
index 5158a118b..710d57e49 100644
--- a/Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/validation/IViewValidator.java
+++ b/Software/Android_Studio/Tango.SharedUI/src/main/java/com/twine/tango/sharedui/validation/IViewValidator.java
@@ -5,10 +5,10 @@ import com.mobsandgeeks.saripaar.Validator;
import java.util.List;
+
/**
- * Created by Roy on 11/6/2017.
+ * Represents a view with support for auto field validation.
*/
-
public class IViewValidator implements Validator.ValidationListener {
@Override
diff --git a/Software/Android_Studio/Tango.Stubs.UI/src/main/java/com/twine/tango/stubs/ui/App.java b/Software/Android_Studio/Tango.Stubs.UI/src/main/java/com/twine/tango/stubs/ui/App.java
index 69e4c7b22..d0437aaa1 100644
--- a/Software/Android_Studio/Tango.Stubs.UI/src/main/java/com/twine/tango/stubs/ui/App.java
+++ b/Software/Android_Studio/Tango.Stubs.UI/src/main/java/com/twine/tango/stubs/ui/App.java
@@ -2,35 +2,19 @@ package com.twine.tango.stubs.ui;
import android.app.Application;
import android.content.Context;
-import android.os.Environment;
-import com.elvishew.xlog.LogConfiguration;
-import com.elvishew.xlog.LogLevel;
import com.elvishew.xlog.XLog;
-import com.elvishew.xlog.printer.AndroidPrinter;
-import com.elvishew.xlog.printer.Printer;
-import com.elvishew.xlog.printer.file.FilePrinter;
-import com.elvishew.xlog.printer.file.backup.FileSizeBackupStrategy;
-import com.elvishew.xlog.printer.file.naming.DateFileNameGenerator;
-import com.google.protobuf.GeneratedMessageV3;
-import com.twine.tango.core.ContextFactory;
-import com.twine.tango.dal.TangoDB;
-import com.twine.tango.sharedui.AppInitializer;
+import com.twine.tango.sharedui.TangoApplication;
import com.twine.tango.stubs.ui.dagger.ApplicationComponent;
import com.twine.tango.stubs.ui.dagger.ApplicationModule;
import com.twine.tango.stubs.ui.dagger.DaggerApplicationComponent;
-import net.danlew.android.joda.JodaTimeAndroid;
-
-import java.io.File;
-
/**
* Created by Roy on 11/6/2017.
*/
-public class App extends Application {
- private static Context context;
-
+public class App extends TangoApplication
+{
private ApplicationComponent appComponent;
public ApplicationComponent getAppComponent() {
@@ -42,33 +26,13 @@ public class App extends Application {
}
@Override
- public File getDatabasePath(String name)
- {
- return new File(TangoDB.getDataBasePath());
- }
-
- @Override
public void onCreate() {
super.onCreate();
appComponent = initDagger(this);
- context = getApplicationContext();
-
- AppInitializer.init(context);
-
- Thread.setDefaultUncaughtExceptionHandler((thread, throwable) -> {
-
- throwable.printStackTrace();
- XLog.e(throwable);
- System.exit(1);
- });
}
public static ApplicationComponent getComponent() {
return ((App) context).getAppComponent();
}
-
- public static Context getContext() {
- return context;
- }
}
diff --git a/Software/Android_Studio/Tango.Stubs/src/main/java/com/twine/tango/stubs/AvailableStub.java b/Software/Android_Studio/Tango.Stubs/src/main/java/com/twine/tango/stubs/AvailableStub.java
index ca6d691de..f1b2488af 100644
--- a/Software/Android_Studio/Tango.Stubs/src/main/java/com/twine/tango/stubs/AvailableStub.java
+++ b/Software/Android_Studio/Tango.Stubs/src/main/java/com/twine/tango/stubs/AvailableStub.java
@@ -3,10 +3,10 @@ package com.twine.tango.stubs;
import com.elvishew.xlog.XLog;
import com.twine.tango.transport.ITransporter;
+
/**
- * Created by Roy on 11/14/2017.
+ * Represents a description of an available stub type which can be instantiated and run.
*/
-
public class AvailableStub
{
@@ -14,36 +14,73 @@ public class AvailableStub
private String name;
private String description;
+ /**
+ * Gets type.
+ *
+ * @return the type
+ */
public Class<?> getType()
{
return type;
}
+ /**
+ * Sets type.
+ *
+ * @param type the type
+ */
public void setType(Class<?> type)
{
this.type = type;
}
+ /**
+ * Gets name.
+ *
+ * @return the name
+ */
public String getName()
{
return name;
}
+ /**
+ * Sets name.
+ *
+ * @param name the name
+ */
public void setName(String name)
{
this.name = name;
}
+ /**
+ * Gets description.
+ *
+ * @return the description
+ */
public String getDescription()
{
return description;
}
+ /**
+ * Sets description.
+ *
+ * @param description the description
+ */
public void setDescription(String description)
{
this.description = description;
}
+ /**
+ * Instantiates a new Available stub.
+ *
+ * @param type the type
+ * @param name the name
+ * @param description the description
+ */
public AvailableStub(Class<?> type, String name, String description)
{
this.type = type;
@@ -51,6 +88,12 @@ public class AvailableStub
this.description = description;
}
+ /**
+ * Create instance stub base.
+ *
+ * @param transporter the transporter
+ * @return the stub base
+ */
public StubBase createInstance(ITransporter transporter)
{
try
diff --git a/Software/Android_Studio/Tango.Stubs/src/main/java/com/twine/tango/stubs/IStub.java b/Software/Android_Studio/Tango.Stubs/src/main/java/com/twine/tango/stubs/IStub.java
index 4168021dc..5bacc06ad 100644
--- a/Software/Android_Studio/Tango.Stubs/src/main/java/com/twine/tango/stubs/IStub.java
+++ b/Software/Android_Studio/Tango.Stubs/src/main/java/com/twine/tango/stubs/IStub.java
@@ -5,13 +5,30 @@ import com.twine.tango.sharedui.editors.IParameterized;
import io.reactivex.Observable;
import io.reactivex.Single;
+
/**
- * Created by Roy on 11/14/2017.
+ * Represents a parameterized stub.
*/
-
public interface IStub extends IParameterized
{
+ /**
+ * Gets stub state.
+ *
+ * @return the state
+ */
StubState getState();
+
+ /**
+ * Runs the stub on subscribe.
+ *
+ * @return the observable
+ */
Observable<String> run();
+
+ /**
+ * Cancels the stub by ignoring the response.
+ *
+ * @return the single
+ */
Single<String> cancel();
}
diff --git a/Software/Android_Studio/Tango.Stubs/src/main/java/com/twine/tango/stubs/StubAnnotation.java b/Software/Android_Studio/Tango.Stubs/src/main/java/com/twine/tango/stubs/StubAnnotation.java
index 6b070b401..68c19066a 100644
--- a/Software/Android_Studio/Tango.Stubs/src/main/java/com/twine/tango/stubs/StubAnnotation.java
+++ b/Software/Android_Studio/Tango.Stubs/src/main/java/com/twine/tango/stubs/StubAnnotation.java
@@ -5,18 +5,34 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
+
/**
- * Created by Roy on 11/14/2017.
+ * Represents an {@link IStub} annotation.
*/
-
-
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
public @interface StubAnnotation
{
-
+
+ /**
+ * Stub direction.
+ *
+ * @return the stub direction
+ */
StubDirection direction() default StubDirection.ToMachine;
+
+ /**
+ * Stub display name.
+ *
+ * @return the string
+ */
String name() default "";
+
+ /**
+ * Stub description.
+ *
+ * @return the string
+ */
String description() default "";
}
diff --git a/Software/Android_Studio/Tango.Stubs/src/main/java/com/twine/tango/stubs/StubBase.java b/Software/Android_Studio/Tango.Stubs/src/main/java/com/twine/tango/stubs/StubBase.java
index a0e963b8d..80ac59a8e 100644
--- a/Software/Android_Studio/Tango.Stubs/src/main/java/com/twine/tango/stubs/StubBase.java
+++ b/Software/Android_Studio/Tango.Stubs/src/main/java/com/twine/tango/stubs/StubBase.java
@@ -1,7 +1,7 @@
package com.twine.tango.stubs;
import com.elvishew.xlog.XLog;
-import com.twine.tango.core.Reflections;
+import com.twine.tango.core.ReflectionsHelper;
import com.twine.tango.transport.ITransporter;
import java.util.ArrayList;
@@ -11,19 +11,29 @@ import io.reactivex.Observable;
import io.reactivex.Single;
import io.reactivex.subjects.PublishSubject;
+
/**
- * Created by Roy on 11/14/2017.
+ * Represents na {@link IStub} base class.
*/
-
public abstract class StubBase implements IStub {
private ITransporter transporter;
private StubState state;
-
+
+ /**
+ * Gets transporter.
+ *
+ * @return the transporter
+ */
public ITransporter getTransporter() {
return transporter;
}
-
+
+ /**
+ * Sets the transporter to execute the stub on.
+ *
+ * @param transporter the transporter
+ */
public void setTransporter(ITransporter transporter) {
this.transporter = transporter;
}
@@ -32,11 +42,21 @@ public abstract class StubBase implements IStub {
public StubState getState() {
return state;
}
-
+
+ /**
+ * Sets state.
+ *
+ * @param state the state
+ */
protected void setState(StubState state) {
this.state = state;
}
-
+
+ /**
+ * Instantiates a new Stub base.
+ *
+ * @param transporter the transporter
+ */
public StubBase(ITransporter transporter) {
this.transporter = transporter;
}
@@ -70,14 +90,25 @@ public abstract class StubBase implements IStub {
public Single<String> cancel() {
return null;
}
-
+
+ /**
+ * On run observable.
+ *
+ * @return the observable
+ */
protected abstract Observable<String> onRun();
-
+
+ /**
+ * Gets all stubs.
+ *
+ * @param direction the direction
+ * @return the all stubs
+ */
public static List<AvailableStub> getAllStubs(StubDirection direction)
{
List<AvailableStub> stubs = new ArrayList<>();
- List<String> names = Reflections.getReflectionListFromResource(R.raw.stubs);
+ List<String> names = ReflectionsHelper.getReflectionListFromResource(R.raw.stubs);
for (String name : names)
{
diff --git a/Software/Android_Studio/Tango.Stubs/src/main/java/com/twine/tango/stubs/StubDirection.java b/Software/Android_Studio/Tango.Stubs/src/main/java/com/twine/tango/stubs/StubDirection.java
index 17409dd8e..b9b3483ec 100644
--- a/Software/Android_Studio/Tango.Stubs/src/main/java/com/twine/tango/stubs/StubDirection.java
+++ b/Software/Android_Studio/Tango.Stubs/src/main/java/com/twine/tango/stubs/StubDirection.java
@@ -1,11 +1,20 @@
package com.twine.tango.stubs;
+
/**
- * Created by Roy on 11/14/2017.
+ * Represents the different stub directions.
*/
-
public enum StubDirection {
+ /**
+ * To machine stub direction.
+ */
ToMachine,
+ /**
+ * To mobile stub direction.
+ */
ToMobile,
+ /**
+ * Both stub direction.
+ */
Both,
}
diff --git a/Software/Android_Studio/Tango.Stubs/src/main/java/com/twine/tango/stubs/StubState.java b/Software/Android_Studio/Tango.Stubs/src/main/java/com/twine/tango/stubs/StubState.java
index 5a83533f0..1b492b45f 100644
--- a/Software/Android_Studio/Tango.Stubs/src/main/java/com/twine/tango/stubs/StubState.java
+++ b/Software/Android_Studio/Tango.Stubs/src/main/java/com/twine/tango/stubs/StubState.java
@@ -1,13 +1,28 @@
package com.twine.tango.stubs;
+
/**
- * Created by Roy on 11/14/2017.
+ * Represents the different stub states.
*/
-
public enum StubState {
+ /**
+ * Stopped stub state.
+ */
Stopped,
+ /**
+ * Running stub state.
+ */
Running,
+ /**
+ * Passed stub state.
+ */
Passed,
+ /**
+ * Failed stub state.
+ */
Failed,
+ /**
+ * Canceled stub state.
+ */
Canceled
}
diff --git a/Software/Android_Studio/Tango.Stubs/src/main/java/com/twine/tango/stubs/stubs/Calculate.java b/Software/Android_Studio/Tango.Stubs/src/main/java/com/twine/tango/stubs/stubs/Calculate.java
index d6c02fa75..68c697b67 100644
--- a/Software/Android_Studio/Tango.Stubs/src/main/java/com/twine/tango/stubs/stubs/Calculate.java
+++ b/Software/Android_Studio/Tango.Stubs/src/main/java/com/twine/tango/stubs/stubs/Calculate.java
@@ -13,23 +13,33 @@ import com.twine.tango.transport.ITransporter;
import io.reactivex.Observable;
import io.reactivex.subjects.PublishSubject;
+
/**
- * Created by Roy on 11/14/2017.
+ * Represents a simple calculation stub.
*/
-
-
@StubAnnotation(direction = StubDirection.ToMachine, name = "Calculate", description = "Calculate Description...")
public class Calculate extends StubBase
{
+ /**
+ * Instantiates a new Calculate.
+ *
+ * @param transporter the transporter
+ */
public Calculate(ITransporter transporter)
{
super(transporter);
}
+ /**
+ * Number 1 to sum.
+ */
@ParameterAnnotation(name = "Number 1", defaultValue = 5.0)
public DependencyProperty<Double> number1 = new DependencyProperty<>(5.0);
+ /**
+ * Number 2 to sum.
+ */
@ParameterAnnotation(name = "Number 2", defaultValue = 10.0)
public DependencyProperty<Double> number2 = new DependencyProperty<>(10.0);
diff --git a/Software/Android_Studio/Tango.Stubs/src/main/java/com/twine/tango/stubs/stubs/Progress.java b/Software/Android_Studio/Tango.Stubs/src/main/java/com/twine/tango/stubs/stubs/Progress.java
index a9d8176a2..0b4d656f9 100644
--- a/Software/Android_Studio/Tango.Stubs/src/main/java/com/twine/tango/stubs/stubs/Progress.java
+++ b/Software/Android_Studio/Tango.Stubs/src/main/java/com/twine/tango/stubs/stubs/Progress.java
@@ -13,21 +13,32 @@ import com.twine.tango.transport.ITransporter;
import io.reactivex.Observable;
import io.reactivex.subjects.PublishSubject;
+
/**
- * Created by Roy on 11/14/2017.
+ * Represents a simple continuous stub demonstrating a multi response message..
*/
-
@StubAnnotation(direction = StubDirection.ToMachine, name = "Progress", description = "Multi Response Test...")
public class Progress extends StubBase
{
+ /**
+ * Instantiates a new Progress.
+ *
+ * @param transporter the transporter
+ */
public Progress(ITransporter transporter)
{
super(transporter);
}
+ /**
+ * The Amount of response messages.
+ */
@ParameterAnnotation(name = "Amount", maximum = 1000, defaultValue = 100)
public DependencyProperty<Number> amount = new DependencyProperty<>(100);
+ /**
+ * The Delay between each response.
+ */
@ParameterAnnotation(name = "Delay", maximum = 20, defaultValue = 4)
public DependencyProperty<Number> delay = new DependencyProperty<>(4);
diff --git a/Software/Android_Studio/Tango.Synchronization/src/main/java/com/twine/tango/synchronization/ITangoSynchronizer.java b/Software/Android_Studio/Tango.Synchronization/src/main/java/com/twine/tango/synchronization/ITangoSynchronizer.java
index 1b61a29aa..ef17439fd 100644
--- a/Software/Android_Studio/Tango.Synchronization/src/main/java/com/twine/tango/synchronization/ITangoSynchronizer.java
+++ b/Software/Android_Studio/Tango.Synchronization/src/main/java/com/twine/tango/synchronization/ITangoSynchronizer.java
@@ -1,12 +1,17 @@
package com.twine.tango.synchronization;
-import com.twine.tango.pmr.synchronization.SynchronizeDBResponseOuterClass.SynchronizeDBResponse;
-
import io.reactivex.Completable;
-import io.reactivex.Single;
+/**
+ * Represents the Tango application local to remote synchronization engine.
+ */
public interface ITangoSynchronizer
{
- Completable synchronize();
+ /**
+ * Synchronizes the local database with the remote database through the remote machine service.
+ *
+ * @return the completable.
+ */
+ Completable synchronizeDB();
}
diff --git a/Software/Android_Studio/Tango.Synchronization/src/main/java/com/twine/tango/synchronization/TangoSynchronizer.java b/Software/Android_Studio/Tango.Synchronization/src/main/java/com/twine/tango/synchronization/TangoSynchronizer.java
index 555e4f01c..e0cb01ef1 100644
--- a/Software/Android_Studio/Tango.Synchronization/src/main/java/com/twine/tango/synchronization/TangoSynchronizer.java
+++ b/Software/Android_Studio/Tango.Synchronization/src/main/java/com/twine/tango/synchronization/TangoSynchronizer.java
@@ -3,30 +3,36 @@ package com.twine.tango.synchronization;
import com.elvishew.xlog.XLog;
import com.google.protobuf.ByteString;
import com.snatik.storage.Storage;
-import com.twine.tango.core.ContextFactory;
+import com.twine.tango.core.ContextHelper;
import com.twine.tango.dal.TangoDB;
import com.twine.tango.integration.IMachineIdentityProvider;
import com.twine.tango.pmr.synchronization.SynchronizeDBRequestOuterClass.SynchronizeDBRequest;
-import com.twine.tango.pmr.synchronization.SynchronizeDBResponseOuterClass.SynchronizeDBResponse;
-import com.twine.tango.web.APIFactory;
+import com.twine.tango.web.WebApiFactory;
import com.twine.tango.web.ISynchronizationAPI;
import io.reactivex.Completable;
-import io.reactivex.Single;
+
+/**
+ * Represents the Tango application local to remote synchronization engine.
+ */
public class TangoSynchronizer implements ITangoSynchronizer
{
- private APIFactory api;
private IMachineIdentityProvider machineIdentityProvider;
- public TangoSynchronizer(APIFactory api, IMachineIdentityProvider machineIdentityProvider)
+
+ /**
+ * Instantiates a new Tango synchronizer.
+ *
+ * @param machineIdentityProvider the machine identity provider
+ */
+ public TangoSynchronizer(IMachineIdentityProvider machineIdentityProvider)
{
- this.api = api;
this.machineIdentityProvider = machineIdentityProvider;
}
@Override
- public Completable synchronize()
+ public Completable synchronizeDB()
{
return Completable.create((emitter) ->
{
@@ -34,13 +40,13 @@ public class TangoSynchronizer implements ITangoSynchronizer
//Backup DataBase.
TangoDB.backup();
- Storage storage = new Storage(ContextFactory.getApplicationContext());
+ Storage storage = new Storage(ContextHelper.getApplicationContext());
//Read current DB file bytes.
byte[] data = storage.readFile(TangoDB.getDataBasePath());
//Create synchronization web api.
- ISynchronizationAPI synchAPI = api.getSynchronizationAPI();
+ ISynchronizationAPI synchAPI = WebApiFactory.getSynchronizationAPI();
//Create synchronization response.
SynchronizeDBRequest request = SynchronizeDBRequest.newBuilder()
diff --git a/Software/Android_Studio/Tango.Transport/src/main/java/com/twine/tango/transport/ITransportAdapter.java b/Software/Android_Studio/Tango.Transport/src/main/java/com/twine/tango/transport/ITransportAdapter.java
index cdb2d4a6d..083ab60fd 100644
--- a/Software/Android_Studio/Tango.Transport/src/main/java/com/twine/tango/transport/ITransportAdapter.java
+++ b/Software/Android_Studio/Tango.Transport/src/main/java/com/twine/tango/transport/ITransportAdapter.java
@@ -1,12 +1,10 @@
package com.twine.tango.transport;
-import com.twine.tango.core.EventHandler;
+import com.twine.tango.core.IEventHandler;
import com.twine.tango.core.ObjectDisposedException;
import java.io.IOException;
-import java8.util.function.Consumer;
-
/**
* Represents a transport adapter capable of connecting, writing and receiving data from a serial stream.
*/
@@ -24,7 +22,7 @@ public interface ITransportAdapter extends ITransportComponent {
*
* @param handler event handler
*/
- void setDataAvailableListener(EventHandler<byte[]> handler);
+ void setDataAvailableListener(IEventHandler<byte[]> handler);
/**
* Gets the adapter address.
diff --git a/Software/Android_Studio/Tango.Transport/src/main/java/com/twine/tango/transport/ITransportComponent.java b/Software/Android_Studio/Tango.Transport/src/main/java/com/twine/tango/transport/ITransportComponent.java
index 889761806..e195c280f 100644
--- a/Software/Android_Studio/Tango.Transport/src/main/java/com/twine/tango/transport/ITransportComponent.java
+++ b/Software/Android_Studio/Tango.Transport/src/main/java/com/twine/tango/transport/ITransportComponent.java
@@ -1,10 +1,9 @@
package com.twine.tango.transport;
-import com.twine.tango.core.EventHandler;
+import com.twine.tango.core.IEventHandler;
import com.twine.tango.core.IDisposable;
-import com.twine.tango.core.ObjectDisposedException;
+
import io.reactivex.Completable;
-import java8.util.function.Consumer;
/**
@@ -31,14 +30,14 @@ public interface ITransportComponent extends IDisposable {
*
* @param listener the listener
*/
- void addStateChangedListener(EventHandler<TransportComponentState> listener);
+ void addStateChangedListener(IEventHandler<TransportComponentState> listener);
/**
* Removed a state changed listener.
*
* @param listener the listener
*/
- void removeStateChangedListener(EventHandler<TransportComponentState> listener);
+ void removeStateChangedListener(IEventHandler<TransportComponentState> listener);
/**
* Gets state.
diff --git a/Software/Android_Studio/Tango.Transport/src/main/java/com/twine/tango/transport/ITransporter.java b/Software/Android_Studio/Tango.Transport/src/main/java/com/twine/tango/transport/ITransporter.java
index 475893f02..ae5f6b5dc 100644
--- a/Software/Android_Studio/Tango.Transport/src/main/java/com/twine/tango/transport/ITransporter.java
+++ b/Software/Android_Studio/Tango.Transport/src/main/java/com/twine/tango/transport/ITransporter.java
@@ -1,7 +1,7 @@
package com.twine.tango.transport;
import com.google.protobuf.GeneratedMessageV3;
-import com.twine.tango.core.EventHandler;
+import com.twine.tango.core.IEventHandler;
import com.twine.tango.core.ObservableCollection;
import com.twine.tango.pmr.TangoMessage;
import com.twine.tango.pmr.common.MessageContainerOuterClass.MessageContainer;
@@ -11,30 +11,99 @@ import org.joda.time.Period;
import io.reactivex.Observable;
import io.reactivex.Single;
+
/**
- * Created by Roy on 11/13/2017.
+ * Represents a transport component capable of sending and receiving {@link TangoMessage} on a collection of {@link ITransportAdapter}.
*/
-
public interface ITransporter extends ITransportComponent {
-
+
+ /**
+ * Gets the collection of adapters.
+ *
+ * @return the adapters
+ */
ObservableCollection<ITransportAdapter> getAdapters();
-
+
+ /**
+ * Send a request to all adapters.
+ *
+ * @param <Request> the type parameter
+ * @param <Response> the type parameter
+ * @param request the request
+ * @return the single
+ */
<Request extends GeneratedMessageV3,Response extends GeneratedMessageV3> Single<Response> sendRequest(TangoMessage<Request> request);
-
+
+ /**
+ * Sends a request on the specified adapter.
+ *
+ * @param <Request> the type parameter
+ * @param <Response> the type parameter
+ * @param request the request
+ * @param adapter the adapter
+ * @return the single
+ */
<Request extends GeneratedMessageV3,Response extends GeneratedMessageV3> Single<Response> sendRequest(TangoMessage<Request> request,ITransportAdapter adapter);
-
+
+ /**
+ * Sends a continuous request on all adapters.
+ *
+ * @param <Request> the type parameter
+ * @param <Response> the type parameter
+ * @param request the request
+ * @return the observable
+ */
<Request extends GeneratedMessageV3,Response extends GeneratedMessageV3> Observable<Response> sendContinuousRequest(TangoMessage<Request> request);
-
+
+ /**
+ * Sends a continuous request on the specified adapter.
+ *
+ * @param <Request> the type parameter
+ * @param <Response> the type parameter
+ * @param request the request
+ * @param adapter the adapter
+ * @return the observable
+ */
<Request extends GeneratedMessageV3,Response extends GeneratedMessageV3> Observable<Response> sendContinuousRequest(TangoMessage<Request> request, ITransportAdapter adapter);
-
+
+ /**
+ * Sends a response.
+ *
+ * @param <Response> the type parameter
+ * @param response the response
+ * @return the single
+ */
<Response extends GeneratedMessageV3> Single<Response> sendResponse(TangoMessage<Response> response);
-
+
+ /**
+ * Sends a response with the specified request token.
+ *
+ * @param <Response> the type parameter
+ * @param response the response
+ * @param token the token
+ * @return the single
+ */
<Response extends GeneratedMessageV3> Single<Response> sendResponse(TangoMessage<Response> response,String token);
-
- void setRequestReceivedListener(EventHandler<MessageContainer> listener);
-
+
+ /**
+ * Sets request received listener.
+ *
+ * @param listener the listener
+ */
+ void setRequestReceivedListener(IEventHandler<MessageContainer> listener);
+
+ /**
+ * Gets the request timeout.
+ *
+ * @return the request timeout
+ */
Period getRequestTimeout();
-
+
+ /**
+ * Sets the request timeout.
+ *
+ * @param duration the duration
+ */
void setRequestTimeout(Period duration);
diff --git a/Software/Android_Studio/Tango.Transport/src/main/java/com/twine/tango/transport/TransportAdapterBase.java b/Software/Android_Studio/Tango.Transport/src/main/java/com/twine/tango/transport/TransportAdapterBase.java
index 7528e3e9d..d5301296b 100644
--- a/Software/Android_Studio/Tango.Transport/src/main/java/com/twine/tango/transport/TransportAdapterBase.java
+++ b/Software/Android_Studio/Tango.Transport/src/main/java/com/twine/tango/transport/TransportAdapterBase.java
@@ -2,24 +2,27 @@ package com.twine.tango.transport;
import com.elvishew.xlog.XLog;
import com.twine.tango.core.Event;
-import com.twine.tango.core.EventHandler;
+import com.twine.tango.core.IEventHandler;
import com.twine.tango.core.ObjectDisposedException;
import java.io.IOException;
import io.reactivex.Completable;
+
/**
- * Created by Roy on 11/12/2017.
+ * Represents an {@link ITransportAdapter} base class.
*/
-
public abstract class TransportAdapterBase implements ITransportAdapter {
private String address;
private Event<TransportComponentState> stateChangedEvent;
- private EventHandler<byte[]> dataAvailableListener;
+ private IEventHandler<byte[]> dataAvailableListener;
private TransportComponentState state;
+ /**
+ * Instantiates a new Transport adapter base.
+ */
public TransportAdapterBase()
{
stateChangedEvent = new Event<>();
@@ -32,7 +35,7 @@ public abstract class TransportAdapterBase implements ITransportAdapter {
public abstract Completable disconnect();
@Override
- public void setDataAvailableListener(EventHandler<byte[]> handler) {
+ public void setDataAvailableListener(IEventHandler<byte[]> handler) {
dataAvailableListener = handler;
}
@@ -47,12 +50,12 @@ public abstract class TransportAdapterBase implements ITransportAdapter {
}
@Override
- public void addStateChangedListener(EventHandler<TransportComponentState> listener) {
+ public void addStateChangedListener(IEventHandler<TransportComponentState> listener) {
stateChangedEvent.addListener(listener);
}
@Override
- public void removeStateChangedListener(EventHandler<TransportComponentState> listener)
+ public void removeStateChangedListener(IEventHandler<TransportComponentState> listener)
{
stateChangedEvent.removeListener(listener);
}
@@ -61,7 +64,12 @@ public abstract class TransportAdapterBase implements ITransportAdapter {
public TransportComponentState getState() {
return state;
}
-
+
+ /**
+ * Sets the component state.
+ *
+ * @param state the state
+ */
protected void setState(TransportComponentState state) {
this.state = state;
if (stateChangedEvent != null) {
@@ -78,13 +86,23 @@ public abstract class TransportAdapterBase implements ITransportAdapter {
disconnect().blockingAwait();
setState(TransportComponentState.Disposed);
}
-
+
+ /**
+ * Throws an exception if the component is in a disposed state.
+ *
+ * @throws ObjectDisposedException the object disposed exception
+ */
protected void throwIfDisposed() throws ObjectDisposedException {
if (state == TransportComponentState.Disposed) {
throw new ObjectDisposedException("The adapter is in a " + state + " state.");
}
}
-
+
+ /**
+ * Invokes the data available event.
+ *
+ * @param data the data
+ */
protected void onDataAvailable(byte[] data) {
if (dataAvailableListener != null) {
try {
@@ -94,7 +112,12 @@ public abstract class TransportAdapterBase implements ITransportAdapter {
}
}
}
-
+
+ /**
+ * Perform failure fallbacks.
+ *
+ * @param ex the ex
+ */
protected void onFailed(Exception ex) {
disconnect().blockingAwait();
setState(TransportComponentState.Failed);
diff --git a/Software/Android_Studio/Tango.Transport/src/main/java/com/twine/tango/transport/TransportMessage.java b/Software/Android_Studio/Tango.Transport/src/main/java/com/twine/tango/transport/TransportMessage.java
index 4ed894dba..1cfd77705 100644
--- a/Software/Android_Studio/Tango.Transport/src/main/java/com/twine/tango/transport/TransportMessage.java
+++ b/Software/Android_Studio/Tango.Transport/src/main/java/com/twine/tango/transport/TransportMessage.java
@@ -4,15 +4,27 @@ import com.twine.tango.core.Func;
import io.reactivex.subjects.PublishSubject;
+
/**
- * Created by Roy on 11/13/2017.
+ * Represents a {@link ITransporter} message.
+ *
+ * @param <T> the type parameter
*/
-
public class TransportMessage<T> extends TransportMessageBase
{
private PublishSubject<T> publishSubject;
+ /**
+ * Instantiates a new Transport message.
+ *
+ * @param adapter the adapter
+ * @param token the token
+ * @param message the message
+ * @param direction the direction
+ * @param serialize the serialize
+ * @param publishSubject the publish subject
+ */
public TransportMessage(ITransportAdapter adapter, String token, Object message, TransportMessageDirection direction, Func<byte[]> serialize, PublishSubject<T> publishSubject)
{
super(adapter, token, message, direction, serialize);
diff --git a/Software/Android_Studio/Tango.Transport/src/main/java/com/twine/tango/transport/TransportMessageBase.java b/Software/Android_Studio/Tango.Transport/src/main/java/com/twine/tango/transport/TransportMessageBase.java
index e236fc44f..718a1c66b 100644
--- a/Software/Android_Studio/Tango.Transport/src/main/java/com/twine/tango/transport/TransportMessageBase.java
+++ b/Software/Android_Studio/Tango.Transport/src/main/java/com/twine/tango/transport/TransportMessageBase.java
@@ -2,10 +2,10 @@ package com.twine.tango.transport;
import com.twine.tango.core.Func;
+
/**
- * Created by Roy on 11/13/2017.
+ * Represents an {@link ITransporter} message base class.
*/
-
public abstract class TransportMessageBase
{
@@ -16,70 +16,150 @@ public abstract class TransportMessageBase
private Func<byte[]> serialize;
private Object message;
+ /**
+ * Sets result.
+ *
+ * @param result the result
+ * @param completed the completed
+ */
protected abstract void setResult(Object result, boolean completed);
+ /**
+ * Sets exception.
+ *
+ * @param error the error
+ */
protected abstract void setException(Exception error);
+ /**
+ * Gets adapter.
+ *
+ * @return the adapter
+ */
public ITransportAdapter getAdapter()
{
return adapter;
}
+ /**
+ * Sets adapter.
+ *
+ * @param adapter the adapter
+ */
public void setAdapter(ITransportAdapter adapter)
{
this.adapter = adapter;
}
+ /**
+ * Is continuous boolean.
+ *
+ * @return the boolean
+ */
public boolean isContinuous()
{
return isContinuous;
}
+ /**
+ * Sets continuous.
+ *
+ * @param continuous the continuous
+ */
public void setContinuous(boolean continuous)
{
isContinuous = continuous;
}
+ /**
+ * Gets token.
+ *
+ * @return the token
+ */
public String getToken()
{
return token;
}
+ /**
+ * Sets token.
+ *
+ * @param token the token
+ */
public void setToken(String token)
{
this.token = token;
}
+ /**
+ * Gets direction.
+ *
+ * @return the direction
+ */
public TransportMessageDirection getDirection()
{
return direction;
}
+ /**
+ * Sets direction.
+ *
+ * @param direction the direction
+ */
public void setDirection(TransportMessageDirection direction)
{
this.direction = direction;
}
+ /**
+ * Gets serialize.
+ *
+ * @return the serialize
+ */
public Func<byte[]> getSerialize()
{
return serialize;
}
+ /**
+ * Sets serialize.
+ *
+ * @param serialize the serialize
+ */
public void setSerialize(Func<byte[]> serialize)
{
this.serialize = serialize;
}
+ /**
+ * Gets message.
+ *
+ * @return the message
+ */
public Object getMessage()
{
return message;
}
+ /**
+ * Sets message.
+ *
+ * @param message the message
+ */
public void setMessage(Object message)
{
this.message = message;
}
+ /**
+ * Instantiates a new Transport message base.
+ *
+ * @param adapter the adapter
+ * @param token the token
+ * @param message the message
+ * @param direction the direction
+ * @param serialize the serialize
+ */
public TransportMessageBase(ITransportAdapter adapter, String token, Object message, TransportMessageDirection direction, Func<byte[]> serialize)
{
this.adapter = adapter;
diff --git a/Software/Android_Studio/Tango.Transport/src/main/java/com/twine/tango/transport/TransportMessageDirection.java b/Software/Android_Studio/Tango.Transport/src/main/java/com/twine/tango/transport/TransportMessageDirection.java
index f055aa744..ac01e8b57 100644
--- a/Software/Android_Studio/Tango.Transport/src/main/java/com/twine/tango/transport/TransportMessageDirection.java
+++ b/Software/Android_Studio/Tango.Transport/src/main/java/com/twine/tango/transport/TransportMessageDirection.java
@@ -1,10 +1,16 @@
package com.twine.tango.transport;
+
/**
- * Created by Roy on 11/13/2017.
+ * The enum Transport message direction.
*/
-
public enum TransportMessageDirection {
+ /**
+ * Request transport message direction.
+ */
Request,
+ /**
+ * Response transport message direction.
+ */
Response
}
diff --git a/Software/Android_Studio/Tango.Transport/src/main/java/com/twine/tango/transport/TransporterBase.java b/Software/Android_Studio/Tango.Transport/src/main/java/com/twine/tango/transport/TransporterBase.java
index 5c0715806..ca7f6ed92 100644
--- a/Software/Android_Studio/Tango.Transport/src/main/java/com/twine/tango/transport/TransporterBase.java
+++ b/Software/Android_Studio/Tango.Transport/src/main/java/com/twine/tango/transport/TransporterBase.java
@@ -8,7 +8,7 @@ import com.elvishew.xlog.XLog;
import com.google.protobuf.GeneratedMessageV3;
import com.google.protobuf.InvalidProtocolBufferException;
import com.twine.tango.core.Event;
-import com.twine.tango.core.EventHandler;
+import com.twine.tango.core.IEventHandler;
import com.twine.tango.core.Func;
import com.twine.tango.core.ObjectDisposedException;
import com.twine.tango.core.ObservableCollection;
@@ -53,7 +53,7 @@ public abstract class TransporterBase implements ITransporter
//region Events
- private EventHandler<MessageContainer> requestReceivedListener;
+ private IEventHandler<MessageContainer> requestReceivedListener;
private Event<TransportComponentState> stateChangedEvent;
//endregion
@@ -66,6 +66,11 @@ public abstract class TransporterBase implements ITransporter
return adapters;
}
+ /**
+ * Sets adapters.
+ *
+ * @param adapters the adapters
+ */
protected void setAdapters(ObservableCollection<ITransportAdapter> adapters)
{
@@ -88,6 +93,11 @@ public abstract class TransporterBase implements ITransporter
return state;
}
+ /**
+ * Sets state.
+ *
+ * @param state the state
+ */
protected void setState(TransportComponentState state)
{
this.state = state;
@@ -110,6 +120,9 @@ public abstract class TransporterBase implements ITransporter
//region Protected Methods
+ /**
+ * On adapters changed.
+ */
protected void onAdaptersChanged()
{
@@ -149,11 +162,23 @@ public abstract class TransporterBase implements ITransporter
}
}
+ /**
+ * On state changed.
+ *
+ * @param state the state
+ */
protected void onStateChanged(TransportComponentState state)
{
if (stateChangedEvent != null) stateChangedEvent.invoke(this, state);
}
+ /**
+ * On serializing message func.
+ *
+ * @param <T> the type parameter
+ * @param message the message
+ * @return the func
+ */
protected <T extends GeneratedMessageV3> Func<byte[]> onSerializingMessage(TangoMessage<T> message)
{
return new Func<byte[]>()
@@ -166,6 +191,11 @@ public abstract class TransporterBase implements ITransporter
};
}
+ /**
+ * On failed.
+ *
+ * @param ex the ex
+ */
protected void onFailed(Exception ex)
{
disconnect().blockingAwait();
@@ -173,16 +203,38 @@ public abstract class TransporterBase implements ITransporter
XLog.e("Transporter failed.", ex);
}
+ /**
+ * On request received.
+ *
+ * @param request the request
+ */
protected void onRequestReceived(MessageContainer request)
{
if (requestReceivedListener != null) requestReceivedListener.invoke(this, request);
}
+ /**
+ * On parse container message container.
+ *
+ * @param data the data
+ * @return the message container
+ * @throws InvalidProtocolBufferException the invalid protocol buffer exception
+ */
protected MessageContainer onParseContainer(byte[] data) throws InvalidProtocolBufferException
{
return MessageFactory.parseContainer(data);
}
+ /**
+ * On parse message generated message v 3.
+ *
+ * @param container the container
+ * @return the generated message v 3
+ * @throws InvalidProtocolBufferException the invalid protocol buffer exception
+ * @throws NoSuchMethodException the no such method exception
+ * @throws IllegalAccessException the illegal access exception
+ * @throws InvocationTargetException the invocation target exception
+ */
protected GeneratedMessageV3 onParseMessage(MessageContainer container) throws InvalidProtocolBufferException, NoSuchMethodException, IllegalAccessException, InvocationTargetException
{
return MessageFactory.parseMessageFromContainerAgnostic(container);
@@ -192,6 +244,9 @@ public abstract class TransporterBase implements ITransporter
//region Constructors
+ /**
+ * Instantiates a new Transporter base.
+ */
public TransporterBase()
{
stateChangedEvent = new Event<>();
@@ -203,6 +258,11 @@ public abstract class TransporterBase implements ITransporter
setRequestTimeout(Period.seconds(2));
}
+ /**
+ * Instantiates a new Transporter base.
+ *
+ * @param adapter the adapter
+ */
public TransporterBase(ITransportAdapter adapter)
{
this();
@@ -214,19 +274,19 @@ public abstract class TransporterBase implements ITransporter
//region Public Methods
@Override
- public void addStateChangedListener(EventHandler<TransportComponentState> listener)
+ public void addStateChangedListener(IEventHandler<TransportComponentState> listener)
{
stateChangedEvent.addListener(listener);
}
@Override
- public void removeStateChangedListener(EventHandler<TransportComponentState> listener)
+ public void removeStateChangedListener(IEventHandler<TransportComponentState> listener)
{
stateChangedEvent.removeListener(listener);
}
@Override
- public void setRequestReceivedListener(EventHandler<MessageContainer> listener)
+ public void setRequestReceivedListener(IEventHandler<MessageContainer> listener)
{
this.requestReceivedListener = listener;
}
@@ -408,6 +468,11 @@ public abstract class TransporterBase implements ITransporter
pushThread.start();
}
+ /**
+ * Throw if disposed.
+ *
+ * @throws ObjectDisposedException the object disposed exception
+ */
protected void throwIfDisposed() throws ObjectDisposedException {
if (state == TransportComponentState.Disposed) {
throw new ObjectDisposedException("The transporter is in a " + state + " state.");
@@ -418,6 +483,9 @@ public abstract class TransporterBase implements ITransporter
//region Push Thread
+ /**
+ * Push thread method.
+ */
public void pushThreadMethod()
{
try
@@ -480,6 +548,9 @@ public abstract class TransporterBase implements ITransporter
//region Pull Thread
+ /**
+ * Pull thread method.
+ */
public void pullThreadMethod()
{
try
diff --git a/Software/Android_Studio/Tango.Transport/src/main/java/com/twine/tango/transport/transporters/ProtoTransporter.java b/Software/Android_Studio/Tango.Transport/src/main/java/com/twine/tango/transport/transporters/ProtoTransporter.java
index 1e40d5a72..eeb9bfa08 100644
--- a/Software/Android_Studio/Tango.Transport/src/main/java/com/twine/tango/transport/transporters/ProtoTransporter.java
+++ b/Software/Android_Studio/Tango.Transport/src/main/java/com/twine/tango/transport/transporters/ProtoTransporter.java
@@ -3,15 +3,23 @@ package com.twine.tango.transport.transporters;
import com.twine.tango.transport.ITransportAdapter;
import com.twine.tango.transport.TransporterBase;
+
/**
- * Created by Roy on 11/14/2017.
+ * Represents an {@link com.twine.tango.transport.ITransporter} which communicates using protobuf protocol.
*/
-
public class ProtoTransporter extends TransporterBase {
-
+
+ /**
+ * Instantiates a new Proto transporter.
+ */
public ProtoTransporter() {
}
-
+
+ /**
+ * Instantiates a new Proto transporter.
+ *
+ * @param adapter the adapter
+ */
public ProtoTransporter(ITransportAdapter adapter) {
super(adapter);
}
diff --git a/Software/Android_Studio/Tango.UnitTesting/src/androidTest/java/com/twine/tango/unittesting/Synchronization_TST.java b/Software/Android_Studio/Tango.UnitTesting/src/androidTest/java/com/twine/tango/unittesting/Synchronization_TST.java
index 7353fd0d4..92e745a10 100644
--- a/Software/Android_Studio/Tango.UnitTesting/src/androidTest/java/com/twine/tango/unittesting/Synchronization_TST.java
+++ b/Software/Android_Studio/Tango.UnitTesting/src/androidTest/java/com/twine/tango/unittesting/Synchronization_TST.java
@@ -5,58 +5,41 @@ import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import com.elvishew.xlog.XLog;
-import com.raizlabs.android.dbflow.config.FlowManager;
-import com.raizlabs.android.dbflow.sql.language.SQLite;
-import com.twine.tango.dal.TangoDB;
import com.twine.tango.dal.dao.OrganizationsDAO;
import com.twine.tango.dal.entities.Organization;
import com.twine.tango.integration.MachineIdentityProvider;
-import com.twine.tango.sharedui.AppInitializer;
import com.twine.tango.synchronization.ITangoSynchronizer;
import com.twine.tango.synchronization.TangoSynchronizer;
-import com.twine.tango.web.APIFactory;
+import com.twine.tango.web.WebApiFactory;
import org.junit.Test;
import org.junit.runner.RunWith;
-import static org.junit.Assert.*;
/**
- * Instrumented test, which will execute on an Android device.
- *
- * @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
+ * Contains unit testing for Tango machine local to remote synchronization.
*/
@RunWith(AndroidJUnit4.class)
public class Synchronization_TST
{
- @Test
- public void useAppContext() throws Exception
- {
- // Context of the app under test.
- Context appContext = InstrumentationRegistry.getTargetContext();
-
- assertEquals("com.twine.tango.unittesting", appContext.getPackageName());
- }
+ /**
+ * Synchronize local to remote db.
+ */
@Test
- public void performSynchronization()
+ public void synchronize_local_to_remote_db()
{
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
-
- AppInitializer.init(appContext);
-
-
for (Organization org : OrganizationsDAO.getAllOrganizations())
{
XLog.i(org.getName());
}
+ ITangoSynchronizer synchronizer = new TangoSynchronizer(new MachineIdentityProvider());
- ITangoSynchronizer synchronizer = new TangoSynchronizer(new APIFactory("http://10.0.2.2:45455/api/"), new MachineIdentityProvider());
-
- synchronizer.synchronize().subscribe(() ->
+ synchronizer.synchronizeDB().subscribe(() ->
{
for (Organization org : OrganizationsDAO.getAllOrganizations())
{
diff --git a/Software/Android_Studio/Tango.UnitTesting/src/main/java/com/twine/tango/unittesting/App.java b/Software/Android_Studio/Tango.UnitTesting/src/main/java/com/twine/tango/unittesting/App.java
index 51ba62de8..6d81b7c32 100644
--- a/Software/Android_Studio/Tango.UnitTesting/src/main/java/com/twine/tango/unittesting/App.java
+++ b/Software/Android_Studio/Tango.UnitTesting/src/main/java/com/twine/tango/unittesting/App.java
@@ -3,6 +3,7 @@ package com.twine.tango.unittesting;
import android.app.Application;
import com.twine.tango.dal.TangoDB;
+import com.twine.tango.sharedui.TangoApplication;
import java.io.File;
@@ -10,11 +11,7 @@ import java.io.File;
* Created by Roy on 12/2/2017.
*/
-public class App extends Application
+public class App extends TangoApplication
{
- @Override
- public File getDatabasePath(String name)
- {
- return new File(TangoDB.getDataBasePath(name));
- }
+
}
diff --git a/Software/Android_Studio/Tango.UnitTesting/src/main/res/layout/activity_main.xml b/Software/Android_Studio/Tango.UnitTesting/src/main/res/layout/activity_main.xml
index 22c2d005c..9cdd121ea 100644
--- a/Software/Android_Studio/Tango.UnitTesting/src/main/res/layout/activity_main.xml
+++ b/Software/Android_Studio/Tango.UnitTesting/src/main/res/layout/activity_main.xml
@@ -9,7 +9,8 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:text="Hello World!"
+ android:gravity="center_vertical|center"
+ android:text="This is a unit testing project only! Please browse the tests folder."
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
diff --git a/Software/Android_Studio/Tango.Web/src/main/java/com/twine/tango/web/WebApiFactory.java b/Software/Android_Studio/Tango.Web/src/main/java/com/twine/tango/web/WebApiFactory.java
index d244a99c8..cc72dbece 100644
--- a/Software/Android_Studio/Tango.Web/src/main/java/com/twine/tango/web/WebApiFactory.java
+++ b/Software/Android_Studio/Tango.Web/src/main/java/com/twine/tango/web/WebApiFactory.java
@@ -8,24 +8,45 @@ import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory;
import retrofit2.converter.protobuf.ProtoConverterFactory;
-public class APIFactory
+/**
+ * Represents the system restful api factory.
+ */
+public class WebApiFactory
{
- private String base_url;
+ private static String baseUrl;
- public APIFactory(String base_url)
+
+ /**
+ * Initializes the remote base url.
+ *
+ * @param base_url the base url
+ */
+ public static void init(String base_url)
{
- this.base_url = base_url;
+ baseUrl = base_url;
}
- public ISynchronizationAPI getSynchronizationAPI()
+ /**
+ * Gets synchronization api.
+ *
+ * @return the synchronization api
+ */
+ public static ISynchronizationAPI getSynchronizationAPI()
{
return createAPI(ISynchronizationAPI.class, 60);
}
- private <T> T createAPI(Class<?> cls, int timeout)
+ /**
+ * Creates the specified API interface instance.
+ * @param cls
+ * @param timeout
+ * @param <T>
+ * @return
+ */
+ private static <T> T createAPI(Class<?> cls, int timeout)
{
Retrofit retrofit = new Retrofit.Builder()
- .baseUrl(base_url)
+ .baseUrl(baseUrl)
.addCallAdapterFactory(RxJava2CallAdapterFactory.create())
.addConverterFactory(ProtoConverterFactory.create())
.client(new OkHttpClient.Builder()
diff --git a/Software/Android_Studio/app/.gitignore b/Software/Android_Studio/app/.gitignore
deleted file mode 100644
index 796b96d1c..000000000
--- a/Software/Android_Studio/app/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/build
diff --git a/Software/Android_Studio/app/CMakeLists.txt b/Software/Android_Studio/app/CMakeLists.txt
deleted file mode 100644
index f8e6e8b3d..000000000
--- a/Software/Android_Studio/app/CMakeLists.txt
+++ /dev/null
@@ -1,44 +0,0 @@
-# For more information about using CMake with Android Studio, read the
-# documentation: https://d.android.com/studio/projects/add-native-code.html
-
-# Sets the minimum version of CMake required to build the native library.
-
-cmake_minimum_required(VERSION 3.4.1)
-
-# Creates and names a library, sets it as either STATIC
-# or SHARED, and provides the relative paths to its source code.
-# You can define multiple libraries, and CMake builds them for you.
-# Gradle automatically packages shared libraries with your APK.
-
-add_library( # Sets the name of the library.
- native-lib
-
- # Sets the library as a shared library.
- SHARED
-
- # Provides a relative path to your source file(s).
- src/main/cpp/native-lib.cpp )
-
-# Searches for a specified prebuilt library and stores the path as a
-# variable. Because CMake includes system libraries in the search path by
-# default, you only need to specify the name of the public NDK library
-# you want to add. CMake verifies that the library exists before
-# completing its build.
-
-find_library( # Sets the name of the path variable.
- log-lib
-
- # Specifies the name of the NDK library that
- # you want CMake to locate.
- log )
-
-# Specifies libraries CMake should link to your target library. You
-# can link multiple libraries, such as libraries you define in this
-# build script, prebuilt third-party libraries, or system libraries.
-
-target_link_libraries( # Specifies the target library.
- native-lib
-
- # Links the target library to the log library
- # included in the NDK.
- ${log-lib} ) \ No newline at end of file
diff --git a/Software/Android_Studio/app/build.gradle b/Software/Android_Studio/app/build.gradle
deleted file mode 100644
index ccd536141..000000000
--- a/Software/Android_Studio/app/build.gradle
+++ /dev/null
@@ -1,41 +0,0 @@
-apply plugin: 'com.android.application'
-
-android {
- compileSdkVersion 26
- buildToolsVersion "26.0.1"
- defaultConfig {
- applicationId "com.twine.tango"
- minSdkVersion 22
- targetSdkVersion 26
- versionCode 1
- versionName "1.0"
- testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
- externalNativeBuild {
- cmake {
- cppFlags "-std=c++11 -frtti -fexceptions"
- }
- }
- }
- buildTypes {
- release {
- minifyEnabled false
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
- }
- }
- externalNativeBuild {
- cmake {
- path "CMakeLists.txt"
- }
- }
-}
-
-dependencies {
- implementation fileTree(include: ['*.jar'], dir: 'libs')
- implementation 'com.android.support:appcompat-v7:26.1.0'
- implementation 'com.android.support.constraint:constraint-layout:1.0.2'
- testImplementation 'junit:junit:4.12'
- androidTestImplementation 'com.android.support.test:runner:1.0.1'
- androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
- compile 'com.google.protobuf:protobuf-java:3.4.0'
- implementation project(':Tango.PMR')
-}
diff --git a/Software/Android_Studio/app/proguard-rules.pro b/Software/Android_Studio/app/proguard-rules.pro
deleted file mode 100644
index a0eef131a..000000000
--- a/Software/Android_Studio/app/proguard-rules.pro
+++ /dev/null
@@ -1,25 +0,0 @@
-# Add project specific ProGuard rules here.
-# By default, the flags in this file are appended to flags specified
-# in C:\Users\Roy\AppData\Local\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 *;
-#}
-
-# Uncomment this to preserve the line number information for
-# debugging stack traces.
-#-keepattributes SourceFile,LineNumberTable
-
-# If you keep the line number information, uncomment this to
-# hide the original source file name.
-#-renamesourcefileattribute SourceFile
diff --git a/Software/Android_Studio/app/src/androidTest/java/com/twine/tango/ExampleInstrumentedTest.java b/Software/Android_Studio/app/src/androidTest/java/com/twine/tango/ExampleInstrumentedTest.java
deleted file mode 100644
index bed558a6e..000000000
--- a/Software/Android_Studio/app/src/androidTest/java/com/twine/tango/ExampleInstrumentedTest.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package com.twine.tango;
-
-import android.content.Context;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import static org.junit.Assert.*;
-
-/**
- * Instrumented test, which will execute on an Android device.
- *
- * @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
- */
-@RunWith(AndroidJUnit4.class)
-public class ExampleInstrumentedTest {
- @Test
- public void useAppContext() throws Exception {
- // Context of the app under test.
- Context appContext = InstrumentationRegistry.getTargetContext();
-
- MainActivity a = new MainActivity();
- a.Do();
-
- assertEquals("com.twine.tango", appContext.getPackageName());
- }
-}
diff --git a/Software/Android_Studio/app/src/main/AndroidManifest.xml b/Software/Android_Studio/app/src/main/AndroidManifest.xml
deleted file mode 100644
index 9fb70555b..000000000
--- a/Software/Android_Studio/app/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.twine.tango">
-
- <application
- android:allowBackup="true"
- android:icon="@mipmap/ic_launcher"
- android:label="@string/app_name"
- android:roundIcon="@mipmap/ic_launcher_round"
- android:supportsRtl="true"
- android:theme="@style/AppTheme">
- <activity android:name=".MainActivity">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
-
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
- </activity>
- </application>
-
-</manifest> \ No newline at end of file
diff --git a/Software/Android_Studio/app/src/main/cpp/Android.mk b/Software/Android_Studio/app/src/main/cpp/Android.mk
deleted file mode 100644
index e69de29bb..000000000
--- a/Software/Android_Studio/app/src/main/cpp/Android.mk
+++ /dev/null
diff --git a/Software/Android_Studio/app/src/main/cpp/native-lib.cpp b/Software/Android_Studio/app/src/main/cpp/native-lib.cpp
deleted file mode 100644
index fa595fbae..000000000
--- a/Software/Android_Studio/app/src/main/cpp/native-lib.cpp
+++ /dev/null
@@ -1,13 +0,0 @@
-#include <jni.h>
-#include <string>
-
-extern "C"
-JNIEXPORT jstring
-
-JNICALL
-Java_com_twine_tango_MainActivity_stringFromJNI(
- JNIEnv *env,
- jobject /* this */) {
- std::string hello = "Hello from C++";
- return env->NewStringUTF(hello.c_str());
-}
diff --git a/Software/Android_Studio/app/src/main/java/com/twine/tango/MainActivity.java b/Software/Android_Studio/app/src/main/java/com/twine/tango/MainActivity.java
deleted file mode 100644
index e739c599d..000000000
--- a/Software/Android_Studio/app/src/main/java/com/twine/tango/MainActivity.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package com.twine.tango;
-
-import android.support.v7.app.AppCompatActivity;
-import android.os.Bundle;
-import android.widget.TextView;
-
-public class MainActivity extends AppCompatActivity {
-
- // Used to load the 'native-lib' library on application startup.
- static {
- System.loadLibrary("native-lib");
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
-
- // Example of a call to a native method
- TextView tv = (TextView) findViewById(R.id.sample_text);
- tv.setText(stringFromJNI());
- }
-
- public void Do()
- {
- stringFromJNI();
- }
-
- /**
- * A native method that is implemented by the 'native-lib' native library,
- * which is packaged with this application.
- */
- public native String stringFromJNI();
-}
diff --git a/Software/Android_Studio/app/src/main/res/drawable/ic_launcher_background.xml b/Software/Android_Studio/app/src/main/res/drawable/ic_launcher_background.xml
deleted file mode 100644
index 1cd2a3665..000000000
--- a/Software/Android_Studio/app/src/main/res/drawable/ic_launcher_background.xml
+++ /dev/null
@@ -1,113 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
- android:width="24dp"
- android:height="24dp"
- android:viewportHeight="108.0"
- android:viewportWidth="108.0">
- <path
- android:fillColor="#26A69A"
- android:pathData="M0,0h108v108h-108z"
- android:strokeColor="#66FFFFFF"
- android:strokeWidth="0.8" />
- <path
- android:fillColor="#00000000"
- android:pathData="M19,0L19,108"
- android:strokeColor="#33FFFFFF"
- android:strokeWidth="0.8" />
- <path
- android:fillColor="#00000000"
- android:pathData="M9,0L9,108"
- android:strokeColor="#66FFFFFF"
- android:strokeWidth="0.8" />
- <path
- android:fillColor="#00000000"
- android:pathData="M39,0L39,108"
- android:strokeColor="#66FFFFFF"
- android:strokeWidth="0.8" />
- <path
- android:fillColor="#00000000"
- android:pathData="M29,0L29,108"
- android:strokeColor="#66FFFFFF"
- android:strokeWidth="0.8" />
- <path
- android:fillColor="#00000000"
- android:pathData="M59,0L59,108"
- android:strokeColor="#66FFFFFF"
- android:strokeWidth="0.8" />
- <path
- android:fillColor="#00000000"
- android:pathData="M49,0L49,108"
- android:strokeColor="#66FFFFFF"
- android:strokeWidth="0.8" />
- <path
- android:fillColor="#00000000"
- android:pathData="M79,0L79,108"
- android:strokeColor="#66FFFFFF"
- android:strokeWidth="0.8" />
- <path
- android:fillColor="#00000000"
- android:pathData="M69,0L69,108"
- android:strokeColor="#66FFFFFF"
- android:strokeWidth="0.8" />
- <path
- android:fillColor="#00000000"
- android:pathData="M89,0L89,108"
- android:strokeColor="#33FFFFFF"
- android:strokeWidth="0.8" />
- <path
- android:fillColor="#00000000"
- android:pathData="M99,0L99,108"
- android:strokeColor="#66FFFFFF"
- android:strokeWidth="0.8" />
- <path
- android:fillColor="#00000000"
- android:pathData="M0,89L108,89"
- android:strokeColor="#33FFFFFF"
- android:strokeWidth="0.8" />
- <path
- android:fillColor="#00000000"
- android:pathData="M0,99L108,99"
- android:strokeColor="#66FFFFFF"
- android:strokeWidth="0.8" />
- <path
- android:fillColor="#00000000"
- android:pathData="M0,69L108,69"
- android:strokeColor="#66FFFFFF"
- android:strokeWidth="0.8" />
- <path
- android:fillColor="#00000000"
- android:pathData="M0,79L108,79"
- android:strokeColor="#66FFFFFF"
- android:strokeWidth="0.8" />
- <path
- android:fillColor="#00000000"
- android:pathData="M0,49L108,49"
- android:strokeColor="#66FFFFFF"
- android:strokeWidth="0.8" />
- <path
- android:fillColor="#00000000"
- android:pathData="M0,59L108,59"
- android:strokeColor="#66FFFFFF"
- android:strokeWidth="0.8" />
- <path
- android:fillColor="#00000000"
- android:pathData="M0,29L108,29"
- android:strokeColor="#66FFFFFF"
- android:strokeWidth="0.8" />
- <path
- android:fillColor="#00000000"
- android:pathData="M0,39L108,39"
- android:strokeColor="#66FFFFFF"
- android:strokeWidth="0.8" />
- <path
- android:fillColor="#00000000"
- android:pathData="M0,19L108,19"
- android:strokeColor="#33FFFFFF"
- android:strokeWidth="0.8" />
- <path
- android:fillColor="#00000000"
- android:pathData="M0,9L108,9"
- android:strokeColor="#66FFFFFF"
- android:strokeWidth="0.8" />
-</vector>
-
diff --git a/Software/Android_Studio/app/src/main/res/layout/activity_main.xml b/Software/Android_Studio/app/src/main/res/layout/activity_main.xml
deleted file mode 100644
index ef968203f..000000000
--- a/Software/Android_Studio/app/src/main/res/layout/activity_main.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:app="http://schemas.android.com/apk/res-auto"
- xmlns:tools="http://schemas.android.com/tools"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- tools:context="com.twine.tango.MainActivity">
-
- <TextView
- android:id="@+id/sample_text"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="Hello World!"
- app:layout_constraintBottom_toBottomOf="parent"
- app:layout_constraintLeft_toLeftOf="parent"
- app:layout_constraintRight_toRightOf="parent"
- app:layout_constraintTop_toTopOf="parent" />
-
-</android.support.constraint.ConstraintLayout>
diff --git a/Software/Android_Studio/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/Software/Android_Studio/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
deleted file mode 100644
index 00f9eaaf3..000000000
--- a/Software/Android_Studio/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
- <background android:drawable="@drawable/ic_launcher_background" />
- <foreground android:drawable="@mipmap/ic_launcher_foreground" />
-</adaptive-icon> \ No newline at end of file
diff --git a/Software/Android_Studio/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/Software/Android_Studio/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
deleted file mode 100644
index 00f9eaaf3..000000000
--- a/Software/Android_Studio/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
- <background android:drawable="@drawable/ic_launcher_background" />
- <foreground android:drawable="@mipmap/ic_launcher_foreground" />
-</adaptive-icon> \ No newline at end of file
diff --git a/Software/Android_Studio/app/src/main/res/mipmap-hdpi/ic_launcher.png b/Software/Android_Studio/app/src/main/res/mipmap-hdpi/ic_launcher.png
deleted file mode 100644
index 550730310..000000000
--- a/Software/Android_Studio/app/src/main/res/mipmap-hdpi/ic_launcher.png
+++ /dev/null
Binary files differ
diff --git a/Software/Android_Studio/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png b/Software/Android_Studio/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png
deleted file mode 100644
index 4e526c95b..000000000
--- a/Software/Android_Studio/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png
+++ /dev/null
Binary files differ
diff --git a/Software/Android_Studio/app/src/main/res/mipmap-hdpi/ic_launcher_round.png b/Software/Android_Studio/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
deleted file mode 100644
index 8fab6a3a5..000000000
--- a/Software/Android_Studio/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
+++ /dev/null
Binary files differ
diff --git a/Software/Android_Studio/app/src/main/res/mipmap-mdpi/ic_launcher.png b/Software/Android_Studio/app/src/main/res/mipmap-mdpi/ic_launcher.png
deleted file mode 100644
index 6bc7fcd6f..000000000
--- a/Software/Android_Studio/app/src/main/res/mipmap-mdpi/ic_launcher.png
+++ /dev/null
Binary files differ
diff --git a/Software/Android_Studio/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png b/Software/Android_Studio/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png
deleted file mode 100644
index 2c38c7190..000000000
--- a/Software/Android_Studio/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png
+++ /dev/null
Binary files differ
diff --git a/Software/Android_Studio/app/src/main/res/mipmap-mdpi/ic_launcher_round.png b/Software/Android_Studio/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
deleted file mode 100644
index 1eecc0e7d..000000000
--- a/Software/Android_Studio/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
+++ /dev/null
Binary files differ
diff --git a/Software/Android_Studio/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/Software/Android_Studio/app/src/main/res/mipmap-xhdpi/ic_launcher.png
deleted file mode 100644
index ec87dcebe..000000000
--- a/Software/Android_Studio/app/src/main/res/mipmap-xhdpi/ic_launcher.png
+++ /dev/null
Binary files differ
diff --git a/Software/Android_Studio/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png b/Software/Android_Studio/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png
deleted file mode 100644
index 072467eaa..000000000
--- a/Software/Android_Studio/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png
+++ /dev/null
Binary files differ
diff --git a/Software/Android_Studio/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/Software/Android_Studio/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
deleted file mode 100644
index 05ca079ca..000000000
--- a/Software/Android_Studio/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
+++ /dev/null
Binary files differ
diff --git a/Software/Android_Studio/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/Software/Android_Studio/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
deleted file mode 100644
index 6f67f21ba..000000000
--- a/Software/Android_Studio/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
+++ /dev/null
Binary files differ
diff --git a/Software/Android_Studio/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png b/Software/Android_Studio/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png
deleted file mode 100644
index 78a6b7a34..000000000
--- a/Software/Android_Studio/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png
+++ /dev/null
Binary files differ
diff --git a/Software/Android_Studio/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/Software/Android_Studio/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
deleted file mode 100644
index 8bac0f274..000000000
--- a/Software/Android_Studio/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
+++ /dev/null
Binary files differ
diff --git a/Software/Android_Studio/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/Software/Android_Studio/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
deleted file mode 100644
index 0327e13fa..000000000
--- a/Software/Android_Studio/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
+++ /dev/null
Binary files differ
diff --git a/Software/Android_Studio/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png b/Software/Android_Studio/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png
deleted file mode 100644
index 68ebe33fe..000000000
--- a/Software/Android_Studio/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png
+++ /dev/null
Binary files differ
diff --git a/Software/Android_Studio/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/Software/Android_Studio/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
deleted file mode 100644
index bacd3e758..000000000
--- a/Software/Android_Studio/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
+++ /dev/null
Binary files differ
diff --git a/Software/Android_Studio/app/src/main/res/values/colors.xml b/Software/Android_Studio/app/src/main/res/values/colors.xml
deleted file mode 100644
index 3ab3e9cbc..000000000
--- a/Software/Android_Studio/app/src/main/res/values/colors.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<resources>
- <color name="colorPrimary">#3F51B5</color>
- <color name="colorPrimaryDark">#303F9F</color>
- <color name="colorAccent">#FF4081</color>
-</resources>
diff --git a/Software/Android_Studio/app/src/main/res/values/strings.xml b/Software/Android_Studio/app/src/main/res/values/strings.xml
deleted file mode 100644
index 9bff8a19c..000000000
--- a/Software/Android_Studio/app/src/main/res/values/strings.xml
+++ /dev/null
@@ -1,3 +0,0 @@
-<resources>
- <string name="app_name">Tango</string>
-</resources>
diff --git a/Software/Android_Studio/app/src/main/res/values/styles.xml b/Software/Android_Studio/app/src/main/res/values/styles.xml
deleted file mode 100644
index 5885930df..000000000
--- a/Software/Android_Studio/app/src/main/res/values/styles.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-<resources>
-
- <!-- Base application theme. -->
- <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
- <!-- Customize your theme here. -->
- <item name="colorPrimary">@color/colorPrimary</item>
- <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
- <item name="colorAccent">@color/colorAccent</item>
- </style>
-
-</resources>
diff --git a/Software/Android_Studio/app/src/test/java/com/twine/tango/ExampleUnitTest.java b/Software/Android_Studio/app/src/test/java/com/twine/tango/ExampleUnitTest.java
deleted file mode 100644
index 4ef42c6db..000000000
--- a/Software/Android_Studio/app/src/test/java/com/twine/tango/ExampleUnitTest.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package com.twine.tango;
-
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-/**
- * Example local unit test, which will execute on the development machine (host).
- *
- * @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
- */
-public class ExampleUnitTest {
- @Test
- public void addition_isCorrect() throws Exception {
-
- MainActivity a = new MainActivity();
- a.Do();
- assertEquals(4, 2 + 2);
- }
-} \ No newline at end of file
diff --git a/Software/Android_Studio/app/src/test/java/com/twine/tango/PMR_TST.java b/Software/Android_Studio/app/src/test/java/com/twine/tango/PMR_TST.java
deleted file mode 100644
index 1bb15f4d7..000000000
--- a/Software/Android_Studio/app/src/test/java/com/twine/tango/PMR_TST.java
+++ /dev/null
@@ -1,73 +0,0 @@
-package com.twine.tango;
-
-import org.junit.Test;
-
-import com.google.protobuf.InvalidProtocolBufferException;
-import com.twine.tango.pmr.MessageFactory;
-import com.twine.tango.pmr.TangoMessage;
-import com.twine.tango.pmr.common.MessageContainerOuterClass.MessageContainer;
-import com.twine.tango.pmr.common.MessageTypeOuterClass.MessageType;
-import com.twine.tango.pmr.common.RGBOuterClass.RGB;
-import com.twine.tango.pmr.jobs.JobOuterClass.Job;
-import com.twine.tango.pmr.jobs.SegmentOuterClass.Segment;
-
-import java.lang.reflect.InvocationTargetException;
-
-import static org.junit.Assert.assertEquals;
-
-/**
- * Created by Roy on 11/2/2017.
- */
-
-public class PMR_TST {
- @Test
- public void read_write_PMR() throws Exception {
-
- MessageContainer.Builder container = MessageContainer.newBuilder();
-
- Job.Builder job = Job.newBuilder();
- job.setName("Test Job");
-
- job.addSegments(
- Segment.newBuilder().
- setName("Segment 1").
- setColor(RGB.newBuilder()
- .setR(10)
- .setG(20)
- .setB(30))
- .build());
-
- job.addSegments(
- Segment.newBuilder().
- setName("Segment 2").
- setColor(RGB.newBuilder()
- .setR(100)
- .setG(200)
- .setB(300))
- .build());
-
- container.setType(MessageType.Job);
- Job buildJob = job.build();
- container.setData(buildJob.toByteString());
-
- byte[] bytes = container.build().toByteArray();
-
- MessageContainer parsed = MessageContainer.parseFrom(bytes);
- Job parsedJob = Job.parseFrom(parsed.getData());
-
- assertEquals(buildJob, parsedJob);
- }
-
- @Test
- public void read_write_PMR_Generic() throws InstantiationException, IllegalAccessException, InvalidProtocolBufferException, NoSuchMethodException, InvocationTargetException {
-
- TangoMessage<Job> message = MessageFactory.createTangoMessage(Job.class);
- message.setMessage(Job.newBuilder().setName("Roy").build());
-
- byte[] bytes = message.toBytes();
-
- TangoMessage<Job> parsed = MessageFactory.parseTangoMessage(bytes);
-
- assertEquals(message.getMessage(), parsed.getMessage());
- }
-}
diff --git a/Software/Android_Studio/settings.gradle b/Software/Android_Studio/settings.gradle
index 9c10194eb..cb2899bce 100644
--- a/Software/Android_Studio/settings.gradle
+++ b/Software/Android_Studio/settings.gradle
@@ -1 +1 @@
-include ':app', ':Tango.BL', ':Tango.Stubs.UI', ':Tango.SharedUI', ':Tango.Models', ':Tango.Stubs', ':Tango.Integration', ':Tango.Transport', ':Tango.Core', ':Tango.PMR', ':Tango.DAL', ':Tango.Web', ':Tango.Synchronization', ':Tango.UnitTesting'
+include ':Tango.BL', ':Tango.Stubs.UI', ':Tango.SharedUI', ':Tango.Models', ':Tango.Stubs', ':Tango.Integration', ':Tango.Transport', ':Tango.Core', ':Tango.PMR', ':Tango.DAL', ':Tango.Web', ':Tango.Synchronization', ':Tango.UnitTesting'