Reputation: 1063
I have a status bar signal icon that I would like to make an option in Settings.apk on Cyanogenmod. The setting is there, and assigns the correct int value to STATUS_BAR_SIGNAL, I just can't figure out how to execute my new icon once that option is selected.
Currently, without my new option, there are 3 options; Icon, Text, and Hidden. Icon shows the stock Icon, Text shows a dBm value of the signal, and Hidden hides the signal icon. The int assignments are: Icon = 0, Text = 1, Hidden = 2 in android.provider.Settings.System.
There are, without my icon, two java files in SystemUI.statusbar; SignalClusterView.java and SignalClusterTextView.java.
My new option is Always, and I assigned it 2, and moved Hidden to 3. However, 2 and 3 don't lead to a new icon, resulting in a hidden icon.
I made a new icon in SystemUI.statusbar, SignalClusterAlwaysView.java, but I am unsure of what needs to be in my java file to enable it once STATUS_BAR_SIGNAL is changed to 2.
How do I make my new icon execute if STATUS_BAR_SIGNAL = 2?
Upvotes: 1
Views: 1942
Reputation: 1063
Well I figured it out; not sure how it links, but it does.
I needed to create my code under
public void setStyle(int style) {
mSignalClusterStyle = style;
updateVisibilityForStyle();
Or something similar in my code for my icon.
style
retrieves the value stored in Settings.System.STATUS_BAR_SIGNAL, and uses public int to define which each one means, so in my case I had to add;
public static final int STYLE_ALWAYS = 2;
to the top of of the main SignalClusterView.java.
So I ended up with something along the lines of:
if (mSignalClusterStyle == STYLE_ALWAYS) {
mMobileType.setVisibility(View.VISIBLE);
}
else if (!mIsAirplaneMode && mMobileGroup != null) {
mMobileGroup.setVisibility(mSignalClusterStyle != STYLE_NORMAL
? View.GONE : View.VISIBLE);
}
Upvotes: 0