mirror of
https://github.com/gedoor/legado.git
synced 2024-07-06 23:47:49 +08:00
修改添加服务器配置时不回调 id自动生成
This commit is contained in:
parent
6d11d4e244
commit
aeb727b40b
@ -25,7 +25,7 @@ object AppConst {
|
||||
|
||||
const val MAX_THREAD = 9
|
||||
|
||||
const val DEFAULT_WEBDAV_ID = -1
|
||||
const val DEFAULT_WEBDAV_ID = -1L
|
||||
|
||||
val SCRIPT_ENGINE: RhinoScriptEngine by lazy {
|
||||
RhinoScriptEngine()
|
||||
|
@ -67,7 +67,6 @@ class ServerConfigDialog() : BaseDialogFragment(R.layout.dialog_webdav_server, t
|
||||
}
|
||||
|
||||
private fun upConfigView(server: Server?) {
|
||||
binding.etId.setText(server?.id?.toString())
|
||||
binding.etName.setText(server?.name)
|
||||
binding.spType.setSelection(
|
||||
when (server?.type) {
|
||||
@ -109,14 +108,7 @@ class ServerConfigDialog() : BaseDialogFragment(R.layout.dialog_webdav_server, t
|
||||
}
|
||||
|
||||
private fun getServer(): Server? {
|
||||
val id = kotlin.runCatching {
|
||||
binding.etId.text.toString().toLong()
|
||||
}.getOrNull()
|
||||
if (id == null) {
|
||||
toastOnUi("id不能为空")
|
||||
return null
|
||||
}
|
||||
val server = viewModel.mServer?.copy(id = id) ?: Server(id = id)
|
||||
val server = viewModel.mServer?.copy() ?: Server()
|
||||
server.name = binding.etName.text.toString()
|
||||
server.type = when (binding.spType.selectedItemPosition) {
|
||||
else -> Server.TYPE.WEBDAV
|
||||
@ -139,15 +131,15 @@ class ServerConfigDialog() : BaseDialogFragment(R.layout.dialog_webdav_server, t
|
||||
}
|
||||
|
||||
|
||||
override fun onDismiss(dialog: DialogInterface) {
|
||||
super.onDismiss(dialog)
|
||||
((parentFragment as? Callback) ?: (activity as? Callback))
|
||||
?.onDialogDismiss("serverConfig")
|
||||
}
|
||||
// override fun onDismiss(dialog: DialogInterface) {
|
||||
// super.onDismiss(dialog)
|
||||
// ((parentFragment as? Callback) ?: (activity as? Callback))
|
||||
// ?.onDialogDismiss("serverConfig")
|
||||
// }
|
||||
|
||||
interface Callback {
|
||||
// interface Callback {
|
||||
|
||||
fun onDialogDismiss(tag: String)
|
||||
// fun onDialogDismiss(tag: String)
|
||||
|
||||
}
|
||||
// }
|
||||
}
|
@ -28,21 +28,6 @@
|
||||
app:popupTheme="@style/AppTheme.PopupOverlay"
|
||||
app:titleTextAppearance="@style/ToolbarTitle" />
|
||||
|
||||
<io.legado.app.ui.widget.text.TextInputLayout
|
||||
android:id="@+id/til_id"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="ID"
|
||||
tools:ignore="HardcodedText">
|
||||
|
||||
<io.legado.app.lib.theme.view.ThemeEditText
|
||||
android:id="@+id/et_id"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:numeric="integer"
|
||||
tools:ignore="SpeakableTextPresentCheck,TouchTargetSizeCheck" />
|
||||
</io.legado.app.ui.widget.text.TextInputLayout>
|
||||
|
||||
<io.legado.app.ui.widget.text.TextInputLayout
|
||||
android:id="@+id/til_name"
|
||||
android:layout_width="match_parent"
|
||||
|
Loading…
Reference in New Issue
Block a user