|
|
|
@ -320,56 +320,73 @@ public class AdapterAccount extends RecyclerView.Adapter<AdapterAccount.ViewHold
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onClick(View view) {
|
|
|
|
|
if (view.getId() == R.id.btnHelp)
|
|
|
|
|
Helper.viewFAQ(context, 22);
|
|
|
|
|
else {
|
|
|
|
|
if (view.getId() == R.id.btnHelp) {
|
|
|
|
|
int pos = getAdapterPosition();
|
|
|
|
|
if (pos == RecyclerView.NO_POSITION)
|
|
|
|
|
return;
|
|
|
|
|
TupleAccountEx account = (pos == RecyclerView.NO_POSITION ? null : items.get(pos));
|
|
|
|
|
if (account == null)
|
|
|
|
|
Helper.viewFAQ(context, 22);
|
|
|
|
|
else {
|
|
|
|
|
Intent intent = new Intent(context, ActivityError.class);
|
|
|
|
|
intent.putExtra("title", "Test");
|
|
|
|
|
intent.putExtra("message", account.error);
|
|
|
|
|
intent.putExtra("provider", account.provider);
|
|
|
|
|
intent.putExtra("account", account.id);
|
|
|
|
|
intent.putExtra("protocol", account.protocol);
|
|
|
|
|
intent.putExtra("auth_type", account.auth_type);
|
|
|
|
|
intent.putExtra("personal", "personal");
|
|
|
|
|
intent.putExtra("address", "address");
|
|
|
|
|
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
|
|
|
|
context.startActivity(intent);
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TupleAccountEx account = items.get(pos);
|
|
|
|
|
if (account.tbd != null)
|
|
|
|
|
return;
|
|
|
|
|
int pos = getAdapterPosition();
|
|
|
|
|
if (pos == RecyclerView.NO_POSITION)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (view.getId() == R.id.ibInbox) {
|
|
|
|
|
Bundle args = new Bundle();
|
|
|
|
|
args.putLong("id", account.id);
|
|
|
|
|
TupleAccountEx account = items.get(pos);
|
|
|
|
|
if (account.tbd != null)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
new SimpleTask<EntityFolder>() {
|
|
|
|
|
@Override
|
|
|
|
|
protected EntityFolder onExecute(Context context, Bundle args) {
|
|
|
|
|
long id = args.getLong("id");
|
|
|
|
|
if (view.getId() == R.id.ibInbox) {
|
|
|
|
|
Bundle args = new Bundle();
|
|
|
|
|
args.putLong("id", account.id);
|
|
|
|
|
|
|
|
|
|
DB db = DB.getInstance(context);
|
|
|
|
|
return db.folder().getFolderByType(id, EntityFolder.INBOX);
|
|
|
|
|
}
|
|
|
|
|
new SimpleTask<EntityFolder>() {
|
|
|
|
|
@Override
|
|
|
|
|
protected EntityFolder onExecute(Context context, Bundle args) {
|
|
|
|
|
long id = args.getLong("id");
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
protected void onExecuted(Bundle args, EntityFolder inbox) {
|
|
|
|
|
if (inbox == null)
|
|
|
|
|
return;
|
|
|
|
|
DB db = DB.getInstance(context);
|
|
|
|
|
return db.folder().getFolderByType(id, EntityFolder.INBOX);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(context);
|
|
|
|
|
lbm.sendBroadcast(
|
|
|
|
|
new Intent(ActivityView.ACTION_VIEW_MESSAGES)
|
|
|
|
|
.putExtra("account", inbox.account)
|
|
|
|
|
.putExtra("folder", inbox.id)
|
|
|
|
|
.putExtra("type", inbox.type));
|
|
|
|
|
@Override
|
|
|
|
|
protected void onExecuted(Bundle args, EntityFolder inbox) {
|
|
|
|
|
if (inbox == null)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(context);
|
|
|
|
|
lbm.sendBroadcast(
|
|
|
|
|
new Intent(ActivityView.ACTION_VIEW_MESSAGES)
|
|
|
|
|
.putExtra("account", inbox.account)
|
|
|
|
|
.putExtra("folder", inbox.id)
|
|
|
|
|
.putExtra("type", inbox.type));
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
protected void onException(Bundle args, Throwable ex) {
|
|
|
|
|
Log.unexpectedError(parentFragment.getParentFragmentManager(), ex);
|
|
|
|
|
}
|
|
|
|
|
}.execute(context, owner, args, "account:inbox");
|
|
|
|
|
} else {
|
|
|
|
|
LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(context);
|
|
|
|
|
lbm.sendBroadcast(
|
|
|
|
|
new Intent(settings ? ActivitySetup.ACTION_EDIT_ACCOUNT : ActivityView.ACTION_VIEW_FOLDERS)
|
|
|
|
|
.putExtra("id", account.id)
|
|
|
|
|
.putExtra("protocol", account.protocol));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
protected void onException(Bundle args, Throwable ex) {
|
|
|
|
|
Log.unexpectedError(parentFragment.getParentFragmentManager(), ex);
|
|
|
|
|
}
|
|
|
|
|
}.execute(context, owner, args, "account:inbox");
|
|
|
|
|
} else {
|
|
|
|
|
LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(context);
|
|
|
|
|
lbm.sendBroadcast(
|
|
|
|
|
new Intent(settings ? ActivitySetup.ACTION_EDIT_ACCOUNT : ActivityView.ACTION_VIEW_FOLDERS)
|
|
|
|
|
.putExtra("id", account.id)
|
|
|
|
|
.putExtra("protocol", account.protocol));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|