Browse Source

rename variables to camelCase

legacy
Ammar Githam 4 years ago
parent
commit
0023c56688
  1. 22
      app/src/main/java/awais/instagrabber/activities/DirectMessageThread.java

22
app/src/main/java/awais/instagrabber/activities/DirectMessageThread.java

@ -37,14 +37,14 @@ import awais.instagrabber.utils.Utils;
public final class DirectMessageThread extends BaseLanguageActivity { public final class DirectMessageThread extends BaseLanguageActivity {
private DirectItemModel directItemModel; private DirectItemModel directItemModel;
private String threadid;
private String threadId;
private String endCursor; private String endCursor;
private ActivityDmsBinding dmsBinding; private ActivityDmsBinding dmsBinding;
private MessageItemsAdapter messageItemsAdapter; private MessageItemsAdapter messageItemsAdapter;
private final ProfileModel myProfileHolder = ProfileModel.getDefaultProfileModel(); private final ProfileModel myProfileHolder = ProfileModel.getDefaultProfileModel();
private final ArrayList<ProfileModel> users = new ArrayList<>(); private final ArrayList<ProfileModel> users = new ArrayList<>();
private final ArrayList<ProfileModel> leftusers = new ArrayList<>();
private final ArrayList<ProfileModel> leftUsers = new ArrayList<>();
private final ArrayList<DirectItemModel> directItemModels = new ArrayList<>(); private final ArrayList<DirectItemModel> directItemModels = new ArrayList<>();
private final FetchListener<InboxThreadModel> fetchListener = new FetchListener<InboxThreadModel>() { private final FetchListener<InboxThreadModel> fetchListener = new FetchListener<InboxThreadModel>() {
@Override @Override
@ -65,10 +65,10 @@ public final class DirectMessageThread extends BaseLanguageActivity {
users.clear(); users.clear();
users.addAll(Arrays.asList(result.getUsers())); users.addAll(Arrays.asList(result.getUsers()));
leftusers.clear();
leftusers.addAll(Arrays.asList(result.getLeftUsers()));
leftUsers.clear();
leftUsers.addAll(Arrays.asList(result.getLeftUsers()));
threadid = result.getThreadId();
threadId = result.getThreadId();
dmsBinding.toolbar.toolbar.setTitle(result.getThreadTitle()); dmsBinding.toolbar.toolbar.setTitle(result.getThreadTitle());
String[] users = new String[result.getUsers().length]; String[] users = new String[result.getUsers().length];
for (int i = 0; i < users.length; ++i) { for (int i = 0; i < users.length; ++i) {
@ -90,7 +90,7 @@ public final class DirectMessageThread extends BaseLanguageActivity {
Toast.makeText(getApplicationContext(), R.string.comment_send_empty_comment, Toast.LENGTH_SHORT).show(); Toast.makeText(getApplicationContext(), R.string.comment_send_empty_comment, Toast.LENGTH_SHORT).show();
return; return;
} }
final CommentAction action = new CommentAction(dmsBinding.commentText.getText().toString(), threadid);
final CommentAction action = new CommentAction(dmsBinding.commentText.getText().toString(), threadId);
action.setOnTaskCompleteListener(result -> { action.setOnTaskCompleteListener(result -> {
if (!result) { if (!result) {
Toast.makeText(getApplicationContext(), R.string.downloader_unknown_error, Toast.LENGTH_SHORT).show(); Toast.makeText(getApplicationContext(), R.string.downloader_unknown_error, Toast.LENGTH_SHORT).show();
@ -100,7 +100,7 @@ public final class DirectMessageThread extends BaseLanguageActivity {
dmsBinding.commentText.clearFocus(); dmsBinding.commentText.clearFocus();
directItemModels.clear(); directItemModels.clear();
messageItemsAdapter.notifyDataSetChanged(); messageItemsAdapter.notifyDataSetChanged();
new UserInboxFetcher(threadid, UserInboxDirection.OLDER, null, fetchListener).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
new UserInboxFetcher(threadId, UserInboxDirection.OLDER, null, fetchListener).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}); });
action.execute(); action.execute();
}; };
@ -134,7 +134,7 @@ public final class DirectMessageThread extends BaseLanguageActivity {
} }
})); }));
messageItemsAdapter = new MessageItemsAdapter(directItemModels, users, leftusers, v -> {
messageItemsAdapter = new MessageItemsAdapter(directItemModels, users, leftUsers, v -> {
Object tag = v.getTag(); Object tag = v.getTag();
if (tag instanceof DirectItemModel) { if (tag instanceof DirectItemModel) {
directItemModel = (DirectItemModel) tag; directItemModel = (DirectItemModel) tag;
@ -203,9 +203,9 @@ public final class DirectMessageThread extends BaseLanguageActivity {
for (final ProfileModel user : users) { for (final ProfileModel user : users) {
if (Long.toString(userId).equals(user.getId())) result = user; if (Long.toString(userId).equals(user.getId())) result = user;
} }
if (leftusers != null)
for (final ProfileModel leftuser : leftusers) {
if (Long.toString(userId).equals(leftuser.getId())) result = leftuser;
if (leftUsers != null)
for (final ProfileModel leftUser : leftUsers) {
if (Long.toString(userId).equals(leftUser.getId())) result = leftUser;
} }
return result; return result;
} }

Loading…
Cancel
Save