mirror of
https://github.com/wrwrabbit/Partisan-Telegram-Android.git
synced 2026-05-05 15:41:02 +00:00
merge 9.0.2
This commit is contained in:
commit
e59f56848a
82 changed files with 3160 additions and 737 deletions
|
|
@ -116,6 +116,7 @@ import androidx.core.math.MathUtils;
|
|||
import androidx.core.view.ViewCompat;
|
||||
import androidx.core.widget.NestedScrollView;
|
||||
import androidx.dynamicanimation.animation.DynamicAnimation;
|
||||
import androidx.dynamicanimation.animation.FloatValueHolder;
|
||||
import androidx.dynamicanimation.animation.SpringAnimation;
|
||||
import androidx.dynamicanimation.animation.SpringForce;
|
||||
import androidx.exifinterface.media.ExifInterface;
|
||||
|
|
@ -717,7 +718,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
|||
} else {
|
||||
bulletinMessage = LocaleController.getString("LinkCopied", R.string.LinkCopied);
|
||||
}
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.S) {
|
||||
if (AndroidUtilities.shouldShowClipboardToast()) {
|
||||
BulletinFactory.of(containerView, resourcesProvider).createSimpleBulletin(R.raw.voip_invite, bulletinMessage).show();
|
||||
}
|
||||
}
|
||||
|
|
@ -1040,7 +1041,8 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
|||
private MentionsAdapter mentionsAdapter;
|
||||
private RecyclerListView mentionListView;
|
||||
private LinearLayoutManager mentionLayoutManager;
|
||||
private AnimatorSet mentionListAnimation;
|
||||
private SpringAnimation mentionListAnimation;
|
||||
private boolean mentionListViewVisible;
|
||||
private boolean allowMentions;
|
||||
|
||||
private ActionBarPopupWindow sendPopupWindow;
|
||||
|
|
@ -2444,7 +2446,8 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
|||
}
|
||||
if (child == mentionListView) {
|
||||
canvas.save();
|
||||
canvas.clipRect(child.getX(), child.getY(), child.getX() + child.getWidth(), child.getY() + child.getHeight());
|
||||
canvas.clipRect(child.getX(), child.getY(), child.getX() + child.getWidth(), captionEditText.getTop());
|
||||
canvas.drawColor(0x7f000000);
|
||||
boolean r = super.drawChild(canvas, child, drawingTime);
|
||||
canvas.restore();
|
||||
return r;
|
||||
|
|
@ -2572,6 +2575,23 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
|||
private int parentWidth;
|
||||
private int parentHeight;
|
||||
|
||||
private int lastTimeWidth;
|
||||
private FloatValueHolder timeValue = new FloatValueHolder(0);
|
||||
private SpringAnimation timeSpring = new SpringAnimation(timeValue)
|
||||
.setSpring(new SpringForce(0)
|
||||
.setStiffness(750f)
|
||||
.setDampingRatio(SpringForce.DAMPING_RATIO_NO_BOUNCY))
|
||||
.addUpdateListener((animation, value, velocity) -> {
|
||||
int extraWidth;
|
||||
if (parentWidth > parentHeight) {
|
||||
extraWidth = AndroidUtilities.dp(48);
|
||||
} else {
|
||||
extraWidth = 0;
|
||||
}
|
||||
|
||||
videoPlayerSeekbar.setSize((int) (getMeasuredWidth() - AndroidUtilities.dp(2 + 14) - value - extraWidth), getMeasuredHeight());
|
||||
});
|
||||
|
||||
public VideoPlayerControlFrameLayout(@NonNull Context context) {
|
||||
super(context);
|
||||
setWillNotDraw(false);
|
||||
|
|
@ -2590,6 +2610,14 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow();
|
||||
|
||||
timeValue.setValue(0);
|
||||
lastTimeWidth = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void requestLayout() {
|
||||
if (ignoreLayout) {
|
||||
|
|
@ -2639,7 +2667,15 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
|||
}
|
||||
|
||||
int size = (int) Math.ceil(videoPlayerTime.getPaint().measureText(String.format(Locale.ROOT, "%1$s / %1$s", durationStr)));
|
||||
videoPlayerSeekbar.setSize(getMeasuredWidth() - AndroidUtilities.dp(2 + 14) - size - extraWidth, getMeasuredHeight());
|
||||
timeSpring.cancel();
|
||||
if (lastTimeWidth != 0 && timeValue.getValue() != size) {
|
||||
timeSpring.getSpring().setFinalPosition(size);
|
||||
timeSpring.start();
|
||||
} else {
|
||||
videoPlayerSeekbar.setSize(getMeasuredWidth() - AndroidUtilities.dp(2 + 14) - size - extraWidth, getMeasuredHeight());
|
||||
timeValue.setValue(size);
|
||||
}
|
||||
lastTimeWidth = size;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -6104,6 +6140,37 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
|||
public boolean onTouchEvent(MotionEvent event) {
|
||||
return !bottomTouchEnabled && super.onTouchEvent(event);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTranslationY(float translationY) {
|
||||
super.setTranslationY(translationY);
|
||||
invalidate();
|
||||
|
||||
if (getParent() != null) {
|
||||
((View) getParent()).invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
|
||||
super.onSizeChanged(w, h, oldw, oldh);
|
||||
|
||||
if (mentionListViewVisible && getVisibility() == VISIBLE && mentionListAnimation == null) {
|
||||
setTranslationY(h - oldh);
|
||||
mentionListAnimation = new SpringAnimation(this, DynamicAnimation.TRANSLATION_Y)
|
||||
.setMinValue(Math.min(h - oldh, 0))
|
||||
.setMaxValue(Math.max(h - oldh, 0))
|
||||
.setSpring(new SpringForce(0)
|
||||
.setStiffness(750f)
|
||||
.setDampingRatio(SpringForce.DAMPING_RATIO_NO_BOUNCY));
|
||||
mentionListAnimation.addEndListener((animation, canceled, value, velocity) -> {
|
||||
if (mentionListAnimation == animation) {
|
||||
mentionListAnimation = null;
|
||||
}
|
||||
});
|
||||
mentionListAnimation.start();
|
||||
}
|
||||
}
|
||||
};
|
||||
mentionListView.setTag(5);
|
||||
mentionLayoutManager = new LinearLayoutManager(activityContext) {
|
||||
|
|
@ -6114,7 +6181,6 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
|||
};
|
||||
mentionLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
|
||||
mentionListView.setLayoutManager(mentionLayoutManager);
|
||||
mentionListView.setBackgroundColor(0x7f000000);
|
||||
mentionListView.setVisibility(View.GONE);
|
||||
mentionListView.setClipToPadding(true);
|
||||
mentionListView.setOverScrollMode(RecyclerListView.OVER_SCROLL_NEVER);
|
||||
|
|
@ -6141,29 +6207,29 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
|||
}
|
||||
|
||||
if (mentionListView.getVisibility() == View.VISIBLE) {
|
||||
mentionListView.setAlpha(1.0f);
|
||||
mentionListView.setTranslationY(0);
|
||||
return;
|
||||
} else {
|
||||
mentionLayoutManager.scrollToPositionWithOffset(0, 10000);
|
||||
}
|
||||
if (allowMentions) {
|
||||
mentionListView.setVisibility(View.VISIBLE);
|
||||
mentionListAnimation = new AnimatorSet();
|
||||
mentionListAnimation.playTogether(
|
||||
ObjectAnimator.ofFloat(mentionListView, View.ALPHA, 0.0f, 1.0f)
|
||||
);
|
||||
mentionListAnimation.addListener(new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
if (mentionListAnimation != null && mentionListAnimation.equals(animation)) {
|
||||
mentionListAnimation = null;
|
||||
}
|
||||
mentionListViewVisible = true;
|
||||
mentionListView.setTranslationY(AndroidUtilities.dp(height));
|
||||
mentionListAnimation = new SpringAnimation(mentionListView, DynamicAnimation.TRANSLATION_Y)
|
||||
.setMinValue(0)
|
||||
.setMaxValue(AndroidUtilities.dp(height))
|
||||
.setSpring(new SpringForce(0f)
|
||||
.setStiffness(750f)
|
||||
.setDampingRatio(SpringForce.DAMPING_RATIO_NO_BOUNCY));
|
||||
mentionListAnimation.addEndListener((animation, canceled, value, velocity) -> {
|
||||
if (mentionListAnimation == animation) {
|
||||
mentionListAnimation = null;
|
||||
}
|
||||
});
|
||||
mentionListAnimation.setDuration(200);
|
||||
mentionListAnimation.start();
|
||||
} else {
|
||||
mentionListView.setAlpha(1.0f);
|
||||
mentionListView.setTranslationY(0);
|
||||
mentionListView.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
} else {
|
||||
|
|
@ -6176,20 +6242,19 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
|||
return;
|
||||
}
|
||||
if (allowMentions) {
|
||||
mentionListAnimation = new AnimatorSet();
|
||||
mentionListAnimation.playTogether(
|
||||
ObjectAnimator.ofFloat(mentionListView, View.ALPHA, 0.0f)
|
||||
);
|
||||
mentionListAnimation.addListener(new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
if (mentionListAnimation != null && mentionListAnimation.equals(animation)) {
|
||||
mentionListView.setVisibility(View.GONE);
|
||||
mentionListAnimation = null;
|
||||
}
|
||||
mentionListViewVisible = false;
|
||||
mentionListAnimation = new SpringAnimation(mentionListView, DynamicAnimation.TRANSLATION_Y)
|
||||
.setMinValue(0)
|
||||
.setMaxValue(mentionListView.getMeasuredHeight())
|
||||
.setSpring(new SpringForce(mentionListView.getMeasuredHeight())
|
||||
.setStiffness(750f)
|
||||
.setDampingRatio(SpringForce.DAMPING_RATIO_NO_BOUNCY));
|
||||
mentionListAnimation.addEndListener((animation, canceled, value, velocity) -> {
|
||||
if (mentionListAnimation == animation) {
|
||||
mentionListView.setVisibility(View.GONE);
|
||||
mentionListAnimation = null;
|
||||
}
|
||||
});
|
||||
mentionListAnimation.setDuration(200);
|
||||
mentionListAnimation.start();
|
||||
} else {
|
||||
mentionListView.setVisibility(View.GONE);
|
||||
|
|
@ -8264,10 +8329,13 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
|||
}
|
||||
}
|
||||
}
|
||||
if (AndroidUtilities.displaySize.y > AndroidUtilities.displaySize.x && !(videoTextureView instanceof VideoEditTextureView) && w > h) {
|
||||
if (AndroidUtilities.displaySize.y > AndroidUtilities.displaySize.x && w > h) {
|
||||
if (fullscreenButton[b].getVisibility() != View.VISIBLE) {
|
||||
fullscreenButton[b].setVisibility(View.VISIBLE);
|
||||
}
|
||||
if (isActionBarVisible) {
|
||||
fullscreenButton[b].setAlpha(1f);
|
||||
}
|
||||
float scale = w / (float) containerView.getMeasuredWidth();
|
||||
int height = (int) (h / scale);
|
||||
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) fullscreenButton[b].getLayoutParams();
|
||||
|
|
@ -13597,6 +13665,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
|||
if (photoViewerWebView.isControllable()) {
|
||||
setVideoPlayerControlVisible(true, true);
|
||||
}
|
||||
videoPlayerSeekbar.clearTimestamps();
|
||||
updateVideoPlayerTime();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue