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