mirror of
https://github.com/KDE/kdeconnect-android
synced 2025-08-31 06:05:12 +00:00
Make ListAdapter.Item.inflateView nonNull
This commit is contained in:
@@ -23,14 +23,21 @@ package org.kde.kdeconnect.UserInterface.List;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
public class CustomItem implements ListAdapter.Item {
|
||||
|
||||
private final View view;
|
||||
|
||||
public CustomItem(View v) {
|
||||
|
||||
if (v == null)
|
||||
throw new IllegalArgumentException("View must not be null");
|
||||
|
||||
this.view = v;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public View inflateView(LayoutInflater layoutInflater) {
|
||||
return view;
|
||||
|
@@ -24,6 +24,8 @@ import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import org.kde.kdeconnect_tp.R;
|
||||
|
||||
public class EntryItem implements ListAdapter.Item {
|
||||
@@ -41,6 +43,7 @@ public class EntryItem implements ListAdapter.Item {
|
||||
this.subtitle = subtitle;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public View inflateView(LayoutInflater layoutInflater) {
|
||||
View v = layoutInflater.inflate(R.layout.list_item_entry, null);
|
||||
|
@@ -33,6 +33,7 @@ import java.util.ArrayList;
|
||||
public class ListAdapter extends ArrayAdapter<ListAdapter.Item> {
|
||||
|
||||
public interface Item {
|
||||
@NonNull
|
||||
View inflateView(LayoutInflater layoutInflater);
|
||||
}
|
||||
|
||||
@@ -45,11 +46,10 @@ public class ListAdapter extends ArrayAdapter<ListAdapter.Item> {
|
||||
layoutInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||
}
|
||||
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public View getView(int position, View convertView, @NonNull ViewGroup parent) {
|
||||
final Item i = items.get(position);
|
||||
return i.inflateView(layoutInflater);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -25,6 +25,8 @@ import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import org.kde.kdeconnect.Device;
|
||||
import org.kde.kdeconnect_tp.R;
|
||||
|
||||
@@ -46,6 +48,7 @@ public class PairingDeviceItem implements ListAdapter.Item {
|
||||
return this.device;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public View inflateView(LayoutInflater layoutInflater) {
|
||||
final View v = layoutInflater.inflate(R.layout.list_item_with_icon_entry, null);
|
||||
|
@@ -25,6 +25,8 @@ import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import org.kde.kdeconnect.Plugins.Plugin;
|
||||
import org.kde.kdeconnect_tp.R;
|
||||
|
||||
@@ -39,6 +41,7 @@ public class PluginItem implements ListAdapter.Item {
|
||||
}
|
||||
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public View inflateView(final LayoutInflater layoutInflater) {
|
||||
View v = layoutInflater.inflate(R.layout.list_item_with_icon_entry, null);
|
||||
|
@@ -24,6 +24,8 @@ import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import org.kde.kdeconnect_tp.R;
|
||||
|
||||
public class SectionItem implements ListAdapter.Item {
|
||||
@@ -36,6 +38,7 @@ public class SectionItem implements ListAdapter.Item {
|
||||
this.isEmpty = true;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public View inflateView(LayoutInflater layoutInflater) {
|
||||
|
||||
|
@@ -26,6 +26,7 @@ import android.widget.TextView;
|
||||
|
||||
import org.kde.kdeconnect_tp.R;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
public class SmallEntryItem implements ListAdapter.Item {
|
||||
@@ -43,6 +44,7 @@ public class SmallEntryItem implements ListAdapter.Item {
|
||||
this.clickListener = clickListener;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public View inflateView(LayoutInflater layoutInflater) {
|
||||
View v = layoutInflater.inflate(android.R.layout.simple_list_item_1, null);
|
||||
|
Reference in New Issue
Block a user