Minor improvements

pull/12/merge
M66B 6 years ago
parent 9f626e3489
commit d6363b7f81

@ -89,7 +89,7 @@ public class AdapterAccount extends RecyclerView.Adapter<AdapterAccount.ViewHold
setHasStableIds(true); setHasStableIds(true);
} }
public void set(List<EntityAccount> accounts) { public void set(@NonNull List<EntityAccount> accounts) {
Log.i(Helper.TAG, "Set accounts=" + accounts.size()); Log.i(Helper.TAG, "Set accounts=" + accounts.size());
final Collator collator = Collator.getInstance(Locale.getDefault()); final Collator collator = Collator.getInstance(Locale.getDefault());

@ -164,7 +164,7 @@ public class AdapterAttachment extends RecyclerView.Adapter<AdapterAttachment.Vi
setHasStableIds(true); setHasStableIds(true);
} }
public void set(List<TupleAttachment> attachments) { public void set(@NonNull List<TupleAttachment> attachments) {
Log.i(Helper.TAG, "Set attachments=" + attachments.size()); Log.i(Helper.TAG, "Set attachments=" + attachments.size());
Collections.sort(attachments, new Comparator<TupleAttachment>() { Collections.sort(attachments, new Comparator<TupleAttachment>() {

@ -110,7 +110,7 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
setHasStableIds(true); setHasStableIds(true);
} }
public void set(List<TupleFolderEx> folders) { public void set(@NonNull List<TupleFolderEx> folders) {
Log.i(Helper.TAG, "Set folders=" + folders.size()); Log.i(Helper.TAG, "Set folders=" + folders.size());
final Collator collator = Collator.getInstance(Locale.getDefault()); final Collator collator = Collator.getInstance(Locale.getDefault());

@ -89,7 +89,7 @@ public class AdapterIdentity extends RecyclerView.Adapter<AdapterIdentity.ViewHo
setHasStableIds(true); setHasStableIds(true);
} }
public void set(List<EntityIdentity> identities) { public void set(@NonNull List<EntityIdentity> identities) {
Log.i(Helper.TAG, "Set identities=" + identities.size()); Log.i(Helper.TAG, "Set identities=" + identities.size());
final Collator collator = Collator.getInstance(Locale.getDefault()); final Collator collator = Collator.getInstance(Locale.getDefault());

@ -120,7 +120,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
setHasStableIds(true); setHasStableIds(true);
} }
public void set(List<TupleMessageEx> messages) { public void set(@NonNull List<TupleMessageEx> messages) {
Log.i(Helper.TAG, "Set messages=" + messages.size()); Log.i(Helper.TAG, "Set messages=" + messages.size());
Collections.sort(messages, new Comparator<TupleMessageEx>() { Collections.sort(messages, new Comparator<TupleMessageEx>() {

@ -86,7 +86,7 @@ public class FragmentAccount extends FragmentEx {
// Get arguments // Get arguments
Bundle args = getArguments(); Bundle args = getArguments();
final long id = args.getLong("id", -1); final long id = (args == null ? -1 : args.getLong("id", -1));
// Get providers // Get providers
providers = Provider.loadProfiles(getContext()); providers = Provider.loadProfiles(getContext());

@ -92,8 +92,8 @@ public class FragmentCompose extends FragmentEx {
// Get arguments // Get arguments
Bundle args = getArguments(); Bundle args = getArguments();
String action = args.getString("action"); String action = (args == null ? null : args.getString("action"));
final long id = (TextUtils.isEmpty(action) ? args.getLong("id") : -1); final long id = (TextUtils.isEmpty(action) ? (args == null ? -1 : args.getLong("id")) : -1);
// Get controls // Get controls
spFrom = view.findViewById(R.id.spFrom); spFrom = view.findViewById(R.id.spFrom);
@ -242,7 +242,7 @@ public class FragmentCompose extends FragmentEx {
ContactsContract.Contacts.DISPLAY_NAME ContactsContract.Contacts.DISPLAY_NAME
}, },
null, null, null); null, null, null);
if (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);
String email = cursor.getString(colEmail); String email = cursor.getString(colEmail);

@ -56,7 +56,7 @@ public class FragmentFolder extends FragmentEx {
// Get arguments // Get arguments
Bundle args = getArguments(); Bundle args = getArguments();
final long id = args.getLong("id"); final long id = (args == null ? -1 : args.getLong("id"));
// Get controls // Get controls
cbSynchronize = view.findViewById(R.id.cbSynchronize); cbSynchronize = view.findViewById(R.id.cbSynchronize);

@ -79,7 +79,7 @@ public class FragmentIdentity extends FragmentEx {
// Get arguments // Get arguments
Bundle args = getArguments(); Bundle args = getArguments();
final long id = args.getLong("id", -1); final long id = (args == null ? -1 : args.getLong("id", -1));
// Get providers // Get providers
providers = Provider.loadProfiles(getContext()); providers = Provider.loadProfiles(getContext());
@ -221,7 +221,7 @@ public class FragmentIdentity extends FragmentEx {
identity.name = Objects.requireNonNull(args.getString("name")); identity.name = Objects.requireNonNull(args.getString("name"));
identity.email = Objects.requireNonNull(args.getString("email")); identity.email = Objects.requireNonNull(args.getString("email"));
identity.replyto = replyto; identity.replyto = replyto;
identity.host = host; identity.host = Objects.requireNonNull(host);
identity.port = Integer.parseInt(port); identity.port = Integer.parseInt(port);
identity.starttls = starttls; identity.starttls = starttls;
identity.user = Objects.requireNonNull(args.getString("user")); identity.user = Objects.requireNonNull(args.getString("user"));

@ -92,7 +92,8 @@ public class FragmentMessage extends FragmentEx {
View view = inflater.inflate(R.layout.fragment_message, container, false); View view = inflater.inflate(R.layout.fragment_message, container, false);
// Get arguments // Get arguments
final long id = getArguments().getLong("id"); Bundle args = getArguments();
final long id = (args == null ? -1 : args.getLong("id"));
// Get controls // Get controls
tvFrom = view.findViewById(R.id.tvFrom); tvFrom = view.findViewById(R.id.tvFrom);
@ -467,14 +468,6 @@ public class FragmentMessage extends FragmentEx {
.putExtra("action", "reply")); .putExtra("action", "reply"));
} }
private static class MetaData {
Throwable ex;
EntityFolder folder;
boolean hasTrash;
boolean hasJunk;
boolean hasArchive;
}
private static class MoveLoader extends AsyncTaskLoader<List<EntityFolder>> { private static class MoveLoader extends AsyncTaskLoader<List<EntityFolder>> {
private Bundle args; private Bundle args;
@ -493,7 +486,7 @@ public class FragmentMessage extends FragmentEx {
List<EntityFolder> folders = db.folder().getUserFolders(message.account); List<EntityFolder> folders = db.folder().getUserFolders(message.account);
for (int i = 0; i < folders.size(); i++) for (int i = 0; i < folders.size(); i++)
if (folders.get(i).id == message.folder) { if (folders.get(i).id.equals(message.folder)) {
folders.remove(i); folders.remove(i);
break; break;
} }
@ -509,7 +502,7 @@ public class FragmentMessage extends FragmentEx {
}); });
EntityFolder inbox = db.folder().getFolderByType(message.account, EntityFolder.TYPE_INBOX); EntityFolder inbox = db.folder().getFolderByType(message.account, EntityFolder.TYPE_INBOX);
if (message.folder != inbox.id) if (!message.folder.equals(inbox.id))
folders.add(0, inbox); folders.add(0, inbox);
return folders; return folders;

@ -126,7 +126,7 @@ public class FragmentMessages extends FragmentEx {
pbWait.setVisibility(View.GONE); pbWait.setVisibility(View.GONE);
grpReady.setVisibility(View.VISIBLE); grpReady.setVisibility(View.VISIBLE);
if (messages == null || messages.size() == 0) { if (messages.size() == 0) {
tvNoEmail.setVisibility(View.VISIBLE); tvNoEmail.setVisibility(View.VISIBLE);
rvMessage.setVisibility(View.GONE); rvMessage.setVisibility(View.GONE);
} else { } else {

@ -69,7 +69,8 @@ public class FragmentWebView extends FragmentEx {
} }
}); });
url = getArguments().getString("link"); Bundle args = getArguments();
url = (args == null ? null : args.getString("link"));
webview.loadUrl(url); webview.loadUrl(url);
setSubtitle(url); setSubtitle(url);

Loading…
Cancel
Save