Keep reference to inflater

pull/147/head
M66B 6 years ago
parent c16fa09dab
commit 988674c4b3

@ -46,6 +46,7 @@ import androidx.recyclerview.widget.RecyclerView;
public class AdapterAccount extends RecyclerView.Adapter<AdapterAccount.ViewHolder> { public class AdapterAccount extends RecyclerView.Adapter<AdapterAccount.ViewHolder> {
private Context context; private Context context;
private LayoutInflater inflater;
private boolean debug; private boolean debug;
private List<EntityAccount> all = new ArrayList<>(); private List<EntityAccount> all = new ArrayList<>();
@ -128,6 +129,7 @@ public class AdapterAccount extends RecyclerView.Adapter<AdapterAccount.ViewHold
AdapterAccount(Context context) { AdapterAccount(Context context) {
this.context = context; this.context = context;
this.inflater = LayoutInflater.from(context);
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
this.debug = prefs.getBoolean("debug", false); this.debug = prefs.getBoolean("debug", false);
@ -226,7 +228,7 @@ public class AdapterAccount extends RecyclerView.Adapter<AdapterAccount.ViewHold
@Override @Override
@NonNull @NonNull
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
return new ViewHolder(LayoutInflater.from(context).inflate(R.layout.item_account, parent, false)); return new ViewHolder(inflater.inflate(R.layout.item_account, parent, false));
} }
@Override @Override

@ -41,6 +41,7 @@ import androidx.recyclerview.widget.RecyclerView;
public class AdapterAnswer extends RecyclerView.Adapter<AdapterAnswer.ViewHolder> { public class AdapterAnswer extends RecyclerView.Adapter<AdapterAnswer.ViewHolder> {
private Context context; private Context context;
private LayoutInflater inflater;
private List<EntityAnswer> all = new ArrayList<>(); private List<EntityAnswer> all = new ArrayList<>();
private List<EntityAnswer> filtered = new ArrayList<>(); private List<EntityAnswer> filtered = new ArrayList<>();
@ -85,6 +86,7 @@ public class AdapterAnswer extends RecyclerView.Adapter<AdapterAnswer.ViewHolder
AdapterAnswer(Context context) { AdapterAnswer(Context context) {
this.context = context; this.context = context;
this.inflater = LayoutInflater.from(context);
setHasStableIds(true); setHasStableIds(true);
} }
@ -179,7 +181,7 @@ public class AdapterAnswer extends RecyclerView.Adapter<AdapterAnswer.ViewHolder
@Override @Override
@NonNull @NonNull
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
return new ViewHolder(LayoutInflater.from(context).inflate(R.layout.item_answer, parent, false)); return new ViewHolder(inflater.inflate(R.layout.item_answer, parent, false));
} }
@Override @Override

@ -57,7 +57,9 @@ import androidx.recyclerview.widget.RecyclerView;
public class AdapterAttachment extends RecyclerView.Adapter<AdapterAttachment.ViewHolder> { public class AdapterAttachment extends RecyclerView.Adapter<AdapterAttachment.ViewHolder> {
private Context context; private Context context;
private LayoutInflater inflater;
private LifecycleOwner owner; private LifecycleOwner owner;
private boolean readonly; private boolean readonly;
private boolean confirm; private boolean confirm;
private boolean debug; private boolean debug;
@ -307,6 +309,7 @@ public class AdapterAttachment extends RecyclerView.Adapter<AdapterAttachment.Vi
AdapterAttachment(Context context, LifecycleOwner owner, boolean readonly) { AdapterAttachment(Context context, LifecycleOwner owner, boolean readonly) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
this.context = context; this.context = context;
this.inflater = LayoutInflater.from(context);
this.owner = owner; this.owner = owner;
this.readonly = readonly; this.readonly = readonly;
this.confirm = prefs.getBoolean("confirm", false); this.confirm = prefs.getBoolean("confirm", false);
@ -402,7 +405,7 @@ public class AdapterAttachment extends RecyclerView.Adapter<AdapterAttachment.Vi
@Override @Override
@NonNull @NonNull
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
return new ViewHolder(LayoutInflater.from(context).inflate(R.layout.item_attachment, parent, false)); return new ViewHolder(inflater.inflate(R.layout.item_attachment, parent, false));
} }
@Override @Override

@ -52,7 +52,9 @@ import androidx.recyclerview.widget.RecyclerView;
public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder> { public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder> {
private Context context; private Context context;
private LayoutInflater inflater;
private LifecycleOwner owner; private LifecycleOwner owner;
private long account; private long account;
private boolean debug; private boolean debug;
private int dp12; private int dp12;
@ -370,6 +372,7 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
AdapterFolder(Context context, LifecycleOwner owner) { AdapterFolder(Context context, LifecycleOwner owner) {
this.context = context; this.context = context;
this.inflater = LayoutInflater.from(context);
this.owner = owner; this.owner = owner;
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
@ -481,7 +484,7 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
@Override @Override
@NonNull @NonNull
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
return new ViewHolder(LayoutInflater.from(context).inflate(R.layout.item_folder, parent, false)); return new ViewHolder(inflater.inflate(R.layout.item_folder, parent, false));
} }
@Override @Override

@ -43,6 +43,7 @@ import androidx.recyclerview.widget.RecyclerView;
public class AdapterIdentity extends RecyclerView.Adapter<AdapterIdentity.ViewHolder> { public class AdapterIdentity extends RecyclerView.Adapter<AdapterIdentity.ViewHolder> {
private Context context; private Context context;
private LayoutInflater inflater;
private List<TupleIdentityEx> all = new ArrayList<>(); private List<TupleIdentityEx> all = new ArrayList<>();
private List<TupleIdentityEx> filtered = new ArrayList<>(); private List<TupleIdentityEx> filtered = new ArrayList<>();
@ -120,6 +121,7 @@ public class AdapterIdentity extends RecyclerView.Adapter<AdapterIdentity.ViewHo
AdapterIdentity(Context context) { AdapterIdentity(Context context) {
this.context = context; this.context = context;
this.inflater = LayoutInflater.from(context);
setHasStableIds(true); setHasStableIds(true);
} }
@ -214,7 +216,7 @@ public class AdapterIdentity extends RecyclerView.Adapter<AdapterIdentity.ViewHo
@Override @Override
@NonNull @NonNull
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
return new ViewHolder(LayoutInflater.from(context).inflate(R.layout.item_identity, parent, false)); return new ViewHolder(inflater.inflate(R.layout.item_identity, parent, false));
} }
@Override @Override

@ -37,6 +37,7 @@ import androidx.recyclerview.widget.RecyclerView;
public class AdapterLog extends RecyclerView.Adapter<AdapterLog.ViewHolder> { public class AdapterLog extends RecyclerView.Adapter<AdapterLog.ViewHolder> {
private Context context; private Context context;
private LayoutInflater inflater;
private List<EntityLog> all = new ArrayList<>(); private List<EntityLog> all = new ArrayList<>();
private List<EntityLog> filtered = new ArrayList<>(); private List<EntityLog> filtered = new ArrayList<>();
@ -65,6 +66,7 @@ public class AdapterLog extends RecyclerView.Adapter<AdapterLog.ViewHolder> {
AdapterLog(Context context) { AdapterLog(Context context) {
this.context = context; this.context = context;
this.inflater = LayoutInflater.from(context);
setHasStableIds(true); setHasStableIds(true);
} }
@ -149,7 +151,7 @@ public class AdapterLog extends RecyclerView.Adapter<AdapterLog.ViewHolder> {
@Override @Override
@NonNull @NonNull
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
return new ViewHolder(LayoutInflater.from(context).inflate(R.layout.item_log, parent, false)); return new ViewHolder(inflater.inflate(R.layout.item_log, parent, false));
} }
@Override @Override

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

@ -43,6 +43,7 @@ import androidx.recyclerview.widget.RecyclerView;
public class AdapterOperation extends RecyclerView.Adapter<AdapterOperation.ViewHolder> { public class AdapterOperation extends RecyclerView.Adapter<AdapterOperation.ViewHolder> {
private Context context; private Context context;
private LayoutInflater inflater;
private LifecycleOwner owner; private LifecycleOwner owner;
private List<TupleOperationEx> all = new ArrayList<>(); private List<TupleOperationEx> all = new ArrayList<>();
@ -160,6 +161,7 @@ public class AdapterOperation extends RecyclerView.Adapter<AdapterOperation.View
AdapterOperation(Context context, LifecycleOwner owner) { AdapterOperation(Context context, LifecycleOwner owner) {
this.context = context; this.context = context;
this.inflater = LayoutInflater.from(context);
this.owner = owner; this.owner = owner;
setHasStableIds(true); setHasStableIds(true);
} }
@ -245,7 +247,7 @@ public class AdapterOperation extends RecyclerView.Adapter<AdapterOperation.View
@Override @Override
@NonNull @NonNull
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
return new ViewHolder(LayoutInflater.from(context).inflate(R.layout.item_operation, parent, false)); return new ViewHolder(inflater.inflate(R.layout.item_operation, parent, false));
} }
@Override @Override

Loading…
Cancel
Save