Beta 2.0 introduced a new way of saving Activity-specific settings. The TTSB settings code. With this code you can easily share, backup and copy settings from one device to another, from one app to another, from one Activity to another, and so on. Also you can change values more precisely when you're experienced with the TTSB settings code than you can with the UI (although the UI should work in 90% of planned cases).
TTSB settings code is structured as a multi-splitted
There are 4 levels of structure, each level with it's own markers and sperators (so you can exactly know in which level the code you're looking at is).
The first level is the easiest.
There are general values saved, the most important values for TTSB, if you want - the tinting values.
So there's the value
status, which can be either
0 means, the status bar will not be tinted, and
1 means, it will.
If last case is true, there's also the value
s_color - the color code for the status bar. Can be either
#RRGGBB, but I recommend using alpha as it is automatically parsed to color with alpha and otherwise it could confuse a bit when there appear new numbers coming from nowhere.
The same is for navbar, too -
n_color for the color.
You may see that the value is entered behind a colon.
The multiple values are separated with a semicolon.
So, as an example, a simple code line would look like this:
This will tint the status bar red and the navigation bar transparent.
There are 2 more values,
n_plus, these are
int values, that expand the status/nav bar background's height for the specified value in pixels.
This is helpful to hide the annoying one-pixel-line in many many ActionBars.
Now we get a bit more complicated, you should have heard the term
View and what it stands for programmatically to proceed without hundreds of question marks in your mind.
TTSB code offers you a default set of three views where you can apply extra settings to, settings like “move layout to fit status bar height”.
This is required because TTSB removes the unused layout space behind the status bar and everything inside the app moves into it.
Use the setting code command
view to start a
After the colon behind
view, you're now in a level-2-setting.
The separator between command and value is now
>, the separator between settings is a comma.
ViewSettingsPack knows 4 necessary settings:
from: One of the values
cview (for more info, see below). This is the first View where TTSB should start counting the next setting -
levels. This is an signed
int value, saying how many levels TTSB should go down or up to find the View you're looking for. It uses
getParent() for negative and
getChildAt(0) for positive
levels to find the view.
childindexes: This is if you come to the point where the View you're looking for is not at child position 0 of another View, but maybe at 1 or 182. You can either specify just one single
int value defining which child index TTSB should use at any call of
getChildAt(childindex), or you can pass an
int array, which will be worked from 0 to it's end with every call of
The array is then a level-3-setting: the separator for values here is
Now, the last and most important one:
settings: Here are located the settings for this view, also as level-3-settings. The separator between command and value here is
=, by the way.
Here you can set 3 more values:
setFSW to either
=1 to set the
fitsSystemWindows attribute of this View to
setCTP to set the
clipToPadding attribute in the same way, and
padding to set the padding of the View.
Padding becomes a bit more complex because it is the only level-4-setting - it has 4 sides.
Padding is set by
padding=left@top@right@bottom. The values between the
ints defining the padding in
You can add also the following dynamic constants:
At top padding you can set
actionbar_h to add the status bar/ActionBar height to padding.
At the right you can add
+nav_w to add the navigation bar width when it is at the right of the screen (landscape mode).
And at the bottom you can add
+nav_h to add the nav bar height.
You can set the settings of
cview (most time the best choice, it's the first view inside of the Activity's layout content),
content (the Content View set by
setContentView(View view), and
decview (the “Decor View”, the outest View of all, containing everything, including content behind status bar etc.) also directly, without using
view:(...), by just writing
content:(...) and just directly writing the
The settings you can set to them are only the level-3-settings from the
settings setting, without the command
How can I know which View I have to tint? Most time it is a try-and-error process and needs it's time, but there is a helper inside TTSB, if you have access to LogCat log files of Android. TTSB prints at every start of an Activity the full layout tree of this Activity, so you can see where which View is.
For example I'm taking the difficult Twitter MainActivity. It uses completely different settings than every other Activity from Twitter (all the others are working fine with the automatic option).
The default setting for Twitter should be:
This is our starting point for changing it to a working one.
The LogCat output is:
>TTSB: [ INFO: ] Activity is com.twitter.android.MainActivity >TTSB [VIEWTEST] ┕com.android.internal.policy.impl.PhoneWindow$DecorView >TTSB [VIEWTEST] ┕╾android.widget.LinearLayout >TTSB [VIEWTEST] ┕╾╾android.view.ViewStub >TTSB [VIEWTEST] ┕╾╾android.widget.FrameLayout (ContentView) >TTSB [VIEWTEST] ┕╾╾╾com.twitter.internal.android.widget.HiddenDrawerLayout >TTSB [VIEWTEST] ┕╾╾╾╾android.widget.LinearLayout >TTSB [VIEWTEST] ┕╾╾╾╾╾android.widget.LinearLayout >TTSB [VIEWTEST] ┕╾╾╾╾╾╾android.widget.ImageView >TTSB [VIEWTEST] ┕╾╾╾╾╾android.view.View >TTSB [VIEWTEST] ┕╾╾╾╾╾com.mobeta.android.dslv.DragSortListView > [...]
As you can see, the
cview would be the 5th one in the list (the one starting with
It seems like it doesn't work.
content, to get the one marked with
ContentView, does also not work.
So you should consider using a
The finally working code is:
Just to describe, you can do this also with the
view command instead of the direct commands:
ContentView is at level 2 below the
DecorView (you can see this at the bars in front of the View name).
But it is not the first child of the first
LinearLayout, it is the second.
So we have to set
The code would be:
childindexes is zero-based, while
This code does also work very nice.
Most of this you can add by using the Advanced UI - but it can be very helpful to know, what every setting does. Now, thank you for taking time for reading this long article, if you really did. Have fun with the TTSB-produced look and feel of your KitKat smartphone!