|
|
|
@ -48,7 +48,7 @@ class RssSourceEditActivity : |
|
|
|
|
private val qrCodeResult = registerForActivityResult(QrCodeResult()) { |
|
|
|
|
it?.let { |
|
|
|
|
viewModel.importSource(it) { source: RssSource -> |
|
|
|
|
upRecyclerView(source) |
|
|
|
|
upSourceView(source) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -57,7 +57,7 @@ class RssSourceEditActivity : |
|
|
|
|
softKeyboardTool.attachToWindow(window) |
|
|
|
|
initView() |
|
|
|
|
viewModel.initData(intent) { |
|
|
|
|
upRecyclerView() |
|
|
|
|
upSourceView() |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -134,7 +134,7 @@ class RssSourceEditActivity : |
|
|
|
|
R.id.menu_auto_complete -> viewModel.autoComplete = !viewModel.autoComplete |
|
|
|
|
R.id.menu_copy_source -> sendToClip(GSON.toJson(getRssSource())) |
|
|
|
|
R.id.menu_qr_code_camera -> qrCodeResult.launch() |
|
|
|
|
R.id.menu_paste_source -> viewModel.pasteSource { upRecyclerView(it) } |
|
|
|
|
R.id.menu_paste_source -> viewModel.pasteSource { upSourceView(it) } |
|
|
|
|
R.id.menu_share_str -> share(GSON.toJson(getRssSource())) |
|
|
|
|
R.id.menu_share_qr -> shareWithQr( |
|
|
|
|
GSON.toJson(getRssSource()), |
|
|
|
@ -151,10 +151,11 @@ class RssSourceEditActivity : |
|
|
|
|
binding.recyclerView.adapter = adapter |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private fun upRecyclerView(source: RssSource? = viewModel.rssSource) { |
|
|
|
|
private fun upSourceView(source: RssSource? = viewModel.rssSource) { |
|
|
|
|
source?.let { |
|
|
|
|
binding.cbIsEnable.isChecked = source.enabled |
|
|
|
|
binding.cbSingleUrl.isChecked = source.singleUrl |
|
|
|
|
binding.cbIsEnableCookie.isChecked = source.enabledCookieJar == true |
|
|
|
|
binding.cbEnableJs.isChecked = source.enableJs |
|
|
|
|
binding.cbEnableBaseUrl.isChecked = source.loadWithBaseUrl |
|
|
|
|
} |
|
|
|
@ -192,6 +193,7 @@ class RssSourceEditActivity : |
|
|
|
|
val source = viewModel.rssSource |
|
|
|
|
source.enabled = binding.cbIsEnable.isChecked |
|
|
|
|
source.singleUrl = binding.cbSingleUrl.isChecked |
|
|
|
|
source.enabledCookieJar = binding.cbIsEnableCookie.isChecked |
|
|
|
|
source.enableJs = binding.cbEnableJs.isChecked |
|
|
|
|
source.loadWithBaseUrl = binding.cbEnableBaseUrl.isChecked |
|
|
|
|
sourceEntities.forEach { |
|
|
|
|