testing mal sync

This commit is contained in:
LagradOst 2022-04-02 03:38:55 +02:00
parent 2a27c0360d
commit 6d2c609246
10 changed files with 491 additions and 439 deletions

View file

@ -109,7 +109,7 @@ class MALApi(index: Int) : AccountManager(index), SyncAPI {
@JsonProperty("updated_at") val updatedAt: String?,
@JsonProperty("media_type") val mediaType: String?,
@JsonProperty("status") val status: String?,
@JsonProperty("genres") val genres: ArrayList<Genres>,
@JsonProperty("genres") val genres: ArrayList<Genres>?,
@JsonProperty("my_list_status") val myListStatus: MyListStatus?,
@JsonProperty("num_episodes") val numEpisodes: Int?,
@JsonProperty("start_season") val startSeason: StartSeason?,
@ -117,12 +117,12 @@ class MALApi(index: Int) : AccountManager(index), SyncAPI {
@JsonProperty("source") val source: String?,
@JsonProperty("average_episode_duration") val averageEpisodeDuration: Int?,
@JsonProperty("rating") val rating: String?,
@JsonProperty("pictures") val pictures: ArrayList<MainPicture>,
@JsonProperty("pictures") val pictures: ArrayList<MainPicture>?,
@JsonProperty("background") val background: String?,
@JsonProperty("related_anime") val relatedAnime: ArrayList<RelatedAnime>,
@JsonProperty("related_manga") val relatedManga: ArrayList<String>,
@JsonProperty("recommendations") val recommendations: ArrayList<Recommendations>,
@JsonProperty("studios") val studios: ArrayList<Studios>,
@JsonProperty("related_anime") val relatedAnime: ArrayList<RelatedAnime>?,
@JsonProperty("related_manga") val relatedManga: ArrayList<String>?,
@JsonProperty("recommendations") val recommendations: ArrayList<Recommendations>?,
@JsonProperty("studios") val studios: ArrayList<Studios>?,
@JsonProperty("statistics") val statistics: Statistics?,
)
@ -136,7 +136,6 @@ class MALApi(index: Int) : AccountManager(index), SyncAPI {
@JsonProperty("name") val name: String? = null
)
data class MyListStatus(
@JsonProperty("status") val status: String? = null,
@JsonProperty("score") val score: Int? = null,
@ -172,7 +171,7 @@ class MALApi(index: Int) : AccountManager(index), SyncAPI {
}
}
private fun toSearchResult(node : Node?) : SyncAPI.SyncSearchResult? {
private fun toSearchResult(node: Node?): SyncAPI.SyncSearchResult? {
return SyncAPI.SyncSearchResult(
name = node?.title ?: return null,
syncApiName = this.name,
@ -205,19 +204,19 @@ class MALApi(index: Int) : AccountManager(index), SyncAPI {
else -> null
},
nextAiring = null,
studio = malAnime.studios.mapNotNull { it.name },
genres = malAnime.genres.map { it.name },
studio = malAnime.studios?.mapNotNull { it.name },
genres = malAnime.genres?.map { it.name },
trailerUrl = null,
startDate = parseDate(malAnime.startDate),
endDate = parseDate(malAnime.endDate),
recommendations = malAnime.recommendations.mapNotNull { rec ->
recommendations = malAnime.recommendations?.mapNotNull { rec ->
val node = rec.node ?: return@mapNotNull null
toSearchResult(node)
},
nextSeason = malAnime.relatedAnime.firstOrNull {
nextSeason = malAnime.relatedAnime?.firstOrNull {
return@firstOrNull it.relationType == "sequel"
}?.let { toSearchResult(it.node) },
prevSeason = malAnime.relatedAnime.firstOrNull {
}?.let { toSearchResult(it.node) },
prevSeason = malAnime.relatedAnime?.firstOrNull {
return@firstOrNull it.relationType == "prequel"
}?.let { toSearchResult(it.node) },
actors = null,
@ -229,7 +228,8 @@ class MALApi(index: Int) : AccountManager(index), SyncAPI {
override suspend fun getStatus(id: String): SyncAPI.SyncStatus? {
val internalId = id.toIntOrNull() ?: return null
val data = getDataAboutMalId(internalId)?.my_list_status //?: throw ErrorLoadingException("No my_list_status")
val data =
getDataAboutMalId(internalId)?.my_list_status //?: throw ErrorLoadingException("No my_list_status")
return SyncAPI.SyncStatus(
score = data?.score,
status = malStatusAsString.indexOf(data?.status),

View file

@ -11,15 +11,15 @@ import android.content.res.ColorStateList
import android.content.res.Configuration
import android.graphics.Rect
import android.net.Uri
import android.os.Build
import android.os.Bundle
import android.text.Editable
import android.view.LayoutInflater
import android.view.View
import android.view.View.GONE
import android.view.View.VISIBLE
import android.view.ViewGroup
import android.widget.ImageView
import android.widget.TextView
import android.widget.Toast
import android.widget.*
import androidx.annotation.StringRes
import androidx.appcompat.app.AlertDialog
import androidx.core.content.FileProvider
@ -27,6 +27,7 @@ import androidx.core.graphics.drawable.toBitmap
import androidx.core.view.isGone
import androidx.core.view.isVisible
import androidx.core.widget.NestedScrollView
import androidx.core.widget.doOnTextChanged
import androidx.fragment.app.Fragment
import androidx.lifecycle.ViewModelProvider
import androidx.preference.PreferenceManager
@ -1149,7 +1150,79 @@ class ResultFragment : Fragment(), PanelsChildGestureRegionObserver.GestureRegio
}
}
observe(syncModel.status) { status ->
context?.let { ctx ->
val arrayAdapter = ArrayAdapter<String>(ctx, R.layout.sort_bottom_single_choice)
/*
-1 -> None
0 -> Watching
1 -> Completed
2 -> OnHold
3 -> Dropped
4 -> PlanToWatch
5 -> ReWatching
*/
val items = listOf(
R.string.none,
R.string.type_watching,
R.string.type_completed,
R.string.type_on_hold,
R.string.type_dropped,
R.string.type_plan_to_watch,
R.string.type_re_watching
).map { ctx.getString(it) }
arrayAdapter.addAll(items)
result_sync_check?.choiceMode = AbsListView.CHOICE_MODE_SINGLE
result_sync_check?.adapter = arrayAdapter
UIHelper.setListViewHeightBasedOnItems(result_sync_check)
result_sync_check?.setOnItemClickListener { _, _, which, _ ->
syncModel.setStatus(which - 1)
}
result_sync_rating?.addOnChangeListener { _, value, _ ->
syncModel.setScore(value.toInt())
}
result_sync_add_episode?.setOnClickListener {
syncModel.setEpisodesDelta(1)
}
result_sync_sub_episode?.setOnClickListener {
syncModel.setEpisodesDelta(-1)
}
result_sync_current_episodes?.doOnTextChanged { text, start, before, count ->
if(count == before) return@doOnTextChanged
text?.toString()?.toIntOrNull()?.let { ep ->
syncModel.setEpisodes(ep)
}
}
}
observe(syncModel.metadata) { meta ->
when (meta) {
is Resource.Success -> {
val d = meta.value
result_sync_episodes?.max = (d.totalEpisodes ?: 0)*1000
normalSafeApiCall {
val ctx = result_sync_max_episodes?.context
result_sync_max_episodes?.text =
d.totalEpisodes?.let {
ctx?.getString(R.string.sync_total_episodes_some)?.format(it)
} ?: run {
ctx?.getString(R.string.sync_total_episodes_none)
}
}
}
is Resource.Loading -> {
result_sync_max_episodes?.text =
result_sync_max_episodes?.context?.getString(R.string.sync_total_episodes_none)
}
else -> {}
}
}
observe(syncModel.userData) { status ->
var closed = false
when (status) {
is Resource.Failure -> {
@ -1169,17 +1242,20 @@ class ResultFragment : Fragment(), PanelsChildGestureRegionObserver.GestureRegio
val d = status.value
result_sync_rating?.value = d.score?.toFloat() ?: 0.0f
/*when(d.status) {
-1 -> None
0 -> Watching
1 -> Completed
2 -> OnHold
3 -> Dropped
4 -> PlanToWatch
5 -> ReWatching
}*/
//d.status
result_sync_check?.setItemChecked(d.status + 1, true)
val watchedEpisodes = d.watchedEpisodes ?: 0
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
result_sync_episodes?.setProgress(watchedEpisodes * 1000, true)
} else {
result_sync_episodes?.progress = watchedEpisodes * 1000
}
result_sync_current_episodes?.text =
Editable.Factory.getInstance()?.newEditable(watchedEpisodes.toString())
normalSafeApiCall { // format might fail
context?.getString(R.string.sync_score_format)?.format(d.score ?: 0)?.let {
result_sync_score_text?.text = it
}
}
}
null -> {
closed = false
@ -1349,10 +1425,7 @@ class ResultFragment : Fragment(), PanelsChildGestureRegionObserver.GestureRegio
}
result_sync_set_score?.setOnClickListener {
// TODO set score
//syncModel.setScore(SyncAPI.SyncStatus(
// status =
//))
syncModel.publishUserData()
}
observe(viewModel.publicEpisodesCount) { count ->
@ -1455,7 +1528,7 @@ class ResultFragment : Fragment(), PanelsChildGestureRegionObserver.GestureRegio
setAniListSync(d.anilistId?.toString())
) {
syncModel.updateMetadata()
syncModel.updateStatus()
syncModel.updateUserData()
}
}

View file

@ -11,6 +11,7 @@ import com.lagradost.cloudstream3.syncproviders.OAuth2API.Companion.malApi
import com.lagradost.cloudstream3.syncproviders.SyncAPI
import kotlinx.coroutines.launch
class SyncViewModel : ViewModel() {
private val repos = SyncApis
@ -19,10 +20,10 @@ class SyncViewModel : ViewModel() {
val metadata: LiveData<Resource<SyncAPI.SyncResult>> get() = _metaResponse
private val _statusResponse: MutableLiveData<Resource<SyncAPI.SyncStatus>?> =
private val _userDataResponse: MutableLiveData<Resource<SyncAPI.SyncStatus>?> =
MutableLiveData(null)
val status: LiveData<Resource<SyncAPI.SyncStatus>?> get() = _statusResponse
val userData: LiveData<Resource<SyncAPI.SyncStatus>?> get() = _userDataResponse
// prefix, id
private val syncIds = hashMapOf<String, String>()
@ -35,29 +36,75 @@ class SyncViewModel : ViewModel() {
syncIds[aniListApi.idPrefix] = id
}
fun setScore(status: SyncAPI.SyncStatus) = viewModelScope.launch {
for ((prefix, id) in syncIds) {
repos.firstOrNull { it.idPrefix == prefix }?.score(id, status)
fun setEpisodesDelta(delta: Int) {
val user = userData.value
if (user is Resource.Success) {
user.value.watchedEpisodes?.plus(
delta
)?.let { episode ->
setEpisodes(episode)
}
}
updateStatus()
}
fun updateStatus() = viewModelScope.launch {
_statusResponse.postValue(Resource.Loading())
fun setEpisodes(episodes: Int) {
if (episodes < 0) return
val meta = metadata.value
if (meta is Resource.Success) {
meta.value.totalEpisodes?.let { max ->
if (episodes > max) {
setEpisodes(max)
return
}
}
}
val user = userData.value
if (user is Resource.Success) {
_userDataResponse.postValue(Resource.Success(user.value.copy(watchedEpisodes = episodes)))
}
}
fun setScore(score: Int) {
val user = userData.value
if (user is Resource.Success) {
_userDataResponse.postValue(Resource.Success(user.value.copy(score = score)))
}
}
fun setStatus(which: Int) {
if (which < -1 || which > 5) return // validate input
val user = userData.value
if (user is Resource.Success) {
_userDataResponse.postValue(Resource.Success(user.value.copy(status = which)))
}
}
fun publishUserData() = viewModelScope.launch {
val user = userData.value
if (user is Resource.Success) {
for ((prefix, id) in syncIds) {
repos.firstOrNull { it.idPrefix == prefix }?.score(id, user.value)
}
}
updateUserData()
}
fun updateUserData() = viewModelScope.launch {
_userDataResponse.postValue(Resource.Loading())
var lastError: Resource<SyncAPI.SyncStatus> = Resource.Failure(false, null, null, "No data")
for ((prefix, id) in syncIds) {
repos.firstOrNull { it.idPrefix == prefix }?.let {
val result = it.getStatus(id)
if (result is Resource.Success) {
_statusResponse.postValue(result)
_userDataResponse.postValue(result)
return@launch
} else if (result is Resource.Failure) {
lastError = result
}
}
}
_statusResponse.postValue(lastError)
_userDataResponse.postValue(lastError)
}
fun updateMetadata() = viewModelScope.launch {
@ -75,5 +122,6 @@ class SyncViewModel : ViewModel() {
}
}
_metaResponse.postValue(lastError)
setEpisodesDelta(0)
}
}

View file

@ -88,7 +88,7 @@ class SettingsFragment : PreferenceFragmentCompat() {
return uiModeManager?.currentModeType == Configuration.UI_MODE_TYPE_TELEVISION
}
const val accountEnabled = false
const val accountEnabled = true
}
private var beneneCount = 0

View file

@ -12,12 +12,11 @@ import android.content.res.Resources
import android.graphics.Color
import android.os.Build
import android.os.Bundle
import android.view.Gravity
import android.view.MenuItem
import android.view.View
import android.view.WindowManager
import android.view.*
import android.view.inputmethod.InputMethodManager
import android.widget.ImageView
import android.widget.ListAdapter
import android.widget.ListView
import androidx.annotation.AttrRes
import androidx.annotation.ColorInt
import androidx.annotation.IdRes
@ -71,6 +70,36 @@ object UIHelper {
)
}
/**
* Sets ListView height dynamically based on the height of the items.
*
* @param listView to be resized
* @return true if the listView is successfully resized, false otherwise
*/
fun setListViewHeightBasedOnItems(listView: ListView?) {
val listAdapter: ListAdapter = listView?.adapter ?: return
val numberOfItems: Int = listAdapter.count
// Get total height of all items.
var totalItemsHeight = 0
for (itemPos in 0 until numberOfItems) {
val item: View = listAdapter.getView(itemPos, null, listView)
item.measure(0, 0)
totalItemsHeight += item.measuredHeight
}
// Get total height of all item dividers.
val totalDividersHeight: Int = listView.dividerHeight *
(numberOfItems - 1)
// Set list height.
val params: ViewGroup.LayoutParams = listView.layoutParams
params.height = totalItemsHeight + totalDividersHeight
listView.layoutParams = params
listView.requestLayout()
}
fun Activity?.getSpanCount(): Int? {
val compactView = this?.getGridIsCompact() ?: return null
val spanCountLandscape = if (compactView) 2 else 6
@ -120,7 +149,7 @@ object UIHelper {
return color
}
fun ImageView?.setImage(url: String?) : Boolean {
fun ImageView?.setImage(url: String?): Boolean {
if (this == null || url.isNullOrBlank()) return false
return try {
GlideApp.with(this.context)
@ -316,7 +345,7 @@ object UIHelper {
fun Activity.showSystemUI() {
window.decorView.systemUiVisibility =
(View.SYSTEM_UI_FLAG_LAYOUT_STABLE or View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN)
(View.SYSTEM_UI_FLAG_LAYOUT_STABLE or View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN)
changeStatusBarState(isEmulatorSettings())

View file

@ -6,363 +6,265 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
<ScrollView
android:id="@+id/result_sync_holder"
tools:visibility="visible"
android:visibility="gone"
android:padding="16dp"
android:orientation="vertical"
android:id="@+id/result_sync_holder"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:textStyle="bold"
android:textSize="16sp"
android:layout_marginBottom="10dp"
android:text="MyAnimeList, AniList"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
android:layout_height="wrap_content">
<LinearLayout
android:visibility="visible"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:padding="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:src="@drawable/baseline_remove_24"
android:layout_gravity="end|center_vertical"
android:contentDescription="@string/result_share"
app:tint="?attr/textColor" />
<EditText
android:id="@+id/result_sync_current_episodes"
style="@style/AppEditStyle"
tools:hint="20"
android:textSize="20sp"
android:inputType="number"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:ignore="LabelFor" />
<TextView
android:id="@+id/result_sync_max_episodes"
android:layout_gravity="center_vertical"
android:paddingBottom="1dp"
android:textSize="20sp"
android:textColor="?attr/textColor"
tools:text="/30"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<ImageView
android:padding="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:src="@drawable/ic_baseline_add_24"
android:layout_gravity="end|center_vertical"
android:contentDescription="@string/result_share"
app:tint="?attr/textColor" />
</LinearLayout>
<androidx.core.widget.ContentLoadingProgressBar
android:id="@+id/result_sync_episodes"
android:padding="10dp"
android:layout_width="match_parent"
android:layout_height="20dp"
android:progress="50"
android:indeterminate="false"
android:progressBackgroundTint="?attr/colorPrimary"
style="?android:attr/progressBarStyleHorizontal"
android:max="100"
android:layout_gravity="end|center_vertical"
tools:visibility="visible" />
<!--
<LinearLayout
android:layout_marginBottom="10dp"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_gravity="center_vertical"
android:padding="10dp"
android:textSize="17sp"
android:textColor="?attr/textColor"
android:text="Status:"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<com.google.android.material.button.MaterialButton
android:layout_height="30dp"
android:text="Watching"
android:minWidth="0dp"
android:layout_width="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginStart="0dp"
style="@style/BlackButton" />
</LinearLayout>
<GridLayout
android:orientation="horizontal"
android:columnCount="2"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.button.MaterialButton
android:id="@+id/sync_completed"
android:nextFocusRight="@id/sync_on_hold"
android:nextFocusDown="@id/sync_plan_to_watch"
android:layout_row="0"
android:layout_column="0"
android:text="@string/type_completed"
style="@style/SyncButton" />
<com.google.android.material.button.MaterialButton
android:id="@+id/sync_on_hold"
android:nextFocusDown="@id/sync_watching"
android:nextFocusLeft="@id/sync_completed"
android:layout_row="0"
android:layout_column="1"
style="@style/SyncButton"
android:text="@string/type_on_hold" />
<com.google.android.material.button.MaterialButton
android:id="@+id/sync_plan_to_watch"
android:nextFocusRight="@id/sync_plan_to_watch"
android:nextFocusDown="@id/sync_dropped"
android:nextFocusUp="@id/sync_completed"
android:layout_row="1"
android:layout_column="0"
android:text="@string/type_plan_to_watch"
style="@style/SyncButton"
/>
<com.google.android.material.button.MaterialButton
android:id="@+id/sync_watching"
android:nextFocusLeft="@id/sync_plan_to_watch"
android:nextFocusDown="@id/sync_dropped"
android:nextFocusUp="@id/sync_on_hold"
android:layout_row="1"
android:layout_column="1"
style="@style/SyncButton"
android:text="@string/type_watching" />
</GridLayout>
<com.google.android.material.button.MaterialButton
android:id="@+id/sync_dropped"
android:nextFocusUp="@id/sync_plan_to_watch"
android:layout_width="match_parent"
style="@style/SyncButton"
android:text="@string/type_dropped" />-->
<LinearLayout
android:orientation="horizontal"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_gravity="center_vertical"
android:padding="10dp"
android:textSize="17sp"
android:textColor="?attr/textColor"
android:text="Rated:"
android:visibility="gone"
android:textStyle="bold"
android:textSize="16sp"
android:layout_marginBottom="10dp"
android:text="MyAnimeList, AniList"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<!--
<LinearLayout
android:visibility="visible"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/result_sync_sub_episode"
android:padding="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:src="@drawable/baseline_remove_24"
android:layout_gravity="end|center_vertical"
app:tint="?attr/textColor" />
<EditText
android:id="@+id/result_sync_current_episodes"
style="@style/AppEditStyle"
tools:hint="20"
android:textSize="20sp"
android:inputType="number"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:ignore="LabelFor" />
<TextView
android:id="@+id/result_sync_max_episodes"
android:layout_gravity="center_vertical"
android:paddingBottom="1dp"
android:textSize="20sp"
android:textColor="?attr/textColor"
tools:text="30"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<ImageView
android:id="@+id/result_sync_add_episode"
android:padding="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:src="@drawable/ic_baseline_add_24"
android:layout_gravity="end|center_vertical"
app:tint="?attr/textColor" />
</LinearLayout>
<androidx.core.widget.ContentLoadingProgressBar
android:id="@+id/result_sync_episodes"
android:padding="10dp"
android:layout_width="match_parent"
android:layout_height="20dp"
android:progress="0"
android:indeterminate="false"
android:progressBackgroundTint="?attr/colorPrimary"
style="?android:attr/progressBarStyleHorizontal"
android:max="100"
android:layout_gravity="end|center_vertical"
tools:visibility="visible" />
<!--
<LinearLayout
android:layout_marginBottom="10dp"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_gravity="center_vertical"
android:padding="10dp"
android:textSize="17sp"
android:textColor="?attr/textColor"
android:text="Status:"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<com.google.android.material.button.MaterialButton
android:layout_height="30dp"
android:text="Watching"
android:minWidth="0dp"
android:layout_width="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginStart="0dp"
style="@style/BlackButton" />
</LinearLayout>
<GridLayout
android:orientation="horizontal"
android:columnCount="2"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.button.MaterialButton
android:id="@+id/sync_completed"
android:nextFocusRight="@id/sync_on_hold"
android:nextFocusDown="@id/sync_plan_to_watch"
android:layout_row="0"
android:layout_column="0"
android:text="@string/type_completed"
style="@style/SyncButton" />
<com.google.android.material.button.MaterialButton
android:id="@+id/sync_on_hold"
android:nextFocusDown="@id/sync_watching"
android:nextFocusLeft="@id/sync_completed"
android:layout_row="0"
android:layout_column="1"
style="@style/SyncButton"
android:text="@string/type_on_hold" />
<com.google.android.material.button.MaterialButton
android:id="@+id/sync_plan_to_watch"
android:nextFocusRight="@id/sync_plan_to_watch"
android:nextFocusDown="@id/sync_dropped"
android:nextFocusUp="@id/sync_completed"
android:layout_row="1"
android:layout_column="0"
android:text="@string/type_plan_to_watch"
style="@style/SyncButton"
/>
<com.google.android.material.button.MaterialButton
android:id="@+id/sync_watching"
android:nextFocusLeft="@id/sync_plan_to_watch"
android:nextFocusDown="@id/sync_dropped"
android:nextFocusUp="@id/sync_on_hold"
android:layout_row="1"
android:layout_column="1"
style="@style/SyncButton"
android:text="@string/type_watching" />
</GridLayout>
<com.google.android.material.button.MaterialButton
android:layout_height="30dp"
android:text="7/10"
android:minWidth="0dp"
android:id="@+id/sync_dropped"
android:nextFocusUp="@id/sync_plan_to_watch"
android:layout_width="match_parent"
style="@style/SyncButton"
android:text="@string/type_dropped" />-->
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_gravity="center_vertical"
android:padding="10dp"
android:textSize="17sp"
android:textColor="?attr/textColor"
android:text="@string/sync_score"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<com.google.android.material.button.MaterialButton
android:id="@+id/result_sync_score_text"
android:layout_height="30dp"
android:text="7/10"
android:minWidth="0dp"
android:layout_width="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginStart="0dp"
style="@style/BlackButton" />
</LinearLayout>
<com.google.android.material.slider.Slider
android:id="@+id/result_sync_rating"
android:valueFrom="0"
android:valueTo="10"
android:value="4"
android:stepSize="1"
app:tickVisible="false"
android:layout_marginStart="-5dp"
android:layout_marginEnd="-5dp"
app:thumbRadius="10dp"
app:labelStyle="@style/BlackLabel"
android:layout_width="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginStart="0dp"
style="@style/BlackButton" />-->
android:layout_height="wrap_content" />
<FrameLayout
android:visibility="gone"
android:paddingTop="12dp"
android:paddingBottom="12dp"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/home_parent_item_title"
style="@style/WatchHeaderText"
tools:text="Recommended" />
<ImageView
app:tint="?attr/textColor"
android:layout_marginEnd="5dp"
android:layout_gravity="end|center_vertical"
android:src="@drawable/ic_baseline_arrow_forward_24"
android:layout_width="30dp"
android:layout_height="match_parent"
android:contentDescription="@string/home_more_info" />
</FrameLayout>
<ListView
android:id="@+id/result_sync_check"
tools:listitem="@layout/sort_bottom_single_choice"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_rowWeight="1" />
<com.google.android.material.button.MaterialButton
android:visibility="gone"
android:layout_marginTop="10dp"
android:layout_width="match_parent"
style="@style/WhiteButton"
android:text="@string/type_watching" />
<com.google.android.material.button.MaterialButton
android:id="@+id/result_sync_set_score"
android:layout_marginTop="10dp"
android:layout_width="match_parent"
style="@style/BlackButton"
app:icon="@drawable/baseline_sync_24"
android:text="@string/upload_sync" />
</LinearLayout>
<com.google.android.material.slider.Slider
android:id="@+id/result_sync_rating"
android:valueFrom="0"
android:valueTo="10"
android:value="4"
android:stepSize="1"
app:tickVisible="false"
android:layout_marginStart="-5dp"
android:layout_marginEnd="-5dp"
app:thumbRadius="10dp"
app:labelStyle="@style/BlackLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<FrameLayout
android:visibility="gone"
android:paddingTop="12dp"
android:paddingBottom="12dp"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/home_parent_item_title"
style="@style/WatchHeaderText"
tools:text="Recommended" />
<ImageView
app:tint="?attr/textColor"
android:layout_marginEnd="5dp"
android:layout_gravity="end|center_vertical"
android:src="@drawable/ic_baseline_arrow_forward_24"
android:layout_width="30dp"
android:layout_height="match_parent"
android:contentDescription="@string/home_more_info" />
</FrameLayout>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
style="@style/AppTextViewStyle"
android:id="@android:id/text1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?android:attr/listPreferredItemHeightSmall"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@color/text_selection_color"
android:textSize="16sp"
android:textStyle="bold"
android:gravity="center_vertical"
android:paddingStart="12dp"
android:paddingEnd="7dip"
android:text="@string/type_watching"
android:checkMark="?android:attr/listChoiceIndicatorSingle"
android:ellipsize="marquee"
android:foreground="?attr/selectableItemBackgroundBorderless"
tools:drawableTint="?attr/textColor"
android:drawablePadding="20dp"
app:drawableTint="@color/check_selection_color"
app:drawableStartCompat="@drawable/ic_baseline_check_24" />
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
style="@style/AppTextViewStyle"
android:id="@android:id/text1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?android:attr/listPreferredItemHeightSmall"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@color/text_selection_color"
android:textSize="16sp"
android:textStyle="bold"
android:gravity="center_vertical"
android:paddingStart="12dp"
android:paddingEnd="7dip"
android:text="@string/type_on_hold"
android:checkMark="?android:attr/listChoiceIndicatorSingle"
android:ellipsize="marquee"
android:foreground="?attr/selectableItemBackgroundBorderless"
tools:drawableTint="?attr/textColor"
android:drawablePadding="20dp"
app:drawableTint="@color/check_selection_color"
app:drawableStartCompat="@drawable/ic_baseline_check_24" />
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
style="@style/AppTextViewStyle"
android:id="@android:id/text1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?android:attr/listPreferredItemHeightSmall"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@color/text_selection_color"
android:textSize="16sp"
android:textStyle="bold"
android:gravity="center_vertical"
android:paddingStart="12dp"
android:paddingEnd="7dip"
android:text="@string/type_completed"
android:checkMark="?android:attr/listChoiceIndicatorSingle"
android:ellipsize="marquee"
android:foreground="?attr/selectableItemBackgroundBorderless"
tools:drawableTint="?attr/textColor"
android:drawablePadding="20dp"
app:drawableTint="@color/check_selection_color"
app:drawableStartCompat="@drawable/ic_baseline_check_24" />
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
style="@style/AppTextViewStyle"
android:id="@android:id/text1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?android:attr/listPreferredItemHeightSmall"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@color/text_selection_color"
android:textSize="16sp"
android:textStyle="bold"
android:gravity="center_vertical"
android:paddingStart="12dp"
android:paddingEnd="7dip"
android:text="@string/type_plan_to_watch"
android:checkMark="?android:attr/listChoiceIndicatorSingle"
android:ellipsize="marquee"
android:foreground="?attr/selectableItemBackgroundBorderless"
tools:drawableTint="?attr/textColor"
android:drawablePadding="20dp"
app:drawableTint="@color/check_selection_color"
app:drawableStartCompat="@drawable/ic_baseline_check_24" />
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
style="@style/AppTextViewStyle"
android:id="@android:id/text1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?android:attr/listPreferredItemHeightSmall"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@color/text_selection_color"
android:textSize="16sp"
android:textStyle="bold"
android:gravity="center_vertical"
android:paddingStart="12dp"
android:paddingEnd="7dip"
android:text="@string/type_dropped"
android:checkMark="?android:attr/listChoiceIndicatorSingle"
android:ellipsize="marquee"
android:foreground="?attr/selectableItemBackgroundBorderless"
tools:drawableTint="?attr/textColor"
android:drawablePadding="20dp"
app:drawableTint="@color/check_selection_color"
app:drawableStartCompat="@drawable/ic_baseline_check_24" />
<com.google.android.material.button.MaterialButton
android:visibility="gone"
android:layout_marginTop="10dp"
android:layout_width="match_parent"
style="@style/WhiteButton"
android:text="@string/type_watching" />
<com.google.android.material.button.MaterialButton
android:id="@+id/result_sync_set_score"
android:layout_marginTop="10dp"
android:layout_width="match_parent"
style="@style/BlackButton"
app:icon="@drawable/baseline_sync_24"
android:text="@string/upload_sync" />
</LinearLayout>
</ScrollView>
<com.facebook.shimmer.ShimmerFrameLayout
tools:visibility="gone"
android:id="@+id/result_sync_loading_shimmer"
app:shimmer_base_alpha="0.2"
app:shimmer_highlight_alpha="0.3"
@ -378,32 +280,45 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<Space
android:layout_width="match_parent"
android:layout_height="30dp"/>
android:layout_height="30dp" />
<include layout="@layout/loading_line_short" />
<include layout="@layout/loading_line" />
<Space
android:layout_width="match_parent"
android:layout_height="30dp"/>
android:layout_height="30dp" />
<include layout="@layout/loading_line_short" />
<include layout="@layout/loading_line" />
<Space
android:layout_width="match_parent"
android:layout_height="30dp"/>
android:layout_height="30dp" />
<include layout="@layout/loading_line_short" />
<include layout="@layout/loading_line_short" />
<include layout="@layout/loading_line_short" />
<include layout="@layout/loading_line_short" />
<include layout="@layout/loading_line_short" />
<Space
android:layout_width="match_parent"
android:layout_height="30dp"/>
android:layout_height="30dp" />
<include layout="@layout/loading_line" />
<include layout="@layout/loading_line" />
</LinearLayout>
</com.facebook.shimmer.ShimmerFrameLayout>
</FrameLayout>

View file

@ -1,23 +1,7 @@
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
style="@style/AppTextViewStyle"
style="@style/CheckLabel"
android:id="@android:id/text1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?android:attr/listPreferredItemHeightSmall"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@color/text_selection_color"
android:textSize="16sp"
android:textStyle="bold"
android:gravity="center_vertical"
android:paddingStart="12dp"
android:paddingEnd="7dip"
tools:text="TEST"
android:checkMark="?android:attr/listChoiceIndicatorSingle"
android:ellipsize="marquee"
android:foreground="?attr/selectableItemBackgroundBorderless"
tools:drawableTint="?attr/textColor"
android:drawablePadding="20dp"
app:drawableTint="?attr/textColor"
tools:text="hello"
app:drawableStartCompat="@drawable/ic_baseline_add_24" />

View file

@ -14,25 +14,7 @@
-->
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
style="@style/AppTextViewStyle"
android:id="@android:id/text1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?android:attr/listPreferredItemHeightSmall"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@color/text_selection_color"
android:textSize="16sp"
android:textStyle="bold"
android:gravity="center_vertical"
android:paddingStart="12dp"
android:paddingEnd="7dip"
tools:text="TEST"
android:checkMark="?android:attr/listChoiceIndicatorSingle"
android:ellipsize="marquee"
android:foreground="?attr/selectableItemBackgroundBorderless"
tools:drawableTint="?attr/textColor"
android:drawablePadding="20dp"
app:drawableTint="@color/check_selection_color"
app:drawableStartCompat="@drawable/ic_baseline_check_24" />
style="@style/CheckLabel"
tools:text="hello"
android:id="@android:id/text1" />

View file

@ -395,7 +395,10 @@
<string name="add_sync">Add tracking</string>
<string name="added_sync_format" formatted="true">Added %s</string>
<string name="upload_sync">Sync</string>
<string name="sync_score">Rated</string>
<string name="sync_score_format" formatted="true">%d / 10</string>
<string name="sync_total_episodes_none">/??</string>
<string name="sync_total_episodes_some" formatted="true">/%d</string>
<!-- ============ -->
<string name="none">None</string>
<string name="normal">Normal</string>

View file

@ -370,6 +370,24 @@
<item name="android:textColor">?attr/textColor</item>
</style>
<style name="CheckLabel" parent="@style/AppTextViewStyle">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:minHeight">?android:attr/listPreferredItemHeightSmall</item>
<item name="android:textColor">@color/text_selection_color</item>
<item name="android:textSize">16sp</item>
<item name="android:textStyle">bold</item>
<item name="android:gravity">center_vertical</item>
<item name="android:paddingStart">12dp</item>
<item name="android:paddingEnd">12dp</item>
<item name="android:checkMark">?android:attr/listChoiceIndicatorSingle</item>
<item name="android:ellipsize">marquee</item>
<item name="android:foreground">?attr/selectableItemBackgroundBorderless</item>
<item name="android:drawablePadding">20dp</item>
<item name="drawableTint">@color/check_selection_color</item>
<item name="drawableStartCompat">@drawable/ic_baseline_check_24</item>
</style>
<style name="BlackButton" parent="NiceButton">
<item name="strokeColor">?attr/textColor</item>
<item name="backgroundTint">?attr/iconGrayBackground</item>