Esempio n. 1
0
        @Override
        public void onClick(View v) {
          if (refreshing) return;
          Animation operatingAnim =
              AnimationUtils.loadAnimation(getActivity(), R.anim.refresh_route);
          LinearInterpolator lin = new LinearInterpolator();
          operatingAnim.setInterpolator(lin);
          if (operatingAnim != null) {
            v.startAnimation(operatingAnim);
          }

          swipeRefreshLayout.setRefreshing(true);

          mListView.post(
              new Runnable() {
                @Override
                public void run() {
                  mListView.smoothScrollToPosition(0);
                }
              });

          mListView.postDelayed(
              new Runnable() {
                @Override
                public void run() {
                  onRefresh();
                }
              },
              800);
        }
Esempio n. 2
0
 @Override
 public void tabAdded() {
   if (mTabsAdapter != null) {
     mTabsAdapter.notifyItemInserted(mTabsManager.last());
     mRecyclerView.postDelayed(
         new Runnable() {
           @Override
           public void run() {
             mRecyclerView.smoothScrollToPosition(mTabsAdapter.getItemCount() - 1);
           }
         },
         500);
   }
 }
Esempio n. 3
0
        @Override
        public void onClick(View v) {
          swipeRefreshLayout.setRefreshing(true);

          mListView.post(
              new Runnable() {
                @Override
                public void run() {
                  mListView.smoothScrollToPosition(0);
                }
              });

          mListView.postDelayed(
              new Runnable() {
                @Override
                public void run() {
                  onRefresh();
                }
              },
              800);
        }
Esempio n. 4
0
  public void onEventMainThread(MainActivity.BottomItemRefreshEvent event) {
    if (event.bottomIndex == 2
        && !refreshing
        && mListView != null
        && mListView.getVisibility() == View.VISIBLE) {
      swipeRefreshLayout.setRefreshing(true);

      mListView.post(
          new Runnable() {
            @Override
            public void run() {
              mListView.smoothScrollToPosition(0);
            }
          });
      mListView.postDelayed(
          new Runnable() {
            @Override
            public void run() {
              onRefresh();
            }
          },
          800);
    }
  }
 @Override
 public boolean onQueryTextChange(String newText) {
   mQueryText = newText;
   mRecyclerView.postDelayed(searchRunnable, 400);
   return false;
 }