mirror of https://github.com/M66B/FairEmail.git
Attach snackbar to parent view
This commit is contained in:
parent
da0f528798
commit
8c0e81d6df
|
@ -217,7 +217,10 @@ public class AdapterAttachment extends RecyclerView.Adapter<AdapterAttachment.Vi
|
|||
|
||||
// Check if viewer available
|
||||
if (ris.size() == 0)
|
||||
Snackbar.make(view, context.getString(R.string.title_no_viewer, attachment.type), Snackbar.LENGTH_LONG).show();
|
||||
Snackbar.make(
|
||||
(View) itemView.getParent(),
|
||||
context.getString(R.string.title_no_viewer, attachment.type),
|
||||
Snackbar.LENGTH_LONG).show();
|
||||
else
|
||||
context.startActivity(intent);
|
||||
}
|
||||
|
|
|
@ -485,7 +485,10 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
|
|||
@Override
|
||||
protected void onException(Bundle args, Throwable ex) {
|
||||
if (ex instanceof IllegalStateException) {
|
||||
Snackbar snackbar = Snackbar.make(view, ex.getMessage(), Snackbar.LENGTH_LONG);
|
||||
Snackbar snackbar = Snackbar.make(
|
||||
(View) itemView.getParent(),
|
||||
ex.getMessage(),
|
||||
Snackbar.LENGTH_LONG);
|
||||
snackbar.setAction(R.string.title_fix, new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
|
@ -496,7 +499,10 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
|
|||
});
|
||||
snackbar.show();
|
||||
} else if (ex instanceof IllegalArgumentException)
|
||||
Snackbar.make(view, ex.getMessage(), Snackbar.LENGTH_LONG).show();
|
||||
Snackbar.make(
|
||||
(View) itemView.getParent(),
|
||||
ex.getMessage(),
|
||||
Snackbar.LENGTH_LONG).show();
|
||||
else
|
||||
Helper.unexpectedError(context, owner, ex);
|
||||
}
|
||||
|
|
|
@ -130,7 +130,10 @@ public class AdapterImage extends RecyclerView.Adapter<AdapterImage.ViewHolder>
|
|||
|
||||
// Check if viewer available
|
||||
if (ris.size() == 0) {
|
||||
Snackbar.make(view, context.getString(R.string.title_no_viewer, attachment.type), Snackbar.LENGTH_LONG).show();
|
||||
Snackbar.make(
|
||||
(View) itemView.getParent(),
|
||||
context.getString(R.string.title_no_viewer, attachment.type),
|
||||
Snackbar.LENGTH_LONG).show();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -1411,7 +1411,8 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
if (message.ui_snoozed != null) {
|
||||
DateFormat df = SimpleDateFormat.getDateTimeInstance(SimpleDateFormat.MEDIUM, SimpleDateFormat.SHORT);
|
||||
DateFormat day = new SimpleDateFormat("E");
|
||||
Snackbar.make(view,
|
||||
Snackbar.make(
|
||||
(View) itemView.getParent(),
|
||||
day.format(message.ui_snoozed) + " " + df.format(message.ui_snoozed),
|
||||
Snackbar.LENGTH_LONG).show();
|
||||
}
|
||||
|
@ -1621,7 +1622,10 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
|
||||
PackageManager pm = context.getPackageManager();
|
||||
if (edit.resolveActivity(pm) == null)
|
||||
Snackbar.make(view, R.string.title_no_contacts, Snackbar.LENGTH_LONG).show();
|
||||
Snackbar.make(
|
||||
(View) itemView.getParent(),
|
||||
R.string.title_no_contacts,
|
||||
Snackbar.LENGTH_LONG).show();
|
||||
else
|
||||
context.startActivity(edit);
|
||||
}
|
||||
|
@ -2661,7 +2665,10 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
|
||||
PackageManager pm = context.getPackageManager();
|
||||
if (share.resolveActivity(pm) == null)
|
||||
Snackbar.make(view, R.string.title_no_viewer, Snackbar.LENGTH_LONG).show();
|
||||
Snackbar.make(
|
||||
(View) itemView.getParent(),
|
||||
R.string.title_no_viewer,
|
||||
Snackbar.LENGTH_LONG).show();
|
||||
else
|
||||
context.startActivity(share);
|
||||
}
|
||||
|
@ -3208,7 +3215,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
protected void onExecuted(Bundle args, List<EntityAnswer> answers) {
|
||||
if (answers == null || answers.size() == 0) {
|
||||
Snackbar snackbar = Snackbar.make(
|
||||
view,
|
||||
(View) itemView.getParent(),
|
||||
context.getString(R.string.title_no_answers),
|
||||
Snackbar.LENGTH_LONG);
|
||||
snackbar.setAction(R.string.title_fix, new View.OnClickListener() {
|
||||
|
|
|
@ -258,7 +258,10 @@ public class AdapterRule extends RecyclerView.Adapter<AdapterRule.ViewHolder> {
|
|||
|
||||
@Override
|
||||
protected void onExecuted(Bundle args, Integer applied) {
|
||||
Snackbar.make(view, context.getString(R.string.title_rule_applied, applied), Snackbar.LENGTH_LONG).show();
|
||||
Snackbar.make(
|
||||
(View) itemView.getParent(),
|
||||
context.getString(R.string.title_rule_applied, applied),
|
||||
Snackbar.LENGTH_LONG).show();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue