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
90d8e8a3
Commit
90d8e8a3
authored
Nov 04, 2013
by
DrKLO
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update to 1.2.7
parent
27b74b53
Changes
55
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
55 changed files
with
632 additions
and
468 deletions
+632
-468
build.gradle
TMessagesProj/build.gradle
+6
-6
HockeySDK-3.0.1.jar
TMessagesProj/libs/HockeySDK-3.0.1.jar
+0
-0
AndroidManifest.xml
TMessagesProj/src/main/AndroidManifest.xml
+5
-3
countries.txt
TMessagesProj/src/main/assets/countries.txt
+0
-1
PhoneFormat.java
...j/src/main/java/org/telegram/PhoneFormat/PhoneFormat.java
+2
-2
ConnectionsManager.java
.../main/java/org/telegram/messenger/ConnectionsManager.java
+3
-3
Emoji.java
...sagesProj/src/main/java/org/telegram/messenger/Emoji.java
+9
-7
FileLoader.java
...Proj/src/main/java/org/telegram/messenger/FileLoader.java
+2
-1
GcmBroadcastReceiver.java
...ain/java/org/telegram/messenger/GcmBroadcastReceiver.java
+1
-1
MessagesController.java
.../main/java/org/telegram/messenger/MessagesController.java
+178
-165
MessagesStorage.java
...src/main/java/org/telegram/messenger/MessagesStorage.java
+97
-4
UserConfig.java
...Proj/src/main/java/org/telegram/messenger/UserConfig.java
+52
-50
Utilities.java
...sProj/src/main/java/org/telegram/messenger/Utilities.java
+44
-28
MessageObject.java
...roj/src/main/java/org/telegram/objects/MessageObject.java
+22
-21
ApplicationActivity.java
...oj/src/main/java/org/telegram/ui/ApplicationActivity.java
+6
-4
ApplicationLoader.java
...Proj/src/main/java/org/telegram/ui/ApplicationLoader.java
+14
-10
ChatActivity.java
...sagesProj/src/main/java/org/telegram/ui/ChatActivity.java
+37
-29
ChatProfileActivity.java
...oj/src/main/java/org/telegram/ui/ChatProfileActivity.java
+6
-6
ChatProfileChangeNameActivity.java
...n/java/org/telegram/ui/ChatProfileChangeNameActivity.java
+2
-2
ContactAddActivity.java
...roj/src/main/java/org/telegram/ui/ContactAddActivity.java
+2
-2
ContactsActivity.java
...sProj/src/main/java/org/telegram/ui/ContactsActivity.java
+8
-5
GalleryImageViewer.java
...roj/src/main/java/org/telegram/ui/GalleryImageViewer.java
+1
-1
GroupCreateActivity.java
...oj/src/main/java/org/telegram/ui/GroupCreateActivity.java
+4
-4
GroupCreateFinalActivity.java
...c/main/java/org/telegram/ui/GroupCreateFinalActivity.java
+1
-1
IdenticonActivity.java
...Proj/src/main/java/org/telegram/ui/IdenticonActivity.java
+2
-2
IntroActivity.java
...agesProj/src/main/java/org/telegram/ui/IntroActivity.java
+1
-1
LaunchActivity.java
...gesProj/src/main/java/org/telegram/ui/LaunchActivity.java
+10
-6
LocationActivity.java
...sProj/src/main/java/org/telegram/ui/LocationActivity.java
+12
-8
LoginActivity.java
...agesProj/src/main/java/org/telegram/ui/LoginActivity.java
+2
-2
MediaActivity.java
...agesProj/src/main/java/org/telegram/ui/MediaActivity.java
+1
-1
MessagesActivity.java
...sProj/src/main/java/org/telegram/ui/MessagesActivity.java
+10
-4
ScreenSlidePageFragmentPhone.java
...in/java/org/telegram/ui/ScreenSlidePageFragmentPhone.java
+8
-8
ScreenSlidePageFragmentRegister.java
...java/org/telegram/ui/ScreenSlidePageFragmentRegister.java
+6
-6
ScreenSlidePageFragmentSms.java
...main/java/org/telegram/ui/ScreenSlidePageFragmentSms.java
+8
-8
SettingsActivity.java
...sProj/src/main/java/org/telegram/ui/SettingsActivity.java
+6
-6
SettingsBlockedUsers.java
...j/src/main/java/org/telegram/ui/SettingsBlockedUsers.java
+1
-1
SettingsChangeNameActivity.java
...main/java/org/telegram/ui/SettingsChangeNameActivity.java
+3
-3
SettingsNotificationsActivity.java
...n/java/org/telegram/ui/SettingsNotificationsActivity.java
+13
-13
SettingsWallpapersActivity.java
...main/java/org/telegram/ui/SettingsWallpapersActivity.java
+7
-7
UserProfileActivity.java
...oj/src/main/java/org/telegram/ui/UserProfileActivity.java
+2
-2
AvatarUpdater.java
...oj/src/main/java/org/telegram/ui/Views/AvatarUpdater.java
+10
-5
BaseFragment.java
...roj/src/main/java/org/telegram/ui/Views/BaseFragment.java
+3
-2
NotificationView.java
...src/main/java/org/telegram/ui/Views/NotificationView.java
+14
-16
notification_layout.xml
TMessagesProj/src/main/res/layout-ar/notification_layout.xml
+0
-2
settings_name_layout.xml
...sagesProj/src/main/res/layout-ar/settings_name_layout.xml
+1
-0
chat_group_incoming_forward_layout.xml
...rc/main/res/layout/chat_group_incoming_forward_layout.xml
+1
-1
chat_group_incoming_text_layout.xml
...j/src/main/res/layout/chat_group_incoming_text_layout.xml
+1
-1
chat_incoming_forward_layout.xml
...Proj/src/main/res/layout/chat_incoming_forward_layout.xml
+1
-1
chat_incoming_text_layout.xml
...gesProj/src/main/res/layout/chat_incoming_text_layout.xml
+1
-1
chat_outgoing_forward_layout.xml
...Proj/src/main/res/layout/chat_outgoing_forward_layout.xml
+1
-1
chat_outgoing_text_layout.xml
...gesProj/src/main/res/layout/chat_outgoing_text_layout.xml
+1
-1
notification_layout.xml
TMessagesProj/src/main/res/layout/notification_layout.xml
+0
-2
settings_name_layout.xml
TMessagesProj/src/main/res/layout/settings_name_layout.xml
+1
-0
strings.xml
TMessagesProj/src/main/res/values-ar/strings.xml
+1
-0
strings.xml
TMessagesProj/src/main/res/values/strings.xml
+2
-1
No files found.
TMessagesProj/build.gradle
View file @
90d8e8a3
...
...
@@ -32,18 +32,18 @@ tasks.withType(Compile) {
dependencies
{
compile
'com.actionbarsherlock:actionbarsherlock:4.4.0@aar'
compile
'com.google.android.gms:play-services:
3.1
.+'
compile
'net.hockeyapp.android:HockeySDK:3.0.
0
'
compile
'com.android.support:support-v4:1
8
.0.+'
compile
'com.google.android.gms:play-services:
4.0
.+'
compile
'net.hockeyapp.android:HockeySDK:3.0.
1
'
compile
'com.android.support:support-v4:1
9
.0.+'
compile
fileTree
(
dir:
"$buildDir/native-libs"
,
include:
'*.jar'
)
}
android
{
compileSdkVersion
1
8
buildToolsVersion
"1
7
.0.0"
compileSdkVersion
1
9
buildToolsVersion
"1
9
.0.0"
defaultConfig
{
minSdkVersion
8
targetSdkVersion
1
8
targetSdkVersion
1
9
}
}
TMessagesProj/libs/HockeySDK-3.0.
0
.jar
→
TMessagesProj/libs/HockeySDK-3.0.
1
.jar
View file @
90d8e8a3
No preview for this file type
TMessagesProj/src/main/AndroidManifest.xml
View file @
90d8e8a3
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android=
"http://schemas.android.com/apk/res/android"
package=
"org.telegram.messenger"
android:versionCode=
"9
1
"
android:versionName=
"1.2.
4
"
>
android:versionCode=
"9
8
"
android:versionName=
"1.2.
7
"
>
<supports-screens
android:anyDensity=
"true"
android:smallScreens=
"true"
...
...
@@ -11,7 +11,7 @@
android:resizeable=
"true"
android:xlargeScreens=
"true"
/>
<uses-sdk
android:minSdkVersion=
"8"
android:targetSdkVersion=
"1
8
"
/>
<uses-sdk
android:minSdkVersion=
"8"
android:targetSdkVersion=
"1
9
"
/>
<uses-feature
android:glEsVersion=
"0x00020000"
android:required=
"true"
/>
<uses-feature
android:name=
"android.hardware.telephony"
android:required=
"false"
/>
...
...
@@ -19,6 +19,8 @@
<uses-feature
android:name=
"android.hardware.location.network"
android:required=
"false"
/>
<uses-feature
android:name=
"android.hardware.location"
android:required=
"false"
/>
<uses-feature
android:name=
"android.hardware.camera.autofocus"
android:required=
"false"
/>
<uses-feature
android:name=
"android.hardware.camera"
android:required=
"false"
/>
<uses-feature
android:name=
"android.hardware.wifi"
android:required=
"false"
/>
<uses-feature
android:name=
"android.hardware.LOCATION"
android:required=
"false"
/>
<uses-permission
android:name=
"android.permission.INTERNET"
/>
...
...
TMessagesProj/src/main/assets/countries.txt
View file @
90d8e8a3
...
...
@@ -228,7 +228,6 @@
31;NL;Netherlands
30;GR;Greece
27;ZA;South Africa
21;DZ;Algeria
20;EG;Egypt
7;KZ;Kazakhstan
7;RU;Russia
...
...
TMessagesProj/src/main/java/org/telegram/PhoneFormat/PhoneFormat.java
View file @
90d8e8a3
...
...
@@ -24,7 +24,7 @@
package
org
.
telegram
.
PhoneFormat
;
import
org.telegram.
messenger.Utilities
;
import
org.telegram.
ui.ApplicationLoader
;
import
java.io.ByteArrayOutputStream
;
import
java.io.InputStream
;
...
...
@@ -78,7 +78,7 @@ public class PhoneFormat {
public
void
init
(
String
countryCode
)
{
try
{
InputStream
stream
=
Utilities
.
applicationContext
.
getAssets
().
open
(
"PhoneFormats.dat"
);
InputStream
stream
=
ApplicationLoader
.
applicationContext
.
getAssets
().
open
(
"PhoneFormats.dat"
);
ByteArrayOutputStream
bos
=
new
ByteArrayOutputStream
();
byte
[]
buf
=
new
byte
[
1024
];
int
len
;
...
...
TMessagesProj/src/main/java/org/telegram/messenger/ConnectionsManager.java
View file @
90d8e8a3
...
...
@@ -150,7 +150,7 @@ public class ConnectionsManager implements Action.ActionDelegate, TcpConnection.
Utilities
.
stageQueue
.
postRunnable
(
new
Runnable
()
{
@Override
public
void
run
()
{
File
configFile
=
new
File
(
Utilities
.
applicationContext
.
getFilesDir
(),
"config.dat"
);
File
configFile
=
new
File
(
ApplicationLoader
.
applicationContext
.
getFilesDir
(),
"config.dat"
);
if
(
configFile
.
exists
())
{
try
{
SerializedData
data
=
new
SerializedData
(
configFile
);
...
...
@@ -235,7 +235,7 @@ public class ConnectionsManager implements Action.ActionDelegate, TcpConnection.
data
.
writeInt32
(
0
);
}
try
{
File
configFile
=
new
File
(
Utilities
.
applicationContext
.
getFilesDir
(),
"config.dat"
);
File
configFile
=
new
File
(
ApplicationLoader
.
applicationContext
.
getFilesDir
(),
"config.dat"
);
if
(!
configFile
.
exists
())
{
configFile
.
createNewFile
();
}
...
...
@@ -491,7 +491,7 @@ public class ConnectionsManager implements Action.ActionDelegate, TcpConnection.
public
static
boolean
isNetworkOnline
()
{
boolean
status
=
false
;
try
{
ConnectivityManager
cm
=
(
ConnectivityManager
)
Utilities
.
applicationContext
.
getSystemService
(
Context
.
CONNECTIVITY_SERVICE
);
ConnectivityManager
cm
=
(
ConnectivityManager
)
ApplicationLoader
.
applicationContext
.
getSystemService
(
Context
.
CONNECTIVITY_SERVICE
);
NetworkInfo
netInfo
=
cm
.
getNetworkInfo
(
0
);
if
(
netInfo
!=
null
&&
netInfo
.
getState
()
==
NetworkInfo
.
State
.
CONNECTED
)
{
status
=
true
;
...
...
TMessagesProj/src/main/java/org/telegram/messenger/Emoji.java
View file @
90d8e8a3
...
...
@@ -27,6 +27,8 @@ import android.view.View;
import
android.view.ViewGroup
;
import
android.widget.TextView
;
import
org.telegram.ui.ApplicationLoader
;
public
class
Emoji
{
private
static
final
int
[]
ROW_SIZES
=
{
27
,
29
,
33
,
34
,
34
};
private
static
HashMap
<
Long
,
DrawableInfo
>
rects
=
new
HashMap
<
Long
,
DrawableInfo
>();
...
...
@@ -287,7 +289,7 @@ public class Emoji {
0x00000000D83DDD34
L
,
0x00000000D83DDD35
L
,
0x00000000D83DDD3B
L
,
0x00000000D83DDD36
L
,
0x00000000D83DDD37
L
,
0x00000000D83DDD38
L
,
0x00000000D83DDD39
L
}};
static
{
imgSize
=
Math
.
min
(
scale
(
30
),
Utilities
.
applicationContext
.
getResources
().
getDisplayMetrics
().
density
<
1.5f
?
28
:
56
);
imgSize
=
Math
.
min
(
scale
(
30
),
ApplicationLoader
.
applicationContext
.
getResources
().
getDisplayMetrics
().
density
<
1.5f
?
28
:
56
);
drawImgSize
=
scale
(
20
);
bigImgSize
=
scale
(
30
);
if
(
Math
.
abs
(
imgSize
-
bigImgSize
)
<
5
)
{
...
...
@@ -306,7 +308,7 @@ public class Emoji {
}
public
static
int
scale
(
float
value
)
{
return
(
int
)(
Utilities
.
applicationContext
.
getResources
().
getDisplayMetrics
().
density
*
value
);
return
(
int
)(
ApplicationLoader
.
applicationContext
.
getResources
().
getDisplayMetrics
().
density
*
value
);
}
private
static
Bitmap
loadPage
(
final
int
page
){
...
...
@@ -317,13 +319,13 @@ public class Emoji {
opts
.
inPreferredConfig
=
Bitmap
.
Config
.
ARGB_8888
;
opts
.
inDither
=
false
;
if
(
Utilities
.
applicationContext
.
getResources
().
getDisplayMetrics
().
density
<
1.5f
)
{
if
(
ApplicationLoader
.
applicationContext
.
getResources
().
getDisplayMetrics
().
density
<
1.5f
)
{
opts
.
inSampleSize
=
2
;
}
int
iw
,
ih
;
InputStream
is
=
Utilities
.
applicationContext
.
getAssets
().
open
(
"emojisprite_"
+
page
+
".png"
);
InputStream
is
=
ApplicationLoader
.
applicationContext
.
getAssets
().
open
(
"emojisprite_"
+
page
+
".png"
);
Bitmap
color
=
BitmapFactory
.
decodeStream
(
is
,
null
,
opts
);
is
.
close
();
...
...
@@ -559,8 +561,8 @@ public class Emoji {
int
sz
=
super
.
getSize
(
paint
,
text
,
start
,
end
,
fm
);
int
offset
=
(
int
)(
8
*
Utilities
.
applicationContext
.
getResources
().
getDisplayMetrics
().
density
);
int
w
=
(
int
)(
20
*
Utilities
.
applicationContext
.
getResources
().
getDisplayMetrics
().
density
/
2
);
int
offset
=
(
int
)(
8
*
ApplicationLoader
.
applicationContext
.
getResources
().
getDisplayMetrics
().
density
);
int
w
=
(
int
)(
20
*
ApplicationLoader
.
applicationContext
.
getResources
().
getDisplayMetrics
().
density
/
2
);
fm
.
top
=
-
w
-
offset
;
fm
.
bottom
=
w
-
offset
;
fm
.
ascent
=
-
w
-
offset
;
...
...
@@ -586,7 +588,7 @@ public class Emoji {
int
sz
=
super
.
getSize
(
paint
,
text
,
start
,
end
,
fm
);
int
offset
=
(
int
)(
6
*
Utilities
.
applicationContext
.
getResources
().
getDisplayMetrics
().
density
);
int
offset
=
(
int
)(
6
*
ApplicationLoader
.
applicationContext
.
getResources
().
getDisplayMetrics
().
density
);
int
w
=
(
fm
.
bottom
-
fm
.
top
)
/
2
;
fm
.
top
=
-
w
-
offset
;
fm
.
bottom
=
w
-
offset
;
...
...
TMessagesProj/src/main/java/org/telegram/messenger/FileLoader.java
View file @
90d8e8a3
...
...
@@ -18,6 +18,7 @@ import android.view.View;
import
android.widget.ImageView
;
import
org.telegram.TL.TLRPC
;
import
org.telegram.ui.ApplicationLoader
;
import
org.telegram.ui.Views.BackupImageView
;
import
java.io.ByteArrayOutputStream
;
...
...
@@ -247,7 +248,7 @@ public class FileLoader {
public
FileLoader
()
{
int
maxMemory
=
(
int
)
Runtime
.
getRuntime
().
maxMemory
();
int
cacheSize
=
maxMemory
/
10
;
density
=
Utilities
.
applicationContext
.
getResources
().
getDisplayMetrics
().
density
;
density
=
ApplicationLoader
.
applicationContext
.
getResources
().
getDisplayMetrics
().
density
;
if
(
Build
.
VERSION
.
SDK_INT
<
11
)
{
runtimeHack
=
new
VMRuntimeHack
();
cacheSize
=
1024
*
1024
*
3
;
...
...
TMessagesProj/src/main/java/org/telegram/messenger/GcmBroadcastReceiver.java
View file @
90d8e8a3
...
...
@@ -198,7 +198,7 @@ public class GcmBroadcastReceiver extends BroadcastReceiver {
PendingIntent
contentIntent
=
PendingIntent
.
getActivity
(
context
,
0
,
intent
,
PendingIntent
.
FLAG_ONE_SHOT
);
NotificationCompat
.
Builder
mBuilder
=
new
NotificationCompat
.
Builder
(
context
)
.
setContentTitle
(
Utilities
.
applicationContext
.
getString
(
R
.
string
.
AppName
))
.
setContentTitle
(
ApplicationLoader
.
applicationContext
.
getString
(
R
.
string
.
AppName
))
.
setSmallIcon
(
R
.
drawable
.
notification
)
.
setStyle
(
new
NotificationCompat
.
BigTextStyle
()
.
bigText
(
msg
))
...
...
TMessagesProj/src/main/java/org/telegram/messenger/MessagesController.java
View file @
90d8e8a3
This diff is collapsed.
Click to expand it.
TMessagesProj/src/main/java/org/telegram/messenger/MessagesStorage.java
View file @
90d8e8a3
...
...
@@ -17,6 +17,7 @@ import org.telegram.SQLite.SQLitePreparedStatement;
import
org.telegram.TL.TLClassStore
;
import
org.telegram.TL.TLObject
;
import
org.telegram.TL.TLRPC
;
import
org.telegram.ui.ApplicationLoader
;
import
java.io.File
;
import
java.util.ArrayList
;
...
...
@@ -28,6 +29,13 @@ public class MessagesStorage {
public
DispatchQueue
storageQueue
=
new
DispatchQueue
(
"storageQueue"
);
private
SQLiteDatabase
database
;
private
File
cacheFile
;
public
static
int
lastDateValue
=
0
;
public
static
int
lastPtsValue
=
0
;
public
static
int
lastQtsValue
=
0
;
public
static
int
lastSeqValue
=
0
;
public
static
int
lastSecretVersion
=
0
;
public
static
byte
[]
secretPBytes
=
null
;
public
static
int
secretG
=
0
;
public
static
final
int
wallpapersDidLoaded
=
171
;
public
static
MessagesStorage
Instance
=
new
MessagesStorage
();
...
...
@@ -38,7 +46,7 @@ public class MessagesStorage {
}
public
void
openDatabase
()
{
cacheFile
=
new
File
(
Utilities
.
applicationContext
.
getFilesDir
(),
"cache4.db"
);
cacheFile
=
new
File
(
ApplicationLoader
.
applicationContext
.
getFilesDir
(),
"cache4.db"
);
boolean
createTable
=
false
;
//cacheFile.delete();
if
(!
cacheFile
.
exists
())
{
...
...
@@ -60,6 +68,8 @@ public class MessagesStorage {
database
.
executeFast
(
"CREATE TABLE wallpapers(uid INTEGER PRIMARY KEY, data BLOB)"
).
stepThis
().
dispose
();
database
.
executeFast
(
"CREATE TABLE randoms(random_id INTEGER PRIMARY KEY, mid INTEGER)"
).
stepThis
().
dispose
();
database
.
executeFast
(
"CREATE TABLE enc_tasks(date INTEGER, data BLOB)"
).
stepThis
().
dispose
();
database
.
executeFast
(
"CREATE TABLE params(id INTEGER PRIMARY KEY, seq INTEGER, pts INTEGER, date INTEGER, qts INTEGER, lsv INTEGER, sg INTEGER, pbytes BLOB)"
).
stepThis
().
dispose
();
database
.
executeFast
(
"INSERT INTO params VALUES(1, 0, 0, 0, 0, 0, 0, NULL)"
).
stepThis
().
dispose
();
database
.
executeFast
(
"CREATE INDEX IF NOT EXISTS date_idx_dialogs ON dialogs(date);"
).
stepThis
().
dispose
();
database
.
executeFast
(
"CREATE INDEX IF NOT EXISTS date_idx_enc_tasks ON enc_tasks(date);"
).
stepThis
().
dispose
();
...
...
@@ -69,6 +79,41 @@ public class MessagesStorage {
database
.
executeFast
(
"CREATE INDEX IF NOT EXISTS uid_mid_idx_media ON media(uid, mid);"
).
stepThis
().
dispose
();
database
.
executeFast
(
"CREATE INDEX IF NOT EXISTS ttl_idx_messages ON messages(ttl);"
).
stepThis
().
dispose
();
database
.
executeFast
(
"CREATE INDEX IF NOT EXISTS read_state_out_idx_messages ON messages(read_state, out);"
).
stepThis
().
dispose
();
}
else
{
SQLiteCursor
cursor
=
database
.
queryFinalized
(
"SELECT count(*) FROM sqlite_master WHERE type='table' AND name='params'"
);
boolean
create
=
false
;
if
(
cursor
.
next
())
{
int
count
=
cursor
.
intValue
(
0
);
if
(
count
==
0
)
{
create
=
true
;
}
}
else
{
create
=
true
;
}
cursor
.
dispose
();
if
(
create
)
{
database
.
executeFast
(
"CREATE TABLE params(id INTEGER PRIMARY KEY, seq INTEGER, pts INTEGER, date INTEGER, qts INTEGER, lsv INTEGER, sg INTEGER, pbytes BLOB)"
).
stepThis
().
dispose
();
database
.
executeFast
(
"INSERT INTO params VALUES(1, 0, 0, 0, 0, 0, 0, NULL)"
).
stepThis
().
dispose
();
}
else
{
cursor
=
database
.
queryFinalized
(
"SELECT seq, pts, date, qts, lsv, sg, pbytes FROM params WHERE id = 1"
);
if
(
cursor
.
next
())
{
lastSeqValue
=
cursor
.
intValue
(
0
);
lastPtsValue
=
cursor
.
intValue
(
1
);
lastDateValue
=
cursor
.
intValue
(
2
);
lastQtsValue
=
cursor
.
intValue
(
3
);
lastSecretVersion
=
cursor
.
intValue
(
4
);
secretG
=
cursor
.
intValue
(
5
);
if
(
cursor
.
isNull
(
6
))
{
secretPBytes
=
null
;
}
else
{
secretPBytes
=
cursor
.
byteArrayValue
(
6
);
if
(
secretPBytes
!=
null
&&
secretPBytes
.
length
==
1
)
{
secretPBytes
=
null
;
}
}
}
cursor
.
dispose
();
}
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
...
...
@@ -79,6 +124,13 @@ public class MessagesStorage {
storageQueue
.
postRunnable
(
new
Runnable
()
{
@Override
public
void
run
()
{
lastDateValue
=
0
;
lastSeqValue
=
0
;
lastPtsValue
=
0
;
lastQtsValue
=
0
;
lastSecretVersion
=
0
;
secretPBytes
=
null
;
secretG
=
0
;
if
(
database
!=
null
)
{
database
.
close
();
database
=
null
;
...
...
@@ -88,15 +140,15 @@ public class MessagesStorage {
cacheFile
=
null
;
}
try
{
File
old
=
new
File
(
Utilities
.
applicationContext
.
getFilesDir
(),
"cache.db"
);
File
old
=
new
File
(
ApplicationLoader
.
applicationContext
.
getFilesDir
(),
"cache.db"
);
if
(
old
.
exists
())
{
old
.
delete
();
}
old
=
new
File
(
Utilities
.
applicationContext
.
getFilesDir
(),
"cache2.db"
);
old
=
new
File
(
ApplicationLoader
.
applicationContext
.
getFilesDir
(),
"cache2.db"
);
if
(
old
.
exists
())
{
old
.
delete
();
}
old
=
new
File
(
Utilities
.
applicationContext
.
getFilesDir
(),
"cache3.db"
);
old
=
new
File
(
ApplicationLoader
.
applicationContext
.
getFilesDir
(),
"cache3.db"
);
if
(
old
.
exists
())
{
old
.
delete
();
}
...
...
@@ -108,6 +160,47 @@ public class MessagesStorage {
});
}
public
void
saveSecretParams
(
final
int
lsv
,
final
int
sg
,
final
byte
[]
pbytes
)
{
storageQueue
.
postRunnable
(
new
Runnable
()
{
@Override
public
void
run
()
{
try
{
SQLitePreparedStatement
state
=
database
.
executeFast
(
"UPDATE params SET lsv = ?, sg = ?, pbytes = ? WHERE id = 1"
);
state
.
bindInteger
(
1
,
lsv
);
state
.
bindInteger
(
2
,
sg
);
if
(
pbytes
!=
null
)
{
state
.
bindByteArray
(
3
,
pbytes
);
}
else
{
state
.
bindByteArray
(
3
,
new
byte
[
1
]);
}
state
.
step
();
state
.
dispose
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
});
}
public
void
saveDiffParams
(
final
int
seq
,
final
int
pts
,
final
int
date
,
final
int
qts
)
{
storageQueue
.
postRunnable
(
new
Runnable
()
{
@Override
public
void
run
()
{
try
{
SQLitePreparedStatement
state
=
database
.
executeFast
(
"UPDATE params SET seq = ?, pts = ?, date = ?, qts = ? WHERE id = 1"
);
state
.
bindInteger
(
1
,
seq
);
state
.
bindInteger
(
2
,
pts
);
state
.
bindInteger
(
3
,
date
);
state
.
bindInteger
(
4
,
qts
);
state
.
step
();
state
.
dispose
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
});
}
public
void
putWallpapers
(
final
ArrayList
<
TLRPC
.
WallPaper
>
wallPapers
)
{
storageQueue
.
postRunnable
(
new
Runnable
()
{
@Override
...
...
TMessagesProj/src/main/java/org/telegram/messenger/UserConfig.java
View file @
90d8e8a3
...
...
@@ -8,8 +8,12 @@
package
org
.
telegram
.
messenger
;
import
android.content.Context
;
import
android.content.SharedPreferences
;
import
org.telegram.TL.TLClassStore
;
import
org.telegram.TL.TLRPC
;
import
org.telegram.ui.ApplicationLoader
;
import
java.io.File
;
import
java.io.FileOutputStream
;
...
...
@@ -18,17 +22,10 @@ public class UserConfig {
public
static
TLRPC
.
User
currentUser
;
public
static
int
clientUserId
=
0
;
public
static
boolean
clientActivated
=
false
;
public
static
int
lastDateValue
=
0
;
public
static
int
lastPtsValue
=
0
;
public
static
int
lastQtsValue
=
0
;
public
static
int
lastSeqValue
=
0
;
public
static
boolean
registeredForPush
=
false
;
public
static
String
pushString
=
""
;
public
static
int
lastSendMessageId
=
-
1
;
public
static
int
lastLocalId
=
-
1
;
public
static
int
lastSecretVersion
=
0
;
public
static
byte
[]
secretPBytes
=
null
;
public
static
int
secretG
=
0
;
public
static
String
contactsHash
=
""
;
public
static
String
importHash
=
""
;
private
final
static
Integer
sync
=
1
;
...
...
@@ -43,64 +40,58 @@ public class UserConfig {
return
id
;
}
public
static
void
saveConfig
()
{
public
static
void
saveConfig
(
boolean
withFile
)
{
synchronized
(
sync
)
{
SerializedData
data
=
new
SerializedData
();
if
(
currentUser
!=
null
)
{
data
.
writeInt32
(
1
);
data
.
writeInt32
(
2
);
currentUser
.
serializeToStream
(
data
);
clientUserId
=
currentUser
.
id
;
clientActivated
=
true
;
data
.
writeInt32
(
lastDateValue
);
data
.
writeInt32
(
lastPtsValue
);
data
.
writeInt32
(
lastSeqValue
);
data
.
writeBool
(
registeredForPush
);
data
.
writeString
(
pushString
);
data
.
writeInt32
(
lastSendMessageId
);
data
.
writeInt32
(
lastLocalId
);
data
.
writeString
(
contactsHash
);
data
.
writeString
(
importHash
);
data
.
writeBool
(
saveIncomingPhotos
);
data
.
writeInt32
(
lastQtsValue
);
data
.
writeInt32
(
lastSecretVersion
);
if
(
secretPBytes
!=
null
)
{
data
.
writeInt32
(
1
);
data
.
writeByteArray
(
secretPBytes
);
}
else
{
data
.
writeInt32
(
0
);
}
data
.
writeInt32
(
secretG
);
SharedPreferences
preferences
=
ApplicationLoader
.
applicationContext
.
getSharedPreferences
(
"userconfing"
,
Context
.
MODE_PRIVATE
);
SharedPreferences
.
Editor
editor
=
preferences
.
edit
();
editor
.
putBoolean
(
"registeredForPush"
,
registeredForPush
);
editor
.
putString
(
"pushString"
,
pushString
);
editor
.
putInt
(
"lastSendMessageId"
,
lastSendMessageId
);
editor
.
putInt
(
"lastLocalId"
,
lastLocalId
);
editor
.
putString
(
"contactsHash"
,
contactsHash
);
editor
.
putString
(
"importHash"
,
importHash
);
editor
.
putBoolean
(
"saveIncomingPhotos"
,
saveIncomingPhotos
);
editor
.
commit
();
}
else
{
data
.
writeInt32
(
0
);
}
try
{
File
configFile
=
new
File
(
Utilities
.
applicationContext
.
getFilesDir
(),
"user.dat"
);
if
(!
configFile
.
exists
())
{
configFile
.
createNewFile
();
if
(
withFile
)
{
try
{
File
configFile
=
new
File
(
ApplicationLoader
.
applicationContext
.
getFilesDir
(),
"user.dat"
);
if
(!
configFile
.
exists
())
{
configFile
.
createNewFile
();
}
FileOutputStream
stream
=
new
FileOutputStream
(
configFile
);
stream
.
write
(
data
.
toByteArray
());
stream
.
close
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
FileOutputStream
stream
=
new
FileOutputStream
(
configFile
);
stream
.
write
(
data
.
toByteArray
());
stream
.
close
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
}
public
static
void
loadConfig
()
{
synchronized
(
sync
)
{
File
configFile
=
new
File
(
Utilities
.
applicationContext
.
getFilesDir
(),
"user.dat"
);
File
configFile
=
new
File
(
ApplicationLoader
.
applicationContext
.
getFilesDir
(),
"user.dat"
);
if
(
configFile
.
exists
())
{
try
{
SerializedData
data
=
new
SerializedData
(
configFile
);
if
(
data
.
readInt32
()
!=
0
)
{
int
ver
=
data
.
readInt32
();
if
(
ver
==
1
)
{
int
constructor
=
data
.
readInt32
();
currentUser
=
(
TLRPC
.
TL_userSelf
)
TLClassStore
.
Instance
().
TLdeserialize
(
data
,
constructor
);
clientUserId
=
currentUser
.
id
;
clientActivated
=
true
;
lastDateValue
=
data
.
readInt32
();
lastPtsValue
=
data
.
readInt32
();
lastSeqValue
=
data
.
readInt32
();
MessagesStorage
.
lastDateValue
=
data
.
readInt32
();
MessagesStorage
.
lastPtsValue
=
data
.
readInt32
();
MessagesStorage
.
lastSeqValue
=
data
.
readInt32
();
registeredForPush
=
data
.
readBool
();
pushString
=
data
.
readString
();
lastSendMessageId
=
data
.
readInt32
();
...
...
@@ -115,13 +106,27 @@ public class UserConfig {
currentUser
.
status
.
expires
=
currentUser
.
status
.
was_online
;
}
}
lastQtsValue
=
data
.
readInt32
();
lastSecretVersion
=
data
.
readInt32
();
MessagesStorage
.
lastQtsValue
=
data
.
readInt32
();
MessagesStorage
.
lastSecretVersion
=
data
.
readInt32
();
int
val
=
data
.
readInt32
();
if
(
val
==
1
)
{
secretPBytes
=
data
.
readByteArray
();
MessagesStorage
.
secretPBytes
=
data
.
readByteArray
();
}
secretG
=
data
.
readInt32
();
MessagesStorage
.
secretG
=
data
.
readInt32
();
}
else
if
(
ver
==
2
)
{
int
constructor
=
data
.
readInt32
();
currentUser
=
(
TLRPC
.
TL_userSelf
)
TLClassStore
.
Instance
().
TLdeserialize
(
data
,
constructor
);
clientUserId
=
currentUser
.
id
;
clientActivated
=
true
;
SharedPreferences
preferences
=
ApplicationLoader
.
applicationContext
.
getSharedPreferences
(
"userconfing"
,
Context
.
MODE_PRIVATE
);
registeredForPush
=
preferences
.
getBoolean
(
"registeredForPush"
,
false
);
pushString
=
preferences
.
getString
(
"pushString"
,
""
);
lastSendMessageId
=
preferences
.
getInt
(
"lastSendMessageId"
,
-
1
);
lastLocalId
=
preferences
.
getInt
(
"lastLocalId"
,
-
1
);
contactsHash
=
preferences
.
getString
(
"contactsHash"
,
""
);
importHash
=
preferences
.
getString
(
"importHash"
,
""
);
saveIncomingPhotos
=
preferences
.
getBoolean
(
"saveIncomingPhotos"
,
false
);
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
...
...
@@ -134,15 +139,12 @@ public class UserConfig {
clientUserId
=
0
;
clientActivated
=
false
;
currentUser
=
null
;
lastDateValue
=
0
;
lastSeqValue
=
0
;
lastPtsValue
=
0
;
registeredForPush
=
false
;
contactsHash
=
""
;
lastLocalId
=
-
1
;
importHash
=
""
;
lastSendMessageId
=
-
1
;
saveIncomingPhotos
=
false
;
saveConfig
();
saveConfig
(
true
);
}
}
TMessagesProj/src/main/java/org/telegram/messenger/Utilities.java
View file @
90d8e8a3
...
...
@@ -18,6 +18,7 @@ import android.os.Environment;
import
android.os.Handler
;
import
android.text.Html
;
import
android.text.SpannableStringBuilder
;
import
android.text.format.DateFormat
;
import
android.util.AttributeSet
;
import
android.util.Log
;
import
android.view.View
;
...
...
@@ -25,6 +26,7 @@ import android.view.inputmethod.InputMethodManager;
import
org.telegram.TL.TLClassStore
;
import
org.telegram.TL.TLObject
;
import
org.telegram.ui.ApplicationLoader
;
import
java.io.ByteArrayInputStream
;
import
java.io.ByteArrayOutputStream
;
...
...
@@ -50,7 +52,6 @@ import java.util.zip.GZIPInputStream;
import
javax.crypto.Cipher
;
public
class
Utilities
{
public
static
Context
applicationContext
;
public
static
Handler
applicationHandler
;
private
final
static
Integer
lock
=
1
;
...
...
@@ -77,10 +78,10 @@ public class Utilities {
public
static
File
getCacheDir
()
{
if
(
externalCacheNotAvailableState
==
1
||
externalCacheNotAvailableState
==
0
&&
Environment
.
getExternalStorageState
().
startsWith
(
Environment
.
MEDIA_MOUNTED
))
{
externalCacheNotAvailableState
=
1
;
return
applicationContext
.
getExternalCacheDir
();
return
ApplicationLoader
.
applicationContext
.
getExternalCacheDir
();
}
externalCacheNotAvailableState
=
2
;
return
applicationContext
.
getCacheDir
();
return
ApplicationLoader
.
applicationContext
.
getCacheDir
();
}
public
static
TPFactorizedValue
getFactorizedValue
(
long
what
)
{
...
...
@@ -230,7 +231,7 @@ public class Utilities {
synchronized
(
cache
)
{
if
(!
cache
.
containsKey
(
assetPath
))
{
try
{
Typeface
t
=
Typeface
.
createFromAsset
(
applicationContext
.
getAssets
(),
Typeface
t
=
Typeface
.
createFromAsset
(
ApplicationLoader
.
applicationContext
.
getAssets
(),
assetPath
);
cache
.
put
(
assetPath
,
t
);
}
catch
(
Exception
e
)
{
...
...
@@ -304,11 +305,19 @@ public class Utilities {
formatterYearMax
=
FastDateFormat
.
getInstance
(
"dd.MM.yyyy"
,
locale
);
chatDate
=
FastDateFormat
.
getInstance
(
"d MMMM"
,
locale
);
chatFullDate
=
FastDateFormat
.
getInstance
(
"d MMMM yyyy"
,
locale
);
if
(
lang
!=
null
&&
lang
.
toLowerCase
().
equals
(
"ar"
))
{
formatterDay
=
FastDateFormat
.
getInstance
(
"h:mm a"
,
locale
);
if
(
lang
!=
null
)
{
if
(
DateFormat
.
is24HourFormat
(
ApplicationLoader
.
applicationContext
))
{
formatterDay
=
FastDateFormat
.
getInstance
(
"HH:mm"
,
locale
);
}
else
{
if
(
lang
.
toLowerCase
().
equals
(
"ar"
))
{
formatterDay
=
FastDateFormat
.
getInstance
(
"h:mm a"
,
locale
);
}
else
{
formatterDay
=
FastDateFormat
.
getInstance
(
"h:mm a"
,
Locale
.
US
);
}
}
}
else
{
formatterDay
=
FastDateFormat
.
getInstance
(
"h:mm a"
,
Locale
.
US
);
}
formatterDay
=
FastDateFormat
.
getInstance
(
"h:mm a"
,
Locale
.
US
);
}
}
public
static
String
formatDateChat
(
long
date
)
{
...
...
@@ -335,7 +344,7 @@ public class Utilities {
if
(
dateDay
==
day
&&
year
==
dateYear
)
{
return
formatterDay
.
format
(
new
Date
(
date
*
1000
));
}
else
if
(
dateDay
+
1
==
day
&&
year
==
dateYear
)
{
return
applicationContext
.
getResources
().
getString
(
R
.
string
.
Yesterday
);
return
ApplicationLoader
.
applicationContext
.
getResources
().
getString
(
R
.
string
.
Yesterday
);
}
else
if
(
year
==
dateYear
)
{
return
formatterMonth
.
format
(
new
Date
(
date
*
1000
));
}
else
{
...
...
@@ -352,13 +361,13 @@ public class Utilities {
int
dateYear
=
rightNow
.
get
(
Calendar
.
YEAR
);
if
(
dateDay
==
day
&&
year
==
dateYear
)
{
return
String
.
format
(
"%s %s"
,
applicationContext
.
getResources
().
getString
(
R
.
string
.
TodayAt
),
formatterDay
.
format
(
new
Date
(
date
*
1000
)));
return
String
.
format
(
"%s %s"
,
ApplicationLoader
.
applicationContext
.
getResources
().
getString
(
R
.
string
.
TodayAt
),
formatterDay
.
format
(
new
Date
(
date
*
1000
)));
}
else
if
(
dateDay
+
1
==
day
&&
year
==
dateYear
)
{
return
String
.
format
(
"%s %s"
,
applicationContext
.
getResources
().
getString
(
R
.
string
.
YesterdayAt
),
formatterDay
.
format
(
new
Date
(
date
*
1000
)));
return
String
.
format
(
"%s %s"
,
ApplicationLoader
.
applicationContext
.
getResources
().
getString
(
R
.
string
.
YesterdayAt
),
formatterDay
.
format
(
new
Date
(
date
*
1000
)));
}
else
if
(
year
==
dateYear
)
{
return
String
.
format
(
"%s %s %s"
,
formatterMonth
.
format
(
new
Date
(
date
*
1000
)),
applicationContext
.
getResources
().
getString
(
R
.
string
.
OtherAt
),
formatterDay
.
format
(
new
Date
(
date
*
1000
)));
return
String
.
format
(
"%s %s %s"
,
formatterMonth
.
format
(
new
Date
(
date
*
1000
)),
ApplicationLoader
.
applicationContext
.
getResources
().
getString
(
R
.
string
.
OtherAt
),
formatterDay
.
format
(
new
Date
(
date
*
1000
)));
}
else
{
return
String
.
format
(
"%s %s %s"
,
formatterYear
.
format
(
new
Date
(
date
*
1000
)),
applicationContext
.
getResources
().
getString
(
R
.
string
.
OtherAt
),
formatterDay
.
format
(
new
Date
(
date
*
1000
)));
return
String
.
format
(
"%s %s %s"
,
formatterYear
.
format
(
new
Date
(
date
*
1000
)),
ApplicationLoader
.
applicationContext
.
getResources
().
getString
(
R
.
string
.
OtherAt
),
formatterDay
.
format
(
new
Date
(
date
*
1000
)));
}
}
...
...
@@ -401,7 +410,7 @@ public class Utilities {
public
static
void
RunOnUIThread
(
Runnable
runnable
)
{
synchronized
(
lock
)
{
if
(
applicationHandler
==
null
)
{
applicationHandler
=
new
Handler
(
applicationContext
.
getMainLooper
());
applicationHandler
=
new
Handler
(
ApplicationLoader
.
applicationContext
.
getMainLooper
());
}
applicationHandler
.
post
(
runnable
);
}
...
...
@@ -419,18 +428,25 @@ public class Utilities {
R
.
drawable
.
user_placeholder_orange
};
public
static
int
[]
arrGroupsAvatars
=
{
R
.
drawable
.
group_placeholder_red
,
R
.
drawable
.
group_placeholder_green
,
R
.
drawable
.
group_placeholder_
yellow
,
R
.
drawable
.
group_placeholder_
red
,
R
.
drawable
.
group_placeholder_blue
,
R
.
drawable
.
group_placeholder_purple
,
R
.
drawable
.
group_placeholder_pink
,
R
.
drawable
.
group_placeholder_cyan
,
R
.
drawable
.
group_placeholder_orange
};
R
.
drawable
.
group_placeholder_yellow
};
public
static
int
getColorIndex
(
int
id
)
{
int
[]
arr
;
if
(
id
>=
0
)
{
arr
=
arrUsersAvatars
;
}
else
{
arr
=
arrGroupsAvatars
;
}
try
{
String
str
=
String
.
format
(
Locale
.
US
,
"%d%d"
,
id
,
UserConfig
.
clientUserId
);
String
str
;
if
(
id
>=
0
)
{
str
=
String
.
format
(
Locale
.
US
,
"%d%d"
,
id
,
UserConfig
.
clientUserId
);
}
else
{
str
=
String
.
format
(
Locale
.
US
,
"%d"
,
id
);
}
if
(
str
.
length
()
>
15
)
{
str
=
str
.
substring
(
0
,
15
);
}
...
...
@@ -440,11 +456,11 @@ public class Utilities {
if
(
b
<
0
)
{
b
+=
256
;
}
return
Math
.
abs
(
b
)
%
arr
Colors
.
length
;
return
Math
.
abs
(
b
)
%
arr
.
length
;
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
id
%
arr
Colors
.
length
;
return
id
%
arr
.
length
;
}
public
static
int
getColorForId
(
int
id
)
{
...
...
@@ -462,7 +478,7 @@ public class Utilities {
}
public
static
int
getGroupAvatarForId
(
int
id
)
{
return
arrGroupsAvatars
[
getColorIndex
(
id
)];
return
arrGroupsAvatars
[
getColorIndex
(
-
id
)];
}
public
static
String
MD5
(
String
md5
)
{
...
...
@@ -488,7 +504,7 @@ public class Utilities {
File
f
=
new
File
(
fromPath
);
Uri
contentUri
=
Uri
.
fromFile
(
f
);
mediaScanIntent
.
setData
(
contentUri
);
applicationContext
.
sendBroadcast
(
mediaScanIntent
);
ApplicationLoader
.
applicationContext
.
sendBroadcast
(
mediaScanIntent
);
}
public
static
void
addMediaToGallery
(
Uri
uri
)
{
...
...
@@ -497,13 +513,13 @@ public class Utilities {
}
Intent
mediaScanIntent
=
new
Intent
(
Intent
.
ACTION_MEDIA_SCANNER_SCAN_FILE
);
mediaScanIntent
.
setData
(
uri
);
applicationContext
.
sendBroadcast
(
mediaScanIntent
);
ApplicationLoader
.
applicationContext
.
sendBroadcast
(
mediaScanIntent
);
}
private
static
File
getAlbumDir
()
{
File
storageDir
=
null
;
if
(
Environment
.
MEDIA_MOUNTED
.
equals
(
Environment
.
getExternalStorageState
()))
{
storageDir
=
new
File
(
Environment
.
getExternalStoragePublicDirectory
(
Environment
.
DIRECTORY_PICTURES
),
applicationContext
.
getResources
().
getString
(
R
.
string
.
AppName
));
storageDir
=
new
File
(
Environment
.
getExternalStoragePublicDirectory
(
Environment
.
DIRECTORY_PICTURES
),
ApplicationLoader
.
applicationContext
.
getResources
().
getString
(
R
.
string
.
AppName
));
if
(
storageDir
!=
null
)
{
if
(!
storageDir
.
mkdirs
())
{
if
(!
storageDir
.
exists
()){
...
...
@@ -578,7 +594,7 @@ public class Utilities {
/*
String fileName = "VID" + id + ".mp4";
return new File(
Utilities
.applicationContext.getCacheDir(), fileName);
return new File(
ApplicationLoader
.applicationContext.getCacheDir(), fileName);
*/
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
...
...
TMessagesProj/src/main/java/org/telegram/objects/MessageObject.java
View file @
90d8e8a3
This diff is collapsed.
Click to expand it.
TMessagesProj/src/main/java/org/telegram/ui/ApplicationActivity.java
View file @
90d8e8a3
...
...
@@ -76,7 +76,6 @@ public class ApplicationActivity extends SherlockFragmentActivity implements Not
}
}
setContentView
(
R
.
layout
.
application_layout
);
notificationView
=
(
NotificationView
)
getLayoutInflater
().
inflate
(
R
.
layout
.
notification_layout
,
null
);
shadowView
=
findViewById
(
R
.
id
.
shadow
);
NotificationCenter
.
Instance
.
addObserver
(
this
,
1234
);
NotificationCenter
.
Instance
.
addObserver
(
this
,
658
);
...
...
@@ -342,6 +341,9 @@ public class ApplicationActivity extends SherlockFragmentActivity implements Not
@Override
protected
void
onResume
()
{
super
.
onResume
();
if
(
notificationView
==
null
&&
getLayoutInflater
()
!=
null
)
{
notificationView
=
(
NotificationView
)
getLayoutInflater
().
inflate
(
R
.
layout
.
notification_layout
,
null
);
}
fixLayout
();
checkForCrashes
();
checkForUpdates
();
...
...
@@ -389,7 +391,7 @@ public class ApplicationActivity extends SherlockFragmentActivity implements Not
WindowManager
manager
=
(
WindowManager
)
getSystemService
(
WINDOW_SERVICE
);
Display
display
=
manager
.
getDefaultDisplay
();
int
rotation
=
display
.
getRotation
();
float
density
=
Utilities
.
applicationContext
.
getResources
().
getDisplayMetrics
().
density
;
float
density
=
ApplicationLoader
.
applicationContext
.
getResources
().
getDisplayMetrics
().
density
;
int
height
;
int
currentActionBarHeight
=
getSupportActionBar
().
getHeight
();
...
...
@@ -575,7 +577,7 @@ public class ApplicationActivity extends SherlockFragmentActivity implements Not
ApplicationLoader
.
fragmentsStack
.
remove
(
ApplicationLoader
.
fragmentsStack
.
size
()
-
1
);
current
.
onFragmentDestroy
();
}
SharedPreferences
preferences
=
Utilities
.
applicationContext
.
getSharedPreferences
(
"Notifications"
,
Activity
.
MODE_PRIVATE
);
SharedPreferences
preferences
=
ApplicationLoader
.
applicationContext
.
getSharedPreferences
(
"Notifications"
,
Activity
.
MODE_PRIVATE
);
boolean
animations
=
preferences
.
getBoolean
(
"view_animations"
,
true
);
if
(
animations
)
{
if
(
bySwipe
)
{
...
...
@@ -614,7 +616,7 @@ public class ApplicationActivity extends SherlockFragmentActivity implements Not
BaseFragment
prev
=
ApplicationLoader
.
fragmentsStack
.
get
(
ApplicationLoader
.
fragmentsStack
.
size
()
-
2
);
FragmentManager
fm
=
getSupportFragmentManager
();
FragmentTransaction
fTrans
=
fm
.
beginTransaction
();
SharedPreferences
preferences
=
Utilities
.
applicationContext
.
getSharedPreferences
(
"Notifications"
,
Activity
.
MODE_PRIVATE
);
SharedPreferences
preferences
=
ApplicationLoader
.
applicationContext
.
getSharedPreferences
(
"Notifications"
,
Activity
.
MODE_PRIVATE
);
boolean
animations
=
preferences
.
getBoolean
(
"view_animations"
,
true
);
if
(
animations
)
{
if
(
bySwipe
)
{
...
...
TMessagesProj/src/main/java/org/telegram/ui/ApplicationLoader.java
View file @
90d8e8a3
...
...
@@ -47,6 +47,7 @@ public class ApplicationLoader extends Application {
private
static
final
int
PLAY_SERVICES_RESOLUTION_REQUEST
=
9000
;
public
static
long
lastPauseTime
;
public
static
Bitmap
cachedWallpaper
=
null
;
public
static
Context
applicationContext
;
public
static
ApplicationLoader
Instance
=
null
;
...
...
@@ -60,18 +61,19 @@ public class ApplicationLoader extends Application {
java
.
lang
.
System
.
setProperty
(
"java.net.preferIPv4Stack"
,
"true"
);
java
.
lang
.
System
.
setProperty
(
"java.net.preferIPv6Addresses"
,
"false"
);
Utilities
.
applicationContext
=
getApplicationContext
();
applicationContext
=
getApplicationContext
();
Utilities
.
getTypeface
(
"fonts/rlight.ttf"
);
UserConfig
.
loadConfig
();
SharedPreferences
preferences
=
getSharedPreferences
(
"Notifications"
,
MODE_PRIVATE
);
if
(
UserConfig
.
currentUser
!=
null
)
{
int
value
=
preferences
.
getInt
(
"version"
,
0
);
if
(
value
!=
15
)
{
UserConfig
.
contactsHash
=
""
;
UserConfig
.
lastDateValue
=
0
;
UserConfig
.
lastPtsValue
=
0
;
UserConfig
.
lastSeqValue
=
0
;
UserConfig
.
lastQtsValue
=
0
;
UserConfig
.
saveConfig
();
MessagesStorage
.
lastDateValue
=
0
;
MessagesStorage
.
lastPtsValue
=
0
;
MessagesStorage
.
lastSeqValue
=
0
;
MessagesStorage
.
lastQtsValue
=
0
;
UserConfig
.
saveConfig
(
false
);
MessagesStorage
.
Instance
.
cleanUp
();
ArrayList
<
TLRPC
.
User
>
users
=
new
ArrayList
<
TLRPC
.
User
>();
users
.
add
(
UserConfig
.
currentUser
);
...
...
@@ -80,6 +82,8 @@ public class ApplicationLoader extends Application {
SharedPreferences
.
Editor
editor
=
preferences
.
edit
();
editor
.
putInt
(
"version"
,
15
);
editor
.
commit
();
}
else
{
MessagesStorage
init
=
MessagesStorage
.
Instance
;
}
MessagesController
.
Instance
.
users
.
put
(
UserConfig
.
clientUserId
,
UserConfig
.
currentUser
);
}
else
{
...
...
@@ -102,7 +106,7 @@ public class ApplicationLoader extends Application {
if
(
checkPlayServices
())
{
gcm
=
GoogleCloudMessaging
.
getInstance
(
this
);
regid
=
getRegistrationId
(
Utilities
.
applicationContext
);
regid
=
getRegistrationId
(
applicationContext
);
if
(
regid
.
length
()
==
0
)
{
registerInBackground
();
...
...
@@ -171,11 +175,11 @@ public class ApplicationLoader extends Application {
String
msg
;
try
{
if
(
gcm
==
null
)
{
gcm
=
GoogleCloudMessaging
.
getInstance
(
Utilities
.
applicationContext
);
gcm
=
GoogleCloudMessaging
.
getInstance
(
applicationContext
);
}
regid
=
gcm
.
register
(
SENDER_ID
);
sendRegistrationIdToBackend
(
true
);
storeRegistrationId
(
Utilities
.
applicationContext
,
regid
);
storeRegistrationId
(
applicationContext
,
regid
);
return
true
;
}
catch
(
IOException
ex
)
{
ex
.
printStackTrace
();
...
...
@@ -191,7 +195,7 @@ public class ApplicationLoader extends Application {
public
void
run
()
{
UserConfig
.
pushString
=
regid
;
UserConfig
.
registeredForPush
=
!
isNew
;
UserConfig
.
saveConfig
();
UserConfig
.
saveConfig
(
false
);
MessagesController
.
Instance
.
registerForPush
(
regid
);
}
});
...
...
TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java
View file @
90d8e8a3
This diff is collapsed.
Click to expand it.
TMessagesProj/src/main/java/org/telegram/ui/ChatProfileActivity.java
View file @
90d8e8a3
...
...
@@ -225,7 +225,7 @@ public class ChatProfileActivity extends BaseFragment implements NotificationCen
((
ApplicationActivity
)
parentActivity
).
presentFragment
(
fragment
,
"user_"
+
user_id
,
false
);
}
else
{
if
(
size
+
7
==
i
)
{
if
(
info
.
participants
.
size
()
<
1
00
)
{
if
(
info
.
participants
.
size
()
<
2
00
)
{
openAddMenu
();
}
else
{
kickUser
(
null
);
...
...
@@ -375,7 +375,7 @@ public class ChatProfileActivity extends BaseFragment implements NotificationCen
int
rotation
=
display
.
getRotation
();
int
height
;
int
currentActionBarHeight
=
parentActivity
.
getSupportActionBar
().
getHeight
();
float
density
=
Utilities
.
applicationContext
.
getResources
().
getDisplayMetrics
().
density
;
float
density
=
ApplicationLoader
.
applicationContext
.
getResources
().
getDisplayMetrics
().
density
;
if
(
currentActionBarHeight
!=
48
*
density
&&
currentActionBarHeight
!=
40
*
density
)
{
height
=
currentActionBarHeight
;
}
else
{
...
...
@@ -539,7 +539,7 @@ public class ChatProfileActivity extends BaseFragment implements NotificationCen
int
count
=
6
;
if
(
info
!=
null
&&
!(
info
instanceof
TLRPC
.
TL_chatParticipantsForbidden
))
{
count
+=
info
.
participants
.
size
()
+
2
;
if
(
info
.
participants
.
size
()
<
1
00
)
{
if
(
info
.
participants
.
size
()
<
2
00
)
{
count
++;
}
}
...
...
@@ -673,7 +673,7 @@ public class ChatProfileActivity extends BaseFragment implements NotificationCen
TextView
textView
=
(
TextView
)
view
.
findViewById
(
R
.
id
.
settings_row_text
);
View
divider
=
view
.
findViewById
(
R
.
id
.
settings_row_divider
);
if
(
i
==
2
)
{
SharedPreferences
preferences
=
parentActivity
.
getSharedPreferences
(
"Notifications"
,
Activity
.
MODE_PRIVATE
);
SharedPreferences
preferences
=
mContext
.
getSharedPreferences
(
"Notifications"
,
Activity
.
MODE_PRIVATE
);
String
key
=
"notify_"
+
(-
chat_id
);
boolean
value
=
preferences
.
getBoolean
(
key
,
true
);
ImageView
checkButton
=
(
ImageView
)
view
.
findViewById
(
R
.
id
.
settings_row_check_button
);
...
...
@@ -696,7 +696,7 @@ public class ChatProfileActivity extends BaseFragment implements NotificationCen
detailTextView
.
setTypeface
(
typeface
);
View
divider
=
view
.
findViewById
(
R
.
id
.
settings_row_divider
);
if
(
i
==
3
)
{
SharedPreferences
preferences
=
parentActivity
.
getSharedPreferences
(
"Notifications"
,
Activity
.
MODE_PRIVATE
);
SharedPreferences
preferences
=
mContext
.
getSharedPreferences
(
"Notifications"
,
Activity
.
MODE_PRIVATE
);
String
name
=
preferences
.
getString
(
"sound_chat_"
+
chat_id
,
getStringEntry
(
R
.
string
.
Default
));
if
(
name
.
equals
(
"NoSound"
))
{
detailTextView
.
setText
(
getStringEntry
(
R
.
string
.
NoSound
));
...
...
@@ -836,7 +836,7 @@ public class ChatProfileActivity extends BaseFragment implements NotificationCen
return
4
;
}
else
{
if
(
size
+
7
==
i
)
{
if
(
info
!=
null
&&
info
.
participants
.
size
()
<
1
00
)
{
if
(
info
!=
null
&&
info
.
participants
.
size
()
<
2
00
)
{
return
5
;
}
else
{
return
6
;
...
...
TMessagesProj/src/main/java/org/telegram/ui/ChatProfileChangeNameActivity.java
View file @
90d8e8a3
...
...
@@ -111,7 +111,7 @@ public class ChatProfileChangeNameActivity extends BaseFragment {
int
rotation
=
display
.
getRotation
();
int
height
;
int
currentActionBarHeight
=
parentActivity
.
getSupportActionBar
().
getHeight
();
float
density
=
Utilities
.
applicationContext
.
getResources
().
getDisplayMetrics
().
density
;
float
density
=
ApplicationLoader
.
applicationContext
.
getResources
().
getDisplayMetrics
().
density
;
if
(
currentActionBarHeight
!=
48
*
density
&&
currentActionBarHeight
!=
40
*
density
)
{
height
=
currentActionBarHeight
;
}
else
{
...
...
@@ -173,7 +173,7 @@ public class ChatProfileChangeNameActivity extends BaseFragment {
}
((
ApplicationActivity
)
parentActivity
).
updateActionBar
();
fixLayout
();
SharedPreferences
preferences
=
Utilities
.
applicationContext
.
getSharedPreferences
(
"Notifications"
,
Activity
.
MODE_PRIVATE
);
SharedPreferences
preferences
=
ApplicationLoader
.
applicationContext
.
getSharedPreferences
(
"Notifications"
,
Activity
.
MODE_PRIVATE
);
boolean
animations
=
preferences
.
getBoolean
(
"view_animations"
,
true
);
if
(!
animations
)
{
firstNameField
.
requestFocus
();
...
...
TMessagesProj/src/main/java/org/telegram/ui/ContactAddActivity.java
View file @
90d8e8a3
...
...
@@ -219,7 +219,7 @@ public class ContactAddActivity extends BaseFragment implements NotificationCent
((
ApplicationActivity
)
parentActivity
).
updateActionBar
();
fixLayout
();
SharedPreferences
preferences
=
Utilities
.
applicationContext
.
getSharedPreferences
(
"Notifications"
,
Activity
.
MODE_PRIVATE
);
SharedPreferences
preferences
=
ApplicationLoader
.
applicationContext
.
getSharedPreferences
(
"Notifications"
,
Activity
.
MODE_PRIVATE
);
boolean
animations
=
preferences
.
getBoolean
(
"view_animations"
,
true
);
if
(!
animations
)
{
firstNameField
.
requestFocus
();
...
...
@@ -245,7 +245,7 @@ public class ContactAddActivity extends BaseFragment implements NotificationCent
int
rotation
=
display
.
getRotation
();
int
height
;
int
currentActionBarHeight
=
parentActivity
.
getSupportActionBar
().
getHeight
();
float
density
=
Utilities
.
applicationContext
.
getResources
().
getDisplayMetrics
().
density
;
float
density
=
ApplicationLoader
.
applicationContext
.
getResources
().
getDisplayMetrics
().
density
;
if
(
currentActionBarHeight
!=
48
*
density
&&
currentActionBarHeight
!=
40
*
density
)
{
height
=
currentActionBarHeight
;
}
else
{
...
...
TMessagesProj/src/main/java/org/telegram/ui/ContactsActivity.java
View file @
90d8e8a3
...
...
@@ -34,6 +34,8 @@ import com.actionbarsherlock.view.Menu;
import
com.actionbarsherlock.view.MenuInflater
;
import
com.actionbarsherlock.view.MenuItem
;
import
com.actionbarsherlock.widget.SearchView
;
import
org.telegram.PhoneFormat.PhoneFormat
;
import
org.telegram.TL.TLRPC
;
import
org.telegram.messenger.ConnectionsManager
;
import
org.telegram.messenger.MessagesController
;
...
...
@@ -231,7 +233,8 @@ public class ContactsActivity extends BaseFragment implements NotificationCenter
if
(
usePhone
==
null
)
{
usePhone
=
phone
;
}
TLRPC
.
TL_contact
cLocal
=
MessagesController
.
Instance
.
contactsByPhones
.
get
(
phone
);
String
cleanPhone
=
PhoneFormat
.
stripExceptNumbers
(
usePhone
);
TLRPC
.
TL_contact
cLocal
=
MessagesController
.
Instance
.
contactsByPhones
.
get
(
cleanPhone
);
if
(
cLocal
!=
null
)
{
if
(
cLocal
.
user_id
==
UserConfig
.
clientUserId
)
{
return
;
...
...
@@ -257,7 +260,7 @@ public class ContactsActivity extends BaseFragment implements NotificationCenter
@Override
public
void
onClick
(
DialogInterface
dialogInterface
,
int
i
)
{
try
{
String
number
=
"+"
+
arg1
;
String
number
=
arg1
;
Intent
intent
=
new
Intent
(
Intent
.
ACTION_VIEW
,
Uri
.
fromParts
(
"sms"
,
number
,
null
));
intent
.
putExtra
(
"sms_body"
,
getStringEntry
(
R
.
string
.
InviteText
));
startActivity
(
intent
);
...
...
@@ -347,7 +350,7 @@ public class ContactsActivity extends BaseFragment implements NotificationCenter
int
rotation
=
display
.
getRotation
();
int
height
;
int
currentActionBarHeight
=
parentActivity
.
getSupportActionBar
().
getHeight
();
float
density
=
Utilities
.
applicationContext
.
getResources
().
getDisplayMetrics
().
density
;
float
density
=
ApplicationLoader
.
applicationContext
.
getResources
().
getDisplayMetrics
().
density
;
if
(
currentActionBarHeight
!=
48
*
density
&&
currentActionBarHeight
!=
40
*
density
)
{
height
=
currentActionBarHeight
;
}
else
{
...
...
@@ -529,7 +532,7 @@ public class ContactsActivity extends BaseFragment implements NotificationCenter
if
(
s
.
length
()
!=
0
)
{
searchWas
=
true
;
if
(
listView
!=
null
)
{
float
density
=
Utilities
.
applicationContext
.
getResources
().
getDisplayMetrics
().
density
;
float
density
=
ApplicationLoader
.
applicationContext
.
getResources
().
getDisplayMetrics
().
density
;
listView
.
setPadding
((
int
)(
density
*
16
),
listView
.
getPaddingTop
(),
(
int
)(
density
*
16
),
listView
.
getPaddingBottom
());
listView
.
setAdapter
(
searchListViewAdapter
);
if
(
android
.
os
.
Build
.
VERSION
.
SDK_INT
>=
11
)
{
...
...
@@ -562,7 +565,7 @@ public class ContactsActivity extends BaseFragment implements NotificationCenter
searchWas
=
false
;
ViewGroup
group
=
(
ViewGroup
)
listView
.
getParent
();
listView
.
setAdapter
(
listViewAdapter
);
float
density
=
Utilities
.
applicationContext
.
getResources
().
getDisplayMetrics
().
density
;
float
density
=
ApplicationLoader
.
applicationContext
.
getResources
().
getDisplayMetrics
().
density
;
if
(!
isRTL
)
{
listView
.
setPadding
((
int
)(
density
*
16
),
listView
.
getPaddingTop
(),
(
int
)(
density
*
30
),
listView
.
getPaddingBottom
());
}
else
{
...
...
TMessagesProj/src/main/java/org/telegram/ui/GalleryImageViewer.java
View file @
90d8e8a3
...
...
@@ -179,7 +179,7 @@ public class GalleryImageViewer extends AbstractGalleryActivity implements Notif
localPagerAdapter
=
new
LocalPagerAdapter
(
imagesArr
,
imagesByIds
);
}
float
density
=
Utilities
.
applicationContext
.
getResources
().
getDisplayMetrics
().
density
;
float
density
=
ApplicationLoader
.
applicationContext
.
getResources
().
getDisplayMetrics
().
density
;
mViewPager
.
setPageMargin
((
int
)(
20
*
density
));
mViewPager
.
setOffscreenPageLimit
(
1
);
...
...
TMessagesProj/src/main/java/org/telegram/ui/GroupCreateActivity.java
View file @
90d8e8a3
...
...
@@ -161,7 +161,7 @@ public class GroupCreateActivity extends BaseFragment implements NotificationCen
}
else
{
doneTextView
.
setText
(
getStringEntry
(
R
.
string
.
Done
)
+
" ("
+
selectedContacts
.
size
()
+
")"
);
}
countTextView
.
setText
(
selectedContacts
.
size
()
+
"/
1
00"
);
countTextView
.
setText
(
selectedContacts
.
size
()
+
"/
2
00"
);
listView
.
invalidateViews
();
}
else
{
search
=
true
;
...
...
@@ -219,7 +219,7 @@ public class GroupCreateActivity extends BaseFragment implements NotificationCen
userSelectEditText
.
setSelection
(
text
.
length
());
ignoreChange
=
false
;
}
else
{
if
(
selectedContacts
.
size
()
==
1
00
)
{
if
(
selectedContacts
.
size
()
==
2
00
)
{
return
;
}
ignoreChange
=
true
;
...
...
@@ -232,7 +232,7 @@ public class GroupCreateActivity extends BaseFragment implements NotificationCen
}
else
{
doneTextView
.
setText
(
getStringEntry
(
R
.
string
.
Done
)
+
" ("
+
selectedContacts
.
size
()
+
")"
);
}
countTextView
.
setText
(
selectedContacts
.
size
()
+
"/
1
00"
);
countTextView
.
setText
(
selectedContacts
.
size
()
+
"/
2
00"
);
if
(
searching
||
searchWas
)
{
searching
=
false
;
searchWas
=
false
;
...
...
@@ -280,7 +280,7 @@ public class GroupCreateActivity extends BaseFragment implements NotificationCen
int
rotation
=
display
.
getRotation
();
int
height
;
int
currentActionBarHeight
=
parentActivity
.
getSupportActionBar
().
getHeight
();
float
density
=
Utilities
.
applicationContext
.
getResources
().
getDisplayMetrics
().
density
;
float
density
=
ApplicationLoader
.
applicationContext
.
getResources
().
getDisplayMetrics
().
density
;
if
(
currentActionBarHeight
!=
48
*
density
&&
currentActionBarHeight
!=
40
*
density
)
{
height
=
currentActionBarHeight
;
}
else
{
...
...
TMessagesProj/src/main/java/org/telegram/ui/GroupCreateFinalActivity.java
View file @
90d8e8a3
...
...
@@ -156,7 +156,7 @@ public class GroupCreateFinalActivity extends BaseFragment implements Notificati
int
rotation
=
display
.
getRotation
();
int
height
;
int
currentActionBarHeight
=
parentActivity
.
getSupportActionBar
().
getHeight
();
float
density
=
Utilities
.
applicationContext
.
getResources
().
getDisplayMetrics
().
density
;
float
density
=
ApplicationLoader
.
applicationContext
.
getResources
().
getDisplayMetrics
().
density
;
if
(
currentActionBarHeight
!=
48
*
density
&&
currentActionBarHeight
!=
40
*
density
)
{
height
=
currentActionBarHeight
;
}
else
{
...
...
TMessagesProj/src/main/java/org/telegram/ui/IdenticonActivity.java
View file @
90d8e8a3
...
...
@@ -133,7 +133,7 @@ public class IdenticonActivity extends BaseFragment {
int
rotation
=
display
.
getRotation
();
int
height
;
int
currentActionBarHeight
=
parentActivity
.
getSupportActionBar
().
getHeight
();
float
density
=
Utilities
.
applicationContext
.
getResources
().
getDisplayMetrics
().
density
;
float
density
=
ApplicationLoader
.
applicationContext
.
getResources
().
getDisplayMetrics
().
density
;
if
(
currentActionBarHeight
!=
48
*
density
&&
currentActionBarHeight
!=
40
*
density
)
{
height
=
currentActionBarHeight
;
}
else
{
...
...
@@ -154,7 +154,7 @@ public class IdenticonActivity extends BaseFragment {
TextView
title
=
(
TextView
)
parentActivity
.
findViewById
(
R
.
id
.
abs__action_bar_title
);
if
(
title
==
null
)
{
final
int
subtitleId
=
Utilities
.
applicationContext
.
getResources
().
getIdentifier
(
"action_bar_title"
,
"id"
,
"android"
);
final
int
subtitleId
=
ApplicationLoader
.
applicationContext
.
getResources
().
getIdentifier
(
"action_bar_title"
,
"id"
,
"android"
);
title
=
(
TextView
)
parentActivity
.
findViewById
(
subtitleId
);
}
if
(
title
!=
null
)
{
...
...
TMessagesProj/src/main/java/org/telegram/ui/IntroActivity.java
View file @
90d8e8a3
...
...
@@ -261,7 +261,7 @@ public class IntroActivity extends SherlockFragmentActivity {
WindowManager
manager
=
(
WindowManager
)
getSystemService
(
Context
.
WINDOW_SERVICE
);
Display
display
=
manager
.
getDefaultDisplay
();
int
rotation
=
display
.
getRotation
();
density
=
Utilities
.
applicationContext
.
getResources
().
getDisplayMetrics
().
density
;
density
=
ApplicationLoader
.
applicationContext
.
getResources
().
getDisplayMetrics
().
density
;
FrameLayout
.
LayoutParams
params
=
(
FrameLayout
.
LayoutParams
)
parentSlidingView
.
getLayoutParams
();
FrameLayout
.
LayoutParams
buttonParams
=
(
FrameLayout
.
LayoutParams
)
startMessagingButton
.
getLayoutParams
();
...
...
TMessagesProj/src/main/java/org/telegram/ui/LaunchActivity.java
View file @
90d8e8a3
...
...
@@ -54,10 +54,12 @@ public class LaunchActivity extends PausableActivity {
cursor
.
close
();
}
}
if
(
path
.
startsWith
(
"file:"
))
{
path
=
path
.
replace
(
"file://"
,
""
);
if
(
path
!=
null
)
{
if
(
path
.
startsWith
(
"file:"
))
{
path
=
path
.
replace
(
"file://"
,
""
);
}
NotificationCenter
.
Instance
.
addToMemCache
(
533
,
path
);
}
NotificationCenter
.
Instance
.
addToMemCache
(
533
,
path
);
}
else
if
(
intent
.
getType
().
startsWith
(
"video/"
))
{
String
path
=
intent
.
getParcelableExtra
(
Intent
.
EXTRA_STREAM
).
toString
();
if
(
path
.
startsWith
(
"content:"
))
{
...
...
@@ -68,10 +70,12 @@ public class LaunchActivity extends PausableActivity {
cursor
.
close
();
}
}
if
(
path
.
startsWith
(
"file:"
))
{
path
=
path
.
replace
(
"file://"
,
""
);
if
(
path
!=
null
)
{
if
(
path
.
startsWith
(
"file:"
))
{
path
=
path
.
replace
(
"file://"
,
""
);
}
NotificationCenter
.
Instance
.
addToMemCache
(
534
,
path
);
}
NotificationCenter
.
Instance
.
addToMemCache
(
534
,
path
);
}
else
if
(
intent
.
getType
().
equals
(
"text/plain"
))
{
String
text
=
intent
.
getStringExtra
(
Intent
.
EXTRA_TEXT
);
if
(
text
.
length
()
!=
0
)
{
...
...
TMessagesProj/src/main/java/org/telegram/ui/LocationActivity.java
View file @
90d8e8a3
...
...
@@ -227,7 +227,7 @@ public class LocationActivity extends BaseFragment implements LocationListener,
bottomView
=
fragmentView
.
findViewById
(
R
.
id
.
location_bottom_view
);
sendButton
=
(
TextView
)
fragmentView
.
findViewById
(
R
.
id
.
location_send_button
);
getFragmentManager
().
beginTransaction
().
replace
(
R
.
id
.
map_view
,
mapFragment
).
commit
();
get
Child
FragmentManager
().
beginTransaction
().
replace
(
R
.
id
.
map_view
,
mapFragment
).
commit
();
}
else
{
ViewGroup
parent
=
(
ViewGroup
)
fragmentView
.
getParent
();
if
(
parent
!=
null
)
{
...
...
@@ -305,14 +305,13 @@ public class LocationActivity extends BaseFragment implements LocationListener,
if
(
isGPSEnabled
||
isNetworkEnabled
)
{
if
(
isGPSEnabled
)
{
locationManager
.
requestLocationUpdates
(
LocationManager
.
GPS_PROVIDER
,
1000
*
3
*
1
,
0
,
this
);
locationManager
.
requestLocationUpdates
(
LocationManager
.
GPS_PROVIDER
,
1000
*
3
*
1
,
1
,
this
);
if
(
locationManager
!=
null
)
{
location
=
locationManager
.
getLastKnownLocation
(
LocationManager
.
GPS_PROVIDER
);
}
}
if
(
location
==
null
&&
isNetworkEnabled
)
{
long
MIN_DISTANCE_CHANGE_FOR_UPDATES
=
10
;
locationManager
.
requestLocationUpdates
(
LocationManager
.
NETWORK_PROVIDER
,
1000
*
3
*
1
,
0
,
this
);
locationManager
.
requestLocationUpdates
(
LocationManager
.
NETWORK_PROVIDER
,
1000
*
3
*
1
,
1
,
this
);
if
(
locationManager
!=
null
)
{
location
=
locationManager
.
getLastKnownLocation
(
LocationManager
.
NETWORK_PROVIDER
);
}
...
...
@@ -341,9 +340,9 @@ public class LocationActivity extends BaseFragment implements LocationListener,
if
(
userLocation
!=
null
&&
distanceTextView
!=
null
)
{
float
distance
=
location
.
distanceTo
(
userLocation
);
if
(
distance
<
1000
)
{
distanceTextView
.
setText
(
String
.
format
(
"%d %s"
,
(
int
)(
distance
),
Utilities
.
applicationContext
.
getString
(
R
.
string
.
MetersAway
)));
distanceTextView
.
setText
(
String
.
format
(
"%d %s"
,
(
int
)(
distance
),
ApplicationLoader
.
applicationContext
.
getString
(
R
.
string
.
MetersAway
)));
}
else
{
distanceTextView
.
setText
(
String
.
format
(
"%.2f %s"
,
distance
/
1000.0f
,
Utilities
.
applicationContext
.
getString
(
R
.
string
.
KMetersAway
)));
distanceTextView
.
setText
(
String
.
format
(
"%.2f %s"
,
distance
/
1000.0f
,
ApplicationLoader
.
applicationContext
.
getString
(
R
.
string
.
KMetersAway
)));
}
}
}
else
{
...
...
@@ -365,8 +364,13 @@ public class LocationActivity extends BaseFragment implements LocationListener,
}
@Override
public
void
onLocationChanged
(
Location
location
)
{
positionMarker
(
location
);
public
void
onLocationChanged
(
final
Location
location
)
{
Utilities
.
RunOnUIThread
(
new
Runnable
()
{
@Override
public
void
run
()
{
positionMarker
(
location
);
}
});
}
@Override
...
...
TMessagesProj/src/main/java/org/telegram/ui/LoginActivity.java
View file @
90d8e8a3
...
...
@@ -76,7 +76,7 @@ public class LoginActivity extends SherlockFragmentActivity implements NonSwipea
AlertDialog
.
Builder
builder
=
new
AlertDialog
.
Builder
(
activity
);
builder
.
setTitle
(
LoginActivity
.
this
.
getString
(
R
.
string
.
AppName
));
builder
.
setMessage
(
message
);
builder
.
setPositiveButton
(
Utilities
.
applicationContext
.
getString
(
R
.
string
.
OK
),
null
);
builder
.
setPositiveButton
(
ApplicationLoader
.
applicationContext
.
getString
(
R
.
string
.
OK
),
null
);
builder
.
show
().
setCanceledOnTouchOutside
(
true
);
}
}
...
...
@@ -160,7 +160,7 @@ public class LoginActivity extends SherlockFragmentActivity implements NonSwipea
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
login_layout
);
Utilities
.
applicationContext
=
this
.
getApplicationContext
();
ApplicationLoader
.
applicationContext
=
this
.
getApplicationContext
();
ConnectionsManager
inst
=
ConnectionsManager
.
Instance
;
Typeface
typeface
=
Utilities
.
getTypeface
(
"fonts/rlight.ttf"
);
...
...
TMessagesProj/src/main/java/org/telegram/ui/MediaActivity.java
View file @
90d8e8a3
...
...
@@ -296,7 +296,7 @@ public class MediaActivity extends BaseFragment implements NotificationCenter.No
int
rotation
=
display
.
getRotation
();
int
height
;
int
currentActionBarHeight
=
parentActivity
.
getSupportActionBar
().
getHeight
();
float
density
=
Utilities
.
applicationContext
.
getResources
().
getDisplayMetrics
().
density
;
float
density
=
ApplicationLoader
.
applicationContext
.
getResources
().
getDisplayMetrics
().
density
;
if
(
currentActionBarHeight
!=
48
*
density
&&
currentActionBarHeight
!=
40
*
density
)
{
height
=
currentActionBarHeight
;
}
else
{
...
...
TMessagesProj/src/main/java/org/telegram/ui/MessagesActivity.java
View file @
90d8e8a3
...
...
@@ -92,6 +92,7 @@ public class MessagesActivity extends BaseFragment implements NotificationCenter
NotificationCenter
.
Instance
.
addObserver
(
this
,
MessagesController
.
reloadSearchResults
);
NotificationCenter
.
Instance
.
addObserver
(
this
,
MessagesController
.
userPrintUpdateAll
);
NotificationCenter
.
Instance
.
addObserver
(
this
,
MessagesController
.
encryptedChatUpdated
);
NotificationCenter
.
Instance
.
addObserver
(
this
,
MessagesController
.
contactsDidLoaded
);
NotificationCenter
.
Instance
.
addObserver
(
this
,
1234
);
if
(
getArguments
()
!=
null
)
{
onlySelect
=
getArguments
().
getBoolean
(
"onlySelect"
,
false
);
...
...
@@ -109,6 +110,7 @@ public class MessagesActivity extends BaseFragment implements NotificationCenter
NotificationCenter
.
Instance
.
removeObserver
(
this
,
MessagesController
.
reloadSearchResults
);
NotificationCenter
.
Instance
.
removeObserver
(
this
,
MessagesController
.
userPrintUpdateAll
);
NotificationCenter
.
Instance
.
removeObserver
(
this
,
MessagesController
.
encryptedChatUpdated
);
NotificationCenter
.
Instance
.
removeObserver
(
this
,
MessagesController
.
contactsDidLoaded
);
NotificationCenter
.
Instance
.
removeObserver
(
this
,
1234
);
delegate
=
null
;
}
...
...
@@ -328,7 +330,7 @@ public class MessagesActivity extends BaseFragment implements NotificationCenter
view
=
(
ImageView
)
parentActivity
.
findViewById
(
com
.
actionbarsherlock
.
R
.
id
.
abs__home
);
}
if
(
view
!=
null
)
{
view
.
setPadding
((
int
)(
Utilities
.
applicationContext
.
getResources
().
getDisplayMetrics
().
density
*
6
),
0
,
(
int
)(
Utilities
.
applicationContext
.
getResources
().
getDisplayMetrics
().
density
*
6
),
0
);
view
.
setPadding
((
int
)(
ApplicationLoader
.
applicationContext
.
getResources
().
getDisplayMetrics
().
density
*
6
),
0
,
(
int
)(
ApplicationLoader
.
applicationContext
.
getResources
().
getDisplayMetrics
().
density
*
6
),
0
);
}
actionBar
.
setHomeButtonEnabled
(
false
);
actionBar
.
setDisplayShowTitleEnabled
(
true
);
...
...
@@ -420,6 +422,10 @@ public class MessagesActivity extends BaseFragment implements NotificationCenter
if
(
messagesListView
!=
null
)
{
updateVisibleRows
();
}
}
else
if
(
id
==
MessagesController
.
contactsDidLoaded
)
{
if
(
messagesListView
!=
null
)
{
updateVisibleRows
();
}
}
}
...
...
@@ -453,7 +459,7 @@ public class MessagesActivity extends BaseFragment implements NotificationCenter
WindowManager
manager
=
(
WindowManager
)
parentActivity
.
getSystemService
(
Context
.
WINDOW_SERVICE
);
Display
display
=
manager
.
getDefaultDisplay
();
int
rotation
=
display
.
getRotation
();
density
=
Utilities
.
applicationContext
.
getResources
().
getDisplayMetrics
().
density
;
density
=
ApplicationLoader
.
applicationContext
.
getResources
().
getDisplayMetrics
().
density
;
int
height
;
int
currentActionBarHeight
=
parentActivity
.
getSupportActionBar
().
getHeight
();
...
...
@@ -1043,8 +1049,8 @@ public class MessagesActivity extends BaseFragment implements NotificationCenter
nameTextView
.
setText
(
chat
.
title
);
nameTextView
.
setTextColor
(
0xff000000
);
}
else
if
(
user
!=
null
)
{
if
(
user
.
id
!=
333000
&&
!
MessagesController
.
Instance
.
contactsByPhones
.
containsKey
(
user
.
phone
)
)
{
if
(
MessagesController
.
Instance
.
contacts
ByPhones
.
isEmpty
()
&&
MessagesController
.
Instance
.
loadingContacts
)
{
if
(
user
.
id
!=
333000
&&
MessagesController
.
Instance
.
contactsDict
.
get
(
user
.
id
)
==
null
)
{
if
(
MessagesController
.
Instance
.
contacts
Dict
.
size
()
==
0
&&
MessagesController
.
Instance
.
loadingContacts
)
{
nameTextView
.
setTextColor
(
0xff000000
);
nameTextView
.
setText
(
Utilities
.
formatName
(
user
.
first_name
,
user
.
last_name
));
}
else
{
...
...
TMessagesProj/src/main/java/org/telegram/ui/ScreenSlidePageFragmentPhone.java
View file @
90d8e8a3
...
...
@@ -183,7 +183,7 @@ public class ScreenSlidePageFragmentPhone extends SlideFragment implements Adapt
}
});
ArrayAdapter
<
String
>
dataAdapter
=
new
ArrayAdapter
<
String
>(
Utilities
.
applicationContext
,
R
.
layout
.
login_country_textview
,
countriesArray
);
ArrayAdapter
<
String
>
dataAdapter
=
new
ArrayAdapter
<
String
>(
ApplicationLoader
.
applicationContext
,
R
.
layout
.
login_country_textview
,
countriesArray
);
dataAdapter
.
setDropDownViewResource
(
R
.
layout
.
login_country_dropdown
);
countrySpinner
.
setAdapter
(
dataAdapter
);
...
...
@@ -205,7 +205,7 @@ public class ScreenSlidePageFragmentPhone extends SlideFragment implements Adapt
String
country
=
"RU"
;
try
{
TelephonyManager
telephonyManager
=
(
TelephonyManager
)
Utilities
.
applicationContext
.
getSystemService
(
Context
.
TELEPHONY_SERVICE
);
TelephonyManager
telephonyManager
=
(
TelephonyManager
)
ApplicationLoader
.
applicationContext
.
getSystemService
(
Context
.
TELEPHONY_SERVICE
);
if
(
telephonyManager
!=
null
)
{
country
=
telephonyManager
.
getSimCountryIso
().
toUpperCase
();
}
...
...
@@ -215,7 +215,7 @@ public class ScreenSlidePageFragmentPhone extends SlideFragment implements Adapt
if
(
country
==
null
||
country
.
length
()
==
0
)
{
try
{
Locale
current
=
Utilities
.
applicationContext
.
getResources
().
getConfiguration
().
locale
;
Locale
current
=
ApplicationLoader
.
applicationContext
.
getResources
().
getConfiguration
().
locale
;
country
=
current
.
getCountry
().
toUpperCase
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
...
...
@@ -299,8 +299,8 @@ public class ScreenSlidePageFragmentPhone extends SlideFragment implements Adapt
TLRPC
.
TL_auth_sendCode
req
=
new
TLRPC
.
TL_auth_sendCode
();
String
phone
=
""
+
codeField
.
getText
()
+
phoneField
.
getText
();
phone
=
phone
.
replace
(
"+"
,
""
);
req
.
api_hash
=
"
5bce48dc7d331e62c955669eb7233217
"
;
req
.
api_id
=
2458
;
req
.
api_hash
=
"
eb06d4abfb49dc3eeb1aeb98ae0f581e
"
;
req
.
api_id
=
6
;
req
.
sms_type
=
0
;
req
.
phone_number
=
phone
;
req
.
lang_code
=
Locale
.
getDefault
().
getCountry
();
...
...
@@ -330,11 +330,11 @@ public class ScreenSlidePageFragmentPhone extends SlideFragment implements Adapt
}
else
{
if
(
error
.
text
!=
null
)
{
if
(
error
.
text
.
contains
(
"PHONE_NUMBER_INVALID"
))
{
delegate
.
needShowAlert
(
Utilities
.
applicationContext
.
getString
(
R
.
string
.
InvalidPhoneNumber
));
delegate
.
needShowAlert
(
ApplicationLoader
.
applicationContext
.
getString
(
R
.
string
.
InvalidPhoneNumber
));
}
else
if
(
error
.
text
.
contains
(
"PHONE_CODE_EMPTY"
)
||
error
.
text
.
contains
(
"PHONE_CODE_INVALID"
))
{
delegate
.
needShowAlert
(
Utilities
.
applicationContext
.
getString
(
R
.
string
.
InvalidCode
));
delegate
.
needShowAlert
(
ApplicationLoader
.
applicationContext
.
getString
(
R
.
string
.
InvalidCode
));
}
else
if
(
error
.
text
.
contains
(
"PHONE_CODE_EXPIRED"
))
{
delegate
.
needShowAlert
(
Utilities
.
applicationContext
.
getString
(
R
.
string
.
CodeExpired
));
delegate
.
needShowAlert
(
ApplicationLoader
.
applicationContext
.
getString
(
R
.
string
.
CodeExpired
));
}
else
{
delegate
.
needShowAlert
(
error
.
text
);
}
...
...
TMessagesProj/src/main/java/org/telegram/ui/ScreenSlidePageFragmentRegister.java
View file @
90d8e8a3
...
...
@@ -196,7 +196,7 @@ public class ScreenSlidePageFragmentRegister extends SlideFragment {
UserConfig
.
currentUser
=
user
;
UserConfig
.
clientActivated
=
true
;
UserConfig
.
clientUserId
=
user
.
id
;
UserConfig
.
saveConfig
();
UserConfig
.
saveConfig
(
true
);
ArrayList
<
TLRPC
.
User
>
users
=
new
ArrayList
<
TLRPC
.
User
>();
users
.
add
(
user
);
MessagesStorage
.
Instance
.
putUsersAndChats
(
users
,
null
,
true
,
true
);
...
...
@@ -208,15 +208,15 @@ public class ScreenSlidePageFragmentRegister extends SlideFragment {
});
}
else
{
if
(
error
.
text
.
contains
(
"PHONE_NUMBER_INVALID"
))
{
delegate
.
needShowAlert
(
Utilities
.
applicationContext
.
getString
(
R
.
string
.
InvalidPhoneNumber
));
delegate
.
needShowAlert
(
ApplicationLoader
.
applicationContext
.
getString
(
R
.
string
.
InvalidPhoneNumber
));
}
else
if
(
error
.
text
.
contains
(
"PHONE_CODE_EMPTY"
)
||
error
.
text
.
contains
(
"PHONE_CODE_INVALID"
))
{
delegate
.
needShowAlert
(
Utilities
.
applicationContext
.
getString
(
R
.
string
.
InvalidCode
));
delegate
.
needShowAlert
(
ApplicationLoader
.
applicationContext
.
getString
(
R
.
string
.
InvalidCode
));
}
else
if
(
error
.
text
.
contains
(
"PHONE_CODE_EXPIRED"
))
{
delegate
.
needShowAlert
(
Utilities
.
applicationContext
.
getString
(
R
.
string
.
CodeExpired
));
delegate
.
needShowAlert
(
ApplicationLoader
.
applicationContext
.
getString
(
R
.
string
.
CodeExpired
));
}
else
if
(
error
.
text
.
contains
(
"FIRSTNAME_INVALID"
))
{
delegate
.
needShowAlert
(
Utilities
.
applicationContext
.
getString
(
R
.
string
.
FirstName
));
delegate
.
needShowAlert
(
ApplicationLoader
.
applicationContext
.
getString
(
R
.
string
.
FirstName
));
}
else
if
(
error
.
text
.
contains
(
"LASTNAME_INVALID"
))
{
delegate
.
needShowAlert
(
Utilities
.
applicationContext
.
getString
(
R
.
string
.
LastName
));
delegate
.
needShowAlert
(
ApplicationLoader
.
applicationContext
.
getString
(
R
.
string
.
LastName
));
}
else
{
delegate
.
needShowAlert
(
error
.
text
);
}
...
...
TMessagesProj/src/main/java/org/telegram/ui/ScreenSlidePageFragmentSms.java
View file @
90d8e8a3
...
...
@@ -119,7 +119,7 @@ public class ScreenSlidePageFragmentSms extends SlideFragment implements Notific
registered
=
params
.
get
(
"registered"
);
String
number
=
PhoneFormat
.
Instance
.
format
(
phone
);
confirmTextView
.
setText
(
Html
.
fromHtml
(
String
.
format
(
Utilities
.
applicationContext
.
getResources
().
getString
(
R
.
string
.
SentSmsCode
)
+
" <b>%s</b>"
,
number
)));
confirmTextView
.
setText
(
Html
.
fromHtml
(
String
.
format
(
ApplicationLoader
.
applicationContext
.
getResources
().
getString
(
R
.
string
.
SentSmsCode
)
+
" <b>%s</b>"
,
number
)));
Utilities
.
showKeyboard
(
codeField
);
codeField
.
requestFocus
();
...
...
@@ -129,7 +129,7 @@ public class ScreenSlidePageFragmentSms extends SlideFragment implements Notific
timeTimer
.
cancel
();
timeTimer
=
null
;
}
timeText
.
setText
(
String
.
format
(
"%s 1:00"
,
Utilities
.
applicationContext
.
getResources
().
getString
(
R
.
string
.
CallText
)));
timeText
.
setText
(
String
.
format
(
"%s 1:00"
,
ApplicationLoader
.
applicationContext
.
getResources
().
getString
(
R
.
string
.
CallText
)));
lastCurrentTime
=
System
.
currentTimeMillis
();
timeTimer
=
new
Timer
();
timeTimer
.
schedule
(
new
TimerTask
()
{
...
...
@@ -145,9 +145,9 @@ public class ScreenSlidePageFragmentSms extends SlideFragment implements Notific
if
(
time
>=
1000
)
{
int
minutes
=
time
/
1000
/
60
;
int
seconds
=
time
/
1000
-
minutes
*
60
;
timeText
.
setText
(
String
.
format
(
"%s %d:%02d"
,
Utilities
.
applicationContext
.
getResources
().
getString
(
R
.
string
.
CallText
),
minutes
,
seconds
));
timeText
.
setText
(
String
.
format
(
"%s %d:%02d"
,
ApplicationLoader
.
applicationContext
.
getResources
().
getString
(
R
.
string
.
CallText
),
minutes
,
seconds
));
}
else
{
timeText
.
setText
(
Utilities
.
applicationContext
.
getResources
().
getString
(
R
.
string
.
Calling
));
timeText
.
setText
(
ApplicationLoader
.
applicationContext
.
getResources
().
getString
(
R
.
string
.
Calling
));
if
(
timeTimer
!=
null
)
{
timeTimer
.
cancel
();
timeTimer
=
null
;
...
...
@@ -201,7 +201,7 @@ public class ScreenSlidePageFragmentSms extends SlideFragment implements Notific
UserConfig
.
currentUser
=
res
.
user
;
UserConfig
.
clientActivated
=
true
;
UserConfig
.
clientUserId
=
res
.
user
.
id
;
UserConfig
.
saveConfig
();
UserConfig
.
saveConfig
(
true
);
ArrayList
<
TLRPC
.
User
>
users
=
new
ArrayList
<
TLRPC
.
User
>();
users
.
add
(
UserConfig
.
currentUser
);
MessagesStorage
.
Instance
.
putUsersAndChats
(
users
,
null
,
true
,
true
);
...
...
@@ -229,11 +229,11 @@ public class ScreenSlidePageFragmentSms extends SlideFragment implements Notific
});
}
else
{
if
(
error
.
text
.
contains
(
"PHONE_NUMBER_INVALID"
))
{
delegate
.
needShowAlert
(
Utilities
.
applicationContext
.
getString
(
R
.
string
.
InvalidPhoneNumber
));
delegate
.
needShowAlert
(
ApplicationLoader
.
applicationContext
.
getString
(
R
.
string
.
InvalidPhoneNumber
));
}
else
if
(
error
.
text
.
contains
(
"PHONE_CODE_EMPTY"
)
||
error
.
text
.
contains
(
"PHONE_CODE_INVALID"
))
{
delegate
.
needShowAlert
(
Utilities
.
applicationContext
.
getString
(
R
.
string
.
InvalidCode
));
delegate
.
needShowAlert
(
ApplicationLoader
.
applicationContext
.
getString
(
R
.
string
.
InvalidCode
));
}
else
if
(
error
.
text
.
contains
(
"PHONE_CODE_EXPIRED"
))
{
delegate
.
needShowAlert
(
Utilities
.
applicationContext
.
getString
(
R
.
string
.
CodeExpired
));
delegate
.
needShowAlert
(
ApplicationLoader
.
applicationContext
.
getString
(
R
.
string
.
CodeExpired
));
}
else
{
delegate
.
needShowAlert
(
error
.
text
);
}
...
...
TMessagesProj/src/main/java/org/telegram/ui/SettingsActivity.java
View file @
90d8e8a3
...
...
@@ -140,7 +140,7 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter
builder
.
setItems
(
new
CharSequence
[]{
String
.
format
(
"%d"
,
16
),
String
.
format
(
"%d"
,
17
),
String
.
format
(
"%d"
,
18
),
String
.
format
(
"%d"
,
19
),
String
.
format
(
"%d"
,
20
)},
new
DialogInterface
.
OnClickListener
()
{
@Override
public
void
onClick
(
DialogInterface
dialog
,
int
which
)
{
SharedPreferences
preferences
=
Utilities
.
applicationContext
.
getSharedPreferences
(
"Notifications"
,
Activity
.
MODE_PRIVATE
);
SharedPreferences
preferences
=
ApplicationLoader
.
applicationContext
.
getSharedPreferences
(
"Notifications"
,
Activity
.
MODE_PRIVATE
);
SharedPreferences
.
Editor
editor
=
preferences
.
edit
();
editor
.
putInt
(
"fons_size"
,
16
+
which
);
editor
.
commit
();
...
...
@@ -152,7 +152,7 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter
builder
.
setNegativeButton
(
getStringEntry
(
R
.
string
.
Cancel
),
null
);
builder
.
show
().
setCanceledOnTouchOutside
(
true
);
}
else
if
(
i
==
enableAnimationsRow
)
{
SharedPreferences
preferences
=
Utilities
.
applicationContext
.
getSharedPreferences
(
"Notifications"
,
Activity
.
MODE_PRIVATE
);
SharedPreferences
preferences
=
ApplicationLoader
.
applicationContext
.
getSharedPreferences
(
"Notifications"
,
Activity
.
MODE_PRIVATE
);
boolean
animations
=
preferences
.
getBoolean
(
"view_animations"
,
true
);
SharedPreferences
.
Editor
editor
=
preferences
.
edit
();
editor
.
putBoolean
(
"view_animations"
,
!
animations
);
...
...
@@ -270,7 +270,7 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter
int
rotation
=
display
.
getRotation
();
int
height
;
int
currentActionBarHeight
=
parentActivity
.
getSupportActionBar
().
getHeight
();
float
density
=
Utilities
.
applicationContext
.
getResources
().
getDisplayMetrics
().
density
;
float
density
=
ApplicationLoader
.
applicationContext
.
getResources
().
getDisplayMetrics
().
density
;
if
(
currentActionBarHeight
!=
48
*
density
&&
currentActionBarHeight
!=
40
*
density
)
{
height
=
currentActionBarHeight
;
}
else
{
...
...
@@ -504,7 +504,7 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter
divider
.
setVisibility
(
View
.
VISIBLE
);
ImageView
checkButton
=
(
ImageView
)
view
.
findViewById
(
R
.
id
.
settings_row_check_button
);
SharedPreferences
preferences
=
Utilities
.
applicationContext
.
getSharedPreferences
(
"Notifications"
,
Activity
.
MODE_PRIVATE
);
SharedPreferences
preferences
=
ApplicationLoader
.
applicationContext
.
getSharedPreferences
(
"Notifications"
,
Activity
.
MODE_PRIVATE
);
boolean
animations
=
preferences
.
getBoolean
(
"view_animations"
,
true
);
if
(
animations
)
{
checkButton
.
setImageResource
(
R
.
drawable
.
btn_check_on
);
...
...
@@ -559,10 +559,10 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter
detailTextView
.
setTypeface
(
typeface
);
View
divider
=
view
.
findViewById
(
R
.
id
.
settings_row_divider
);
if
(
i
==
textSizeRow
)
{
SharedPreferences
preferences
=
Utilities
.
applicationContext
.
getSharedPreferences
(
"Notifications"
,
Activity
.
MODE_PRIVATE
);
SharedPreferences
preferences
=
ApplicationLoader
.
applicationContext
.
getSharedPreferences
(
"Notifications"
,
Activity
.
MODE_PRIVATE
);
int
size
=
preferences
.
getInt
(
"fons_size"
,
16
);
detailTextView
.
setText
(
String
.
format
(
"%d"
,
size
));
textView
.
setText
(
Utilities
.
applicationContext
.
getString
(
R
.
string
.
TextSize
));
textView
.
setText
(
ApplicationLoader
.
applicationContext
.
getString
(
R
.
string
.
TextSize
));
divider
.
setVisibility
(
View
.
VISIBLE
);
}
}
...
...
TMessagesProj/src/main/java/org/telegram/ui/SettingsBlockedUsers.java
View file @
90d8e8a3
...
...
@@ -305,7 +305,7 @@ public class SettingsBlockedUsers extends BaseFragment implements NotificationCe
int
rotation
=
display
.
getRotation
();
int
height
;
int
currentActionBarHeight
=
parentActivity
.
getSupportActionBar
().
getHeight
();
float
density
=
Utilities
.
applicationContext
.
getResources
().
getDisplayMetrics
().
density
;
float
density
=
ApplicationLoader
.
applicationContext
.
getResources
().
getDisplayMetrics
().
density
;
if
(
currentActionBarHeight
!=
48
*
density
&&
currentActionBarHeight
!=
40
*
density
)
{
height
=
currentActionBarHeight
;
}
else
{
...
...
TMessagesProj/src/main/java/org/telegram/ui/SettingsChangeNameActivity.java
View file @
90d8e8a3
...
...
@@ -73,7 +73,7 @@ public class SettingsChangeNameActivity extends BaseFragment {
int
rotation
=
display
.
getRotation
();
int
height
;
int
currentActionBarHeight
=
parentActivity
.
getSupportActionBar
().
getHeight
();
float
density
=
Utilities
.
applicationContext
.
getResources
().
getDisplayMetrics
().
density
;
float
density
=
ApplicationLoader
.
applicationContext
.
getResources
().
getDisplayMetrics
().
density
;
if
(
currentActionBarHeight
!=
48
*
density
&&
currentActionBarHeight
!=
40
*
density
)
{
height
=
currentActionBarHeight
;
}
else
{
...
...
@@ -130,7 +130,7 @@ public class SettingsChangeNameActivity extends BaseFragment {
fixLayout
();
SharedPreferences
preferences
=
Utilities
.
applicationContext
.
getSharedPreferences
(
"Notifications"
,
Activity
.
MODE_PRIVATE
);
SharedPreferences
preferences
=
ApplicationLoader
.
applicationContext
.
getSharedPreferences
(
"Notifications"
,
Activity
.
MODE_PRIVATE
);
boolean
animations
=
preferences
.
getBoolean
(
"view_animations"
,
true
);
if
(!
animations
)
{
firstNameField
.
requestFocus
();
...
...
@@ -226,7 +226,7 @@ public class SettingsChangeNameActivity extends BaseFragment {
user
.
first_name
=
req
.
first_name
;
user
.
last_name
=
req
.
last_name
;
}
UserConfig
.
saveConfig
();
UserConfig
.
saveConfig
(
true
);
NotificationCenter
.
Instance
.
postNotificationName
(
MessagesController
.
updateInterfaces
,
MessagesController
.
UPDATE_MASK_ALL
);
ConnectionsManager
.
Instance
.
performRpc
(
req
,
new
RPCRequest
.
RPCRequestDelegate
()
{
@Override
...
...
TMessagesProj/src/main/java/org/telegram/ui/SettingsNotificationsActivity.java
View file @
90d8e8a3
...
...
@@ -65,7 +65,7 @@ public class SettingsNotificationsActivity extends BaseFragment {
@Override
public
void
onItemClick
(
AdapterView
<?>
adapterView
,
View
view
,
int
i
,
long
l
)
{
if
(
i
==
1
||
i
==
6
)
{
SharedPreferences
preferences
=
parentActivity
.
getSharedPreferences
(
"Notifications"
,
Activity
.
MODE_PRIVATE
);
SharedPreferences
preferences
=
ApplicationLoader
.
applicationContext
.
getSharedPreferences
(
"Notifications"
,
Activity
.
MODE_PRIVATE
);
SharedPreferences
.
Editor
editor
=
preferences
.
edit
();
boolean
enabled
=
false
;
if
(
i
==
1
)
{
...
...
@@ -96,7 +96,7 @@ public class SettingsNotificationsActivity extends BaseFragment {
}
ConnectionsManager
.
Instance
.
performRpc
(
req
,
null
,
null
,
true
,
RPCRequest
.
RPCRequestClassGeneric
);
}
else
if
(
i
==
2
||
i
==
7
)
{
SharedPreferences
preferences
=
parentActivity
.
getSharedPreferences
(
"Notifications"
,
Activity
.
MODE_PRIVATE
);
SharedPreferences
preferences
=
ApplicationLoader
.
applicationContext
.
getSharedPreferences
(
"Notifications"
,
Activity
.
MODE_PRIVATE
);
SharedPreferences
.
Editor
editor
=
preferences
.
edit
();
boolean
enabledAll
=
true
;
boolean
enabled
=
true
;
...
...
@@ -130,7 +130,7 @@ public class SettingsNotificationsActivity extends BaseFragment {
}
ConnectionsManager
.
Instance
.
performRpc
(
req
,
null
,
null
,
true
,
RPCRequest
.
RPCRequestClassGeneric
);
}
else
if
(
i
==
3
||
i
==
8
)
{
SharedPreferences
preferences
=
parentActivity
.
getSharedPreferences
(
"Notifications"
,
Activity
.
MODE_PRIVATE
);
SharedPreferences
preferences
=
ApplicationLoader
.
applicationContext
.
getSharedPreferences
(
"Notifications"
,
Activity
.
MODE_PRIVATE
);
SharedPreferences
.
Editor
editor
=
preferences
.
edit
();
boolean
enabled
;
if
(
i
==
3
)
{
...
...
@@ -143,7 +143,7 @@ public class SettingsNotificationsActivity extends BaseFragment {
editor
.
commit
();
listView
.
invalidateViews
();
}
else
if
(
i
==
4
||
i
==
9
)
{
SharedPreferences
preferences
=
parentActivity
.
getSharedPreferences
(
"Notifications"
,
Activity
.
MODE_PRIVATE
);
SharedPreferences
preferences
=
ApplicationLoader
.
applicationContext
.
getSharedPreferences
(
"Notifications"
,
Activity
.
MODE_PRIVATE
);
Intent
tmpIntent
=
new
Intent
(
RingtoneManager
.
ACTION_RINGTONE_PICKER
);
tmpIntent
.
putExtra
(
RingtoneManager
.
EXTRA_RINGTONE_TYPE
,
RingtoneManager
.
TYPE_NOTIFICATION
);
tmpIntent
.
putExtra
(
RingtoneManager
.
EXTRA_RINGTONE_SHOW_DEFAULT
,
false
);
...
...
@@ -196,7 +196,7 @@ public class SettingsNotificationsActivity extends BaseFragment {
return
;
}
reseting
=
false
;
SharedPreferences
preferences
=
inflaterActivity
.
getSharedPreferences
(
"Notifications"
,
Activity
.
MODE_PRIVATE
);
SharedPreferences
preferences
=
ApplicationLoader
.
applicationContext
.
getSharedPreferences
(
"Notifications"
,
Activity
.
MODE_PRIVATE
);
SharedPreferences
.
Editor
editor
=
preferences
.
edit
();
editor
.
clear
();
editor
.
commit
();
...
...
@@ -208,21 +208,21 @@ public class SettingsNotificationsActivity extends BaseFragment {
}
},
null
,
true
,
RPCRequest
.
RPCRequestClassGeneric
);
}
else
if
(
i
==
11
)
{
SharedPreferences
preferences
=
parentActivity
.
getSharedPreferences
(
"Notifications"
,
Activity
.
MODE_PRIVATE
);
SharedPreferences
preferences
=
ApplicationLoader
.
applicationContext
.
getSharedPreferences
(
"Notifications"
,
Activity
.
MODE_PRIVATE
);
SharedPreferences
.
Editor
editor
=
preferences
.
edit
();
boolean
enabled
=
preferences
.
getBoolean
(
"EnableInAppSounds"
,
true
);
editor
.
putBoolean
(
"EnableInAppSounds"
,
!
enabled
);
editor
.
commit
();
listView
.
invalidateViews
();
}
else
if
(
i
==
12
)
{
SharedPreferences
preferences
=
parentActivity
.
getSharedPreferences
(
"Notifications"
,
Activity
.
MODE_PRIVATE
);
SharedPreferences
preferences
=
ApplicationLoader
.
applicationContext
.
getSharedPreferences
(
"Notifications"
,
Activity
.
MODE_PRIVATE
);
SharedPreferences
.
Editor
editor
=
preferences
.
edit
();
boolean
enabled
=
preferences
.
getBoolean
(
"EnableInAppVibrate"
,
true
);
editor
.
putBoolean
(
"EnableInAppVibrate"
,
!
enabled
);
editor
.
commit
();
listView
.
invalidateViews
();
}
else
if
(
i
==
13
)
{
SharedPreferences
preferences
=
parentActivity
.
getSharedPreferences
(
"Notifications"
,
Activity
.
MODE_PRIVATE
);
SharedPreferences
preferences
=
ApplicationLoader
.
applicationContext
.
getSharedPreferences
(
"Notifications"
,
Activity
.
MODE_PRIVATE
);
SharedPreferences
.
Editor
editor
=
preferences
.
edit
();
boolean
enabled
=
preferences
.
getBoolean
(
"EnableInAppPreview"
,
true
);
editor
.
putBoolean
(
"EnableInAppPreview"
,
!
enabled
);
...
...
@@ -260,7 +260,7 @@ public class SettingsNotificationsActivity extends BaseFragment {
}
}
SharedPreferences
preferences
=
parentActivity
.
getSharedPreferences
(
"Notifications"
,
Activity
.
MODE_PRIVATE
);
SharedPreferences
preferences
=
ApplicationLoader
.
applicationContext
.
getSharedPreferences
(
"Notifications"
,
Activity
.
MODE_PRIVATE
);
SharedPreferences
.
Editor
editor
=
preferences
.
edit
();
if
(
requestCode
==
4
)
{
...
...
@@ -342,7 +342,7 @@ public class SettingsNotificationsActivity extends BaseFragment {
int
rotation
=
display
.
getRotation
();
int
height
;
int
currentActionBarHeight
=
parentActivity
.
getSupportActionBar
().
getHeight
();
float
density
=
Utilities
.
applicationContext
.
getResources
().
getDisplayMetrics
().
density
;
float
density
=
ApplicationLoader
.
applicationContext
.
getResources
().
getDisplayMetrics
().
density
;
if
(
currentActionBarHeight
!=
48
*
density
&&
currentActionBarHeight
!=
40
*
density
)
{
height
=
currentActionBarHeight
;
}
else
{
...
...
@@ -387,7 +387,7 @@ public class SettingsNotificationsActivity extends BaseFragment {
@Override
public
boolean
isEnabled
(
int
i
)
{
SharedPreferences
preferences
=
parentActivity
.
getSharedPreferences
(
"Notifications"
,
Activity
.
MODE_PRIVATE
);
SharedPreferences
preferences
=
ApplicationLoader
.
applicationContext
.
getSharedPreferences
(
"Notifications"
,
Activity
.
MODE_PRIVATE
);
boolean
enabledAll
=
preferences
.
getBoolean
(
"EnableAll"
,
true
);
return
!(
i
!=
1
&&
!
enabledAll
&&
i
!=
13
)
&&
(
i
>
0
&&
i
<
5
||
i
>
5
&&
i
<
10
||
i
>
10
&&
i
<
14
||
i
==
15
);
}
...
...
@@ -439,7 +439,7 @@ public class SettingsNotificationsActivity extends BaseFragment {
View
divider
=
view
.
findViewById
(
R
.
id
.
settings_row_divider
);
ImageView
checkButton
=
(
ImageView
)
view
.
findViewById
(
R
.
id
.
settings_row_check_button
);
SharedPreferences
preferences
=
parentActivity
.
getSharedPreferences
(
"Notifications"
,
Activity
.
MODE_PRIVATE
);
SharedPreferences
preferences
=
ApplicationLoader
.
applicationContext
.
getSharedPreferences
(
"Notifications"
,
Activity
.
MODE_PRIVATE
);
boolean
enabled
=
false
;
boolean
enabledAll
=
preferences
.
getBoolean
(
"EnableAll"
,
true
);
...
...
@@ -506,7 +506,7 @@ public class SettingsNotificationsActivity extends BaseFragment {
TextView
textView
=
(
TextView
)
view
.
findViewById
(
R
.
id
.
settings_row_text
);
TextView
textViewDetail
=
(
TextView
)
view
.
findViewById
(
R
.
id
.
settings_row_text_detail
);
View
divider
=
view
.
findViewById
(
R
.
id
.
settings_row_divider
);
SharedPreferences
preferences
=
parentActivity
.
getSharedPreferences
(
"Notifications"
,
Activity
.
MODE_PRIVATE
);
SharedPreferences
preferences
=
ApplicationLoader
.
applicationContext
.
getSharedPreferences
(
"Notifications"
,
Activity
.
MODE_PRIVATE
);
boolean
enabledAll
=
preferences
.
getBoolean
(
"EnableAll"
,
true
);
if
(
i
==
4
||
i
==
9
)
{
if
(
i
==
4
)
{
...
...
TMessagesProj/src/main/java/org/telegram/ui/SettingsWallpapersActivity.java
View file @
90d8e8a3
...
...
@@ -73,7 +73,7 @@ public class SettingsWallpapersActivity extends BaseFragment implements Notifica
NotificationCenter
.
Instance
.
addObserver
(
this
,
FileLoader
.
FileLoadProgressChanged
);
NotificationCenter
.
Instance
.
addObserver
(
this
,
MessagesStorage
.
wallpapersDidLoaded
);
SharedPreferences
preferences
=
Utilities
.
applicationContext
.
getSharedPreferences
(
"Notifications"
,
Activity
.
MODE_PRIVATE
);
SharedPreferences
preferences
=
ApplicationLoader
.
applicationContext
.
getSharedPreferences
(
"Notifications"
,
Activity
.
MODE_PRIVATE
);
selectedBackground
=
preferences
.
getInt
(
"selectedBackground"
,
1000001
);
selectedColor
=
preferences
.
getInt
(
"selectedColor"
,
0
);
MessagesStorage
.
Instance
.
getWallpapers
();
...
...
@@ -94,7 +94,7 @@ public class SettingsWallpapersActivity extends BaseFragment implements Notifica
if
(
fragmentView
==
null
)
{
fragmentView
=
inflater
.
inflate
(
R
.
layout
.
settings_wallpapers_layout
,
container
,
false
);
listAdapter
=
new
ListAdapter
(
parentActivity
);
density
=
Utilities
.
applicationContext
.
getResources
().
getDisplayMetrics
().
density
;
density
=
ApplicationLoader
.
applicationContext
.
getResources
().
getDisplayMetrics
().
density
;
progressBar
=
(
ProgressBar
)
fragmentView
.
findViewById
(
R
.
id
.
action_progress
);
backgroundImage
=
(
ImageView
)
fragmentView
.
findViewById
(
R
.
id
.
background_image
);
...
...
@@ -154,7 +154,7 @@ public class SettingsWallpapersActivity extends BaseFragment implements Notifica
TLRPC
.
PhotoSize
size
=
PhotoObject
.
getClosestPhotoSizeWithSize
(
wallPaper
.
sizes
,
(
int
)
(
320
*
density
),
(
int
)
(
480
*
density
));
String
fileName
=
size
.
location
.
volume_id
+
"_"
+
size
.
location
.
local_id
+
".jpg"
;
File
f
=
new
File
(
Utilities
.
getCacheDir
(),
fileName
);
File
toFile
=
new
File
(
Utilities
.
applicationContext
.
getFilesDir
(),
"wallpaper.jpg"
);
File
toFile
=
new
File
(
ApplicationLoader
.
applicationContext
.
getFilesDir
(),
"wallpaper.jpg"
);
try
{
done
=
Utilities
.
copyFile
(
f
,
toFile
);
}
catch
(
Exception
e
)
{
...
...
@@ -166,7 +166,7 @@ public class SettingsWallpapersActivity extends BaseFragment implements Notifica
}
if
(
done
)
{
SharedPreferences
preferences
=
Utilities
.
applicationContext
.
getSharedPreferences
(
"Notifications"
,
Activity
.
MODE_PRIVATE
);
SharedPreferences
preferences
=
ApplicationLoader
.
applicationContext
.
getSharedPreferences
(
"Notifications"
,
Activity
.
MODE_PRIVATE
);
SharedPreferences
.
Editor
editor
=
preferences
.
edit
();
editor
.
putInt
(
"selectedBackground"
,
selectedBackground
);
editor
.
putInt
(
"selectedColor"
,
selectedColor
);
...
...
@@ -195,7 +195,7 @@ public class SettingsWallpapersActivity extends BaseFragment implements Notifica
Utilities
.
addMediaToGallery
(
currentPicturePath
);
try
{
Bitmap
bitmap
=
FileLoader
.
loadBitmap
(
currentPicturePath
,
(
int
)(
320
*
density
),
(
int
)(
480
*
density
));
File
toFile
=
new
File
(
Utilities
.
applicationContext
.
getFilesDir
(),
"wallpaper.jpg"
);
File
toFile
=
new
File
(
ApplicationLoader
.
applicationContext
.
getFilesDir
(),
"wallpaper.jpg"
);
FileOutputStream
stream
=
new
FileOutputStream
(
toFile
);
bitmap
.
compress
(
Bitmap
.
CompressFormat
.
JPEG
,
87
,
stream
);
selectedBackground
=
-
1
;
...
...
@@ -218,7 +218,7 @@ public class SettingsWallpapersActivity extends BaseFragment implements Notifica
try
{
Bitmap
bitmap
=
FileLoader
.
loadBitmap
(
imageFilePath
,
(
int
)(
320
*
density
),
(
int
)(
480
*
density
));
File
toFile
=
new
File
(
Utilities
.
applicationContext
.
getFilesDir
(),
"wallpaper.jpg"
);
File
toFile
=
new
File
(
ApplicationLoader
.
applicationContext
.
getFilesDir
(),
"wallpaper.jpg"
);
FileOutputStream
stream
=
new
FileOutputStream
(
toFile
);
bitmap
.
compress
(
Bitmap
.
CompressFormat
.
JPEG
,
87
,
stream
);
selectedBackground
=
-
1
;
...
...
@@ -269,7 +269,7 @@ public class SettingsWallpapersActivity extends BaseFragment implements Notifica
backgroundImage
.
setBackgroundColor
(
0
);
selectedColor
=
0
;
}
else
if
(
selectedBackground
==
-
1
)
{
File
toFile
=
new
File
(
Utilities
.
applicationContext
.
getFilesDir
(),
"wallpaper.jpg"
);
File
toFile
=
new
File
(
ApplicationLoader
.
applicationContext
.
getFilesDir
(),
"wallpaper.jpg"
);
if
(
toFile
.
exists
())
{
backgroundImage
.
setImageURI
(
Uri
.
fromFile
(
toFile
));
}
else
{
...
...
TMessagesProj/src/main/java/org/telegram/ui/UserProfileActivity.java
View file @
90d8e8a3
...
...
@@ -399,7 +399,7 @@ public class UserProfileActivity extends BaseFragment implements NotificationCen
int
rotation
=
display
.
getRotation
();
int
height
;
int
currentActionBarHeight
=
parentActivity
.
getSupportActionBar
().
getHeight
();
float
density
=
Utilities
.
applicationContext
.
getResources
().
getDisplayMetrics
().
density
;
float
density
=
ApplicationLoader
.
applicationContext
.
getResources
().
getDisplayMetrics
().
density
;
if
(
currentActionBarHeight
!=
48
*
density
&&
currentActionBarHeight
!=
40
*
density
)
{
height
=
currentActionBarHeight
;
}
else
{
...
...
@@ -415,7 +415,7 @@ public class UserProfileActivity extends BaseFragment implements NotificationCen
if
(
dialog_id
!=
0
)
{
TextView
title
=
(
TextView
)
parentActivity
.
findViewById
(
R
.
id
.
abs__action_bar_title
);
if
(
title
==
null
)
{
final
int
subtitleId
=
Utilities
.
applicationContext
.
getResources
().
getIdentifier
(
"action_bar_title"
,
"id"
,
"android"
);
final
int
subtitleId
=
ApplicationLoader
.
applicationContext
.
getResources
().
getIdentifier
(
"action_bar_title"
,
"id"
,
"android"
);
title
=
(
TextView
)
parentActivity
.
findViewById
(
subtitleId
);
}
if
(
title
!=
null
)
{
...
...
TMessagesProj/src/main/java/org/telegram/ui/Views/AvatarUpdater.java
View file @
90d8e8a3
...
...
@@ -118,10 +118,15 @@ public class AvatarUpdater implements NotificationCenter.NotificationCenterDeleg
}
else
if
(
requestCode
==
1
)
{
Uri
imageUri
=
data
.
getData
();
Cursor
cursor
=
null
;
if
(
parentFragment
!=
null
)
{
cursor
=
parentFragment
.
getSherlockActivity
().
getContentResolver
().
query
(
imageUri
,
new
String
[]{
android
.
provider
.
MediaStore
.
Images
.
ImageColumns
.
DATA
},
null
,
null
,
null
);
}
else
if
(
parentActivity
!=
null
)
{
cursor
=
parentActivity
.
getContentResolver
().
query
(
imageUri
,
new
String
[]{
android
.
provider
.
MediaStore
.
Images
.
ImageColumns
.
DATA
},
null
,
null
,
null
);
try
{
if
(
parentFragment
!=
null
)
{
cursor
=
parentFragment
.
getSherlockActivity
().
getContentResolver
().
query
(
imageUri
,
new
String
[]{
android
.
provider
.
MediaStore
.
Images
.
ImageColumns
.
DATA
},
null
,
null
,
null
);
}
else
if
(
parentActivity
!=
null
)
{
cursor
=
parentActivity
.
getContentResolver
().
query
(
imageUri
,
new
String
[]{
android
.
provider
.
MediaStore
.
Images
.
ImageColumns
.
DATA
},
null
,
null
,
null
);
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
return
;
}
if
(
cursor
==
null
)
{
return
;
...
...
@@ -149,7 +154,7 @@ public class AvatarUpdater implements NotificationCenter.NotificationCenterDeleg
delegate
.
didUploadedPhoto
(
null
,
smallPhoto
,
bigPhoto
);
}
}
else
{
UserConfig
.
saveConfig
();
UserConfig
.
saveConfig
(
false
);
uploadingAvatar
=
Utilities
.
getCacheDir
()
+
"/"
+
bigPhoto
.
location
.
volume_id
+
"_"
+
bigPhoto
.
location
.
local_id
+
".jpg"
;
NotificationCenter
.
Instance
.
addObserver
(
AvatarUpdater
.
this
,
FileLoader
.
FileDidUpload
);
NotificationCenter
.
Instance
.
addObserver
(
AvatarUpdater
.
this
,
FileLoader
.
FileDidFailUpload
);
...
...
TMessagesProj/src/main/java/org/telegram/ui/Views/BaseFragment.java
View file @
90d8e8a3
...
...
@@ -17,8 +17,8 @@ import android.view.animation.AnimationUtils;
import
com.actionbarsherlock.app.SherlockFragment
;
import
com.actionbarsherlock.app.SherlockFragmentActivity
;
import
org.telegram.messenger.ConnectionsManager
;
import
org.telegram.messenger.Utilities
;
import
org.telegram.ui.ApplicationActivity
;
import
org.telegram.ui.ApplicationLoader
;
public
class
BaseFragment
extends
SherlockFragment
{
public
int
animationType
=
0
;
...
...
@@ -90,10 +90,11 @@ public class BaseFragment extends SherlockFragment {
public
void
onFragmentDestroy
()
{
ConnectionsManager
.
Instance
.
cancelRpcsForClassGuid
(
classGuid
);
removeParentOnDestroy
=
true
;
isFinish
=
true
;
}
public
String
getStringEntry
(
int
res
)
{
return
Utilities
.
applicationContext
.
getString
(
res
);
return
ApplicationLoader
.
applicationContext
.
getString
(
res
);
}
public
void
onAnimationStart
()
{
...
...
TMessagesProj/src/main/java/org/telegram/ui/Views/NotificationView.java
View file @
90d8e8a3
...
...
@@ -29,6 +29,7 @@ import org.telegram.messenger.NotificationCenter;
import
org.telegram.messenger.R
;
import
org.telegram.messenger.Utilities
;
import
org.telegram.objects.MessageObject
;
import
org.telegram.ui.ApplicationLoader
;
import
java.util.Locale
;
import
java.util.Timer
;
...
...
@@ -119,11 +120,11 @@ public class NotificationView extends LinearLayout {
}
});
notificationParentView
=
new
FrameLayout
(
Utilities
.
applicationContext
);
notificationParentView
=
new
FrameLayout
(
getContext
()
);
notificationParentView
.
addView
(
this
);
notificationParentView
.
setFocusable
(
false
);
setFocusable
(
false
);
WindowManager
wm
=
(
WindowManager
)
Utilities
.
applicationContext
.
getSystemService
(
Context
.
WINDOW_SERVICE
);
final
WindowManager
wm
=
(
WindowManager
)
ApplicationLoader
.
applicationContext
.
getSystemService
(
Context
.
WINDOW_SERVICE
);
notificationLayoutParams
=
new
WindowManager
.
LayoutParams
();
notificationLayoutParams
.
height
=
90
;
notificationLayoutParams
.
format
=
PixelFormat
.
TRANSLUCENT
;
...
...
@@ -131,11 +132,11 @@ public class NotificationView extends LinearLayout {
notificationLayoutParams
.
gravity
=
Gravity
.
CLIP_HORIZONTAL
|
Gravity
.
TOP
;
notificationLayoutParams
.
type
=
WindowManager
.
LayoutParams
.
TYPE_SYSTEM_ERROR
;
notificationLayoutParams
.
flags
=
WindowManager
.
LayoutParams
.
FLAG_LAYOUT_IN_SCREEN
|
WindowManager
.
LayoutParams
.
FLAG_LAYOUT_NO_LIMITS
|
WindowManager
.
LayoutParams
.
FLAG_WATCH_OUTSIDE_TOUCH
|
WindowManager
.
LayoutParams
.
FLAG_NOT_FOCUSABLE
;
notificationLayoutParams
.
y
=
-
300
;
isVisible
=
false
;
wm
.
addView
(
notificationParentView
,
notificationLayoutParams
);
notificationParentView
.
setVisibility
(
View
.
INVISIBLE
);
animHide
=
AnimationUtils
.
loadAnimation
(
Utilities
.
applicationContext
,
R
.
anim
.
slide_up
);
animHide
=
AnimationUtils
.
loadAnimation
(
ApplicationLoader
.
applicationContext
,
R
.
anim
.
slide_up
);
animHide
.
setAnimationListener
(
new
Animation
.
AnimationListener
()
{
public
void
onAnimationStart
(
Animation
animation
)
{
onScreen
=
false
;
...
...
@@ -147,14 +148,13 @@ public class NotificationView extends LinearLayout {
public
void
onAnimationEnd
(
Animation
animation
)
{
setVisibility
(
GONE
);
WindowManager
wm
=
(
WindowManager
)
Utilities
.
applicationContext
.
getSystemService
(
Context
.
WINDOW_SERVICE
);
WindowManager
wm
=
(
WindowManager
)
ApplicationLoader
.
applicationContext
.
getSystemService
(
Context
.
WINDOW_SERVICE
);
isVisible
=
false
;
notificationLayoutParams
.
y
=
-
300
;
wm
.
updateViewLayout
(
notificationParentView
,
notificationLayoutParams
);
notificationParentView
.
setVisibility
(
View
.
INVISIBLE
);
}
});
animShow
=
AnimationUtils
.
loadAnimation
(
Utilities
.
applicationContext
,
R
.
anim
.
slide_down
);
animShow
=
AnimationUtils
.
loadAnimation
(
ApplicationLoader
.
applicationContext
,
R
.
anim
.
slide_down
);
animShow
.
setAnimationListener
(
new
Animation
.
AnimationListener
()
{
public
void
onAnimationStart
(
Animation
animation
)
{
setVisibility
(
VISIBLE
);
...
...
@@ -237,10 +237,9 @@ public class NotificationView extends LinearLayout {
}
if
(!
onScreen
)
{
WindowManager
wm
=
(
WindowManager
)
Utilities
.
applicationContext
.
getSystemService
(
Context
.
WINDOW_SERVICE
);
WindowManager
wm
=
(
WindowManager
)
ApplicationLoader
.
applicationContext
.
getSystemService
(
Context
.
WINDOW_SERVICE
);
isVisible
=
true
;
notificationLayoutParams
.
y
=
0
;
wm
.
updateViewLayout
(
notificationParentView
,
notificationLayoutParams
);
notificationParentView
.
setVisibility
(
View
.
VISIBLE
);
startAnimation
(
animShow
);
}
}
...
...
@@ -261,10 +260,9 @@ public class NotificationView extends LinearLayout {
onScreen
=
false
;
setVisibility
(
GONE
);
if
(
notificationParentView
!=
null
&&
notificationParentView
.
getParent
()
!=
null
)
{
WindowManager
wm
=
(
WindowManager
)
Utilities
.
applicationContext
.
getSystemService
(
Context
.
WINDOW_SERVICE
);
WindowManager
wm
=
(
WindowManager
)
ApplicationLoader
.
applicationContext
.
getSystemService
(
Context
.
WINDOW_SERVICE
);
isVisible
=
false
;
notificationLayoutParams
.
y
=
-
300
;
wm
.
updateViewLayout
(
notificationParentView
,
notificationLayoutParams
);
notificationParentView
.
setVisibility
(
View
.
INVISIBLE
);
}
}
}
...
...
@@ -276,7 +274,7 @@ public class NotificationView extends LinearLayout {
notificationParentView
.
removeView
(
this
);
try
{
if
(
notificationParentView
.
getParent
()
!=
null
)
{
WindowManager
wm
=
(
WindowManager
)
Utilities
.
applicationContext
.
getSystemService
(
Context
.
WINDOW_SERVICE
);
WindowManager
wm
=
(
WindowManager
)
ApplicationLoader
.
applicationContext
.
getSystemService
(
Context
.
WINDOW_SERVICE
);
wm
.
removeViewImmediate
(
notificationParentView
);
}
}
catch
(
Exception
e
)
{
...
...
@@ -322,7 +320,7 @@ public class NotificationView extends LinearLayout {
if
(
notificationParentView
!=
null
)
{
notificationLayoutParams
.
height
=
height
+
(
int
)(
2
*
density
);
if
(
notificationParentView
.
getParent
()
!=
null
)
{
WindowManager
wm
=
(
WindowManager
)
Utilities
.
applicationContext
.
getSystemService
(
Context
.
WINDOW_SERVICE
);
WindowManager
wm
=
(
WindowManager
)
ApplicationLoader
.
applicationContext
.
getSystemService
(
Context
.
WINDOW_SERVICE
);
wm
.
updateViewLayout
(
notificationParentView
,
notificationLayoutParams
);
}
}
...
...
TMessagesProj/src/main/res/layout-ar/notification_layout.xml
View file @
90d8e8a3
...
...
@@ -29,7 +29,6 @@
android:gravity=
"right|center"
android:textSize=
"15dp"
android:textColor=
"#000000"
android:text=
"Nikolay Kudashov"
android:id=
"@+id/name_text_view"
android:paddingTop=
"4dp"
android:ellipsize=
"end"
...
...
@@ -41,7 +40,6 @@
android:gravity=
"right|center"
android:textColor=
"#000000"
android:textSize=
"15dp"
android:text=
"Hello"
android:id=
"@+id/message_text_view"
android:paddingTop=
"24dp"
android:ellipsize=
"end"
...
...
TMessagesProj/src/main/res/layout-ar/settings_name_layout.xml
View file @
90d8e8a3
...
...
@@ -24,6 +24,7 @@
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_marginRight=
"14dp"
android:layout_marginLeft=
"4dp"
android:layout_marginTop=
"2dp"
android:layout_weight=
"1.0"
android:gravity=
"right"
>
...
...
TMessagesProj/src/main/res/layout/chat_group_incoming_forward_layout.xml
View file @
90d8e8a3
...
...
@@ -64,7 +64,7 @@
android:textSize=
"16dp"
android:linksClickable=
"false"
android:layout_marginBottom=
"8dp"
android:autoLink=
"web"
android:autoLink=
"web
|email
"
android:descendantFocusability=
"afterDescendants"
android:layout_marginTop=
"53dp"
android:layout_gravity=
"top"
...
...
TMessagesProj/src/main/res/layout/chat_group_incoming_text_layout.xml
View file @
90d8e8a3
...
...
@@ -42,7 +42,7 @@
android:layout_height=
"wrap_content"
android:textSize=
"16dp"
android:layout_marginBottom=
"8dp"
android:autoLink=
"web"
android:autoLink=
"web
|email
"
android:linksClickable=
"false"
android:layout_marginTop=
"18dp"
android:textColor=
"#000000"
...
...
TMessagesProj/src/main/res/layout/chat_incoming_forward_layout.xml
View file @
90d8e8a3
...
...
@@ -42,7 +42,7 @@
android:layout_height=
"wrap_content"
android:textSize=
"16dp"
android:layout_marginBottom=
"8dp"
android:autoLink=
"web"
android:autoLink=
"web
|email
"
android:linksClickable=
"false"
android:layout_marginTop=
"34dp"
android:descendantFocusability=
"afterDescendants"
...
...
TMessagesProj/src/main/res/layout/chat_incoming_text_layout.xml
View file @
90d8e8a3
...
...
@@ -22,7 +22,7 @@
android:layout_height=
"wrap_content"
android:textSize=
"16dp"
android:layout_marginBottom=
"8dp"
android:autoLink=
"web"
android:autoLink=
"web
|email
"
android:linksClickable=
"false"
android:layout_gravity=
"top"
android:textColor=
"#000000"
/>
...
...
TMessagesProj/src/main/res/layout/chat_outgoing_forward_layout.xml
View file @
90d8e8a3
...
...
@@ -43,7 +43,7 @@
android:linksClickable=
"false"
android:layout_marginTop=
"34dp"
android:layout_marginBottom=
"8dp"
android:autoLink=
"web"
android:autoLink=
"web
|email
"
android:descendantFocusability=
"afterDescendants"
android:layout_gravity=
"top"
android:textColor=
"#000000"
/>
...
...
TMessagesProj/src/main/res/layout/chat_outgoing_text_layout.xml
View file @
90d8e8a3
...
...
@@ -20,7 +20,7 @@
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:textSize=
"16dp"
android:autoLink=
"web"
android:autoLink=
"web
|email
"
android:linksClickable=
"false"
android:layout_gravity=
"top"
android:textColor=
"#000000"
...
...
TMessagesProj/src/main/res/layout/notification_layout.xml
View file @
90d8e8a3
...
...
@@ -28,7 +28,6 @@
android:gravity=
"left|center"
android:textSize=
"15dp"
android:textColor=
"#000000"
android:text=
"Nikolay Kudashov"
android:id=
"@+id/name_text_view"
android:paddingTop=
"4dp"
android:ellipsize=
"end"
...
...
@@ -39,7 +38,6 @@
android:gravity=
"left|center"
android:textColor=
"#000000"
android:textSize=
"15dp"
android:text=
"Hello"
android:id=
"@+id/message_text_view"
android:paddingTop=
"24dp"
android:ellipsize=
"end"
...
...
TMessagesProj/src/main/res/layout/settings_name_layout.xml
View file @
90d8e8a3
...
...
@@ -25,6 +25,7 @@
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"14dp"
android:layout_marginTop=
"2dp"
android:layout_marginRight=
"4dp"
android:layout_weight=
"1.0"
>
<TextView
android:textSize=
"19dp"
...
...
TMessagesProj/src/main/res/values-ar/strings.xml
View file @
90d8e8a3
...
...
@@ -89,6 +89,7 @@
<string
name=
"MessageLifetime1h"
>
ساعة
</string>
<string
name=
"MessageLifetime1d"
>
يوم
</string>
<string
name=
"MessageLifetime1w"
>
أسبوع
</string>
<string
name=
"YouHaveNewMessage"
>
لديك رسالة جديدة
</string>
<!--contacts view-->
<string
name=
"SearchContactHint"
>
إبحث عن جهات الاتصال
</string>
...
...
TMessagesProj/src/main/res/values/strings.xml
View file @
90d8e8a3
...
...
@@ -89,6 +89,7 @@
<string
name=
"MessageLifetime1h"
>
1 hour
</string>
<string
name=
"MessageLifetime1d"
>
1 day
</string>
<string
name=
"MessageLifetime1w"
>
1 week
</string>
<string
name=
"YouHaveNewMessage"
>
You have a new message
</string>
<!--contacts view-->
<string
name=
"SearchContactHint"
>
Search contacts
</string>
...
...
@@ -265,4 +266,4 @@
<!--Don't change this! Not for localization!-->
<string
name=
"CacheTag"
>
CACHE_TAG
</string>
</resources>
</resources>
\ No newline at end of file
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