Search in sources :

Example 1 with LinksController

use of com.winsonchiu.reader.links.LinksController in project Reader by TheKeeperOfPie.

the class FragmentComments method subscribe.

private void subscribe() {
    CommentsTopModel data = controllerCommentsTop.getEventHolder().getData().getValue();
    Link linkStart = data.getLinkModel().getLink();
    Source source = data.getSource();
    LinksController linksController = getLinksControllerFromSource(source);
    if (linksController == null) {
        this.linksModel.getLinks().clear();
        this.linksModel.getLinks().add(linkStart);
    } else {
        subscriptionLinks = linksController.getEventHolder().getData().subscribe(linksModel -> {
            this.linksModel = linksModel;
            if (indexStart == 0) {
                indexStart = UtilsList.indexOf(linksModel.getLinks(), link -> linkStart.getId().equals(link.getId()));
                positionCurrent = indexStart;
            }
            adapterComments.notifyDataSetChanged();
            pagerComments.setCurrentItem(positionCurrent, false);
        });
    }
}
Also used : Rect(android.graphics.Rect) LinearLayout(android.widget.LinearLayout) Bundle(android.os.Bundle) Historian(com.winsonchiu.reader.history.Historian) CustomApplication(com.winsonchiu.reader.CustomApplication) ControllerLinks(com.winsonchiu.reader.links.ControllerLinks) Uri(android.net.Uri) ViewPropertyAnimatorListener(android.support.v4.view.ViewPropertyAnimatorListener) Animator(android.animation.Animator) CustomFrameLayout(com.winsonchiu.reader.views.CustomFrameLayout) YouTubeInitializationResult(com.google.android.youtube.player.YouTubeInitializationResult) LinksModel(com.winsonchiu.reader.links.LinksModel) BindView(butterknife.BindView) YouTubePlayerStateListener(com.winsonchiu.reader.utils.YouTubePlayerStateListener) MotionEventCompat(android.support.v4.view.MotionEventCompat) ControllerProfile(com.winsonchiu.reader.profile.ControllerProfile) Matcher(java.util.regex.Matcher) View(android.view.View) ViewCompat(android.support.v4.view.ViewCompat) PreferenceManager(android.preference.PreferenceManager) Log(android.util.Log) ControllerSearch(com.winsonchiu.reader.search.ControllerSearch) StaggeredGridLayoutManager(android.support.v7.widget.StaggeredGridLayoutManager) ApiKeys(com.winsonchiu.reader.ApiKeys) FloatingActionButton(android.support.design.widget.FloatingActionButton) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) DisplayMetrics(android.util.DisplayMetrics) ViewGroup(android.view.ViewGroup) R(com.winsonchiu.reader.R) FragmentBase(com.winsonchiu.reader.FragmentBase) RecyclerFragmentPagerAdapter(com.winsonchiu.reader.utils.RecyclerFragmentPagerAdapter) Pattern(java.util.regex.Pattern) Nullable(android.support.annotation.Nullable) YouTubePlayerSupportFragment(com.google.android.youtube.player.YouTubePlayerSupportFragment) Subscription(rx.Subscription) ControllerHistory(com.winsonchiu.reader.history.ControllerHistory) AppBarLayout(android.support.design.widget.AppBarLayout) CoordinatorLayout(android.support.design.widget.CoordinatorLayout) GestureDetector(android.view.GestureDetector) FastOutSlowInInterpolator(android.support.v4.view.animation.FastOutSlowInInterpolator) ButterKnife(butterknife.ButterKnife) AdapterLink(com.winsonchiu.reader.links.AdapterLink) UtilsRx(com.winsonchiu.reader.utils.UtilsRx) ViewPager(android.support.v4.view.ViewPager) UtilsList(com.winsonchiu.reader.utils.UtilsList) AppSettings(com.winsonchiu.reader.AppSettings) MenuItem(android.view.MenuItem) Inject(javax.inject.Inject) MotionEvent(android.view.MotionEvent) Toast(android.widget.Toast) LinksController(com.winsonchiu.reader.links.LinksController) Menu(android.view.Menu) Link(com.winsonchiu.reader.data.reddit.Link) ScrollAwareFloatingActionButtonBehavior(com.winsonchiu.reader.utils.ScrollAwareFloatingActionButtonBehavior) Build(android.os.Build) LayoutInflater(android.view.LayoutInflater) YouTubeListener(com.winsonchiu.reader.utils.YouTubeListener) Sort(com.winsonchiu.reader.data.reddit.Sort) TextUtils(android.text.TextUtils) RecyclerView(android.support.v7.widget.RecyclerView) SharedPreferences(android.content.SharedPreferences) TypedValue(android.util.TypedValue) YouTubePlayer(com.google.android.youtube.player.YouTubePlayer) Toolbar(android.support.v7.widget.Toolbar) ActivityMain(com.winsonchiu.reader.ActivityMain) GestureDetectorCompat(android.support.v4.view.GestureDetectorCompat) FragmentListenerBase(com.winsonchiu.reader.FragmentListenerBase) Activity(android.app.Activity) UtilsTheme(com.winsonchiu.reader.utils.UtilsTheme) ValueAnimator(android.animation.ValueAnimator) LinksController(com.winsonchiu.reader.links.LinksController) AdapterLink(com.winsonchiu.reader.links.AdapterLink) Link(com.winsonchiu.reader.data.reddit.Link)

Aggregations

Animator (android.animation.Animator)1 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)1 ValueAnimator (android.animation.ValueAnimator)1 Activity (android.app.Activity)1 SharedPreferences (android.content.SharedPreferences)1 Rect (android.graphics.Rect)1 Uri (android.net.Uri)1 Build (android.os.Build)1 Bundle (android.os.Bundle)1 PreferenceManager (android.preference.PreferenceManager)1 Nullable (android.support.annotation.Nullable)1 AppBarLayout (android.support.design.widget.AppBarLayout)1 CoordinatorLayout (android.support.design.widget.CoordinatorLayout)1 FloatingActionButton (android.support.design.widget.FloatingActionButton)1 GestureDetectorCompat (android.support.v4.view.GestureDetectorCompat)1 MotionEventCompat (android.support.v4.view.MotionEventCompat)1 ViewCompat (android.support.v4.view.ViewCompat)1 ViewPager (android.support.v4.view.ViewPager)1 ViewPropertyAnimatorListener (android.support.v4.view.ViewPropertyAnimatorListener)1 FastOutSlowInInterpolator (android.support.v4.view.animation.FastOutSlowInInterpolator)1