-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MERGE/#46] merge develop into ocr-feat-text-recognition
- Loading branch information
Showing
24 changed files
with
335 additions
and
84 deletions.
There are no files selected for viewing
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
9 changes: 9 additions & 0 deletions
9
app/src/main/java/com/keyneez/data/model/request/RequestPostSaveDto.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,9 @@ | ||
package com.keyneez.data.model.request | ||
|
||
import kotlinx.serialization.SerialName | ||
|
||
@kotlinx.serialization.Serializable | ||
data class RequestPostSaveDto( | ||
@SerialName("content_id") | ||
val contentId: Int | ||
) |
27 changes: 27 additions & 0 deletions
27
app/src/main/java/com/keyneez/data/model/response/ResponseContentDto.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,27 @@ | ||
package com.keyneez.data.model.response | ||
|
||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class ResponseContentDto( | ||
@SerialName("content_key") | ||
val key: Int, | ||
@SerialName("content_title") | ||
val title: String, | ||
@SerialName("content_img") | ||
val img: String?, | ||
val introduction: String, | ||
val usage: String, | ||
@SerialName("start_at") | ||
val start: String?, | ||
@SerialName("end_at") | ||
val end: String?, | ||
val liked: Boolean, | ||
val category: List<String> | ||
) { | ||
@Serializable | ||
data class Category( | ||
val category: String? | ||
) | ||
} |
7 changes: 7 additions & 0 deletions
7
app/src/main/java/com/keyneez/data/repository/ContentRepository.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
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
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
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
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
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
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
43 changes: 25 additions & 18 deletions
43
app/src/main/java/com/keyneez/presentation/main/home/recommend/RecommendAdapter.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 |
---|---|---|
@@ -1,34 +1,41 @@ | ||
package com.keyneez.presentation.main.home.recommend | ||
|
||
import android.content.Intent | ||
import android.view.LayoutInflater | ||
import android.view.ViewGroup | ||
import androidx.core.content.ContextCompat | ||
import androidx.recyclerview.widget.RecyclerView | ||
import coil.load | ||
import com.keyneez.data.entity.HomeData | ||
import com.keyneez.data.model.response.ResponseContentDto | ||
import com.keyneez.presentation.main.detail.DetailActivity | ||
import com.keyneez.util.extension.setOnSingleClickListener | ||
import com.lab.keyneez.databinding.ItemHomeBinding | ||
|
||
class RecommendAdapter : RecyclerView.Adapter<RecommendAdapter.InfoViewHolder>() { | ||
var data = listOf<HomeData>() | ||
class RecommendAdapter : RecyclerView.Adapter<RecommendAdapter.HomeViewHolder>() { | ||
var data = listOf<ResponseContentDto>() | ||
|
||
class InfoViewHolder(private val binding: ItemHomeBinding) : | ||
RecyclerView.ViewHolder(binding.root) { | ||
fun bind(item: HomeData) { | ||
binding.ivHomeItem.load(item.background) | ||
binding.tvHomeTitle.text = item.title | ||
binding.ivHomeCard.setOnSingleClickListener { | ||
} | ||
} | ||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): HomeViewHolder { | ||
val binding = ItemHomeBinding.inflate(LayoutInflater.from(parent.context), parent, false) | ||
return HomeViewHolder(binding) | ||
} | ||
|
||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): InfoViewHolder { | ||
val binding = ItemHomeBinding.inflate(LayoutInflater.from(parent.context), parent, false) | ||
return InfoViewHolder(binding) | ||
override fun getItemCount(): Int { | ||
return data.size | ||
} | ||
|
||
override fun getItemCount(): Int = data.size | ||
override fun onBindViewHolder(holder: HomeViewHolder, position: Int) { | ||
holder.onBind(data[position]) | ||
} | ||
|
||
override fun onBindViewHolder(holder: InfoViewHolder, position: Int) { | ||
holder.bind(data[position]) | ||
class HomeViewHolder(private val binding: ItemHomeBinding) : | ||
RecyclerView.ViewHolder(binding.root) { | ||
fun onBind(item: ResponseContentDto) { | ||
binding.content = item | ||
binding.btnHomeHeart.isSelected = item.liked | ||
binding.root.setOnSingleClickListener { | ||
val intent = Intent(binding.root.context, DetailActivity::class.java) | ||
intent.putExtra("contentId", item.key) | ||
ContextCompat.startActivity(binding.root.context, intent, null) | ||
} | ||
} | ||
} | ||
} |
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
Oops, something went wrong.