mirror of
https://github.com/ArcaneChat/android.git
synced 2026-07-03 14:05:24 +02:00
Cleanup.
This commit is contained in:
@@ -17,7 +17,6 @@ public class TLRPC {
|
||||
public static final int MESSAGE_FLAG_REPLY = 0x00000008;
|
||||
public static final int MESSAGE_FLAG_HAS_FROM_ID = 0x00000100;
|
||||
public static final int MESSAGE_FLAG_HAS_MEDIA = 0x00000200;
|
||||
public static final int MESSAGE_FLAG_EDITED = 0x00008000;
|
||||
|
||||
public static class DraftMessage extends TLObject {
|
||||
public int flags;
|
||||
@@ -117,24 +116,6 @@ public class TLRPC {
|
||||
public static class TL_messageMediaWebPage extends MessageMedia {
|
||||
}
|
||||
|
||||
public static class BotInlineResult extends TLObject {
|
||||
public int flags;
|
||||
public String id;
|
||||
public String type;
|
||||
public String title;
|
||||
public String description;
|
||||
public String url;
|
||||
public String thumb_url;
|
||||
public String content_url;
|
||||
public String content_type;
|
||||
public int w;
|
||||
public int h;
|
||||
public int duration;
|
||||
public Photo photo;
|
||||
public Document document;
|
||||
}
|
||||
|
||||
|
||||
public static class PeerNotifySettings extends TLObject {
|
||||
public int flags;
|
||||
public boolean silent;
|
||||
@@ -237,7 +218,6 @@ public class TLRPC {
|
||||
public int flags;
|
||||
public boolean self;
|
||||
public boolean contact;
|
||||
public final boolean mutual_contact = false;
|
||||
public boolean min;
|
||||
}
|
||||
|
||||
@@ -422,11 +402,6 @@ public class TLRPC {
|
||||
public static class TL_photoEmpty extends Photo {
|
||||
}
|
||||
|
||||
public static class TL_contact extends TLObject {
|
||||
public int user_id;
|
||||
public boolean mutual;
|
||||
}
|
||||
|
||||
public static class ChatParticipants extends TLObject {
|
||||
public int flags;
|
||||
public int chat_id;
|
||||
@@ -587,12 +562,10 @@ public class TLRPC {
|
||||
public boolean media_unread;
|
||||
public boolean out;
|
||||
public boolean unread;
|
||||
public String via_bot_name;
|
||||
public int views;
|
||||
public boolean silent;
|
||||
public boolean post;
|
||||
public TL_messageFwdHeader fwd_from;
|
||||
public int via_bot_id;
|
||||
public int send_state = 0; //custom
|
||||
public String attachPath = ""; //custom
|
||||
public HashMap<String, String> params; //custom
|
||||
|
||||
@@ -1,212 +0,0 @@
|
||||
/*
|
||||
* This is the source code of Telegram for Android v. 3.x.x.
|
||||
* It is licensed under GNU GPL v. 2 or later.
|
||||
* You should have received a copy of the license in this archive (see LICENSE).
|
||||
*
|
||||
* Copyright Nikolai Kudashov, 2013-2016.
|
||||
*/
|
||||
|
||||
package com.b44t.ui.Adapters;
|
||||
|
||||
import com.b44t.messenger.ConnectionsManager;
|
||||
import com.b44t.messenger.TLObject;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class BaseSearchAdapter extends BaseFragmentAdapter {
|
||||
|
||||
protected static class HashtagObject {
|
||||
}
|
||||
|
||||
protected ArrayList<TLObject> globalSearch = new ArrayList<>();
|
||||
private int reqId = 0;
|
||||
protected String lastFoundUsername = null;
|
||||
|
||||
protected ArrayList<HashtagObject> hashtags;
|
||||
|
||||
public void queryServerSearch(final String query, final boolean allowChats, final boolean allowBots) {
|
||||
if (reqId != 0) {
|
||||
ConnectionsManager.getInstance().cancelRequest(reqId, true);
|
||||
reqId = 0;
|
||||
}
|
||||
if (query == null || query.length() < 5) {
|
||||
globalSearch.clear();
|
||||
notifyDataSetChanged();
|
||||
return;
|
||||
}
|
||||
/*TLRPC.TL_contacts_search req = new TLRPC.TL_contacts_search();
|
||||
req.q = query;
|
||||
req.limit = 50;*/
|
||||
/*final int currentReqId = ++lastReqId; */
|
||||
reqId = 0; /* ConnectionsManager.getInstance().sendRequest(req, new RequestDelegate() {
|
||||
@Override
|
||||
public void run(final TLObject response, final TLRPC.TL_error error) {
|
||||
AndroidUtilities.runOnUIThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (currentReqId == lastReqId) {
|
||||
if (error == null) {
|
||||
TLRPC.TL_contacts_found res = (TLRPC.TL_contacts_found) response;
|
||||
globalSearch.clear();
|
||||
if (allowChats) {
|
||||
for (int a = 0; a < res.chats.size(); a++) {
|
||||
globalSearch.add(res.chats.get(a));
|
||||
}
|
||||
}
|
||||
for (int a = 0; a < res.users.size(); a++) {
|
||||
if (!allowBots && res.users.get(a).bot) {
|
||||
continue;
|
||||
}
|
||||
globalSearch.add(res.users.get(a));
|
||||
}
|
||||
lastFoundUsername = query;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
reqId = 0;
|
||||
}
|
||||
});
|
||||
}
|
||||
}, ConnectionsManager.RequestFlagFailOnServerErrors);*/
|
||||
}
|
||||
|
||||
/*
|
||||
public void loadRecentHashtags() {
|
||||
MessagesStorage.getInstance().getStorageQueue().postRunnable(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
SQLiteCursor cursor = MessagesStorage.getInstance().getDatabase().queryFinalized("SELECT id, date FROM hashtag_recent_v2 WHERE 1");
|
||||
final ArrayList<HashtagObject> arrayList = new ArrayList<>();
|
||||
final HashMap<String, HashtagObject> hashMap = new HashMap<>();
|
||||
while (cursor.next()) {
|
||||
HashtagObject hashtagObject = new HashtagObject();
|
||||
hashtagObject.hashtag = cursor.stringValue(0);
|
||||
hashtagObject.date = cursor.intValue(1);
|
||||
arrayList.add(hashtagObject);
|
||||
hashMap.put(hashtagObject.hashtag, hashtagObject);
|
||||
}
|
||||
cursor.dispose();
|
||||
Collections.sort(arrayList, new Comparator<HashtagObject>() {
|
||||
@Override
|
||||
public int compare(HashtagObject lhs, HashtagObject rhs) {
|
||||
if (lhs.date < rhs.date) {
|
||||
return 1;
|
||||
} else if (lhs.date > rhs.date) {
|
||||
return -1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
});
|
||||
AndroidUtilities.runOnUIThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
setHashtags(arrayList, hashMap);
|
||||
}
|
||||
});
|
||||
} catch (Exception e) {
|
||||
FileLog.e("messenger", e);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
public void addHashtagsFromMessage(String message) {
|
||||
if (message == null) {
|
||||
return;
|
||||
}
|
||||
boolean changed = false;
|
||||
Pattern pattern = Pattern.compile("(^|\\s)#[\\w@\\.]+");
|
||||
Matcher matcher = pattern.matcher(message);
|
||||
while (matcher.find()) {
|
||||
int start = matcher.start();
|
||||
int end = matcher.end();
|
||||
if (message.charAt(start) != '@' && message.charAt(start) != '#') {
|
||||
start++;
|
||||
}
|
||||
String hashtag = message.substring(start, end);
|
||||
if (hashtagsByText == null) {
|
||||
hashtagsByText = new HashMap<>();
|
||||
hashtags = new ArrayList<>();
|
||||
}
|
||||
HashtagObject hashtagObject = hashtagsByText.get(hashtag);
|
||||
if (hashtagObject == null) {
|
||||
hashtagObject = new HashtagObject();
|
||||
hashtagObject.hashtag = hashtag;
|
||||
hashtagsByText.put(hashtagObject.hashtag, hashtagObject);
|
||||
} else {
|
||||
hashtags.remove(hashtagObject);
|
||||
}
|
||||
hashtagObject.date = (int) (System.currentTimeMillis() / 1000);
|
||||
hashtags.add(0, hashtagObject);
|
||||
changed = true;
|
||||
}
|
||||
if (changed) {
|
||||
putRecentHashtags(hashtags);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
private void putRecentHashtags(final ArrayList<HashtagObject> arrayList) {
|
||||
MessagesStorage.getInstance().getStorageQueue().postRunnable(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
MessagesStorage.getInstance().getDatabase().beginTransaction();
|
||||
SQLitePreparedStatement state = MessagesStorage.getInstance().getDatabase().executeFast("REPLACE INTO hashtag_recent_v2 VALUES(?, ?)");
|
||||
for (int a = 0; a < arrayList.size(); a++) {
|
||||
if (a == 100) {
|
||||
break;
|
||||
}
|
||||
HashtagObject hashtagObject = arrayList.get(a);
|
||||
state.requery();
|
||||
state.bindString(1, hashtagObject.hashtag);
|
||||
state.bindInteger(2, hashtagObject.date);
|
||||
state.step();
|
||||
}
|
||||
state.dispose();
|
||||
MessagesStorage.getInstance().getDatabase().commitTransaction();
|
||||
if (arrayList.size() >= 100) {
|
||||
MessagesStorage.getInstance().getDatabase().beginTransaction();
|
||||
for (int a = 100; a < arrayList.size(); a++) {
|
||||
MessagesStorage.getInstance().getDatabase().executeFast("DELETE FROM hashtag_recent_v2 WHERE id = '" + arrayList.get(a).hashtag + "'").stepThis().dispose();
|
||||
}
|
||||
MessagesStorage.getInstance().getDatabase().commitTransaction();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
FileLog.e("messenger", e);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
public void clearRecentHashtags() {
|
||||
hashtags = new ArrayList<>();
|
||||
hashtagsByText = new HashMap<>();
|
||||
MessagesStorage.getInstance().getStorageQueue().postRunnable(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
MessagesStorage.getInstance().getDatabase().executeFast("DELETE FROM hashtag_recent_v2 WHERE 1").stepThis().dispose();
|
||||
} catch (Exception e) {
|
||||
FileLog.e("messenger", e);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
protected void setHashtags(ArrayList<HashtagObject> arrayList, HashMap<String, HashtagObject> hashMap) {
|
||||
hashtags = arrayList;
|
||||
hashtagsByText = hashMap;
|
||||
hashtagsLoadedFromDb = true;
|
||||
}
|
||||
*/
|
||||
}
|
||||
@@ -75,50 +75,7 @@ public abstract class BaseSearchAdapterRecycler extends RecyclerView.Adapter {
|
||||
}, ConnectionsManager.RequestFlagFailOnServerErrors);*/
|
||||
}
|
||||
|
||||
public void loadRecentHashtags() {
|
||||
/*
|
||||
MessagesStorage.getInstance().getStorageQueue().postRunnable(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
SQLiteCursor cursor = MessagesStorage.getInstance().getDatabase().queryFinalized("SELECT id, date FROM hashtag_recent_v2 WHERE 1");
|
||||
final ArrayList<HashtagObject> arrayList = new ArrayList<>();
|
||||
final HashMap<String, HashtagObject> hashMap = new HashMap<>();
|
||||
while (cursor.next()) {
|
||||
HashtagObject hashtagObject = new HashtagObject();
|
||||
hashtagObject.hashtag = cursor.stringValue(0);
|
||||
hashtagObject.date = cursor.intValue(1);
|
||||
arrayList.add(hashtagObject);
|
||||
hashMap.put(hashtagObject.hashtag, hashtagObject);
|
||||
}
|
||||
cursor.dispose();
|
||||
Collections.sort(arrayList, new Comparator<HashtagObject>() {
|
||||
@Override
|
||||
public int compare(HashtagObject lhs, HashtagObject rhs) {
|
||||
if (lhs.date < rhs.date) {
|
||||
return 1;
|
||||
} else if (lhs.date > rhs.date) {
|
||||
return -1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
});
|
||||
AndroidUtilities.runOnUIThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
setHashtags(arrayList, hashMap);
|
||||
}
|
||||
});
|
||||
} catch (Exception e) {
|
||||
FileLog.e("messenger", e);
|
||||
}
|
||||
}
|
||||
});
|
||||
*/
|
||||
}
|
||||
|
||||
public void addHashtagsFromMessage(CharSequence message) {
|
||||
public void addHashtagsFromMessage(CharSequence message) {
|
||||
if (message == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -804,7 +804,6 @@ public class DialogsSearchAdapter extends BaseSearchAdapterRecycler {
|
||||
if (needMessagesSearch != 2 && (query.startsWith("#") && query.length() == 1)) {
|
||||
messagesSearchEndReached = true;
|
||||
if (!hashtagsLoadedFromDb) {
|
||||
loadRecentHashtags();
|
||||
if (delegate != null) {
|
||||
delegate.searchStateChanged(true);
|
||||
}
|
||||
|
||||
@@ -32,7 +32,6 @@ public class MentionsAdapter extends BaseSearchAdapterRecycler {
|
||||
|
||||
public interface MentionsAdapterDelegate {
|
||||
void needChangePanelVisibility(boolean show);
|
||||
void onContextClick(TLRPC.BotInlineResult result);
|
||||
}
|
||||
|
||||
public class Holder extends RecyclerView.ViewHolder {
|
||||
@@ -50,11 +49,7 @@ public class MentionsAdapter extends BaseSearchAdapterRecycler {
|
||||
private ArrayList<String> searchResultCommands;
|
||||
private ArrayList<String> searchResultCommandsHelp;
|
||||
private ArrayList<TLRPC.User> searchResultCommandsUsers;
|
||||
//private ArrayList<TLRPC.BotInlineResult> searchResultBotContext;
|
||||
//private TLRPC.TL_inlineBotSwitchPM searchResultBotContextSwitch;
|
||||
//private HashMap<String, TLRPC.BotInlineResult> searchResultBotContextById;
|
||||
private MentionsAdapterDelegate delegate;
|
||||
//private HashMap<Integer, TLRPC.BotInfo> botInfo;
|
||||
private int resultStartPosition;
|
||||
private boolean allowNewMentions = true;
|
||||
private int resultLength;
|
||||
@@ -62,17 +57,10 @@ public class MentionsAdapter extends BaseSearchAdapterRecycler {
|
||||
private int lastPosition;
|
||||
private ArrayList<MessageObject> messages;
|
||||
private boolean needUsernames = true;
|
||||
private boolean needBotContext = true;
|
||||
private boolean isDarkTheme;
|
||||
|
||||
private String searchingContextUsername;
|
||||
private String searchingContextQuery;
|
||||
private String nextQueryOffset;
|
||||
private int contextUsernameReqid;
|
||||
private int contextQueryReqid;
|
||||
private boolean noUserName;
|
||||
private TLRPC.User foundContextBot;
|
||||
private boolean contextMedia;
|
||||
private Runnable contextQueryRunnable;
|
||||
//private Location lastKnownLocation;
|
||||
|
||||
@@ -124,10 +112,6 @@ public class MentionsAdapter extends BaseSearchAdapterRecycler {
|
||||
ConnectionsManager.getInstance().cancelRequest(contextQueryReqid, true);
|
||||
contextQueryReqid = 0;
|
||||
}
|
||||
foundContextBot = null;
|
||||
searchingContextUsername = null;
|
||||
searchingContextQuery = null;
|
||||
noUserName = false;
|
||||
}
|
||||
|
||||
public void setAllowNewMentions(boolean value) {
|
||||
@@ -149,10 +133,6 @@ public class MentionsAdapter extends BaseSearchAdapterRecycler {
|
||||
needUsernames = value;
|
||||
}
|
||||
|
||||
public void setNeedBotContext(boolean value) {
|
||||
needBotContext = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearRecentHashtags() {
|
||||
super.clearRecentHashtags();
|
||||
@@ -171,163 +151,6 @@ public class MentionsAdapter extends BaseSearchAdapterRecycler {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
public TLRPC.TL_inlineBotSwitchPM getBotContextSwitch() {
|
||||
return searchResultBotContextSwitch;
|
||||
}
|
||||
|
||||
public int getContextBotId() {
|
||||
return foundContextBot != null ? foundContextBot.id : 0;
|
||||
}
|
||||
|
||||
public TLRPC.User getContextBotUser() {
|
||||
return foundContextBot != null ? foundContextBot : null;
|
||||
}
|
||||
|
||||
public String getContextBotName() {
|
||||
return foundContextBot != null ? foundContextBot.username : "";
|
||||
}
|
||||
|
||||
private void searchForContextBot(final String username, final String query) {
|
||||
searchResultBotContext = null;
|
||||
searchResultBotContextById = null;
|
||||
searchResultBotContextSwitch = null;
|
||||
notifyDataSetChanged();
|
||||
if (foundContextBot != null) {
|
||||
delegate.needChangePanelVisibility(false);
|
||||
}
|
||||
if (contextQueryRunnable != null) {
|
||||
AndroidUtilities.cancelRunOnUIThread(contextQueryRunnable);
|
||||
contextQueryRunnable = null;
|
||||
}
|
||||
if (username == null || username.length() == 0 || searchingContextUsername != null && !searchingContextUsername.equals(username)) {
|
||||
if (contextUsernameReqid != 0) {
|
||||
ConnectionsManager.getInstance().cancelRequest(contextUsernameReqid, true);
|
||||
contextUsernameReqid = 0;
|
||||
}
|
||||
if (contextQueryReqid != 0) {
|
||||
ConnectionsManager.getInstance().cancelRequest(contextQueryReqid, true);
|
||||
contextQueryReqid = 0;
|
||||
}
|
||||
foundContextBot = null;
|
||||
searchingContextUsername = null;
|
||||
searchingContextQuery = null;
|
||||
//locationProvider.stop();
|
||||
noUserName = false;
|
||||
if (delegate != null) {
|
||||
delegate.onContextSearch(false);
|
||||
}
|
||||
if (username == null || username.length() == 0) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (query == null) {
|
||||
if (contextQueryReqid != 0) {
|
||||
ConnectionsManager.getInstance().cancelRequest(contextQueryReqid, true);
|
||||
contextQueryReqid = 0;
|
||||
}
|
||||
searchingContextQuery = null;
|
||||
if (delegate != null) {
|
||||
delegate.onContextSearch(false);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (delegate != null) {
|
||||
if (foundContextBot != null) {
|
||||
delegate.onContextSearch(true);
|
||||
} else if (username.equals("gif")) {
|
||||
searchingContextUsername = "gif";
|
||||
delegate.onContextSearch(false);
|
||||
}
|
||||
}
|
||||
searchingContextQuery = query;
|
||||
contextQueryRunnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (contextQueryRunnable != this) {
|
||||
return;
|
||||
}
|
||||
contextQueryRunnable = null;
|
||||
if (foundContextBot != null || noUserName) {
|
||||
if (noUserName) {
|
||||
return;
|
||||
}
|
||||
//searchForContextBotResults(foundContextBot, query, "");
|
||||
} else {
|
||||
TLRPC.TL_contacts_resolveUsername req = new TLRPC.TL_contacts_resolveUsername();
|
||||
req.username = searchingContextUsername = username;
|
||||
contextUsernameReqid = ConnectionsManager.getInstance().sendRequest(req, new RequestDelegate() {
|
||||
@Override
|
||||
public void run(final TLObject response, final TLRPC.TL_error error) {
|
||||
AndroidUtilities.runOnUIThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (searchingContextUsername == null || !searchingContextUsername.equals(username)) {
|
||||
return;
|
||||
}
|
||||
contextUsernameReqid = 0;
|
||||
foundContextBot = null;
|
||||
locationProvider.stop();
|
||||
if (error == null) {
|
||||
TLRPC.TL_contacts_resolvedPeer res = (TLRPC.TL_contacts_resolvedPeer) response;
|
||||
if (!res.users.isEmpty()) {
|
||||
TLRPC.User user = res.users.get(0);
|
||||
if (user.bot && user.bot_inline_placeholder != null) {
|
||||
MessagesController.getInstance().putUser(user, false);
|
||||
MessagesStorage.getInstance().putUsersAndChats(res.users, null, true, true);
|
||||
foundContextBot = user;
|
||||
if (foundContextBot.bot_inline_geo) {
|
||||
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE);
|
||||
boolean allowGeo = preferences.getBoolean("inlinegeo_" + foundContextBot.id, false);
|
||||
if (!allowGeo && parentFragment != null && parentFragment.getParentActivity() != null) {
|
||||
final TLRPC.User foundContextBotFinal = foundContextBot;
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(parentFragment.getParentActivity());
|
||||
builder.setTitle(LocaleController.getString("ShareYouLocationTitle", R.string.ShareYouLocationTitle));
|
||||
builder.setMessage(LocaleController.getString("ShareYouLocationInline", R.string.ShareYouLocationInline));
|
||||
builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
if (foundContextBotFinal != null) {
|
||||
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE);
|
||||
preferences.edit().putBoolean("inlinegeo_" + foundContextBotFinal.id, true).commit();
|
||||
checkLocationPermissionsOrStart();
|
||||
}
|
||||
}
|
||||
});
|
||||
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
onLocationUnavailable();
|
||||
}
|
||||
});
|
||||
parentFragment.showDialog(builder.create());
|
||||
} else {
|
||||
checkLocationPermissionsOrStart();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (foundContextBot == null) {
|
||||
noUserName = true;
|
||||
} else {
|
||||
if (delegate != null) {
|
||||
delegate.onContextSearch(true);
|
||||
}
|
||||
searchForContextBotResults(foundContextBot, searchingContextQuery, "");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
AndroidUtilities.runOnUIThread(contextQueryRunnable, 400);
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
private void onLocationUnavailable() {
|
||||
if (foundContextBot != null && foundContextBot.bot_inline_geo) {
|
||||
@@ -354,115 +177,6 @@ public class MentionsAdapter extends BaseSearchAdapterRecycler {
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
public String getBotCaption() {
|
||||
if (foundContextBot != null) {
|
||||
return foundContextBot.bot_inline_placeholder;
|
||||
} else if (searchingContextUsername != null && searchingContextUsername.equals("gif")) {
|
||||
return "Search GIFs";
|
||||
}
|
||||
return null;
|
||||
}
|
||||
*/
|
||||
|
||||
public void searchForContextBotForNextOffset() {
|
||||
if (contextQueryReqid != 0 || nextQueryOffset == null || nextQueryOffset.length() == 0 || foundContextBot == null || searchingContextQuery == null) {
|
||||
return;
|
||||
}
|
||||
//searchForContextBotResults(foundContextBot, searchingContextQuery, nextQueryOffset);
|
||||
}
|
||||
|
||||
/*
|
||||
private void searchForContextBotResults(TLRPC.User user, final String query, final String offset) {
|
||||
if (contextQueryReqid != 0) {
|
||||
ConnectionsManager.getInstance().cancelRequest(contextQueryReqid, true);
|
||||
contextQueryReqid = 0;
|
||||
}
|
||||
if (query == null || user == null) {
|
||||
searchingContextQuery = null;
|
||||
return;
|
||||
}
|
||||
if (user.bot_inline_geo && lastKnownLocation == null) {
|
||||
return;
|
||||
}
|
||||
TLRPC.TL_messages_getInlineBotResults req = new TLRPC.TL_messages_getInlineBotResults();
|
||||
req.bot = MessagesController.getInputUser(user);
|
||||
req.query = query;
|
||||
req.offset = offset;
|
||||
if (user.bot_inline_geo && lastKnownLocation != null && lastKnownLocation.getLatitude() != -1000) {
|
||||
req.flags |= 1;
|
||||
req.geo_point = new TLRPC.TL_inputGeoPoint();
|
||||
req.geo_point.lat = lastKnownLocation.getLatitude();
|
||||
req.geo_point._long = lastKnownLocation.getLongitude();
|
||||
}
|
||||
int lower_id = (int) dialog_id;
|
||||
int high_id = (int) (dialog_id >> 32);
|
||||
if (lower_id != 0) {
|
||||
req.peer = MessagesController.getInputPeer(lower_id);
|
||||
} else {
|
||||
req.peer = new TLRPC.TL_inputPeerEmpty();
|
||||
}
|
||||
contextQueryReqid = ConnectionsManager.getInstance().sendRequest(req, new RequestDelegate() {
|
||||
@Override
|
||||
public void run(final TLObject response, final TLRPC.TL_error error) {
|
||||
AndroidUtilities.runOnUIThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (searchingContextQuery == null || !query.equals(searchingContextQuery)) {
|
||||
return;
|
||||
}
|
||||
if (delegate != null) {
|
||||
delegate.onContextSearch(false);
|
||||
}
|
||||
contextQueryReqid = 0;
|
||||
if (error == null) {
|
||||
TLRPC.TL_messages_botResults res = (TLRPC.TL_messages_botResults) response;
|
||||
nextQueryOffset = res.next_offset;
|
||||
if (searchResultBotContextById == null) {
|
||||
searchResultBotContextById = new HashMap<>();
|
||||
searchResultBotContextSwitch = res.switch_pm;
|
||||
}
|
||||
for (int a = 0; a < res.results.size(); a++) {
|
||||
TLRPC.BotInlineResult result = res.results.get(a);
|
||||
if (searchResultBotContextById.containsKey(result.id) || !(result.document instanceof TLRPC.TL_document) && !(result.photo instanceof TLRPC.TL_photo) && result.content_url == null && result.send_message instanceof TLRPC.TL_botInlineMessageMediaAuto) {
|
||||
res.results.remove(a);
|
||||
a--;
|
||||
}
|
||||
result.query_id = res.query_id;
|
||||
searchResultBotContextById.put(result.id, result);
|
||||
}
|
||||
boolean added = false;
|
||||
if (searchResultBotContext == null || offset.length() == 0) {
|
||||
searchResultBotContext = res.results;
|
||||
contextMedia = res.gallery;
|
||||
} else {
|
||||
added = true;
|
||||
searchResultBotContext.addAll(res.results);
|
||||
if (res.results.isEmpty()) {
|
||||
nextQueryOffset = "";
|
||||
}
|
||||
}
|
||||
searchResultHashtags = null;
|
||||
searchResultUsernames = null;
|
||||
searchResultCommands = null;
|
||||
searchResultCommandsHelp = null;
|
||||
searchResultCommandsUsers = null;
|
||||
if (added) {
|
||||
boolean hasTop = searchResultBotContextSwitch != null;
|
||||
notifyItemChanged(searchResultBotContext.size() - res.results.size() + (hasTop ? 1 : 0) - 1);
|
||||
notifyItemRangeInserted(searchResultBotContext.size() - res.results.size() + (hasTop ? 1 : 0), res.results.size());
|
||||
} else {
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
delegate.needChangePanelVisibility(!searchResultBotContext.isEmpty() || searchResultBotContextSwitch != null);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}, ConnectionsManager.RequestFlagFailOnServerErrors);
|
||||
}
|
||||
*/
|
||||
|
||||
public void searchUsernameOrHashtag(String text, int position, ArrayList<MessageObject> messageObjects) {
|
||||
if (text == null || text.length() == 0) {
|
||||
//searchForContextBot(null, null);
|
||||
@@ -478,33 +192,6 @@ public class MentionsAdapter extends BaseSearchAdapterRecycler {
|
||||
StringBuilder result = new StringBuilder();
|
||||
int foundType = -1;
|
||||
boolean hasIllegalUsernameCharacters = false;
|
||||
/*if (needBotContext && text.charAt(0) == '@') {
|
||||
int index = text.indexOf(' ');
|
||||
if (index > 0) {
|
||||
String username = text.substring(1, index);
|
||||
if (username.length() >= 1) {
|
||||
for (int a = 1; a < username.length(); a++) {
|
||||
char ch = username.charAt(a);
|
||||
if (!(ch >= '0' && ch <= '9' || ch >= 'a' && ch <= 'z' || ch >= 'A' && ch <= 'Z' || ch == '_')) {
|
||||
username = "";
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
username = "";
|
||||
}
|
||||
String query = text.substring(index + 1);
|
||||
if (username.length() > 0 && query.length() >= 0) {
|
||||
searchForContextBot(username, query);
|
||||
} else {
|
||||
searchForContextBot(username, null);
|
||||
}
|
||||
} else {
|
||||
searchForContextBot(null, null);
|
||||
}
|
||||
} else*/ {
|
||||
//searchForContextBot(null, null);
|
||||
}
|
||||
int dogPostion = -1;
|
||||
for (int a = searchPostion; a >= 0; a--) {
|
||||
if (a >= text.length()) {
|
||||
@@ -513,7 +200,7 @@ public class MentionsAdapter extends BaseSearchAdapterRecycler {
|
||||
char ch = text.charAt(a);
|
||||
if (a == 0 || text.charAt(a - 1) == ' ' || text.charAt(a - 1) == '\n') {
|
||||
if (ch == '@') {
|
||||
if (needUsernames || needBotContext && a == 0) {
|
||||
if (needUsernames /*|| needBotContext && a == 0*/ ) {
|
||||
if (hasIllegalUsernameCharacters) {
|
||||
delegate.needChangePanelVisibility(false);
|
||||
return;
|
||||
@@ -533,7 +220,6 @@ public class MentionsAdapter extends BaseSearchAdapterRecycler {
|
||||
}
|
||||
} else if (ch == '#') {
|
||||
if (!hashtagsLoadedFromDb) {
|
||||
loadRecentHashtags();
|
||||
lastText = text;
|
||||
lastPosition = position;
|
||||
messages = messageObjects;
|
||||
@@ -764,18 +450,6 @@ public class MentionsAdapter extends BaseSearchAdapterRecycler {
|
||||
return searchResultHashtags != null || searchResultCommands != null;
|
||||
}
|
||||
|
||||
/*public boolean isBotCommands() {
|
||||
return searchResultCommands != null;
|
||||
}*/
|
||||
|
||||
public boolean isBotContext() {
|
||||
return false; //searchResultBotContext != null;
|
||||
}
|
||||
|
||||
public boolean isMediaLayout() {
|
||||
return contextMedia;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||
View view;
|
||||
@@ -784,7 +458,7 @@ public class MentionsAdapter extends BaseSearchAdapterRecycler {
|
||||
((ContextLinkCell) view).setDelegate(new ContextLinkCell.ContextLinkCellDelegate() {
|
||||
@Override
|
||||
public void didPressedImage(ContextLinkCell cell) {
|
||||
delegate.onContextClick(cell.getResult());
|
||||
//delegate.onContextClick(null);
|
||||
}
|
||||
});
|
||||
//} else if (viewType == 2) {
|
||||
|
||||
@@ -1,323 +0,0 @@
|
||||
/*
|
||||
* This is the source code of Telegram for Android v. 1.3.x.
|
||||
* It is licensed under GNU GPL v. 2 or later.
|
||||
* You should have received a copy of the license in this archive (see LICENSE).
|
||||
*
|
||||
* Copyright Nikolai Kudashov, 2013-2016.
|
||||
*/
|
||||
|
||||
package com.b44t.ui.Adapters;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.b44t.messenger.AndroidUtilities;
|
||||
import com.b44t.messenger.LocaleController;
|
||||
import com.b44t.messenger.R;
|
||||
import com.b44t.messenger.TLObject;
|
||||
import com.b44t.messenger.TLRPC;
|
||||
import com.b44t.messenger.ContactsController;
|
||||
import com.b44t.messenger.FileLog;
|
||||
import com.b44t.messenger.MessagesController;
|
||||
import com.b44t.messenger.UserConfig;
|
||||
import com.b44t.messenger.Utilities;
|
||||
import com.b44t.ui.Cells.GreySectionCell;
|
||||
import com.b44t.ui.Cells.ProfileSearchCell;
|
||||
import com.b44t.ui.Cells.UserCell;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
public class SearchAdapter extends BaseSearchAdapter {
|
||||
|
||||
private Context mContext;
|
||||
private HashMap<Integer, TLRPC.User> ignoreUsers;
|
||||
private ArrayList<TLRPC.User> searchResult = new ArrayList<>();
|
||||
private ArrayList<CharSequence> searchResultNames = new ArrayList<>();
|
||||
private HashMap<Integer, ?> checkedMap;
|
||||
private Timer searchTimer;
|
||||
private boolean allowUsernameSearch;
|
||||
private boolean useUserCell;
|
||||
private boolean onlyMutual;
|
||||
private boolean allowChats;
|
||||
private boolean allowBots;
|
||||
|
||||
public SearchAdapter(Context context, HashMap<Integer, TLRPC.User> arg1, boolean usernameSearch, boolean mutual, boolean chats, boolean bots) {
|
||||
mContext = context;
|
||||
ignoreUsers = arg1;
|
||||
onlyMutual = mutual;
|
||||
allowUsernameSearch = usernameSearch;
|
||||
allowChats = chats;
|
||||
allowBots = bots;
|
||||
}
|
||||
|
||||
public void setCheckedMap(HashMap<Integer, ?> map) {
|
||||
checkedMap = map;
|
||||
}
|
||||
|
||||
public void setUseUserCell(boolean value) {
|
||||
useUserCell = value;
|
||||
}
|
||||
|
||||
public void searchDialogs(final String query) {
|
||||
try {
|
||||
if (searchTimer != null) {
|
||||
searchTimer.cancel();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
FileLog.e("messenger", e);
|
||||
}
|
||||
if (query == null) {
|
||||
searchResult.clear();
|
||||
searchResultNames.clear();
|
||||
if (allowUsernameSearch) {
|
||||
queryServerSearch(null, allowChats, allowBots);
|
||||
}
|
||||
notifyDataSetChanged();
|
||||
} else {
|
||||
searchTimer = new Timer();
|
||||
searchTimer.schedule(new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
searchTimer.cancel();
|
||||
searchTimer = null;
|
||||
} catch (Exception e) {
|
||||
FileLog.e("messenger", e);
|
||||
}
|
||||
processSearch(query);
|
||||
}
|
||||
}, 200, 300);
|
||||
}
|
||||
}
|
||||
|
||||
private void processSearch(final String query) {
|
||||
AndroidUtilities.runOnUIThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (allowUsernameSearch) {
|
||||
queryServerSearch(query, allowChats, allowBots);
|
||||
}
|
||||
final ArrayList<TLRPC.TL_contact> contactsCopy = new ArrayList<>();
|
||||
//contactsCopy.addAll(ContactsController.getInstance().contacts);
|
||||
Utilities.searchQueue.postRunnable(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
String search1 = query.trim().toLowerCase();
|
||||
if (search1.length() == 0) {
|
||||
updateSearchResults(new ArrayList<TLRPC.User>(), new ArrayList<CharSequence>());
|
||||
return;
|
||||
}
|
||||
String search2 = LocaleController.getInstance().getTranslitString(search1);
|
||||
if (search1.equals(search2) || search2.length() == 0) {
|
||||
search2 = null;
|
||||
}
|
||||
String search[] = new String[1 + (search2 != null ? 1 : 0)];
|
||||
search[0] = search1;
|
||||
if (search2 != null) {
|
||||
search[1] = search2;
|
||||
}
|
||||
|
||||
ArrayList<TLRPC.User> resultArray = new ArrayList<>();
|
||||
ArrayList<CharSequence> resultArrayNames = new ArrayList<>();
|
||||
|
||||
for (int a = 0; a < contactsCopy.size(); a++) {
|
||||
TLRPC.TL_contact contact = contactsCopy.get(a);
|
||||
TLRPC.User user = MessagesController.getInstance().getUser(contact.user_id);
|
||||
if (user.id == UserConfig.getClientUserId() || onlyMutual && !user.mutual_contact) {
|
||||
continue;
|
||||
}
|
||||
|
||||
String name = ContactsController.formatName(user.first_name, user.last_name).toLowerCase();
|
||||
String tName = LocaleController.getInstance().getTranslitString(name);
|
||||
if (name.equals(tName)) {
|
||||
tName = null;
|
||||
}
|
||||
|
||||
int found = 0;
|
||||
for (String q : search) {
|
||||
if (name.startsWith(q) || name.contains(" " + q) || tName != null && (tName.startsWith(q) || tName.contains(" " + q))) {
|
||||
found = 1;
|
||||
} else if (user.username != null && user.username.startsWith(q)) {
|
||||
found = 2;
|
||||
}
|
||||
|
||||
if (found != 0) {
|
||||
if (found == 1) {
|
||||
resultArrayNames.add(AndroidUtilities.generateSearchName(user.first_name, user.last_name, q));
|
||||
} else {
|
||||
resultArrayNames.add(AndroidUtilities.generateSearchName("@" + user.username, null, "@" + q));
|
||||
}
|
||||
resultArray.add(user);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
updateSearchResults(resultArray, resultArrayNames);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void updateSearchResults(final ArrayList<TLRPC.User> users, final ArrayList<CharSequence> names) {
|
||||
AndroidUtilities.runOnUIThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
searchResult = users;
|
||||
searchResultNames = names;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean areAllItemsEnabled() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabled(int i) {
|
||||
return i != searchResult.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
int count = searchResult.size();
|
||||
int globalCount = globalSearch.size();
|
||||
if (globalCount != 0) {
|
||||
count += globalCount + 1;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
public boolean isGlobalSearch(int i) {
|
||||
int localCount = searchResult.size();
|
||||
int globalCount = globalSearch.size();
|
||||
if (i >= 0 && i < localCount) {
|
||||
return false;
|
||||
} else if (i > localCount && i <= globalCount + localCount) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TLObject getItem(int i) {
|
||||
int localCount = searchResult.size();
|
||||
int globalCount = globalSearch.size();
|
||||
if (i >= 0 && i < localCount) {
|
||||
return searchResult.get(i);
|
||||
} else if (i > localCount && i <= globalCount + localCount) {
|
||||
return globalSearch.get(i - localCount - 1);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int i) {
|
||||
return i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasStableIds() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int i, View view, ViewGroup viewGroup) {
|
||||
if (i == searchResult.size()) {
|
||||
if (view == null) {
|
||||
view = new GreySectionCell(mContext);
|
||||
((GreySectionCell) view).setText(LocaleController.getString("GlobalSearch", R.string.GlobalSearch));
|
||||
}
|
||||
} else {
|
||||
if (view == null) {
|
||||
if (useUserCell) {
|
||||
view = new UserCell(mContext, 1, 1);
|
||||
if (checkedMap != null) {
|
||||
((UserCell) view).setChecked(false, false);
|
||||
}
|
||||
} else {
|
||||
view = new ProfileSearchCell(mContext);
|
||||
}
|
||||
}
|
||||
|
||||
TLObject object = getItem(i);
|
||||
if (object != null) {
|
||||
int id = 0;
|
||||
String un = null;
|
||||
if (object instanceof TLRPC.User) {
|
||||
un = ((TLRPC.User) object).username;
|
||||
id = ((TLRPC.User) object).id;
|
||||
} else if (object instanceof TLRPC.Chat) {
|
||||
un = ((TLRPC.Chat) object).username;
|
||||
id = ((TLRPC.Chat) object).id;
|
||||
}
|
||||
|
||||
CharSequence username = null;
|
||||
CharSequence name = null;
|
||||
if (i < searchResult.size()) {
|
||||
name = searchResultNames.get(i);
|
||||
if (name != null && un != null && un.length() > 0) {
|
||||
if (name.toString().startsWith("@" + un)) {
|
||||
username = name;
|
||||
name = null;
|
||||
}
|
||||
}
|
||||
} else if (i > searchResult.size() && un != null) {
|
||||
String foundUserName = lastFoundUsername;
|
||||
if (foundUserName.startsWith("@")) {
|
||||
foundUserName = foundUserName.substring(1);
|
||||
}
|
||||
try {
|
||||
username = AndroidUtilities.replaceTags(String.format("<c#ff4d83b3>@%s</c>%s", un.substring(0, foundUserName.length()), un.substring(foundUserName.length())));
|
||||
} catch (Exception e) {
|
||||
username = un;
|
||||
FileLog.e("messenger", e);
|
||||
}
|
||||
}
|
||||
|
||||
if (useUserCell) {
|
||||
((UserCell) view).setData(123, 0, "ErrUserName", "ErrStatus", 0);
|
||||
if (checkedMap != null) {
|
||||
((UserCell) view).setChecked(checkedMap.containsKey(id), false);
|
||||
}
|
||||
} else {
|
||||
((ProfileSearchCell) view).setData(object, null, name, username, false);
|
||||
((ProfileSearchCell) view).useSeparator = (i != getCount() - 1 && i != searchResult.size() - 1);
|
||||
if (ignoreUsers != null) {
|
||||
if (ignoreUsers.containsKey(id)) {
|
||||
((ProfileSearchCell) view).drawAlpha = 0.5f;
|
||||
} else {
|
||||
((ProfileSearchCell) view).drawAlpha = 1.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemViewType(int i) {
|
||||
if (i == searchResult.size()) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getViewTypeCount() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return searchResult.isEmpty() && globalSearch.isEmpty();
|
||||
}
|
||||
}
|
||||
@@ -75,7 +75,6 @@ public class ContextLinkCell extends View implements MediaController.FileDownloa
|
||||
private int descriptionY = AndroidUtilities.dp(27);
|
||||
private StaticLayout descriptionLayout;
|
||||
|
||||
private final TLRPC.BotInlineResult inlineResult = null;
|
||||
private TLRPC.Document documentAttach;
|
||||
private int documentAttachType;
|
||||
private boolean mediaWebpage;
|
||||
@@ -83,7 +82,6 @@ public class ContextLinkCell extends View implements MediaController.FileDownloa
|
||||
private static TextPaint titleTextPaint;
|
||||
private static TextPaint descriptionTextPaint;
|
||||
private static Paint paint;
|
||||
private static Drawable shadowDrawable;
|
||||
|
||||
private int TAG;
|
||||
private int buttonState;
|
||||
@@ -129,7 +127,7 @@ public class ContextLinkCell extends View implements MediaController.FileDownloa
|
||||
linkLayout = null;
|
||||
linkY = AndroidUtilities.dp(27);
|
||||
|
||||
if (inlineResult == null && documentAttach == null) {
|
||||
if (documentAttach == null) {
|
||||
setMeasuredDimension(AndroidUtilities.dp(100), AndroidUtilities.dp(100));
|
||||
return;
|
||||
}
|
||||
@@ -145,42 +143,6 @@ public class ContextLinkCell extends View implements MediaController.FileDownloa
|
||||
if (documentAttach != null) {
|
||||
photoThumbs = new ArrayList<>();
|
||||
photoThumbs.add(documentAttach.thumb);
|
||||
} else if (inlineResult != null && inlineResult.photo != null) {
|
||||
photoThumbs = new ArrayList<>(inlineResult.photo.sizes);
|
||||
}
|
||||
|
||||
if (!mediaWebpage && inlineResult != null) {
|
||||
if (inlineResult.title != null) {
|
||||
try {
|
||||
int width = (int) Math.ceil(titleTextPaint.measureText(inlineResult.title));
|
||||
CharSequence titleFinal = TextUtils.ellipsize(Emoji.replaceEmoji(inlineResult.title.replace('\n', ' '), titleTextPaint.getFontMetricsInt(), AndroidUtilities.dp(15), false), titleTextPaint, Math.min(width, maxWidth), TextUtils.TruncateAt.END);
|
||||
titleLayout = new StaticLayout(titleFinal, titleTextPaint, maxWidth + AndroidUtilities.dp(4), Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
|
||||
} catch (Exception e) {
|
||||
FileLog.e("messenger", e);
|
||||
}
|
||||
letterDrawable.setTitle(inlineResult.title);
|
||||
}
|
||||
|
||||
if (inlineResult.description != null) {
|
||||
try {
|
||||
descriptionLayout = ChatMessageCell.generateStaticLayout(Emoji.replaceEmoji(inlineResult.description, descriptionTextPaint.getFontMetricsInt(), AndroidUtilities.dp(13), false), descriptionTextPaint, maxWidth, maxWidth, 0, 3);
|
||||
if (descriptionLayout.getLineCount() > 0) {
|
||||
linkY = descriptionY + descriptionLayout.getLineBottom(descriptionLayout.getLineCount() - 1) + AndroidUtilities.dp(1);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
FileLog.e("messenger", e);
|
||||
}
|
||||
}
|
||||
|
||||
if (inlineResult.url != null) {
|
||||
try {
|
||||
int width = (int) Math.ceil(descriptionTextPaint.measureText(inlineResult.url));
|
||||
CharSequence linkFinal = TextUtils.ellipsize(inlineResult.url.replace('\n', ' '), descriptionTextPaint, Math.min(width, maxWidth), TextUtils.TruncateAt.MIDDLE);
|
||||
linkLayout = new StaticLayout(linkFinal, descriptionTextPaint, maxWidth, Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
|
||||
} catch (Exception e) {
|
||||
FileLog.e("messenger", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
documentAttachType = DOCUMENT_ATTACH_TYPE_NONE;
|
||||
@@ -196,40 +158,6 @@ public class ContextLinkCell extends View implements MediaController.FileDownloa
|
||||
} else {
|
||||
currentPhotoObject = documentAttach.thumb;
|
||||
}
|
||||
} else if (inlineResult != null && inlineResult.photo != null) {
|
||||
documentAttachType = DOCUMENT_ATTACH_TYPE_PHOTO;
|
||||
currentPhotoObject = FileLoader.getClosestPhotoSizeWithSize(photoThumbs, AndroidUtilities.getPhotoSize(), true);
|
||||
currentPhotoObjectThumb = FileLoader.getClosestPhotoSizeWithSize(photoThumbs, 80);
|
||||
if (currentPhotoObjectThumb == currentPhotoObject) {
|
||||
currentPhotoObjectThumb = null;
|
||||
}
|
||||
}
|
||||
if (inlineResult != null) {
|
||||
if (inlineResult.content_url != null) {
|
||||
if (inlineResult.type != null) {
|
||||
if (inlineResult.type.startsWith("gif")) {
|
||||
if (documentAttachType != DOCUMENT_ATTACH_TYPE_GIF) {
|
||||
url = inlineResult.content_url;
|
||||
documentAttachType = DOCUMENT_ATTACH_TYPE_GIF;
|
||||
}
|
||||
} else if (inlineResult.type.equals("photo")) {
|
||||
url = inlineResult.thumb_url;
|
||||
if (url == null) {
|
||||
url = inlineResult.content_url;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (url == null && inlineResult.thumb_url != null) {
|
||||
url = inlineResult.thumb_url;
|
||||
}
|
||||
}
|
||||
if (url == null && currentPhotoObject == null && currentPhotoObjectThumb == null) {
|
||||
/*if (inlineResult.send_message instanceof TLRPC.TL_botInlineMessageMediaVenue || inlineResult.send_message instanceof TLRPC.TL_botInlineMessageMediaGeo) {
|
||||
double lat = inlineResult.send_message.geo.lat;
|
||||
double lon = inlineResult.send_message.geo._long;
|
||||
url = String.format(Locale.US, "https://maps.googleapis.com/maps/api/staticmap?center=%f,%f&zoom=15&size=72x72&maptype=roadmap&scale=%d&markers=color:red|size:small|%f,%f&sensor=false", lat, lon, Math.min(2, (int) Math.ceil(AndroidUtilities.density)), lat, lon);
|
||||
}*/
|
||||
}
|
||||
|
||||
int width;
|
||||
@@ -253,9 +181,6 @@ public class ContextLinkCell extends View implements MediaController.FileDownloa
|
||||
}
|
||||
w = currentPhotoObject.w;
|
||||
h = currentPhotoObject.h;
|
||||
} else if (inlineResult != null) {
|
||||
w = inlineResult.w;
|
||||
h = inlineResult.h;
|
||||
}
|
||||
}
|
||||
if (w == 0 || h == 0) {
|
||||
@@ -296,7 +221,6 @@ public class ContextLinkCell extends View implements MediaController.FileDownloa
|
||||
|
||||
if (mediaWebpage) {
|
||||
setBackgroundDrawable(null);
|
||||
//if (inlineResult == null) {
|
||||
width = viewWidth;
|
||||
int height = MeasureSpec.getSize(heightMeasureSpec);
|
||||
if (height == 0) {
|
||||
@@ -307,13 +231,6 @@ public class ContextLinkCell extends View implements MediaController.FileDownloa
|
||||
int y = (height - AndroidUtilities.dp(24)) / 2;
|
||||
radialProgress.setProgressRect(x, y, x + AndroidUtilities.dp(24), y + AndroidUtilities.dp(24));
|
||||
linkImageView.setImageCoords(0, 0, width, height);
|
||||
/*} else {
|
||||
setMeasuredDimension(width + AndroidUtilities.dp(5), AndroidUtilities.dp(90));
|
||||
int x = AndroidUtilities.dp(5) + (width - AndroidUtilities.dp(24)) / 2;
|
||||
int y = (AndroidUtilities.dp(90) - AndroidUtilities.dp(24)) / 2;
|
||||
radialProgress.setProgressRect(x, y, x + AndroidUtilities.dp(24), y + AndroidUtilities.dp(24));
|
||||
linkImageView.setImageCoords(AndroidUtilities.dp(5), AndroidUtilities.dp(5), width, AndroidUtilities.dp(80));
|
||||
}*/
|
||||
} else {
|
||||
setBackgroundResource(R.drawable.list_selector);
|
||||
int height = 0;
|
||||
@@ -339,7 +256,6 @@ public class ContextLinkCell extends View implements MediaController.FileDownloa
|
||||
public void setGif(TLRPC.Document document, boolean divider) {
|
||||
needDivider = divider;
|
||||
needShadow = false;
|
||||
//inlineResult = null;
|
||||
documentAttach = document;
|
||||
mediaWebpage = true;
|
||||
requestLayout();
|
||||
@@ -391,41 +307,7 @@ public class ContextLinkCell extends View implements MediaController.FileDownloa
|
||||
}
|
||||
}
|
||||
|
||||
if (mediaWebpage || delegate == null || inlineResult == null) {
|
||||
return super.onTouchEvent(event);
|
||||
}
|
||||
int x = (int) event.getX();
|
||||
int y = (int) event.getY();
|
||||
|
||||
boolean result = false;
|
||||
int side = AndroidUtilities.dp(48);
|
||||
if (inlineResult != null && inlineResult.content_url != null && inlineResult.content_url.length() > 0) {
|
||||
if (event.getAction() == MotionEvent.ACTION_DOWN) {
|
||||
if (letterDrawable.getBounds().contains(x, y)) {
|
||||
buttonPressed = true;
|
||||
result = true;
|
||||
}
|
||||
} else {
|
||||
if (buttonPressed) {
|
||||
if (event.getAction() == MotionEvent.ACTION_UP) {
|
||||
buttonPressed = false;
|
||||
playSoundEffect(SoundEffectConstants.CLICK);
|
||||
delegate.didPressedImage(this);
|
||||
} else if (event.getAction() == MotionEvent.ACTION_CANCEL) {
|
||||
buttonPressed = false;
|
||||
} else if (event.getAction() == MotionEvent.ACTION_MOVE) {
|
||||
if (!letterDrawable.getBounds().contains(x, y)) {
|
||||
buttonPressed = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!result) {
|
||||
result = super.onTouchEvent(event);
|
||||
}
|
||||
|
||||
return result;
|
||||
return super.onTouchEvent(event);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -454,43 +336,7 @@ public class ContextLinkCell extends View implements MediaController.FileDownloa
|
||||
}
|
||||
|
||||
if (!mediaWebpage) {
|
||||
/*if (inlineResult != null && inlineResult.type.equals("file")) {
|
||||
int w = Theme.inlineDocDrawable.getIntrinsicWidth();
|
||||
int h = Theme.inlineDocDrawable.getIntrinsicHeight();
|
||||
int x = linkImageView.getImageX() + (AndroidUtilities.dp(52) - w) / 2;
|
||||
int y = linkImageView.getImageY() + (AndroidUtilities.dp(52) - h) / 2;
|
||||
canvas.drawRect(linkImageView.getImageX(), linkImageView.getImageY(), linkImageView.getImageX() + AndroidUtilities.dp(52), linkImageView.getImageY() + AndroidUtilities.dp(52), LetterDrawable.paint);
|
||||
Theme.inlineDocDrawable.setBounds(x, y, x + w, y + h);
|
||||
Theme.inlineDocDrawable.draw(canvas);
|
||||
} else if (inlineResult != null && (inlineResult.type.equals("audio") || inlineResult.type.equals("voice"))) {
|
||||
int w = Theme.inlineAudioDrawable.getIntrinsicWidth();
|
||||
int h = Theme.inlineAudioDrawable.getIntrinsicHeight();
|
||||
int x = linkImageView.getImageX() + (AndroidUtilities.dp(52) - w) / 2;
|
||||
int y = linkImageView.getImageY() + (AndroidUtilities.dp(52) - h) / 2;
|
||||
canvas.drawRect(linkImageView.getImageX(), linkImageView.getImageY(), linkImageView.getImageX() + AndroidUtilities.dp(52), linkImageView.getImageY() + AndroidUtilities.dp(52), LetterDrawable.paint);
|
||||
Theme.inlineAudioDrawable.setBounds(x, y, x + w, y + h);
|
||||
Theme.inlineAudioDrawable.draw(canvas);
|
||||
} else if (inlineResult != null && (inlineResult.type.equals("venue") || inlineResult.type.equals("geo"))) {
|
||||
int w = Theme.inlineLocationDrawable.getIntrinsicWidth();
|
||||
int h = Theme.inlineLocationDrawable.getIntrinsicHeight();
|
||||
int x = linkImageView.getImageX() + (AndroidUtilities.dp(52) - w) / 2;
|
||||
int y = linkImageView.getImageY() + (AndroidUtilities.dp(52) - h) / 2;
|
||||
canvas.drawRect(linkImageView.getImageX(), linkImageView.getImageY(), linkImageView.getImageX() + AndroidUtilities.dp(52), linkImageView.getImageY() + AndroidUtilities.dp(52), LetterDrawable.paint);
|
||||
Theme.inlineLocationDrawable.setBounds(x, y, x + w, y + h);
|
||||
Theme.inlineLocationDrawable.draw(canvas);
|
||||
} else*/ {
|
||||
letterDrawable.draw(canvas);
|
||||
}
|
||||
} else {
|
||||
/*if (inlineResult != null && (inlineResult.send_message instanceof TLRPC.TL_botInlineMessageMediaGeo || inlineResult.send_message instanceof TLRPC.TL_botInlineMessageMediaVenue)) {
|
||||
int w = Theme.inlineLocationDrawable.getIntrinsicWidth();
|
||||
int h = Theme.inlineLocationDrawable.getIntrinsicHeight();
|
||||
int x = linkImageView.getImageX() + (linkImageView.getImageWidth() - w) / 2;
|
||||
int y = linkImageView.getImageY() + (linkImageView.getImageHeight() - h) / 2;
|
||||
canvas.drawRect(linkImageView.getImageX(), linkImageView.getImageY(), linkImageView.getImageX() + linkImageView.getImageWidth(), linkImageView.getImageY() + linkImageView.getImageHeight(), LetterDrawable.paint);
|
||||
Theme.inlineLocationDrawable.setBounds(x, y, x + w, y + h);
|
||||
Theme.inlineLocationDrawable.draw(canvas);
|
||||
}*/
|
||||
}
|
||||
if (drawLinkImageView) {
|
||||
canvas.save();
|
||||
@@ -526,10 +372,7 @@ public class ContextLinkCell extends View implements MediaController.FileDownloa
|
||||
canvas.drawLine(AndroidUtilities.dp(AndroidUtilities.leftBaseline), getMeasuredHeight() - 1, getMeasuredWidth(), getMeasuredHeight() - 1, paint);
|
||||
}
|
||||
}
|
||||
if (needShadow && shadowDrawable != null) {
|
||||
shadowDrawable.setBounds(0, 0, getMeasuredWidth(), AndroidUtilities.dp(3));
|
||||
shadowDrawable.draw(canvas);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private Drawable getDrawableForCurrentState() {
|
||||
@@ -542,22 +385,7 @@ public class ContextLinkCell extends View implements MediaController.FileDownloa
|
||||
}
|
||||
String fileName = null;
|
||||
File cacheFile = null;
|
||||
if (inlineResult != null) {
|
||||
if (inlineResult.document instanceof TLRPC.TL_document) {
|
||||
fileName = FileLoader.getAttachFileName(inlineResult.document);
|
||||
cacheFile = FileLoader.getPathToAttach(inlineResult.document);
|
||||
} else if (inlineResult.photo instanceof TLRPC.TL_photo) {
|
||||
TLRPC.PhotoSize currentPhotoObject = FileLoader.getClosestPhotoSizeWithSize(inlineResult.photo.sizes, AndroidUtilities.getPhotoSize(), true);
|
||||
fileName = FileLoader.getAttachFileName(currentPhotoObject);
|
||||
cacheFile = FileLoader.getPathToAttach(currentPhotoObject);
|
||||
} else if (inlineResult.content_url != null) {
|
||||
fileName = Utilities.MD5(inlineResult.content_url) + "." + ImageLoader.getHttpUrlExtension(inlineResult.content_url, "jpg");
|
||||
cacheFile = new File(FileLoader.getInstance().getDirectory(FileLoader.MEDIA_DIR_CACHE), fileName);
|
||||
} else if (inlineResult.thumb_url != null) {
|
||||
fileName = Utilities.MD5(inlineResult.thumb_url) + "." + ImageLoader.getHttpUrlExtension(inlineResult.thumb_url, "jpg");
|
||||
cacheFile = new File(FileLoader.getInstance().getDirectory(FileLoader.MEDIA_DIR_CACHE), fileName);
|
||||
}
|
||||
} else if (documentAttach != null) {
|
||||
if (documentAttach != null) {
|
||||
fileName = FileLoader.getAttachFileName(documentAttach);
|
||||
cacheFile = FileLoader.getPathToAttach(documentAttach);
|
||||
}
|
||||
@@ -589,10 +417,6 @@ public class ContextLinkCell extends View implements MediaController.FileDownloa
|
||||
delegate = contextLinkCellDelegate;
|
||||
}
|
||||
|
||||
public TLRPC.BotInlineResult getResult() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailedDownload(String fileName) {
|
||||
updateButtonState(false);
|
||||
|
||||
@@ -187,7 +187,6 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
private boolean openSearchKeyboard;
|
||||
|
||||
private boolean allowStickersPanel;
|
||||
private boolean allowContextBotPanel;
|
||||
private boolean allowContextBotPanelSecond = true;
|
||||
private AnimatorSet runningAnimation;
|
||||
|
||||
@@ -862,28 +861,10 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
int height;
|
||||
mentionListViewIgnoreLayout = true;
|
||||
|
||||
/*if (mentionsAdapter.isBotContext() && mentionsAdapter.isMediaLayout()) {
|
||||
int size = mentionGridLayoutManager.getRowsCount(widthSize);
|
||||
int maxHeight = size * 102;
|
||||
if (mentionsAdapter.isBotContext()) {
|
||||
if (mentionsAdapter.getBotContextSwitch() != null) {
|
||||
maxHeight += 34;
|
||||
}
|
||||
}
|
||||
height = heightSize - chatActivityEnterView.getMeasuredHeight() + (maxHeight != 0 ? AndroidUtilities.dp(2) : 0);
|
||||
mentionListView.setPadding(0, Math.max(0, height - AndroidUtilities.dp(Math.min(maxHeight, 68 * 1.8f))), 0, 0);
|
||||
} else */ {
|
||||
{
|
||||
int size = mentionsAdapter.getItemCount();
|
||||
int maxHeight = 0;
|
||||
/*if (mentionsAdapter.isBotContext()) {
|
||||
if (mentionsAdapter.getBotContextSwitch() != null) {
|
||||
maxHeight += 36;
|
||||
size -= 1;
|
||||
}
|
||||
maxHeight += size * 68;
|
||||
} else */ {
|
||||
maxHeight += size * 36;
|
||||
}
|
||||
maxHeight += size * 36;
|
||||
height = heightSize - chatActivityEnterView.getMeasuredHeight() + (maxHeight != 0 ? AndroidUtilities.dp(2) : 0);
|
||||
mentionListView.setPadding(0, Math.max(0, height - AndroidUtilities.dp(Math.min(maxHeight, 68 * 1.8f))), 0, 0);
|
||||
}
|
||||
@@ -1251,9 +1232,9 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
|
||||
if (newPosition != -1) {
|
||||
mentionListViewIgnoreLayout = true;
|
||||
if (mentionsAdapter.isBotContext() && mentionsAdapter.isMediaLayout()) {
|
||||
/*if (mentionsAdapter.isBotContext() && mentionsAdapter.isMediaLayout()) {
|
||||
mentionGridLayoutManager.scrollToPositionWithOffset(newPosition, newTop);
|
||||
} else {
|
||||
} else*/ {
|
||||
mentionLayoutManager.scrollToPositionWithOffset(newPosition, newTop);
|
||||
}
|
||||
super.onLayout(false, l, t, r, b);
|
||||
@@ -1366,9 +1347,9 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
mentionListView.setAdapter(mentionsAdapter = new MentionsAdapter(context, false, dialog_id, new MentionsAdapter.MentionsAdapterDelegate() {
|
||||
@Override
|
||||
public void needChangePanelVisibility(boolean show) {
|
||||
if (mentionsAdapter.isBotContext() && mentionsAdapter.isMediaLayout()) {
|
||||
/*if (mentionsAdapter.isBotContext() && mentionsAdapter.isMediaLayout()) {
|
||||
mentionListView.setLayoutManager(mentionGridLayoutManager);
|
||||
} else {
|
||||
} else*/ {
|
||||
mentionListView.setLayoutManager(mentionLayoutManager);
|
||||
}
|
||||
if (show) {
|
||||
@@ -1381,12 +1362,12 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
mentionContainer.setAlpha(1.0f);
|
||||
return;
|
||||
}
|
||||
if (mentionsAdapter.isBotContext() && mentionsAdapter.isMediaLayout()) {
|
||||
/*if (mentionsAdapter.isBotContext() && mentionsAdapter.isMediaLayout()) {
|
||||
mentionGridLayoutManager.scrollToPositionWithOffset(0, 10000);
|
||||
} else {
|
||||
} else*/ {
|
||||
mentionLayoutManager.scrollToPositionWithOffset(0, 10000);
|
||||
}
|
||||
if (allowStickersPanel && (!mentionsAdapter.isBotContext() || (allowContextBotPanel || allowContextBotPanelSecond))) {
|
||||
if (allowStickersPanel) {
|
||||
mentionContainer.setVisibility(View.VISIBLE);
|
||||
mentionContainer.setTag(null);
|
||||
mentionListAnimation = new AnimatorSet();
|
||||
@@ -1463,27 +1444,11 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
@Override
|
||||
public void onContextClick(TLRPC.BotInlineResult result) {
|
||||
if (getParentActivity() == null || result.content_url == null) {
|
||||
return;
|
||||
}
|
||||
if (result.type.equals("video") || result.type.equals("web_player_video")) {
|
||||
BottomSheet.Builder builder = new BottomSheet.Builder(getParentActivity());
|
||||
builder.setCustomView(new WebFrameLayout(getParentActivity(), builder.create(), result.title != null ? result.title : "", result.description, result.content_url, result.content_url, result.w, result.h));
|
||||
builder.setUseFullWidth(true);
|
||||
showDialog(builder.create());
|
||||
} else {
|
||||
Browser.openUrl(getParentActivity(), result.content_url);
|
||||
}
|
||||
}
|
||||
}));
|
||||
|
||||
mentionsAdapter.setParentFragment(this);
|
||||
mentionsAdapter.setChatInfo(info);
|
||||
mentionsAdapter.setNeedUsernames(currentChat != null);
|
||||
mentionsAdapter.setNeedBotContext(true);
|
||||
mentionListView.setOnItemClickListener(mentionsOnItemClickListener = new RecyclerListView.OnItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(View view, int position) {
|
||||
@@ -1542,16 +1507,6 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
|
||||
@Override
|
||||
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
|
||||
int lastVisibleItem;
|
||||
if (mentionsAdapter.isBotContext() && mentionsAdapter.isMediaLayout()) {
|
||||
lastVisibleItem = mentionGridLayoutManager.findLastVisibleItemPosition();
|
||||
} else {
|
||||
lastVisibleItem = mentionLayoutManager.findLastVisibleItemPosition();
|
||||
}
|
||||
int visibleItemCount = lastVisibleItem == RecyclerView.NO_POSITION ? 0 : lastVisibleItem;
|
||||
if (visibleItemCount > 0 && lastVisibleItem > mentionsAdapter.getItemCount() - 5) {
|
||||
mentionsAdapter.searchForContextBotForNextOffset();
|
||||
}
|
||||
mentionListViewUpdateLayout();
|
||||
}
|
||||
});
|
||||
@@ -1682,13 +1637,11 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
if (stickersPanel.getVisibility() == View.INVISIBLE) {
|
||||
stickersPanel.setVisibility(View.VISIBLE);
|
||||
}
|
||||
if (mentionContainer != null && mentionContainer.getVisibility() == View.INVISIBLE && (!mentionsAdapter.isBotContext() || (allowContextBotPanel || allowContextBotPanelSecond))) {
|
||||
if (mentionContainer != null && mentionContainer.getVisibility() == View.INVISIBLE ) {
|
||||
mentionContainer.setVisibility(View.VISIBLE);
|
||||
mentionContainer.setTag(null);
|
||||
}
|
||||
}
|
||||
|
||||
allowContextBotPanel = !chatActivityEnterView.isPopupShowing();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -2064,12 +2017,6 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
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;
|
||||
} else {
|
||||
checkLoadCount = 5;
|
||||
}
|
||||
if (!loadingForward && firstVisibleItem + visibleItemCount >= totalItemCount - 10) {
|
||||
if (!forwardEndReached) {
|
||||
//MessagesController.getInstance().loadMessages(dialog_id, 50, minMessageId[0], true, maxDate[0], classGuid, 1, 0, ChatObject.isChannel(currentChat), lastLoadIndex++);
|
||||
|
||||
@@ -1661,10 +1661,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
||||
}
|
||||
*/
|
||||
|
||||
@Override
|
||||
public void onContextClick(TLRPC.BotInlineResult result) {
|
||||
|
||||
}
|
||||
}));
|
||||
mentionsAdapter.setAllowNewMentions(false);
|
||||
|
||||
@@ -2622,7 +2619,6 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
||||
if (parentChatActivity != null /*&& (parentChatActivity.currentEncryptedChat == null || AndroidUtilities.getPeerLayerVersion(parentChatActivity.currentEncryptedChat.layer) >= 46)*/) {
|
||||
mentionsAdapter.setChatInfo(parentChatActivity.info);
|
||||
mentionsAdapter.setNeedUsernames(parentChatActivity.currentChat != null);
|
||||
mentionsAdapter.setNeedBotContext(false);
|
||||
//captionItem.setVisibility(cropItem.getVisibility());
|
||||
//captionEditText.setVisibility(cropItem.getVisibility());
|
||||
//needCaptionLayout = captionItem.getVisibility() == View.VISIBLE;
|
||||
|
||||
Reference in New Issue
Block a user