Skip to content

Commit

Permalink
fixed folder apps drawer hidden animation where the view might flicker
Browse files Browse the repository at this point in the history
  • Loading branch information
Kosh committed Nov 9, 2016
1 parent 45257e2 commit 56a0dae
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 17 deletions.
3 changes: 3 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,9 @@
<meta-data
android:name="DOMAIN_PACKAGE_NAME"
android:value="com.fastaccess.data.dao"/>
<meta-data
android:name="com.google.firebase.messaging.default_notification_icon"
android:resource="@drawable/ic_fa_notification"/>
</application>

</manifest>
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
package com.fastaccess.ui.adapter.viewholder;

import android.support.annotation.ColorInt;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.ActivityCompat;
import android.support.v7.widget.CardView;
import android.view.View;
import android.widget.ImageView;
Expand All @@ -16,6 +14,7 @@
import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder;
import com.fastaccess.ui.widgets.recyclerview.touch.ItemTouchHelperViewHolder;

import butterknife.BindColor;
import butterknife.BindView;

/**
Expand All @@ -25,15 +24,13 @@
public class DeviceAppsViewHolder extends BaseViewHolder<AppsModel> implements ItemTouchHelperViewHolder {
@BindView(R.id.appIcon) ImageView appIcon;
@BindView(R.id.cardView) CardView cardView;
@ColorInt private final int selectedColor;
@ColorInt private final int normalColor;
@BindColor(R.color.light_gray) int selectedColor;
@BindColor(R.color.cardview_light_background) int normalColor;
private boolean selected;
private boolean selectedApps;

public DeviceAppsViewHolder(@NonNull View itemView, @Nullable BaseRecyclerAdapter adapter) {
super(itemView, adapter);
selectedColor = ActivityCompat.getColor(itemView.getContext(), R.color.light_gray);
normalColor = ActivityCompat.getColor(itemView.getContext(), R.color.cardview_light_background);
appIcon.setOnClickListener(this);
appIcon.setOnLongClickListener(this);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ private void updateParams(int orientation, boolean update) {
Logger.e(isFinishing);
if (windowManager != null && !isFinishing) {
if (drawerHolder != null && drawerHolder.appDrawer.isShown()) {
drawerHolder.appDrawer.animate().scaleY(0).scaleX(0).withStartAction(startActionRunnable).withEndAction(endActionRunnable);
drawerHolder.appDrawer.animate().alpha(0).scaleY(0).scaleX(0).withStartAction(startActionRunnable).withEndAction(endActionRunnable);
}
}
}
Expand All @@ -138,6 +138,7 @@ private FloatingDrawPresenter getPresenter() {

private Runnable endActionRunnable = new Runnable() {
@Override public void run() {
drawerHolder.appDrawer.setVisibility(View.GONE);
windowManager.removeView(drawerHolder.appDrawer);
drawerHolder.onDestroy();
if (appsLoader != null) appsLoader.unregisterListener(getPresenter());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.net.Uri;
import android.support.annotation.NonNull;
import android.support.v4.graphics.drawable.RoundedBitmapDrawable;
import android.support.v4.graphics.drawable.RoundedBitmapDrawableFactory;
import android.view.KeyEvent;
Expand Down Expand Up @@ -38,7 +39,7 @@ public class FloatingView extends RevealFrameLayout implements TouchTypeDetector
private ImageView imageView;
private FloatingTouchCallback callback;

public FloatingView(Context context, FloatingTouchCallback callback) {
public FloatingView(@NonNull Context context, @NonNull FloatingTouchCallback callback) {
super(context);
this.callback = callback;
imageView = new ImageView(context);
Expand Down Expand Up @@ -67,33 +68,33 @@ public FloatingView(Context context, FloatingTouchCallback callback) {
@Override public void onThreeFingerSingleTap() {}//op-out

@Override public void onDoubleTap() {
callback.onDoubleTapped();
if (callback != null) callback.onDoubleTapped();
}

@Override public void onScroll(int scrollDirection) {}//op-out

@Override public void onSingleTap() {
callback.onSingleTapped();
if (callback != null) callback.onSingleTapped();
}

@Override public void onSwipe(int swipeDirection) {
callback.onSwipe(swipeDirection);
if (callback != null) callback.onSwipe(swipeDirection);
}

@Override public void onLongPress() {
callback.onLongPressed();
if (callback != null) callback.onLongPressed();
}

@Override public boolean dispatchKeyEvent(KeyEvent event) {
if (event.getKeyCode() == KeyEvent.KEYCODE_BACK) {
callback.onBackPressed();
if (callback != null) callback.onBackPressed();
}
return super.dispatchKeyEvent(event);
}

@Override protected void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
callback.onConfigChanged(newConfig.orientation);
if (callback != null) callback.onConfigChanged(newConfig.orientation);
}

@Override public boolean onTouch(View view, MotionEvent event) {
Expand All @@ -105,17 +106,18 @@ public FloatingView(Context context, FloatingTouchCallback callback) {
break;
case MotionEvent.ACTION_UP:
setClickable(true);
callback.onStoppedMoving();
if (callback != null) callback.onStoppedMoving();
onMoving(false);
imageView.setPressed(false);
break;
case MotionEvent.ACTION_MOVE:
setClickable(false);
onMoving(true);
callback.onViewMoving(initialX + (int) (event.getRawX() - initialTouchX), initialY + (int) (event.getRawY() - initialTouchY));
if (callback != null)
callback.onViewMoving(initialX + (int) (event.getRawX() - initialTouchX), initialY + (int) (event.getRawY() - initialTouchY));
break;
case MotionEvent.ACTION_OUTSIDE:
callback.onTouchOutside();
if (callback != null) callback.onTouchOutside();
imageView.setPressed(false);
break;
}
Expand Down

0 comments on commit 56a0dae

Please sign in to comment.