Commit 934408c7 authored by DrKLO's avatar DrKLO

More Android L design

parent 5e51393b
......@@ -80,7 +80,7 @@ android {
defaultConfig {
minSdkVersion 8
targetSdkVersion 21
versionCode 380
versionCode 382
versionName "2.0.0"
}
}
......@@ -824,12 +824,11 @@ public class ConnectionsManager implements Action.ActionDelegate, TcpConnection.
if (invoke.system_version == null || invoke.system_version.length() == 0) {
invoke.system_version = "SDK Unknown";
}
object = invoke;
}
TLRPC.invokeWithLayer18 invoke = new TLRPC.invokeWithLayer18();
invoke.query = object;
TLRPC.invokeWithLayer invoke2 = new TLRPC.invokeWithLayer();
invoke2.query = invoke;
FileLog.d("wrap in layer", "" + object);
return invoke;
object = invoke2;
}
}
return object;
}
......@@ -1607,12 +1606,12 @@ public class ConnectionsManager implements Action.ActionDelegate, TcpConnection.
TLRPC.TL_protoMessage message = networkMessage.protoMessage;
if (BuildVars.DEBUG_VERSION) {
if (message.body instanceof TLRPC.invokeWithLayer18) {
FileLog.d("tmessages", connection.getSissionId() + ":DC" + datacenter.datacenterId + "> Send message (" + message.seqno + ", " + message.msg_id + "): " + ((TLRPC.invokeWithLayer18)message.body).query);
if (message.body instanceof TLRPC.invokeWithLayer) {
FileLog.d("tmessages", connection.getSissionId() + ":DC" + datacenter.datacenterId + "> Send message (" + message.seqno + ", " + message.msg_id + "): " + ((TLRPC.invokeWithLayer)message.body).query);
} else if (message.body instanceof TLRPC.initConnection) {
TLRPC.initConnection r = (TLRPC.initConnection)message.body;
if (r.query instanceof TLRPC.invokeWithLayer18) {
FileLog.d("tmessages", connection.getSissionId() + ":DC" + datacenter.datacenterId + "> Send message (" + message.seqno + ", " + message.msg_id + "): " + ((TLRPC.invokeWithLayer18)r.query).query);
if (r.query instanceof TLRPC.invokeWithLayer) {
FileLog.d("tmessages", connection.getSissionId() + ":DC" + datacenter.datacenterId + "> Send message (" + message.seqno + ", " + message.msg_id + "): " + ((TLRPC.invokeWithLayer)r.query).query);
} else {
FileLog.d("tmessages", connection.getSissionId() + ":DC" + datacenter.datacenterId + "> Send message (" + message.seqno + ", " + message.msg_id + "): " + r.query);
}
......@@ -1647,12 +1646,12 @@ public class ConnectionsManager implements Action.ActionDelegate, TcpConnection.
TLRPC.TL_protoMessage message = networkMessage.protoMessage;
containerMessages.add(message);
if (BuildVars.DEBUG_VERSION) {
if (message.body instanceof TLRPC.invokeWithLayer18) {
FileLog.d("tmessages", connection.getSissionId() + ":DC" + datacenter.datacenterId + "> Send message (" + message.seqno + ", " + message.msg_id + "): " + ((TLRPC.invokeWithLayer18)message.body).query);
if (message.body instanceof TLRPC.invokeWithLayer) {
FileLog.d("tmessages", connection.getSissionId() + ":DC" + datacenter.datacenterId + "> Send message (" + message.seqno + ", " + message.msg_id + "): " + ((TLRPC.invokeWithLayer)message.body).query);
} else if (message.body instanceof TLRPC.initConnection) {
TLRPC.initConnection r = (TLRPC.initConnection)message.body;
if (r.query instanceof TLRPC.invokeWithLayer18) {
FileLog.d("tmessages", connection.getSissionId() + ":DC" + datacenter.datacenterId + "> Send message (" + message.seqno + ", " + message.msg_id + "): " + ((TLRPC.invokeWithLayer18)r.query).query);
if (r.query instanceof TLRPC.invokeWithLayer) {
FileLog.d("tmessages", connection.getSissionId() + ":DC" + datacenter.datacenterId + "> Send message (" + message.seqno + ", " + message.msg_id + "): " + ((TLRPC.invokeWithLayer)r.query).query);
} else {
FileLog.d("tmessages", connection.getSissionId() + ":DC" + datacenter.datacenterId + "> Send message (" + message.seqno + ", " + message.msg_id + "): " + r.query);
}
......
......@@ -51,6 +51,8 @@ public class TLClassStore {
classStore.put(TLRPC.TL_updates_difference.constructor, TLRPC.TL_updates_difference.class);
classStore.put(TLRPC.TL_geoPointEmpty.constructor, TLRPC.TL_geoPointEmpty.class);
classStore.put(TLRPC.TL_geoPoint.constructor, TLRPC.TL_geoPoint.class);
classStore.put(TLRPC.TL_privacyKeyStatusTimestamp.constructor, TLRPC.TL_privacyKeyStatusTimestamp.class);
classStore.put(TLRPC.TL_account_privacyRules.constructor, TLRPC.TL_account_privacyRules.class);
classStore.put(TLRPC.TL_help_appUpdate.constructor, TLRPC.TL_help_appUpdate.class);
classStore.put(TLRPC.TL_help_noAppUpdate.constructor, TLRPC.TL_help_noAppUpdate.class);
classStore.put(TLRPC.TL_messageForwarded.constructor, TLRPC.TL_messageForwarded.class);
......@@ -93,8 +95,15 @@ public class TLClassStore {
classStore.put(TLRPC.TL_audioEmpty.constructor, TLRPC.TL_audioEmpty.class);
classStore.put(TLRPC.TL_audio.constructor, TLRPC.TL_audio.class);
classStore.put(TLRPC.TL_destroy_sessions_res.constructor, TLRPC.TL_destroy_sessions_res.class);
classStore.put(TLRPC.TL_privacyValueAllowUsers.constructor, TLRPC.TL_privacyValueAllowUsers.class);
classStore.put(TLRPC.TL_privacyValueDisallowAll.constructor, TLRPC.TL_privacyValueDisallowAll.class);
classStore.put(TLRPC.TL_privacyValueAllowContacts.constructor, TLRPC.TL_privacyValueAllowContacts.class);
classStore.put(TLRPC.TL_privacyValueDisallowContacts.constructor, TLRPC.TL_privacyValueDisallowContacts.class);
classStore.put(TLRPC.TL_privacyValueAllowAll.constructor, TLRPC.TL_privacyValueAllowAll.class);
classStore.put(TLRPC.TL_privacyValueDisallowUsers.constructor, TLRPC.TL_privacyValueDisallowUsers.class);
classStore.put(TLRPC.TL_contacts_contacts.constructor, TLRPC.TL_contacts_contacts.class);
classStore.put(TLRPC.TL_contacts_contactsNotModified.constructor, TLRPC.TL_contacts_contactsNotModified.class);
classStore.put(TLRPC.TL_inputPrivacyKeyStatusTimestamp.constructor, TLRPC.TL_inputPrivacyKeyStatusTimestamp.class);
classStore.put(TLRPC.TL_photos_photos.constructor, TLRPC.TL_photos_photos.class);
classStore.put(TLRPC.TL_photos_photosSlice.constructor, TLRPC.TL_photos_photosSlice.class);
classStore.put(TLRPC.TL_chatFull.constructor, TLRPC.TL_chatFull.class);
......@@ -165,6 +174,12 @@ public class TLClassStore {
classStore.put(TLRPC.TL_messages_affectedHistory.constructor, TLRPC.TL_messages_affectedHistory.class);
classStore.put(TLRPC.TL_documentEmpty.constructor, TLRPC.TL_documentEmpty.class);
classStore.put(TLRPC.TL_document.constructor, TLRPC.TL_document.class);
classStore.put(TLRPC.TL_inputPrivacyValueDisallowUsers.constructor, TLRPC.TL_inputPrivacyValueDisallowUsers.class);
classStore.put(TLRPC.TL_inputPrivacyValueDisallowAll.constructor, TLRPC.TL_inputPrivacyValueDisallowAll.class);
classStore.put(TLRPC.TL_inputPrivacyValueDisallowContacts.constructor, TLRPC.TL_inputPrivacyValueDisallowContacts.class);
classStore.put(TLRPC.TL_inputPrivacyValueAllowAll.constructor, TLRPC.TL_inputPrivacyValueAllowAll.class);
classStore.put(TLRPC.TL_inputPrivacyValueAllowContacts.constructor, TLRPC.TL_inputPrivacyValueAllowContacts.class);
classStore.put(TLRPC.TL_inputPrivacyValueAllowUsers.constructor, TLRPC.TL_inputPrivacyValueAllowUsers.class);
classStore.put(TLRPC.TL_inputMediaContact.constructor, TLRPC.TL_inputMediaContact.class);
classStore.put(TLRPC.TL_inputMediaUploadedThumbDocument.constructor, TLRPC.TL_inputMediaUploadedThumbDocument.class);
classStore.put(TLRPC.TL_inputMediaAudio.constructor, TLRPC.TL_inputMediaAudio.class);
......@@ -187,9 +202,12 @@ public class TLClassStore {
classStore.put(TLRPC.TL_contactSuggested.constructor, TLRPC.TL_contactSuggested.class);
classStore.put(TLRPC.TL_server_DH_params_fail.constructor, TLRPC.TL_server_DH_params_fail.class);
classStore.put(TLRPC.TL_server_DH_params_ok.constructor, TLRPC.TL_server_DH_params_ok.class);
classStore.put(TLRPC.TL_userStatusOffline.constructor, TLRPC.TL_userStatusOffline.class);
classStore.put(TLRPC.TL_userStatusLastWeek.constructor, TLRPC.TL_userStatusLastWeek.class);
classStore.put(TLRPC.TL_userStatusEmpty.constructor, TLRPC.TL_userStatusEmpty.class);
classStore.put(TLRPC.TL_userStatusLastMonth.constructor, TLRPC.TL_userStatusLastMonth.class);
classStore.put(TLRPC.TL_userStatusOnline.constructor, TLRPC.TL_userStatusOnline.class);
classStore.put(TLRPC.TL_userStatusOffline.constructor, TLRPC.TL_userStatusOffline.class);
classStore.put(TLRPC.TL_userStatusRecently.constructor, TLRPC.TL_userStatusRecently.class);
classStore.put(TLRPC.TL_msg_copy.constructor, TLRPC.TL_msg_copy.class);
classStore.put(TLRPC.TL_contacts_importedContacts.constructor, TLRPC.TL_contacts_importedContacts.class);
classStore.put(TLRPC.TL_futureSalt.constructor, TLRPC.TL_futureSalt.class);
......@@ -210,6 +228,7 @@ public class TLClassStore {
classStore.put(TLRPC.TL_updateEncryptedChatTyping.constructor, TLRPC.TL_updateEncryptedChatTyping.class);
classStore.put(TLRPC.TL_updateDcOptions.constructor, TLRPC.TL_updateDcOptions.class);
classStore.put(TLRPC.TL_updateChatParticipants.constructor, TLRPC.TL_updateChatParticipants.class);
classStore.put(TLRPC.TL_updatePrivacy.constructor, TLRPC.TL_updatePrivacy.class);
classStore.put(TLRPC.TL_updateEncryption.constructor, TLRPC.TL_updateEncryption.class);
classStore.put(TLRPC.TL_updateUserBlocked.constructor, TLRPC.TL_updateUserBlocked.class);
classStore.put(TLRPC.TL_updateActivation.constructor, TLRPC.TL_updateActivation.class);
......@@ -328,6 +347,7 @@ public class TLClassStore {
classStore.put(TLRPC.TL_inputPhotoEmpty.constructor, TLRPC.TL_inputPhotoEmpty.class);
classStore.put(TLRPC.TL_inputPhoto.constructor, TLRPC.TL_inputPhoto.class);
classStore.put(TLRPC.TL_importedContact.constructor, TLRPC.TL_importedContact.class);
classStore.put(TLRPC.TL_accountDaysTTL.constructor, TLRPC.TL_accountDaysTTL.class);
classStore.put(TLRPC.TL_inputPeerContact.constructor, TLRPC.TL_inputPeerContact.class);
classStore.put(TLRPC.TL_inputPeerChat.constructor, TLRPC.TL_inputPeerChat.class);
classStore.put(TLRPC.TL_inputPeerEmpty.constructor, TLRPC.TL_inputPeerEmpty.class);
......
......@@ -190,6 +190,7 @@ public class ActionBar extends FrameLayout {
titleFrameLayout.addView(backButtonImageView);
backButtonImageView.setVisibility(VISIBLE);
backButtonImageView.setScaleType(ImageView.ScaleType.CENTER);
backButtonImageView.setBackgroundResource(itemsBackgroundResourceId);
backButtonImageView.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
......@@ -505,7 +506,7 @@ public class ActionBar extends FrameLayout {
public void setItemsBackground(int resourceId) {
itemsBackgroundResourceId = resourceId;
if (backButtonImageView != null) {
backButtonImageView.setBackgroundResource(resourceId);
backButtonImageView.setBackgroundResource(itemsBackgroundResourceId);
}
}
......
......@@ -63,6 +63,10 @@ public class ActionBarMenu extends LinearLayout {
}
public ActionBarMenuItem addItem(int id, int icon, int backgroundResource) {
return addItem(id, icon, parentActionBar.itemsBackgroundResourceId, AndroidUtilities.dp(48));
}
public ActionBarMenuItem addItem(int id, int icon, int backgroundResource, int width) {
ActionBarMenuItem menuItem = new ActionBarMenuItem(getContext(), this, backgroundResource);
menuItem.setTag(id);
menuItem.setScaleType(ImageView.ScaleType.CENTER);
......@@ -70,7 +74,7 @@ public class ActionBarMenu extends LinearLayout {
addView(menuItem);
LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams)menuItem.getLayoutParams();
layoutParams.height = FrameLayout.LayoutParams.MATCH_PARENT;
layoutParams.width = AndroidUtilities.dp(48);
layoutParams.width = width;
menuItem.setLayoutParams(layoutParams);
menuItem.setOnClickListener(new OnClickListener() {
@Override
......
......@@ -53,6 +53,8 @@ public class ActionBarMenuItem extends ImageView {
private int[] location;
private View selectedMenuView;
private Runnable showMenuRunnable;
private boolean showFromBottom;
private int height;
public ActionBarMenuItem(Context context, ActionBarMenu menu, int background) {
super(context);
......@@ -129,6 +131,10 @@ public class ActionBarMenuItem extends ImageView {
return super.onTouchEvent(event);
}
public void setShowFromBottom(boolean value) {
showFromBottom = value;
}
public void addSubItem(int id, String text, int icon) {
if (popupLayout == null) {
rect = new Rect();
......@@ -238,12 +244,25 @@ public class ActionBarMenuItem extends ImageView {
}
popupWindow.setFocusable(true);
if (popupLayout.getMeasuredWidth() == 0) {
if (showFromBottom) {
popupWindow.showAsDropDown(this, -popupLayout.getMeasuredWidth() + getMeasuredWidth() + AndroidUtilities.dp(12), -popupLayout.getMeasuredHeight() + AndroidUtilities.dp(12));
popupWindow.update(this, -popupLayout.getMeasuredWidth() + getMeasuredWidth() + AndroidUtilities.dp(12), -popupLayout.getMeasuredHeight() + AndroidUtilities.dp(12), -1, -1);
height = popupLayout.getMeasuredHeight();
} else {
popupWindow.showAsDropDown(this, parentMenu.parentActionBar.getMeasuredWidth() - popupLayout.getMeasuredWidth() - getLeft() - parentMenu.getLeft(), -getMeasuredHeight());
popupWindow.update(this, parentMenu.parentActionBar.getMeasuredWidth() - popupLayout.getMeasuredWidth() - getLeft() - parentMenu.getLeft(), -getMeasuredHeight(), -1, -1);
}
} else {
if (showFromBottom) {
if (height == 0) {
height = popupLayout.getMeasuredHeight();
}
popupWindow.showAsDropDown(this, -popupLayout.getMeasuredWidth() + getMeasuredWidth() + AndroidUtilities.dp(12), -height + AndroidUtilities.dp(12));
} else {
popupWindow.showAsDropDown(this, parentMenu.parentActionBar.getMeasuredWidth() - popupLayout.getMeasuredWidth() - getLeft() - parentMenu.getLeft(), -getMeasuredHeight());
}
}
}
public boolean toggleSearch() {
if (searchField == null) {
......@@ -287,7 +306,7 @@ public class ActionBarMenuItem extends ImageView {
searchField.setTextColor(0xffffffff);
searchField.setSingleLine(true);
searchField.setBackgroundResource(R.drawable.search_light_states);
searchField.setPadding(AndroidUtilities.dp(6), 0, AndroidUtilities.dp(6), 0);
searchField.setPadding(0, 0, 0, 0);
searchField.setInputType(EditorInfo.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
if (android.os.Build.VERSION.SDK_INT < 11) {
searchField.setOnCreateContextMenuListener(new OnCreateContextMenuListener() {
......@@ -366,7 +385,8 @@ public class ActionBarMenuItem extends ImageView {
layoutParams.width = 0;
layoutParams.gravity = Gravity.CENTER_VERTICAL;
layoutParams.height = AndroidUtilities.dp(36);
layoutParams.rightMargin = AndroidUtilities.dp(16);
layoutParams.rightMargin = AndroidUtilities.dp(22);
layoutParams.leftMargin = AndroidUtilities.dp(6);
searchField.setLayoutParams(layoutParams);
searchField.setVisibility(GONE);
}
......@@ -386,11 +406,13 @@ public class ActionBarMenuItem extends ImageView {
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
super.onLayout(changed, left, top, right, bottom);
if (popupWindow != null && popupWindow.isShowing()) {
int x = parentMenu.parentActionBar.getMeasuredWidth() - popupLayout.getMeasuredWidth() - getLeft() - parentMenu.getLeft();
int y = -getMeasuredHeight();
if (showFromBottom) {
popupWindow.update(this, -popupLayout.getMeasuredWidth() + getMeasuredWidth() + AndroidUtilities.dp(12), -height + AndroidUtilities.dp(12), -1, -1);
} else {
popupWindow.update(this, parentMenu.parentActionBar.getMeasuredWidth() - popupLayout.getMeasuredWidth() - getLeft() - parentMenu.getLeft(), -getMeasuredHeight(), -1, -1);
}
}
}
public void hideSubItem(int id) {
View view = popupLayout.findViewWithTag(id);
......
......@@ -34,6 +34,7 @@ public class ContactsAdapter extends BaseSectionsAdapter {
private boolean onlyUsers;
private boolean needPhonebook;
private HashMap<Integer, TLRPC.User> ignoreUsers;
private HashMap<Integer, ?> checkedMap;
public ContactsAdapter(Context context, boolean arg1, boolean arg2, HashMap<Integer, TLRPC.User> arg3) {
mContext = context;
......@@ -42,6 +43,10 @@ public class ContactsAdapter extends BaseSectionsAdapter {
ignoreUsers = arg3;
}
public void setCheckedMap(HashMap<Integer, ?> map) {
checkedMap = map;
}
@Override
public Object getItem(int section, int position) {
if (onlyUsers) {
......@@ -212,6 +217,9 @@ public class ContactsAdapter extends BaseSectionsAdapter {
ArrayList<TLRPC.TL_contact> arr = ContactsController.getInstance().usersSectionsDict.get(ContactsController.getInstance().sortedUsersSectionsArray.get(section - (onlyUsers ? 0 : 1)));
TLRPC.User user = MessagesController.getInstance().getUser(arr.get(position).user_id);
((UserCell)convertView).setData(user, null, null, 0);
if (checkedMap != null) {
((UserCell) convertView).setChecked(checkedMap.containsKey(user.id));
}
if (ignoreUsers != null) {
if (ignoreUsers.containsKey(user.id)) {
ViewProxy.setAlpha(convertView, 0.5f);
......
......@@ -36,6 +36,7 @@ public class ContactsSearchAdapter extends BaseContactsSearchAdapter {
private HashMap<Integer, TLRPC.User> ignoreUsers;
private ArrayList<TLRPC.User> searchResult = new ArrayList<TLRPC.User>();
private ArrayList<CharSequence> searchResultNames = new ArrayList<CharSequence>();
private HashMap<Integer, ?> checkedMap;
private Timer searchTimer;
private boolean allowUsernameSearch;
private boolean useUserCell;
......@@ -46,6 +47,10 @@ public class ContactsSearchAdapter extends BaseContactsSearchAdapter {
allowUsernameSearch = usernameSearch;
}
public void setCheckedMap(HashMap<Integer, ?> map) {
checkedMap = map;
}
public void setUseUserCell(boolean value) {
useUserCell = value;
}
......@@ -238,6 +243,9 @@ public class ContactsSearchAdapter extends BaseContactsSearchAdapter {
if (useUserCell) {
((UserCell) view).setData(user, name, username, 0);
if (checkedMap != null) {
((UserCell) view).setChecked(checkedMap.containsKey(user.id));
}
} else {
((ProfileSearchCell) view).useSeparator = (i != getCount() - 1 && i != searchResult.size() - 1);
if (ignoreUsers != null) {
......
......@@ -136,7 +136,7 @@ public class DialogsAdapter extends BaseFragmentAdapter {
@Override
public boolean isEmpty() {
if (MessagesController.getInstance().loadingDialogs && MessagesController.getInstance().dialogs.isEmpty()) {
return false;
return true;
}
int count;
if (serverOnly) {
......
......@@ -33,6 +33,7 @@ import org.telegram.android.ImageReceiver;
import org.telegram.ui.Views.AvatarDrawable;
public class DialogCell extends BaseCell {
private static TextPaint namePaint;
private static TextPaint nameEncryptedPaint;
private static TextPaint nameUnknownPaint;
......
......@@ -12,7 +12,6 @@ import android.content.Context;
import android.text.TextUtils;
import android.util.TypedValue;
import android.view.Gravity;
import android.widget.CheckBox;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.TextView;
......@@ -27,6 +26,7 @@ import org.telegram.messenger.TLRPC;
import org.telegram.messenger.UserConfig;
import org.telegram.ui.Views.AvatarDrawable;
import org.telegram.ui.Views.BackupImageView;
import org.telegram.ui.Views.CheckBox;
public class UserCell extends FrameLayout {
......@@ -111,6 +111,18 @@ public class UserCell extends FrameLayout {
layoutParams.rightMargin = AndroidUtilities.dp(LocaleController.isRTL ? 16 : 0);
layoutParams.gravity = (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.CENTER_VERTICAL;
imageView.setLayoutParams(layoutParams);
checkBox = new CheckBox(context);
checkBox.setVisibility(GONE);
addView(checkBox);
layoutParams = (LayoutParams) checkBox.getLayoutParams();
layoutParams.width = AndroidUtilities.dp(22);
layoutParams.height = AndroidUtilities.dp(22);
layoutParams.topMargin = AndroidUtilities.dp(38);
layoutParams.leftMargin = LocaleController.isRTL ? 0 : AndroidUtilities.dp(37 + padding);
layoutParams.rightMargin = LocaleController.isRTL ? AndroidUtilities.dp(37 + padding) : 0;
layoutParams.gravity = (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT);
checkBox.setLayoutParams(layoutParams);
}
public void setData(TLRPC.User user, CharSequence name, CharSequence status, int resId) {
......@@ -130,6 +142,13 @@ public class UserCell extends FrameLayout {
update(0);
}
public void setChecked(boolean checked) {
if (checkBox.getVisibility() != VISIBLE) {
checkBox.setVisibility(VISIBLE);
}
checkBox.setChecked(checked);
}
@Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
......
......@@ -74,7 +74,7 @@ public class ChangeChatNameActivity extends BaseFragment {
});
ActionBarMenu menu = actionBar.createMenu();
doneButton = menu.addItem(done_button, R.drawable.ic_done);
doneButton = menu.addItem(done_button, R.drawable.ic_done, 0, AndroidUtilities.dp(56));
TLRPC.Chat currentChat = MessagesController.getInstance().getChat(chat_id);
......
......@@ -67,7 +67,7 @@ public class ChangeNameActivity extends BaseFragment {
});
ActionBarMenu menu = actionBar.createMenu();
doneButton = menu.addItem(done_button, R.drawable.ic_done);
doneButton = menu.addItem(done_button, R.drawable.ic_done, 0, AndroidUtilities.dp(56));
fragmentView = inflater.inflate(R.layout.contact_add_layout, container, false);
......
......@@ -77,7 +77,7 @@ public class ChangeUsernameActivity extends BaseFragment {
});
ActionBarMenu menu = actionBar.createMenu();
doneButton = menu.addItem(done_button, R.drawable.ic_done);
doneButton = menu.addItem(done_button, R.drawable.ic_done, 0, AndroidUtilities.dp(56));
TLRPC.User user = MessagesController.getInstance().getUser(UserConfig.getClientUserId());
if (user == null) {
......
......@@ -98,7 +98,7 @@ public class ContactAddActivity extends BaseFragment implements NotificationCent
});
ActionBarMenu menu = actionBar.createMenu();
doneButton = menu.addItem(done_button, R.drawable.ic_done);
doneButton = menu.addItem(done_button, R.drawable.ic_done, 0, AndroidUtilities.dp(56));
fragmentView = inflater.inflate(R.layout.contact_add_layout, container, false);
......@@ -112,6 +112,7 @@ public class ContactAddActivity extends BaseFragment implements NotificationCent
onlineText = (TextView)fragmentView.findViewById(R.id.settings_online);
avatarImage = (BackupImageView)fragmentView.findViewById(R.id.settings_avatar_image);
avatarImage.processDetach = false;
avatarImage.imageReceiver.setRoundRadius(AndroidUtilities.dp(32));
phoneText = (TextView)fragmentView.findViewById(R.id.settings_name);
Typeface typeface = AndroidUtilities.getTypeface("fonts/rmedium.ttf");
phoneText.setTypeface(typeface);
......
......@@ -47,7 +47,6 @@ import org.telegram.messenger.FileLog;
import org.telegram.android.MessagesController;
import org.telegram.android.NotificationCenter;
import org.telegram.messenger.R;
import org.telegram.ui.Adapters.BaseSectionsAdapter;
import org.telegram.ui.Adapters.ContactsAdapter;
import org.telegram.ui.Adapters.ContactsSearchAdapter;
import org.telegram.ui.ActionBar.ActionBar;
......@@ -85,7 +84,7 @@ public class GroupCreateActivity extends BaseFragment implements NotificationCen
}
}
private BaseSectionsAdapter listViewAdapter;
private ContactsAdapter listViewAdapter;
private TextView emptyTextView;
private EditText userSelectEditText;
private SectionsListView listView;
......@@ -158,13 +157,13 @@ public class GroupCreateActivity extends BaseFragment implements NotificationCen
}
});
ActionBarMenu menu = actionBar.createMenu();
View doneItem = menu.addItemResource(done_button, R.layout.group_create_done_layout);
TextView doneTextView = (TextView)doneItem.findViewById(R.id.done_button);
doneTextView.setText(LocaleController.getString("Next", R.string.Next));
menu.addItem(done_button, R.drawable.ic_done, 0, AndroidUtilities.dp(56));
searchListViewAdapter = new ContactsSearchAdapter(getParentActivity(), null, false);
listViewAdapter = new ContactsAdapter(getParentActivity(), true, false, null);
searchListViewAdapter.setCheckedMap(selectedContacts);
searchListViewAdapter.setUseUserCell(true);
listViewAdapter = new ContactsAdapter(getParentActivity(), true, false, null);
listViewAdapter.setCheckedMap(selectedContacts);
fragmentView = new LinearLayout(getParentActivity());
LinearLayout linearLayout = (LinearLayout) fragmentView;
......@@ -182,19 +181,23 @@ public class GroupCreateActivity extends BaseFragment implements NotificationCen
userSelectEditText.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
userSelectEditText.setHintTextColor(0xffa6a6a6);
userSelectEditText.setTextColor(0xff000000);
userSelectEditText.setMinimumHeight(AndroidUtilities.dp(52));
userSelectEditText.setMaxLines(2);
userSelectEditText.setPadding(userSelectEditText.getPaddingLeft(), AndroidUtilities.dp(3), userSelectEditText.getPaddingRight(), userSelectEditText.getPaddingBottom());
userSelectEditText.setInputType(InputType.TYPE_TEXT_VARIATION_FILTER | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS | InputType.TYPE_TEXT_FLAG_MULTI_LINE);
userSelectEditText.setImeOptions(EditorInfo.IME_ACTION_DONE);
userSelectEditText.setMinimumHeight(AndroidUtilities.dp(54));
userSelectEditText.setSingleLine(false);
userSelectEditText.setLines(2);
userSelectEditText.setMaxLines(2);
userSelectEditText.setVerticalScrollBarEnabled(true);
userSelectEditText.setHorizontalScrollBarEnabled(false);
userSelectEditText.setPadding(0, 0, 0, 0);
userSelectEditText.setImeOptions(EditorInfo.IME_ACTION_DONE | EditorInfo.IME_FLAG_NO_EXTRACT_UI);
userSelectEditText.setGravity((LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.CENTER_VERTICAL);
AndroidUtilities.clearCursorDrawable(userSelectEditText);
frameLayout.addView(userSelectEditText);
FrameLayout.LayoutParams layoutParams1 = (FrameLayout.LayoutParams) userSelectEditText.getLayoutParams();
layoutParams1.width = FrameLayout.LayoutParams.MATCH_PARENT;
layoutParams1.height = FrameLayout.LayoutParams.WRAP_CONTENT;
layoutParams1.leftMargin = AndroidUtilities.dp(5);
layoutParams1.rightMargin = AndroidUtilities.dp(5);
layoutParams1.leftMargin = AndroidUtilities.dp(10);
layoutParams1.rightMargin = AndroidUtilities.dp(10);
layoutParams1.gravity = Gravity.TOP;
userSelectEditText.setLayoutParams(layoutParams1);
......@@ -324,16 +327,21 @@ public class GroupCreateActivity extends BaseFragment implements NotificationCen
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
/*TLRPC.User user;
int section = listViewAdapter.getSectionForPosition(i);
int row = listViewAdapter.getPositionInSectionForPosition(i);
TLRPC.User user = null;
if (searching && searchWas) {
user = searchResult.get(row);
user = searchListViewAdapter.getItem(i);
} else {
ArrayList<TLRPC.TL_contact> arr = ContactsController.getInstance().usersSectionsDict.get(ContactsController.getInstance().sortedUsersSectionsArray.get(section));
user = MessagesController.getInstance().getUser(arr.get(row).user_id);
listView.invalidateViews();
int section = listViewAdapter.getSectionForPosition(i);
int row = listViewAdapter.getPositionInSectionForPosition(i);
if (row < 0 || section < 0) {
return;
}
user = (TLRPC.User) listViewAdapter.getItem(section, row);
}
if (user == null) {
return;
}
if (selectedContacts.containsKey(user.id)) {
XImageSpan span = selectedContacts.get(user.id);
selectedContacts.remove(user.id);
......@@ -355,10 +363,6 @@ public class GroupCreateActivity extends BaseFragment implements NotificationCen
}
actionBar.setSubtitle(LocaleController.formatString("MembersCount", R.string.MembersCount, selectedContacts.size(), maxCount));
if (searching || searchWas) {
searching = false;
searchWas = false;
emptyTextView.setText(LocaleController.getString("NoContacts", R.string.NoContacts));
ignoreChange = true;
SpannableStringBuilder ssb = new SpannableStringBuilder("");
for (ImageSpan sp : allSpans) {
......@@ -369,10 +373,21 @@ public class GroupCreateActivity extends BaseFragment implements NotificationCen
userSelectEditText.setSelection(ssb.length());
ignoreChange = false;
searchListViewAdapter.searchDialogs(null);
searching = false;
searchWas = false;
ViewGroup group = (ViewGroup) listView.getParent();
listView.setAdapter(listViewAdapter);
listViewAdapter.notifyDataSetChanged();
if (android.os.Build.VERSION.SDK_INT >= 11) {
listView.setFastScrollAlwaysVisible(true);
}
listView.setFastScrollEnabled(true);
listView.setVerticalScrollBarEnabled(false);
emptyTextView.setText(LocaleController.getString("NoContacts", R.string.NoContacts));
} else {
listView.invalidateViews();
}*/
}
}
});
listView.setOnScrollListener(new AbsListView.OnScrollListener() {
......
......@@ -8,17 +8,25 @@
package org.telegram.ui;
import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.text.Editable;
import android.text.InputType;
import android.text.TextWatcher;
import android.util.TypedValue;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.inputmethod.EditorInfo;
import android.widget.EditText;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.TextView;
import org.telegram.android.AndroidUtilities;
import org.telegram.messenger.ConnectionsManager;
......@@ -30,6 +38,7 @@ import org.telegram.android.MessagesController;
import org.telegram.android.NotificationCenter;
import org.telegram.messenger.R;
import org.telegram.ui.Adapters.BaseFragmentAdapter;
import org.telegram.ui.Cells.GreySectionCell;
import org.telegram.ui.Cells.UserCell;
import org.telegram.ui.ActionBar.ActionBar;
import org.telegram.ui.ActionBar.ActionBarMenu;
......@@ -175,15 +184,33 @@ public class GroupCreateFinalActivity extends BaseFragment implements Notificati
});
ActionBarMenu menu = actionBar.createMenu();
View doneItem = menu.addItemResource(done_button, R.layout.group_create_done_layout);
menu.addItem(done_button, R.drawable.ic_done, 0, AndroidUtilities.dp(56));
TextView doneTextView = (TextView)doneItem.findViewById(R.id.done_button);
doneTextView.setText(LocaleController.getString("Done", R.string.Done).toUpperCase());
fragmentView = new LinearLayout(getParentActivity());
LinearLayout linearLayout = (LinearLayout) fragmentView;
linearLayout.setOrientation(LinearLayout.VERTICAL);
fragmentView = inflater.inflate(R.layout.group_create_final_layout, container, false);
FrameLayout frameLayout = new FrameLayout(getParentActivity());
linearLayout.addView(frameLayout);
LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) frameLayout.getLayoutParams();
layoutParams.width = LinearLayout.LayoutParams.MATCH_PARENT;
layoutParams.height = LinearLayout.LayoutParams.WRAP_CONTENT;
frameLayout.setLayoutParams(layoutParams);
avatarImage = new BackupImageView(getParentActivity());
avatarDrawable.setInfo(5, null, null, isBroadcast);
avatarImage.setImageDrawable(avatarDrawable);
frameLayout.addView(avatarImage);
FrameLayout.LayoutParams layoutParams1 = (FrameLayout.LayoutParams) avatarImage.getLayoutParams();
layoutParams1.width = AndroidUtilities.dp(64);
layoutParams1.height = AndroidUtilities.dp(64);
layoutParams1.topMargin = AndroidUtilities.dp(12);
layoutParams1.bottomMargin = AndroidUtilities.dp(12);
layoutParams1.leftMargin = AndroidUtilities.dp(16);
avatarImage.setLayoutParams(layoutParams1);
if (!isBroadcast) {
/*button2.setOnClickListener(new View.OnClickListener() {
avatarDrawable.setDrawPhoto(true);
avatarImage.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (getParentActivity() == null) {
......@@ -215,25 +242,66 @@ public class GroupCreateFinalActivity extends BaseFragment implements Notificati
});
showAlertDialog(builder);
}
});*/
});
}
avatarImage = (BackupImageView)fragmentView.findViewById(R.id.settings_avatar_image);
avatarDrawable.setInfo(3, null, null, isBroadcast);
avatarImage.setImageDrawable(avatarDrawable);
nameTextView = (EditText)fragmentView.findViewById(R.id.bubble_input_text);
if (isBroadcast) {
nameTextView.setHint(LocaleController.getString("EnterListName", R.string.EnterListName));
} else {
nameTextView.setHint(LocaleController.getString("EnterGroupNamePlaceholder", R.string.EnterGroupNamePlaceholder));
}
nameTextView = new EditText(getParentActivity());
nameTextView.setHint(isBroadcast ? LocaleController.getString("EnterListName", R.string.EnterListName) : LocaleController.getString("EnterGroupNamePlaceholder", R.string.EnterGroupNamePlaceholder));
if (nameToSet != null) {
nameTextView.setText(nameToSet);
nameToSet = null;
}
listView = (ListView)fragmentView.findViewById(R.id.listView);
nameTextView.setMaxLines(4);
nameTextView.setGravity(Gravity.CENTER_VERTICAL | Gravity.LEFT);
nameTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
nameTextView.setHintTextColor(0xffa6a6a6);
nameTextView.setImeOptions(EditorInfo.IME_FLAG_NO_EXTRACT_UI);
nameTextView.setInputType(InputType.TYPE_TEXT_FLAG_CAP_SENTENCES);
nameTextView.setPadding(0, 0, 0, AndroidUtilities.dp(8));
AndroidUtilities.clearCursorDrawable(nameTextView);
nameTextView.setTextColor(0xff000000);
frameLayout.addView(nameTextView);
layoutParams1 = (FrameLayout.LayoutParams) nameTextView.getLayoutParams();
layoutParams1.width = FrameLayout.LayoutParams.MATCH_PARENT;
layoutParams1.height = FrameLayout.LayoutParams.WRAP_CONTENT;
layoutParams1.leftMargin = AndroidUtilities.dp(96);
layoutParams1.rightMargin = AndroidUtilities.dp(16);
layoutParams1.gravity = Gravity.CENTER_VERTICAL;
nameTextView.setLayoutParams(layoutParams1);
if (!isBroadcast) {
nameTextView.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
@Override
public void afterTextChanged(Editable s) {
avatarDrawable.setInfo(5, nameTextView.length() > 0 ? nameTextView.getText().toString() : null, null, isBroadcast);
avatarImage.invalidate();
}
});
}
GreySectionCell sectionCell = new GreySectionCell(getParentActivity());
sectionCell.setText(LocaleController.formatPluralString("Members", selectedContacts.size()));
linearLayout.addView(sectionCell);
listView = new ListView(getParentActivity());
listView.setDivider(null);
listView.setDividerHeight(0);
listView.setVerticalScrollBarEnabled(false);
listView.setAdapter(new ListAdapter(getParentActivity()));
linearLayout.addView(listView);
layoutParams = (LinearLayout.LayoutParams) listView.getLayoutParams();
layoutParams.width = LinearLayout.LayoutParams.MATCH_PARENT;
layoutParams.height = LinearLayout.LayoutParams.MATCH_PARENT;
listView.setLayoutParams(layoutParams);
} else {
ViewGroup parent = (ViewGroup)fragmentView.getParent();
if (parent != null) {
......@@ -359,21 +427,28 @@ public class GroupCreateFinalActivity extends BaseFragment implements Notificati
@Override
public View getView(int i, View view, ViewGroup viewGroup) {
TLRPC.User user = MessagesController.getInstance().getUser(selectedContacts.get(i));
if (view == null) {
view = new UserCell(mContext, 1);
}
TLRPC.User user = MessagesController.getInstance().getUser(selectedContacts.get(i));
((UserCell) view).setData(user, null, null, 0);
return view;
}
/*
if (convertView == null) {
convertView = new SettingsSectionLayout(mContext);
convertView.setBackgroundColor(0xffffffff);
@Override
public int getItemViewType(int position) {
return 0;
}
((SettingsSectionLayout) convertView).setText(LocaleController.formatPluralString("Members", selectedContacts.size()).toUpperCase());
return convertView;
*/
@Override
public int getViewTypeCount() {
return 1;
}
@Override
public int getCount() {
return selectedContacts.size();
}
}
}
......@@ -305,7 +305,6 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa
setContentView(drawerLayoutContainer, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
drawerLayoutContainer.setParentActionBarLayout(actionBarLayout);
drawerLayoutContainer.setAllowOpenDrawer(true);
actionBarLayout.setDrawerLayoutContainer(drawerLayoutContainer);
}
actionBarLayout.init(mainFragmentsStack);
......@@ -1119,6 +1118,7 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa
@Override
public boolean needPresentFragment(BaseFragment fragment, boolean removeLast, boolean forceWithoutAnimation, ActionBarLayout layout) {
drawerLayoutContainer.setAllowOpenDrawer(!(fragment instanceof LoginActivity));
if (AndroidUtilities.isTablet()) {
if (fragment instanceof MessagesActivity) {
MessagesActivity messagesActivity = (MessagesActivity)fragment;
......@@ -1196,6 +1196,7 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa
@Override
public boolean needAddFragmentToStack(BaseFragment fragment, ActionBarLayout layout) {
drawerLayoutContainer.setAllowOpenDrawer(!(fragment instanceof LoginActivity));
if (AndroidUtilities.isTablet()) {
if (fragment instanceof MessagesActivity) {
MessagesActivity messagesActivity = (MessagesActivity)fragment;
......
/*
* This is the source code of Telegram for Android v. 1.3.2.
* It is licensed under GNU GPL v. 2 or later.
* You should have received a copy of the license in this archive (see LICENSE).
*
* Copyright Nikolai Kudashov, 2013.
*/
package org.telegram.ui;
import android.content.Context;
import android.os.Bundle;
import android.util.AttributeSet;
import android.view.KeyEvent;
import android.view.View;
import android.view.inputmethod.EditorInfo;
import android.widget.EditText;
import android.widget.TextView;
import org.telegram.android.AndroidUtilities;
import org.telegram.android.LocaleController;
import org.telegram.messenger.TLObject;
import org.telegram.messenger.TLRPC;
import org.telegram.messenger.ConnectionsManager;
import org.telegram.android.ContactsController;
import org.telegram.android.MessagesController;
import org.telegram.android.MessagesStorage;
import org.telegram.messenger.R;
import org.telegram.messenger.RPCRequest;
import org.telegram.messenger.UserConfig;
import org.telegram.ui.Views.SlideView;
import java.util.ArrayList;
public class LoginActivityRegisterView extends SlideView {
private EditText firstNameField;
private EditText lastNameField;
private String requestPhone;
private String phoneHash;
private String phoneCode;
private Bundle currentParams;
private boolean nextPressed = false;
public LoginActivityRegisterView(Context context) {
super(context);
}
public LoginActivityRegisterView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public LoginActivityRegisterView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
@Override
protected void onFinishInflate() {
super.onFinishInflate();
firstNameField = (EditText)findViewById(R.id.login_first_name_field);
firstNameField.setHint(LocaleController.getString("FirstName", R.string.FirstName));
lastNameField = (EditText)findViewById(R.id.login_last_name_field);
lastNameField.setHint(LocaleController.getString("LastName", R.string.LastName));
TextView textView = (TextView)findViewById(R.id.login_register_info);
textView.setText(LocaleController.getString("RegisterText", R.string.RegisterText));
TextView wrongNumber = (TextView) findViewById(R.id.changed_mind);
wrongNumber.setText(LocaleController.getString("CancelRegistration", R.string.CancelRegistration));
wrongNumber.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
onBackPressed();
delegate.setPage(0, true, null, true);
}
});
firstNameField.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) {
if (i == EditorInfo.IME_ACTION_NEXT) {
lastNameField.requestFocus();
return true;
}
return false;
}
});
}
@Override
public void onBackPressed() {
currentParams = null;
}
@Override
public String getHeaderName() {
return LocaleController.getString("YourName", R.string.YourName);
}
@Override
public void onShow() {
super.onShow();
if (firstNameField != null) {
firstNameField.requestFocus();
firstNameField.setSelection(firstNameField.length());
}
}
@Override
public void setParams(Bundle params) {
if (params == null) {
return;
}
firstNameField.setText("");
lastNameField.setText("");
requestPhone = params.getString("phoneFormated");
phoneHash = params.getString("phoneHash");
phoneCode = params.getString("code");
currentParams = params;
}
@Override
public void onNextPressed() {
if (nextPressed) {
return;
}
nextPressed = true;
TLRPC.TL_auth_signUp req = new TLRPC.TL_auth_signUp();
req.phone_code = phoneCode;
req.phone_code_hash = phoneHash;
req.phone_number = requestPhone;
req.first_name = firstNameField.getText().toString();
req.last_name = lastNameField.getText().toString();
if (delegate != null) {
delegate.needShowProgress();
}
ConnectionsManager.getInstance().performRpc(req, new RPCRequest.RPCRequestDelegate() {
@Override
public void run(final TLObject response, final TLRPC.TL_error error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public void run() {
nextPressed = false;
if (delegate != null) {
delegate.needHideProgress();
}
if (error == null) {
final TLRPC.TL_auth_authorization res = (TLRPC.TL_auth_authorization) response;
TLRPC.TL_userSelf user = (TLRPC.TL_userSelf) res.user;
UserConfig.clearConfig();
MessagesController.getInstance().cleanUp();
UserConfig.setCurrentUser(user);
UserConfig.saveConfig(true);
MessagesStorage.getInstance().cleanUp(true);
ArrayList<TLRPC.User> users = new ArrayList<TLRPC.User>();
users.add(user);
MessagesStorage.getInstance().putUsersAndChats(users, null, true, true);
//MessagesController.getInstance().uploadAndApplyUserAvatar(avatarPhotoBig);
MessagesController.getInstance().putUser(res.user, false);
ContactsController.getInstance().checkAppAccount();
MessagesController.getInstance().getBlockedUsers(true);
if (delegate != null) {
delegate.needFinishActivity();
}
ConnectionsManager.getInstance().initPushConnection();
} else {
if (delegate != null) {
if (error.text.contains("PHONE_NUMBER_INVALID")) {
delegate.needShowAlert(LocaleController.getString("InvalidPhoneNumber", R.string.InvalidPhoneNumber));
} else if (error.text.contains("PHONE_CODE_EMPTY") || error.text.contains("PHONE_CODE_INVALID")) {
delegate.needShowAlert(LocaleController.getString("InvalidCode", R.string.InvalidCode));
} else if (error.text.contains("PHONE_CODE_EXPIRED")) {
delegate.needShowAlert(LocaleController.getString("CodeExpired", R.string.CodeExpired));
} else if (error.text.contains("FIRSTNAME_INVALID")) {
delegate.needShowAlert(LocaleController.getString("InvalidFirstName", R.string.InvalidFirstName));
} else if (error.text.contains("LASTNAME_INVALID")) {
delegate.needShowAlert(LocaleController.getString("InvalidLastName", R.string.InvalidLastName));
} else {
delegate.needShowAlert(error.text);
}
}
}
}
});
}
}, true, RPCRequest.RPCRequestClassGeneric | RPCRequest.RPCRequestClassWithoutLogin);
}
@Override
public void saveStateParams(Bundle bundle) {
String first = firstNameField.getText().toString();
if (first != null && first.length() != 0) {
bundle.putString("registerview_first", first);
}
String last = lastNameField.getText().toString();
if (last != null && last.length() != 0) {
bundle.putString("registerview_last", last);
}
if (currentParams != null) {
bundle.putBundle("registerview_params", currentParams);
}
}
@Override
public void restoreStateParams(Bundle bundle) {
currentParams = bundle.getBundle("registerview_params");
if (currentParams != null) {
setParams(currentParams);
}
String first = bundle.getString("registerview_first");
if (first != null) {
firstNameField.setText(first);
}
String last = bundle.getString("registerview_last");
if (last != null) {
lastNameField.setText(last);
}
}
}
......@@ -149,9 +149,16 @@ public class MessagesActivity extends BaseFragment implements NotificationCenter
searching = false;
searchWas = false;
if (messagesListView != null) {
if (MessagesController.getInstance().loadingDialogs && MessagesController.getInstance().dialogs.isEmpty()) {
searchEmptyView.setVisibility(View.GONE);
emptyView.setVisibility(View.GONE);
progressView.setVisibility(View.VISIBLE);
messagesListView.setEmptyView(progressView);
} else {
messagesListView.setEmptyView(emptyView);
searchEmptyView.setVisibility(View.GONE);
progressView.setVisibility(View.GONE);
}
if (!onlySelect) {
floatingButton.setVisibility(View.VISIBLE);
floatingHidden = true;
......@@ -274,15 +281,11 @@ public class MessagesActivity extends BaseFragment implements NotificationCenter
if (MessagesController.getInstance().loadingDialogs && MessagesController.getInstance().dialogs.isEmpty()) {
searchEmptyView.setVisibility(View.GONE);
emptyView.setVisibility(View.GONE);
progressView.setVisibility(View.VISIBLE);
messagesListView.setEmptyView(progressView);
} else {
if (searching && searchWas) {
messagesListView.setEmptyView(searchEmptyView);
emptyView.setVisibility(View.GONE);
} else {
messagesListView.setEmptyView(emptyView);
searchEmptyView.setVisibility(View.GONE);
}
progressView.setVisibility(View.GONE);
}
......
......@@ -353,7 +353,7 @@ public class PhotoCropActivity extends BaseFragment {
});
ActionBarMenu menu = actionBar.createMenu();
menu.addItem(done_button, R.drawable.ic_done);
menu.addItem(done_button, R.drawable.ic_done, 0, AndroidUtilities.dp(56));
fragmentView = view = new PhotoCropView(getParentActivity());
fragmentView.setLayoutParams(new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT));
......
/*
* This is the source code of Telegram for Android v. 1.7.x.
* It is licensed under GNU GPL v. 2 or later.
* You should have received a copy of the license in this archive (see LICENSE).
*
* Copyright Nikolai Kudashov, 2013-2014.
*/
package org.telegram.ui;
import org.telegram.ui.ActionBar.BaseFragment;
public class PrivacySettingsActivity extends BaseFragment {
}
......@@ -254,10 +254,7 @@ public class VideoEditorActivity extends BaseFragment implements TextureView.Sur
});
ActionBarMenu menu = actionBar.createMenu();
View doneItem = menu.addItemResource(1, R.layout.group_create_done_layout);
TextView doneTextView = (TextView) doneItem.findViewById(R.id.done_button);
doneTextView.setText(LocaleController.getString("Done", R.string.Done).toUpperCase());
menu.addItem(1, R.drawable.ic_done, 0, AndroidUtilities.dp(56));
fragmentView = inflater.inflate(R.layout.video_editor_layout, container, false);
originalSizeTextView = (TextView) fragmentView.findViewById(R.id.original_size);
......
......@@ -35,6 +35,7 @@ public class AvatarDrawable extends Drawable {
R.drawable.bar_selector_green, R.drawable.bar_selector_cyan, R.drawable.bar_selector_blue, R.drawable.bar_selector_violet, R.drawable.bar_selector_pink};
private static Drawable broadcastDrawable;
private static Drawable photoDrawable;
private int color;
private StaticLayout textLayout;
......@@ -42,6 +43,7 @@ public class AvatarDrawable extends Drawable {
private float textHeight;
private boolean isProfile;
private boolean drawBrodcast;
private boolean drawPhoto;
public AvatarDrawable() {
super();
......@@ -147,6 +149,13 @@ public class AvatarDrawable extends Drawable {
}
}
public void setDrawPhoto(boolean value) {
if (value && photoDrawable == null) {
photoDrawable = ApplicationLoader.applicationContext.getResources().getDrawable(R.drawable.photo_w);
}
drawPhoto = value;
}
@Override
public void draw(Canvas canvas) {
Rect bounds = getBounds();
......@@ -168,6 +177,11 @@ public class AvatarDrawable extends Drawable {
if (textLayout != null) {
canvas.translate((size - textWidth) / 2, (size - textHeight) / 2);
textLayout.draw(canvas);
} else if (drawPhoto && photoDrawable != null) {
int x = (size - photoDrawable.getIntrinsicWidth()) / 2;
int y = (size - photoDrawable.getIntrinsicHeight()) / 2;
photoDrawable.setBounds(x, y, x + photoDrawable.getIntrinsicWidth(), y + photoDrawable.getIntrinsicHeight());
photoDrawable.draw(canvas);
}
}
canvas.restore();
......
/*
* This is the source code of Telegram for Android v. 1.7.x.
* It is licensed under GNU GPL v. 2 or later.
* You should have received a copy of the license in this archive (see LICENSE).
*
* Copyright Nikolai Kudashov, 2013-2014.
*/
package org.telegram.ui.Views;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.drawable.Drawable;
import android.widget.CompoundButton;
import org.telegram.messenger.R;
public class CheckBox extends CompoundButton {
private Paint paint;
private Drawable checkDrawable;
public CheckBox(Context context) {
super(context);
paint = new Paint(Paint.ANTI_ALIAS_FLAG);
paint.setColor(0xff5ec245);
checkDrawable = context.getResources().getDrawable(R.drawable.round_check2);
}
@Override
public void setChecked(boolean checked) {
super.setChecked(checked);
checked = isChecked();
invalidate();
/*if (attachedToWindow && wasLayout) {
animateThumbToCheckedState(checked);
} else {
cancelPositionAnimator();
setThumbPosition(checked ? 1 : 0);
}*/
}
@Override
protected void onDraw(Canvas canvas) {
if (isChecked()) {
canvas.drawCircle(getMeasuredWidth() / 2, getMeasuredHeight() / 2, getMeasuredWidth() / 2, paint);
int x = (getMeasuredWidth() - checkDrawable.getIntrinsicWidth()) / 2;
int y = (getMeasuredHeight() - checkDrawable.getIntrinsicHeight()) / 2;
checkDrawable.setBounds(x, y, x + checkDrawable.getIntrinsicWidth(), y + checkDrawable.getIntrinsicHeight());
checkDrawable.draw(canvas);
}
}
}
/*
* This is the source code of Telegram for Android v. 1.3.2.
* It is licensed under GNU GPL v. 2 or later.
* You should have received a copy of the license in this archive (see LICENSE).
*
* Copyright Nikolai Kudashov, 2013.
*/
package org.telegram.ui.Views;
import android.content.Context;
import android.os.Bundle;
import android.util.AttributeSet;
import android.widget.LinearLayout;
public class SlideView extends LinearLayout {
public static interface SlideViewDelegate {
public abstract void onNextAction();
public abstract void needShowAlert(String text);
public abstract void needShowProgress();
public abstract void needHideProgress();
public abstract void setPage(int page, boolean animated, Bundle params, boolean back);
public abstract void needFinishActivity();
}
public SlideView(Context context) {
super(context);
}
public SlideView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public SlideView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
public SlideViewDelegate delegate;
public String getHeaderName() {
return "";
}
public void onNextPressed() {
}
public void setParams(Bundle params) {
}
public void onBackPressed() {
}
public void onShow() {
}
public void onDestroyActivity() {
delegate = null;
}
public void saveStateParams(Bundle bundle) {
}
public void restoreStateParams(Bundle bundle) {
}
}
......@@ -155,7 +155,7 @@ public class WallpapersActivity extends BaseFragment implements NotificationCent
});
ActionBarMenu menu = actionBar.createMenu();
doneButton = menu.addItem(done_button, R.drawable.ic_done);
doneButton = menu.addItem(done_button, R.drawable.ic_done, 0, AndroidUtilities.dp(56));
fragmentView = inflater.inflate(R.layout.settings_wallpapers_layout, container, false);
listAdapter = new ListAdapter(getParentActivity());
......
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_window_focused="false" android:state_enabled="true" android:drawable="@drawable/search_dark_activated" />
<item android:state_enabled="true" android:state_focused="true" android:drawable="@drawable/search_dark_activated" />
<item android:state_focused="true" android:drawable="@drawable/search_dark_activated" />
<item android:drawable="@drawable/search_dark" />
......
<selector
xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" android:drawable="@drawable/spinner_pressed" />
<item android:state_focused="true" android:drawable="@drawable/spinner_pressed" />
<item android:state_checked="true" android:drawable="@drawable/spinner_pressed" />
<item android:drawable="@drawable/spinner" />
<item android:state_pressed="true">
<shape android:shape="rectangle">
<padding
android:left="4dp"
android:top="4dp"
android:right="4dp"
android:bottom="4dp"/>
<solid
android:color="#22000000" />
</shape>
</item>
<item android:state_checked="true">
<shape android:shape="rectangle">
<padding
android:left="4dp"
android:top="4dp"
android:right="4dp"
android:bottom="4dp"/>
<solid
android:color="#22000000" />
</shape>
</item>
<item android:state_focused="true">
<shape android:shape="rectangle">
<padding
android:left="4dp"
android:top="4dp"
android:right="4dp"
android:bottom="4dp"/>
<solid
android:color="#22000000" />
</shape>
</item>
<item>
<shape android:shape="rectangle">
<padding
android:left="4dp"
android:top="4dp"
android:right="4dp"
android:bottom="4dp"/>
<solid
android:color="#00000000" />
</shape>
</item>
</selector>
\ No newline at end of file
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="50dp"
android:layout_gravity="top">
<TextView
android:textSize="18dp"
android:textColor="#999999"
android:id="@+id/settings_row_text_detail"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_marginLeft="12dp"
android:layout_marginRight="8dp"
android:gravity="center_vertical|left"
android:layout_gravity="left"/>
<TextView
android:textSize="18dp"
android:textColor="#333333"
android:id="@+id/settings_row_text"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_marginLeft="8dp"
android:layout_marginRight="12dp"
android:gravity="center_vertical|right"
android:layout_gravity="top|right"/>
<View
android:background="@color/divider"
android:layout_width="fill_parent"
android:layout_height="1px"
android:layout_gravity="bottom"
android:id="@+id/settings_row_divider"/>
</FrameLayout>
\ No newline at end of file
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="50dp"
android:layout_gravity="top">
<TextView
android:textSize="18dp"
android:textColor="#333333"
android:id="@+id/settings_row_text"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_marginLeft="12dp"
android:layout_marginRight="8dp"
android:gravity="center_vertical"
android:layout_gravity="top"/>
<TextView
android:textSize="18dp"
android:textColor="#999999"
android:id="@+id/settings_row_text_detail"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_marginLeft="8dp"
android:layout_marginRight="12dp"
android:gravity="center_vertical"
android:layout_gravity="right"/>
<View
android:background="@color/divider"
android:layout_width="fill_parent"
android:layout_height="1px"
android:layout_gravity="bottom"
android:id="@+id/settings_row_divider"/>
</FrameLayout>
\ No newline at end of file
This diff is collapsed.
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="100dp"
android:layout_height="100dp">
<ProgressBar
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:paddingTop="6dp"
android:paddingBottom="6dp">
</ProgressBar>
android:paddingBottom="6dp"/>
</FrameLayout>
......@@ -10,7 +10,6 @@
android:id="@+id/background_image"/>
<ProgressBar
android:background="#99000000"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_gravity="center"
......
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