mirror of
https://github.com/Nezumi-2711/Foodify.git
synced 2026-09-22 20:00:50 +00:00
Add product detail screen
This commit is contained in:
+3
-3
@@ -26,6 +26,8 @@ android {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
dependencies {
|
||||
@@ -44,13 +46,11 @@ dependencies {
|
||||
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
|
||||
|
||||
implementation 'com.github.denzcoskun:ImageSlideshow:0.1.0'
|
||||
|
||||
implementation 'com.makeramen:roundedimageview:2.3.0'
|
||||
implementation 'com.github.smarteist:autoimageslider:1.4.0'
|
||||
implementation 'com.github.bumptech.glide:glide:4.14.2'
|
||||
annotationProcessor 'com.github.bumptech.glide:compiler:4.14.2'
|
||||
|
||||
implementation "com.github.kojofosu:Quantitizer:1.6.7"
|
||||
implementation 'com.squareup.picasso:picasso:2.71828'
|
||||
|
||||
implementation "com.paulrybitskyi.persistentsearchview:persistentsearchview:1.1.4"
|
||||
}
|
||||
@@ -7,31 +7,31 @@
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:dataExtractionRules="@xml/data_extraction_rules"
|
||||
android:enableOnBackInvokedCallback="true"
|
||||
android:fullBackupContent="@xml/backup_rules"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:enableOnBackInvokedCallback="true"
|
||||
android:label="@string/app_name"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/Theme.Foodify"
|
||||
tools:targetApi="31">
|
||||
<activity
|
||||
android:name=".Activity.FoodDetailActivity"
|
||||
android:exported="false" />
|
||||
<activity
|
||||
android:name=".Activity.ResetPasswordActivity"
|
||||
android:exported="false"
|
||||
android:noHistory="true"
|
||||
/>
|
||||
android:noHistory="true" />
|
||||
<activity
|
||||
android:name=".Activity.SendEmailActivity"
|
||||
android:exported="false"
|
||||
android:noHistory="true"
|
||||
/>
|
||||
android:noHistory="true" />
|
||||
<activity
|
||||
android:name=".Activity.ForgotPasswordActivity"
|
||||
android:exported="false"
|
||||
android:noHistory="true"
|
||||
/>
|
||||
android:noHistory="true" />
|
||||
<activity
|
||||
android:name=".Activity.SignInActivity"
|
||||
android:exported="false"/>
|
||||
android:exported="false" />
|
||||
<activity
|
||||
android:name=".Activity.SignUpActivity"
|
||||
android:exported="false"
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.capstone.foodify.Activity;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import com.capstone.foodify.R;
|
||||
import com.denzcoskun.imageslider.ImageSlider;
|
||||
import com.denzcoskun.imageslider.constants.ScaleTypes;
|
||||
import com.denzcoskun.imageslider.models.SlideModel;
|
||||
import com.mcdev.quantitizerlibrary.AnimationStyle;
|
||||
import com.mcdev.quantitizerlibrary.HorizontalQuantitizer;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class FoodDetailActivity extends AppCompatActivity {
|
||||
|
||||
HorizontalQuantitizer horizontalQuantitizer;
|
||||
ImageSlider imageSlider;
|
||||
ImageView back_image;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_food_detail);
|
||||
|
||||
//Init Component
|
||||
horizontalQuantitizer = findViewById(R.id.quantity_option);
|
||||
imageSlider = findViewById(R.id.slider);
|
||||
back_image = findViewById(R.id.back_image);
|
||||
|
||||
horizontalQuantitizer.setTextAnimationStyle(AnimationStyle.SLIDE_IN_REVERSE);
|
||||
horizontalQuantitizer.setPlusIconBackgroundColor(R.color.white);
|
||||
horizontalQuantitizer.setMinusIconBackgroundColor(R.color.white);
|
||||
|
||||
List<SlideModel> slideModels = new ArrayList<>();
|
||||
slideModels.add(new SlideModel("https://firebasestorage.googleapis.com/v0/b/foodify-55954.appspot.com/o/basil-minced-pork-with-rice-fried-egg.jpg?alt=media&token=838ea008-5525-44fb-a5b0-cf77877184a8", null));
|
||||
slideModels.add(new SlideModel("https://firebasestorage.googleapis.com/v0/b/foodify-55954.appspot.com/o/delicious-vietnamese-food-including-pho-ga-noodles-spring-rolls-white-table.jpg?alt=media&token=c19919c7-f69d-4933-b955-3fa627e411a0", null));
|
||||
slideModels.add(new SlideModel("https://firebasestorage.googleapis.com/v0/b/foodify-55954.appspot.com/o/fried-spring-rolls-cutting-board.jpg?alt=media&token=a2f64b21-578c-427f-bbc8-767280ee82e0", null));
|
||||
slideModels.add(new SlideModel("https://firebasestorage.googleapis.com/v0/b/foodify-55954.appspot.com/o/pieces-chicken-fillet-with-mushrooms-stewed-tomato-sauce-with-boiled-broccoli-rice-proper-nutrition-healthy-lifestyle-dietetic-menu-top-view.jpg?alt=media&token=deded3b6-db7b-4a8d-9720-66ddef916d6f", null));
|
||||
slideModels.add(new SlideModel("https://firebasestorage.googleapis.com/v0/b/foodify-55954.appspot.com/o/top-view-fresh-delicious-vietnamese-food-table.jpg?alt=media&token=eec8a996-2a12-4b47-b369-8d4d1e91b20a", null));
|
||||
|
||||
imageSlider.setImageList(slideModels, ScaleTypes.FIT);
|
||||
|
||||
back_image.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
onBackPressed();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.capstone.foodify.Model.Food;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.text.Layout;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
@@ -11,6 +12,7 @@ import android.widget.TextView;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.capstone.foodify.Activity.FoodDetailActivity;
|
||||
import com.capstone.foodify.R;
|
||||
import com.squareup.picasso.Picasso;
|
||||
|
||||
@@ -35,6 +37,15 @@ public class FoodAdapter extends RecyclerView.Adapter<FoodAdapter.FoodViewHolder
|
||||
@Override
|
||||
public FoodViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_foods, parent, false);
|
||||
|
||||
view.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
Intent intent = new Intent(parent.getContext(), FoodDetailActivity.class);
|
||||
parent.getContext().startActivity(intent);
|
||||
}
|
||||
});
|
||||
|
||||
return new FoodViewHolder(view);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval"
|
||||
>
|
||||
<solid android:color="@color/white"/>
|
||||
|
||||
</shape>
|
||||
@@ -0,0 +1,218 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout 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=".Activity.FoodDetailActivity">
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:id="@+id/app_bar_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
|
||||
>
|
||||
|
||||
<com.google.android.material.appbar.CollapsingToolbarLayout
|
||||
android:id="@+id/collapsing"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="250dp"
|
||||
android:fitsSystemWindows="true"
|
||||
app:layout_scrollFlags="scroll|exitUntilCollapsed"
|
||||
app:contentScrim="#0e0d0e"
|
||||
>
|
||||
|
||||
<com.denzcoskun.imageslider.ImageSlider
|
||||
android:id="@+id/slider"
|
||||
app:iss_auto_cycle="true"
|
||||
app:iss_delay="0"
|
||||
app:iss_period="3000"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
/>
|
||||
</com.google.android.material.appbar.CollapsingToolbarLayout>
|
||||
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/back_image"
|
||||
android:layout_width="28dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/back_button"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginTop="25dp"
|
||||
android:background="@drawable/circle_button"
|
||||
android:padding="8dp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
android:id="@+id/food_detail"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior"
|
||||
>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/linear_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
>
|
||||
<TextView
|
||||
android:id="@+id/food_name_text_view"
|
||||
android:textSize="40sp"
|
||||
android:text="Food Name"
|
||||
android:textColor="@color/black"
|
||||
android:fontFamily="@font/bebas"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_weight="0.8"
|
||||
/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/favorite_icon"
|
||||
android:src="@drawable/baseline_favorite_border_24"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="35dp"
|
||||
android:layout_weight="0.2"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/shop_name_text_view"
|
||||
android:textSize="20sp"
|
||||
android:text="Shop Name"
|
||||
android:textColor="@color/secondary"
|
||||
android:fontFamily="@font/opensans"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toBottomOf="@id/linear_layout"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/description_text_view"
|
||||
android:text="Description"
|
||||
android:textSize="18sp"
|
||||
android:fontFamily="@font/bebas"
|
||||
android:textColor="@color/black"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toBottomOf="@id/shop_name_text_view"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/content_description_text_view"
|
||||
android:text="@string/text_description"
|
||||
android:fontFamily="@font/opensans"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
app:layout_constraintTop_toBottomOf="@id/description_text_view"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
/>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/constraintLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="30dp"
|
||||
app:layout_constraintTop_toBottomOf="@id/content_description_text_view"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:orientation="vertical"
|
||||
>
|
||||
<TextView
|
||||
android:text="Quantity"
|
||||
android:fontFamily="@font/bebas"
|
||||
android:textColor="@color/primaryColor"
|
||||
android:textSize="15sp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
/>
|
||||
|
||||
<com.mcdev.quantitizerlibrary.HorizontalQuantitizer
|
||||
android:id="@+id/quantity_option"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="-10dp"
|
||||
app:layout_constraintTop_toBottomOf="@id/content_description_text_view"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:orientation="vertical"
|
||||
>
|
||||
|
||||
<TextView
|
||||
android:text="Sub Total"
|
||||
android:fontFamily="@font/bebas"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="15sp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="right"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:text="$15.00"
|
||||
android:fontFamily="@font/bebas"
|
||||
android:textColor="@color/primaryColor"
|
||||
android:textSize="30sp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/add_to_basket_button"
|
||||
style="@style/DefaultSolid"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="40dp"
|
||||
android:fontFamily="@font/bebas"
|
||||
android:padding="10dp"
|
||||
android:text="Add to basket"
|
||||
android:textSize="20sp"
|
||||
app:layout_constraintTop_toBottomOf="@id/constraintLayout"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
/>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
|
||||
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
@@ -8,14 +8,15 @@
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/header_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_marginTop="40dp"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
@@ -63,8 +64,6 @@
|
||||
app:iss_period="3000"
|
||||
android:layout_marginTop="20dp"
|
||||
app:iss_corner_radius="40"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="180dp"
|
||||
app:layout_constraintTop_toBottomOf="@id/header_title"
|
||||
@@ -76,9 +75,6 @@
|
||||
android:id="@+id/recycler_view_menu"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:layout_marginTop="10dp"
|
||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
||||
android:orientation="horizontal"
|
||||
tools:listitem="@layout/list_foods"
|
||||
@@ -91,10 +87,10 @@
|
||||
android:id="@+id/restaurant_text"
|
||||
android:text="@string/restaurant"
|
||||
android:layout_marginTop="5dp"
|
||||
android:textSize="18sp"
|
||||
android:fontFamily="@font/opensans"
|
||||
android:textColor="@color/black"
|
||||
android:textStyle="bold"
|
||||
android:layout_marginStart="10dp"
|
||||
android:textSize="18sp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toBottomOf="@id/slider"
|
||||
@@ -105,9 +101,6 @@
|
||||
android:id="@+id/recycler_view_restaurant"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="100dp"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:layout_marginTop="10dp"
|
||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
||||
android:orientation="horizontal"
|
||||
android:contentDescription="@string/description"
|
||||
|
||||
@@ -7,5 +7,5 @@
|
||||
<color name="gray">#A3A3A3</color>
|
||||
<color name="secondary">#F99928</color>
|
||||
<color name="graylight">#ACA5A5</color>
|
||||
|
||||
<color name="red">#FF0000</color>
|
||||
</resources>
|
||||
@@ -39,4 +39,6 @@
|
||||
<string name="food_title">Food Title</string>
|
||||
<string name="basket_icon">Basket Icon</string>
|
||||
<string name="favourite_icon">Favourite Icon</string>
|
||||
<string name="text_description">Non odit iusto delectus maxime sit placeat voluptatum dolorem. Dolores quos rerum iusto.
|
||||
Beatae totam ab veritatis aliquid tenetur qui ut. Quia ut dolorum enim et. .</string>
|
||||
</resources>
|
||||
Reference in New Issue
Block a user