access attachedView
Closed this issue · 9 comments
Hello,
Could you please do something about accessing the attachedView field. It is private but it does not have any getter, but I really need to be able to access it somehow.
Thank you
@mp3por Hi,Thanks for the issues.
I want to know whether the "attachedView" what you mentioned means "contentView" field in "EasyDialog.java" in line 59?
I opened this issue because at the time I needed a way to access the View to which the EasyDialog was attached. I think this is line 199 in "EasyDialog.java". I understand that you use the "attachedView" in "setLocationByAttachedView(View attachedView)" line 174 just to calculate the position of the EasyDialog but you also save it at line 178 so providing a getter for it is not a big deal.
My use case is that I want to create and configure 1 EasyDialog and then just change its location by attaching it to different Views on the screen. Doing it this way it means that I can have only 1 OnClickListener so having the ability to access the View to which the dialog is attached will enable me to know what I have to do
tooltipViewInstance.findViewById(R.id.llContent).setOnClickListener(new View.OnClickListener() {
@OverRide
public void onClick(View view) {
if (EasyDialog.getAttachedView() == View1) {
// do what I have to do if the EasyDialog was attached to View1
} else if (EasyDialog.getAttachedView() == View2){
// do what I have to do if the EasyDialog was attached to View2
}
}
});
@mp3por ok,I got it,I will add a getter for the "attachedView" soon,Thanks for issue : )
Where should i write following code in order to give click event for textview defined inside easydialog
tooltipViewInstance.findViewById(R.id.llContent).setOnClickListener(new View.OnClickListener() {
@OverRide
public void onClick(View view) {
if (EasyDialog.getAttachedView() == View1) {
// do what I have to do if the EasyDialog was attached to View1
} else if (EasyDialog.getAttachedView() == View2){
// do what I have to do if the EasyDialog was attached to View2
}
}
});
where should i put these lines?????
@nayana123 Hi, I am not very clear about what you mean,if you want to handle the click event of the textview defined inside easydialog, you could just setOnClickListener on it.
@mp3por The getter for attachedView is available now
see:
compile 'com.github.michaelye.easydialog:easydialog:1.2'
thanks worked for me by using onClickListener on view
Thank you
can anyone can share any example?