File indexing completed on 2025-02-02 04:47:53

0001 /*
0002  * SPDX-FileCopyrightText: 2014 Albert Vaca Cintora <albertvaka@gmail.com>
0003  *
0004  * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0005 */
0006 
0007 package org.kde.kdeconnect.UserInterface.List;
0008 
0009 import android.view.LayoutInflater;
0010 import android.view.View;
0011 
0012 import androidx.annotation.NonNull;
0013 
0014 import org.kde.kdeconnect_tp.databinding.ListItemEntryBinding;
0015 
0016 public class EntryItem implements ListAdapter.Item {
0017     protected final String title;
0018     protected final String subtitle;
0019 
0020     public EntryItem(String title) {
0021         this(title, null);
0022     }
0023 
0024     protected EntryItem(String title, String subtitle) {
0025         this.title = title;
0026         this.subtitle = subtitle;
0027     }
0028 
0029     @NonNull
0030     @Override
0031     public View inflateView(@NonNull LayoutInflater layoutInflater) {
0032         final ListItemEntryBinding binding = ListItemEntryBinding.inflate(layoutInflater);
0033 
0034         binding.listItemEntryTitle.setText(title);
0035 
0036         if (subtitle != null) {
0037             binding.listItemEntrySummary.setVisibility(View.VISIBLE);
0038             binding.listItemEntrySummary.setText(subtitle);
0039         }
0040 
0041         return binding.getRoot();
0042     }
0043 }