1
0
mirror of https://github.com/TeamNewPipe/NewPipe synced 2024-12-23 00:20:32 +00:00

Icons for import/export

This commit is contained in:
litetex 2022-03-20 17:32:41 +01:00
parent 7ab11a8379
commit 7de17ad949

View File

@ -143,9 +143,8 @@ class SubscriptionFragment : BaseStateFragment<SubscriptionState>() {
// -- Import -- // -- Import --
val importSubMenu = menu.addSubMenu(R.string.import_from) val importSubMenu = menu.addSubMenu(R.string.import_from)
addMenuItem(importSubMenu, R.string.previous_export) { addMenuItem(importSubMenu, R.string.previous_export) { onImportPreviousSelected() }
onImportPreviousSelected() .setIcon(R.drawable.ic_backup)
}
val services = requireContext().resources.getStringArray(R.array.service_list) val services = requireContext().resources.getStringArray(R.array.service_list)
for (serviceName in services) { for (serviceName in services) {
@ -157,10 +156,10 @@ class SubscriptionFragment : BaseStateFragment<SubscriptionState>() {
val supportedSources = subscriptionExtractor.supportedSources val supportedSources = subscriptionExtractor.supportedSources
if (supportedSources.isEmpty()) continue if (supportedSources.isEmpty()) continue
val item = addMenuItem(importSubMenu, serviceName) { addMenuItem(importSubMenu, serviceName) {
onImportFromServiceSelected(service.serviceId) onImportFromServiceSelected(service.serviceId)
} }
item.setIcon(ServiceHelper.getIcon(service.serviceId)) .setIcon(ServiceHelper.getIcon(service.serviceId))
} catch (e: ExtractionException) { } catch (e: ExtractionException) {
throw RuntimeException( throw RuntimeException(
"Services array contains an entry that it's not a valid service name ($serviceName)", "Services array contains an entry that it's not a valid service name ($serviceName)",
@ -173,6 +172,7 @@ class SubscriptionFragment : BaseStateFragment<SubscriptionState>() {
val exportSubMenu = menu.addSubMenu(R.string.export_to) val exportSubMenu = menu.addSubMenu(R.string.export_to)
addMenuItem(exportSubMenu, R.string.file) { onExportSelected() } addMenuItem(exportSubMenu, R.string.file) { onExportSelected() }
.setIcon(R.drawable.ic_save)
} }
private fun addMenuItem( private fun addMenuItem(