Make chat preview scrollable
* crutch Co-Authored-By: Laky64 <35636667+Laky-64@users.noreply.github.com>
This commit is contained in:
@@ -14,6 +14,8 @@ public class ExteraConfig {
|
||||
|
||||
private static final Object sync = new Object();
|
||||
|
||||
public static boolean scrollablePreview;
|
||||
|
||||
public static boolean useSystemFonts;
|
||||
public static boolean disableVibration;
|
||||
public static boolean blurForAllThemes;
|
||||
@@ -68,6 +70,8 @@ public class ExteraConfig {
|
||||
|
||||
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("exteraconfig", Activity.MODE_PRIVATE);
|
||||
|
||||
scrollablePreview = preferences.getBoolean("scrollablePreview", true);
|
||||
|
||||
useSystemFonts = preferences.getBoolean("useSystemFonts", false);
|
||||
disableVibration = preferences.getBoolean("disableVibration", false);
|
||||
blurForAllThemes = preferences.getBoolean("blurForAllThemes", true);
|
||||
|
||||
@@ -83,6 +83,7 @@ public class ActionBarLayout extends FrameLayout {
|
||||
|
||||
public LayoutContainer(Context context) {
|
||||
super(context);
|
||||
setClickable(true);
|
||||
setWillNotDraw(false);
|
||||
}
|
||||
|
||||
@@ -188,11 +189,34 @@ public class ActionBarLayout extends FrameLayout {
|
||||
|
||||
@Override
|
||||
public boolean dispatchTouchEvent(MotionEvent ev) {
|
||||
boolean passivePreview = inPreviewMode && previewMenu == null;
|
||||
boolean previewModeStatus = !ExteraConfig.scrollablePreview && inPreviewMode;
|
||||
boolean passivePreview = previewModeStatus && previewMenu == null;
|
||||
|
||||
if ((passivePreview || transitionAnimationPreviewMode) && (ev.getActionMasked() == MotionEvent.ACTION_DOWN || ev.getActionMasked() == MotionEvent.ACTION_POINTER_DOWN)) {
|
||||
return false;
|
||||
}
|
||||
//
|
||||
|
||||
if (!ExteraConfig.scrollablePreview && inPreviewMode && previewMenu == null) {
|
||||
View view = containerView.getChildAt(0);
|
||||
if (view != null) {
|
||||
int y = (int) (view.getTop() + containerView.getTranslationY());
|
||||
y += AndroidUtilities.dp(24);
|
||||
if (ev.getY() <= y && ev.getAction() == MotionEvent.ACTION_DOWN) {
|
||||
movePreviewFragment(AndroidUtilities.dp(65));
|
||||
}
|
||||
boolean isValidTouch = ev.getX() >= AndroidUtilities.dp(8);
|
||||
isValidTouch &= ev.getX() <= view.getRight() - AndroidUtilities.dp(8);
|
||||
isValidTouch &= ev.getY() <= view.getBottom();
|
||||
isValidTouch &= ev.getY() >= y + AndroidUtilities.dp(70);
|
||||
if (!isValidTouch) {
|
||||
if (ev.getY() > view.getBottom() && ev.getAction() == MotionEvent.ACTION_DOWN) {
|
||||
finishPreviewFragment();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
return (!passivePreview || this != containerView) && super.dispatchTouchEvent(ev);
|
||||
} catch (Throwable e) {
|
||||
|
||||
Reference in New Issue
Block a user