|
|
@ -39,6 +39,7 @@ import android.view.MenuItem;
|
|
|
|
import android.view.View;
|
|
|
|
import android.view.View;
|
|
|
|
import android.view.ViewGroup;
|
|
|
|
import android.view.ViewGroup;
|
|
|
|
import android.widget.Button;
|
|
|
|
import android.widget.Button;
|
|
|
|
|
|
|
|
import android.widget.ImageButton;
|
|
|
|
import android.widget.ImageView;
|
|
|
|
import android.widget.ImageView;
|
|
|
|
import android.widget.TextView;
|
|
|
|
import android.widget.TextView;
|
|
|
|
|
|
|
|
|
|
|
@ -85,6 +86,7 @@ public class AdapterAccount extends RecyclerView.Adapter<AdapterAccount.ViewHold
|
|
|
|
private ImageView ivNotify;
|
|
|
|
private ImageView ivNotify;
|
|
|
|
private TextView tvName;
|
|
|
|
private TextView tvName;
|
|
|
|
private ImageView ivSync;
|
|
|
|
private ImageView ivSync;
|
|
|
|
|
|
|
|
private ImageButton ibInbox;
|
|
|
|
private TextView tvUser;
|
|
|
|
private TextView tvUser;
|
|
|
|
private ImageView ivState;
|
|
|
|
private ImageView ivState;
|
|
|
|
private TextView tvHost;
|
|
|
|
private TextView tvHost;
|
|
|
@ -105,6 +107,7 @@ public class AdapterAccount extends RecyclerView.Adapter<AdapterAccount.ViewHold
|
|
|
|
view = itemView.findViewById(R.id.clItem);
|
|
|
|
view = itemView.findViewById(R.id.clItem);
|
|
|
|
vwColor = itemView.findViewById(R.id.vwColor);
|
|
|
|
vwColor = itemView.findViewById(R.id.vwColor);
|
|
|
|
ivSync = itemView.findViewById(R.id.ivSync);
|
|
|
|
ivSync = itemView.findViewById(R.id.ivSync);
|
|
|
|
|
|
|
|
ibInbox = itemView.findViewById(R.id.ibInbox);
|
|
|
|
ivOAuth = itemView.findViewById(R.id.ivOAuth);
|
|
|
|
ivOAuth = itemView.findViewById(R.id.ivOAuth);
|
|
|
|
ivPrimary = itemView.findViewById(R.id.ivPrimary);
|
|
|
|
ivPrimary = itemView.findViewById(R.id.ivPrimary);
|
|
|
|
ivNotify = itemView.findViewById(R.id.ivNotify);
|
|
|
|
ivNotify = itemView.findViewById(R.id.ivNotify);
|
|
|
@ -125,12 +128,14 @@ public class AdapterAccount extends RecyclerView.Adapter<AdapterAccount.ViewHold
|
|
|
|
private void wire() {
|
|
|
|
private void wire() {
|
|
|
|
view.setOnClickListener(this);
|
|
|
|
view.setOnClickListener(this);
|
|
|
|
view.setOnLongClickListener(this);
|
|
|
|
view.setOnLongClickListener(this);
|
|
|
|
|
|
|
|
ibInbox.setOnClickListener(this);
|
|
|
|
btnHelp.setOnClickListener(this);
|
|
|
|
btnHelp.setOnClickListener(this);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void unwire() {
|
|
|
|
private void unwire() {
|
|
|
|
view.setOnClickListener(null);
|
|
|
|
view.setOnClickListener(null);
|
|
|
|
view.setOnLongClickListener(null);
|
|
|
|
view.setOnLongClickListener(null);
|
|
|
|
|
|
|
|
ibInbox.setOnClickListener(null);
|
|
|
|
btnHelp.setOnClickListener(null);
|
|
|
|
btnHelp.setOnClickListener(null);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -199,6 +204,7 @@ public class AdapterAccount extends RecyclerView.Adapter<AdapterAccount.ViewHold
|
|
|
|
tvError.setVisibility(account.error == null ? View.GONE : View.VISIBLE);
|
|
|
|
tvError.setVisibility(account.error == null ? View.GONE : View.VISIBLE);
|
|
|
|
btnHelp.setVisibility(account.error == null ? View.GONE : View.VISIBLE);
|
|
|
|
btnHelp.setVisibility(account.error == null ? View.GONE : View.VISIBLE);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ibInbox.setVisibility(settings ? View.GONE : View.VISIBLE);
|
|
|
|
grpSettings.setVisibility(settings ? View.VISIBLE : View.GONE);
|
|
|
|
grpSettings.setVisibility(settings ? View.VISIBLE : View.GONE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -215,11 +221,45 @@ public class AdapterAccount extends RecyclerView.Adapter<AdapterAccount.ViewHold
|
|
|
|
if (account.tbd != null)
|
|
|
|
if (account.tbd != null)
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(context);
|
|
|
|
if (view.getId() == R.id.ibInbox) {
|
|
|
|
lbm.sendBroadcast(
|
|
|
|
Bundle args = new Bundle();
|
|
|
|
new Intent(settings ? ActivitySetup.ACTION_EDIT_ACCOUNT : ActivityView.ACTION_VIEW_FOLDERS)
|
|
|
|
args.putLong("id", account.id);
|
|
|
|
.putExtra("id", account.id)
|
|
|
|
|
|
|
|
.putExtra("protocol", account.protocol));
|
|
|
|
new SimpleTask<EntityFolder>() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
protected EntityFolder onExecute(Context context, Bundle args) {
|
|
|
|
|
|
|
|
long id = args.getLong("id");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DB db = DB.getInstance(context);
|
|
|
|
|
|
|
|
return db.folder().getFolderByType(id, EntityFolder.INBOX);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@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));
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|