pull/1171/head
gedoor 3 years ago
parent 8e334a3f90
commit 83330cf30d
  1. 5
      app/src/main/AndroidManifest.xml
  2. 61
      app/src/main/java/io/legado/app/ui/association/ImportRssSourceActivity.kt

@ -335,11 +335,6 @@
<data android:scheme="yuedu" />
</intent-filter>
</activity>
<!-- 导入订阅源 -->
<activity
android:name=".ui.association.ImportRssSourceActivity"
android:configChanges="locale|keyboardHidden|orientation|screenSize|smallestScreenSize|screenLayout"
android:theme="@style/AppTheme.Transparent" />
<!-- 打开文件 -->
<activity
android:name=".ui.association.FileAssociationActivity"

@ -1,61 +0,0 @@
package io.legado.app.ui.association
import android.os.Bundle
import androidx.activity.viewModels
import io.legado.app.R
import io.legado.app.base.VMBaseActivity
import io.legado.app.constant.Theme
import io.legado.app.databinding.ActivityTranslucenceBinding
import io.legado.app.help.IntentDataHelp
import io.legado.app.lib.dialogs.alert
import io.legado.app.utils.viewbindingdelegate.viewBinding
class ImportRssSourceActivity :
VMBaseActivity<ActivityTranslucenceBinding, ImportRssSourceViewModel>(
theme = Theme.Transparent
) {
override val binding by viewBinding(ActivityTranslucenceBinding::inflate)
override val viewModel by viewModels<ImportRssSourceViewModel>()
override fun onActivityCreated(savedInstanceState: Bundle?) {
binding.rotateLoading.show()
viewModel.errorLiveData.observe(this, {
binding.rotateLoading.hide()
errorDialog(it)
})
viewModel.successLiveData.observe(this, {
binding.rotateLoading.hide()
if (it > 0) {
ImportRssSourceDialog().show(supportFragmentManager, "SourceDialog")
} else {
errorDialog(getString(R.string.wrong_format))
}
})
initData()
}
private fun initData() {
intent.getStringExtra("dataKey")?.let {
IntentDataHelp.getData<String>(it)?.let { source ->
viewModel.importSource(source)
return
}
}
intent.getStringExtra("source")?.let {
viewModel.importSource(it)
return
}
finish()
}
private fun errorDialog(msg: String) {
alert(getString(R.string.error), msg) {
okButton { }
onDismiss {
finish()
}
}.show()
}
}
Loading…
Cancel
Save