Add gift tab in donation receipts page.

This commit is contained in:
Alex Hart 2022-05-09 10:36:08 -03:00
parent 60b20a9b8a
commit dc5f7d0906
2 changed files with 3 additions and 1 deletions

View file

@ -32,6 +32,7 @@ class DonationReceiptListFragment : Fragment(R.layout.donation_receipt_list_frag
0 -> R.string.DonationReceiptListFragment__all
1 -> R.string.DonationReceiptListFragment__recurring
2 -> R.string.DonationReceiptListFragment__one_time
3 -> R.string.DonationReceiptListFragment__gift
else -> error("Unsupported index $position")
}
)

View file

@ -5,13 +5,14 @@ import androidx.viewpager2.adapter.FragmentStateAdapter
import org.thoughtcrime.securesms.database.model.DonationReceiptRecord
class DonationReceiptListPageAdapter(fragment: Fragment) : FragmentStateAdapter(fragment) {
override fun getItemCount(): Int = 3
override fun getItemCount(): Int = 4
override fun createFragment(position: Int): Fragment {
return when (position) {
0 -> DonationReceiptListPageFragment.create(null)
1 -> DonationReceiptListPageFragment.create(DonationReceiptRecord.Type.RECURRING)
2 -> DonationReceiptListPageFragment.create(DonationReceiptRecord.Type.BOOST)
3 -> DonationReceiptListPageFragment.create(DonationReceiptRecord.Type.GIFT)
else -> error("Unsupported position $position")
}
}