mirror of
https://github.com/DrKLO/Telegram.git
synced 2024-12-22 14:35:03 +01:00
update to 9.1.4
This commit is contained in:
parent
4951061dde
commit
9bd017a72a
66 changed files with 1207 additions and 417 deletions
|
@ -22,7 +22,7 @@ dependencies {
|
||||||
implementation 'androidx.exifinterface:exifinterface:1.3.3'
|
implementation 'androidx.exifinterface:exifinterface:1.3.3'
|
||||||
implementation 'androidx.dynamicanimation:dynamicanimation:1.0.0'
|
implementation 'androidx.dynamicanimation:dynamicanimation:1.0.0'
|
||||||
implementation 'androidx.multidex:multidex:2.0.1'
|
implementation 'androidx.multidex:multidex:2.0.1'
|
||||||
implementation "androidx.sharetarget:sharetarget:1.1.0"
|
implementation "androidx.sharetarget:sharetarget:1.2.0"
|
||||||
|
|
||||||
compileOnly 'org.checkerframework:checker-qual:2.5.2'
|
compileOnly 'org.checkerframework:checker-qual:2.5.2'
|
||||||
compileOnly 'org.checkerframework:checker-compat-qual:2.5.0'
|
compileOnly 'org.checkerframework:checker-compat-qual:2.5.0'
|
||||||
|
@ -79,8 +79,8 @@ android {
|
||||||
defaultConfig.versionCode = Integer.parseInt(APP_VERSION_CODE)
|
defaultConfig.versionCode = Integer.parseInt(APP_VERSION_CODE)
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdkVersion 16
|
minSdkVersion 19
|
||||||
targetSdkVersion 30
|
targetSdkVersion 31
|
||||||
versionName "8.9.0"
|
versionName "8.9.0"
|
||||||
|
|
||||||
vectorDrawables.generatedDensities = ['mdpi', 'hdpi', 'xhdpi', 'xxhdpi']
|
vectorDrawables.generatedDensities = ['mdpi', 'hdpi', 'xhdpi', 'xxhdpi']
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
|
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
|
||||||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
||||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||||
|
<uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM"/>
|
||||||
|
|
||||||
<permission android:name="${applicationId}.permission.MAPS_RECEIVE" android:protectionLevel="signature"/>
|
<permission android:name="${applicationId}.permission.MAPS_RECEIVE" android:protectionLevel="signature"/>
|
||||||
|
|
||||||
|
@ -31,7 +32,7 @@
|
||||||
<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" />
|
||||||
|
|
||||||
<service
|
<service
|
||||||
android:name="org.telegram.messenger.GcmPushListenerService">
|
android:name="org.telegram.messenger.GcmPushListenerService" android:exported="true">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="com.google.firebase.MESSAGING_EVENT" />
|
<action android:name="com.google.firebase.MESSAGING_EVENT" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
|
@ -45,7 +46,8 @@
|
||||||
<receiver
|
<receiver
|
||||||
tools:replace="android:enabled"
|
tools:replace="android:enabled"
|
||||||
android:name="com.google.android.gms.measurement.AppMeasurementReceiver"
|
android:name="com.google.android.gms.measurement.AppMeasurementReceiver"
|
||||||
android:enabled="false">
|
android:enabled="false"
|
||||||
|
android:exported="false">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="com.google.android.gms.measurement.UPLOAD" />
|
<action android:name="com.google.android.gms.measurement.UPLOAD" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
<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" />
|
||||||
|
|
||||||
<service
|
<service
|
||||||
android:name="org.telegram.messenger.GcmPushListenerService">
|
android:name="org.telegram.messenger.GcmPushListenerService" android:exported="true">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="com.google.firebase.MESSAGING_EVENT" />
|
<action android:name="com.google.firebase.MESSAGING_EVENT" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
|
@ -48,7 +48,8 @@
|
||||||
<receiver
|
<receiver
|
||||||
tools:replace="android:enabled"
|
tools:replace="android:enabled"
|
||||||
android:name="com.google.android.gms.measurement.AppMeasurementReceiver"
|
android:name="com.google.android.gms.measurement.AppMeasurementReceiver"
|
||||||
android:enabled="false">
|
android:enabled="false"
|
||||||
|
android:exported="false">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="com.google.android.gms.measurement.UPLOAD" />
|
<action android:name="com.google.android.gms.measurement.UPLOAD" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
|
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
|
||||||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
||||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||||
|
<uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM"/>
|
||||||
|
|
||||||
<permission android:name="${applicationId}.permission.MAPS_RECEIVE" android:protectionLevel="signature"/>
|
<permission android:name="${applicationId}.permission.MAPS_RECEIVE" android:protectionLevel="signature"/>
|
||||||
|
|
||||||
|
@ -31,7 +32,7 @@
|
||||||
<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" />
|
||||||
|
|
||||||
<service
|
<service
|
||||||
android:name="org.telegram.messenger.GcmPushListenerService">
|
android:name="org.telegram.messenger.GcmPushListenerService" android:exported="true">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="com.google.firebase.MESSAGING_EVENT" />
|
<action android:name="com.google.firebase.MESSAGING_EVENT" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
|
@ -45,7 +46,8 @@
|
||||||
<receiver
|
<receiver
|
||||||
tools:replace="android:enabled"
|
tools:replace="android:enabled"
|
||||||
android:name="com.google.android.gms.measurement.AppMeasurementReceiver"
|
android:name="com.google.android.gms.measurement.AppMeasurementReceiver"
|
||||||
android:enabled="false">
|
android:enabled="false"
|
||||||
|
android:exported="false">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="com.google.android.gms.measurement.UPLOAD" />
|
<action android:name="com.google.android.gms.measurement.UPLOAD" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
|
|
|
@ -34,7 +34,8 @@
|
||||||
<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" />
|
||||||
|
|
||||||
<service
|
<service
|
||||||
android:name="org.telegram.messenger.GcmPushListenerService">
|
android:name="org.telegram.messenger.GcmPushListenerService"
|
||||||
|
android:exported="true">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="com.google.firebase.MESSAGING_EVENT" />
|
<action android:name="com.google.firebase.MESSAGING_EVENT" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
|
@ -48,7 +49,8 @@
|
||||||
<receiver
|
<receiver
|
||||||
tools:replace="android:enabled"
|
tools:replace="android:enabled"
|
||||||
android:name="com.google.android.gms.measurement.AppMeasurementReceiver"
|
android:name="com.google.android.gms.measurement.AppMeasurementReceiver"
|
||||||
android:enabled="false">
|
android:enabled="false"
|
||||||
|
android:exported="false">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="com.google.android.gms.measurement.UPLOAD" />
|
<action android:name="com.google.android.gms.measurement.UPLOAD" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
|
|
|
@ -114,7 +114,7 @@
|
||||||
<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" />
|
||||||
|
|
||||||
<service
|
<service
|
||||||
android:name="org.telegram.messenger.GcmPushListenerService">
|
android:name="org.telegram.messenger.GcmPushListenerService" android:exported="true">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="com.google.firebase.MESSAGING_EVENT" />
|
<action android:name="com.google.firebase.MESSAGING_EVENT" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
|
@ -128,7 +128,8 @@
|
||||||
<receiver
|
<receiver
|
||||||
tools:replace="android:enabled"
|
tools:replace="android:enabled"
|
||||||
android:name="com.google.android.gms.measurement.AppMeasurementReceiver"
|
android:name="com.google.android.gms.measurement.AppMeasurementReceiver"
|
||||||
android:enabled="false">
|
android:enabled="false"
|
||||||
|
android:exported="false">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="com.google.android.gms.measurement.UPLOAD" />
|
<action android:name="com.google.android.gms.measurement.UPLOAD" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
|
|
|
@ -184,7 +184,8 @@
|
||||||
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
|
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
|
||||||
android:hardwareAccelerated="@bool/useHardwareAcceleration"
|
android:hardwareAccelerated="@bool/useHardwareAcceleration"
|
||||||
android:launchMode="singleTask"
|
android:launchMode="singleTask"
|
||||||
android:windowSoftInputMode="adjustResize">
|
android:windowSoftInputMode="adjustResize"
|
||||||
|
android:exported="true">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
|
@ -251,7 +252,8 @@
|
||||||
<activity-alias
|
<activity-alias
|
||||||
android:name="org.telegram.ui.CallsActivity"
|
android:name="org.telegram.ui.CallsActivity"
|
||||||
android:targetActivity="org.telegram.ui.LaunchActivity"
|
android:targetActivity="org.telegram.ui.LaunchActivity"
|
||||||
android:permission="android.permission.CALL_PHONE">
|
android:permission="android.permission.CALL_PHONE"
|
||||||
|
android:exported="true">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.VIEW"/>
|
<action android:name="android.intent.action.VIEW"/>
|
||||||
<category android:name="android.intent.category.DEFAULT"/>
|
<category android:name="android.intent.category.DEFAULT"/>
|
||||||
|
@ -274,7 +276,8 @@
|
||||||
android:windowSoftInputMode="adjustPan"
|
android:windowSoftInputMode="adjustPan"
|
||||||
android:excludeFromRecents="true"
|
android:excludeFromRecents="true"
|
||||||
android:stateNotNeeded="true"
|
android:stateNotNeeded="true"
|
||||||
android:theme="@style/Theme.TMessages.Transparent">
|
android:theme="@style/Theme.TMessages.Transparent"
|
||||||
|
android:exported="true">
|
||||||
<intent-filter android:icon="@mipmap/ic_launcher" android:roundIcon="@mipmap/ic_launcher_round" android:priority="1">
|
<intent-filter android:icon="@mipmap/ic_launcher" android:roundIcon="@mipmap/ic_launcher_round" android:priority="1">
|
||||||
<action android:name="android.intent.action.VIEW" />
|
<action android:name="android.intent.action.VIEW" />
|
||||||
<category android:name="android.intent.category.BROWSABLE" />
|
<category android:name="android.intent.category.BROWSABLE" />
|
||||||
|
@ -286,7 +289,8 @@
|
||||||
android:name="org.telegram.ui.ExternalActionActivity"
|
android:name="org.telegram.ui.ExternalActionActivity"
|
||||||
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
|
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
|
||||||
android:hardwareAccelerated="@bool/useHardwareAcceleration"
|
android:hardwareAccelerated="@bool/useHardwareAcceleration"
|
||||||
android:windowSoftInputMode="adjustPan">
|
android:windowSoftInputMode="adjustPan"
|
||||||
|
android:exported="true">
|
||||||
<intent-filter android:icon="@mipmap/ic_launcher" android:roundIcon="@mipmap/ic_launcher_round">
|
<intent-filter android:icon="@mipmap/ic_launcher" android:roundIcon="@mipmap/ic_launcher_round">
|
||||||
<action android:name="org.telegram.passport.AUTHORIZE"/>
|
<action android:name="org.telegram.passport.AUTHORIZE"/>
|
||||||
<category android:name="android.intent.category.DEFAULT"/>
|
<category android:name="android.intent.category.DEFAULT"/>
|
||||||
|
@ -296,7 +300,8 @@
|
||||||
android:name="org.telegram.ui.ChatsWidgetConfigActivity"
|
android:name="org.telegram.ui.ChatsWidgetConfigActivity"
|
||||||
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
|
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
|
||||||
android:hardwareAccelerated="@bool/useHardwareAcceleration"
|
android:hardwareAccelerated="@bool/useHardwareAcceleration"
|
||||||
android:windowSoftInputMode="adjustPan">
|
android:windowSoftInputMode="adjustPan"
|
||||||
|
android:exported="true">
|
||||||
<intent-filter android:icon="@mipmap/ic_launcher" android:roundIcon="@mipmap/ic_launcher_round">
|
<intent-filter android:icon="@mipmap/ic_launcher" android:roundIcon="@mipmap/ic_launcher_round">
|
||||||
<action android:name="android.appwidget.action.APPWIDGET_CONFIGURE"/>
|
<action android:name="android.appwidget.action.APPWIDGET_CONFIGURE"/>
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
|
@ -305,7 +310,8 @@
|
||||||
android:name="org.telegram.ui.ContactsWidgetConfigActivity"
|
android:name="org.telegram.ui.ContactsWidgetConfigActivity"
|
||||||
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
|
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
|
||||||
android:hardwareAccelerated="@bool/useHardwareAcceleration"
|
android:hardwareAccelerated="@bool/useHardwareAcceleration"
|
||||||
android:windowSoftInputMode="adjustPan">
|
android:windowSoftInputMode="adjustPan"
|
||||||
|
android:exported="true">
|
||||||
<intent-filter android:icon="@mipmap/ic_launcher" android:roundIcon="@mipmap/ic_launcher_round">
|
<intent-filter android:icon="@mipmap/ic_launcher" android:roundIcon="@mipmap/ic_launcher_round">
|
||||||
<action android:name="android.appwidget.action.APPWIDGET_CONFIGURE"/>
|
<action android:name="android.appwidget.action.APPWIDGET_CONFIGURE"/>
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
|
@ -377,7 +383,7 @@
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</receiver>
|
</receiver>
|
||||||
|
|
||||||
<receiver android:name=".CallReceiver">
|
<receiver android:name=".CallReceiver" android:exported="false">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.PHONE_STATE"/>
|
<action android:name="android.intent.action.PHONE_STATE"/>
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
|
@ -404,14 +410,15 @@
|
||||||
<service android:name=".KeepAliveJob"
|
<service android:name=".KeepAliveJob"
|
||||||
android:exported="false"
|
android:exported="false"
|
||||||
android:permission="android.permission.BIND_JOB_SERVICE"/>
|
android:permission="android.permission.BIND_JOB_SERVICE"/>
|
||||||
<service android:name=".BringAppForegroundService" android:enabled="true"/>
|
<service android:name=".BringAppForegroundService" android:enabled="true" android:exported="true"/>
|
||||||
<service android:name=".NotificationsService" android:enabled="true"/>
|
<service android:name=".NotificationsService" android:enabled="true" android:exported="true"/>
|
||||||
<service android:name=".NotificationRepeat" android:exported="false"/>
|
<service android:name=".NotificationRepeat" android:exported="false"/>
|
||||||
<service android:name=".VideoEncodingService" android:enabled="true"/>
|
<service android:name=".VideoEncodingService" android:enabled="true" android:exported="true"/>
|
||||||
<service android:name=".ImportingService" android:enabled="true"/>
|
<service android:name=".ImportingService" android:enabled="true" android:exported="true"/>
|
||||||
<service android:name=".LocationSharingService"
|
<service android:name=".LocationSharingService"
|
||||||
android:foregroundServiceType="location"
|
android:foregroundServiceType="location"
|
||||||
android:enabled="true"/>
|
android:enabled="true"
|
||||||
|
android:exported="true"/>
|
||||||
<service android:name=".voip.VoIPService" android:enabled="true" android:foregroundServiceType="mediaProjection|camera|microphone|mediaPlayback"/>
|
<service android:name=".voip.VoIPService" android:enabled="true" android:foregroundServiceType="mediaProjection|camera|microphone|mediaPlayback"/>
|
||||||
<service android:name=".MusicPlayerService" android:exported="true" android:enabled="true" android:foregroundServiceType="mediaPlayback"/>
|
<service android:name=".MusicPlayerService" android:exported="true" android:enabled="true" android:foregroundServiceType="mediaPlayback"/>
|
||||||
<service android:name=".MusicBrowserService" android:exported="true">
|
<service android:name=".MusicBrowserService" android:exported="true">
|
||||||
|
@ -419,13 +426,13 @@
|
||||||
<action android:name="android.media.browse.MediaBrowserService"/>
|
<action android:name="android.media.browse.MediaBrowserService"/>
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</service>
|
</service>
|
||||||
<service android:name=".voip.TelegramConnectionService" android:permission="android.permission.BIND_TELECOM_CONNECTION_SERVICE">
|
<service android:name=".voip.TelegramConnectionService" android:permission="android.permission.BIND_TELECOM_CONNECTION_SERVICE" android:exported="true">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.telecom.ConnectionService" />
|
<action android:name="android.telecom.ConnectionService" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</service>
|
</service>
|
||||||
|
|
||||||
<receiver android:name=".MusicPlayerReceiver" >
|
<receiver android:name=".MusicPlayerReceiver" android:exported="false">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="org.telegram.android.musicplayer.close" />
|
<action android:name="org.telegram.android.musicplayer.close" />
|
||||||
<action android:name="org.telegram.android.musicplayer.pause" />
|
<action android:name="org.telegram.android.musicplayer.pause" />
|
||||||
|
@ -442,7 +449,7 @@
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</receiver>
|
</receiver>
|
||||||
|
|
||||||
<receiver android:name=".AppStartReceiver" android:enabled="true">
|
<receiver android:name=".AppStartReceiver" android:enabled="true" android:exported="false">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="org.telegram.start" />
|
<action android:name="org.telegram.start" />
|
||||||
<action android:name="android.intent.action.BOOT_COMPLETED" />
|
<action android:name="android.intent.action.BOOT_COMPLETED" />
|
||||||
|
|
|
@ -297,7 +297,7 @@ public class ApplicationLoader extends Application {
|
||||||
} else {
|
} else {
|
||||||
applicationContext.stopService(new Intent(applicationContext, NotificationsService.class));
|
applicationContext.stopService(new Intent(applicationContext, NotificationsService.class));
|
||||||
|
|
||||||
PendingIntent pintent = PendingIntent.getService(applicationContext, 0, new Intent(applicationContext, NotificationsService.class), 0);
|
PendingIntent pintent = PendingIntent.getService(applicationContext, 0, new Intent(applicationContext, NotificationsService.class), PendingIntent.FLAG_MUTABLE);
|
||||||
AlarmManager alarm = (AlarmManager)applicationContext.getSystemService(Context.ALARM_SERVICE);
|
AlarmManager alarm = (AlarmManager)applicationContext.getSystemService(Context.ALARM_SERVICE);
|
||||||
alarm.cancel(pintent);
|
alarm.cancel(pintent);
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,8 +24,8 @@ public class BuildVars {
|
||||||
public static boolean USE_CLOUD_STRINGS = true;
|
public static boolean USE_CLOUD_STRINGS = true;
|
||||||
public static boolean CHECK_UPDATES = true;
|
public static boolean CHECK_UPDATES = true;
|
||||||
public static boolean NO_SCOPED_STORAGE = Build.VERSION.SDK_INT <= 29;
|
public static boolean NO_SCOPED_STORAGE = Build.VERSION.SDK_INT <= 29;
|
||||||
public static int BUILD_VERSION = 2917;
|
public static int BUILD_VERSION = 2927;
|
||||||
public static String BUILD_VERSION_STRING = "9.1.3";
|
public static String BUILD_VERSION_STRING = "9.1.4";
|
||||||
public static int APP_ID = 4;
|
public static int APP_ID = 4;
|
||||||
public static String APP_HASH = "014b35b6184100b085b0d0572f9b5103";
|
public static String APP_HASH = "014b35b6184100b085b0d0572f9b5103";
|
||||||
|
|
||||||
|
|
|
@ -110,7 +110,7 @@ public class ChatsWidgetProvider extends AppWidgetProvider {
|
||||||
intent.setAction("com.tmessages.openchat" + Math.random() + Integer.MAX_VALUE);
|
intent.setAction("com.tmessages.openchat" + Math.random() + Integer.MAX_VALUE);
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||||
intent.addCategory(Intent.CATEGORY_LAUNCHER);
|
intent.addCategory(Intent.CATEGORY_LAUNCHER);
|
||||||
PendingIntent contentIntent = PendingIntent.getActivity(ApplicationLoader.applicationContext, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
|
PendingIntent contentIntent = PendingIntent.getActivity(ApplicationLoader.applicationContext, 0, intent, PendingIntent.FLAG_MUTABLE | PendingIntent.FLAG_UPDATE_CURRENT);
|
||||||
|
|
||||||
rv.setPendingIntentTemplate(R.id.list_view, contentIntent);
|
rv.setPendingIntentTemplate(R.id.list_view, contentIntent);
|
||||||
appWidgetManager.updateAppWidget(appWidgetId, rv);
|
appWidgetManager.updateAppWidget(appWidgetId, rv);
|
||||||
|
|
|
@ -23,6 +23,8 @@ import android.widget.RemoteViewsService;
|
||||||
|
|
||||||
import androidx.collection.LongSparseArray;
|
import androidx.collection.LongSparseArray;
|
||||||
|
|
||||||
|
import com.google.android.exoplayer2.util.Log;
|
||||||
|
|
||||||
import org.telegram.tgnet.TLRPC;
|
import org.telegram.tgnet.TLRPC;
|
||||||
import org.telegram.ui.ActionBar.Theme;
|
import org.telegram.ui.ActionBar.Theme;
|
||||||
import org.telegram.ui.Components.AvatarDrawable;
|
import org.telegram.ui.Components.AvatarDrawable;
|
||||||
|
@ -350,6 +352,8 @@ class ChatsRemoteViewsFactory implements RemoteViewsService.RemoteViewsFactory {
|
||||||
fillInIntent.putExtras(extras);
|
fillInIntent.putExtras(extras);
|
||||||
rv.setOnClickFillInIntent(R.id.shortcut_widget_item, fillInIntent);
|
rv.setOnClickFillInIntent(R.id.shortcut_widget_item, fillInIntent);
|
||||||
|
|
||||||
|
Log.d("kek", "kek " + name);
|
||||||
|
|
||||||
rv.setViewVisibility(R.id.shortcut_widget_item_divider, position == getCount() ? View.GONE : View.VISIBLE);
|
rv.setViewVisibility(R.id.shortcut_widget_item_divider, position == getCount() ? View.GONE : View.VISIBLE);
|
||||||
|
|
||||||
return rv;
|
return rv;
|
||||||
|
|
|
@ -111,7 +111,7 @@ public class ContactsWidgetProvider extends AppWidgetProvider {
|
||||||
intent.setAction("com.tmessages.openchat" + Math.random() + Integer.MAX_VALUE);
|
intent.setAction("com.tmessages.openchat" + Math.random() + Integer.MAX_VALUE);
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||||
intent.addCategory(Intent.CATEGORY_LAUNCHER);
|
intent.addCategory(Intent.CATEGORY_LAUNCHER);
|
||||||
PendingIntent contentIntent = PendingIntent.getActivity(ApplicationLoader.applicationContext, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
|
PendingIntent contentIntent = PendingIntent.getActivity(ApplicationLoader.applicationContext, 0, intent, PendingIntent.FLAG_MUTABLE | PendingIntent.FLAG_UPDATE_CURRENT);
|
||||||
|
|
||||||
rv.setPendingIntentTemplate(R.id.list_view, contentIntent);
|
rv.setPendingIntentTemplate(R.id.list_view, contentIntent);
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,8 @@ import android.widget.RemoteViewsService;
|
||||||
|
|
||||||
import androidx.collection.LongSparseArray;
|
import androidx.collection.LongSparseArray;
|
||||||
|
|
||||||
|
import com.google.android.exoplayer2.util.Log;
|
||||||
|
|
||||||
import org.telegram.tgnet.TLRPC;
|
import org.telegram.tgnet.TLRPC;
|
||||||
import org.telegram.ui.ActionBar.Theme;
|
import org.telegram.ui.ActionBar.Theme;
|
||||||
import org.telegram.ui.Components.AvatarDrawable;
|
import org.telegram.ui.Components.AvatarDrawable;
|
||||||
|
@ -201,6 +203,8 @@ class ContactsRemoteViewsFactory implements RemoteViewsService.RemoteViewsFactor
|
||||||
}
|
}
|
||||||
extras.putInt("currentAccount", accountInstance.getCurrentAccount());
|
extras.putInt("currentAccount", accountInstance.getCurrentAccount());
|
||||||
|
|
||||||
|
Log.d("kek", "kek " + name);
|
||||||
|
|
||||||
Intent fillInIntent = new Intent();
|
Intent fillInIntent = new Intent();
|
||||||
fillInIntent.putExtras(extras);
|
fillInIntent.putExtras(extras);
|
||||||
rv.setOnClickFillInIntent(a == 0 ? R.id.contacts_widget_item1 : R.id.contacts_widget_item2, fillInIntent);
|
rv.setOnClickFillInIntent(a == 0 ? R.id.contacts_widget_item1 : R.id.contacts_widget_item2, fillInIntent);
|
||||||
|
|
|
@ -42,14 +42,14 @@ public class FeedWidgetProvider extends AppWidgetProvider {
|
||||||
intent2.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId);
|
intent2.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId);
|
||||||
intent2.setData(Uri.parse(intent2.toUri(Intent.URI_INTENT_SCHEME)));
|
intent2.setData(Uri.parse(intent2.toUri(Intent.URI_INTENT_SCHEME)));
|
||||||
RemoteViews rv = new RemoteViews(context.getPackageName(), R.layout.feed_widget_layout);
|
RemoteViews rv = new RemoteViews(context.getPackageName(), R.layout.feed_widget_layout);
|
||||||
rv.setRemoteAdapter(appWidgetId, R.id.list_view, intent2);
|
rv.setRemoteAdapter(R.id.list_view, intent2);
|
||||||
rv.setEmptyView(R.id.list_view, R.id.empty_view);
|
rv.setEmptyView(R.id.list_view, R.id.empty_view);
|
||||||
|
|
||||||
Intent intent = new Intent(ApplicationLoader.applicationContext, LaunchActivity.class);
|
Intent intent = new Intent(ApplicationLoader.applicationContext, LaunchActivity.class);
|
||||||
intent.setAction("com.tmessages.openchat" + Math.random() + Integer.MAX_VALUE);
|
intent.setAction("com.tmessages.openchat" + Math.random() + Integer.MAX_VALUE);
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||||
intent.addCategory(Intent.CATEGORY_LAUNCHER);
|
intent.addCategory(Intent.CATEGORY_LAUNCHER);
|
||||||
PendingIntent contentIntent = PendingIntent.getActivity(ApplicationLoader.applicationContext, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
|
PendingIntent contentIntent = PendingIntent.getActivity(ApplicationLoader.applicationContext, 0, intent, PendingIntent.FLAG_MUTABLE | PendingIntent.FLAG_UPDATE_CURRENT);
|
||||||
|
|
||||||
rv.setPendingIntentTemplate(R.id.list_view, contentIntent);
|
rv.setPendingIntentTemplate(R.id.list_view, contentIntent);
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,7 @@ import com.google.gson.FieldAttributes;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.GsonBuilder;
|
import com.google.gson.GsonBuilder;
|
||||||
|
|
||||||
|
import org.telegram.SQLite.SQLiteException;
|
||||||
import org.telegram.messenger.time.FastDateFormat;
|
import org.telegram.messenger.time.FastDateFormat;
|
||||||
import org.telegram.messenger.video.MediaCodecVideoConvertor;
|
import org.telegram.messenger.video.MediaCodecVideoConvertor;
|
||||||
import org.telegram.tgnet.TLObject;
|
import org.telegram.tgnet.TLObject;
|
||||||
|
@ -308,6 +309,9 @@ public class FileLog {
|
||||||
}
|
}
|
||||||
if (BuildVars.DEBUG_VERSION && needSent(e) && logToAppCenter) {
|
if (BuildVars.DEBUG_VERSION && needSent(e) && logToAppCenter) {
|
||||||
AndroidUtilities.appCenterLog(e);
|
AndroidUtilities.appCenterLog(e);
|
||||||
|
}
|
||||||
|
if (BuildVars.DEBUG_VERSION && e instanceof SQLiteException && e.getMessage() != null && e.getMessage().contains("disk image is malformed")) {
|
||||||
|
|
||||||
}
|
}
|
||||||
ensureInitied();
|
ensureInitied();
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
|
@ -140,7 +140,6 @@ public class FilePathDatabase {
|
||||||
|
|
||||||
CountDownLatch syncLatch = new CountDownLatch(1);
|
CountDownLatch syncLatch = new CountDownLatch(1);
|
||||||
String[] res = new String[1];
|
String[] res = new String[1];
|
||||||
long time = System.currentTimeMillis();
|
|
||||||
|
|
||||||
dispatchQueue.postRunnable(() -> {
|
dispatchQueue.postRunnable(() -> {
|
||||||
if (database != null) {
|
if (database != null) {
|
||||||
|
|
|
@ -132,7 +132,7 @@ public class LocationSharingService extends Service implements NotificationCente
|
||||||
Intent intent2 = new Intent(ApplicationLoader.applicationContext, LaunchActivity.class);
|
Intent intent2 = new Intent(ApplicationLoader.applicationContext, LaunchActivity.class);
|
||||||
intent2.setAction("org.tmessages.openlocations");
|
intent2.setAction("org.tmessages.openlocations");
|
||||||
intent2.addCategory(Intent.CATEGORY_LAUNCHER);
|
intent2.addCategory(Intent.CATEGORY_LAUNCHER);
|
||||||
PendingIntent contentIntent = PendingIntent.getActivity(ApplicationLoader.applicationContext, 0, intent2, 0);
|
PendingIntent contentIntent = PendingIntent.getActivity(ApplicationLoader.applicationContext, 0, intent2, PendingIntent.FLAG_MUTABLE);
|
||||||
|
|
||||||
builder = new NotificationCompat.Builder(ApplicationLoader.applicationContext);
|
builder = new NotificationCompat.Builder(ApplicationLoader.applicationContext);
|
||||||
builder.setWhen(System.currentTimeMillis());
|
builder.setWhen(System.currentTimeMillis());
|
||||||
|
@ -142,7 +142,7 @@ public class LocationSharingService extends Service implements NotificationCente
|
||||||
builder.setChannelId(NotificationsController.OTHER_NOTIFICATIONS_CHANNEL);
|
builder.setChannelId(NotificationsController.OTHER_NOTIFICATIONS_CHANNEL);
|
||||||
builder.setContentTitle(LocaleController.getString("AppName", R.string.AppName));
|
builder.setContentTitle(LocaleController.getString("AppName", R.string.AppName));
|
||||||
Intent stopIntent = new Intent(ApplicationLoader.applicationContext, StopLiveLocationReceiver.class);
|
Intent stopIntent = new Intent(ApplicationLoader.applicationContext, StopLiveLocationReceiver.class);
|
||||||
builder.addAction(0, LocaleController.getString("StopLiveLocation", R.string.StopLiveLocation), PendingIntent.getBroadcast(ApplicationLoader.applicationContext, 2, stopIntent, PendingIntent.FLAG_UPDATE_CURRENT));
|
builder.addAction(0, LocaleController.getString("StopLiveLocation", R.string.StopLiveLocation), PendingIntent.getBroadcast(ApplicationLoader.applicationContext, 2, stopIntent, PendingIntent.FLAG_MUTABLE | PendingIntent.FLAG_UPDATE_CURRENT));
|
||||||
}
|
}
|
||||||
|
|
||||||
updateNotification(false);
|
updateNotification(false);
|
||||||
|
|
|
@ -52,7 +52,6 @@ import android.provider.OpenableColumns;
|
||||||
import android.telephony.PhoneStateListener;
|
import android.telephony.PhoneStateListener;
|
||||||
import android.telephony.TelephonyManager;
|
import android.telephony.TelephonyManager;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
|
||||||
import android.util.SparseArray;
|
import android.util.SparseArray;
|
||||||
import android.view.HapticFeedbackConstants;
|
import android.view.HapticFeedbackConstants;
|
||||||
import android.view.TextureView;
|
import android.view.TextureView;
|
||||||
|
@ -5041,7 +5040,11 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
|
||||||
FileLog.e(e);
|
FileLog.e(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
retriever.release();
|
try {
|
||||||
|
retriever.release();
|
||||||
|
} catch (Throwable throwable) {
|
||||||
|
FileLog.e(throwable);
|
||||||
|
}
|
||||||
return bitrate;
|
return bitrate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -120,6 +120,7 @@ public class MessagesController extends BaseController implements NotificationCe
|
||||||
public LongSparseArray<SparseArray<Integer>> printingStringsTypes = new LongSparseArray<>();
|
public LongSparseArray<SparseArray<Integer>> printingStringsTypes = new LongSparseArray<>();
|
||||||
public LongSparseArray<SparseArray<Boolean>>[] sendingTypings = new LongSparseArray[12];
|
public LongSparseArray<SparseArray<Boolean>>[] sendingTypings = new LongSparseArray[12];
|
||||||
public ConcurrentHashMap<Long, Integer> onlinePrivacy = new ConcurrentHashMap<>(20, 1.0f, 2);
|
public ConcurrentHashMap<Long, Integer> onlinePrivacy = new ConcurrentHashMap<>(20, 1.0f, 2);
|
||||||
|
private LongSparseIntArray pendingUnreadCounter = new LongSparseIntArray();
|
||||||
private int lastPrintingStringCount;
|
private int lastPrintingStringCount;
|
||||||
|
|
||||||
private boolean dialogsInTransaction;
|
private boolean dialogsInTransaction;
|
||||||
|
@ -1331,6 +1332,7 @@ public class MessagesController extends BaseController implements NotificationCe
|
||||||
sendLoadPeersRequest(req3, requests, pinnedDialogs, pinnedRemoteDialogs, users, chats, filtersToSave, filtersToDelete, filtersOrder, filterDialogRemovals, filterUserRemovals, filtersUnreadCounterReset);
|
sendLoadPeersRequest(req3, requests, pinnedDialogs, pinnedRemoteDialogs, users, chats, filtersToSave, filtersToDelete, filtersOrder, filterDialogRemovals, filterUserRemovals, filtersUnreadCounterReset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//no
|
||||||
TLRPC.TL_messages_getPeerDialogs req4 = null;
|
TLRPC.TL_messages_getPeerDialogs req4 = null;
|
||||||
for (HashMap.Entry<Long, TLRPC.InputPeer> entry : dialogsToLoadMap.entrySet()) {
|
for (HashMap.Entry<Long, TLRPC.InputPeer> entry : dialogsToLoadMap.entrySet()) {
|
||||||
if (req4 == null) {
|
if (req4 == null) {
|
||||||
|
@ -4128,6 +4130,7 @@ public class MessagesController extends BaseController implements NotificationCe
|
||||||
if (did == 0 && (dialogs == null || dialogs.isEmpty())) {
|
if (did == 0 && (dialogs == null || dialogs.isEmpty())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
//probably
|
||||||
TLRPC.TL_messages_getPeerDialogs req = new TLRPC.TL_messages_getPeerDialogs();
|
TLRPC.TL_messages_getPeerDialogs req = new TLRPC.TL_messages_getPeerDialogs();
|
||||||
if (dialogs != null) {
|
if (dialogs != null) {
|
||||||
for (int a = 0; a < dialogs.size(); a++) {
|
for (int a = 0; a < dialogs.size(); a++) {
|
||||||
|
@ -6755,6 +6758,7 @@ public class MessagesController extends BaseController implements NotificationCe
|
||||||
chatsDict.put(c.id, c);
|
chatsDict.put(c.id, c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//no
|
||||||
TLRPC.TL_messages_getPeerDialogs req1 = new TLRPC.TL_messages_getPeerDialogs();
|
TLRPC.TL_messages_getPeerDialogs req1 = new TLRPC.TL_messages_getPeerDialogs();
|
||||||
TLRPC.TL_inputDialogPeer peer = new TLRPC.TL_inputDialogPeer();
|
TLRPC.TL_inputDialogPeer peer = new TLRPC.TL_inputDialogPeer();
|
||||||
if (res.peer.user_id != 0) {
|
if (res.peer.user_id != 0) {
|
||||||
|
@ -7352,6 +7356,7 @@ public class MessagesController extends BaseController implements NotificationCe
|
||||||
getConnectionsManager().bindRequestToGuid(reqId, classGuid);
|
getConnectionsManager().bindRequestToGuid(reqId, classGuid);
|
||||||
} else {
|
} else {
|
||||||
if (loadDialog && (load_type == 3 || load_type == 2) && last_message_id == 0) {
|
if (loadDialog && (load_type == 3 || load_type == 2) && last_message_id == 0) {
|
||||||
|
//probably--
|
||||||
TLRPC.TL_messages_getPeerDialogs req = new TLRPC.TL_messages_getPeerDialogs();
|
TLRPC.TL_messages_getPeerDialogs req = new TLRPC.TL_messages_getPeerDialogs();
|
||||||
TLRPC.InputPeer inputPeer = getInputPeer(dialogId);
|
TLRPC.InputPeer inputPeer = getInputPeer(dialogId);
|
||||||
TLRPC.TL_inputDialogPeer inputDialogPeer = new TLRPC.TL_inputDialogPeer();
|
TLRPC.TL_inputDialogPeer inputDialogPeer = new TLRPC.TL_inputDialogPeer();
|
||||||
|
@ -8118,6 +8123,7 @@ public class MessagesController extends BaseController implements NotificationCe
|
||||||
FileLog.d("load unknown dialog " + dialogId);
|
FileLog.d("load unknown dialog " + dialogId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//probably--
|
||||||
TLRPC.TL_messages_getPeerDialogs req = new TLRPC.TL_messages_getPeerDialogs();
|
TLRPC.TL_messages_getPeerDialogs req = new TLRPC.TL_messages_getPeerDialogs();
|
||||||
TLRPC.TL_inputDialogPeer inputDialogPeer = new TLRPC.TL_inputDialogPeer();
|
TLRPC.TL_inputDialogPeer inputDialogPeer = new TLRPC.TL_inputDialogPeer();
|
||||||
inputDialogPeer.peer = peer;
|
inputDialogPeer.peer = peer;
|
||||||
|
@ -9210,6 +9216,7 @@ public class MessagesController extends BaseController implements NotificationCe
|
||||||
if (BuildVars.DEBUG_PRIVATE_VERSION) {
|
if (BuildVars.DEBUG_PRIVATE_VERSION) {
|
||||||
FileLog.d("can't update dialog " + dialogId + " with new unread " + dialogsToUpdate.valueAt(a));
|
FileLog.d("can't update dialog " + dialogId + " with new unread " + dialogsToUpdate.valueAt(a));
|
||||||
}
|
}
|
||||||
|
pendingUnreadCounter.put(dialogId, dialogsToUpdate.valueAt(a));
|
||||||
}
|
}
|
||||||
if (currentDialog != null) {
|
if (currentDialog != null) {
|
||||||
int prevCount = currentDialog.unread_count;
|
int prevCount = currentDialog.unread_count;
|
||||||
|
@ -11262,6 +11269,7 @@ public class MessagesController extends BaseController implements NotificationCe
|
||||||
|
|
||||||
gettingUnknownChannels.put(channel.id, true);
|
gettingUnknownChannels.put(channel.id, true);
|
||||||
|
|
||||||
|
//no
|
||||||
TLRPC.TL_messages_getPeerDialogs req = new TLRPC.TL_messages_getPeerDialogs();
|
TLRPC.TL_messages_getPeerDialogs req = new TLRPC.TL_messages_getPeerDialogs();
|
||||||
TLRPC.TL_inputDialogPeer inputDialogPeer = new TLRPC.TL_inputDialogPeer();
|
TLRPC.TL_inputDialogPeer inputDialogPeer = new TLRPC.TL_inputDialogPeer();
|
||||||
inputDialogPeer.peer = inputPeer;
|
inputDialogPeer.peer = inputPeer;
|
||||||
|
@ -13196,8 +13204,8 @@ public class MessagesController extends BaseController implements NotificationCe
|
||||||
|
|
||||||
for (int c = 0, size3 = updates.size(); c < size3; c++) {
|
for (int c = 0, size3 = updates.size(); c < size3; c++) {
|
||||||
TLRPC.Update baseUpdate = updates.get(c);
|
TLRPC.Update baseUpdate = updates.get(c);
|
||||||
if (BuildVars.LOGS_ENABLED) {
|
if (BuildVars.LOGS_ENABLED && baseUpdate != null) {
|
||||||
FileLog.d("process update " + baseUpdate);
|
FileLog.d("process update " + baseUpdate.getClass().getSimpleName());
|
||||||
}
|
}
|
||||||
if (baseUpdate instanceof TLRPC.TL_updateNewMessage || baseUpdate instanceof TLRPC.TL_updateNewChannelMessage || baseUpdate instanceof TLRPC.TL_updateNewScheduledMessage) {
|
if (baseUpdate instanceof TLRPC.TL_updateNewMessage || baseUpdate instanceof TLRPC.TL_updateNewChannelMessage || baseUpdate instanceof TLRPC.TL_updateNewScheduledMessage) {
|
||||||
TLRPC.Message message;
|
TLRPC.Message message;
|
||||||
|
@ -15553,6 +15561,7 @@ public class MessagesController extends BaseController implements NotificationCe
|
||||||
}
|
}
|
||||||
if (needReload) {
|
if (needReload) {
|
||||||
if (topicId == 0) {
|
if (topicId == 0) {
|
||||||
|
//no
|
||||||
TLRPC.TL_messages_getPeerDialogs req = new TLRPC.TL_messages_getPeerDialogs();
|
TLRPC.TL_messages_getPeerDialogs req = new TLRPC.TL_messages_getPeerDialogs();
|
||||||
TLRPC.TL_inputDialogPeer inputDialogPeer = new TLRPC.TL_inputDialogPeer();
|
TLRPC.TL_inputDialogPeer inputDialogPeer = new TLRPC.TL_inputDialogPeer();
|
||||||
inputDialogPeer.peer = getInputPeer(dialogId);
|
inputDialogPeer.peer = getInputPeer(dialogId);
|
||||||
|
@ -16009,11 +16018,27 @@ public class MessagesController extends BaseController implements NotificationCe
|
||||||
if (BuildVars.LOGS_ENABLED) {
|
if (BuildVars.LOGS_ENABLED) {
|
||||||
FileLog.d("not found dialog with id " + dialogId + " dictCount = " + dialogs_dict.size() + " allCount = " + allDialogs.size());
|
FileLog.d("not found dialog with id " + dialogId + " dictCount = " + dialogs_dict.size() + " allCount = " + allDialogs.size());
|
||||||
}
|
}
|
||||||
|
boolean filterDialogsChanged = false;
|
||||||
dialog = new TLRPC.TL_dialog();
|
dialog = new TLRPC.TL_dialog();
|
||||||
dialog.id = dialogId;
|
dialog.id = dialogId;
|
||||||
int mid = dialog.top_message = lastMessage.getId();
|
int mid = dialog.top_message = lastMessage.getId();
|
||||||
dialog.last_message_date = lastMessage.messageOwner.date;
|
dialog.last_message_date = lastMessage.messageOwner.date;
|
||||||
dialog.flags = ChatObject.isChannel(chat) ? 1 : 0;
|
dialog.flags = ChatObject.isChannel(chat) ? 1 : 0;
|
||||||
|
if (pendingUnreadCounter.get(dialogId, 0) > 0) {
|
||||||
|
dialog.unread_count = pendingUnreadCounter.get(dialogId);
|
||||||
|
pendingUnreadCounter.delete(dialogId);
|
||||||
|
if (!isDialogMuted(dialogId, 0)) {
|
||||||
|
unreadUnmutedDialogs++;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int b = 0; b < selectedDialogFilter.length; b++) {
|
||||||
|
if (selectedDialogFilter[b] != null && (selectedDialogFilter[b].flags & DIALOG_FILTER_FLAG_EXCLUDE_READ) != 0) {
|
||||||
|
filterDialogsChanged = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
dialogs_dict.put(dialogId, dialog);
|
dialogs_dict.put(dialogId, dialog);
|
||||||
allDialogs.add(dialog);
|
allDialogs.add(dialog);
|
||||||
ArrayList<MessageObject> arrayList = new ArrayList<MessageObject>();
|
ArrayList<MessageObject> arrayList = new ArrayList<MessageObject>();
|
||||||
|
@ -16032,6 +16057,10 @@ public class MessagesController extends BaseController implements NotificationCe
|
||||||
dialogMessage.put(dialogId, arrayList);
|
dialogMessage.put(dialogId, arrayList);
|
||||||
changed = true;
|
changed = true;
|
||||||
|
|
||||||
|
if (filterDialogsChanged) {
|
||||||
|
sortDialogs(null);
|
||||||
|
getNotificationCenter().postNotificationName(NotificationCenter.dialogsNeedReload);
|
||||||
|
}
|
||||||
TLRPC.Dialog dialogFinal = dialog;
|
TLRPC.Dialog dialogFinal = dialog;
|
||||||
getMessagesStorage().getDialogFolderId(dialogId, param -> {
|
getMessagesStorage().getDialogFolderId(dialogId, param -> {
|
||||||
if (param != -1) {
|
if (param != -1) {
|
||||||
|
|
|
@ -2630,6 +2630,38 @@ public class MessagesStorage extends BaseController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cursor2.dispose();
|
||||||
|
if (!topMessageIds.isEmpty()) {
|
||||||
|
cursor2 = database.queryFinalized("SELECT mid, data FROM messages_topics WHERE uid = " + dialogId + " AND mid IN (" + TextUtils.join(",", topMessageIds) + ")");
|
||||||
|
try {
|
||||||
|
while (cursor2.next()) {
|
||||||
|
int messageId = cursor2.intValue(0);
|
||||||
|
NativeByteBuffer data = cursor2.byteBufferValue(1);
|
||||||
|
if (data != null) {
|
||||||
|
TLRPC.Message message = TLRPC.Message.TLdeserialize(data, data.readInt32(false), false);
|
||||||
|
if (message != null) {
|
||||||
|
message.readAttachPath(data, UserConfig.getInstance(currentAccount).clientUserId);
|
||||||
|
}
|
||||||
|
data.reuse();
|
||||||
|
|
||||||
|
topMessageIds.remove(messageId);
|
||||||
|
addUsersAndChatsFromMessage(message, usersToLoad, chatsToLoad, null);
|
||||||
|
|
||||||
|
ArrayList<TLRPC.TL_forumTopic> topicsList = topicsByTopMessageId.get(messageId);
|
||||||
|
if (topicsList != null) {
|
||||||
|
for (int i = 0; i < topicsList.size(); i++) {
|
||||||
|
topicsList.get(i).topMessage = message;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
FileLog.e(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
loadReplyMessages(replyMessageOwners, dialogReplyMessagesIds, usersToLoad, chatsToLoad, false);
|
||||||
|
|
||||||
ArrayList<TLRPC.Chat> chats = new ArrayList<>();
|
ArrayList<TLRPC.Chat> chats = new ArrayList<>();
|
||||||
ArrayList<TLRPC.User> users = new ArrayList<>();
|
ArrayList<TLRPC.User> users = new ArrayList<>();
|
||||||
if (!chatsToLoad.isEmpty()) {
|
if (!chatsToLoad.isEmpty()) {
|
||||||
|
@ -2648,35 +2680,6 @@ public class MessagesStorage extends BaseController {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
cursor2.dispose();
|
|
||||||
if (!topMessageIds.isEmpty()) {
|
|
||||||
cursor2 = database.queryFinalized("SELECT mid, data FROM messages_topics WHERE uid = " + dialogId + " AND mid IN (" + TextUtils.join(",", topMessageIds) + ")");
|
|
||||||
try {
|
|
||||||
while (cursor2.next()) {
|
|
||||||
int messageId = cursor2.intValue(0);
|
|
||||||
NativeByteBuffer data = cursor2.byteBufferValue(1);
|
|
||||||
if (data != null) {
|
|
||||||
TLRPC.Message message = TLRPC.Message.TLdeserialize(data, data.readInt32(false), false);
|
|
||||||
if (message != null) {
|
|
||||||
message.readAttachPath(data, UserConfig.getInstance(currentAccount).clientUserId);
|
|
||||||
}
|
|
||||||
data.reuse();
|
|
||||||
|
|
||||||
topMessageIds.remove(messageId);
|
|
||||||
ArrayList<TLRPC.TL_forumTopic> topicsList = topicsByTopMessageId.get(messageId);
|
|
||||||
if (topicsList != null) {
|
|
||||||
for (int i = 0; i < topicsList.size(); i++) {
|
|
||||||
topicsList.get(i).topMessage = message;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
FileLog.e(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
loadReplyMessages(replyMessageOwners, dialogReplyMessagesIds, usersToLoad, chatsToLoad, false);
|
|
||||||
loadGroupedMessagesForTopics(dialogId, topics);
|
loadGroupedMessagesForTopics(dialogId, topics);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10190,6 +10193,7 @@ public class MessagesStorage extends BaseController {
|
||||||
private int malformedCleanupCount = 0;
|
private int malformedCleanupCount = 0;
|
||||||
public void checkMalformed(Exception e) {
|
public void checkMalformed(Exception e) {
|
||||||
if (e != null && e.getMessage() != null && e.getMessage().contains("malformed") && malformedCleanupCount < 3) {
|
if (e != null && e.getMessage() != null && e.getMessage().contains("malformed") && malformedCleanupCount < 3) {
|
||||||
|
FileLog.e("detected database malformed error, cleaning up...");
|
||||||
malformedCleanupCount++;
|
malformedCleanupCount++;
|
||||||
cleanup(false);
|
cleanup(false);
|
||||||
}
|
}
|
||||||
|
@ -10238,6 +10242,7 @@ public class MessagesStorage extends BaseController {
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
FileLog.e(e);
|
FileLog.e(e);
|
||||||
|
checkMalformed(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cursor.dispose();
|
cursor.dispose();
|
||||||
|
@ -10812,23 +10817,44 @@ public class MessagesStorage extends BaseController {
|
||||||
cursor = null;
|
cursor = null;
|
||||||
|
|
||||||
database.executeFast(String.format(Locale.US, "UPDATE messages_topics SET read_state = read_state | 1 WHERE uid = %d AND topic_id = %d AND mid <= %d AND read_state IN(0,2) AND out = 0", -chatId, mid, readMaxId)).stepThis().dispose();
|
database.executeFast(String.format(Locale.US, "UPDATE messages_topics SET read_state = read_state | 1 WHERE uid = %d AND topic_id = %d AND mid <= %d AND read_state IN(0,2) AND out = 0", -chatId, mid, readMaxId)).stepThis().dispose();
|
||||||
|
//mark mentions as read
|
||||||
|
database.executeFast(String.format(Locale.US, "UPDATE messages_topics SET read_state = read_state | 2 WHERE uid = %d AND topic_id = %d AND mid <= %d AND read_state IN(0,1) AND out = 0", -chatId, mid, readMaxId)).stepThis().dispose();
|
||||||
|
|
||||||
|
int unreadMentionsCount = -1;
|
||||||
if (unreadCount < 0) {
|
if (unreadCount < 0) {
|
||||||
unreadCount = 0;
|
unreadCount = 0;
|
||||||
cursor = database.queryFinalized(String.format(Locale.US, "SELECT count(mid) FROM messages_topics WHERE uid = %d AND topic_id = %d AND mid > %d AND read_state IN(0,2) AND out = 0", -chatId, mid, readMaxId));
|
cursor = database.queryFinalized(String.format(Locale.US, "SELECT count(mid) FROM messages_topics WHERE uid = %d AND topic_id = %d AND mid > %d AND read_state IN(0,2) AND out = 0", -chatId, mid, readMaxId));
|
||||||
if (cursor.next()) {
|
if (cursor.next()) {
|
||||||
unreadCount = cursor.intValue(0);
|
unreadCount = cursor.intValue(0);
|
||||||
}
|
}
|
||||||
cursor.dispose();
|
cursor.dispose();
|
||||||
cursor = null;
|
cursor = null;
|
||||||
|
if (unreadCount == 0) {
|
||||||
|
unreadMentionsCount = 0;
|
||||||
|
} else {
|
||||||
|
cursor = database.queryFinalized(String.format(Locale.US, "SELECT count(mid) FROM messages_topics WHERE uid = %d AND topic_id = %d AND mid > %d AND read_state < 2 AND out = 0", -chatId, mid, readMaxId));
|
||||||
|
if (cursor.next()) {
|
||||||
|
unreadMentionsCount = cursor.intValue(0);
|
||||||
|
}
|
||||||
|
cursor.dispose();
|
||||||
|
cursor = null;
|
||||||
|
}
|
||||||
|
} else if (unreadCount == 0) {
|
||||||
|
unreadMentionsCount = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (updateTopic) {
|
if (updateTopic) {
|
||||||
database.executeFast(String.format(Locale.ENGLISH, "UPDATE topics SET max_read_id = %d, unread_count = %d WHERE did = %d AND topic_id = %d", readMaxId, unreadCount, -chatId, mid)).stepThis().dispose();
|
if (unreadMentionsCount >= 0) {
|
||||||
|
database.executeFast(String.format(Locale.ENGLISH, "UPDATE topics SET max_read_id = %d, unread_count = %d, unread_mentions = %d WHERE did = %d AND topic_id = %d", readMaxId, unreadCount, unreadMentionsCount, -chatId, mid)).stepThis().dispose();
|
||||||
|
} else {
|
||||||
|
database.executeFast(String.format(Locale.ENGLISH, "UPDATE topics SET max_read_id = %d, unread_count = %d WHERE did = %d AND topic_id = %d", readMaxId, unreadCount, -chatId, mid)).stepThis().dispose();
|
||||||
|
}
|
||||||
|
|
||||||
int finalUnreadCount = unreadCount;
|
int finalUnreadCount = unreadCount;
|
||||||
|
int finalUnreadMentionsCount = unreadMentionsCount;
|
||||||
AndroidUtilities.runOnUIThread(() -> {
|
AndroidUtilities.runOnUIThread(() -> {
|
||||||
getMessagesController().getTopicsController().updateMaxReadId(chatId, mid, readMaxId, finalUnreadCount);
|
getMessagesController().getTopicsController().updateMaxReadId(chatId, mid, readMaxId, finalUnreadCount, finalUnreadMentionsCount);
|
||||||
});
|
});
|
||||||
|
|
||||||
resetForumBadgeIfNeed(-chatId);
|
resetForumBadgeIfNeed(-chatId);
|
||||||
|
@ -15017,6 +15043,7 @@ public class MessagesStorage extends BaseController {
|
||||||
encryptedChats.clear();
|
encryptedChats.clear();
|
||||||
FileLog.e(e);
|
FileLog.e(e);
|
||||||
getMessagesController().processLoadedDialogs(dialogs, encryptedChats, folderId, 0, 100, 1, true, false, true);
|
getMessagesController().processLoadedDialogs(dialogs, encryptedChats, folderId, 0, 100, 1, true, false, true);
|
||||||
|
checkMalformed(e);
|
||||||
} finally {
|
} finally {
|
||||||
if (cursor != null) {
|
if (cursor != null) {
|
||||||
cursor.dispose();
|
cursor.dispose();
|
||||||
|
|
|
@ -97,7 +97,7 @@ public class MusicBrowserService extends MediaBrowserService implements Notifica
|
||||||
|
|
||||||
Context context = getApplicationContext();
|
Context context = getApplicationContext();
|
||||||
Intent intent = new Intent(context, LaunchActivity.class);
|
Intent intent = new Intent(context, LaunchActivity.class);
|
||||||
PendingIntent pi = PendingIntent.getActivity(context, 99, intent, PendingIntent.FLAG_UPDATE_CURRENT);
|
PendingIntent pi = PendingIntent.getActivity(context, 99, intent, PendingIntent.FLAG_MUTABLE | PendingIntent.FLAG_UPDATE_CURRENT);
|
||||||
mediaSession.setSessionActivity(pi);
|
mediaSession.setSessionActivity(pi);
|
||||||
|
|
||||||
Bundle extras = new Bundle();
|
Bundle extras = new Bundle();
|
||||||
|
|
|
@ -172,7 +172,7 @@ public class MusicPlayerService extends Service implements NotificationCenter.No
|
||||||
audioManager.registerMediaButtonEventReceiver(remoteComponentName);
|
audioManager.registerMediaButtonEventReceiver(remoteComponentName);
|
||||||
Intent mediaButtonIntent = new Intent(Intent.ACTION_MEDIA_BUTTON);
|
Intent mediaButtonIntent = new Intent(Intent.ACTION_MEDIA_BUTTON);
|
||||||
mediaButtonIntent.setComponent(remoteComponentName);
|
mediaButtonIntent.setComponent(remoteComponentName);
|
||||||
PendingIntent mediaPendingIntent = PendingIntent.getBroadcast(this, 0, mediaButtonIntent, 0);
|
PendingIntent mediaPendingIntent = PendingIntent.getBroadcast(this, 0, mediaButtonIntent, PendingIntent.FLAG_MUTABLE);
|
||||||
remoteControlClient = new RemoteControlClient(mediaPendingIntent);
|
remoteControlClient = new RemoteControlClient(mediaPendingIntent);
|
||||||
audioManager.registerRemoteControlClient(remoteControlClient);
|
audioManager.registerRemoteControlClient(remoteControlClient);
|
||||||
}
|
}
|
||||||
|
@ -219,7 +219,7 @@ public class MusicPlayerService extends Service implements NotificationCenter.No
|
||||||
Intent intent = new Intent(ApplicationLoader.applicationContext, LaunchActivity.class);
|
Intent intent = new Intent(ApplicationLoader.applicationContext, LaunchActivity.class);
|
||||||
intent.setAction("com.tmessages.openplayer");
|
intent.setAction("com.tmessages.openplayer");
|
||||||
intent.addCategory(Intent.CATEGORY_LAUNCHER);
|
intent.addCategory(Intent.CATEGORY_LAUNCHER);
|
||||||
PendingIntent contentIntent = PendingIntent.getActivity(ApplicationLoader.applicationContext, 0, intent, 0);
|
PendingIntent contentIntent = PendingIntent.getActivity(ApplicationLoader.applicationContext, 0, intent, PendingIntent.FLAG_MUTABLE);
|
||||||
|
|
||||||
Notification notification;
|
Notification notification;
|
||||||
|
|
||||||
|
@ -246,12 +246,12 @@ public class MusicPlayerService extends Service implements NotificationCenter.No
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||||
boolean isPlaying = !MediaController.getInstance().isMessagePaused();
|
boolean isPlaying = !MediaController.getInstance().isMessagePaused();
|
||||||
|
|
||||||
PendingIntent pendingPrev = PendingIntent.getBroadcast(getApplicationContext(), 0, new Intent(NOTIFY_PREVIOUS).setComponent(new ComponentName(this, MusicPlayerReceiver.class)), PendingIntent.FLAG_CANCEL_CURRENT);
|
PendingIntent pendingPrev = PendingIntent.getBroadcast(getApplicationContext(), 0, new Intent(NOTIFY_PREVIOUS).setComponent(new ComponentName(this, MusicPlayerReceiver.class)), PendingIntent.FLAG_MUTABLE | PendingIntent.FLAG_CANCEL_CURRENT);
|
||||||
//PendingIntent pendingStop = PendingIntent.getBroadcast(getApplicationContext(), 0, new Intent(NOTIFY_CLOSE).setComponent(new ComponentName(this, MusicPlayerReceiver.class)), PendingIntent.FLAG_CANCEL_CURRENT);
|
//PendingIntent pendingStop = PendingIntent.getBroadcast(getApplicationContext(), 0, new Intent(NOTIFY_CLOSE).setComponent(new ComponentName(this, MusicPlayerReceiver.class)), PendingIntent.FLAG_CANCEL_CURRENT);
|
||||||
PendingIntent pendingStop = PendingIntent.getService(getApplicationContext(), 0, new Intent(this, getClass()).setAction(getPackageName() + ".STOP_PLAYER"), PendingIntent.FLAG_CANCEL_CURRENT);
|
PendingIntent pendingStop = PendingIntent.getService(getApplicationContext(), 0, new Intent(this, getClass()).setAction(getPackageName() + ".STOP_PLAYER"), PendingIntent.FLAG_MUTABLE | PendingIntent.FLAG_CANCEL_CURRENT);
|
||||||
PendingIntent pendingPlaypause = PendingIntent.getBroadcast(getApplicationContext(), 0, new Intent(isPlaying ? NOTIFY_PAUSE : NOTIFY_PLAY).setComponent(new ComponentName(this, MusicPlayerReceiver.class)), PendingIntent.FLAG_CANCEL_CURRENT);
|
PendingIntent pendingPlaypause = PendingIntent.getBroadcast(getApplicationContext(), 0, new Intent(isPlaying ? NOTIFY_PAUSE : NOTIFY_PLAY).setComponent(new ComponentName(this, MusicPlayerReceiver.class)), PendingIntent.FLAG_MUTABLE | PendingIntent.FLAG_CANCEL_CURRENT);
|
||||||
PendingIntent pendingNext = PendingIntent.getBroadcast(getApplicationContext(), 0, new Intent(NOTIFY_NEXT).setComponent(new ComponentName(this, MusicPlayerReceiver.class)), PendingIntent.FLAG_CANCEL_CURRENT);
|
PendingIntent pendingNext = PendingIntent.getBroadcast(getApplicationContext(), 0, new Intent(NOTIFY_NEXT).setComponent(new ComponentName(this, MusicPlayerReceiver.class)), PendingIntent.FLAG_MUTABLE | PendingIntent.FLAG_CANCEL_CURRENT);
|
||||||
PendingIntent pendingSeek = PendingIntent.getBroadcast(getApplicationContext(), 0, new Intent(NOTIFY_SEEK).setComponent(new ComponentName(this, MusicPlayerReceiver.class)), PendingIntent.FLAG_CANCEL_CURRENT);
|
PendingIntent pendingSeek = PendingIntent.getBroadcast(getApplicationContext(), 0, new Intent(NOTIFY_SEEK).setComponent(new ComponentName(this, MusicPlayerReceiver.class)), PendingIntent.FLAG_MUTABLE | PendingIntent.FLAG_CANCEL_CURRENT);
|
||||||
|
|
||||||
Notification.Builder bldr = new Notification.Builder(this);
|
Notification.Builder bldr = new Notification.Builder(this);
|
||||||
bldr.setSmallIcon(R.drawable.player)
|
bldr.setSmallIcon(R.drawable.player)
|
||||||
|
@ -480,15 +480,15 @@ public class MusicPlayerService extends Service implements NotificationCenter.No
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setListeners(RemoteViews view) {
|
public void setListeners(RemoteViews view) {
|
||||||
PendingIntent pendingIntent = PendingIntent.getBroadcast(getApplicationContext(), 0, new Intent(NOTIFY_PREVIOUS), PendingIntent.FLAG_UPDATE_CURRENT);
|
PendingIntent pendingIntent = PendingIntent.getBroadcast(getApplicationContext(), 0, new Intent(NOTIFY_PREVIOUS), PendingIntent.FLAG_MUTABLE | PendingIntent.FLAG_UPDATE_CURRENT);
|
||||||
view.setOnClickPendingIntent(R.id.player_previous, pendingIntent);
|
view.setOnClickPendingIntent(R.id.player_previous, pendingIntent);
|
||||||
pendingIntent = PendingIntent.getBroadcast(getApplicationContext(), 0, new Intent(NOTIFY_CLOSE), PendingIntent.FLAG_UPDATE_CURRENT);
|
pendingIntent = PendingIntent.getBroadcast(getApplicationContext(), 0, new Intent(NOTIFY_CLOSE), PendingIntent.FLAG_MUTABLE | PendingIntent.FLAG_UPDATE_CURRENT);
|
||||||
view.setOnClickPendingIntent(R.id.player_close, pendingIntent);
|
view.setOnClickPendingIntent(R.id.player_close, pendingIntent);
|
||||||
pendingIntent = PendingIntent.getBroadcast(getApplicationContext(), 0, new Intent(NOTIFY_PAUSE), PendingIntent.FLAG_UPDATE_CURRENT);
|
pendingIntent = PendingIntent.getBroadcast(getApplicationContext(), 0, new Intent(NOTIFY_PAUSE), PendingIntent.FLAG_MUTABLE | PendingIntent.FLAG_UPDATE_CURRENT);
|
||||||
view.setOnClickPendingIntent(R.id.player_pause, pendingIntent);
|
view.setOnClickPendingIntent(R.id.player_pause, pendingIntent);
|
||||||
pendingIntent = PendingIntent.getBroadcast(getApplicationContext(), 0, new Intent(NOTIFY_NEXT), PendingIntent.FLAG_UPDATE_CURRENT);
|
pendingIntent = PendingIntent.getBroadcast(getApplicationContext(), 0, new Intent(NOTIFY_NEXT), PendingIntent.FLAG_MUTABLE | PendingIntent.FLAG_UPDATE_CURRENT);
|
||||||
view.setOnClickPendingIntent(R.id.player_next, pendingIntent);
|
view.setOnClickPendingIntent(R.id.player_next, pendingIntent);
|
||||||
pendingIntent = PendingIntent.getBroadcast(getApplicationContext(), 0, new Intent(NOTIFY_PLAY), PendingIntent.FLAG_UPDATE_CURRENT);
|
pendingIntent = PendingIntent.getBroadcast(getApplicationContext(), 0, new Intent(NOTIFY_PLAY), PendingIntent.FLAG_MUTABLE | PendingIntent.FLAG_UPDATE_CURRENT);
|
||||||
view.setOnClickPendingIntent(R.id.player_play, pendingIntent);
|
view.setOnClickPendingIntent(R.id.player_play, pendingIntent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -55,6 +55,8 @@ import androidx.core.content.pm.ShortcutInfoCompat;
|
||||||
import androidx.core.content.pm.ShortcutManagerCompat;
|
import androidx.core.content.pm.ShortcutManagerCompat;
|
||||||
import androidx.core.graphics.drawable.IconCompat;
|
import androidx.core.graphics.drawable.IconCompat;
|
||||||
|
|
||||||
|
import com.google.android.exoplayer2.util.Log;
|
||||||
|
|
||||||
import org.telegram.messenger.support.LongSparseIntArray;
|
import org.telegram.messenger.support.LongSparseIntArray;
|
||||||
import org.telegram.tgnet.ConnectionsManager;
|
import org.telegram.tgnet.ConnectionsManager;
|
||||||
import org.telegram.tgnet.TLRPC;
|
import org.telegram.tgnet.TLRPC;
|
||||||
|
@ -65,6 +67,7 @@ import org.telegram.ui.PopupNotificationActivity;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -470,8 +473,13 @@ public class NotificationsController extends BaseController {
|
||||||
smartNotificationsDialogs.remove(dialogId);
|
smartNotificationsDialogs.remove(dialogId);
|
||||||
}
|
}
|
||||||
if (!newCount.equals(currentCount)) {
|
if (!newCount.equals(currentCount)) {
|
||||||
total_unread_count -= currentCount;
|
if (getMessagesController().isForum(dialogId)) {
|
||||||
total_unread_count += newCount;
|
total_unread_count -= currentCount > 0 ? 1 : 0;
|
||||||
|
total_unread_count += newCount > 0 ? 1 : 0;
|
||||||
|
} else {
|
||||||
|
total_unread_count -= currentCount;
|
||||||
|
total_unread_count += newCount;
|
||||||
|
}
|
||||||
pushDialogs.put(dialogId, newCount);
|
pushDialogs.put(dialogId, newCount);
|
||||||
}
|
}
|
||||||
if (newCount == 0) {
|
if (newCount == 0) {
|
||||||
|
@ -562,8 +570,13 @@ public class NotificationsController extends BaseController {
|
||||||
smartNotificationsDialogs.remove(dialogId);
|
smartNotificationsDialogs.remove(dialogId);
|
||||||
}
|
}
|
||||||
if (!newCount.equals(currentCount)) {
|
if (!newCount.equals(currentCount)) {
|
||||||
total_unread_count -= currentCount;
|
if (getMessagesController().isForum(dialogId)) {
|
||||||
total_unread_count += newCount;
|
total_unread_count -= currentCount > 0 ? 1 : 0;
|
||||||
|
total_unread_count += newCount > 0 ? 1 : 0;
|
||||||
|
} else {
|
||||||
|
total_unread_count -= currentCount;
|
||||||
|
total_unread_count += newCount;
|
||||||
|
}
|
||||||
pushDialogs.put(dialogId, newCount);
|
pushDialogs.put(dialogId, newCount);
|
||||||
}
|
}
|
||||||
if (newCount == 0) {
|
if (newCount == 0) {
|
||||||
|
@ -967,10 +980,15 @@ public class NotificationsController extends BaseController {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (canAddValue) {
|
if (canAddValue) {
|
||||||
if (currentCount != null) {
|
if (getMessagesController().isForum(dialog_id)) {
|
||||||
total_unread_count -= currentCount;
|
total_unread_count -= currentCount != null && currentCount > 0 ? 1 : 0;
|
||||||
|
total_unread_count += newCount > 0 ? 1 : 0;
|
||||||
|
} else {
|
||||||
|
if (currentCount != null) {
|
||||||
|
total_unread_count -= currentCount;
|
||||||
|
}
|
||||||
|
total_unread_count += newCount;
|
||||||
}
|
}
|
||||||
total_unread_count += newCount;
|
|
||||||
pushDialogs.put(dialog_id, newCount);
|
pushDialogs.put(dialog_id, newCount);
|
||||||
}
|
}
|
||||||
if (old_unread_count != total_unread_count) {
|
if (old_unread_count != total_unread_count) {
|
||||||
|
@ -1051,7 +1069,11 @@ public class NotificationsController extends BaseController {
|
||||||
}
|
}
|
||||||
if (canAddValue || newCount == 0) {
|
if (canAddValue || newCount == 0) {
|
||||||
if (currentCount != null) {
|
if (currentCount != null) {
|
||||||
total_unread_count -= currentCount;
|
if (getMessagesController().isForum(dialogId)) {
|
||||||
|
total_unread_count -= currentCount > 0 ? 1 : 0;
|
||||||
|
} else {
|
||||||
|
total_unread_count -= currentCount;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (newCount == 0) {
|
if (newCount == 0) {
|
||||||
|
@ -1083,7 +1105,11 @@ public class NotificationsController extends BaseController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (canAddValue) {
|
} else if (canAddValue) {
|
||||||
total_unread_count += newCount;
|
if (getMessagesController().isForum(dialogId)) {
|
||||||
|
total_unread_count += newCount > 0 ? 1 : 0;
|
||||||
|
} else {
|
||||||
|
total_unread_count += newCount;
|
||||||
|
}
|
||||||
pushDialogs.put(dialogId, newCount);
|
pushDialogs.put(dialogId, newCount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1209,7 +1235,11 @@ public class NotificationsController extends BaseController {
|
||||||
}
|
}
|
||||||
int count = dialogs.valueAt(a);
|
int count = dialogs.valueAt(a);
|
||||||
pushDialogs.put(dialog_id, count);
|
pushDialogs.put(dialog_id, count);
|
||||||
total_unread_count += count;
|
if (getMessagesController().isForum(dialog_id)) {
|
||||||
|
total_unread_count += count > 0 ? 1 : 0;
|
||||||
|
} else {
|
||||||
|
total_unread_count += count;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (push != null) {
|
if (push != null) {
|
||||||
|
@ -1270,10 +1300,17 @@ public class NotificationsController extends BaseController {
|
||||||
Integer currentCount = pushDialogs.get(dialogId);
|
Integer currentCount = pushDialogs.get(dialogId);
|
||||||
int newCount = currentCount != null ? currentCount + 1 : 1;
|
int newCount = currentCount != null ? currentCount + 1 : 1;
|
||||||
|
|
||||||
if (currentCount != null) {
|
if (getMessagesController().isForum(dialogId)) {
|
||||||
total_unread_count -= currentCount;
|
if (currentCount != null) {
|
||||||
|
total_unread_count -= currentCount > 0 ? 1 : 0;
|
||||||
|
}
|
||||||
|
total_unread_count += newCount > 0 ? 1 : 0;
|
||||||
|
} else {
|
||||||
|
if (currentCount != null) {
|
||||||
|
total_unread_count -= currentCount;
|
||||||
|
}
|
||||||
|
total_unread_count += newCount;
|
||||||
}
|
}
|
||||||
total_unread_count += newCount;
|
|
||||||
pushDialogs.put(dialogId, newCount);
|
pushDialogs.put(dialogId, newCount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1313,8 +1350,8 @@ public class NotificationsController extends BaseController {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (dialog != null && dialog.unread_count != 0) {
|
if (dialog != null) {
|
||||||
count += dialog.unread_count;
|
count += MessagesController.getInstance(a).getDialogUnreadCount(dialog);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -1334,7 +1371,7 @@ public class NotificationsController extends BaseController {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (dialog.unread_count != 0) {
|
if (MessagesController.getInstance(a).getDialogUnreadCount(dialog) != 0) {
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2608,7 +2645,7 @@ public class NotificationsController extends BaseController {
|
||||||
try {
|
try {
|
||||||
Intent intent = new Intent(ApplicationLoader.applicationContext, NotificationRepeat.class);
|
Intent intent = new Intent(ApplicationLoader.applicationContext, NotificationRepeat.class);
|
||||||
intent.putExtra("currentAccount", currentAccount);
|
intent.putExtra("currentAccount", currentAccount);
|
||||||
PendingIntent pintent = PendingIntent.getService(ApplicationLoader.applicationContext, 0, intent, 0);
|
PendingIntent pintent = PendingIntent.getService(ApplicationLoader.applicationContext, 0, intent, PendingIntent.FLAG_MUTABLE);
|
||||||
SharedPreferences preferences = getAccountInstance().getNotificationsSettings();
|
SharedPreferences preferences = getAccountInstance().getNotificationsSettings();
|
||||||
int minutes = preferences.getInt("repeat_messages", 60);
|
int minutes = preferences.getInt("repeat_messages", 60);
|
||||||
if (minutes > 0 && personalCount > 0) {
|
if (minutes > 0 && personalCount > 0) {
|
||||||
|
@ -2990,7 +3027,7 @@ public class NotificationsController extends BaseController {
|
||||||
}
|
}
|
||||||
NotificationCompat.BubbleMetadata.Builder bubbleBuilder =
|
NotificationCompat.BubbleMetadata.Builder bubbleBuilder =
|
||||||
new NotificationCompat.BubbleMetadata.Builder(
|
new NotificationCompat.BubbleMetadata.Builder(
|
||||||
PendingIntent.getActivity(ApplicationLoader.applicationContext, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT),
|
PendingIntent.getActivity(ApplicationLoader.applicationContext, 0, intent, PendingIntent.FLAG_MUTABLE | PendingIntent.FLAG_UPDATE_CURRENT),
|
||||||
icon);
|
icon);
|
||||||
bubbleBuilder.setSuppressNotification(openedDialogId == did);
|
bubbleBuilder.setSuppressNotification(openedDialogId == did);
|
||||||
bubbleBuilder.setAutoExpandBubble(false);
|
bubbleBuilder.setAutoExpandBubble(false);
|
||||||
|
@ -3737,7 +3774,7 @@ public class NotificationsController extends BaseController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
intent.putExtra("currentAccount", currentAccount);
|
intent.putExtra("currentAccount", currentAccount);
|
||||||
PendingIntent contentIntent = PendingIntent.getActivity(ApplicationLoader.applicationContext, 0, intent, PendingIntent.FLAG_ONE_SHOT);
|
PendingIntent contentIntent = PendingIntent.getActivity(ApplicationLoader.applicationContext, 0, intent, PendingIntent.FLAG_MUTABLE | PendingIntent.FLAG_ONE_SHOT);
|
||||||
|
|
||||||
mBuilder.setContentTitle(name)
|
mBuilder.setContentTitle(name)
|
||||||
.setSmallIcon(R.drawable.notification)
|
.setSmallIcon(R.drawable.notification)
|
||||||
|
@ -3761,7 +3798,7 @@ public class NotificationsController extends BaseController {
|
||||||
Intent dismissIntent = new Intent(ApplicationLoader.applicationContext, NotificationDismissReceiver.class);
|
Intent dismissIntent = new Intent(ApplicationLoader.applicationContext, NotificationDismissReceiver.class);
|
||||||
dismissIntent.putExtra("messageDate", lastMessageObject.messageOwner.date);
|
dismissIntent.putExtra("messageDate", lastMessageObject.messageOwner.date);
|
||||||
dismissIntent.putExtra("currentAccount", currentAccount);
|
dismissIntent.putExtra("currentAccount", currentAccount);
|
||||||
mBuilder.setDeleteIntent(PendingIntent.getBroadcast(ApplicationLoader.applicationContext, 1, dismissIntent, PendingIntent.FLAG_UPDATE_CURRENT));
|
mBuilder.setDeleteIntent(PendingIntent.getBroadcast(ApplicationLoader.applicationContext, 1, dismissIntent, PendingIntent.FLAG_MUTABLE | PendingIntent.FLAG_UPDATE_CURRENT));
|
||||||
|
|
||||||
if (photoPath != null) {
|
if (photoPath != null) {
|
||||||
BitmapDrawable img = ImageLoader.getInstance().getImageFromMemory(photoPath, null, "50_50");
|
BitmapDrawable img = ImageLoader.getInstance().getImageFromMemory(photoPath, null, "50_50");
|
||||||
|
@ -3885,7 +3922,7 @@ public class NotificationsController extends BaseController {
|
||||||
callbackIntent.putExtra("data", button.data);
|
callbackIntent.putExtra("data", button.data);
|
||||||
}
|
}
|
||||||
callbackIntent.putExtra("mid", lastMessageObject.getId());
|
callbackIntent.putExtra("mid", lastMessageObject.getId());
|
||||||
mBuilder.addAction(0, button.text, PendingIntent.getBroadcast(ApplicationLoader.applicationContext, lastButtonId++, callbackIntent, PendingIntent.FLAG_UPDATE_CURRENT));
|
mBuilder.addAction(0, button.text, PendingIntent.getBroadcast(ApplicationLoader.applicationContext, lastButtonId++, callbackIntent, PendingIntent.FLAG_MUTABLE | PendingIntent.FLAG_UPDATE_CURRENT));
|
||||||
hasCallback = true;
|
hasCallback = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3897,9 +3934,9 @@ public class NotificationsController extends BaseController {
|
||||||
Intent replyIntent = new Intent(ApplicationLoader.applicationContext, PopupReplyReceiver.class);
|
Intent replyIntent = new Intent(ApplicationLoader.applicationContext, PopupReplyReceiver.class);
|
||||||
replyIntent.putExtra("currentAccount", currentAccount);
|
replyIntent.putExtra("currentAccount", currentAccount);
|
||||||
if (Build.VERSION.SDK_INT <= 19) {
|
if (Build.VERSION.SDK_INT <= 19) {
|
||||||
mBuilder.addAction(R.drawable.ic_ab_reply2, LocaleController.getString("Reply", R.string.Reply), PendingIntent.getBroadcast(ApplicationLoader.applicationContext, 2, replyIntent, PendingIntent.FLAG_UPDATE_CURRENT));
|
mBuilder.addAction(R.drawable.ic_ab_reply2, LocaleController.getString("Reply", R.string.Reply), PendingIntent.getBroadcast(ApplicationLoader.applicationContext, 2, replyIntent, PendingIntent.FLAG_MUTABLE | PendingIntent.FLAG_UPDATE_CURRENT));
|
||||||
} else {
|
} else {
|
||||||
mBuilder.addAction(R.drawable.ic_ab_reply, LocaleController.getString("Reply", R.string.Reply), PendingIntent.getBroadcast(ApplicationLoader.applicationContext, 2, replyIntent, PendingIntent.FLAG_UPDATE_CURRENT));
|
mBuilder.addAction(R.drawable.ic_ab_reply, LocaleController.getString("Reply", R.string.Reply), PendingIntent.getBroadcast(ApplicationLoader.applicationContext, 2, replyIntent, PendingIntent.FLAG_MUTABLE | PendingIntent.FLAG_UPDATE_CURRENT));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
showExtraNotifications(mBuilder, detailText, dialog_id, topicId, chatName, vibrationPattern, ledColor, sound, configImportance, isDefault, isInApp, notifyDisabled, chatType);
|
showExtraNotifications(mBuilder, detailText, dialog_id, topicId, chatName, vibrationPattern, ledColor, sound, configImportance, isDefault, isInApp, notifyDisabled, chatType);
|
||||||
|
@ -4202,7 +4239,7 @@ public class NotificationsController extends BaseController {
|
||||||
replyIntent.putExtra("max_id", maxId);
|
replyIntent.putExtra("max_id", maxId);
|
||||||
replyIntent.putExtra("topic_id", topicId);
|
replyIntent.putExtra("topic_id", topicId);
|
||||||
replyIntent.putExtra("currentAccount", currentAccount);
|
replyIntent.putExtra("currentAccount", currentAccount);
|
||||||
PendingIntent replyPendingIntent = PendingIntent.getBroadcast(ApplicationLoader.applicationContext, internalId, replyIntent, PendingIntent.FLAG_UPDATE_CURRENT);
|
PendingIntent replyPendingIntent = PendingIntent.getBroadcast(ApplicationLoader.applicationContext, internalId, replyIntent, PendingIntent.FLAG_MUTABLE | PendingIntent.FLAG_UPDATE_CURRENT);
|
||||||
RemoteInput remoteInputWear = new RemoteInput.Builder(EXTRA_VOICE_REPLY).setLabel(LocaleController.getString("Reply", R.string.Reply)).build();
|
RemoteInput remoteInputWear = new RemoteInput.Builder(EXTRA_VOICE_REPLY).setLabel(LocaleController.getString("Reply", R.string.Reply)).build();
|
||||||
String replyToString;
|
String replyToString;
|
||||||
if (DialogObject.isChatDialog(dialogId)) {
|
if (DialogObject.isChatDialog(dialogId)) {
|
||||||
|
@ -4443,7 +4480,7 @@ public class NotificationsController extends BaseController {
|
||||||
intent.putExtra("topicId", topicId);
|
intent.putExtra("topicId", topicId);
|
||||||
}
|
}
|
||||||
intent.putExtra("currentAccount", currentAccount);
|
intent.putExtra("currentAccount", currentAccount);
|
||||||
PendingIntent contentIntent = PendingIntent.getActivity(ApplicationLoader.applicationContext, 0, intent, PendingIntent.FLAG_ONE_SHOT);
|
PendingIntent contentIntent = PendingIntent.getActivity(ApplicationLoader.applicationContext, 0, intent, PendingIntent.FLAG_MUTABLE | PendingIntent.FLAG_ONE_SHOT);
|
||||||
|
|
||||||
NotificationCompat.WearableExtender wearableExtender = new NotificationCompat.WearableExtender();
|
NotificationCompat.WearableExtender wearableExtender = new NotificationCompat.WearableExtender();
|
||||||
if (wearReplyAction != null) {
|
if (wearReplyAction != null) {
|
||||||
|
@ -4455,7 +4492,7 @@ public class NotificationsController extends BaseController {
|
||||||
msgHeardIntent.putExtra("dialog_id", dialogId);
|
msgHeardIntent.putExtra("dialog_id", dialogId);
|
||||||
msgHeardIntent.putExtra("max_id", maxId);
|
msgHeardIntent.putExtra("max_id", maxId);
|
||||||
msgHeardIntent.putExtra("currentAccount", currentAccount);
|
msgHeardIntent.putExtra("currentAccount", currentAccount);
|
||||||
PendingIntent readPendingIntent = PendingIntent.getBroadcast(ApplicationLoader.applicationContext, internalId, msgHeardIntent, PendingIntent.FLAG_UPDATE_CURRENT);
|
PendingIntent readPendingIntent = PendingIntent.getBroadcast(ApplicationLoader.applicationContext, internalId, msgHeardIntent, PendingIntent.FLAG_MUTABLE | PendingIntent.FLAG_UPDATE_CURRENT);
|
||||||
NotificationCompat.Action readAction = new NotificationCompat.Action.Builder(R.drawable.msg_markread, LocaleController.getString("MarkAsRead", R.string.MarkAsRead), readPendingIntent)
|
NotificationCompat.Action readAction = new NotificationCompat.Action.Builder(R.drawable.msg_markread, LocaleController.getString("MarkAsRead", R.string.MarkAsRead), readPendingIntent)
|
||||||
.setSemanticAction(NotificationCompat.Action.SEMANTIC_ACTION_MARK_AS_READ)
|
.setSemanticAction(NotificationCompat.Action.SEMANTIC_ACTION_MARK_AS_READ)
|
||||||
.setShowsUserInterface(false)
|
.setShowsUserInterface(false)
|
||||||
|
@ -4504,7 +4541,7 @@ public class NotificationsController extends BaseController {
|
||||||
dismissIntent.putExtra("messageDate", maxDate);
|
dismissIntent.putExtra("messageDate", maxDate);
|
||||||
dismissIntent.putExtra("dialogId", dialogId);
|
dismissIntent.putExtra("dialogId", dialogId);
|
||||||
dismissIntent.putExtra("currentAccount", currentAccount);
|
dismissIntent.putExtra("currentAccount", currentAccount);
|
||||||
builder.setDeleteIntent(PendingIntent.getBroadcast(ApplicationLoader.applicationContext, internalId, dismissIntent, PendingIntent.FLAG_UPDATE_CURRENT));
|
builder.setDeleteIntent(PendingIntent.getBroadcast(ApplicationLoader.applicationContext, internalId, dismissIntent, PendingIntent.FLAG_MUTABLE | PendingIntent.FLAG_UPDATE_CURRENT));
|
||||||
|
|
||||||
if (useSummaryNotification) {
|
if (useSummaryNotification) {
|
||||||
builder.setGroup(notificationGroup);
|
builder.setGroup(notificationGroup);
|
||||||
|
@ -4541,7 +4578,7 @@ public class NotificationsController extends BaseController {
|
||||||
callbackIntent.putExtra("data", button.data);
|
callbackIntent.putExtra("data", button.data);
|
||||||
}
|
}
|
||||||
callbackIntent.putExtra("mid", rowsMid);
|
callbackIntent.putExtra("mid", rowsMid);
|
||||||
builder.addAction(0, button.text, PendingIntent.getBroadcast(ApplicationLoader.applicationContext, lastButtonId++, callbackIntent, PendingIntent.FLAG_UPDATE_CURRENT));
|
builder.addAction(0, button.text, PendingIntent.getBroadcast(ApplicationLoader.applicationContext, lastButtonId++, callbackIntent, PendingIntent.FLAG_MUTABLE | PendingIntent.FLAG_UPDATE_CURRENT));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3612,7 +3612,7 @@ public class SendMessagesHelper extends BaseController implements NotificationCe
|
||||||
newMsg.via_bot_name = "";
|
newMsg.via_bot_name = "";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
newMsg.via_bot_id = Utilities.parseInt(params.get("bot"));
|
newMsg.via_bot_id = Utilities.parseLong(params.get("bot"));
|
||||||
}
|
}
|
||||||
newMsg.flags |= TLRPC.MESSAGE_FLAG_HAS_BOT_ID;
|
newMsg.flags |= TLRPC.MESSAGE_FLAG_HAS_BOT_ID;
|
||||||
}
|
}
|
||||||
|
@ -8037,7 +8037,7 @@ public class SendMessagesHelper extends BaseController implements NotificationCe
|
||||||
} finally {
|
} finally {
|
||||||
try {
|
try {
|
||||||
retriever.release();
|
retriever.release();
|
||||||
} catch (RuntimeException ex) {
|
} catch (Throwable ex) {
|
||||||
// Ignore failures while cleaning up.
|
// Ignore failures while cleaning up.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,6 +70,8 @@ public class TopicsController extends BaseController {
|
||||||
if (BuildVars.DEBUG_PRIVATE_VERSION) {
|
if (BuildVars.DEBUG_PRIVATE_VERSION) {
|
||||||
FileLog.d("load topics " + chatId + " fromCache=" + fromCache + " loadType=" + loadType);
|
FileLog.d("load topics " + chatId + " fromCache=" + fromCache + " loadType=" + loadType);
|
||||||
}
|
}
|
||||||
|
topicsIsLoading.put(chatId, 1);
|
||||||
|
|
||||||
if (fromCache) {
|
if (fromCache) {
|
||||||
getMessagesStorage().loadTopics(-chatId, topics -> {
|
getMessagesStorage().loadTopics(-chatId, topics -> {
|
||||||
AndroidUtilities.runOnUIThread(() -> {
|
AndroidUtilities.runOnUIThread(() -> {
|
||||||
|
@ -88,7 +90,6 @@ public class TopicsController extends BaseController {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
topicsIsLoading.put(chatId, 1);
|
|
||||||
TLRPC.TL_channels_getForumTopics getForumTopics = new TLRPC.TL_channels_getForumTopics();
|
TLRPC.TL_channels_getForumTopics getForumTopics = new TLRPC.TL_channels_getForumTopics();
|
||||||
getForumTopics.channel = getMessagesController().getInputChannel(chatId);
|
getForumTopics.channel = getMessagesController().getInputChannel(chatId);
|
||||||
if (loadType == LOAD_TYPE_PRELOAD) {
|
if (loadType == LOAD_TYPE_PRELOAD) {
|
||||||
|
@ -113,6 +114,7 @@ public class TopicsController extends BaseController {
|
||||||
messagesMap.put(topics.messages.get(i).id, topics.messages.get(i));
|
messagesMap.put(topics.messages.get(i).id, topics.messages.get(i));
|
||||||
}
|
}
|
||||||
AndroidUtilities.runOnUIThread(() -> {
|
AndroidUtilities.runOnUIThread(() -> {
|
||||||
|
getMessagesStorage().putUsersAndChats(((TLRPC.TL_messages_forumTopics) response).users, ((TLRPC.TL_messages_forumTopics) response).chats, true, false);
|
||||||
getMessagesController().putUsers(((TLRPC.TL_messages_forumTopics) response).users, false);
|
getMessagesController().putUsers(((TLRPC.TL_messages_forumTopics) response).users, false);
|
||||||
getMessagesController().putChats(((TLRPC.TL_messages_forumTopics) response).chats, false);
|
getMessagesController().putChats(((TLRPC.TL_messages_forumTopics) response).chats, false);
|
||||||
|
|
||||||
|
@ -172,20 +174,19 @@ public class TopicsController extends BaseController {
|
||||||
topicsToReload = new ArrayList<>();
|
topicsToReload = new ArrayList<>();
|
||||||
}
|
}
|
||||||
topicsToReload.add(newTopic);
|
topicsToReload.add(newTopic);
|
||||||
} else {
|
|
||||||
if (newTopic.topicStartMessage == null) {
|
|
||||||
newTopic.topicStartMessage = new TLRPC.TL_message();
|
|
||||||
newTopic.topicStartMessage.message = "";
|
|
||||||
newTopic.topicStartMessage.id = newTopic.id;
|
|
||||||
newTopic.topicStartMessage.peer_id = getMessagesController().getPeer(-chatId);
|
|
||||||
newTopic.topicStartMessage.action = new TLRPC.TL_messageActionTopicCreate();
|
|
||||||
newTopic.topicStartMessage.action.title = newTopic.title;
|
|
||||||
}
|
|
||||||
topics.add(newTopic);
|
|
||||||
topicsMap.put(newTopic.id, newTopic);
|
|
||||||
topicsByTopMsgId.put(messageHash(newTopic.top_message, chatId), newTopic);
|
|
||||||
changed = true;
|
|
||||||
}
|
}
|
||||||
|
if (newTopic.topicStartMessage == null) {
|
||||||
|
newTopic.topicStartMessage = new TLRPC.TL_message();
|
||||||
|
newTopic.topicStartMessage.message = "";
|
||||||
|
newTopic.topicStartMessage.id = newTopic.id;
|
||||||
|
newTopic.topicStartMessage.peer_id = getMessagesController().getPeer(-chatId);
|
||||||
|
newTopic.topicStartMessage.action = new TLRPC.TL_messageActionTopicCreate();
|
||||||
|
newTopic.topicStartMessage.action.title = newTopic.title;
|
||||||
|
}
|
||||||
|
topics.add(newTopic);
|
||||||
|
topicsMap.put(newTopic.id, newTopic);
|
||||||
|
topicsByTopMsgId.put(messageHash(newTopic.top_message, chatId), newTopic);
|
||||||
|
changed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -202,9 +203,7 @@ public class TopicsController extends BaseController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (changed) {
|
|
||||||
sortTopics(chatId);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (topicsToReload != null && loadType != LOAD_TYPE_LOAD_UNKNOWN) {
|
if (topicsToReload != null && loadType != LOAD_TYPE_LOAD_UNKNOWN) {
|
||||||
reloadTopics(chatId, topicsToReload);
|
reloadTopics(chatId, topicsToReload);
|
||||||
|
@ -213,6 +212,10 @@ public class TopicsController extends BaseController {
|
||||||
getUserConfig().getPreferences().edit().putBoolean("topics_end_reached_" + chatId, true).apply();
|
getUserConfig().getPreferences().edit().putBoolean("topics_end_reached_" + chatId, true).apply();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (changed) {
|
||||||
|
sortTopics(chatId);
|
||||||
|
}
|
||||||
|
|
||||||
getNotificationCenter().postNotificationName(NotificationCenter.topicsDidLoaded, chatId, true);
|
getNotificationCenter().postNotificationName(NotificationCenter.topicsDidLoaded, chatId, true);
|
||||||
|
|
||||||
if ((loadType == LOAD_TYPE_PRELOAD || (loadType == LOAD_TYPE_PRELOAD && !fromCache)) && fromCache && topicsByChatId.get(chatId).isEmpty()) {
|
if ((loadType == LOAD_TYPE_PRELOAD || (loadType == LOAD_TYPE_PRELOAD && !fromCache)) && fromCache && topicsByChatId.get(chatId).isEmpty()) {
|
||||||
|
@ -367,11 +370,14 @@ public class TopicsController extends BaseController {
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateMaxReadId(long chatId, int topicId, int readMaxId, int unreadCount) {
|
public void updateMaxReadId(long chatId, int topicId, int readMaxId, int unreadCount, int mentionsUnread) {
|
||||||
TLRPC.TL_forumTopic topic = findTopic(chatId, topicId);
|
TLRPC.TL_forumTopic topic = findTopic(chatId, topicId);
|
||||||
if (topic != null) {
|
if (topic != null) {
|
||||||
topic.read_inbox_max_id = readMaxId;
|
topic.read_inbox_max_id = readMaxId;
|
||||||
topic.unread_count = unreadCount;
|
topic.unread_count = unreadCount;
|
||||||
|
if (mentionsUnread >= 0) {
|
||||||
|
topic.unread_mentions_count = mentionsUnread;
|
||||||
|
}
|
||||||
sortTopics(chatId);
|
sortTopics(chatId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -669,14 +675,6 @@ public class TopicsController extends BaseController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public TLRPC.Message getLastMessage(long id) {
|
|
||||||
ArrayList<TLRPC.TL_forumTopic> topics = topicsByChatId.get(id);
|
|
||||||
if (!topics.isEmpty()) {
|
|
||||||
return topics.get(0).topMessage;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
LongSparseArray<TopicsLoadOffset> offsets = new LongSparseArray<>();
|
LongSparseArray<TopicsLoadOffset> offsets = new LongSparseArray<>();
|
||||||
|
|
||||||
public TopicsLoadOffset getLoadOffset(long chatId) {
|
public TopicsLoadOffset getLoadOffset(long chatId) {
|
||||||
|
@ -867,7 +865,7 @@ public class TopicsController extends BaseController {
|
||||||
if (topic != null) {
|
if (topic != null) {
|
||||||
topic.read_outbox_max_id = Math.max(topic.read_outbox_max_id, value);
|
topic.read_outbox_max_id = Math.max(topic.read_outbox_max_id, value);
|
||||||
updatedChats.add(-topicKey.dialogId);
|
updatedChats.add(-topicKey.dialogId);
|
||||||
if (topic.read_outbox_max_id >= topic.topMessage.id) {
|
if (topic.topMessage != null && topic.read_outbox_max_id >= topic.topMessage.id) {
|
||||||
topic.topMessage.unread = false;
|
topic.topMessage.unread = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -178,7 +178,7 @@ public class Browser {
|
||||||
if (equals) {
|
if (equals) {
|
||||||
return url.equals("telegra.ph") || url.equals("te.legra.ph") || url.equals("graph.org");
|
return url.equals("telegra.ph") || url.equals("te.legra.ph") || url.equals("graph.org");
|
||||||
}
|
}
|
||||||
return url.matches("^(https" + (forceHttps ? "" : "?") + "://)?(te\\.?legra\\.ph|graph\\.org).*"); // telegra.ph, te.legra.ph, graph.org
|
return url.matches("^(https" + (forceHttps ? "" : "?") + "://)?(te\\.?legra\\.ph|graph\\.org)(/.*|$)"); // telegra.ph, te.legra.ph, graph.org
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String extractUsername(String link) {
|
public static String extractUsername(String link) {
|
||||||
|
@ -207,9 +207,9 @@ public class Browser {
|
||||||
public static boolean urlMustNotHaveConfirmation(String url) {
|
public static boolean urlMustNotHaveConfirmation(String url) {
|
||||||
return (
|
return (
|
||||||
isTelegraphUrl(url, false, true) ||
|
isTelegraphUrl(url, false, true) ||
|
||||||
url.matches("^(https://)?t\\.me/iv\\??.*") || // t.me/iv?
|
url.matches("^(https://)?t\\.me/iv\\??(/.*|$)") || // t.me/iv?
|
||||||
url.matches("^(https://)?telegram\\.org/(blog|tour)/?.*") || // telegram.org/blog, telegram.org/tour
|
url.matches("^(https://)?telegram\\.org/(blog|tour)(/.*|$)") || // telegram.org/blog, telegram.org/tour
|
||||||
url.matches("^(https://)?fragment\\.com/?.*") // fragment.com
|
url.matches("^(https://)?fragment\\.com(/.*|$)") // fragment.com
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -346,14 +346,14 @@ public class Browser {
|
||||||
Intent share = new Intent(ApplicationLoader.applicationContext, ShareBroadcastReceiver.class);
|
Intent share = new Intent(ApplicationLoader.applicationContext, ShareBroadcastReceiver.class);
|
||||||
share.setAction(Intent.ACTION_SEND);
|
share.setAction(Intent.ACTION_SEND);
|
||||||
|
|
||||||
PendingIntent copy = PendingIntent.getBroadcast(ApplicationLoader.applicationContext, 0, new Intent(ApplicationLoader.applicationContext, CustomTabsCopyReceiver.class), PendingIntent.FLAG_UPDATE_CURRENT);
|
PendingIntent copy = PendingIntent.getBroadcast(ApplicationLoader.applicationContext, 0, new Intent(ApplicationLoader.applicationContext, CustomTabsCopyReceiver.class), PendingIntent.FLAG_MUTABLE | PendingIntent.FLAG_UPDATE_CURRENT);
|
||||||
|
|
||||||
CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder(getSession());
|
CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder(getSession());
|
||||||
builder.addMenuItem(LocaleController.getString("CopyLink", R.string.CopyLink), copy);
|
builder.addMenuItem(LocaleController.getString("CopyLink", R.string.CopyLink), copy);
|
||||||
|
|
||||||
builder.setToolbarColor(Theme.getColor(Theme.key_actionBarBrowser));
|
builder.setToolbarColor(Theme.getColor(Theme.key_actionBarBrowser));
|
||||||
builder.setShowTitle(true);
|
builder.setShowTitle(true);
|
||||||
builder.setActionButton(BitmapFactory.decodeResource(context.getResources(), R.drawable.msg_filled_shareout), LocaleController.getString("ShareFile", R.string.ShareFile), PendingIntent.getBroadcast(ApplicationLoader.applicationContext, 0, share, 0), true);
|
builder.setActionButton(BitmapFactory.decodeResource(context.getResources(), R.drawable.msg_filled_shareout), LocaleController.getString("ShareFile", R.string.ShareFile), PendingIntent.getBroadcast(ApplicationLoader.applicationContext, 0, share, PendingIntent.FLAG_MUTABLE ), true);
|
||||||
CustomTabsIntent intent = builder.build();
|
CustomTabsIntent intent = builder.build();
|
||||||
intent.setUseNewTask();
|
intent.setUseNewTask();
|
||||||
intent.launchUrl(context, uri);
|
intent.launchUrl(context, uri);
|
||||||
|
|
|
@ -9,6 +9,7 @@ import org.telegram.messenger.BuildVars;
|
||||||
import org.telegram.messenger.DispatchQueuePoolBackground;
|
import org.telegram.messenger.DispatchQueuePoolBackground;
|
||||||
import org.telegram.messenger.FileLoader;
|
import org.telegram.messenger.FileLoader;
|
||||||
import org.telegram.messenger.FileLog;
|
import org.telegram.messenger.FileLog;
|
||||||
|
import org.telegram.messenger.SharedConfig;
|
||||||
import org.telegram.messenger.Utilities;
|
import org.telegram.messenger.Utilities;
|
||||||
import org.telegram.ui.Components.RLottieDrawable;
|
import org.telegram.ui.Components.RLottieDrawable;
|
||||||
|
|
||||||
|
@ -47,12 +48,12 @@ public class BitmapsCache {
|
||||||
static volatile boolean cleanupScheduled;
|
static volatile boolean cleanupScheduled;
|
||||||
byte[] bufferTmp;
|
byte[] bufferTmp;
|
||||||
|
|
||||||
private final static int N = Utilities.clamp(Runtime.getRuntime().availableProcessors(), 8, 1);
|
private final static int N = Utilities.clamp(Runtime.getRuntime().availableProcessors() - 2, 8, 1);
|
||||||
private static ThreadPoolExecutor bitmapCompressExecutor;
|
private static ThreadPoolExecutor bitmapCompressExecutor;
|
||||||
private final Object mutex = new Object();
|
private final Object mutex = new Object();
|
||||||
private int frameIndex;
|
private int frameIndex;
|
||||||
boolean error;
|
boolean error;
|
||||||
boolean fileExist;
|
volatile boolean fileExist;
|
||||||
int compressQuality;
|
int compressQuality;
|
||||||
|
|
||||||
final File file;
|
final File file;
|
||||||
|
@ -89,36 +90,47 @@ public class BitmapsCache {
|
||||||
File fileTmo = new File(FileLoader.checkDirectory(FileLoader.MEDIA_DIR_CACHE), "acache");
|
File fileTmo = new File(FileLoader.checkDirectory(FileLoader.MEDIA_DIR_CACHE), "acache");
|
||||||
file = new File(fileTmo, fileName + "_" + w + "_" + h + (noLimit ? "_nolimit" : " ") + ".pcache2");
|
file = new File(fileTmo, fileName + "_" + w + "_" + h + (noLimit ? "_nolimit" : " ") + ".pcache2");
|
||||||
useSharedBuffers = w < AndroidUtilities.dp(60) && h < AndroidUtilities.dp(60);
|
useSharedBuffers = w < AndroidUtilities.dp(60) && h < AndroidUtilities.dp(60);
|
||||||
fileExist = file.exists();
|
|
||||||
if (fileExist) {
|
|
||||||
RandomAccessFile randomAccessFile = null;
|
|
||||||
try {
|
|
||||||
randomAccessFile = new RandomAccessFile(file, "r");
|
|
||||||
cacheCreated = randomAccessFile.readBoolean();
|
|
||||||
if (cacheCreated && frameOffsets.isEmpty()) {
|
|
||||||
randomAccessFile.seek(randomAccessFile.readInt());
|
|
||||||
int count = randomAccessFile.readInt();
|
|
||||||
fillFrames(randomAccessFile, count);
|
|
||||||
if (count == 0) {
|
|
||||||
file.delete();
|
|
||||||
cacheCreated = false;
|
|
||||||
fileExist = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (Throwable e) {
|
// check cache created in file load queue only for high devices
|
||||||
e.printStackTrace();
|
if (SharedConfig.getDevicePerformanceClass() >= SharedConfig.PERFORMANCE_CLASS_HIGH) {
|
||||||
file.delete();
|
fileExist = file.exists();
|
||||||
fileExist = false;
|
if (fileExist) {
|
||||||
} finally {
|
RandomAccessFile randomAccessFile = null;
|
||||||
try {
|
try {
|
||||||
if (randomAccessFile != null) {
|
randomAccessFile = new RandomAccessFile(file, "r");
|
||||||
randomAccessFile.close();
|
cacheCreated = randomAccessFile.readBoolean();
|
||||||
|
if (cacheCreated && frameOffsets.isEmpty()) {
|
||||||
|
randomAccessFile.seek(randomAccessFile.readInt());
|
||||||
|
int count = randomAccessFile.readInt();
|
||||||
|
if (count > 10_000) {
|
||||||
|
count = 0;
|
||||||
|
}
|
||||||
|
fillFrames(randomAccessFile, count);
|
||||||
|
if (frameOffsets.size() == 0) {
|
||||||
|
cacheCreated = false;
|
||||||
|
fileExist = false;
|
||||||
|
file.delete();
|
||||||
|
} else {
|
||||||
|
cachedFile = randomAccessFile;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (Throwable e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
file.delete();
|
||||||
|
fileExist = false;
|
||||||
|
} finally {
|
||||||
|
try {
|
||||||
|
if (cachedFile != randomAccessFile && randomAccessFile != null) {
|
||||||
|
randomAccessFile.close();
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
fileExist = false;
|
||||||
|
cacheCreated = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -152,25 +164,30 @@ public class BitmapsCache {
|
||||||
|
|
||||||
public void createCache() {
|
public void createCache() {
|
||||||
try {
|
try {
|
||||||
long time = System.currentTimeMillis();
|
|
||||||
if (file.exists()) {
|
if (file.exists()) {
|
||||||
RandomAccessFile randomAccessFile = null;
|
RandomAccessFile randomAccessFile = null;
|
||||||
try {
|
try {
|
||||||
randomAccessFile = new RandomAccessFile(file, "r");
|
randomAccessFile = new RandomAccessFile(file, "r");
|
||||||
cacheCreated = randomAccessFile.readBoolean();
|
cacheCreated = randomAccessFile.readBoolean();
|
||||||
int framesCount = randomAccessFile.readInt();
|
|
||||||
if (framesCount == 0) {
|
|
||||||
cacheCreated = false;
|
|
||||||
}
|
|
||||||
if (cacheCreated) {
|
if (cacheCreated) {
|
||||||
frameOffsets.clear();
|
frameOffsets.clear();
|
||||||
randomAccessFile.seek(randomAccessFile.readInt());
|
randomAccessFile.seek(randomAccessFile.readInt());
|
||||||
int count = randomAccessFile.readInt();
|
int count = randomAccessFile.readInt();
|
||||||
fillFrames(randomAccessFile, count);
|
if (count > 10_000) {
|
||||||
randomAccessFile.close();
|
count = 0;
|
||||||
fileExist = true;
|
}
|
||||||
return;
|
if (count > 0) {
|
||||||
} else {
|
fillFrames(randomAccessFile, count);
|
||||||
|
randomAccessFile.seek(0);
|
||||||
|
cachedFile = randomAccessFile;
|
||||||
|
fileExist = true;
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
fileExist = false;
|
||||||
|
cacheCreated = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!cacheCreated) {
|
||||||
file.delete();
|
file.delete();
|
||||||
}
|
}
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
|
@ -180,7 +197,7 @@ public class BitmapsCache {
|
||||||
|
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
if (randomAccessFile != null) {
|
if (cachedFile != randomAccessFile && randomAccessFile != null) {
|
||||||
try {
|
try {
|
||||||
randomAccessFile.close();
|
randomAccessFile.close();
|
||||||
} catch (Throwable e2) {
|
} catch (Throwable e2) {
|
||||||
|
@ -207,9 +224,6 @@ public class BitmapsCache {
|
||||||
finalRandomAccessFile.writeInt(0);
|
finalRandomAccessFile.writeInt(0);
|
||||||
|
|
||||||
int index = 0;
|
int index = 0;
|
||||||
long bitmapFrameTime = 0;
|
|
||||||
long compressTime = 0;
|
|
||||||
long writeFileTime = 0;
|
|
||||||
int framePosition = 0;
|
int framePosition = 0;
|
||||||
|
|
||||||
AtomicBoolean closed = new AtomicBoolean(false);
|
AtomicBoolean closed = new AtomicBoolean(false);
|
||||||
|
@ -250,11 +264,9 @@ public class BitmapsCache {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
long time2 = System.currentTimeMillis();
|
|
||||||
if (source.getNextFrame(bitmap[index]) != 1) {
|
if (source.getNextFrame(bitmap[index]) != 1) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
bitmapFrameTime += System.currentTimeMillis() - time2;
|
|
||||||
countDownLatch[index] = new CountDownLatch(1);
|
countDownLatch[index] = new CountDownLatch(1);
|
||||||
|
|
||||||
|
|
||||||
|
@ -332,12 +344,10 @@ public class BitmapsCache {
|
||||||
randomAccessFile.close();
|
randomAccessFile.close();
|
||||||
|
|
||||||
this.frameOffsets.clear();
|
this.frameOffsets.clear();
|
||||||
// this.frameOffsets.addAll(frameOffsets);
|
this.frameOffsets.addAll(frameOffsets);
|
||||||
|
cachedFile = new RandomAccessFile(file, "r");
|
||||||
|
cacheCreated = true;
|
||||||
fileExist = true;
|
fileExist = true;
|
||||||
|
|
||||||
// if (BuildVars.DEBUG_VERSION) {
|
|
||||||
// FileLog.d("generate cache for time = " + (System.currentTimeMillis() - time) + " drawFrameTime = " + bitmapFrameTime + " comressQuality = " + compressQuality + " fileSize = " + AndroidUtilities.formatFileSize(file.length()) + " " + fileName);
|
|
||||||
// }
|
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
@ -348,6 +358,9 @@ public class BitmapsCache {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void fillFrames(RandomAccessFile randomAccessFile, int count) throws Throwable {
|
private void fillFrames(RandomAccessFile randomAccessFile, int count) throws Throwable {
|
||||||
|
if (count == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
byte[] bytes = new byte[4 * 2 * count];
|
byte[] bytes = new byte[4 * 2 * count];
|
||||||
randomAccessFile.read(bytes);
|
randomAccessFile.read(bytes);
|
||||||
ByteBuffer byteBuffer = ByteBuffer.wrap(bytes);
|
ByteBuffer byteBuffer = ByteBuffer.wrap(bytes);
|
||||||
|
@ -385,6 +398,7 @@ public class BitmapsCache {
|
||||||
synchronized (mutex) {
|
synchronized (mutex) {
|
||||||
randomAccessFile = new RandomAccessFile(file, "r");
|
randomAccessFile = new RandomAccessFile(file, "r");
|
||||||
cacheCreated = randomAccessFile.readBoolean();
|
cacheCreated = randomAccessFile.readBoolean();
|
||||||
|
randomAccessFile.seek(randomAccessFile.readInt());
|
||||||
framesCount = randomAccessFile.readInt();
|
framesCount = randomAccessFile.readInt();
|
||||||
if (framesCount <= 0) {
|
if (framesCount <= 0) {
|
||||||
cacheCreated = false;
|
cacheCreated = false;
|
||||||
|
@ -436,6 +450,9 @@ public class BitmapsCache {
|
||||||
} else {
|
} else {
|
||||||
randomAccessFile = cachedFile;
|
randomAccessFile = cachedFile;
|
||||||
}
|
}
|
||||||
|
if (frameOffsets.size() == 0) {
|
||||||
|
return FRAME_RESULT_NO_FRAME;
|
||||||
|
}
|
||||||
index = Utilities.clamp(index, frameOffsets.size() - 1, 0);
|
index = Utilities.clamp(index, frameOffsets.size() - 1, 0);
|
||||||
selectedFrame = frameOffsets.get(index);
|
selectedFrame = frameOffsets.get(index);
|
||||||
randomAccessFile.seek(selectedFrame.frameOffset);
|
randomAccessFile.seek(selectedFrame.frameOffset);
|
||||||
|
|
|
@ -79,7 +79,6 @@ import android.widget.RemoteViews;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.core.app.ActivityCompat;
|
|
||||||
|
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
import org.telegram.messenger.AccountInstance;
|
import org.telegram.messenger.AccountInstance;
|
||||||
|
@ -1562,7 +1561,7 @@ public class VoIPService extends Service implements SensorEventListener, AudioMa
|
||||||
.putExtra("call_access_hash", privateCall.access_hash)
|
.putExtra("call_access_hash", privateCall.access_hash)
|
||||||
.putExtra("call_video", privateCall.video)
|
.putExtra("call_video", privateCall.video)
|
||||||
.putExtra("account", currentAccount)
|
.putExtra("account", currentAccount)
|
||||||
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_SINGLE_TOP), 0).send();
|
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_SINGLE_TOP), PendingIntent.FLAG_MUTABLE).send();
|
||||||
} catch (Exception x) {
|
} catch (Exception x) {
|
||||||
if (BuildVars.LOGS_ENABLED) {
|
if (BuildVars.LOGS_ENABLED) {
|
||||||
FileLog.e("Error starting incall activity", x);
|
FileLog.e("Error starting incall activity", x);
|
||||||
|
@ -2858,7 +2857,7 @@ public class VoIPService extends Service implements SensorEventListener, AudioMa
|
||||||
}
|
}
|
||||||
Notification.Builder builder = new Notification.Builder(this)
|
Notification.Builder builder = new Notification.Builder(this)
|
||||||
.setContentText(name)
|
.setContentText(name)
|
||||||
.setContentIntent(PendingIntent.getActivity(this, 50, intent, 0));
|
.setContentIntent(PendingIntent.getActivity(this, 50, intent, PendingIntent.FLAG_MUTABLE));
|
||||||
if (groupCall != null) {
|
if (groupCall != null) {
|
||||||
builder.setContentTitle(ChatObject.isChannelOrGiga(chat) ? LocaleController.getString("VoipLiveStream", R.string.VoipLiveStream) : LocaleController.getString("VoipVoiceChat", R.string.VoipVoiceChat));
|
builder.setContentTitle(ChatObject.isChannelOrGiga(chat) ? LocaleController.getString("VoipLiveStream", R.string.VoipLiveStream) : LocaleController.getString("VoipVoiceChat", R.string.VoipVoiceChat));
|
||||||
builder.setSmallIcon(isMicMute() ? R.drawable.voicechat_muted : R.drawable.voicechat_active);
|
builder.setSmallIcon(isMicMute() ? R.drawable.voicechat_muted : R.drawable.voicechat_active);
|
||||||
|
@ -2870,9 +2869,9 @@ public class VoIPService extends Service implements SensorEventListener, AudioMa
|
||||||
Intent endIntent = new Intent(this, VoIPActionsReceiver.class);
|
Intent endIntent = new Intent(this, VoIPActionsReceiver.class);
|
||||||
endIntent.setAction(getPackageName() + ".END_CALL");
|
endIntent.setAction(getPackageName() + ".END_CALL");
|
||||||
if (groupCall != null) {
|
if (groupCall != null) {
|
||||||
builder.addAction(R.drawable.ic_call_end_white_24dp, ChatObject.isChannelOrGiga(chat) ? LocaleController.getString("VoipChannelLeaveAlertTitle", R.string.VoipChannelLeaveAlertTitle) : LocaleController.getString("VoipGroupLeaveAlertTitle", R.string.VoipGroupLeaveAlertTitle), PendingIntent.getBroadcast(this, 0, endIntent, PendingIntent.FLAG_UPDATE_CURRENT));
|
builder.addAction(R.drawable.ic_call_end_white_24dp, ChatObject.isChannelOrGiga(chat) ? LocaleController.getString("VoipChannelLeaveAlertTitle", R.string.VoipChannelLeaveAlertTitle) : LocaleController.getString("VoipGroupLeaveAlertTitle", R.string.VoipGroupLeaveAlertTitle), PendingIntent.getBroadcast(this, 0, endIntent, PendingIntent.FLAG_MUTABLE | PendingIntent.FLAG_UPDATE_CURRENT));
|
||||||
} else {
|
} else {
|
||||||
builder.addAction(R.drawable.ic_call_end_white_24dp, LocaleController.getString("VoipEndCall", R.string.VoipEndCall), PendingIntent.getBroadcast(this, 0, endIntent, PendingIntent.FLAG_UPDATE_CURRENT));
|
builder.addAction(R.drawable.ic_call_end_white_24dp, LocaleController.getString("VoipEndCall", R.string.VoipEndCall), PendingIntent.getBroadcast(this, 0, endIntent, PendingIntent.FLAG_MUTABLE | PendingIntent.FLAG_UPDATE_CURRENT));
|
||||||
}
|
}
|
||||||
builder.setPriority(Notification.PRIORITY_MAX);
|
builder.setPriority(Notification.PRIORITY_MAX);
|
||||||
}
|
}
|
||||||
|
@ -3313,7 +3312,7 @@ public class VoIPService extends Service implements SensorEventListener, AudioMa
|
||||||
FileLog.d("Starting incall activity for incoming call");
|
FileLog.d("Starting incall activity for incoming call");
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
PendingIntent.getActivity(VoIPService.this, 12345, new Intent(VoIPService.this, LaunchActivity.class).setAction("voip"), 0).send();
|
PendingIntent.getActivity(VoIPService.this, 12345, new Intent(VoIPService.this, LaunchActivity.class).setAction("voip"), PendingIntent.FLAG_MUTABLE).send();
|
||||||
} catch (Exception x) {
|
} catch (Exception x) {
|
||||||
if (BuildVars.LOGS_ENABLED) {
|
if (BuildVars.LOGS_ENABLED) {
|
||||||
FileLog.e("Error starting incall activity", x);
|
FileLog.e("Error starting incall activity", x);
|
||||||
|
@ -3914,7 +3913,7 @@ public class VoIPService extends Service implements SensorEventListener, AudioMa
|
||||||
.setContentText(name)
|
.setContentText(name)
|
||||||
.setSmallIcon(R.drawable.notification)
|
.setSmallIcon(R.drawable.notification)
|
||||||
.setSubText(subText)
|
.setSubText(subText)
|
||||||
.setContentIntent(PendingIntent.getActivity(this, 0, intent, 0));
|
.setContentIntent(PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_MUTABLE));
|
||||||
Uri soundProviderUri = Uri.parse("content://" + ApplicationLoader.getApplicationId() + ".call_sound_provider/start_ringing");
|
Uri soundProviderUri = Uri.parse("content://" + ApplicationLoader.getApplicationId() + ".call_sound_provider/start_ringing");
|
||||||
if (Build.VERSION.SDK_INT >= 26) {
|
if (Build.VERSION.SDK_INT >= 26) {
|
||||||
SharedPreferences nprefs = MessagesController.getGlobalNotificationsSettings();
|
SharedPreferences nprefs = MessagesController.getGlobalNotificationsSettings();
|
||||||
|
@ -3969,7 +3968,7 @@ public class VoIPService extends Service implements SensorEventListener, AudioMa
|
||||||
endTitle = new SpannableString(endTitle);
|
endTitle = new SpannableString(endTitle);
|
||||||
((SpannableString) endTitle).setSpan(new ForegroundColorSpan(0xFFF44336), 0, endTitle.length(), 0);
|
((SpannableString) endTitle).setSpan(new ForegroundColorSpan(0xFFF44336), 0, endTitle.length(), 0);
|
||||||
}
|
}
|
||||||
PendingIntent endPendingIntent = PendingIntent.getBroadcast(this, 0, endIntent, PendingIntent.FLAG_CANCEL_CURRENT);
|
PendingIntent endPendingIntent = PendingIntent.getBroadcast(this, 0, endIntent, PendingIntent.FLAG_MUTABLE | PendingIntent.FLAG_CANCEL_CURRENT);
|
||||||
builder.addAction(R.drawable.ic_call_end_white_24dp, endTitle, endPendingIntent);
|
builder.addAction(R.drawable.ic_call_end_white_24dp, endTitle, endPendingIntent);
|
||||||
Intent answerIntent = new Intent(this, VoIPActionsReceiver.class);
|
Intent answerIntent = new Intent(this, VoIPActionsReceiver.class);
|
||||||
answerIntent.setAction(getPackageName() + ".ANSWER_CALL");
|
answerIntent.setAction(getPackageName() + ".ANSWER_CALL");
|
||||||
|
@ -3979,7 +3978,7 @@ public class VoIPService extends Service implements SensorEventListener, AudioMa
|
||||||
answerTitle = new SpannableString(answerTitle);
|
answerTitle = new SpannableString(answerTitle);
|
||||||
((SpannableString) answerTitle).setSpan(new ForegroundColorSpan(0xFF00AA00), 0, answerTitle.length(), 0);
|
((SpannableString) answerTitle).setSpan(new ForegroundColorSpan(0xFF00AA00), 0, answerTitle.length(), 0);
|
||||||
}
|
}
|
||||||
PendingIntent answerPendingIntent = PendingIntent.getBroadcast(this, 0, answerIntent, PendingIntent.FLAG_CANCEL_CURRENT);
|
PendingIntent answerPendingIntent = PendingIntent.getBroadcast(this, 0, answerIntent, PendingIntent.FLAG_MUTABLE | PendingIntent.FLAG_CANCEL_CURRENT);
|
||||||
builder.addAction(R.drawable.ic_call, answerTitle, answerPendingIntent);
|
builder.addAction(R.drawable.ic_call, answerTitle, answerPendingIntent);
|
||||||
builder.setPriority(Notification.PRIORITY_MAX);
|
builder.setPriority(Notification.PRIORITY_MAX);
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
|
||||||
|
@ -3989,7 +3988,7 @@ public class VoIPService extends Service implements SensorEventListener, AudioMa
|
||||||
builder.setColor(0xff2ca5e0);
|
builder.setColor(0xff2ca5e0);
|
||||||
builder.setVibrate(new long[0]);
|
builder.setVibrate(new long[0]);
|
||||||
builder.setCategory(Notification.CATEGORY_CALL);
|
builder.setCategory(Notification.CATEGORY_CALL);
|
||||||
builder.setFullScreenIntent(PendingIntent.getActivity(this, 0, intent, 0), true);
|
builder.setFullScreenIntent(PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_MUTABLE), true);
|
||||||
if (userOrChat instanceof TLRPC.User) {
|
if (userOrChat instanceof TLRPC.User) {
|
||||||
TLRPC.User user = (TLRPC.User) userOrChat;
|
TLRPC.User user = (TLRPC.User) userOrChat;
|
||||||
if (!TextUtils.isEmpty(user.phone)) {
|
if (!TextUtils.isEmpty(user.phone)) {
|
||||||
|
@ -4269,7 +4268,7 @@ public class VoIPService extends Service implements SensorEventListener, AudioMa
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && Build.VERSION.SDK_INT < Build.VERSION_CODES.R && (checkSelfPermission(Manifest.permission.RECORD_AUDIO) != PackageManager.PERMISSION_GRANTED || privateCall.video && checkSelfPermission(Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED)) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && Build.VERSION.SDK_INT < Build.VERSION_CODES.R && (checkSelfPermission(Manifest.permission.RECORD_AUDIO) != PackageManager.PERMISSION_GRANTED || privateCall.video && checkSelfPermission(Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED)) {
|
||||||
try {
|
try {
|
||||||
//intent.addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT);
|
//intent.addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT);
|
||||||
PendingIntent.getActivity(VoIPService.this, 0, new Intent(VoIPService.this, VoIPPermissionActivity.class).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK), PendingIntent.FLAG_ONE_SHOT).send();
|
PendingIntent.getActivity(VoIPService.this, 0, new Intent(VoIPService.this, VoIPPermissionActivity.class).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK), PendingIntent.FLAG_MUTABLE | PendingIntent.FLAG_ONE_SHOT).send();
|
||||||
} catch (Exception x) {
|
} catch (Exception x) {
|
||||||
if (BuildVars.LOGS_ENABLED) {
|
if (BuildVars.LOGS_ENABLED) {
|
||||||
FileLog.e("Error starting permission activity", x);
|
FileLog.e("Error starting permission activity", x);
|
||||||
|
@ -4279,7 +4278,7 @@ public class VoIPService extends Service implements SensorEventListener, AudioMa
|
||||||
}
|
}
|
||||||
acceptIncomingCall();
|
acceptIncomingCall();
|
||||||
try {
|
try {
|
||||||
PendingIntent.getActivity(VoIPService.this, 0, new Intent(VoIPService.this, getUIActivityClass()).setAction("voip"), 0).send();
|
PendingIntent.getActivity(VoIPService.this, 0, new Intent(VoIPService.this, getUIActivityClass()).setAction("voip"), PendingIntent.FLAG_MUTABLE).send();
|
||||||
} catch (Exception x) {
|
} catch (Exception x) {
|
||||||
if (BuildVars.LOGS_ENABLED) {
|
if (BuildVars.LOGS_ENABLED) {
|
||||||
FileLog.e("Error starting incall activity", x);
|
FileLog.e("Error starting incall activity", x);
|
||||||
|
|
|
@ -69,6 +69,7 @@ public class ActionBar extends FrameLayout {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private INavigationLayout.BackButtonState backButtonState;
|
||||||
private ImageView backButtonImageView;
|
private ImageView backButtonImageView;
|
||||||
private Drawable backButtonDrawable;
|
private Drawable backButtonDrawable;
|
||||||
private SimpleTextView[] titleTextView = new SimpleTextView[2];
|
private SimpleTextView[] titleTextView = new SimpleTextView[2];
|
||||||
|
@ -157,6 +158,10 @@ public class ActionBar extends FrameLayout {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public INavigationLayout.BackButtonState getBackButtonState() {
|
||||||
|
return backButtonState;
|
||||||
|
}
|
||||||
|
|
||||||
private void createBackButtonImage() {
|
private void createBackButtonImage() {
|
||||||
if (backButtonImageView != null) {
|
if (backButtonImageView != null) {
|
||||||
return;
|
return;
|
||||||
|
@ -247,6 +252,10 @@ public class ActionBar extends FrameLayout {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean drawChild(Canvas canvas, View child, long drawingTime) {
|
protected boolean drawChild(Canvas canvas, View child, long drawingTime) {
|
||||||
|
if (parentFragment != null && parentFragment.getParentLayout().isActionBarInCrossfade()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
boolean clip = shouldClipChild(child);
|
boolean clip = shouldClipChild(child);
|
||||||
if (clip) {
|
if (clip) {
|
||||||
canvas.save();
|
canvas.save();
|
||||||
|
@ -309,6 +318,9 @@ public class ActionBar extends FrameLayout {
|
||||||
}
|
}
|
||||||
backButtonImageView.setVisibility(resource == 0 ? GONE : VISIBLE);
|
backButtonImageView.setVisibility(resource == 0 ? GONE : VISIBLE);
|
||||||
backButtonImageView.setImageResource(resource);
|
backButtonImageView.setImageResource(resource);
|
||||||
|
if (resource == R.drawable.ic_ab_back) {
|
||||||
|
backButtonState = INavigationLayout.BackButtonState.BACK;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createSubtitleTextView() {
|
private void createSubtitleTextView() {
|
||||||
|
@ -592,6 +604,45 @@ public class ActionBar extends FrameLayout {
|
||||||
return actionMode;
|
return actionMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void onDrawCrossfadeBackground(Canvas canvas) {
|
||||||
|
if (blurredBackground && actionBarColor != Color.TRANSPARENT) {
|
||||||
|
rectTmp.set(0, 0, getMeasuredWidth(), getMeasuredHeight());
|
||||||
|
blurScrimPaint.setColor(actionBarColor);
|
||||||
|
contentView.drawBlurRect(canvas, getY(), rectTmp, blurScrimPaint, true);
|
||||||
|
} else {
|
||||||
|
Drawable drawable = getBackground();
|
||||||
|
if (drawable != null) {
|
||||||
|
drawable.setBounds(0, 0, getWidth(), getHeight());
|
||||||
|
drawable.draw(canvas);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onDrawCrossfadeContent(Canvas canvas, boolean front, boolean hideBackDrawable, float progress) {
|
||||||
|
for (int i = 0; i < getChildCount(); i++) {
|
||||||
|
View ch = getChildAt(i);
|
||||||
|
if ((!hideBackDrawable || ch != backButtonImageView) && ch.getVisibility() == View.VISIBLE && ch instanceof ActionBarMenu) {
|
||||||
|
canvas.save();
|
||||||
|
canvas.translate(ch.getX(), ch.getY());
|
||||||
|
ch.draw(canvas);
|
||||||
|
canvas.restore();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
canvas.save();
|
||||||
|
canvas.translate(front ? getWidth() * progress * 0.5f : -getWidth() * 0.4f * (1f - progress), 0);
|
||||||
|
for (int i = 0; i < getChildCount(); i++) {
|
||||||
|
View ch = getChildAt(i);
|
||||||
|
if ((!hideBackDrawable || ch != backButtonImageView) && ch.getVisibility() == View.VISIBLE && !(ch instanceof ActionBarMenu)) {
|
||||||
|
canvas.save();
|
||||||
|
canvas.translate(ch.getX(), ch.getY());
|
||||||
|
ch.draw(canvas);
|
||||||
|
canvas.restore();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
canvas.restore();
|
||||||
|
}
|
||||||
|
|
||||||
public void showActionMode() {
|
public void showActionMode() {
|
||||||
showActionMode(true, null, null, null, null, null, 0);
|
showActionMode(true, null, null, null, null, null, 0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,6 +87,8 @@ public class ActionBarMenuItem extends FrameLayout {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class ActionBarMenuItemSearchListener {
|
public static class ActionBarMenuItemSearchListener {
|
||||||
|
public void onPreToggleSearch() {}
|
||||||
|
|
||||||
public void onSearchExpand() {
|
public void onSearchExpand() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -144,6 +146,8 @@ public class ActionBarMenuItem extends FrameLayout {
|
||||||
private LinearLayout searchFilterLayout;
|
private LinearLayout searchFilterLayout;
|
||||||
private ArrayList<SearchFilterView> searchFilterViews = new ArrayList<>();
|
private ArrayList<SearchFilterView> searchFilterViews = new ArrayList<>();
|
||||||
private TextView searchFieldCaption;
|
private TextView searchFieldCaption;
|
||||||
|
private CharSequence searchFieldHint;
|
||||||
|
private CharSequence searchFieldText;
|
||||||
private ImageView clearButton;
|
private ImageView clearButton;
|
||||||
private AnimatorSet clearButtonAnimator;
|
private AnimatorSet clearButtonAnimator;
|
||||||
private View searchAdditionalButton;
|
private View searchAdditionalButton;
|
||||||
|
@ -151,6 +155,7 @@ public class ActionBarMenuItem extends FrameLayout {
|
||||||
protected TextView textView;
|
protected TextView textView;
|
||||||
private FrameLayout searchContainer;
|
private FrameLayout searchContainer;
|
||||||
private boolean isSearchField;
|
private boolean isSearchField;
|
||||||
|
private boolean wrapSearchInScrollView;
|
||||||
protected ActionBarMenuItemSearchListener listener;
|
protected ActionBarMenuItemSearchListener listener;
|
||||||
private Rect rect;
|
private Rect rect;
|
||||||
private int[] location;
|
private int[] location;
|
||||||
|
@ -756,6 +761,7 @@ public class ActionBarMenuItem extends FrameLayout {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void openSearch(boolean openKeyboard) {
|
public void openSearch(boolean openKeyboard) {
|
||||||
|
checkCreateSearchField();
|
||||||
if (searchContainer == null || searchContainer.getVisibility() == VISIBLE || parentMenu == null) {
|
if (searchContainer == null || searchContainer.getVisibility() == VISIBLE || parentMenu == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -773,6 +779,10 @@ public class ActionBarMenuItem extends FrameLayout {
|
||||||
AnimatorSet searchContainerAnimator;
|
AnimatorSet searchContainerAnimator;
|
||||||
|
|
||||||
public boolean toggleSearch(boolean openKeyboard) {
|
public boolean toggleSearch(boolean openKeyboard) {
|
||||||
|
checkCreateSearchField();
|
||||||
|
if (listener != null) {
|
||||||
|
listener.onPreToggleSearch();
|
||||||
|
}
|
||||||
if (searchContainer == null || (listener != null && !listener.canToggleSearch())) {
|
if (searchContainer == null || (listener != null && !listener.canToggleSearch())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1090,6 +1100,7 @@ public class ActionBarMenuItem extends FrameLayout {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSearchFieldHint(CharSequence hint) {
|
public void setSearchFieldHint(CharSequence hint) {
|
||||||
|
searchFieldHint = hint;
|
||||||
if (searchFieldCaption == null) {
|
if (searchFieldCaption == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1098,6 +1109,7 @@ public class ActionBarMenuItem extends FrameLayout {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSearchFieldText(CharSequence text, boolean animated) {
|
public void setSearchFieldText(CharSequence text, boolean animated) {
|
||||||
|
searchFieldText = text;
|
||||||
if (searchFieldCaption == null) {
|
if (searchFieldCaption == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1115,6 +1127,7 @@ public class ActionBarMenuItem extends FrameLayout {
|
||||||
}
|
}
|
||||||
|
|
||||||
public EditTextBoldCursor getSearchField() {
|
public EditTextBoldCursor getSearchField() {
|
||||||
|
checkCreateSearchField();
|
||||||
return searchField;
|
return searchField;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1135,7 +1148,13 @@ public class ActionBarMenuItem extends FrameLayout {
|
||||||
if (parentMenu == null) {
|
if (parentMenu == null) {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
if (value && searchContainer == null) {
|
isSearchField = value;
|
||||||
|
wrapSearchInScrollView = wrapInScrollView;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void checkCreateSearchField() {
|
||||||
|
if (searchContainer == null && isSearchField) {
|
||||||
searchContainer = new FrameLayout(getContext()) {
|
searchContainer = new FrameLayout(getContext()) {
|
||||||
|
|
||||||
private boolean ignoreRequestLayout;
|
private boolean ignoreRequestLayout;
|
||||||
|
@ -1166,7 +1185,7 @@ public class ActionBarMenuItem extends FrameLayout {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||||
if (!wrapInScrollView) {
|
if (!wrapSearchInScrollView) {
|
||||||
measureChildWithMargins(clearButton, widthMeasureSpec, 0, heightMeasureSpec, 0);
|
measureChildWithMargins(clearButton, widthMeasureSpec, 0, heightMeasureSpec, 0);
|
||||||
if (searchAdditionalButton != null) {
|
if (searchAdditionalButton != null) {
|
||||||
measureChildWithMargins(searchAdditionalButton, widthMeasureSpec, 0, heightMeasureSpec, 0);
|
measureChildWithMargins(searchAdditionalButton, widthMeasureSpec, 0, heightMeasureSpec, 0);
|
||||||
|
@ -1233,7 +1252,7 @@ public class ActionBarMenuItem extends FrameLayout {
|
||||||
};
|
};
|
||||||
searchContainer.setClipChildren(searchItemPaddingStart != 0);
|
searchContainer.setClipChildren(searchItemPaddingStart != 0);
|
||||||
wrappedSearchFrameLayout = null;
|
wrappedSearchFrameLayout = null;
|
||||||
if (wrapInScrollView) {
|
if (wrapSearchInScrollView) {
|
||||||
wrappedSearchFrameLayout = new FrameLayout(getContext());
|
wrappedSearchFrameLayout = new FrameLayout(getContext());
|
||||||
HorizontalScrollView horizontalScrollView = new HorizontalScrollView(getContext()) {
|
HorizontalScrollView horizontalScrollView = new HorizontalScrollView(getContext()) {
|
||||||
|
|
||||||
|
@ -1402,16 +1421,24 @@ public class ActionBarMenuItem extends FrameLayout {
|
||||||
searchField.setHighlightColor(getThemedColor(Theme.key_chat_inTextSelectionHighlight));
|
searchField.setHighlightColor(getThemedColor(Theme.key_chat_inTextSelectionHighlight));
|
||||||
searchField.setHandlesColor(getThemedColor(Theme.key_chat_TextSelectionCursor));
|
searchField.setHandlesColor(getThemedColor(Theme.key_chat_TextSelectionCursor));
|
||||||
|
|
||||||
|
if (searchFieldHint != null) {
|
||||||
|
searchField.setHint(searchFieldHint);
|
||||||
|
setContentDescription(searchFieldHint);
|
||||||
|
}
|
||||||
|
if (searchFieldText != null) {
|
||||||
|
searchField.setText(searchFieldText);
|
||||||
|
}
|
||||||
|
|
||||||
searchFilterLayout = new LinearLayout(getContext());
|
searchFilterLayout = new LinearLayout(getContext());
|
||||||
searchFilterLayout.setOrientation(LinearLayout.HORIZONTAL);
|
searchFilterLayout.setOrientation(LinearLayout.HORIZONTAL);
|
||||||
searchFilterLayout.setVisibility(View.VISIBLE);
|
searchFilterLayout.setVisibility(View.VISIBLE);
|
||||||
if (!LocaleController.isRTL) {
|
if (!LocaleController.isRTL) {
|
||||||
searchContainer.addView(searchFieldCaption, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, 36, Gravity.CENTER_VERTICAL | Gravity.LEFT, 0, 5.5f, 0, 0));
|
searchContainer.addView(searchFieldCaption, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, 36, Gravity.CENTER_VERTICAL | Gravity.LEFT, 0, 5.5f, 0, 0));
|
||||||
searchContainer.addView(searchField, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 36, Gravity.CENTER_VERTICAL, 6, 0, wrapInScrollView ? 0 : 48, 0));
|
searchContainer.addView(searchField, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 36, Gravity.CENTER_VERTICAL, 6, 0, wrapSearchInScrollView ? 0 : 48, 0));
|
||||||
searchContainer.addView(searchFilterLayout, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, 32, Gravity.CENTER_VERTICAL, 0, 0, 48, 0));
|
searchContainer.addView(searchFilterLayout, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, 32, Gravity.CENTER_VERTICAL, 0, 0, 48, 0));
|
||||||
} else {
|
} else {
|
||||||
searchContainer.addView(searchFilterLayout, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, 32, Gravity.CENTER_VERTICAL, 0, 0, 48, 0));
|
searchContainer.addView(searchFilterLayout, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, 32, Gravity.CENTER_VERTICAL, 0, 0, 48, 0));
|
||||||
searchContainer.addView(searchField, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 36, Gravity.CENTER_VERTICAL, 0, 0, wrapInScrollView ? 0 : 48, 0));
|
searchContainer.addView(searchField, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 36, Gravity.CENTER_VERTICAL, 0, 0, wrapSearchInScrollView ? 0 : 48, 0));
|
||||||
searchContainer.addView(searchFieldCaption, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, 36, Gravity.CENTER_VERTICAL | Gravity.RIGHT, 0, 5.5f, 48, 0));
|
searchContainer.addView(searchFieldCaption, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, 36, Gravity.CENTER_VERTICAL | Gravity.RIGHT, 0, 5.5f, 48, 0));
|
||||||
}
|
}
|
||||||
searchFilterLayout.setClipChildren(false);
|
searchFilterLayout.setClipChildren(false);
|
||||||
|
@ -1474,14 +1501,12 @@ public class ActionBarMenuItem extends FrameLayout {
|
||||||
AndroidUtilities.showKeyboard(searchField);
|
AndroidUtilities.showKeyboard(searchField);
|
||||||
});
|
});
|
||||||
clearButton.setContentDescription(LocaleController.getString("ClearButton", R.string.ClearButton));
|
clearButton.setContentDescription(LocaleController.getString("ClearButton", R.string.ClearButton));
|
||||||
if (wrapInScrollView) {
|
if (wrapSearchInScrollView) {
|
||||||
wrappedSearchFrameLayout.addView(clearButton, LayoutHelper.createFrame(48, LayoutHelper.MATCH_PARENT, Gravity.CENTER_VERTICAL | Gravity.RIGHT));
|
wrappedSearchFrameLayout.addView(clearButton, LayoutHelper.createFrame(48, LayoutHelper.MATCH_PARENT, Gravity.CENTER_VERTICAL | Gravity.RIGHT));
|
||||||
} else {
|
} else {
|
||||||
searchContainer.addView(clearButton, LayoutHelper.createFrame(48, LayoutHelper.MATCH_PARENT, Gravity.CENTER_VERTICAL | Gravity.RIGHT));
|
searchContainer.addView(clearButton, LayoutHelper.createFrame(48, LayoutHelper.MATCH_PARENT, Gravity.CENTER_VERTICAL | Gravity.RIGHT));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
isSearchField = value;
|
|
||||||
return this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public OnClickListener getOnClickListener() {
|
public OnClickListener getOnClickListener() {
|
||||||
|
@ -1632,6 +1657,7 @@ public class ActionBarMenuItem extends FrameLayout {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void clearSearchText() {
|
public void clearSearchText() {
|
||||||
|
searchFieldText = null;
|
||||||
if (searchField == null) {
|
if (searchField == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -153,6 +153,14 @@ public abstract class BaseFragment {
|
||||||
return parentLayout != null && parentLayout.isInPassivePreviewMode();
|
return parentLayout != null && parentLayout.isInPassivePreviewMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isActionBarCrossfadeEnabled() {
|
||||||
|
return actionBar != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public INavigationLayout.BackButtonState getBackButtonState() {
|
||||||
|
return actionBar != null ? actionBar.getBackButtonState() : null;
|
||||||
|
}
|
||||||
|
|
||||||
public void setInPreviewMode(boolean value) {
|
public void setInPreviewMode(boolean value) {
|
||||||
inPreviewMode = value;
|
inPreviewMode = value;
|
||||||
if (actionBar != null) {
|
if (actionBar != null) {
|
||||||
|
|
|
@ -78,6 +78,10 @@ public interface INavigationLayout {
|
||||||
return SharedConfig.useLNavigation ? new LNavigation(context) : new ActionBarLayout(context);
|
return SharedConfig.useLNavigation ? new LNavigation(context) : new ActionBarLayout(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
default boolean isActionBarInCrossfade() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
default boolean hasIntegratedBlurInPreview() {
|
default boolean hasIntegratedBlurInPreview() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -376,4 +380,9 @@ public interface INavigationLayout {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enum BackButtonState {
|
||||||
|
BACK,
|
||||||
|
MENU
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -181,7 +181,7 @@ public class MenuDrawable extends Drawable {
|
||||||
startXDiff += (paint.getStrokeWidth() / 2f) * (1f - currentRotation);
|
startXDiff += (paint.getStrokeWidth() / 2f) * (1f - currentRotation);
|
||||||
endYDiff += AndroidUtilities.dp(.5f) * currentRotation;
|
endYDiff += AndroidUtilities.dp(.5f) * currentRotation;
|
||||||
endXDiff -= AndroidUtilities.dp(.5f) * currentRotation + (paint.getStrokeWidth() / 2f) * (1f - currentRotation);
|
endXDiff -= AndroidUtilities.dp(.5f) * currentRotation + (paint.getStrokeWidth() / 2f) * (1f - currentRotation);
|
||||||
startYDiff -= AndroidUtilities.dp(.25f) * currentRotation;
|
startYDiff -= AndroidUtilities.dp(.75f) * currentRotation;
|
||||||
endYDiff += AndroidUtilities.dp(.25f) * currentRotation;
|
endYDiff += AndroidUtilities.dp(.25f) * currentRotation;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -3117,6 +3117,8 @@ public class Theme {
|
||||||
public static Drawable chat_commentDrawable;
|
public static Drawable chat_commentDrawable;
|
||||||
public static Drawable chat_commentStickerDrawable;
|
public static Drawable chat_commentStickerDrawable;
|
||||||
public static Drawable chat_commentArrowDrawable;
|
public static Drawable chat_commentArrowDrawable;
|
||||||
|
public static Drawable chat_gradientLeftDrawable;
|
||||||
|
public static Drawable chat_gradientRightDrawable;
|
||||||
public static Drawable[] chat_msgInCallDrawable = new Drawable[2];
|
public static Drawable[] chat_msgInCallDrawable = new Drawable[2];
|
||||||
public static Drawable[] chat_msgInCallSelectedDrawable = new Drawable[2];
|
public static Drawable[] chat_msgInCallSelectedDrawable = new Drawable[2];
|
||||||
public static Drawable[] chat_msgOutCallDrawable = new Drawable[2];
|
public static Drawable[] chat_msgOutCallDrawable = new Drawable[2];
|
||||||
|
@ -5043,6 +5045,7 @@ public class Theme {
|
||||||
fallbackKeys.put(key_topics_unreadCounter, key_chats_unreadCounter);
|
fallbackKeys.put(key_topics_unreadCounter, key_chats_unreadCounter);
|
||||||
fallbackKeys.put(key_topics_unreadCounterMuted, key_chats_message);
|
fallbackKeys.put(key_topics_unreadCounterMuted, key_chats_message);
|
||||||
|
|
||||||
|
fallbackKeys.put(key_avatar_background2Saved, key_avatar_backgroundSaved);
|
||||||
fallbackKeys.put(key_avatar_background2Red, key_avatar_backgroundRed);
|
fallbackKeys.put(key_avatar_background2Red, key_avatar_backgroundRed);
|
||||||
fallbackKeys.put(key_avatar_background2Orange, key_avatar_backgroundOrange);
|
fallbackKeys.put(key_avatar_background2Orange, key_avatar_backgroundOrange);
|
||||||
fallbackKeys.put(key_avatar_background2Violet, key_avatar_backgroundViolet);
|
fallbackKeys.put(key_avatar_background2Violet, key_avatar_backgroundViolet);
|
||||||
|
@ -9316,6 +9319,8 @@ public class Theme {
|
||||||
chat_commentDrawable = resources.getDrawable(R.drawable.msg_msgbubble);
|
chat_commentDrawable = resources.getDrawable(R.drawable.msg_msgbubble);
|
||||||
chat_commentStickerDrawable = resources.getDrawable(R.drawable.msg_msgbubble2);
|
chat_commentStickerDrawable = resources.getDrawable(R.drawable.msg_msgbubble2);
|
||||||
chat_commentArrowDrawable = resources.getDrawable(R.drawable.msg_arrowright);
|
chat_commentArrowDrawable = resources.getDrawable(R.drawable.msg_arrowright);
|
||||||
|
chat_gradientLeftDrawable = resources.getDrawable(R.drawable.gradient_left);
|
||||||
|
chat_gradientRightDrawable = resources.getDrawable(R.drawable.gradient_right);
|
||||||
|
|
||||||
chat_contextResult_shadowUnderSwitchDrawable = resources.getDrawable(R.drawable.header_shadow).mutate();
|
chat_contextResult_shadowUnderSwitchDrawable = resources.getDrawable(R.drawable.header_shadow).mutate();
|
||||||
|
|
||||||
|
@ -9641,6 +9646,8 @@ public class Theme {
|
||||||
setDrawableColorByKey(chat_commentDrawable, key_chat_inInstant);
|
setDrawableColorByKey(chat_commentDrawable, key_chat_inInstant);
|
||||||
setDrawableColorByKey(chat_commentStickerDrawable, key_chat_serviceIcon);
|
setDrawableColorByKey(chat_commentStickerDrawable, key_chat_serviceIcon);
|
||||||
setDrawableColorByKey(chat_commentArrowDrawable, key_chat_inInstant);
|
setDrawableColorByKey(chat_commentArrowDrawable, key_chat_inInstant);
|
||||||
|
setDrawableColorByKey(chat_gradientLeftDrawable, key_chat_stickersHintPanel);
|
||||||
|
setDrawableColorByKey(chat_gradientRightDrawable, key_chat_stickersHintPanel);
|
||||||
|
|
||||||
for (int a = 0; a < 2; a++) {
|
for (int a = 0; a < 2; a++) {
|
||||||
setDrawableColorByKey(chat_msgInCallDrawable[a], key_chat_inInstant);
|
setDrawableColorByKey(chat_msgInCallDrawable[a], key_chat_inInstant);
|
||||||
|
|
|
@ -8552,9 +8552,6 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
timeX -= getExtraTimeX();
|
timeX -= getExtraTimeX();
|
||||||
// if (transitionParams != null && !transitionParams.shouldAnimateTimeX) {
|
|
||||||
// transitionParams.lastTimeX = timeX;
|
|
||||||
// }
|
|
||||||
|
|
||||||
if ((currentMessageObject.messageOwner.flags & TLRPC.MESSAGE_FLAG_HAS_VIEWS) != 0) {
|
if ((currentMessageObject.messageOwner.flags & TLRPC.MESSAGE_FLAG_HAS_VIEWS) != 0) {
|
||||||
viewsLayout = new StaticLayout(currentViewsString, Theme.chat_timePaint, viewsTextWidth, Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
|
viewsLayout = new StaticLayout(currentViewsString, Theme.chat_timePaint, viewsTextWidth, Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
|
||||||
|
@ -9745,13 +9742,13 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
}
|
}
|
||||||
reactionsLayoutInBubble.y = getBackgroundDrawableBottom() - AndroidUtilities.dp(10) - reactionsLayoutInBubble.height;
|
reactionsLayoutInBubble.y = getBackgroundDrawableBottom() - AndroidUtilities.dp(10) - reactionsLayoutInBubble.height;
|
||||||
reactionsLayoutInBubble.y -= (drawCommentButton ? AndroidUtilities.dp(43) : 0);
|
reactionsLayoutInBubble.y -= (drawCommentButton ? AndroidUtilities.dp(43) : 0);
|
||||||
if (hasNewLineForTime) {
|
if (hasNewLineForTime && !(drawForwardedName && hasLinkPreview && documentAttachType == DOCUMENT_ATTACH_TYPE_AUDIO)) {
|
||||||
reactionsLayoutInBubble.y -= AndroidUtilities.dp(16);
|
reactionsLayoutInBubble.y -= AndroidUtilities.dp(16);
|
||||||
}
|
}
|
||||||
if (captionLayout != null && ((currentMessageObject.type != MessageObject.TYPE_VOICE && !(currentMessageObject.isOut() && drawForwardedName && !drawPhotoImage) && !(currentMessageObject.type == MessageObject.TYPE_FILE && drawPhotoImage)) || (currentPosition != null && currentMessagesGroup != null))) {
|
if (captionLayout != null && ((currentMessageObject.type != MessageObject.TYPE_VOICE && !(currentMessageObject.isOut() && drawForwardedName && !drawPhotoImage) && !(currentMessageObject.type == MessageObject.TYPE_FILE && drawPhotoImage)) || (currentPosition != null && currentMessagesGroup != null))) {
|
||||||
reactionsLayoutInBubble.y -= AndroidUtilities.dp(14);
|
reactionsLayoutInBubble.y -= AndroidUtilities.dp(14);
|
||||||
}
|
}
|
||||||
reactionsLayoutInBubble.y = reactionsLayoutInBubble.y + reactionsLayoutInBubble.positionOffsetY;
|
reactionsLayoutInBubble.y += reactionsLayoutInBubble.positionOffsetY;
|
||||||
}
|
}
|
||||||
if (reactionsLayoutInBubble.isSmall && !reactionsLayoutInBubble.isEmpty) {
|
if (reactionsLayoutInBubble.isSmall && !reactionsLayoutInBubble.isEmpty) {
|
||||||
int timeYOffset;
|
int timeYOffset;
|
||||||
|
@ -13912,7 +13909,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (drawTopic && (animatingAlpha > 0 && replyForwardAlpha > 0) && (currentPosition == null || currentPosition.minY == 0 && currentPosition.minX == 0)) {
|
if (drawTopic && topicButton != null && (animatingAlpha > 0 && replyForwardAlpha > 0) && (currentPosition == null || currentPosition.minY == 0 && currentPosition.minX == 0)) {
|
||||||
float x, y;
|
float x, y;
|
||||||
if (currentMessageObject.shouldDrawWithoutBackground()) {
|
if (currentMessageObject.shouldDrawWithoutBackground()) {
|
||||||
if (currentMessageObject.isOutOwner()) {
|
if (currentMessageObject.isOutOwner()) {
|
||||||
|
@ -14878,7 +14875,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
reactionsLayoutInBubble.draw(canvas, transitionParams.animateChangeProgress, null);
|
reactionsLayoutInBubble.draw(canvas, transitionParams.animateChangeProgress, null);
|
||||||
}
|
}
|
||||||
if (ChatObject.isChannel(currentChat) && !currentChat.megagroup || (currentMessageObject.messageOwner.flags & TLRPC.MESSAGE_FLAG_HAS_VIEWS) != 0 || (repliesLayout != null || transitionParams.animateReplies) || (isPinned || transitionParams.animatePinned)) {
|
if (ChatObject.isChannel(currentChat) && !currentChat.megagroup || (currentMessageObject.messageOwner.flags & TLRPC.MESSAGE_FLAG_HAS_VIEWS) != 0 || (repliesLayout != null || transitionParams.animateReplies) || (isPinned || transitionParams.animatePinned)) {
|
||||||
additionalX += this.timeWidth - timeLayout.getLineWidth(0);
|
additionalX += timeWidth - timeLayout.getLineWidth(0);
|
||||||
if (reactionsLayoutInBubble.isSmall && !reactionsLayoutInBubble.isEmpty) {
|
if (reactionsLayoutInBubble.isSmall && !reactionsLayoutInBubble.isEmpty) {
|
||||||
additionalX -= reactionsLayoutInBubble.width;
|
additionalX -= reactionsLayoutInBubble.width;
|
||||||
}
|
}
|
||||||
|
@ -18171,7 +18168,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
animateTimeWidth = lastTimeWidth;
|
animateTimeWidth = lastTimeWidth;
|
||||||
changed = true;
|
changed = true;
|
||||||
} else if (timeDrawablesIsChanged || Math.abs(timeX - lastTimeX) > 1) {
|
} else if (timeDrawablesIsChanged || Math.abs(timeX - lastTimeX) > 1) {
|
||||||
shouldAnimateTimeX = true ;
|
shouldAnimateTimeX = true;
|
||||||
animateTimeWidth = lastTimeWidth;
|
animateTimeWidth = lastTimeWidth;
|
||||||
animateFromTimeX = lastTimeX;
|
animateFromTimeX = lastTimeX;
|
||||||
animateFromTimeXViews = lastTimeXViews;
|
animateFromTimeXViews = lastTimeXViews;
|
||||||
|
|
|
@ -1047,9 +1047,9 @@ public class DialogCell extends BaseCell {
|
||||||
updateMessageThumbs();
|
updateMessageThumbs();
|
||||||
messageNameString = getMessageNameString();
|
messageNameString = getMessageNameString();
|
||||||
messageString = formatTopicsNames();
|
messageString = formatTopicsNames();
|
||||||
String restrictionReason = MessagesController.getRestrictionReason(message.messageOwner.restriction_reason);
|
String restrictionReason = message != null ? MessagesController.getRestrictionReason(message.messageOwner.restriction_reason) : null;
|
||||||
buttonString = getMessageStringFormatted(messageFormat, restrictionReason, messageNameString, true);
|
buttonString = message != null ? getMessageStringFormatted(messageFormat, restrictionReason, messageNameString, true) : "";
|
||||||
if (applyName && buttonString.length() >= 0) {
|
if (applyName && buttonString.length() >= 0 && messageNameString != null) {
|
||||||
SpannableStringBuilder spannableStringBuilder = SpannableStringBuilder.valueOf(buttonString);
|
SpannableStringBuilder spannableStringBuilder = SpannableStringBuilder.valueOf(buttonString);
|
||||||
spannableStringBuilder.setSpan(new ForegroundColorSpanThemable(Theme.key_chats_name, resourcesProvider), 0, Math.min(spannableStringBuilder.length(), messageNameString.length() + 1), 0);
|
spannableStringBuilder.setSpan(new ForegroundColorSpanThemable(Theme.key_chats_name, resourcesProvider), 0, Math.min(spannableStringBuilder.length(), messageNameString.length() + 1), 0);
|
||||||
buttonString = spannableStringBuilder;
|
buttonString = spannableStringBuilder;
|
||||||
|
@ -2066,10 +2066,10 @@ public class DialogCell extends BaseCell {
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
CharSequence text = layout.getText();
|
CharSequence text = layout.getText();
|
||||||
if (text instanceof Spannable) {
|
if (text instanceof Spanned) {
|
||||||
FixedWidthSpan[] spans = ((Spannable) text).getSpans(0, text.length(), FixedWidthSpan.class);
|
FixedWidthSpan[] spans = ((Spanned) text).getSpans(0, text.length(), FixedWidthSpan.class);
|
||||||
if (spans != null && spans.length > 0) {
|
if (spans != null && spans.length > 0) {
|
||||||
int spanOffset = ((Spannable) text).getSpanStart(spans[0]);
|
int spanOffset = ((Spanned) text).getSpanStart(spans[0]);
|
||||||
if (spanOffset < 0) {
|
if (spanOffset < 0) {
|
||||||
spanOffset = 0;
|
spanOffset = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -312,6 +312,9 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
private final static boolean DISABLE_PROGRESS_VIEW = true;
|
private final static boolean DISABLE_PROGRESS_VIEW = true;
|
||||||
private final static int SKELETON_DISAPPEAR_MS = 200;
|
private final static int SKELETON_DISAPPEAR_MS = 200;
|
||||||
|
|
||||||
|
private static int SKELETON_LIGHT_OVERLAY_ALPHA = 22;
|
||||||
|
private static float SKELETON_SATURATION = 1.4f;
|
||||||
|
|
||||||
public final static int DEBUG_SHARE_ALERT_MODE_NORMAL = 0,
|
public final static int DEBUG_SHARE_ALERT_MODE_NORMAL = 0,
|
||||||
DEBUG_SHARE_ALERT_MODE_LESS = 1,
|
DEBUG_SHARE_ALERT_MODE_LESS = 1,
|
||||||
DEBUG_SHARE_ALERT_MODE_MORE = 2;
|
DEBUG_SHARE_ALERT_MODE_MORE = 2;
|
||||||
|
@ -682,6 +685,8 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
private int lastSkeletonCount;
|
private int lastSkeletonCount;
|
||||||
private int lastSkeletonMessageCount;
|
private int lastSkeletonMessageCount;
|
||||||
private Paint skeletonPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
private Paint skeletonPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||||
|
private Paint skeletonServicePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||||
|
private ColorMatrix skeletonColorMatrix = new ColorMatrix();
|
||||||
private Theme.MessageDrawable.PathDrawParams skeletonBackgroundCacheParams = new Theme.MessageDrawable.PathDrawParams();
|
private Theme.MessageDrawable.PathDrawParams skeletonBackgroundCacheParams = new Theme.MessageDrawable.PathDrawParams();
|
||||||
private Theme.MessageDrawable skeletonBackgroundDrawable = new Theme.MessageDrawable(Theme.MessageDrawable.TYPE_TEXT, false, false, this::getThemedColor);
|
private Theme.MessageDrawable skeletonBackgroundDrawable = new Theme.MessageDrawable(Theme.MessageDrawable.TYPE_TEXT, false, false, this::getThemedColor);
|
||||||
private long skeletonLastUpdateTime;
|
private long skeletonLastUpdateTime;
|
||||||
|
@ -692,6 +697,15 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
private int skeletonColor0;
|
private int skeletonColor0;
|
||||||
private int skeletonColor1;
|
private int skeletonColor1;
|
||||||
|
|
||||||
|
private Paint skeletonOutlinePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||||
|
private Matrix skeletonOutlineMatrix = new Matrix();
|
||||||
|
private LinearGradient skeletonOutlineGradient;
|
||||||
|
|
||||||
|
{
|
||||||
|
skeletonOutlinePaint.setStyle(Paint.Style.STROKE);
|
||||||
|
skeletonOutlinePaint.setStrokeWidth(AndroidUtilities.dp(1));
|
||||||
|
}
|
||||||
|
|
||||||
private boolean premiumInvoiceBot;
|
private boolean premiumInvoiceBot;
|
||||||
private boolean showScrollToMessageError;
|
private boolean showScrollToMessageError;
|
||||||
private int startLoadFromMessageId;
|
private int startLoadFromMessageId;
|
||||||
|
@ -1037,7 +1051,8 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
@Override
|
@Override
|
||||||
public List<FloatingDebugController.DebugItem> onGetDebugItems() {
|
public List<FloatingDebugController.DebugItem> onGetDebugItems() {
|
||||||
List<FloatingDebugController.DebugItem> items = new ArrayList<>();
|
List<FloatingDebugController.DebugItem> items = new ArrayList<>();
|
||||||
if (currentChat != null && ChatObject.isChannel(currentChat)) {
|
if (ChatObject.isChannel(currentChat)) {
|
||||||
|
items.add(new FloatingDebugController.DebugItem(LocaleController.getString(R.string.DebugShareAlert)));
|
||||||
String mode;
|
String mode;
|
||||||
switch (shareAlertDebugMode) {
|
switch (shareAlertDebugMode) {
|
||||||
default:
|
default:
|
||||||
|
@ -1057,6 +1072,33 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
|
|
||||||
items.add(new FloatingDebugController.DebugItem(LocaleController.getString(R.string.DebugShareAlertTopicsSlowMotion), ()-> shareAlertDebugTopicsSlowMotion = !shareAlertDebugTopicsSlowMotion));
|
items.add(new FloatingDebugController.DebugItem(LocaleController.getString(R.string.DebugShareAlertTopicsSlowMotion), ()-> shareAlertDebugTopicsSlowMotion = !shareAlertDebugTopicsSlowMotion));
|
||||||
}
|
}
|
||||||
|
if (currentUser == null) {
|
||||||
|
items.add(new FloatingDebugController.DebugItem(LocaleController.getString(R.string.DebugMessageSkeletons)));
|
||||||
|
items.add(new FloatingDebugController.DebugItem(LocaleController.getString(R.string.DebugMessageSkeletonsLightOverlayAlpha), 0, 255, new AnimationProperties.FloatProperty("") {
|
||||||
|
@Override
|
||||||
|
public void setValue(Object object, float value) {
|
||||||
|
SKELETON_LIGHT_OVERLAY_ALPHA = (int) value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object get(Object object) {
|
||||||
|
return (float) SKELETON_LIGHT_OVERLAY_ALPHA;
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
items.add(new FloatingDebugController.DebugItem(LocaleController.getString(R.string.DebugMessageSkeletonsSaturation), 1f, 10f, new AnimationProperties.FloatProperty("") {
|
||||||
|
@Override
|
||||||
|
public void setValue(Object object, float value) {
|
||||||
|
SKELETON_SATURATION = value;
|
||||||
|
skeletonColorMatrix.setSaturation(value);
|
||||||
|
skeletonServicePaint.setColorFilter(new ColorMatrixColorFilter(skeletonColorMatrix));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object get(Object object) {
|
||||||
|
return SKELETON_SATURATION;
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
return items;
|
return items;
|
||||||
}
|
}
|
||||||
|
@ -4833,7 +4875,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isSkeletonVisible() {
|
private boolean isSkeletonVisible() {
|
||||||
if (justCreatedTopic) {
|
if (justCreatedTopic || currentUser != null || !SharedConfig.animationsEnabled()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
int childHeight = 0;
|
int childHeight = 0;
|
||||||
|
@ -4849,10 +4891,26 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
checkDispatchHideSkeletons(fragmentBeginToShow);
|
checkDispatchHideSkeletons(fragmentBeginToShow);
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean visible = (!endReached[0] || mergeDialogId != 0 && !endReached[1] || messages.isEmpty()) && loading && maxTop > 0 && (messages.isEmpty() ? animateProgressViewTo : childHeight != 0);
|
boolean visible = (!endReached[0] || mergeDialogId != 0 && !endReached[1] || messages.isEmpty()) && loading && maxTop > chatListViewPaddingTop && (messages.isEmpty() ? animateProgressViewTo : childHeight != 0);
|
||||||
if (!visible && startMessageAppearTransitionMs == 0) {
|
if (!visible && startMessageAppearTransitionMs == 0) {
|
||||||
checkDispatchHideSkeletons(fragmentBeginToShow);
|
checkDispatchHideSkeletons(fragmentBeginToShow);
|
||||||
}
|
}
|
||||||
|
if (SharedConfig.getDevicePerformanceClass() != SharedConfig.PERFORMANCE_CLASS_LOW && !fromPullingDownTransition && !fragmentBeginToShow) {
|
||||||
|
Drawable wallpaper = themeDelegate.getWallpaperDrawable();
|
||||||
|
if (fragmentView != null) {
|
||||||
|
wallpaper = ((SizeNotifierFrameLayout) fragmentView).getBackgroundImage();
|
||||||
|
}
|
||||||
|
if (wallpaper instanceof MotionBackgroundDrawable) {
|
||||||
|
MotionBackgroundDrawable motion = (MotionBackgroundDrawable) wallpaper;
|
||||||
|
if (((MotionBackgroundDrawable) wallpaper).isIndeterminateAnimation() != visible) {
|
||||||
|
motion.setIndeterminateAnimation(visible);
|
||||||
|
motion.setIndeterminateSpeedScale(visible ? 1.5f : 1f);
|
||||||
|
motion.updateAnimation(true);
|
||||||
|
} else if (visible) {
|
||||||
|
motion.updateAnimation(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return visible || startMessageAppearTransitionMs != 0 && System.currentTimeMillis() - startMessageAppearTransitionMs <= SKELETON_DISAPPEAR_MS;
|
return visible || startMessageAppearTransitionMs != 0 && System.currentTimeMillis() - startMessageAppearTransitionMs <= SKELETON_DISAPPEAR_MS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4882,6 +4940,14 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
}
|
}
|
||||||
|
|
||||||
Paint servicePaint = getThemedPaint(Theme.key_paint_chatActionBackground);
|
Paint servicePaint = getThemedPaint(Theme.key_paint_chatActionBackground);
|
||||||
|
if (skeletonServicePaint.getColor() != servicePaint.getColor()) {
|
||||||
|
skeletonServicePaint.setColor(servicePaint.getColor());
|
||||||
|
}
|
||||||
|
if (skeletonServicePaint.getShader() != servicePaint.getShader()) {
|
||||||
|
skeletonServicePaint.setShader(servicePaint.getShader());
|
||||||
|
skeletonColorMatrix.setSaturation(SKELETON_SATURATION);
|
||||||
|
skeletonServicePaint.setColorFilter(new ColorMatrixColorFilter(skeletonColorMatrix));
|
||||||
|
}
|
||||||
|
|
||||||
for (int i = 0; i < getChildCount(); i++) {
|
for (int i = 0; i < getChildCount(); i++) {
|
||||||
View v = getChildAt(i);
|
View v = getChildAt(i);
|
||||||
|
@ -4952,10 +5018,22 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isSkeletonVisible()) {
|
if (isSkeletonVisible()) {
|
||||||
|
boolean drawService = SharedConfig.getDevicePerformanceClass() != SharedConfig.PERFORMANCE_CLASS_LOW && Theme.hasGradientService();
|
||||||
|
boolean darkOverlay = ColorUtils.calculateLuminance(getThemedColor(Theme.key_windowBackgroundWhite)) <= 0.7f && Theme.hasGradientService();
|
||||||
|
boolean blackOverlay = ColorUtils.calculateLuminance(getThemedColor(Theme.key_windowBackgroundWhite)) <= 0.01f && Theme.hasGradientService();
|
||||||
|
if (drawService) {
|
||||||
|
Theme.applyServiceShaderMatrix(getMeasuredWidth(), AndroidUtilities.displaySize.y, 0, getY() - contentPanTranslation);
|
||||||
|
}
|
||||||
|
int wasDarkenAlpha = Theme.chat_actionBackgroundGradientDarkenPaint.getAlpha();
|
||||||
|
if (blackOverlay) {
|
||||||
|
Theme.chat_actionBackgroundGradientDarkenPaint.setAlpha((int) (wasDarkenAlpha * 4f));
|
||||||
|
}
|
||||||
|
|
||||||
float topSkeletonAlpha = startMessageAppearTransitionMs != 0 ? 1f - (System.currentTimeMillis() - startMessageAppearTransitionMs) / (float) SKELETON_DISAPPEAR_MS : 1f;
|
float topSkeletonAlpha = startMessageAppearTransitionMs != 0 ? 1f - (System.currentTimeMillis() - startMessageAppearTransitionMs) / (float) SKELETON_DISAPPEAR_MS : 1f;
|
||||||
int alpha = skeletonPaint.getAlpha();
|
int alpha = skeletonPaint.getAlpha();
|
||||||
int wasServiceAlpha = servicePaint.getAlpha();
|
int wasServiceAlpha = skeletonServicePaint.getAlpha();
|
||||||
servicePaint.setAlpha((int) (wasServiceAlpha * 0.4f * topSkeletonAlpha));
|
int wasOutlineAlpha = skeletonOutlinePaint.getAlpha();
|
||||||
|
skeletonServicePaint.setAlpha((int) (0xFF * topSkeletonAlpha));
|
||||||
skeletonPaint.setAlpha((int) (topSkeletonAlpha * alpha));
|
skeletonPaint.setAlpha((int) (topSkeletonAlpha * alpha));
|
||||||
while (lastTop > blurredViewTopOffset) {
|
while (lastTop > blurredViewTopOffset) {
|
||||||
lastTop -= AndroidUtilities.dp(3f);
|
lastTop -= AndroidUtilities.dp(3f);
|
||||||
|
@ -4982,21 +5060,33 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
|
|
||||||
int bottom = skeleton.lastBottom;
|
int bottom = skeleton.lastBottom;
|
||||||
skeletonBackgroundDrawable.setBounds(noAvatar ? AndroidUtilities.dp(3f) : AndroidUtilities.dp(51), bottom - skeleton.height, skeleton.width, bottom);
|
skeletonBackgroundDrawable.setBounds(noAvatar ? AndroidUtilities.dp(3f) : AndroidUtilities.dp(51), bottom - skeleton.height, skeleton.width, bottom);
|
||||||
Theme.applyServiceShaderMatrix(getMeasuredWidth(), AndroidUtilities.displaySize.y, 0, getY() + skeletonBackgroundDrawable.getBounds().top);
|
if (drawService) {
|
||||||
skeletonBackgroundDrawable.drawCached(canvas, skeletonBackgroundCacheParams, servicePaint);
|
skeletonBackgroundDrawable.drawCached(canvas, skeletonBackgroundCacheParams, skeletonServicePaint);
|
||||||
|
}
|
||||||
skeletonBackgroundDrawable.drawCached(canvas, skeletonBackgroundCacheParams, skeletonPaint);
|
skeletonBackgroundDrawable.drawCached(canvas, skeletonBackgroundCacheParams, skeletonPaint);
|
||||||
|
if (darkOverlay) {
|
||||||
|
skeletonBackgroundDrawable.drawCached(canvas, skeletonBackgroundCacheParams, Theme.chat_actionBackgroundGradientDarkenPaint);
|
||||||
|
}
|
||||||
|
skeletonBackgroundDrawable.drawCached(canvas, skeletonBackgroundCacheParams, skeletonOutlinePaint);
|
||||||
|
|
||||||
if (!noAvatar) {
|
if (!noAvatar) {
|
||||||
Theme.applyServiceShaderMatrix(getMeasuredWidth(), AndroidUtilities.displaySize.y, 0, getY() + bottom - AndroidUtilities.dp(42));
|
if (drawService) {
|
||||||
canvas.drawCircle(AndroidUtilities.dp(48 - 21), bottom - AndroidUtilities.dp(21), AndroidUtilities.dp(21), servicePaint);
|
canvas.drawCircle(AndroidUtilities.dp(48 - 21), bottom - AndroidUtilities.dp(21), AndroidUtilities.dp(21), skeletonServicePaint);
|
||||||
|
}
|
||||||
canvas.drawCircle(AndroidUtilities.dp(48 - 21), bottom - AndroidUtilities.dp(21), AndroidUtilities.dp(21), skeletonPaint);
|
canvas.drawCircle(AndroidUtilities.dp(48 - 21), bottom - AndroidUtilities.dp(21), AndroidUtilities.dp(21), skeletonPaint);
|
||||||
|
if (darkOverlay) {
|
||||||
|
canvas.drawCircle(AndroidUtilities.dp(48 - 21), bottom - AndroidUtilities.dp(21), AndroidUtilities.dp(21), Theme.chat_actionBackgroundGradientDarkenPaint);
|
||||||
|
}
|
||||||
|
canvas.drawCircle(AndroidUtilities.dp(48 - 21), bottom - AndroidUtilities.dp(21), AndroidUtilities.dp(21), skeletonOutlinePaint);
|
||||||
}
|
}
|
||||||
|
|
||||||
lastTop -= skeleton.height;
|
lastTop -= skeleton.height;
|
||||||
}
|
}
|
||||||
|
|
||||||
servicePaint.setAlpha(wasServiceAlpha);
|
skeletonServicePaint.setAlpha(wasServiceAlpha);
|
||||||
skeletonPaint.setAlpha(alpha);
|
skeletonPaint.setAlpha(alpha);
|
||||||
|
skeletonOutlinePaint.setAlpha(wasOutlineAlpha);
|
||||||
|
Theme.chat_actionBackgroundGradientDarkenPaint.setAlpha(wasDarkenAlpha);
|
||||||
invalidated = false;
|
invalidated = false;
|
||||||
invalidate();
|
invalidate();
|
||||||
} else if (System.currentTimeMillis() - startMessageAppearTransitionMs > SKELETON_DISAPPEAR_MS) {
|
} else if (System.currentTimeMillis() - startMessageAppearTransitionMs > SKELETON_DISAPPEAR_MS) {
|
||||||
|
@ -5012,13 +5102,18 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateSkeletonColors() {
|
private void updateSkeletonColors() {
|
||||||
int color0 = ColorUtils.setAlphaComponent(getThemedColor(Theme.key_listSelector), 30);
|
boolean dark = ColorUtils.calculateLuminance(getThemedColor(Theme.key_windowBackgroundWhite)) <= 0.7f;
|
||||||
int color1 = ColorUtils.setAlphaComponent(getThemedColor(Theme.key_listSelector), 20);
|
int color0 = ColorUtils.blendARGB(getThemedColor(Theme.key_listSelector), Color.argb(dark ? 0x21 : 0x03, 0xFF, 0xFF, 0xFF), dark ? 0.9f : 0.5f);
|
||||||
|
int color1 = ColorUtils.setAlphaComponent(getThemedColor(Theme.key_listSelector), dark ? 24 : SKELETON_LIGHT_OVERLAY_ALPHA);
|
||||||
if (skeletonColor1 != color1 || skeletonColor0 != color0) {
|
if (skeletonColor1 != color1 || skeletonColor0 != color0) {
|
||||||
skeletonColor0 = color0;
|
skeletonColor0 = color0;
|
||||||
skeletonColor1 = color1;
|
skeletonColor1 = color1;
|
||||||
skeletonGradient = new LinearGradient(0, 0, skeletonGradientWidth = AndroidUtilities.dp(200), 0, new int[]{color1, color0, color0, color1}, new float[]{0.0f, 0.4f, 0.6f, 1f}, Shader.TileMode.CLAMP);
|
skeletonGradient = new LinearGradient(0, 0, skeletonGradientWidth = AndroidUtilities.dp(200), 0, new int[]{color1, color0, color0, color1}, new float[]{0.0f, 0.4f, 0.6f, 1f}, Shader.TileMode.CLAMP);
|
||||||
skeletonPaint.setShader(skeletonGradient);
|
skeletonPaint.setShader(skeletonGradient);
|
||||||
|
|
||||||
|
int outlineColor = Color.argb(dark ? 0x2B : 0x60, 0xFF, 0xFF, 0xFF);
|
||||||
|
skeletonOutlineGradient = new LinearGradient(0, 0, skeletonGradientWidth, 0, new int[]{Color.TRANSPARENT, outlineColor, outlineColor, Color.TRANSPARENT}, new float[]{0.0f, 0.4f, 0.6f, 1f}, Shader.TileMode.CLAMP);
|
||||||
|
skeletonOutlinePaint.setShader(skeletonOutlineGradient);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5041,6 +5136,10 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
if (skeletonGradient != null) {
|
if (skeletonGradient != null) {
|
||||||
skeletonGradient.setLocalMatrix(skeletonMatrix);
|
skeletonGradient.setLocalMatrix(skeletonMatrix);
|
||||||
}
|
}
|
||||||
|
skeletonOutlineMatrix.setTranslate(skeletonTotalTranslation, 0);
|
||||||
|
if (skeletonOutlineGradient != null) {
|
||||||
|
skeletonOutlineGradient.setLocalMatrix(skeletonOutlineMatrix);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -8907,6 +9006,11 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
return fragmentView;
|
return fragmentView;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public INavigationLayout.BackButtonState getBackButtonState() {
|
||||||
|
return INavigationLayout.BackButtonState.BACK;
|
||||||
|
}
|
||||||
|
|
||||||
public void onPageDownClicked() {
|
public void onPageDownClicked() {
|
||||||
wasManualScroll = true;
|
wasManualScroll = true;
|
||||||
textSelectionHelper.cancelTextSelectionRunnable();
|
textSelectionHelper.cancelTextSelectionRunnable();
|
||||||
|
@ -13018,6 +13122,9 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getHeightForMessage(MessageObject object) {
|
private int getHeightForMessage(MessageObject object) {
|
||||||
|
if (getParentActivity() == null) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
if (dummyMessageCell == null) {
|
if (dummyMessageCell == null) {
|
||||||
dummyMessageCell = new ChatMessageCell(getParentActivity(), true, themeDelegate);
|
dummyMessageCell = new ChatMessageCell(getParentActivity(), true, themeDelegate);
|
||||||
}
|
}
|
||||||
|
@ -22176,7 +22283,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
final ArrayList<Integer> options = new ArrayList<>();
|
final ArrayList<Integer> options = new ArrayList<>();
|
||||||
View optionsView = null;
|
View optionsView = null;
|
||||||
|
|
||||||
if (!getUserConfig().isPremium() && !getMessagesController().premiumLocked && message.getDocument() != null && message.getDocument().size >= 300 * 1024 * 1024 && FileLoader.getInstance(currentAccount).isLoadingFile(FileLoader.getAttachFileName(message.getDocument()))) {
|
if (!getUserConfig().isPremium() && !getMessagesController().premiumLocked && message.getDocument() != null && message.getDocument().size >= 150 * 1024 * 1024 && FileLoader.getInstance(currentAccount).isLoadingFile(FileLoader.getAttachFileName(message.getDocument()))) {
|
||||||
items.add(LocaleController.getString(R.string.PremiumSpeedPromo));
|
items.add(LocaleController.getString(R.string.PremiumSpeedPromo));
|
||||||
options.add(OPTION_SPEED_PROMO);
|
options.add(OPTION_SPEED_PROMO);
|
||||||
icons.add(R.drawable.msg_speed);
|
icons.add(R.drawable.msg_speed);
|
||||||
|
|
|
@ -251,6 +251,9 @@ public class ChatReactionsEditActivity extends BaseFragment implements Notificat
|
||||||
} else {
|
} else {
|
||||||
chatReactions.remove(react.reaction);
|
chatReactions.remove(react.reaction);
|
||||||
if (chatReactions.isEmpty()) {
|
if (chatReactions.isEmpty()) {
|
||||||
|
if (listAdapter != null) {
|
||||||
|
listAdapter.notifyItemRangeRemoved((isChannel ? 1 : 2), 1 + availableReactions.size());
|
||||||
|
}
|
||||||
setCheckedEnableReactionCell(SELECT_TYPE_NONE, true);
|
setCheckedEnableReactionCell(SELECT_TYPE_NONE, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1272,10 +1272,10 @@ public class Bulletin {
|
||||||
|
|
||||||
avatarsImageView = new AvatarsImageView(context, false);
|
avatarsImageView = new AvatarsImageView(context, false);
|
||||||
avatarsImageView.setStyle(AvatarsDrawable.STYLE_MESSAGE_SEEN);
|
avatarsImageView.setStyle(AvatarsDrawable.STYLE_MESSAGE_SEEN);
|
||||||
|
avatarsImageView.setAvatarsTextSize(AndroidUtilities.dp(18));
|
||||||
addView(avatarsImageView, LayoutHelper.createFrameRelatively(24 + 12 + 12 + 8, 48, Gravity.START | Gravity.CENTER_VERTICAL, 12, 0, 0, 0));
|
addView(avatarsImageView, LayoutHelper.createFrameRelatively(24 + 12 + 12 + 8, 48, Gravity.START | Gravity.CENTER_VERTICAL, 12, 0, 0, 0));
|
||||||
|
|
||||||
textView = new LinkSpanDrawable.LinksTextView(context);
|
textView = new LinkSpanDrawable.LinksTextView(context);
|
||||||
textView.setSingleLine();
|
|
||||||
textView.setTypeface(Typeface.SANS_SERIF);
|
textView.setTypeface(Typeface.SANS_SERIF);
|
||||||
textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 15);
|
textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 15);
|
||||||
textView.setEllipsize(TextUtils.TruncateAt.END);
|
textView.setEllipsize(TextUtils.TruncateAt.END);
|
||||||
|
|
|
@ -9,6 +9,7 @@ import android.text.style.ClickableSpan;
|
||||||
import android.util.TypedValue;
|
import android.util.TypedValue;
|
||||||
import android.view.HapticFeedbackConstants;
|
import android.view.HapticFeedbackConstants;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
import android.widget.FrameLayout;
|
import android.widget.FrameLayout;
|
||||||
|
|
||||||
import androidx.annotation.CheckResult;
|
import androidx.annotation.CheckResult;
|
||||||
|
@ -203,10 +204,17 @@ public final class BulletinFactory {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
layout.avatarsImageView.commitTransition(false);
|
layout.avatarsImageView.commitTransition(false);
|
||||||
layout.textView.setSingleLine(true);
|
layout.textView.setSingleLine(false);
|
||||||
layout.textView.setLines(1);
|
layout.textView.setMaxLines(2);
|
||||||
layout.textView.setText(text);
|
layout.textView.setText(text);
|
||||||
layout.textView.setTranslationX(-(3 - count) * AndroidUtilities.dp(12));
|
if (layout.textView.getLayoutParams() instanceof ViewGroup.MarginLayoutParams) {
|
||||||
|
int margin = AndroidUtilities.dp(12 + 56 + 2 - (3 - count) * 12);
|
||||||
|
if (LocaleController.isRTL) {
|
||||||
|
((ViewGroup.MarginLayoutParams) layout.textView.getLayoutParams()).rightMargin = margin;
|
||||||
|
} else {
|
||||||
|
((ViewGroup.MarginLayoutParams) layout.textView.getLayoutParams()).leftMargin = margin;
|
||||||
|
}
|
||||||
|
}
|
||||||
return create(layout, Bulletin.DURATION_LONG);
|
return create(layout, Bulletin.DURATION_LONG);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -216,9 +224,9 @@ public final class BulletinFactory {
|
||||||
text = null;
|
text = null;
|
||||||
} else if (users.size() == 1) {
|
} else if (users.size() == 1) {
|
||||||
if (ChatObject.isChannelAndNotMegaGroup(chat)) {
|
if (ChatObject.isChannelAndNotMegaGroup(chat)) {
|
||||||
text = AndroidUtilities.replaceTags(LocaleController.formatString("HasBeenAddedToChannel", R.string.HasBeenAddedToChannel, "**" + UserObject.getUserName(users.get(0)) + "**"));
|
text = AndroidUtilities.replaceTags(LocaleController.formatString("HasBeenAddedToChannel", R.string.HasBeenAddedToChannel, "**" + UserObject.getFirstName(users.get(0)) + "**"));
|
||||||
} else {
|
} else {
|
||||||
text = AndroidUtilities.replaceTags(LocaleController.formatString("HasBeenAddedToGroup", R.string.HasBeenAddedToGroup, "**" + UserObject.getUserName(users.get(0)) + "**"));
|
text = AndroidUtilities.replaceTags(LocaleController.formatString("HasBeenAddedToGroup", R.string.HasBeenAddedToGroup, "**" + UserObject.getFirstName(users.get(0)) + "**"));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (ChatObject.isChannelAndNotMegaGroup(chat)) {
|
if (ChatObject.isChannelAndNotMegaGroup(chat)) {
|
||||||
|
|
|
@ -930,6 +930,9 @@ public class EmojiPacksAlert extends BottomSheet implements NotificationCenter.N
|
||||||
@Override
|
@Override
|
||||||
public void dismiss() {
|
public void dismiss() {
|
||||||
super.dismiss();
|
super.dismiss();
|
||||||
|
if (customEmojiPacks != null) {
|
||||||
|
customEmojiPacks.recycle();
|
||||||
|
}
|
||||||
NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.startAllHeavyOperations, 4);
|
NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.startAllHeavyOperations, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ import android.view.ViewGroup;
|
||||||
import android.widget.FrameLayout;
|
import android.widget.FrameLayout;
|
||||||
|
|
||||||
import org.telegram.messenger.SharedConfig;
|
import org.telegram.messenger.SharedConfig;
|
||||||
|
import org.telegram.ui.Components.AnimationProperties;
|
||||||
import org.telegram.ui.LaunchActivity;
|
import org.telegram.ui.LaunchActivity;
|
||||||
|
|
||||||
public class FloatingDebugController {
|
public class FloatingDebugController {
|
||||||
|
@ -54,16 +55,34 @@ public class FloatingDebugController {
|
||||||
public static class DebugItem {
|
public static class DebugItem {
|
||||||
final CharSequence title;
|
final CharSequence title;
|
||||||
final DebugItemType type;
|
final DebugItemType type;
|
||||||
final Runnable action;
|
Runnable action;
|
||||||
|
float from;
|
||||||
|
float to;
|
||||||
|
AnimationProperties.FloatProperty floatProperty;
|
||||||
|
|
||||||
public DebugItem(CharSequence title, Runnable action) {
|
public DebugItem(CharSequence title, Runnable action) {
|
||||||
this.type = DebugItemType.SIMPLE;
|
this.type = DebugItemType.SIMPLE;
|
||||||
this.title = title;
|
this.title = title;
|
||||||
this.action = action;
|
this.action = action;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public DebugItem(CharSequence title) {
|
||||||
|
this.type = DebugItemType.HEADER;
|
||||||
|
this.title = title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DebugItem(CharSequence title, float from, float to, AnimationProperties.FloatProperty callback) {
|
||||||
|
this.type = DebugItemType.SEEKBAR;
|
||||||
|
this.title = title;
|
||||||
|
this.from = from;
|
||||||
|
this.to = to;
|
||||||
|
this.floatProperty = callback;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum DebugItemType {
|
public enum DebugItemType {
|
||||||
SIMPLE
|
SIMPLE,
|
||||||
|
HEADER,
|
||||||
|
SEEKBAR
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,10 +7,13 @@ import android.content.SharedPreferences;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
|
import android.graphics.Paint;
|
||||||
import android.graphics.PorterDuff;
|
import android.graphics.PorterDuff;
|
||||||
import android.graphics.PorterDuffColorFilter;
|
import android.graphics.PorterDuffColorFilter;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.text.TextPaint;
|
||||||
import android.util.DisplayMetrics;
|
import android.util.DisplayMetrics;
|
||||||
import android.util.TypedValue;
|
import android.util.TypedValue;
|
||||||
import android.view.GestureDetector;
|
import android.view.GestureDetector;
|
||||||
|
@ -21,6 +24,7 @@ import android.view.View;
|
||||||
import android.view.ViewConfiguration;
|
import android.view.ViewConfiguration;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.view.Window;
|
import android.view.Window;
|
||||||
|
import android.view.accessibility.AccessibilityNodeInfo;
|
||||||
import android.widget.FrameLayout;
|
import android.widget.FrameLayout;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
|
@ -38,6 +42,7 @@ import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
import org.telegram.messenger.AndroidUtilities;
|
import org.telegram.messenger.AndroidUtilities;
|
||||||
|
import org.telegram.messenger.ApplicationLoader;
|
||||||
import org.telegram.messenger.LocaleController;
|
import org.telegram.messenger.LocaleController;
|
||||||
import org.telegram.messenger.NotificationCenter;
|
import org.telegram.messenger.NotificationCenter;
|
||||||
import org.telegram.messenger.R;
|
import org.telegram.messenger.R;
|
||||||
|
@ -45,13 +50,17 @@ import org.telegram.messenger.SharedConfig;
|
||||||
import org.telegram.ui.ActionBar.AlertDialog;
|
import org.telegram.ui.ActionBar.AlertDialog;
|
||||||
import org.telegram.ui.ActionBar.INavigationLayout;
|
import org.telegram.ui.ActionBar.INavigationLayout;
|
||||||
import org.telegram.ui.ActionBar.Theme;
|
import org.telegram.ui.ActionBar.Theme;
|
||||||
|
import org.telegram.ui.Cells.HeaderCell;
|
||||||
|
import org.telegram.ui.Components.AnimationProperties;
|
||||||
import org.telegram.ui.Components.CombinedDrawable;
|
import org.telegram.ui.Components.CombinedDrawable;
|
||||||
import org.telegram.ui.Components.LayoutHelper;
|
import org.telegram.ui.Components.LayoutHelper;
|
||||||
import org.telegram.ui.Components.RecyclerListView;
|
import org.telegram.ui.Components.RecyclerListView;
|
||||||
|
import org.telegram.ui.Components.SeekBarView;
|
||||||
import org.telegram.ui.LaunchActivity;
|
import org.telegram.ui.LaunchActivity;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
public class FloatingDebugView extends FrameLayout implements NotificationCenter.NotificationCenterDelegate {
|
public class FloatingDebugView extends FrameLayout implements NotificationCenter.NotificationCenterDelegate {
|
||||||
private FrameLayout floatingButtonContainer;
|
private FrameLayout floatingButtonContainer;
|
||||||
|
@ -225,10 +234,16 @@ public class FloatingDebugView extends FrameLayout implements NotificationCenter
|
||||||
switch (FloatingDebugController.DebugItemType.values()[viewType]) {
|
switch (FloatingDebugController.DebugItemType.values()[viewType]) {
|
||||||
default:
|
default:
|
||||||
case SIMPLE:
|
case SIMPLE:
|
||||||
v = new AlertDialog.AlertDialogCell(context, null);
|
v = new AlertDialog.AlertDialogCell(context, null);
|
||||||
v.setLayoutParams(new RecyclerView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
|
break;
|
||||||
break;
|
case HEADER:
|
||||||
|
v = new HeaderCell(context);
|
||||||
|
break;
|
||||||
|
case SEEKBAR:
|
||||||
|
v = new SeekBarCell(context);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
v.setLayoutParams(new RecyclerView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
|
||||||
return new RecyclerListView.Holder(v);
|
return new RecyclerListView.Holder(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -236,11 +251,28 @@ public class FloatingDebugView extends FrameLayout implements NotificationCenter
|
||||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
|
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
|
||||||
FloatingDebugController.DebugItem item = debugItems.get(position);
|
FloatingDebugController.DebugItem item = debugItems.get(position);
|
||||||
switch (item.type) {
|
switch (item.type) {
|
||||||
case SIMPLE:
|
case SIMPLE: {
|
||||||
AlertDialog.AlertDialogCell cell = (AlertDialog.AlertDialogCell) holder.itemView;
|
AlertDialog.AlertDialogCell cell = (AlertDialog.AlertDialogCell) holder.itemView;
|
||||||
cell.setTextColor(Theme.getColor(Theme.key_dialogTextBlack));
|
cell.setTextColor(Theme.getColor(Theme.key_dialogTextBlack));
|
||||||
cell.setTextAndIcon(item.title, 0);
|
cell.setTextAndIcon(item.title, 0);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
case HEADER: {
|
||||||
|
HeaderCell cell = (HeaderCell) holder.itemView;
|
||||||
|
cell.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlueHeader));
|
||||||
|
cell.setText(item.title);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case SEEKBAR: {
|
||||||
|
SeekBarCell cell = (SeekBarCell) holder.itemView;
|
||||||
|
cell.title = item.title.toString();
|
||||||
|
cell.value = (float) item.floatProperty.get(null);
|
||||||
|
cell.min = item.from;
|
||||||
|
cell.max = item.to;
|
||||||
|
cell.callback = item.floatProperty;
|
||||||
|
cell.invalidate();
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -450,6 +482,7 @@ public class FloatingDebugView extends FrameLayout implements NotificationCenter
|
||||||
|
|
||||||
private List<FloatingDebugController.DebugItem> getBuiltInDebugItems() {
|
private List<FloatingDebugController.DebugItem> getBuiltInDebugItems() {
|
||||||
List<FloatingDebugController.DebugItem> items = new ArrayList<>();
|
List<FloatingDebugController.DebugItem> items = new ArrayList<>();
|
||||||
|
items.add(new FloatingDebugController.DebugItem(LocaleController.getString(R.string.DebugGeneral)));
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
||||||
items.add(new FloatingDebugController.DebugItem(LocaleController.getString(SharedConfig.debugWebView ? R.string.DebugMenuDisableWebViewDebug : R.string.DebugMenuEnableWebViewDebug), ()->{
|
items.add(new FloatingDebugController.DebugItem(LocaleController.getString(SharedConfig.debugWebView ? R.string.DebugMenuDisableWebViewDebug : R.string.DebugMenuEnableWebViewDebug), ()->{
|
||||||
SharedConfig.toggleDebugWebView();
|
SharedConfig.toggleDebugWebView();
|
||||||
|
@ -463,6 +496,37 @@ public class FloatingDebugView extends FrameLayout implements NotificationCenter
|
||||||
((Activity) getContext()).recreate();
|
((Activity) getContext()).recreate();
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
items.add(new FloatingDebugController.DebugItem(Theme.isCurrentThemeDark() ? "Switch to day theme" : "Switch to dark theme", () -> {
|
||||||
|
boolean toDark;
|
||||||
|
|
||||||
|
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("themeconfig", Activity.MODE_PRIVATE);
|
||||||
|
String dayThemeName = preferences.getString("lastDayTheme", "Blue");
|
||||||
|
if (Theme.getTheme(dayThemeName) == null || Theme.getTheme(dayThemeName).isDark()) {
|
||||||
|
dayThemeName = "Blue";
|
||||||
|
}
|
||||||
|
String nightThemeName = preferences.getString("lastDarkTheme", "Dark Blue");
|
||||||
|
if (Theme.getTheme(nightThemeName) == null || !Theme.getTheme(nightThemeName).isDark()) {
|
||||||
|
nightThemeName = "Dark Blue";
|
||||||
|
}
|
||||||
|
Theme.ThemeInfo themeInfo = Theme.getActiveTheme();
|
||||||
|
if (dayThemeName.equals(nightThemeName)) {
|
||||||
|
if (themeInfo.isDark() || dayThemeName.equals("Dark Blue") || dayThemeName.equals("Night")) {
|
||||||
|
dayThemeName = "Blue";
|
||||||
|
} else {
|
||||||
|
nightThemeName = "Dark Blue";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Theme.isCurrentThemeDark()) {
|
||||||
|
themeInfo = Theme.getTheme(nightThemeName);
|
||||||
|
} else {
|
||||||
|
themeInfo = Theme.getTheme(dayThemeName);
|
||||||
|
}
|
||||||
|
Theme.ThemeInfo finalThemeInfo = themeInfo;
|
||||||
|
AndroidUtilities.runOnUIThread(() -> {
|
||||||
|
NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.needSetDayNightTheme, finalThemeInfo, true, null, -1);
|
||||||
|
}, 200);
|
||||||
|
}));
|
||||||
return items;
|
return items;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -511,4 +575,87 @@ public class FloatingDebugView extends FrameLayout implements NotificationCenter
|
||||||
public void dismiss(Runnable callback) {
|
public void dismiss(Runnable callback) {
|
||||||
callback.run();
|
callback.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
private class SeekBarCell extends FrameLayout {
|
||||||
|
|
||||||
|
private SeekBarView seekBar;
|
||||||
|
private float min;
|
||||||
|
private float max;
|
||||||
|
private float value;
|
||||||
|
private AnimationProperties.FloatProperty callback;
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
private TextPaint textPaint;
|
||||||
|
private int lastWidth;
|
||||||
|
|
||||||
|
public SeekBarCell(Context context) {
|
||||||
|
super(context);
|
||||||
|
|
||||||
|
setWillNotDraw(false);
|
||||||
|
|
||||||
|
textPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG);
|
||||||
|
textPaint.setTextSize(AndroidUtilities.dp(16));
|
||||||
|
|
||||||
|
seekBar = new SeekBarView(context);
|
||||||
|
seekBar.setReportChanges(true);
|
||||||
|
seekBar.setDelegate(new SeekBarView.SeekBarViewDelegate() {
|
||||||
|
@Override
|
||||||
|
public void onSeekBarDrag(boolean stop, float progress) {
|
||||||
|
value = min + (max - min) * progress;
|
||||||
|
if (stop) {
|
||||||
|
callback.set(null, value);
|
||||||
|
}
|
||||||
|
invalidate();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSeekBarPressed(boolean pressed) {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CharSequence getContentDescription() {
|
||||||
|
return String.valueOf(Math.round(min + (max - min) * seekBar.getProgress()));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
seekBar.setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_NO);
|
||||||
|
addView(seekBar, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 38, Gravity.LEFT | Gravity.BOTTOM, 5, 5 + 24, 47, 0));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onDraw(Canvas canvas) {
|
||||||
|
textPaint.setColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
|
||||||
|
canvas.drawText(title, AndroidUtilities.dp(24), AndroidUtilities.dp(24), textPaint);
|
||||||
|
|
||||||
|
textPaint.setColor(Theme.getColor(Theme.key_windowBackgroundWhiteValueText));
|
||||||
|
String str = String.format(Locale.ROOT, "%.2f", value);
|
||||||
|
canvas.drawText(str, getMeasuredWidth() - AndroidUtilities.dp(8) - textPaint.measureText(str), AndroidUtilities.dp(28 - 5) + seekBar.getY(), textPaint);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||||
|
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
|
||||||
|
int width = MeasureSpec.getSize(widthMeasureSpec);
|
||||||
|
if (lastWidth != width) {
|
||||||
|
seekBar.setProgress(((float) callback.get(null) - min) / (float) (max - min));
|
||||||
|
lastWidth = width;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void invalidate() {
|
||||||
|
super.invalidate();
|
||||||
|
seekBar.invalidate();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
|
||||||
|
super.onInitializeAccessibilityNodeInfo(info);
|
||||||
|
seekBar.getSeekBarAccessibilityDelegate().onInitializeAccessibilityNodeInfoInternal(this, info);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean performAccessibilityAction(int action, Bundle arguments) {
|
||||||
|
return super.performAccessibilityAction(action, arguments) || seekBar.getSeekBarAccessibilityDelegate().performAccessibilityActionInternal(this, action, arguments);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -110,6 +110,7 @@ public class MotionBackgroundDrawable extends Drawable {
|
||||||
private ColorFilter legacyBitmapColorFilter;
|
private ColorFilter legacyBitmapColorFilter;
|
||||||
private int legacyBitmapColor;
|
private int legacyBitmapColor;
|
||||||
|
|
||||||
|
private float indeterminateSpeedScale = 1f;
|
||||||
private boolean isIndeterminateAnimation;
|
private boolean isIndeterminateAnimation;
|
||||||
private Paint overrideBitmapPaint;
|
private Paint overrideBitmapPaint;
|
||||||
|
|
||||||
|
@ -861,7 +862,7 @@ public class MotionBackgroundDrawable extends Drawable {
|
||||||
float progress;
|
float progress;
|
||||||
boolean isNeedGenerateGradient = postInvalidateParent || rotatingPreview;
|
boolean isNeedGenerateGradient = postInvalidateParent || rotatingPreview;
|
||||||
if (isIndeterminateAnimation) {
|
if (isIndeterminateAnimation) {
|
||||||
posAnimationProgress += dt / 12000f;
|
posAnimationProgress += (dt / 12000f) * indeterminateSpeedScale;
|
||||||
if (posAnimationProgress >= 1.0f) {
|
if (posAnimationProgress >= 1.0f) {
|
||||||
posAnimationProgress = 0.0f;
|
posAnimationProgress = 0.0f;
|
||||||
}
|
}
|
||||||
|
@ -1007,6 +1008,18 @@ public class MotionBackgroundDrawable extends Drawable {
|
||||||
return colors[0] == colors[1] && colors[0] == colors[2] && colors[0] == colors[3];
|
return colors[0] == colors[1] && colors[0] == colors[2] && colors[0] == colors[3];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public float getIndeterminateSpeedScale() {
|
||||||
|
return indeterminateSpeedScale;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIndeterminateSpeedScale(float indeterminateSpeedScale) {
|
||||||
|
this.indeterminateSpeedScale = indeterminateSpeedScale;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isIndeterminateAnimation() {
|
||||||
|
return isIndeterminateAnimation;
|
||||||
|
}
|
||||||
|
|
||||||
public void setIndeterminateAnimation(boolean isIndeterminateAnimation) {
|
public void setIndeterminateAnimation(boolean isIndeterminateAnimation) {
|
||||||
this.isIndeterminateAnimation = isIndeterminateAnimation;
|
this.isIndeterminateAnimation = isIndeterminateAnimation;
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,8 +69,8 @@ public class VideoScreenPreview extends FrameLayout implements PagerHeaderView,
|
||||||
|
|
||||||
MediaMetadataRetriever retriever = new MediaMetadataRetriever();
|
MediaMetadataRetriever retriever = new MediaMetadataRetriever();
|
||||||
retriever.setDataSource(ApplicationLoader.applicationContext, Uri.fromFile(file));
|
retriever.setDataSource(ApplicationLoader.applicationContext, Uri.fromFile(file));
|
||||||
int width = Integer.valueOf(retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_VIDEO_WIDTH));
|
int width = Integer.parseInt(retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_VIDEO_WIDTH));
|
||||||
int height = Integer.valueOf(retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_VIDEO_HEIGHT));
|
int height = Integer.parseInt(retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_VIDEO_HEIGHT));
|
||||||
retriever.release();
|
retriever.release();
|
||||||
aspectRatio = width / (float) height;
|
aspectRatio = width / (float) height;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -48,10 +48,15 @@ public class RLottieDrawable extends BitmapDrawable implements Animatable, Bitma
|
||||||
public boolean skipFrameUpdate;
|
public boolean skipFrameUpdate;
|
||||||
|
|
||||||
public static native long create(String src, String json, int w, int h, int[] params, boolean precache, int[] colorReplacement, boolean limitFps, int fitzModifier);
|
public static native long create(String src, String json, int w, int h, int[] params, boolean precache, int[] colorReplacement, boolean limitFps, int fitzModifier);
|
||||||
|
|
||||||
protected static native long createWithJson(String json, String name, int[] params, int[] colorReplacement);
|
protected static native long createWithJson(String json, String name, int[] params, int[] colorReplacement);
|
||||||
|
|
||||||
public static native void destroy(long ptr);
|
public static native void destroy(long ptr);
|
||||||
|
|
||||||
private static native void setLayerColor(long ptr, String layer, int color);
|
private static native void setLayerColor(long ptr, String layer, int color);
|
||||||
|
|
||||||
private static native void replaceColors(long ptr, int[] colorReplacement);
|
private static native void replaceColors(long ptr, int[] colorReplacement);
|
||||||
|
|
||||||
public static native int getFrame(long ptr, int frame, Bitmap bitmap, int w, int h, int stride, boolean clear);
|
public static native int getFrame(long ptr, int frame, Bitmap bitmap, int w, int h, int stride, boolean clear);
|
||||||
|
|
||||||
protected final int width;
|
protected final int width;
|
||||||
|
@ -177,9 +182,13 @@ public class RLottieDrawable extends BitmapDrawable implements Animatable, Bitma
|
||||||
}
|
}
|
||||||
BitmapsCache.incrementTaskCounter();
|
BitmapsCache.incrementTaskCounter();
|
||||||
lottieCacheGenerateQueue.postRunnable(cacheGenerateTask = () -> {
|
lottieCacheGenerateQueue.postRunnable(cacheGenerateTask = () -> {
|
||||||
BitmapsCache bitmapsCacheFinal = bitmapsCache;
|
try {
|
||||||
if (bitmapsCacheFinal != null) {
|
BitmapsCache bitmapsCacheFinal = bitmapsCache;
|
||||||
bitmapsCacheFinal.createCache();
|
if (bitmapsCacheFinal != null) {
|
||||||
|
bitmapsCacheFinal.createCache();
|
||||||
|
}
|
||||||
|
} catch (Throwable throwable) {
|
||||||
|
|
||||||
}
|
}
|
||||||
uiHandler.post(uiRunnableCacheFinished);
|
uiHandler.post(uiRunnableCacheFinished);
|
||||||
});
|
});
|
||||||
|
@ -267,6 +276,7 @@ public class RLottieDrawable extends BitmapDrawable implements Animatable, Bitma
|
||||||
private boolean genCacheSend;
|
private boolean genCacheSend;
|
||||||
protected Runnable loadFrameRunnable = new Runnable() {
|
protected Runnable loadFrameRunnable = new Runnable() {
|
||||||
private long lastUpdate = 0;
|
private long lastUpdate = 0;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (isRecycled) {
|
if (isRecycled) {
|
||||||
|
@ -717,7 +727,6 @@ public class RLottieDrawable extends BitmapDrawable implements Animatable, Bitma
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
parentViews.add(parent);
|
parentViews.add(parent);
|
||||||
checkCacheCancel();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeParentView(ImageReceiver parent) {
|
public void removeParentView(ImageReceiver parent) {
|
||||||
|
@ -729,6 +738,7 @@ public class RLottieDrawable extends BitmapDrawable implements Animatable, Bitma
|
||||||
}
|
}
|
||||||
|
|
||||||
private Runnable cancelCache;
|
private Runnable cancelCache;
|
||||||
|
|
||||||
public void checkCacheCancel() {
|
public void checkCacheCancel() {
|
||||||
if (bitmapsCache == null || lottieCacheGenerateQueue == null || cacheGenerateTask == null) {
|
if (bitmapsCache == null || lottieCacheGenerateQueue == null || cacheGenerateTask == null) {
|
||||||
return;
|
return;
|
||||||
|
@ -739,17 +749,14 @@ public class RLottieDrawable extends BitmapDrawable implements Animatable, Bitma
|
||||||
} else {
|
} else {
|
||||||
mustCancel = mustCancel && masterParent == null;
|
mustCancel = mustCancel && masterParent == null;
|
||||||
}
|
}
|
||||||
if (mustCancel && cancelCache == null) {
|
if (mustCancel) {
|
||||||
AndroidUtilities.runOnUIThread(cancelCache = () -> {
|
if (cacheGenerateTask != null) {
|
||||||
lottieCacheGenerateQueue.cancelRunnable(cacheGenerateTask);
|
lottieCacheGenerateQueue.cancelRunnable(cacheGenerateTask);
|
||||||
if (bitmapsCache != null) {
|
|
||||||
bitmapsCache.cancelCreate();
|
|
||||||
}
|
|
||||||
BitmapsCache.decrementTaskCounter();
|
BitmapsCache.decrementTaskCounter();
|
||||||
}, 600);
|
cacheGenerateTask = null;
|
||||||
} else if (!mustCancel && cancelCache != null) {
|
}
|
||||||
AndroidUtilities.cancelRunOnUIThread(cancelCache);
|
generatingCache = false;
|
||||||
cancelCache = null;
|
genCacheSend = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1315,33 +1322,30 @@ public class RLottieDrawable extends BitmapDrawable implements Animatable, Bitma
|
||||||
AndroidUtilities.runOnUIThread(onReady);
|
AndroidUtilities.runOnUIThread(onReady);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
loadFrameRunnableQueue.execute(() -> {
|
|
||||||
if (bitmapsCache.cacheExist()) {
|
generatingCache = true;
|
||||||
AndroidUtilities.runOnUIThread(onReady);
|
if (lottieCacheGenerateQueue == null) {
|
||||||
} else {
|
createCacheGenQueue();
|
||||||
AndroidUtilities.runOnUIThread(() -> {
|
}
|
||||||
generatingCache = true;
|
if (cacheGenerateTask == null) {
|
||||||
if (lottieCacheGenerateQueue == null) {
|
BitmapsCache.incrementTaskCounter();
|
||||||
createCacheGenQueue();
|
lottieCacheGenerateQueue.postRunnable(cacheGenerateTask = () -> {
|
||||||
|
try {
|
||||||
|
BitmapsCache bitmapsCacheFinal = bitmapsCache;
|
||||||
|
if (bitmapsCacheFinal != null) {
|
||||||
|
bitmapsCacheFinal.createCache();
|
||||||
}
|
}
|
||||||
if (cacheGenerateTask == null) {
|
} catch (Throwable e) {
|
||||||
BitmapsCache.incrementTaskCounter();
|
FileLog.e(e);
|
||||||
lottieCacheGenerateQueue.postRunnable(cacheGenerateTask = () -> {
|
}
|
||||||
BitmapsCache bitmapsCacheFinal = bitmapsCache;
|
AndroidUtilities.runOnUIThread(() -> {
|
||||||
if (bitmapsCacheFinal != null) {
|
onReady.run();
|
||||||
bitmapsCacheFinal.createCache();
|
if (cacheGenerateTask != null) {
|
||||||
}
|
cacheGenerateTask = null;
|
||||||
AndroidUtilities.runOnUIThread(() -> {
|
BitmapsCache.decrementTaskCounter();
|
||||||
onReady.run();
|
|
||||||
if (cacheGenerateTask != null) {
|
|
||||||
cacheGenerateTask = null;
|
|
||||||
BitmapsCache.decrementTaskCounter();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
});
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -386,9 +386,10 @@ public class ReactedUsersListView extends FrameLayout {
|
||||||
titleView.setTextColor(Theme.getColor(Theme.key_actionBarDefaultSubmenuItem));
|
titleView.setTextColor(Theme.getColor(Theme.key_actionBarDefaultSubmenuItem));
|
||||||
titleView.setEllipsizeByGradient(true);
|
titleView.setEllipsizeByGradient(true);
|
||||||
titleView.setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_NO);
|
titleView.setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_NO);
|
||||||
titleView.setWidthWrapContent(true);
|
|
||||||
titleView.setPadding(0, AndroidUtilities.dp(12), 0, AndroidUtilities.dp(12));
|
titleView.setPadding(0, AndroidUtilities.dp(12), 0, AndroidUtilities.dp(12));
|
||||||
addView(titleView, LayoutHelper.createFrameRelatively(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.START | Gravity.CENTER_VERTICAL, 58, 0, 36 + 6, 0));
|
titleView.setRightPadding(AndroidUtilities.dp(30));
|
||||||
|
titleView.setTranslationX(LocaleController.isRTL ? AndroidUtilities.dp(30) : 0);
|
||||||
|
addView(titleView, LayoutHelper.createFrameRelatively(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.FILL_HORIZONTAL | Gravity.CENTER_VERTICAL, 58, 0, 12, 0));
|
||||||
|
|
||||||
reactView = new BackupImageView(context);
|
reactView = new BackupImageView(context);
|
||||||
addView(reactView, LayoutHelper.createFrameRelatively(24, 24, Gravity.END | Gravity.CENTER_VERTICAL, 0, 0, 12, 0));
|
addView(reactView, LayoutHelper.createFrameRelatively(24, 24, Gravity.END | Gravity.CENTER_VERTICAL, 0, 0, 12, 0));
|
||||||
|
@ -411,6 +412,7 @@ public class ReactedUsersListView extends FrameLayout {
|
||||||
}
|
}
|
||||||
avatarView.setImage(ImageLocation.getForUser(u, ImageLocation.TYPE_SMALL), "50_50", thumb, u);
|
avatarView.setImage(ImageLocation.getForUser(u, ImageLocation.TYPE_SMALL), "50_50", thumb, u);
|
||||||
|
|
||||||
|
boolean hasReactImage = false;
|
||||||
if (reaction.reaction != null) {
|
if (reaction.reaction != null) {
|
||||||
ReactionsLayoutInBubble.VisibleReaction visibleReaction = ReactionsLayoutInBubble.VisibleReaction.fromTLReaction(reaction.reaction);
|
ReactionsLayoutInBubble.VisibleReaction visibleReaction = ReactionsLayoutInBubble.VisibleReaction.fromTLReaction(reaction.reaction);
|
||||||
if (visibleReaction.emojicon != null) {
|
if (visibleReaction.emojicon != null) {
|
||||||
|
@ -418,17 +420,21 @@ public class ReactedUsersListView extends FrameLayout {
|
||||||
if (r != null) {
|
if (r != null) {
|
||||||
SvgHelper.SvgDrawable svgThumb = DocumentObject.getSvgThumb(r.static_icon.thumbs, Theme.key_windowBackgroundGray, 1.0f);
|
SvgHelper.SvgDrawable svgThumb = DocumentObject.getSvgThumb(r.static_icon.thumbs, Theme.key_windowBackgroundGray, 1.0f);
|
||||||
reactView.setImage(ImageLocation.getForDocument(r.center_icon), "40_40_lastframe", "webp", svgThumb, r);
|
reactView.setImage(ImageLocation.getForDocument(r.center_icon), "40_40_lastframe", "webp", svgThumb, r);
|
||||||
|
hasReactImage = true;
|
||||||
} else {
|
} else {
|
||||||
reactView.setImageDrawable(null);
|
reactView.setImageDrawable(null);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
reactView.setAnimatedEmojiDrawable(new AnimatedEmojiDrawable(AnimatedEmojiDrawable.CACHE_TYPE_MESSAGES, currentAccount, visibleReaction.documentId));
|
reactView.setAnimatedEmojiDrawable(new AnimatedEmojiDrawable(AnimatedEmojiDrawable.CACHE_TYPE_MESSAGES, currentAccount, visibleReaction.documentId));
|
||||||
|
hasReactImage = true;
|
||||||
}
|
}
|
||||||
setContentDescription(LocaleController.formatString("AccDescrReactedWith", R.string.AccDescrReactedWith, UserObject.getUserName(u), reaction.reaction));
|
setContentDescription(LocaleController.formatString("AccDescrReactedWith", R.string.AccDescrReactedWith, UserObject.getUserName(u), reaction.reaction));
|
||||||
} else {
|
} else {
|
||||||
reactView.setImageDrawable(null);
|
reactView.setImageDrawable(null);
|
||||||
setContentDescription(LocaleController.formatString("AccDescrPersonHasSeen", R.string.AccDescrPersonHasSeen, UserObject.getUserName(u)));
|
setContentDescription(LocaleController.formatString("AccDescrPersonHasSeen", R.string.AccDescrPersonHasSeen, UserObject.getUserName(u)));
|
||||||
}
|
}
|
||||||
|
titleView.setRightPadding(AndroidUtilities.dp(hasReactImage ? 30 : 0));
|
||||||
|
titleView.setTranslationX(hasReactImage && LocaleController.isRTL ? AndroidUtilities.dp(30) : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -66,6 +66,7 @@ import java.util.ArrayList;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
|
@SuppressWarnings("JavaReflectionMemberAccess")
|
||||||
public class RecyclerListView extends RecyclerView {
|
public class RecyclerListView extends RecyclerView {
|
||||||
public final static int SECTIONS_TYPE_SIMPLE = 0,
|
public final static int SECTIONS_TYPE_SIMPLE = 0,
|
||||||
SECTIONS_TYPE_STICKY_HEADERS = 1,
|
SECTIONS_TYPE_STICKY_HEADERS = 1,
|
||||||
|
@ -181,6 +182,18 @@ public class RecyclerListView extends RecyclerView {
|
||||||
|
|
||||||
private boolean accessibilityEnabled = true;
|
private boolean accessibilityEnabled = true;
|
||||||
|
|
||||||
|
private final static Method initializeScrollbars;
|
||||||
|
|
||||||
|
static {
|
||||||
|
Method notSoFinalInitializeScrollbars;
|
||||||
|
try {
|
||||||
|
notSoFinalInitializeScrollbars = android.view.View.class.getDeclaredMethod("initializeScrollbars", TypedArray.class);
|
||||||
|
} catch (Exception ignored) {
|
||||||
|
notSoFinalInitializeScrollbars = null;
|
||||||
|
}
|
||||||
|
initializeScrollbars = notSoFinalInitializeScrollbars;
|
||||||
|
}
|
||||||
|
|
||||||
private AccessibilityDelegate accessibilityDelegate = new AccessibilityDelegate() {
|
private AccessibilityDelegate accessibilityDelegate = new AccessibilityDelegate() {
|
||||||
@Override
|
@Override
|
||||||
public void onInitializeAccessibilityNodeInfo(View host, AccessibilityNodeInfo info) {
|
public void onInitializeAccessibilityNodeInfo(View host, AccessibilityNodeInfo info) {
|
||||||
|
@ -1367,10 +1380,9 @@ public class RecyclerListView extends RecyclerView {
|
||||||
gotAttributes = true;
|
gotAttributes = true;
|
||||||
}
|
}
|
||||||
TypedArray a = context.getTheme().obtainStyledAttributes(attributes);
|
TypedArray a = context.getTheme().obtainStyledAttributes(attributes);
|
||||||
@SuppressLint("DiscouragedPrivateApi")
|
if (initializeScrollbars != null) {
|
||||||
Method initializeScrollbars = android.view.View.class.getDeclaredMethod("initializeScrollbars", TypedArray.class);
|
initializeScrollbars.invoke(this, a);
|
||||||
initializeScrollbars.invoke(this, a);
|
}
|
||||||
a.recycle();
|
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
FileLog.e(e);
|
FileLog.e(e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -434,7 +434,7 @@ public class SearchViewPager extends ViewPagerFixed implements FilteredSearchVie
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
for (MessageObject obj : selectedFiles.values()) {
|
for (MessageObject obj : selectedFiles.values()) {
|
||||||
if (obj.getDocument() != null && obj.getDocument().size >= 300 * 1024 * 1024) {
|
if (obj.getDocument() != null && obj.getDocument().size >= 150 * 1024 * 1024) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -839,12 +839,23 @@ public class SharedMediaLayout extends FrameLayout implements NotificationCenter
|
||||||
for (int i = 0 ; i < sharedMediaData.length; i++) {
|
for (int i = 0 ; i < sharedMediaData.length; i++) {
|
||||||
allMessages.addAll(sharedMediaData[i].messages);
|
allMessages.addAll(sharedMediaData[i].messages);
|
||||||
}
|
}
|
||||||
Utilities.globalQueue.postRunnable(new Runnable() {
|
String fileName = (String) args[0];
|
||||||
@Override
|
if (fileName != null) {
|
||||||
public void run() {
|
Utilities.globalQueue.postRunnable(new Runnable() {
|
||||||
FileLoader.getInstance(account).checkMediaExistance(allMessages);
|
@Override
|
||||||
}
|
public void run() {
|
||||||
});
|
for (int i = 0; i < allMessages.size(); i++) {
|
||||||
|
if (!fileName.equals(allMessages.get(i).getFileName())) {
|
||||||
|
allMessages.remove(i);
|
||||||
|
i--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (allMessages.size() > 0) {
|
||||||
|
FileLoader.getInstance(account).checkMediaExistance(allMessages);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,6 @@ import org.telegram.messenger.Emoji;
|
||||||
import org.telegram.messenger.MediaDataController;
|
import org.telegram.messenger.MediaDataController;
|
||||||
import org.telegram.messenger.MessageObject;
|
import org.telegram.messenger.MessageObject;
|
||||||
import org.telegram.messenger.NotificationCenter;
|
import org.telegram.messenger.NotificationCenter;
|
||||||
import org.telegram.messenger.R;
|
|
||||||
import org.telegram.messenger.SharedConfig;
|
import org.telegram.messenger.SharedConfig;
|
||||||
import org.telegram.tgnet.TLRPC;
|
import org.telegram.tgnet.TLRPC;
|
||||||
import org.telegram.ui.ActionBar.Theme;
|
import org.telegram.ui.ActionBar.Theme;
|
||||||
|
@ -133,12 +132,6 @@ public class SuggestEmojiView extends FrameLayout implements NotificationCenter.
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this.leftGradient = getResources().getDrawable(R.drawable.gradient_right).mutate();
|
|
||||||
this.leftGradient.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_chat_stickersHintPanel, resourcesProvider), PorterDuff.Mode.MULTIPLY));
|
|
||||||
|
|
||||||
this.rightGradient = getResources().getDrawable(R.drawable.gradient_left).mutate();
|
|
||||||
this.rightGradient.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_chat_stickersHintPanel, resourcesProvider), PorterDuff.Mode.MULTIPLY));
|
|
||||||
|
|
||||||
MediaDataController.getInstance(currentAccount).checkStickers(MediaDataController.TYPE_EMOJIPACKS);
|
MediaDataController.getInstance(currentAccount).checkStickers(MediaDataController.TYPE_EMOJIPACKS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -154,8 +147,8 @@ public class SuggestEmojiView extends FrameLayout implements NotificationCenter.
|
||||||
if (backgroundPaint != null) {
|
if (backgroundPaint != null) {
|
||||||
backgroundPaint.setColor(Theme.getColor(Theme.key_chat_stickersHintPanel, resourcesProvider));
|
backgroundPaint.setColor(Theme.getColor(Theme.key_chat_stickersHintPanel, resourcesProvider));
|
||||||
}
|
}
|
||||||
this.leftGradient.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_chat_stickersHintPanel, resourcesProvider), PorterDuff.Mode.MULTIPLY));
|
Theme.chat_gradientLeftDrawable.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_chat_stickersHintPanel, resourcesProvider), PorterDuff.Mode.MULTIPLY));
|
||||||
this.rightGradient.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_chat_stickersHintPanel, resourcesProvider), PorterDuff.Mode.MULTIPLY));
|
Theme.chat_gradientRightDrawable.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_chat_stickersHintPanel, resourcesProvider), PorterDuff.Mode.MULTIPLY));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void forceClose() {
|
public void forceClose() {
|
||||||
|
@ -423,7 +416,6 @@ public class SuggestEmojiView extends FrameLayout implements NotificationCenter.
|
||||||
private AnimatedFloat showFloat2 = new AnimatedFloat(containerView, 150, 600, CubicBezierInterpolator.EASE_OUT_QUINT);
|
private AnimatedFloat showFloat2 = new AnimatedFloat(containerView, 150, 600, CubicBezierInterpolator.EASE_OUT_QUINT);
|
||||||
private OvershootInterpolator overshootInterpolator = new OvershootInterpolator(.4f);
|
private OvershootInterpolator overshootInterpolator = new OvershootInterpolator(.4f);
|
||||||
|
|
||||||
private Drawable leftGradient, rightGradient;
|
|
||||||
private AnimatedFloat leftGradientAlpha = new AnimatedFloat(containerView, 300, CubicBezierInterpolator.EASE_OUT_QUINT);
|
private AnimatedFloat leftGradientAlpha = new AnimatedFloat(containerView, 300, CubicBezierInterpolator.EASE_OUT_QUINT);
|
||||||
private AnimatedFloat rightGradientAlpha = new AnimatedFloat(containerView, 300, CubicBezierInterpolator.EASE_OUT_QUINT);
|
private AnimatedFloat rightGradientAlpha = new AnimatedFloat(containerView, 300, CubicBezierInterpolator.EASE_OUT_QUINT);
|
||||||
|
|
||||||
|
@ -549,16 +541,16 @@ public class SuggestEmojiView extends FrameLayout implements NotificationCenter.
|
||||||
|
|
||||||
float leftAlpha = leftGradientAlpha.set(listView.canScrollHorizontally(-1) ? 1f : 0f);
|
float leftAlpha = leftGradientAlpha.set(listView.canScrollHorizontally(-1) ? 1f : 0f);
|
||||||
if (leftAlpha > 0) {
|
if (leftAlpha > 0) {
|
||||||
leftGradient.setBounds((int) left, (int) top, (int) left + AndroidUtilities.dp(32), (int) bottom);
|
Theme.chat_gradientLeftDrawable.setBounds((int) left, (int) top, (int) left + AndroidUtilities.dp(32), (int) bottom);
|
||||||
leftGradient.setAlpha((int) (255 * leftAlpha));
|
Theme.chat_gradientLeftDrawable.setAlpha((int) (255 * leftAlpha));
|
||||||
leftGradient.draw(canvas);
|
Theme.chat_gradientLeftDrawable.draw(canvas);
|
||||||
}
|
}
|
||||||
|
|
||||||
float rightAlpha = rightGradientAlpha.set(listView.canScrollHorizontally(1) ? 1f : 0f);
|
float rightAlpha = rightGradientAlpha.set(listView.canScrollHorizontally(1) ? 1f : 0f);
|
||||||
if (rightAlpha > 0) {
|
if (rightAlpha > 0) {
|
||||||
rightGradient.setBounds((int) right - AndroidUtilities.dp(32), (int) top, (int) right, (int) bottom);
|
Theme.chat_gradientRightDrawable.setBounds((int) right - AndroidUtilities.dp(32), (int) top, (int) right, (int) bottom);
|
||||||
rightGradient.setAlpha((int) (255 * rightAlpha));
|
Theme.chat_gradientRightDrawable.setAlpha((int) (255 * rightAlpha));
|
||||||
rightGradient.draw(canvas);
|
Theme.chat_gradientRightDrawable.draw(canvas);
|
||||||
}
|
}
|
||||||
|
|
||||||
canvas.restore();
|
canvas.restore();
|
||||||
|
|
|
@ -46,6 +46,8 @@ public class UnreadCounterTextView extends View {
|
||||||
int counterColor;
|
int counterColor;
|
||||||
CharSequence lastText;
|
CharSequence lastText;
|
||||||
|
|
||||||
|
String textColorKey = Theme.key_chat_fieldOverlayText;
|
||||||
|
|
||||||
public UnreadCounterTextView(Context context) {
|
public UnreadCounterTextView(Context context) {
|
||||||
super(context);
|
super(context);
|
||||||
textPaint.setTextSize(AndroidUtilities.dp(13));
|
textPaint.setTextSize(AndroidUtilities.dp(13));
|
||||||
|
@ -202,7 +204,7 @@ public class UnreadCounterTextView extends View {
|
||||||
@Override
|
@Override
|
||||||
protected void onDraw(Canvas canvas) {
|
protected void onDraw(Canvas canvas) {
|
||||||
Layout layout = textLayout;
|
Layout layout = textLayout;
|
||||||
int color = Theme.getColor(isEnabled() ? Theme.key_chat_fieldOverlayText : Theme.key_windowBackgroundWhiteGrayText, getResourceProvider());
|
int color = Theme.getColor(isEnabled() ? textColorKey : Theme.key_windowBackgroundWhiteGrayText, getResourceProvider());
|
||||||
if (textColor != color) {
|
if (textColor != color) {
|
||||||
layoutPaint.setColor(textColor = color);
|
layoutPaint.setColor(textColor = color);
|
||||||
}
|
}
|
||||||
|
@ -218,8 +220,8 @@ public class UnreadCounterTextView extends View {
|
||||||
if (getParent() != null) {
|
if (getParent() != null) {
|
||||||
int contentWidth = getMeasuredWidth();
|
int contentWidth = getMeasuredWidth();
|
||||||
int x = (getMeasuredWidth() - contentWidth) / 2;
|
int x = (getMeasuredWidth() - contentWidth) / 2;
|
||||||
if (rippleColor != Theme.getColor(Theme.key_chat_fieldOverlayText, getResourceProvider()) || selectableBackground == null) {
|
if (rippleColor != Theme.getColor(textColorKey, getResourceProvider()) || selectableBackground == null) {
|
||||||
selectableBackground = Theme.createSimpleSelectorCircleDrawable(AndroidUtilities.dp(60), 0, ColorUtils.setAlphaComponent(rippleColor = Theme.getColor(Theme.key_chat_fieldOverlayText, getResourceProvider()), 26));
|
selectableBackground = Theme.createSimpleSelectorCircleDrawable(AndroidUtilities.dp(60), 0, ColorUtils.setAlphaComponent(rippleColor = Theme.getColor(textColorKey, getResourceProvider()), 26));
|
||||||
selectableBackground.setCallback(this);
|
selectableBackground.setCallback(this);
|
||||||
}
|
}
|
||||||
int start = (getLeft() + x) <= 0 ? x - AndroidUtilities.dp(20) : x;
|
int start = (getLeft() + x) <= 0 ? x - AndroidUtilities.dp(20) : x;
|
||||||
|
@ -298,4 +300,9 @@ public class UnreadCounterTextView extends View {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setTextColorKey(String textColorKey) {
|
||||||
|
this.textColorKey = textColorKey;
|
||||||
|
invalidate();
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -2208,6 +2208,32 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
||||||
updateProxyButton(false, false);
|
updateProxyButton(false, false);
|
||||||
}
|
}
|
||||||
searchItem = menu.addItem(0, R.drawable.ic_ab_search).setIsSearchField(true, true).setActionBarMenuItemSearchListener(new ActionBarMenuItem.ActionBarMenuItemSearchListener() {
|
searchItem = menu.addItem(0, R.drawable.ic_ab_search).setIsSearchField(true, true).setActionBarMenuItemSearchListener(new ActionBarMenuItem.ActionBarMenuItemSearchListener() {
|
||||||
|
boolean isSpeedItemCreated = false;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPreToggleSearch() {
|
||||||
|
if (!isSpeedItemCreated) {
|
||||||
|
isSpeedItemCreated = true;
|
||||||
|
FrameLayout searchContainer = (FrameLayout) searchItem.getSearchClearButton().getParent();
|
||||||
|
speedItem = new ActionBarMenuItem(context, menu, Theme.getColor(Theme.key_actionBarActionModeDefaultSelector), Theme.getColor(Theme.key_actionBarActionModeDefaultIcon));
|
||||||
|
speedItem.setIcon(R.drawable.avd_speed);
|
||||||
|
speedItem.getIconView().setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_actionBarActionModeDefaultIcon), PorterDuff.Mode.SRC_IN));
|
||||||
|
speedItem.setTranslationX(AndroidUtilities.dp(32));
|
||||||
|
speedItem.setAlpha(0f);
|
||||||
|
speedItem.setOnClickListener(v -> showDialog(new PremiumFeatureBottomSheet(DialogsActivity.this, PremiumPreviewFragment.PREMIUM_FEATURE_DOWNLOAD_SPEED, true)));
|
||||||
|
speedItem.setClickable(false);
|
||||||
|
speedItem.setFixBackground(true);
|
||||||
|
FrameLayout.LayoutParams speedParams = new FrameLayout.LayoutParams(AndroidUtilities.dp(42), ViewGroup.LayoutParams.MATCH_PARENT);
|
||||||
|
speedParams.leftMargin = speedParams.rightMargin = AndroidUtilities.dp(14 + 24);
|
||||||
|
speedParams.gravity = Gravity.RIGHT;
|
||||||
|
searchContainer.addView(speedItem, speedParams);
|
||||||
|
searchItem.setSearchAdditionalButton(speedItem);
|
||||||
|
|
||||||
|
updateSpeedItem(searchViewPager.getCurrentPosition() == 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSearchExpand() {
|
public void onSearchExpand() {
|
||||||
searching = true;
|
searching = true;
|
||||||
|
@ -2313,20 +2339,6 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
||||||
return !actionBar.isActionModeShowed() && databaseMigrationHint == null;
|
return !actionBar.isActionModeShowed() && databaseMigrationHint == null;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
FrameLayout searchContainer = (FrameLayout) searchItem.getSearchClearButton().getParent();
|
|
||||||
speedItem = new ActionBarMenuItem(context, menu, Theme.getColor(Theme.key_actionBarActionModeDefaultSelector), Theme.getColor(Theme.key_actionBarActionModeDefaultIcon));
|
|
||||||
speedItem.setIcon(R.drawable.avd_speed);
|
|
||||||
speedItem.getIconView().setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_actionBarActionModeDefaultIcon), PorterDuff.Mode.SRC_IN));
|
|
||||||
speedItem.setTranslationX(AndroidUtilities.dp(32));
|
|
||||||
speedItem.setAlpha(0f);
|
|
||||||
speedItem.setOnClickListener(v -> showDialog(new PremiumFeatureBottomSheet(this, PremiumPreviewFragment.PREMIUM_FEATURE_DOWNLOAD_SPEED, true)));
|
|
||||||
speedItem.setClickable(false);
|
|
||||||
speedItem.setFixBackground(true);
|
|
||||||
FrameLayout.LayoutParams speedParams = new FrameLayout.LayoutParams(AndroidUtilities.dp(42), ViewGroup.LayoutParams.MATCH_PARENT);
|
|
||||||
speedParams.leftMargin = speedParams.rightMargin = AndroidUtilities.dp(14 + 24);
|
|
||||||
speedParams.gravity = Gravity.RIGHT;
|
|
||||||
searchContainer.addView(speedItem, speedParams);
|
|
||||||
searchItem.setSearchAdditionalButton(speedItem);
|
|
||||||
|
|
||||||
if (initialDialogsType == 2 || initialDialogsType == DIALOGS_TYPE_START_ATTACH_BOT) {
|
if (initialDialogsType == 2 || initialDialogsType == DIALOGS_TYPE_START_ATTACH_BOT) {
|
||||||
searchItem.setVisibility(View.GONE);
|
searchItem.setVisibility(View.GONE);
|
||||||
|
@ -4308,15 +4320,19 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateSpeedItem(boolean visibleByPosition) {
|
public void updateSpeedItem(boolean visibleByPosition) {
|
||||||
|
if (speedItem == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
boolean visibleByDownload = false;
|
boolean visibleByDownload = false;
|
||||||
for (MessageObject obj : getDownloadController().downloadingFiles) {
|
for (MessageObject obj : getDownloadController().downloadingFiles) {
|
||||||
if (obj.getDocument() != null && obj.getDocument().size >= 300 * 1024 * 1024) {
|
if (obj.getDocument() != null && obj.getDocument().size >= 150 * 1024 * 1024) {
|
||||||
visibleByDownload = true;
|
visibleByDownload = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (MessageObject obj : getDownloadController().recentDownloadingFiles) {
|
for (MessageObject obj : getDownloadController().recentDownloadingFiles) {
|
||||||
if (obj.getDocument() != null && obj.getDocument().size >= 300 * 1024 * 1024) {
|
if (obj.getDocument() != null && obj.getDocument().size >= 150 * 1024 * 1024) {
|
||||||
visibleByDownload = true;
|
visibleByDownload = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -8851,6 +8867,14 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
||||||
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_avatar_backgroundBlue));
|
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_avatar_backgroundBlue));
|
||||||
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_avatar_backgroundPink));
|
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_avatar_backgroundPink));
|
||||||
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_avatar_backgroundSaved));
|
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_avatar_backgroundSaved));
|
||||||
|
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_avatar_backgroundRed));
|
||||||
|
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_avatar_background2Orange));
|
||||||
|
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_avatar_background2Violet));
|
||||||
|
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_avatar_background2Green));
|
||||||
|
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_avatar_background2Cyan));
|
||||||
|
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_avatar_background2Blue));
|
||||||
|
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_avatar_background2Pink));
|
||||||
|
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_avatar_background2Saved));
|
||||||
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_avatar_backgroundArchived));
|
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_avatar_backgroundArchived));
|
||||||
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_avatar_backgroundArchivedHidden));
|
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_avatar_backgroundArchivedHidden));
|
||||||
|
|
||||||
|
@ -9237,6 +9261,11 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public INavigationLayout.BackButtonState getBackButtonState() {
|
||||||
|
return INavigationLayout.BackButtonState.MENU;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setProgressToDrawerOpened(float progress) {
|
public void setProgressToDrawerOpened(float progress) {
|
||||||
if (SharedConfig.getDevicePerformanceClass() == SharedConfig.PERFORMANCE_CLASS_LOW || isSlideBackTransition) {
|
if (SharedConfig.getDevicePerformanceClass() == SharedConfig.PERFORMANCE_CLASS_LOW || isSlideBackTransition) {
|
||||||
|
@ -9290,6 +9319,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
||||||
@Override
|
@Override
|
||||||
public List<FloatingDebugController.DebugItem> onGetDebugItems() {
|
public List<FloatingDebugController.DebugItem> onGetDebugItems() {
|
||||||
return Arrays.asList(
|
return Arrays.asList(
|
||||||
|
new FloatingDebugController.DebugItem(LocaleController.getString(R.string.DebugDialogsActivity)),
|
||||||
new FloatingDebugController.DebugItem(LocaleController.getString(R.string.ClearLocalDatabase), () -> {
|
new FloatingDebugController.DebugItem(LocaleController.getString(R.string.ClearLocalDatabase), () -> {
|
||||||
getMessagesStorage().clearLocalDatabase();
|
getMessagesStorage().clearLocalDatabase();
|
||||||
Toast.makeText(getContext(), LocaleController.getString(R.string.DebugClearLocalDatabaseSuccess), Toast.LENGTH_SHORT).show();
|
Toast.makeText(getContext(), LocaleController.getString(R.string.DebugClearLocalDatabaseSuccess), Toast.LENGTH_SHORT).show();
|
||||||
|
|
|
@ -135,7 +135,7 @@ public class DownloadProgressIcon extends View implements NotificationCenter.Not
|
||||||
protected void onDetachedFromWindow() {
|
protected void onDetachedFromWindow() {
|
||||||
super.onDetachedFromWindow();
|
super.onDetachedFromWindow();
|
||||||
detachCurrentListeners();
|
detachCurrentListeners();
|
||||||
NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.onDownloadingFilesChanged);
|
NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.onDownloadingFilesChanged);
|
||||||
downloadImageReceiver.onDetachedFromWindow();
|
downloadImageReceiver.onDetachedFromWindow();
|
||||||
downloadCompleteImageReceiver.onDetachedFromWindow();
|
downloadCompleteImageReceiver.onDetachedFromWindow();
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,6 +55,7 @@ import org.telegram.ui.ActionBar.BaseFragment;
|
||||||
import org.telegram.ui.ActionBar.BottomSheet;
|
import org.telegram.ui.ActionBar.BottomSheet;
|
||||||
import org.telegram.ui.ActionBar.DrawerLayoutContainer;
|
import org.telegram.ui.ActionBar.DrawerLayoutContainer;
|
||||||
import org.telegram.ui.ActionBar.INavigationLayout;
|
import org.telegram.ui.ActionBar.INavigationLayout;
|
||||||
|
import org.telegram.ui.ActionBar.MenuDrawable;
|
||||||
import org.telegram.ui.ActionBar.Theme;
|
import org.telegram.ui.ActionBar.Theme;
|
||||||
import org.telegram.ui.ActionBar.ThemeDescription;
|
import org.telegram.ui.ActionBar.ThemeDescription;
|
||||||
import org.telegram.ui.Cells.CheckBoxCell;
|
import org.telegram.ui.Cells.CheckBoxCell;
|
||||||
|
@ -72,6 +73,7 @@ import java.util.Locale;
|
||||||
|
|
||||||
public class LNavigation extends FrameLayout implements INavigationLayout, FloatingDebugProvider {
|
public class LNavigation extends FrameLayout implements INavigationLayout, FloatingDebugProvider {
|
||||||
private final static boolean ALLOW_OPEN_STIFFNESS_CONTROL = false;
|
private final static boolean ALLOW_OPEN_STIFFNESS_CONTROL = false;
|
||||||
|
private final static boolean USE_ACTIONBAR_CROSSFADE = false;
|
||||||
private static float SPRING_STIFFNESS = 1000f;
|
private static float SPRING_STIFFNESS = 1000f;
|
||||||
private static float SPRING_DAMPING_RATIO = 1f;
|
private static float SPRING_DAMPING_RATIO = 1f;
|
||||||
private final static float SPRING_STIFFNESS_PREVIEW = 650f;
|
private final static float SPRING_STIFFNESS_PREVIEW = 650f;
|
||||||
|
@ -225,6 +227,11 @@ public class LNavigation extends FrameLayout implements INavigationLayout, Float
|
||||||
*/
|
*/
|
||||||
private Paint blurPaint = new Paint(Paint.DITHER_FLAG | Paint.ANTI_ALIAS_FLAG);
|
private Paint blurPaint = new Paint(Paint.DITHER_FLAG | Paint.ANTI_ALIAS_FLAG);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Back button drawable
|
||||||
|
*/
|
||||||
|
private MenuDrawable menuDrawable = new MenuDrawable(MenuDrawable.TYPE_DEFAULT);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* View that captured current touch input
|
* View that captured current touch input
|
||||||
*/
|
*/
|
||||||
|
@ -299,6 +306,8 @@ public class LNavigation extends FrameLayout implements INavigationLayout, Float
|
||||||
dimmPaint.setColor(0x7a000000);
|
dimmPaint.setColor(0x7a000000);
|
||||||
setWillNotDraw(false);
|
setWillNotDraw(false);
|
||||||
|
|
||||||
|
menuDrawable.setRoundCap();
|
||||||
|
|
||||||
int touchSlop = ViewConfiguration.get(context).getScaledTouchSlop();
|
int touchSlop = ViewConfiguration.get(context).getScaledTouchSlop();
|
||||||
gestureDetector = new GestureDetectorCompat(context, new GestureDetector.SimpleOnGestureListener() {
|
gestureDetector = new GestureDetectorCompat(context, new GestureDetector.SimpleOnGestureListener() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -360,6 +369,8 @@ public class LNavigation extends FrameLayout implements INavigationLayout, Float
|
||||||
getChildAt(i).dispatchTouchEvent(e);
|
getChildAt(i).dispatchTouchEvent(e);
|
||||||
}
|
}
|
||||||
e.recycle();
|
e.recycle();
|
||||||
|
|
||||||
|
invalidateActionBars();
|
||||||
} else {
|
} else {
|
||||||
isSwipeDisallowed = true;
|
isSwipeDisallowed = true;
|
||||||
}
|
}
|
||||||
|
@ -488,9 +499,6 @@ public class LNavigation extends FrameLayout implements INavigationLayout, Float
|
||||||
}
|
}
|
||||||
|
|
||||||
fragment.onTransitionAnimationStart(true, true);
|
fragment.onTransitionAnimationStart(true, true);
|
||||||
if (bgFragment != null) {
|
|
||||||
bgFragment.onTransitionAnimationStart(false, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
FloatValueHolder valueHolder = new FloatValueHolder(swipeProgress * SPRING_MULTIPLIER);
|
FloatValueHolder valueHolder = new FloatValueHolder(swipeProgress * SPRING_MULTIPLIER);
|
||||||
currentSpringAnimation = new SpringAnimation(valueHolder)
|
currentSpringAnimation = new SpringAnimation(valueHolder)
|
||||||
|
@ -501,16 +509,10 @@ public class LNavigation extends FrameLayout implements INavigationLayout, Float
|
||||||
swipeProgress = value / SPRING_MULTIPLIER;
|
swipeProgress = value / SPRING_MULTIPLIER;
|
||||||
invalidateTranslation();
|
invalidateTranslation();
|
||||||
fragment.onTransitionAnimationProgress(true, 1f - swipeProgress);
|
fragment.onTransitionAnimationProgress(true, 1f - swipeProgress);
|
||||||
if (bgFragment != null) {
|
|
||||||
bgFragment.onTransitionAnimationProgress(false, 1f - swipeProgress);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
Runnable onEnd = ()->{
|
Runnable onEnd = ()->{
|
||||||
fragment.onTransitionAnimationEnd(true, true);
|
fragment.onTransitionAnimationEnd(true, true);
|
||||||
fragment.prepareFragmentToSlide(true, false);
|
fragment.prepareFragmentToSlide(true, false);
|
||||||
if (bgFragment != null) {
|
|
||||||
bgFragment.onTransitionAnimationEnd(false, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
swipeProgress = 0f;
|
swipeProgress = 0f;
|
||||||
invalidateTranslation();
|
invalidateTranslation();
|
||||||
|
@ -526,6 +528,7 @@ public class LNavigation extends FrameLayout implements INavigationLayout, Float
|
||||||
}
|
}
|
||||||
|
|
||||||
currentSpringAnimation = null;
|
currentSpringAnimation = null;
|
||||||
|
invalidateActionBars();
|
||||||
};
|
};
|
||||||
currentSpringAnimation.addEndListener((animation, canceled, value, velocity) -> {
|
currentSpringAnimation.addEndListener((animation, canceled, value, velocity) -> {
|
||||||
if (animation == currentSpringAnimation) {
|
if (animation == currentSpringAnimation) {
|
||||||
|
@ -539,6 +542,15 @@ public class LNavigation extends FrameLayout implements INavigationLayout, Float
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void invalidateActionBars() {
|
||||||
|
if (getLastFragment() != null && getLastFragment().getActionBar() != null) {
|
||||||
|
getLastFragment().getActionBar().invalidate();
|
||||||
|
}
|
||||||
|
if (getBackgroundFragment() != null && getBackgroundFragment().getActionBar() != null) {
|
||||||
|
getBackgroundFragment().getActionBar().invalidate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private boolean processTouchEvent(MotionEvent ev) {
|
private boolean processTouchEvent(MotionEvent ev) {
|
||||||
int act = ev.getActionMasked();
|
int act = ev.getActionMasked();
|
||||||
if (isTransitionAnimationInProgress()) {
|
if (isTransitionAnimationInProgress()) {
|
||||||
|
@ -688,6 +700,7 @@ public class LNavigation extends FrameLayout implements INavigationLayout, Float
|
||||||
if (params.removeLast && prevFragment != null) {
|
if (params.removeLast && prevFragment != null) {
|
||||||
removeFragmentFromStack(prevFragment);
|
removeFragmentFromStack(prevFragment);
|
||||||
}
|
}
|
||||||
|
invalidateActionBars();
|
||||||
};
|
};
|
||||||
if (animate) {
|
if (animate) {
|
||||||
if (!params.isFromDelay) {
|
if (!params.isFromDelay) {
|
||||||
|
@ -754,9 +767,6 @@ public class LNavigation extends FrameLayout implements INavigationLayout, Float
|
||||||
}
|
}
|
||||||
|
|
||||||
fragment.onTransitionAnimationStart(true, false);
|
fragment.onTransitionAnimationStart(true, false);
|
||||||
if (prevFragment != null) {
|
|
||||||
prevFragment.onTransitionAnimationStart(false, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
customAnimation = fragment.onCustomTransitionAnimation(true, ()-> {
|
customAnimation = fragment.onCustomTransitionAnimation(true, ()-> {
|
||||||
customAnimation = null;
|
customAnimation = null;
|
||||||
|
@ -770,7 +780,6 @@ public class LNavigation extends FrameLayout implements INavigationLayout, Float
|
||||||
|
|
||||||
fragment.onBecomeFullyVisible();
|
fragment.onBecomeFullyVisible();
|
||||||
if (prevFragment != null) {
|
if (prevFragment != null) {
|
||||||
prevFragment.onTransitionAnimationEnd(false, true);
|
|
||||||
prevFragment.onBecomeFullyHidden();
|
prevFragment.onBecomeFullyHidden();
|
||||||
}
|
}
|
||||||
onFragmentOpened.run();
|
onFragmentOpened.run();
|
||||||
|
@ -781,6 +790,7 @@ public class LNavigation extends FrameLayout implements INavigationLayout, Float
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
invalidateActionBars();
|
||||||
FloatValueHolder valueHolder = new FloatValueHolder(SPRING_MULTIPLIER);
|
FloatValueHolder valueHolder = new FloatValueHolder(SPRING_MULTIPLIER);
|
||||||
currentSpringAnimation = new SpringAnimation(valueHolder)
|
currentSpringAnimation = new SpringAnimation(valueHolder)
|
||||||
.setSpring(new SpringForce(0f)
|
.setSpring(new SpringForce(0f)
|
||||||
|
@ -803,7 +813,6 @@ public class LNavigation extends FrameLayout implements INavigationLayout, Float
|
||||||
|
|
||||||
fragment.onBecomeFullyVisible();
|
fragment.onBecomeFullyVisible();
|
||||||
if (prevFragment != null) {
|
if (prevFragment != null) {
|
||||||
prevFragment.onTransitionAnimationEnd(false, true);
|
|
||||||
prevFragment.onBecomeFullyHidden();
|
prevFragment.onBecomeFullyHidden();
|
||||||
prevFragment.setPaused(true);
|
prevFragment.setPaused(true);
|
||||||
}
|
}
|
||||||
|
@ -904,6 +913,7 @@ public class LNavigation extends FrameLayout implements INavigationLayout, Float
|
||||||
observeDebugItemsFromView(items, fragment.getFragmentView());
|
observeDebugItemsFromView(items, fragment.getFragmentView());
|
||||||
}
|
}
|
||||||
if (ALLOW_OPEN_STIFFNESS_CONTROL) {
|
if (ALLOW_OPEN_STIFFNESS_CONTROL) {
|
||||||
|
items.add(new FloatingDebugController.DebugItem(LocaleController.getString(R.string.DebugAltNavigation)));
|
||||||
items.add(new FloatingDebugController.DebugItem(LocaleController.getString(R.string.DebugAltNavigationToggleControls), () -> getStiffnessControl().setVisibility(getStiffnessControl().getVisibility() == VISIBLE ? GONE : VISIBLE)));
|
items.add(new FloatingDebugController.DebugItem(LocaleController.getString(R.string.DebugAltNavigationToggleControls), () -> getStiffnessControl().setVisibility(getStiffnessControl().getVisibility() == VISIBLE ? GONE : VISIBLE)));
|
||||||
}
|
}
|
||||||
return items;
|
return items;
|
||||||
|
@ -1201,6 +1211,12 @@ public class LNavigation extends FrameLayout implements INavigationLayout, Float
|
||||||
this.delegate = delegate;
|
this.delegate = delegate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isActionBarInCrossfade() {
|
||||||
|
boolean crossfadeNoFragments = USE_ACTIONBAR_CROSSFADE && !isInPreviewMode() && (isSwipeInProgress() || isTransitionAnimationInProgress()) && customAnimation == null;
|
||||||
|
return crossfadeNoFragments && getLastFragment() != null && getLastFragment().isActionBarCrossfadeEnabled() && getBackgroundFragment() != null && getBackgroundFragment().isActionBarCrossfadeEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw(Canvas canvas) {
|
public void draw(Canvas canvas) {
|
||||||
if (useAlphaAnimations) {
|
if (useAlphaAnimations) {
|
||||||
|
@ -1238,6 +1254,64 @@ public class LNavigation extends FrameLayout implements INavigationLayout, Float
|
||||||
canvas.drawBitmap(previewFragmentSnapshot, 0, 0, blurPaint);
|
canvas.drawBitmap(previewFragmentSnapshot, 0, 0, blurPaint);
|
||||||
canvas.restore();
|
canvas.restore();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isActionBarInCrossfade()) {
|
||||||
|
BaseFragment foregroundFragment = getLastFragment();
|
||||||
|
BaseFragment backgroundFragment = getBackgroundFragment();
|
||||||
|
|
||||||
|
ActionBar fgActionBar = foregroundFragment.getActionBar();
|
||||||
|
ActionBar bgActionBar = backgroundFragment.getActionBar();
|
||||||
|
|
||||||
|
boolean useBackDrawable = false;
|
||||||
|
boolean backDrawableReverse = false;
|
||||||
|
Float backDrawableForcedProgress = null;
|
||||||
|
|
||||||
|
if (backgroundFragment.getBackButtonState() == BackButtonState.MENU && foregroundFragment.getBackButtonState() == BackButtonState.BACK) {
|
||||||
|
useBackDrawable = true;
|
||||||
|
backDrawableReverse = false;
|
||||||
|
} else if (backgroundFragment.getBackButtonState() == BackButtonState.BACK && foregroundFragment.getBackButtonState() == BackButtonState.MENU) {
|
||||||
|
useBackDrawable = true;
|
||||||
|
backDrawableReverse = true;
|
||||||
|
} else if (backgroundFragment.getBackButtonState() == BackButtonState.BACK && foregroundFragment.getBackButtonState() == BackButtonState.BACK) {
|
||||||
|
useBackDrawable = true;
|
||||||
|
backDrawableForcedProgress = 0f;
|
||||||
|
} else if (backgroundFragment.getBackButtonState() == BackButtonState.MENU && foregroundFragment.getBackButtonState() == BackButtonState.MENU) {
|
||||||
|
useBackDrawable = true;
|
||||||
|
backDrawableForcedProgress = 1f;
|
||||||
|
}
|
||||||
|
|
||||||
|
AndroidUtilities.rectTmp.set(0, 0, getWidth(), bgActionBar.getHeight());
|
||||||
|
canvas.saveLayerAlpha(AndroidUtilities.rectTmp, (int) (swipeProgress * 0xFF), Canvas.ALL_SAVE_FLAG);
|
||||||
|
bgActionBar.onDrawCrossfadeBackground(canvas);
|
||||||
|
canvas.restore();
|
||||||
|
|
||||||
|
canvas.saveLayerAlpha(AndroidUtilities.rectTmp, (int) ((1 - swipeProgress) * 0xFF), Canvas.ALL_SAVE_FLAG);
|
||||||
|
fgActionBar.onDrawCrossfadeBackground(canvas);
|
||||||
|
canvas.restore();
|
||||||
|
|
||||||
|
if (useBackDrawable) {
|
||||||
|
AndroidUtilities.rectTmp.set(0, 0, getWidth(), bgActionBar.getHeight());
|
||||||
|
float progress = backDrawableForcedProgress != null ? backDrawableForcedProgress : swipeProgress;
|
||||||
|
float bgAlpha = 1f - (bgActionBar.getY() / -(bgActionBar.getHeight() - AndroidUtilities.statusBarHeight));
|
||||||
|
float fgAlpha = 1f - (fgActionBar.getY() / -(fgActionBar.getHeight() - AndroidUtilities.statusBarHeight));
|
||||||
|
canvas.saveLayerAlpha(AndroidUtilities.rectTmp, (int) (AndroidUtilities.lerp(bgAlpha, fgAlpha, 1f - swipeProgress) * 0xFF), Canvas.ALL_SAVE_FLAG);
|
||||||
|
canvas.translate(AndroidUtilities.dp(16) - AndroidUtilities.dp(2) * (1f - progress), AndroidUtilities.dp(16) + (fgActionBar.getOccupyStatusBar() ? AndroidUtilities.statusBarHeight : 0));
|
||||||
|
menuDrawable.setRotation(backDrawableReverse ? progress : 1f - progress, false);
|
||||||
|
menuDrawable.draw(canvas);
|
||||||
|
canvas.restore();
|
||||||
|
}
|
||||||
|
|
||||||
|
AndroidUtilities.rectTmp.set(0, AndroidUtilities.statusBarHeight, getWidth(), bgActionBar.getHeight());
|
||||||
|
canvas.saveLayerAlpha(AndroidUtilities.rectTmp, (int) (swipeProgress * 0xFF), Canvas.ALL_SAVE_FLAG);
|
||||||
|
canvas.translate(0, bgActionBar.getY());
|
||||||
|
bgActionBar.onDrawCrossfadeContent(canvas, false, useBackDrawable, swipeProgress);
|
||||||
|
canvas.restore();
|
||||||
|
|
||||||
|
canvas.saveLayerAlpha(AndroidUtilities.rectTmp, (int) ((1 - swipeProgress) * 0xFF), Canvas.ALL_SAVE_FLAG);
|
||||||
|
canvas.translate(0, fgActionBar.getY());
|
||||||
|
fgActionBar.onDrawCrossfadeContent(canvas, true, useBackDrawable, swipeProgress);
|
||||||
|
canvas.restore();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1283,12 +1357,10 @@ public class LNavigation extends FrameLayout implements INavigationLayout, Float
|
||||||
lastFragment.onTransitionAnimationStart(false, true);
|
lastFragment.onTransitionAnimationStart(false, true);
|
||||||
if (newLastFragment != null) {
|
if (newLastFragment != null) {
|
||||||
newLastFragment.setPaused(false);
|
newLastFragment.setPaused(false);
|
||||||
newLastFragment.onTransitionAnimationStart(true, false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (swipeProgress == 0) {
|
if (swipeProgress == 0) {
|
||||||
customAnimation = lastFragment.onCustomTransitionAnimation(false, () -> {
|
customAnimation = lastFragment.onCustomTransitionAnimation(false, () -> {
|
||||||
lastFragment.onTransitionAnimationEnd(false, true);
|
|
||||||
onCloseAnimationEnd(lastFragment, newLastFragment);
|
onCloseAnimationEnd(lastFragment, newLastFragment);
|
||||||
|
|
||||||
customAnimation = null;
|
customAnimation = null;
|
||||||
|
@ -1351,7 +1423,6 @@ public class LNavigation extends FrameLayout implements INavigationLayout, Float
|
||||||
|
|
||||||
if (newLastFragment != null) {
|
if (newLastFragment != null) {
|
||||||
newLastFragment.prepareFragmentToSlide(false, false);
|
newLastFragment.prepareFragmentToSlide(false, false);
|
||||||
newLastFragment.onTransitionAnimationEnd(true, true);
|
|
||||||
newLastFragment.onBecomeFullyVisible();
|
newLastFragment.onBecomeFullyVisible();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1372,6 +1443,7 @@ public class LNavigation extends FrameLayout implements INavigationLayout, Float
|
||||||
blurredBackFragmentForPreview = null;
|
blurredBackFragmentForPreview = null;
|
||||||
}
|
}
|
||||||
previewOpenCallback = null;
|
previewOpenCallback = null;
|
||||||
|
invalidateActionBars();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1534,11 +1534,6 @@ public class LaunchActivity extends BasePermissionsActivity implements INavigati
|
||||||
@SuppressLint("Range")
|
@SuppressLint("Range")
|
||||||
private boolean handleIntent(Intent intent, boolean isNew, boolean restore, boolean fromPassword) {
|
private boolean handleIntent(Intent intent, boolean isNew, boolean restore, boolean fromPassword) {
|
||||||
if (AndroidUtilities.handleProxyIntent(this, intent)) {
|
if (AndroidUtilities.handleProxyIntent(this, intent)) {
|
||||||
actionBarLayout.rebuildFragments(INavigationLayout.REBUILD_FLAG_REBUILD_LAST);
|
|
||||||
if (AndroidUtilities.isTablet()) {
|
|
||||||
layersActionBarLayout.rebuildFragments(INavigationLayout.REBUILD_FLAG_REBUILD_LAST);
|
|
||||||
rightActionBarLayout.rebuildFragments(INavigationLayout.REBUILD_FLAG_REBUILD_LAST);
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (PhotoViewer.hasInstance() && PhotoViewer.getInstance().isVisible()) {
|
if (PhotoViewer.hasInstance() && PhotoViewer.getInstance().isVisible()) {
|
||||||
|
|
|
@ -1591,6 +1591,11 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isActionBarCrossfadeEnabled() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFragmentDestroy() {
|
public void onFragmentDestroy() {
|
||||||
super.onFragmentDestroy();
|
super.onFragmentDestroy();
|
||||||
|
|
|
@ -38,7 +38,6 @@ import androidx.collection.LongSparseArray;
|
||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
import androidx.core.graphics.ColorUtils;
|
import androidx.core.graphics.ColorUtils;
|
||||||
import androidx.recyclerview.widget.DefaultItemAnimator;
|
import androidx.recyclerview.widget.DefaultItemAnimator;
|
||||||
import androidx.recyclerview.widget.DiffUtil;
|
|
||||||
import androidx.recyclerview.widget.ItemTouchHelper;
|
import androidx.recyclerview.widget.ItemTouchHelper;
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
@ -55,6 +54,7 @@ import org.telegram.messenger.NotificationsController;
|
||||||
import org.telegram.messenger.R;
|
import org.telegram.messenger.R;
|
||||||
import org.telegram.messenger.SharedConfig;
|
import org.telegram.messenger.SharedConfig;
|
||||||
import org.telegram.messenger.TopicsController;
|
import org.telegram.messenger.TopicsController;
|
||||||
|
import org.telegram.messenger.UserConfig;
|
||||||
import org.telegram.messenger.Utilities;
|
import org.telegram.messenger.Utilities;
|
||||||
import org.telegram.tgnet.ConnectionsManager;
|
import org.telegram.tgnet.ConnectionsManager;
|
||||||
import org.telegram.tgnet.TLObject;
|
import org.telegram.tgnet.TLObject;
|
||||||
|
@ -68,10 +68,16 @@ import org.telegram.ui.ActionBar.AlertDialog;
|
||||||
import org.telegram.ui.ActionBar.BackDrawable;
|
import org.telegram.ui.ActionBar.BackDrawable;
|
||||||
import org.telegram.ui.ActionBar.BaseFragment;
|
import org.telegram.ui.ActionBar.BaseFragment;
|
||||||
import org.telegram.ui.ActionBar.Theme;
|
import org.telegram.ui.ActionBar.Theme;
|
||||||
|
import org.telegram.ui.ActionBar.ThemeDescription;
|
||||||
import org.telegram.ui.Adapters.FiltersView;
|
import org.telegram.ui.Adapters.FiltersView;
|
||||||
import org.telegram.ui.Cells.DialogCell;
|
import org.telegram.ui.Cells.DialogCell;
|
||||||
|
import org.telegram.ui.Cells.DrawerProfileCell;
|
||||||
import org.telegram.ui.Cells.GraySectionCell;
|
import org.telegram.ui.Cells.GraySectionCell;
|
||||||
|
import org.telegram.ui.Cells.HeaderCell;
|
||||||
|
import org.telegram.ui.Cells.HintDialogCell;
|
||||||
|
import org.telegram.ui.Cells.ProfileSearchCell;
|
||||||
import org.telegram.ui.Cells.TopicSearchCell;
|
import org.telegram.ui.Cells.TopicSearchCell;
|
||||||
|
import org.telegram.ui.Cells.UserCell;
|
||||||
import org.telegram.ui.Components.AlertsCreator;
|
import org.telegram.ui.Components.AlertsCreator;
|
||||||
import org.telegram.ui.Components.AnimatedEmojiDrawable;
|
import org.telegram.ui.Components.AnimatedEmojiDrawable;
|
||||||
import org.telegram.ui.Components.Bulletin;
|
import org.telegram.ui.Components.Bulletin;
|
||||||
|
@ -106,6 +112,8 @@ import java.util.Iterator;
|
||||||
|
|
||||||
public class TopicsFragment extends BaseFragment implements NotificationCenter.NotificationCenterDelegate, ChatActivityInterface {
|
public class TopicsFragment extends BaseFragment implements NotificationCenter.NotificationCenterDelegate, ChatActivityInterface {
|
||||||
|
|
||||||
|
private final static int BOTTOM_BUTTON_TYPE_JOIN = 0;
|
||||||
|
private final static int BOTTOM_BUTTON_TYPE_REPORT = 1;
|
||||||
final long chatId;
|
final long chatId;
|
||||||
ArrayList<Item> forumTopics = new ArrayList<>();
|
ArrayList<Item> forumTopics = new ArrayList<>();
|
||||||
|
|
||||||
|
@ -145,6 +153,7 @@ public class TopicsFragment extends BaseFragment implements NotificationCenter.N
|
||||||
TLRPC.ChatFull chatFull;
|
TLRPC.ChatFull chatFull;
|
||||||
boolean canShowCreateTopic;
|
boolean canShowCreateTopic;
|
||||||
private UnreadCounterTextView bottomOverlayChatText;
|
private UnreadCounterTextView bottomOverlayChatText;
|
||||||
|
private int bottomButtonType;
|
||||||
private RecyclerListView recyclerListView;
|
private RecyclerListView recyclerListView;
|
||||||
private ItemTouchHelper itemTouchHelper;
|
private ItemTouchHelper itemTouchHelper;
|
||||||
private ActionBarMenuSubItem createTopicSubmenu;
|
private ActionBarMenuSubItem createTopicSubmenu;
|
||||||
|
@ -203,6 +212,7 @@ public class TopicsFragment extends BaseFragment implements NotificationCenter.N
|
||||||
ValueAnimator slideBackTransitionAnimator;
|
ValueAnimator slideBackTransitionAnimator;
|
||||||
|
|
||||||
private FrameLayout topView;
|
private FrameLayout topView;
|
||||||
|
private RLottieImageView floatingButton;
|
||||||
|
|
||||||
public TopicsFragment(Bundle bundle) {
|
public TopicsFragment(Bundle bundle) {
|
||||||
super(bundle);
|
super(bundle);
|
||||||
|
@ -468,7 +478,7 @@ public class TopicsFragment extends BaseFragment implements NotificationCenter.N
|
||||||
TLRPC.TL_forumTopic topic = topicsController.findTopic(chatId, list.get(i));
|
TLRPC.TL_forumTopic topic = topicsController.findTopic(chatId, list.get(i));
|
||||||
if (topic != null) {
|
if (topic != null) {
|
||||||
getMessagesController().markMentionsAsRead(-chatId, topic.id);
|
getMessagesController().markMentionsAsRead(-chatId, topic.id);
|
||||||
getMessagesController().markDialogAsRead(-chatId, topic.top_message, 0, topic.topMessage.date, false, topic.id, 0, true, 0);
|
getMessagesController().markDialogAsRead(-chatId, topic.top_message, 0, topic.topMessage != null ? topic.topMessage.date : 0, false, topic.id, 0, true, 0);
|
||||||
getMessagesStorage().updateRepliesMaxReadId(chatId, topic.id, topic.top_message, 0, true);
|
getMessagesStorage().updateRepliesMaxReadId(chatId, topic.id, topic.top_message, 0, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -713,7 +723,7 @@ public class TopicsFragment extends BaseFragment implements NotificationCenter.N
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
floatingButtonContainer.setBackground(drawable);
|
floatingButtonContainer.setBackground(drawable);
|
||||||
RLottieImageView floatingButton = new RLottieImageView(context);
|
floatingButton = new RLottieImageView(context);
|
||||||
floatingButton.setImageResource(R.drawable.ic_chatlist_add_2);
|
floatingButton.setImageResource(R.drawable.ic_chatlist_add_2);
|
||||||
floatingButtonContainer.setContentDescription(LocaleController.getString("CreateTopic", R.string.CreateTopic));
|
floatingButtonContainer.setContentDescription(LocaleController.getString("CreateTopic", R.string.CreateTopic));
|
||||||
|
|
||||||
|
@ -745,7 +755,8 @@ public class TopicsFragment extends BaseFragment implements NotificationCenter.N
|
||||||
};
|
};
|
||||||
try {
|
try {
|
||||||
topicsEmptyView.stickerView.getImageReceiver().setAutoRepeat(2);
|
topicsEmptyView.stickerView.getImageReceiver().setAutoRepeat(2);
|
||||||
} catch (Exception ignore) {}
|
} catch (Exception ignore) {
|
||||||
|
}
|
||||||
topicsEmptyView.showProgress(loadingTopics, fragmentBeginToShow);
|
topicsEmptyView.showProgress(loadingTopics, fragmentBeginToShow);
|
||||||
topicsEmptyView.title.setText(LocaleController.getString("NoTopics", R.string.NoTopics));
|
topicsEmptyView.title.setText(LocaleController.getString("NoTopics", R.string.NoTopics));
|
||||||
SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder("d");
|
SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder("d");
|
||||||
|
@ -778,33 +789,31 @@ public class TopicsFragment extends BaseFragment implements NotificationCenter.N
|
||||||
bottomOverlayChatText.setOnClickListener(new View.OnClickListener() {
|
bottomOverlayChatText.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
joinToGroup();
|
if (bottomButtonType == BOTTOM_BUTTON_TYPE_REPORT) {
|
||||||
|
AlertsCreator.showBlockReportSpamAlert(TopicsFragment.this, -chatId, null, getCurrentChat(), null, false, chatFull, param -> {
|
||||||
|
if (param == 0) {
|
||||||
|
updateChatInfo();
|
||||||
|
} else {
|
||||||
|
finishFragment();
|
||||||
|
}
|
||||||
|
}, getResourceProvider());
|
||||||
|
} else {
|
||||||
|
joinToGroup();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
bottomOverlayProgress = new RadialProgressView(context, themeDelegate);
|
bottomOverlayProgress = new RadialProgressView(context, themeDelegate);
|
||||||
bottomOverlayProgress.setSize(AndroidUtilities.dp(22));
|
bottomOverlayProgress.setSize(AndroidUtilities.dp(22));
|
||||||
bottomOverlayProgress.setProgressColor(getThemedColor(Theme.key_chat_fieldOverlayText));
|
|
||||||
bottomOverlayProgress.setVisibility(View.INVISIBLE);
|
bottomOverlayProgress.setVisibility(View.INVISIBLE);
|
||||||
bottomOverlayContainer.addView(bottomOverlayProgress, LayoutHelper.createFrame(30, 30, Gravity.CENTER));
|
bottomOverlayContainer.addView(bottomOverlayProgress, LayoutHelper.createFrame(30, 30, Gravity.CENTER));
|
||||||
|
|
||||||
updateChatInfo();
|
updateChatInfo();
|
||||||
|
|
||||||
bottomOverlayChatText.setBackground(Theme.createSelectorDrawable(ColorUtils.setAlphaComponent(getThemedColor(Theme.key_chat_fieldOverlayText), 26), Theme.RIPPLE_MASK_ALL));
|
|
||||||
floatingButton.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_chats_actionIcon), PorterDuff.Mode.MULTIPLY));
|
|
||||||
bottomOverlayContainer.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
|
|
||||||
actionBar.setActionModeColor(Theme.getColor(Theme.key_windowBackgroundWhite));
|
|
||||||
actionBar.setBackgroundColor(Theme.getColor(Theme.key_actionBarDefault));
|
|
||||||
|
|
||||||
searchContainer = new SearchContainer(context);
|
searchContainer = new SearchContainer(context);
|
||||||
searchContainer.setVisibility(View.GONE);
|
searchContainer.setVisibility(View.GONE);
|
||||||
contentView.addView(searchContainer);
|
contentView.addView(searchContainer);
|
||||||
EditTextBoldCursor editText = searchItem.getSearchField();
|
|
||||||
|
|
||||||
searchContainer.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
|
|
||||||
// editText.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
|
|
||||||
// editText.setHintTextColor(Theme.getColor(Theme.key_player_time));
|
|
||||||
// editText.setCursorColor(Theme.getColor(Theme.key_chat_messagePanelCursor));
|
|
||||||
|
|
||||||
actionBar.setDrawBlurBackground(contentView);
|
actionBar.setDrawBlurBackground(contentView);
|
||||||
|
|
||||||
|
@ -859,10 +868,23 @@ public class TopicsFragment extends BaseFragment implements NotificationCenter.N
|
||||||
bottomPannelVisible = true;
|
bottomPannelVisible = true;
|
||||||
|
|
||||||
updateChatInfo();
|
updateChatInfo();
|
||||||
|
updateColors();
|
||||||
|
|
||||||
return fragmentView;
|
return fragmentView;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void updateColors() {
|
||||||
|
if (bottomOverlayProgress == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
bottomOverlayProgress.setProgressColor(getThemedColor(Theme.key_chat_fieldOverlayText));
|
||||||
|
floatingButton.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_chats_actionIcon), PorterDuff.Mode.MULTIPLY));
|
||||||
|
bottomOverlayContainer.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
|
||||||
|
actionBar.setActionModeColor(Theme.getColor(Theme.key_windowBackgroundWhite));
|
||||||
|
actionBar.setBackgroundColor(Theme.getColor(Theme.key_actionBarDefault));
|
||||||
|
searchContainer.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
|
||||||
|
}
|
||||||
|
|
||||||
private void openProfile(boolean byAvatar) {
|
private void openProfile(boolean byAvatar) {
|
||||||
Bundle args = new Bundle();
|
Bundle args = new Bundle();
|
||||||
args.putLong("chat_id", chatId);
|
args.putLong("chat_id", chatId);
|
||||||
|
@ -1266,6 +1288,7 @@ public class TopicsFragment extends BaseFragment implements NotificationCenter.N
|
||||||
unpinItem.setVisibility(canUnpinCount == 1 && canPinCount == 0 ? View.VISIBLE : View.GONE);
|
unpinItem.setVisibility(canUnpinCount == 1 && canPinCount == 0 ? View.VISIBLE : View.GONE);
|
||||||
} else {
|
} else {
|
||||||
actionBar.hideActionMode();
|
actionBar.hideActionMode();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
selectedDialogsCountTextView.setNumber(selectedTopics.size(), true);
|
selectedDialogsCountTextView.setNumber(selectedTopics.size(), true);
|
||||||
|
|
||||||
|
@ -1414,6 +1437,11 @@ public class TopicsFragment extends BaseFragment implements NotificationCenter.N
|
||||||
TLRPC.Chat chatLocal = getMessagesController().getChat(chatId);
|
TLRPC.Chat chatLocal = getMessagesController().getChat(chatId);
|
||||||
|
|
||||||
avatarContainer.setChatAvatar(chatLocal);
|
avatarContainer.setChatAvatar(chatLocal);
|
||||||
|
|
||||||
|
SharedPreferences preferences = MessagesController.getNotificationsSettings(currentAccount);
|
||||||
|
boolean showReport = preferences.getBoolean("dialog_bar_report" + (-chatId), false);
|
||||||
|
boolean showBlock = preferences.getBoolean("dialog_bar_block" + (-chatId), false);
|
||||||
|
|
||||||
if (!opnendForSelect) {
|
if (!opnendForSelect) {
|
||||||
if (chatLocal != null) {
|
if (chatLocal != null) {
|
||||||
avatarContainer.setTitle(chatLocal.title);
|
avatarContainer.setTitle(chatLocal.title);
|
||||||
|
@ -1447,6 +1475,7 @@ public class TopicsFragment extends BaseFragment implements NotificationCenter.N
|
||||||
bottomOverlayChatText.setEnabled(false);
|
bottomOverlayChatText.setEnabled(false);
|
||||||
AndroidUtilities.updateViewVisibilityAnimated(bottomOverlayProgress, false, 0.5f, animated);
|
AndroidUtilities.updateViewVisibilityAnimated(bottomOverlayProgress, false, 0.5f, animated);
|
||||||
AndroidUtilities.updateViewVisibilityAnimated(bottomOverlayChatText, true, 0.5f, animated);
|
AndroidUtilities.updateViewVisibilityAnimated(bottomOverlayChatText, true, 0.5f, animated);
|
||||||
|
setButtonType(BOTTOM_BUTTON_TYPE_JOIN);
|
||||||
} else if (chatLocal != null && !opnendForSelect && (ChatObject.isNotInChat(chatLocal) || getMessagesController().isJoiningChannel(chatLocal.id))) {
|
} else if (chatLocal != null && !opnendForSelect && (ChatObject.isNotInChat(chatLocal) || getMessagesController().isJoiningChannel(chatLocal.id))) {
|
||||||
bottomPannelVisibleLocal = true;
|
bottomPannelVisibleLocal = true;
|
||||||
|
|
||||||
|
@ -1465,6 +1494,17 @@ public class TopicsFragment extends BaseFragment implements NotificationCenter.N
|
||||||
|
|
||||||
AndroidUtilities.updateViewVisibilityAnimated(bottomOverlayProgress, showProgress, 0.5f, animated);
|
AndroidUtilities.updateViewVisibilityAnimated(bottomOverlayProgress, showProgress, 0.5f, animated);
|
||||||
AndroidUtilities.updateViewVisibilityAnimated(bottomOverlayChatText, !showProgress, 0.5f, animated);
|
AndroidUtilities.updateViewVisibilityAnimated(bottomOverlayChatText, !showProgress, 0.5f, animated);
|
||||||
|
setButtonType(BOTTOM_BUTTON_TYPE_JOIN);
|
||||||
|
} else if (showBlock || showReport) {
|
||||||
|
bottomOverlayChatText.setText(LocaleController.getString("ReportSpamAndLeave", R.string.ReportSpamAndLeave));
|
||||||
|
bottomOverlayChatText.setClickable(true);
|
||||||
|
bottomOverlayChatText.setEnabled(true);
|
||||||
|
|
||||||
|
AndroidUtilities.updateViewVisibilityAnimated(bottomOverlayProgress, false, 0.5f, false);
|
||||||
|
AndroidUtilities.updateViewVisibilityAnimated(bottomOverlayChatText, true, 0.5f, false);
|
||||||
|
|
||||||
|
setButtonType(BOTTOM_BUTTON_TYPE_REPORT);
|
||||||
|
bottomPannelVisibleLocal = true;
|
||||||
} else {
|
} else {
|
||||||
bottomPannelVisibleLocal = false;
|
bottomPannelVisibleLocal = false;
|
||||||
}
|
}
|
||||||
|
@ -1496,6 +1536,13 @@ public class TopicsFragment extends BaseFragment implements NotificationCenter.N
|
||||||
groupCall = getMessagesController().getGroupCall(chatId, true);
|
groupCall = getMessagesController().getGroupCall(chatId, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setButtonType(int bottomButtonType) {
|
||||||
|
if (this.bottomButtonType != bottomButtonType) {
|
||||||
|
this.bottomButtonType = bottomButtonType;
|
||||||
|
bottomOverlayChatText.setTextColorKey(bottomButtonType == BOTTOM_BUTTON_TYPE_JOIN ? Theme.key_chat_fieldOverlayText : Theme.key_chat_reportSpam);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void updateSubtitle() {
|
private void updateSubtitle() {
|
||||||
TLRPC.ChatFull chatFull = getMessagesController().getChatFull(chatId);
|
TLRPC.ChatFull chatFull = getMessagesController().getChatFull(chatId);
|
||||||
if (this.chatFull != null && this.chatFull.participants != null) {
|
if (this.chatFull != null && this.chatFull.participants != null) {
|
||||||
|
@ -2410,7 +2457,7 @@ public class TopicsFragment extends BaseFragment implements NotificationCenter.N
|
||||||
public void onTransitionAnimationStart(boolean isOpen, boolean backward) {
|
public void onTransitionAnimationStart(boolean isOpen, boolean backward) {
|
||||||
super.onTransitionAnimationStart(isOpen, backward);
|
super.onTransitionAnimationStart(isOpen, backward);
|
||||||
|
|
||||||
transitionAnimationIndex = getNotificationCenter().setAnimationInProgress(transitionAnimationIndex, new int[] {NotificationCenter.topicsDidLoaded});
|
transitionAnimationIndex = getNotificationCenter().setAnimationInProgress(transitionAnimationIndex, new int[]{NotificationCenter.topicsDidLoaded});
|
||||||
transitionAnimationGlobalIndex = NotificationCenter.getGlobalInstance().setAnimationInProgress(transitionAnimationGlobalIndex, new int[0]);
|
transitionAnimationGlobalIndex = NotificationCenter.getGlobalInstance().setAnimationInProgress(transitionAnimationGlobalIndex, new int[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2427,7 +2474,7 @@ public class TopicsFragment extends BaseFragment implements NotificationCenter.N
|
||||||
getNotificationCenter().onAnimationFinish(transitionAnimationIndex);
|
getNotificationCenter().onAnimationFinish(transitionAnimationIndex);
|
||||||
NotificationCenter.getGlobalInstance().onAnimationFinish(transitionAnimationGlobalIndex);
|
NotificationCenter.getGlobalInstance().onAnimationFinish(transitionAnimationGlobalIndex);
|
||||||
|
|
||||||
if (!isOpen && (opnendForSelect || removeFragmentOnTransitionEnd)) {
|
if (!isOpen && (opnendForSelect && removeFragmentOnTransitionEnd)) {
|
||||||
removeSelfFromStack();
|
removeSelfFromStack();
|
||||||
if (dialogsActivity != null) {
|
if (dialogsActivity != null) {
|
||||||
dialogsActivity.removeSelfFromStack();
|
dialogsActivity.removeSelfFromStack();
|
||||||
|
@ -2528,4 +2575,57 @@ public class TopicsFragment extends BaseFragment implements NotificationCenter.N
|
||||||
public SizeNotifierFrameLayout getContentView() {
|
public SizeNotifierFrameLayout getContentView() {
|
||||||
return contentView;
|
return contentView;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ArrayList<ThemeDescription> getThemeDescriptions() {
|
||||||
|
ThemeDescription.ThemeDescriptionDelegate cellDelegate = () -> {
|
||||||
|
for (int b = 0; b < 2; b++) {
|
||||||
|
RecyclerListView list = null;
|
||||||
|
if (b == 0) {
|
||||||
|
list = recyclerListView;
|
||||||
|
} else if (searchContainer != null) {
|
||||||
|
list = searchContainer.recyclerView;
|
||||||
|
}
|
||||||
|
if (list == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
int count = list.getChildCount();
|
||||||
|
for (int a = 0; a < count; a++) {
|
||||||
|
View child = list.getChildAt(a);
|
||||||
|
if (child instanceof ProfileSearchCell) {
|
||||||
|
((ProfileSearchCell) child).update(0);
|
||||||
|
} else if (child instanceof DialogCell) {
|
||||||
|
((DialogCell) child).update(0);
|
||||||
|
} else if (child instanceof UserCell) {
|
||||||
|
((UserCell) child).update(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (actionBar != null) {
|
||||||
|
actionBar.setPopupBackgroundColor(Theme.getColor(Theme.key_actionBarDefaultSubmenuBackground), true);
|
||||||
|
actionBar.setPopupItemsColor(Theme.getColor(Theme.key_actionBarDefaultSubmenuItem), false, true);
|
||||||
|
actionBar.setPopupItemsColor(Theme.getColor(Theme.key_actionBarDefaultSubmenuItemIcon), true, true);
|
||||||
|
actionBar.setPopupItemsSelectorColor(Theme.getColor(Theme.key_dialogButtonSelector), true);
|
||||||
|
}
|
||||||
|
if (blurredView != null) {
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||||
|
blurredView.setForeground(new ColorDrawable(ColorUtils.setAlphaComponent(getThemedColor(Theme.key_windowBackgroundWhite), 100)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
updateColors();
|
||||||
|
};
|
||||||
|
|
||||||
|
ArrayList<ThemeDescription> arrayList = new ArrayList<>();
|
||||||
|
|
||||||
|
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_windowBackgroundWhite));
|
||||||
|
arrayList.add(new ThemeDescription(actionBar, ThemeDescription.FLAG_BACKGROUND, null, null, null, null, Theme.key_actionBarDefault));
|
||||||
|
arrayList.add(new ThemeDescription(actionBar, ThemeDescription.FLAG_AB_ITEMSCOLOR, null, null, null, null, Theme.key_actionBarDefaultIcon));
|
||||||
|
arrayList.add(new ThemeDescription(actionBar, ThemeDescription.FLAG_AB_TITLECOLOR, null, null, null, null, Theme.key_actionBarDefaultTitle));
|
||||||
|
arrayList.add(new ThemeDescription(actionBar, ThemeDescription.FLAG_AB_SELECTORCOLOR, null, null, null, null, Theme.key_actionBarDefaultSelector));
|
||||||
|
|
||||||
|
if (searchContainer != null && searchContainer.recyclerView != null) {
|
||||||
|
GraySectionCell.createThemeDescriptions(arrayList, searchContainer.recyclerView);
|
||||||
|
}
|
||||||
|
return arrayList;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5735,7 +5735,7 @@
|
||||||
<string name="FloatingDebugEnable">Enable floating debug</string>
|
<string name="FloatingDebugEnable">Enable floating debug</string>
|
||||||
<string name="FloatingDebugDisable">Disable floating debug</string>
|
<string name="FloatingDebugDisable">Disable floating debug</string>
|
||||||
<string name="DebugClearLocalDatabaseSuccess">Cleared local database.</string>
|
<string name="DebugClearLocalDatabaseSuccess">Cleared local database.</string>
|
||||||
<string name="DebugAltNavigationToggleControls">Toggle navigation stiffness controls</string>
|
<string name="DebugAltNavigationToggleControls">Toggle stiffness controls</string>
|
||||||
<string name="DebugClearSendMessageAsPeers">Clear Send Message As... peers</string>
|
<string name="DebugClearSendMessageAsPeers">Clear Send Message As... peers</string>
|
||||||
<string name="DebugShareAlertSwitchDialogsMode">Switch sharing alert dialogs mode (%1$s)</string>
|
<string name="DebugShareAlertSwitchDialogsMode">Switch sharing alert dialogs mode (%1$s)</string>
|
||||||
<string name="DebugShareAlertDialogsModeNormal">Normal</string>
|
<string name="DebugShareAlertDialogsModeNormal">Normal</string>
|
||||||
|
@ -5781,4 +5781,11 @@
|
||||||
<string name="ChannelCaptionLimitPremiumPromo_many">Make the caption shorter or subscribe to *Telegram Premium* to double the limit to **%1$s** characters.</string>
|
<string name="ChannelCaptionLimitPremiumPromo_many">Make the caption shorter or subscribe to *Telegram Premium* to double the limit to **%1$s** characters.</string>
|
||||||
<string name="ChannelCaptionLimitPremiumPromo_other">Make the caption shorter or subscribe to *Telegram Premium* to double the limit to **%1$s** characters.</string>
|
<string name="ChannelCaptionLimitPremiumPromo_other">Make the caption shorter or subscribe to *Telegram Premium* to double the limit to **%1$s** characters.</string>
|
||||||
<string name="AllChats">All Chats</string>
|
<string name="AllChats">All Chats</string>
|
||||||
|
<string name="DebugShareAlert">Share Alert</string>
|
||||||
|
<string name="DebugDialogsActivity">Dialogs Activity</string>
|
||||||
|
<string name="DebugMessageSkeletons">Message Skeletons</string>
|
||||||
|
<string name="DebugMessageSkeletonsLightOverlayAlpha">Light overlay alpha</string>
|
||||||
|
<string name="DebugMessageSkeletonsSaturation">Saturation</string>
|
||||||
|
<string name="DebugAltNavigation">Alternative navigation</string>
|
||||||
|
<string name="DebugGeneral">General</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -21,20 +21,9 @@ dependencies {
|
||||||
implementation files('../TMessagesProj/libs/libgsaverification-client.aar')
|
implementation files('../TMessagesProj/libs/libgsaverification-client.aar')
|
||||||
}
|
}
|
||||||
|
|
||||||
def getProps(String propName) {
|
|
||||||
def propsFile = rootProject.file('local.properties')
|
|
||||||
if (propsFile.exists()) {
|
|
||||||
def props = new Properties()
|
|
||||||
props.load(new FileInputStream(propsFile))
|
|
||||||
return props[propName]
|
|
||||||
} else {
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 31
|
compileSdkVersion 33
|
||||||
buildToolsVersion '31.0.0'
|
buildToolsVersion '33.0.0'
|
||||||
|
|
||||||
defaultConfig.applicationId = APP_PACKAGE
|
defaultConfig.applicationId = APP_PACKAGE
|
||||||
|
|
||||||
|
@ -186,8 +175,8 @@ android {
|
||||||
}
|
}
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdkVersion 16
|
minSdkVersion 19
|
||||||
targetSdkVersion 30
|
targetSdkVersion 31
|
||||||
versionName APP_VERSION_NAME
|
versionName APP_VERSION_NAME
|
||||||
ndkVersion "21.4.7075529"
|
ndkVersion "21.4.7075529"
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
android:installLocation="auto">
|
android:installLocation="auto">
|
||||||
|
|
||||||
<application android:name="org.telegram.messenger.ApplicationLoaderImpl" tools:replace="name">
|
<application android:name="org.telegram.messenger.ApplicationLoaderImpl" tools:replace="name">
|
||||||
<service android:name="org.telegram.messenger.GoogleVoiceClientService"/>
|
<service android:name="org.telegram.messenger.GoogleVoiceClientService" android:exported="true"/>
|
||||||
<activity
|
<activity
|
||||||
android:name="org.telegram.messenger.GoogleVoiceClientActivity"
|
android:name="org.telegram.messenger.GoogleVoiceClientActivity"
|
||||||
android:exported="true">
|
android:exported="true">
|
||||||
|
|
|
@ -25,8 +25,8 @@ dependencies {
|
||||||
}
|
}
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 31
|
compileSdkVersion 33
|
||||||
buildToolsVersion '31.0.0'
|
buildToolsVersion '33.0.0'
|
||||||
|
|
||||||
defaultConfig.applicationId = APP_PACKAGE
|
defaultConfig.applicationId = APP_PACKAGE
|
||||||
|
|
||||||
|
@ -142,8 +142,8 @@ android {
|
||||||
}
|
}
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdkVersion 16
|
minSdkVersion 19
|
||||||
targetSdkVersion 30
|
targetSdkVersion 31
|
||||||
versionName APP_VERSION_NAME
|
versionName APP_VERSION_NAME
|
||||||
ndkVersion "21.4.7075529"
|
ndkVersion "21.4.7075529"
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
android:installLocation="auto">
|
android:installLocation="auto">
|
||||||
|
|
||||||
<application android:name="org.telegram.messenger.ApplicationLoaderImpl" tools:replace="name">
|
<application android:name="org.telegram.messenger.ApplicationLoaderImpl" tools:replace="name">
|
||||||
<service android:name="org.telegram.messenger.GoogleVoiceClientService"/>
|
<service android:name="org.telegram.messenger.GoogleVoiceClientService" android:exported="true"/>
|
||||||
<activity
|
<activity
|
||||||
android:name="org.telegram.messenger.GoogleVoiceClientActivity"
|
android:name="org.telegram.messenger.GoogleVoiceClientActivity"
|
||||||
android:exported="true">
|
android:exported="true">
|
||||||
|
@ -15,5 +15,31 @@
|
||||||
<data android:mimeType="text/plain" />
|
<data android:mimeType="text/plain" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
|
<activity
|
||||||
|
android:name="com.microsoft.appcenter.distribute.DeepLinkActivity"
|
||||||
|
android:exported="true"
|
||||||
|
android:theme="@android:style/Theme.NoDisplay">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.VIEW" />
|
||||||
|
|
||||||
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
<category android:name="android.intent.category.BROWSABLE" />
|
||||||
|
|
||||||
|
<data
|
||||||
|
android:host="updates"
|
||||||
|
android:path="/"
|
||||||
|
android:scheme="appcenter" />
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
|
||||||
|
<receiver
|
||||||
|
android:name="com.microsoft.appcenter.distribute.DownloadManagerReceiver"
|
||||||
|
android:exported="true">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.DOWNLOAD_COMPLETE" />
|
||||||
|
<action android:name="android.intent.action.DOWNLOAD_NOTIFICATION_CLICKED" />
|
||||||
|
</intent-filter>
|
||||||
|
</receiver>
|
||||||
</application>
|
</application>
|
||||||
</manifest>
|
</manifest>
|
|
@ -29,8 +29,8 @@ dependencies {
|
||||||
}
|
}
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 31
|
compileSdkVersion 33
|
||||||
buildToolsVersion '31.0.0'
|
buildToolsVersion '33.0.0'
|
||||||
|
|
||||||
defaultConfig.applicationId = APP_PACKAGE
|
defaultConfig.applicationId = APP_PACKAGE
|
||||||
|
|
||||||
|
@ -137,7 +137,7 @@ android {
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdkVersion 19
|
minSdkVersion 19
|
||||||
targetSdkVersion 30
|
targetSdkVersion 31
|
||||||
versionName APP_VERSION_NAME
|
versionName APP_VERSION_NAME
|
||||||
ndkVersion "21.4.7075529"
|
ndkVersion "21.4.7075529"
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
</queries>
|
</queries>
|
||||||
|
|
||||||
<application android:name="org.telegram.messenger.HuaweiApplicationLoader" tools:replace="name">
|
<application android:name="org.telegram.messenger.HuaweiApplicationLoader" tools:replace="name">
|
||||||
<service android:name="org.telegram.messenger.GoogleVoiceClientService"/>
|
<service android:name="org.telegram.messenger.GoogleVoiceClientService" android:exported="true"/>
|
||||||
<activity
|
<activity
|
||||||
android:name="org.telegram.messenger.GoogleVoiceClientActivity"
|
android:name="org.telegram.messenger.GoogleVoiceClientActivity"
|
||||||
android:exported="true">
|
android:exported="true">
|
||||||
|
|
|
@ -13,8 +13,8 @@
|
||||||
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
||||||
# org.gradle.parallel=true
|
# org.gradle.parallel=true
|
||||||
#Sat Mar 12 05:53:50 MSK 2016
|
#Sat Mar 12 05:53:50 MSK 2016
|
||||||
APP_VERSION_NAME=9.1.3
|
APP_VERSION_NAME=9.1.4
|
||||||
APP_VERSION_CODE=2917
|
APP_VERSION_CODE=2927
|
||||||
APP_PACKAGE=org.telegram.messenger
|
APP_PACKAGE=org.telegram.messenger
|
||||||
RELEASE_KEY_PASSWORD=TelegramAndroidPswd
|
RELEASE_KEY_PASSWORD=TelegramAndroidPswd
|
||||||
RELEASE_KEY_ALIAS=tmessages
|
RELEASE_KEY_ALIAS=tmessages
|
||||||
|
|
Loading…
Reference in a new issue