use of android.support.v4.view.GestureDetectorCompat in project vlc-android by GeoffreyMetais.
the class PopupManager method showPopup.
public void showPopup() {
mService.addCallback(this);
LayoutInflater li = (LayoutInflater) VLCApplication.getAppContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
mRootView = (PopupLayout) li.inflate(R.layout.video_popup, null);
if (mAlwaysOn)
mRootView.setKeepScreenOn(true);
mPlayPauseButton = mRootView.findViewById(R.id.video_play_pause);
mCloseButton = mRootView.findViewById(R.id.popup_close);
mExpandButton = mRootView.findViewById(R.id.popup_expand);
mPlayPauseButton.setOnClickListener(this);
mCloseButton.setOnClickListener(this);
mExpandButton.setOnClickListener(this);
GestureDetectorCompat gestureDetector = new GestureDetectorCompat(mService, this);
gestureDetector.setOnDoubleTapListener(this);
mRootView.setGestureDetector(gestureDetector);
final IVLCVout vlcVout = mService.getVLCVout();
vlcVout.setVideoView((SurfaceView) mRootView.findViewById(R.id.player_surface));
vlcVout.addCallback(this);
vlcVout.attachViews(this);
mRootView.setVLCVOut(vlcVout);
}
use of android.support.v4.view.GestureDetectorCompat in project BaseProject by feer921.
the class SimpleClickListener method onInterceptTouchEvent.
@Override
public boolean onInterceptTouchEvent(RecyclerView rv, MotionEvent e) {
if (recyclerView == null) {
this.recyclerView = rv;
this.baseQuickAdapter = (BaseQuickAdapter) recyclerView.getAdapter();
mGestureDetector = new GestureDetectorCompat(recyclerView.getContext(), new ItemTouchHelperGestureListener(recyclerView));
} else if (recyclerView != rv) {
this.recyclerView = rv;
this.baseQuickAdapter = (BaseQuickAdapter) recyclerView.getAdapter();
mGestureDetector = new GestureDetectorCompat(recyclerView.getContext(), new ItemTouchHelperGestureListener(recyclerView));
}
if (!mGestureDetector.onTouchEvent(e) && e.getActionMasked() == MotionEvent.ACTION_UP && mIsShowPress) {
if (mPressedView != null) {
BaseViewHolder vh = (BaseViewHolder) recyclerView.getChildViewHolder(mPressedView);
if (vh == null || !isHeaderOrFooterView(vh.getItemViewType())) {
mPressedView.setPressed(false);
}
}
mIsShowPress = false;
mIsPrepressed = false;
}
return false;
}
use of android.support.v4.view.GestureDetectorCompat in project Reader by TheKeeperOfPie.
the class ActivityMain method inflateNavigationDrawer.
private void inflateNavigationDrawer() {
// TODO: Adhere to guidelines by making the increment 56dp on mobile and 64dp on tablet
float standardIncrement = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 56, getResources().getDisplayMetrics());
float screenWidth = getResources().getDisplayMetrics().widthPixels;
float navigationWidth = screenWidth - UtilsTheme.getAttributeDimension(this, R.attr.actionBarSize, standardIncrement);
if (navigationWidth > standardIncrement * 6) {
navigationWidth = standardIncrement * 6;
}
layoutNavigation.getLayoutParams().width = (int) navigationWidth;
textAccountName.setTextColor(colorFilterPrimary.getColor());
textAccountInfo.setTextColor(colorFilterPrimary.getColor());
buttonAccounts.setColorFilter(colorFilterPrimary);
View.OnClickListener onClickListener = v -> setAccountsVisible(!accountsVisible);
textAccountName.setOnClickListener(onClickListener);
textAccountInfo.setOnClickListener(onClickListener);
buttonAccounts.setOnClickListener(onClickListener);
adapterAccounts = new AccountsAdapter(colorFilterPrimary.getColor(), this);
recyclerAccounts.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
recyclerAccounts.setAdapter(adapterAccounts);
resetAccountList();
final GestureDetectorCompat gestureDetector = new GestureDetectorCompat(this, new GestureDetector.SimpleOnGestureListener() {
@Override
public boolean onDoubleTap(MotionEvent e) {
loadHeaderImage(true);
return true;
}
@Override
public boolean onSingleTapConfirmed(MotionEvent e) {
String permalink = sharedPreferences.getString(AppSettings.HEADER_PERMALINK, "");
if (!TextUtils.isEmpty(permalink)) {
Intent intentActivity = new Intent(ActivityMain.this, ActivityMain.class);
intentActivity.setAction(Intent.ACTION_VIEW);
intentActivity.setData(Uri.parse(Reddit.BASE_URL + permalink));
startActivity(intentActivity);
return true;
}
return super.onSingleTapConfirmed(e);
}
});
// Add an empty view to remove extra margin on top
viewNavigation.addHeaderView(new View(this));
viewNavigation.setNavigationItemSelectedListener(menuItem -> {
loadId = menuItem.getItemId();
layoutDrawer.closeDrawer(GravityCompat.START);
return true;
});
scrollHeaderVertical.setDispatchTouchListener((v, event) -> {
gestureDetector.onTouchEvent(event);
switch(MotionEventCompat.getActionMasked(event)) {
case MotionEvent.ACTION_DOWN:
layoutDrawer.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_OPEN);
break;
case MotionEvent.ACTION_UP:
case MotionEvent.ACTION_CANCEL:
layoutDrawer.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED);
break;
}
return false;
});
loadHeaderImage(false);
}
use of android.support.v4.view.GestureDetectorCompat in project Reader by TheKeeperOfPie.
the class FragmentCommentsInner method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
scrollToPaddingTop = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 8, getResources().getDisplayMetrics());
scrollToPaddingBottom = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 56, getResources().getDisplayMetrics());
layoutRoot = (CustomFrameLayout) inflater.inflate(R.layout.fragment_comments_inner, container, false);
CallbackYouTubeDestruction callbackYouTubeDestruction = () -> {
adapterCommentList.destroyYouTubePlayerFragments();
adapterLink.destroyYouTubePlayerFragments();
};
swipeRefreshCommentList = (SwipeRefreshLayout) layoutRoot.findViewById(R.id.swipe_refresh_comment_list);
swipeRefreshCommentList.setOnRefreshListener(() -> controllerComments.reloadAllComments());
linearLayoutManager = new LinearLayoutManager(getActivity());
recyclerCommentList = (RecyclerView) layoutRoot.findViewById(R.id.recycler_comment_list);
recyclerCommentList.setLayoutManager(linearLayoutManager);
recyclerCommentList.setHasFixedSize(true);
recyclerCommentList.setItemAnimator(null);
AdapterListener adapterListenerComment = new AdapterListener() {
@Override
public void scrollAndCenter(int position, int height) {
linearLayoutManager.scrollToPositionWithOffset(position, 0);
}
@Override
public void hideToolbar() {
callback.hideToolbar();
}
@Override
public void clearDecoration() {
callback.clearDecoration();
}
@Override
public void requestMore() {
controllerComments.loadMoreComments();
}
@Override
public void requestDisallowInterceptTouchEventVertical(boolean disallow) {
recyclerCommentList.requestDisallowInterceptTouchEvent(disallow);
swipeRefreshCommentList.requestDisallowInterceptTouchEvent(disallow);
}
@Override
public void requestDisallowInterceptTouchEventHorizontal(boolean disallow) {
}
};
AdapterLink.ViewHolderLink.Listener listenerLink = new LinksListenerBase(mListener.getEventListenerBase()) {
@Override
public void onVote(Link link, AdapterLink.ViewHolderLink viewHolderLink, Likes vote) {
}
@Override
public void onDelete(Link link) {
}
@Override
public void onReport(Link link) {
}
@Override
public void onSave(Link link) {
}
@Override
public void onMarkNsfw(Link link) {
}
};
AdapterCommentList.ViewHolderComment.Listener listenerComment = new AdapterCommentList.ViewHolderComment.Listener() {
@Override
public void onToggleComment(Comment comment) {
controllerComments.toggleComment(comment);
}
@Override
public void onShowReplyEditor(Comment comment) {
}
@Override
public void onEditComment(Comment comment, String text) {
}
@Override
public void onSendComment(Comment comment, String text) {
}
@Override
public void onMarkRead(Comment comment) {
}
@Override
public void onLoadNestedComments(Comment comment) {
controllerComments.loadNestedComments(comment);
}
@Override
public void onJumpToParent(Comment comment) {
controllerComments.jumpToParent(comment);
}
@Override
public void onViewProfile(Comment comment) {
}
@Override
public void onCopyText(Comment comment) {
}
@Override
public void onDeleteComment(Comment comment) {
}
@Override
public void onReport(Comment comment) {
// TODO: Add comment text
new AlertDialog.Builder(getContext()).setTitle(R.string.report_title).setSingleChoiceItems(Report.getDisplayReasons(getResources()), -1, (dialog, which) -> {
reportSelected = Report.values()[which];
}).setPositiveButton(R.string.ok, (dialog, which) -> {
if (reportSelected == Report.OTHER) {
View viewDialog = LayoutInflater.from(getContext()).inflate(R.layout.dialog_text_input, null, false);
final EditText editText = (EditText) viewDialog.findViewById(R.id.edit_text);
editText.setFilters(new InputFilter[] { new InputFilter.LengthFilter(100) });
new AlertDialog.Builder(getContext()).setView(viewDialog).setTitle(R.string.item_report).setPositiveButton(R.string.ok, (dialog1, which1) -> {
mListener.getEventListenerBase().onReport(link, editText.getText().toString()).subscribe(new ObserverError<String>() {
@Override
public void onError(Throwable e) {
controllerComments.getEventHolder().getErrors().call(CommentsError.REPORT);
}
});
}).setNegativeButton(R.string.cancel, (dialog1, which1) -> {
dialog1.dismiss();
}).show();
} else if (reportSelected != null) {
mListener.getEventListenerBase().onReport(link, reportSelected.getReason()).subscribe(new ObserverError<String>() {
@Override
public void onError(Throwable e) {
controllerComments.getEventHolder().getErrors().call(CommentsError.REPORT);
}
});
}
}).setNegativeButton(R.string.cancel, null).show();
}
@Override
public void onVoteComment(Comment comment, AdapterCommentList.ViewHolderComment viewHolderComment, Likes vote) {
}
@Override
public void onSave(Comment comment) {
}
};
adapterCommentList = new AdapterCommentList(getActivity(), adapterListenerComment, listenerComment, listenerLink, youTubeListener, callbackYouTubeDestruction, getArguments().getBoolean(ARG_IS_GRID, false), getArguments().getString(ARG_FIRST_LINK_NAME), getArguments().getInt(ARG_COLOR_LINK, 0), getArguments().getBoolean(ARG_ACTIONS_EXPANDED, false));
observer = new RecyclerView.AdapterDataObserver() {
@Override
public void onItemRangeChanged(int positionStart, int itemCount) {
super.onItemRangeChanged(positionStart, itemCount);
if (positionStart == 0) {
callback.releaseYouTube();
}
}
};
adapterCommentList.registerAdapterDataObserver(observer);
recyclerCommentList.setAdapter(adapterCommentList);
layoutManagerLink = new LinearLayoutManagerWrapHeight(getActivity(), LinearLayoutManager.VERTICAL, false);
layoutManagerLink.setOnSizeChangedListener((width, height, oldWidth, oldHeight) -> {
if (postExpanded && targetExpandPostHeight == 0) {
targetExpandPostHeight = height + heightExpandHandle;
postExpanded = false;
expandPost(true);
}
});
AdapterListener adapterListenerLink = new AdapterListener() {
@Override
public void scrollAndCenter(int position, int height) {
layoutManagerLink.scrollToPositionWithOffset(position, 0);
}
@Override
public void hideToolbar() {
callback.hideToolbar();
}
@Override
public void clearDecoration() {
callback.clearDecoration();
}
@Override
public void requestMore() {
}
@Override
public void requestDisallowInterceptTouchEventVertical(boolean disallow) {
recyclerLink.requestDisallowInterceptTouchEvent(disallow);
}
@Override
public void requestDisallowInterceptTouchEventHorizontal(boolean disallow) {
}
};
adapterLink = new AdapterLinkHeader(getActivity(), controllerComments, adapterListenerLink, listenerLink, youTubeListener, callbackYouTubeDestruction, getArguments().getBoolean(ARG_IS_GRID, false), getArguments().getString(ARG_FIRST_LINK_NAME), getArguments().getInt(ARG_COLOR_LINK, 0), getArguments().getBoolean(ARG_ACTIONS_EXPANDED, false));
final GestureDetectorCompat gestureDetectorExpand = new GestureDetectorCompat(getActivity(), new GestureDetector.SimpleOnGestureListener() {
private float startY;
private int startHeight;
@Override
public boolean onDown(MotionEvent e) {
if (targetExpandPostHeight == 0) {
targetExpandPostHeight = layoutManagerLink.getFirstChildHeight() + heightExpandHandle;
}
if (e.getY() > imageExpandIndicator.getY() && e.getY() < imageExpandIndicator.getY() + heightExpandHandle) {
startY = e.getY();
startHeight = targetExpandPostHeight;
} else {
startY = 0;
}
return super.onDown(e);
}
@Override
public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) {
if (startY == 0) {
return super.onScroll(e1, e2, distanceX, distanceY);
}
float distance = e2.getY() - startY;
targetExpandPostHeight = (int) Math.min(startHeight + distance, layoutRoot.getHeight());
layoutExpandPostInner.getLayoutParams().height = targetExpandPostHeight;
layoutExpandPostInner.requestLayout();
return super.onScroll(e1, e2, distanceX, distanceY);
}
@Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
if (startY == 0) {
return super.onFling(e1, e2, velocityX, velocityY);
}
if (velocityY < -expandFlingThreshold) {
startY = 0;
expandPost(false);
return true;
} else if (velocityY > expandFlingThreshold) {
startY = 0;
targetExpandPostHeight = layoutRoot.getHeight() - heightExpandHandle;
postExpanded = false;
expandPost(true);
return true;
}
return super.onFling(e1, e2, velocityX, velocityY);
}
});
heightExpandHandle = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 33, getResources().getDisplayMetrics());
expandFlingThreshold = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, EXPAND_FLING_THRESHOLD, getResources().getDisplayMetrics());
layoutExpandPostInner = (ViewGroup) layoutRoot.findViewById(R.id.layout_expand_post_inner);
imageExpandIndicator = (ImageView) layoutRoot.findViewById(R.id.image_expand_indicator);
imageExpandIndicator.setColorFilter(themer.getColorFilterIcon());
layoutRoot.setDispatchTouchListener((v, event) -> gestureDetectorExpand.onTouchEvent(event));
recyclerLink = (RecyclerView) layoutRoot.findViewById(R.id.recycler_link);
recyclerLink.setLayoutManager(layoutManagerLink);
recyclerLink.setItemAnimator(null);
if (savedInstanceState != null) {
String youtubeId = savedInstanceState.getString(ARG_YOUTUBE_ID, null);
if (!TextUtils.isEmpty(youtubeId)) {
callback.loadYouTubeVideo(youtubeId, savedInstanceState.getInt(ARG_YOUTUBE_TIME, 0));
}
}
if (savedInstanceState != null && savedInstanceState.containsKey("Link")) {
adapterLink.setAnimationFinished(true);
adapterCommentList.setAnimationFinished(true);
controllerComments.setLinkFromCache((Link) savedInstanceState.get("Link"));
} else if (link != null) {
controllerComments.setLink(link);
link = null;
}
adapterCommentList.setData(controllerComments.getData());
if (animationFinished) {
setAnimationFinished(true);
}
return layoutRoot;
}
use of android.support.v4.view.GestureDetectorCompat in project Reader by TheKeeperOfPie.
the class FragmentComments method onCreateView.
@SuppressWarnings("ResourceType")
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
layoutRoot = (CustomFrameLayout) inflater.inflate(R.layout.fragment_comments, container, false);
ButterKnife.bind(this, layoutRoot);
youTubeListener = new YouTubeListener() {
@Override
public void loadYouTubeVideo(Link link, final String id, final int timeInMillis) {
loadYoutubeVideo(id, timeInMillis);
}
@Override
public boolean hideYouTube() {
if (layoutYouTube.isShown()) {
if (youTubePlayer != null) {
youTubePlayer.pause();
}
toggleYouTubeVisibility(View.GONE);
return false;
}
return true;
}
};
toolbar.setTitleTextColor(themer.getColorFilterPrimary().getColor());
toolbar.setBackgroundColor(themer.getColorPrimary());
setUpToolbar();
behaviorFloatingActionButton = new ScrollAwareFloatingActionButtonBehavior(getActivity(), null, new ScrollAwareFloatingActionButtonBehavior.OnVisibilityChangeListener() {
@Override
public void onStartHideFromScroll() {
hideLayoutActions(0);
}
@Override
public void onEndHideFromScroll() {
buttonExpandActions.setImageResource(R.drawable.ic_unfold_more_white_24dp);
buttonExpandActions.setColorFilter(themer.getColorFilterAccent());
}
});
buttonExpandActions.setOnClickListener(v -> toggleLayoutActions());
((CoordinatorLayout.LayoutParams) buttonExpandActions.getLayoutParams()).setBehavior(behaviorFloatingActionButton);
buttonJumpTop.setOnClickListener(v -> fragmentCurrent.scrollToPositionWithOffset(0, 0));
buttonJumpTop.setOnLongClickListener(v -> {
Toast.makeText(getActivity(), getString(R.string.content_description_button_jump_top), Toast.LENGTH_SHORT).show();
return false;
});
buttonCommentPrevious.setOnClickListener(v -> fragmentCurrent.previousComment());
buttonCommentPrevious.setOnLongClickListener(v -> {
Toast.makeText(getActivity(), getString(R.string.content_description_button_comment_previous), Toast.LENGTH_SHORT).show();
return false;
});
buttonCommentNext.setOnClickListener(v -> fragmentCurrent.nextComment());
buttonCommentNext.setOnLongClickListener(v -> {
Toast.makeText(getActivity(), getString(R.string.content_description_button_comment_next), Toast.LENGTH_SHORT).show();
return false;
});
// Margin is included within shadow margin on pre-Lollipop, so remove all regular margin
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
((CoordinatorLayout.LayoutParams) buttonExpandActions.getLayoutParams()).setMargins(0, 0, 0, 0);
int margin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 8, getResources().getDisplayMetrics());
LinearLayout.LayoutParams layoutParamsJumpTop = (LinearLayout.LayoutParams) buttonJumpTop.getLayoutParams();
layoutParamsJumpTop.setMargins(0, 0, 0, 0);
buttonJumpTop.setLayoutParams(layoutParamsJumpTop);
LinearLayout.LayoutParams layoutParamsPrevious = (LinearLayout.LayoutParams) buttonCommentPrevious.getLayoutParams();
layoutParamsPrevious.setMargins(0, 0, 0, 0);
buttonCommentPrevious.setLayoutParams(layoutParamsPrevious);
LinearLayout.LayoutParams layoutParamsNext = (LinearLayout.LayoutParams) buttonCommentNext.getLayoutParams();
layoutParamsNext.setMargins(0, 0, 0, 0);
buttonCommentNext.setLayoutParams(layoutParamsNext);
ViewGroup.MarginLayoutParams layoutParamsActions = (ViewGroup.MarginLayoutParams) layoutActions.getLayoutParams();
layoutParamsActions.setMarginStart(margin);
layoutParamsActions.setMarginEnd(margin);
layoutActions.setLayoutParams(layoutParamsActions);
}
buttonExpandActions.setColorFilter(themer.getColorFilterAccent());
buttonJumpTop.setColorFilter(themer.getColorFilterAccent());
buttonCommentPrevious.setColorFilter(themer.getColorFilterAccent());
buttonCommentNext.setColorFilter(themer.getColorFilterAccent());
isStartOnLeft = getResources().getConfiguration().getLayoutDirection() == View.LAYOUT_DIRECTION_LTR;
final float screenWidth = getResources().getDisplayMetrics().widthPixels;
swipeEndDistance = screenWidth * 0.4f;
gestureDetector = new GestureDetectorCompat(getActivity(), new GestureDetector.SimpleOnGestureListener() {
@Override
public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) {
if (isFinished) {
return true;
}
swipeDifferenceX = e2.getX() - e1.getX();
if (isStartOnLeft) {
if (e1.getX() > screenWidth * 0.2f || swipeDifferenceX < 0) {
return super.onScroll(e1, e2, distanceX, distanceY);
}
} else {
if (e1.getX() < screenWidth * 0.8f || swipeDifferenceX > 0) {
return super.onScroll(e1, e2, distanceX, distanceY);
}
}
if (!hasSwipedEnd) {
FragmentBase fragment = (FragmentBase) getFragmentManager().findFragmentByTag(fragmentParentTag);
if (fragment != null) {
fragment.setVisibilityOfThing(View.VISIBLE, linkTop);
fragment.onHiddenChanged(false);
}
hasSwipedEnd = true;
}
float ratio = 1f - swipeDifferenceX / screenWidth;
buttonExpandActions.setAlpha(ratio);
buttonExpandActions.setScaleX(ratio);
buttonExpandActions.setScaleY(ratio);
layoutAppBar.setTranslationX(swipeDifferenceX);
layoutComments.setTranslationX(swipeDifferenceX);
viewBackground.setTranslationX(swipeDifferenceX);
return super.onScroll(e1, e2, distanceX, distanceY);
}
});
if (preferences.getBoolean(AppSettings.SWIPE_EXIT_COMMENTS, true)) {
layoutRoot.setDispatchTouchListener(this);
}
if (savedInstanceState == null) {
if (getArguments().getInt(ARG_YOUTUBE_TIME, -1) >= 0) {
loadYoutubeVideo(getArguments().getString(ARG_YOUTUBE_ID), getArguments().getInt(ARG_YOUTUBE_TIME));
}
} else {
String youtubeId = savedInstanceState.getString(ARG_YOUTUBE_ID, null);
if (!TextUtils.isEmpty(youtubeId)) {
loadYoutubeVideo(youtubeId, savedInstanceState.getInt(ARG_YOUTUBE_TIME, 0));
}
}
fragmentCallback = new FragmentCommentsInner.Callback() {
@Override
public void loadYouTubeVideo(String id, int timeInMillis) {
FragmentComments.this.loadYoutubeVideo(id, timeInMillis);
}
@Override
public void releaseYouTube() {
FragmentComments.this.releaseYouTube();
}
@Override
public void setPostExpanded(boolean expanded) {
FragmentComments.this.setPostExpanded(expanded);
}
@Override
public void setIsCommentThread(boolean isCommentThread) {
FragmentComments.this.setIsCommentThread(isCommentThread);
}
@Override
public void setSort(Sort sort) {
FragmentComments.this.setSort(sort);
}
@Override
public void setTitle(CharSequence title) {
FragmentComments.this.setTitle(title);
}
@Override
public void clearDecoration() {
behaviorFloatingActionButton.animateOut(buttonExpandActions);
AppBarLayout.Behavior behaviorAppBar = (AppBarLayout.Behavior) ((CoordinatorLayout.LayoutParams) layoutAppBar.getLayoutParams()).getBehavior();
behaviorAppBar.onNestedFling(layoutCoordinator, layoutAppBar, null, 0, 1000, true);
}
@Override
public void hideToolbar() {
AppBarLayout.Behavior behaviorAppBar = (AppBarLayout.Behavior) ((CoordinatorLayout.LayoutParams) layoutAppBar.getLayoutParams()).getBehavior();
behaviorAppBar.onNestedFling(layoutCoordinator, layoutAppBar, null, 0, 1000, true);
}
@Override
public int getAppBarHeight() {
return layoutAppBar.getHeight();
}
@Override
public boolean isCurrentFragment(FragmentCommentsInner fragmentCommentsInner) {
return positionCurrent == fragmentCommentsInner.getPosition();
}
@Override
public void loadYouTubeVideo(Link link, String id, int timeInMillis) {
youTubeListener.loadYouTubeVideo(link, id, timeInMillis);
}
@Override
public boolean hideYouTube() {
return youTubeListener.hideYouTube();
}
};
setUpPager();
if (!getArguments().getBoolean(ARG_INITIALIZED, false)) {
viewBackground.setVisibility(View.INVISIBLE);
pagerComments.setVisibility(View.INVISIBLE);
layoutAppBar.setVisibility(View.GONE);
layoutComments.postOnAnimation(() -> animateEnter(layoutRoot));
} else {
setAnimationFinished(true);
}
return layoutRoot;
}
Aggregations