use of org.telegram.ui.ActionBar.AlertDialog in project Telegram-FOSS by Telegram-FOSS-Team.
the class ChatActivity method scrollToLastMessage.
private void scrollToLastMessage(boolean skipSponsored) {
if (chatListView.isFastScrollAnimationRunning()) {
return;
}
forceNextPinnedMessageId = 0;
nextScrollToMessageId = 0;
forceScrollToFirst = false;
chatScrollHelper.setScrollDirection(RecyclerAnimationScrollHelper.SCROLL_DIRECTION_DOWN);
if (forwardEndReached[0] && first_unread_id == 0 && startLoadFromMessageId == 0) {
if (chatLayoutManager.findFirstCompletelyVisibleItemPosition() == 0) {
canShowPagedownButton = false;
updatePagedownButtonVisibility(true);
removeSelectedMessageHighlight();
updateVisibleRows();
} else {
chatAdapter.updateRowsSafe();
chatScrollHelperCallback.scrollTo = null;
int position = 0;
if (skipSponsored) {
while (position < messages.size()) {
if (!messages.get(position).isSponsored()) {
break;
}
position++;
}
}
chatScrollHelper.scrollToPosition(position, 0, true, true);
}
} else {
if (progressDialog != null) {
progressDialog.dismiss();
}
updatePinnedListButton(false);
progressDialog = new AlertDialog(getParentActivity(), 3, themeDelegate);
progressDialog.setOnCancelListener(postponedScrollCancelListener);
progressDialog.showDelayed(1000);
postponedScrollToLastMessageQueryIndex = lastLoadIndex;
postponedScrollMessageId = 0;
postponedScrollIsCanceled = false;
waitingForLoad.clear();
waitingForLoad.add(lastLoadIndex);
getMessagesController().loadMessages(dialog_id, mergeDialogId, false, 30, 0, 0, true, 0, classGuid, 0, 0, chatMode, threadMessageId, replyMaxReadId, lastLoadIndex++);
}
}
use of org.telegram.ui.ActionBar.AlertDialog in project Telegram-FOSS by Telegram-FOSS-Team.
the class PrivacyControlActivity method applyCurrentPrivacySettings.
private void applyCurrentPrivacySettings() {
TLRPC.TL_account_setPrivacy req = new TLRPC.TL_account_setPrivacy();
if (rulesType == PRIVACY_RULES_TYPE_PHONE) {
req.key = new TLRPC.TL_inputPrivacyKeyPhoneNumber();
if (currentType == TYPE_NOBODY) {
TLRPC.TL_account_setPrivacy req2 = new TLRPC.TL_account_setPrivacy();
req2.key = new TLRPC.TL_inputPrivacyKeyAddedByPhone();
if (currentSubType == 0) {
req2.rules.add(new TLRPC.TL_inputPrivacyValueAllowAll());
} else {
req2.rules.add(new TLRPC.TL_inputPrivacyValueAllowContacts());
}
ConnectionsManager.getInstance(currentAccount).sendRequest(req2, (response, error) -> AndroidUtilities.runOnUIThread(() -> {
if (error == null) {
TLRPC.TL_account_privacyRules privacyRules = (TLRPC.TL_account_privacyRules) response;
ContactsController.getInstance(currentAccount).setPrivacyRules(privacyRules.rules, PRIVACY_RULES_TYPE_ADDED_BY_PHONE);
}
}), ConnectionsManager.RequestFlagFailOnServerErrors);
}
} else if (rulesType == PRIVACY_RULES_TYPE_FORWARDS) {
req.key = new TLRPC.TL_inputPrivacyKeyForwards();
} else if (rulesType == PRIVACY_RULES_TYPE_PHOTO) {
req.key = new TLRPC.TL_inputPrivacyKeyProfilePhoto();
} else if (rulesType == PRIVACY_RULES_TYPE_P2P) {
req.key = new TLRPC.TL_inputPrivacyKeyPhoneP2P();
} else if (rulesType == PRIVACY_RULES_TYPE_CALLS) {
req.key = new TLRPC.TL_inputPrivacyKeyPhoneCall();
} else if (rulesType == PRIVACY_RULES_TYPE_INVITE) {
req.key = new TLRPC.TL_inputPrivacyKeyChatInvite();
} else {
req.key = new TLRPC.TL_inputPrivacyKeyStatusTimestamp();
}
if (currentType != 0 && currentPlus.size() > 0) {
TLRPC.TL_inputPrivacyValueAllowUsers usersRule = new TLRPC.TL_inputPrivacyValueAllowUsers();
TLRPC.TL_inputPrivacyValueAllowChatParticipants chatsRule = new TLRPC.TL_inputPrivacyValueAllowChatParticipants();
for (int a = 0; a < currentPlus.size(); a++) {
long id = currentPlus.get(a);
if (DialogObject.isUserDialog(id)) {
TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(id);
if (user != null) {
TLRPC.InputUser inputUser = MessagesController.getInstance(currentAccount).getInputUser(user);
if (inputUser != null) {
usersRule.users.add(inputUser);
}
}
} else {
chatsRule.chats.add(-id);
}
}
req.rules.add(usersRule);
req.rules.add(chatsRule);
}
if (currentType != 1 && currentMinus.size() > 0) {
TLRPC.TL_inputPrivacyValueDisallowUsers usersRule = new TLRPC.TL_inputPrivacyValueDisallowUsers();
TLRPC.TL_inputPrivacyValueDisallowChatParticipants chatsRule = new TLRPC.TL_inputPrivacyValueDisallowChatParticipants();
for (int a = 0; a < currentMinus.size(); a++) {
long id = currentMinus.get(a);
if (DialogObject.isUserDialog(id)) {
TLRPC.User user = getMessagesController().getUser(id);
if (user != null) {
TLRPC.InputUser inputUser = getMessagesController().getInputUser(user);
if (inputUser != null) {
usersRule.users.add(inputUser);
}
}
} else {
chatsRule.chats.add(-id);
}
}
req.rules.add(usersRule);
req.rules.add(chatsRule);
}
if (currentType == TYPE_EVERYBODY) {
req.rules.add(new TLRPC.TL_inputPrivacyValueAllowAll());
} else if (currentType == TYPE_NOBODY) {
req.rules.add(new TLRPC.TL_inputPrivacyValueDisallowAll());
} else if (currentType == TYPE_CONTACTS) {
req.rules.add(new TLRPC.TL_inputPrivacyValueAllowContacts());
}
AlertDialog progressDialog = null;
if (getParentActivity() != null) {
progressDialog = new AlertDialog(getParentActivity(), 3);
progressDialog.setCanCacnel(false);
progressDialog.show();
}
final AlertDialog progressDialogFinal = progressDialog;
ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> {
try {
if (progressDialogFinal != null) {
progressDialogFinal.dismiss();
}
} catch (Exception e) {
FileLog.e(e);
}
if (error == null) {
TLRPC.TL_account_privacyRules privacyRules = (TLRPC.TL_account_privacyRules) response;
MessagesController.getInstance(currentAccount).putUsers(privacyRules.users, false);
MessagesController.getInstance(currentAccount).putChats(privacyRules.chats, false);
ContactsController.getInstance(currentAccount).setPrivacyRules(privacyRules.rules, rulesType);
finishFragment();
} else {
showErrorAlert();
}
}), ConnectionsManager.RequestFlagFailOnServerErrors);
}
use of org.telegram.ui.ActionBar.AlertDialog in project Telegram-FOSS by Telegram-FOSS-Team.
the class PrivacySettingsActivity method createView.
@Override
public View createView(Context context) {
actionBar.setBackButtonImage(R.drawable.ic_ab_back);
actionBar.setAllowOverlayTitle(true);
actionBar.setTitle(LocaleController.getString("PrivacySettings", R.string.PrivacySettings));
actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {
@Override
public void onItemClick(int id) {
if (id == -1) {
finishFragment();
}
}
});
listAdapter = new ListAdapter(context);
fragmentView = new FrameLayout(context);
FrameLayout frameLayout = (FrameLayout) fragmentView;
frameLayout.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundGray));
listView = new RecyclerListView(context);
listView.setLayoutManager(layoutManager = new LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false) {
@Override
public boolean supportsPredictiveItemAnimations() {
return false;
}
});
listView.setVerticalScrollBarEnabled(false);
listView.setItemAnimator(null);
listView.setLayoutAnimation(null);
frameLayout.addView(listView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
listView.setAdapter(listAdapter);
listView.setOnItemClickListener((view, position) -> {
if (!view.isEnabled()) {
return;
}
if (position == blockedRow) {
presentFragment(new PrivacyUsersActivity());
} else if (position == sessionsRow) {
presentFragment(new SessionsActivity(0));
} else if (position == webSessionsRow) {
presentFragment(new SessionsActivity(1));
} else if (position == deleteAccountRow) {
if (getParentActivity() == null) {
return;
}
int ttl = getContactsController().getDeleteAccountTTL();
int selected;
if (ttl <= 31) {
selected = 0;
} else if (ttl <= 93) {
selected = 1;
} else if (ttl <= 182) {
selected = 2;
} else {
selected = 3;
}
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
builder.setTitle(LocaleController.getString("DeleteAccountTitle", R.string.DeleteAccountTitle));
String[] items = new String[] { LocaleController.formatPluralString("Months", 1), LocaleController.formatPluralString("Months", 3), LocaleController.formatPluralString("Months", 6), LocaleController.formatPluralString("Years", 1) };
final LinearLayout linearLayout = new LinearLayout(getParentActivity());
linearLayout.setOrientation(LinearLayout.VERTICAL);
builder.setView(linearLayout);
for (int a = 0; a < items.length; a++) {
RadioColorCell cell = new RadioColorCell(getParentActivity());
cell.setPadding(AndroidUtilities.dp(4), 0, AndroidUtilities.dp(4), 0);
cell.setTag(a);
cell.setCheckColor(Theme.getColor(Theme.key_radioBackground), Theme.getColor(Theme.key_dialogRadioBackgroundChecked));
cell.setTextAndValue(items[a], selected == a);
linearLayout.addView(cell);
cell.setOnClickListener(v -> {
builder.getDismissRunnable().run();
Integer which = (Integer) v.getTag();
int value = 0;
if (which == 0) {
value = 30;
} else if (which == 1) {
value = 90;
} else if (which == 2) {
value = 182;
} else if (which == 3) {
value = 365;
}
final AlertDialog progressDialog = new AlertDialog(getParentActivity(), 3);
progressDialog.setCanCacnel(false);
progressDialog.show();
final TLRPC.TL_account_setAccountTTL req = new TLRPC.TL_account_setAccountTTL();
req.ttl = new TLRPC.TL_accountDaysTTL();
req.ttl.days = value;
getConnectionsManager().sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> {
try {
progressDialog.dismiss();
} catch (Exception e) {
FileLog.e(e);
}
if (response instanceof TLRPC.TL_boolTrue) {
getContactsController().setDeleteAccountTTL(req.ttl.days);
listAdapter.notifyDataSetChanged();
}
}));
});
}
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
showDialog(builder.create());
} else if (position == lastSeenRow) {
presentFragment(new PrivacyControlActivity(ContactsController.PRIVACY_RULES_TYPE_LASTSEEN));
} else if (position == phoneNumberRow) {
presentFragment(new PrivacyControlActivity(ContactsController.PRIVACY_RULES_TYPE_PHONE));
} else if (position == groupsRow) {
presentFragment(new PrivacyControlActivity(ContactsController.PRIVACY_RULES_TYPE_INVITE));
} else if (position == callsRow) {
presentFragment(new PrivacyControlActivity(ContactsController.PRIVACY_RULES_TYPE_CALLS));
} else if (position == profilePhotoRow) {
presentFragment(new PrivacyControlActivity(ContactsController.PRIVACY_RULES_TYPE_PHOTO));
} else if (position == forwardsRow) {
presentFragment(new PrivacyControlActivity(ContactsController.PRIVACY_RULES_TYPE_FORWARDS));
} else if (position == passwordRow) {
if (currentPassword == null) {
return;
}
if (!TwoStepVerificationActivity.canHandleCurrentPassword(currentPassword, false)) {
AlertsCreator.showUpdateAppAlert(getParentActivity(), LocaleController.getString("UpdateAppAlert", R.string.UpdateAppAlert), true);
}
if (currentPassword.has_password) {
TwoStepVerificationActivity fragment = new TwoStepVerificationActivity();
fragment.setPassword(currentPassword);
presentFragment(fragment);
} else {
int type;
if (TextUtils.isEmpty(currentPassword.email_unconfirmed_pattern)) {
type = TwoStepVerificationSetupActivity.TYPE_INTRO;
} else {
type = TwoStepVerificationSetupActivity.TYPE_EMAIL_CONFIRM;
}
presentFragment(new TwoStepVerificationSetupActivity(type, currentPassword));
}
} else if (position == passcodeRow) {
if (SharedConfig.passcodeHash.length() > 0) {
presentFragment(new PasscodeActivity(2));
} else {
presentFragment(new PasscodeActivity(0));
}
} else if (position == secretWebpageRow) {
if (getMessagesController().secretWebpagePreview == 1) {
getMessagesController().secretWebpagePreview = 0;
} else {
getMessagesController().secretWebpagePreview = 1;
}
MessagesController.getGlobalMainSettings().edit().putInt("secretWebpage2", getMessagesController().secretWebpagePreview).commit();
if (view instanceof TextCheckCell) {
((TextCheckCell) view).setChecked(getMessagesController().secretWebpagePreview == 1);
}
} else if (position == contactsDeleteRow) {
if (getParentActivity() == null) {
return;
}
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
builder.setTitle(LocaleController.getString("SyncContactsDeleteTitle", R.string.SyncContactsDeleteTitle));
builder.setMessage(AndroidUtilities.replaceTags(LocaleController.getString("SyncContactsDeleteText", R.string.SyncContactsDeleteText)));
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
builder.setPositiveButton(LocaleController.getString("Delete", R.string.Delete), (dialogInterface, i) -> {
AlertDialog.Builder builder12 = new AlertDialog.Builder(getParentActivity(), 3, null);
progressDialog = builder12.show();
progressDialog.setCanCacnel(false);
if (currentSync != newSync) {
currentSync = getUserConfig().syncContacts = newSync;
getUserConfig().saveConfig(false);
}
getContactsController().deleteAllContacts(() -> progressDialog.dismiss());
});
AlertDialog alertDialog = builder.create();
showDialog(alertDialog);
TextView button = (TextView) alertDialog.getButton(DialogInterface.BUTTON_POSITIVE);
if (button != null) {
button.setTextColor(Theme.getColor(Theme.key_dialogTextRed2));
}
} else if (position == contactsSuggestRow) {
final TextCheckCell cell = (TextCheckCell) view;
if (newSuggest) {
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
builder.setTitle(LocaleController.getString("SuggestContactsTitle", R.string.SuggestContactsTitle));
builder.setMessage(LocaleController.getString("SuggestContactsAlert", R.string.SuggestContactsAlert));
builder.setPositiveButton(LocaleController.getString("MuteDisable", R.string.MuteDisable), (dialogInterface, i) -> {
TLRPC.TL_payments_clearSavedInfo req = new TLRPC.TL_payments_clearSavedInfo();
req.credentials = clear[1];
req.info = clear[0];
getUserConfig().tmpPassword = null;
getUserConfig().saveConfig(false);
getConnectionsManager().sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> {
newSuggest = !newSuggest;
cell.setChecked(newSuggest);
}));
});
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
AlertDialog alertDialog = builder.create();
showDialog(alertDialog);
TextView button = (TextView) alertDialog.getButton(DialogInterface.BUTTON_POSITIVE);
if (button != null) {
button.setTextColor(Theme.getColor(Theme.key_dialogTextRed2));
}
} else {
cell.setChecked(newSuggest = true);
}
} else if (position == newChatsRow) {
final TextCheckCell cell = (TextCheckCell) view;
archiveChats = !archiveChats;
cell.setChecked(archiveChats);
} else if (position == contactsSyncRow) {
newSync = !newSync;
if (view instanceof TextCheckCell) {
((TextCheckCell) view).setChecked(newSync);
}
} else if (position == secretMapRow) {
AlertsCreator.showSecretLocationAlert(getParentActivity(), currentAccount, () -> listAdapter.notifyDataSetChanged(), false, null);
} else if (position == paymentsClearRow) {
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
builder.setTitle(LocaleController.getString("PrivacyPaymentsClearAlertTitle", R.string.PrivacyPaymentsClearAlertTitle));
builder.setMessage(LocaleController.getString("PrivacyPaymentsClearAlertText", R.string.PrivacyPaymentsClearAlertText));
LinearLayout linearLayout = new LinearLayout(getParentActivity());
linearLayout.setOrientation(LinearLayout.VERTICAL);
builder.setView(linearLayout);
for (int a = 0; a < 2; a++) {
String name;
if (a == 0) {
name = LocaleController.getString("PrivacyClearShipping", R.string.PrivacyClearShipping);
} else {
name = LocaleController.getString("PrivacyClearPayment", R.string.PrivacyClearPayment);
}
clear[a] = true;
CheckBoxCell checkBoxCell = new CheckBoxCell(getParentActivity(), 1, 21, null);
checkBoxCell.setTag(a);
checkBoxCell.setBackgroundDrawable(Theme.getSelectorDrawable(false));
checkBoxCell.setPadding(AndroidUtilities.dp(4), 0, AndroidUtilities.dp(4), 0);
linearLayout.addView(checkBoxCell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 50));
checkBoxCell.setText(name, null, true, false);
checkBoxCell.setTextColor(Theme.getColor(Theme.key_dialogTextBlack));
checkBoxCell.setOnClickListener(v -> {
CheckBoxCell cell = (CheckBoxCell) v;
int num = (Integer) cell.getTag();
clear[num] = !clear[num];
cell.setChecked(clear[num], true);
});
}
builder.setPositiveButton(LocaleController.getString("ClearButton", R.string.ClearButton), (dialogInterface, i) -> {
try {
if (visibleDialog != null) {
visibleDialog.dismiss();
}
} catch (Exception e) {
FileLog.e(e);
}
AlertDialog.Builder builder1 = new AlertDialog.Builder(getParentActivity());
builder1.setTitle(LocaleController.getString("PrivacyPaymentsClearAlertTitle", R.string.PrivacyPaymentsClearAlertTitle));
builder1.setMessage(LocaleController.getString("PrivacyPaymentsClearAlert", R.string.PrivacyPaymentsClearAlert));
builder1.setPositiveButton(LocaleController.getString("ClearButton", R.string.ClearButton), (dialogInterface2, i2) -> {
TLRPC.TL_payments_clearSavedInfo req = new TLRPC.TL_payments_clearSavedInfo();
req.credentials = clear[1];
req.info = clear[0];
getUserConfig().tmpPassword = null;
getUserConfig().saveConfig(false);
getConnectionsManager().sendRequest(req, (response, error) -> {
});
String text;
if (clear[0] && clear[1]) {
text = LocaleController.getString("PrivacyPaymentsPaymentShippingCleared", R.string.PrivacyPaymentsPaymentShippingCleared);
} else if (clear[0]) {
text = LocaleController.getString("PrivacyPaymentsShippingInfoCleared", R.string.PrivacyPaymentsShippingInfoCleared);
} else if (clear[1]) {
text = LocaleController.getString("PrivacyPaymentsPaymentInfoCleared", R.string.PrivacyPaymentsPaymentInfoCleared);
} else {
return;
}
BulletinFactory.of(PrivacySettingsActivity.this).createSimpleBulletin(R.raw.chats_infotip, text).show();
});
builder1.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
showDialog(builder1.create());
AlertDialog alertDialog = builder1.create();
showDialog(alertDialog);
TextView button = (TextView) alertDialog.getButton(DialogInterface.BUTTON_POSITIVE);
if (button != null) {
button.setTextColor(Theme.getColor(Theme.key_dialogTextRed2));
}
});
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
showDialog(builder.create());
AlertDialog alertDialog = builder.create();
showDialog(alertDialog);
TextView button = (TextView) alertDialog.getButton(DialogInterface.BUTTON_POSITIVE);
if (button != null) {
button.setTextColor(Theme.getColor(Theme.key_dialogTextRed2));
}
} else if (position == passportRow) {
presentFragment(new PassportActivity(PassportActivity.TYPE_PASSWORD, 0, "", "", null, null, null, null, null));
}
});
return fragmentView;
}
use of org.telegram.ui.ActionBar.AlertDialog in project Telegram-FOSS by Telegram-FOSS-Team.
the class CropView method showAspectRatioDialog.
public void showAspectRatioDialog() {
if (state == null) {
return;
}
if (hasAspectRatioDialog) {
return;
}
hasAspectRatioDialog = true;
String[] actions = new String[8];
final Integer[][] ratios = new Integer[][] { new Integer[] { 3, 2 }, new Integer[] { 5, 3 }, new Integer[] { 4, 3 }, new Integer[] { 5, 4 }, new Integer[] { 7, 5 }, new Integer[] { 16, 9 } };
actions[0] = LocaleController.getString("CropOriginal", R.string.CropOriginal);
actions[1] = LocaleController.getString("CropSquare", R.string.CropSquare);
int i = 2;
for (Integer[] ratioPair : ratios) {
if (areaView.getAspectRatio() > 1.0f) {
actions[i] = String.format("%d:%d", ratioPair[0], ratioPair[1]);
} else {
actions[i] = String.format("%d:%d", ratioPair[1], ratioPair[0]);
}
i++;
}
AlertDialog dialog = new AlertDialog.Builder(getContext()).setItems(actions, (dialog12, which) -> {
hasAspectRatioDialog = false;
switch(which) {
case 0:
{
float w = state.getBaseRotation() % 180 != 0 ? state.getHeight() : state.getWidth();
float h = state.getBaseRotation() % 180 != 0 ? state.getWidth() : state.getHeight();
setLockedAspectRatio(w / h);
}
break;
case 1:
{
setLockedAspectRatio(1.0f);
}
break;
default:
{
Integer[] ratioPair = ratios[which - 2];
if (areaView.getAspectRatio() > 1.0f) {
setLockedAspectRatio(ratioPair[0] / (float) ratioPair[1]);
} else {
setLockedAspectRatio(ratioPair[1] / (float) ratioPair[0]);
}
}
break;
}
}).create();
dialog.setCanceledOnTouchOutside(true);
dialog.setOnCancelListener(dialog1 -> hasAspectRatioDialog = false);
dialog.show();
}
use of org.telegram.ui.ActionBar.AlertDialog in project Telegram-FOSS by Telegram-FOSS-Team.
the class ChatActivity method jumpToDate.
public void jumpToDate(int date) {
if (messages.isEmpty()) {
return;
}
MessageObject firstMessage = messages.get(0);
MessageObject lastMessage = messages.get(messages.size() - 1);
if (firstMessage.messageOwner.date >= date && lastMessage.messageOwner.date <= date || lastMessage.messageOwner.date >= date && endReached[0]) {
for (int a = messages.size() - 1; a >= 0; a--) {
MessageObject message = messages.get(a);
if (message.messageOwner.date >= date && message.getId() != 0) {
scrollToMessageId(message.getId(), 0, false, message.getDialogId() == mergeDialogId ? 1 : 0, true, 0);
break;
}
}
} else if (!DialogObject.isEncryptedDialog(dialog_id)) {
int scrollDirection = RecyclerAnimationScrollHelper.SCROLL_DIRECTION_UNSET;
int end = chatLayoutManager.findLastVisibleItemPosition();
for (int i = chatLayoutManager.findFirstVisibleItemPosition(); i <= end; i++) {
if (i >= chatAdapter.messagesStartRow && i <= chatAdapter.messagesEndRow) {
TLRPC.Message message = messages.get(i - chatAdapter.messagesStartRow).messageOwner;
if (message != null) {
boolean scrollDown = message.date < date;
if (isSecretChat()) {
scrollDown = !scrollDown;
}
scrollDirection = scrollDown ? RecyclerAnimationScrollHelper.SCROLL_DIRECTION_DOWN : RecyclerAnimationScrollHelper.SCROLL_DIRECTION_UP;
break;
}
}
}
chatScrollHelper.setScrollDirection(scrollDirection);
if (progressDialog != null) {
progressDialog.dismiss();
}
updatePinnedListButton(false);
progressDialog = new AlertDialog(getParentActivity(), 3, themeDelegate);
progressDialog.setOnCancelListener(postponedScrollCancelListener);
progressDialog.showDelayed(1000);
postponedScrollToLastMessageQueryIndex = lastLoadIndex;
waitingForLoad.add(lastLoadIndex);
postponedScrollMessageId = 0;
postponedScrollIsCanceled = false;
getMessagesController().loadMessages(dialog_id, mergeDialogId, false, 30, 0, date, true, 0, classGuid, 4, 0, chatMode, threadMessageId, replyMaxReadId, lastLoadIndex++);
floatingDateView.setAlpha(0.0f);
floatingDateView.setTag(null);
}
}
Aggregations