2013-10-25 17:19:00 +02:00
|
|
|
/*
|
2019-01-23 18:03:33 +01:00
|
|
|
* This is the source code of Telegram for Android v. 5.x.x.
|
2013-10-25 17:19:00 +02:00
|
|
|
* It is licensed under GNU GPL v. 2 or later.
|
|
|
|
* You should have received a copy of the license in this archive (see LICENSE).
|
|
|
|
*
|
2019-01-23 18:03:33 +01:00
|
|
|
* Copyright Nikolai Kudashov, 2013-2018.
|
2013-10-25 17:19:00 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
package org.telegram.ui;
|
|
|
|
|
2016-06-24 12:27:15 +02:00
|
|
|
import android.animation.Animator;
|
2017-03-31 01:58:05 +02:00
|
|
|
import android.animation.AnimatorListenerAdapter;
|
2016-06-24 12:27:15 +02:00
|
|
|
import android.animation.AnimatorSet;
|
2015-02-01 19:51:02 +01:00
|
|
|
import android.animation.ObjectAnimator;
|
|
|
|
import android.animation.StateListAnimator;
|
2015-05-21 23:27:27 +02:00
|
|
|
import android.annotation.SuppressLint;
|
2015-09-24 22:52:02 +02:00
|
|
|
import android.app.Dialog;
|
2013-10-25 17:19:00 +02:00
|
|
|
import android.content.Context;
|
2019-06-04 12:14:50 +02:00
|
|
|
import android.content.DialogInterface;
|
2013-10-25 17:19:00 +02:00
|
|
|
import android.content.Intent;
|
2015-11-26 22:04:02 +01:00
|
|
|
import android.content.SharedPreferences;
|
2017-03-31 01:58:05 +02:00
|
|
|
import android.content.pm.PackageManager;
|
2014-11-11 23:16:17 +01:00
|
|
|
import android.content.res.Configuration;
|
2016-04-22 15:49:00 +02:00
|
|
|
import android.graphics.Canvas;
|
2015-10-29 18:10:07 +01:00
|
|
|
import android.graphics.Color;
|
2015-02-01 19:51:02 +01:00
|
|
|
import android.graphics.Outline;
|
2016-04-22 15:49:00 +02:00
|
|
|
import android.graphics.Paint;
|
2017-03-31 01:58:05 +02:00
|
|
|
import android.graphics.PorterDuff;
|
|
|
|
import android.graphics.PorterDuffColorFilter;
|
|
|
|
import android.graphics.drawable.ColorDrawable;
|
|
|
|
import android.graphics.drawable.Drawable;
|
2013-10-25 17:19:00 +02:00
|
|
|
import android.net.Uri;
|
2014-11-10 12:05:22 +01:00
|
|
|
import android.os.Build;
|
2013-10-25 17:19:00 +02:00
|
|
|
import android.os.Bundle;
|
2019-05-14 14:08:05 +02:00
|
|
|
import androidx.annotation.Keep;
|
|
|
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
|
|
|
import androidx.recyclerview.widget.RecyclerView;
|
|
|
|
|
2017-03-31 01:58:05 +02:00
|
|
|
import android.text.TextUtils;
|
2018-07-30 04:07:02 +02:00
|
|
|
import android.util.SparseArray;
|
2017-03-31 01:58:05 +02:00
|
|
|
import android.util.TypedValue;
|
2014-11-10 12:05:22 +01:00
|
|
|
import android.view.Gravity;
|
2015-10-29 18:10:07 +01:00
|
|
|
import android.view.MotionEvent;
|
2013-10-25 17:19:00 +02:00
|
|
|
import android.view.View;
|
|
|
|
import android.view.ViewGroup;
|
2015-02-01 19:51:02 +01:00
|
|
|
import android.view.ViewOutlineProvider;
|
2014-11-11 23:16:17 +01:00
|
|
|
import android.view.ViewTreeObserver;
|
2015-06-29 19:12:11 +02:00
|
|
|
import android.view.animation.AccelerateInterpolator;
|
|
|
|
import android.view.animation.DecelerateInterpolator;
|
2014-11-10 12:05:22 +01:00
|
|
|
import android.widget.FrameLayout;
|
|
|
|
import android.widget.ImageView;
|
2017-03-31 01:58:05 +02:00
|
|
|
import android.widget.TextView;
|
2018-07-30 04:07:02 +02:00
|
|
|
import android.widget.Toast;
|
2013-10-25 17:19:00 +02:00
|
|
|
|
2015-09-24 22:52:02 +02:00
|
|
|
import org.telegram.messenger.AndroidUtilities;
|
2013-10-25 17:19:00 +02:00
|
|
|
import org.telegram.PhoneFormat.PhoneFormat;
|
2015-09-24 22:52:02 +02:00
|
|
|
import org.telegram.messenger.ChatObject;
|
2019-07-18 15:01:39 +02:00
|
|
|
import org.telegram.messenger.MediaDataController;
|
2019-05-14 14:08:05 +02:00
|
|
|
import org.telegram.messenger.FileLoader;
|
|
|
|
import org.telegram.messenger.ImageLocation;
|
2015-09-24 22:52:02 +02:00
|
|
|
import org.telegram.messenger.LocaleController;
|
|
|
|
import org.telegram.messenger.MessagesStorage;
|
2019-01-23 18:03:33 +01:00
|
|
|
import org.telegram.messenger.NotificationsController;
|
2015-09-24 22:52:02 +02:00
|
|
|
import org.telegram.messenger.SecretChatHelper;
|
|
|
|
import org.telegram.messenger.SendMessagesHelper;
|
|
|
|
import org.telegram.messenger.UserObject;
|
2014-12-01 18:56:31 +01:00
|
|
|
import org.telegram.messenger.ApplicationLoader;
|
2015-09-24 22:52:02 +02:00
|
|
|
import org.telegram.tgnet.ConnectionsManager;
|
2019-06-04 12:14:50 +02:00
|
|
|
import org.telegram.tgnet.TLObject;
|
2015-09-24 22:52:02 +02:00
|
|
|
import org.telegram.tgnet.TLRPC;
|
|
|
|
import org.telegram.messenger.ContactsController;
|
2013-12-20 20:25:49 +01:00
|
|
|
import org.telegram.messenger.FileLog;
|
2015-09-24 22:52:02 +02:00
|
|
|
import org.telegram.messenger.MessagesController;
|
|
|
|
import org.telegram.messenger.NotificationCenter;
|
2013-10-25 17:19:00 +02:00
|
|
|
import org.telegram.messenger.R;
|
2015-09-24 22:52:02 +02:00
|
|
|
import org.telegram.messenger.MessageObject;
|
2014-11-12 23:16:59 +01:00
|
|
|
import org.telegram.messenger.UserConfig;
|
2017-03-31 01:58:05 +02:00
|
|
|
import org.telegram.ui.ActionBar.AlertDialog;
|
2015-10-29 18:10:07 +01:00
|
|
|
import org.telegram.ui.ActionBar.BackDrawable;
|
2016-04-22 15:49:00 +02:00
|
|
|
import org.telegram.ui.ActionBar.SimpleTextView;
|
2017-03-31 01:58:05 +02:00
|
|
|
import org.telegram.ui.ActionBar.ThemeDescription;
|
2015-11-26 22:04:02 +01:00
|
|
|
import org.telegram.ui.Cells.AboutLinkCell;
|
2014-11-10 12:05:22 +01:00
|
|
|
import org.telegram.ui.Cells.DividerCell;
|
|
|
|
import org.telegram.ui.Cells.EmptyCell;
|
2019-01-23 18:03:33 +01:00
|
|
|
import org.telegram.ui.Cells.HeaderCell;
|
2014-11-12 23:16:59 +01:00
|
|
|
import org.telegram.ui.Cells.ShadowSectionCell;
|
2014-11-10 12:05:22 +01:00
|
|
|
import org.telegram.ui.Cells.TextCell;
|
|
|
|
import org.telegram.ui.Cells.TextDetailCell;
|
2015-11-26 22:04:02 +01:00
|
|
|
import org.telegram.ui.Cells.TextInfoPrivacyCell;
|
2014-11-12 23:16:59 +01:00
|
|
|
import org.telegram.ui.Cells.UserCell;
|
2014-11-13 21:10:14 +01:00
|
|
|
import org.telegram.ui.ActionBar.ActionBar;
|
|
|
|
import org.telegram.ui.ActionBar.ActionBarMenu;
|
|
|
|
import org.telegram.ui.ActionBar.ActionBarMenuItem;
|
2019-01-23 18:03:33 +01:00
|
|
|
import org.telegram.ui.Cells.NotificationsCheckCell;
|
2015-11-26 22:04:02 +01:00
|
|
|
import org.telegram.ui.Components.AlertsCreator;
|
2014-12-01 18:56:31 +01:00
|
|
|
import org.telegram.ui.Components.AvatarDrawable;
|
|
|
|
import org.telegram.ui.Components.BackupImageView;
|
2014-11-13 21:10:14 +01:00
|
|
|
import org.telegram.ui.ActionBar.BaseFragment;
|
2017-03-31 01:58:05 +02:00
|
|
|
import org.telegram.ui.Components.CombinedDrawable;
|
2014-12-01 18:56:31 +01:00
|
|
|
import org.telegram.ui.Components.IdenticonDrawable;
|
2015-05-03 13:48:36 +02:00
|
|
|
import org.telegram.ui.Components.LayoutHelper;
|
2015-10-29 18:10:07 +01:00
|
|
|
import org.telegram.ui.Components.RecyclerListView;
|
2016-04-22 15:49:00 +02:00
|
|
|
import org.telegram.ui.ActionBar.Theme;
|
2019-05-14 14:08:05 +02:00
|
|
|
import org.telegram.ui.Components.ScamDrawable;
|
2019-07-18 15:01:39 +02:00
|
|
|
import org.telegram.ui.Components.UndoView;
|
2017-03-31 01:58:05 +02:00
|
|
|
import org.telegram.ui.Components.voip.VoIPHelper;
|
2013-10-25 17:19:00 +02:00
|
|
|
|
2014-02-04 19:36:55 +01:00
|
|
|
import java.util.ArrayList;
|
2014-11-12 23:16:59 +01:00
|
|
|
import java.util.Collections;
|
2018-07-30 04:07:02 +02:00
|
|
|
import java.util.concurrent.CountDownLatch;
|
2014-02-04 19:36:55 +01:00
|
|
|
|
2019-06-21 13:32:04 +02:00
|
|
|
import tw.nekomimi.nekogram.NekoConfig;
|
|
|
|
|
2017-12-08 18:35:59 +01:00
|
|
|
public class ProfileActivity extends BaseFragment implements NotificationCenter.NotificationCenterDelegate, DialogsActivity.DialogsActivityDelegate {
|
2014-11-12 23:16:59 +01:00
|
|
|
|
2015-10-29 18:10:07 +01:00
|
|
|
private RecyclerListView listView;
|
|
|
|
private LinearLayoutManager layoutManager;
|
2013-10-25 17:19:00 +02:00
|
|
|
private ListAdapter listAdapter;
|
2014-11-10 12:05:22 +01:00
|
|
|
private BackupImageView avatarImage;
|
2019-06-18 07:55:59 +02:00
|
|
|
private SimpleTextView nameTextView[] = new SimpleTextView[2];
|
|
|
|
private SimpleTextView onlineTextView[] = new SimpleTextView[2];
|
|
|
|
private SimpleTextView idTextView;
|
2014-11-11 23:16:17 +01:00
|
|
|
private ImageView writeButton;
|
2016-06-24 12:27:15 +02:00
|
|
|
private AnimatorSet writeButtonAnimation;
|
2019-05-14 14:08:05 +02:00
|
|
|
private ScamDrawable scamDrawable;
|
2019-06-04 12:14:50 +02:00
|
|
|
private MediaActivity mediaActivity;
|
2019-07-18 15:01:39 +02:00
|
|
|
private UndoView undoView;
|
2019-06-04 12:14:50 +02:00
|
|
|
|
|
|
|
private boolean[] isOnline = new boolean[1];
|
2019-01-23 18:03:33 +01:00
|
|
|
|
2015-11-26 22:04:02 +01:00
|
|
|
private AvatarDrawable avatarDrawable;
|
|
|
|
private ActionBarMenuItem animatingItem;
|
2017-03-31 01:58:05 +02:00
|
|
|
private ActionBarMenuItem callItem;
|
2017-07-08 18:32:04 +02:00
|
|
|
private ActionBarMenuItem editItem;
|
2016-04-22 15:49:00 +02:00
|
|
|
private TopView topView;
|
2013-10-25 17:19:00 +02:00
|
|
|
private int user_id;
|
2014-11-12 23:16:59 +01:00
|
|
|
private int chat_id;
|
2013-10-25 17:19:00 +02:00
|
|
|
private long dialog_id;
|
2014-11-12 23:16:59 +01:00
|
|
|
private boolean creatingChat;
|
|
|
|
private boolean userBlocked;
|
2019-07-18 15:01:39 +02:00
|
|
|
private boolean reportSpam;
|
2015-11-26 22:04:02 +01:00
|
|
|
private long mergeDialogId;
|
|
|
|
|
2018-07-30 04:07:02 +02:00
|
|
|
private int[] mediaCount = new int[]{-1, -1, -1, -1, -1};
|
|
|
|
private int[] mediaMergeCount = new int[]{-1, -1, -1, -1, -1};
|
2019-01-23 18:03:33 +01:00
|
|
|
private int[] lastMediaCount = new int[]{-1, -1, -1, -1, -1};
|
|
|
|
private int[] prevMediaCount = new int[]{-1, -1, -1, -1, -1};
|
|
|
|
|
|
|
|
private MediaActivity.SharedMediaData[] sharedMediaData;
|
2018-07-30 04:07:02 +02:00
|
|
|
|
2015-11-26 22:04:02 +01:00
|
|
|
private boolean loadingUsers;
|
2018-07-30 04:07:02 +02:00
|
|
|
private SparseArray<TLRPC.ChatParticipant> participantsMap = new SparseArray<>();
|
2015-11-26 22:04:02 +01:00
|
|
|
private boolean usersEndReached;
|
2014-11-12 23:16:59 +01:00
|
|
|
|
2017-07-08 18:32:04 +02:00
|
|
|
private int banFromGroup;
|
2015-10-29 18:10:07 +01:00
|
|
|
private boolean openAnimationInProgress;
|
2017-03-31 01:58:05 +02:00
|
|
|
private boolean recreateMenuAfterAnimation;
|
2015-10-29 18:10:07 +01:00
|
|
|
private boolean playProfileAnimation;
|
2016-05-25 23:49:47 +02:00
|
|
|
private boolean allowProfileAnimation = true;
|
2015-10-29 18:10:07 +01:00
|
|
|
private int extraHeight;
|
|
|
|
private int initialAnimationExtraHeight;
|
|
|
|
private float animationProgress;
|
|
|
|
|
2017-12-08 18:35:59 +01:00
|
|
|
private boolean isBot;
|
|
|
|
|
2019-01-23 18:03:33 +01:00
|
|
|
private TLRPC.ChatFull chatInfo;
|
2019-05-14 14:08:05 +02:00
|
|
|
private TLRPC.UserFull userInfo;
|
2019-01-23 18:03:33 +01:00
|
|
|
|
2015-11-26 22:04:02 +01:00
|
|
|
private int selectedUser;
|
2014-11-12 23:16:59 +01:00
|
|
|
private int onlineCount = -1;
|
|
|
|
private ArrayList<Integer> sortedUsers;
|
|
|
|
|
2013-10-25 17:19:00 +02:00
|
|
|
private TLRPC.EncryptedChat currentEncryptedChat;
|
2014-11-12 23:16:59 +01:00
|
|
|
private TLRPC.Chat currentChat;
|
2015-06-29 19:12:11 +02:00
|
|
|
private TLRPC.BotInfo botInfo;
|
2017-07-08 18:32:04 +02:00
|
|
|
private TLRPC.ChannelParticipant currentChannelParticipant;
|
2014-11-12 23:16:59 +01:00
|
|
|
|
2014-04-02 19:36:57 +02:00
|
|
|
private final static int add_contact = 1;
|
|
|
|
private final static int block_contact = 2;
|
|
|
|
private final static int share_contact = 3;
|
|
|
|
private final static int edit_contact = 4;
|
|
|
|
private final static int delete_contact = 5;
|
2014-11-12 23:16:59 +01:00
|
|
|
private final static int leave_group = 7;
|
2015-06-29 19:12:11 +02:00
|
|
|
private final static int invite_to_group = 9;
|
|
|
|
private final static int share = 10;
|
2015-11-26 22:04:02 +01:00
|
|
|
private final static int edit_channel = 12;
|
2016-05-25 23:49:47 +02:00
|
|
|
private final static int add_shortcut = 14;
|
2017-03-31 01:58:05 +02:00
|
|
|
private final static int call_item = 15;
|
2019-01-23 18:03:33 +01:00
|
|
|
private final static int search_members = 17;
|
|
|
|
private final static int add_member = 18;
|
|
|
|
private final static int statistics = 19;
|
|
|
|
|
|
|
|
private int rowCount;
|
2014-04-02 19:36:57 +02:00
|
|
|
|
2014-11-10 12:05:22 +01:00
|
|
|
private int emptyRow;
|
2019-01-23 18:03:33 +01:00
|
|
|
private int infoHeaderRow;
|
2014-05-17 01:05:49 +02:00
|
|
|
private int phoneRow;
|
2019-07-18 15:01:39 +02:00
|
|
|
private int locationRow;
|
2019-01-23 18:03:33 +01:00
|
|
|
private int userInfoRow;
|
2015-09-24 22:52:02 +02:00
|
|
|
private int channelInfoRow;
|
2019-01-23 18:03:33 +01:00
|
|
|
private int usernameRow;
|
|
|
|
private int notificationsDividerRow;
|
|
|
|
private int notificationsRow;
|
|
|
|
private int infoSectionRow;
|
|
|
|
|
2014-05-17 01:05:49 +02:00
|
|
|
private int settingsTimerRow;
|
|
|
|
private int settingsKeyRow;
|
2019-01-23 18:03:33 +01:00
|
|
|
private int settingsSectionRow;
|
|
|
|
|
|
|
|
private int membersHeaderRow;
|
|
|
|
private int membersStartRow;
|
2014-11-12 23:16:59 +01:00
|
|
|
private int membersEndRow;
|
2015-05-03 13:48:36 +02:00
|
|
|
private int addMemberRow;
|
2019-01-23 18:03:33 +01:00
|
|
|
private int subscribersRow;
|
|
|
|
private int administratorsRow;
|
|
|
|
private int blockedUsersRow;
|
|
|
|
private int membersSectionRow;
|
|
|
|
|
|
|
|
private int sharedHeaderRow;
|
|
|
|
private int photosRow;
|
|
|
|
private int filesRow;
|
|
|
|
private int linksRow;
|
|
|
|
private int audioRow;
|
|
|
|
private int voiceRow;
|
|
|
|
private int groupsInCommonRow;
|
|
|
|
private int sharedSectionRow;
|
|
|
|
|
2019-06-04 12:14:50 +02:00
|
|
|
private int unblockRow;
|
2019-01-23 18:03:33 +01:00
|
|
|
private int startSecretChatRow;
|
|
|
|
private int leaveChannelRow;
|
|
|
|
private int joinRow;
|
|
|
|
private int lastSectionRow;
|
2014-05-17 01:05:49 +02:00
|
|
|
|
2017-12-08 18:35:59 +01:00
|
|
|
private PhotoViewer.PhotoViewerProvider provider = new PhotoViewer.EmptyPhotoViewerProvider() {
|
|
|
|
|
|
|
|
@Override
|
2019-03-03 21:40:48 +01:00
|
|
|
public PhotoViewer.PlaceProviderObject getPlaceForPhoto(MessageObject messageObject, TLRPC.FileLocation fileLocation, int index, boolean needPreview) {
|
2017-12-08 18:35:59 +01:00
|
|
|
if (fileLocation == null) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
TLRPC.FileLocation photoBig = null;
|
|
|
|
if (user_id != 0) {
|
2018-07-30 04:07:02 +02:00
|
|
|
TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(user_id);
|
2017-12-08 18:35:59 +01:00
|
|
|
if (user != null && user.photo != null && user.photo.photo_big != null) {
|
|
|
|
photoBig = user.photo.photo_big;
|
|
|
|
}
|
|
|
|
} else if (chat_id != 0) {
|
2018-07-30 04:07:02 +02:00
|
|
|
TLRPC.Chat chat = MessagesController.getInstance(currentAccount).getChat(chat_id);
|
2017-12-08 18:35:59 +01:00
|
|
|
if (chat != null && chat.photo != null && chat.photo.photo_big != null) {
|
|
|
|
photoBig = chat.photo.photo_big;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (photoBig != null && photoBig.local_id == fileLocation.local_id && photoBig.volume_id == fileLocation.volume_id && photoBig.dc_id == fileLocation.dc_id) {
|
2019-05-14 14:08:05 +02:00
|
|
|
int[] coords = new int[2];
|
2017-12-08 18:35:59 +01:00
|
|
|
avatarImage.getLocationInWindow(coords);
|
|
|
|
PhotoViewer.PlaceProviderObject object = new PhotoViewer.PlaceProviderObject();
|
|
|
|
object.viewX = coords[0];
|
|
|
|
object.viewY = coords[1] - (Build.VERSION.SDK_INT >= 21 ? 0 : AndroidUtilities.statusBarHeight);
|
|
|
|
object.parentView = avatarImage;
|
|
|
|
object.imageReceiver = avatarImage.getImageReceiver();
|
|
|
|
if (user_id != 0) {
|
|
|
|
object.dialogId = user_id;
|
|
|
|
} else if (chat_id != 0) {
|
|
|
|
object.dialogId = -chat_id;
|
|
|
|
}
|
2018-07-30 04:07:02 +02:00
|
|
|
object.thumb = object.imageReceiver.getBitmapSafe();
|
2017-12-08 18:35:59 +01:00
|
|
|
object.size = -1;
|
|
|
|
object.radius = avatarImage.getImageReceiver().getRoundRadius();
|
|
|
|
object.scale = avatarImage.getScaleX();
|
|
|
|
return object;
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void willHidePhotoViewer() {
|
|
|
|
avatarImage.getImageReceiver().setVisible(true, true);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2016-04-22 15:49:00 +02:00
|
|
|
private class TopView extends View {
|
|
|
|
|
|
|
|
private int currentColor;
|
|
|
|
private Paint paint = new Paint();
|
|
|
|
|
|
|
|
public TopView(Context context) {
|
|
|
|
super(context);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
2016-05-25 23:49:47 +02:00
|
|
|
setMeasuredDimension(MeasureSpec.getSize(widthMeasureSpec), ActionBar.getCurrentActionBarHeight() + (actionBar.getOccupyStatusBar() ? AndroidUtilities.statusBarHeight : 0) + AndroidUtilities.dp(91));
|
2016-04-22 15:49:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void setBackgroundColor(int color) {
|
|
|
|
if (color != currentColor) {
|
|
|
|
paint.setColor(color);
|
|
|
|
invalidate();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected void onDraw(Canvas canvas) {
|
|
|
|
int height = getMeasuredHeight() - AndroidUtilities.dp(91);
|
|
|
|
canvas.drawRect(0, 0, getMeasuredWidth(), height + extraHeight, paint);
|
|
|
|
if (parentLayout != null) {
|
|
|
|
parentLayout.drawHeaderShadow(canvas, height + extraHeight);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-11-10 12:05:22 +01:00
|
|
|
public ProfileActivity(Bundle args) {
|
2014-06-04 01:31:48 +02:00
|
|
|
super(args);
|
|
|
|
}
|
|
|
|
|
2013-10-25 17:19:00 +02:00
|
|
|
@Override
|
|
|
|
public boolean onFragmentCreate() {
|
2014-06-04 01:31:48 +02:00
|
|
|
user_id = arguments.getInt("user_id", 0);
|
2017-07-08 18:32:04 +02:00
|
|
|
chat_id = arguments.getInt("chat_id", 0);
|
|
|
|
banFromGroup = arguments.getInt("ban_chat_id", 0);
|
2019-07-18 15:01:39 +02:00
|
|
|
reportSpam = arguments.getBoolean("reportSpam", false);
|
2014-11-12 23:16:59 +01:00
|
|
|
if (user_id != 0) {
|
|
|
|
dialog_id = arguments.getLong("dialog_id", 0);
|
|
|
|
if (dialog_id != 0) {
|
2018-07-30 04:07:02 +02:00
|
|
|
currentEncryptedChat = MessagesController.getInstance(currentAccount).getEncryptedChat((int) (dialog_id >> 32));
|
2014-11-12 23:16:59 +01:00
|
|
|
}
|
2018-07-30 04:07:02 +02:00
|
|
|
TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(user_id);
|
2015-06-29 19:12:11 +02:00
|
|
|
if (user == null) {
|
2014-11-12 23:16:59 +01:00
|
|
|
return false;
|
|
|
|
}
|
2018-07-30 04:07:02 +02:00
|
|
|
NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.updateInterfaces);
|
2019-01-23 18:03:33 +01:00
|
|
|
NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.contactsDidLoad);
|
2018-07-30 04:07:02 +02:00
|
|
|
NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.encryptedChatCreated);
|
|
|
|
NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.encryptedChatUpdated);
|
2019-01-23 18:03:33 +01:00
|
|
|
NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.blockedUsersDidLoad);
|
|
|
|
NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.botInfoDidLoad);
|
|
|
|
NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.userInfoDidLoad);
|
2018-08-27 10:33:11 +02:00
|
|
|
userBlocked = MessagesController.getInstance(currentAccount).blockedUsers.indexOfKey(user_id) >= 0;
|
2015-11-26 22:04:02 +01:00
|
|
|
if (user.bot) {
|
2017-12-08 18:35:59 +01:00
|
|
|
isBot = true;
|
2019-07-18 15:01:39 +02:00
|
|
|
MediaDataController.getInstance(currentAccount).loadBotInfo(user.id, true, classGuid);
|
2015-06-29 19:12:11 +02:00
|
|
|
}
|
2019-05-14 14:08:05 +02:00
|
|
|
userInfo = MessagesController.getInstance(currentAccount).getUserFull(user_id);
|
2018-07-30 04:07:02 +02:00
|
|
|
MessagesController.getInstance(currentAccount).loadFullUser(MessagesController.getInstance(currentAccount).getUser(user_id), classGuid, true);
|
2015-11-26 22:04:02 +01:00
|
|
|
participantsMap = null;
|
2014-11-12 23:16:59 +01:00
|
|
|
} else if (chat_id != 0) {
|
2018-07-30 04:07:02 +02:00
|
|
|
currentChat = MessagesController.getInstance(currentAccount).getChat(chat_id);
|
2014-11-12 23:16:59 +01:00
|
|
|
if (currentChat == null) {
|
2018-07-30 04:07:02 +02:00
|
|
|
final CountDownLatch countDownLatch = new CountDownLatch(1);
|
2018-08-27 10:33:11 +02:00
|
|
|
MessagesStorage.getInstance(currentAccount).getStorageQueue().postRunnable(() -> {
|
|
|
|
currentChat = MessagesStorage.getInstance(currentAccount).getChat(chat_id);
|
|
|
|
countDownLatch.countDown();
|
2014-11-12 23:16:59 +01:00
|
|
|
});
|
|
|
|
try {
|
2018-07-30 04:07:02 +02:00
|
|
|
countDownLatch.await();
|
2014-11-12 23:16:59 +01:00
|
|
|
} catch (Exception e) {
|
2017-03-31 01:58:05 +02:00
|
|
|
FileLog.e(e);
|
2014-11-12 23:16:59 +01:00
|
|
|
}
|
|
|
|
if (currentChat != null) {
|
2018-07-30 04:07:02 +02:00
|
|
|
MessagesController.getInstance(currentAccount).putChat(currentChat, true);
|
2014-11-12 23:16:59 +01:00
|
|
|
} else {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-11-26 22:04:02 +01:00
|
|
|
if (currentChat.megagroup) {
|
|
|
|
getChannelParticipants(true);
|
|
|
|
} else {
|
|
|
|
participantsMap = null;
|
|
|
|
}
|
2019-01-23 18:03:33 +01:00
|
|
|
NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.chatInfoDidLoad);
|
|
|
|
NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.chatOnlineCountDidLoad);
|
2014-11-12 23:16:59 +01:00
|
|
|
|
2015-01-02 23:15:07 +01:00
|
|
|
sortedUsers = new ArrayList<>();
|
2014-11-12 23:16:59 +01:00
|
|
|
updateOnlineCount();
|
2019-08-22 01:53:26 +02:00
|
|
|
if (chatInfo == null) {
|
|
|
|
chatInfo = getMessagesController().getChatFull(chat_id);
|
|
|
|
}
|
2016-03-16 13:26:32 +01:00
|
|
|
if (ChatObject.isChannel(currentChat)) {
|
2018-07-30 04:07:02 +02:00
|
|
|
MessagesController.getInstance(currentAccount).loadFullChat(chat_id, classGuid, true);
|
2019-06-04 12:14:50 +02:00
|
|
|
} else if (chatInfo == null) {
|
2019-08-22 01:53:26 +02:00
|
|
|
chatInfo = getMessagesStorage().loadChatInfo(chat_id, null, false, false);
|
2016-03-16 13:26:32 +01:00
|
|
|
}
|
2014-11-12 23:16:59 +01:00
|
|
|
} else {
|
2014-08-22 16:24:33 +02:00
|
|
|
return false;
|
|
|
|
}
|
2014-10-17 20:29:13 +02:00
|
|
|
|
2019-01-23 18:03:33 +01:00
|
|
|
sharedMediaData = new MediaActivity.SharedMediaData[5];
|
|
|
|
for (int a = 0; a < sharedMediaData.length; a++) {
|
|
|
|
sharedMediaData[a] = new MediaActivity.SharedMediaData();
|
|
|
|
sharedMediaData[a].setMaxId(0, dialog_id != 0 ? Integer.MIN_VALUE : Integer.MAX_VALUE);
|
2015-11-26 22:04:02 +01:00
|
|
|
}
|
|
|
|
|
2019-01-23 18:03:33 +01:00
|
|
|
loadMediaCounts();
|
|
|
|
|
|
|
|
NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.mediaCountDidLoad);
|
|
|
|
NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.mediaCountsDidLoad);
|
|
|
|
NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.mediaDidLoad);
|
2018-07-30 04:07:02 +02:00
|
|
|
NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.updateInterfaces);
|
2019-01-23 18:03:33 +01:00
|
|
|
NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.didReceiveNewMessages);
|
|
|
|
NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.messagesDeleted);
|
2018-07-30 04:07:02 +02:00
|
|
|
NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.closeChats);
|
2014-11-12 23:16:59 +01:00
|
|
|
updateRowsIds();
|
2014-10-17 20:29:13 +02:00
|
|
|
|
2014-08-22 16:24:33 +02:00
|
|
|
return true;
|
2013-10-25 17:19:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onFragmentDestroy() {
|
|
|
|
super.onFragmentDestroy();
|
2019-01-23 18:03:33 +01:00
|
|
|
NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.mediaCountDidLoad);
|
|
|
|
NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.mediaCountsDidLoad);
|
|
|
|
NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.mediaDidLoad);
|
2018-07-30 04:07:02 +02:00
|
|
|
NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.updateInterfaces);
|
|
|
|
NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.closeChats);
|
2019-01-23 18:03:33 +01:00
|
|
|
NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.didReceiveNewMessages);
|
|
|
|
NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.messagesDeleted);
|
2014-11-12 23:16:59 +01:00
|
|
|
if (user_id != 0) {
|
2019-01-23 18:03:33 +01:00
|
|
|
NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.contactsDidLoad);
|
2018-07-30 04:07:02 +02:00
|
|
|
NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.encryptedChatCreated);
|
|
|
|
NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.encryptedChatUpdated);
|
2019-01-23 18:03:33 +01:00
|
|
|
NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.blockedUsersDidLoad);
|
|
|
|
NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.botInfoDidLoad);
|
|
|
|
NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.userInfoDidLoad);
|
2018-07-30 04:07:02 +02:00
|
|
|
MessagesController.getInstance(currentAccount).cancelLoadFullUser(user_id);
|
2014-11-12 23:16:59 +01:00
|
|
|
} else if (chat_id != 0) {
|
2019-01-23 18:03:33 +01:00
|
|
|
NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.chatInfoDidLoad);
|
|
|
|
NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.chatOnlineCountDidLoad);
|
2014-11-12 23:16:59 +01:00
|
|
|
}
|
2013-10-25 17:19:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2016-04-22 15:49:00 +02:00
|
|
|
protected ActionBar createActionBar(Context context) {
|
|
|
|
ActionBar actionBar = new ActionBar(context) {
|
|
|
|
@Override
|
|
|
|
public boolean onTouchEvent(MotionEvent event) {
|
2016-05-25 23:49:47 +02:00
|
|
|
return super.onTouchEvent(event);
|
2016-04-22 15:49:00 +02:00
|
|
|
}
|
|
|
|
};
|
2018-07-30 04:07:02 +02:00
|
|
|
actionBar.setItemsBackgroundColor(AvatarDrawable.getButtonColorForId(user_id != 0 || ChatObject.isChannel(chat_id, currentAccount) && !currentChat.megagroup ? 5 : chat_id), false);
|
2017-03-31 01:58:05 +02:00
|
|
|
actionBar.setItemsColor(Theme.getColor(Theme.key_actionBarDefaultIcon), false);
|
|
|
|
actionBar.setItemsColor(Theme.getColor(Theme.key_actionBarActionModeDefaultIcon), true);
|
2015-10-29 18:10:07 +01:00
|
|
|
actionBar.setBackButtonDrawable(new BackDrawable(false));
|
|
|
|
actionBar.setCastShadows(false);
|
|
|
|
actionBar.setAddToContainer(false);
|
2016-05-25 23:49:47 +02:00
|
|
|
actionBar.setOccupyStatusBar(Build.VERSION.SDK_INT >= 21 && !AndroidUtilities.isTablet());
|
2016-04-22 15:49:00 +02:00
|
|
|
return actionBar;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public View createView(Context context) {
|
2017-03-31 01:58:05 +02:00
|
|
|
Theme.createProfileResources(context);
|
|
|
|
|
2015-10-29 18:10:07 +01:00
|
|
|
hasOwnBackground = true;
|
2016-05-25 23:49:47 +02:00
|
|
|
extraHeight = AndroidUtilities.dp(88);
|
2015-04-09 20:00:14 +02:00
|
|
|
actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {
|
|
|
|
@Override
|
|
|
|
public void onItemClick(final int id) {
|
|
|
|
if (getParentActivity() == null) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (id == -1) {
|
|
|
|
finishFragment();
|
|
|
|
} else if (id == block_contact) {
|
2018-07-30 04:07:02 +02:00
|
|
|
TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(user_id);
|
2015-09-02 00:14:21 +02:00
|
|
|
if (user == null) {
|
|
|
|
return;
|
2015-04-09 20:00:14 +02:00
|
|
|
}
|
2019-03-03 21:40:48 +01:00
|
|
|
if (!isBot || MessagesController.isSupportUser(user)) {
|
2019-06-04 12:14:50 +02:00
|
|
|
if (userBlocked) {
|
|
|
|
MessagesController.getInstance(currentAccount).unblockUser(user_id);
|
|
|
|
AlertsCreator.showSimpleToast(ProfileActivity.this, LocaleController.getString("UserUnblocked", R.string.UserUnblocked));
|
2015-09-02 00:14:21 +02:00
|
|
|
} else {
|
2019-07-18 15:01:39 +02:00
|
|
|
if (reportSpam) {
|
|
|
|
AlertsCreator.showBlockReportSpamAlert(ProfileActivity.this, user_id, user, null, currentEncryptedChat, false, null, param -> {
|
|
|
|
if (param == 1) {
|
|
|
|
NotificationCenter.getInstance(currentAccount).removeObserver(ProfileActivity.this, NotificationCenter.closeChats);
|
|
|
|
NotificationCenter.getInstance(currentAccount).postNotificationName(NotificationCenter.closeChats);
|
|
|
|
playProfileAnimation = false;
|
|
|
|
finishFragment();
|
|
|
|
} else {
|
|
|
|
getNotificationCenter().postNotificationName(NotificationCenter.peerSettingsDidLoad, (long) user_id);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
|
|
|
|
builder.setTitle(LocaleController.getString("BlockUser", R.string.BlockUser));
|
|
|
|
builder.setMessage(AndroidUtilities.replaceTags(LocaleController.formatString("AreYouSureBlockContact2", R.string.AreYouSureBlockContact2, ContactsController.formatName(user.first_name, user.last_name))));
|
|
|
|
builder.setPositiveButton(LocaleController.getString("BlockContact", R.string.BlockContact), (dialogInterface, i) -> {
|
|
|
|
MessagesController.getInstance(currentAccount).blockUser(user_id);
|
|
|
|
AlertsCreator.showSimpleToast(ProfileActivity.this, LocaleController.getString("UserBlocked", R.string.UserBlocked));
|
|
|
|
});
|
|
|
|
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
|
|
|
|
AlertDialog dialog = builder.create();
|
|
|
|
showDialog(dialog);
|
|
|
|
TextView button = (TextView) dialog.getButton(DialogInterface.BUTTON_POSITIVE);
|
|
|
|
if (button != null) {
|
|
|
|
button.setTextColor(Theme.getColor(Theme.key_dialogTextRed2));
|
|
|
|
}
|
2015-04-09 20:00:14 +02:00
|
|
|
}
|
2019-06-04 12:14:50 +02:00
|
|
|
}
|
2015-09-02 00:14:21 +02:00
|
|
|
} else {
|
|
|
|
if (!userBlocked) {
|
2018-07-30 04:07:02 +02:00
|
|
|
MessagesController.getInstance(currentAccount).blockUser(user_id);
|
2015-09-02 00:14:21 +02:00
|
|
|
} else {
|
2018-07-30 04:07:02 +02:00
|
|
|
MessagesController.getInstance(currentAccount).unblockUser(user_id);
|
2019-09-10 12:56:11 +02:00
|
|
|
SendMessagesHelper.getInstance(currentAccount).sendMessage("/start", user_id, null, null, false, null, null, null, true, 0);
|
2015-09-02 00:14:21 +02:00
|
|
|
finishFragment();
|
2015-04-09 20:00:14 +02:00
|
|
|
}
|
2015-09-02 00:14:21 +02:00
|
|
|
}
|
2015-04-09 20:00:14 +02:00
|
|
|
} else if (id == add_contact) {
|
2018-07-30 04:07:02 +02:00
|
|
|
TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(user_id);
|
2015-04-09 20:00:14 +02:00
|
|
|
Bundle args = new Bundle();
|
|
|
|
args.putInt("user_id", user.id);
|
2015-10-29 18:10:07 +01:00
|
|
|
args.putBoolean("addContact", true);
|
2015-04-09 20:00:14 +02:00
|
|
|
presentFragment(new ContactAddActivity(args));
|
|
|
|
} else if (id == share_contact) {
|
|
|
|
Bundle args = new Bundle();
|
|
|
|
args.putBoolean("onlySelect", true);
|
2015-11-26 22:04:02 +01:00
|
|
|
args.putString("selectAlertString", LocaleController.getString("SendContactTo", R.string.SendContactTo));
|
|
|
|
args.putString("selectAlertStringGroup", LocaleController.getString("SendContactToGroup", R.string.SendContactToGroup));
|
2015-07-22 20:56:37 +02:00
|
|
|
DialogsActivity fragment = new DialogsActivity(args);
|
2015-04-09 20:00:14 +02:00
|
|
|
fragment.setDelegate(ProfileActivity.this);
|
|
|
|
presentFragment(fragment);
|
|
|
|
} else if (id == edit_contact) {
|
|
|
|
Bundle args = new Bundle();
|
|
|
|
args.putInt("user_id", user_id);
|
|
|
|
presentFragment(new ContactAddActivity(args));
|
|
|
|
} else if (id == delete_contact) {
|
2018-07-30 04:07:02 +02:00
|
|
|
final TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(user_id);
|
2015-04-09 20:00:14 +02:00
|
|
|
if (user == null || getParentActivity() == null) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
|
2019-06-04 12:14:50 +02:00
|
|
|
builder.setTitle(LocaleController.getString("DeleteContact", R.string.DeleteContact));
|
2015-04-09 20:00:14 +02:00
|
|
|
builder.setMessage(LocaleController.getString("AreYouSureDeleteContact", R.string.AreYouSureDeleteContact));
|
2019-06-04 12:14:50 +02:00
|
|
|
builder.setPositiveButton(LocaleController.getString("Delete", R.string.Delete), (dialogInterface, i) -> {
|
2018-08-27 10:33:11 +02:00
|
|
|
ArrayList<TLRPC.User> arrayList = new ArrayList<>();
|
|
|
|
arrayList.add(user);
|
|
|
|
ContactsController.getInstance(currentAccount).deleteContact(arrayList);
|
2015-04-09 20:00:14 +02:00
|
|
|
});
|
|
|
|
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
|
2019-06-04 12:14:50 +02:00
|
|
|
AlertDialog dialog = builder.create();
|
|
|
|
showDialog(dialog);
|
|
|
|
TextView button = (TextView) dialog.getButton(DialogInterface.BUTTON_POSITIVE);
|
|
|
|
if (button != null) {
|
|
|
|
button.setTextColor(Theme.getColor(Theme.key_dialogTextRed2));
|
|
|
|
}
|
2015-04-09 20:00:14 +02:00
|
|
|
} else if (id == leave_group) {
|
2015-11-26 22:04:02 +01:00
|
|
|
leaveChatPressed();
|
|
|
|
} else if (id == edit_channel) {
|
|
|
|
Bundle args = new Bundle();
|
|
|
|
args.putInt("chat_id", chat_id);
|
2019-01-23 18:03:33 +01:00
|
|
|
ChatEditActivity fragment = new ChatEditActivity(args);
|
|
|
|
fragment.setInfo(chatInfo);
|
2015-11-26 22:04:02 +01:00
|
|
|
presentFragment(fragment);
|
2015-06-29 19:12:11 +02:00
|
|
|
} else if (id == invite_to_group) {
|
2018-07-30 04:07:02 +02:00
|
|
|
final TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(user_id);
|
2015-06-29 19:12:11 +02:00
|
|
|
if (user == null) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
Bundle args = new Bundle();
|
|
|
|
args.putBoolean("onlySelect", true);
|
|
|
|
args.putInt("dialogsType", 2);
|
|
|
|
args.putString("addToGroupAlertString", LocaleController.formatString("AddToTheGroupTitle", R.string.AddToTheGroupTitle, UserObject.getUserName(user), "%1$s"));
|
2015-07-22 20:56:37 +02:00
|
|
|
DialogsActivity fragment = new DialogsActivity(args);
|
2018-08-27 10:33:11 +02:00
|
|
|
fragment.setDelegate((fragment1, dids, message, param) -> {
|
|
|
|
long did = dids.get(0);
|
|
|
|
Bundle args1 = new Bundle();
|
|
|
|
args1.putBoolean("scrollToTopOnResume", true);
|
|
|
|
args1.putInt("chat_id", -(int) did);
|
|
|
|
if (!MessagesController.getInstance(currentAccount).checkCanOpenChat(args1, fragment1)) {
|
|
|
|
return;
|
2015-06-29 19:12:11 +02:00
|
|
|
}
|
2018-08-27 10:33:11 +02:00
|
|
|
|
|
|
|
NotificationCenter.getInstance(currentAccount).removeObserver(ProfileActivity.this, NotificationCenter.closeChats);
|
|
|
|
NotificationCenter.getInstance(currentAccount).postNotificationName(NotificationCenter.closeChats);
|
2019-01-23 18:03:33 +01:00
|
|
|
MessagesController.getInstance(currentAccount).addUserToChat(-(int) did, user, null, 0, null, ProfileActivity.this, null);
|
2018-08-27 10:33:11 +02:00
|
|
|
presentFragment(new ChatActivity(args1), true);
|
|
|
|
removeSelfFromStack();
|
2015-06-29 19:12:11 +02:00
|
|
|
});
|
|
|
|
presentFragment(fragment);
|
|
|
|
} else if (id == share) {
|
|
|
|
try {
|
2018-07-30 04:07:02 +02:00
|
|
|
TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(user_id);
|
2015-06-29 19:12:11 +02:00
|
|
|
if (user == null) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
Intent intent = new Intent(Intent.ACTION_SEND);
|
|
|
|
intent.setType("text/plain");
|
2019-01-23 18:03:33 +01:00
|
|
|
if (botInfo != null && userInfo != null && !TextUtils.isEmpty(userInfo.about)) {
|
|
|
|
intent.putExtra(Intent.EXTRA_TEXT, String.format("%s https://" + MessagesController.getInstance(currentAccount).linkPrefix + "/%s", userInfo.about, user.username));
|
2015-06-29 19:12:11 +02:00
|
|
|
} else {
|
2018-07-30 04:07:02 +02:00
|
|
|
intent.putExtra(Intent.EXTRA_TEXT, String.format("https://" + MessagesController.getInstance(currentAccount).linkPrefix + "/%s", user.username));
|
2015-06-29 19:12:11 +02:00
|
|
|
}
|
|
|
|
startActivityForResult(Intent.createChooser(intent, LocaleController.getString("BotShare", R.string.BotShare)), 500);
|
|
|
|
} catch (Exception e) {
|
2017-03-31 01:58:05 +02:00
|
|
|
FileLog.e(e);
|
2015-06-29 19:12:11 +02:00
|
|
|
}
|
2016-05-25 23:49:47 +02:00
|
|
|
} else if (id == add_shortcut) {
|
|
|
|
try {
|
|
|
|
long did;
|
|
|
|
if (currentEncryptedChat != null) {
|
|
|
|
did = ((long) currentEncryptedChat.id) << 32;
|
|
|
|
} else if (user_id != 0) {
|
|
|
|
did = user_id;
|
|
|
|
} else if (chat_id != 0) {
|
|
|
|
did = -chat_id;
|
|
|
|
} else {
|
|
|
|
return;
|
|
|
|
}
|
2019-07-18 15:01:39 +02:00
|
|
|
MediaDataController.getInstance(currentAccount).installShortcut(did);
|
2016-05-25 23:49:47 +02:00
|
|
|
} catch (Exception e) {
|
2017-03-31 01:58:05 +02:00
|
|
|
FileLog.e(e);
|
|
|
|
}
|
|
|
|
} else if (id == call_item) {
|
2018-07-30 04:07:02 +02:00
|
|
|
TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(user_id);
|
2017-03-31 01:58:05 +02:00
|
|
|
if (user != null) {
|
2019-01-23 18:03:33 +01:00
|
|
|
VoIPHelper.startCall(user, getParentActivity(), userInfo);
|
2016-05-25 23:49:47 +02:00
|
|
|
}
|
2017-07-08 18:32:04 +02:00
|
|
|
} else if (id == search_members) {
|
|
|
|
Bundle args = new Bundle();
|
|
|
|
args.putInt("chat_id", chat_id);
|
2019-01-23 18:03:33 +01:00
|
|
|
args.putInt("type", ChatUsersActivity.TYPE_USERS);
|
|
|
|
args.putBoolean("open_search", true);
|
|
|
|
ChatUsersActivity fragment = new ChatUsersActivity(args);
|
|
|
|
fragment.setInfo(chatInfo);
|
|
|
|
presentFragment(fragment);
|
|
|
|
} else if (id == add_member) {
|
|
|
|
openAddMember();
|
|
|
|
} else if (id == statistics) {
|
|
|
|
final int did;
|
|
|
|
if (user_id != 0) {
|
|
|
|
did = user_id;
|
2017-12-08 18:35:59 +01:00
|
|
|
} else {
|
2019-01-23 18:03:33 +01:00
|
|
|
did = -chat_id;
|
|
|
|
}
|
2019-05-14 14:08:05 +02:00
|
|
|
final AlertDialog[] progressDialog = new AlertDialog[]{new AlertDialog(getParentActivity(), 3)};
|
2019-01-23 18:03:33 +01:00
|
|
|
TLRPC.TL_messages_getStatsURL req = new TLRPC.TL_messages_getStatsURL();
|
|
|
|
req.peer = MessagesController.getInstance(currentAccount).getInputPeer(did);
|
2019-05-14 14:08:05 +02:00
|
|
|
req.dark = Theme.getCurrentTheme().isDark();
|
2019-03-03 21:40:48 +01:00
|
|
|
req.params = "";
|
2019-01-23 18:03:33 +01:00
|
|
|
int requestId = ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> {
|
|
|
|
try {
|
|
|
|
progressDialog[0].dismiss();
|
|
|
|
} catch (Throwable ignore) {
|
|
|
|
|
|
|
|
}
|
|
|
|
progressDialog[0] = null;
|
|
|
|
if (response != null) {
|
|
|
|
TLRPC.TL_statsURL url = (TLRPC.TL_statsURL) response;
|
2019-03-03 21:40:48 +01:00
|
|
|
presentFragment(new WebviewActivity(url.url, -chat_id));
|
2019-01-23 18:03:33 +01:00
|
|
|
}
|
|
|
|
}));
|
|
|
|
if (progressDialog[0] == null) {
|
|
|
|
return;
|
2017-12-08 18:35:59 +01:00
|
|
|
}
|
2019-01-23 18:03:33 +01:00
|
|
|
progressDialog[0].setOnCancelListener(dialog -> ConnectionsManager.getInstance(currentAccount).cancelRequest(requestId, true));
|
|
|
|
showDialog(progressDialog[0]);
|
2015-04-09 20:00:14 +02:00
|
|
|
}
|
2014-11-17 03:44:57 +01:00
|
|
|
}
|
2015-04-09 20:00:14 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
createActionBarMenu();
|
|
|
|
|
|
|
|
listAdapter = new ListAdapter(context);
|
2015-11-26 22:04:02 +01:00
|
|
|
avatarDrawable = new AvatarDrawable();
|
|
|
|
avatarDrawable.setProfile(true);
|
2015-04-09 20:00:14 +02:00
|
|
|
|
2015-11-26 22:04:02 +01:00
|
|
|
fragmentView = new FrameLayout(context) {
|
|
|
|
@Override
|
|
|
|
public boolean hasOverlappingRendering() {
|
|
|
|
return false;
|
|
|
|
}
|
2016-04-22 15:49:00 +02:00
|
|
|
|
|
|
|
@Override
|
|
|
|
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
|
|
|
|
super.onLayout(changed, left, top, right, bottom);
|
|
|
|
checkListViewScroll();
|
|
|
|
}
|
2015-11-26 22:04:02 +01:00
|
|
|
};
|
2015-04-09 20:00:14 +02:00
|
|
|
FrameLayout frameLayout = (FrameLayout) fragmentView;
|
|
|
|
|
2015-10-29 18:10:07 +01:00
|
|
|
listView = new RecyclerListView(context) {
|
2019-01-23 18:03:33 +01:00
|
|
|
|
|
|
|
private Paint paint = new Paint();
|
|
|
|
|
2015-04-09 20:00:14 +02:00
|
|
|
@Override
|
2015-10-29 18:10:07 +01:00
|
|
|
public boolean hasOverlappingRendering() {
|
|
|
|
return false;
|
2015-04-09 20:00:14 +02:00
|
|
|
}
|
2019-01-23 18:03:33 +01:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onDraw(Canvas c) {
|
|
|
|
ViewHolder holder;
|
|
|
|
if (lastSectionRow != -1) {
|
|
|
|
holder = findViewHolderForAdapterPosition(lastSectionRow);
|
|
|
|
} else if (sharedSectionRow != -1 && (membersSectionRow == -1 || membersSectionRow < sharedSectionRow)) {
|
|
|
|
holder = findViewHolderForAdapterPosition(sharedSectionRow);
|
|
|
|
} else if (membersSectionRow != -1 && (sharedSectionRow == -1 || membersSectionRow > sharedSectionRow)) {
|
|
|
|
holder = findViewHolderForAdapterPosition(membersSectionRow);
|
2019-07-18 15:01:39 +02:00
|
|
|
} else if (settingsSectionRow != -1) {
|
|
|
|
holder = findViewHolderForAdapterPosition(settingsSectionRow);
|
2019-01-23 18:03:33 +01:00
|
|
|
} else if (infoSectionRow != -1) {
|
|
|
|
holder = findViewHolderForAdapterPosition(infoSectionRow);
|
|
|
|
} else {
|
|
|
|
holder = null;
|
|
|
|
}
|
|
|
|
int bottom;
|
|
|
|
int height = getMeasuredHeight();
|
|
|
|
if (holder != null) {
|
|
|
|
bottom = holder.itemView.getBottom();
|
|
|
|
if (holder.itemView.getBottom() >= height) {
|
|
|
|
bottom = height;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
bottom = height;
|
|
|
|
}
|
|
|
|
|
|
|
|
paint.setColor(Theme.getColor(Theme.key_windowBackgroundWhite));
|
|
|
|
c.drawRect(0, 0, getMeasuredWidth(), bottom, paint);
|
|
|
|
if (bottom != height) {
|
|
|
|
paint.setColor(Theme.getColor(Theme.key_windowBackgroundGray));
|
|
|
|
c.drawRect(0, bottom, getMeasuredWidth(), height, paint);
|
|
|
|
}
|
|
|
|
}
|
2015-10-29 18:10:07 +01:00
|
|
|
};
|
2015-04-09 20:00:14 +02:00
|
|
|
listView.setVerticalScrollBarEnabled(false);
|
2015-10-29 18:10:07 +01:00
|
|
|
listView.setItemAnimator(null);
|
|
|
|
listView.setLayoutAnimation(null);
|
2016-04-22 15:49:00 +02:00
|
|
|
listView.setClipToPadding(false);
|
2015-10-29 18:10:07 +01:00
|
|
|
layoutManager = new LinearLayoutManager(context) {
|
|
|
|
@Override
|
|
|
|
public boolean supportsPredictiveItemAnimations() {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
|
|
|
|
listView.setLayoutManager(layoutManager);
|
2018-07-30 04:07:02 +02:00
|
|
|
listView.setGlowColor(AvatarDrawable.getProfileBackColorForId(user_id != 0 || ChatObject.isChannel(chat_id, currentAccount) && !currentChat.megagroup ? 5 : chat_id));
|
2015-10-29 18:10:07 +01:00
|
|
|
frameLayout.addView(listView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.TOP | Gravity.LEFT));
|
2015-04-09 20:00:14 +02:00
|
|
|
|
|
|
|
listView.setAdapter(listAdapter);
|
2019-01-23 18:03:33 +01:00
|
|
|
listView.setOnItemClickListener((view, position, x, y) -> {
|
2018-08-27 10:33:11 +02:00
|
|
|
if (getParentActivity() == null) {
|
|
|
|
return;
|
|
|
|
}
|
2019-01-23 18:03:33 +01:00
|
|
|
if (position == photosRow || position == filesRow || position == linksRow || position == audioRow || position == voiceRow) {
|
|
|
|
int tab;
|
|
|
|
if (position == photosRow) {
|
2019-07-18 15:01:39 +02:00
|
|
|
tab = MediaDataController.MEDIA_PHOTOVIDEO;
|
2019-01-23 18:03:33 +01:00
|
|
|
} else if (position == filesRow) {
|
2019-07-18 15:01:39 +02:00
|
|
|
tab = MediaDataController.MEDIA_FILE;
|
2019-01-23 18:03:33 +01:00
|
|
|
} else if (position == linksRow) {
|
2019-07-18 15:01:39 +02:00
|
|
|
tab = MediaDataController.MEDIA_URL;
|
2019-01-23 18:03:33 +01:00
|
|
|
} else if (position == audioRow) {
|
2019-07-18 15:01:39 +02:00
|
|
|
tab = MediaDataController.MEDIA_MUSIC;
|
2019-01-23 18:03:33 +01:00
|
|
|
} else {
|
2019-07-18 15:01:39 +02:00
|
|
|
tab = MediaDataController.MEDIA_AUDIO;
|
2019-01-23 18:03:33 +01:00
|
|
|
}
|
2018-08-27 10:33:11 +02:00
|
|
|
Bundle args = new Bundle();
|
|
|
|
if (user_id != 0) {
|
|
|
|
args.putLong("dialog_id", dialog_id != 0 ? dialog_id : user_id);
|
|
|
|
} else {
|
|
|
|
args.putLong("dialog_id", -chat_id);
|
|
|
|
}
|
2019-07-18 15:01:39 +02:00
|
|
|
int[] media = new int[MediaDataController.MEDIA_TYPES_COUNT];
|
2019-01-23 18:03:33 +01:00
|
|
|
System.arraycopy(lastMediaCount, 0, media, 0, media.length);
|
2019-06-04 12:14:50 +02:00
|
|
|
mediaActivity = new MediaActivity(args, media, sharedMediaData, tab);
|
|
|
|
mediaActivity.setChatInfo(chatInfo);
|
|
|
|
presentFragment(mediaActivity);
|
2018-08-27 10:33:11 +02:00
|
|
|
} else if (position == groupsInCommonRow) {
|
|
|
|
presentFragment(new CommonGroupsActivity(user_id));
|
|
|
|
} else if (position == settingsKeyRow) {
|
|
|
|
Bundle args = new Bundle();
|
|
|
|
args.putInt("chat_id", (int) (dialog_id >> 32));
|
|
|
|
presentFragment(new IdenticonActivity(args));
|
|
|
|
} else if (position == settingsTimerRow) {
|
|
|
|
showDialog(AlertsCreator.createTTLAlert(getParentActivity(), currentEncryptedChat).create());
|
2019-01-23 18:03:33 +01:00
|
|
|
} else if (position == notificationsRow) {
|
2018-08-27 10:33:11 +02:00
|
|
|
final long did;
|
|
|
|
if (dialog_id != 0) {
|
|
|
|
did = dialog_id;
|
|
|
|
} else if (user_id != 0) {
|
|
|
|
did = user_id;
|
|
|
|
} else {
|
|
|
|
did = -chat_id;
|
|
|
|
}
|
2019-01-23 18:03:33 +01:00
|
|
|
|
|
|
|
if (LocaleController.isRTL && x <= AndroidUtilities.dp(76) || !LocaleController.isRTL && x >= view.getMeasuredWidth() - AndroidUtilities.dp(76)) {
|
|
|
|
NotificationsCheckCell checkCell = (NotificationsCheckCell) view;
|
|
|
|
boolean checked = !checkCell.isChecked();
|
|
|
|
|
|
|
|
boolean defaultEnabled = NotificationsController.getInstance(currentAccount).isGlobalNotificationsEnabled(did);
|
|
|
|
|
|
|
|
if (checked) {
|
|
|
|
SharedPreferences preferences = MessagesController.getNotificationsSettings(currentAccount);
|
|
|
|
SharedPreferences.Editor editor = preferences.edit();
|
|
|
|
if (defaultEnabled) {
|
|
|
|
editor.remove("notify2_" + did);
|
|
|
|
} else {
|
|
|
|
editor.putInt("notify2_" + did, 0);
|
|
|
|
}
|
|
|
|
MessagesStorage.getInstance(currentAccount).setDialogFlags(did, 0);
|
|
|
|
editor.commit();
|
2019-05-14 14:08:05 +02:00
|
|
|
TLRPC.Dialog dialog = MessagesController.getInstance(currentAccount).dialogs_dict.get(did);
|
2019-01-23 18:03:33 +01:00
|
|
|
if (dialog != null) {
|
|
|
|
dialog.notify_settings = new TLRPC.TL_peerNotifySettings();
|
|
|
|
}
|
|
|
|
NotificationsController.getInstance(currentAccount).updateServerNotificationsSettings(did);
|
|
|
|
} else {
|
|
|
|
int untilTime = Integer.MAX_VALUE;
|
|
|
|
SharedPreferences preferences = MessagesController.getNotificationsSettings(currentAccount);
|
|
|
|
SharedPreferences.Editor editor = preferences.edit();
|
|
|
|
long flags;
|
|
|
|
if (!defaultEnabled) {
|
|
|
|
editor.remove("notify2_" + did);
|
|
|
|
flags = 0;
|
|
|
|
} else {
|
|
|
|
editor.putInt("notify2_" + did, 2);
|
|
|
|
flags = 1;
|
|
|
|
}
|
|
|
|
NotificationsController.getInstance(currentAccount).removeNotificationsForDialog(did);
|
|
|
|
MessagesStorage.getInstance(currentAccount).setDialogFlags(did, flags);
|
|
|
|
editor.commit();
|
2019-05-14 14:08:05 +02:00
|
|
|
TLRPC.Dialog dialog = MessagesController.getInstance(currentAccount).dialogs_dict.get(did);
|
2019-01-23 18:03:33 +01:00
|
|
|
if (dialog != null) {
|
|
|
|
dialog.notify_settings = new TLRPC.TL_peerNotifySettings();
|
|
|
|
if (defaultEnabled) {
|
|
|
|
dialog.notify_settings.mute_until = untilTime;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
NotificationsController.getInstance(currentAccount).updateServerNotificationsSettings(did);
|
|
|
|
}
|
|
|
|
checkCell.setChecked(checked);
|
|
|
|
RecyclerListView.Holder holder = (RecyclerListView.Holder) listView.findViewHolderForPosition(notificationsRow);
|
|
|
|
if (holder != null) {
|
|
|
|
listAdapter.onBindViewHolder(holder, notificationsRow);
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
AlertsCreator.showCustomNotificationsDialog(ProfileActivity.this, did, -1, null, currentAccount, param -> listAdapter.notifyItemChanged(notificationsRow));
|
2018-08-27 10:33:11 +02:00
|
|
|
} else if (position == startSecretChatRow) {
|
|
|
|
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
|
2019-06-04 12:14:50 +02:00
|
|
|
builder.setTitle(LocaleController.getString("AreYouSureSecretChatTitle", R.string.AreYouSureSecretChatTitle));
|
2018-08-27 10:33:11 +02:00
|
|
|
builder.setMessage(LocaleController.getString("AreYouSureSecretChat", R.string.AreYouSureSecretChat));
|
2019-06-04 12:14:50 +02:00
|
|
|
builder.setPositiveButton(LocaleController.getString("Start", R.string.Start), (dialogInterface, i) -> {
|
2018-08-27 10:33:11 +02:00
|
|
|
creatingChat = true;
|
|
|
|
SecretChatHelper.getInstance(currentAccount).startSecretChat(getParentActivity(), MessagesController.getInstance(currentAccount).getUser(user_id));
|
|
|
|
});
|
|
|
|
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
|
|
|
|
showDialog(builder.create());
|
2019-06-04 12:14:50 +02:00
|
|
|
} else if (position == unblockRow) {
|
|
|
|
MessagesController.getInstance(currentAccount).unblockUser(user_id);
|
|
|
|
AlertsCreator.showSimpleToast(ProfileActivity.this, LocaleController.getString("UserUnblocked", R.string.UserUnblocked));
|
2019-01-23 18:03:33 +01:00
|
|
|
} else if (position >= membersStartRow && position < membersEndRow) {
|
2018-08-27 10:33:11 +02:00
|
|
|
int user_id;
|
|
|
|
if (!sortedUsers.isEmpty()) {
|
2019-01-23 18:03:33 +01:00
|
|
|
user_id = chatInfo.participants.participants.get(sortedUsers.get(position - membersStartRow)).user_id;
|
2018-08-27 10:33:11 +02:00
|
|
|
} else {
|
2019-01-23 18:03:33 +01:00
|
|
|
user_id = chatInfo.participants.participants.get(position - membersStartRow).user_id;
|
2018-08-27 10:33:11 +02:00
|
|
|
}
|
|
|
|
if (user_id == UserConfig.getInstance(currentAccount).getClientUserId()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
Bundle args = new Bundle();
|
|
|
|
args.putInt("user_id", user_id);
|
|
|
|
presentFragment(new ProfileActivity(args));
|
|
|
|
} else if (position == addMemberRow) {
|
|
|
|
openAddMember();
|
2019-01-23 18:03:33 +01:00
|
|
|
} else if (position == usernameRow) {
|
|
|
|
if (currentChat != null) {
|
|
|
|
try {
|
|
|
|
Intent intent = new Intent(Intent.ACTION_SEND);
|
|
|
|
intent.setType("text/plain");
|
|
|
|
if (!TextUtils.isEmpty(chatInfo.about)) {
|
|
|
|
intent.putExtra(Intent.EXTRA_TEXT, currentChat.title + "\n" + chatInfo.about + "\nhttps://" + MessagesController.getInstance(currentAccount).linkPrefix + "/" + currentChat.username);
|
|
|
|
} else {
|
|
|
|
intent.putExtra(Intent.EXTRA_TEXT, currentChat.title + "\nhttps://" + MessagesController.getInstance(currentAccount).linkPrefix + "/" + currentChat.username);
|
|
|
|
}
|
|
|
|
getParentActivity().startActivityForResult(Intent.createChooser(intent, LocaleController.getString("BotShare", R.string.BotShare)), 500);
|
|
|
|
} catch (Exception e) {
|
|
|
|
FileLog.e(e);
|
2015-09-24 22:52:02 +02:00
|
|
|
}
|
2015-04-09 20:00:14 +02:00
|
|
|
}
|
2019-07-18 15:01:39 +02:00
|
|
|
} else if (position == locationRow) {
|
|
|
|
if (chatInfo.location instanceof TLRPC.TL_channelLocation) {
|
|
|
|
LocationActivity fragment = new LocationActivity(LocationActivity.LOCATION_TYPE_GROUP_VIEW);
|
|
|
|
fragment.setChatLocation(chat_id, (TLRPC.TL_channelLocation) chatInfo.location);
|
|
|
|
presentFragment(fragment);
|
|
|
|
}
|
2018-08-27 10:33:11 +02:00
|
|
|
} else if (position == leaveChannelRow) {
|
|
|
|
leaveChatPressed();
|
2019-01-23 18:03:33 +01:00
|
|
|
} else if (position == joinRow) {
|
|
|
|
MessagesController.getInstance(currentAccount).addUserToChat(currentChat.id, UserConfig.getInstance(currentAccount).getCurrentUser(), null, 0, null, ProfileActivity.this, null);
|
|
|
|
NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.closeSearchByActiveAction);
|
|
|
|
} else if (position == subscribersRow) {
|
2018-08-27 10:33:11 +02:00
|
|
|
Bundle args = new Bundle();
|
|
|
|
args.putInt("chat_id", chat_id);
|
2019-01-23 18:03:33 +01:00
|
|
|
args.putInt("type", ChatUsersActivity.TYPE_USERS);
|
|
|
|
ChatUsersActivity fragment = new ChatUsersActivity(args);
|
|
|
|
fragment.setInfo(chatInfo);
|
|
|
|
presentFragment(fragment);
|
|
|
|
} else if (position == administratorsRow) {
|
|
|
|
Bundle args = new Bundle();
|
|
|
|
args.putInt("chat_id", chat_id);
|
|
|
|
args.putInt("type", ChatUsersActivity.TYPE_ADMIN);
|
|
|
|
ChatUsersActivity fragment = new ChatUsersActivity(args);
|
|
|
|
fragment.setInfo(chatInfo);
|
|
|
|
presentFragment(fragment);
|
|
|
|
} else if (position == blockedUsersRow) {
|
|
|
|
Bundle args = new Bundle();
|
|
|
|
args.putInt("chat_id", chat_id);
|
|
|
|
args.putInt("type", ChatUsersActivity.TYPE_BANNED);
|
|
|
|
ChatUsersActivity fragment = new ChatUsersActivity(args);
|
|
|
|
fragment.setInfo(chatInfo);
|
|
|
|
presentFragment(fragment);
|
2018-08-27 10:33:11 +02:00
|
|
|
} else {
|
|
|
|
processOnClickOrPress(position);
|
2015-04-09 20:00:14 +02:00
|
|
|
}
|
|
|
|
});
|
2015-10-29 18:10:07 +01:00
|
|
|
|
2018-08-27 10:33:11 +02:00
|
|
|
listView.setOnItemLongClickListener((view, position) -> {
|
2019-01-23 18:03:33 +01:00
|
|
|
if (position >= membersStartRow && position < membersEndRow) {
|
2018-08-27 10:33:11 +02:00
|
|
|
if (getParentActivity() == null) {
|
|
|
|
return false;
|
|
|
|
}
|
2019-01-23 18:03:33 +01:00
|
|
|
final TLRPC.ChatParticipant participant;
|
2018-08-27 10:33:11 +02:00
|
|
|
if (!sortedUsers.isEmpty()) {
|
2019-01-23 18:03:33 +01:00
|
|
|
participant = chatInfo.participants.participants.get(sortedUsers.get(position - membersStartRow));
|
2018-08-27 10:33:11 +02:00
|
|
|
} else {
|
2019-01-23 18:03:33 +01:00
|
|
|
participant = chatInfo.participants.participants.get(position - membersStartRow);
|
|
|
|
}
|
|
|
|
TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(participant.user_id);
|
|
|
|
if (user == null || participant.user_id == UserConfig.getInstance(currentAccount).getClientUserId()) {
|
|
|
|
return false;
|
2018-08-27 10:33:11 +02:00
|
|
|
}
|
2019-01-23 18:03:33 +01:00
|
|
|
selectedUser = participant.user_id;
|
|
|
|
boolean allowKick;
|
|
|
|
boolean canEditAdmin;
|
|
|
|
boolean canRestrict;
|
|
|
|
boolean editingAdmin;
|
|
|
|
final TLRPC.ChannelParticipant channelParticipant;
|
2016-03-16 13:26:32 +01:00
|
|
|
|
2018-08-27 10:33:11 +02:00
|
|
|
if (ChatObject.isChannel(currentChat)) {
|
2019-01-23 18:03:33 +01:00
|
|
|
channelParticipant = ((TLRPC.TL_chatChannelParticipant) participant).channelParticipant;
|
|
|
|
TLRPC.User u = MessagesController.getInstance(currentAccount).getUser(participant.user_id);
|
|
|
|
canEditAdmin = ChatObject.canAddAdmins(currentChat);
|
2019-07-18 15:01:39 +02:00
|
|
|
if (canEditAdmin && (channelParticipant instanceof TLRPC.TL_channelParticipantCreator || channelParticipant instanceof TLRPC.TL_channelParticipantAdmin && !channelParticipant.can_edit)) {
|
|
|
|
canEditAdmin = false;
|
|
|
|
}
|
2019-01-23 18:03:33 +01:00
|
|
|
allowKick = canRestrict = ChatObject.canBlockUsers(currentChat) && (!(channelParticipant instanceof TLRPC.TL_channelParticipantAdmin || channelParticipant instanceof TLRPC.TL_channelParticipantCreator) || channelParticipant.can_edit);
|
|
|
|
editingAdmin = channelParticipant instanceof TLRPC.TL_channelParticipantAdmin;
|
2018-08-27 10:33:11 +02:00
|
|
|
} else {
|
|
|
|
channelParticipant = null;
|
2019-01-23 18:03:33 +01:00
|
|
|
allowKick = currentChat.creator || participant instanceof TLRPC.TL_chatParticipant && (ChatObject.canBlockUsers(currentChat) || participant.inviter_id == UserConfig.getInstance(currentAccount).getClientUserId());
|
|
|
|
canEditAdmin = currentChat.creator;
|
|
|
|
canRestrict = currentChat.creator;
|
|
|
|
editingAdmin = participant instanceof TLRPC.TL_chatParticipantAdmin;
|
2018-08-27 10:33:11 +02:00
|
|
|
}
|
2017-07-08 18:32:04 +02:00
|
|
|
|
2018-08-27 10:33:11 +02:00
|
|
|
ArrayList<String> items = new ArrayList<>();
|
2019-01-23 18:03:33 +01:00
|
|
|
ArrayList<Integer> icons = new ArrayList<>();
|
2018-08-27 10:33:11 +02:00
|
|
|
final ArrayList<Integer> actions = new ArrayList<>();
|
2019-01-23 18:03:33 +01:00
|
|
|
boolean hasRemove = false;
|
|
|
|
|
|
|
|
if (canEditAdmin) {
|
|
|
|
items.add(editingAdmin ? LocaleController.getString("EditAdminRights", R.string.EditAdminRights) : LocaleController.getString("SetAsAdmin", R.string.SetAsAdmin));
|
|
|
|
icons.add(R.drawable.actions_addadmin);
|
|
|
|
actions.add(0);
|
|
|
|
}
|
|
|
|
if (canRestrict) {
|
|
|
|
items.add(LocaleController.getString("ChangePermissions", R.string.ChangePermissions));
|
|
|
|
icons.add(R.drawable.actions_permissions);
|
|
|
|
actions.add(1);
|
|
|
|
}
|
|
|
|
if (allowKick) {
|
|
|
|
items.add(LocaleController.getString("KickFromGroup", R.string.KickFromGroup));
|
|
|
|
icons.add(R.drawable.actions_remove_user);
|
2018-08-27 10:33:11 +02:00
|
|
|
actions.add(2);
|
2019-01-23 18:03:33 +01:00
|
|
|
hasRemove = true;
|
2018-08-27 10:33:11 +02:00
|
|
|
}
|
2019-01-23 18:03:33 +01:00
|
|
|
|
2018-08-27 10:33:11 +02:00
|
|
|
if (items.isEmpty()) {
|
|
|
|
return false;
|
|
|
|
}
|
2019-01-23 18:03:33 +01:00
|
|
|
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
|
|
|
|
builder.setItems(items.toArray(new CharSequence[0]), AndroidUtilities.toIntArray(icons), (dialogInterface, i) -> {
|
2018-08-27 10:33:11 +02:00
|
|
|
if (actions.get(i) == 2) {
|
|
|
|
kickUser(selectedUser);
|
|
|
|
} else {
|
2019-01-23 18:03:33 +01:00
|
|
|
int action = actions.get(i);
|
|
|
|
if (action == 1 && (channelParticipant instanceof TLRPC.TL_channelParticipantAdmin || participant instanceof TLRPC.TL_chatParticipantAdmin)) {
|
|
|
|
AlertDialog.Builder builder2 = new AlertDialog.Builder(getParentActivity());
|
|
|
|
builder2.setTitle(LocaleController.getString("AppName", R.string.AppName));
|
|
|
|
builder2.setMessage(LocaleController.formatString("AdminWillBeRemoved", R.string.AdminWillBeRemoved, ContactsController.formatName(user.first_name, user.last_name)));
|
2019-08-22 01:53:26 +02:00
|
|
|
builder2.setPositiveButton(LocaleController.getString("OK", R.string.OK), (dialog, which) -> {
|
|
|
|
if (channelParticipant != null) {
|
|
|
|
openRightsEdit(action, user.id, participant, channelParticipant.admin_rights, channelParticipant.banned_rights, channelParticipant.rank);
|
|
|
|
} else {
|
|
|
|
openRightsEdit(action, user.id, participant, null, null, "");
|
|
|
|
}
|
|
|
|
});
|
2019-01-23 18:03:33 +01:00
|
|
|
builder2.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
|
|
|
|
showDialog(builder2.create());
|
|
|
|
} else {
|
2019-08-22 01:53:26 +02:00
|
|
|
if (channelParticipant != null) {
|
|
|
|
openRightsEdit(action, user.id, participant, channelParticipant.admin_rights, channelParticipant.banned_rights, channelParticipant.rank);
|
|
|
|
} else {
|
|
|
|
openRightsEdit(action, user.id, participant, null, null, "");
|
|
|
|
}
|
2019-01-23 18:03:33 +01:00
|
|
|
}
|
2018-08-27 10:33:11 +02:00
|
|
|
}
|
|
|
|
});
|
2019-01-23 18:03:33 +01:00
|
|
|
AlertDialog alertDialog = builder.create();
|
|
|
|
showDialog(alertDialog);
|
|
|
|
if (hasRemove) {
|
|
|
|
alertDialog.setItemColor(items.size() - 1, Theme.getColor(Theme.key_dialogTextRed2), Theme.getColor(Theme.key_dialogRedIcon));
|
|
|
|
}
|
2018-08-27 10:33:11 +02:00
|
|
|
return true;
|
|
|
|
} else {
|
|
|
|
return processOnClickOrPress(position);
|
2016-04-22 15:49:00 +02:00
|
|
|
}
|
|
|
|
});
|
2014-11-10 12:05:22 +01:00
|
|
|
|
2017-07-08 18:32:04 +02:00
|
|
|
if (banFromGroup != 0) {
|
2019-01-23 18:03:33 +01:00
|
|
|
TLRPC.Chat chat = MessagesController.getInstance(currentAccount).getChat(banFromGroup);
|
2017-07-08 18:32:04 +02:00
|
|
|
if (currentChannelParticipant == null) {
|
|
|
|
TLRPC.TL_channels_getParticipant req = new TLRPC.TL_channels_getParticipant();
|
2019-01-23 18:03:33 +01:00
|
|
|
req.channel = MessagesController.getInputChannel(chat);
|
2018-07-30 04:07:02 +02:00
|
|
|
req.user_id = MessagesController.getInstance(currentAccount).getInputUser(user_id);
|
2018-08-27 10:33:11 +02:00
|
|
|
ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> {
|
|
|
|
if (response != null) {
|
|
|
|
AndroidUtilities.runOnUIThread(() -> currentChannelParticipant = ((TLRPC.TL_channels_channelParticipant) response).participant);
|
2017-07-08 18:32:04 +02:00
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
FrameLayout frameLayout1 = new FrameLayout(context) {
|
|
|
|
@Override
|
|
|
|
protected void onDraw(Canvas canvas) {
|
|
|
|
int bottom = Theme.chat_composeShadowDrawable.getIntrinsicHeight();
|
|
|
|
Theme.chat_composeShadowDrawable.setBounds(0, 0, getMeasuredWidth(), bottom);
|
|
|
|
Theme.chat_composeShadowDrawable.draw(canvas);
|
|
|
|
canvas.drawRect(0, bottom, getMeasuredWidth(), getMeasuredHeight(), Theme.chat_composeBackgroundPaint);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
frameLayout1.setWillNotDraw(false);
|
|
|
|
|
|
|
|
frameLayout.addView(frameLayout1, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 51, Gravity.LEFT | Gravity.BOTTOM));
|
2018-08-27 10:33:11 +02:00
|
|
|
frameLayout1.setOnClickListener(v -> {
|
2019-08-22 01:53:26 +02:00
|
|
|
ChatRightsEditActivity fragment = new ChatRightsEditActivity(user_id, banFromGroup, null, chat.default_banned_rights, currentChannelParticipant != null ? currentChannelParticipant.banned_rights : null, "", ChatRightsEditActivity.TYPE_BANNED, true, false);
|
2019-07-18 15:01:39 +02:00
|
|
|
fragment.setDelegate(new ChatRightsEditActivity.ChatRightsEditActivityDelegate() {
|
|
|
|
@Override
|
2019-08-22 01:53:26 +02:00
|
|
|
public void didSetRights(int rights, TLRPC.TL_chatAdminRights rightsAdmin, TLRPC.TL_chatBannedRights rightsBanned, String rank) {
|
2019-07-18 15:01:39 +02:00
|
|
|
removeSelfFromStack();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void didChangeOwner(TLRPC.User user) {
|
|
|
|
undoView.showWithAction(-chat_id, currentChat.megagroup ? UndoView.ACTION_OWNER_TRANSFERED_GROUP : UndoView.ACTION_OWNER_TRANSFERED_CHANNEL, user);
|
|
|
|
}
|
|
|
|
});
|
2018-08-27 10:33:11 +02:00
|
|
|
presentFragment(fragment);
|
2017-07-08 18:32:04 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
TextView textView = new TextView(context);
|
|
|
|
textView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteRedText));
|
|
|
|
textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 15);
|
|
|
|
textView.setGravity(Gravity.CENTER);
|
|
|
|
textView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
|
|
|
|
textView.setText(LocaleController.getString("BanFromTheGroup", R.string.BanFromTheGroup));
|
|
|
|
frameLayout1.addView(textView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER, 0, 1, 0, 0));
|
|
|
|
|
|
|
|
listView.setPadding(0, AndroidUtilities.dp(88), 0, AndroidUtilities.dp(48));
|
|
|
|
listView.setBottomGlowOffset(AndroidUtilities.dp(48));
|
|
|
|
} else {
|
|
|
|
listView.setPadding(0, AndroidUtilities.dp(88), 0, 0);
|
|
|
|
}
|
|
|
|
|
2016-04-22 15:49:00 +02:00
|
|
|
topView = new TopView(context);
|
2018-07-30 04:07:02 +02:00
|
|
|
topView.setBackgroundColor(AvatarDrawable.getProfileBackColorForId(user_id != 0 || ChatObject.isChannel(chat_id, currentAccount) && !currentChat.megagroup ? 5 : chat_id));
|
2016-04-22 15:49:00 +02:00
|
|
|
frameLayout.addView(topView);
|
2015-10-29 18:10:07 +01:00
|
|
|
|
2016-04-22 15:49:00 +02:00
|
|
|
frameLayout.addView(actionBar);
|
2015-10-29 18:10:07 +01:00
|
|
|
|
|
|
|
avatarImage = new BackupImageView(context);
|
|
|
|
avatarImage.setRoundRadius(AndroidUtilities.dp(21));
|
2016-06-24 12:27:15 +02:00
|
|
|
avatarImage.setPivotX(0);
|
|
|
|
avatarImage.setPivotY(0);
|
2015-10-29 18:10:07 +01:00
|
|
|
frameLayout.addView(avatarImage, LayoutHelper.createFrame(42, 42, Gravity.TOP | Gravity.LEFT, 64, 0, 0, 0));
|
2018-08-27 10:33:11 +02:00
|
|
|
avatarImage.setOnClickListener(v -> {
|
|
|
|
if (user_id != 0) {
|
|
|
|
TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(user_id);
|
|
|
|
if (user.photo != null && user.photo.photo_big != null) {
|
|
|
|
PhotoViewer.getInstance().setParentActivity(getParentActivity());
|
2019-05-14 14:08:05 +02:00
|
|
|
if (user.photo.dc_id != 0) {
|
|
|
|
user.photo.photo_big.dc_id = user.photo.dc_id;
|
|
|
|
}
|
2018-08-27 10:33:11 +02:00
|
|
|
PhotoViewer.getInstance().openPhoto(user.photo.photo_big, provider);
|
|
|
|
}
|
|
|
|
} else if (chat_id != 0) {
|
|
|
|
TLRPC.Chat chat = MessagesController.getInstance(currentAccount).getChat(chat_id);
|
|
|
|
if (chat.photo != null && chat.photo.photo_big != null) {
|
|
|
|
PhotoViewer.getInstance().setParentActivity(getParentActivity());
|
2019-05-14 14:08:05 +02:00
|
|
|
if (chat.photo.dc_id != 0) {
|
|
|
|
chat.photo.photo_big.dc_id = chat.photo.dc_id;
|
|
|
|
}
|
2018-08-27 10:33:11 +02:00
|
|
|
PhotoViewer.getInstance().openPhoto(chat.photo.photo_big, provider);
|
2015-10-29 18:10:07 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
2019-05-14 14:08:05 +02:00
|
|
|
avatarImage.setContentDescription(LocaleController.getString("AccDescrProfilePicture", R.string.AccDescrProfilePicture));
|
2015-10-29 18:10:07 +01:00
|
|
|
|
2015-11-26 22:04:02 +01:00
|
|
|
for (int a = 0; a < 2; a++) {
|
|
|
|
if (!playProfileAnimation && a == 0) {
|
|
|
|
continue;
|
|
|
|
}
|
2016-04-22 15:49:00 +02:00
|
|
|
nameTextView[a] = new SimpleTextView(context);
|
2017-03-31 01:58:05 +02:00
|
|
|
if (a == 1) {
|
|
|
|
nameTextView[a].setTextColor(Theme.getColor(Theme.key_profile_title));
|
|
|
|
} else {
|
|
|
|
nameTextView[a].setTextColor(Theme.getColor(Theme.key_actionBarDefaultTitle));
|
|
|
|
}
|
2016-04-22 15:49:00 +02:00
|
|
|
nameTextView[a].setTextSize(18);
|
2015-11-26 22:04:02 +01:00
|
|
|
nameTextView[a].setGravity(Gravity.LEFT);
|
|
|
|
nameTextView[a].setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
|
2016-04-22 15:49:00 +02:00
|
|
|
nameTextView[a].setLeftDrawableTopPadding(-AndroidUtilities.dp(1.3f));
|
2016-06-24 12:27:15 +02:00
|
|
|
nameTextView[a].setPivotX(0);
|
|
|
|
nameTextView[a].setPivotY(0);
|
2017-03-31 01:58:05 +02:00
|
|
|
nameTextView[a].setAlpha(a == 0 ? 0.0f : 1.0f);
|
2019-02-08 03:30:32 +01:00
|
|
|
if (a == 1) {
|
|
|
|
nameTextView[a].setScrollNonFitText(true);
|
|
|
|
nameTextView[a].setBackgroundColor(AvatarDrawable.getProfileBackColorForId(user_id != 0 || ChatObject.isChannel(chat_id, currentAccount) && !currentChat.megagroup ? 5 : chat_id));
|
|
|
|
}
|
2019-06-18 07:55:59 +02:00
|
|
|
nameTextView[a].setOnLongClickListener(new SimpleTextView.OnLongClickListener() {
|
|
|
|
public boolean onLongClick(View v) {
|
|
|
|
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
|
|
|
|
builder.setItems(new CharSequence[]{LocaleController.getString("Copy", R.string.Copy)}, (dialogInterface, i) -> {
|
|
|
|
if (i == 0) {
|
|
|
|
try {
|
|
|
|
android.content.ClipboardManager clipboard = (android.content.ClipboardManager) ApplicationLoader.applicationContext.getSystemService(Context.CLIPBOARD_SERVICE);
|
|
|
|
android.content.ClipData clip = android.content.ClipData.newPlainText("label", ((SimpleTextView) v).getText());
|
|
|
|
clipboard.setPrimaryClip(clip);
|
|
|
|
Toast.makeText(getParentActivity(), LocaleController.getString("TextCopied", R.string.TextCopied), Toast.LENGTH_SHORT).show();
|
|
|
|
} catch (Exception e) {
|
|
|
|
FileLog.e(e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
showDialog(builder.create());
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
});
|
2015-11-26 22:04:02 +01:00
|
|
|
frameLayout.addView(nameTextView[a], LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.TOP, 118, 0, a == 0 ? 48 : 0, 0));
|
|
|
|
|
2016-04-22 15:49:00 +02:00
|
|
|
onlineTextView[a] = new SimpleTextView(context);
|
2018-07-30 04:07:02 +02:00
|
|
|
onlineTextView[a].setTextColor(AvatarDrawable.getProfileTextColorForId(user_id != 0 || ChatObject.isChannel(chat_id, currentAccount) && !currentChat.megagroup ? 5 : chat_id));
|
2016-04-22 15:49:00 +02:00
|
|
|
onlineTextView[a].setTextSize(14);
|
2015-11-26 22:04:02 +01:00
|
|
|
onlineTextView[a].setGravity(Gravity.LEFT);
|
2017-03-31 01:58:05 +02:00
|
|
|
onlineTextView[a].setAlpha(a == 0 ? 0.0f : 1.0f);
|
2015-11-26 22:04:02 +01:00
|
|
|
frameLayout.addView(onlineTextView[a], LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.TOP, 118, 0, a == 0 ? 48 : 8, 0));
|
|
|
|
}
|
2015-10-29 18:10:07 +01:00
|
|
|
|
2019-06-18 07:55:59 +02:00
|
|
|
idTextView = new SimpleTextView(context);
|
|
|
|
idTextView.setTextColor(AvatarDrawable.getProfileTextColorForId(user_id != 0 || ChatObject.isChannel(chat_id, currentAccount) && !currentChat.megagroup ? 5 : chat_id));
|
|
|
|
idTextView.setTextSize(14);
|
|
|
|
idTextView.setGravity(Gravity.LEFT);
|
|
|
|
idTextView.setAlpha(1.0f);
|
|
|
|
frameLayout.addView(idTextView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.TOP, 118, 0, 48, 0));
|
|
|
|
|
2019-01-23 18:03:33 +01:00
|
|
|
if (user_id != 0) {
|
2015-04-09 20:00:14 +02:00
|
|
|
writeButton = new ImageView(context);
|
2017-03-31 01:58:05 +02:00
|
|
|
Drawable drawable = Theme.createSimpleSelectorCircleDrawable(AndroidUtilities.dp(56), Theme.getColor(Theme.key_profile_actionBackground), Theme.getColor(Theme.key_profile_actionPressedBackground));
|
|
|
|
if (Build.VERSION.SDK_INT < 21) {
|
|
|
|
Drawable shadowDrawable = context.getResources().getDrawable(R.drawable.floating_shadow_profile).mutate();
|
|
|
|
shadowDrawable.setColorFilter(new PorterDuffColorFilter(0xff000000, PorterDuff.Mode.MULTIPLY));
|
|
|
|
CombinedDrawable combinedDrawable = new CombinedDrawable(shadowDrawable, drawable, 0, 0);
|
|
|
|
combinedDrawable.setIconSize(AndroidUtilities.dp(56), AndroidUtilities.dp(56));
|
|
|
|
drawable = combinedDrawable;
|
|
|
|
}
|
|
|
|
writeButton.setBackgroundDrawable(drawable);
|
2019-01-23 18:03:33 +01:00
|
|
|
writeButton.setImageResource(R.drawable.profile_newmsg);
|
2019-05-14 14:08:05 +02:00
|
|
|
writeButton.setContentDescription(LocaleController.getString("AccDescrOpenChat", R.string.AccDescrOpenChat));
|
2017-03-31 01:58:05 +02:00
|
|
|
writeButton.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_profile_actionIcon), PorterDuff.Mode.MULTIPLY));
|
2019-01-23 18:03:33 +01:00
|
|
|
writeButton.setScaleType(ImageView.ScaleType.CENTER);
|
2015-04-09 20:00:14 +02:00
|
|
|
if (Build.VERSION.SDK_INT >= 21) {
|
|
|
|
StateListAnimator animator = new StateListAnimator();
|
2019-05-14 14:08:05 +02:00
|
|
|
animator.addState(new int[]{android.R.attr.state_pressed}, ObjectAnimator.ofFloat(writeButton, View.TRANSLATION_Z, AndroidUtilities.dp(2), AndroidUtilities.dp(4)).setDuration(200));
|
|
|
|
animator.addState(new int[]{}, ObjectAnimator.ofFloat(writeButton, View.TRANSLATION_Z, AndroidUtilities.dp(4), AndroidUtilities.dp(2)).setDuration(200));
|
2015-04-09 20:00:14 +02:00
|
|
|
writeButton.setStateListAnimator(animator);
|
|
|
|
writeButton.setOutlineProvider(new ViewOutlineProvider() {
|
2015-05-21 23:27:27 +02:00
|
|
|
@SuppressLint("NewApi")
|
2015-04-09 20:00:14 +02:00
|
|
|
@Override
|
|
|
|
public void getOutline(View view, Outline outline) {
|
|
|
|
outline.setOval(0, 0, AndroidUtilities.dp(56), AndroidUtilities.dp(56));
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2019-01-23 18:03:33 +01:00
|
|
|
frameLayout.addView(writeButton, LayoutHelper.createFrame(Build.VERSION.SDK_INT >= 21 ? 56 : 60, Build.VERSION.SDK_INT >= 21 ? 56 : 60, Gravity.RIGHT | Gravity.TOP, 0, 0, 16, 0));
|
2018-08-27 10:33:11 +02:00
|
|
|
writeButton.setOnClickListener(v -> {
|
2019-01-23 18:03:33 +01:00
|
|
|
if (playProfileAnimation && parentLayout.fragmentsStack.get(parentLayout.fragmentsStack.size() - 2) instanceof ChatActivity) {
|
|
|
|
finishFragment();
|
|
|
|
} else {
|
|
|
|
TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(user_id);
|
|
|
|
if (user == null || user instanceof TLRPC.TL_userEmpty) {
|
|
|
|
return;
|
2014-11-10 12:05:22 +01:00
|
|
|
}
|
2019-01-23 18:03:33 +01:00
|
|
|
Bundle args = new Bundle();
|
|
|
|
args.putInt("user_id", user_id);
|
|
|
|
if (!MessagesController.getInstance(currentAccount).checkCanOpenChat(args, ProfileActivity.this)) {
|
|
|
|
return;
|
2013-10-25 17:19:00 +02:00
|
|
|
}
|
2019-01-23 18:03:33 +01:00
|
|
|
NotificationCenter.getInstance(currentAccount).removeObserver(ProfileActivity.this, NotificationCenter.closeChats);
|
|
|
|
NotificationCenter.getInstance(currentAccount).postNotificationName(NotificationCenter.closeChats);
|
|
|
|
presentFragment(new ChatActivity(args), true);
|
2013-10-25 17:19:00 +02:00
|
|
|
}
|
|
|
|
});
|
2015-04-09 20:00:14 +02:00
|
|
|
}
|
2015-10-29 18:10:07 +01:00
|
|
|
needLayout();
|
2014-11-12 23:16:59 +01:00
|
|
|
|
2015-10-29 18:10:07 +01:00
|
|
|
listView.setOnScrollListener(new RecyclerView.OnScrollListener() {
|
2015-04-09 20:00:14 +02:00
|
|
|
@Override
|
2015-10-29 18:10:07 +01:00
|
|
|
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
|
2015-04-09 20:00:14 +02:00
|
|
|
checkListViewScroll();
|
2019-01-23 18:03:33 +01:00
|
|
|
if (participantsMap != null && !usersEndReached && layoutManager.findLastVisibleItemPosition() > membersEndRow - 8) {
|
2015-11-26 22:04:02 +01:00
|
|
|
getChannelParticipants(false);
|
|
|
|
}
|
2014-11-12 23:16:59 +01:00
|
|
|
}
|
2015-04-09 20:00:14 +02:00
|
|
|
});
|
2014-11-12 23:16:59 +01:00
|
|
|
|
2019-07-18 15:01:39 +02:00
|
|
|
undoView = new UndoView(context);
|
|
|
|
frameLayout.addView(undoView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.BOTTOM | Gravity.LEFT, 8, 0, 8, 8));
|
|
|
|
|
2013-10-25 17:19:00 +02:00
|
|
|
return fragmentView;
|
|
|
|
}
|
|
|
|
|
2019-08-22 01:53:26 +02:00
|
|
|
private void openRightsEdit(int action, int user_id, TLRPC.ChatParticipant participant, TLRPC.TL_chatAdminRights adminRights, TLRPC.TL_chatBannedRights bannedRights, String rank) {
|
|
|
|
ChatRightsEditActivity fragment = new ChatRightsEditActivity(user_id, chat_id, adminRights, currentChat.default_banned_rights, bannedRights, rank, action, true, false);
|
2019-07-18 15:01:39 +02:00
|
|
|
fragment.setDelegate(new ChatRightsEditActivity.ChatRightsEditActivityDelegate() {
|
|
|
|
@Override
|
2019-08-22 01:53:26 +02:00
|
|
|
public void didSetRights(int rights, TLRPC.TL_chatAdminRights rightsAdmin, TLRPC.TL_chatBannedRights rightsBanned, String rank) {
|
2019-07-18 15:01:39 +02:00
|
|
|
if (action == 0) {
|
|
|
|
if (participant instanceof TLRPC.TL_chatChannelParticipant) {
|
|
|
|
TLRPC.TL_chatChannelParticipant channelParticipant1 = ((TLRPC.TL_chatChannelParticipant) participant);
|
|
|
|
if (rights == 1) {
|
|
|
|
channelParticipant1.channelParticipant = new TLRPC.TL_channelParticipantAdmin();
|
2019-08-22 01:53:26 +02:00
|
|
|
channelParticipant1.channelParticipant.flags |= 4;
|
2019-07-18 15:01:39 +02:00
|
|
|
} else {
|
|
|
|
channelParticipant1.channelParticipant = new TLRPC.TL_channelParticipant();
|
|
|
|
}
|
|
|
|
channelParticipant1.channelParticipant.inviter_id = UserConfig.getInstance(currentAccount).getClientUserId();
|
|
|
|
channelParticipant1.channelParticipant.user_id = participant.user_id;
|
|
|
|
channelParticipant1.channelParticipant.date = participant.date;
|
|
|
|
channelParticipant1.channelParticipant.banned_rights = rightsBanned;
|
|
|
|
channelParticipant1.channelParticipant.admin_rights = rightsAdmin;
|
2019-08-22 01:53:26 +02:00
|
|
|
channelParticipant1.channelParticipant.rank = rank;
|
2019-07-18 15:01:39 +02:00
|
|
|
} else if (participant instanceof TLRPC.ChatParticipant) {
|
|
|
|
TLRPC.ChatParticipant newParticipant;
|
|
|
|
if (rights == 1) {
|
|
|
|
newParticipant = new TLRPC.TL_chatParticipantAdmin();
|
|
|
|
} else {
|
|
|
|
newParticipant = new TLRPC.TL_chatParticipant();
|
2019-01-23 18:03:33 +01:00
|
|
|
}
|
2019-07-18 15:01:39 +02:00
|
|
|
newParticipant.user_id = participant.user_id;
|
|
|
|
newParticipant.date = participant.date;
|
|
|
|
newParticipant.inviter_id = participant.inviter_id;
|
|
|
|
int index = chatInfo.participants.participants.indexOf(participant);
|
|
|
|
if (index >= 0) {
|
|
|
|
chatInfo.participants.participants.set(index, newParticipant);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (action == 1) {
|
|
|
|
if (rights == 0) {
|
|
|
|
if (currentChat.megagroup && chatInfo != null && chatInfo.participants != null) {
|
|
|
|
boolean changed = false;
|
2019-01-23 18:03:33 +01:00
|
|
|
for (int a = 0; a < chatInfo.participants.participants.size(); a++) {
|
2019-07-18 15:01:39 +02:00
|
|
|
TLRPC.ChannelParticipant p = ((TLRPC.TL_chatChannelParticipant) chatInfo.participants.participants.get(a)).channelParticipant;
|
2019-01-23 18:03:33 +01:00
|
|
|
if (p.user_id == participant.user_id) {
|
2019-07-18 15:01:39 +02:00
|
|
|
if (chatInfo != null) {
|
|
|
|
chatInfo.participants_count--;
|
|
|
|
}
|
2019-01-23 18:03:33 +01:00
|
|
|
chatInfo.participants.participants.remove(a);
|
|
|
|
changed = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2019-07-18 15:01:39 +02:00
|
|
|
if (chatInfo != null && chatInfo.participants != null) {
|
|
|
|
for (int a = 0; a < chatInfo.participants.participants.size(); a++) {
|
|
|
|
TLRPC.ChatParticipant p = chatInfo.participants.participants.get(a);
|
|
|
|
if (p.user_id == participant.user_id) {
|
|
|
|
chatInfo.participants.participants.remove(a);
|
|
|
|
changed = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (changed) {
|
|
|
|
updateOnlineCount();
|
|
|
|
updateRowsIds();
|
|
|
|
listAdapter.notifyDataSetChanged();
|
|
|
|
}
|
2019-01-23 18:03:33 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-07-18 15:01:39 +02:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public void didChangeOwner(TLRPC.User user) {
|
|
|
|
undoView.showWithAction(-chat_id, currentChat.megagroup ? UndoView.ACTION_OWNER_TRANSFERED_GROUP : UndoView.ACTION_OWNER_TRANSFERED_CHANNEL, user);
|
|
|
|
}
|
2019-01-23 18:03:33 +01:00
|
|
|
});
|
|
|
|
presentFragment(fragment);
|
|
|
|
}
|
|
|
|
|
2016-04-22 15:49:00 +02:00
|
|
|
private boolean processOnClickOrPress(final int position) {
|
2019-01-23 18:03:33 +01:00
|
|
|
if (position == usernameRow) {
|
2017-03-31 01:58:05 +02:00
|
|
|
final String username;
|
2019-01-23 18:03:33 +01:00
|
|
|
if (user_id != 0) {
|
2018-07-30 04:07:02 +02:00
|
|
|
final TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(user_id);
|
2017-03-31 01:58:05 +02:00
|
|
|
if (user == null || user.username == null) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
username = user.username;
|
2019-01-23 18:03:33 +01:00
|
|
|
} else if (chat_id != 0) {
|
2018-07-30 04:07:02 +02:00
|
|
|
final TLRPC.Chat chat = MessagesController.getInstance(currentAccount).getChat(chat_id);
|
2017-03-31 01:58:05 +02:00
|
|
|
if (chat == null || chat.username == null) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
username = chat.username;
|
2019-01-23 18:03:33 +01:00
|
|
|
} else {
|
|
|
|
return false;
|
2016-04-22 15:49:00 +02:00
|
|
|
}
|
|
|
|
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
|
2018-08-27 10:33:11 +02:00
|
|
|
builder.setItems(new CharSequence[]{LocaleController.getString("Copy", R.string.Copy)}, (dialogInterface, i) -> {
|
|
|
|
if (i == 0) {
|
|
|
|
try {
|
|
|
|
android.content.ClipboardManager clipboard = (android.content.ClipboardManager) ApplicationLoader.applicationContext.getSystemService(Context.CLIPBOARD_SERVICE);
|
|
|
|
android.content.ClipData clip = android.content.ClipData.newPlainText("label", "@" + username);
|
|
|
|
clipboard.setPrimaryClip(clip);
|
|
|
|
Toast.makeText(getParentActivity(), LocaleController.getString("TextCopied", R.string.TextCopied), Toast.LENGTH_SHORT).show();
|
|
|
|
} catch (Exception e) {
|
|
|
|
FileLog.e(e);
|
2016-04-22 15:49:00 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
showDialog(builder.create());
|
|
|
|
return true;
|
|
|
|
} else if (position == phoneRow) {
|
2018-07-30 04:07:02 +02:00
|
|
|
final TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(user_id);
|
2019-06-21 13:32:04 +02:00
|
|
|
if (user == null || user.phone == null || user.phone.length() == 0 || getParentActivity() == null
|
|
|
|
|| (NekoConfig.hidePhone && user.id == UserConfig.getInstance(currentAccount).getClientUserId())) {
|
2016-04-22 15:49:00 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
|
2017-03-31 01:58:05 +02:00
|
|
|
ArrayList<CharSequence> items = new ArrayList<>();
|
|
|
|
final ArrayList<Integer> actions = new ArrayList<>();
|
2019-01-23 18:03:33 +01:00
|
|
|
if (userInfo != null && userInfo.phone_calls_available) {
|
2017-03-31 01:58:05 +02:00
|
|
|
items.add(LocaleController.getString("CallViaTelegram", R.string.CallViaTelegram));
|
|
|
|
actions.add(2);
|
|
|
|
}
|
2019-01-23 18:03:33 +01:00
|
|
|
items.add(LocaleController.getString("Call", R.string.Call));
|
|
|
|
actions.add(0);
|
2017-03-31 01:58:05 +02:00
|
|
|
items.add(LocaleController.getString("Copy", R.string.Copy));
|
|
|
|
actions.add(1);
|
2019-01-23 18:03:33 +01:00
|
|
|
builder.setItems(items.toArray(new CharSequence[0]), (dialogInterface, i) -> {
|
2018-08-27 10:33:11 +02:00
|
|
|
i = actions.get(i);
|
|
|
|
if (i == 0) {
|
|
|
|
try {
|
|
|
|
Intent intent = new Intent(Intent.ACTION_DIAL, Uri.parse("tel:+" + user.phone));
|
|
|
|
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
|
|
|
getParentActivity().startActivityForResult(intent, 500);
|
|
|
|
} catch (Exception e) {
|
|
|
|
FileLog.e(e);
|
|
|
|
}
|
|
|
|
} else if (i == 1) {
|
|
|
|
try {
|
|
|
|
android.content.ClipboardManager clipboard = (android.content.ClipboardManager) ApplicationLoader.applicationContext.getSystemService(Context.CLIPBOARD_SERVICE);
|
|
|
|
android.content.ClipData clip = android.content.ClipData.newPlainText("label", "+" + user.phone);
|
|
|
|
clipboard.setPrimaryClip(clip);
|
|
|
|
Toast.makeText(getParentActivity(), LocaleController.getString("PhoneCopied", R.string.PhoneCopied), Toast.LENGTH_SHORT).show();
|
|
|
|
} catch (Exception e) {
|
|
|
|
FileLog.e(e);
|
2016-04-22 15:49:00 +02:00
|
|
|
}
|
2018-08-27 10:33:11 +02:00
|
|
|
} else if (i == 2) {
|
2019-01-23 18:03:33 +01:00
|
|
|
VoIPHelper.startCall(user, getParentActivity(), userInfo);
|
2016-04-22 15:49:00 +02:00
|
|
|
}
|
|
|
|
});
|
|
|
|
showDialog(builder.create());
|
|
|
|
return true;
|
2019-07-18 15:01:39 +02:00
|
|
|
} else if (position == channelInfoRow || position == userInfoRow || position == locationRow) {
|
2016-04-22 15:49:00 +02:00
|
|
|
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
|
2018-08-27 10:33:11 +02:00
|
|
|
builder.setItems(new CharSequence[]{LocaleController.getString("Copy", R.string.Copy)}, (dialogInterface, i) -> {
|
|
|
|
try {
|
|
|
|
String about;
|
2019-07-18 15:01:39 +02:00
|
|
|
if (position == locationRow) {
|
|
|
|
about = chatInfo != null && chatInfo.location instanceof TLRPC.TL_channelLocation ? ((TLRPC.TL_channelLocation) chatInfo.location).address : null;
|
|
|
|
} else if (position == channelInfoRow) {
|
2019-01-23 18:03:33 +01:00
|
|
|
about = chatInfo != null ? chatInfo.about : null;
|
2018-08-27 10:33:11 +02:00
|
|
|
} else {
|
2019-01-23 18:03:33 +01:00
|
|
|
about = userInfo != null ? userInfo.about : null;
|
2016-04-22 15:49:00 +02:00
|
|
|
}
|
2018-08-27 10:33:11 +02:00
|
|
|
if (TextUtils.isEmpty(about)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
AndroidUtilities.addToClipboard(about);
|
|
|
|
Toast.makeText(getParentActivity(), LocaleController.getString("TextCopied", R.string.TextCopied), Toast.LENGTH_SHORT).show();
|
|
|
|
} catch (Exception e) {
|
|
|
|
FileLog.e(e);
|
2016-04-22 15:49:00 +02:00
|
|
|
}
|
|
|
|
});
|
|
|
|
showDialog(builder.create());
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2015-11-26 22:04:02 +01:00
|
|
|
private void leaveChatPressed() {
|
2019-05-14 14:08:05 +02:00
|
|
|
AlertsCreator.createClearOrDeleteDialogAlert(ProfileActivity.this, false, currentChat, null, false, (param) -> {
|
2019-01-23 18:03:33 +01:00
|
|
|
playProfileAnimation = false;
|
|
|
|
NotificationCenter.getInstance(currentAccount).removeObserver(ProfileActivity.this, NotificationCenter.closeChats);
|
|
|
|
NotificationCenter.getInstance(currentAccount).postNotificationName(NotificationCenter.closeChats);
|
|
|
|
finishFragment();
|
2019-05-14 14:08:05 +02:00
|
|
|
NotificationCenter.getInstance(currentAccount).postNotificationName(NotificationCenter.needDeleteDialog, (long) -currentChat.id, null, currentChat, param);
|
2019-01-23 18:03:33 +01:00
|
|
|
});
|
2014-11-12 23:16:59 +01:00
|
|
|
}
|
|
|
|
|
2015-11-26 22:04:02 +01:00
|
|
|
private void getChannelParticipants(boolean reload) {
|
2019-01-23 18:03:33 +01:00
|
|
|
if (loadingUsers || participantsMap == null || chatInfo == null) {
|
2015-11-26 22:04:02 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
loadingUsers = true;
|
2018-07-30 04:07:02 +02:00
|
|
|
final int delay = participantsMap.size() != 0 && reload ? 300 : 0;
|
2015-11-26 22:04:02 +01:00
|
|
|
|
|
|
|
final TLRPC.TL_channels_getParticipants req = new TLRPC.TL_channels_getParticipants();
|
2018-07-30 04:07:02 +02:00
|
|
|
req.channel = MessagesController.getInstance(currentAccount).getInputChannel(chat_id);
|
2015-11-26 22:04:02 +01:00
|
|
|
req.filter = new TLRPC.TL_channelParticipantsRecent();
|
2016-03-16 13:26:32 +01:00
|
|
|
req.offset = reload ? 0 : participantsMap.size();
|
|
|
|
req.limit = 200;
|
2018-08-27 10:33:11 +02:00
|
|
|
int reqId = ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> {
|
|
|
|
if (error == null) {
|
|
|
|
TLRPC.TL_channels_channelParticipants res = (TLRPC.TL_channels_channelParticipants) response;
|
|
|
|
MessagesController.getInstance(currentAccount).putUsers(res.users, false);
|
|
|
|
if (res.users.size() < 200) {
|
|
|
|
usersEndReached = true;
|
|
|
|
}
|
|
|
|
if (req.offset == 0) {
|
|
|
|
participantsMap.clear();
|
2019-01-23 18:03:33 +01:00
|
|
|
chatInfo.participants = new TLRPC.TL_chatParticipants();
|
2018-08-27 10:33:11 +02:00
|
|
|
MessagesStorage.getInstance(currentAccount).putUsersAndChats(res.users, null, true, true);
|
|
|
|
MessagesStorage.getInstance(currentAccount).updateChannelUsers(chat_id, res.participants);
|
|
|
|
}
|
|
|
|
for (int a = 0; a < res.participants.size(); a++) {
|
|
|
|
TLRPC.TL_chatChannelParticipant participant = new TLRPC.TL_chatChannelParticipant();
|
|
|
|
participant.channelParticipant = res.participants.get(a);
|
|
|
|
participant.inviter_id = participant.channelParticipant.inviter_id;
|
|
|
|
participant.user_id = participant.channelParticipant.user_id;
|
|
|
|
participant.date = participant.channelParticipant.date;
|
|
|
|
if (participantsMap.indexOfKey(participant.user_id) < 0) {
|
2019-01-23 18:03:33 +01:00
|
|
|
chatInfo.participants.participants.add(participant);
|
2018-08-27 10:33:11 +02:00
|
|
|
participantsMap.put(participant.user_id, participant);
|
2015-11-26 22:04:02 +01:00
|
|
|
}
|
2018-08-27 10:33:11 +02:00
|
|
|
}
|
2015-11-26 22:04:02 +01:00
|
|
|
}
|
2018-08-27 10:33:11 +02:00
|
|
|
updateOnlineCount();
|
|
|
|
loadingUsers = false;
|
|
|
|
updateRowsIds();
|
|
|
|
if (listAdapter != null) {
|
|
|
|
listAdapter.notifyDataSetChanged();
|
|
|
|
}
|
|
|
|
}, delay));
|
2018-07-30 04:07:02 +02:00
|
|
|
ConnectionsManager.getInstance(currentAccount).bindRequestToGuid(reqId, classGuid);
|
2015-11-26 22:04:02 +01:00
|
|
|
}
|
|
|
|
|
2015-05-03 13:48:36 +02:00
|
|
|
private void openAddMember() {
|
|
|
|
Bundle args = new Bundle();
|
2019-06-04 12:14:50 +02:00
|
|
|
args.putBoolean("addToGroup", true);
|
|
|
|
args.putInt("chatId", currentChat.id);
|
|
|
|
GroupCreateActivity fragment = new GroupCreateActivity(args);
|
2019-07-18 15:01:39 +02:00
|
|
|
fragment.setInfo(chatInfo);
|
2019-01-23 18:03:33 +01:00
|
|
|
if (chatInfo != null && chatInfo.participants != null) {
|
2019-06-04 12:14:50 +02:00
|
|
|
SparseArray<TLObject> users = new SparseArray<>();
|
2019-01-23 18:03:33 +01:00
|
|
|
for (int a = 0; a < chatInfo.participants.participants.size(); a++) {
|
|
|
|
users.put(chatInfo.participants.participants.get(a).user_id, null);
|
2015-11-26 22:04:02 +01:00
|
|
|
}
|
|
|
|
fragment.setIgnoreUsers(users);
|
2015-05-03 13:48:36 +02:00
|
|
|
}
|
2019-06-04 12:14:50 +02:00
|
|
|
fragment.setDelegate((users, fwdCount) -> {
|
|
|
|
for (int a = 0, N = users.size(); a < N; a++) {
|
|
|
|
TLRPC.User user = users.get(a);
|
|
|
|
MessagesController.getInstance(currentAccount).addUserToChat(chat_id, user, chatInfo, fwdCount, null, ProfileActivity.this, null);
|
|
|
|
}
|
|
|
|
});
|
2015-05-03 13:48:36 +02:00
|
|
|
presentFragment(fragment);
|
|
|
|
}
|
|
|
|
|
2014-11-19 02:23:46 +01:00
|
|
|
private void checkListViewScroll() {
|
2016-04-22 15:49:00 +02:00
|
|
|
if (listView.getChildCount() <= 0 || openAnimationInProgress) {
|
2014-11-19 02:23:46 +01:00
|
|
|
return;
|
|
|
|
}
|
2016-04-22 15:49:00 +02:00
|
|
|
|
2014-11-19 02:23:46 +01:00
|
|
|
View child = listView.getChildAt(0);
|
2017-03-31 01:58:05 +02:00
|
|
|
RecyclerListView.Holder holder = (RecyclerListView.Holder) listView.findContainingViewHolder(child);
|
2016-04-22 15:49:00 +02:00
|
|
|
int top = child.getTop();
|
|
|
|
int newOffset = 0;
|
|
|
|
if (top >= 0 && holder != null && holder.getAdapterPosition() == 0) {
|
|
|
|
newOffset = top;
|
|
|
|
}
|
|
|
|
if (extraHeight != newOffset) {
|
|
|
|
extraHeight = newOffset;
|
|
|
|
topView.invalidate();
|
2016-05-25 23:49:47 +02:00
|
|
|
if (playProfileAnimation) {
|
|
|
|
allowProfileAnimation = extraHeight != 0;
|
|
|
|
}
|
2016-04-22 15:49:00 +02:00
|
|
|
needLayout();
|
2014-11-19 02:23:46 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-11-12 23:16:59 +01:00
|
|
|
private void needLayout() {
|
|
|
|
FrameLayout.LayoutParams layoutParams;
|
2015-10-29 18:10:07 +01:00
|
|
|
int newTop = (actionBar.getOccupyStatusBar() ? AndroidUtilities.statusBarHeight : 0) + ActionBar.getCurrentActionBarHeight();
|
|
|
|
if (listView != null && !openAnimationInProgress) {
|
2014-11-12 23:16:59 +01:00
|
|
|
layoutParams = (FrameLayout.LayoutParams) listView.getLayoutParams();
|
2015-10-29 18:10:07 +01:00
|
|
|
if (layoutParams.topMargin != newTop) {
|
|
|
|
layoutParams.topMargin = newTop;
|
|
|
|
listView.setLayoutParams(layoutParams);
|
|
|
|
}
|
2014-11-12 23:16:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (avatarImage != null) {
|
2015-10-29 18:10:07 +01:00
|
|
|
float diff = extraHeight / (float) AndroidUtilities.dp(88);
|
|
|
|
listView.setTopGlowOffset(extraHeight);
|
2014-11-12 23:16:59 +01:00
|
|
|
|
|
|
|
if (writeButton != null) {
|
2016-06-24 12:27:15 +02:00
|
|
|
writeButton.setTranslationY((actionBar.getOccupyStatusBar() ? AndroidUtilities.statusBarHeight : 0) + ActionBar.getCurrentActionBarHeight() + extraHeight - AndroidUtilities.dp(29.5f));
|
2015-10-29 18:10:07 +01:00
|
|
|
|
|
|
|
if (!openAnimationInProgress) {
|
|
|
|
final boolean setVisible = diff > 0.2f;
|
|
|
|
boolean currentVisible = writeButton.getTag() == null;
|
|
|
|
if (setVisible != currentVisible) {
|
|
|
|
if (setVisible) {
|
|
|
|
writeButton.setTag(null);
|
|
|
|
} else {
|
|
|
|
writeButton.setTag(0);
|
2015-06-29 19:12:11 +02:00
|
|
|
}
|
2015-10-29 18:10:07 +01:00
|
|
|
if (writeButtonAnimation != null) {
|
2016-06-24 12:27:15 +02:00
|
|
|
AnimatorSet old = writeButtonAnimation;
|
2015-10-29 18:10:07 +01:00
|
|
|
writeButtonAnimation = null;
|
|
|
|
old.cancel();
|
|
|
|
}
|
2016-06-24 12:27:15 +02:00
|
|
|
writeButtonAnimation = new AnimatorSet();
|
2015-10-29 18:10:07 +01:00
|
|
|
if (setVisible) {
|
|
|
|
writeButtonAnimation.setInterpolator(new DecelerateInterpolator());
|
|
|
|
writeButtonAnimation.playTogether(
|
2019-05-14 14:08:05 +02:00
|
|
|
ObjectAnimator.ofFloat(writeButton, View.SCALE_X, 1.0f),
|
|
|
|
ObjectAnimator.ofFloat(writeButton, View.SCALE_Y, 1.0f),
|
|
|
|
ObjectAnimator.ofFloat(writeButton, View.ALPHA, 1.0f)
|
2015-10-29 18:10:07 +01:00
|
|
|
);
|
|
|
|
} else {
|
|
|
|
writeButtonAnimation.setInterpolator(new AccelerateInterpolator());
|
|
|
|
writeButtonAnimation.playTogether(
|
2019-05-14 14:08:05 +02:00
|
|
|
ObjectAnimator.ofFloat(writeButton, View.SCALE_X, 0.2f),
|
|
|
|
ObjectAnimator.ofFloat(writeButton, View.SCALE_Y, 0.2f),
|
|
|
|
ObjectAnimator.ofFloat(writeButton, View.ALPHA, 0.0f)
|
2015-10-29 18:10:07 +01:00
|
|
|
);
|
|
|
|
}
|
|
|
|
writeButtonAnimation.setDuration(150);
|
2017-03-31 01:58:05 +02:00
|
|
|
writeButtonAnimation.addListener(new AnimatorListenerAdapter() {
|
2015-10-29 18:10:07 +01:00
|
|
|
@Override
|
2016-06-24 12:27:15 +02:00
|
|
|
public void onAnimationEnd(Animator animation) {
|
2015-10-29 18:10:07 +01:00
|
|
|
if (writeButtonAnimation != null && writeButtonAnimation.equals(animation)) {
|
|
|
|
writeButtonAnimation = null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
writeButtonAnimation.start();
|
|
|
|
}
|
2014-11-19 02:23:46 +01:00
|
|
|
}
|
2014-11-12 23:16:59 +01:00
|
|
|
}
|
|
|
|
|
2015-10-29 18:10:07 +01:00
|
|
|
float avatarY = (actionBar.getOccupyStatusBar() ? AndroidUtilities.statusBarHeight : 0) + ActionBar.getCurrentActionBarHeight() / 2.0f * (1.0f + diff) - 21 * AndroidUtilities.density + 27 * AndroidUtilities.density * diff;
|
2016-06-24 12:27:15 +02:00
|
|
|
avatarImage.setScaleX((42 + 18 * diff) / 42.0f);
|
|
|
|
avatarImage.setScaleY((42 + 18 * diff) / 42.0f);
|
|
|
|
avatarImage.setTranslationX(-AndroidUtilities.dp(47) * diff);
|
|
|
|
avatarImage.setTranslationY((float) Math.ceil(avatarY));
|
2015-11-26 22:04:02 +01:00
|
|
|
for (int a = 0; a < 2; a++) {
|
|
|
|
if (nameTextView[a] == null) {
|
|
|
|
continue;
|
|
|
|
}
|
2016-06-24 12:27:15 +02:00
|
|
|
nameTextView[a].setTranslationX(-21 * AndroidUtilities.density * diff);
|
|
|
|
nameTextView[a].setTranslationY((float) Math.floor(avatarY) + AndroidUtilities.dp(1.3f) + AndroidUtilities.dp(7) * diff);
|
|
|
|
onlineTextView[a].setTranslationX(-21 * AndroidUtilities.density * diff);
|
|
|
|
onlineTextView[a].setTranslationY((float) Math.floor(avatarY) + AndroidUtilities.dp(24) + (float) Math.floor(11 * AndroidUtilities.density) * diff);
|
2019-01-23 18:03:33 +01:00
|
|
|
float scale = 1.0f + 0.12f * diff;
|
2019-06-18 07:55:59 +02:00
|
|
|
idTextView.setTranslationX( -21 * AndroidUtilities.density * diff);
|
|
|
|
idTextView.setTranslationY( (float) Math.floor(avatarY) + AndroidUtilities.dp(32) + (float)Math.floor(22 * AndroidUtilities.density) * diff);
|
2019-01-23 18:03:33 +01:00
|
|
|
nameTextView[a].setScaleX(scale);
|
|
|
|
nameTextView[a].setScaleY(scale);
|
2015-11-26 22:04:02 +01:00
|
|
|
if (a == 1 && !openAnimationInProgress) {
|
2019-01-23 18:03:33 +01:00
|
|
|
int viewWidth;
|
2015-11-26 22:04:02 +01:00
|
|
|
if (AndroidUtilities.isTablet()) {
|
2019-01-23 18:03:33 +01:00
|
|
|
viewWidth = AndroidUtilities.dp(490);
|
2015-11-26 22:04:02 +01:00
|
|
|
} else {
|
2019-01-23 18:03:33 +01:00
|
|
|
viewWidth = AndroidUtilities.displaySize.x;
|
2015-11-26 22:04:02 +01:00
|
|
|
}
|
2019-01-23 18:03:33 +01:00
|
|
|
int buttonsWidth = AndroidUtilities.dp(118 + 8 + (40 + (callItem != null || editItem != null ? 48 : 0)));
|
|
|
|
int minWidth = viewWidth - buttonsWidth;
|
|
|
|
|
|
|
|
int width = (int) (viewWidth - buttonsWidth * Math.max(0.0f, 1.0f - (diff != 1.0f ? diff * 0.15f / (1.0f - diff) : 1.0f)) - nameTextView[a].getTranslationX());
|
|
|
|
float width2 = nameTextView[a].getPaint().measureText(nameTextView[a].getText().toString()) * scale + nameTextView[a].getSideDrawablesSize();
|
2015-11-26 22:04:02 +01:00
|
|
|
layoutParams = (FrameLayout.LayoutParams) nameTextView[a].getLayoutParams();
|
|
|
|
if (width < width2) {
|
2019-01-23 18:03:33 +01:00
|
|
|
layoutParams.width = Math.max(minWidth, (int) Math.ceil((width - AndroidUtilities.dp(24)) / (scale + (1.12f - scale) * 7.0f)));
|
2015-11-26 22:04:02 +01:00
|
|
|
} else {
|
2019-01-23 18:03:33 +01:00
|
|
|
layoutParams.width = (int) Math.ceil(width2);
|
2015-11-26 22:04:02 +01:00
|
|
|
}
|
2019-01-23 18:03:33 +01:00
|
|
|
layoutParams.width = (int) Math.min((viewWidth - nameTextView[a].getX()) / scale - AndroidUtilities.dp(8), layoutParams.width);
|
2015-11-26 22:04:02 +01:00
|
|
|
nameTextView[a].setLayoutParams(layoutParams);
|
|
|
|
|
2019-01-23 18:03:33 +01:00
|
|
|
width2 = onlineTextView[a].getPaint().measureText(onlineTextView[a].getText().toString());
|
2015-11-26 22:04:02 +01:00
|
|
|
layoutParams = (FrameLayout.LayoutParams) onlineTextView[a].getLayoutParams();
|
2016-06-24 12:27:15 +02:00
|
|
|
layoutParams.rightMargin = (int) Math.ceil(onlineTextView[a].getTranslationX() + AndroidUtilities.dp(8) + AndroidUtilities.dp(40) * (1.0f - diff));
|
2019-01-23 18:03:33 +01:00
|
|
|
if (width < width2) {
|
|
|
|
layoutParams.width = (int) Math.ceil(width);
|
|
|
|
} else {
|
|
|
|
layoutParams.width = LayoutHelper.WRAP_CONTENT;
|
|
|
|
}
|
2015-11-26 22:04:02 +01:00
|
|
|
onlineTextView[a].setLayoutParams(layoutParams);
|
|
|
|
}
|
2019-06-18 07:55:59 +02:00
|
|
|
if (diff > 0.85) {
|
|
|
|
idTextView.setVisibility(View.VISIBLE);
|
|
|
|
} else {
|
|
|
|
idTextView.setVisibility(View.GONE);
|
|
|
|
}
|
2015-11-26 22:04:02 +01:00
|
|
|
}
|
2014-11-12 23:16:59 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-01-23 18:03:33 +01:00
|
|
|
private void loadMediaCounts() {
|
|
|
|
if (dialog_id != 0) {
|
2019-07-18 15:01:39 +02:00
|
|
|
MediaDataController.getInstance(currentAccount).getMediaCounts(dialog_id, classGuid);
|
2019-01-23 18:03:33 +01:00
|
|
|
} else if (user_id != 0) {
|
2019-07-18 15:01:39 +02:00
|
|
|
MediaDataController.getInstance(currentAccount).getMediaCounts(user_id, classGuid);
|
2019-01-23 18:03:33 +01:00
|
|
|
} else if (chat_id > 0) {
|
2019-07-18 15:01:39 +02:00
|
|
|
MediaDataController.getInstance(currentAccount).getMediaCounts(-chat_id, classGuid);
|
2019-01-23 18:03:33 +01:00
|
|
|
if (mergeDialogId != 0) {
|
2019-07-18 15:01:39 +02:00
|
|
|
MediaDataController.getInstance(currentAccount).getMediaCounts(mergeDialogId, classGuid);
|
2019-01-23 18:03:33 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-11-11 23:16:17 +01:00
|
|
|
private void fixLayout() {
|
|
|
|
if (fragmentView == null) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
fragmentView.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
|
|
|
|
@Override
|
|
|
|
public boolean onPreDraw() {
|
|
|
|
if (fragmentView != null) {
|
2015-11-26 22:04:02 +01:00
|
|
|
checkListViewScroll();
|
2014-11-12 23:16:59 +01:00
|
|
|
needLayout();
|
2014-11-11 23:16:17 +01:00
|
|
|
fragmentView.getViewTreeObserver().removeOnPreDrawListener(this);
|
|
|
|
}
|
2015-06-29 19:12:11 +02:00
|
|
|
return true;
|
2014-11-11 23:16:17 +01:00
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onConfigurationChanged(Configuration newConfig) {
|
|
|
|
super.onConfigurationChanged(newConfig);
|
|
|
|
fixLayout();
|
|
|
|
}
|
|
|
|
|
2015-10-29 18:10:07 +01:00
|
|
|
@SuppressWarnings("unchecked")
|
2014-11-12 23:16:59 +01:00
|
|
|
@Override
|
2018-07-30 04:07:02 +02:00
|
|
|
public void didReceivedNotification(int id, int account, final Object... args) {
|
2014-08-22 16:24:33 +02:00
|
|
|
if (id == NotificationCenter.updateInterfaces) {
|
2015-10-29 18:10:07 +01:00
|
|
|
int mask = (Integer) args[0];
|
2014-11-12 23:16:59 +01:00
|
|
|
if (user_id != 0) {
|
2014-11-19 16:17:24 +01:00
|
|
|
if ((mask & MessagesController.UPDATE_MASK_AVATAR) != 0 || (mask & MessagesController.UPDATE_MASK_NAME) != 0 || (mask & MessagesController.UPDATE_MASK_STATUS) != 0) {
|
2014-11-12 23:16:59 +01:00
|
|
|
updateProfileData();
|
|
|
|
}
|
2014-12-01 18:56:31 +01:00
|
|
|
if ((mask & MessagesController.UPDATE_MASK_PHONE) != 0) {
|
|
|
|
if (listView != null) {
|
2017-03-31 01:58:05 +02:00
|
|
|
RecyclerListView.Holder holder = (RecyclerListView.Holder) listView.findViewHolderForPosition(phoneRow);
|
2015-10-29 18:10:07 +01:00
|
|
|
if (holder != null) {
|
|
|
|
listAdapter.onBindViewHolder(holder, phoneRow);
|
|
|
|
}
|
2014-12-01 18:56:31 +01:00
|
|
|
}
|
|
|
|
}
|
2014-11-12 23:16:59 +01:00
|
|
|
} else if (chat_id != 0) {
|
2019-01-23 18:03:33 +01:00
|
|
|
if ((mask & MessagesController.UPDATE_MASK_CHAT) != 0 || (mask & MessagesController.UPDATE_MASK_CHAT_AVATAR) != 0 || (mask & MessagesController.UPDATE_MASK_CHAT_NAME) != 0 || (mask & MessagesController.UPDATE_MASK_CHAT_MEMBERS) != 0 || (mask & MessagesController.UPDATE_MASK_STATUS) != 0) {
|
2014-11-12 23:16:59 +01:00
|
|
|
updateOnlineCount();
|
|
|
|
updateProfileData();
|
|
|
|
}
|
2019-01-23 18:03:33 +01:00
|
|
|
if ((mask & MessagesController.UPDATE_MASK_CHAT) != 0) {
|
2015-09-24 22:52:02 +02:00
|
|
|
updateRowsIds();
|
|
|
|
if (listAdapter != null) {
|
|
|
|
listAdapter.notifyDataSetChanged();
|
|
|
|
}
|
|
|
|
}
|
2014-11-12 23:16:59 +01:00
|
|
|
if ((mask & MessagesController.UPDATE_MASK_AVATAR) != 0 || (mask & MessagesController.UPDATE_MASK_NAME) != 0 || (mask & MessagesController.UPDATE_MASK_STATUS) != 0) {
|
2015-02-27 20:57:58 +01:00
|
|
|
if (listView != null) {
|
|
|
|
int count = listView.getChildCount();
|
|
|
|
for (int a = 0; a < count; a++) {
|
|
|
|
View child = listView.getChildAt(a);
|
|
|
|
if (child instanceof UserCell) {
|
|
|
|
((UserCell) child).update(mask);
|
|
|
|
}
|
2014-11-12 23:16:59 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2013-10-25 17:19:00 +02:00
|
|
|
}
|
2019-01-23 18:03:33 +01:00
|
|
|
} else if (id == NotificationCenter.chatOnlineCountDidLoad) {
|
|
|
|
Integer chatId = (Integer) args[0];
|
|
|
|
if (chatInfo == null || currentChat == null || currentChat.id != chatId) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
chatInfo.online_count = (Integer) args[1];
|
|
|
|
updateOnlineCount();
|
|
|
|
updateProfileData();
|
|
|
|
} else if (id == NotificationCenter.contactsDidLoad) {
|
2014-06-04 01:31:48 +02:00
|
|
|
createActionBarMenu();
|
2019-01-23 18:03:33 +01:00
|
|
|
} else if (id == NotificationCenter.mediaDidLoad) {
|
|
|
|
long uid = (Long) args[0];
|
|
|
|
int guid = (Integer) args[3];
|
|
|
|
if (guid == classGuid) {
|
|
|
|
long did = dialog_id;
|
|
|
|
if (did == 0) {
|
|
|
|
if (user_id != 0) {
|
|
|
|
did = user_id;
|
|
|
|
} else if (chat_id != 0) {
|
|
|
|
did = -chat_id;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
int type = (Integer) args[4];
|
|
|
|
sharedMediaData[type].setTotalCount((Integer) args[1]);
|
|
|
|
ArrayList<MessageObject> arr = (ArrayList<MessageObject>) args[2];
|
|
|
|
boolean enc = ((int) did) == 0;
|
|
|
|
int loadIndex = uid == did ? 0 : 1;
|
|
|
|
if (!arr.isEmpty()) {
|
|
|
|
sharedMediaData[type].setEndReached(loadIndex, (Boolean) args[5]);
|
|
|
|
}
|
|
|
|
for (int a = 0; a < arr.size(); a++) {
|
|
|
|
MessageObject message = arr.get(a);
|
|
|
|
sharedMediaData[type].addMessage(message, loadIndex, false, enc);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (id == NotificationCenter.mediaCountsDidLoad) {
|
2015-10-29 18:10:07 +01:00
|
|
|
long uid = (Long) args[0];
|
2015-11-26 22:04:02 +01:00
|
|
|
long did = dialog_id;
|
|
|
|
if (did == 0) {
|
|
|
|
if (user_id != 0) {
|
|
|
|
did = user_id;
|
|
|
|
} else if (chat_id != 0) {
|
|
|
|
did = -chat_id;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (uid == did || uid == mergeDialogId) {
|
2019-01-23 18:03:33 +01:00
|
|
|
int[] counts = (int[]) args[1];
|
|
|
|
if (uid == did) {
|
|
|
|
mediaCount = counts;
|
|
|
|
} else {
|
|
|
|
mediaMergeCount = counts;
|
|
|
|
}
|
|
|
|
System.arraycopy(lastMediaCount, 0, prevMediaCount, 0, prevMediaCount.length);
|
|
|
|
for (int a = 0; a < lastMediaCount.length; a++) {
|
|
|
|
if (mediaCount[a] >= 0 && mediaMergeCount[a] >= 0) {
|
|
|
|
lastMediaCount[a] = mediaCount[a] + mediaMergeCount[a];
|
|
|
|
} else if (mediaCount[a] >= 0) {
|
|
|
|
lastMediaCount[a] = mediaCount[a];
|
|
|
|
} else if (mediaMergeCount[a] >= 0) {
|
|
|
|
lastMediaCount[a] = mediaMergeCount[a];
|
|
|
|
} else {
|
|
|
|
lastMediaCount[a] = 0;
|
|
|
|
}
|
|
|
|
if (uid == did && lastMediaCount[a] != 0) {
|
2019-07-18 15:01:39 +02:00
|
|
|
MediaDataController.getInstance(currentAccount).loadMedia(did, 50, 0, a, 2, classGuid);
|
2014-11-12 23:16:59 +01:00
|
|
|
}
|
2013-10-25 17:19:00 +02:00
|
|
|
}
|
2019-01-23 18:03:33 +01:00
|
|
|
updateSharedMediaRows();
|
|
|
|
}
|
|
|
|
} else if (id == NotificationCenter.mediaCountDidLoad) {
|
|
|
|
long uid = (Long) args[0];
|
|
|
|
long did = dialog_id;
|
|
|
|
if (did == 0) {
|
|
|
|
if (user_id != 0) {
|
|
|
|
did = user_id;
|
|
|
|
} else if (chat_id != 0) {
|
|
|
|
did = -chat_id;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (uid == did || uid == mergeDialogId) {
|
|
|
|
int type = (Integer) args[3];
|
|
|
|
int mCount = (Integer) args[1];
|
2018-07-30 04:07:02 +02:00
|
|
|
if (uid == did) {
|
|
|
|
mediaCount[type] = mCount;
|
|
|
|
} else {
|
|
|
|
mediaMergeCount[type] = mCount;
|
|
|
|
}
|
2019-01-23 18:03:33 +01:00
|
|
|
prevMediaCount[type] = lastMediaCount[type];
|
|
|
|
if (mediaCount[type] >= 0 && mediaMergeCount[type] >= 0) {
|
|
|
|
lastMediaCount[type] = mediaCount[type] + mediaMergeCount[type];
|
|
|
|
} else if (mediaCount[type] >= 0) {
|
|
|
|
lastMediaCount[type] = mediaCount[type];
|
|
|
|
} else if (mediaMergeCount[type] >= 0) {
|
|
|
|
lastMediaCount[type] = mediaMergeCount[type];
|
|
|
|
} else {
|
|
|
|
lastMediaCount[type] = 0;
|
|
|
|
}
|
|
|
|
updateSharedMediaRows();
|
2013-10-25 17:19:00 +02:00
|
|
|
}
|
2014-08-22 16:24:33 +02:00
|
|
|
} else if (id == NotificationCenter.encryptedChatCreated) {
|
2013-10-25 17:19:00 +02:00
|
|
|
if (creatingChat) {
|
2018-08-27 10:33:11 +02:00
|
|
|
AndroidUtilities.runOnUIThread(() -> {
|
|
|
|
NotificationCenter.getInstance(currentAccount).removeObserver(ProfileActivity.this, NotificationCenter.closeChats);
|
|
|
|
NotificationCenter.getInstance(currentAccount).postNotificationName(NotificationCenter.closeChats);
|
|
|
|
TLRPC.EncryptedChat encryptedChat = (TLRPC.EncryptedChat) args[0];
|
|
|
|
Bundle args2 = new Bundle();
|
|
|
|
args2.putInt("enc_id", encryptedChat.id);
|
|
|
|
presentFragment(new ChatActivity(args2), true);
|
2014-10-09 17:55:05 +02:00
|
|
|
});
|
2013-10-25 17:19:00 +02:00
|
|
|
}
|
2014-08-22 16:24:33 +02:00
|
|
|
} else if (id == NotificationCenter.encryptedChatUpdated) {
|
2015-10-29 18:10:07 +01:00
|
|
|
TLRPC.EncryptedChat chat = (TLRPC.EncryptedChat) args[0];
|
2013-10-25 17:19:00 +02:00
|
|
|
if (currentEncryptedChat != null && chat.id == currentEncryptedChat.id) {
|
|
|
|
currentEncryptedChat = chat;
|
2014-05-17 01:05:49 +02:00
|
|
|
updateRowsIds();
|
2013-10-25 17:19:00 +02:00
|
|
|
if (listAdapter != null) {
|
|
|
|
listAdapter.notifyDataSetChanged();
|
|
|
|
}
|
|
|
|
}
|
2019-01-23 18:03:33 +01:00
|
|
|
} else if (id == NotificationCenter.blockedUsersDidLoad) {
|
2014-08-22 16:24:33 +02:00
|
|
|
boolean oldValue = userBlocked;
|
2018-08-27 10:33:11 +02:00
|
|
|
userBlocked = MessagesController.getInstance(currentAccount).blockedUsers.indexOfKey(user_id) >= 0;
|
2014-08-22 16:24:33 +02:00
|
|
|
if (oldValue != userBlocked) {
|
|
|
|
createActionBarMenu();
|
2019-06-04 12:14:50 +02:00
|
|
|
updateRowsIds();
|
|
|
|
listAdapter.notifyDataSetChanged();
|
2014-08-22 16:24:33 +02:00
|
|
|
}
|
2019-01-23 18:03:33 +01:00
|
|
|
} else if (id == NotificationCenter.chatInfoDidLoad) {
|
2015-09-24 22:52:02 +02:00
|
|
|
TLRPC.ChatFull chatFull = (TLRPC.ChatFull) args[0];
|
|
|
|
if (chatFull.id == chat_id) {
|
2015-11-26 22:04:02 +01:00
|
|
|
boolean byChannelUsers = (Boolean) args[2];
|
2019-01-23 18:03:33 +01:00
|
|
|
if (chatInfo instanceof TLRPC.TL_channelFull) {
|
|
|
|
if (chatFull.participants == null && chatInfo != null) {
|
|
|
|
chatFull.participants = chatInfo.participants;
|
2015-11-26 22:04:02 +01:00
|
|
|
}
|
|
|
|
}
|
2019-01-23 18:03:33 +01:00
|
|
|
boolean loadChannelParticipants = chatInfo == null && chatFull instanceof TLRPC.TL_channelFull;
|
|
|
|
chatInfo = chatFull;
|
|
|
|
if (mergeDialogId == 0 && chatInfo.migrated_from_chat_id != 0) {
|
|
|
|
mergeDialogId = -chatInfo.migrated_from_chat_id;
|
2019-07-18 15:01:39 +02:00
|
|
|
MediaDataController.getInstance(currentAccount).getMediaCount(mergeDialogId, MediaDataController.MEDIA_PHOTOVIDEO, classGuid, true);
|
2015-11-26 22:04:02 +01:00
|
|
|
}
|
|
|
|
fetchUsersFromChannelInfo();
|
2014-11-12 23:16:59 +01:00
|
|
|
updateOnlineCount();
|
|
|
|
updateRowsIds();
|
|
|
|
if (listAdapter != null) {
|
|
|
|
listAdapter.notifyDataSetChanged();
|
|
|
|
}
|
2018-07-30 04:07:02 +02:00
|
|
|
TLRPC.Chat newChat = MessagesController.getInstance(currentAccount).getChat(chat_id);
|
2015-11-26 22:04:02 +01:00
|
|
|
if (newChat != null) {
|
|
|
|
currentChat = newChat;
|
|
|
|
createActionBarMenu();
|
|
|
|
}
|
2016-03-16 13:26:32 +01:00
|
|
|
if (currentChat.megagroup && (loadChannelParticipants || !byChannelUsers)) {
|
2015-11-26 22:04:02 +01:00
|
|
|
getChannelParticipants(true);
|
|
|
|
}
|
2014-11-12 23:16:59 +01:00
|
|
|
}
|
|
|
|
} else if (id == NotificationCenter.closeChats) {
|
|
|
|
removeSelfFromStack();
|
2019-01-23 18:03:33 +01:00
|
|
|
} else if (id == NotificationCenter.botInfoDidLoad) {
|
2015-06-29 19:12:11 +02:00
|
|
|
TLRPC.BotInfo info = (TLRPC.BotInfo) args[0];
|
|
|
|
if (info.user_id == user_id) {
|
|
|
|
botInfo = info;
|
|
|
|
updateRowsIds();
|
2015-11-26 22:04:02 +01:00
|
|
|
if (listAdapter != null) {
|
|
|
|
listAdapter.notifyDataSetChanged();
|
|
|
|
}
|
2015-06-29 19:12:11 +02:00
|
|
|
}
|
2019-01-23 18:03:33 +01:00
|
|
|
} else if (id == NotificationCenter.userInfoDidLoad) {
|
2016-03-16 13:26:32 +01:00
|
|
|
int uid = (Integer) args[0];
|
|
|
|
if (uid == user_id) {
|
2019-05-14 14:08:05 +02:00
|
|
|
userInfo = (TLRPC.UserFull) args[1];
|
2017-03-31 01:58:05 +02:00
|
|
|
if (!openAnimationInProgress && callItem == null) {
|
|
|
|
createActionBarMenu();
|
|
|
|
} else {
|
|
|
|
recreateMenuAfterAnimation = true;
|
|
|
|
}
|
2016-03-16 13:26:32 +01:00
|
|
|
updateRowsIds();
|
|
|
|
if (listAdapter != null) {
|
|
|
|
listAdapter.notifyDataSetChanged();
|
|
|
|
}
|
|
|
|
}
|
2019-01-23 18:03:33 +01:00
|
|
|
} else if (id == NotificationCenter.didReceiveNewMessages) {
|
2019-09-10 12:56:11 +02:00
|
|
|
boolean scheduled = (Boolean) args[2];
|
|
|
|
if (scheduled) {
|
|
|
|
return;
|
|
|
|
}
|
2019-01-23 18:03:33 +01:00
|
|
|
long did;
|
|
|
|
if (dialog_id != 0) {
|
|
|
|
did = dialog_id;
|
|
|
|
} else if (user_id != 0) {
|
|
|
|
did = user_id;
|
|
|
|
} else {
|
|
|
|
did = -chat_id;
|
|
|
|
}
|
|
|
|
if (did == (Long) args[0]) {
|
|
|
|
boolean enc = ((int) did) == 0;
|
2015-10-29 18:10:07 +01:00
|
|
|
ArrayList<MessageObject> arr = (ArrayList<MessageObject>) args[1];
|
|
|
|
for (int a = 0; a < arr.size(); a++) {
|
|
|
|
MessageObject obj = arr.get(a);
|
2019-01-23 18:03:33 +01:00
|
|
|
if (currentEncryptedChat != null && obj.messageOwner.action instanceof TLRPC.TL_messageEncryptedAction && obj.messageOwner.action.encryptedAction instanceof TLRPC.TL_decryptedMessageActionSetMessageTTL) {
|
2015-10-29 18:10:07 +01:00
|
|
|
TLRPC.TL_decryptedMessageActionSetMessageTTL action = (TLRPC.TL_decryptedMessageActionSetMessageTTL) obj.messageOwner.action.encryptedAction;
|
|
|
|
if (listAdapter != null) {
|
|
|
|
listAdapter.notifyDataSetChanged();
|
|
|
|
}
|
|
|
|
}
|
2019-01-23 18:03:33 +01:00
|
|
|
|
2019-07-18 15:01:39 +02:00
|
|
|
int type = MediaDataController.getMediaType(obj.messageOwner);
|
2019-01-23 18:03:33 +01:00
|
|
|
if (type == -1) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
sharedMediaData[type].addMessage(obj, 0, true, enc);
|
|
|
|
}
|
|
|
|
loadMediaCounts();
|
|
|
|
}
|
|
|
|
} else if (id == NotificationCenter.messagesDeleted) {
|
2019-09-10 12:56:11 +02:00
|
|
|
boolean scheduled = (Boolean) args[2];
|
|
|
|
if (scheduled) {
|
|
|
|
return;
|
|
|
|
}
|
2019-01-23 18:03:33 +01:00
|
|
|
int channelId = (Integer) args[1];
|
|
|
|
if (ChatObject.isChannel(currentChat)) {
|
|
|
|
if (!(channelId == 0 && mergeDialogId != 0 || channelId == currentChat.id)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
} else if (channelId != 0) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
ArrayList<Integer> markAsDeletedMessages = (ArrayList<Integer>) args[0];
|
|
|
|
boolean updated = false;
|
|
|
|
for (int a = 0, N = markAsDeletedMessages.size(); a < N; a++) {
|
|
|
|
for (int b = 0; b < sharedMediaData.length; b++) {
|
2019-06-04 12:14:50 +02:00
|
|
|
if (sharedMediaData[b].deleteMessage(markAsDeletedMessages.get(a), 0)) {
|
|
|
|
updated = true;
|
|
|
|
}
|
2015-10-29 18:10:07 +01:00
|
|
|
}
|
|
|
|
}
|
2019-06-04 12:14:50 +02:00
|
|
|
if (updated && mediaActivity != null) {
|
|
|
|
mediaActivity.updateAdapters();
|
|
|
|
}
|
2019-01-23 18:03:33 +01:00
|
|
|
loadMediaCounts();
|
2013-10-25 17:19:00 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onResume() {
|
2014-06-04 18:00:42 +02:00
|
|
|
super.onResume();
|
2014-06-04 01:31:48 +02:00
|
|
|
if (listAdapter != null) {
|
2013-10-25 17:19:00 +02:00
|
|
|
listAdapter.notifyDataSetChanged();
|
|
|
|
}
|
2015-04-09 20:00:14 +02:00
|
|
|
updateProfileData();
|
2014-11-11 23:16:17 +01:00
|
|
|
fixLayout();
|
2019-05-14 14:08:05 +02:00
|
|
|
if (nameTextView[1] != null) {
|
|
|
|
setParentActivityTitle(nameTextView[1].getText());
|
|
|
|
}
|
2013-10-25 17:19:00 +02:00
|
|
|
}
|
|
|
|
|
2019-07-18 15:01:39 +02:00
|
|
|
@Override
|
|
|
|
public void onPause() {
|
|
|
|
super.onPause();
|
|
|
|
if (undoView != null) {
|
|
|
|
undoView.hide(true, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected void onBecomeFullyHidden() {
|
|
|
|
if (undoView != null) {
|
|
|
|
undoView.hide(true, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-10-29 18:10:07 +01:00
|
|
|
public void setPlayProfileAnimation(boolean value) {
|
2018-07-30 04:07:02 +02:00
|
|
|
SharedPreferences preferences = MessagesController.getGlobalMainSettings();
|
2016-06-24 12:27:15 +02:00
|
|
|
if (!AndroidUtilities.isTablet() && preferences.getBoolean("view_animations", true)) {
|
2015-10-29 18:10:07 +01:00
|
|
|
playProfileAnimation = value;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-01-23 18:03:33 +01:00
|
|
|
private void updateSharedMediaRows() {
|
|
|
|
if (listAdapter == null) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
int sharedHeaderRowPrev = sharedHeaderRow;
|
|
|
|
int photosRowPrev = photosRow;
|
|
|
|
int filesRowPrev = filesRow;
|
|
|
|
int linksRowPrev = linksRow;
|
|
|
|
int audioRowPrev = audioRow;
|
|
|
|
int voiceRowPrev = voiceRow;
|
|
|
|
int groupsInCommonRowPrev = groupsInCommonRow;
|
|
|
|
int sharedSectionRowPrev = sharedSectionRow;
|
|
|
|
updateRowsIds();
|
|
|
|
if (sharedHeaderRowPrev == -1 && sharedHeaderRow != -1) {
|
|
|
|
int newRowsCount = 2;
|
|
|
|
if (photosRow != -1) {
|
|
|
|
newRowsCount++;
|
|
|
|
}
|
|
|
|
if (filesRow != -1) {
|
|
|
|
newRowsCount++;
|
|
|
|
}
|
|
|
|
if (linksRow != -1) {
|
|
|
|
newRowsCount++;
|
|
|
|
}
|
|
|
|
if (audioRow != -1) {
|
|
|
|
newRowsCount++;
|
|
|
|
}
|
|
|
|
if (voiceRow != -1) {
|
|
|
|
newRowsCount++;
|
|
|
|
}
|
2019-05-14 14:08:05 +02:00
|
|
|
if (groupsInCommonRow != -1) {
|
|
|
|
newRowsCount++;
|
|
|
|
}
|
2019-01-23 18:03:33 +01:00
|
|
|
listAdapter.notifyItemRangeInserted(sharedHeaderRow, newRowsCount);
|
|
|
|
} else if (sharedHeaderRowPrev != -1 && sharedHeaderRow != -1) {
|
2019-07-18 15:01:39 +02:00
|
|
|
if (photosRowPrev != -1 && photosRow != -1 && prevMediaCount[MediaDataController.MEDIA_PHOTOVIDEO] != lastMediaCount[MediaDataController.MEDIA_PHOTOVIDEO]) {
|
2019-01-23 18:03:33 +01:00
|
|
|
listAdapter.notifyItemChanged(photosRow);
|
|
|
|
}
|
2019-07-18 15:01:39 +02:00
|
|
|
if (filesRowPrev != -1 && filesRow != -1 && prevMediaCount[MediaDataController.MEDIA_FILE] != lastMediaCount[MediaDataController.MEDIA_FILE]) {
|
2019-01-23 18:03:33 +01:00
|
|
|
listAdapter.notifyItemChanged(filesRow);
|
|
|
|
}
|
2019-07-18 15:01:39 +02:00
|
|
|
if (linksRowPrev != -1 && linksRow != -1 && prevMediaCount[MediaDataController.MEDIA_URL] != lastMediaCount[MediaDataController.MEDIA_URL]) {
|
2019-01-23 18:03:33 +01:00
|
|
|
listAdapter.notifyItemChanged(linksRow);
|
|
|
|
}
|
2019-07-18 15:01:39 +02:00
|
|
|
if (audioRowPrev != -1 && audioRow != -1 && prevMediaCount[MediaDataController.MEDIA_MUSIC] != lastMediaCount[MediaDataController.MEDIA_MUSIC]) {
|
2019-01-23 18:03:33 +01:00
|
|
|
listAdapter.notifyItemChanged(audioRow);
|
|
|
|
}
|
2019-07-18 15:01:39 +02:00
|
|
|
if (voiceRowPrev != -1 && voiceRow != -1 && prevMediaCount[MediaDataController.MEDIA_AUDIO] != lastMediaCount[MediaDataController.MEDIA_AUDIO]) {
|
2019-01-23 18:03:33 +01:00
|
|
|
listAdapter.notifyItemChanged(voiceRow);
|
|
|
|
}
|
|
|
|
if (photosRowPrev == -1 && photosRow != -1) {
|
|
|
|
listAdapter.notifyItemInserted(photosRow);
|
|
|
|
} else if (photosRowPrev != -1 && photosRow == -1) {
|
|
|
|
listAdapter.notifyItemRemoved(photosRowPrev);
|
|
|
|
}
|
|
|
|
if (filesRowPrev == -1 && filesRow != -1) {
|
|
|
|
listAdapter.notifyItemInserted(filesRow);
|
|
|
|
} else if (filesRowPrev != -1 && filesRow == -1) {
|
|
|
|
listAdapter.notifyItemRemoved(filesRowPrev);
|
|
|
|
}
|
|
|
|
if (linksRowPrev == -1 && linksRow != -1) {
|
|
|
|
listAdapter.notifyItemInserted(linksRow);
|
|
|
|
} else if (linksRowPrev != -1 && linksRow == -1) {
|
|
|
|
listAdapter.notifyItemRemoved(linksRowPrev);
|
|
|
|
}
|
|
|
|
if (audioRowPrev == -1 && audioRow != -1) {
|
|
|
|
listAdapter.notifyItemInserted(audioRow);
|
|
|
|
} else if (audioRowPrev != -1 && audioRow == -1) {
|
|
|
|
listAdapter.notifyItemRemoved(audioRowPrev);
|
|
|
|
}
|
|
|
|
if (voiceRowPrev == -1 && voiceRow != -1) {
|
|
|
|
listAdapter.notifyItemInserted(voiceRow);
|
|
|
|
} else if (voiceRowPrev != -1 && voiceRow == -1) {
|
|
|
|
listAdapter.notifyItemRemoved(voiceRowPrev);
|
|
|
|
}
|
2019-05-14 14:08:05 +02:00
|
|
|
if (groupsInCommonRowPrev == -1 && groupsInCommonRow != -1) {
|
|
|
|
listAdapter.notifyItemInserted(groupsInCommonRow);
|
|
|
|
} else if (groupsInCommonRowPrev != -1 && groupsInCommonRow == -1) {
|
|
|
|
listAdapter.notifyItemRemoved(groupsInCommonRowPrev);
|
|
|
|
}
|
2019-01-23 18:03:33 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-10-29 18:10:07 +01:00
|
|
|
@Override
|
|
|
|
protected void onTransitionAnimationStart(boolean isOpen, boolean backward) {
|
2019-08-22 01:53:26 +02:00
|
|
|
if ((!isOpen && backward || isOpen && !backward) && playProfileAnimation && allowProfileAnimation) {
|
|
|
|
openAnimationInProgress = true;
|
2019-07-18 15:01:39 +02:00
|
|
|
}
|
|
|
|
if (isOpen) {
|
|
|
|
NotificationCenter.getInstance(currentAccount).setAllowedNotificationsDutingAnimation(new int[]{NotificationCenter.dialogsNeedReload, NotificationCenter.closeChats, NotificationCenter.mediaCountDidLoad, NotificationCenter.mediaCountsDidLoad});
|
|
|
|
NotificationCenter.getInstance(currentAccount).setAnimationInProgress(true);
|
2015-10-29 18:10:07 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected void onTransitionAnimationEnd(boolean isOpen, boolean backward) {
|
2019-07-18 15:01:39 +02:00
|
|
|
if (isOpen) {
|
|
|
|
if (!backward && playProfileAnimation && allowProfileAnimation) {
|
|
|
|
openAnimationInProgress = false;
|
|
|
|
if (recreateMenuAfterAnimation) {
|
|
|
|
createActionBarMenu();
|
|
|
|
}
|
2017-03-31 01:58:05 +02:00
|
|
|
}
|
2019-07-18 15:01:39 +02:00
|
|
|
NotificationCenter.getInstance(currentAccount).setAnimationInProgress(false);
|
2015-10-29 18:10:07 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public float getAnimationProgress() {
|
|
|
|
return animationProgress;
|
|
|
|
}
|
|
|
|
|
2017-03-31 01:58:05 +02:00
|
|
|
@Keep
|
2015-10-29 18:10:07 +01:00
|
|
|
public void setAnimationProgress(float progress) {
|
|
|
|
animationProgress = progress;
|
2019-01-23 18:03:33 +01:00
|
|
|
|
2016-06-24 12:27:15 +02:00
|
|
|
listView.setAlpha(progress);
|
2016-04-22 15:49:00 +02:00
|
|
|
|
2016-06-24 12:27:15 +02:00
|
|
|
listView.setTranslationX(AndroidUtilities.dp(48) - AndroidUtilities.dp(48) * progress);
|
2019-01-23 18:03:33 +01:00
|
|
|
|
2018-07-30 04:07:02 +02:00
|
|
|
int color = AvatarDrawable.getProfileBackColorForId(user_id != 0 || ChatObject.isChannel(chat_id, currentAccount) && !currentChat.megagroup ? 5 : chat_id);
|
2016-04-22 15:49:00 +02:00
|
|
|
|
2017-03-31 01:58:05 +02:00
|
|
|
int actionBarColor = Theme.getColor(Theme.key_actionBarDefault);
|
|
|
|
int r = Color.red(actionBarColor);
|
|
|
|
int g = Color.green(actionBarColor);
|
|
|
|
int b = Color.blue(actionBarColor);
|
|
|
|
int a;
|
2016-04-22 15:49:00 +02:00
|
|
|
|
|
|
|
int rD = (int) ((Color.red(color) - r) * progress);
|
|
|
|
int gD = (int) ((Color.green(color) - g) * progress);
|
|
|
|
int bD = (int) ((Color.blue(color) - b) * progress);
|
2017-03-31 01:58:05 +02:00
|
|
|
int aD;
|
2016-04-22 15:49:00 +02:00
|
|
|
topView.setBackgroundColor(Color.rgb(r + rD, g + gD, b + bD));
|
|
|
|
|
2018-07-30 04:07:02 +02:00
|
|
|
color = AvatarDrawable.getIconColorForId(user_id != 0 || ChatObject.isChannel(chat_id, currentAccount) && !currentChat.megagroup ? 5 : chat_id);
|
2017-03-31 01:58:05 +02:00
|
|
|
int iconColor = Theme.getColor(Theme.key_actionBarDefaultIcon);
|
|
|
|
r = Color.red(iconColor);
|
|
|
|
g = Color.green(iconColor);
|
|
|
|
b = Color.blue(iconColor);
|
2016-04-22 15:49:00 +02:00
|
|
|
|
|
|
|
rD = (int) ((Color.red(color) - r) * progress);
|
|
|
|
gD = (int) ((Color.green(color) - g) * progress);
|
|
|
|
bD = (int) ((Color.blue(color) - b) * progress);
|
2017-03-31 01:58:05 +02:00
|
|
|
actionBar.setItemsColor(Color.rgb(r + rD, g + gD, b + bD), false);
|
|
|
|
|
|
|
|
color = Theme.getColor(Theme.key_profile_title);
|
|
|
|
int titleColor = Theme.getColor(Theme.key_actionBarDefaultTitle);
|
|
|
|
r = Color.red(titleColor);
|
|
|
|
g = Color.green(titleColor);
|
|
|
|
b = Color.blue(titleColor);
|
|
|
|
a = Color.alpha(titleColor);
|
|
|
|
|
|
|
|
rD = (int) ((Color.red(color) - r) * progress);
|
|
|
|
gD = (int) ((Color.green(color) - g) * progress);
|
|
|
|
bD = (int) ((Color.blue(color) - b) * progress);
|
|
|
|
aD = (int) ((Color.alpha(color) - a) * progress);
|
|
|
|
for (int i = 0; i < 2; i++) {
|
|
|
|
if (nameTextView[i] == null) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
nameTextView[i].setTextColor(Color.argb(a + aD, r + rD, g + gD, b + bD));
|
|
|
|
}
|
|
|
|
|
2019-06-04 12:14:50 +02:00
|
|
|
color = isOnline[0] ? Theme.getColor(Theme.key_profile_status) : AvatarDrawable.getProfileTextColorForId(user_id != 0 || ChatObject.isChannel(chat_id, currentAccount) && !currentChat.megagroup ? 5 : chat_id);
|
|
|
|
int subtitleColor = Theme.getColor(isOnline[0] ? Theme.key_chat_status : Theme.key_actionBarDefaultSubtitle);
|
2017-03-31 01:58:05 +02:00
|
|
|
r = Color.red(subtitleColor);
|
|
|
|
g = Color.green(subtitleColor);
|
|
|
|
b = Color.blue(subtitleColor);
|
|
|
|
a = Color.alpha(subtitleColor);
|
|
|
|
|
|
|
|
rD = (int) ((Color.red(color) - r) * progress);
|
|
|
|
gD = (int) ((Color.green(color) - g) * progress);
|
|
|
|
bD = (int) ((Color.blue(color) - b) * progress);
|
|
|
|
aD = (int) ((Color.alpha(color) - a) * progress);
|
|
|
|
for (int i = 0; i < 2; i++) {
|
|
|
|
if (onlineTextView[i] == null) {
|
2015-11-26 22:04:02 +01:00
|
|
|
continue;
|
|
|
|
}
|
2017-03-31 01:58:05 +02:00
|
|
|
onlineTextView[i].setTextColor(Color.argb(a + aD, r + rD, g + gD, b + bD));
|
2015-11-26 22:04:02 +01:00
|
|
|
}
|
2015-10-29 18:10:07 +01:00
|
|
|
extraHeight = (int) (initialAnimationExtraHeight * progress);
|
2015-11-26 22:04:02 +01:00
|
|
|
color = AvatarDrawable.getProfileColorForId(user_id != 0 ? user_id : chat_id);
|
|
|
|
int color2 = AvatarDrawable.getColorForId(user_id != 0 ? user_id : chat_id);
|
|
|
|
if (color != color2) {
|
|
|
|
rD = (int) ((Color.red(color) - Color.red(color2)) * progress);
|
|
|
|
gD = (int) ((Color.green(color) - Color.green(color2)) * progress);
|
|
|
|
bD = (int) ((Color.blue(color) - Color.blue(color2)) * progress);
|
|
|
|
avatarDrawable.setColor(Color.rgb(Color.red(color2) + rD, Color.green(color2) + gD, Color.blue(color2) + bD));
|
|
|
|
avatarImage.invalidate();
|
|
|
|
}
|
|
|
|
|
2015-10-29 18:10:07 +01:00
|
|
|
needLayout();
|
|
|
|
}
|
|
|
|
|
2019-01-23 18:03:33 +01:00
|
|
|
/*@Override
|
|
|
|
protected AnimatorSet onCustomTransitionAnimation(final boolean isOpen, final Runnable callback) {
|
|
|
|
if (playProfileAnimation && allowProfileAnimation) {
|
|
|
|
final AnimatorSet animatorSet = new AnimatorSet();
|
|
|
|
animatorSet.setDuration(180);
|
|
|
|
listView.setLayerType(View.LAYER_TYPE_HARDWARE, null);
|
|
|
|
ActionBarMenu menu = actionBar.createMenu();
|
|
|
|
if (menu.getItem(10) == null) {
|
|
|
|
if (animatingItem == null) {
|
|
|
|
animatingItem = menu.addItem(10, R.drawable.ic_ab_other);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ArrayList<Animator> animators = new ArrayList<>();
|
|
|
|
if (isOpen) {
|
|
|
|
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) onlineTextView[1].getLayoutParams();
|
|
|
|
layoutParams.rightMargin = (int) (-21 * AndroidUtilities.density + AndroidUtilities.dp(8));
|
|
|
|
onlineTextView[1].setLayoutParams(layoutParams);
|
|
|
|
|
|
|
|
int width = (int) Math.ceil(AndroidUtilities.displaySize.x - AndroidUtilities.dp(118 + 8) + 21 * AndroidUtilities.density);
|
|
|
|
float width2 = nameTextView[1].getPaint().measureText(nameTextView[1].getText().toString()) * 1.12f + nameTextView[1].getSideDrawablesSize();
|
|
|
|
layoutParams = (FrameLayout.LayoutParams) nameTextView[1].getLayoutParams();
|
|
|
|
if (width < width2) {
|
|
|
|
layoutParams.width = (int) Math.ceil(width / 1.12f);
|
|
|
|
} else {
|
|
|
|
layoutParams.width = LayoutHelper.WRAP_CONTENT;
|
|
|
|
}
|
|
|
|
nameTextView[1].setLayoutParams(layoutParams);
|
|
|
|
|
|
|
|
initialAnimationExtraHeight = AndroidUtilities.dp(88);
|
|
|
|
fragmentView.setBackgroundColor(0);
|
|
|
|
setAnimationProgress(0);
|
|
|
|
|
|
|
|
animators.add(ObjectAnimator.ofFloat(this, "animationProgress", 0.0f, 1.0f));
|
|
|
|
|
|
|
|
listView.setAlpha(0.0f);
|
|
|
|
listView.setTranslationX(AndroidUtilities.dp(48));
|
|
|
|
animators.add(FastAnimator.ofView(listView).alpha(1.0f).translationX(0));
|
|
|
|
|
|
|
|
if (writeButton != null) {
|
|
|
|
writeButton.setScaleX(0.2f);
|
|
|
|
writeButton.setScaleY(0.2f);
|
|
|
|
writeButton.setAlpha(0.0f);
|
|
|
|
animators.add(FastAnimator.ofView(writeButton).scaleX(1.0f).scaleY(1.0f).alpha(1.0f));
|
|
|
|
}
|
|
|
|
for (int a = 0; a < 2; a++) {
|
|
|
|
onlineTextView[a].setAlpha(a == 0 ? 1.0f : 0.0f);
|
|
|
|
nameTextView[a].setAlpha(a == 0 ? 1.0f : 0.0f);
|
|
|
|
animators.add(FastAnimator.ofView(onlineTextView[a]).alpha(a == 0 ? 0.0f : 1.0f));
|
|
|
|
animators.add(FastAnimator.ofView(nameTextView[a]).alpha(a == 0 ? 0.0f : 1.0f));
|
|
|
|
}
|
|
|
|
if (animatingItem != null) {
|
|
|
|
animatingItem.setAlpha(1.0f);
|
|
|
|
animators.add(FastAnimator.ofView(animatingItem).alpha(0.0f));
|
|
|
|
}
|
|
|
|
if (callItem != null) {
|
|
|
|
callItem.setAlpha(0.0f);
|
|
|
|
animators.add(FastAnimator.ofView(callItem).alpha(1.0f));
|
|
|
|
}
|
|
|
|
if (editItem != null) {
|
|
|
|
editItem.setAlpha(0.0f);
|
|
|
|
animators.add(FastAnimator.ofView(editItem).alpha(1.0f));
|
|
|
|
}
|
|
|
|
animatorSet.playTogether(animators);
|
|
|
|
} else {
|
|
|
|
initialAnimationExtraHeight = extraHeight;
|
|
|
|
|
|
|
|
animators.add(ObjectAnimator.ofFloat(this, "animationProgress", 1.0f, 0.0f));
|
|
|
|
|
|
|
|
animators.add(FastAnimator.ofView(listView).alpha(0.0f).translationX(AndroidUtilities.dp(48)));
|
|
|
|
|
|
|
|
if (writeButton != null) {
|
|
|
|
animators.add(FastAnimator.ofView(writeButton).scaleX(0.2f).scaleY(0.2f).alpha(0.0f));
|
|
|
|
}
|
|
|
|
for (int a = 0; a < 2; a++) {
|
|
|
|
animators.add(FastAnimator.ofView(onlineTextView[a]).alpha(a == 0 ? 1.0f : 0.0f));
|
|
|
|
animators.add(FastAnimator.ofView(nameTextView[a]).alpha(a == 0 ? 1.0f : 0.0f));
|
|
|
|
}
|
|
|
|
if (animatingItem != null) {
|
|
|
|
animatingItem.setAlpha(0.0f);
|
|
|
|
animators.add(FastAnimator.ofView(animatingItem).alpha(1.0f));
|
|
|
|
}
|
|
|
|
if (callItem != null) {
|
|
|
|
callItem.setAlpha(1.0f);
|
|
|
|
animators.add(FastAnimator.ofView(callItem).alpha(0.0f));
|
|
|
|
}
|
|
|
|
if (editItem != null) {
|
|
|
|
editItem.setAlpha(1.0f);
|
|
|
|
animators.add(FastAnimator.ofView(editItem).alpha(0.0f));
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
animatorSet.setInterpolator(new DecelerateInterpolator());
|
|
|
|
animatorSet.playTogether(animators);
|
|
|
|
animators.get(0).addListener(new AnimatorListenerAdapter() {
|
|
|
|
@Override
|
|
|
|
public void onAnimationEnd(Animator animation) {
|
|
|
|
listView.setLayerType(View.LAYER_TYPE_NONE, null);
|
|
|
|
if (animatingItem != null) {
|
|
|
|
ActionBarMenu menu = actionBar.createMenu();
|
|
|
|
menu.clearItems();
|
|
|
|
animatingItem = null;
|
|
|
|
}
|
|
|
|
callback.run();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
AndroidUtilities.runOnUIThread(animatorSet::start, 50);
|
|
|
|
return animatorSet;
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}*/
|
|
|
|
|
2015-10-29 18:10:07 +01:00
|
|
|
@Override
|
2016-06-24 12:27:15 +02:00
|
|
|
protected AnimatorSet onCustomTransitionAnimation(final boolean isOpen, final Runnable callback) {
|
2016-05-25 23:49:47 +02:00
|
|
|
if (playProfileAnimation && allowProfileAnimation) {
|
2016-06-24 12:27:15 +02:00
|
|
|
final AnimatorSet animatorSet = new AnimatorSet();
|
2016-04-22 15:49:00 +02:00
|
|
|
animatorSet.setDuration(180);
|
2017-07-23 14:56:38 +02:00
|
|
|
listView.setLayerType(View.LAYER_TYPE_HARDWARE, null);
|
2015-11-26 22:04:02 +01:00
|
|
|
ActionBarMenu menu = actionBar.createMenu();
|
|
|
|
if (menu.getItem(10) == null) {
|
|
|
|
if (animatingItem == null) {
|
|
|
|
animatingItem = menu.addItem(10, R.drawable.ic_ab_other);
|
|
|
|
}
|
|
|
|
}
|
2015-10-29 18:10:07 +01:00
|
|
|
if (isOpen) {
|
2015-11-26 22:04:02 +01:00
|
|
|
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) onlineTextView[1].getLayoutParams();
|
|
|
|
layoutParams.rightMargin = (int) (-21 * AndroidUtilities.density + AndroidUtilities.dp(8));
|
|
|
|
onlineTextView[1].setLayoutParams(layoutParams);
|
|
|
|
|
|
|
|
int width = (int) Math.ceil(AndroidUtilities.displaySize.x - AndroidUtilities.dp(118 + 8) + 21 * AndroidUtilities.density);
|
2016-04-22 15:49:00 +02:00
|
|
|
float width2 = nameTextView[1].getPaint().measureText(nameTextView[1].getText().toString()) * 1.12f + nameTextView[1].getSideDrawablesSize();
|
2015-11-26 22:04:02 +01:00
|
|
|
layoutParams = (FrameLayout.LayoutParams) nameTextView[1].getLayoutParams();
|
|
|
|
if (width < width2) {
|
|
|
|
layoutParams.width = (int) Math.ceil(width / 1.12f);
|
|
|
|
} else {
|
|
|
|
layoutParams.width = LayoutHelper.WRAP_CONTENT;
|
|
|
|
}
|
|
|
|
nameTextView[1].setLayoutParams(layoutParams);
|
|
|
|
|
2015-10-29 18:10:07 +01:00
|
|
|
initialAnimationExtraHeight = AndroidUtilities.dp(88);
|
|
|
|
fragmentView.setBackgroundColor(0);
|
|
|
|
setAnimationProgress(0);
|
2016-06-24 12:27:15 +02:00
|
|
|
ArrayList<Animator> animators = new ArrayList<>();
|
|
|
|
animators.add(ObjectAnimator.ofFloat(this, "animationProgress", 0.0f, 1.0f));
|
2015-10-29 18:10:07 +01:00
|
|
|
if (writeButton != null) {
|
2016-06-24 12:27:15 +02:00
|
|
|
writeButton.setScaleX(0.2f);
|
|
|
|
writeButton.setScaleY(0.2f);
|
|
|
|
writeButton.setAlpha(0.0f);
|
2019-05-14 14:08:05 +02:00
|
|
|
animators.add(ObjectAnimator.ofFloat(writeButton, View.SCALE_X, 1.0f));
|
|
|
|
animators.add(ObjectAnimator.ofFloat(writeButton, View.SCALE_Y, 1.0f));
|
|
|
|
animators.add(ObjectAnimator.ofFloat(writeButton, View.ALPHA, 1.0f));
|
2015-10-29 18:10:07 +01:00
|
|
|
}
|
2015-11-26 22:04:02 +01:00
|
|
|
for (int a = 0; a < 2; a++) {
|
2016-06-24 12:27:15 +02:00
|
|
|
onlineTextView[a].setAlpha(a == 0 ? 1.0f : 0.0f);
|
|
|
|
nameTextView[a].setAlpha(a == 0 ? 1.0f : 0.0f);
|
2019-05-14 14:08:05 +02:00
|
|
|
animators.add(ObjectAnimator.ofFloat(onlineTextView[a], View.ALPHA, a == 0 ? 0.0f : 1.0f));
|
|
|
|
animators.add(ObjectAnimator.ofFloat(nameTextView[a], View.ALPHA, a == 0 ? 0.0f : 1.0f));
|
2015-11-26 22:04:02 +01:00
|
|
|
}
|
|
|
|
if (animatingItem != null) {
|
2016-06-24 12:27:15 +02:00
|
|
|
animatingItem.setAlpha(1.0f);
|
2019-05-14 14:08:05 +02:00
|
|
|
animators.add(ObjectAnimator.ofFloat(animatingItem, View.ALPHA, 0.0f));
|
2015-11-26 22:04:02 +01:00
|
|
|
}
|
2017-03-31 01:58:05 +02:00
|
|
|
if (callItem != null) {
|
|
|
|
callItem.setAlpha(0.0f);
|
2019-05-14 14:08:05 +02:00
|
|
|
animators.add(ObjectAnimator.ofFloat(callItem, View.ALPHA, 1.0f));
|
2017-03-31 01:58:05 +02:00
|
|
|
}
|
2017-07-08 18:32:04 +02:00
|
|
|
if (editItem != null) {
|
|
|
|
editItem.setAlpha(0.0f);
|
2019-05-14 14:08:05 +02:00
|
|
|
animators.add(ObjectAnimator.ofFloat(editItem, View.ALPHA, 1.0f));
|
2017-07-08 18:32:04 +02:00
|
|
|
}
|
2015-10-29 18:10:07 +01:00
|
|
|
animatorSet.playTogether(animators);
|
|
|
|
} else {
|
|
|
|
initialAnimationExtraHeight = extraHeight;
|
2016-06-24 12:27:15 +02:00
|
|
|
ArrayList<Animator> animators = new ArrayList<>();
|
|
|
|
animators.add(ObjectAnimator.ofFloat(this, "animationProgress", 1.0f, 0.0f));
|
2015-10-29 18:10:07 +01:00
|
|
|
if (writeButton != null) {
|
2019-05-14 14:08:05 +02:00
|
|
|
animators.add(ObjectAnimator.ofFloat(writeButton, View.SCALE_X, 0.2f));
|
|
|
|
animators.add(ObjectAnimator.ofFloat(writeButton, View.SCALE_Y, 0.2f));
|
|
|
|
animators.add(ObjectAnimator.ofFloat(writeButton, View.ALPHA, 0.0f));
|
2015-10-29 18:10:07 +01:00
|
|
|
}
|
2015-11-26 22:04:02 +01:00
|
|
|
for (int a = 0; a < 2; a++) {
|
2019-05-14 14:08:05 +02:00
|
|
|
animators.add(ObjectAnimator.ofFloat(onlineTextView[a], View.ALPHA, a == 0 ? 1.0f : 0.0f));
|
|
|
|
animators.add(ObjectAnimator.ofFloat(nameTextView[a], View.ALPHA, a == 0 ? 1.0f : 0.0f));
|
2015-11-26 22:04:02 +01:00
|
|
|
}
|
|
|
|
if (animatingItem != null) {
|
2016-06-24 12:27:15 +02:00
|
|
|
animatingItem.setAlpha(0.0f);
|
2019-05-14 14:08:05 +02:00
|
|
|
animators.add(ObjectAnimator.ofFloat(animatingItem, View.ALPHA, 1.0f));
|
2015-11-26 22:04:02 +01:00
|
|
|
}
|
2017-03-31 01:58:05 +02:00
|
|
|
if (callItem != null) {
|
|
|
|
callItem.setAlpha(1.0f);
|
2019-05-14 14:08:05 +02:00
|
|
|
animators.add(ObjectAnimator.ofFloat(callItem, View.ALPHA, 0.0f));
|
2017-03-31 01:58:05 +02:00
|
|
|
}
|
2017-07-08 18:32:04 +02:00
|
|
|
if (editItem != null) {
|
|
|
|
editItem.setAlpha(1.0f);
|
2019-05-14 14:08:05 +02:00
|
|
|
animators.add(ObjectAnimator.ofFloat(editItem, View.ALPHA, 0.0f));
|
2017-07-08 18:32:04 +02:00
|
|
|
}
|
2015-10-29 18:10:07 +01:00
|
|
|
animatorSet.playTogether(animators);
|
|
|
|
}
|
2017-03-31 01:58:05 +02:00
|
|
|
animatorSet.addListener(new AnimatorListenerAdapter() {
|
2015-10-29 18:10:07 +01:00
|
|
|
@Override
|
2016-06-24 12:27:15 +02:00
|
|
|
public void onAnimationEnd(Animator animation) {
|
2017-07-23 14:56:38 +02:00
|
|
|
listView.setLayerType(View.LAYER_TYPE_NONE, null);
|
2015-11-26 22:04:02 +01:00
|
|
|
if (animatingItem != null) {
|
|
|
|
ActionBarMenu menu = actionBar.createMenu();
|
|
|
|
menu.clearItems();
|
|
|
|
animatingItem = null;
|
|
|
|
}
|
2015-10-29 18:10:07 +01:00
|
|
|
callback.run();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
animatorSet.setInterpolator(new DecelerateInterpolator());
|
|
|
|
|
2018-08-27 10:33:11 +02:00
|
|
|
AndroidUtilities.runOnUIThread(animatorSet::start, 50);
|
2015-10-29 18:10:07 +01:00
|
|
|
return animatorSet;
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2014-11-12 23:16:59 +01:00
|
|
|
private void updateOnlineCount() {
|
2015-10-29 18:10:07 +01:00
|
|
|
onlineCount = 0;
|
2018-07-30 04:07:02 +02:00
|
|
|
int currentTime = ConnectionsManager.getInstance(currentAccount).getCurrentTime();
|
2014-11-12 23:16:59 +01:00
|
|
|
sortedUsers.clear();
|
2019-01-23 18:03:33 +01:00
|
|
|
if (chatInfo instanceof TLRPC.TL_chatFull || chatInfo instanceof TLRPC.TL_channelFull && chatInfo.participants_count <= 200 && chatInfo.participants != null) {
|
|
|
|
for (int a = 0; a < chatInfo.participants.participants.size(); a++) {
|
|
|
|
TLRPC.ChatParticipant participant = chatInfo.participants.participants.get(a);
|
2018-07-30 04:07:02 +02:00
|
|
|
TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(participant.user_id);
|
|
|
|
if (user != null && user.status != null && (user.status.expires > currentTime || user.id == UserConfig.getInstance(currentAccount).getClientUserId()) && user.status.expires > 10000) {
|
2016-03-16 13:26:32 +01:00
|
|
|
onlineCount++;
|
|
|
|
}
|
|
|
|
sortedUsers.add(a);
|
|
|
|
}
|
2014-11-12 23:16:59 +01:00
|
|
|
|
2016-03-16 13:26:32 +01:00
|
|
|
try {
|
2018-08-27 10:33:11 +02:00
|
|
|
Collections.sort(sortedUsers, (lhs, rhs) -> {
|
2019-01-23 18:03:33 +01:00
|
|
|
TLRPC.User user1 = MessagesController.getInstance(currentAccount).getUser(chatInfo.participants.participants.get(rhs).user_id);
|
|
|
|
TLRPC.User user2 = MessagesController.getInstance(currentAccount).getUser(chatInfo.participants.participants.get(lhs).user_id);
|
2018-08-27 10:33:11 +02:00
|
|
|
int status1 = 0;
|
|
|
|
int status2 = 0;
|
2019-01-23 18:03:33 +01:00
|
|
|
if (user1 != null) {
|
|
|
|
if (user1.bot) {
|
|
|
|
status1 = -110;
|
|
|
|
} else if (user1.self) {
|
|
|
|
status1 = currentTime + 50000;
|
|
|
|
} else if (user1.status != null) {
|
2018-08-27 10:33:11 +02:00
|
|
|
status1 = user1.status.expires;
|
2015-01-02 23:15:07 +01:00
|
|
|
}
|
2018-08-27 10:33:11 +02:00
|
|
|
}
|
2019-01-23 18:03:33 +01:00
|
|
|
if (user2 != null) {
|
|
|
|
if (user2.bot) {
|
|
|
|
status2 = -110;
|
|
|
|
} else if (user2.self) {
|
|
|
|
status2 = currentTime + 50000;
|
|
|
|
} else if (user2.status != null) {
|
2018-08-27 10:33:11 +02:00
|
|
|
status2 = user2.status.expires;
|
2015-01-02 23:15:07 +01:00
|
|
|
}
|
2018-08-27 10:33:11 +02:00
|
|
|
}
|
|
|
|
if (status1 > 0 && status2 > 0) {
|
|
|
|
if (status1 > status2) {
|
|
|
|
return 1;
|
|
|
|
} else if (status1 < status2) {
|
2015-01-02 23:15:07 +01:00
|
|
|
return -1;
|
2018-08-27 10:33:11 +02:00
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
} else if (status1 < 0 && status2 < 0) {
|
|
|
|
if (status1 > status2) {
|
2015-01-02 23:15:07 +01:00
|
|
|
return 1;
|
2018-08-27 10:33:11 +02:00
|
|
|
} else if (status1 < status2) {
|
|
|
|
return -1;
|
2015-01-02 23:15:07 +01:00
|
|
|
}
|
|
|
|
return 0;
|
2018-08-27 10:33:11 +02:00
|
|
|
} else if (status1 < 0 && status2 > 0 || status1 == 0 && status2 != 0) {
|
|
|
|
return -1;
|
|
|
|
} else if (status2 < 0 && status1 > 0 || status2 == 0 && status1 != 0) {
|
|
|
|
return 1;
|
2014-11-20 15:45:33 +01:00
|
|
|
}
|
2018-08-27 10:33:11 +02:00
|
|
|
return 0;
|
2016-03-16 13:26:32 +01:00
|
|
|
});
|
|
|
|
} catch (Exception e) {
|
2017-03-31 01:58:05 +02:00
|
|
|
FileLog.e(e);
|
2016-03-16 13:26:32 +01:00
|
|
|
}
|
2015-01-02 23:15:07 +01:00
|
|
|
|
2019-01-23 18:03:33 +01:00
|
|
|
if (listAdapter != null && membersStartRow > 0) {
|
|
|
|
listAdapter.notifyItemRangeChanged(membersStartRow, sortedUsers.size());
|
2016-03-16 13:26:32 +01:00
|
|
|
}
|
2019-01-23 18:03:33 +01:00
|
|
|
} else if (chatInfo instanceof TLRPC.TL_channelFull && chatInfo.participants_count > 200) {
|
|
|
|
onlineCount = chatInfo.online_count;
|
2014-11-12 23:16:59 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-01-23 18:03:33 +01:00
|
|
|
public void setChatInfo(TLRPC.ChatFull value) {
|
|
|
|
chatInfo = value;
|
|
|
|
if (chatInfo != null && chatInfo.migrated_from_chat_id != 0 && mergeDialogId == 0) {
|
|
|
|
mergeDialogId = -chatInfo.migrated_from_chat_id;
|
2019-07-18 15:01:39 +02:00
|
|
|
MediaDataController.getInstance(currentAccount).getMediaCounts(mergeDialogId, classGuid);
|
2015-11-26 22:04:02 +01:00
|
|
|
}
|
|
|
|
fetchUsersFromChannelInfo();
|
|
|
|
}
|
|
|
|
|
2019-05-14 14:08:05 +02:00
|
|
|
public void setUserInfo(TLRPC.UserFull value) {
|
2019-01-23 18:03:33 +01:00
|
|
|
userInfo = value;
|
|
|
|
}
|
|
|
|
|
2015-11-26 22:04:02 +01:00
|
|
|
private void fetchUsersFromChannelInfo() {
|
2017-07-08 18:32:04 +02:00
|
|
|
if (currentChat == null || !currentChat.megagroup) {
|
|
|
|
return;
|
|
|
|
}
|
2019-01-23 18:03:33 +01:00
|
|
|
if (chatInfo instanceof TLRPC.TL_channelFull && chatInfo.participants != null) {
|
|
|
|
for (int a = 0; a < chatInfo.participants.participants.size(); a++) {
|
|
|
|
TLRPC.ChatParticipant chatParticipant = chatInfo.participants.participants.get(a);
|
2016-03-16 13:26:32 +01:00
|
|
|
participantsMap.put(chatParticipant.user_id, chatParticipant);
|
2015-11-26 22:04:02 +01:00
|
|
|
}
|
|
|
|
}
|
2014-11-12 23:16:59 +01:00
|
|
|
}
|
|
|
|
|
2015-11-26 22:04:02 +01:00
|
|
|
private void kickUser(int uid) {
|
|
|
|
if (uid != 0) {
|
2019-01-23 18:03:33 +01:00
|
|
|
MessagesController.getInstance(currentAccount).deleteUserFromChat(chat_id, MessagesController.getInstance(currentAccount).getUser(uid), chatInfo);
|
2014-11-10 12:05:22 +01:00
|
|
|
} else {
|
2018-07-30 04:07:02 +02:00
|
|
|
NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.closeChats);
|
2015-09-24 22:52:02 +02:00
|
|
|
if (AndroidUtilities.isTablet()) {
|
2018-07-30 04:07:02 +02:00
|
|
|
NotificationCenter.getInstance(currentAccount).postNotificationName(NotificationCenter.closeChats, -(long) chat_id);
|
2015-09-24 22:52:02 +02:00
|
|
|
} else {
|
2018-07-30 04:07:02 +02:00
|
|
|
NotificationCenter.getInstance(currentAccount).postNotificationName(NotificationCenter.closeChats);
|
2015-09-24 22:52:02 +02:00
|
|
|
}
|
2019-01-23 18:03:33 +01:00
|
|
|
MessagesController.getInstance(currentAccount).deleteUserFromChat(chat_id, MessagesController.getInstance(currentAccount).getUser(UserConfig.getInstance(currentAccount).getClientUserId()), chatInfo);
|
2015-10-29 18:10:07 +01:00
|
|
|
playProfileAnimation = false;
|
2014-11-12 23:16:59 +01:00
|
|
|
finishFragment();
|
2014-11-10 12:05:22 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-11-12 23:16:59 +01:00
|
|
|
public boolean isChat() {
|
|
|
|
return chat_id != 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
private void updateRowsIds() {
|
2019-01-23 18:03:33 +01:00
|
|
|
rowCount = 0;
|
|
|
|
|
2016-03-16 13:26:32 +01:00
|
|
|
emptyRow = -1;
|
2019-01-23 18:03:33 +01:00
|
|
|
infoHeaderRow = -1;
|
2016-03-16 13:26:32 +01:00
|
|
|
phoneRow = -1;
|
|
|
|
userInfoRow = -1;
|
2019-07-18 15:01:39 +02:00
|
|
|
locationRow = -1;
|
2019-01-23 18:03:33 +01:00
|
|
|
channelInfoRow = -1;
|
2016-03-16 13:26:32 +01:00
|
|
|
usernameRow = -1;
|
|
|
|
settingsTimerRow = -1;
|
|
|
|
settingsKeyRow = -1;
|
2019-01-23 18:03:33 +01:00
|
|
|
notificationsDividerRow = -1;
|
|
|
|
notificationsRow = -1;
|
|
|
|
infoSectionRow = -1;
|
|
|
|
settingsSectionRow = -1;
|
|
|
|
|
|
|
|
membersHeaderRow = -1;
|
|
|
|
membersStartRow = -1;
|
2016-03-16 13:26:32 +01:00
|
|
|
membersEndRow = -1;
|
|
|
|
addMemberRow = -1;
|
2019-01-23 18:03:33 +01:00
|
|
|
subscribersRow = -1;
|
|
|
|
administratorsRow = -1;
|
|
|
|
blockedUsersRow = -1;
|
2016-03-16 13:26:32 +01:00
|
|
|
membersSectionRow = -1;
|
2019-01-23 18:03:33 +01:00
|
|
|
|
|
|
|
sharedHeaderRow = -1;
|
|
|
|
photosRow = -1;
|
|
|
|
filesRow = -1;
|
|
|
|
linksRow = -1;
|
|
|
|
audioRow = -1;
|
|
|
|
voiceRow = -1;
|
2017-03-31 01:58:05 +02:00
|
|
|
groupsInCommonRow = -1;
|
2019-01-23 18:03:33 +01:00
|
|
|
sharedSectionRow = -1;
|
|
|
|
|
2019-06-04 12:14:50 +02:00
|
|
|
unblockRow = -1;
|
2019-01-23 18:03:33 +01:00
|
|
|
startSecretChatRow = -1;
|
|
|
|
leaveChannelRow = -1;
|
|
|
|
joinRow = -1;
|
|
|
|
lastSectionRow = -1;
|
|
|
|
|
|
|
|
boolean hasMedia = false;
|
|
|
|
for (int a = 0; a < lastMediaCount.length; a++) {
|
|
|
|
if (lastMediaCount[a] > 0) {
|
|
|
|
hasMedia = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (user_id != 0 && LocaleController.isRTL) {
|
|
|
|
emptyRow = rowCount++;
|
|
|
|
}
|
2016-03-16 13:26:32 +01:00
|
|
|
|
2014-11-12 23:16:59 +01:00
|
|
|
if (user_id != 0) {
|
2018-07-30 04:07:02 +02:00
|
|
|
TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(user_id);
|
2019-01-23 18:03:33 +01:00
|
|
|
|
|
|
|
boolean hasInfo = userInfo != null && !TextUtils.isEmpty(userInfo.about) || user != null && !TextUtils.isEmpty(user.username);
|
|
|
|
boolean hasPhone = user != null && !TextUtils.isEmpty(user.phone);
|
|
|
|
|
|
|
|
infoHeaderRow = rowCount++;
|
|
|
|
if (!isBot && (hasPhone || !hasPhone && !hasInfo)) {
|
2015-06-29 19:12:11 +02:00
|
|
|
phoneRow = rowCount++;
|
|
|
|
}
|
2019-01-23 18:03:33 +01:00
|
|
|
if (userInfo != null && !TextUtils.isEmpty(userInfo.about)) {
|
|
|
|
userInfoRow = rowCount++;
|
2017-07-23 14:56:38 +02:00
|
|
|
}
|
2019-01-23 18:03:33 +01:00
|
|
|
if (user != null && !TextUtils.isEmpty(user.username)) {
|
2017-07-23 14:56:38 +02:00
|
|
|
usernameRow = rowCount++;
|
2015-06-29 19:12:11 +02:00
|
|
|
}
|
2019-01-23 18:03:33 +01:00
|
|
|
if (phoneRow != -1 || userInfoRow != -1 || usernameRow != -1) {
|
|
|
|
notificationsDividerRow = rowCount++;
|
2017-07-23 19:29:17 +02:00
|
|
|
}
|
2018-07-30 04:07:02 +02:00
|
|
|
if (user_id != UserConfig.getInstance(currentAccount).getClientUserId()) {
|
2019-01-23 18:03:33 +01:00
|
|
|
notificationsRow = rowCount++;
|
2016-10-11 13:57:01 +02:00
|
|
|
}
|
2019-01-23 18:03:33 +01:00
|
|
|
infoSectionRow = rowCount++;
|
|
|
|
|
2014-11-12 23:16:59 +01:00
|
|
|
if (currentEncryptedChat instanceof TLRPC.TL_encryptedChat) {
|
|
|
|
settingsTimerRow = rowCount++;
|
|
|
|
settingsKeyRow = rowCount++;
|
2019-01-23 18:03:33 +01:00
|
|
|
settingsSectionRow = rowCount++;
|
2014-11-12 23:16:59 +01:00
|
|
|
}
|
2019-01-23 18:03:33 +01:00
|
|
|
|
|
|
|
if (hasMedia || userInfo != null && userInfo.common_chats_count != 0) {
|
|
|
|
sharedHeaderRow = rowCount++;
|
2019-07-18 15:01:39 +02:00
|
|
|
if (lastMediaCount[MediaDataController.MEDIA_PHOTOVIDEO] > 0) {
|
2019-01-23 18:03:33 +01:00
|
|
|
photosRow = rowCount++;
|
|
|
|
} else {
|
|
|
|
photosRow = -1;
|
|
|
|
}
|
2019-07-18 15:01:39 +02:00
|
|
|
if (lastMediaCount[MediaDataController.MEDIA_FILE] > 0) {
|
2019-01-23 18:03:33 +01:00
|
|
|
filesRow = rowCount++;
|
|
|
|
} else {
|
|
|
|
filesRow = -1;
|
|
|
|
}
|
2019-07-18 15:01:39 +02:00
|
|
|
if (lastMediaCount[MediaDataController.MEDIA_URL] > 0) {
|
2019-01-23 18:03:33 +01:00
|
|
|
linksRow = rowCount++;
|
|
|
|
} else {
|
|
|
|
linksRow = -1;
|
|
|
|
}
|
2019-07-18 15:01:39 +02:00
|
|
|
if (lastMediaCount[MediaDataController.MEDIA_MUSIC] > 0) {
|
2019-01-23 18:03:33 +01:00
|
|
|
audioRow = rowCount++;
|
|
|
|
} else {
|
|
|
|
audioRow = -1;
|
|
|
|
}
|
2019-07-18 15:01:39 +02:00
|
|
|
if (lastMediaCount[MediaDataController.MEDIA_AUDIO] > 0) {
|
2019-01-23 18:03:33 +01:00
|
|
|
voiceRow = rowCount++;
|
|
|
|
} else {
|
|
|
|
voiceRow = -1;
|
|
|
|
}
|
|
|
|
if (userInfo != null && userInfo.common_chats_count != 0) {
|
|
|
|
groupsInCommonRow = rowCount++;
|
|
|
|
}
|
|
|
|
sharedSectionRow = rowCount++;
|
2017-03-31 01:58:05 +02:00
|
|
|
}
|
2019-01-23 18:03:33 +01:00
|
|
|
|
2018-07-30 04:07:02 +02:00
|
|
|
if (user != null && !isBot && currentEncryptedChat == null && user.id != UserConfig.getInstance(currentAccount).getClientUserId()) {
|
2019-06-04 12:14:50 +02:00
|
|
|
if (userBlocked) {
|
|
|
|
unblockRow = rowCount++;
|
|
|
|
} else {
|
|
|
|
startSecretChatRow = rowCount++;
|
|
|
|
}
|
2019-01-23 18:03:33 +01:00
|
|
|
lastSectionRow = rowCount++;
|
2014-11-12 23:16:59 +01:00
|
|
|
}
|
|
|
|
} else if (chat_id != 0) {
|
|
|
|
if (chat_id > 0) {
|
2019-07-18 15:01:39 +02:00
|
|
|
if (chatInfo != null && (!TextUtils.isEmpty(chatInfo.about) || chatInfo.location instanceof TLRPC.TL_channelLocation) || !TextUtils.isEmpty(currentChat.username)) {
|
2019-01-23 18:03:33 +01:00
|
|
|
infoHeaderRow = rowCount++;
|
2019-07-18 15:01:39 +02:00
|
|
|
if (chatInfo != null) {
|
|
|
|
if (!TextUtils.isEmpty(chatInfo.about)) {
|
|
|
|
channelInfoRow = rowCount++;
|
|
|
|
}
|
|
|
|
if (chatInfo.location instanceof TLRPC.TL_channelLocation) {
|
|
|
|
locationRow = rowCount++;
|
|
|
|
}
|
2015-09-24 22:52:02 +02:00
|
|
|
}
|
2019-01-23 18:03:33 +01:00
|
|
|
if (!TextUtils.isEmpty(currentChat.username)) {
|
|
|
|
usernameRow = rowCount++;
|
2015-09-24 22:52:02 +02:00
|
|
|
}
|
|
|
|
}
|
2019-07-18 15:01:39 +02:00
|
|
|
if (infoHeaderRow != -1) {
|
2019-01-23 18:03:33 +01:00
|
|
|
notificationsDividerRow = rowCount++;
|
|
|
|
}
|
|
|
|
notificationsRow = rowCount++;
|
|
|
|
infoSectionRow = rowCount++;
|
|
|
|
|
|
|
|
if (ChatObject.isChannel(currentChat) && !currentChat.megagroup) {
|
|
|
|
if (chatInfo != null && (currentChat.creator || chatInfo.can_view_participants)) {
|
|
|
|
membersHeaderRow = rowCount++;
|
|
|
|
subscribersRow = rowCount++;
|
|
|
|
administratorsRow = rowCount++;
|
2019-06-04 12:14:50 +02:00
|
|
|
if (chatInfo.banned_count != 0 || chatInfo.kicked_count != 0) {
|
|
|
|
blockedUsersRow = rowCount++;
|
|
|
|
}
|
2019-01-23 18:03:33 +01:00
|
|
|
membersSectionRow = rowCount++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (hasMedia) {
|
|
|
|
sharedHeaderRow = rowCount++;
|
2019-07-18 15:01:39 +02:00
|
|
|
if (lastMediaCount[MediaDataController.MEDIA_PHOTOVIDEO] > 0) {
|
2019-01-23 18:03:33 +01:00
|
|
|
photosRow = rowCount++;
|
|
|
|
} else {
|
|
|
|
photosRow = -1;
|
|
|
|
}
|
2019-07-18 15:01:39 +02:00
|
|
|
if (lastMediaCount[MediaDataController.MEDIA_FILE] > 0) {
|
2019-01-23 18:03:33 +01:00
|
|
|
filesRow = rowCount++;
|
|
|
|
} else {
|
|
|
|
filesRow = -1;
|
|
|
|
}
|
2019-07-18 15:01:39 +02:00
|
|
|
if (lastMediaCount[MediaDataController.MEDIA_URL] > 0) {
|
2019-01-23 18:03:33 +01:00
|
|
|
linksRow = rowCount++;
|
|
|
|
} else {
|
|
|
|
linksRow = -1;
|
|
|
|
}
|
2019-07-18 15:01:39 +02:00
|
|
|
if (lastMediaCount[MediaDataController.MEDIA_MUSIC] > 0) {
|
2019-01-23 18:03:33 +01:00
|
|
|
audioRow = rowCount++;
|
|
|
|
} else {
|
|
|
|
audioRow = -1;
|
2015-09-24 22:52:02 +02:00
|
|
|
}
|
2019-07-18 15:01:39 +02:00
|
|
|
if (lastMediaCount[MediaDataController.MEDIA_AUDIO] > 0) {
|
2019-01-23 18:03:33 +01:00
|
|
|
voiceRow = rowCount++;
|
|
|
|
} else {
|
|
|
|
voiceRow = -1;
|
|
|
|
}
|
|
|
|
sharedSectionRow = rowCount++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ChatObject.isChannel(currentChat)) {
|
2015-11-26 22:04:02 +01:00
|
|
|
if (!currentChat.creator && !currentChat.left && !currentChat.kicked && !currentChat.megagroup) {
|
|
|
|
leaveChannelRow = rowCount++;
|
2019-01-23 18:03:33 +01:00
|
|
|
lastSectionRow = rowCount++;
|
2015-11-26 22:04:02 +01:00
|
|
|
}
|
2019-01-23 18:03:33 +01:00
|
|
|
if (chatInfo != null && currentChat.megagroup && chatInfo.participants != null && !chatInfo.participants.participants.isEmpty()) {
|
2019-05-14 14:08:05 +02:00
|
|
|
if (!ChatObject.isNotInChat(currentChat) && currentChat.megagroup && ChatObject.canAddUsers(currentChat) && (chatInfo == null || chatInfo.participants_count < MessagesController.getInstance(currentAccount).maxMegagroupCount)) {
|
2015-11-26 22:04:02 +01:00
|
|
|
addMemberRow = rowCount++;
|
2019-01-23 18:03:33 +01:00
|
|
|
} else {
|
|
|
|
membersHeaderRow = rowCount++;
|
2015-11-26 22:04:02 +01:00
|
|
|
}
|
2019-01-23 18:03:33 +01:00
|
|
|
membersStartRow = rowCount;
|
|
|
|
rowCount += chatInfo.participants.participants.size();
|
2015-11-26 22:04:02 +01:00
|
|
|
membersEndRow = rowCount;
|
2019-01-23 18:03:33 +01:00
|
|
|
membersSectionRow = rowCount++;
|
2015-09-24 22:52:02 +02:00
|
|
|
}
|
2015-11-26 22:04:02 +01:00
|
|
|
|
2019-01-23 18:03:33 +01:00
|
|
|
if (lastSectionRow == -1 && currentChat.left && !currentChat.kicked) {
|
|
|
|
joinRow = rowCount++;
|
|
|
|
lastSectionRow = rowCount++;
|
2015-11-26 22:04:02 +01:00
|
|
|
}
|
2019-01-23 18:03:33 +01:00
|
|
|
} else if (chatInfo != null) {
|
|
|
|
if (!(chatInfo.participants instanceof TLRPC.TL_chatParticipantsForbidden)) {
|
|
|
|
if (ChatObject.canAddUsers(currentChat) || currentChat.default_banned_rights == null || !currentChat.default_banned_rights.invite_users) {
|
|
|
|
addMemberRow = rowCount++;
|
|
|
|
} else {
|
|
|
|
membersHeaderRow = rowCount++;
|
|
|
|
}
|
|
|
|
membersStartRow = rowCount;
|
|
|
|
rowCount += chatInfo.participants.participants.size();
|
2015-11-26 22:04:02 +01:00
|
|
|
membersEndRow = rowCount;
|
2019-01-23 18:03:33 +01:00
|
|
|
membersSectionRow = rowCount++;
|
2015-11-26 22:04:02 +01:00
|
|
|
}
|
2015-09-24 22:52:02 +02:00
|
|
|
}
|
2019-01-23 18:03:33 +01:00
|
|
|
} else if (!ChatObject.isChannel(currentChat) && chatInfo != null && !(chatInfo.participants instanceof TLRPC.TL_chatParticipantsForbidden)) {
|
|
|
|
membersHeaderRow = rowCount++;
|
|
|
|
membersStartRow = rowCount;
|
|
|
|
rowCount += chatInfo.participants.participants.size();
|
|
|
|
membersEndRow = rowCount;
|
|
|
|
membersSectionRow = rowCount++;
|
|
|
|
addMemberRow = rowCount++;
|
2014-11-12 23:16:59 +01:00
|
|
|
}
|
2014-11-10 12:05:22 +01:00
|
|
|
}
|
2014-11-12 23:16:59 +01:00
|
|
|
}
|
2014-11-10 12:05:22 +01:00
|
|
|
|
2019-05-14 14:08:05 +02:00
|
|
|
private Drawable getScamDrawable() {
|
|
|
|
if (scamDrawable == null) {
|
|
|
|
scamDrawable = new ScamDrawable(11);
|
|
|
|
scamDrawable.setColor(AvatarDrawable.getProfileTextColorForId(user_id != 0 || ChatObject.isChannel(chat_id, currentAccount) && !currentChat.megagroup ? 5 : chat_id));
|
|
|
|
}
|
|
|
|
return scamDrawable;
|
|
|
|
}
|
|
|
|
|
2014-11-12 23:16:59 +01:00
|
|
|
private void updateProfileData() {
|
2015-05-03 13:48:36 +02:00
|
|
|
if (avatarImage == null || nameTextView == null) {
|
2014-11-17 03:44:57 +01:00
|
|
|
return;
|
|
|
|
}
|
2017-12-08 18:35:59 +01:00
|
|
|
String onlineTextOverride;
|
2018-07-30 04:07:02 +02:00
|
|
|
int currentConnectionState = ConnectionsManager.getInstance(currentAccount).getConnectionState();
|
2017-12-08 18:35:59 +01:00
|
|
|
if (currentConnectionState == ConnectionsManager.ConnectionStateWaitingForNetwork) {
|
|
|
|
onlineTextOverride = LocaleController.getString("WaitingForNetwork", R.string.WaitingForNetwork);
|
|
|
|
} else if (currentConnectionState == ConnectionsManager.ConnectionStateConnecting) {
|
|
|
|
onlineTextOverride = LocaleController.getString("Connecting", R.string.Connecting);
|
|
|
|
} else if (currentConnectionState == ConnectionsManager.ConnectionStateUpdating) {
|
|
|
|
onlineTextOverride = LocaleController.getString("Updating", R.string.Updating);
|
|
|
|
} else if (currentConnectionState == ConnectionsManager.ConnectionStateConnectingToProxy) {
|
|
|
|
onlineTextOverride = LocaleController.getString("ConnectingToProxy", R.string.ConnectingToProxy);
|
|
|
|
} else {
|
|
|
|
onlineTextOverride = null;
|
|
|
|
}
|
|
|
|
|
2019-06-18 07:55:59 +02:00
|
|
|
int id = 0;
|
2014-11-12 23:16:59 +01:00
|
|
|
if (user_id != 0) {
|
2018-07-30 04:07:02 +02:00
|
|
|
TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(user_id);
|
2014-11-12 23:16:59 +01:00
|
|
|
TLRPC.FileLocation photoBig = null;
|
|
|
|
if (user.photo != null) {
|
|
|
|
photoBig = user.photo.photo_big;
|
|
|
|
}
|
2015-11-26 22:04:02 +01:00
|
|
|
avatarDrawable.setInfo(user);
|
2019-05-14 14:08:05 +02:00
|
|
|
avatarImage.setImage(ImageLocation.getForUser(user, false), "50_50", avatarDrawable, user);
|
|
|
|
FileLoader.getInstance(currentAccount).loadFile(ImageLocation.getForUser(user, true), user, null, 0, 1);
|
2014-11-10 12:05:22 +01:00
|
|
|
|
2015-11-26 22:04:02 +01:00
|
|
|
String newString = UserObject.getUserName(user);
|
|
|
|
String newString2;
|
2018-07-30 04:07:02 +02:00
|
|
|
if (user.id == UserConfig.getInstance(currentAccount).getClientUserId()) {
|
2016-10-11 13:57:01 +02:00
|
|
|
newString2 = LocaleController.getString("ChatYourSelf", R.string.ChatYourSelf);
|
|
|
|
newString = LocaleController.getString("ChatYourSelfName", R.string.ChatYourSelfName);
|
2019-03-03 21:40:48 +01:00
|
|
|
} else if (user.id == 333000 || user.id == 777000 || user.id == 42777) {
|
2015-11-26 22:04:02 +01:00
|
|
|
newString2 = LocaleController.getString("ServiceNotifications", R.string.ServiceNotifications);
|
2019-03-03 21:40:48 +01:00
|
|
|
} else if (MessagesController.isSupportUser(user)) {
|
|
|
|
newString2 = LocaleController.getString("SupportStatus", R.string.SupportStatus);
|
2017-12-08 18:35:59 +01:00
|
|
|
} else if (isBot) {
|
2015-11-26 22:04:02 +01:00
|
|
|
newString2 = LocaleController.getString("Bot", R.string.Bot);
|
2015-02-01 19:51:02 +01:00
|
|
|
} else {
|
2019-06-04 12:14:50 +02:00
|
|
|
isOnline[0] = false;
|
|
|
|
newString2 = LocaleController.formatUserStatus(currentAccount, user, isOnline);
|
|
|
|
if (onlineTextView[1] != null) {
|
|
|
|
String key = isOnline[0] ? Theme.key_profile_status : Theme.key_avatar_subtitleInProfileBlue;
|
|
|
|
onlineTextView[1].setTag(key);
|
|
|
|
onlineTextView[1].setTextColor(Theme.getColor(key));
|
|
|
|
}
|
2015-02-01 19:51:02 +01:00
|
|
|
}
|
2015-11-26 22:04:02 +01:00
|
|
|
for (int a = 0; a < 2; a++) {
|
|
|
|
if (nameTextView[a] == null) {
|
|
|
|
continue;
|
|
|
|
}
|
2019-06-18 07:36:47 +02:00
|
|
|
if (!nameTextView[a].getText().equals(newString)) {
|
|
|
|
nameTextView[a].setText(newString);
|
2015-11-26 22:04:02 +01:00
|
|
|
}
|
2017-12-08 18:35:59 +01:00
|
|
|
if (a == 0 && onlineTextOverride != null) {
|
|
|
|
onlineTextView[a].setText(onlineTextOverride);
|
|
|
|
} else {
|
|
|
|
if (!onlineTextView[a].getText().equals(newString2)) {
|
|
|
|
onlineTextView[a].setText(newString2);
|
|
|
|
}
|
2015-11-26 22:04:02 +01:00
|
|
|
}
|
2017-03-31 01:58:05 +02:00
|
|
|
Drawable leftIcon = currentEncryptedChat != null ? Theme.chat_lockIconDrawable : null;
|
|
|
|
Drawable rightIcon = null;
|
2016-04-22 15:49:00 +02:00
|
|
|
if (a == 0) {
|
2019-05-14 14:08:05 +02:00
|
|
|
if (user.scam) {
|
|
|
|
rightIcon = getScamDrawable();
|
|
|
|
} else {
|
|
|
|
rightIcon = MessagesController.getInstance(currentAccount).isDialogMuted(dialog_id != 0 ? dialog_id : (long) user_id) ? Theme.chat_muteIconDrawable : null;
|
|
|
|
}
|
|
|
|
} else if (user.scam) {
|
|
|
|
rightIcon = getScamDrawable();
|
2016-04-22 15:49:00 +02:00
|
|
|
} else if (user.verified) {
|
2017-03-31 01:58:05 +02:00
|
|
|
rightIcon = new CombinedDrawable(Theme.profile_verifiedDrawable, Theme.profile_verifiedCheckDrawable);
|
2015-11-26 22:04:02 +01:00
|
|
|
}
|
2016-04-22 15:49:00 +02:00
|
|
|
nameTextView[a].setLeftDrawable(leftIcon);
|
|
|
|
nameTextView[a].setRightDrawable(rightIcon);
|
2015-10-29 18:10:07 +01:00
|
|
|
}
|
|
|
|
|
2019-06-26 16:11:11 +02:00
|
|
|
if (user.photo != null) {
|
|
|
|
idTextView.setText("ID: " + user_id + ", DC: " + user.photo.dc_id);
|
2019-06-18 07:55:59 +02:00
|
|
|
} else {
|
|
|
|
idTextView.setText("ID: " + user_id);
|
|
|
|
}
|
|
|
|
id = user_id;
|
2018-07-30 04:07:02 +02:00
|
|
|
avatarImage.getImageReceiver().setVisible(!PhotoViewer.isShowingImage(photoBig), false);
|
2014-11-12 23:16:59 +01:00
|
|
|
} else if (chat_id != 0) {
|
2018-07-30 04:07:02 +02:00
|
|
|
TLRPC.Chat chat = MessagesController.getInstance(currentAccount).getChat(chat_id);
|
2014-11-12 23:16:59 +01:00
|
|
|
if (chat != null) {
|
|
|
|
currentChat = chat;
|
2015-05-03 13:48:36 +02:00
|
|
|
} else {
|
|
|
|
chat = currentChat;
|
2014-11-12 23:16:59 +01:00
|
|
|
}
|
|
|
|
|
2015-10-29 18:10:07 +01:00
|
|
|
String newString;
|
2015-09-24 22:52:02 +02:00
|
|
|
if (ChatObject.isChannel(chat)) {
|
2019-01-23 18:03:33 +01:00
|
|
|
if (chatInfo == null || !currentChat.megagroup && (chatInfo.participants_count == 0 || ChatObject.hasAdminRights(currentChat) || chatInfo.can_view_participants)) {
|
2016-03-16 13:26:32 +01:00
|
|
|
if (currentChat.megagroup) {
|
|
|
|
newString = LocaleController.getString("Loading", R.string.Loading).toLowerCase();
|
2015-09-24 22:52:02 +02:00
|
|
|
} else {
|
2016-03-16 13:26:32 +01:00
|
|
|
if ((chat.flags & TLRPC.CHAT_FLAG_IS_PUBLIC) != 0) {
|
|
|
|
newString = LocaleController.getString("ChannelPublic", R.string.ChannelPublic).toLowerCase();
|
|
|
|
} else {
|
|
|
|
newString = LocaleController.getString("ChannelPrivate", R.string.ChannelPrivate).toLowerCase();
|
|
|
|
}
|
2015-09-24 22:52:02 +02:00
|
|
|
}
|
|
|
|
} else {
|
2019-01-23 18:03:33 +01:00
|
|
|
if (currentChat.megagroup) {
|
|
|
|
if (onlineCount > 1 && chatInfo.participants_count != 0) {
|
|
|
|
newString = String.format("%s, %s", LocaleController.formatPluralString("Members", chatInfo.participants_count), LocaleController.formatPluralString("OnlineCount", Math.min(onlineCount, chatInfo.participants_count)));
|
2016-03-16 13:26:32 +01:00
|
|
|
} else {
|
2019-07-18 15:01:39 +02:00
|
|
|
if (chatInfo.participants_count == 0) {
|
|
|
|
if (chat.has_geo) {
|
|
|
|
newString = LocaleController.getString("MegaLocation", R.string.MegaLocation).toLowerCase();
|
|
|
|
} else if (!TextUtils.isEmpty(chat.username)) {
|
|
|
|
newString = LocaleController.getString("MegaPublic", R.string.MegaPublic).toLowerCase();
|
|
|
|
} else {
|
|
|
|
newString = LocaleController.getString("MegaPrivate", R.string.MegaPrivate).toLowerCase();
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
newString = LocaleController.formatPluralString("Members", chatInfo.participants_count);
|
|
|
|
}
|
2016-03-16 13:26:32 +01:00
|
|
|
}
|
|
|
|
} else {
|
2019-05-14 14:08:05 +02:00
|
|
|
int[] result = new int[1];
|
2019-01-23 18:03:33 +01:00
|
|
|
String shortNumber = LocaleController.formatShortNumber(chatInfo.participants_count, result);
|
2017-12-08 18:35:59 +01:00
|
|
|
if (currentChat.megagroup) {
|
2019-01-23 18:03:33 +01:00
|
|
|
newString = LocaleController.formatPluralString("Members", chatInfo.participants_count);
|
2017-12-08 18:35:59 +01:00
|
|
|
} else {
|
2019-01-23 18:03:33 +01:00
|
|
|
newString = LocaleController.formatPluralString("Subscribers", chatInfo.participants_count);
|
2017-12-08 18:35:59 +01:00
|
|
|
}
|
2016-03-16 13:26:32 +01:00
|
|
|
}
|
2015-09-24 22:52:02 +02:00
|
|
|
}
|
2014-11-12 23:16:59 +01:00
|
|
|
} else {
|
2015-09-24 22:52:02 +02:00
|
|
|
int count = chat.participants_count;
|
2019-01-23 18:03:33 +01:00
|
|
|
if (chatInfo != null) {
|
|
|
|
count = chatInfo.participants.participants.size();
|
2015-09-24 22:52:02 +02:00
|
|
|
}
|
|
|
|
if (count != 0 && onlineCount > 1) {
|
2017-07-08 18:32:04 +02:00
|
|
|
newString = String.format("%s, %s", LocaleController.formatPluralString("Members", count), LocaleController.formatPluralString("OnlineCount", onlineCount));
|
2015-09-24 22:52:02 +02:00
|
|
|
} else {
|
2015-10-29 18:10:07 +01:00
|
|
|
newString = LocaleController.formatPluralString("Members", count);
|
2015-09-24 22:52:02 +02:00
|
|
|
}
|
2014-11-12 23:16:59 +01:00
|
|
|
}
|
2015-11-26 22:04:02 +01:00
|
|
|
|
2019-01-23 18:03:33 +01:00
|
|
|
boolean changed = false;
|
2015-11-26 22:04:02 +01:00
|
|
|
for (int a = 0; a < 2; a++) {
|
|
|
|
if (nameTextView[a] == null) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if (chat.title != null && !nameTextView[a].getText().equals(chat.title)) {
|
2019-01-23 18:03:33 +01:00
|
|
|
if (nameTextView[a].setText(chat.title)) {
|
|
|
|
changed = true;
|
|
|
|
}
|
2015-11-26 22:04:02 +01:00
|
|
|
}
|
2016-04-22 15:49:00 +02:00
|
|
|
nameTextView[a].setLeftDrawable(null);
|
2015-11-26 22:04:02 +01:00
|
|
|
if (a != 0) {
|
2019-05-14 14:08:05 +02:00
|
|
|
if (chat.scam) {
|
|
|
|
nameTextView[a].setRightDrawable(getScamDrawable());
|
|
|
|
} else if (chat.verified) {
|
2017-03-31 01:58:05 +02:00
|
|
|
nameTextView[a].setRightDrawable(new CombinedDrawable(Theme.profile_verifiedDrawable, Theme.profile_verifiedCheckDrawable));
|
2015-11-26 22:04:02 +01:00
|
|
|
} else {
|
2016-04-22 15:49:00 +02:00
|
|
|
nameTextView[a].setRightDrawable(null);
|
2015-11-26 22:04:02 +01:00
|
|
|
}
|
|
|
|
} else {
|
2019-05-14 14:08:05 +02:00
|
|
|
if (chat.scam) {
|
|
|
|
nameTextView[a].setRightDrawable(getScamDrawable());
|
|
|
|
} else {
|
|
|
|
nameTextView[a].setRightDrawable(MessagesController.getInstance(currentAccount).isDialogMuted((long) -chat_id) ? Theme.chat_muteIconDrawable : null);
|
|
|
|
}
|
2015-11-26 22:04:02 +01:00
|
|
|
}
|
2017-12-08 18:35:59 +01:00
|
|
|
if (a == 0 && onlineTextOverride != null) {
|
|
|
|
onlineTextView[a].setText(onlineTextOverride);
|
2015-11-26 22:04:02 +01:00
|
|
|
} else {
|
2019-01-23 18:03:33 +01:00
|
|
|
if (currentChat.megagroup && chatInfo != null && onlineCount > 0) {
|
2017-12-08 18:35:59 +01:00
|
|
|
if (!onlineTextView[a].getText().equals(newString)) {
|
|
|
|
onlineTextView[a].setText(newString);
|
|
|
|
}
|
2019-01-23 18:03:33 +01:00
|
|
|
} else if (a == 0 && ChatObject.isChannel(currentChat) && chatInfo != null && chatInfo.participants_count != 0 && (currentChat.megagroup || currentChat.broadcast)) {
|
2019-05-14 14:08:05 +02:00
|
|
|
int[] result = new int[1];
|
2019-01-23 18:03:33 +01:00
|
|
|
String shortNumber = LocaleController.formatShortNumber(chatInfo.participants_count, result);
|
2017-12-08 18:35:59 +01:00
|
|
|
if (currentChat.megagroup) {
|
2019-07-18 15:01:39 +02:00
|
|
|
if (chatInfo.participants_count == 0) {
|
|
|
|
if (chat.has_geo) {
|
|
|
|
newString = LocaleController.getString("MegaLocation", R.string.MegaLocation).toLowerCase();
|
|
|
|
} else if (!TextUtils.isEmpty(chat.username)) {
|
|
|
|
newString = LocaleController.getString("MegaPublic", R.string.MegaPublic).toLowerCase();
|
|
|
|
} else {
|
|
|
|
newString = LocaleController.getString("MegaPrivate", R.string.MegaPrivate).toLowerCase();
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
onlineTextView[a].setText(LocaleController.formatPluralString("Members", result[0]).replace(String.format("%d", result[0]), shortNumber));
|
|
|
|
}
|
2017-12-08 18:35:59 +01:00
|
|
|
} else {
|
|
|
|
onlineTextView[a].setText(LocaleController.formatPluralString("Subscribers", result[0]).replace(String.format("%d", result[0]), shortNumber));
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (!onlineTextView[a].getText().equals(newString)) {
|
|
|
|
onlineTextView[a].setText(newString);
|
|
|
|
}
|
2015-11-26 22:04:02 +01:00
|
|
|
}
|
|
|
|
}
|
2015-10-29 18:10:07 +01:00
|
|
|
}
|
2019-06-18 07:55:59 +02:00
|
|
|
id = chat_id;
|
2019-01-23 18:03:33 +01:00
|
|
|
if (changed) {
|
|
|
|
needLayout();
|
|
|
|
}
|
2014-11-12 23:16:59 +01:00
|
|
|
|
|
|
|
TLRPC.FileLocation photoBig = null;
|
|
|
|
if (chat.photo != null) {
|
|
|
|
photoBig = chat.photo.photo_big;
|
|
|
|
}
|
2015-11-26 22:04:02 +01:00
|
|
|
avatarDrawable.setInfo(chat);
|
2019-05-14 14:08:05 +02:00
|
|
|
avatarImage.setImage(ImageLocation.getForChat(chat, false), "50_50", avatarDrawable, chat);
|
|
|
|
FileLoader.getInstance(currentAccount).loadFile(ImageLocation.getForChat(chat, true), chat, null, 0, 1);
|
2018-07-30 04:07:02 +02:00
|
|
|
avatarImage.getImageReceiver().setVisible(!PhotoViewer.isShowingImage(photoBig), false);
|
2019-06-26 16:11:11 +02:00
|
|
|
if (chat.photo != null) {
|
|
|
|
idTextView.setText("ID: " + chat_id + ", DC: " + chat.photo.dc_id);
|
2019-06-18 07:55:59 +02:00
|
|
|
} else {
|
|
|
|
idTextView.setText("ID: " + chat_id);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (id != 0) {
|
|
|
|
int finalId = id;
|
|
|
|
idTextView.setOnLongClickListener(new SimpleTextView.OnLongClickListener() {
|
|
|
|
public boolean onLongClick(View v) {
|
|
|
|
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
|
|
|
|
builder.setItems(new CharSequence[]{LocaleController.getString("Copy", R.string.Copy)}, (dialogInterface, i) -> {
|
|
|
|
if (i == 0) {
|
|
|
|
try {
|
|
|
|
android.content.ClipboardManager clipboard = (android.content.ClipboardManager) ApplicationLoader.applicationContext.getSystemService(Context.CLIPBOARD_SERVICE);
|
|
|
|
android.content.ClipData clip = android.content.ClipData.newPlainText("label", String.valueOf(finalId));
|
|
|
|
clipboard.setPrimaryClip(clip);
|
|
|
|
Toast.makeText(getParentActivity(), LocaleController.getString("TextCopied", R.string.TextCopied), Toast.LENGTH_SHORT).show();
|
|
|
|
} catch (Exception e) {
|
|
|
|
FileLog.e(e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
showDialog(builder.create());
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
});
|
2014-11-12 23:16:59 +01:00
|
|
|
}
|
2014-11-10 12:05:22 +01:00
|
|
|
}
|
|
|
|
|
2014-06-04 01:31:48 +02:00
|
|
|
private void createActionBarMenu() {
|
2014-11-11 23:16:17 +01:00
|
|
|
ActionBarMenu menu = actionBar.createMenu();
|
2014-06-04 01:31:48 +02:00
|
|
|
menu.clearItems();
|
2015-11-26 22:04:02 +01:00
|
|
|
animatingItem = null;
|
2013-10-25 17:19:00 +02:00
|
|
|
|
2016-05-25 23:49:47 +02:00
|
|
|
ActionBarMenuItem item = null;
|
2014-11-12 23:16:59 +01:00
|
|
|
if (user_id != 0) {
|
2018-07-30 04:07:02 +02:00
|
|
|
if (UserConfig.getInstance(currentAccount).getClientUserId() != user_id) {
|
2019-03-03 21:40:48 +01:00
|
|
|
TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(user_id);
|
|
|
|
if (user == null) {
|
|
|
|
return;
|
|
|
|
}
|
2019-01-23 18:03:33 +01:00
|
|
|
if (userInfo != null && userInfo.phone_calls_available) {
|
2019-05-14 14:08:05 +02:00
|
|
|
callItem = menu.addItem(call_item, R.drawable.ic_call);
|
2017-03-31 01:58:05 +02:00
|
|
|
}
|
2019-03-03 21:40:48 +01:00
|
|
|
if (isBot || ContactsController.getInstance(currentAccount).contactsDict.get(user_id) == null) {
|
2016-10-11 13:57:01 +02:00
|
|
|
item = menu.addItem(10, R.drawable.ic_ab_other);
|
2019-03-03 21:40:48 +01:00
|
|
|
if (MessagesController.isSupportUser(user)) {
|
|
|
|
if (userBlocked) {
|
2019-07-18 15:01:39 +02:00
|
|
|
item.addSubItem(block_contact, R.drawable.msg_block, LocaleController.getString("Unblock", R.string.Unblock));
|
2016-10-11 13:57:01 +02:00
|
|
|
}
|
|
|
|
} else {
|
2017-12-08 18:35:59 +01:00
|
|
|
if (isBot) {
|
2019-03-03 21:40:48 +01:00
|
|
|
if (!user.bot_nochats) {
|
2019-05-14 14:08:05 +02:00
|
|
|
item.addSubItem(invite_to_group, R.drawable.msg_addbot, LocaleController.getString("BotInvite", R.string.BotInvite));
|
2019-03-03 21:40:48 +01:00
|
|
|
}
|
2019-05-14 14:08:05 +02:00
|
|
|
item.addSubItem(share, R.drawable.msg_share, LocaleController.getString("BotShare", R.string.BotShare));
|
2019-07-18 15:01:39 +02:00
|
|
|
} else {
|
2019-05-14 14:08:05 +02:00
|
|
|
item.addSubItem(add_contact, R.drawable.msg_addcontact, LocaleController.getString("AddContact", R.string.AddContact));
|
2019-07-18 15:01:39 +02:00
|
|
|
}
|
|
|
|
if (!TextUtils.isEmpty(user.phone)) {
|
2019-05-14 14:08:05 +02:00
|
|
|
item.addSubItem(share_contact, R.drawable.msg_share, LocaleController.getString("ShareContact", R.string.ShareContact));
|
2019-07-18 15:01:39 +02:00
|
|
|
}
|
|
|
|
if (isBot) {
|
|
|
|
item.addSubItem(block_contact, !userBlocked ? R.drawable.msg_block : R.drawable.msg_retry, !userBlocked ? LocaleController.getString("BotStop", R.string.BotStop) : LocaleController.getString("BotRestart", R.string.BotRestart));
|
2019-03-03 21:40:48 +01:00
|
|
|
} else {
|
2019-07-18 15:01:39 +02:00
|
|
|
item.addSubItem(block_contact, !userBlocked ? R.drawable.msg_block : R.drawable.msg_block, !userBlocked ? LocaleController.getString("BlockContact", R.string.BlockContact) : LocaleController.getString("Unblock", R.string.Unblock));
|
2016-10-11 13:57:01 +02:00
|
|
|
}
|
2015-09-02 00:14:21 +02:00
|
|
|
}
|
2016-10-11 13:57:01 +02:00
|
|
|
} else {
|
|
|
|
item = menu.addItem(10, R.drawable.ic_ab_other);
|
2019-07-18 15:01:39 +02:00
|
|
|
if (!TextUtils.isEmpty(user.phone)) {
|
|
|
|
item.addSubItem(share_contact, R.drawable.msg_share, LocaleController.getString("ShareContact", R.string.ShareContact));
|
|
|
|
}
|
|
|
|
item.addSubItem(block_contact, !userBlocked ? R.drawable.msg_block : R.drawable.msg_block, !userBlocked ? LocaleController.getString("BlockContact", R.string.BlockContact) : LocaleController.getString("Unblock", R.string.Unblock));
|
2019-05-14 14:08:05 +02:00
|
|
|
item.addSubItem(edit_contact, R.drawable.msg_edit, LocaleController.getString("EditContact", R.string.EditContact));
|
|
|
|
item.addSubItem(delete_contact, R.drawable.msg_delete, LocaleController.getString("DeleteContact", R.string.DeleteContact));
|
2014-11-12 23:16:59 +01:00
|
|
|
}
|
2013-10-25 17:19:00 +02:00
|
|
|
} else {
|
2016-05-25 23:49:47 +02:00
|
|
|
item = menu.addItem(10, R.drawable.ic_ab_other);
|
2019-05-14 14:08:05 +02:00
|
|
|
item.addSubItem(share_contact, R.drawable.msg_share, LocaleController.getString("ShareContact", R.string.ShareContact));
|
2013-10-25 17:19:00 +02:00
|
|
|
}
|
2014-11-12 23:16:59 +01:00
|
|
|
} else if (chat_id != 0) {
|
|
|
|
if (chat_id > 0) {
|
2018-07-30 04:07:02 +02:00
|
|
|
TLRPC.Chat chat = MessagesController.getInstance(currentAccount).getChat(chat_id);
|
2015-09-24 22:52:02 +02:00
|
|
|
if (ChatObject.isChannel(chat)) {
|
2019-12-10 16:17:55 +01:00
|
|
|
if (ChatObject.hasAdminRights(chat) || chat.megagroup) {
|
2019-01-23 18:03:33 +01:00
|
|
|
editItem = menu.addItem(edit_channel, R.drawable.group_edit_profile);
|
|
|
|
}
|
|
|
|
if (!chat.megagroup && chatInfo != null && chatInfo.can_view_stats) {
|
2017-07-08 18:32:04 +02:00
|
|
|
if (item == null) {
|
|
|
|
item = menu.addItem(10, R.drawable.ic_ab_other);
|
|
|
|
}
|
2019-05-14 14:08:05 +02:00
|
|
|
item.addSubItem(statistics, R.drawable.msg_stats, LocaleController.getString("Statistics", R.string.Statistics));
|
2015-11-26 22:04:02 +01:00
|
|
|
}
|
2017-07-08 18:32:04 +02:00
|
|
|
if (chat.megagroup) {
|
2015-11-26 22:04:02 +01:00
|
|
|
if (item == null) {
|
|
|
|
item = menu.addItem(10, R.drawable.ic_ab_other);
|
|
|
|
}
|
2019-05-14 14:08:05 +02:00
|
|
|
item.addSubItem(search_members, R.drawable.msg_search, LocaleController.getString("SearchMembers", R.string.SearchMembers));
|
2017-07-08 18:32:04 +02:00
|
|
|
if (!chat.creator && !chat.left && !chat.kicked) {
|
2019-05-14 14:08:05 +02:00
|
|
|
item.addSubItem(leave_group, R.drawable.msg_leave, LocaleController.getString("LeaveMegaMenu", R.string.LeaveMegaMenu));
|
2017-07-08 18:32:04 +02:00
|
|
|
}
|
2015-09-24 22:52:02 +02:00
|
|
|
}
|
|
|
|
} else {
|
2019-01-23 18:03:33 +01:00
|
|
|
if (ChatObject.canChangeChatInfo(chat)) {
|
|
|
|
editItem = menu.addItem(edit_channel, R.drawable.group_edit_profile);
|
2017-07-08 18:32:04 +02:00
|
|
|
}
|
2016-05-25 23:49:47 +02:00
|
|
|
item = menu.addItem(10, R.drawable.ic_ab_other);
|
2019-05-14 14:08:05 +02:00
|
|
|
item.addSubItem(search_members, R.drawable.msg_search, LocaleController.getString("SearchMembers", R.string.SearchMembers));
|
|
|
|
item.addSubItem(leave_group, R.drawable.msg_leave, LocaleController.getString("DeleteAndExit", R.string.DeleteAndExit));
|
2015-09-24 22:52:02 +02:00
|
|
|
}
|
2014-11-12 23:16:59 +01:00
|
|
|
}
|
2013-10-25 17:19:00 +02:00
|
|
|
}
|
2016-05-25 23:49:47 +02:00
|
|
|
if (item == null) {
|
|
|
|
item = menu.addItem(10, R.drawable.ic_ab_other);
|
|
|
|
}
|
2019-05-14 14:08:05 +02:00
|
|
|
item.addSubItem(add_shortcut, R.drawable.msg_home, LocaleController.getString("AddShortcut", R.string.AddShortcut));
|
|
|
|
item.setContentDescription(LocaleController.getString("AccDescrMoreOptions", R.string.AccDescrMoreOptions));
|
|
|
|
if (editItem != null) {
|
|
|
|
editItem.setContentDescription(LocaleController.getString("Edit", R.string.Edit));
|
|
|
|
}
|
|
|
|
if (callItem != null) {
|
|
|
|
callItem.setContentDescription(LocaleController.getString("Call", R.string.Call));
|
|
|
|
}
|
2013-10-25 17:19:00 +02:00
|
|
|
}
|
|
|
|
|
2014-10-14 22:36:15 +02:00
|
|
|
@Override
|
2015-09-24 22:52:02 +02:00
|
|
|
protected void onDialogDismiss(Dialog dialog) {
|
2014-10-14 22:36:15 +02:00
|
|
|
if (listView != null) {
|
|
|
|
listView.invalidateViews();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-10-25 17:19:00 +02:00
|
|
|
@Override
|
2017-12-08 18:35:59 +01:00
|
|
|
public void didSelectDialogs(DialogsActivity fragment, ArrayList<Long> dids, CharSequence message, boolean param) {
|
|
|
|
long did = dids.get(0);
|
|
|
|
Bundle args = new Bundle();
|
|
|
|
args.putBoolean("scrollToTopOnResume", true);
|
|
|
|
int lower_part = (int) did;
|
|
|
|
if (lower_part != 0) {
|
|
|
|
if (lower_part > 0) {
|
|
|
|
args.putInt("user_id", lower_part);
|
|
|
|
} else if (lower_part < 0) {
|
|
|
|
args.putInt("chat_id", -lower_part);
|
2016-03-16 13:26:32 +01:00
|
|
|
}
|
2017-12-08 18:35:59 +01:00
|
|
|
} else {
|
|
|
|
args.putInt("enc_id", (int) (did >> 32));
|
2013-10-25 17:19:00 +02:00
|
|
|
}
|
2018-07-30 04:07:02 +02:00
|
|
|
if (!MessagesController.getInstance(currentAccount).checkCanOpenChat(args, fragment)) {
|
2017-12-08 18:35:59 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2018-07-30 04:07:02 +02:00
|
|
|
NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.closeChats);
|
|
|
|
NotificationCenter.getInstance(currentAccount).postNotificationName(NotificationCenter.closeChats);
|
2017-12-08 18:35:59 +01:00
|
|
|
presentFragment(new ChatActivity(args), true);
|
|
|
|
removeSelfFromStack();
|
2018-07-30 04:07:02 +02:00
|
|
|
TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(user_id);
|
2019-09-10 12:56:11 +02:00
|
|
|
SendMessagesHelper.getInstance(currentAccount).sendMessage(user, did, null, null, null, true, 0);
|
2013-10-25 17:19:00 +02:00
|
|
|
}
|
|
|
|
|
2017-03-31 01:58:05 +02:00
|
|
|
@Override
|
|
|
|
public void onRequestPermissionsResultFragment(int requestCode, String[] permissions, int[] grantResults) {
|
|
|
|
if (requestCode == 101) {
|
2018-07-30 04:07:02 +02:00
|
|
|
final TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(user_id);
|
2017-03-31 01:58:05 +02:00
|
|
|
if (user == null) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
|
2019-01-23 18:03:33 +01:00
|
|
|
VoIPHelper.startCall(user, getParentActivity(), userInfo);
|
2017-03-31 01:58:05 +02:00
|
|
|
} else {
|
|
|
|
VoIPHelper.permissionDenied(getParentActivity(), null);
|
2014-11-12 23:16:59 +01:00
|
|
|
}
|
2013-10-25 17:19:00 +02:00
|
|
|
}
|
2017-03-31 01:58:05 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
private class ListAdapter extends RecyclerListView.SelectionAdapter {
|
|
|
|
|
|
|
|
private Context mContext;
|
2013-10-25 17:19:00 +02:00
|
|
|
|
2015-10-29 18:10:07 +01:00
|
|
|
public ListAdapter(Context context) {
|
|
|
|
mContext = context;
|
2013-10-25 17:19:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2015-10-29 18:10:07 +01:00
|
|
|
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
|
|
|
View view = null;
|
|
|
|
switch (viewType) {
|
2019-01-23 18:03:33 +01:00
|
|
|
case 1: {
|
|
|
|
view = new HeaderCell(mContext, 23);
|
2015-10-29 18:10:07 +01:00
|
|
|
break;
|
2019-01-23 18:03:33 +01:00
|
|
|
}
|
|
|
|
case 2: {
|
2017-03-31 01:58:05 +02:00
|
|
|
view = new TextDetailCell(mContext);
|
2015-10-29 18:10:07 +01:00
|
|
|
break;
|
2019-01-23 18:03:33 +01:00
|
|
|
}
|
|
|
|
case 3: {
|
|
|
|
view = new AboutLinkCell(mContext) {
|
|
|
|
@Override
|
|
|
|
protected void didPressUrl(String url) {
|
|
|
|
if (url.startsWith("@")) {
|
|
|
|
MessagesController.getInstance(currentAccount).openByUserName(url.substring(1), ProfileActivity.this, 0);
|
|
|
|
} else if (url.startsWith("#")) {
|
|
|
|
DialogsActivity fragment = new DialogsActivity(null);
|
|
|
|
fragment.setSearchString(url);
|
|
|
|
presentFragment(fragment);
|
|
|
|
} else if (url.startsWith("/")) {
|
|
|
|
if (parentLayout.fragmentsStack.size() > 1) {
|
|
|
|
BaseFragment previousFragment = parentLayout.fragmentsStack.get(parentLayout.fragmentsStack.size() - 2);
|
|
|
|
if (previousFragment instanceof ChatActivity) {
|
|
|
|
finishFragment();
|
|
|
|
((ChatActivity) previousFragment).chatActivityEnterView.setCommand(null, url, false, false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
2015-10-29 18:10:07 +01:00
|
|
|
break;
|
2019-01-23 18:03:33 +01:00
|
|
|
}
|
|
|
|
case 4: {
|
|
|
|
view = new TextCell(mContext);
|
2015-10-29 18:10:07 +01:00
|
|
|
break;
|
2019-01-23 18:03:33 +01:00
|
|
|
}
|
2017-03-31 01:58:05 +02:00
|
|
|
case 5: {
|
2019-01-23 18:03:33 +01:00
|
|
|
view = new DividerCell(mContext);
|
|
|
|
view.setPadding(AndroidUtilities.dp(20), AndroidUtilities.dp(4), 0, 0);
|
2015-10-29 18:10:07 +01:00
|
|
|
break;
|
2017-03-31 01:58:05 +02:00
|
|
|
}
|
|
|
|
case 6: {
|
2019-06-04 12:14:50 +02:00
|
|
|
view = new NotificationsCheckCell(mContext, 23, 70);
|
2015-11-26 22:04:02 +01:00
|
|
|
break;
|
2017-03-31 01:58:05 +02:00
|
|
|
}
|
2019-01-23 18:03:33 +01:00
|
|
|
case 7: {
|
|
|
|
view = new ShadowSectionCell(mContext);
|
2015-11-26 22:04:02 +01:00
|
|
|
break;
|
2019-01-23 18:03:33 +01:00
|
|
|
}
|
|
|
|
case 8: {
|
|
|
|
view = new UserCell(mContext, addMemberRow == -1 ? 9 : 6, 0, true);
|
2015-10-29 18:10:07 +01:00
|
|
|
break;
|
2019-01-23 18:03:33 +01:00
|
|
|
}
|
|
|
|
case 11: {
|
|
|
|
view = new EmptyCell(mContext, 36);
|
|
|
|
}
|
2015-10-29 18:10:07 +01:00
|
|
|
}
|
2016-03-16 13:26:32 +01:00
|
|
|
view.setLayoutParams(new RecyclerView.LayoutParams(RecyclerView.LayoutParams.MATCH_PARENT, RecyclerView.LayoutParams.WRAP_CONTENT));
|
2017-03-31 01:58:05 +02:00
|
|
|
return new RecyclerListView.Holder(view);
|
2015-10-29 18:10:07 +01:00
|
|
|
}
|
2013-12-20 20:25:49 +01:00
|
|
|
|
2015-10-29 18:10:07 +01:00
|
|
|
@Override
|
2019-01-23 18:03:33 +01:00
|
|
|
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
|
2015-10-29 18:10:07 +01:00
|
|
|
switch (holder.getItemViewType()) {
|
2019-01-23 18:03:33 +01:00
|
|
|
case 1:
|
|
|
|
HeaderCell headerCell = (HeaderCell) holder.itemView;
|
|
|
|
if (position == infoHeaderRow) {
|
|
|
|
if (ChatObject.isChannel(currentChat) && !currentChat.megagroup && channelInfoRow != -1) {
|
|
|
|
headerCell.setText(LocaleController.getString("ReportChatDescription", R.string.ReportChatDescription));
|
|
|
|
} else {
|
|
|
|
headerCell.setText(LocaleController.getString("Info", R.string.Info));
|
|
|
|
}
|
|
|
|
} else if (position == sharedHeaderRow) {
|
|
|
|
headerCell.setText(LocaleController.getString("SharedContent", R.string.SharedContent));
|
|
|
|
} else if (position == membersHeaderRow) {
|
|
|
|
headerCell.setText(LocaleController.getString("ChannelMembers", R.string.ChannelMembers));
|
2015-09-24 22:52:02 +02:00
|
|
|
}
|
2015-10-29 18:10:07 +01:00
|
|
|
break;
|
|
|
|
case 2:
|
2019-01-23 18:03:33 +01:00
|
|
|
TextDetailCell detailCell = (TextDetailCell) holder.itemView;
|
|
|
|
if (position == phoneRow) {
|
2015-10-29 18:10:07 +01:00
|
|
|
String text;
|
2018-07-30 04:07:02 +02:00
|
|
|
final TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(user_id);
|
2019-06-21 13:32:04 +02:00
|
|
|
if (!TextUtils.isEmpty(user.phone)
|
|
|
|
&& !(NekoConfig.hidePhone && user.id == UserConfig.getInstance(currentAccount).getClientUserId())) {
|
2015-10-29 18:10:07 +01:00
|
|
|
text = PhoneFormat.getInstance().format("+" + user.phone);
|
|
|
|
} else {
|
2019-01-23 18:03:33 +01:00
|
|
|
text = LocaleController.getString("PhoneHidden", R.string.PhoneHidden);
|
2017-07-23 14:56:38 +02:00
|
|
|
}
|
2019-01-23 18:03:33 +01:00
|
|
|
detailCell.setTextAndValue(text, LocaleController.getString("PhoneMobile", R.string.PhoneMobile), false);
|
|
|
|
} else if (position == usernameRow) {
|
2015-10-29 18:10:07 +01:00
|
|
|
String text;
|
2019-01-23 18:03:33 +01:00
|
|
|
if (user_id != 0) {
|
|
|
|
final TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(user_id);
|
|
|
|
if (user != null && !TextUtils.isEmpty(user.username)) {
|
|
|
|
text = "@" + user.username;
|
|
|
|
} else {
|
|
|
|
text = "-";
|
|
|
|
}
|
|
|
|
detailCell.setTextAndValue(text, LocaleController.getString("Username", R.string.Username), false);
|
|
|
|
} else if (currentChat != null) {
|
|
|
|
TLRPC.Chat chat = MessagesController.getInstance(currentAccount).getChat(chat_id);
|
|
|
|
detailCell.setTextAndValue(MessagesController.getInstance(currentAccount).linkPrefix + "/" + chat.username, LocaleController.getString("InviteLink", R.string.InviteLink), false);
|
2015-10-29 18:10:07 +01:00
|
|
|
}
|
2019-07-18 15:01:39 +02:00
|
|
|
} else if (position == locationRow) {
|
|
|
|
if (chatInfo != null && chatInfo.location instanceof TLRPC.TL_channelLocation) {
|
|
|
|
TLRPC.TL_channelLocation location = (TLRPC.TL_channelLocation) chatInfo.location;
|
|
|
|
detailCell.setTextAndValue(location.address, LocaleController.getString("AttachLocation", R.string.AttachLocation), false);
|
|
|
|
}
|
2015-09-24 22:52:02 +02:00
|
|
|
}
|
2015-10-29 18:10:07 +01:00
|
|
|
break;
|
|
|
|
case 3:
|
2019-01-23 18:03:33 +01:00
|
|
|
AboutLinkCell aboutLinkCell = (AboutLinkCell) holder.itemView;
|
|
|
|
if (position == userInfoRow) {
|
|
|
|
aboutLinkCell.setTextAndValue(userInfo.about, LocaleController.getString("UserBio", R.string.UserBio), isBot);
|
|
|
|
} else if (position == channelInfoRow) {
|
|
|
|
String text = chatInfo.about;
|
|
|
|
while (text.contains("\n\n\n")) {
|
|
|
|
text = text.replace("\n\n\n", "\n\n");
|
|
|
|
}
|
|
|
|
aboutLinkCell.setText(text, true);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 4:
|
2015-10-29 18:10:07 +01:00
|
|
|
TextCell textCell = (TextCell) holder.itemView;
|
2019-01-23 18:03:33 +01:00
|
|
|
textCell.setColors(Theme.key_windowBackgroundWhiteGrayIcon, Theme.key_windowBackgroundWhiteBlackText);
|
2017-03-31 01:58:05 +02:00
|
|
|
textCell.setTag(Theme.key_windowBackgroundWhiteBlackText);
|
2019-01-23 18:03:33 +01:00
|
|
|
if (position == photosRow) {
|
2019-07-18 15:01:39 +02:00
|
|
|
textCell.setTextAndValueAndIcon(LocaleController.getString("SharedPhotosAndVideos", R.string.SharedPhotosAndVideos), String.format("%d", lastMediaCount[MediaDataController.MEDIA_PHOTOVIDEO]), R.drawable.profile_photos, position != sharedSectionRow - 1);
|
2019-01-23 18:03:33 +01:00
|
|
|
} else if (position == filesRow) {
|
2019-07-18 15:01:39 +02:00
|
|
|
textCell.setTextAndValueAndIcon(LocaleController.getString("FilesDataUsage", R.string.FilesDataUsage), String.format("%d", lastMediaCount[MediaDataController.MEDIA_FILE]), R.drawable.profile_file, position != sharedSectionRow - 1);
|
2019-01-23 18:03:33 +01:00
|
|
|
} else if (position == linksRow) {
|
2019-07-18 15:01:39 +02:00
|
|
|
textCell.setTextAndValueAndIcon(LocaleController.getString("SharedLinks", R.string.SharedLinks), String.format("%d", lastMediaCount[MediaDataController.MEDIA_URL]), R.drawable.profile_link, position != sharedSectionRow - 1);
|
2019-01-23 18:03:33 +01:00
|
|
|
} else if (position == audioRow) {
|
2019-07-18 15:01:39 +02:00
|
|
|
textCell.setTextAndValueAndIcon(LocaleController.getString("SharedAudioFiles", R.string.SharedAudioFiles), String.format("%d", lastMediaCount[MediaDataController.MEDIA_MUSIC]), R.drawable.profile_audio, position != sharedSectionRow - 1);
|
2019-01-23 18:03:33 +01:00
|
|
|
} else if (position == voiceRow) {
|
2019-07-18 15:01:39 +02:00
|
|
|
textCell.setTextAndValueAndIcon(LocaleController.getString("AudioAutodownload", R.string.AudioAutodownload), String.format("%d", lastMediaCount[MediaDataController.MEDIA_AUDIO]), R.drawable.profile_voice, position != sharedSectionRow - 1);
|
2019-01-23 18:03:33 +01:00
|
|
|
} else if (position == groupsInCommonRow) {
|
2019-05-14 14:08:05 +02:00
|
|
|
textCell.setTextAndValueAndIcon(LocaleController.getString("GroupsInCommonTitle", R.string.GroupsInCommonTitle), String.format("%d", userInfo.common_chats_count), R.drawable.actions_viewmembers, position != sharedSectionRow - 1);
|
2019-01-23 18:03:33 +01:00
|
|
|
} else if (position == settingsTimerRow) {
|
2018-07-30 04:07:02 +02:00
|
|
|
TLRPC.EncryptedChat encryptedChat = MessagesController.getInstance(currentAccount).getEncryptedChat((int) (dialog_id >> 32));
|
2015-10-29 18:10:07 +01:00
|
|
|
String value;
|
|
|
|
if (encryptedChat.ttl == 0) {
|
|
|
|
value = LocaleController.getString("ShortMessageLifetimeForever", R.string.ShortMessageLifetimeForever);
|
|
|
|
} else {
|
2017-03-31 01:58:05 +02:00
|
|
|
value = LocaleController.formatTTLString(encryptedChat.ttl);
|
2015-10-29 18:10:07 +01:00
|
|
|
}
|
2019-01-23 18:03:33 +01:00
|
|
|
textCell.setTextAndValue(LocaleController.getString("MessageLifetime", R.string.MessageLifetime), value, false);
|
2019-06-04 12:14:50 +02:00
|
|
|
} else if (position == unblockRow) {
|
|
|
|
textCell.setText(LocaleController.getString("Unblock", R.string.Unblock), false);
|
|
|
|
textCell.setColors(null, Theme.key_windowBackgroundWhiteRedText5);
|
2019-01-23 18:03:33 +01:00
|
|
|
} else if (position == startSecretChatRow) {
|
|
|
|
textCell.setText(LocaleController.getString("StartEncryptedChat", R.string.StartEncryptedChat), false);
|
|
|
|
textCell.setColors(null, Theme.key_windowBackgroundWhiteGreenText2);
|
|
|
|
} else if (position == settingsKeyRow) {
|
|
|
|
IdenticonDrawable identiconDrawable = new IdenticonDrawable();
|
|
|
|
TLRPC.EncryptedChat encryptedChat = MessagesController.getInstance(currentAccount).getEncryptedChat((int) (dialog_id >> 32));
|
|
|
|
identiconDrawable.setEncryptedChat(encryptedChat);
|
|
|
|
textCell.setTextAndValueDrawable(LocaleController.getString("EncryptionKey", R.string.EncryptionKey), identiconDrawable, false);
|
|
|
|
} else if (position == leaveChannelRow) {
|
|
|
|
textCell.setColors(null, Theme.key_windowBackgroundWhiteRedText5);
|
|
|
|
textCell.setText(LocaleController.getString("LeaveChannel", R.string.LeaveChannel), false);
|
|
|
|
} else if (position == joinRow) {
|
|
|
|
textCell.setColors(null, Theme.key_windowBackgroundWhiteBlueText2);
|
|
|
|
textCell.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlueText2));
|
|
|
|
if (currentChat.megagroup) {
|
|
|
|
textCell.setText(LocaleController.getString("ProfileJoinGroup", R.string.ProfileJoinGroup), false);
|
|
|
|
} else {
|
|
|
|
textCell.setText(LocaleController.getString("ProfileJoinChannel", R.string.ProfileJoinChannel), false);
|
|
|
|
}
|
|
|
|
} else if (position == subscribersRow) {
|
|
|
|
if (chatInfo != null) {
|
|
|
|
if (ChatObject.isChannel(currentChat) && !currentChat.megagroup) {
|
|
|
|
textCell.setTextAndValueAndIcon(LocaleController.getString("ChannelSubscribers", R.string.ChannelSubscribers), String.format("%d", chatInfo.participants_count), R.drawable.actions_viewmembers, position != membersSectionRow - 1);
|
|
|
|
} else {
|
|
|
|
textCell.setTextAndValueAndIcon(LocaleController.getString("ChannelMembers", R.string.ChannelMembers), String.format("%d", chatInfo.participants_count), R.drawable.actions_viewmembers, position != membersSectionRow - 1);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (ChatObject.isChannel(currentChat) && !currentChat.megagroup) {
|
|
|
|
textCell.setTextAndIcon(LocaleController.getString("ChannelSubscribers", R.string.ChannelSubscribers), R.drawable.actions_viewmembers, position != membersSectionRow - 1);
|
|
|
|
} else {
|
|
|
|
textCell.setTextAndIcon(LocaleController.getString("ChannelMembers", R.string.ChannelMembers), R.drawable.actions_viewmembers, position != membersSectionRow - 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (position == administratorsRow) {
|
|
|
|
if (chatInfo != null) {
|
|
|
|
textCell.setTextAndValueAndIcon(LocaleController.getString("ChannelAdministrators", R.string.ChannelAdministrators), String.format("%d", chatInfo.admins_count), R.drawable.actions_addadmin, position != membersSectionRow - 1);
|
|
|
|
} else {
|
|
|
|
textCell.setTextAndIcon(LocaleController.getString("ChannelAdministrators", R.string.ChannelAdministrators), R.drawable.actions_addadmin, position != membersSectionRow - 1);
|
|
|
|
}
|
|
|
|
} else if (position == blockedUsersRow) {
|
|
|
|
if (chatInfo != null) {
|
|
|
|
textCell.setTextAndValueAndIcon(LocaleController.getString("ChannelBlacklist", R.string.ChannelBlacklist), String.format("%d", Math.max(chatInfo.banned_count, chatInfo.kicked_count)), R.drawable.actions_removed, position != membersSectionRow - 1);
|
|
|
|
} else {
|
|
|
|
textCell.setTextAndIcon(LocaleController.getString("ChannelBlacklist", R.string.ChannelBlacklist), R.drawable.actions_removed, position != membersSectionRow - 1);
|
|
|
|
}
|
|
|
|
} else if (position == addMemberRow) {
|
|
|
|
textCell.setColors(Theme.key_windowBackgroundWhiteBlueIcon, Theme.key_windowBackgroundWhiteBlueButton);
|
|
|
|
if (chat_id > 0) {
|
|
|
|
textCell.setTextAndIcon(LocaleController.getString("AddMember", R.string.AddMember), R.drawable.actions_addmember2, true);
|
|
|
|
} else {
|
|
|
|
textCell.setTextAndIcon(LocaleController.getString("AddRecipient", R.string.AddRecipient), R.drawable.actions_addmember2, true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 6:
|
|
|
|
NotificationsCheckCell checkCell = (NotificationsCheckCell) holder.itemView;
|
|
|
|
if (position == notificationsRow) {
|
2018-07-30 04:07:02 +02:00
|
|
|
SharedPreferences preferences = MessagesController.getNotificationsSettings(currentAccount);
|
2017-03-31 01:58:05 +02:00
|
|
|
long did;
|
|
|
|
if (dialog_id != 0) {
|
|
|
|
did = dialog_id;
|
|
|
|
} else if (user_id != 0) {
|
|
|
|
did = user_id;
|
|
|
|
} else {
|
|
|
|
did = -chat_id;
|
|
|
|
}
|
|
|
|
|
2019-01-23 18:03:33 +01:00
|
|
|
boolean enabled = false;
|
2017-03-31 01:58:05 +02:00
|
|
|
boolean custom = preferences.getBoolean("custom_" + did, false);
|
|
|
|
boolean hasOverride = preferences.contains("notify2_" + did);
|
|
|
|
int value = preferences.getInt("notify2_" + did, 0);
|
|
|
|
int delta = preferences.getInt("notifyuntil_" + did, 0);
|
|
|
|
String val;
|
|
|
|
if (value == 3 && delta != Integer.MAX_VALUE) {
|
2018-07-30 04:07:02 +02:00
|
|
|
delta -= ConnectionsManager.getInstance(currentAccount).getCurrentTime();
|
2017-03-31 01:58:05 +02:00
|
|
|
if (delta <= 0) {
|
|
|
|
if (custom) {
|
|
|
|
val = LocaleController.getString("NotificationsCustom", R.string.NotificationsCustom);
|
|
|
|
} else {
|
|
|
|
val = LocaleController.getString("NotificationsOn", R.string.NotificationsOn);
|
|
|
|
}
|
2019-01-23 18:03:33 +01:00
|
|
|
enabled = true;
|
2017-03-31 01:58:05 +02:00
|
|
|
} else if (delta < 60 * 60) {
|
|
|
|
val = LocaleController.formatString("WillUnmuteIn", R.string.WillUnmuteIn, LocaleController.formatPluralString("Minutes", delta / 60));
|
|
|
|
} else if (delta < 60 * 60 * 24) {
|
|
|
|
val = LocaleController.formatString("WillUnmuteIn", R.string.WillUnmuteIn, LocaleController.formatPluralString("Hours", (int) Math.ceil(delta / 60.0f / 60)));
|
|
|
|
} else if (delta < 60 * 60 * 24 * 365) {
|
|
|
|
val = LocaleController.formatString("WillUnmuteIn", R.string.WillUnmuteIn, LocaleController.formatPluralString("Days", (int) Math.ceil(delta / 60.0f / 60 / 24)));
|
|
|
|
} else {
|
|
|
|
val = null;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (value == 0) {
|
|
|
|
if (hasOverride) {
|
|
|
|
enabled = true;
|
|
|
|
} else {
|
2019-01-23 18:03:33 +01:00
|
|
|
enabled = NotificationsController.getInstance(currentAccount).isGlobalNotificationsEnabled(did);
|
2017-03-31 01:58:05 +02:00
|
|
|
}
|
|
|
|
} else if (value == 1) {
|
|
|
|
enabled = true;
|
|
|
|
} else if (value == 2) {
|
|
|
|
enabled = false;
|
|
|
|
} else {
|
|
|
|
enabled = false;
|
|
|
|
}
|
|
|
|
if (enabled && custom) {
|
|
|
|
val = LocaleController.getString("NotificationsCustom", R.string.NotificationsCustom);
|
|
|
|
} else {
|
2019-01-23 18:03:33 +01:00
|
|
|
val = enabled ? LocaleController.getString("NotificationsOn", R.string.NotificationsOn) : LocaleController.getString("NotificationsOff", R.string.NotificationsOff);
|
2017-03-31 01:58:05 +02:00
|
|
|
}
|
|
|
|
}
|
2019-01-23 18:03:33 +01:00
|
|
|
if (val == null) {
|
|
|
|
val = LocaleController.getString("NotificationsOff", R.string.NotificationsOff);
|
2017-07-08 18:32:04 +02:00
|
|
|
}
|
2019-01-23 18:03:33 +01:00
|
|
|
checkCell.setTextAndValueAndCheck(LocaleController.getString("Notifications", R.string.Notifications), val, enabled, false);
|
2015-09-24 22:52:02 +02:00
|
|
|
}
|
2015-10-29 18:10:07 +01:00
|
|
|
break;
|
2019-01-23 18:03:33 +01:00
|
|
|
case 7:
|
|
|
|
View sectionCell = holder.itemView;
|
|
|
|
sectionCell.setTag(position);
|
|
|
|
Drawable drawable;
|
2019-07-18 15:01:39 +02:00
|
|
|
if (position == infoSectionRow && sharedSectionRow == -1 && lastSectionRow == -1 && settingsSectionRow == -1 || position == settingsSectionRow && sharedSectionRow == -1 || position == sharedSectionRow && lastSectionRow == -1 || position == lastSectionRow || position == membersSectionRow && lastSectionRow == -1 && (sharedSectionRow == -1 || membersSectionRow > sharedSectionRow)) {
|
2019-01-23 18:03:33 +01:00
|
|
|
drawable = Theme.getThemedDrawable(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow);
|
|
|
|
} else {
|
|
|
|
drawable = Theme.getThemedDrawable(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow);
|
|
|
|
}
|
|
|
|
CombinedDrawable combinedDrawable = new CombinedDrawable(new ColorDrawable(Theme.getColor(Theme.key_windowBackgroundGray)), drawable);
|
|
|
|
combinedDrawable.setFullsize(true);
|
|
|
|
sectionCell.setBackgroundDrawable(combinedDrawable);
|
|
|
|
break;
|
|
|
|
case 8:
|
|
|
|
UserCell userCell = (UserCell) holder.itemView;
|
2016-03-16 13:26:32 +01:00
|
|
|
TLRPC.ChatParticipant part;
|
|
|
|
if (!sortedUsers.isEmpty()) {
|
2019-01-23 18:03:33 +01:00
|
|
|
part = chatInfo.participants.participants.get(sortedUsers.get(position - membersStartRow));
|
2015-11-26 22:04:02 +01:00
|
|
|
} else {
|
2019-01-23 18:03:33 +01:00
|
|
|
part = chatInfo.participants.participants.get(position - membersStartRow);
|
2016-03-16 13:26:32 +01:00
|
|
|
}
|
|
|
|
if (part != null) {
|
2019-08-22 01:53:26 +02:00
|
|
|
String role;
|
2016-03-16 13:26:32 +01:00
|
|
|
if (part instanceof TLRPC.TL_chatChannelParticipant) {
|
|
|
|
TLRPC.ChannelParticipant channelParticipant = ((TLRPC.TL_chatChannelParticipant) part).channelParticipant;
|
2019-08-22 01:53:26 +02:00
|
|
|
if (!TextUtils.isEmpty(channelParticipant.rank)) {
|
|
|
|
role = channelParticipant.rank;
|
2016-04-22 15:49:00 +02:00
|
|
|
} else {
|
2019-08-22 01:53:26 +02:00
|
|
|
if (channelParticipant instanceof TLRPC.TL_channelParticipantCreator) {
|
|
|
|
role = LocaleController.getString("ChannelCreator", R.string.ChannelCreator);
|
|
|
|
} else if (channelParticipant instanceof TLRPC.TL_channelParticipantAdmin) {
|
|
|
|
role = LocaleController.getString("ChannelAdmin", R.string.ChannelAdmin);
|
|
|
|
} else {
|
|
|
|
role = null;
|
|
|
|
}
|
2016-04-22 15:49:00 +02:00
|
|
|
}
|
2016-03-16 13:26:32 +01:00
|
|
|
} else {
|
2016-04-22 15:49:00 +02:00
|
|
|
if (part instanceof TLRPC.TL_chatParticipantCreator) {
|
2019-08-22 01:53:26 +02:00
|
|
|
role = LocaleController.getString("ChannelCreator", R.string.ChannelCreator);
|
2019-01-23 18:03:33 +01:00
|
|
|
} else if (part instanceof TLRPC.TL_chatParticipantAdmin) {
|
2019-08-22 01:53:26 +02:00
|
|
|
role = LocaleController.getString("ChannelAdmin", R.string.ChannelAdmin);
|
2016-04-22 15:49:00 +02:00
|
|
|
} else {
|
2019-08-22 01:53:26 +02:00
|
|
|
role = null;
|
2016-04-22 15:49:00 +02:00
|
|
|
}
|
2016-03-16 13:26:32 +01:00
|
|
|
}
|
2019-08-22 01:53:26 +02:00
|
|
|
userCell.setAdminRole(role);
|
2019-05-14 14:08:05 +02:00
|
|
|
userCell.setData(MessagesController.getInstance(currentAccount).getUser(part.user_id), null, null, 0, position != membersEndRow - 1);
|
2015-11-26 22:04:02 +01:00
|
|
|
}
|
2015-10-29 18:10:07 +01:00
|
|
|
break;
|
|
|
|
}
|
2017-03-31 01:58:05 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean isEnabled(RecyclerView.ViewHolder holder) {
|
2019-01-23 18:03:33 +01:00
|
|
|
int type = holder.getItemViewType();
|
|
|
|
return type != 1 && type != 5 && type != 7 && type != 9 && type != 10 && type != 11;
|
2015-10-29 18:10:07 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public int getItemCount() {
|
|
|
|
return rowCount;
|
2013-10-25 17:19:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public int getItemViewType(int i) {
|
2019-01-23 18:03:33 +01:00
|
|
|
if (i == infoHeaderRow || i == sharedHeaderRow || i == membersHeaderRow) {
|
2014-05-17 01:05:49 +02:00
|
|
|
return 1;
|
2019-07-18 15:01:39 +02:00
|
|
|
} else if (i == phoneRow || i == usernameRow || i == locationRow) {
|
2014-05-17 01:05:49 +02:00
|
|
|
return 2;
|
2019-01-23 18:03:33 +01:00
|
|
|
} else if (i == userInfoRow || i == channelInfoRow) {
|
2014-05-17 01:05:49 +02:00
|
|
|
return 3;
|
2019-01-23 18:03:33 +01:00
|
|
|
} else if (i == settingsTimerRow || i == settingsKeyRow || i == photosRow || i == filesRow ||
|
|
|
|
i == linksRow || i == audioRow || i == voiceRow || i == groupsInCommonRow ||
|
|
|
|
i == startSecretChatRow || i == subscribersRow || i == administratorsRow || i == blockedUsersRow ||
|
2019-06-04 12:14:50 +02:00
|
|
|
i == leaveChannelRow || i == addMemberRow || i == joinRow || i == unblockRow) {
|
2014-11-12 23:16:59 +01:00
|
|
|
return 4;
|
2019-01-23 18:03:33 +01:00
|
|
|
} else if (i == notificationsDividerRow) {
|
2014-11-12 23:16:59 +01:00
|
|
|
return 5;
|
2019-01-23 18:03:33 +01:00
|
|
|
} else if (i == notificationsRow) {
|
2015-05-03 13:48:36 +02:00
|
|
|
return 6;
|
2019-01-23 18:03:33 +01:00
|
|
|
} else if (i == infoSectionRow || i == sharedSectionRow || i == lastSectionRow || i == membersSectionRow || i == settingsSectionRow) {
|
2015-11-26 22:04:02 +01:00
|
|
|
return 7;
|
2019-01-23 18:03:33 +01:00
|
|
|
} else if (i >= membersStartRow && i < membersEndRow) {
|
2015-11-26 22:04:02 +01:00
|
|
|
return 8;
|
2019-01-23 18:03:33 +01:00
|
|
|
} else if (i == emptyRow) {
|
|
|
|
return 11;
|
2013-10-25 17:19:00 +02:00
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
2017-03-31 01:58:05 +02:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public ThemeDescription[] getThemeDescriptions() {
|
2018-08-27 10:33:11 +02:00
|
|
|
ThemeDescription.ThemeDescriptionDelegate cellDelegate = () -> {
|
|
|
|
if (listView != null) {
|
|
|
|
int count = listView.getChildCount();
|
|
|
|
for (int a = 0; a < count; a++) {
|
|
|
|
View child = listView.getChildAt(a);
|
|
|
|
if (child instanceof UserCell) {
|
|
|
|
((UserCell) child).update(0);
|
2017-03-31 01:58:05 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
return new ThemeDescription[]{
|
2019-01-23 18:03:33 +01:00
|
|
|
new ThemeDescription(listView, 0, null, null, null, null, Theme.key_windowBackgroundWhite),
|
|
|
|
new ThemeDescription(listView, 0, null, null, null, null, Theme.key_windowBackgroundGray),
|
2017-03-31 01:58:05 +02:00
|
|
|
new ThemeDescription(actionBar, ThemeDescription.FLAG_AB_SUBMENUBACKGROUND, null, null, null, null, Theme.key_actionBarDefaultSubmenuBackground),
|
|
|
|
new ThemeDescription(actionBar, ThemeDescription.FLAG_AB_SUBMENUITEM, null, null, null, null, Theme.key_actionBarDefaultSubmenuItem),
|
2019-05-14 14:08:05 +02:00
|
|
|
new ThemeDescription(actionBar, ThemeDescription.FLAG_AB_SUBMENUITEM | ThemeDescription.FLAG_IMAGECOLOR, null, null, null, null, Theme.key_actionBarDefaultSubmenuItemIcon),
|
2017-03-31 01:58:05 +02:00
|
|
|
|
|
|
|
new ThemeDescription(actionBar, ThemeDescription.FLAG_BACKGROUND, null, null, null, null, Theme.key_avatar_backgroundActionBarBlue),
|
|
|
|
new ThemeDescription(listView, ThemeDescription.FLAG_LISTGLOWCOLOR, null, null, null, null, Theme.key_avatar_backgroundActionBarBlue),
|
|
|
|
new ThemeDescription(topView, ThemeDescription.FLAG_BACKGROUND, null, null, null, null, Theme.key_avatar_backgroundActionBarBlue),
|
|
|
|
new ThemeDescription(actionBar, ThemeDescription.FLAG_AB_SELECTORCOLOR, null, null, null, null, Theme.key_avatar_actionBarSelectorBlue),
|
|
|
|
new ThemeDescription(nameTextView[1], ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_profile_title),
|
2019-02-08 03:30:32 +01:00
|
|
|
new ThemeDescription(nameTextView[1], ThemeDescription.FLAG_BACKGROUND, null, null, null, null, Theme.key_avatar_backgroundActionBarBlue),
|
2019-06-04 12:14:50 +02:00
|
|
|
new ThemeDescription(onlineTextView[1], ThemeDescription.FLAG_TEXTCOLOR | ThemeDescription.FLAG_CHECKTAG, null, null, null, null, Theme.key_profile_status),
|
|
|
|
new ThemeDescription(onlineTextView[1], ThemeDescription.FLAG_TEXTCOLOR | ThemeDescription.FLAG_CHECKTAG, null, null, null, null, Theme.key_avatar_subtitleInProfileBlue),
|
2017-03-31 01:58:05 +02:00
|
|
|
|
|
|
|
new ThemeDescription(listView, ThemeDescription.FLAG_SELECTOR, null, null, null, null, Theme.key_listSelector),
|
|
|
|
|
|
|
|
new ThemeDescription(listView, 0, new Class[]{View.class}, Theme.dividerPaint, null, null, Theme.key_divider),
|
|
|
|
|
2019-09-10 12:56:11 +02:00
|
|
|
new ThemeDescription(avatarImage, 0, null, null, new Drawable[]{Theme.avatar_savedDrawable}, null, Theme.key_avatar_text),
|
2017-03-31 01:58:05 +02:00
|
|
|
new ThemeDescription(avatarImage, 0, null, null, new Drawable[]{avatarDrawable}, null, Theme.key_avatar_backgroundInProfileBlue),
|
|
|
|
|
|
|
|
new ThemeDescription(writeButton, ThemeDescription.FLAG_IMAGECOLOR, null, null, null, null, Theme.key_profile_actionIcon),
|
|
|
|
new ThemeDescription(writeButton, ThemeDescription.FLAG_BACKGROUNDFILTER, null, null, null, null, Theme.key_profile_actionBackground),
|
|
|
|
new ThemeDescription(writeButton, ThemeDescription.FLAG_BACKGROUNDFILTER | ThemeDescription.FLAG_DRAWABLESELECTEDSTATE, null, null, null, null, Theme.key_profile_actionPressedBackground),
|
|
|
|
|
|
|
|
new ThemeDescription(listView, ThemeDescription.FLAG_CHECKTAG, new Class[]{TextCell.class}, new String[]{"textView"}, null, null, null, Theme.key_windowBackgroundWhiteBlackText),
|
|
|
|
new ThemeDescription(listView, ThemeDescription.FLAG_CHECKTAG, new Class[]{TextCell.class}, new String[]{"textView"}, null, null, null, Theme.key_windowBackgroundWhiteGreenText2),
|
|
|
|
new ThemeDescription(listView, ThemeDescription.FLAG_CHECKTAG, new Class[]{TextCell.class}, new String[]{"textView"}, null, null, null, Theme.key_windowBackgroundWhiteRedText5),
|
2019-01-23 18:03:33 +01:00
|
|
|
new ThemeDescription(listView, ThemeDescription.FLAG_CHECKTAG, new Class[]{TextCell.class}, new String[]{"textView"}, null, null, null, Theme.key_windowBackgroundWhiteBlueText2),
|
|
|
|
new ThemeDescription(listView, ThemeDescription.FLAG_CHECKTAG, new Class[]{TextCell.class}, new String[]{"textView"}, null, null, null, Theme.key_windowBackgroundWhiteBlueButton),
|
2017-03-31 01:58:05 +02:00
|
|
|
new ThemeDescription(listView, 0, new Class[]{TextCell.class}, new String[]{"valueTextView"}, null, null, null, Theme.key_windowBackgroundWhiteValueText),
|
2019-01-23 18:03:33 +01:00
|
|
|
new ThemeDescription(listView, ThemeDescription.FLAG_CHECKTAG, new Class[]{TextCell.class}, new String[]{"imageView"}, null, null, null, Theme.key_windowBackgroundWhiteGrayIcon),
|
|
|
|
new ThemeDescription(listView, ThemeDescription.FLAG_CHECKTAG, new Class[]{TextCell.class}, new String[]{"imageView"}, null, null, null, Theme.key_windowBackgroundWhiteBlueIcon),
|
2017-03-31 01:58:05 +02:00
|
|
|
|
|
|
|
new ThemeDescription(listView, 0, new Class[]{TextDetailCell.class}, new String[]{"textView"}, null, null, null, Theme.key_windowBackgroundWhiteBlackText),
|
2019-01-23 18:03:33 +01:00
|
|
|
new ThemeDescription(listView, 0, new Class[]{TextDetailCell.class}, new String[]{"valueTextView"}, null, null, null, Theme.key_windowBackgroundWhiteGrayText2),
|
|
|
|
|
|
|
|
new ThemeDescription(listView, 0, new Class[]{HeaderCell.class}, new String[]{"textView"}, null, null, null, Theme.key_windowBackgroundWhiteBlueHeader),
|
2017-03-31 01:58:05 +02:00
|
|
|
|
2019-01-23 18:03:33 +01:00
|
|
|
new ThemeDescription(listView, 0, new Class[]{NotificationsCheckCell.class}, new String[]{"textView"}, null, null, null, Theme.key_windowBackgroundWhiteBlackText),
|
|
|
|
new ThemeDescription(listView, 0, new Class[]{NotificationsCheckCell.class}, new String[]{"valueTextView"}, null, null, null, Theme.key_windowBackgroundWhiteGrayText2),
|
|
|
|
new ThemeDescription(listView, 0, new Class[]{NotificationsCheckCell.class}, new String[]{"checkBox"}, null, null, null, Theme.key_switchTrack),
|
|
|
|
new ThemeDescription(listView, 0, new Class[]{NotificationsCheckCell.class}, new String[]{"checkBox"}, null, null, null, Theme.key_switchTrackChecked),
|
|
|
|
|
|
|
|
new ThemeDescription(listView, ThemeDescription.FLAG_TEXTCOLOR, new Class[]{UserCell.class}, new String[]{"adminTextView"}, null, null, null, Theme.key_profile_creatorIcon),
|
2018-07-30 04:07:02 +02:00
|
|
|
new ThemeDescription(listView, 0, new Class[]{UserCell.class}, new String[]{"imageView"}, null, null, null, Theme.key_windowBackgroundWhiteGrayIcon),
|
2017-03-31 01:58:05 +02:00
|
|
|
new ThemeDescription(listView, 0, new Class[]{UserCell.class}, new String[]{"nameTextView"}, null, null, null, Theme.key_windowBackgroundWhiteBlackText),
|
2018-07-30 04:07:02 +02:00
|
|
|
new ThemeDescription(listView, 0, new Class[]{UserCell.class}, new String[]{"statusColor"}, null, null, cellDelegate, Theme.key_windowBackgroundWhiteGrayText),
|
|
|
|
new ThemeDescription(listView, 0, new Class[]{UserCell.class}, new String[]{"statusOnlineColor"}, null, null, cellDelegate, Theme.key_windowBackgroundWhiteBlueText),
|
2019-09-10 12:56:11 +02:00
|
|
|
new ThemeDescription(listView, 0, new Class[]{UserCell.class}, null, new Drawable[]{Theme.avatar_savedDrawable}, null, Theme.key_avatar_text),
|
2018-07-30 04:07:02 +02:00
|
|
|
new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_avatar_backgroundRed),
|
|
|
|
new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_avatar_backgroundOrange),
|
|
|
|
new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_avatar_backgroundViolet),
|
|
|
|
new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_avatar_backgroundGreen),
|
|
|
|
new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_avatar_backgroundCyan),
|
|
|
|
new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_avatar_backgroundBlue),
|
|
|
|
new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_avatar_backgroundPink),
|
2017-03-31 01:58:05 +02:00
|
|
|
|
2019-07-18 15:01:39 +02:00
|
|
|
new ThemeDescription(undoView, ThemeDescription.FLAG_BACKGROUND, null, null, null, null, Theme.key_undo_background),
|
|
|
|
new ThemeDescription(undoView, 0, new Class[]{UndoView.class}, new String[]{"undoImageView"}, null, null, null, Theme.key_undo_cancelColor),
|
|
|
|
new ThemeDescription(undoView, 0, new Class[]{UndoView.class}, new String[]{"undoTextView"}, null, null, null, Theme.key_undo_cancelColor),
|
|
|
|
new ThemeDescription(undoView, 0, new Class[]{UndoView.class}, new String[]{"infoTextView"}, null, null, null, Theme.key_undo_infoColor),
|
|
|
|
new ThemeDescription(undoView, 0, new Class[]{UndoView.class}, new String[]{"textPaint"}, null, null, null, Theme.key_undo_infoColor),
|
|
|
|
new ThemeDescription(undoView, 0, new Class[]{UndoView.class}, new String[]{"progressPaint"}, null, null, null, Theme.key_undo_infoColor),
|
|
|
|
new ThemeDescription(undoView, ThemeDescription.FLAG_IMAGECOLOR, new Class[]{UndoView.class}, new String[]{"leftImageView"}, null, null, null, Theme.key_undo_infoColor),
|
|
|
|
|
2017-03-31 01:58:05 +02:00
|
|
|
new ThemeDescription(listView, ThemeDescription.FLAG_TEXTCOLOR, new Class[]{AboutLinkCell.class}, Theme.profile_aboutTextPaint, null, null, Theme.key_windowBackgroundWhiteBlackText),
|
|
|
|
new ThemeDescription(listView, ThemeDescription.FLAG_LINKCOLOR, new Class[]{AboutLinkCell.class}, Theme.profile_aboutTextPaint, null, null, Theme.key_windowBackgroundWhiteLinkText),
|
|
|
|
new ThemeDescription(listView, 0, new Class[]{AboutLinkCell.class}, Theme.linkSelectionPaint, null, null, Theme.key_windowBackgroundWhiteLinkSelection),
|
|
|
|
|
|
|
|
new ThemeDescription(listView, ThemeDescription.FLAG_BACKGROUNDFILTER, new Class[]{ShadowSectionCell.class}, null, null, null, Theme.key_windowBackgroundGrayShadow),
|
|
|
|
new ThemeDescription(listView, ThemeDescription.FLAG_BACKGROUNDFILTER | ThemeDescription.FLAG_CELLBACKGROUNDCOLOR, new Class[]{ShadowSectionCell.class}, null, null, null, Theme.key_windowBackgroundGray),
|
|
|
|
|
|
|
|
new ThemeDescription(listView, ThemeDescription.FLAG_BACKGROUNDFILTER, new Class[]{TextInfoPrivacyCell.class}, null, null, null, Theme.key_windowBackgroundGrayShadow),
|
|
|
|
new ThemeDescription(listView, ThemeDescription.FLAG_BACKGROUNDFILTER | ThemeDescription.FLAG_CELLBACKGROUNDCOLOR, new Class[]{TextInfoPrivacyCell.class}, null, null, null, Theme.key_windowBackgroundGray),
|
|
|
|
new ThemeDescription(listView, 0, new Class[]{TextInfoPrivacyCell.class}, new String[]{"textView"}, null, null, null, Theme.key_windowBackgroundWhiteGrayText4),
|
|
|
|
|
|
|
|
new ThemeDescription(nameTextView[1], 0, null, null, new Drawable[]{Theme.profile_verifiedCheckDrawable}, null, Theme.key_profile_verifiedCheck),
|
|
|
|
new ThemeDescription(nameTextView[1], 0, null, null, new Drawable[]{Theme.profile_verifiedDrawable}, null, Theme.key_profile_verifiedBackground),
|
|
|
|
};
|
|
|
|
}
|
2013-10-25 17:19:00 +02:00
|
|
|
}
|