Hello this is Mortaza Cordy.
And in this story all your way to learn how to drag or move our floating budget or our floating view
on the screen by using the user's touch.
So in order to do that first of all we need to access the root container or the root view.
So by root view I am actually referring.
Let's go into this flawed underlying view Underland lay out that XML file here.
And now you can see this route view here.
This relatively out which is playing the role of a root container that contains the collapsed state
or the collapsed view and the expanded view is that the idea of this relatively out is this one root
Underland view.
So let's go back into this Flutey and view.
So we start justified and here inside this class you can see that we have some instances valuables.
Let's create another instance variable.
It is going to be of type view and its name is going to be root view semicolon.
So let's actually declare all of our instance variables as private so put the private keyword before
these instance variables because it's a good programming practice to do that.
Now we need to go inside the uncreate benefit.
And if you're going to initialize our route to view Silis scroll down here and before adding curly brace
of this on Christmas.
And we to refer to this Roots view assignment operator and I can say find excuse me Vinita repetoire
which is first floating bitted that find view by ID because here we are actually accessing a view and
we want to assign this view to this read the view which is actually of type view.
We don't have to cast this to any other types because we are directly accessing of you.
So if you can say find by ID inside a Apprentice's I'm going to say are that Id dot root underline if
you semicolon Now that be initialized this root view I can create an on Poche listener for the this
view.
So I went to say root view that sits on touch listener now only to pass the context because we do not
want to actually create an anonymous inner class since insight is unclear if it is going to be too much
crowded and it's not a good programming practice eboy that everything should be encapsulated any and
everything should be done in its own methods or functions so set on patches and or inside Apprentice's.
I am going to say the context that we need to pass the context the context is disserve is floating view
so Service that this.
Now we have an error.
It says that we have to now that we passed this context to the set and to each listener.
And we are saying that this floating View service is going to be the listener for the touch of the user.
This fluty view service that java file this class now must implement the unattach listener interface
and override the untouched method.
So let's scroll to the top here.
It says publish class fluting View service extends service class implements view that unclick listener
interface.
So we now need to implement another interface so people are coming here and now we're going to see view
that on capital or.
Okay touch on that listener.
That's it.
Now we need to override the on touch method inside our class.
So let's scroll down here.
And after this and click on it.
So make sure that you are actually still inside this class.
And after the end in curly brace of our unclick listener uncle Mefford here and before the anti-cruelty
place of the class the fluting you said with class if you're going to see on Poche now the autocomplete
feature helped me to override this method.
So here it is on my phone.
So it is written false.
Let's delete this return false.
Here let's go inside this method.
Notice that the Smurfette needs to return a value of a boolean.
So I think that's enough for this story or indirect tutorial.
We're going to implement this on touch Meffert.
So thank you very much for watching.
And I look forward to seeing you in the next story.