@Test public void testItemChanged() { startWithIntent(); TabLayout tabLayout = activity.findViewById(R.id.tab_layout); assertEquals(activity.getResources().getQuantityString(R.plurals.comments_count, 0, 0), tabLayout.getTabAt(0).getText()); activity.onItemChanged(new TestHnItem(1L) { @Override public int getKidCount() { return 10; } }); assertEquals(activity.getResources().getQuantityString(R.plurals.comments_count, 10, 10), tabLayout.getTabAt(0).getText()); }
@Override public void onItemChanged(@NonNull Item item) { mItem = item; if (mTabLayout.getTabCount() > 0) { mTabLayout.getTabAt(0).setText(getResources() .getQuantityString(R.plurals.comments_count, item.getKidCount(), item.getKidCount())); } }
ItemActivity extends InjectableActivity implements ItemFragment.ItemChangedListener { @Override public void onItemChanged(@NonNull Item item) { mItem = item; if (mTabLayout.getTabCount() > 0) { mTabLayout.getTabAt(0).setText(getResources() .getQuantityString(R.plurals.comments_count, item.getKidCount(), item.getKidCount())); } } }
ItemActivity extends InjectableActivity implements ItemFragment.ItemChangedListener { @Override public void onItemChanged(@NonNull Item item) { mItem = item; if (mTabLayout.getTabCount() > 0) { mTabLayout.getTabAt(0).setText(getResources() .getQuantityString(R.plurals.comments_count, item.getKidCount(), item.getKidCount())); } }  }
ItemActivity extends InjectableActivity implements ItemFragment.ItemChangedListener { @Override public void onItemChanged(@NonNull Item item) { mItem = item; if (mTabLayout.getTabCount() > 0) { mTabLayout.getTabAt(0).setText(getResources() .getQuantityString(R.plurals.comments_count, item.getKidCount(), item.getKidCount())); } }  @Override boolean onCreateOptionsMenu(Menu menu); @Override boolean onPrepareOptionsMenu(Menu menu); @Override boolean onOptionsItemSelected(MenuItem item); @Override void onBackPressed(); @Override boolean onKeyDown(int keyCode, KeyEvent event); @Override boolean onKeyUp(int keyCode, KeyEvent event); @Override boolean onKeyLongPress(int keyCode, KeyEvent event); @Override void onWindowFocusChanged(boolean hasFocus); @Override void onItemChanged(@NonNull Item item); }
ItemActivity extends InjectableActivity implements ItemFragment.ItemChangedListener { @Override public void onItemChanged(@NonNull Item item) { mItem = item; if (mTabLayout.getTabCount() > 0) { mTabLayout.getTabAt(0).setText(getResources() .getQuantityString(R.plurals.comments_count, item.getKidCount(), item.getKidCount())); } }  @Override boolean onCreateOptionsMenu(Menu menu); @Override boolean onPrepareOptionsMenu(Menu menu); @Override boolean onOptionsItemSelected(MenuItem item); @Override void onBackPressed(); @Override boolean onKeyDown(int keyCode, KeyEvent event); @Override boolean onKeyUp(int keyCode, KeyEvent event); @Override boolean onKeyLongPress(int keyCode, KeyEvent event); @Override void onWindowFocusChanged(boolean hasFocus); @Override void onItemChanged(@NonNull Item item); static final String EXTRA_ITEM; static final String EXTRA_CACHE_MODE; static final String EXTRA_OPEN_COMMENTS; }