This commit is contained in:
M66B 2018-08-12 16:14:20 +00:00
parent ccc42a77a8
commit 82929b231e
8 changed files with 25 additions and 17 deletions

View File

@ -145,8 +145,9 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
Collections.sort(folders, new Comparator<TupleFolderEx>() { Collections.sort(folders, new Comparator<TupleFolderEx>() {
@Override @Override
public int compare(TupleFolderEx f1, TupleFolderEx f2) { public int compare(TupleFolderEx f1, TupleFolderEx f2) {
int s = ((Integer) EntityFolder.FOLDER_SORT_ORDER.indexOf(f1.type)) int s = Integer.compare(
.compareTo(EntityFolder.FOLDER_SORT_ORDER.indexOf(f2.type)); EntityFolder.FOLDER_SORT_ORDER.indexOf(f1.type),
EntityFolder.FOLDER_SORT_ORDER.indexOf(f2.type));
if (s != 0) if (s != 0)
return s; return s;
int c = -f1.synchronize.compareTo(f2.synchronize); int c = -f1.synchronize.compareTo(f2.synchronize);

View File

@ -203,7 +203,7 @@ public class AdapterMessage extends PagedListAdapter<TupleMessageEx, AdapterMess
this.debug = PreferenceManager.getDefaultSharedPreferences(context).getBoolean("debug", false); this.debug = PreferenceManager.getDefaultSharedPreferences(context).getBoolean("debug", false);
} }
public static final DiffUtil.ItemCallback<TupleMessageEx> DIFF_CALLBACK = private static final DiffUtil.ItemCallback<TupleMessageEx> DIFF_CALLBACK =
new DiffUtil.ItemCallback<TupleMessageEx>() { new DiffUtil.ItemCallback<TupleMessageEx>() {
@Override @Override
public boolean areItemsTheSame( public boolean areItemsTheSame(

View File

@ -317,12 +317,14 @@ public class FragmentCompose extends FragmentEx {
private void handlePickContact(int requestCode, Intent data) { private void handlePickContact(int requestCode, Intent data) {
Cursor cursor = null; Cursor cursor = null;
try { try {
cursor = getContext().getContentResolver().query(data.getData(), Uri uri = data.getData();
new String[]{ if (uri != null)
ContactsContract.CommonDataKinds.Email.ADDRESS, cursor = getContext().getContentResolver().query(uri,
ContactsContract.Contacts.DISPLAY_NAME new String[]{
}, ContactsContract.CommonDataKinds.Email.ADDRESS,
null, null, null); ContactsContract.Contacts.DISPLAY_NAME
},
null, null, null);
if (cursor != null && cursor.moveToFirst()) { if (cursor != null && cursor.moveToFirst()) {
int colEmail = cursor.getColumnIndex(ContactsContract.CommonDataKinds.Email.ADDRESS); int colEmail = cursor.getColumnIndex(ContactsContract.CommonDataKinds.Email.ADDRESS);
int colName = cursor.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME); int colName = cursor.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME);
@ -370,7 +372,8 @@ public class FragmentCompose extends FragmentEx {
Cursor cursor = null; Cursor cursor = null;
try { try {
Uri uri = args.getParcelable("uri"); Uri uri = args.getParcelable("uri");
cursor = context.getContentResolver().query(uri, null, null, null, null, null); if (uri != null)
cursor = context.getContentResolver().query(uri, null, null, null, null, null);
if (cursor == null || !cursor.moveToFirst()) if (cursor == null || !cursor.moveToFirst())
return null; return null;
@ -479,11 +482,13 @@ public class FragmentCompose extends FragmentEx {
Log.i(Helper.TAG, "Load draft action=" + action + " id=" + id + " account=" + account + " reference=" + reference); Log.i(Helper.TAG, "Load draft action=" + action + " id=" + id + " account=" + account + " reference=" + reference);
EntityMessage draft;
DB db = DB.getInstance(context); DB db = DB.getInstance(context);
try { try {
db.beginTransaction(); db.beginTransaction();
EntityMessage draft = db.message().getMessage(id); draft = db.message().getMessage(id);
if (draft == null) { if (draft == null) {
if ("edit".equals(action)) if ("edit".equals(action))
throw new IllegalStateException("Message to edit not found"); throw new IllegalStateException("Message to edit not found");

View File

@ -75,7 +75,7 @@ public class FragmentFolder extends FragmentEx {
new SimpleTask<Void>() { new SimpleTask<Void>() {
@Override @Override
protected Void onLoad(Context context, Bundle args) throws Throwable { protected Void onLoad(Context context, Bundle args) {
try { try {
ServiceSynchronize.stop(getContext(), "folder"); ServiceSynchronize.stop(getContext(), "folder");

View File

@ -278,7 +278,7 @@ public class FragmentIdentity extends FragmentEx {
return null; return null;
} finally { } finally {
ServiceSynchronize.restart(getContext(), "account"); ServiceSynchronize.restart(getContext(), "identity");
} }
} }

View File

@ -337,7 +337,7 @@ public class FragmentMessage extends FragmentEx {
top_navigation.setVisibility(View.VISIBLE); top_navigation.setVisibility(View.VISIBLE);
bottom_navigation.getMenu().findItem(R.id.action_spam).setVisible(!inOutbox && !inArchive && !inJunk && hasJunk); bottom_navigation.getMenu().findItem(R.id.action_spam).setVisible(!inOutbox && !inArchive && !inJunk && hasJunk);
bottom_navigation.getMenu().findItem(R.id.action_trash).setVisible(!inOutbox && !inArchive && hasTrash); bottom_navigation.getMenu().findItem(R.id.action_trash).setVisible(!inOutbox && hasTrash);
bottom_navigation.getMenu().findItem(R.id.action_move).setVisible(!inOutbox && (!inInbox || hasUser)); bottom_navigation.getMenu().findItem(R.id.action_move).setVisible(!inOutbox && (!inInbox || hasUser));
bottom_navigation.getMenu().findItem(R.id.action_archive).setVisible(!inOutbox && !inArchive && hasArchive); bottom_navigation.getMenu().findItem(R.id.action_archive).setVisible(!inOutbox && !inArchive && hasArchive);
bottom_navigation.getMenu().findItem(R.id.action_reply).setVisible(!inOutbox); bottom_navigation.getMenu().findItem(R.id.action_reply).setVisible(!inOutbox);

View File

@ -185,8 +185,10 @@ public class FragmentMessages extends FragmentEx {
@Override @Override
protected void onLoaded(Bundle args, Long account) { protected void onLoaded(Bundle args, Long account) {
fab.setTag(account); if (account != null) {
fab.setVisibility(View.VISIBLE); fab.setTag(account);
fab.setVisibility(View.VISIBLE);
}
} }
@Override @Override

View File

@ -155,7 +155,7 @@ public class FragmentSetup extends FragmentEx {
// Create outbox // Create outbox
new SimpleTask<Void>() { new SimpleTask<Void>() {
@Override @Override
protected Void onLoad(Context context, Bundle args) throws Throwable { protected Void onLoad(Context context, Bundle args) {
DB db = DB.getInstance(context); DB db = DB.getInstance(context);
try { try {
db.beginTransaction(); db.beginTransaction();