Compare commits
99 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 46463f13c6 | |||
| 35c8fb2399 | |||
| 8cda23ccaf | |||
| f7831cc6a0 | |||
| 2be0a78f6f | |||
| b505d9b020 | |||
| 9320d992b5 | |||
| c9f81e447a | |||
| 9d5edba4aa | |||
| f689b2fb94 | |||
| 0c22f40bf0 | |||
| 8957823dae | |||
| 243ec39eb8 | |||
| 529435316a | |||
| f541fd668b | |||
| ec29371d3f | |||
| 1add172770 | |||
| 37f401f2cd | |||
| f88c8231eb | |||
| 04b318f753 | |||
| 2af0e1ffb6 | |||
| 806ed69432 | |||
| 491e5e0190 | |||
| 93d9d053ee | |||
| 58de8d2830 | |||
| 6d26bbd3fb | |||
| e7c432e0de | |||
| 8c00d6e09e | |||
| 310d8f79bc | |||
| 8127e3427e | |||
| 4a12b055e7 | |||
| de7c71931c | |||
| 5a6fc7761c | |||
| 7410cb21a0 | |||
| 99d4142c13 | |||
| 27de528e57 | |||
| 521360f667 | |||
| 4e003ec6f5 | |||
| 98c8a0c550 | |||
| 039eb0d924 | |||
| e7636cee4e | |||
| 4b844ebb71 | |||
| c704ed4898 | |||
| ada4ef461e | |||
| 8dd4193f4e | |||
| 704d6f0516 | |||
| 097f3e8149 | |||
| 9d8988b08b | |||
| 0dcdc2d0bf | |||
| 83ed86575e | |||
| 40e7b08238 | |||
| 0ac7648bd6 | |||
| 41f1233a27 | |||
| 0bba3d94c7 | |||
| 67c5b1a281 | |||
| dbf6c98ddb | |||
| af666374ea | |||
| 45d10ab435 | |||
| 602ad36e6f | |||
| 6fc3c38b28 | |||
| a0e2aed195 | |||
| 9aff89ea9a | |||
| 60a8ab9bcf | |||
| 0d21883546 | |||
| 9fde45d272 | |||
| 61c15ea56d | |||
| d821e43fe9 | |||
| 03e5ee1098 | |||
| 646b2f028c | |||
| 794bdeafce | |||
| bd4d3b3e11 | |||
| 58c8cecee8 | |||
| 801406ce58 | |||
| 20a93a30b3 | |||
| 38d3c6c634 | |||
| 43bf4a4616 | |||
| 059edeaf18 | |||
| e1e9462fb1 | |||
| 125e70c04b | |||
| e4fc9502fe | |||
| 72a6627059 | |||
| 73cf5105dd | |||
| c69e128e83 | |||
| fcb037122d | |||
| 7eab23aa19 | |||
| 4d839e40ca | |||
| 7a06e3ac0c | |||
| 8392c34f65 | |||
| 67b8486b99 | |||
| 308018e6e6 | |||
| 6c625d078f | |||
| a69afe11f4 | |||
| 4ff15e433b | |||
| 6c81d03c50 | |||
| 9f0b322249 | |||
| e8831b0dfc | |||
| d6e9ba2ea9 | |||
| 2c8c5a7558 | |||
| d2e76a5e61 |
@@ -1,5 +1,29 @@
|
||||
# Delta Chat Changelog
|
||||
|
||||
## v0.1.32
|
||||
2017-04-22
|
||||
|
||||
* Update Spanish and Portuguese translations
|
||||
* Update internal sqlite library to version 3.18.0, released on 2017-03-28
|
||||
* Remove more of the custom language handling, use Android's routines instead
|
||||
* General code cleanup
|
||||
* Play GIF files
|
||||
* Option to disable autoplaying GIF files
|
||||
* When sending contacts, only use the names the receivers have set themselves
|
||||
* Show some hints when long-pressing icons in the action bar
|
||||
|
||||
## v0.1.29
|
||||
2017-04-19
|
||||
|
||||
* Add Russian translation
|
||||
* For outgoing (group-)messages, only use the names the receivers have set themselves
|
||||
|
||||
## v0.1.28
|
||||
2017-04-14
|
||||
|
||||
* Pimp notifications
|
||||
* Bug fixes
|
||||
|
||||
## v0.1.27
|
||||
2017-04-12
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ tasks.withType(JavaCompile) {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile 'com.android.support:appcompat-v7:25.1.1'
|
||||
compile 'com.android.support:appcompat-v7:25.3.1'
|
||||
compile 'com.googlecode.mp4parser:isoparser:1.0.6'
|
||||
compile 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
|
||||
compile fileTree(dir: "$buildDir/native-libs", include: 'native-libs.jar')
|
||||
@@ -76,7 +76,7 @@ android {
|
||||
}
|
||||
}
|
||||
|
||||
defaultConfig.versionCode = 27
|
||||
defaultConfig.versionCode = 32
|
||||
|
||||
sourceSets.main {
|
||||
jniLibs.srcDir 'libs'
|
||||
@@ -117,6 +117,6 @@ android {
|
||||
defaultConfig {
|
||||
minSdkVersion 14 // 14: Android 4.0 Ice Cream Sandwich 2011 (Telegram default), 21: Android 5.0 Lollipop 2014 (recommended for InstantRun)
|
||||
targetSdkVersion 25 // 25: Nougat. CAVE: Do NOT target "Andoid O" without checking the background tasks carefully, see https://developer.android.com/preview/behavior-changes.html#back-all . As long as we target "Nougat", everything works as expected even for "Andoid O" or later
|
||||
versionName "0.1.27" // do NOT forget to increase defaultConfig.versionCode!
|
||||
versionName "0.1.32" // do NOT forget to increase defaultConfig.versionCode!
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,13 +122,13 @@
|
||||
#define LIBETPAN_REENTRANT 1
|
||||
|
||||
/* Define this to the version of libEtPan */
|
||||
#define LIBETPAN_VERSION "1.2-dev-20141203"
|
||||
//#define LIBETPAN_VERSION "1.2-dev-20141203"
|
||||
|
||||
/* Define this to the major version of libEtPan */
|
||||
#define LIBETPAN_VERSION_MAJOR 1
|
||||
//#define LIBETPAN_VERSION_MAJOR 1
|
||||
|
||||
/* Define this to the minor version of libEtPan */
|
||||
#define LIBETPAN_VERSION_MINOR 2
|
||||
//#define LIBETPAN_VERSION_MINOR 2
|
||||
|
||||
/* Define to the sub-directory in which libtool stores uninstalled libraries.
|
||||
*/
|
||||
@@ -144,7 +144,7 @@
|
||||
#define PACKAGE_NAME "libetpan"
|
||||
|
||||
/* Define to the full name and version of this package. */
|
||||
#define PACKAGE_STRING "libetpan 1.2"
|
||||
//#define PACKAGE_STRING "libetpan 1.2"
|
||||
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#define PACKAGE_TARNAME "libetpan"
|
||||
@@ -153,7 +153,7 @@
|
||||
#define PACKAGE_URL ""
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#define PACKAGE_VERSION "1.2"
|
||||
//#define PACKAGE_VERSION "1.2"
|
||||
|
||||
/* Define to 1 if you have the ANSI C header files. */
|
||||
#define STDC_HEADERS 1
|
||||
@@ -171,7 +171,7 @@
|
||||
#define USE_SSL 1
|
||||
|
||||
/* Version number of package */
|
||||
#define VERSION "1.2"
|
||||
//#define VERSION "1.2"
|
||||
|
||||
/* Define to `__inline__' or `__inline' if that's what the C compiler
|
||||
calls it, or to nothing if 'inline' is not supported under any name. */
|
||||
|
||||
@@ -697,7 +697,7 @@ JNIEXPORT jint Java_com_b44t_messenger_MrChat_sendMedia(JNIEnv *env, jclass cls,
|
||||
CHAR_REF(file);
|
||||
mrparam_set(msg->m_param, 'f', filePtr);
|
||||
CHAR_UNREF(file);
|
||||
if( type == MR_MSG_IMAGE || type == MR_MSG_VIDEO ) {
|
||||
if( type == MR_MSG_IMAGE || type == MR_MSG_GIF || type == MR_MSG_VIDEO ) {
|
||||
mrparam_set_int(msg->m_param, 'w', w);
|
||||
mrparam_set_int(msg->m_param, 'h', h);
|
||||
}
|
||||
@@ -924,6 +924,20 @@ JNIEXPORT jint Java_com_b44t_messenger_MrMsg_isIncreation(JNIEnv *env, jobject o
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
static mrcontact_t* get_mrcontact_t(JNIEnv *env, jobject obj)
|
||||
{
|
||||
static jfieldID fid = 0;
|
||||
if( fid == 0 ) {
|
||||
jclass cls = (*env)->GetObjectClass(env, obj);
|
||||
fid = (*env)->GetFieldID(env, cls, "m_hContact", "J" /*Signature, J=long*/);
|
||||
}
|
||||
if( fid ) {
|
||||
return (mrcontact_t*)(*env)->GetLongField(env, obj, fid);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT void Java_com_b44t_messenger_MrContact_MrContactUnref(JNIEnv *env, jclass c, jlong hContact)
|
||||
{
|
||||
mrcontact_unref((mrcontact_t*)hContact);
|
||||
@@ -937,6 +951,13 @@ JNIEXPORT jstring Java_com_b44t_messenger_MrContact_MrContactGetName(JNIEnv *env
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT jstring Java_com_b44t_messenger_MrContact_getAuthName(JNIEnv *env, jclass cls)
|
||||
{
|
||||
mrcontact_t* ths = get_mrcontact_t(env, cls); if( ths == NULL ) { return JSTRING_NEW(NULL); }
|
||||
return JSTRING_NEW(ths->m_authname);
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT jstring Java_com_b44t_messenger_MrContact_MrContactGetAddr(JNIEnv *env, jclass c, jlong hContact)
|
||||
{
|
||||
mrcontact_t* ths = (mrcontact_t*)hContact; if( ths == NULL ) { return JSTRING_NEW(NULL); }
|
||||
|
||||
@@ -46,7 +46,6 @@
|
||||
<application
|
||||
android:name=".ApplicationLoader"
|
||||
android:allowBackup="false"
|
||||
android:hardwareAccelerated="@bool/useHardwareAcceleration"
|
||||
android:icon="@drawable/ic_launcher"
|
||||
android:label="@string/AppName"
|
||||
android:largeHeap="true"
|
||||
@@ -56,7 +55,6 @@
|
||||
<activity
|
||||
android:name="com.b44t.ui.LaunchActivity"
|
||||
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
|
||||
android:hardwareAccelerated="@bool/useHardwareAcceleration"
|
||||
android:launchMode="singleTask"
|
||||
android:windowSoftInputMode="adjustPan">
|
||||
<intent-filter>
|
||||
@@ -110,7 +108,6 @@
|
||||
<activity
|
||||
android:name="com.b44t.ui.ManageSpaceActivity"
|
||||
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
|
||||
android:hardwareAccelerated="@bool/useHardwareAcceleration"
|
||||
android:launchMode="singleTask"
|
||||
android:windowSoftInputMode="adjustPan">
|
||||
</activity>
|
||||
|
||||
@@ -330,15 +330,21 @@ public class AndroidUtilities {
|
||||
}
|
||||
|
||||
public static boolean isTablet() {
|
||||
/* -- we do not make any special for tablet or not. _If_ sth. like this is desired, check for an appropriate screen size.
|
||||
if (isTablet == null) {
|
||||
isTablet = ApplicationLoader.applicationContext.getResources().getBoolean(R.bool.isTablet);
|
||||
}
|
||||
return isTablet;
|
||||
*/
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isSmallTablet() {
|
||||
/*
|
||||
float minSide = Math.min(displaySize.x, displaySize.y) / density;
|
||||
return minSide <= 700;
|
||||
*/
|
||||
return false;
|
||||
}
|
||||
|
||||
public static int getMinTabletSide() {
|
||||
@@ -884,7 +890,7 @@ public class AndroidUtilities {
|
||||
try {
|
||||
File file = new File(path);
|
||||
if( !file.exists() ) {
|
||||
showHint(activity, LocaleController.formatString("FileNotFound", R.string.FileNotFound, path));
|
||||
showHint(activity, String.format(ApplicationLoader.applicationContext.getString(R.string.FileNotFound), path));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -911,7 +917,7 @@ public class AndroidUtilities {
|
||||
|
||||
}
|
||||
catch (Exception e) {
|
||||
showHint(activity, LocaleController.formatString("NoHandleAppInstalled", R.string.NoHandleAppInstalled, mimeType));
|
||||
showHint(activity, String.format(ApplicationLoader.applicationContext.getString(R.string.NoHandleAppInstalled), mimeType));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -951,11 +957,11 @@ public class AndroidUtilities {
|
||||
final String msg_file_name = msg.getFilename();
|
||||
final File sourceFile = new File(msg_file_path);
|
||||
if( !sourceFile.exists() ) {
|
||||
showHint(context, LocaleController.formatString("FileNotFound", R.string.FileNotFound, msg_file_path));
|
||||
showHint(context, String.format(context.getString(R.string.FileNotFound), msg_file_path));
|
||||
return;
|
||||
}
|
||||
|
||||
final Toast waitingHint = showHint(context, ApplicationLoader.applicationContext.getString(R.string.OneMoment));
|
||||
final Toast waitingHint = showHint(context, context.getString(R.string.OneMoment));
|
||||
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
@@ -966,7 +972,7 @@ public class AndroidUtilities {
|
||||
// get destination path
|
||||
File destPath = null;
|
||||
boolean add_to_download_manager = false;
|
||||
if (msg_type == MrMsg.MR_MSG_IMAGE || msg_type == MrMsg.MR_MSG_VIDEO) {
|
||||
if (msg_type == MrMsg.MR_MSG_IMAGE || msg_type == MrMsg.MR_MSG_GIF || msg_type == MrMsg.MR_MSG_VIDEO) {
|
||||
destPath = AndroidUtilities.getAlbumDir();
|
||||
} else if (msg_type == MrMsg.MR_MSG_FILE) {
|
||||
destPath = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS);
|
||||
|
||||
@@ -177,7 +177,7 @@ public class ApplicationLoader extends Application {
|
||||
|
||||
// init locale
|
||||
try {
|
||||
LocaleController.getInstance();
|
||||
LocaleController.getInstance(); // this call does _not_ do nothing; in fact, it creates eg. the formatters while creating the static object.
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -231,9 +231,13 @@ public class ApplicationLoader extends Application {
|
||||
|
||||
@Override
|
||||
public void onConfigurationChanged(Configuration newConfig) {
|
||||
// this function is needed to react to changed system configuration, eg. locale or display size
|
||||
super.onConfigurationChanged(newConfig);
|
||||
try {
|
||||
// change some locale stuff that is not updated automatically, see comments in onDeviceConfigurationChange() and rebuildUiParts()
|
||||
LocaleController.getInstance().onDeviceConfigurationChange(newConfig);
|
||||
|
||||
// re-calculate some things regarding the display (the size may have changed)
|
||||
AndroidUtilities.checkDisplaySize();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
||||
@@ -122,40 +122,6 @@ public class ContactsController {
|
||||
return true;
|
||||
}
|
||||
|
||||
public static String formatName(String firstName, String lastName) {
|
||||
|
||||
if (firstName != null) {
|
||||
firstName = firstName.trim();
|
||||
}
|
||||
if (lastName != null) {
|
||||
lastName = lastName.trim();
|
||||
}
|
||||
StringBuilder result = new StringBuilder((firstName != null ? firstName.length() : 0) + (lastName != null ? lastName.length() : 0) + 1);
|
||||
if (LocaleController.nameDisplayOrder == 1) {
|
||||
if (firstName != null && firstName.length() > 0) {
|
||||
result.append(firstName);
|
||||
if (lastName != null && lastName.length() > 0) {
|
||||
result.append(" ");
|
||||
result.append(lastName);
|
||||
}
|
||||
} else if (lastName != null && lastName.length() > 0) {
|
||||
result.append(lastName);
|
||||
}
|
||||
} else {
|
||||
if (lastName != null && lastName.length() > 0) {
|
||||
result.append(lastName);
|
||||
if (firstName != null && firstName.length() > 0) {
|
||||
result.append(" ");
|
||||
result.append(firstName);
|
||||
}
|
||||
} else if (firstName != null && firstName.length() > 0) {
|
||||
result.append(firstName);
|
||||
}
|
||||
}
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
|
||||
/* Handle contact images
|
||||
**********************************************************************************************/
|
||||
|
||||
|
||||
@@ -37,7 +37,6 @@ import android.media.ThumbnailUtils;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.provider.MediaStore;
|
||||
import android.util.Log;
|
||||
|
||||
import com.b44t.ui.Components.AnimatedFileDrawable;
|
||||
|
||||
@@ -51,7 +50,6 @@ import java.nio.ByteBuffer;
|
||||
import java.nio.channels.FileChannel;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
public class ImageLoader {
|
||||
|
||||
|
||||
@@ -140,7 +140,7 @@ public class ImageReceiver implements NotificationCenter.NotificationCenterDeleg
|
||||
setImage(path, null, filter, thumb, null, null, size, ext, cacheOnly);
|
||||
}
|
||||
|
||||
public void setImage(String httpUrl, String filter, Drawable thumb, String ext, int size) {
|
||||
public void setImageByPath(String httpUrl, String filter, Drawable thumb, String ext, int size) {
|
||||
setImage(null, httpUrl, filter, thumb, null, null, size, ext, true);
|
||||
}
|
||||
|
||||
|
||||
@@ -89,7 +89,7 @@ public class KeepAliveService extends Service {
|
||||
NotificationCompat.Builder builder = new NotificationCompat.Builder(this);
|
||||
|
||||
if( MrMailbox.isConfigured()!=0) {
|
||||
builder.setContentTitle(LocaleController.formatString("", R.string.PermNotificationTitle, MrMailbox.getConfig("addr", "")));
|
||||
builder.setContentTitle(String.format(getString(R.string.PermNotificationTitle), MrMailbox.getConfig("addr", "")));
|
||||
builder.setContentText(getString(R.string.PermNotificationText));
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -23,28 +23,25 @@
|
||||
|
||||
package com.b44t.messenger;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.Configuration;
|
||||
import android.os.Build;
|
||||
import android.text.format.DateFormat;
|
||||
import android.view.View;
|
||||
|
||||
import com.b44t.messenger.time.FastDateFormat;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.TimeZone;
|
||||
|
||||
public class LocaleController {
|
||||
|
||||
public static boolean isRTL = false;
|
||||
public static int nameDisplayOrder = 1;
|
||||
private static boolean is24HourFormat = false;
|
||||
public FastDateFormat formatterDay;
|
||||
public FastDateFormat formatterWeek;
|
||||
public FastDateFormat formatterMonth;
|
||||
@@ -53,11 +50,7 @@ public class LocaleController {
|
||||
public FastDateFormat chatDate;
|
||||
public FastDateFormat chatFullDate;
|
||||
|
||||
private Locale currentLocale;
|
||||
private Locale systemDefaultLocale; // this is not Locale.getDefault(); Locale.getDefault() may be changed using Locale.setDefault()
|
||||
private LocaleInfo currentLocaleInfo;
|
||||
private String languageOverride;
|
||||
private boolean changingConfiguration = false;
|
||||
private String formattersCreatedFor = "";
|
||||
|
||||
private class TimeZoneChangedReceiver extends BroadcastReceiver {
|
||||
@Override
|
||||
@@ -73,14 +66,6 @@ public class LocaleController {
|
||||
}
|
||||
}
|
||||
|
||||
public static class LocaleInfo {
|
||||
public String name;
|
||||
public String nameEnglish;
|
||||
public String shortName;
|
||||
}
|
||||
|
||||
public HashMap<String, LocaleInfo> languagesDict = new HashMap<>();
|
||||
|
||||
private static volatile LocaleController Instance = null;
|
||||
public static LocaleController getInstance() {
|
||||
LocaleController localInstance = Instance;
|
||||
@@ -96,94 +81,8 @@ public class LocaleController {
|
||||
}
|
||||
|
||||
public LocaleController() {
|
||||
LocaleInfo localeInfo = new LocaleInfo();
|
||||
localeInfo.name = "English";
|
||||
localeInfo.nameEnglish = "English";
|
||||
localeInfo.shortName = "en";
|
||||
languagesDict.put(localeInfo.shortName, localeInfo);
|
||||
|
||||
localeInfo = new LocaleInfo();
|
||||
localeInfo.name = "Italiano";
|
||||
localeInfo.nameEnglish = "Italian";
|
||||
localeInfo.shortName = "it";
|
||||
languagesDict.put(localeInfo.shortName, localeInfo);
|
||||
|
||||
localeInfo = new LocaleInfo();
|
||||
localeInfo.name = "Español";
|
||||
localeInfo.nameEnglish = "Spanish";
|
||||
localeInfo.shortName = "es";
|
||||
languagesDict.put(localeInfo.shortName, localeInfo);
|
||||
|
||||
localeInfo = new LocaleInfo();
|
||||
localeInfo.name = "Deutsch";
|
||||
localeInfo.nameEnglish = "German";
|
||||
localeInfo.shortName = "de";
|
||||
languagesDict.put(localeInfo.shortName, localeInfo);
|
||||
|
||||
localeInfo = new LocaleInfo();
|
||||
localeInfo.name = "Français";
|
||||
localeInfo.nameEnglish = "French";
|
||||
localeInfo.shortName = "fr";
|
||||
languagesDict.put(localeInfo.shortName, localeInfo);
|
||||
|
||||
localeInfo = new LocaleInfo();
|
||||
localeInfo.name = "Nederlands";
|
||||
localeInfo.nameEnglish = "Dutch";
|
||||
localeInfo.shortName = "nl";
|
||||
languagesDict.put(localeInfo.shortName, localeInfo);
|
||||
|
||||
localeInfo = new LocaleInfo();
|
||||
localeInfo.name = "Polski";
|
||||
localeInfo.nameEnglish = "Polish";
|
||||
localeInfo.shortName = "pl";
|
||||
languagesDict.put(localeInfo.shortName, localeInfo);
|
||||
|
||||
localeInfo = new LocaleInfo();
|
||||
localeInfo.name = "Português";
|
||||
localeInfo.nameEnglish = "Portuguese";
|
||||
localeInfo.shortName = "pt";
|
||||
languagesDict.put(localeInfo.shortName, localeInfo);
|
||||
|
||||
localeInfo = new LocaleInfo();
|
||||
localeInfo.name = "한국어";
|
||||
localeInfo.nameEnglish = "Korean";
|
||||
localeInfo.shortName = "ko";
|
||||
languagesDict.put(localeInfo.shortName, localeInfo);
|
||||
|
||||
localeInfo = new LocaleInfo();
|
||||
localeInfo.name = "Magyar";
|
||||
localeInfo.nameEnglish = "Hungarian";
|
||||
localeInfo.shortName = "hu";
|
||||
languagesDict.put(localeInfo.shortName, localeInfo);
|
||||
|
||||
systemDefaultLocale = Locale.getDefault(); // we have to remember this as we may switch back to default later
|
||||
is24HourFormat = DateFormat.is24HourFormat(ApplicationLoader.applicationContext);
|
||||
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(getLocaleString(systemDefaultLocale));
|
||||
}
|
||||
if (currentInfo == null) {
|
||||
currentInfo = languagesDict.get("en");
|
||||
}
|
||||
applyLanguage(currentInfo, override);
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
recreateFormatters();
|
||||
|
||||
try {
|
||||
IntentFilter timezoneFilter = new IntentFilter(Intent.ACTION_TIMEZONE_CHANGED);
|
||||
@@ -193,156 +92,26 @@ public class LocaleController {
|
||||
}
|
||||
}
|
||||
|
||||
private String getLocaleString(Locale locale) {
|
||||
if (locale == null) {
|
||||
return "en";
|
||||
}
|
||||
String languageCode = locale.getLanguage();
|
||||
String countryCode = locale.getCountry();
|
||||
String variantCode = locale.getVariant();
|
||||
if (languageCode.length() == 0 && countryCode.length() == 0) {
|
||||
return "en";
|
||||
}
|
||||
StringBuilder result = new StringBuilder(11);
|
||||
result.append(languageCode);
|
||||
if (countryCode.length() > 0 || variantCode.length() > 0) {
|
||||
result.append('_');
|
||||
}
|
||||
result.append(countryCode);
|
||||
if (variantCode.length() > 0) {
|
||||
result.append('_');
|
||||
}
|
||||
result.append(variantCode);
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
public void applyLanguage(LocaleInfo localeInfo, boolean override) {
|
||||
if (localeInfo == null) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
Locale newLocale;
|
||||
if (localeInfo.shortName != null) {
|
||||
String[] args = localeInfo.shortName.split("_");
|
||||
if (args.length == 1) {
|
||||
newLocale = new Locale(localeInfo.shortName);
|
||||
} else {
|
||||
newLocale = new Locale(args[0], args[1]);
|
||||
}
|
||||
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.apply();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
newLocale = systemDefaultLocale; // this is not Locale.getDefault(); Locale.getDefault() may be changed using Locale.setDefault()
|
||||
languageOverride = null;
|
||||
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", Activity.MODE_PRIVATE);
|
||||
SharedPreferences.Editor editor = preferences.edit();
|
||||
editor.remove("language");
|
||||
editor.apply();
|
||||
|
||||
if (newLocale != null) {
|
||||
LocaleInfo info = null;
|
||||
if (newLocale.getLanguage() != null) {
|
||||
info = languagesDict.get(newLocale.getLanguage());
|
||||
}
|
||||
if (info == null) {
|
||||
info = languagesDict.get(getLocaleString(newLocale));
|
||||
}
|
||||
if (info == null) {
|
||||
newLocale = Locale.US;
|
||||
}
|
||||
}
|
||||
}
|
||||
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) {
|
||||
|
||||
changingConfiguration = false;
|
||||
}
|
||||
recreateFormatters();
|
||||
}
|
||||
|
||||
public static String getCurrentLanguageName() {
|
||||
return getString("LanguageName", R.string.LanguageName);
|
||||
}
|
||||
|
||||
private String getStringInternal(String key, int res) {
|
||||
String value = null;
|
||||
try {
|
||||
value = ApplicationLoader.applicationContext.getString(res);
|
||||
} catch (Exception e) { }
|
||||
if (value == null) {
|
||||
value = "LOC_ERR:" + key;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
public static String getString(String key, int res) {
|
||||
return getInstance().getStringInternal(key, res);
|
||||
}
|
||||
|
||||
public static String formatString(String key, int res, Object... args) {
|
||||
try {
|
||||
String value = ApplicationLoader.applicationContext.getString(res);
|
||||
if (getInstance().currentLocale != null) {
|
||||
return String.format(getInstance().currentLocale, value, args);
|
||||
} else {
|
||||
return String.format(value, args);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
return "LOC_ERR: " + key;
|
||||
}
|
||||
}
|
||||
|
||||
public static String formatStringSimple(String string, Object... args) {
|
||||
try {
|
||||
if (getInstance().currentLocale != null) {
|
||||
return String.format(getInstance().currentLocale, string, args);
|
||||
} else {
|
||||
return String.format(string, args);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
return "LOC_ERR: " + string;
|
||||
public void rebuildUiParts()
|
||||
{
|
||||
// While android makes sure, the activities are re-translated on locale changes, this is
|
||||
// not done for the permanent notification "Connected to foo@bar - Waiting for messages ..."
|
||||
// To re-translate this, it is needed to update the notification (which is a good idea as the
|
||||
// notification is really permanent and would stuck in the wrong language for weeks otherwise ...)
|
||||
KeepAliveService kas = KeepAliveService.getInstance();
|
||||
if( kas != null ) {
|
||||
kas.updateForegroundNotification();
|
||||
}
|
||||
}
|
||||
|
||||
public void onDeviceConfigurationChange(Configuration newConfig) {
|
||||
if (changingConfiguration) {
|
||||
return;
|
||||
}
|
||||
is24HourFormat = DateFormat.is24HourFormat(ApplicationLoader.applicationContext);
|
||||
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;
|
||||
}
|
||||
// rebuild some UI parts after a language change:
|
||||
// - the permanent notification (Waiting for messages ...) - notfifications are not re-translated after a locale change. This cannot be done without listening to the language-change-envent.
|
||||
// - some formatters and other cached values, maybe this can be done in other ways, however, it's just working.
|
||||
Locale newLocale = Locale.getDefault();
|
||||
if( newLocale!=null && !newLocale.getDisplayName().equals(formattersCreatedFor) ) { // onDeviceConfigurationChange() is also called on screen orientation changes; do not rebuild the locale stuff in these cases
|
||||
recreateFormatters();
|
||||
rebuildUiParts(); // this is really needed, see comment in rebuildUiParts()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -378,25 +147,29 @@ public class LocaleController {
|
||||
return formatter;
|
||||
}
|
||||
|
||||
public void recreateFormatters() {
|
||||
Locale locale = currentLocale;
|
||||
if (locale == null) {
|
||||
locale = Locale.getDefault();
|
||||
}
|
||||
String lang = locale.getLanguage();
|
||||
if (lang == null) {
|
||||
lang = "en";
|
||||
}
|
||||
isRTL = lang.toLowerCase().equals("ar");
|
||||
nameDisplayOrder = lang.toLowerCase().equals("ko") ? 2 : 1;
|
||||
private void recreateFormatters() {
|
||||
Locale locale = Locale.getDefault();
|
||||
|
||||
formatterMonth = createFormatter(locale, getStringInternal("formatterMonth", R.string.formatterMonth), "dd MMM");
|
||||
formatterYear = createFormatter(locale, getStringInternal("formatterYear", R.string.formatterYear), "dd.MM.yyyy");
|
||||
chatDate = createFormatter(locale, getStringInternal("chatDate", R.string.chatDate), "d MMMM");
|
||||
chatFullDate = createFormatter(locale, getStringInternal("chatFullDate", R.string.chatFullDate), "d MMMM yyyy");
|
||||
formatterWeek = createFormatter(locale, getStringInternal("formatterWeek", R.string.formatterWeek), "EEE");
|
||||
formatterMonthYear = createFormatter(locale, getStringInternal("formatterMonthYear", R.string.formatterMonthYear), "MMMM yyyy");
|
||||
formatterDay = createFormatter(lang.toLowerCase().equals("ar") || lang.toLowerCase().equals("ko") ? locale : Locale.US, is24HourFormat ? getStringInternal("formatterDay24H", R.string.formatterDay24H) : getStringInternal("formatterDay12H", R.string.formatterDay12H), is24HourFormat ? "HH:mm" : "h:mm a");
|
||||
isRTL = false;
|
||||
if (Build.VERSION.SDK_INT >= 17) {
|
||||
// ViewCompat.getLayoutDirection() can also be used, however, this function always returns LTR for SDK < 17, too, but requires a additinal view handle
|
||||
Configuration config = ApplicationLoader.applicationContext.getResources().getConfiguration();
|
||||
if(config.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL) {
|
||||
isRTL = true;
|
||||
}
|
||||
}
|
||||
|
||||
boolean is24HourFormat = DateFormat.is24HourFormat(ApplicationLoader.applicationContext);
|
||||
|
||||
formatterMonth = createFormatter(locale, ApplicationLoader.applicationContext.getString(R.string.formatterMonth), "dd MMM");
|
||||
formatterYear = createFormatter(locale, ApplicationLoader.applicationContext.getString(R.string.formatterYear), "dd.MM.yyyy");
|
||||
chatDate = createFormatter(locale, ApplicationLoader.applicationContext.getString(R.string.chatDate), "d MMMM");
|
||||
chatFullDate = createFormatter(locale, ApplicationLoader.applicationContext.getString(R.string.chatFullDate), "d MMMM yyyy");
|
||||
formatterWeek = createFormatter(locale, ApplicationLoader.applicationContext.getString(R.string.formatterWeek), "EEE");
|
||||
formatterMonthYear = createFormatter(locale, ApplicationLoader.applicationContext.getString(R.string.formatterMonthYear), "MMMM yyyy");
|
||||
formatterDay = createFormatter(locale, is24HourFormat ? ApplicationLoader.applicationContext.getString(R.string.formatterDay24H) : ApplicationLoader.applicationContext.getString(R.string.formatterDay12H), is24HourFormat ? "HH:mm" : "h:mm a");
|
||||
|
||||
formattersCreatedFor = locale.getDisplayName();
|
||||
}
|
||||
|
||||
public static String stringForMessageListDate(long date) {
|
||||
|
||||
@@ -266,7 +266,7 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
|
||||
public int wifiDownloadMask = 0;
|
||||
public int roamingDownloadMask = 0;
|
||||
|
||||
private final boolean autoplayGifs = true;
|
||||
private boolean autoplayGifs = true;
|
||||
private boolean raiseToSpeak = true;
|
||||
private boolean directShare = true;
|
||||
|
||||
@@ -527,7 +527,7 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
|
||||
mobileDataDownloadMask = preferences.getInt("mobileDataDownloadMask", AUTODOWNLOAD_MASK_PHOTO | AUTODOWNLOAD_MASK_AUDIO | AUTODOWNLOAD_MASK_MUSIC | AUTODOWNLOAD_MASK_GIF);
|
||||
wifiDownloadMask = preferences.getInt("wifiDownloadMask", AUTODOWNLOAD_MASK_PHOTO | AUTODOWNLOAD_MASK_AUDIO | AUTODOWNLOAD_MASK_MUSIC | AUTODOWNLOAD_MASK_GIF);
|
||||
roamingDownloadMask = preferences.getInt("roamingDownloadMask", 0);
|
||||
//autoplayGifs = preferences.getBoolean("autoplay_gif", true);
|
||||
autoplayGifs = preferences.getBoolean("autoplay_gif", true);
|
||||
raiseToSpeak = preferences.getBoolean("raise_to_speak", true);
|
||||
directShare = preferences.getBoolean("direct_share", true);
|
||||
|
||||
@@ -2014,7 +2014,6 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
public void toggleAutoplayGifs() {
|
||||
autoplayGifs = !autoplayGifs;
|
||||
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", Activity.MODE_PRIVATE);
|
||||
@@ -2022,7 +2021,6 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
|
||||
editor.putBoolean("autoplay_gif", autoplayGifs);
|
||||
editor.apply();
|
||||
}
|
||||
*/
|
||||
|
||||
public void toogleRaiseToSpeak() {
|
||||
raiseToSpeak = !raiseToSpeak;
|
||||
@@ -2091,7 +2089,7 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
|
||||
PhotoEntry photoEntry = new PhotoEntry(bucketId, imageId, dateTaken, path, orientation, false);
|
||||
|
||||
if (allPhotosAlbum == null) {
|
||||
allPhotosAlbum = new AlbumEntry(0, LocaleController.getString("AllPhotos", R.string.AllPhotos), photoEntry, false);
|
||||
allPhotosAlbum = new AlbumEntry(0, ApplicationLoader.applicationContext.getString(R.string.AllPhotos), photoEntry, false);
|
||||
albumsSorted.add(0, allPhotosAlbum);
|
||||
}
|
||||
if (allPhotosAlbum != null) {
|
||||
@@ -2152,7 +2150,7 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
|
||||
PhotoEntry photoEntry = new PhotoEntry(bucketId, imageId, dateTaken, path, 0, true);
|
||||
|
||||
if (allVideosAlbum == null) {
|
||||
allVideosAlbum = new AlbumEntry(0, LocaleController.getString("AllVideo", R.string.AllVideo), photoEntry, true);
|
||||
allVideosAlbum = new AlbumEntry(0, ApplicationLoader.applicationContext.getString(R.string.AllVideo), photoEntry, true);
|
||||
videoAlbumsSorted.add(0, allVideosAlbum);
|
||||
}
|
||||
if (allVideosAlbum != null) {
|
||||
|
||||
@@ -161,18 +161,7 @@ public class MessageObject {
|
||||
}
|
||||
|
||||
public static boolean isGifDocument(TLRPC.Document document) {
|
||||
return document != null && document.thumb != null && document.mime_type != null && (document.mime_type.equals("image/gif") || isNewGifDocument(document));
|
||||
}
|
||||
|
||||
public static boolean isNewGifDocument(TLRPC.Document document) {
|
||||
if (document != null && document.mime_type != null && document.mime_type.equals("video/mp4")) {
|
||||
for (int a = 0; a < document.attributes.size(); a++) {
|
||||
if (document.attributes.get(a) instanceof TLRPC.TL_documentAttributeAnimated) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
return document != null && document.thumb != null && document.mime_type != null && document.mime_type.equals("image/gif");
|
||||
}
|
||||
|
||||
private void generateThumbs(boolean update) {
|
||||
@@ -720,10 +709,6 @@ public class MessageObject {
|
||||
return messageOwner.media instanceof TLRPC.TL_messageMediaDocument && isGifDocument(messageOwner.media.document);
|
||||
}
|
||||
|
||||
public boolean isNewGif() {
|
||||
return messageOwner.media != null && isNewGifDocument(messageOwner.media.document);
|
||||
}
|
||||
|
||||
public int getDuration() {
|
||||
TLRPC.Document document;
|
||||
document = messageOwner.media.document;
|
||||
|
||||
@@ -45,6 +45,7 @@ public class MrContact {
|
||||
public String getName() {
|
||||
return MrContactGetName(m_hContact);
|
||||
}
|
||||
public native String getAuthName();
|
||||
|
||||
public String getAddr() {
|
||||
return MrContactGetAddr(m_hContact);
|
||||
|
||||
@@ -326,6 +326,7 @@ public class MrMailbox {
|
||||
case 20: s = ApplicationLoader.applicationContext.getString(R.string.Error); break;
|
||||
case 21: s = ApplicationLoader.applicationContext.getString(R.string.ErrSelfNotInGroup); break;
|
||||
case 22: s = ApplicationLoader.applicationContext.getString(R.string.NoNetwork); break;
|
||||
case 23: s = ApplicationLoader.applicationContext.getString(R.string.AttachGif); break;
|
||||
}
|
||||
return String2CPtr(s);
|
||||
|
||||
@@ -418,7 +419,7 @@ public class MrMailbox {
|
||||
public static String getInviteText() {
|
||||
String url = "https://getdelta.org";
|
||||
String email = getConfig("addr", "");
|
||||
String text = LocaleController.formatString("InviteText", R.string.InviteText, url, email);
|
||||
String text = String.format(ApplicationLoader.applicationContext.getString(R.string.InviteText), url, email);
|
||||
return text;
|
||||
}
|
||||
|
||||
|
||||
@@ -41,6 +41,7 @@ public class MrMsg {
|
||||
public final static int MR_MSG_UNDEFINED = 0;
|
||||
public final static int MR_MSG_TEXT = 10;
|
||||
public final static int MR_MSG_IMAGE = 20;
|
||||
public final static int MR_MSG_GIF = 21;
|
||||
public final static int MR_MSG_AUDIO = 40;
|
||||
public final static int MR_MSG_VOICE = 41;
|
||||
public final static int MR_MSG_VIDEO = 50;
|
||||
@@ -195,7 +196,7 @@ public class MrMsg {
|
||||
ret.message = "<cannot load image>";
|
||||
}
|
||||
}
|
||||
else if( type == MR_MSG_AUDIO || type == MR_MSG_VOICE || type == MR_MSG_VIDEO || type == MR_MSG_FILE ) {
|
||||
else if( type == MR_MSG_GIF || type == MR_MSG_AUDIO || type == MR_MSG_VOICE || type == MR_MSG_VIDEO || type == MR_MSG_FILE ) {
|
||||
String path = getParam('f', "");
|
||||
if( !path.isEmpty()) {
|
||||
ret.message = "-1"; // may be misused for video editing information
|
||||
@@ -205,7 +206,18 @@ public class MrMsg {
|
||||
ret.media.document.file_name = getFilename();
|
||||
ret.media.document.mr_path = path;
|
||||
ret.media.document.size = getBytes();
|
||||
if( type == MR_MSG_AUDIO || type == MR_MSG_VOICE ) {
|
||||
if( type == MR_MSG_GIF ) {
|
||||
ret.media.document.mime_type = getParam('m', "image/gif");
|
||||
TLRPC.PhotoSize size = new TLRPC.PhotoSize();
|
||||
size.location = new TLRPC.TL_fileLocation();
|
||||
size.location.mr_path = path;
|
||||
size.location.local_id = -ret.id;
|
||||
size.w = getParamInt('w', 320);
|
||||
size.h = getParamInt('h', 240);
|
||||
size.type = "s";
|
||||
ret.media.document.thumb = size;
|
||||
}
|
||||
else if( type == MR_MSG_AUDIO || type == MR_MSG_VOICE ) {
|
||||
TLRPC.TL_documentAttributeAudio attr = new TLRPC.TL_documentAttributeAudio();
|
||||
attr.voice = type == MR_MSG_VOICE;
|
||||
attr.duration = getParamInt('d', 0) / 1000;
|
||||
|
||||
@@ -90,6 +90,8 @@ public class NotificationsController {
|
||||
protected AudioManager audioManager;
|
||||
private AlarmManager alarmManager;
|
||||
|
||||
public static final int DEF_LED_COLOR = 0xffffffff;
|
||||
|
||||
private static volatile NotificationsController Instance = null;
|
||||
public static NotificationsController getInstance() {
|
||||
NotificationsController localInstance = Instance;
|
||||
@@ -992,7 +994,7 @@ public class NotificationsController {
|
||||
boolean notifyDisabled = false;
|
||||
int needVibrate = 0;
|
||||
String choosenSoundPath = null;
|
||||
int ledColor = 0xff00ff00;
|
||||
int ledColor = DEF_LED_COLOR;
|
||||
boolean inAppSounds;
|
||||
boolean inAppVibrate;
|
||||
//boolean inAppPreview = false;
|
||||
@@ -1046,7 +1048,7 @@ public class NotificationsController {
|
||||
}
|
||||
needVibrate = preferences.getInt("vibrate_group", 0);
|
||||
priority = preferences.getInt("priority_group", 1);
|
||||
ledColor = preferences.getInt("GroupLed", 0xff00ff00);
|
||||
ledColor = preferences.getInt("GroupLed", DEF_LED_COLOR);
|
||||
} else {
|
||||
if (choosenSoundPath != null && choosenSoundPath.equals(defaultPath)) {
|
||||
choosenSoundPath = null;
|
||||
@@ -1055,10 +1057,10 @@ public class NotificationsController {
|
||||
}
|
||||
needVibrate = preferences.getInt("vibrate_messages", 0);
|
||||
priority = preferences.getInt("priority_messages", 1);
|
||||
ledColor = preferences.getInt("MessagesLed", 0xff00ff00);
|
||||
ledColor = preferences.getInt("MessagesLed", DEF_LED_COLOR);
|
||||
}
|
||||
if (preferences.contains("color_" + dialog_id)) {
|
||||
ledColor = preferences.getInt("color_" + dialog_id, 0);
|
||||
ledColor = preferences.getInt("color_" + dialog_id, 0/*0=off*/);
|
||||
}
|
||||
|
||||
if (priorityOverride != 3) {
|
||||
|
||||
@@ -100,7 +100,7 @@ public class SendMessagesHelper implements NotificationCenter.NotificationCenter
|
||||
|
||||
public void sendMessageContact(int contact_id, int dialog_id) {
|
||||
MrContact contact = MrMailbox.getContact(contact_id);
|
||||
String msg = contact.getName();
|
||||
String msg = contact.getAuthName();
|
||||
if(msg.isEmpty()) {
|
||||
msg = contact.getAddr();
|
||||
}
|
||||
@@ -540,7 +540,7 @@ public class SendMessagesHelper implements NotificationCenter.NotificationCenter
|
||||
String originalPath = path;
|
||||
String tempPath = path;
|
||||
if (tempPath == null && uri != null) {
|
||||
tempPath = AndroidUtilities.getPath(uri);
|
||||
tempPath = AndroidUtilities.getPath(uri); // convert uri to path, this may fail
|
||||
originalPath = uri.toString();
|
||||
}
|
||||
|
||||
@@ -553,6 +553,7 @@ public class SendMessagesHelper implements NotificationCenter.NotificationCenter
|
||||
}
|
||||
isDocument = true;
|
||||
} else if (tempPath == null && uri != null) {
|
||||
// if conversion from uri to path fails above, we have a look at the content of the file
|
||||
if (MediaController.isGif(uri)) {
|
||||
isDocument = true;
|
||||
originalPath = uri.toString();
|
||||
|
||||
@@ -1391,10 +1391,8 @@ public class ItemTouchHelper extends RecyclerView.ItemDecoration
|
||||
static {
|
||||
if (Build.VERSION.SDK_INT >= 21) {
|
||||
sUICallback = new ItemTouchUIUtilImpl.Lollipop();
|
||||
} else if (Build.VERSION.SDK_INT >= 11) {
|
||||
sUICallback = new ItemTouchUIUtilImpl.Honeycomb();
|
||||
} else {
|
||||
sUICallback = new ItemTouchUIUtilImpl.Gingerbread();
|
||||
sUICallback = new ItemTouchUIUtilImpl.Honeycomb();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -30,6 +30,8 @@ import android.view.View;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import com.b44t.messenger.AndroidUtilities;
|
||||
import com.b44t.messenger.ApplicationLoader;
|
||||
import com.b44t.messenger.R;
|
||||
import com.b44t.ui.Components.LayoutHelper;
|
||||
|
||||
public class ActionBarMenu extends LinearLayout {
|
||||
@@ -82,7 +84,7 @@ public class ActionBarMenu extends LinearLayout {
|
||||
return addItem(id, icon, parentActionBar.itemsBackgroundColor, null, width);
|
||||
}
|
||||
|
||||
public ActionBarMenuItem addItem(int id, int icon, int backgroundColor, Drawable drawable, int width) {
|
||||
public ActionBarMenuItem addItem(int id, final int icon, int backgroundColor, Drawable drawable, int width) {
|
||||
ActionBarMenuItem menuItem = new ActionBarMenuItem(getContext(), this, backgroundColor);
|
||||
|
||||
menuItem.setTag(id);
|
||||
@@ -111,6 +113,25 @@ public class ActionBarMenu extends LinearLayout {
|
||||
}
|
||||
}
|
||||
});
|
||||
menuItem.setOnLongClickListener(new OnLongClickListener() {
|
||||
@Override
|
||||
public boolean onLongClick(View view) {
|
||||
String hint = null;
|
||||
switch(icon) {
|
||||
case R.drawable.ic_ab_fwd_delete: hint = ApplicationLoader.applicationContext.getString(R.string.Delete); break;
|
||||
case R.drawable.ic_ab_fwd_forward: hint = ApplicationLoader.applicationContext.getString(R.string.Forward); break;
|
||||
case R.drawable.photo_crop: hint = ApplicationLoader.applicationContext.getString(R.string.CropImage); break;
|
||||
case R.drawable.photo_tools: hint = ApplicationLoader.applicationContext.getString(R.string.EditImage); break;
|
||||
}
|
||||
if( hint != null ) {
|
||||
AndroidUtilities.showHint(ApplicationLoader.applicationContext, hint);
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
});
|
||||
return menuItem;
|
||||
}
|
||||
|
||||
|
||||
@@ -246,11 +246,7 @@ public class ActionBarMenuItem extends FrameLayout {
|
||||
TextView textView = new TextView(getContext());
|
||||
textView.setTextColor(0xff212121);
|
||||
textView.setBackgroundResource(R.drawable.list_selector);
|
||||
if (!LocaleController.isRTL) {
|
||||
textView.setGravity(Gravity.CENTER_VERTICAL);
|
||||
} else {
|
||||
textView.setGravity(Gravity.CENTER_VERTICAL | Gravity.RIGHT);
|
||||
}
|
||||
textView.setGravity(Gravity.CENTER_VERTICAL | Gravity.START);
|
||||
textView.setPadding(AndroidUtilities.dp(16), 0, AndroidUtilities.dp(16), 0);
|
||||
textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18);
|
||||
textView.setMinWidth(AndroidUtilities.dp(196));
|
||||
@@ -267,9 +263,7 @@ public class ActionBarMenuItem extends FrameLayout {
|
||||
//popupLayout.setShowedFromBotton(showFromBottom);
|
||||
popupLayout.addView(textView);
|
||||
LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) textView.getLayoutParams();
|
||||
if (LocaleController.isRTL) {
|
||||
layoutParams.gravity = Gravity.RIGHT;
|
||||
}
|
||||
layoutParams.gravity = Gravity.START;
|
||||
layoutParams.width = LayoutHelper.MATCH_PARENT;
|
||||
layoutParams.height = AndroidUtilities.dp(48);
|
||||
textView.setLayoutParams(layoutParams);
|
||||
|
||||
@@ -448,7 +448,7 @@ public class BottomSheet extends Dialog {
|
||||
|
||||
imageView = new ImageView(context);
|
||||
imageView.setScaleType(ImageView.ScaleType.CENTER);
|
||||
addView(imageView, LayoutHelper.createFrame(24, 24, Gravity.CENTER_VERTICAL | (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT)));
|
||||
addView(imageView, LayoutHelper.createFrame(24, 24, Gravity.CENTER_VERTICAL | Gravity.START));
|
||||
|
||||
textView = new TextView(context);
|
||||
textView.setLines(1);
|
||||
@@ -458,7 +458,7 @@ public class BottomSheet extends Dialog {
|
||||
if (type == 0) {
|
||||
textView.setTextColor(0xff212121);
|
||||
textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
|
||||
addView(textView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.CENTER_VERTICAL));
|
||||
addView(textView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.START | Gravity.CENTER_VERTICAL));
|
||||
} else if (type == 1) {
|
||||
textView.setGravity(Gravity.CENTER);
|
||||
textView.setTextColor(0xff212121);
|
||||
|
||||
@@ -29,7 +29,6 @@ import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
|
||||
import com.b44t.messenger.AndroidUtilities;
|
||||
import com.b44t.messenger.LocaleController;
|
||||
import com.b44t.messenger.R;
|
||||
import com.b44t.ui.Cells.DrawerActionCell;
|
||||
import com.b44t.ui.Cells.DividerCell;
|
||||
@@ -113,21 +112,21 @@ public class DrawerLayoutAdapter extends BaseAdapter {
|
||||
}
|
||||
DrawerActionCell actionCell = (DrawerActionCell) view;
|
||||
if (i == ROW_NEW_CHAT) {
|
||||
actionCell.setTextAndIcon(LocaleController.getString("NewChat", R.string.NewChat), R.drawable.menu_newchat);
|
||||
actionCell.setTextAndIcon(mContext.getString(R.string.NewChat), R.drawable.menu_newchat);
|
||||
} else if (i == ROW_NEW_GROUP) {
|
||||
actionCell.setTextAndIcon(LocaleController.getString("NewGroup", R.string.NewGroup), R.drawable.menu_empty);
|
||||
actionCell.setTextAndIcon(mContext.getString(R.string.NewGroup), R.drawable.menu_empty);
|
||||
} else if (i == ROW_INVITE) {
|
||||
actionCell.setTextAndIcon(LocaleController.getString("InviteMenuEntry", R.string.InviteMenuEntry), R.drawable.menu_empty);
|
||||
actionCell.setTextAndIcon(mContext.getString(R.string.InviteMenuEntry), R.drawable.menu_empty);
|
||||
} else if (i == ROW_DEADDROP) {
|
||||
actionCell.setTextAndIcon(LocaleController.getString("Deaddrop", R.string.Deaddrop), R.drawable.menu_empty);
|
||||
actionCell.setTextAndIcon(mContext.getString(R.string.Deaddrop), R.drawable.menu_empty);
|
||||
// we do not want an icon beside the mailbox:
|
||||
// 1. We do not want to give it much attention,
|
||||
// 2. If the mailbox is shown in the chatlist, it gets the chat icon (KISS), but we should not use this icon in the drawer for the mailbox.
|
||||
// 3. Simplicity - we have two sections, "Add" and "Tools" - Mailbox belongs to the latter
|
||||
} else if (i == ROW_SETTINGS) {
|
||||
actionCell.setTextAndIcon(LocaleController.getString("Settings", R.string.Settings), R.drawable.menu_settings);
|
||||
actionCell.setTextAndIcon(mContext.getString(R.string.Settings), R.drawable.menu_settings);
|
||||
} else if (i == ROW_FAQ) {
|
||||
actionCell.setTextAndIcon(LocaleController.getString("Help", R.string.Help), R.drawable.menu_empty);
|
||||
actionCell.setTextAndIcon(mContext.getString(R.string.Help), R.drawable.menu_empty);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -97,7 +97,7 @@ public class AudioSelectActivity extends BaseFragment implements NotificationCen
|
||||
public View createView(Context context) {
|
||||
actionBar.setBackButtonImage(R.drawable.ic_ab_back);
|
||||
actionBar.setAllowOverlayTitle(true);
|
||||
actionBar.setTitle(LocaleController.getString("AttachMusic", R.string.AttachMusic));
|
||||
actionBar.setTitle(context.getString(R.string.AttachMusic));
|
||||
actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {
|
||||
@Override
|
||||
public void onItemClick(int id) {
|
||||
@@ -111,7 +111,7 @@ public class AudioSelectActivity extends BaseFragment implements NotificationCen
|
||||
FrameLayout frameLayout = (FrameLayout) fragmentView;
|
||||
|
||||
progressView = new EmptyTextProgressView(context);
|
||||
progressView.setText(LocaleController.getString("NoAudio", R.string.NoAudio));
|
||||
progressView.setText(context.getString(R.string.NoAudio));
|
||||
frameLayout.addView(progressView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
|
||||
|
||||
ListView listView = new ListView(context);
|
||||
@@ -119,7 +119,6 @@ public class AudioSelectActivity extends BaseFragment implements NotificationCen
|
||||
listView.setDivider(null);
|
||||
listView.setDividerHeight(0);
|
||||
listView.setAdapter(listViewAdapter = new ListAdapter(context));
|
||||
listView.setVerticalScrollbarPosition(LocaleController.isRTL ? ListView.SCROLLBAR_POSITION_LEFT : ListView.SCROLLBAR_POSITION_RIGHT);
|
||||
frameLayout.addView(listView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.LEFT | Gravity.TOP, 0, 0, 0, 48));
|
||||
|
||||
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||
|
||||
@@ -77,7 +77,7 @@ public class BlockedUsersActivity extends BaseFragment implements NotificationCe
|
||||
}
|
||||
|
||||
@Override
|
||||
public View createView(Context context) {
|
||||
public View createView(final Context context) {
|
||||
actionBar.setBackButtonImage(R.drawable.ic_ab_back);
|
||||
actionBar.setAllowOverlayTitle(true);
|
||||
actionBar.setTitle(ApplicationLoader.applicationContext.getString(R.string.BlockedContacts));
|
||||
@@ -107,7 +107,7 @@ public class BlockedUsersActivity extends BaseFragment implements NotificationCe
|
||||
emptyTextView.setTextSize(20);
|
||||
emptyTextView.setGravity(Gravity.CENTER);
|
||||
emptyTextView.setVisibility(View.INVISIBLE);
|
||||
emptyTextView.setText(LocaleController.getString("NoBlocked", R.string.NoBlocked));
|
||||
emptyTextView.setText(context.getString(R.string.NoBlocked));
|
||||
frameLayout.addView(emptyTextView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.TOP | Gravity.LEFT));
|
||||
emptyTextView.setOnTouchListener(new View.OnTouchListener() {
|
||||
@Override
|
||||
@@ -121,7 +121,6 @@ public class BlockedUsersActivity extends BaseFragment implements NotificationCe
|
||||
listView.setDivider(null);
|
||||
listView.setDividerHeight(0);
|
||||
listView.setAdapter(listViewAdapter = new ListAdapter(context));
|
||||
listView.setVerticalScrollbarPosition(LocaleController.isRTL ? ListView.SCROLLBAR_POSITION_LEFT : ListView.SCROLLBAR_POSITION_RIGHT);
|
||||
frameLayout.addView(listView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
|
||||
|
||||
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||
@@ -144,7 +143,7 @@ public class BlockedUsersActivity extends BaseFragment implements NotificationCe
|
||||
selectedUserId = blockedUserIds[i];
|
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
|
||||
CharSequence[] items = new CharSequence[]{LocaleController.getString("UnblockContact", R.string.UnblockContact)};
|
||||
CharSequence[] items = new CharSequence[]{context.getString(R.string.UnblockContact)};
|
||||
builder.setItems(items, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
|
||||
@@ -36,7 +36,6 @@ import android.widget.Toast;
|
||||
|
||||
import com.b44t.messenger.AndroidUtilities;
|
||||
import com.b44t.messenger.ApplicationLoader;
|
||||
import com.b44t.messenger.LocaleController;
|
||||
import com.b44t.messenger.R;
|
||||
import com.b44t.ui.ActionBar.ActionBar;
|
||||
import com.b44t.ui.ActionBar.BaseFragment;
|
||||
@@ -77,7 +76,7 @@ public class CacheControlActivity extends BaseFragment {
|
||||
public View createView(final Context context) {
|
||||
actionBar.setBackButtonImage(R.drawable.ic_ab_back);
|
||||
actionBar.setAllowOverlayTitle(true);
|
||||
actionBar.setTitle(LocaleController.getString("CacheSettings", R.string.CacheSettings));
|
||||
actionBar.setTitle(context.getString(R.string.CacheSettings));
|
||||
actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {
|
||||
@Override
|
||||
public void onItemClick(int id) {
|
||||
@@ -104,7 +103,7 @@ public class CacheControlActivity extends BaseFragment {
|
||||
public void onItemClick(final AdapterView<?> adapterView, View view, final int i, long l) {
|
||||
if (i == rowKeepMediaSetting) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
|
||||
builder.setItems(new CharSequence[]{context.getResources().getQuantityString(R.plurals.Weeks, 1, 1), context.getResources().getQuantityString(R.plurals.Months, 1, 1), LocaleController.getString("KeepMediaForever", R.string.KeepMediaForever)}, new DialogInterface.OnClickListener() {
|
||||
builder.setItems(new CharSequence[]{context.getResources().getQuantityString(R.plurals.Weeks, 1, 1), context.getResources().getQuantityString(R.plurals.Months, 1, 1), context.getString(R.string.KeepMediaForever)}, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, final int which) {
|
||||
SharedPreferences.Editor editor = ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", Activity.MODE_PRIVATE).edit();
|
||||
@@ -112,7 +111,7 @@ public class CacheControlActivity extends BaseFragment {
|
||||
if (listAdapter != null) {
|
||||
listAdapter.notifyDataSetChanged();
|
||||
}
|
||||
Toast.makeText(context, LocaleController.getString("NotYetImplemented", R.string.NotYetImplemented), Toast.LENGTH_SHORT).show();
|
||||
Toast.makeText(context, context.getString(R.string.NotYetImplemented), Toast.LENGTH_SHORT).show();
|
||||
|
||||
}
|
||||
});
|
||||
@@ -196,7 +195,7 @@ public class CacheControlActivity extends BaseFragment {
|
||||
view = new TextInfoCell(mContext);
|
||||
}
|
||||
if (i == rowKeepMediaInfo) {
|
||||
((TextInfoCell) view).setText(AndroidUtilities.replaceTags(LocaleController.getString("KeepMediaInfo", R.string.KeepMediaInfo)));
|
||||
((TextInfoCell) view).setText(AndroidUtilities.replaceTags(mContext.getString(R.string.KeepMediaInfo)));
|
||||
view.setBackgroundResource(R.drawable.greydivider_bottom);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ public class AudioCell extends FrameLayout {
|
||||
|
||||
playButton = new ImageView(context);
|
||||
playButton.setScaleType(ImageView.ScaleType.CENTER);
|
||||
addView(playButton, LayoutHelper.createFrame(46, 46, ((LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP), LocaleController.isRTL ? 0 : 13, 13, LocaleController.isRTL ? 13 : 0, 0));
|
||||
addView(playButton, LayoutHelper.createFrame(46, 46, (Gravity.START | Gravity.TOP), LocaleController.isRTL ? 0 : 13, 13, LocaleController.isRTL ? 13 : 0, 0));
|
||||
playButton.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
@@ -96,8 +96,8 @@ public class AudioCell extends FrameLayout {
|
||||
titleTextView.setMaxLines(1);
|
||||
titleTextView.setSingleLine(true);
|
||||
titleTextView.setEllipsize(TextUtils.TruncateAt.END);
|
||||
titleTextView.setGravity((LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP);
|
||||
addView(titleTextView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, LocaleController.isRTL ? 50 : 72, 7, LocaleController.isRTL ? 72 : 50, 0));
|
||||
titleTextView.setGravity(Gravity.START | Gravity.TOP);
|
||||
addView(titleTextView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.START | Gravity.TOP, LocaleController.isRTL ? 50 : 72, 7, LocaleController.isRTL ? 72 : 50, 0));
|
||||
|
||||
authorTextView = new TextView(context);
|
||||
authorTextView.setTextColor(0xff8a8a8a);
|
||||
@@ -106,8 +106,8 @@ public class AudioCell extends FrameLayout {
|
||||
authorTextView.setMaxLines(1);
|
||||
authorTextView.setSingleLine(true);
|
||||
authorTextView.setEllipsize(TextUtils.TruncateAt.END);
|
||||
authorTextView.setGravity((LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP);
|
||||
addView(authorTextView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, LocaleController.isRTL ? 50 : 72, 28, LocaleController.isRTL ? 72 : 50, 0));
|
||||
authorTextView.setGravity(Gravity.START | Gravity.TOP);
|
||||
addView(authorTextView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.START | Gravity.TOP, LocaleController.isRTL ? 50 : 72, 28, LocaleController.isRTL ? 72 : 50, 0));
|
||||
|
||||
timeTextView = new TextView(context);
|
||||
timeTextView.setTextColor(0xff8a8a8a);
|
||||
@@ -116,8 +116,8 @@ public class AudioCell extends FrameLayout {
|
||||
timeTextView.setMaxLines(1);
|
||||
timeTextView.setSingleLine(true);
|
||||
timeTextView.setEllipsize(TextUtils.TruncateAt.END);
|
||||
timeTextView.setGravity((LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP);
|
||||
addView(timeTextView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, LocaleController.isRTL ? 50 : 72, 44, LocaleController.isRTL ? 72 : 50, 0));
|
||||
timeTextView.setGravity(Gravity.START | Gravity.TOP);
|
||||
addView(timeTextView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.START | Gravity.TOP, LocaleController.isRTL ? 50 : 72, 44, LocaleController.isRTL ? 72 : 50, 0));
|
||||
|
||||
checkBox = new CheckBoxView(context, R.drawable.round_check2);
|
||||
checkBox.setVisibility(VISIBLE);
|
||||
@@ -125,7 +125,7 @@ public class AudioCell extends FrameLayout {
|
||||
addView(checkBox, LayoutHelper.createFrame(
|
||||
22, // width
|
||||
22, // height
|
||||
(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, // gravity
|
||||
Gravity.START | Gravity.TOP, // gravity
|
||||
LocaleController.isRTL ? 0 : 44, // marginLeft
|
||||
39, // marginTop
|
||||
LocaleController.isRTL ? 44 : 0, // marginRight
|
||||
|
||||
@@ -66,7 +66,6 @@ import com.b44t.ui.Components.StaticLayoutEx;
|
||||
import com.b44t.ui.ActionBar.Theme;
|
||||
import com.b44t.ui.PhotoViewer;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Locale;
|
||||
|
||||
@@ -137,7 +136,6 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||
|
||||
private int buttonPressed;
|
||||
private boolean imagePressed;
|
||||
private boolean photoNotSet;
|
||||
private RectF deleteProgressRect = new RectF();
|
||||
private RectF rect = new RectF();
|
||||
private TLRPC.PhotoSize currentPhotoObject;
|
||||
@@ -838,18 +836,14 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||
didPressedButton();
|
||||
}
|
||||
} else if (currentMessageObject.type == MessageObject.MO_TYPE8_GIF) {
|
||||
if (buttonState == -1) {
|
||||
if (MediaController.getInstance().canAutoplayGifs()) {
|
||||
delegate.didPressedImage(this);
|
||||
} else {
|
||||
buttonState = BS0_CLICK_TO_PLAY;
|
||||
currentMessageObject.audioProgress = 1;
|
||||
photoImage.setAllowStartAnimation(false);
|
||||
photoImage.stopAnimation();
|
||||
invalidate();
|
||||
}
|
||||
} else if ( buttonState == BS0_CLICK_TO_PLAY) {
|
||||
didPressedButton();
|
||||
if( !photoImage.isAnimationRunning() ) {
|
||||
// start GIF by a single click (if not running as autoplay disabled or stopped by a long click)
|
||||
// the second click will enlage the animation then (long click to stop)
|
||||
photoImage.startAnimation();
|
||||
}
|
||||
else {
|
||||
// enlarge GIF by a single click (if autoplay enabled)
|
||||
delegate.didPressedImage(this);
|
||||
}
|
||||
} else if (documentAttachType == DOCUMENT_ATTACH_TYPE_VIDEO) {
|
||||
if (buttonState == BS0_CLICK_TO_PLAY || buttonState == BS3_NORMAL) {
|
||||
@@ -868,11 +862,6 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||
}
|
||||
if (currentPhotoObject == null || currentPhotoObject.location instanceof TLRPC.TL_fileLocationUnavailable) {
|
||||
return true;
|
||||
} else if (currentMessageObject != null && photoNotSet) {
|
||||
File cacheFile = FileLoader.getPathToMessage(currentMessageObject.messageOwner);
|
||||
if (cacheFile.exists()) { //TODO
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -962,6 +951,12 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||
buttonPressed = 0;
|
||||
invalidate();
|
||||
}
|
||||
|
||||
if( photoImage.isAnimationRunning() ) {
|
||||
photoImage.stopAnimation();
|
||||
return; // a second long click may select (alternatively, you can select while running by clicking beside the image)
|
||||
}
|
||||
|
||||
if (delegate != null) {
|
||||
delegate.didLongPressed(this);
|
||||
}
|
||||
@@ -1103,7 +1098,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||
documentAttachType = DOCUMENT_ATTACH_TYPE_DOCUMENT;
|
||||
String name = FileLoader.getDocumentFileName(documentAttach);
|
||||
if (name == null || name.length() == 0) {
|
||||
name = LocaleController.getString("AttachDocument", R.string.AttachDocument);
|
||||
name = ApplicationLoader.applicationContext.getString(R.string.AttachDocument);
|
||||
}
|
||||
docTitleLayout = StaticLayoutEx.createStaticLayout(name, docNamePaint, maxWidth, Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false, TextUtils.TruncateAt.MIDDLE, maxWidth, drawPhotoImage ? 2 : 1);
|
||||
docTitleOffsetX = Integer.MIN_VALUE;
|
||||
@@ -1214,7 +1209,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||
|
||||
public void setMessageObject(MessageObject messageObject) {
|
||||
boolean messageChanged = currentMessageObject != messageObject || messageObject.forceUpdate;
|
||||
boolean dataChanged = currentMessageObject == messageObject && (isUserDataChanged() || photoNotSet);
|
||||
boolean dataChanged = currentMessageObject == messageObject && isUserDataChanged();
|
||||
if (messageChanged || dataChanged || isPhotoDataChanged(messageObject)) {
|
||||
currentMessageObject = messageObject;
|
||||
lastSendState = messageObject.messageOwner.send_state;
|
||||
@@ -1244,7 +1239,6 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||
currentPhotoFilter = null;
|
||||
infoLayout = null;
|
||||
buttonState = -1;
|
||||
photoNotSet = false;
|
||||
drawBackground = true;
|
||||
drawName = false;
|
||||
useSeekBarWaveform = false;
|
||||
@@ -1462,10 +1456,6 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||
photoImage.setShouldGenerateQualityThumb(true);
|
||||
photoImage.setParentMessageObject(messageObject);
|
||||
} else if (messageObject.type == MessageObject.MO_TYPE8_GIF) {
|
||||
String str = formatFileSize(messageObject.messageOwner.media.document.size);
|
||||
infoWidth = (int) Math.ceil(infoPaint.measureText(str));
|
||||
infoLayout = new StaticLayout(str, infoPaint, infoWidth, Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
|
||||
|
||||
photoImage.setNeedsQualityThumb(true);
|
||||
photoImage.setShouldGenerateQualityThumb(true);
|
||||
photoImage.setParentMessageObject(messageObject);
|
||||
@@ -1596,7 +1586,6 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||
if (photoExist /*|| MediaController.getInstance().canDownloadMedia(MediaController.AUTODOWNLOAD_MASK_PHOTO) || FileLoader.getInstance().isLoadingFile(fileName)*/) {
|
||||
photoImage.setImage(currentPhotoObject.location, currentPhotoFilter, currentPhotoObjectThumb != null ? currentPhotoObjectThumb.location : null, currentPhotoFilter, noSize ? 0 : currentPhotoObject.size, null, false);
|
||||
} else {
|
||||
photoNotSet = true;
|
||||
if (currentPhotoObjectThumb != null) {
|
||||
photoImage.setImage(null, null, currentPhotoObjectThumb.location, currentPhotoFilter, 0, null, false);
|
||||
} else {
|
||||
@@ -1607,23 +1596,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||
photoImage.setImageBitmap((BitmapDrawable) null);
|
||||
}
|
||||
} else if (messageObject.type == MessageObject.MO_TYPE8_GIF) {
|
||||
String fileName = FileLoader.getAttachFileName(messageObject.messageOwner.media.document);
|
||||
int localFile = 0;
|
||||
if (messageObject.attachPathExists) {
|
||||
localFile = 1;
|
||||
} else if (messageObject.mediaExists) {
|
||||
localFile = 2;
|
||||
}
|
||||
if (!messageObject.isSending() && (localFile != 0 /*|| MediaController.getInstance().canDownloadMedia(MediaController.AUTODOWNLOAD_MASK_GIF) && MessageObject.isNewGifDocument(messageObject.messageOwner.media.document)*/ || FileLoader.getInstance().isLoadingFile(fileName))) {
|
||||
if (localFile == 1) {
|
||||
photoImage.setImage(null, messageObject.isSendError() ? null : messageObject.messageOwner.attachPath, null, null, currentPhotoObject != null ? currentPhotoObject.location : null, currentPhotoFilter, 0, null, false);
|
||||
} else {
|
||||
photoImage.setImage(messageObject.messageOwner.media.document, null, currentPhotoObject != null ? currentPhotoObject.location : null, currentPhotoFilter, messageObject.messageOwner.media.document.size, null, false);
|
||||
}
|
||||
} else {
|
||||
photoNotSet = true;
|
||||
photoImage.setImage(null, null, currentPhotoObject != null ? currentPhotoObject.location : null, currentPhotoFilter, 0, null, false);
|
||||
}
|
||||
photoImage.setImageByPath(currentPhotoObject.location.mr_path, null, null, null, 0);
|
||||
} else {
|
||||
photoImage.setImage(null, null, currentPhotoObject != null ? currentPhotoObject.location : null, currentPhotoFilter, 0, null, false);
|
||||
}
|
||||
@@ -1856,7 +1829,9 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||
}
|
||||
|
||||
if (documentAttachType == DOCUMENT_ATTACH_TYPE_GIF || currentMessageObject.type == MessageObject.MO_TYPE8_GIF) {
|
||||
;
|
||||
if( !photoImage.isAnimationRunning() ) {
|
||||
drawIcon = Theme.INLIST_TRANSP_PLAY;
|
||||
}
|
||||
} else if (documentAttachType == DOCUMENT_ATTACH_TYPE_MUSIC) {
|
||||
drawIcon = buttonState==BS0_CLICK_TO_PLAY? Theme.INLIST_PLAY : Theme.INLIST_PAUSE;
|
||||
|
||||
@@ -2042,10 +2017,6 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||
} else {
|
||||
buttonState = -1;
|
||||
}
|
||||
|
||||
if (photoNotSet) {
|
||||
setMessageObject(currentMessageObject);
|
||||
}
|
||||
invalidate();
|
||||
}
|
||||
}
|
||||
@@ -2116,34 +2087,8 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||
}
|
||||
|
||||
private void measureTime(MessageObject messageObject) {
|
||||
boolean hasSign = !messageObject.isOutOwner() && messageObject.messageOwner.from_id > 0 && messageObject.messageOwner.post;
|
||||
TLRPC.User signUser = MrMailbox.getUser(messageObject.messageOwner.from_id);
|
||||
if (hasSign && signUser == null) {
|
||||
hasSign = false;
|
||||
}
|
||||
String timeString = LocaleController.getInstance().formatterDay.format((long) (messageObject.messageOwner.date) * 1000);
|
||||
if (hasSign) {
|
||||
currentTimeString = ", " + timeString;
|
||||
} else {
|
||||
currentTimeString = timeString;
|
||||
}
|
||||
currentTimeString = LocaleController.getInstance().formatterDay.format((long) (messageObject.messageOwner.date) * 1000);
|
||||
timeTextWidth = timeWidth = (int) Math.ceil(timePaint.measureText(currentTimeString));
|
||||
|
||||
if (hasSign) {
|
||||
if (availableTimeWidth == 0) {
|
||||
availableTimeWidth = dp(1000);
|
||||
}
|
||||
CharSequence name = ContactsController.formatName(signUser.first_name, signUser.last_name).replace('\n', ' ');
|
||||
int widthForSign = availableTimeWidth - timeWidth;
|
||||
int width = (int) Math.ceil(timePaint.measureText(name, 0, name.length()));
|
||||
if (width > widthForSign) {
|
||||
name = TextUtils.ellipsize(name, timePaint, widthForSign, TextUtils.TruncateAt.END);
|
||||
width = widthForSign;
|
||||
}
|
||||
currentTimeString = name + currentTimeString;
|
||||
timeTextWidth += width;
|
||||
timeWidth += width;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isDrawSelectedBackground() {
|
||||
@@ -2235,14 +2180,14 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||
currentForwardNameString = messageObject.messageOwner.fwd_from.m_name;
|
||||
|
||||
forwardedNameWidth = getMaxNameWidth();
|
||||
int fromWidth = (int) Math.ceil(forwardNamePaint.measureText(LocaleController.getString("From", R.string.From) + " "));
|
||||
int fromWidth = (int) Math.ceil(forwardNamePaint.measureText(ApplicationLoader.applicationContext.getString(R.string.From) + " "));
|
||||
CharSequence name = TextUtils.ellipsize(currentForwardNameString.replace('\n', ' '), forward2NamePaint, forwardedNameWidth - fromWidth, TextUtils.TruncateAt.END);
|
||||
CharSequence lastLine;
|
||||
lastLine = replaceTags(String.format("%s <b>%s</b>", LocaleController.getString("From", R.string.From), name));
|
||||
lastLine = replaceTags(String.format("%s <b>%s</b>", ApplicationLoader.applicationContext.getString(R.string.From), name));
|
||||
lastLine = TextUtils.ellipsize(lastLine, forwardNamePaint, forwardedNameWidth, TextUtils.TruncateAt.END);
|
||||
try {
|
||||
forwardedNameLayout[1] = new StaticLayout(lastLine, forwardNamePaint, forwardedNameWidth + dp(2), Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
|
||||
lastLine = TextUtils.ellipsize(replaceTags(LocaleController.getString("ForwardedMessage", R.string.ForwardedMessage)), forwardNamePaint, forwardedNameWidth, TextUtils.TruncateAt.END);
|
||||
lastLine = TextUtils.ellipsize(replaceTags(ApplicationLoader.applicationContext.getString(R.string.ForwardedMessage)), forwardNamePaint, forwardedNameWidth, TextUtils.TruncateAt.END);
|
||||
forwardedNameLayout[0] = new StaticLayout(lastLine, forwardNamePaint, forwardedNameWidth + dp(2), Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
|
||||
forwardedNameWidth = Math.max((int) Math.ceil(forwardedNameLayout[0].getLineWidth(0)), (int) Math.ceil(forwardedNameLayout[1].getLineWidth(0)));
|
||||
forwardNameOffsetX[0] = forwardedNameLayout[0].getLineLeft(0);
|
||||
|
||||
@@ -124,13 +124,13 @@ public class DrawerProfileCell extends FrameLayout {
|
||||
}
|
||||
|
||||
public void updateUserName() {
|
||||
String displayname = MrMailbox.getConfig("displayname", LocaleController.getString("MyAccount", R.string.MyAccount));
|
||||
String displayname = MrMailbox.getConfig("displayname", ApplicationLoader.applicationContext.getString(R.string.MyAccount));
|
||||
String addr;
|
||||
if( MrMailbox.isConfigured()!=0) {
|
||||
addr = MrMailbox.getConfig("addr", "");
|
||||
}
|
||||
else {
|
||||
addr = LocaleController.getString("AccountNotConfigured", R.string.AccountNotConfigured);
|
||||
addr = ApplicationLoader.applicationContext.getString(R.string.AccountNotConfigured);
|
||||
}
|
||||
nameTextView.setText(displayname);
|
||||
subtitleTextView.setText(addr);
|
||||
|
||||
@@ -67,12 +67,12 @@ public class EditTextCell extends FrameLayout {
|
||||
labelTextView = new TextView(context);
|
||||
labelTextView.setTextColor(0xff212121);
|
||||
labelTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 13);
|
||||
labelTextView.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT);
|
||||
labelTextView.setGravity(Gravity.START);
|
||||
labelTextView.setLines(1);
|
||||
labelTextView.setMaxLines(1);
|
||||
labelTextView.setSingleLine(true);
|
||||
labelTextView.setPadding(0, 0, 0, 0);
|
||||
addView(labelTextView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP,
|
||||
addView(labelTextView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.START | Gravity.TOP,
|
||||
17, 8, 17, 0));
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@ public class EditTextCell extends FrameLayout {
|
||||
editView.setMaxLines(1);
|
||||
editView.setSingleLine(true);
|
||||
editView.setHintTextColor(0xffBBBBBB); // was: 0xff979797
|
||||
editView.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT);
|
||||
editView.setGravity(Gravity.START);
|
||||
editView.setInputType(InputType.TYPE_CLASS_TEXT|InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
|
||||
editView.setImeOptions(EditorInfo.IME_ACTION_DONE); // just close the keyboard, NEXT would not work as the other entries nay not yet loaded
|
||||
AndroidUtilities.clearCursorDrawable(editView);
|
||||
@@ -101,7 +101,7 @@ public class EditTextCell extends FrameLayout {
|
||||
});
|
||||
*/
|
||||
|
||||
addView(editView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP,
|
||||
addView(editView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.START | Gravity.TOP,
|
||||
17, useLabel? 25 : 25-17, 17, 0));
|
||||
|
||||
setBackgroundColor(0xffffffff);
|
||||
|
||||
@@ -46,8 +46,8 @@ public class GreySectionCell extends FrameLayout {
|
||||
textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 13);
|
||||
textView.setTypeface(Typeface.DEFAULT_BOLD);
|
||||
textView.setTextColor(0xff8a8a8a);
|
||||
textView.setGravity((LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.CENTER_VERTICAL);
|
||||
addView(textView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, 16, 0, 16, 0));
|
||||
textView.setGravity(Gravity.START | Gravity.CENTER_VERTICAL);
|
||||
addView(textView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.START | Gravity.TOP, 16, 0, 16, 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -45,8 +45,8 @@ public class HeaderCell extends FrameLayout {
|
||||
textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 15);
|
||||
textView.setTypeface(Typeface.DEFAULT_BOLD);
|
||||
textView.setTextColor(0xff5099c9);
|
||||
textView.setGravity((LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.CENTER_VERTICAL);
|
||||
addView(textView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, 17, 15, 17, 0));
|
||||
textView.setGravity(Gravity.START | Gravity.CENTER_VERTICAL);
|
||||
addView(textView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.START | Gravity.TOP, 17, 15, 17, 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -60,10 +60,10 @@ public class SharedDocumentCell extends FrameLayout {
|
||||
}
|
||||
|
||||
placeholderImageView = new ImageView(context);
|
||||
addView(placeholderImageView, LayoutHelper.createFrame(40, 40, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, LocaleController.isRTL ? 0 : 12, 8, LocaleController.isRTL ? 12 : 0, 0));
|
||||
addView(placeholderImageView, LayoutHelper.createFrame(40, 40, Gravity.START | Gravity.TOP, LocaleController.isRTL ? 0 : 12, 8, LocaleController.isRTL ? 12 : 0, 0));
|
||||
|
||||
thumbImageView = new BackupImageView(context);
|
||||
addView(thumbImageView, LayoutHelper.createFrame(40, 40, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, LocaleController.isRTL ? 0 : 12, 8, LocaleController.isRTL ? 12 : 0, 0));
|
||||
addView(thumbImageView, LayoutHelper.createFrame(40, 40, Gravity.START | Gravity.TOP, LocaleController.isRTL ? 0 : 12, 8, LocaleController.isRTL ? 12 : 0, 0));
|
||||
thumbImageView.getImageReceiver().setDelegate(new ImageReceiver.ImageReceiverDelegate() {
|
||||
@Override
|
||||
public void didSetImage(ImageReceiver imageReceiver, boolean set, boolean thumb) {
|
||||
@@ -78,8 +78,8 @@ public class SharedDocumentCell extends FrameLayout {
|
||||
nameTextView.setMaxLines(1);
|
||||
nameTextView.setSingleLine(true);
|
||||
nameTextView.setEllipsize(TextUtils.TruncateAt.END);
|
||||
nameTextView.setGravity((LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.CENTER_VERTICAL);
|
||||
addView(nameTextView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, LocaleController.isRTL ? 8 : 72, 5, LocaleController.isRTL ? 72 : 8, 0));
|
||||
nameTextView.setGravity(Gravity.START | Gravity.CENTER_VERTICAL);
|
||||
addView(nameTextView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.START | Gravity.TOP, LocaleController.isRTL ? 8 : 72, 5, LocaleController.isRTL ? 72 : 8, 0));
|
||||
|
||||
dateTextView = new TextView(context);
|
||||
dateTextView.setTextColor(0xff999999);
|
||||
@@ -88,12 +88,12 @@ public class SharedDocumentCell extends FrameLayout {
|
||||
dateTextView.setMaxLines(1);
|
||||
dateTextView.setSingleLine(true);
|
||||
dateTextView.setEllipsize(TextUtils.TruncateAt.END);
|
||||
dateTextView.setGravity((LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.CENTER_VERTICAL);
|
||||
addView(dateTextView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, LocaleController.isRTL ? 8 : 72, 30, LocaleController.isRTL ? 72 : 8, 0));
|
||||
dateTextView.setGravity(Gravity.START | Gravity.CENTER_VERTICAL);
|
||||
addView(dateTextView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.START | Gravity.TOP, LocaleController.isRTL ? 8 : 72, 30, LocaleController.isRTL ? 72 : 8, 0));
|
||||
|
||||
checkBox = new CheckBoxView(context, R.drawable.round_check2);
|
||||
checkBox.setVisibility(INVISIBLE);
|
||||
addView(checkBox, LayoutHelper.createFrame(22, 22, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, LocaleController.isRTL ? 0 : 34, 30, LocaleController.isRTL ? 34 : 0, 0));
|
||||
addView(checkBox, LayoutHelper.createFrame(22, 22, Gravity.START | Gravity.TOP, LocaleController.isRTL ? 0 : 34, 30, LocaleController.isRTL ? 34 : 0, 0));
|
||||
}
|
||||
|
||||
public void setTextAndValueAndTypeAndThumb(String text, String value, String type, String thumb, int resId) {
|
||||
|
||||
@@ -46,13 +46,13 @@ public class TextCell extends FrameLayout {
|
||||
textView = new SimpleTextView(context);
|
||||
textView.setTextColor(0xff212121);
|
||||
textView.setTextSize(16);
|
||||
textView.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT);
|
||||
textView.setGravity(Gravity.START);
|
||||
addView(textView);
|
||||
|
||||
valueTextView = new SimpleTextView(context);
|
||||
valueTextView.setTextColor(0xff2f8cc9);
|
||||
valueTextView.setTextSize(16);
|
||||
valueTextView.setGravity(LocaleController.isRTL ? Gravity.LEFT : Gravity.RIGHT);
|
||||
valueTextView.setGravity(Gravity.END);
|
||||
addView(valueTextView);
|
||||
|
||||
imageView = new ImageView(context);
|
||||
|
||||
@@ -61,27 +61,27 @@ public class TextCheckCell extends FrameLayout {
|
||||
textView.setLines(1);
|
||||
textView.setMaxLines(1);
|
||||
textView.setSingleLine(true);
|
||||
textView.setGravity((LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.CENTER_VERTICAL);
|
||||
textView.setGravity(Gravity.START | Gravity.CENTER_VERTICAL);
|
||||
textView.setEllipsize(TextUtils.TruncateAt.END);
|
||||
addView(textView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, LocaleController.isRTL ? 64 : 17, 0, LocaleController.isRTL ? 17 : 64, 0));
|
||||
addView(textView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.START | Gravity.TOP, LocaleController.isRTL ? 64 : 17, 0, LocaleController.isRTL ? 17 : 64, 0));
|
||||
|
||||
valueTextView = new TextView(context);
|
||||
valueTextView.setTextColor(0xff8a8a8a);
|
||||
valueTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 13);
|
||||
valueTextView.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT);
|
||||
valueTextView.setGravity(Gravity.START);
|
||||
valueTextView.setLines(1);
|
||||
valueTextView.setMaxLines(1);
|
||||
valueTextView.setSingleLine(true);
|
||||
valueTextView.setPadding(0, 0, 0, 0);
|
||||
valueTextView.setEllipsize(TextUtils.TruncateAt.END);
|
||||
addView(valueTextView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, LocaleController.isRTL ? 64 : 17, 35, LocaleController.isRTL ? 17 : 64, 0));
|
||||
addView(valueTextView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.START | Gravity.TOP, LocaleController.isRTL ? 64 : 17, 35, LocaleController.isRTL ? 17 : 64, 0));
|
||||
|
||||
checkBox = new CheckBox(context);
|
||||
checkBox.setDuplicateParentStateEnabled(false);
|
||||
checkBox.setFocusable(false);
|
||||
checkBox.setFocusableInTouchMode(false);
|
||||
checkBox.setClickable(false);
|
||||
addView(checkBox, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, (LocaleController.isRTL ? Gravity.LEFT : Gravity.RIGHT) | Gravity.CENTER_VERTICAL, 11, 0, 11, 0));
|
||||
addView(checkBox, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.END | Gravity.CENTER_VERTICAL, 11, 0, 11, 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,93 +0,0 @@
|
||||
/*******************************************************************************
|
||||
*
|
||||
* Messenger Android Frontend
|
||||
* (C) 2013-2016 Nikolai Kudashov
|
||||
* (C) 2017 Björn Petersen
|
||||
* Contact: r10s@b44t.com, http://b44t.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see http://www.gnu.org/licenses/ .
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Cells;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Paint;
|
||||
import android.util.TypedValue;
|
||||
import android.view.Gravity;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.b44t.messenger.LocaleController;
|
||||
import com.b44t.ui.Components.LayoutHelper;
|
||||
|
||||
import static com.b44t.messenger.AndroidUtilities.dp;
|
||||
|
||||
public class TextColorCell extends FrameLayout {
|
||||
|
||||
private TextView textView;
|
||||
private boolean needDivider;
|
||||
private Paint dividerpaint;
|
||||
private Paint circlepaint;
|
||||
|
||||
|
||||
public TextColorCell(Context context) {
|
||||
super(context);
|
||||
|
||||
dividerpaint = new Paint();
|
||||
dividerpaint.setColor(0xffd9d9d9);
|
||||
dividerpaint.setStrokeWidth(1);
|
||||
dividerpaint.setAntiAlias(true);
|
||||
|
||||
circlepaint = new Paint();
|
||||
circlepaint.setAntiAlias(true);
|
||||
|
||||
textView = new TextView(context);
|
||||
textView.setTextColor(0xff212121);
|
||||
textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
|
||||
textView.setLines(1);
|
||||
textView.setMaxLines(1);
|
||||
textView.setSingleLine(true);
|
||||
textView.setGravity((LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.CENTER_VERTICAL);
|
||||
addView(textView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, 17, 0, 17, 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||
super.onMeasure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(dp(48) + (needDivider ? 1 : 0), MeasureSpec.EXACTLY));
|
||||
}
|
||||
|
||||
public void setTextAndColor(String text, int color, boolean divider) {
|
||||
textView.setText(text);
|
||||
needDivider = divider;
|
||||
circlepaint.setColor(color);
|
||||
setWillNotDraw(false);
|
||||
invalidate();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDraw(Canvas canvas) {
|
||||
if (needDivider) {
|
||||
canvas.drawLine(getPaddingLeft(), getHeight() - 1, getWidth() - getPaddingRight(), getHeight() - 1, dividerpaint);
|
||||
}
|
||||
|
||||
final int RADIUS = dp(8);
|
||||
int x = getWidth()-getPaddingRight()-dp(17)-RADIUS;
|
||||
int y = getHeight()/2;
|
||||
canvas.drawCircle(x+dp(1), y+dp(1), RADIUS, dividerpaint);
|
||||
canvas.drawCircle(x, y, RADIUS, circlepaint);
|
||||
}
|
||||
}
|
||||
@@ -50,8 +50,8 @@ public class TextDetailCell extends FrameLayout {
|
||||
textView.setLines(1);
|
||||
textView.setMaxLines(1);
|
||||
textView.setSingleLine(true);
|
||||
textView.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT);
|
||||
addView(textView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT, LocaleController.isRTL ? 16 : 71, 10, LocaleController.isRTL ? 71 : 16, 0));
|
||||
textView.setGravity(Gravity.START);
|
||||
addView(textView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.START, LocaleController.isRTL ? 16 : 71, 10, LocaleController.isRTL ? 71 : 16, 0));
|
||||
|
||||
valueTextView = new TextView(context);
|
||||
valueTextView.setTextColor(0xff8a8a8a);
|
||||
@@ -59,12 +59,12 @@ public class TextDetailCell extends FrameLayout {
|
||||
valueTextView.setLines(1);
|
||||
valueTextView.setMaxLines(1);
|
||||
valueTextView.setSingleLine(true);
|
||||
valueTextView.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT);
|
||||
addView(valueTextView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT, LocaleController.isRTL ? 16 : 71, 35, LocaleController.isRTL ? 71 : 16, 0));
|
||||
valueTextView.setGravity(Gravity.START);
|
||||
addView(valueTextView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.START, LocaleController.isRTL ? 16 : 71, 35, LocaleController.isRTL ? 71 : 16, 0));
|
||||
|
||||
imageView = new ImageView(context);
|
||||
imageView.setScaleType(ImageView.ScaleType.CENTER);
|
||||
addView(imageView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.CENTER_VERTICAL, LocaleController.isRTL ? 0 : 16, 0, LocaleController.isRTL ? 16 : 0, 0));
|
||||
addView(imageView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.START | Gravity.CENTER_VERTICAL, LocaleController.isRTL ? 0 : 16, 0, LocaleController.isRTL ? 16 : 0, 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -58,18 +58,18 @@ public class TextDetailSettingsCell extends FrameLayout {
|
||||
textView.setLines(1);
|
||||
textView.setMaxLines(1);
|
||||
textView.setSingleLine(true);
|
||||
textView.setGravity((LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.CENTER_VERTICAL);
|
||||
addView(textView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, 17, 10, 17, 0));
|
||||
textView.setGravity(Gravity.START | Gravity.CENTER_VERTICAL);
|
||||
addView(textView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.START | Gravity.TOP, 17, 10, 17, 0));
|
||||
|
||||
valueTextView = new TextView(context);
|
||||
valueTextView.setTextColor(0xff8a8a8a);
|
||||
valueTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 13);
|
||||
valueTextView.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT);
|
||||
valueTextView.setGravity(Gravity.START);
|
||||
valueTextView.setLines(1);
|
||||
valueTextView.setMaxLines(1);
|
||||
valueTextView.setSingleLine(true);
|
||||
valueTextView.setPadding(0, 0, 0, 0);
|
||||
addView(valueTextView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, 17, 35, 17, 0));
|
||||
addView(valueTextView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.START | Gravity.TOP, 17, 35, 17, 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -46,13 +46,13 @@ public class TextInfoCell extends FrameLayout {
|
||||
textView = new TextView(context);
|
||||
textView.setTextColor(0xff808080);
|
||||
textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
|
||||
textView.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT);
|
||||
textView.setGravity(Gravity.START);
|
||||
addView(textView);
|
||||
|
||||
iconView = new TextView(context);
|
||||
iconView.setTextColor(0xff212121);
|
||||
iconView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, iconDp);
|
||||
iconView.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT);
|
||||
iconView.setGravity(Gravity.START);
|
||||
addView(iconView);
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ public class TextInfoCell extends FrameLayout {
|
||||
FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) textView.getLayoutParams();
|
||||
lp.width = LayoutHelper.WRAP_CONTENT;
|
||||
lp.height = LayoutHelper.WRAP_CONTENT;
|
||||
lp.gravity = (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP;
|
||||
lp.gravity = Gravity.START | Gravity.TOP;
|
||||
lp.leftMargin = AndroidUtilities.dp(17);
|
||||
lp.topMargin = AndroidUtilities.dp(13);
|
||||
lp.rightMargin = AndroidUtilities.dp(17 + (icon!=null?iconDp:0));
|
||||
@@ -88,7 +88,7 @@ public class TextInfoCell extends FrameLayout {
|
||||
lp = (FrameLayout.LayoutParams) iconView.getLayoutParams();
|
||||
lp.width = LayoutHelper.WRAP_CONTENT;
|
||||
lp.height = LayoutHelper.WRAP_CONTENT;
|
||||
lp.gravity = (LocaleController.isRTL ? Gravity.LEFT : Gravity.RIGHT) | Gravity.TOP;
|
||||
lp.gravity = Gravity.END | Gravity.TOP;
|
||||
lp.leftMargin = AndroidUtilities.dp(17);
|
||||
lp.topMargin = AndroidUtilities.dp(3);
|
||||
lp.rightMargin = AndroidUtilities.dp(20);
|
||||
|
||||
@@ -37,22 +37,31 @@ import com.b44t.messenger.AndroidUtilities;
|
||||
import com.b44t.messenger.LocaleController;
|
||||
import com.b44t.ui.Components.LayoutHelper;
|
||||
|
||||
import static com.b44t.messenger.AndroidUtilities.dp;
|
||||
|
||||
public class TextSettingsCell extends FrameLayout {
|
||||
|
||||
private TextView textView;
|
||||
private TextView valueTextView;
|
||||
private ImageView valueImageView;
|
||||
private static Paint paint;
|
||||
private boolean valueIsColor;
|
||||
private Paint dividerpaint;
|
||||
private Paint circlepaint;
|
||||
private Paint circleborderpaint;
|
||||
private boolean needDivider;
|
||||
|
||||
public TextSettingsCell(Context context) {
|
||||
super(context);
|
||||
|
||||
if (paint == null) {
|
||||
paint = new Paint();
|
||||
paint.setColor(0xffd9d9d9);
|
||||
paint.setStrokeWidth(1);
|
||||
}
|
||||
dividerpaint = new Paint();
|
||||
dividerpaint.setColor(0xffd9d9d9);
|
||||
dividerpaint.setStrokeWidth(1);
|
||||
|
||||
circleborderpaint = new Paint();
|
||||
circleborderpaint.setColor(0xff000000);
|
||||
circleborderpaint.setStrokeWidth(1);
|
||||
|
||||
circlepaint = new Paint();
|
||||
circlepaint.setAntiAlias(true);
|
||||
|
||||
textView = new TextView(context);
|
||||
textView.setTextColor(0xff212121);
|
||||
@@ -61,8 +70,8 @@ public class TextSettingsCell extends FrameLayout {
|
||||
textView.setMaxLines(1);
|
||||
textView.setSingleLine(true);
|
||||
textView.setEllipsize(TextUtils.TruncateAt.END);
|
||||
textView.setGravity((LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.CENTER_VERTICAL);
|
||||
addView(textView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, 17, 0, 17, 0));
|
||||
textView.setGravity(Gravity.START | Gravity.CENTER_VERTICAL);
|
||||
addView(textView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.START | Gravity.TOP, 17, 0, 17, 0));
|
||||
|
||||
valueTextView = new TextView(context);
|
||||
valueTextView.setTextColor(0xff2f8cc9);
|
||||
@@ -71,29 +80,26 @@ public class TextSettingsCell extends FrameLayout {
|
||||
valueTextView.setMaxLines(1);
|
||||
valueTextView.setSingleLine(true);
|
||||
valueTextView.setEllipsize(TextUtils.TruncateAt.END);
|
||||
valueTextView.setGravity((LocaleController.isRTL ? Gravity.LEFT : Gravity.RIGHT) | Gravity.CENTER_VERTICAL);
|
||||
addView(valueTextView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.MATCH_PARENT, (LocaleController.isRTL ? Gravity.LEFT : Gravity.RIGHT) | Gravity.TOP, 17, 0, 17, 0));
|
||||
|
||||
valueImageView = new ImageView(context);
|
||||
valueImageView.setScaleType(ImageView.ScaleType.CENTER);
|
||||
valueImageView.setVisibility(INVISIBLE);
|
||||
addView(valueImageView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, (LocaleController.isRTL ? Gravity.LEFT : Gravity.RIGHT) | Gravity.CENTER_VERTICAL, 17, 0, 17, 0));
|
||||
valueTextView.setGravity(Gravity.END | Gravity.CENTER_VERTICAL);
|
||||
addView(valueTextView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.MATCH_PARENT, Gravity.END | Gravity.TOP, 17, 0, 17, 0));
|
||||
}
|
||||
|
||||
private final int RADIUS = dp(8);
|
||||
|
||||
@Override
|
||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||
setMeasuredDimension(MeasureSpec.getSize(widthMeasureSpec), AndroidUtilities.dp(48) + (needDivider ? 1 : 0));
|
||||
|
||||
int availableWidth = getMeasuredWidth() - getPaddingLeft() - getPaddingRight() - AndroidUtilities.dp(34);
|
||||
int width = availableWidth / 2;
|
||||
if (valueImageView.getVisibility() == VISIBLE) {
|
||||
valueImageView.measure(MeasureSpec.makeMeasureSpec(width, MeasureSpec.AT_MOST), MeasureSpec.makeMeasureSpec(getMeasuredHeight(), MeasureSpec.EXACTLY));
|
||||
}
|
||||
if (valueTextView.getVisibility() == VISIBLE) {
|
||||
valueTextView.measure(MeasureSpec.makeMeasureSpec(width, MeasureSpec.AT_MOST), MeasureSpec.makeMeasureSpec(getMeasuredHeight(), MeasureSpec.EXACTLY));
|
||||
width = availableWidth - valueTextView.getMeasuredWidth() - AndroidUtilities.dp(8);
|
||||
} else {
|
||||
width = availableWidth;
|
||||
if( valueIsColor ) {
|
||||
width -= RADIUS * 3/*2 for the circle, 1 for space*/;
|
||||
}
|
||||
}
|
||||
textView.measure(MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(getMeasuredHeight(), MeasureSpec.EXACTLY));
|
||||
}
|
||||
@@ -102,21 +108,16 @@ public class TextSettingsCell extends FrameLayout {
|
||||
textView.setTextColor(color);
|
||||
}
|
||||
|
||||
public void setTextValueColor(int color) {
|
||||
valueTextView.setTextColor(color);
|
||||
}
|
||||
|
||||
public void setText(String text, boolean divider) {
|
||||
textView.setText(text);
|
||||
valueTextView.setVisibility(INVISIBLE);
|
||||
valueImageView.setVisibility(INVISIBLE);
|
||||
needDivider = divider;
|
||||
setWillNotDraw(!divider);
|
||||
}
|
||||
|
||||
public void setTextAndValue(String text, String value, boolean divider) {
|
||||
textView.setText(text);
|
||||
valueImageView.setVisibility(INVISIBLE);
|
||||
valueIsColor = false;
|
||||
if (value != null) {
|
||||
valueTextView.setText(value);
|
||||
valueTextView.setVisibility(VISIBLE);
|
||||
@@ -124,27 +125,31 @@ public class TextSettingsCell extends FrameLayout {
|
||||
valueTextView.setVisibility(INVISIBLE);
|
||||
}
|
||||
needDivider = divider;
|
||||
setWillNotDraw(!divider);
|
||||
setWillNotDraw(!needDivider);
|
||||
requestLayout();
|
||||
}
|
||||
|
||||
public void setTextAndIcon(String text, int resId, boolean divider) {
|
||||
public void setTextAndColor(String text, int color, boolean divider) {
|
||||
textView.setText(text);
|
||||
valueIsColor = true;
|
||||
valueTextView.setVisibility(INVISIBLE);
|
||||
if (resId != 0) {
|
||||
valueImageView.setVisibility(VISIBLE);
|
||||
valueImageView.setImageResource(resId);
|
||||
} else {
|
||||
valueImageView.setVisibility(INVISIBLE);
|
||||
}
|
||||
needDivider = divider;
|
||||
setWillNotDraw(!divider);
|
||||
circlepaint.setColor(color);
|
||||
setWillNotDraw(false);
|
||||
requestLayout();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDraw(Canvas canvas) {
|
||||
if (needDivider) {
|
||||
canvas.drawLine(getPaddingLeft(), getHeight() - 1, getWidth() - getPaddingRight(), getHeight() - 1, paint);
|
||||
canvas.drawLine(getPaddingLeft(), getHeight() - 1, getWidth() - getPaddingRight(), getHeight() - 1, dividerpaint);
|
||||
}
|
||||
|
||||
if( valueIsColor ) {
|
||||
int x = getWidth()-getPaddingRight()-dp(17)-RADIUS;
|
||||
int y = getHeight()/2;
|
||||
canvas.drawCircle(x, y, RADIUS+dp(1), circleborderpaint);
|
||||
canvas.drawCircle(x, y, RADIUS, circlepaint);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,28 +63,28 @@ public class UserCell extends FrameLayout {
|
||||
|
||||
avatarImageView = new BackupImageView(context);
|
||||
avatarImageView.setRoundRadius(AndroidUtilities.dp(24));
|
||||
addView(avatarImageView, LayoutHelper.createFrame(48, 48, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, LocaleController.isRTL ? 0 : 7 + padding, 8, LocaleController.isRTL ? 7 + padding : 0, 0));
|
||||
addView(avatarImageView, LayoutHelper.createFrame(48, 48, Gravity.START | Gravity.TOP, LocaleController.isRTL ? 0 : 7 + padding, 8, LocaleController.isRTL ? 7 + padding : 0, 0));
|
||||
|
||||
nameTextView = new SimpleTextView(context);
|
||||
nameTextView.setTextColor(0xff212121);
|
||||
nameTextView.setTextSize(16); /*same size as in TextCell */
|
||||
nameTextView.setGravity((LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP);
|
||||
addView(nameTextView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 20, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, LocaleController.isRTL ? 28 + (useCheckboxes == 2 ? 18 : 0) : (68 + padding), 11.5f, LocaleController.isRTL ? (68 + padding) : 28 + (useCheckboxes == 2 ? 18 : 0), 0));
|
||||
nameTextView.setGravity(Gravity.START | Gravity.TOP);
|
||||
addView(nameTextView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 20, Gravity.START | Gravity.TOP, LocaleController.isRTL ? 28 + (useCheckboxes == 2 ? 18 : 0) : (68 + padding), 11.5f, LocaleController.isRTL ? (68 + padding) : 28 + (useCheckboxes == 2 ? 18 : 0), 0));
|
||||
|
||||
statusTextView = new SimpleTextView(context);
|
||||
statusTextView.setTextSize(14);
|
||||
statusTextView.setGravity((LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP);
|
||||
addView(statusTextView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 20, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, LocaleController.isRTL ? 28 : (68 + padding), 34.5f, LocaleController.isRTL ? (68 + padding) : 28, 0));
|
||||
statusTextView.setGravity(Gravity.START | Gravity.TOP);
|
||||
addView(statusTextView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 20, Gravity.START | Gravity.TOP, LocaleController.isRTL ? 28 : (68 + padding), 34.5f, LocaleController.isRTL ? (68 + padding) : 28, 0));
|
||||
|
||||
imageView = new ImageView(context);
|
||||
imageView.setScaleType(ImageView.ScaleType.CENTER);
|
||||
imageView.setVisibility(GONE);
|
||||
addView(imageView, LayoutHelper.createFrame(LayoutParams.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.CENTER_VERTICAL, LocaleController.isRTL ? 0 : 16, 0, LocaleController.isRTL ? 16 : 0, 0));
|
||||
addView(imageView, LayoutHelper.createFrame(LayoutParams.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.START | Gravity.CENTER_VERTICAL, LocaleController.isRTL ? 0 : 16, 0, LocaleController.isRTL ? 16 : 0, 0));
|
||||
|
||||
if( useCheckboxes == 1 ) {
|
||||
checkBox = new CheckBoxView(context, R.drawable.round_check2);
|
||||
checkBox.setVisibility(INVISIBLE);
|
||||
addView(checkBox, LayoutHelper.createFrame(22, 22, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, LocaleController.isRTL ? 0 : 37 + padding, 38, LocaleController.isRTL ? 37 + padding : 0, 0));
|
||||
addView(checkBox, LayoutHelper.createFrame(22, 22, Gravity.START | Gravity.TOP, LocaleController.isRTL ? 0 : 37 + padding, 38, LocaleController.isRTL ? 37 + padding : 0, 0));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -377,7 +377,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
}
|
||||
|
||||
@Override
|
||||
public View createView(Context context) {
|
||||
public View createView(final Context context) {
|
||||
|
||||
selectedMessagesIds.clear();
|
||||
|
||||
@@ -396,9 +396,10 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
public void onItemClick(final int id) {
|
||||
if (id == -1) {
|
||||
if (actionBar.isActionModeShowed()) {
|
||||
// finish selection mode
|
||||
selectedMessagesIds.clear();
|
||||
actionBar.hideActionMode();
|
||||
updateVisibleRows();
|
||||
updateVisibleRowsFast();
|
||||
} else {
|
||||
finishFragment();
|
||||
}
|
||||
@@ -418,7 +419,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
AndroidUtilities.addToClipboard(str);
|
||||
selectedMessagesIds.clear();
|
||||
actionBar.hideActionMode();
|
||||
updateVisibleRows();
|
||||
updateVisibleRowsFast();
|
||||
AndroidUtilities.showDoneHint(getParentActivity());
|
||||
} else if (id == ID_DELETE_MESSAGES) {
|
||||
if (getParentActivity() == null) {
|
||||
@@ -430,8 +431,8 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
{
|
||||
Bundle args = new Bundle();
|
||||
args.putBoolean("onlySelect", true);
|
||||
args.putString("onlySelectTitle", LocaleController.getString("ForwardToTitle", R.string.ForwardToTitle));
|
||||
args.putString("selectAlertString", LocaleController.getString("ForwardMessagesTo", R.string.ForwardMessagesTo));
|
||||
args.putString("onlySelectTitle", context.getString(R.string.ForwardToTitle));
|
||||
args.putString("selectAlertString", context.getString(R.string.ForwardMessagesTo));
|
||||
DialogsActivity fragment = new DialogsActivity(args);
|
||||
fragment.setDelegate(ChatActivity.this);
|
||||
presentFragment(fragment); // this results in a call to didSelectDialog()
|
||||
@@ -445,8 +446,8 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
}
|
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
|
||||
builder.setMessage(LocaleController.getString("AreYouSureDeleteThisChat", R.string.AreYouSureDeleteThisChat));
|
||||
builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), new DialogInterface.OnClickListener() {
|
||||
builder.setMessage(context.getString(R.string.AreYouSureDeleteThisChat));
|
||||
builder.setPositiveButton(context.getString(R.string.OK), new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
if( MrMailbox.deleteChat((int)dialog_id)!=0 ) {
|
||||
@@ -458,7 +459,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
}
|
||||
}
|
||||
});
|
||||
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
|
||||
builder.setNegativeButton(context.getString(R.string.Cancel), null);
|
||||
showDialog(builder.create());
|
||||
} else if (id == ID_MUTE) {
|
||||
toggleMute();
|
||||
@@ -471,13 +472,13 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
}
|
||||
else{
|
||||
actionBar.hideActionMode();
|
||||
updateVisibleRows();
|
||||
updateVisibleRowsFast();
|
||||
}
|
||||
} else if (id == ID_INFO) {
|
||||
String info_str = MrMailbox.getMsgInfo(getFirstSelectedId());
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
|
||||
builder.setMessage(info_str);
|
||||
builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), new DialogInterface.OnClickListener() {
|
||||
builder.setPositiveButton(context.getString(R.string.OK), new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
;
|
||||
@@ -485,26 +486,26 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
});
|
||||
showDialog(builder.create());
|
||||
actionBar.hideActionMode();
|
||||
updateVisibleRows();
|
||||
updateVisibleRowsFast();
|
||||
}
|
||||
else if( id== ID_SAVE_TO_XX )
|
||||
{
|
||||
AndroidUtilities.saveMessageFileToExt(getParentActivity(), getFirstSelectedId());
|
||||
actionBar.hideActionMode();
|
||||
updateVisibleRows();
|
||||
updateVisibleRowsFast();
|
||||
}
|
||||
else if( id == ID_OPEN )
|
||||
{
|
||||
// for files, that cannot be handled internally (documents ...), this is equal to a normal click
|
||||
AndroidUtilities.openForViewOrShare(getParentActivity(), getFirstSelectedId(), Intent.ACTION_VIEW);
|
||||
actionBar.hideActionMode();
|
||||
updateVisibleRows();
|
||||
updateVisibleRowsFast();
|
||||
}
|
||||
else if( id== ID_SHARE )
|
||||
{
|
||||
AndroidUtilities.openForViewOrShare(getParentActivity(), getFirstSelectedId(), Intent.ACTION_SEND);
|
||||
actionBar.hideActionMode();
|
||||
updateVisibleRows();
|
||||
updateVisibleRowsFast();
|
||||
}
|
||||
else if (id == ID_ATTACH) {
|
||||
if (getParentActivity() == null) {
|
||||
@@ -537,7 +538,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
searchItem.setVisibility(View.GONE);
|
||||
highlightMessageId = 0;
|
||||
m_searching = false;
|
||||
updateVisibleRows();
|
||||
updateVisibleRowsFast();
|
||||
//scrollToLastMessage(false); -- wo do not scroll down; this does not make sense if the user has just selected a different position by "search"
|
||||
updateBottomOverlay();
|
||||
}
|
||||
@@ -571,13 +572,13 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
handleSearch(SEARCH_DOWN, null);
|
||||
}
|
||||
});
|
||||
searchItem.getSearchField().setHint(LocaleController.getString("Search", R.string.Search));
|
||||
searchItem.getSearchField().setHint(context.getString(R.string.Search));
|
||||
searchItem.setVisibility(View.GONE);
|
||||
|
||||
|
||||
headerItem = menu.addItem(0, R.drawable.ic_ab_other);
|
||||
if (searchItem != null) {
|
||||
headerItem.addSubItem(ID_SEARCH, ApplicationLoader.applicationContext.getString(R.string.Search), 0);
|
||||
headerItem.addSubItem(ID_SEARCH, context.getString(R.string.Search), 0);
|
||||
}
|
||||
|
||||
boolean isChatWithDeaddrop = m_mrChat.getId()==MrChat.MR_CHAT_ID_DEADDROP;
|
||||
@@ -591,8 +592,8 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
}
|
||||
|
||||
if( !isChatWithDeaddrop ) {
|
||||
headerItem.addSubItem(ID_ATTACH, ApplicationLoader.applicationContext.getString(R.string.AttachFiles), 0); // "Attach" means "Attach to chat", not "Attach to message" (which is not possible)
|
||||
headerItem.addSubItem(ID_DELETE_CHAT, ApplicationLoader.applicationContext.getString(R.string.DeleteChat), 0);
|
||||
headerItem.addSubItem(ID_ATTACH, context.getString(R.string.AttachFiles), 0); // "Attach" means "Attach to chat", not "Attach to message" (which is not possible)
|
||||
headerItem.addSubItem(ID_DELETE_CHAT, context.getString(R.string.DeleteChat), 0);
|
||||
}
|
||||
|
||||
updateTitle();
|
||||
@@ -665,7 +666,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
actionModeTextView = new SimpleTextView(context);
|
||||
actionModeTextView.setTextSize(18);
|
||||
actionModeTextView.setTextColor(Theme.ACTION_BAR_ACTION_MODE_TEXT_COLOR);
|
||||
actionModeTextView.setText(LocaleController.getString("Edit", R.string.Edit));
|
||||
actionModeTextView.setText(context.getString(R.string.Edit));
|
||||
actionModeTitleContainer.addView(actionModeTextView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
|
||||
|
||||
actionModeSubTextView = new SimpleTextView(context);
|
||||
@@ -676,13 +677,13 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
actionModeViews.add(actionMode.addItem(ID_FORWARD, R.drawable.ic_ab_fwd_forward, Theme.ACTION_BAR_MODE_SELECTOR_COLOR, null, AndroidUtilities.dp(54)));
|
||||
ActionBarMenuItem submenu = actionMode.addItem(0, R.drawable.ic_ab_other_grey);
|
||||
if( isChatWithDeaddrop ) {
|
||||
m_replyMenuItem = submenu.addSubItem(ID_REPLY, ApplicationLoader.applicationContext.getString(R.string.Reply), 0);
|
||||
m_replyMenuItem = submenu.addSubItem(ID_REPLY, context.getString(R.string.Reply), 0);
|
||||
}
|
||||
submenu.addSubItem(ID_COPY, ApplicationLoader.applicationContext.getString(R.string.CopyToClipboard), 0);
|
||||
submenu.addSubItem(ID_COPY, context.getString(R.string.CopyToClipboard), 0);
|
||||
m_saveToXXMenuItem = submenu.addSubItem(ID_SAVE_TO_XX, "", 0);
|
||||
m_openMenuItem = submenu.addSubItem(ID_OPEN, ApplicationLoader.applicationContext.getString(R.string.Open), 0);
|
||||
m_shareMenuItem = submenu.addSubItem(ID_SHARE, ApplicationLoader.applicationContext.getString(R.string.Share), 0);
|
||||
m_infoMenuItem = submenu.addSubItem(ID_INFO, ApplicationLoader.applicationContext.getString(R.string.Info), 0);
|
||||
m_openMenuItem = submenu.addSubItem(ID_OPEN, context.getString(R.string.Open), 0);
|
||||
m_shareMenuItem = submenu.addSubItem(ID_SHARE, context.getString(R.string.Share), 0);
|
||||
m_infoMenuItem = submenu.addSubItem(ID_INFO, context.getString(R.string.Info), 0);
|
||||
actionModeViews.add(submenu);
|
||||
checkActionBarMenu();
|
||||
|
||||
@@ -820,16 +821,16 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
TextView emptyView = new TextView(context);
|
||||
|
||||
if( m_mrChat.getParamInt(MrChat.MR_CHAT_PARAM_UNPROMOTED, 0)==1 ) {
|
||||
emptyView.setText(LocaleController.getString("MsgNewGroupDraftHint", R.string.MsgNewGroupDraftHint));
|
||||
emptyView.setText(context.getString(R.string.MsgNewGroupDraftHint));
|
||||
emptyView.setGravity(Gravity.LEFT);
|
||||
}
|
||||
else if( m_mrChat.getType()==MrChat.MR_CHAT_NORMAL ){
|
||||
String name = m_mrChat.getName();
|
||||
emptyView.setText(AndroidUtilities.replaceTags(LocaleController.formatString("NoMessagesHint", R.string.NoMessagesHint, name, name)));
|
||||
emptyView.setText(AndroidUtilities.replaceTags(String.format(context.getString(R.string.NoMessagesHint), name, name)));
|
||||
emptyView.setGravity(Gravity.LEFT);
|
||||
}
|
||||
else {
|
||||
emptyView.setText(LocaleController.getString("NoMessages", R.string.NoMessages));
|
||||
emptyView.setText(context.getString(R.string.NoMessages));
|
||||
emptyView.setGravity(Gravity.CENTER);
|
||||
}
|
||||
|
||||
@@ -1365,10 +1366,10 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity()); // was: BottomSheet.Builder
|
||||
//builder.setTitle(LocaleController.getString("Notifications", R.string.Notifications)); -- a title seems more confusing than helping -- the user has clicked "mute" before and there are several options all starting with "mute...", I think, this is very clear
|
||||
CharSequence[] items = new CharSequence[]{
|
||||
ApplicationLoader.applicationContext.getString(R.string.MuteFor1Hour),
|
||||
ApplicationLoader.applicationContext.getString(R.string.MuteFor8Hours),
|
||||
ApplicationLoader.applicationContext.getString(R.string.MuteFor2Days),
|
||||
LocaleController.getString("MuteAlways", R.string.MuteAlways)
|
||||
ProfileNotificationsActivity.muteForString( 60*60),
|
||||
ProfileNotificationsActivity.muteForString( 8*60*60),
|
||||
ProfileNotificationsActivity.muteForString(48*60*60),
|
||||
ApplicationLoader.applicationContext.getString(R.string.MuteAlways)
|
||||
};
|
||||
builder.setItems(items, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
@@ -1434,7 +1435,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
|
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
|
||||
builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), new DialogInterface.OnClickListener() {
|
||||
builder.setPositiveButton(context.getString(R.string.OK), new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
int chatId = MrMailbox.createChatByContactId(fromId);
|
||||
@@ -1448,8 +1449,8 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
}
|
||||
}
|
||||
});
|
||||
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
|
||||
builder.setMessage(AndroidUtilities.replaceTags(LocaleController.formatString("AskStartChatWith", R.string.AskStartChatWith, name)));
|
||||
builder.setNegativeButton(context.getString(R.string.Cancel), null);
|
||||
builder.setMessage(AndroidUtilities.replaceTags(String.format(context.getString(R.string.AskStartChatWith), name)));
|
||||
showDialog(builder.create());
|
||||
}
|
||||
|
||||
@@ -1556,7 +1557,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
hasAttachment = true;
|
||||
m_saveToXXMenuItem.setText(R.string.SaveToMusic);
|
||||
}
|
||||
if( type==MrMsg.MR_MSG_IMAGE || type == MrMsg.MR_MSG_VIDEO ) {
|
||||
if( type==MrMsg.MR_MSG_IMAGE || type==MrMsg.MR_MSG_GIF || type == MrMsg.MR_MSG_VIDEO ) {
|
||||
hasAttachment = true;
|
||||
m_saveToXXMenuItem.setText(R.string.SaveToGallery);
|
||||
}
|
||||
@@ -1581,6 +1582,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
}
|
||||
|
||||
private void processRowSelect(View view) {
|
||||
// add/remove a selected messages in selection mode
|
||||
MessageObject message = null;
|
||||
if (view instanceof ChatMessageCell) {
|
||||
message = ((ChatMessageCell) view).getMessageObject();
|
||||
@@ -1591,7 +1593,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
}
|
||||
addToSelectedMessages(message);
|
||||
updateActionModeTitle();
|
||||
updateVisibleRows();
|
||||
updateVisibleRowsFast();
|
||||
}
|
||||
|
||||
private void updateActionModeTitle() {
|
||||
@@ -1623,9 +1625,9 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
avatarContainer.setTitleIcons(0, rightIcon);
|
||||
if( muteMenuEntry != null ) {
|
||||
if (rightIcon != 0) {
|
||||
muteMenuEntry.setText(LocaleController.getString("UnmuteNotifications", R.string.UnmuteNotifications));
|
||||
muteMenuEntry.setText(ApplicationLoader.applicationContext.getString(R.string.UnmuteNotifications));
|
||||
} else {
|
||||
muteMenuEntry.setText(LocaleController.getString("MuteNotifications", R.string.MuteNotifications));
|
||||
muteMenuEntry.setText(ApplicationLoader.applicationContext.getString(R.string.MuteNotifications));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2089,7 +2091,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
else {
|
||||
highlightMessageId = 0;
|
||||
}
|
||||
updateVisibleRows();
|
||||
updateVisibleRowsFast();
|
||||
|
||||
if( m_lastSearchQuery.isEmpty() ) {
|
||||
searchItem.setExtraSearchInfo("", true, true, true);
|
||||
@@ -2138,9 +2140,9 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
if (m_mrChat.getId()==MrChat.MR_CHAT_ID_DEADDROP) {
|
||||
if( m_msglist.length==0 ) {
|
||||
// showing the DeaddropHint if there are no messages is confusing (there are no "reply arrows" in this case)
|
||||
bottomOverlayChatText.setText(LocaleController.getString("NoMessages", R.string.NoMessages));
|
||||
bottomOverlayChatText.setText(ApplicationLoader.applicationContext.getString(R.string.NoMessages));
|
||||
} else {
|
||||
bottomOverlayChatText.setText(LocaleController.getString("DeaddropHint", R.string.DeaddropHint));
|
||||
bottomOverlayChatText.setText(ApplicationLoader.applicationContext.getString(R.string.DeaddropHint));
|
||||
}
|
||||
bottomOverlayChat.setVisibility(View.VISIBLE);
|
||||
chatActivityEnterView.setVisibility(View.INVISIBLE);
|
||||
@@ -2319,7 +2321,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
private void createDeleteMessagesAlert() {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
|
||||
builder.setMessage(ApplicationLoader.applicationContext.getResources().getQuantityString(R.plurals.AreYouSureDeleteMessages, selectedMessagesIds.size(), selectedMessagesIds.size()));
|
||||
builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), new DialogInterface.OnClickListener() {
|
||||
builder.setPositiveButton(ApplicationLoader.applicationContext.getString(R.string.OK), new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
|
||||
@@ -2340,7 +2342,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
NotificationCenter.getInstance().postNotificationName(NotificationCenter.dialogsNeedReload);
|
||||
}
|
||||
});
|
||||
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
|
||||
builder.setNegativeButton(ApplicationLoader.applicationContext.getString(R.string.Cancel), null);
|
||||
showDialog(builder.create());
|
||||
}
|
||||
|
||||
@@ -2357,6 +2359,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
return;
|
||||
}
|
||||
|
||||
// long click: start selection mode
|
||||
selectedMessagesIds.clear();
|
||||
actionBar.hideActionMode();
|
||||
actionBar.createActionMode();
|
||||
@@ -2375,7 +2378,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
|
||||
addToSelectedMessages(message);
|
||||
selectedMessagesCountTextView.setNumber(1, false);
|
||||
updateVisibleRows();
|
||||
updateVisibleRowsFast();
|
||||
}
|
||||
|
||||
private String getMessageContent(int msg_id, int prev_msg_id)
|
||||
@@ -2434,9 +2437,10 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
@Override
|
||||
public boolean onBackPressed() {
|
||||
if (actionBar.isActionModeShowed()) {
|
||||
// finish selection mode
|
||||
selectedMessagesIds.clear();
|
||||
actionBar.hideActionMode();
|
||||
updateVisibleRows();
|
||||
updateVisibleRowsFast();
|
||||
return false;
|
||||
} else if (chatActivityEnterView.isPopupShowing()) {
|
||||
chatActivityEnterView.hidePopup(true);
|
||||
@@ -2446,9 +2450,48 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
}
|
||||
|
||||
private void updateVisibleRows() {
|
||||
// update by reloading all messages cells from disk.
|
||||
// this is slow, but works always, eg. on deletion of messages.
|
||||
chatAdapter.notifyDataSetChanged();
|
||||
}
|
||||
|
||||
private void updateVisibleRowsFast()
|
||||
{
|
||||
// faster update, works only for selecting message cells
|
||||
// (we do some stuff normally done in onBindViewHolder() here)
|
||||
int count = chatListView.getChildCount();
|
||||
for (int a = 0; a < count; a++) {
|
||||
View view_ = chatListView.getChildAt(a);
|
||||
if (view_ instanceof ChatMessageCell) {
|
||||
ChatMessageCell messageCell = (ChatMessageCell)view_;
|
||||
boolean selected = false;
|
||||
boolean disableSelection = false;
|
||||
if (actionBar.isActionModeShowed()) {
|
||||
if ( selectedMessagesIds.containsKey(messageCell.getMessageObject().getId()) ) {
|
||||
messageCell.setBackgroundColor(Theme.MSG_SELECTED_BACKGROUND_COLOR);
|
||||
selected = true;
|
||||
} else {
|
||||
messageCell.setBackgroundColor(0);
|
||||
}
|
||||
disableSelection = true;
|
||||
} else {
|
||||
messageCell.setBackgroundColor(0);
|
||||
}
|
||||
|
||||
messageCell.setCheckPressed(!disableSelection, disableSelection && selected);
|
||||
messageCell.setHighlighted(highlightMessageId != 0 && messageCell.getMessageObject().getId() == highlightMessageId);
|
||||
|
||||
if (m_searching && !m_lastSearchQuery.isEmpty()) {
|
||||
messageCell.setHighlightedText(m_lastSearchQuery);
|
||||
} else {
|
||||
messageCell.setHighlightedText(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
chatListView.invalidate();
|
||||
}
|
||||
|
||||
private void openSearchWithText(String text) {
|
||||
avatarContainer.setVisibility(View.GONE);
|
||||
headerItem.setVisibility(View.GONE);
|
||||
@@ -2670,14 +2713,14 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
if( isMailto )
|
||||
{
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
|
||||
builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), new DialogInterface.OnClickListener() {
|
||||
builder.setPositiveButton(mContext.getString(R.string.OK), new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
createChat(urlFinal);
|
||||
}
|
||||
});
|
||||
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
|
||||
builder.setMessage(AndroidUtilities.replaceTags(LocaleController.formatString("AskStartChatWith", R.string.AskStartChatWith, urlTitle)));
|
||||
builder.setNegativeButton(mContext.getString(R.string.Cancel), null);
|
||||
builder.setMessage(AndroidUtilities.replaceTags(String.format(mContext.getString(R.string.AskStartChatWith), urlTitle)));
|
||||
showDialog(builder.create());
|
||||
}
|
||||
else
|
||||
|
||||
@@ -62,7 +62,6 @@ import android.widget.TextView;
|
||||
|
||||
import com.b44t.messenger.AndroidUtilities;
|
||||
import com.b44t.messenger.Emoji;
|
||||
import com.b44t.messenger.LocaleController;
|
||||
import com.b44t.messenger.MediaController;
|
||||
import com.b44t.messenger.MessageObject;
|
||||
import com.b44t.messenger.MrContact;
|
||||
@@ -465,7 +464,7 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
|
||||
});
|
||||
|
||||
messageEditText = new EditTextCaption(context);
|
||||
messageEditText.setHint(LocaleController.getString("TypeMessage", R.string.TypeMessage));
|
||||
messageEditText.setHint(context.getString(R.string.TypeMessage));
|
||||
|
||||
int addImeFlag = 0, addInputType = 0;
|
||||
if( sendByEnter ) {
|
||||
@@ -666,7 +665,7 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
|
||||
slideText.addView(imageView, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER_VERTICAL, 0, 1, 0, 0));
|
||||
|
||||
TextView textView = new TextView(context);
|
||||
textView.setText(LocaleController.getString("SlideToCancel", R.string.SlideToCancel));
|
||||
textView.setText(context.getString(R.string.SlideToCancel));
|
||||
textView.setTextColor(0xff999999);
|
||||
textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 12);
|
||||
slideText.addView(textView, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER_VERTICAL, 6, 0, 0, 0));
|
||||
@@ -1415,14 +1414,14 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
|
||||
return;
|
||||
}
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(parentActivity);
|
||||
builder.setMessage(LocaleController.getString("ClearRecentEmoji", R.string.ClearRecentEmoji));
|
||||
builder.setPositiveButton(LocaleController.getString("ClearButton", R.string.ClearButton).toUpperCase(), new DialogInterface.OnClickListener() {
|
||||
builder.setMessage(ApplicationLoader.applicationContext.getString(R.string.ClearRecentEmoji));
|
||||
builder.setPositiveButton(ApplicationLoader.applicationContext.getString(R.string.ClearButton).toUpperCase(), new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
emojiView.clearRecentEmoji();
|
||||
}
|
||||
});
|
||||
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
|
||||
builder.setNegativeButton(ApplicationLoader.applicationContext.getString(R.string.Cancel), null);
|
||||
parentFragment.showDialog(builder.create());
|
||||
}
|
||||
});
|
||||
|
||||
@@ -65,6 +65,7 @@ import com.b44t.ui.PhotoViewer;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
|
||||
public class ChatAttachAlert extends BottomSheet implements NotificationCenter.NotificationCenterDelegate, PhotoViewer.PhotoViewerProvider, BottomSheet.BottomSheetDelegateInterface {
|
||||
|
||||
@@ -322,10 +323,10 @@ public class ChatAttachAlert extends BottomSheet implements NotificationCenter.N
|
||||
|
||||
views[9] = progressView = new EmptyTextProgressView(context);
|
||||
if (Build.VERSION.SDK_INT >= 23 && getContext().checkSelfPermission(Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
|
||||
progressView.setText(LocaleController.getString("PermissionStorage", R.string.PermissionStorage));
|
||||
progressView.setText(context.getString(R.string.PermissionStorage));
|
||||
progressView.setTextSize(16);
|
||||
} else {
|
||||
progressView.setText(LocaleController.getString("NoPhotos", R.string.NoPhotos));
|
||||
progressView.setText(context.getString(R.string.NoPhotos));
|
||||
progressView.setTextSize(20);
|
||||
}
|
||||
attachView.addView(progressView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 80));
|
||||
@@ -424,14 +425,14 @@ public class ChatAttachAlert extends BottomSheet implements NotificationCenter.N
|
||||
} else {
|
||||
sendPhotosButton.imageView.setPadding(AndroidUtilities.dp(2), 0, 0, 0);
|
||||
sendPhotosButton.imageView.setBackgroundResource(R.drawable.attach_send_states);
|
||||
sendPhotosButton.textView.setText(LocaleController.formatString("SendItems", R.string.SendItems, String.format("%d", count)));
|
||||
sendPhotosButton.textView.setText(String.format(ApplicationLoader.applicationContext.getString(R.string.SendItems), String.format(Locale.getDefault(), "%d", count)));
|
||||
}
|
||||
|
||||
if (Build.VERSION.SDK_INT >= 23 && getContext().checkSelfPermission(Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
|
||||
progressView.setText(LocaleController.getString("PermissionStorage", R.string.PermissionStorage));
|
||||
progressView.setText(ApplicationLoader.applicationContext.getString(R.string.PermissionStorage));
|
||||
progressView.setTextSize(16);
|
||||
} else {
|
||||
progressView.setText(LocaleController.getString("NoPhotos", R.string.NoPhotos));
|
||||
progressView.setText(ApplicationLoader.applicationContext.getString(R.string.NoPhotos));
|
||||
progressView.setTextSize(20);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -704,50 +704,12 @@ public class EmojiView extends FrameLayout implements NotificationCenter.Notific
|
||||
listener.onGifSelected(document);
|
||||
}
|
||||
});
|
||||
gifsGridView.setOnItemLongClickListener(new RecyclerListView.OnItemLongClickListener() {
|
||||
@Override
|
||||
public boolean onItemClick(View view, int position) {
|
||||
if (position < 0 || position >= recentImages.size()) {
|
||||
return false;
|
||||
}
|
||||
final MediaController.SearchImage searchImage = recentImages.get(position);
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(view.getContext());
|
||||
builder.setMessage(LocaleController.getString("DeleteGif", R.string.DeleteGif));
|
||||
builder.setPositiveButton(LocaleController.getString("OK", R.string.OK).toUpperCase(), new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
recentImages.remove(searchImage);
|
||||
/*TLRPC.TL_messages_saveGif req = new TLRPC.TL_messages_saveGif();
|
||||
req.id = new TLRPC.TL_inputDocument();
|
||||
req.id.id = searchImage.document.id;
|
||||
req.id.access_hash = searchImage.document.access_hash;
|
||||
req.unsave = true;
|
||||
ConnectionsManager.getInstance().sendRequest(req, new RequestDelegate() {
|
||||
@Override
|
||||
public void run(TLObject response, TLRPC.TL_error error) {
|
||||
|
||||
}
|
||||
});*/
|
||||
//MessagesStorage.getInstance().removeWebRecent(searchImage);
|
||||
if (gifsAdapter != null) {
|
||||
gifsAdapter.notifyDataSetChanged();
|
||||
}
|
||||
if (recentImages.isEmpty()) {
|
||||
updateStickerTabs();
|
||||
}
|
||||
}
|
||||
});
|
||||
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
|
||||
builder.show().setCanceledOnTouchOutside(true);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
gifsGridView.setVisibility(GONE);
|
||||
stickersWrap.addView(gifsGridView);
|
||||
}
|
||||
|
||||
stickersEmptyView = new TextView(context);
|
||||
stickersEmptyView.setText(LocaleController.getString("NoStickers", R.string.NoStickers));
|
||||
stickersEmptyView.setText("ErrNoStickers");
|
||||
stickersEmptyView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18);
|
||||
stickersEmptyView.setTextColor(0xff888888);
|
||||
stickersWrap.addView(stickersEmptyView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER));
|
||||
@@ -965,7 +927,7 @@ public class EmojiView extends FrameLayout implements NotificationCenter.Notific
|
||||
recentsWrap.addView(views.get(0));
|
||||
|
||||
TextView textView = new TextView(context);
|
||||
textView.setText(LocaleController.getString("NoRecent", R.string.NoRecent));
|
||||
textView.setText(context.getString(R.string.NoRecent));
|
||||
textView.setTextSize(18);
|
||||
textView.setTextColor(0xff888888);
|
||||
textView.setGravity(Gravity.CENTER);
|
||||
|
||||
@@ -55,7 +55,7 @@ public class EmptyTextProgressView extends FrameLayout {
|
||||
textView.setGravity(Gravity.CENTER);
|
||||
textView.setVisibility(INVISIBLE);
|
||||
textView.setPadding(AndroidUtilities.dp(20), 0, AndroidUtilities.dp(20), 0);
|
||||
textView.setText(LocaleController.getString("NoResult", R.string.NoResult));
|
||||
textView.setText(context.getString(R.string.NoResult));
|
||||
addView(textView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT));
|
||||
|
||||
setOnTouchListener(new View.OnTouchListener() {
|
||||
|
||||
@@ -531,7 +531,7 @@ public class PasscodeView extends FrameLayout {
|
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
|
||||
builder.setView(relativeLayout);
|
||||
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
|
||||
builder.setNegativeButton(ApplicationLoader.applicationContext.getString(R.string.Cancel), null);
|
||||
builder.setOnDismissListener(new DialogInterface.OnDismissListener() {
|
||||
@Override
|
||||
public void onDismiss(DialogInterface dialog) {
|
||||
@@ -570,7 +570,7 @@ public class PasscodeView extends FrameLayout {
|
||||
|
||||
@Override
|
||||
public void onAuthenticationFailed() {
|
||||
showFingerprintError(LocaleController.getString("FingerprintNotRecognized", R.string.FingerprintNotRecognized));
|
||||
showFingerprintError(ApplicationLoader.applicationContext.getString(R.string.FingerprintNotRecognized));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -622,7 +622,7 @@ public class PasscodeView extends FrameLayout {
|
||||
backgroundFrameLayout.setBackgroundColor(Theme.ACTION_BAR_COLOR);
|
||||
}
|
||||
|
||||
passcodeTextView.setText(LocaleController.getString("EnterYourPasscode", R.string.EnterYourPasscode));
|
||||
passcodeTextView.setText(ApplicationLoader.applicationContext.getString(R.string.EnterYourPasscode));
|
||||
|
||||
if (UserConfig.passcodeType == 0) {
|
||||
numbersFrameLayout.setVisibility(VISIBLE);
|
||||
|
||||
@@ -48,6 +48,7 @@ import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.b44t.messenger.AndroidUtilities;
|
||||
import com.b44t.messenger.ApplicationLoader;
|
||||
import com.b44t.messenger.LocaleController;
|
||||
import com.b44t.messenger.support.widget.LinearLayoutManager;
|
||||
import com.b44t.messenger.support.widget.RecyclerView;
|
||||
@@ -1991,7 +1992,7 @@ public class PhotoFilterView extends FrameLayout {
|
||||
}
|
||||
}
|
||||
|
||||
public PhotoFilterView(Context context, Bitmap bitmap, int rotation) {
|
||||
public PhotoFilterView(final Context context, Bitmap bitmap, int rotation) {
|
||||
super(context);
|
||||
|
||||
bitmapToEdit = bitmap;
|
||||
@@ -2086,7 +2087,7 @@ public class PhotoFilterView extends FrameLayout {
|
||||
cancelTextView.setGravity(Gravity.CENTER);
|
||||
cancelTextView.setBackgroundDrawable(Theme.createBarSelectorDrawable(Theme.ACTION_BAR_PICKER_SELECTOR_COLOR, false));
|
||||
cancelTextView.setPadding(AndroidUtilities.dp(29), 0, AndroidUtilities.dp(29), 0);
|
||||
cancelTextView.setText(LocaleController.getString("Cancel", R.string.Cancel).toUpperCase());
|
||||
cancelTextView.setText(context.getString(R.string.Cancel).toUpperCase());
|
||||
frameLayout.addView(cancelTextView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.MATCH_PARENT, Gravity.TOP | Gravity.LEFT));
|
||||
|
||||
doneTextView = new TextView(context);
|
||||
@@ -2095,7 +2096,7 @@ public class PhotoFilterView extends FrameLayout {
|
||||
doneTextView.setGravity(Gravity.CENTER);
|
||||
doneTextView.setBackgroundDrawable(Theme.createBarSelectorDrawable(Theme.ACTION_BAR_PICKER_SELECTOR_COLOR, false));
|
||||
doneTextView.setPadding(AndroidUtilities.dp(29), 0, AndroidUtilities.dp(29), 0);
|
||||
doneTextView.setText(LocaleController.getString("Done", R.string.Done).toUpperCase());
|
||||
doneTextView.setText(context.getString(R.string.Done).toUpperCase());
|
||||
doneTextView.setTypeface(Typeface.DEFAULT_BOLD);
|
||||
frameLayout.addView(doneTextView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.MATCH_PARENT, Gravity.TOP | Gravity.RIGHT));
|
||||
|
||||
@@ -2115,47 +2116,47 @@ public class PhotoFilterView extends FrameLayout {
|
||||
if (position == enhanceTool) {
|
||||
previousValue = enhanceValue;
|
||||
valueSeekBar.setMinMax(0, 100);
|
||||
paramTextView.setText(LocaleController.getString("Enhance", R.string.Enhance));
|
||||
paramTextView.setText(context.getString(R.string.Enhance));
|
||||
} else if (position == highlightsTool) {
|
||||
previousValue = highlightsValue;
|
||||
valueSeekBar.setMinMax(-100, 100);
|
||||
paramTextView.setText(LocaleController.getString("Highlights", R.string.Highlights));
|
||||
paramTextView.setText(context.getString(R.string.Highlights));
|
||||
} else if (position == contrastTool) {
|
||||
previousValue = contrastValue;
|
||||
valueSeekBar.setMinMax(-100, 100);
|
||||
paramTextView.setText(LocaleController.getString("Contrast", R.string.Contrast));
|
||||
paramTextView.setText(context.getString(R.string.Contrast));
|
||||
} else if (position == exposureTool) {
|
||||
previousValue = exposureValue;
|
||||
valueSeekBar.setMinMax(-100, 100);
|
||||
paramTextView.setText(LocaleController.getString("Exposure", R.string.Exposure));
|
||||
paramTextView.setText(context.getString(R.string.Exposure));
|
||||
} else if (position == warmthTool) {
|
||||
previousValue = warmthValue;
|
||||
valueSeekBar.setMinMax(-100, 100);
|
||||
paramTextView.setText(LocaleController.getString("Warmth", R.string.Warmth));
|
||||
paramTextView.setText(context.getString(R.string.Warmth));
|
||||
} else if (position == saturationTool) {
|
||||
previousValue = saturationValue;
|
||||
valueSeekBar.setMinMax(-100, 100);
|
||||
paramTextView.setText(LocaleController.getString("Saturation", R.string.Saturation));
|
||||
paramTextView.setText(context.getString(R.string.Saturation));
|
||||
} else if (position == vignetteTool) {
|
||||
previousValue = vignetteValue;
|
||||
valueSeekBar.setMinMax(0, 100);
|
||||
paramTextView.setText(LocaleController.getString("Vignette", R.string.Vignette));
|
||||
paramTextView.setText(context.getString(R.string.Vignette));
|
||||
} else if (position == shadowsTool) {
|
||||
previousValue = shadowsValue;
|
||||
valueSeekBar.setMinMax(-100, 100);
|
||||
paramTextView.setText(LocaleController.getString("Shadows", R.string.Shadows));
|
||||
paramTextView.setText(context.getString(R.string.Shadows));
|
||||
} else if (position == grainTool) {
|
||||
previousValue = grainValue;
|
||||
valueSeekBar.setMinMax(0, 100);
|
||||
paramTextView.setText(LocaleController.getString("Grain", R.string.Grain));
|
||||
paramTextView.setText(context.getString(R.string.Grain));
|
||||
} else if (position == fadeTool) {
|
||||
previousValue = fadeValue;
|
||||
valueSeekBar.setMinMax(0, 100);
|
||||
paramTextView.setText(LocaleController.getString("Fade", R.string.Fade));
|
||||
paramTextView.setText(context.getString(R.string.Fade));
|
||||
} else if (position == sharpenTool) {
|
||||
previousValue = sharpenValue;
|
||||
valueSeekBar.setMinMax(0, 100);
|
||||
paramTextView.setText(LocaleController.getString("Sharpen", R.string.Sharpen));
|
||||
paramTextView.setText(context.getString(R.string.Sharpen));
|
||||
} else if (position == blurTool) {
|
||||
previousValueInt = blurType;
|
||||
} else if (position == tintTool) {
|
||||
@@ -2306,13 +2307,13 @@ public class PhotoFilterView extends FrameLayout {
|
||||
curveTextView[a].setGravity(Gravity.CENTER_VERTICAL);
|
||||
curveTextView[a].setTag(a);
|
||||
if (a == 0) {
|
||||
curveTextView[a].setText(LocaleController.getString("CurvesAll", R.string.CurvesAll).toUpperCase());
|
||||
curveTextView[a].setText(context.getString(R.string.CurvesAll).toUpperCase());
|
||||
} else if (a == 1) {
|
||||
curveTextView[a].setText(LocaleController.getString("CurvesRed", R.string.CurvesRed).toUpperCase());
|
||||
curveTextView[a].setText(context.getString(R.string.CurvesRed).toUpperCase());
|
||||
} else if (a == 2) {
|
||||
curveTextView[a].setText(LocaleController.getString("CurvesGreen", R.string.CurvesGreen).toUpperCase());
|
||||
curveTextView[a].setText(context.getString(R.string.CurvesGreen).toUpperCase());
|
||||
} else if (a == 3) {
|
||||
curveTextView[a].setText(LocaleController.getString("CurvesBlue", R.string.CurvesBlue).toUpperCase());
|
||||
curveTextView[a].setText(context.getString(R.string.CurvesBlue).toUpperCase());
|
||||
}
|
||||
curveTextViewContainer.addView(curveTextView[a], LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, 28, a == 0 ? 0 : 30, 0, 0, 0));
|
||||
curveTextView[a].setOnClickListener(new OnClickListener() {
|
||||
@@ -2338,7 +2339,7 @@ public class PhotoFilterView extends FrameLayout {
|
||||
tintShadowsButton = new TextView(context);
|
||||
tintShadowsButton.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
|
||||
tintShadowsButton.setGravity(Gravity.CENTER_VERTICAL);
|
||||
tintShadowsButton.setText(LocaleController.getString("TintShadows", R.string.TintShadows).toUpperCase());
|
||||
tintShadowsButton.setText(context.getString(R.string.TintShadows).toUpperCase());
|
||||
tintTextViewContainer.addView(tintShadowsButton, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, 28));
|
||||
tintShadowsButton.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
@@ -2351,7 +2352,7 @@ public class PhotoFilterView extends FrameLayout {
|
||||
tintHighlightsButton = new TextView(context);
|
||||
tintHighlightsButton.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
|
||||
tintHighlightsButton.setGravity(Gravity.CENTER_VERTICAL);
|
||||
tintHighlightsButton.setText(LocaleController.getString("TintHighlights", R.string.TintHighlights).toUpperCase());
|
||||
tintHighlightsButton.setText(context.getString(R.string.TintHighlights).toUpperCase());
|
||||
tintTextViewContainer.addView(tintHighlightsButton, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, 28, 100, 0, 0, 0));
|
||||
tintHighlightsButton.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
@@ -2396,7 +2397,7 @@ public class PhotoFilterView extends FrameLayout {
|
||||
blurOffButton.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 13);
|
||||
blurOffButton.setTextColor(0xff51bdf3);
|
||||
blurOffButton.setGravity(Gravity.CENTER_HORIZONTAL);
|
||||
blurOffButton.setText(LocaleController.getString("BlurOff", R.string.BlurOff));
|
||||
blurOffButton.setText(context.getString(R.string.BlurOff));
|
||||
blurLayout.addView(blurOffButton, LayoutHelper.createFrame(80, 60));
|
||||
blurOffButton.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
@@ -2416,7 +2417,7 @@ public class PhotoFilterView extends FrameLayout {
|
||||
blurRadialButton.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 13);
|
||||
blurRadialButton.setTextColor(0xffffffff);
|
||||
blurRadialButton.setGravity(Gravity.CENTER_HORIZONTAL);
|
||||
blurRadialButton.setText(LocaleController.getString("BlurRadial", R.string.BlurRadial));
|
||||
blurRadialButton.setText(context.getString(R.string.BlurRadial));
|
||||
blurLayout.addView(blurRadialButton, LayoutHelper.createFrame(80, 80, Gravity.LEFT | Gravity.TOP, 100, 0, 0, 0));
|
||||
blurRadialButton.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
@@ -2437,7 +2438,7 @@ public class PhotoFilterView extends FrameLayout {
|
||||
blurLinearButton.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 13);
|
||||
blurLinearButton.setTextColor(0xffffffff);
|
||||
blurLinearButton.setGravity(Gravity.CENTER_HORIZONTAL);
|
||||
blurLinearButton.setText(LocaleController.getString("BlurLinear", R.string.BlurLinear));
|
||||
blurLinearButton.setText(context.getString(R.string.BlurLinear));
|
||||
blurLayout.addView(blurLinearButton, LayoutHelper.createFrame(80, 80, Gravity.LEFT | Gravity.TOP, 200, 0, 0, 0));
|
||||
blurLinearButton.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
@@ -2565,12 +2566,12 @@ public class PhotoFilterView extends FrameLayout {
|
||||
tintLayout.setVisibility(selectedTool == tintTool ? VISIBLE : INVISIBLE);
|
||||
curveLayout.setVisibility(selectedTool == curvesTool ? VISIBLE : INVISIBLE);
|
||||
if (selectedTool == blurTool) {
|
||||
infoTextView.setText(LocaleController.getString("Blur", R.string.Blur));
|
||||
infoTextView.setText(ApplicationLoader.applicationContext.getString(R.string.Blur));
|
||||
if (blurType != 0) {
|
||||
blurControl.setVisibility(VISIBLE);
|
||||
}
|
||||
} else if (selectedTool == curvesTool) {
|
||||
infoTextView.setText(LocaleController.getString("Curves", R.string.Curves));
|
||||
infoTextView.setText(ApplicationLoader.applicationContext.getString(R.string.Curves));
|
||||
curvesControl.setVisibility(VISIBLE);
|
||||
curvesToolValue.activeType = 0;
|
||||
for (int a = 0; a < 4; a++) {
|
||||
@@ -2579,7 +2580,7 @@ public class PhotoFilterView extends FrameLayout {
|
||||
} else {
|
||||
selectedTintMode = 0;
|
||||
updateSelectedTintButton(false);
|
||||
infoTextView.setText(LocaleController.getString("Tint", R.string.Tint));
|
||||
infoTextView.setText(ApplicationLoader.applicationContext.getString(R.string.Tint));
|
||||
}
|
||||
infoTextView.setVisibility(VISIBLE);
|
||||
valueSeekBar.setVisibility(INVISIBLE);
|
||||
@@ -2798,7 +2799,7 @@ public class PhotoFilterView extends FrameLayout {
|
||||
previousValue = enhanceValue;
|
||||
enhanceValue = 50;
|
||||
valueSeekBar.setMinMax(0, 100);
|
||||
paramTextView.setText(LocaleController.getString("Enhance", R.string.Enhance));
|
||||
paramTextView.setText(ApplicationLoader.applicationContext.getString(R.string.Enhance));
|
||||
editView.setVisibility(VISIBLE);
|
||||
toolsView.setVisibility(GONE);
|
||||
valueSeekBar.setProgress(50, false);
|
||||
@@ -2849,31 +2850,31 @@ public class PhotoFilterView extends FrameLayout {
|
||||
public void onBindViewHolder(RecyclerView.ViewHolder viewHolder, int i) {
|
||||
Holder holder = (Holder) viewHolder;
|
||||
if (i == enhanceTool) {
|
||||
((PhotoEditToolCell) holder.itemView).setIconAndTextAndValue(R.drawable.tool_enhance, LocaleController.getString("Enhance", R.string.Enhance), enhanceValue);
|
||||
((PhotoEditToolCell) holder.itemView).setIconAndTextAndValue(R.drawable.tool_enhance, mContext.getString(R.string.Enhance), enhanceValue);
|
||||
} else if (i == highlightsTool) {
|
||||
((PhotoEditToolCell) holder.itemView).setIconAndTextAndValue(R.drawable.tool_highlights, LocaleController.getString("Highlights", R.string.Highlights), highlightsValue);
|
||||
((PhotoEditToolCell) holder.itemView).setIconAndTextAndValue(R.drawable.tool_highlights, mContext.getString(R.string.Highlights), highlightsValue);
|
||||
} else if (i == contrastTool) {
|
||||
((PhotoEditToolCell) holder.itemView).setIconAndTextAndValue(R.drawable.tool_contrast, LocaleController.getString("Contrast", R.string.Contrast), contrastValue);
|
||||
((PhotoEditToolCell) holder.itemView).setIconAndTextAndValue(R.drawable.tool_contrast, mContext.getString(R.string.Contrast), contrastValue);
|
||||
} else if (i == exposureTool) {
|
||||
((PhotoEditToolCell) holder.itemView).setIconAndTextAndValue(R.drawable.tool_brightness, LocaleController.getString("Exposure", R.string.Exposure), exposureValue);
|
||||
((PhotoEditToolCell) holder.itemView).setIconAndTextAndValue(R.drawable.tool_brightness, mContext.getString(R.string.Exposure), exposureValue);
|
||||
} else if (i == warmthTool) {
|
||||
((PhotoEditToolCell) holder.itemView).setIconAndTextAndValue(R.drawable.tool_warmth, LocaleController.getString("Warmth", R.string.Warmth), warmthValue);
|
||||
((PhotoEditToolCell) holder.itemView).setIconAndTextAndValue(R.drawable.tool_warmth, mContext.getString(R.string.Warmth), warmthValue);
|
||||
} else if (i == saturationTool) {
|
||||
((PhotoEditToolCell) holder.itemView).setIconAndTextAndValue(R.drawable.tool_saturation, LocaleController.getString("Saturation", R.string.Saturation), saturationValue);
|
||||
((PhotoEditToolCell) holder.itemView).setIconAndTextAndValue(R.drawable.tool_saturation, mContext.getString(R.string.Saturation), saturationValue);
|
||||
} else if (i == vignetteTool) {
|
||||
((PhotoEditToolCell) holder.itemView).setIconAndTextAndValue(R.drawable.tool_vignette, LocaleController.getString("Vignette", R.string.Vignette), vignetteValue);
|
||||
((PhotoEditToolCell) holder.itemView).setIconAndTextAndValue(R.drawable.tool_vignette, mContext.getString(R.string.Vignette), vignetteValue);
|
||||
} else if (i == shadowsTool) {
|
||||
((PhotoEditToolCell) holder.itemView).setIconAndTextAndValue(R.drawable.tool_shadows, LocaleController.getString("Shadows", R.string.Shadows), shadowsValue);
|
||||
((PhotoEditToolCell) holder.itemView).setIconAndTextAndValue(R.drawable.tool_shadows, mContext.getString(R.string.Shadows), shadowsValue);
|
||||
} else if (i == grainTool) {
|
||||
((PhotoEditToolCell) holder.itemView).setIconAndTextAndValue(R.drawable.tool_grain, LocaleController.getString("Grain", R.string.Grain), grainValue);
|
||||
((PhotoEditToolCell) holder.itemView).setIconAndTextAndValue(R.drawable.tool_grain, mContext.getString(R.string.Grain), grainValue);
|
||||
} else if (i == sharpenTool) {
|
||||
((PhotoEditToolCell) holder.itemView).setIconAndTextAndValue(R.drawable.tool_details, LocaleController.getString("Sharpen", R.string.Sharpen), sharpenValue);
|
||||
((PhotoEditToolCell) holder.itemView).setIconAndTextAndValue(R.drawable.tool_details, mContext.getString(R.string.Sharpen), sharpenValue);
|
||||
} else if (i == tintTool) {
|
||||
((PhotoEditToolCell) holder.itemView).setIconAndTextAndValue(R.drawable.tool_tint, LocaleController.getString("Tint", R.string.Tint), tintHighlightsColor != 0 || tintShadowsColor != 0 ? "◆" : "");
|
||||
((PhotoEditToolCell) holder.itemView).setIconAndTextAndValue(R.drawable.tool_tint, mContext.getString(R.string.Tint), tintHighlightsColor != 0 || tintShadowsColor != 0 ? "◆" : "");
|
||||
} else if (i == fadeTool) {
|
||||
((PhotoEditToolCell) holder.itemView).setIconAndTextAndValue(R.drawable.tool_fade, LocaleController.getString("Fade", R.string.Fade), fadeValue);
|
||||
((PhotoEditToolCell) holder.itemView).setIconAndTextAndValue(R.drawable.tool_fade, mContext.getString(R.string.Fade), fadeValue);
|
||||
} else if (i == curvesTool) {
|
||||
((PhotoEditToolCell) holder.itemView).setIconAndTextAndValue(R.drawable.tool_curve, LocaleController.getString("Curves", R.string.Curves), curvesToolValue.shouldBeSkipped() ? "" : "◆");
|
||||
((PhotoEditToolCell) holder.itemView).setIconAndTextAndValue(R.drawable.tool_curve, mContext.getString(R.string.Curves), curvesToolValue.shouldBeSkipped() ? "" : "◆");
|
||||
} else if (i == blurTool) {
|
||||
String value = "";
|
||||
if (blurType == 1) {
|
||||
@@ -2881,7 +2882,7 @@ public class PhotoFilterView extends FrameLayout {
|
||||
} else if (blurType == 2) {
|
||||
value = "L";
|
||||
}
|
||||
((PhotoEditToolCell) holder.itemView).setIconAndTextAndValue(R.drawable.tool_blur, LocaleController.getString("Blur", R.string.Blur), value);
|
||||
((PhotoEditToolCell) holder.itemView).setIconAndTextAndValue(R.drawable.tool_blur, mContext.getString(R.string.Blur), value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ public class PickerBottomLayout extends FrameLayout {
|
||||
cancelButton.setGravity(Gravity.CENTER);
|
||||
cancelButton.setBackgroundDrawable(Theme.createBarSelectorDrawable(isDarkTheme ? Theme.ACTION_BAR_PICKER_SELECTOR_COLOR : Theme.ACTION_BAR_AUDIO_SELECTOR_COLOR, false));
|
||||
cancelButton.setPadding(AndroidUtilities.dp(29), 0, AndroidUtilities.dp(29), 0);
|
||||
cancelButton.setText(LocaleController.getString("Cancel", R.string.Cancel).toUpperCase());
|
||||
cancelButton.setText(context.getString(R.string.Cancel).toUpperCase());
|
||||
addView(cancelButton, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.MATCH_PARENT, Gravity.TOP | Gravity.LEFT));
|
||||
|
||||
doneButton = new LinearLayout(context);
|
||||
@@ -85,7 +85,7 @@ public class PickerBottomLayout extends FrameLayout {
|
||||
doneButtonTextView.setTextColor(isDarkTheme ? 0xffffffff : 0xff19a7e8);
|
||||
doneButtonTextView.setGravity(Gravity.CENTER);
|
||||
doneButtonTextView.setCompoundDrawablePadding(AndroidUtilities.dp(8));
|
||||
doneButtonTextView.setText(LocaleController.getString("Send", R.string.Send).toUpperCase());
|
||||
doneButtonTextView.setText(context.getString(R.string.Send).toUpperCase());
|
||||
doneButtonTextView.setTypeface(Typeface.DEFAULT_BOLD);
|
||||
doneButton.addView(doneButtonTextView, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER_VERTICAL));
|
||||
}
|
||||
|
||||
@@ -40,6 +40,7 @@ import android.widget.LinearLayout;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.b44t.messenger.AndroidUtilities;
|
||||
import com.b44t.messenger.ApplicationLoader;
|
||||
import com.b44t.messenger.ContactsController;
|
||||
import com.b44t.messenger.LocaleController;
|
||||
import com.b44t.messenger.MrContact;
|
||||
@@ -109,14 +110,14 @@ public class ContactAddActivity extends BaseFragment implements NotificationCent
|
||||
}
|
||||
|
||||
@Override
|
||||
public View createView(Context context) {
|
||||
public View createView(final Context context) {
|
||||
|
||||
actionBar.setBackButtonImage(R.drawable.ic_close_white);
|
||||
actionBar.setAllowOverlayTitle(true);
|
||||
if (do_what==CREATE_CONTACT) {
|
||||
actionBar.setTitle(LocaleController.getString("NewContactTitle", R.string.NewContactTitle));
|
||||
actionBar.setTitle(context.getString(R.string.NewContactTitle));
|
||||
} else {
|
||||
actionBar.setTitle(LocaleController.getString("EditName", R.string.EditName));
|
||||
actionBar.setTitle(context.getString(R.string.EditName));
|
||||
if( user_id!=0 ) {
|
||||
nameToSet = MrMailbox.getContact(user_id).getDisplayName();
|
||||
}
|
||||
@@ -147,7 +148,7 @@ public class ContactAddActivity extends BaseFragment implements NotificationCent
|
||||
|
||||
int new_user_id;
|
||||
if( (new_user_id=MrMailbox.createContact(name, addr))==0 ) {
|
||||
Toast.makeText(getParentActivity(), LocaleController.getString("BadEmailAddress", R.string.BadEmailAddress), Toast.LENGTH_LONG).show();
|
||||
Toast.makeText(getParentActivity(), context.getString(R.string.BadEmailAddress), Toast.LENGTH_LONG).show();
|
||||
return;
|
||||
}
|
||||
else if (do_what==CREATE_CONTACT) {
|
||||
@@ -163,7 +164,7 @@ public class ContactAddActivity extends BaseFragment implements NotificationCent
|
||||
}
|
||||
}
|
||||
else {
|
||||
Toast.makeText(getParentActivity(), LocaleController.getString("ContactCreated", R.string.ContactCreated), Toast.LENGTH_LONG).show();
|
||||
Toast.makeText(getParentActivity(), context.getString(R.string.ContactCreated), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -200,7 +201,7 @@ public class ContactAddActivity extends BaseFragment implements NotificationCent
|
||||
layoutParams1.bottomMargin = AndroidUtilities.dp(12);
|
||||
layoutParams1.leftMargin = LocaleController.isRTL ? 0 : AndroidUtilities.dp(16);
|
||||
layoutParams1.rightMargin = LocaleController.isRTL ? AndroidUtilities.dp(16) : 0;
|
||||
layoutParams1.gravity = Gravity.TOP | (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT);
|
||||
layoutParams1.gravity = Gravity.TOP | Gravity.START;
|
||||
avatarImage.setLayoutParams(layoutParams1);
|
||||
{
|
||||
//avatarDrawable.setDrawPhoto(true);
|
||||
@@ -242,12 +243,12 @@ public class ContactAddActivity extends BaseFragment implements NotificationCent
|
||||
}
|
||||
|
||||
nameTextView = new EditText(context);
|
||||
nameTextView.setHint(LocaleController.getString("Name", R.string.Name));
|
||||
nameTextView.setHint(context.getString(R.string.Name));
|
||||
if (nameToSet != null) {
|
||||
nameTextView.setText(nameToSet);
|
||||
}
|
||||
nameTextView.setMaxLines(4);
|
||||
nameTextView.setGravity(Gravity.CENTER_VERTICAL | (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT));
|
||||
nameTextView.setGravity(Gravity.CENTER_VERTICAL | Gravity.START);
|
||||
nameTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
|
||||
nameTextView.setHintTextColor(0xff979797);
|
||||
nameTextView.setImeOptions(EditorInfo.IME_FLAG_NO_EXTRACT_UI);
|
||||
@@ -289,11 +290,11 @@ public class ContactAddActivity extends BaseFragment implements NotificationCent
|
||||
emailTextView.setHintTextColor(0xff979797);
|
||||
emailTextView.setTextColor(0xff212121);
|
||||
emailTextView.setMaxLines(4);
|
||||
emailTextView.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT);
|
||||
emailTextView.setGravity(Gravity.START);
|
||||
emailTextView.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS | InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS);
|
||||
emailTextView.setImeOptions(EditorInfo.IME_FLAG_NO_EXTRACT_UI);
|
||||
emailTextView.setPadding(0, 0, 0, AndroidUtilities.dp(8));
|
||||
emailTextView.setHint(LocaleController.getString("EmailAddress", R.string.EmailAddress));
|
||||
emailTextView.setHint(context.getString(R.string.EmailAddress));
|
||||
emailTextView.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||
@@ -344,7 +345,7 @@ public class ContactAddActivity extends BaseFragment implements NotificationCent
|
||||
|
||||
@Override
|
||||
public void didUploadedPhoto(final TLRPC.InputFile file, final TLRPC.PhotoSize small, final TLRPC.PhotoSize big) {
|
||||
Toast.makeText(getParentActivity(), LocaleController.getString("NotYetImplemented", R.string.NotYetImplemented), Toast.LENGTH_SHORT).show();
|
||||
Toast.makeText(getParentActivity(), ApplicationLoader.applicationContext.getString(R.string.NotYetImplemented), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -129,21 +129,21 @@ public class ContactsActivity extends BaseFragment implements NotificationCenter
|
||||
|
||||
if( do_what == SELECT_CONTACT_FOR_NEW_CHAT )
|
||||
{
|
||||
title = LocaleController.getString("NewChat", R.string.NewChat);
|
||||
subtitle = LocaleController.getString("SendMessageTo", R.string.SendMessageTo);
|
||||
title = ApplicationLoader.applicationContext.getString(R.string.NewChat);
|
||||
subtitle = ApplicationLoader.applicationContext.getString(R.string.SendMessageTo);
|
||||
}
|
||||
else if( do_what == SELECT_CONTACTS_FOR_NEW_GROUP )
|
||||
{
|
||||
title = LocaleController.getString("NewGroup", R.string.NewGroup);
|
||||
title = ApplicationLoader.applicationContext.getString(R.string.NewGroup);
|
||||
subtitle = ApplicationLoader.applicationContext.getResources().getQuantityString(R.plurals.MeAndMembers, 0, 0);
|
||||
}
|
||||
else if( do_what == ADD_CONTACTS_TO_GROUP )
|
||||
{
|
||||
title = LocaleController.getString("AddMember", R.string.AddMember);
|
||||
title = ApplicationLoader.applicationContext.getString(R.string.AddMember);
|
||||
}
|
||||
else if( do_what == SELECT_CONTACT_TO_BLOCK )
|
||||
{
|
||||
title = LocaleController.getString("BlockContact", R.string.BlockContact);
|
||||
title = ApplicationLoader.applicationContext.getString(R.string.BlockContact);
|
||||
}
|
||||
else if( do_what == SELECT_CONTACT_TO_ATTACH )
|
||||
{
|
||||
@@ -259,9 +259,9 @@ public class ContactsActivity extends BaseFragment implements NotificationCenter
|
||||
|
||||
ActionBarMenuItem item = menu.addItem(10, R.drawable.ic_ab_other);
|
||||
if (do_what == SELECT_CONTACT_FOR_NEW_CHAT || do_what == SELECT_CONTACTS_FOR_NEW_GROUP) {
|
||||
item.addSubItem(id_toggle, do_what == SELECT_CONTACT_FOR_NEW_CHAT ? LocaleController.getString("NewGroup", R.string.NewGroup) : LocaleController.getString("NewChat", R.string.NewChat), 0);
|
||||
item.addSubItem(id_toggle, do_what == SELECT_CONTACT_FOR_NEW_CHAT ? context.getString(R.string.NewGroup) : context.getString(R.string.NewChat), 0);
|
||||
}
|
||||
item.addSubItem(id_add_contact, LocaleController.getString("NewContactTitle", R.string.NewContactTitle), 0);
|
||||
item.addSubItem(id_add_contact, context.getString(R.string.NewContactTitle), 0);
|
||||
|
||||
|
||||
listViewAdapter = new ContactsAdapter(context);
|
||||
@@ -290,9 +290,9 @@ public class ContactsActivity extends BaseFragment implements NotificationCenter
|
||||
userSelectEditText.setHorizontalScrollBarEnabled(false);
|
||||
userSelectEditText.setPadding(0, 0, 0, 0);
|
||||
userSelectEditText.setImeOptions(EditorInfo.IME_ACTION_DONE | EditorInfo.IME_FLAG_NO_EXTRACT_UI);
|
||||
userSelectEditText.setGravity((LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.CENTER_VERTICAL);
|
||||
userSelectEditText.setGravity(Gravity.START | Gravity.CENTER_VERTICAL);
|
||||
AndroidUtilities.clearCursorDrawable(userSelectEditText);
|
||||
frameLayout.addView(userSelectEditText, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.TOP | Gravity.LEFT, 10, 0, 10, 0));
|
||||
frameLayout.addView(userSelectEditText, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.TOP | Gravity.START, 10, 0, 10, 0));
|
||||
|
||||
userSelectEditText.setHint(ApplicationLoader.applicationContext.getString(R.string.Search));
|
||||
userSelectEditText.setTextIsSelectable(false);
|
||||
@@ -352,7 +352,7 @@ public class ContactsActivity extends BaseFragment implements NotificationCenter
|
||||
listView.setVerticalScrollBarEnabled(true);
|
||||
}
|
||||
if (emptyTextView != null) {
|
||||
emptyTextView.setText(LocaleController.getString("NoResult", R.string.NoResult));
|
||||
emptyTextView.setText(context.getString(R.string.NoResult));
|
||||
}
|
||||
listViewAdapter.search(text);
|
||||
listViewAdapter.notifyDataSetChanged();
|
||||
@@ -364,7 +364,7 @@ public class ContactsActivity extends BaseFragment implements NotificationCenter
|
||||
listView.setFastScrollAlwaysVisible(true);
|
||||
listView.setFastScrollEnabled(true);
|
||||
listView.setVerticalScrollBarEnabled(false);
|
||||
emptyTextView.setText(LocaleController.getString("NoContacts", R.string.NoContacts));
|
||||
emptyTextView.setText(context.getString(R.string.NoContacts));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -388,7 +388,7 @@ public class ContactsActivity extends BaseFragment implements NotificationCenter
|
||||
emptyTextView.setTextColor(0xff808080);
|
||||
emptyTextView.setTextSize(20);
|
||||
emptyTextView.setGravity(Gravity.CENTER);
|
||||
emptyTextView.setText(LocaleController.getString("NoContacts", R.string.NoContacts));
|
||||
emptyTextView.setText(context.getString(R.string.NoContacts));
|
||||
emptyTextLayout.addView(emptyTextView, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, 0.5f));
|
||||
|
||||
FrameLayout frameLayout2 = new FrameLayout(context);
|
||||
@@ -404,7 +404,6 @@ public class ContactsActivity extends BaseFragment implements NotificationCenter
|
||||
listView.setScrollBarStyle(View.SCROLLBARS_OUTSIDE_OVERLAY);
|
||||
listView.setAdapter(listViewAdapter);
|
||||
listView.setFastScrollAlwaysVisible(true);
|
||||
listView.setVerticalScrollbarPosition(LocaleController.isRTL ? ListView.SCROLLBAR_POSITION_LEFT : ListView.SCROLLBAR_POSITION_RIGHT);
|
||||
linearLayout.addView(listView);
|
||||
|
||||
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||
@@ -430,7 +429,7 @@ public class ContactsActivity extends BaseFragment implements NotificationCenter
|
||||
}
|
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
|
||||
builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), new DialogInterface.OnClickListener() {
|
||||
builder.setPositiveButton(context.getString(R.string.OK), new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
int belonging_chat_id = MrMailbox.createChatByContactId(user.id);
|
||||
@@ -441,8 +440,8 @@ public class ContactsActivity extends BaseFragment implements NotificationCenter
|
||||
}
|
||||
}
|
||||
});
|
||||
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
|
||||
builder.setMessage(AndroidUtilities.replaceTags(LocaleController.formatString("AskStartChatWith", R.string.AskStartChatWith, name)));
|
||||
builder.setNegativeButton(context.getString(R.string.Cancel), null);
|
||||
builder.setMessage(AndroidUtilities.replaceTags(String.format(context.getString(R.string.AskStartChatWith), name)));
|
||||
showDialog(builder.create());
|
||||
}
|
||||
else if( do_what == SELECT_CONTACTS_FOR_NEW_GROUP ) {
|
||||
@@ -487,7 +486,7 @@ public class ContactsActivity extends BaseFragment implements NotificationCenter
|
||||
listView.setFastScrollAlwaysVisible(true);
|
||||
listView.setFastScrollEnabled(true);
|
||||
listView.setVerticalScrollBarEnabled(false);
|
||||
emptyTextView.setText(LocaleController.getString("NoContacts", R.string.NoContacts));
|
||||
emptyTextView.setText(context.getString(R.string.NoContacts));
|
||||
} else {
|
||||
if (view instanceof UserCell) {
|
||||
((UserCell) view).setChecked(check, true);
|
||||
@@ -510,7 +509,7 @@ public class ContactsActivity extends BaseFragment implements NotificationCenter
|
||||
if (item instanceof TLRPC.User) {
|
||||
final TLRPC.User user = (TLRPC.User) item;
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
|
||||
CharSequence[] items = new CharSequence[]{LocaleController.getString("ViewProfile", R.string.ViewProfile)};
|
||||
CharSequence[] items = new CharSequence[]{context.getString(R.string.ViewProfile)};
|
||||
builder.setItems(items, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
|
||||
@@ -140,7 +140,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
||||
onlySelect = arguments.getBoolean("onlySelect", false);
|
||||
onlySelectTitle = arguments.getString("onlySelectTitle");
|
||||
if( onlySelectTitle==null || onlySelectTitle.isEmpty()) {
|
||||
onlySelectTitle = LocaleController.getString("SelectChat", R.string.SelectChat);
|
||||
onlySelectTitle = ApplicationLoader.applicationContext.getString(R.string.SelectChat);
|
||||
}
|
||||
selectAlertString = arguments.getString("selectAlertString");
|
||||
selectAlertPreviewString = arguments.getString("selectAlertPreviewString");
|
||||
@@ -260,13 +260,13 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
||||
}
|
||||
}
|
||||
});
|
||||
item.getSearchField().setHint(LocaleController.getString("Search", R.string.Search));
|
||||
item.getSearchField().setHint(ApplicationLoader.applicationContext.getString(R.string.Search));
|
||||
if (onlySelect) {
|
||||
actionBar.setBackButtonImage(R.drawable.ic_ab_back);
|
||||
actionBar.setTitle(onlySelectTitle);
|
||||
} else {
|
||||
actionBar.setBackButtonDrawable(new MenuDrawable());
|
||||
actionBar.setTitle(LocaleController.getString("AppName", R.string.AppName));
|
||||
actionBar.setTitle(ApplicationLoader.applicationContext.getString(R.string.AppName));
|
||||
}
|
||||
actionBar.setAllowOverlayTitle(true);
|
||||
|
||||
@@ -327,7 +327,6 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
||||
};
|
||||
layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
|
||||
listView.setLayoutManager(layoutManager);
|
||||
listView.setVerticalScrollbarPosition(LocaleController.isRTL ? ListView.SCROLLBAR_POSITION_LEFT : ListView.SCROLLBAR_POSITION_RIGHT);
|
||||
frameLayout.addView(listView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
|
||||
listView.setOnItemClickListener(new RecyclerListView.OnItemClickListener() {
|
||||
@Override
|
||||
@@ -389,7 +388,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
||||
searchEmptyView = new EmptyTextProgressView(context);
|
||||
searchEmptyView.setVisibility(View.GONE);
|
||||
searchEmptyView.setShowAtCenter(true);
|
||||
searchEmptyView.setText(LocaleController.getString("NoResult", R.string.NoResult));
|
||||
searchEmptyView.setText(context.getString(R.string.NoResult));
|
||||
frameLayout.addView(searchEmptyView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
|
||||
|
||||
emptyView = new LinearLayout(context);
|
||||
@@ -405,14 +404,14 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
||||
});
|
||||
|
||||
TextView textView = new TextView(context);
|
||||
textView.setText(LocaleController.getString("NoChats", R.string.NoChats));
|
||||
textView.setText(context.getString(R.string.NoChats));
|
||||
textView.setTextColor(0xff959595);
|
||||
textView.setGravity(Gravity.CENTER);
|
||||
textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 20);
|
||||
emptyView.addView(textView, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT));
|
||||
|
||||
textView = new TextView(context);
|
||||
String help = LocaleController.getString("NoChatsHelp", R.string.NoChatsHelp);
|
||||
String help = context.getString(R.string.NoChatsHelp);
|
||||
textView.setText(help);
|
||||
textView.setTextColor(0xff959595);
|
||||
textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 15);
|
||||
@@ -439,7 +438,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
||||
}
|
||||
});
|
||||
}
|
||||
frameLayout.addView(floatingButton, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, (LocaleController.isRTL ? Gravity.LEFT : Gravity.RIGHT) | Gravity.BOTTOM, LocaleController.isRTL ? 14 : 0, 0, LocaleController.isRTL ? 0 : 14, 14));
|
||||
frameLayout.addView(floatingButton, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.END | Gravity.BOTTOM, LocaleController.isRTL ? 14 : 0, 0, LocaleController.isRTL ? 0 : 14, 14));
|
||||
floatingButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
@@ -806,7 +805,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
||||
MrChat mrChat = MrMailbox.getChat((int)dialog_id);
|
||||
|
||||
builder.setMessage(AndroidUtilities.replaceTags(
|
||||
LocaleController.formatStringSimple(selectAlertString, mrChat.getNameNAddr()) // display addr as there may be contacts with the same name but different addresses
|
||||
String.format(selectAlertString, mrChat.getNameNAddr()) // display addr as there may be contacts with the same name but different addresses
|
||||
+ (selectAlertPreviewString==null? "" : ("\n\n<c#808080>"+selectAlertPreviewString+"</c>"))));
|
||||
|
||||
builder.setPositiveButton(selectAlertOkButtonString!=null? selectAlertOkButtonString : ApplicationLoader.applicationContext.getString(R.string.OK), new DialogInterface.OnClickListener() {
|
||||
@@ -815,7 +814,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
||||
didSelectResult(dialog_id, false, false);
|
||||
}
|
||||
});
|
||||
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
|
||||
builder.setNegativeButton(ApplicationLoader.applicationContext.getString(R.string.Cancel), null);
|
||||
showDialog(builder.create());
|
||||
} else {
|
||||
if (delegate != null) {
|
||||
|
||||
@@ -161,7 +161,7 @@ public class DocumentSelectActivity extends BaseFragment {
|
||||
|
||||
actionBar.setBackButtonDrawable(new BackDrawable(false));
|
||||
actionBar.setAllowOverlayTitle(true);
|
||||
actionBar.setTitle(LocaleController.getString("SelectFile", R.string.SelectFile));
|
||||
actionBar.setTitle(context.getString(R.string.SelectFile));
|
||||
actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {
|
||||
@Override
|
||||
public void onItemClick(int id) {
|
||||
@@ -406,9 +406,9 @@ public class DocumentSelectActivity extends BaseFragment {
|
||||
items.clear();
|
||||
String state = Environment.getExternalStorageState();
|
||||
if (Environment.MEDIA_SHARED.equals(state)) {
|
||||
emptyView.setText(LocaleController.getString("UsbActive", R.string.UsbActive));
|
||||
emptyView.setText(ApplicationLoader.applicationContext.getString(R.string.UsbActive));
|
||||
} else {
|
||||
emptyView.setText(LocaleController.getString("NotMounted", R.string.NotMounted));
|
||||
emptyView.setText(ApplicationLoader.applicationContext.getString(R.string.NotMounted));
|
||||
}
|
||||
AndroidUtilities.clearDrawableAnimation(listView);
|
||||
scrolling = true;
|
||||
@@ -419,7 +419,7 @@ public class DocumentSelectActivity extends BaseFragment {
|
||||
showErrorBox(ApplicationLoader.applicationContext.getString(R.string.AccessError));
|
||||
return false;
|
||||
}
|
||||
emptyView.setText(LocaleController.getString("NoFiles", R.string.NoFiles));
|
||||
emptyView.setText(ApplicationLoader.applicationContext.getString(R.string.NoFiles));
|
||||
File[] files;
|
||||
try {
|
||||
files = dir.listFiles();
|
||||
@@ -461,7 +461,7 @@ public class DocumentSelectActivity extends BaseFragment {
|
||||
item.file = file;
|
||||
if (file.isDirectory()) {
|
||||
item.icon = R.drawable.ic_directory;
|
||||
item.subtitle = LocaleController.getString("Folder", R.string.Folder);
|
||||
item.subtitle = ApplicationLoader.applicationContext.getString(R.string.Folder);
|
||||
} else {
|
||||
String fname = file.getName();
|
||||
String[] sp = fname.split("\\.");
|
||||
@@ -479,12 +479,12 @@ public class DocumentSelectActivity extends BaseFragment {
|
||||
if (history.size() > 0) {
|
||||
HistoryEntry entry = history.get(history.size() - 1);
|
||||
if (entry.dir == null) {
|
||||
item.subtitle = LocaleController.getString("Folder", R.string.Folder);
|
||||
item.subtitle = ApplicationLoader.applicationContext.getString(R.string.Folder);
|
||||
} else {
|
||||
item.subtitle = entry.dir.toString();
|
||||
}
|
||||
} else {
|
||||
item.subtitle = LocaleController.getString("Folder", R.string.Folder);
|
||||
item.subtitle = ApplicationLoader.applicationContext.getString(R.string.Folder);
|
||||
}
|
||||
item.icon = R.drawable.ic_directory;
|
||||
item.file = null;
|
||||
@@ -510,10 +510,10 @@ public class DocumentSelectActivity extends BaseFragment {
|
||||
if (defaultPathState.equals(Environment.MEDIA_MOUNTED) || defaultPathState.equals(Environment.MEDIA_MOUNTED_READ_ONLY)) {
|
||||
ListItem ext = new ListItem();
|
||||
if (Environment.isExternalStorageRemovable()) {
|
||||
ext.title = LocaleController.getString("SdCard", R.string.SdCard);
|
||||
ext.title = ApplicationLoader.applicationContext.getString(R.string.SdCard);
|
||||
ext.icon = R.drawable.ic_external_storage;
|
||||
} else {
|
||||
ext.title = LocaleController.getString("InternalStorage", R.string.InternalStorage);
|
||||
ext.title = ApplicationLoader.applicationContext.getString(R.string.InternalStorage);
|
||||
ext.icon = R.drawable.ic_storage;
|
||||
}
|
||||
ext.subtitle = getRootSubtitle(defaultPath);
|
||||
@@ -550,9 +550,9 @@ public class DocumentSelectActivity extends BaseFragment {
|
||||
try {
|
||||
ListItem item = new ListItem();
|
||||
if (path.toLowerCase().contains("sd")) {
|
||||
item.title = LocaleController.getString("SdCard", R.string.SdCard);
|
||||
item.title = ApplicationLoader.applicationContext.getString(R.string.SdCard);
|
||||
} else {
|
||||
item.title = LocaleController.getString("ExternalStorage", R.string.ExternalStorage);
|
||||
item.title = ApplicationLoader.applicationContext.getString(R.string.ExternalStorage);
|
||||
}
|
||||
item.icon = R.drawable.ic_external_storage;
|
||||
item.subtitle = getRootSubtitle(path);
|
||||
@@ -578,7 +578,7 @@ public class DocumentSelectActivity extends BaseFragment {
|
||||
}
|
||||
ListItem fs = new ListItem();
|
||||
fs.title = "/";
|
||||
fs.subtitle = LocaleController.getString("SystemRoot", R.string.SystemRoot);
|
||||
fs.subtitle = ApplicationLoader.applicationContext.getString(R.string.SystemRoot);
|
||||
fs.icon = R.drawable.ic_directory;
|
||||
fs.file = new File("/");
|
||||
items.add(fs);
|
||||
@@ -598,8 +598,8 @@ public class DocumentSelectActivity extends BaseFragment {
|
||||
}
|
||||
|
||||
fs = new ListItem();
|
||||
fs.title = LocaleController.getString("Gallery", R.string.Gallery);
|
||||
fs.subtitle = LocaleController.getString("GalleryInfo", R.string.GalleryInfo);
|
||||
fs.title = ApplicationLoader.applicationContext.getString(R.string.Gallery);
|
||||
fs.subtitle = ApplicationLoader.applicationContext.getString(R.string.GalleryInfo);
|
||||
fs.icon = R.drawable.ic_storage_gallery;
|
||||
fs.file = null;
|
||||
items.add(fs);
|
||||
@@ -617,7 +617,7 @@ public class DocumentSelectActivity extends BaseFragment {
|
||||
if (total == 0) {
|
||||
return "";
|
||||
}
|
||||
return LocaleController.formatString("FreeOfTotal", R.string.FreeOfTotal, AndroidUtilities.formatFileSize(free), AndroidUtilities.formatFileSize(total));
|
||||
return String.format(ApplicationLoader.applicationContext.getString(R.string.FreeOfTotal), AndroidUtilities.formatFileSize(free), AndroidUtilities.formatFileSize(total));
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
|
||||
@@ -42,6 +42,7 @@ import android.widget.ListView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.b44t.messenger.AndroidUtilities;
|
||||
import com.b44t.messenger.ApplicationLoader;
|
||||
import com.b44t.messenger.ContactsController;
|
||||
import com.b44t.messenger.LocaleController;
|
||||
import com.b44t.messenger.MrContact;
|
||||
@@ -111,10 +112,10 @@ public class GroupCreateFinalActivity extends BaseFragment implements Notificati
|
||||
}
|
||||
|
||||
@Override
|
||||
public View createView(Context context) {
|
||||
public View createView(final Context context) {
|
||||
actionBar.setBackButtonImage(R.drawable.ic_close_white);
|
||||
actionBar.setAllowOverlayTitle(true);
|
||||
actionBar.setTitle(LocaleController.getString("NewGroup", R.string.NewGroup));
|
||||
actionBar.setTitle(context.getString(R.string.NewGroup));
|
||||
actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {
|
||||
@Override
|
||||
public void onItemClick(int id) {
|
||||
@@ -123,7 +124,7 @@ public class GroupCreateFinalActivity extends BaseFragment implements Notificati
|
||||
} else if (id == done_button) {
|
||||
String groupName = nameTextView.getText().toString().trim();
|
||||
if (groupName.isEmpty()) {
|
||||
Toast.makeText(getParentActivity(), LocaleController.getString("ErrGroupNameEmpty", R.string.ErrGroupNameEmpty), Toast.LENGTH_LONG).show();
|
||||
Toast.makeText(getParentActivity(), context.getString(R.string.ErrGroupNameEmpty), Toast.LENGTH_LONG).show();
|
||||
return;
|
||||
}
|
||||
int chat_id=MrMailbox.createGroupChat(groupName);
|
||||
@@ -181,7 +182,7 @@ public class GroupCreateFinalActivity extends BaseFragment implements Notificati
|
||||
layoutParams1.bottomMargin = AndroidUtilities.dp(12);
|
||||
layoutParams1.leftMargin = LocaleController.isRTL ? 0 : AndroidUtilities.dp(16);
|
||||
layoutParams1.rightMargin = LocaleController.isRTL ? AndroidUtilities.dp(16) : 0;
|
||||
layoutParams1.gravity = Gravity.TOP | (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT);
|
||||
layoutParams1.gravity = Gravity.TOP | Gravity.START;
|
||||
avatarImage.setLayoutParams(layoutParams1);
|
||||
{
|
||||
//avatarDrawable.setDrawPhoto(true);
|
||||
@@ -223,13 +224,13 @@ public class GroupCreateFinalActivity extends BaseFragment implements Notificati
|
||||
}
|
||||
|
||||
nameTextView = new EditText(context);
|
||||
nameTextView.setHint(LocaleController.getString("EnterGroupNamePlaceholder", R.string.EnterGroupNamePlaceholder));
|
||||
nameTextView.setHint(context.getString(R.string.EnterGroupNamePlaceholder));
|
||||
if (nameToSet != null) {
|
||||
nameTextView.setText(nameToSet);
|
||||
nameToSet = null;
|
||||
}
|
||||
nameTextView.setMaxLines(4);
|
||||
nameTextView.setGravity(Gravity.CENTER_VERTICAL | (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT));
|
||||
nameTextView.setGravity(Gravity.CENTER_VERTICAL | Gravity.START);
|
||||
nameTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
|
||||
nameTextView.setHintTextColor(0xff979797);
|
||||
nameTextView.setImeOptions(EditorInfo.IME_FLAG_NO_EXTRACT_UI);
|
||||
@@ -294,7 +295,7 @@ public class GroupCreateFinalActivity extends BaseFragment implements Notificati
|
||||
|
||||
@Override
|
||||
public void didUploadedPhoto(final TLRPC.InputFile file, final TLRPC.PhotoSize small, final TLRPC.PhotoSize big) {
|
||||
Toast.makeText(getParentActivity(), LocaleController.getString("NotYetImplemented", R.string.NotYetImplemented), Toast.LENGTH_SHORT).show();
|
||||
Toast.makeText(getParentActivity(), ApplicationLoader.applicationContext.getString(R.string.NotYetImplemented), Toast.LENGTH_SHORT).show();
|
||||
/*
|
||||
AndroidUtilities.runOnUIThread(new Runnable() {
|
||||
@Override
|
||||
|
||||
@@ -26,12 +26,17 @@ package com.b44t.ui;
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.animation.StateListAnimator;
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.database.DataSetObserver;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Parcelable;
|
||||
import android.os.PowerManager;
|
||||
import android.support.v4.view.PagerAdapter;
|
||||
import android.support.v4.view.ViewPager;
|
||||
import android.view.View;
|
||||
@@ -39,17 +44,22 @@ import android.view.ViewGroup;
|
||||
import android.view.Window;
|
||||
import android.view.animation.Animation;
|
||||
import android.view.animation.AnimationUtils;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.b44t.messenger.AndroidUtilities;
|
||||
import com.b44t.messenger.ApplicationLoader;
|
||||
import com.b44t.messenger.BuildConfig;
|
||||
import com.b44t.messenger.LocaleController;
|
||||
import com.b44t.messenger.MrMailbox;
|
||||
import com.b44t.messenger.R;
|
||||
import com.b44t.ui.ActionBar.Theme;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import static java.lang.Math.min;
|
||||
|
||||
public class IntroActivity extends Activity {
|
||||
|
||||
private ViewPager viewPager;
|
||||
@@ -63,6 +73,8 @@ public class IntroActivity extends Activity {
|
||||
private int[] titles;
|
||||
private int[] messages;
|
||||
|
||||
private boolean isAbout = false;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
setTheme(R.style.Theme_MessengerProj);
|
||||
@@ -70,13 +82,18 @@ public class IntroActivity extends Activity {
|
||||
Theme.loadRecources(this);
|
||||
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
|
||||
if (AndroidUtilities.isTablet()) {
|
||||
setContentView(R.layout.intro_layout_tablet);
|
||||
} else {
|
||||
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
||||
setContentView(R.layout.intro_layout);
|
||||
Bundle extras = getIntent().getExtras();
|
||||
if( extras != null && extras.getBoolean("com.b44t.ui.IntroActivity.isAbout") ) {
|
||||
isAbout = true;
|
||||
}
|
||||
|
||||
float heightOnLandscape = min(AndroidUtilities.displaySize.x,AndroidUtilities.displaySize.y)/AndroidUtilities.density;
|
||||
if( heightOnLandscape < 450 ) {
|
||||
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
||||
}
|
||||
|
||||
setContentView(R.layout.intro_layout);
|
||||
|
||||
if (LocaleController.isRTL) {
|
||||
icons = new int[]{
|
||||
R.drawable.intro7,
|
||||
@@ -135,14 +152,48 @@ public class IntroActivity extends Activity {
|
||||
};
|
||||
}
|
||||
viewPager = (ViewPager) findViewById(R.id.intro_view_pager);
|
||||
TextView startMessagingButton = (TextView) findViewById(R.id.start_messaging_button);
|
||||
startMessagingButton.setText(ApplicationLoader.applicationContext.getString(R.string.IntroStartMessaging).toUpperCase(Locale.getDefault()));
|
||||
if (Build.VERSION.SDK_INT >= 21) {
|
||||
StateListAnimator animator = new StateListAnimator();
|
||||
animator.addState(new int[]{android.R.attr.state_pressed}, ObjectAnimator.ofFloat(startMessagingButton, "translationZ", AndroidUtilities.dp(2), AndroidUtilities.dp(4)).setDuration(200));
|
||||
animator.addState(new int[]{}, ObjectAnimator.ofFloat(startMessagingButton, "translationZ", AndroidUtilities.dp(4), AndroidUtilities.dp(2)).setDuration(200));
|
||||
startMessagingButton.setStateListAnimator(animator);
|
||||
|
||||
Button startMessagingButton = (Button) findViewById(R.id.start_messaging_button);
|
||||
Button detailsButton = (Button) findViewById(R.id.details_button);
|
||||
if( isAbout ) {
|
||||
startMessagingButton.setText(ApplicationLoader.applicationContext.getString(R.string.OK));
|
||||
detailsButton.setText(ApplicationLoader.applicationContext.getString(R.string.Info));
|
||||
detailsButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
new AlertDialog.Builder(IntroActivity.this)
|
||||
.setTitle(ApplicationLoader.applicationContext.getString(R.string.AppName) + " v" + getVersion())
|
||||
.setMessage(MrMailbox.getInfo() + "\n\n" + getAndroidInfo())
|
||||
.setPositiveButton(ApplicationLoader.applicationContext.getString(R.string.OK), new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
;
|
||||
}
|
||||
})
|
||||
.show();
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
startMessagingButton.setText(ApplicationLoader.applicationContext.getString(R.string.IntroStartMessaging));
|
||||
detailsButton.setVisibility(View.GONE);
|
||||
}
|
||||
startMessagingButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if(!isAbout) {
|
||||
if(startPressed) {
|
||||
return;
|
||||
}
|
||||
startPressed = true;
|
||||
Intent intent2 = new Intent(IntroActivity.this, LaunchActivity.class);
|
||||
intent2.putExtra("fromIntro", true);
|
||||
startActivity(intent2);
|
||||
}
|
||||
finish();
|
||||
}
|
||||
});
|
||||
|
||||
topImage1 = (ImageView) findViewById(R.id.icon_image1);
|
||||
topImage2 = (ImageView) findViewById(R.id.icon_image2);
|
||||
bottomPages = (ViewGroup) findViewById(R.id.bottom_pages);
|
||||
@@ -225,23 +276,57 @@ public class IntroActivity extends Activity {
|
||||
}
|
||||
});
|
||||
|
||||
startMessagingButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (startPressed) {
|
||||
return;
|
||||
}
|
||||
startPressed = true;
|
||||
Intent intent2 = new Intent(IntroActivity.this, LaunchActivity.class);
|
||||
intent2.putExtra("fromIntro", true);
|
||||
startActivity(intent2);
|
||||
finish();
|
||||
}
|
||||
});
|
||||
|
||||
justCreated = true;
|
||||
}
|
||||
|
||||
public static String getVersion()
|
||||
{
|
||||
try {
|
||||
PackageInfo pInfo = ApplicationLoader.applicationContext.getPackageManager().getPackageInfo(ApplicationLoader.applicationContext.getPackageName(), 0);
|
||||
return pInfo.versionName;
|
||||
}
|
||||
catch(Exception e) {
|
||||
return "ErrVersion";
|
||||
}
|
||||
}
|
||||
|
||||
private String getAndroidInfo()
|
||||
{
|
||||
String abi = "ErrAbi";
|
||||
int versionCode = 0, ignoreBatteryOptimizations = -1;
|
||||
try {
|
||||
PackageInfo pInfo = ApplicationLoader.applicationContext.getPackageManager().getPackageInfo(ApplicationLoader.applicationContext.getPackageName(), 0);
|
||||
versionCode = pInfo.versionCode;
|
||||
switch (versionCode % 10) {
|
||||
case 0:
|
||||
abi = "arm";
|
||||
break;
|
||||
case 1:
|
||||
abi = "arm-v7a";
|
||||
break;
|
||||
case 2:
|
||||
abi = "x86";
|
||||
break;
|
||||
case 3:
|
||||
abi = "universal";
|
||||
break;
|
||||
}
|
||||
if( Build.VERSION.SDK_INT >= 23 ) {
|
||||
PowerManager pm = (PowerManager) ApplicationLoader.applicationContext.getSystemService(Context.POWER_SERVICE);
|
||||
ignoreBatteryOptimizations = pm.isIgnoringBatteryOptimizations(ApplicationLoader.applicationContext.getPackageName())? 1 : 0;
|
||||
}
|
||||
} catch (Exception e) {}
|
||||
|
||||
return "SDK_INT=" + Build.VERSION.SDK_INT
|
||||
+ "\nMANUFACTURER=" + Build.MANUFACTURER
|
||||
+ "\nMODEL=" + Build.MODEL
|
||||
+ "\nAPPLICATION_ID=" + BuildConfig.APPLICATION_ID
|
||||
+ "\nBUILD_TYPE=" + BuildConfig.BUILD_TYPE
|
||||
+ "\nABI=" + abi // ABI = Application Binary Interface
|
||||
+ "\nignoreBatteryOptimizations=" + ignoreBatteryOptimizations
|
||||
+ "\nversionCode=" + versionCode;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
|
||||
@@ -1,428 +0,0 @@
|
||||
/*******************************************************************************
|
||||
*
|
||||
* Messenger Android Frontend
|
||||
* (C) 2013-2016 Nikolai Kudashov
|
||||
* (C) 2017 Björn Petersen
|
||||
* Contact: r10s@b44t.com, http://b44t.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see http://www.gnu.org/licenses/ .
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.Gravity;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.AbsListView;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.EditText;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.b44t.messenger.AndroidUtilities;
|
||||
import com.b44t.messenger.ApplicationLoader;
|
||||
import com.b44t.messenger.LocaleController;
|
||||
import com.b44t.messenger.R;
|
||||
import com.b44t.messenger.Utilities;
|
||||
import com.b44t.ui.Adapters.BaseFragmentAdapter;
|
||||
import com.b44t.ui.Cells.TextDetailSettingsCell;
|
||||
import com.b44t.ui.ActionBar.ActionBar;
|
||||
import com.b44t.ui.ActionBar.ActionBarMenu;
|
||||
import com.b44t.ui.ActionBar.ActionBarMenuItem;
|
||||
import com.b44t.ui.ActionBar.BaseFragment;
|
||||
import com.b44t.ui.Components.LayoutHelper;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
public class LanguageSelectActivity extends BaseFragment {
|
||||
private BaseFragmentAdapter listAdapter;
|
||||
private ListView listView;
|
||||
private boolean searchWas;
|
||||
private boolean searching;
|
||||
private BaseFragmentAdapter searchListViewAdapter;
|
||||
private TextView emptyTextView;
|
||||
private Timer searchTimer;
|
||||
public ArrayList<LocaleController.LocaleInfo> searchResult;
|
||||
private ArrayList<LocaleController.LocaleInfo> sortedLanguages = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
public View createView(Context context) {
|
||||
|
||||
for (LocaleController.LocaleInfo localInfo : LocaleController.getInstance().languagesDict.values()) {
|
||||
sortedLanguages.add(localInfo);
|
||||
}
|
||||
Collections.sort(sortedLanguages, new Comparator<LocaleController.LocaleInfo>() {
|
||||
@Override
|
||||
public int compare(LocaleController.LocaleInfo o, LocaleController.LocaleInfo o2) {
|
||||
return o.name.compareTo(o2.name);
|
||||
}
|
||||
});
|
||||
LocaleController.LocaleInfo localeInfo = new LocaleController.LocaleInfo();
|
||||
localeInfo.name = ApplicationLoader.applicationContext.getString(R.string.Default); // the "Default" option is interesting, because it not only sets the language to default but also clears the "override" flag - further system changes are then followed by Delta Chat again.
|
||||
localeInfo.nameEnglish = "Default";
|
||||
localeInfo.shortName = null;
|
||||
sortedLanguages.add(0, localeInfo);
|
||||
|
||||
searching = false;
|
||||
searchWas = false;
|
||||
|
||||
actionBar.setBackButtonImage(R.drawable.ic_ab_back);
|
||||
actionBar.setAllowOverlayTitle(true);
|
||||
actionBar.setTitle(LocaleController.getString("Language", R.string.Language));
|
||||
|
||||
actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {
|
||||
@Override
|
||||
public void onItemClick(int id) {
|
||||
if (id == -1) {
|
||||
finishFragment();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
ActionBarMenu menu = actionBar.createMenu();
|
||||
ActionBarMenuItem item = menu.addItem(0, R.drawable.ic_ab_search).setIsSearchField(true, false).setActionBarMenuItemSearchListener(new ActionBarMenuItem.ActionBarMenuItemSearchListener() {
|
||||
@Override
|
||||
public void onSearchExpand() {
|
||||
searching = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSearchCollapse() {
|
||||
search(null);
|
||||
searching = false;
|
||||
searchWas = false;
|
||||
if (listView != null) {
|
||||
emptyTextView.setVisibility(View.GONE);
|
||||
listView.setAdapter(listAdapter);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(EditText editText) {
|
||||
String text = editText.getText().toString();
|
||||
search(text);
|
||||
if (text.length() != 0) {
|
||||
searchWas = true;
|
||||
if (listView != null) {
|
||||
listView.setAdapter(searchListViewAdapter);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
item.getSearchField().setHint(LocaleController.getString("Search", R.string.Search));
|
||||
|
||||
listAdapter = new ListAdapter(context);
|
||||
searchListViewAdapter = new SearchAdapter(context);
|
||||
|
||||
fragmentView = new FrameLayout(context);
|
||||
|
||||
LinearLayout emptyTextLayout = new LinearLayout(context);
|
||||
emptyTextLayout.setVisibility(View.INVISIBLE);
|
||||
emptyTextLayout.setOrientation(LinearLayout.VERTICAL);
|
||||
((FrameLayout) fragmentView).addView(emptyTextLayout);
|
||||
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) emptyTextLayout.getLayoutParams();
|
||||
layoutParams.width = LayoutHelper.MATCH_PARENT;
|
||||
layoutParams.height = LayoutHelper.MATCH_PARENT;
|
||||
layoutParams.gravity = Gravity.TOP;
|
||||
emptyTextLayout.setLayoutParams(layoutParams);
|
||||
emptyTextLayout.setOnTouchListener(new View.OnTouchListener() {
|
||||
@Override
|
||||
public boolean onTouch(View v, MotionEvent event) {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
emptyTextView = new TextView(context);
|
||||
emptyTextView.setTextColor(0xff808080);
|
||||
emptyTextView.setTextSize(20);
|
||||
emptyTextView.setGravity(Gravity.CENTER);
|
||||
emptyTextView.setText(LocaleController.getString("NoResult", R.string.NoResult));
|
||||
emptyTextLayout.addView(emptyTextView);
|
||||
LinearLayout.LayoutParams layoutParams1 = (LinearLayout.LayoutParams) emptyTextView.getLayoutParams();
|
||||
layoutParams1.width = LayoutHelper.MATCH_PARENT;
|
||||
layoutParams1.height = LayoutHelper.MATCH_PARENT;
|
||||
layoutParams1.weight = 0.5f;
|
||||
emptyTextView.setLayoutParams(layoutParams1);
|
||||
|
||||
FrameLayout frameLayout = new FrameLayout(context);
|
||||
emptyTextLayout.addView(frameLayout);
|
||||
layoutParams1 = (LinearLayout.LayoutParams) frameLayout.getLayoutParams();
|
||||
layoutParams1.width = LayoutHelper.MATCH_PARENT;
|
||||
layoutParams1.height = LayoutHelper.MATCH_PARENT;
|
||||
layoutParams1.weight = 0.5f;
|
||||
frameLayout.setLayoutParams(layoutParams1);
|
||||
|
||||
listView = new ListView(context);
|
||||
listView.setEmptyView(emptyTextLayout);
|
||||
listView.setDrawSelectorOnTop(true);
|
||||
listView.setDivider(null);
|
||||
listView.setDividerHeight(0);
|
||||
listView.setAdapter(listAdapter);
|
||||
((FrameLayout) fragmentView).addView(listView);
|
||||
layoutParams = (FrameLayout.LayoutParams) listView.getLayoutParams();
|
||||
layoutParams.width = LayoutHelper.MATCH_PARENT;
|
||||
layoutParams.height = LayoutHelper.MATCH_PARENT;
|
||||
listView.setLayoutParams(layoutParams);
|
||||
|
||||
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
|
||||
LocaleController.LocaleInfo localeInfo = null;
|
||||
if (searching && searchWas) {
|
||||
if (i >= 0 && i < searchResult.size()) {
|
||||
localeInfo = searchResult.get(i);
|
||||
}
|
||||
} else {
|
||||
if (i >= 0 && i < sortedLanguages.size()) {
|
||||
localeInfo = sortedLanguages.get(i);
|
||||
}
|
||||
}
|
||||
if (localeInfo != null) {
|
||||
LocaleController.getInstance().applyLanguage(localeInfo, true);
|
||||
parentLayout.rebuildAllFragmentViews(false);
|
||||
}
|
||||
finishFragment();
|
||||
}
|
||||
});
|
||||
|
||||
listView.setOnScrollListener(new AbsListView.OnScrollListener() {
|
||||
@Override
|
||||
public void onScrollStateChanged(AbsListView absListView, int i) {
|
||||
if (i == SCROLL_STATE_TOUCH_SCROLL && searching && searchWas) {
|
||||
AndroidUtilities.hideKeyboard(getParentActivity().getCurrentFocus());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onScroll(AbsListView absListView, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
|
||||
}
|
||||
});
|
||||
|
||||
return fragmentView;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
if (listAdapter != null) {
|
||||
listAdapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public void search(final String query) {
|
||||
if (query == null) {
|
||||
searchResult = null;
|
||||
} else {
|
||||
try {
|
||||
if (searchTimer != null) {
|
||||
searchTimer.cancel();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
searchTimer = new Timer();
|
||||
searchTimer.schedule(new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
searchTimer.cancel();
|
||||
searchTimer = null;
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
processSearch(query);
|
||||
}
|
||||
}, 100, 300);
|
||||
}
|
||||
}
|
||||
|
||||
private void processSearch(final String query) {
|
||||
Utilities.searchQueue.postRunnable(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
String q = query.trim().toLowerCase();
|
||||
if (q.length() == 0) {
|
||||
updateSearchResults(new ArrayList<LocaleController.LocaleInfo>());
|
||||
return;
|
||||
}
|
||||
ArrayList<LocaleController.LocaleInfo> resultArray = new ArrayList<>();
|
||||
|
||||
for (LocaleController.LocaleInfo c : 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) {
|
||||
AndroidUtilities.runOnUIThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
searchResult = arrCounties;
|
||||
searchListViewAdapter.notifyDataSetChanged();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private class SearchAdapter extends BaseFragmentAdapter {
|
||||
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) {
|
||||
view = new TextDetailSettingsCell(mContext);
|
||||
}
|
||||
|
||||
LocaleController.LocaleInfo c = searchResult.get(i);
|
||||
((TextDetailSettingsCell) view).setTextAndValue(c.name, c.nameEnglish, i != searchResult.size() - 1);
|
||||
|
||||
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 BaseFragmentAdapter {
|
||||
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 (sortedLanguages == null) {
|
||||
return 0;
|
||||
}
|
||||
return 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) {
|
||||
view = new TextDetailSettingsCell(mContext);
|
||||
}
|
||||
|
||||
LocaleController.LocaleInfo localeInfo = sortedLanguages.get(i);
|
||||
((TextDetailSettingsCell) view).setTextAndValue(localeInfo.name, localeInfo.nameEnglish, i != sortedLanguages.size() - 1);
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemViewType(int i) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getViewTypeCount() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return sortedLanguages == null || sortedLanguages.size() == 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -302,7 +302,7 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa
|
||||
Intent intent = new Intent(Intent.ACTION_SEND);
|
||||
intent.setType("text/plain");
|
||||
intent.putExtra(Intent.EXTRA_TEXT, MrMailbox.getInviteText());
|
||||
startActivity(Intent.createChooser(intent, LocaleController.getString("InviteMenuEntry", R.string.InviteMenuEntry)));
|
||||
startActivity(Intent.createChooser(intent, ApplicationLoader.applicationContext.getString(R.string.InviteMenuEntry)));
|
||||
} catch (Exception e) {
|
||||
}
|
||||
drawerLayoutContainer.closeDrawer(false);
|
||||
@@ -784,7 +784,7 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa
|
||||
{
|
||||
final String createChatWithFinal = createChatWith;
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||
builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), new DialogInterface.OnClickListener() {
|
||||
builder.setPositiveButton(ApplicationLoader.applicationContext.getString(R.string.OK), new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
int chatId = MrMailbox.createChatByContactId(MrMailbox.createContact("", createChatWithFinal));
|
||||
@@ -798,8 +798,8 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa
|
||||
|
||||
}
|
||||
});
|
||||
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
|
||||
builder.setMessage(AndroidUtilities.replaceTags(LocaleController.formatString("AskStartChatWith", R.string.AskStartChatWith, createChatWith)));
|
||||
builder.setNegativeButton(ApplicationLoader.applicationContext.getString(R.string.Cancel), null);
|
||||
builder.setMessage(AndroidUtilities.replaceTags(String.format(ApplicationLoader.applicationContext.getString(R.string.AskStartChatWith), createChatWith)));
|
||||
builder.show();
|
||||
}
|
||||
else if (push_chat_id != 0)
|
||||
@@ -1122,13 +1122,13 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa
|
||||
else {
|
||||
switch (permissions[i]) {
|
||||
case Manifest.permission.READ_CONTACTS:
|
||||
msg += "- " + LocaleController.getString("PermissionContacts", R.string.PermissionContacts) + "\n\n";
|
||||
msg += "- " + ApplicationLoader.applicationContext.getString(R.string.PermissionContacts) + "\n\n";
|
||||
break;
|
||||
case Manifest.permission.WRITE_EXTERNAL_STORAGE:
|
||||
msg += "- " + LocaleController.getString("PermissionStorage", R.string.PermissionStorage) + "\n\n";
|
||||
msg += "- " + ApplicationLoader.applicationContext.getString(R.string.PermissionStorage) + "\n\n";
|
||||
break;
|
||||
case Manifest.permission.RECORD_AUDIO:
|
||||
msg += "- " + LocaleController.getString("PermissionNoAudio", R.string.PermissionNoAudio) + "\n\n";
|
||||
msg += "- " + ApplicationLoader.applicationContext.getString(R.string.PermissionNoAudio) + "\n\n";
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1144,7 +1144,7 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||
builder.setMessage(msg.trim());
|
||||
|
||||
builder.setPositiveButton(LocaleController.getString("PermissionOpenSettings", R.string.PermissionOpenSettings), new DialogInterface.OnClickListener() {
|
||||
builder.setPositiveButton(ApplicationLoader.applicationContext.getString(R.string.PermissionOpenSettings), new DialogInterface.OnClickListener() {
|
||||
@TargetApi(Build.VERSION_CODES.GINGERBREAD)
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
@@ -1159,7 +1159,7 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa
|
||||
}
|
||||
}
|
||||
});
|
||||
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
|
||||
builder.setNegativeButton(ApplicationLoader.applicationContext.getString(R.string.Cancel), null);
|
||||
builder.show();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -127,7 +127,7 @@ public class PasscodeActivity extends BaseFragment implements NotificationCenter
|
||||
}
|
||||
|
||||
@Override
|
||||
public View createView(Context context) {
|
||||
public View createView(final Context context) {
|
||||
actionBar.setBackButtonImage(screen == SCREEN0_SETTINGS? R.drawable.ic_ab_back : R.drawable.ic_close_white);
|
||||
actionBar.setAllowOverlayTitle(false);
|
||||
actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {
|
||||
@@ -162,12 +162,12 @@ public class PasscodeActivity extends BaseFragment implements NotificationCenter
|
||||
titleTextView.setTextColor(0xff757575);
|
||||
if (screen == SCREEN1_ENTER_CODE1) {
|
||||
if (UserConfig.passcodeHash.length() != 0) {
|
||||
titleTextView.setText(LocaleController.getString("EnterNewPasscode", R.string.EnterNewPasscode));
|
||||
titleTextView.setText(context.getString(R.string.EnterNewPasscode));
|
||||
} else {
|
||||
titleTextView.setText(LocaleController.getString("EnterNewFirstPasscode", R.string.EnterNewFirstPasscode));
|
||||
titleTextView.setText(context.getString(R.string.EnterNewFirstPasscode));
|
||||
}
|
||||
} else {
|
||||
titleTextView.setText(LocaleController.getString("EnterCurrentPasscode", R.string.EnterCurrentPasscode));
|
||||
titleTextView.setText(context.getString(R.string.EnterCurrentPasscode));
|
||||
}
|
||||
titleTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18);
|
||||
titleTextView.setGravity(Gravity.CENTER_HORIZONTAL);
|
||||
@@ -265,8 +265,8 @@ public class PasscodeActivity extends BaseFragment implements NotificationCenter
|
||||
if (screen == SCREEN1_ENTER_CODE1) {
|
||||
dropDownContainer = new ActionBarMenuItem(context, menu, 0);
|
||||
dropDownContainer.setSubMenuOpenSide(1);
|
||||
dropDownContainer.addSubItem(pin_item, LocaleController.getString("PasscodePIN", R.string.PasscodePIN), 0);
|
||||
dropDownContainer.addSubItem(password_item, LocaleController.getString("PasscodePassword", R.string.PasscodePassword), 0);
|
||||
dropDownContainer.addSubItem(pin_item, context.getString(R.string.PasscodePIN), 0);
|
||||
dropDownContainer.addSubItem(password_item, context.getString(R.string.PasscodePassword), 0);
|
||||
actionBar.addView(dropDownContainer);
|
||||
layoutParams = (FrameLayout.LayoutParams) dropDownContainer.getLayoutParams();
|
||||
layoutParams.height = LayoutHelper.MATCH_PARENT;
|
||||
@@ -301,12 +301,12 @@ public class PasscodeActivity extends BaseFragment implements NotificationCenter
|
||||
layoutParams.bottomMargin = AndroidUtilities.dp(1);
|
||||
dropDown.setLayoutParams(layoutParams);
|
||||
} else {
|
||||
actionBar.setTitle(LocaleController.getString("Passcode", R.string.Passcode));
|
||||
actionBar.setTitle(context.getString(R.string.Passcode));
|
||||
}
|
||||
|
||||
updateDropDownTextView();
|
||||
} else {
|
||||
actionBar.setTitle(LocaleController.getString("Passcode", R.string.Passcode));
|
||||
actionBar.setTitle(context.getString(R.string.Passcode));
|
||||
frameLayout.setBackgroundColor(0xfff0f0f0);
|
||||
listView = new ListView(context);
|
||||
listView.setDivider(null);
|
||||
@@ -349,7 +349,7 @@ public class PasscodeActivity extends BaseFragment implements NotificationCenter
|
||||
return;
|
||||
}
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
|
||||
builder.setTitle(LocaleController.getString("AutoLock", R.string.AutoLock));
|
||||
builder.setTitle(context.getString(R.string.AutoLock));
|
||||
final NumberPicker numberPicker = new NumberPicker(getParentActivity());
|
||||
numberPicker.setMinValue(0);
|
||||
numberPicker.setMaxValue(4);
|
||||
@@ -368,22 +368,22 @@ public class PasscodeActivity extends BaseFragment implements NotificationCenter
|
||||
@Override
|
||||
public String format(int value) {
|
||||
if (value == 0) {
|
||||
return LocaleController.getString("Disabled", R.string.Disabled);
|
||||
return context.getString(R.string.Disabled);
|
||||
} else if (value == 1) {
|
||||
return ApplicationLoader.applicationContext.getResources().getQuantityString(R.plurals.Minutes, 1, 1);
|
||||
return context.getResources().getQuantityString(R.plurals.Minutes, 1, 1);
|
||||
} else if (value == 2) {
|
||||
return ApplicationLoader.applicationContext.getResources().getQuantityString(R.plurals.Minutes, 5, 5);
|
||||
return context.getResources().getQuantityString(R.plurals.Minutes, 5, 5);
|
||||
} else if (value == 3) {
|
||||
return ApplicationLoader.applicationContext.getResources().getQuantityString(R.plurals.Hours, 1, 1);
|
||||
return context.getResources().getQuantityString(R.plurals.Hours, 1, 1);
|
||||
} else if (value == 4) {
|
||||
return ApplicationLoader.applicationContext.getResources().getQuantityString(R.plurals.Hours, 5, 5);
|
||||
return context.getResources().getQuantityString(R.plurals.Hours, 5, 5);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
});
|
||||
numberPicker.setWrapSelectorWheel(false);
|
||||
builder.setView(numberPicker);
|
||||
builder.setNegativeButton(LocaleController.getString("Done", R.string.Done), new DialogInterface.OnClickListener() {
|
||||
builder.setNegativeButton(context.getString(R.string.Done), new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
which = numberPicker.getValue();
|
||||
@@ -498,9 +498,9 @@ public class PasscodeActivity extends BaseFragment implements NotificationCenter
|
||||
private void updateDropDownTextView() {
|
||||
if (dropDown != null) {
|
||||
if (currentPasswordType == 0) {
|
||||
dropDown.setText(LocaleController.getString("PasscodePIN", R.string.PasscodePIN));
|
||||
dropDown.setText(ApplicationLoader.applicationContext.getString(R.string.PasscodePIN));
|
||||
} else if (currentPasswordType == 1) {
|
||||
dropDown.setText(LocaleController.getString("PasscodePassword", R.string.PasscodePassword));
|
||||
dropDown.setText(ApplicationLoader.applicationContext.getString(R.string.PasscodePassword));
|
||||
}
|
||||
}
|
||||
if (screen == SCREEN1_ENTER_CODE1 && currentPasswordType == 0 || screen == SCREEN2_ENTER_CODE2 && UserConfig.passcodeType == 0) {
|
||||
@@ -523,12 +523,12 @@ public class PasscodeActivity extends BaseFragment implements NotificationCenter
|
||||
return;
|
||||
}
|
||||
if (currentPasswordType == 0) {
|
||||
actionBar.setTitle(LocaleController.getString("PasscodePIN", R.string.PasscodePIN));
|
||||
actionBar.setTitle(ApplicationLoader.applicationContext.getString(R.string.PasscodePIN));
|
||||
} else {
|
||||
actionBar.setTitle(LocaleController.getString("PasscodePassword", R.string.PasscodePassword));
|
||||
actionBar.setTitle(ApplicationLoader.applicationContext.getString(R.string.PasscodePassword));
|
||||
}
|
||||
dropDownContainer.setVisibility(View.GONE);
|
||||
titleTextView.setText(LocaleController.getString("ReEnterYourPasscode", R.string.ReEnterYourPasscode));
|
||||
titleTextView.setText(ApplicationLoader.applicationContext.getString(R.string.ReEnterYourPasscode));
|
||||
firstPassword = passwordEditText.getText().toString();
|
||||
passwordEditText.setText("");
|
||||
passcodeSetStep = 1;
|
||||
@@ -542,7 +542,7 @@ public class PasscodeActivity extends BaseFragment implements NotificationCenter
|
||||
if (screen == SCREEN1_ENTER_CODE1) {
|
||||
if (!firstPassword.equals(passwordEditText.getText().toString())) {
|
||||
try {
|
||||
Toast.makeText(getParentActivity(), LocaleController.getString("PasscodeDoNotMatch", R.string.PasscodeDoNotMatch), Toast.LENGTH_SHORT).show();
|
||||
Toast.makeText(getParentActivity(), ApplicationLoader.applicationContext.getString(R.string.PasscodeDoNotMatch), Toast.LENGTH_SHORT).show();
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
@@ -656,9 +656,9 @@ public class PasscodeActivity extends BaseFragment implements NotificationCenter
|
||||
TextCheckCell textCell = (TextCheckCell) view;
|
||||
|
||||
if (i == passcodeOnOffRow) {
|
||||
textCell.setTextAndCheck(LocaleController.getString("Passcode", R.string.Passcode), UserConfig.passcodeHash.length() > 0, true);
|
||||
textCell.setTextAndCheck(mContext.getString(R.string.Passcode), UserConfig.passcodeHash.length() > 0, true);
|
||||
} else if (i == fingerprintRow) {
|
||||
textCell.setTextAndCheck(LocaleController.getString("UnlockFingerprint", R.string.UnlockFingerprint), UserConfig.useFingerprint, true);
|
||||
textCell.setTextAndCheck(mContext.getString(R.string.UnlockFingerprint), UserConfig.useFingerprint, true);
|
||||
}
|
||||
} else if (viewType == 1) {
|
||||
if (view == null) {
|
||||
@@ -667,20 +667,20 @@ public class PasscodeActivity extends BaseFragment implements NotificationCenter
|
||||
}
|
||||
TextSettingsCell textCell = (TextSettingsCell) view;
|
||||
if (i == changePasscodeRow) {
|
||||
textCell.setText(LocaleController.getString("ChangePasscode", R.string.ChangePasscode), false);
|
||||
textCell.setText(mContext.getString(R.string.ChangePasscode), false);
|
||||
textCell.setTextColor(UserConfig.passcodeHash.length() == 0 ? 0xffc6c6c6 : 0xff000000);
|
||||
} else if (i == autoLockRow) {
|
||||
String val;
|
||||
if (UserConfig.autoLockIn == 0) {
|
||||
val = LocaleController.formatString("Disabled", R.string.Disabled);
|
||||
val = mContext.getString(R.string.Disabled);
|
||||
} else if (UserConfig.autoLockIn < 60 * 60) {
|
||||
val = ApplicationLoader.applicationContext.getResources().getQuantityString(R.plurals.Minutes, UserConfig.autoLockIn / 60, UserConfig.autoLockIn / 60);
|
||||
val = mContext.getResources().getQuantityString(R.plurals.Minutes, UserConfig.autoLockIn / 60, UserConfig.autoLockIn / 60);
|
||||
} else if (UserConfig.autoLockIn < 60 * 60 * 24) {
|
||||
val = ApplicationLoader.applicationContext.getResources().getQuantityString(R.plurals.Hours, (int) Math.ceil(UserConfig.autoLockIn / 60.0f / 60), (int) Math.ceil(UserConfig.autoLockIn / 60.0f / 60));
|
||||
val = mContext.getResources().getQuantityString(R.plurals.Hours, (int) Math.ceil(UserConfig.autoLockIn / 60.0f / 60), (int) Math.ceil(UserConfig.autoLockIn / 60.0f / 60));
|
||||
} else {
|
||||
val = ApplicationLoader.applicationContext.getResources().getQuantityString(R.plurals.Days, (int) Math.ceil(UserConfig.autoLockIn / 60.0f / 60 / 24), (int) Math.ceil(UserConfig.autoLockIn / 60.0f / 60 / 24));
|
||||
val = mContext.getResources().getQuantityString(R.plurals.Days, (int) Math.ceil(UserConfig.autoLockIn / 60.0f / 60 / 24), (int) Math.ceil(UserConfig.autoLockIn / 60.0f / 60 / 24));
|
||||
}
|
||||
textCell.setTextAndValue(LocaleController.getString("AutoLock", R.string.AutoLock), val, true);
|
||||
textCell.setTextAndValue(mContext.getString(R.string.AutoLock), val, true);
|
||||
textCell.setTextColor(0xff000000);
|
||||
}
|
||||
} else if (viewType == 2) {
|
||||
@@ -688,14 +688,14 @@ public class PasscodeActivity extends BaseFragment implements NotificationCenter
|
||||
view = new TextInfoCell(mContext);
|
||||
}
|
||||
if (i == passcodeDetailRow) {
|
||||
((TextInfoCell) view).setText(LocaleController.getString("ChangePasscodeInfo", R.string.ChangePasscodeInfo));
|
||||
((TextInfoCell) view).setText(mContext.getString(R.string.ChangePasscodeInfo));
|
||||
if (autoLockDetailRow != -1) {
|
||||
view.setBackgroundResource(R.drawable.greydivider);
|
||||
} else {
|
||||
view.setBackgroundResource(R.drawable.greydivider_bottom);
|
||||
}
|
||||
} else if (i == autoLockDetailRow) {
|
||||
((TextInfoCell) view).setText(LocaleController.getString("AutoLockInfo", R.string.AutoLockInfo));
|
||||
((TextInfoCell) view).setText(mContext.getString(R.string.AutoLockInfo));
|
||||
view.setBackgroundResource(R.drawable.greydivider_bottom);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -120,7 +120,7 @@ public class PhotoAlbumPickerActivity extends BaseFragment implements Notificati
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public View createView(Context context) {
|
||||
public View createView(final Context context) {
|
||||
actionBar.setBackButtonImage(R.drawable.ic_ab_back);
|
||||
actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {
|
||||
@Override
|
||||
@@ -137,16 +137,16 @@ public class PhotoAlbumPickerActivity extends BaseFragment implements Notificati
|
||||
return;
|
||||
}
|
||||
selectedMode = SELECTMODE0_PHOTOS;
|
||||
dropDown.setText(LocaleController.getString("PickerPhotos", R.string.PickerPhotos));
|
||||
emptyView.setText(LocaleController.getString("NoPhotos", R.string.NoPhotos));
|
||||
dropDown.setText(context.getString(R.string.PickerPhotos));
|
||||
emptyView.setText(context.getString(R.string.NoPhotos));
|
||||
listAdapter.notifyDataSetChanged();
|
||||
} else if (id == ID_ITEM_VIDEO) {
|
||||
if (selectedMode == SELECTMODE1_VIDEOS) {
|
||||
return;
|
||||
}
|
||||
selectedMode = SELECTMODE1_VIDEOS;
|
||||
dropDown.setText(LocaleController.getString("PickerVideo", R.string.PickerVideo));
|
||||
emptyView.setText(LocaleController.getString("NoVideo", R.string.NoVideo));
|
||||
dropDown.setText(context.getString(R.string.PickerVideo));
|
||||
emptyView.setText(context.getString(R.string.NoVideo));
|
||||
listAdapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
@@ -165,8 +165,8 @@ public class PhotoAlbumPickerActivity extends BaseFragment implements Notificati
|
||||
|
||||
dropDownContainer = new ActionBarMenuItem(context, menu, 0);
|
||||
dropDownContainer.setSubMenuOpenSide(1);
|
||||
dropDownContainer.addSubItem(ID_ITEM_PHOTOS, LocaleController.getString("PickerPhotos", R.string.PickerPhotos), 0);
|
||||
dropDownContainer.addSubItem(ID_ITEM_VIDEO, LocaleController.getString("PickerVideo", R.string.PickerVideo), 0);
|
||||
dropDownContainer.addSubItem(ID_ITEM_PHOTOS, context.getString(R.string.PickerPhotos), 0);
|
||||
dropDownContainer.addSubItem(ID_ITEM_VIDEO, context.getString(R.string.PickerVideo), 0);
|
||||
actionBar.addView(dropDownContainer);
|
||||
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) dropDownContainer.getLayoutParams();
|
||||
layoutParams.height = LayoutHelper.MATCH_PARENT;
|
||||
@@ -192,7 +192,7 @@ public class PhotoAlbumPickerActivity extends BaseFragment implements Notificati
|
||||
dropDown.setCompoundDrawablesWithIntrinsicBounds(0, 0, R.drawable.ic_arrow_drop_down, 0);
|
||||
dropDown.setCompoundDrawablePadding(AndroidUtilities.dp(4));
|
||||
dropDown.setPadding(0, 0, AndroidUtilities.dp(10), 0);
|
||||
dropDown.setText(LocaleController.getString("PickerPhotos", R.string.PickerPhotos));
|
||||
dropDown.setText(context.getString(R.string.PickerPhotos));
|
||||
dropDownContainer.addView(dropDown);
|
||||
layoutParams = (FrameLayout.LayoutParams) dropDown.getLayoutParams();
|
||||
layoutParams.width = LayoutHelper.WRAP_CONTENT;
|
||||
@@ -201,7 +201,7 @@ public class PhotoAlbumPickerActivity extends BaseFragment implements Notificati
|
||||
layoutParams.gravity = Gravity.CENTER_VERTICAL;
|
||||
dropDown.setLayoutParams(layoutParams);
|
||||
} else {
|
||||
actionBar.setTitle(LocaleController.getString("Gallery", R.string.Gallery));
|
||||
actionBar.setTitle(context.getString(R.string.Gallery));
|
||||
}
|
||||
|
||||
listView = new ListView(context);
|
||||
@@ -227,7 +227,7 @@ public class PhotoAlbumPickerActivity extends BaseFragment implements Notificati
|
||||
emptyView.setTextSize(20);
|
||||
emptyView.setGravity(Gravity.CENTER);
|
||||
emptyView.setVisibility(View.GONE);
|
||||
emptyView.setText(LocaleController.getString("NoPhotos", R.string.NoPhotos));
|
||||
emptyView.setText(context.getString(R.string.NoPhotos));
|
||||
frameLayout.addView(emptyView);
|
||||
layoutParams = (FrameLayout.LayoutParams) emptyView.getLayoutParams();
|
||||
layoutParams.width = LayoutHelper.MATCH_PARENT;
|
||||
|
||||
@@ -434,7 +434,7 @@ public class PhotoCropActivity extends BaseFragment {
|
||||
actionBar.setItemsBackgroundColor(Theme.ACTION_BAR_PICKER_SELECTOR_COLOR);
|
||||
actionBar.setBackButtonImage(R.drawable.ic_ab_back);
|
||||
actionBar.setAllowOverlayTitle(true);
|
||||
actionBar.setTitle(LocaleController.getString("CropImage", R.string.CropImage));
|
||||
actionBar.setTitle(context.getString(R.string.CropImage));
|
||||
actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {
|
||||
@Override
|
||||
public void onItemClick(int id) {
|
||||
|
||||
@@ -167,7 +167,7 @@ public class PhotoPickerActivity extends BaseFragment implements NotificationCen
|
||||
emptyView.setTextSize(20);
|
||||
emptyView.setGravity(Gravity.CENTER);
|
||||
emptyView.setVisibility(View.GONE);
|
||||
emptyView.setText(LocaleController.getString("NoPhotos", R.string.NoPhotos));
|
||||
emptyView.setText(context.getString(R.string.NoPhotos));
|
||||
|
||||
frameLayout.addView(emptyView);
|
||||
layoutParams = (FrameLayout.LayoutParams) emptyView.getLayoutParams();
|
||||
|
||||
@@ -63,11 +63,11 @@ import android.widget.Toast;
|
||||
|
||||
import com.b44t.messenger.AndroidUtilities;
|
||||
import com.b44t.messenger.ImageLoader;
|
||||
import com.b44t.messenger.LocaleController;
|
||||
import com.b44t.messenger.MrContact;
|
||||
import com.b44t.messenger.MrMailbox;
|
||||
import com.b44t.messenger.ApplicationLoader;
|
||||
import com.b44t.messenger.FileLoader;
|
||||
import com.b44t.messenger.LocaleController;
|
||||
import com.b44t.messenger.MediaController;
|
||||
import com.b44t.messenger.NotificationCenter;
|
||||
import com.b44t.messenger.R;
|
||||
@@ -703,9 +703,9 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
||||
//SharedMediaQuery.loadMedia(currentDialogId, 0, 80, 0, SharedMediaQuery.MEDIA_PHOTOVIDEO, true, classGuid);
|
||||
} else if (!imagesArr.isEmpty()) {
|
||||
if (opennedFromMedia) {
|
||||
actionBar.setTitle(LocaleController.formatString("Of", R.string.Of, currentIndex + 1, totalImagesCount + totalImagesCountMerge));
|
||||
actionBar.setTitle(String.format(ApplicationLoader.applicationContext.getString(R.string.Of), currentIndex + 1, totalImagesCount + totalImagesCountMerge));
|
||||
} else {
|
||||
actionBar.setTitle(LocaleController.formatString("Of", R.string.Of, (totalImagesCount + totalImagesCountMerge - imagesArr.size()) + currentIndex + 1, totalImagesCount + totalImagesCountMerge));
|
||||
actionBar.setTitle(String.format(ApplicationLoader.applicationContext.getString(R.string.Of), (totalImagesCount + totalImagesCountMerge - imagesArr.size()) + currentIndex + 1, totalImagesCount + totalImagesCountMerge));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -906,7 +906,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
||||
actionBar.setOccupyStatusBar(false);
|
||||
actionBar.setItemsBackgroundColor(Theme.ACTION_BAR_WHITE_SELECTOR_COLOR);
|
||||
actionBar.setBackButtonImage(R.drawable.ic_ab_back);
|
||||
actionBar.setTitle(LocaleController.formatString("Of", R.string.Of, 1, 1));
|
||||
actionBar.setTitle(String.format(ApplicationLoader.applicationContext.getString(R.string.Of), 1, 1));
|
||||
containerView.addView(actionBar, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
|
||||
|
||||
actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {
|
||||
@@ -941,10 +941,10 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
||||
switchToEditMode(2);
|
||||
}
|
||||
else if (id == gallery_menu_forward) {
|
||||
Toast.makeText(parentActivity, LocaleController.getString("NotYetImplemented", R.string.NotYetImplemented), Toast.LENGTH_SHORT).show();
|
||||
Toast.makeText(parentActivity, ApplicationLoader.applicationContext.getString(R.string.NotYetImplemented), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
else if (id == gallery_menu_delete) {
|
||||
Toast.makeText(parentActivity, LocaleController.getString("NotYetImplemented", R.string.NotYetImplemented), Toast.LENGTH_SHORT).show();
|
||||
Toast.makeText(parentActivity, ApplicationLoader.applicationContext.getString(R.string.NotYetImplemented), Toast.LENGTH_SHORT).show();
|
||||
/*
|
||||
if (parentActivity == null) {
|
||||
return;
|
||||
@@ -1916,7 +1916,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
||||
});
|
||||
}
|
||||
|
||||
editorDoneLayout.doneButtonTextView.setText(LocaleController.getString("Crop", R.string.Crop));
|
||||
editorDoneLayout.doneButtonTextView.setText(ApplicationLoader.applicationContext.getString(R.string.Crop));
|
||||
changeModeAnimation = new AnimatorSet();
|
||||
ArrayList<Animator> arrayList = new ArrayList<>();
|
||||
arrayList.add(ObjectAnimator.ofFloat(pickerView, "translationY", 0, AndroidUtilities.dp(96)));
|
||||
@@ -2011,14 +2011,14 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
||||
return;
|
||||
}
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(parentActivity);
|
||||
builder.setMessage(LocaleController.getString("DiscardChanges", R.string.DiscardChanges));
|
||||
builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), new DialogInterface.OnClickListener() {
|
||||
builder.setMessage(ApplicationLoader.applicationContext.getString(R.string.DiscardChanges));
|
||||
builder.setPositiveButton(ApplicationLoader.applicationContext.getString(R.string.OK), new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
switchToEditMode(0);
|
||||
}
|
||||
});
|
||||
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
|
||||
builder.setNegativeButton(ApplicationLoader.applicationContext.getString(R.string.Cancel), null);
|
||||
showAlertDialog(builder);
|
||||
} else {
|
||||
switchToEditMode(0);
|
||||
@@ -2477,7 +2477,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
||||
*/
|
||||
|
||||
long date = (long) currentMessageObject.messageOwner.date * 1000;
|
||||
String dateString = LocaleController.formatString("formatDateAtTime", R.string.formatDateAtTime, LocaleController.getInstance().formatterYear.format(new Date(date)), LocaleController.getInstance().formatterDay.format(new Date(date)));
|
||||
String dateString = String.format(ApplicationLoader.applicationContext.getString(R.string.formatDateAtTime), LocaleController.getInstance().formatterYear.format(new Date(date)), LocaleController.getInstance().formatterDay.format(new Date(date)));
|
||||
if (currentFileNames[0] != null && isVideo) {
|
||||
dateTextView.setText(String.format("%s (%s)", dateString, AndroidUtilities.formatFileSize(currentMessageObject.getDocument().size)));
|
||||
} else {
|
||||
@@ -2489,7 +2489,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
||||
if (currentAnimation != null) {
|
||||
menuItem.hideSubItem(gallery_menu_save);
|
||||
menuItem.hideSubItem(gallery_menu_share);
|
||||
actionBar.setTitle(LocaleController.getString("AttachGif", R.string.AttachGif));
|
||||
actionBar.setTitle(ApplicationLoader.applicationContext.getString(R.string.AttachGif));
|
||||
} else {
|
||||
if (totalImagesCount + totalImagesCountMerge != 0 && !needSearchImageInArr) {
|
||||
if (opennedFromMedia) {
|
||||
@@ -2506,7 +2506,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
||||
//SharedMediaQuery.loadMedia(loadIndex == 0 ? currentDialogId : mergeDialogId, 0, 80, loadFromMaxId, SharedMediaQuery.MEDIA_PHOTOVIDEO, true, classGuid);
|
||||
loadingMoreImages = true;
|
||||
}
|
||||
actionBar.setTitle(LocaleController.formatString("Of", R.string.Of, currentIndex + 1, totalImagesCount + totalImagesCountMerge));
|
||||
actionBar.setTitle(String.format(ApplicationLoader.applicationContext.getString(R.string.Of), currentIndex + 1, totalImagesCount + totalImagesCountMerge));
|
||||
} else {
|
||||
if (imagesArr.size() < totalImagesCount + totalImagesCountMerge && !loadingMoreImages && currentIndex < 5) {
|
||||
int loadFromMaxId = imagesArr.isEmpty() ? 0 : imagesArr.get(0).getId();
|
||||
@@ -2521,7 +2521,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
||||
//SharedMediaQuery.loadMedia(loadIndex == 0 ? currentDialogId : mergeDialogId, 0, 80, loadFromMaxId, SharedMediaQuery.MEDIA_PHOTOVIDEO, true, classGuid);
|
||||
loadingMoreImages = true;
|
||||
}
|
||||
actionBar.setTitle(LocaleController.formatString("Of", R.string.Of, (totalImagesCount + totalImagesCountMerge - imagesArr.size()) + currentIndex + 1, totalImagesCount + totalImagesCountMerge));
|
||||
actionBar.setTitle(String.format(ApplicationLoader.applicationContext.getString(R.string.Of), (totalImagesCount + totalImagesCountMerge - imagesArr.size()) + currentIndex + 1, totalImagesCount + totalImagesCountMerge));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2540,7 +2540,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
||||
if (old != null && currentFileLocation != null && old.local_id == currentFileLocation.local_id && old.volume_id == currentFileLocation.volume_id) {
|
||||
sameImage = true;
|
||||
}
|
||||
actionBar.setTitle(LocaleController.formatString("Of", R.string.Of, currentIndex + 1, imagesArrLocations.size()));
|
||||
actionBar.setTitle(String.format(ApplicationLoader.applicationContext.getString(R.string.Of), currentIndex + 1, imagesArrLocations.size()));
|
||||
menuItem.showSubItem(gallery_menu_save);
|
||||
menuItem.showSubItem(gallery_menu_share);
|
||||
} else if (!imagesArrLocals.isEmpty()) {
|
||||
@@ -2562,9 +2562,9 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
||||
}
|
||||
}
|
||||
if (fromCamera) {
|
||||
actionBar.setTitle(LocaleController.getString("AttachPhoto", R.string.AttachPhoto));
|
||||
actionBar.setTitle(ApplicationLoader.applicationContext.getString(R.string.AttachPhoto));
|
||||
} else {
|
||||
actionBar.setTitle(LocaleController.formatString("Of", R.string.Of, currentIndex + 1, imagesArrLocals.size()));
|
||||
actionBar.setTitle(String.format(ApplicationLoader.applicationContext.getString(R.string.Of), currentIndex + 1, imagesArrLocals.size()));
|
||||
}
|
||||
if (sendPhotoType == 0) {
|
||||
checkImageView.setChecked(placeProvider.isPhotoChecked(currentIndex), false);
|
||||
@@ -2796,7 +2796,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
||||
if (document != null) {
|
||||
imageReceiver.setImage(document, null, "d", placeHolder != null ? new BitmapDrawable(null, placeHolder) : null, placeHolder == null ? document.thumb.location : null, String.format(Locale.US, "%d_%d", size, size), imageSize, null, false);
|
||||
} else {
|
||||
imageReceiver.setImage(path, filter, placeHolder != null ? new BitmapDrawable(null, placeHolder) : null, null, imageSize);
|
||||
imageReceiver.setImageByPath(path, filter, placeHolder != null ? new BitmapDrawable(null, placeHolder) : null, null, imageSize);
|
||||
}
|
||||
} else {
|
||||
imageReceiver.setImageBitmap((Bitmap) null);
|
||||
@@ -2881,7 +2881,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
||||
public void openPhotoForSelect(final ArrayList<Object> photos, final int index, int type, final PhotoViewerProvider provider, ChatActivity chatActivity) {
|
||||
sendPhotoType = type;
|
||||
if (pickerView != null) {
|
||||
pickerView.doneButtonTextView.setText(sendPhotoType == 1 ? LocaleController.getString("Set", R.string.Set).toUpperCase() : LocaleController.getString("Send", R.string.Send).toUpperCase());
|
||||
pickerView.doneButtonTextView.setText(sendPhotoType == 1 ? ApplicationLoader.applicationContext.getString(R.string.Set).toUpperCase() : ApplicationLoader.applicationContext.getString(R.string.Send).toUpperCase());
|
||||
}
|
||||
openPhoto(null, null, null, photos, index, provider, chatActivity, 0);
|
||||
}
|
||||
@@ -2932,7 +2932,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
||||
|
||||
parentChatActivity = chatActivity;
|
||||
|
||||
actionBar.setTitle(LocaleController.formatString("Of", R.string.Of, 1, 1));
|
||||
actionBar.setTitle(String.format(ApplicationLoader.applicationContext.getString(R.string.Of), 1, 1));
|
||||
NotificationCenter.getInstance().addObserver(this, NotificationCenter.mediaCountDidLoaded);
|
||||
NotificationCenter.getInstance().addObserver(this, NotificationCenter.mediaDidLoaded);
|
||||
NotificationCenter.getInstance().addObserver(this, NotificationCenter.emojiDidLoaded);
|
||||
|
||||
@@ -249,7 +249,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
|
||||
}
|
||||
|
||||
@Override
|
||||
public View createView(Context context) {
|
||||
public View createView(final Context context) {
|
||||
hasOwnBackground = true;
|
||||
extraHeight = AndroidUtilities.dp(88);
|
||||
actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {
|
||||
@@ -263,7 +263,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
|
||||
}
|
||||
else if( id==ID_STOP_ENCRYPTION_FOR_THIS_USER )
|
||||
{
|
||||
Toast.makeText(getParentActivity(), LocaleController.getString("NotYetImplemented", R.string.NotYetImplemented), Toast.LENGTH_SHORT).show();
|
||||
Toast.makeText(getParentActivity(), context.getString(R.string.NotYetImplemented), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
else if (id == ID_BLOCK_CONTACT)
|
||||
{
|
||||
@@ -273,27 +273,27 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
|
||||
}
|
||||
else {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
|
||||
builder.setMessage(LocaleController.getString("AreYouSureBlockContact", R.string.AreYouSureBlockContact));
|
||||
builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), new DialogInterface.OnClickListener() {
|
||||
builder.setMessage(context.getString(R.string.AreYouSureBlockContact));
|
||||
builder.setPositiveButton(context.getString(R.string.OK), new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
MrMailbox.blockContact(user_id, 1);
|
||||
finishFragment(); /* got to the parent, this is important eg. when editing blocking in the BlockedUserActivitiy. Moreover, this saves us updating all the states in the profile */
|
||||
}
|
||||
});
|
||||
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
|
||||
builder.setNegativeButton(context.getString(R.string.Cancel), null);
|
||||
showDialog(builder.create());
|
||||
}
|
||||
}
|
||||
else if (id == ID_DELETE_CONTACT)
|
||||
{
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
|
||||
builder.setMessage(LocaleController.getString("AreYouSureDeleteContact", R.string.AreYouSureDeleteContact));
|
||||
builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), new DialogInterface.OnClickListener() {
|
||||
builder.setMessage(context.getString(R.string.AreYouSureDeleteContact));
|
||||
builder.setPositiveButton(context.getString(R.string.OK), new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
if( MrMailbox.deleteContact(user_id)==0 ) {
|
||||
AndroidUtilities.showHint(getParentActivity(), ApplicationLoader.applicationContext.getString(R.string.CannotDeleteContact));
|
||||
AndroidUtilities.showHint(getParentActivity(), context.getString(R.string.CannotDeleteContact));
|
||||
}
|
||||
else {
|
||||
AndroidUtilities.showDoneHint(getParentActivity());
|
||||
@@ -301,7 +301,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
|
||||
}
|
||||
}
|
||||
});
|
||||
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
|
||||
builder.setNegativeButton(context.getString(R.string.Cancel), null);
|
||||
showDialog(builder.create());
|
||||
}
|
||||
else if (id == ID_ADD_SHORTCUT)
|
||||
@@ -317,7 +317,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
|
||||
// add shortcut
|
||||
int install_chat_id = chat_id!=0? chat_id : MrMailbox.getChatIdByContactId(user_id);
|
||||
AndroidUtilities.installShortcut(install_chat_id, bitmap);
|
||||
Toast.makeText(getParentActivity(), LocaleController.getString("ShortcutAdded", R.string.ShortcutAdded), Toast.LENGTH_LONG).show();
|
||||
Toast.makeText(getParentActivity(), context.getString(R.string.ShortcutAdded), Toast.LENGTH_LONG).show();
|
||||
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -399,7 +399,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
|
||||
}
|
||||
else if(position==compareKeysRow)
|
||||
{
|
||||
Toast.makeText(getParentActivity(), LocaleController.getString("NotYetImplemented", R.string.NotYetImplemented), Toast.LENGTH_SHORT).show();
|
||||
Toast.makeText(getParentActivity(), context.getString(R.string.NotYetImplemented), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
else if(position==startChatRow)
|
||||
{
|
||||
@@ -415,7 +415,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
|
||||
|
||||
String name = MrMailbox.getContact(user_id).getNameNAddr();
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
|
||||
builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), new DialogInterface.OnClickListener() {
|
||||
builder.setPositiveButton(context.getString(R.string.OK), new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
int belonging_chat_id = MrMailbox.createChatByContactId(user_id);
|
||||
@@ -429,8 +429,8 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
|
||||
}
|
||||
}
|
||||
});
|
||||
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
|
||||
builder.setMessage(AndroidUtilities.replaceTags(LocaleController.formatString("AskStartChatWith", R.string.AskStartChatWith, name)));
|
||||
builder.setNegativeButton(context.getString(R.string.Cancel), null);
|
||||
builder.setMessage(AndroidUtilities.replaceTags(String.format(context.getString(R.string.AskStartChatWith), name)));
|
||||
showDialog(builder.create());
|
||||
}
|
||||
else if (position == addMemberRow)
|
||||
@@ -443,20 +443,20 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
|
||||
public void didSelectContact(final int added_user_id) {
|
||||
if( MrMailbox.isContactInChat(chat_id, added_user_id)!=0 )
|
||||
{
|
||||
Toast.makeText(getParentActivity(), ApplicationLoader.applicationContext.getString(R.string.ContactAlreadyInGroup), Toast.LENGTH_SHORT).show();
|
||||
Toast.makeText(getParentActivity(), context.getString(R.string.ContactAlreadyInGroup), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
else {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
|
||||
builder.setPositiveButton(ApplicationLoader.applicationContext.getString(R.string.OK), new DialogInterface.OnClickListener() {
|
||||
builder.setPositiveButton(context.getString(R.string.OK), new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
MrMailbox.addContactToChat(chat_id, added_user_id);
|
||||
NotificationCenter.getInstance().postNotificationName(NotificationCenter.updateInterfaces, MrMailbox.UPDATE_MASK_CHAT_MEMBERS);
|
||||
}
|
||||
});
|
||||
builder.setNegativeButton(ApplicationLoader.applicationContext.getString(R.string.Cancel), null);
|
||||
builder.setNegativeButton(context.getString(R.string.Cancel), null);
|
||||
String name = MrMailbox.getContact(added_user_id).getDisplayName();
|
||||
builder.setMessage(AndroidUtilities.replaceTags(LocaleController.formatString("AskAddMemberToGroup", R.string.AskAddMemberToGroup, name)));
|
||||
builder.setMessage(AndroidUtilities.replaceTags(String.format(context.getString(R.string.AskAddMemberToGroup), name)));
|
||||
showDialog(builder.create());
|
||||
}
|
||||
}
|
||||
@@ -488,22 +488,22 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
|
||||
{
|
||||
final int curr_user_id = sortedUserIds[curr_user_index];
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
|
||||
CharSequence[] items = new CharSequence[]{LocaleController.getString("RemoveMember", R.string.RemoveMember)};
|
||||
CharSequence[] items = new CharSequence[]{context.getString(R.string.RemoveMember)};
|
||||
builder.setItems(items, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
|
||||
builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), new DialogInterface.OnClickListener() {
|
||||
builder.setPositiveButton(context.getString(R.string.OK), new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
MrMailbox.removeContactFromChat(chat_id, curr_user_id);
|
||||
NotificationCenter.getInstance().postNotificationName(NotificationCenter.updateInterfaces, MrMailbox.UPDATE_MASK_CHAT_MEMBERS);
|
||||
}
|
||||
});
|
||||
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
|
||||
builder.setNegativeButton(context.getString(R.string.Cancel), null);
|
||||
String name = MrMailbox.getContact(curr_user_id).getDisplayName();
|
||||
builder.setMessage(AndroidUtilities.replaceTags(LocaleController.formatString("AskRemoveMemberFromGroup", R.string.AskRemoveMemberFromGroup, name)));
|
||||
builder.setMessage(AndroidUtilities.replaceTags(String.format(context.getString(R.string.AskRemoveMemberFromGroup), name)));
|
||||
showDialog(builder.create());
|
||||
}
|
||||
});
|
||||
@@ -1198,13 +1198,13 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
|
||||
ActionBarMenuItem item = menu.addItem(10, R.drawable.ic_ab_other);
|
||||
|
||||
if( chat_id!=0 || MrMailbox.getChatIdByContactId(user_id)!=0 ) {
|
||||
item.addSubItem(ID_ADD_SHORTCUT, LocaleController.getString("AddShortcut", R.string.AddShortcut), 0);
|
||||
item.addSubItem(ID_ADD_SHORTCUT, ApplicationLoader.applicationContext.getString(R.string.AddShortcut), 0);
|
||||
}
|
||||
|
||||
if (user_id != 0) {
|
||||
item.addSubItem(ID_STOP_ENCRYPTION_FOR_THIS_USER, ApplicationLoader.applicationContext.getString(R.string.ResetContactsKey), 0);
|
||||
item.addSubItem(ID_BLOCK_CONTACT, userBlocked()? LocaleController.getString("UnblockContact", R.string.UnblockContact) : LocaleController.getString("BlockContact", R.string.BlockContact), 0);
|
||||
item.addSubItem(ID_DELETE_CONTACT, LocaleController.getString("DeleteContact", R.string.DeleteContact), 0);
|
||||
item.addSubItem(ID_BLOCK_CONTACT, userBlocked()? ApplicationLoader.applicationContext.getString(R.string.UnblockContact) : ApplicationLoader.applicationContext.getString(R.string.BlockContact), 0);
|
||||
item.addSubItem(ID_DELETE_CONTACT, ApplicationLoader.applicationContext.getString(R.string.DeleteContact), 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -1307,15 +1307,15 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
|
||||
TextCell textCell = (TextCell) holder.itemView;
|
||||
textCell.setTextColor(0xff212121);
|
||||
if (i == changeNameRow) {
|
||||
textCell.setText(LocaleController.getString("EditName", R.string.EditName));
|
||||
textCell.setText(mContext.getString(R.string.EditName));
|
||||
} else if (i == compareKeysRow) {
|
||||
textCell.setText(LocaleController.getString("E2ECompareKeys", R.string.E2ECompareKeys));
|
||||
textCell.setText(mContext.getString(R.string.E2ECompareKeys));
|
||||
} else if (i == startChatRow) {
|
||||
textCell.setText(LocaleController.getString("NewChat", R.string.NewChat));
|
||||
textCell.setText(mContext.getString(R.string.NewChat));
|
||||
} else if (i == settingsNotificationsRow) {
|
||||
textCell.setTextAndIcon(LocaleController.getString("Settings", R.string.Settings), R.drawable.menu_settings);
|
||||
textCell.setTextAndIcon(mContext.getString(R.string.Settings), R.drawable.menu_settings);
|
||||
} else if (i == addMemberRow) {
|
||||
textCell.setText(LocaleController.getString("AddMember", R.string.AddMember));
|
||||
textCell.setText(mContext.getString(R.string.AddMember));
|
||||
}
|
||||
break;
|
||||
case typeContactCell:
|
||||
|
||||
@@ -51,10 +51,10 @@ import com.b44t.messenger.MrMailbox;
|
||||
import com.b44t.messenger.ApplicationLoader;
|
||||
import com.b44t.messenger.LocaleController;
|
||||
import com.b44t.messenger.NotificationCenter;
|
||||
import com.b44t.messenger.NotificationsController;
|
||||
import com.b44t.messenger.R;
|
||||
import com.b44t.ui.Adapters.BaseFragmentAdapter;
|
||||
import com.b44t.ui.Cells.HeaderCell;
|
||||
import com.b44t.ui.Cells.TextColorCell;
|
||||
import com.b44t.ui.Cells.TextSettingsCell;
|
||||
import com.b44t.ui.Cells.TextDetailSettingsCell;
|
||||
import com.b44t.ui.ActionBar.ActionBar;
|
||||
@@ -80,20 +80,20 @@ public class ProfileNotificationsActivity extends BaseFragment implements Notifi
|
||||
private final int TYPE_HEADER = 0;
|
||||
private final int TYPE_TEXTSETTINGS = 1;
|
||||
private final int TYPE_TEXTDETAILS = 2;
|
||||
private final int TYPE_COLOR_CELL = 3;
|
||||
private final int TYPE_COUNT = 4;
|
||||
private final int TYPE_COUNT = 3;
|
||||
|
||||
private MrChat m_mrChat;
|
||||
private boolean m_isGroupChat;
|
||||
|
||||
public ProfileNotificationsActivity(Bundle args) {
|
||||
super(args);
|
||||
dialog_id = args.getInt("chat_id");
|
||||
m_mrChat = MrMailbox.getChat(dialog_id);
|
||||
m_isGroupChat = m_mrChat.getType()== MrChat.MR_CHAT_GROUP;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onFragmentCreate() {
|
||||
boolean isGroupChat = m_mrChat.getType()== MrChat.MR_CHAT_GROUP;
|
||||
|
||||
headerRow = rowCount++;
|
||||
settingsNotificationsRow = rowCount++;
|
||||
@@ -102,7 +102,7 @@ public class ProfileNotificationsActivity extends BaseFragment implements Notifi
|
||||
settingsLedRow = rowCount++;
|
||||
settingsPriorityRow = Build.VERSION.SDK_INT >= 21? rowCount++ : -1;
|
||||
|
||||
if (isGroupChat) {
|
||||
if (m_isGroupChat) {
|
||||
smartRow = rowCount++;
|
||||
} else {
|
||||
smartRow = -1;
|
||||
@@ -119,11 +119,10 @@ public class ProfileNotificationsActivity extends BaseFragment implements Notifi
|
||||
}
|
||||
|
||||
@Override
|
||||
public View createView(Context context) {
|
||||
public View createView(final Context context) {
|
||||
actionBar.setBackButtonImage(R.drawable.ic_ab_back);
|
||||
actionBar.setAllowOverlayTitle(true);
|
||||
actionBar.setTitle(m_mrChat.getName());
|
||||
actionBar.setSubtitle(LocaleController.getString("Settings", R.string.Settings));
|
||||
actionBar.setTitle(String.format(context.getString(R.string.SettingsFor), m_mrChat.getName()));
|
||||
actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {
|
||||
@Override
|
||||
public void onItemClick(int id) {
|
||||
@@ -150,13 +149,12 @@ public class ProfileNotificationsActivity extends BaseFragment implements Notifi
|
||||
public void onItemClick(AdapterView<?> adapterView, View view, final int i, long l) {
|
||||
if (i == settingsVibrateRow) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
|
||||
builder.setTitle(LocaleController.getString("Vibrate", R.string.Vibrate));
|
||||
builder.setTitle(context.getString(R.string.Vibrate));
|
||||
builder.setItems(new CharSequence[]{
|
||||
LocaleController.getString("Disabled", R.string.Disabled),
|
||||
LocaleController.getString("Default", R.string.Default),
|
||||
LocaleController.getString("SystemDefault", R.string.SystemDefault),
|
||||
LocaleController.getString("Short", R.string.Short),
|
||||
LocaleController.getString("Long", R.string.Long)
|
||||
context.getString(R.string.Disabled),
|
||||
context.getString(R.string.Default),
|
||||
context.getString(R.string.Short),
|
||||
context.getString(R.string.Long)
|
||||
}, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
@@ -164,15 +162,13 @@ public class ProfileNotificationsActivity extends BaseFragment implements Notifi
|
||||
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE);
|
||||
SharedPreferences.Editor editor = preferences.edit();
|
||||
if (which == 0) {
|
||||
editor.putInt("vibrate_" + dialog_id, 2);
|
||||
editor.putInt("vibrate_" + dialog_id, 2); // off
|
||||
} else if (which == 1) {
|
||||
editor.putInt("vibrate_" + dialog_id, 0);
|
||||
editor.remove("vibrate_" + dialog_id); // delta-chat-default
|
||||
} else if (which == 2) {
|
||||
editor.putInt("vibrate_" + dialog_id, 4);
|
||||
editor.putInt("vibrate_" + dialog_id, 1); // short
|
||||
} else if (which == 3) {
|
||||
editor.putInt("vibrate_" + dialog_id, 1);
|
||||
} else if (which == 4) {
|
||||
editor.putInt("vibrate_" + dialog_id, 3);
|
||||
editor.putInt("vibrate_" + dialog_id, 3); // long
|
||||
}
|
||||
editor.apply();
|
||||
}
|
||||
@@ -181,7 +177,7 @@ public class ProfileNotificationsActivity extends BaseFragment implements Notifi
|
||||
}
|
||||
}
|
||||
});
|
||||
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
|
||||
builder.setNegativeButton(context.getString(R.string.Cancel), null);
|
||||
showDialog(builder.create());
|
||||
} else if (i == settingsNotificationsRow) {
|
||||
if (getParentActivity() == null) {
|
||||
@@ -189,9 +185,9 @@ public class ProfileNotificationsActivity extends BaseFragment implements Notifi
|
||||
}
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
|
||||
builder.setItems(new CharSequence[]{
|
||||
LocaleController.getString("Default", R.string.Default),
|
||||
LocaleController.getString("Enabled", R.string.Enabled),
|
||||
LocaleController.getString("Disabled", R.string.Disabled)
|
||||
context.getString(R.string.Default),
|
||||
context.getString(R.string.Enabled),
|
||||
context.getString(R.string.Disabled)
|
||||
}, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface d, int which) {
|
||||
@@ -216,7 +212,7 @@ public class ProfileNotificationsActivity extends BaseFragment implements Notifi
|
||||
NotificationCenter.getInstance().postNotificationName(NotificationCenter.notificationsSettingsUpdated);
|
||||
}
|
||||
});
|
||||
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
|
||||
builder.setNegativeButton(context.getString(R.string.Cancel), null);
|
||||
showDialog(builder.create());
|
||||
} else if (i == settingsSoundRow) {
|
||||
try {
|
||||
@@ -259,44 +255,40 @@ public class ProfileNotificationsActivity extends BaseFragment implements Notifi
|
||||
|
||||
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE);
|
||||
if (preferences.contains("color_" + dialog_id)) {
|
||||
colorPickerView.setColor(preferences.getInt("color_" + dialog_id, 0xff00ff00));
|
||||
colorPickerView.setColor(preferences.getInt("color_" + dialog_id, NotificationsController.DEF_LED_COLOR));
|
||||
} else {
|
||||
if ((int) dialog_id < 0) {
|
||||
colorPickerView.setColor(preferences.getInt("GroupLed", 0xff00ff00));
|
||||
} else {
|
||||
colorPickerView.setColor(preferences.getInt("MessagesLed", 0xff00ff00));
|
||||
}
|
||||
colorPickerView.setColor(preferences.getInt(m_isGroupChat? "GroupLed" : "MessagesLed", NotificationsController.DEF_LED_COLOR));
|
||||
}
|
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
|
||||
builder.setTitle(LocaleController.getString("LedColor", R.string.LedColor));
|
||||
builder.setTitle(context.getString(R.string.LedColor));
|
||||
builder.setView(linearLayout);
|
||||
builder.setPositiveButton(LocaleController.getString("Set", R.string.Set), new DialogInterface.OnClickListener() {
|
||||
builder.setPositiveButton(context.getString(R.string.Set), new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int which) {
|
||||
final SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE);
|
||||
SharedPreferences.Editor editor = preferences.edit();
|
||||
editor.putInt("color_" + dialog_id, colorPickerView.getColor());
|
||||
editor.putInt("color_" + dialog_id, colorPickerView.getColor()); // use selected color
|
||||
editor.apply();
|
||||
listView.invalidateViews();
|
||||
}
|
||||
});
|
||||
builder.setNeutralButton(LocaleController.getString("Disabled", R.string.Disabled), new DialogInterface.OnClickListener() {
|
||||
builder.setNeutralButton(context.getString(R.string.Disabled), new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
final SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE);
|
||||
SharedPreferences.Editor editor = preferences.edit();
|
||||
editor.putInt("color_" + dialog_id, 0);
|
||||
editor.putInt("color_" + dialog_id, 0/*0=off*/);
|
||||
editor.apply();
|
||||
listView.invalidateViews();
|
||||
}
|
||||
});
|
||||
builder.setNegativeButton(LocaleController.getString("Default", R.string.Default), new DialogInterface.OnClickListener() {
|
||||
builder.setNegativeButton(context.getString(R.string.Default), new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
final SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE);
|
||||
SharedPreferences.Editor editor = preferences.edit();
|
||||
editor.remove("color_" + dialog_id);
|
||||
editor.remove("color_" + dialog_id); // use delta-chat-default
|
||||
editor.apply();
|
||||
listView.invalidateViews();
|
||||
}
|
||||
@@ -304,12 +296,12 @@ public class ProfileNotificationsActivity extends BaseFragment implements Notifi
|
||||
showDialog(builder.create());
|
||||
} else if (i == settingsPriorityRow) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
|
||||
builder.setTitle(LocaleController.getString("NotificationsPriority", R.string.NotificationsPriority));
|
||||
builder.setTitle(context.getString(R.string.NotificationsPriority));
|
||||
builder.setItems(new CharSequence[]{
|
||||
LocaleController.getString("Default", R.string.Default),
|
||||
LocaleController.getString("NotificationsPriorityDefault", R.string.NotificationsPriorityDefault),
|
||||
LocaleController.getString("NotificationsPriorityHigh", R.string.NotificationsPriorityHigh),
|
||||
LocaleController.getString("NotificationsPriorityMax", R.string.NotificationsPriorityMax)
|
||||
context.getString(R.string.Default),
|
||||
context.getString(R.string.NotificationsPriorityDefault),
|
||||
context.getString(R.string.NotificationsPriorityHigh),
|
||||
context.getString(R.string.NotificationsPriorityMax)
|
||||
}, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
@@ -325,7 +317,7 @@ public class ProfileNotificationsActivity extends BaseFragment implements Notifi
|
||||
}
|
||||
}
|
||||
});
|
||||
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
|
||||
builder.setNegativeButton(context.getString(R.string.Cancel), null);
|
||||
showDialog(builder.create());
|
||||
} else if (i == smartRow) {
|
||||
if (getParentActivity() == null) {
|
||||
@@ -351,7 +343,7 @@ public class ProfileNotificationsActivity extends BaseFragment implements Notifi
|
||||
linearLayout2.setLayoutParams(layoutParams1);
|
||||
|
||||
TextView textView = new TextView(getParentActivity());
|
||||
textView.setText(LocaleController.getString("SmartNotificationsSoundAtMost", R.string.SmartNotificationsSoundAtMost));
|
||||
textView.setText(context.getString(R.string.SmartNotificationsSoundAtMost));
|
||||
textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18);
|
||||
linearLayout2.addView(textView);
|
||||
layoutParams1 = (LinearLayout.LayoutParams) textView.getLayoutParams();
|
||||
@@ -371,7 +363,7 @@ public class ProfileNotificationsActivity extends BaseFragment implements Notifi
|
||||
numberPickerTimes.setLayoutParams(layoutParams1);
|
||||
|
||||
textView = new TextView(getParentActivity());
|
||||
textView.setText(LocaleController.getString("SmartNotificationsTimes", R.string.SmartNotificationsTimes));
|
||||
textView.setText(context.getString(R.string.SmartNotificationsTimes));
|
||||
textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18);
|
||||
linearLayout2.addView(textView);
|
||||
layoutParams1 = (LinearLayout.LayoutParams) textView.getLayoutParams();
|
||||
@@ -390,7 +382,7 @@ public class ProfileNotificationsActivity extends BaseFragment implements Notifi
|
||||
linearLayout2.setLayoutParams(layoutParams1);
|
||||
|
||||
textView = new TextView(getParentActivity());
|
||||
textView.setText(LocaleController.getString("SmartNotificationsWithin", R.string.SmartNotificationsWithin));
|
||||
textView.setText(context.getString(R.string.SmartNotificationsWithin));
|
||||
textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18);
|
||||
linearLayout2.addView(textView);
|
||||
layoutParams1 = (LinearLayout.LayoutParams) textView.getLayoutParams();
|
||||
@@ -410,7 +402,7 @@ public class ProfileNotificationsActivity extends BaseFragment implements Notifi
|
||||
numberPickerMinutes.setLayoutParams(layoutParams1);
|
||||
|
||||
textView = new TextView(getParentActivity());
|
||||
textView.setText(LocaleController.getString("SmartNotificationsMinutes", R.string.SmartNotificationsMinutes));
|
||||
textView.setText(context.getString(R.string.SmartNotificationsMinutes));
|
||||
textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18);
|
||||
linearLayout2.addView(textView);
|
||||
layoutParams1 = (LinearLayout.LayoutParams) textView.getLayoutParams();
|
||||
@@ -420,9 +412,9 @@ public class ProfileNotificationsActivity extends BaseFragment implements Notifi
|
||||
textView.setLayoutParams(layoutParams1);
|
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
|
||||
builder.setTitle(LocaleController.getString("SmartNotifications", R.string.SmartNotifications));
|
||||
builder.setTitle(context.getString(R.string.SmartNotifications));
|
||||
builder.setView(linearLayout);
|
||||
builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), new DialogInterface.OnClickListener() {
|
||||
builder.setPositiveButton(context.getString(R.string.OK), new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE);
|
||||
@@ -433,7 +425,7 @@ public class ProfileNotificationsActivity extends BaseFragment implements Notifi
|
||||
}
|
||||
}
|
||||
});
|
||||
builder.setNegativeButton(LocaleController.getString("Disabled", R.string.Disabled), new DialogInterface.OnClickListener() {
|
||||
builder.setNegativeButton(context.getString(R.string.Disabled), new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE);
|
||||
@@ -463,7 +455,7 @@ public class ProfileNotificationsActivity extends BaseFragment implements Notifi
|
||||
Ringtone rng = RingtoneManager.getRingtone(ApplicationLoader.applicationContext, ringtone);
|
||||
if (rng != null) {
|
||||
if(ringtone.equals(Settings.System.DEFAULT_NOTIFICATION_URI)) {
|
||||
name = LocaleController.getString("SoundDefault", R.string.SoundDefault);
|
||||
name = "use-delta-chat-default";
|
||||
} else {
|
||||
name = rng.getTitle(getParentActivity());
|
||||
}
|
||||
@@ -475,13 +467,18 @@ public class ProfileNotificationsActivity extends BaseFragment implements Notifi
|
||||
SharedPreferences.Editor editor = preferences.edit();
|
||||
|
||||
if (requestCode == RC12_PROFILE_RINGTONE_PICKER) {
|
||||
if (name != null) {
|
||||
editor.putString("sound_" + dialog_id, name);
|
||||
editor.putString("sound_path_" + dialog_id, ringtone.toString());
|
||||
} else {
|
||||
if( name==null ) {
|
||||
editor.putString("sound_" + dialog_id, "NoSound");
|
||||
editor.putString("sound_path_" + dialog_id, "NoSound");
|
||||
}
|
||||
else if( name.equals("use-delta-chat-default") ) {
|
||||
editor.remove("sound_" + dialog_id); // use the Delta Chat standard sound, not the system standard sound!
|
||||
editor.remove("sound_path_" + dialog_id);
|
||||
}
|
||||
else {
|
||||
editor.putString("sound_" + dialog_id, name);
|
||||
editor.putString("sound_path_" + dialog_id, ringtone.toString());
|
||||
}
|
||||
}
|
||||
editor.apply();
|
||||
listView.invalidateViews();
|
||||
@@ -495,6 +492,19 @@ public class ProfileNotificationsActivity extends BaseFragment implements Notifi
|
||||
}
|
||||
}
|
||||
|
||||
static String muteForString(int seconds)
|
||||
{
|
||||
String val;
|
||||
if (seconds < 60 * 60) {
|
||||
val = ApplicationLoader.applicationContext.getResources().getQuantityString(R.plurals.Minutes, seconds / 60, seconds / 60);
|
||||
} else if (seconds < 24 * 60 * 60) {
|
||||
val = ApplicationLoader.applicationContext.getResources().getQuantityString(R.plurals.Hours, (int) Math.ceil(seconds / 60.0f / 60), (int) Math.ceil(seconds / 60.0f / 60));
|
||||
} else {
|
||||
val = ApplicationLoader.applicationContext.getResources().getQuantityString(R.plurals.Days, (int) Math.ceil(seconds / 60.0f / 60 / 24), (int) Math.ceil(seconds / 60.0f / 60 / 24));
|
||||
}
|
||||
return String.format(ApplicationLoader.applicationContext.getString(R.string.MuteFor), val);
|
||||
}
|
||||
|
||||
private class ListAdapter extends BaseFragmentAdapter {
|
||||
private Context mContext;
|
||||
|
||||
@@ -539,7 +549,7 @@ public class ProfileNotificationsActivity extends BaseFragment implements Notifi
|
||||
if (view == null) {
|
||||
view = new HeaderCell(mContext);
|
||||
}
|
||||
((HeaderCell) view).setText(LocaleController.getString("NotificationsAndSounds", R.string.NotificationsAndSounds));
|
||||
((HeaderCell) view).setText(mContext.getString(R.string.NotificationsAndSounds));
|
||||
}
|
||||
else if (type == TYPE_TEXTSETTINGS) {
|
||||
if (view == null) {
|
||||
@@ -547,67 +557,67 @@ public class ProfileNotificationsActivity extends BaseFragment implements Notifi
|
||||
}
|
||||
TextSettingsCell textCell = (TextSettingsCell) view;
|
||||
SharedPreferences preferences = mContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE);
|
||||
|
||||
if (i == settingsVibrateRow) {
|
||||
int value = preferences.getInt("vibrate_" + dialog_id, 0);
|
||||
if (value == 0) {
|
||||
textCell.setTextAndValue(LocaleController.getString("Vibrate", R.string.Vibrate), LocaleController.getString("Default", R.string.Default), true);
|
||||
} else if (value == 1) {
|
||||
textCell.setTextAndValue(LocaleController.getString("Vibrate", R.string.Vibrate), LocaleController.getString("Short", R.string.Short), true);
|
||||
if (value == 1) {
|
||||
textCell.setTextAndValue(mContext.getString(R.string.Vibrate), mContext.getString(R.string.Short), true);
|
||||
} else if (value == 2) {
|
||||
textCell.setTextAndValue(LocaleController.getString("Vibrate", R.string.Vibrate), LocaleController.getString("Disabled", R.string.Disabled), true);
|
||||
textCell.setTextAndValue(mContext.getString(R.string.Vibrate), mContext.getString(R.string.Disabled), true);
|
||||
} else if (value == 3) {
|
||||
textCell.setTextAndValue(LocaleController.getString("Vibrate", R.string.Vibrate), LocaleController.getString("Long", R.string.Long), true);
|
||||
} else if (value == 4) {
|
||||
textCell.setTextAndValue(LocaleController.getString("Vibrate", R.string.Vibrate), LocaleController.getString("SystemDefault", R.string.SystemDefault), true);
|
||||
textCell.setTextAndValue(mContext.getString(R.string.Vibrate), mContext.getString(R.string.Long), true);
|
||||
} else {
|
||||
textCell.setTextAndValue(mContext.getString(R.string.Vibrate), mContext.getString(R.string.Default), true);
|
||||
}
|
||||
} else if (i == settingsNotificationsRow) {
|
||||
int value = preferences.getInt("notify2_" + dialog_id, 0);
|
||||
if (value == 0) {
|
||||
textCell.setTextAndValue(LocaleController.getString("Notifications", R.string.Notifications), LocaleController.getString("Default", R.string.Default), true);
|
||||
textCell.setTextAndValue(mContext.getString(R.string.Notifications), mContext.getString(R.string.Default), true);
|
||||
} else if (value == 1) {
|
||||
textCell.setTextAndValue(LocaleController.getString("Notifications", R.string.Notifications), LocaleController.getString("Enabled", R.string.Enabled), true);
|
||||
textCell.setTextAndValue(mContext.getString(R.string.Notifications), mContext.getString(R.string.Enabled), true);
|
||||
} else if (value == 2) {
|
||||
textCell.setTextAndValue(LocaleController.getString("Notifications", R.string.Notifications), LocaleController.getString("Disabled", R.string.Disabled), true);
|
||||
textCell.setTextAndValue(mContext.getString(R.string.Notifications), mContext.getString(R.string.Disabled), true);
|
||||
} else if (value == 3) {
|
||||
int delta = preferences.getInt("notifyuntil_" + dialog_id, 0) - MrMailbox.getCurrentTime();
|
||||
String val;
|
||||
if (delta <= 0) {
|
||||
val = LocaleController.getString("Enabled", R.string.Enabled);
|
||||
} else if (delta < 60 * 60) {
|
||||
// @TODO: Maybe this should be reworded a bit.
|
||||
val = mContext.getResources().getQuantityString(R.plurals.Minutes, delta / 60, delta / 60);
|
||||
} else if (delta < 60 * 60 * 24) {
|
||||
// @TODO: Maybe this should be reworded a bit.
|
||||
val = mContext.getResources().getQuantityString(R.plurals.Hours, (int) Math.ceil(delta / 60.0f / 60), (int) Math.ceil(delta / 60.0f / 60));
|
||||
val = mContext.getString(R.string.Enabled);
|
||||
} else if (delta < 60 * 60 * 24 * 365) {
|
||||
// @TODO: Maybe this should be reworded a bit.
|
||||
val = mContext.getResources().getQuantityString(R.plurals.Days, (int) Math.ceil(delta / 60.0f / 60 / 24), (int) Math.ceil(delta / 60.0f / 60 / 24));
|
||||
val = muteForString(delta);
|
||||
} else {
|
||||
val = null;
|
||||
}
|
||||
if (val != null) {
|
||||
textCell.setTextAndValue(LocaleController.getString("Notifications", R.string.Notifications), val, true);
|
||||
} else {
|
||||
textCell.setTextAndValue(LocaleController.getString("Notifications", R.string.Notifications), LocaleController.getString("Disabled", R.string.Disabled), true);
|
||||
val = mContext.getString(R.string.Disabled);
|
||||
}
|
||||
textCell.setTextAndValue(mContext.getString(R.string.Notifications), val, true);
|
||||
}
|
||||
} else if (i == settingsSoundRow) {
|
||||
String value = preferences.getString("sound_" + dialog_id, LocaleController.getString("SoundDefault", R.string.SoundDefault));
|
||||
String value = preferences.getString("sound_" + dialog_id, mContext.getString(R.string.Default));
|
||||
if (value.equals("NoSound")) {
|
||||
value = LocaleController.getString("Disabled", R.string.Disabled);
|
||||
value = mContext.getString(R.string.Disabled);
|
||||
}
|
||||
textCell.setTextAndValue(LocaleController.getString("Sound", R.string.Sound), value, true);
|
||||
textCell.setTextAndValue(mContext.getString(R.string.Sound), value, true);
|
||||
} else if (i == settingsPriorityRow) {
|
||||
int value = preferences.getInt("priority_" + dialog_id, 3);
|
||||
if (value == 0) {
|
||||
textCell.setTextAndValue(LocaleController.getString("NotificationsPriority", R.string.NotificationsPriority), LocaleController.getString("NotificationsPriorityDefault", R.string.NotificationsPriorityDefault), true);
|
||||
textCell.setTextAndValue(mContext.getString(R.string.NotificationsPriority), mContext.getString(R.string.NotificationsPriorityDefault), true);
|
||||
} else if (value == 1) {
|
||||
textCell.setTextAndValue(LocaleController.getString("NotificationsPriority", R.string.NotificationsPriority), LocaleController.getString("NotificationsPriorityHigh", R.string.NotificationsPriorityHigh), true);
|
||||
textCell.setTextAndValue(mContext.getString(R.string.NotificationsPriority), mContext.getString(R.string.NotificationsPriorityHigh), true);
|
||||
} else if (value == 2) {
|
||||
textCell.setTextAndValue(LocaleController.getString("NotificationsPriority", R.string.NotificationsPriority), LocaleController.getString("NotificationsPriorityMax", R.string.NotificationsPriorityMax), true);
|
||||
textCell.setTextAndValue(mContext.getString(R.string.NotificationsPriority), mContext.getString(R.string.NotificationsPriorityMax), true);
|
||||
} else if (value == 3) {
|
||||
textCell.setTextAndValue(LocaleController.getString("NotificationsPriority", R.string.NotificationsPriority), LocaleController.getString("Default", R.string.Default), true);
|
||||
textCell.setTextAndValue(mContext.getString(R.string.NotificationsPriority), mContext.getString(R.string.Default), true);
|
||||
}
|
||||
}
|
||||
else if( i== settingsLedRow )
|
||||
{
|
||||
if (preferences.contains("color_" + dialog_id)) {
|
||||
int color = preferences.getInt("color_" + dialog_id, NotificationsController.DEF_LED_COLOR);
|
||||
if( color == 0 ) {
|
||||
textCell.setTextAndValue(mContext.getString(R.string.LedColor), mContext.getString(R.string.Disabled), true);
|
||||
}
|
||||
else {
|
||||
textCell.setTextAndColor(mContext.getString(R.string.LedColor), color, true);
|
||||
}
|
||||
} else {
|
||||
textCell.setTextAndValue(mContext.getString(R.string.LedColor), mContext.getString(R.string.Default), true);
|
||||
}
|
||||
}
|
||||
} else if (type == TYPE_TEXTDETAILS) {
|
||||
@@ -621,29 +631,11 @@ public class ProfileNotificationsActivity extends BaseFragment implements Notifi
|
||||
int notifyMaxCount = preferences.getInt("smart_max_count_" + dialog_id, 0);
|
||||
int notifyDelay = preferences.getInt("smart_delay_" + dialog_id, 3 * 60);
|
||||
if (notifyMaxCount == 0) {
|
||||
textCell.setTextAndValue(LocaleController.getString("SmartNotifications", R.string.SmartNotifications), LocaleController.getString("Disabled", R.string.Disabled), true);
|
||||
textCell.setTextAndValue(mContext.getString(R.string.SmartNotifications), mContext.getString(R.string.Disabled), true);
|
||||
} else {
|
||||
String minutes = ApplicationLoader.applicationContext.getResources().getQuantityString(R.plurals.Minutes, notifyDelay / 60, notifyDelay / 60);
|
||||
String value = ApplicationLoader.applicationContext.getResources().getQuantityString(R.plurals.MaxNotifications, notifyMaxCount, notifyMaxCount, minutes);
|
||||
textCell.setTextAndValue(LocaleController.getString("SmartNotifications", R.string.SmartNotifications), value, true);
|
||||
}
|
||||
}
|
||||
} else if (type == TYPE_COLOR_CELL) {
|
||||
if (view == null) {
|
||||
view = new TextColorCell(mContext);
|
||||
}
|
||||
|
||||
TextColorCell textCell = (TextColorCell) view;
|
||||
|
||||
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE);
|
||||
|
||||
if (preferences.contains("color_" + dialog_id)) {
|
||||
textCell.setTextAndColor(LocaleController.getString("LedColor", R.string.LedColor), preferences.getInt("color_" + dialog_id, 0xff00ff00), true);
|
||||
} else {
|
||||
if ((int)dialog_id < 0) {
|
||||
textCell.setTextAndColor(LocaleController.getString("LedColor", R.string.LedColor), preferences.getInt("GroupLed", 0xff00ff00), true);
|
||||
} else {
|
||||
textCell.setTextAndColor(LocaleController.getString("LedColor", R.string.LedColor), preferences.getInt("MessagesLed", 0xff00ff00), true);
|
||||
String minutes = mContext.getResources().getQuantityString(R.plurals.Minutes, notifyDelay / 60, notifyDelay / 60);
|
||||
String value = mContext.getResources().getQuantityString(R.plurals.MaxNotifications, notifyMaxCount, notifyMaxCount, minutes);
|
||||
textCell.setTextAndValue(mContext.getString(R.string.SmartNotifications), value, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -655,9 +647,6 @@ public class ProfileNotificationsActivity extends BaseFragment implements Notifi
|
||||
if( i==headerRow ) {
|
||||
return TYPE_HEADER;
|
||||
}
|
||||
else if (i == settingsLedRow) {
|
||||
return TYPE_COLOR_CELL;
|
||||
}
|
||||
else if( i==smartRow ) {
|
||||
return TYPE_TEXTDETAILS;
|
||||
}
|
||||
|
||||
@@ -40,7 +40,6 @@ import android.widget.ListView;
|
||||
|
||||
import com.b44t.messenger.AndroidUtilities;
|
||||
import com.b44t.messenger.ApplicationLoader;
|
||||
import com.b44t.messenger.LocaleController;
|
||||
import com.b44t.messenger.MrMailbox;
|
||||
import com.b44t.messenger.NotificationCenter;
|
||||
import com.b44t.messenger.R;
|
||||
@@ -202,7 +201,7 @@ public class SettingsAccountActivity extends BaseFragment implements Notificatio
|
||||
}
|
||||
|
||||
@Override
|
||||
public View createView(Context context) {
|
||||
public View createView(final Context context) {
|
||||
|
||||
// create action bar
|
||||
if( !fromIntro ) {
|
||||
@@ -210,7 +209,7 @@ public class SettingsAccountActivity extends BaseFragment implements Notificatio
|
||||
}
|
||||
|
||||
actionBar.setAllowOverlayTitle(true);
|
||||
actionBar.setTitle(LocaleController.getString("AccountSettings", R.string.AccountSettings));
|
||||
actionBar.setTitle(context.getString(R.string.AccountSettings));
|
||||
actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {
|
||||
@Override
|
||||
public void onItemClick(int id) {
|
||||
@@ -279,7 +278,7 @@ public class SettingsAccountActivity extends BaseFragment implements Notificatio
|
||||
listView.invalidateViews();
|
||||
}
|
||||
});
|
||||
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
|
||||
builder.setNegativeButton(context.getString(R.string.Cancel), null);
|
||||
showDialog(builder.create());
|
||||
|
||||
}
|
||||
@@ -350,7 +349,7 @@ public class SettingsAccountActivity extends BaseFragment implements Notificatio
|
||||
progressDialog.setMessage(ApplicationLoader.applicationContext.getString(R.string.OneMoment));
|
||||
progressDialog.setCanceledOnTouchOutside(false);
|
||||
progressDialog.setCancelable(false);
|
||||
progressDialog.setButton(DialogInterface.BUTTON_NEGATIVE, LocaleController.getString("Cancel", R.string.Cancel), new DialogInterface.OnClickListener() {
|
||||
progressDialog.setButton(DialogInterface.BUTTON_NEGATIVE, ApplicationLoader.applicationContext.getString(R.string.Cancel), new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
MrMailbox.configureCancel();
|
||||
@@ -407,7 +406,7 @@ public class SettingsAccountActivity extends BaseFragment implements Notificatio
|
||||
else if( ! MrMailbox.m_lastErrorString.isEmpty() ){
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
|
||||
builder.setMessage(errorString);
|
||||
builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), new DialogInterface.OnClickListener() {
|
||||
builder.setPositiveButton(ApplicationLoader.applicationContext.getString(R.string.OK), new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
;
|
||||
@@ -491,7 +490,7 @@ public class SettingsAccountActivity extends BaseFragment implements Notificatio
|
||||
if( mailServerCell==null) {
|
||||
mailServerCell = new EditTextCell(mContext);
|
||||
mailServerCell.setValueHintAndLabel(MrMailbox.getConfig("mail_server", ""),
|
||||
ApplicationLoader.applicationContext.getString(R.string.Automatic), LocaleController.getString("ImapServer", R.string.ImapServer), false);
|
||||
ApplicationLoader.applicationContext.getString(R.string.Automatic), ApplicationLoader.applicationContext.getString(R.string.ImapServer), false);
|
||||
mailServerCell.getEditTextView().setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_URI);
|
||||
}
|
||||
view = mailServerCell;
|
||||
@@ -500,7 +499,7 @@ public class SettingsAccountActivity extends BaseFragment implements Notificatio
|
||||
if( mailPortCell==null) {
|
||||
mailPortCell = new EditTextCell(mContext);
|
||||
mailPortCell.setValueHintAndLabel(MrMailbox.getConfig("mail_port", ""),
|
||||
ApplicationLoader.applicationContext.getString(R.string.Automatic), LocaleController.getString("ImapPort", R.string.ImapPort), false);
|
||||
ApplicationLoader.applicationContext.getString(R.string.Automatic), ApplicationLoader.applicationContext.getString(R.string.ImapPort), false);
|
||||
mailPortCell.getEditTextView().setInputType(InputType.TYPE_CLASS_NUMBER);
|
||||
}
|
||||
view = mailPortCell;
|
||||
@@ -509,7 +508,7 @@ public class SettingsAccountActivity extends BaseFragment implements Notificatio
|
||||
if( mailUserCell==null) {
|
||||
mailUserCell = new EditTextCell(mContext);
|
||||
mailUserCell.setValueHintAndLabel(MrMailbox.getConfig("mail_user", ""),
|
||||
ApplicationLoader.applicationContext.getString(R.string.Automatic), LocaleController.getString("ImapLoginname", R.string.ImapLoginname), false);
|
||||
ApplicationLoader.applicationContext.getString(R.string.Automatic), ApplicationLoader.applicationContext.getString(R.string.ImapLoginname), false);
|
||||
}
|
||||
view = mailUserCell;
|
||||
}
|
||||
@@ -517,7 +516,7 @@ public class SettingsAccountActivity extends BaseFragment implements Notificatio
|
||||
if( sendServerCell==null) {
|
||||
sendServerCell = new EditTextCell(mContext);
|
||||
sendServerCell.setValueHintAndLabel(MrMailbox.getConfig("send_server", ""),
|
||||
ApplicationLoader.applicationContext.getString(R.string.Automatic), LocaleController.getString("SmtpServer", R.string.SmtpServer), false);
|
||||
ApplicationLoader.applicationContext.getString(R.string.Automatic), ApplicationLoader.applicationContext.getString(R.string.SmtpServer), false);
|
||||
sendServerCell.getEditTextView().setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_URI);
|
||||
}
|
||||
view = sendServerCell;
|
||||
@@ -526,7 +525,7 @@ public class SettingsAccountActivity extends BaseFragment implements Notificatio
|
||||
if( sendPortCell==null) {
|
||||
sendPortCell = new EditTextCell(mContext);
|
||||
sendPortCell.setValueHintAndLabel(MrMailbox.getConfig("send_port", ""),
|
||||
ApplicationLoader.applicationContext.getString(R.string.Automatic), LocaleController.getString("SmtpPort", R.string.SmtpPort), false);
|
||||
ApplicationLoader.applicationContext.getString(R.string.Automatic), ApplicationLoader.applicationContext.getString(R.string.SmtpPort), false);
|
||||
sendPortCell.getEditTextView().setInputType(InputType.TYPE_CLASS_NUMBER);
|
||||
}
|
||||
view = sendPortCell;
|
||||
@@ -535,7 +534,7 @@ public class SettingsAccountActivity extends BaseFragment implements Notificatio
|
||||
if( sendUserCell==null) {
|
||||
sendUserCell = new EditTextCell(mContext);
|
||||
sendUserCell.setValueHintAndLabel(MrMailbox.getConfig("send_user", ""),
|
||||
ApplicationLoader.applicationContext.getString(R.string.Automatic), LocaleController.getString("SmtpLoginname", R.string.SmtpLoginname), false);
|
||||
ApplicationLoader.applicationContext.getString(R.string.Automatic), ApplicationLoader.applicationContext.getString(R.string.SmtpLoginname), false);
|
||||
}
|
||||
view = sendUserCell;
|
||||
}
|
||||
@@ -543,7 +542,7 @@ public class SettingsAccountActivity extends BaseFragment implements Notificatio
|
||||
if( sendPwCell==null) {
|
||||
sendPwCell = new EditTextCell(mContext);
|
||||
sendPwCell.setValueHintAndLabel(MrMailbox.getConfig("send_pw", ""),
|
||||
LocaleController.getString("FromAbove", R.string.FromAbove), LocaleController.getString("SmtpPassword", R.string.SmtpPassword), false);
|
||||
ApplicationLoader.applicationContext.getString(R.string.FromAbove), ApplicationLoader.applicationContext.getString(R.string.SmtpPassword), false);
|
||||
sendPwCell.getEditTextView().setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS | InputType.TYPE_TEXT_VARIATION_PASSWORD);
|
||||
}
|
||||
view = sendPwCell;
|
||||
@@ -578,9 +577,9 @@ public class SettingsAccountActivity extends BaseFragment implements Notificatio
|
||||
} else if (i == rowMailPwHeadline) {
|
||||
((HeaderCell) view).setText(ApplicationLoader.applicationContext.getString(R.string.Password));
|
||||
} else if (i == rowMailHeadline) {
|
||||
((HeaderCell) view).setText(LocaleController.getString("InboxHeadline", R.string.InboxHeadline));
|
||||
((HeaderCell) view).setText(ApplicationLoader.applicationContext.getString(R.string.InboxHeadline));
|
||||
} else if (i == rowSendHeadline) {
|
||||
((HeaderCell) view).setText(LocaleController.getString("OutboxHeadline", R.string.OutboxHeadline));
|
||||
((HeaderCell) view).setText(ApplicationLoader.applicationContext.getString(R.string.OutboxHeadline));
|
||||
}
|
||||
}
|
||||
else if (type == ROWTYPE_SHADOW_BREAK) {
|
||||
@@ -593,12 +592,12 @@ public class SettingsAccountActivity extends BaseFragment implements Notificatio
|
||||
view = new TextInfoCell(mContext);
|
||||
}
|
||||
if( i== rowOpenAdvOpions) {
|
||||
((TextInfoCell) view).setText(LocaleController.getString("MyAccoutExplain", R.string.MyAccountExplain),
|
||||
((TextInfoCell) view).setText(ApplicationLoader.applicationContext.getString(R.string.MyAccountExplain),
|
||||
m_expanded? " \u2212" /*minus-sign*/ : "+", m_expanded /*draw bottom border?*/);
|
||||
view.setBackgroundResource(m_expanded? R.drawable.greydivider : R.drawable.greydivider_bottom); // has shadow top+bottom
|
||||
}
|
||||
else if( i==rowInfoBelowSendPw) {
|
||||
((TextInfoCell) view).setText(AndroidUtilities.replaceTags(LocaleController.getString("MyAccountExplain2", R.string.MyAccountExplain2)));
|
||||
((TextInfoCell) view).setText(AndroidUtilities.replaceTags(ApplicationLoader.applicationContext.getString(R.string.MyAccountExplain2)));
|
||||
if( m_expanded ) {
|
||||
view.setBackgroundResource(R.drawable.greydivider_bottom);
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ package com.b44t.ui;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.os.Build;
|
||||
import android.os.PowerManager;
|
||||
@@ -38,9 +39,6 @@ import android.widget.AdapterView;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ListView;
|
||||
|
||||
import com.b44t.messenger.ApplicationLoader;
|
||||
import com.b44t.messenger.BuildConfig;
|
||||
import com.b44t.messenger.LocaleController;
|
||||
import com.b44t.messenger.MrMailbox;
|
||||
import com.b44t.messenger.R;
|
||||
import com.b44t.ui.ActionBar.ActionBar;
|
||||
@@ -99,7 +97,7 @@ public class SettingsActivity extends BaseFragment {
|
||||
// create action bar
|
||||
actionBar.setBackButtonImage(R.drawable.ic_ab_back);
|
||||
actionBar.setAllowOverlayTitle(true);
|
||||
actionBar.setTitle(LocaleController.getString("Settings", R.string.Settings));
|
||||
actionBar.setTitle(context.getString(R.string.Settings));
|
||||
actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {
|
||||
@Override
|
||||
public void onItemClick(int id) {
|
||||
@@ -144,17 +142,10 @@ public class SettingsActivity extends BaseFragment {
|
||||
else if (i == advRow) {
|
||||
presentFragment(new SettingsAdvActivity());
|
||||
}
|
||||
else if (i == aboutRow) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
|
||||
builder.setTitle(ApplicationLoader.applicationContext.getString(R.string.AppName) + " v" + getVersion());
|
||||
builder.setMessage(MrMailbox.getInfo() + "\n\n" + getAndroidInfo());
|
||||
builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
;
|
||||
}
|
||||
});
|
||||
showDialog(builder.create());
|
||||
else if (i == aboutRow ) {
|
||||
Intent intent2 = new Intent(getParentActivity(), IntroActivity.class);
|
||||
intent2.putExtra("com.b44t.ui.IntroActivity.isAbout", true);
|
||||
getParentActivity().startActivity(intent2);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -162,54 +153,6 @@ public class SettingsActivity extends BaseFragment {
|
||||
return fragmentView;
|
||||
}
|
||||
|
||||
private String getVersion()
|
||||
{
|
||||
try {
|
||||
PackageInfo pInfo = ApplicationLoader.applicationContext.getPackageManager().getPackageInfo(ApplicationLoader.applicationContext.getPackageName(), 0);
|
||||
return pInfo.versionName;
|
||||
}
|
||||
catch(Exception e) {
|
||||
return "ErrVersion";
|
||||
}
|
||||
}
|
||||
|
||||
private String getAndroidInfo()
|
||||
{
|
||||
String abi = "ErrAbi";
|
||||
int versionCode = 0, ignoreBatteryOptimizations = -1;
|
||||
try {
|
||||
PackageInfo pInfo = ApplicationLoader.applicationContext.getPackageManager().getPackageInfo(ApplicationLoader.applicationContext.getPackageName(), 0);
|
||||
versionCode = pInfo.versionCode;
|
||||
switch (versionCode % 10) {
|
||||
case 0:
|
||||
abi = "arm";
|
||||
break;
|
||||
case 1:
|
||||
abi = "arm-v7a";
|
||||
break;
|
||||
case 2:
|
||||
abi = "x86";
|
||||
break;
|
||||
case 3:
|
||||
abi = "universal";
|
||||
break;
|
||||
}
|
||||
if( Build.VERSION.SDK_INT >= 23 ) {
|
||||
PowerManager pm = (PowerManager) ApplicationLoader.applicationContext.getSystemService(Context.POWER_SERVICE);
|
||||
ignoreBatteryOptimizations = pm.isIgnoringBatteryOptimizations(ApplicationLoader.applicationContext.getPackageName())? 1 : 0;
|
||||
}
|
||||
} catch (Exception e) {}
|
||||
|
||||
return "SDK_INT=" + Build.VERSION.SDK_INT
|
||||
+ "\nMANUFACTURER=" + Build.MANUFACTURER
|
||||
+ "\nMODEL=" + Build.MODEL
|
||||
+ "\nAPPLICATION_ID=" + BuildConfig.APPLICATION_ID
|
||||
+ "\nBUILD_TYPE=" + BuildConfig.BUILD_TYPE
|
||||
+ "\nABI=" + abi // ABI = Application Binary Interface
|
||||
+ "\nignoreBatteryOptimizations=" + ignoreBatteryOptimizations
|
||||
+ "\nversionCode=" + versionCode;
|
||||
}
|
||||
|
||||
private class ListAdapter extends BaseFragmentAdapter {
|
||||
private Context mContext;
|
||||
|
||||
@@ -265,16 +208,16 @@ public class SettingsActivity extends BaseFragment {
|
||||
}
|
||||
TextSettingsCell textCell = (TextSettingsCell) view;
|
||||
if (i == privacyRow) {
|
||||
textCell.setText(LocaleController.getString("PrivacySettings", R.string.PrivacySettings), true);
|
||||
textCell.setText(mContext.getString(R.string.PrivacySettings), true);
|
||||
}
|
||||
else if (i == notificationRow) {
|
||||
textCell.setText(LocaleController.getString("NotificationsAndSounds", R.string.NotificationsAndSounds), true);
|
||||
textCell.setText(mContext.getString(R.string.NotificationsAndSounds), true);
|
||||
}
|
||||
else if (i == backgroundRow) {
|
||||
textCell.setText(LocaleController.getString("ChatBackground", R.string.ChatBackground), true);
|
||||
textCell.setText(mContext.getString(R.string.ChatBackground), true);
|
||||
}
|
||||
else if (i == advRow) {
|
||||
textCell.setText(ApplicationLoader.applicationContext.getString(R.string.AdvancedSettings), false);
|
||||
textCell.setText(mContext.getString(R.string.AdvancedSettings), false);
|
||||
}
|
||||
}
|
||||
else if (type == ROWTYPE_HEADER) {
|
||||
@@ -283,13 +226,13 @@ public class SettingsActivity extends BaseFragment {
|
||||
view.setBackgroundColor(0xffffffff);
|
||||
}
|
||||
if (i == settingsHeaderRow) {
|
||||
((HeaderCell) view).setText(ApplicationLoader.applicationContext.getString(R.string.Settings));
|
||||
((HeaderCell) view).setText(mContext.getString(R.string.Settings));
|
||||
}
|
||||
else if (i == aboutHeaderRow) {
|
||||
((HeaderCell) view).setText(LocaleController.getString("Info", R.string.Info));
|
||||
((HeaderCell) view).setText(mContext.getString(R.string.Info));
|
||||
}
|
||||
else if (i == accountHeaderRow) {
|
||||
((HeaderCell) view).setText(LocaleController.getString("MyAccount", R.string.MyAccount));
|
||||
((HeaderCell) view).setText(mContext.getString(R.string.MyAccount));
|
||||
}
|
||||
}
|
||||
else if (type == ROWTYPE_DETAIL_SETTINGS) {
|
||||
@@ -304,20 +247,20 @@ public class SettingsActivity extends BaseFragment {
|
||||
subtitle = MrMailbox.getConfig("addr", "");
|
||||
}
|
||||
else {
|
||||
subtitle = LocaleController.getString("AccountNotConfigured", R.string.AccountNotConfigured);
|
||||
subtitle = mContext.getString(R.string.AccountNotConfigured);
|
||||
}
|
||||
|
||||
textCell.setTextAndValue(LocaleController.getString("AccountSettings", R.string.AccountSettings), subtitle, false);
|
||||
textCell.setTextAndValue(mContext.getString(R.string.AccountSettings), subtitle, false);
|
||||
}
|
||||
else if (i == usernameRow) {
|
||||
String subtitle = MrMailbox.getConfig("displayname", "");
|
||||
if( subtitle.isEmpty()) {
|
||||
subtitle = LocaleController.getString("NotSet", R.string.NotSet);
|
||||
subtitle = mContext.getString(R.string.NotSet);
|
||||
}
|
||||
textCell.setTextAndValue(LocaleController.getString("MyName", R.string.MyName), subtitle, true);
|
||||
textCell.setTextAndValue(mContext.getString(R.string.MyName), subtitle, true);
|
||||
}
|
||||
else if (i == aboutRow) {
|
||||
textCell.setTextAndValue(ApplicationLoader.applicationContext.getString(R.string.AboutThisProgram), "v" + getVersion(), false);
|
||||
textCell.setTextAndValue(mContext.getString(R.string.AboutThisProgram), "v" + IntroActivity.getVersion(), false);
|
||||
}
|
||||
}
|
||||
return view;
|
||||
|
||||
@@ -38,7 +38,6 @@ import android.widget.ListView;
|
||||
import com.b44t.messenger.AndroidUtilities;
|
||||
import com.b44t.messenger.MediaController;
|
||||
import com.b44t.messenger.ApplicationLoader;
|
||||
import com.b44t.messenger.LocaleController;
|
||||
import com.b44t.messenger.R;
|
||||
import com.b44t.ui.Adapters.BaseFragmentAdapter;
|
||||
import com.b44t.ui.Cells.ShadowSectionCell;
|
||||
@@ -48,13 +47,12 @@ import com.b44t.ui.ActionBar.ActionBar;
|
||||
import com.b44t.ui.ActionBar.BaseFragment;
|
||||
import com.b44t.ui.Components.LayoutHelper;
|
||||
import com.b44t.ui.Components.NumberPicker;
|
||||
import com.b44t.ui.ActionBar.Theme;
|
||||
|
||||
|
||||
public class SettingsAdvActivity extends BaseFragment {
|
||||
|
||||
// the list
|
||||
private int enableAnimationsRow, languageRow, directShareRow, textSizeRow, cacheRow, raiseToSpeakRow, sendByEnterRow, finalShadowRow;
|
||||
private int directShareRow, textSizeRow, cacheRow, raiseToSpeakRow, sendByEnterRow, autoplayGifsRow, finalShadowRow;
|
||||
private int rowCount;
|
||||
|
||||
private static final int ROWTYPE_SHADOW = 0;
|
||||
@@ -81,11 +79,10 @@ public class SettingsAdvActivity extends BaseFragment {
|
||||
directShareRow = -1;
|
||||
}
|
||||
textSizeRow = rowCount++;
|
||||
autoplayGifsRow = rowCount++;
|
||||
sendByEnterRow = rowCount++;
|
||||
raiseToSpeakRow = rowCount++; // outgoing message
|
||||
enableAnimationsRow = -1;//rowCount++; -- for now, we disable this option, maybe we can add it later to a "view" settings, however, in general, this should be more a system-option
|
||||
cacheRow = -1;// for now, the - non-functional - page is reachable by the "storage settings" in the "android App Settings" only
|
||||
languageRow = rowCount++;
|
||||
finalShadowRow = rowCount++;
|
||||
|
||||
return true;
|
||||
@@ -129,7 +126,7 @@ public class SettingsAdvActivity extends BaseFragment {
|
||||
return;
|
||||
}
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
|
||||
builder.setTitle(LocaleController.getString("TextSize", R.string.TextSize));
|
||||
builder.setTitle(ApplicationLoader.applicationContext.getString(R.string.TextSize));
|
||||
final NumberPicker numberPicker = new NumberPicker(getParentActivity());
|
||||
final int MIN_VAL = 12;
|
||||
final int MAX_VAL = 30;
|
||||
@@ -138,7 +135,7 @@ public class SettingsAdvActivity extends BaseFragment {
|
||||
for( int v = MIN_VAL; v <= MAX_VAL; v++ ) {
|
||||
String cur = String.format("%d", v);
|
||||
if( v==DEF_VAL ) {
|
||||
cur += " (" +LocaleController.getString("Default", R.string.Default)+ ")";
|
||||
cur += " (" +ApplicationLoader.applicationContext.getString(R.string.Default)+ ")";
|
||||
}
|
||||
displayValues[v-MIN_VAL] = cur;
|
||||
}
|
||||
@@ -148,7 +145,7 @@ public class SettingsAdvActivity extends BaseFragment {
|
||||
numberPicker.setWrapSelectorWheel(false);
|
||||
numberPicker.setValue(ApplicationLoader.fontSize);
|
||||
builder.setView(numberPicker);
|
||||
builder.setNegativeButton(LocaleController.getString("Done", R.string.Done), new DialogInterface.OnClickListener() {
|
||||
builder.setNegativeButton(ApplicationLoader.applicationContext.getString(R.string.Done), new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", Activity.MODE_PRIVATE);
|
||||
@@ -162,15 +159,6 @@ public class SettingsAdvActivity extends BaseFragment {
|
||||
}
|
||||
});
|
||||
showDialog(builder.create());
|
||||
} else if (i == enableAnimationsRow) {
|
||||
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", Activity.MODE_PRIVATE);
|
||||
boolean animations = preferences.getBoolean("view_animations2", true);
|
||||
SharedPreferences.Editor editor = preferences.edit();
|
||||
editor.putBoolean("view_animations2", !animations);
|
||||
editor.apply();
|
||||
if (view instanceof TextCheckCell) {
|
||||
((TextCheckCell) view).setChecked(!animations);
|
||||
}
|
||||
} else if (i == sendByEnterRow) {
|
||||
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", Activity.MODE_PRIVATE);
|
||||
boolean send = preferences.getBoolean("send_by_enter", false);
|
||||
@@ -185,13 +173,16 @@ public class SettingsAdvActivity extends BaseFragment {
|
||||
if (view instanceof TextCheckCell) {
|
||||
((TextCheckCell) view).setChecked(MediaController.getInstance().canRaiseToSpeak());
|
||||
}
|
||||
} else if (i == autoplayGifsRow) {
|
||||
MediaController.getInstance().toggleAutoplayGifs();
|
||||
if (view instanceof TextCheckCell) {
|
||||
((TextCheckCell) view).setChecked(MediaController.getInstance().canAutoplayGifs());
|
||||
}
|
||||
} else if(i == directShareRow) {
|
||||
MediaController.getInstance().toggleDirectShare();
|
||||
if (view instanceof TextCheckCell) {
|
||||
((TextCheckCell) view).setChecked(MediaController.getInstance().canDirectShare());
|
||||
}
|
||||
} else if (i == languageRow) {
|
||||
presentFragment(new LanguageSelectActivity());
|
||||
} else if (i == cacheRow) {
|
||||
presentFragment(new CacheControlActivity());
|
||||
}
|
||||
@@ -215,10 +206,9 @@ public class SettingsAdvActivity extends BaseFragment {
|
||||
|
||||
@Override
|
||||
public boolean isEnabled(int i) {
|
||||
return i == textSizeRow || i == enableAnimationsRow ||
|
||||
return i == textSizeRow ||
|
||||
i == sendByEnterRow ||
|
||||
i == languageRow ||
|
||||
i == cacheRow || i == raiseToSpeakRow || i == directShareRow ;
|
||||
i == cacheRow || i == raiseToSpeakRow || i == autoplayGifsRow || i == directShareRow;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -258,11 +248,9 @@ public class SettingsAdvActivity extends BaseFragment {
|
||||
if (i == textSizeRow) {
|
||||
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", Activity.MODE_PRIVATE);
|
||||
int size = preferences.getInt("msg_font_size", defMsgFontSize());
|
||||
textCell.setTextAndValue(LocaleController.getString("TextSize", R.string.TextSize), String.format("%d", size), true);
|
||||
} else if (i == languageRow) {
|
||||
textCell.setTextAndValue(LocaleController.getString("Language", R.string.Language), LocaleController.getCurrentLanguageName(), false);
|
||||
textCell.setTextAndValue(mContext.getString(R.string.TextSize), String.format("%d", size), true);
|
||||
} else if (i == cacheRow) {
|
||||
textCell.setText(LocaleController.getString("CacheSettings", R.string.CacheSettings), true);
|
||||
textCell.setText(mContext.getString(R.string.CacheSettings), true);
|
||||
}
|
||||
} else if (type == ROWTYPE_CHECK) {
|
||||
if (view == null) {
|
||||
@@ -272,14 +260,14 @@ public class SettingsAdvActivity extends BaseFragment {
|
||||
TextCheckCell textCell = (TextCheckCell) view;
|
||||
|
||||
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", Activity.MODE_PRIVATE);
|
||||
if (i == enableAnimationsRow) {
|
||||
textCell.setTextAndCheck(LocaleController.getString("EnableAnimations", R.string.EnableAnimations), preferences.getBoolean("view_animations2", true), false);
|
||||
} else if (i == sendByEnterRow) {
|
||||
textCell.setTextAndCheck(LocaleController.getString("SendByEnter", R.string.SendByEnter), preferences.getBoolean("send_by_enter", false), true);
|
||||
if (i == sendByEnterRow) {
|
||||
textCell.setTextAndCheck(mContext.getString(R.string.SendByEnter), preferences.getBoolean("send_by_enter", false), true);
|
||||
} else if (i == raiseToSpeakRow) {
|
||||
textCell.setTextAndCheck(LocaleController.getString("RaiseToSpeak", R.string.RaiseToSpeak), MediaController.getInstance().canRaiseToSpeak(), true);
|
||||
textCell.setTextAndCheck(mContext.getString(R.string.RaiseToSpeak), MediaController.getInstance().canRaiseToSpeak(), false);
|
||||
} else if (i == autoplayGifsRow) {
|
||||
textCell.setTextAndCheck(mContext.getString(R.string.AutoplayGifs), MediaController.getInstance().canAutoplayGifs(), true);
|
||||
} else if (i == directShareRow) {
|
||||
textCell.setTextAndValueAndCheck(LocaleController.getString("DirectShare", R.string.DirectShare), LocaleController.getString("DirectShareInfo", R.string.DirectShareInfo), MediaController.getInstance().canDirectShare(), false, true);
|
||||
textCell.setTextAndValueAndCheck(mContext.getString(R.string.DirectShare), mContext.getString(R.string.DirectShareInfo), MediaController.getInstance().canDirectShare(), false, true);
|
||||
}
|
||||
}
|
||||
return view;
|
||||
@@ -289,7 +277,7 @@ public class SettingsAdvActivity extends BaseFragment {
|
||||
public int getItemViewType(int i) {
|
||||
if (i == finalShadowRow ) {
|
||||
return ROWTYPE_SHADOW;
|
||||
} else if (i == enableAnimationsRow || i == sendByEnterRow || i == raiseToSpeakRow || i == directShareRow) {
|
||||
} else if ( i == sendByEnterRow || i == raiseToSpeakRow || i == autoplayGifsRow || i == directShareRow) {
|
||||
return ROWTYPE_CHECK;
|
||||
} else {
|
||||
return ROWTYPE_TEXT_SETTINGS;
|
||||
|
||||
@@ -37,7 +37,7 @@ import android.widget.FrameLayout;
|
||||
import android.widget.ListView;
|
||||
|
||||
import com.b44t.messenger.AndroidUtilities;
|
||||
import com.b44t.messenger.LocaleController;
|
||||
import com.b44t.messenger.ApplicationLoader;
|
||||
import com.b44t.messenger.MrMailbox;
|
||||
import com.b44t.messenger.NotificationCenter;
|
||||
import com.b44t.messenger.R;
|
||||
@@ -93,7 +93,7 @@ public class SettingsNameActivity extends BaseFragment {
|
||||
// create action bar
|
||||
actionBar.setBackButtonImage(R.drawable.ic_close_white);
|
||||
actionBar.setAllowOverlayTitle(true);
|
||||
actionBar.setTitle(LocaleController.getString("MyName", R.string.MyName));
|
||||
actionBar.setTitle(context.getString(R.string.MyName));
|
||||
actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {
|
||||
@Override
|
||||
public void onItemClick(int id) {
|
||||
@@ -143,7 +143,7 @@ public class SettingsNameActivity extends BaseFragment {
|
||||
}
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
|
||||
builder.setMessage(execute_result);
|
||||
builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), new DialogInterface.OnClickListener() {
|
||||
builder.setPositiveButton(ApplicationLoader.applicationContext.getString(R.string.OK), new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
}
|
||||
@@ -216,7 +216,7 @@ public class SettingsNameActivity extends BaseFragment {
|
||||
view.setBackgroundColor(0xffffffff);
|
||||
}
|
||||
if (i == rowNameTitle) {
|
||||
((HeaderCell) view).setText(LocaleController.getString("MyName", R.string.MyName));
|
||||
((HeaderCell) view).setText(mContext.getString(R.string.MyName));
|
||||
}
|
||||
}
|
||||
else if (type == typeTextEntry) {
|
||||
@@ -234,7 +234,7 @@ public class SettingsNameActivity extends BaseFragment {
|
||||
view = new TextInfoCell(mContext);
|
||||
}
|
||||
if( i==rowDisplaynameInfo) {
|
||||
((TextInfoCell) view).setText(LocaleController.getString("MyNameExplain", R.string.MyNameExplain));
|
||||
((TextInfoCell) view).setText(mContext.getString(R.string.MyNameExplain));
|
||||
}
|
||||
view.setBackgroundResource(R.drawable.greydivider_bottom);
|
||||
}
|
||||
|
||||
@@ -42,7 +42,6 @@ import android.widget.FrameLayout;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.ListView;
|
||||
|
||||
import com.b44t.messenger.LocaleController;
|
||||
import com.b44t.messenger.NotificationsController;
|
||||
import com.b44t.messenger.NotificationCenter;
|
||||
import com.b44t.messenger.ApplicationLoader;
|
||||
@@ -51,8 +50,6 @@ import com.b44t.ui.Adapters.BaseFragmentAdapter;
|
||||
import com.b44t.ui.Cells.HeaderCell;
|
||||
import com.b44t.ui.Cells.ShadowSectionCell;
|
||||
import com.b44t.ui.Cells.TextCheckCell;
|
||||
import com.b44t.ui.Cells.TextColorCell;
|
||||
import com.b44t.ui.Cells.TextDetailSettingsCell;
|
||||
import com.b44t.ui.ActionBar.ActionBar;
|
||||
import com.b44t.ui.ActionBar.BaseFragment;
|
||||
import com.b44t.ui.Cells.TextSettingsCell;
|
||||
@@ -92,11 +89,9 @@ public class SettingsNotificationsActivity extends BaseFragment implements Notif
|
||||
|
||||
private final int TYPE_HEADER = 0;
|
||||
private final int TYPE_CHECK_CELL = 1;
|
||||
private final int TYPE_TEXTDETAIL = 2;
|
||||
private final int TYPE_COLOR_CELL = 3;
|
||||
private final int TYPE_SHADOW = 4;
|
||||
private final int TYPE_TEXTSETTING = 5;
|
||||
private final int TYPE_COUNT = 6;
|
||||
private final int TYPE_SHADOW = 2;
|
||||
private final int TYPE_TEXTSETTING = 3;
|
||||
private final int TYPE_COUNT = 4;
|
||||
|
||||
@Override
|
||||
public boolean onFragmentCreate() {
|
||||
@@ -141,10 +136,10 @@ public class SettingsNotificationsActivity extends BaseFragment implements Notif
|
||||
}
|
||||
|
||||
@Override
|
||||
public View createView(Context context) {
|
||||
public View createView(final Context context) {
|
||||
actionBar.setBackButtonImage(R.drawable.ic_ab_back);
|
||||
actionBar.setAllowOverlayTitle(true);
|
||||
actionBar.setTitle(LocaleController.getString("NotificationsAndSounds", R.string.NotificationsAndSounds));
|
||||
actionBar.setTitle(context.getString(R.string.NotificationsAndSounds));
|
||||
actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {
|
||||
@Override
|
||||
public void onItemClick(int id) {
|
||||
@@ -230,9 +225,9 @@ public class SettingsNotificationsActivity extends BaseFragment implements Notif
|
||||
} else if (i == resetNotificationsRow) {
|
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
|
||||
builder.setMessage(LocaleController.formatString("AskResetNotifications", R.string.AskResetNotifications));
|
||||
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
|
||||
builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), new DialogInterface.OnClickListener() {
|
||||
builder.setMessage(context.getString(R.string.AskResetNotifications));
|
||||
builder.setNegativeButton(context.getString(R.string.Cancel), null);
|
||||
builder.setPositiveButton(context.getString(R.string.OK), new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE);
|
||||
@@ -284,43 +279,48 @@ public class SettingsNotificationsActivity extends BaseFragment implements Notif
|
||||
linearLayout.addView(colorPickerView, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER));
|
||||
|
||||
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE);
|
||||
if (i == messageLedRow) {
|
||||
colorPickerView.setColor(preferences.getInt("MessagesLed", 0xff00ff00));
|
||||
} else if (i == groupLedRow) {
|
||||
colorPickerView.setColor(preferences.getInt("GroupLed", 0xff00ff00));
|
||||
}
|
||||
colorPickerView.setColor(preferences.getInt(i == messageLedRow? "MessagesLed" : "GroupLed", NotificationsController.DEF_LED_COLOR));
|
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
|
||||
builder.setTitle(LocaleController.getString("LedColor", R.string.LedColor));
|
||||
builder.setTitle(context.getString(R.string.LedColor));
|
||||
builder.setView(linearLayout);
|
||||
builder.setPositiveButton(LocaleController.getString("Set", R.string.Set), new DialogInterface.OnClickListener() {
|
||||
builder.setPositiveButton(context.getString(R.string.Set), new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int which) {
|
||||
final SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE);
|
||||
SharedPreferences.Editor editor = preferences.edit();
|
||||
TextColorCell textCell = (TextColorCell) view;
|
||||
if (i == messageLedRow) {
|
||||
editor.putInt("MessagesLed", colorPickerView.getColor());
|
||||
textCell.setTextAndColor(LocaleController.getString("LedColor", R.string.LedColor), colorPickerView.getColor(), true);
|
||||
} else if (i == groupLedRow) {
|
||||
editor.putInt("GroupLed", colorPickerView.getColor());
|
||||
textCell.setTextAndColor(LocaleController.getString("LedColor", R.string.LedColor), colorPickerView.getColor(), true);
|
||||
}
|
||||
editor.apply();
|
||||
listView.invalidateViews();
|
||||
}
|
||||
});
|
||||
builder.setNeutralButton(LocaleController.getString("Disabled", R.string.Disabled), new DialogInterface.OnClickListener() {
|
||||
builder.setNeutralButton(context.getString(R.string.Disabled), new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
final SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE);
|
||||
SharedPreferences.Editor editor = preferences.edit();
|
||||
TextColorCell textCell = (TextColorCell) view;
|
||||
if (i == messageLedRow) {
|
||||
editor.putInt("MessagesLed", 0);
|
||||
textCell.setTextAndColor(LocaleController.getString("LedColor", R.string.LedColor), 0, true);
|
||||
editor.putInt("MessagesLed", 0/*0=off*/);
|
||||
} else if (i == groupLedRow) {
|
||||
editor.putInt("GroupLed", 0);
|
||||
textCell.setTextAndColor(LocaleController.getString("LedColor", R.string.LedColor), 0, true);
|
||||
editor.putInt("GroupLed", 0/*0=off*/);
|
||||
}
|
||||
editor.apply();
|
||||
listView.invalidateViews();
|
||||
}
|
||||
});
|
||||
builder.setNegativeButton(context.getString(R.string.Default), new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
final SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE);
|
||||
SharedPreferences.Editor editor = preferences.edit();
|
||||
if (i == messageLedRow) {
|
||||
editor.remove("MessagesLed");
|
||||
} else if (i == groupLedRow) {
|
||||
editor.remove("GroupLed");
|
||||
}
|
||||
editor.apply();
|
||||
listView.invalidateViews();
|
||||
@@ -329,13 +329,13 @@ public class SettingsNotificationsActivity extends BaseFragment implements Notif
|
||||
showDialog(builder.create());
|
||||
} else if (i == messageVibrateRow || i == groupVibrateRow) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
|
||||
builder.setTitle(LocaleController.getString("Vibrate", R.string.Vibrate));
|
||||
builder.setTitle(context.getString(R.string.Vibrate));
|
||||
builder.setItems(new CharSequence[]{
|
||||
LocaleController.getString("Disabled", R.string.Disabled),
|
||||
LocaleController.getString("VibrationDefault", R.string.VibrationDefault),
|
||||
LocaleController.getString("Short", R.string.Short),
|
||||
LocaleController.getString("Long", R.string.Long),
|
||||
LocaleController.getString("OnlyIfSilent", R.string.OnlyIfSilent)
|
||||
context.getString(R.string.Disabled),
|
||||
context.getString(R.string.Default),
|
||||
context.getString(R.string.Short),
|
||||
context.getString(R.string.Long),
|
||||
context.getString(R.string.OnlyIfSilent)
|
||||
}, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
@@ -362,15 +362,15 @@ public class SettingsNotificationsActivity extends BaseFragment implements Notif
|
||||
}
|
||||
}
|
||||
});
|
||||
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
|
||||
builder.setNegativeButton(context.getString(R.string.Cancel), null);
|
||||
showDialog(builder.create());
|
||||
} else if (i == messagePriorityRow || i == groupPriorityRow || i == inappPriorityRow ) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
|
||||
builder.setTitle(LocaleController.getString("NotificationsPriority", R.string.NotificationsPriority));
|
||||
builder.setTitle(context.getString(R.string.NotificationsPriority));
|
||||
builder.setItems(new CharSequence[]{
|
||||
LocaleController.getString("NotificationsPriorityDefault", R.string.NotificationsPriorityDefault),
|
||||
LocaleController.getString("NotificationsPriorityHigh", R.string.NotificationsPriorityHigh),
|
||||
LocaleController.getString("NotificationsPriorityMax", R.string.NotificationsPriorityMax)
|
||||
context.getString(R.string.NotificationsPriorityDefault),
|
||||
context.getString(R.string.NotificationsPriorityHigh),
|
||||
context.getString(R.string.NotificationsPriorityMax)
|
||||
}, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
@@ -387,19 +387,19 @@ public class SettingsNotificationsActivity extends BaseFragment implements Notif
|
||||
}
|
||||
}
|
||||
});
|
||||
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
|
||||
builder.setNegativeButton(context.getString(R.string.Cancel), null);
|
||||
showDialog(builder.create());
|
||||
} else if (i == repeatRow) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
|
||||
builder.setTitle(LocaleController.getString("RepeatNotifications", R.string.RepeatNotifications));
|
||||
builder.setTitle(context.getString(R.string.RepeatNotifications));
|
||||
builder.setItems(new CharSequence[]{
|
||||
LocaleController.getString("Disabled", R.string.Disabled),
|
||||
ApplicationLoader.applicationContext.getResources().getQuantityString(R.plurals.Minutes, 5, 5),
|
||||
ApplicationLoader.applicationContext.getResources().getQuantityString(R.plurals.Minutes, 10, 10),
|
||||
ApplicationLoader.applicationContext.getResources().getQuantityString(R.plurals.Minutes, 30, 30),
|
||||
ApplicationLoader.applicationContext.getResources().getQuantityString(R.plurals.Hours, 1, 1),
|
||||
ApplicationLoader.applicationContext.getResources().getQuantityString(R.plurals.Hours, 2, 2),
|
||||
ApplicationLoader.applicationContext.getResources().getQuantityString(R.plurals.Hours, 4, 4)
|
||||
context.getString(R.string.Disabled),
|
||||
context.getResources().getQuantityString(R.plurals.Minutes, 5, 5),
|
||||
context.getResources().getQuantityString(R.plurals.Minutes, 10, 10),
|
||||
context.getResources().getQuantityString(R.plurals.Minutes, 30, 30),
|
||||
context.getResources().getQuantityString(R.plurals.Hours, 1, 1),
|
||||
context.getResources().getQuantityString(R.plurals.Hours, 2, 2),
|
||||
context.getResources().getQuantityString(R.plurals.Hours, 4, 4)
|
||||
}, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
@@ -424,7 +424,7 @@ public class SettingsNotificationsActivity extends BaseFragment implements Notif
|
||||
}
|
||||
}
|
||||
});
|
||||
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
|
||||
builder.setNegativeButton(context.getString(R.string.Cancel), null);
|
||||
showDialog(builder.create());
|
||||
}
|
||||
if (view instanceof TextCheckCell) {
|
||||
@@ -445,7 +445,7 @@ public class SettingsNotificationsActivity extends BaseFragment implements Notif
|
||||
Ringtone rng = RingtoneManager.getRingtone(getParentActivity(), ringtone);
|
||||
if (rng != null) {
|
||||
if(ringtone.equals(Settings.System.DEFAULT_NOTIFICATION_URI)) {
|
||||
name = LocaleController.getString("SoundDefault", R.string.SoundDefault);
|
||||
name = ApplicationLoader.applicationContext.getString(R.string.Default);
|
||||
} else {
|
||||
name = rng.getTitle(getParentActivity());
|
||||
}
|
||||
@@ -533,13 +533,13 @@ public class SettingsNotificationsActivity extends BaseFragment implements Notif
|
||||
view = new HeaderCell(mContext);
|
||||
}
|
||||
if (i == messageSectionRow) {
|
||||
((HeaderCell) view).setText(LocaleController.getString("NormalMessagess", R.string.NormalMessages));
|
||||
((HeaderCell) view).setText(mContext.getString(R.string.DefaultForNormalMessages));
|
||||
} else if (i == groupSectionRow) {
|
||||
((HeaderCell) view).setText(LocaleController.getString("GroupMessages", R.string.GroupMessages));
|
||||
((HeaderCell) view).setText(mContext.getString(R.string.DefaultForGroupMessages));
|
||||
} else if (i == inappSectionRow) {
|
||||
((HeaderCell) view).setText(LocaleController.getString("InAppNotifications", R.string.InAppNotifications));
|
||||
((HeaderCell) view).setText(mContext.getString(R.string.InAppNotifications));
|
||||
} else if (i == otherSectionRow) {
|
||||
((HeaderCell) view).setText(LocaleController.getString("NotificationsOther", R.string.NotificationsOther));
|
||||
((HeaderCell) view).setText(mContext.getString(R.string.NotificationsOther));
|
||||
}
|
||||
} if (type == TYPE_CHECK_CELL) {
|
||||
if (view == null) {
|
||||
@@ -547,50 +547,40 @@ public class SettingsNotificationsActivity extends BaseFragment implements Notif
|
||||
}
|
||||
TextCheckCell checkCell = (TextCheckCell) view;
|
||||
|
||||
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE);
|
||||
SharedPreferences preferences = mContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE);
|
||||
if (i == messageAlertRow) {
|
||||
checkCell.setTextAndCheck(LocaleController.getString("Alert", R.string.Alert), preferences.getBoolean("EnableAll", true), true);
|
||||
checkCell.setTextAndCheck(mContext.getString(R.string.Notifications), preferences.getBoolean("EnableAll", true), true);
|
||||
} else if (i == groupAlertRow) {
|
||||
checkCell.setTextAndCheck(LocaleController.getString("Alert", R.string.Alert), preferences.getBoolean("EnableGroup", true), true);
|
||||
checkCell.setTextAndCheck(mContext.getString(R.string.Notifications), preferences.getBoolean("EnableGroup", true), true);
|
||||
} else if (i == messagePreviewRow) {
|
||||
checkCell.setTextAndCheck(LocaleController.getString("MessagePreview", R.string.MessagePreview), preferences.getBoolean("EnablePreviewAll", true), true);
|
||||
checkCell.setTextAndCheck(mContext.getString(R.string.MessagePreview), preferences.getBoolean("EnablePreviewAll", true), true);
|
||||
} else if (i == inappSoundRow) {
|
||||
checkCell.setTextAndCheck(LocaleController.getString("Sound", R.string.Sound), preferences.getBoolean("EnableInAppSounds", true), true);
|
||||
checkCell.setTextAndCheck(mContext.getString(R.string.Sound), preferences.getBoolean("EnableInAppSounds", true), true);
|
||||
} else if (i == inappVibrateRow) {
|
||||
checkCell.setTextAndCheck(LocaleController.getString("Vibrate", R.string.Vibrate), preferences.getBoolean("EnableInAppVibrate", true), true);
|
||||
checkCell.setTextAndCheck(mContext.getString(R.string.Vibrate), preferences.getBoolean("EnableInAppVibrate", true), true);
|
||||
} else if (i == badgeNumberRow) {
|
||||
checkCell.setTextAndCheck(LocaleController.getString("BadgeNumber", R.string.BadgeNumber), preferences.getBoolean("badgeNumber", true), true);
|
||||
checkCell.setTextAndCheck(mContext.getString(R.string.BadgeNumber), preferences.getBoolean("badgeNumber", true), true);
|
||||
} else if (i == inchatSoundRow) {
|
||||
checkCell.setTextAndCheck(LocaleController.getString("InChatSound", R.string.InChatSound), preferences.getBoolean("EnableInChatSound", true), true);
|
||||
}
|
||||
} else if (type == TYPE_TEXTDETAIL) {
|
||||
if (view == null) {
|
||||
view = new TextDetailSettingsCell(mContext);
|
||||
}
|
||||
TextDetailSettingsCell textCell = (TextDetailSettingsCell) view;
|
||||
|
||||
if (i == resetNotificationsRow) {
|
||||
textCell.setMultilineDetail(true);
|
||||
textCell.setTextAndValue(LocaleController.getString("Reset", R.string.Reset), LocaleController.getString("ResetAllNotifications", R.string.ResetAllNotifications), false);
|
||||
checkCell.setTextAndCheck(mContext.getString(R.string.InChatSound), preferences.getBoolean("EnableInChatSound", true), true);
|
||||
}
|
||||
} else if (type == TYPE_TEXTSETTING) {
|
||||
if (view == null) {
|
||||
view = new TextSettingsCell(mContext);
|
||||
}
|
||||
TextSettingsCell textCell = (TextSettingsCell) view;
|
||||
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE);
|
||||
SharedPreferences preferences = mContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE);
|
||||
|
||||
if (i == messageSoundRow || i == groupSoundRow) {
|
||||
String value = null;
|
||||
if (i == messageSoundRow) {
|
||||
value = preferences.getString("GlobalSound", LocaleController.getString("SoundDefault", R.string.SoundDefault));
|
||||
value = preferences.getString("GlobalSound", mContext.getString(R.string.Default));
|
||||
} else if (i == groupSoundRow) {
|
||||
value = preferences.getString("GroupSound", LocaleController.getString("SoundDefault", R.string.SoundDefault));
|
||||
value = preferences.getString("GroupSound", mContext.getString(R.string.Default));
|
||||
}
|
||||
if (value.equals("NoSound")) {
|
||||
value = LocaleController.getString("Disabled", R.string.Disabled);
|
||||
value = mContext.getString(R.string.Disabled);
|
||||
}
|
||||
textCell.setTextAndValue(LocaleController.getString("Sound", R.string.Sound), value, true);
|
||||
textCell.setTextAndValue(mContext.getString(R.string.Sound), value, true);
|
||||
} else if (i == messageVibrateRow || i == groupVibrateRow) {
|
||||
int value = 0;
|
||||
if (i == messageVibrateRow) {
|
||||
@@ -599,15 +589,15 @@ public class SettingsNotificationsActivity extends BaseFragment implements Notif
|
||||
value = preferences.getInt("vibrate_group", 0);
|
||||
}
|
||||
if (value == 0) {
|
||||
textCell.setTextAndValue(LocaleController.getString("Vibrate", R.string.Vibrate), LocaleController.getString("VibrationDefault", R.string.VibrationDefault), true);
|
||||
textCell.setTextAndValue(mContext.getString(R.string.Vibrate), mContext.getString(R.string.Default), true);
|
||||
} else if (value == 1) {
|
||||
textCell.setTextAndValue(LocaleController.getString("Vibrate", R.string.Vibrate), LocaleController.getString("Short", R.string.Short), true);
|
||||
textCell.setTextAndValue(mContext.getString(R.string.Vibrate), mContext.getString(R.string.Short), true);
|
||||
} else if (value == 2) {
|
||||
textCell.setTextAndValue(LocaleController.getString("Vibrate", R.string.Vibrate), LocaleController.getString("Disabled", R.string.Disabled), true);
|
||||
textCell.setTextAndValue(mContext.getString(R.string.Vibrate), mContext.getString(R.string.Disabled), true);
|
||||
} else if (value == 3) {
|
||||
textCell.setTextAndValue(LocaleController.getString("Vibrate", R.string.Vibrate), LocaleController.getString("Long", R.string.Long), true);
|
||||
textCell.setTextAndValue(mContext.getString(R.string.Vibrate), mContext.getString(R.string.Long), true);
|
||||
} else if (value == 4) {
|
||||
textCell.setTextAndValue(LocaleController.getString("Vibrate", R.string.Vibrate), LocaleController.getString("OnlyIfSilent", R.string.OnlyIfSilent), true);
|
||||
textCell.setTextAndValue(mContext.getString(R.string.Vibrate), mContext.getString(R.string.OnlyIfSilent), true);
|
||||
}
|
||||
} else if (i == messagePriorityRow || i == groupPriorityRow || i == inappPriorityRow ) {
|
||||
int value = 0;
|
||||
@@ -619,36 +609,35 @@ public class SettingsNotificationsActivity extends BaseFragment implements Notif
|
||||
value = preferences.getInt("priority_inapp", 0);
|
||||
}
|
||||
if (value == 0) {
|
||||
textCell.setTextAndValue(LocaleController.getString("NotificationsPriority", R.string.NotificationsPriority), LocaleController.getString("NotificationsPriorityDefault", R.string.NotificationsPriorityDefault), false);
|
||||
textCell.setTextAndValue(mContext.getString(R.string.NotificationsPriority), mContext.getString(R.string.NotificationsPriorityDefault), false);
|
||||
} else if (value == 1) {
|
||||
textCell.setTextAndValue(LocaleController.getString("NotificationsPriority", R.string.NotificationsPriority), LocaleController.getString("NotificationsPriorityHigh", R.string.NotificationsPriorityHigh), false);
|
||||
textCell.setTextAndValue(mContext.getString(R.string.NotificationsPriority), mContext.getString(R.string.NotificationsPriorityHigh), false);
|
||||
} else if (value == 2) {
|
||||
textCell.setTextAndValue(LocaleController.getString("NotificationsPriority", R.string.NotificationsPriority), LocaleController.getString("NotificationsPriorityMax", R.string.NotificationsPriorityMax), false);
|
||||
textCell.setTextAndValue(mContext.getString(R.string.NotificationsPriority), mContext.getString(R.string.NotificationsPriorityMax), false);
|
||||
}
|
||||
} else if (i == repeatRow) {
|
||||
int minutes = preferences.getInt("repeat_messages", 0);
|
||||
String value;
|
||||
if (minutes == 0) {
|
||||
value = LocaleController.getString("Disabled", R.string.Disabled);
|
||||
value = mContext.getString(R.string.Disabled);
|
||||
} else if (minutes < 60) {
|
||||
value = ApplicationLoader.applicationContext.getResources().getQuantityString(R.plurals.Minutes, minutes, minutes);
|
||||
value = mContext.getResources().getQuantityString(R.plurals.Minutes, minutes, minutes);
|
||||
} else {
|
||||
value = ApplicationLoader.applicationContext.getResources().getQuantityString(R.plurals.Hours, minutes / 60, minutes / 60);
|
||||
value = mContext.getResources().getQuantityString(R.plurals.Hours, minutes / 60, minutes / 60);
|
||||
}
|
||||
textCell.setTextAndValue(LocaleController.getString("RepeatNotifications", R.string.RepeatNotifications), value, true);
|
||||
textCell.setTextAndValue(mContext.getString(R.string.RepeatNotifications), value, true);
|
||||
}
|
||||
} else if (type == TYPE_COLOR_CELL) {
|
||||
if (view == null) {
|
||||
view = new TextColorCell(mContext);
|
||||
else if (i == messageLedRow || i==groupLedRow ) {
|
||||
int color = preferences.getInt(i==messageLedRow? "MessagesLed" : "GroupLed", NotificationsController.DEF_LED_COLOR);
|
||||
if( color == 0 ) {
|
||||
textCell.setTextAndValue(mContext.getString(R.string.LedColor), mContext.getString(R.string.Disabled), true);
|
||||
}
|
||||
else {
|
||||
textCell.setTextAndColor(mContext.getString(R.string.LedColor), color, true);
|
||||
}
|
||||
}
|
||||
|
||||
TextColorCell textCell = (TextColorCell) view;
|
||||
|
||||
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE);
|
||||
if (i == messageLedRow) {
|
||||
textCell.setTextAndColor(LocaleController.getString("LedColor", R.string.LedColor), preferences.getInt("MessagesLed", 0xff00ff00), true);
|
||||
} else if (i == groupLedRow) {
|
||||
textCell.setTextAndColor(LocaleController.getString("LedColor", R.string.LedColor), preferences.getInt("GroupLed", 0xff00ff00), true);
|
||||
else if (i == resetNotificationsRow) {
|
||||
textCell.setText(mContext.getString(R.string.ResetAllNotifications), false);
|
||||
}
|
||||
} else if (type == TYPE_SHADOW) {
|
||||
if (view == null) {
|
||||
@@ -668,13 +657,9 @@ public class SettingsNotificationsActivity extends BaseFragment implements Notif
|
||||
i == badgeNumberRow ||
|
||||
i == inchatSoundRow ) {
|
||||
return TYPE_CHECK_CELL;
|
||||
} else if (i == messageLedRow || i == groupLedRow) {
|
||||
return TYPE_COLOR_CELL;
|
||||
} else if ( i == groupSectionRow2 ||
|
||||
i == inappSectionRow2 || i == otherSectionRow2 ) {
|
||||
return TYPE_SHADOW;
|
||||
} else if( i==resetNotificationsRow ){
|
||||
return TYPE_TEXTDETAIL;
|
||||
} else {
|
||||
return TYPE_TEXTSETTING;
|
||||
}
|
||||
|
||||
@@ -33,7 +33,6 @@ import android.widget.ListView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.b44t.messenger.ApplicationLoader;
|
||||
import com.b44t.messenger.LocaleController;
|
||||
import com.b44t.messenger.MrChat;
|
||||
import com.b44t.messenger.MrMailbox;
|
||||
import com.b44t.messenger.R;
|
||||
@@ -81,10 +80,10 @@ public class SettingsPrivacyActivity extends BaseFragment {
|
||||
}
|
||||
|
||||
@Override
|
||||
public View createView(Context context) {
|
||||
public View createView(final Context context) {
|
||||
actionBar.setBackButtonImage(R.drawable.ic_ab_back);
|
||||
actionBar.setAllowOverlayTitle(true);
|
||||
actionBar.setTitle(LocaleController.getString("PrivacySettings", R.string.PrivacySettings));
|
||||
actionBar.setTitle(context.getString(R.string.PrivacySettings));
|
||||
actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {
|
||||
@Override
|
||||
public void onItemClick(int id) {
|
||||
@@ -120,15 +119,15 @@ public class SettingsPrivacyActivity extends BaseFragment {
|
||||
}
|
||||
else if(i==e2eEncryptionRow )
|
||||
{
|
||||
Toast.makeText(getParentActivity(), LocaleController.getString("NotYetImplemented", R.string.NotYetImplemented), Toast.LENGTH_SHORT).show();
|
||||
Toast.makeText(getParentActivity(), context.getString(R.string.NotYetImplemented), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
else if(i==manageKeysRow )
|
||||
{
|
||||
Toast.makeText(getParentActivity(), LocaleController.getString("NotYetImplemented", R.string.NotYetImplemented), Toast.LENGTH_SHORT).show();
|
||||
Toast.makeText(getParentActivity(), context.getString(R.string.NotYetImplemented), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
else if(i==readReceiptsRow )
|
||||
{
|
||||
Toast.makeText(getParentActivity(), LocaleController.getString("NotYetImplemented", R.string.NotYetImplemented), Toast.LENGTH_SHORT).show();
|
||||
Toast.makeText(getParentActivity(), context.getString(R.string.NotYetImplemented), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
else if( i==showUnknownSendersRow) {
|
||||
int oldval = MrMailbox.getConfigInt("show_deaddrop", 0);
|
||||
@@ -214,11 +213,11 @@ public class SettingsPrivacyActivity extends BaseFragment {
|
||||
String cntStr = String.format("%d", MrMailbox.getBlockedCount());
|
||||
textCell.setTextAndValue(ApplicationLoader.applicationContext.getString(R.string.BlockedContacts), cntStr, true);
|
||||
} else if (i == passcodeRow) {
|
||||
String val = UserConfig.passcodeHash.length() > 0? LocaleController.getString("Enabled", R.string.Enabled) : LocaleController.getString("Disabled", R.string.Disabled);
|
||||
textCell.setTextAndValue(LocaleController.getString("Passcode", R.string.Passcode), val, true);
|
||||
String val = UserConfig.passcodeHash.length() > 0? mContext.getString(R.string.Enabled) : mContext.getString(R.string.Disabled);
|
||||
textCell.setTextAndValue(mContext.getString(R.string.Passcode), val, true);
|
||||
}
|
||||
else if( i==manageKeysRow ) {
|
||||
textCell.setText(LocaleController.getString("E2EManagePrivateKeys", R.string.E2EManagePrivateKeys), true);
|
||||
textCell.setText(mContext.getString(R.string.E2EManagePrivateKeys), true);
|
||||
}
|
||||
} else if (type == TYPE_TEXT_INFO) {
|
||||
if (view == null) {
|
||||
@@ -235,15 +234,15 @@ public class SettingsPrivacyActivity extends BaseFragment {
|
||||
}
|
||||
TextCheckCell textCell = (TextCheckCell) view;
|
||||
if( i == e2eEncryptionRow ) {
|
||||
textCell.setTextAndCheck(LocaleController.getString("E2EEncryption", R.string.E2EEncryption),
|
||||
textCell.setTextAndCheck(mContext.getString(R.string.E2EEncryption),
|
||||
MrMailbox.getConfigInt("e2e_encrypt", 0)!=0, true);
|
||||
}
|
||||
else if( i == readReceiptsRow ) {
|
||||
textCell.setTextAndCheck(LocaleController.getString("SendNRcvReadReceipts", R.string.SendNRcvReadReceipts),
|
||||
textCell.setTextAndCheck(mContext.getString(R.string.SendNRcvReadReceipts),
|
||||
MrMailbox.getConfigInt("read_receipts", 0)!=0, true);
|
||||
}
|
||||
else if( i==showUnknownSendersRow) {
|
||||
textCell.setTextAndCheck(LocaleController.getString("DeaddropInChatlist", R.string.DeaddropInChatlist),
|
||||
textCell.setTextAndCheck(mContext.getString(R.string.DeaddropInChatlist),
|
||||
MrMailbox.getConfigInt("show_deaddrop", 0)!=0, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -231,7 +231,7 @@ public class VideoEditorActivity extends BaseFragment implements TextureView.Sur
|
||||
}
|
||||
|
||||
@Override
|
||||
public View createView(Context context) {
|
||||
public View createView(final Context context) {
|
||||
actionBar.setBackButtonImage(R.drawable.ic_close_white);
|
||||
actionBar.setTitle(ApplicationLoader.applicationContext.getString(R.string.SendVideo));
|
||||
actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {
|
||||
@@ -253,7 +253,7 @@ public class VideoEditorActivity extends BaseFragment implements TextureView.Sur
|
||||
}
|
||||
|
||||
if(estimatedBytes>MAX_BYTES) {
|
||||
AndroidUtilities.showHint(getParentActivity(), LocaleController.formatString("", R.string.PleaseCutVideoToMaxSize, AndroidUtilities.formatFileSize(MAX_BYTES)));
|
||||
AndroidUtilities.showHint(getParentActivity(), String.format(context.getString(R.string.PleaseCutVideoToMaxSize), AndroidUtilities.formatFileSize(MAX_BYTES)));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -123,10 +123,10 @@ public class WallpapersActivity extends BaseFragment implements NotificationCent
|
||||
}
|
||||
|
||||
@Override
|
||||
public View createView(Context context) {
|
||||
public View createView(final Context context) {
|
||||
actionBar.setBackButtonImage(R.drawable.ic_close_white);
|
||||
actionBar.setAllowOverlayTitle(true);
|
||||
actionBar.setTitle(LocaleController.getString("ChatBackground", R.string.ChatBackground));
|
||||
actionBar.setTitle(context.getString(R.string.ChatBackground));
|
||||
actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {
|
||||
@Override
|
||||
public void onItemClick(int id) {
|
||||
@@ -212,7 +212,7 @@ public class WallpapersActivity extends BaseFragment implements NotificationCent
|
||||
}
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
|
||||
|
||||
CharSequence[] items = new CharSequence[]{LocaleController.getString("FromCamera", R.string.FromCamera), LocaleController.getString("FromGalley", R.string.FromGalley), LocaleController.getString("Cancel", R.string.Cancel)};
|
||||
CharSequence[] items = new CharSequence[]{context.getString(R.string.FromCamera), context.getString(R.string.FromGalley), context.getString(R.string.Cancel)};
|
||||
|
||||
builder.setItems(items, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
|
||||
|
Before Width: | Height: | Size: 229 B |
|
Before Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 991 B |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 258 B |
|
Before Width: | Height: | Size: 254 B |
|
Before Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 468 B |
|
Before Width: | Height: | Size: 187 B |
|
Before Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 977 B |
|
Before Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 186 B |
|
Before Width: | Height: | Size: 181 B |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 270 B |
@@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:color="#fff2f2f2">
|
||||
<item android:drawable="@drawable/floating3_profile_m"/>
|
||||
</ripple>
|
||||
@@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:color="#ff1c94cf">
|
||||
<item android:drawable="@drawable/regbtn2"/>
|
||||
</ripple>
|
||||
|
Before Width: | Height: | Size: 275 B |
|
Before Width: | Height: | Size: 2.6 KiB |
|
Before Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 1023 B |