diff options
Diffstat (limited to 'Software/Android_Studio')
114 files changed, 1665 insertions, 230 deletions
diff --git a/Software/Android_Studio/ColorCapture/app/build.gradle b/Software/Android_Studio/ColorCapture/app/build.gradle index 7b8adc999..ae4fcfeb1 100644 --- a/Software/Android_Studio/ColorCapture/app/build.gradle +++ b/Software/Android_Studio/ColorCapture/app/build.gradle @@ -17,13 +17,13 @@ android { ndk { // Tells Gradle to build outputs for the following ABIs and package // them into your APK. - abiFilters 'armeabi-v7a' //Supported on most devices. + // abiFilters 'armeabi-v7a' //Supported on most devices. } } buildTypes { debug { - buildConfigField "String", "WEB_SERVICE_ADDRESS", "\"http://192.168.1.86:45455/api/\"" + buildConfigField "String", "WEB_SERVICE_ADDRESS", "\"http://10.100.102.46:45455/api/\"" buildConfigField "String", "WEB_SERVICE_APP_ID", "\"Tdf793i4ughsiduf8749509237885ehgfdlkghlT\"" } @@ -51,6 +51,63 @@ android { path "CMakeLists.txt" } } + + splits { + + // Configures multiple APKs based on ABI. + abi { + + // Enables building multiple APKs per ABI. + enable true + + // By default all ABIs are included, so use reset() and include to specify that we only + // want APKs for x86 and x86_64. + + // Resets the list of ABIs that Gradle should create APKs for to none. + reset() + + // Specifies a list of ABIs that Gradle should create APKs for. + include "armeabi-v7a", "arm64-v8a", "x86" + + // Specifies that we do not want to also generate a universal APK that includes all ABIs. + universalApk false + } + } +} + +// Map for the version code that gives each ABI a value. +ext.abiCodes = ['armeabi-v7a':1, 'arm64-v8a':2, 'x86':3] + +import com.android.build.OutputFile + +// For each APK output variant, override versionCode with a combination of +// ext.abiCodes * 1000 + variant.versionCode. In this example, variant.versionCode +// is equal to defaultConfig.versionCode. If you configure product flavors that +// define their own versionCode, variant.versionCode uses that value instead. +android.applicationVariants.all { variant -> + + // Assigns a different version code for each output APK + // other than the universal APK. + variant.outputs.each { output -> + + // Stores the value of ext.abiCodes that is associated with the ABI for this variant. + def baseAbiVersionCode = + // Determines the ABI for this variant and returns the mapped value. + project.ext.abiCodes.get(output.getFilter(OutputFile.ABI)) + + // Because abiCodes.get() returns null for ABIs that are not mapped by ext.abiCodes, + // the following code does not override the version code for universal APKs. + // However, because we want universal APKs to have the lowest version code, + // this outcome is desirable. + if (baseAbiVersionCode != null) { + + // Assigns the new version code to versionCodeOverride, which changes the version code + // for only the output APK, not for the variant itself. Skipping this step simply + // causes Gradle to use the value of variant.versionCode for the APK. + output.versionCodeOverride = + baseAbiVersionCode * 1000 + variant.versionCode + } + } } dependencies { diff --git a/Software/Android_Studio/ColorCapture/app/src/main/AndroidManifest.xml b/Software/Android_Studio/ColorCapture/app/src/main/AndroidManifest.xml index a03d65975..441817928 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/AndroidManifest.xml +++ b/Software/Android_Studio/ColorCapture/app/src/main/AndroidManifest.xml @@ -26,14 +26,27 @@ android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="false" android:theme="@style/AppTheme"> - <activity android:name=".views.loading.LoadingActivity" android:noHistory="true"> + <activity + android:name=".views.loading.LoadingActivity" + android:noHistory="true"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> + <intent-filter> + <action android:name="android.intent.action.VIEW" /> + + <category android:name="android.intent.category.DEFAULT" /> + <category android:name="android.intent.category.BROWSABLE" /> + + <data + android:scheme="http" + android:host="twine-s.com" /> + </intent-filter> </activity> - <activity android:name=".views.main.MainActivity"></activity> + <activity android:name=".views.main.MainActivity"/> + <activity android:name=".views.sendtoemail.SendToEmailActivity" /> </application> </manifest>
\ No newline at end of file diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/controls/CircleActionButton.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/controls/CircleActionButton.java index 242702fe9..afa02c511 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/controls/CircleActionButton.java +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/controls/CircleActionButton.java @@ -4,14 +4,18 @@ import android.animation.Animator; import android.animation.ValueAnimator; import android.content.Context; import android.content.res.TypedArray; +import android.databinding.BindingAdapter; +import android.databinding.InverseBindingAdapter; import android.graphics.drawable.Drawable; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.v7.widget.AppCompatTextView; import android.util.AttributeSet; +import android.util.TypedValue; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; +import android.view.animation.AlphaAnimation; import android.widget.Button; import android.widget.FrameLayout; import android.widget.ImageView; @@ -27,15 +31,18 @@ public class CircleActionButton extends FrameLayout implements View.OnTouchListe private int initial_circle_width; private ValueAnimator animationDown; private ValueAnimator animationUp; + private AlphaAnimation alphaAnimationDown; + private AlphaAnimation alphaAnimationUp; private Drawable icon; + private AppCompatTextView textView; public CircleActionButton(@NonNull Context context, @Nullable AttributeSet attrs) { super(context, attrs); - init(context,attrs); + init(context, attrs); } - private void init(Context context,AttributeSet attrs) + private void init(Context context, AttributeSet attrs) { inflate(context, R.layout.circle_action_button, this); @@ -43,12 +50,19 @@ public class CircleActionButton extends FrameLayout implements View.OnTouchListe circleActionButton = findViewById(R.id.actionButtonCircle); frameAfterPadding = findViewById(R.id.frameAfterPadding); ImageView imageView = findViewById(R.id.circleActionButtonImageView); - AppCompatTextView textView = findViewById(R.id.circleActionButtonTextView); + textView = findViewById(R.id.circleActionButtonTextView); btn.setOnTouchListener(this); TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.CircleActionButton); + int textSize = a.getDimensionPixelSize(R.styleable.CircleActionButton_textSize, 0); + + if (textSize > 0) + { + textView.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize); + } + icon = getContext().getDrawable(a.getResourceId(R.styleable.CircleActionButton_src, 0)); CharSequence text = a.getText(R.styleable.CircleActionButton_text); @@ -67,7 +81,7 @@ public class CircleActionButton extends FrameLayout implements View.OnTouchListe } else if (motionEvent.getAction() == MotionEvent.ACTION_UP) { - animateUp(); + //animateUp(); performClick(); } @@ -83,11 +97,21 @@ public class CircleActionButton extends FrameLayout implements View.OnTouchListe initial_circle_width = circleActionButton.getMeasuredWidth(); } + + alphaAnimationDown = new AlphaAnimation(1f, 0.5f); + alphaAnimationDown.setDuration(50); + alphaAnimationDown.setFillAfter(true); + circleActionButton.startAnimation(alphaAnimationDown); + + final CircleActionButton that = this; + ValueAnimator anim = ValueAnimator.ofInt(initial_circle_width, frameAfterPadding.getMeasuredWidth()); animationDown = anim; - anim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { + anim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() + { @Override - public void onAnimationUpdate(ValueAnimator valueAnimator) { + public void onAnimationUpdate(ValueAnimator valueAnimator) + { int val = (Integer) valueAnimator.getAnimatedValue(); ViewGroup.LayoutParams layoutParams = circleActionButton.getLayoutParams(); layoutParams.width = val; @@ -105,7 +129,7 @@ public class CircleActionButton extends FrameLayout implements View.OnTouchListe @Override public void onAnimationEnd(Animator animator) { - + that.animateUp(); } @Override @@ -124,22 +148,31 @@ public class CircleActionButton extends FrameLayout implements View.OnTouchListe anim.start(); } - private void animateUp() + public void animateUp() { cancelAnimations(); + + alphaAnimationUp = new AlphaAnimation(0.5f, 1f); + alphaAnimationUp.setDuration(500); + alphaAnimationUp.setFillAfter(true); + alphaAnimationUp.setStartTime(1000); + circleActionButton.startAnimation(alphaAnimationUp); + ValueAnimator anim = ValueAnimator.ofInt(circleActionButton.getMeasuredWidth(), initial_circle_width); animationUp = anim; - anim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { + anim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() + { @Override - public void onAnimationUpdate(ValueAnimator valueAnimator) { + public void onAnimationUpdate(ValueAnimator valueAnimator) + { int val = (Integer) valueAnimator.getAnimatedValue(); ViewGroup.LayoutParams layoutParams = circleActionButton.getLayoutParams(); layoutParams.width = val; circleActionButton.setLayoutParams(layoutParams); } }); - anim.setDuration(300); - anim.setStartDelay(200); + anim.setDuration(500); + anim.setStartDelay(1000); anim.start(); } @@ -156,5 +189,39 @@ public class CircleActionButton extends FrameLayout implements View.OnTouchListe animationUp.cancel(); animationUp = null; } + + if (alphaAnimationDown != null) + { + alphaAnimationDown.cancel(); + alphaAnimationDown = null; + } + + if (alphaAnimationUp != null) + { + alphaAnimationUp.cancel(); + alphaAnimationUp = null; + } + } + + public void setText(String text) + { + this.textView.setText(text); + } + + public String getText() + { + return this.textView.getText().toString(); + } + + @BindingAdapter("text") + public static void setText(CircleActionButton view, String value) + { + view.setText(value); + } + + @InverseBindingAdapter(attribute = "text") + public static String getText(CircleActionButton view) + { + return view.getText(); } } diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/dagger/ApplicationComponent.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/dagger/ApplicationComponent.java index 498e3776d..db2848fa1 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/dagger/ApplicationComponent.java +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/dagger/ApplicationComponent.java @@ -1,5 +1,6 @@ package com.twine.colorcapture.dagger; +import com.twine.colorcapture.dialogs.confirm.ConfirmDialog; import com.twine.colorcapture.dialogs.error.ErrorDialog; import com.twine.colorcapture.dialogs.processing.ProcessingDialog; import com.twine.colorcapture.dialogs.progress.ProgressDialog; @@ -10,7 +11,9 @@ import com.twine.colorcapture.views.mycolors.MyColorsFragment; import com.twine.colorcapture.views.loading.LoadingActivity; import com.twine.colorcapture.views.main.MainActivity; import com.twine.colorcapture.views.register.RegisterFragment; +import com.twine.colorcapture.views.rename.RenameFragment; import com.twine.colorcapture.views.result.ResultFragment; +import com.twine.colorcapture.views.sendtoemail.SendToEmailActivity; import com.twine.colorcapture.views.sendtomachine.SendToMachineFragment; import javax.inject.Singleton; @@ -48,4 +51,10 @@ public interface ApplicationComponent void inject(SuccessDialog successDialog); void inject(SendToMachineFragment sendToMachineFragment); + + void inject(ConfirmDialog confirmDialog); + + void inject(RenameFragment renameFragment); + + void inject(SendToEmailActivity sendToEmailActivity); } diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/dagger/ViewModelsModule.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/dagger/ViewModelsModule.java index 40a49f021..f83826b21 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/dagger/ViewModelsModule.java +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/dagger/ViewModelsModule.java @@ -1,6 +1,7 @@ package com.twine.colorcapture.dagger; import com.squareup.otto.Bus; +import com.twine.colorcapture.dialogs.confirm.ConfirmDialogVM; import com.twine.colorcapture.dialogs.error.ErrorDialogVM; import com.twine.colorcapture.dialogs.processing.ProcessingDialogVM; import com.twine.colorcapture.dialogs.progress.ProgressDialogVM; @@ -13,7 +14,9 @@ import com.twine.colorcapture.views.loading.LoadingActivityVM; import com.twine.colorcapture.views.mycolors.MyColorsFragmentVM; import com.twine.colorcapture.views.main.MainActivityVM; import com.twine.colorcapture.views.register.RegisterFragmentVM; +import com.twine.colorcapture.views.rename.RenameFragmentVM; import com.twine.colorcapture.views.result.ResultFragmentVM; +import com.twine.colorcapture.views.sendtoemail.SendToEmailActivityVM; import com.twine.colorcapture.views.sendtomachine.SendToMachineFragmentVM; import com.twine.colorcapture.web.ITCCService; @@ -46,16 +49,23 @@ public class ViewModelsModule @Provides @Singleton + public SendToEmailActivityVM provideSendToEmailActivityVM(Bus eventBus, INotificationProvider notificationProvider, INavigationProvider navigationProvider, ITCCService tccService) + { + return new SendToEmailActivityVM(); + } + + @Provides + @Singleton public MyColorsFragmentVM provideMyColorsFragmentVM(Bus eventBus, INotificationProvider notificationProvider, INavigationProvider navigationProvider) { - return new MyColorsFragmentVM(navigationProvider); + return new MyColorsFragmentVM(navigationProvider, notificationProvider); } @Provides @Singleton public CaptureFragmentVM provideCaptureFragmentVM(Bus eventBus, INotificationProvider notificationProvider, INavigationProvider navigationProvider, ITCCService tccService) { - return new CaptureFragmentVM(eventBus,tccService, navigationProvider, notificationProvider); + return new CaptureFragmentVM(eventBus, tccService, navigationProvider, notificationProvider); } @Provides @@ -67,23 +77,30 @@ public class ViewModelsModule @Provides @Singleton - public ResultFragmentVM provideResultFragmentVM(Bus eventBus,INavigationProvider navigationProvider) + public ResultFragmentVM provideResultFragmentVM(Bus eventBus, INavigationProvider navigationProvider, ITCCService tccService) { - return new ResultFragmentVM(eventBus,navigationProvider); + return new ResultFragmentVM(eventBus, navigationProvider, tccService); } @Provides @Singleton - public RegisterFragmentVM provideRegisterFragmentVM(INotificationProvider notificationProvider, INavigationProvider navigationProvider, ITCCService tccService,Bus eventBus) + public RegisterFragmentVM provideRegisterFragmentVM(INotificationProvider notificationProvider, INavigationProvider navigationProvider, ITCCService tccService, Bus eventBus) { - return new RegisterFragmentVM(notificationProvider,navigationProvider,tccService,eventBus); + return new RegisterFragmentVM(notificationProvider, navigationProvider, tccService, eventBus); } @Provides @Singleton - public SendToMachineFragmentVM provideSendMachineFragmentVM(INotificationProvider notificationProvider, INavigationProvider navigationProvider) + public RenameFragmentVM provideRenameFragmentVM(INavigationProvider navigationProvider) { - return new SendToMachineFragmentVM(notificationProvider,navigationProvider); + return new RenameFragmentVM(navigationProvider); + } + + @Provides + @Singleton + public SendToMachineFragmentVM provideSendMachineFragmentVM(INotificationProvider notificationProvider, INavigationProvider navigationProvider, ITCCService tccService) + { + return new SendToMachineFragmentVM(notificationProvider, navigationProvider, tccService); } @Provides @@ -109,6 +126,13 @@ public class ViewModelsModule @Provides @Singleton + public ConfirmDialogVM provideConfirmDialogVM() + { + return new ConfirmDialogVM(); + } + + @Provides + @Singleton public WelcomeDialogVM provideWelcomeDialogVM() { return new WelcomeDialogVM(); diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/dialogs/confirm/ConfirmDialog.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/dialogs/confirm/ConfirmDialog.java new file mode 100644 index 000000000..9b67c2a08 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/dialogs/confirm/ConfirmDialog.java @@ -0,0 +1,22 @@ +package com.twine.colorcapture.dialogs.confirm; + +import com.twine.colorcapture.App; +import com.twine.colorcapture.R; +import com.twine.colorcapture.databinding.DialogConfirmBinding; +import com.twine.colorcapture.mvvm.DialogBase; + +public class ConfirmDialog extends DialogBase<DialogConfirmBinding,ConfirmDialogVM> +{ + + @Override + public int getLayoutId() + { + return R.layout.dialog_confirm; + } + + @Override + public void inject() + { + App.getComponent().inject(this); + } +} diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/dialogs/confirm/ConfirmDialogVM.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/dialogs/confirm/ConfirmDialogVM.java new file mode 100644 index 000000000..5fa0db57c --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/dialogs/confirm/ConfirmDialogVM.java @@ -0,0 +1,41 @@ +package com.twine.colorcapture.dialogs.confirm; + +import com.twine.colorcapture.mvvm.DependencyProperty; +import com.twine.colorcapture.mvvm.MessageDialogViewModelBase; +import com.twine.colorcapture.mvvm.RelayCommand; + +public class ConfirmDialogVM extends MessageDialogViewModelBase +{ + private boolean confirmed; + + public DependencyProperty<String> confirmText; + public RelayCommand confirmCommand; + + public ConfirmDialogVM() + { + super(); + confirmText = new DependencyProperty<>("OK"); + confirmCommand = new RelayCommand(this::onConfirmed); + } + + private void onConfirmed() + { + confirmed = true; + close(); + } + + public void setConfirmText(String confirmText) + { + this.confirmText.set(confirmText); + } + + public boolean isConfirmed() + { + return this.confirmed; + } + + public void setConfirmed(Boolean confirmed) + { + this.confirmed = confirmed; + } +} diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/dialogs/error/ErrorDialogVM.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/dialogs/error/ErrorDialogVM.java index 4bc2dbb36..6dee3dfe1 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/dialogs/error/ErrorDialogVM.java +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/dialogs/error/ErrorDialogVM.java @@ -2,25 +2,9 @@ package com.twine.colorcapture.dialogs.error; import com.twine.colorcapture.mvvm.DependencyProperty; import com.twine.colorcapture.mvvm.DialogViewModelBase; +import com.twine.colorcapture.mvvm.MessageDialogViewModelBase; -public class ErrorDialogVM extends DialogViewModelBase +public class ErrorDialogVM extends MessageDialogViewModelBase { - public DependencyProperty<String> title; - public DependencyProperty<String> message; - public ErrorDialogVM() - { - title = new DependencyProperty<>(""); - message = new DependencyProperty<>(""); - } - - public void setTitle(String title) - { - this.title.set(title); - } - - public void setMessage(String message) - { - this.message.set(message); - } } diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/dialogs/progress/ProgressDialogVM.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/dialogs/progress/ProgressDialogVM.java index 4b7dc1d34..24d0da2ea 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/dialogs/progress/ProgressDialogVM.java +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/dialogs/progress/ProgressDialogVM.java @@ -2,25 +2,9 @@ package com.twine.colorcapture.dialogs.progress; import com.twine.colorcapture.mvvm.DependencyProperty; import com.twine.colorcapture.mvvm.DialogViewModelBase; +import com.twine.colorcapture.mvvm.MessageDialogViewModelBase; -public class ProgressDialogVM extends DialogViewModelBase +public class ProgressDialogVM extends MessageDialogViewModelBase { - public DependencyProperty<String> title; - public DependencyProperty<String> message; - public ProgressDialogVM() - { - title = new DependencyProperty<>(""); - message = new DependencyProperty<>(""); - } - - public void setTitle(String title) - { - this.title.set(title); - } - - public void setMessage(String message) - { - this.message.set(message); - } } diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/dialogs/success/SuccessDialogVM.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/dialogs/success/SuccessDialogVM.java index b1fb00129..466f32879 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/dialogs/success/SuccessDialogVM.java +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/dialogs/success/SuccessDialogVM.java @@ -2,25 +2,9 @@ package com.twine.colorcapture.dialogs.success; import com.twine.colorcapture.mvvm.DependencyProperty; import com.twine.colorcapture.mvvm.DialogViewModelBase; +import com.twine.colorcapture.mvvm.MessageDialogViewModelBase; -public class SuccessDialogVM extends DialogViewModelBase +public class SuccessDialogVM extends MessageDialogViewModelBase { - public DependencyProperty<String> title; - public DependencyProperty<String> message; - public SuccessDialogVM() - { - title = new DependencyProperty<>(""); - message = new DependencyProperty<>(""); - } - - public void setTitle(String title) - { - this.title.set(title); - } - - public void setMessage(String message) - { - this.message.set(message); - } } diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/integration/ExternalBridgeClient.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/integration/ExternalBridgeClient.java index b2ccc16dc..99436a6b2 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/integration/ExternalBridgeClient.java +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/integration/ExternalBridgeClient.java @@ -31,6 +31,7 @@ public class ExternalBridgeClient try { Socket tcpClient = new Socket(); + tcpClient.setSoTimeout(10000); tcpClient.connect(new InetSocketAddress(machine.getIpAddress(), EXTERNAL_BRIDGE_PORT), 2000); //Create detection color diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/logging/LogManager.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/logging/LogManager.java new file mode 100644 index 000000000..a15e0752d --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/logging/LogManager.java @@ -0,0 +1,35 @@ +package com.twine.colorcapture.logging; + +import android.util.Log; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; + +public class LogManager +{ + private static final String TAG = "TCC"; + + public static void log(String message) + { + Log.d(TAG, message); + } + + public static Exception log(Exception ex) + { + Log.e(TAG, ex.toString()); + return ex; + } + + public static Exception log(Exception ex, String message) + { + Log.e(TAG, message, ex); + return ex; + } + + public static void log(String message, Object obj) + { + Gson gson = new GsonBuilder().setPrettyPrinting().create(); + String json = gson.toJson(obj); + Log.d(TAG, message + "\n" + json); + } +} diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/models/ColorResult.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/models/ColorResult.java new file mode 100644 index 000000000..a4c726ef6 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/models/ColorResult.java @@ -0,0 +1,54 @@ +package com.twine.colorcapture.models; + +import android.databinding.BaseObservable; + +import com.twine.colorcapture.mvvm.ExtendedObject; +import com.twine.colorcapture.web.messages.DetectionColor; +import com.twine.colorcapture.web.messages.DetectionResponse; + +import org.joda.time.DateTime; + +public class ColorResult extends BaseObservable +{ + private DetectionResponse detectionResponse; + private String date; + private String name; + + public DetectionResponse getDetectionResponse() + { + return detectionResponse; + } + + public void setDetectionResponse(DetectionResponse detectionResponse) + { + this.detectionResponse = detectionResponse; + } + + public String getDate() + { + return date; + } + + public void setDate(String date) + { + this.date = date; + } + + public String getName() + { + return name; + } + + public void setName(String name) + { + this.name = name; + notifyChange(); + } + + public ColorResult(DetectionResponse detectionResponse, String date, String name) + { + this.detectionResponse = detectionResponse; + this.date = date; + this.name = name; + } +} diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/models/ColorResultVM.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/models/ColorResultVM.java new file mode 100644 index 000000000..02dd14b8b --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/models/ColorResultVM.java @@ -0,0 +1,40 @@ +package com.twine.colorcapture.models; + +import com.twine.colorcapture.core.IAction1; +import com.twine.colorcapture.mvvm.RelayCommand; +import com.twine.colorcapture.mvvm.ViewModelBase; + +public class ColorResultVM extends ViewModelBase +{ + private ColorResult result; + public RelayCommand deleteCommand; + private IAction1<ColorResultVM> onDeleteListener; + + public ColorResultVM() + { + deleteCommand = new RelayCommand(this::handleDeleteCommand); + } + + private void handleDeleteCommand() + { + if (onDeleteListener != null) + { + onDeleteListener.invoke(this); + } + } + + public ColorResult getResult() + { + return result; + } + + public void setResult(ColorResult result) + { + this.result = result; + } + + public void setOnDeleteListener(IAction1<ColorResultVM> listener) + { + onDeleteListener = listener; + } +} diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/mvvm/MessageDialogViewModelBase.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/mvvm/MessageDialogViewModelBase.java new file mode 100644 index 000000000..f2026ecc6 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/mvvm/MessageDialogViewModelBase.java @@ -0,0 +1,25 @@ +package com.twine.colorcapture.mvvm; + +public class MessageDialogViewModelBase extends DialogViewModelBase +{ + public DependencyProperty<String> title; + public DependencyProperty<String> message; + public RelayCommand closeCommand; + + public MessageDialogViewModelBase() + { + title = new DependencyProperty<>(""); + message = new DependencyProperty<>(""); + closeCommand = new RelayCommand(this::close); + } + + public void setTitle(String title) + { + this.title.set(title); + } + + public void setMessage(String message) + { + this.message.set(message); + } +} diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/navigation/AndroidNavigationProvider.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/navigation/AndroidNavigationProvider.java index 5924c17d9..07bb16ecc 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/navigation/AndroidNavigationProvider.java +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/navigation/AndroidNavigationProvider.java @@ -279,6 +279,7 @@ public class AndroidNavigationProvider extends ExtendedObject implements INaviga { Class cls = Class.forName(activityName); Intent intent = new Intent(context, cls); + intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); if (!addToHistory) { diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/navigation/NavigationActivity.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/navigation/NavigationActivity.java index b03f688bc..760e0f8b6 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/navigation/NavigationActivity.java +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/navigation/NavigationActivity.java @@ -4,4 +4,5 @@ public enum NavigationActivity { Loading, Main, + SendToEmail, } diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/navigation/NavigationFragment.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/navigation/NavigationFragment.java index 07474ec3e..0731287e8 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/navigation/NavigationFragment.java +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/navigation/NavigationFragment.java @@ -8,5 +8,8 @@ public enum NavigationFragment @PreventHistory Register, @PreventHistory - SendToMachine + SendToMachine, + @PreventHistory + Rename + } diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/navigation/TabState.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/navigation/TabState.java new file mode 100644 index 000000000..2682ded78 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/navigation/TabState.java @@ -0,0 +1,8 @@ +package com.twine.colorcapture.navigation; + +public enum TabState +{ + Capture, + MyColors, + More +} diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/navigation/TabStateManager.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/navigation/TabStateManager.java new file mode 100644 index 000000000..89156af17 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/navigation/TabStateManager.java @@ -0,0 +1,25 @@ +package com.twine.colorcapture.navigation; + +import com.twine.colorcapture.mvvm.DependencyProperty; + +public class TabStateManager +{ + private static TabStateManager instance; + + public DependencyProperty<TabState> state; + + public static TabStateManager getInstance() + { + if (instance == null) + { + instance = new TabStateManager(); + } + + return instance; + } + + public TabStateManager() + { + state = new DependencyProperty<>(TabState.Capture); + } +} diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/notification/AndroidNotificationProvider.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/notification/AndroidNotificationProvider.java index 307fc5edf..528bea2e2 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/notification/AndroidNotificationProvider.java +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/notification/AndroidNotificationProvider.java @@ -9,6 +9,8 @@ import android.widget.Toast; import com.twine.colorcapture.core.IAction; import com.twine.colorcapture.core.IAction1; +import com.twine.colorcapture.dialogs.confirm.ConfirmDialog; +import com.twine.colorcapture.dialogs.confirm.ConfirmDialogVM; import com.twine.colorcapture.dialogs.error.ErrorDialog; import com.twine.colorcapture.dialogs.error.ErrorDialogVM; import com.twine.colorcapture.dialogs.progress.ProgressDialog; @@ -153,6 +155,34 @@ public class AndroidNotificationProvider implements INotificationProvider } @Override + public void showConfirm(String title, String message,String confirmText, IAction1<ConfirmDialogVM> onDismiss) + { + closeDialog(); + ConfirmDialog dialog = new ConfirmDialog(); + dialog.inject(); + + lastDialog = dialog; + FragmentTransaction ft = activity.getFragmentManager().beginTransaction(); + Fragment prev = activity.getFragmentManager().findFragmentByTag("dialog"); + if (prev != null) { + ft.remove(prev); + } + ft.addToBackStack(null); + + dialog.setOnDismissListener(onDismiss); + + //show the dialog. + dialog.show(ft, "dialog"); + + ConfirmDialogVM vm = dialog.getVM(); + + vm.setConfirmed(false); + vm.setTitle(title); + vm.setMessage(message); + vm.setConfirmText(confirmText); + } + + @Override public void closeDialog() { if (lastDialog != null) diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/notification/INotificationProvider.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/notification/INotificationProvider.java index b1295a8b4..121ce0919 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/notification/INotificationProvider.java +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/notification/INotificationProvider.java @@ -4,6 +4,7 @@ import android.app.Activity; import com.twine.colorcapture.core.IAction; import com.twine.colorcapture.core.IAction1; +import com.twine.colorcapture.dialogs.confirm.ConfirmDialogVM; import com.twine.colorcapture.dialogs.error.ErrorDialogVM; import com.twine.colorcapture.dialogs.progress.ProgressDialogVM; import com.twine.colorcapture.dialogs.success.SuccessDialog; @@ -37,6 +38,7 @@ public interface INotificationProvider /** * Displays a progress dialog... + * * @param title * @param message */ @@ -44,6 +46,7 @@ public interface INotificationProvider /** * Displays a success dialog. + * * @param title * @param message * @param onDismiss @@ -52,6 +55,7 @@ public interface INotificationProvider /** * Displays an error dialog. + * * @param title * @param message * @param onDismiss @@ -59,6 +63,15 @@ public interface INotificationProvider void showError(String title, String message, IAction1<ErrorDialogVM> onDismiss); /** + * Displays a confirmation dialog. + * + * @param title + * @param message + * @param onDismiss + */ + void showConfirm(String title, String message, String confirmText, IAction1<ConfirmDialogVM> onDismiss); + + /** * Closes the last dialog. */ void closeDialog(); diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/settings/SettingsManager.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/settings/SettingsManager.java new file mode 100644 index 000000000..b90f11a13 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/settings/SettingsManager.java @@ -0,0 +1,96 @@ +package com.twine.colorcapture.settings; + +import android.content.SharedPreferences; + +import com.google.gson.Gson; +import com.twine.colorcapture.logging.LogManager; +import com.twine.colorcapture.models.ColorResult; + +import java.util.ArrayList; +import java.util.List; + +import static android.content.Context.MODE_PRIVATE; +import static com.twine.colorcapture.App.getContext; + +public class SettingsManager +{ + private static final String SETTINGS_FILE_NAME = "TCC_Settings"; + private static SettingsManager instance; + private boolean isWelcomeScreenShown; + private List<ColorResult> results; + + public boolean isWelcomeScreenShown() + { + return isWelcomeScreenShown; + } + + public void setWelcomeScreenShown(boolean welcomeScreenShown) + { + isWelcomeScreenShown = welcomeScreenShown; + } + + public List<ColorResult> getResults() + { + return results; + } + + public static SettingsManager getInstance() + { + if (instance == null) + { + instance = load(); + } + + return instance; + } + + public static void save() + { + try + { + LogManager.log("Saving settings..."); + Gson gson = new Gson(); + String value = gson.toJson(getInstance()); + SharedPreferences.Editor editor = getContext().getSharedPreferences(SETTINGS_FILE_NAME, MODE_PRIVATE).edit(); + editor.putString("settings", value); + editor.apply(); + + LogManager.log("Settings:", getInstance()); + } + catch (Exception ex) + { + LogManager.log(ex, "Error saving settings."); + } + } + + private static SettingsManager load() + { + SettingsManager result = new SettingsManager(); + + try + { + LogManager.log("Loading settings..."); + SharedPreferences prefs = getContext().getSharedPreferences(SETTINGS_FILE_NAME, MODE_PRIVATE); + String value = prefs.getString("settings", null); + + if (value != null) + { + Gson gson = new Gson(); + result = gson.fromJson(value, SettingsManager.class); + } + } + catch (Exception ex) + { + LogManager.log(ex, "Error loading settings."); + } + + LogManager.log("Settings:", result); + + return result; + } + + public SettingsManager() + { + results = new ArrayList<>(); + } +} diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/capture/CaptureFragmentVM.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/capture/CaptureFragmentVM.java index b043bef9f..c0b89fba8 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/capture/CaptureFragmentVM.java +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/capture/CaptureFragmentVM.java @@ -8,12 +8,16 @@ import com.squareup.otto.Bus; import com.twine.colorcapture.core.Task.TaskBuilder; import com.twine.colorcapture.dialogs.processing.ProcessingDialog; import com.twine.colorcapture.dialogs.welcome.WelcomeDialog; +import com.twine.colorcapture.models.ColorResult; import com.twine.colorcapture.mvvm.DependencyProperty; import com.twine.colorcapture.mvvm.ViewModelBase; import com.twine.colorcapture.navigation.INavigationProvider; import com.twine.colorcapture.navigation.NavigationFragment; +import com.twine.colorcapture.navigation.TabState; +import com.twine.colorcapture.navigation.TabStateManager; import com.twine.colorcapture.notification.INotificationProvider; import com.twine.colorcapture.opencv.ImageProcessor; +import com.twine.colorcapture.settings.SettingsManager; import com.twine.colorcapture.utils.ThreadingUtils; import com.twine.colorcapture.views.capture.ICaptureFragment.ICaptureFragmentListener; import com.twine.colorcapture.web.ITCCService; @@ -24,6 +28,11 @@ import com.yanzhenjie.zbar.ImageScanner; import com.yanzhenjie.zbar.Symbol; import com.yanzhenjie.zbar.SymbolSet; +import org.joda.time.LocalDateTime; +import org.joda.time.format.DateTimeFormat; +import org.joda.time.format.DateTimeFormatter; + +import java.util.Locale; import java.util.concurrent.atomic.AtomicBoolean; public class CaptureFragmentVM extends ViewModelBase<ICaptureFragment> implements ICaptureFragmentListener @@ -42,7 +51,6 @@ public class CaptureFragmentVM extends ViewModelBase<ICaptureFragment> implement private DefinitionResponse definition; private INavigationProvider navigationProvider; private INotificationProvider notificationProvider; - private boolean startDialogShown; private boolean preventDetection; private Bus eventBus; @@ -161,8 +169,17 @@ public class CaptureFragmentVM extends ViewModelBase<ICaptureFragment> implement if (!abort.get()) { + LocalDateTime date = LocalDateTime.now(); + DateTimeFormatter fmt = DateTimeFormat.forPattern("d MMMM, yyyy, hh:mm:ss").withLocale(Locale.ENGLISH); + String name = date.toString(fmt); + + ColorResult colorResult = new ColorResult(response, date.toString(), name); + + SettingsManager.getInstance().getResults().add(colorResult); + SettingsManager.save(); + notificationProvider.closeDialog(); - navigationProvider.navigateWithObjectTo(NavigationFragment.Result, true, false, response); + navigationProvider.navigateWithObjectTo(NavigationFragment.Result, true, false, colorResult); } else { @@ -203,18 +220,22 @@ public class CaptureFragmentVM extends ViewModelBase<ICaptureFragment> implement protected void onNavigatedTo() { super.onNavigatedTo(); + TabStateManager.getInstance().state.set(TabState.Capture); preventDetection = false; - if (!startDialogShown) - { - startDialogShown = true; + boolean showDialog = !SettingsManager.getInstance().isWelcomeScreenShown(); + if (showDialog) + { notificationProvider.showDialog(new WelcomeDialog(), (vm) -> { isCardDetected.set(false); view.startCamera(); }); + + SettingsManager.getInstance().setWelcomeScreenShown(true); + SettingsManager.save(); } else { diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/main/IMainActivity.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/main/IMainActivity.java index 866a0ece7..0835d4eef 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/main/IMainActivity.java +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/main/IMainActivity.java @@ -4,4 +4,5 @@ import com.twine.colorcapture.mvvm.IView; public interface IMainActivity extends IView { + void cloneMenu(); } diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/main/MainActivity.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/main/MainActivity.java index e0eaca38c..f40b78a4b 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/main/MainActivity.java +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/main/MainActivity.java @@ -10,6 +10,7 @@ import android.util.Log; import android.view.Gravity; import android.view.View; import android.view.ViewGroup; +import android.widget.ImageButton; import android.widget.LinearLayout; import com.twine.colorcapture.App; @@ -38,7 +39,7 @@ public class MainActivity extends ActivityBase<ActivityMainBinding, MainActivity public INotificationProvider notificationProvider; @BindView(R.id.btnMenu) - ToggleImageButton btnMenu; + ImageButton btnMenu; @BindView(R.id.header) LinearLayout frameHeader; @@ -125,4 +126,10 @@ public class MainActivity extends ActivityBase<ActivityMainBinding, MainActivity navigationProvider.reset(); super.onDestroy(); } + + @Override + public void cloneMenu() + { + drawerLayout.closeDrawer(Gravity.START); + } } diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/main/MainActivityVM.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/main/MainActivityVM.java index b579a3e9f..23f3e3868 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/main/MainActivityVM.java +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/main/MainActivityVM.java @@ -4,9 +4,12 @@ import com.squareup.otto.Bus; import com.twine.colorcapture.dialogs.welcome.WelcomeDialog; import com.twine.colorcapture.integration.ExternalBridgeScanner; import com.twine.colorcapture.mvvm.DependencyProperty; +import com.twine.colorcapture.mvvm.RelayCommand; import com.twine.colorcapture.mvvm.ViewModelBase; import com.twine.colorcapture.navigation.INavigationProvider; import com.twine.colorcapture.navigation.NavigationFragment; +import com.twine.colorcapture.navigation.TabState; +import com.twine.colorcapture.navigation.TabStateManager; import com.twine.colorcapture.notification.INotificationProvider; import javax.inject.Inject; @@ -24,86 +27,73 @@ public class MainActivityVM extends ViewModelBase<IMainActivity> private INotificationProvider notificationProvider; private CurrentTab currentTab; - public DependencyProperty<Boolean> isMoreToggled; - public DependencyProperty<Boolean> isCaptureToggled; - public DependencyProperty<Boolean> isMyColorsToggled; + public TabStateManager tabStateManager; + + public RelayCommand captureCommand; + public RelayCommand myColorsCommand; + public RelayCommand moreCommand; + + public RelayCommand howToUseCommand; @Inject public MainActivityVM(Bus eventBus, INotificationProvider notificationProvider, INavigationProvider navigationProvider) { + tabStateManager = TabStateManager.getInstance(); + this.navigationProvider = navigationProvider; this.notificationProvider = notificationProvider; - isMoreToggled = new DependencyProperty<Boolean>(false, this::onMoreToggled); - isCaptureToggled = new DependencyProperty<Boolean>(false, this::onCaptureToggled); - isMyColorsToggled = new DependencyProperty<Boolean>(false, this::onMyColorsToggled); currentTab = CurrentTab.Capture; - setCurrentTab(currentTab); navigationProvider.addFragmentNavigationListener(this::onNavigation); + + howToUseCommand = new RelayCommand(this::handleHowToUseCommand); + + captureCommand = new RelayCommand(this::handleCaptureCommand); + myColorsCommand = new RelayCommand(this::handleMyColorsCommand); + moreCommand = new RelayCommand(this::handleMoreCommand); } - private void onNavigation(NavigationFragment navigationFragment) + private void handleMoreCommand() + { + + } + + private void handleMyColorsCommand() { - if (navigationFragment == NavigationFragment.Capture || navigationFragment == NavigationFragment.Result && currentTab != CurrentTab.Capture) + if (navigationProvider.getCurrentFragment() != NavigationFragment.MyColors) { - isMoreToggled.setNoCallback(false); - isMyColorsToggled.setNoCallback(false); - isCaptureToggled.setNoCallback(true); + navigationProvider.navigateTo(NavigationFragment.MyColors, true, false); } } - @Override - protected void onViewAttached(IMainActivity view) + private void handleCaptureCommand() { - super.onViewAttached(view); + if (navigationProvider.getCurrentFragment() != NavigationFragment.Capture) + { + navigationProvider.navigateTo(NavigationFragment.Capture, false, true); + } } - private void onMyColorsToggled(DependencyProperty<Boolean> booleanDependencyProperty, Boolean value) + @Override + protected void onNavigatedTo() { - setCurrentTab(CurrentTab.MyColors); + super.onNavigatedTo(); + tabStateManager.state.set(TabState.Capture); } - private void onCaptureToggled(DependencyProperty<Boolean> booleanDependencyProperty, Boolean value) + private void handleHowToUseCommand() { - setCurrentTab(CurrentTab.Capture); + view.cloneMenu(); + notificationProvider.showDialog(new WelcomeDialog(), (vm) -> { }); } - private void onMoreToggled(DependencyProperty<Boolean> booleanDependencyProperty, Boolean value) + private void onNavigation(NavigationFragment navigationFragment) { - setCurrentTab(CurrentTab.More); + } - private void setCurrentTab(CurrentTab tab) + @Override + protected void onViewAttached(IMainActivity view) { - currentTab = tab; - - if (tab == CurrentTab.More) - { - if (isMoreToggled.get()) - { - isCaptureToggled.setNoCallback(false); - isMyColorsToggled.setNoCallback(false); - } - isMoreToggled.setNoCallback(true); - } - else if (tab == CurrentTab.Capture) - { - if (isCaptureToggled.get()) - { - isMoreToggled.setNoCallback(false); - isMyColorsToggled.setNoCallback(false); - navigationProvider.navigateTo(NavigationFragment.Capture, false, true); - } - isCaptureToggled.setNoCallback(true); - } - else if (tab == CurrentTab.MyColors) - { - if (isMyColorsToggled.get()) - { - isMoreToggled.setNoCallback(false); - isCaptureToggled.setNoCallback(false); - navigationProvider.navigateTo(NavigationFragment.MyColors, true, false); - } - isMyColorsToggled.setNoCallback(true); - } + super.onViewAttached(view); } } diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/mycolors/MyColorsFragmentVM.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/mycolors/MyColorsFragmentVM.java index 9a2358516..6b0fc7b27 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/mycolors/MyColorsFragmentVM.java +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/mycolors/MyColorsFragmentVM.java @@ -1,17 +1,83 @@ package com.twine.colorcapture.views.mycolors; +import android.databinding.ObservableArrayList; +import android.databinding.ObservableList; +import android.view.View; +import android.widget.AdapterView; + +import com.twine.colorcapture.BR; +import com.twine.colorcapture.R; +import com.twine.colorcapture.integration.ExternalBridgeMachine; +import com.twine.colorcapture.logging.LogManager; +import com.twine.colorcapture.models.ColorResult; +import com.twine.colorcapture.models.ColorResultVM; import com.twine.colorcapture.mvvm.ViewModelBase; import com.twine.colorcapture.navigation.INavigationProvider; +import com.twine.colorcapture.navigation.NavigationFragment; +import com.twine.colorcapture.navigation.TabState; +import com.twine.colorcapture.navigation.TabStateManager; +import com.twine.colorcapture.notification.INotificationProvider; +import com.twine.colorcapture.settings.SettingsManager; + +import java.util.Collections; import javax.inject.Inject; +import me.tatarka.bindingcollectionadapter2.ItemBinding; + +import static br.com.zbra.androidlinq.Linq.stream; + public class MyColorsFragmentVM extends ViewModelBase<IMyColorsFragment> { private INavigationProvider navigationProvider; - + private INotificationProvider notificationProvider; + public ObservableList<ColorResultVM> results; + public ItemBinding<String> resultBinding; + @Inject - public MyColorsFragmentVM(INavigationProvider navigationProvider) + public MyColorsFragmentVM(INavigationProvider navigationProvider, INotificationProvider notificationProvider) { + this.notificationProvider = notificationProvider; this.navigationProvider = navigationProvider; + + results = new ObservableArrayList<>(); + resultBinding = ItemBinding.of(BR.result, R.layout.color_result_item); + } + + public void onResultSelected(AdapterView<?> adapterView, View view, int i, long l) + { + ColorResultVM colorResultVM = (ColorResultVM) adapterView.getAdapter().getItem(i); + navigationProvider.navigateWithObjectTo(NavigationFragment.Result, true, false, colorResultVM.getResult()); + } + + @Override + protected void onNavigatedTo() + { + super.onNavigatedTo(); + + TabStateManager.getInstance().state.set(TabState.MyColors); + + results.clear(); + + for (ColorResult result : stream(SettingsManager.getInstance().getResults()).reverse()) + { + ColorResultVM vm = new ColorResultVM(); + vm.setResult(result); + results.add(vm); + vm.setOnDeleteListener(this::onResultDeleted); + } + } + + private void onResultDeleted(ColorResultVM colorResultVM) + { + notificationProvider.showConfirm("Delete color", "Are you sure you want to delete the selected color?", "Delete", (vm) -> + { + if (vm.isConfirmed()) + { + results.remove(colorResultVM); + SettingsManager.getInstance().getResults().remove(colorResultVM.getResult()); + SettingsManager.save(); + } + }); } } diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/register/RegisterFragmentVM.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/register/RegisterFragmentVM.java index 3641e89ee..3002bf243 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/register/RegisterFragmentVM.java +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/register/RegisterFragmentVM.java @@ -81,7 +81,7 @@ public class RegisterFragmentVM extends ViewModelBase<IResultFragment> catch (Exception ex) { pVM.close(); - //TODO: display error message! + notificationProvider.showError("Registering your system","Device registration failed.\nPlease check your serial number.",(e) -> {}); Log.i("REGISTER", ex.getMessage()); } diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/rename/IRenameFragment.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/rename/IRenameFragment.java new file mode 100644 index 000000000..9cd9e9a54 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/rename/IRenameFragment.java @@ -0,0 +1,7 @@ +package com.twine.colorcapture.views.rename; + +import com.twine.colorcapture.mvvm.IView; + +public interface IRenameFragment extends IView +{ +} diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/rename/RenameFragment.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/rename/RenameFragment.java new file mode 100644 index 000000000..228ccd66d --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/rename/RenameFragment.java @@ -0,0 +1,62 @@ +package com.twine.colorcapture.views.rename; + +import android.content.Context; +import android.databinding.Bindable; +import android.support.v7.widget.AppCompatEditText; +import android.view.View; +import android.view.inputmethod.InputMethodManager; + +import com.twine.colorcapture.App; +import com.twine.colorcapture.R; +import com.twine.colorcapture.databinding.FragmentRenameBinding; +import com.twine.colorcapture.mvvm.FragmentBase; + +import butterknife.BindView; + +public class RenameFragment extends FragmentBase<FragmentRenameBinding, RenameFragmentVM> +{ + @BindView(R.id.txtName) + public AppCompatEditText txtName; + + @Override + protected int getLayoutId() + { + return R.layout.fragment_rename; + } + + @Override + protected void inject() + { + App.getComponent().inject(this); + } + + @Override + public String getTitle() + { + return "Rename"; + } + + @Override + protected void onCreated() + { + super.onCreated(); + + InputMethodManager imgr = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE); + txtName.requestFocus(); + txtName.selectAll(); + imgr.toggleSoftInput(InputMethodManager.SHOW_IMPLICIT, InputMethodManager.HIDE_NOT_ALWAYS); + } + + @Override + public void onPause() + { + super.onPause(); + + // Check if no view has focus: + View view = getActivity().getCurrentFocus(); + if (view != null) { + InputMethodManager inputManager = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE); + inputManager.hideSoftInputFromWindow(view.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); + } + } +} diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/rename/RenameFragmentVM.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/rename/RenameFragmentVM.java new file mode 100644 index 000000000..e860d0aac --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/rename/RenameFragmentVM.java @@ -0,0 +1,50 @@ +package com.twine.colorcapture.views.rename; + +import com.twine.colorcapture.models.ColorResult; +import com.twine.colorcapture.models.ColorResultVM; +import com.twine.colorcapture.mvvm.DependencyProperty; +import com.twine.colorcapture.mvvm.RelayCommand; +import com.twine.colorcapture.mvvm.ViewModelBase; +import com.twine.colorcapture.navigation.INavigationObjectReceiver; +import com.twine.colorcapture.navigation.INavigationProvider; +import com.twine.colorcapture.navigation.TabState; +import com.twine.colorcapture.navigation.TabStateManager; +import com.twine.colorcapture.settings.SettingsManager; + +public class RenameFragmentVM extends ViewModelBase<IRenameFragment> implements INavigationObjectReceiver<ColorResult> +{ + private INavigationProvider navigationProvider; + + public DependencyProperty<ColorResult> colorResult; + public DependencyProperty<String> name; + public RelayCommand renameCommand; + + public RenameFragmentVM(INavigationProvider navigationProvider) + { + this.navigationProvider = navigationProvider; + colorResult = new DependencyProperty<>(); + renameCommand = new RelayCommand(this::handleRenameCommand); + name = new DependencyProperty<>(""); + } + + private void handleRenameCommand() + { + colorResult.get().setName(name.get()); + SettingsManager.save(); + navigationProvider.navigateBack(); + } + + @Override + protected void onNavigatedTo() + { + super.onNavigatedTo(); + TabStateManager.getInstance().state.set(TabState.MyColors); + } + + @Override + public void onNavigationObjectReceived(ColorResult colorResult) + { + this.colorResult.set(colorResult); + this.name.set(colorResult.getName()); + } +} diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/result/ResultFragmentVM.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/result/ResultFragmentVM.java index 2e5639154..2e58e2777 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/result/ResultFragmentVM.java +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/result/ResultFragmentVM.java @@ -5,19 +5,34 @@ import android.util.Log; import com.squareup.otto.Bus; import com.squareup.otto.Subscribe; import com.twine.colorcapture.messages.MachineRegisteredMessage; +import com.twine.colorcapture.models.ColorResult; +import com.twine.colorcapture.models.ColorResultVM; import com.twine.colorcapture.mvvm.DependencyProperty; import com.twine.colorcapture.mvvm.RelayCommand; import com.twine.colorcapture.mvvm.ViewModelBase; import com.twine.colorcapture.navigation.INavigationObjectReceiver; import com.twine.colorcapture.navigation.INavigationProvider; +import com.twine.colorcapture.navigation.NavigationActivity; import com.twine.colorcapture.navigation.NavigationFragment; +import com.twine.colorcapture.navigation.TabState; +import com.twine.colorcapture.navigation.TabStateManager; +import com.twine.colorcapture.settings.SettingsManager; +import com.twine.colorcapture.web.ITCCService; import com.twine.colorcapture.web.messages.DetectionResponse; +import org.joda.time.LocalDateTime; +import org.joda.time.format.DateTimeFormat; +import org.joda.time.format.DateTimeFormatter; + +import java.util.Locale; + import javax.inject.Inject; -public class ResultFragmentVM extends ViewModelBase<IResultFragment> implements INavigationObjectReceiver<DetectionResponse> +public class ResultFragmentVM extends ViewModelBase<IResultFragment> implements INavigationObjectReceiver<ColorResult> { private INavigationProvider navigationProvider; + private ITCCService tccService; + public ColorResult colorResult; public DependencyProperty<Boolean> isCameraColorToggled; public DependencyProperty<DetectionResponse> detectionResponse; @@ -28,10 +43,12 @@ public class ResultFragmentVM extends ViewModelBase<IResultFragment> implements public RelayCommand sendToMachineCommand; public RelayCommand registerMachineCommand; + @Inject - public ResultFragmentVM(Bus eventBus, INavigationProvider navigationProvider) + public ResultFragmentVM(Bus eventBus, INavigationProvider navigationProvider, ITCCService tccService) { this.navigationProvider = navigationProvider; + this.tccService = tccService; isCameraColorToggled = new DependencyProperty<>(false); isMachineRegistred = new DependencyProperty<>(false); @@ -63,11 +80,12 @@ public class ResultFragmentVM extends ViewModelBase<IResultFragment> implements private void handleRenameCommand() { + navigationProvider.navigateWithObjectTo(NavigationFragment.Rename, true, false, colorResult); } private void handleEmailCommand() { - Log.d("RESULT", "handleEmailCommand: "); + navigationProvider.navigateTo(NavigationActivity.SendToEmail, false); } private void toggleCameraColor() @@ -76,8 +94,24 @@ public class ResultFragmentVM extends ViewModelBase<IResultFragment> implements } @Override - public void onNavigationObjectReceived(DetectionResponse detectionResponse) + public void onNavigationObjectReceived(ColorResult colorResult) + { + this.colorResult = colorResult; + this.detectionResponse.set(colorResult.getDetectionResponse()); + } + + @Override + protected void onNavigatedTo() { - this.detectionResponse.set(detectionResponse); + super.onNavigatedTo(); + + try + { + isMachineRegistred.set(tccService.getDefinition().isRegistered()); + } + catch (Exception e) + { + e.printStackTrace(); + } } } diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/sendtoemail/ISendToEmailActivity.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/sendtoemail/ISendToEmailActivity.java new file mode 100644 index 000000000..980d2eb49 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/sendtoemail/ISendToEmailActivity.java @@ -0,0 +1,7 @@ +package com.twine.colorcapture.views.sendtoemail; + +import com.twine.colorcapture.mvvm.IView; + +public interface ISendToEmailActivity extends IView +{ +} diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/sendtoemail/SendToEmailActivity.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/sendtoemail/SendToEmailActivity.java new file mode 100644 index 000000000..d886de513 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/sendtoemail/SendToEmailActivity.java @@ -0,0 +1,30 @@ +package com.twine.colorcapture.views.sendtoemail; + +import android.app.Activity; +import android.os.Bundle; + +import com.twine.colorcapture.App; +import com.twine.colorcapture.R; +import com.twine.colorcapture.databinding.ActivitySendToEmailBinding; +import com.twine.colorcapture.mvvm.ActivityBase; + +public class SendToEmailActivity extends ActivityBase<ActivitySendToEmailBinding, SendToEmailActivityVM> implements ISendToEmailActivity +{ + @Override + protected void onCreating(Bundle savedInstanceState) + { + + } + + @Override + protected int getLayoutId() + { + return R.layout.activity_send_to_email; + } + + @Override + protected void inject() + { + App.getComponent().inject(this); + } +} diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/sendtoemail/SendToEmailActivityVM.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/sendtoemail/SendToEmailActivityVM.java new file mode 100644 index 000000000..77467fff4 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/sendtoemail/SendToEmailActivityVM.java @@ -0,0 +1,21 @@ +package com.twine.colorcapture.views.sendtoemail; + +import com.twine.colorcapture.models.ColorResult; +import com.twine.colorcapture.mvvm.RelayCommand; +import com.twine.colorcapture.mvvm.ViewModelBase; + +public class SendToEmailActivityVM extends ViewModelBase<ISendToEmailActivity> +{ + public RelayCommand sendCommand; + public ColorResult colorResult; + + public SendToEmailActivityVM() + { + sendCommand = new RelayCommand(this::handleSendCommand); + } + + private void handleSendCommand() + { + + } +} diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/sendtomachine/SendToMachineFragmentVM.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/sendtomachine/SendToMachineFragmentVM.java index 0d415b498..a51d0eb71 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/sendtomachine/SendToMachineFragmentVM.java +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/sendtomachine/SendToMachineFragmentVM.java @@ -2,8 +2,6 @@ package com.twine.colorcapture.views.sendtomachine; import android.databinding.ObservableArrayList; import android.databinding.ObservableList; -import android.os.Handler; -import android.os.Looper; import android.view.View; import android.widget.AdapterView; @@ -16,6 +14,7 @@ import com.twine.colorcapture.mvvm.ViewModelBase; import com.twine.colorcapture.navigation.INavigationObjectReceiver; import com.twine.colorcapture.navigation.INavigationProvider; import com.twine.colorcapture.notification.INotificationProvider; +import com.twine.colorcapture.web.ITCCService; import com.twine.colorcapture.web.messages.DetectionColor; import java.util.concurrent.atomic.AtomicBoolean; @@ -24,21 +23,25 @@ import javax.inject.Inject; import me.tatarka.bindingcollectionadapter2.ItemBinding; +import static br.com.zbra.androidlinq.Linq.stream; + public class SendToMachineFragmentVM extends ViewModelBase<ISendToMachineFragment> implements INavigationObjectReceiver<DetectionColor> { private ExternalBridgeScanner scanner; private DetectionColor detectionColor; private INotificationProvider notificationProvider; private INavigationProvider navigationProvider; + private ITCCService tccService; public ObservableList<ExternalBridgeMachine> machines; public ItemBinding<String> machineBinding; @Inject - public SendToMachineFragmentVM(INotificationProvider notificationProvider, INavigationProvider navigationProvider) + public SendToMachineFragmentVM(INotificationProvider notificationProvider, INavigationProvider navigationProvider, ITCCService tccService) { this.notificationProvider = notificationProvider; this.navigationProvider = navigationProvider; + this.tccService = tccService; machines = new ObservableArrayList<>(); scanner = new ExternalBridgeScanner(); @@ -50,18 +53,24 @@ public class SendToMachineFragmentVM extends ViewModelBase<ISendToMachineFragmen private void onMachineDisconnected(Object o, ExternalBridgeMachine machine) { - invokeUI(() -> + if (stream(tccService.getOrganizationMachines()).any(x -> x.equals(machine.getSerialNumber()))) { - machines.remove(machine); - }); + invokeUI(() -> + { + machines.remove(machine); + }); + } } private void onMachineDiscovered(Object o, ExternalBridgeMachine machine) { - invokeUI(() -> + if (stream(tccService.getOrganizationMachines()).any(x -> x.equals(machine.getSerialNumber()))) { - machines.add(0, machine); - }); + invokeUI(() -> + { + machines.add(0, machine); + }); + } } @Override diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/web/ITCCService.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/web/ITCCService.java index feefe86f8..362abe121 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/web/ITCCService.java +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/web/ITCCService.java @@ -8,6 +8,7 @@ import com.twine.colorcapture.web.messages.DetectionResponse; import com.twine.colorcapture.web.messages.MachineRegistrationResponse; import java.io.IOException; +import java.util.List; public interface ITCCService { @@ -16,4 +17,8 @@ public interface ITCCService DetectionResponse detect(Bitmap bitmap, String barcode) throws Exception; MachineRegistrationResponse register(String serialNumber) throws Exception; + + boolean isRegistered(); + + List<String> getOrganizationMachines(); } diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/web/TCCService.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/web/TCCService.java index 6e03755b8..6999d2f0e 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/web/TCCService.java +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/web/TCCService.java @@ -7,6 +7,7 @@ import android.provider.Settings; import android.util.Base64; import com.twine.colorcapture.BuildConfig; +import com.twine.colorcapture.logging.LogManager; import com.twine.colorcapture.utils.BitmapUtils; import com.twine.colorcapture.web.messages.DefinitionRequest; import com.twine.colorcapture.web.messages.DefinitionResponse; @@ -18,6 +19,7 @@ import com.twine.colorcapture.web.messages.MachineRegistrationRequest; import com.twine.colorcapture.web.messages.MachineRegistrationResponse; import java.io.IOException; +import java.util.List; import java.util.UUID; import javax.inject.Inject; @@ -34,6 +36,8 @@ public class TCCService implements ITCCService private IWebServiceAPI webAPI; private LoginResponse loginResponse; private static final String DEVICE_ID_PREF_NAME = "DeviceIdFile"; + private boolean isRegistered; + private List<String> organizationMachines; @Inject public TCCService(IWebServiceAPI webServiceAPI) @@ -44,6 +48,8 @@ public class TCCService implements ITCCService @Override public DefinitionResponse getDefinition() throws Exception { + LogManager.log("Retrieving definition..."); + ensureAuthenticated(); if (definition == null) @@ -52,11 +58,15 @@ public class TCCService implements ITCCService if (response.isSuccessful()) { - definition = webAPI.getDefinition(new DefinitionRequest()).execute().body(); + definition = response.body(); + isRegistered = definition.isRegistered(); + organizationMachines = definition.getOrganizationMachines(); + + LogManager.log("Definition retrieved.", definition); } else { - throw new Exception(response.message()); + throw LogManager.log(new Exception(response.message())); } } @@ -88,20 +98,30 @@ public class TCCService implements ITCCService @Override public MachineRegistrationResponse register(String serialNumber) throws Exception { + LogManager.log("Registering machine..."); + ensureAuthenticated(); MachineRegistrationRequest request = new MachineRegistrationRequest(); request.setSerialnumber(serialNumber); + LogManager.log("Sending machine registration request:", request); + Response<MachineRegistrationResponse> response = webAPI.register(request).execute(); if (response.isSuccessful()) { - return response.body(); + MachineRegistrationResponse r = response.body(); + + LogManager.log("Machine registration successful.", r); + + isRegistered = true; + organizationMachines = r.getOrganizationMachines(); + return r; } else { - throw new Exception(response.message()); + throw LogManager.log(new Exception(response.message()), "Machine registration failed."); } } @@ -115,37 +135,57 @@ public class TCCService implements ITCCService private LoginResponse login() throws Exception { + LogManager.log("Logging in to TCC service..."); + LoginRequest request = new LoginRequest(); request.setAppId(BuildConfig.WEB_SERVICE_APP_ID); String deviceId; + LogManager.log("Getting device id from shared preferences..."); + SharedPreferences prefs = getContext().getSharedPreferences(DEVICE_ID_PREF_NAME, MODE_PRIVATE); deviceId = prefs.getString("DeviceId", null); if (deviceId == null) { + LogManager.log("Device id was not found in shared preferences. Generating device id..."); deviceId = UUID.randomUUID().toString(); SharedPreferences.Editor editor = getContext().getSharedPreferences(DEVICE_ID_PREF_NAME, MODE_PRIVATE).edit(); editor.putString("DeviceId", deviceId); editor.apply(); } + LogManager.log("Device id: " + deviceId + "."); + request.setDeviceId(deviceId); request.setDevice(Build.MANUFACTURER + " " + Build.MODEL); request.setOsVersion(Build.VERSION_CODES.class.getFields()[android.os.Build.VERSION.SDK_INT].getName()); + LogManager.log("Sending log-in request:", request); + Response<LoginResponse> response = webAPI.login(request).execute(); if (response.isSuccessful()) { loginResponse = response.body(); + LogManager.log("Login response received:", loginResponse); WebApiFactory.setAuthenticationToken(loginResponse.getAccessToken()); return loginResponse; } else { - throw new Exception(response.message()); + throw LogManager.log(new Exception(response.message()), "LogIn request failed."); } } + + public boolean isRegistered() + { + return isRegistered; + } + + public List<String> getOrganizationMachines() + { + return organizationMachines; + } } diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/web/WebApiFactory.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/web/WebApiFactory.java index 3aeaccd14..17c4f2d43 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/web/WebApiFactory.java +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/web/WebApiFactory.java @@ -3,6 +3,7 @@ package com.twine.colorcapture.web; import com.google.gson.FieldNamingPolicy; import com.google.gson.Gson; import com.google.gson.GsonBuilder; +import com.twine.colorcapture.logging.LogManager; import java.io.IOException; import java.util.concurrent.TimeUnit; @@ -47,6 +48,7 @@ public class WebApiFactory /** * Creates the specified API interface instance. + * * @param cls * @param timeout * @param <T> @@ -55,7 +57,8 @@ public class WebApiFactory private static <T> T createAPI(Class<?> cls, int timeout) { OkHttpClient.Builder httpClient = new OkHttpClient.Builder(); - httpClient.addInterceptor(new Interceptor() { + httpClient.addInterceptor(new Interceptor() + { @Override public Response intercept(Chain chain) throws IOException { @@ -69,6 +72,7 @@ public class WebApiFactory { request = chain.request().newBuilder().build(); } + return chain.proceed(request); } }); diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/web/messages/DefinitionResponse.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/web/messages/DefinitionResponse.java index 2dde27e09..d5da8ffe6 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/web/messages/DefinitionResponse.java +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/web/messages/DefinitionResponse.java @@ -1,5 +1,8 @@ package com.twine.colorcapture.web.messages; +import java.util.ArrayList; +import java.util.List; + public class DefinitionResponse { private String templateString; @@ -11,6 +14,28 @@ public class DefinitionResponse private double similarityTolerance; private boolean enableDoubleChecking; private boolean enforceBarcodeDetection; + private boolean isRegistered; + private List<String> organizationMachines; + + public boolean isRegistered() + { + return isRegistered; + } + + public void setRegistered(boolean registered) + { + isRegistered = registered; + } + + public List<String> getOrganizationMachines() + { + return organizationMachines; + } + + public void setOrganizationMachines(List<String> organizationMachines) + { + this.organizationMachines = organizationMachines; + } public String getTemplateString() { @@ -102,4 +127,9 @@ public class DefinitionResponse { this.enforceBarcodeDetection = enforceBarcodeDetection; } + + public DefinitionResponse() + { + organizationMachines = new ArrayList<>(); + } } diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-hdpi/about.png b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-hdpi/about.png Binary files differnew file mode 100644 index 000000000..69ff01eea --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-hdpi/about.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-hdpi/delete_thin.png b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-hdpi/delete_thin.png Binary files differnew file mode 100644 index 000000000..c1a9b62a9 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-hdpi/delete_thin.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-hdpi/error.png b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-hdpi/error.png Binary files differnew file mode 100644 index 000000000..bc9aeb86b --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-hdpi/error.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-hdpi/how_to.png b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-hdpi/how_to.png Binary files differnew file mode 100644 index 000000000..50aca55cb --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-hdpi/how_to.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-hdpi/icon_twine_card.png b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-hdpi/icon_twine_card.png Binary files differnew file mode 100644 index 000000000..188126db8 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-hdpi/icon_twine_card.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-hdpi/icons_close.png b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-hdpi/icons_close.png Binary files differnew file mode 100644 index 000000000..89c3b1653 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-hdpi/icons_close.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-hdpi/icons_delete.png b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-hdpi/icons_delete.png Binary files differnew file mode 100644 index 000000000..c04a02d4d --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-hdpi/icons_delete.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-hdpi/info.png b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-hdpi/info.png Binary files differnew file mode 100644 index 000000000..79a64c487 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-hdpi/info.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-hdpi/snapmatch.png b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-hdpi/snapmatch.png Binary files differnew file mode 100644 index 000000000..05656ffdc --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-hdpi/snapmatch.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-hdpi/twine_card_icon.png b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-hdpi/twine_card_icon.png Binary files differnew file mode 100644 index 000000000..ec9ae5576 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-hdpi/twine_card_icon.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-mdpi/about.png b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-mdpi/about.png Binary files differnew file mode 100644 index 000000000..65e278cd4 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-mdpi/about.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-mdpi/delete_thin.png b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-mdpi/delete_thin.png Binary files differnew file mode 100644 index 000000000..524997a78 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-mdpi/delete_thin.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-mdpi/error.png b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-mdpi/error.png Binary files differnew file mode 100644 index 000000000..db3db4966 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-mdpi/error.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-mdpi/how_to.png b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-mdpi/how_to.png Binary files differnew file mode 100644 index 000000000..59ba0e181 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-mdpi/how_to.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-mdpi/icon_twine_card.png b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-mdpi/icon_twine_card.png Binary files differnew file mode 100644 index 000000000..bad44f686 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-mdpi/icon_twine_card.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-mdpi/icons_close.png b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-mdpi/icons_close.png Binary files differnew file mode 100644 index 000000000..4e9940432 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-mdpi/icons_close.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-mdpi/icons_delete.png b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-mdpi/icons_delete.png Binary files differnew file mode 100644 index 000000000..e9a9a108e --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-mdpi/icons_delete.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-mdpi/info.png b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-mdpi/info.png Binary files differnew file mode 100644 index 000000000..a9bec6997 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-mdpi/info.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-mdpi/snapmatch.png b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-mdpi/snapmatch.png Binary files differnew file mode 100644 index 000000000..bbd2be018 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-mdpi/snapmatch.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-mdpi/twine_card_icon.png b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-mdpi/twine_card_icon.png Binary files differnew file mode 100644 index 000000000..e7ff93a39 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-mdpi/twine_card_icon.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xhdpi/about.png b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xhdpi/about.png Binary files differnew file mode 100644 index 000000000..d5701a483 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xhdpi/about.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xhdpi/delete_thin.png b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xhdpi/delete_thin.png Binary files differnew file mode 100644 index 000000000..b6b951c0a --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xhdpi/delete_thin.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xhdpi/error.png b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xhdpi/error.png Binary files differnew file mode 100644 index 000000000..41fa3df55 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xhdpi/error.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xhdpi/how_to.png b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xhdpi/how_to.png Binary files differnew file mode 100644 index 000000000..fbeb31818 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xhdpi/how_to.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xhdpi/icon_twine_card.png b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xhdpi/icon_twine_card.png Binary files differnew file mode 100644 index 000000000..48e6595fa --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xhdpi/icon_twine_card.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xhdpi/icons_close.png b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xhdpi/icons_close.png Binary files differnew file mode 100644 index 000000000..f4e9e1c50 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xhdpi/icons_close.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xhdpi/icons_delete.png b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xhdpi/icons_delete.png Binary files differnew file mode 100644 index 000000000..55753d24a --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xhdpi/icons_delete.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xhdpi/info.png b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xhdpi/info.png Binary files differnew file mode 100644 index 000000000..3e33de5a6 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xhdpi/info.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xhdpi/snapmatch.png b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xhdpi/snapmatch.png Binary files differnew file mode 100644 index 000000000..994d77ffe --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xhdpi/snapmatch.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xhdpi/twine_card_icon.png b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xhdpi/twine_card_icon.png Binary files differnew file mode 100644 index 000000000..ff3f1c99c --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xhdpi/twine_card_icon.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxhdpi/about.png b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxhdpi/about.png Binary files differnew file mode 100644 index 000000000..06fedcd88 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxhdpi/about.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxhdpi/delete_thin.png b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxhdpi/delete_thin.png Binary files differnew file mode 100644 index 000000000..f1e190f1c --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxhdpi/delete_thin.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxhdpi/error.png b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxhdpi/error.png Binary files differnew file mode 100644 index 000000000..019edf5c7 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxhdpi/error.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxhdpi/how_to.png b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxhdpi/how_to.png Binary files differnew file mode 100644 index 000000000..bae6374b6 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxhdpi/how_to.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxhdpi/icon_twine_card.png b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxhdpi/icon_twine_card.png Binary files differnew file mode 100644 index 000000000..e399b466b --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxhdpi/icon_twine_card.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxhdpi/icons_close.png b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxhdpi/icons_close.png Binary files differnew file mode 100644 index 000000000..91ba9167d --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxhdpi/icons_close.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxhdpi/icons_delete.png b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxhdpi/icons_delete.png Binary files differnew file mode 100644 index 000000000..8e54c739c --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxhdpi/icons_delete.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxhdpi/info.png b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxhdpi/info.png Binary files differnew file mode 100644 index 000000000..3727e7129 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxhdpi/info.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxhdpi/snapmatch.png b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxhdpi/snapmatch.png Binary files differnew file mode 100644 index 000000000..198fb9f6f --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxhdpi/snapmatch.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxhdpi/twine_card_icon.png b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxhdpi/twine_card_icon.png Binary files differnew file mode 100644 index 000000000..e8c54a75f --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxhdpi/twine_card_icon.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxxhdpi/about.png b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxxhdpi/about.png Binary files differnew file mode 100644 index 000000000..85234de5d --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxxhdpi/about.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxxhdpi/delete_thin.png b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxxhdpi/delete_thin.png Binary files differnew file mode 100644 index 000000000..33b633fcc --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxxhdpi/delete_thin.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxxhdpi/error.png b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxxhdpi/error.png Binary files differnew file mode 100644 index 000000000..f386b553d --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxxhdpi/error.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxxhdpi/how_to.png b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxxhdpi/how_to.png Binary files differnew file mode 100644 index 000000000..0569f95f7 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxxhdpi/how_to.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxxhdpi/icon_twine_card.png b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxxhdpi/icon_twine_card.png Binary files differnew file mode 100644 index 000000000..589cf908d --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxxhdpi/icon_twine_card.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxxhdpi/icons_close.png b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxxhdpi/icons_close.png Binary files differnew file mode 100644 index 000000000..f37a9bbbc --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxxhdpi/icons_close.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxxhdpi/icons_delete.png b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxxhdpi/icons_delete.png Binary files differnew file mode 100644 index 000000000..ccc594f43 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxxhdpi/icons_delete.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxxhdpi/info.png b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxxhdpi/info.png Binary files differnew file mode 100644 index 000000000..07af24775 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxxhdpi/info.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxxhdpi/snapmatch.png b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxxhdpi/snapmatch.png Binary files differnew file mode 100644 index 000000000..7bf802396 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxxhdpi/snapmatch.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxxhdpi/twine_card_icon.png b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxxhdpi/twine_card_icon.png Binary files differnew file mode 100644 index 000000000..e2b2bf09f --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxxhdpi/twine_card_icon.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/layout/activity_main.xml b/Software/Android_Studio/ColorCapture/app/src/main/res/layout/activity_main.xml index d2e2f89c1..7c55188cc 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/res/layout/activity_main.xml +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/layout/activity_main.xml @@ -6,6 +6,7 @@ <data> <import type="android.view.View" /> + <import type="com.twine.colorcapture.navigation.TabState"/> <variable name="vm" @@ -34,51 +35,46 @@ android:orientation="horizontal" android:visibility="visible"> - <com.twine.colorcapture.controls.ToggleImageButton + <ImageButton android:id="@+id/btnMenu" android:layout_width="68dp" android:layout_height="65dp" android:layout_alignParentStart="true" android:layout_centerVertical="true" android:layout_marginLeft="20dp" - android:background="@color/colorTransparent" - bind:normalImage="@drawable/more_normal" - bind:checkedImage="@drawable/more_selected" - bind:checked="@={vm.isMoreToggled}"/> + android:background="@drawable/button_transparent_fill_ripple" + android:src="@{vm.tabStateManager.state == TabState.More ? @drawable/more_selected : @drawable/more_normal}" /> <Space android:layout_width="0dp" android:layout_height="1dp" android:layout_weight="1" /> - <com.twine.colorcapture.controls.ToggleImageButton + <ImageButton android:id="@+id/imageButton2" - android:layout_width="68dp" + android:layout_width="72dp" android:layout_height="65dp" android:layout_alignParentStart="true" android:layout_centerVertical="true" - android:background="@color/colorTransparent" - bind:normalImage="@drawable/twinesnap_normal" - bind:checkedImage="@drawable/twinesnap_selected" - bind:checked="@={vm.isCaptureToggled}"/> + android:background="@drawable/button_transparent_fill_ripple" + android:src="@{vm.tabStateManager.state == TabState.Capture ? @drawable/twinesnap_selected : @drawable/twinesnap_normal}" + bind:command="@{vm.captureCommand}"/> <Space android:layout_width="0dp" android:layout_height="1dp" android:layout_weight="1" /> - <com.twine.colorcapture.controls.ToggleImageButton + <ImageButton android:id="@+id/imageButton3" android:layout_width="68dp" android:layout_height="65dp" android:layout_marginRight="20dp" android:layout_alignParentStart="true" android:layout_centerVertical="true" - android:background="@color/colorTransparent" - bind:normalImage="@drawable/my_colors" - bind:checkedImage="@drawable/selected" - bind:checked="@={vm.isMyColorsToggled}" - /> + android:background="@drawable/button_transparent_fill_ripple" + android:src="@{vm.tabStateManager.state == TabState.MyColors ? @drawable/selected : @drawable/my_colors}" + bind:command="@{vm.myColorsCommand}"/> </LinearLayout> <FrameLayout diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/layout/activity_send_to_email.xml b/Software/Android_Studio/ColorCapture/app/src/main/res/layout/activity_send_to_email.xml new file mode 100644 index 000000000..2e97be0b5 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/layout/activity_send_to_email.xml @@ -0,0 +1,66 @@ +<?xml version="1.0" encoding="utf-8"?> + +<layout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:bind="http://schemas.android.com/apk/res-auto" + xmlns:tools="http://schemas.android.com/tools"> + + <data> + + <variable + name="vm" + type="com.twine.colorcapture.views.sendtoemail.SendToEmailActivityVM" /> + </data> + + <RelativeLayout + android:layout_width="match_parent" + android:layout_height="match_parent" + android:layoutDirection="ltr" + tools:context="com.twine.colorcapture.views.sendtoemail.SendToEmailActivity"> + + <FrameLayout + android:id="@+id/frameTitle" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:padding="20dp" + android:background="@color/colorPrimaryBackground"> + + <android.support.v7.widget.AppCompatTextView + android:id="@+id/txtTitle" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="left|center" + android:fontFamily="@font/flexo_bold" + android:letterSpacing="0.07" + android:text="Share your color" + android:textSize="17.3sp" /> + + <android.support.v7.widget.AppCompatButton + android:id="@+id/btnDone" + android:background="@drawable/button_transparent_fill_ripple" + android:layout_gravity="right" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:textSize="17.3sp" + android:letterSpacing="0.07" + android:textStyle="bold" + android:text="Send" + android:layout_marginRight="-10dp" + android:fontFamily="@font/flexo_bold" + android:textAllCaps="false" + bind:command="@{vm.sendCommand}"/> + + </FrameLayout> + + <LinearLayout + android:layout_below="@id/frameTitle" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:orientation="vertical" + android:background="@color/white"> + + + + </LinearLayout> + + </RelativeLayout> +</layout> diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/layout/color_result_item.xml b/Software/Android_Studio/ColorCapture/app/src/main/res/layout/color_result_item.xml new file mode 100644 index 000000000..9be44f3da --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/layout/color_result_item.xml @@ -0,0 +1,135 @@ +<?xml version="1.0" encoding="utf-8"?> + +<layout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:bind="http://schemas.android.com/apk/res-auto" + xmlns:tools="http://schemas.android.com/tools"> + + <data> + + <variable + name="result" + type="com.twine.colorcapture.models.ColorResultVM" /> + </data> + + <FrameLayout + android:background="@drawable/list_view_selectable" + android:layout_width="match_parent" + android:layout_height="wrap_content"> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginTop="20dp" + android:orientation="vertical"> + + <RelativeLayout + android:layout_width="match_parent" + android:layout_height="wrap_content"> + + <LinearLayout + android:id="@+id/frame" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="horizontal"> + + <com.github.florent37.shapeofview.shapes.RoundRectView + android:id="@+id/resultRect" + android:layout_width="67dp" + android:layout_height="67dp" + bind:shape_roundRect_borderColor="@android:color/black" + bind:shape_roundRect_borderWidth="0dp" + bind:shape_roundRect_bottomLeftRadius="5dp" + bind:shape_roundRect_bottomRightRadius="5dp" + bind:shape_roundRect_topLeftRadius="5dp" + bind:shape_roundRect_topRightRadius="5dp"> + + + <FrameLayout + android:layout_width="match_parent" + android:layout_height="match_parent" + tools:background="@color/colorAccent" + android:background="@{result.result.detectionResponse.getProcessedColor().getColor()}" /> + + </com.github.florent37.shapeofview.shapes.RoundRectView> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="vertical" + android:padding="5dp"> + + <android.support.v7.widget.AppCompatTextView + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_gravity="center" + android:layout_marginTop="5dp" + android:fontFamily="@font/flexo_medium" + android:letterSpacing="0.07" + android:text="@{result.result.name}" + android:textSize="15.4sp" + tools:text="Nike 100" /> + + + <LinearLayout + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginTop="10dp" + android:orientation="horizontal"> + + <android.support.v7.widget.AppCompatTextView + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_gravity="center" + android:fontFamily="@font/flexo_light" + android:letterSpacing="0.07" + android:text="RGB:" + android:textSize="15.4sp" /> + + <android.support.v7.widget.AppCompatTextView + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_gravity="center" + android:fontFamily="@font/flexo_light" + android:letterSpacing="0.07" + android:layout_marginLeft="5dp" + android:text="@{result.result.detectionResponse.getProcessedColor().toString()}" + tools:text="200, 100, 0" + android:textSize="15.4sp" /> + </LinearLayout> + </LinearLayout> + </LinearLayout> + </RelativeLayout> + + <FrameLayout + android:layout_width="match_parent" + android:layout_height="2dp" + android:layout_marginLeft="2dp" + android:layout_marginTop="20dp" + android:layout_marginRight="2dp" + android:background="@color/white" /> + </LinearLayout> + + <FrameLayout + android:layout_width="40dp" + android:layout_height="40dp" + android:layout_gravity="right|center" + android:layout_marginRight="10dp" + android:layout_marginBottom="10dp"> + + <ImageView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center" + android:src="@drawable/delete_thin" /> + + <Button + android:layout_width="40dp" + android:layout_height="40dp" + android:focusable="false" + android:focusableInTouchMode="false" + bind:command="@{result.deleteCommand}" + android:background="@drawable/button_transparent_fill_ripple" /> + + </FrameLayout> + </FrameLayout> +</layout>
\ No newline at end of file diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/layout/dialog_confirm.xml b/Software/Android_Studio/ColorCapture/app/src/main/res/layout/dialog_confirm.xml new file mode 100644 index 000000000..1bad9d630 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/layout/dialog_confirm.xml @@ -0,0 +1,87 @@ +<layout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:bind="http://schemas.android.com/apk/res-auto" + xmlns:tools="http://schemas.android.com/tools"> + + <data> + + <variable + name="vm" + type="com.twine.colorcapture.dialogs.confirm.ConfirmDialogVM" /> + </data> + + <RelativeLayout + android:layout_width="match_parent" + android:layout_height="match_parent" + android:background="@color/colorBlueMask"> + + <RelativeLayout + android:layout_width="313.9dp" + android:layout_height="202.6dp" + android:layout_centerVertical="true" + android:layout_centerHorizontal="true" + android:elevation="10dp" + android:background="@drawable/border_primary_background"> + + <FrameLayout + android:layout_width="40dp" + android:layout_alignParentRight="true" + android:layout_height="40dp"> + + <ImageView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center" + android:src="@drawable/icons_close"/> + + <Button + android:layout_width="match_parent" + android:layout_height="match_parent" + bind:command="@{vm.closeCommand}" + android:background="@drawable/button_transparent_fill_ripple"/> + </FrameLayout> + + + <android.support.v7.widget.AppCompatTextView + android:id="@+id/txtTitle" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_centerHorizontal="true" + android:layout_marginTop="15dp" + android:fontFamily="@font/flexo_bold" + android:gravity="center" + android:letterSpacing="0.07" + android:textSize="13.4sp" + tools:text="Error title" + android:text="@{vm.title}" /> + + + <android.support.v7.widget.AppCompatTextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_below="@id/txtTitle" + android:layout_centerHorizontal="true" + android:layout_marginTop="20dp" + android:fontFamily="@font/flexo_light" + android:gravity="center" + android:letterSpacing="0.07" + android:textSize="13.4sp" + tools:text="Success message" + android:text="@{vm.message}"/> + + <com.twine.colorcapture.controls.CircleActionButton + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_alignParentBottom="true" + android:layout_marginLeft="20dp" + android:layout_marginRight="20dp" + android:layout_marginBottom="20dp" + bind:text="@{vm.confirmText}" + bind:command="@{vm.confirmCommand}" + tools:text="Delete" + bind:textSize="15.3sp" + bind:src="@drawable/icons_delete" + android:clickable="true" /> + + </RelativeLayout> + </RelativeLayout> +</layout> diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/layout/dialog_error.xml b/Software/Android_Studio/ColorCapture/app/src/main/res/layout/dialog_error.xml index bd8dad40c..eee19cd3b 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/res/layout/dialog_error.xml +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/layout/dialog_error.xml @@ -21,6 +21,24 @@ android:layout_centerHorizontal="true" android:background="@drawable/border_primary_background"> + <FrameLayout + android:layout_width="40dp" + android:layout_alignParentRight="true" + android:layout_height="40dp"> + + <ImageView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center" + android:src="@drawable/icons_close"/> + + <Button + android:layout_width="match_parent" + android:layout_height="match_parent" + bind:command="@{vm.closeCommand}" + android:background="@drawable/button_transparent_fill_ripple"/> + </FrameLayout> + <android.support.v7.widget.AppCompatTextView android:id="@+id/txtTitle" android:layout_width="wrap_content" diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/layout/dialog_success.xml b/Software/Android_Studio/ColorCapture/app/src/main/res/layout/dialog_success.xml index 5cba917ec..aa4fb6639 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/res/layout/dialog_success.xml +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/layout/dialog_success.xml @@ -21,6 +21,24 @@ android:layout_centerHorizontal="true" android:background="@drawable/border_primary_background"> + <FrameLayout + android:layout_width="40dp" + android:layout_alignParentRight="true" + android:layout_height="40dp"> + + <ImageView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center" + android:src="@drawable/icons_close"/> + + <Button + android:layout_width="match_parent" + android:layout_height="match_parent" + bind:command="@{vm.closeCommand}" + android:background="@drawable/button_transparent_fill_ripple"/> + </FrameLayout> + <android.support.v7.widget.AppCompatTextView android:id="@+id/txtTitle" android:layout_width="wrap_content" diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/layout/external_machine_item.xml b/Software/Android_Studio/ColorCapture/app/src/main/res/layout/external_machine_item.xml index 24b2c0f7e..585829bcb 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/res/layout/external_machine_item.xml +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/layout/external_machine_item.xml @@ -13,6 +13,7 @@ <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" + android:background="@drawable/list_view_selectable" android:orientation="horizontal"> <ImageView @@ -26,7 +27,6 @@ <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" - android:background="@drawable/list_view_selectable" android:orientation="vertical" android:padding="5dp"> diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/layout/fragment_mycolors.xml b/Software/Android_Studio/ColorCapture/app/src/main/res/layout/fragment_mycolors.xml index edc10f2ce..1fdcb2710 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/res/layout/fragment_mycolors.xml +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/layout/fragment_mycolors.xml @@ -13,30 +13,33 @@ android:layoutDirection="ltr" android:layout_width="match_parent" android:layout_height="match_parent" - android:paddingLeft="40dp" - android:paddingRight="40dp" + android:paddingLeft="20dp" + android:paddingRight="20dp" + android:background="@color/colorDarkBackground" tools:context="com.twine.colorcapture.views.mycolors.MyColorsFragment"> - <TextView - android:id="@+id/textView" + <android.support.v7.widget.AppCompatTextView + android:id="@+id/txtTitle" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_centerHorizontal="true" - android:layout_centerVertical="true" - android:text="My Colors" - android:textSize="30sp" - tools:text="My Colors" /> + android:layout_gravity="center" + android:layout_marginTop="20dp" + android:fontFamily="@font/flexo_bold" + android:letterSpacing="0.07" + android:text="My colors" + android:textSize="17.3sp" /> - <!--<Button--> - <!--android:id="@+id/btnStart"--> - <!--android:layout_width="150dp"--> - <!--android:layout_height="wrap_content"--> - <!--android:layout_alignParentBottom="true"--> - <!--android:layout_centerHorizontal="true"--> - <!--android:layout_marginBottom="36dp"--> - <!--android:text="Start"--> - <!--bind:command="@{vm.startCaptureCommand}" />--> + <ListView + android:id="@+id/listResults" + android:layout_marginTop="20dp" + android:layout_below="@id/txtTitle" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:choiceMode="none" + android:onItemClick="@{vm::onResultSelected}" + bind:itemBinding="@{vm.resultBinding}" + bind:items="@{vm.results}" /> </RelativeLayout> </layout> diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/layout/fragment_rename.xml b/Software/Android_Studio/ColorCapture/app/src/main/res/layout/fragment_rename.xml new file mode 100644 index 000000000..fb95f1c14 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/layout/fragment_rename.xml @@ -0,0 +1,83 @@ +<layout xmlns:tools="http://schemas.android.com/tools" + xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:bind="http://schemas.android.com/apk/res-auto"> + + <data> + <variable + name="vm" + type="com.twine.colorcapture.views.rename.RenameFragmentVM" /> + </data> + + <RelativeLayout + android:layoutDirection="ltr" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:paddingLeft="20dp" + android:paddingRight="20dp" + android:background="@color/colorDarkBackground" + tools:context="com.twine.colorcapture.views.rename.RenameFragment"> + + + <FrameLayout + android:id="@+id/frameTitle" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginTop="15dp"> + + <android.support.v7.widget.AppCompatTextView + android:id="@+id/txtTitlef" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:fontFamily="@font/flexo_bold" + android:letterSpacing="0.07" + android:layout_gravity="left|center" + android:text="Rename my color" + android:textSize="17.3sp" /> + + + <android.support.v7.widget.AppCompatButton + android:id="@+id/btnDone" + android:background="@drawable/button_transparent_fill_ripple" + android:layout_gravity="right" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:textSize="17.3sp" + android:letterSpacing="0.07" + android:textStyle="bold" + android:text="Done" + android:layout_marginRight="-10dp" + android:fontFamily="@font/flexo_bold" + android:textAllCaps="false" + bind:command="@{vm.renameCommand}"/> + </FrameLayout> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_below="@+id/frameTitle" + android:layout_marginTop="50dp" + android:orientation="vertical"> + + <android.support.v7.widget.AppCompatTextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:fontFamily="@font/flexo_light" + android:letterSpacing="0.07" + android:textSize="13.4sp" + android:text="Name this color as:" /> + + <android.support.v7.widget.AppCompatEditText + android:id="@+id/txtName" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginTop="5dp" + android:fontFamily="@font/flexo_light" + android:letterSpacing="0.07" + android:textSize="15.4sp" + android:textDirection="ltr" + android:text="@={vm.name}"/> + + </LinearLayout> + + </RelativeLayout> +</layout> diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/layout/fragment_result.xml b/Software/Android_Studio/ColorCapture/app/src/main/res/layout/fragment_result.xml index 1bf65d15b..90242ec30 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/res/layout/fragment_result.xml +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/layout/fragment_result.xml @@ -30,7 +30,7 @@ android:fontFamily="@font/flexo_bold" android:gravity="center" android:letterSpacing="0.07" - android:text="@string/my_color" + android:text="@{vm.colorResult.name}" android:textSize="17.3sp" /> <com.github.florent37.shapeofview.shapes.RoundRectView @@ -51,7 +51,7 @@ <FrameLayout android:layout_width="match_parent" android:layout_height="match_parent" - android:background="@{vm.detectionResponse.getProcessedColor().getColor()}"></FrameLayout> + android:background="@{vm.detectionResponse.getProcessedColor().getColor()}"/> </com.github.florent37.shapeofview.shapes.RoundRectView> diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/layout/side_menu.xml b/Software/Android_Studio/ColorCapture/app/src/main/res/layout/side_menu.xml index 9921a92a5..aa20bd3ef 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/res/layout/side_menu.xml +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/layout/side_menu.xml @@ -1,53 +1,180 @@ <?xml version="1.0" encoding="utf-8"?> -<layout xmlns:android="http://schemas.android.com/apk/res/android"> +<layout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:bind="http://schemas.android.com/apk/res-auto"> <data> + <variable name="vm" - type="com.twine.colorcapture.views.main.MainActivityVM"/> + type="com.twine.colorcapture.views.main.MainActivityVM" /> </data> - <RelativeLayout - xmlns:app="http://schemas.android.com/apk/res-auto" - android:layout_width="250dp" + <RelativeLayout xmlns:app="http://schemas.android.com/apk/res-auto" + android:layout_width="match_parent" android:layout_height="match_parent" android:layout_gravity="start" - android:background="#151515"> + android:background="@color/colorPrimaryBackground"> <LinearLayout android:id="@+id/linear" android:layout_width="match_parent" android:layout_height="wrap_content" - android:background="#303030" - android:gravity="center_vertical|start" - android:orientation="horizontal"> - - <ImageView - android:id="@+id/imageView" - android:layout_width="match_parent" - android:layout_height="150dp" - android:adjustViewBounds="true" - android:background="@color/colorPrimaryDark" - android:scaleType="fitXY" - android:src="@drawable/hand_phone" /> + android:orientation="vertical" + android:padding="20dp"> - <TextView - android:id="@+id/txtUserName" + <android.support.v7.widget.AppCompatTextView android:layout_width="wrap_content" android:layout_height="wrap_content" - android:textSize="24sp" /> + android:layout_gravity="center" + android:layout_marginTop="10dp" + android:fontFamily="@font/flexo_bold" + android:letterSpacing="0.07" + android:text="@string/app_name" + android:textSize="17.3sp" /> + + + <FrameLayout + android:layout_width="match_parent" + android:layout_marginTop="20dp" + android:layout_height="wrap_content"> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="vertical"> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="horizontal"> + + <ImageView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:src="@drawable/info" /> + + <android.support.v7.widget.AppCompatTextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center" + android:layout_marginLeft="15dp" + android:fontFamily="@font/flexo_medium" + android:letterSpacing="0.06" + android:text="About Twine" + android:textSize="15.4sp" /> + </LinearLayout> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="2dp" + android:layout_marginTop="20dp" + android:background="@drawable/accent_gradient" /> + + </LinearLayout> + + <Button + android:layout_width="match_parent" + android:layout_height="match_parent" + android:background="@drawable/button_transparent_fill_ripple"/> + </FrameLayout> + + <FrameLayout + android:layout_width="match_parent" + android:layout_marginTop="40dp" + android:layout_height="wrap_content"> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="vertical"> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="horizontal"> + + <ImageView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:src="@drawable/about" /> + + <android.support.v7.widget.AppCompatTextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center" + android:layout_marginLeft="15dp" + android:fontFamily="@font/flexo_medium" + android:letterSpacing="0.06" + android:text="About SnapMatch" + android:textSize="15.4sp" /> + </LinearLayout> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="2dp" + android:layout_marginTop="20dp" + android:background="@drawable/accent_gradient" /> + + </LinearLayout> + + <Button + android:layout_width="match_parent" + android:layout_height="match_parent" + android:background="@drawable/button_transparent_fill_ripple"/> + </FrameLayout> + + <FrameLayout + android:layout_width="match_parent" + android:layout_marginTop="40dp" + android:layout_height="60dp"> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="vertical"> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="horizontal"> + + <ImageView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:src="@drawable/how_to" /> + + <android.support.v7.widget.AppCompatTextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center" + android:layout_marginLeft="15dp" + android:fontFamily="@font/flexo_medium" + android:letterSpacing="0.06" + android:text="How to use" + android:textSize="15.4sp" /> + </LinearLayout> + + </LinearLayout> + + <Button + android:layout_width="match_parent" + android:layout_height="match_parent" + android:background="@drawable/button_transparent_fill_ripple" + bind:command="@{vm.howToUseCommand}"/> + </FrameLayout> + </LinearLayout> - <ListView - android:id="@+id/menuList" + <com.twine.colorcapture.controls.CircleActionButton android:layout_width="match_parent" - android:layout_height="match_parent" - android:listSelector="@android:color/transparent" - android:layout_alignParentStart="true" - android:layout_below="@+id/linear" - android:choiceMode="singleChoice" - android:background="@color/colorPrimaryDark" - android:padding="10dp" /> + android:layout_height="wrap_content" + android:layout_alignParentBottom="true" + android:layout_marginLeft="20dp" + android:layout_marginRight="20dp" + android:layout_marginBottom="60dp" + bind:text=" Get a twine TTCâ„¢ card" + bind:textSize="15.3sp" + bind:src="@drawable/icon_twine_card" + android:clickable="true" /> </RelativeLayout> </layout>
\ No newline at end of file diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/mipmap-hdpi/ic_launcher.png b/Software/Android_Studio/ColorCapture/app/src/main/res/mipmap-hdpi/ic_launcher.png Binary files differindex 898f3ed59..d0bba595f 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/res/mipmap-hdpi/ic_launcher.png +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/mipmap-hdpi/ic_launcher.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/mipmap-hdpi/ic_launcher_round.png b/Software/Android_Studio/ColorCapture/app/src/main/res/mipmap-hdpi/ic_launcher_round.png Binary files differindex dffca3601..698bb5a95 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/res/mipmap-hdpi/ic_launcher_round.png +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/mipmap-hdpi/ic_launcher_round.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/mipmap-mdpi/ic_launcher.png b/Software/Android_Studio/ColorCapture/app/src/main/res/mipmap-mdpi/ic_launcher.png Binary files differindex 64ba76f75..346b6e1b9 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/res/mipmap-mdpi/ic_launcher.png +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/mipmap-mdpi/ic_launcher.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/mipmap-mdpi/ic_launcher_round.png b/Software/Android_Studio/ColorCapture/app/src/main/res/mipmap-mdpi/ic_launcher_round.png Binary files differindex dae5e0823..b4a48b906 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/res/mipmap-mdpi/ic_launcher_round.png +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/mipmap-mdpi/ic_launcher_round.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/Software/Android_Studio/ColorCapture/app/src/main/res/mipmap-xhdpi/ic_launcher.png Binary files differindex e5ed46597..ea6b05b48 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/res/mipmap-xhdpi/ic_launcher.png +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/mipmap-xhdpi/ic_launcher.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/Software/Android_Studio/ColorCapture/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png Binary files differindex 14ed0af35..9bc8d9af9 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/Software/Android_Studio/ColorCapture/app/src/main/res/mipmap-xxhdpi/ic_launcher.png Binary files differindex b0907cac3..547f0e8e3 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/mipmap-xxhdpi/ic_launcher.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/Software/Android_Studio/ColorCapture/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png Binary files differindex d8ae03154..157ded94b 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/Software/Android_Studio/ColorCapture/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png Binary files differindex 2c18de9e6..a678fba65 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/Software/Android_Studio/ColorCapture/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png Binary files differindex beed3cdd2..e31967651 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/values/strings.xml b/Software/Android_Studio/ColorCapture/app/src/main/res/values/strings.xml index fe1ec6d7c..ebb9cfd4c 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/res/values/strings.xml +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/values/strings.xml @@ -1,5 +1,5 @@ <resources> - <string name="app_name">Color Capture</string> + <string name="app_name">SnapMatch</string> <!-- TODO: Remove or change this placeholder text --> <string name="hello_blank_fragment">Hello blank fragment</string> diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/values/styles.xml b/Software/Android_Studio/ColorCapture/app/src/main/res/values/styles.xml index cbf34a8c3..aaf895d46 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/res/values/styles.xml +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/values/styles.xml @@ -26,6 +26,7 @@ <declare-styleable name="CircleActionButton"> <attr name="text" format="string" /> + <attr name="textSize" format="dimension" /> <attr name="src" format="reference" /> </declare-styleable> |
