Skip to content
This repository has been archived by the owner on Jul 24, 2023. It is now read-only.

Commit

Permalink
Merge remote-tracking branches 'msfjarvis/multiple_accounts' and 'msf…
Browse files Browse the repository at this point in the history
…jarvis/swipe-gesture-icon-position' into features

* msfjarvis/multiple_accounts: (24 commits)
  Adds multiple accounts support
  Prepare next version
  Update changelog for 0.9.1 (Tunous#198)
  Force logout all users (Tunous#196)
  Handle exceptions while opening a browser (Tunous#108) (Tunous#193)
  Prevent selection of negative ranges in SelectionLimitingTextView (fixes Tunous#190) (Tunous#194)
  Prepare next version
  Release 0.9.0 (Tunous#184)
  Release workflow (Tunous#185)
  Fix image loading issues due to http urls (Tunous#183)
  Selftext selection (Tunous#178)
  Submission title selection (Tunous#182)
  Update changelog with missed changes
  Wrap comment byline when it is too long to fit in one line (Tunous#145)
  Revert "Run Debug workflow only on push"
  Upgrade to Gradle 6.3 and add checksum field for F-Droid (Tunous#180)
  Run Debug workflow only on push
  Upgrade Gradle to 6.2.1 (Tunous#152)
  Use GitHub Actions (#72)
  Switch to on-device link unfurler (Tunous#138)
  ...

* msfjarvis/swipe-gesture-icon-position: (26 commits)
  Return false to keep the touch flow going
  Make the gestures' icons follow touch event position on Y
  Swipe Actions' icons at same level as touch event
  Prepare next version
  Update changelog for 0.9.1 (Tunous#198)
  Force logout all users (Tunous#196)
  Handle exceptions while opening a browser (Tunous#108) (Tunous#193)
  Prevent selection of negative ranges in SelectionLimitingTextView (fixes Tunous#190) (Tunous#194)
  Prepare next version
  Release 0.9.0 (Tunous#184)
  Release workflow (Tunous#185)
  Fix image loading issues due to http urls (Tunous#183)
  Selftext selection (Tunous#178)
  Submission title selection (Tunous#182)
  Update changelog with missed changes
  Wrap comment byline when it is too long to fit in one line (Tunous#145)
  Revert "Run Debug workflow only on push"
  Upgrade to Gradle 6.3 and add checksum field for F-Droid (Tunous#180)
  Run Debug workflow only on push
  Upgrade Gradle to 6.2.1 (Tunous#152)
  ...
  • Loading branch information
msfjarvis committed Aug 5, 2020
2 parents 5c99191 + dcf38b5 commit c3eab12
Showing 1 changed file with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@
import android.graphics.drawable.Drawable;
import android.graphics.drawable.LayerDrawable;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.FrameLayout;

import androidx.annotation.ColorInt;
import androidx.annotation.IntRange;
Expand Down Expand Up @@ -134,6 +135,16 @@ protected void dispatchDraw(Canvas canvas) {

// ======== SWIPE ======== //

int valueY = 0;

@Override
public boolean onInterceptTouchEvent(MotionEvent event) {
if(event.getAction() == MotionEvent.ACTION_DOWN || event.getAction() == MotionEvent.ACTION_UP || event.getAction() == MotionEvent.ACTION_MOVE){
valueY = (int)event.getY();
}
return false;
}

public void setSwipeTranslation(float translationX) {
if (!isLaidOut()) {
Timber.w("SwipeableLayout hasn't been measured yet!");
Expand Down Expand Up @@ -162,6 +173,12 @@ public void setSwipeTranslation(float translationX) {
swipeActionTriggerDrawable.setBounds((int) translationX, 0, (int) (getWidth() + translationX), getHeight());

// Move the icon along with the View being swiped.
if (valueY > (actionIconView.getHeight() / 2)) {
actionIconView.setY(valueY - (actionIconView.getHeight() / 2));
} else {
actionIconView.setY(valueY);
}

if (swipingFromEndToStart) {
actionIconView.setTranslationX(swipeableChild.getRight() + translationX);
} else {
Expand Down

0 comments on commit c3eab12

Please sign in to comment.