Bimba.git

ref: 3877e1e462c33778518e8c48dbf9e53076c00a53

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.name, line.feedID)
	}

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

	override fun getCount(): Int {
		return 2
	}
}