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>() {
@Override
public int compare(TupleFolderEx f1, TupleFolderEx f2) {
int s = ((Integer) EntityFolder.FOLDER_SORT_ORDER.indexOf(f1.type))
.compareTo(EntityFolder.FOLDER_SORT_ORDER.indexOf(f2.type));
int s = Integer.compare(
EntityFolder.FOLDER_SORT_ORDER.indexOf(f1.type),
EntityFolder.FOLDER_SORT_ORDER.indexOf(f2.type));
if (s != 0)
return s;
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);
}
public static final DiffUtil.ItemCallback<TupleMessageEx> DIFF_CALLBACK =
private static final DiffUtil.ItemCallback<TupleMessageEx> DIFF_CALLBACK =
new DiffUtil.ItemCallback<TupleMessageEx>() {
@Override
public boolean areItemsTheSame(

View File

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

View File

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

View File

@ -278,7 +278,7 @@ public class FragmentIdentity extends FragmentEx {
return null;
} 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);
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_archive).setVisible(!inOutbox && !inArchive && hasArchive);
bottom_navigation.getMenu().findItem(R.id.action_reply).setVisible(!inOutbox);

View File

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

View File

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