Bug fixes
This commit is contained in:
parent
d69b5b3b36
commit
fdaf4555c5
@ -65,16 +65,16 @@ android {
|
||||
jni.srcDirs = [] //disable automatic ndk-build call
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
debug {
|
||||
manifest.srcFile 'config/debug/AndroidManifest.xml'
|
||||
}
|
||||
release {
|
||||
manifest.srcFile 'config/release/AndroidManifest.xml'
|
||||
}
|
||||
foss {
|
||||
manifest.srcFile 'config/foss/AndroidManifest.xml'
|
||||
}
|
||||
sourceSets.debug {
|
||||
manifest.srcFile 'config/debug/AndroidManifest.xml'
|
||||
}
|
||||
|
||||
sourceSets.release {
|
||||
manifest.srcFile 'config/release/AndroidManifest.xml'
|
||||
}
|
||||
|
||||
sourceSets.foss {
|
||||
manifest.srcFile 'config/foss/AndroidManifest.xml'
|
||||
}
|
||||
|
||||
defaultConfig {
|
||||
|
@ -346,7 +346,7 @@ public class AndroidUtilities {
|
||||
} else if (encryptedChat.ttl == 60 * 60 * 24 * 7) {
|
||||
numberPicker.setValue(20);
|
||||
} else if (encryptedChat.ttl == 0) {
|
||||
numberPicker.setValue(5);
|
||||
numberPicker.setValue(0);
|
||||
}
|
||||
numberPicker.setFormatter(new NumberPicker.Formatter() {
|
||||
@Override
|
||||
|
@ -345,7 +345,9 @@ public class MessageObject {
|
||||
int dateMonth = rightNow.get(Calendar.MONTH);
|
||||
dateKey = String.format("%d_%02d_%02d", dateYear, dateMonth, dateDay);
|
||||
|
||||
generateLayout();
|
||||
if (preview != 0) {
|
||||
generateLayout();
|
||||
}
|
||||
generateThumbs(false, preview);
|
||||
}
|
||||
|
||||
|
@ -424,6 +424,12 @@ public class NotificationsController {
|
||||
mBuilder.setPriority(NotificationCompat.PRIORITY_MAX);
|
||||
}
|
||||
|
||||
mBuilder.setCategory(NotificationCompat.CATEGORY_MESSAGE);
|
||||
mBuilder.setVisibility(NotificationCompat.VISIBILITY_PUBLIC);
|
||||
/*Bundle bundle = new Bundle();
|
||||
bundle.putString(NotificationCompat.EXTRA_PEOPLE, );
|
||||
mBuilder.setExtras()*/
|
||||
|
||||
String lastMessage = null;
|
||||
String lastMessageFull = null;
|
||||
if (pushMessages.size() == 1) {
|
||||
@ -627,7 +633,8 @@ public class NotificationsController {
|
||||
.setContentText(text)
|
||||
.setGroupSummary(false)
|
||||
.setContentIntent(contentIntent)
|
||||
.extend(new NotificationCompat.WearableExtender().addAction(action));
|
||||
.extend(new NotificationCompat.WearableExtender().addAction(action))
|
||||
.setCategory(NotificationCompat.CATEGORY_MESSAGE);
|
||||
|
||||
notificationManager.notify(notificationId, builder.build());
|
||||
wearNoticationsIds.put(dialog_id, notificationId);
|
||||
|
@ -220,7 +220,7 @@ public class ContactsAdapter extends BaseSectionsAdapter {
|
||||
TLRPC.User user = MessagesController.getInstance().getUser(arr.get(position).user_id);
|
||||
((UserCell)convertView).setData(user, null, null, 0);
|
||||
if (checkedMap != null) {
|
||||
((UserCell) convertView).setChecked(checkedMap.containsKey(user.id));
|
||||
((UserCell) convertView).setChecked(checkedMap.containsKey(user.id), false);
|
||||
}
|
||||
if (ignoreUsers != null) {
|
||||
if (ignoreUsers.containsKey(user.id)) {
|
||||
|
@ -215,6 +215,9 @@ public class ContactsSearchAdapter extends BaseContactsSearchAdapter {
|
||||
if (view == null) {
|
||||
if (useUserCell) {
|
||||
view = new UserCell(mContext, 1);
|
||||
if (checkedMap != null) {
|
||||
((UserCell) view).setChecked(false, false);
|
||||
}
|
||||
} else {
|
||||
view = new ProfileSearchCell(mContext);
|
||||
}
|
||||
@ -244,7 +247,7 @@ public class ContactsSearchAdapter extends BaseContactsSearchAdapter {
|
||||
if (useUserCell) {
|
||||
((UserCell) view).setData(user, name, username, 0);
|
||||
if (checkedMap != null) {
|
||||
((UserCell) view).setChecked(checkedMap.containsKey(user.id));
|
||||
((UserCell) view).setChecked(checkedMap.containsKey(user.id), false);
|
||||
}
|
||||
} else {
|
||||
((ProfileSearchCell) view).setData(user, null, null, name, username);
|
||||
|
@ -228,7 +228,7 @@ public class ChatActionCell extends BaseCell {
|
||||
setMeasuredDimension(MeasureSpec.getSize(widthMeasureSpec), textHeight + AndroidUtilities.dp(14));
|
||||
return;
|
||||
}
|
||||
int width = MeasureSpec.getSize(widthMeasureSpec);
|
||||
int width = Math.max(AndroidUtilities.dp(30), MeasureSpec.getSize(widthMeasureSpec));
|
||||
if (width != previousWidth) {
|
||||
previousWidth = width;
|
||||
|
||||
|
@ -328,7 +328,12 @@ public class DialogCell extends BaseCell {
|
||||
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 {
|
||||
if (message.messageOwner.message != null) {
|
||||
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));
|
||||
String mess = message.messageOwner.message;
|
||||
if (mess.length() > 150) {
|
||||
mess = mess.substring(0, 150);
|
||||
}
|
||||
mess = mess.replace("\n", " ");
|
||||
messageString = Emoji.replaceEmoji(Html.fromHtml(String.format("<font color=#4d83b3>%s:</font> <font color=#808080>%s</font>", name, mess.replace("<", "<").replace(">", ">"))), messagePaint.getFontMetricsInt(), AndroidUtilities.dp(20));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -505,10 +510,11 @@ public class DialogCell extends BaseCell {
|
||||
if (messageString == null) {
|
||||
messageString = "";
|
||||
}
|
||||
String mess = messageString.toString().replace("\n", " ");
|
||||
String mess = messageString.toString();
|
||||
if (mess.length() > 150) {
|
||||
mess = mess.substring(0, 150);
|
||||
}
|
||||
mess = mess.replace("\n", " ");
|
||||
messageString = Emoji.replaceEmoji(mess, messagePaint.getFontMetricsInt(), AndroidUtilities.dp(17));
|
||||
}
|
||||
messageWidth = Math.max(AndroidUtilities.dp(12), messageWidth);
|
||||
|
@ -142,11 +142,11 @@ public class UserCell extends FrameLayout {
|
||||
update(0);
|
||||
}
|
||||
|
||||
public void setChecked(boolean checked) {
|
||||
public void setChecked(boolean checked, boolean animated) {
|
||||
if (checkBox.getVisibility() != VISIBLE) {
|
||||
checkBox.setVisibility(VISIBLE);
|
||||
}
|
||||
checkBox.setChecked(checked);
|
||||
checkBox.setChecked(checked, animated);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -120,7 +120,7 @@ public class GroupCreateActivity extends BaseFragment implements NotificationCen
|
||||
isBroadcast = args.getBoolean("broadcast", false);
|
||||
isAlwaysShare = args.getBoolean("isAlwaysShare", false);
|
||||
isNeverShare = args.getBoolean("isNeverShare", false);
|
||||
maxCount = !isBroadcast ? MessagesController.getInstance().maxGroupCount : MessagesController.getInstance().maxBroadcastCount;
|
||||
maxCount = !isBroadcast ? MessagesController.getInstance().maxGroupCount - 1 : MessagesController.getInstance().maxBroadcastCount;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -391,7 +391,9 @@ public class GroupCreateActivity extends BaseFragment implements NotificationCen
|
||||
return;
|
||||
}
|
||||
|
||||
boolean check = true;
|
||||
if (selectedContacts.containsKey(user.id)) {
|
||||
check = false;
|
||||
try {
|
||||
XImageSpan span = selectedContacts.get(user.id);
|
||||
selectedContacts.remove(user.id);
|
||||
@ -441,7 +443,9 @@ public class GroupCreateActivity extends BaseFragment implements NotificationCen
|
||||
listView.setVerticalScrollBarEnabled(false);
|
||||
emptyTextView.setText(LocaleController.getString("NoContacts", R.string.NoContacts));
|
||||
} else {
|
||||
listView.invalidateViews();
|
||||
if (view instanceof UserCell) {
|
||||
((UserCell) view).setChecked(check, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -193,8 +193,14 @@ public class LastSeenActivity extends BaseFragment implements NotificationCenter
|
||||
public void didSelectUsers(ArrayList<Integer> ids) {
|
||||
if (i == neverShareRow) {
|
||||
currentMinus = ids;
|
||||
for (Integer id : currentMinus) {
|
||||
currentPlus.remove(id);
|
||||
}
|
||||
} else {
|
||||
currentPlus = ids;
|
||||
for (Integer id : currentPlus) {
|
||||
currentMinus.remove(id);
|
||||
}
|
||||
}
|
||||
doneButton.setVisibility(View.VISIBLE);
|
||||
listAdapter.notifyDataSetChanged();
|
||||
|
@ -9,50 +9,146 @@
|
||||
package org.telegram.ui.Views;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.PorterDuffXfermode;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.widget.CompoundButton;
|
||||
import android.view.View;
|
||||
|
||||
import org.telegram.android.AndroidUtilities;
|
||||
import org.telegram.messenger.R;
|
||||
import org.telegram.ui.AnimationCompat.ObjectAnimatorProxy;
|
||||
|
||||
public class CheckBox extends CompoundButton {
|
||||
public class CheckBox extends View {
|
||||
|
||||
private Paint paint;
|
||||
private Drawable checkDrawable;
|
||||
private static Drawable checkDrawable;
|
||||
private static Paint paint;
|
||||
private static Paint eraser;
|
||||
private static Paint eraser2;
|
||||
private static Paint checkPaint;
|
||||
|
||||
private Bitmap drawBitmap;
|
||||
private Bitmap checkBitmap;
|
||||
private Canvas bitmapCanvas;
|
||||
private Canvas checkCanvas;
|
||||
|
||||
private float progress;
|
||||
private ObjectAnimatorProxy checkAnimator;
|
||||
private boolean isCheckAnimation = true;
|
||||
|
||||
private boolean attachedToWindow;
|
||||
private boolean isChecked = false;
|
||||
|
||||
private final static float progressBounceDiff = 0.2f;
|
||||
|
||||
public CheckBox(Context context) {
|
||||
super(context);
|
||||
if (checkDrawable == null) {
|
||||
checkDrawable = context.getResources().getDrawable(R.drawable.round_check2);
|
||||
paint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||
paint.setColor(0xff5ec245);
|
||||
eraser = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||
eraser.setColor(0);
|
||||
eraser.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.CLEAR));
|
||||
eraser2 = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||
eraser2.setColor(0);
|
||||
eraser2.setStyle(Paint.Style.STROKE);
|
||||
eraser2.setStrokeWidth(AndroidUtilities.dp(28));
|
||||
eraser2.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.CLEAR));
|
||||
}
|
||||
drawBitmap = Bitmap.createBitmap(AndroidUtilities.dp(22), AndroidUtilities.dp(22), Bitmap.Config.ARGB_4444);
|
||||
bitmapCanvas = new Canvas(drawBitmap);
|
||||
checkBitmap = Bitmap.createBitmap(AndroidUtilities.dp(22), AndroidUtilities.dp(22), Bitmap.Config.ARGB_4444);
|
||||
checkCanvas = new Canvas(checkBitmap);
|
||||
}
|
||||
|
||||
paint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||
paint.setColor(0xff5ec245);
|
||||
public void setProgress(float value) {
|
||||
progress = value;
|
||||
invalidate();
|
||||
}
|
||||
|
||||
checkDrawable = context.getResources().getDrawable(R.drawable.round_check2);
|
||||
public float getProgress() {
|
||||
return progress;
|
||||
}
|
||||
|
||||
private void cancelCheckAnimator() {
|
||||
if (checkAnimator != null) {
|
||||
checkAnimator.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
private void animateToCheckedState(boolean newCheckedState) {
|
||||
isCheckAnimation = newCheckedState;
|
||||
checkAnimator = ObjectAnimatorProxy.ofFloatProxy(this, "progress", newCheckedState ? 1 : 0);
|
||||
checkAnimator.setDuration(300);
|
||||
checkAnimator.start();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setChecked(boolean checked) {
|
||||
super.setChecked(checked);
|
||||
protected void onAttachedToWindow() {
|
||||
super.onAttachedToWindow();
|
||||
attachedToWindow = true;
|
||||
}
|
||||
|
||||
checked = isChecked();
|
||||
@Override
|
||||
protected void onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow();
|
||||
attachedToWindow = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
|
||||
super.onLayout(changed, left, top, right, bottom);
|
||||
}
|
||||
|
||||
public void setChecked(boolean checked, boolean animated) {
|
||||
isChecked = checked;
|
||||
invalidate();
|
||||
|
||||
/*if (attachedToWindow && wasLayout) {
|
||||
animateThumbToCheckedState(checked);
|
||||
if (attachedToWindow && animated) {
|
||||
animateToCheckedState(checked);
|
||||
} else {
|
||||
cancelPositionAnimator();
|
||||
setThumbPosition(checked ? 1 : 0);
|
||||
}*/
|
||||
cancelCheckAnimator();
|
||||
setProgress(checked ? 1.0f : 0.0f);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isChecked() {
|
||||
return isChecked;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDraw(Canvas canvas) {
|
||||
if (isChecked()) {
|
||||
canvas.drawCircle(getMeasuredWidth() / 2, getMeasuredHeight() / 2, getMeasuredWidth() / 2, paint);
|
||||
int x = (getMeasuredWidth() - checkDrawable.getIntrinsicWidth()) / 2;
|
||||
int y = (getMeasuredHeight() - checkDrawable.getIntrinsicHeight()) / 2;
|
||||
checkDrawable.setBounds(x, y, x + checkDrawable.getIntrinsicWidth(), y + checkDrawable.getIntrinsicHeight());
|
||||
checkDrawable.draw(canvas);
|
||||
if (progress != 0) {
|
||||
drawBitmap.eraseColor(0);
|
||||
float rad = getMeasuredWidth() / 2;
|
||||
|
||||
float roundProgress = progress >= 0.5f ? 1.0f : progress / 0.5f;
|
||||
float checkProgress = progress < 0.5f ? 0.0f : (progress - 0.5f) / 0.5f;
|
||||
|
||||
float roundProgressCheckState = isCheckAnimation ? progress : (1.0f - progress);
|
||||
if (roundProgressCheckState < progressBounceDiff) {
|
||||
rad -= AndroidUtilities.dp(2) * roundProgressCheckState / progressBounceDiff;
|
||||
} else if (roundProgressCheckState < progressBounceDiff * 2) {
|
||||
rad -= AndroidUtilities.dp(2) - AndroidUtilities.dp(2) * (roundProgressCheckState - progressBounceDiff) / progressBounceDiff;
|
||||
}
|
||||
bitmapCanvas.drawCircle(getMeasuredWidth() / 2, getMeasuredHeight() / 2, rad, paint);
|
||||
bitmapCanvas.drawCircle(getMeasuredWidth() / 2, getMeasuredHeight() / 2, rad * (1 - roundProgress), eraser);
|
||||
canvas.drawBitmap(drawBitmap, 0, 0, null);
|
||||
|
||||
checkBitmap.eraseColor(0);
|
||||
int w = checkDrawable.getIntrinsicWidth();
|
||||
int h = checkDrawable.getIntrinsicHeight();
|
||||
int x = (getMeasuredWidth() - w) / 2;
|
||||
int y = (getMeasuredHeight() - h) / 2;
|
||||
|
||||
checkDrawable.setBounds(x, y, x + w, y + h);
|
||||
checkDrawable.draw(checkCanvas);
|
||||
checkCanvas.drawCircle(getMeasuredWidth() / 2 - AndroidUtilities.dp(2.5f), getMeasuredHeight() / 2 + AndroidUtilities.dp(4), ((getMeasuredWidth() + AndroidUtilities.dp(6)) / 2) * (1 - checkProgress), eraser2);
|
||||
|
||||
canvas.drawBitmap(checkBitmap, 0, 0, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -90,7 +90,6 @@ public class Switch extends CompoundButton {
|
||||
|
||||
private ObjectAnimatorProxy mPositionAnimator;
|
||||
|
||||
@SuppressWarnings("hiding")
|
||||
private final Rect mTempRect = new Rect();
|
||||
|
||||
public Switch(Context context) {
|
||||
|
@ -137,7 +137,7 @@
|
||||
<string name="NotificationGroupKickYou">%1$s removed you from the group %2$s</string>
|
||||
<string name="NotificationGroupLeftMember">%1$s has left the group %2$s</string>
|
||||
<string name="NotificationContactJoined">%1$s joined Telegram!</string>
|
||||
<string name="NotificationUnrecognizedDevice">%1$s,\nWe detected a login into your account from a new device on %2$s\n\nDevice: %3$s\nLocation: %4$s\n\nIf this wasn\'t you, you can go to Settings - Terminate all sessions.\n\nSincerely,\nThe Telegram Team</string>
|
||||
<string name="NotificationUnrecognizedDevice">%1$s,\nWe detected a login into your account from a new device on %2$s\n\nDevice: %3$s\nLocation: %4$s\n\nIf this wasn\'t you, you can go to Settings - Privacy and Security - Terminate all other sessions.\n\nSincerely,\nThe Telegram Team</string>
|
||||
<string name="NotificationContactNewPhoto">%1$s updated profile photo</string>
|
||||
<string name="Reply">Reply</string>
|
||||
<string name="ReplyToGroup">Reply to %1$s</string>
|
||||
|
Loading…
Reference in New Issue
Block a user