Remove duplicated class

This commit is contained in:
Benoit Marty 2020-05-08 15:47:34 +02:00
parent ffd8ac859d
commit d3bc9f52fd
2 changed files with 7 additions and 50 deletions

View File

@ -23,6 +23,7 @@ import com.airbnb.mvrx.Loading
import com.airbnb.mvrx.Success
import com.google.i18n.phonenumbers.PhoneNumberUtil
import im.vector.riotx.R
import im.vector.riotx.core.epoxy.loadingItem
import im.vector.riotx.core.resources.ColorProvider
import im.vector.riotx.core.resources.StringProvider
import timber.log.Timber
@ -38,7 +39,7 @@ class DiscoverySettingsController @Inject constructor(
override fun buildModels(data: DiscoverySettingsState) {
when (data.identityServer) {
is Loading -> {
settingsLoadingItem {
loadingItem {
id("identityServerLoading")
}
}
@ -69,8 +70,8 @@ class DiscoverySettingsController @Inject constructor(
when (data.phoneNumbersList) {
is Incomplete -> {
settingsLoadingItem {
id("phoneLoading")
loadingItem {
id("msisdnLoading")
}
}
is Fail -> {
@ -165,17 +166,17 @@ class DiscoverySettingsController @Inject constructor(
}
when (data.emailList) {
is Incomplete -> {
settingsLoadingItem {
loadingItem {
id("mailLoading")
}
}
is Fail -> {
is Fail -> {
settingsInfoItem {
id("mailListError")
helperText(data.emailList.error.message)
}
}
is Success -> {
is Success -> {
val emails = data.emailList.invoke()
if (emails.isEmpty()) {
settingsInfoItem {

View File

@ -1,44 +0,0 @@
/*
* Copyright (c) 2020 New Vector Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package im.vector.riotx.features.discovery
import android.widget.ProgressBar
import android.widget.TextView
import androidx.core.view.isVisible
import com.airbnb.epoxy.EpoxyAttribute
import com.airbnb.epoxy.EpoxyModelClass
import com.airbnb.epoxy.EpoxyModelWithHolder
import im.vector.riotx.R
import im.vector.riotx.core.epoxy.VectorEpoxyHolder
import im.vector.riotx.core.extensions.setTextOrHide
@EpoxyModelClass(layout = R.layout.item_loading)
abstract class SettingsLoadingItem : EpoxyModelWithHolder<SettingsLoadingItem.Holder>() {
@EpoxyAttribute var loadingText: String? = null
override fun bind(holder: Holder) {
super.bind(holder)
holder.textView.setTextOrHide(loadingText)
holder.progressBar.isVisible = true
holder.progressBar.animate()
}
class Holder : VectorEpoxyHolder() {
val textView by bind<TextView>(R.id.loadingText)
val progressBar by bind<ProgressBar>(R.id.loadingProgress)
}
}