mirror of
https://github.com/Nezumi-2711/Foodify.git
synced 2026-09-22 13:38:41 +00:00
Design UI Home Fragment
This commit is contained in:
+1
-3
@@ -43,7 +43,5 @@ dependencies {
|
|||||||
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
|
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
|
||||||
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
|
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
|
||||||
|
|
||||||
implementation 'androidx.viewpager2:viewpager2:1.0.0'
|
implementation 'com.github.denzcoskun:ImageSlideshow:0.1.0'
|
||||||
|
|
||||||
implementation 'com.makeramen:roundedimageview:2.3.0'
|
|
||||||
}
|
}
|
||||||
@@ -1,24 +1,45 @@
|
|||||||
package com.capstone.foodify.Fragment;
|
package com.capstone.foodify.Fragment;
|
||||||
|
|
||||||
|
import static com.capstone.foodify.R.drawable.banner1;
|
||||||
|
import static com.capstone.foodify.R.drawable.banner2;
|
||||||
|
import static com.capstone.foodify.R.drawable.banner3;
|
||||||
|
import static com.capstone.foodify.R.drawable.banner4;
|
||||||
|
import static com.capstone.foodify.R.drawable.banner5;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
import androidx.viewpager2.widget.ViewPager2;
|
|
||||||
|
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
import com.capstone.foodify.R;
|
import com.capstone.foodify.R;
|
||||||
|
import com.denzcoskun.imageslider.ImageSlider;
|
||||||
|
import com.denzcoskun.imageslider.constants.ScaleTypes;
|
||||||
|
import com.denzcoskun.imageslider.models.SlideModel;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class HomeFragment extends Fragment {
|
public class HomeFragment extends Fragment {
|
||||||
|
|
||||||
|
ImageSlider imageSlider;
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
Bundle savedInstanceState) {
|
Bundle savedInstanceState) {
|
||||||
View view = inflater.inflate(R.layout.fragment_home, container, false);
|
View view = inflater.inflate(R.layout.fragment_home, container, false);
|
||||||
|
|
||||||
|
imageSlider = (ImageSlider) view.findViewById(R.id.slider);
|
||||||
|
|
||||||
|
List<SlideModel> slideModels = new ArrayList<>();
|
||||||
|
slideModels.add(new SlideModel("https://res.cloudinary.com/dnkmxpujh/image/upload/v1676023773/banner1_dandvd.png", null));
|
||||||
|
slideModels.add(new SlideModel("https://res.cloudinary.com/dnkmxpujh/image/upload/v1676023777/banner2_okkqac.png", null));
|
||||||
|
slideModels.add(new SlideModel("https://res.cloudinary.com/dnkmxpujh/image/upload/v1676023775/banner3_rklfi6.png", null));
|
||||||
|
slideModels.add(new SlideModel("https://res.cloudinary.com/dnkmxpujh/image/upload/v1676023852/banner4_ufsaps.png", null));
|
||||||
|
slideModels.add(new SlideModel("https://res.cloudinary.com/dnkmxpujh/image/upload/v1676023778/banner5_b4d1b8.png", null));
|
||||||
|
|
||||||
|
imageSlider.setImageList(slideModels);
|
||||||
// Inflate the layout for this fragment
|
// Inflate the layout for this fragment
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="18dp"
|
||||||
|
android:height="21dp"
|
||||||
|
android:viewportWidth="18"
|
||||||
|
android:viewportHeight="21">
|
||||||
|
<path
|
||||||
|
android:pathData="M9,20.751L3.166,14.917C2.013,13.763 1.227,12.293 0.909,10.693C0.59,9.093 0.754,7.434 1.378,5.926C2.002,4.419 3.06,3.13 4.417,2.224C5.773,1.317 7.368,0.833 9,0.833C10.632,0.833 12.227,1.317 13.583,2.224C14.94,3.13 15.998,4.419 16.622,5.926C17.246,7.434 17.41,9.093 17.091,10.693C16.773,12.293 15.987,13.763 14.834,14.917L9,20.751ZM13.538,13.621C14.435,12.723 15.046,11.58 15.293,10.335C15.541,9.091 15.414,7.801 14.928,6.628C14.443,5.456 13.62,4.454 12.565,3.748C11.51,3.043 10.269,2.667 9,2.667C7.731,2.667 6.49,3.043 5.435,3.748C4.38,4.454 3.558,5.456 3.072,6.628C2.586,7.801 2.459,9.091 2.707,10.335C2.954,11.58 3.565,12.723 4.463,13.621L9,18.158L13.538,13.621ZM9,10.917C8.514,10.917 8.047,10.724 7.704,10.38C7.36,10.036 7.167,9.57 7.167,9.083C7.167,8.597 7.36,8.131 7.704,7.787C8.047,7.443 8.514,7.25 9,7.25C9.486,7.25 9.953,7.443 10.296,7.787C10.64,8.131 10.833,8.597 10.833,9.083C10.833,9.57 10.64,10.036 10.296,10.38C9.953,10.724 9.486,10.917 9,10.917Z"
|
||||||
|
android:fillColor="#2D2D2D"/>
|
||||||
|
</vector>
|
||||||
@@ -55,6 +55,7 @@
|
|||||||
|
|
||||||
</com.google.android.material.textfield.TextInputLayout>
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
|
|
||||||
<com.google.android.material.textfield.TextInputLayout
|
<com.google.android.material.textfield.TextInputLayout
|
||||||
android:id="@+id/textInput_confirmPassword"
|
android:id="@+id/textInput_confirmPassword"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|||||||
@@ -1,10 +1,91 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
tools:context=".Fragment.HomeFragment">
|
tools:context=".Fragment.HomeFragment">
|
||||||
|
|
||||||
|
|
||||||
</LinearLayout>
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
<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"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/welcome_text"
|
||||||
|
android:text="@string/hello_guest"
|
||||||
|
android:textSize="22sp"
|
||||||
|
android:fontFamily="@font/opensans"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:textColor="@color/black"
|
||||||
|
android:layout_weight="0.7"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/text_address"
|
||||||
|
android:text="Home"
|
||||||
|
android:textSize="18sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:textColor="@color/secondary"
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
/>
|
||||||
|
<ImageView
|
||||||
|
android:src="@drawable/location"
|
||||||
|
android:layout_weight="0.1"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="30dp"
|
||||||
|
app:tint="@color/secondary"
|
||||||
|
/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<com.denzcoskun.imageslider.ImageSlider
|
||||||
|
android:id="@+id/slider"
|
||||||
|
app:iss_auto_cycle="true"
|
||||||
|
app:iss_delay="0"
|
||||||
|
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="200dp"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/header_title"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/recommend_text"
|
||||||
|
android:text="@string/recommend_for_you"
|
||||||
|
android:layout_marginTop="5dp"
|
||||||
|
android:textColor="@color/black"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:layout_marginStart="20dp"
|
||||||
|
android:textSize="18sp"
|
||||||
|
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/slider"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
/>
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
</androidx.core.widget.NestedScrollView>
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<com.makeramen.roundedimageview.RoundedImageView xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
android:id="@+id/imageSlide"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:adjustViewBounds="true"
|
|
||||||
app:riv_corner_radius="12dp"
|
|
||||||
>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</com.makeramen.roundedimageview.RoundedImageView>
|
|
||||||
@@ -28,4 +28,6 @@
|
|||||||
<string name="resend_code">Gửi lại</string>
|
<string name="resend_code">Gửi lại</string>
|
||||||
<string name="confirm">Xác nhận</string>
|
<string name="confirm">Xác nhận</string>
|
||||||
<string name="new_password">mật khẩu mới</string>
|
<string name="new_password">mật khẩu mới</string>
|
||||||
|
<string name="hello_guest">Hello, Guest!</string>
|
||||||
|
<string name="recommend_for_you">Recommend for you</string>
|
||||||
</resources>
|
</resources>
|
||||||
@@ -10,6 +10,7 @@ dependencyResolutionManagement {
|
|||||||
repositories {
|
repositories {
|
||||||
google()
|
google()
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
|
maven { url 'https://jitpack.io' }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rootProject.name = "Foodify"
|
rootProject.name = "Foodify"
|
||||||
|
|||||||
Reference in New Issue
Block a user