-
Notifications
You must be signed in to change notification settings - Fork 0
MOB-5193 HP4U Data API #26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 1 commit
3d01a76
2e01bc4
1aa4bad
b3baeb6
86acf20
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,12 +4,12 @@ plugins { | |
| } | ||
|
|
||
| android { | ||
| compileSdk 32 | ||
| compileSdk 34 | ||
|
|
||
| defaultConfig { | ||
| applicationId "com.taboola.hp4udemoapplication" | ||
| minSdk 21 | ||
| targetSdk 32 | ||
| targetSdk 34 | ||
| versionCode 1 | ||
| versionName "1.0" | ||
|
|
||
|
|
@@ -35,6 +35,7 @@ android { | |
| kotlinOptions { | ||
| jvmTarget = '1.8' | ||
| } | ||
| namespace 'com.taboola.hp4udemoapplication' | ||
| } | ||
|
|
||
| dependencies { | ||
|
|
@@ -50,7 +51,7 @@ dependencies { | |
| implementation 'androidx.core:core-splashscreen:1.0.0-rc01' | ||
| implementation 'com.squareup.picasso:picasso:2.8' | ||
| //Taboola SDK | ||
| implementation 'com.taboola:android-sdk:3.8.13' | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @sanjacurcic-taboola - Notice that you changed the major version (from three to four). I would make sure nothing was impacted.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've already checked the entire app, everything seems fine.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @sanjacurcic-taboola - Remember you can only merge this once 4.0.17 has been released officially. |
||
| implementation 'com.taboola:android-sdk:4.0.17' | ||
|
|
||
| testImplementation 'junit:junit:4.13.2' | ||
| androidTestImplementation 'androidx.test.ext:junit:1.1.3' | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,6 +13,7 @@ import com.taboola.hp4udemoapplication.model.Header | |
|
|
||
| class HomePageAdapter( | ||
| private var homePage: TBLHomePage?, | ||
| private val isHomePageDataApiMode: Boolean, | ||
| private val onItemClickListener: HomePageItemClickListener | ||
| ) : | ||
| RecyclerView.Adapter<RecyclerView.ViewHolder>() { | ||
|
|
@@ -47,7 +48,7 @@ class HomePageAdapter( | |
| return mainItemViewHolder | ||
| } | ||
| DEFAULT_ARTICLE -> { | ||
| val viewHolder = HomePageItemViewHolder(view) | ||
| val viewHolder = if (isHomePageDataApiMode) HomePageDataApiItemViewHolder(view) else HomePageItemViewHolder(view) | ||
|
||
| view.setOnClickListener { | ||
| val url = (data[viewHolder.adapterPosition] as Article).url | ||
| onItemClickListener.onClick(url) | ||
|
|
@@ -65,11 +66,15 @@ class HomePageAdapter( | |
| (holder as MainHomePageItemViewHolder).onBind(data[position] as Article) | ||
| } | ||
| DEFAULT_ARTICLE -> if (data[position] is Article) { | ||
| (holder as HomePageItemViewHolder).onBind( | ||
| (holder as? HomePageItemViewHolder)?.onBind( | ||
| homePage, | ||
| position, | ||
| data[position] as Article | ||
| ) | ||
|
|
||
| (holder as? HomePageDataApiItemViewHolder)?.onBind( | ||
| data[position] as Article | ||
| ) | ||
| } | ||
| HEADER -> if (data[position] is Header) { | ||
| (holder as HeaderViewHolder).onBind(data[position] as Header) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| package com.taboola.hp4udemoapplication.adapters.articles | ||
|
|
||
| import android.view.View | ||
| import android.widget.ImageView | ||
| import android.widget.TextView | ||
| import androidx.core.view.isVisible | ||
| import androidx.recyclerview.widget.RecyclerView | ||
| import com.squareup.picasso.Picasso | ||
| import com.taboola.hp4udemoapplication.R | ||
| import com.taboola.hp4udemoapplication.model.Article | ||
| import com.taboola.hp4udemoapplication.view.AnimatedBackgroundTextView | ||
|
|
||
| class HomePageDataApiItemViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) { | ||
|
|
||
| private val title: TextView? | ||
| get() = itemView.findViewById(R.id.title) | ||
|
|
||
| private val content: TextView? | ||
| get() = itemView.findViewById(R.id.content) | ||
|
|
||
| private val image: ImageView? | ||
| get() = itemView.findViewById(R.id.image) | ||
|
|
||
| private val animatedBackgroundTextView: AnimatedBackgroundTextView? | ||
| get() = itemView.findViewById(R.id.swapped_indication) | ||
|
|
||
| fun onBind(article: Article) { | ||
| animatedBackgroundTextView?.isVisible = article.isSwapped | ||
| title?.text = article.title | ||
| content?.text = article.content | ||
| if (article.isSwapped) { | ||
| Picasso.get().load(article.url).into(image) | ||
| } else { | ||
| Picasso.get().load(article.imageResourceId).into(image) | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sanjacurcic-taboola - The latest SDK level is 36, so at the very least you can upgrade to it or to 35.