Skip to content

Conversation

@SidMalladi
Copy link
Collaborator

Replaced the valueView StringBuilder implementation with RecyclerView/Adapter

Comment on lines +296 to +324
if (cursor.moveToFirst()) {
for (String header : headerTokens) {

if (!header.equals(mListId)) {

final String val = cursor.getString(
cursor.getColumnIndexOrThrow(header)
);

if (header.equals("color") || header.equals("scan_count") || header.equals("date")
|| header.equals("user") || header.equals("note")) {
if (header.equals("color")) continue;
else if (header.equals("scan_count")) auxValues.append("Number of scans");
else if (header.equals("date")) auxValues.append("Date");
else auxValues.append(header);
auxValues.append(" : ");
if (val != null) auxValues.append(val);
auxValues.append(line_separator);
} else {
String value = header + " :\n\t\t";
if (val != null) value += val;
values.add(value);
}
}
}
cursor.close();

adapter.values = values;
adapter.notifyDataSetChanged();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Improve your recycler view implementation to not require this string builder. Augment your adapter with a model class that has a prefix and value, which are populated here, then sent to the adapter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants