Skip to content

Commit

Permalink
change from spinner to text for now
Browse files Browse the repository at this point in the history
  • Loading branch information
nonproto committed Sep 1, 2019
1 parent 973fd93 commit d9ce8d2
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import android.support.v4.content.pm.ShortcutInfoCompat
import android.support.v4.content.pm.ShortcutManagerCompat
import android.support.v4.graphics.drawable.IconCompat
import android.view.*
import android.widget.ArrayAdapter
import android.widget.Toast
import com.afollestad.materialdialogs.MaterialDialog
import com.bumptech.glide.load.engine.DiskCacheStrategy
Expand All @@ -30,7 +29,6 @@ import com.mikepenz.iconics.IconicsDrawable
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.database.models.Category
import eu.kanade.tachiyomi.data.database.models.Manga
import eu.kanade.tachiyomi.data.database.models.Manga.Companion.toDatabaseInt
import eu.kanade.tachiyomi.data.glide.GlideApp
import eu.kanade.tachiyomi.data.notification.NotificationReceiver
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
Expand Down Expand Up @@ -125,16 +123,6 @@ class MangaInfoController : NucleusController<MangaInfoPresenter>(),
manga_cover.longClicks().subscribeUntilDestroy {
copyToClipboard(view.context.getString(R.string.title), presenter.manga.title)
}
ArrayAdapter.createFromResource(
this.applicationContext,
R.array.follows_options,
android.R.layout.simple_spinner_item
).also { adapter ->
// Specify the layout to use when the list of choices appears
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item)
// Apply the adapter to the spinner
follows_spinner.adapter = adapter
}
}

override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
Expand Down Expand Up @@ -233,10 +221,16 @@ class MangaInfoController : NucleusController<MangaInfoPresenter>(),
else -> R.string.unknown
})

manga.follow_status.let {
follows_spinner.setSelection(manga.follow_status!!.toDatabaseInt())
}

// Update status TextView.
follows_spinner.setText(when (manga.follow_status) {
SManga.FollowStatus.COMPLETED -> R.string.follows_completed
SManga.FollowStatus.DROPPED -> R.string.follows_dropped
SManga.FollowStatus.ON_HOLD -> R.string.follows_on_hold
SManga.FollowStatus.PLAN_TO_READ -> R.string.follows_plan_to_read
SManga.FollowStatus.READING -> R.string.follows_reading
SManga.FollowStatus.RE_READING -> R.string.follows_re_reading
else -> R.string.follows_unfollowed
})

// Set the favorite drawable to the correct one.
setFavoriteDrawable(manga.favorite)
Expand Down
6 changes: 4 additions & 2 deletions app/src/main/res/layout-land/manga_info_controller.xml
Original file line number Diff line number Diff line change
Expand Up @@ -192,11 +192,13 @@
app:layout_constraintTop_toBottomOf="@+id/manga_status_label"
app:layout_constraintLeft_toLeftOf="parent"/>

<Spinner
<TextView
android:id="@+id/follows_spinner"
android:layout_width="wrap_content"
style="@style/TextAppearance.Medium.Body2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:paddingTop="5dp"
android:paddingStart="5dp"
app:layout_constraintLeft_toRightOf="@+id/manga_lang_flag"
app:layout_constraintTop_toBottomOf="@+id/manga_status_label" />

Expand Down
6 changes: 4 additions & 2 deletions app/src/main/res/layout/manga_info_controller.xml
Original file line number Diff line number Diff line change
Expand Up @@ -216,11 +216,13 @@
app:layout_constraintTop_toBottomOf="@+id/manga_status_label"
app:layout_constraintLeft_toLeftOf="parent"/>

<Spinner
<TextView
android:id="@+id/follows_spinner"
android:layout_width="wrap_content"
style="@style/TextAppearance.Medium.Body2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:paddingTop="5dp"
android:paddingStart="5dp"
app:layout_constraintLeft_toRightOf="@+id/manga_lang_flag"
app:layout_constraintTop_toBottomOf="@+id/manga_status_label" />

Expand Down

0 comments on commit d9ce8d2

Please sign in to comment.