mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-11 18:54:21 +00:00
fix direct capture drag twitch
// FREEBIE
This commit is contained in:
parent
21c8051b02
commit
72735baa11
@ -274,7 +274,6 @@ public class QuickAttachmentDrawer extends ViewGroup {
|
|||||||
private void setDrawerState(DrawerState drawerState) {
|
private void setDrawerState(DrawerState drawerState) {
|
||||||
switch (drawerState) {
|
switch (drawerState) {
|
||||||
case COLLAPSED:
|
case COLLAPSED:
|
||||||
slideOffset = COLLAPSED_ANCHOR_POINT;
|
|
||||||
fullScreenButton.setImageResource(R.drawable.quick_camera_fullscreen);
|
fullScreenButton.setImageResource(R.drawable.quick_camera_fullscreen);
|
||||||
if (listener != null) listener.onAttachmentDrawerClosed();
|
if (listener != null) listener.onAttachmentDrawerClosed();
|
||||||
break;
|
break;
|
||||||
@ -283,15 +282,12 @@ public class QuickAttachmentDrawer extends ViewGroup {
|
|||||||
setDrawerState(DrawerState.FULL_EXPANDED);
|
setDrawerState(DrawerState.FULL_EXPANDED);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Log.w(TAG, "HALF_EXPANDED init");
|
|
||||||
quickCamera.onResume();
|
quickCamera.onResume();
|
||||||
slideOffset = halfExpandedAnchorPoint;
|
|
||||||
fullScreenButton.setImageResource(R.drawable.quick_camera_fullscreen);
|
fullScreenButton.setImageResource(R.drawable.quick_camera_fullscreen);
|
||||||
if (listener != null) listener.onAttachmentDrawerOpened();
|
if (listener != null) listener.onAttachmentDrawerOpened();
|
||||||
break;
|
break;
|
||||||
case FULL_EXPANDED:
|
case FULL_EXPANDED:
|
||||||
quickCamera.onResume();
|
quickCamera.onResume();
|
||||||
slideOffset = FULL_EXPANDED_ANCHOR_POINT;
|
|
||||||
fullScreenButton.setImageResource(isFullscreenOnly() ? R.drawable.quick_camera_hide
|
fullScreenButton.setImageResource(isFullscreenOnly() ? R.drawable.quick_camera_hide
|
||||||
: R.drawable.quick_camera_exit_fullscreen);
|
: R.drawable.quick_camera_exit_fullscreen);
|
||||||
if (listener != null) listener.onAttachmentDrawerOpened();
|
if (listener != null) listener.onAttachmentDrawerOpened();
|
||||||
@ -300,6 +296,14 @@ public class QuickAttachmentDrawer extends ViewGroup {
|
|||||||
this.drawerState = drawerState;
|
this.drawerState = drawerState;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public float getTargetSlideOffset() {
|
||||||
|
switch (drawerState) {
|
||||||
|
case FULL_EXPANDED: return FULL_EXPANDED_ANCHOR_POINT;
|
||||||
|
case HALF_EXPANDED: return halfExpandedAnchorPoint;
|
||||||
|
default: return COLLAPSED_ANCHOR_POINT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public DrawerState getDrawerState() {
|
public DrawerState getDrawerState() {
|
||||||
return drawerState;
|
return drawerState;
|
||||||
}
|
}
|
||||||
@ -308,7 +312,7 @@ public class QuickAttachmentDrawer extends ViewGroup {
|
|||||||
DrawerState oldDrawerState = this.drawerState;
|
DrawerState oldDrawerState = this.drawerState;
|
||||||
setDrawerState(requestedDrawerState);
|
setDrawerState(requestedDrawerState);
|
||||||
if (oldDrawerState != drawerState) {
|
if (oldDrawerState != drawerState) {
|
||||||
slideTo(slideOffset);
|
slideTo(getTargetSlideOffset());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -333,6 +337,7 @@ public class QuickAttachmentDrawer extends ViewGroup {
|
|||||||
public void onViewDragStateChanged(int state) {
|
public void onViewDragStateChanged(int state) {
|
||||||
if (dragHelper.getViewDragState() == ViewDragHelper.STATE_IDLE) {
|
if (dragHelper.getViewDragState() == ViewDragHelper.STATE_IDLE) {
|
||||||
setDrawerState(drawerState);
|
setDrawerState(drawerState);
|
||||||
|
slideOffset = getTargetSlideOffset();
|
||||||
requestLayout();
|
requestLayout();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -374,6 +379,7 @@ public class QuickAttachmentDrawer extends ViewGroup {
|
|||||||
}
|
}
|
||||||
|
|
||||||
setDrawerState(drawerState);
|
setDrawerState(drawerState);
|
||||||
|
float slideOffset = getTargetSlideOffset();
|
||||||
dragHelper.captureChildView(coverView, 0);
|
dragHelper.captureChildView(coverView, 0);
|
||||||
Log.w(TAG, String.format("setting cover at %d", computeCoverBottomPosition(slideOffset) - coverView.getHeight()));
|
Log.w(TAG, String.format("setting cover at %d", computeCoverBottomPosition(slideOffset) - coverView.getHeight()));
|
||||||
dragHelper.settleCapturedViewAt(coverView.getLeft(), computeCoverBottomPosition(slideOffset) - coverView.getHeight());
|
dragHelper.settleCapturedViewAt(coverView.getLeft(), computeCoverBottomPosition(slideOffset) - coverView.getHeight());
|
||||||
|
Loading…
Reference in New Issue
Block a user