Commit f76fa00e authored by DrKLO's avatar DrKLO

More Android L design

parent 934408c7
...@@ -17,7 +17,7 @@ tasks.withType(JavaCompile) { ...@@ -17,7 +17,7 @@ tasks.withType(JavaCompile) {
} }
dependencies { dependencies {
compile 'com.android.support:support-v4:20.0.+' compile 'com.android.support:support-v4:21.0.+'
compile 'com.google.android.gms:play-services:3.2.+' compile 'com.google.android.gms:play-services:3.2.+'
compile 'net.hockeyapp.android:HockeySDK:3.0.2' compile 'net.hockeyapp.android:HockeySDK:3.0.2'
compile 'com.googlecode.mp4parser:isoparser:1.0.+' compile 'com.googlecode.mp4parser:isoparser:1.0.+'
......
...@@ -17,8 +17,10 @@ import android.content.res.Configuration; ...@@ -17,8 +17,10 @@ import android.content.res.Configuration;
import android.graphics.Point; import android.graphics.Point;
import android.graphics.Rect; import android.graphics.Rect;
import android.graphics.Typeface; import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.os.Build; import android.os.Build;
import android.os.Environment; import android.os.Environment;
import android.util.StateSet;
import android.view.Display; import android.view.Display;
import android.view.Surface; import android.view.Surface;
import android.view.View; import android.view.View;
...@@ -491,4 +493,23 @@ public class AndroidUtilities { ...@@ -491,4 +493,23 @@ public class AndroidUtilities {
} }
} }
} }
public static void clearDrawableAnimation(View view) {
if (Build.VERSION.SDK_INT < 21 || view == null) {
return;
}
Drawable drawable = null;
if (view instanceof ListView) {
drawable = ((ListView) view).getSelector();
if (drawable != null) {
drawable.setState(StateSet.NOTHING);
}
} else {
drawable = view.getBackground();
if (drawable != null) {
drawable.setState(StateSet.NOTHING);
drawable.jumpToCurrentState();
}
}
}
} }
...@@ -54,6 +54,11 @@ public class ContactsController { ...@@ -54,6 +54,11 @@ public class ContactsController {
private String inviteText; private String inviteText;
private boolean updatingInviteText = false; private boolean updatingInviteText = false;
private int loadingDeleteInfo = 0;
private int deleteAccountTTL;
private int loadingLastSeenInfo = 0;
private ArrayList<TLRPC.PrivacyRule> privacyRules = null;
public static class Contact { public static class Contact {
public int id; public int id;
public ArrayList<String> phones = new ArrayList<String>(); public ArrayList<String> phones = new ArrayList<String>();
...@@ -119,6 +124,10 @@ public class ContactsController { ...@@ -119,6 +124,10 @@ public class ContactsController {
contactsLoaded = false; contactsLoaded = false;
contactsBookLoaded = false; contactsBookLoaded = false;
lastContactsVersions = ""; lastContactsVersions = "";
loadingDeleteInfo = 0;
deleteAccountTTL = 0;
loadingLastSeenInfo = 0;
privacyRules = null;
} }
public void checkInviteText() { public void checkInviteText() {
...@@ -1568,6 +1577,81 @@ public class ContactsController { ...@@ -1568,6 +1577,81 @@ public class ContactsController {
}, true, RPCRequest.RPCRequestClassGeneric); }, true, RPCRequest.RPCRequestClassGeneric);
} }
public void loadPrivacySettings() {
if (loadingDeleteInfo == 0) {
loadingDeleteInfo = 1;
TLRPC.TL_account_getAccountTTL req = new TLRPC.TL_account_getAccountTTL();
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() {
if (error == null) {
TLRPC.TL_accountDaysTTL ttl = (TLRPC.TL_accountDaysTTL) response;
deleteAccountTTL = ttl.days;
loadingDeleteInfo = 2;
} else {
loadingDeleteInfo = 0;
}
NotificationCenter.getInstance().postNotificationName(NotificationCenter.privacyRulesUpdated);
}
});
}
});
}
if (loadingLastSeenInfo == 0) {
loadingLastSeenInfo = 1;
TLRPC.TL_account_getPrivacy req = new TLRPC.TL_account_getPrivacy();
req.key = new TLRPC.TL_inputPrivacyKeyStatusTimestamp();
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() {
if (error == null) {
TLRPC.TL_account_privacyRules rules = (TLRPC.TL_account_privacyRules) response;
MessagesController.getInstance().putUsers(rules.users, false);
privacyRules = rules.rules;
loadingLastSeenInfo = 2;
} else {
loadingLastSeenInfo = 0;
}
NotificationCenter.getInstance().postNotificationName(NotificationCenter.privacyRulesUpdated);
}
});
}
});
}
NotificationCenter.getInstance().postNotificationName(NotificationCenter.privacyRulesUpdated);
}
public void setDeleteAccountTTL(int ttl) {
deleteAccountTTL = ttl;
}
public int getDeleteAccountTTL() {
return deleteAccountTTL;
}
public boolean getLoadingDeleteInfo() {
return loadingDeleteInfo != 2;
}
public boolean getLoadingLastSeenInfo() {
return loadingLastSeenInfo != 2;
}
public ArrayList<TLRPC.PrivacyRule> getPrivacyRules() {
return privacyRules;
}
public void setPrivacyRules(ArrayList<TLRPC.PrivacyRule> rules) {
privacyRules = rules;
NotificationCenter.getInstance().postNotificationName(NotificationCenter.privacyRulesUpdated);
}
public static String formatName(String firstName, String lastName) { public static String formatName(String firstName, String lastName) {
String result = null; String result = null;
if (LocaleController.nameDisplayOrder == 1) { if (LocaleController.nameDisplayOrder == 1) {
......
...@@ -427,4 +427,8 @@ public class ImageReceiver { ...@@ -427,4 +427,8 @@ public class ImageReceiver {
bitmapRect = null; bitmapRect = null;
} }
} }
public int getRoundRadius() {
return roundRadius;
}
} }
...@@ -783,7 +783,7 @@ public class LocaleController { ...@@ -783,7 +783,7 @@ public class LocaleController {
public static String formatUserStatus(TLRPC.User user) { public static String formatUserStatus(TLRPC.User user) {
if (user == null || user.status == null || user.status.expires == 0 || user instanceof TLRPC.TL_userDeleted || user instanceof TLRPC.TL_userEmpty) { if (user == null || user.status == null || user.status.expires == 0 || user instanceof TLRPC.TL_userDeleted || user instanceof TLRPC.TL_userEmpty) {
return getString("Offline", R.string.Offline); return getString("ALongTimeAgo", R.string.ALongTimeAgo);
} else { } else {
int currentTime = ConnectionsManager.getInstance().getCurrentTime(); int currentTime = ConnectionsManager.getInstance().getCurrentTime();
if (user.status.expires > currentTime) { if (user.status.expires > currentTime) {
...@@ -791,6 +791,12 @@ public class LocaleController { ...@@ -791,6 +791,12 @@ public class LocaleController {
} else { } else {
if (user.status.expires == -1) { if (user.status.expires == -1) {
return getString("Invisible", R.string.Invisible); return getString("Invisible", R.string.Invisible);
} else if (user.status.expires == -100) {
return getString("Lately", R.string.Lately);
} else if (user.status.expires == -101) {
return getString("WithinAWeek", R.string.WithinAWeek);
} else if (user.status.expires == -102) {
return getString("WithinAMonth", R.string.WithinAMonth);
} else { } else {
return formatDateOnline(user.status.expires); return formatDateOnline(user.status.expires);
} }
......
...@@ -60,7 +60,6 @@ public class MessagesController implements NotificationCenter.NotificationCenter ...@@ -60,7 +60,6 @@ public class MessagesController implements NotificationCenter.NotificationCenter
public boolean loadingBlockedUsers = false; public boolean loadingBlockedUsers = false;
public ArrayList<Integer> blockedUsers = new ArrayList<Integer>(); public ArrayList<Integer> blockedUsers = new ArrayList<Integer>();
public HashMap<Integer, TLRPC.User> hidenAddToContacts = new HashMap<Integer, TLRPC.User>();
private HashMap<Integer, TLRPC.EncryptedChat> acceptingChats = new HashMap<Integer, TLRPC.EncryptedChat>(); private HashMap<Integer, TLRPC.EncryptedChat> acceptingChats = new HashMap<Integer, TLRPC.EncryptedChat>();
private ArrayList<TLRPC.Updates> updatesQueue = new ArrayList<TLRPC.Updates>(); private ArrayList<TLRPC.Updates> updatesQueue = new ArrayList<TLRPC.Updates>();
private ArrayList<Long> pendingEncMessagesToDelete = new ArrayList<Long>(); private ArrayList<Long> pendingEncMessagesToDelete = new ArrayList<Long>();
...@@ -317,7 +316,6 @@ public class MessagesController implements NotificationCenter.NotificationCenter ...@@ -317,7 +316,6 @@ public class MessagesController implements NotificationCenter.NotificationCenter
printingStrings.clear(); printingStrings.clear();
totalDialogsCount = 0; totalDialogsCount = 0;
lastPrintingStringCount = 0; lastPrintingStringCount = 0;
hidenAddToContacts.clear();
updatesQueue.clear(); updatesQueue.clear();
pendingEncMessagesToDelete.clear(); pendingEncMessagesToDelete.clear();
delayedEncryptedChatUpdates.clear(); delayedEncryptedChatUpdates.clear();
...@@ -391,7 +389,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter ...@@ -391,7 +389,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter
if (user == null) { if (user == null) {
return false; return false;
} }
fromCache = fromCache && user.id / 1000 != 333; fromCache = fromCache && user.id / 1000 != 333 && user.id != 777000;
TLRPC.User oldUser = users.get(user.id); TLRPC.User oldUser = users.get(user.id);
if (!fromCache) { if (!fromCache) {
users.put(user.id, user); users.put(user.id, user);
...@@ -758,6 +756,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter ...@@ -758,6 +756,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter
if (user != null) { if (user != null) {
user.photo = UserConfig.getCurrentUser().photo; user.photo = UserConfig.getCurrentUser().photo;
} }
NotificationCenter.getInstance().postNotificationName(NotificationCenter.mainUserInfoChanged);
NotificationCenter.getInstance().postNotificationName(NotificationCenter.updateInterfaces, MessagesController.UPDATE_MASK_ALL); NotificationCenter.getInstance().postNotificationName(NotificationCenter.updateInterfaces, MessagesController.UPDATE_MASK_ALL);
ConnectionsManager.getInstance().performRpc(req, new RPCRequest.RPCRequestDelegate() { ConnectionsManager.getInstance().performRpc(req, new RPCRequest.RPCRequestDelegate() {
@Override @Override
...@@ -1379,7 +1378,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter ...@@ -1379,7 +1378,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter
if (!isCache) { if (!isCache) {
MessagesStorage.getInstance().putMessages(messagesRes, dialog_id); MessagesStorage.getInstance().putMessages(messagesRes, dialog_id);
} }
if (lower_id != 0 && isCache && messagesRes.messages.size() == 0 && (load_type == 0 || load_type == 3)) { if (lower_id != 0 && isCache && messagesRes.messages.size() == 0 && (load_type == 0 || load_type == 2 || load_type == 3)) {
AndroidUtilities.runOnUIThread(new Runnable() { AndroidUtilities.runOnUIThread(new Runnable() {
@Override @Override
public void run() { public void run() {
...@@ -3242,6 +3241,8 @@ public class MessagesController implements NotificationCenter.NotificationCenter ...@@ -3242,6 +3241,8 @@ public class MessagesController implements NotificationCenter.NotificationCenter
} }
arr.add(obj); arr.add(obj);
pushMessages.add(obj); pushMessages.add(obj);
} else if (update instanceof TLRPC.TL_updatePrivacy) {
updatesOnMainThread.add(update);
} }
} }
if (!messages.isEmpty()) { if (!messages.isEmpty()) {
...@@ -3299,7 +3300,18 @@ public class MessagesController implements NotificationCenter.NotificationCenter ...@@ -3299,7 +3300,18 @@ public class MessagesController implements NotificationCenter.NotificationCenter
TLRPC.User toDbUser = new TLRPC.User(); TLRPC.User toDbUser = new TLRPC.User();
toDbUser.id = update.user_id; toDbUser.id = update.user_id;
TLRPC.User currentUser = getUser(update.user_id); TLRPC.User currentUser = getUser(update.user_id);
if (update instanceof TLRPC.TL_updateUserStatus) { if (update instanceof TLRPC.TL_updatePrivacy) {
if (update.key instanceof TLRPC.TL_privacyKeyStatusTimestamp) {
ContactsController.getInstance().setPrivacyRules(update.rules);
}
} else if (update instanceof TLRPC.TL_updateUserStatus) {
if (update.status instanceof TLRPC.TL_userStatusRecently) {
update.status.expires = -100;
} else if (update.status instanceof TLRPC.TL_userStatusLastWeek) {
update.status.expires = -101;
} else if (update.status instanceof TLRPC.TL_userStatusLastMonth) {
update.status.expires = -102;
}
if (currentUser != null) { if (currentUser != null) {
currentUser.id = update.user_id; currentUser.id = update.user_id;
currentUser.status = update.status; currentUser.status = update.status;
......
...@@ -41,6 +41,8 @@ public class NotificationCenter { ...@@ -41,6 +41,8 @@ public class NotificationCenter {
public static final int hideEmojiKeyboard = 30; public static final int hideEmojiKeyboard = 30;
public static final int stopEncodingService = 31; public static final int stopEncodingService = 31;
public static final int didCreatedNewDeleteTask = 32; public static final int didCreatedNewDeleteTask = 32;
public static final int mainUserInfoChanged = 33;
public static final int privacyRulesUpdated = 34;
public static final int wallpapersDidLoaded = 171; public static final int wallpapersDidLoaded = 171;
public static final int closeOtherAppActivities = 702; public static final int closeOtherAppActivities = 702;
......
...@@ -17,7 +17,6 @@ import android.view.Gravity; ...@@ -17,7 +17,6 @@ import android.view.Gravity;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.MotionEvent; import android.view.MotionEvent;
import android.view.View; import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout; import android.widget.FrameLayout;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
...@@ -38,8 +37,6 @@ public class ActionBar extends FrameLayout { ...@@ -38,8 +37,6 @@ public class ActionBar extends FrameLayout {
} }
} }
private static boolean withStatusBar = Build.VERSION.SDK_INT >= 21;
private FrameLayout titleFrameLayout; private FrameLayout titleFrameLayout;
private ImageView backButtonImageView; private ImageView backButtonImageView;
private TextView titleTextView; private TextView titleTextView;
...@@ -47,6 +44,7 @@ public class ActionBar extends FrameLayout { ...@@ -47,6 +44,7 @@ public class ActionBar extends FrameLayout {
private ActionBarMenu menu; private ActionBarMenu menu;
private ActionBarMenu actionMode; private ActionBarMenu actionMode;
private View actionOverlay; private View actionOverlay;
private boolean occupyStatusBar = Build.VERSION.SDK_INT >= 21;
protected boolean isSearchFieldVisible; protected boolean isSearchFieldVisible;
protected int itemsBackgroundResourceId; protected int itemsBackgroundResourceId;
...@@ -64,9 +62,6 @@ public class ActionBar extends FrameLayout { ...@@ -64,9 +62,6 @@ public class ActionBar extends FrameLayout {
layoutParams.width = LayoutParams.WRAP_CONTENT; layoutParams.width = LayoutParams.WRAP_CONTENT;
layoutParams.height = LayoutParams.FILL_PARENT; layoutParams.height = LayoutParams.FILL_PARENT;
layoutParams.gravity = Gravity.TOP | Gravity.LEFT; layoutParams.gravity = Gravity.TOP | Gravity.LEFT;
if (withStatusBar) {
layoutParams.topMargin = AndroidUtilities.statusBarHeight;
}
titleFrameLayout.setLayoutParams(layoutParams); titleFrameLayout.setLayoutParams(layoutParams);
titleFrameLayout.setPadding(0, 0, AndroidUtilities.dp(4), 0); titleFrameLayout.setPadding(0, 0, AndroidUtilities.dp(4), 0);
titleFrameLayout.setEnabled(false); titleFrameLayout.setEnabled(false);
...@@ -162,8 +157,9 @@ public class ActionBar extends FrameLayout { ...@@ -162,8 +157,9 @@ public class ActionBar extends FrameLayout {
subTitleTextView.setLayoutParams(layoutParams); subTitleTextView.setLayoutParams(layoutParams);
} }
ViewGroup.LayoutParams layoutParams1 = titleFrameLayout.getLayoutParams(); MarginLayoutParams layoutParams1 = (MarginLayoutParams) titleFrameLayout.getLayoutParams();
layoutParams1.width = x + maxTextWidth + (isSearchFieldVisible ? 0 : AndroidUtilities.dp(6)); layoutParams1.width = x + maxTextWidth + (isSearchFieldVisible ? 0 : AndroidUtilities.dp(6));
layoutParams1.topMargin = occupyStatusBar ? AndroidUtilities.statusBarHeight : 0;
titleFrameLayout.setLayoutParams(layoutParams1); titleFrameLayout.setLayoutParams(layoutParams1);
} }
...@@ -175,9 +171,7 @@ public class ActionBar extends FrameLayout { ...@@ -175,9 +171,7 @@ public class ActionBar extends FrameLayout {
layoutParams.width = isSearchFieldVisible ? LayoutParams.MATCH_PARENT : LayoutParams.WRAP_CONTENT; layoutParams.width = isSearchFieldVisible ? LayoutParams.MATCH_PARENT : LayoutParams.WRAP_CONTENT;
layoutParams.height = height; layoutParams.height = height;
layoutParams.leftMargin = isSearchFieldVisible ? AndroidUtilities.dp(54) : 0; layoutParams.leftMargin = isSearchFieldVisible ? AndroidUtilities.dp(54) : 0;
if (withStatusBar) { layoutParams.topMargin = occupyStatusBar ? AndroidUtilities.statusBarHeight : 0;
layoutParams.topMargin = AndroidUtilities.statusBarHeight;
}
menu.setLayoutParams(layoutParams); menu.setLayoutParams(layoutParams);
menu.measure(width, height); menu.measure(width, height);
} }
...@@ -330,9 +324,7 @@ public class ActionBar extends FrameLayout { ...@@ -330,9 +324,7 @@ public class ActionBar extends FrameLayout {
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams)view.getLayoutParams(); FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams)view.getLayoutParams();
layoutParams.width = LayoutParams.FILL_PARENT; layoutParams.width = LayoutParams.FILL_PARENT;
layoutParams.height = LayoutParams.FILL_PARENT; layoutParams.height = LayoutParams.FILL_PARENT;
if (withStatusBar) { layoutParams.topMargin = occupyStatusBar ? AndroidUtilities.statusBarHeight : 0;
layoutParams.topMargin = AndroidUtilities.statusBarHeight;
}
view.setLayoutParams(layoutParams); view.setLayoutParams(layoutParams);
} }
...@@ -343,13 +335,11 @@ public class ActionBar extends FrameLayout { ...@@ -343,13 +335,11 @@ public class ActionBar extends FrameLayout {
actionMode = new ActionBarMenu(getContext(), this); actionMode = new ActionBarMenu(getContext(), this);
actionMode.setBackgroundResource(R.drawable.editheader); actionMode.setBackgroundResource(R.drawable.editheader);
addView(actionMode); addView(actionMode);
actionMode.setPadding(0, occupyStatusBar ? AndroidUtilities.statusBarHeight : 0, 0, 0);
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams)actionMode.getLayoutParams(); FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams)actionMode.getLayoutParams();
layoutParams.height = LayoutParams.FILL_PARENT; layoutParams.height = LayoutParams.FILL_PARENT;
layoutParams.width = LayoutParams.FILL_PARENT; layoutParams.width = LayoutParams.FILL_PARENT;
layoutParams.gravity = Gravity.RIGHT; layoutParams.gravity = Gravity.RIGHT;
if (withStatusBar) {
layoutParams.topMargin = AndroidUtilities.statusBarHeight;
}
actionMode.setLayoutParams(layoutParams); actionMode.setLayoutParams(layoutParams);
actionMode.setVisibility(GONE); actionMode.setVisibility(GONE);
return actionMode; return actionMode;
...@@ -414,9 +404,7 @@ public class ActionBar extends FrameLayout { ...@@ -414,9 +404,7 @@ public class ActionBar extends FrameLayout {
positionMenu(MeasureSpec.getSize(widthMeasureSpec), actionBarHeight); positionMenu(MeasureSpec.getSize(widthMeasureSpec), actionBarHeight);
positionTitle(MeasureSpec.getSize(widthMeasureSpec), actionBarHeight); positionTitle(MeasureSpec.getSize(widthMeasureSpec), actionBarHeight);
positionBackOverlay(MeasureSpec.getSize(widthMeasureSpec), actionBarHeight); positionBackOverlay(MeasureSpec.getSize(widthMeasureSpec), actionBarHeight);
if (Build.VERSION.SDK_INT >= 21) { actionBarHeight += occupyStatusBar ? AndroidUtilities.statusBarHeight : 0;
actionBarHeight += AndroidUtilities.statusBarHeight;
}
super.onMeasure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(actionBarHeight + extraHeight, MeasureSpec.EXACTLY)); super.onMeasure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(actionBarHeight + extraHeight, MeasureSpec.EXACTLY));
} }
...@@ -495,14 +483,20 @@ public class ActionBar extends FrameLayout { ...@@ -495,14 +483,20 @@ public class ActionBar extends FrameLayout {
layoutParams.height = LayoutParams.MATCH_PARENT; layoutParams.height = LayoutParams.MATCH_PARENT;
actionOverlay.setLayoutParams(layoutParams); actionOverlay.setLayoutParams(layoutParams);
actionOverlay.measure(widthMeasureSpec, heightMeasureSpec); actionOverlay.measure(widthMeasureSpec, heightMeasureSpec);
if (withStatusBar) { layoutParams.topMargin = occupyStatusBar ? AndroidUtilities.statusBarHeight : 0;
layoutParams.topMargin = AndroidUtilities.statusBarHeight;
}
layoutParams.width = Math.min(actionOverlay.getMeasuredWidth() + AndroidUtilities.dp(4), widthMeasureSpec - (menu != null ? menu.getMeasuredWidth() : 0)); layoutParams.width = Math.min(actionOverlay.getMeasuredWidth() + AndroidUtilities.dp(4), widthMeasureSpec - (menu != null ? menu.getMeasuredWidth() : 0));
actionOverlay.setLayoutParams(layoutParams); actionOverlay.setLayoutParams(layoutParams);
} }
} }
public void setOccupyStatusBar(boolean value) {
occupyStatusBar = value;
}
public boolean getOccupyStatusBar() {
return occupyStatusBar;
}
public void setItemsBackground(int resourceId) { public void setItemsBackground(int resourceId) {
itemsBackgroundResourceId = resourceId; itemsBackgroundResourceId = resourceId;
if (backButtonImageView != null) { if (backButtonImageView != null) {
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
package org.telegram.ui.ActionBar; package org.telegram.ui.ActionBar;
import android.content.Context; import android.content.Context;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
...@@ -58,19 +59,31 @@ public class ActionBarMenu extends LinearLayout { ...@@ -58,19 +59,31 @@ public class ActionBarMenu extends LinearLayout {
return view; return view;
} }
public ActionBarMenuItem addItem(int id, Drawable drawable) {
return addItem(id, 0, parentActionBar.itemsBackgroundResourceId, drawable, AndroidUtilities.dp(48));
}
public ActionBarMenuItem addItem(int id, int icon) { public ActionBarMenuItem addItem(int id, int icon) {
return addItem(id, icon, parentActionBar.itemsBackgroundResourceId); return addItem(id, icon, parentActionBar.itemsBackgroundResourceId);
} }
public ActionBarMenuItem addItem(int id, int icon, int backgroundResource) { public ActionBarMenuItem addItem(int id, int icon, int backgroundResource) {
return addItem(id, icon, parentActionBar.itemsBackgroundResourceId, AndroidUtilities.dp(48)); return addItem(id, icon, backgroundResource, null, AndroidUtilities.dp(48));
}
public ActionBarMenuItem addItemWithWidth(int id, int icon, int width) {
return addItem(id, icon, parentActionBar.itemsBackgroundResourceId, null, width);
} }
public ActionBarMenuItem addItem(int id, int icon, int backgroundResource, int width) { public ActionBarMenuItem addItem(int id, int icon, int backgroundResource, Drawable drawable, int width) {
ActionBarMenuItem menuItem = new ActionBarMenuItem(getContext(), this, backgroundResource); ActionBarMenuItem menuItem = new ActionBarMenuItem(getContext(), this, backgroundResource);
menuItem.setTag(id); menuItem.setTag(id);
menuItem.setScaleType(ImageView.ScaleType.CENTER); menuItem.setScaleType(ImageView.ScaleType.CENTER);
if (drawable != null) {
menuItem.setImageDrawable(drawable);
} else {
menuItem.setImageResource(icon); menuItem.setImageResource(icon);
}
addView(menuItem); addView(menuItem);
LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams)menuItem.getLayoutParams(); LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams)menuItem.getLayoutParams();
layoutParams.height = FrameLayout.LayoutParams.MATCH_PARENT; layoutParams.height = FrameLayout.LayoutParams.MATCH_PARENT;
......
...@@ -54,7 +54,7 @@ public class ActionBarMenuItem extends ImageView { ...@@ -54,7 +54,7 @@ public class ActionBarMenuItem extends ImageView {
private View selectedMenuView; private View selectedMenuView;
private Runnable showMenuRunnable; private Runnable showMenuRunnable;
private boolean showFromBottom; private boolean showFromBottom;
private int height; private int menuHeight = AndroidUtilities.dp(16);
public ActionBarMenuItem(Context context, ActionBarMenu menu, int background) { public ActionBarMenuItem(Context context, ActionBarMenu menu, int background) {
super(context); super(context);
...@@ -135,7 +135,7 @@ public class ActionBarMenuItem extends ImageView { ...@@ -135,7 +135,7 @@ public class ActionBarMenuItem extends ImageView {
showFromBottom = value; showFromBottom = value;
} }
public void addSubItem(int id, String text, int icon) { public TextView addSubItem(int id, String text, int icon) {
if (popupLayout == null) { if (popupLayout == null) {
rect = new Rect(); rect = new Rect();
location = new int[2]; location = new int[2];
...@@ -166,7 +166,7 @@ public class ActionBarMenuItem extends ImageView { ...@@ -166,7 +166,7 @@ public class ActionBarMenuItem extends ImageView {
}); });
} }
TextView textView = new TextView(getContext()); TextView textView = new TextView(getContext());
textView.setTextColor(0xff000000); textView.setTextColor(0xff212121);
textView.setBackgroundResource(R.drawable.list_selector); textView.setBackgroundResource(R.drawable.list_selector);
if (!LocaleController.isRTL) { if (!LocaleController.isRTL) {
textView.setGravity(Gravity.CENTER_VERTICAL); textView.setGravity(Gravity.CENTER_VERTICAL);
...@@ -203,6 +203,8 @@ public class ActionBarMenuItem extends ImageView { ...@@ -203,6 +203,8 @@ public class ActionBarMenuItem extends ImageView {
} }
} }
}); });
menuHeight += layoutParams.height;
return textView;
} }
public boolean hasSubMenu() { public boolean hasSubMenu() {
...@@ -245,25 +247,31 @@ public class ActionBarMenuItem extends ImageView { ...@@ -245,25 +247,31 @@ public class ActionBarMenuItem extends ImageView {
popupWindow.setFocusable(true); popupWindow.setFocusable(true);
if (popupLayout.getMeasuredWidth() == 0) { if (popupLayout.getMeasuredWidth() == 0) {
if (showFromBottom) { if (showFromBottom) {
popupWindow.showAsDropDown(this, -popupLayout.getMeasuredWidth() + getMeasuredWidth() + AndroidUtilities.dp(12), -popupLayout.getMeasuredHeight() + AndroidUtilities.dp(12)); popupWindow.showAsDropDown(this, -popupLayout.getMeasuredWidth() + getMeasuredWidth() + AndroidUtilities.dp(14), getBottomOffsetY());
popupWindow.update(this, -popupLayout.getMeasuredWidth() + getMeasuredWidth() + AndroidUtilities.dp(12), -popupLayout.getMeasuredHeight() + AndroidUtilities.dp(12), -1, -1); popupWindow.update(this, -popupLayout.getMeasuredWidth() + getMeasuredWidth() + AndroidUtilities.dp(14), getBottomOffsetY(), -1, -1);
height = popupLayout.getMeasuredHeight();
} else { } else {
popupWindow.showAsDropDown(this, parentMenu.parentActionBar.getMeasuredWidth() - popupLayout.getMeasuredWidth() - getLeft() - parentMenu.getLeft(), -getMeasuredHeight()); 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); popupWindow.update(this, parentMenu.parentActionBar.getMeasuredWidth() - popupLayout.getMeasuredWidth() - getLeft() - parentMenu.getLeft(), -getMeasuredHeight(), -1, -1);
} }
} else { } else {
if (showFromBottom) { if (showFromBottom) {
if (height == 0) { popupWindow.showAsDropDown(this, -popupLayout.getMeasuredWidth() + getMeasuredWidth() + AndroidUtilities.dp(14), getBottomOffsetY());
height = popupLayout.getMeasuredHeight();
}
popupWindow.showAsDropDown(this, -popupLayout.getMeasuredWidth() + getMeasuredWidth() + AndroidUtilities.dp(12), -height + AndroidUtilities.dp(12));
} else { } else {
popupWindow.showAsDropDown(this, parentMenu.parentActionBar.getMeasuredWidth() - popupLayout.getMeasuredWidth() - getLeft() - parentMenu.getLeft(), -getMeasuredHeight()); popupWindow.showAsDropDown(this, parentMenu.parentActionBar.getMeasuredWidth() - popupLayout.getMeasuredWidth() - getLeft() - parentMenu.getLeft(), -getMeasuredHeight());
} }
} }
} }
private int getBottomOffsetY() {
getLocationOnScreen(location);
int diff = location[1] - (Build.VERSION.SDK_INT >= 21 ? AndroidUtilities.statusBarHeight : 0) + getMeasuredHeight() - menuHeight;
int y = AndroidUtilities.dp(8) - menuHeight;
if (diff < 0) {
y -= diff;
}
return y;
}
public boolean toggleSearch() { public boolean toggleSearch() {
if (searchField == null) { if (searchField == null) {
return false; return false;
...@@ -407,7 +415,7 @@ public class ActionBarMenuItem extends ImageView { ...@@ -407,7 +415,7 @@ public class ActionBarMenuItem extends ImageView {
super.onLayout(changed, left, top, right, bottom); super.onLayout(changed, left, top, right, bottom);
if (popupWindow != null && popupWindow.isShowing()) { if (popupWindow != null && popupWindow.isShowing()) {
if (showFromBottom) { if (showFromBottom) {
popupWindow.update(this, -popupLayout.getMeasuredWidth() + getMeasuredWidth() + AndroidUtilities.dp(12), -height + AndroidUtilities.dp(12), -1, -1); popupWindow.update(this, -popupLayout.getMeasuredWidth() + getMeasuredWidth() + AndroidUtilities.dp(14), getBottomOffsetY(), -1, -1);
} else { } else {
popupWindow.update(this, parentMenu.parentActionBar.getMeasuredWidth() - popupLayout.getMeasuredWidth() - getLeft() - parentMenu.getLeft(), -getMeasuredHeight(), -1, -1); popupWindow.update(this, parentMenu.parentActionBar.getMeasuredWidth() - popupLayout.getMeasuredWidth() - getLeft() - parentMenu.getLeft(), -getMeasuredHeight(), -1, -1);
} }
......
...@@ -320,7 +320,7 @@ public class DrawerLayoutContainer extends FrameLayout { ...@@ -320,7 +320,7 @@ public class DrawerLayoutContainer extends FrameLayout {
} }
} }
} }
if (startedTracking) { if (startedTracking || drawerPosition != 0 && drawerPosition != drawerLayout.getMeasuredWidth()) {
float velX = velocityTracker.getXVelocity(); float velX = velocityTracker.getXVelocity();
float velY = velocityTracker.getYVelocity(); float velY = velocityTracker.getYVelocity();
boolean backAnimation = drawerPosition < drawerLayout.getMeasuredWidth() / 2.0f && (velX < 1500 || Math.abs(velX) < Math.abs(velY)) || velX < 0 && Math.abs(velX) >= 1500; boolean backAnimation = drawerPosition < drawerLayout.getMeasuredWidth() / 2.0f && (velX < 1500 || Math.abs(velX) < Math.abs(velY)) || velX < 0 && Math.abs(velX) >= 1500;
...@@ -458,10 +458,12 @@ public class DrawerLayoutContainer extends FrameLayout { ...@@ -458,10 +458,12 @@ public class DrawerLayoutContainer extends FrameLayout {
canvas.drawRect(clipLeft, 0, clipRight, getHeight(), scrimPaint); canvas.drawRect(clipLeft, 0, clipRight, getHeight(), scrimPaint);
} else if (shadowLeft != null) { } else if (shadowLeft != null) {
final float alpha = Math.max(0, Math.min((float) drawerPosition / AndroidUtilities.dp(20), 1.0f)); final float alpha = Math.max(0, Math.min((float) drawerPosition / AndroidUtilities.dp(20), 1.0f));
if (alpha != 0) {
shadowLeft.setBounds(drawerPosition, child.getTop(), drawerPosition + shadowLeft.getIntrinsicWidth(), child.getBottom()); shadowLeft.setBounds(drawerPosition, child.getTop(), drawerPosition + shadowLeft.getIntrinsicWidth(), child.getBottom());
shadowLeft.setAlpha((int) (0xff * alpha)); shadowLeft.setAlpha((int) (0xff * alpha));
shadowLeft.draw(canvas); shadowLeft.draw(canvas);
} }
}
return result; return result;
} }
} }
...@@ -247,6 +247,7 @@ public class ContactsSearchAdapter extends BaseContactsSearchAdapter { ...@@ -247,6 +247,7 @@ public class ContactsSearchAdapter extends BaseContactsSearchAdapter {
((UserCell) view).setChecked(checkedMap.containsKey(user.id)); ((UserCell) view).setChecked(checkedMap.containsKey(user.id));
} }
} else { } else {
((ProfileSearchCell) view).setData(user, null, null, name, username);
((ProfileSearchCell) view).useSeparator = (i != getCount() - 1 && i != searchResult.size() - 1); ((ProfileSearchCell) view).useSeparator = (i != getCount() - 1 && i != searchResult.size() - 1);
if (ignoreUsers != null) { if (ignoreUsers != null) {
if (ignoreUsers.containsKey(user.id)) { if (ignoreUsers.containsKey(user.id)) {
......
...@@ -18,12 +18,33 @@ import org.telegram.ui.Animation.AnimatorListenerAdapter10; ...@@ -18,12 +18,33 @@ import org.telegram.ui.Animation.AnimatorListenerAdapter10;
import org.telegram.ui.Animation.AnimatorSet10; import org.telegram.ui.Animation.AnimatorSet10;
import org.telegram.ui.Animation.View10; import org.telegram.ui.Animation.View10;
import java.lang.reflect.Array;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
public class AnimatorSetProxy { public class AnimatorSetProxy {
private Object animatorSet; private Object animatorSet;
public static <T, U> T[] copyOf(U[] original, int newLength, Class<? extends T[]> newType) {
return copyOfRange(original, 0, newLength, newType);
}
@SuppressWarnings("unchecked")
public static <T, U> T[] copyOfRange(U[] original, int start, int end, Class<? extends T[]> newType) {
if (start > end) {
throw new IllegalArgumentException();
}
int originalLength = original.length;
if (start < 0 || start > originalLength) {
throw new ArrayIndexOutOfBoundsException();
}
int resultLength = end - start;
int copyLength = Math.min(resultLength, originalLength - start);
T[] result = (T[]) Array.newInstance(newType.getComponentType(), resultLength);
System.arraycopy(original, start, result, 0, copyLength);
return result;
}
public AnimatorSetProxy() { public AnimatorSetProxy() {
if (View10.NEED_PROXY) { if (View10.NEED_PROXY) {
animatorSet = new AnimatorSet10(); animatorSet = new AnimatorSet10();
...@@ -32,12 +53,13 @@ public class AnimatorSetProxy { ...@@ -32,12 +53,13 @@ public class AnimatorSetProxy {
} }
} }
@SuppressWarnings("unchecked")
public void playTogether(Object... items) { public void playTogether(Object... items) {
if (View10.NEED_PROXY) { if (View10.NEED_PROXY) {
Animator10[] animators = Arrays.copyOf(items, items.length, Animator10[].class); Animator10[] animators = copyOf(items, items.length, Animator10[].class);
((AnimatorSet10) animatorSet).playTogether(animators); ((AnimatorSet10) animatorSet).playTogether(animators);
} else { } else {
Animator[] animators = Arrays.copyOf(items, items.length, Animator[].class); Animator[] animators = copyOf(items, items.length, Animator[].class);
((AnimatorSet) animatorSet).playTogether(animators); ((AnimatorSet) animatorSet).playTogether(animators);
} }
} }
...@@ -98,4 +120,9 @@ public class AnimatorSetProxy { ...@@ -98,4 +120,9 @@ public class AnimatorSetProxy {
((AnimatorSet) animatorSet).setInterpolator(interpolator); ((AnimatorSet) animatorSet).setInterpolator(interpolator);
} }
} }
@Override
public boolean equals(Object o) {
return animatorSet == o;
}
} }
...@@ -8,9 +8,11 @@ ...@@ -8,9 +8,11 @@
package org.telegram.ui.AnimationCompat; package org.telegram.ui.AnimationCompat;
import android.animation.AnimatorListenerAdapter;
import android.animation.ObjectAnimator; import android.animation.ObjectAnimator;
import android.view.animation.Interpolator; import android.view.animation.Interpolator;
import org.telegram.ui.Animation.AnimatorListenerAdapter10;
import org.telegram.ui.Animation.ObjectAnimator10; import org.telegram.ui.Animation.ObjectAnimator10;
import org.telegram.ui.Animation.View10; import org.telegram.ui.Animation.View10;
...@@ -110,4 +112,13 @@ public class ObjectAnimatorProxy { ...@@ -110,4 +112,13 @@ public class ObjectAnimatorProxy {
((ObjectAnimator) objectAnimator).cancel(); ((ObjectAnimator) objectAnimator).cancel();
} }
} }
public ObjectAnimatorProxy addListener(AnimatorListenerAdapterProxy listener) {
if (View10.NEED_PROXY) {
((ObjectAnimator10) objectAnimator).addListener((AnimatorListenerAdapter10) listener.animatorListenerAdapter);
} else {
((ObjectAnimator) objectAnimator).addListener((AnimatorListenerAdapter) listener.animatorListenerAdapter);
}
return this;
}
} }
...@@ -38,6 +38,7 @@ import org.telegram.ui.ActionBar.ActionBarMenu; ...@@ -38,6 +38,7 @@ import org.telegram.ui.ActionBar.ActionBarMenu;
import org.telegram.ui.ActionBar.BaseFragment; import org.telegram.ui.ActionBar.BaseFragment;
public class BlockedUsersActivity extends BaseFragment implements NotificationCenter.NotificationCenterDelegate, ContactsActivity.ContactsActivityDelegate { public class BlockedUsersActivity extends BaseFragment implements NotificationCenter.NotificationCenterDelegate, ContactsActivity.ContactsActivityDelegate {
private ListView listView; private ListView listView;
private ListAdapter listViewAdapter; private ListAdapter listViewAdapter;
private FrameLayout progressView; private FrameLayout progressView;
...@@ -93,7 +94,7 @@ public class BlockedUsersActivity extends BaseFragment implements NotificationCe ...@@ -93,7 +94,7 @@ public class BlockedUsersActivity extends BaseFragment implements NotificationCe
emptyTextView = new TextView(getParentActivity()); emptyTextView = new TextView(getParentActivity());
emptyTextView.setTextColor(0xff808080); emptyTextView.setTextColor(0xff808080);
emptyTextView.setTextSize(24); emptyTextView.setTextSize(20);
emptyTextView.setGravity(Gravity.CENTER); emptyTextView.setGravity(Gravity.CENTER);
emptyTextView.setVisibility(View.INVISIBLE); emptyTextView.setVisibility(View.INVISIBLE);
emptyTextView.setText(LocaleController.getString("NoBlocked", R.string.NoBlocked)); emptyTextView.setText(LocaleController.getString("NoBlocked", R.string.NoBlocked));
......
...@@ -74,6 +74,7 @@ public class ChatActionCell extends BaseCell { ...@@ -74,6 +74,7 @@ public class ChatActionCell extends BaseCell {
textPaint.linkColor = 0xffffffff; textPaint.linkColor = 0xffffffff;
} }
imageReceiver = new ImageReceiver(this); imageReceiver = new ImageReceiver(this);
imageReceiver.setRoundRadius(AndroidUtilities.dp(32));
avatarDrawable = new AvatarDrawable(); avatarDrawable = new AvatarDrawable();
textPaint.setTextSize(AndroidUtilities.dp(MessagesController.getInstance().fontSize)); textPaint.setTextSize(AndroidUtilities.dp(MessagesController.getInstance().fontSize));
} }
......
...@@ -65,6 +65,7 @@ public class ChatAudioCell extends ChatBaseCell implements SeekBar.SeekBarDelega ...@@ -65,6 +65,7 @@ public class ChatAudioCell extends ChatBaseCell implements SeekBar.SeekBarDelega
TAG = MediaController.getInstance().generateObserverTag(); TAG = MediaController.getInstance().generateObserverTag();
avatarImage = new ImageReceiver(this); avatarImage = new ImageReceiver(this);
avatarImage.setRoundRadius(AndroidUtilities.dp(25));
seekBar = new SeekBar(context); seekBar = new SeekBar(context);
seekBar.delegate = this; seekBar.delegate = this;
progressView = new ProgressView(); progressView = new ProgressView();
......
...@@ -156,6 +156,7 @@ public class ChatBaseCell extends BaseCell { ...@@ -156,6 +156,7 @@ public class ChatBaseCell extends BaseCell {
forwardNamePaint.setTextSize(AndroidUtilities.dp(14)); forwardNamePaint.setTextSize(AndroidUtilities.dp(14));
} }
avatarImage = new ImageReceiver(this); avatarImage = new ImageReceiver(this);
avatarImage.setRoundRadius(AndroidUtilities.dp(21));
avatarDrawable = new AvatarDrawable(); avatarDrawable = new AvatarDrawable();
} }
......
...@@ -66,12 +66,13 @@ public class ChatContactCell extends ChatBaseCell { ...@@ -66,12 +66,13 @@ public class ChatContactCell extends ChatBaseCell {
phonePaint = new TextPaint(TextPaint.ANTI_ALIAS_FLAG); phonePaint = new TextPaint(TextPaint.ANTI_ALIAS_FLAG);
phonePaint.setTextSize(AndroidUtilities.dp(15)); phonePaint.setTextSize(AndroidUtilities.dp(15));
phonePaint.setColor(0xff000000); phonePaint.setColor(0xff212121);
addContactDrawableIn = getResources().getDrawable(R.drawable.addcontact_blue); addContactDrawableIn = getResources().getDrawable(R.drawable.addcontact_blue);
addContactDrawableOut = getResources().getDrawable(R.drawable.addcontact_green); addContactDrawableOut = getResources().getDrawable(R.drawable.addcontact_green);
} }
avatarImage = new ImageReceiver(this); avatarImage = new ImageReceiver(this);
avatarImage.setRoundRadius(AndroidUtilities.dp(21));
avatarDrawable = new AvatarDrawable(); avatarDrawable = new AvatarDrawable();
} }
......
...@@ -133,7 +133,7 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD ...@@ -133,7 +133,7 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD
infoPaint.setTextSize(AndroidUtilities.dp(12)); infoPaint.setTextSize(AndroidUtilities.dp(12));
namePaint = new TextPaint(Paint.ANTI_ALIAS_FLAG); namePaint = new TextPaint(Paint.ANTI_ALIAS_FLAG);
namePaint.setColor(0xff000000); namePaint.setColor(0xff212121);
namePaint.setTextSize(AndroidUtilities.dp(16)); namePaint.setTextSize(AndroidUtilities.dp(16));
docBackPaint = new Paint(); docBackPaint = new Paint();
...@@ -827,7 +827,7 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD ...@@ -827,7 +827,7 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD
menuDrawable = docMenuInDrawable; menuDrawable = docMenuInDrawable;
} }
setDrawableBounds(menuDrawable, photoImage.getImageX() + backgroundWidth - AndroidUtilities.dp(50), AndroidUtilities.dp(10)); setDrawableBounds(menuDrawable, photoImage.getImageX() + backgroundWidth - AndroidUtilities.dp(44), AndroidUtilities.dp(10));
menuDrawable.draw(canvas); menuDrawable.draw(canvas);
if (!imageDrawn) { if (!imageDrawn) {
......
...@@ -566,29 +566,35 @@ public class DialogCell extends BaseCell { ...@@ -566,29 +566,35 @@ public class DialogCell extends BaseCell {
continueUpdate = true; continueUpdate = true;
} }
} }
if ((mask & MessagesController.UPDATE_MASK_AVATAR) != 0) { if (!continueUpdate && (mask & MessagesController.UPDATE_MASK_AVATAR) != 0) {
if (chat == null) { if (chat == null) {
continueUpdate = true; continueUpdate = true;
} }
} }
if ((mask & MessagesController.UPDATE_MASK_NAME) != 0) { if (!continueUpdate && (mask & MessagesController.UPDATE_MASK_NAME) != 0) {
if (chat == null) { if (chat == null) {
continueUpdate = true; continueUpdate = true;
} }
} }
if ((mask & MessagesController.UPDATE_MASK_CHAT_AVATAR) != 0) { if (!continueUpdate && (mask & MessagesController.UPDATE_MASK_CHAT_AVATAR) != 0) {
if (user == null) { if (user == null) {
continueUpdate = true; continueUpdate = true;
} }
} }
if ((mask & MessagesController.UPDATE_MASK_CHAT_NAME) != 0) { if (!continueUpdate && (mask & MessagesController.UPDATE_MASK_CHAT_NAME) != 0) {
if (user == null) { if (user == null) {
continueUpdate = true; continueUpdate = true;
} }
} }
if ((mask & MessagesController.UPDATE_MASK_READ_DIALOG_MESSAGE) != 0) { if (!continueUpdate && (mask & MessagesController.UPDATE_MASK_READ_DIALOG_MESSAGE) != 0) {
if (message != null && lastUnreadState != message.isUnread()) { if (message != null && lastUnreadState != message.isUnread()) {
continueUpdate = true; continueUpdate = true;
} else if (allowPrintStrings) {
TLRPC.TL_dialog dialog = MessagesController.getInstance().dialogs_dict.get(currentDialogId);
if (dialog != null && unreadCount != dialog.unread_count) {
unreadCount = dialog.unread_count;
continueUpdate = true;
}
} }
} }
......
/*
* 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.Cells;
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import org.telegram.android.AndroidUtilities;
import org.telegram.messenger.R;
public class ShadowBottomSectionCell extends View {
private void init() {
setBackgroundResource(R.drawable.greydivider_bottom);
}
public ShadowBottomSectionCell(Context context) {
super(context);
init();
}
public ShadowBottomSectionCell(Context context, AttributeSet attrs) {
super(context, attrs);
init();
}
public ShadowBottomSectionCell(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
init();
}
public ShadowBottomSectionCell(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
init();
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(6), MeasureSpec.EXACTLY));
}
}
...@@ -31,7 +31,7 @@ public class TextCell extends FrameLayout { ...@@ -31,7 +31,7 @@ public class TextCell extends FrameLayout {
super(context); super(context);
textView = new TextView(context); textView = new TextView(context);
textView.setTextColor(0xff000000); textView.setTextColor(0xff212121);
textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16); textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
textView.setLines(1); textView.setLines(1);
textView.setMaxLines(1); textView.setMaxLines(1);
......
...@@ -18,9 +18,10 @@ import android.widget.TextView; ...@@ -18,9 +18,10 @@ import android.widget.TextView;
import org.telegram.android.AndroidUtilities; import org.telegram.android.AndroidUtilities;
import org.telegram.android.LocaleController; import org.telegram.android.LocaleController;
import org.telegram.ui.Views.FrameLayoutFixed;
import org.telegram.ui.Views.Switch; import org.telegram.ui.Views.Switch;
public class TextCheckCell extends FrameLayout { public class TextCheckCell extends FrameLayoutFixed {
private TextView textView; private TextView textView;
private Switch checkBox; private Switch checkBox;
...@@ -37,7 +38,7 @@ public class TextCheckCell extends FrameLayout { ...@@ -37,7 +38,7 @@ public class TextCheckCell extends FrameLayout {
} }
textView = new TextView(context); textView = new TextView(context);
textView.setTextColor(0xff000000); textView.setTextColor(0xff212121);
textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16); textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
textView.setLines(1); textView.setLines(1);
textView.setMaxLines(1); textView.setMaxLines(1);
......
...@@ -40,7 +40,7 @@ public class TextColorCell extends FrameLayout { ...@@ -40,7 +40,7 @@ public class TextColorCell extends FrameLayout {
} }
textView = new TextView(context); textView = new TextView(context);
textView.setTextColor(0xff000000); textView.setTextColor(0xff212121);
textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16); textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
textView.setLines(1); textView.setLines(1);
textView.setMaxLines(1); textView.setMaxLines(1);
......
...@@ -29,7 +29,7 @@ public class TextDetailCell extends FrameLayout { ...@@ -29,7 +29,7 @@ public class TextDetailCell extends FrameLayout {
super(context); super(context);
textView = new TextView(context); textView = new TextView(context);
textView.setTextColor(0xff000000); textView.setTextColor(0xff212121);
textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16); textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
textView.setLines(1); textView.setLines(1);
textView.setMaxLines(1); textView.setMaxLines(1);
......
/*
* 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.Cells;
import android.content.Context;
import android.graphics.Typeface;
import android.text.TextUtils;
import android.util.TypedValue;
import android.view.Gravity;
import android.widget.FrameLayout;
import android.widget.TextView;
import org.telegram.android.AndroidUtilities;
import org.telegram.android.LocaleController;
import org.telegram.ui.Views.BackupImageView;
public class TextDetailDocumentsCell extends FrameLayout {
private TextView textView;
private TextView valueTextView;
private TextView typeTextView;
private BackupImageView imageView;
public TextDetailDocumentsCell(Context context) {
super(context);
textView = new TextView(context);
textView.setTextColor(0xff212121);
textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
textView.setLines(1);
textView.setMaxLines(1);
textView.setSingleLine(true);
textView.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT);
addView(textView);
LayoutParams layoutParams = (LayoutParams) textView.getLayoutParams();
layoutParams.width = LayoutParams.WRAP_CONTENT;
layoutParams.height = LayoutParams.WRAP_CONTENT;
layoutParams.topMargin = AndroidUtilities.dp(10);
layoutParams.leftMargin = AndroidUtilities.dp(LocaleController.isRTL ? 16 : 71);
layoutParams.rightMargin = AndroidUtilities.dp(LocaleController.isRTL ? 71 : 16);
layoutParams.gravity = LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT;
textView.setLayoutParams(layoutParams);
valueTextView = new TextView(context);
valueTextView.setTextColor(0xff8a8a8a);
valueTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 13);
valueTextView.setLines(1);
valueTextView.setMaxLines(1);
valueTextView.setSingleLine(true);
valueTextView.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT);
addView(valueTextView);
layoutParams = (LayoutParams) valueTextView.getLayoutParams();
layoutParams.width = LayoutParams.WRAP_CONTENT;
layoutParams.height = LayoutParams.WRAP_CONTENT;
layoutParams.topMargin = AndroidUtilities.dp(35);
layoutParams.leftMargin = AndroidUtilities.dp(LocaleController.isRTL ? 16 : 71);
layoutParams.rightMargin = AndroidUtilities.dp(LocaleController.isRTL ? 71 : 16);
layoutParams.gravity = LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT;
valueTextView.setLayoutParams(layoutParams);
typeTextView = new TextView(context);
typeTextView.setBackgroundColor(0xff757575);
typeTextView.setEllipsize(TextUtils.TruncateAt.MARQUEE);
typeTextView.setGravity(Gravity.CENTER);
typeTextView.setSingleLine(true);
typeTextView.setTextColor(0xffd1d1d1);
typeTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
typeTextView.setTypeface(Typeface.DEFAULT_BOLD);
addView(typeTextView);
layoutParams = (LayoutParams) typeTextView.getLayoutParams();
layoutParams.width = AndroidUtilities.dp(40);
layoutParams.height = AndroidUtilities.dp(40);
layoutParams.leftMargin = AndroidUtilities.dp(LocaleController.isRTL ? 0 : 16);
layoutParams.rightMargin = AndroidUtilities.dp(LocaleController.isRTL ? 16 : 0);
layoutParams.gravity = (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.CENTER_VERTICAL;
typeTextView.setLayoutParams(layoutParams);
imageView = new BackupImageView(context);
addView(imageView);
layoutParams = (LayoutParams) imageView.getLayoutParams();
layoutParams.width = AndroidUtilities.dp(40);
layoutParams.height = AndroidUtilities.dp(40);
layoutParams.leftMargin = AndroidUtilities.dp(LocaleController.isRTL ? 0 : 16);
layoutParams.rightMargin = AndroidUtilities.dp(LocaleController.isRTL ? 16 : 0);
layoutParams.gravity = (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.CENTER_VERTICAL;
imageView.setLayoutParams(layoutParams);
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(64), MeasureSpec.EXACTLY));
}
public void setTextAndValueAndTypeAndThumb(String text, String value, String type, String thumb, int resId) {
textView.setText(text);
valueTextView.setText(value);
if (type != null) {
typeTextView.setVisibility(VISIBLE);
typeTextView.setText(type);
} else {
typeTextView.setVisibility(GONE);
}
if (thumb != null || resId != 0) {
if (thumb != null) {
imageView.setImage(thumb, "40_40", null);
} else {
imageView.setImageResource(resId);
}
imageView.setVisibility(VISIBLE);
} else {
imageView.setVisibility(GONE);
}
}
}
...@@ -13,13 +13,13 @@ import android.graphics.Canvas; ...@@ -13,13 +13,13 @@ import android.graphics.Canvas;
import android.graphics.Paint; import android.graphics.Paint;
import android.util.TypedValue; import android.util.TypedValue;
import android.view.Gravity; import android.view.Gravity;
import android.widget.FrameLayout;
import android.widget.TextView; import android.widget.TextView;
import org.telegram.android.AndroidUtilities; import org.telegram.android.AndroidUtilities;
import org.telegram.android.LocaleController; import org.telegram.android.LocaleController;
import org.telegram.ui.Views.FrameLayoutFixed;
public class TextDetailSettingsCell extends FrameLayout { public class TextDetailSettingsCell extends FrameLayoutFixed {
private TextView textView; private TextView textView;
private TextView valueTextView; private TextView valueTextView;
...@@ -37,7 +37,7 @@ public class TextDetailSettingsCell extends FrameLayout { ...@@ -37,7 +37,7 @@ public class TextDetailSettingsCell extends FrameLayout {
} }
textView = new TextView(context); textView = new TextView(context);
textView.setTextColor(0xff000000); textView.setTextColor(0xff212121);
textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16); textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
textView.setLines(1); textView.setLines(1);
textView.setMaxLines(1); textView.setMaxLines(1);
......
...@@ -6,77 +6,42 @@ ...@@ -6,77 +6,42 @@
* Copyright Nikolai Kudashov, 2013-2014. * Copyright Nikolai Kudashov, 2013-2014.
*/ */
package org.telegram.ui.Views; package org.telegram.ui.Cells;
import android.content.Context; import android.content.Context;
import android.graphics.Typeface;
import android.util.AttributeSet;
import android.util.TypedValue; import android.util.TypedValue;
import android.view.Gravity; import android.view.Gravity;
import android.view.View; import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.TextView; import android.widget.TextView;
import org.telegram.android.AndroidUtilities; import org.telegram.android.AndroidUtilities;
import org.telegram.android.LocaleController; import org.telegram.android.LocaleController;
public class SettingsSectionLayout extends LinearLayout { public class TextInfoPrivacyCell extends FrameLayout {
private TextView textView; private TextView textView;
private void init() { public TextInfoPrivacyCell(Context context) {
setOrientation(LinearLayout.VERTICAL); super(context);
textView = new TextView(getContext()); textView = new TextView(context);
textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14); textView.setTextColor(0xffa3a3a3);
textView.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD)); textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 13);
textView.setTextColor(0xff3b84c0); textView.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT);
textView.setPadding(0, AndroidUtilities.dp(6), 0, AndroidUtilities.dp(16));
addView(textView); addView(textView);
LayoutParams layoutParams = (LayoutParams)textView.getLayoutParams(); LayoutParams layoutParams = (LayoutParams) textView.getLayoutParams();
layoutParams.width = LayoutParams.WRAP_CONTENT; layoutParams.width = LayoutParams.WRAP_CONTENT;
layoutParams.height = LayoutParams.WRAP_CONTENT; layoutParams.height = LayoutParams.WRAP_CONTENT;
layoutParams.leftMargin = AndroidUtilities.dp(8); layoutParams.leftMargin = AndroidUtilities.dp(17);
layoutParams.rightMargin = AndroidUtilities.dp(8); layoutParams.rightMargin = AndroidUtilities.dp(17);
layoutParams.topMargin = AndroidUtilities.dp(6); layoutParams.gravity = LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT;
layoutParams.bottomMargin = AndroidUtilities.dp(4);
if (LocaleController.isRTL) {
textView.setGravity(Gravity.RIGHT);
layoutParams.gravity = Gravity.RIGHT;
}
textView.setLayoutParams(layoutParams); textView.setLayoutParams(layoutParams);
View view = new View(getContext());
view.setBackgroundColor(0xff6caae4);
addView(view);
layoutParams = (LayoutParams)view.getLayoutParams();
layoutParams.weight = LayoutParams.MATCH_PARENT;
layoutParams.height = AndroidUtilities.dp(1);
view.setLayoutParams(layoutParams);
}
public SettingsSectionLayout(Context context) {
super(context);
init();
}
public SettingsSectionLayout(Context context, AttributeSet attrs) {
super(context, attrs);
init();
}
public SettingsSectionLayout(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
init();
}
public SettingsSectionLayout(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
init();
} }
@Override @Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(MeasureSpec.getSize(heightMeasureSpec), MeasureSpec.UNSPECIFIED)); super.onMeasure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED));
} }
public void setText(String text) { public void setText(String text) {
......
...@@ -15,6 +15,7 @@ import android.text.TextUtils; ...@@ -15,6 +15,7 @@ import android.text.TextUtils;
import android.util.TypedValue; import android.util.TypedValue;
import android.view.Gravity; import android.view.Gravity;
import android.widget.FrameLayout; import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import org.telegram.android.AndroidUtilities; import org.telegram.android.AndroidUtilities;
...@@ -24,6 +25,7 @@ public class TextSettingsCell extends FrameLayout { ...@@ -24,6 +25,7 @@ public class TextSettingsCell extends FrameLayout {
private TextView textView; private TextView textView;
private TextView valueTextView; private TextView valueTextView;
private ImageView valueImageView;
private static Paint paint; private static Paint paint;
private boolean needDivider; private boolean needDivider;
...@@ -37,7 +39,7 @@ public class TextSettingsCell extends FrameLayout { ...@@ -37,7 +39,7 @@ public class TextSettingsCell extends FrameLayout {
} }
textView = new TextView(context); textView = new TextView(context);
textView.setTextColor(0xff000000); textView.setTextColor(0xff212121);
textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16); textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
textView.setLines(1); textView.setLines(1);
textView.setMaxLines(1); textView.setMaxLines(1);
...@@ -69,6 +71,18 @@ public class TextSettingsCell extends FrameLayout { ...@@ -69,6 +71,18 @@ public class TextSettingsCell extends FrameLayout {
layoutParams.rightMargin = AndroidUtilities.dp(17); layoutParams.rightMargin = AndroidUtilities.dp(17);
layoutParams.gravity = LocaleController.isRTL ? Gravity.LEFT : Gravity.RIGHT; layoutParams.gravity = LocaleController.isRTL ? Gravity.LEFT : Gravity.RIGHT;
valueTextView.setLayoutParams(layoutParams); valueTextView.setLayoutParams(layoutParams);
valueImageView = new ImageView(context);
valueImageView.setScaleType(ImageView.ScaleType.CENTER);
valueImageView.setVisibility(GONE);
addView(valueImageView);
layoutParams = (LayoutParams) valueImageView.getLayoutParams();
layoutParams.width = LayoutParams.WRAP_CONTENT;
layoutParams.height = LayoutParams.WRAP_CONTENT;
layoutParams.leftMargin = AndroidUtilities.dp(LocaleController.isRTL ? 17 : 0);
layoutParams.rightMargin = AndroidUtilities.dp(LocaleController.isRTL ? 0 : 17);
layoutParams.gravity = (LocaleController.isRTL ? Gravity.LEFT : Gravity.RIGHT) | Gravity.CENTER_VERTICAL;
valueImageView.setLayoutParams(layoutParams);
} }
@Override @Override
...@@ -77,6 +91,9 @@ public class TextSettingsCell extends FrameLayout { ...@@ -77,6 +91,9 @@ public class TextSettingsCell extends FrameLayout {
int availableWidth = getMeasuredWidth() - getPaddingLeft() - getPaddingRight() - AndroidUtilities.dp(34); int availableWidth = getMeasuredWidth() - getPaddingLeft() - getPaddingRight() - AndroidUtilities.dp(34);
int width = availableWidth / 2; int width = availableWidth / 2;
if (valueImageView.getVisibility() == VISIBLE) {
valueImageView.measure(MeasureSpec.makeMeasureSpec(width, MeasureSpec.AT_MOST), MeasureSpec.makeMeasureSpec(getMeasuredHeight(), MeasureSpec.EXACTLY));
}
if (valueTextView.getVisibility() == VISIBLE) { if (valueTextView.getVisibility() == VISIBLE) {
valueTextView.measure(MeasureSpec.makeMeasureSpec(width, MeasureSpec.AT_MOST), MeasureSpec.makeMeasureSpec(getMeasuredHeight(), MeasureSpec.EXACTLY)); valueTextView.measure(MeasureSpec.makeMeasureSpec(width, MeasureSpec.AT_MOST), MeasureSpec.makeMeasureSpec(getMeasuredHeight(), MeasureSpec.EXACTLY));
width = availableWidth - valueTextView.getMeasuredWidth() - AndroidUtilities.dp(8); width = availableWidth - valueTextView.getMeasuredWidth() - AndroidUtilities.dp(8);
...@@ -99,8 +116,26 @@ public class TextSettingsCell extends FrameLayout { ...@@ -99,8 +116,26 @@ public class TextSettingsCell extends FrameLayout {
public void setTextAndValue(String text, String value, boolean divider) { public void setTextAndValue(String text, String value, boolean divider) {
textView.setText(text); textView.setText(text);
valueImageView.setVisibility(GONE);
if (value != null) {
valueTextView.setText(value); valueTextView.setText(value);
valueTextView.setVisibility(VISIBLE); valueTextView.setVisibility(VISIBLE);
} else {
valueTextView.setVisibility(GONE);
}
needDivider = divider;
setWillNotDraw(!divider);
}
public void setTextAndIcon(String text, int resId, boolean divider) {
textView.setText(text);
valueTextView.setVisibility(GONE);
if (resId != 0) {
valueImageView.setVisibility(VISIBLE);
valueImageView.setImageResource(resId);
} else {
valueImageView.setVisibility(GONE);
}
needDivider = divider; needDivider = divider;
setWillNotDraw(!divider); setWillNotDraw(!divider);
} }
......
...@@ -16,6 +16,7 @@ import android.util.TypedValue; ...@@ -16,6 +16,7 @@ import android.util.TypedValue;
import android.view.Gravity; import android.view.Gravity;
import android.view.KeyEvent; import android.view.KeyEvent;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.inputmethod.EditorInfo; import android.view.inputmethod.EditorInfo;
...@@ -74,25 +75,31 @@ public class ChangeChatNameActivity extends BaseFragment { ...@@ -74,25 +75,31 @@ public class ChangeChatNameActivity extends BaseFragment {
}); });
ActionBarMenu menu = actionBar.createMenu(); ActionBarMenu menu = actionBar.createMenu();
doneButton = menu.addItem(done_button, R.drawable.ic_done, 0, AndroidUtilities.dp(56)); doneButton = menu.addItemWithWidth(done_button, R.drawable.ic_done, AndroidUtilities.dp(56));
TLRPC.Chat currentChat = MessagesController.getInstance().getChat(chat_id); TLRPC.Chat currentChat = MessagesController.getInstance().getChat(chat_id);
fragmentView = new LinearLayout(inflater.getContext()); fragmentView = new LinearLayout(inflater.getContext());
fragmentView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); fragmentView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
fragmentView.setPadding(0, AndroidUtilities.dp(8), 0, 0);
((LinearLayout) fragmentView).setOrientation(LinearLayout.VERTICAL); ((LinearLayout) fragmentView).setOrientation(LinearLayout.VERTICAL);
fragmentView.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
return true;
}
});
firstNameField = new EditText(inflater.getContext()); firstNameField = new EditText(inflater.getContext());
firstNameField.setText(currentChat.title); firstNameField.setText(currentChat.title);
firstNameField.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 19); firstNameField.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18);
firstNameField.setHintTextColor(0xffa3a3a3); firstNameField.setHintTextColor(0xff979797);
firstNameField.setTextColor(0xff000000); firstNameField.setTextColor(0xff212121);
firstNameField.setPadding(AndroidUtilities.dp(15), 0, AndroidUtilities.dp(15), AndroidUtilities.dp(15));
firstNameField.setMaxLines(3); firstNameField.setMaxLines(3);
firstNameField.setPadding(0, 0, 0, 0);
firstNameField.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT); firstNameField.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT);
firstNameField.setInputType(InputType.TYPE_TEXT_FLAG_CAP_SENTENCES | InputType.TYPE_TEXT_FLAG_MULTI_LINE | InputType.TYPE_TEXT_FLAG_AUTO_CORRECT); firstNameField.setInputType(InputType.TYPE_TEXT_FLAG_CAP_SENTENCES | InputType.TYPE_TEXT_FLAG_MULTI_LINE | InputType.TYPE_TEXT_FLAG_AUTO_CORRECT);
firstNameField.setImeOptions(EditorInfo.IME_ACTION_DONE); firstNameField.setImeOptions(EditorInfo.IME_ACTION_DONE);
firstNameField.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT);
AndroidUtilities.clearCursorDrawable(firstNameField); AndroidUtilities.clearCursorDrawable(firstNameField);
firstNameField.setOnEditorActionListener(new TextView.OnEditorActionListener() { firstNameField.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override @Override
...@@ -104,17 +111,14 @@ public class ChangeChatNameActivity extends BaseFragment { ...@@ -104,17 +111,14 @@ public class ChangeChatNameActivity extends BaseFragment {
return false; return false;
} }
}); });
if (LocaleController.isRTL) {
firstNameField.setGravity(Gravity.RIGHT);
}
((LinearLayout) fragmentView).addView(firstNameField); ((LinearLayout) fragmentView).addView(firstNameField);
LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams)firstNameField.getLayoutParams(); LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams)firstNameField.getLayoutParams();
layoutParams.topMargin = AndroidUtilities.dp(15); layoutParams.topMargin = AndroidUtilities.dp(24);
layoutParams.leftMargin = AndroidUtilities.dp(16); layoutParams.height = AndroidUtilities.dp(36);
layoutParams.rightMargin = AndroidUtilities.dp(16); layoutParams.leftMargin = AndroidUtilities.dp(24);
layoutParams.rightMargin = AndroidUtilities.dp(24);
layoutParams.width = LinearLayout.LayoutParams.MATCH_PARENT; layoutParams.width = LinearLayout.LayoutParams.MATCH_PARENT;
layoutParams.height = LinearLayout.LayoutParams.WRAP_CONTENT;
firstNameField.setLayoutParams(layoutParams); firstNameField.setLayoutParams(layoutParams);
if (chat_id > 0) { if (chat_id > 0) {
......
...@@ -15,6 +15,7 @@ import android.util.TypedValue; ...@@ -15,6 +15,7 @@ import android.util.TypedValue;
import android.view.Gravity; import android.view.Gravity;
import android.view.KeyEvent; import android.view.KeyEvent;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.inputmethod.EditorInfo; import android.view.inputmethod.EditorInfo;
...@@ -35,7 +36,6 @@ import org.telegram.messenger.UserConfig; ...@@ -35,7 +36,6 @@ import org.telegram.messenger.UserConfig;
import org.telegram.ui.ActionBar.ActionBar; import org.telegram.ui.ActionBar.ActionBar;
import org.telegram.ui.ActionBar.ActionBarMenu; import org.telegram.ui.ActionBar.ActionBarMenu;
import org.telegram.ui.ActionBar.BaseFragment; import org.telegram.ui.ActionBar.BaseFragment;
import org.telegram.ui.Views.SettingsSectionLayout;
public class ChangeNameActivity extends BaseFragment { public class ChangeNameActivity extends BaseFragment {
...@@ -67,9 +67,7 @@ public class ChangeNameActivity extends BaseFragment { ...@@ -67,9 +67,7 @@ public class ChangeNameActivity extends BaseFragment {
}); });
ActionBarMenu menu = actionBar.createMenu(); ActionBarMenu menu = actionBar.createMenu();
doneButton = menu.addItem(done_button, R.drawable.ic_done, 0, AndroidUtilities.dp(56)); doneButton = menu.addItemWithWidth(done_button, R.drawable.ic_done, AndroidUtilities.dp(56));
fragmentView = inflater.inflate(R.layout.contact_add_layout, container, false);
TLRPC.User user = MessagesController.getInstance().getUser(UserConfig.getClientUserId()); TLRPC.User user = MessagesController.getInstance().getUser(UserConfig.getClientUserId());
if (user == null) { if (user == null) {
...@@ -78,25 +76,34 @@ public class ChangeNameActivity extends BaseFragment { ...@@ -78,25 +76,34 @@ public class ChangeNameActivity extends BaseFragment {
fragmentView = new LinearLayout(inflater.getContext()); fragmentView = new LinearLayout(inflater.getContext());
fragmentView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); fragmentView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
fragmentView.setPadding(AndroidUtilities.dp(16), AndroidUtilities.dp(8), AndroidUtilities.dp(16), 0);
((LinearLayout) fragmentView).setOrientation(LinearLayout.VERTICAL); ((LinearLayout) fragmentView).setOrientation(LinearLayout.VERTICAL);
fragmentView.setOnTouchListener(new View.OnTouchListener() {
SettingsSectionLayout settingsSectionLayout = new SettingsSectionLayout(inflater.getContext()); @Override
((LinearLayout) fragmentView).addView(settingsSectionLayout); public boolean onTouch(View v, MotionEvent event) {
settingsSectionLayout.setText(LocaleController.getString("YourFirstNameAndLastName", R.string.YourFirstNameAndLastName).toUpperCase()); return true;
}
});
firstNameField = new EditText(inflater.getContext()); firstNameField = new EditText(inflater.getContext());
firstNameField.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 19); firstNameField.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18);
firstNameField.setHintTextColor(0xffa3a3a3); firstNameField.setHintTextColor(0xff979797);
firstNameField.setTextColor(0xff000000); firstNameField.setTextColor(0xff212121);
firstNameField.setPadding(AndroidUtilities.dp(15), 0, AndroidUtilities.dp(15), AndroidUtilities.dp(15));
firstNameField.setMaxLines(1); firstNameField.setMaxLines(1);
firstNameField.setLines(1); firstNameField.setLines(1);
firstNameField.setSingleLine(true); firstNameField.setSingleLine(true);
firstNameField.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT); firstNameField.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT);
firstNameField.setInputType(InputType.TYPE_TEXT_FLAG_CAP_SENTENCES | InputType.TYPE_TEXT_FLAG_MULTI_LINE | InputType.TYPE_TEXT_FLAG_AUTO_CORRECT); firstNameField.setInputType(InputType.TYPE_TEXT_FLAG_CAP_SENTENCES | InputType.TYPE_TEXT_FLAG_AUTO_CORRECT);
firstNameField.setImeOptions(EditorInfo.IME_ACTION_NEXT); firstNameField.setImeOptions(EditorInfo.IME_ACTION_NEXT);
firstNameField.setHint(LocaleController.getString("FirstName", R.string.FirstName)); firstNameField.setHint(LocaleController.getString("FirstName", R.string.FirstName));
AndroidUtilities.clearCursorDrawable(firstNameField);
((LinearLayout) fragmentView).addView(firstNameField);
LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams)firstNameField.getLayoutParams();
layoutParams.topMargin = AndroidUtilities.dp(24);
layoutParams.height = AndroidUtilities.dp(36);
layoutParams.leftMargin = AndroidUtilities.dp(24);
layoutParams.rightMargin = AndroidUtilities.dp(24);
layoutParams.width = LinearLayout.LayoutParams.MATCH_PARENT;
firstNameField.setLayoutParams(layoutParams);
firstNameField.setOnEditorActionListener(new TextView.OnEditorActionListener() { firstNameField.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override @Override
public boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) { public boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) {
...@@ -108,26 +115,27 @@ public class ChangeNameActivity extends BaseFragment { ...@@ -108,26 +115,27 @@ public class ChangeNameActivity extends BaseFragment {
return false; return false;
} }
}); });
AndroidUtilities.clearCursorDrawable(firstNameField);
((LinearLayout) fragmentView).addView(firstNameField);
LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams)firstNameField.getLayoutParams();
layoutParams.topMargin = AndroidUtilities.dp(15);
layoutParams.width = LinearLayout.LayoutParams.MATCH_PARENT;
layoutParams.height = LinearLayout.LayoutParams.WRAP_CONTENT;
firstNameField.setLayoutParams(layoutParams);
lastNameField = new EditText(inflater.getContext()); lastNameField = new EditText(inflater.getContext());
lastNameField.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 19); lastNameField.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18);
lastNameField.setHintTextColor(0xffa3a3a3); lastNameField.setHintTextColor(0xff979797);
lastNameField.setTextColor(0xff000000); lastNameField.setTextColor(0xff212121);
lastNameField.setPadding(AndroidUtilities.dp(15), 0, AndroidUtilities.dp(15), AndroidUtilities.dp(15));
lastNameField.setMaxLines(1); lastNameField.setMaxLines(1);
lastNameField.setLines(1); lastNameField.setLines(1);
lastNameField.setSingleLine(true); lastNameField.setSingleLine(true);
lastNameField.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT); lastNameField.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT);
lastNameField.setInputType(InputType.TYPE_TEXT_FLAG_CAP_SENTENCES | InputType.TYPE_TEXT_FLAG_MULTI_LINE | InputType.TYPE_TEXT_FLAG_AUTO_CORRECT); lastNameField.setInputType(InputType.TYPE_TEXT_FLAG_CAP_SENTENCES | InputType.TYPE_TEXT_FLAG_AUTO_CORRECT);
lastNameField.setImeOptions(EditorInfo.IME_ACTION_DONE); lastNameField.setImeOptions(EditorInfo.IME_ACTION_DONE);
lastNameField.setHint(LocaleController.getString("LastName", R.string.LastName)); lastNameField.setHint(LocaleController.getString("LastName", R.string.LastName));
AndroidUtilities.clearCursorDrawable(lastNameField);
((LinearLayout) fragmentView).addView(lastNameField);
layoutParams = (LinearLayout.LayoutParams)lastNameField.getLayoutParams();
layoutParams.topMargin = AndroidUtilities.dp(16);
layoutParams.height = AndroidUtilities.dp(36);
layoutParams.leftMargin = AndroidUtilities.dp(24);
layoutParams.rightMargin = AndroidUtilities.dp(24);
layoutParams.width = LinearLayout.LayoutParams.MATCH_PARENT;
lastNameField.setLayoutParams(layoutParams);
lastNameField.setOnEditorActionListener(new TextView.OnEditorActionListener() { lastNameField.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override @Override
public boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) { public boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) {
...@@ -138,13 +146,6 @@ public class ChangeNameActivity extends BaseFragment { ...@@ -138,13 +146,6 @@ public class ChangeNameActivity extends BaseFragment {
return false; return false;
} }
}); });
AndroidUtilities.clearCursorDrawable(lastNameField);
((LinearLayout) fragmentView).addView(lastNameField);
layoutParams = (LinearLayout.LayoutParams)lastNameField.getLayoutParams();
layoutParams.topMargin = AndroidUtilities.dp(10);
layoutParams.width = LinearLayout.LayoutParams.MATCH_PARENT;
layoutParams.height = LinearLayout.LayoutParams.WRAP_CONTENT;
lastNameField.setLayoutParams(layoutParams);
if (user != null) { if (user != null) {
firstNameField.setText(user.first_name); firstNameField.setText(user.first_name);
...@@ -190,6 +191,7 @@ public class ChangeNameActivity extends BaseFragment { ...@@ -190,6 +191,7 @@ public class ChangeNameActivity extends BaseFragment {
user.last_name = req.last_name; user.last_name = req.last_name;
} }
UserConfig.saveConfig(true); UserConfig.saveConfig(true);
NotificationCenter.getInstance().postNotificationName(NotificationCenter.mainUserInfoChanged);
NotificationCenter.getInstance().postNotificationName(NotificationCenter.updateInterfaces, MessagesController.UPDATE_MASK_NAME); NotificationCenter.getInstance().postNotificationName(NotificationCenter.updateInterfaces, MessagesController.UPDATE_MASK_NAME);
ConnectionsManager.getInstance().performRpc(req, new RPCRequest.RPCRequestDelegate() { ConnectionsManager.getInstance().performRpc(req, new RPCRequest.RPCRequestDelegate() {
@Override @Override
......
...@@ -21,6 +21,7 @@ import android.util.TypedValue; ...@@ -21,6 +21,7 @@ import android.util.TypedValue;
import android.view.Gravity; import android.view.Gravity;
import android.view.KeyEvent; import android.view.KeyEvent;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.inputmethod.EditorInfo; import android.view.inputmethod.EditorInfo;
...@@ -43,7 +44,6 @@ import org.telegram.messenger.UserConfig; ...@@ -43,7 +44,6 @@ import org.telegram.messenger.UserConfig;
import org.telegram.ui.ActionBar.ActionBar; import org.telegram.ui.ActionBar.ActionBar;
import org.telegram.ui.ActionBar.ActionBarMenu; import org.telegram.ui.ActionBar.ActionBarMenu;
import org.telegram.ui.ActionBar.BaseFragment; import org.telegram.ui.ActionBar.BaseFragment;
import org.telegram.ui.Views.SettingsSectionLayout;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -77,7 +77,7 @@ public class ChangeUsernameActivity extends BaseFragment { ...@@ -77,7 +77,7 @@ public class ChangeUsernameActivity extends BaseFragment {
}); });
ActionBarMenu menu = actionBar.createMenu(); ActionBarMenu menu = actionBar.createMenu();
doneButton = menu.addItem(done_button, R.drawable.ic_done, 0, AndroidUtilities.dp(56)); doneButton = menu.addItemWithWidth(done_button, R.drawable.ic_done, AndroidUtilities.dp(56));
TLRPC.User user = MessagesController.getInstance().getUser(UserConfig.getClientUserId()); TLRPC.User user = MessagesController.getInstance().getUser(UserConfig.getClientUserId());
if (user == null) { if (user == null) {
...@@ -86,20 +86,21 @@ public class ChangeUsernameActivity extends BaseFragment { ...@@ -86,20 +86,21 @@ public class ChangeUsernameActivity extends BaseFragment {
fragmentView = new LinearLayout(inflater.getContext()); fragmentView = new LinearLayout(inflater.getContext());
fragmentView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); fragmentView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
fragmentView.setPadding(AndroidUtilities.dp(16), AndroidUtilities.dp(8), AndroidUtilities.dp(16), 0);
((LinearLayout) fragmentView).setOrientation(LinearLayout.VERTICAL); ((LinearLayout) fragmentView).setOrientation(LinearLayout.VERTICAL);
fragmentView.setOnTouchListener(new View.OnTouchListener() {
SettingsSectionLayout settingsSectionLayout = new SettingsSectionLayout(inflater.getContext()); @Override
((LinearLayout) fragmentView).addView(settingsSectionLayout); public boolean onTouch(View v, MotionEvent event) {
settingsSectionLayout.setText(LocaleController.getString("Username", R.string.Username).toUpperCase()); return true;
}
});
firstNameField = new EditText(inflater.getContext()); firstNameField = new EditText(inflater.getContext());
firstNameField.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 19); firstNameField.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18);
firstNameField.setHintTextColor(0xffa3a3a3); firstNameField.setHintTextColor(0xff979797);
firstNameField.setTextColor(0xff000000); firstNameField.setTextColor(0xff212121);
firstNameField.setPadding(AndroidUtilities.dp(15), 0, AndroidUtilities.dp(15), AndroidUtilities.dp(15));
firstNameField.setMaxLines(1); firstNameField.setMaxLines(1);
firstNameField.setLines(1); firstNameField.setLines(1);
firstNameField.setPadding(0, 0, 0, 0);
firstNameField.setSingleLine(true); firstNameField.setSingleLine(true);
firstNameField.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT); firstNameField.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT);
firstNameField.setInputType(InputType.TYPE_TEXT_FLAG_CAP_SENTENCES | InputType.TYPE_TEXT_FLAG_MULTI_LINE | InputType.TYPE_TEXT_FLAG_AUTO_CORRECT); firstNameField.setInputType(InputType.TYPE_TEXT_FLAG_CAP_SENTENCES | InputType.TYPE_TEXT_FLAG_MULTI_LINE | InputType.TYPE_TEXT_FLAG_AUTO_CORRECT);
...@@ -119,9 +120,11 @@ public class ChangeUsernameActivity extends BaseFragment { ...@@ -119,9 +120,11 @@ public class ChangeUsernameActivity extends BaseFragment {
((LinearLayout) fragmentView).addView(firstNameField); ((LinearLayout) fragmentView).addView(firstNameField);
LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams)firstNameField.getLayoutParams(); LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams)firstNameField.getLayoutParams();
layoutParams.topMargin = AndroidUtilities.dp(15); layoutParams.topMargin = AndroidUtilities.dp(24);
layoutParams.height = AndroidUtilities.dp(36);
layoutParams.leftMargin = AndroidUtilities.dp(24);
layoutParams.rightMargin = AndroidUtilities.dp(24);
layoutParams.width = LinearLayout.LayoutParams.MATCH_PARENT; layoutParams.width = LinearLayout.LayoutParams.MATCH_PARENT;
layoutParams.height = LinearLayout.LayoutParams.WRAP_CONTENT;
firstNameField.setLayoutParams(layoutParams); firstNameField.setLayoutParams(layoutParams);
if (user != null && user.username != null && user.username.length() > 0) { if (user != null && user.username != null && user.username.length() > 0) {
...@@ -131,7 +134,6 @@ public class ChangeUsernameActivity extends BaseFragment { ...@@ -131,7 +134,6 @@ public class ChangeUsernameActivity extends BaseFragment {
checkTextView = new TextView(inflater.getContext()); checkTextView = new TextView(inflater.getContext());
checkTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 15); checkTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 15);
checkTextView.setPadding(AndroidUtilities.dp(8), 0, AndroidUtilities.dp(8), 0);
checkTextView.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT); checkTextView.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT);
((LinearLayout) fragmentView).addView(checkTextView); ((LinearLayout) fragmentView).addView(checkTextView);
layoutParams = (LinearLayout.LayoutParams)checkTextView.getLayoutParams(); layoutParams = (LinearLayout.LayoutParams)checkTextView.getLayoutParams();
...@@ -139,12 +141,13 @@ public class ChangeUsernameActivity extends BaseFragment { ...@@ -139,12 +141,13 @@ public class ChangeUsernameActivity extends BaseFragment {
layoutParams.width = LinearLayout.LayoutParams.WRAP_CONTENT; layoutParams.width = LinearLayout.LayoutParams.WRAP_CONTENT;
layoutParams.height = LinearLayout.LayoutParams.WRAP_CONTENT; layoutParams.height = LinearLayout.LayoutParams.WRAP_CONTENT;
layoutParams.gravity = LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT; layoutParams.gravity = LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT;
layoutParams.leftMargin = AndroidUtilities.dp(24);
layoutParams.rightMargin = AndroidUtilities.dp(24);
checkTextView.setLayoutParams(layoutParams); checkTextView.setLayoutParams(layoutParams);
TextView helpTextView = new TextView(inflater.getContext()); TextView helpTextView = new TextView(inflater.getContext());
helpTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 15); helpTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 15);
helpTextView.setTextColor(0xff6d6d72); helpTextView.setTextColor(0xff6d6d72);
helpTextView.setPadding(AndroidUtilities.dp(8), 0, AndroidUtilities.dp(8), 0);
helpTextView.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT); helpTextView.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT);
helpTextView.setText(Html.fromHtml(LocaleController.getString("UsernameHelp", R.string.UsernameHelp))); helpTextView.setText(Html.fromHtml(LocaleController.getString("UsernameHelp", R.string.UsernameHelp)));
((LinearLayout) fragmentView).addView(helpTextView); ((LinearLayout) fragmentView).addView(helpTextView);
...@@ -153,6 +156,8 @@ public class ChangeUsernameActivity extends BaseFragment { ...@@ -153,6 +156,8 @@ public class ChangeUsernameActivity extends BaseFragment {
layoutParams.width = LinearLayout.LayoutParams.WRAP_CONTENT; layoutParams.width = LinearLayout.LayoutParams.WRAP_CONTENT;
layoutParams.height = LinearLayout.LayoutParams.WRAP_CONTENT; layoutParams.height = LinearLayout.LayoutParams.WRAP_CONTENT;
layoutParams.gravity = LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT; layoutParams.gravity = LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT;
layoutParams.leftMargin = AndroidUtilities.dp(24);
layoutParams.rightMargin = AndroidUtilities.dp(24);
helpTextView.setLayoutParams(layoutParams); helpTextView.setLayoutParams(layoutParams);
firstNameField.addTextChangedListener(new TextWatcher() { firstNameField.addTextChangedListener(new TextWatcher() {
......
...@@ -25,6 +25,7 @@ import android.widget.AbsListView; ...@@ -25,6 +25,7 @@ import android.widget.AbsListView;
import android.widget.AdapterView; import android.widget.AdapterView;
import android.widget.EditText; import android.widget.EditText;
import android.widget.FrameLayout; import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.ListView; import android.widget.ListView;
import android.widget.TextView; import android.widget.TextView;
...@@ -183,27 +184,44 @@ public class ContactsActivity extends BaseFragment implements NotificationCenter ...@@ -183,27 +184,44 @@ public class ContactsActivity extends BaseFragment implements NotificationCenter
fragmentView = new FrameLayout(getParentActivity()); fragmentView = new FrameLayout(getParentActivity());
emptyTextView = new TextView(getParentActivity()); LinearLayout emptyTextLayout = new LinearLayout(getParentActivity());
emptyTextView.setTextColor(0xff808080); emptyTextLayout.setVisibility(View.INVISIBLE);
emptyTextView.setTextSize(24); emptyTextLayout.setOrientation(LinearLayout.VERTICAL);
emptyTextView.setGravity(Gravity.CENTER); ((FrameLayout) fragmentView).addView(emptyTextLayout);
emptyTextView.setVisibility(View.INVISIBLE); FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) emptyTextLayout.getLayoutParams();
emptyTextView.setText(LocaleController.getString("NoContacts", R.string.NoContacts));
((FrameLayout) fragmentView).addView(emptyTextView);
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) emptyTextView.getLayoutParams();
layoutParams.width = FrameLayout.LayoutParams.MATCH_PARENT; layoutParams.width = FrameLayout.LayoutParams.MATCH_PARENT;
layoutParams.height = FrameLayout.LayoutParams.MATCH_PARENT; layoutParams.height = FrameLayout.LayoutParams.MATCH_PARENT;
layoutParams.gravity = Gravity.TOP; layoutParams.gravity = Gravity.TOP;
emptyTextView.setLayoutParams(layoutParams); emptyTextLayout.setLayoutParams(layoutParams);
emptyTextView.setOnTouchListener(new View.OnTouchListener() { emptyTextLayout.setOnTouchListener(new View.OnTouchListener() {
@Override @Override
public boolean onTouch(View v, MotionEvent event) { public boolean onTouch(View v, MotionEvent event) {
return true; return true;
} }
}); });
emptyTextView = new TextView(getParentActivity());
emptyTextView.setTextColor(0xff808080);
emptyTextView.setTextSize(20);
emptyTextView.setGravity(Gravity.CENTER);
emptyTextView.setText(LocaleController.getString("NoContacts", R.string.NoContacts));
emptyTextLayout.addView(emptyTextView);
LinearLayout.LayoutParams layoutParams1 = (LinearLayout.LayoutParams) emptyTextView.getLayoutParams();
layoutParams1.width = LinearLayout.LayoutParams.MATCH_PARENT;
layoutParams1.height = LinearLayout.LayoutParams.MATCH_PARENT;
layoutParams1.weight = 0.5f;
emptyTextView.setLayoutParams(layoutParams1);
FrameLayout frameLayout = new FrameLayout(getParentActivity());
emptyTextLayout.addView(frameLayout);
layoutParams1 = (LinearLayout.LayoutParams) frameLayout.getLayoutParams();
layoutParams1.width = LinearLayout.LayoutParams.MATCH_PARENT;
layoutParams1.height = LinearLayout.LayoutParams.MATCH_PARENT;
layoutParams1.weight = 0.5f;
frameLayout.setLayoutParams(layoutParams1);
listView = new SectionsListView(getParentActivity()); listView = new SectionsListView(getParentActivity());
listView.setEmptyView(emptyTextView); listView.setEmptyView(emptyTextLayout);
listView.setVerticalScrollBarEnabled(false); listView.setVerticalScrollBarEnabled(false);
listView.setDivider(null); listView.setDivider(null);
listView.setDividerHeight(0); listView.setDividerHeight(0);
...@@ -348,6 +366,9 @@ public class ContactsActivity extends BaseFragment implements NotificationCenter ...@@ -348,6 +366,9 @@ public class ContactsActivity extends BaseFragment implements NotificationCenter
@Override @Override
public void onScroll(AbsListView absListView, int firstVisibleItem, int visibleItemCount, int totalItemCount) { public void onScroll(AbsListView absListView, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
if (absListView.isFastScrollEnabled()) {
AndroidUtilities.clearDrawableAnimation(absListView);
}
} }
}); });
} else { } else {
......
...@@ -18,6 +18,7 @@ import android.widget.AbsListView; ...@@ -18,6 +18,7 @@ import android.widget.AbsListView;
import android.widget.AdapterView; import android.widget.AdapterView;
import android.widget.EditText; import android.widget.EditText;
import android.widget.FrameLayout; import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.ListView; import android.widget.ListView;
import android.widget.TextView; import android.widget.TextView;
...@@ -127,27 +128,44 @@ public class CountrySelectActivity extends BaseFragment { ...@@ -127,27 +128,44 @@ public class CountrySelectActivity extends BaseFragment {
fragmentView = new FrameLayout(getParentActivity()); fragmentView = new FrameLayout(getParentActivity());
emptyTextView = new TextView(getParentActivity()); LinearLayout emptyTextLayout = new LinearLayout(getParentActivity());
emptyTextView.setTextColor(0xff808080); emptyTextLayout.setVisibility(View.INVISIBLE);
emptyTextView.setTextSize(24); emptyTextLayout.setOrientation(LinearLayout.VERTICAL);
emptyTextView.setGravity(Gravity.CENTER); ((FrameLayout) fragmentView).addView(emptyTextLayout);
emptyTextView.setVisibility(View.INVISIBLE); FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) emptyTextLayout.getLayoutParams();
emptyTextView.setText(LocaleController.getString("NoResult", R.string.NoResult));
((FrameLayout) fragmentView).addView(emptyTextView);
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) emptyTextView.getLayoutParams();
layoutParams.width = FrameLayout.LayoutParams.MATCH_PARENT; layoutParams.width = FrameLayout.LayoutParams.MATCH_PARENT;
layoutParams.height = FrameLayout.LayoutParams.MATCH_PARENT; layoutParams.height = FrameLayout.LayoutParams.MATCH_PARENT;
layoutParams.gravity = Gravity.TOP; layoutParams.gravity = Gravity.TOP;
emptyTextView.setLayoutParams(layoutParams); emptyTextLayout.setLayoutParams(layoutParams);
emptyTextView.setOnTouchListener(new View.OnTouchListener() { emptyTextLayout.setOnTouchListener(new View.OnTouchListener() {
@Override @Override
public boolean onTouch(View v, MotionEvent event) { public boolean onTouch(View v, MotionEvent event) {
return true; return true;
} }
}); });
emptyTextView = new TextView(getParentActivity());
emptyTextView.setTextColor(0xff808080);
emptyTextView.setTextSize(20);
emptyTextView.setGravity(Gravity.CENTER);
emptyTextView.setText(LocaleController.getString("NoResult", R.string.NoResult));
emptyTextLayout.addView(emptyTextView);
LinearLayout.LayoutParams layoutParams1 = (LinearLayout.LayoutParams) emptyTextView.getLayoutParams();
layoutParams1.width = LinearLayout.LayoutParams.MATCH_PARENT;
layoutParams1.height = LinearLayout.LayoutParams.MATCH_PARENT;
layoutParams1.weight = 0.5f;
emptyTextView.setLayoutParams(layoutParams1);
FrameLayout frameLayout = new FrameLayout(getParentActivity());
emptyTextLayout.addView(frameLayout);
layoutParams1 = (LinearLayout.LayoutParams) frameLayout.getLayoutParams();
layoutParams1.width = LinearLayout.LayoutParams.MATCH_PARENT;
layoutParams1.height = LinearLayout.LayoutParams.MATCH_PARENT;
layoutParams1.weight = 0.5f;
frameLayout.setLayoutParams(layoutParams1);
listView = new SectionsListView(getParentActivity()); listView = new SectionsListView(getParentActivity());
listView.setEmptyView(emptyTextView); listView.setEmptyView(emptyTextLayout);
listView.setVerticalScrollBarEnabled(false); listView.setVerticalScrollBarEnabled(false);
listView.setDivider(null); listView.setDivider(null);
listView.setDividerHeight(0); listView.setDividerHeight(0);
...@@ -198,6 +216,9 @@ public class CountrySelectActivity extends BaseFragment { ...@@ -198,6 +216,9 @@ public class CountrySelectActivity extends BaseFragment {
@Override @Override
public void onScroll(AbsListView absListView, int firstVisibleItem, int visibleItemCount, int totalItemCount) { public void onScroll(AbsListView absListView, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
if (absListView.isFastScrollEnabled()) {
AndroidUtilities.clearDrawableAnimation(absListView);
}
} }
}); });
} else { } else {
......
...@@ -24,6 +24,7 @@ import android.widget.AdapterView; ...@@ -24,6 +24,7 @@ import android.widget.AdapterView;
import android.widget.ListView; import android.widget.ListView;
import android.widget.TextView; import android.widget.TextView;
import org.telegram.android.AndroidUtilities;
import org.telegram.messenger.FileLog; import org.telegram.messenger.FileLog;
import org.telegram.android.LocaleController; import org.telegram.android.LocaleController;
import org.telegram.messenger.R; import org.telegram.messenger.R;
...@@ -32,7 +33,7 @@ import org.telegram.ui.Adapters.BaseFragmentAdapter; ...@@ -32,7 +33,7 @@ import org.telegram.ui.Adapters.BaseFragmentAdapter;
import org.telegram.ui.ActionBar.ActionBar; import org.telegram.ui.ActionBar.ActionBar;
import org.telegram.ui.ActionBar.ActionBarMenu; import org.telegram.ui.ActionBar.ActionBarMenu;
import org.telegram.ui.ActionBar.ActionBarMenuItem; import org.telegram.ui.ActionBar.ActionBarMenuItem;
import org.telegram.ui.Views.BackupImageView; import org.telegram.ui.Cells.TextDetailDocumentsCell;
import org.telegram.ui.ActionBar.BaseFragment; import org.telegram.ui.ActionBar.BaseFragment;
import java.io.BufferedReader; import java.io.BufferedReader;
...@@ -261,6 +262,7 @@ public class DocumentSelectActivity extends BaseFragment { ...@@ -261,6 +262,7 @@ public class DocumentSelectActivity extends BaseFragment {
} else { } else {
emptyView.setText(LocaleController.getString("NotMounted", R.string.NotMounted)); emptyView.setText(LocaleController.getString("NotMounted", R.string.NotMounted));
} }
AndroidUtilities.clearDrawableAnimation(listView);
listAdapter.notifyDataSetChanged(); listAdapter.notifyDataSetChanged();
return true; return true;
} }
...@@ -309,6 +311,7 @@ public class DocumentSelectActivity extends BaseFragment { ...@@ -309,6 +311,7 @@ public class DocumentSelectActivity extends BaseFragment {
item.file = file; item.file = file;
if (file.isDirectory()) { if (file.isDirectory()) {
item.icon = R.drawable.ic_directory; item.icon = R.drawable.ic_directory;
item.subtitle = LocaleController.getString("Folder", R.string.Folder);
} else { } else {
String fname = file.getName(); String fname = file.getName();
String[] sp = fname.split("\\."); String[] sp = fname.split("\\.");
...@@ -323,10 +326,11 @@ public class DocumentSelectActivity extends BaseFragment { ...@@ -323,10 +326,11 @@ public class DocumentSelectActivity extends BaseFragment {
} }
ListItem item = new ListItem(); ListItem item = new ListItem();
item.title = ".."; item.title = "..";
item.subtitle = ""; item.subtitle = LocaleController.getString("Folder", R.string.Folder);
item.icon = R.drawable.ic_directory; item.icon = R.drawable.ic_directory;
item.file = null; item.file = null;
items.add(0, item); items.add(0, item);
AndroidUtilities.clearDrawableAnimation(listView);
listAdapter.notifyDataSetChanged(); listAdapter.notifyDataSetChanged();
return true; return true;
} }
...@@ -335,11 +339,7 @@ public class DocumentSelectActivity extends BaseFragment { ...@@ -335,11 +339,7 @@ public class DocumentSelectActivity extends BaseFragment {
if (getParentActivity() == null) { if (getParentActivity() == null) {
return; return;
} }
new AlertDialog.Builder(getParentActivity()) new AlertDialog.Builder(getParentActivity()).setTitle(LocaleController.getString("AppName", R.string.AppName)).setMessage(error).setPositiveButton(R.string.OK, null).show();
.setTitle(LocaleController.getString("AppName", R.string.AppName))
.setMessage(error)
.setPositiveButton(R.string.OK, null)
.show();
} }
private void listRoots() { private void listRoots() {
...@@ -420,6 +420,7 @@ public class DocumentSelectActivity extends BaseFragment { ...@@ -420,6 +420,7 @@ public class DocumentSelectActivity extends BaseFragment {
FileLog.e("tmessages", e); FileLog.e("tmessages", e);
} }
AndroidUtilities.clearDrawableAnimation(listView);
listAdapter.notifyDataSetChanged(); listAdapter.notifyDataSetChanged();
} }
...@@ -465,35 +466,18 @@ public class DocumentSelectActivity extends BaseFragment { ...@@ -465,35 +466,18 @@ public class DocumentSelectActivity extends BaseFragment {
@Override @Override
public View getView(int position, View convertView, ViewGroup parent) { public View getView(int position, View convertView, ViewGroup parent) {
View v = convertView; if (convertView == null) {
convertView = new TextDetailDocumentsCell(mContext);
}
TextDetailDocumentsCell textDetailCell = (TextDetailDocumentsCell) convertView;
ListItem item = items.get(position); ListItem item = items.get(position);
if (v == null) { if (item.icon != 0) {
v = View.inflate(mContext, R.layout.document_item, null); ((TextDetailDocumentsCell) convertView).setTextAndValueAndTypeAndThumb(item.title, item.subtitle, null, null, item.icon);
if (item.subtitle.length() == 0) {
v.findViewById(R.id.docs_item_info).setVisibility(View.GONE);
}
}
TextView typeTextView = (TextView)v.findViewById(R.id.docs_item_type);
((TextView)v.findViewById(R.id.docs_item_title)).setText(item.title);
((TextView)v.findViewById(R.id.docs_item_info)).setText(item.subtitle);
BackupImageView imageView = (BackupImageView)v.findViewById(R.id.docs_item_thumb);
if (item.thumb != null) {
imageView.setImageBitmap(null);
typeTextView.setText(item.ext.toUpperCase().substring(0, Math.min(item.ext.length(), 4)));
imageView.setImage(item.thumb, "55_42", null);
imageView.setVisibility(View.VISIBLE);
typeTextView.setVisibility(View.VISIBLE);
} else if (item.icon != 0) {
imageView.setImageResource(item.icon);
imageView.setVisibility(View.VISIBLE);
typeTextView.setVisibility(View.GONE);
} else { } else {
typeTextView.setText(item.ext.toUpperCase().substring(0, Math.min(item.ext.length(), 4))); String type = item.ext.toUpperCase().substring(0, Math.min(item.ext.length(), 4));
imageView.setVisibility(View.GONE); ((TextDetailDocumentsCell) convertView).setTextAndValueAndTypeAndThumb(item.title, item.subtitle, type, item.thumb, 0);
typeTextView.setVisibility(View.VISIBLE);
} }
return v; return convertView;
} }
} }
} }
...@@ -184,7 +184,7 @@ public class GroupCreateFinalActivity extends BaseFragment implements Notificati ...@@ -184,7 +184,7 @@ public class GroupCreateFinalActivity extends BaseFragment implements Notificati
}); });
ActionBarMenu menu = actionBar.createMenu(); ActionBarMenu menu = actionBar.createMenu();
menu.addItem(done_button, R.drawable.ic_done, 0, AndroidUtilities.dp(56)); menu.addItemWithWidth(done_button, R.drawable.ic_done, AndroidUtilities.dp(56));
fragmentView = new LinearLayout(getParentActivity()); fragmentView = new LinearLayout(getParentActivity());
LinearLayout linearLayout = (LinearLayout) fragmentView; LinearLayout linearLayout = (LinearLayout) fragmentView;
...@@ -198,6 +198,7 @@ public class GroupCreateFinalActivity extends BaseFragment implements Notificati ...@@ -198,6 +198,7 @@ public class GroupCreateFinalActivity extends BaseFragment implements Notificati
frameLayout.setLayoutParams(layoutParams); frameLayout.setLayoutParams(layoutParams);
avatarImage = new BackupImageView(getParentActivity()); avatarImage = new BackupImageView(getParentActivity());
avatarImage.imageReceiver.setRoundRadius(AndroidUtilities.dp(32));
avatarDrawable.setInfo(5, null, null, isBroadcast); avatarDrawable.setInfo(5, null, null, isBroadcast);
avatarImage.setImageDrawable(avatarDrawable); avatarImage.setImageDrawable(avatarDrawable);
frameLayout.addView(avatarImage); frameLayout.addView(avatarImage);
...@@ -254,12 +255,12 @@ public class GroupCreateFinalActivity extends BaseFragment implements Notificati ...@@ -254,12 +255,12 @@ public class GroupCreateFinalActivity extends BaseFragment implements Notificati
nameTextView.setMaxLines(4); nameTextView.setMaxLines(4);
nameTextView.setGravity(Gravity.CENTER_VERTICAL | Gravity.LEFT); nameTextView.setGravity(Gravity.CENTER_VERTICAL | Gravity.LEFT);
nameTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16); nameTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
nameTextView.setHintTextColor(0xffa6a6a6); nameTextView.setHintTextColor(0xff979797);
nameTextView.setImeOptions(EditorInfo.IME_FLAG_NO_EXTRACT_UI); nameTextView.setImeOptions(EditorInfo.IME_FLAG_NO_EXTRACT_UI);
nameTextView.setInputType(InputType.TYPE_TEXT_FLAG_CAP_SENTENCES); nameTextView.setInputType(InputType.TYPE_TEXT_FLAG_CAP_SENTENCES);
nameTextView.setPadding(0, 0, 0, AndroidUtilities.dp(8)); nameTextView.setPadding(0, 0, 0, AndroidUtilities.dp(8));
AndroidUtilities.clearCursorDrawable(nameTextView); AndroidUtilities.clearCursorDrawable(nameTextView);
nameTextView.setTextColor(0xff000000); nameTextView.setTextColor(0xff212121);
frameLayout.addView(nameTextView); frameLayout.addView(nameTextView);
layoutParams1 = (FrameLayout.LayoutParams) nameTextView.getLayoutParams(); layoutParams1 = (FrameLayout.LayoutParams) nameTextView.getLayoutParams();
layoutParams1.width = FrameLayout.LayoutParams.MATCH_PARENT; layoutParams1.width = FrameLayout.LayoutParams.MATCH_PARENT;
......
...@@ -20,6 +20,7 @@ import android.widget.AbsListView; ...@@ -20,6 +20,7 @@ import android.widget.AbsListView;
import android.widget.AdapterView; import android.widget.AdapterView;
import android.widget.EditText; import android.widget.EditText;
import android.widget.FrameLayout; import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.ListView; import android.widget.ListView;
import android.widget.TextView; import android.widget.TextView;
...@@ -94,7 +95,6 @@ public class LanguageSelectActivity extends BaseFragment { ...@@ -94,7 +95,6 @@ public class LanguageSelectActivity extends BaseFragment {
if (text.length() != 0) { if (text.length() != 0) {
searchWas = true; searchWas = true;
if (listView != null) { if (listView != null) {
listView.setPadding(AndroidUtilities.dp(16), listView.getPaddingTop(), AndroidUtilities.dp(16), listView.getPaddingBottom());
listView.setAdapter(searchListViewAdapter); listView.setAdapter(searchListViewAdapter);
} }
} }
...@@ -106,27 +106,44 @@ public class LanguageSelectActivity extends BaseFragment { ...@@ -106,27 +106,44 @@ public class LanguageSelectActivity extends BaseFragment {
fragmentView = new FrameLayout(getParentActivity()); fragmentView = new FrameLayout(getParentActivity());
emptyTextView = new TextView(getParentActivity()); LinearLayout emptyTextLayout = new LinearLayout(getParentActivity());
emptyTextView.setTextColor(0xff808080); emptyTextLayout.setVisibility(View.INVISIBLE);
emptyTextView.setTextSize(24); emptyTextLayout.setOrientation(LinearLayout.VERTICAL);
emptyTextView.setGravity(Gravity.CENTER); ((FrameLayout) fragmentView).addView(emptyTextLayout);
emptyTextView.setVisibility(View.INVISIBLE); FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) emptyTextLayout.getLayoutParams();
emptyTextView.setText(LocaleController.getString("NoResult", R.string.NoResult));
((FrameLayout) fragmentView).addView(emptyTextView);
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) emptyTextView.getLayoutParams();
layoutParams.width = FrameLayout.LayoutParams.MATCH_PARENT; layoutParams.width = FrameLayout.LayoutParams.MATCH_PARENT;
layoutParams.height = FrameLayout.LayoutParams.MATCH_PARENT; layoutParams.height = FrameLayout.LayoutParams.MATCH_PARENT;
layoutParams.gravity = Gravity.TOP; layoutParams.gravity = Gravity.TOP;
emptyTextView.setLayoutParams(layoutParams); emptyTextLayout.setLayoutParams(layoutParams);
emptyTextView.setOnTouchListener(new View.OnTouchListener() { emptyTextLayout.setOnTouchListener(new View.OnTouchListener() {
@Override @Override
public boolean onTouch(View v, MotionEvent event) { public boolean onTouch(View v, MotionEvent event) {
return true; return true;
} }
}); });
emptyTextView = new TextView(getParentActivity());
emptyTextView.setTextColor(0xff808080);
emptyTextView.setTextSize(20);
emptyTextView.setGravity(Gravity.CENTER);
emptyTextView.setText(LocaleController.getString("NoResult", R.string.NoResult));
emptyTextLayout.addView(emptyTextView);
LinearLayout.LayoutParams layoutParams1 = (LinearLayout.LayoutParams) emptyTextView.getLayoutParams();
layoutParams1.width = LinearLayout.LayoutParams.MATCH_PARENT;
layoutParams1.height = LinearLayout.LayoutParams.MATCH_PARENT;
layoutParams1.weight = 0.5f;
emptyTextView.setLayoutParams(layoutParams1);
FrameLayout frameLayout = new FrameLayout(getParentActivity());
emptyTextLayout.addView(frameLayout);
layoutParams1 = (LinearLayout.LayoutParams) frameLayout.getLayoutParams();
layoutParams1.width = LinearLayout.LayoutParams.MATCH_PARENT;
layoutParams1.height = LinearLayout.LayoutParams.MATCH_PARENT;
layoutParams1.weight = 0.5f;
frameLayout.setLayoutParams(layoutParams1);
listView = new ListView(getParentActivity()); listView = new ListView(getParentActivity());
listView.setEmptyView(emptyTextView); listView.setEmptyView(emptyTextLayout);
listView.setVerticalScrollBarEnabled(false); listView.setVerticalScrollBarEnabled(false);
listView.setDivider(null); listView.setDivider(null);
listView.setDividerHeight(0); listView.setDividerHeight(0);
......
...@@ -27,6 +27,7 @@ import com.google.android.gms.maps.model.LatLng; ...@@ -27,6 +27,7 @@ import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.Marker; import com.google.android.gms.maps.model.Marker;
import com.google.android.gms.maps.model.MarkerOptions; import com.google.android.gms.maps.model.MarkerOptions;
import org.telegram.android.AndroidUtilities;
import org.telegram.android.ContactsController; import org.telegram.android.ContactsController;
import org.telegram.messenger.FileLog; import org.telegram.messenger.FileLog;
import org.telegram.android.LocaleController; import org.telegram.android.LocaleController;
...@@ -145,6 +146,7 @@ public class LocationActivity extends BaseFragment implements NotificationCenter ...@@ -145,6 +146,7 @@ public class LocationActivity extends BaseFragment implements NotificationCenter
avatarImageView = (BackupImageView)fragmentView.findViewById(R.id.location_avatar_view); avatarImageView = (BackupImageView)fragmentView.findViewById(R.id.location_avatar_view);
if (avatarImageView != null) { if (avatarImageView != null) {
avatarImageView.processDetach = false; avatarImageView.processDetach = false;
avatarImageView.imageReceiver.setRoundRadius(AndroidUtilities.dp(32));
} }
nameTextView = (TextView)fragmentView.findViewById(R.id.location_name_label); nameTextView = (TextView)fragmentView.findViewById(R.id.location_name_label);
distanceTextView = (TextView)fragmentView.findViewById(R.id.location_distance_label); distanceTextView = (TextView)fragmentView.findViewById(R.id.location_distance_label);
......
...@@ -117,7 +117,7 @@ public class LoginActivity extends BaseFragment { ...@@ -117,7 +117,7 @@ public class LoginActivity extends BaseFragment {
}); });
ActionBarMenu menu = actionBar.createMenu(); ActionBarMenu menu = actionBar.createMenu();
menu.addItem(done_button, R.drawable.ic_done, 0, AndroidUtilities.dp(56)); menu.addItemWithWidth(done_button, R.drawable.ic_done, AndroidUtilities.dp(56));
fragmentView = new ScrollView(getParentActivity()); fragmentView = new ScrollView(getParentActivity());
ScrollView scrollView = (ScrollView) fragmentView; ScrollView scrollView = (ScrollView) fragmentView;
...@@ -207,14 +207,18 @@ public class LoginActivity extends BaseFragment { ...@@ -207,14 +207,18 @@ public class LoginActivity extends BaseFragment {
@Override @Override
public void onPause() { public void onPause() {
super.onPause(); super.onPause();
if (!AndroidUtilities.isTablet()) {
getParentActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN); getParentActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
} }
}
@Override @Override
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
if (!AndroidUtilities.isTablet()) {
getParentActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE); getParentActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
} }
}
private Bundle loadCurrentState() { private Bundle loadCurrentState() {
try { try {
...@@ -411,6 +415,7 @@ public class LoginActivity extends BaseFragment { ...@@ -411,6 +415,7 @@ public class LoginActivity extends BaseFragment {
public void needFinishActivity() { public void needFinishActivity() {
clearCurrentState(); clearCurrentState();
presentFragment(new MessagesActivity(null), true); presentFragment(new MessagesActivity(null), true);
NotificationCenter.getInstance().postNotificationName(NotificationCenter.mainUserInfoChanged);
} }
public class SlideView extends LinearLayout { public class SlideView extends LinearLayout {
...@@ -989,7 +994,7 @@ public class LoginActivity extends BaseFragment { ...@@ -989,7 +994,7 @@ public class LoginActivity extends BaseFragment {
codeField.setHintTextColor(0xff979797); codeField.setHintTextColor(0xff979797);
codeField.setImeOptions(EditorInfo.IME_ACTION_NEXT | EditorInfo.IME_FLAG_NO_EXTRACT_UI); codeField.setImeOptions(EditorInfo.IME_ACTION_NEXT | EditorInfo.IME_FLAG_NO_EXTRACT_UI);
codeField.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16); codeField.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
codeField.setInputType(InputType.TYPE_NUMBER_FLAG_DECIMAL); codeField.setInputType(InputType.TYPE_CLASS_NUMBER);
codeField.setMaxLines(1); codeField.setMaxLines(1);
codeField.setPadding(0, 0, 0, 0); codeField.setPadding(0, 0, 0, 0);
addView(codeField); addView(codeField);
......
...@@ -41,6 +41,7 @@ import java.util.ArrayList; ...@@ -41,6 +41,7 @@ import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
public class MediaActivity extends BaseFragment implements NotificationCenter.NotificationCenterDelegate, PhotoViewer.PhotoViewerProvider { public class MediaActivity extends BaseFragment implements NotificationCenter.NotificationCenterDelegate, PhotoViewer.PhotoViewerProvider {
private GridView listView; private GridView listView;
private ListAdapter listAdapter; private ListAdapter listAdapter;
private ArrayList<MessageObject> messages = new ArrayList<MessageObject>(); private ArrayList<MessageObject> messages = new ArrayList<MessageObject>();
......
...@@ -58,7 +58,7 @@ public class MessagesActivity extends BaseFragment implements NotificationCenter ...@@ -58,7 +58,7 @@ public class MessagesActivity extends BaseFragment implements NotificationCenter
private ListView messagesListView; private ListView messagesListView;
private DialogsAdapter dialogsAdapter; private DialogsAdapter dialogsAdapter;
private DialogsSearchAdapter dialogsSearchAdapter; private DialogsSearchAdapter dialogsSearchAdapter;
private TextView searchEmptyView; private View searchEmptyView;
private View progressView; private View progressView;
private View emptyView; private View emptyView;
private ImageView floatingButton; private ImageView floatingButton;
...@@ -243,14 +243,13 @@ public class MessagesActivity extends BaseFragment implements NotificationCenter ...@@ -243,14 +243,13 @@ public class MessagesActivity extends BaseFragment implements NotificationCenter
progressView = fragmentView.findViewById(R.id.progressLayout); progressView = fragmentView.findViewById(R.id.progressLayout);
dialogsAdapter.notifyDataSetChanged(); dialogsAdapter.notifyDataSetChanged();
searchEmptyView = (TextView)fragmentView.findViewById(R.id.searchEmptyView); searchEmptyView = fragmentView.findViewById(R.id.search_empty_view);
searchEmptyView.setOnTouchListener(new View.OnTouchListener() { searchEmptyView.setOnTouchListener(new View.OnTouchListener() {
@Override @Override
public boolean onTouch(View v, MotionEvent event) { public boolean onTouch(View v, MotionEvent event) {
return true; return true;
} }
}); });
searchEmptyView.setText(LocaleController.getString("NoResult", R.string.NoResult));
emptyView = fragmentView.findViewById(R.id.list_empty_view); emptyView = fragmentView.findViewById(R.id.list_empty_view);
emptyView.setOnTouchListener(new View.OnTouchListener() { emptyView.setOnTouchListener(new View.OnTouchListener() {
@Override @Override
...@@ -258,10 +257,14 @@ public class MessagesActivity extends BaseFragment implements NotificationCenter ...@@ -258,10 +257,14 @@ public class MessagesActivity extends BaseFragment implements NotificationCenter
return true; return true;
} }
}); });
TextView textView = (TextView)fragmentView.findViewById(R.id.list_empty_view_text1); TextView textView = (TextView)fragmentView.findViewById(R.id.list_empty_view_text1);
textView.setText(LocaleController.getString("NoChats", R.string.NoChats)); textView.setText(LocaleController.getString("NoChats", R.string.NoChats));
textView = (TextView)fragmentView.findViewById(R.id.list_empty_view_text2); textView = (TextView)fragmentView.findViewById(R.id.list_empty_view_text2);
textView.setText(LocaleController.getString("NoChats", R.string.NoChatsHelp)); textView.setText(LocaleController.getString("NoChatsHelp", R.string.NoChatsHelp));
textView = (TextView)fragmentView.findViewById(R.id.search_empty_text);
textView.setText(LocaleController.getString("NoResult", R.string.NoResult));
floatingButton = (ImageView)fragmentView.findViewById(R.id.floating_button); floatingButton = (ImageView)fragmentView.findViewById(R.id.floating_button);
floatingButton.setVisibility(onlySelect ? View.GONE : View.VISIBLE); floatingButton.setVisibility(onlySelect ? View.GONE : View.VISIBLE);
...@@ -393,56 +396,40 @@ public class MessagesActivity extends BaseFragment implements NotificationCenter ...@@ -393,56 +396,40 @@ public class MessagesActivity extends BaseFragment implements NotificationCenter
int lower_id = (int)selectedDialog; int lower_id = (int)selectedDialog;
int high_id = (int)(selectedDialog >> 32); int high_id = (int)(selectedDialog >> 32);
if (lower_id < 0 && high_id != 1) { final boolean isChat = lower_id < 0 && high_id != 1;
builder.setItems(new CharSequence[]{LocaleController.getString("ClearHistory", R.string.ClearHistory), LocaleController.getString("DeleteChat", R.string.DeleteChat)}, new DialogInterface.OnClickListener() { builder.setItems(new CharSequence[]{LocaleController.getString("ClearHistory", R.string.ClearHistory),
isChat ? LocaleController.getString("DeleteChat", R.string.DeleteChat) : LocaleController.getString("Delete", R.string.Delete)}, new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, final int which) {
if (which == 0) {
MessagesController.getInstance().deleteDialog(selectedDialog, 0, true);
} else if (which == 1) {
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity()); AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
builder.setMessage(LocaleController.getString("AreYouSureDeleteAndExit", R.string.AreYouSureDeleteAndExit));
builder.setTitle(LocaleController.getString("AppName", R.string.AppName)); builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
MessagesController.getInstance().deleteUserFromChat((int) -selectedDialog, MessagesController.getInstance().getUser(UserConfig.getClientUserId()), null);
MessagesController.getInstance().deleteDialog(selectedDialog, 0, false);
if (AndroidUtilities.isTablet()) {
NotificationCenter.getInstance().postNotificationName(NotificationCenter.closeChats, selectedDialog);
}
}
});
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
showAlertDialog(builder);
}
}
});
} else {
builder.setItems(new CharSequence[]{LocaleController.getString("ClearHistory", R.string.ClearHistory), LocaleController.getString("Delete", R.string.Delete)}, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
if (which == 0) { if (which == 0) {
MessagesController.getInstance().deleteDialog(selectedDialog, 0, true); builder.setMessage(LocaleController.getString("AreYouSureClearHistory", R.string.AreYouSureClearHistory));
} else {
if (isChat) {
builder.setMessage(LocaleController.getString("AreYouSureDeleteAndExit", R.string.AreYouSureDeleteAndExit));
} else { } else {
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
builder.setMessage(LocaleController.getString("AreYouSureDeleteThisChat", R.string.AreYouSureDeleteThisChat)); builder.setMessage(LocaleController.getString("AreYouSureDeleteThisChat", R.string.AreYouSureDeleteThisChat));
builder.setTitle(LocaleController.getString("AppName", R.string.AppName)); }
}
builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), new DialogInterface.OnClickListener() { builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialogInterface, int i) { public void onClick(DialogInterface dialogInterface, int i) {
MessagesController.getInstance().deleteDialog(selectedDialog, 0, false); MessagesController.getInstance().deleteDialog(selectedDialog, 0, which == 0);
if (which != 0) {
if (isChat) {
MessagesController.getInstance().deleteUserFromChat((int) -selectedDialog, MessagesController.getInstance().getUser(UserConfig.getClientUserId()), null);
}
if (AndroidUtilities.isTablet()) { if (AndroidUtilities.isTablet()) {
NotificationCenter.getInstance().postNotificationName(NotificationCenter.closeChats, selectedDialog); NotificationCenter.getInstance().postNotificationName(NotificationCenter.closeChats, selectedDialog);
} }
} }
}
}); });
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null); builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
showAlertDialog(builder); showAlertDialog(builder);
} }
}
}); });
}
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null); builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
showAlertDialog(builder); showAlertDialog(builder);
return true; return true;
...@@ -545,7 +532,6 @@ public class MessagesActivity extends BaseFragment implements NotificationCenter ...@@ -545,7 +532,6 @@ public class MessagesActivity extends BaseFragment implements NotificationCenter
emptyView.setVisibility(View.GONE); emptyView.setVisibility(View.GONE);
messagesListView.setEmptyView(progressView); messagesListView.setEmptyView(progressView);
} else { } else {
if (messagesListView.getEmptyView() == null) {
if (searching && searchWas) { if (searching && searchWas) {
messagesListView.setEmptyView(searchEmptyView); messagesListView.setEmptyView(searchEmptyView);
emptyView.setVisibility(View.GONE); emptyView.setVisibility(View.GONE);
...@@ -553,7 +539,6 @@ public class MessagesActivity extends BaseFragment implements NotificationCenter ...@@ -553,7 +539,6 @@ public class MessagesActivity extends BaseFragment implements NotificationCenter
messagesListView.setEmptyView(emptyView); messagesListView.setEmptyView(emptyView);
searchEmptyView.setVisibility(View.GONE); searchEmptyView.setVisibility(View.GONE);
} }
}
progressView.setVisibility(View.GONE); progressView.setVisibility(View.GONE);
} }
} }
......
...@@ -353,7 +353,7 @@ public class PhotoCropActivity extends BaseFragment { ...@@ -353,7 +353,7 @@ public class PhotoCropActivity extends BaseFragment {
}); });
ActionBarMenu menu = actionBar.createMenu(); ActionBarMenu menu = actionBar.createMenu();
menu.addItem(done_button, R.drawable.ic_done, 0, AndroidUtilities.dp(56)); menu.addItemWithWidth(done_button, R.drawable.ic_done, AndroidUtilities.dp(56));
fragmentView = view = new PhotoCropView(getParentActivity()); fragmentView = view = new PhotoCropView(getParentActivity());
fragmentView.setLayoutParams(new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT)); fragmentView.setLayoutParams(new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT));
......
...@@ -76,6 +76,7 @@ import java.util.HashMap; ...@@ -76,6 +76,7 @@ import java.util.HashMap;
import java.util.Locale; import java.util.Locale;
public class PhotoViewer implements NotificationCenter.NotificationCenterDelegate, GestureDetector.OnGestureListener, GestureDetector.OnDoubleTapListener { public class PhotoViewer implements NotificationCenter.NotificationCenterDelegate, GestureDetector.OnGestureListener, GestureDetector.OnDoubleTapListener {
private int classGuid; private int classGuid;
private PhotoViewerProvider placeProvider; private PhotoViewerProvider placeProvider;
private boolean isVisible; private boolean isVisible;
...@@ -325,6 +326,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat ...@@ -325,6 +326,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
public int user_id; public int user_id;
public int index; public int index;
public int size; public int size;
public int radius;
} }
public static interface PhotoViewerProvider { public static interface PhotoViewerProvider {
...@@ -602,6 +604,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat ...@@ -602,6 +604,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
actionBar = new ActionBar(activity); actionBar = new ActionBar(activity);
actionBar.setBackgroundColor(0x7F000000); actionBar.setBackgroundColor(0x7F000000);
actionBar.setOccupyStatusBar(false);
actionBar.setItemsBackground(R.drawable.bar_selector_white); actionBar.setItemsBackground(R.drawable.bar_selector_white);
actionBar.setBackButtonImage(R.drawable.ic_ab_back); actionBar.setBackButtonImage(R.drawable.ic_ab_back);
actionBar.setTitle(LocaleController.formatString("Of", R.string.Of, 1, 1)); actionBar.setTitle(LocaleController.formatString("Of", R.string.Of, 1, 1));
...@@ -1591,6 +1594,8 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat ...@@ -1591,6 +1594,8 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
final Rect drawRegion = object.imageReceiver.getDrawRegion(); final Rect drawRegion = object.imageReceiver.getDrawRegion();
animatingImageView.setVisibility(View.VISIBLE); animatingImageView.setVisibility(View.VISIBLE);
animatingImageView.setRadius(object.radius);
animatingImageView.setNeedRadius(object.radius != 0);
animatingImageView.setImageBitmap(object.thumb); animatingImageView.setImageBitmap(object.thumb);
ViewProxy.setAlpha(animatingImageView, 1.0f); ViewProxy.setAlpha(animatingImageView, 1.0f);
...@@ -1643,6 +1648,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat ...@@ -1643,6 +1648,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
ObjectAnimatorProxy.ofInt(animatingImageView, "clipHorizontal", clipHorizontal, 0), ObjectAnimatorProxy.ofInt(animatingImageView, "clipHorizontal", clipHorizontal, 0),
ObjectAnimatorProxy.ofInt(animatingImageView, "clipTop", clipTop, 0), ObjectAnimatorProxy.ofInt(animatingImageView, "clipTop", clipTop, 0),
ObjectAnimatorProxy.ofInt(animatingImageView, "clipBottom", clipBottom, 0), ObjectAnimatorProxy.ofInt(animatingImageView, "clipBottom", clipBottom, 0),
ObjectAnimatorProxy.ofInt(animatingImageView, "radius", 0),
ObjectAnimatorProxy.ofFloat(containerView, "alpha", 0.0f, 1.0f) ObjectAnimatorProxy.ofFloat(containerView, "alpha", 0.0f, 1.0f)
); );
...@@ -1731,11 +1737,13 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat ...@@ -1731,11 +1737,13 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
final ViewGroup.LayoutParams layoutParams = animatingImageView.getLayoutParams(); final ViewGroup.LayoutParams layoutParams = animatingImageView.getLayoutParams();
Rect drawRegion = null; Rect drawRegion = null;
if (object != null) { if (object != null) {
animatingImageView.setNeedRadius(object.radius != 0);
drawRegion = object.imageReceiver.getDrawRegion(); drawRegion = object.imageReceiver.getDrawRegion();
layoutParams.width = drawRegion.right - drawRegion.left; layoutParams.width = drawRegion.right - drawRegion.left;
layoutParams.height = drawRegion.bottom - drawRegion.top; layoutParams.height = drawRegion.bottom - drawRegion.top;
animatingImageView.setImageBitmap(object.thumb); animatingImageView.setImageBitmap(object.thumb);
} else { } else {
animatingImageView.setNeedRadius(false);
layoutParams.width = centerImage.getImageWidth(); layoutParams.width = centerImage.getImageWidth();
layoutParams.height = centerImage.getImageHeight(); layoutParams.height = centerImage.getImageHeight();
animatingImageView.setImageBitmap(centerImage.getBitmap()); animatingImageView.setImageBitmap(centerImage.getBitmap());
...@@ -1782,6 +1790,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat ...@@ -1782,6 +1790,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
ObjectAnimatorProxy.ofInt(animatingImageView, "clipHorizontal", clipHorizontal), ObjectAnimatorProxy.ofInt(animatingImageView, "clipHorizontal", clipHorizontal),
ObjectAnimatorProxy.ofInt(animatingImageView, "clipTop", clipTop), ObjectAnimatorProxy.ofInt(animatingImageView, "clipTop", clipTop),
ObjectAnimatorProxy.ofInt(animatingImageView, "clipBottom", clipBottom), ObjectAnimatorProxy.ofInt(animatingImageView, "clipBottom", clipBottom),
ObjectAnimatorProxy.ofInt(animatingImageView, "radius", object.radius),
ObjectAnimatorProxy.ofFloat(containerView, "alpha", 0.0f) ObjectAnimatorProxy.ofFloat(containerView, "alpha", 0.0f)
); );
} else { } else {
......
...@@ -224,6 +224,9 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter. ...@@ -224,6 +224,9 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
actionBar.setBackButtonImage(R.drawable.ic_ab_back); actionBar.setBackButtonImage(R.drawable.ic_ab_back);
actionBar.setBackOverlay(R.layout.updating_state_layout); actionBar.setBackOverlay(R.layout.updating_state_layout);
actionBar.setExtraHeight(AndroidUtilities.dp(88), false); actionBar.setExtraHeight(AndroidUtilities.dp(88), false);
if (AndroidUtilities.isTablet()) {
actionBar.setOccupyStatusBar(false);
}
actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() { actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {
@Override @Override
public void onItemClick(final int id) { public void onItemClick(final int id) {
...@@ -675,7 +678,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter. ...@@ -675,7 +678,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
FrameLayout.LayoutParams layoutParams; FrameLayout.LayoutParams layoutParams;
if (listView != null) { if (listView != null) {
layoutParams = (FrameLayout.LayoutParams) listView.getLayoutParams(); layoutParams = (FrameLayout.LayoutParams) listView.getLayoutParams();
layoutParams.topMargin = (Build.VERSION.SDK_INT >= 21 ? AndroidUtilities.statusBarHeight : 0) + AndroidUtilities.getCurrentActionBarHeight(); layoutParams.topMargin = (actionBar.getOccupyStatusBar() ? AndroidUtilities.statusBarHeight : 0) + AndroidUtilities.getCurrentActionBarHeight();
listView.setLayoutParams(layoutParams); listView.setLayoutParams(layoutParams);
} }
...@@ -694,7 +697,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter. ...@@ -694,7 +697,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
if (writeButton != null) { if (writeButton != null) {
layoutParams = (FrameLayout.LayoutParams) writeButton.getLayoutParams(); layoutParams = (FrameLayout.LayoutParams) writeButton.getLayoutParams();
layoutParams.topMargin = (Build.VERSION.SDK_INT >= 21 ? AndroidUtilities.statusBarHeight : 0) + AndroidUtilities.getCurrentActionBarHeight() + actionBar.getExtraHeight() - AndroidUtilities.dp(29.5f); layoutParams.topMargin = (actionBar.getOccupyStatusBar() ? AndroidUtilities.statusBarHeight : 0) + AndroidUtilities.getCurrentActionBarHeight() + actionBar.getExtraHeight() - AndroidUtilities.dp(29.5f);
writeButton.setLayoutParams(layoutParams); writeButton.setLayoutParams(layoutParams);
ViewProxy.setAlpha(writeButton, diff); ViewProxy.setAlpha(writeButton, diff);
writeButton.setVisibility(diff == 0 ? View.GONE : View.VISIBLE); writeButton.setVisibility(diff == 0 ? View.GONE : View.VISIBLE);
...@@ -877,6 +880,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter. ...@@ -877,6 +880,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
object.user_id = user_id; object.user_id = user_id;
object.thumb = object.imageReceiver.getBitmap(); object.thumb = object.imageReceiver.getBitmap();
object.size = -1; object.size = -1;
object.radius = avatarImage.imageReceiver.getRoundRadius();
return object; return object;
} }
return null; return null;
...@@ -1019,6 +1023,9 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter. ...@@ -1019,6 +1023,9 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
} }
private void updateProfileData() { private void updateProfileData() {
if (avatarImage == null) {
return;
}
if (user_id != 0) { if (user_id != 0) {
TLRPC.User user = MessagesController.getInstance().getUser(user_id); TLRPC.User user = MessagesController.getInstance().getUser(user_id);
TLRPC.FileLocation photo = null; TLRPC.FileLocation photo = null;
...@@ -1219,7 +1226,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter. ...@@ -1219,7 +1226,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
view = new TextCell(mContext); view = new TextCell(mContext);
} }
TextCell textCell = (TextCell) view; TextCell textCell = (TextCell) view;
textCell.setTextColor(0xff000000); textCell.setTextColor(0xff212121);
if (i == sharedMediaRow) { if (i == sharedMediaRow) {
String value; String value;
......
...@@ -254,7 +254,7 @@ public class VideoEditorActivity extends BaseFragment implements TextureView.Sur ...@@ -254,7 +254,7 @@ public class VideoEditorActivity extends BaseFragment implements TextureView.Sur
}); });
ActionBarMenu menu = actionBar.createMenu(); ActionBarMenu menu = actionBar.createMenu();
menu.addItem(1, R.drawable.ic_done, 0, AndroidUtilities.dp(56)); menu.addItemWithWidth(1, R.drawable.ic_done, AndroidUtilities.dp(56));
fragmentView = inflater.inflate(R.layout.video_editor_layout, container, false); fragmentView = inflater.inflate(R.layout.video_editor_layout, container, false);
originalSizeTextView = (TextView) fragmentView.findViewById(R.id.original_size); originalSizeTextView = (TextView) fragmentView.findViewById(R.id.original_size);
......
...@@ -10,9 +10,13 @@ package org.telegram.ui.Views; ...@@ -10,9 +10,13 @@ package org.telegram.ui.Views;
import android.content.Context; import android.content.Context;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.BitmapShader;
import android.graphics.Canvas; import android.graphics.Canvas;
import android.graphics.Matrix;
import android.graphics.Paint; import android.graphics.Paint;
import android.graphics.Rect; import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.Shader;
import android.view.View; import android.view.View;
import org.telegram.messenger.FileLog; import org.telegram.messenger.FileLog;
...@@ -28,6 +32,14 @@ public class ClippingImageView extends View { ...@@ -28,6 +32,14 @@ public class ClippingImageView extends View {
private Bitmap bmp; private Bitmap bmp;
private onDrawListener drawListener; private onDrawListener drawListener;
private boolean needRadius;
private int radius;
private BitmapShader bitmapShader;
private Paint roundPaint;
private RectF roundRect;
private RectF bitmapRect;
private Matrix shaderMatrix;
public static interface onDrawListener { public static interface onDrawListener {
public abstract void onDraw(); public abstract void onDraw();
} }
...@@ -59,6 +71,10 @@ public class ClippingImageView extends View { ...@@ -59,6 +71,10 @@ public class ClippingImageView extends View {
return clipTop; return clipTop;
} }
public int getRadius() {
return radius;
}
public void onDraw(Canvas canvas) { public void onDraw(Canvas canvas) {
if (getVisibility() == GONE || getVisibility() == INVISIBLE) { if (getVisibility() == GONE || getVisibility() == INVISIBLE) {
return; return;
...@@ -69,13 +85,21 @@ public class ClippingImageView extends View { ...@@ -69,13 +85,21 @@ public class ClippingImageView extends View {
drawListener.onDraw(); drawListener.onDraw();
} }
canvas.save(); canvas.save();
if (needRadius) {
roundRect.set(0, 0, getWidth(), getHeight());
shaderMatrix.reset();
shaderMatrix.setRectToRect(bitmapRect, roundRect, Matrix.ScaleToFit.FILL);
bitmapShader.setLocalMatrix(shaderMatrix);
canvas.drawRoundRect(roundRect, radius, radius, roundPaint);
} else {
canvas.clipRect(clipLeft / scaleY, clipTop / scaleY, getWidth() - clipRight / scaleY, getHeight() - clipBottom / scaleY); canvas.clipRect(clipLeft / scaleY, clipTop / scaleY, getWidth() - clipRight / scaleY, getHeight() - clipBottom / scaleY);
drawRect.set(0, 0, getWidth(), getHeight()); drawRect.set(0, 0, getWidth(), getHeight());
try { try {
canvas.drawBitmap(this.bmp, null, drawRect, this.paint); canvas.drawBitmap(bmp, null, drawRect, paint);
} catch (Exception e) { } catch (Exception e) {
FileLog.e("tmessages", e); FileLog.e("tmessages", e);
} }
}
canvas.restore(); canvas.restore();
} }
} }
...@@ -114,10 +138,27 @@ public class ClippingImageView extends View { ...@@ -114,10 +138,27 @@ public class ClippingImageView extends View {
public void setImageBitmap(Bitmap bitmap) { public void setImageBitmap(Bitmap bitmap) {
bmp = bitmap; bmp = bitmap;
if (bitmap != null && needRadius) {
roundRect = new RectF();
shaderMatrix = new Matrix();
bitmapRect = new RectF();
bitmapRect.set(0, 0, bitmap.getWidth(), bitmap.getHeight());
bitmapShader = new BitmapShader(bitmap, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP);
roundPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
roundPaint.setShader(bitmapShader);
}
invalidate(); invalidate();
} }
public void setOnDrawListener(onDrawListener listener) { public void setOnDrawListener(onDrawListener listener) {
drawListener = listener; drawListener = listener;
} }
public void setNeedRadius(boolean value) {
needRadius = value;
}
public void setRadius(int value) {
radius = value;
}
} }
...@@ -155,7 +155,7 @@ public class WallpapersActivity extends BaseFragment implements NotificationCent ...@@ -155,7 +155,7 @@ public class WallpapersActivity extends BaseFragment implements NotificationCent
}); });
ActionBarMenu menu = actionBar.createMenu(); ActionBarMenu menu = actionBar.createMenu();
doneButton = menu.addItem(done_button, R.drawable.ic_done, 0, AndroidUtilities.dp(56)); doneButton = menu.addItemWithWidth(done_button, R.drawable.ic_done, AndroidUtilities.dp(56));
fragmentView = inflater.inflate(R.layout.settings_wallpapers_layout, container, false); fragmentView = inflater.inflate(R.layout.settings_wallpapers_layout, container, false);
listAdapter = new ListAdapter(getParentActivity()); listAdapter = new ListAdapter(getParentActivity());
......
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:fromYDelta="-100%"
android:toYDelta="0"
android:duration="200"/>
</set>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:fromYDelta="0%"
android:toYDelta="-100%"
android:duration="200"/>
</set>
\ No newline at end of file
TMessagesProj/src/main/res/drawable-hdpi/ic_directory.png

652 Bytes | W: | H:

TMessagesProj/src/main/res/drawable-hdpi/ic_directory.png

227 Bytes | W: | H:

TMessagesProj/src/main/res/drawable-hdpi/ic_directory.png
TMessagesProj/src/main/res/drawable-hdpi/ic_directory.png
TMessagesProj/src/main/res/drawable-hdpi/ic_directory.png
TMessagesProj/src/main/res/drawable-hdpi/ic_directory.png
  • 2-up
  • Swipe
  • Onion skin
TMessagesProj/src/main/res/drawable-hdpi/ic_external_storage.png

444 Bytes | W: | H:

TMessagesProj/src/main/res/drawable-hdpi/ic_external_storage.png

373 Bytes | W: | H:

TMessagesProj/src/main/res/drawable-hdpi/ic_external_storage.png
TMessagesProj/src/main/res/drawable-hdpi/ic_external_storage.png
TMessagesProj/src/main/res/drawable-hdpi/ic_external_storage.png
TMessagesProj/src/main/res/drawable-hdpi/ic_external_storage.png
  • 2-up
  • Swipe
  • Onion skin
TMessagesProj/src/main/res/drawable-hdpi/ic_storage.png

325 Bytes | W: | H:

TMessagesProj/src/main/res/drawable-hdpi/ic_storage.png

198 Bytes | W: | H:

TMessagesProj/src/main/res/drawable-hdpi/ic_storage.png
TMessagesProj/src/main/res/drawable-hdpi/ic_storage.png
TMessagesProj/src/main/res/drawable-hdpi/ic_storage.png
TMessagesProj/src/main/res/drawable-hdpi/ic_storage.png
  • 2-up
  • Swipe
  • Onion skin
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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