mirror of
https://github.com/KDE/kdeconnect-android
synced 2025-08-28 12:47:43 +00:00
Migrate EntryItem to Kotlin
This commit is contained in:
parent
b856bdbb0b
commit
a5057df1c8
@ -29,10 +29,10 @@ class CommandEntry extends EntryItem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return title;
|
return getTitle();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getCommand() {
|
public String getCommand() {
|
||||||
return subtitle;
|
return getSubtitle();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,43 +0,0 @@
|
|||||||
/*
|
|
||||||
* SPDX-FileCopyrightText: 2014 Albert Vaca Cintora <albertvaka@gmail.com>
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.kde.kdeconnect.UserInterface.List;
|
|
||||||
|
|
||||||
import android.view.LayoutInflater;
|
|
||||||
import android.view.View;
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
|
|
||||||
import org.kde.kdeconnect_tp.databinding.ListItemEntryBinding;
|
|
||||||
|
|
||||||
public class EntryItem implements ListAdapter.Item {
|
|
||||||
protected final String title;
|
|
||||||
protected final String subtitle;
|
|
||||||
|
|
||||||
public EntryItem(String title) {
|
|
||||||
this(title, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected EntryItem(String title, String subtitle) {
|
|
||||||
this.title = title;
|
|
||||||
this.subtitle = subtitle;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NonNull
|
|
||||||
@Override
|
|
||||||
public View inflateView(@NonNull LayoutInflater layoutInflater) {
|
|
||||||
final ListItemEntryBinding binding = ListItemEntryBinding.inflate(layoutInflater);
|
|
||||||
|
|
||||||
binding.listItemEntryTitle.setText(title);
|
|
||||||
|
|
||||||
if (subtitle != null) {
|
|
||||||
binding.listItemEntrySummary.setVisibility(View.VISIBLE);
|
|
||||||
binding.listItemEntrySummary.setText(subtitle);
|
|
||||||
}
|
|
||||||
|
|
||||||
return binding.getRoot();
|
|
||||||
}
|
|
||||||
}
|
|
26
src/org/kde/kdeconnect/UserInterface/List/EntryItem.kt
Normal file
26
src/org/kde/kdeconnect/UserInterface/List/EntryItem.kt
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: 2014 Albert Vaca Cintora <albertvaka@gmail.com>
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
||||||
|
*/
|
||||||
|
package org.kde.kdeconnect.UserInterface.List
|
||||||
|
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.View
|
||||||
|
import org.kde.kdeconnect_tp.databinding.ListItemEntryBinding
|
||||||
|
|
||||||
|
open class EntryItem protected constructor(protected val title: String, protected val subtitle: String?) : ListAdapter.Item {
|
||||||
|
|
||||||
|
override fun inflateView(layoutInflater: LayoutInflater): View {
|
||||||
|
val binding = ListItemEntryBinding.inflate(layoutInflater)
|
||||||
|
|
||||||
|
binding.listItemEntryTitle.text = title
|
||||||
|
|
||||||
|
if (subtitle != null) {
|
||||||
|
binding.listItemEntrySummary.visibility = View.VISIBLE
|
||||||
|
binding.listItemEntrySummary.text = subtitle
|
||||||
|
}
|
||||||
|
|
||||||
|
return binding.root
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user