mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-12-27 12:07:39 +00:00
Fix possible list items displaying wrong information
It is better to display empty strings rather than forget to reset textviews when a viewholder is reused!
This commit is contained in:
parent
953a81b299
commit
8f43055b0e
@ -3,6 +3,7 @@ package com.topjohnwu.magisk.adapters;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.support.design.widget.Snackbar;
|
import android.support.design.widget.Snackbar;
|
||||||
import android.support.v7.widget.RecyclerView;
|
import android.support.v7.widget.RecyclerView;
|
||||||
|
import android.text.TextUtils;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
@ -41,18 +42,10 @@ public class ModulesAdapter extends RecyclerView.Adapter<ModulesAdapter.ViewHold
|
|||||||
final Module module = mList.get(position);
|
final Module module = mList.get(position);
|
||||||
|
|
||||||
holder.title.setText(module.getName());
|
holder.title.setText(module.getName());
|
||||||
|
holder.versionName.setText(module.getVersion());
|
||||||
String author = module.getAuthor();
|
String author = module.getAuthor();
|
||||||
String versionName = module.getVersion();
|
holder.author.setText(TextUtils.isEmpty(author) ? null : context.getString(R.string.author, author));
|
||||||
String description = module.getDescription();
|
holder.description.setText(module.getDescription());
|
||||||
if (versionName != null) {
|
|
||||||
holder.versionName.setText(versionName);
|
|
||||||
}
|
|
||||||
if (author != null) {
|
|
||||||
holder.author.setText(context.getString(R.string.author, author));
|
|
||||||
}
|
|
||||||
if (description != null) {
|
|
||||||
holder.description.setText(description);
|
|
||||||
}
|
|
||||||
|
|
||||||
holder.checkBox.setChecked(module.isEnabled());
|
holder.checkBox.setChecked(module.isEnabled());
|
||||||
holder.checkBox.setOnClickListener((v) -> {
|
holder.checkBox.setOnClickListener((v) -> {
|
||||||
|
@ -52,18 +52,10 @@ public class ReposAdapter extends RecyclerView.Adapter<ReposAdapter.ViewHolder>
|
|||||||
Repo repo = getItem(position);
|
Repo repo = getItem(position);
|
||||||
|
|
||||||
holder.title.setText(repo.getName());
|
holder.title.setText(repo.getName());
|
||||||
|
holder.versionName.setText(repo.getVersion());
|
||||||
String author = repo.getAuthor();
|
String author = repo.getAuthor();
|
||||||
String versionName = repo.getVersion();
|
holder.author.setText(TextUtils.isEmpty(author) ? null : context.getString(R.string.author, author));
|
||||||
String description = repo.getDescription();
|
holder.description.setText(repo.getDescription());
|
||||||
if (versionName != null) {
|
|
||||||
holder.versionName.setText(versionName);
|
|
||||||
}
|
|
||||||
if (author != null) {
|
|
||||||
holder.author.setText(context.getString(R.string.author, author));
|
|
||||||
}
|
|
||||||
if (description != null) {
|
|
||||||
holder.description.setText(description);
|
|
||||||
}
|
|
||||||
|
|
||||||
holder.setExpanded(expandList.contains(repo));
|
holder.setExpanded(expandList.contains(repo));
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user