-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
39 changed files
with
211 additions
and
1 deletion.
There are no files selected for viewing
12 changes: 12 additions & 0 deletions
12
app/src/main/java/com/charo/android/domain/model/home/BannerLocal.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.charo.android.domain.model.home | ||
|
||
import android.graphics.fonts.Font | ||
|
||
data class BannerLocal( | ||
val homeViewPagerRoadImage: Int, | ||
val homeViewPagerTitle: String, | ||
val homeViewPagerSubTitle: String, | ||
val homeViewPagerSubTitleImg: Int, | ||
val titleFontSize: Float, | ||
val charoImgVisible: Boolean | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
78 changes: 78 additions & 0 deletions
78
...src/main/java/com/charo/android/presentation/ui/home/adapter/HomeViewPagerLocalAdapter.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
package com.charo.android.presentation.ui.home.adapter | ||
|
||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import androidx.recyclerview.widget.RecyclerView | ||
import com.bumptech.glide.Glide | ||
import com.charo.android.databinding.ItemHomeViewpagerLocalBinding | ||
import com.charo.android.domain.model.home.BannerLocal | ||
import com.charo.android.domain.model.home.BannerRoad | ||
|
||
class HomeViewPagerLocalAdapter() : | ||
RecyclerView.Adapter<HomeViewPagerLocalAdapter.HomeViewPagerViewHolder>() { | ||
private val _banner = mutableListOf<BannerLocal>() | ||
var banner: List<BannerLocal> = _banner | ||
|
||
private val _bannerRoad = mutableListOf<BannerRoad>() | ||
var bannerRoad : List<BannerRoad> = _bannerRoad | ||
|
||
override fun onCreateViewHolder( | ||
parent: ViewGroup, | ||
viewType: Int | ||
): HomeViewPagerViewHolder { | ||
val binding = ItemHomeViewpagerLocalBinding.inflate( | ||
LayoutInflater.from(parent.context), | ||
parent, | ||
false | ||
) | ||
return HomeViewPagerViewHolder(binding) | ||
} | ||
|
||
override fun onBindViewHolder( | ||
holder: HomeViewPagerViewHolder, | ||
position: Int | ||
) { | ||
holder.onBind(banner[position], bannerRoad[position]) | ||
|
||
} | ||
|
||
override fun getItemCount(): Int { | ||
return banner.size | ||
} | ||
|
||
class HomeViewPagerViewHolder( | ||
private val binding: ItemHomeViewpagerLocalBinding | ||
) : RecyclerView.ViewHolder(binding.root) { | ||
fun onBind(banner : BannerLocal, bannerRoad: BannerRoad){ | ||
|
||
Glide.with(binding.imgViewpager) | ||
.load(banner.homeViewPagerRoadImage) | ||
.into(binding.imgViewpager) | ||
|
||
if(banner.homeViewPagerSubTitleImg == 0){ | ||
binding.textViewpagerSubTitleImg.visibility = View.GONE | ||
}else{ | ||
binding.textViewpagerSubTitleImg.visibility = View.VISIBLE | ||
binding.textViewpagerSubTitleImg.setImageResource(banner.homeViewPagerSubTitleImg) | ||
} | ||
|
||
if(banner.charoImgVisible){ | ||
binding.imgViewpagerCharo.visibility = View.VISIBLE | ||
}else{ | ||
binding.imgViewpagerCharo.visibility = View.INVISIBLE | ||
} | ||
binding.textViewpagerTitle.textSize = banner.titleFontSize | ||
binding.banner = banner | ||
binding.bannerRoad = bannerRoad | ||
binding.executePendingBindings() | ||
} | ||
} | ||
|
||
fun setHomeBanner(banner: List<BannerLocal>, bannerRoad: List<BannerRoad>){ | ||
this.banner = banner | ||
this.bannerRoad = bannerRoad | ||
notifyDataSetChanged() | ||
} | ||
|
||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
|
||
<layout xmlns:tools="http://schemas.android.com/tools"> | ||
<data> | ||
<variable | ||
name="banner" | ||
type="com.charo.android.domain.model.home.BannerLocal" /> | ||
|
||
<variable | ||
name="bannerRoad" | ||
type="com.charo.android.domain.model.home.BannerRoad" /> | ||
</data> | ||
|
||
<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="match_parent" | ||
android:layout_height="match_parent"> | ||
|
||
<ImageView | ||
android:id="@+id/img_viewpager" | ||
android:layout_width="0dp" | ||
android:layout_height="match_parent" | ||
android:scaleType="fitXY" | ||
android:src="@drawable/main_image" | ||
app:layout_constraintBottom_toBottomOf="parent" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toTopOf="parent" | ||
/> | ||
|
||
<ImageView | ||
android:layout_width="0dp" | ||
android:layout_height="match_parent" | ||
android:scaleType="fitXY" | ||
app:layout_constraintBottom_toBottomOf="parent" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toTopOf="parent" | ||
android:background="#63000000" | ||
/> | ||
|
||
<ImageView | ||
android:id="@+id/text_viewpager_sub_title_img" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
app:layout_constraintBottom_toTopOf="@id/text_viewpager_title" | ||
app:layout_constraintStart_toStartOf="@+id/text_viewpager_title" | ||
/> | ||
|
||
<TextView | ||
android:id="@+id/text_viewpager_sub_title" | ||
style="@style/HeaderH2" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_marginHorizontal="20dp" | ||
android:includeFontPadding="false" | ||
android:textColor="@color/white" | ||
android:text="@{banner.homeViewPagerSubTitle}" | ||
app:layout_constraintBottom_toTopOf="@id/text_viewpager_title" | ||
app:layout_constraintStart_toStartOf="@+id/text_viewpager_title" | ||
/> | ||
|
||
<TextView | ||
android:id="@+id/text_viewpager_title" | ||
style="@style/HeaderH1" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginStart="20dp" | ||
app:layout_constraintVertical_bias="0.55" | ||
android:text="@{banner.homeViewPagerTitle}" | ||
tools:text="차에서의\n오늘이 최고가 될 수 있게\n당신의 드라이브 메이트" | ||
android:lineSpacingExtra="1sp" | ||
android:includeFontPadding="false" | ||
app:layout_constraintBottom_toBottomOf="@+id/img_viewpager" | ||
app:layout_constraintStart_toStartOf="@+id/img_viewpager" | ||
app:layout_constraintTop_toTopOf="@+id/img_viewpager" | ||
app:layout_constraintEnd_toStartOf="@+id/img_viewpager_charo"/> | ||
|
||
<ImageView | ||
android:id="@+id/img_viewpager_charo" | ||
android:layout_width="0dp" | ||
android:scaleType="fitStart" | ||
android:layout_height="wrap_content" | ||
android:src="@drawable/banner_charo" | ||
app:layout_constraintStart_toEndOf="@id/text_viewpager_title" | ||
app:layout_constraintBottom_toBottomOf="@id/text_viewpager_title" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
android:visibility="invisible"/> | ||
|
||
<ImageView | ||
android:id="@+id/img_viewpager_line" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_margin="16dp" | ||
imgIntBind="@{bannerRoad.bannerRoadImg}" | ||
app:layout_constraintBottom_toBottomOf="parent"/> | ||
|
||
|
||
</androidx.constraintlayout.widget.ConstraintLayout> | ||
</layout> |