// Path: app/src/main/java/com/fastaccess/ui/modules/floating/BaseFloatingPresenter.java
// public class BaseFloatingPresenter<M, V extends BaseFloatingMvp.BaseView<M>> extends BasePresenter<V> implements BaseFloatingMvp.BasePresenter<M, V> {
// 
//     private final TimeInterpolator moveEdgeInterpolator = new AccelerateInterpolator();
// 
//     protected BaseFloatingPresenter(@NonNull V view) {
//         super(view);
//     }
// 
//     @Override public void onViewMoving(int x, int y) {
//         if (isAttached()) getView().onViewMoving(x, y);
//     }
// 
//     @Override public void onSingleTapped() {
//         if (isAttached()) getView().onSingleTapped();
//     }
// 
//     @Override public void onDoubleTapped() {
//         if (isAttached()) getView().onDoubleTapped();
//     }
// 
//     @Override public void onLongPressed() {
//         if (isAttached()) getView().onLongPressed();
//     }
// 
//     @Override public void onSwipe(int swipeDirection) {}//Op-out
// 
//     @Override public void onBackPressed() {
//         onTouchOutside();
//     }
// 
//     @Override public void onTouchOutside() {
//         if (isAttached()) getView().onTouchedOutside();
//     }
// 
//     @Override public void onStoppedMoving() {
//         if (isAttached()) getView().onStoppedMoving();
//     }
// 
//     @Override public void onConfigChanged(int orientation) {
//         if (isAttached()) getView().onConfigChanged(orientation);
//     }
// 
//     @Override public void onItemClick(int position, View v, M item) {
//         if (isAttached()) getView().onTouchedOutside();
//     }
// 
//     @Override public void onItemLongClick(int position, View v, M item) {
//         onItemClick(position, v, item);
//     }
// 
//     @Override public void onUpdateWindowParams(@NonNull WindowManager windowManager,
//                                                @NonNull WindowManager.LayoutParams originalParams,
//                                                @NonNull FloatingView floatingView,
//                                                int x, int y) {
//         originalParams.x = x;
//         originalParams.y = y;
//         windowManager.updateViewLayout(floatingView, originalParams);
//     }
// 
//     @Override public void onToggleVisibility(final boolean showFloating, @NonNull final WindowManager windowManager,
//                                              @NonNull final WindowManager.LayoutParams originalParams, @NonNull final View view,
//                                              @NonNull final FloatingView floatingView, final boolean isHorizontal) {
//         if (showFloating) {
//             AnimHelper.animateVisibility(view, false, new AnimHelper.AnimationCallback() {
//                 @Override public void onAnimationStart() {}
// 
//                 @Override public void onAnimationEnd() {
//                     if (!isAttached()) return;
//                     getView().setupParamsSize();
//                     AnimHelper.animateVisibility(floatingView, true);
//                 }
//             });
//         } else {
//             AnimHelper.animateVisibility(floatingView, false, new AnimHelper.AnimationCallback() {
//                 @Override public void onAnimationEnd() {
//                     AnimHelper.animateVisibility(view, true, new AnimHelper.AnimationCallback() {
//                         @Override public void onAnimationEnd() {}
// 
//                         @Override public void onAnimationStart() {
//                             if (!isAttached()) return;
//                             if (isHorizontal) {
//                                 final DynamicRecyclerView recycler = (DynamicRecyclerView) view.findViewById(R.id.recycler);
//                                 originalParams.width = ViewHelper.getWidthFromRecyclerView(recycler, windowManager);
//                             }
//                             windowManager.updateViewLayout(view, originalParams);
//                         }
//                     });
//                 }
// 
//                 @Override public void onAnimationStart() {}
//             });
//         }
//     }
// 
//     @Override public void onMoveToEdge(@NonNull final WindowManager windowManager, @NonNull final WindowManager.LayoutParams originalParams,
//                                        @NonNull final FloatingView floatingView, @NonNull Point szWindow) {
//         if (!PrefHelper.getBoolean(PrefConstant.FA_EDGES_STICKY)) return;
//         int w = originalParams.width;
//         final boolean isMoveRightEdge = originalParams.x + w / 2 <= szWindow.x / 2;
//         final int goalPositionX = isMoveRightEdge ? 0 : szWindow.x - w;
//         Logger.e(originalParams.x, goalPositionX, isMoveRightEdge);
//         if (!isAttached() || !floatingView.isShown()) return;
//         ValueAnimator mMoveEdgeAnimator = ValueAnimator.ofInt(originalParams.x, goalPositionX);
//         mMoveEdgeAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
//             @Override public void onAnimationUpdate(ValueAnimator animation) {
//                 if (!isAttached() || !floatingView.isShown()) return;
//                 originalParams.x = (Integer) animation.getAnimatedValue();
//                 windowManager.updateViewLayout(floatingView, originalParams);
//                 getView().onUpdateXY();
//             }
//         });
//         mMoveEdgeAnimator.setDuration(200L);
//         mMoveEdgeAnimator.setInterpolator(moveEdgeInterpolator);
//         mMoveEdgeAnimator.start();
//     }
// 
//     @Override public void onLoadComplete(Loader<List<M>> loader, List<M> data) {
//         if (isAttached()) getView().onLoaderLoaded(data);
//     }
// }


import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.support.annotation.NonNull;
import android.view.View;
import com.fastaccess.data.dao.AppsModel;
import com.fastaccess.ui.modules.floating.BaseFloatingMvp;
import com.fastaccess.ui.modules.floating.BaseFloatingPresenter;
package com.fastaccess.ui.modules.floating.apps;



/**
 * Created by Kosh on 14 Oct 2016, 9:00 PM
 */

public class FloatingVHPresenter extends BaseFloatingPresenter<AppsModel, BaseFloatingMvp.BaseView<AppsModel>> implements FloatingHVMvp.Presenter {


    public FloatingVHPresenter(@NonNull BaseFloatingMvp.BaseView<AppsModel> view) {
// Path: app/src/main/java/com/fastaccess/ui/modules/floating/BaseFloatingPresenter.java
// public class BaseFloatingPresenter<M, V extends BaseFloatingMvp.BaseView<M>> extends BasePresenter<V> implements BaseFloatingMvp.BasePresenter<M, V> {
// 
//     private final TimeInterpolator moveEdgeInterpolator = new AccelerateInterpolator();
// 
//     protected BaseFloatingPresenter(@NonNull V view) {
//         super(view);
//     }
// 
//     @Override public void onViewMoving(int x, int y) {
//         if (isAttached()) getView().onViewMoving(x, y);
//     }
// 
//     @Override public void onSingleTapped() {
//         if (isAttached()) getView().onSingleTapped();
//     }
// 
//     @Override public void onDoubleTapped() {
//         if (isAttached()) getView().onDoubleTapped();
//     }
// 
//     @Override public void onLongPressed() {
//         if (isAttached()) getView().onLongPressed();
//     }
// 
//     @Override public void onSwipe(int swipeDirection) {}//Op-out
// 
//     @Override public void onBackPressed() {
//         onTouchOutside();
//     }
// 
//     @Override public void onTouchOutside() {
//         if (isAttached()) getView().onTouchedOutside();
//     }
// 
//     @Override public void onStoppedMoving() {
//         if (isAttached()) getView().onStoppedMoving();
//     }
// 
//     @Override public void onConfigChanged(int orientation) {
//         if (isAttached()) getView().onConfigChanged(orientation);
//     }
// 
//     @Override public void onItemClick(int position, View v, M item) {
//         if (isAttached()) getView().onTouchedOutside();
//     }
// 
//     @Override public void onItemLongClick(int position, View v, M item) {
//         onItemClick(position, v, item);
//     }
// 
//     @Override public void onUpdateWindowParams(@NonNull WindowManager windowManager,
//                                                @NonNull WindowManager.LayoutParams originalParams,
//                                                @NonNull FloatingView floatingView,
//                                                int x, int y) {
//         originalParams.x = x;
//         originalParams.y = y;
//         windowManager.updateViewLayout(floatingView, originalParams);
//     }
// 
//     @Override public void onToggleVisibility(final boolean showFloating, @NonNull final WindowManager windowManager,
//                                              @NonNull final WindowManager.LayoutParams originalParams, @NonNull final View view,
//                                              @NonNull final FloatingView floatingView, final boolean isHorizontal) {
//         if (showFloating) {
//             AnimHelper.animateVisibility(view, false, new AnimHelper.AnimationCallback() {
//                 @Override public void onAnimationStart() {}
// 
//                 @Override public void onAnimationEnd() {
//                     if (!isAttached()) return;
//                     getView().setupParamsSize();
//                     AnimHelper.animateVisibility(floatingView, true);
//                 }
//             });
//         } else {
//             AnimHelper.animateVisibility(floatingView, false, new AnimHelper.AnimationCallback() {
//                 @Override public void onAnimationEnd() {
//                     AnimHelper.animateVisibility(view, true, new AnimHelper.AnimationCallback() {
//                         @Override public void onAnimationEnd() {}
// 
//                         @Override public void onAnimationStart() {
//                             if (!isAttached()) return;
//                             if (isHorizontal) {
//                                 final DynamicRecyclerView recycler = (DynamicRecyclerView) view.findViewById(R.id.recycler);
//                                 originalParams.width = ViewHelper.getWidthFromRecyclerView(recycler, windowManager);
//                             }
//                             windowManager.updateViewLayout(view, originalParams);
//                         }
//                     });
//                 }
// 
//                 @Override public void onAnimationStart() {}
//             });
//         }
//     }
// 
//     @Override public void onMoveToEdge(@NonNull final WindowManager windowManager, @NonNull final WindowManager.LayoutParams originalParams,
//                                        @NonNull final FloatingView floatingView, @NonNull Point szWindow) {
//         if (!PrefHelper.getBoolean(PrefConstant.FA_EDGES_STICKY)) return;
//         int w = originalParams.width;
//         final boolean isMoveRightEdge = originalParams.x + w / 2 <= szWindow.x / 2;
//         final int goalPositionX = isMoveRightEdge ? 0 : szWindow.x - w;
//         Logger.e(originalParams.x, goalPositionX, isMoveRightEdge);
//         if (!isAttached() || !floatingView.isShown()) return;
//         ValueAnimator mMoveEdgeAnimator = ValueAnimator.ofInt(originalParams.x, goalPositionX);
//         mMoveEdgeAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
//             @Override public void onAnimationUpdate(ValueAnimator animation) {
//                 if (!isAttached() || !floatingView.isShown()) return;
//                 originalParams.x = (Integer) animation.getAnimatedValue();
//                 windowManager.updateViewLayout(floatingView, originalParams);
//                 getView().onUpdateXY();
//             }
//         });
//         mMoveEdgeAnimator.setDuration(200L);
//         mMoveEdgeAnimator.setInterpolator(moveEdgeInterpolator);
//         mMoveEdgeAnimator.start();
//     }
// 
//     @Override public void onLoadComplete(Loader<List<M>> loader, List<M> data) {
//         if (isAttached()) getView().onLoaderLoaded(data);
//     }
// }


// Path: app/src/main/java/com/fastaccess/ui/modules/floating/apps/FloatingVHPresenter.java
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.support.annotation.NonNull;
import android.view.View;
import com.fastaccess.data.dao.AppsModel;
import com.fastaccess.ui.modules.floating.BaseFloatingMvp;
import com.fastaccess.ui.modules.floating.BaseFloatingPresenter;

package com.fastaccess.ui.modules.floating.apps;



/**
 * Created by Kosh on 14 Oct 2016, 9:00 PM
 */

public class FloatingVHPresenter extends BaseFloatingPresenter<AppsModel, BaseFloatingMvp.BaseView<AppsModel>> implements FloatingHVMvp.Presenter {


    public FloatingVHPresenter(@NonNull BaseFloatingMvp.BaseView<AppsModel> view) {
        super(view);