diff options
Diffstat (limited to 'Client')
5 files changed, 263 insertions, 65 deletions
diff --git a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Adapters/MyPostsAdapter.kt b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Adapters/MyPostsAdapter.kt index 2161f96..7ea97f6 100644 --- a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Adapters/MyPostsAdapter.kt +++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Adapters/MyPostsAdapter.kt @@ -14,6 +14,8 @@ import com.example.brzodolokacije.Models.LocationType import com.example.brzodolokacije.Models.PostPreview import com.example.brzodolokacije.Services.RetrofitHelper import com.example.brzodolokacije.Services.SharedPreferencesHelper +import com.example.brzodolokacije.databinding.PostItemHomePageBinding +import com.example.brzodolokacije.databinding.PostItemUserPostBinding import com.example.brzodolokacije.databinding.PostPreviewBinding @@ -22,12 +24,12 @@ class MyPostsAdapter (val activity:Activity,val items : MutableList<PostPreview> private lateinit var token: String private lateinit var imageApi: IBackendApi - private lateinit var binding: PostPreviewBinding + private lateinit var binding: PostItemUserPostBinding override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder { val inflater = LayoutInflater.from(parent.context) imageApi= RetrofitHelper.getInstance() token= SharedPreferencesHelper.getValue("jwt", activity).toString() - binding = PostPreviewBinding.inflate(inflater, parent, false) + binding = PostItemUserPostBinding.inflate(inflater, parent, false) return ViewHolder(binding) } @@ -35,19 +37,19 @@ class MyPostsAdapter (val activity:Activity,val items : MutableList<PostPreview> override fun getItemCount() = items.size - inner class ViewHolder(itemView: PostPreviewBinding) : RecyclerView.ViewHolder(itemView.root) { + inner class ViewHolder(itemView: PostItemUserPostBinding) : RecyclerView.ViewHolder(itemView.root) { fun bind(item: PostPreview) { binding.apply { - tvTitle.text = item.location.name - tvLocationParent.text = item.location.country - tvPostPreviewRating.text=item.ratings.toString() + piupLocation.text = item.location.name + piupLocationDetail.text = item.location.country + piuprating.text=item.ratings.toString() if(item.images.size>1) ivMultipleImagesIcon.visibility= View.VISIBLE // tvLocationType.text = "TODO" if(item.images.isNotEmpty()) { Glide.with(activity) .load(RetrofitHelper.baseUrl + "/api/post/image/compress/" + item.images[0]._id) - .into(locationImage) + .into(piupbackground) } } diff --git a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/FragmentProfileStatistics.kt b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/FragmentProfileStatistics.kt index fb4c563..1f0ff56 100644 --- a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/FragmentProfileStatistics.kt +++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/FragmentProfileStatistics.kt @@ -86,7 +86,7 @@ class FragmentProfileStatistics : Fragment() { } private fun loadMonths(){ rcMonths.apply { - layoutManager= GridLayoutManager(requireContext(),1, GridLayoutManager.HORIZONTAL,false) + layoutManager= GridLayoutManager(requireContext(),2) adapter= MonthViewsAdapter(requireActivity(), stats!!.monthlyViews as MutableList<MonthlyViews> ) diff --git a/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_profile_statistics.xml b/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_profile_statistics.xml index ca60334..797e2b7 100644 --- a/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_profile_statistics.xml +++ b/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_profile_statistics.xml @@ -5,12 +5,13 @@ android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".FragmentProfileStatistics" - android:padding="16dp" + android:paddingHorizontal="16dp" + android:paddingTop="16dp" > <LinearLayout android:id="@+id/linearLayout8" - android:layout_width="wrap_content" + android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" @@ -18,154 +19,225 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent"> - <LinearLayout + <androidx.constraintlayout.widget.ConstraintLayout android:id="@+id/linearLayout3" - android:layout_width="wrap_content" + android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" + android:layout_marginBottom="5dp" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent"> <ImageView - android:layout_width="50dp" - android:layout_height="50dp" - android:src="@drawable/ic_total_views" /> + android:id="@+id/imageView13" + android:layout_width="30dp" + android:layout_height="30dp" + android:src="@drawable/ic_total_views" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> <TextView - android:layout_width="100dp" + android:id="@+id/textView5" + android:layout_width="wrap_content" android:layout_height="match_parent" - android:layout_marginRight="5dp" + android:layout_marginStart="8dp" android:gravity="center" - android:text="Broj pregleda" /> + android:text="Broj pregleda" + android:textAllCaps="true" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintStart_toEndOf="@+id/imageView13" + app:layout_constraintTop_toTopOf="parent" /> <TextView android:id="@+id/tvProfileStatisticsViews" android:layout_width="wrap_content" android:layout_height="match_parent" + android:layout_marginEnd="16dp" android:gravity="center" android:text="0" - android:textSize="20dp" /> + android:textSize="20dp" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintTop_toTopOf="parent" /> - </LinearLayout> + </androidx.constraintlayout.widget.ConstraintLayout> - <LinearLayout + <androidx.constraintlayout.widget.ConstraintLayout android:id="@+id/linearLayout4" - android:layout_width="wrap_content" + android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" + android:layout_marginBottom="5dp" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/linearLayout3"> <ImageView - android:layout_width="50dp" - android:layout_height="50dp" - android:src="@drawable/ic_baseline_star_24" /> + android:id="@+id/imageView14" + android:layout_width="30dp" + android:layout_height="30dp" + android:src="@drawable/ic_baseline_star_24" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> <TextView - android:layout_width="100dp" + android:id="@+id/textView13" + android:layout_width="wrap_content" android:layout_height="match_parent" - android:layout_marginRight="5dp" + android:layout_marginStart="8dp" android:gravity="center" - android:text="Broj ocena" /> + android:text="Broj ocena" + android:textAllCaps="true" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintStart_toEndOf="@+id/imageView14" + app:layout_constraintTop_toTopOf="parent" /> <TextView android:id="@+id/tvProfileStatisticsRatingNumber" android:layout_width="wrap_content" android:layout_height="match_parent" + android:layout_marginEnd="16dp" android:gravity="center" android:text="0" - android:textSize="20dp" /> + android:textSize="20dp" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintTop_toTopOf="parent" /> - </LinearLayout> + </androidx.constraintlayout.widget.ConstraintLayout> - <LinearLayout + <androidx.constraintlayout.widget.ConstraintLayout android:id="@+id/linearLayout5" - android:layout_width="wrap_content" + android:layout_width="match_parent" android:layout_height="wrap_content" + android:layout_marginBottom="5dp" android:orientation="horizontal" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/linearLayout4"> <ImageView - android:layout_width="50dp" - android:layout_height="50dp" - android:src="@drawable/ic_baseline_star_half_24" /> + android:id="@+id/imageView15" + android:layout_width="30dp" + android:layout_height="30dp" + android:src="@drawable/ic_baseline_star_half_24" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> <TextView - android:layout_width="100dp" + android:id="@+id/textView14" + android:layout_width="wrap_content" android:layout_height="match_parent" - android:layout_marginRight="5dp" + android:layout_marginStart="8dp" android:gravity="center" - android:text="Prosečna ocena po objavi" /> + android:text="Prosečna ocena po objavi" + android:textAllCaps="true" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintStart_toEndOf="@+id/imageView15" + app:layout_constraintTop_toTopOf="parent" /> <TextView android:id="@+id/tvProfileStatisticsAverageRating" android:layout_width="wrap_content" android:layout_height="match_parent" + android:layout_marginEnd="16dp" android:gravity="center" android:text="0" - android:textSize="20dp" /> + android:textSize="20dp" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintTop_toTopOf="parent" /> - </LinearLayout> + </androidx.constraintlayout.widget.ConstraintLayout> - <LinearLayout + <androidx.constraintlayout.widget.ConstraintLayout android:id="@+id/linearLayout7" - android:layout_width="wrap_content" + android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" + android:layout_marginBottom="5dp" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/linearLayout5"> <ImageView - android:layout_width="50dp" - android:layout_height="50dp" - android:src="@drawable/ic_baseline_favorite_24" /> + android:id="@+id/imageView16" + android:layout_width="30dp" + android:layout_height="30dp" + android:src="@drawable/ic_baseline_favorite_24" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> <TextView - android:layout_width="100dp" + android:id="@+id/textView15" + android:layout_width="wrap_content" android:layout_height="match_parent" - android:layout_marginRight="5dp" + android:layout_marginStart="8dp" android:gravity="center" - android:text="Broj omiljenih objava" /> + android:text="Broj omiljenih objava" + android:textAllCaps="true" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintStart_toEndOf="@+id/imageView16" + app:layout_constraintTop_toTopOf="parent" /> <TextView android:id="@+id/tvProfileStatisticsFavouriteNumber" android:layout_width="wrap_content" android:layout_height="match_parent" + android:layout_marginEnd="16dp" android:gravity="center" android:text="0" - android:textSize="20dp" /> + android:textSize="20dp" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintTop_toTopOf="parent" /> - </LinearLayout> + </androidx.constraintlayout.widget.ConstraintLayout> - <LinearLayout + <androidx.constraintlayout.widget.ConstraintLayout android:id="@+id/linearLayout6" - android:layout_width="wrap_content" + android:layout_width="match_parent" android:layout_height="wrap_content" + android:layout_marginBottom="5dp" android:orientation="horizontal" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/linearLayout7"> <ImageView - android:layout_width="50dp" - android:layout_height="50dp" - android:src="@drawable/ic_baseline_calendar_month_24" /> + android:id="@+id/imageView17" + android:layout_width="30dp" + android:layout_height="30dp" + android:src="@drawable/ic_baseline_calendar_month_24" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> <TextView - android:layout_width="100dp" + android:layout_width="wrap_content" android:layout_height="match_parent" - android:layout_marginRight="5dp" + android:layout_marginStart="8dp" android:gravity="center" - android:text="Pregledi po mesecima" /> + android:text="Pregledi po mesecima" + android:textAllCaps="true" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintStart_toEndOf="@+id/imageView17" + app:layout_constraintTop_toTopOf="parent" /> - </LinearLayout> + </androidx.constraintlayout.widget.ConstraintLayout> + + <View + android:id="@+id/divider7" + android:layout_width="match_parent" + android:layout_height="1dp" + android:background="?android:attr/listDivider" /> </LinearLayout> @@ -173,7 +245,8 @@ <androidx.recyclerview.widget.RecyclerView android:id="@+id/rvFragmentProfileStatisticsMonths" android:layout_width="match_parent" - android:layout_height="wrap_content" + android:layout_height="0dp" + app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/linearLayout8" /> diff --git a/Client/BrzoDoLokacije/app/src/main/res/layout/post_item_user_post.xml b/Client/BrzoDoLokacije/app/src/main/res/layout/post_item_user_post.xml new file mode 100644 index 0000000..c72ace6 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/res/layout/post_item_user_post.xml @@ -0,0 +1,119 @@ +<?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:padding="10dp" + android:layout_height="wrap_content"> + + <com.google.android.material.imageview.ShapeableImageView + android:id="@+id/piupbackgroi" + android:layout_width="match_parent" + android:layout_height="210dp" + android:layout_marginTop="3dp" + android:layout_marginBottom="3dp" + android:layout_marginHorizontal="3dp" + android:elevation="3dp" + android:src="@color/white" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" + app:shapeAppearanceOverlay="@style/Circular" /> + + <ImageView + android:id="@+id/ivMultipleImagesIcon" + android:layout_width="20dp" + android:layout_height="20dp" + android:layout_marginTop="8dp" + android:layout_marginEnd="8dp" + android:elevation="10dp" + android:src="@drawable/ic_baseline_multiple_images_24" + android:visibility="invisible" + app:layout_constraintEnd_toEndOf="@+id/piupbackground" + app:layout_constraintTop_toTopOf="@+id/piupbackgroi" /> + + <com.google.android.material.imageview.ShapeableImageView + android:id="@+id/piupbackground" + android:layout_width="match_parent" + android:layout_height="170dp" + android:layout_marginStart="3dp" + android:layout_marginEnd="3dp" + android:layout_marginHorizontal="3dp" + android:elevation="3dp" + android:scaleType="centerCrop" + app:layout_constraintBottom_toBottomOf="@+id/piupbackgroi" + app:layout_constraintEnd_toEndOf="@id/piupbackgroi" + app:layout_constraintStart_toStartOf="@id/piupbackgroi" + app:layout_constraintTop_toTopOf="@id/piupbackgroi" + app:layout_constraintVertical_bias="0.0" + app:shapeAppearanceOverlay="@style/roundedTop" + app:srcCompat="@drawable/b1" /> + + <TextView + android:id="@+id/piupLocation" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="12dp" + android:layout_marginTop="2dp" + android:elevation="3dp" + android:text="TextView" + android:textSize="13sp" + android:textStyle="bold" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/piupbackground" /> + + <TextView + android:id="@+id/piuprating" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginTop="3dp" + + android:layout_marginEnd="4dp" + android:elevation="3dp" + android:text="TextView" + android:textSize="11dp" + android:textStyle="bold" + app:layout_constraintEnd_toEndOf="@+id/piupbackgroi" + app:layout_constraintTop_toBottomOf="@+id/piupbackground" /> + + <ImageView + android:id="@+id/imageView10" + + android:layout_width="15dp" + android:layout_height="15dp" + android:layout_marginTop="3dp" + android:elevation="3dp" + app:layout_constraintEnd_toStartOf="@+id/piuprating" + app:layout_constraintTop_toBottomOf="@+id/piupbackground" + app:srcCompat="@drawable/ic_baseline_star_rate_24" /> + + <ImageView + android:id="@+id/imageView11" + + android:layout_width="18dp" + android:layout_height="18dp" + android:layout_marginStart="8dp" + android:layout_marginTop="2dp" + android:elevation="3dp" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/piupLocation" + app:srcCompat="@drawable/ic_baseline_location_on_24" /> + + <TextView + android:id="@+id/piupLocationDetail" + + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginTop="2dp" + android:elevation="3dp" + android:text="TextView" + android:textSize="11dp" + app:layout_constraintEnd_toEndOf="@+id/piupbackgroi" + app:layout_constraintHorizontal_bias="0.0" + app:layout_constraintStart_toEndOf="@+id/imageView11" + app:layout_constraintTop_toBottomOf="@+id/piupLocation" /> + " /> + + +</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file diff --git a/Client/BrzoDoLokacije/app/src/main/res/layout/single_date_view.xml b/Client/BrzoDoLokacije/app/src/main/res/layout/single_date_view.xml index fd4c568..f2726db 100644 --- a/Client/BrzoDoLokacije/app/src/main/res/layout/single_date_view.xml +++ b/Client/BrzoDoLokacije/app/src/main/res/layout/single_date_view.xml @@ -1,27 +1,31 @@ <?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" - android:layout_width="150dp" + android:layout_width="match_parent" + android:padding="10dp" android:layout_height="50dp"> <TextView android:id="@+id/tvMonth" - android:layout_width="100dp" + android:layout_width="80dp" android:layout_height="match_parent" - android:gravity="center" + android:gravity="left|center_vertical" android:text="Mesec" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toTopOf="parent" /> + app:layout_constraintTop_toTopOf="parent" + app:layout_constraintVertical_bias="0.0" /> <TextView android:id="@+id/tvMonthViews" android:layout_width="50dp" android:layout_height="match_parent" - android:gravity="center" + android:gravity="left|center_vertical" android:text="5" + android:textStyle="bold" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_bias="0.0" app:layout_constraintStart_toEndOf="@+id/tvMonth" app:layout_constraintTop_toTopOf="parent" /> </androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file |