Skip to content

Commit

Permalink
fix(android): address minor memory leak
Browse files Browse the repository at this point in the history
  • Loading branch information
garymathews authored and sgtcoolguy committed Jan 19, 2021
1 parent 8d79902 commit 6d9c62c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ public class ListViewAdapter extends TiRecyclerViewAdapter<ListViewHolder>
private static final String TAG = "ListViewAdapter";

private static int id_holder;
private static LayoutInflater inflater;

private LayoutInflater inflater;
private List<ListItemProxy> models;
private SelectionTracker tracker;

Expand All @@ -35,9 +35,7 @@ public ListViewAdapter(@NonNull Context context, @NonNull List<ListItemProxy> mo
this.context = context;

// Obtain layout inflater instance.
if (inflater == null) {
inflater = LayoutInflater.from(context);
}
inflater = LayoutInflater.from(context);

// Obtain TableViewHolder layout identifier.
try {
Expand Down Expand Up @@ -122,7 +120,7 @@ public void onBindViewHolder(@NonNull ListViewHolder holder, int position)
public ListViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType)
{
// Create new TableViewHolder instance.
final RelativeLayout layout = (RelativeLayout) inflater.inflate(id_holder, parent, false);
final RelativeLayout layout = (RelativeLayout) inflater.inflate(id_holder, null);
return new ListViewHolder(parent.getContext(), layout);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ public class TableViewAdapter extends TiRecyclerViewAdapter<TableViewHolder>
private static final String TAG = "TableViewAdapter";

private static int id_holder;
private static LayoutInflater inflater;

private LayoutInflater inflater;
private List<TableViewRowProxy> models;
private SelectionTracker tracker;

Expand All @@ -38,9 +38,7 @@ public TableViewAdapter(@NonNull Context context, @NonNull List<TableViewRowProx
this.context = context;

// Obtain layout inflater instance.
if (inflater == null) {
inflater = LayoutInflater.from(context);
}
inflater = LayoutInflater.from(context);

// Obtain TableViewHolder layout identifier.
try {
Expand Down Expand Up @@ -129,7 +127,7 @@ public void onBindViewHolder(@NonNull TableViewHolder holder, int position)
public TableViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType)
{
// Create new TableViewHolder instance.
final RelativeLayout layout = (RelativeLayout) inflater.inflate(id_holder, parent, false);
final RelativeLayout layout = (RelativeLayout) inflater.inflate(id_holder, null);
return new TableViewHolder(parent.getContext(), layout);
}

Expand Down

0 comments on commit 6d9c62c

Please sign in to comment.