Skip to content

Commit

Permalink
- Used toast extensions on BookmarkFragment ๐Ÿ‘Œ๐Ÿพ
Browse files Browse the repository at this point in the history
  • Loading branch information
MicahSphelele committed Aug 4, 2021
1 parent 2926800 commit 111c6d5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,8 @@ class CountryAdapter(private var list: List<Country>) : RecyclerView.Adapter<Cou
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
val country = list[position]

if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP){
holder.image.setImageDrawable(ContextCompat.getDrawable(holder.itemView.context,country.image))

holder.image.setImageDrawable(ContextCompat.getDrawable(holder.itemView.context,country.image))

}else{
@Suppress("DEPRECATION")
holder.image.setImageDrawable(ContextCompat.getDrawable(holder.itemView.context,country.image))
}
holder.title.text = country.countryName

holder.itemView.setOnClickListener {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ import sphe.inews.ui.main.dialogfragments.ArticlePreviewFragment
import sphe.inews.ui.main.dialogfragments.ViewYoutubeDialogFragment
import sphe.inews.util.AppLogger
import sphe.inews.util.notNull
import sphe.inews.util.showLongToast
import sphe.inews.util.showShortToast
import java.util.*
import javax.inject.Inject

Expand Down Expand Up @@ -113,6 +115,9 @@ class BookmarkFragment : Fragment(R.layout.fragment_bookmark), ArticleAdapter.Ar
state = View.VISIBLE,
errorMsg = "Something went wrong"
)
ex.message?.let {
requireActivity().showShortToast(it)
}
AppLogger.error("Error on fetching bookmark data", ex)
}
}
Expand Down Expand Up @@ -199,6 +204,9 @@ class BookmarkFragment : Fragment(R.layout.fragment_bookmark), ArticleAdapter.Ar
state = View.VISIBLE,
errorMsg = "Something went wrong"
)
ex.message?.let {
requireActivity().showLongToast(it)
}
AppLogger.error("Error on fetching bookmark data category: ${category.title}", ex)
}
}
Expand Down

0 comments on commit 111c6d5

Please sign in to comment.