Fix first icon selection

This commit is contained in:
stom79 2018-11-03 18:27:33 +01:00
parent 13a6fe3a3f
commit 69aa347dce
1 changed files with 12 additions and 0 deletions

View File

@ -691,6 +691,7 @@ public abstract class BaseMainActivity extends BaseActivity
if( display_global) if( display_global)
tabLayout.addTab(tabPublic); tabLayout.addTab(tabPublic);
//Display filter for notification when long pressing the tab //Display filter for notification when long pressing the tab
final LinearLayout tabStrip = (LinearLayout) tabLayout.getChildAt(0); final LinearLayout tabStrip = (LinearLayout) tabLayout.getChildAt(0);
tabStrip.getChildAt(1).setOnLongClickListener(new View.OnLongClickListener() { tabStrip.getChildAt(1).setOnLongClickListener(new View.OnLongClickListener() {
@ -880,6 +881,7 @@ public abstract class BaseMainActivity extends BaseActivity
toot.show(); toot.show();
else else
toot.hide(); toot.hide();
if( viewPager.getAdapter() != null) { if( viewPager.getAdapter() != null) {
Fragment fragment = (Fragment) viewPager.getAdapter().instantiateItem(viewPager, tab.getPosition()); Fragment fragment = (Fragment) viewPager.getAdapter().instantiateItem(viewPager, tab.getPosition());
switch (tab.getPosition()) { switch (tab.getPosition()) {
@ -941,6 +943,14 @@ public abstract class BaseMainActivity extends BaseActivity
displayStatusFragment.scrollToTop(); displayStatusFragment.scrollToTop();
} }
} }
if( tab.getCustomView() != null) {
ImageView icon = tab.getCustomView().findViewById(R.id.tab_icon);
if( icon != null)
if( theme == THEME_BLACK)
icon.setColorFilter(ContextCompat.getColor(getApplicationContext(), R.color.dark_icon), PorterDuff.Mode.SRC_IN);
else
icon.setColorFilter(ContextCompat.getColor(getApplicationContext(), R.color.mastodonC4), PorterDuff.Mode.SRC_IN);
}
} }
}); });
Helper.refreshSearchTag(BaseMainActivity.this, tabLayout, adapter); Helper.refreshSearchTag(BaseMainActivity.this, tabLayout, adapter);
@ -952,6 +962,7 @@ public abstract class BaseMainActivity extends BaseActivity
navigationView.setNavigationItemSelectedListener(this); navigationView.setNavigationItemSelectedListener(this);
//Scroll to top when top bar is clicked for favourites/blocked/muted //Scroll to top when top bar is clicked for favourites/blocked/muted
toolbarTitle.setOnClickListener(new View.OnClickListener() { toolbarTitle.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) { public void onClick(View v) {
@ -1122,6 +1133,7 @@ public abstract class BaseMainActivity extends BaseActivity
toot = findViewById(R.id.toot); toot = findViewById(R.id.toot);
delete_all = findViewById(R.id.delete_all); delete_all = findViewById(R.id.delete_all);
add_new = findViewById(R.id.add_new); add_new = findViewById(R.id.add_new);
tabLayout.getTabAt(0).select();
toot.setOnClickListener(new View.OnClickListener() { toot.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {