Skip to content

Commit

Permalink
fix(android): allow Tab barColor to be set
Browse files Browse the repository at this point in the history
  • Loading branch information
garymathews authored and sgtcoolguy committed Jun 8, 2020
1 parent 33aba9e commit 98718ac
Showing 1 changed file with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import org.appcelerator.titanium.TiC;
import org.appcelerator.titanium.proxy.ActivityProxy;
import org.appcelerator.titanium.proxy.TiViewProxy;
import org.appcelerator.titanium.proxy.TiWindowProxy;
import org.appcelerator.titanium.util.TiColorHelper;
import org.appcelerator.titanium.util.TiConvert;
import org.appcelerator.titanium.util.TiRHelper;
Expand Down Expand Up @@ -368,6 +369,18 @@ public void onPageScrollStateChanged(int i)
{
}
});

// Set action bar color.
final ActionBar actionBar = ((AppCompatActivity) proxy.getActivity()).getSupportActionBar();
if (actionBar != null) {
final TiWindowProxy windowProxy = ((TabProxy) this.tabs.get(tabIndex).getProxy()).getWindow();
final KrollDict windowProperties = windowProxy.getProperties();

if (windowProperties.containsKeyAndNotNull(TiC.PROPERTY_BAR_COLOR)) {
final int color = TiColorHelper.parseColor(windowProperties.getString(TiC.PROPERTY_BAR_COLOR));
actionBar.setBackgroundDrawable(new ColorDrawable(color));
}
}
}

@Override
Expand Down

0 comments on commit 98718ac

Please sign in to comment.