Guide Switch Big Display Picture di Profil BBM

Home » » Guide Switch Big Display Picture di Profil BBM
1. Siapkan 2 Layout activity_view_profile.xml dengan activity_view_profile_big.xml (dimana yang big merupakan layout yang sudah diedit menjadi bigdp)
 
2. Buka smali ViewProfileActivity.smali
 
3. Masukan kode berikut di bawah # direct methods
 
.method private setContent()V
    .locals 4
 
    .prologue
    .line 20
    invoke-virtual {p0}, Lcom/bbm/ui/activities/ViewProfileActivity;->getBaseContext()Landroid/content/Context;
 
    move-result-object v0
 
    invoke-static {v0}, Landroid/preference/PreferenceManager;->getDefaultSharedPreferences(Landroid/content/Context;)Landroid/content/SharedPreferences;
 
    move-result-object v0
 
    const-string v1, "DeltaBigDp.Checked"
 
    const/4 v2, 0x1
 
    invoke-interface {v0, v1, v2}, Landroid/content/SharedPreferences;->getBoolean(Ljava/lang/String;Z)Z
 
    move-result v0
 
    invoke-static {v0}, Ljava/lang/Boolean;->valueOf(Z)Ljava/lang/Boolean;
 
    move-result-object v0
 
    invoke-virtual {v0}, Ljava/lang/Boolean;->booleanValue()Z
 
    move-result v0
 
    if-nez v0, :cond_0
 
    .line 21
    invoke-virtual {p0}, Lcom/bbm/ui/activities/ViewProfileActivity;->getBaseContext()Landroid/content/Context;
 
    move-result-object v0
 
    invoke-virtual {v0}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;
 
    move-result-object v0
 
    const-string v1, "activity_view_profile"
 
    const-string v2, "layout"
 
    invoke-virtual {p0}, Lcom/bbm/ui/activities/ViewProfileActivity;->getBaseContext()Landroid/content/Context;
 
    move-result-object v3
 
    invoke-virtual {v3}, Landroid/content/Context;->getPackageName()Ljava/lang/String;
 
    move-result-object v3
 
    invoke-virtual {v0, v1, v2, v3}, Landroid/content/res/Resources;->getIdentifier(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)I
 
    move-result v0
 
    invoke-virtual {p0, v0}, Lcom/bbm/ui/activities/ViewProfileActivity;->setContentView(I)V
 
    .line 28
    :goto_0
    return-void
 
    .line 24
    :cond_0
    invoke-virtual {p0}, Lcom/bbm/ui/activities/ViewProfileActivity;->getBaseContext()Landroid/content/Context;
 
    move-result-object v0
 
    invoke-virtual {v0}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;
 
    move-result-object v0
 
    const-string v1, "activity_view_profile_big"
 
    const-string v2, "layout"
 
    invoke-virtual {p0}, Lcom/bbm/ui/activities/ViewProfileActivity;->getBaseContext()Landroid/content/Context;
 
    move-result-object v3
 
    invoke-virtual {v3}, Landroid/content/Context;->getPackageName()Ljava/lang/String;
 
    move-result-object v3
 
    invoke-virtual {v0, v1, v2, v3}, Landroid/content/res/Resources;->getIdentifier(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)I
 
    move-result v0
 
    invoke-virtual {p0, v0}, Lcom/bbm/ui/activities/ViewProfileActivity;->setContentView(I)V
 
    goto :goto_0
.end method
 
 
4. Ganti kode A dengan B
 
    (A) .line 242
    const v0, 0x7f03008f
 
    invoke-virtual {p0, v0}, Lcom/bbm/ui/activities/ViewProfileActivity;->setContentView(I)V
 
 
    (B) .line 15
    invoke-direct {p0}, Lcom/bbm/ui/activities/ViewProfileActivity;->setContent()V
 
5. Untuk yang menggunakan PreferenceActivity gunakan kode di bawah namun jika mau ditempatkan di layout activity_setting.xml lanjut step 6
 
Tambahkan kode berikut di prefernce.xml dari PreferenceActivity Anda (Contoh di delta_preference.xml)
 
        <CheckBoxPreference android:icon="@drawable/delta_dp" android:title="@string/bigdp" android:key="DeltaBigDp.Checked" android:defaultValue="true" android:summaryOn="@string/enabled" android:summaryOff="@string/disabled" />
 
 
6. Bikin smali baru dengan nama DeltaBigDp.smali letaknya di com/mod/dp/* isinya sebagai berikut :
 
.class public Lcom/mod/dp/DeltaBigDp;
.super Lcom/mod/libs/TCheckBoxMod;
.source "DeltaBigDp.java"
 
 
# direct methods
.method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;)V
    .locals 1
    .param p1, "cont"    # Landroid/content/Context;
    .param p2, "attr"    # Landroid/util/AttributeSet;
 
    .prologue
    .line 12
    const/4 v0, 0x0
 
    invoke-static {v0}, Ljava/lang/Boolean;->valueOf(Z)Ljava/lang/Boolean;
 
    move-result-object v0
 
    invoke-direct {p0, p1, p2, v0}, Lcom/mod/libs/TCheckBoxMod;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;Ljava/lang/Boolean;)V
 
    .line 13
    return-void
.end method
 
 
# virtual methods
.method public onSwitchOFF()V
    .locals 1
 
    .prologue
    .line 26
    invoke-static {}, Landroid/os/Process;->myPid()I
 
    move-result v0
 
    invoke-static {v0}, Landroid/os/Process;->killProcess(I)V
 
    .line 27
    return-void
.end method
 
.method public onSwitchON()V
    .locals 1
 
    .prologue
    .line 19
    invoke-static {}, Landroid/os/Process;->myPid()I
 
    move-result v0
 
    invoke-static {v0}, Landroid/os/Process;->killProcess(I)V
 
    .line 20
    return-void
.end method
 
 
7. Langsung tambahkan kode berikut di layout activity_setting.xml
 
 <LinearLayout android:orientation="horizontal" android:paddingLeft="@dimen/settings_item_padding_left" android:paddingTop="@dimen/settings_item_padding_top" android:paddingBottom="@dimen/settings_item_padding_bottom" android:layout_width="fill_parent" android:layout_height="wrap_content">
            <com.mod.libs.TLabel android:textColor="@color/listItemTitle" android:layout_gravity="center_vertical" android:layout_width="0.0dip" android:layout_height="wrap_content" android:text="Big DP on Profile" android:layout_weight="1.0" style="@style/Common.Label" />
            <com.mod.dp.DeltaBigDp android:textColor="@color/listItemTitle" android:paddingRight="@dimen/settings_item_small_padding_right" android:layout_width="wrap_content" android:layout_height="wrap_content" />
        </LinearLayout>

Credit  : Yoyocx Praditya S Putra
Source :  http://www.deltacomputindo.com 
Share this article :