Keep reference to inflater

This commit is contained in:
M66B
2018-12-24 13:41:49 +00:00
parent c16fa09dab
commit 988674c4b3
8 changed files with 26 additions and 8 deletions

View File

@@ -106,6 +106,7 @@ import androidx.recyclerview.widget.RecyclerView;
public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHolder> {
private Context context;
private LayoutInflater inflater;
private LifecycleOwner owner;
private FragmentManager fragmentManager;
private ViewType viewType;
@@ -1608,6 +1609,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
ViewType viewType, boolean outgoing, int zoom, IProperties properties) {
this.context = context;
this.owner = owner;
this.inflater = LayoutInflater.from(context);
this.fragmentManager = fragmentManager;
this.viewType = viewType;
this.outgoing = outgoing;
@@ -1674,7 +1676,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
@Override
@NonNull
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
return new ViewHolder(LayoutInflater.from(context).inflate(
return new ViewHolder(inflater.inflate(
compact ? R.layout.item_message_compact : R.layout.item_message_normal,
parent,
false));