Dodaj okno szczegółów produktu, layout jeszcze nie skończony
This commit is contained in:
parent
59a9b3d788
commit
049f2dcdb4
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectType">
|
<component name="ProjectType">
|
||||||
|
@ -14,7 +14,8 @@
|
|||||||
android:roundIcon="@mipmap/ic_launcher_round"
|
android:roundIcon="@mipmap/ic_launcher_round"
|
||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
android:theme="@style/AppTheme">
|
android:theme="@style/AppTheme">
|
||||||
<activity android:name=".Results"></activity>
|
<activity android:name=".Popup"></activity>
|
||||||
|
<activity android:name=".Results" />
|
||||||
<activity android:name=".ProductsAdapter" />
|
<activity android:name=".ProductsAdapter" />
|
||||||
<activity android:name=".Product" />
|
<activity android:name=".Product" />
|
||||||
<activity android:name=".DecodeFail" />
|
<activity android:name=".DecodeFail" />
|
||||||
|
@ -11,11 +11,11 @@ import androidx.core.content.ContextCompat;
|
|||||||
|
|
||||||
public class MainActivity extends AppCompatActivity {
|
public class MainActivity extends AppCompatActivity {
|
||||||
|
|
||||||
private Button button_scan;
|
Button button_scan;
|
||||||
private Button button_help;
|
Button button_help;
|
||||||
private Button button_about;
|
Button button_about;
|
||||||
|
|
||||||
private Button button_results;
|
Button button_results;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
51
Lookify/app/src/main/java/com/example/lookifyv2/Popup.java
Normal file
51
Lookify/app/src/main/java/com/example/lookifyv2/Popup.java
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
package com.example.lookifyv2;
|
||||||
|
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.text.Html;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.TextView;
|
||||||
|
import com.bumptech.glide.Glide;
|
||||||
|
|
||||||
|
public class Popup extends AppCompatActivity {
|
||||||
|
|
||||||
|
Button button_back;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_popup);
|
||||||
|
|
||||||
|
ImageView productImage = findViewById(R.id.productimagedet);
|
||||||
|
TextView productCode = findViewById(R.id.productcodedet);
|
||||||
|
TextView productName = findViewById(R.id.productnamedet);
|
||||||
|
TextView productPrice = findViewById(R.id.productpricedet);
|
||||||
|
TextView productRetailer = findViewById(R.id.productretailerdet);
|
||||||
|
TextView productColour = findViewById(R.id.productcolourdet);
|
||||||
|
TextView productStyle = findViewById(R.id.productstyledet);
|
||||||
|
TextView productCollection = findViewById(R.id.productcollectiondet);
|
||||||
|
|
||||||
|
Bundle bundle = this.getIntent().getExtras();
|
||||||
|
|
||||||
|
Glide.with(this).load((String) bundle.getSerializable("productimage")).into(productImage);
|
||||||
|
|
||||||
|
productCode.setText(Html.fromHtml("<b>" + "Kod produktu:" + "</b> " + bundle.getSerializable("productcode")));
|
||||||
|
productName.setText(Html.fromHtml("<b>" + "Nazwa produktu:" + "</b> " + bundle.getSerializable("productname")));
|
||||||
|
productPrice.setText(Html.fromHtml("<b>" + "Cena:" + "</b> " + bundle.getSerializable("productprice")));
|
||||||
|
productRetailer.setText(Html.fromHtml("<b>" + "Producent:" + "</b> " + bundle.getSerializable("productretailer")));
|
||||||
|
productColour.setText(Html.fromHtml("<b>" + "Kolor:" + "</b> " + bundle.getSerializable("productcolour")));
|
||||||
|
productStyle.setText(Html.fromHtml("<b>" + "Styl:" + "</b> " + bundle.getSerializable("productstyle")));
|
||||||
|
productCollection.setText(Html.fromHtml("<b>" + "Kolekcja:" + "</b> " + bundle.getSerializable("productcollection")));
|
||||||
|
|
||||||
|
button_back = findViewById(R.id.back_button);
|
||||||
|
|
||||||
|
button_back.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
@ -2,6 +2,7 @@ package com.example.lookifyv2;
|
|||||||
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
@ -93,9 +94,27 @@ public class ProductsAdapter extends RecyclerView.Adapter<ProductsAdapter.ViewHo
|
|||||||
public boolean onMenuItemClick(MenuItem menuItem) {
|
public boolean onMenuItemClick(MenuItem menuItem) {
|
||||||
switch (menuItem.getItemId()) {
|
switch (menuItem.getItemId()) {
|
||||||
case R.id.action_favourite:
|
case R.id.action_favourite:
|
||||||
Toast.makeText(context, "Produkt \"" + products.get(pos).getproductName() + "\" został dodany do ulubionych",
|
Toast.makeText(context, "Produkt \"" + products.get(pos).getproductName() + "\" został dodany do obserwowanych",
|
||||||
Toast.LENGTH_SHORT).show();
|
Toast.LENGTH_SHORT).show();
|
||||||
return true;
|
return true;
|
||||||
|
case R.id.action_details:
|
||||||
|
Intent intent_Popup = new Intent(context, Popup.class).setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
|
|
||||||
|
Bundle bundle = new Bundle();
|
||||||
|
|
||||||
|
bundle.putSerializable("productimage", products.get(pos).getImageLink());
|
||||||
|
bundle.putSerializable("productcode", products.get(pos).getproductCode());
|
||||||
|
bundle.putSerializable("productname", products.get(pos).getproductName());
|
||||||
|
bundle.putSerializable("productprice", products.get(pos).getproductPrice());
|
||||||
|
bundle.putSerializable("productretailer", products.get(pos).getproductRetailer());
|
||||||
|
bundle.putSerializable("productcolour", products.get(pos).getproductColour());
|
||||||
|
bundle.putSerializable("productstyle", products.get(pos).getproductStyle());
|
||||||
|
bundle.putSerializable("productcollection", products.get(pos).getproductCollection());
|
||||||
|
|
||||||
|
intent_Popup.putExtras(bundle);
|
||||||
|
|
||||||
|
context.startActivity(intent_Popup);
|
||||||
|
return true;
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -36,11 +36,11 @@ public class TakePhoto extends AppCompatActivity {
|
|||||||
//Jeśli moduł kamery zostanie zamknięty zanim zrobione zostanie zdjęcie to activity skanowania się kończy, w innym razie przechodzi dalej
|
//Jeśli moduł kamery zostanie zamknięty zanim zrobione zostanie zdjęcie to activity skanowania się kończy, w innym razie przechodzi dalej
|
||||||
@Override
|
@Override
|
||||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||||
|
super.onActivityResult(requestCode, resultCode, data); //??????????????
|
||||||
if (requestCode == 100) {
|
if (requestCode == 100) {
|
||||||
if (resultCode == RESULT_CANCELED) {
|
if (resultCode == RESULT_CANCELED) {
|
||||||
finish();
|
finish();
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
goDecode();
|
goDecode();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
114
Lookify/app/src/main/res/layout/activity_popup.xml
Normal file
114
Lookify/app/src/main/res/layout/activity_popup.xml
Normal file
@ -0,0 +1,114 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
tools:context=".MainActivity">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/productimagedet"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="300dp"
|
||||||
|
android:scaleType="fitCenter" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/productnamedet"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="16dp"
|
||||||
|
android:layout_marginLeft="16dp"
|
||||||
|
android:paddingLeft="5dp"
|
||||||
|
android:paddingTop="5dp"
|
||||||
|
android:paddingRight="5dp"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
tools:layout_editor_absoluteY="312dp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/productpricedet"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingLeft="5dp"
|
||||||
|
android:paddingTop="5dp"
|
||||||
|
android:paddingRight="5dp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintVertical_bias="0.681"
|
||||||
|
tools:layout_editor_absoluteX="74dp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/productretailerdet"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingLeft="5dp"
|
||||||
|
android:paddingTop="5dp"
|
||||||
|
android:paddingRight="5dp"
|
||||||
|
tools:layout_editor_absoluteX="56dp"
|
||||||
|
tools:layout_editor_absoluteY="398dp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/productcolourdet"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingLeft="5dp"
|
||||||
|
android:paddingTop="5dp"
|
||||||
|
android:paddingRight="5dp"
|
||||||
|
tools:layout_editor_absoluteX="84dp"
|
||||||
|
tools:layout_editor_absoluteY="435dp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/productstyledet"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingLeft="5dp"
|
||||||
|
android:paddingTop="5dp"
|
||||||
|
android:paddingRight="5dp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintVertical_bias="0.596"
|
||||||
|
tools:layout_editor_absoluteX="118dp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/productcollectiondet"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingLeft="5dp"
|
||||||
|
android:paddingTop="5dp"
|
||||||
|
android:paddingRight="5dp"
|
||||||
|
tools:layout_editor_absoluteX="128dp"
|
||||||
|
tools:layout_editor_absoluteY="530dp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/productcodedet"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingLeft="5dp"
|
||||||
|
android:paddingTop="5dp"
|
||||||
|
android:paddingRight="5dp"
|
||||||
|
tools:layout_editor_absoluteX="128dp"
|
||||||
|
tools:layout_editor_absoluteY="611dp" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/back_button"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="bottom|end"
|
||||||
|
android:paddingLeft="5dp"
|
||||||
|
android:paddingTop="5dp"
|
||||||
|
android:paddingRight="5dp"
|
||||||
|
android:text="Zamknij"
|
||||||
|
tools:layout_editor_absoluteX="203dp"
|
||||||
|
tools:layout_editor_absoluteY="506dp" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_width="350dp"
|
||||||
|
android:layout_height="475dp"
|
||||||
|
android:padding="5dp"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
-->
|
@ -3,5 +3,8 @@ xmlns:app="http://schemas.android.com/apk/res-auto"
|
|||||||
xmlns:tools="http://schemas.android.com/tools">
|
xmlns:tools="http://schemas.android.com/tools">
|
||||||
<item
|
<item
|
||||||
android:id="@+id/action_favourite"
|
android:id="@+id/action_favourite"
|
||||||
android:title="Dodaj do ulubionych" />
|
android:title="Dodaj do obserwowanych" />
|
||||||
|
<item
|
||||||
|
android:id="@+id/action_details"
|
||||||
|
android:title="Szczegóły" />
|
||||||
</menu>
|
</menu>
|
Loading…
Reference in New Issue
Block a user