37 lines
1.1 KiB
Java
37 lines
1.1 KiB
Java
package com.appetize.remotesms;
|
|
|
|
import android.content.Context;
|
|
import android.view.LayoutInflater;
|
|
import android.view.View;
|
|
import android.view.ViewGroup;
|
|
import android.widget.ArrayAdapter;
|
|
import android.widget.TextView;
|
|
|
|
import androidx.annotation.NonNull;
|
|
import androidx.annotation.Nullable;
|
|
|
|
import java.util.List;
|
|
|
|
public class DeviceAdapter extends ArrayAdapter<Rule> {
|
|
List<Rule> devices;
|
|
Context context;
|
|
int resource;
|
|
public DeviceAdapter(@NonNull Context context, int resource, @NonNull List<Rule> objects) {
|
|
super(context, resource, objects);
|
|
this.context = context;
|
|
this.resource = resource;
|
|
this.devices = objects;
|
|
}
|
|
|
|
@NonNull
|
|
@Override
|
|
public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
|
|
LayoutInflater inflater = LayoutInflater.from(context);
|
|
View view = inflater.inflate(R.layout.block,null);
|
|
Rule q = devices.get(position);
|
|
((TextView)view.findViewById(R.id.blk_name)).setText(q.name);
|
|
((TextView)view.findViewById(R.id.blk_sims)).setText(String.valueOf(q.sims));
|
|
return view;
|
|
}
|
|
}
|