Save localization files applyed from document, fixed forwarded name position in group chats, added links to telegram FAQ and support alert message, move all menus creation to code for localization purposes
This commit is contained in:
parent
bd4152dc81
commit
ebedf3c367
@ -82,7 +82,7 @@ android {
|
||||
defaultConfig {
|
||||
minSdkVersion 8
|
||||
targetSdkVersion 19
|
||||
versionCode 215
|
||||
versionCode 217
|
||||
versionName "1.4.9"
|
||||
}
|
||||
}
|
||||
|
@ -649,7 +649,7 @@ public class ConnectionsManager implements Action.ActionDelegate, TcpConnection.
|
||||
if (phone.startsWith("968")) {
|
||||
for (HashMap.Entry<Integer, Datacenter> entry : datacenters.entrySet()) {
|
||||
Datacenter datacenter = entry.getValue();
|
||||
datacenter.overridePort = 14;
|
||||
datacenter.overridePort = 8888;
|
||||
if (datacenter.connection != null) {
|
||||
datacenter.connection.suspendConnection(true);
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ public class Datacenter {
|
||||
public ArrayList<String> addresses = new ArrayList<String>();
|
||||
public HashMap<String, Integer> ports = new HashMap<String, Integer>();
|
||||
public int[] defaultPorts = new int[] {-1, 80, -1, 443, -1, 443, -1, 80, -1, 443, -1};
|
||||
public int[] defaultPorts14 = new int[] {-1, 14, -1, 443, -1, 14, -1, 80, -1, 14, -1};
|
||||
public int[] defaultPorts8888 = new int[] {-1, 8888, -1, 443, -1, 8888, -1, 80, -1, 8888, -1};
|
||||
public boolean authorized;
|
||||
public long authSessionId;
|
||||
public long authDownloadSessionId;
|
||||
@ -136,8 +136,8 @@ public class Datacenter {
|
||||
|
||||
int[] portsArray = defaultPorts;
|
||||
|
||||
if (overridePort == 14) {
|
||||
portsArray = defaultPorts14;
|
||||
if (overridePort == 8888) {
|
||||
portsArray = defaultPorts8888;
|
||||
}
|
||||
|
||||
if (currentPortNum >= defaultPorts.length) {
|
||||
|
@ -42,6 +42,7 @@ public class LocaleController {
|
||||
private Locale currentLocale;
|
||||
private Locale systemDefaultLocale;
|
||||
private LocaleInfo currentLocaleInfo;
|
||||
private LocaleInfo defaultLocalInfo;
|
||||
private HashMap<String, String> localeValues = new HashMap<String, String>();
|
||||
private String languageOverride;
|
||||
private boolean changingConfiguration = false;
|
||||
@ -50,12 +51,34 @@ public class LocaleController {
|
||||
public String name;
|
||||
public String nameEnglish;
|
||||
public String shortName;
|
||||
public boolean embededLang;
|
||||
public String pathToFile;
|
||||
|
||||
public String getSaveString() {
|
||||
return name + "|" + nameEnglish + "|" + shortName + "|" + pathToFile;
|
||||
}
|
||||
|
||||
public static LocaleInfo createWithString(String string) {
|
||||
if (string == null || string.length() == 0) {
|
||||
return null;
|
||||
}
|
||||
String[] args = string.split("\\|");
|
||||
if (args.length != 4) {
|
||||
return null;
|
||||
}
|
||||
LocaleInfo localeInfo = new LocaleInfo();
|
||||
localeInfo.name = args[0];
|
||||
localeInfo.nameEnglish = args[1];
|
||||
localeInfo.shortName = args[2];
|
||||
localeInfo.pathToFile = args[3];
|
||||
return localeInfo;
|
||||
}
|
||||
}
|
||||
|
||||
public ArrayList<LocaleInfo> sortedLanguages = new ArrayList<LocaleController.LocaleInfo>();
|
||||
public HashMap<String, LocaleInfo> languagesDict = new HashMap<String, LocaleInfo>();
|
||||
|
||||
private ArrayList<LocaleInfo> otherLanguages = new ArrayList<LocaleInfo>();
|
||||
|
||||
private static volatile LocaleController Instance = null;
|
||||
public static LocaleController getInstance() {
|
||||
LocaleController localInstance = Instance;
|
||||
@ -75,7 +98,7 @@ public class LocaleController {
|
||||
localeInfo.name = "English";
|
||||
localeInfo.nameEnglish = "English";
|
||||
localeInfo.shortName = "en";
|
||||
localeInfo.embededLang = true;
|
||||
localeInfo.pathToFile = null;
|
||||
sortedLanguages.add(localeInfo);
|
||||
languagesDict.put(localeInfo.shortName, localeInfo);
|
||||
|
||||
@ -83,7 +106,7 @@ public class LocaleController {
|
||||
localeInfo.name = "Italiano";
|
||||
localeInfo.nameEnglish = "Italian";
|
||||
localeInfo.shortName = "it";
|
||||
localeInfo.embededLang = true;
|
||||
localeInfo.pathToFile = null;
|
||||
sortedLanguages.add(localeInfo);
|
||||
languagesDict.put(localeInfo.shortName, localeInfo);
|
||||
|
||||
@ -98,7 +121,7 @@ public class LocaleController {
|
||||
localeInfo.name = "Deutsch";
|
||||
localeInfo.nameEnglish = "German";
|
||||
localeInfo.shortName = "de";
|
||||
localeInfo.embededLang = true;
|
||||
localeInfo.pathToFile = null;
|
||||
sortedLanguages.add(localeInfo);
|
||||
languagesDict.put(localeInfo.shortName, localeInfo);
|
||||
|
||||
@ -106,7 +129,7 @@ public class LocaleController {
|
||||
localeInfo.name = "Nederlands";
|
||||
localeInfo.nameEnglish = "Dutch";
|
||||
localeInfo.shortName = "nl";
|
||||
localeInfo.embededLang = true;
|
||||
localeInfo.pathToFile = null;
|
||||
sortedLanguages.add(localeInfo);
|
||||
languagesDict.put(localeInfo.shortName, localeInfo);
|
||||
|
||||
@ -114,10 +137,17 @@ public class LocaleController {
|
||||
localeInfo.name = "العربية";
|
||||
localeInfo.nameEnglish = "Arabic";
|
||||
localeInfo.shortName = "ar";
|
||||
localeInfo.embededLang = true;
|
||||
localeInfo.pathToFile = null;
|
||||
sortedLanguages.add(localeInfo);
|
||||
languagesDict.put(localeInfo.shortName, localeInfo);
|
||||
|
||||
loadOtherLanguages();
|
||||
|
||||
for (LocaleInfo locale : otherLanguages) {
|
||||
sortedLanguages.add(locale);
|
||||
languagesDict.put(locale.shortName, locale);
|
||||
}
|
||||
|
||||
Collections.sort(sortedLanguages, new Comparator<LocaleInfo>() {
|
||||
@Override
|
||||
public int compare(LocaleController.LocaleInfo o, LocaleController.LocaleInfo o2) {
|
||||
@ -125,11 +155,11 @@ public class LocaleController {
|
||||
}
|
||||
});
|
||||
|
||||
localeInfo = new LocaleController.LocaleInfo();
|
||||
defaultLocalInfo = localeInfo = new LocaleController.LocaleInfo();
|
||||
localeInfo.name = "System default";
|
||||
localeInfo.nameEnglish = "System default";
|
||||
localeInfo.shortName = null;
|
||||
localeInfo.embededLang = true;
|
||||
localeInfo.pathToFile = null;
|
||||
sortedLanguages.add(0, localeInfo);
|
||||
|
||||
systemDefaultLocale = Locale.getDefault();
|
||||
@ -160,6 +190,117 @@ public class LocaleController {
|
||||
}
|
||||
|
||||
public boolean applyLanguageFile(File file) {
|
||||
try {
|
||||
HashMap<String, String> stringMap = getLocaleFileStrings(file);
|
||||
|
||||
String languageName = stringMap.get("LanguageName");
|
||||
String languageNameInEnglish = stringMap.get("LanguageNameInEnglish");
|
||||
String languageCode = stringMap.get("LanguageCode");
|
||||
|
||||
if (languageName != null && languageName.length() > 0 &&
|
||||
languageNameInEnglish != null && languageNameInEnglish.length() > 0 &&
|
||||
languageCode != null && languageCode.length() > 0) {
|
||||
|
||||
if (languageName.contains("&") || languageName.contains("|")) {
|
||||
return false;
|
||||
}
|
||||
if (languageNameInEnglish.contains("&") || languageNameInEnglish.contains("|")) {
|
||||
return false;
|
||||
}
|
||||
if (languageCode.contains("&") || languageCode.contains("|")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
File finalFile = new File(ApplicationLoader.applicationContext.getFilesDir(), languageCode + ".xml");
|
||||
if (!Utilities.copyFile(file, finalFile)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
LocaleInfo localeInfo = languagesDict.get(languageCode);
|
||||
if (localeInfo == null) {
|
||||
localeInfo = new LocaleInfo();
|
||||
localeInfo.name = languageName;
|
||||
localeInfo.nameEnglish = languageNameInEnglish;
|
||||
localeInfo.shortName = languageCode;
|
||||
|
||||
localeInfo.pathToFile = finalFile.getAbsolutePath();
|
||||
sortedLanguages.add(localeInfo);
|
||||
languagesDict.put(localeInfo.shortName, localeInfo);
|
||||
otherLanguages.add(localeInfo);
|
||||
|
||||
Collections.sort(sortedLanguages, new Comparator<LocaleInfo>() {
|
||||
@Override
|
||||
public int compare(LocaleController.LocaleInfo o, LocaleController.LocaleInfo o2) {
|
||||
if (o.shortName == null) {
|
||||
return -1;
|
||||
} else if (o2.shortName == null) {
|
||||
return 1;
|
||||
}
|
||||
return o.name.compareTo(o2.name);
|
||||
}
|
||||
});
|
||||
saveOtherLanguages();
|
||||
}
|
||||
localeValues = stringMap;
|
||||
applyLanguage(localeInfo, true, true);
|
||||
return true;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
FileLog.e("tmessages", e);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private void saveOtherLanguages() {
|
||||
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("langconfig", Activity.MODE_PRIVATE);
|
||||
SharedPreferences.Editor editor = preferences.edit();
|
||||
String locales = "";
|
||||
for (LocaleInfo localeInfo : otherLanguages) {
|
||||
String loc = localeInfo.getSaveString();
|
||||
if (loc != null) {
|
||||
if (locales.length() != 0) {
|
||||
locales += "&";
|
||||
}
|
||||
locales += loc;
|
||||
}
|
||||
}
|
||||
editor.putString("locales", locales);
|
||||
editor.commit();
|
||||
}
|
||||
|
||||
public boolean deleteLanguage(LocaleInfo localeInfo) {
|
||||
if (localeInfo.pathToFile == null) {
|
||||
return false;
|
||||
}
|
||||
if (currentLocaleInfo == localeInfo) {
|
||||
applyLanguage(defaultLocalInfo, true);
|
||||
}
|
||||
|
||||
otherLanguages.remove(localeInfo);
|
||||
sortedLanguages.remove(localeInfo);
|
||||
languagesDict.remove(localeInfo.shortName);
|
||||
File file = new File(localeInfo.pathToFile);
|
||||
file.delete();
|
||||
saveOtherLanguages();
|
||||
return true;
|
||||
}
|
||||
|
||||
private void loadOtherLanguages() {
|
||||
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("langconfig", Activity.MODE_PRIVATE);
|
||||
String locales = preferences.getString("locales", null);
|
||||
if (locales == null || locales.length() == 0) {
|
||||
return;
|
||||
}
|
||||
String[] localesArr = locales.split("&");
|
||||
for (String locale : localesArr) {
|
||||
LocaleInfo localeInfo = LocaleInfo.createWithString(locale);
|
||||
if (localeInfo != null) {
|
||||
otherLanguages.add(localeInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private HashMap<String, String> getLocaleFileStrings(File file) {
|
||||
try {
|
||||
HashMap<String, String> stringMap = new HashMap<String, String>();
|
||||
XmlPullParser parser = Xml.newPullParser();
|
||||
@ -192,44 +333,18 @@ public class LocaleController {
|
||||
}
|
||||
eventType = parser.next();
|
||||
}
|
||||
|
||||
String languageName = stringMap.get("LanguageName");
|
||||
String languageNameInEnglish = stringMap.get("LanguageNameInEnglish");
|
||||
String languageCode = stringMap.get("LanguageCode");
|
||||
|
||||
if (languageName != null && languageName.length() > 0 &&
|
||||
languageNameInEnglish != null && languageNameInEnglish.length() > 0 &&
|
||||
languageCode != null && languageCode.length() > 0) {
|
||||
LocaleInfo localeInfo = new LocaleInfo();
|
||||
localeInfo.name = languageName;
|
||||
localeInfo.nameEnglish = languageNameInEnglish;
|
||||
localeInfo.shortName = languageCode;
|
||||
localeInfo.embededLang = false;
|
||||
sortedLanguages.add(localeInfo);
|
||||
languagesDict.put(localeInfo.shortName, localeInfo);
|
||||
|
||||
Collections.sort(sortedLanguages, new Comparator<LocaleInfo>() {
|
||||
@Override
|
||||
public int compare(LocaleController.LocaleInfo o, LocaleController.LocaleInfo o2) {
|
||||
if (o.shortName == null) {
|
||||
return -1;
|
||||
} else if (o2.shortName == null) {
|
||||
return 1;
|
||||
}
|
||||
return o.name.compareTo(o2.name);
|
||||
}
|
||||
});
|
||||
applyLanguage(localeInfo, true);
|
||||
localeValues = stringMap;
|
||||
return true;
|
||||
}
|
||||
return stringMap;
|
||||
} catch (Exception e) {
|
||||
FileLog.e("tmessages", e);
|
||||
}
|
||||
return false;
|
||||
return null;
|
||||
}
|
||||
|
||||
public void applyLanguage(LocaleInfo localeInfo, boolean override) {
|
||||
applyLanguage(localeInfo, override, false);
|
||||
}
|
||||
|
||||
public void applyLanguage(LocaleInfo localeInfo, boolean override, boolean fromFile) {
|
||||
if (localeInfo == null) {
|
||||
return;
|
||||
}
|
||||
@ -256,8 +371,10 @@ public class LocaleController {
|
||||
editor.commit();
|
||||
}
|
||||
if (newLocale != null) {
|
||||
if (localeInfo.embededLang) {
|
||||
if (localeInfo.pathToFile == null) {
|
||||
localeValues.clear();
|
||||
} else if (!fromFile) {
|
||||
localeValues = getLocaleFileStrings(new File(localeInfo.pathToFile));
|
||||
}
|
||||
currentLocale = newLocale;
|
||||
currentLocaleInfo = localeInfo;
|
||||
|
@ -131,7 +131,7 @@ public class ChatMessageCell extends ChatBaseCell {
|
||||
}
|
||||
pressedLink = null;
|
||||
int maxWidth;
|
||||
if (isChat) {
|
||||
if (isChat && !messageObject.messageOwner.out) {
|
||||
maxWidth = Utilities.displaySize.x - Utilities.dp(122);
|
||||
drawName = true;
|
||||
} else {
|
||||
|
@ -46,6 +46,7 @@ import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.SubMenu;
|
||||
import android.view.Surface;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@ -197,6 +198,18 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa
|
||||
|
||||
private CharSequence lastPrintString;
|
||||
|
||||
private final static int copy = 1;
|
||||
private final static int forward = 2;
|
||||
private final static int delete = 3;
|
||||
private final static int chat_enc_timer = 4;
|
||||
private final static int chat_menu_attach = 5;
|
||||
private final static int attach_photo = 6;
|
||||
private final static int attach_gallery = 7;
|
||||
private final static int attach_video = 8;
|
||||
private final static int attach_document = 9;
|
||||
private final static int attach_location = 10;
|
||||
private final static int chat_menu_avatar = 11;
|
||||
|
||||
ActionMode mActionMode = null;
|
||||
private ActionMode.Callback mActionModeCallback = new ActionMode.Callback() {
|
||||
@Override
|
||||
@ -204,11 +217,14 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa
|
||||
menu.clear();
|
||||
MenuInflater inflater = actionMode.getMenuInflater();
|
||||
if (currentEncryptedChat == null) {
|
||||
inflater.inflate(R.menu.messages_full_menu, menu);
|
||||
menu.add(Menu.NONE, copy, Menu.NONE, LocaleController.getString("Copy", R.string.Copy)).setIcon(R.drawable.ic_ab_fwd_copy);
|
||||
menu.add(Menu.NONE, forward, Menu.NONE, LocaleController.getString("Forward", R.string.Forward)).setIcon(R.drawable.ic_ab_fwd_forward);
|
||||
menu.add(Menu.NONE, delete, Menu.NONE, LocaleController.getString("Delete", R.string.Delete)).setIcon(R.drawable.ic_ab_fwd_delete);
|
||||
} else {
|
||||
inflater.inflate(R.menu.messages_encrypted_menu, menu);
|
||||
menu.add(Menu.NONE, copy, Menu.NONE, LocaleController.getString("Copy", R.string.Copy)).setIcon(R.drawable.ic_ab_fwd_copy);
|
||||
menu.add(Menu.NONE, delete, Menu.NONE, LocaleController.getString("Delete", R.string.Delete)).setIcon(R.drawable.ic_ab_fwd_delete);
|
||||
}
|
||||
menu.findItem(R.id.copy).setVisible(selectedMessagesCanCopyIds.size() != 0);
|
||||
menu.findItem(copy).setVisible(selectedMessagesCanCopyIds.size() != 0);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -220,7 +236,7 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa
|
||||
@Override
|
||||
public boolean onActionItemClicked(ActionMode actionMode, MenuItem menuItem) {
|
||||
switch (menuItem.getItemId()) {
|
||||
case R.id.copy: {
|
||||
case copy: {
|
||||
String str = "";
|
||||
ArrayList<Integer> ids = new ArrayList<Integer>(selectedMessagesCanCopyIds.keySet());
|
||||
if (currentEncryptedChat == null) {
|
||||
@ -247,7 +263,7 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa
|
||||
}
|
||||
break;
|
||||
}
|
||||
case R.id.delete: {
|
||||
case delete: {
|
||||
ArrayList<Integer> ids = new ArrayList<Integer>(selectedMessagesIds.keySet());
|
||||
ArrayList<Long> random_ids = null;
|
||||
if (currentEncryptedChat != null) {
|
||||
@ -262,7 +278,7 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa
|
||||
MessagesController.getInstance().deleteMessages(ids, random_ids, currentEncryptedChat);
|
||||
break;
|
||||
}
|
||||
case R.id.forward: {
|
||||
case forward: {
|
||||
MessagesActivity fragment = new MessagesActivity();
|
||||
fragment.selectAlertString = R.string.ForwardMessagesTo;
|
||||
fragment.selectAlertStringDesc = "ForwardMessagesTo";
|
||||
@ -1250,7 +1266,7 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa
|
||||
if (messageObject.messageOwner.media instanceof TLRPC.TL_messageMediaDocument) {
|
||||
String mime = messageObject.messageOwner.media.document.mime_type;
|
||||
if (mime != null && mime.equals("text/xml")) {
|
||||
return 4;
|
||||
return 5;
|
||||
}
|
||||
}
|
||||
return 4;
|
||||
@ -1294,7 +1310,7 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa
|
||||
if (messageObject.messageOwner.media instanceof TLRPC.TL_messageMediaDocument) {
|
||||
String mime = messageObject.messageOwner.media.document.mime_type;
|
||||
if (mime != null && mime.equals("text/xml")) {
|
||||
return 4;
|
||||
return 5;
|
||||
}
|
||||
}
|
||||
//return 4;
|
||||
@ -1321,7 +1337,7 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa
|
||||
}
|
||||
}
|
||||
if (mActionMode != null && mActionMode.getMenu() != null) {
|
||||
mActionMode.getMenu().findItem(R.id.copy).setVisible(selectedMessagesCanCopyIds.size() != 0);
|
||||
mActionMode.getMenu().findItem(copy).setVisible(selectedMessagesCanCopyIds.size() != 0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2745,16 +2761,32 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa
|
||||
@Override
|
||||
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
||||
menu.clear();
|
||||
|
||||
SupportMenuItem timeItem = null;
|
||||
|
||||
if (currentEncryptedChat != null) {
|
||||
inflater.inflate(R.menu.chat_enc_menu, menu);
|
||||
} else {
|
||||
inflater.inflate(R.menu.chat_menu, menu);
|
||||
timeItem = (SupportMenuItem)menu.add(Menu.NONE, chat_enc_timer, Menu.NONE, null);
|
||||
timeItem.setShowAsAction(SupportMenuItem.SHOW_AS_ACTION_ALWAYS);
|
||||
timeItem.setActionView(R.layout.chat_header_enc_layout);
|
||||
}
|
||||
SupportMenuItem timeItem = (SupportMenuItem)menu.findItem(R.id.chat_enc_timer);
|
||||
|
||||
SubMenu subMenu = menu.addSubMenu(Menu.NONE, chat_menu_attach, Menu.NONE, LocaleController.getString("Attach", R.string.Attach)).setIcon(R.drawable.ic_ab_attach);
|
||||
SupportMenuItem menuItem = (SupportMenuItem)subMenu.getItem();
|
||||
menuItem.setShowAsAction(SupportMenuItem.SHOW_AS_ACTION_ALWAYS);
|
||||
|
||||
subMenu.add(Menu.NONE, attach_photo, Menu.NONE, LocaleController.getString("ChatTakePhoto", R.string.ChatTakePhoto)).setIcon(R.drawable.ic_attach_photo);
|
||||
subMenu.add(Menu.NONE, attach_gallery, Menu.NONE, LocaleController.getString("ChatGallery", R.string.ChatGallery)).setIcon(R.drawable.ic_attach_gallery);
|
||||
subMenu.add(Menu.NONE, attach_video, Menu.NONE, LocaleController.getString("ChatVideo", R.string.ChatVideo)).setIcon(R.drawable.ic_attach_video);
|
||||
subMenu.add(Menu.NONE, attach_document, Menu.NONE, LocaleController.getString("ChatDocument", R.string.ChatDocument)).setIcon(R.drawable.ic_ab_doc);
|
||||
subMenu.add(Menu.NONE, attach_location, Menu.NONE, LocaleController.getString("ChatLocation", R.string.ChatLocation)).setIcon(R.drawable.ic_attach_location);
|
||||
|
||||
SupportMenuItem avatarItem = (SupportMenuItem)menu.add(Menu.NONE, chat_menu_avatar, Menu.NONE, null);
|
||||
avatarItem.setShowAsAction(SupportMenuItem.SHOW_AS_ACTION_ALWAYS);
|
||||
avatarItem.setActionView(R.layout.chat_header_layout);
|
||||
|
||||
if (currentEncryptedChat != null && !(currentEncryptedChat instanceof TLRPC.TL_encryptedChat) || currentChat != null && (currentChat instanceof TLRPC.TL_chatForbidden || currentChat.left)) {
|
||||
SupportMenuItem item = (SupportMenuItem)menu.findItem(R.id.chat_menu_attach);
|
||||
if (item != null) {
|
||||
item.setVisible(false);
|
||||
if (menuItem != null) {
|
||||
menuItem.setVisible(false);
|
||||
}
|
||||
|
||||
if (timeItem != null) {
|
||||
@ -2810,7 +2842,6 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa
|
||||
timerButton.setTime(currentEncryptedChat.ttl);
|
||||
}
|
||||
|
||||
SupportMenuItem avatarItem = (SupportMenuItem)menu.findItem(R.id.chat_menu_avatar);
|
||||
View avatarLayout = avatarItem.getActionView();
|
||||
avatarImageView = (BackupImageView)avatarLayout.findViewById(R.id.chat_avatar_image);
|
||||
|
||||
@ -3040,6 +3071,20 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa
|
||||
if (locFile != null) {
|
||||
if (LocaleController.getInstance().applyLanguageFile(locFile)) {
|
||||
((LaunchActivity)parentActivity).presentFragment(new LanguageSelectActivity(), "settings_lang", false);
|
||||
} else if (parentActivity != null) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(parentActivity);
|
||||
builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
|
||||
builder.setMessage(LocaleController.getString("IncorrectLocalization", R.string.IncorrectLocalization));
|
||||
builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), null);
|
||||
visibleDialog = builder.show();
|
||||
visibleDialog.setCanceledOnTouchOutside(true);
|
||||
|
||||
visibleDialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
|
||||
@Override
|
||||
public void onDismiss(DialogInterface dialog) {
|
||||
visibleDialog = null;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3047,7 +3092,7 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa
|
||||
}
|
||||
});
|
||||
|
||||
builder.setTitle(R.string.Message);
|
||||
builder.setTitle(LocaleController.getString("Message", R.string.Message));
|
||||
visibleDialog = builder.show();
|
||||
visibleDialog.setCanceledOnTouchOutside(true);
|
||||
|
||||
@ -3290,7 +3335,7 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa
|
||||
case android.R.id.home:
|
||||
finishFragment();
|
||||
break;
|
||||
case R.id.attach_photo: {
|
||||
case attach_photo: {
|
||||
try {
|
||||
Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
|
||||
File image = Utilities.generatePicturePath();
|
||||
@ -3304,7 +3349,7 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa
|
||||
}
|
||||
break;
|
||||
}
|
||||
case R.id.attach_gallery: {
|
||||
case attach_gallery: {
|
||||
try {
|
||||
Intent photoPickerIntent = new Intent(Intent.ACTION_PICK);
|
||||
photoPickerIntent.setType("image/*");
|
||||
@ -3314,7 +3359,7 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa
|
||||
}
|
||||
break;
|
||||
}
|
||||
case R.id.attach_video: {
|
||||
case attach_video: {
|
||||
try {
|
||||
Intent pickIntent = new Intent();
|
||||
pickIntent.setType("video/*");
|
||||
@ -3338,7 +3383,7 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa
|
||||
}
|
||||
break;
|
||||
}
|
||||
case R.id.attach_location: {
|
||||
case attach_location: {
|
||||
if (!isGoogleMapsInstalled()) {
|
||||
return true;
|
||||
}
|
||||
@ -3346,7 +3391,7 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa
|
||||
((LaunchActivity)parentActivity).presentFragment(fragment, "location", false);
|
||||
break;
|
||||
}
|
||||
case R.id.attach_document: {
|
||||
case attach_document: {
|
||||
DocumentSelectActivity fragment = new DocumentSelectActivity();
|
||||
fragment.delegate = this;
|
||||
((LaunchActivity)parentActivity).presentFragment(fragment, "document", false);
|
||||
@ -4404,7 +4449,7 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa
|
||||
|
||||
private void alertUserOpenError() {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(parentActivity);
|
||||
builder.setTitle(R.string.AppName);
|
||||
builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
|
||||
builder.setPositiveButton(R.string.OK, null);
|
||||
if (message.type == 6 || message.type == 7) {
|
||||
builder.setMessage(R.string.NoPlayerInstalled);
|
||||
|
@ -22,6 +22,7 @@ import android.os.Bundle;
|
||||
import android.provider.Settings;
|
||||
import android.support.v4.internal.view.SupportMenuItem;
|
||||
import android.support.v7.app.ActionBar;
|
||||
import android.support.v7.widget.SearchView;
|
||||
import android.text.Html;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
@ -483,16 +484,21 @@ public class ChatProfileActivity extends BaseFragment implements NotificationCen
|
||||
|
||||
@Override
|
||||
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
||||
inflater.inflate(R.menu.group_profile_menu, menu);
|
||||
SupportMenuItem doneItem = (SupportMenuItem)menu.findItem(R.id.block_user);
|
||||
TextView doneTextView = (TextView)doneItem.getActionView().findViewById(R.id.done_button);
|
||||
doneTextView.setText(LocaleController.getString("AddMember", R.string.AddMember));
|
||||
doneTextView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
openAddMenu();
|
||||
}
|
||||
});
|
||||
SupportMenuItem item = (SupportMenuItem)menu.add(Menu.NONE, 0, Menu.NONE, LocaleController.getString("AddMember", R.string.AddMember));
|
||||
item.setShowAsAction(SupportMenuItem.SHOW_AS_ACTION_ALWAYS);
|
||||
LayoutInflater li = (LayoutInflater)ApplicationLoader.applicationContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||
item.setActionView(R.layout.group_profile_add_member_layout);
|
||||
|
||||
TextView textView = (TextView)item.getActionView().findViewById(R.id.done_button);
|
||||
if (textView != null) {
|
||||
textView.setText(LocaleController.getString("AddMember", R.string.AddMember));
|
||||
textView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
openAddMenu();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private class ListAdapter extends BaseAdapter {
|
||||
|
@ -306,7 +306,7 @@ public class ContactsActivity extends BaseFragment implements NotificationCenter
|
||||
private void didSelectResult(final TLRPC.User user, boolean useAlert) {
|
||||
if (useAlert && selectAlertString != 0) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(parentActivity);
|
||||
builder.setTitle(R.string.AppName);
|
||||
builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
|
||||
builder.setMessage(LocaleController.formatString(selectAlertStringDesc, selectAlertString, Utilities.formatName(user.first_name, user.last_name)));
|
||||
builder.setPositiveButton(R.string.OK, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
@ -400,9 +400,9 @@ public class ContactsActivity extends BaseFragment implements NotificationCenter
|
||||
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
||||
super.onCreateOptionsMenu(menu, inflater);
|
||||
|
||||
inflater.inflate(R.menu.contacts_menu, menu);
|
||||
searchItem = (SupportMenuItem)menu.findItem(R.id.messages_list_menu_search);
|
||||
searchView = (SearchView)searchItem.getActionView();
|
||||
searchItem = (SupportMenuItem)menu.add(Menu.NONE, 0, Menu.NONE, LocaleController.getString("Search", R.string.Search)).setIcon(R.drawable.ic_ab_search);
|
||||
searchItem.setShowAsAction(SupportMenuItem.SHOW_AS_ACTION_ALWAYS|SupportMenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW);
|
||||
searchItem.setActionView(searchView = new SearchView(parentActivity));
|
||||
|
||||
TextView textView = (TextView) searchView.findViewById(R.id.search_src_text);
|
||||
if (textView != null) {
|
||||
|
@ -19,7 +19,6 @@ import android.support.v7.app.ActionBarActivity;
|
||||
import android.support.v7.widget.SearchView;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@ -191,11 +190,9 @@ public class CountrySelectActivity extends ActionBarActivity {
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
MenuInflater inflater = getMenuInflater();
|
||||
|
||||
inflater.inflate(R.menu.contacts_menu, menu);
|
||||
searchItem = (SupportMenuItem)menu.findItem(R.id.messages_list_menu_search);
|
||||
searchView = (SearchView)searchItem.getActionView();
|
||||
searchItem = (SupportMenuItem)menu.add(Menu.NONE, 0, Menu.NONE, LocaleController.getString("Search", R.string.Search)).setIcon(R.drawable.ic_ab_search);
|
||||
searchItem.setShowAsAction(SupportMenuItem.SHOW_AS_ACTION_ALWAYS|SupportMenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW);
|
||||
searchItem.setActionView(searchView = new SearchView(this));
|
||||
|
||||
TextView textView = (TextView) searchView.findViewById(R.id.search_src_text);
|
||||
if (textView != null) {
|
||||
|
@ -345,7 +345,7 @@ public class DocumentSelectActivity extends BaseFragment {
|
||||
|
||||
private void showErrorBox(String error){
|
||||
new AlertDialog.Builder(parentActivity)
|
||||
.setTitle(R.string.AppName)
|
||||
.setTitle(LocaleController.getString("AppName", R.string.AppName))
|
||||
.setMessage(error)
|
||||
.setPositiveButton(R.string.OK, null)
|
||||
.show();
|
||||
|
@ -18,7 +18,6 @@ import android.support.v4.view.ViewPager;
|
||||
import android.support.v7.app.ActionBar;
|
||||
import android.view.Display;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@ -82,6 +81,9 @@ public class GalleryImageViewer extends AbstractGalleryActivity implements Notif
|
||||
|
||||
public static int needShowAllMedia = 2000;
|
||||
|
||||
private final static int gallery_menu_save = 1;
|
||||
private final static int gallery_menu_showall = 2;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
@ -640,11 +642,9 @@ public class GalleryImageViewer extends AbstractGalleryActivity implements Notif
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
MenuInflater inflater = getMenuInflater();
|
||||
if (withoutBottom) {
|
||||
inflater.inflate(R.menu.gallery_save_only_menu, menu);
|
||||
} else {
|
||||
inflater.inflate(R.menu.gallery_menu, menu);
|
||||
menu.add(Menu.NONE, gallery_menu_save, Menu.NONE, LocaleController.getString("SaveToGallery", R.string.SaveToGallery));
|
||||
if (!withoutBottom) {
|
||||
menu.add(Menu.NONE, gallery_menu_showall, Menu.NONE, LocaleController.getString("ShowAllMedia", R.string.ShowAllMedia));
|
||||
}
|
||||
return super.onCreateOptionsMenu(menu);
|
||||
}
|
||||
@ -721,7 +721,7 @@ public class GalleryImageViewer extends AbstractGalleryActivity implements Notif
|
||||
finish();
|
||||
System.gc();
|
||||
break;
|
||||
case R.id.gallery_menu_save:
|
||||
case gallery_menu_save:
|
||||
if (currentFileName == null) {
|
||||
return;
|
||||
}
|
||||
@ -737,7 +737,7 @@ public class GalleryImageViewer extends AbstractGalleryActivity implements Notif
|
||||
// startActivityForResult(intent, 10);
|
||||
// break;
|
||||
// }
|
||||
case R.id.gallery_menu_showall: {
|
||||
case gallery_menu_showall: {
|
||||
if (fromAll) {
|
||||
finish();
|
||||
} else {
|
||||
|
@ -421,8 +421,10 @@ public class GroupCreateActivity extends BaseFragment implements NotificationCen
|
||||
|
||||
@Override
|
||||
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
||||
inflater.inflate(R.menu.group_create_menu, menu);
|
||||
SupportMenuItem doneItem = (SupportMenuItem)menu.findItem(R.id.done_menu_item);
|
||||
SupportMenuItem doneItem = (SupportMenuItem)menu.add(Menu.NONE, 0, Menu.NONE, null);
|
||||
doneItem.setShowAsAction(SupportMenuItem.SHOW_AS_ACTION_ALWAYS);
|
||||
doneItem.setActionView(R.layout.group_create_done_layout);
|
||||
|
||||
TextView doneTextView = (TextView)doneItem.getActionView().findViewById(R.id.done_button);
|
||||
doneTextView.setText(LocaleController.getString("Next", R.string.Next));
|
||||
doneTextView.setOnClickListener(new View.OnClickListener() {
|
||||
|
@ -274,8 +274,10 @@ public class GroupCreateFinalActivity extends BaseFragment implements Notificati
|
||||
|
||||
@Override
|
||||
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
||||
inflater.inflate(R.menu.group_create_menu, menu);
|
||||
SupportMenuItem doneItem = (SupportMenuItem)menu.findItem(R.id.done_menu_item);
|
||||
SupportMenuItem doneItem = (SupportMenuItem)menu.add(Menu.NONE, 0, Menu.NONE, null);
|
||||
doneItem.setShowAsAction(SupportMenuItem.SHOW_AS_ACTION_ALWAYS);
|
||||
doneItem.setActionView(R.layout.group_create_done_layout);
|
||||
|
||||
TextView doneTextView = (TextView)doneItem.getActionView().findViewById(R.id.done_button);
|
||||
doneTextView.setText(LocaleController.getString("Done", R.string.Done));
|
||||
doneTextView.setOnClickListener(new View.OnClickListener() {
|
||||
|
@ -8,7 +8,9 @@
|
||||
|
||||
package org.telegram.ui;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.internal.view.SupportMenuItem;
|
||||
import android.support.v4.view.MenuItemCompat;
|
||||
@ -114,10 +116,62 @@ public class LanguageSelectActivity extends BaseFragment {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (searchItem != null && searchItem.isActionViewExpanded()) {
|
||||
searchItem.collapseActionView();
|
||||
}
|
||||
finishFragment();
|
||||
}
|
||||
});
|
||||
|
||||
listView.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
|
||||
@Override
|
||||
public boolean onItemLongClick(AdapterView<?> adapterView, View view, int i, long l) {
|
||||
if (parentActivity == null) {
|
||||
return false;
|
||||
}
|
||||
LocaleController.LocaleInfo localeInfo = null;
|
||||
if (searching && searchWas) {
|
||||
if (i >= 0 && i < searchResult.size()) {
|
||||
localeInfo = searchResult.get(i);
|
||||
}
|
||||
} else {
|
||||
if (i >= 0 && i < LocaleController.getInstance().sortedLanguages.size()) {
|
||||
localeInfo = LocaleController.getInstance().sortedLanguages.get(i);
|
||||
}
|
||||
}
|
||||
if (localeInfo == null || localeInfo.pathToFile == null) {
|
||||
return false;
|
||||
}
|
||||
final LocaleController.LocaleInfo finalLocaleInfo = localeInfo;
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(parentActivity);
|
||||
builder.setMessage(LocaleController.getString("DeleteLocalization", R.string.DeleteLocalization));
|
||||
builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
|
||||
builder.setPositiveButton(LocaleController.getString("Delete", R.string.Delete), new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
if (LocaleController.getInstance().deleteLanguage(finalLocaleInfo)) {
|
||||
if (searchResult != null) {
|
||||
searchResult.remove(finalLocaleInfo);
|
||||
}
|
||||
if (listAdapter != null) {
|
||||
listAdapter.notifyDataSetChanged();
|
||||
}
|
||||
if (searchListViewAdapter != null) {
|
||||
searchListViewAdapter.notifyDataSetChanged();
|
||||
}
|
||||
applySelfActionBar();
|
||||
if (searchItem != null && searchItem.isActionViewExpanded()) {
|
||||
searchItem.collapseActionView();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
|
||||
builder.show().setCanceledOnTouchOutside(true);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
listView.setOnTouchListener(new OnSwipeTouchListener() {
|
||||
public void onSwipeRight() {
|
||||
finishFragment(true);
|
||||
@ -184,10 +238,8 @@ public class LanguageSelectActivity extends BaseFragment {
|
||||
int itemId = item.getItemId();
|
||||
switch (itemId) {
|
||||
case android.R.id.home:
|
||||
if (searchItem != null) {
|
||||
if (searchItem.isActionViewExpanded()) {
|
||||
searchItem.collapseActionView();
|
||||
}
|
||||
if (searchItem != null && searchItem.isActionViewExpanded()) {
|
||||
searchItem.collapseActionView();
|
||||
}
|
||||
finishFragment();
|
||||
break;
|
||||
@ -197,9 +249,9 @@ public class LanguageSelectActivity extends BaseFragment {
|
||||
|
||||
@Override
|
||||
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
||||
inflater.inflate(R.menu.contacts_menu, menu);
|
||||
searchItem = (SupportMenuItem)menu.findItem(R.id.messages_list_menu_search);
|
||||
searchView = (SearchView)searchItem.getActionView();
|
||||
searchItem = (SupportMenuItem)menu.add(Menu.NONE, 0, Menu.NONE, LocaleController.getString("Search", R.string.Search)).setIcon(R.drawable.ic_ab_search);
|
||||
searchItem.setShowAsAction(SupportMenuItem.SHOW_AS_ACTION_ALWAYS|SupportMenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW);
|
||||
searchItem.setActionView(searchView = new SearchView(parentActivity));
|
||||
|
||||
TextView textView = (TextView) searchView.findViewById(R.id.search_src_text);
|
||||
if (textView != null) {
|
||||
|
@ -10,6 +10,7 @@ package org.telegram.ui;
|
||||
|
||||
import android.location.Location;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.internal.view.SupportMenuItem;
|
||||
import android.support.v7.app.ActionBar;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
@ -53,6 +54,11 @@ public class LocationActivity extends BaseFragment implements NotificationCenter
|
||||
private boolean userLocationMoved = false;
|
||||
private boolean firstWas = false;
|
||||
|
||||
private final static int map_to_my_location = 1;
|
||||
private final static int map_list_menu_map = 2;
|
||||
private final static int map_list_menu_satellite = 3;
|
||||
private final static int map_list_menu_hybrid = 4;
|
||||
|
||||
public SupportMapFragment mapFragment = new SupportMapFragment() {
|
||||
@Override
|
||||
public void onActivityCreated(Bundle savedInstanceState) {
|
||||
@ -261,29 +267,34 @@ public class LocationActivity extends BaseFragment implements NotificationCenter
|
||||
|
||||
@Override
|
||||
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
||||
inflater.inflate(R.menu.location_menu, menu);
|
||||
SupportMenuItem item = (SupportMenuItem)menu.add(Menu.NONE, map_to_my_location, Menu.NONE, LocaleController.getString("MyLocation", R.string.MyLocation)).setIcon(R.drawable.ic_ab_location);
|
||||
item.setShowAsAction(SupportMenuItem.SHOW_AS_ACTION_ALWAYS);
|
||||
|
||||
menu.add(Menu.NONE, map_list_menu_map, Menu.NONE, LocaleController.getString("Map", R.string.Map));
|
||||
menu.add(Menu.NONE, map_list_menu_satellite, Menu.NONE, LocaleController.getString("Satellite", R.string.Satellite));
|
||||
menu.add(Menu.NONE, map_list_menu_hybrid, Menu.NONE, LocaleController.getString("Hybrid", R.string.Hybrid));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
int itemId = item.getItemId();
|
||||
switch (itemId) {
|
||||
case R.id.map_list_menu_map:
|
||||
case map_list_menu_map:
|
||||
if (googleMap != null) {
|
||||
googleMap.setMapType(GoogleMap.MAP_TYPE_NORMAL);
|
||||
}
|
||||
break;
|
||||
case R.id.map_list_menu_satellite:
|
||||
case map_list_menu_satellite:
|
||||
if (googleMap != null) {
|
||||
googleMap.setMapType(GoogleMap.MAP_TYPE_SATELLITE);
|
||||
}
|
||||
break;
|
||||
case R.id.map_list_menu_hybrid:
|
||||
case map_list_menu_hybrid:
|
||||
if (googleMap != null) {
|
||||
googleMap.setMapType(GoogleMap.MAP_TYPE_HYBRID);
|
||||
}
|
||||
break;
|
||||
case R.id.map_to_my_location:
|
||||
case map_to_my_location:
|
||||
if (myLocation != null) {
|
||||
LatLng latLng = new LatLng(myLocation.getLatitude(), myLocation.getLongitude());
|
||||
if (googleMap != null) {
|
||||
|
@ -19,7 +19,6 @@ import android.support.v4.internal.view.SupportMenuItem;
|
||||
import android.support.v7.app.ActionBarActivity;
|
||||
import android.view.Display;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.View;
|
||||
import android.view.animation.AccelerateDecelerateInterpolator;
|
||||
import android.widget.ImageView;
|
||||
@ -113,9 +112,10 @@ public class LoginActivity extends ActionBarActivity implements SlideView.SlideV
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
MenuInflater inflater = getMenuInflater();
|
||||
inflater.inflate(R.menu.group_create_menu, menu);
|
||||
SupportMenuItem doneItem = (SupportMenuItem)menu.findItem(R.id.done_menu_item);
|
||||
SupportMenuItem doneItem = (SupportMenuItem)menu.add(Menu.NONE, 0, Menu.NONE, null);
|
||||
doneItem.setShowAsAction(SupportMenuItem.SHOW_AS_ACTION_ALWAYS);
|
||||
doneItem.setActionView(R.layout.group_create_done_layout);
|
||||
|
||||
TextView doneTextView = (TextView)doneItem.getActionView().findViewById(R.id.done_button);
|
||||
doneTextView.setText(LocaleController.getString("Done", R.string.Done));
|
||||
doneTextView.setOnClickListener(new View.OnClickListener() {
|
||||
|
@ -75,6 +75,12 @@ public class MessagesActivity extends BaseFragment implements NotificationCenter
|
||||
|
||||
public MessagesActivityDelegate delegate;
|
||||
|
||||
private final static int messages_list_menu_new_messages = 1;
|
||||
private final static int messages_list_menu_new_chat = 2;
|
||||
private final static int messages_list_menu_new_secret_chat = 3;
|
||||
private final static int messages_list_menu_contacts = 4;
|
||||
private final static int messages_list_menu_settings = 5;
|
||||
|
||||
public static interface MessagesActivityDelegate {
|
||||
public abstract void didSelectDialog(MessagesActivity fragment, long dialog_id);
|
||||
}
|
||||
@ -434,7 +440,7 @@ public class MessagesActivity extends BaseFragment implements NotificationCenter
|
||||
private void didSelectResult(final long dialog_id, boolean useAlert) {
|
||||
if (useAlert && selectAlertString != 0) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(parentActivity);
|
||||
builder.setTitle(R.string.AppName);
|
||||
builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
|
||||
int lower_part = (int)dialog_id;
|
||||
if (lower_part != 0) {
|
||||
if (lower_part > 0) {
|
||||
@ -535,13 +541,25 @@ public class MessagesActivity extends BaseFragment implements NotificationCenter
|
||||
|
||||
@Override
|
||||
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
||||
if (onlySelect) {
|
||||
inflater.inflate(R.menu.messages_list_select_menu, menu);
|
||||
} else {
|
||||
inflater.inflate(R.menu.messages_list_menu, menu);
|
||||
searchItem = (SupportMenuItem)menu.add(Menu.NONE, 0, Menu.NONE, LocaleController.getString("Search", R.string.Search)).setIcon(R.drawable.ic_ab_search);
|
||||
searchItem.setShowAsAction(SupportMenuItem.SHOW_AS_ACTION_ALWAYS|SupportMenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW);
|
||||
searchItem.setActionView(searchView = new SearchView(parentActivity));
|
||||
if (!onlySelect) {
|
||||
SupportMenuItem item = (SupportMenuItem)menu.add(Menu.NONE, messages_list_menu_new_messages, Menu.NONE, LocaleController.getString("NewMessages", R.string.NewMessages)).setIcon(R.drawable.ic_ab_compose);
|
||||
item.setShowAsAction(SupportMenuItem.SHOW_AS_ACTION_ALWAYS);
|
||||
|
||||
item = (SupportMenuItem)menu.add(Menu.NONE, messages_list_menu_new_chat, Menu.NONE, LocaleController.getString("NewGroup", R.string.NewGroup));
|
||||
item.setShowAsAction(SupportMenuItem.SHOW_AS_ACTION_NEVER);
|
||||
|
||||
item = (SupportMenuItem)menu.add(Menu.NONE, messages_list_menu_new_secret_chat, Menu.NONE, LocaleController.getString("NewSecretChat", R.string.NewSecretChat));
|
||||
item.setShowAsAction(SupportMenuItem.SHOW_AS_ACTION_NEVER);
|
||||
|
||||
item = (SupportMenuItem)menu.add(Menu.NONE, messages_list_menu_contacts, Menu.NONE, LocaleController.getString("Contacts", R.string.Contacts));
|
||||
item.setShowAsAction(SupportMenuItem.SHOW_AS_ACTION_NEVER);
|
||||
|
||||
item = (SupportMenuItem)menu.add(Menu.NONE, messages_list_menu_settings, Menu.NONE, LocaleController.getString("Settings", R.string.Settings));
|
||||
item.setShowAsAction(SupportMenuItem.SHOW_AS_ACTION_NEVER);
|
||||
}
|
||||
searchItem = (SupportMenuItem)menu.findItem(R.id.messages_list_menu_search);
|
||||
searchView = (SearchView) searchItem.getActionView();
|
||||
|
||||
TextView textView = (TextView) searchView.findViewById(R.id.search_src_text);
|
||||
if (textView != null) {
|
||||
@ -634,15 +652,15 @@ public class MessagesActivity extends BaseFragment implements NotificationCenter
|
||||
}
|
||||
switch (itemId) {
|
||||
|
||||
case R.id.messages_list_menu_settings: {
|
||||
case messages_list_menu_settings: {
|
||||
((LaunchActivity)inflaterActivity).presentFragment(new SettingsActivity(), "settings", false);
|
||||
break;
|
||||
}
|
||||
case R.id.messages_list_menu_contacts: {
|
||||
case messages_list_menu_contacts: {
|
||||
((LaunchActivity)inflaterActivity).presentFragment(new ContactsActivity(), "contacts", false);
|
||||
break;
|
||||
}
|
||||
case R.id.messages_list_menu_new_messages: {
|
||||
case messages_list_menu_new_messages: {
|
||||
BaseFragment fragment = new ContactsActivity();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putBoolean("onlyUsers", true);
|
||||
@ -653,7 +671,7 @@ public class MessagesActivity extends BaseFragment implements NotificationCenter
|
||||
((LaunchActivity)inflaterActivity).presentFragment(fragment, "contacts_chat", false);
|
||||
break;
|
||||
}
|
||||
case R.id.messages_list_menu_new_secret_chat: {
|
||||
case messages_list_menu_new_secret_chat: {
|
||||
BaseFragment fragment = new ContactsActivity();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putBoolean("onlyUsers", true);
|
||||
@ -665,7 +683,7 @@ public class MessagesActivity extends BaseFragment implements NotificationCenter
|
||||
((LaunchActivity)inflaterActivity).presentFragment(fragment, "contacts_chat", false);
|
||||
break;
|
||||
}
|
||||
case R.id.messages_list_menu_new_chat: {
|
||||
case messages_list_menu_new_chat: {
|
||||
((LaunchActivity)inflaterActivity).presentFragment(new GroupCreateActivity(), "group_create", false);
|
||||
break;
|
||||
}
|
||||
|
@ -20,6 +20,8 @@ import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.app.ActionBar;
|
||||
import android.support.v7.app.ActionBarActivity;
|
||||
import android.text.Html;
|
||||
import android.text.method.LinkMovementMethod;
|
||||
import android.util.Base64;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MenuItem;
|
||||
@ -88,6 +90,7 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter
|
||||
private int audioDownloadSection;
|
||||
private int audioDownloadChatRow;
|
||||
private int audioDownloadPrivateRow;
|
||||
private int telegramFaqRow;
|
||||
private int languageRow;
|
||||
|
||||
@Override
|
||||
@ -178,6 +181,7 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter
|
||||
clearLogsRow = rowCount++;
|
||||
switchBackendButtonRow = rowCount++;
|
||||
}
|
||||
telegramFaqRow = rowCount++;
|
||||
askQuestionRow = rowCount++;
|
||||
logoutRow = rowCount++;
|
||||
|
||||
@ -241,91 +245,25 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter
|
||||
} else if (i == backgroundRow) {
|
||||
((LaunchActivity)parentActivity).presentFragment(new SettingsWallpapersActivity(), "settings_wallpapers", false);
|
||||
} else if (i == askQuestionRow) {
|
||||
final SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", Activity.MODE_PRIVATE);
|
||||
int uid = preferences.getInt("support_id", 0);
|
||||
TLRPC.User supportUser = null;
|
||||
if (uid != 0) {
|
||||
supportUser = MessagesController.getInstance().users.get(uid);
|
||||
if (supportUser == null) {
|
||||
String userString = preferences.getString("support_user", null);
|
||||
if (userString != null) {
|
||||
try {
|
||||
byte[] datacentersBytes = Base64.decode(userString, Base64.DEFAULT);
|
||||
if (datacentersBytes != null) {
|
||||
SerializedData data = new SerializedData(datacentersBytes);
|
||||
supportUser = (TLRPC.User)TLClassStore.Instance().TLdeserialize(data, data.readInt32());
|
||||
|
||||
}
|
||||
} catch (Exception e) {
|
||||
FileLog.e("tmessages", e);
|
||||
supportUser = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (parentActivity == null) {
|
||||
return;
|
||||
}
|
||||
if (supportUser == null) {
|
||||
if (parentActivity == null) {
|
||||
return;
|
||||
}
|
||||
final ProgressDialog progressDialog = new ProgressDialog(parentActivity);
|
||||
progressDialog.setMessage(parentActivity.getString(R.string.Loading));
|
||||
progressDialog.setCanceledOnTouchOutside(false);
|
||||
progressDialog.setCancelable(false);
|
||||
progressDialog.show();
|
||||
TLRPC.TL_help_getSupport req = new TLRPC.TL_help_getSupport();
|
||||
ConnectionsManager.getInstance().performRpc(req, new RPCRequest.RPCRequestDelegate() {
|
||||
@Override
|
||||
public void run(TLObject response, TLRPC.TL_error error) {
|
||||
if (error == null) {
|
||||
final TextView message = new TextView(parentActivity);
|
||||
message.setText(Html.fromHtml(LocaleController.getString("AskAQuestionInfo", R.string.AskAQuestionInfo)));
|
||||
message.setTextSize(18);
|
||||
message.setPadding(Utilities.dp(8), Utilities.dp(5), Utilities.dp(8), Utilities.dp(6));
|
||||
message.setMovementMethod(LinkMovementMethod.getInstance());
|
||||
|
||||
final TLRPC.TL_help_support res = (TLRPC.TL_help_support)response;
|
||||
Utilities.RunOnUIThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (parentActivity == null) {
|
||||
return;
|
||||
}
|
||||
SharedPreferences.Editor editor = preferences.edit();
|
||||
editor.putInt("support_id", res.user.id);
|
||||
SerializedData data = new SerializedData();
|
||||
res.user.serializeToStream(data);
|
||||
editor.putString("support_user", Base64.encodeToString(data.toByteArray(), Base64.DEFAULT));
|
||||
editor.commit();
|
||||
try {
|
||||
progressDialog.dismiss();
|
||||
} catch (Exception e) {
|
||||
FileLog.e("tmessages", e);
|
||||
}
|
||||
MessagesController.getInstance().users.put(res.user.id, res.user);
|
||||
ChatActivity fragment = new ChatActivity();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putInt("user_id", res.user.id);
|
||||
fragment.setArguments(bundle);
|
||||
((LaunchActivity)parentActivity).presentFragment(fragment, "chat" + Math.random(), false);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
Utilities.RunOnUIThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
progressDialog.dismiss();
|
||||
} catch (Exception e) {
|
||||
FileLog.e("tmessages", e);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}, null, true, RPCRequest.RPCRequestClassGeneric);
|
||||
} else {
|
||||
MessagesController.getInstance().users.putIfAbsent(supportUser.id, supportUser);
|
||||
ChatActivity fragment = new ChatActivity();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putInt("user_id", supportUser.id);
|
||||
fragment.setArguments(bundle);
|
||||
((LaunchActivity)parentActivity).presentFragment(fragment, "chat" + Math.random(), false);
|
||||
}
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(parentActivity);
|
||||
builder.setView(message);
|
||||
builder.setPositiveButton(LocaleController.getString("AskButton", R.string.AskButton), new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
performAskAQuestion();
|
||||
}
|
||||
});
|
||||
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
|
||||
builder.show().setCanceledOnTouchOutside(true);
|
||||
} else if (i == sendLogsRow) {
|
||||
sendLogs();
|
||||
} else if (i == clearLogsRow) {
|
||||
@ -422,11 +360,14 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter
|
||||
});
|
||||
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
|
||||
builder.show().setCanceledOnTouchOutside(true);
|
||||
} else if (i == telegramFaqRow) {
|
||||
try {
|
||||
Intent pickIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(LocaleController.getString("TelegramFaqUrl", R.string.TelegramFaqUrl)));
|
||||
parentActivity.startActivity(pickIntent);
|
||||
} catch (Exception e) {
|
||||
FileLog.e("tmessages", e);
|
||||
}
|
||||
}
|
||||
// else if (i == 6) {
|
||||
// UserConfig.saveIncomingPhotos = !UserConfig.saveIncomingPhotos;
|
||||
// listView.invalidateViews();
|
||||
// }
|
||||
}
|
||||
});
|
||||
|
||||
@ -444,6 +385,94 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter
|
||||
return fragmentView;
|
||||
}
|
||||
|
||||
public void performAskAQuestion() {
|
||||
final SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", Activity.MODE_PRIVATE);
|
||||
int uid = preferences.getInt("support_id", 0);
|
||||
TLRPC.User supportUser = null;
|
||||
if (uid != 0) {
|
||||
supportUser = MessagesController.getInstance().users.get(uid);
|
||||
if (supportUser == null) {
|
||||
String userString = preferences.getString("support_user", null);
|
||||
if (userString != null) {
|
||||
try {
|
||||
byte[] datacentersBytes = Base64.decode(userString, Base64.DEFAULT);
|
||||
if (datacentersBytes != null) {
|
||||
SerializedData data = new SerializedData(datacentersBytes);
|
||||
supportUser = (TLRPC.User)TLClassStore.Instance().TLdeserialize(data, data.readInt32());
|
||||
|
||||
}
|
||||
} catch (Exception e) {
|
||||
FileLog.e("tmessages", e);
|
||||
supportUser = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (supportUser == null) {
|
||||
if (parentActivity == null) {
|
||||
return;
|
||||
}
|
||||
final ProgressDialog progressDialog = new ProgressDialog(parentActivity);
|
||||
progressDialog.setMessage(parentActivity.getString(R.string.Loading));
|
||||
progressDialog.setCanceledOnTouchOutside(false);
|
||||
progressDialog.setCancelable(false);
|
||||
progressDialog.show();
|
||||
TLRPC.TL_help_getSupport req = new TLRPC.TL_help_getSupport();
|
||||
ConnectionsManager.getInstance().performRpc(req, new RPCRequest.RPCRequestDelegate() {
|
||||
@Override
|
||||
public void run(TLObject response, TLRPC.TL_error error) {
|
||||
if (error == null) {
|
||||
|
||||
final TLRPC.TL_help_support res = (TLRPC.TL_help_support)response;
|
||||
Utilities.RunOnUIThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (parentActivity == null) {
|
||||
return;
|
||||
}
|
||||
SharedPreferences.Editor editor = preferences.edit();
|
||||
editor.putInt("support_id", res.user.id);
|
||||
SerializedData data = new SerializedData();
|
||||
res.user.serializeToStream(data);
|
||||
editor.putString("support_user", Base64.encodeToString(data.toByteArray(), Base64.DEFAULT));
|
||||
editor.commit();
|
||||
try {
|
||||
progressDialog.dismiss();
|
||||
} catch (Exception e) {
|
||||
FileLog.e("tmessages", e);
|
||||
}
|
||||
MessagesController.getInstance().users.put(res.user.id, res.user);
|
||||
ChatActivity fragment = new ChatActivity();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putInt("user_id", res.user.id);
|
||||
fragment.setArguments(bundle);
|
||||
((LaunchActivity)parentActivity).presentFragment(fragment, "chat" + Math.random(), false);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
Utilities.RunOnUIThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
progressDialog.dismiss();
|
||||
} catch (Exception e) {
|
||||
FileLog.e("tmessages", e);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}, null, true, RPCRequest.RPCRequestClassGeneric);
|
||||
} else {
|
||||
MessagesController.getInstance().users.putIfAbsent(supportUser.id, supportUser);
|
||||
ChatActivity fragment = new ChatActivity();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putInt("user_id", supportUser.id);
|
||||
fragment.setArguments(bundle);
|
||||
((LaunchActivity)parentActivity).presentFragment(fragment, "chat" + Math.random(), false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityResultFragment(int requestCode, int resultCode, Intent data) {
|
||||
avatarUpdater.onActivityResult(requestCode, resultCode, data);
|
||||
@ -570,7 +599,7 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter
|
||||
return i == textSizeRow || i == enableAnimationsRow || i == blockedRow || i == notificationRow || i == backgroundRow ||
|
||||
i == askQuestionRow || i == sendLogsRow || i == sendByEnterRow || i == terminateSessionsRow || i == photoDownloadPrivateRow ||
|
||||
i == photoDownloadChatRow || i == clearLogsRow || i == audioDownloadChatRow || i == audioDownloadPrivateRow || i == languageRow ||
|
||||
i == switchBackendButtonRow;
|
||||
i == switchBackendButtonRow || i == telegramFaqRow;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -779,6 +808,9 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter
|
||||
} else if (i == switchBackendButtonRow) {
|
||||
textView.setText("Switch Backend");
|
||||
divider.setVisibility(View.VISIBLE);
|
||||
} else if (i == telegramFaqRow) {
|
||||
textView.setText(LocaleController.getString("TelegramFAQ", R.string.TelegramFaq));
|
||||
divider.setVisibility(View.VISIBLE);
|
||||
}
|
||||
} else if (type == 3) {
|
||||
if (view == null) {
|
||||
@ -914,7 +946,7 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter
|
||||
return 5;
|
||||
} else if (i == enableAnimationsRow || i == sendByEnterRow || i == photoDownloadChatRow || i == photoDownloadPrivateRow || i == audioDownloadChatRow || i == audioDownloadPrivateRow) {
|
||||
return 3;
|
||||
} else if (i == numberRow || i == notificationRow || i == blockedRow || i == backgroundRow || i == askQuestionRow || i == sendLogsRow || i == terminateSessionsRow || i == clearLogsRow || i == switchBackendButtonRow) {
|
||||
} else if (i == numberRow || i == notificationRow || i == blockedRow || i == backgroundRow || i == askQuestionRow || i == sendLogsRow || i == terminateSessionsRow || i == clearLogsRow || i == switchBackendButtonRow || i == telegramFaqRow) {
|
||||
return 2;
|
||||
} else if (i == logoutRow) {
|
||||
return 4;
|
||||
|
@ -12,6 +12,7 @@ import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.internal.view.SupportMenuItem;
|
||||
import android.support.v7.app.ActionBar;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
@ -37,7 +38,6 @@ import org.telegram.messenger.Utilities;
|
||||
import org.telegram.ui.Cells.ChatOrUserCell;
|
||||
import org.telegram.ui.Views.BaseFragment;
|
||||
import org.telegram.ui.Views.OnSwipeTouchListener;
|
||||
import org.w3c.dom.Text;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
@ -52,6 +52,8 @@ public class SettingsBlockedUsers extends BaseFragment implements NotificationCe
|
||||
private HashMap<Integer, TLRPC.TL_contactBlocked> blockedContactsDict = new HashMap<Integer, TLRPC.TL_contactBlocked>();
|
||||
private int selectedUserId;
|
||||
|
||||
private final static int block_user = 1;
|
||||
|
||||
@Override
|
||||
public boolean onFragmentCreate() {
|
||||
super.onFragmentCreate();
|
||||
@ -293,7 +295,8 @@ public class SettingsBlockedUsers extends BaseFragment implements NotificationCe
|
||||
}
|
||||
|
||||
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
||||
inflater.inflate(R.menu.settings_block_users_bar_menu, menu);
|
||||
SupportMenuItem item = (SupportMenuItem)menu.add(Menu.NONE, block_user, Menu.NONE, null).setIcon(R.drawable.plus);
|
||||
item.setShowAsAction(SupportMenuItem.SHOW_AS_ACTION_ALWAYS);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -303,7 +306,7 @@ public class SettingsBlockedUsers extends BaseFragment implements NotificationCe
|
||||
case android.R.id.home:
|
||||
finishFragment();
|
||||
break;
|
||||
case R.id.block_user:
|
||||
case block_user:
|
||||
ContactsActivity fragment = new ContactsActivity();
|
||||
fragment.animationType = 1;
|
||||
Bundle bundle = new Bundle();
|
||||
|
@ -66,6 +66,12 @@ public class UserProfileActivity extends BaseFragment implements NotificationCen
|
||||
private long dialog_id;
|
||||
private TLRPC.EncryptedChat currentEncryptedChat;
|
||||
|
||||
private final static int add_contact = 1;
|
||||
private final static int block_contact = 2;
|
||||
private final static int share_contact = 3;
|
||||
private final static int edit_contact = 4;
|
||||
private final static int delete_contact = 5;
|
||||
|
||||
@Override
|
||||
public boolean onFragmentCreate() {
|
||||
super.onFragmentCreate();
|
||||
@ -426,7 +432,7 @@ public class UserProfileActivity extends BaseFragment implements NotificationCen
|
||||
case android.R.id.home:
|
||||
finishFragment();
|
||||
break;
|
||||
case R.id.block_contact: {
|
||||
case block_contact: {
|
||||
TLRPC.User user = MessagesController.getInstance().users.get(user_id);
|
||||
if (user == null) {
|
||||
break;
|
||||
@ -444,7 +450,7 @@ public class UserProfileActivity extends BaseFragment implements NotificationCen
|
||||
}, null, true, RPCRequest.RPCRequestClassGeneric);
|
||||
break;
|
||||
}
|
||||
case R.id.add_contact: {
|
||||
case add_contact: {
|
||||
TLRPC.User user = MessagesController.getInstance().users.get(user_id);
|
||||
ContactAddActivity fragment = new ContactAddActivity();
|
||||
Bundle args = new Bundle();
|
||||
@ -453,7 +459,7 @@ public class UserProfileActivity extends BaseFragment implements NotificationCen
|
||||
((LaunchActivity)parentActivity).presentFragment(fragment, "add_contact_" + user.id, false);
|
||||
break;
|
||||
}
|
||||
case R.id.share_contact: {
|
||||
case share_contact: {
|
||||
MessagesActivity fragment = new MessagesActivity();
|
||||
Bundle args = new Bundle();
|
||||
args.putBoolean("onlySelect", true);
|
||||
@ -463,7 +469,7 @@ public class UserProfileActivity extends BaseFragment implements NotificationCen
|
||||
((LaunchActivity)parentActivity).presentFragment(fragment, "chat_select", false);
|
||||
break;
|
||||
}
|
||||
case R.id.edit_contact: {
|
||||
case edit_contact: {
|
||||
ContactAddActivity fragment = new ContactAddActivity();
|
||||
Bundle args = new Bundle();
|
||||
args.putInt("user_id", user_id);
|
||||
@ -471,7 +477,7 @@ public class UserProfileActivity extends BaseFragment implements NotificationCen
|
||||
((LaunchActivity)parentActivity).presentFragment(fragment, "add_contact_" + user_id, false);
|
||||
break;
|
||||
}
|
||||
case R.id.delete_contact: {
|
||||
case delete_contact: {
|
||||
final TLRPC.User user = MessagesController.getInstance().users.get(user_id);
|
||||
if (user == null) {
|
||||
break;
|
||||
@ -503,12 +509,16 @@ public class UserProfileActivity extends BaseFragment implements NotificationCen
|
||||
return;
|
||||
}
|
||||
if (user.phone != null && user.phone.length() != 0) {
|
||||
inflater.inflate(R.menu.user_profile_menu, menu);
|
||||
menu.add(Menu.NONE, add_contact, Menu.NONE, LocaleController.getString("AddContact", R.string.AddContact));
|
||||
menu.add(Menu.NONE, block_contact, Menu.NONE, LocaleController.getString("BlockContact", R.string.BlockContact));
|
||||
} else {
|
||||
inflater.inflate(R.menu.user_profile_block_menu, menu);
|
||||
menu.add(Menu.NONE, block_contact, Menu.NONE, LocaleController.getString("BlockContact", R.string.BlockContact));
|
||||
}
|
||||
} else {
|
||||
inflater.inflate(R.menu.user_profile_contact_menu, menu);
|
||||
menu.add(Menu.NONE, share_contact, Menu.NONE, LocaleController.getString("ShareContact", R.string.ShareContact));
|
||||
menu.add(Menu.NONE, block_contact, Menu.NONE, LocaleController.getString("BlockContact", R.string.BlockContact));
|
||||
menu.add(Menu.NONE, block_contact, Menu.NONE, LocaleController.getString("EditContact", R.string.EditContact));
|
||||
menu.add(Menu.NONE, block_contact, Menu.NONE, LocaleController.getString("DeleteContact", R.string.DeleteContact));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,50 +0,0 @@
|
||||
<menu
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:sabd="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<item
|
||||
android:id="@+id/chat_enc_timer"
|
||||
sabd:showAsAction="always"
|
||||
sabd:actionLayout="@layout/chat_header_enc_layout"/>
|
||||
|
||||
<item
|
||||
android:id="@+id/chat_menu_attach"
|
||||
android:icon="@drawable/ic_ab_attach"
|
||||
android:title="@string/Attach"
|
||||
sabd:showAsAction="always">
|
||||
|
||||
<menu>
|
||||
<item
|
||||
android:icon="@drawable/ic_attach_photo"
|
||||
android:title="@string/ChatTakePhoto"
|
||||
android:id="@+id/attach_photo"/>
|
||||
|
||||
<item
|
||||
android:icon="@drawable/ic_attach_gallery"
|
||||
android:title="@string/ChatGallery"
|
||||
android:id="@+id/attach_gallery"/>
|
||||
|
||||
<item
|
||||
android:icon="@drawable/ic_attach_video"
|
||||
android:title="@string/ChatVideo"
|
||||
android:id="@+id/attach_video"/>
|
||||
|
||||
<item
|
||||
android:icon="@drawable/ic_ab_doc"
|
||||
android:title="@string/ChatDocument"
|
||||
android:id="@+id/attach_document"/>
|
||||
|
||||
<item
|
||||
android:icon="@drawable/ic_attach_location"
|
||||
android:title="@string/ChatLocation"
|
||||
android:id="@+id/attach_location"/>
|
||||
</menu>
|
||||
|
||||
</item>
|
||||
|
||||
<item
|
||||
android:id="@+id/chat_menu_avatar"
|
||||
sabd:showAsAction="always"
|
||||
sabd:actionLayout="@layout/chat_header_layout"/>
|
||||
|
||||
</menu>
|
@ -1,45 +0,0 @@
|
||||
<menu
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:sabd="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<item
|
||||
android:id="@+id/chat_menu_attach"
|
||||
android:icon="@drawable/ic_ab_attach"
|
||||
android:title="@string/Attach"
|
||||
sabd:showAsAction="always">
|
||||
|
||||
<menu>
|
||||
<item
|
||||
android:icon="@drawable/ic_attach_photo"
|
||||
android:title="@string/ChatTakePhoto"
|
||||
android:id="@+id/attach_photo"/>
|
||||
|
||||
<item
|
||||
android:icon="@drawable/ic_attach_gallery"
|
||||
android:title="@string/ChatGallery"
|
||||
android:id="@+id/attach_gallery"/>
|
||||
|
||||
<item
|
||||
android:icon="@drawable/ic_attach_video"
|
||||
android:title="@string/ChatVideo"
|
||||
android:id="@+id/attach_video"/>
|
||||
|
||||
<item
|
||||
android:icon="@drawable/ic_ab_doc"
|
||||
android:title="@string/ChatDocument"
|
||||
android:id="@+id/attach_document"/>
|
||||
|
||||
<item
|
||||
android:icon="@drawable/ic_attach_location"
|
||||
android:title="@string/ChatLocation"
|
||||
android:id="@+id/attach_location"/>
|
||||
</menu>
|
||||
|
||||
</item>
|
||||
|
||||
<item
|
||||
android:id="@+id/chat_menu_avatar"
|
||||
sabd:showAsAction="always"
|
||||
sabd:actionLayout="@layout/chat_header_layout"/>
|
||||
|
||||
</menu>
|
@ -1,12 +0,0 @@
|
||||
<menu
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:sabd="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<item
|
||||
android:id="@+id/messages_list_menu_search"
|
||||
android:icon="@drawable/ic_ab_search"
|
||||
android:title="@string/Search"
|
||||
sabd:showAsAction="always|collapseActionView"
|
||||
sabd:actionViewClass="android.support.v7.widget.SearchView"/>
|
||||
|
||||
</menu>
|
@ -1,14 +0,0 @@
|
||||
<menu
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<!--<item android:id="@+id/gallery_menu_send"-->
|
||||
<!--android:title="@string/Send"/>-->
|
||||
|
||||
<item
|
||||
android:id="@+id/gallery_menu_save"
|
||||
android:title="@string/SaveToGallery"/>
|
||||
|
||||
<item
|
||||
android:id="@+id/gallery_menu_showall"
|
||||
android:title="@string/ShowAllMedia"/>
|
||||
|
||||
</menu>
|
@ -1,8 +0,0 @@
|
||||
<menu
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item
|
||||
android:id="@+id/gallery_menu_save"
|
||||
android:title="@string/SaveToGallery"/>
|
||||
|
||||
</menu>
|
@ -1,10 +0,0 @@
|
||||
<menu
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:sabd="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<item
|
||||
android:id="@+id/done_menu_item"
|
||||
sabd:showAsAction="always"
|
||||
sabd:actionLayout="@layout/group_create_done_layout"/>
|
||||
|
||||
</menu>
|
@ -1,10 +0,0 @@
|
||||
<menu
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:sabd="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<item
|
||||
android:id="@+id/block_user"
|
||||
sabd:actionLayout="@layout/group_profile_add_member_layout"
|
||||
sabd:showAsAction="always"/>
|
||||
|
||||
</menu>
|
@ -1,23 +0,0 @@
|
||||
<menu
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:sabd="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<item
|
||||
android:id="@+id/map_to_my_location"
|
||||
android:icon="@drawable/ic_ab_location"
|
||||
android:title="@string/MyLocation"
|
||||
sabd:showAsAction="always"/>
|
||||
|
||||
<item
|
||||
android:id="@+id/map_list_menu_map"
|
||||
android:title="@string/Map"/>
|
||||
|
||||
<item
|
||||
android:id="@+id/map_list_menu_satellite"
|
||||
android:title="@string/Satellite"/>
|
||||
|
||||
<item
|
||||
android:id="@+id/map_list_menu_hybrid"
|
||||
android:title="@string/Hybrid"/>
|
||||
|
||||
</menu>
|
@ -1,9 +0,0 @@
|
||||
<menu
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item
|
||||
android:id="@+id/delete"
|
||||
android:icon="@drawable/ic_ab_fwd_delete"
|
||||
android:title="@string/Delete"/>
|
||||
|
||||
</menu>
|
@ -1,14 +0,0 @@
|
||||
<menu
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item
|
||||
android:id="@+id/copy"
|
||||
android:icon="@drawable/ic_ab_fwd_copy"
|
||||
android:title="@string/Copy"/>
|
||||
|
||||
<item
|
||||
android:id="@+id/delete"
|
||||
android:icon="@drawable/ic_ab_fwd_delete"
|
||||
android:title="@string/Delete"/>
|
||||
|
||||
</menu>
|
@ -1,19 +0,0 @@
|
||||
<menu
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item
|
||||
android:id="@+id/copy"
|
||||
android:icon="@drawable/ic_ab_fwd_copy"
|
||||
android:title="@string/Copy"/>
|
||||
|
||||
<item
|
||||
android:id="@+id/forward"
|
||||
android:icon="@drawable/ic_ab_fwd_forward"
|
||||
android:title="@string/Forward"/>
|
||||
|
||||
<item
|
||||
android:id="@+id/delete"
|
||||
android:icon="@drawable/ic_ab_fwd_delete"
|
||||
android:title="@string/Delete"/>
|
||||
|
||||
</menu>
|
@ -1,38 +0,0 @@
|
||||
<menu
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:sabd="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<item
|
||||
android:id="@+id/messages_list_menu_search"
|
||||
android:icon="@drawable/ic_ab_search"
|
||||
android:title="@string/Search"
|
||||
sabd:showAsAction="always|collapseActionView"
|
||||
sabd:actionViewClass="android.support.v7.widget.SearchView"/>
|
||||
|
||||
<item
|
||||
android:id="@+id/messages_list_menu_new_messages"
|
||||
android:icon="@drawable/ic_ab_compose"
|
||||
android:title="@string/NewMessages"
|
||||
sabd:showAsAction="always"/>
|
||||
|
||||
<item
|
||||
android:id="@+id/messages_list_menu_new_chat"
|
||||
android:title="@string/NewGroup"
|
||||
sabd:showAsAction="never"/>
|
||||
|
||||
<item
|
||||
android:id="@+id/messages_list_menu_new_secret_chat"
|
||||
android:title="@string/NewSecretChat"
|
||||
sabd:showAsAction="never"/>
|
||||
|
||||
<item
|
||||
android:id="@+id/messages_list_menu_contacts"
|
||||
android:title="@string/Contacts"
|
||||
sabd:showAsAction="never"/>
|
||||
|
||||
<item
|
||||
android:id="@+id/messages_list_menu_settings"
|
||||
android:title="@string/Settings"
|
||||
sabd:showAsAction="never"/>
|
||||
|
||||
</menu>
|
@ -1,12 +0,0 @@
|
||||
<menu
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:sabd="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<item
|
||||
android:id="@+id/messages_list_menu_search"
|
||||
android:icon="@drawable/ic_ab_search"
|
||||
android:title="@string/Search"
|
||||
sabd:showAsAction="always|collapseActionView"
|
||||
sabd:actionViewClass="android.support.v7.widget.SearchView"/>
|
||||
|
||||
</menu>
|
@ -1,10 +0,0 @@
|
||||
<menu
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:sabd="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<item
|
||||
android:id="@+id/block_user"
|
||||
android:icon="@drawable/plus"
|
||||
sabd:showAsAction="always"/>
|
||||
|
||||
</menu>
|
@ -1,8 +0,0 @@
|
||||
<menu
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item
|
||||
android:id="@+id/block_contact"
|
||||
android:title="@string/BlockContact"/>
|
||||
|
||||
</menu>
|
@ -1,18 +0,0 @@
|
||||
<menu
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item
|
||||
android:id="@+id/share_contact"
|
||||
android:title="@string/ShareContact"/>
|
||||
|
||||
<item
|
||||
android:id="@+id/block_contact"
|
||||
android:title="@string/BlockContact"/>
|
||||
|
||||
<item android:id="@+id/edit_contact"
|
||||
android:title="@string/EditContact"/>
|
||||
|
||||
<item android:id="@+id/delete_contact"
|
||||
android:title="@string/DeleteContact"/>
|
||||
|
||||
</menu>
|
@ -1,12 +0,0 @@
|
||||
<menu
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item
|
||||
android:id="@+id/add_contact"
|
||||
android:title="@string/AddContact"/>
|
||||
|
||||
<item
|
||||
android:id="@+id/block_contact"
|
||||
android:title="@string/BlockContact"/>
|
||||
|
||||
</menu>
|
@ -256,6 +256,12 @@
|
||||
<string name="ContactJoined">اشترك صديق في تيليجرام</string>
|
||||
<string name="Pebble">PEBBLE</string>
|
||||
<string name="Language">اللغة</string>
|
||||
<string name="AskAQuestionInfo">نرجو الأخذ بالعلم أن الدعم الفني في تيليجرام يقوم به مجموعة من المتطوعين. نحاول الرد بسرعة قدر المستطاع، لكن ربما نستغرق القليل من الوقت.<![CDATA[<br><br>]]>يرجى الإطلاع على <![CDATA[<a href="http://telegram.org/faq/ar">صفحة الأسئلة الأكثر شيوعًا</a>]]>: يوجد بها حلول للمشاكل وإجابات لمعظم الأسئلة.</string>
|
||||
<string name="AskButton">اسأل متطوع</string>
|
||||
<string name="TelegramFaq">Telegram FAQ</string>
|
||||
<string name="TelegramFaqUrl">https://telegram.org/faq/ar</string>
|
||||
<string name="DeleteLocalization">Delete localization?</string>
|
||||
<string name="IncorrectLocalization">Incorrect localization file</string>
|
||||
|
||||
<!--media view-->
|
||||
<string name="NoMedia">لا توجد وسائط بعد</string>
|
||||
|
@ -256,6 +256,12 @@
|
||||
<string name="ContactJoined">Kontakt ist Telegram beigetreten</string>
|
||||
<string name="Pebble">PEBBLE</string>
|
||||
<string name="Language">Sprache</string>
|
||||
<string name="AskAQuestionInfo">Please note that Telegram Support is done by volunteers. We try to respond as quickly as possible, but it may take a while.<![CDATA[<br><br>]]>Please take a look at the <![CDATA[<a href="http://telegram.org/faq#general">Telegram FAQ</a>]]>: it has important <![CDATA[<a href="http://telegram.org/faq#troubleshooting">troubleshooting tips</a>]]> and answers to most questions.</string>
|
||||
<string name="AskButton">Ask a volunteer</string>
|
||||
<string name="TelegramFaq">Telegram FAQ</string>
|
||||
<string name="TelegramFaqUrl">https://telegram.org/faq</string>
|
||||
<string name="DeleteLocalization">Delete localization?</string>
|
||||
<string name="IncorrectLocalization">Incorrect localization file</string>
|
||||
|
||||
<!--media view-->
|
||||
<string name="NoMedia">Noch keine geteilten Medien vorhanden</string>
|
||||
|
@ -256,6 +256,12 @@
|
||||
<string name="ContactJoined">Un contacto se unió a Telegram</string>
|
||||
<string name="Pebble">PEBBLE</string>
|
||||
<string name="Language">Idioma</string>
|
||||
<string name="AskAQuestionInfo">Por favor, ten en cuenta que el Soporte de Telegram está hecho por voluntarios. Intentamos responder lo antes posible, pero puede tomar un tiempo.<![CDATA[<br><br>]]>Por favor, echa un vistazo a las <![CDATA[<a href=“http://telegram.org/faq/es”>Preguntas Frecuentes de Telegram</a>]]>: tiene importantes <![CDATA[<a href=“http://telegram.org/faq/es#solucin-de-problemas”>Soluciones a problemas</a>]]> y respuestas para la mayoría de las preguntas.</string>
|
||||
<string name="AskButton">Preguntar</string>
|
||||
<string name="TelegramFaq">Telegram FAQ</string>
|
||||
<string name="TelegramFaqUrl">https://telegram.org/faq/es</string>
|
||||
<string name="DeleteLocalization">¿Eliminar localización?</string>
|
||||
<string name="IncorrectLocalization">Incorrect localization file</string>
|
||||
|
||||
<!--media view-->
|
||||
<string name="NoMedia">No hay fotos ni vídeos compartidos aún</string>
|
||||
|
@ -256,6 +256,12 @@
|
||||
<string name="ContactJoined">Un contatto si è collegato a Telegram</string>
|
||||
<string name="Pebble">PEBBLE</string>
|
||||
<string name="Language">Lingua</string>
|
||||
<string name="AskAQuestionInfo">Nota che il supporto di Telegram è fornito da volontari. Proviamo a rispondere non appena possibile, ma potrebbe richiedere del tempo.<![CDATA[<br><br>]]>Dai un\'occhiata alle <![CDATA[<a href="http://telegram.org/faq#general">Domande frequenti</a>]]>: troverai risposte alla maggior parte delle domande e suggerimenti importanti per <![CDATA[<a href="http://telegram.org/faq#troubleshooting">l\'individuazione del problema</a>]]>.</string>
|
||||
<string name="AskButton">Chiedi a un volontario</string>
|
||||
<string name="TelegramFaq">Telegram FAQ</string>
|
||||
<string name="TelegramFaqUrl">https://telegram.org/faq</string>
|
||||
<string name="DeleteLocalization">Eliminare la localizzazione?</string>
|
||||
<string name="IncorrectLocalization">Incorrect localization file</string>
|
||||
|
||||
<!--media view-->
|
||||
<string name="NoMedia">Nessun media condiviso</string>
|
||||
|
@ -256,6 +256,12 @@
|
||||
<string name="ContactJoined">Contact lid geworden van Telegram</string>
|
||||
<string name="Pebble">PEBBLE</string>
|
||||
<string name="Language">Taal</string>
|
||||
<string name="AskAQuestionInfo">Please note that Telegram Support is done by volunteers. We try to respond as quickly as possible, but it may take a while.<![CDATA[<br><br>]]>Please take a look at the <![CDATA[<a href="http://telegram.org/faq#general">Telegram FAQ</a>]]>: it has important <![CDATA[<a href="http://telegram.org/faq#troubleshooting">troubleshooting tips</a>]]> and answers to most questions.</string>
|
||||
<string name="AskButton">Ask a volunteer</string>
|
||||
<string name="TelegramFaq">Telegram FAQ</string>
|
||||
<string name="TelegramFaqUrl">https://telegram.org/faq</string>
|
||||
<string name="DeleteLocalization">Delete localization?</string>
|
||||
<string name="IncorrectLocalization">Incorrect localization file</string>
|
||||
|
||||
<!--media view-->
|
||||
<string name="NoMedia">Nog geen media gedeeld</string>
|
||||
|
@ -256,6 +256,12 @@
|
||||
<string name="ContactJoined">Contact joined Telegram</string>
|
||||
<string name="Pebble">PEBBLE</string>
|
||||
<string name="Language">Language</string>
|
||||
<string name="AskAQuestionInfo">Please note that Telegram Support is done by volunteers. We try to respond as quickly as possible, but it may take a while.<![CDATA[<br><br>]]>Please take a look at the <![CDATA[<a href="http://telegram.org/faq#general">Telegram FAQ</a>]]>: it has answers to most questions and important tips for <![CDATA[<a href="http://telegram.org/faq#troubleshooting">troubleshooting</a>]]>.</string>
|
||||
<string name="AskButton">Ask a volunteer</string>
|
||||
<string name="TelegramFaq">Telegram FAQ</string>
|
||||
<string name="TelegramFaqUrl">https://telegram.org/faq</string>
|
||||
<string name="DeleteLocalization">Delete localization?</string>
|
||||
<string name="IncorrectLocalization">Incorrect localization file</string>
|
||||
|
||||
<!--media view-->
|
||||
<string name="NoMedia">No shared media yet</string>
|
||||
|
Loading…
x
Reference in New Issue
Block a user