본문 바로가기

테마강좌

[블박의 테마강좌]SystemUI - 밝기바를 넣어보자

336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

흔히 말하는 밝기 슬라이더바 몇몇의 폰에서는 지원이 안된 기능이죠

그래서 한번 넣어보겠습니다 :)

난이도는 ★★☆☆☆

일단 몇몇 버그가 있습니다

CM9~CM10는 자동밝기가 되겠지만

ICS~JB의 몇몇 폰들은 자동밝기가 되지않습니다

그리고 자동밝기를 디스플레이에서 체크하실시 밝기바가 사라집니다 :)

자 바로 시작합니다 ~

필수항목


경험
디컴할 SystemUI 및 framework-res . apk
노트패드++
Apkmanager



이정 도면 되겠네요 :)


1.SystemUI.apk를 디컴파일하고 ids.xml을 수정하자
SystemUI를 디컴파일 합시다

그러시면 project 폴더안에 SystemUI라는 폴더가 뜨죠

그다음 /res/values폴더안에 있는 ids.xml을 열어줍시다

그리고 맨 마지막에 이 코드를 넣어줍시다

<item type="id" name="automatic">false</item>

이명령어를 써줍시다(칸에 맞추셔야합니다)


이렇게 말이죠


2.string.xml에다가 구문을 더 추가하자

일단 res/values폴더안에 있는 strings.xml을 열어줍시다

그다음 마지막에 이코드를 넣어줍시다

<string name="brightness_settings_automatic">AUTO</string>

<string name="brightness_settings_title" />

이번에도 칸에 맞춰서 넣어주세요

여기서 자신이 한글로 번역하신걸 보여주고 싶으시면

res/values-ko/strings.xml을 수정하시면 됩니다(똑같은 코드를 넣으시고 AUTO가 아닌 자동으로 쓰시면됩니다 )

자 이렇게 해서 xml들을 수정해보았습니다

좀 어려우실지도 모르겠지만 최대한 쉽게 제가 쓴겁니다 ㅎㅎ...


자~ 이제 여기서 CM9(ICS)와 CM10(JB)로 나눠집니다.

CM 9부터 시작하겠습니다 :)


3-1.CM9는 이방법으로 해주세요

res/layout/status_bar_expanded.xml를 열어줍시다

그러시면

<?xml version="1.0" encoding="utf-8"?>

<com.android.systemui.statusbar.phone.ExpandedView android:orientation="vertical" android:focusable="true" android:descendantFocusability="afterDescendants"

  xmlns:android="http://schemas.android.com/apk/res/android"

  xmlns:systemui="http://schemas.android.com/apk/res/com.android.systemui">

    <LinearLayout android:orientation="vertical" android:background="@drawable/notification_header_bg" android:layout_width="fill_parent" android:layout_height="wrap_content">

        <com.android.systemui.statusbar.powerwidget.PowerWidget android:id="@id/exp_power_stat" android:layout_width="fill_parent" android:layout_height="wrap_content" />

        <RelativeLayout android:paddingTop="3.0dip" android:paddingRight="3.0dip" android:paddingBottom="5.0dip" android:layout_width="fill_parent" android:layout_height="52.0dip">

            <com.android.systemui.statusbar.policy.DateView android:textAppearance="@style/TextAppearance.StatusBar.Date" android:gravity="left|center" android:id="@id/date" android:paddingLeft="16.0dip" android:layout_width="wrap_content" android:layout_height="fill_parent" android:singleLine="true" android:layout_alignParentLeft="true" />

            <ImageView android:id="@id/settings_button" android:paddingLeft="8.0dip" android:paddingRight="8.0dip" android:layout_width="wrap_content" android:layout_height="fill_parent" android:src="@drawable/ic_notify_quicksettings" android:layout_toRightOf="@id/date" android:contentDescription="@string/accessibility_settings_button" />

            <ImageView android:id="@id/clear_all_button" android:paddingLeft="8.0dip" android:paddingRight="8.0dip" android:layout_width="wrap_content" android:layout_height="fill_parent" android:src="@drawable/ic_notify_clear" android:layout_alignParentRight="true" android:contentDescription="@string/accessibility_clear_all" />

        </RelativeLayout>

   <include layout="@layout/adi_brightness" />

   </LinearLayout>

    <View android:background="@drawable/status_bar_hr" android:layout_width="fill_parent" android:layout_height="2.0dip" />

    <FrameLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="1.0">

        <TextView android:textAppearance="@*android:style/TextAppearance.Large" android:gravity="left" android:layout_gravity="top" android:id="@id/noNotificationsTitle" android:padding="8.0dip" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/status_bar_no_notifications_title" />

        <ScrollView android:id="@id/scroll" android:fadingEdge="none" android:layout_width="fill_parent" android:layout_height="fill_parent" android:overScrollMode="ifContentScrolls">

            <LinearLayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="wrap_content">

                <com.android.systemui.statusbar.policy.NotificationRowLayout android:id="@id/latestItems" android:layout_width="fill_parent" android:layout_height="wrap_content" systemui:rowHeight="@dimen/notification_height" />

            </LinearLayout>

        </ScrollView>

        <ImageView android:layout_width="fill_parent" android:layout_height="fill_parent" android:src="@drawable/title_bar_shadow" android:scaleType="fitXY" />

    </FrameLayout>

</com.android.systemui.statusbar.phone.ExpandedView>

이렇게 되어있는데 빨간줄에 있는 명령어를 저위치에 넣어주세요(폰마다 위치가 다르지만 CM9에서는 이렇게 되어있습니다 :)


3-2 CM10은 이렇게 해주세요

CM9과 같게 res/layout/status_bar_expaned.xml을 열어줍시다


이렇게 써주세요(제가 이미지로 한이유는 자꾸 쓰는데 오류나 나네요;;ㅋㅋ)


자 이제 거의 끝났네요 파이팅!!


4.CM10만 이걸 따라해주세요(CM9는 하지 마시고요)

res/layout/status_bar_expaned_header를 열어주세요

그리고

<LinearLayout android:gravity="center_vertical" android:orientation="horizontal" android:background="#ff000000" android:layout_width="fill_parent" android:layout_height="wrap_content" android:baselineAligned="false"

이렇게 android_background="#ff000000"이렇게 써주세요



5.마지막으로 파일들을 넣어보자

이파일들을 다운받아주셔야 하는데

핸드폰 해상도에 따라 다릅니다

자신의 폰 해상도를 알고싶으시면 찾아보시는 편이 나으리라고 믿습니다 :)


Source_Brightness_HDPI

Source_Brightness_XHDPI

Source_Brightness_MDPI

Source_Brightness_LDPI


자 이제 다운로드 다 받으셨죠??

그걸 열어보시면 res/...이렇게 되어있으실겁니다(다운로드 하신거에 따라 달라요 :)

그걸 자신의 프로젝트 SystemUI/에 넣어줍시다

폴더가 꼭 겹쳐야합니다(여기서 이말은 SystemUI폴더안에 있는 res폴더등 위에 그대로 올리시라는 말이죠

그상태로 덮어쓰기 하시면됩니다

마지막으로 디컴파일을 하신뒤 테스트를 해보세요 :)

밝기 슬라이더바가 생겼을것입니다 ㅎㅎ

수고하셨습니다 다음강좌에 뵈요~ :)

출처:

http://forum.xda-developers.com/showthread.php?p=41150037