Fix color issues for tabs
This commit is contained in:
parent
19b5d24c4c
commit
a55465ae82
|
@ -1713,12 +1713,16 @@ public abstract class BaseMainActivity extends BaseActivity
|
|||
drawer.closeDrawer(GravityCompat.START);
|
||||
if( tab.getCustomView() != null) {
|
||||
ImageView icon = tab.getCustomView().findViewById(R.id.tab_icon);
|
||||
TextView tv = tab.getCustomView().findViewById(R.id.host_name);
|
||||
|
||||
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);
|
||||
|
||||
else if( tv != null){
|
||||
tv.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.mastodonC4));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1726,11 +1730,18 @@ public abstract class BaseMainActivity extends BaseActivity
|
|||
public void onTabUnselected(TabLayout.Tab tab) {
|
||||
if( tab.getCustomView() != null) {
|
||||
ImageView icon = tab.getCustomView().findViewById(R.id.tab_icon);
|
||||
TextView tv = tab.getCustomView().findViewById(R.id.host_name);
|
||||
if( icon != null)
|
||||
if( theme == THEME_LIGHT)
|
||||
icon.setColorFilter(ContextCompat.getColor(getApplicationContext(), R.color.dark_icon), PorterDuff.Mode.SRC_IN);
|
||||
else
|
||||
icon.setColorFilter(ContextCompat.getColor(getApplicationContext(), R.color.dark_text), PorterDuff.Mode.SRC_IN);
|
||||
else if( tv != null){
|
||||
if( theme == THEME_LIGHT)
|
||||
tv.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_icon));
|
||||
else
|
||||
tv.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_text));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@ import android.support.v7.app.AlertDialog;
|
|||
import android.support.v7.widget.PopupMenu;
|
||||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
|
@ -349,27 +350,30 @@ public class ManageTimelines {
|
|||
}
|
||||
tabLayout.addTab(tb);
|
||||
}else{
|
||||
String name = "";
|
||||
if( tl.getType() == Type.TAG){
|
||||
if( tl.getTagTimeline().getDisplayname() != null) {
|
||||
tb.setText(tl.getTagTimeline().getDisplayname());
|
||||
name = tl.getTagTimeline().getDisplayname();
|
||||
}else {
|
||||
tb.setText(tl.getTagTimeline().getName());
|
||||
name = tl.getTagTimeline().getName();
|
||||
}
|
||||
tabLayout.addTab(tb);
|
||||
}else if( tl.getType() == Type.INSTANCE && (MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON || MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA)){
|
||||
tb.setText(tl.getRemoteInstance().getHost());
|
||||
tabLayout.addTab(tb);
|
||||
name = tl.getRemoteInstance().getHost();
|
||||
}else if( tl.getType() == Type.LIST){
|
||||
tb.setText(tl.getListTimeline().getTitle());
|
||||
tabLayout.addTab(tb);
|
||||
name = tl.getListTimeline().getTitle();
|
||||
}
|
||||
|
||||
TextView tv=(TextView)LayoutInflater.from(context).inflate(R.layout.custom_tab_instance,null);
|
||||
tv.setText(name);
|
||||
if (theme == THEME_LIGHT) {
|
||||
tv.setTextColor(ContextCompat.getColor(context, R.color.action_light_header));
|
||||
}
|
||||
tb.setCustomView(tv);
|
||||
if( tl.getPosition() == 0){
|
||||
TextView tv = tabLayout.getChildAt(0).findViewById(android.R.id.title);
|
||||
if( tv != null)
|
||||
tv.setTextColor(ContextCompat.getColor(context, R.color.mastodonC4));
|
||||
tv.setTextColor(ContextCompat.getColor(context, R.color.mastodonC4));
|
||||
}
|
||||
tabLayout.addTab(tb);
|
||||
}
|
||||
|
||||
final LinearLayout tabStrip = (LinearLayout) tabLayout.getChildAt(0);
|
||||
if( tl.getType() == Type.NOTIFICATION){
|
||||
notificationClik(context, tl, tabLayout);
|
||||
|
|
|
@ -3433,7 +3433,6 @@ public class Helper {
|
|||
if(v instanceof MenuItem) {
|
||||
((MenuItem)v).getIcon().setColorFilter(colorFilter);
|
||||
}
|
||||
|
||||
if(v instanceof ActionMenuView) {
|
||||
for(int j = 0; j < ((ActionMenuView)v).getChildCount(); j++) {
|
||||
|
||||
|
@ -3461,7 +3460,13 @@ public class Helper {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(v instanceof LinearLayout) {
|
||||
for(int j = 0; j < ((LinearLayout)v).getChildCount(); j++) {
|
||||
//Action Bar back button
|
||||
if (((LinearLayout) v).getChildAt(j) instanceof ImageView)
|
||||
((ImageView)((LinearLayout) v).getChildAt(j)).setColorFilter(colorFilter);
|
||||
}
|
||||
}
|
||||
//Step 3: Changing the color of title and subtitle.
|
||||
toolbarView.setTitleTextColor(toolbarIconsColor);
|
||||
toolbarView.setSubtitleTextColor(toolbarIconsColor);
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TextView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/host_name"
|
||||
android:layout_width="match_parent"
|
||||
android:gravity="center"
|
||||
android:layout_height="match_parent"
|
||||
/>
|
Loading…
Reference in New Issue