Bug fixes
This commit is contained in:
parent
ea8760f9a2
commit
ba4cf583b4
@ -80,7 +80,7 @@ android {
|
|||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdkVersion 8
|
minSdkVersion 8
|
||||||
targetSdkVersion 21
|
targetSdkVersion 21
|
||||||
versionCode 386
|
versionCode 388
|
||||||
versionName "2.0.0"
|
versionName "2.0.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -850,6 +850,8 @@ public class ContactsController {
|
|||||||
|
|
||||||
final HashMap<Integer, TLRPC.User> usersDict = new HashMap<Integer, TLRPC.User>();
|
final HashMap<Integer, TLRPC.User> usersDict = new HashMap<Integer, TLRPC.User>();
|
||||||
|
|
||||||
|
final boolean isEmpty = contactsArr.isEmpty();
|
||||||
|
|
||||||
if (!contacts.isEmpty()) {
|
if (!contacts.isEmpty()) {
|
||||||
for (int a = 0; a < contactsArr.size(); a++) {
|
for (int a = 0; a < contactsArr.size(); a++) {
|
||||||
TLRPC.TL_contact contact = contactsArr.get(a);
|
TLRPC.TL_contact contact = contactsArr.get(a);
|
||||||
@ -1003,6 +1005,12 @@ public class ContactsController {
|
|||||||
updateUnregisteredContacts(contactsArr);
|
updateUnregisteredContacts(contactsArr);
|
||||||
|
|
||||||
NotificationCenter.getInstance().postNotificationName(NotificationCenter.contactsDidLoaded);
|
NotificationCenter.getInstance().postNotificationName(NotificationCenter.contactsDidLoaded);
|
||||||
|
|
||||||
|
if (from != 1 && !isEmpty) {
|
||||||
|
saveContactsLoadTime();
|
||||||
|
} else {
|
||||||
|
reloadContactsStatusesMaybe();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -1037,6 +1045,27 @@ public class ContactsController {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void reloadContactsStatusesMaybe() {
|
||||||
|
try {
|
||||||
|
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", Activity.MODE_PRIVATE);
|
||||||
|
long lastReloadStatusTime = preferences.getLong("lastReloadStatusTime", 0);
|
||||||
|
if (lastReloadStatusTime < System.currentTimeMillis() - 1000 * 60 * 60 * 24) {
|
||||||
|
reloadContactsStatuses();
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
FileLog.e("tmessages", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void saveContactsLoadTime() {
|
||||||
|
try {
|
||||||
|
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", Activity.MODE_PRIVATE);
|
||||||
|
preferences.edit().putLong("lastReloadStatusTime", System.currentTimeMillis()).commit();
|
||||||
|
} catch (Exception e) {
|
||||||
|
FileLog.e("tmessages", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void updateUnregisteredContacts(final ArrayList<TLRPC.TL_contact> contactsArr) {
|
private void updateUnregisteredContacts(final ArrayList<TLRPC.TL_contact> contactsArr) {
|
||||||
final HashMap<String, TLRPC.TL_contact> contactsPhonesShort = new HashMap<String, TLRPC.TL_contact>();
|
final HashMap<String, TLRPC.TL_contact> contactsPhonesShort = new HashMap<String, TLRPC.TL_contact>();
|
||||||
|
|
||||||
@ -1586,6 +1615,7 @@ public class ContactsController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void reloadContactsStatuses() {
|
public void reloadContactsStatuses() {
|
||||||
|
saveContactsLoadTime();
|
||||||
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", Activity.MODE_PRIVATE);
|
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", Activity.MODE_PRIVATE);
|
||||||
final SharedPreferences.Editor editor = preferences.edit();
|
final SharedPreferences.Editor editor = preferences.edit();
|
||||||
editor.putBoolean("needGetStatuses", true).commit();
|
editor.putBoolean("needGetStatuses", true).commit();
|
||||||
|
@ -560,6 +560,10 @@ public class ActionBarLayout extends FrameLayout {
|
|||||||
if (removeActionBarExtraHeight) {
|
if (removeActionBarExtraHeight) {
|
||||||
fragment.actionBar.setOccupyStatusBar(false);
|
fragment.actionBar.setOccupyStatusBar(false);
|
||||||
}
|
}
|
||||||
|
ViewGroup parent = (ViewGroup) fragment.actionBar.getParent();
|
||||||
|
if (parent != null) {
|
||||||
|
parent.removeView(fragment.actionBar);
|
||||||
|
}
|
||||||
containerViewBack.addView(fragment.actionBar);
|
containerViewBack.addView(fragment.actionBar);
|
||||||
fragment.actionBar.setTitleOverlayText(titleOverlayText);
|
fragment.actionBar.setTitleOverlayText(titleOverlayText);
|
||||||
}
|
}
|
||||||
@ -698,6 +702,10 @@ public class ActionBarLayout extends FrameLayout {
|
|||||||
if (removeActionBarExtraHeight) {
|
if (removeActionBarExtraHeight) {
|
||||||
previousFragment.actionBar.setOccupyStatusBar(false);
|
previousFragment.actionBar.setOccupyStatusBar(false);
|
||||||
}
|
}
|
||||||
|
ViewGroup parent = (ViewGroup) previousFragment.actionBar.getParent();
|
||||||
|
if (parent != null) {
|
||||||
|
parent.removeView(previousFragment.actionBar);
|
||||||
|
}
|
||||||
containerView.addView(previousFragment.actionBar);
|
containerView.addView(previousFragment.actionBar);
|
||||||
previousFragment.actionBar.setTitleOverlayText(titleOverlayText);
|
previousFragment.actionBar.setTitleOverlayText(titleOverlayText);
|
||||||
}
|
}
|
||||||
|
@ -165,6 +165,9 @@ public class DrawerLayoutContainer extends FrameLayout {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void openDrawer(boolean fast) {
|
public void openDrawer(boolean fast) {
|
||||||
|
if (AndroidUtilities.isTablet() && parentActionBarLayout != null && parentActionBarLayout.parentActivity != null) {
|
||||||
|
AndroidUtilities.hideKeyboard(parentActionBarLayout.parentActivity.getCurrentFocus());
|
||||||
|
}
|
||||||
cancelCurrentAnimation();
|
cancelCurrentAnimation();
|
||||||
AnimatorSetProxy animatorSet = new AnimatorSetProxy();
|
AnimatorSetProxy animatorSet = new AnimatorSetProxy();
|
||||||
animatorSet.playTogether(
|
animatorSet.playTogether(
|
||||||
|
@ -506,6 +506,9 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
|||||||
if (currentEncryptedChat != null) {
|
if (currentEncryptedChat != null) {
|
||||||
MediaController.getInstance().stopMediaObserver();
|
MediaController.getInstance().stopMediaObserver();
|
||||||
}
|
}
|
||||||
|
if (currentUser != null) {
|
||||||
|
MessagesController.getInstance().cancelLoadFullUser(currentUser.id);
|
||||||
|
}
|
||||||
if (!AndroidUtilities.isTablet()) {
|
if (!AndroidUtilities.isTablet()) {
|
||||||
getParentActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
|
getParentActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
|
||||||
}
|
}
|
||||||
@ -996,38 +999,6 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (currentEncryptedChat != null) {
|
|
||||||
emptyView.setVisibility(View.INVISIBLE);
|
|
||||||
View secretChatPlaceholder = contentView.findViewById(R.id.secret_placeholder);
|
|
||||||
secretChatPlaceholder.setVisibility(View.VISIBLE);
|
|
||||||
if (isCustomTheme) {
|
|
||||||
secretChatPlaceholder.setBackgroundResource(R.drawable.system_black);
|
|
||||||
} else {
|
|
||||||
secretChatPlaceholder.setBackgroundResource(R.drawable.system_blue);
|
|
||||||
}
|
|
||||||
secretViewStatusTextView = (TextView) contentView.findViewById(R.id.invite_text);
|
|
||||||
secretChatPlaceholder.setPadding(AndroidUtilities.dp(16), AndroidUtilities.dp(12), AndroidUtilities.dp(16), AndroidUtilities.dp(12));
|
|
||||||
|
|
||||||
View v = contentView.findViewById(R.id.secret_placeholder);
|
|
||||||
v.setVisibility(View.VISIBLE);
|
|
||||||
|
|
||||||
if (currentEncryptedChat.admin_id == UserConfig.getClientUserId()) {
|
|
||||||
if (currentUser.first_name.length() > 0) {
|
|
||||||
secretViewStatusTextView.setText(LocaleController.formatString("EncryptedPlaceholderTitleOutgoing", R.string.EncryptedPlaceholderTitleOutgoing, currentUser.first_name));
|
|
||||||
} else {
|
|
||||||
secretViewStatusTextView.setText(LocaleController.formatString("EncryptedPlaceholderTitleOutgoing", R.string.EncryptedPlaceholderTitleOutgoing, currentUser.last_name));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (currentUser.first_name.length() > 0) {
|
|
||||||
secretViewStatusTextView.setText(LocaleController.formatString("EncryptedPlaceholderTitleIncoming", R.string.EncryptedPlaceholderTitleIncoming, currentUser.first_name));
|
|
||||||
} else {
|
|
||||||
secretViewStatusTextView.setText(LocaleController.formatString("EncryptedPlaceholderTitleIncoming", R.string.EncryptedPlaceholderTitleIncoming, currentUser.last_name));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
updateSecretStatus();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isCustomTheme) {
|
if (isCustomTheme) {
|
||||||
progressViewInner.setBackgroundResource(R.drawable.system_loader2);
|
progressViewInner.setBackgroundResource(R.drawable.system_loader2);
|
||||||
emptyView.setBackgroundResource(R.drawable.system_black);
|
emptyView.setBackgroundResource(R.drawable.system_black);
|
||||||
@ -1261,6 +1232,38 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
|||||||
|
|
||||||
chatActivityEnterView.setContainerView(getParentActivity(), fragmentView);
|
chatActivityEnterView.setContainerView(getParentActivity(), fragmentView);
|
||||||
chatActivityEnterView.addToAttachLayout(menuItem);
|
chatActivityEnterView.addToAttachLayout(menuItem);
|
||||||
|
|
||||||
|
if (currentEncryptedChat != null) {
|
||||||
|
emptyView.setVisibility(View.INVISIBLE);
|
||||||
|
View secretChatPlaceholder = contentView.findViewById(R.id.secret_placeholder);
|
||||||
|
secretChatPlaceholder.setVisibility(View.VISIBLE);
|
||||||
|
if (isCustomTheme) {
|
||||||
|
secretChatPlaceholder.setBackgroundResource(R.drawable.system_black);
|
||||||
|
} else {
|
||||||
|
secretChatPlaceholder.setBackgroundResource(R.drawable.system_blue);
|
||||||
|
}
|
||||||
|
secretViewStatusTextView = (TextView) contentView.findViewById(R.id.invite_text);
|
||||||
|
secretChatPlaceholder.setPadding(AndroidUtilities.dp(16), AndroidUtilities.dp(12), AndroidUtilities.dp(16), AndroidUtilities.dp(12));
|
||||||
|
|
||||||
|
View v = contentView.findViewById(R.id.secret_placeholder);
|
||||||
|
v.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
|
if (currentEncryptedChat.admin_id == UserConfig.getClientUserId()) {
|
||||||
|
if (currentUser.first_name.length() > 0) {
|
||||||
|
secretViewStatusTextView.setText(LocaleController.formatString("EncryptedPlaceholderTitleOutgoing", R.string.EncryptedPlaceholderTitleOutgoing, currentUser.first_name));
|
||||||
|
} else {
|
||||||
|
secretViewStatusTextView.setText(LocaleController.formatString("EncryptedPlaceholderTitleOutgoing", R.string.EncryptedPlaceholderTitleOutgoing, currentUser.last_name));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (currentUser.first_name.length() > 0) {
|
||||||
|
secretViewStatusTextView.setText(LocaleController.formatString("EncryptedPlaceholderTitleIncoming", R.string.EncryptedPlaceholderTitleIncoming, currentUser.first_name));
|
||||||
|
} else {
|
||||||
|
secretViewStatusTextView.setText(LocaleController.formatString("EncryptedPlaceholderTitleIncoming", R.string.EncryptedPlaceholderTitleIncoming, currentUser.last_name));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
updateSecretStatus();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
ViewGroup parent = (ViewGroup)fragmentView.getParent();
|
ViewGroup parent = (ViewGroup)fragmentView.getParent();
|
||||||
if (parent != null) {
|
if (parent != null) {
|
||||||
@ -2544,6 +2547,10 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
|||||||
cell.setAllowedToSetPhoto(true);
|
cell.setAllowedToSetPhoto(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (currentUser != null) {
|
||||||
|
MessagesController.getInstance().loadFullUser(MessagesController.getInstance().getUser(currentUser.id), classGuid);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateBottomOverlay() {
|
private void updateBottomOverlay() {
|
||||||
|
@ -223,6 +223,9 @@ public class MessagesActivity extends BaseFragment implements NotificationCenter
|
|||||||
fragmentView = inflater.inflate(R.layout.messages_list, container, false);
|
fragmentView = inflater.inflate(R.layout.messages_list, container, false);
|
||||||
|
|
||||||
dialogsAdapter = new DialogsAdapter(getParentActivity(), serverOnly);
|
dialogsAdapter = new DialogsAdapter(getParentActivity(), serverOnly);
|
||||||
|
if (AndroidUtilities.isTablet() && openedDialogId != 0) {
|
||||||
|
dialogsAdapter.setOpenedDialogId(openedDialogId);
|
||||||
|
}
|
||||||
dialogsSearchAdapter = new DialogsSearchAdapter(getParentActivity(), !onlySelect);
|
dialogsSearchAdapter = new DialogsSearchAdapter(getParentActivity(), !onlySelect);
|
||||||
dialogsSearchAdapter.setDelegate(new DialogsSearchAdapter.MessagesActivitySearchAdapterDelegate() {
|
dialogsSearchAdapter.setDelegate(new DialogsSearchAdapter.MessagesActivitySearchAdapterDelegate() {
|
||||||
@Override
|
@Override
|
||||||
@ -527,9 +530,6 @@ public class MessagesActivity extends BaseFragment implements NotificationCenter
|
|||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public void didReceivedNotification(int id, Object... args) {
|
public void didReceivedNotification(int id, Object... args) {
|
||||||
if (id == NotificationCenter.dialogsNeedReload) {
|
if (id == NotificationCenter.dialogsNeedReload) {
|
||||||
if (dialogsAdapter != null) {
|
|
||||||
dialogsAdapter.notifyDataSetChanged();
|
|
||||||
}
|
|
||||||
if (messagesListView != null) {
|
if (messagesListView != null) {
|
||||||
if (MessagesController.getInstance().loadingDialogs && MessagesController.getInstance().dialogs.isEmpty()) {
|
if (MessagesController.getInstance().loadingDialogs && MessagesController.getInstance().dialogs.isEmpty()) {
|
||||||
searchEmptyView.setVisibility(View.GONE);
|
searchEmptyView.setVisibility(View.GONE);
|
||||||
@ -537,14 +537,33 @@ public class MessagesActivity extends BaseFragment implements NotificationCenter
|
|||||||
messagesListView.setEmptyView(progressView);
|
messagesListView.setEmptyView(progressView);
|
||||||
} else {
|
} else {
|
||||||
if (searching && searchWas) {
|
if (searching && searchWas) {
|
||||||
|
if (dialogsAdapter != null) {
|
||||||
|
dialogsAdapter.notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
if (dialogsSearchAdapter != null) {
|
||||||
|
dialogsSearchAdapter.notifyDataSetChanged();
|
||||||
|
}
|
||||||
messagesListView.setEmptyView(searchEmptyView);
|
messagesListView.setEmptyView(searchEmptyView);
|
||||||
emptyView.setVisibility(View.GONE);
|
emptyView.setVisibility(View.GONE);
|
||||||
} else {
|
} else {
|
||||||
|
if (dialogsAdapter != null) {
|
||||||
|
dialogsAdapter.notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
if (dialogsSearchAdapter != null) {
|
||||||
|
dialogsSearchAdapter.notifyDataSetChanged();
|
||||||
|
}
|
||||||
messagesListView.setEmptyView(emptyView);
|
messagesListView.setEmptyView(emptyView);
|
||||||
searchEmptyView.setVisibility(View.GONE);
|
searchEmptyView.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
progressView.setVisibility(View.GONE);
|
progressView.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
if (dialogsAdapter != null) {
|
||||||
|
dialogsAdapter.notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
if (dialogsSearchAdapter != null) {
|
||||||
|
dialogsSearchAdapter.notifyDataSetChanged();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (id == NotificationCenter.emojiDidLoaded) {
|
} else if (id == NotificationCenter.emojiDidLoaded) {
|
||||||
if (messagesListView != null) {
|
if (messagesListView != null) {
|
||||||
@ -569,7 +588,9 @@ public class MessagesActivity extends BaseFragment implements NotificationCenter
|
|||||||
} else {
|
} else {
|
||||||
openedDialogId = dialog_id;
|
openedDialogId = dialog_id;
|
||||||
}
|
}
|
||||||
dialogsAdapter.setOpenedDialogId(openedDialogId);
|
if (dialogsAdapter != null) {
|
||||||
|
dialogsAdapter.setOpenedDialogId(openedDialogId);
|
||||||
|
}
|
||||||
updateVisibleRows(MessagesController.UPDATE_MASK_SELECT_DIALOG);
|
updateVisibleRows(MessagesController.UPDATE_MASK_SELECT_DIALOG);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -695,6 +695,9 @@ public class ChatActivityEnterView implements NotificationCenter.NotificationCen
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setFieldText(String text) {
|
public void setFieldText(String text) {
|
||||||
|
if (messsageEditText == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
ignoreTextChange = true;
|
ignoreTextChange = true;
|
||||||
messsageEditText.setText(text);
|
messsageEditText.setText(text);
|
||||||
messsageEditText.setSelection(messsageEditText.getText().length());
|
messsageEditText.setSelection(messsageEditText.getText().length());
|
||||||
|
@ -17,6 +17,7 @@ import android.widget.AbsListView;
|
|||||||
import android.widget.ListAdapter;
|
import android.widget.ListAdapter;
|
||||||
import android.widget.ListView;
|
import android.widget.ListView;
|
||||||
|
|
||||||
|
import org.telegram.android.AndroidUtilities;
|
||||||
import org.telegram.android.LocaleController;
|
import org.telegram.android.LocaleController;
|
||||||
import org.telegram.messenger.FileLog;
|
import org.telegram.messenger.FileLog;
|
||||||
import org.telegram.ui.Adapters.BaseSectionsAdapter;
|
import org.telegram.ui.Adapters.BaseSectionsAdapter;
|
||||||
@ -112,7 +113,12 @@ public class SectionsListView extends ListView implements AbsListView.OnScrollLi
|
|||||||
header.setTag(-header.getHeight());
|
header.setTag(-header.getHeight());
|
||||||
} else if (pos == count - 2) {
|
} else if (pos == count - 2) {
|
||||||
View child = getChildAt(itemNum - firstVisibleItem);
|
View child = getChildAt(itemNum - firstVisibleItem);
|
||||||
int headerTop = child.getTop();
|
int headerTop = 0;
|
||||||
|
if (child != null) {
|
||||||
|
headerTop = child.getTop();
|
||||||
|
} else {
|
||||||
|
headerTop = -AndroidUtilities.dp(100);
|
||||||
|
}
|
||||||
if (headerTop < 0) {
|
if (headerTop < 0) {
|
||||||
header.setTag(headerTop);
|
header.setTag(headerTop);
|
||||||
} else {
|
} else {
|
||||||
@ -124,7 +130,9 @@ public class SectionsListView extends ListView implements AbsListView.OnScrollLi
|
|||||||
itemNum += count - mAdapter.getPositionInSectionForPosition(firstVisibleItem);
|
itemNum += count - mAdapter.getPositionInSectionForPosition(firstVisibleItem);
|
||||||
} else {
|
} else {
|
||||||
View child = getChildAt(itemNum - firstVisibleItem);
|
View child = getChildAt(itemNum - firstVisibleItem);
|
||||||
header.setTag(child.getTop());
|
if (child != null) {
|
||||||
|
header.setTag(child.getTop());
|
||||||
|
}
|
||||||
itemNum += count;
|
itemNum += count;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user