mirror of https://github.com/NekoX-Dev/NekoX.git
Update to 2.5.2
This commit is contained in:
parent
85bc7046bb
commit
0f4b890153
|
@ -82,7 +82,7 @@ android {
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdkVersion 8
|
minSdkVersion 8
|
||||||
targetSdkVersion 21
|
targetSdkVersion 21
|
||||||
versionCode 454
|
versionCode 458
|
||||||
versionName "2.5.1"
|
versionName "2.5.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
android:label="@string/AppName"
|
android:label="@string/AppName"
|
||||||
android:theme="@style/Theme.TMessages.Start"
|
android:theme="@style/Theme.TMessages.Start"
|
||||||
android:name=".ApplicationLoader"
|
android:name=".ApplicationLoader"
|
||||||
android:hardwareAccelerated="true"
|
android:hardwareAccelerated="@bool/useHardwareAcceleration"
|
||||||
android:largeHeap="true">
|
android:largeHeap="true">
|
||||||
|
|
||||||
<meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="AIzaSyCTNmNqbWovP9ETcAob98YlrfOQEAC0CJ4" />
|
<meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="AIzaSyCTNmNqbWovP9ETcAob98YlrfOQEAC0CJ4" />
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
android:label="@string/AppName"
|
android:label="@string/AppName"
|
||||||
android:theme="@style/Theme.TMessages.Start"
|
android:theme="@style/Theme.TMessages.Start"
|
||||||
android:name=".ApplicationLoader"
|
android:name=".ApplicationLoader"
|
||||||
android:hardwareAccelerated="true"
|
android:hardwareAccelerated="@bool/useHardwareAcceleration"
|
||||||
android:largeHeap="true">
|
android:largeHeap="true">
|
||||||
|
|
||||||
</application>
|
</application>
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
android:label="@string/AppName"
|
android:label="@string/AppName"
|
||||||
android:theme="@style/Theme.TMessages.Start"
|
android:theme="@style/Theme.TMessages.Start"
|
||||||
android:name=".ApplicationLoader"
|
android:name=".ApplicationLoader"
|
||||||
android:hardwareAccelerated="true"
|
android:hardwareAccelerated="@bool/useHardwareAcceleration"
|
||||||
android:largeHeap="true">
|
android:largeHeap="true">
|
||||||
|
|
||||||
<meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="AIzaSyA-t0jLPjUt2FxrA8VPK2EiYHcYcboIR6k" />
|
<meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="AIzaSyA-t0jLPjUt2FxrA8VPK2EiYHcYcboIR6k" />
|
||||||
|
|
|
@ -43,7 +43,7 @@
|
||||||
<application
|
<application
|
||||||
android:name=".ApplicationLoader"
|
android:name=".ApplicationLoader"
|
||||||
android:allowBackup="false"
|
android:allowBackup="false"
|
||||||
android:hardwareAccelerated="true"
|
android:hardwareAccelerated="@bool/useHardwareAcceleration"
|
||||||
android:icon="@drawable/ic_launcher"
|
android:icon="@drawable/ic_launcher"
|
||||||
android:label="@string/AppName"
|
android:label="@string/AppName"
|
||||||
android:largeHeap="true"
|
android:largeHeap="true"
|
||||||
|
@ -52,7 +52,7 @@
|
||||||
<activity
|
<activity
|
||||||
android:name="org.telegram.ui.LaunchActivity"
|
android:name="org.telegram.ui.LaunchActivity"
|
||||||
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
|
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
|
||||||
android:hardwareAccelerated="true"
|
android:hardwareAccelerated="@bool/useHardwareAcceleration"
|
||||||
android:launchMode="singleTask"
|
android:launchMode="singleTask"
|
||||||
android:windowSoftInputMode="adjustPan">
|
android:windowSoftInputMode="adjustPan">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
|
|
|
@ -28,7 +28,7 @@ public class ByteStream {
|
||||||
private final ArrayList<ByteBufferDesc> queue;
|
private final ArrayList<ByteBufferDesc> queue;
|
||||||
|
|
||||||
public ByteStream() {
|
public ByteStream() {
|
||||||
this.queue = new ArrayList<ByteBufferDesc>();
|
this.queue = new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void append(ByteBufferDesc buf) {
|
public void append(ByteBufferDesc buf) {
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
package org.telegram.PhoneFormat;
|
package org.telegram.PhoneFormat;
|
||||||
|
|
||||||
import org.telegram.messenger.ApplicationLoader;
|
import org.telegram.messenger.ApplicationLoader;
|
||||||
|
import org.telegram.messenger.FileLog;
|
||||||
|
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
@ -97,9 +98,11 @@ public class PhoneFormat {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void init(String countryCode) {
|
public void init(String countryCode) {
|
||||||
|
InputStream stream = null;
|
||||||
|
ByteArrayOutputStream bos = null;
|
||||||
try {
|
try {
|
||||||
InputStream stream = ApplicationLoader.applicationContext.getAssets().open("PhoneFormats.dat");
|
stream = ApplicationLoader.applicationContext.getAssets().open("PhoneFormats.dat");
|
||||||
ByteArrayOutputStream bos = new ByteArrayOutputStream();
|
bos = new ByteArrayOutputStream();
|
||||||
byte[] buf = new byte[1024];
|
byte[] buf = new byte[1024];
|
||||||
int len;
|
int len;
|
||||||
while ((len = stream.read(buf, 0, 1024)) != -1) {
|
while ((len = stream.read(buf, 0, 1024)) != -1) {
|
||||||
|
@ -111,6 +114,21 @@ public class PhoneFormat {
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return;
|
return;
|
||||||
|
} finally {
|
||||||
|
try {
|
||||||
|
if (bos != null) {
|
||||||
|
bos.close();
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
FileLog.e("tmessages", e);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
if (stream != null) {
|
||||||
|
stream.close();
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
FileLog.e("tmessages", e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (countryCode != null && countryCode.length() != 0) {
|
if (countryCode != null && countryCode.length() != 0) {
|
||||||
|
@ -119,10 +137,10 @@ public class PhoneFormat {
|
||||||
Locale loc = Locale.getDefault();
|
Locale loc = Locale.getDefault();
|
||||||
defaultCountry = loc.getCountry().toLowerCase();
|
defaultCountry = loc.getCountry().toLowerCase();
|
||||||
}
|
}
|
||||||
callingCodeOffsets = new HashMap<String, Integer>(255);
|
callingCodeOffsets = new HashMap<>(255);
|
||||||
callingCodeCountries = new HashMap<String, ArrayList<String>>(255);
|
callingCodeCountries = new HashMap<>(255);
|
||||||
callingCodeData = new HashMap<String, CallingCodeInfo>(10);
|
callingCodeData = new HashMap<>(10);
|
||||||
countryCallingCode = new HashMap<String, String>(255);
|
countryCallingCode = new HashMap<>(255);
|
||||||
|
|
||||||
parseDataHeader();
|
parseDataHeader();
|
||||||
initialzed = true;
|
initialzed = true;
|
||||||
|
@ -293,7 +311,7 @@ public class PhoneFormat {
|
||||||
|
|
||||||
offset += 2;
|
offset += 2;
|
||||||
|
|
||||||
ArrayList<String> strs = new ArrayList<String>(5);
|
ArrayList<String> strs = new ArrayList<>(5);
|
||||||
String str;
|
String str;
|
||||||
while ((str = valueString(offset)).length() != 0) {
|
while ((str = valueString(offset)).length() != 0) {
|
||||||
strs.add(str);
|
strs.add(str);
|
||||||
|
@ -302,14 +320,14 @@ public class PhoneFormat {
|
||||||
res.trunkPrefixes = strs;
|
res.trunkPrefixes = strs;
|
||||||
offset++;
|
offset++;
|
||||||
|
|
||||||
strs = new ArrayList<String>(5);
|
strs = new ArrayList<>(5);
|
||||||
while ((str = valueString(offset)).length() != 0) {
|
while ((str = valueString(offset)).length() != 0) {
|
||||||
strs.add(str);
|
strs.add(str);
|
||||||
offset += str.length() + 1;
|
offset += str.length() + 1;
|
||||||
}
|
}
|
||||||
res.intlPrefixes = strs;
|
res.intlPrefixes = strs;
|
||||||
|
|
||||||
ArrayList<RuleSet> ruleSets = new ArrayList<RuleSet>(setCnt);
|
ArrayList<RuleSet> ruleSets = new ArrayList<>(setCnt);
|
||||||
offset = start + block1Len;
|
offset = start + block1Len;
|
||||||
for (int s = 0; s < setCnt; s++) {
|
for (int s = 0; s < setCnt; s++) {
|
||||||
RuleSet ruleSet = new RuleSet();
|
RuleSet ruleSet = new RuleSet();
|
||||||
|
@ -317,7 +335,7 @@ public class PhoneFormat {
|
||||||
offset += 2;
|
offset += 2;
|
||||||
int ruleCnt = value16(offset);
|
int ruleCnt = value16(offset);
|
||||||
offset += 2;
|
offset += 2;
|
||||||
ArrayList<PhoneRule> rules = new ArrayList<PhoneRule>(ruleCnt);
|
ArrayList<PhoneRule> rules = new ArrayList<>(ruleCnt);
|
||||||
for (int r = 0; r < ruleCnt; r++) {
|
for (int r = 0; r < ruleCnt; r++) {
|
||||||
PhoneRule rule = new PhoneRule();
|
PhoneRule rule = new PhoneRule();
|
||||||
rule.minVal = value32(offset);
|
rule.minVal = value32(offset);
|
||||||
|
@ -380,7 +398,7 @@ public class PhoneFormat {
|
||||||
callingCodeOffsets.put(callingCode, offset);
|
callingCodeOffsets.put(callingCode, offset);
|
||||||
ArrayList<String> countries = callingCodeCountries.get(callingCode);
|
ArrayList<String> countries = callingCodeCountries.get(callingCode);
|
||||||
if (countries == null) {
|
if (countries == null) {
|
||||||
countries = new ArrayList<String>();
|
countries = new ArrayList<>();
|
||||||
callingCodeCountries.put(callingCode, countries);
|
callingCodeCountries.put(callingCode, countries);
|
||||||
}
|
}
|
||||||
countries.add(country);
|
countries.add(country);
|
||||||
|
|
|
@ -568,4 +568,18 @@ public class AndroidUtilities {
|
||||||
return UserConfig.passcodeHash.length() > 0 && wasInBackground &&
|
return UserConfig.passcodeHash.length() > 0 && wasInBackground &&
|
||||||
(UserConfig.appLocked || UserConfig.autoLockIn != 0 && UserConfig.lastPauseTime != 0 && !UserConfig.appLocked && (UserConfig.lastPauseTime + UserConfig.autoLockIn) <= ConnectionsManager.getInstance().getCurrentTime());
|
(UserConfig.appLocked || UserConfig.autoLockIn != 0 && UserConfig.lastPauseTime != 0 && !UserConfig.appLocked && (UserConfig.lastPauseTime + UserConfig.autoLockIn) <= ConnectionsManager.getInstance().getCurrentTime());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*public static void turnOffHardwareAcceleration(Window window) {
|
||||||
|
if (window == null || Build.MODEL == null || Build.VERSION.SDK_INT < 11) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (Build.MODEL.contains("GT-S5301") ||
|
||||||
|
Build.MODEL.contains("GT-S5303") ||
|
||||||
|
Build.MODEL.contains("GT-B5330") ||
|
||||||
|
Build.MODEL.contains("GT-S5302") ||
|
||||||
|
Build.MODEL.contains("GT-S6012B") ||
|
||||||
|
Build.MODEL.contains("MegaFon_SP-AI")) {
|
||||||
|
window.clearFlags(WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED);
|
||||||
|
}
|
||||||
|
}*/
|
||||||
}
|
}
|
||||||
|
|
|
@ -449,6 +449,11 @@ public class ImageLoader {
|
||||||
originalBitmap = scaledBitmap;
|
originalBitmap = scaledBitmap;
|
||||||
FileOutputStream stream = new FileOutputStream(thumbFile);
|
FileOutputStream stream = new FileOutputStream(thumbFile);
|
||||||
originalBitmap.compress(Bitmap.CompressFormat.JPEG, 60, stream);
|
originalBitmap.compress(Bitmap.CompressFormat.JPEG, 60, stream);
|
||||||
|
try {
|
||||||
|
stream.close();
|
||||||
|
} catch (Exception e) {
|
||||||
|
FileLog.e("tmessages", e);
|
||||||
|
}
|
||||||
final BitmapDrawable bitmapDrawable = new BitmapDrawable(originalBitmap);
|
final BitmapDrawable bitmapDrawable = new BitmapDrawable(originalBitmap);
|
||||||
AndroidUtilities.runOnUIThread(new Runnable() {
|
AndroidUtilities.runOnUIThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -615,7 +620,9 @@ public class ImageLoader {
|
||||||
if (mediaId != null) {
|
if (mediaId != null) {
|
||||||
MediaStore.Images.Thumbnails.getThumbnail(ApplicationLoader.applicationContext.getContentResolver(), mediaId, MediaStore.Images.Thumbnails.MINI_KIND, opts);
|
MediaStore.Images.Thumbnails.getThumbnail(ApplicationLoader.applicationContext.getContentResolver(), mediaId, MediaStore.Images.Thumbnails.MINI_KIND, opts);
|
||||||
} else {
|
} else {
|
||||||
BitmapFactory.decodeFile(cacheImage.finalFilePath.getAbsolutePath(), opts);
|
FileInputStream is = new FileInputStream(cacheFileFinal);
|
||||||
|
image = BitmapFactory.decodeStream(is, null, opts);
|
||||||
|
is.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
float photoW = opts.outWidth;
|
float photoW = opts.outWidth;
|
||||||
|
|
|
@ -444,10 +444,12 @@ public class LocaleController {
|
||||||
}
|
}
|
||||||
|
|
||||||
private HashMap<String, String> getLocaleFileStrings(File file) {
|
private HashMap<String, String> getLocaleFileStrings(File file) {
|
||||||
|
FileInputStream stream = null;
|
||||||
try {
|
try {
|
||||||
HashMap<String, String> stringMap = new HashMap<>();
|
HashMap<String, String> stringMap = new HashMap<>();
|
||||||
XmlPullParser parser = Xml.newPullParser();
|
XmlPullParser parser = Xml.newPullParser();
|
||||||
parser.setInput(new FileInputStream(file), "UTF-8");
|
stream = new FileInputStream(file);
|
||||||
|
parser.setInput(stream, "UTF-8");
|
||||||
int eventType = parser.getEventType();
|
int eventType = parser.getEventType();
|
||||||
String name = null;
|
String name = null;
|
||||||
String value = null;
|
String value = null;
|
||||||
|
@ -484,6 +486,15 @@ public class LocaleController {
|
||||||
return stringMap;
|
return stringMap;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
FileLog.e("tmessages", e);
|
FileLog.e("tmessages", e);
|
||||||
|
} finally {
|
||||||
|
try {
|
||||||
|
if (stream != null) {
|
||||||
|
stream.close();
|
||||||
|
stream = null;
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
FileLog.e("tmessages", e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1698,10 +1698,10 @@ public class MediaController implements NotificationCenter.NotificationCenterDel
|
||||||
FileLog.e("tmessages", e);
|
FileLog.e("tmessages", e);
|
||||||
result = false;
|
result = false;
|
||||||
} finally {
|
} finally {
|
||||||
if(source != null) {
|
if (source != null) {
|
||||||
source.close();
|
source.close();
|
||||||
}
|
}
|
||||||
if(destination != null) {
|
if (destination != null) {
|
||||||
destination.close();
|
destination.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,10 +9,12 @@
|
||||||
package org.telegram.android;
|
package org.telegram.android;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
import android.app.AlertDialog;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.content.pm.PackageInfo;
|
import android.content.pm.PackageInfo;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.text.Html;
|
import android.text.Html;
|
||||||
|
import android.util.Base64;
|
||||||
import android.util.SparseArray;
|
import android.util.SparseArray;
|
||||||
|
|
||||||
import org.telegram.messenger.ConnectionsManager;
|
import org.telegram.messenger.ConnectionsManager;
|
||||||
|
@ -20,11 +22,14 @@ import org.telegram.messenger.FileLoader;
|
||||||
import org.telegram.messenger.FileLog;
|
import org.telegram.messenger.FileLog;
|
||||||
import org.telegram.messenger.R;
|
import org.telegram.messenger.R;
|
||||||
import org.telegram.messenger.RPCRequest;
|
import org.telegram.messenger.RPCRequest;
|
||||||
|
import org.telegram.messenger.SerializedData;
|
||||||
|
import org.telegram.messenger.TLClassStore;
|
||||||
import org.telegram.messenger.TLObject;
|
import org.telegram.messenger.TLObject;
|
||||||
import org.telegram.messenger.TLRPC;
|
import org.telegram.messenger.TLRPC;
|
||||||
import org.telegram.messenger.UserConfig;
|
import org.telegram.messenger.UserConfig;
|
||||||
import org.telegram.messenger.Utilities;
|
import org.telegram.messenger.Utilities;
|
||||||
import org.telegram.messenger.ApplicationLoader;
|
import org.telegram.messenger.ApplicationLoader;
|
||||||
|
import org.telegram.ui.ActionBar.BaseFragment;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
@ -86,6 +91,8 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
||||||
public int fontSize = AndroidUtilities.dp(16);
|
public int fontSize = AndroidUtilities.dp(16);
|
||||||
public int maxGroupCount = 200;
|
public int maxGroupCount = 200;
|
||||||
public int maxBroadcastCount = 100;
|
public int maxBroadcastCount = 100;
|
||||||
|
public int groupBigSize;
|
||||||
|
private ArrayList<TLRPC.TL_disabledFeature> disabledFeatures = new ArrayList<>();
|
||||||
|
|
||||||
private class UserActionUpdates extends TLRPC.Updates {
|
private class UserActionUpdates extends TLRPC.Updates {
|
||||||
|
|
||||||
|
@ -140,7 +147,26 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
||||||
preferences = ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", Activity.MODE_PRIVATE);
|
preferences = ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", Activity.MODE_PRIVATE);
|
||||||
maxGroupCount = preferences.getInt("maxGroupCount", 200);
|
maxGroupCount = preferences.getInt("maxGroupCount", 200);
|
||||||
maxBroadcastCount = preferences.getInt("maxBroadcastCount", 100);
|
maxBroadcastCount = preferences.getInt("maxBroadcastCount", 100);
|
||||||
|
groupBigSize = preferences.getInt("groupBigSize", 10);
|
||||||
fontSize = preferences.getInt("fons_size", AndroidUtilities.isTablet() ? 18 : 16);
|
fontSize = preferences.getInt("fons_size", AndroidUtilities.isTablet() ? 18 : 16);
|
||||||
|
String disabledFeaturesString = preferences.getString("disabledFeatures", null);
|
||||||
|
if (disabledFeaturesString != null && disabledFeaturesString.length() != 0) {
|
||||||
|
try {
|
||||||
|
byte[] bytes = Base64.decode(disabledFeaturesString, Base64.DEFAULT);
|
||||||
|
if (bytes != null) {
|
||||||
|
SerializedData data = new SerializedData(bytes);
|
||||||
|
int count = data.readInt32();
|
||||||
|
for (int a = 0; a < count; a++) {
|
||||||
|
TLRPC.TL_disabledFeature feature = (TLRPC.TL_disabledFeature) TLClassStore.Instance().TLdeserialize(data, data.readInt32());
|
||||||
|
if (feature != null && feature.feature != null && feature.description != null) {
|
||||||
|
disabledFeatures.add(feature);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
FileLog.e("tmessages", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateConfig(final TLRPC.TL_config config) {
|
public void updateConfig(final TLRPC.TL_config config) {
|
||||||
|
@ -149,15 +175,52 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
||||||
public void run() {
|
public void run() {
|
||||||
maxBroadcastCount = config.broadcast_size_max;
|
maxBroadcastCount = config.broadcast_size_max;
|
||||||
maxGroupCount = config.chat_size_max;
|
maxGroupCount = config.chat_size_max;
|
||||||
|
groupBigSize = config.chat_big_size;
|
||||||
|
disabledFeatures = config.disabled_features;
|
||||||
|
|
||||||
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", Activity.MODE_PRIVATE);
|
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", Activity.MODE_PRIVATE);
|
||||||
SharedPreferences.Editor editor = preferences.edit();
|
SharedPreferences.Editor editor = preferences.edit();
|
||||||
editor.putInt("maxGroupCount", maxGroupCount);
|
editor.putInt("maxGroupCount", maxGroupCount);
|
||||||
editor.putInt("maxBroadcastCount", maxBroadcastCount);
|
editor.putInt("maxBroadcastCount", maxBroadcastCount);
|
||||||
|
editor.putInt("groupBigSize", groupBigSize);
|
||||||
|
try {
|
||||||
|
SerializedData data = new SerializedData();
|
||||||
|
data.writeInt32(disabledFeatures.size());
|
||||||
|
for (TLRPC.TL_disabledFeature disabledFeature : disabledFeatures) {
|
||||||
|
disabledFeature.serializeToStream(data);
|
||||||
|
}
|
||||||
|
String string = Base64.encodeToString(data.toByteArray(), Base64.DEFAULT);
|
||||||
|
if (string != null && string.length() != 0) {
|
||||||
|
editor.putString("disabledFeatures", string);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
editor.remove("disabledFeatures");
|
||||||
|
FileLog.e("tmessages", e);
|
||||||
|
}
|
||||||
editor.commit();
|
editor.commit();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isFeatureEnabled(String feature, BaseFragment fragment) {
|
||||||
|
if (feature == null || feature.length() == 0 || getInstance().disabledFeatures.isEmpty() || fragment == null) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
for (TLRPC.TL_disabledFeature disabledFeature : getInstance().disabledFeatures) {
|
||||||
|
if (disabledFeature.feature.equals(feature)) {
|
||||||
|
if (fragment.getParentActivity() != null) {
|
||||||
|
AlertDialog.Builder builder = new AlertDialog.Builder(fragment.getParentActivity());
|
||||||
|
builder.setTitle("Oops!");
|
||||||
|
builder.setPositiveButton(R.string.OK, null);
|
||||||
|
builder.setMessage(disabledFeature.description);
|
||||||
|
fragment.showAlertDialog(builder);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public void addSupportUser() {
|
public void addSupportUser() {
|
||||||
TLRPC.TL_userForeign user = new TLRPC.TL_userForeign();
|
TLRPC.TL_userForeign user = new TLRPC.TL_userForeign();
|
||||||
user.phone = "333";
|
user.phone = "333";
|
||||||
|
@ -3582,4 +3645,6 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -841,7 +841,7 @@ public class NotificationsController {
|
||||||
notifyCheck = isLast;
|
notifyCheck = isLast;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!popupMessages.isEmpty() && oldCount != popupMessages.size() && !AndroidUtilities.needShowPasscode(false)) {
|
if (!popupMessages.isEmpty() && oldCount != popupMessages.size() && !AndroidUtilities.needShowPasscode(false) && !UserConfig.isWaitingForPasscodeEnter) {
|
||||||
if (ApplicationLoader.mainInterfacePaused || !ApplicationLoader.isScreenOn) {
|
if (ApplicationLoader.mainInterfacePaused || !ApplicationLoader.isScreenOn) {
|
||||||
MessageObject messageObject = messageObjects.get(0);
|
MessageObject messageObject = messageObjects.get(0);
|
||||||
if (popup == 3 || popup == 1 && ApplicationLoader.isScreenOn || popup == 2 && !ApplicationLoader.isScreenOn) {
|
if (popup == 3 || popup == 1 && ApplicationLoader.isScreenOn || popup == 2 && !ApplicationLoader.isScreenOn) {
|
||||||
|
|
|
@ -366,6 +366,7 @@ public class ConnectionsManager implements Action.ActionDelegate, TcpConnection.
|
||||||
datacenters.put(datacenter.datacenterId, datacenter);
|
datacenters.put(datacenter.datacenterId, datacenter);
|
||||||
}
|
}
|
||||||
currentDatacenterId = data.readInt32();
|
currentDatacenterId = data.readInt32();
|
||||||
|
data.cleanup();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
UserConfig.clearConfig();
|
UserConfig.clearConfig();
|
||||||
}
|
}
|
||||||
|
@ -388,6 +389,7 @@ public class ConnectionsManager implements Action.ActionDelegate, TcpConnection.
|
||||||
for (int a = 0; a < count; a++) {
|
for (int a = 0; a < count; a++) {
|
||||||
sessionsToDestroy.add(data.readInt64());
|
sessionsToDestroy.add(data.readInt64());
|
||||||
}
|
}
|
||||||
|
data.cleanup();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -405,6 +407,7 @@ public class ConnectionsManager implements Action.ActionDelegate, TcpConnection.
|
||||||
Datacenter datacenter = new Datacenter(data, 1);
|
Datacenter datacenter = new Datacenter(data, 1);
|
||||||
datacenters.put(datacenter.datacenterId, datacenter);
|
datacenters.put(datacenter.datacenterId, datacenter);
|
||||||
}
|
}
|
||||||
|
data.cleanup();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -528,6 +531,7 @@ public class ConnectionsManager implements Action.ActionDelegate, TcpConnection.
|
||||||
data.writeInt64(session);
|
data.writeInt64(session);
|
||||||
}
|
}
|
||||||
editor.putString("sessionsToDestroy", Base64.encodeToString(data.toByteArray(), Base64.DEFAULT));
|
editor.putString("sessionsToDestroy", Base64.encodeToString(data.toByteArray(), Base64.DEFAULT));
|
||||||
|
data.cleanup();
|
||||||
} else {
|
} else {
|
||||||
editor.remove("sessionsToDestroy");
|
editor.remove("sessionsToDestroy");
|
||||||
}
|
}
|
||||||
|
@ -539,6 +543,7 @@ public class ConnectionsManager implements Action.ActionDelegate, TcpConnection.
|
||||||
datacenter.SerializeToStream(data);
|
datacenter.SerializeToStream(data);
|
||||||
}
|
}
|
||||||
editor.putString("datacenters", Base64.encodeToString(data.toByteArray(), Base64.DEFAULT));
|
editor.putString("datacenters", Base64.encodeToString(data.toByteArray(), Base64.DEFAULT));
|
||||||
|
data.cleanup();
|
||||||
} else {
|
} else {
|
||||||
editor.remove("datacenters");
|
editor.remove("datacenters");
|
||||||
}
|
}
|
||||||
|
@ -763,8 +768,12 @@ public class ConnectionsManager implements Action.ActionDelegate, TcpConnection.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (error == null) {
|
if (error == null) {
|
||||||
lastDcUpdateTime = (int)(System.currentTimeMillis() / 1000);
|
|
||||||
TLRPC.TL_config config = (TLRPC.TL_config)response;
|
TLRPC.TL_config config = (TLRPC.TL_config)response;
|
||||||
|
int updateIn = config.expires - getCurrentTime();
|
||||||
|
if (updateIn <= 0) {
|
||||||
|
updateIn = 120;
|
||||||
|
}
|
||||||
|
lastDcUpdateTime = (int)(System.currentTimeMillis() / 1000) - DC_UPDATE_TIME + updateIn;
|
||||||
ArrayList<Datacenter> datacentersArr = new ArrayList<>();
|
ArrayList<Datacenter> datacentersArr = new ArrayList<>();
|
||||||
HashMap<Integer, Datacenter> datacenterMap = new HashMap<>();
|
HashMap<Integer, Datacenter> datacenterMap = new HashMap<>();
|
||||||
for (TLRPC.TL_dcOption datacenterDesc : config.dc_options) {
|
for (TLRPC.TL_dcOption datacenterDesc : config.dc_options) {
|
||||||
|
@ -1338,6 +1347,7 @@ public class ConnectionsManager implements Action.ActionDelegate, TcpConnection.
|
||||||
if (canCompress) {
|
if (canCompress) {
|
||||||
try {
|
try {
|
||||||
byte[] data = Utilities.compress(os.toByteArray());
|
byte[] data = Utilities.compress(os.toByteArray());
|
||||||
|
os.cleanup();
|
||||||
if (data.length < requestLength) {
|
if (data.length < requestLength) {
|
||||||
TLRPC.TL_gzip_packed packed = new TLRPC.TL_gzip_packed();
|
TLRPC.TL_gzip_packed packed = new TLRPC.TL_gzip_packed();
|
||||||
packed.packed_data = data;
|
packed.packed_data = data;
|
||||||
|
@ -1345,6 +1355,7 @@ public class ConnectionsManager implements Action.ActionDelegate, TcpConnection.
|
||||||
os = new SerializedData(true);
|
os = new SerializedData(true);
|
||||||
packed.serializeToStream(os);
|
packed.serializeToStream(os);
|
||||||
requestLength = os.length();
|
requestLength = os.length();
|
||||||
|
os.cleanup();
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
FileLog.e("tmessages", e);
|
FileLog.e("tmessages", e);
|
||||||
|
@ -1723,6 +1734,7 @@ public class ConnectionsManager implements Action.ActionDelegate, TcpConnection.
|
||||||
if (quickAckId != null) {
|
if (quickAckId != null) {
|
||||||
SerializedData data = new SerializedData(messageKeyFull);
|
SerializedData data = new SerializedData(messageKeyFull);
|
||||||
quickAckId.add(data.readInt32() & 0x7fffffff);
|
quickAckId.add(data.readInt32() & 0x7fffffff);
|
||||||
|
data.cleanup();
|
||||||
}
|
}
|
||||||
|
|
||||||
MessageKeyData keyData = Utilities.generateMessageKeyData(datacenter.authKey, messageKey, false);
|
MessageKeyData keyData = Utilities.generateMessageKeyData(datacenter.authKey, messageKey, false);
|
||||||
|
|
|
@ -91,6 +91,14 @@ public class FileUploadOperation {
|
||||||
remove(fileKey + "_iv").
|
remove(fileKey + "_iv").
|
||||||
remove(fileKey + "_key").
|
remove(fileKey + "_key").
|
||||||
remove(fileKey + "_ivc").commit();
|
remove(fileKey + "_ivc").commit();
|
||||||
|
try {
|
||||||
|
if (stream != null) {
|
||||||
|
stream.close();
|
||||||
|
stream = null;
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
FileLog.e("tmessages", e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void checkNewDataAvailable(final long finalSize) {
|
protected void checkNewDataAvailable(final long finalSize) {
|
||||||
|
|
|
@ -55,7 +55,7 @@ public class HandshakeAction extends Action implements TcpConnection.TcpConnecti
|
||||||
}
|
}
|
||||||
datacenter.connection.delegate = this;
|
datacenter.connection.delegate = this;
|
||||||
|
|
||||||
processedMessageIds = new ArrayList<Long>();
|
processedMessageIds = new ArrayList<>();
|
||||||
authNonce = null;
|
authNonce = null;
|
||||||
authServerNonce = null;
|
authServerNonce = null;
|
||||||
authNewNonce = null;
|
authNewNonce = null;
|
||||||
|
@ -92,10 +92,10 @@ public class HandshakeAction extends Action implements TcpConnection.TcpConnecti
|
||||||
HashMap<String, Object> selectPublicKey(ArrayList<Long> fingerprints) {
|
HashMap<String, Object> selectPublicKey(ArrayList<Long> fingerprints) {
|
||||||
synchronized (lock) {
|
synchronized (lock) {
|
||||||
if (serverPublicKeys == null) {
|
if (serverPublicKeys == null) {
|
||||||
serverPublicKeys = new ArrayList<HashMap<String, Object>>();
|
serverPublicKeys = new ArrayList<>();
|
||||||
HashMap<String, Object> map;
|
HashMap<String, Object> map;
|
||||||
|
|
||||||
map = new HashMap<String, Object>();
|
map = new HashMap<>();
|
||||||
map.put("key", new BigInteger[]{
|
map.put("key", new BigInteger[]{
|
||||||
new BigInteger("c150023e2f70db7985ded064759cfecf0af328e69a41daf4d6f01b538135" +
|
new BigInteger("c150023e2f70db7985ded064759cfecf0af328e69a41daf4d6f01b538135" +
|
||||||
"a6f91f8f8b2a0ec9ba9720ce352efcf6c5680ffc424bd634864902de0b4bd6d49f4e580230e" +
|
"a6f91f8f8b2a0ec9ba9720ce352efcf6c5680ffc424bd634864902de0b4bd6d49f4e580230e" +
|
||||||
|
@ -108,7 +108,7 @@ public class HandshakeAction extends Action implements TcpConnection.TcpConnecti
|
||||||
map.put("fingerprint", 0xc3b42b026ce86b21L);
|
map.put("fingerprint", 0xc3b42b026ce86b21L);
|
||||||
serverPublicKeys.add(map);
|
serverPublicKeys.add(map);
|
||||||
|
|
||||||
map = new HashMap<String, Object>();
|
map = new HashMap<>();
|
||||||
map.put("key", new BigInteger[]{
|
map.put("key", new BigInteger[]{
|
||||||
new BigInteger("c6aeda78b02a251db4b6441031f467fa871faed32526c436524b1fb3b5dc" +
|
new BigInteger("c6aeda78b02a251db4b6441031f467fa871faed32526c436524b1fb3b5dc" +
|
||||||
"a28efb8c089dd1b46d92c895993d87108254951c5f001a0f055f3063dcd14d431a300eb9e29" +
|
"a28efb8c089dd1b46d92c895993d87108254951c5f001a0f055f3063dcd14d431a300eb9e29" +
|
||||||
|
@ -121,7 +121,7 @@ public class HandshakeAction extends Action implements TcpConnection.TcpConnecti
|
||||||
map.put("fingerprint", 0x9a996a1db11c729bL);
|
map.put("fingerprint", 0x9a996a1db11c729bL);
|
||||||
serverPublicKeys.add(map);
|
serverPublicKeys.add(map);
|
||||||
|
|
||||||
map = new HashMap<String, Object>();
|
map = new HashMap<>();
|
||||||
map.put("key", new BigInteger[]{
|
map.put("key", new BigInteger[]{
|
||||||
new BigInteger("b1066749655935f0a5936f517034c943bea7f3365a8931ae52c8bcb14856" +
|
new BigInteger("b1066749655935f0a5936f517034c943bea7f3365a8931ae52c8bcb14856" +
|
||||||
"f004b83d26cf2839be0f22607470d67481771c1ce5ec31de16b20bbaa4ecd2f7d2ecf6b6356" +
|
"f004b83d26cf2839be0f22607470d67481771c1ce5ec31de16b20bbaa4ecd2f7d2ecf6b6356" +
|
||||||
|
@ -134,7 +134,7 @@ public class HandshakeAction extends Action implements TcpConnection.TcpConnecti
|
||||||
map.put("fingerprint", 0xb05b2a6f70cdea78L);
|
map.put("fingerprint", 0xb05b2a6f70cdea78L);
|
||||||
serverPublicKeys.add(map);
|
serverPublicKeys.add(map);
|
||||||
|
|
||||||
map = new HashMap<String, Object>();
|
map = new HashMap<>();
|
||||||
map.put("key", new BigInteger[]{
|
map.put("key", new BigInteger[]{
|
||||||
new BigInteger("c2a8c55b4a62e2b78a19b91cf692bcdc4ba7c23fe4d06f194e2a0c30f6d9" +
|
new BigInteger("c2a8c55b4a62e2b78a19b91cf692bcdc4ba7c23fe4d06f194e2a0c30f6d9" +
|
||||||
"996f7d1a2bcc89bc1ac4333d44359a6c433252d1a8402d9970378b5912b75bc8cc3fa76710a" +
|
"996f7d1a2bcc89bc1ac4333d44359a6c433252d1a8402d9970378b5912b75bc8cc3fa76710a" +
|
||||||
|
@ -190,7 +190,7 @@ public class HandshakeAction extends Action implements TcpConnection.TcpConnecti
|
||||||
if (message instanceof TLRPC.TL_resPQ) {
|
if (message instanceof TLRPC.TL_resPQ) {
|
||||||
if (processedPQRes) {
|
if (processedPQRes) {
|
||||||
TLRPC.TL_msgs_ack msgsAck = new TLRPC.TL_msgs_ack();
|
TLRPC.TL_msgs_ack msgsAck = new TLRPC.TL_msgs_ack();
|
||||||
msgsAck.msg_ids = new ArrayList<Long>();
|
msgsAck.msg_ids = new ArrayList<>();
|
||||||
msgsAck.msg_ids.add(messageId);
|
msgsAck.msg_ids.add(messageId);
|
||||||
sendMessageData(msgsAck, generateMessageId());
|
sendMessageData(msgsAck, generateMessageId());
|
||||||
return;
|
return;
|
||||||
|
@ -250,6 +250,7 @@ public class HandshakeAction extends Action implements TcpConnection.TcpConnecti
|
||||||
innerData.serializeToStream(os);
|
innerData.serializeToStream(os);
|
||||||
|
|
||||||
byte[] innerDataBytes = os.toByteArray();
|
byte[] innerDataBytes = os.toByteArray();
|
||||||
|
os.cleanup();
|
||||||
|
|
||||||
SerializedData dataWithHash = new SerializedData();
|
SerializedData dataWithHash = new SerializedData();
|
||||||
dataWithHash.writeRaw(Utilities.computeSHA1(innerDataBytes));
|
dataWithHash.writeRaw(Utilities.computeSHA1(innerDataBytes));
|
||||||
|
@ -261,6 +262,7 @@ public class HandshakeAction extends Action implements TcpConnection.TcpConnecti
|
||||||
}
|
}
|
||||||
|
|
||||||
byte[] encryptedBytes = Utilities.encryptWithRSA((BigInteger[])publicKey.get("key"), dataWithHash.toByteArray());
|
byte[] encryptedBytes = Utilities.encryptWithRSA((BigInteger[])publicKey.get("key"), dataWithHash.toByteArray());
|
||||||
|
dataWithHash.cleanup();
|
||||||
SerializedData encryptedData = new SerializedData();
|
SerializedData encryptedData = new SerializedData();
|
||||||
encryptedData.writeRaw(encryptedBytes);
|
encryptedData.writeRaw(encryptedBytes);
|
||||||
if (encryptedData.length() < 256) {
|
if (encryptedData.length() < 256) {
|
||||||
|
@ -269,12 +271,14 @@ public class HandshakeAction extends Action implements TcpConnection.TcpConnecti
|
||||||
newEncryptedData.writeByte(0);
|
newEncryptedData.writeByte(0);
|
||||||
}
|
}
|
||||||
newEncryptedData.writeRaw(encryptedData.toByteArray());
|
newEncryptedData.writeRaw(encryptedData.toByteArray());
|
||||||
|
encryptedData.cleanup();
|
||||||
encryptedData = newEncryptedData;
|
encryptedData = newEncryptedData;
|
||||||
}
|
}
|
||||||
reqDH.encrypted_data = encryptedData.toByteArray();
|
reqDH.encrypted_data = encryptedData.toByteArray();
|
||||||
|
encryptedData.cleanup();
|
||||||
|
|
||||||
TLRPC.TL_msgs_ack msgsAck = new TLRPC.TL_msgs_ack();
|
TLRPC.TL_msgs_ack msgsAck = new TLRPC.TL_msgs_ack();
|
||||||
msgsAck.msg_ids = new ArrayList<Long>();
|
msgsAck.msg_ids = new ArrayList<>();
|
||||||
msgsAck.msg_ids.add(messageIdf);
|
msgsAck.msg_ids.add(messageIdf);
|
||||||
sendMessageData(msgsAck, generateMessageId());
|
sendMessageData(msgsAck, generateMessageId());
|
||||||
|
|
||||||
|
@ -305,8 +309,10 @@ public class HandshakeAction extends Action implements TcpConnection.TcpConnecti
|
||||||
serverNonceAndNewNonce.writeRaw(authServerNonce);
|
serverNonceAndNewNonce.writeRaw(authServerNonce);
|
||||||
serverNonceAndNewNonce.writeRaw(authNewNonce);
|
serverNonceAndNewNonce.writeRaw(authNewNonce);
|
||||||
tmpAesKey.writeRaw(Utilities.computeSHA1(newNonceAndServerNonce.toByteArray()));
|
tmpAesKey.writeRaw(Utilities.computeSHA1(newNonceAndServerNonce.toByteArray()));
|
||||||
|
newNonceAndServerNonce.cleanup();
|
||||||
|
|
||||||
byte[] serverNonceAndNewNonceHash = Utilities.computeSHA1(serverNonceAndNewNonce.toByteArray());
|
byte[] serverNonceAndNewNonceHash = Utilities.computeSHA1(serverNonceAndNewNonce.toByteArray());
|
||||||
|
serverNonceAndNewNonce.cleanup();
|
||||||
byte[] serverNonceAndNewNonceHash0_12 = new byte[12];
|
byte[] serverNonceAndNewNonceHash0_12 = new byte[12];
|
||||||
System.arraycopy(serverNonceAndNewNonceHash, 0, serverNonceAndNewNonceHash0_12, 0, 12);
|
System.arraycopy(serverNonceAndNewNonceHash, 0, serverNonceAndNewNonceHash0_12, 0, 12);
|
||||||
|
|
||||||
|
@ -322,6 +328,7 @@ public class HandshakeAction extends Action implements TcpConnection.TcpConnecti
|
||||||
newNonceAndNewNonce.writeRaw(authNewNonce);
|
newNonceAndNewNonce.writeRaw(authNewNonce);
|
||||||
newNonceAndNewNonce.writeRaw(authNewNonce);
|
newNonceAndNewNonce.writeRaw(authNewNonce);
|
||||||
tmpAesIv.writeRaw(Utilities.computeSHA1(newNonceAndNewNonce.toByteArray()));
|
tmpAesIv.writeRaw(Utilities.computeSHA1(newNonceAndNewNonce.toByteArray()));
|
||||||
|
newNonceAndNewNonce.cleanup();
|
||||||
|
|
||||||
byte[] newNonce0_4 = new byte[4];
|
byte[] newNonce0_4 = new byte[4];
|
||||||
System.arraycopy(authNewNonce, 0, newNonce0_4, 0, 4);
|
System.arraycopy(authNewNonce, 0, newNonce0_4, 0, 4);
|
||||||
|
@ -417,6 +424,7 @@ public class HandshakeAction extends Action implements TcpConnection.TcpConnecti
|
||||||
serverSaltData.writeByte(x);
|
serverSaltData.writeByte(x);
|
||||||
}
|
}
|
||||||
ByteBuffer saltBuffer = ByteBuffer.wrap(serverSaltData.toByteArray());
|
ByteBuffer saltBuffer = ByteBuffer.wrap(serverSaltData.toByteArray());
|
||||||
|
serverSaltData.cleanup();
|
||||||
|
|
||||||
timeDifference = dhInnerData.server_time - (int)(System.currentTimeMillis() / 1000);
|
timeDifference = dhInnerData.server_time - (int)(System.currentTimeMillis() / 1000);
|
||||||
|
|
||||||
|
@ -455,8 +463,11 @@ public class HandshakeAction extends Action implements TcpConnection.TcpConnecti
|
||||||
Utilities.aesIgeEncryption(clientDataWithHash.buffer, tmpAesKey.toByteArray(), tmpAesIv.toByteArray(), true, false, 0, clientDataWithHash.length());
|
Utilities.aesIgeEncryption(clientDataWithHash.buffer, tmpAesKey.toByteArray(), tmpAesIv.toByteArray(), true, false, 0, clientDataWithHash.length());
|
||||||
setClientDhParams.encrypted_data = clientDataWithHash;
|
setClientDhParams.encrypted_data = clientDataWithHash;
|
||||||
|
|
||||||
|
tmpAesKey.cleanup();
|
||||||
|
tmpAesIv.cleanup();
|
||||||
|
|
||||||
TLRPC.TL_msgs_ack msgsAck = new TLRPC.TL_msgs_ack();
|
TLRPC.TL_msgs_ack msgsAck = new TLRPC.TL_msgs_ack();
|
||||||
msgsAck.msg_ids = new ArrayList<Long>();
|
msgsAck.msg_ids = new ArrayList<>();
|
||||||
msgsAck.msg_ids.add(messageId);
|
msgsAck.msg_ids.add(messageId);
|
||||||
sendMessageData(msgsAck, generateMessageId());
|
sendMessageData(msgsAck, generateMessageId());
|
||||||
|
|
||||||
|
@ -494,7 +505,7 @@ public class HandshakeAction extends Action implements TcpConnection.TcpConnecti
|
||||||
}
|
}
|
||||||
|
|
||||||
TLRPC.TL_msgs_ack msgsAck = new TLRPC.TL_msgs_ack();
|
TLRPC.TL_msgs_ack msgsAck = new TLRPC.TL_msgs_ack();
|
||||||
msgsAck.msg_ids = new ArrayList<Long>();
|
msgsAck.msg_ids = new ArrayList<>();
|
||||||
msgsAck.msg_ids.add(messageId);
|
msgsAck.msg_ids.add(messageId);
|
||||||
sendMessageData(msgsAck, generateMessageId());
|
sendMessageData(msgsAck, generateMessageId());
|
||||||
|
|
||||||
|
@ -507,6 +518,7 @@ public class HandshakeAction extends Action implements TcpConnection.TcpConnecti
|
||||||
newNonce1.writeByte(1);
|
newNonce1.writeByte(1);
|
||||||
newNonce1.writeRaw(authKeyAuxHash);
|
newNonce1.writeRaw(authKeyAuxHash);
|
||||||
byte[] newNonceHash1Full = Utilities.computeSHA1(newNonce1.toByteArray());
|
byte[] newNonceHash1Full = Utilities.computeSHA1(newNonce1.toByteArray());
|
||||||
|
newNonce1.cleanup();
|
||||||
byte[] newNonceHash1 = new byte[16];
|
byte[] newNonceHash1 = new byte[16];
|
||||||
System.arraycopy(newNonceHash1Full, newNonceHash1Full.length - 16, newNonceHash1, 0, 16);
|
System.arraycopy(newNonceHash1Full, newNonceHash1Full.length - 16, newNonceHash1, 0, 16);
|
||||||
|
|
||||||
|
@ -515,6 +527,7 @@ public class HandshakeAction extends Action implements TcpConnection.TcpConnecti
|
||||||
newNonce2.writeByte(2);
|
newNonce2.writeByte(2);
|
||||||
newNonce2.writeRaw(authKeyAuxHash);
|
newNonce2.writeRaw(authKeyAuxHash);
|
||||||
byte[] newNonceHash2Full = Utilities.computeSHA1(newNonce2.toByteArray());
|
byte[] newNonceHash2Full = Utilities.computeSHA1(newNonce2.toByteArray());
|
||||||
|
newNonce2.cleanup();
|
||||||
byte[] newNonceHash2 = new byte[16];
|
byte[] newNonceHash2 = new byte[16];
|
||||||
System.arraycopy(newNonceHash2Full, newNonceHash2Full.length - 16, newNonceHash2, 0, 16);
|
System.arraycopy(newNonceHash2Full, newNonceHash2Full.length - 16, newNonceHash2, 0, 16);
|
||||||
|
|
||||||
|
@ -523,6 +536,7 @@ public class HandshakeAction extends Action implements TcpConnection.TcpConnecti
|
||||||
newNonce3.writeByte(3);
|
newNonce3.writeByte(3);
|
||||||
newNonce3.writeRaw(authKeyAuxHash);
|
newNonce3.writeRaw(authKeyAuxHash);
|
||||||
byte[] newNonceHash3Full = Utilities.computeSHA1(newNonce3.toByteArray());
|
byte[] newNonceHash3Full = Utilities.computeSHA1(newNonce3.toByteArray());
|
||||||
|
newNonce3.cleanup();
|
||||||
byte[] newNonceHash3 = new byte[16];
|
byte[] newNonceHash3 = new byte[16];
|
||||||
System.arraycopy(newNonceHash3Full, newNonceHash3Full.length - 16, newNonceHash3, 0, 16);
|
System.arraycopy(newNonceHash3Full, newNonceHash3Full.length - 16, newNonceHash3, 0, 16);
|
||||||
|
|
||||||
|
@ -544,7 +558,7 @@ public class HandshakeAction extends Action implements TcpConnection.TcpConnecti
|
||||||
datacenter.authKey = authKey;
|
datacenter.authKey = authKey;
|
||||||
datacenter.authKeyId = authKeyId;
|
datacenter.authKeyId = authKeyId;
|
||||||
datacenter.addServerSalt(serverSalt);
|
datacenter.addServerSalt(serverSalt);
|
||||||
HashMap<String, Object> resultDict = new HashMap<String, Object>();
|
HashMap<String, Object> resultDict = new HashMap<>();
|
||||||
resultDict.put("timeDifference", timeDifference);
|
resultDict.put("timeDifference", timeDifference);
|
||||||
if (delegate != null) {
|
if (delegate != null) {
|
||||||
delegate.ActionDidFinishExecution(parent, resultDict);
|
delegate.ActionDidFinishExecution(parent, resultDict);
|
||||||
|
@ -575,7 +589,7 @@ public class HandshakeAction extends Action implements TcpConnection.TcpConnecti
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
TLRPC.TL_msgs_ack msgsAck = new TLRPC.TL_msgs_ack();
|
TLRPC.TL_msgs_ack msgsAck = new TLRPC.TL_msgs_ack();
|
||||||
msgsAck.msg_ids = new ArrayList<Long>();
|
msgsAck.msg_ids = new ArrayList<>();
|
||||||
msgsAck.msg_ids.add(messageId);
|
msgsAck.msg_ids.add(messageId);
|
||||||
sendMessageData(msgsAck, generateMessageId());
|
sendMessageData(msgsAck, generateMessageId());
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,6 +49,41 @@ public class SerializedData extends AbsSerializedData {
|
||||||
in = new DataInputStream(inbuf);
|
in = new DataInputStream(inbuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void cleanup() {
|
||||||
|
try {
|
||||||
|
if (inbuf != null) {
|
||||||
|
inbuf.close();
|
||||||
|
inbuf = null;
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
FileLog.e("tmessages", e);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
if (in != null) {
|
||||||
|
in.close();
|
||||||
|
in = null;
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
FileLog.e("tmessages", e);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
if (outbuf != null) {
|
||||||
|
outbuf.close();
|
||||||
|
outbuf = null;
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
FileLog.e("tmessages", e);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
if (out != null) {
|
||||||
|
out.close();
|
||||||
|
out = null;
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
FileLog.e("tmessages", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public SerializedData(File file) throws Exception {
|
public SerializedData(File file) throws Exception {
|
||||||
FileInputStream is = new FileInputStream(file);
|
FileInputStream is = new FileInputStream(file);
|
||||||
byte[] data = new byte[(int)file.length()];
|
byte[] data = new byte[(int)file.length()];
|
||||||
|
|
|
@ -216,6 +216,7 @@ public class TLClassStore {
|
||||||
classStore.put(TLRPC.TL_userStatusRecently.constructor, TLRPC.TL_userStatusRecently.class);
|
classStore.put(TLRPC.TL_userStatusRecently.constructor, TLRPC.TL_userStatusRecently.class);
|
||||||
classStore.put(TLRPC.TL_msg_copy.constructor, TLRPC.TL_msg_copy.class);
|
classStore.put(TLRPC.TL_msg_copy.constructor, TLRPC.TL_msg_copy.class);
|
||||||
classStore.put(TLRPC.TL_contacts_importedContacts.constructor, TLRPC.TL_contacts_importedContacts.class);
|
classStore.put(TLRPC.TL_contacts_importedContacts.constructor, TLRPC.TL_contacts_importedContacts.class);
|
||||||
|
classStore.put(TLRPC.TL_disabledFeature.constructor, TLRPC.TL_disabledFeature.class);
|
||||||
classStore.put(TLRPC.TL_futureSalt.constructor, TLRPC.TL_futureSalt.class);
|
classStore.put(TLRPC.TL_futureSalt.constructor, TLRPC.TL_futureSalt.class);
|
||||||
classStore.put(TLRPC.TL_updateEncryptedMessagesRead.constructor, TLRPC.TL_updateEncryptedMessagesRead.class);
|
classStore.put(TLRPC.TL_updateEncryptedMessagesRead.constructor, TLRPC.TL_updateEncryptedMessagesRead.class);
|
||||||
classStore.put(TLRPC.TL_updateContactLink.constructor, TLRPC.TL_updateContactLink.class);
|
classStore.put(TLRPC.TL_updateContactLink.constructor, TLRPC.TL_updateContactLink.class);
|
||||||
|
@ -413,6 +414,7 @@ public class TLClassStore {
|
||||||
classStore.put(TLRPC.TL_decryptedMessageHolder.constructor, TLRPC.TL_decryptedMessageHolder.class);
|
classStore.put(TLRPC.TL_decryptedMessageHolder.constructor, TLRPC.TL_decryptedMessageHolder.class);
|
||||||
classStore.put(TLRPC.TL_documentEncrypted_old.constructor, TLRPC.TL_documentEncrypted_old.class);
|
classStore.put(TLRPC.TL_documentEncrypted_old.constructor, TLRPC.TL_documentEncrypted_old.class);
|
||||||
classStore.put(TLRPC.TL_document_old.constructor, TLRPC.TL_document_old.class);
|
classStore.put(TLRPC.TL_document_old.constructor, TLRPC.TL_document_old.class);
|
||||||
|
classStore.put(TLRPC.TL_config_old.constructor, TLRPC.TL_config_old.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
static TLClassStore store = null;
|
static TLClassStore store = null;
|
||||||
|
|
|
@ -16,7 +16,7 @@ public class TLRPC {
|
||||||
|
|
||||||
public static final int MESSAGE_FLAG_UNREAD = 1;
|
public static final int MESSAGE_FLAG_UNREAD = 1;
|
||||||
public static final int MESSAGE_FLAG_OUT = 2;
|
public static final int MESSAGE_FLAG_OUT = 2;
|
||||||
public static final int LAYER = 22;
|
public static final int LAYER = 23;
|
||||||
|
|
||||||
public static class ChatPhoto extends TLObject {
|
public static class ChatPhoto extends TLObject {
|
||||||
public FileLocation photo_small;
|
public FileLocation photo_small;
|
||||||
|
@ -3743,6 +3743,24 @@ public class TLRPC {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static class TL_disabledFeature extends TLObject {
|
||||||
|
public static int constructor = 0xae636f24;
|
||||||
|
|
||||||
|
public String feature;
|
||||||
|
public String description;
|
||||||
|
|
||||||
|
public void readParams(AbsSerializedData stream) {
|
||||||
|
feature = stream.readString();
|
||||||
|
description = stream.readString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void serializeToStream(AbsSerializedData stream) {
|
||||||
|
stream.writeInt32(constructor);
|
||||||
|
stream.writeString(feature);
|
||||||
|
stream.writeString(description);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static class TL_futureSalt extends TLObject {
|
public static class TL_futureSalt extends TLObject {
|
||||||
public static int constructor = 0x0949d9dc;
|
public static int constructor = 0x0949d9dc;
|
||||||
|
|
||||||
|
@ -5023,17 +5041,21 @@ public class TLRPC {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class TL_config extends TLObject {
|
public static class TL_config extends TLObject {
|
||||||
public static int constructor = 0x2e54dd74;
|
public static int constructor = 0x7dae33e0;
|
||||||
|
|
||||||
public int date;
|
public int date;
|
||||||
|
public int expires;
|
||||||
public boolean test_mode;
|
public boolean test_mode;
|
||||||
public int this_dc;
|
public int this_dc;
|
||||||
public ArrayList<TL_dcOption> dc_options = new ArrayList<>();
|
public ArrayList<TL_dcOption> dc_options = new ArrayList<>();
|
||||||
|
public int chat_big_size;
|
||||||
public int chat_size_max;
|
public int chat_size_max;
|
||||||
public int broadcast_size_max;
|
public int broadcast_size_max;
|
||||||
|
public ArrayList<TL_disabledFeature> disabled_features = new ArrayList<>();
|
||||||
|
|
||||||
public void readParams(AbsSerializedData stream) {
|
public void readParams(AbsSerializedData stream) {
|
||||||
date = stream.readInt32();
|
date = stream.readInt32();
|
||||||
|
expires = stream.readInt32();
|
||||||
test_mode = stream.readBool();
|
test_mode = stream.readBool();
|
||||||
this_dc = stream.readInt32();
|
this_dc = stream.readInt32();
|
||||||
stream.readInt32();
|
stream.readInt32();
|
||||||
|
@ -5041,23 +5063,37 @@ public class TLRPC {
|
||||||
for (int a = 0; a < count; a++) {
|
for (int a = 0; a < count; a++) {
|
||||||
dc_options.add((TL_dcOption)TLClassStore.Instance().TLdeserialize(stream, stream.readInt32()));
|
dc_options.add((TL_dcOption)TLClassStore.Instance().TLdeserialize(stream, stream.readInt32()));
|
||||||
}
|
}
|
||||||
|
chat_big_size = stream.readInt32();
|
||||||
chat_size_max = stream.readInt32();
|
chat_size_max = stream.readInt32();
|
||||||
broadcast_size_max = stream.readInt32();
|
broadcast_size_max = stream.readInt32();
|
||||||
|
stream.readInt32();
|
||||||
|
count = stream.readInt32();
|
||||||
|
for (int a = 0; a < count; a++) {
|
||||||
|
disabled_features.add((TL_disabledFeature)TLClassStore.Instance().TLdeserialize(stream, stream.readInt32()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void serializeToStream(AbsSerializedData stream) {
|
public void serializeToStream(AbsSerializedData stream) {
|
||||||
stream.writeInt32(constructor);
|
stream.writeInt32(constructor);
|
||||||
stream.writeInt32(date);
|
stream.writeInt32(date);
|
||||||
|
stream.writeInt32(expires);
|
||||||
stream.writeBool(test_mode);
|
stream.writeBool(test_mode);
|
||||||
stream.writeInt32(this_dc);
|
stream.writeInt32(this_dc);
|
||||||
stream.writeInt32(0x1cb5c415);
|
stream.writeInt32(0x1cb5c415);
|
||||||
int count = dc_options.size();
|
int count = dc_options.size();
|
||||||
stream.writeInt32(count);
|
stream.writeInt32(count);
|
||||||
for (TL_dcOption dc_option : dc_options) {
|
for (int a = 0; a < count; a++) {
|
||||||
dc_option.serializeToStream(stream);
|
dc_options.get(a).serializeToStream(stream);
|
||||||
}
|
}
|
||||||
|
stream.writeInt32(chat_big_size);
|
||||||
stream.writeInt32(chat_size_max);
|
stream.writeInt32(chat_size_max);
|
||||||
stream.writeInt32(broadcast_size_max);
|
stream.writeInt32(broadcast_size_max);
|
||||||
|
stream.writeInt32(0x1cb5c415);
|
||||||
|
count = disabled_features.size();
|
||||||
|
stream.writeInt32(count);
|
||||||
|
for (int a = 0; a < count; a++) {
|
||||||
|
disabled_features.get(a).serializeToStream(stream);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9298,6 +9334,40 @@ public class TLRPC {
|
||||||
|
|
||||||
//manually created
|
//manually created
|
||||||
|
|
||||||
|
public static class TL_config_old extends TL_config {
|
||||||
|
public static int constructor = 0x2e54dd74;
|
||||||
|
|
||||||
|
public void readParams(AbsSerializedData stream) {
|
||||||
|
date = stream.readInt32();
|
||||||
|
test_mode = stream.readBool();
|
||||||
|
this_dc = stream.readInt32();
|
||||||
|
stream.readInt32();
|
||||||
|
int count = stream.readInt32();
|
||||||
|
for (int a = 0; a < count; a++) {
|
||||||
|
dc_options.add((TL_dcOption) TLClassStore.Instance().TLdeserialize(stream, stream.readInt32()));
|
||||||
|
}
|
||||||
|
chat_size_max = stream.readInt32();
|
||||||
|
broadcast_size_max = stream.readInt32();
|
||||||
|
expires = (int) (System.currentTimeMillis() / 1000) + 3600;
|
||||||
|
chat_big_size = 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void serializeToStream(AbsSerializedData stream) {
|
||||||
|
stream.writeInt32(constructor);
|
||||||
|
stream.writeInt32(date);
|
||||||
|
stream.writeBool(test_mode);
|
||||||
|
stream.writeInt32(this_dc);
|
||||||
|
stream.writeInt32(0x1cb5c415);
|
||||||
|
int count = dc_options.size();
|
||||||
|
stream.writeInt32(count);
|
||||||
|
for (TL_dcOption dc_option : dc_options) {
|
||||||
|
dc_option.serializeToStream(stream);
|
||||||
|
}
|
||||||
|
stream.writeInt32(chat_size_max);
|
||||||
|
stream.writeInt32(broadcast_size_max);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static class TL_document_old extends TL_document {
|
public static class TL_document_old extends TL_document {
|
||||||
public static int constructor = 0x9efc6326;
|
public static int constructor = 0x9efc6326;
|
||||||
|
|
||||||
|
|
|
@ -80,6 +80,7 @@ public class UserConfig {
|
||||||
currentUser.serializeToStream(data);
|
currentUser.serializeToStream(data);
|
||||||
String userString = Base64.encodeToString(data.toByteArray(), Base64.DEFAULT);
|
String userString = Base64.encodeToString(data.toByteArray(), Base64.DEFAULT);
|
||||||
editor.putString("user", userString);
|
editor.putString("user", userString);
|
||||||
|
data.cleanup();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
editor.remove("user");
|
editor.remove("user");
|
||||||
|
@ -184,6 +185,7 @@ public class UserConfig {
|
||||||
if (lastSendMessageId > -210000) {
|
if (lastSendMessageId > -210000) {
|
||||||
lastSendMessageId = -210000;
|
lastSendMessageId = -210000;
|
||||||
}
|
}
|
||||||
|
data.cleanup();
|
||||||
Utilities.stageQueue.postRunnable(new Runnable() {
|
Utilities.stageQueue.postRunnable(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
@ -218,6 +220,7 @@ public class UserConfig {
|
||||||
if (userBytes != null) {
|
if (userBytes != null) {
|
||||||
SerializedData data = new SerializedData(userBytes);
|
SerializedData data = new SerializedData(userBytes);
|
||||||
currentUser = (TLRPC.TL_userSelf)TLClassStore.Instance().TLdeserialize(data, data.readInt32());
|
currentUser = (TLRPC.TL_userSelf)TLClassStore.Instance().TLdeserialize(data, data.readInt32());
|
||||||
|
data.cleanup();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,6 @@ import java.io.InputStream;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
import java.nio.channels.FileChannel;
|
|
||||||
import java.security.KeyFactory;
|
import java.security.KeyFactory;
|
||||||
import java.security.MessageDigest;
|
import java.security.MessageDigest;
|
||||||
import java.security.PublicKey;
|
import java.security.PublicKey;
|
||||||
|
@ -97,6 +96,7 @@ public class Utilities {
|
||||||
for (int a = 0; a < count; a++) {
|
for (int a = 0; a < count; a++) {
|
||||||
goodPrimes.add(data.readString());
|
goodPrimes.add(data.readString());
|
||||||
}
|
}
|
||||||
|
data.cleanup();
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
FileLog.e("tmessages", e);
|
FileLog.e("tmessages", e);
|
||||||
|
@ -229,6 +229,7 @@ public class Utilities {
|
||||||
data.writeString(pr);
|
data.writeString(pr);
|
||||||
}
|
}
|
||||||
byte[] bytes = data.toByteArray();
|
byte[] bytes = data.toByteArray();
|
||||||
|
data.cleanup();
|
||||||
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("primes", Context.MODE_PRIVATE);
|
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("primes", Context.MODE_PRIVATE);
|
||||||
SharedPreferences.Editor editor = preferences.edit();
|
SharedPreferences.Editor editor = preferences.edit();
|
||||||
editor.putString("primes", Base64.encodeToString(bytes, Base64.DEFAULT));
|
editor.putString("primes", Base64.encodeToString(bytes, Base64.DEFAULT));
|
||||||
|
@ -364,35 +365,41 @@ public class Utilities {
|
||||||
data.writeRaw(messageKey);
|
data.writeRaw(messageKey);
|
||||||
data.writeRaw(authKey, x, 32);
|
data.writeRaw(authKey, x, 32);
|
||||||
byte[] sha1_a = Utilities.computeSHA1(data.toByteArray());
|
byte[] sha1_a = Utilities.computeSHA1(data.toByteArray());
|
||||||
|
data.cleanup();
|
||||||
|
|
||||||
data = new SerializedData();
|
data = new SerializedData();
|
||||||
data.writeRaw(authKey, 32 + x, 16);
|
data.writeRaw(authKey, 32 + x, 16);
|
||||||
data.writeRaw(messageKey);
|
data.writeRaw(messageKey);
|
||||||
data.writeRaw(authKey, 48 + x, 16);
|
data.writeRaw(authKey, 48 + x, 16);
|
||||||
byte[] sha1_b = Utilities.computeSHA1(data.toByteArray());
|
byte[] sha1_b = Utilities.computeSHA1(data.toByteArray());
|
||||||
|
data.cleanup();
|
||||||
|
|
||||||
data = new SerializedData();
|
data = new SerializedData();
|
||||||
data.writeRaw(authKey, 64 + x, 32);
|
data.writeRaw(authKey, 64 + x, 32);
|
||||||
data.writeRaw(messageKey);
|
data.writeRaw(messageKey);
|
||||||
byte[] sha1_c = Utilities.computeSHA1(data.toByteArray());
|
byte[] sha1_c = Utilities.computeSHA1(data.toByteArray());
|
||||||
|
data.cleanup();
|
||||||
|
|
||||||
data = new SerializedData();
|
data = new SerializedData();
|
||||||
data.writeRaw(messageKey);
|
data.writeRaw(messageKey);
|
||||||
data.writeRaw(authKey, 96 + x, 32);
|
data.writeRaw(authKey, 96 + x, 32);
|
||||||
byte[] sha1_d = Utilities.computeSHA1(data.toByteArray());
|
byte[] sha1_d = Utilities.computeSHA1(data.toByteArray());
|
||||||
|
data.cleanup();
|
||||||
|
|
||||||
SerializedData aesKey = new SerializedData();
|
data = new SerializedData();
|
||||||
aesKey.writeRaw(sha1_a, 0, 8);
|
data.writeRaw(sha1_a, 0, 8);
|
||||||
aesKey.writeRaw(sha1_b, 8, 12);
|
data.writeRaw(sha1_b, 8, 12);
|
||||||
aesKey.writeRaw(sha1_c, 4, 12);
|
data.writeRaw(sha1_c, 4, 12);
|
||||||
keyData.aesKey = aesKey.toByteArray();
|
keyData.aesKey = data.toByteArray();
|
||||||
|
data.cleanup();
|
||||||
|
|
||||||
SerializedData aesIv = new SerializedData();
|
data = new SerializedData();
|
||||||
aesIv.writeRaw(sha1_a, 8, 12);
|
data.writeRaw(sha1_a, 8, 12);
|
||||||
aesIv.writeRaw(sha1_b, 0, 8);
|
data.writeRaw(sha1_b, 0, 8);
|
||||||
aesIv.writeRaw(sha1_c, 16, 4);
|
data.writeRaw(sha1_c, 16, 4);
|
||||||
aesIv.writeRaw(sha1_d, 0, 8);
|
data.writeRaw(sha1_d, 0, 8);
|
||||||
keyData.aesIv = aesIv.toByteArray();
|
keyData.aesIv = data.toByteArray();
|
||||||
|
data.cleanup();
|
||||||
|
|
||||||
return keyData;
|
return keyData;
|
||||||
}
|
}
|
||||||
|
@ -409,10 +416,25 @@ public class Utilities {
|
||||||
while ((bytesRead = gis.read(data)) != -1) {
|
while ((bytesRead = gis.read(data)) != -1) {
|
||||||
bytesOutput.write(data, 0, bytesRead);
|
bytesOutput.write(data, 0, bytesRead);
|
||||||
}
|
}
|
||||||
gis.close();
|
try {
|
||||||
is.close();
|
gis.close();
|
||||||
|
} catch (Exception e) {
|
||||||
|
FileLog.e("tmessages", e);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
is.close();
|
||||||
|
} catch (Exception e) {
|
||||||
|
FileLog.e("tmessages", e);
|
||||||
|
}
|
||||||
SerializedData stream = new SerializedData(bytesOutput.toByteArray());
|
SerializedData stream = new SerializedData(bytesOutput.toByteArray());
|
||||||
return TLClassStore.Instance().TLdeserialize(stream, stream.readInt32(), parentObject);
|
try {
|
||||||
|
bytesOutput.close();
|
||||||
|
} catch (Exception e) {
|
||||||
|
FileLog.e("tmessages", e);
|
||||||
|
}
|
||||||
|
TLObject object = TLClassStore.Instance().TLdeserialize(stream, stream.readInt32(), parentObject);
|
||||||
|
stream.cleanup();
|
||||||
|
return object;
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
FileLog.e("tmessages", e);
|
FileLog.e("tmessages", e);
|
||||||
}
|
}
|
||||||
|
@ -433,6 +455,12 @@ public class Utilities {
|
||||||
packedData = bytesStream.toByteArray();
|
packedData = bytesStream.toByteArray();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
FileLog.e("tmessages", e);
|
FileLog.e("tmessages", e);
|
||||||
|
} finally {
|
||||||
|
try {
|
||||||
|
bytesStream.close();
|
||||||
|
} catch (Exception e) {
|
||||||
|
FileLog.e("tmessages", e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return packedData;
|
return packedData;
|
||||||
}
|
}
|
||||||
|
@ -450,23 +478,23 @@ public class Utilities {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean copyFile(File sourceFile, File destFile) throws IOException {
|
public static boolean copyFile(File sourceFile, File destFile) throws IOException {
|
||||||
if(!destFile.exists()) {
|
if (!destFile.exists()) {
|
||||||
destFile.createNewFile();
|
destFile.createNewFile();
|
||||||
}
|
}
|
||||||
FileChannel source = null;
|
FileInputStream source = null;
|
||||||
FileChannel destination = null;
|
FileOutputStream destination = null;
|
||||||
try {
|
try {
|
||||||
source = new FileInputStream(sourceFile).getChannel();
|
source = new FileInputStream(sourceFile);
|
||||||
destination = new FileOutputStream(destFile).getChannel();
|
destination = new FileOutputStream(destFile);
|
||||||
destination.transferFrom(source, 0, source.size());
|
destination.getChannel().transferFrom(source.getChannel(), 0, source.getChannel().size());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
FileLog.e("tmessages", e);
|
FileLog.e("tmessages", e);
|
||||||
return false;
|
return false;
|
||||||
} finally {
|
} finally {
|
||||||
if(source != null) {
|
if (source != null) {
|
||||||
source.close();
|
source.close();
|
||||||
}
|
}
|
||||||
if(destination != null) {
|
if (destination != null) {
|
||||||
destination.close();
|
destination.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -712,7 +740,13 @@ public class Utilities {
|
||||||
buffer.write(b);
|
buffer.write(b);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return buffer.toByteArray();
|
byte[] array = buffer.toByteArray();
|
||||||
|
try {
|
||||||
|
buffer.close();
|
||||||
|
} catch (Exception e) {
|
||||||
|
FileLog.e("tmessages", e);
|
||||||
|
}
|
||||||
|
return array;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void checkForCrashes(Activity context) {
|
public static void checkForCrashes(Activity context) {
|
||||||
|
|
|
@ -201,7 +201,7 @@ public class BaseFragment {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void showAlertDialog(AlertDialog.Builder builder) {
|
public void showAlertDialog(AlertDialog.Builder builder) {
|
||||||
if (parentLayout == null || parentLayout.checkTransitionAnimation() || parentLayout.animationInProgress || parentLayout.startedTracking) {
|
if (parentLayout == null || parentLayout.checkTransitionAnimation() || parentLayout.animationInProgress || parentLayout.startedTracking) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -544,6 +544,7 @@ public class ChangePhoneActivity extends BaseFragment {
|
||||||
codesMap.put(args[0], args[2]);
|
codesMap.put(args[0], args[2]);
|
||||||
languageMap.put(args[1], args[2]);
|
languageMap.put(args[1], args[2]);
|
||||||
}
|
}
|
||||||
|
reader.close();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
FileLog.e("tmessages", e);
|
FileLog.e("tmessages", e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -481,6 +481,33 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {
|
actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {
|
||||||
@Override
|
@Override
|
||||||
public void onItemClick(final int id) {
|
public void onItemClick(final int id) {
|
||||||
|
if (id == attach_photo || id == attach_gallery || id == attach_document || id == attach_video) {
|
||||||
|
String action = null;
|
||||||
|
if (currentChat != null) {
|
||||||
|
if (currentChat.participants_count > MessagesController.getInstance().groupBigSize) {
|
||||||
|
if (id == attach_photo || id == attach_gallery) {
|
||||||
|
action = "bigchat_upload_photo";
|
||||||
|
} else {
|
||||||
|
action = "bigchat_upload_document";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (id == attach_photo || id == attach_gallery) {
|
||||||
|
action = "chat_upload_photo";
|
||||||
|
} else {
|
||||||
|
action = "chat_upload_document";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (id == attach_photo || id == attach_gallery) {
|
||||||
|
action = "pm_upload_photo";
|
||||||
|
} else {
|
||||||
|
action = "pm_upload_document";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (action != null && !MessagesController.isFeatureEnabled(action, ChatActivity.this)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (id == -1) {
|
if (id == -1) {
|
||||||
finishFragment();
|
finishFragment();
|
||||||
} else if (id == -2) {
|
} else if (id == -2) {
|
||||||
|
@ -1001,7 +1028,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
|
|
||||||
if (currentEncryptedChat == null) {
|
if (currentEncryptedChat == null) {
|
||||||
TextView emptyView = new TextView(getParentActivity());
|
TextView emptyView = new TextView(getParentActivity());
|
||||||
if (currentUser != null && (currentUser.id / 1000 == 333 || currentUser.id % 1000 == 0)) {
|
if (currentUser != null && currentUser.id != 777000 && (currentUser.id / 1000 == 333 || currentUser.id % 1000 == 0)) {
|
||||||
emptyView.setText(LocaleController.getString("GotAQuestion", R.string.GotAQuestion));
|
emptyView.setText(LocaleController.getString("GotAQuestion", R.string.GotAQuestion));
|
||||||
} else {
|
} else {
|
||||||
emptyView.setText(LocaleController.getString("NoMessages", R.string.NoMessages));
|
emptyView.setText(LocaleController.getString("NoMessages", R.string.NoMessages));
|
||||||
|
@ -1324,7 +1351,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
if (chatActivityEnterView != null) {
|
if (chatActivityEnterView != null) {
|
||||||
chatActivityEnterView.onDestroy();
|
chatActivityEnterView.onDestroy();
|
||||||
}
|
}
|
||||||
chatActivityEnterView = new ChatActivityEnterView(getParentActivity(), contentView, true);
|
chatActivityEnterView = new ChatActivityEnterView(getParentActivity(), contentView, this, true);
|
||||||
chatActivityEnterView.setDialogId(dialog_id);
|
chatActivityEnterView.setDialogId(dialog_id);
|
||||||
chatActivityEnterView.addToAttachLayout(menuItem);
|
chatActivityEnterView.addToAttachLayout(menuItem);
|
||||||
chatActivityEnterView.setId(id_chat_compose_panel);
|
chatActivityEnterView.setId(id_chat_compose_panel);
|
||||||
|
|
|
@ -182,7 +182,7 @@ public class AvatarDrawable extends Drawable {
|
||||||
}
|
}
|
||||||
lastch = lastName.substring(a, a + 1);
|
lastch = lastName.substring(a, a + 1);
|
||||||
}
|
}
|
||||||
if (Build.VERSION.SDK_INT >= 14) {
|
if (Build.VERSION.SDK_INT >= 16) {
|
||||||
text += "\u200C" + lastch;
|
text += "\u200C" + lastch;
|
||||||
} else {
|
} else {
|
||||||
text += lastch;
|
text += lastch;
|
||||||
|
@ -191,7 +191,7 @@ public class AvatarDrawable extends Drawable {
|
||||||
for (int a = firstName.length() - 1; a >= 0; a--) {
|
for (int a = firstName.length() - 1; a >= 0; a--) {
|
||||||
if (firstName.charAt(a) == ' ') {
|
if (firstName.charAt(a) == ' ') {
|
||||||
if (a != firstName.length() - 1 && firstName.charAt(a + 1) != ' ') {
|
if (a != firstName.length() - 1 && firstName.charAt(a + 1) != ' ') {
|
||||||
if (Build.VERSION.SDK_INT >= 14) {
|
if (Build.VERSION.SDK_INT >= 16) {
|
||||||
text += "\u200C" + firstName.substring(a + 1, a + 2);
|
text += "\u200C" + firstName.substring(a + 1, a + 2);
|
||||||
} else {
|
} else {
|
||||||
text += firstName.substring(a + 1, a + 2);
|
text += firstName.substring(a + 1, a + 2);
|
||||||
|
|
|
@ -47,6 +47,7 @@ import org.telegram.android.NotificationCenter;
|
||||||
import org.telegram.messenger.R;
|
import org.telegram.messenger.R;
|
||||||
import org.telegram.messenger.TLRPC;
|
import org.telegram.messenger.TLRPC;
|
||||||
import org.telegram.messenger.UserConfig;
|
import org.telegram.messenger.UserConfig;
|
||||||
|
import org.telegram.ui.ActionBar.BaseFragment;
|
||||||
import org.telegram.ui.AnimationCompat.AnimatorListenerAdapterProxy;
|
import org.telegram.ui.AnimationCompat.AnimatorListenerAdapterProxy;
|
||||||
import org.telegram.ui.AnimationCompat.AnimatorSetProxy;
|
import org.telegram.ui.AnimationCompat.AnimatorSetProxy;
|
||||||
import org.telegram.ui.AnimationCompat.ObjectAnimatorProxy;
|
import org.telegram.ui.AnimationCompat.ObjectAnimatorProxy;
|
||||||
|
@ -96,11 +97,12 @@ public class ChatActivityEnterView extends LinearLayout implements NotificationC
|
||||||
private boolean recordingAudio;
|
private boolean recordingAudio;
|
||||||
|
|
||||||
private Activity parentActivity;
|
private Activity parentActivity;
|
||||||
|
private BaseFragment parentFragment;
|
||||||
private long dialog_id;
|
private long dialog_id;
|
||||||
private boolean ignoreTextChange;
|
private boolean ignoreTextChange;
|
||||||
private ChatActivityEnterViewDelegate delegate;
|
private ChatActivityEnterViewDelegate delegate;
|
||||||
|
|
||||||
public ChatActivityEnterView(Activity context, SizeNotifierRelativeLayout parent, boolean isChat) {
|
public ChatActivityEnterView(Activity context, SizeNotifierRelativeLayout parent, BaseFragment fragment, boolean isChat) {
|
||||||
super(context);
|
super(context);
|
||||||
setOrientation(HORIZONTAL);
|
setOrientation(HORIZONTAL);
|
||||||
setBackgroundResource(R.drawable.compose_panel);
|
setBackgroundResource(R.drawable.compose_panel);
|
||||||
|
@ -117,6 +119,7 @@ public class ChatActivityEnterView extends LinearLayout implements NotificationC
|
||||||
NotificationCenter.getInstance().addObserver(this, NotificationCenter.hideEmojiKeyboard);
|
NotificationCenter.getInstance().addObserver(this, NotificationCenter.hideEmojiKeyboard);
|
||||||
NotificationCenter.getInstance().addObserver(this, NotificationCenter.audioRouteChanged);
|
NotificationCenter.getInstance().addObserver(this, NotificationCenter.audioRouteChanged);
|
||||||
parentActivity = context;
|
parentActivity = context;
|
||||||
|
parentFragment = fragment;
|
||||||
sizeNotifierRelativeLayout = parent;
|
sizeNotifierRelativeLayout = parent;
|
||||||
sizeNotifierRelativeLayout.setDelegate(this);
|
sizeNotifierRelativeLayout.setDelegate(this);
|
||||||
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", Activity.MODE_PRIVATE);
|
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", Activity.MODE_PRIVATE);
|
||||||
|
@ -148,20 +151,6 @@ public class ChatActivityEnterView extends LinearLayout implements NotificationC
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
/*
|
|
||||||
<EditText
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="bottom"
|
|
||||||
android:id="@+id/chat_text_edit"
|
|
||||||
android:maxLines="4"
|
|
||||||
android:textSize="18dp"
|
|
||||||
android:textColorHint="#b2b2b2"
|
|
||||||
android:imeOptions="flagNoExtractUi"
|
|
||||||
android:inputType="textCapSentences|textMultiLine"
|
|
||||||
/>
|
|
||||||
*/
|
|
||||||
|
|
||||||
messsageEditText = new EditText(context);
|
messsageEditText = new EditText(context);
|
||||||
messsageEditText.setHint(LocaleController.getString("TypeMessage", R.string.TypeMessage));
|
messsageEditText.setHint(LocaleController.getString("TypeMessage", R.string.TypeMessage));
|
||||||
messsageEditText.setImeOptions(EditorInfo.IME_FLAG_NO_EXTRACT_UI);
|
messsageEditText.setImeOptions(EditorInfo.IME_FLAG_NO_EXTRACT_UI);
|
||||||
|
@ -383,6 +372,23 @@ public class ChatActivityEnterView extends LinearLayout implements NotificationC
|
||||||
@Override
|
@Override
|
||||||
public boolean onTouch(View view, MotionEvent motionEvent) {
|
public boolean onTouch(View view, MotionEvent motionEvent) {
|
||||||
if (motionEvent.getAction() == MotionEvent.ACTION_DOWN) {
|
if (motionEvent.getAction() == MotionEvent.ACTION_DOWN) {
|
||||||
|
if (parentFragment != null) {
|
||||||
|
String action = null;
|
||||||
|
TLRPC.Chat currentChat = null;
|
||||||
|
if ((int) dialog_id < 0) {
|
||||||
|
currentChat = MessagesController.getInstance().getChat(-(int) dialog_id);
|
||||||
|
if (currentChat != null && currentChat.participants_count > MessagesController.getInstance().groupBigSize) {
|
||||||
|
action = "bigchat_upload_audio";
|
||||||
|
} else {
|
||||||
|
action = "chat_upload_audio";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
action = "pm_upload_audio";
|
||||||
|
}
|
||||||
|
if (!MessagesController.isFeatureEnabled(action, parentFragment)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
startedDraggingX = -1;
|
startedDraggingX = -1;
|
||||||
MediaController.getInstance().startRecording(dialog_id);
|
MediaController.getInstance().startRecording(dialog_id);
|
||||||
updateAudioRecordIntefrace();
|
updateAudioRecordIntefrace();
|
||||||
|
@ -488,6 +494,23 @@ public class ChatActivityEnterView extends LinearLayout implements NotificationC
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendMessage() {
|
private void sendMessage() {
|
||||||
|
if (parentFragment != null) {
|
||||||
|
String action = null;
|
||||||
|
TLRPC.Chat currentChat = null;
|
||||||
|
if ((int) dialog_id < 0) {
|
||||||
|
currentChat = MessagesController.getInstance().getChat(-(int) dialog_id);
|
||||||
|
if (currentChat != null && currentChat.participants_count > MessagesController.getInstance().groupBigSize) {
|
||||||
|
action = "bigchat_message";
|
||||||
|
} else {
|
||||||
|
action = "chat_message";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
action = "pm_message";
|
||||||
|
}
|
||||||
|
if (!MessagesController.isFeatureEnabled(action, parentFragment)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (processSendingText(messsageEditText.getText().toString())) {
|
if (processSendingText(messsageEditText.getText().toString())) {
|
||||||
messsageEditText.setText("");
|
messsageEditText.setText("");
|
||||||
lastTypingTimeSend = 0;
|
lastTypingTimeSend = 0;
|
||||||
|
|
|
@ -0,0 +1,417 @@
|
||||||
|
/*
|
||||||
|
* This is the source code of Telegram for Android v. 2.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-2015.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.telegram.ui.Components;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.graphics.Canvas;
|
||||||
|
import android.graphics.PointF;
|
||||||
|
import android.graphics.RectF;
|
||||||
|
import android.util.SizeF;
|
||||||
|
import android.widget.FrameLayout;
|
||||||
|
|
||||||
|
public class PhotoFilterLinearBlurControl extends FrameLayout {
|
||||||
|
|
||||||
|
private final static float LinearBlurInsetProximity = 20;
|
||||||
|
private final static float LinearBlurMinimumFalloff = 0.1f;
|
||||||
|
private final static float LinearBlurMinimumDifference = 0.02f;
|
||||||
|
private final static float LinearBlurViewCenterInset = 30.0f;
|
||||||
|
private final static float LinearBlurViewRadiusInset = 30.0f;
|
||||||
|
|
||||||
|
private enum LinearBlurViewActiveControl {
|
||||||
|
TGLinearBlurViewActiveControlNone,
|
||||||
|
TGLinearBlurViewActiveControlCenter,
|
||||||
|
TGLinearBlurViewActiveControlInnerRadius,
|
||||||
|
TGLinearBlurViewActiveControlOuterRadius,
|
||||||
|
TGLinearBlurViewActiveControlWholeArea,
|
||||||
|
TGLinearBlurViewActiveControlRotation
|
||||||
|
}
|
||||||
|
|
||||||
|
private LinearBlurViewActiveControl activeControl;
|
||||||
|
private PointF startCenterPoint = new PointF();
|
||||||
|
private PointF startDistance = new PointF();
|
||||||
|
private PointF startRadius = new PointF();
|
||||||
|
private boolean isTracking;
|
||||||
|
private SizeF actualAreaSize;
|
||||||
|
private PointF centerPoint;
|
||||||
|
private float falloff;
|
||||||
|
private float size;
|
||||||
|
private float angle;
|
||||||
|
|
||||||
|
//@property (nonatomic, copy) void (^valueChanged)(CGPoint centerPoint, CGFloat falloff, CGFloat size, CGFloat angle);
|
||||||
|
//@property (nonatomic, copy) void(^interactionEnded)(void);
|
||||||
|
//UILongPressGestureRecognizer *_pressGestureRecognizer;
|
||||||
|
//UIPanGestureRecognizer *_panGestureRecognizer;
|
||||||
|
//UIPinchGestureRecognizer *_pinchGestureRecognizer;
|
||||||
|
|
||||||
|
public PhotoFilterLinearBlurControl(Context context) {
|
||||||
|
super(context);
|
||||||
|
|
||||||
|
setWillNotDraw(false);
|
||||||
|
|
||||||
|
centerPoint = new PointF(0.5f, 0.5f);
|
||||||
|
falloff = 0.15f;
|
||||||
|
size = 0.35f;
|
||||||
|
|
||||||
|
/*_pressGestureRecognizer = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(handlePress:)];
|
||||||
|
_pressGestureRecognizer.delegate = self;
|
||||||
|
_pressGestureRecognizer.minimumPressDuration = 0.1f;
|
||||||
|
[self addGestureRecognizer:_pressGestureRecognizer];
|
||||||
|
|
||||||
|
_panGestureRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(handlePan:)];
|
||||||
|
_panGestureRecognizer.delegate = self;
|
||||||
|
[self addGestureRecognizer:_panGestureRecognizer];
|
||||||
|
|
||||||
|
_pinchGestureRecognizer = [[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(handlePinch:)];
|
||||||
|
_pinchGestureRecognizer.delegate = self;
|
||||||
|
[self addGestureRecognizer:_pinchGestureRecognizer];*/
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void handlePress() {
|
||||||
|
/*switch (gestureRecognizer.state) {
|
||||||
|
case UIGestureRecognizerStateBegan:
|
||||||
|
[self setSelected:true animated:true];
|
||||||
|
break;
|
||||||
|
|
||||||
|
case UIGestureRecognizerStateEnded:
|
||||||
|
case UIGestureRecognizerStateCancelled:
|
||||||
|
case UIGestureRecognizerStateFailed:
|
||||||
|
[self setSelected:false animated:true];
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}*/
|
||||||
|
}
|
||||||
|
|
||||||
|
private void handlePan() {
|
||||||
|
/*CGPoint location = [gestureRecognizer locationInView:self];
|
||||||
|
CGPoint centerPoint = [self _actualCenterPoint];
|
||||||
|
CGPoint delta = CGPointMake(location.x - centerPoint.x, location.y - centerPoint.y);
|
||||||
|
CGFloat radialDistance = sqrtf(delta.x * delta.x + delta.y * delta.y);
|
||||||
|
CGFloat distance = fabsf(delta.x * cosf(self.angle + (CGFloat)M_PI_2) + delta.y * sinf(self.angle + (CGFloat)M_PI_2));
|
||||||
|
|
||||||
|
CGFloat shorterSide = (self.actualAreaSize.width > self.actualAreaSize.height) ? self.actualAreaSize.height : self.actualAreaSize.width;
|
||||||
|
|
||||||
|
CGFloat innerRadius = shorterSide * self.falloff;
|
||||||
|
CGFloat outerRadius = shorterSide * self.size;
|
||||||
|
|
||||||
|
switch (gestureRecognizer.state) {
|
||||||
|
case UIGestureRecognizerStateBegan:
|
||||||
|
{
|
||||||
|
bool close = fabsf(outerRadius - innerRadius) < TGLinearBlurInsetProximity;
|
||||||
|
CGFloat innerRadiusOuterInset = close ? 0 : TGLinearBlurViewRadiusInset;
|
||||||
|
CGFloat outerRadiusInnerInset = close ? 0 : TGLinearBlurViewRadiusInset;
|
||||||
|
|
||||||
|
if (radialDistance < TGLinearBlurViewCenterInset)
|
||||||
|
{
|
||||||
|
_activeControl = TGLinearBlurViewActiveControlCenter;
|
||||||
|
_startCenterPoint = centerPoint;
|
||||||
|
}
|
||||||
|
else if (distance > innerRadius - TGLinearBlurViewRadiusInset && distance < innerRadius + innerRadiusOuterInset)
|
||||||
|
{
|
||||||
|
_activeControl = TGLinearBlurViewActiveControlInnerRadius;
|
||||||
|
_startDistance = distance;
|
||||||
|
_startRadius = innerRadius;
|
||||||
|
}
|
||||||
|
else if (distance > outerRadius - outerRadiusInnerInset && distance < outerRadius + TGLinearBlurViewRadiusInset)
|
||||||
|
{
|
||||||
|
_activeControl = TGLinearBlurViewActiveControlOuterRadius;
|
||||||
|
_startDistance = distance;
|
||||||
|
_startRadius = outerRadius;
|
||||||
|
}
|
||||||
|
else if (distance <= innerRadius - TGLinearBlurViewRadiusInset || distance >= outerRadius + TGLinearBlurViewRadiusInset)
|
||||||
|
{
|
||||||
|
_activeControl = TGLinearBlurViewActiveControlRotation;
|
||||||
|
}
|
||||||
|
|
||||||
|
[self setSelected:true animated:true];
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case UIGestureRecognizerStateChanged:
|
||||||
|
{
|
||||||
|
switch (_activeControl)
|
||||||
|
{
|
||||||
|
case TGLinearBlurViewActiveControlCenter:
|
||||||
|
{
|
||||||
|
CGPoint translation = [gestureRecognizer translationInView:self];
|
||||||
|
|
||||||
|
CGRect actualArea = CGRectMake((self.frame.size.width - self.actualAreaSize.width) / 2, (self.frame.size.height - self.actualAreaSize.height) / 2, self.actualAreaSize.width, self.actualAreaSize.height);
|
||||||
|
|
||||||
|
CGPoint newPoint = CGPointMake(MAX(CGRectGetMinX(actualArea), MIN(CGRectGetMaxX(actualArea), _startCenterPoint.x + translation.x)),
|
||||||
|
MAX(CGRectGetMinY(actualArea), MIN(CGRectGetMaxY(actualArea), _startCenterPoint.y + translation.y)));
|
||||||
|
|
||||||
|
CGPoint offset = CGPointMake(0, (self.actualAreaSize.width - self.actualAreaSize.height) / 2);
|
||||||
|
CGPoint actualPoint = CGPointMake(newPoint.x - actualArea.origin.x, newPoint.y - actualArea.origin.y);
|
||||||
|
self.centerPoint = CGPointMake((actualPoint.x + offset.x) / self.actualAreaSize.width, (actualPoint.y + offset.y) / self.actualAreaSize.width);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case TGLinearBlurViewActiveControlInnerRadius:
|
||||||
|
{
|
||||||
|
CGFloat delta = distance - _startDistance;
|
||||||
|
self.falloff = MIN(MAX(TGLinearBlurMinimumFalloff, (_startRadius + delta) / shorterSide), self.size - TGLinearBlurMinimumDifference);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case TGLinearBlurViewActiveControlOuterRadius:
|
||||||
|
{
|
||||||
|
CGFloat delta = distance - _startDistance;
|
||||||
|
self.size = MAX(self.falloff + TGLinearBlurMinimumDifference, (_startRadius + delta) / shorterSide);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case TGLinearBlurViewActiveControlRotation:
|
||||||
|
{
|
||||||
|
CGPoint translation = [gestureRecognizer translationInView:self];
|
||||||
|
bool clockwise = false;
|
||||||
|
|
||||||
|
bool right = location.x > centerPoint.x;
|
||||||
|
bool bottom = location.y > centerPoint.y;
|
||||||
|
|
||||||
|
if (!right && !bottom)
|
||||||
|
{
|
||||||
|
if (fabsf(translation.y) > fabsf(translation.x))
|
||||||
|
{
|
||||||
|
if (translation.y < 0)
|
||||||
|
clockwise = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (translation.x > 0)
|
||||||
|
clockwise = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (right && !bottom)
|
||||||
|
{
|
||||||
|
if (fabsf(translation.y) > fabsf(translation.x))
|
||||||
|
{
|
||||||
|
if (translation.y > 0)
|
||||||
|
clockwise = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (translation.x > 0)
|
||||||
|
clockwise = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (right && bottom)
|
||||||
|
{
|
||||||
|
if (fabsf(translation.y) > fabsf(translation.x))
|
||||||
|
{
|
||||||
|
if (translation.y > 0)
|
||||||
|
clockwise = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (translation.x < 0)
|
||||||
|
clockwise = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (fabsf(translation.y) > fabsf(translation.x))
|
||||||
|
{
|
||||||
|
if (translation.y < 0)
|
||||||
|
clockwise = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (translation.x < 0)
|
||||||
|
clockwise = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CGFloat delta = sqrtf(translation.x * translation.x + translation.y * translation.y);
|
||||||
|
|
||||||
|
CGFloat angleInDegrees = TGRadiansToDegrees(_angle);
|
||||||
|
CGFloat newAngleInDegrees = angleInDegrees + delta * (clockwise * 2 - 1) / (CGFloat)M_PI / 1.15f;
|
||||||
|
|
||||||
|
_angle = TGDegreesToRadians(newAngleInDegrees);
|
||||||
|
|
||||||
|
[gestureRecognizer setTranslation:CGPointZero inView:self];
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
[self setNeedsDisplay];
|
||||||
|
|
||||||
|
if (self.valueChanged != nil)
|
||||||
|
self.valueChanged(self.centerPoint, self.falloff, self.size, self.angle);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case UIGestureRecognizerStateEnded:
|
||||||
|
case UIGestureRecognizerStateCancelled:
|
||||||
|
case UIGestureRecognizerStateFailed:
|
||||||
|
{
|
||||||
|
_activeControl = TGLinearBlurViewActiveControlNone;
|
||||||
|
|
||||||
|
[self setSelected:false animated:true];
|
||||||
|
|
||||||
|
if (self.interactionEnded != nil)
|
||||||
|
self.interactionEnded();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}*/
|
||||||
|
}
|
||||||
|
|
||||||
|
private void handlePinch() {
|
||||||
|
/*switch (gestureRecognizer.state) {
|
||||||
|
case UIGestureRecognizerStateBegan: {
|
||||||
|
_activeControl = TGLinearBlurViewActiveControlWholeArea;
|
||||||
|
[self setSelected:true animated:true];
|
||||||
|
}
|
||||||
|
case UIGestureRecognizerStateChanged: {
|
||||||
|
CGFloat scale = gestureRecognizer.scale;
|
||||||
|
|
||||||
|
self.falloff = MAX(TGLinearBlurMinimumFalloff, self.falloff * scale);
|
||||||
|
self.size = MAX(self.falloff + TGLinearBlurMinimumDifference, self.size * scale);
|
||||||
|
|
||||||
|
gestureRecognizer.scale = 1.0f;
|
||||||
|
|
||||||
|
[self setNeedsDisplay];
|
||||||
|
|
||||||
|
if (self.valueChanged != nil)
|
||||||
|
self.valueChanged(self.centerPoint, self.falloff, self.size, self.angle);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case UIGestureRecognizerStateEnded: {
|
||||||
|
_activeControl = TGLinearBlurViewActiveControlNone;
|
||||||
|
[self setSelected:false animated:true];
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case UIGestureRecognizerStateCancelled:
|
||||||
|
case UIGestureRecognizerStateFailed: {
|
||||||
|
_activeControl = TGLinearBlurViewActiveControlNone;
|
||||||
|
[self setSelected:false animated:true];
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}*/
|
||||||
|
}
|
||||||
|
|
||||||
|
/*- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer
|
||||||
|
{
|
||||||
|
if (gestureRecognizer == _pressGestureRecognizer || gestureRecognizer == _panGestureRecognizer)
|
||||||
|
{
|
||||||
|
CGPoint location = [gestureRecognizer locationInView:self];
|
||||||
|
CGPoint centerPoint = [self _actualCenterPoint];
|
||||||
|
CGPoint delta = CGPointMake(location.x - centerPoint.x, location.y - centerPoint.y);
|
||||||
|
CGFloat radialDistance = sqrtf(delta.x * delta.x + delta.y * delta.y);
|
||||||
|
CGFloat distance = fabsf(delta.x * cosf(self.angle + (CGFloat)M_PI_2) + delta.y * sinf(self.angle + (CGFloat)M_PI_2));
|
||||||
|
|
||||||
|
CGFloat innerRadius = [self _actualInnerRadius];
|
||||||
|
CGFloat outerRadius = [self _actualOuterRadius];
|
||||||
|
|
||||||
|
bool close = fabsf(outerRadius - innerRadius) < TGLinearBlurInsetProximity;
|
||||||
|
CGFloat innerRadiusOuterInset = close ? 0 : TGLinearBlurViewRadiusInset;
|
||||||
|
CGFloat outerRadiusInnerInset = close ? 0 : TGLinearBlurViewRadiusInset;
|
||||||
|
|
||||||
|
if (radialDistance < TGLinearBlurViewCenterInset && gestureRecognizer == _panGestureRecognizer)
|
||||||
|
return true;
|
||||||
|
else if (distance > innerRadius - TGLinearBlurViewRadiusInset && distance < innerRadius + innerRadiusOuterInset)
|
||||||
|
return true;
|
||||||
|
else if (distance > outerRadius - outerRadiusInnerInset && distance < outerRadius + TGLinearBlurViewRadiusInset)
|
||||||
|
return true;
|
||||||
|
else if ((distance <= innerRadius - TGLinearBlurViewRadiusInset) || distance >= outerRadius + TGLinearBlurViewRadiusInset)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer
|
||||||
|
{
|
||||||
|
if (gestureRecognizer == _pressGestureRecognizer || otherGestureRecognizer == _pressGestureRecognizer)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}*/
|
||||||
|
|
||||||
|
private void setSelected(boolean selected, boolean animated) {
|
||||||
|
/*if (animated) {
|
||||||
|
[UIView animateWithDuration:0.16f delay:0.0f options:UIViewAnimationOptionBeginFromCurrentState animations:^
|
||||||
|
{
|
||||||
|
self.alpha = selected ? 0.6f : 1.0f;
|
||||||
|
} completion:nil];
|
||||||
|
} else {
|
||||||
|
self.alpha = selected ? 0.6f : 1.0f;
|
||||||
|
}*/
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onDraw(Canvas canvas) {
|
||||||
|
super.onDraw(canvas);
|
||||||
|
|
||||||
|
/*PointF centerPoint = getActualCenterPoint();
|
||||||
|
float innerRadius = getActualInnerRadius();
|
||||||
|
float outerRadius = getActualOuterRadius();
|
||||||
|
|
||||||
|
CGContextTranslateCTM(context, centerPoint.x, centerPoint.y);
|
||||||
|
CGContextRotateCTM(context, self.angle);
|
||||||
|
|
||||||
|
CGContextSetFillColorWithColor(context, [UIColor whiteColor].CGColor);
|
||||||
|
CGContextSetShadowWithColor(context, CGSizeZero, 2.5f, [UIColor colorWithWhite:0.0f alpha:0.3f].CGColor);
|
||||||
|
|
||||||
|
float space = 6.0f;
|
||||||
|
float length = 12.0f;
|
||||||
|
float thickness = 1.5f;
|
||||||
|
for (int i = 0; i < 30; i++) {
|
||||||
|
CGContextAddRect(context, CGRectMake(i * (length + space), -innerRadius, length, thickness));
|
||||||
|
CGContextAddRect(context, CGRectMake(-i * (length + space) - space - length, -innerRadius, length, thickness));
|
||||||
|
|
||||||
|
CGContextAddRect(context, CGRectMake(i * (length + space), innerRadius, length, thickness));
|
||||||
|
CGContextAddRect(context, CGRectMake(-i * (length + space) - space - length, innerRadius, length, thickness));
|
||||||
|
}
|
||||||
|
|
||||||
|
length = 6.0f;
|
||||||
|
thickness = 1.5f;
|
||||||
|
for (int i = 0; i < 64; i++) {
|
||||||
|
CGContextAddRect(context, CGRectMake(i * (length + space), -outerRadius, length, thickness));
|
||||||
|
CGContextAddRect(context, CGRectMake(-i * (length + space) - space - length, -outerRadius, length, thickness));
|
||||||
|
|
||||||
|
CGContextAddRect(context, CGRectMake(i * (length + space), outerRadius, length, thickness));
|
||||||
|
CGContextAddRect(context, CGRectMake(-i * (length + space) - space - length, outerRadius, length, thickness));
|
||||||
|
}
|
||||||
|
|
||||||
|
CGContextFillPath(context);
|
||||||
|
|
||||||
|
CGContextFillEllipseInRect(context, CGRectMake(-16 / 2, - 16 / 2, 16, 16));*/
|
||||||
|
}
|
||||||
|
|
||||||
|
private PointF getActualCenterPoint() {
|
||||||
|
RectF actualArea = new RectF((getWidth() - actualAreaSize.getWidth()) / 2, (getHeight() - actualAreaSize.getHeight()) / 2, actualAreaSize.getWidth(), actualAreaSize.getHeight());
|
||||||
|
PointF offset = new PointF(0, (actualAreaSize.getWidth() - actualAreaSize.getHeight()) / 2);
|
||||||
|
return new PointF(actualArea.left - offset.x + centerPoint.x * actualAreaSize.getWidth(), actualArea.top - offset.y + centerPoint.y * actualAreaSize.getWidth());
|
||||||
|
}
|
||||||
|
|
||||||
|
private float getActualInnerRadius() {
|
||||||
|
float shorterSide = (actualAreaSize.getWidth() > actualAreaSize.getHeight()) ? actualAreaSize.getHeight() : actualAreaSize.getWidth();
|
||||||
|
return shorterSide * falloff;
|
||||||
|
}
|
||||||
|
|
||||||
|
private float getActualOuterRadius() {
|
||||||
|
float shorterSide = (actualAreaSize.getWidth() > actualAreaSize.getHeight()) ? actualAreaSize.getHeight() : actualAreaSize.getWidth();
|
||||||
|
return shorterSide * size;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
/*
|
||||||
|
* This is the source code of Telegram for Android v. 2.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-2015.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.telegram.ui.Components;
|
||||||
|
|
||||||
|
public class PhotoFilterRadialBlurControl {
|
||||||
|
}
|
|
@ -71,6 +71,7 @@ public class PhotoFilterView extends FrameLayout {
|
||||||
private int shadowsTool = 6;
|
private int shadowsTool = 6;
|
||||||
private int vignetteTool = 7;
|
private int vignetteTool = 7;
|
||||||
private int grainTool = 8;
|
private int grainTool = 8;
|
||||||
|
private int blurTool = -1;
|
||||||
private int sharpenTool = 9;
|
private int sharpenTool = 9;
|
||||||
|
|
||||||
private float highlightsValue = 0; //0 100
|
private float highlightsValue = 0; //0 100
|
||||||
|
@ -1028,6 +1029,10 @@ public class PhotoFilterView extends FrameLayout {
|
||||||
orientation = rotation;
|
orientation = rotation;
|
||||||
|
|
||||||
textureView = new TextureView(context);
|
textureView = new TextureView(context);
|
||||||
|
if (Build.VERSION.SDK_INT == 14 || Build.VERSION.SDK_INT == 15) {
|
||||||
|
//setLayerType(LAYER_TYPE_HARDWARE, null);
|
||||||
|
//textureView.setLayerType(LAYER_TYPE_HARDWARE, null);
|
||||||
|
}
|
||||||
addView(textureView);
|
addView(textureView);
|
||||||
textureView.setVisibility(INVISIBLE);
|
textureView.setVisibility(INVISIBLE);
|
||||||
LayoutParams layoutParams = (LayoutParams) textureView.getLayoutParams();
|
LayoutParams layoutParams = (LayoutParams) textureView.getLayoutParams();
|
||||||
|
@ -1176,10 +1181,12 @@ public class PhotoFilterView extends FrameLayout {
|
||||||
previousValue = grainValue;
|
previousValue = grainValue;
|
||||||
valueSeekBar.setMinMax(0, 100);
|
valueSeekBar.setMinMax(0, 100);
|
||||||
paramTextView.setText(LocaleController.getString("Grain", R.string.Grain));
|
paramTextView.setText(LocaleController.getString("Grain", R.string.Grain));
|
||||||
} else if (i == sharpenTool) {
|
} else if (i == sharpenTool) {
|
||||||
previousValue = sharpenValue;
|
previousValue = sharpenValue;
|
||||||
valueSeekBar.setMinMax(0, 100);
|
valueSeekBar.setMinMax(0, 100);
|
||||||
paramTextView.setText(LocaleController.getString("Sharpen", R.string.Sharpen));
|
paramTextView.setText(LocaleController.getString("Sharpen", R.string.Sharpen));
|
||||||
|
} else if (i == blurTool) {
|
||||||
|
|
||||||
}
|
}
|
||||||
valueSeekBar.setProgress((int) previousValue, false);
|
valueSeekBar.setProgress((int) previousValue, false);
|
||||||
updateValueTextView();
|
updateValueTextView();
|
||||||
|
@ -1239,7 +1246,9 @@ public class PhotoFilterView extends FrameLayout {
|
||||||
} else if (selectedTool == sharpenTool) {
|
} else if (selectedTool == sharpenTool) {
|
||||||
sharpenValue = previousValue;
|
sharpenValue = previousValue;
|
||||||
}
|
}
|
||||||
eglThread.requestRender();
|
if (eglThread != null) {
|
||||||
|
eglThread.requestRender();
|
||||||
|
}
|
||||||
switchToOrFromEditMode();
|
switchToOrFromEditMode();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -1641,6 +1650,8 @@ public class PhotoFilterView extends FrameLayout {
|
||||||
((PhotoEditToolCell) holder.itemView).setIconAndTextAndValue(R.drawable.tool_grain, LocaleController.getString("Grain", R.string.Grain), grainValue);
|
((PhotoEditToolCell) holder.itemView).setIconAndTextAndValue(R.drawable.tool_grain, LocaleController.getString("Grain", R.string.Grain), grainValue);
|
||||||
} else if (i == sharpenTool) {
|
} else if (i == sharpenTool) {
|
||||||
((PhotoEditToolCell) holder.itemView).setIconAndTextAndValue(R.drawable.tool_details, LocaleController.getString("Sharpen", R.string.Sharpen), sharpenValue);
|
((PhotoEditToolCell) holder.itemView).setIconAndTextAndValue(R.drawable.tool_details, LocaleController.getString("Sharpen", R.string.Sharpen), sharpenValue);
|
||||||
|
} else if (i == blurTool) {
|
||||||
|
((PhotoEditToolCell) holder.itemView).setIconAndTextAndValue(R.drawable.tool_details, LocaleController.getString("Blur", R.string.Blur), 0); //TODO add value
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -302,6 +302,9 @@ public class ContactsActivity extends BaseFragment implements NotificationCenter
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (row == 0) {
|
if (row == 0) {
|
||||||
|
if (!MessagesController.isFeatureEnabled("chat_create", ContactsActivity.this)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
presentFragment(new GroupCreateActivity(), false);
|
presentFragment(new GroupCreateActivity(), false);
|
||||||
} else if (row == 1) {
|
} else if (row == 1) {
|
||||||
Bundle args = new Bundle();
|
Bundle args = new Bundle();
|
||||||
|
@ -310,6 +313,9 @@ public class ContactsActivity extends BaseFragment implements NotificationCenter
|
||||||
args.putBoolean("createSecretChat", true);
|
args.putBoolean("createSecretChat", true);
|
||||||
presentFragment(new ContactsActivity(args), false);
|
presentFragment(new ContactsActivity(args), false);
|
||||||
} else if (row == 2) {
|
} else if (row == 2) {
|
||||||
|
if (!MessagesController.isFeatureEnabled("broadcast_create", ContactsActivity.this)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
Bundle args = new Bundle();
|
Bundle args = new Bundle();
|
||||||
args.putBoolean("broadcast", true);
|
args.putBoolean("broadcast", true);
|
||||||
presentFragment(new GroupCreateActivity(args), false);
|
presentFragment(new GroupCreateActivity(args), false);
|
||||||
|
|
|
@ -266,6 +266,9 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa
|
||||||
@Override
|
@Override
|
||||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||||
if (position == 2) {
|
if (position == 2) {
|
||||||
|
if (!MessagesController.isFeatureEnabled("chat_create", actionBarLayout.fragmentsStack.get(actionBarLayout.fragmentsStack.size() - 1))) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
presentFragment(new GroupCreateActivity());
|
presentFragment(new GroupCreateActivity());
|
||||||
drawerLayoutContainer.closeDrawer(false);
|
drawerLayoutContainer.closeDrawer(false);
|
||||||
} else if (position == 3) {
|
} else if (position == 3) {
|
||||||
|
@ -276,6 +279,9 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa
|
||||||
presentFragment(new ContactsActivity(args));
|
presentFragment(new ContactsActivity(args));
|
||||||
drawerLayoutContainer.closeDrawer(false);
|
drawerLayoutContainer.closeDrawer(false);
|
||||||
} else if (position == 4) {
|
} else if (position == 4) {
|
||||||
|
if (!MessagesController.isFeatureEnabled("broadcast_create", actionBarLayout.fragmentsStack.get(actionBarLayout.fragmentsStack.size() - 1))) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
Bundle args = new Bundle();
|
Bundle args = new Bundle();
|
||||||
args.putBoolean("broadcast", true);
|
args.putBoolean("broadcast", true);
|
||||||
presentFragment(new GroupCreateActivity(args));
|
presentFragment(new GroupCreateActivity(args));
|
||||||
|
@ -546,6 +552,12 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
|
bufferedReader.close();
|
||||||
|
stream.close();
|
||||||
|
} catch (Exception e) {
|
||||||
|
FileLog.e("tmessages", e);
|
||||||
|
}
|
||||||
if (name != null && !phones.isEmpty()) {
|
if (name != null && !phones.isEmpty()) {
|
||||||
contactsToSend = new ArrayList<>();
|
contactsToSend = new ArrayList<>();
|
||||||
for (String phone : phones) {
|
for (String phone : phones) {
|
||||||
|
|
|
@ -58,6 +58,7 @@ import org.telegram.messenger.RPCRequest;
|
||||||
import org.telegram.messenger.TLObject;
|
import org.telegram.messenger.TLObject;
|
||||||
import org.telegram.messenger.TLRPC;
|
import org.telegram.messenger.TLRPC;
|
||||||
import org.telegram.messenger.UserConfig;
|
import org.telegram.messenger.UserConfig;
|
||||||
|
import org.telegram.messenger.Utilities;
|
||||||
import org.telegram.ui.ActionBar.ActionBar;
|
import org.telegram.ui.ActionBar.ActionBar;
|
||||||
import org.telegram.ui.ActionBar.ActionBarMenu;
|
import org.telegram.ui.ActionBar.ActionBarMenu;
|
||||||
import org.telegram.ui.ActionBar.BaseFragment;
|
import org.telegram.ui.ActionBar.BaseFragment;
|
||||||
|
@ -685,6 +686,7 @@ public class LoginActivity extends BaseFragment {
|
||||||
codesMap.put(args[0], args[2]);
|
codesMap.put(args[0], args[2]);
|
||||||
languageMap.put(args[1], args[2]);
|
languageMap.put(args[1], args[2]);
|
||||||
}
|
}
|
||||||
|
reader.close();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
FileLog.e("tmessages", e);
|
FileLog.e("tmessages", e);
|
||||||
}
|
}
|
||||||
|
@ -1233,6 +1235,12 @@ public class LoginActivity extends BaseFragment {
|
||||||
MessagesController.getInstance().getBlockedUsers(true);
|
MessagesController.getInstance().getBlockedUsers(true);
|
||||||
needFinishActivity();
|
needFinishActivity();
|
||||||
ConnectionsManager.getInstance().initPushConnection();
|
ConnectionsManager.getInstance().initPushConnection();
|
||||||
|
Utilities.stageQueue.postRunnable(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
ConnectionsManager.getInstance().updateDcSettings(0);
|
||||||
|
}
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
lastError = error.text;
|
lastError = error.text;
|
||||||
|
|
||||||
|
@ -1536,6 +1544,12 @@ public class LoginActivity extends BaseFragment {
|
||||||
MessagesController.getInstance().getBlockedUsers(true);
|
MessagesController.getInstance().getBlockedUsers(true);
|
||||||
needFinishActivity();
|
needFinishActivity();
|
||||||
ConnectionsManager.getInstance().initPushConnection();
|
ConnectionsManager.getInstance().initPushConnection();
|
||||||
|
Utilities.stageQueue.postRunnable(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
ConnectionsManager.getInstance().updateDcSettings(0);
|
||||||
|
}
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
if (error.text.contains("PHONE_NUMBER_INVALID")) {
|
if (error.text.contains("PHONE_NUMBER_INVALID")) {
|
||||||
needShowAlert(LocaleController.getString("InvalidPhoneNumber", R.string.InvalidPhoneNumber));
|
needShowAlert(LocaleController.getString("InvalidPhoneNumber", R.string.InvalidPhoneNumber));
|
||||||
|
|
|
@ -793,7 +793,7 @@ public class MediaActivity extends BaseFragment implements NotificationCenter.No
|
||||||
emptyImageView.setVisibility(View.VISIBLE);
|
emptyImageView.setVisibility(View.VISIBLE);
|
||||||
if (selectedMode == 0) {
|
if (selectedMode == 0) {
|
||||||
listView.setAdapter(photoVideoAdapter);
|
listView.setAdapter(photoVideoAdapter);
|
||||||
dropDown.setText(LocaleController.getString("SharedMedia", R.string.SharedMedia));
|
dropDown.setText(LocaleController.getString("SharedMediaTitle", R.string.SharedMediaTitle));
|
||||||
emptyImageView.setImageResource(R.drawable.tip1);
|
emptyImageView.setImageResource(R.drawable.tip1);
|
||||||
emptyTextView.setText(LocaleController.getString("NoMedia", R.string.NoMedia));
|
emptyTextView.setText(LocaleController.getString("NoMedia", R.string.NoMedia));
|
||||||
searchItem.setVisibility(View.GONE);
|
searchItem.setVisibility(View.GONE);
|
||||||
|
|
|
@ -753,7 +753,7 @@ public class NotificationsSettingsActivity extends BaseFragment implements Notif
|
||||||
} else if (value == 1) {
|
} else if (value == 1) {
|
||||||
textCell.setTextAndValue(LocaleController.getString("Vibrate", R.string.Vibrate), LocaleController.getString("Short", R.string.Short), true);
|
textCell.setTextAndValue(LocaleController.getString("Vibrate", R.string.Vibrate), LocaleController.getString("Short", R.string.Short), true);
|
||||||
} else if (value == 2) {
|
} else if (value == 2) {
|
||||||
textCell.setTextAndValue(LocaleController.getString("Vibrate", R.string.Vibrate), LocaleController.getString("Disabled", R.string.Disabled), true);
|
textCell.setTextAndValue(LocaleController.getString("Vibrate", R.string.Vibrate), LocaleController.getString("VibrationDisabled", R.string.VibrationDisabled), true);
|
||||||
} else if (value == 3) {
|
} else if (value == 3) {
|
||||||
textCell.setTextAndValue(LocaleController.getString("Vibrate", R.string.Vibrate), LocaleController.getString("Long", R.string.Long), true);
|
textCell.setTextAndValue(LocaleController.getString("Vibrate", R.string.Vibrate), LocaleController.getString("Long", R.string.Long), true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1875,7 +1875,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
||||||
canShowBottom = false;
|
canShowBottom = false;
|
||||||
Object obj = imagesArrLocals.get(index);
|
Object obj = imagesArrLocals.get(index);
|
||||||
cropItem.setVisibility(obj instanceof MediaController.PhotoEntry || obj instanceof MediaController.SearchImage && ((MediaController.SearchImage) obj).type == 0 ? View.VISIBLE : View.GONE);
|
cropItem.setVisibility(obj instanceof MediaController.PhotoEntry || obj instanceof MediaController.SearchImage && ((MediaController.SearchImage) obj).type == 0 ? View.VISIBLE : View.GONE);
|
||||||
if (Build.VERSION.SDK_INT >= 14) {
|
if (Build.VERSION.SDK_INT >= 16) {
|
||||||
tuneItem.setVisibility(cropItem.getVisibility());
|
tuneItem.setVisibility(cropItem.getVisibility());
|
||||||
}
|
}
|
||||||
updateSelectedCount();
|
updateSelectedCount();
|
||||||
|
@ -2313,12 +2313,10 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (windowView.getParent() != null) {
|
WindowManager wm = (WindowManager) parentActivity.getSystemService(Context.WINDOW_SERVICE);
|
||||||
WindowManager wm = (WindowManager) parentActivity.getSystemService(Context.WINDOW_SERVICE);
|
wm.removeView(windowView);
|
||||||
wm.removeView(windowView);
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
FileLog.e("tmessages", e);
|
//don't promt
|
||||||
}
|
}
|
||||||
|
|
||||||
WindowManager wm = (WindowManager) parentActivity.getSystemService(Context.WINDOW_SERVICE);
|
WindowManager wm = (WindowManager) parentActivity.getSystemService(Context.WINDOW_SERVICE);
|
||||||
|
|
|
@ -185,7 +185,7 @@ public class PopupNotificationActivity extends Activity implements NotificationC
|
||||||
if (chatActivityEnterView != null) {
|
if (chatActivityEnterView != null) {
|
||||||
chatActivityEnterView.onDestroy();
|
chatActivityEnterView.onDestroy();
|
||||||
}
|
}
|
||||||
chatActivityEnterView = new ChatActivityEnterView(this, contentView, true);
|
chatActivityEnterView = new ChatActivityEnterView(this, contentView, null, true);
|
||||||
popupContainer.addView(chatActivityEnterView);
|
popupContainer.addView(chatActivityEnterView);
|
||||||
layoutParams3 = (RelativeLayout.LayoutParams) chatActivityEnterView.getLayoutParams();
|
layoutParams3 = (RelativeLayout.LayoutParams) chatActivityEnterView.getLayoutParams();
|
||||||
layoutParams3.width = RelativeLayout.LayoutParams.MATCH_PARENT;
|
layoutParams3.width = RelativeLayout.LayoutParams.MATCH_PARENT;
|
||||||
|
|
|
@ -800,11 +800,13 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
|
||||||
updateProfileData();
|
updateProfileData();
|
||||||
}
|
}
|
||||||
if ((mask & MessagesController.UPDATE_MASK_AVATAR) != 0 || (mask & MessagesController.UPDATE_MASK_NAME) != 0 || (mask & MessagesController.UPDATE_MASK_STATUS) != 0) {
|
if ((mask & MessagesController.UPDATE_MASK_AVATAR) != 0 || (mask & MessagesController.UPDATE_MASK_NAME) != 0 || (mask & MessagesController.UPDATE_MASK_STATUS) != 0) {
|
||||||
int count = listView.getChildCount();
|
if (listView != null) {
|
||||||
for (int a = 0; a < count; a++) {
|
int count = listView.getChildCount();
|
||||||
View child = listView.getChildAt(a);
|
for (int a = 0; a < count; a++) {
|
||||||
if (child instanceof UserCell) {
|
View child = listView.getChildAt(a);
|
||||||
((UserCell) child).update(mask);
|
if (child instanceof UserCell) {
|
||||||
|
((UserCell) child).update(mask);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -120,7 +120,7 @@ public class ProfileNotificationsActivity extends BaseFragment implements Notifi
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
|
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
|
||||||
builder.setTitle(LocaleController.getString("Vibrate", R.string.Vibrate));
|
builder.setTitle(LocaleController.getString("Vibrate", R.string.Vibrate));
|
||||||
builder.setItems(new CharSequence[] {
|
builder.setItems(new CharSequence[] {
|
||||||
LocaleController.getString("Disabled", R.string.Disabled),
|
LocaleController.getString("VibrationDisabled", R.string.VibrationDisabled),
|
||||||
LocaleController.getString("SettingsDefault", R.string.SettingsDefault),
|
LocaleController.getString("SettingsDefault", R.string.SettingsDefault),
|
||||||
LocaleController.getString("SystemDefault", R.string.SystemDefault),
|
LocaleController.getString("SystemDefault", R.string.SystemDefault),
|
||||||
LocaleController.getString("Short", R.string.Short),
|
LocaleController.getString("Short", R.string.Short),
|
||||||
|
@ -158,7 +158,7 @@ public class ProfileNotificationsActivity extends BaseFragment implements Notifi
|
||||||
builder.setItems(new CharSequence[] {
|
builder.setItems(new CharSequence[] {
|
||||||
LocaleController.getString("Default", R.string.Default),
|
LocaleController.getString("Default", R.string.Default),
|
||||||
LocaleController.getString("Enabled", R.string.Enabled),
|
LocaleController.getString("Enabled", R.string.Enabled),
|
||||||
LocaleController.getString("Disabled", R.string.Disabled)
|
LocaleController.getString("NotificationsDisabled", R.string.NotificationsDisabled)
|
||||||
}, new DialogInterface.OnClickListener() {
|
}, new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface d, int which) {
|
public void onClick(DialogInterface d, int which) {
|
||||||
|
@ -402,7 +402,7 @@ public class ProfileNotificationsActivity extends BaseFragment implements Notifi
|
||||||
} else if (value == 1) {
|
} else if (value == 1) {
|
||||||
textCell.setTextAndValue(LocaleController.getString("Vibrate", R.string.Vibrate), LocaleController.getString("Short", R.string.Short), true);
|
textCell.setTextAndValue(LocaleController.getString("Vibrate", R.string.Vibrate), LocaleController.getString("Short", R.string.Short), true);
|
||||||
} else if (value == 2) {
|
} else if (value == 2) {
|
||||||
textCell.setTextAndValue(LocaleController.getString("Vibrate", R.string.Vibrate), LocaleController.getString("Disabled", R.string.Disabled), true);
|
textCell.setTextAndValue(LocaleController.getString("Vibrate", R.string.Vibrate), LocaleController.getString("VibrationDisabled", R.string.VibrationDisabled), true);
|
||||||
} else if (value == 3) {
|
} else if (value == 3) {
|
||||||
textCell.setTextAndValue(LocaleController.getString("Vibrate", R.string.Vibrate), LocaleController.getString("Long", R.string.Long), true);
|
textCell.setTextAndValue(LocaleController.getString("Vibrate", R.string.Vibrate), LocaleController.getString("Long", R.string.Long), true);
|
||||||
} else if (value == 4) {
|
} else if (value == 4) {
|
||||||
|
@ -415,7 +415,7 @@ public class ProfileNotificationsActivity extends BaseFragment implements Notifi
|
||||||
} else if (value == 1) {
|
} else if (value == 1) {
|
||||||
textCell.setTextAndValue(LocaleController.getString("Notifications", R.string.Notifications), LocaleController.getString("Enabled", R.string.Enabled), true);
|
textCell.setTextAndValue(LocaleController.getString("Notifications", R.string.Notifications), LocaleController.getString("Enabled", R.string.Enabled), true);
|
||||||
} else if (value == 2) {
|
} else if (value == 2) {
|
||||||
textCell.setTextAndValue(LocaleController.getString("Notifications", R.string.Notifications), LocaleController.getString("Disabled", R.string.Disabled), true);
|
textCell.setTextAndValue(LocaleController.getString("Notifications", R.string.Notifications), LocaleController.getString("NotificationsDisabled", R.string.NotificationsDisabled), true);
|
||||||
} else if (value == 3) {
|
} else if (value == 3) {
|
||||||
int delta = preferences.getInt("notifyuntil_" + dialog_id, 0) - ConnectionsManager.getInstance().getCurrentTime();
|
int delta = preferences.getInt("notifyuntil_" + dialog_id, 0) - ConnectionsManager.getInstance().getCurrentTime();
|
||||||
String val;
|
String val;
|
||||||
|
@ -433,7 +433,7 @@ public class ProfileNotificationsActivity extends BaseFragment implements Notifi
|
||||||
if (val != null) {
|
if (val != null) {
|
||||||
textCell.setTextAndValue(LocaleController.getString("Notifications", R.string.Notifications), val, true);
|
textCell.setTextAndValue(LocaleController.getString("Notifications", R.string.Notifications), val, true);
|
||||||
} else {
|
} else {
|
||||||
textCell.setTextAndValue(LocaleController.getString("Notifications", R.string.Notifications), LocaleController.getString("Disabled", R.string.Disabled), true);
|
textCell.setTextAndValue(LocaleController.getString("Notifications", R.string.Notifications), LocaleController.getString("NotificationsDisabled", R.string.NotificationsDisabled), true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (i == settingsSoundRow) {
|
} else if (i == settingsSoundRow) {
|
||||||
|
|
|
@ -782,6 +782,7 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter
|
||||||
if (supportUser != null && supportUser.id == 333000) {
|
if (supportUser != null && supportUser.id == 333000) {
|
||||||
supportUser = null;
|
supportUser = null;
|
||||||
}
|
}
|
||||||
|
data.cleanup();
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
FileLog.e("tmessages", e);
|
FileLog.e("tmessages", e);
|
||||||
|
@ -812,6 +813,7 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter
|
||||||
res.user.serializeToStream(data);
|
res.user.serializeToStream(data);
|
||||||
editor.putString("support_user", Base64.encodeToString(data.toByteArray(), Base64.DEFAULT));
|
editor.putString("support_user", Base64.encodeToString(data.toByteArray(), Base64.DEFAULT));
|
||||||
editor.commit();
|
editor.commit();
|
||||||
|
data.cleanup();
|
||||||
try {
|
try {
|
||||||
progressDialog.dismiss();
|
progressDialog.dismiss();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
|
@ -223,17 +223,26 @@ public class WallpapersActivity extends BaseFragment implements NotificationCent
|
||||||
if (resultCode == Activity.RESULT_OK) {
|
if (resultCode == Activity.RESULT_OK) {
|
||||||
if (requestCode == 10) {
|
if (requestCode == 10) {
|
||||||
Utilities.addMediaToGallery(currentPicturePath);
|
Utilities.addMediaToGallery(currentPicturePath);
|
||||||
|
FileOutputStream stream = null;
|
||||||
try {
|
try {
|
||||||
Point screenSize = AndroidUtilities.getRealScreenSize();
|
Point screenSize = AndroidUtilities.getRealScreenSize();
|
||||||
Bitmap bitmap = ImageLoader.loadBitmap(currentPicturePath, null, screenSize.x, screenSize.y, true);
|
Bitmap bitmap = ImageLoader.loadBitmap(currentPicturePath, null, screenSize.x, screenSize.y, true);
|
||||||
File toFile = new File(ApplicationLoader.applicationContext.getFilesDir(), "wallpaper-temp.jpg");
|
File toFile = new File(ApplicationLoader.applicationContext.getFilesDir(), "wallpaper-temp.jpg");
|
||||||
FileOutputStream stream = new FileOutputStream(toFile);
|
stream = new FileOutputStream(toFile);
|
||||||
bitmap.compress(Bitmap.CompressFormat.JPEG, 87, stream);
|
bitmap.compress(Bitmap.CompressFormat.JPEG, 87, stream);
|
||||||
selectedBackground = -1;
|
selectedBackground = -1;
|
||||||
selectedColor = 0;
|
selectedColor = 0;
|
||||||
backgroundImage.setImageBitmap(bitmap);
|
backgroundImage.setImageBitmap(bitmap);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
FileLog.e("tmessages", e);
|
FileLog.e("tmessages", e);
|
||||||
|
} finally {
|
||||||
|
try {
|
||||||
|
if (stream != null) {
|
||||||
|
stream.close();
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
FileLog.e("tmessages", e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
currentPicturePath = null;
|
currentPicturePath = null;
|
||||||
} else if (requestCode == 11) {
|
} else if (requestCode == 11) {
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
<string name="YourCode">رمز التفعيل</string>
|
<string name="YourCode">رمز التفعيل</string>
|
||||||
<string name="SentSmsCode">تم إرسال رسالة قصيرة تحتوي على رمز التفعيل الخاص بك</string>
|
<string name="SentSmsCode">تم إرسال رسالة قصيرة تحتوي على رمز التفعيل الخاص بك</string>
|
||||||
<string name="CallText">%1$d:%2$02d سنتصل بك خلال</string>
|
<string name="CallText">%1$d:%2$02d سنتصل بك خلال</string>
|
||||||
<string name="Calling">جاري الاتصال بك ...</string>
|
<string name="Calling">جارٍ الاتصال بك ...</string>
|
||||||
<string name="Code">رمز التفعيل</string>
|
<string name="Code">رمز التفعيل</string>
|
||||||
<string name="WrongNumber">الرقم خاطئ؟</string>
|
<string name="WrongNumber">الرقم خاطئ؟</string>
|
||||||
<string name="DidNotGetTheCode">هل استقبلت الرمز؟</string>
|
<string name="DidNotGetTheCode">هل استقبلت الرمز؟</string>
|
||||||
|
@ -36,12 +36,12 @@
|
||||||
<string name="NoChats">...لا توجد محادثات بعد</string>
|
<string name="NoChats">...لا توجد محادثات بعد</string>
|
||||||
<string name="NoChatsHelp">إبدأ المراسلة بالضغط على\nأيقونة النقاط في أعلى يمين الشاشة\nأو اذهب لقسم جهات الاتصال.</string>
|
<string name="NoChatsHelp">إبدأ المراسلة بالضغط على\nأيقونة النقاط في أعلى يمين الشاشة\nأو اذهب لقسم جهات الاتصال.</string>
|
||||||
<string name="WaitingForNetwork">في إنتظار الشبكة...</string>
|
<string name="WaitingForNetwork">في إنتظار الشبكة...</string>
|
||||||
<string name="Connecting">جاري الاتصال...</string>
|
<string name="Connecting">جارٍ الاتصال...</string>
|
||||||
<string name="Updating">جاري التحديث...</string>
|
<string name="Updating">جارٍ التحديث...</string>
|
||||||
<string name="NewSecretChat">محادثة سرية جديدة</string>
|
<string name="NewSecretChat">محادثة سرية جديدة</string>
|
||||||
<string name="AwaitingEncryption">في إنتظار اتصال %s … </string>
|
<string name="AwaitingEncryption">في إنتظار اتصال %s … </string>
|
||||||
<string name="EncryptionRejected">تم إلغاء المحادثة السرية</string>
|
<string name="EncryptionRejected">تم إلغاء المحادثة السرية</string>
|
||||||
<string name="EncryptionProcessing">جاري إرسال المفاتيح المشفرة...</string>
|
<string name="EncryptionProcessing">جارٍ إرسال المفاتيح المشفرة...</string>
|
||||||
<string name="EncryptedChatStartedOutgoing">%s قام بالدخول للمحادثة السرية.</string>
|
<string name="EncryptedChatStartedOutgoing">%s قام بالدخول للمحادثة السرية.</string>
|
||||||
<string name="EncryptedChatStartedIncoming">لقد قمت بالدخول للمحادثة السرية.</string>
|
<string name="EncryptedChatStartedIncoming">لقد قمت بالدخول للمحادثة السرية.</string>
|
||||||
<string name="ClearHistory">مسح سجل المحادثات</string>
|
<string name="ClearHistory">مسح سجل المحادثات</string>
|
||||||
|
@ -81,7 +81,7 @@
|
||||||
<string name="GalleryInfo">أرسل الصورة بدون ضغطها</string>
|
<string name="GalleryInfo">أرسل الصورة بدون ضغطها</string>
|
||||||
<!--chat view-->
|
<!--chat view-->
|
||||||
<string name="Invisible">مخفي</string>
|
<string name="Invisible">مخفي</string>
|
||||||
<string name="Typing">جاري الكتابة… </string>
|
<string name="Typing">جارٍ الكتابة… </string>
|
||||||
<string name="IsTyping">يكتب… </string>
|
<string name="IsTyping">يكتب… </string>
|
||||||
<string name="AreTyping">يكتبون… </string>
|
<string name="AreTyping">يكتبون… </string>
|
||||||
<string name="GotAQuestion">هل يوجد لديك سؤال\nحول تيليجرام؟</string>
|
<string name="GotAQuestion">هل يوجد لديك سؤال\nحول تيليجرام؟</string>
|
||||||
|
@ -108,7 +108,7 @@
|
||||||
<string name="YouWereKicked">لقد تم إخراجك من هذه المجموعة</string>
|
<string name="YouWereKicked">لقد تم إخراجك من هذه المجموعة</string>
|
||||||
<string name="YouLeft">لقد قمت بمغادرة المجموعة</string>
|
<string name="YouLeft">لقد قمت بمغادرة المجموعة</string>
|
||||||
<string name="DeleteThisGroup">حذف هذه المجموعة</string>
|
<string name="DeleteThisGroup">حذف هذه المجموعة</string>
|
||||||
<string name="DeleteThisChat">حذف هذه الدردشة</string>
|
<string name="DeleteThisChat">حذف هذه المحادثة</string>
|
||||||
<string name="SlideToCancel">قم بالسحب للإلغاء</string>
|
<string name="SlideToCancel">قم بالسحب للإلغاء</string>
|
||||||
<string name="SaveToDownloads">حفظ في الجهاز</string>
|
<string name="SaveToDownloads">حفظ في الجهاز</string>
|
||||||
<string name="ShareFile">مشاركة</string>
|
<string name="ShareFile">مشاركة</string>
|
||||||
|
@ -244,7 +244,7 @@
|
||||||
<string name="NoSound">لا يوجد صوت</string>
|
<string name="NoSound">لا يوجد صوت</string>
|
||||||
<string name="Default">افتراضي</string>
|
<string name="Default">افتراضي</string>
|
||||||
<string name="Support">الدعم</string>
|
<string name="Support">الدعم</string>
|
||||||
<string name="ChatBackground">خلفية الدردشة</string>
|
<string name="ChatBackground">خلفية المحادثة</string>
|
||||||
<string name="MessagesSettings">الرسائل</string>
|
<string name="MessagesSettings">الرسائل</string>
|
||||||
<string name="SendByEnter">أرسل بزر الإدخال</string>
|
<string name="SendByEnter">أرسل بزر الإدخال</string>
|
||||||
<string name="TerminateAllSessions">سجل الخروج من كافة الأجهزة الأخرى</string>
|
<string name="TerminateAllSessions">سجل الخروج من كافة الأجهزة الأخرى</string>
|
||||||
|
@ -298,6 +298,8 @@
|
||||||
<string name="ChangePhoneHelp">سيتم إرسال رسالة قصيرة تحتوي على رمز التفعيل الخاص إلى رقمك الجديد.</string>
|
<string name="ChangePhoneHelp">سيتم إرسال رسالة قصيرة تحتوي على رمز التفعيل الخاص إلى رقمك الجديد.</string>
|
||||||
<string name="ChangePhoneNumberOccupied">الرقم %1$s لديه حساب تيليجرام مسبقًا. يرجى حذف هذا الحساب قبل محاولة تغيير رقمك.</string>
|
<string name="ChangePhoneNumberOccupied">الرقم %1$s لديه حساب تيليجرام مسبقًا. يرجى حذف هذا الحساب قبل محاولة تغيير رقمك.</string>
|
||||||
<string name="NotificationsOther">آخر</string>
|
<string name="NotificationsOther">آخر</string>
|
||||||
|
<string name="NotificationsDisabled">تعطيل</string>
|
||||||
|
<string name="VibrationDisabled">تعطيل</string>
|
||||||
<!--passcode view-->
|
<!--passcode view-->
|
||||||
<string name="Passcode">رمز المرور</string>
|
<string name="Passcode">رمز المرور</string>
|
||||||
<string name="ChangePasscode">غيًر رمز المرور</string>
|
<string name="ChangePasscode">غيًر رمز المرور</string>
|
||||||
|
@ -477,14 +479,14 @@
|
||||||
<string name="InvalidCode">الرمز غير صحيح</string>
|
<string name="InvalidCode">الرمز غير صحيح</string>
|
||||||
<string name="InvalidFirstName">الاسم الأول غير صحيح</string>
|
<string name="InvalidFirstName">الاسم الأول غير صحيح</string>
|
||||||
<string name="InvalidLastName">اسم العائلة غير صحيح</string>
|
<string name="InvalidLastName">اسم العائلة غير صحيح</string>
|
||||||
<string name="Loading">جاري التحميل ...</string>
|
<string name="Loading">جارٍ التحميل ...</string>
|
||||||
<string name="NoPlayerInstalled">ليس لديك أي مشغل مقاطع مرئية، يرجى تنزيل أية مشغل</string>
|
<string name="NoPlayerInstalled">ليس لديك أي مشغل مقاطع مرئية، يرجى تنزيل أية مشغل</string>
|
||||||
<string name="NoMailInstalled">يرجى إرسال رسالة بواسطة البريد الإلكتروني إلى sms@telegram.org لتخبرنا عن مشكلتك.</string>
|
<string name="NoMailInstalled">يرجى إرسال رسالة بواسطة البريد الإلكتروني إلى sms@telegram.org لتخبرنا عن مشكلتك.</string>
|
||||||
<string name="NoHandleAppInstalled">لا يوجد لديك تطبيق يمكنه فتح \'%1$s\'، يرجى تنزيل تطبيق مناسب للإستمرار</string>
|
<string name="NoHandleAppInstalled">لا يوجد لديك تطبيق يمكنه فتح \'%1$s\'، يرجى تنزيل تطبيق مناسب للإستمرار</string>
|
||||||
<string name="InviteUser">هذا المستخدم ليس لديه تيليجرام بعد ، هل ترغب في دعوته الآن؟</string>
|
<string name="InviteUser">هذا المستخدم ليس لديه تيليجرام بعد ، هل ترغب في دعوته الآن؟</string>
|
||||||
<string name="AreYouSure">هل أنت متأكد؟</string>
|
<string name="AreYouSure">هل أنت متأكد؟</string>
|
||||||
<string name="AddToTheGroup">هل ترغب في إضافة %1$s للمجموعة؟\n\nعدد الرسائل الحديثة المراد إعادة تحويلها:</string>
|
<string name="AddToTheGroup">هل ترغب في إضافة %1$s للمجموعة؟\n\nعدد الرسائل الحديثة المراد إعادة تحويلها:</string>
|
||||||
<string name="ForwardMessagesTo">؟%1$s هل تريد إعادة توجيه الرسائل إلى</string>
|
<string name="ForwardMessagesTo">هل تريد إعادة توجيه الرسائل إلى %1$s؟</string>
|
||||||
<string name="SendMessagesTo">هل ترغب في إرسال رسالة إلى %1$s؟</string>
|
<string name="SendMessagesTo">هل ترغب في إرسال رسالة إلى %1$s؟</string>
|
||||||
<string name="AreYouSureLogout">نرجو الأخذ بالعلم أنه يمكنك استخدام تيليجرام على أجهزتك المتعددة بسهولة تامة وفي وقت واحد.\n\nوتذكر، تسجيل الخروج يحذف كافة محادثاتك السرية.</string>
|
<string name="AreYouSureLogout">نرجو الأخذ بالعلم أنه يمكنك استخدام تيليجرام على أجهزتك المتعددة بسهولة تامة وفي وقت واحد.\n\nوتذكر، تسجيل الخروج يحذف كافة محادثاتك السرية.</string>
|
||||||
<string name="AreYouSureSessions">هل أنت متأكد من تسجيل الخروج من جميع الأجهزة الأخرى باستثناء هذا الجهاز؟</string>
|
<string name="AreYouSureSessions">هل أنت متأكد من تسجيل الخروج من جميع الأجهزة الأخرى باستثناء هذا الجهاز؟</string>
|
||||||
|
@ -499,7 +501,7 @@
|
||||||
<string name="AreYouSureClearHistory">هل أنت متأكد من رغبتك في حذف سجل المحادثات؟</string>
|
<string name="AreYouSureClearHistory">هل أنت متأكد من رغبتك في حذف سجل المحادثات؟</string>
|
||||||
<string name="AreYouSureDeleteMessages">هل أنت متأكد من رغبتك في حذف %1$s؟</string>
|
<string name="AreYouSureDeleteMessages">هل أنت متأكد من رغبتك في حذف %1$s؟</string>
|
||||||
<string name="SendMessagesToGroup">هل ترغب في إرسال رسالة إلى %1$s؟</string>
|
<string name="SendMessagesToGroup">هل ترغب في إرسال رسالة إلى %1$s؟</string>
|
||||||
<string name="ForwardMessagesToGroup">؟%1$s هل تريد إعادة توجيه الرسائل إلى</string>
|
<string name="ForwardMessagesToGroup">هل تريد إعادة توجيه الرسائل إلى %1$s؟</string>
|
||||||
<string name="FeatureUnavailable">.Sorry, this feature is currently not available in your country</string>
|
<string name="FeatureUnavailable">.Sorry, this feature is currently not available in your country</string>
|
||||||
<!--Intro view-->
|
<!--Intro view-->
|
||||||
<string name="Page1Title">تيليجرام</string>
|
<string name="Page1Title">تيليجرام</string>
|
||||||
|
|
|
@ -298,6 +298,8 @@
|
||||||
<string name="ChangePhoneHelp">Der Bestätigungscode kommt per SMS an deine neue Nummer.</string>
|
<string name="ChangePhoneHelp">Der Bestätigungscode kommt per SMS an deine neue Nummer.</string>
|
||||||
<string name="ChangePhoneNumberOccupied">Die Telefonnummer %1$s ist bereits ein Telegram Konto. Bitte lösche es, bevor du mit der Übertragung auf das neue Konto startest.</string>
|
<string name="ChangePhoneNumberOccupied">Die Telefonnummer %1$s ist bereits ein Telegram Konto. Bitte lösche es, bevor du mit der Übertragung auf das neue Konto startest.</string>
|
||||||
<string name="NotificationsOther">Sonstige</string>
|
<string name="NotificationsOther">Sonstige</string>
|
||||||
|
<string name="NotificationsDisabled">Deaktiviert</string>
|
||||||
|
<string name="VibrationDisabled">Deaktiviert</string>
|
||||||
<!--passcode view-->
|
<!--passcode view-->
|
||||||
<string name="Passcode">Pincode</string>
|
<string name="Passcode">Pincode</string>
|
||||||
<string name="ChangePasscode">Pincode ändern</string>
|
<string name="ChangePasscode">Pincode ändern</string>
|
||||||
|
|
|
@ -298,6 +298,8 @@
|
||||||
<string name="ChangePhoneHelp">Enviaremos un SMS con el código de confirmación a tu nuevo número.</string>
|
<string name="ChangePhoneHelp">Enviaremos un SMS con el código de confirmación a tu nuevo número.</string>
|
||||||
<string name="ChangePhoneNumberOccupied">El número %1$s ya está vinculado a una cuenta de Telegram. Por favor, elimina esa cuenta antes de migrar al nuevo número.</string>
|
<string name="ChangePhoneNumberOccupied">El número %1$s ya está vinculado a una cuenta de Telegram. Por favor, elimina esa cuenta antes de migrar al nuevo número.</string>
|
||||||
<string name="NotificationsOther">Otras</string>
|
<string name="NotificationsOther">Otras</string>
|
||||||
|
<string name="NotificationsDisabled">Desactivadas</string>
|
||||||
|
<string name="VibrationDisabled">Desactivadas</string>
|
||||||
<!--passcode view-->
|
<!--passcode view-->
|
||||||
<string name="Passcode">Código de acceso</string>
|
<string name="Passcode">Código de acceso</string>
|
||||||
<string name="ChangePasscode">Cambiar código de acceso</string>
|
<string name="ChangePasscode">Cambiar código de acceso</string>
|
||||||
|
|
|
@ -298,6 +298,8 @@
|
||||||
<string name="ChangePhoneHelp">Invieremo un SMS con un codice di conferma al tuo nuovo numero.</string>
|
<string name="ChangePhoneHelp">Invieremo un SMS con un codice di conferma al tuo nuovo numero.</string>
|
||||||
<string name="ChangePhoneNumberOccupied">Il numero %1$s è già connesso a un account Telegram. Per favore elimina quell\'account prima di migrare ad un nuovo numero.</string>
|
<string name="ChangePhoneNumberOccupied">Il numero %1$s è già connesso a un account Telegram. Per favore elimina quell\'account prima di migrare ad un nuovo numero.</string>
|
||||||
<string name="NotificationsOther">Altro</string>
|
<string name="NotificationsOther">Altro</string>
|
||||||
|
<string name="NotificationsDisabled">Disabilitate</string>
|
||||||
|
<string name="VibrationDisabled">Disabilitata</string>
|
||||||
<!--passcode view-->
|
<!--passcode view-->
|
||||||
<string name="Passcode">Codice</string>
|
<string name="Passcode">Codice</string>
|
||||||
<string name="ChangePasscode">Cambia codice</string>
|
<string name="ChangePasscode">Cambia codice</string>
|
||||||
|
|
|
@ -298,6 +298,8 @@
|
||||||
<string name="ChangePhoneHelp">인증코드 메시지를 새 번호로 전송하겠습니다.</string>
|
<string name="ChangePhoneHelp">인증코드 메시지를 새 번호로 전송하겠습니다.</string>
|
||||||
<string name="ChangePhoneNumberOccupied">그 번호는 이미 텔레그램 계정에 연결되어 있습니다. 새 번호로 이동하기 전에 %1$s 계정에서 탈퇴해 주세요.</string>
|
<string name="ChangePhoneNumberOccupied">그 번호는 이미 텔레그램 계정에 연결되어 있습니다. 새 번호로 이동하기 전에 %1$s 계정에서 탈퇴해 주세요.</string>
|
||||||
<string name="NotificationsOther">기타</string>
|
<string name="NotificationsOther">기타</string>
|
||||||
|
<string name="NotificationsDisabled">끄기</string>
|
||||||
|
<string name="VibrationDisabled">끄기</string>
|
||||||
<!--passcode view-->
|
<!--passcode view-->
|
||||||
<string name="Passcode">잠금번호</string>
|
<string name="Passcode">잠금번호</string>
|
||||||
<string name="ChangePasscode">잠금번호 변경</string>
|
<string name="ChangePasscode">잠금번호 변경</string>
|
||||||
|
|
|
@ -298,6 +298,8 @@
|
||||||
<string name="ChangePhoneHelp">We sturen een sms-bericht met verificatiecode naar je nieuwe nummer.</string>
|
<string name="ChangePhoneHelp">We sturen een sms-bericht met verificatiecode naar je nieuwe nummer.</string>
|
||||||
<string name="ChangePhoneNumberOccupied">Aan telefoonnummer %1$s is al een Telegram-account gekoppeld. Verwijder het account om te kunnen migreren naar het nieuwe nummer.</string>
|
<string name="ChangePhoneNumberOccupied">Aan telefoonnummer %1$s is al een Telegram-account gekoppeld. Verwijder het account om te kunnen migreren naar het nieuwe nummer.</string>
|
||||||
<string name="NotificationsOther">Overig</string>
|
<string name="NotificationsOther">Overig</string>
|
||||||
|
<string name="NotificationsDisabled">Uitgeschakeld</string>
|
||||||
|
<string name="VibrationDisabled">Uitgeschakeld</string>
|
||||||
<!--passcode view-->
|
<!--passcode view-->
|
||||||
<string name="Passcode">Toegangscode</string>
|
<string name="Passcode">Toegangscode</string>
|
||||||
<string name="ChangePasscode">Toegangscode wijzigen</string>
|
<string name="ChangePasscode">Toegangscode wijzigen</string>
|
||||||
|
|
|
@ -298,6 +298,8 @@
|
||||||
<string name="ChangePhoneHelp">Vamos enviar uma SMS com um código de confirmação para o seu novo número.</string>
|
<string name="ChangePhoneHelp">Vamos enviar uma SMS com um código de confirmação para o seu novo número.</string>
|
||||||
<string name="ChangePhoneNumberOccupied">O número %1$s já possui uma conta do Telegram. Por favor, exclua esta conta antes de migrar para o novo número.</string>
|
<string name="ChangePhoneNumberOccupied">O número %1$s já possui uma conta do Telegram. Por favor, exclua esta conta antes de migrar para o novo número.</string>
|
||||||
<string name="NotificationsOther">Outro</string>
|
<string name="NotificationsOther">Outro</string>
|
||||||
|
<string name="NotificationsDisabled">Desativado</string>
|
||||||
|
<string name="VibrationDisabled">Desativado</string>
|
||||||
<!--passcode view-->
|
<!--passcode view-->
|
||||||
<string name="Passcode">Senha</string>
|
<string name="Passcode">Senha</string>
|
||||||
<string name="ChangePasscode">Alterar Senha</string>
|
<string name="ChangePasscode">Alterar Senha</string>
|
||||||
|
|
|
@ -298,6 +298,8 @@
|
||||||
<string name="ChangePhoneHelp">Vamos enviar uma SMS com um código de confirmação para o seu novo número.</string>
|
<string name="ChangePhoneHelp">Vamos enviar uma SMS com um código de confirmação para o seu novo número.</string>
|
||||||
<string name="ChangePhoneNumberOccupied">O número %1$s já possui uma conta do Telegram. Por favor, exclua esta conta antes de migrar para o novo número.</string>
|
<string name="ChangePhoneNumberOccupied">O número %1$s já possui uma conta do Telegram. Por favor, exclua esta conta antes de migrar para o novo número.</string>
|
||||||
<string name="NotificationsOther">Outro</string>
|
<string name="NotificationsOther">Outro</string>
|
||||||
|
<string name="NotificationsDisabled">Desativado</string>
|
||||||
|
<string name="VibrationDisabled">Desativado</string>
|
||||||
<!--passcode view-->
|
<!--passcode view-->
|
||||||
<string name="Passcode">Senha</string>
|
<string name="Passcode">Senha</string>
|
||||||
<string name="ChangePasscode">Alterar Senha</string>
|
<string name="ChangePasscode">Alterar Senha</string>
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
|
<resources>
|
||||||
|
<bool name="useHardwareAcceleration">false</bool>
|
||||||
|
</resources>
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
|
<resources>
|
||||||
|
<bool name="useHardwareAcceleration">false</bool>
|
||||||
|
</resources>
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
|
<resources>
|
||||||
|
<bool name="useHardwareAcceleration">true</bool>
|
||||||
|
</resources>
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
|
<resources>
|
||||||
|
<bool name="useHardwareAcceleration">true</bool>
|
||||||
|
</resources>
|
|
@ -298,6 +298,8 @@
|
||||||
<string name="ChangePhoneHelp">We will send an SMS with a confirmation code to your new number.</string>
|
<string name="ChangePhoneHelp">We will send an SMS with a confirmation code to your new number.</string>
|
||||||
<string name="ChangePhoneNumberOccupied">The number %1$s is already connected to a Telegram account. Please delete that account before migrating to the new number.</string>
|
<string name="ChangePhoneNumberOccupied">The number %1$s is already connected to a Telegram account. Please delete that account before migrating to the new number.</string>
|
||||||
<string name="NotificationsOther">Other</string>
|
<string name="NotificationsOther">Other</string>
|
||||||
|
<string name="NotificationsDisabled">Disabled</string>
|
||||||
|
<string name="VibrationDisabled">Disabled</string>
|
||||||
<!--passcode view-->
|
<!--passcode view-->
|
||||||
<string name="Passcode">Passcode</string>
|
<string name="Passcode">Passcode</string>
|
||||||
<string name="ChangePasscode">Change Passcode</string>
|
<string name="ChangePasscode">Change Passcode</string>
|
||||||
|
|
Loading…
Reference in New Issue