Skip to content
This repository was archived by the owner on Feb 9, 2023. It is now read-only.
Merged
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
9 changes: 9 additions & 0 deletions hover/src/main/java/io/mattcarroll/hover/HoverView.java
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ public static HoverView createForView(@NonNull Context context) {
OnExitListener mOnExitListener;
private final Set<OnStateChangeListener> mOnStateChangeListeners = new CopyOnWriteArraySet<>();
private final Set<OnInteractionListener> mOnInteractionListeners = new CopyOnWriteArraySet<>();
private boolean mKeepVisible;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

기본값은 false인가요?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

네 기본값은 false 입니다.


// Public for use with XML inflation. Clients should use static methods for construction.
public HoverView(@NonNull Context context, @Nullable AttributeSet attrs) {
Expand Down Expand Up @@ -347,6 +348,14 @@ public void run() {
});
}

public void setKeepVisible(boolean keepVisible) {
this.mKeepVisible = keepVisible;
}

public boolean shouldKeepVisible() {
return mKeepVisible;
}

public void setOnExitListener(@Nullable OnExitListener listener) {
mOnExitListener = listener;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class HoverViewStateCollapsed extends BaseHoverViewState {
private static final float MIN_TAB_VERTICAL_POSITION = 0.0f;
private static final float MAX_TAB_VERTICAL_POSITION = 1.0f;
private static final long ALPHA_IDLE_MILLIS = 5000;
private static final float ALPHA_IDLE_VALUE = 0.4f;

protected FloatingTab mFloatingTab;
protected final Dragger.DragListener mDragListener = new FloatingTabDragListener(this);
Expand All @@ -56,7 +57,11 @@ class HoverViewStateCollapsed extends BaseHoverViewState {
public void run() {
final HoverViewState state = mHoverView.getState();
if (!(state instanceof HoverViewStatePreviewed) && state instanceof HoverViewStateCollapsed) {
mHoverView.setAlpha(0.4f);
if (mHoverView.shouldKeepVisible()) {
mHoverView.setAlpha(ALPHA_IDLE_VALUE);
} else {
mHoverView.close();
}
}
}
};
Expand Down