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