Commit ebedf3c3 authored by DrKLO's avatar DrKLO

Save localization files applyed from document, fixed forwarded name position...

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
parent bd4152dc
......@@ -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) {
......
......@@ -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 {
......
......@@ -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;
}
......
......@@ -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));
}
}
......
<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>
\ No newline at end of file
<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>
\ No newline at end of file
<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>
\ No newline at end of file
<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>
\ No newline at end of file
<menu
xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/gallery_menu_save"
android:title="@string/SaveToGallery"/>
</menu>
\ No newline at end of file
<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>
\ No newline at end of file
<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>
\ No newline at end of file
<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>
\ No newline at end of file
<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>
\ No newline at end of file
<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>
\ No newline at end of file
<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>
\ No newline at end of file
<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>
\ No newline at end of file
<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>
\ No newline at end of file
<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>
\ No newline at end of file
<menu
xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/block_contact"
android:title="@string/BlockContact"/>
</menu>
\ No newline at end of file
<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>
\ No newline at end of file
<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>
\ No newline at end of file
......@@ -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>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment