mirror of
https://github.com/lacerta-doc/Lacerta.git
synced 2024-11-22 16:03:15 +00:00
Adapter実装WIP
This commit is contained in:
parent
71986bb17d
commit
7eb87305ea
|
@ -1,7 +1,11 @@
|
||||||
package one.nem.lacerta.setting;
|
package one.nem.lacerta.setting;
|
||||||
|
|
||||||
|
import android.media.Image;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
@ -27,12 +31,20 @@ public class TagListItemAdapter extends RecyclerView.Adapter<TagListItemAdapter.
|
||||||
@NonNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public TagListItemViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
public TagListItemViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||||
return null;
|
View view = LayoutInflater.from(parent.getContext()).inflate(one.nem.lacerta.shared.ui.R.layout.tag_list_full_item, parent, false);
|
||||||
|
return new TagListItemViewHolder(view);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBindViewHolder(@NonNull TagListItemViewHolder holder, int position) {
|
public void onBindViewHolder(@NonNull TagListItemViewHolder holder, int position) {
|
||||||
|
DocumentTag documentTag = documentTags.get(position);
|
||||||
|
|
||||||
|
holder.tag_name.setText(documentTag.getName());
|
||||||
|
try {
|
||||||
|
holder.tag_icon.setImageResource(one.nem.lacerta.shared.ui.R.drawable.class.getField(documentTag.getIcon()).getInt(null));
|
||||||
|
} catch (Exception e) {
|
||||||
|
holder.tag_name.setText("Sorry, Parse Error occurred");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -42,8 +54,15 @@ public class TagListItemAdapter extends RecyclerView.Adapter<TagListItemAdapter.
|
||||||
|
|
||||||
public static class TagListItemViewHolder extends RecyclerView.ViewHolder {
|
public static class TagListItemViewHolder extends RecyclerView.ViewHolder {
|
||||||
|
|
||||||
|
ImageView tag_icon;
|
||||||
|
TextView tag_name;
|
||||||
|
|
||||||
public TagListItemViewHolder(@NonNull View itemView) {
|
public TagListItemViewHolder(@NonNull View itemView) {
|
||||||
super(itemView);
|
super(itemView);
|
||||||
|
|
||||||
|
tag_icon = itemView.findViewById(one.nem.lacerta.shared.ui.R.id.tag_icon);
|
||||||
|
tag_name = itemView.findViewById(one.nem.lacerta.shared.ui.R.id.tag_name);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user