mirror of
https://github.com/KokaKiwi/BarInsta
synced 2024-11-26 00:27:30 +00:00
organize code for readability
This commit is contained in:
parent
4e00d02f17
commit
86b9feda4a
@ -37,10 +37,15 @@ import awais.instagrabber.utils.Utils;
|
|||||||
|
|
||||||
public final class DirectMessageThread extends BaseLanguageActivity {
|
public final class DirectMessageThread extends BaseLanguageActivity {
|
||||||
private DirectItemModel directItemModel;
|
private DirectItemModel directItemModel;
|
||||||
private final ProfileModel myProfileHolder = ProfileModel.getDefaultProfileModel();
|
|
||||||
private final ArrayList<ProfileModel> users = new ArrayList<>(), leftusers = new ArrayList<>();
|
|
||||||
private final ArrayList<DirectItemModel> directItemModels = new ArrayList<>();
|
|
||||||
private String threadid;
|
private String threadid;
|
||||||
|
private String endCursor;
|
||||||
|
private ActivityDmsBinding dmsBinding;
|
||||||
|
private MessageItemsAdapter messageItemsAdapter;
|
||||||
|
|
||||||
|
private final ProfileModel myProfileHolder = ProfileModel.getDefaultProfileModel();
|
||||||
|
private final ArrayList<ProfileModel> users = new ArrayList<>();
|
||||||
|
private final ArrayList<ProfileModel> leftusers = 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
|
||||||
public void doBefore() {
|
public void doBefore() {
|
||||||
@ -80,9 +85,25 @@ public final class DirectMessageThread extends BaseLanguageActivity {
|
|||||||
dmsBinding.swipeRefreshLayout.setRefreshing(false);
|
dmsBinding.swipeRefreshLayout.setRefreshing(false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
private String endCursor;
|
private final View.OnClickListener newCommentListener = v -> {
|
||||||
private ActivityDmsBinding dmsBinding;
|
if (Utils.isEmpty(dmsBinding.commentText.getText().toString()) && v == dmsBinding.commentSend)
|
||||||
private MessageItemsAdapter messageItemsAdapter;
|
Toast.makeText(getApplicationContext(), R.string.comment_send_empty_comment, Toast.LENGTH_SHORT).show();
|
||||||
|
else if (v == dmsBinding.commentSend) {
|
||||||
|
final CommentAction action = new CommentAction(dmsBinding.commentText.getText().toString(), threadid);
|
||||||
|
action.setOnTaskCompleteListener(result -> {
|
||||||
|
if (!result) {
|
||||||
|
Toast.makeText(getApplicationContext(), R.string.downloader_unknown_error, Toast.LENGTH_SHORT).show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
dmsBinding.commentText.setText("");
|
||||||
|
dmsBinding.commentText.clearFocus();
|
||||||
|
directItemModels.clear();
|
||||||
|
messageItemsAdapter.notifyDataSetChanged();
|
||||||
|
new UserInboxFetcher(threadid, UserInboxDirection.OLDER, null, fetchListener).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||||
|
});
|
||||||
|
action.execute();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(@Nullable final Bundle savedInstanceState) {
|
protected void onCreate(@Nullable final Bundle savedInstanceState) {
|
||||||
@ -194,25 +215,4 @@ public final class DirectMessageThread extends BaseLanguageActivity {
|
|||||||
private void searchUsername(final String text) {
|
private void searchUsername(final String text) {
|
||||||
startActivity(new Intent(getApplicationContext(), ProfileViewer.class).putExtra(Constants.EXTRAS_USERNAME, text));
|
startActivity(new Intent(getApplicationContext(), ProfileViewer.class).putExtra(Constants.EXTRAS_USERNAME, text));
|
||||||
}
|
}
|
||||||
|
|
||||||
private final View.OnClickListener newCommentListener = v -> {
|
|
||||||
if (Utils.isEmpty(dmsBinding.commentText.getText().toString()) && v == dmsBinding.commentSend)
|
|
||||||
Toast.makeText(getApplicationContext(), R.string.comment_send_empty_comment, Toast.LENGTH_SHORT).show();
|
|
||||||
else if (v == dmsBinding.commentSend) {
|
|
||||||
final CommentAction action = new CommentAction(dmsBinding.commentText.getText().toString(), threadid);
|
|
||||||
action.setOnTaskCompleteListener(result -> {
|
|
||||||
if (!result) {
|
|
||||||
Toast.makeText(getApplicationContext(), R.string.downloader_unknown_error, Toast.LENGTH_SHORT).show();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
dmsBinding.commentText.setText("");
|
|
||||||
dmsBinding.commentText.clearFocus();
|
|
||||||
directItemModels.clear();
|
|
||||||
messageItemsAdapter.notifyDataSetChanged();
|
|
||||||
new UserInboxFetcher(threadid, UserInboxDirection.OLDER, null, fetchListener).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
|
||||||
});
|
|
||||||
action.execute();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user