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.ListItemCategoryBinding;
0015 
0016 public class SectionItem implements ListAdapter.Item {
0017     private final String title;
0018     public boolean isEmpty;
0019 
0020     public SectionItem(String title) {
0021         this.title = title;
0022         this.isEmpty = true;
0023     }
0024 
0025     @NonNull
0026     @Override
0027     public View inflateView(@NonNull LayoutInflater layoutInflater) {
0028         final ListItemCategoryBinding binding = ListItemCategoryBinding.inflate(layoutInflater);
0029 
0030         //Make it not selectable
0031         binding.getRoot().setOnClickListener(null);
0032         binding.getRoot().setOnLongClickListener(null);
0033         binding.getRoot().setFocusable(false);
0034         binding.getRoot().setClickable(false);
0035 
0036         binding.listItemCategoryText.setText(title);
0037 
0038         if (isEmpty) {
0039             binding.listItemCategoryEmptyPlaceholder.setVisibility(View.VISIBLE);
0040         }
0041 
0042         return binding.getRoot();
0043     }
0044 }