[Miscellaneous Android Development] teztaz--v3:
Hello guys, today i want to share to u, how to add swipe to remove notification for galaxy pocket..

Here, lets us start now!

SYSTEMUI

1.	Create folder anim (if not exists yet) inside /res folder

2.	Create 2 file named slide_out_left_basic.xml and slide_out_right_basic.xml inside res/anim folder

3.	for slide_out_left_basic.xml, edit the file and fill with this

Code:

<?xml version="1.0" encoding="utf-8"?>
<translate android:duration="@android:integer/config_mediumAnimTime" android:fromXDelta="0.0" android:toXDelta="-50.0%p"
xmlns:android="http://schemas.android.com/apk/res/android" />

4.	for slide_out_right_basic.xml, edit the file and fill with this

<?xml version="1.0" encoding="utf-8"?>
<translate android:duration="@android:integer/config_mediumAnimTime" android:fromXDelta="0.0" android:toXDelta="50.0%p"
xmlns:android="http://schemas.android.com/apk/res/android" />

5.	Save both

* Editing res/layout/status_bar_latest_event.xml

We are replacing LinearLayout object used in StatusBar with LatestItemContainer here, so notification can be removed. We handle the Styling first by editing this .xml first. Here are the steps:

6.	Change the code from Original code to this (change the bold one)

<?xml version="1.0" encoding="utf-8"?>
<[B]com.android.systemui.statusbar.LatestItemContainer[/B] android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="65.0sp"
xmlns:android="http://schemas.android.com/apk/res/android">
<com.android.systemui.statusbar.LatestItemView android:id="@id/content" android:background="@android:drawable/status_bar_item_background" android:paddingRight="6.0sp" android:focusable="true" android:clickable="true" android:layout_width="fill_parent" android:layout_height="64.0sp" android:shadowColor="#ff000000" android:shadowDx="0.0" android:shadowDy="1.0" android:shadowRadius="2.0" />
<View android:background="@drawable/divider_horizontal_light_opaque" android:layout_width="fill_parent" android:layout_height="wrap_content" />
<[B]/com.android.systemui.statusbar.LatestItemContainer[/B]>

7.	Save

* Editing res/values/public.xml

This one is for registering anim file that we made on step 1.1 to be available publicly and to be recognized in .smali program. Here are the steps:

8.	Recompile your apk after putting anim file into /res folder

9.	Decompile again the resulting apk

10.	Inside /res/values/public.xml, you'll found something like this in the end:

<resources>
.
.
.

<public type="anim" name="slide_out_left_basic" id="0x7f0a0000" />
<public type="anim" name="slide_out_right_basic" id="0x7f0a0001" />

</resources>

11.	Remember the ID for both anim lines. As a backup

12.	Extract the StatusBarService$7.smali from smali_files.zip at attachment

13.	Extract the ItemTouchDispatcher$1.smali from smali_files.zip at attachment

14.	Extract the ItemTouchDispatcher.smali from smali_files.zip at attachment

15.	Extract the LatestItemContainer.smali from smali_files.zip at attachment

16.	Put these 4 files in smali/com/android/systemui/statusbar/

17.	Open /smali/com/android/systemui/statusbar/ExpandedView.smali

add under # instance fields

.field mTouchDispatcher:Lcom/android/systemui/statusbar/ItemTouchDispatcher;

18.	Delete any method u found after this

.method protected onFinishInflate()V
.locals 0

.prologue
.line 42
invoke-super {p0}, Landroid/widget/LinearLayout;->onFinishInflate()V

.line 43
return-void
.end method

19.	Then, add this method below the method above

.method public onInterceptTouchEvent(Landroid/view/MotionEvent;)Z
.locals 1
.parameter "event"

.prologue
.line 51
iget-object v0, p0, Lcom/android/systemui/statusbar/ExpandedView;->mTouchDispatcher:Lcom/android/systemui/statusbar/ItemTouchDispatcher;

invoke-virtual {v0, p1}, Lcom/android/systemui/statusbar/ItemTouchDispatcher;->needsInterceptTouch(Landroid/view/MotionEvent;)Z

move-result v0

if-eqz v0, :cond_0

.line 52
const/4 v0, 0x1

.line 54
:goto_0
return v0

:cond_0
invoke-super {p0, p1}, Landroid/widget/LinearLayout;->onInterceptTouchEvent(Landroid/view/MotionEvent;)Z

move-result v0

goto :goto_0
.end method

.method protected onLayout(ZIIII)V
.locals 3
.parameter "changed"
.parameter "left"
.parameter "top"
.parameter "right"
.parameter "bottom"

.prologue
.line 53
invoke-super/range {p0 .. p5}, Landroid/widget/LinearLayout;->onLayout(ZIIII)V

.line 54
sub-int v0, p5, p3

.line 55
.local v0, height:I
iget v1, p0, Lcom/android/systemui/statusbar/ExpandedView;->mPrevHeight:I

if-eq v0, v1, :cond_0

.line 58
iput v0, p0, Lcom/android/systemui/statusbar/ExpandedView;->mPrevHeight:I

.line 59
iget-object v1, p0, Lcom/android/systemui/statusbar/ExpandedView;->mService:Lcom/android/systemui/statusbar/StatusBarService;

const/16 v2, -0x2710

invoke-virtual {v1, v2}, Lcom/android/systemui/statusbar/StatusBarService;->updateExpandedViewPos(I)V

.line 61
:cond_0
return-void
.end method

.method public onTouchEvent(Landroid/view/MotionEvent;)Z
.locals 2
.parameter "event"

.prologue
.line 59
iget-object v1, p0, Lcom/android/systemui/statusbar/ExpandedView;->mTouchDispatcher:Lcom/android/systemui/statusbar/ItemTouchDispatcher;

invoke-virtual {v1, p1}, Lcom/android/systemui/statusbar/ItemTouchDispatcher;->handleTouchEvent(Landroid/view/MotionEvent;)Z

move-result v0

.line 61
.local v0, handled:Z
invoke-super {p0, p1}, Landroid/widget/LinearLayout;->onTouchEvent(Landroid/view/MotionEvent;)Z

move-result v1

if-eqz v1, :cond_0

.line 62
const/4 v0, 0x1

.line 65
:cond_0
return v0
.end method

20.	Save.

21.	Edit StatusBarService.smali

Add under .field private mTicking:Z in #instance fields

.field mTouchDispatcher:Lcom/android/systemui/statusbar/ItemTouchDispatcher;

22.	In .method private makeStatusBarView

above

const v7, 0x1050005

invoke-virtual {v4, v7}, Landroid/content/res/Resources;->getDimensionPixelSize(I)I

23.	Add

new-instance v5, Lcom/android/systemui/statusbar/ItemTouchDispatcher;

invoke-direct {v5, p0}, Lcom/android/systemui/statusbar/ItemTouchDispatcher;-><init>(Landroid/content/Context;)V

iput-object v5, p0, Lcom/android/systemui/statusbar/StatusBarService;->mTouchDispatcher:Lcom/android/systemui/statusbar/ItemTouchDispatcher;

24.	Above

const v7, 0x7f030004

invoke-static {p1, v7, v9}, Landroid/view/View;->inflate(Landroid/content/Context;ILandroid/view/ViewGroup;)Landroid/view/View;

25.	Add

iget-object v5, p0, Lcom/android/systemui/statusbar/StatusBarService;->mTouchDispatcher:Lcom/android/systemui/statusbar/ItemTouchDispatcher;

iput-object v5, v1, Lcom/android/systemui/statusbar/ExpandedView;->mTouchDispatcher:Lcom/android/systemui/statusbar/ItemTouchDispatcher;

26.	Replace method makeNotificationView ( from begin to end)

with modified

.method makeNotificationView(Lcom/android/internal/statusbar/StatusBarNotification;Landroid/view/ViewGroup;)[Landroid/view/View;
.locals 19
.parameter "notification"
.parameter "parent"

.prologue
.line 574
move-object/from16 v0, p1

iget-object v0, v0, Lcom/android/internal/statusbar/StatusBarNotification;->notification:Landroid/app/Notification;

move-object/from16 v16, v0

.line 575
.local v16, n:Landroid/app/Notification;
move-object/from16 v0, v16

iget-object v0, v0, Landroid/app/Notification;->contentView:Landroid/widget/RemoteViews;

move-object/from16 v17, v0

.line 576
.local v17, remoteViews:Landroid/widget/RemoteViews;
if-nez v17, :cond_0

.line 577
const/4 v4, 0x0

.line 611
:goto_0
return-object v4

.line 581
:cond_0
const-string v4, "layout_inflater"

move-object/from16 v0, p0

move-object v1, v4

invoke-virtual {v0, v1}, Lcom/android/systemui/statusbar/StatusBarService;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;

move-result-object v15

check-cast v15, Landroid/view/LayoutInflater;

.line 582
.local v15, inflater:Landroid/view/LayoutInflater;
const v4, 0x7f030008

const/4 v5, 0x0

move-object v0, v15

move v1, v4

move-object/from16 v2, p2

move v3, v5

invoke-virtual {v0, v1, v2, v3}, Landroid/view/LayoutInflater;->inflate(ILandroid/view/ViewGroup;Z)Landroid/view/View;

move-result-object v18

check-cast v18, Lcom/android/systemui/statusbar/LatestItemContainer;

.local v18, row:Lcom/android/systemui/statusbar/LatestItemContainer;
move-object/from16 v0, v16

iget v0, v0, Landroid/app/Notification;->flags:I

move v4, v0

and-int/lit8 v4, v4, 0x2

if-nez v4, :cond_1

move-object/from16 v0, v16

iget v0, v0, Landroid/app/Notification;->flags:I

move v4, v0

and-int/lit8 v4, v4, 0x20

if-nez v4, :cond_1

move-object/from16 v0, p0

iget-object v0, v0, Lcom/android/systemui/statusbar/StatusBarService;->mTouchDispatcher:Lcom/android/systemui/statusbar/ItemTouchDispatcher;

move-object v4, v0

new-instance v5, Lcom/android/systemui/statusbar/StatusBarService$7;

move-object v0, v5

move-object/from16 v1, p0

move-object/from16 v2, p1

invoke-direct {v0, v1, v2}, Lcom/android/systemui/statusbar/StatusBarService$7;-><init>(Lcom/android/systemui/statusbar/StatusBarService;Lcom/android/internal/statusbar/StatusBarNotification;)V

move-object/from16 v0, v18

move-object v1, v4

move-object v2, v5

invoke-virtual {v0, v1, v2}, Lcom/android/systemui/statusbar/LatestItemContainer;->setOnSwipeCallback(Lcom/android/systemui/statusbar/ItemTouchDispatcher;Ljava/lang/Runnable;)V

:cond_1
const v4, 0x7f090024

move-object/from16 v0, v18

move v1, v4

invoke-virtual {v0, v1}, Lcom/android/systemui/statusbar/LatestItemContainer;->findViewById(I)Landroid/view/View;

move-result-object v10

check-cast v10, Landroid/view/ViewGroup;

.line 586
.local v10, content:Landroid/view/ViewGroup;
const/high16 v4, 0x6

invoke-virtual {v10, v4}, Landroid/view/ViewGroup;->setDescendantFocusability(I)V

.line 587
move-object/from16 v0, p0

iget-object v0, v0, Lcom/android/systemui/statusbar/StatusBarService;->mFocusChangeListener:Landroid/view/View$OnFocusChangeListener;

move-object v4, v0

invoke-virtual {v10, v4}, Landroid/view/ViewGroup;->setOnFocusChangeListener(Landroid/view/View$OnFocusChangeListener;)V

.line 588
move-object/from16 v0, v16

iget-object v0, v0, Landroid/app/Notification;->contentIntent:Landroid/app/PendingIntent;

move-object v6, v0

.line 589
.local v6, contentIntent:Landroid/app/PendingIntent;
if-eqz v6, :cond_2

.line 590
new-instance v4, Lcom/android/systemui/statusbar/StatusBarService$Launcher;

move-object/from16 v0, p1

iget-object v0, v0, Lcom/android/internal/statusbar/StatusBarNotification;->pkg:Ljava/lang/String;

move-object v7, v0

move-object/from16 v0, p1

iget-object v0, v0, Lcom/android/internal/statusbar/StatusBarNotification;->tag:Ljava/lang/String;

move-object v8, v0

move-object/from16 v0, p1

iget v0, v0, Lcom/android/internal/statusbar/StatusBarNotification;->id:I

move v9, v0

move-object/from16 v5, p0

invoke-direct/range {v4 .. v9}, Lcom/android/systemui/statusbar/StatusBarService$Launcher;-><init>(Lcom/android/systemui/statusbar/StatusBarService;Landroid/app/PendingIntent;Ljava/lang/String;Ljava/lang/String;I)V

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

.line 594
:cond_2
const/4 v13, 0x0

.line 595
.local v13, expanded:Landroid/view/View;
const/4 v12, 0x0

.line 597
.local v12, exception:Ljava/lang/Exception;
:try_start_0
move-object/from16 v0, v17

move-object/from16 v1, p0

move-object v2, v10

invoke-virtual {v0, v1, v2}, Landroid/widget/RemoteViews;->apply(Landroid/content/Context;Landroid/view/ViewGroup;)Landroid/view/View;
:try_end_0
.catch Ljava/lang/RuntimeException; {:try_start_0 .. :try_end_0} :catch_0

move-result-object v13

.line 602
:goto_1
if-nez v13, :cond_3

.line 603
new-instance v4, Ljava/lang/StringBuilder;

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

move-object/from16 v0, p1

iget-object v0, v0, Lcom/android/internal/statusbar/StatusBarNotification;->pkg:Ljava/lang/String;

move-object v5, v0

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

move-result-object v4

const-string v5, "/0x"

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

move-result-object v4

move-object/from16 v0, p1

iget v0, v0, Lcom/android/internal/statusbar/StatusBarNotification;->id:I

move v5, v0

invoke-static {v5}, Ljava/lang/Integer;->toHexString(I)Ljava/lang/String;

move-result-object v5

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

move-result-object v4

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

move-result-object v14

.line 604
.local v14, ident:Ljava/lang/String;
const-string v4, "StatusBarService"

new-instance v5, Ljava/lang/StringBuilder;

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

const-string v6, "couldn\'t inflate view for notification "

.end local v6 #contentIntent:Landroid/app/PendingIntent;
invoke-virtual {v5, v6}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

move-result-object v5

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

move-result-object v5

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

move-result-object v5

invoke-static {v4, v5, v12}, Landroid/util/Slog;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I

.line 605
const/4 v4, 0x0

goto/16 :goto_0

.line 599
.end local v14 #ident:Ljava/lang/String;
.restart local v6 #contentIntent:Landroid/app/PendingIntent;
:catch_0
move-exception v11

.line 600
.local v11, e:Ljava/lang/RuntimeException;
move-object v12, v11

goto :goto_1

.line 607
.end local v11 #e:Ljava/lang/RuntimeException;
:cond_3
invoke-virtual {v10, v13}, Landroid/view/ViewGroup;->addView(Landroid/view/View;)V

.line 608
const/4 v4, 0x1

move-object/from16 v0, v18

move v1, v4

invoke-virtual {v0, v1}, Lcom/android/systemui/statusbar/LatestItemContainer;->setDrawingCacheEnabled(Z)V

.line 611
const/4 v4, 0x3

new-array v4, v4, [Landroid/view/View;

const/4 v5, 0x0

aput-object v18, v4, v5

const/4 v5, 0x1

aput-object v10, v4, v5

const/4 v5, 0x2

aput-object v13, v4, v5

goto/16 :goto_0
.end method

27.	Save

28.	Recompile your SystemUI.apk

FRAMEWORK.JAR

The tutorial for this, i will share soon..

Use my framework.jar for now.. (work with almost rom)