Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
apk
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
apk
Commits
1b913b2a
Commit
1b913b2a
authored
Mar 27, 2015
by
DrKLO
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug fixes
parent
08ac6a14
Changes
18
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
124 additions
and
19 deletions
+124
-19
build.gradle
TMessagesProj/build.gradle
+1
-1
ContactsController.java
...rc/main/java/org/telegram/android/ContactsController.java
+1
-1
NotificationsController.java
...in/java/org/telegram/android/NotificationsController.java
+90
-14
SendMessagesHelper.java
...rc/main/java/org/telegram/android/SendMessagesHelper.java
+7
-2
ChatActivity.java
...sagesProj/src/main/java/org/telegram/ui/ChatActivity.java
+8
-0
ChatActivityEnterView.java
...ava/org/telegram/ui/Components/ChatActivityEnterView.java
+2
-0
NotificationsSettingsActivity.java
...n/java/org/telegram/ui/NotificationsSettingsActivity.java
+6
-1
sound_in.wav
TMessagesProj/src/main/res/raw/sound_in.wav
+0
-0
sound_out.wav
TMessagesProj/src/main/res/raw/sound_out.wav
+0
-0
strings.xml
TMessagesProj/src/main/res/values-ar/strings.xml
+1
-0
strings.xml
TMessagesProj/src/main/res/values-de/strings.xml
+1
-0
strings.xml
TMessagesProj/src/main/res/values-es/strings.xml
+1
-0
strings.xml
TMessagesProj/src/main/res/values-it/strings.xml
+1
-0
strings.xml
TMessagesProj/src/main/res/values-ko/strings.xml
+1
-0
strings.xml
TMessagesProj/src/main/res/values-nl/strings.xml
+1
-0
strings.xml
TMessagesProj/src/main/res/values-pt-rBR/strings.xml
+1
-0
strings.xml
TMessagesProj/src/main/res/values-pt-rPT/strings.xml
+1
-0
strings.xml
TMessagesProj/src/main/res/values/strings.xml
+1
-0
No files found.
TMessagesProj/build.gradle
View file @
1b913b2a
...
...
@@ -82,7 +82,7 @@ android {
defaultConfig
{
minSdkVersion
8
targetSdkVersion
22
versionCode
47
5
versionCode
47
9
versionName
"2.6.1"
}
}
TMessagesProj/src/main/java/org/telegram/android/ContactsController.java
View file @
1b913b2a
...
...
@@ -1772,7 +1772,7 @@ public class ContactsController {
}
public
static
String
formatName
(
String
firstName
,
String
lastName
)
{
String
result
=
null
;
String
result
=
""
;
if
(
LocaleController
.
nameDisplayOrder
==
1
)
{
result
=
firstName
;
if
(
result
==
null
||
result
.
length
()
==
0
)
{
...
...
TMessagesProj/src/main/java/org/telegram/android/NotificationsController.java
View file @
1b913b2a
...
...
@@ -17,10 +17,10 @@ import android.content.Intent;
import
android.content.SharedPreferences
;
import
android.content.pm.PackageManager
;
import
android.content.pm.ResolveInfo
;
import
android.content.res.AssetFileDescriptor
;
import
android.graphics.drawable.BitmapDrawable
;
import
android.media.AudioManager
;
import
android.media.MediaPlayer
;
import
android.media.SoundPool
;
import
android.net.Uri
;
import
android.os.Build
;
import
android.os.SystemClock
;
...
...
@@ -68,11 +68,10 @@ public class NotificationsController {
private
int
lastOnlineFromOtherDevice
=
0
;
private
boolean
inChatSoundEnabled
=
true
;
private
SoundPool
soundPool
;
private
int
inChatOutgoingSound
;
private
long
lastSoundPlay
;
private
MediaPlayer
mediaPlayer
;
private
String
lastMediaPlayerUri
;
private
MediaPlayer
mediaPlayerIn
;
private
MediaPlayer
mediaPlayerOut
;
private
AudioManager
audioManager
;
private
static
volatile
NotificationsController
Instance
=
null
;
public
static
NotificationsController
getInstance
()
{
...
...
@@ -94,9 +93,8 @@ public class NotificationsController {
inChatSoundEnabled
=
preferences
.
getBoolean
(
"EnableInChatSound"
,
true
);
try
{
soundPool
=
new
SoundPool
(
1
,
AudioManager
.
STREAM_NOTIFICATION
,
0
);
inChatOutgoingSound
=
soundPool
.
load
(
ApplicationLoader
.
applicationContext
,
R
.
raw
.
sound_out
,
1
);
mediaPlayer
=
new
MediaPlayer
();
audioManager
=
(
AudioManager
)
ApplicationLoader
.
applicationContext
.
getSystemService
(
Context
.
AUDIO_SERVICE
);
//mediaPlayer = new MediaPlayer();
}
catch
(
Exception
e
)
{
FileLog
.
e
(
"tmessages"
,
e
);
}
...
...
@@ -389,6 +387,7 @@ public class NotificationsController {
inAppPriority
=
preferences
.
getBoolean
(
"EnableInAppPriority"
,
false
);
vibrate_override
=
preferences
.
getInt
(
"vibrate_"
+
dialog_id
,
0
);
priority_override
=
preferences
.
getInt
(
"priority_"
+
dialog_id
,
3
);
boolean
vibrateOnlyIfSilent
=
false
;
choosenSoundPath
=
preferences
.
getString
(
"sound_path_"
+
dialog_id
,
null
);
if
(
chat_id
!=
0
)
{
...
...
@@ -418,6 +417,10 @@ public class NotificationsController {
priority
=
priority_override
;
}
if
(
needVibrate
==
4
)
{
vibrateOnlyIfSilent
=
true
;
needVibrate
=
0
;
}
if
(
needVibrate
==
2
&&
(
vibrate_override
==
1
||
vibrate_override
==
3
||
vibrate_override
==
5
)
||
needVibrate
!=
2
&&
vibrate_override
==
2
||
vibrate_override
!=
0
)
{
needVibrate
=
vibrate_override
;
}
...
...
@@ -434,6 +437,16 @@ public class NotificationsController {
priority
=
1
;
}
}
if
(
vibrateOnlyIfSilent
&&
needVibrate
!=
2
)
{
try
{
int
mode
=
audioManager
.
getRingerMode
();
if
(
mode
!=
AudioManager
.
RINGER_MODE_SILENT
&&
mode
!=
AudioManager
.
RINGER_MODE_VIBRATE
)
{
needVibrate
=
2
;
}
}
catch
(
Exception
e
)
{
FileLog
.
e
(
"tmessages"
,
e
);
}
}
}
Intent
intent
=
new
Intent
(
ApplicationLoader
.
applicationContext
,
LaunchActivity
.
class
);
...
...
@@ -824,13 +837,53 @@ public class NotificationsController {
if
(!
inChatSoundEnabled
)
{
return
;
}
if
(
lastSoundPlay
>
System
.
currentTimeMillis
()
-
1800
)
{
return
;
try
{
if
(
audioManager
.
getRingerMode
()
==
AudioManager
.
RINGER_MODE_SILENT
)
{
return
;
}
}
catch
(
Exception
e
)
{
FileLog
.
e
(
"tmessages"
,
e
);
}
try
{
String
choosenSoundPath
=
null
;
String
defaultPath
=
Settings
.
System
.
DEFAULT_NOTIFICATION_URI
.
getPath
();
SharedPreferences
preferences
=
ApplicationLoader
.
applicationContext
.
getSharedPreferences
(
"Notifications"
,
Context
.
MODE_PRIVATE
);
int
notify_override
=
preferences
.
getInt
(
"notify2_"
+
openned_dialog_id
,
0
);
if
(
notify_override
==
3
)
{
int
mute_until
=
preferences
.
getInt
(
"notifyuntil_"
+
openned_dialog_id
,
0
);
if
(
mute_until
>=
ConnectionsManager
.
getInstance
().
getCurrentTime
())
{
notify_override
=
2
;
}
}
if
(
notify_override
==
2
)
{
return
;
}
notificationsQueue
.
postRunnable
(
new
Runnable
()
{
@Override
public
void
run
()
{
if
(
lastSoundPlay
>
System
.
currentTimeMillis
()
-
500
)
{
return
;
}
try
{
if
(
mediaPlayerIn
==
null
)
{
AssetFileDescriptor
assetFileDescriptor
=
ApplicationLoader
.
applicationContext
.
getResources
().
openRawResourceFd
(
R
.
raw
.
sound_in
);
if
(
assetFileDescriptor
!=
null
)
{
mediaPlayerIn
=
new
MediaPlayer
();
mediaPlayerIn
.
setAudioStreamType
(
AudioManager
.
STREAM_NOTIFICATION
);
mediaPlayerIn
.
setDataSource
(
assetFileDescriptor
.
getFileDescriptor
(),
assetFileDescriptor
.
getStartOffset
(),
assetFileDescriptor
.
getLength
());
mediaPlayerIn
.
setLooping
(
false
);
assetFileDescriptor
.
close
();
mediaPlayerIn
.
prepare
();
}
}
mediaPlayerIn
.
start
();
}
catch
(
Exception
e
)
{
FileLog
.
e
(
"tmessages"
,
e
);
}
}
});
/*String choosenSoundPath = null;
String defaultPath = Settings.System.DEFAULT_NOTIFICATION_URI.getPath();
choosenSoundPath = preferences.getString("sound_path_" + openned_dialog_id, null);
boolean isChat = (int)(openned_dialog_id) < 0;
if (isChat) {
...
...
@@ -860,7 +913,7 @@ public class NotificationsController {
mediaPlayer.prepare();
}
mediaPlayer.start();
}
}
*/
}
catch
(
Exception
e
)
{
FileLog
.
e
(
"tmessages"
,
e
);
}
...
...
@@ -871,10 +924,33 @@ public class NotificationsController {
return
;
}
try
{
soundPool
.
play
(
inChatOutgoingSound
,
1
,
1
,
1
,
0
,
1
);
if
(
audioManager
.
getRingerMode
()
==
AudioManager
.
RINGER_MODE_SILENT
)
{
return
;
}
}
catch
(
Exception
e
)
{
FileLog
.
e
(
"tmessages"
,
e
);
}
notificationsQueue
.
postRunnable
(
new
Runnable
()
{
@Override
public
void
run
()
{
try
{
if
(
mediaPlayerOut
==
null
)
{
AssetFileDescriptor
assetFileDescriptor
=
ApplicationLoader
.
applicationContext
.
getResources
().
openRawResourceFd
(
R
.
raw
.
sound_out
);
if
(
assetFileDescriptor
!=
null
)
{
mediaPlayerOut
=
new
MediaPlayer
();
mediaPlayerOut
.
setAudioStreamType
(
AudioManager
.
STREAM_NOTIFICATION
);
mediaPlayerOut
.
setDataSource
(
assetFileDescriptor
.
getFileDescriptor
(),
assetFileDescriptor
.
getStartOffset
(),
assetFileDescriptor
.
getLength
());
mediaPlayerOut
.
setLooping
(
false
);
assetFileDescriptor
.
close
();
mediaPlayerOut
.
prepare
();
}
}
mediaPlayerOut
.
start
();
}
catch
(
Exception
e
)
{
FileLog
.
e
(
"tmessages"
,
e
);
}
}
});
}
public
void
processNewMessages
(
ArrayList
<
MessageObject
>
messageObjects
,
boolean
isLast
)
{
...
...
TMessagesProj/src/main/java/org/telegram/android/SendMessagesHelper.java
View file @
1b913b2a
...
...
@@ -1810,8 +1810,13 @@ public class SendMessagesHelper implements NotificationCenter.NotificationCenter
FileLog
.
e
(
"tmessages"
,
e
);
}
if
(
bmOptions
.
outWidth
!=
0
&&
bmOptions
.
outHeight
!=
0
&&
bmOptions
.
outWidth
<=
800
&&
bmOptions
.
outHeight
<=
800
)
{
TLRPC
.
TL_documentAttributeSticker
attributeSticker
=
new
TLRPC
.
TL_documentAttributeSticker
();
attributeSticker
.
alt
=
""
;
TLRPC
.
TL_documentAttributeSticker
attributeSticker
=
null
;
if
(
isEncrypted
)
{
attributeSticker
=
new
TLRPC
.
TL_documentAttributeSticker_old
();
}
else
{
attributeSticker
=
new
TLRPC
.
TL_documentAttributeSticker
();
attributeSticker
.
alt
=
""
;
}
document
.
attributes
.
add
(
attributeSticker
);
TLRPC
.
TL_documentAttributeImageSize
attributeImageSize
=
new
TLRPC
.
TL_documentAttributeImageSize
();
attributeImageSize
.
w
=
bmOptions
.
outWidth
;
...
...
TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java
View file @
1b913b2a
...
...
@@ -1799,6 +1799,14 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
}
}
}
for
(
int
a
=
0
;
a
<
document
.
attributes
.
size
();
a
++)
{
TLRPC
.
DocumentAttribute
attribute
=
document
.
attributes
.
get
(
a
);
if
(
attribute
instanceof
TLRPC
.
TL_documentAttributeSticker
)
{
document
.
attributes
.
remove
(
a
);
document
.
attributes
.
add
(
new
TLRPC
.
TL_documentAttributeSticker_old
());
break
;
}
}
SendMessagesHelper
.
getInstance
().
sendMessage
((
TLRPC
.
TL_document
)
document
,
null
,
null
,
dialog_id
,
replyingMessageObject
);
showReplyForMessageObjectOrForward
(
false
,
null
,
null
,
true
);
}
...
...
TMessagesProj/src/main/java/org/telegram/ui/Components/ChatActivityEnterView.java
View file @
1b913b2a
...
...
@@ -376,6 +376,7 @@ public class ChatActivityEnterView extends FrameLayoutFixed implements Notificat
audioSendButton
.
setScaleType
(
ImageView
.
ScaleType
.
CENTER_INSIDE
);
audioSendButton
.
setImageResource
(
R
.
drawable
.
mic_button_states
);
audioSendButton
.
setBackgroundColor
(
0xffffffff
);
audioSendButton
.
setSoundEffectsEnabled
(
false
);
audioSendButton
.
setPadding
(
0
,
0
,
AndroidUtilities
.
dp
(
4
),
0
);
frameLayout1
.
addView
(
audioSendButton
);
layoutParams1
=
(
FrameLayout
.
LayoutParams
)
audioSendButton
.
getLayoutParams
();
...
...
@@ -461,6 +462,7 @@ public class ChatActivityEnterView extends FrameLayoutFixed implements Notificat
sendButton
.
setVisibility
(
View
.
INVISIBLE
);
sendButton
.
setScaleType
(
ImageView
.
ScaleType
.
CENTER_INSIDE
);
sendButton
.
setImageResource
(
R
.
drawable
.
ic_send
);
sendButton
.
setSoundEffectsEnabled
(
false
);
ViewProxy
.
setScaleX
(
sendButton
,
0.1f
);
ViewProxy
.
setScaleY
(
sendButton
,
0.1f
);
ViewProxy
.
setAlpha
(
sendButton
,
0.0f
);
...
...
TMessagesProj/src/main/java/org/telegram/ui/NotificationsSettingsActivity.java
View file @
1b913b2a
...
...
@@ -439,7 +439,8 @@ public class NotificationsSettingsActivity extends BaseFragment implements Notif
LocaleController
.
getString
(
"VibrationDisabled"
,
R
.
string
.
VibrationDisabled
),
LocaleController
.
getString
(
"Default"
,
R
.
string
.
Default
),
LocaleController
.
getString
(
"Short"
,
R
.
string
.
Short
),
LocaleController
.
getString
(
"Long"
,
R
.
string
.
Long
)
LocaleController
.
getString
(
"Long"
,
R
.
string
.
Long
),
LocaleController
.
getString
(
"OnlyIfSilent"
,
R
.
string
.
OnlyIfSilent
)
},
new
DialogInterface
.
OnClickListener
()
{
@Override
public
void
onClick
(
DialogInterface
dialog
,
int
which
)
{
...
...
@@ -457,6 +458,8 @@ public class NotificationsSettingsActivity extends BaseFragment implements Notif
editor
.
putInt
(
param
,
1
);
}
else
if
(
which
==
3
)
{
editor
.
putInt
(
param
,
3
);
}
else
if
(
which
==
4
)
{
editor
.
putInt
(
param
,
4
);
}
editor
.
commit
();
if
(
listView
!=
null
)
{
...
...
@@ -767,6 +770,8 @@ public class NotificationsSettingsActivity extends BaseFragment implements Notif
textCell
.
setTextAndValue
(
LocaleController
.
getString
(
"Vibrate"
,
R
.
string
.
Vibrate
),
LocaleController
.
getString
(
"VibrationDisabled"
,
R
.
string
.
VibrationDisabled
),
true
);
}
else
if
(
value
==
3
)
{
textCell
.
setTextAndValue
(
LocaleController
.
getString
(
"Vibrate"
,
R
.
string
.
Vibrate
),
LocaleController
.
getString
(
"Long"
,
R
.
string
.
Long
),
true
);
}
else
if
(
value
==
4
)
{
textCell
.
setTextAndValue
(
LocaleController
.
getString
(
"Vibrate"
,
R
.
string
.
Vibrate
),
LocaleController
.
getString
(
"OnlyIfSilent"
,
R
.
string
.
OnlyIfSilent
),
true
);
}
}
else
if
(
i
==
repeatRow
)
{
textCell
.
setMultilineDetail
(
false
);
...
...
TMessagesProj/src/main/res/raw/sound_in.wav
0 → 100644
View file @
1b913b2a
File added
TMessagesProj/src/main/res/raw/sound_out.wav
View file @
1b913b2a
No preview for this file type
TMessagesProj/src/main/res/values-ar/strings.xml
View file @
1b913b2a
...
...
@@ -245,6 +245,7 @@
<string
name=
"NoSound"
>
لا يوجد صوت
</string>
<string
name=
"Default"
>
افتراضي
</string>
<string
name=
"Support"
>
الدعم
</string>
<string
name=
"OnlyIfSilent"
>
إذا كان على الصامت
</string>
<string
name=
"ChatBackground"
>
خلفية الدردشة
</string>
<string
name=
"MessagesSettings"
>
الرسائل
</string>
<string
name=
"SendByEnter"
>
أرسل بزر الإدخال
</string>
...
...
TMessagesProj/src/main/res/values-de/strings.xml
View file @
1b913b2a
...
...
@@ -245,6 +245,7 @@
<string
name=
"NoSound"
>
Kein Ton
</string>
<string
name=
"Default"
>
Standard
</string>
<string
name=
"Support"
>
Support
</string>
<string
name=
"OnlyIfSilent"
>
Nur wenn stumm
</string>
<string
name=
"ChatBackground"
>
Chat-Hintergrundbild
</string>
<string
name=
"MessagesSettings"
>
Nachrichten
</string>
<string
name=
"SendByEnter"
>
Mit Enter senden
</string>
...
...
TMessagesProj/src/main/res/values-es/strings.xml
View file @
1b913b2a
...
...
@@ -245,6 +245,7 @@
<string
name=
"NoSound"
>
Sin sonido
</string>
<string
name=
"Default"
>
Por defecto
</string>
<string
name=
"Support"
>
Soporte
</string>
<string
name=
"OnlyIfSilent"
>
Only if silent
</string>
<string
name=
"ChatBackground"
>
Fondo de chat
</string>
<string
name=
"MessagesSettings"
>
Mensajes
</string>
<string
name=
"SendByEnter"
>
Enviar con \'Intro\'
</string>
...
...
TMessagesProj/src/main/res/values-it/strings.xml
View file @
1b913b2a
...
...
@@ -245,6 +245,7 @@
<string
name=
"NoSound"
>
Nessun suono
</string>
<string
name=
"Default"
>
Default
</string>
<string
name=
"Support"
>
Supporto
</string>
<string
name=
"OnlyIfSilent"
>
Solo se silenzioso
</string>
<string
name=
"ChatBackground"
>
Sfondo chat
</string>
<string
name=
"MessagesSettings"
>
Messaggi
</string>
<string
name=
"SendByEnter"
>
Spedisci con Invio
</string>
...
...
TMessagesProj/src/main/res/values-ko/strings.xml
View file @
1b913b2a
...
...
@@ -245,6 +245,7 @@
<string
name=
"NoSound"
>
알림음 없음
</string>
<string
name=
"Default"
>
기본값
</string>
<string
name=
"Support"
>
지원
</string>
<string
name=
"OnlyIfSilent"
>
Only if silent
</string>
<string
name=
"ChatBackground"
>
채팅방 배경화면
</string>
<string
name=
"MessagesSettings"
>
메시지
</string>
<string
name=
"SendByEnter"
>
엔터키로 메시지 전송
</string>
...
...
TMessagesProj/src/main/res/values-nl/strings.xml
View file @
1b913b2a
...
...
@@ -245,6 +245,7 @@
<string
name=
"NoSound"
>
Geen geluid
</string>
<string
name=
"Default"
>
Standaard
</string>
<string
name=
"Support"
>
Ondersteuning
</string>
<string
name=
"OnlyIfSilent"
>
Alleen indien stil
</string>
<string
name=
"ChatBackground"
>
Achtergrond kiezen
</string>
<string
name=
"MessagesSettings"
>
Berichten
</string>
<string
name=
"SendByEnter"
>
Versturen met Enter
</string>
...
...
TMessagesProj/src/main/res/values-pt-rBR/strings.xml
View file @
1b913b2a
...
...
@@ -245,6 +245,7 @@
<string
name=
"NoSound"
>
Sem som
</string>
<string
name=
"Default"
>
Padrão
</string>
<string
name=
"Support"
>
Suporte
</string>
<string
name=
"OnlyIfSilent"
>
Only if silent
</string>
<string
name=
"ChatBackground"
>
Papel de Parede
</string>
<string
name=
"MessagesSettings"
>
Mensagens
</string>
<string
name=
"SendByEnter"
>
Enviar usando \'Enter\'
</string>
...
...
TMessagesProj/src/main/res/values-pt-rPT/strings.xml
View file @
1b913b2a
...
...
@@ -245,6 +245,7 @@
<string
name=
"NoSound"
>
Sem som
</string>
<string
name=
"Default"
>
Padrão
</string>
<string
name=
"Support"
>
Suporte
</string>
<string
name=
"OnlyIfSilent"
>
Only if silent
</string>
<string
name=
"ChatBackground"
>
Papel de Parede
</string>
<string
name=
"MessagesSettings"
>
Mensagens
</string>
<string
name=
"SendByEnter"
>
Enviar usando \'Enter\'
</string>
...
...
TMessagesProj/src/main/res/values/strings.xml
View file @
1b913b2a
...
...
@@ -245,6 +245,7 @@
<string
name=
"NoSound"
>
No sound
</string>
<string
name=
"Default"
>
Default
</string>
<string
name=
"Support"
>
Support
</string>
<string
name=
"OnlyIfSilent"
>
Only if silent
</string>
<string
name=
"ChatBackground"
>
Chat Background
</string>
<string
name=
"MessagesSettings"
>
Messages
</string>
<string
name=
"SendByEnter"
>
Send by Enter
</string>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment