Bimba.git

ref: fce99bb7fe691fea197b4cac75ee9cbc1eb836a4

app/src/main/java/xyz/apiote/bimba/czwek/search/ui/SectionsPagerAdapter.kt


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// SPDX-FileCopyrightText: Adam Evyčędo
//
// SPDX-License-Identifier: GPL-3.0-or-later

package xyz.apiote.bimba.czwek.search.ui

import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.fragment.app.FragmentPagerAdapter
import xyz.apiote.bimba.czwek.repo.Line

class SectionsPagerAdapter(fm: FragmentManager, val line: Line) :
	FragmentPagerAdapter(fm, BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT) {

	override fun getItem(position: Int): Fragment {
		return LineGraphFragment.newInstance(line.graphs[position], line.id, line.name, line.feedID)
	}

	override fun getPageTitle(position: Int): CharSequence {
		return line.headsigns[position].joinToString()
	}

	override fun getCount(): Int {
		return line.headsigns.size
	}
}