More Android L design
@ -71,24 +71,22 @@ public class AndroidUtilities {
|
|||||||
if (manager != null && manager.getDefaultDisplay() != null) {
|
if (manager != null && manager.getDefaultDisplay() != null) {
|
||||||
int rotation = manager.getDefaultDisplay().getRotation();
|
int rotation = manager.getDefaultDisplay().getRotation();
|
||||||
int orientation = activity.getResources().getConfiguration().orientation;
|
int orientation = activity.getResources().getConfiguration().orientation;
|
||||||
|
int SCREEN_ORIENTATION_REVERSE_LANDSCAPE = 8;
|
||||||
|
int SCREEN_ORIENTATION_REVERSE_PORTRAIT = 9;
|
||||||
|
if (Build.VERSION.SDK_INT < 9) {
|
||||||
|
SCREEN_ORIENTATION_REVERSE_LANDSCAPE = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;
|
||||||
|
SCREEN_ORIENTATION_REVERSE_PORTRAIT = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
|
||||||
|
}
|
||||||
|
|
||||||
if (rotation == Surface.ROTATION_270) {
|
if (rotation == Surface.ROTATION_270) {
|
||||||
if (orientation == Configuration.ORIENTATION_PORTRAIT) {
|
if (orientation == Configuration.ORIENTATION_PORTRAIT) {
|
||||||
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
||||||
} else {
|
} else {
|
||||||
if (Build.VERSION.SDK_INT >= 9) {
|
activity.setRequestedOrientation(SCREEN_ORIENTATION_REVERSE_LANDSCAPE);
|
||||||
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE);
|
|
||||||
} else {
|
|
||||||
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else if (rotation == Surface.ROTATION_90) {
|
} else if (rotation == Surface.ROTATION_90) {
|
||||||
if (orientation == Configuration.ORIENTATION_PORTRAIT) {
|
if (orientation == Configuration.ORIENTATION_PORTRAIT) {
|
||||||
if (Build.VERSION.SDK_INT >= 9) {
|
activity.setRequestedOrientation(SCREEN_ORIENTATION_REVERSE_PORTRAIT);
|
||||||
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT);
|
|
||||||
} else {
|
|
||||||
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
|
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
|
||||||
}
|
}
|
||||||
@ -100,17 +98,9 @@ public class AndroidUtilities {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (orientation == Configuration.ORIENTATION_LANDSCAPE) {
|
if (orientation == Configuration.ORIENTATION_LANDSCAPE) {
|
||||||
if (Build.VERSION.SDK_INT >= 9) {
|
activity.setRequestedOrientation(SCREEN_ORIENTATION_REVERSE_LANDSCAPE);
|
||||||
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE);
|
|
||||||
} else {
|
|
||||||
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if (Build.VERSION.SDK_INT >= 9) {
|
activity.setRequestedOrientation(SCREEN_ORIENTATION_REVERSE_PORTRAIT);
|
||||||
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT);
|
|
||||||
} else {
|
|
||||||
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -472,7 +462,7 @@ public class AndroidUtilities {
|
|||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setListViewEdgeEffectColor(ListView listView, int color) {
|
public static void setListViewEdgeEffectColor(AbsListView listView, int color) {
|
||||||
if (Build.VERSION.SDK_INT >= 21) {
|
if (Build.VERSION.SDK_INT >= 21) {
|
||||||
try {
|
try {
|
||||||
Field field = AbsListView.class.getDeclaredField("mEdgeGlowTop");
|
Field field = AbsListView.class.getDeclaredField("mEdgeGlowTop");
|
||||||
|
@ -41,6 +41,7 @@ import java.util.Locale;
|
|||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
public class ContactsController {
|
public class ContactsController {
|
||||||
|
|
||||||
private Account currentAccount;
|
private Account currentAccount;
|
||||||
private boolean loadingContacts = false;
|
private boolean loadingContacts = false;
|
||||||
private static final Object loadContactsSync = new Object();
|
private static final Object loadContactsSync = new Object();
|
||||||
@ -108,6 +109,13 @@ public class ContactsController {
|
|||||||
return localInstance;
|
return localInstance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ContactsController() {
|
||||||
|
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", Activity.MODE_PRIVATE);
|
||||||
|
if (preferences.getBoolean("needGetStatuses", false)) {
|
||||||
|
reloadContactsStatuses();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void cleanup() {
|
public void cleanup() {
|
||||||
contactsBook.clear();
|
contactsBook.clear();
|
||||||
contactsBookSPhones.clear();
|
contactsBookSPhones.clear();
|
||||||
@ -1577,6 +1585,42 @@ public class ContactsController {
|
|||||||
}, true, RPCRequest.RPCRequestClassGeneric);
|
}, true, RPCRequest.RPCRequestClassGeneric);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void reloadContactsStatuses() {
|
||||||
|
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", Activity.MODE_PRIVATE);
|
||||||
|
final SharedPreferences.Editor editor = preferences.edit();
|
||||||
|
editor.putBoolean("needGetStatuses", true).commit();
|
||||||
|
TLRPC.TL_contacts_getStatuses req = new TLRPC.TL_contacts_getStatuses();
|
||||||
|
ConnectionsManager.getInstance().performRpc(req, new RPCRequest.RPCRequestDelegate() {
|
||||||
|
@Override
|
||||||
|
public void run(final TLObject response, TLRPC.TL_error error) {
|
||||||
|
if (error == null) {
|
||||||
|
AndroidUtilities.runOnUIThread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
editor.remove("needGetStatuses").commit();
|
||||||
|
TLRPC.Vector vector = (TLRPC.Vector) response;
|
||||||
|
if (!vector.objects.isEmpty()) {
|
||||||
|
ArrayList<TLRPC.User> dbUsersStatus = new ArrayList<TLRPC.User>();
|
||||||
|
for (Object object : vector.objects) {
|
||||||
|
TLRPC.User toDbUser = new TLRPC.User();
|
||||||
|
TLRPC.TL_contactStatus status = (TLRPC.TL_contactStatus) object;
|
||||||
|
TLRPC.User user = MessagesController.getInstance().getUser(status.user_id);
|
||||||
|
if (user != null) {
|
||||||
|
user.status = status.status;
|
||||||
|
}
|
||||||
|
toDbUser.status = status.status;
|
||||||
|
dbUsersStatus.add(toDbUser);
|
||||||
|
}
|
||||||
|
MessagesStorage.getInstance().updateUsers(dbUsersStatus, true, true, true);
|
||||||
|
}
|
||||||
|
NotificationCenter.getInstance().postNotificationName(NotificationCenter.updateInterfaces, MessagesController.UPDATE_MASK_STATUS);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
public void loadPrivacySettings() {
|
public void loadPrivacySettings() {
|
||||||
if (loadingDeleteInfo == 0) {
|
if (loadingDeleteInfo == 0) {
|
||||||
loadingDeleteInfo = 1;
|
loadingDeleteInfo = 1;
|
||||||
@ -1650,6 +1694,7 @@ public class ContactsController {
|
|||||||
public void setPrivacyRules(ArrayList<TLRPC.PrivacyRule> rules) {
|
public void setPrivacyRules(ArrayList<TLRPC.PrivacyRule> rules) {
|
||||||
privacyRules = rules;
|
privacyRules = rules;
|
||||||
NotificationCenter.getInstance().postNotificationName(NotificationCenter.privacyRulesUpdated);
|
NotificationCenter.getInstance().postNotificationName(NotificationCenter.privacyRulesUpdated);
|
||||||
|
reloadContactsStatuses();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String formatName(String firstName, String lastName) {
|
public static String formatName(String firstName, String lastName) {
|
||||||
|
@ -1117,9 +1117,9 @@ public class ImageLoader {
|
|||||||
return b;
|
return b;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static TLRPC.PhotoSize scaleAndSaveImageInternal(Bitmap bitmap, int w, int h, float photoW, float photoH, float scaleFactor, int quality, boolean cache) throws Exception {
|
private static TLRPC.PhotoSize scaleAndSaveImageInternal(Bitmap bitmap, int w, int h, float photoW, float photoH, float scaleFactor, int quality, boolean cache, boolean scaleAnyway) throws Exception {
|
||||||
Bitmap scaledBitmap = null;
|
Bitmap scaledBitmap = null;
|
||||||
if (scaleFactor > 1) {
|
if (scaleFactor > 1 || scaleAnyway) {
|
||||||
scaledBitmap = Bitmap.createScaledBitmap(bitmap, w, h, true);
|
scaledBitmap = Bitmap.createScaledBitmap(bitmap, w, h, true);
|
||||||
} else {
|
} else {
|
||||||
scaledBitmap = bitmap;
|
scaledBitmap = bitmap;
|
||||||
@ -1171,6 +1171,10 @@ public class ImageLoader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static TLRPC.PhotoSize scaleAndSaveImage(Bitmap bitmap, float maxWidth, float maxHeight, int quality, boolean cache) {
|
public static TLRPC.PhotoSize scaleAndSaveImage(Bitmap bitmap, float maxWidth, float maxHeight, int quality, boolean cache) {
|
||||||
|
return scaleAndSaveImage(bitmap, maxWidth, maxHeight, quality, cache, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static TLRPC.PhotoSize scaleAndSaveImage(Bitmap bitmap, float maxWidth, float maxHeight, int quality, boolean cache, int minWidth, int minHeight) {
|
||||||
if (bitmap == null) {
|
if (bitmap == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -1179,7 +1183,12 @@ public class ImageLoader {
|
|||||||
if (photoW == 0 || photoH == 0) {
|
if (photoW == 0 || photoH == 0) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
boolean scaleAnyway = false;
|
||||||
float scaleFactor = Math.max(photoW / maxWidth, photoH / maxHeight);
|
float scaleFactor = Math.max(photoW / maxWidth, photoH / maxHeight);
|
||||||
|
if (scaleFactor < 1 && minWidth != 0 && minHeight != 0) {
|
||||||
|
scaleFactor = Math.max(photoW / minWidth, photoH / minHeight);
|
||||||
|
scaleAnyway = true;
|
||||||
|
}
|
||||||
int w = (int)(photoW / scaleFactor);
|
int w = (int)(photoW / scaleFactor);
|
||||||
int h = (int)(photoH / scaleFactor);
|
int h = (int)(photoH / scaleFactor);
|
||||||
if (h == 0 || w == 0) {
|
if (h == 0 || w == 0) {
|
||||||
@ -1187,13 +1196,13 @@ public class ImageLoader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return scaleAndSaveImageInternal(bitmap, w, h, photoW, photoH, scaleFactor, quality, cache);
|
return scaleAndSaveImageInternal(bitmap, w, h, photoW, photoH, scaleFactor, quality, cache, scaleAnyway);
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
FileLog.e("tmessages", e);
|
FileLog.e("tmessages", e);
|
||||||
ImageLoader.getInstance().clearMemory();
|
ImageLoader.getInstance().clearMemory();
|
||||||
System.gc();
|
System.gc();
|
||||||
try {
|
try {
|
||||||
return scaleAndSaveImageInternal(bitmap, w, h, photoW, photoH, scaleFactor, quality, cache);
|
return scaleAndSaveImageInternal(bitmap, w, h, photoW, photoH, scaleFactor, quality, cache, scaleAnyway);
|
||||||
} catch (Throwable e2) {
|
} catch (Throwable e2) {
|
||||||
FileLog.e("tmessages", e2);
|
FileLog.e("tmessages", e2);
|
||||||
return null;
|
return null;
|
||||||
|
@ -1375,10 +1375,11 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
int lower_id = (int)dialog_id;
|
int lower_id = (int)dialog_id;
|
||||||
|
int high_id = (int)(dialog_id >> 32);
|
||||||
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 == 2 || load_type == 3)) {
|
if (high_id != 1 && 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() {
|
||||||
|
@ -272,20 +272,20 @@ public class TLRPC {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static class TL_contactStatus extends TLObject {
|
public static class TL_contactStatus extends TLObject {
|
||||||
public static int constructor = 0xaa77b873;
|
public static int constructor = 0xd3680c61;
|
||||||
|
|
||||||
public int user_id;
|
public int user_id;
|
||||||
public int expires;
|
public UserStatus status;
|
||||||
|
|
||||||
public void readParams(AbsSerializedData stream) {
|
public void readParams(AbsSerializedData stream) {
|
||||||
user_id = stream.readInt32();
|
user_id = stream.readInt32();
|
||||||
expires = stream.readInt32();
|
status = (UserStatus)TLClassStore.Instance().TLdeserialize(stream, stream.readInt32());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void serializeToStream(AbsSerializedData stream) {
|
public void serializeToStream(AbsSerializedData stream) {
|
||||||
stream.writeInt32(constructor);
|
stream.writeInt32(constructor);
|
||||||
stream.writeInt32(user_id);
|
stream.writeInt32(user_id);
|
||||||
stream.writeInt32(expires);
|
status.serializeToStream(stream);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -7389,6 +7389,18 @@ public class TLRPC {
|
|||||||
public static class TL_contacts_getStatuses extends TLObject {
|
public static class TL_contacts_getStatuses extends TLObject {
|
||||||
public static int constructor = 0xc4a353ee;
|
public static int constructor = 0xc4a353ee;
|
||||||
|
|
||||||
|
public ArrayList<TL_contactStatus> id = new ArrayList<TL_contactStatus>();
|
||||||
|
|
||||||
|
public Class responseClass () {
|
||||||
|
return Vector.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void parseVector(Vector vector, AbsSerializedData data) {
|
||||||
|
int size = data.readInt32();
|
||||||
|
for (int a = 0; a < size; a++) {
|
||||||
|
vector.objects.add(TLClassStore.Instance().TLdeserialize(data, data.readInt32()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void serializeToStream(AbsSerializedData stream) {
|
public void serializeToStream(AbsSerializedData stream) {
|
||||||
stream.writeInt32(constructor);
|
stream.writeInt32(constructor);
|
||||||
|
@ -114,7 +114,7 @@ public class Utilities {
|
|||||||
private native static void aesIgeEncryption(ByteBuffer buffer, byte[] key, byte[] iv, boolean encrypt, int offset, int length);
|
private native static void aesIgeEncryption(ByteBuffer buffer, byte[] key, byte[] iv, boolean encrypt, int offset, int length);
|
||||||
|
|
||||||
public static void aesIgeEncryption(ByteBuffer buffer, byte[] key, byte[] iv, boolean encrypt, boolean changeIv, int offset, int length) {
|
public static void aesIgeEncryption(ByteBuffer buffer, byte[] key, byte[] iv, boolean encrypt, boolean changeIv, int offset, int length) {
|
||||||
aesIgeEncryption(buffer, key, changeIv ? iv : iv.clone(), encrypt, offset, length);
|
aesIgeEncryption(buffer, key, changeIv ? iv : (byte [])iv.clone(), encrypt, offset, length);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Integer parseInt(String value) {
|
public static Integer parseInt(String value) {
|
||||||
@ -640,7 +640,7 @@ public class Utilities {
|
|||||||
builder.append(" ");
|
builder.append(" ");
|
||||||
}
|
}
|
||||||
query.trim();
|
query.trim();
|
||||||
builder.append(Html.fromHtml("<font color=\"#548ab6\">" + query + "</font>"));
|
builder.append(Html.fromHtml("<font color=\"#4d83b3\">" + query + "</font>"));
|
||||||
|
|
||||||
lastIndex = end;
|
lastIndex = end;
|
||||||
}
|
}
|
||||||
|
@ -633,6 +633,10 @@ public class ActionBarLayout extends FrameLayout {
|
|||||||
currentAnimation.start();
|
currentAnimation.start();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
if (backgroundView != null) {
|
||||||
|
ViewProxy.setAlpha(backgroundView, 1.0f);
|
||||||
|
backgroundView.setVisibility(VISIBLE);
|
||||||
|
}
|
||||||
fragment.onOpenAnimationEnd();
|
fragment.onOpenAnimationEnd();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@ -789,6 +793,10 @@ public class ActionBarLayout extends FrameLayout {
|
|||||||
if (removeActionBarExtraHeight) {
|
if (removeActionBarExtraHeight) {
|
||||||
previousFragment.actionBar.setOccupyStatusBar(false);
|
previousFragment.actionBar.setOccupyStatusBar(false);
|
||||||
}
|
}
|
||||||
|
ViewGroup parent = (ViewGroup) previousFragment.actionBar.getParent();
|
||||||
|
if (parent != null) {
|
||||||
|
parent.removeView(previousFragment.actionBar);
|
||||||
|
}
|
||||||
containerView.addView(previousFragment.actionBar);
|
containerView.addView(previousFragment.actionBar);
|
||||||
}
|
}
|
||||||
containerView.addView(fragmentView);
|
containerView.addView(fragmentView);
|
||||||
|
@ -264,7 +264,7 @@ public class ActionBarMenuItem extends ImageView {
|
|||||||
|
|
||||||
private int getBottomOffsetY() {
|
private int getBottomOffsetY() {
|
||||||
getLocationOnScreen(location);
|
getLocationOnScreen(location);
|
||||||
int diff = location[1] - (Build.VERSION.SDK_INT >= 21 ? AndroidUtilities.statusBarHeight : 0) + getMeasuredHeight() - menuHeight;
|
int diff = location[1] - AndroidUtilities.statusBarHeight + getMeasuredHeight() - menuHeight;
|
||||||
int y = AndroidUtilities.dp(8) - menuHeight;
|
int y = AndroidUtilities.dp(8) - menuHeight;
|
||||||
if (diff < 0) {
|
if (diff < 0) {
|
||||||
y -= diff;
|
y -= diff;
|
||||||
|
@ -218,7 +218,6 @@ public class DrawerLayoutContainer extends FrameLayout {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void onDrawerAnimationEnd(boolean opened) {
|
private void onDrawerAnimationEnd(boolean opened) {
|
||||||
AndroidUtilities.unlockOrientation((Activity) getContext());
|
|
||||||
startedTracking = false;
|
startedTracking = false;
|
||||||
currentAnimation = null;
|
currentAnimation = null;
|
||||||
drawerOpened = opened;
|
drawerOpened = opened;
|
||||||
@ -257,7 +256,6 @@ public class DrawerLayoutContainer extends FrameLayout {
|
|||||||
startedTrackingX = (int) ev.getX();
|
startedTrackingX = (int) ev.getX();
|
||||||
}
|
}
|
||||||
beginTrackingSent = false;
|
beginTrackingSent = false;
|
||||||
AndroidUtilities.lockOrientation((Activity)getContext());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isDrawerOpened() {
|
public boolean isDrawerOpened() {
|
||||||
|
@ -234,7 +234,7 @@ public class ContactsSearchAdapter extends BaseContactsSearchAdapter {
|
|||||||
}
|
}
|
||||||
} else if (i > searchResult.size() && user.username != null) {
|
} else if (i > searchResult.size() && user.username != null) {
|
||||||
try {
|
try {
|
||||||
username = Html.fromHtml(String.format("<font color=\"#548ab6\">@%s</font>%s", user.username.substring(0, lastFoundUsername.length()), user.username.substring(lastFoundUsername.length())));
|
username = Html.fromHtml(String.format("<font color=\"#4d83b3\">@%s</font>%s", user.username.substring(0, lastFoundUsername.length()), user.username.substring(lastFoundUsername.length())));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
username = user.username;
|
username = user.username;
|
||||||
FileLog.e("tmessages", e);
|
FileLog.e("tmessages", e);
|
||||||
|
@ -48,13 +48,15 @@ public class DialogsSearchAdapter extends BaseContactsSearchAdapter {
|
|||||||
private long reqId = 0;
|
private long reqId = 0;
|
||||||
private int lastReqId;
|
private int lastReqId;
|
||||||
private MessagesActivitySearchAdapterDelegate delegate;
|
private MessagesActivitySearchAdapterDelegate delegate;
|
||||||
|
private boolean needMessagesSearch;
|
||||||
|
|
||||||
public static interface MessagesActivitySearchAdapterDelegate {
|
public static interface MessagesActivitySearchAdapterDelegate {
|
||||||
public abstract void searchStateChanged(boolean searching);
|
public abstract void searchStateChanged(boolean searching);
|
||||||
}
|
}
|
||||||
|
|
||||||
public DialogsSearchAdapter(Context context) {
|
public DialogsSearchAdapter(Context context, boolean messagesSearch) {
|
||||||
mContext = context;
|
mContext = context;
|
||||||
|
needMessagesSearch = messagesSearch;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDelegate(MessagesActivitySearchAdapterDelegate delegate) {
|
public void setDelegate(MessagesActivitySearchAdapterDelegate delegate) {
|
||||||
@ -62,6 +64,9 @@ public class DialogsSearchAdapter extends BaseContactsSearchAdapter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void searchMessagesInternal(final String query) {
|
private void searchMessagesInternal(final String query) {
|
||||||
|
if (!needMessagesSearch) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (reqId != 0) {
|
if (reqId != 0) {
|
||||||
ConnectionsManager.getInstance().cancelRpc(reqId, true);
|
ConnectionsManager.getInstance().cancelRpc(reqId, true);
|
||||||
reqId = 0;
|
reqId = 0;
|
||||||
@ -412,7 +417,7 @@ public class DialogsSearchAdapter extends BaseContactsSearchAdapter {
|
|||||||
}
|
}
|
||||||
} else if (i > searchResult.size() && user != null && user.username != null) {
|
} else if (i > searchResult.size() && user != null && user.username != null) {
|
||||||
try {
|
try {
|
||||||
username = Html.fromHtml(String.format("<font color=\"#548ab6\">@%s</font>%s", user.username.substring(0, lastFoundUsername.length()), user.username.substring(lastFoundUsername.length())));
|
username = Html.fromHtml(String.format("<font color=\"#4d83b3\">@%s</font>%s", user.username.substring(0, lastFoundUsername.length()), user.username.substring(lastFoundUsername.length())));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
username = user.username;
|
username = user.username;
|
||||||
FileLog.e("tmessages", e);
|
FileLog.e("tmessages", e);
|
||||||
|
@ -121,4 +121,9 @@ public class ObjectAnimatorProxy {
|
|||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
return objectAnimator == o;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -120,7 +120,7 @@ public class DialogCell extends BaseCell {
|
|||||||
|
|
||||||
nameUnknownPaint = new TextPaint(TextPaint.ANTI_ALIAS_FLAG);
|
nameUnknownPaint = new TextPaint(TextPaint.ANTI_ALIAS_FLAG);
|
||||||
nameUnknownPaint.setTextSize(AndroidUtilities.dp(17));
|
nameUnknownPaint.setTextSize(AndroidUtilities.dp(17));
|
||||||
nameUnknownPaint.setColor(0xff548ab6);
|
nameUnknownPaint.setColor(0xff4d83b3);
|
||||||
nameUnknownPaint.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
|
nameUnknownPaint.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
|
||||||
|
|
||||||
messagePaint = new TextPaint(TextPaint.ANTI_ALIAS_FLAG);
|
messagePaint = new TextPaint(TextPaint.ANTI_ALIAS_FLAG);
|
||||||
@ -132,7 +132,7 @@ public class DialogCell extends BaseCell {
|
|||||||
|
|
||||||
messagePrintingPaint = new TextPaint(TextPaint.ANTI_ALIAS_FLAG);
|
messagePrintingPaint = new TextPaint(TextPaint.ANTI_ALIAS_FLAG);
|
||||||
messagePrintingPaint.setTextSize(AndroidUtilities.dp(16));
|
messagePrintingPaint.setTextSize(AndroidUtilities.dp(16));
|
||||||
messagePrintingPaint.setColor(0xff548ab6);
|
messagePrintingPaint.setColor(0xff4d83b3);
|
||||||
|
|
||||||
timePaint = new TextPaint(TextPaint.ANTI_ALIAS_FLAG);
|
timePaint = new TextPaint(TextPaint.ANTI_ALIAS_FLAG);
|
||||||
timePaint.setTextSize(AndroidUtilities.dp(13));
|
timePaint.setTextSize(AndroidUtilities.dp(13));
|
||||||
@ -325,10 +325,10 @@ public class DialogCell extends BaseCell {
|
|||||||
checkMessage = false;
|
checkMessage = false;
|
||||||
if (message.messageOwner.media != null && !(message.messageOwner.media instanceof TLRPC.TL_messageMediaEmpty)) {
|
if (message.messageOwner.media != null && !(message.messageOwner.media instanceof TLRPC.TL_messageMediaEmpty)) {
|
||||||
currentMessagePaint = messagePrintingPaint;
|
currentMessagePaint = messagePrintingPaint;
|
||||||
messageString = Emoji.replaceEmoji(Html.fromHtml(String.format("<font color=#548ab6>%s:</font> <font color=#548ab6>%s</font>", name, message.messageText)), messagePaint.getFontMetricsInt(), AndroidUtilities.dp(20));
|
messageString = Emoji.replaceEmoji(Html.fromHtml(String.format("<font color=#4d83b3>%s:</font> <font color=#4d83b3>%s</font>", name, message.messageText)), messagePaint.getFontMetricsInt(), AndroidUtilities.dp(20));
|
||||||
} else {
|
} else {
|
||||||
if (message.messageOwner.message != null) {
|
if (message.messageOwner.message != null) {
|
||||||
messageString = Emoji.replaceEmoji(Html.fromHtml(String.format("<font color=#548ab6>%s:</font> <font color=#808080>%s</font>", name, message.messageOwner.message.replace("\n", " ").replace("<", "<").replace(">", ">"))), messagePaint.getFontMetricsInt(), AndroidUtilities.dp(20));
|
messageString = Emoji.replaceEmoji(Html.fromHtml(String.format("<font color=#4d83b3>%s:</font> <font color=#808080>%s</font>", name, message.messageOwner.message.replace("\n", " ").replace("<", "<").replace(">", ">"))), messagePaint.getFontMetricsInt(), AndroidUtilities.dp(20));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -28,6 +28,7 @@ public class EmptyCell extends FrameLayout {
|
|||||||
|
|
||||||
public void setHeight(int height) {
|
public void setHeight(int height) {
|
||||||
cellHeight = height;
|
cellHeight = height;
|
||||||
|
requestLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -58,8 +58,8 @@ public class TextCell extends FrameLayout {
|
|||||||
layoutParams = (LayoutParams) valueTextView.getLayoutParams();
|
layoutParams = (LayoutParams) valueTextView.getLayoutParams();
|
||||||
layoutParams.width = LayoutParams.WRAP_CONTENT;
|
layoutParams.width = LayoutParams.WRAP_CONTENT;
|
||||||
layoutParams.height = LayoutParams.MATCH_PARENT;
|
layoutParams.height = LayoutParams.MATCH_PARENT;
|
||||||
layoutParams.leftMargin = AndroidUtilities.dp(LocaleController.isRTL ? 16 : 0);
|
layoutParams.leftMargin = AndroidUtilities.dp(LocaleController.isRTL ? 24 : 0);
|
||||||
layoutParams.rightMargin = AndroidUtilities.dp(LocaleController.isRTL ? 0 : 16);
|
layoutParams.rightMargin = AndroidUtilities.dp(LocaleController.isRTL ? 0 : 24);
|
||||||
layoutParams.gravity = LocaleController.isRTL ? Gravity.LEFT : Gravity.RIGHT;
|
layoutParams.gravity = LocaleController.isRTL ? Gravity.LEFT : Gravity.RIGHT;
|
||||||
valueTextView.setLayoutParams(layoutParams);
|
valueTextView.setLayoutParams(layoutParams);
|
||||||
|
|
||||||
@ -80,8 +80,8 @@ public class TextCell extends FrameLayout {
|
|||||||
layoutParams = (LayoutParams) valueImageView.getLayoutParams();
|
layoutParams = (LayoutParams) valueImageView.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(LocaleController.isRTL ? 16 : 0);
|
layoutParams.leftMargin = AndroidUtilities.dp(LocaleController.isRTL ? 24 : 0);
|
||||||
layoutParams.rightMargin = AndroidUtilities.dp(LocaleController.isRTL ? 0 : 16);
|
layoutParams.rightMargin = AndroidUtilities.dp(LocaleController.isRTL ? 0 : 24);
|
||||||
layoutParams.gravity = (LocaleController.isRTL ? Gravity.LEFT : Gravity.RIGHT) | Gravity.CENTER_VERTICAL;
|
layoutParams.gravity = (LocaleController.isRTL ? Gravity.LEFT : Gravity.RIGHT) | Gravity.CENTER_VERTICAL;
|
||||||
valueImageView.setLayoutParams(layoutParams);
|
valueImageView.setLayoutParams(layoutParams);
|
||||||
}
|
}
|
||||||
|
@ -453,7 +453,6 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
|||||||
lastStatus = null;
|
lastStatus = null;
|
||||||
|
|
||||||
actionBar.setBackButtonImage(R.drawable.ic_ab_back);
|
actionBar.setBackButtonImage(R.drawable.ic_ab_back);
|
||||||
actionBar.setBackOverlay(R.layout.updating_state_layout);
|
|
||||||
actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {
|
actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {
|
||||||
@Override
|
@Override
|
||||||
public void onItemClick(final int id) {
|
public void onItemClick(final int id) {
|
||||||
@ -699,16 +698,6 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
|||||||
}
|
}
|
||||||
presentFragment(new ProfileActivity(args));
|
presentFragment(new ProfileActivity(args));
|
||||||
} else if (currentChat != null) {
|
} else if (currentChat != null) {
|
||||||
if (info != null && info instanceof TLRPC.TL_chatParticipantsForbidden) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
int count = currentChat.participants_count;
|
|
||||||
if (info != null) {
|
|
||||||
count = info.participants.size();
|
|
||||||
}
|
|
||||||
if (count == 0 || currentChat.left || currentChat instanceof TLRPC.TL_chatForbidden) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Bundle args = new Bundle();
|
Bundle args = new Bundle();
|
||||||
args.putInt("chat_id", currentChat.id);
|
args.putInt("chat_id", currentChat.id);
|
||||||
ProfileActivity fragment = new ProfileActivity(args);
|
ProfileActivity fragment = new ProfileActivity(args);
|
||||||
@ -718,6 +707,16 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (currentChat != null) {
|
||||||
|
int count = currentChat.participants_count;
|
||||||
|
if (info != null) {
|
||||||
|
count = info.participants.size();
|
||||||
|
}
|
||||||
|
if (count == 0 || currentChat.left || currentChat instanceof TLRPC.TL_chatForbidden || info != null && info instanceof TLRPC.TL_chatParticipantsForbidden) {
|
||||||
|
avatarContainer.setEnabled(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
avatarImageView = new BackupImageView(getParentActivity());
|
avatarImageView = new BackupImageView(getParentActivity());
|
||||||
avatarImageView.imageReceiver.setRoundRadius(AndroidUtilities.dp(21));
|
avatarImageView.imageReceiver.setRoundRadius(AndroidUtilities.dp(21));
|
||||||
avatarImageView.processDetach = false;
|
avatarImageView.processDetach = false;
|
||||||
@ -768,10 +767,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
|||||||
updateSubtitle();
|
updateSubtitle();
|
||||||
|
|
||||||
if (currentEncryptedChat != null) {
|
if (currentEncryptedChat != null) {
|
||||||
nameTextView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_lock_white, 0, 0, 0);
|
nameTextView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_lock_header, 0, 0, 0);
|
||||||
nameTextView.setCompoundDrawablePadding(AndroidUtilities.dp(4));
|
|
||||||
} else if (currentChat != null && currentChat.id < 0) {
|
|
||||||
nameTextView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.broadcast2, 0, 0, 0);
|
|
||||||
nameTextView.setCompoundDrawablePadding(AndroidUtilities.dp(4));
|
nameTextView.setCompoundDrawablePadding(AndroidUtilities.dp(4));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2471,6 +2467,10 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
|||||||
getParentActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
|
getParentActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (chatAdapter != null) {
|
||||||
|
chatAdapter.notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
|
||||||
checkActionBarMenu();
|
checkActionBarMenu();
|
||||||
|
|
||||||
NotificationsController.getInstance().setOpennedDialogId(dialog_id);
|
NotificationsController.getInstance().setOpennedDialogId(dialog_id);
|
||||||
@ -2543,7 +2543,6 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
|||||||
@Override
|
@Override
|
||||||
public void onPause() {
|
public void onPause() {
|
||||||
super.onPause();
|
super.onPause();
|
||||||
actionBar.hideActionMode();
|
|
||||||
chatActivityEnterView.hideEmojiPopup();
|
chatActivityEnterView.hideEmojiPopup();
|
||||||
paused = true;
|
paused = true;
|
||||||
NotificationsController.getInstance().setOpennedDialogId(0);
|
NotificationsController.getInstance().setOpennedDialogId(0);
|
||||||
@ -2660,6 +2659,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
|||||||
forwaringMessage = null;
|
forwaringMessage = null;
|
||||||
selectedMessagesCanCopyIds.clear();
|
selectedMessagesCanCopyIds.clear();
|
||||||
selectedMessagesIds.clear();
|
selectedMessagesIds.clear();
|
||||||
|
actionBar.hideActionMode();
|
||||||
|
|
||||||
if (single || type < 2 || type == 6) {
|
if (single || type < 2 || type == 6) {
|
||||||
if (type >= 0) {
|
if (type >= 0) {
|
||||||
@ -2928,6 +2928,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
|||||||
}
|
}
|
||||||
selectedMessagesCanCopyIds.clear();
|
selectedMessagesCanCopyIds.clear();
|
||||||
selectedMessagesIds.clear();
|
selectedMessagesIds.clear();
|
||||||
|
actionBar.hideActionMode();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,6 +51,8 @@ import java.util.ArrayList;
|
|||||||
import java.util.concurrent.Semaphore;
|
import java.util.concurrent.Semaphore;
|
||||||
|
|
||||||
public class GroupCreateFinalActivity extends BaseFragment implements NotificationCenter.NotificationCenterDelegate, AvatarUpdater.AvatarUpdaterDelegate {
|
public class GroupCreateFinalActivity extends BaseFragment implements NotificationCenter.NotificationCenterDelegate, AvatarUpdater.AvatarUpdaterDelegate {
|
||||||
|
|
||||||
|
private ListAdapter listAdapter;
|
||||||
private ListView listView;
|
private ListView listView;
|
||||||
private EditText nameTextView;
|
private EditText nameTextView;
|
||||||
private TLRPC.FileLocation avatar;
|
private TLRPC.FileLocation avatar;
|
||||||
@ -126,6 +128,14 @@ public class GroupCreateFinalActivity extends BaseFragment implements Notificati
|
|||||||
avatarUpdater.clear();
|
avatarUpdater.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
if (listAdapter != null) {
|
||||||
|
listAdapter.notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View createView(LayoutInflater inflater, ViewGroup container) {
|
public View createView(LayoutInflater inflater, ViewGroup container) {
|
||||||
if (fragmentView == null) {
|
if (fragmentView == null) {
|
||||||
@ -297,7 +307,7 @@ public class GroupCreateFinalActivity extends BaseFragment implements Notificati
|
|||||||
listView.setDivider(null);
|
listView.setDivider(null);
|
||||||
listView.setDividerHeight(0);
|
listView.setDividerHeight(0);
|
||||||
listView.setVerticalScrollBarEnabled(false);
|
listView.setVerticalScrollBarEnabled(false);
|
||||||
listView.setAdapter(new ListAdapter(getParentActivity()));
|
listView.setAdapter(listAdapter = new ListAdapter(getParentActivity()));
|
||||||
linearLayout.addView(listView);
|
linearLayout.addView(listView);
|
||||||
layoutParams = (LinearLayout.LayoutParams) listView.getLayoutParams();
|
layoutParams = (LinearLayout.LayoutParams) listView.getLayoutParams();
|
||||||
layoutParams.width = LinearLayout.LayoutParams.MATCH_PARENT;
|
layoutParams.width = LinearLayout.LayoutParams.MATCH_PARENT;
|
||||||
|
@ -49,7 +49,6 @@ public class IdenticonActivity extends BaseFragment {
|
|||||||
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.setTitle(LocaleController.getString("EncryptionKey", R.string.EncryptionKey));
|
actionBar.setTitle(LocaleController.getString("EncryptionKey", R.string.EncryptionKey));
|
||||||
actionBar.setTitleIcon(R.drawable.ic_lock_white, AndroidUtilities.dp(4));
|
|
||||||
|
|
||||||
actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {
|
actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -8,8 +8,12 @@
|
|||||||
|
|
||||||
package org.telegram.ui;
|
package org.telegram.ui;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
|
import android.app.ProgressDialog;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.DialogInterface;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.text.Spannable;
|
import android.text.Spannable;
|
||||||
import android.text.method.LinkMovementMethod;
|
import android.text.method.LinkMovementMethod;
|
||||||
@ -105,59 +109,30 @@ public class LastSeenActivity extends BaseFragment implements NotificationCenter
|
|||||||
if (id == -1) {
|
if (id == -1) {
|
||||||
finishFragment();
|
finishFragment();
|
||||||
} else if (id == done_button) {
|
} else if (id == done_button) {
|
||||||
TLRPC.TL_account_setPrivacy req = new TLRPC.TL_account_setPrivacy();
|
if (getParentActivity() == null) {
|
||||||
req.key = new TLRPC.TL_inputPrivacyKeyStatusTimestamp();
|
return;
|
||||||
if (currentType != 0 && currentPlus.size() > 0) {
|
|
||||||
TLRPC.TL_inputPrivacyValueAllowUsers rule = new TLRPC.TL_inputPrivacyValueAllowUsers();
|
|
||||||
for (Integer uid : currentPlus) {
|
|
||||||
TLRPC.User user = MessagesController.getInstance().getUser(uid);
|
|
||||||
if (user != null) {
|
|
||||||
TLRPC.InputUser inputUser = MessagesController.getInputUser(user);
|
|
||||||
if (inputUser != null) {
|
|
||||||
rule.users.add(inputUser);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
req.rules.add(rule);
|
|
||||||
}
|
}
|
||||||
if (currentType != 1 && currentMinus.size() > 0) {
|
|
||||||
TLRPC.TL_inputPrivacyValueDisallowUsers rule = new TLRPC.TL_inputPrivacyValueDisallowUsers();
|
if (currentType != 0) {
|
||||||
for (Integer uid : currentMinus) {
|
final SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", Activity.MODE_PRIVATE);
|
||||||
TLRPC.User user = MessagesController.getInstance().getUser(uid);
|
boolean showed = preferences.getBoolean("privacyAlertShowed", false);
|
||||||
if (user != null) {
|
if (!showed) {
|
||||||
TLRPC.InputUser inputUser = MessagesController.getInputUser(user);
|
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
|
||||||
if (inputUser != null) {
|
builder.setMessage(LocaleController.getString("CustomHelp", R.string.CustomHelp));
|
||||||
rule.users.add(inputUser);
|
builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
|
||||||
}
|
builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), new DialogInterface.OnClickListener() {
|
||||||
}
|
|
||||||
}
|
|
||||||
req.rules.add(rule);
|
|
||||||
}
|
|
||||||
if (currentType == 0) {
|
|
||||||
req.rules.add(new TLRPC.TL_inputPrivacyValueAllowAll());
|
|
||||||
} else if (currentType == 1) {
|
|
||||||
req.rules.add(new TLRPC.TL_inputPrivacyValueDisallowAll());
|
|
||||||
} else if (currentType == 2) {
|
|
||||||
req.rules.add(new TLRPC.TL_inputPrivacyValueAllowContacts());
|
|
||||||
}
|
|
||||||
ConnectionsManager.getInstance().performRpc(req, new RPCRequest.RPCRequestDelegate() {
|
|
||||||
@Override
|
|
||||||
public void run(final TLObject response, final TLRPC.TL_error error) {
|
|
||||||
AndroidUtilities.runOnUIThread(new Runnable() {
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void onClick(DialogInterface dialogInterface, int i) {
|
||||||
if (error == null) {
|
applyCurrentPrivacySettings();
|
||||||
finishFragment();
|
preferences.edit().putBoolean("privacyAlertShowed", true).commit();
|
||||||
TLRPC.TL_account_privacyRules rules = (TLRPC.TL_account_privacyRules) response;
|
|
||||||
MessagesController.getInstance().putUsers(rules.users, false);
|
|
||||||
ContactsController.getInstance().setPrivacyRules(rules.rules);
|
|
||||||
} else {
|
|
||||||
showErrorAlert();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
|
||||||
|
showAlertDialog(builder);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}, true, RPCRequest.RPCRequestClassGeneric | RPCRequest.RPCRequestClassFailOnServerErrors);
|
}
|
||||||
|
applyCurrentPrivacySettings();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -271,6 +246,73 @@ public class LastSeenActivity extends BaseFragment implements NotificationCenter
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void applyCurrentPrivacySettings() {
|
||||||
|
TLRPC.TL_account_setPrivacy req = new TLRPC.TL_account_setPrivacy();
|
||||||
|
req.key = new TLRPC.TL_inputPrivacyKeyStatusTimestamp();
|
||||||
|
if (currentType != 0 && currentPlus.size() > 0) {
|
||||||
|
TLRPC.TL_inputPrivacyValueAllowUsers rule = new TLRPC.TL_inputPrivacyValueAllowUsers();
|
||||||
|
for (Integer uid : currentPlus) {
|
||||||
|
TLRPC.User user = MessagesController.getInstance().getUser(uid);
|
||||||
|
if (user != null) {
|
||||||
|
TLRPC.InputUser inputUser = MessagesController.getInputUser(user);
|
||||||
|
if (inputUser != null) {
|
||||||
|
rule.users.add(inputUser);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
req.rules.add(rule);
|
||||||
|
}
|
||||||
|
if (currentType != 1 && currentMinus.size() > 0) {
|
||||||
|
TLRPC.TL_inputPrivacyValueDisallowUsers rule = new TLRPC.TL_inputPrivacyValueDisallowUsers();
|
||||||
|
for (Integer uid : currentMinus) {
|
||||||
|
TLRPC.User user = MessagesController.getInstance().getUser(uid);
|
||||||
|
if (user != null) {
|
||||||
|
TLRPC.InputUser inputUser = MessagesController.getInputUser(user);
|
||||||
|
if (inputUser != null) {
|
||||||
|
rule.users.add(inputUser);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
req.rules.add(rule);
|
||||||
|
}
|
||||||
|
if (currentType == 0) {
|
||||||
|
req.rules.add(new TLRPC.TL_inputPrivacyValueAllowAll());
|
||||||
|
} else if (currentType == 1) {
|
||||||
|
req.rules.add(new TLRPC.TL_inputPrivacyValueDisallowAll());
|
||||||
|
} else if (currentType == 2) {
|
||||||
|
req.rules.add(new TLRPC.TL_inputPrivacyValueAllowContacts());
|
||||||
|
}
|
||||||
|
final ProgressDialog progressDialog = new ProgressDialog(getParentActivity());
|
||||||
|
progressDialog.setMessage(LocaleController.getString("Loading", R.string.Loading));
|
||||||
|
progressDialog.setCanceledOnTouchOutside(false);
|
||||||
|
progressDialog.setCancelable(false);
|
||||||
|
progressDialog.show();
|
||||||
|
|
||||||
|
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() {
|
||||||
|
try {
|
||||||
|
progressDialog.dismiss();
|
||||||
|
} catch (Exception e) {
|
||||||
|
FileLog.e("tmessages", e);
|
||||||
|
}
|
||||||
|
if (error == null) {
|
||||||
|
finishFragment();
|
||||||
|
TLRPC.TL_account_privacyRules rules = (TLRPC.TL_account_privacyRules) response;
|
||||||
|
MessagesController.getInstance().putUsers(rules.users, false);
|
||||||
|
ContactsController.getInstance().setPrivacyRules(rules.rules);
|
||||||
|
} else {
|
||||||
|
showErrorAlert();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}, true, RPCRequest.RPCRequestClassGeneric | RPCRequest.RPCRequestClassFailOnServerErrors);
|
||||||
|
}
|
||||||
|
|
||||||
private void showErrorAlert() {
|
private void showErrorAlert() {
|
||||||
if (getParentActivity() == null) {
|
if (getParentActivity() == null) {
|
||||||
return;
|
return;
|
||||||
|
@ -735,6 +735,7 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
actionBarLayout.presentFragment(fragment, true);
|
actionBarLayout.presentFragment(fragment, true);
|
||||||
|
|
||||||
if (sendingText != null) {
|
if (sendingText != null) {
|
||||||
fragment.processSendingText(sendingText);
|
fragment.processSendingText(sendingText);
|
||||||
}
|
}
|
||||||
@ -1156,10 +1157,8 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa
|
|||||||
}
|
}
|
||||||
layersActionBarLayout.closeLastFragment(!forceWithoutAnimation);
|
layersActionBarLayout.closeLastFragment(!forceWithoutAnimation);
|
||||||
}
|
}
|
||||||
if (actionBarLayout.fragmentsStack.size() > 1) {
|
actionBarLayout.presentFragment(fragment, actionBarLayout.fragmentsStack.size() > 1, forceWithoutAnimation, false);
|
||||||
actionBarLayout.presentFragment(fragment, actionBarLayout.fragmentsStack.size() > 1, forceWithoutAnimation, false);
|
return false;
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else if (layout != layersActionBarLayout) {
|
} else if (layout != layersActionBarLayout) {
|
||||||
layersActionBarLayout.setVisibility(View.VISIBLE);
|
layersActionBarLayout.setVisibility(View.VISIBLE);
|
||||||
|
@ -994,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_CLASS_NUMBER);
|
codeField.setInputType(InputType.TYPE_CLASS_PHONE);
|
||||||
codeField.setMaxLines(1);
|
codeField.setMaxLines(1);
|
||||||
codeField.setPadding(0, 0, 0, 0);
|
codeField.setPadding(0, 0, 0, 0);
|
||||||
addView(codeField);
|
addView(codeField);
|
||||||
@ -1037,7 +1037,7 @@ public class LoginActivity extends BaseFragment {
|
|||||||
problemText.setVisibility(time < 1000 ? VISIBLE : GONE);
|
problemText.setVisibility(time < 1000 ? VISIBLE : GONE);
|
||||||
problemText.setGravity(Gravity.LEFT);
|
problemText.setGravity(Gravity.LEFT);
|
||||||
problemText.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
|
problemText.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
|
||||||
problemText.setTextColor(0xff548ab6);
|
problemText.setTextColor(0xff4d83b3);
|
||||||
problemText.setLineSpacing(AndroidUtilities.dp(2), 1.0f);
|
problemText.setLineSpacing(AndroidUtilities.dp(2), 1.0f);
|
||||||
problemText.setPadding(0, AndroidUtilities.dp(2), 0, AndroidUtilities.dp(12));
|
problemText.setPadding(0, AndroidUtilities.dp(2), 0, AndroidUtilities.dp(12));
|
||||||
addView(problemText);
|
addView(problemText);
|
||||||
@ -1078,7 +1078,7 @@ public class LoginActivity extends BaseFragment {
|
|||||||
|
|
||||||
TextView wrongNumber = new TextView(context);
|
TextView wrongNumber = new TextView(context);
|
||||||
wrongNumber.setGravity(Gravity.LEFT | Gravity.CENTER_HORIZONTAL);
|
wrongNumber.setGravity(Gravity.LEFT | Gravity.CENTER_HORIZONTAL);
|
||||||
wrongNumber.setTextColor(0xff548ab6);
|
wrongNumber.setTextColor(0xff4d83b3);
|
||||||
wrongNumber.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
|
wrongNumber.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
|
||||||
wrongNumber.setLineSpacing(AndroidUtilities.dp(2), 1.0f);
|
wrongNumber.setLineSpacing(AndroidUtilities.dp(2), 1.0f);
|
||||||
wrongNumber.setPadding(0, AndroidUtilities.dp(24), 0, 0);
|
wrongNumber.setPadding(0, AndroidUtilities.dp(24), 0, 0);
|
||||||
@ -1487,7 +1487,7 @@ public class LoginActivity extends BaseFragment {
|
|||||||
TextView wrongNumber = new TextView(context);
|
TextView wrongNumber = new TextView(context);
|
||||||
wrongNumber.setText(LocaleController.getString("CancelRegistration", R.string.CancelRegistration));
|
wrongNumber.setText(LocaleController.getString("CancelRegistration", R.string.CancelRegistration));
|
||||||
wrongNumber.setGravity(Gravity.LEFT | Gravity.CENTER_HORIZONTAL);
|
wrongNumber.setGravity(Gravity.LEFT | Gravity.CENTER_HORIZONTAL);
|
||||||
wrongNumber.setTextColor(0xff548ab6);
|
wrongNumber.setTextColor(0xff4d83b3);
|
||||||
wrongNumber.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
|
wrongNumber.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
|
||||||
wrongNumber.setLineSpacing(AndroidUtilities.dp(2), 1.0f);
|
wrongNumber.setLineSpacing(AndroidUtilities.dp(2), 1.0f);
|
||||||
wrongNumber.setPadding(0, AndroidUtilities.dp(24), 0, 0);
|
wrongNumber.setPadding(0, AndroidUtilities.dp(24), 0, 0);
|
||||||
|
@ -223,7 +223,7 @@ public class MessagesActivity extends BaseFragment implements NotificationCenter
|
|||||||
fragmentView = inflater.inflate(R.layout.messages_list, container, false);
|
fragmentView = inflater.inflate(R.layout.messages_list, container, false);
|
||||||
|
|
||||||
dialogsAdapter = new DialogsAdapter(getParentActivity(), serverOnly);
|
dialogsAdapter = new DialogsAdapter(getParentActivity(), serverOnly);
|
||||||
dialogsSearchAdapter = new DialogsSearchAdapter(getParentActivity());
|
dialogsSearchAdapter = new DialogsSearchAdapter(getParentActivity(), !onlySelect);
|
||||||
dialogsSearchAdapter.setDelegate(new DialogsSearchAdapter.MessagesActivitySearchAdapterDelegate() {
|
dialogsSearchAdapter.setDelegate(new DialogsSearchAdapter.MessagesActivitySearchAdapterDelegate() {
|
||||||
@Override
|
@Override
|
||||||
public void searchStateChanged(boolean search) {
|
public void searchStateChanged(boolean search) {
|
||||||
|
@ -10,6 +10,7 @@ package org.telegram.ui;
|
|||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
import android.app.AlertDialog;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
@ -628,6 +629,12 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
|||||||
|
|
||||||
if (f != null && f.exists()) {
|
if (f != null && f.exists()) {
|
||||||
MediaController.saveFile(f.toString(), parentActivity, currentFileNames[0].endsWith("mp4") ? 1 : 0, null);
|
MediaController.saveFile(f.toString(), parentActivity, currentFileNames[0].endsWith("mp4") ? 1 : 0, null);
|
||||||
|
} else {
|
||||||
|
AlertDialog.Builder builder = new AlertDialog.Builder(parentActivity);
|
||||||
|
builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
|
||||||
|
builder.setPositiveButton(R.string.OK, null);
|
||||||
|
builder.setMessage(LocaleController.getString("PleaseDownload", R.string.PleaseDownload));
|
||||||
|
builder.show().setCanceledOnTouchOutside(true);
|
||||||
}
|
}
|
||||||
} else if (id == gallery_menu_showall) {
|
} else if (id == gallery_menu_showall) {
|
||||||
if (opennedFromMedia) {
|
if (opennedFromMedia) {
|
||||||
@ -745,6 +752,12 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
|||||||
}
|
}
|
||||||
intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(f));
|
intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(f));
|
||||||
parentActivity.startActivity(intent);
|
parentActivity.startActivity(intent);
|
||||||
|
} else {
|
||||||
|
AlertDialog.Builder builder = new AlertDialog.Builder(parentActivity);
|
||||||
|
builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
|
||||||
|
builder.setPositiveButton(R.string.OK, null);
|
||||||
|
builder.setMessage(LocaleController.getString("PleaseDownload", R.string.PleaseDownload));
|
||||||
|
builder.show().setCanceledOnTouchOutside(true);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
FileLog.e("tmessages", e);
|
FileLog.e("tmessages", e);
|
||||||
|
@ -172,7 +172,6 @@ public class PrivacySettingsActivity extends BaseFragment implements Notificatio
|
|||||||
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
|
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
|
||||||
builder.setTitle(LocaleController.getString("DeleteAccountTitle", R.string.DeleteAccountTitle));
|
builder.setTitle(LocaleController.getString("DeleteAccountTitle", R.string.DeleteAccountTitle));
|
||||||
builder.setItems(new CharSequence[] {
|
builder.setItems(new CharSequence[] {
|
||||||
LocaleController.getString("DeleteAccountNever", R.string.DeleteAccountNever),
|
|
||||||
LocaleController.formatPluralString("Months", 1),
|
LocaleController.formatPluralString("Months", 1),
|
||||||
LocaleController.formatPluralString("Months", 3),
|
LocaleController.formatPluralString("Months", 3),
|
||||||
LocaleController.formatPluralString("Months", 6),
|
LocaleController.formatPluralString("Months", 6),
|
||||||
@ -181,13 +180,13 @@ public class PrivacySettingsActivity extends BaseFragment implements Notificatio
|
|||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
int value = 0;
|
int value = 0;
|
||||||
if (which == 1) {
|
if (which == 0) {
|
||||||
value = 30;
|
value = 30;
|
||||||
} else if (which == 2) {
|
} else if (which == 1) {
|
||||||
value = 60;
|
value = 60;
|
||||||
} else if (which == 3) {
|
} else if (which == 2) {
|
||||||
value = 182;
|
value = 182;
|
||||||
} else if (which == 4) {
|
} else if (which == 3) {
|
||||||
value = 365;
|
value = 365;
|
||||||
}
|
}
|
||||||
final ProgressDialog progressDialog = new ProgressDialog(getParentActivity());
|
final ProgressDialog progressDialog = new ProgressDialog(getParentActivity());
|
||||||
@ -366,9 +365,7 @@ public class PrivacySettingsActivity extends BaseFragment implements Notificatio
|
|||||||
value = LocaleController.getString("Loading", R.string.Loading);
|
value = LocaleController.getString("Loading", R.string.Loading);
|
||||||
} else {
|
} else {
|
||||||
int ttl = ContactsController.getInstance().getDeleteAccountTTL();
|
int ttl = ContactsController.getInstance().getDeleteAccountTTL();
|
||||||
if (ttl == 0) {
|
if (ttl <= 182) {
|
||||||
value = LocaleController.getString("DeleteAccountNever", R.string.DeleteAccountNever);
|
|
||||||
} else if (ttl <= 182) {
|
|
||||||
value = LocaleController.formatPluralString("Months", ttl / 30);
|
value = LocaleController.formatPluralString("Months", ttl / 30);
|
||||||
} else if (ttl == 365) {
|
} else if (ttl == 365) {
|
||||||
value = LocaleController.formatPluralString("Years", ttl / 365);
|
value = LocaleController.formatPluralString("Years", ttl / 365);
|
||||||
|
@ -222,7 +222,6 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
|
|||||||
actionBar.setBackgroundColor(AvatarDrawable.getProfileBackColorForId(user_id != 0 ? user_id : chat_id));
|
actionBar.setBackgroundColor(AvatarDrawable.getProfileBackColorForId(user_id != 0 ? user_id : chat_id));
|
||||||
actionBar.setItemsBackground(AvatarDrawable.getButtonColorForId(user_id != 0 ? user_id : chat_id));
|
actionBar.setItemsBackground(AvatarDrawable.getButtonColorForId(user_id != 0 ? user_id : chat_id));
|
||||||
actionBar.setBackButtonImage(R.drawable.ic_ab_back);
|
actionBar.setBackButtonImage(R.drawable.ic_ab_back);
|
||||||
actionBar.setBackOverlay(R.layout.updating_state_layout);
|
|
||||||
actionBar.setExtraHeight(AndroidUtilities.dp(88), false);
|
actionBar.setExtraHeight(AndroidUtilities.dp(88), false);
|
||||||
if (AndroidUtilities.isTablet()) {
|
if (AndroidUtilities.isTablet()) {
|
||||||
actionBar.setOccupyStatusBar(false);
|
actionBar.setOccupyStatusBar(false);
|
||||||
@ -409,8 +408,6 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
|
|||||||
onlineTextView.setLayoutParams(layoutParams);
|
onlineTextView.setLayoutParams(layoutParams);
|
||||||
|
|
||||||
listView = new ListView(getParentActivity());
|
listView = new ListView(getParentActivity());
|
||||||
listView.setDrawingCacheEnabled(false);
|
|
||||||
listView.setDrawingCacheBackgroundColor(0);
|
|
||||||
listView.setDivider(null);
|
listView.setDivider(null);
|
||||||
listView.setDividerHeight(0);
|
listView.setDividerHeight(0);
|
||||||
listView.setVerticalScrollBarEnabled(false);
|
listView.setVerticalScrollBarEnabled(false);
|
||||||
@ -554,7 +551,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
|
|||||||
|
|
||||||
frameLayout.addView(actionBar);
|
frameLayout.addView(actionBar);
|
||||||
|
|
||||||
if (user_id != 0 || chat_id >= 0) {
|
if (user_id != 0 || chat_id >= 0 && !currentChat.left) {
|
||||||
writeButton = new ImageView(getParentActivity());
|
writeButton = new ImageView(getParentActivity());
|
||||||
if (user_id != 0) {
|
if (user_id != 0) {
|
||||||
writeButton.setImageResource(R.drawable.floating_user_states);
|
writeButton.setImageResource(R.drawable.floating_user_states);
|
||||||
@ -602,7 +599,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
|
|||||||
avatarUpdater.openCamera();
|
avatarUpdater.openCamera();
|
||||||
} else if (i == 1) {
|
} else if (i == 1) {
|
||||||
avatarUpdater.openGallery();
|
avatarUpdater.openGallery();
|
||||||
} else if (i == 3) {
|
} else if (i == 2) {
|
||||||
MessagesController.getInstance().changeChatAvatar(chat_id, null);
|
MessagesController.getInstance().changeChatAvatar(chat_id, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -890,7 +887,9 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
|
|||||||
public void willSwitchFromPhoto(MessageObject messageObject, TLRPC.FileLocation fileLocation, int index) { }
|
public void willSwitchFromPhoto(MessageObject messageObject, TLRPC.FileLocation fileLocation, int index) { }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void willHidePhotoViewer() { }
|
public void willHidePhotoViewer() {
|
||||||
|
avatarImage.imageReceiver.setVisible(true, true);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isPhotoChecked(int index) { return false; }
|
public boolean isPhotoChecked(int index) { return false; }
|
||||||
@ -1065,6 +1064,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
|
|||||||
photoBig = chat.photo.photo_big;
|
photoBig = chat.photo.photo_big;
|
||||||
}
|
}
|
||||||
avatarImage.setImage(photo, "50_50", new AvatarDrawable(chat));
|
avatarImage.setImage(photo, "50_50", new AvatarDrawable(chat));
|
||||||
|
|
||||||
avatarImage.imageReceiver.setVisible(!PhotoViewer.getInstance().isShowingImage(photoBig), false);
|
avatarImage.imageReceiver.setVisible(!PhotoViewer.getInstance().isShowingImage(photoBig), false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,6 @@ import android.content.SharedPreferences;
|
|||||||
import android.content.pm.PackageInfo;
|
import android.content.pm.PackageInfo;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Build;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.text.Html;
|
import android.text.Html;
|
||||||
import android.text.Spannable;
|
import android.text.Spannable;
|
||||||
@ -211,11 +210,11 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter
|
|||||||
usernameRow = rowCount++;
|
usernameRow = rowCount++;
|
||||||
settingsSectionRow = rowCount++;
|
settingsSectionRow = rowCount++;
|
||||||
settingsSectionRow2 = rowCount++;
|
settingsSectionRow2 = rowCount++;
|
||||||
enableAnimationsRow = rowCount++;
|
|
||||||
notificationRow = rowCount++;
|
notificationRow = rowCount++;
|
||||||
privacyRow = rowCount++;
|
privacyRow = rowCount++;
|
||||||
backgroundRow = rowCount++;
|
backgroundRow = rowCount++;
|
||||||
languageRow = rowCount++;
|
languageRow = rowCount++;
|
||||||
|
enableAnimationsRow = rowCount++;
|
||||||
mediaDownloadSection = rowCount++;
|
mediaDownloadSection = rowCount++;
|
||||||
mediaDownloadSection2 = rowCount++;
|
mediaDownloadSection2 = rowCount++;
|
||||||
mobileDownloadRow = rowCount++;
|
mobileDownloadRow = rowCount++;
|
||||||
@ -264,7 +263,6 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter
|
|||||||
actionBar.setBackgroundColor(AvatarDrawable.getProfileBackColorForId(5));
|
actionBar.setBackgroundColor(AvatarDrawable.getProfileBackColorForId(5));
|
||||||
actionBar.setItemsBackground(AvatarDrawable.getButtonColorForId(5));
|
actionBar.setItemsBackground(AvatarDrawable.getButtonColorForId(5));
|
||||||
actionBar.setBackButtonImage(R.drawable.ic_ab_back);
|
actionBar.setBackButtonImage(R.drawable.ic_ab_back);
|
||||||
actionBar.setBackOverlay(R.layout.updating_state_layout);
|
|
||||||
actionBar.setExtraHeight(AndroidUtilities.dp(88), false);
|
actionBar.setExtraHeight(AndroidUtilities.dp(88), false);
|
||||||
if (AndroidUtilities.isTablet()) {
|
if (AndroidUtilities.isTablet()) {
|
||||||
actionBar.setOccupyStatusBar(false);
|
actionBar.setOccupyStatusBar(false);
|
||||||
@ -637,7 +635,7 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter
|
|||||||
avatarUpdater.openCamera();
|
avatarUpdater.openCamera();
|
||||||
} else if (i == 1) {
|
} else if (i == 1) {
|
||||||
avatarUpdater.openGallery();
|
avatarUpdater.openGallery();
|
||||||
} else if (i == 3) {
|
} else if (i == 2) {
|
||||||
MessagesController.getInstance().deleteUserPhoto(null);
|
MessagesController.getInstance().deleteUserPhoto(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -716,7 +714,9 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter
|
|||||||
public void willSwitchFromPhoto(MessageObject messageObject, TLRPC.FileLocation fileLocation, int index) { }
|
public void willSwitchFromPhoto(MessageObject messageObject, TLRPC.FileLocation fileLocation, int index) { }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void willHidePhotoViewer() { }
|
public void willHidePhotoViewer() {
|
||||||
|
avatarImage.imageReceiver.setVisible(true, true);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isPhotoChecked(int index) { return false; }
|
public boolean isPhotoChecked(int index) { return false; }
|
||||||
@ -1034,7 +1034,7 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter
|
|||||||
int size = preferences.getInt("fons_size", AndroidUtilities.isTablet() ? 18 : 16);
|
int size = preferences.getInt("fons_size", AndroidUtilities.isTablet() ? 18 : 16);
|
||||||
textCell.setTextAndValue(LocaleController.getString("TextSize", R.string.TextSize), String.format("%d", size), true);
|
textCell.setTextAndValue(LocaleController.getString("TextSize", R.string.TextSize), String.format("%d", size), true);
|
||||||
} else if (i == languageRow) {
|
} else if (i == languageRow) {
|
||||||
textCell.setTextAndValue(LocaleController.getString("Language", R.string.Language), LocaleController.getCurrentLanguageName(), false);
|
textCell.setTextAndValue(LocaleController.getString("Language", R.string.Language), LocaleController.getCurrentLanguageName(), true);
|
||||||
} else if (i == contactsSortRow) {
|
} else if (i == contactsSortRow) {
|
||||||
String value;
|
String value;
|
||||||
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", Activity.MODE_PRIVATE);
|
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", Activity.MODE_PRIVATE);
|
||||||
@ -1074,7 +1074,7 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter
|
|||||||
|
|
||||||
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", Activity.MODE_PRIVATE);
|
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", Activity.MODE_PRIVATE);
|
||||||
if (i == enableAnimationsRow) {
|
if (i == enableAnimationsRow) {
|
||||||
textCell.setTextAndCheck(LocaleController.getString("EnableAnimations", R.string.EnableAnimations), preferences.getBoolean("view_animations", true), true);
|
textCell.setTextAndCheck(LocaleController.getString("EnableAnimations", R.string.EnableAnimations), preferences.getBoolean("view_animations", true), false);
|
||||||
} else if (i == sendByEnterRow) {
|
} else if (i == sendByEnterRow) {
|
||||||
textCell.setTextAndCheck(LocaleController.getString("SendByEnter", R.string.SendByEnter), preferences.getBoolean("send_by_enter", false), false);
|
textCell.setTextAndCheck(LocaleController.getString("SendByEnter", R.string.SendByEnter), preferences.getBoolean("send_by_enter", false), false);
|
||||||
} else if (i == saveToGalleryRow) {
|
} else if (i == saveToGalleryRow) {
|
||||||
|
@ -21,8 +21,11 @@ import org.telegram.android.AndroidUtilities;
|
|||||||
import org.telegram.messenger.FileLog;
|
import org.telegram.messenger.FileLog;
|
||||||
import org.telegram.messenger.R;
|
import org.telegram.messenger.R;
|
||||||
import org.telegram.messenger.TLRPC;
|
import org.telegram.messenger.TLRPC;
|
||||||
|
import org.telegram.messenger.UserConfig;
|
||||||
import org.telegram.ui.ApplicationLoader;
|
import org.telegram.ui.ApplicationLoader;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
public class AvatarDrawable extends Drawable {
|
public class AvatarDrawable extends Drawable {
|
||||||
|
|
||||||
private static Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
private static Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||||
@ -58,47 +61,69 @@ public class AvatarDrawable extends Drawable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public AvatarDrawable(TLRPC.User user) {
|
public AvatarDrawable(TLRPC.User user) {
|
||||||
this();
|
this(user, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public AvatarDrawable(TLRPC.Chat chat) {
|
||||||
|
this(chat, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public AvatarDrawable(TLRPC.User user, boolean profile) {
|
||||||
|
isProfile = profile;
|
||||||
if (user != null) {
|
if (user != null) {
|
||||||
setInfo(user.id, user.first_name, user.last_name, false);
|
setInfo(user.id, user.first_name, user.last_name, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public AvatarDrawable(TLRPC.Chat chat) {
|
public AvatarDrawable(TLRPC.Chat chat, boolean profile) {
|
||||||
this();
|
isProfile = profile;
|
||||||
if (chat != null) {
|
if (chat != null) {
|
||||||
setInfo(chat.id, chat.title, null, chat.id < 0);
|
setInfo(chat.id, chat.title, null, chat.id < 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public AvatarDrawable(TLRPC.User user, boolean profile) {
|
public static int getColorIndex(int id) {
|
||||||
this(user);
|
try {
|
||||||
isProfile = profile;
|
String str;
|
||||||
}
|
if (id >= 0) {
|
||||||
|
str = String.format(Locale.US, "%d%d", id, UserConfig.getClientUserId());
|
||||||
public AvatarDrawable(TLRPC.Chat chat, boolean profile) {
|
} else {
|
||||||
this(chat);
|
str = String.format(Locale.US, "%d", id);
|
||||||
isProfile = profile;
|
}
|
||||||
|
if (str.length() > 15) {
|
||||||
|
str = str.substring(0, 15);
|
||||||
|
}
|
||||||
|
java.security.MessageDigest md = java.security.MessageDigest.getInstance("MD5");
|
||||||
|
byte[] digest = md.digest(str.getBytes());
|
||||||
|
int b = digest[Math.abs(id % 16)];
|
||||||
|
if (b < 0) {
|
||||||
|
b += 256;
|
||||||
|
}
|
||||||
|
return Math.abs(b) % arrColors.length;
|
||||||
|
} catch (Exception e) {
|
||||||
|
FileLog.e("tmessages", e);
|
||||||
|
}
|
||||||
|
return id % arrColors.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getColorForId(int id) {
|
public static int getColorForId(int id) {
|
||||||
return arrColors[Math.abs(id) % arrColors.length];
|
return arrColors[getColorIndex(id)];
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getButtonColorForId(int id) {
|
public static int getButtonColorForId(int id) {
|
||||||
return arrColorsButtons[Math.abs(id) % arrColorsButtons.length];
|
return arrColorsButtons[getColorIndex(id)];
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getProfileColorForId(int id) {
|
public static int getProfileColorForId(int id) {
|
||||||
return arrColorsProfiles[Math.abs(id) % arrColorsProfiles.length];
|
return arrColorsProfiles[getColorIndex(id)];
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getProfileTextColorForId(int id) {
|
public static int getProfileTextColorForId(int id) {
|
||||||
return arrColorsProfilesText[Math.abs(id) % arrColorsProfilesText.length];
|
return arrColorsProfilesText[getColorIndex(id)];
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getProfileBackColorForId(int id) {
|
public static int getProfileBackColorForId(int id) {
|
||||||
return arrColorsProfilesBack[Math.abs(id) % arrColorsProfilesBack.length];
|
return arrColorsProfilesBack[getColorIndex(id)];
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setInfo(TLRPC.User user) {
|
public void setInfo(TLRPC.User user) {
|
||||||
@ -119,9 +144,9 @@ public class AvatarDrawable extends Drawable {
|
|||||||
|
|
||||||
public void setInfo(int id, String firstName, String lastName, boolean isBroadcast) {
|
public void setInfo(int id, String firstName, String lastName, boolean isBroadcast) {
|
||||||
if (isProfile) {
|
if (isProfile) {
|
||||||
color = arrColorsProfiles[Math.abs(id) % arrColorsProfiles.length];
|
color = arrColorsProfiles[getColorIndex(id)];
|
||||||
} else {
|
} else {
|
||||||
color = arrColors[Math.abs(id) % arrColors.length];
|
color = arrColors[getColorIndex(id)];
|
||||||
}
|
}
|
||||||
|
|
||||||
drawBrodcast = isBroadcast;
|
drawBrodcast = isBroadcast;
|
||||||
|
@ -120,7 +120,7 @@ public class AvatarUpdater implements NotificationCenter.NotificationCenterDeleg
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
smallPhoto = ImageLoader.scaleAndSaveImage(bitmap, 100, 100, 80, false);
|
smallPhoto = ImageLoader.scaleAndSaveImage(bitmap, 100, 100, 80, false);
|
||||||
bigPhoto = ImageLoader.scaleAndSaveImage(bitmap, 800, 800, 80, false);
|
bigPhoto = ImageLoader.scaleAndSaveImage(bitmap, 800, 800, 80, false, 320, 320);
|
||||||
if (bigPhoto != null && smallPhoto != null) {
|
if (bigPhoto != null && smallPhoto != null) {
|
||||||
if (returnOnly) {
|
if (returnOnly) {
|
||||||
if (delegate != null) {
|
if (delegate != null) {
|
||||||
|
@ -70,7 +70,9 @@ public class ChatActivityEnterView implements NotificationCenter.NotificationCen
|
|||||||
private FrameLayout attachButton;
|
private FrameLayout attachButton;
|
||||||
private AnimatorSetProxy runningAnimation;
|
private AnimatorSetProxy runningAnimation;
|
||||||
private AnimatorSetProxy runningAnimation2;
|
private AnimatorSetProxy runningAnimation2;
|
||||||
|
private ObjectAnimatorProxy runningAnimationAudio;
|
||||||
private int runningAnimationType;
|
private int runningAnimationType;
|
||||||
|
private int audioInterfaceState;
|
||||||
|
|
||||||
private int keyboardHeight;
|
private int keyboardHeight;
|
||||||
private int keyboardHeightLand;
|
private int keyboardHeightLand;
|
||||||
@ -502,6 +504,10 @@ public class ChatActivityEnterView implements NotificationCenter.NotificationCen
|
|||||||
|
|
||||||
private void updateAudioRecordIntefrace() {
|
private void updateAudioRecordIntefrace() {
|
||||||
if (recordingAudio) {
|
if (recordingAudio) {
|
||||||
|
if (audioInterfaceState == 1) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
audioInterfaceState = 1;
|
||||||
try {
|
try {
|
||||||
if (mWakeLock == null) {
|
if (mWakeLock == null) {
|
||||||
PowerManager pm = (PowerManager) ApplicationLoader.applicationContext.getSystemService(Context.POWER_SERVICE);
|
PowerManager pm = (PowerManager) ApplicationLoader.applicationContext.getSystemService(Context.POWER_SERVICE);
|
||||||
@ -521,16 +527,21 @@ public class ChatActivityEnterView implements NotificationCenter.NotificationCen
|
|||||||
params.leftMargin = AndroidUtilities.dp(30);
|
params.leftMargin = AndroidUtilities.dp(30);
|
||||||
slideText.setLayoutParams(params);
|
slideText.setLayoutParams(params);
|
||||||
ViewProxy.setAlpha(slideText, 1);
|
ViewProxy.setAlpha(slideText, 1);
|
||||||
recordPanel.setX(AndroidUtilities.displaySize.x);
|
ViewProxy.setX(recordPanel, AndroidUtilities.displaySize.x);
|
||||||
ObjectAnimatorProxy animatorProxy = ObjectAnimatorProxy.ofFloatProxy(recordPanel, "translationX", 0).setDuration(300);
|
if (runningAnimationAudio != null) {
|
||||||
animatorProxy.addListener(new AnimatorListenerAdapterProxy() {
|
runningAnimationAudio.cancel();
|
||||||
|
}
|
||||||
|
runningAnimationAudio = ObjectAnimatorProxy.ofFloatProxy(recordPanel, "translationX", 0).setDuration(300);
|
||||||
|
runningAnimationAudio.addListener(new AnimatorListenerAdapterProxy() {
|
||||||
@Override
|
@Override
|
||||||
public void onAnimationEnd(Object animator) {
|
public void onAnimationEnd(Object animator) {
|
||||||
ViewProxy.setX(recordPanel, 0);
|
if (runningAnimationAudio != null && runningAnimationAudio.equals(animator)) {
|
||||||
|
ViewProxy.setX(recordPanel, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
animatorProxy.setInterpolator(new AccelerateDecelerateInterpolator());
|
runningAnimationAudio.setInterpolator(new AccelerateDecelerateInterpolator());
|
||||||
animatorProxy.start();
|
runningAnimationAudio.start();
|
||||||
} else {
|
} else {
|
||||||
if (mWakeLock != null) {
|
if (mWakeLock != null) {
|
||||||
try {
|
try {
|
||||||
@ -541,20 +552,29 @@ public class ChatActivityEnterView implements NotificationCenter.NotificationCen
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
AndroidUtilities.unlockOrientation(parentActivity);
|
AndroidUtilities.unlockOrientation(parentActivity);
|
||||||
|
if (audioInterfaceState == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
audioInterfaceState = 0;
|
||||||
|
|
||||||
ObjectAnimatorProxy animatorProxy = ObjectAnimatorProxy.ofFloatProxy(recordPanel, "translationX", AndroidUtilities.displaySize.x).setDuration(300);
|
if (runningAnimationAudio != null) {
|
||||||
animatorProxy.addListener(new AnimatorListenerAdapterProxy() {
|
runningAnimationAudio.cancel();
|
||||||
|
}
|
||||||
|
runningAnimationAudio = ObjectAnimatorProxy.ofFloatProxy(recordPanel, "translationX", AndroidUtilities.displaySize.x).setDuration(300);
|
||||||
|
runningAnimationAudio.addListener(new AnimatorListenerAdapterProxy() {
|
||||||
@Override
|
@Override
|
||||||
public void onAnimationEnd(Object animator) {
|
public void onAnimationEnd(Object animator) {
|
||||||
FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) slideText.getLayoutParams();
|
if (runningAnimationAudio != null && runningAnimationAudio.equals(animator)) {
|
||||||
params.leftMargin = AndroidUtilities.dp(30);
|
FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) slideText.getLayoutParams();
|
||||||
slideText.setLayoutParams(params);
|
params.leftMargin = AndroidUtilities.dp(30);
|
||||||
ViewProxy.setAlpha(slideText, 1);
|
slideText.setLayoutParams(params);
|
||||||
recordPanel.setVisibility(View.GONE);
|
ViewProxy.setAlpha(slideText, 1);
|
||||||
|
recordPanel.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
animatorProxy.setInterpolator(new AccelerateDecelerateInterpolator());
|
runningAnimationAudio.setInterpolator(new AccelerateDecelerateInterpolator());
|
||||||
animatorProxy.start();
|
runningAnimationAudio.start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,7 +10,6 @@ package org.telegram.ui.Views;
|
|||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.database.DataSetObserver;
|
import android.database.DataSetObserver;
|
||||||
import android.graphics.drawable.GradientDrawable;
|
|
||||||
import android.support.v4.view.PagerAdapter;
|
import android.support.v4.view.PagerAdapter;
|
||||||
import android.support.v4.view.ViewPager;
|
import android.support.v4.view.ViewPager;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
@ -114,10 +113,11 @@ public class EmojiView extends LinearLayout {
|
|||||||
|
|
||||||
EmojiGridAdapter localEmojiGridAdapter = new EmojiGridAdapter(Emoji.data[i]);
|
EmojiGridAdapter localEmojiGridAdapter = new EmojiGridAdapter(Emoji.data[i]);
|
||||||
gridView.setAdapter(localEmojiGridAdapter);
|
gridView.setAdapter(localEmojiGridAdapter);
|
||||||
|
AndroidUtilities.setListViewEdgeEffectColor(gridView, 0xff999999);
|
||||||
adapters.add(localEmojiGridAdapter);
|
adapters.add(localEmojiGridAdapter);
|
||||||
}
|
}
|
||||||
|
|
||||||
setBackgroundDrawable(new GradientDrawable(GradientDrawable.Orientation.TOP_BOTTOM, new int[] { -14145496, -16777216 }));
|
setBackgroundColor(0xff222222);
|
||||||
pager = new ViewPager(getContext());
|
pager = new ViewPager(getContext());
|
||||||
pager.setAdapter(new EmojiPagesAdapter());
|
pager.setAdapter(new EmojiPagesAdapter());
|
||||||
PagerSlidingTabStrip tabs = new PagerSlidingTabStrip(getContext());
|
PagerSlidingTabStrip tabs = new PagerSlidingTabStrip(getContext());
|
||||||
@ -258,33 +258,30 @@ public class EmojiView extends LinearLayout {
|
|||||||
|
|
||||||
private class EmojiPagesAdapter extends PagerAdapter implements PagerSlidingTabStrip.IconTabProvider {
|
private class EmojiPagesAdapter extends PagerAdapter implements PagerSlidingTabStrip.IconTabProvider {
|
||||||
|
|
||||||
private EmojiPagesAdapter() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public void destroyItem(ViewGroup paramViewGroup, int paramInt, Object paramObject) {
|
public void destroyItem(ViewGroup paramViewGroup, int paramInt, Object paramObject) {
|
||||||
View localObject;
|
View localObject;
|
||||||
if (paramInt == 0) {
|
if (paramInt == 0) {
|
||||||
localObject = EmojiView.this.recentsWrap;
|
localObject = recentsWrap;
|
||||||
} else {
|
} else {
|
||||||
localObject = EmojiView.this.views.get(paramInt);
|
localObject = views.get(paramInt);
|
||||||
}
|
}
|
||||||
paramViewGroup.removeView(localObject);
|
paramViewGroup.removeView(localObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getCount() {
|
public int getCount() {
|
||||||
return EmojiView.this.views.size();
|
return views.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getPageIconResId(int paramInt) {
|
public int getPageIconResId(int paramInt) {
|
||||||
return EmojiView.this.icons[paramInt];
|
return icons[paramInt];
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object instantiateItem(ViewGroup paramViewGroup, int paramInt) {
|
public Object instantiateItem(ViewGroup paramViewGroup, int paramInt) {
|
||||||
View localObject;
|
View localObject;
|
||||||
if (paramInt == 0) {
|
if (paramInt == 0) {
|
||||||
localObject = EmojiView.this.recentsWrap;
|
localObject = recentsWrap;
|
||||||
} else {
|
} else {
|
||||||
localObject = EmojiView.this.views.get(paramInt);
|
localObject = views.get(paramInt);
|
||||||
}
|
}
|
||||||
paramViewGroup.addView(localObject);
|
paramViewGroup.addView(localObject);
|
||||||
return localObject;
|
return localObject;
|
||||||
|
@ -55,11 +55,9 @@ public class PagerSlidingTabStrip extends HorizontalScrollView {
|
|||||||
private float currentPositionOffset = 0f;
|
private float currentPositionOffset = 0f;
|
||||||
|
|
||||||
private Paint rectPaint;
|
private Paint rectPaint;
|
||||||
private Paint dividerPaint;
|
|
||||||
|
|
||||||
private int indicatorColor = 0xFF666666;
|
private int indicatorColor = 0xFF666666;
|
||||||
private int underlineColor = 0x1A000000;
|
private int underlineColor = 0x1A000000;
|
||||||
private int dividerColor = 0x1A000000;
|
|
||||||
|
|
||||||
private boolean shouldExpand = false;
|
private boolean shouldExpand = false;
|
||||||
private boolean textAllCaps = true;
|
private boolean textAllCaps = true;
|
||||||
@ -69,7 +67,6 @@ public class PagerSlidingTabStrip extends HorizontalScrollView {
|
|||||||
private int underlineHeight = 2;
|
private int underlineHeight = 2;
|
||||||
private int dividerPadding = 12;
|
private int dividerPadding = 12;
|
||||||
private int tabPadding = 24;
|
private int tabPadding = 24;
|
||||||
private int dividerWidth = 1;
|
|
||||||
|
|
||||||
private int tabTextSize = 12;
|
private int tabTextSize = 12;
|
||||||
private int tabTextColor = 0xFF666666;
|
private int tabTextColor = 0xFF666666;
|
||||||
@ -108,17 +105,12 @@ public class PagerSlidingTabStrip extends HorizontalScrollView {
|
|||||||
underlineHeight = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, underlineHeight, dm);
|
underlineHeight = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, underlineHeight, dm);
|
||||||
dividerPadding = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dividerPadding, dm);
|
dividerPadding = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dividerPadding, dm);
|
||||||
tabPadding = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, tabPadding, dm);
|
tabPadding = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, tabPadding, dm);
|
||||||
dividerWidth = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dividerWidth, dm);
|
|
||||||
tabTextSize = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, tabTextSize, dm);
|
tabTextSize = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, tabTextSize, dm);
|
||||||
|
|
||||||
rectPaint = new Paint();
|
rectPaint = new Paint();
|
||||||
rectPaint.setAntiAlias(true);
|
rectPaint.setAntiAlias(true);
|
||||||
rectPaint.setStyle(Style.FILL);
|
rectPaint.setStyle(Style.FILL);
|
||||||
|
|
||||||
dividerPaint = new Paint();
|
|
||||||
dividerPaint.setAntiAlias(true);
|
|
||||||
dividerPaint.setStrokeWidth(dividerWidth);
|
|
||||||
|
|
||||||
defaultTabLayoutParams = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT);
|
defaultTabLayoutParams = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT);
|
||||||
|
|
||||||
if (locale == null) {
|
if (locale == null) {
|
||||||
@ -322,14 +314,6 @@ public class PagerSlidingTabStrip extends HorizontalScrollView {
|
|||||||
|
|
||||||
rectPaint.setColor(underlineColor);
|
rectPaint.setColor(underlineColor);
|
||||||
canvas.drawRect(0, height - underlineHeight, tabsContainer.getWidth(), height, rectPaint);
|
canvas.drawRect(0, height - underlineHeight, tabsContainer.getWidth(), height, rectPaint);
|
||||||
|
|
||||||
// draw divider
|
|
||||||
|
|
||||||
dividerPaint.setColor(dividerColor);
|
|
||||||
for (int i = 0; i < tabCount - 1; i++) {
|
|
||||||
View tab = tabsContainer.getChildAt(i);
|
|
||||||
canvas.drawLine(tab.getRight(), dividerPadding, tab.getRight(), height - dividerPadding, dividerPaint);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private class PageListener implements OnPageChangeListener {
|
private class PageListener implements OnPageChangeListener {
|
||||||
@ -419,20 +403,6 @@ public class PagerSlidingTabStrip extends HorizontalScrollView {
|
|||||||
return underlineColor;
|
return underlineColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDividerColor(int dividerColor) {
|
|
||||||
this.dividerColor = dividerColor;
|
|
||||||
invalidate();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDividerColorResource(int resId) {
|
|
||||||
this.dividerColor = getResources().getColor(resId);
|
|
||||||
invalidate();
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getDividerColor() {
|
|
||||||
return dividerColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUnderlineHeight(int underlineHeightPx) {
|
public void setUnderlineHeight(int underlineHeightPx) {
|
||||||
this.underlineHeight = underlineHeightPx;
|
this.underlineHeight = underlineHeightPx;
|
||||||
invalidate();
|
invalidate();
|
||||||
|
@ -525,7 +525,8 @@ public class Switch extends CompoundButton {
|
|||||||
|
|
||||||
final int thumbLeft = thumbInitialLeft - padding.left;
|
final int thumbLeft = thumbInitialLeft - padding.left;
|
||||||
final int thumbRight = thumbInitialLeft + mThumbWidth + padding.right;
|
final int thumbRight = thumbInitialLeft + mThumbWidth + padding.right;
|
||||||
mThumbDrawable.setBounds(thumbLeft, switchTop, thumbRight, switchBottom);
|
int offset = (AndroidUtilities.density == 1.5f ? AndroidUtilities.dp(1) : 0);
|
||||||
|
mThumbDrawable.setBounds(thumbLeft, switchTop + offset, thumbRight, switchBottom + offset);
|
||||||
|
|
||||||
final Drawable background = getBackground();
|
final Drawable background = getBackground();
|
||||||
if (background != null) {
|
if (background != null) {
|
||||||
|
@ -90,8 +90,8 @@ public class TimerDrawable extends Drawable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw(Canvas canvas) {
|
public void draw(Canvas canvas) {
|
||||||
int width = canvas.getWidth();
|
int width = getBounds().width();
|
||||||
int height = canvas.getHeight();
|
int height = getBounds().height();
|
||||||
Drawable drawable = null;
|
Drawable drawable = null;
|
||||||
if (time == 0) {
|
if (time == 0) {
|
||||||
drawable = timerDrawable;
|
drawable = timerDrawable;
|
||||||
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 929 B After Width: | Height: | Size: 656 B |
Before Width: | Height: | Size: 676 B After Width: | Height: | Size: 432 B |
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 815 B |
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 3.5 KiB |
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.1 KiB |
BIN
TMessagesProj/src/main/res/drawable-xxhdpi/ic_lock_header.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
@ -111,7 +111,7 @@
|
|||||||
android:layout_marginTop="2dp"
|
android:layout_marginTop="2dp"
|
||||||
android:maxLines="4"
|
android:maxLines="4"
|
||||||
android:textSize="18dp"
|
android:textSize="18dp"
|
||||||
android:textColorHint="#909090"
|
android:textColorHint="#b2b2b2"
|
||||||
android:ems="10"
|
android:ems="10"
|
||||||
android:imeOptions="flagNoExtractUi"
|
android:imeOptions="flagNoExtractUi"
|
||||||
android:inputType="textCapSentences|textMultiLine"
|
android:inputType="textCapSentences|textMultiLine"
|
||||||
@ -119,8 +119,9 @@
|
|||||||
android:layout_marginLeft="52dp"
|
android:layout_marginLeft="52dp"
|
||||||
android:layout_marginRight="2dp"
|
android:layout_marginRight="2dp"
|
||||||
android:layout_marginBottom="4dp"
|
android:layout_marginBottom="4dp"
|
||||||
android:paddingBottom="10dp"
|
android:paddingBottom="8dp"
|
||||||
android:paddingTop="4dp"
|
android:paddingTop="4dp"
|
||||||
|
android:background="@null"
|
||||||
android:textCursorDrawable="@null"
|
android:textCursorDrawable="@null"
|
||||||
android:textColor="#000000"/>
|
android:textColor="#000000"/>
|
||||||
|
|
||||||
|
@ -51,9 +51,9 @@
|
|||||||
android:layout_gravity="bottom"
|
android:layout_gravity="bottom"
|
||||||
android:id="@+id/chat_text_edit"
|
android:id="@+id/chat_text_edit"
|
||||||
android:layout_marginTop="2dp"
|
android:layout_marginTop="2dp"
|
||||||
android:maxLines="2"
|
android:maxLines="4"
|
||||||
android:textSize="18dp"
|
android:textSize="18dp"
|
||||||
android:textColorHint="#909090"
|
android:textColorHint="#b2b2b2"
|
||||||
android:ems="10"
|
android:ems="10"
|
||||||
android:imeOptions="flagNoExtractUi"
|
android:imeOptions="flagNoExtractUi"
|
||||||
android:inputType="textCapSentences|textMultiLine"
|
android:inputType="textCapSentences|textMultiLine"
|
||||||
@ -61,8 +61,9 @@
|
|||||||
android:layout_marginLeft="52dp"
|
android:layout_marginLeft="52dp"
|
||||||
android:layout_marginRight="2dp"
|
android:layout_marginRight="2dp"
|
||||||
android:layout_marginBottom="4dp"
|
android:layout_marginBottom="4dp"
|
||||||
android:paddingBottom="10dp"
|
android:paddingBottom="8dp"
|
||||||
android:paddingTop="4dp"
|
android:paddingTop="4dp"
|
||||||
|
android:background="@null"
|
||||||
android:textCursorDrawable="@null"
|
android:textCursorDrawable="@null"
|
||||||
android:textColor="#000000"/>
|
android:textColor="#000000"/>
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
<item name="android:colorPrimaryDark">#33000000</item>
|
<item name="android:colorPrimaryDark">#33000000</item>
|
||||||
<item name="android:colorPrimary">#54759e</item>
|
<item name="android:colorPrimary">#54759e</item>
|
||||||
<item name="android:alertDialogTheme">@style/Theme.TMessages.Dialog.Alert</item>
|
<item name="android:alertDialogTheme">@style/Theme.TMessages.Dialog.Alert</item>
|
||||||
<item name="android:colorControlActivated">#678cb9</item>
|
<item name="android:colorControlActivated">#4d83b3</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="Theme.TMessages.PopupNotification" parent="Theme.TMessages">
|
<style name="Theme.TMessages.PopupNotification" parent="Theme.TMessages">
|
||||||
@ -47,7 +47,7 @@
|
|||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="Theme.TMessages.Dialog.Alert" parent="android:style/Theme.Material.Light.Dialog.Alert">
|
<style name="Theme.TMessages.Dialog.Alert" parent="android:style/Theme.Material.Light.Dialog.Alert">
|
||||||
<item name="android:colorAccent">#678cb9</item>
|
<item name="android:colorAccent">#4d83b3</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<!--ACTION BAR-->
|
<!--ACTION BAR-->
|
||||||
|
@ -47,7 +47,7 @@
|
|||||||
<string name="ClearHistory">Clear history</string>
|
<string name="ClearHistory">Clear history</string>
|
||||||
<string name="DeleteChat">Delete and exit</string>
|
<string name="DeleteChat">Delete and exit</string>
|
||||||
<string name="DeleteChatUser">Delete chat</string>
|
<string name="DeleteChatUser">Delete chat</string>
|
||||||
<string name="HiddenName">Hidden Name</string>
|
<string name="HiddenName">Deleted Account</string>
|
||||||
<string name="SelectChat">Select Chat</string>
|
<string name="SelectChat">Select Chat</string>
|
||||||
<string name="PhotoTip">Tap and hold to view</string>
|
<string name="PhotoTip">Tap and hold to view</string>
|
||||||
<string name="CompatibilityChat">%1$s is using an older version of Telegram, so secret photos will be shown in compatibility mode.\n\nOnce %2$s updates Telegram, photos with timers for 1 minute or less will start working in \'Tap and hold to view\' mode, and you will be notified whenever the other party takes a screenshot.</string>
|
<string name="CompatibilityChat">%1$s is using an older version of Telegram, so secret photos will be shown in compatibility mode.\n\nOnce %2$s updates Telegram, photos with timers for 1 minute or less will start working in \'Tap and hold to view\' mode, and you will be notified whenever the other party takes a screenshot.</string>
|
||||||
@ -287,6 +287,7 @@
|
|||||||
<string name="Gallery">Gallery</string>
|
<string name="Gallery">Gallery</string>
|
||||||
<string name="AllPhotos">All Photos</string>
|
<string name="AllPhotos">All Photos</string>
|
||||||
<string name="NoPhotos">No photos yet</string>
|
<string name="NoPhotos">No photos yet</string>
|
||||||
|
<string name="PleaseDownload">Please download media first</string>
|
||||||
<!--privacy settings-->
|
<!--privacy settings-->
|
||||||
<string name="PrivacySettings">Privacy and Security</string>
|
<string name="PrivacySettings">Privacy and Security</string>
|
||||||
<string name="PrivacyTitle">Privacy</string>
|
<string name="PrivacyTitle">Privacy</string>
|
||||||
@ -300,11 +301,10 @@
|
|||||||
<string name="LastSeenContactsMinusPlus">My Contacts (-%1$d, +%2$d)</string>
|
<string name="LastSeenContactsMinusPlus">My Contacts (-%1$d, +%2$d)</string>
|
||||||
<string name="LastSeenNobodyPlus">Nobody (+%1$d)</string>
|
<string name="LastSeenNobodyPlus">Nobody (+%1$d)</string>
|
||||||
<string name="SecurityTitle">Security</string>
|
<string name="SecurityTitle">Security</string>
|
||||||
<string name="DeleteAccountTitle">Delete my account</string>
|
<string name="DeleteAccountTitle">Account self-destructs</string>
|
||||||
<string name="DeleteAccountIfAwayFor">If Away For</string>
|
<string name="DeleteAccountIfAwayFor">If you\'re away for</string>
|
||||||
<string name="DeleteAccountHelp">If you do not log in at least once within this period, your account will be deleted along with all groups, messages and contacts.</string>
|
<string name="DeleteAccountHelp">If you do not log in at least once within this period, your account will be deleted along with all groups, messages and contacts.</string>
|
||||||
<string name="DeleteAccountNowConfirmation">Delete your account?</string>
|
<string name="DeleteAccountNowConfirmation">Delete your account?</string>
|
||||||
<string name="DeleteAccountNever">Never</string>
|
|
||||||
<string name="LastSeenHelp">Change who can see your Last Seen time.</string>
|
<string name="LastSeenHelp">Change who can see your Last Seen time.</string>
|
||||||
<string name="LastSeenTitle">Who can see your Last Seen time?</string>
|
<string name="LastSeenTitle">Who can see your Last Seen time?</string>
|
||||||
<string name="AddExceptions">Add exceptions</string>
|
<string name="AddExceptions">Add exceptions</string>
|
||||||
|