diff --git a/Lookify/app/src/main/AndroidManifest.xml b/Lookify/app/src/main/AndroidManifest.xml
index 66b9a31..8638220 100644
--- a/Lookify/app/src/main/AndroidManifest.xml
+++ b/Lookify/app/src/main/AndroidManifest.xml
@@ -15,7 +15,8 @@
android:supportsRtl="true"
android:theme="@style/AppTheme">
-
+
diff --git a/Lookify/app/src/main/java/com/example/lookifyv2/Decode.java b/Lookify/app/src/main/java/com/example/lookifyv2/Decode.java
index c476da1..9a92403 100644
--- a/Lookify/app/src/main/java/com/example/lookifyv2/Decode.java
+++ b/Lookify/app/src/main/java/com/example/lookifyv2/Decode.java
@@ -118,6 +118,7 @@ public class Decode extends AppCompatActivity {
hints.put(DecodeHintType.POSSIBLE_FORMATS, formats);
hints.put(DecodeHintType.TRY_HARDER, true);
+ int reminder = 0;
//Szukanie kodu na wczytanym zdjęciu
MultiFormatReader reader = new MultiFormatReader();
String contents = null;
@@ -125,13 +126,18 @@ public class Decode extends AppCompatActivity {
Result result = reader.decode(bitmap, hints);
contents = result.getText();
} catch (NotFoundException e) {
+ reminder = -1;
e.printStackTrace();
Intent intent_DecodeFail = new Intent(this, DecodeFail.class);
startActivity(intent_DecodeFail);
- Decode.this.finish();
+ finish();
+ }
+ if(reminder == 0) {
+ Intent intent_Results = new Intent(this, Results.class);
+ intent_Results.putExtra("decodedcode", contents);
+ startActivity(intent_Results);
+ finish();
}
- Toast toast = Toast.makeText(this, contents, Toast.LENGTH_LONG);
- toast.show();
}
//Druga część potrzebna do ładowania OpenCV w odpowiednim momencie
diff --git a/Lookify/app/src/main/java/com/example/lookifyv2/Results.java b/Lookify/app/src/main/java/com/example/lookifyv2/Results.java
index 9bd2867..debf901 100644
--- a/Lookify/app/src/main/java/com/example/lookifyv2/Results.java
+++ b/Lookify/app/src/main/java/com/example/lookifyv2/Results.java
@@ -3,6 +3,7 @@ package com.example.lookifyv2;
import androidx.appcompat.app.AppCompatActivity;
import android.annotation.SuppressLint;
+import android.content.Intent;
import android.os.Bundle;
import android.os.AsyncTask;
@@ -31,6 +32,7 @@ public class Results extends AppCompatActivity {
private RecyclerView recyclerView;
private GridLayoutManager gridLayout;
private ProductsAdapter adapter;
+ String decodedCode;
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -41,6 +43,24 @@ public class Results extends AppCompatActivity {
products = new ArrayList<>();
getProductsFromDB(0);
+ Bundle extras = getIntent().getExtras();
+ decodedCode = extras.getString("decodedcode");
+
+ int foundPosition = -1;
+ for(int i = 0; i < products.size(); i++){
+ if(decodedCode.equals(products.get(i).getproductCode())){
+ foundPosition = i;
+ break;
+ }
+ }
+ if(foundPosition == -1){
+ Intent intent_DecodeFail = new Intent(this, DecodeFail.class);
+ startActivity(intent_DecodeFail);
+ finish();
+ }
+
+
+
gridLayout = new GridLayoutManager(this, 2);
recyclerView.setLayoutManager(gridLayout);
diff --git a/Lookify/app/src/main/res/layout/activity_popup.xml b/Lookify/app/src/main/res/layout/activity_popup.xml
index 218bc9f..bf75c5a 100644
--- a/Lookify/app/src/main/res/layout/activity_popup.xml
+++ b/Lookify/app/src/main/res/layout/activity_popup.xml
@@ -10,97 +10,114 @@
android:id="@+id/productimagedet"
android:layout_width="match_parent"
android:layout_height="300dp"
- android:scaleType="fitCenter" />
+ android:scaleType="fitCenter"
+ app:layout_constraintBottom_toTopOf="@+id/productnamedet"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent" />
+ app:layout_constraintTop_toBottomOf="@+id/productimagedet" />
+ android:layout_marginStart="8dp"
+ android:layout_marginLeft="8dp"
+ android:layout_marginTop="8dp"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintHorizontal_bias="0.0"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@+id/productnamedet" />
+ android:layout_marginStart="8dp"
+ android:layout_marginLeft="8dp"
+ android:layout_marginTop="8dp"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintHorizontal_bias="0.0"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@+id/productpricedet" />
+ android:layout_marginStart="8dp"
+ android:layout_marginLeft="8dp"
+ android:layout_marginTop="8dp"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintHorizontal_bias="0.0"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@+id/productretailerdet" />
+ android:layout_marginStart="8dp"
+ android:layout_marginLeft="8dp"
+ android:layout_marginTop="8dp"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintHorizontal_bias="0.0"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@+id/productcolourdet" />
+ android:layout_marginStart="8dp"
+ android:layout_marginLeft="8dp"
+ android:layout_marginTop="8dp"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintHorizontal_bias="0.0"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@+id/productstyledet" />
+ android:layout_marginStart="8dp"
+ android:layout_marginLeft="8dp"
+ android:layout_marginTop="8dp"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintHorizontal_bias="0.0"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@+id/productcollectiondet"
+ app:layout_constraintVertical_bias="0.0" />
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintHorizontal_bias="1.0"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintVertical_bias="1.0" />
-
+
\ No newline at end of file
diff --git a/Lookify/app/src/main/res/values/styles.xml b/Lookify/app/src/main/res/values/styles.xml
index 5885930..fb70615 100644
--- a/Lookify/app/src/main/res/values/styles.xml
+++ b/Lookify/app/src/main/res/values/styles.xml
@@ -8,4 +8,11 @@
- @color/colorAccent
+
+