diff --git a/app/src/main/java/app/michaelwuensch/bitbanana/listViews/channels/ManageChannelsActivity.java b/app/src/main/java/app/michaelwuensch/bitbanana/listViews/channels/ManageChannelsActivity.java index bae76334..d36fcb77 100644 --- a/app/src/main/java/app/michaelwuensch/bitbanana/listViews/channels/ManageChannelsActivity.java +++ b/app/src/main/java/app/michaelwuensch/bitbanana/listViews/channels/ManageChannelsActivity.java @@ -63,6 +63,7 @@ public class ManageChannelsActivity extends BaseAppCompatActivity implements Cha private CustomViewPager mViewPager; private ChannelsPagerAdapter mPagerAdapter; private boolean isOpenChannelView = true; + private long createOptionsMenuTimestamp; @Override protected void onCreate(Bundle savedInstanceState) { @@ -292,6 +293,7 @@ public boolean onCreateOptionsMenu(Menu menu) { MenuItem menuItem = menu.findItem(R.id.searchButton); SearchView searchView = (SearchView) menuItem.getActionView(); searchView.setQueryHint(getResources().getString(R.string.search)); + createOptionsMenuTimestamp = System.currentTimeMillis(); searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() { @Override @@ -304,11 +306,13 @@ public boolean onQueryTextChange(String newText) { mCurrentSearchString = newText; final List filteredChannelList = filter(mChannelItems, newText); mPagerAdapter.getOpenChannelsList().replaceAllItems(filteredChannelList); - mPagerAdapter.getOpenChannelsList().scrollToPosition(0); + if (System.currentTimeMillis() - createOptionsMenuTimestamp > 500) + mPagerAdapter.getOpenChannelsList().scrollToPosition(0); final List filteredClosedChannelList = filter(mClosedChannelItems, newText); mPagerAdapter.getClosedChannelsList().replaceAllItems(filteredClosedChannelList); - mPagerAdapter.getClosedChannelsList().scrollToPosition(0); + if (System.currentTimeMillis() - createOptionsMenuTimestamp > 500) + mPagerAdapter.getClosedChannelsList().scrollToPosition(0); return true; }