Minor changes

This commit is contained in:
len 2016-07-03 18:49:02 +02:00
parent 3680eb0bf5
commit 987473df44
2 changed files with 5 additions and 5 deletions

View file

@ -4,7 +4,9 @@ import android.view.ViewGroup
import eu.davidea.flexibleadapter.FlexibleAdapter
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.database.models.MangaChapterHistory
import eu.kanade.tachiyomi.data.source.SourceManager
import eu.kanade.tachiyomi.util.inflate
import uy.kohesive.injekt.injectLazy
/**
* Adapter of RecentlyReadHolder.
@ -17,6 +19,8 @@ import eu.kanade.tachiyomi.util.inflate
class RecentlyReadAdapter(val fragment: RecentlyReadFragment)
: FlexibleAdapter<RecentlyReadHolder, MangaChapterHistory>() {
val sourceManager by injectLazy<SourceManager>()
/**
* Called when ViewHolder is created
* @param parent parent View

View file

@ -7,10 +7,8 @@ import com.bumptech.glide.Glide
import com.bumptech.glide.load.engine.DiskCacheStrategy
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.database.models.MangaChapterHistory
import eu.kanade.tachiyomi.data.source.SourceManager
import kotlinx.android.synthetic.main.dialog_remove_recently.view.*
import kotlinx.android.synthetic.main.item_recently_read.view.*
import uy.kohesive.injekt.injectLazy
import java.text.DateFormat
import java.text.DecimalFormat
import java.text.DecimalFormatSymbols
@ -33,8 +31,6 @@ class RecentlyReadHolder(view: View, private val adapter: RecentlyReadAdapter)
*/
private val decimalFormat = DecimalFormat("#.###", DecimalFormatSymbols().apply { decimalSeparator = '.' })
private val sourceManager by injectLazy<SourceManager>()
private val df = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT)
/**
@ -54,7 +50,7 @@ class RecentlyReadHolder(view: View, private val adapter: RecentlyReadAdapter)
// Set source + chapter title
val formattedNumber = decimalFormat.format(chapter.chapter_number.toDouble())
itemView.manga_source.text = itemView.context.getString(R.string.recent_manga_source)
.format(sourceManager.get(manga.source)?.name, formattedNumber)
.format(adapter.sourceManager.get(manga.source)?.name, formattedNumber)
// Set last read timestamp title
itemView.last_read.text = df.format(Date(history.last_read))