Warning, /network/kdeconnect-android/src/org/kde/kdeconnect/UserInterface/About/AboutPersonEntryItem.kt is written in an unsupported language. File is not indexed.

0001 /*
0002  * SPDX-FileCopyrightText: 2014 Albert Vaca Cintora <albertvaka@gmail.com>
0003  * SPDX-FileCopyrightText: 2021 Maxim Leshchenko <cnmaks90@gmail.com>
0004  *
0005  * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0006  */
0007 
0008 package org.kde.kdeconnect.UserInterface.About
0009 
0010 import android.content.Intent
0011 import android.net.Uri
0012 import android.view.LayoutInflater
0013 import android.view.View
0014 import androidx.appcompat.widget.TooltipCompat
0015 import org.kde.kdeconnect.UserInterface.List.ListAdapter
0016 import org.kde.kdeconnect_tp.R
0017 import org.kde.kdeconnect_tp.databinding.AboutPersonListItemEntryBinding
0018 
0019 class AboutPersonEntryItem(val person: AboutPerson) : ListAdapter.Item {
0020     override fun inflateView(layoutInflater: LayoutInflater): View {
0021         val binding = AboutPersonListItemEntryBinding.inflate(layoutInflater)
0022 
0023         binding.aboutPersonListItemEntryName.text = person.name
0024 
0025         if (person.task != null) {
0026             binding.aboutPersonListItemEntryTask.visibility = View.VISIBLE
0027             binding.aboutPersonListItemEntryTask.text = layoutInflater.context.getString(person.task)
0028         }
0029 
0030         if (person.webAddress != null) {
0031             binding.aboutPersonListItemEntryVisitHomepageButton.visibility = View.VISIBLE
0032             TooltipCompat.setTooltipText(binding.aboutPersonListItemEntryVisitHomepageButton, layoutInflater.context.resources.getString(R.string.visit_contributors_homepage, person.webAddress))
0033             binding.aboutPersonListItemEntryVisitHomepageButton.setOnClickListener {
0034                 layoutInflater.context.startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(person.webAddress)))
0035             }
0036         }
0037 
0038         return binding.root
0039     }
0040 }