AboutDialogFragment.kt (2152B)
1 /* 2 * This file is part of GNU Taler 3 * (C) 2020 Taler Systems S.A. 4 * 5 * GNU Taler is free software; you can redistribute it and/or modify it under the 6 * terms of the GNU General Public License as published by the Free Software 7 * Foundation; either version 3, or (at your option) any later version. 8 * 9 * GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY 10 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 11 * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 * 13 * You should have received a copy of the GNU General Public License along with 14 * GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/> 15 */ 16 17 package net.taler.cashier 18 19 import android.os.Bundle 20 import android.view.LayoutInflater 21 import android.view.View 22 import android.view.ViewGroup 23 import androidx.fragment.app.DialogFragment 24 import net.taler.cashier.BuildConfig.VERSION_NAME 25 import net.taler.cashier.config.VERSION_BANK 26 import net.taler.cashier.databinding.FragmentAboutDialogBinding 27 import net.taler.common.Version 28 29 class AboutDialogFragment : DialogFragment() { 30 31 private lateinit var ui: FragmentAboutDialogBinding 32 33 override fun onCreateView( 34 inflater: LayoutInflater, 35 container: ViewGroup?, 36 savedInstanceState: Bundle?, 37 ): View { 38 ui = FragmentAboutDialogBinding.inflate(layoutInflater, container, false) 39 return ui.root 40 } 41 42 override fun onViewCreated(view: View, savedInstanceState: Bundle?) { 43 super.onViewCreated(view, savedInstanceState) 44 45 ui.versionView.text = getString(R.string.about_version, VERSION_NAME) 46 ui.bankVersionView.text = getString(R.string.about_supported_bank_api, VERSION_BANK.str()) 47 ui.licenseView.text = 48 getString(R.string.about_license, getString(R.string.about_license_content)) 49 ui.copyrightView.text = 50 getString(R.string.about_copyright, getString(R.string.about_copyright_holder)) 51 52 ui.button.setOnClickListener { dismiss() } 53 } 54 55 private fun Version.str(): String { 56 return "$current:$revision:$age" 57 } 58 59 }