|
|
@ -9,7 +9,6 @@ import android.view.SubMenu |
|
|
|
import androidx.activity.viewModels |
|
|
|
import androidx.activity.viewModels |
|
|
|
import androidx.appcompat.widget.PopupMenu |
|
|
|
import androidx.appcompat.widget.PopupMenu |
|
|
|
import androidx.appcompat.widget.SearchView |
|
|
|
import androidx.appcompat.widget.SearchView |
|
|
|
import androidx.documentfile.provider.DocumentFile |
|
|
|
|
|
|
|
import androidx.recyclerview.widget.ItemTouchHelper |
|
|
|
import androidx.recyclerview.widget.ItemTouchHelper |
|
|
|
import io.legado.app.R |
|
|
|
import io.legado.app.R |
|
|
|
import io.legado.app.base.VMBaseActivity |
|
|
|
import io.legado.app.base.VMBaseActivity |
|
|
@ -35,7 +34,6 @@ import io.legado.app.utils.viewbindingdelegate.viewBinding |
|
|
|
import kotlinx.coroutines.Job |
|
|
|
import kotlinx.coroutines.Job |
|
|
|
import kotlinx.coroutines.flow.collect |
|
|
|
import kotlinx.coroutines.flow.collect |
|
|
|
import kotlinx.coroutines.launch |
|
|
|
import kotlinx.coroutines.launch |
|
|
|
import java.io.File |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 订阅源管理 |
|
|
|
* 订阅源管理 |
|
|
@ -67,15 +65,16 @@ class RssSourceActivity : VMBaseActivity<ActivityRssSourceBinding, RssSourceView |
|
|
|
} |
|
|
|
} |
|
|
|
private val exportDir = registerForActivityResult(HandleFileContract()) { uri -> |
|
|
|
private val exportDir = registerForActivityResult(HandleFileContract()) { uri -> |
|
|
|
uri ?: return@registerForActivityResult |
|
|
|
uri ?: return@registerForActivityResult |
|
|
|
if (uri.isContentScheme()) { |
|
|
|
alert(R.string.export_success) { |
|
|
|
DocumentFile.fromTreeUri(this, uri)?.let { |
|
|
|
val alertBinding = DialogEditTextBinding.inflate(layoutInflater).apply { |
|
|
|
viewModel.exportSelection(adapter.selection, it) |
|
|
|
editView.hint = getString(R.string.path) |
|
|
|
} |
|
|
|
editView.setText(uri.toString()) |
|
|
|
} else { |
|
|
|
|
|
|
|
uri.path?.let { |
|
|
|
|
|
|
|
viewModel.exportSelection(adapter.selection, File(it)) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
customView { alertBinding.root } |
|
|
|
|
|
|
|
okButton { |
|
|
|
|
|
|
|
sendToClip(uri.toString()) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
}.show() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
override fun onActivityCreated(savedInstanceState: Bundle?) { |
|
|
|
override fun onActivityCreated(savedInstanceState: Bundle?) { |
|
|
@ -126,7 +125,11 @@ class RssSourceActivity : VMBaseActivity<ActivityRssSourceBinding, RssSourceView |
|
|
|
R.id.menu_enable_selection -> viewModel.enableSelection(adapter.selection) |
|
|
|
R.id.menu_enable_selection -> viewModel.enableSelection(adapter.selection) |
|
|
|
R.id.menu_disable_selection -> viewModel.disableSelection(adapter.selection) |
|
|
|
R.id.menu_disable_selection -> viewModel.disableSelection(adapter.selection) |
|
|
|
R.id.menu_del_selection -> viewModel.delSelection(adapter.selection) |
|
|
|
R.id.menu_del_selection -> viewModel.delSelection(adapter.selection) |
|
|
|
R.id.menu_export_selection -> exportDir.launch(null) |
|
|
|
R.id.menu_export_selection -> exportDir.launch { |
|
|
|
|
|
|
|
mode = HandleFileContract.EXPORT |
|
|
|
|
|
|
|
fileName = "exportRssSource.json" |
|
|
|
|
|
|
|
file = GSON.toJson(adapter.selection).toByteArray() |
|
|
|
|
|
|
|
} |
|
|
|
R.id.menu_top_sel -> viewModel.topSource(*adapter.selection.toTypedArray()) |
|
|
|
R.id.menu_top_sel -> viewModel.topSource(*adapter.selection.toTypedArray()) |
|
|
|
R.id.menu_bottom_sel -> viewModel.bottomSource(*adapter.selection.toTypedArray()) |
|
|
|
R.id.menu_bottom_sel -> viewModel.bottomSource(*adapter.selection.toTypedArray()) |
|
|
|
} |
|
|
|
} |
|
|
|