Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ public void onActoinDown(float x, float y) {
this.x = x;
this.y = y;
isMovementStart = false;
currentPercent = getMinMaxValue(currentPercent + lastPercent);
updateCurrentValue();
}

public void onActionUp() {
Expand All @@ -400,15 +400,15 @@ public boolean onActionMove(final MotionEvent event) {
float dx = Math.abs(x - event.getX());

if ((isMovementStart || dy > Dips.DP_25) && event.getPointerCount() == 1 && x < BRIGHTNESS_WIDTH && dy > dx) {
isMovementStart = true;

if (y < Dips.screenHeight() / 3 || y > Dips.screenHeight() - Dips.screenHeight() / 3) {
lastPercent = (int) (yDiff * 100 / MIN);
float plus;
if (!isMovementStart) { // On first call update y and enable isMovementStart and do not change brightness.
this.y = event.getY();
plus = currentPercent;
} else {
lastPercent = (int) (yDiff * 100 / MAX);
lastPercent = (int) (yDiff * 100 / MIN);
plus = getMinMaxValue(lastPercent + currentPercent);
}

float plus = getMinMaxValue(lastPercent + currentPercent);
isMovementStart = true;
EventBus.getDefault().post(new MessegeBrightness((int) plus));
}
return isMovementStart;
Expand Down
8 changes: 3 additions & 5 deletions app/src/main/java/com/foobnix/sys/AdvGuestureDetector.java
Original file line number Diff line number Diff line change
Expand Up @@ -300,14 +300,12 @@ public boolean onScroll(final MotionEvent e1, final MotionEvent e2, final float
if (docCtrl.checkReadingTimer()) {
return true;
}

final float x = distanceX, y = distanceY;
d1 += x;
d2 += y;

if (brightnessHelper.onActionMove(e2)) {
return true;
}
final float x = distanceX, y = distanceY;
d1 += x;
d2 += y;

long delta = System.currentTimeMillis() - t;
long value = AppSP.get().isLocked ? 5 : 10;
Expand Down