use of com.topjohnwu.magisk.asyncs.ProcessRepoZip in project MagiskManager by topjohnwu.
the class ReposAdapter method onBindItemViewHolder.
@Override
public void onBindItemViewHolder(RepoHolder holder, int section, int position) {
Repo repo = repoPairs.get(section).second.get(position);
Context context = holder.itemView.getContext();
holder.title.setText(repo.getName());
holder.versionName.setText(repo.getVersion());
String author = repo.getAuthor();
holder.author.setText(TextUtils.isEmpty(author) ? null : context.getString(R.string.author, author));
holder.description.setText(repo.getDescription());
holder.updateTime.setText(context.getString(R.string.updated_on, repo.getLastUpdateString()));
holder.infoLayout.setOnClickListener(v -> new MarkDownWindow((Activity) context, null, repo.getDetailUrl()).exec());
holder.downloadImage.setOnClickListener(v -> {
String filename = repo.getName() + "-" + repo.getVersion() + ".zip";
new AlertDialogBuilder((Activity) context).setTitle(context.getString(R.string.repo_install_title, repo.getName())).setMessage(context.getString(R.string.repo_install_msg, filename)).setCancelable(true).setPositiveButton(R.string.install, (d, i) -> new ProcessRepoZip((Activity) context, repo.getZipUrl(), Utils.getLegalFilename(filename), true).exec()).setNeutralButton(R.string.download, (d, i) -> new ProcessRepoZip((Activity) context, repo.getZipUrl(), Utils.getLegalFilename(filename), false).exec()).setNegativeButton(R.string.no_thanks, null).show();
});
}
Aggregations