pull/306/head
gedoor 4 years ago
parent 3916651984
commit ceb2cd600e
  1. 6
      app/src/main/java/io/legado/app/ui/association/ImportBookSourceActivity.kt
  2. 6
      app/src/main/java/io/legado/app/ui/association/ImportReplaceRuleActivity.kt
  3. 6
      app/src/main/java/io/legado/app/ui/association/ImportRssSourceActivity.kt
  4. 13
      app/src/main/res/layout/activity_translucence.xml

@ -13,6 +13,7 @@ import io.legado.app.lib.dialogs.noButton
import io.legado.app.lib.dialogs.okButton import io.legado.app.lib.dialogs.okButton
import io.legado.app.utils.applyTint import io.legado.app.utils.applyTint
import io.legado.app.utils.getViewModel import io.legado.app.utils.getViewModel
import kotlinx.android.synthetic.main.activity_translucence.*
import org.jetbrains.anko.toast import org.jetbrains.anko.toast
class ImportBookSourceActivity : VMBaseActivity<ImportBookSourceViewModel>( class ImportBookSourceActivity : VMBaseActivity<ImportBookSourceViewModel>(
@ -24,10 +25,13 @@ class ImportBookSourceActivity : VMBaseActivity<ImportBookSourceViewModel>(
get() = getViewModel(ImportBookSourceViewModel::class.java) get() = getViewModel(ImportBookSourceViewModel::class.java)
override fun onActivityCreated(savedInstanceState: Bundle?) { override fun onActivityCreated(savedInstanceState: Bundle?) {
rotate_loading.show()
viewModel.errorLiveData.observe(this, Observer { viewModel.errorLiveData.observe(this, Observer {
rotate_loading.hide()
errorDialog(it) errorDialog(it)
}) })
viewModel.successLiveData.observe(this, Observer { viewModel.successLiveData.observe(this, Observer {
rotate_loading.hide()
successDialog(it) successDialog(it)
}) })
initData() initData()
@ -58,7 +62,9 @@ class ImportBookSourceActivity : VMBaseActivity<ImportBookSourceViewModel>(
} }
} }
else -> { else -> {
rotate_loading.hide()
toast("格式不对") toast("格式不对")
finish()
} }
} }
} }

@ -13,6 +13,7 @@ import io.legado.app.lib.dialogs.noButton
import io.legado.app.lib.dialogs.okButton import io.legado.app.lib.dialogs.okButton
import io.legado.app.utils.applyTint import io.legado.app.utils.applyTint
import io.legado.app.utils.getViewModel import io.legado.app.utils.getViewModel
import kotlinx.android.synthetic.main.activity_translucence.*
import org.jetbrains.anko.toast import org.jetbrains.anko.toast
class ImportReplaceRuleActivity : VMBaseActivity<ImportReplaceRuleViewModel>( class ImportReplaceRuleActivity : VMBaseActivity<ImportReplaceRuleViewModel>(
@ -24,10 +25,13 @@ class ImportReplaceRuleActivity : VMBaseActivity<ImportReplaceRuleViewModel>(
get() = getViewModel(ImportReplaceRuleViewModel::class.java) get() = getViewModel(ImportReplaceRuleViewModel::class.java)
override fun onActivityCreated(savedInstanceState: Bundle?) { override fun onActivityCreated(savedInstanceState: Bundle?) {
rotate_loading.show()
viewModel.errorLiveData.observe(this, Observer { viewModel.errorLiveData.observe(this, Observer {
rotate_loading.hide()
errorDialog(it) errorDialog(it)
}) })
viewModel.successLiveData.observe(this, Observer { viewModel.successLiveData.observe(this, Observer {
rotate_loading.hide()
successDialog(it) successDialog(it)
}) })
initData() initData()
@ -58,7 +62,9 @@ class ImportReplaceRuleActivity : VMBaseActivity<ImportReplaceRuleViewModel>(
} }
} }
else -> { else -> {
rotate_loading.hide()
toast("格式不对") toast("格式不对")
finish()
} }
} }
} }

@ -13,6 +13,7 @@ import io.legado.app.lib.dialogs.noButton
import io.legado.app.lib.dialogs.okButton import io.legado.app.lib.dialogs.okButton
import io.legado.app.utils.applyTint import io.legado.app.utils.applyTint
import io.legado.app.utils.getViewModel import io.legado.app.utils.getViewModel
import kotlinx.android.synthetic.main.activity_translucence.*
import org.jetbrains.anko.toast import org.jetbrains.anko.toast
class ImportRssSourceActivity : VMBaseActivity<ImportRssSourceViewModel>( class ImportRssSourceActivity : VMBaseActivity<ImportRssSourceViewModel>(
@ -24,10 +25,13 @@ class ImportRssSourceActivity : VMBaseActivity<ImportRssSourceViewModel>(
get() = getViewModel(ImportRssSourceViewModel::class.java) get() = getViewModel(ImportRssSourceViewModel::class.java)
override fun onActivityCreated(savedInstanceState: Bundle?) { override fun onActivityCreated(savedInstanceState: Bundle?) {
rotate_loading.show()
viewModel.errorLiveData.observe(this, Observer { viewModel.errorLiveData.observe(this, Observer {
rotate_loading.hide()
errorDialog(it) errorDialog(it)
}) })
viewModel.successLiveData.observe(this, Observer { viewModel.successLiveData.observe(this, Observer {
rotate_loading.hide()
successDialog(it) successDialog(it)
}) })
initData() initData()
@ -58,7 +62,9 @@ class ImportRssSourceActivity : VMBaseActivity<ImportRssSourceViewModel>(
} }
} }
else -> { else -> {
rotate_loading.hide()
toast("格式不对") toast("格式不对")
finish()
} }
} }
} }

@ -2,6 +2,19 @@
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="@color/transparent50"> android:background="@color/transparent50">
<io.legado.app.ui.widget.anima.RotateLoading
android:id="@+id/rotate_loading"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_margin="6dp"
android:visibility="gone"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:loading_width="2dp" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
Loading…
Cancel
Save