[GUIDE] Header Machine

July 06, 2017
 Header machine asus zenfone 4s

Screenshot:
headermachine

headermachine

headermachine

headermachine

headermachine


Feature:
Header BG with option (Default, Color, BG Picker, Timer/Omni)
Header BG Timer/Omni style (Default, Modern, Poly)
Header BG alpha
Header BG animation
Enable/disable blur BG
Add options to set date for Idul Fitri, Idul Adha and birthday
Add Blur BG preview

Requirement:
- Mengerti compile/decompile APK
- APKTool
- Notepad++ (PC)
- Bahan: Download

Step:
Part AsusSystemUI:
1. Decompile AsusSystemUI.apk
2. Letakkan smali dan res yg dari guide ke tempat masing".. Timpah aja bila yg sudah ada..
3. Buka AndroidManifest.xml
   Cari:
        <activity android:excludeFromRecents="true" android:name="com.android.keyguard.KeyguardIntruderView" android:screenOrientation="portrait" android:theme="@android:style/Theme.Translucent">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
            </intent-filter>
        </activity>

   Tambahkan dibawahnya:
        <activity android:theme="@android:style/Theme.Holo" android:label="Header Machine Preference" android:icon="@null" android:name="com.bamzzz.prefs.HeaderMachineActivity" android:excludeFromRecents="true" android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>

4. Buka res/layout/asus_status_bar_expanded_header.xml (Asus) atau status_bar_expanded_header.xml (Other phone)
   Cari:
<?xml version="1.0" encoding="utf-8"?>
<com.android.systemui.statusbar.phone.StatusBarHeaderView android:layout_gravity="@integer/notification_panel_layout_gravity" android:id="@id/header" android:background="@null" android:paddingBottom="@dimen/asus_quicksetting_panel_header_padding_bottom" android:focusable="true" android:clickable="true" android:layout_width="@dimen/notification_panel_width" android:layout_height="@dimen/asus_status_bar_header_height" android:baselineAligned="false" android:paddingStart="@dimen/notification_side_padding" android:paddingEnd="@dimen/notification_side_padding"
  xmlns:android="http://schemas.android.com/apk/res/android">
 
   Tambahkan tepat dibawahnya:
    <com.bamzzz.HeaderMachine android:id="@id/header_machine"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_gravity="center"
        android:scaleType="fitXY"
        android:adjustViewBounds="true" />

   Asus Only:
   Cari:
   <Button android:textSize="@dimen/asus_notification_clear_all_text_size" android:textColor="@color/asus_notification_clear_all_text_color" android:id="@id/clear_all_button" android:background="@drawable/ic_notify_clear" android:layout_width="wrap_content" android:layout_height="@dimen/asus_notification_clear_all_height" android:text="@string/status_bar_clear_all_button" android:layout_alignParentBottom="true" android:contentDescription="@string/accessibility_clear_all" android:fontFamily="sans-serif" android:layout_marginEnd="@dimen/asus_quicksetting_button_margin_right" android:layout_alignParentEnd="true" />
   Lalu tambahkan: android:layout_marginBottom="@dimen/asus_quicksetting_panel_header_padding_bottom"
   Hingga menjadi:
   <Button android:layout_marginBottom="@dimen/asus_quicksetting_panel_header_padding_bottom" android:textSize="@dimen/asus_notification_clear_all_text_size" android:textColor="@color/asus_notification_clear_all_text_color" android:id="@id/clear_all_button" android:background="@drawable/ic_notify_clear" android:layout_width="wrap_content" android:layout_height="@dimen/asus_notification_clear_all_height" android:text="@string/status_bar_clear_all_button" android:layout_alignParentBottom="true" android:contentDescription="@string/accessibility_clear_all" android:fontFamily="sans-serif" android:layout_marginEnd="@dimen/asus_quicksetting_button_margin_right" android:layout_alignParentEnd="true" />

5. Buka res/values/ids.xml
   Tambahkan:
    <item type="id" name="header_machine">false</item>
    <item type="id" name="header_machine_layout">false</item>
    <item type="id" name="header_machine_time_title">false</item>
    <item type="id" name="header_machine_idul_fitri_text">false</item>
    <item type="id" name="header_machine_idul_fitri_button">false</item>
    <item type="id" name="header_machine_idul_adha_text">false</item>
    <item type="id" name="header_machine_idul_adha_button">false</item>
    <item type="id" name="header_machine_birthday_text">false</item>
    <item type="id" name="header_machine_birthday_button">false</item>
    <item type="id" name="header_machine_background_title">false</item>
    <item type="id" name="header_machine_background_content">false</item>
    <item type="id" name="header_machine_checkBlur">false</item>
    <item type="id" name="header_machine_background_button_pick">false</item>
    <item type="id" name="header_machine_background_button_set">false</item>
    <item type="id" name="header_machine_tip_text">false</item>

6. Step ini tidak harus diterapkan !!! Khusus Asus Zenfone, berfungsi untuk menghilangkan background default atau bawaan tema:

   Buka smali/com/android/systemui/statusbar/phone/StatusBarHeaderView.smali
   Cari:
    # instance fields

   Tambahkan dibawahnya:
    .field private mHeaderMachine:I

   Cari:
    .method private setImageViewDrawable()V

   Kemudian cari:
    invoke-virtual {p0, v0}, Lcom/android/systemui/statusbar/phone/StatusBarHeaderView;->setBackground(Landroid/graphics/drawable/Drawable;)V

   Tambahkan diatasnya:
    iget v8, p0, Lcom/android/systemui/statusbar/phone/StatusBarHeaderView;->mHeaderMachine:I

    const/4 v9, 0x0

    if-ne v8, v9, :cond_brut

    const-string v8, "BamzzzHeaderMachine"

    new-instance v9, Ljava/lang/StringBuilder;

    invoke-direct {v9}, Ljava/lang/StringBuilder;-><init>()V

    const-string v10, "Header Machine disable -> "

    invoke-virtual {v9, v10}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v9

    iget v10, p0, Lcom/android/systemui/statusbar/phone/StatusBarHeaderView;->mHeaderMachine:I

    invoke-virtual {v9, v10}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v9

    invoke-virtual {v9}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v9

    invoke-static {v8, v9}, Landroid/util/Log;->i(Ljava/lang/String;Ljava/lang/String;)I

   Cari lagi yang tadi:
    invoke-virtual {p0, v0}, Lcom/android/systemui/statusbar/phone/StatusBarHeaderView;->setBackground(Landroid/graphics/drawable/Drawable;)V

   Lalu tambahkan dibawahnya:
    goto :goto_brutt

    :cond_brut
    const-string v8, "BamzzzHeaderMachine"

    new-instance v9, Ljava/lang/StringBuilder;

    invoke-direct {v9}, Ljava/lang/StringBuilder;-><init>()V

    const-string v10, "Header Machine enable -> "

    invoke-virtual {v9, v10}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v9

    iget v10, p0, Lcom/android/systemui/statusbar/phone/StatusBarHeaderView;->mHeaderMachine:I

    invoke-virtual {v9, v10}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v9

    invoke-virtual {v9}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v9

    invoke-static {v8, v9}, Landroid/util/Log;->i(Ljava/lang/String;Ljava/lang/String;)I

    const/4 v8, 0x0

    invoke-virtual {p0, v8}, Lcom/android/systemui/statusbar/phone/StatusBarHeaderView;->setBackgroundResource(I)V

    :goto_brutt

   Cari:
    .line 199
    .local v8, "paddingBottom":I
    const/4 v12, 0x0

    invoke-virtual {p0, v7, v12, v7, v8}, Lcom/android/systemui/statusbar/phone/StatusBarHeaderView;->setPaddingRelative(IIII)V

    .line 200
    return-void
  
   Diatasnya tambahkan:
    const/4 v8, 0x0

   Cari:
    .method public updateEverything()V

   Diatas return-void tambahkan:
    invoke-static {}, Lcom/bamzzz/HeaderMachine;->getVisibilities()I

    move-result v0

    iput v0, p0, Lcom/android/systemui/statusbar/phone/StatusBarHeaderView;->mHeaderMachine:I

    invoke-direct {p0}, Lcom/android/systemui/statusbar/phone/StatusBarHeaderView;->setImageViewDrawable()V

7. Recompile UI nya, jgn lupa di Sign dan zipalign. Push & Reboot.

8. Selesai


Part Settings:

Optional!!! Pilih salah satu, menggunakan ZenControl.apk (Lollipop only) atau dimasukin ke Settings.apk

Add Preference using ZenControl.apk :

1. Decompile ZenControl.apk

2. Buka dan tambahkan script dibawah ini di /res/xml/dropdown_prefs.xml

    <PreferenceScreen android:title="@string/header_machine_title" android:summary="@string/header_machine_summary">
        <PreferenceCategory android:title="@string/header_machine_title" />
        <com.wubydax.romcontrol.prefs.MyListPreference
            android:entries="@array/header_machine_style_entries"
            android:title="@string/header_machine_style_title"
            android:key="header_machine_style"
            android:defaultValue="3"
            android:entryValues="@array/header_machine_style_values" />
        <com.wubydax.romcontrol.prefs.MyListPreference
            android:entries="@array/header_machine_bg_style_entries"
            android:title="@string/header_machine_bg_style_title"
            android:key="header_machine_bg_style"
            android:defaultValue="1"
            android:entryValues="@array/header_machine_bg_style_values" />
        <com.wubydax.romcontrol.prefs.ColorPickerPreference
            android:title="@string/header_machine_color_title"
            android:key="header_machine_color"
            android:defaultValue="\#00000000"
            alphaSlider="true" />
        <com.wubydax.romcontrol.prefs.SeekBarPreference
            android:icon="@null"
            android:max="255"
            android:title="@string/header_machine_bg_alpha_title"
            android:key="header_machine_bg_image_alpha"
            android:defaultValue="100"
            min="0"
            unitsRight="" />
        <CheckBoxPreference
            android:defaultValue="false"
            android:title="@string/header_machine_bg_animated_title"
            android:key="header_machine_bg_animated"
            android:summaryOn="@string/header_machine_enable"
            android:summaryOff="@string/header_machine_disable" />
        <CheckBoxPreference
            android:defaultValue="false"
            android:title="@string/header_machine_bg_image_blur_title"
            android:key="header_machine_bg_image_blur"
            android:summaryOn="@string/header_machine_enable"
            android:summaryOff="@string/header_machine_disable" />
        <PreferenceScreen
            android:summary="@string/header_machine_preference_summary"
            android:title="@string/header_machine_preference_title">
            <intent
                android:targetClass="com.bamzzz.prefs.HeaderMachineActivity"
                android:targetPackage="com.android.systemui" />
        </PreferenceScreen>
    </PreferenceScreen>

3. Buka dan tambahkan script dibawah ini di res/values/strings.xml

    <string name="header_machine_title">Header Machine</string>
    <string name="header_machine_summary">Enable various bg options in expanded header</string>
    <string name="header_machine_style_title">Header Machine Style</string>
    <string name="header_machine_style_1_title">Default</string>
    <string name="header_machine_style_2_title">Color</string>
    <string name="header_machine_style_3_title">Custom Image</string>
    <string name="header_machine_style_4_title">Timer (OMNI)</string>
    <string name="header_machine_bg_style_title">Timer Background Style</string>
    <string name="header_machine_bg_style_1_title">Default</string>
    <string name="header_machine_bg_style_2_title">Modern</string>
    <string name="header_machine_bg_style_3_title">Poly HD</string>
    <string name="header_machine_color_title">Header Color</string>
    <string name="header_machine_bg_alpha_title">Header BG Alpha</string>
    <string name="header_machine_bg_animated_title">BG Animated</string>
    <string name="header_machine_bg_image_blur_title">Blur BG</string>
    <string name="header_machine_enable">Enable</string>
    <string name="header_machine_disable">Disable</string>
    <string name="header_machine_preference_title">Header Machine Preference</string>
    <string name="header_machine_preference_summary">Set Header Machine Date and Custom Image Background</string>

4. Buka dan tambahkan script dibawah ini di res/values/arrays.xml

    <string-array name="header_machine_bg_style_entries">
        <item>@string/header_machine_bg_style_1_title</item>
        <item>@string/header_machine_bg_style_2_title</item>
        <item>@string/header_machine_bg_style_3_title</item>
    </string-array>
    <string-array name="header_machine_bg_style_values" translatable="false">
        <item>0</item>
        <item>1</item>
        <item>2</item>
    </string-array>
    <string-array name="header_machine_style_entries">
        <item>@string/header_machine_style_1_title</item>
        <item>@string/header_machine_style_2_title</item>
        <item>@string/header_machine_style_3_title</item>
        <item>@string/header_machine_style_4_title</item>
    </string-array>
    <string-array name="header_machine_style_values" translatable="false">
        <item>0</item>
        <item>1</item>
        <item>2</item>
        <item>3</item>
    </string-array>

5. Recompile ZenControl..

6. Install ZenControl seperti apk normal


Add Preference include settings:

1. Terapkan guide ane sebelumnya: http://forum.xda-developers.com/zenfone-4/themes-apps/guide-easy-preference-control-t3317849

2. Buka dan tambahkan script dibawah ini di /res/xml/zen_prefs.xml

    <PreferenceScreen android:title="@string/header_machine_title" android:summary="@string/header_machine_summary">
        <com.android.settings.bamzzz.prefs.MyListPreference
            android:entries="@array/header_machine_style_entries"
            android:title="@string/header_machine_style_title"
            android:key="header_machine_style"
            android:defaultValue="3"
            android:entryValues="@array/header_machine_style_values" />
        <com.android.settings.bamzzz.prefs.MyListPreference
            android:entries="@array/header_machine_bg_style_entries"
            android:title="@string/header_machine_bg_style_title"
            android:key="header_machine_bg_style"
            android:defaultValue="1"
            android:entryValues="@array/header_machine_bg_style_values" />
        <com.android.settings.bamzzz.prefs.ColorPickerPreference
            android:title="@string/header_machine_color_title"
            android:key="header_machine_color"
            android:defaultValue="\#00000000"
            alphaSlider="true" />
        <com.android.settings.bamzzz.prefs.SeekBarPreference
            android:icon="@null"
            android:max="255"
            android:title="@string/header_machine_bg_alpha_title"
            android:key="header_machine_bg_image_alpha"
            android:defaultValue="100"
            min="0"
            unitsRight="" />
        <CheckBoxPreference
            android:defaultValue="false"
            android:title="@string/header_machine_bg_animated_title"
            android:key="header_machine_bg_animated"
            android:summaryOn="@string/header_machine_enable"
            android:summaryOff="@string/header_machine_disable" />
        <CheckBoxPreference
            android:defaultValue="false"
            android:title="@string/header_machine_bg_image_blur_title"
            android:key="header_machine_bg_image_blur"
            android:summaryOn="@string/header_machine_enable"
            android:summaryOff="@string/header_machine_disable" />
        <PreferenceScreen
            android:summary="@string/header_machine_preference_summary"
            android:title="@string/header_machine_preference_title">
            <intent
                android:targetClass="com.bamzzz.prefs.HeaderMachineActivity"
                android:targetPackage="com.android.systemui" />
        </PreferenceScreen>
    </PreferenceScreen>

3. Buka dan tambahkan script dibawah ini di res/values/strings.xml

    <string name="header_machine_title">Header Machine</string>
    <string name="header_machine_summary">Enable various bg options in expanded header</string>
    <string name="header_machine_style_title">Header Machine Style</string>
    <string name="header_machine_style_1_title">Default</string>
    <string name="header_machine_style_2_title">Color</string>
    <string name="header_machine_style_3_title">Custom Image</string>
    <string name="header_machine_style_4_title">Timer (OMNI)</string>
    <string name="header_machine_bg_style_title">Timer Background Style</string>
    <string name="header_machine_bg_style_1_title">Default</string>
    <string name="header_machine_bg_style_2_title">Modern</string>
    <string name="header_machine_bg_style_3_title">Poly HD</string>
    <string name="header_machine_color_title">Header Color</string>
    <string name="header_machine_bg_alpha_title">Header BG Alpha</string>
    <string name="header_machine_bg_animated_title">BG Animated</string>
    <string name="header_machine_bg_image_blur_title">Blur BG</string>
    <string name="header_machine_enable">Enable</string>
    <string name="header_machine_disable">Disable</string>
    <string name="header_machine_preference_title">Header Machine Preference</string>
    <string name="header_machine_preference_summary">Set Header Machine Date and Custom Image Background</string>

4. Buka dan tambahkan script dibawah ini di res/values/arrays.xml

    <string-array name="header_machine_bg_style_entries">
        <item>@string/header_machine_bg_style_1_title</item>
        <item>@string/header_machine_bg_style_2_title</item>
        <item>@string/header_machine_bg_style_3_title</item>
    </string-array>
    <string-array name="header_machine_bg_style_values" translatable="false">
        <item>0</item>
        <item>1</item>
        <item>2</item>
    </string-array>
    <string-array name="header_machine_style_entries">
        <item>@string/header_machine_style_1_title</item>
        <item>@string/header_machine_style_2_title</item>
        <item>@string/header_machine_style_3_title</item>
        <item>@string/header_machine_style_4_title</item>
    </string-array>
    <string-array name="header_machine_style_values" translatable="false">
        <item>0</item>
        <item>1</item>
        <item>2</item>
        <item>3</item>
    </string-array>

5. Compile Settings. Selesai.


========================================================================

NB: Dilarang mengubah nama smali atau path smali yang ada didalam guide ini tanpa izin ane !!!

Attention: Don't rename or modify path of smali from this guide without my permissions !!!

========================================================================

Header Machine demo video: https://youtu.be/TaFGTlTdrMI

========================================================================

Created by bamzzz@xda
fb.me/bamz4ever

ZenControl by Wuby986@xda & daxgirl@xda
Idea from StatusBar Header Machine and some drawables and some methods from OmniROM Project

Thanks to SyahrulLail for idea of Date picker preference

========================================================================

/*
 *  Copyright (C) 2015 The OmniROM Project
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */

 =========================================================================

Artikel Terkait

Previous
Next Post »

1 comments:

Write comments
dra_golem
AUTHOR
November 16, 2017 at 8:09 PM delete

gan...mohon pencerahan na untuk menghilangkan/disable background header bawaan di miui cara na gmn...(step no.6)...

Reply
avatar

Silahkan tinggalkan komentar EmoticonEmoticon