make tabs contain icons instead of title

This commit is contained in:
Christian Schabesberger 2017-10-25 16:09:26 +02:00
parent 9a073713bb
commit 4c4cfb49b4
12 changed files with 11 additions and 2 deletions

View File

@ -84,6 +84,15 @@ public class MainFragment extends BaseFragment implements TabLayout.OnTabSelecte
viewPager.setOffscreenPageLimit(adapter.getCount()); viewPager.setOffscreenPageLimit(adapter.getCount());
tabLayout.setupWithViewPager(viewPager); tabLayout.setupWithViewPager(viewPager);
if(PreferenceManager.getDefaultSharedPreferences(getActivity())
.getString(getString(R.string.main_page_content_key), getString(R.string.blank_page_key))
.equals(getString(R.string.subscription_page_key))) {
tabLayout.getTabAt(0).setIcon(R.drawable.ic_channel_white_24dp);
} else {
tabLayout.getTabAt(0).setIcon(R.drawable.ic_whatshot_white_24dp);
tabLayout.getTabAt(1).setIcon(R.drawable.ic_channel_white_24dp);
}
} }
/*////////////////////////////////////////////////////////////////////////// /*//////////////////////////////////////////////////////////////////////////
@ -171,7 +180,8 @@ public class MainFragment extends BaseFragment implements TabLayout.OnTabSelecte
@Override @Override
public CharSequence getPageTitle(int position) { public CharSequence getPageTitle(int position) {
return getString(this.tabTitles[position]); //return getString(this.tabTitles[position]);
return "";
} }
@Override @Override

View File

@ -62,7 +62,6 @@ public class SubscriptionFragment extends BaseStateFragment<List<SubscriptionEnt
@Nullable @Nullable
@Override @Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) { public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {
activity.getSupportActionBar().setDisplayShowTitleEnabled(true);
activity.getSupportActionBar().setDisplayShowTitleEnabled(true); activity.getSupportActionBar().setDisplayShowTitleEnabled(true);
activity.setTitle(R.string.tab_subscriptions); activity.setTitle(R.string.tab_subscriptions);
return inflater.inflate(R.layout.fragment_subscription, container, false); return inflater.inflate(R.layout.fragment_subscription, container, false);

Binary file not shown.

After

Width:  |  Height:  |  Size: 398 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 468 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 304 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 334 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 468 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 595 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 739 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 866 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 633 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB