Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added minor UI fixes #34

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1302,25 +1302,14 @@ private void displayQualityResult (boolean[] isCorrectPosSize, boolean isBlur, b
}

mImageQualityFeedbackView.setText(Html.fromHtml(message));
if (isCorrectPosSize[0] && isCorrectPosSize[1] && isCorrectPosSize[2] && !isBlur && !isOverExposed && !isUnderExposed && !isShadow) {
if (mViewport.getBackgroundColorId() != R.color.green_overlay) {
mViewport.setBackgroundColoId(R.color.green_overlay);
}
} else {
if (mViewport.getBackgroundColorId() != R.color.red_overlay) {
mViewport.setBackgroundColoId(R.color.red_overlay);
}
}
} else if (currFocusState == FocusState.INACTIVE) {
mInstructionText.setText(getResources().getString(R.string.instruction_pos));
mViewport.setBackgroundColoId(R.color.red_overlay);
} else if (currFocusState == FocusState.UNFOCUSED) {
mInstructionText.setText(getResources().getString(R.string.instruction_unfocused));
mViewport.setBackgroundColoId(R.color.red_overlay);
} else if (currFocusState == FocusState.FOCUSING) {
mInstructionText.setText(getResources().getString(R.string.instruction_focusing));
mViewport.setBackgroundColoId(R.color.red_overlay);
}
mViewport.setBackgroundColoId(R.color.black_overlay);
}


Expand Down
16 changes: 16 additions & 0 deletions app/src/main/res/drawable/rounded_button.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2019 University of Washington Ubicomp Lab
~ All rights reserved.
~
~ This software may be modified and distributed under the terms
~ of a BSD-style license that can be found in the LICENSE file.
-->

<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="150dp"></corners>
<solid android:color="@color/colorPrimaryDark" />

</shape>
14 changes: 7 additions & 7 deletions app/src/main/res/layout/activity_image_quality_opencv.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@
style="?android:attr/progressBarStyle"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:layout_marginBottom="8dp"
android:indeterminate="true"
android:visibility="visible"
android:visibility="invisible"
app:layout_constraintBottom_toBottomOf="@+id/img_quality_check_viewport"
app:layout_constraintEnd_toEndOf="@+id/img_quality_check_viewport"
app:layout_constraintStart_toStartOf="@+id/img_quality_check_viewport"
Expand All @@ -71,9 +71,9 @@
android:id="@+id/progressText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:text="@string/progress_initialization"
android:textAlignment="center"
android:textAppearance="@android:style/TextAppearance.Material.Medium"
Expand Down Expand Up @@ -106,10 +106,10 @@
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:layout_marginBottom="8dp"
android:background="@drawable/circular_shape"
android:indeterminate="false"
android:max="10"
Expand All @@ -120,6 +120,6 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:visibility="visible" />
tools:visibility="invisible" />

</android.support.constraint.ConstraintLayout>
4 changes: 4 additions & 0 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
android:layout_marginTop="16dp"
android:text="@string/exp_date_check"
android:theme="@style/PrimaryButton"
android:background="@drawable/rounded_button"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
Expand All @@ -28,6 +29,7 @@
android:layout_marginTop="8dp"
android:text="@string/image_quality"
android:theme="@style/PrimaryButton"
android:background="@drawable/rounded_button"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/expdateButton" />
Expand All @@ -41,6 +43,7 @@
android:layout_marginStart="8dp"
android:text="@string/settings"
android:theme="@style/PrimaryButton"
android:background="@drawable/rounded_button"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
Expand All @@ -54,6 +57,7 @@
android:layout_marginTop="8dp"
android:text="Test Camera2"
android:theme="@style/PrimaryButton"
android:background="@drawable/rounded_button"
android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<color name="transparent_overlay">#00000000</color>
<color name="gray_overlay">#33000000</color>
<color name="red_overlay">#66FF0000</color>
<color name="green_overlay">#6600FF00</color>
<color name="green_overlay">#662ead2e</color>

<color name="control_background">#cc4285f4</color>
</resources>
14 changes: 7 additions & 7 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@
<string name="title_activity_camera2_test">Camera2TestActivity</string>
<string name="progress_initialization">Stay still…</string>
<string name="progress_final">Captured! Analyzing the image…</string>
<string name="instruction">Place the RDT inside the rectangle.</string>
<string name="instruction">Fit RDT in the rectangle. Hold still...</string>
<string name="instruction_detected"><![CDATA[RDT detected at the center!]]></string>
<string name="instruction_pos"><![CDATA[Place RDT at the center.\nFit RDT to the rectangle.]]></string>
<string name="instruction_too_small"><![CDATA[Place RDT at the center.\nFit RDT to the rectangle.\nMove closer.]]></string>
<string name="instruction_too_large"><![CDATA[Place RDT at the center.\nFit RDT to the rectangle.\nMove further away.]]></string>
<string name="instruction_focusing"><![CDATA[Place RDT at the center.\nFit RDT to the rectangle.\nCamera is focusing. \nStay still.]]></string>
<string name="instruction_unfocused"><![CDATA[Place RDT at the center.\n Fit RDT to the rectangle.\nCamera is not focused. \nMove further away.]]></string>
<string name="over_exposed_msg">TOO BRIGHT </string>
<string name="under_exposed_msg">TOO DARK </string>
<string name="quality_msg_format"> <![CDATA[POSITION/SIZE: %s <br> SHARPNESS: %s <br> BRIGHTNESS: %s <br> NO SHADOW: %s]]></string>
<string name="exp_date_undetected"><![CDATA[EXP DATE NOT DETECTED.\n ]]></string>
<string name="exp_date_expired"><![CDATA[EXPIRED!\n DO NOT USE THIS RDT! ]]></string>
<string name="exp_date_valid"><![CDATA[VALID!\n YOU CAN USE THIS RDT. ]]></string>
<string name="over_exposed_msg">Too bright </string>
<string name="under_exposed_msg">Too dark </string>
<string name="quality_msg_format"> <![CDATA[%s Position/size <br> %s Sharpness <br> %s Brightness <br> %s No shadow]]></string>
<string name="exp_date_undetected"><![CDATA[Exp date not detected.\n ]]></string>
<string name="exp_date_expired"><![CDATA[Expired!\n Do not use this RDT! ]]></string>
<string name="exp_date_valid"><![CDATA[Valid!\n You can use this RDT. ]]></string>
<string name="settings_strict">Strict</string>
<string name="settings_loose">Loose</string>
<string name="exp_date_check">Expiration Date</string>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<resources>

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.2'
classpath 'com.android.tools.build:gradle:3.2.1'


// NOTE: Do not place your application dependencies here; they belong
Expand Down
2 changes: 1 addition & 1 deletion openCVLibrary341/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apply plugin: 'com.android.library'

android {
compileSdkVersion 21
buildToolsVersion "26.0.2"
buildToolsVersion '28.0.3'

defaultConfig {
minSdkVersion 8
Expand Down
2 changes: 1 addition & 1 deletion openCVLibrary341/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
android:versionCode="3410"
android:versionName="3.4.1">

<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="21" />
<uses-sdk android:targetSdkVersion="21" />
</manifest>