diff options
author | Stefan Niedermann <info@niedermann.it> | 2020-04-03 18:25:50 +0300 |
---|---|---|
committer | Stefan Niedermann <info@niedermann.it> | 2020-04-03 18:25:50 +0300 |
commit | 772f40a570f0a51068c2cd7c6339b994849a1678 (patch) | |
tree | 33cdde8c412531d14a36574e6c98bf12164b5874 /app/src/main/java/it/niedermann/nextcloud/deck/ui/helper/dnd/CrossTabDragAndDrop.java | |
parent | 556bbd17c08e91441fa5594394ff4b62b2e7bbac (diff) |
#333 Refactor drawer and main and use viewpager2
Change parameters for DnD
Signed-off-by: Stefan Niedermann <info@niedermann.it>
Diffstat (limited to 'app/src/main/java/it/niedermann/nextcloud/deck/ui/helper/dnd/CrossTabDragAndDrop.java')
-rw-r--r-- | app/src/main/java/it/niedermann/nextcloud/deck/ui/helper/dnd/CrossTabDragAndDrop.java | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/app/src/main/java/it/niedermann/nextcloud/deck/ui/helper/dnd/CrossTabDragAndDrop.java b/app/src/main/java/it/niedermann/nextcloud/deck/ui/helper/dnd/CrossTabDragAndDrop.java index 26af567bc..140be20bc 100644 --- a/app/src/main/java/it/niedermann/nextcloud/deck/ui/helper/dnd/CrossTabDragAndDrop.java +++ b/app/src/main/java/it/niedermann/nextcloud/deck/ui/helper/dnd/CrossTabDragAndDrop.java @@ -1,8 +1,6 @@ package it.niedermann.nextcloud.deck.ui.helper.dnd; -import android.content.Context; import android.content.res.Resources; -import android.util.DisplayMetrics; import android.util.Log; import android.view.DragEvent; import android.view.View; @@ -33,21 +31,19 @@ public class CrossTabDragAndDrop< private final float pxToReact; private final float pxToReactTopBottom; - private final float dragAndDropMsToReact; - private final float dragAndDropMsToReactTopBottom; + private final int dragAndDropMsToReact; + private final int dragAndDropMsToReactTopBottom; private final int displayX; private long lastSwap = 0; private long lastMove = 0; private final Set<ItemMovedByDragListener<ItemModel>> moveListenerList = new HashSet<>(1); - public CrossTabDragAndDrop(@NonNull Context context) { - final Resources resources = context.getResources(); - final DisplayMetrics metrics = resources.getDisplayMetrics(); - - this.pxToReact = context.getResources().getInteger(R.integer.drag_n_drop_dp_to_react) * metrics.density; - this.pxToReactTopBottom = context.getResources().getInteger(R.integer.drag_n_drop_dp_to_react_top_bottom) * metrics.density; - this.displayX = metrics.widthPixels; + public CrossTabDragAndDrop(@NonNull Resources resources) { + this.displayX = resources.getDisplayMetrics().widthPixels; + final float density = resources.getDisplayMetrics().density; + this.pxToReact = resources.getInteger(R.integer.drag_n_drop_dp_to_react) * density; + this.pxToReactTopBottom = resources.getInteger(R.integer.drag_n_drop_dp_to_react_top_bottom) * density; this.dragAndDropMsToReact = resources.getInteger(R.integer.drag_n_drop_ms_to_react); this.dragAndDropMsToReactTopBottom = resources.getInteger(R.integer.drag_n_drop_dp_to_react_top_bottom); } |