2017-07-08 18:32:04 +02:00
|
|
|
/*
|
2019-01-23 18:03:33 +01:00
|
|
|
* This is the source code of Telegram for Android v. 5.x.x.
|
2017-07-08 18:32:04 +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.
|
2017-07-08 18:32:04 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
package org.telegram.ui;
|
|
|
|
|
|
|
|
import android.Manifest;
|
|
|
|
import android.animation.Animator;
|
|
|
|
import android.animation.AnimatorListenerAdapter;
|
|
|
|
import android.animation.AnimatorSet;
|
|
|
|
import android.animation.ObjectAnimator;
|
|
|
|
import android.annotation.TargetApi;
|
|
|
|
import android.app.DatePickerDialog;
|
|
|
|
import android.content.Context;
|
|
|
|
import android.content.Intent;
|
|
|
|
import android.content.pm.PackageManager;
|
|
|
|
import android.graphics.Canvas;
|
|
|
|
import android.graphics.Outline;
|
|
|
|
import android.graphics.Paint;
|
|
|
|
import android.graphics.Path;
|
|
|
|
import android.graphics.PorterDuff;
|
|
|
|
import android.graphics.PorterDuffColorFilter;
|
|
|
|
import android.graphics.PorterDuffXfermode;
|
|
|
|
import android.graphics.drawable.Drawable;
|
|
|
|
import android.net.Uri;
|
|
|
|
import android.os.Build;
|
|
|
|
import android.os.Bundle;
|
|
|
|
import android.text.TextUtils;
|
|
|
|
import android.text.style.CharacterStyle;
|
|
|
|
import android.text.style.ClickableSpan;
|
|
|
|
import android.text.style.URLSpan;
|
2018-07-30 04:07:02 +02:00
|
|
|
import android.util.LongSparseArray;
|
|
|
|
import android.util.SparseArray;
|
2017-07-08 18:32:04 +02:00
|
|
|
import android.util.TypedValue;
|
|
|
|
import android.view.Gravity;
|
2020-09-30 15:48:47 +02:00
|
|
|
import android.view.MotionEvent;
|
2017-07-08 18:32:04 +02:00
|
|
|
import android.view.TextureView;
|
|
|
|
import android.view.View;
|
|
|
|
import android.view.ViewGroup;
|
|
|
|
import android.view.ViewOutlineProvider;
|
|
|
|
import android.view.ViewTreeObserver;
|
2020-07-26 10:03:38 +02:00
|
|
|
import android.view.accessibility.AccessibilityNodeInfo;
|
2017-07-08 18:32:04 +02:00
|
|
|
import android.widget.EditText;
|
|
|
|
import android.widget.FrameLayout;
|
|
|
|
import android.widget.ImageView;
|
|
|
|
import android.widget.TextView;
|
|
|
|
import android.widget.Toast;
|
|
|
|
|
2020-12-17 06:45:19 +01:00
|
|
|
import androidx.core.content.FileProvider;
|
|
|
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
|
|
|
import androidx.recyclerview.widget.LinearSmoothScrollerCustom;
|
|
|
|
import androidx.recyclerview.widget.RecyclerView;
|
|
|
|
|
2018-08-27 10:33:11 +02:00
|
|
|
import com.google.android.exoplayer2.ui.AspectRatioFrameLayout;
|
|
|
|
|
2017-07-08 18:32:04 +02:00
|
|
|
import org.telegram.messenger.AndroidUtilities;
|
|
|
|
import org.telegram.messenger.BuildConfig;
|
|
|
|
import org.telegram.messenger.BuildVars;
|
|
|
|
import org.telegram.messenger.ChatObject;
|
|
|
|
import org.telegram.messenger.ContactsController;
|
|
|
|
import org.telegram.messenger.FileLoader;
|
|
|
|
import org.telegram.messenger.FileLog;
|
2020-12-17 06:45:19 +01:00
|
|
|
import org.telegram.messenger.ImageLocation;
|
2017-07-08 18:32:04 +02:00
|
|
|
import org.telegram.messenger.ImageReceiver;
|
|
|
|
import org.telegram.messenger.LocaleController;
|
|
|
|
import org.telegram.messenger.MediaController;
|
2020-12-17 06:45:19 +01:00
|
|
|
import org.telegram.messenger.MediaDataController;
|
2017-07-08 18:32:04 +02:00
|
|
|
import org.telegram.messenger.MessageObject;
|
|
|
|
import org.telegram.messenger.MessagesController;
|
|
|
|
import org.telegram.messenger.NotificationCenter;
|
|
|
|
import org.telegram.messenger.R;
|
|
|
|
import org.telegram.messenger.UserConfig;
|
|
|
|
import org.telegram.messenger.Utilities;
|
|
|
|
import org.telegram.messenger.browser.Browser;
|
|
|
|
import org.telegram.tgnet.ConnectionsManager;
|
|
|
|
import org.telegram.tgnet.TLRPC;
|
|
|
|
import org.telegram.ui.ActionBar.ActionBar;
|
|
|
|
import org.telegram.ui.ActionBar.ActionBarMenu;
|
|
|
|
import org.telegram.ui.ActionBar.ActionBarMenuItem;
|
|
|
|
import org.telegram.ui.ActionBar.AlertDialog;
|
|
|
|
import org.telegram.ui.ActionBar.BackDrawable;
|
|
|
|
import org.telegram.ui.ActionBar.BaseFragment;
|
|
|
|
import org.telegram.ui.ActionBar.SimpleTextView;
|
|
|
|
import org.telegram.ui.ActionBar.Theme;
|
|
|
|
import org.telegram.ui.ActionBar.ThemeDescription;
|
|
|
|
import org.telegram.ui.Cells.ChatActionCell;
|
|
|
|
import org.telegram.ui.Cells.ChatLoadingCell;
|
|
|
|
import org.telegram.ui.Cells.ChatMessageCell;
|
|
|
|
import org.telegram.ui.Cells.ChatUnreadCell;
|
|
|
|
import org.telegram.ui.Components.AdminLogFilterAlert;
|
2020-09-30 15:48:47 +02:00
|
|
|
import org.telegram.ui.Components.AlertsCreator;
|
2017-07-08 18:32:04 +02:00
|
|
|
import org.telegram.ui.Components.ChatAvatarContainer;
|
2021-02-23 12:53:38 +01:00
|
|
|
import org.telegram.ui.Components.ClearHistoryAlert;
|
2017-07-08 18:32:04 +02:00
|
|
|
import org.telegram.ui.Components.EmbedBottomSheet;
|
2021-02-23 12:53:38 +01:00
|
|
|
import org.telegram.ui.Components.InviteLinkBottomSheet;
|
2017-07-08 18:32:04 +02:00
|
|
|
import org.telegram.ui.Components.LayoutHelper;
|
2019-12-31 14:08:08 +01:00
|
|
|
import org.telegram.ui.Components.PhonebookShareAlert;
|
2017-07-08 18:32:04 +02:00
|
|
|
import org.telegram.ui.Components.PipRoundVideoView;
|
|
|
|
import org.telegram.ui.Components.RadialProgressView;
|
|
|
|
import org.telegram.ui.Components.RecyclerListView;
|
|
|
|
import org.telegram.ui.Components.ShareAlert;
|
|
|
|
import org.telegram.ui.Components.SizeNotifierFrameLayout;
|
|
|
|
import org.telegram.ui.Components.StickersAlert;
|
|
|
|
import org.telegram.ui.Components.URLSpanMono;
|
|
|
|
import org.telegram.ui.Components.URLSpanNoUnderline;
|
|
|
|
import org.telegram.ui.Components.URLSpanReplacement;
|
|
|
|
import org.telegram.ui.Components.URLSpanUserMention;
|
2021-02-23 12:53:38 +01:00
|
|
|
import org.telegram.ui.Components.UndoView;
|
2017-07-08 18:32:04 +02:00
|
|
|
|
2018-07-30 04:07:02 +02:00
|
|
|
import java.io.BufferedWriter;
|
2017-07-08 18:32:04 +02:00
|
|
|
import java.io.File;
|
2018-07-30 04:07:02 +02:00
|
|
|
import java.io.FileWriter;
|
2017-07-08 18:32:04 +02:00
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
2021-02-03 15:14:57 +01:00
|
|
|
import kotlin.Unit;
|
|
|
|
import tw.nekomimi.nekogram.BottomBuilder;
|
2020-06-25 17:29:04 +02:00
|
|
|
import tw.nekomimi.nekogram.NekoConfig;
|
|
|
|
import tw.nekomimi.nekogram.utils.AlertUtil;
|
2021-02-03 15:14:57 +01:00
|
|
|
import tw.nekomimi.nekogram.utils.ProxyUtil;
|
2020-06-25 17:29:04 +02:00
|
|
|
|
2017-12-08 18:35:59 +01:00
|
|
|
public class ChannelAdminLogActivity extends BaseFragment implements NotificationCenter.NotificationCenterDelegate {
|
2017-07-08 18:32:04 +02:00
|
|
|
|
|
|
|
protected TLRPC.Chat currentChat;
|
|
|
|
|
|
|
|
private ArrayList<ChatMessageCell> chatMessageCellsCache = new ArrayList<>();
|
|
|
|
|
|
|
|
private FrameLayout progressView;
|
|
|
|
private View progressView2;
|
|
|
|
private RadialProgressView progressBar;
|
|
|
|
private RecyclerListView chatListView;
|
2021-02-23 12:53:38 +01:00
|
|
|
private UndoView undoView;
|
2017-07-08 18:32:04 +02:00
|
|
|
private LinearLayoutManager chatLayoutManager;
|
|
|
|
private ChatActivityAdapter chatAdapter;
|
|
|
|
private TextView bottomOverlayChatText;
|
|
|
|
private ImageView bottomOverlayImage;
|
|
|
|
private FrameLayout bottomOverlayChat;
|
|
|
|
private FrameLayout emptyViewContainer;
|
|
|
|
private ChatAvatarContainer avatarContainer;
|
|
|
|
private TextView emptyView;
|
|
|
|
private ChatActionCell floatingDateView;
|
|
|
|
private ActionBarMenuItem searchItem;
|
|
|
|
private long minEventId;
|
|
|
|
private boolean currentFloatingDateOnScreen;
|
|
|
|
private boolean currentFloatingTopIsNotMessage;
|
|
|
|
private AnimatorSet floatingDateAnimation;
|
|
|
|
private boolean scrollingFloatingDate;
|
|
|
|
private int[] mid = new int[]{2};
|
|
|
|
private boolean searchWas;
|
|
|
|
|
|
|
|
private boolean checkTextureViewPosition;
|
|
|
|
private SizeNotifierFrameLayout contentView;
|
|
|
|
|
|
|
|
private MessageObject selectedObject;
|
|
|
|
|
|
|
|
private FrameLayout searchContainer;
|
|
|
|
private ImageView searchCalendarButton;
|
|
|
|
private ImageView searchUpButton;
|
|
|
|
private ImageView searchDownButton;
|
|
|
|
private SimpleTextView searchCountText;
|
|
|
|
|
|
|
|
private FrameLayout roundVideoContainer;
|
|
|
|
private AspectRatioFrameLayout aspectRatioFrameLayout;
|
|
|
|
private TextureView videoTextureView;
|
|
|
|
private Path aspectPath;
|
|
|
|
private Paint aspectPaint;
|
|
|
|
|
|
|
|
private int scrollToPositionOnRecreate = -1;
|
|
|
|
private int scrollToOffsetOnRecreate = 0;
|
|
|
|
|
|
|
|
private boolean paused = true;
|
|
|
|
private boolean wasPaused = false;
|
|
|
|
|
|
|
|
private boolean openAnimationEnded;
|
|
|
|
|
2018-07-30 04:07:02 +02:00
|
|
|
private LongSparseArray<MessageObject> messagesDict = new LongSparseArray<>();
|
2017-07-08 18:32:04 +02:00
|
|
|
private HashMap<String, ArrayList<MessageObject>> messagesByDays = new HashMap<>();
|
|
|
|
protected ArrayList<MessageObject> messages = new ArrayList<>();
|
|
|
|
private int minDate;
|
|
|
|
private boolean endReached;
|
|
|
|
private boolean loading;
|
|
|
|
private int loadsCount;
|
|
|
|
|
|
|
|
private ArrayList<TLRPC.ChannelParticipant> admins;
|
|
|
|
private TLRPC.TL_channelAdminLogEventsFilter currentFilter = null;
|
|
|
|
private String searchQuery = "";
|
2018-07-30 04:07:02 +02:00
|
|
|
private SparseArray<TLRPC.User> selectedAdmins;
|
2017-07-08 18:32:04 +02:00
|
|
|
|
|
|
|
private MessageObject scrollToMessage;
|
|
|
|
|
2020-06-04 18:47:15 +02:00
|
|
|
private int allowAnimationIndex;
|
|
|
|
|
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
|
|
|
int count = chatListView.getChildCount();
|
|
|
|
|
|
|
|
for (int a = 0; a < count; a++) {
|
|
|
|
ImageReceiver imageReceiver = null;
|
|
|
|
View view = chatListView.getChildAt(a);
|
|
|
|
if (view instanceof ChatMessageCell) {
|
|
|
|
if (messageObject != null) {
|
|
|
|
ChatMessageCell cell = (ChatMessageCell) view;
|
|
|
|
MessageObject message = cell.getMessageObject();
|
|
|
|
if (message != null && message.getId() == messageObject.getId()) {
|
|
|
|
imageReceiver = cell.getPhotoImage();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (view instanceof ChatActionCell) {
|
|
|
|
ChatActionCell cell = (ChatActionCell) view;
|
|
|
|
MessageObject message = cell.getMessageObject();
|
|
|
|
if (message != null) {
|
|
|
|
if (messageObject != null) {
|
|
|
|
if (message.getId() == messageObject.getId()) {
|
|
|
|
imageReceiver = cell.getPhotoImage();
|
|
|
|
}
|
|
|
|
} else if (fileLocation != null && message.photoThumbs != null) {
|
|
|
|
for (int b = 0; b < message.photoThumbs.size(); b++) {
|
|
|
|
TLRPC.PhotoSize photoSize = message.photoThumbs.get(b);
|
|
|
|
if (photoSize.location.volume_id == fileLocation.volume_id && photoSize.location.local_id == fileLocation.local_id) {
|
|
|
|
imageReceiver = cell.getPhotoImage();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (imageReceiver != null) {
|
2020-01-23 07:15:40 +01:00
|
|
|
int[] coords = new int[2];
|
2017-12-08 18:35:59 +01:00
|
|
|
view.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 = chatListView;
|
|
|
|
object.imageReceiver = imageReceiver;
|
2018-07-30 04:07:02 +02:00
|
|
|
object.thumb = imageReceiver.getBitmapSafe();
|
2017-12-08 18:35:59 +01:00
|
|
|
object.radius = imageReceiver.getRoundRadius();
|
|
|
|
object.isEvent = true;
|
|
|
|
return object;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2017-07-08 18:32:04 +02:00
|
|
|
public ChannelAdminLogActivity(TLRPC.Chat chat) {
|
|
|
|
currentChat = chat;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean onFragmentCreate() {
|
|
|
|
super.onFragmentCreate();
|
2019-01-23 18:03:33 +01:00
|
|
|
NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.emojiDidLoad);
|
|
|
|
NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.messagePlayingDidStart);
|
2018-07-30 04:07:02 +02:00
|
|
|
NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.messagePlayingPlayStateChanged);
|
|
|
|
NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.messagePlayingDidReset);
|
|
|
|
NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.messagePlayingProgressDidChanged);
|
|
|
|
NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.didSetNewWallpapper);
|
2017-07-08 18:32:04 +02:00
|
|
|
loadMessages(true);
|
|
|
|
loadAdmins();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onFragmentDestroy() {
|
|
|
|
super.onFragmentDestroy();
|
2019-01-23 18:03:33 +01:00
|
|
|
NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.emojiDidLoad);
|
|
|
|
NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.messagePlayingDidStart);
|
2018-07-30 04:07:02 +02:00
|
|
|
NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.messagePlayingPlayStateChanged);
|
|
|
|
NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.messagePlayingDidReset);
|
|
|
|
NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.messagePlayingProgressDidChanged);
|
|
|
|
NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.didSetNewWallpapper);
|
2020-12-24 06:36:01 +01:00
|
|
|
getNotificationCenter().onAnimationFinish(allowAnimationIndex);
|
2017-07-08 18:32:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
private void updateEmptyPlaceholder() {
|
|
|
|
if (emptyView == null) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (!TextUtils.isEmpty(searchQuery)) {
|
|
|
|
emptyView.setPadding(AndroidUtilities.dp(8), AndroidUtilities.dp(5), AndroidUtilities.dp(8), AndroidUtilities.dp(5));
|
|
|
|
emptyView.setText(AndroidUtilities.replaceTags(LocaleController.formatString("EventLogEmptyTextSearch", R.string.EventLogEmptyTextSearch, searchQuery)));
|
|
|
|
} else if (selectedAdmins != null || currentFilter != null) {
|
|
|
|
emptyView.setPadding(AndroidUtilities.dp(8), AndroidUtilities.dp(5), AndroidUtilities.dp(8), AndroidUtilities.dp(5));
|
|
|
|
emptyView.setText(AndroidUtilities.replaceTags(LocaleController.getString("EventLogEmptySearch", R.string.EventLogEmptySearch)));
|
|
|
|
} else {
|
|
|
|
emptyView.setPadding(AndroidUtilities.dp(16), AndroidUtilities.dp(16), AndroidUtilities.dp(16), AndroidUtilities.dp(16));
|
|
|
|
if (currentChat.megagroup) {
|
|
|
|
emptyView.setText(AndroidUtilities.replaceTags(LocaleController.getString("EventLogEmpty", R.string.EventLogEmpty)));
|
|
|
|
} else {
|
|
|
|
emptyView.setText(AndroidUtilities.replaceTags(LocaleController.getString("EventLogEmptyChannel", R.string.EventLogEmptyChannel)));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private void loadMessages(boolean reset) {
|
|
|
|
if (loading) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (reset) {
|
|
|
|
minEventId = Long.MAX_VALUE;
|
|
|
|
if (progressView != null) {
|
|
|
|
progressView.setVisibility(View.VISIBLE);
|
|
|
|
emptyViewContainer.setVisibility(View.INVISIBLE);
|
|
|
|
chatListView.setEmptyView(null);
|
|
|
|
}
|
|
|
|
messagesDict.clear();
|
|
|
|
messages.clear();
|
|
|
|
messagesByDays.clear();
|
|
|
|
}
|
|
|
|
loading = true;
|
|
|
|
TLRPC.TL_channels_getAdminLog req = new TLRPC.TL_channels_getAdminLog();
|
|
|
|
req.channel = MessagesController.getInputChannel(currentChat);
|
|
|
|
req.q = searchQuery;
|
|
|
|
req.limit = 50;
|
|
|
|
if (!reset && !messages.isEmpty()) {
|
|
|
|
req.max_id = minEventId;
|
|
|
|
} else {
|
|
|
|
req.max_id = 0;
|
|
|
|
}
|
|
|
|
req.min_id = 0;
|
|
|
|
if (currentFilter != null) {
|
|
|
|
req.flags |= 1;
|
|
|
|
req.events_filter = currentFilter;
|
|
|
|
}
|
|
|
|
if (selectedAdmins != null) {
|
|
|
|
req.flags |= 2;
|
2018-07-30 04:07:02 +02:00
|
|
|
for (int a = 0; a < selectedAdmins.size(); a++) {
|
|
|
|
req.admins.add(MessagesController.getInstance(currentAccount).getInputUser(selectedAdmins.valueAt(a)));
|
2017-07-08 18:32:04 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
updateEmptyPlaceholder();
|
2019-01-23 18:03:33 +01:00
|
|
|
ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> {
|
|
|
|
if (response != null) {
|
|
|
|
final TLRPC.TL_channels_adminLogResults res = (TLRPC.TL_channels_adminLogResults) response;
|
|
|
|
AndroidUtilities.runOnUIThread(() -> {
|
|
|
|
MessagesController.getInstance(currentAccount).putUsers(res.users, false);
|
|
|
|
MessagesController.getInstance(currentAccount).putChats(res.chats, false);
|
|
|
|
boolean added = false;
|
|
|
|
int oldRowsCount = messages.size();
|
|
|
|
for (int a = 0; a < res.events.size(); a++) {
|
|
|
|
TLRPC.TL_channelAdminLogEvent event = res.events.get(a);
|
|
|
|
if (messagesDict.indexOfKey(event.id) >= 0) {
|
|
|
|
continue;
|
2017-07-08 18:32:04 +02:00
|
|
|
}
|
2019-07-18 15:01:39 +02:00
|
|
|
if (event.action instanceof TLRPC.TL_channelAdminLogEventActionParticipantToggleAdmin) {
|
2020-12-23 08:48:30 +01:00
|
|
|
TLRPC.TL_channelAdminLogEventActionParticipantToggleAdmin action = (TLRPC.TL_channelAdminLogEventActionParticipantToggleAdmin) event.action;
|
|
|
|
if (action.prev_participant instanceof TLRPC.TL_channelParticipantCreator && !(action.new_participant instanceof TLRPC.TL_channelParticipantCreator)) {
|
2019-07-18 15:01:39 +02:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
2019-01-23 18:03:33 +01:00
|
|
|
minEventId = Math.min(minEventId, event.id);
|
|
|
|
added = true;
|
|
|
|
MessageObject messageObject = new MessageObject(currentAccount, event, messages, messagesByDays, currentChat, mid);
|
|
|
|
if (messageObject.contentType < 0) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
messagesDict.put(event.id, messageObject);
|
|
|
|
}
|
|
|
|
int newRowsCount = messages.size() - oldRowsCount;
|
|
|
|
loading = false;
|
|
|
|
if (!added) {
|
|
|
|
endReached = true;
|
|
|
|
}
|
|
|
|
progressView.setVisibility(View.INVISIBLE);
|
|
|
|
chatListView.setEmptyView(emptyViewContainer);
|
|
|
|
if (newRowsCount != 0) {
|
|
|
|
boolean end = false;
|
|
|
|
if (endReached) {
|
|
|
|
end = true;
|
|
|
|
chatAdapter.notifyItemRangeChanged(0, 2);
|
|
|
|
}
|
|
|
|
int firstVisPos = chatLayoutManager.findLastVisibleItemPosition();
|
|
|
|
View firstVisView = chatLayoutManager.findViewByPosition(firstVisPos);
|
|
|
|
int top = ((firstVisView == null) ? 0 : firstVisView.getTop()) - chatListView.getPaddingTop();
|
|
|
|
if (newRowsCount - (end ? 1 : 0) > 0) {
|
|
|
|
int insertStart = 1 + (end ? 0 : 1);
|
|
|
|
chatAdapter.notifyItemChanged(insertStart);
|
|
|
|
chatAdapter.notifyItemRangeInserted(insertStart, newRowsCount - (end ? 1 : 0));
|
|
|
|
}
|
|
|
|
if (firstVisPos != -1) {
|
|
|
|
chatLayoutManager.scrollToPositionWithOffset(firstVisPos + newRowsCount - (end ? 1 : 0), top);
|
|
|
|
}
|
|
|
|
} else if (endReached) {
|
|
|
|
chatAdapter.notifyItemRemoved(0);
|
|
|
|
}
|
|
|
|
});
|
2017-07-08 18:32:04 +02:00
|
|
|
}
|
|
|
|
});
|
|
|
|
if (reset && chatAdapter != null) {
|
|
|
|
chatAdapter.notifyDataSetChanged();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2018-07-30 04:07:02 +02:00
|
|
|
public void didReceivedNotification(int id, int account, Object... args) {
|
2019-01-23 18:03:33 +01:00
|
|
|
if (id == NotificationCenter.emojiDidLoad) {
|
2017-07-08 18:32:04 +02:00
|
|
|
if (chatListView != null) {
|
|
|
|
chatListView.invalidateViews();
|
|
|
|
}
|
2019-01-23 18:03:33 +01:00
|
|
|
} else if (id == NotificationCenter.messagePlayingDidStart) {
|
2017-07-08 18:32:04 +02:00
|
|
|
MessageObject messageObject = (MessageObject) args[0];
|
|
|
|
|
|
|
|
if (messageObject.isRoundVideo()) {
|
|
|
|
MediaController.getInstance().setTextureView(createTextureView(true), aspectRatioFrameLayout, roundVideoContainer, true);
|
|
|
|
updateTextureViewPosition();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (chatListView != null) {
|
|
|
|
int count = chatListView.getChildCount();
|
|
|
|
for (int a = 0; a < count; a++) {
|
|
|
|
View view = chatListView.getChildAt(a);
|
|
|
|
if (view instanceof ChatMessageCell) {
|
|
|
|
ChatMessageCell cell = (ChatMessageCell) view;
|
|
|
|
MessageObject messageObject1 = cell.getMessageObject();
|
|
|
|
if (messageObject1 != null) {
|
|
|
|
if (messageObject1.isVoice() || messageObject1.isMusic()) {
|
2019-01-23 18:03:33 +01:00
|
|
|
cell.updateButtonState(false, true, false);
|
2017-07-08 18:32:04 +02:00
|
|
|
} else if (messageObject1.isRoundVideo()) {
|
2019-03-03 21:40:48 +01:00
|
|
|
cell.checkVideoPlayback(false);
|
2018-07-30 04:07:02 +02:00
|
|
|
if (!MediaController.getInstance().isPlayingMessage(messageObject1)) {
|
|
|
|
if (messageObject1.audioProgress != 0) {
|
|
|
|
messageObject1.resetPlayingProgress();
|
|
|
|
cell.invalidate();
|
|
|
|
}
|
|
|
|
}
|
2017-07-08 18:32:04 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (id == NotificationCenter.messagePlayingDidReset || id == NotificationCenter.messagePlayingPlayStateChanged) {
|
|
|
|
if (chatListView != null) {
|
|
|
|
int count = chatListView.getChildCount();
|
|
|
|
for (int a = 0; a < count; a++) {
|
|
|
|
View view = chatListView.getChildAt(a);
|
|
|
|
if (view instanceof ChatMessageCell) {
|
|
|
|
ChatMessageCell cell = (ChatMessageCell) view;
|
|
|
|
MessageObject messageObject = cell.getMessageObject();
|
|
|
|
if (messageObject != null) {
|
|
|
|
if (messageObject.isVoice() || messageObject.isMusic()) {
|
2019-01-23 18:03:33 +01:00
|
|
|
cell.updateButtonState(false, true, false);
|
2017-07-08 18:32:04 +02:00
|
|
|
} else if (messageObject.isRoundVideo()) {
|
|
|
|
if (!MediaController.getInstance().isPlayingMessage(messageObject)) {
|
2019-03-03 21:40:48 +01:00
|
|
|
cell.checkVideoPlayback(true);
|
2017-07-08 18:32:04 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (id == NotificationCenter.messagePlayingProgressDidChanged) {
|
|
|
|
Integer mid = (Integer) args[0];
|
|
|
|
if (chatListView != null) {
|
|
|
|
int count = chatListView.getChildCount();
|
|
|
|
for (int a = 0; a < count; a++) {
|
|
|
|
View view = chatListView.getChildAt(a);
|
|
|
|
if (view instanceof ChatMessageCell) {
|
|
|
|
ChatMessageCell cell = (ChatMessageCell) view;
|
|
|
|
MessageObject playing = cell.getMessageObject();
|
|
|
|
if (playing != null && playing.getId() == mid) {
|
|
|
|
MessageObject player = MediaController.getInstance().getPlayingMessageObject();
|
|
|
|
if (player != null) {
|
|
|
|
playing.audioProgress = player.audioProgress;
|
|
|
|
playing.audioProgressSec = player.audioProgressSec;
|
2018-07-30 04:07:02 +02:00
|
|
|
playing.audioPlayerDuration = player.audioPlayerDuration;
|
2017-07-08 18:32:04 +02:00
|
|
|
cell.updatePlayingMessageProgress();
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (id == NotificationCenter.didSetNewWallpapper) {
|
|
|
|
if (fragmentView != null) {
|
2019-01-23 18:03:33 +01:00
|
|
|
contentView.setBackgroundImage(Theme.getCachedWallpaper(), Theme.isWallpaperMotion());
|
2017-07-08 18:32:04 +02:00
|
|
|
progressView2.getBackground().setColorFilter(Theme.colorFilter);
|
|
|
|
if (emptyView != null) {
|
|
|
|
emptyView.getBackground().setColorFilter(Theme.colorFilter);
|
|
|
|
}
|
|
|
|
chatListView.invalidateViews();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private void updateBottomOverlay() {
|
|
|
|
/*if (searchItem != null && searchItem.getVisibility() == View.VISIBLE) {
|
|
|
|
searchContainer.setVisibility(View.VISIBLE);
|
|
|
|
bottomOverlayChat.setVisibility(View.INVISIBLE);
|
|
|
|
} else {
|
|
|
|
searchContainer.setVisibility(View.INVISIBLE);
|
|
|
|
bottomOverlayChat.setVisibility(View.VISIBLE);
|
|
|
|
}*/
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public View createView(Context context) {
|
|
|
|
if (chatMessageCellsCache.isEmpty()) {
|
|
|
|
for (int a = 0; a < 8; a++) {
|
|
|
|
chatMessageCellsCache.add(new ChatMessageCell(context));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
searchWas = false;
|
|
|
|
hasOwnBackground = true;
|
|
|
|
|
|
|
|
Theme.createChatResources(context, false);
|
|
|
|
|
|
|
|
actionBar.setAddToContainer(false);
|
2017-12-08 18:35:59 +01:00
|
|
|
actionBar.setOccupyStatusBar(Build.VERSION.SDK_INT >= 21 && !AndroidUtilities.isTablet());
|
2017-07-08 18:32:04 +02:00
|
|
|
actionBar.setBackButtonDrawable(new BackDrawable(false));
|
|
|
|
actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {
|
|
|
|
@Override
|
|
|
|
public void onItemClick(final int id) {
|
|
|
|
if (id == -1) {
|
|
|
|
finishFragment();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
avatarContainer = new ChatAvatarContainer(context, null, false);
|
2018-07-30 04:07:02 +02:00
|
|
|
avatarContainer.setOccupyStatusBar(!AndroidUtilities.isTablet());
|
2017-07-08 18:32:04 +02:00
|
|
|
actionBar.addView(avatarContainer, 0, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.MATCH_PARENT, Gravity.TOP | Gravity.LEFT, 56, 0, 40, 0));
|
|
|
|
|
|
|
|
ActionBarMenu menu = actionBar.createMenu();
|
|
|
|
searchItem = menu.addItem(0, R.drawable.ic_ab_search).setIsSearchField(true).setActionBarMenuItemSearchListener(new ActionBarMenuItem.ActionBarMenuItemSearchListener() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onSearchCollapse() {
|
|
|
|
searchQuery = "";
|
|
|
|
avatarContainer.setVisibility(View.VISIBLE);
|
|
|
|
if (searchWas) {
|
|
|
|
searchWas = false;
|
|
|
|
loadMessages(true);
|
|
|
|
}
|
|
|
|
/*highlightMessageId = Integer.MAX_VALUE;
|
|
|
|
updateVisibleRows();
|
|
|
|
scrollToLastMessage(false);
|
|
|
|
*/
|
|
|
|
updateBottomOverlay();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onSearchExpand() {
|
|
|
|
avatarContainer.setVisibility(View.GONE);
|
|
|
|
updateBottomOverlay();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onSearchPressed(EditText editText) {
|
|
|
|
searchWas = true;
|
|
|
|
searchQuery = editText.getText().toString();
|
|
|
|
loadMessages(true);
|
|
|
|
//updateSearchButtons(0, 0, 0);
|
|
|
|
}
|
|
|
|
});
|
2019-01-23 18:03:33 +01:00
|
|
|
searchItem.setSearchFieldHint(LocaleController.getString("Search", R.string.Search));
|
2017-07-08 18:32:04 +02:00
|
|
|
|
|
|
|
avatarContainer.setEnabled(false);
|
|
|
|
|
|
|
|
avatarContainer.setTitle(currentChat.title);
|
|
|
|
avatarContainer.setSubtitle(LocaleController.getString("EventLogAllEvents", R.string.EventLogAllEvents));
|
|
|
|
avatarContainer.setChatAvatar(currentChat);
|
|
|
|
|
2020-09-30 15:48:47 +02:00
|
|
|
fragmentView = new SizeNotifierFrameLayout(context) {
|
2017-07-08 18:32:04 +02:00
|
|
|
|
|
|
|
@Override
|
|
|
|
protected void onAttachedToWindow() {
|
|
|
|
super.onAttachedToWindow();
|
|
|
|
MessageObject messageObject = MediaController.getInstance().getPlayingMessageObject();
|
2018-07-30 04:07:02 +02:00
|
|
|
if (messageObject != null && messageObject.isRoundVideo() && messageObject.eventId != 0 && messageObject.getDialogId() == -currentChat.id) {
|
2017-07-08 18:32:04 +02:00
|
|
|
MediaController.getInstance().setTextureView(createTextureView(false), aspectRatioFrameLayout, roundVideoContainer, true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected boolean drawChild(Canvas canvas, View child, long drawingTime) {
|
|
|
|
boolean result = super.drawChild(canvas, child, drawingTime);
|
|
|
|
if (child == actionBar && parentLayout != null) {
|
|
|
|
parentLayout.drawHeaderShadow(canvas, actionBar.getVisibility() == VISIBLE ? actionBar.getMeasuredHeight() : 0);
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected boolean isActionBarVisible() {
|
|
|
|
return actionBar.getVisibility() == VISIBLE;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
|
|
|
int allHeight;
|
|
|
|
int widthSize = MeasureSpec.getSize(widthMeasureSpec);
|
|
|
|
int heightSize = MeasureSpec.getSize(heightMeasureSpec);
|
|
|
|
|
|
|
|
setMeasuredDimension(widthSize, heightSize);
|
|
|
|
heightSize -= getPaddingTop();
|
|
|
|
|
|
|
|
measureChildWithMargins(actionBar, widthMeasureSpec, 0, heightMeasureSpec, 0);
|
|
|
|
int actionBarHeight = actionBar.getMeasuredHeight();
|
|
|
|
if (actionBar.getVisibility() == VISIBLE) {
|
|
|
|
heightSize -= actionBarHeight;
|
|
|
|
}
|
|
|
|
|
|
|
|
int childCount = getChildCount();
|
|
|
|
|
|
|
|
for (int i = 0; i < childCount; i++) {
|
|
|
|
View child = getChildAt(i);
|
|
|
|
if (child == null || child.getVisibility() == GONE || child == actionBar) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if (child == chatListView || child == progressView) {
|
|
|
|
int contentWidthSpec = MeasureSpec.makeMeasureSpec(widthSize, MeasureSpec.EXACTLY);
|
|
|
|
int contentHeightSpec = MeasureSpec.makeMeasureSpec(Math.max(AndroidUtilities.dp(10), heightSize - AndroidUtilities.dp(48 + 2)), MeasureSpec.EXACTLY);
|
|
|
|
child.measure(contentWidthSpec, contentHeightSpec);
|
|
|
|
} else if (child == emptyViewContainer) {
|
|
|
|
int contentWidthSpec = MeasureSpec.makeMeasureSpec(widthSize, MeasureSpec.EXACTLY);
|
|
|
|
int contentHeightSpec = MeasureSpec.makeMeasureSpec(heightSize, MeasureSpec.EXACTLY);
|
|
|
|
child.measure(contentWidthSpec, contentHeightSpec);
|
|
|
|
} else {
|
|
|
|
measureChildWithMargins(child, widthMeasureSpec, 0, heightMeasureSpec, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected void onLayout(boolean changed, int l, int t, int r, int b) {
|
|
|
|
final int count = getChildCount();
|
|
|
|
|
|
|
|
for (int i = 0; i < count; i++) {
|
|
|
|
final View child = getChildAt(i);
|
|
|
|
if (child.getVisibility() == GONE) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
final LayoutParams lp = (LayoutParams) child.getLayoutParams();
|
|
|
|
|
|
|
|
final int width = child.getMeasuredWidth();
|
|
|
|
final int height = child.getMeasuredHeight();
|
|
|
|
|
|
|
|
int childLeft;
|
|
|
|
int childTop;
|
|
|
|
|
|
|
|
int gravity = lp.gravity;
|
|
|
|
if (gravity == -1) {
|
|
|
|
gravity = Gravity.TOP | Gravity.LEFT;
|
|
|
|
}
|
|
|
|
|
|
|
|
final int absoluteGravity = gravity & Gravity.HORIZONTAL_GRAVITY_MASK;
|
|
|
|
final int verticalGravity = gravity & Gravity.VERTICAL_GRAVITY_MASK;
|
|
|
|
|
|
|
|
switch (absoluteGravity & Gravity.HORIZONTAL_GRAVITY_MASK) {
|
|
|
|
case Gravity.CENTER_HORIZONTAL:
|
|
|
|
childLeft = (r - l - width) / 2 + lp.leftMargin - lp.rightMargin;
|
|
|
|
break;
|
|
|
|
case Gravity.RIGHT:
|
|
|
|
childLeft = r - width - lp.rightMargin;
|
|
|
|
break;
|
|
|
|
case Gravity.LEFT:
|
|
|
|
default:
|
|
|
|
childLeft = lp.leftMargin;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (verticalGravity) {
|
|
|
|
case Gravity.TOP:
|
|
|
|
childTop = lp.topMargin + getPaddingTop();
|
|
|
|
if (child != actionBar && actionBar.getVisibility() == VISIBLE) {
|
|
|
|
childTop += actionBar.getMeasuredHeight();
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case Gravity.CENTER_VERTICAL:
|
|
|
|
childTop = (b - t - height) / 2 + lp.topMargin - lp.bottomMargin;
|
|
|
|
break;
|
|
|
|
case Gravity.BOTTOM:
|
|
|
|
childTop = (b - t) - height - lp.bottomMargin;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
childTop = lp.topMargin;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (child == emptyViewContainer) {
|
|
|
|
childTop -= AndroidUtilities.dp(24) - (actionBar.getVisibility() == VISIBLE ? actionBar.getMeasuredHeight() / 2 : 0);
|
|
|
|
} else if (child == actionBar) {
|
|
|
|
childTop -= getPaddingTop();
|
|
|
|
}
|
|
|
|
child.layout(childLeft, childTop, childLeft + width, childTop + height);
|
|
|
|
}
|
|
|
|
|
|
|
|
updateMessagesVisisblePart();
|
|
|
|
notifyHeightChanged();
|
|
|
|
}
|
2020-09-30 15:48:47 +02:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean dispatchTouchEvent(MotionEvent ev) {
|
|
|
|
if (AvatarPreviewer.hasVisibleInstance()) {
|
|
|
|
AvatarPreviewer.getInstance().onTouchEvent(ev);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return super.dispatchTouchEvent(ev);
|
|
|
|
}
|
2017-07-08 18:32:04 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
contentView = (SizeNotifierFrameLayout) fragmentView;
|
|
|
|
|
2018-07-30 04:07:02 +02:00
|
|
|
contentView.setOccupyStatusBar(!AndroidUtilities.isTablet());
|
2019-01-23 18:03:33 +01:00
|
|
|
contentView.setBackgroundImage(Theme.getCachedWallpaper(), Theme.isWallpaperMotion());
|
2017-07-08 18:32:04 +02:00
|
|
|
|
|
|
|
emptyViewContainer = new FrameLayout(context);
|
|
|
|
emptyViewContainer.setVisibility(View.INVISIBLE);
|
|
|
|
contentView.addView(emptyViewContainer, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER));
|
2019-01-23 18:03:33 +01:00
|
|
|
emptyViewContainer.setOnTouchListener((v, event) -> true);
|
2017-07-08 18:32:04 +02:00
|
|
|
|
|
|
|
|
|
|
|
emptyView = new TextView(context);
|
|
|
|
emptyView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
|
|
|
|
emptyView.setGravity(Gravity.CENTER);
|
|
|
|
emptyView.setTextColor(Theme.getColor(Theme.key_chat_serviceText));
|
|
|
|
emptyView.setBackgroundDrawable(Theme.createRoundRectDrawable(AndroidUtilities.dp(10), Theme.getServiceMessageColor()));
|
|
|
|
emptyView.setPadding(AndroidUtilities.dp(16), AndroidUtilities.dp(16), AndroidUtilities.dp(16), AndroidUtilities.dp(16));
|
|
|
|
emptyViewContainer.addView(emptyView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER, 16, 0, 16, 0));
|
|
|
|
|
|
|
|
chatListView = new RecyclerListView(context) {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean drawChild(Canvas canvas, View child, long drawingTime) {
|
|
|
|
boolean result = super.drawChild(canvas, child, drawingTime);
|
|
|
|
if (child instanceof ChatMessageCell) {
|
|
|
|
ChatMessageCell chatMessageCell = (ChatMessageCell) child;
|
|
|
|
ImageReceiver imageReceiver = chatMessageCell.getAvatarImage();
|
|
|
|
if (imageReceiver != null) {
|
|
|
|
int top = child.getTop();
|
|
|
|
if (chatMessageCell.isPinnedBottom()) {
|
|
|
|
ViewHolder holder = chatListView.getChildViewHolder(child);
|
|
|
|
if (holder != null) {
|
|
|
|
holder = chatListView.findViewHolderForAdapterPosition(holder.getAdapterPosition() + 1);
|
|
|
|
if (holder != null) {
|
|
|
|
imageReceiver.setImageY(-AndroidUtilities.dp(1000));
|
|
|
|
imageReceiver.draw(canvas);
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (chatMessageCell.isPinnedTop()) {
|
|
|
|
ViewHolder holder = chatListView.getChildViewHolder(child);
|
|
|
|
if (holder != null) {
|
|
|
|
while (true) {
|
|
|
|
holder = chatListView.findViewHolderForAdapterPosition(holder.getAdapterPosition() - 1);
|
|
|
|
if (holder != null) {
|
|
|
|
top = holder.itemView.getTop();
|
|
|
|
if (!(holder.itemView instanceof ChatMessageCell) || !((ChatMessageCell) holder.itemView).isPinnedTop()) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
int y = child.getTop() + chatMessageCell.getLayoutHeight();
|
|
|
|
int maxY = chatListView.getHeight() - chatListView.getPaddingBottom();
|
|
|
|
if (y > maxY) {
|
|
|
|
y = maxY;
|
|
|
|
}
|
|
|
|
if (y - AndroidUtilities.dp(48) < top) {
|
|
|
|
y = top + AndroidUtilities.dp(48);
|
|
|
|
}
|
|
|
|
imageReceiver.setImageY(y - AndroidUtilities.dp(44));
|
|
|
|
imageReceiver.draw(canvas);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
};
|
2019-01-23 18:03:33 +01:00
|
|
|
chatListView.setOnItemClickListener((view, position) -> createMenu(view));
|
2017-07-08 18:32:04 +02:00
|
|
|
chatListView.setTag(1);
|
|
|
|
chatListView.setVerticalScrollBarEnabled(true);
|
|
|
|
chatListView.setAdapter(chatAdapter = new ChatActivityAdapter(context));
|
|
|
|
chatListView.setClipToPadding(false);
|
|
|
|
chatListView.setPadding(0, AndroidUtilities.dp(4), 0, AndroidUtilities.dp(3));
|
|
|
|
chatListView.setItemAnimator(null);
|
|
|
|
chatListView.setLayoutAnimation(null);
|
|
|
|
chatLayoutManager = new LinearLayoutManager(context) {
|
|
|
|
@Override
|
|
|
|
public boolean supportsPredictiveItemAnimations() {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void smoothScrollToPosition(RecyclerView recyclerView, RecyclerView.State state, int position) {
|
2020-02-13 19:26:53 +01:00
|
|
|
LinearSmoothScrollerCustom linearSmoothScroller = new LinearSmoothScrollerCustom(recyclerView.getContext(), LinearSmoothScrollerCustom.POSITION_MIDDLE);
|
2017-07-08 18:32:04 +02:00
|
|
|
linearSmoothScroller.setTargetPosition(position);
|
|
|
|
startSmoothScroll(linearSmoothScroller);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
chatLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
|
|
|
|
chatLayoutManager.setStackFromEnd(true);
|
|
|
|
chatListView.setLayoutManager(chatLayoutManager);
|
|
|
|
contentView.addView(chatListView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
|
|
|
|
chatListView.setOnScrollListener(new RecyclerView.OnScrollListener() {
|
|
|
|
|
|
|
|
private float totalDy = 0;
|
|
|
|
private final int scrollValue = AndroidUtilities.dp(100);
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
|
|
|
|
if (newState == RecyclerView.SCROLL_STATE_DRAGGING) {
|
|
|
|
scrollingFloatingDate = true;
|
|
|
|
checkTextureViewPosition = true;
|
|
|
|
} else if (newState == RecyclerView.SCROLL_STATE_IDLE) {
|
|
|
|
scrollingFloatingDate = false;
|
|
|
|
checkTextureViewPosition = false;
|
|
|
|
hideFloatingDateView(true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
|
|
|
|
chatListView.invalidate();
|
|
|
|
if (dy != 0 && scrollingFloatingDate && !currentFloatingTopIsNotMessage) {
|
|
|
|
if (floatingDateView.getTag() == null) {
|
|
|
|
if (floatingDateAnimation != null) {
|
|
|
|
floatingDateAnimation.cancel();
|
|
|
|
}
|
|
|
|
floatingDateView.setTag(1);
|
|
|
|
floatingDateAnimation = new AnimatorSet();
|
|
|
|
floatingDateAnimation.setDuration(150);
|
|
|
|
floatingDateAnimation.playTogether(ObjectAnimator.ofFloat(floatingDateView, "alpha", 1.0f));
|
|
|
|
floatingDateAnimation.addListener(new AnimatorListenerAdapter() {
|
|
|
|
@Override
|
|
|
|
public void onAnimationEnd(Animator animation) {
|
|
|
|
if (animation.equals(floatingDateAnimation)) {
|
|
|
|
floatingDateAnimation = null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
floatingDateAnimation.start();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
checkScrollForLoad(true);
|
|
|
|
updateMessagesVisisblePart();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
if (scrollToPositionOnRecreate != -1) {
|
|
|
|
chatLayoutManager.scrollToPositionWithOffset(scrollToPositionOnRecreate, scrollToOffsetOnRecreate);
|
|
|
|
scrollToPositionOnRecreate = -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
progressView = new FrameLayout(context);
|
|
|
|
progressView.setVisibility(View.INVISIBLE);
|
|
|
|
contentView.addView(progressView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.TOP | Gravity.LEFT));
|
|
|
|
|
|
|
|
progressView2 = new View(context);
|
|
|
|
progressView2.setBackgroundResource(R.drawable.system_loader);
|
|
|
|
progressView2.getBackground().setColorFilter(Theme.colorFilter);
|
|
|
|
progressView.addView(progressView2, LayoutHelper.createFrame(36, 36, Gravity.CENTER));
|
|
|
|
|
|
|
|
progressBar = new RadialProgressView(context);
|
|
|
|
progressBar.setSize(AndroidUtilities.dp(28));
|
|
|
|
progressBar.setProgressColor(Theme.getColor(Theme.key_chat_serviceText));
|
|
|
|
progressView.addView(progressBar, LayoutHelper.createFrame(32, 32, Gravity.CENTER));
|
|
|
|
|
|
|
|
floatingDateView = new ChatActionCell(context);
|
|
|
|
floatingDateView.setAlpha(0.0f);
|
2020-07-26 10:03:38 +02:00
|
|
|
floatingDateView.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO);
|
2017-07-08 18:32:04 +02:00
|
|
|
contentView.addView(floatingDateView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.TOP | Gravity.CENTER_HORIZONTAL, 0, 4, 0, 0));
|
|
|
|
|
|
|
|
contentView.addView(actionBar);
|
|
|
|
|
|
|
|
bottomOverlayChat = new FrameLayout(context) {
|
|
|
|
@Override
|
|
|
|
public 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);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
bottomOverlayChat.setWillNotDraw(false);
|
|
|
|
bottomOverlayChat.setPadding(0, AndroidUtilities.dp(3), 0, 0);
|
|
|
|
contentView.addView(bottomOverlayChat, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 51, Gravity.BOTTOM));
|
2019-01-23 18:03:33 +01:00
|
|
|
bottomOverlayChat.setOnClickListener(view -> {
|
|
|
|
if (getParentActivity() == null) {
|
|
|
|
return;
|
2017-07-08 18:32:04 +02:00
|
|
|
}
|
2019-01-23 18:03:33 +01:00
|
|
|
AdminLogFilterAlert adminLogFilterAlert = new AdminLogFilterAlert(getParentActivity(), currentFilter, selectedAdmins, currentChat.megagroup);
|
|
|
|
adminLogFilterAlert.setCurrentAdmins(admins);
|
|
|
|
adminLogFilterAlert.setAdminLogFilterAlertDelegate((filter, admins) -> {
|
|
|
|
currentFilter = filter;
|
|
|
|
selectedAdmins = admins;
|
|
|
|
if (currentFilter != null || selectedAdmins != null) {
|
|
|
|
avatarContainer.setSubtitle(LocaleController.getString("EventLogSelectedEvents", R.string.EventLogSelectedEvents));
|
|
|
|
} else {
|
|
|
|
avatarContainer.setSubtitle(LocaleController.getString("EventLogAllEvents", R.string.EventLogAllEvents));
|
|
|
|
}
|
|
|
|
loadMessages(true);
|
|
|
|
});
|
|
|
|
showDialog(adminLogFilterAlert);
|
2017-07-08 18:32:04 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
bottomOverlayChatText = new TextView(context);
|
|
|
|
bottomOverlayChatText.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 15);
|
|
|
|
bottomOverlayChatText.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
|
|
|
|
bottomOverlayChatText.setTextColor(Theme.getColor(Theme.key_chat_fieldOverlayText));
|
|
|
|
bottomOverlayChatText.setText(LocaleController.getString("SETTINGS", R.string.SETTINGS).toUpperCase());
|
|
|
|
bottomOverlayChat.addView(bottomOverlayChatText, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER));
|
|
|
|
|
|
|
|
bottomOverlayImage = new ImageView(context);
|
|
|
|
bottomOverlayImage.setImageResource(R.drawable.log_info);
|
2020-06-25 17:29:04 +02:00
|
|
|
bottomOverlayImage.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_chat_fieldOverlayText), PorterDuff.Mode.SRC_IN));
|
2017-07-08 18:32:04 +02:00
|
|
|
bottomOverlayImage.setScaleType(ImageView.ScaleType.CENTER);
|
|
|
|
bottomOverlayChat.addView(bottomOverlayImage, LayoutHelper.createFrame(48, 48, Gravity.RIGHT | Gravity.TOP, 3, 0, 0, 0));
|
2019-05-14 14:08:05 +02:00
|
|
|
bottomOverlayImage.setContentDescription(LocaleController.getString("BotHelp", R.string.BotHelp));
|
2019-01-23 18:03:33 +01:00
|
|
|
bottomOverlayImage.setOnClickListener(v -> {
|
|
|
|
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
|
|
|
|
if (currentChat.megagroup) {
|
|
|
|
builder.setMessage(AndroidUtilities.replaceTags(LocaleController.getString("EventLogInfoDetail", R.string.EventLogInfoDetail)));
|
|
|
|
} else {
|
|
|
|
builder.setMessage(AndroidUtilities.replaceTags(LocaleController.getString("EventLogInfoDetailChannel", R.string.EventLogInfoDetailChannel)));
|
2017-07-08 18:32:04 +02:00
|
|
|
}
|
2019-01-23 18:03:33 +01:00
|
|
|
builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), null);
|
|
|
|
builder.setTitle(LocaleController.getString("EventLogInfoTitle", R.string.EventLogInfoTitle));
|
|
|
|
showDialog(builder.create());
|
2017-07-08 18:32:04 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
searchContainer = new FrameLayout(context) {
|
|
|
|
@Override
|
|
|
|
public 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);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
searchContainer.setWillNotDraw(false);
|
|
|
|
searchContainer.setVisibility(View.INVISIBLE);
|
|
|
|
searchContainer.setFocusable(true);
|
|
|
|
searchContainer.setFocusableInTouchMode(true);
|
|
|
|
searchContainer.setClickable(true);
|
|
|
|
searchContainer.setPadding(0, AndroidUtilities.dp(3), 0, 0);
|
|
|
|
contentView.addView(searchContainer, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 51, Gravity.BOTTOM));
|
|
|
|
|
|
|
|
/*searchUpButton = new ImageView(context);
|
|
|
|
searchUpButton.setScaleType(ImageView.ScaleType.CENTER);
|
2019-05-14 14:08:05 +02:00
|
|
|
searchUpButton.setImageResource(R.drawable.msg_go_up);
|
2020-06-25 17:29:04 +02:00
|
|
|
searchUpButton.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_chat_searchPanelIcons), PorterDuff.Mode.SRC_IN));
|
2017-07-08 18:32:04 +02:00
|
|
|
searchContainer.addView(searchUpButton, LayoutHelper.createFrame(48, 48));
|
|
|
|
searchUpButton.setOnClickListener(new View.OnClickListener() {
|
|
|
|
@Override
|
|
|
|
public void onClick(View view) {
|
|
|
|
MessagesSearchQuery.searchMessagesInChat(null, dialog_id, mergeDialogId, classGuid, 1);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
searchDownButton = new ImageView(context);
|
|
|
|
searchDownButton.setScaleType(ImageView.ScaleType.CENTER);
|
2019-05-14 14:08:05 +02:00
|
|
|
searchDownButton.setImageResource(R.drawable.msg_go_down);
|
2020-06-25 17:29:04 +02:00
|
|
|
searchDownButton.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_chat_searchPanelIcons), PorterDuff.Mode.SRC_IN));
|
2017-07-08 18:32:04 +02:00
|
|
|
searchContainer.addView(searchDownButton, LayoutHelper.createFrame(48, 48, Gravity.LEFT | Gravity.TOP, 48, 0, 0, 0));
|
|
|
|
searchDownButton.setOnClickListener(new View.OnClickListener() {
|
|
|
|
@Override
|
|
|
|
public void onClick(View view) {
|
|
|
|
MessagesSearchQuery.searchMessagesInChat(null, dialog_id, mergeDialogId, classGuid, 2);
|
|
|
|
}
|
|
|
|
});*/
|
|
|
|
|
|
|
|
searchCalendarButton = new ImageView(context);
|
|
|
|
searchCalendarButton.setScaleType(ImageView.ScaleType.CENTER);
|
2020-06-25 17:29:04 +02:00
|
|
|
searchCalendarButton.setImageResource(R.drawable.baseline_date_range_24);
|
|
|
|
searchCalendarButton.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_chat_searchPanelIcons), PorterDuff.Mode.SRC_IN));
|
2017-07-08 18:32:04 +02:00
|
|
|
searchContainer.addView(searchCalendarButton, LayoutHelper.createFrame(48, 48, Gravity.RIGHT | Gravity.TOP));
|
2019-01-23 18:03:33 +01:00
|
|
|
searchCalendarButton.setOnClickListener(view -> {
|
|
|
|
if (getParentActivity() == null) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
AndroidUtilities.hideKeyboard(searchItem.getSearchField());
|
2020-09-30 15:48:47 +02:00
|
|
|
showDialog(AlertsCreator.createCalendarPickerDialog(getParentActivity(), 1375315200000L, param -> loadMessages(true)).create());
|
2017-07-08 18:32:04 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
searchCountText = new SimpleTextView(context);
|
|
|
|
searchCountText.setTextColor(Theme.getColor(Theme.key_chat_searchPanelText));
|
|
|
|
searchCountText.setTextSize(15);
|
|
|
|
searchCountText.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
|
|
|
|
searchContainer.addView(searchCountText, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.CENTER_VERTICAL, 108, 0, 0, 0));
|
|
|
|
|
|
|
|
chatAdapter.updateRows();
|
|
|
|
if (loading && messages.isEmpty()) {
|
|
|
|
progressView.setVisibility(View.VISIBLE);
|
|
|
|
chatListView.setEmptyView(null);
|
|
|
|
} else {
|
|
|
|
progressView.setVisibility(View.INVISIBLE);
|
|
|
|
chatListView.setEmptyView(emptyViewContainer);
|
|
|
|
}
|
|
|
|
|
2021-02-23 12:53:38 +01:00
|
|
|
undoView = new UndoView(context);
|
|
|
|
undoView.setAdditionalTranslationY(AndroidUtilities.dp(51));
|
|
|
|
contentView.addView(undoView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.BOTTOM | Gravity.LEFT, 8, 0, 8, 8));
|
|
|
|
|
2017-07-08 18:32:04 +02:00
|
|
|
updateEmptyPlaceholder();
|
|
|
|
|
|
|
|
return fragmentView;
|
|
|
|
}
|
|
|
|
|
|
|
|
private void createMenu(View v) {
|
|
|
|
MessageObject message = null;
|
|
|
|
if (v instanceof ChatMessageCell) {
|
|
|
|
message = ((ChatMessageCell) v).getMessageObject();
|
|
|
|
} else if (v instanceof ChatActionCell) {
|
|
|
|
message = ((ChatActionCell) v).getMessageObject();
|
|
|
|
}
|
|
|
|
if (message == null) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
final int type = getMessageType(message);
|
|
|
|
selectedObject = message;
|
|
|
|
if (getParentActivity() == null) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
|
|
|
|
|
|
|
|
ArrayList<CharSequence> items = new ArrayList<>();
|
|
|
|
final ArrayList<Integer> options = new ArrayList<>();
|
|
|
|
|
|
|
|
if (selectedObject.type == 0 || selectedObject.caption != null) {
|
|
|
|
items.add(LocaleController.getString("Copy", R.string.Copy));
|
|
|
|
options.add(3);
|
|
|
|
}
|
2017-12-08 18:35:59 +01:00
|
|
|
if (type == 1) {
|
|
|
|
if (selectedObject.currentEvent != null && selectedObject.currentEvent.action instanceof TLRPC.TL_channelAdminLogEventActionChangeStickerSet) {
|
2020-12-23 08:48:30 +01:00
|
|
|
TLRPC.TL_channelAdminLogEventActionChangeStickerSet action = (TLRPC.TL_channelAdminLogEventActionChangeStickerSet) selectedObject.currentEvent.action;
|
|
|
|
TLRPC.InputStickerSet stickerSet = action.new_stickerset;
|
2017-12-08 18:35:59 +01:00
|
|
|
if (stickerSet == null || stickerSet instanceof TLRPC.TL_inputStickerSetEmpty) {
|
2020-12-23 08:48:30 +01:00
|
|
|
stickerSet = action.prev_stickerset;
|
2017-12-08 18:35:59 +01:00
|
|
|
}
|
|
|
|
if (stickerSet != null) {
|
|
|
|
showDialog(new StickersAlert(getParentActivity(), ChannelAdminLogActivity.this, stickerSet, null, null));
|
|
|
|
return;
|
|
|
|
}
|
2021-02-23 12:53:38 +01:00
|
|
|
} else if (selectedObject.currentEvent != null && selectedObject.currentEvent.action instanceof TLRPC.TL_channelAdminLogEventActionChangeHistoryTTL) {
|
|
|
|
if (ChatObject.canUserDoAdminAction(currentChat, ChatObject.ACTION_DELETE_MESSAGES)) {
|
|
|
|
ClearHistoryAlert alert = new ClearHistoryAlert(getParentActivity(), null, currentChat, false);
|
|
|
|
alert.setDelegate(new ClearHistoryAlert.ClearHistoryAlertDelegate() {
|
|
|
|
@Override
|
|
|
|
public void onAutoDeleteHistory(int ttl, int action) {
|
|
|
|
getMessagesController().setDialogHistoryTTL(-currentChat.id, ttl);
|
|
|
|
TLRPC.ChatFull chatInfo = getMessagesController().getChatFull(currentChat.id);
|
|
|
|
if (chatInfo != null) {
|
|
|
|
undoView.showWithAction(-currentChat.id, action, null, chatInfo.ttl_period, null, null);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
showDialog(alert);
|
|
|
|
}
|
2017-12-08 18:35:59 +01:00
|
|
|
}
|
|
|
|
} else if (type == 3) {
|
2017-07-08 18:32:04 +02:00
|
|
|
if (selectedObject.messageOwner.media instanceof TLRPC.TL_messageMediaWebPage && MessageObject.isNewGifDocument(selectedObject.messageOwner.media.webpage.document)) {
|
|
|
|
items.add(LocaleController.getString("SaveToGIFs", R.string.SaveToGIFs));
|
|
|
|
options.add(11);
|
|
|
|
}
|
|
|
|
} else if (type == 4) {
|
|
|
|
if (selectedObject.isVideo()) {
|
|
|
|
items.add(LocaleController.getString("SaveToGallery", R.string.SaveToGallery));
|
|
|
|
options.add(4);
|
|
|
|
items.add(LocaleController.getString("ShareFile", R.string.ShareFile));
|
|
|
|
options.add(6);
|
|
|
|
} else if (selectedObject.isMusic()) {
|
|
|
|
items.add(LocaleController.getString("SaveToMusic", R.string.SaveToMusic));
|
|
|
|
options.add(10);
|
|
|
|
items.add(LocaleController.getString("ShareFile", R.string.ShareFile));
|
|
|
|
options.add(6);
|
|
|
|
} else if (selectedObject.getDocument() != null) {
|
|
|
|
if (MessageObject.isNewGifDocument(selectedObject.getDocument())) {
|
|
|
|
items.add(LocaleController.getString("SaveToGIFs", R.string.SaveToGIFs));
|
|
|
|
options.add(11);
|
|
|
|
}
|
|
|
|
items.add(LocaleController.getString("SaveToDownloads", R.string.SaveToDownloads));
|
|
|
|
options.add(10);
|
|
|
|
items.add(LocaleController.getString("ShareFile", R.string.ShareFile));
|
|
|
|
options.add(6);
|
|
|
|
} else {
|
|
|
|
items.add(LocaleController.getString("SaveToGallery", R.string.SaveToGallery));
|
|
|
|
options.add(4);
|
|
|
|
}
|
|
|
|
} else if (type == 5) {
|
|
|
|
items.add(LocaleController.getString("ApplyLocalizationFile", R.string.ApplyLocalizationFile));
|
|
|
|
options.add(5);
|
|
|
|
items.add(LocaleController.getString("SaveToDownloads", R.string.SaveToDownloads));
|
|
|
|
options.add(10);
|
|
|
|
items.add(LocaleController.getString("ShareFile", R.string.ShareFile));
|
|
|
|
options.add(6);
|
|
|
|
} else if (type == 10) {
|
|
|
|
items.add(LocaleController.getString("ApplyThemeFile", R.string.ApplyThemeFile));
|
|
|
|
options.add(5);
|
|
|
|
items.add(LocaleController.getString("SaveToDownloads", R.string.SaveToDownloads));
|
|
|
|
options.add(10);
|
|
|
|
items.add(LocaleController.getString("ShareFile", R.string.ShareFile));
|
|
|
|
options.add(6);
|
|
|
|
} else if (type == 6) {
|
|
|
|
items.add(LocaleController.getString("SaveToGallery", R.string.SaveToGallery));
|
|
|
|
options.add(7);
|
|
|
|
items.add(LocaleController.getString("SaveToDownloads", R.string.SaveToDownloads));
|
|
|
|
options.add(10);
|
|
|
|
items.add(LocaleController.getString("ShareFile", R.string.ShareFile));
|
|
|
|
options.add(6);
|
|
|
|
} else if (type == 7) {
|
|
|
|
if (selectedObject.isMask()) {
|
|
|
|
items.add(LocaleController.getString("AddToMasks", R.string.AddToMasks));
|
|
|
|
} else {
|
|
|
|
items.add(LocaleController.getString("AddToStickers", R.string.AddToStickers));
|
|
|
|
}
|
|
|
|
options.add(9);
|
|
|
|
} else if (type == 8) {
|
2018-07-30 04:07:02 +02:00
|
|
|
TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(selectedObject.messageOwner.media.user_id);
|
|
|
|
if (user != null && user.id != UserConfig.getInstance(currentAccount).getClientUserId() && ContactsController.getInstance(currentAccount).contactsDict.get(user.id) == null) {
|
2017-07-08 18:32:04 +02:00
|
|
|
items.add(LocaleController.getString("AddContactTitle", R.string.AddContactTitle));
|
|
|
|
options.add(15);
|
|
|
|
}
|
|
|
|
if (selectedObject.messageOwner.media.phone_number != null || selectedObject.messageOwner.media.phone_number.length() != 0) {
|
|
|
|
items.add(LocaleController.getString("Copy", R.string.Copy));
|
|
|
|
options.add(16);
|
|
|
|
items.add(LocaleController.getString("Call", R.string.Call));
|
|
|
|
options.add(17);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (options.isEmpty()) {
|
|
|
|
return;
|
|
|
|
}
|
2019-05-14 14:08:05 +02:00
|
|
|
final CharSequence[] finalItems = items.toArray(new CharSequence[0]);
|
2019-01-23 18:03:33 +01:00
|
|
|
builder.setItems(finalItems, (dialogInterface, i) -> {
|
|
|
|
if (selectedObject == null || i < 0 || i >= options.size()) {
|
|
|
|
return;
|
2017-07-08 18:32:04 +02:00
|
|
|
}
|
2019-01-23 18:03:33 +01:00
|
|
|
processSelectedOption(options.get(i));
|
2017-07-08 18:32:04 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
builder.setTitle(LocaleController.getString("Message", R.string.Message));
|
|
|
|
showDialog(builder.create());
|
|
|
|
}
|
|
|
|
|
|
|
|
private String getMessageContent(MessageObject messageObject, int previousUid, boolean name) {
|
|
|
|
String str = "";
|
|
|
|
if (name) {
|
2020-09-30 15:48:47 +02:00
|
|
|
int fromId = messageObject.getFromChatId();
|
|
|
|
if (previousUid != fromId) {
|
|
|
|
if (fromId > 0) {
|
|
|
|
TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(fromId);
|
2017-07-08 18:32:04 +02:00
|
|
|
if (user != null) {
|
|
|
|
str = ContactsController.formatName(user.first_name, user.last_name) + ":\n";
|
|
|
|
}
|
2020-09-30 15:48:47 +02:00
|
|
|
} else if (fromId < 0) {
|
|
|
|
TLRPC.Chat chat = MessagesController.getInstance(currentAccount).getChat(-fromId);
|
2017-07-08 18:32:04 +02:00
|
|
|
if (chat != null) {
|
|
|
|
str = chat.title + ":\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (messageObject.type == 0 && messageObject.messageOwner.message != null) {
|
|
|
|
str += messageObject.messageOwner.message;
|
2018-07-30 04:07:02 +02:00
|
|
|
} else if (messageObject.messageOwner.media != null && messageObject.messageOwner.message != null) {
|
|
|
|
str += messageObject.messageOwner.message;
|
2017-07-08 18:32:04 +02:00
|
|
|
} else {
|
|
|
|
str += messageObject.messageText;
|
|
|
|
}
|
|
|
|
return str;
|
|
|
|
}
|
|
|
|
|
|
|
|
private TextureView createTextureView(boolean add) {
|
|
|
|
if (parentLayout == null) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
if (roundVideoContainer == null) {
|
|
|
|
if (Build.VERSION.SDK_INT >= 21) {
|
|
|
|
roundVideoContainer = new FrameLayout(getParentActivity()) {
|
|
|
|
@Override
|
|
|
|
public void setTranslationY(float translationY) {
|
|
|
|
super.setTranslationY(translationY);
|
|
|
|
contentView.invalidate();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
roundVideoContainer.setOutlineProvider(new ViewOutlineProvider() {
|
|
|
|
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
|
|
|
@Override
|
|
|
|
public void getOutline(View view, Outline outline) {
|
|
|
|
outline.setOval(0, 0, AndroidUtilities.roundMessageSize, AndroidUtilities.roundMessageSize);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
roundVideoContainer.setClipToOutline(true);
|
|
|
|
} else {
|
|
|
|
roundVideoContainer = new FrameLayout(getParentActivity()) {
|
|
|
|
@Override
|
|
|
|
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
|
|
|
|
super.onSizeChanged(w, h, oldw, oldh);
|
|
|
|
aspectPath.reset();
|
|
|
|
aspectPath.addCircle(w / 2, h / 2, w / 2, Path.Direction.CW);
|
|
|
|
aspectPath.toggleInverseFillType();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void setTranslationY(float translationY) {
|
|
|
|
super.setTranslationY(translationY);
|
|
|
|
contentView.invalidate();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void setVisibility(int visibility) {
|
|
|
|
super.setVisibility(visibility);
|
|
|
|
if (visibility == VISIBLE) {
|
|
|
|
setLayerType(View.LAYER_TYPE_HARDWARE, null);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected void dispatchDraw(Canvas canvas) {
|
|
|
|
super.dispatchDraw(canvas);
|
|
|
|
canvas.drawPath(aspectPath, aspectPaint);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
aspectPath = new Path();
|
|
|
|
aspectPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
|
|
|
aspectPaint.setColor(0xff000000);
|
|
|
|
aspectPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.CLEAR));
|
|
|
|
}
|
|
|
|
roundVideoContainer.setWillNotDraw(false);
|
|
|
|
roundVideoContainer.setVisibility(View.INVISIBLE);
|
|
|
|
|
|
|
|
aspectRatioFrameLayout = new AspectRatioFrameLayout(getParentActivity());
|
|
|
|
aspectRatioFrameLayout.setBackgroundColor(0);
|
|
|
|
if (add) {
|
|
|
|
roundVideoContainer.addView(aspectRatioFrameLayout, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
|
|
|
|
}
|
|
|
|
|
|
|
|
videoTextureView = new TextureView(getParentActivity());
|
|
|
|
videoTextureView.setOpaque(false);
|
|
|
|
aspectRatioFrameLayout.addView(videoTextureView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
|
|
|
|
}
|
|
|
|
if (roundVideoContainer.getParent() == null) {
|
|
|
|
contentView.addView(roundVideoContainer, 1, new FrameLayout.LayoutParams(AndroidUtilities.roundMessageSize, AndroidUtilities.roundMessageSize));
|
|
|
|
}
|
|
|
|
roundVideoContainer.setVisibility(View.INVISIBLE);
|
|
|
|
aspectRatioFrameLayout.setDrawingReady(false);
|
|
|
|
return videoTextureView;
|
|
|
|
}
|
|
|
|
|
|
|
|
private void destroyTextureView() {
|
|
|
|
if (roundVideoContainer == null || roundVideoContainer.getParent() == null) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
contentView.removeView(roundVideoContainer);
|
|
|
|
aspectRatioFrameLayout.setDrawingReady(false);
|
|
|
|
roundVideoContainer.setVisibility(View.INVISIBLE);
|
|
|
|
if (Build.VERSION.SDK_INT < 21) {
|
|
|
|
roundVideoContainer.setLayerType(View.LAYER_TYPE_NONE, null);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private void processSelectedOption(int option) {
|
|
|
|
if (selectedObject == null) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
switch (option) {
|
|
|
|
case 3: {
|
|
|
|
AndroidUtilities.addToClipboard(getMessageContent(selectedObject, 0, true));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 4: {
|
|
|
|
String path = selectedObject.messageOwner.attachPath;
|
|
|
|
if (path != null && path.length() > 0) {
|
|
|
|
File temp = new File(path);
|
|
|
|
if (!temp.exists()) {
|
|
|
|
path = null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (path == null || path.length() == 0) {
|
|
|
|
path = FileLoader.getPathToMessage(selectedObject.messageOwner).toString();
|
|
|
|
}
|
|
|
|
if (selectedObject.type == 3 || selectedObject.type == 1) {
|
|
|
|
if (Build.VERSION.SDK_INT >= 23 && getParentActivity().checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
|
|
|
|
getParentActivity().requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, 4);
|
|
|
|
selectedObject = null;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
MediaController.saveFile(path, getParentActivity(), selectedObject.type == 3 ? 1 : 0, null, null);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 5: {
|
|
|
|
File locFile = null;
|
|
|
|
if (selectedObject.messageOwner.attachPath != null && selectedObject.messageOwner.attachPath.length() != 0) {
|
|
|
|
File f = new File(selectedObject.messageOwner.attachPath);
|
|
|
|
if (f.exists()) {
|
|
|
|
locFile = f;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (locFile == null) {
|
|
|
|
File f = FileLoader.getPathToMessage(selectedObject.messageOwner);
|
|
|
|
if (f.exists()) {
|
|
|
|
locFile = f;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (locFile != null) {
|
2018-07-30 04:07:02 +02:00
|
|
|
if (locFile.getName().toLowerCase().endsWith("attheme")) {
|
2017-07-08 18:32:04 +02:00
|
|
|
if (chatLayoutManager != null) {
|
|
|
|
int lastPosition = chatLayoutManager.findLastVisibleItemPosition();
|
|
|
|
if (lastPosition < chatLayoutManager.getItemCount() - 1) {
|
|
|
|
scrollToPositionOnRecreate = chatLayoutManager.findFirstVisibleItemPosition();
|
|
|
|
RecyclerListView.Holder holder = (RecyclerListView.Holder) chatListView.findViewHolderForAdapterPosition(scrollToPositionOnRecreate);
|
|
|
|
if (holder != null) {
|
|
|
|
scrollToOffsetOnRecreate = holder.itemView.getTop();
|
|
|
|
} else {
|
|
|
|
scrollToPositionOnRecreate = -1;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
scrollToPositionOnRecreate = -1;
|
|
|
|
}
|
|
|
|
}
|
2019-09-10 12:56:11 +02:00
|
|
|
Theme.ThemeInfo themeInfo = Theme.applyThemeFile(locFile, selectedObject.getDocumentName(), null, true);
|
2017-07-08 18:32:04 +02:00
|
|
|
if (themeInfo != null) {
|
2019-09-10 12:56:11 +02:00
|
|
|
presentFragment(new ThemePreviewActivity(themeInfo));
|
2017-07-08 18:32:04 +02:00
|
|
|
} else {
|
|
|
|
scrollToPositionOnRecreate = -1;
|
|
|
|
if (getParentActivity() == null) {
|
|
|
|
selectedObject = null;
|
|
|
|
return;
|
|
|
|
}
|
2020-06-25 17:29:04 +02:00
|
|
|
AlertUtil.showToast(LocaleController.getString("IncorrectTheme", R.string.IncorrectTheme));
|
2017-07-08 18:32:04 +02:00
|
|
|
}
|
|
|
|
} else {
|
2018-07-30 04:07:02 +02:00
|
|
|
if (LocaleController.getInstance().applyLanguageFile(locFile, currentAccount)) {
|
2017-07-08 18:32:04 +02:00
|
|
|
presentFragment(new LanguageSelectActivity());
|
|
|
|
} else {
|
|
|
|
if (getParentActivity() == null) {
|
|
|
|
selectedObject = null;
|
|
|
|
return;
|
|
|
|
}
|
2020-06-25 17:29:04 +02:00
|
|
|
AlertUtil.showToast(LocaleController.getString("IncorrectLocalization", R.string.IncorrectLocalization));
|
2017-07-08 18:32:04 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 6: {
|
|
|
|
String path = selectedObject.messageOwner.attachPath;
|
|
|
|
if (path != null && path.length() > 0) {
|
|
|
|
File temp = new File(path);
|
|
|
|
if (!temp.exists()) {
|
|
|
|
path = null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (path == null || path.length() == 0) {
|
|
|
|
path = FileLoader.getPathToMessage(selectedObject.messageOwner).toString();
|
|
|
|
}
|
|
|
|
Intent intent = new Intent(Intent.ACTION_SEND);
|
|
|
|
intent.setType(selectedObject.getDocument().mime_type);
|
2017-12-08 18:35:59 +01:00
|
|
|
if (Build.VERSION.SDK_INT >= 24) {
|
|
|
|
try {
|
|
|
|
intent.putExtra(Intent.EXTRA_STREAM, FileProvider.getUriForFile(getParentActivity(), BuildConfig.APPLICATION_ID + ".provider", new File(path)));
|
|
|
|
intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
|
|
|
} catch (Exception ignore) {
|
|
|
|
intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(new File(path)));
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(new File(path)));
|
|
|
|
}
|
2017-07-08 18:32:04 +02:00
|
|
|
getParentActivity().startActivityForResult(Intent.createChooser(intent, LocaleController.getString("ShareFile", R.string.ShareFile)), 500);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 7: {
|
|
|
|
String path = selectedObject.messageOwner.attachPath;
|
|
|
|
if (path != null && path.length() > 0) {
|
|
|
|
File temp = new File(path);
|
|
|
|
if (!temp.exists()) {
|
|
|
|
path = null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (path == null || path.length() == 0) {
|
|
|
|
path = FileLoader.getPathToMessage(selectedObject.messageOwner).toString();
|
|
|
|
}
|
|
|
|
if (Build.VERSION.SDK_INT >= 23 && getParentActivity().checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
|
|
|
|
getParentActivity().requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, 4);
|
|
|
|
selectedObject = null;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
MediaController.saveFile(path, getParentActivity(), 0, null, null);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 9: {
|
|
|
|
showDialog(new StickersAlert(getParentActivity(), this, selectedObject.getInputStickerSet(), null, null));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 10: {
|
|
|
|
if (Build.VERSION.SDK_INT >= 23 && getParentActivity().checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
|
|
|
|
getParentActivity().requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, 4);
|
|
|
|
selectedObject = null;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
String fileName = FileLoader.getDocumentFileName(selectedObject.getDocument());
|
|
|
|
if (TextUtils.isEmpty(fileName)) {
|
|
|
|
fileName = selectedObject.getFileName();
|
|
|
|
}
|
|
|
|
String path = selectedObject.messageOwner.attachPath;
|
|
|
|
if (path != null && path.length() > 0) {
|
|
|
|
File temp = new File(path);
|
|
|
|
if (!temp.exists()) {
|
|
|
|
path = null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (path == null || path.length() == 0) {
|
|
|
|
path = FileLoader.getPathToMessage(selectedObject.messageOwner).toString();
|
|
|
|
}
|
|
|
|
MediaController.saveFile(path, getParentActivity(), selectedObject.isMusic() ? 3 : 2, fileName, selectedObject.getDocument() != null ? selectedObject.getDocument().mime_type : "");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 11: {
|
|
|
|
TLRPC.Document document = selectedObject.getDocument();
|
2019-01-23 18:03:33 +01:00
|
|
|
MessagesController.getInstance(currentAccount).saveGif(selectedObject, document);
|
2017-07-08 18:32:04 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 15: {
|
|
|
|
Bundle args = new Bundle();
|
|
|
|
args.putInt("user_id", selectedObject.messageOwner.media.user_id);
|
|
|
|
args.putString("phone", selectedObject.messageOwner.media.phone_number);
|
|
|
|
args.putBoolean("addContact", true);
|
|
|
|
presentFragment(new ContactAddActivity(args));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 16: {
|
|
|
|
AndroidUtilities.addToClipboard(selectedObject.messageOwner.media.phone_number);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 17: {
|
|
|
|
try {
|
|
|
|
Intent intent = new Intent(Intent.ACTION_DIAL, Uri.parse("tel:" + selectedObject.messageOwner.media.phone_number));
|
|
|
|
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
|
|
|
getParentActivity().startActivityForResult(intent, 500);
|
|
|
|
} catch (Exception e) {
|
|
|
|
FileLog.e(e);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
selectedObject = null;
|
|
|
|
}
|
|
|
|
|
|
|
|
private int getMessageType(MessageObject messageObject) {
|
|
|
|
if (messageObject == null) {
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
if (messageObject.type == 6) {
|
|
|
|
return -1;
|
|
|
|
} else if (messageObject.type == 10 || messageObject.type == 11 || messageObject.type == 16) {
|
|
|
|
if (messageObject.getId() == 0) {
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
return 1;
|
|
|
|
} else {
|
|
|
|
if (messageObject.isVoice()) {
|
|
|
|
return 2;
|
2019-07-18 15:01:39 +02:00
|
|
|
} else if (messageObject.isSticker() || messageObject.isAnimatedSticker()) {
|
2017-07-08 18:32:04 +02:00
|
|
|
TLRPC.InputStickerSet inputStickerSet = messageObject.getInputStickerSet();
|
|
|
|
if (inputStickerSet instanceof TLRPC.TL_inputStickerSetID) {
|
2019-07-18 15:01:39 +02:00
|
|
|
if (!MediaDataController.getInstance(currentAccount).isStickerPackInstalled(inputStickerSet.id)) {
|
2017-07-08 18:32:04 +02:00
|
|
|
return 7;
|
|
|
|
}
|
|
|
|
} else if (inputStickerSet instanceof TLRPC.TL_inputStickerSetShortName) {
|
2019-07-18 15:01:39 +02:00
|
|
|
if (!MediaDataController.getInstance(currentAccount).isStickerPackInstalled(inputStickerSet.short_name)) {
|
2017-07-08 18:32:04 +02:00
|
|
|
return 7;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if ((!messageObject.isRoundVideo() || messageObject.isRoundVideo() && BuildVars.DEBUG_VERSION) && (messageObject.messageOwner.media instanceof TLRPC.TL_messageMediaPhoto || messageObject.getDocument() != null || messageObject.isMusic() || messageObject.isVideo())) {
|
|
|
|
boolean canSave = false;
|
|
|
|
if (messageObject.messageOwner.attachPath != null && messageObject.messageOwner.attachPath.length() != 0) {
|
|
|
|
File f = new File(messageObject.messageOwner.attachPath);
|
|
|
|
if (f.exists()) {
|
|
|
|
canSave = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!canSave) {
|
|
|
|
File f = FileLoader.getPathToMessage(messageObject.messageOwner);
|
|
|
|
if (f.exists()) {
|
|
|
|
canSave = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (canSave) {
|
|
|
|
if (messageObject.getDocument() != null) {
|
|
|
|
String mime = messageObject.getDocument().mime_type;
|
|
|
|
if (mime != null) {
|
2018-07-30 04:07:02 +02:00
|
|
|
if (messageObject.getDocumentName().toLowerCase().endsWith("attheme")) {
|
2017-07-08 18:32:04 +02:00
|
|
|
return 10;
|
|
|
|
} else if (mime.endsWith("/xml")) {
|
|
|
|
return 5;
|
|
|
|
} else if (mime.endsWith("/png") || mime.endsWith("/jpg") || mime.endsWith("/jpeg")) {
|
|
|
|
return 6;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 4;
|
|
|
|
}
|
|
|
|
} else if (messageObject.type == 12) {
|
|
|
|
return 8;
|
|
|
|
} else if (messageObject.isMediaEmpty()) {
|
|
|
|
return 3;
|
|
|
|
}
|
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private void loadAdmins() {
|
|
|
|
TLRPC.TL_channels_getParticipants req = new TLRPC.TL_channels_getParticipants();
|
|
|
|
req.channel = MessagesController.getInputChannel(currentChat);
|
|
|
|
req.filter = new TLRPC.TL_channelParticipantsAdmins();
|
|
|
|
req.offset = 0;
|
|
|
|
req.limit = 200;
|
2019-01-23 18:03:33 +01: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);
|
|
|
|
admins = res.participants;
|
|
|
|
if (visibleDialog instanceof AdminLogFilterAlert) {
|
|
|
|
((AdminLogFilterAlert) visibleDialog).setCurrentAdmins(admins);
|
|
|
|
}
|
2017-07-08 18:32:04 +02:00
|
|
|
}
|
2019-01-23 18:03:33 +01:00
|
|
|
}));
|
2018-07-30 04:07:02 +02:00
|
|
|
ConnectionsManager.getInstance(currentAccount).bindRequestToGuid(reqId, classGuid);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected void onRemoveFromParent() {
|
|
|
|
MediaController.getInstance().setTextureView(videoTextureView, null, null, false);
|
2017-07-08 18:32:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
private void hideFloatingDateView(boolean animated) {
|
|
|
|
if (floatingDateView.getTag() != null && !currentFloatingDateOnScreen && (!scrollingFloatingDate || currentFloatingTopIsNotMessage)) {
|
|
|
|
floatingDateView.setTag(null);
|
|
|
|
if (animated) {
|
|
|
|
floatingDateAnimation = new AnimatorSet();
|
|
|
|
floatingDateAnimation.setDuration(150);
|
|
|
|
floatingDateAnimation.playTogether(ObjectAnimator.ofFloat(floatingDateView, "alpha", 0.0f));
|
|
|
|
floatingDateAnimation.addListener(new AnimatorListenerAdapter() {
|
|
|
|
@Override
|
|
|
|
public void onAnimationEnd(Animator animation) {
|
|
|
|
if (animation.equals(floatingDateAnimation)) {
|
|
|
|
floatingDateAnimation = null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
floatingDateAnimation.setStartDelay(500);
|
|
|
|
floatingDateAnimation.start();
|
|
|
|
} else {
|
|
|
|
if (floatingDateAnimation != null) {
|
|
|
|
floatingDateAnimation.cancel();
|
|
|
|
floatingDateAnimation = null;
|
|
|
|
}
|
|
|
|
floatingDateView.setAlpha(0.0f);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private void checkScrollForLoad(boolean scroll) {
|
|
|
|
if (chatLayoutManager == null || paused) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
int firstVisibleItem = chatLayoutManager.findFirstVisibleItemPosition();
|
|
|
|
int visibleItemCount = firstVisibleItem == RecyclerView.NO_POSITION ? 0 : Math.abs(chatLayoutManager.findLastVisibleItemPosition() - firstVisibleItem) + 1;
|
|
|
|
if (visibleItemCount > 0) {
|
|
|
|
int totalItemCount = chatAdapter.getItemCount();
|
|
|
|
int checkLoadCount;
|
|
|
|
if (scroll) {
|
|
|
|
checkLoadCount = 25;
|
2021-02-03 15:14:57 +01:00
|
|
|
} else {
|
2017-07-08 18:32:04 +02:00
|
|
|
checkLoadCount = 5;
|
|
|
|
}
|
|
|
|
if (firstVisibleItem <= checkLoadCount && !loading && !endReached) {
|
|
|
|
loadMessages(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private void moveScrollToLastMessage() {
|
|
|
|
if (chatListView != null && !messages.isEmpty()) {
|
|
|
|
chatLayoutManager.scrollToPositionWithOffset(messages.size() - 1, -100000 - chatListView.getPaddingTop());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private void updateTextureViewPosition() {
|
|
|
|
boolean foundTextureViewMessage = false;
|
|
|
|
int count = chatListView.getChildCount();
|
|
|
|
for (int a = 0; a < count; a++) {
|
|
|
|
View view = chatListView.getChildAt(a);
|
|
|
|
if (view instanceof ChatMessageCell) {
|
|
|
|
ChatMessageCell messageCell = (ChatMessageCell) view;
|
|
|
|
MessageObject messageObject = messageCell.getMessageObject();
|
|
|
|
if (roundVideoContainer != null && messageObject.isRoundVideo() && MediaController.getInstance().isPlayingMessage(messageObject)) {
|
|
|
|
ImageReceiver imageReceiver = messageCell.getPhotoImage();
|
|
|
|
roundVideoContainer.setTranslationX(imageReceiver.getImageX());
|
|
|
|
roundVideoContainer.setTranslationY(fragmentView.getPaddingTop() + messageCell.getTop() + imageReceiver.getImageY());
|
|
|
|
fragmentView.invalidate();
|
|
|
|
roundVideoContainer.invalidate();
|
|
|
|
foundTextureViewMessage = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (roundVideoContainer != null) {
|
|
|
|
MessageObject messageObject = MediaController.getInstance().getPlayingMessageObject();
|
|
|
|
if (!foundTextureViewMessage) {
|
|
|
|
roundVideoContainer.setTranslationY(-AndroidUtilities.roundMessageSize - 100);
|
|
|
|
fragmentView.invalidate();
|
|
|
|
if (messageObject != null && messageObject.isRoundVideo()) {
|
|
|
|
if (checkTextureViewPosition || PipRoundVideoView.getInstance() != null) {
|
2019-03-03 21:40:48 +01:00
|
|
|
MediaController.getInstance().setCurrentVideoVisible(false);
|
2017-07-08 18:32:04 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
2019-03-03 21:40:48 +01:00
|
|
|
MediaController.getInstance().setCurrentVideoVisible(true);
|
2017-07-08 18:32:04 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private void updateMessagesVisisblePart() {
|
|
|
|
if (chatListView == null) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
int count = chatListView.getChildCount();
|
|
|
|
int height = chatListView.getMeasuredHeight();
|
|
|
|
int minPositionHolder = Integer.MAX_VALUE;
|
|
|
|
int minPositionDateHolder = Integer.MAX_VALUE;
|
|
|
|
View minDateChild = null;
|
|
|
|
View minChild = null;
|
|
|
|
View minMessageChild = null;
|
|
|
|
boolean foundTextureViewMessage = false;
|
|
|
|
for (int a = 0; a < count; a++) {
|
|
|
|
View view = chatListView.getChildAt(a);
|
|
|
|
if (view instanceof ChatMessageCell) {
|
|
|
|
ChatMessageCell messageCell = (ChatMessageCell) view;
|
|
|
|
int top = messageCell.getTop();
|
|
|
|
int bottom = messageCell.getBottom();
|
|
|
|
int viewTop = top >= 0 ? 0 : -top;
|
|
|
|
int viewBottom = messageCell.getMeasuredHeight();
|
|
|
|
if (viewBottom > height) {
|
|
|
|
viewBottom = viewTop + height;
|
|
|
|
}
|
2020-09-30 15:48:47 +02:00
|
|
|
messageCell.setVisiblePart(viewTop, viewBottom - viewTop, contentView.getHeightWithKeyboard() - AndroidUtilities.dp(48) - chatListView.getTop(), 0);
|
2017-07-08 18:32:04 +02:00
|
|
|
|
|
|
|
MessageObject messageObject = messageCell.getMessageObject();
|
|
|
|
if (roundVideoContainer != null && messageObject.isRoundVideo() && MediaController.getInstance().isPlayingMessage(messageObject)) {
|
|
|
|
ImageReceiver imageReceiver = messageCell.getPhotoImage();
|
|
|
|
roundVideoContainer.setTranslationX(imageReceiver.getImageX());
|
|
|
|
roundVideoContainer.setTranslationY(fragmentView.getPaddingTop() + top + imageReceiver.getImageY());
|
|
|
|
fragmentView.invalidate();
|
|
|
|
roundVideoContainer.invalidate();
|
|
|
|
foundTextureViewMessage = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (view.getBottom() <= chatListView.getPaddingTop()) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
int position = view.getBottom();
|
|
|
|
if (position < minPositionHolder) {
|
|
|
|
minPositionHolder = position;
|
|
|
|
if (view instanceof ChatMessageCell || view instanceof ChatActionCell) {
|
|
|
|
minMessageChild = view;
|
|
|
|
}
|
|
|
|
minChild = view;
|
|
|
|
}
|
|
|
|
if (view instanceof ChatActionCell && ((ChatActionCell) view).getMessageObject().isDateObject) {
|
|
|
|
if (view.getAlpha() != 1.0f) {
|
|
|
|
view.setAlpha(1.0f);
|
|
|
|
}
|
|
|
|
if (position < minPositionDateHolder) {
|
|
|
|
minPositionDateHolder = position;
|
|
|
|
minDateChild = view;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (roundVideoContainer != null) {
|
|
|
|
if (!foundTextureViewMessage) {
|
|
|
|
roundVideoContainer.setTranslationY(-AndroidUtilities.roundMessageSize - 100);
|
|
|
|
fragmentView.invalidate();
|
|
|
|
MessageObject messageObject = MediaController.getInstance().getPlayingMessageObject();
|
|
|
|
if (messageObject != null && messageObject.isRoundVideo() && checkTextureViewPosition) {
|
2019-03-03 21:40:48 +01:00
|
|
|
MediaController.getInstance().setCurrentVideoVisible(false);
|
2017-07-08 18:32:04 +02:00
|
|
|
}
|
|
|
|
} else {
|
2019-03-03 21:40:48 +01:00
|
|
|
MediaController.getInstance().setCurrentVideoVisible(true);
|
2017-07-08 18:32:04 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (minMessageChild != null) {
|
|
|
|
MessageObject messageObject;
|
|
|
|
if (minMessageChild instanceof ChatMessageCell) {
|
|
|
|
messageObject = ((ChatMessageCell) minMessageChild).getMessageObject();
|
|
|
|
} else {
|
|
|
|
messageObject = ((ChatActionCell) minMessageChild).getMessageObject();
|
|
|
|
}
|
2019-12-31 14:08:08 +01:00
|
|
|
floatingDateView.setCustomDate(messageObject.messageOwner.date, false, true);
|
2017-07-08 18:32:04 +02:00
|
|
|
}
|
|
|
|
currentFloatingDateOnScreen = false;
|
|
|
|
currentFloatingTopIsNotMessage = !(minChild instanceof ChatMessageCell || minChild instanceof ChatActionCell);
|
|
|
|
if (minDateChild != null) {
|
|
|
|
if (minDateChild.getTop() > chatListView.getPaddingTop() || currentFloatingTopIsNotMessage) {
|
|
|
|
if (minDateChild.getAlpha() != 1.0f) {
|
|
|
|
minDateChild.setAlpha(1.0f);
|
|
|
|
}
|
|
|
|
hideFloatingDateView(!currentFloatingTopIsNotMessage);
|
|
|
|
} else {
|
|
|
|
if (minDateChild.getAlpha() != 0.0f) {
|
|
|
|
minDateChild.setAlpha(0.0f);
|
|
|
|
}
|
|
|
|
if (floatingDateAnimation != null) {
|
|
|
|
floatingDateAnimation.cancel();
|
|
|
|
floatingDateAnimation = null;
|
|
|
|
}
|
|
|
|
if (floatingDateView.getTag() == null) {
|
|
|
|
floatingDateView.setTag(1);
|
|
|
|
}
|
|
|
|
if (floatingDateView.getAlpha() != 1.0f) {
|
|
|
|
floatingDateView.setAlpha(1.0f);
|
|
|
|
}
|
|
|
|
currentFloatingDateOnScreen = true;
|
|
|
|
}
|
|
|
|
int offset = minDateChild.getBottom() - chatListView.getPaddingTop();
|
|
|
|
if (offset > floatingDateView.getMeasuredHeight() && offset < floatingDateView.getMeasuredHeight() * 2) {
|
|
|
|
floatingDateView.setTranslationY(-floatingDateView.getMeasuredHeight() * 2 + offset);
|
|
|
|
} else {
|
|
|
|
floatingDateView.setTranslationY(0);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
hideFloatingDateView(true);
|
|
|
|
floatingDateView.setTranslationY(0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onTransitionAnimationStart(boolean isOpen, boolean backward) {
|
|
|
|
if (isOpen) {
|
2020-10-31 22:13:37 +01:00
|
|
|
allowAnimationIndex = getNotificationCenter().setAnimationInProgress(allowAnimationIndex, new int[]{NotificationCenter.chatInfoDidLoad, NotificationCenter.dialogsNeedReload,
|
2019-07-18 15:01:39 +02:00
|
|
|
NotificationCenter.closeChats, NotificationCenter.messagesDidLoad, NotificationCenter.botKeyboardDidLoad/*, NotificationCenter.botInfoDidLoad*/});
|
2017-07-08 18:32:04 +02:00
|
|
|
openAnimationEnded = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onTransitionAnimationEnd(boolean isOpen, boolean backward) {
|
|
|
|
if (isOpen) {
|
2020-10-31 22:13:37 +01:00
|
|
|
getNotificationCenter().onAnimationFinish(allowAnimationIndex);
|
2017-07-08 18:32:04 +02:00
|
|
|
openAnimationEnded = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onResume() {
|
|
|
|
super.onResume();
|
|
|
|
|
2019-01-23 18:03:33 +01:00
|
|
|
if (contentView != null) {
|
|
|
|
contentView.onResume();
|
|
|
|
}
|
2017-07-08 18:32:04 +02:00
|
|
|
paused = false;
|
|
|
|
checkScrollForLoad(false);
|
|
|
|
if (wasPaused) {
|
|
|
|
wasPaused = false;
|
|
|
|
if (chatAdapter != null) {
|
|
|
|
chatAdapter.notifyDataSetChanged();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onPause() {
|
|
|
|
super.onPause();
|
2019-01-23 18:03:33 +01:00
|
|
|
if (contentView != null) {
|
|
|
|
contentView.onPause();
|
|
|
|
}
|
2021-02-23 12:53:38 +01:00
|
|
|
if (undoView != null) {
|
|
|
|
undoView.hide(true, 0);
|
|
|
|
}
|
2017-07-08 18:32:04 +02:00
|
|
|
paused = true;
|
|
|
|
wasPaused = true;
|
2020-09-30 15:48:47 +02:00
|
|
|
if (AvatarPreviewer.hasVisibleInstance()) {
|
|
|
|
AvatarPreviewer.getInstance().close();
|
|
|
|
}
|
2017-07-08 18:32:04 +02:00
|
|
|
}
|
|
|
|
|
2021-02-23 12:53:38 +01:00
|
|
|
@Override
|
|
|
|
protected void onBecomeFullyHidden() {
|
|
|
|
if (undoView != null) {
|
|
|
|
undoView.hide(true, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-12-31 14:08:08 +01:00
|
|
|
public void openVCard(TLRPC.User user, String vcard, String first_name, String last_name) {
|
2018-07-30 04:07:02 +02:00
|
|
|
try {
|
2019-12-31 14:08:08 +01:00
|
|
|
File f = AndroidUtilities.getSharingDirectory();
|
2018-07-30 04:07:02 +02:00
|
|
|
f.mkdirs();
|
|
|
|
f = new File(f, "vcard.vcf");
|
|
|
|
BufferedWriter writer = new BufferedWriter(new FileWriter(f));
|
|
|
|
writer.write(vcard);
|
|
|
|
writer.close();
|
2020-04-24 11:21:58 +02:00
|
|
|
showDialog(new PhonebookShareAlert(this, null, user, null, f, first_name, last_name));
|
2018-07-30 04:07:02 +02:00
|
|
|
} catch (Exception e) {
|
|
|
|
FileLog.e(e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-07-08 18:32:04 +02:00
|
|
|
@Override
|
|
|
|
public void onConfigurationChanged(android.content.res.Configuration newConfig) {
|
|
|
|
if (visibleDialog instanceof DatePickerDialog) {
|
|
|
|
visibleDialog.dismiss();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private void alertUserOpenError(MessageObject message) {
|
|
|
|
if (getParentActivity() == null) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
|
|
|
|
builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
|
|
|
|
builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), null);
|
|
|
|
if (message.type == 3) {
|
|
|
|
builder.setMessage(LocaleController.getString("NoPlayerInstalled", R.string.NoPlayerInstalled));
|
|
|
|
} else {
|
|
|
|
builder.setMessage(LocaleController.formatString("NoHandleAppInstalled", R.string.NoHandleAppInstalled, message.getDocument().mime_type));
|
|
|
|
}
|
|
|
|
showDialog(builder.create());
|
|
|
|
}
|
|
|
|
|
|
|
|
public TLRPC.Chat getCurrentChat() {
|
|
|
|
return currentChat;
|
|
|
|
}
|
|
|
|
|
|
|
|
private void addCanBanUser(Bundle bundle, int uid) {
|
|
|
|
if (!currentChat.megagroup || admins == null || !ChatObject.canBlockUsers(currentChat)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
for (int a = 0; a < admins.size(); a++) {
|
|
|
|
TLRPC.ChannelParticipant channelParticipant = admins.get(a);
|
|
|
|
if (channelParticipant.user_id == uid) {
|
|
|
|
if (!channelParticipant.can_edit) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
bundle.putInt("ban_chat_id", currentChat.id);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void showOpenUrlAlert(final String url, boolean ask) {
|
2020-06-25 17:29:04 +02:00
|
|
|
if (Browser.isInternalUrl(url, null) || !ask || NekoConfig.skipOpenLinkConfirm) {
|
2017-07-08 18:32:04 +02:00
|
|
|
Browser.openUrl(getParentActivity(), url, true);
|
|
|
|
} else {
|
|
|
|
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
|
2019-06-04 12:14:50 +02:00
|
|
|
builder.setTitle(LocaleController.getString("OpenUrlTitle", R.string.OpenUrlTitle));
|
|
|
|
builder.setMessage(LocaleController.formatString("OpenUrlAlert2", R.string.OpenUrlAlert2, url));
|
2019-01-23 18:03:33 +01:00
|
|
|
builder.setPositiveButton(LocaleController.getString("Open", R.string.Open), (dialogInterface, i) -> Browser.openUrl(getParentActivity(), url, true));
|
2017-07-08 18:32:04 +02:00
|
|
|
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
|
|
|
|
showDialog(builder.create());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private void removeMessageObject(MessageObject messageObject) {
|
|
|
|
int index = messages.indexOf(messageObject);
|
|
|
|
if (index == -1) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
messages.remove(index);
|
|
|
|
if (chatAdapter != null) {
|
|
|
|
chatAdapter.notifyItemRemoved(chatAdapter.messagesStartRow + messages.size() - index - 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public class ChatActivityAdapter extends RecyclerView.Adapter {
|
|
|
|
|
|
|
|
private Context mContext;
|
|
|
|
private int rowCount;
|
|
|
|
private int loadingUpRow;
|
|
|
|
private int messagesStartRow;
|
|
|
|
private int messagesEndRow;
|
|
|
|
|
|
|
|
public ChatActivityAdapter(Context context) {
|
|
|
|
mContext = context;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void updateRows() {
|
|
|
|
rowCount = 0;
|
|
|
|
if (!messages.isEmpty()) {
|
|
|
|
if (!endReached) {
|
|
|
|
loadingUpRow = rowCount++;
|
|
|
|
} else {
|
|
|
|
loadingUpRow = -1;
|
|
|
|
}
|
|
|
|
messagesStartRow = rowCount;
|
|
|
|
rowCount += messages.size();
|
|
|
|
messagesEndRow = rowCount;
|
|
|
|
} else {
|
|
|
|
loadingUpRow = -1;
|
|
|
|
messagesStartRow = -1;
|
|
|
|
messagesEndRow = -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public int getItemCount() {
|
|
|
|
return rowCount;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public long getItemId(int i) {
|
|
|
|
return RecyclerListView.NO_ID;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
|
|
|
View view = null;
|
|
|
|
if (viewType == 0) {
|
|
|
|
if (!chatMessageCellsCache.isEmpty()) {
|
|
|
|
view = chatMessageCellsCache.get(0);
|
|
|
|
chatMessageCellsCache.remove(0);
|
|
|
|
} else {
|
|
|
|
view = new ChatMessageCell(mContext);
|
|
|
|
}
|
|
|
|
ChatMessageCell chatMessageCell = (ChatMessageCell) view;
|
|
|
|
chatMessageCell.setDelegate(new ChatMessageCell.ChatMessageCellDelegate() {
|
|
|
|
@Override
|
2020-09-30 15:48:47 +02:00
|
|
|
public void didPressSideButton(ChatMessageCell cell) {
|
2017-07-08 18:32:04 +02:00
|
|
|
if (getParentActivity() == null) {
|
|
|
|
return;
|
|
|
|
}
|
2019-05-14 14:08:05 +02:00
|
|
|
showDialog(ShareAlert.createShareAlert(mContext, cell.getMessageObject(), null, ChatObject.isChannel(currentChat) && !currentChat.megagroup, null, false));
|
2017-07-08 18:32:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean needPlayMessage(MessageObject messageObject) {
|
|
|
|
if (messageObject.isVoice() || messageObject.isRoundVideo()) {
|
|
|
|
boolean result = MediaController.getInstance().playMessage(messageObject);
|
|
|
|
MediaController.getInstance().setVoiceMessagesPlaylist(null, false);
|
|
|
|
return result;
|
|
|
|
} else if (messageObject.isMusic()) {
|
2020-07-26 10:03:38 +02:00
|
|
|
return MediaController.getInstance().setPlaylist(messages, messageObject, 0);
|
2017-07-08 18:32:04 +02:00
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2019-05-14 14:08:05 +02:00
|
|
|
public void didPressChannelAvatar(ChatMessageCell cell, TLRPC.Chat chat, int postId, float touchX, float touchY) {
|
2017-07-08 18:32:04 +02:00
|
|
|
if (chat != null && chat != currentChat) {
|
|
|
|
Bundle args = new Bundle();
|
|
|
|
args.putInt("chat_id", chat.id);
|
|
|
|
if (postId != 0) {
|
|
|
|
args.putInt("message_id", postId);
|
|
|
|
}
|
2018-07-30 04:07:02 +02:00
|
|
|
if (MessagesController.getInstance(currentAccount).checkCanOpenChat(args, ChannelAdminLogActivity.this)) {
|
2017-07-08 18:32:04 +02:00
|
|
|
presentFragment(new ChatActivity(args), true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2019-05-14 14:08:05 +02:00
|
|
|
public void didPressOther(ChatMessageCell cell, float x, float y) {
|
2017-07-08 18:32:04 +02:00
|
|
|
createMenu(cell);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2019-05-14 14:08:05 +02:00
|
|
|
public void didPressUserAvatar(ChatMessageCell cell, TLRPC.User user, float touchX, float touchY) {
|
2018-07-30 04:07:02 +02:00
|
|
|
if (user != null && user.id != UserConfig.getInstance(currentAccount).getClientUserId()) {
|
2020-09-30 15:48:47 +02:00
|
|
|
openProfile(user);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean didLongPressUserAvatar(ChatMessageCell cell, TLRPC.User user, float touchX, float touchY) {
|
|
|
|
if (user != null && user.id != UserConfig.getInstance(currentAccount).getClientUserId()) {
|
|
|
|
final AvatarPreviewer.MenuItem[] menuItems = {AvatarPreviewer.MenuItem.OPEN_PROFILE, AvatarPreviewer.MenuItem.SEND_MESSAGE};
|
|
|
|
final TLRPC.UserFull userFull = getMessagesController().getUserFull(user.id);
|
|
|
|
final AvatarPreviewer.Data data;
|
|
|
|
if (userFull != null) {
|
|
|
|
data = AvatarPreviewer.Data.of(userFull, menuItems);
|
|
|
|
} else {
|
|
|
|
data = AvatarPreviewer.Data.of(user, classGuid, menuItems);
|
|
|
|
}
|
|
|
|
if (AvatarPreviewer.canPreview(data)) {
|
|
|
|
AvatarPreviewer.getInstance().show((ViewGroup) fragmentView, data, item -> {
|
|
|
|
switch (item) {
|
|
|
|
case SEND_MESSAGE:
|
|
|
|
openDialog(cell, user);
|
|
|
|
break;
|
|
|
|
case OPEN_PROFILE:
|
|
|
|
openProfile(user);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
private void openProfile(TLRPC.User user) {
|
|
|
|
Bundle args = new Bundle();
|
|
|
|
args.putInt("user_id", user.id);
|
|
|
|
addCanBanUser(args, user.id);
|
|
|
|
ProfileActivity fragment = new ProfileActivity(args);
|
|
|
|
fragment.setPlayProfileAnimation(0);
|
|
|
|
presentFragment(fragment);
|
|
|
|
}
|
|
|
|
|
|
|
|
private void openDialog(ChatMessageCell cell, TLRPC.User user) {
|
|
|
|
if (user != null) {
|
2017-07-08 18:32:04 +02:00
|
|
|
Bundle args = new Bundle();
|
|
|
|
args.putInt("user_id", user.id);
|
2020-09-30 15:48:47 +02:00
|
|
|
if (getMessagesController().checkCanOpenChat(args, ChannelAdminLogActivity.this)) {
|
|
|
|
presentFragment(new ChatActivity(args));
|
|
|
|
}
|
2017-07-08 18:32:04 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2019-01-23 18:03:33 +01:00
|
|
|
public void didPressCancelSendButton(ChatMessageCell cell) {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2019-05-14 14:08:05 +02:00
|
|
|
public void didLongPress(ChatMessageCell cell, float x, float y) {
|
2017-07-08 18:32:04 +02:00
|
|
|
createMenu(cell);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean canPerformActions() {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2019-08-22 01:53:26 +02:00
|
|
|
public void didPressUrl(ChatMessageCell cell, final CharacterStyle url, boolean longPress) {
|
2017-07-08 18:32:04 +02:00
|
|
|
if (url == null) {
|
|
|
|
return;
|
|
|
|
}
|
2019-08-22 01:53:26 +02:00
|
|
|
MessageObject messageObject = cell.getMessageObject();
|
2017-07-08 18:32:04 +02:00
|
|
|
if (url instanceof URLSpanMono) {
|
|
|
|
((URLSpanMono) url).copyToClipboard();
|
|
|
|
Toast.makeText(getParentActivity(), LocaleController.getString("TextCopied", R.string.TextCopied), Toast.LENGTH_SHORT).show();
|
|
|
|
} else if (url instanceof URLSpanUserMention) {
|
2018-07-30 04:07:02 +02:00
|
|
|
TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(Utilities.parseInt(((URLSpanUserMention) url).getURL()));
|
2017-07-08 18:32:04 +02:00
|
|
|
if (user != null) {
|
|
|
|
MessagesController.openChatOrProfileWith(user, null, ChannelAdminLogActivity.this, 0, false);
|
|
|
|
}
|
|
|
|
} else if (url instanceof URLSpanNoUnderline) {
|
|
|
|
String str = ((URLSpanNoUnderline) url).getURL();
|
|
|
|
if (str.startsWith("@")) {
|
2018-07-30 04:07:02 +02:00
|
|
|
MessagesController.getInstance(currentAccount).openByUserName(str.substring(1), ChannelAdminLogActivity.this, 0);
|
2017-07-08 18:32:04 +02:00
|
|
|
} else if (str.startsWith("#")) {
|
|
|
|
DialogsActivity fragment = new DialogsActivity(null);
|
|
|
|
fragment.setSearchString(str);
|
|
|
|
presentFragment(fragment);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
final String urlFinal = ((URLSpan) url).getURL();
|
|
|
|
if (longPress) {
|
2021-02-03 15:14:57 +01:00
|
|
|
BottomBuilder builder = new BottomBuilder(getParentActivity());
|
|
|
|
builder.addTitle(urlFinal);
|
|
|
|
builder.addItems(
|
|
|
|
new String[]{LocaleController.getString("Open", R.string.Open), LocaleController.getString("Copy", R.string.Copy), LocaleController.getString("ShareQRCode", R.string.ShareQRCode)},
|
2021-02-04 18:59:00 +01:00
|
|
|
new int[]{R.drawable.baseline_open_in_browser_24, R.drawable.baseline_content_copy_24, R.drawable.wallet_qr}, (which, text, __) -> {
|
2021-02-03 15:14:57 +01:00
|
|
|
if (which == 0 || which == 2) {
|
|
|
|
if (which == 0) {
|
|
|
|
Browser.openUrl(getParentActivity(), urlFinal);
|
|
|
|
} else {
|
|
|
|
ProxyUtil.showQrDialog(getParentActivity(), urlFinal);
|
|
|
|
}
|
|
|
|
} else if (which == 1) {
|
|
|
|
String url1 = urlFinal;
|
|
|
|
if (url1.startsWith("mailto:")) {
|
|
|
|
url1 = url1.substring(7);
|
|
|
|
} else if (url1.startsWith("tel:")) {
|
|
|
|
url1 = url1.substring(4);
|
|
|
|
}
|
|
|
|
AndroidUtilities.addToClipboard(url1);
|
|
|
|
AlertUtil.showToast(LocaleController.getString("LinkCopied", R.string.LinkCopied));
|
|
|
|
}
|
|
|
|
return Unit.INSTANCE;
|
|
|
|
});
|
2017-07-08 18:32:04 +02:00
|
|
|
showDialog(builder.create());
|
|
|
|
} else {
|
|
|
|
if (url instanceof URLSpanReplacement) {
|
|
|
|
showOpenUrlAlert(((URLSpanReplacement) url).getURL(), true);
|
|
|
|
} else if (url instanceof URLSpan) {
|
|
|
|
if (messageObject.messageOwner.media instanceof TLRPC.TL_messageMediaWebPage && messageObject.messageOwner.media.webpage != null && messageObject.messageOwner.media.webpage.cached_page != null) {
|
|
|
|
String lowerUrl = urlFinal.toLowerCase();
|
|
|
|
String lowerUrl2 = messageObject.messageOwner.media.webpage.url.toLowerCase();
|
2020-07-26 10:03:38 +02:00
|
|
|
if ((Browser.isTelegraphUrl(lowerUrl, false) || lowerUrl.contains("t.me/iv")) && (lowerUrl.contains(lowerUrl2) || lowerUrl2.contains(lowerUrl))) {
|
2017-07-08 18:32:04 +02:00
|
|
|
ArticleViewer.getInstance().setParentActivity(getParentActivity(), ChannelAdminLogActivity.this);
|
|
|
|
ArticleViewer.getInstance().open(messageObject);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Browser.openUrl(getParentActivity(), urlFinal, true);
|
|
|
|
} else if (url instanceof ClickableSpan) {
|
|
|
|
((ClickableSpan) url).onClick(fragmentView);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void needOpenWebView(String url, String title, String description, String originalUrl, int w, int h) {
|
2020-07-26 10:03:38 +02:00
|
|
|
EmbedBottomSheet.show(mContext, title, description, originalUrl, url, w, h, false);
|
2017-07-08 18:32:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2019-01-23 18:03:33 +01:00
|
|
|
public void didPressReplyMessage(ChatMessageCell cell, int id) {
|
2017-07-08 18:32:04 +02:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2019-01-23 18:03:33 +01:00
|
|
|
public void didPressViaBot(ChatMessageCell cell, String username) {
|
2017-07-08 18:32:04 +02:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2019-05-14 14:08:05 +02:00
|
|
|
public void didPressImage(ChatMessageCell cell, float x, float y) {
|
2017-07-08 18:32:04 +02:00
|
|
|
MessageObject message = cell.getMessageObject();
|
|
|
|
if (message.type == 13) {
|
|
|
|
showDialog(new StickersAlert(getParentActivity(), ChannelAdminLogActivity.this, message.getInputStickerSet(), null, null));
|
2017-07-23 14:56:38 +02:00
|
|
|
} else if (message.isVideo() || message.type == 1 || message.type == 0 && !message.isWebpageDocument() || message.isGif()) {
|
2017-07-08 18:32:04 +02:00
|
|
|
PhotoViewer.getInstance().setParentActivity(getParentActivity());
|
2020-09-30 15:48:47 +02:00
|
|
|
PhotoViewer.getInstance().openPhoto(message, null, 0, 0, provider);
|
2017-07-08 18:32:04 +02:00
|
|
|
} else if (message.type == 3) {
|
|
|
|
try {
|
|
|
|
File f = null;
|
|
|
|
if (message.messageOwner.attachPath != null && message.messageOwner.attachPath.length() != 0) {
|
|
|
|
f = new File(message.messageOwner.attachPath);
|
|
|
|
}
|
|
|
|
if (f == null || !f.exists()) {
|
|
|
|
f = FileLoader.getPathToMessage(message.messageOwner);
|
|
|
|
}
|
|
|
|
Intent intent = new Intent(Intent.ACTION_VIEW);
|
|
|
|
if (Build.VERSION.SDK_INT >= 24) {
|
|
|
|
intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
|
|
|
intent.setDataAndType(FileProvider.getUriForFile(getParentActivity(), BuildConfig.APPLICATION_ID + ".provider", f), "video/mp4");
|
|
|
|
} else {
|
|
|
|
intent.setDataAndType(Uri.fromFile(f), "video/mp4");
|
|
|
|
}
|
|
|
|
getParentActivity().startActivityForResult(intent, 500);
|
|
|
|
} catch (Exception e) {
|
|
|
|
alertUserOpenError(message);
|
|
|
|
}
|
|
|
|
} else if (message.type == 4) {
|
|
|
|
if (!AndroidUtilities.isGoogleMapsInstalled(ChannelAdminLogActivity.this)) {
|
|
|
|
return;
|
|
|
|
}
|
2017-12-08 18:35:59 +01:00
|
|
|
LocationActivity fragment = new LocationActivity(0);
|
2017-07-08 18:32:04 +02:00
|
|
|
fragment.setMessageObject(message);
|
|
|
|
presentFragment(fragment);
|
|
|
|
} else if (message.type == 9 || message.type == 0) {
|
2018-07-30 04:07:02 +02:00
|
|
|
if (message.getDocumentName().toLowerCase().endsWith("attheme")) {
|
2017-07-08 18:32:04 +02:00
|
|
|
File locFile = null;
|
|
|
|
if (message.messageOwner.attachPath != null && message.messageOwner.attachPath.length() != 0) {
|
|
|
|
File f = new File(message.messageOwner.attachPath);
|
|
|
|
if (f.exists()) {
|
|
|
|
locFile = f;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (locFile == null) {
|
|
|
|
File f = FileLoader.getPathToMessage(message.messageOwner);
|
|
|
|
if (f.exists()) {
|
|
|
|
locFile = f;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (chatLayoutManager != null) {
|
|
|
|
int lastPosition = chatLayoutManager.findLastVisibleItemPosition();
|
|
|
|
if (lastPosition < chatLayoutManager.getItemCount() - 1) {
|
|
|
|
scrollToPositionOnRecreate = chatLayoutManager.findFirstVisibleItemPosition();
|
|
|
|
RecyclerListView.Holder holder = (RecyclerListView.Holder) chatListView.findViewHolderForAdapterPosition(scrollToPositionOnRecreate);
|
|
|
|
if (holder != null) {
|
|
|
|
scrollToOffsetOnRecreate = holder.itemView.getTop();
|
|
|
|
} else {
|
|
|
|
scrollToPositionOnRecreate = -1;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
scrollToPositionOnRecreate = -1;
|
|
|
|
}
|
|
|
|
}
|
2019-09-10 12:56:11 +02:00
|
|
|
Theme.ThemeInfo themeInfo = Theme.applyThemeFile(locFile, message.getDocumentName(), null, true);
|
2017-07-08 18:32:04 +02:00
|
|
|
if (themeInfo != null) {
|
2019-09-10 12:56:11 +02:00
|
|
|
presentFragment(new ThemePreviewActivity(themeInfo));
|
2017-07-08 18:32:04 +02:00
|
|
|
return;
|
|
|
|
} else {
|
|
|
|
scrollToPositionOnRecreate = -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
try {
|
|
|
|
AndroidUtilities.openForView(message, getParentActivity());
|
|
|
|
} catch (Exception e) {
|
|
|
|
alertUserOpenError(message);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2019-01-23 18:03:33 +01:00
|
|
|
public void didPressInstantButton(ChatMessageCell cell, int type) {
|
2017-07-08 18:32:04 +02:00
|
|
|
MessageObject messageObject = cell.getMessageObject();
|
|
|
|
if (type == 0) {
|
|
|
|
if (messageObject.messageOwner.media != null && messageObject.messageOwner.media.webpage != null && messageObject.messageOwner.media.webpage.cached_page != null) {
|
|
|
|
ArticleViewer.getInstance().setParentActivity(getParentActivity(), ChannelAdminLogActivity.this);
|
|
|
|
ArticleViewer.getInstance().open(messageObject);
|
|
|
|
}
|
2018-07-30 04:07:02 +02:00
|
|
|
} else if (type == 5) {
|
2019-12-31 14:08:08 +01:00
|
|
|
openVCard(getMessagesController().getUser(messageObject.messageOwner.media.user_id), messageObject.messageOwner.media.vcard, messageObject.messageOwner.media.first_name, messageObject.messageOwner.media.last_name);
|
2017-07-08 18:32:04 +02:00
|
|
|
} else {
|
2018-07-30 04:07:02 +02:00
|
|
|
if (messageObject.messageOwner.media != null && messageObject.messageOwner.media.webpage != null) {
|
|
|
|
Browser.openUrl(getParentActivity(), messageObject.messageOwner.media.webpage.url);
|
|
|
|
}
|
2017-07-08 18:32:04 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
chatMessageCell.setAllowAssistant(true);
|
|
|
|
} else if (viewType == 1) {
|
2020-07-26 10:03:38 +02:00
|
|
|
view = new ChatActionCell(mContext) {
|
|
|
|
@Override
|
|
|
|
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
|
|
|
|
super.onInitializeAccessibilityNodeInfo(info);
|
|
|
|
// if alpha == 0, then visibleToUser == false, so we need to override it
|
|
|
|
// to keep accessibility working correctly
|
|
|
|
info.setVisibleToUser(true);
|
|
|
|
}
|
|
|
|
};
|
2017-07-08 18:32:04 +02:00
|
|
|
((ChatActionCell) view).setDelegate(new ChatActionCell.ChatActionCellDelegate() {
|
|
|
|
@Override
|
2019-05-14 14:08:05 +02:00
|
|
|
public void didClickImage(ChatActionCell cell) {
|
2017-07-08 18:32:04 +02:00
|
|
|
MessageObject message = cell.getMessageObject();
|
|
|
|
PhotoViewer.getInstance().setParentActivity(getParentActivity());
|
|
|
|
TLRPC.PhotoSize photoSize = FileLoader.getClosestPhotoSizeWithSize(message.photoThumbs, 640);
|
|
|
|
if (photoSize != null) {
|
2020-01-23 07:15:40 +01:00
|
|
|
ImageLocation imageLocation = ImageLocation.getForPhoto(photoSize, message.messageOwner.action.photo);
|
|
|
|
PhotoViewer.getInstance().openPhoto(photoSize.location, imageLocation, provider);
|
2017-07-08 18:32:04 +02:00
|
|
|
} else {
|
2020-09-30 15:48:47 +02:00
|
|
|
PhotoViewer.getInstance().openPhoto(message, null, 0, 0, provider);
|
2017-07-08 18:32:04 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2019-05-14 14:08:05 +02:00
|
|
|
public void didLongPress(ChatActionCell cell, float x, float y) {
|
2017-07-08 18:32:04 +02:00
|
|
|
createMenu(cell);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void needOpenUserProfile(int uid) {
|
|
|
|
if (uid < 0) {
|
|
|
|
Bundle args = new Bundle();
|
|
|
|
args.putInt("chat_id", -uid);
|
2018-07-30 04:07:02 +02:00
|
|
|
if (MessagesController.getInstance(currentAccount).checkCanOpenChat(args, ChannelAdminLogActivity.this)) {
|
2017-07-08 18:32:04 +02:00
|
|
|
presentFragment(new ChatActivity(args), true);
|
|
|
|
}
|
2018-07-30 04:07:02 +02:00
|
|
|
} else if (uid != UserConfig.getInstance(currentAccount).getClientUserId()) {
|
2017-07-08 18:32:04 +02:00
|
|
|
Bundle args = new Bundle();
|
|
|
|
args.putInt("user_id", uid);
|
|
|
|
addCanBanUser(args, uid);
|
|
|
|
ProfileActivity fragment = new ProfileActivity(args);
|
2020-02-13 19:26:53 +01:00
|
|
|
fragment.setPlayProfileAnimation(0);
|
2017-07-08 18:32:04 +02:00
|
|
|
presentFragment(fragment);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-02-23 12:53:38 +01:00
|
|
|
public void needOpenInviteLink(TLRPC.TL_chatInviteExported invite) {
|
|
|
|
TLRPC.ChatFull chatInfo = getMessagesController().getChatFull(currentChat.id);
|
|
|
|
InviteLinkBottomSheet inviteLinkBottomSheet = new InviteLinkBottomSheet(contentView.getContext(), invite, chatInfo, null, ChannelAdminLogActivity.this, chatInfo.id, false, ChatObject.isChannel(currentChat));
|
|
|
|
inviteLinkBottomSheet.show();
|
|
|
|
}
|
|
|
|
|
2017-07-08 18:32:04 +02:00
|
|
|
@Override
|
2019-05-14 14:08:05 +02:00
|
|
|
public void didPressReplyMessage(ChatActionCell cell, int id) {
|
2017-07-08 18:32:04 +02:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2019-05-14 14:08:05 +02:00
|
|
|
public void didPressBotButton(MessageObject messageObject, TLRPC.KeyboardButton button) {
|
2017-07-08 18:32:04 +02:00
|
|
|
|
|
|
|
}
|
|
|
|
});
|
|
|
|
} else if (viewType == 2) {
|
|
|
|
view = new ChatUnreadCell(mContext);
|
|
|
|
} else if (viewType == 4) {
|
|
|
|
view = new ChatLoadingCell(mContext);
|
|
|
|
}
|
|
|
|
view.setLayoutParams(new RecyclerView.LayoutParams(RecyclerView.LayoutParams.MATCH_PARENT, RecyclerView.LayoutParams.WRAP_CONTENT));
|
|
|
|
return new RecyclerListView.Holder(view);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
|
|
|
|
if (position == loadingUpRow) {
|
|
|
|
ChatLoadingCell loadingCell = (ChatLoadingCell) holder.itemView;
|
|
|
|
loadingCell.setProgressVisible(loadsCount > 1);
|
|
|
|
} else if (position >= messagesStartRow && position < messagesEndRow) {
|
|
|
|
MessageObject message = messages.get(messages.size() - (position - messagesStartRow) - 1);
|
|
|
|
View view = holder.itemView;
|
|
|
|
|
|
|
|
if (view instanceof ChatMessageCell) {
|
|
|
|
final ChatMessageCell messageCell = (ChatMessageCell) view;
|
|
|
|
messageCell.isChat = true;
|
|
|
|
int nextType = getItemViewType(position + 1);
|
|
|
|
int prevType = getItemViewType(position - 1);
|
|
|
|
boolean pinnedBotton;
|
|
|
|
boolean pinnedTop;
|
|
|
|
if (!(message.messageOwner.reply_markup instanceof TLRPC.TL_replyInlineMarkup) && nextType == holder.getItemViewType()) {
|
|
|
|
MessageObject nextMessage = messages.get(messages.size() - (position + 1 - messagesStartRow) - 1);
|
2020-09-30 15:48:47 +02:00
|
|
|
pinnedBotton = nextMessage.isOutOwner() == message.isOutOwner() && (nextMessage.getFromChatId() == message.getFromChatId()) && Math.abs(nextMessage.messageOwner.date - message.messageOwner.date) <= 5 * 60;
|
2017-07-08 18:32:04 +02:00
|
|
|
} else {
|
|
|
|
pinnedBotton = false;
|
|
|
|
}
|
|
|
|
if (prevType == holder.getItemViewType()) {
|
|
|
|
MessageObject prevMessage = messages.get(messages.size() - (position - messagesStartRow));
|
2020-09-30 15:48:47 +02:00
|
|
|
pinnedTop = !(prevMessage.messageOwner.reply_markup instanceof TLRPC.TL_replyInlineMarkup) && prevMessage.isOutOwner() == message.isOutOwner() && (prevMessage.getFromChatId() == message.getFromChatId()) && Math.abs(prevMessage.messageOwner.date - message.messageOwner.date) <= 5 * 60;
|
2017-07-08 18:32:04 +02:00
|
|
|
} else {
|
|
|
|
pinnedTop = false;
|
|
|
|
}
|
2017-12-08 18:35:59 +01:00
|
|
|
messageCell.setMessageObject(message, null, pinnedBotton, pinnedTop);
|
2017-07-08 18:32:04 +02:00
|
|
|
messageCell.setHighlighted(false);
|
|
|
|
messageCell.setHighlightedText(null);
|
|
|
|
} else if (view instanceof ChatActionCell) {
|
|
|
|
ChatActionCell actionCell = (ChatActionCell) view;
|
|
|
|
actionCell.setMessageObject(message);
|
|
|
|
actionCell.setAlpha(1.0f);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public int getItemViewType(int position) {
|
|
|
|
if (position >= messagesStartRow && position < messagesEndRow) {
|
|
|
|
return messages.get(messages.size() - (position - messagesStartRow) - 1).contentType;
|
|
|
|
}
|
|
|
|
return 4;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onViewAttachedToWindow(RecyclerView.ViewHolder holder) {
|
|
|
|
if (holder.itemView instanceof ChatMessageCell) {
|
|
|
|
final ChatMessageCell messageCell = (ChatMessageCell) holder.itemView;
|
|
|
|
MessageObject message = messageCell.getMessageObject();
|
|
|
|
|
|
|
|
boolean selected = false;
|
|
|
|
boolean disableSelection = false;
|
|
|
|
messageCell.setBackgroundDrawable(null);
|
|
|
|
messageCell.setCheckPressed(!disableSelection, disableSelection && selected);
|
|
|
|
|
|
|
|
messageCell.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
|
|
|
|
@Override
|
|
|
|
public boolean onPreDraw() {
|
|
|
|
messageCell.getViewTreeObserver().removeOnPreDrawListener(this);
|
|
|
|
|
|
|
|
int height = chatListView.getMeasuredHeight();
|
|
|
|
int top = messageCell.getTop();
|
|
|
|
int bottom = messageCell.getBottom();
|
|
|
|
int viewTop = top >= 0 ? 0 : -top;
|
|
|
|
int viewBottom = messageCell.getMeasuredHeight();
|
|
|
|
if (viewBottom > height) {
|
|
|
|
viewBottom = viewTop + height;
|
|
|
|
}
|
2020-09-30 15:48:47 +02:00
|
|
|
messageCell.setVisiblePart(viewTop, viewBottom - viewTop, contentView.getHeightWithKeyboard() - AndroidUtilities.dp(48) - chatListView.getTop(), 0);
|
2017-07-08 18:32:04 +02:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
messageCell.setHighlighted(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public void updateRowWithMessageObject(MessageObject messageObject) {
|
|
|
|
int index = messages.indexOf(messageObject);
|
|
|
|
if (index == -1) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
notifyItemChanged(messagesStartRow + messages.size() - index - 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void notifyDataSetChanged() {
|
|
|
|
updateRows();
|
|
|
|
try {
|
|
|
|
super.notifyDataSetChanged();
|
|
|
|
} catch (Exception e) {
|
|
|
|
FileLog.e(e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void notifyItemChanged(int position) {
|
|
|
|
updateRows();
|
|
|
|
try {
|
|
|
|
super.notifyItemChanged(position);
|
|
|
|
} catch (Exception e) {
|
|
|
|
FileLog.e(e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void notifyItemRangeChanged(int positionStart, int itemCount) {
|
|
|
|
updateRows();
|
|
|
|
try {
|
|
|
|
super.notifyItemRangeChanged(positionStart, itemCount);
|
|
|
|
} catch (Exception e) {
|
|
|
|
FileLog.e(e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void notifyItemInserted(int position) {
|
|
|
|
updateRows();
|
|
|
|
try {
|
|
|
|
super.notifyItemInserted(position);
|
|
|
|
} catch (Exception e) {
|
|
|
|
FileLog.e(e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void notifyItemMoved(int fromPosition, int toPosition) {
|
|
|
|
updateRows();
|
|
|
|
try {
|
|
|
|
super.notifyItemMoved(fromPosition, toPosition);
|
|
|
|
} catch (Exception e) {
|
|
|
|
FileLog.e(e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void notifyItemRangeInserted(int positionStart, int itemCount) {
|
|
|
|
updateRows();
|
|
|
|
try {
|
|
|
|
super.notifyItemRangeInserted(positionStart, itemCount);
|
|
|
|
} catch (Exception e) {
|
|
|
|
FileLog.e(e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void notifyItemRemoved(int position) {
|
|
|
|
updateRows();
|
|
|
|
try {
|
|
|
|
super.notifyItemRemoved(position);
|
|
|
|
} catch (Exception e) {
|
|
|
|
FileLog.e(e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void notifyItemRangeRemoved(int positionStart, int itemCount) {
|
|
|
|
updateRows();
|
|
|
|
try {
|
|
|
|
super.notifyItemRangeRemoved(positionStart, itemCount);
|
|
|
|
} catch (Exception e) {
|
|
|
|
FileLog.e(e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2020-04-24 11:21:58 +02:00
|
|
|
public ArrayList<ThemeDescription> getThemeDescriptions() {
|
|
|
|
ArrayList<ThemeDescription> themeDescriptions = new ArrayList<>();
|
|
|
|
|
|
|
|
themeDescriptions.add(new ThemeDescription(fragmentView, 0, null, null, null, null, Theme.key_chat_wallpaper));
|
|
|
|
|
|
|
|
themeDescriptions.add(new ThemeDescription(actionBar, ThemeDescription.FLAG_BACKGROUND, null, null, null, null, Theme.key_actionBarDefault));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, ThemeDescription.FLAG_LISTGLOWCOLOR, null, null, null, null, Theme.key_actionBarDefault));
|
|
|
|
themeDescriptions.add(new ThemeDescription(actionBar, ThemeDescription.FLAG_AB_ITEMSCOLOR, null, null, null, null, Theme.key_actionBarDefaultIcon));
|
|
|
|
themeDescriptions.add(new ThemeDescription(actionBar, ThemeDescription.FLAG_AB_SELECTORCOLOR, null, null, null, null, Theme.key_actionBarDefaultSelector));
|
|
|
|
themeDescriptions.add(new ThemeDescription(actionBar, ThemeDescription.FLAG_AB_SUBMENUBACKGROUND, null, null, null, null, Theme.key_actionBarDefaultSubmenuBackground));
|
|
|
|
themeDescriptions.add(new ThemeDescription(actionBar, ThemeDescription.FLAG_AB_SUBMENUITEM, null, null, null, null, Theme.key_actionBarDefaultSubmenuItem));
|
|
|
|
themeDescriptions.add(new ThemeDescription(actionBar, ThemeDescription.FLAG_AB_SUBMENUITEM | ThemeDescription.FLAG_IMAGECOLOR, null, null, null, null, Theme.key_actionBarDefaultSubmenuItemIcon));
|
|
|
|
|
|
|
|
themeDescriptions.add(new ThemeDescription(actionBar, ThemeDescription.FLAG_BACKGROUND, null, null, null, null, Theme.key_actionBarDefault));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, ThemeDescription.FLAG_LISTGLOWCOLOR, null, null, null, null, Theme.key_actionBarDefault));
|
|
|
|
themeDescriptions.add(new ThemeDescription(actionBar, ThemeDescription.FLAG_AB_ITEMSCOLOR, null, null, null, null, Theme.key_actionBarDefaultIcon));
|
|
|
|
themeDescriptions.add(new ThemeDescription(avatarContainer.getTitleTextView(), ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_actionBarDefaultTitle));
|
|
|
|
themeDescriptions.add(new ThemeDescription(avatarContainer.getSubtitleTextView(), ThemeDescription.FLAG_TEXTCOLOR, null, new Paint[]{Theme.chat_statusPaint, Theme.chat_statusRecordPaint}, null, null, Theme.key_actionBarDefaultSubtitle, null));
|
|
|
|
themeDescriptions.add(new ThemeDescription(actionBar, ThemeDescription.FLAG_AB_SELECTORCOLOR, null, null, null, null, Theme.key_actionBarDefaultSelector));
|
|
|
|
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, Theme.avatarDrawables, null, Theme.key_avatar_text));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_avatar_backgroundRed));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_avatar_backgroundOrange));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_avatar_backgroundViolet));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_avatar_backgroundGreen));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_avatar_backgroundCyan));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_avatar_backgroundBlue));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_avatar_backgroundPink));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_avatar_nameInMessageRed));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_avatar_nameInMessageOrange));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_avatar_nameInMessageViolet));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_avatar_nameInMessageGreen));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_avatar_nameInMessageCyan));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_avatar_nameInMessageBlue));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_avatar_nameInMessagePink));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_msgInDrawable, Theme.chat_msgInMediaDrawable}, null, Theme.key_chat_inBubble));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_msgInSelectedDrawable, Theme.chat_msgInMediaSelectedDrawable}, null, Theme.key_chat_inBubbleSelected));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, Theme.chat_msgInDrawable.getShadowDrawables(), null, Theme.key_chat_inBubbleShadow));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, Theme.chat_msgInMediaDrawable.getShadowDrawables(), null, Theme.key_chat_inBubbleShadow));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, Theme.chat_msgOutDrawable.getShadowDrawables(), null, Theme.key_chat_outBubbleShadow));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, Theme.chat_msgOutMediaDrawable.getShadowDrawables(), null, Theme.key_chat_outBubbleShadow));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_msgOutDrawable, Theme.chat_msgOutMediaDrawable}, null, Theme.key_chat_outBubble));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_msgOutDrawable, Theme.chat_msgOutMediaDrawable}, null, Theme.key_chat_outBubbleGradient));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_msgOutSelectedDrawable, Theme.chat_msgOutMediaSelectedDrawable}, null, Theme.key_chat_outBubbleSelected));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, ThemeDescription.FLAG_TEXTCOLOR, new Class[]{ChatActionCell.class}, Theme.chat_actionTextPaint, null, null, Theme.key_chat_serviceText));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, ThemeDescription.FLAG_LINKCOLOR, new Class[]{ChatActionCell.class}, Theme.chat_actionTextPaint, null, null, Theme.key_chat_serviceLink));
|
|
|
|
|
2020-09-30 15:48:47 +02:00
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_shareIconDrawable, Theme.chat_botInlineDrawable, Theme.chat_botLinkDrawalbe, Theme.chat_goIconDrawable, Theme.chat_commentStickerDrawable}, null, Theme.key_chat_serviceIcon));
|
2020-04-24 11:21:58 +02:00
|
|
|
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class, ChatActionCell.class}, null, null, null, Theme.key_chat_serviceBackground));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class, ChatActionCell.class}, null, null, null, Theme.key_chat_serviceBackgroundSelected));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_messageTextIn));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_messageTextOut));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, ThemeDescription.FLAG_LINKCOLOR, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_messageLinkIn, null));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, ThemeDescription.FLAG_LINKCOLOR, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_messageLinkOut, null));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_msgOutCheckDrawable}, null, Theme.key_chat_outSentCheck));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_msgOutCheckSelectedDrawable}, null, Theme.key_chat_outSentCheckSelected));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_msgOutCheckReadDrawable, Theme.chat_msgOutHalfCheckDrawable}, null, Theme.key_chat_outSentCheckRead));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_msgOutCheckReadSelectedDrawable, Theme.chat_msgOutHalfCheckSelectedDrawable}, null, Theme.key_chat_outSentCheckReadSelected));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_msgOutClockDrawable}, null, Theme.key_chat_outSentClock));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_msgOutSelectedClockDrawable}, null, Theme.key_chat_outSentClockSelected));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_msgInClockDrawable}, null, Theme.key_chat_inSentClock));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_msgInSelectedClockDrawable}, null, Theme.key_chat_inSentClockSelected));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_msgMediaCheckDrawable, Theme.chat_msgMediaHalfCheckDrawable}, null, Theme.key_chat_mediaSentCheck));
|
2020-10-30 11:26:29 +01:00
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_msgStickerHalfCheckDrawable, Theme.chat_msgStickerCheckDrawable, Theme.chat_msgStickerClockDrawable, Theme.chat_msgStickerViewsDrawable, Theme.chat_msgStickerRepliesDrawable, Theme.chat_msgStickerPinnedDrawable}, null, Theme.key_chat_serviceText));
|
2020-04-24 11:21:58 +02:00
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_msgMediaClockDrawable}, null, Theme.key_chat_mediaSentClock));
|
2020-10-30 11:26:29 +01:00
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_msgOutViewsDrawable, Theme.chat_msgOutRepliesDrawable, Theme.chat_msgOutPinnedDrawable}, null, Theme.key_chat_outViews));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_msgOutViewsSelectedDrawable, Theme.chat_msgOutRepliesSelectedDrawable, Theme.chat_msgOutPinnedSelectedDrawable}, null, Theme.key_chat_outViewsSelected));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_msgInViewsDrawable, Theme.chat_msgInRepliesDrawable, Theme.chat_msgInPinnedDrawable}, null, Theme.key_chat_inViews));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_msgInViewsSelectedDrawable, Theme.chat_msgInRepliesSelectedDrawable, Theme.chat_msgInPinnedSelectedDrawable}, null, Theme.key_chat_inViewsSelected));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_msgMediaViewsDrawable, Theme.chat_msgMediaRepliesDrawable, Theme.chat_msgMediaPinnedDrawable}, null, Theme.key_chat_mediaViews));
|
2020-04-24 11:21:58 +02:00
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_msgOutMenuDrawable}, null, Theme.key_chat_outMenu));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_msgOutMenuSelectedDrawable}, null, Theme.key_chat_outMenuSelected));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_msgInMenuDrawable}, null, Theme.key_chat_inMenu));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_msgInMenuSelectedDrawable}, null, Theme.key_chat_inMenuSelected));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_msgMediaMenuDrawable}, null, Theme.key_chat_mediaMenu));
|
2020-08-14 18:58:22 +02:00
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_msgOutInstantDrawable}, null, Theme.key_chat_outInstant));
|
2020-09-30 15:48:47 +02:00
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_msgInInstantDrawable, Theme.chat_commentDrawable, Theme.chat_commentArrowDrawable}, null, Theme.key_chat_inInstant));
|
2020-08-14 18:58:22 +02:00
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, Theme.chat_msgOutCallDrawable, null, Theme.key_chat_outInstant));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, Theme.chat_msgOutCallSelectedDrawable, null, Theme.key_chat_outInstantSelected));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, Theme.chat_msgInCallDrawable, null, Theme.key_chat_inInstant));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, Theme.chat_msgInCallSelectedDrawable, null, Theme.key_chat_inInstantSelected));
|
2020-04-24 11:21:58 +02:00
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_msgCallUpGreenDrawable}, null, Theme.key_chat_outGreenCall));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_msgCallDownRedDrawable}, null, Theme.key_chat_inRedCall));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_msgCallDownGreenDrawable}, null, Theme.key_chat_inGreenCall));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, Theme.chat_msgErrorPaint, null, null, Theme.key_chat_sentError));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_msgErrorDrawable}, null, Theme.key_chat_sentErrorIcon));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, Theme.chat_durationPaint, null, null, Theme.key_chat_previewDurationText));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, Theme.chat_gamePaint, null, null, Theme.key_chat_previewGameText));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inPreviewInstantText));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outPreviewInstantText));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inPreviewInstantSelectedText));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outPreviewInstantSelectedText));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, Theme.chat_deleteProgressPaint, null, null, Theme.key_chat_secretTimeText));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_stickerNameText));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, Theme.chat_botButtonPaint, null, null, Theme.key_chat_botButtonText));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, Theme.chat_botProgressPaint, null, null, Theme.key_chat_botProgress));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inForwardedNameText));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outForwardedNameText));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inViaBotNameText));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outViaBotNameText));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_stickerViaBotNameText));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inReplyLine));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outReplyLine));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_stickerReplyLine));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inReplyNameText));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outReplyNameText));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_stickerReplyNameText));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inReplyMessageText));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outReplyMessageText));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inReplyMediaMessageText));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outReplyMediaMessageText));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inReplyMediaMessageSelectedText));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outReplyMediaMessageSelectedText));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_stickerReplyMessageText));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inPreviewLine));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outPreviewLine));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inSiteNameText));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outSiteNameText));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inContactNameText));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outContactNameText));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inContactPhoneText));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outContactPhoneText));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_mediaProgress));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inAudioProgress));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outAudioProgress));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inAudioSelectedProgress));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outAudioSelectedProgress));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_mediaTimeText));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inTimeText));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outTimeText));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inTimeSelectedText));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outTimeSelectedText));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inAudioPerformerText));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outAudioPerformerText));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inAudioTitleText));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outAudioTitleText));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inAudioDurationText));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outAudioDurationText));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inAudioDurationSelectedText));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outAudioDurationSelectedText));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inAudioSeekbar));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outAudioSeekbar));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inAudioSeekbarSelected));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outAudioSeekbarSelected));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inAudioSeekbarFill));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inAudioCacheSeekbar));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outAudioSeekbarFill));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outAudioCacheSeekbar));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inVoiceSeekbar));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outVoiceSeekbar));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inVoiceSeekbarSelected));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outVoiceSeekbarSelected));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inVoiceSeekbarFill));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outVoiceSeekbarFill));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inFileProgress));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outFileProgress));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inFileProgressSelected));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outFileProgressSelected));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inFileNameText));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outFileNameText));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inFileInfoText));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outFileInfoText));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inFileInfoSelectedText));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outFileInfoSelectedText));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inFileBackground));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outFileBackground));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inFileBackgroundSelected));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outFileBackgroundSelected));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inVenueInfoText));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outVenueInfoText));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inVenueInfoSelectedText));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outVenueInfoSelectedText));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_mediaInfoText));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, Theme.chat_urlPaint, null, null, Theme.key_chat_linkSelectBackground));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, Theme.chat_textSearchSelectionPaint, null, null, Theme.key_chat_textSelectBackground));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outLoader));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outMediaIcon));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outLoaderSelected));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outMediaIconSelected));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inLoader));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inMediaIcon));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inLoaderSelected));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inMediaIconSelected));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, ThemeDescription.FLAG_BACKGROUNDFILTER, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_photoStatesDrawables[0][0], Theme.chat_photoStatesDrawables[1][0], Theme.chat_photoStatesDrawables[2][0], Theme.chat_photoStatesDrawables[3][0]}, null, Theme.key_chat_mediaLoaderPhoto));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_photoStatesDrawables[0][0], Theme.chat_photoStatesDrawables[1][0], Theme.chat_photoStatesDrawables[2][0], Theme.chat_photoStatesDrawables[3][0]}, null, Theme.key_chat_mediaLoaderPhotoIcon));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, ThemeDescription.FLAG_BACKGROUNDFILTER, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_photoStatesDrawables[0][1], Theme.chat_photoStatesDrawables[1][1], Theme.chat_photoStatesDrawables[2][1], Theme.chat_photoStatesDrawables[3][1]}, null, Theme.key_chat_mediaLoaderPhotoSelected));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_photoStatesDrawables[0][1], Theme.chat_photoStatesDrawables[1][1], Theme.chat_photoStatesDrawables[2][1], Theme.chat_photoStatesDrawables[3][1]}, null, Theme.key_chat_mediaLoaderPhotoIconSelected));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, ThemeDescription.FLAG_BACKGROUNDFILTER, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_photoStatesDrawables[7][0], Theme.chat_photoStatesDrawables[8][0]}, null, Theme.key_chat_outLoaderPhoto));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_photoStatesDrawables[7][0], Theme.chat_photoStatesDrawables[8][0]}, null, Theme.key_chat_outLoaderPhotoIcon));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, ThemeDescription.FLAG_BACKGROUNDFILTER, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_photoStatesDrawables[7][1], Theme.chat_photoStatesDrawables[8][1]}, null, Theme.key_chat_outLoaderPhotoSelected));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_photoStatesDrawables[7][1], Theme.chat_photoStatesDrawables[8][1]}, null, Theme.key_chat_outLoaderPhotoIconSelected));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, ThemeDescription.FLAG_BACKGROUNDFILTER, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_photoStatesDrawables[10][0], Theme.chat_photoStatesDrawables[11][0]}, null, Theme.key_chat_inLoaderPhoto));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_photoStatesDrawables[10][0], Theme.chat_photoStatesDrawables[11][0]}, null, Theme.key_chat_inLoaderPhotoIcon));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, ThemeDescription.FLAG_BACKGROUNDFILTER, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_photoStatesDrawables[10][1], Theme.chat_photoStatesDrawables[11][1]}, null, Theme.key_chat_inLoaderPhotoSelected));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_photoStatesDrawables[10][1], Theme.chat_photoStatesDrawables[11][1]}, null, Theme.key_chat_inLoaderPhotoIconSelected));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_photoStatesDrawables[9][0]}, null, Theme.key_chat_outFileIcon));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_photoStatesDrawables[9][1]}, null, Theme.key_chat_outFileSelectedIcon));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_photoStatesDrawables[12][0]}, null, Theme.key_chat_inFileIcon));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_photoStatesDrawables[12][1]}, null, Theme.key_chat_inFileSelectedIcon));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, ThemeDescription.FLAG_BACKGROUNDFILTER, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_contactDrawable[0]}, null, Theme.key_chat_inContactBackground));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_contactDrawable[0]}, null, Theme.key_chat_inContactIcon));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, ThemeDescription.FLAG_BACKGROUNDFILTER, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_contactDrawable[1]}, null, Theme.key_chat_outContactBackground));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_contactDrawable[1]}, null, Theme.key_chat_outContactIcon));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inLocationBackground));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_locationDrawable[0]}, null, Theme.key_chat_inLocationIcon));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outLocationBackground));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_locationDrawable[1]}, null, Theme.key_chat_outLocationIcon));
|
|
|
|
|
|
|
|
themeDescriptions.add(new ThemeDescription(bottomOverlayChat, 0, null, Theme.chat_composeBackgroundPaint, null, null, Theme.key_chat_messagePanelBackground));
|
|
|
|
themeDescriptions.add(new ThemeDescription(bottomOverlayChat, 0, null, null, new Drawable[]{Theme.chat_composeShadowDrawable}, null, Theme.key_chat_messagePanelShadow));
|
|
|
|
|
|
|
|
themeDescriptions.add(new ThemeDescription(bottomOverlayChatText, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_chat_fieldOverlayText));
|
|
|
|
|
|
|
|
themeDescriptions.add(new ThemeDescription(emptyView, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_chat_serviceText));
|
|
|
|
|
|
|
|
themeDescriptions.add(new ThemeDescription(progressBar, ThemeDescription.FLAG_PROGRESSBAR, null, null, null, null, Theme.key_chat_serviceText));
|
|
|
|
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, ThemeDescription.FLAG_USEBACKGROUNDDRAWABLE, new Class[]{ChatUnreadCell.class}, new String[]{"backgroundLayout"}, null, null, null, Theme.key_chat_unreadMessagesStartBackground));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, ThemeDescription.FLAG_IMAGECOLOR, new Class[]{ChatUnreadCell.class}, new String[]{"imageView"}, null, null, null, Theme.key_chat_unreadMessagesStartArrowIcon));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, ThemeDescription.FLAG_TEXTCOLOR, new Class[]{ChatUnreadCell.class}, new String[]{"textView"}, null, null, null, Theme.key_chat_unreadMessagesStartText));
|
|
|
|
|
|
|
|
themeDescriptions.add(new ThemeDescription(progressView2, ThemeDescription.FLAG_SERVICEBACKGROUND, null, null, null, null, Theme.key_chat_serviceBackground));
|
|
|
|
themeDescriptions.add(new ThemeDescription(emptyView, ThemeDescription.FLAG_SERVICEBACKGROUND, null, null, null, null, Theme.key_chat_serviceBackground));
|
|
|
|
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, ThemeDescription.FLAG_SERVICEBACKGROUND, new Class[]{ChatLoadingCell.class}, new String[]{"textView"}, null, null, null, Theme.key_chat_serviceBackground));
|
|
|
|
themeDescriptions.add(new ThemeDescription(chatListView, ThemeDescription.FLAG_PROGRESSBAR, new Class[]{ChatLoadingCell.class}, new String[]{"textView"}, null, null, null, Theme.key_chat_serviceText));
|
|
|
|
|
|
|
|
themeDescriptions.add(new ThemeDescription(avatarContainer != null ? avatarContainer.getTimeItem() : null, 0, null, null, null, null, Theme.key_chat_secretTimerBackground));
|
|
|
|
themeDescriptions.add(new ThemeDescription(avatarContainer != null ? avatarContainer.getTimeItem() : null, 0, null, null, null, null, Theme.key_chat_secretTimerText));
|
2021-02-03 15:14:57 +01:00
|
|
|
|
2021-02-23 12:53:38 +01:00
|
|
|
themeDescriptions.add(new ThemeDescription(undoView, ThemeDescription.FLAG_BACKGROUNDFILTER, null, null, null, null, Theme.key_undo_background));
|
|
|
|
themeDescriptions.add(new ThemeDescription(undoView, 0, new Class[]{UndoView.class}, new String[]{"undoImageView"}, null, null, null, Theme.key_undo_cancelColor));
|
|
|
|
themeDescriptions.add(new ThemeDescription(undoView, 0, new Class[]{UndoView.class}, new String[]{"undoTextView"}, null, null, null, Theme.key_undo_cancelColor));
|
|
|
|
themeDescriptions.add(new ThemeDescription(undoView, 0, new Class[]{UndoView.class}, new String[]{"infoTextView"}, null, null, null, Theme.key_undo_infoColor));
|
|
|
|
themeDescriptions.add(new ThemeDescription(undoView, 0, new Class[]{UndoView.class}, new String[]{"textPaint"}, null, null, null, Theme.key_undo_infoColor));
|
|
|
|
themeDescriptions.add(new ThemeDescription(undoView, 0, new Class[]{UndoView.class}, new String[]{"progressPaint"}, null, null, null, Theme.key_undo_infoColor));
|
|
|
|
themeDescriptions.add(new ThemeDescription(undoView, ThemeDescription.FLAG_IMAGECOLOR, new Class[]{UndoView.class}, new String[]{"leftImageView"}, null, null, null, Theme.key_undo_infoColor));
|
2021-02-23 22:47:48 +01:00
|
|
|
|
2020-04-24 11:21:58 +02:00
|
|
|
return themeDescriptions;
|
2017-07-08 18:32:04 +02:00
|
|
|
}
|
|
|
|
}
|