diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/backup/full/models/BackupTracking.kt b/app/src/main/java/eu/kanade/tachiyomi/data/backup/full/models/BackupTracking.kt index 270adf2bf..c47897c8f 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/backup/full/models/BackupTracking.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/backup/full/models/BackupTracking.kt @@ -22,9 +22,9 @@ data class BackupTracking( @ProtoNumber(8) var score: Float = 0F, @ProtoNumber(9) var status: Int = 0, // startedReadingDate is called startReadTime in 1.x - @ProtoNumber(10) var startedReadingDate: Long = 0, + // @ProtoNumber(10) var startedReadingDate: Long = 0, // finishedReadingDate is called endReadTime in 1.x - @ProtoNumber(11) var finishedReadingDate: Long = 0, + // @ProtoNumber(11) var finishedReadingDate: Long = 0, ) { fun getTrackingImpl(): TrackImpl { return TrackImpl().apply { @@ -37,8 +37,6 @@ data class BackupTracking( total_chapters = this@BackupTracking.totalChapters score = this@BackupTracking.score status = this@BackupTracking.status - started_reading_date = this@BackupTracking.startedReadingDate - finished_reading_date = this@BackupTracking.finishedReadingDate tracking_url = this@BackupTracking.trackingUrl } } @@ -56,8 +54,6 @@ data class BackupTracking( totalChapters = track.total_chapters, score = track.score, status = track.status, - startedReadingDate = track.started_reading_date, - finishedReadingDate = track.finished_reading_date, trackingUrl = track.tracking_url ) } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/database/mappers/TrackTypeMapping.kt b/app/src/main/java/eu/kanade/tachiyomi/data/database/mappers/TrackTypeMapping.kt index 94de567ad..ce7d13726 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/database/mappers/TrackTypeMapping.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/database/mappers/TrackTypeMapping.kt @@ -56,8 +56,10 @@ class TrackPutResolver : DefaultPutResolver() { put(COL_STATUS, obj.status) put(COL_TRACKING_URL, obj.tracking_url) put(COL_SCORE, obj.score) - put(COL_START_DATE, obj.started_reading_date) - put(COL_FINISH_DATE, obj.finished_reading_date) + + // These aren't used anymore + put(COL_START_DATE, 0) + put(COL_FINISH_DATE, 0) } } @@ -75,8 +77,6 @@ class TrackGetResolver : DefaultGetResolver() { status = cursor.getInt(cursor.getColumnIndex(COL_STATUS)) score = cursor.getFloat(cursor.getColumnIndex(COL_SCORE)) tracking_url = cursor.getString(cursor.getColumnIndex(COL_TRACKING_URL)) - started_reading_date = cursor.getLong(cursor.getColumnIndex(COL_START_DATE)) - finished_reading_date = cursor.getLong(cursor.getColumnIndex(COL_FINISH_DATE)) } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/database/models/Track.kt b/app/src/main/java/eu/kanade/tachiyomi/data/database/models/Track.kt index 0f3815c54..c64363efa 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/database/models/Track.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/database/models/Track.kt @@ -24,18 +24,12 @@ interface Track : Serializable { var status: Int - var started_reading_date: Long - - var finished_reading_date: Long - var tracking_url: String fun copyPersonalFrom(other: Track) { last_chapter_read = other.last_chapter_read score = other.score status = other.status - started_reading_date = other.started_reading_date - finished_reading_date = other.finished_reading_date } companion object { diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/database/models/TrackImpl.kt b/app/src/main/java/eu/kanade/tachiyomi/data/database/models/TrackImpl.kt index 6f5991133..03a878e14 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/database/models/TrackImpl.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/database/models/TrackImpl.kt @@ -22,10 +22,6 @@ class TrackImpl : Track { override var status: Int = 0 - override var started_reading_date: Long = 0 - - override var finished_reading_date: Long = 0 - override var tracking_url: String = "" override fun equals(other: Any?): Boolean { diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/track/TrackService.kt b/app/src/main/java/eu/kanade/tachiyomi/data/track/TrackService.kt index 5e2611942..5fe8e6f2b 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/track/TrackService.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/track/TrackService.kt @@ -23,9 +23,6 @@ abstract class TrackService(val id: Int) { // Name of the manga sync service to display abstract val name: String - // Application and remote support for reading dates - open val supportsReadingDates: Boolean = false - @DrawableRes abstract fun getLogo(): Int diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/track/model/TrackSearch.kt b/app/src/main/java/eu/kanade/tachiyomi/data/track/model/TrackSearch.kt index 9035f5550..ee1100b76 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/track/model/TrackSearch.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/track/model/TrackSearch.kt @@ -24,10 +24,6 @@ class TrackSearch : Track { override var status: Int = 0 - override var started_reading_date: Long = 0 - - override var finished_reading_date: Long = 0 - override lateinit var tracking_url: String var cover_url: String = "" diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/track/myanimelist/MyAnimeList.kt b/app/src/main/java/eu/kanade/tachiyomi/data/track/myanimelist/MyAnimeList.kt index bcfe72920..3a5320467 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/track/myanimelist/MyAnimeList.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/track/myanimelist/MyAnimeList.kt @@ -76,6 +76,7 @@ class MyAnimeList(private val context: Context, id: Int) : TrackService(id) { } override fun bind(track: Track): Observable { + // TODO: change this to call add and update like the other trackers? return runAsObservable { api.getListItem(track) } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/SetTrackReadingDatesDialog.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/SetTrackReadingDatesDialog.kt deleted file mode 100644 index f1e0ee5ff..000000000 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/SetTrackReadingDatesDialog.kt +++ /dev/null @@ -1,85 +0,0 @@ -package eu.kanade.tachiyomi.ui.manga.track - -import android.app.Dialog -import android.os.Bundle -import androidx.core.os.bundleOf -import com.afollestad.materialdialogs.MaterialDialog -import com.afollestad.materialdialogs.datetime.datePicker -import com.bluelinelabs.conductor.Controller -import eu.kanade.tachiyomi.R -import eu.kanade.tachiyomi.data.database.models.Track -import eu.kanade.tachiyomi.data.track.TrackManager -import eu.kanade.tachiyomi.ui.base.controller.DialogController -import uy.kohesive.injekt.Injekt -import uy.kohesive.injekt.api.get -import java.util.Calendar - -class SetTrackReadingDatesDialog : DialogController - where T : Controller, T : SetTrackReadingDatesDialog.Listener { - - private val item: TrackItem - - private val dateToUpdate: ReadingDate - - constructor(target: T, dateToUpdate: ReadingDate, item: TrackItem) : super( - bundleOf(KEY_ITEM_TRACK to item.track) - ) { - targetController = target - this.item = item - this.dateToUpdate = dateToUpdate - } - - @Suppress("unused") - constructor(bundle: Bundle) : super(bundle) { - val track = bundle.getSerializable(KEY_ITEM_TRACK) as Track - val service = Injekt.get().getService(track.sync_id)!! - item = TrackItem(track, service) - dateToUpdate = ReadingDate.Start - } - - override fun onCreateDialog(savedViewState: Bundle?): Dialog { - val listener = (targetController as? Listener) - - return MaterialDialog(activity!!) - .title( - when (dateToUpdate) { - ReadingDate.Start -> R.string.track_started_reading_date - ReadingDate.Finish -> R.string.track_finished_reading_date - } - ) - .datePicker(currentDate = getCurrentDate()) { _, date -> - listener?.setReadingDate(item, dateToUpdate, date.timeInMillis) - } - .neutralButton(R.string.action_remove) { - listener?.setReadingDate(item, dateToUpdate, 0L) - } - } - - private fun getCurrentDate(): Calendar { - // Today if no date is set, otherwise the already set date - return Calendar.getInstance().apply { - item.track?.let { - val date = when (dateToUpdate) { - ReadingDate.Start -> it.started_reading_date - ReadingDate.Finish -> it.finished_reading_date - } - if (date != 0L) { - timeInMillis = date - } - } - } - } - - interface Listener { - fun setReadingDate(item: TrackItem, type: ReadingDate, date: Long) - } - - enum class ReadingDate { - Start, - Finish - } - - companion object { - private const val KEY_ITEM_TRACK = "SetTrackReadingDatesDialog.item.track" - } -} diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/TrackAdapter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/TrackAdapter.kt index 221212ef7..28b50c1b3 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/TrackAdapter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/TrackAdapter.kt @@ -43,7 +43,5 @@ class TrackAdapter(controller: TrackController) : RecyclerView.Adapter presenter.setStartDate(item, date) - SetTrackReadingDatesDialog.ReadingDate.Finish -> presenter.setFinishDate(item, date) - } - binding.swipeRefresh.isRefreshing = true - } - private companion object { const val MANGA_EXTRA = "manga" const val TAG_SEARCH_CONTROLLER = "track_search_controller" diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/TrackHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/TrackHolder.kt index 1279335aa..4e98f8178 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/TrackHolder.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/TrackHolder.kt @@ -6,16 +6,11 @@ import eu.kanade.tachiyomi.data.preference.PreferencesHelper import eu.kanade.tachiyomi.databinding.TrackItemBinding import eu.kanade.tachiyomi.ui.base.holder.BaseViewHolder import uy.kohesive.injekt.injectLazy -import java.text.DateFormat class TrackHolder(private val binding: TrackItemBinding, adapter: TrackAdapter) : BaseViewHolder(binding.root) { private val preferences: PreferencesHelper by injectLazy() - private val dateFormat: DateFormat by lazy { - preferences.dateFormat() - } - init { val listener = adapter.rowClickListener @@ -29,8 +24,6 @@ class TrackHolder(private val binding: TrackItemBinding, adapter: TrackAdapter) binding.trackStatus.setOnClickListener { listener.onStatusClick(bindingAdapterPosition) } binding.trackChapters.setOnClickListener { listener.onChaptersClick(bindingAdapterPosition) } binding.trackScore.setOnClickListener { listener.onScoreClick(bindingAdapterPosition) } - binding.trackStartDate.setOnClickListener { listener.onStartDateClick(bindingAdapterPosition) } - binding.trackFinishDate.setOnClickListener { listener.onFinishDateClick(bindingAdapterPosition) } } @SuppressLint("SetTextI18n") @@ -49,18 +42,6 @@ class TrackHolder(private val binding: TrackItemBinding, adapter: TrackAdapter) if (track.total_chapters > 0) track.total_chapters else "-" binding.trackStatus.text = item.service.getStatus(track.status) binding.trackScore.text = if (track.score == 0f) "-" else item.service.displayScore(track) - - if (item.service.supportsReadingDates) { - binding.trackStartDate.text = - if (track.started_reading_date != 0L) dateFormat.format(track.started_reading_date) else "-" - binding.trackFinishDate.text = - if (track.finished_reading_date != 0L) dateFormat.format(track.finished_reading_date) else "-" - } else { - binding.bottomDivider.isVisible = false - binding.vertDivider3.isVisible = false - binding.trackStartDate.isVisible = false - binding.trackFinishDate.isVisible = false - } } } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/TrackPresenter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/TrackPresenter.kt index 85d28c55b..deb4afbb2 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/TrackPresenter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/TrackPresenter.kt @@ -145,16 +145,4 @@ class TrackPresenter( } updateRemote(track, item.service) } - - fun setStartDate(item: TrackItem, date: Long) { - val track = item.track!! - track.started_reading_date = date - updateRemote(track, item.service) - } - - fun setFinishDate(item: TrackItem, date: Long) { - val track = item.track!! - track.finished_reading_date = date - updateRemote(track, item.service) - } } diff --git a/app/src/main/res/layout/track_item.xml b/app/src/main/res/layout/track_item.xml index 47b2f9471..350476d46 100644 --- a/app/src/main/res/layout/track_item.xml +++ b/app/src/main/res/layout/track_item.xml @@ -105,7 +105,7 @@ android:layout_marginBottom="8dp" android:alpha="0.25" android:background="?android:attr/textColorHint" - app:layout_constraintBottom_toTopOf="@+id/bottom_divider" + app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toStartOf="@+id/track_chapters" app:layout_constraintStart_toEndOf="@+id/track_status" app:layout_constraintTop_toTopOf="parent" /> @@ -133,7 +133,7 @@ android:layout_marginBottom="8dp" android:alpha="0.25" android:background="?android:attr/textColorHint" - app:layout_constraintBottom_toTopOf="@+id/bottom_divider" + app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toStartOf="@+id/track_score" app:layout_constraintStart_toEndOf="@+id/track_chapters" app:layout_constraintTop_toTopOf="parent" /> @@ -153,59 +153,6 @@ app:layout_constraintTop_toBottomOf="@+id/top_divider" tools:text="10" /> - - - - - - - - diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 0c1018d94..d60a9143c 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -564,8 +564,6 @@ Status Status Started - Started reading date - Finished reading date Type Author Invalid date supplied