I warned
We start adding new rows, first add two new fields for each button in the section
# instance fields (Where they add does not matter, they too can be called whatever you like, as long as the path to the widget was correct)
I looked at the whale-kata same path# instance fields
...
.field private mAnswerCallButton: Landroid / widget / Button;
.field private mDeclineCallButton: Landroid / widget / Button;
we go further, we need to add our new buttons on the screen, looking for this method
.method private initComponents () V (4.0;4.3;4.4)
We are looking therein, wherein the component is added to 4.0.4
mSlidingTab: Lcom / android / internal / widget / SlidingTabSemc :
.line 180
iget-object v0, p0, Lcom / android / phone / LargeCallView; ->mView: Landroid / view / View;
const v1, 0x7f0700bc
invoke-virtual {v0, v1}, Landroid / view / View; ->findViewById (I) Landroid / view / View;
move-result-object v0
check-cast v0, Lcom / android / internal / widget / SlidingTabSemc;
iput-object v0, p0, Lcom / android / phone / LargeCallView; ->mSlidingTab: Lcom / android / internal / widget / SlidingTabSemc;
for 4.3 and 4.4 is a component of
mIncomingCallView: Lcom / android / phone / SomcIncomingCallView and accordingly, such a code (identifiers will be different):
.line 260
iget-object v0, p0, Lcom / android / phone / LargeCallView; ->mView: Landroid / view / View;
const v1, 0x7f0700c5
invoke-virtual {v0, v1}, Landroid / view / View; ->findViewById (I) Landroid / view / View;
move-result-object v0
check-cast v0, Lcom / android / phone / SomcIncomingCallView;
iput-object v0, p0, Lcom / android / phone / LargeCallView; ->mIncomingCallView: Lcom / android / phone / SomcIncomingCallView;
Now before this code to add their two buttons:
.line 182
iget-object v0, p0, Lcom / android / phone / LargeCallView; ->mView: Landroid / view / View;
const v1, 0x7f070115 # type = "id" name = "answerCallButton"
invoke-virtual {v0, v1}, Landroid / view / View; ->findViewById (I) Landroid / view / View;
move-result-object v0
check-cast v0, Landroid / widget / Button;
iput-object v0, p0, Lcom / android / phone / LargeCallView; ->mAnswerCallButton: Landroid / widget / Button;
.line 183
iget-object v0, p0, Lcom / android / phone / LargeCallView; ->mView: Landroid / view / View;
const v1, 0x7f070116 # type = "id" name = "declineCallButton"
invoke-virtual {v0, v1}, Landroid / view / View; ->findViewById (I) Landroid / view / View;
move-result-object v0
check-cast v0, Landroid / widget / Button;
iput-object v0, p0, Lcom / android / phone / LargeCallView; ->mDeclineCallButton: Landroid / widget / Button;
some explanation: in those dialer, I looked for the 4.3 and 4.4 of the code, rather registers are suitable, but may vary, so look for the code, then the easiest way to copy pieces of your code, search
check-cast v0,
Landroid / widget / Button; and copy of .line to .line, replacing its id and field
going to take from public.xml, Do you remember? this is not clear manipulation of the compilation and decompilation
what is going on
Now we need to learn to respond to pressing a button, this move by this method almost to the very end:
4.0.4 to find the following lines:
.line 218
iget-object v0, p0, Lcom / android / phone / LargeCallView; ->mSlidingTab: Lcom / android / internal / widget / SlidingTabSemc;
invoke-virtual {v0, p0}, Lcom / android / internal / widget / SlidingTabSemc; ->setOnTriggerListener (Lcom / android / internal / widget / SlidingTabSemc $ OnTriggerListener;) V
to 4.3 and 4.4 are (you will be different two subclasses LargeCallView $ 3 and LargeCallView $ 6, but this is not the point):
.line 310
iget-object v0, p0, Lcom / android / phone / LargeCallView; ->mIncomingCallView: Lcom / android / phone / SomcIncomingCallView;
new-instance v1, Lcom / android / phone / LargeCallView $ 3;
invoke-direct {v1, p0}, Lcom / android / phone / LargeCallView $ 3 -><init>(Lcom / android / phone / LargeCallView;) V
invoke-virtual {v0, v1}, Lcom / android / phone / SomcIncomingCallView; ->setOnIncomingCallRspListener (Lcom / android / phone / SomcIncomingCallView $ OnIncomingCallResponseListener;) V
and to add this code to your response and rebound
.line 210
iget-object v0, p0, Lcom / android / phone / LargeCallView; ->mAnswerCallButton: Landroid / widget / Button;
invoke-virtual {v0, p0}, Landroid / widget / Button; ->setOnClickListener (Landroid / view / View $ OnClickListener;) V
.line 211
iget-object v0, p0, Lcom / android / phone / LargeCallView; ->mDeclineCallButton: Landroid / widget / Button;
invoke-virtual {v0, p0}, Landroid / widget / Button; ->setOnClickListener (Landroid / view / View $ OnClickListener;) V
Again, I have coincided with other registers dialer, but not lazy and pay attention, just above the buttons there, looking at them-do as well)
then we need to assign actions to button presses handler
looking for a method
onClick At the end of the method see this crap, it all looks like firmware, so bring only ics, but the sign for all three:
: sswitch_data_0
.sparse-switch
0x7f07009f ->: sswitch_1
0x7f0700a0 ->: sswitch_0
0x7f0700b1 ->: sswitch_7
0x7f0700b2 ->: sswitch_6
0x7f0700b5 ->: sswitch_2
0x7f0700b6 ->: sswitch_4
0x7f0700b7 ->: sswitch_3
0x7f0700b9 ->: sswitch_5
.end sparse-switch
add your switches
for 4.0.4:
: sswitch_data_0
.sparse-switch
0x7f07009f ->: sswitch_1
0x7f0700a0 ->: sswitch_0
0x7f0700b1 ->: sswitch_7
0x7f0700b2 ->: sswitch_6
0x7f0700b5 ->: sswitch_2
0x7f0700b6 ->: sswitch_4
0x7f0700b7 ->: sswitch_3
0x7f0700b9 ->: sswitch_5
0x7f070115 ->: Sswitch_8 # type = "id" name = "answerCallButton"
0x7f070116 ->: Sswitch_9 # type = "id" name = "declineCallButton"
.end sparse-switch
add a little higher immediately after the last switch, but before
nop (Added piece begins with .line 771 and to .line 735):
.line 770
: sswitch_7
sget-object v0, Lcom / android / phone / CallView $ CallViewMode; ->MANAGE_CONFERENCE_MODE: Lcom / android / phone / CallView $ CallViewMode;
invoke-virtual {p0, v0}, Lcom / android / phone / LargeCallView; ->setCallViewMode (Lcom / android / phone / CallView $ CallViewMode;) V
goto: goto_0
.line 771
: sswitch_8
const / 4 v0, 0x1
invoke-virtual {p0, v0, v1}, Lcom / android / phone / LargeCallView; ->fireAction (ILjava / lang / Object;) V
goto: goto_0
.line 772
: sswitch_9
const / 4 v0, 0x4
invoke-virtual {p0, v0, v1}, Lcom / android / phone / LargeCallView; ->fireAction (ILjava / lang / Object;) V
goto: goto_0
.line 735
nop
to 4.3:
: sswitch_data_0
.sparse-switch
0x7f070072 ->: sswitch_0
0x7f070073 ->: sswitch_1
0x7f07008a ->: sswitch_3
0x7f07008b ->: sswitch_4
0x7f07009c ->: sswitch_5
0x7f07009d ->: sswitch_2
->: Sswitch_6 # type = "id" name = "answerCallButton"
->: Sswitch_7 # type = "id" name = "declineCallButton"
.end sparse-switch
you have no nop, so just add after the last goto:
.line 941
: sswitch_6
const / 4 v0, 0x1
invoke-virtual {p0, v0, v1}, Lcom / android / phone / LargeCallView; ->fireAction (ILjava / lang / Object;) V
goto: goto_0
.line 942
: sswitch_7
const / 4 v0, 0x4
invoke-virtual {p0, v0, v1}, Lcom / android / phone / LargeCallView; ->fireAction (ILjava / lang / Object;) V
goto: goto_0
to 4.4:
: sswitch_data_0
.sparse-switch
0x7f070010 ->: sswitch_6
0x7f070011 ->: sswitch_5
0x7f070012 ->: sswitch_7
0x7f070013 ->: sswitch_8
0x7f070089 ->: sswitch_0
0x7f07008a ->: sswitch_1
0x7f070099 ->: sswitch_3
0x7f0700aa ->: sswitch_4
0x7f0700ab ->: sswitch_2
->: Sswitch_9 # type = "id" name = "answerCallButton"
->: Sswitch_10 # type = "id" name = "declineCallButton"
.end sparse-switch
after the last add goto:
.line 1533
: sswitch_9
const / 4 v0, 0x1 # here not sure, here is an explanation
invoke-virtual {p0, v0, v1}, Lcom / android / phone / CallView; ->fireAction (ILjava / lang / Object;) V
goto: goto_0
.line 1533
: sswitch_10
const / 4 v0, 0x4
invoke-virtual {p0, v0, v1}, Lcom / android / phone / CallView; ->fireAction (ILjava / lang / Object;) V
goto: goto_0
not sure that is the correct answer to the constant for whale-kata, the developers decided to be original, so if there is no answer or be something completely extraneous to perform)), try changing this constant on
const / 16 v0, 0x22 and that's not all, we are done with the addition of buttons on the screen and pressing the handler, you now need to hide what should be hidden and shown ... in short vice versa)
first method
clear We found in the following lines
for 4.0.4:
.line 797
iget-object v0, p0, Lcom / android / phone / LargeCallView; ->mSlidingTab: Lcom / android / internal / widget / SlidingTabSemc;
invoke-virtual {v0, v1}, Lcom / android / internal / widget / SlidingTabSemc; ->setVisibility (I) V
for 4.3 and 4.4:
.line 976
iget-object v0, p0, Lcom / android / phone / LargeCallView; ->mIncomingCallView: Lcom / android / phone / SomcIncomingCallView;
invoke-virtual {v0, v1}, Lcom / android / phone / SomcIncomingCallView; ->setVisibility (I) V
and to them adds his to 4.0.4 and 4.3:
.line 805
iget-object v0, p0, Lcom / android / phone / LargeCallView; ->mAnswerCallButton: Landroid / widget / Button;
invoke-virtual {v0, v1}, Landroid / widget / Button; ->setVisibility (I) V
.line 806
iget-object v0, p0, Lcom / android / phone / LargeCallView; ->mDeclineCallButton: Landroid / widget / Button;
invoke-virtual {v0, v1}, Landroid / widget / Button; ->setVisibility (I) V
to 4.4:
.line 805
iget-object v0, p0, Lcom / android / phone / LargeCallView; ->mAnswerCallButton: Landroid / widget / Button;
invoke-virtual {v0, v1}, Landroid / view / View; ->setVisibility (I) V
.line 806
iget-object v0, p0, Lcom / android / phone / LargeCallView; ->mDeclineCallButton: Landroid / widget / Button;
invoke-virtual {v0, v1}, Landroid / view / View; ->setVisibility (I) V
do not forget to look at the registers; as the name of the method, it clears the screen, so the slider it is hidden, that is, v1 at the very beginning so declared
const / 16 v1, 0x8 , Respectively, and our buttons need to hide
following method
reDraw , Looking for the slider:
for 4.0.4:
iput-object v1, p0, Lcom / android / phone / LargeCallView; ->mSlidingTab: Lcom / android / internal / widget / SlidingTabSemc;
for 4.3 and 4.4:
iput-object v1, p0, Lcom / android / phone / LargeCallView; ->mIncomingCallView: Lcom / android / phone / SomcIncomingCallView;
and front line adds his own:
.line 323
iput-object v1, p0, Lcom / android / phone / LargeCallView; ->mAnswerCallButton: Landroid / widget / Button;
.line 324
iput-object v1, p0, Lcom / android / phone / LargeCallView; ->mDeclineCallButton: Landroid / widget / Button;
for some reason, I do not know why, button handler is also assigned
null I do not appropriated because I and so works) seriously, we met in this same method like a button without the handler, so he did not add
method
showAllCallsEndedLayout As always we find a slider:
iget-object v0, p0, Lcom / android / phone / LargeCallView; ->mSlidingTab: Lcom / android / internal / widget / SlidingTabSemc;
invoke-virtual {v0, v2}, Lcom / android / internal / widget / SlidingTabSemc; ->setVisibility (I) V
or
.line 1272
iget-object v0, p0, Lcom / android / phone / LargeCallView; ->mIncomingCallPanel: Landroid / widget / LinearLayout;
invoke-virtual {v0, v2}, Landroid / view / View; ->setVisibility (I) V
and before it is added to 4.0.4 and 4.3:
.line 533
iget-object v0, p0, Lcom / android / phone / LargeCallView; ->mAnswerCallButton: Landroid / widget / Button;
invoke-virtual {v0, v2}, Landroid / widget / Button; ->setVisibility (I) V
.line 534
iget-object v0, p0, Lcom / android / phone / LargeCallView; ->mDeclineCallButton: Landroid / widget / Button;
invoke-virtual {v0, v2}, Landroid / widget / Button; ->setVisibility (I) V
and 4.4 to fix in our code two lines:
.line 533
iget-object v0, p0, Lcom / android / phone / LargeCallView; ->mAnswerCallButton: Landroid / widget / Button;
invoke-virtual {v0, v2}, Landroid / view / View; ->setVisibility (I) V
.line 534
iget-object v0, p0, Lcom / android / phone / LargeCallView; ->mDeclineCallButton: Landroid / widget / Button;
invoke-virtual {v0, v2}, Landroid / view / View; ->setVisibility (I) V
whew ... instructions to get something a chur detailed and long, in general, the principle of the following revisions of the same, there were only screens with the challenges which we must add our button before the slider and, if it is shown, the display buttons and a slider to hide, if the slider is hidden, you add buttons and
hidethem with these complexities should not be, do search in the same way as before
that's all, Sori for this painting, successful mods
and God forbid, I'll take more time for detailed instructions