mirror of https://github.com/NekoX-Dev/NekoX.git
Update to 6.2.0 (1985)
This commit is contained in:
parent
dceccae0b7
commit
e2f7baf2bd
|
@ -276,7 +276,7 @@ android {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
defaultConfig.versionCode = 1984
|
defaultConfig.versionCode = 1985
|
||||||
|
|
||||||
def tgVoipDexFileName = "libtgvoip.dex"
|
def tgVoipDexFileName = "libtgvoip.dex"
|
||||||
def tgVoipDexClasses = ["AudioRecordJNI", "AudioTrackJNI", "NativeTgVoipDelegate", "NativeTgVoipInstance", "TgVoipNativeLoader", "Resampler", "VLog"]
|
def tgVoipDexClasses = ["AudioRecordJNI", "AudioTrackJNI", "NativeTgVoipDelegate", "NativeTgVoipInstance", "TgVoipNativeLoader", "Resampler", "VLog"]
|
||||||
|
|
|
@ -141,14 +141,12 @@ public class ChatListItemAnimator extends DefaultItemAnimator {
|
||||||
if (additionsPending) {
|
if (additionsPending) {
|
||||||
final ArrayList<RecyclerView.ViewHolder> additions = new ArrayList<>();
|
final ArrayList<RecyclerView.ViewHolder> additions = new ArrayList<>();
|
||||||
additions.addAll(mPendingAdditions);
|
additions.addAll(mPendingAdditions);
|
||||||
mAdditionsList.add(additions);
|
|
||||||
mPendingAdditions.clear();
|
mPendingAdditions.clear();
|
||||||
|
|
||||||
for (RecyclerView.ViewHolder holder : additions) {
|
for (RecyclerView.ViewHolder holder : additions) {
|
||||||
animateAddImpl(holder);
|
animateAddImpl(holder);
|
||||||
}
|
}
|
||||||
additions.clear();
|
additions.clear();
|
||||||
mAdditionsList.remove(additions);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -181,26 +179,22 @@ public class ChatListItemAnimator extends DefaultItemAnimator {
|
||||||
if (movesPending) {
|
if (movesPending) {
|
||||||
final ArrayList<MoveInfo> moves = new ArrayList<>();
|
final ArrayList<MoveInfo> moves = new ArrayList<>();
|
||||||
moves.addAll(mPendingMoves);
|
moves.addAll(mPendingMoves);
|
||||||
mMovesList.add(moves);
|
|
||||||
mPendingMoves.clear();
|
mPendingMoves.clear();
|
||||||
for (MoveInfo moveInfo : moves) {
|
for (MoveInfo moveInfo : moves) {
|
||||||
animateMoveImpl(moveInfo.holder, moveInfo);
|
animateMoveImpl(moveInfo.holder, moveInfo);
|
||||||
}
|
}
|
||||||
moves.clear();
|
moves.clear();
|
||||||
mMovesList.remove(moves);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (additionsPending) {
|
if (additionsPending) {
|
||||||
final ArrayList<RecyclerView.ViewHolder> additions = new ArrayList<>();
|
final ArrayList<RecyclerView.ViewHolder> additions = new ArrayList<>();
|
||||||
additions.addAll(mPendingAdditions);
|
additions.addAll(mPendingAdditions);
|
||||||
mAdditionsList.add(additions);
|
|
||||||
mPendingAdditions.clear();
|
mPendingAdditions.clear();
|
||||||
|
|
||||||
for (RecyclerView.ViewHolder holder : additions) {
|
for (RecyclerView.ViewHolder holder : additions) {
|
||||||
animateAddImpl(holder, addedItemsHeight);
|
animateAddImpl(holder, addedItemsHeight);
|
||||||
}
|
}
|
||||||
additions.clear();
|
additions.clear();
|
||||||
mAdditionsList.remove(additions);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,9 @@ import android.view.ViewGroup;
|
||||||
|
|
||||||
import androidx.core.view.accessibility.AccessibilityNodeInfoCompat;
|
import androidx.core.view.accessibility.AccessibilityNodeInfoCompat;
|
||||||
|
|
||||||
|
import org.telegram.messenger.AndroidUtilities;
|
||||||
|
import org.telegram.messenger.BuildVars;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -35,7 +38,7 @@ import java.util.Arrays;
|
||||||
*/
|
*/
|
||||||
public class GridLayoutManager extends LinearLayoutManager {
|
public class GridLayoutManager extends LinearLayoutManager {
|
||||||
|
|
||||||
private static final boolean DEBUG = false;
|
private static final boolean DEBUG = BuildVars.DEBUG_VERSION;
|
||||||
private static final String TAG = "GridLayoutManager";
|
private static final String TAG = "GridLayoutManager";
|
||||||
public static final int DEFAULT_SPAN_COUNT = -1;
|
public static final int DEFAULT_SPAN_COUNT = -1;
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -61,6 +61,7 @@ import android.widget.OverScroller;
|
||||||
import org.telegram.messenger.AndroidUtilities;
|
import org.telegram.messenger.AndroidUtilities;
|
||||||
import org.telegram.messenger.BuildConfig;
|
import org.telegram.messenger.BuildConfig;
|
||||||
import org.telegram.messenger.BuildVars;
|
import org.telegram.messenger.BuildVars;
|
||||||
|
import org.telegram.messenger.FileLog;
|
||||||
|
|
||||||
import androidx.annotation.CallSuper;
|
import androidx.annotation.CallSuper;
|
||||||
import androidx.annotation.IntDef;
|
import androidx.annotation.IntDef;
|
||||||
|
@ -4473,8 +4474,8 @@ public class RecyclerView extends ViewGroup implements ScrollingView,
|
||||||
for (int i = 0; i < childCount; i++) {
|
for (int i = 0; i < childCount; i++) {
|
||||||
final ViewHolder holder = getChildViewHolderInt(mChildHelper.getUnfilteredChildAt(i));
|
final ViewHolder holder = getChildViewHolderInt(mChildHelper.getUnfilteredChildAt(i));
|
||||||
if (DEBUG && holder.mPosition == -1 && !holder.isRemoved()) {
|
if (DEBUG && holder.mPosition == -1 && !holder.isRemoved()) {
|
||||||
throw new IllegalStateException("view holder cannot have position -1 unless it"
|
FileLog.e(new IllegalStateException("view holder cannot have position -1 unless it"
|
||||||
+ " is removed" + exceptionLabel());
|
+ " is removed" + exceptionLabel()));
|
||||||
}
|
}
|
||||||
if (!holder.shouldIgnore()) {
|
if (!holder.shouldIgnore()) {
|
||||||
holder.saveOldPosition();
|
holder.saveOldPosition();
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
*/
|
*/
|
||||||
package androidx.recyclerview.widget;
|
package androidx.recyclerview.widget;
|
||||||
|
|
||||||
import org.telegram.messenger.BuildVars;
|
import org.telegram.messenger.FileLog;
|
||||||
|
|
||||||
import static androidx.recyclerview.widget.ViewInfoStore.InfoRecord.FLAG_APPEAR;
|
import static androidx.recyclerview.widget.ViewInfoStore.InfoRecord.FLAG_APPEAR;
|
||||||
import static androidx.recyclerview.widget.ViewInfoStore.InfoRecord.FLAG_APPEAR_AND_DISAPPEAR;
|
import static androidx.recyclerview.widget.ViewInfoStore.InfoRecord.FLAG_APPEAR_AND_DISAPPEAR;
|
||||||
|
@ -38,8 +38,6 @@ class ViewInfoStore {
|
||||||
|
|
||||||
private static final boolean DEBUG = false;
|
private static final boolean DEBUG = false;
|
||||||
|
|
||||||
private boolean processing;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* View data records for pre-layout
|
* View data records for pre-layout
|
||||||
*/
|
*/
|
||||||
|
@ -117,12 +115,6 @@ class ViewInfoStore {
|
||||||
}
|
}
|
||||||
// if not pre-post flag is left, clear.
|
// if not pre-post flag is left, clear.
|
||||||
if ((record.flags & (FLAG_PRE | FLAG_POST)) == 0) {
|
if ((record.flags & (FLAG_PRE | FLAG_POST)) == 0) {
|
||||||
if (processing) {
|
|
||||||
if (BuildVars.DEBUG_VERSION) {
|
|
||||||
throw new RuntimeException("popFromLayoutStep while processing");
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
mLayoutHolderMap.removeAt(index);
|
mLayoutHolderMap.removeAt(index);
|
||||||
InfoRecord.recycle(record);
|
InfoRecord.recycle(record);
|
||||||
}
|
}
|
||||||
|
@ -224,10 +216,17 @@ class ViewInfoStore {
|
||||||
}
|
}
|
||||||
|
|
||||||
void process(ProcessCallback callback) {
|
void process(ProcessCallback callback) {
|
||||||
processing = true;
|
|
||||||
for (int index = mLayoutHolderMap.size() - 1; index >= 0; index--) {
|
for (int index = mLayoutHolderMap.size() - 1; index >= 0; index--) {
|
||||||
final RecyclerView.ViewHolder viewHolder = mLayoutHolderMap.keyAt(index);
|
final RecyclerView.ViewHolder viewHolder = mLayoutHolderMap.keyAt(index);
|
||||||
final InfoRecord record = mLayoutHolderMap.removeAt(index);
|
InfoRecord record = null;
|
||||||
|
try {
|
||||||
|
record = mLayoutHolderMap.removeAt(index);
|
||||||
|
} catch (Exception e) {
|
||||||
|
FileLog.e(e);
|
||||||
|
}
|
||||||
|
if (record == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if ((record.flags & FLAG_APPEAR_AND_DISAPPEAR) == FLAG_APPEAR_AND_DISAPPEAR) {
|
if ((record.flags & FLAG_APPEAR_AND_DISAPPEAR) == FLAG_APPEAR_AND_DISAPPEAR) {
|
||||||
// Appeared then disappeared. Not useful for animations.
|
// Appeared then disappeared. Not useful for animations.
|
||||||
callback.unused(viewHolder);
|
callback.unused(viewHolder);
|
||||||
|
@ -259,7 +258,6 @@ class ViewInfoStore {
|
||||||
}
|
}
|
||||||
InfoRecord.recycle(record);
|
InfoRecord.recycle(record);
|
||||||
}
|
}
|
||||||
processing = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -275,12 +273,6 @@ class ViewInfoStore {
|
||||||
}
|
}
|
||||||
final InfoRecord info = mLayoutHolderMap.get(holder);
|
final InfoRecord info = mLayoutHolderMap.get(holder);
|
||||||
if (info != null) {
|
if (info != null) {
|
||||||
if (processing) {
|
|
||||||
if (BuildVars.DEBUG_VERSION) {
|
|
||||||
throw new RuntimeException("removeViewHolder while processing");
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
mLayoutHolderMap.remove(holder);
|
mLayoutHolderMap.remove(holder);
|
||||||
InfoRecord.recycle(info);
|
InfoRecord.recycle(info);
|
||||||
}
|
}
|
||||||
|
|
|
@ -315,7 +315,7 @@ public class ApplicationLoader extends Application {
|
||||||
public static boolean isConnectedOrConnectingToWiFi() {
|
public static boolean isConnectedOrConnectingToWiFi() {
|
||||||
try {
|
try {
|
||||||
ensureCurrentNetworkGet(false);
|
ensureCurrentNetworkGet(false);
|
||||||
if (currentNetworkInfo != null && currentNetworkInfo.getType() == ConnectivityManager.TYPE_WIFI) {
|
if (currentNetworkInfo != null && (currentNetworkInfo.getType() == ConnectivityManager.TYPE_WIFI || currentNetworkInfo.getType() == ConnectivityManager.TYPE_ETHERNET)) {
|
||||||
NetworkInfo.State state = currentNetworkInfo.getState();
|
NetworkInfo.State state = currentNetworkInfo.getState();
|
||||||
if (state == NetworkInfo.State.CONNECTED || state == NetworkInfo.State.CONNECTING || state == NetworkInfo.State.SUSPENDED) {
|
if (state == NetworkInfo.State.CONNECTED || state == NetworkInfo.State.CONNECTING || state == NetworkInfo.State.SUSPENDED) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -330,7 +330,7 @@ public class ApplicationLoader extends Application {
|
||||||
public static boolean isConnectedToWiFi() {
|
public static boolean isConnectedToWiFi() {
|
||||||
try {
|
try {
|
||||||
ensureCurrentNetworkGet(false);
|
ensureCurrentNetworkGet(false);
|
||||||
if (currentNetworkInfo != null && currentNetworkInfo.getType() == ConnectivityManager.TYPE_WIFI && currentNetworkInfo.getState() == NetworkInfo.State.CONNECTED) {
|
if (currentNetworkInfo != null && (currentNetworkInfo.getType() == ConnectivityManager.TYPE_WIFI || currentNetworkInfo.getType() == ConnectivityManager.TYPE_ETHERNET) && currentNetworkInfo.getState() == NetworkInfo.State.CONNECTED) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -360,19 +360,18 @@ public class ApplicationLoader extends Application {
|
||||||
|
|
||||||
public static int getAutodownloadNetworkType() {
|
public static int getAutodownloadNetworkType() {
|
||||||
try {
|
try {
|
||||||
ConnectivityManager connectivityManager = (ConnectivityManager) ApplicationLoader.applicationContext.getSystemService(Context.CONNECTIVITY_SERVICE);
|
ensureCurrentNetworkGet(false);
|
||||||
NetworkInfo netInfo = connectivityManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
|
if (currentNetworkInfo == null) {
|
||||||
if (netInfo != null) {
|
return StatsController.TYPE_MOBILE;
|
||||||
if (netInfo.getState() == NetworkInfo.State.CONNECTED) {
|
}
|
||||||
if (connectivityManager.isActiveNetworkMetered()) {
|
if (currentNetworkInfo.getType() == ConnectivityManager.TYPE_WIFI || currentNetworkInfo.getType() == ConnectivityManager.TYPE_ETHERNET) {
|
||||||
return StatsController.TYPE_MOBILE;
|
if (connectivityManager.isActiveNetworkMetered()) {
|
||||||
} else {
|
return StatsController.TYPE_MOBILE;
|
||||||
return StatsController.TYPE_WIFI;
|
} else {
|
||||||
}
|
return StatsController.TYPE_WIFI;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
netInfo = connectivityManager.getActiveNetworkInfo();
|
if (currentNetworkInfo.isRoaming()) {
|
||||||
if (netInfo != null && netInfo.isRoaming()) {
|
|
||||||
return StatsController.TYPE_ROAMING;
|
return StatsController.TYPE_ROAMING;
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
|
@ -19,7 +19,7 @@ public class BuildVars {
|
||||||
public static boolean USE_CLOUD_STRINGS = true;
|
public static boolean USE_CLOUD_STRINGS = true;
|
||||||
public static boolean CHECK_UPDATES = true;
|
public static boolean CHECK_UPDATES = true;
|
||||||
public static boolean TON_WALLET_STANDALONE = false;
|
public static boolean TON_WALLET_STANDALONE = false;
|
||||||
public static int BUILD_VERSION = 1984;
|
public static int BUILD_VERSION = 1985;
|
||||||
public static String BUILD_VERSION_STRING = "6.2.0";
|
public static String BUILD_VERSION_STRING = "6.2.0";
|
||||||
public static int APP_ID = 4;
|
public static int APP_ID = 4;
|
||||||
public static String APP_HASH = "014b35b6184100b085b0d0572f9b5103";
|
public static String APP_HASH = "014b35b6184100b085b0d0572f9b5103";
|
||||||
|
|
|
@ -4802,13 +4802,17 @@ public class MessageObject {
|
||||||
if (messageOwner.media instanceof TLRPC.TL_messageMediaPhoto) {
|
if (messageOwner.media instanceof TLRPC.TL_messageMediaPhoto) {
|
||||||
return messageOwner.media.photo != null && messageOwner.media.photo.has_stickers;
|
return messageOwner.media.photo != null && messageOwner.media.photo.has_stickers;
|
||||||
} else if (messageOwner.media instanceof TLRPC.TL_messageMediaDocument) {
|
} else if (messageOwner.media instanceof TLRPC.TL_messageMediaDocument) {
|
||||||
TLRPC.Document document = messageOwner.media.document;
|
return isDocumentHasAttachedStickers(messageOwner.media.document);
|
||||||
if (document != null) {
|
}
|
||||||
for (int a = 0; a < document.attributes.size(); a++) {
|
return false;
|
||||||
TLRPC.DocumentAttribute attribute = document.attributes.get(a);
|
}
|
||||||
if (attribute instanceof TLRPC.TL_documentAttributeHasStickers) {
|
|
||||||
return true;
|
public static boolean isDocumentHasAttachedStickers(TLRPC.Document document) {
|
||||||
}
|
if (document != null) {
|
||||||
|
for (int a = 0; a < document.attributes.size(); a++) {
|
||||||
|
TLRPC.DocumentAttribute attribute = document.attributes.get(a);
|
||||||
|
if (attribute instanceof TLRPC.TL_documentAttributeHasStickers) {
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -272,6 +272,7 @@ public class MessagesController extends BaseController implements NotificationCe
|
||||||
public int webFileDatacenterId;
|
public int webFileDatacenterId;
|
||||||
public String suggestedLangCode;
|
public String suggestedLangCode;
|
||||||
public boolean qrLoginCamera;
|
public boolean qrLoginCamera;
|
||||||
|
public boolean saveGifsWithStickers;
|
||||||
private String installReferer;
|
private String installReferer;
|
||||||
public ArrayList<String> gifSearchEmojies = new ArrayList<>();
|
public ArrayList<String> gifSearchEmojies = new ArrayList<>();
|
||||||
public HashSet<String> diceEmojies;
|
public HashSet<String> diceEmojies;
|
||||||
|
@ -621,6 +622,7 @@ public class MessagesController extends BaseController implements NotificationCe
|
||||||
suggestedLangCode = mainPreferences.getString("suggestedLangCode", "en");
|
suggestedLangCode = mainPreferences.getString("suggestedLangCode", "en");
|
||||||
animatedEmojisZoom = mainPreferences.getFloat("animatedEmojisZoom", 0.625f);
|
animatedEmojisZoom = mainPreferences.getFloat("animatedEmojisZoom", 0.625f);
|
||||||
qrLoginCamera = mainPreferences.getBoolean("qrLoginCamera", false);
|
qrLoginCamera = mainPreferences.getBoolean("qrLoginCamera", false);
|
||||||
|
saveGifsWithStickers = mainPreferences.getBoolean("saveGifsWithStickers", false);
|
||||||
filtersEnabled = mainPreferences.getBoolean("filtersEnabled", false);
|
filtersEnabled = mainPreferences.getBoolean("filtersEnabled", false);
|
||||||
showFiltersTooltip = mainPreferences.getBoolean("showFiltersTooltip", false);
|
showFiltersTooltip = mainPreferences.getBoolean("showFiltersTooltip", false);
|
||||||
|
|
||||||
|
@ -1213,6 +1215,17 @@ public class MessagesController extends BaseController implements NotificationCe
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case "save_gifs_with_stickers": {
|
||||||
|
if (value.value instanceof TLRPC.TL_jsonBool) {
|
||||||
|
TLRPC.TL_jsonBool bool = (TLRPC.TL_jsonBool) value.value;
|
||||||
|
if (bool.value != saveGifsWithStickers) {
|
||||||
|
saveGifsWithStickers = bool.value;
|
||||||
|
editor.putBoolean("saveGifsWithStickers", saveGifsWithStickers);
|
||||||
|
changed = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
case "emojies_send_dice": {
|
case "emojies_send_dice": {
|
||||||
HashSet<String> newEmojies = new HashSet<>();
|
HashSet<String> newEmojies = new HashSet<>();
|
||||||
if (value.value instanceof TLRPC.TL_jsonArray) {
|
if (value.value instanceof TLRPC.TL_jsonArray) {
|
||||||
|
@ -12070,7 +12083,15 @@ public class MessagesController extends BaseController implements NotificationCe
|
||||||
}
|
}
|
||||||
if (message.isOut() && !message.isSending() && !message.isForwarded()) {
|
if (message.isOut() && !message.isSending() && !message.isForwarded()) {
|
||||||
if (message.isNewGif()) {
|
if (message.isNewGif()) {
|
||||||
getMediaDataController().addRecentGif(message.messageOwner.media.document, message.messageOwner.date);
|
boolean save;
|
||||||
|
if (MessageObject.isDocumentHasAttachedStickers(message.messageOwner.media.document)) {
|
||||||
|
save = getMessagesController().saveGifsWithStickers;
|
||||||
|
} else {
|
||||||
|
save = true;
|
||||||
|
}
|
||||||
|
if (save) {
|
||||||
|
getMediaDataController().addRecentGif(message.messageOwner.media.document, message.messageOwner.date);
|
||||||
|
}
|
||||||
} else if (!message.isAnimatedEmoji() && (message.isSticker() || message.isAnimatedSticker())) {
|
} else if (!message.isAnimatedEmoji() && (message.isSticker() || message.isAnimatedSticker())) {
|
||||||
getMediaDataController().addRecentSticker(MediaDataController.TYPE_IMAGE, message, message.messageOwner.media.document, message.messageOwner.date, false);
|
getMediaDataController().addRecentSticker(MediaDataController.TYPE_IMAGE, message, message.messageOwner.media.document, message.messageOwner.date, false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1764,6 +1764,7 @@ public class MessagesStorage extends BaseController {
|
||||||
SparseArray<TLRPC.User> encUsersDict = new SparseArray<>();
|
SparseArray<TLRPC.User> encUsersDict = new SparseArray<>();
|
||||||
SparseArray<Integer> encryptedChatsByUsersCount = new SparseArray<>();
|
SparseArray<Integer> encryptedChatsByUsersCount = new SparseArray<>();
|
||||||
SparseArray<Boolean> mutedDialogs = new SparseArray<>();
|
SparseArray<Boolean> mutedDialogs = new SparseArray<>();
|
||||||
|
SparseArray<Boolean> archivedDialogs = new SparseArray<>();
|
||||||
if (!usersToLoad.isEmpty()) {
|
if (!usersToLoad.isEmpty()) {
|
||||||
getUsersInternal(TextUtils.join(",", usersToLoad), users);
|
getUsersInternal(TextUtils.join(",", usersToLoad), users);
|
||||||
for (int a = 0, N = users.size(); a < N; a++) {
|
for (int a = 0, N = users.size(); a < N; a++) {
|
||||||
|
@ -1774,6 +1775,9 @@ public class MessagesStorage extends BaseController {
|
||||||
if (muted) {
|
if (muted) {
|
||||||
mutedDialogs.put(user.id, true);
|
mutedDialogs.put(user.id, true);
|
||||||
}
|
}
|
||||||
|
if (idx1 == 1) {
|
||||||
|
archivedDialogs.put(user.id, true);
|
||||||
|
}
|
||||||
if (user.bot) {
|
if (user.bot) {
|
||||||
bots[idx1][idx2]++;
|
bots[idx1][idx2]++;
|
||||||
} else if (user.self || user.contact) {
|
} else if (user.self || user.contact) {
|
||||||
|
@ -1807,6 +1811,9 @@ public class MessagesStorage extends BaseController {
|
||||||
if (muted) {
|
if (muted) {
|
||||||
mutedDialogs.put(user.id, true);
|
mutedDialogs.put(user.id, true);
|
||||||
}
|
}
|
||||||
|
if (idx1 == 1) {
|
||||||
|
archivedDialogs.put(user.id, true);
|
||||||
|
}
|
||||||
if (user.self || user.contact) {
|
if (user.self || user.contact) {
|
||||||
contacts[idx1][idx2]++;
|
contacts[idx1][idx2]++;
|
||||||
} else {
|
} else {
|
||||||
|
@ -1832,6 +1839,9 @@ public class MessagesStorage extends BaseController {
|
||||||
if (muted) {
|
if (muted) {
|
||||||
mutedDialogs.put(-chat.id, true);
|
mutedDialogs.put(-chat.id, true);
|
||||||
}
|
}
|
||||||
|
if (idx1 == 1) {
|
||||||
|
archivedDialogs.put(-chat.id, true);
|
||||||
|
}
|
||||||
if (ChatObject.isChannel(chat) && !chat.megagroup) {
|
if (ChatObject.isChannel(chat) && !chat.megagroup) {
|
||||||
channels[idx1][idx2]++;
|
channels[idx1][idx2]++;
|
||||||
} else {
|
} else {
|
||||||
|
@ -1945,62 +1955,51 @@ public class MessagesStorage extends BaseController {
|
||||||
for (int b = 0, N2 = filter.alwaysShow.size(); b < N2; b++) {
|
for (int b = 0, N2 = filter.alwaysShow.size(); b < N2; b++) {
|
||||||
int did = filter.alwaysShow.get(b);
|
int did = filter.alwaysShow.get(b);
|
||||||
if (did > 0) {
|
if (did > 0) {
|
||||||
TLRPC.User user = usersDict.get(did);
|
for (int i = 0; i < 2; i++) {
|
||||||
if (user != null) {
|
SparseArray<TLRPC.User> dict = i == 0 ? usersDict : encUsersDict;
|
||||||
if ((flags & MessagesController.DIALOG_FILTER_FLAG_EXCLUDE_MUTED) != 0 && mutedDialogs.indexOfKey(user.id) >= 0) {
|
TLRPC.User user = dict.get(did);
|
||||||
unreadCount++;
|
if (user != null) {
|
||||||
} else {
|
int count;
|
||||||
if (user.bot) {
|
if (i == 0) {
|
||||||
if ((flags & MessagesController.DIALOG_FILTER_FLAG_BOTS) == 0) {
|
count = 1;
|
||||||
unreadCount++;
|
|
||||||
}
|
|
||||||
} else if (user.self || user.contact) {
|
|
||||||
if ((flags & MessagesController.DIALOG_FILTER_FLAG_CONTACTS) == 0) {
|
|
||||||
unreadCount++;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if ((flags & MessagesController.DIALOG_FILTER_FLAG_NON_CONTACTS) == 0) {
|
count = encryptedChatsByUsersCount.get(did, 0);
|
||||||
unreadCount++;
|
if (count == 0) {
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
int flag;
|
||||||
}
|
|
||||||
user = encUsersDict.get(did);
|
|
||||||
if (user != null) {
|
|
||||||
int count = encryptedChatsByUsersCount.get(did, 0);
|
|
||||||
if ((flags & MessagesController.DIALOG_FILTER_FLAG_EXCLUDE_MUTED) != 0 && mutedDialogs.indexOfKey(user.id) >= 0) {
|
|
||||||
unreadCount += count;
|
|
||||||
} else {
|
|
||||||
if (user.bot) {
|
if (user.bot) {
|
||||||
if ((flags & MessagesController.DIALOG_FILTER_FLAG_BOTS) == 0) {
|
flag = MessagesController.DIALOG_FILTER_FLAG_BOTS;
|
||||||
unreadCount += count;
|
|
||||||
}
|
|
||||||
} else if (user.self || user.contact) {
|
} else if (user.self || user.contact) {
|
||||||
if ((flags & MessagesController.DIALOG_FILTER_FLAG_CONTACTS) == 0) {
|
flag = MessagesController.DIALOG_FILTER_FLAG_CONTACTS;
|
||||||
unreadCount += count;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if ((flags & MessagesController.DIALOG_FILTER_FLAG_NON_CONTACTS) == 0) {
|
flag = MessagesController.DIALOG_FILTER_FLAG_NON_CONTACTS;
|
||||||
unreadCount += count;
|
}
|
||||||
}
|
if ((flags & flag) == 0) {
|
||||||
|
unreadCount += count;
|
||||||
|
} else if ((flags & MessagesController.DIALOG_FILTER_FLAG_EXCLUDE_MUTED) != 0 && mutedDialogs.indexOfKey(user.id) >= 0) {
|
||||||
|
unreadCount += count;
|
||||||
|
} else if ((flags & MessagesController.DIALOG_FILTER_FLAG_EXCLUDE_ARCHIVED) != 0 && archivedDialogs.indexOfKey(user.id) >= 0) {
|
||||||
|
unreadCount += count;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
TLRPC.Chat chat = chatsDict.get(-did);
|
TLRPC.Chat chat = chatsDict.get(-did);
|
||||||
if (chat != null) {
|
if (chat != null) {
|
||||||
if ((flags & MessagesController.DIALOG_FILTER_FLAG_EXCLUDE_MUTED) != 0 && mutedDialogs.indexOfKey(-chat.id) >= 0 && dialogsWithMentions.indexOfKey(-chat.id) < 0) {
|
int flag;
|
||||||
unreadCount++;
|
if (ChatObject.isChannel(chat) && !chat.megagroup) {
|
||||||
|
flag = MessagesController.DIALOG_FILTER_FLAG_CHANNELS;
|
||||||
} else {
|
} else {
|
||||||
if (ChatObject.isChannel(chat) && !chat.megagroup) {
|
flag = MessagesController.DIALOG_FILTER_FLAG_GROUPS;
|
||||||
if ((flags & MessagesController.DIALOG_FILTER_FLAG_CHANNELS) == 0) {
|
}
|
||||||
unreadCount++;
|
if ((flags & flag) == 0) {
|
||||||
}
|
unreadCount++;
|
||||||
} else {
|
} else if ((flags & MessagesController.DIALOG_FILTER_FLAG_EXCLUDE_MUTED) != 0 && mutedDialogs.indexOfKey(-chat.id) >= 0 && dialogsWithMentions.indexOfKey(-chat.id) < 0) {
|
||||||
if ((flags & MessagesController.DIALOG_FILTER_FLAG_GROUPS) == 0) {
|
unreadCount++;
|
||||||
unreadCount++;
|
} else if ((flags & MessagesController.DIALOG_FILTER_FLAG_EXCLUDE_ARCHIVED) != 0 && archivedDialogs.indexOfKey(-chat.id) >= 0) {
|
||||||
}
|
unreadCount++;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2008,18 +2007,50 @@ public class MessagesStorage extends BaseController {
|
||||||
for (int b = 0, N2 = filter.neverShow.size(); b < N2; b++) {
|
for (int b = 0, N2 = filter.neverShow.size(); b < N2; b++) {
|
||||||
int did = filter.neverShow.get(b);
|
int did = filter.neverShow.get(b);
|
||||||
if (did > 0) {
|
if (did > 0) {
|
||||||
TLRPC.User user = usersDict.get(did);
|
for (int i = 0; i < 2; i++) {
|
||||||
if (user != null) {
|
SparseArray<TLRPC.User> dict = i == 0 ? usersDict : encUsersDict;
|
||||||
unreadCount--;
|
TLRPC.User user = dict.get(did);
|
||||||
}
|
if (user != null) {
|
||||||
user = encUsersDict.get(did);
|
int count;
|
||||||
if (user != null) {
|
if (i == 0) {
|
||||||
unreadCount -= encryptedChatsByUsersCount.get(did, 0);
|
count = 1;
|
||||||
|
} else {
|
||||||
|
count = encryptedChatsByUsersCount.get(did, 0);
|
||||||
|
if (count == 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
int flag;
|
||||||
|
if (user.bot) {
|
||||||
|
flag = MessagesController.DIALOG_FILTER_FLAG_BOTS;
|
||||||
|
} else if (user.self || user.contact) {
|
||||||
|
flag = MessagesController.DIALOG_FILTER_FLAG_CONTACTS;
|
||||||
|
} else {
|
||||||
|
flag = MessagesController.DIALOG_FILTER_FLAG_NON_CONTACTS;
|
||||||
|
}
|
||||||
|
if ((flags & flag) != 0) {
|
||||||
|
if (((flags & MessagesController.DIALOG_FILTER_FLAG_EXCLUDE_ARCHIVED) == 0 || archivedDialogs.indexOfKey(user.id) < 0) &&
|
||||||
|
((flags & MessagesController.DIALOG_FILTER_FLAG_EXCLUDE_MUTED) == 0 || mutedDialogs.indexOfKey(user.id) < 0)) {
|
||||||
|
unreadCount -= count;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
TLRPC.Chat chat = chatsDict.get(-did);
|
TLRPC.Chat chat = chatsDict.get(-did);
|
||||||
if (chat != null) {
|
if (chat != null) {
|
||||||
unreadCount--;
|
int flag;
|
||||||
|
if (ChatObject.isChannel(chat) && !chat.megagroup) {
|
||||||
|
flag = MessagesController.DIALOG_FILTER_FLAG_CHANNELS;
|
||||||
|
} else {
|
||||||
|
flag = MessagesController.DIALOG_FILTER_FLAG_GROUPS;
|
||||||
|
}
|
||||||
|
if ((flags & flag) != 0) {
|
||||||
|
if (((flags & MessagesController.DIALOG_FILTER_FLAG_EXCLUDE_ARCHIVED) == 0 || archivedDialogs.indexOfKey(-chat.id) < 0 || dialogsWithMentions.indexOfKey(-chat.id) >= 0) &&
|
||||||
|
((flags & MessagesController.DIALOG_FILTER_FLAG_EXCLUDE_MUTED) == 0 || mutedDialogs.indexOfKey(-chat.id) < 0)) {
|
||||||
|
unreadCount--;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3726,6 +3757,7 @@ public class MessagesStorage extends BaseController {
|
||||||
SparseArray<TLRPC.User> encUsersDict = new SparseArray<>();
|
SparseArray<TLRPC.User> encUsersDict = new SparseArray<>();
|
||||||
SparseArray<Integer> encryptedChatsByUsersCount = new SparseArray<>();
|
SparseArray<Integer> encryptedChatsByUsersCount = new SparseArray<>();
|
||||||
SparseArray<Boolean> mutedDialogs = new SparseArray<>();
|
SparseArray<Boolean> mutedDialogs = new SparseArray<>();
|
||||||
|
SparseArray<Boolean> archivedDialogs = new SparseArray<>();
|
||||||
if (!usersToLoad.isEmpty()) {
|
if (!usersToLoad.isEmpty()) {
|
||||||
getUsersInternal(TextUtils.join(",", usersToLoad), users);
|
getUsersInternal(TextUtils.join(",", usersToLoad), users);
|
||||||
for (int a = 0, N = users.size(); a < N; a++) {
|
for (int a = 0, N = users.size(); a < N; a++) {
|
||||||
|
@ -3736,6 +3768,9 @@ public class MessagesStorage extends BaseController {
|
||||||
if (muted) {
|
if (muted) {
|
||||||
mutedDialogs.put(user.id, true);
|
mutedDialogs.put(user.id, true);
|
||||||
}
|
}
|
||||||
|
if (idx1 == 1) {
|
||||||
|
archivedDialogs.put(user.id, true);
|
||||||
|
}
|
||||||
if (user.bot) {
|
if (user.bot) {
|
||||||
bots[idx1][idx2]++;
|
bots[idx1][idx2]++;
|
||||||
} else if (user.self || user.contact) {
|
} else if (user.self || user.contact) {
|
||||||
|
@ -3769,6 +3804,9 @@ public class MessagesStorage extends BaseController {
|
||||||
if (muted) {
|
if (muted) {
|
||||||
mutedDialogs.put(user.id, true);
|
mutedDialogs.put(user.id, true);
|
||||||
}
|
}
|
||||||
|
if (idx1 == 1) {
|
||||||
|
archivedDialogs.put(user.id, true);
|
||||||
|
}
|
||||||
if (user.self || user.contact) {
|
if (user.self || user.contact) {
|
||||||
contacts[idx1][idx2]++;
|
contacts[idx1][idx2]++;
|
||||||
} else {
|
} else {
|
||||||
|
@ -3794,6 +3832,9 @@ public class MessagesStorage extends BaseController {
|
||||||
if (muted) {
|
if (muted) {
|
||||||
mutedDialogs.put(-chat.id, true);
|
mutedDialogs.put(-chat.id, true);
|
||||||
}
|
}
|
||||||
|
if (idx1 == 1) {
|
||||||
|
archivedDialogs.put(-chat.id, true);
|
||||||
|
}
|
||||||
if (muted && dialogsToUpdateMentions != null && dialogsToUpdateMentions.indexOfKey(-chat.id) >= 0) {
|
if (muted && dialogsToUpdateMentions != null && dialogsToUpdateMentions.indexOfKey(-chat.id) >= 0) {
|
||||||
if (ChatObject.isChannel(chat) && !chat.megagroup) {
|
if (ChatObject.isChannel(chat) && !chat.megagroup) {
|
||||||
mentionChannels[idx1]++;
|
mentionChannels[idx1]++;
|
||||||
|
@ -3993,24 +4034,109 @@ public class MessagesStorage extends BaseController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (int b = 0, N2 = filter.alwaysShow.size(); b < N2; b++) {
|
||||||
|
int did = filter.alwaysShow.get(b);
|
||||||
|
if (did > 0) {
|
||||||
|
for (int i = 0; i < 2; i++) {
|
||||||
|
SparseArray<TLRPC.User> dict = i == 0 ? usersDict : encUsersDict;
|
||||||
|
TLRPC.User user = dict.get(did);
|
||||||
|
if (user != null) {
|
||||||
|
int count;
|
||||||
|
if (i == 0) {
|
||||||
|
count = 1;
|
||||||
|
} else {
|
||||||
|
count = encryptedChatsByUsersCount.get(did, 0);
|
||||||
|
if (count == 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
int flag;
|
||||||
|
if (user.bot) {
|
||||||
|
flag = MessagesController.DIALOG_FILTER_FLAG_BOTS;
|
||||||
|
} else if (user.self || user.contact) {
|
||||||
|
flag = MessagesController.DIALOG_FILTER_FLAG_CONTACTS;
|
||||||
|
} else {
|
||||||
|
flag = MessagesController.DIALOG_FILTER_FLAG_NON_CONTACTS;
|
||||||
|
}
|
||||||
|
if ((flags & flag) == 0) {
|
||||||
|
unreadCount -= count;
|
||||||
|
} else if ((flags & MessagesController.DIALOG_FILTER_FLAG_EXCLUDE_MUTED) != 0 && mutedDialogs.indexOfKey(user.id) >= 0) {
|
||||||
|
unreadCount -= count;
|
||||||
|
} else if ((flags & MessagesController.DIALOG_FILTER_FLAG_EXCLUDE_ARCHIVED) != 0 && archivedDialogs.indexOfKey(user.id) >= 0) {
|
||||||
|
unreadCount -= count;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
TLRPC.Chat chat = chatsDict.get(-did);
|
||||||
|
if (chat != null) {
|
||||||
|
int flag;
|
||||||
|
if (ChatObject.isChannel(chat) && !chat.megagroup) {
|
||||||
|
flag = MessagesController.DIALOG_FILTER_FLAG_CHANNELS;
|
||||||
|
} else {
|
||||||
|
flag = MessagesController.DIALOG_FILTER_FLAG_GROUPS;
|
||||||
|
}
|
||||||
|
if ((flags & flag) == 0) {
|
||||||
|
unreadCount--;
|
||||||
|
} else if ((flags & MessagesController.DIALOG_FILTER_FLAG_EXCLUDE_MUTED) != 0 && mutedDialogs.indexOfKey(-chat.id) >= 0 && dialogsWithMentions.indexOfKey(-chat.id) < 0) {
|
||||||
|
unreadCount--;
|
||||||
|
} else if ((flags & MessagesController.DIALOG_FILTER_FLAG_EXCLUDE_ARCHIVED) != 0 && archivedDialogs.indexOfKey(-chat.id) >= 0) {
|
||||||
|
unreadCount--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
for (int b = 0, N2 = filter.neverShow.size(); b < N2; b++) {
|
for (int b = 0, N2 = filter.neverShow.size(); b < N2; b++) {
|
||||||
int did = filter.neverShow.get(b);
|
int did = filter.neverShow.get(b);
|
||||||
if (dialogsToUpdateMentions != null && dialogsToUpdateMentions.indexOfKey(did) >= 0 && mutedDialogs.indexOfKey(did) < 0) {
|
if (dialogsToUpdateMentions != null && dialogsToUpdateMentions.indexOfKey(did) >= 0 && mutedDialogs.indexOfKey(did) < 0) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (did > 0) {
|
if (did > 0) {
|
||||||
TLRPC.User user = usersDict.get(did);
|
for (int i = 0; i < 2; i++) {
|
||||||
if (user != null) {
|
SparseArray<TLRPC.User> dict = i == 0 ? usersDict : encUsersDict;
|
||||||
unreadCount++;
|
TLRPC.User user = dict.get(did);
|
||||||
}
|
if (user != null) {
|
||||||
user = encUsersDict.get(did);
|
int count;
|
||||||
if (user != null) {
|
if (i == 0) {
|
||||||
unreadCount += encryptedChatsByUsersCount.get(did, 0);
|
count = 1;
|
||||||
|
} else {
|
||||||
|
count = encryptedChatsByUsersCount.get(did, 0);
|
||||||
|
if (count == 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
int flag;
|
||||||
|
if (user.bot) {
|
||||||
|
flag = MessagesController.DIALOG_FILTER_FLAG_BOTS;
|
||||||
|
} else if (user.self || user.contact) {
|
||||||
|
flag = MessagesController.DIALOG_FILTER_FLAG_CONTACTS;
|
||||||
|
} else {
|
||||||
|
flag = MessagesController.DIALOG_FILTER_FLAG_NON_CONTACTS;
|
||||||
|
}
|
||||||
|
if ((flags & flag) != 0) {
|
||||||
|
if (((flags & MessagesController.DIALOG_FILTER_FLAG_EXCLUDE_ARCHIVED) == 0 || archivedDialogs.indexOfKey(user.id) < 0) &&
|
||||||
|
((flags & MessagesController.DIALOG_FILTER_FLAG_EXCLUDE_MUTED) == 0 || mutedDialogs.indexOfKey(user.id) < 0)) {
|
||||||
|
unreadCount += count;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
TLRPC.Chat chat = chatsDict.get(-did);
|
TLRPC.Chat chat = chatsDict.get(-did);
|
||||||
if (chat != null) {
|
if (chat != null) {
|
||||||
unreadCount++;
|
int flag;
|
||||||
|
if (ChatObject.isChannel(chat) && !chat.megagroup) {
|
||||||
|
flag = MessagesController.DIALOG_FILTER_FLAG_CHANNELS;
|
||||||
|
} else {
|
||||||
|
flag = MessagesController.DIALOG_FILTER_FLAG_GROUPS;
|
||||||
|
}
|
||||||
|
if ((flags & flag) != 0) {
|
||||||
|
if (((flags & MessagesController.DIALOG_FILTER_FLAG_EXCLUDE_ARCHIVED) == 0 || archivedDialogs.indexOfKey(-chat.id) < 0 || dialogsWithMentions.indexOfKey(-chat.id) >= 0) &&
|
||||||
|
((flags & MessagesController.DIALOG_FILTER_FLAG_EXCLUDE_MUTED) == 0 || mutedDialogs.indexOfKey(-chat.id) < 0)) {
|
||||||
|
unreadCount++;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4766,7 +4766,15 @@ public class SendMessagesHelper extends BaseController implements NotificationCe
|
||||||
|
|
||||||
if ((sentMessage.flags & TLRPC.MESSAGE_FLAG_FWD) == 0 && MessageObject.isOut(sentMessage)) {
|
if ((sentMessage.flags & TLRPC.MESSAGE_FLAG_FWD) == 0 && MessageObject.isOut(sentMessage)) {
|
||||||
if (MessageObject.isNewGifDocument(sentMessage.media.document)) {
|
if (MessageObject.isNewGifDocument(sentMessage.media.document)) {
|
||||||
getMediaDataController().addRecentGif(sentMessage.media.document, sentMessage.date);
|
boolean save;
|
||||||
|
if (MessageObject.isDocumentHasAttachedStickers(sentMessage.media.document)) {
|
||||||
|
save = getMessagesController().saveGifsWithStickers;
|
||||||
|
} else {
|
||||||
|
save = true;
|
||||||
|
}
|
||||||
|
if (save) {
|
||||||
|
getMediaDataController().addRecentGif(sentMessage.media.document, sentMessage.date);
|
||||||
|
}
|
||||||
} else if (MessageObject.isStickerDocument(sentMessage.media.document) || MessageObject.isAnimatedStickerDocument(sentMessage.media.document, true)) {
|
} else if (MessageObject.isStickerDocument(sentMessage.media.document) || MessageObject.isAnimatedStickerDocument(sentMessage.media.document, true)) {
|
||||||
getMediaDataController().addRecentSticker(MediaDataController.TYPE_IMAGE, sentMessage, sentMessage.media.document, sentMessage.date, false);
|
getMediaDataController().addRecentSticker(MediaDataController.TYPE_IMAGE, sentMessage, sentMessage.media.document, sentMessage.date, false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -676,7 +676,7 @@ public class CameraController implements MediaRecorder.OnInfoListener {
|
||||||
final File cacheFile = new File(FileLoader.getDirectory(FileLoader.MEDIA_DIR_CACHE), fileName);
|
final File cacheFile = new File(FileLoader.getDirectory(FileLoader.MEDIA_DIR_CACHE), fileName);
|
||||||
try {
|
try {
|
||||||
FileOutputStream stream = new FileOutputStream(cacheFile);
|
FileOutputStream stream = new FileOutputStream(cacheFile);
|
||||||
bitmap.compress(Bitmap.CompressFormat.JPEG, 80, stream);
|
bitmap.compress(Bitmap.CompressFormat.JPEG, 87, stream);
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
FileLog.e(e);
|
FileLog.e(e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -393,8 +393,9 @@ public class SimpleTextView extends View implements Drawable.Callback {
|
||||||
int textOffsetX = 0;
|
int textOffsetX = 0;
|
||||||
|
|
||||||
boolean fade = scrollNonFitText && (textDoesNotFit || scrollingOffset != 0);
|
boolean fade = scrollNonFitText && (textDoesNotFit || scrollingOffset != 0);
|
||||||
|
int restore = Integer.MIN_VALUE;
|
||||||
if (fade) {
|
if (fade) {
|
||||||
canvas.saveLayerAlpha(0, 0, getMeasuredWidth(), getMeasuredHeight(), 255, Canvas.ALL_SAVE_FLAG);
|
restore = canvas.saveLayerAlpha(0, 0, getMeasuredWidth(), getMeasuredHeight(), 255, Canvas.ALL_SAVE_FLAG);
|
||||||
}
|
}
|
||||||
|
|
||||||
totalWidth = textWidth;
|
totalWidth = textWidth;
|
||||||
|
@ -487,6 +488,9 @@ public class SimpleTextView extends View implements Drawable.Callback {
|
||||||
}
|
}
|
||||||
updateScrollAnimation();
|
updateScrollAnimation();
|
||||||
}
|
}
|
||||||
|
if (fade) {
|
||||||
|
canvas.restoreToCount(restore);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateScrollAnimation() {
|
private void updateScrollAnimation() {
|
||||||
|
|
|
@ -6339,11 +6339,11 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
textX += diff;
|
textX += diff;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (transitionParams.animateChangeProgress != 1f && transitionParams.animateMessageText) {
|
if (transitionParams.animateChangeProgress != 1.0f && transitionParams.animateMessageText) {
|
||||||
drawMessageText(canvas, transitionParams.animateOutTextBlocks, false, (1f - transitionParams.animateChangeProgress));
|
drawMessageText(canvas, transitionParams.animateOutTextBlocks, false, (1.0f - transitionParams.animateChangeProgress));
|
||||||
drawMessageText(canvas, currentMessageObject.textLayoutBlocks, true, transitionParams.animateChangeProgress);
|
drawMessageText(canvas, currentMessageObject.textLayoutBlocks, true, transitionParams.animateChangeProgress);
|
||||||
} else {
|
} else {
|
||||||
drawMessageText(canvas, currentMessageObject.textLayoutBlocks, true, 1f);
|
drawMessageText(canvas, currentMessageObject.textLayoutBlocks, true, 1.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -7063,75 +7063,77 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
}
|
}
|
||||||
|
|
||||||
private void drawMessageText(Canvas canvas, ArrayList<MessageObject.TextLayoutBlock> textLayoutBlocks, boolean origin, float alpha) {
|
private void drawMessageText(Canvas canvas, ArrayList<MessageObject.TextLayoutBlock> textLayoutBlocks, boolean origin, float alpha) {
|
||||||
if (textLayoutBlocks != null && !textLayoutBlocks.isEmpty()) {
|
if (textLayoutBlocks == null || textLayoutBlocks.isEmpty()) {
|
||||||
int oldAlpha = 0;
|
return;
|
||||||
int firstVisibleBlockNum;
|
}
|
||||||
int lastVisibleBlockNum;
|
int oldAlpha = 0;
|
||||||
if (origin) {
|
int firstVisibleBlockNum;
|
||||||
if (fullyDraw) {
|
int lastVisibleBlockNum;
|
||||||
this.firstVisibleBlockNum = 0;
|
if (origin) {
|
||||||
this.lastVisibleBlockNum = textLayoutBlocks.size();
|
if (fullyDraw) {
|
||||||
|
this.firstVisibleBlockNum = 0;
|
||||||
|
this.lastVisibleBlockNum = textLayoutBlocks.size();
|
||||||
|
}
|
||||||
|
firstVisibleBlockNum = this.firstVisibleBlockNum;
|
||||||
|
lastVisibleBlockNum = this.lastVisibleBlockNum;
|
||||||
|
} else {
|
||||||
|
firstVisibleBlockNum = 0;
|
||||||
|
lastVisibleBlockNum = textLayoutBlocks.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (firstVisibleBlockNum >= 0) {
|
||||||
|
int restore = Integer.MIN_VALUE;
|
||||||
|
if (alpha != 1.0f) {
|
||||||
|
if (currentBackgroundDrawable != null) {
|
||||||
|
int top = currentBackgroundDrawable.getBounds().top;
|
||||||
|
int bottom = currentBackgroundDrawable.getBounds().bottom;
|
||||||
|
|
||||||
|
if (getY() < 0) {
|
||||||
|
top = (int) -getY();
|
||||||
|
}
|
||||||
|
if (getY() + getMeasuredHeight() > parentHeight) {
|
||||||
|
bottom = (int) (parentHeight - getY());
|
||||||
|
}
|
||||||
|
rect.set(
|
||||||
|
currentBackgroundDrawable.getBounds().left, top,
|
||||||
|
currentBackgroundDrawable.getBounds().right, bottom
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
rect.set(0, 0, getMeasuredWidth(), getMeasuredHeight());
|
||||||
}
|
}
|
||||||
firstVisibleBlockNum = this.firstVisibleBlockNum;
|
restore = canvas.saveLayerAlpha(rect, (int) (alpha * 255), Canvas.ALL_SAVE_FLAG);
|
||||||
lastVisibleBlockNum = this.lastVisibleBlockNum;
|
}
|
||||||
} else {
|
for (int a = firstVisibleBlockNum; a <= lastVisibleBlockNum; a++) {
|
||||||
firstVisibleBlockNum = 0;
|
if (a >= textLayoutBlocks.size()) {
|
||||||
lastVisibleBlockNum = textLayoutBlocks.size();
|
break;
|
||||||
|
}
|
||||||
|
MessageObject.TextLayoutBlock block = textLayoutBlocks.get(a);
|
||||||
|
canvas.save();
|
||||||
|
canvas.translate(textX - (block.isRtl() ? (int) Math.ceil(currentMessageObject.textXOffset) : 0), textY + block.textYOffset);
|
||||||
|
if (pressedLink != null && a == linkBlockNum) {
|
||||||
|
for (int b = 0; b < urlPath.size(); b++) {
|
||||||
|
canvas.drawPath(urlPath.get(b), Theme.chat_urlPaint);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (a == linkSelectionBlockNum && !urlPathSelection.isEmpty()) {
|
||||||
|
for (int b = 0; b < urlPathSelection.size(); b++) {
|
||||||
|
canvas.drawPath(urlPathSelection.get(b), Theme.chat_textSearchSelectionPaint);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (delegate.getTextSelectionHelper() != null && transitionParams.animateChangeProgress == 1f) {
|
||||||
|
delegate.getTextSelectionHelper().draw(currentMessageObject, block, canvas);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
block.textLayout.draw(canvas);
|
||||||
|
} catch (Exception e) {
|
||||||
|
FileLog.e(e);
|
||||||
|
}
|
||||||
|
canvas.restore();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (firstVisibleBlockNum >= 0) {
|
if (restore != Integer.MIN_VALUE) {
|
||||||
if (alpha != 1f) {
|
canvas.restoreToCount(restore);
|
||||||
if (currentBackgroundDrawable != null) {
|
|
||||||
int top = currentBackgroundDrawable.getBounds().top;
|
|
||||||
int bottom = currentBackgroundDrawable.getBounds().bottom;
|
|
||||||
|
|
||||||
if (getY() < 0) {
|
|
||||||
top = (int) -getY();
|
|
||||||
}
|
|
||||||
if (getY() + getMeasuredHeight() > parentHeight) {
|
|
||||||
bottom = (int) (parentHeight - getY());
|
|
||||||
}
|
|
||||||
rect.set(
|
|
||||||
currentBackgroundDrawable.getBounds().left, top,
|
|
||||||
currentBackgroundDrawable.getBounds().right, bottom
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
rect.set(0, 0, getMeasuredWidth(), getMeasuredHeight());
|
|
||||||
}
|
|
||||||
canvas.saveLayerAlpha(rect, (int) (alpha * 255), Canvas.ALL_SAVE_FLAG);
|
|
||||||
}
|
|
||||||
for (int a = firstVisibleBlockNum; a <= lastVisibleBlockNum; a++) {
|
|
||||||
if (a >= textLayoutBlocks.size()) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
MessageObject.TextLayoutBlock block = textLayoutBlocks.get(a);
|
|
||||||
canvas.save();
|
|
||||||
canvas.translate(textX - (block.isRtl() ? (int) Math.ceil(currentMessageObject.textXOffset) : 0), textY + block.textYOffset);
|
|
||||||
if (pressedLink != null && a == linkBlockNum) {
|
|
||||||
for (int b = 0; b < urlPath.size(); b++) {
|
|
||||||
canvas.drawPath(urlPath.get(b), Theme.chat_urlPaint);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (a == linkSelectionBlockNum && !urlPathSelection.isEmpty()) {
|
|
||||||
for (int b = 0; b < urlPathSelection.size(); b++) {
|
|
||||||
canvas.drawPath(urlPathSelection.get(b), Theme.chat_textSearchSelectionPaint);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (delegate.getTextSelectionHelper() != null && transitionParams.animateChangeProgress == 1f) {
|
|
||||||
delegate.getTextSelectionHelper().draw(currentMessageObject, block, canvas);
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
block.textLayout.draw(canvas);
|
|
||||||
} catch (Exception e) {
|
|
||||||
FileLog.e(e);
|
|
||||||
}
|
|
||||||
canvas.restore();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (alpha != 1f) {
|
|
||||||
canvas.restore();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9132,7 +9134,8 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (alphaInternal != 1f) {
|
int restore = Integer.MIN_VALUE;
|
||||||
|
if (alphaInternal != 1.0f) {
|
||||||
int top = 0;
|
int top = 0;
|
||||||
int left = 0;
|
int left = 0;
|
||||||
int bottom = getMeasuredHeight();
|
int bottom = getMeasuredHeight();
|
||||||
|
@ -9159,7 +9162,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
bottom = (int) (parentHeight - getY());
|
bottom = (int) (parentHeight - getY());
|
||||||
}
|
}
|
||||||
rect.set(left, top, right, bottom);
|
rect.set(left, top, right, bottom);
|
||||||
canvas.saveLayerAlpha(rect, (int) (255 * alphaInternal), Canvas.ALL_SAVE_FLAG);
|
restore = canvas.saveLayerAlpha(rect, (int) (255 * alphaInternal), Canvas.ALL_SAVE_FLAG);
|
||||||
}
|
}
|
||||||
if (transitionParams.animateBackgroundBoundsInner && currentBackgroundDrawable != null) {
|
if (transitionParams.animateBackgroundBoundsInner && currentBackgroundDrawable != null) {
|
||||||
Rect r = currentBackgroundDrawable.getBounds();
|
Rect r = currentBackgroundDrawable.getBounds();
|
||||||
|
@ -9274,8 +9277,8 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
parent.invalidate();
|
parent.invalidate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (alphaInternal != 1f) {
|
if (restore != Integer.MIN_VALUE) {
|
||||||
canvas.restore();
|
canvas.restoreToCount(restore);
|
||||||
}
|
}
|
||||||
updateSelectionTextPosition();
|
updateSelectionTextPosition();
|
||||||
}
|
}
|
||||||
|
@ -9418,9 +9421,10 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int restore = Integer.MIN_VALUE;
|
||||||
if (alpha != 1f) {
|
if (alpha != 1f) {
|
||||||
rect.set(0, 0, getMaxNameWidth(), getMeasuredHeight());
|
rect.set(0, 0, getMaxNameWidth(), getMeasuredHeight());
|
||||||
canvas.saveLayerAlpha(rect, (int) (255 * alpha), Canvas.ALL_SAVE_FLAG);
|
restore = canvas.saveLayerAlpha(rect, (int) (255 * alpha), Canvas.ALL_SAVE_FLAG);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (drawNameLayout && nameLayout != null) {
|
if (drawNameLayout && nameLayout != null) {
|
||||||
|
@ -9615,8 +9619,8 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (alpha != 1f) {
|
if (restore != Integer.MIN_VALUE) {
|
||||||
canvas.restore();
|
canvas.restoreToCount(restore);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9751,14 +9755,14 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (renderingAlpha != 1f) {
|
int restore = Integer.MIN_VALUE;
|
||||||
|
if (renderingAlpha != 1.0f) {
|
||||||
rect.set(captionX, captionY, captionX + captionLayout.getWidth(), captionY + captionLayout.getHeight());
|
rect.set(captionX, captionY, captionX + captionLayout.getWidth(), captionY + captionLayout.getHeight());
|
||||||
canvas.saveLayerAlpha(rect, (int) (255 * renderingAlpha), Canvas.ALL_SAVE_FLAG);
|
restore = canvas.saveLayerAlpha(rect, (int) (255 * renderingAlpha), Canvas.ALL_SAVE_FLAG);
|
||||||
}
|
}
|
||||||
|
|
||||||
canvas.translate(captionX, captionY);
|
canvas.translate(captionX, captionY);
|
||||||
|
|
||||||
|
|
||||||
if (pressedLink != null) {
|
if (pressedLink != null) {
|
||||||
for (int b = 0; b < urlPath.size(); b++) {
|
for (int b = 0; b < urlPath.size(); b++) {
|
||||||
canvas.drawPath(urlPath.get(b), Theme.chat_urlPaint);
|
canvas.drawPath(urlPath.get(b), Theme.chat_urlPaint);
|
||||||
|
@ -9779,8 +9783,8 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
FileLog.e(e);
|
FileLog.e(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (renderingAlpha != 1f) {
|
if (restore != Integer.MIN_VALUE) {
|
||||||
canvas.restore();
|
canvas.restoreToCount(restore);
|
||||||
}
|
}
|
||||||
canvas.restore();
|
canvas.restore();
|
||||||
}
|
}
|
||||||
|
|
|
@ -3689,6 +3689,16 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onLayoutChildren(RecyclerView.Recycler recycler, RecyclerView.State state) {
|
||||||
|
try {
|
||||||
|
super.onLayoutChildren(recycler, state);
|
||||||
|
} catch (Exception e) {
|
||||||
|
FileLog.e(e);
|
||||||
|
AndroidUtilities.runOnUIThread(() -> chatAdapter.notifyDataSetChanged());
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
chatLayoutManager.setSpanSizeLookup(new GridLayoutManagerFixed.SpanSizeLookup() {
|
chatLayoutManager.setSpanSizeLookup(new GridLayoutManagerFixed.SpanSizeLookup() {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -788,7 +788,7 @@ public class CropView extends FrameLayout implements CropAreaView.AreaViewListen
|
||||||
matrix.postTranslate(canvasBitmap.getWidth() / 2, canvasBitmap.getHeight() / 2);
|
matrix.postTranslate(canvasBitmap.getWidth() / 2, canvasBitmap.getHeight() / 2);
|
||||||
canvas.drawBitmap(b, matrix, new Paint(FILTER_BITMAP_FLAG));
|
canvas.drawBitmap(b, matrix, new Paint(FILTER_BITMAP_FLAG));
|
||||||
FileOutputStream stream = new FileOutputStream(new File(path));
|
FileOutputStream stream = new FileOutputStream(new File(path));
|
||||||
canvasBitmap.compress(format, 83, stream);
|
canvasBitmap.compress(format, 87, stream);
|
||||||
stream.close();
|
stream.close();
|
||||||
|
|
||||||
if (entities != null && !entities.isEmpty()) {
|
if (entities != null && !entities.isEmpty()) {
|
||||||
|
|
|
@ -4629,7 +4629,7 @@ public class EmojiView extends FrameLayout implements NotificationCenter.Notific
|
||||||
|
|
||||||
@MainThread
|
@MainThread
|
||||||
private void processResponse(final String query, final String offset, boolean searchUser, boolean isEmoji, boolean cache, String key, TLObject response) {
|
private void processResponse(final String query, final String offset, boolean searchUser, boolean isEmoji, boolean cache, String key, TLObject response) {
|
||||||
if (!query.equals(lastSearchImageString)) {
|
if (query == null || !query.equals(lastSearchImageString)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
reqId = 0;
|
reqId = 0;
|
||||||
|
|
|
@ -298,7 +298,7 @@ public class FilterGLThread extends DispatchQueue {
|
||||||
videoHeight /= 2;
|
videoHeight /= 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!renderDataSet && videoWidth != 0 && videoHeight != 0) {
|
if (!renderDataSet && videoWidth > 0 && videoHeight > 0) {
|
||||||
filterShaders.setRenderData(currentBitmap, orientation, videoTexture[0], videoWidth, videoHeight);
|
filterShaders.setRenderData(currentBitmap, orientation, videoTexture[0], videoWidth, videoHeight);
|
||||||
renderDataSet = true;
|
renderDataSet = true;
|
||||||
renderBufferWidth = filterShaders.getRenderBufferWidth();
|
renderBufferWidth = filterShaders.getRenderBufferWidth();
|
||||||
|
@ -382,8 +382,10 @@ public class FilterGLThread extends DispatchQueue {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSurfaceTextureSize(int width, int height) {
|
public void setSurfaceTextureSize(int width, int height) {
|
||||||
surfaceWidth = width;
|
postRunnable(() -> {
|
||||||
surfaceHeight = height;
|
surfaceWidth = width;
|
||||||
|
surfaceHeight = height;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -907,7 +907,7 @@ public class FilterShaders {
|
||||||
GLES20.glTexParameteri(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MAG_FILTER, GL10.GL_LINEAR);
|
GLES20.glTexParameteri(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MAG_FILTER, GL10.GL_LINEAR);
|
||||||
GLES20.glTexParameteri(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_S, GL10.GL_CLAMP_TO_EDGE);
|
GLES20.glTexParameteri(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_S, GL10.GL_CLAMP_TO_EDGE);
|
||||||
GLES20.glTexParameteri(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_T, GL10.GL_CLAMP_TO_EDGE);
|
GLES20.glTexParameteri(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_T, GL10.GL_CLAMP_TO_EDGE);
|
||||||
GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RGBA, renderBufferWidth, renderBufferHeight, 0, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, hsvBuffer);
|
GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RGBA, renderBufferWidth, renderBufferHeight, 0, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int loadShader(int type, String shaderCode) {
|
public static int loadShader(int type, String shaderCode) {
|
||||||
|
|
|
@ -389,10 +389,10 @@ public class Painting {
|
||||||
int texture = buffers[0];
|
int texture = buffers[0];
|
||||||
|
|
||||||
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, texture);
|
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, texture);
|
||||||
GLES20.glTexParameteri(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MIN_FILTER, GL10.GL_LINEAR);
|
|
||||||
GLES20.glTexParameteri(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MAG_FILTER, GL10.GL_LINEAR);
|
|
||||||
GLES20.glTexParameteri(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_S, GL10.GL_CLAMP_TO_EDGE);
|
GLES20.glTexParameteri(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_S, GL10.GL_CLAMP_TO_EDGE);
|
||||||
GLES20.glTexParameteri(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_T, GL10.GL_CLAMP_TO_EDGE);
|
GLES20.glTexParameteri(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_T, GL10.GL_CLAMP_TO_EDGE);
|
||||||
|
GLES20.glTexParameteri(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MIN_FILTER, GL10.GL_LINEAR);
|
||||||
|
GLES20.glTexParameteri(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MAG_FILTER, GL10.GL_NEAREST);
|
||||||
GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RGBA, width, height, 0, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, null);
|
GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RGBA, width, height, 0, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, null);
|
||||||
|
|
||||||
GLES20.glFramebufferTexture2D(GLES20.GL_FRAMEBUFFER, GLES20.GL_COLOR_ATTACHMENT0, GLES20.GL_TEXTURE_2D, texture, 0);
|
GLES20.glFramebufferTexture2D(GLES20.GL_FRAMEBUFFER, GLES20.GL_COLOR_ATTACHMENT0, GLES20.GL_TEXTURE_2D, texture, 0);
|
||||||
|
@ -415,24 +415,15 @@ public class Painting {
|
||||||
|
|
||||||
GLES20.glUniformMatrix4fv(shader.getUniform("mvpMatrix"), 1, false, FloatBuffer.wrap(finalProjection));
|
GLES20.glUniformMatrix4fv(shader.getUniform("mvpMatrix"), 1, false, FloatBuffer.wrap(finalProjection));
|
||||||
|
|
||||||
if (undo) {
|
GLES20.glUniform1i(shader.getUniform("texture"), 0);
|
||||||
GLES20.glUniform1i(shader.getUniform("texture"), 0);
|
|
||||||
|
|
||||||
GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
|
GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
|
||||||
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, getTexture());
|
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, getTexture());
|
||||||
} else {
|
|
||||||
GLES20.glUniform1i(shader.getUniform("texture"), 0);
|
|
||||||
|
|
||||||
GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
|
|
||||||
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, bitmapTexture.texture());
|
|
||||||
|
|
||||||
GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
|
|
||||||
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, getTexture());
|
|
||||||
}
|
|
||||||
GLES20.glClearColor(0, 0, 0, 0);
|
GLES20.glClearColor(0, 0, 0, 0);
|
||||||
GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT);
|
GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT);
|
||||||
|
|
||||||
GLES20.glBlendFunc(GLES20.GL_ONE, GLES20.GL_ONE_MINUS_SRC_ALPHA);
|
GLES20.glBlendFunc(GLES20.GL_ONE, GLES20.GL_ZERO);
|
||||||
|
|
||||||
GLES20.glVertexAttribPointer(0, 2, GLES20.GL_FLOAT, false, 8, vertexBuffer);
|
GLES20.glVertexAttribPointer(0, 2, GLES20.GL_FLOAT, false, 8, vertexBuffer);
|
||||||
GLES20.glEnableVertexAttribArray(0);
|
GLES20.glEnableVertexAttribArray(0);
|
||||||
|
|
|
@ -18,7 +18,7 @@ public class ShaderSet {
|
||||||
private static final String PAINT_BRUSH_FSH = "precision highp float; varying vec2 varTexcoord; varying float varIntensity; uniform sampler2D texture; void main (void) { gl_FragColor = vec4(0, 0, 0, varIntensity * texture2D(texture, varTexcoord.st, 0.0).r); }";
|
private static final String PAINT_BRUSH_FSH = "precision highp float; varying vec2 varTexcoord; varying float varIntensity; uniform sampler2D texture; void main (void) { gl_FragColor = vec4(0, 0, 0, varIntensity * texture2D(texture, varTexcoord.st, 0.0).r); }";
|
||||||
private static final String PAINT_BRUSHLIGHT_FSH = "precision highp float; varying vec2 varTexcoord; varying float varIntensity; uniform sampler2D texture; void main (void) { vec4 f = texture2D(texture, varTexcoord.st, 0.0); gl_FragColor = vec4(f.r * varIntensity, f.g, f.b, 0.0); }";
|
private static final String PAINT_BRUSHLIGHT_FSH = "precision highp float; varying vec2 varTexcoord; varying float varIntensity; uniform sampler2D texture; void main (void) { vec4 f = texture2D(texture, varTexcoord.st, 0.0); gl_FragColor = vec4(f.r * varIntensity, f.g, f.b, 0.0); }";
|
||||||
private static final String PAINT_BLIT_VSH = "precision highp float; uniform mat4 mvpMatrix; attribute vec4 inPosition; attribute vec2 inTexcoord; varying vec2 varTexcoord; void main (void) { gl_Position = mvpMatrix * inPosition; varTexcoord = inTexcoord; }";
|
private static final String PAINT_BLIT_VSH = "precision highp float; uniform mat4 mvpMatrix; attribute vec4 inPosition; attribute vec2 inTexcoord; varying vec2 varTexcoord; void main (void) { gl_Position = mvpMatrix * inPosition; varTexcoord = inTexcoord; }";
|
||||||
private static final String PAINT_BLIT_FSH = "precision highp float; varying vec2 varTexcoord; uniform sampler2D texture; void main (void) { vec4 tex = texture2D(texture, varTexcoord.st, 0.0); gl_FragColor = texture2D(texture, varTexcoord.st, 0.0); gl_FragColor.rgb *= gl_FragColor.a; }";
|
private static final String PAINT_BLIT_FSH = "precision highp float; varying vec2 varTexcoord; uniform sampler2D texture; void main (void) { gl_FragColor = texture2D(texture, varTexcoord.st, 0.0); gl_FragColor.rgb *= gl_FragColor.a; }";
|
||||||
private static final String PAINT_BLITWITHMASKLIGHT_FSH = "precision highp float; varying vec2 varTexcoord; uniform sampler2D texture; uniform sampler2D mask; uniform vec4 color; void main (void) { vec4 dst = texture2D(texture, varTexcoord.st, 0.0); vec3 maskColor = texture2D(mask, varTexcoord.st, 0.0).rgb; float srcAlpha = clamp(0.78 * maskColor.r + maskColor.b + maskColor.g, 0.0, 1.0); vec3 borderColor = mix(color.rgb, vec3(1.0, 1.0, 1.0), 0.86); vec3 finalColor = mix(color.rgb, borderColor, maskColor.g); finalColor = mix(finalColor.rgb, vec3(1.0, 1.0, 1.0), maskColor.b); float outAlpha = srcAlpha + dst.a * (1.0 - srcAlpha); gl_FragColor.rgb = (finalColor * srcAlpha + dst.rgb * dst.a * (1.0 - srcAlpha)) / outAlpha; gl_FragColor.a = outAlpha; gl_FragColor.rgb *= gl_FragColor.a; }";
|
private static final String PAINT_BLITWITHMASKLIGHT_FSH = "precision highp float; varying vec2 varTexcoord; uniform sampler2D texture; uniform sampler2D mask; uniform vec4 color; void main (void) { vec4 dst = texture2D(texture, varTexcoord.st, 0.0); vec3 maskColor = texture2D(mask, varTexcoord.st, 0.0).rgb; float srcAlpha = clamp(0.78 * maskColor.r + maskColor.b + maskColor.g, 0.0, 1.0); vec3 borderColor = mix(color.rgb, vec3(1.0, 1.0, 1.0), 0.86); vec3 finalColor = mix(color.rgb, borderColor, maskColor.g); finalColor = mix(finalColor.rgb, vec3(1.0, 1.0, 1.0), maskColor.b); float outAlpha = srcAlpha + dst.a * (1.0 - srcAlpha); gl_FragColor.rgb = (finalColor * srcAlpha + dst.rgb * dst.a * (1.0 - srcAlpha)) / outAlpha; gl_FragColor.a = outAlpha; gl_FragColor.rgb *= gl_FragColor.a; }";
|
||||||
private static final String PAINT_BLITWITHMASK_FSH = "precision highp float; varying vec2 varTexcoord; uniform sampler2D texture; uniform sampler2D mask; uniform vec4 color; void main (void) { vec4 dst = texture2D(texture, varTexcoord.st, 0.0); float srcAlpha = color.a * texture2D(mask, varTexcoord.st, 0.0).a; float outAlpha = srcAlpha + dst.a * (1.0 - srcAlpha); gl_FragColor.rgb = (color.rgb * srcAlpha + dst.rgb * dst.a * (1.0 - srcAlpha)) / outAlpha; gl_FragColor.a = outAlpha; gl_FragColor.rgb *= gl_FragColor.a; }";
|
private static final String PAINT_BLITWITHMASK_FSH = "precision highp float; varying vec2 varTexcoord; uniform sampler2D texture; uniform sampler2D mask; uniform vec4 color; void main (void) { vec4 dst = texture2D(texture, varTexcoord.st, 0.0); float srcAlpha = color.a * texture2D(mask, varTexcoord.st, 0.0).a; float outAlpha = srcAlpha + dst.a * (1.0 - srcAlpha); gl_FragColor.rgb = (color.rgb * srcAlpha + dst.rgb * dst.a * (1.0 - srcAlpha)) / outAlpha; gl_FragColor.a = outAlpha; gl_FragColor.rgb *= gl_FragColor.a; }";
|
||||||
private static final String PAINT_COMPOSITEWITHMASK_FSH = "precision highp float; varying vec2 varTexcoord; uniform sampler2D texture; uniform sampler2D mask; uniform vec4 color; void main(void) { vec4 dst = texture2D(texture, varTexcoord.st, 0.0); float srcAlpha = color.a * texture2D(mask, varTexcoord.st, 0.0).a; float outAlpha = srcAlpha + dst.a * (1.0 - srcAlpha); gl_FragColor.rgb = (color.rgb * srcAlpha + dst.rgb * dst.a * (1.0 - srcAlpha)) / outAlpha; gl_FragColor.a = outAlpha; }";
|
private static final String PAINT_COMPOSITEWITHMASK_FSH = "precision highp float; varying vec2 varTexcoord; uniform sampler2D texture; uniform sampler2D mask; uniform vec4 color; void main(void) { vec4 dst = texture2D(texture, varTexcoord.st, 0.0); float srcAlpha = color.a * texture2D(mask, varTexcoord.st, 0.0).a; float outAlpha = srcAlpha + dst.a * (1.0 - srcAlpha); gl_FragColor.rgb = (color.rgb * srcAlpha + dst.rgb * dst.a * (1.0 - srcAlpha)) / outAlpha; gl_FragColor.a = outAlpha; }";
|
||||||
|
|
|
@ -2,11 +2,11 @@ package org.telegram.ui.Components.Paint;
|
||||||
|
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.opengl.GLES20;
|
import android.opengl.GLES20;
|
||||||
import android.opengl.GLUtils;
|
|
||||||
|
|
||||||
import org.telegram.ui.Components.Size;
|
import org.telegram.ui.Components.Size;
|
||||||
|
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
|
import java.nio.IntBuffer;
|
||||||
|
|
||||||
public class Texture {
|
public class Texture {
|
||||||
|
|
||||||
|
@ -52,10 +52,19 @@ public class Texture {
|
||||||
|
|
||||||
GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);
|
GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);
|
||||||
GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);
|
GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);
|
||||||
GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);
|
GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_NEAREST);
|
||||||
GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR);
|
GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR);
|
||||||
|
|
||||||
GLUtils.texImage2D(GLES20.GL_TEXTURE_2D, 0, bitmap, 0);
|
int width = bitmap.getWidth();
|
||||||
|
int height = bitmap.getHeight();
|
||||||
|
int[] pixels = new int[width * height];
|
||||||
|
bitmap.getPixels(pixels, 0, width, 0, 0, width, height);
|
||||||
|
for (int i = 0; i < pixels.length; i += 1) {
|
||||||
|
int argb = pixels[i];
|
||||||
|
pixels[i] = argb & 0xff00ff00 | ((argb & 0xff) << 16) | ((argb >> 16) & 0xff);
|
||||||
|
}
|
||||||
|
GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RGBA, width, height, 0, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, IntBuffer.wrap(pixels));
|
||||||
|
|
||||||
int px = bitmap.getPixel(0, 0);
|
int px = bitmap.getPixel(0, 0);
|
||||||
|
|
||||||
ByteBuffer buffer = ByteBuffer.allocateDirect(4); //fix for android 9.0
|
ByteBuffer buffer = ByteBuffer.allocateDirect(4); //fix for android 9.0
|
||||||
|
@ -77,7 +86,7 @@ public class Texture {
|
||||||
|
|
||||||
GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);
|
GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);
|
||||||
GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);
|
GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);
|
||||||
GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);
|
GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_NEAREST);
|
||||||
GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR);
|
GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR);
|
||||||
|
|
||||||
int width = (int) size.width;
|
int width = (int) size.width;
|
||||||
|
|
|
@ -1135,7 +1135,7 @@ public class PhotoPaintView extends FrameLayout implements EntityView.EntityView
|
||||||
}, entityView, Gravity.CENTER, x, y);
|
}, entityView, Gravity.CENTER, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
private FrameLayout buttonForBrush(final int brush, int resource, boolean selected) {
|
private FrameLayout buttonForBrush(final int brush, int resource, boolean applyColor, boolean selected) {
|
||||||
FrameLayout button = new FrameLayout(getContext());
|
FrameLayout button = new FrameLayout(getContext());
|
||||||
button.setBackgroundDrawable(Theme.getSelectorDrawable(false));
|
button.setBackgroundDrawable(Theme.getSelectorDrawable(false));
|
||||||
button.setOnClickListener(v -> {
|
button.setOnClickListener(v -> {
|
||||||
|
@ -1148,6 +1148,9 @@ public class PhotoPaintView extends FrameLayout implements EntityView.EntityView
|
||||||
|
|
||||||
ImageView preview = new ImageView(getContext());
|
ImageView preview = new ImageView(getContext());
|
||||||
preview.setImageResource(resource);
|
preview.setImageResource(resource);
|
||||||
|
if (applyColor) {
|
||||||
|
preview.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_actionBarDefaultSubmenuItem), PorterDuff.Mode.SRC_IN));
|
||||||
|
}
|
||||||
button.addView(preview, LayoutHelper.createFrame(165, 44, Gravity.LEFT | Gravity.CENTER_VERTICAL, 46, 0, 8, 0));
|
button.addView(preview, LayoutHelper.createFrame(165, 44, Gravity.LEFT | Gravity.CENTER_VERTICAL, 46, 0, 8, 0));
|
||||||
|
|
||||||
if (selected) {
|
if (selected) {
|
||||||
|
@ -1163,7 +1166,7 @@ public class PhotoPaintView extends FrameLayout implements EntityView.EntityView
|
||||||
|
|
||||||
private void showBrushSettings() {
|
private void showBrushSettings() {
|
||||||
showPopup(() -> {
|
showPopup(() -> {
|
||||||
View radial = buttonForBrush(0, R.drawable.paint_radial_preview, currentBrush == 0);
|
View radial = buttonForBrush(0, R.drawable.paint_radial_preview, true, currentBrush == 0);
|
||||||
popupLayout.addView(radial);
|
popupLayout.addView(radial);
|
||||||
|
|
||||||
LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) radial.getLayoutParams();
|
LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) radial.getLayoutParams();
|
||||||
|
@ -1171,7 +1174,7 @@ public class PhotoPaintView extends FrameLayout implements EntityView.EntityView
|
||||||
layoutParams.height = AndroidUtilities.dp(52);
|
layoutParams.height = AndroidUtilities.dp(52);
|
||||||
radial.setLayoutParams(layoutParams);
|
radial.setLayoutParams(layoutParams);
|
||||||
|
|
||||||
View elliptical = buttonForBrush(1, R.drawable.paint_elliptical_preview, currentBrush == 1);
|
View elliptical = buttonForBrush(1, R.drawable.paint_elliptical_preview, true, currentBrush == 1);
|
||||||
popupLayout.addView(elliptical);
|
popupLayout.addView(elliptical);
|
||||||
|
|
||||||
layoutParams = (LinearLayout.LayoutParams) elliptical.getLayoutParams();
|
layoutParams = (LinearLayout.LayoutParams) elliptical.getLayoutParams();
|
||||||
|
@ -1179,7 +1182,7 @@ public class PhotoPaintView extends FrameLayout implements EntityView.EntityView
|
||||||
layoutParams.height = AndroidUtilities.dp(52);
|
layoutParams.height = AndroidUtilities.dp(52);
|
||||||
elliptical.setLayoutParams(layoutParams);
|
elliptical.setLayoutParams(layoutParams);
|
||||||
|
|
||||||
View neon = buttonForBrush(2, R.drawable.paint_neon_preview, currentBrush == 2);
|
View neon = buttonForBrush(2, R.drawable.paint_neon_preview, false, currentBrush == 2);
|
||||||
popupLayout.addView(neon);
|
popupLayout.addView(neon);
|
||||||
|
|
||||||
layoutParams = (LinearLayout.LayoutParams) neon.getLayoutParams();
|
layoutParams = (LinearLayout.LayoutParams) neon.getLayoutParams();
|
||||||
|
|
|
@ -241,10 +241,6 @@ public class RecyclerAnimationScrollHelper {
|
||||||
if (recyclerView.mChildHelper.getHiddenChildCount() != 0) {
|
if (recyclerView.mChildHelper.getHiddenChildCount() != 0) {
|
||||||
throw new RuntimeException("hidden child count must be 0");
|
throw new RuntimeException("hidden child count must be 0");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (recyclerView.getCachedChildCount() != 0) {
|
|
||||||
throw new RuntimeException("cached child count must be 0");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int n = recyclerView.getChildCount();
|
int n = recyclerView.getChildCount();
|
||||||
|
|
|
@ -2778,7 +2778,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
||||||
case MotionEvent.ACTION_UP:
|
case MotionEvent.ACTION_UP:
|
||||||
case MotionEvent.ACTION_CANCEL:
|
case MotionEvent.ACTION_CANCEL:
|
||||||
case MotionEvent.ACTION_POINTER_UP:
|
case MotionEvent.ACTION_POINTER_UP:
|
||||||
AndroidUtilities.runOnUIThread(hideActionBarRunnable, 3000);
|
scheduleActionBarHide();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3364,7 +3364,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
||||||
@Override
|
@Override
|
||||||
public void onHideSubMenu() {
|
public void onHideSubMenu() {
|
||||||
if (videoPlayerControlVisible && isPlaying) {
|
if (videoPlayerControlVisible && isPlaying) {
|
||||||
AndroidUtilities.runOnUIThread(hideActionBarRunnable, 3000);
|
scheduleActionBarHide();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -5117,6 +5117,27 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
||||||
return injectingVideoPlayer != null;
|
return injectingVideoPlayer != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void scheduleActionBarHide() {
|
||||||
|
scheduleActionBarHide(3000);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void scheduleActionBarHide(int delay) {
|
||||||
|
if (!isAccessibilityEnabled()) {
|
||||||
|
AndroidUtilities.cancelRunOnUIThread(hideActionBarRunnable);
|
||||||
|
AndroidUtilities.runOnUIThread(hideActionBarRunnable, delay);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isAccessibilityEnabled() {
|
||||||
|
try {
|
||||||
|
AccessibilityManager am = (AccessibilityManager) actvityContext.getSystemService(Context.ACCESSIBILITY_SERVICE);
|
||||||
|
return am.isEnabled();
|
||||||
|
} catch (Exception e) {
|
||||||
|
FileLog.e(e);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
private void updatePlayerState(boolean playWhenReady, int playbackState) {
|
private void updatePlayerState(boolean playWhenReady, int playbackState) {
|
||||||
if (videoPlayer == null) {
|
if (videoPlayer == null) {
|
||||||
return;
|
return;
|
||||||
|
@ -5131,7 +5152,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
||||||
if (buffering) {
|
if (buffering) {
|
||||||
AndroidUtilities.cancelRunOnUIThread(hideActionBarRunnable);
|
AndroidUtilities.cancelRunOnUIThread(hideActionBarRunnable);
|
||||||
} else {
|
} else {
|
||||||
AndroidUtilities.runOnUIThread(hideActionBarRunnable, 3000);
|
scheduleActionBarHide();
|
||||||
}
|
}
|
||||||
toggleMiniProgress(buffering, true);
|
toggleMiniProgress(buffering, true);
|
||||||
}
|
}
|
||||||
|
@ -5503,7 +5524,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
||||||
}
|
}
|
||||||
setVideoPlayerControlVisible(!isCurrentVideo, true);
|
setVideoPlayerControlVisible(!isCurrentVideo, true);
|
||||||
if (!isCurrentVideo) {
|
if (!isCurrentVideo) {
|
||||||
AndroidUtilities.runOnUIThread(hideActionBarRunnable, playerAutoStarted ? 3000 : 1000);
|
scheduleActionBarHide(playerAutoStarted ? 3000 : 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
inPreview = preview;
|
inPreview = preview;
|
||||||
|
@ -5802,7 +5823,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
||||||
stickers = photoPaintView.getMasks();
|
stickers = photoPaintView.getMasks();
|
||||||
}
|
}
|
||||||
if (bitmap != null) {
|
if (bitmap != null) {
|
||||||
TLRPC.PhotoSize size = ImageLoader.scaleAndSaveImage(bitmap, currentEditMode == 3 ? Bitmap.CompressFormat.PNG : Bitmap.CompressFormat.JPEG, AndroidUtilities.getPhotoSize(), AndroidUtilities.getPhotoSize(), 80, false, 101, 101);
|
TLRPC.PhotoSize size = ImageLoader.scaleAndSaveImage(bitmap, currentEditMode == 3 ? Bitmap.CompressFormat.PNG : Bitmap.CompressFormat.JPEG, AndroidUtilities.getPhotoSize(), AndroidUtilities.getPhotoSize(), 87, false, 101, 101);
|
||||||
if (size != null) {
|
if (size != null) {
|
||||||
if (entry.thumbPath != null) {
|
if (entry.thumbPath != null) {
|
||||||
new File(entry.thumbPath).delete();
|
new File(entry.thumbPath).delete();
|
||||||
|
@ -5837,7 +5858,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
||||||
Canvas b = new Canvas(canvasBitmap);
|
Canvas b = new Canvas(canvasBitmap);
|
||||||
b.drawBitmap(bitmap, null, new Rect(0, 0, bitmap.getWidth(), bitmap.getHeight()), bitmapPaint);
|
b.drawBitmap(bitmap, null, new Rect(0, 0, bitmap.getWidth(), bitmap.getHeight()), bitmapPaint);
|
||||||
b.drawBitmap(paintBitmap, null, new Rect(0, 0, bitmap.getWidth(), bitmap.getHeight()), bitmapPaint);
|
b.drawBitmap(paintBitmap, null, new Rect(0, 0, bitmap.getWidth(), bitmap.getHeight()), bitmapPaint);
|
||||||
size = ImageLoader.scaleAndSaveImage(canvasBitmap, AndroidUtilities.getPhotoSize(), AndroidUtilities.getPhotoSize(), 80, false, 101, 101);
|
size = ImageLoader.scaleAndSaveImage(canvasBitmap, AndroidUtilities.getPhotoSize(), AndroidUtilities.getPhotoSize(), 87, false, 101, 101);
|
||||||
entry.imagePath = FileLoader.getPathToAttach(size, true).toString();
|
entry.imagePath = FileLoader.getPathToAttach(size, true).toString();
|
||||||
canvasBitmap.recycle();
|
canvasBitmap.recycle();
|
||||||
paintingOverlay.setEntities(currentMediaEntities, isCurrentVideo, true);
|
paintingOverlay.setEntities(currentMediaEntities, isCurrentVideo, true);
|
||||||
|
@ -5872,7 +5893,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
||||||
Canvas b = new Canvas(canvasBitmap);
|
Canvas b = new Canvas(canvasBitmap);
|
||||||
b.drawBitmap(bitmap, null, new Rect(0, 0, bitmap.getWidth(), bitmap.getHeight()), bitmapPaint);
|
b.drawBitmap(bitmap, null, new Rect(0, 0, bitmap.getWidth(), bitmap.getHeight()), bitmapPaint);
|
||||||
b.drawBitmap(paintBitmap, null, new Rect(0, 0, bitmap.getWidth(), bitmap.getHeight()), bitmapPaint);
|
b.drawBitmap(paintBitmap, null, new Rect(0, 0, bitmap.getWidth(), bitmap.getHeight()), bitmapPaint);
|
||||||
size = ImageLoader.scaleAndSaveImage(canvasBitmap, AndroidUtilities.getPhotoSize(), AndroidUtilities.getPhotoSize(), 80, false, 101, 101);
|
size = ImageLoader.scaleAndSaveImage(canvasBitmap, AndroidUtilities.getPhotoSize(), AndroidUtilities.getPhotoSize(), 87, false, 101, 101);
|
||||||
if (entry.imagePath != null) {
|
if (entry.imagePath != null) {
|
||||||
new File(entry.imagePath).delete();
|
new File(entry.imagePath).delete();
|
||||||
}
|
}
|
||||||
|
@ -5915,11 +5936,12 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
||||||
new File(entry.fullPaintPath).delete();
|
new File(entry.fullPaintPath).delete();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
entry.stickers = stickers;
|
||||||
entry.paintPath = currentPaintPath = FileLoader.getPathToAttach(size, true).toString();
|
entry.paintPath = currentPaintPath = FileLoader.getPathToAttach(size, true).toString();
|
||||||
paintingOverlay.setEntities(entry.mediaEntities = currentMediaEntities = entities == null || entities.isEmpty() ? null : entities, isCurrentVideo, true);
|
paintingOverlay.setEntities(entry.mediaEntities = currentMediaEntities = entities == null || entities.isEmpty() ? null : entities, isCurrentVideo, true);
|
||||||
entry.averageDuration = currentAverageDuration = photoPaintView.getLcm();
|
entry.averageDuration = currentAverageDuration = photoPaintView.getLcm();
|
||||||
if (entry.mediaEntities != null && paintThumbBitmap[0] != null) {
|
if (entry.mediaEntities != null && paintThumbBitmap[0] != null) {
|
||||||
size = ImageLoader.scaleAndSaveImage(paintThumbBitmap[0], Bitmap.CompressFormat.PNG, AndroidUtilities.getPhotoSize(), AndroidUtilities.getPhotoSize(), 80, false, 101, 101);
|
size = ImageLoader.scaleAndSaveImage(paintThumbBitmap[0], Bitmap.CompressFormat.PNG, AndroidUtilities.getPhotoSize(), AndroidUtilities.getPhotoSize(), 87, false, 101, 101);
|
||||||
entry.fullPaintPath = FileLoader.getPathToAttach(size, true).toString();
|
entry.fullPaintPath = FileLoader.getPathToAttach(size, true).toString();
|
||||||
} else {
|
} else {
|
||||||
entry.fullPaintPath = entry.paintPath;
|
entry.fullPaintPath = entry.paintPath;
|
||||||
|
@ -5942,7 +5964,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
||||||
if (originalBitmap != null) {
|
if (originalBitmap != null) {
|
||||||
Canvas b = new Canvas(originalBitmap);
|
Canvas b = new Canvas(originalBitmap);
|
||||||
b.drawBitmap(paintThumbBitmap[0] != null ? paintThumbBitmap[0] : bitmap, null, new Rect(0, 0, originalBitmap.getWidth(), originalBitmap.getHeight()), bitmapPaint);
|
b.drawBitmap(paintThumbBitmap[0] != null ? paintThumbBitmap[0] : bitmap, null, new Rect(0, 0, originalBitmap.getWidth(), originalBitmap.getHeight()), bitmapPaint);
|
||||||
size = ImageLoader.scaleAndSaveImage(originalBitmap, AndroidUtilities.getPhotoSize(), AndroidUtilities.getPhotoSize(), 80, false, 101, 101);
|
size = ImageLoader.scaleAndSaveImage(originalBitmap, AndroidUtilities.getPhotoSize(), AndroidUtilities.getPhotoSize(), 87, false, 101, 101);
|
||||||
if (entry.imagePath != null) {
|
if (entry.imagePath != null) {
|
||||||
new File(entry.imagePath).delete();
|
new File(entry.imagePath).delete();
|
||||||
}
|
}
|
||||||
|
@ -5986,7 +6008,6 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
||||||
|
|
||||||
SharedConfig.saveConfig();
|
SharedConfig.saveConfig();
|
||||||
|
|
||||||
entry.stickers = stickers;
|
|
||||||
if (savedFilterState != null) {
|
if (savedFilterState != null) {
|
||||||
entry.savedFilterState = currentSavedFilterState = savedFilterState;
|
entry.savedFilterState = currentSavedFilterState = savedFilterState;
|
||||||
}
|
}
|
||||||
|
@ -6750,7 +6771,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
||||||
updateContainerFlags(show);
|
updateContainerFlags(show);
|
||||||
|
|
||||||
if (videoPlayerControlVisible && isPlaying && show) {
|
if (videoPlayerControlVisible && isPlaying && show) {
|
||||||
AndroidUtilities.runOnUIThread(hideActionBarRunnable, 3000);
|
scheduleActionBarHide();
|
||||||
} else {
|
} else {
|
||||||
AndroidUtilities.cancelRunOnUIThread(hideActionBarRunnable);
|
AndroidUtilities.cancelRunOnUIThread(hideActionBarRunnable);
|
||||||
}
|
}
|
||||||
|
@ -6889,7 +6910,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
||||||
if (Math.abs(videoPlayerSeekbar.getProgress() - 1.0f) < 0.01f || videoPlayer.getCurrentPosition() == videoPlayer.getDuration()) {
|
if (Math.abs(videoPlayerSeekbar.getProgress() - 1.0f) < 0.01f || videoPlayer.getCurrentPosition() == videoPlayer.getDuration()) {
|
||||||
videoPlayer.seekTo(0);
|
videoPlayer.seekTo(0);
|
||||||
}
|
}
|
||||||
AndroidUtilities.runOnUIThread(hideActionBarRunnable, 1000);
|
scheduleActionBarHide();
|
||||||
}
|
}
|
||||||
videoPlayer.play();
|
videoPlayer.play();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1630,6 +1630,9 @@ public class ThemePreviewActivity extends BaseFragment implements DownloadContro
|
||||||
saveButtonsContainer.addView(doneButton, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.MATCH_PARENT, Gravity.TOP | Gravity.RIGHT));
|
saveButtonsContainer.addView(doneButton, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.MATCH_PARENT, Gravity.TOP | Gravity.RIGHT));
|
||||||
doneButton.setOnClickListener(v -> {
|
doneButton.setOnClickListener(v -> {
|
||||||
Theme.ThemeInfo previousTheme = Theme.getPreviousTheme();
|
Theme.ThemeInfo previousTheme = Theme.getPreviousTheme();
|
||||||
|
if (previousTheme == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
Theme.ThemeAccent previousAccent;
|
Theme.ThemeAccent previousAccent;
|
||||||
if (previousTheme != null && previousTheme.prevAccentId >= 0) {
|
if (previousTheme != null && previousTheme.prevAccentId >= 0) {
|
||||||
previousAccent = previousTheme.themeAccentsMap.get(previousTheme.prevAccentId);
|
previousAccent = previousTheme.themeAccentsMap.get(previousTheme.prevAccentId);
|
||||||
|
|
Loading…
Reference in New Issue