mirror of
https://github.com/M66B/FairEmail.git
synced 2024-12-27 18:27:43 +00:00
VirusTotal dialog lifecycle
This commit is contained in:
parent
04c632eaa9
commit
af27b4dd7a
1 changed files with 14 additions and 2 deletions
|
@ -87,6 +87,8 @@ public class AdapterAttachment extends RecyclerView.Adapter<AdapterAttachment.Vi
|
||||||
private TextView tvError;
|
private TextView tvError;
|
||||||
private ProgressBar progressbar;
|
private ProgressBar progressbar;
|
||||||
|
|
||||||
|
private TwoStateOwner powner = new TwoStateOwner(owner, "AttachmentPopup");
|
||||||
|
|
||||||
ViewHolder(View itemView) {
|
ViewHolder(View itemView) {
|
||||||
super(itemView);
|
super(itemView);
|
||||||
|
|
||||||
|
@ -356,7 +358,7 @@ public class AdapterAttachment extends RecyclerView.Adapter<AdapterAttachment.Vi
|
||||||
tvLabel.setVisibility(TextUtils.isEmpty(label) ? View.GONE : View.VISIBLE);
|
tvLabel.setVisibility(TextUtils.isEmpty(label) ? View.GONE : View.VISIBLE);
|
||||||
tvUnknown.setVisibility(count == 0 ? View.VISIBLE : View.GONE);
|
tvUnknown.setVisibility(count == 0 ? View.VISIBLE : View.GONE);
|
||||||
|
|
||||||
new AlertDialog.Builder(context)
|
AlertDialog dialog = new AlertDialog.Builder(context)
|
||||||
.setView(view)
|
.setView(view)
|
||||||
.setPositiveButton(R.string.title_info, new DialogInterface.OnClickListener() {
|
.setPositiveButton(R.string.title_info, new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -365,7 +367,16 @@ public class AdapterAttachment extends RecyclerView.Adapter<AdapterAttachment.Vi
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.setNegativeButton(android.R.string.cancel, null)
|
.setNegativeButton(android.R.string.cancel, null)
|
||||||
.show();
|
.create();
|
||||||
|
dialog.show();
|
||||||
|
|
||||||
|
powner.getLifecycle().addObserver(new LifecycleObserver() {
|
||||||
|
@OnLifecycleEvent(Lifecycle.Event.ON_DESTROY)
|
||||||
|
public void onDestroy() {
|
||||||
|
dialog.dismiss();
|
||||||
|
powner.getLifecycle().removeObserver(this);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -560,6 +571,7 @@ public class AdapterAttachment extends RecyclerView.Adapter<AdapterAttachment.Vi
|
||||||
holder.unwire();
|
holder.unwire();
|
||||||
|
|
||||||
EntityAttachment attachment = items.get(position);
|
EntityAttachment attachment = items.get(position);
|
||||||
|
holder.powner.recreate(attachment == null ? null : attachment.id);
|
||||||
holder.bindTo(attachment);
|
holder.bindTo(attachment);
|
||||||
|
|
||||||
holder.wire();
|
holder.wire();
|
||||||
|
|
Loading…
Reference in a new issue