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

Used service icons for import

This commit is contained in:
litetex 2022-03-20 17:22:48 +01:00
parent 70e0085596
commit 7ab11a8379

View File

@ -58,6 +58,7 @@ import org.schabi.newpipe.streams.io.NoFileManagerSafeGuard
import org.schabi.newpipe.streams.io.StoredFileHelper import org.schabi.newpipe.streams.io.StoredFileHelper
import org.schabi.newpipe.util.NavigationHelper import org.schabi.newpipe.util.NavigationHelper
import org.schabi.newpipe.util.OnClickGesture import org.schabi.newpipe.util.OnClickGesture
import org.schabi.newpipe.util.ServiceHelper
import org.schabi.newpipe.util.ThemeHelper.getGridSpanCountChannels import org.schabi.newpipe.util.ThemeHelper.getGridSpanCountChannels
import org.schabi.newpipe.util.ThemeHelper.shouldUseGridLayout import org.schabi.newpipe.util.ThemeHelper.shouldUseGridLayout
import org.schabi.newpipe.util.external_communication.ShareUtils import org.schabi.newpipe.util.external_communication.ShareUtils
@ -140,7 +141,6 @@ class SubscriptionFragment : BaseStateFragment<SubscriptionState>() {
private fun buildImportExportMenu(menu: Menu) { private fun buildImportExportMenu(menu: Menu) {
// -- 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) {
@ -157,9 +157,10 @@ class SubscriptionFragment : BaseStateFragment<SubscriptionState>() {
val supportedSources = subscriptionExtractor.supportedSources val supportedSources = subscriptionExtractor.supportedSources
if (supportedSources.isEmpty()) continue if (supportedSources.isEmpty()) continue
addMenuItem(importSubMenu, serviceName) { val item = addMenuItem(importSubMenu, serviceName) {
onImportFromServiceSelected(service.serviceId) onImportFromServiceSelected(service.serviceId)
} }
item.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)",
@ -169,7 +170,6 @@ class SubscriptionFragment : BaseStateFragment<SubscriptionState>() {
} }
// -- Export -- // -- Export --
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() }