EXODUS_Q™
14.09.09
조회 수 7848
추천 수 11
댓글 20

▽Original Thread 


http://forum.xda-developers.com/galaxy-s2/themes-apps/guide-how-to-create-button-notification-t2730988


Thanks to:"gerryS2"


 


 


》이것은 [퀵패널]에 갤럭시S5퀵패널에 있는 "S파인더" "퀵커넥트"버튼을 추가하는 방법입니다.


(실제 S파인더와 퀵커넥트는 아니고, Activity를 이용한 "바로가기"버튼이라고 이해하시면 됩니다.)


 


》디컴파일/컴파일이 가능한 분들에게 해당됩니다.


 


》이 작업에 필요한 파일은 SystemUI.apk입니다.


 


》엥간하면 컴퓨터로 보시기 바랍니다.(빨간색 구문을 확인해야 합니다.)


 


 


 


1.First decompile SystemUI, go to res/layout, open tw_status_bar_expanded.xml and add the red line:


#아래 보이는 빨간색 구문을


SystemUI.apk/res/layout/tw_status_bar_expanded.xml의 저 위치에 추가하세요.



 




Code:
<HorizontalScrollView android:id="@id/quicksetting_scroller" android:scrollbars="none" android:layout_width="wrap_content" android:layout_height="wrap_content">                    <com.android.systemui.statusbar.policy.quicksetting.QuickSettingPanel android:orientation="horizontal" android:id="@id/quicksetting_container" android:layout_width="wrap_content" android:layout_height="wrap_content" android:divider="@drawable/tw_black_bg" android:showDividers="middle" />
</HorizontalScrollView>
<LinearLayout android:orientation="vertical" android:id="@id/sfinder_qconnect_layout" android:visibility="visible" android:layout_width="fill_parent" android:layout_height="wrap_content">
<LinearLayout android:gravity="center_vertical" android:orientation="horizontal" android:paddingLeft="@dimen/finder_connect_button_padding_right" android:paddingTop="@dimen/finder_connect_button_padding_top" android:paddingRight="@dimen/finder_connect_button_padding_left" android:paddingBottom="@dimen/finder_connect_button_padding_bottom" android:layout_width="fill_parent" android:layout_height="wrap_content">
<Button android:textSize="@dimen/tw_quick_panel_sfinder_qconnect_button_text_size" android:textColor="@drawable/tw_quick_panel_sfinder_qconnect_button_text_color" android:id="@id/sfinder_button_big" android:background="@drawable/tw_quick_panel_sfinder_qconnect_button" android:layout_width="0.0dip" android:layout_height="@dimen/finder_connect_button_height" android:layout_marginRight="10.0dip" android:text="@string/big_button_barra" android:layout_weight="0.5" />
<Button android:textSize="@dimen/tw_quick_panel_sfinder_qconnect_button_text_size" android:textColor="@drawable/tw_quick_panel_sfinder_qconnect_button_text_color" android:id="@id/qconnect_button_big" android:background="@drawable/tw_quick_panel_sfinder_qconnect_button" android:layout_width="0.0dip" android:layout_height="@dimen/finder_connect_button_height" android:layout_marginLeft="10.0dip" android:text="@string/big_button_panel" android:layout_weight="0.5" />
</LinearLayout>
<View android:id="@id/sfinder_qconnect_divider" android:background="@drawable/notification_bottom_line" android:layout_width="fill_parent" android:layout_height="1.0dip" />
</LinearLayout>

<LinearLayout android:orientation="vertical" android:id="@id/brightness_controller" android:background="#ff000000" android:layout_width="fill_parent" android:layout_height="56.0dip">
<LinearLayout android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="55.0dip">
<ImageView android:id="@id/brightness_icon" android:clickable="true" android:layout_width="25.0dip" android:layout_height="fill_parent" android:layout_marginLeft="13.0dip" android:src="@drawable/ic_sysbar_brightness" android:contentDescription="@string/accessibility_brightness_icon" />
<FrameLayout android:id="@id/brightness_group" android:layout_width="fill_parent" android:layout_height="fill_parent">
<com.android.systemui.statusbar.policy.ToggleSlider android:id="@id/brightness" android:layout_width="fill_parent" android:layout_height="fill_parent" systemui:text="@string/status_bar_settings_auto_brightness_label" />
<com.android.systemui.statusbar.policy.ToggleSlider android:id="@id/auto_brightness" android:layout_width="fill_parent" android:layout_height="fill_parent" systemui:text="@string/status_bar_settings_auto_brightness_label" />
</FrameLayout>
</LinearLayout>
<View android:background="#ff091a24" android:layout_width="fill_parent" android:layout_height="1.0dip" />
</LinearLayout>

 


 



2.Now go to values folder and add this line in this files.


#res/values폴더의 ids.xml/dimens.xml/strings.xml에 각각 아래 해당되는 구문을 맨 밑 </resources>바로 위에 추가하세요.



 


-In ids.xml:


Code:
    <item type="id" name="sfinder_qconnect_layout">false</item>
<item type="id" name="sfinder_button_big">false</item>
<item type="id" name="qconnect_button_big">false</item>
<item type="id" name="sfinder_qconnect_divider">false</item>

 


 


-In dimens.xml 



Code:
    <dimen name="finder_connect_button_padding_top">11.0dip</dimen>
<dimen name="finder_connect_button_padding_bottom">10.0dip</dimen>
<dimen name="finder_connect_button_padding_right">20.0dip</dimen>
<dimen name="finder_connect_button_padding_left">20.0dip</dimen>
<dimen name="finder_connect_button_height">37.0dip</dimen>
<dimen name="tw_quick_panel_sfinder_qconnect_button_text_size">16.0dip</dimen>

 


 


-In strings.xml 


#만약, 퀵패널에 추가될 버튼 글자를 "한글"로 표기하고자 할때는,


res/values-ko폴더를 열어 strins.xml에 아래와 같은 구문을 똑같이 맨 밑에 추가해주고,


Display와 sound 글자를 원하는 한글로 수정해주면 됩니다.



Code:
<string name="big_button_barra">Display</string>
<string name="big_button_panel">Sound</string>

 


 


    


3.Add the res files in drawable and drawable-hdpi.


#이 게시글에 첨부된 [Button Files]를 압축풀면 res폴더에 drawable/drawable-hdpi폴더 두개가 나옵니다.


drawable폴더안의 파일은 drawable에 넣으면 되고,


drawable-hdpi폴더안의 파일은 각자 폰의 해상도에 맞는 dpi폴더에 넣으세요.(노트1_drawable-xhdpi)


 


 



4.Recompile SystemUI and decompile for insert the value of ids in public.xml


#여기서 일단, SystemUI.apk를 "컴파일"하세요.


그리고, 컴파일된 UnsignedSystemUI.apk를 다시 디컴파일 하여


UnsignedSystemUI.apk/res/values/public.xml을 일단 열어두세요.


이건, 새로 추가한 "버튼 이미지"의 public.xml값을 알아야 다음 작업을 진행할수 있기 때문입니다.


(트윜 포팅할때 자주 사용하는 방법이기도 하죠.)


 


 



5.Now there is the smali part.


Go to smali/com/android/systemui/statusbar/phone and open PhoneStatusbar.smali


#이 작업은 계속 SystemUI.apk로 하는 작업 smali입니다.


(UnsignedSsytemUI.apk와 헷갈리면 안됩니다.)


먼저,


SystemUI/smali/com/android/systemui/statusbar/phone and open PhoneStatusbar.smali를 열어


# instance fields의 맨밑에 아래 두 구문을 추가하세요.


 



 




Code:
.field private mBigButtonListener:Landroid/view/View$OnClickListener;

.field private mBigButtonListener2:Landroid/view/View$OnClickListener;

 


 



6.Add the red line at the end of the .method public constructor <init>()V


#같은 PhoneStatusbar.smali에서 .method public constructor <init>()V


이 메소드를 찾아


메소드의 맨 밑에 아래 빨간색 구문을 추가하세요. 



 




Code:
new-instance v0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar$X1;

invoke-direct {v0, p0}, Lcom/android/systemui/statusbar/phone/PhoneStatusBar$X1;-><init>(Lcom/android/systemui/statusbar/phone/PhoneStatusBar;)V

iput-object v0, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mBigButtonListener:Landroid/view/View$OnClickListener;

new-instance v0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar$X2;

invoke-direct {v0, p0}, Lcom/android/systemui/statusbar/phone/PhoneStatusBar$X2;-><init>(Lcom/android/systemui/statusbar/phone/PhoneStatusBar;)V

iput-object v0, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mBigButtonListener2:Landroid/view/View$OnClickListener;

return-void
.end method


 


 


7.Add the red line in .method protected makeStatusBarView()Lcom/android/systemui/statusbar/phone/PhoneStatusBarView;


#이것 역시 PhoneStatusbar.smali에서 


.method protected makeStatusBarView()Lcom/android/systemui/statusbar/phone/PhoneStatusBarView;


이 메소드를 찾아서,


아래 빨간색 구문을 저 위치에 추가하세요.


(비슷한 구문들이 여러개 있기 때문에 정확하게 잘 찾아서 추가해야 합니다.)


 



 




Code:
iget-object v9, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mStatusBarWindow:Lcom/android/systemui/statusbar/phone/StatusBarWindowView;

const v10, 0x7f0d0051

invoke-virtual {v9, v10}, Lcom/android/systemui/statusbar/phone/StatusBarWindowView;->findViewById(I)Landroid/view/View;

move-result-object v9

iput-object v9, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mSettingsButton:Landroid/view/View;

iget-object v9, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mSettingsButton:Landroid/view/View;

iget-object v10, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mSettingsButtonListener:Landroid/view/View$OnClickListener;

invoke-virtual {v9, v10}, Landroid/view/View;->setOnClickListener(Landroid/view/View$OnClickListener;)V

iget-object v9, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mStatusBarWindow:Lcom/android/systemui/statusbar/phone/StatusBarWindowView;

const v10, 0x7f0d01ea

invoke-virtual {v9, v10}, Lcom/android/systemui/statusbar/phone/StatusBarWindowView;->findViewById(I)Landroid/view/View;

move-result-object v9

check-cast v9, Landroid/widget/Button;

iget-object v10, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mBigButtonListener:Landroid/view/View$OnClickListener;

invoke-virtual {v9, v10}, Landroid/widget/Button;->setOnClickListener(Landroid/view/View$OnClickListener;)V

iget-object v9, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mStatusBarWindow:Lcom/android/systemui/statusbar/phone/StatusBarWindowView;

const v10, 0x7f0d01eb

invoke-virtual {v9, v10}, Lcom/android/systemui/statusbar/phone/StatusBarWindowView;->findViewById(I)Landroid/view/View;

move-result-object v9

check-cast v9, Landroid/widget/Button;

iget-object v10, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mBigButtonListener2:Landroid/view/View$OnClickListener;

invoke-virtual {v9, v10}, Landroid/widget/Button;->setOnClickListener(Landroid/view/View$OnClickListener;)V


 


 


 


8.0x7f0d01ea is the public id of "sfinder_button_big"
0x7f0d01eb is the public id of "qconnect_button_big"


#여기서 중요합니다.


아까 UnsignedSystemUI.apk/res/values/public.xml을 열어두라고 했죠.


방금 위에서 추가한 빨간색 구문중에 0x7f0..으로 시작되는 구문이 두개 포함돼 있습니다.


처음에 나오는 값은 "sfinder_button_big"의 값이여야하고,


두번째 나오는 값은 "qconnect_button_big"값이여야 합니다.


그 두 값을 아까 열어두라고 했던 UnsignedSystemUI.apk/res/values/public.xml에서 각각 찾아


7번에서 추가한 빨간색 구문에 있는 값과 바꿔주면 됩니다. 



 



9.Now add the file of smali folder.


#첨부된 [Button Files]안에 smali폴더가 있는데 쭉쭉~ 들어가보면 두개의 smali파일이 있습니다.


PhoneStatusBar$X1.smlai


PhoneStatusBar$X2.smlai


→SystemUI/smali/com/android/systemui/statusbar/phone폴더에 그 두개의 smali파일을 넣어주세요.


 


 


 


10.If you want to change the intent of the button, you must open the two smali files(PhoneStatusbar$X1 and PhoneStatusbar$X2) and change the parts highlighted in red, adding the names of the resulting applications and tasks that you want to open.


#이게 무슨말이냐하면,


방금 위 9번에서 추가한 두개의 smali파일을 각각 열어보면,


(아래 예시에 있는 smali는 PhoneStatusBar$X1.smlai입니다.)


아래와 같은 빨간색 구문들이 적혀 있습니다.


이것은 퀵패널에 추가하는 두개의 버튼중에서 왼쪽에 있는 버튼(PhoneStatusBar$X1.smlai)을 터치했을때,


→환경설정/"디스플레이 설정(com.android.settings.Settings$DisplaySettingsActivity)창이 열리게 설정돼 있습니다.


마찬가지 개념으로 오른쪽에 추가될 버튼((PhoneStatusBar$X2.smlai)을 터치하면,


→환경설정/"소리 설정(com.android.settings.Settings$SoundSettingsActivity)창이 열리게 설정돼 있습니다.


따라서,


두개의 smlai를 열어 사용자가 원하는 "바로가기(Activity)"를 각각 마음대로수정할수 있다는 뜻입니다.



 




Code:
new-instance v2, Landroid/content/Intent;

invoke-direct {v2}, Landroid/content/Intent;-><init>()V

const-string v3, "android.intent.action.MAIN"

invoke-virtual {v2, v3}, Landroid/content/Intent;->setAction(Ljava/lang/String;)Landroid/content/Intent;

const/high16 v4, 0x1000

invoke-virtual {v2, v4}, Landroid/content/Intent;->setFlags(I)Landroid/content/Intent;

const-string v5, "com.android.settings"

const-string v6, "com.android.settings.Settings$DisplaySettingsActivity"

invoke-virtual {v2, v5, v6}, Landroid/content/Intent;->setClassName(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;

move-result-object v2

invoke-virtual {v1, v2}, Landroid/content/Context;->startActivity(Landroid/content/Intent;)V

iget-object v1, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar$X1;->this$0:Lcom/android/systemui/statusbar/phone/PhoneStatusBar;

invoke-virtual {v1}, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->animateCollapse()V


 


 


11.끝.


컴파일 하세요.


 


 


감사합니다.^^

EXODUS_Q™ 님의 SIGNATURE

profile
Just Do It.
댓글 20
  • profile



    첨부파일은, xda게시글에 있는 파일을 다운로드하세요.^^(이 게시글을 수정하면...원상복구?가 안됩니다.)


     

  • profile
    응용할 수 있다는게 엄청 구미가 땡기네요ㅎㅎ
  • profile
    그렇죠..퀵앱 못지않게 사용자가 원하는 스타일로 다양하게 응용 가능하다는게 저도 맘에 드는 부분입니다.^^
  • ?
    멋지십니다~~ 즐겨찾기부분은 퀵앱이고 말씀하신부분이 윗한글부분인듯 하네용~~ 두가지 만들어 주세용~~~^^ 염치없이 부탁드립니다~~ㅎ 즐겨찾기 퀵앱부분이라동 ㅎㅎ
  • ?
    오혹...이런 언어들을 보면 어질어질...^^ 오늘 머 보내주신다고 했는데 멀 보내주실거예요? S파인더는 S노트로...퀵커넥터는...퀵커맨더(빠른실행)...이렇게 넣어두면 편하겠네요.
  • profile
    저 여쭤볼게 있습니다 마지막에 컴파일 할 때 SystemUI만 컴파일해야하나요 아님 unsignedSystemUI도 컴파일 해야하나요???
  • profile
    UnsignedSystemUI.apk를 디컴파일하는 목적은, public.xml에서 두 버튼의값을 알아내기 위함이죠.그 작업이 끝나면 UnsignedSystenUI.apk는 더이상 필요없구요~...결국, 마지막엔 SystemUI.apk만 컴파일 하면 됩니다.^^
  • profile
    음...뮤직플레이어/KWeather포함해서 이것저것 자질구레하게 수정한(업그레이드?) 파일 몇개 보내려구요~근데,오늘은 힘들것같고...이번주안에 다 보내께요~^^
  • profile
    그렇군요 답변 감사합니다^^
  • ?
    Suxen
    14.09.10
    버튼달기 성공했습니다~! 그런데 PhoneStatusBar$X1.smali 하고 PhoneStatusBar$X2.smali 둘다 넣었는데도, 버튼 두개 다 아무반응이없네요.. 쨌든 강좌 쉽게써주셔서 감사합니다~^^
  • profile
    public.xml값과 smali값이 같은지 다시한번 비교해보세요~^^
  • ?
    Suxen
    14.09.10
    컴파일을 하고나면 smali 수정한것들이 싹다 날아가고 원래대로 돌아오네요 허...
  • profile
    To:Suxen... 헠...어케 하셨길래 smali가 다 날라갔죠!?
  • ?
    Suxen
    14.09.10
    그러게말입니다.. 계속적용이안되길래 디컴파일하고난후에 수정 다하고 컴파일하고 투척할거 다 투척하고 다시 디컴해보니까 smali만 날아가더라는...
  • profile
    To:Suxen... smali가 날라갔다는 표현이...smali폴더는 그대로 있는데, 수정했던 내용들이 다시 원래대로 돼있더란 표현이죠~?
  • ?
    Suxen
    14.09.10
    네. PhoneStatusbar.smali 를 수정한내용들은 싹다 사라지고 PhoneStatusBar$X1.smali 하고 PhoneStatusBar$X2.smali 는 아예 없어져버리네요ㅠ
  • profile
    To Suxen... 이해가 안가네요. smali수정할때 Notepad++로 수정한후 저장 하셨을거고... 두개의 smlai파일은 해당 폴더에 그냥 넣어주면 되고... 그런데도 컴파일 하고나면 수정된 내용이 원래대로 돼있고, 두개의 smali파일이 온데간데 없다는 말씀인데... 하아~~~저도 도무지 뭔지 감이 안오네요.ㅠㅠ
  • ?
    Suxen
    14.09.10
    모르신다면 어쩔수없죠..ㅠ 계속 원상태로 돌아가서 장식용버튼으로만 놔두는걸로 해야겠습니다 하하
  • ?
    태블릿 탭프로에 이식해보려하는데 처음부터 막히네요 ㅠㅠ tw_status_bar_expanded.xml 게 없네요 ㄷㄷㄷ
  • ?
    킷캣4.4.4도 방법이 동일 한가요??
댓글 쓰기 권한이 없습니다.
최신순 목록 검색 쓰기
등록된 글이 없습니다.
1 - 2