Or Continue to Thread: [Q] Adding a Status Bar signal…
Find Your Device:
17th February 2014, 09:07 AM   |  #1  
gakio12's Avatar
OP Senior Member
Thanks Meter: 103
 
178 posts
Join Date:Joined: Dec 2011
Donate to Me
I hope this is the correct forum

I am doing this to Cyanogenmod 11.

I want to add an option to Settings > Interface > Status Bar > Signal Status Style. I am so close to having it done, but there is one thing I am missing, and that is actually getting the radio button to switch the Icon to the correct .java. Here is what I have done so far:

Added to Setting/res/values/cm_strings.xml;
Code:
<string name="status_bar_signal_style_always">Always show type</string>
Added two lines to Settings/res/values/cm_arrays.xml;(marked with *'s)
Code:
<string-array name="entries_status_bar_signal" translatable="false">
        <item>@string/status_bar_signal_style_icon</item>
        <item>@string/status_bar_signal_style_text</item>
       *<item>@string/status_bar_signal_style_always</item>
        <item>@string/status_bar_style_hidden</item>
    </string-array>

    <string-array name="values_status_bar_signal" translatable="false">
        <item>0</item>
        <item>1</item>
        <item>2</item>
       *<item>3</item>
    </string-array>
Created a new java file named SignalClusterAlwaysView.java in SystemUI/src/com/android/systemui/statusbar and signal_cluster_always_view.xml in SystemUI/res/layout, respectively;

Added to SystemUI/res/layout/status_bar.xml;
Code:
<include layout="@layout/signal_cluster_always_view"
                    android:id="@+id/signal_cluster_always"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    />
Added (changed STYLE_HIDDEN to 3) in SystemUI/src/com/android/systemui/statusbar/SignalClusterView.java.
Code:
public static final int STYLE_ALWAYS = 2;
Really all I am trying to do is create a setting to show network type even while WiFi is connected. This is accomplished by simply clearing this line from SignalClusterView.java,
Code:
mMobileType.setVisibility(
                !mWifiVisible ? View.VISIBLE : View.GONE);
and changing android:layout_marginEnd to 3dip in signal_cluster_view.xml.

I can't seem to figure out how the existing setting for a text only network icon sends that to SystemUI. I've explored StatusBar.java in the Settings.apk source, and I think the issue may be in this line,
Code:
int signalStyle = Settings.System.getInt(resolver, Settings.System.STATUS_BAR_SIGNAL_TEXT, 0);
where it is setting the value of the option selected to Settings.System.STATUS_BAR_SIGNAL_TEXT. I think it is properly setting the value to 2, like I want, but it still sees 2 as HIDDEN instead of ALWAYS; or that it does see I want ALWAYS, but doesn't know to refer to SignalClusterAlwaysView.java in SystemUI.

What am I missing? Is there an easier way to do this?


Sorry if this is in the wrong thread.