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
0f53d75a
Commit
0f53d75a
authored
Mar 25, 2014
by
DrKLO
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ability to set language in settings
parent
95233116
Changes
28
Hide whitespace changes
Inline
Side-by-side
Showing
28 changed files
with
941 additions
and
261 deletions
+941
-261
LocaleController.java
...rc/main/java/org/telegram/messenger/LocaleController.java
+293
-10
MessagesController.java
.../main/java/org/telegram/messenger/MessagesController.java
+1
-1
Utilities.java
...sProj/src/main/java/org/telegram/messenger/Utilities.java
+0
-128
MessageObject.java
...roj/src/main/java/org/telegram/objects/MessageObject.java
+1
-1
ContactsActivitySearchAdapter.java
...g/telegram/ui/Adapters/ContactsActivitySearchAdapter.java
+7
-7
ApplicationLoader.java
...Proj/src/main/java/org/telegram/ui/ApplicationLoader.java
+5
-14
ChatBaseCell.java
...roj/src/main/java/org/telegram/ui/Cells/ChatBaseCell.java
+1
-1
ChatOrUserCell.java
...j/src/main/java/org/telegram/ui/Cells/ChatOrUserCell.java
+7
-7
DialogCell.java
...sProj/src/main/java/org/telegram/ui/Cells/DialogCell.java
+14
-14
ChatActivity.java
...sagesProj/src/main/java/org/telegram/ui/ChatActivity.java
+4
-4
ContactAddActivity.java
...roj/src/main/java/org/telegram/ui/ContactAddActivity.java
+1
-1
ContactsActivity.java
...sProj/src/main/java/org/telegram/ui/ContactsActivity.java
+9
-9
CountrySelectActivity.java
.../src/main/java/org/telegram/ui/CountrySelectActivity.java
+18
-17
GalleryImageViewer.java
...roj/src/main/java/org/telegram/ui/GalleryImageViewer.java
+1
-1
GroupCreateActivity.java
...oj/src/main/java/org/telegram/ui/GroupCreateActivity.java
+15
-15
IntroActivity.java
...agesProj/src/main/java/org/telegram/ui/IntroActivity.java
+2
-2
LanguageSelectActivity.java
...src/main/java/org/telegram/ui/LanguageSelectActivity.java
+492
-0
MessagesActivity.java
...sProj/src/main/java/org/telegram/ui/MessagesActivity.java
+7
-7
SettingsActivity.java
...sProj/src/main/java/org/telegram/ui/SettingsActivity.java
+15
-8
UserProfileActivity.java
...oj/src/main/java/org/telegram/ui/UserProfileActivity.java
+1
-1
NotificationView.java
...src/main/java/org/telegram/ui/Views/NotificationView.java
+3
-2
country_select_layout.xml
TMessagesProj/src/main/res/layout/country_select_layout.xml
+2
-1
language_select_layout.xml
TMessagesProj/src/main/res/layout/language_select_layout.xml
+32
-0
strings.xml
TMessagesProj/src/main/res/values-ar/strings.xml
+2
-2
strings.xml
TMessagesProj/src/main/res/values-de/strings.xml
+2
-2
strings.xml
TMessagesProj/src/main/res/values-es/strings.xml
+2
-2
strings.xml
TMessagesProj/src/main/res/values-it/strings.xml
+2
-2
strings.xml
TMessagesProj/src/main/res/values-nl/strings.xml
+2
-2
No files found.
TMessagesProj/src/main/java/org/telegram/messenger/LocaleController.java
View file @
0f53d75a
...
...
@@ -8,16 +8,47 @@
package
org
.
telegram
.
messenger
;
import
android.app.Activity
;
import
android.content.SharedPreferences
;
import
android.content.res.Configuration
;
import
android.text.format.DateFormat
;
import
org.telegram.ui.ApplicationLoader
;
import
java.util.ArrayList
;
import
java.util.Calendar
;
import
java.util.Collections
;
import
java.util.Comparator
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.Locale
;
public
class
LocaleController
{
private
String
currentLanguage
;
public
static
boolean
isRTL
=
false
;
public
static
FastDateFormat
formatterDay
;
public
static
FastDateFormat
formatterWeek
;
public
static
FastDateFormat
formatterMonth
;
public
static
FastDateFormat
formatterYear
;
public
static
FastDateFormat
formatterYearMax
;
public
static
FastDateFormat
chatDate
;
public
static
FastDateFormat
chatFullDate
;
private
Locale
currentLocale
;
private
Locale
systemDefaultLocale
;
private
LocaleInfo
currentLocaleInfo
;
private
HashMap
<
String
,
String
>
localeValues
=
new
HashMap
<
String
,
String
>();
private
String
languageOverride
;
private
boolean
changingConfiguration
=
false
;
public
static
class
LocaleInfo
{
public
String
name
;
public
String
nameEnglish
;
public
String
shortName
;
}
public
ArrayList
<
LocaleInfo
>
sortedLanguages
=
new
ArrayList
<
LocaleController
.
LocaleInfo
>();
public
HashMap
<
String
,
LocaleInfo
>
languagesDict
=
new
HashMap
<
String
,
LocaleInfo
>();
private
static
volatile
LocaleController
Instance
=
null
;
public
static
LocaleController
getInstance
()
{
...
...
@@ -34,24 +65,138 @@ public class LocaleController {
}
public
LocaleController
()
{
currentLocale
=
Locale
.
getDefault
();
currentLanguage
=
currentLocale
.
getLanguage
();
LocaleController
.
LocaleInfo
localeInfo
=
new
LocaleController
.
LocaleInfo
();
localeInfo
.
name
=
"English"
;
localeInfo
.
nameEnglish
=
"English"
;
localeInfo
.
shortName
=
"en"
;
sortedLanguages
.
add
(
localeInfo
);
languagesDict
.
put
(
localeInfo
.
shortName
,
localeInfo
);
localeInfo
=
new
LocaleController
.
LocaleInfo
();
localeInfo
.
name
=
"Italiano"
;
localeInfo
.
nameEnglish
=
"Italian"
;
localeInfo
.
shortName
=
"it"
;
sortedLanguages
.
add
(
localeInfo
);
languagesDict
.
put
(
localeInfo
.
shortName
,
localeInfo
);
localeInfo
=
new
LocaleController
.
LocaleInfo
();
localeInfo
.
name
=
"Español"
;
localeInfo
.
nameEnglish
=
"Spanish"
;
localeInfo
.
shortName
=
"es"
;
sortedLanguages
.
add
(
localeInfo
);
languagesDict
.
put
(
localeInfo
.
shortName
,
localeInfo
);
localeInfo
=
new
LocaleController
.
LocaleInfo
();
localeInfo
.
name
=
"Deutsch"
;
localeInfo
.
nameEnglish
=
"German"
;
localeInfo
.
shortName
=
"de"
;
sortedLanguages
.
add
(
localeInfo
);
languagesDict
.
put
(
localeInfo
.
shortName
,
localeInfo
);
localeInfo
=
new
LocaleController
.
LocaleInfo
();
localeInfo
.
name
=
"Nederlands"
;
localeInfo
.
nameEnglish
=
"Dutch"
;
localeInfo
.
shortName
=
"nl"
;
sortedLanguages
.
add
(
localeInfo
);
languagesDict
.
put
(
localeInfo
.
shortName
,
localeInfo
);
localeInfo
=
new
LocaleController
.
LocaleInfo
();
localeInfo
.
name
=
"العربية"
;
localeInfo
.
nameEnglish
=
"Arabic"
;
localeInfo
.
shortName
=
"ar"
;
sortedLanguages
.
add
(
localeInfo
);
languagesDict
.
put
(
localeInfo
.
shortName
,
localeInfo
);
Collections
.
sort
(
sortedLanguages
,
new
Comparator
<
LocaleInfo
>()
{
@Override
public
int
compare
(
LocaleController
.
LocaleInfo
o
,
LocaleController
.
LocaleInfo
o2
)
{
return
o
.
name
.
compareTo
(
o2
.
name
);
}
});
localeInfo
=
new
LocaleController
.
LocaleInfo
();
localeInfo
.
name
=
"System default"
;
localeInfo
.
nameEnglish
=
"System default"
;
localeInfo
.
shortName
=
null
;
sortedLanguages
.
add
(
0
,
localeInfo
);
systemDefaultLocale
=
Locale
.
getDefault
();
LocaleInfo
currentInfo
=
null
;
boolean
override
=
false
;
try
{
SharedPreferences
preferences
=
ApplicationLoader
.
applicationContext
.
getSharedPreferences
(
"mainconfig"
,
Activity
.
MODE_PRIVATE
);
String
lang
=
preferences
.
getString
(
"language"
,
null
);
if
(
lang
!=
null
)
{
currentInfo
=
languagesDict
.
get
(
lang
);
if
(
currentInfo
!=
null
)
{
override
=
true
;
}
}
if
(
currentInfo
==
null
&&
systemDefaultLocale
.
getLanguage
()
!=
null
)
{
currentInfo
=
languagesDict
.
get
(
systemDefaultLocale
.
getLanguage
());
}
if
(
currentInfo
==
null
)
{
currentInfo
=
languagesDict
.
get
(
"en"
);
}
applyLanguage
(
currentInfo
,
override
);
}
catch
(
Exception
e
)
{
FileLog
.
e
(
"tmessages"
,
e
);
}
}
public
void
applyLanguage
(
String
language
)
{
if
(
language
!=
null
)
{
currentLanguage
=
language
;
currentLocale
=
new
Locale
(
currentLanguage
);
}
else
{
currentLocale
=
Locale
.
getDefault
();
currentLanguage
=
currentLocale
.
getLanguage
();
public
void
applyLanguage
(
LocaleInfo
localeInfo
,
boolean
override
)
{
if
(
localeInfo
==
null
||
localeInfo
==
currentLocaleInfo
)
{
return
;
}
try
{
Locale
newLocale
=
null
;
if
(
localeInfo
.
shortName
!=
null
)
{
newLocale
=
new
Locale
(
localeInfo
.
shortName
);
if
(
newLocale
!=
null
)
{
if
(
override
)
{
languageOverride
=
localeInfo
.
shortName
;
SharedPreferences
preferences
=
ApplicationLoader
.
applicationContext
.
getSharedPreferences
(
"mainconfig"
,
Activity
.
MODE_PRIVATE
);
SharedPreferences
.
Editor
editor
=
preferences
.
edit
();
editor
.
putString
(
"language"
,
localeInfo
.
shortName
);
editor
.
commit
();
}
}
}
else
{
newLocale
=
systemDefaultLocale
;
languageOverride
=
null
;
SharedPreferences
preferences
=
ApplicationLoader
.
applicationContext
.
getSharedPreferences
(
"mainconfig"
,
Activity
.
MODE_PRIVATE
);
SharedPreferences
.
Editor
editor
=
preferences
.
edit
();
editor
.
remove
(
"language"
);
editor
.
commit
();
}
if
(
newLocale
!=
null
)
{
currentLocale
=
newLocale
;
currentLocaleInfo
=
localeInfo
;
changingConfiguration
=
true
;
Locale
.
setDefault
(
currentLocale
);
android
.
content
.
res
.
Configuration
config
=
new
android
.
content
.
res
.
Configuration
();
config
.
locale
=
currentLocale
;
ApplicationLoader
.
applicationContext
.
getResources
().
updateConfiguration
(
config
,
ApplicationLoader
.
applicationContext
.
getResources
().
getDisplayMetrics
());
changingConfiguration
=
false
;
}
}
catch
(
Exception
e
)
{
FileLog
.
e
(
"tmessages"
,
e
);
changingConfiguration
=
false
;
}
recreateFormatters
();
}
private
void
loadCurrentLocale
()
{
localeValues
.
clear
();
}
public
static
String
getCurrentLanguageName
()
{
return
getString
(
"LanguangeName"
,
R
.
string
.
LanguangeName
);
}
public
static
String
getString
(
String
key
,
int
res
)
{
String
value
=
getInstance
().
localeValues
.
get
(
key
);
if
(
value
==
null
)
{
...
...
@@ -76,4 +221,142 @@ public class LocaleController {
return
"LOC_ERR: "
+
key
;
}
}
public
void
onDeviceConfigurationChange
(
Configuration
newConfig
)
{
if
(
changingConfiguration
)
{
return
;
}
systemDefaultLocale
=
newConfig
.
locale
;
if
(
languageOverride
!=
null
)
{
LocaleInfo
toSet
=
currentLocaleInfo
;
currentLocaleInfo
=
null
;
applyLanguage
(
toSet
,
false
);
}
else
{
Locale
newLocale
=
newConfig
.
locale
;
if
(
newLocale
!=
null
)
{
String
d1
=
newLocale
.
getDisplayName
();
String
d2
=
currentLocale
.
getDisplayName
();
if
(
d1
!=
null
&&
d2
!=
null
&&
!
d1
.
equals
(
d2
))
{
recreateFormatters
();
}
currentLocale
=
newLocale
;
}
}
}
public
static
String
formatDateChat
(
long
date
)
{
Calendar
rightNow
=
Calendar
.
getInstance
();
int
year
=
rightNow
.
get
(
Calendar
.
YEAR
);
rightNow
.
setTimeInMillis
(
date
*
1000
);
int
dateYear
=
rightNow
.
get
(
Calendar
.
YEAR
);
if
(
year
==
dateYear
)
{
return
chatDate
.
format
(
date
*
1000
);
}
return
chatFullDate
.
format
(
date
*
1000
);
}
public
static
String
formatDate
(
long
date
)
{
Calendar
rightNow
=
Calendar
.
getInstance
();
int
day
=
rightNow
.
get
(
Calendar
.
DAY_OF_YEAR
);
int
year
=
rightNow
.
get
(
Calendar
.
YEAR
);
rightNow
.
setTimeInMillis
(
date
*
1000
);
int
dateDay
=
rightNow
.
get
(
Calendar
.
DAY_OF_YEAR
);
int
dateYear
=
rightNow
.
get
(
Calendar
.
YEAR
);
if
(
dateDay
==
day
&&
year
==
dateYear
)
{
return
formatterDay
.
format
(
new
Date
(
date
*
1000
));
}
else
if
(
dateDay
+
1
==
day
&&
year
==
dateYear
)
{
return
ApplicationLoader
.
applicationContext
.
getResources
().
getString
(
R
.
string
.
Yesterday
);
}
else
if
(
year
==
dateYear
)
{
return
formatterMonth
.
format
(
new
Date
(
date
*
1000
));
}
else
{
return
formatterYear
.
format
(
new
Date
(
date
*
1000
));
}
}
public
static
String
formatDateOnline
(
long
date
)
{
Calendar
rightNow
=
Calendar
.
getInstance
();
int
day
=
rightNow
.
get
(
Calendar
.
DAY_OF_YEAR
);
int
year
=
rightNow
.
get
(
Calendar
.
YEAR
);
rightNow
.
setTimeInMillis
(
date
*
1000
);
int
dateDay
=
rightNow
.
get
(
Calendar
.
DAY_OF_YEAR
);
int
dateYear
=
rightNow
.
get
(
Calendar
.
YEAR
);
if
(
dateDay
==
day
&&
year
==
dateYear
)
{
return
String
.
format
(
"%s %s %s"
,
LocaleController
.
getString
(
"LastSeen"
,
R
.
string
.
LastSeen
),
LocaleController
.
getString
(
"TodayAt"
,
R
.
string
.
TodayAt
),
formatterDay
.
format
(
new
Date
(
date
*
1000
)));
}
else
if
(
dateDay
+
1
==
day
&&
year
==
dateYear
)
{
return
String
.
format
(
"%s %s %s"
,
LocaleController
.
getString
(
"LastSeen"
,
R
.
string
.
LastSeen
),
LocaleController
.
getString
(
"YesterdayAt"
,
R
.
string
.
YesterdayAt
),
formatterDay
.
format
(
new
Date
(
date
*
1000
)));
}
else
if
(
year
==
dateYear
)
{
return
String
.
format
(
"%s %s %s %s"
,
LocaleController
.
getString
(
"LastSeenDate"
,
R
.
string
.
LastSeenDate
),
formatterMonth
.
format
(
new
Date
(
date
*
1000
)),
LocaleController
.
getString
(
"OtherAt"
,
R
.
string
.
OtherAt
),
formatterDay
.
format
(
new
Date
(
date
*
1000
)));
}
else
{
return
String
.
format
(
"%s %s %s %s"
,
LocaleController
.
getString
(
"LastSeenDate"
,
R
.
string
.
LastSeenDate
),
formatterYear
.
format
(
new
Date
(
date
*
1000
)),
LocaleController
.
getString
(
"OtherAt"
,
R
.
string
.
OtherAt
),
formatterDay
.
format
(
new
Date
(
date
*
1000
)));
}
}
public
static
void
recreateFormatters
()
{
Locale
locale
=
Locale
.
getDefault
();
String
lang
=
locale
.
getLanguage
();
if
(
lang
==
null
)
{
lang
=
"en"
;
}
isRTL
=
lang
.
toLowerCase
().
equals
(
"ar"
);
if
(
lang
.
equals
(
"en"
))
{
formatterMonth
=
FastDateFormat
.
getInstance
(
"MMM dd"
,
locale
);
formatterYear
=
FastDateFormat
.
getInstance
(
"dd.MM.yy"
,
locale
);
formatterYearMax
=
FastDateFormat
.
getInstance
(
"dd.MM.yyyy"
,
locale
);
chatDate
=
FastDateFormat
.
getInstance
(
"MMMM d"
,
locale
);
chatFullDate
=
FastDateFormat
.
getInstance
(
"MMMM d, yyyy"
,
locale
);
}
else
if
(
lang
.
startsWith
(
"es"
))
{
formatterMonth
=
FastDateFormat
.
getInstance
(
"dd 'de' MMM"
,
locale
);
formatterYear
=
FastDateFormat
.
getInstance
(
"dd.MM.yy"
,
locale
);
formatterYearMax
=
FastDateFormat
.
getInstance
(
"dd.MM.yyyy"
,
locale
);
chatDate
=
FastDateFormat
.
getInstance
(
"d 'de' MMMM"
,
locale
);
chatFullDate
=
FastDateFormat
.
getInstance
(
"d 'de' MMMM 'de' yyyy"
,
locale
);
}
else
{
formatterMonth
=
FastDateFormat
.
getInstance
(
"dd MMM"
,
locale
);
formatterYear
=
FastDateFormat
.
getInstance
(
"dd.MM.yy"
,
locale
);
formatterYearMax
=
FastDateFormat
.
getInstance
(
"dd.MM.yyyy"
,
locale
);
chatDate
=
FastDateFormat
.
getInstance
(
"d MMMM"
,
locale
);
chatFullDate
=
FastDateFormat
.
getInstance
(
"d MMMM yyyy"
,
locale
);
}
formatterWeek
=
FastDateFormat
.
getInstance
(
"EEE"
,
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
);
}
}
public
static
String
stringForMessageListDate
(
long
date
)
{
Calendar
rightNow
=
Calendar
.
getInstance
();
int
day
=
rightNow
.
get
(
Calendar
.
DAY_OF_YEAR
);
int
year
=
rightNow
.
get
(
Calendar
.
YEAR
);
rightNow
.
setTimeInMillis
(
date
*
1000
);
int
dateDay
=
rightNow
.
get
(
Calendar
.
DAY_OF_YEAR
);
int
dateYear
=
rightNow
.
get
(
Calendar
.
YEAR
);
if
(
year
!=
dateYear
)
{
return
formatterYear
.
format
(
new
Date
(
date
*
1000
));
}
else
{
int
dayDiff
=
dateDay
-
day
;
if
(
dayDiff
==
0
||
dayDiff
==
-
1
&&
(
int
)(
System
.
currentTimeMillis
()
/
1000
)
-
date
<
60
*
60
*
8
)
{
return
formatterDay
.
format
(
new
Date
(
date
*
1000
));
}
else
if
(
dayDiff
>
-
7
&&
dayDiff
<=
-
1
)
{
return
formatterWeek
.
format
(
new
Date
(
date
*
1000
));
}
else
{
return
formatterMonth
.
format
(
new
Date
(
date
*
1000
));
}
}
}
}
TMessagesProj/src/main/java/org/telegram/messenger/MessagesController.java
View file @
0f53d75a
...
...
@@ -4344,7 +4344,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter
}
else
if
(
messageObject
.
messageOwner
.
action
instanceof
TLRPC
.
TL_messageActionUserUpdatedPhoto
)
{
msg
=
LocaleController
.
formatString
(
"NotificationContactNewPhoto"
,
R
.
string
.
NotificationContactNewPhoto
,
Utilities
.
formatName
(
u
.
first_name
,
u
.
last_name
));
}
else
if
(
messageObject
.
messageOwner
.
action
instanceof
TLRPC
.
TL_messageActionLoginUnknownLocation
)
{
String
date
=
String
.
format
(
"%s %s %s"
,
Utilities
.
formatterYear
.
format
(((
long
)
messageObject
.
messageOwner
.
date
)
*
1000
),
LocaleController
.
getString
(
"OtherAt"
,
R
.
string
.
OtherAt
),
Utilities
.
formatterDay
.
format
(((
long
)
messageObject
.
messageOwner
.
date
)
*
1000
));
String
date
=
String
.
format
(
"%s %s %s"
,
LocaleController
.
formatterYear
.
format
(((
long
)
messageObject
.
messageOwner
.
date
)
*
1000
),
LocaleController
.
getString
(
"OtherAt"
,
R
.
string
.
OtherAt
),
LocaleController
.
formatterDay
.
format
(((
long
)
messageObject
.
messageOwner
.
date
)
*
1000
));
msg
=
LocaleController
.
formatString
(
"NotificationUnrecognizedDevice"
,
R
.
string
.
NotificationUnrecognizedDevice
,
UserConfig
.
currentUser
.
first_name
,
date
,
messageObject
.
messageOwner
.
action
.
title
,
messageObject
.
messageOwner
.
action
.
address
);
}
}
else
{
...
...
TMessagesProj/src/main/java/org/telegram/messenger/Utilities.java
View file @
0f53d75a
...
...
@@ -24,7 +24,6 @@ import android.provider.DocumentsContract;
import
android.provider.MediaStore
;
import
android.text.Html
;
import
android.text.SpannableStringBuilder
;
import
android.text.format.DateFormat
;
import
android.util.Base64
;
import
android.view.Display
;
import
android.view.View
;
...
...
@@ -49,7 +48,6 @@ import java.security.PublicKey;
import
java.security.spec.RSAPublicKeySpec
;
import
java.text.SimpleDateFormat
;
import
java.util.ArrayList
;
import
java.util.Calendar
;
import
java.util.Date
;
import
java.util.Hashtable
;
import
java.util.Locale
;
...
...
@@ -64,7 +62,6 @@ public class Utilities {
public
static
int
statusBarHeight
=
0
;
public
static
float
density
=
1
;
public
static
Point
displaySize
=
new
Point
();
public
static
boolean
isRTL
=
false
;
public
static
Pattern
pattern
=
Pattern
.
compile
(
"[0-9]+"
);
private
final
static
Integer
lock
=
1
;
...
...
@@ -83,14 +80,6 @@ public class Utilities {
public
static
volatile
DispatchQueue
imageLoadQueue
=
new
DispatchQueue
(
"imageLoadQueue"
);
public
static
volatile
DispatchQueue
fileUploadQueue
=
new
DispatchQueue
(
"fileUploadQueue"
);
public
static
FastDateFormat
formatterDay
;
public
static
FastDateFormat
formatterWeek
;
public
static
FastDateFormat
formatterMonth
;
public
static
FastDateFormat
formatterYear
;
public
static
FastDateFormat
formatterYearMax
;
public
static
FastDateFormat
chatDate
;
public
static
FastDateFormat
chatFullDate
;
public
static
int
[]
arrColors
=
{
0xffee4928
,
0xff41a903
,
0xffe09602
,
0xff0f94ed
,
0xff8f3bf7
,
0xfffc4380
,
0xff00a1c4
,
0xffeb7002
};
public
static
int
[]
arrUsersAvatars
=
{
R
.
drawable
.
user_red
,
...
...
@@ -139,7 +128,6 @@ public class Utilities {
}
}
recreateFormatters
();
checkDisplaySize
();
}
...
...
@@ -537,49 +525,6 @@ public class Utilities {
});
}
public
static
void
recreateFormatters
()
{
Locale
locale
=
Locale
.
getDefault
();
String
lang
=
locale
.
getLanguage
();
if
(
lang
==
null
)
{
lang
=
"en"
;
}
isRTL
=
lang
.
toLowerCase
().
equals
(
"ar"
);
if
(
lang
.
equals
(
"en"
))
{
formatterMonth
=
FastDateFormat
.
getInstance
(
"MMM dd"
,
locale
);
formatterYear
=
FastDateFormat
.
getInstance
(
"dd.MM.yy"
,
locale
);
formatterYearMax
=
FastDateFormat
.
getInstance
(
"dd.MM.yyyy"
,
locale
);
chatDate
=
FastDateFormat
.
getInstance
(
"MMMM d"
,
locale
);
chatFullDate
=
FastDateFormat
.
getInstance
(
"MMMM d, yyyy"
,
locale
);
}
else
if
(
lang
.
startsWith
(
"es"
))
{
formatterMonth
=
FastDateFormat
.
getInstance
(
"dd 'de' MMM"
,
locale
);
formatterYear
=
FastDateFormat
.
getInstance
(
"dd.MM.yy"
,
locale
);
formatterYearMax
=
FastDateFormat
.
getInstance
(
"dd.MM.yyyy"
,
locale
);
chatDate
=
FastDateFormat
.
getInstance
(
"d 'de' MMMM"
,
locale
);
chatFullDate
=
FastDateFormat
.
getInstance
(
"d 'de' MMMM 'de' yyyy"
,
locale
);
}
else
{
formatterMonth
=
FastDateFormat
.
getInstance
(
"dd MMM"
,
locale
);
formatterYear
=
FastDateFormat
.
getInstance
(
"dd.MM.yy"
,
locale
);
formatterYearMax
=
FastDateFormat
.
getInstance
(
"dd.MM.yyyy"
,
locale
);
chatDate
=
FastDateFormat
.
getInstance
(
"d MMMM"
,
locale
);
chatFullDate
=
FastDateFormat
.
getInstance
(
"d MMMM yyyy"
,
locale
);
}
formatterWeek
=
FastDateFormat
.
getInstance
(
"EEE"
,
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
);
}
}
public
static
void
checkDisplaySize
()
{
try
{
WindowManager
manager
=
(
WindowManager
)
ApplicationLoader
.
applicationContext
.
getSystemService
(
Context
.
WINDOW_SERVICE
);
...
...
@@ -599,57 +544,6 @@ public class Utilities {
}
}
public
static
String
formatDateChat
(
long
date
)
{
Calendar
rightNow
=
Calendar
.
getInstance
();
int
year
=
rightNow
.
get
(
Calendar
.
YEAR
);
rightNow
.
setTimeInMillis
(
date
*
1000
);
int
dateYear
=
rightNow
.
get
(
Calendar
.
YEAR
);
if
(
year
==
dateYear
)
{
return
chatDate
.
format
(
date
*
1000
);
}
return
chatFullDate
.
format
(
date
*
1000
);
}
public
static
String
formatDate
(
long
date
)
{
Calendar
rightNow
=
Calendar
.
getInstance
();
int
day
=
rightNow
.
get
(
Calendar
.
DAY_OF_YEAR
);
int
year
=
rightNow
.
get
(
Calendar
.
YEAR
);
rightNow
.
setTimeInMillis
(
date
*
1000
);
int
dateDay
=
rightNow
.
get
(
Calendar
.
DAY_OF_YEAR
);
int
dateYear
=
rightNow
.
get
(
Calendar
.
YEAR
);
if
(
dateDay
==
day
&&
year
==
dateYear
)
{
return
formatterDay
.
format
(
new
Date
(
date
*
1000
));
}
else
if
(
dateDay
+
1
==
day
&&
year
==
dateYear
)
{
return
ApplicationLoader
.
applicationContext
.
getResources
().
getString
(
R
.
string
.
Yesterday
);
}
else
if
(
year
==
dateYear
)
{
return
formatterMonth
.
format
(
new
Date
(
date
*
1000
));
}
else
{
return
formatterYear
.
format
(
new
Date
(
date
*
1000
));
}
}
public
static
String
formatDateOnline
(
long
date
)
{
Calendar
rightNow
=
Calendar
.
getInstance
();
int
day
=
rightNow
.
get
(
Calendar
.
DAY_OF_YEAR
);
int
year
=
rightNow
.
get
(
Calendar
.
YEAR
);
rightNow
.
setTimeInMillis
(
date
*
1000
);
int
dateDay
=
rightNow
.
get
(
Calendar
.
DAY_OF_YEAR
);
int
dateYear
=
rightNow
.
get
(
Calendar
.
YEAR
);
if
(
dateDay
==
day
&&
year
==
dateYear
)
{
return
String
.
format
(
"%s %s %s"
,
LocaleController
.
getString
(
"LastSeen"
,
R
.
string
.
LastSeen
),
LocaleController
.
getString
(
"TodayAt"
,
R
.
string
.
TodayAt
),
formatterDay
.
format
(
new
Date
(
date
*
1000
)));
}
else
if
(
dateDay
+
1
==
day
&&
year
==
dateYear
)
{
return
String
.
format
(
"%s %s %s"
,
LocaleController
.
getString
(
"LastSeen"
,
R
.
string
.
LastSeen
),
LocaleController
.
getString
(
"YesterdayAt"
,
R
.
string
.
YesterdayAt
),
formatterDay
.
format
(
new
Date
(
date
*
1000
)));
}
else
if
(
year
==
dateYear
)
{
return
String
.
format
(
"%s %s %s %s"
,
LocaleController
.
getString
(
"LastSeenDate"
,
R
.
string
.
LastSeenDate
),
formatterMonth
.
format
(
new
Date
(
date
*
1000
)),
LocaleController
.
getString
(
"OtherAt"
,
R
.
string
.
OtherAt
),
formatterDay
.
format
(
new
Date
(
date
*
1000
)));
}
else
{
return
String
.
format
(
"%s %s %s %s"
,
LocaleController
.
getString
(
"LastSeenDate"
,
R
.
string
.
LastSeenDate
),
formatterYear
.
format
(
new
Date
(
date
*
1000
)),
LocaleController
.
getString
(
"OtherAt"
,
R
.
string
.
OtherAt
),
formatterDay
.
format
(
new
Date
(
date
*
1000
)));
}
}
public
static
void
HideProgressDialog
(
Activity
activity
)
{
activity
.
runOnUiThread
(
new
Runnable
()
{
@Override
...
...
@@ -956,28 +850,6 @@ public class Utilities {
}
}
public
static
String
stringForMessageListDate
(
long
date
)
{
Calendar
rightNow
=
Calendar
.
getInstance
();
int
day
=
rightNow
.
get
(
Calendar
.
DAY_OF_YEAR
);
int
year
=
rightNow
.
get
(
Calendar
.
YEAR
);
rightNow
.
setTimeInMillis
(
date
*
1000
);
int
dateDay
=
rightNow
.
get
(
Calendar
.
DAY_OF_YEAR
);
int
dateYear
=
rightNow
.
get
(
Calendar
.
YEAR
);
if
(
year
!=
dateYear
)
{
return
formatterYear
.
format
(
new
Date
(
date
*
1000
));
}
else
{
int
dayDiff
=
dateDay
-
day
;
if
(
dayDiff
==
0
||
dayDiff
==
-
1
&&
(
int
)(
System
.
currentTimeMillis
()
/
1000
)
-
date
<
60
*
60
*
8
)
{
return
formatterDay
.
format
(
new
Date
(
date
*
1000
));
}
else
if
(
dayDiff
>
-
7
&&
dayDiff
<=
-
1
)
{
return
formatterWeek
.
format
(
new
Date
(
date
*
1000
));
}
else
{
return
formatterMonth
.
format
(
new
Date
(
date
*
1000
));
}
}
}
public
static
byte
[]
decodeQuotedPrintable
(
final
byte
[]
bytes
)
{
if
(
bytes
==
null
)
{
return
null
;
...
...
TMessagesProj/src/main/java/org/telegram/objects/MessageObject.java
View file @
0f53d75a
...
...
@@ -202,7 +202,7 @@ public class MessageObject {
}
}
}
else
if
(
message
.
action
instanceof
TLRPC
.
TL_messageActionLoginUnknownLocation
)
{
String
date
=
String
.
format
(
"%s %s %s"
,
Utilities
.
formatterYear
.
format
(((
long
)
message
.
date
)
*
1000
),
LocaleController
.
getString
(
"OtherAt"
,
R
.
string
.
OtherAt
),
Utilities
.
formatterDay
.
format
(((
long
)
message
.
date
)
*
1000
));
String
date
=
String
.
format
(
"%s %s %s"
,
LocaleController
.
formatterYear
.
format
(((
long
)
message
.
date
)
*
1000
),
LocaleController
.
getString
(
"OtherAt"
,
R
.
string
.
OtherAt
),
LocaleController
.
formatterDay
.
format
(((
long
)
message
.
date
)
*
1000
));
messageText
=
LocaleController
.
formatString
(
"NotificationUnrecognizedDevice"
,
R
.
string
.
NotificationUnrecognizedDevice
,
UserConfig
.
currentUser
.
first_name
,
date
,
message
.
action
.
title
,
message
.
action
.
address
);
}
else
if
(
message
.
action
instanceof
TLRPC
.
TL_messageActionUserJoined
)
{
if
(
fromUser
!=
null
)
{
...
...
TMessagesProj/src/main/java/org/telegram/ui/Adapters/ContactsActivitySearchAdapter.java
View file @
0f53d75a
...
...
@@ -30,7 +30,7 @@ public class ContactsActivitySearchAdapter extends BaseFragmentAdapter {
private
HashMap
<
Integer
,
TLRPC
.
User
>
ignoreUsers
;
private
ArrayList
<
TLRPC
.
User
>
searchResult
;
private
ArrayList
<
CharSequence
>
searchResultNames
;
private
Timer
search
Dialogs
Timer
;
private
Timer
searchTimer
;
public
ContactsActivitySearchAdapter
(
Context
context
,
HashMap
<
Integer
,
TLRPC
.
User
>
arg1
)
{
mContext
=
context
;
...
...
@@ -44,19 +44,19 @@ public class ContactsActivitySearchAdapter extends BaseFragmentAdapter {
notifyDataSetChanged
();
}
else
{
try
{
if
(
search
Dialogs
Timer
!=
null
)
{
search
Dialogs
Timer
.
cancel
();
if
(
searchTimer
!=
null
)
{
searchTimer
.
cancel
();
}
}
catch
(
Exception
e
)
{
FileLog
.
e
(
"tmessages"
,
e
);
}
search
Dialogs
Timer
=
new
Timer
();
search
Dialogs
Timer
.
schedule
(
new
TimerTask
()
{
searchTimer
=
new
Timer
();
searchTimer
.
schedule
(
new
TimerTask
()
{
@Override
public
void
run
()
{
try
{
search
Dialogs
Timer
.
cancel
();
search
Dialogs
Timer
=
null
;
searchTimer
.
cancel
();
searchTimer
=
null
;
}
catch
(
Exception
e
)
{
FileLog
.
e
(
"tmessages"
,
e
);
}
...
...
TMessagesProj/src/main/java/org/telegram/ui/ApplicationLoader.java
View file @
0f53d75a
...
...
@@ -30,6 +30,7 @@ import com.google.android.gms.gcm.GoogleCloudMessaging;
import
org.telegram.messenger.BuildVars
;
import
org.telegram.messenger.ConnectionsManager
;
import
org.telegram.messenger.FileLog
;
import
org.telegram.messenger.LocaleController
;
import
org.telegram.messenger.MessagesController
;
import
org.telegram.messenger.NativeLoader
;
import
org.telegram.messenger.ScreenReceiver
;
...
...
@@ -39,7 +40,6 @@ import org.telegram.ui.Views.BaseFragment;
import
java.lang.reflect.Field
;
import
java.util.ArrayList
;
import
java.util.Locale
;
import
java.util.concurrent.atomic.AtomicInteger
;
public
class
ApplicationLoader
extends
Application
{
...
...
@@ -52,7 +52,6 @@ public class ApplicationLoader extends Application {
private
static
final
int
PLAY_SERVICES_RESOLUTION_REQUEST
=
9000
;
public
static
long
lastPauseTime
;
public
static
Bitmap
cachedWallpaper
=
null
;
private
Locale
currentLocale
;
public
static
volatile
Context
applicationContext
=
null
;
public
static
volatile
Handler
applicationHandler
=
null
;
...
...
@@ -120,8 +119,10 @@ public class ApplicationLoader extends Application {
super
.
onCreate
();
lastPauseTime
=
System
.
currentTimeMillis
();
applicationContext
=
getApplicationContext
();
NativeLoader
.
initNativeLibs
(
this
);
LocaleController
.
getInstance
();
applicationHandler
=
new
Handler
(
applicationContext
.
getMainLooper
());
currentLocale
=
Locale
.
getDefault
();
java
.
lang
.
System
.
setProperty
(
"java.net.preferIPv4Stack"
,
"true"
);
java
.
lang
.
System
.
setProperty
(
"java.net.preferIPv6Addresses"
,
"false"
);
...
...
@@ -136,22 +137,12 @@ public class ApplicationLoader extends Application {
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
FileLog
.
e
(
"tmessages"
,
"start application with time "
+
lastPauseTime
);
}
@Override
public
void
onConfigurationChanged
(
Configuration
newConfig
)
{
super
.
onConfigurationChanged
(
newConfig
);
Locale
newLocale
=
newConfig
.
locale
;
if
(
newLocale
!=
null
)
{
String
d1
=
newLocale
.
getDisplayName
();
String
d2
=
currentLocale
.
getDisplayName
();
if
(
d1
!=
null
&&
d2
!=
null
&&
!
d1
.
equals
(
d2
))
{
Utilities
.
recreateFormatters
();
}
currentLocale
=
newLocale
;
}
LocaleController
.
getInstance
().
onDeviceConfigurationChange
(
newConfig
);
Utilities
.
checkDisplaySize
();
}
...
...
TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatBaseCell.java
View file @
0f53d75a
...
...
@@ -206,7 +206,7 @@ public class ChatBaseCell extends BaseCell {
currentTimePaint
=
timePaintIn
;
}
currentTimeString
=
Utilities
.
formatterDay
.
format
((
long
)
(
currentMessageObject
.
messageOwner
.
date
)
*
1000
);
currentTimeString
=
LocaleController
.
formatterDay
.
format
((
long
)
(
currentMessageObject
.
messageOwner
.
date
)
*
1000
);
timeWidth
=
(
int
)
Math
.
ceil
(
currentTimePaint
.
measureText
(
currentTimeString
));
namesOffset
=
0
;
...
...
TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatOrUserCell.java
View file @
0f53d75a
...
...
@@ -273,7 +273,7 @@ public class ChatOrUserCell extends BaseCell {
if
(
encryptedChat
!=
null
)
{
drawNameLock
=
true
;
if
(!
Utilities
.
isRTL
)
{
if
(!
LocaleController
.
isRTL
)
{
nameLockLeft
=
Utilities
.
dp
(
61
+
(
usePadding
?
11
:
0
));
nameLeft
=
Utilities
.
dp
(
65
+
(
usePadding
?
11
:
0
))
+
lockDrawable
.
getIntrinsicWidth
();
}
else
{
...
...
@@ -282,7 +282,7 @@ public class ChatOrUserCell extends BaseCell {
}
}
else
{
drawNameLock
=
false
;
if
(!
Utilities
.
isRTL
)
{
if
(!
LocaleController
.
isRTL
)
{
nameLeft
=
Utilities
.
dp
(
61
+
(
usePadding
?
11
:
0
));
}
else
{
nameLeft
=
usePadding
?
Utilities
.
dp
(
11
)
:
0
;
...
...
@@ -324,7 +324,7 @@ public class ChatOrUserCell extends BaseCell {
currentNamePaint
=
namePaint
;
}
if
(!
Utilities
.
isRTL
)
{
if
(!
LocaleController
.
isRTL
)
{
onlineWidth
=
nameWidth
=
width
-
nameLeft
-
Utilities
.
dp
(
3
+
(
usePadding
?
11
:
0
));
}
else
{
onlineWidth
=
nameWidth
=
width
-
nameLeft
-
Utilities
.
dp
(
61
+
(
usePadding
?
11
:
0
));
...
...
@@ -337,7 +337,7 @@ public class ChatOrUserCell extends BaseCell {
nameLayout
=
new
StaticLayout
(
nameStringFinal
,
currentNamePaint
,
nameWidth
,
Layout
.
Alignment
.
ALIGN_NORMAL
,
1.0f
,
0.0f
,
false
);
if
(
chat
==
null
)
{
if
(!
Utilities
.
isRTL
)
{
if
(!
LocaleController
.
isRTL
)
{
onlineLeft
=
Utilities
.
dp
(
61
+
(
usePadding
?
11
:
0
));
}
else
{
onlineLeft
=
usePadding
?
Utilities
.
dp
(
11
)
:
0
;
...
...
@@ -361,7 +361,7 @@ public class ChatOrUserCell extends BaseCell {
if
(
user
.
status
.
expires
<=
10000
)
{
onlineString
=
getResources
().
getString
(
R
.
string
.
Invisible
);
}
else
{
onlineString
=
Utilities
.
formatDateOnline
(
user
.
status
.
expires
);
onlineString
=
LocaleController
.
formatDateOnline
(
user
.
status
.
expires
);
}
}
}
...
...
@@ -376,7 +376,7 @@ public class ChatOrUserCell extends BaseCell {
nameTop
=
Utilities
.
dp
(
22
);
}
if
(!
Utilities
.
isRTL
)
{
if
(!
LocaleController
.
isRTL
)
{
avatarLeft
=
usePadding
?
Utilities
.
dp
(
11
)
:
0
;
}
else
{
avatarLeft
=
width
-
Utilities
.
dp
(
50
+
(
usePadding
?
11
:
0
));
...
...
@@ -388,7 +388,7 @@ public class ChatOrUserCell extends BaseCell {
double
widthpx
=
0
;
float
left
=
0
;
if
(
Utilities
.
isRTL
)
{
if
(
LocaleController
.
isRTL
)
{
if
(
nameLayout
.
getLineCount
()
>
0
)
{
left
=
nameLayout
.
getLineLeft
(
0
);
if
(
left
==
0
)
{
...
...
TMessagesProj/src/main/java/org/telegram/ui/Cells/DialogCell.java
View file @
0f53d75a
...
...
@@ -359,7 +359,7 @@ public class DialogCell extends BaseCell {
if
(
encryptedChat
!=
null
)
{
drawNameLock
=
true
;
if
(!
Utilities
.
isRTL
)
{
if
(!
LocaleController
.
isRTL
)
{
nameLockLeft
=
Utilities
.
dp
(
77
);
nameLeft
=
Utilities
.
dp
(
81
)
+
lockDrawable
.
getIntrinsicWidth
();
}
else
{
...
...
@@ -368,7 +368,7 @@ public class DialogCell extends BaseCell {
}
}
else
{
drawNameLock
=
false
;
if
(!
Utilities
.
isRTL
)
{
if
(!
LocaleController
.
isRTL
)
{
nameLeft
=
Utilities
.
dp
(
77
);
}
else
{
nameLeft
=
Utilities
.
dp
(
14
);
...
...
@@ -407,7 +407,7 @@ public class DialogCell extends BaseCell {
}
}
if
(
currentDialog
.
last_message_date
!=
0
)
{
timeString
=
Utilities
.
stringForMessageListDate
(
currentDialog
.
last_message_date
);
timeString
=
LocaleController
.
stringForMessageListDate
(
currentDialog
.
last_message_date
);
}
drawCheck1
=
false
;
drawCheck2
=
false
;
...
...
@@ -418,9 +418,9 @@ public class DialogCell extends BaseCell {
TLRPC
.
User
fromUser
=
MessagesController
.
getInstance
().
users
.
get
(
message
.
messageOwner
.
from_id
);
if
(
currentDialog
.
last_message_date
!=
0
)
{
timeString
=
Utilities
.
stringForMessageListDate
(
currentDialog
.
last_message_date
);
timeString
=
LocaleController
.
stringForMessageListDate
(
currentDialog
.
last_message_date
);
}
else
{
timeString
=
Utilities
.
stringForMessageListDate
(
message
.
messageOwner
.
date
);
timeString
=
LocaleController
.
stringForMessageListDate
(
message
.
messageOwner
.
date
);
}
if
(
printingString
!=
null
)
{
lastPrintString
=
messageString
=
printingString
;
...
...
@@ -508,7 +508,7 @@ public class DialogCell extends BaseCell {
timeWidth
=
(
int
)
Math
.
ceil
(
timePaint
.
measureText
(
timeString
));
timeLayout
=
new
StaticLayout
(
timeString
,
timePaint
,
timeWidth
,
Layout
.
Alignment
.
ALIGN_NORMAL
,
1.0f
,
0.0f
,
false
);
if
(!
Utilities
.
isRTL
)
{
if
(!
LocaleController
.
isRTL
)
{
timeLeft
=
width
-
Utilities
.
dp
(
11
)
-
timeWidth
;
}
else
{
timeLeft
=
Utilities
.
dp
(
11
);
...
...
@@ -539,7 +539,7 @@ public class DialogCell extends BaseCell {
nameString
=
LocaleController
.
getString
(
"HiddenName"
,
R
.
string
.
HiddenName
);
}
if
(!
Utilities
.
isRTL
)
{
if
(!
LocaleController
.
isRTL
)
{
nameWidth
=
width
-
nameLeft
-
Utilities
.
dp
(
14
)
-
timeWidth
;
}
else
{
nameWidth
=
width
-
nameLeft
-
Utilities
.
dp
(
77
)
-
timeWidth
;
...
...
@@ -551,7 +551,7 @@ public class DialogCell extends BaseCell {
if
(
drawClock
)
{
int
w
=
clockDrawable
.
getIntrinsicWidth
()
+
Utilities
.
dp
(
2
);
nameWidth
-=
w
;
if
(!
Utilities
.
isRTL
)
{
if
(!
LocaleController
.
isRTL
)
{
checkDrawLeft
=
timeLeft
-
w
;
}
else
{
checkDrawLeft
=
timeLeft
+
timeWidth
+
Utilities
.
dp
(
2
);
...
...
@@ -562,7 +562,7 @@ public class DialogCell extends BaseCell {
nameWidth
-=
w
;
if
(
drawCheck1
)
{
nameWidth
-=
halfCheckDrawable
.
getIntrinsicWidth
()
-
Utilities
.
dp
(
5
);
if
(!
Utilities
.
isRTL
)
{
if
(!
LocaleController
.
isRTL
)
{
halfCheckDrawLeft
=
timeLeft
-
w
;
checkDrawLeft
=
halfCheckDrawLeft
-
Utilities
.
dp
(
5
);
}
else
{
...
...
@@ -571,7 +571,7 @@ public class DialogCell extends BaseCell {
nameLeft
+=
w
+
halfCheckDrawable
.
getIntrinsicWidth
()
-
Utilities
.
dp
(
5
);
}
}
else
{
if
(!
Utilities
.
isRTL
)
{
if
(!
LocaleController
.
isRTL
)
{
checkDrawLeft
=
timeLeft
-
w
;
}
else
{
checkDrawLeft
=
timeLeft
+
timeWidth
+
Utilities
.
dp
(
2
);
...
...
@@ -584,7 +584,7 @@ public class DialogCell extends BaseCell {
nameLayout
=
new
StaticLayout
(
nameStringFinal
,
currentNamePaint
,
nameWidth
,
Layout
.
Alignment
.
ALIGN_NORMAL
,
1.0f
,
0.0f
,
false
);
messageWidth
=
width
-
Utilities
.
dp
(
88
);
if
(!
Utilities
.
isRTL
)
{
if
(!
LocaleController
.
isRTL
)
{
messageLeft
=
Utilities
.
dp
(
77
);
avatarLeft
=
Utilities
.
dp
(
11
);
}
else
{
...
...
@@ -598,7 +598,7 @@ public class DialogCell extends BaseCell {
if
(
drawError
)
{
int
w
=
errorDrawable
.
getIntrinsicWidth
()
+
Utilities
.
dp
(
8
);
messageWidth
-=
w
;
if
(!
Utilities
.
isRTL
)
{
if
(!
LocaleController
.
isRTL
)
{
errorLeft
=
width
-
errorDrawable
.
getIntrinsicWidth
()
-
Utilities
.
dp
(
11
);
}
else
{
errorLeft
=
Utilities
.
dp
(
11
);
...
...
@@ -609,7 +609,7 @@ public class DialogCell extends BaseCell {
countLayout
=
new
StaticLayout
(
countString
,
countPaint
,
countWidth
,
Layout
.
Alignment
.
ALIGN_CENTER
,
1.0f
,
0.0f
,
false
);
int
w
=
countWidth
+
Utilities
.
dp
(
18
);
messageWidth
-=
w
;
if
(!
Utilities
.
isRTL
)
{
if
(!
LocaleController
.
isRTL
)
{
countLeft
=
width
-
countWidth
-
Utilities
.
dp
(
16
);
}
else
{
countLeft
=
Utilities
.
dp
(
16
);
...
...
@@ -636,7 +636,7 @@ public class DialogCell extends BaseCell {
double
widthpx
=
0
;
float
left
=
0
;
if
(
Utilities
.
isRTL
)
{
if
(
LocaleController
.
isRTL
)
{
if
(
nameLayout
.
getLineCount
()
>
0
)
{
left
=
nameLayout
.
getLineLeft
(
0
);
if
(
left
==
0
)
{
...
...
TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java
View file @
0f53d75a
...
...
@@ -1315,7 +1315,7 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa
if
(
currentUser
.
status
.
expires
<=
10000
)
{
actionBar
.
setSubtitle
(
LocaleController
.
getString
(
"Invisible"
,
R
.
string
.
Invisible
));
}
else
{
actionBar
.
setSubtitle
(
Utilities
.
formatDateOnline
(
currentUser
.
status
.
expires
));
actionBar
.
setSubtitle
(
LocaleController
.
formatDateOnline
(
currentUser
.
status
.
expires
));
}
}
}
...
...
@@ -1624,7 +1624,7 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa
messagesByDays
.
put
(
obj
.
dateKey
,
dayArray
);
TLRPC
.
Message
dateMsg
=
new
TLRPC
.
Message
();
dateMsg
.
message
=
Utilities
.
formatDateChat
(
obj
.
messageOwner
.
date
);
dateMsg
.
message
=
LocaleController
.
formatDateChat
(
obj
.
messageOwner
.
date
);
dateMsg
.
id
=
0
;
MessageObject
dateObj
=
new
MessageObject
(
dateMsg
,
null
);
dateObj
.
type
=
10
;
...
...
@@ -1902,7 +1902,7 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa
messagesByDays
.
put
(
obj
.
dateKey
,
dayArray
);
TLRPC
.
Message
dateMsg
=
new
TLRPC
.
Message
();
dateMsg
.
message
=
Utilities
.
formatDateChat
(
obj
.
messageOwner
.
date
);
dateMsg
.
message
=
LocaleController
.
formatDateChat
(
obj
.
messageOwner
.
date
);
dateMsg
.
id
=
0
;
MessageObject
dateObj
=
new
MessageObject
(
dateMsg
,
null
);
dateObj
.
type
=
10
;
...
...
@@ -3557,7 +3557,7 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa
int
type
=
message
.
type
;
if
(
timeTextView
!=
null
)
{
timeTextView
.
setText
(
Utilities
.
formatterDay
.
format
((
long
)
(
message
.
messageOwner
.
date
)
*
1000
));
timeTextView
.
setText
(
LocaleController
.
formatterDay
.
format
((
long
)
(
message
.
messageOwner
.
date
)
*
1000
));
}
if
(
avatarImageView
!=
null
&&
fromUser
!=
null
)
{
...
...
TMessagesProj/src/main/java/org/telegram/ui/ContactAddActivity.java
View file @
0f53d75a
...
...
@@ -141,7 +141,7 @@ public class ContactAddActivity extends BaseFragment implements NotificationCent
if
(
user
.
status
.
expires
<=
10000
)
{
onlineText
.
setText
(
LocaleController
.
getString
(
"Invisible"
,
R
.
string
.
Invisible
));
}
else
{
onlineText
.
setText
(
Utilities
.
formatDateOnline
(
user
.
status
.
expires
));
onlineText
.
setText
(
LocaleController
.
formatDateOnline
(
user
.
status
.
expires
));
}
}
}
...
...
TMessagesProj/src/main/java/org/telegram/ui/ContactsActivity.java
View file @
0f53d75a
...
...
@@ -70,7 +70,7 @@ public class ContactsActivity extends BaseFragment implements NotificationCenter
public
int
selectAlertString
=
0
;
public
String
selectAlertStringDesc
=
null
;
private
SearchView
searchView
;
private
TextView
e
pm
tyTextView
;
private
TextView
e
mp
tyTextView
;
private
HashMap
<
Integer
,
TLRPC
.
User
>
ignoreUsers
;
private
SupportMenuItem
searchItem
;
...
...
@@ -145,12 +145,12 @@ public class ContactsActivity extends BaseFragment implements NotificationCenter
fragmentView
=
inflater
.
inflate
(
R
.
layout
.
contacts_layout
,
container
,
false
);
e
pm
tyTextView
=
(
TextView
)
fragmentView
.
findViewById
(
R
.
id
.
searchEmptyView
);
e
pm
tyTextView
.
setText
(
LocaleController
.
getString
(
"NoContacts"
,
R
.
string
.
NoContacts
));
e
mp
tyTextView
=
(
TextView
)
fragmentView
.
findViewById
(
R
.
id
.
searchEmptyView
);
e
mp
tyTextView
.
setText
(
LocaleController
.
getString
(
"NoContacts"
,
R
.
string
.
NoContacts
));
searchListViewAdapter
=
new
ContactsActivitySearchAdapter
(
parentActivity
,
ignoreUsers
);
listView
=
(
PinnedHeaderListView
)
fragmentView
.
findViewById
(
R
.
id
.
listView
);
listView
.
setEmptyView
(
e
pm
tyTextView
);
listView
.
setEmptyView
(
e
mp
tyTextView
);
listView
.
setVerticalScrollBarEnabled
(
false
);
listViewAdapter
=
new
ContactsActivityAdapter
(
parentActivity
,
onlyUsers
,
usersAsSections
,
ignoreUsers
);
...
...
@@ -284,7 +284,7 @@ public class ContactsActivity extends BaseFragment implements NotificationCenter
}
}
});
e
pm
tyTextView
.
setOnTouchListener
(
new
OnSwipeTouchListener
()
{
e
mp
tyTextView
.
setOnTouchListener
(
new
OnSwipeTouchListener
()
{
public
void
onSwipeRight
()
{
finishFragment
(
true
);
if
(
searchItem
!=
null
)
{
...
...
@@ -444,8 +444,8 @@ public class ContactsActivity extends BaseFragment implements NotificationCenter
listView
.
setFastScrollEnabled
(
false
);
listView
.
setVerticalScrollBarEnabled
(
true
);
}
if
(
e
pm
tyTextView
!=
null
)
{
e
pm
tyTextView
.
setText
(
LocaleController
.
getString
(
"NoResult"
,
R
.
string
.
NoResult
));
if
(
e
mp
tyTextView
!=
null
)
{
e
mp
tyTextView
.
setText
(
LocaleController
.
getString
(
"NoResult"
,
R
.
string
.
NoResult
));
}
}
return
true
;
...
...
@@ -474,7 +474,7 @@ public class ContactsActivity extends BaseFragment implements NotificationCenter
searchWas
=
false
;
ViewGroup
group
=
(
ViewGroup
)
listView
.
getParent
();
listView
.
setAdapter
(
listViewAdapter
);
if
(!
Utilities
.
isRTL
)
{
if
(!
LocaleController
.
isRTL
)
{
listView
.
setPadding
(
Utilities
.
dp
(
16
),
listView
.
getPaddingTop
(),
Utilities
.
dp
(
30
),
listView
.
getPaddingBottom
());
}
else
{
listView
.
setPadding
(
Utilities
.
dp
(
30
),
listView
.
getPaddingTop
(),
Utilities
.
dp
(
16
),
listView
.
getPaddingBottom
());
...
...
@@ -486,7 +486,7 @@ public class ContactsActivity extends BaseFragment implements NotificationCenter
listView
.
setVerticalScrollBarEnabled
(
false
);
((
LaunchActivity
)
parentActivity
).
updateActionBar
();
e
pm
tyTextView
.
setText
(
LocaleController
.
getString
(
"NoContacts"
,
R
.
string
.
NoContacts
));
e
mp
tyTextView
.
setText
(
LocaleController
.
getString
(
"NoContacts"
,
R
.
string
.
NoContacts
));
return
true
;
}
});
...
...
TMessagesProj/src/main/java/org/telegram/ui/CountrySelectActivity.java
View file @
0f53d75a
...
...
@@ -29,6 +29,7 @@ import android.widget.ImageView;
import
android.widget.TextView
;
import
org.telegram.messenger.FileLog
;
import
org.telegram.messenger.LocaleController
;
import
org.telegram.messenger.R
;
import
org.telegram.messenger.Utilities
;
import
org.telegram.ui.Views.PinnedHeaderListView
;
...
...
@@ -52,11 +53,11 @@ public class CountrySelectActivity extends ActionBarActivity {
private
boolean
searchWas
;
private
boolean
searching
;
private
BaseAdapter
searchListViewAdapter
;
private
TextView
e
pm
tyTextView
;
private
TextView
e
mp
tyTextView
;
private
HashMap
<
String
,
ArrayList
<
Country
>>
countries
=
new
HashMap
<
String
,
ArrayList
<
Country
>>();
private
ArrayList
<
String
>
sortedCountries
=
new
ArrayList
<
String
>();
private
Timer
search
Dialogs
Timer
;
private
Timer
searchTimer
;
public
ArrayList
<
Country
>
searchResult
;
public
static
class
Country
{
...
...
@@ -112,11 +113,11 @@ public class CountrySelectActivity extends ActionBarActivity {
setContentView
(
R
.
layout
.
country_select_layout
);
e
pm
tyTextView
=
(
TextView
)
findViewById
(
R
.
id
.
searchEmptyView
);
e
mp
tyTextView
=
(
TextView
)
findViewById
(
R
.
id
.
searchEmptyView
);
searchListViewAdapter
=
new
SearchAdapter
(
this
);
listView
=
(
PinnedHeaderListView
)
findViewById
(
R
.
id
.
listView
);
listView
.
setEmptyView
(
e
pm
tyTextView
);
listView
.
setEmptyView
(
e
mp
tyTextView
);
listView
.
setVerticalScrollBarEnabled
(
false
);
listView
.
setAdapter
(
listViewAdapter
=
new
ListAdapter
(
this
));
...
...
@@ -221,7 +222,7 @@ public class CountrySelectActivity extends ActionBarActivity {
@Override
public
boolean
onQueryTextChange
(
String
s
)
{
search
Dialogs
(
s
);
search
(
s
);
if
(
s
.
length
()
!=
0
)
{
searchWas
=
true
;
if
(
listView
!=
null
)
{
...
...
@@ -233,8 +234,8 @@ public class CountrySelectActivity extends ActionBarActivity {
listView
.
setFastScrollEnabled
(
false
);
listView
.
setVerticalScrollBarEnabled
(
true
);
}
if
(
e
pm
tyTextView
!=
null
)
{
e
pm
tyTextView
.
setText
(
getString
(
R
.
string
.
NoResult
));
if
(
e
mp
tyTextView
!=
null
)
{
e
mp
tyTextView
.
setText
(
getString
(
R
.
string
.
NoResult
));
}
}
return
true
;
...
...
@@ -252,12 +253,12 @@ public class CountrySelectActivity extends ActionBarActivity {
@Override
public
boolean
onMenuItemActionCollapse
(
MenuItem
menuItem
)
{
searchView
.
setQuery
(
""
,
false
);
search
Dialogs
(
null
);
search
(
null
);
searching
=
false
;
searchWas
=
false
;
ViewGroup
group
=
(
ViewGroup
)
listView
.
getParent
();
listView
.
setAdapter
(
listViewAdapter
);
if
(!
Utilities
.
isRTL
)
{
if
(!
LocaleController
.
isRTL
)
{
listView
.
setPadding
(
Utilities
.
dp
(
16
),
listView
.
getPaddingTop
(),
Utilities
.
dp
(
30
),
listView
.
getPaddingBottom
());
}
else
{
listView
.
setPadding
(
Utilities
.
dp
(
30
),
listView
.
getPaddingTop
(),
Utilities
.
dp
(
16
),
listView
.
getPaddingBottom
());
...
...
@@ -269,7 +270,7 @@ public class CountrySelectActivity extends ActionBarActivity {
listView
.
setVerticalScrollBarEnabled
(
false
);
applySelfActionBar
();
e
pm
tyTextView
.
setText
(
getString
(
R
.
string
.
ChooseCountry
));
e
mp
tyTextView
.
setText
(
getString
(
R
.
string
.
ChooseCountry
));
return
true
;
}
});
...
...
@@ -305,24 +306,24 @@ public class CountrySelectActivity extends ActionBarActivity {
}
}
public
void
search
Dialogs
(
final
String
query
)
{
public
void
search
(
final
String
query
)
{
if
(
query
==
null
)
{
searchResult
=
null
;
}
else
{
try
{
if
(
search
Dialogs
Timer
!=
null
)
{
search
Dialogs
Timer
.
cancel
();
if
(
searchTimer
!=
null
)
{
searchTimer
.
cancel
();
}
}
catch
(
Exception
e
)
{
FileLog
.
e
(
"tmessages"
,
e
);
}
search
Dialogs
Timer
=
new
Timer
();
search
Dialogs
Timer
.
schedule
(
new
TimerTask
()
{
searchTimer
=
new
Timer
();
searchTimer
.
schedule
(
new
TimerTask
()
{
@Override
public
void
run
()
{
try
{
search
Dialogs
Timer
.
cancel
();
search
Dialogs
Timer
=
null
;
searchTimer
.
cancel
();
searchTimer
=
null
;
}
catch
(
Exception
e
)
{
FileLog
.
e
(
"tmessages"
,
e
);
}
...
...
TMessagesProj/src/main/java/org/telegram/ui/GalleryImageViewer.java
View file @
0f53d75a
...
...
@@ -565,7 +565,7 @@ public class GalleryImageViewer extends AbstractGalleryActivity implements Notif
TLRPC
.
User
user
=
MessagesController
.
getInstance
().
users
.
get
(
obj
.
messageOwner
.
from_id
);
if
(
user
!=
null
)
{
nameTextView
.
setText
(
Utilities
.
formatName
(
user
.
first_name
,
user
.
last_name
));
timeTextView
.
setText
(
Utilities
.
formatterYearMax
.
format
(((
long
)
obj
.
messageOwner
.
date
)
*
1000
));
timeTextView
.
setText
(
LocaleController
.
formatterYearMax
.
format
(((
long
)
obj
.
messageOwner
.
date
)
*
1000
));
}
else
{
nameTextView
.
setText
(
""
);
}
...
...
TMessagesProj/src/main/java/org/telegram/ui/GroupCreateActivity.java
View file @
0f53d75a
...
...
@@ -59,7 +59,7 @@ import java.util.TimerTask;
public
class
GroupCreateActivity
extends
BaseFragment
implements
NotificationCenter
.
NotificationCenterDelegate
{
private
SectionedBaseAdapter
listViewAdapter
;
private
PinnedHeaderListView
listView
;
private
TextView
e
pm
tyTextView
;
private
TextView
e
mp
tyTextView
;
private
EditText
userSelectEditText
;
private
boolean
ignoreChange
=
false
;
...
...
@@ -68,7 +68,7 @@ public class GroupCreateActivity extends BaseFragment implements NotificationCen
private
boolean
searchWas
;
private
boolean
searching
;
private
Timer
search
Dialogs
Timer
;
private
Timer
searchTimer
;
public
ArrayList
<
TLRPC
.
User
>
searchResult
;
public
ArrayList
<
CharSequence
>
searchResultNames
;
...
...
@@ -111,8 +111,8 @@ public class GroupCreateActivity extends BaseFragment implements NotificationCen
fragmentView
=
inflater
.
inflate
(
R
.
layout
.
group_create_layout
,
container
,
false
);
e
pm
tyTextView
=
(
TextView
)
fragmentView
.
findViewById
(
R
.
id
.
searchEmptyView
);
e
pm
tyTextView
.
setText
(
LocaleController
.
getString
(
"NoContacts"
,
R
.
string
.
NoContacts
));
e
mp
tyTextView
=
(
TextView
)
fragmentView
.
findViewById
(
R
.
id
.
searchEmptyView
);
e
mp
tyTextView
.
setText
(
LocaleController
.
getString
(
"NoContacts"
,
R
.
string
.
NoContacts
));
userSelectEditText
=
(
EditText
)
fragmentView
.
findViewById
(
R
.
id
.
bubble_input_text
);
userSelectEditText
.
setHint
(
LocaleController
.
getString
(
"SendMessageTo"
,
R
.
string
.
SendMessageTo
));
if
(
Build
.
VERSION
.
SDK_INT
>=
11
)
{
...
...
@@ -173,14 +173,14 @@ public class GroupCreateActivity extends BaseFragment implements NotificationCen
searchDialogs
(
text
);
searching
=
true
;
searchWas
=
true
;
e
pm
tyTextView
.
setText
(
LocaleController
.
getString
(
"NoResult"
,
R
.
string
.
NoResult
));
e
mp
tyTextView
.
setText
(
LocaleController
.
getString
(
"NoResult"
,
R
.
string
.
NoResult
));
listViewAdapter
.
notifyDataSetChanged
();
}
else
{
searchResult
=
null
;
searchResultNames
=
null
;
searching
=
false
;
searchWas
=
false
;
e
pm
tyTextView
.
setText
(
LocaleController
.
getString
(
"NoContacts"
,
R
.
string
.
NoContacts
));
e
mp
tyTextView
.
setText
(
LocaleController
.
getString
(
"NoContacts"
,
R
.
string
.
NoContacts
));
listViewAdapter
.
notifyDataSetChanged
();
}
}
...
...
@@ -189,7 +189,7 @@ public class GroupCreateActivity extends BaseFragment implements NotificationCen
});
listView
=
(
PinnedHeaderListView
)
fragmentView
.
findViewById
(
R
.
id
.
listView
);
listView
.
setEmptyView
(
e
pm
tyTextView
);
listView
.
setEmptyView
(
e
mp
tyTextView
);
listView
.
setVerticalScrollBarEnabled
(
false
);
listView
.
setAdapter
(
listViewAdapter
=
new
ListAdapter
(
parentActivity
));
...
...
@@ -232,7 +232,7 @@ public class GroupCreateActivity extends BaseFragment implements NotificationCen
if
(
searching
||
searchWas
)
{
searching
=
false
;
searchWas
=
false
;
e
pm
tyTextView
.
setText
(
LocaleController
.
getString
(
"NoContacts"
,
R
.
string
.
NoContacts
));
e
mp
tyTextView
.
setText
(
LocaleController
.
getString
(
"NoContacts"
,
R
.
string
.
NoContacts
));
ignoreChange
=
true
;
SpannableStringBuilder
ssb
=
new
SpannableStringBuilder
(
""
);
...
...
@@ -339,19 +339,19 @@ public class GroupCreateActivity extends BaseFragment implements NotificationCen
searchResultNames
=
null
;
}
else
{
try
{
if
(
search
Dialogs
Timer
!=
null
)
{
search
Dialogs
Timer
.
cancel
();
if
(
searchTimer
!=
null
)
{
searchTimer
.
cancel
();
}
}
catch
(
Exception
e
)
{
FileLog
.
e
(
"tmessages"
,
e
);
}
search
Dialogs
Timer
=
new
Timer
();
search
Dialogs
Timer
.
schedule
(
new
TimerTask
()
{
searchTimer
=
new
Timer
();
searchTimer
.
schedule
(
new
TimerTask
()
{
@Override
public
void
run
()
{
try
{
search
Dialogs
Timer
.
cancel
();
search
Dialogs
Timer
=
null
;
searchTimer
.
cancel
();
searchTimer
=
null
;
}
catch
(
Exception
e
)
{
FileLog
.
e
(
"tmessages"
,
e
);
}
...
...
@@ -568,7 +568,7 @@ public class GroupCreateActivity extends BaseFragment implements NotificationCen
if
(
user
.
status
.
expires
<=
10000
)
{
holder
.
messageTextView
.
setText
(
LocaleController
.
getString
(
"Invisible"
,
R
.
string
.
Invisible
));
}
else
{
holder
.
messageTextView
.
setText
(
Utilities
.
formatDateOnline
(
user
.
status
.
expires
));
holder
.
messageTextView
.
setText
(
LocaleController
.
formatDateOnline
(
user
.
status
.
expires
));
}
holder
.
messageTextView
.
setTextColor
(
0xff808080
);
}
...
...
TMessagesProj/src/main/java/org/telegram/ui/IntroActivity.java
View file @
0f53d75a
...
...
@@ -44,7 +44,7 @@ public class IntroActivity extends ActionBarActivity {
setContentView
(
R
.
layout
.
intro_layout
);
if
(
Utilities
.
isRTL
)
{
if
(
LocaleController
.
isRTL
)
{
icons
=
new
int
[]
{
R
.
drawable
.
intro7
,
R
.
drawable
.
intro6
,
...
...
@@ -209,7 +209,7 @@ public class IntroActivity extends ActionBarActivity {
protected
void
onResume
()
{
super
.
onResume
();
if
(
justCreated
)
{
if
(
Utilities
.
isRTL
)
{
if
(
LocaleController
.
isRTL
)
{
viewPager
.
setCurrentItem
(
6
);
lastPage
=
6
;
}
else
{
...
...
TMessagesProj/src/main/java/org/telegram/ui/LanguageSelectActivity.java
0 → 100644
View file @
0f53d75a
/*
* This is the source code of Telegram for Android v. 1.3.x.
* It is licensed under GNU GPL v. 2 or later.
* You should have received a copy of the license in this archive (see LICENSE).
*
* Copyright Nikolai Kudashov, 2013-2014.
*/
package
org
.
telegram
.
ui
;
import
android.content.Context
;
import
android.os.Bundle
;
import
android.support.v4.internal.view.SupportMenuItem
;
import
android.support.v4.view.MenuItemCompat
;
import
android.support.v7.app.ActionBar
;
import
android.support.v7.widget.SearchView
;
import
android.view.LayoutInflater
;
import
android.view.Menu
;
import
android.view.MenuInflater
;
import
android.view.MenuItem
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.widget.AdapterView
;
import
android.widget.BaseAdapter
;
import
android.widget.ImageView
;
import
android.widget.ListView
;
import
android.widget.TextView
;
import
org.telegram.messenger.FileLog
;
import
org.telegram.messenger.LocaleController
;
import
org.telegram.messenger.R
;
import
org.telegram.messenger.Utilities
;
import
org.telegram.ui.Views.BaseFragment
;
import
org.telegram.ui.Views.OnSwipeTouchListener
;
import
java.lang.reflect.Field
;
import
java.util.ArrayList
;
import
java.util.Timer
;
import
java.util.TimerTask
;
public
class
LanguageSelectActivity
extends
BaseFragment
{
private
SupportMenuItem
searchItem
;
private
SearchView
searchView
;
private
BaseAdapter
listAdapter
;
private
ListView
listView
;
private
boolean
searchWas
;
private
boolean
searching
;
private
BaseAdapter
searchListViewAdapter
;
private
TextView
emptyTextView
;
private
Timer
searchTimer
;
public
ArrayList
<
LocaleController
.
LocaleInfo
>
searchResult
;
@Override
public
boolean
onFragmentCreate
()
{
super
.
onFragmentCreate
();
return
true
;
}
@Override
public
void
onFragmentDestroy
()
{
super
.
onFragmentDestroy
();
}
@Override
public
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
setHasOptionsMenu
(
true
);
}
@Override
public
View
onCreateView
(
LayoutInflater
inflater
,
ViewGroup
container
,
Bundle
savedInstanceState
)
{
if
(
fragmentView
==
null
)
{
fragmentView
=
inflater
.
inflate
(
R
.
layout
.
language_select_layout
,
container
,
false
);
listAdapter
=
new
ListAdapter
(
parentActivity
);
listView
=
(
ListView
)
fragmentView
.
findViewById
(
R
.
id
.
listView
);
listView
.
setAdapter
(
listAdapter
);
emptyTextView
=
(
TextView
)
fragmentView
.
findViewById
(
R
.
id
.
searchEmptyView
);
listView
.
setEmptyView
(
emptyTextView
);
searchListViewAdapter
=
new
SearchAdapter
(
parentActivity
);
listView
.
setOnItemClickListener
(
new
AdapterView
.
OnItemClickListener
()
{
@Override
public
void
onItemClick
(
AdapterView
<?>
adapterView
,
View
view
,
int
i
,
long
l
)
{
if
(
parentActivity
==
null
)
{
return
;
}
LocaleController
.
LocaleInfo
localeInfo
=
null
;
if
(
searching
&&
searchWas
)
{
if
(
i
>=
0
&&
i
<
searchResult
.
size
())
{
localeInfo
=
searchResult
.
get
(
i
);
}
}
else
{
if
(
i
>=
0
&&
i
<
LocaleController
.
getInstance
().
sortedLanguages
.
size
())
{
localeInfo
=
LocaleController
.
getInstance
().
sortedLanguages
.
get
(
i
);
}
}
if
(
localeInfo
!=
null
)
{
boolean
isRTL
=
LocaleController
.
isRTL
;
LocaleController
.
getInstance
().
applyLanguage
(
localeInfo
,
true
);
if
(
isRTL
!=
LocaleController
.
isRTL
)
{
for
(
BaseFragment
fragment
:
ApplicationLoader
.
fragmentsStack
)
{
if
(
fragment
==
LanguageSelectActivity
.
this
)
{
continue
;
}
if
(
fragment
.
fragmentView
!=
null
)
{
ViewGroup
parent
=
(
ViewGroup
)
fragment
.
fragmentView
.
getParent
();
if
(
parent
!=
null
)
{
parent
.
removeView
(
fragment
.
fragmentView
);
}
fragment
.
fragmentView
=
null
;
}
fragment
.
parentActivity
=
parentActivity
;
}
}
}
finishFragment
();
}
});
listView
.
setOnTouchListener
(
new
OnSwipeTouchListener
()
{
public
void
onSwipeRight
()
{
finishFragment
(
true
);
}
});
searching
=
false
;
searchWas
=
false
;
}
else
{
ViewGroup
parent
=
(
ViewGroup
)
fragmentView
.
getParent
();
if
(
parent
!=
null
)
{
parent
.
removeView
(
fragmentView
);
}
}
return
fragmentView
;
}
@Override
public
void
applySelfActionBar
()
{
if
(
parentActivity
==
null
)
{
return
;
}
ActionBar
actionBar
=
parentActivity
.
getSupportActionBar
();
actionBar
.
setDisplayShowTitleEnabled
(
true
);
actionBar
.
setDisplayShowHomeEnabled
(
false
);
actionBar
.
setDisplayHomeAsUpEnabled
(
true
);
actionBar
.
setDisplayUseLogoEnabled
(
false
);
actionBar
.
setDisplayShowCustomEnabled
(
false
);
actionBar
.
setCustomView
(
null
);
actionBar
.
setSubtitle
(
null
);
TextView
title
=
(
TextView
)
parentActivity
.
findViewById
(
R
.
id
.
action_bar_title
);
if
(
title
==
null
)
{
final
int
subtitleId
=
parentActivity
.
getResources
().
getIdentifier
(
"action_bar_title"
,
"id"
,
"android"
);
title
=
(
TextView
)
parentActivity
.
findViewById
(
subtitleId
);
}
if
(
title
!=
null
)
{
title
.
setCompoundDrawablesWithIntrinsicBounds
(
0
,
0
,
0
,
0
);
title
.
setCompoundDrawablePadding
(
0
);
}
actionBar
.
setTitle
(
LocaleController
.
getString
(
"Language"
,
R
.
string
.
Language
));
((
LaunchActivity
)
parentActivity
).
fixBackButton
();
}
@Override
public
void
onResume
()
{
super
.
onResume
();
if
(
isFinish
)
{
return
;
}
if
(
getActivity
()
==
null
)
{
return
;
}
if
(!
firstStart
&&
listAdapter
!=
null
)
{
listAdapter
.
notifyDataSetChanged
();
}
firstStart
=
false
;
((
LaunchActivity
)
parentActivity
).
showActionBar
();
((
LaunchActivity
)
parentActivity
).
updateActionBar
();
}
@Override
public
boolean
onOptionsItemSelected
(
MenuItem
item
)
{
int
itemId
=
item
.
getItemId
();
switch
(
itemId
)
{
case
android
.
R
.
id
.
home
:
if
(
searchItem
!=
null
)
{
if
(
searchItem
.
isActionViewExpanded
())
{
searchItem
.
collapseActionView
();
}
}
finishFragment
();
break
;
}
return
true
;
}
@Override
public
void
onCreateOptionsMenu
(
Menu
menu
,
MenuInflater
inflater
)
{
inflater
.
inflate
(
R
.
menu
.
contacts_menu
,
menu
);
searchItem
=
(
SupportMenuItem
)
menu
.
findItem
(
R
.
id
.
messages_list_menu_search
);
searchView
=
(
SearchView
)
searchItem
.
getActionView
();
TextView
textView
=
(
TextView
)
searchView
.
findViewById
(
R
.
id
.
search_src_text
);
if
(
textView
!=
null
)
{
textView
.
setTextColor
(
0xffffffff
);
try
{
Field
mCursorDrawableRes
=
TextView
.
class
.
getDeclaredField
(
"mCursorDrawableRes"
);
mCursorDrawableRes
.
setAccessible
(
true
);
mCursorDrawableRes
.
set
(
textView
,
R
.
drawable
.
search_carret
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
ImageView
img
=
(
ImageView
)
searchView
.
findViewById
(
R
.
id
.
search_close_btn
);
if
(
img
!=
null
)
{
img
.
setImageResource
(
R
.
drawable
.
ic_msg_btn_cross_custom
);
}
searchView
.
setOnQueryTextListener
(
new
SearchView
.
OnQueryTextListener
()
{
@Override
public
boolean
onQueryTextSubmit
(
String
s
)
{
return
true
;
}
@Override
public
boolean
onQueryTextChange
(
String
s
)
{
search
(
s
);
if
(
s
.
length
()
!=
0
)
{
searchWas
=
true
;
if
(
listView
!=
null
)
{
listView
.
setPadding
(
Utilities
.
dp
(
16
),
listView
.
getPaddingTop
(),
Utilities
.
dp
(
16
),
listView
.
getPaddingBottom
());
listView
.
setAdapter
(
searchListViewAdapter
);
if
(
android
.
os
.
Build
.
VERSION
.
SDK_INT
>=
11
)
{
listView
.
setFastScrollAlwaysVisible
(
false
);
}
listView
.
setFastScrollEnabled
(
false
);
listView
.
setVerticalScrollBarEnabled
(
true
);
}
if
(
emptyTextView
!=
null
)
{
emptyTextView
.
setText
(
getString
(
R
.
string
.
NoResult
));
}
}
return
true
;
}
});
searchItem
.
setSupportOnActionExpandListener
(
new
MenuItemCompat
.
OnActionExpandListener
()
{
@Override
public
boolean
onMenuItemActionExpand
(
MenuItem
menuItem
)
{
if
(
parentActivity
!=
null
)
{
parentActivity
.
getSupportActionBar
().
setIcon
(
R
.
drawable
.
ic_ab_search
);
}
searching
=
true
;
return
true
;
}
@Override
public
boolean
onMenuItemActionCollapse
(
MenuItem
menuItem
)
{
searchView
.
setQuery
(
""
,
false
);
search
(
null
);
searching
=
false
;
searchWas
=
false
;
if
(
listView
!=
null
)
{
listView
.
setEmptyView
(
emptyTextView
);
emptyTextView
.
setVisibility
(
View
.
GONE
);
}
if
(
listAdapter
!=
null
)
{
listAdapter
.
notifyDataSetChanged
();
}
((
LaunchActivity
)
parentActivity
).
fixBackButton
();
return
true
;
}
});
super
.
onCreateOptionsMenu
(
menu
,
inflater
);
}
public
void
search
(
final
String
query
)
{
if
(
query
==
null
)
{
searchResult
=
null
;
}
else
{
try
{
if
(
searchTimer
!=
null
)
{
searchTimer
.
cancel
();
}
}
catch
(
Exception
e
)
{
FileLog
.
e
(
"tmessages"
,
e
);
}
searchTimer
=
new
Timer
();
searchTimer
.
schedule
(
new
TimerTask
()
{
@Override
public
void
run
()
{
try
{
searchTimer
.
cancel
();
searchTimer
=
null
;
}
catch
(
Exception
e
)
{
FileLog
.
e
(
"tmessages"
,
e
);
}
processSearch
(
query
);
}
},
100
,
300
);
}
}
private
void
processSearch
(
final
String
query
)
{
Utilities
.
globalQueue
.
postRunnable
(
new
Runnable
()
{
@Override
public
void
run
()
{
String
q
=
query
.
trim
().
toLowerCase
();
if
(
q
.
length
()
==
0
)
{
updateSearchResults
(
new
ArrayList
<
LocaleController
.
LocaleInfo
>());
return
;
}
long
time
=
System
.
currentTimeMillis
();
ArrayList
<
LocaleController
.
LocaleInfo
>
resultArray
=
new
ArrayList
<
LocaleController
.
LocaleInfo
>();
for
(
LocaleController
.
LocaleInfo
c
:
LocaleController
.
getInstance
().
sortedLanguages
)
{
if
(
c
.
name
.
toLowerCase
().
startsWith
(
query
)
||
c
.
nameEnglish
.
toLowerCase
().
startsWith
(
query
))
{
resultArray
.
add
(
c
);
}
}
updateSearchResults
(
resultArray
);
}
});
}
private
void
updateSearchResults
(
final
ArrayList
<
LocaleController
.
LocaleInfo
>
arrCounties
)
{
Utilities
.
RunOnUIThread
(
new
Runnable
()
{
@Override
public
void
run
()
{
searchResult
=
arrCounties
;
searchListViewAdapter
.
notifyDataSetChanged
();
}
});
}
private
class
SearchAdapter
extends
BaseAdapter
{
private
Context
mContext
;
public
SearchAdapter
(
Context
context
)
{
mContext
=
context
;
}
@Override
public
boolean
areAllItemsEnabled
()
{
return
true
;
}
@Override
public
boolean
isEnabled
(
int
i
)
{
return
true
;
}
@Override
public
int
getCount
()
{
if
(
searchResult
==
null
)
{
return
0
;
}
return
searchResult
.
size
();
}
@Override
public
Object
getItem
(
int
i
)
{
return
null
;
}
@Override
public
long
getItemId
(
int
i
)
{
return
i
;
}
@Override
public
boolean
hasStableIds
()
{
return
false
;
}
@Override
public
View
getView
(
int
i
,
View
view
,
ViewGroup
viewGroup
)
{
if
(
view
==
null
)
{
LayoutInflater
li
=
(
LayoutInflater
)
mContext
.
getSystemService
(
Context
.
LAYOUT_INFLATER_SERVICE
);
view
=
li
.
inflate
(
R
.
layout
.
settings_row_button_layout
,
viewGroup
,
false
);
}
TextView
textView
=
(
TextView
)
view
.
findViewById
(
R
.
id
.
settings_row_text
);
View
divider
=
view
.
findViewById
(
R
.
id
.
settings_row_divider
);
LocaleController
.
LocaleInfo
c
=
searchResult
.
get
(
i
);
textView
.
setText
(
c
.
name
);
if
(
i
==
searchResult
.
size
()
-
1
)
{
divider
.
setVisibility
(
View
.
GONE
);
}
else
{
divider
.
setVisibility
(
View
.
VISIBLE
);
}
return
view
;
}
@Override
public
int
getItemViewType
(
int
i
)
{
return
0
;
}
@Override
public
int
getViewTypeCount
()
{
return
1
;
}
@Override
public
boolean
isEmpty
()
{
return
searchResult
==
null
||
searchResult
.
size
()
==
0
;
}
}
private
class
ListAdapter
extends
BaseAdapter
{
private
Context
mContext
;
public
ListAdapter
(
Context
context
)
{
mContext
=
context
;
}
@Override
public
boolean
areAllItemsEnabled
()
{
return
true
;
}
@Override
public
boolean
isEnabled
(
int
i
)
{
return
true
;
}
@Override
public
int
getCount
()
{
if
(
LocaleController
.
getInstance
().
sortedLanguages
==
null
)
{
return
0
;
}
return
LocaleController
.
getInstance
().
sortedLanguages
.
size
();
}
@Override
public
Object
getItem
(
int
i
)
{
return
null
;
}
@Override
public
long
getItemId
(
int
i
)
{
return
i
;
}
@Override
public
boolean
hasStableIds
()
{
return
false
;
}
@Override
public
View
getView
(
int
i
,
View
view
,
ViewGroup
viewGroup
)
{
if
(
view
==
null
)
{
LayoutInflater
li
=
(
LayoutInflater
)
mContext
.
getSystemService
(
Context
.
LAYOUT_INFLATER_SERVICE
);
view
=
li
.
inflate
(
R
.
layout
.
settings_row_button_layout
,
viewGroup
,
false
);
}
TextView
textView
=
(
TextView
)
view
.
findViewById
(
R
.
id
.
settings_row_text
);
View
divider
=
view
.
findViewById
(
R
.
id
.
settings_row_divider
);
LocaleController
.
LocaleInfo
localeInfo
=
LocaleController
.
getInstance
().
sortedLanguages
.
get
(
i
);
textView
.
setText
(
localeInfo
.
name
);
if
(
i
==
LocaleController
.
getInstance
().
sortedLanguages
.
size
()
-
1
)
{
divider
.
setVisibility
(
View
.
GONE
);
}
else
{
divider
.
setVisibility
(
View
.
VISIBLE
);
}
return
view
;
}
@Override
public
int
getItemViewType
(
int
i
)
{
return
0
;
}
@Override
public
int
getViewTypeCount
()
{
return
1
;
}
@Override
public
boolean
isEmpty
()
{
return
LocaleController
.
getInstance
().
sortedLanguages
==
null
||
LocaleController
.
getInstance
().
sortedLanguages
.
size
()
==
0
;
}
}
}
TMessagesProj/src/main/java/org/telegram/ui/MessagesActivity.java
View file @
0f53d75a
...
...
@@ -69,7 +69,7 @@ public class MessagesActivity extends BaseFragment implements NotificationCenter
private
int
activityToken
=
(
int
)(
MessagesController
.
random
.
nextDouble
()
*
Integer
.
MAX_VALUE
);
private
long
selectedDialog
;
private
Timer
search
Dialogs
Timer
;
private
Timer
searchTimer
;
public
ArrayList
<
TLObject
>
searchResult
;
public
ArrayList
<
CharSequence
>
searchResultNames
;
...
...
@@ -511,19 +511,19 @@ public class MessagesActivity extends BaseFragment implements NotificationCenter
searchResultNames
=
null
;
}
else
{
try
{
if
(
search
Dialogs
Timer
!=
null
)
{
search
Dialogs
Timer
.
cancel
();
if
(
searchTimer
!=
null
)
{
searchTimer
.
cancel
();
}
}
catch
(
Exception
e
)
{
FileLog
.
e
(
"tmessages"
,
e
);
}
search
Dialogs
Timer
=
new
Timer
();
search
Dialogs
Timer
.
schedule
(
new
TimerTask
()
{
searchTimer
=
new
Timer
();
searchTimer
.
schedule
(
new
TimerTask
()
{
@Override
public
void
run
()
{
try
{
search
Dialogs
Timer
.
cancel
();
search
Dialogs
Timer
=
null
;
searchTimer
.
cancel
();
searchTimer
=
null
;
}
catch
(
Exception
e
)
{
FileLog
.
e
(
"tmessages"
,
e
);
}
...
...
TMessagesProj/src/main/java/org/telegram/ui/SettingsActivity.java
View file @
0f53d75a
...
...
@@ -87,6 +87,7 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter
private
int
audioDownloadSection
;
private
int
audioDownloadChatRow
;
private
int
audioDownloadPrivateRow
;
private
int
languageRow
;
@Override
public
boolean
onFragmentCreate
()
{
...
...
@@ -156,6 +157,7 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter
numberRow
=
rowCount
++;
settingsSectionRow
=
rowCount
++;
enableAnimationsRow
=
rowCount
++;
languageRow
=
rowCount
++;
notificationRow
=
rowCount
++;
blockedRow
=
rowCount
++;
backgroundRow
=
rowCount
++;
...
...
@@ -206,7 +208,7 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter
if
(
i
==
textSizeRow
)
{
AlertDialog
.
Builder
builder
=
new
AlertDialog
.
Builder
(
parentActivity
);
builder
.
setTitle
(
LocaleController
.
getString
(
"TextSize"
,
R
.
string
.
TextSize
));
builder
.
setItems
(
new
CharSequence
[]{
String
.
format
(
"%d"
,
12
),
String
.
format
(
"%d"
,
13
),
String
.
format
(
"%d"
,
14
),
String
.
format
(
"%d"
,
15
),
String
.
format
(
"%d"
,
16
),
String
.
format
(
"%d"
,
17
),
String
.
format
(
"%d"
,
18
),
String
.
format
(
"%d"
,
19
),
String
.
format
(
"%d"
,
20
)},
new
DialogInterface
.
OnClickListener
()
{
builder
.
setItems
(
new
CharSequence
[]{
String
.
format
(
"%d"
,
12
),
String
.
format
(
"%d"
,
13
),
String
.
format
(
"%d"
,
14
),
String
.
format
(
"%d"
,
15
),
String
.
format
(
"%d"
,
16
),
String
.
format
(
"%d"
,
17
),
String
.
format
(
"%d"
,
18
),
String
.
format
(
"%d"
,
19
),
String
.
format
(
"%d"
,
20
)
,
String
.
format
(
"%d"
,
21
),
String
.
format
(
"%d"
,
22
),
String
.
format
(
"%d"
,
23
),
String
.
format
(
"%d"
,
24
)
},
new
DialogInterface
.
OnClickListener
()
{
@Override
public
void
onClick
(
DialogInterface
dialog
,
int
which
)
{
SharedPreferences
preferences
=
ApplicationLoader
.
applicationContext
.
getSharedPreferences
(
"mainconfig"
,
Activity
.
MODE_PRIVATE
);
...
...
@@ -404,6 +406,8 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter
if
(
listView
!=
null
)
{
listView
.
invalidateViews
();
}
}
else
if
(
i
==
languageRow
)
{
((
LaunchActivity
)
parentActivity
).
presentFragment
(
new
LanguageSelectActivity
(),
"settings_wallpapers"
,
false
);
}
// else if (i == 6) {
// UserConfig.saveIncomingPhotos = !UserConfig.saveIncomingPhotos;
...
...
@@ -538,7 +542,7 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter
public
boolean
isEnabled
(
int
i
)
{
return
i
==
textSizeRow
||
i
==
enableAnimationsRow
||
i
==
blockedRow
||
i
==
notificationRow
||
i
==
backgroundRow
||
i
==
askQuestionRow
||
i
==
sendLogsRow
||
i
==
sendByEnterRow
||
i
==
terminateSessionsRow
||
i
==
photoDownloadPrivateRow
||
i
==
photoDownloadChatRow
||
i
==
clearLogsRow
||
i
==
audioDownloadChatRow
||
i
==
audioDownloadPrivateRow
;
i
==
photoDownloadChatRow
||
i
==
clearLogsRow
||
i
==
audioDownloadChatRow
||
i
==
audioDownloadPrivateRow
||
i
==
languageRow
;
}
@Override
...
...
@@ -569,9 +573,6 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter
LayoutInflater
li
=
(
LayoutInflater
)
mContext
.
getSystemService
(
Context
.
LAYOUT_INFLATER_SERVICE
);
view
=
li
.
inflate
(
R
.
layout
.
settings_name_layout
,
viewGroup
,
false
);
TextView
textView
=
(
TextView
)
view
.
findViewById
(
R
.
id
.
settings_online
);
textView
.
setText
(
LocaleController
.
getString
(
"Online"
,
R
.
string
.
Online
));
ImageButton
button
=
(
ImageButton
)
view
.
findViewById
(
R
.
id
.
settings_edit_name
);
button
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
...
...
@@ -672,7 +673,10 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter
}
});
}
TextView
textView
=
(
TextView
)
view
.
findViewById
(
R
.
id
.
settings_name
);
TextView
textView
=
(
TextView
)
view
.
findViewById
(
R
.
id
.
settings_online
);
textView
.
setText
(
LocaleController
.
getString
(
"Online"
,
R
.
string
.
Online
));
textView
=
(
TextView
)
view
.
findViewById
(
R
.
id
.
settings_name
);
Typeface
typeface
=
Utilities
.
getTypeface
(
"fonts/rmedium.ttf"
);
textView
.
setTypeface
(
typeface
);
TLRPC
.
User
user
=
MessagesController
.
getInstance
().
users
.
get
(
UserConfig
.
clientUserId
);
...
...
@@ -860,9 +864,12 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter
detailTextView
.
setText
(
String
.
format
(
"%d"
,
size
));
textView
.
setText
(
LocaleController
.
getString
(
"TextSize"
,
R
.
string
.
TextSize
));
divider
.
setVisibility
(
View
.
VISIBLE
);
}
else
if
(
i
==
languageRow
)
{
detailTextView
.
setText
(
LocaleController
.
getCurrentLanguageName
());
textView
.
setText
(
LocaleController
.
getString
(
"Language"
,
R
.
string
.
Language
));
divider
.
setVisibility
(
View
.
VISIBLE
);
}
}
return
view
;
}
...
...
@@ -872,7 +879,7 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter
return
0
;
}
else
if
(
i
==
numberSectionRow
||
i
==
settingsSectionRow
||
i
==
supportSectionRow
||
i
==
messagesSectionRow
||
i
==
photoDownloadSection
||
i
==
audioDownloadSection
)
{
return
1
;
}
else
if
(
i
==
textSizeRow
)
{
}
else
if
(
i
==
textSizeRow
||
i
==
languageRow
)
{
return
5
;
}
else
if
(
i
==
enableAnimationsRow
||
i
==
sendByEnterRow
||
i
==
photoDownloadChatRow
||
i
==
photoDownloadPrivateRow
||
i
==
audioDownloadChatRow
||
i
==
audioDownloadPrivateRow
)
{
return
3
;
...
...
TMessagesProj/src/main/java/org/telegram/ui/UserProfileActivity.java
View file @
0f53d75a
...
...
@@ -647,7 +647,7 @@ public class UserProfileActivity extends BaseFragment implements NotificationCen
if
(
user
.
status
.
expires
<=
10000
)
{
onlineText
.
setText
(
LocaleController
.
getString
(
"Invisible"
,
R
.
string
.
Invisible
));
}
else
{
onlineText
.
setText
(
Utilities
.
formatDateOnline
(
user
.
status
.
expires
));
onlineText
.
setText
(
LocaleController
.
formatDateOnline
(
user
.
status
.
expires
));
}
}
}
...
...
TMessagesProj/src/main/java/org/telegram/ui/Views/NotificationView.java
View file @
0f53d75a
...
...
@@ -23,6 +23,7 @@ import android.widget.ImageView;
import
android.widget.LinearLayout
;
import
android.widget.TextView
;
import
org.telegram.messenger.LocaleController
;
import
org.telegram.messenger.TLRPC
;
import
org.telegram.messenger.FileLog
;
import
org.telegram.messenger.MessagesController
;
...
...
@@ -305,7 +306,7 @@ public class NotificationView extends LinearLayout {
messageTextView
.
setTextSize
(
TypedValue
.
COMPLEX_UNIT_SP
,
14
);
nameTextView
.
setPadding
(
0
,
Utilities
.
dp
(
2
),
0
,
0
);
messageTextView
.
setPadding
(
0
,
Utilities
.
dp
(
18
),
0
,
0
);
if
(
Utilities
.
isRTL
)
{
if
(
LocaleController
.
isRTL
)
{
params1
.
setMargins
(
Utilities
.
dp
(
40
),
0
,
height
+
Utilities
.
dp
(
6
),
0
);
}
else
{
params1
.
setMargins
(
height
+
Utilities
.
dp
(
6
),
0
,
Utilities
.
dp
(
40
),
0
);
...
...
@@ -315,7 +316,7 @@ public class NotificationView extends LinearLayout {
messageTextView
.
setTextSize
(
TypedValue
.
COMPLEX_UNIT_SP
,
15
);
nameTextView
.
setPadding
(
0
,
Utilities
.
dp
(
4
),
0
,
0
);
messageTextView
.
setPadding
(
0
,
Utilities
.
dp
(
24
),
0
,
0
);
if
(
Utilities
.
isRTL
)
{
if
(
LocaleController
.
isRTL
)
{
params1
.
setMargins
(
Utilities
.
dp
(
40
),
0
,
height
+
Utilities
.
dp
(
8
),
0
);
}
else
{
params1
.
setMargins
(
height
+
Utilities
.
dp
(
8
),
0
,
Utilities
.
dp
(
40
),
0
);
...
...
TMessagesProj/src/main/res/layout/country_select_layout.xml
View file @
0f53d75a
...
...
@@ -22,7 +22,8 @@
android:layout_gravity=
"top"
/>
<TextView
android:layout_width=
"match_parent"
<TextView
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:textColor=
"#808080"
android:gravity=
"center"
...
...
TMessagesProj/src/main/res/layout/language_select_layout.xml
0 → 100644
View file @
0f53d75a
<RelativeLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
<ListView
android:layout_width=
"fill_parent"
android:layout_height=
"fill_parent"
android:id=
"@+id/listView"
android:layout_alignParentTop=
"true"
android:layout_alignParentLeft=
"true"
android:layout_alignParentBottom=
"true"
android:clipToPadding=
"false"
android:fadingEdge=
"none"
android:fadingEdgeLength=
"0dp"
android:paddingLeft=
"13dp"
android:paddingRight=
"13dp"
android:dividerHeight=
"0dp"
android:divider=
"@null"
android:scrollbars=
"none"
/>
<TextView
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:textColor=
"#808080"
android:gravity=
"center"
android:textSize=
"24dp"
android:id=
"@+id/searchEmptyView"
android:visibility=
"invisible"
android:layout_gravity=
"top"
/>
</RelativeLayout>
\ No newline at end of file
TMessagesProj/src/main/res/values-ar/strings.xml
View file @
0f53d75a
...
...
@@ -5,7 +5,7 @@
<resources>
<string
name=
"AppName"
>
Telegram
</string>
<string
name=
"LanguangeName"
>
Arabic
</string>
<string
name=
"LanguangeName"
>
العربية
</string>
<string
name=
"LanguangeNameInEnglish"
>
Arabic
</string>
<!--signin view-->
...
...
@@ -254,7 +254,7 @@
<string
name=
"Events"
>
الأحداث
</string>
<string
name=
"ContactJoined"
>
اشترك صديق في تيليجرام
</string>
<string
name=
"Pebble"
>
PEBBLE
</string>
<string
name=
"Language"
>
Language
</string>
<string
name=
"Language"
>
اللغة
</string>
<!--media view-->
<string
name=
"NoMedia"
>
لا توجد وسائط بعد
</string>
...
...
TMessagesProj/src/main/res/values-de/strings.xml
View file @
0f53d75a
...
...
@@ -5,7 +5,7 @@
<resources>
<string
name=
"AppName"
>
Telegram
</string>
<string
name=
"LanguangeName"
>
German
</string>
<string
name=
"LanguangeName"
>
Deutsch
</string>
<string
name=
"LanguangeNameInEnglish"
>
German
</string>
<!--signin view-->
...
...
@@ -254,7 +254,7 @@
<string
name=
"Events"
>
EREIGNISSE
</string>
<string
name=
"ContactJoined"
>
Kontakt ist Telegram beigetreten
</string>
<string
name=
"Pebble"
>
PEBBLE
</string>
<string
name=
"Language"
>
Languag
e
</string>
<string
name=
"Language"
>
Sprach
e
</string>
<!--media view-->
<string
name=
"NoMedia"
>
Noch keine geteilten Medien vorhanden
</string>
...
...
TMessagesProj/src/main/res/values-es/strings.xml
View file @
0f53d75a
...
...
@@ -5,7 +5,7 @@
<resources>
<string
name=
"AppName"
>
Telegram
</string>
<string
name=
"LanguangeName"
>
Spanish
</string>
<string
name=
"LanguangeName"
>
Español
</string>
<string
name=
"LanguangeNameInEnglish"
>
Spanish
</string>
<!--signin view-->
...
...
@@ -254,7 +254,7 @@
<string
name=
"Events"
>
EVENTOS
</string>
<string
name=
"ContactJoined"
>
Un contacto se unió a Telegram
</string>
<string
name=
"Pebble"
>
PEBBLE
</string>
<string
name=
"Language"
>
Language
</string>
<string
name=
"Language"
>
Idioma
</string>
<!--media view-->
<string
name=
"NoMedia"
>
No hay fotos ni vídeos compartidos aún
</string>
...
...
TMessagesProj/src/main/res/values-it/strings.xml
View file @
0f53d75a
...
...
@@ -5,7 +5,7 @@
<resources>
<string
name=
"AppName"
>
Telegram
</string>
<string
name=
"LanguangeName"
>
Italian
</string>
<string
name=
"LanguangeName"
>
Italian
o
</string>
<string
name=
"LanguangeNameInEnglish"
>
Italian
</string>
<!--signin view-->
...
...
@@ -254,7 +254,7 @@
<string
name=
"Events"
>
EVENTI
</string>
<string
name=
"ContactJoined"
>
Un contatto si è collegato a Telegram
</string>
<string
name=
"Pebble"
>
PEBBLE
</string>
<string
name=
"Language"
>
L
anguage
</string>
<string
name=
"Language"
>
L
ingua
</string>
<!--media view-->
<string
name=
"NoMedia"
>
Nessun media condiviso
</string>
...
...
TMessagesProj/src/main/res/values-nl/strings.xml
View file @
0f53d75a
...
...
@@ -5,7 +5,7 @@
<resources>
<string
name=
"AppName"
>
Telegram
</string>
<string
name=
"LanguangeName"
>
Dutch
</string>
<string
name=
"LanguangeName"
>
Nederlands
</string>
<string
name=
"LanguangeNameInEnglish"
>
Dutch
</string>
<!--signin view-->
...
...
@@ -254,7 +254,7 @@
<string
name=
"Events"
>
GEBEURTENISSEN
</string>
<string
name=
"ContactJoined"
>
Contact lid geworden van Telegram
</string>
<string
name=
"Pebble"
>
PEBBLE
</string>
<string
name=
"Language"
>
Language
</string>
<string
name=
"Language"
>
Taal
</string>
<!--media view-->
<string
name=
"NoMedia"
>
Nog geen media gedeeld
</string>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment