Bug fixes

This commit is contained in:
DrKLO 2014-07-30 08:49:39 +01:00
parent 755446e9bb
commit e27094b963
4 changed files with 149 additions and 63 deletions

View file

@ -83,7 +83,7 @@ android {
defaultConfig { defaultConfig {
minSdkVersion 8 minSdkVersion 8
targetSdkVersion 19 targetSdkVersion 19
versionCode 293 versionCode 296
versionName "1.7.0" versionName "1.7.0"
} }
} }

View file

@ -777,10 +777,20 @@ public class MessagesController implements NotificationCenter.NotificationCenter
dialog.unread_count = 0; dialog.unread_count = 0;
} }
dialogMessage.remove(dialog.top_message); dialogMessage.remove(dialog.top_message);
MessagesStorage.getInstance().storageQueue.postRunnable(new Runnable() {
@Override
public void run() {
Utilities.RunOnUIThread(new Runnable() {
@Override
public void run() {
NotificationsController.getInstance().processReadMessages(null, did, 0, Integer.MAX_VALUE); NotificationsController.getInstance().processReadMessages(null, did, 0, Integer.MAX_VALUE);
HashMap<Long, Integer> dialogsToUpdate = new HashMap<Long, Integer>(); HashMap<Long, Integer> dialogsToUpdate = new HashMap<Long, Integer>();
dialogsToUpdate.put(did, 0); dialogsToUpdate.put(did, 0);
NotificationsController.getInstance().processDialogsUpdateRead(dialogsToUpdate, true); NotificationsController.getInstance().processDialogsUpdateRead(dialogsToUpdate, true);
}
});
}
});
MessagesStorage.getInstance().deleteDialog(did, onlyHistory); MessagesStorage.getInstance().deleteDialog(did, onlyHistory);
NotificationCenter.getInstance().postNotificationName(removeAllMessagesFromDialog, did); NotificationCenter.getInstance().postNotificationName(removeAllMessagesFromDialog, did);
NotificationCenter.getInstance().postNotificationName(dialogsNeedReload); NotificationCenter.getInstance().postNotificationName(dialogsNeedReload);
@ -1344,7 +1354,8 @@ public class MessagesController implements NotificationCenter.NotificationCenter
} }
}); });
for (TLRPC.TL_dialog d : dialogs) { for (TLRPC.TL_dialog d : dialogs) {
if ((int)d.id != 0) { int high_id = (int)(d.id >> 32);
if ((int)d.id != 0 && high_id != 1) {
dialogsServerOnly.add(d); dialogsServerOnly.add(d);
} }
} }
@ -1508,7 +1519,8 @@ public class MessagesController implements NotificationCenter.NotificationCenter
} }
}); });
for (TLRPC.TL_dialog d : dialogs) { for (TLRPC.TL_dialog d : dialogs) {
if ((int)d.id != 0) { int high_id = (int)(d.id >> 32);
if ((int)d.id != 0 && high_id != 1) {
dialogsServerOnly.add(d); dialogsServerOnly.add(d);
} }
} }
@ -1583,7 +1595,6 @@ public class MessagesController implements NotificationCenter.NotificationCenter
req.max_id = max_positive_id; req.max_id = max_positive_id;
req.offset = offset; req.offset = offset;
if (offset == 0) { if (offset == 0) {
NotificationsController.getInstance().processReadMessages(null, dialog_id, 0, max_positive_id);
MessagesStorage.getInstance().processPendingRead(dialog_id, max_positive_id, max_date, false); MessagesStorage.getInstance().processPendingRead(dialog_id, max_positive_id, max_date, false);
MessagesStorage.getInstance().storageQueue.postRunnable(new Runnable() { MessagesStorage.getInstance().storageQueue.postRunnable(new Runnable() {
@Override @Override
@ -1596,6 +1607,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter
dialog.unread_count = 0; dialog.unread_count = 0;
NotificationCenter.getInstance().postNotificationName(dialogsNeedReload); NotificationCenter.getInstance().postNotificationName(dialogsNeedReload);
} }
NotificationsController.getInstance().processReadMessages(null, dialog_id, 0, max_positive_id);
HashMap<Long, Integer> dialogsToUpdate = new HashMap<Long, Integer>(); HashMap<Long, Integer> dialogsToUpdate = new HashMap<Long, Integer>();
dialogsToUpdate.put(dialog_id, 0); dialogsToUpdate.put(dialog_id, 0);
NotificationsController.getInstance().processDialogsUpdateRead(dialogsToUpdate, true); NotificationsController.getInstance().processDialogsUpdateRead(dialogsToUpdate, true);
@ -1652,7 +1664,6 @@ public class MessagesController implements NotificationCenter.NotificationCenter
if (max_date == 0) { if (max_date == 0) {
return; return;
} }
NotificationsController.getInstance().processReadMessages(null, dialog_id, max_date, 0);
TLRPC.EncryptedChat chat = encryptedChats.get(high_id); TLRPC.EncryptedChat chat = encryptedChats.get(high_id);
if (chat.auth_key != null && chat.auth_key.length > 1 && chat instanceof TLRPC.TL_encryptedChat) { if (chat.auth_key != null && chat.auth_key.length > 1 && chat instanceof TLRPC.TL_encryptedChat) {
TLRPC.TL_messages_readEncryptedHistory req = new TLRPC.TL_messages_readEncryptedHistory(); TLRPC.TL_messages_readEncryptedHistory req = new TLRPC.TL_messages_readEncryptedHistory();
@ -1676,6 +1687,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter
Utilities.RunOnUIThread(new Runnable() { Utilities.RunOnUIThread(new Runnable() {
@Override @Override
public void run() { public void run() {
NotificationsController.getInstance().processReadMessages(null, dialog_id, max_date, 0);
TLRPC.TL_dialog dialog = dialogs_dict.get(dialog_id); TLRPC.TL_dialog dialog = dialogs_dict.get(dialog_id);
if (dialog != null) { if (dialog != null) {
dialog.unread_count = 0; dialog.unread_count = 0;
@ -3693,14 +3705,19 @@ public class MessagesController implements NotificationCenter.NotificationCenter
updateInterfaceWithMessages(key, value); updateInterfaceWithMessages(key, value);
} }
NotificationCenter.getInstance().postNotificationName(dialogsNeedReload); NotificationCenter.getInstance().postNotificationName(dialogsNeedReload);
if (!pushMessages.isEmpty()) {
NotificationsController.getInstance().processNewMessages(pushMessages, !(res instanceof TLRPC.TL_updates_differenceSlice));
}
} }
}); });
MessagesStorage.getInstance().storageQueue.postRunnable(new Runnable() { MessagesStorage.getInstance().storageQueue.postRunnable(new Runnable() {
@Override @Override
public void run() { public void run() {
if (!pushMessages.isEmpty()) {
Utilities.RunOnUIThread(new Runnable() {
@Override
public void run() {
NotificationsController.getInstance().processNewMessages(pushMessages, !(res instanceof TLRPC.TL_updates_differenceSlice));
}
});
}
MessagesStorage.getInstance().startTransaction(false); MessagesStorage.getInstance().startTransaction(false);
MessagesStorage.getInstance().putMessages(res.new_messages, false, false, false); MessagesStorage.getInstance().putMessages(res.new_messages, false, false, false);
MessagesStorage.getInstance().putUsersAndChats(res.users, res.chats, false, false); MessagesStorage.getInstance().putUsersAndChats(res.users, res.chats, false, false);
@ -3795,11 +3812,22 @@ public class MessagesController implements NotificationCenter.NotificationCenter
if (printUpdate) { if (printUpdate) {
NotificationCenter.getInstance().postNotificationName(updateInterfaces, UPDATE_MASK_USER_PRINT); NotificationCenter.getInstance().postNotificationName(updateInterfaces, UPDATE_MASK_USER_PRINT);
} }
updateInterfaceWithMessages(-updates.chat_id, objArr);
NotificationCenter.getInstance().postNotificationName(dialogsNeedReload);
}
});
MessagesStorage.getInstance().storageQueue.postRunnable(new Runnable() {
@Override
public void run() {
Utilities.RunOnUIThread(new Runnable() {
@Override
public void run() {
if (!obj.isFromMe() && obj.isUnread()) { if (!obj.isFromMe() && obj.isUnread()) {
NotificationsController.getInstance().processNewMessages(objArr, true); NotificationsController.getInstance().processNewMessages(objArr, true);
} }
updateInterfaceWithMessages(-updates.chat_id, objArr); }
NotificationCenter.getInstance().postNotificationName(dialogsNeedReload); });
} }
}); });
MessagesStorage.getInstance().putMessages(arr, false, true, false); MessagesStorage.getInstance().putMessages(arr, false, true, false);
@ -3850,11 +3878,21 @@ public class MessagesController implements NotificationCenter.NotificationCenter
if (printUpdate) { if (printUpdate) {
NotificationCenter.getInstance().postNotificationName(updateInterfaces, UPDATE_MASK_USER_PRINT); NotificationCenter.getInstance().postNotificationName(updateInterfaces, UPDATE_MASK_USER_PRINT);
} }
updateInterfaceWithMessages(updates.from_id, objArr);
NotificationCenter.getInstance().postNotificationName(dialogsNeedReload);
}
});
MessagesStorage.getInstance().storageQueue.postRunnable(new Runnable() {
@Override
public void run() {
Utilities.RunOnUIThread(new Runnable() {
@Override
public void run() {
if (!obj.isFromMe() && obj.isUnread()) { if (!obj.isFromMe() && obj.isUnread()) {
NotificationsController.getInstance().processNewMessages(objArr, true); NotificationsController.getInstance().processNewMessages(objArr, true);
} }
updateInterfaceWithMessages(updates.from_id, objArr); }
NotificationCenter.getInstance().postNotificationName(dialogsNeedReload); });
} }
}); });
MessagesStorage.getInstance().putMessages(arr, false, true, false); MessagesStorage.getInstance().putMessages(arr, false, true, false);
@ -4265,7 +4303,8 @@ public class MessagesController implements NotificationCenter.NotificationCenter
} }
}); });
for (TLRPC.TL_dialog d : dialogs) { for (TLRPC.TL_dialog d : dialogs) {
if ((int)d.id != 0) { int high_id = (int)(d.id >> 32);
if ((int)d.id != 0 && high_id != 1) {
dialogsServerOnly.add(d); dialogsServerOnly.add(d);
} }
} }
@ -4327,6 +4366,20 @@ public class MessagesController implements NotificationCenter.NotificationCenter
ContactsController.getInstance().processContactsUpdates(contactsIds, usersDict); ContactsController.getInstance().processContactsUpdates(contactsIds, usersDict);
} }
MessagesStorage.getInstance().storageQueue.postRunnable(new Runnable() {
@Override
public void run() {
Utilities.RunOnUIThread(new Runnable() {
@Override
public void run() {
if (!pushMessages.isEmpty()) {
NotificationsController.getInstance().processNewMessages(pushMessages, true);
}
}
});
}
});
if (!messagesArr.isEmpty()) { if (!messagesArr.isEmpty()) {
MessagesStorage.getInstance().putMessages(messagesArr, true, true, false); MessagesStorage.getInstance().putMessages(messagesArr, true, true, false);
} }
@ -4415,9 +4468,6 @@ public class MessagesController implements NotificationCenter.NotificationCenter
} }
NotificationCenter.getInstance().postNotificationName(dialogsNeedReload); NotificationCenter.getInstance().postNotificationName(dialogsNeedReload);
} }
if (!pushMessages.isEmpty()) {
NotificationsController.getInstance().processNewMessages(pushMessages, true);
}
if (!markAsReadMessages.isEmpty()) { if (!markAsReadMessages.isEmpty()) {
for (Integer id : markAsReadMessages) { for (Integer id : markAsReadMessages) {
MessageObject obj = dialogMessage.get(id); MessageObject obj = dialogMessage.get(id);
@ -4441,9 +4491,6 @@ public class MessagesController implements NotificationCenter.NotificationCenter
} }
} }
} }
if (!markAsReadMessages.isEmpty()) {
NotificationsController.getInstance().processReadMessages(markAsReadMessages, 0, 0, 0);
}
if (!deletedMessages.isEmpty()) { if (!deletedMessages.isEmpty()) {
NotificationCenter.getInstance().postNotificationName(messagesDeleted, deletedMessages); NotificationCenter.getInstance().postNotificationName(messagesDeleted, deletedMessages);
for (Integer id : deletedMessages) { for (Integer id : deletedMessages) {
@ -4472,7 +4519,6 @@ public class MessagesController implements NotificationCenter.NotificationCenter
} }
}); });
if (!markAsReadMessages.isEmpty() || !markAsReadEncrypted.isEmpty()) {
MessagesStorage.getInstance().storageQueue.postRunnable(new Runnable() { MessagesStorage.getInstance().storageQueue.postRunnable(new Runnable() {
@Override @Override
public void run() { public void run() {
@ -4481,12 +4527,12 @@ public class MessagesController implements NotificationCenter.NotificationCenter
public void run() { public void run() {
if (!markAsReadMessages.isEmpty()) { if (!markAsReadMessages.isEmpty()) {
NotificationCenter.getInstance().postNotificationName(messagesReaded, markAsReadMessages); NotificationCenter.getInstance().postNotificationName(messagesReaded, markAsReadMessages);
NotificationsController.getInstance().processReadMessages(markAsReadMessages, 0, 0, 0);
} }
} }
}); });
} }
}); });
}
if (!markAsReadMessages.isEmpty() || !markAsReadEncrypted.isEmpty()) { if (!markAsReadMessages.isEmpty() || !markAsReadEncrypted.isEmpty()) {
if (!markAsReadMessages.isEmpty()) { if (!markAsReadMessages.isEmpty()) {
@ -4566,13 +4612,23 @@ public class MessagesController implements NotificationCenter.NotificationCenter
updateInterfaceWithMessages(uid, messages, false); updateInterfaceWithMessages(uid, messages, false);
} }
private void updateInterfaceWithMessages(long uid, ArrayList<MessageObject> messages, boolean isBroadcast) { private void updateInterfaceWithMessages(final long uid, final ArrayList<MessageObject> messages, boolean isBroadcast) {
MessageObject lastMessage = null; MessageObject lastMessage = null;
TLRPC.TL_dialog dialog = dialogs_dict.get(uid); TLRPC.TL_dialog dialog = dialogs_dict.get(uid);
boolean isEncryptedChat = ((int)uid) == 0; boolean isEncryptedChat = ((int)uid) == 0;
MessagesStorage.getInstance().storageQueue.postRunnable(new Runnable() {
@Override
public void run() {
Utilities.RunOnUIThread(new Runnable() {
@Override
public void run() {
NotificationCenter.getInstance().postNotificationName(didReceivedNewMessages, uid, messages); NotificationCenter.getInstance().postNotificationName(didReceivedNewMessages, uid, messages);
}
});
}
});
for (MessageObject message : messages) { for (MessageObject message : messages) {
if (lastMessage == null || (!isEncryptedChat && message.messageOwner.id > lastMessage.messageOwner.id || isEncryptedChat && message.messageOwner.id < lastMessage.messageOwner.id) || message.messageOwner.date > lastMessage.messageOwner.date) { if (lastMessage == null || (!isEncryptedChat && message.messageOwner.id > lastMessage.messageOwner.id || isEncryptedChat && message.messageOwner.id < lastMessage.messageOwner.id) || message.messageOwner.date > lastMessage.messageOwner.date) {
@ -4623,7 +4679,8 @@ public class MessagesController implements NotificationCenter.NotificationCenter
} }
}); });
for (TLRPC.TL_dialog d : dialogs) { for (TLRPC.TL_dialog d : dialogs) {
if ((int)d.id != 0) { int high_id = (int)(d.id >> 32);
if ((int)d.id != 0 && high_id != 1) {
dialogsServerOnly.add(d); dialogsServerOnly.add(d);
} }
} }
@ -4854,10 +4911,20 @@ public class MessagesController implements NotificationCenter.NotificationCenter
dialog.unread_count = 0; dialog.unread_count = 0;
dialogMessage.remove(dialog.top_message); dialogMessage.remove(dialog.top_message);
} }
MessagesStorage.getInstance().storageQueue.postRunnable(new Runnable() {
@Override
public void run() {
Utilities.RunOnUIThread(new Runnable() {
@Override
public void run() {
NotificationsController.getInstance().processReadMessages(null, did, 0, Integer.MAX_VALUE); NotificationsController.getInstance().processReadMessages(null, did, 0, Integer.MAX_VALUE);
HashMap<Long, Integer> dialogsToUpdate = new HashMap<Long, Integer>(); HashMap<Long, Integer> dialogsToUpdate = new HashMap<Long, Integer>();
dialogsToUpdate.put(did, 0); dialogsToUpdate.put(did, 0);
NotificationsController.getInstance().processDialogsUpdateRead(dialogsToUpdate, true); NotificationsController.getInstance().processDialogsUpdateRead(dialogsToUpdate, true);
}
});
}
});
MessagesStorage.getInstance().deleteDialog(did, true); MessagesStorage.getInstance().deleteDialog(did, true);
NotificationCenter.getInstance().postNotificationName(removeAllMessagesFromDialog, did); NotificationCenter.getInstance().postNotificationName(removeAllMessagesFromDialog, did);
NotificationCenter.getInstance().postNotificationName(dialogsNeedReload); NotificationCenter.getInstance().postNotificationName(dialogsNeedReload);
@ -5145,7 +5212,8 @@ public class MessagesController implements NotificationCenter.NotificationCenter
} }
}); });
for (TLRPC.TL_dialog d : dialogs) { for (TLRPC.TL_dialog d : dialogs) {
if ((int) d.id != 0) { int high_id = (int)(d.id >> 32);
if ((int)d.id != 0 && high_id != 1) {
dialogsServerOnly.add(d); dialogsServerOnly.add(d);
} }
} }

View file

@ -183,6 +183,8 @@ public class NotificationsController {
} }
msg = LocaleController.formatString("NotificationGroupKickMember", R.string.NotificationGroupKickMember, Utilities.formatName(user.first_name, user.last_name), chat.title, Utilities.formatName(u2.first_name, u2.last_name)); msg = LocaleController.formatString("NotificationGroupKickMember", R.string.NotificationGroupKickMember, Utilities.formatName(user.first_name, user.last_name), chat.title, Utilities.formatName(u2.first_name, u2.last_name));
} }
} else if (messageObject.messageOwner.action instanceof TLRPC.TL_messageActionChatCreate) {
msg = messageObject.messageText.toString();
} }
} else { } else {
if (messageObject.messageOwner.media instanceof TLRPC.TL_messageMediaEmpty) { if (messageObject.messageOwner.media instanceof TLRPC.TL_messageMediaEmpty) {
@ -508,9 +510,6 @@ public class NotificationsController {
if (oldCount != popupMessages.size()) { if (oldCount != popupMessages.size()) {
NotificationCenter.getInstance().postNotificationName(pushMessagesUpdated); NotificationCenter.getInstance().postNotificationName(pushMessagesUpdated);
} }
// if (readMessages != null || oldCount2 != pushMessages.size() || readMessages == null && dialog_id == 0) {
// showOrUpdateNotification(notifyCheck);
// }
} }
public void processNewMessages(ArrayList<MessageObject> messageObjects, boolean isLast) { public void processNewMessages(ArrayList<MessageObject> messageObjects, boolean isLast) {
@ -585,6 +584,15 @@ public class NotificationsController {
} }
if (newCount == 0) { if (newCount == 0) {
pushDialogs.remove(dialog_id); pushDialogs.remove(dialog_id);
for (int a = 0; a < pushMessages.size(); a++) {
MessageObject messageObject = pushMessages.get(a);
if (messageObject.getDialogId() == dialog_id) {
pushMessages.remove(a);
a--;
pushMessagesDict.remove(messageObject.messageOwner.id);
popupMessages.remove(messageObject);
}
}
} else if (canAddValue) { } else if (canAddValue) {
total_unread_count += newCount; total_unread_count += newCount;
pushDialogs.put(dialog_id, newCount); pushDialogs.put(dialog_id, newCount);
@ -611,7 +619,6 @@ public class NotificationsController {
pushDialogs.clear(); pushDialogs.clear();
total_unread_count = 0; total_unread_count = 0;
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Context.MODE_PRIVATE); SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Context.MODE_PRIVATE);
String dialogsToLoad = "";
for (HashMap.Entry<Long, Integer> entry : dialogs.entrySet()) { for (HashMap.Entry<Long, Integer> entry : dialogs.entrySet()) {
long dialog_id = entry.getKey(); long dialog_id = entry.getKey();
int notify_override = preferences.getInt("notify2_" + dialog_id, 0); int notify_override = preferences.getInt("notify2_" + dialog_id, 0);
@ -619,10 +626,6 @@ public class NotificationsController {
if (!(notify_override == 2 || (!preferences.getBoolean("EnableAll", true) || isChat && !preferences.getBoolean("EnableGroup", true)) && notify_override == 0)) { if (!(notify_override == 2 || (!preferences.getBoolean("EnableAll", true) || isChat && !preferences.getBoolean("EnableGroup", true)) && notify_override == 0)) {
pushDialogs.put(dialog_id, entry.getValue()); pushDialogs.put(dialog_id, entry.getValue());
total_unread_count += entry.getValue(); total_unread_count += entry.getValue();
if (dialogsToLoad.length() != 0) {
dialogsToLoad += ",";
}
dialogsToLoad += "" + dialog_id;
} }
} }
if (total_unread_count == 0) { if (total_unread_count == 0) {

View file

@ -8,6 +8,7 @@
package org.telegram.ui; package org.telegram.ui;
import android.animation.Animator;
import android.app.Activity; import android.app.Activity;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.content.Context; import android.content.Context;
@ -149,7 +150,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
private int unread_to_load = 0; private int unread_to_load = 0;
private int first_unread_id = 0; private int first_unread_id = 0;
private int last_unread_id = 0; private int last_unread_id = 0;
private boolean unread_end_reached = true; private boolean unread_end_reached = false;
private boolean loadingForward = false; private boolean loadingForward = false;
private MessageObject unreadMessageObject = null; private MessageObject unreadMessageObject = null;
@ -617,6 +618,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
View bottomOverlayChat = fragmentView.findViewById(R.id.bottom_overlay_chat); View bottomOverlayChat = fragmentView.findViewById(R.id.bottom_overlay_chat);
progressView = fragmentView.findViewById(R.id.progressLayout); progressView = fragmentView.findViewById(R.id.progressLayout);
pagedownButton = fragmentView.findViewById(R.id.pagedown_button); pagedownButton = fragmentView.findViewById(R.id.pagedown_button);
pagedownButton.setVisibility(View.GONE);
View progressViewInner = progressView.findViewById(R.id.progressLayoutInner); View progressViewInner = progressView.findViewById(R.id.progressLayoutInner);
@ -743,8 +745,6 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
if (firstVisibleItem + visibleItemCount == totalItemCount && unread_end_reached) { if (firstVisibleItem + visibleItemCount == totalItemCount && unread_end_reached) {
showPagedownButton(false, true); showPagedownButton(false, true);
} }
} else {
showPagedownButton(false, false);
} }
for (int a = 0; a < visibleItemCount; a++) { for (int a = 0; a < visibleItemCount; a++) {
View view = absListView.getChildAt(a); View view = absListView.getChildAt(a);
@ -873,7 +873,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
} }
if (show) { if (show) {
if (pagedownButton.getVisibility() == View.GONE) { if (pagedownButton.getVisibility() == View.GONE) {
if (android.os.Build.VERSION.SDK_INT >= 16 && animated) { if (android.os.Build.VERSION.SDK_INT >= 12 && animated) {
pagedownButton.setVisibility(View.VISIBLE); pagedownButton.setVisibility(View.VISIBLE);
pagedownButton.setAlpha(0); pagedownButton.setAlpha(0);
pagedownButton.animate().alpha(1).setDuration(200).start(); pagedownButton.animate().alpha(1).setDuration(200).start();
@ -883,13 +883,28 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
} }
} else { } else {
if (pagedownButton.getVisibility() == View.VISIBLE) { if (pagedownButton.getVisibility() == View.VISIBLE) {
if (android.os.Build.VERSION.SDK_INT >= 16 && animated) { if (android.os.Build.VERSION.SDK_INT >= 12 && animated) {
pagedownButton.animate().alpha(0).withEndAction(new Runnable() { pagedownButton.animate().alpha(0).setDuration(200).setListener(new Animator.AnimatorListener() {
@Override @Override
public void run() { public void onAnimationStart(Animator animation) {
}
@Override
public void onAnimationEnd(Animator animation) {
pagedownButton.setVisibility(View.GONE); pagedownButton.setVisibility(View.GONE);
} }
}).setDuration(200).start();
@Override
public void onAnimationCancel(Animator animation) {
}
@Override
public void onAnimationRepeat(Animator animation) {
}
}).start();
} else { } else {
pagedownButton.setVisibility(View.GONE); pagedownButton.setVisibility(View.GONE);
} }