android - Reference another attribute in InverseBindingAdapter -


i have following bindingadapter textview showing date:

@bindingadapter(value = {"date", "mindate", "maxdate", "dateformat", "dateattrchanged"}, requireall = false) public static void binddate(textview textview, long date, long mindate, long maxdate,                             string dateformat, final inversebindinglistener datechangedlistener) {     dateformat dateformatter = new simpledateformat(dateformat != null? dateformat : "dd.mm.yyyy", locale.german);     textview.setonclicklistener(view -> {         calendar calendar = calendar.getinstance();         calendar.settimeinmillis(date != null ? date : system.currenttimemillis());         datepickerdialog datepickerdialog = new datepickerdialog(textview.getcontext(), (dateview, year, month, dayofmonth) -> {             calendar result = calendar.getinstance();             result.set(year, month, dayofmonth);             textview.settext(dateformatter.format(result.gettimeinmillis()));             if(datechangedlistener != null) {                 datechangedlistener.onchange();             }         }, calendar.get(calendar.year), calendar.get(calendar.month), calendar.get(calendar.day_of_month));         if(mindate != null) {             datepickerdialog.getdatepicker().setmindate(mindate);         }         if(maxdate != null){             datepickerdialog.getdatepicker().setmaxdate(maxdate);         }         datepickerdialog.show();     });     textview.setclickable(true);     textview.setfocusable(true);     if(date != null) {         textview.settext(dateformatter.format(date));     }      // todo find way pass dateformat inversebindingadapter     textview.settag(dateformat); }  @nullable @inversebindingadapter(attribute = "date", event = "dateattrchanged") public static long binddate(textview textview) {     dateformat dateformatter = new simpledateformat(textview.gettag() != null ?             (string) textview.gettag() : "dd.mm.yyyy", locale.german);     long result = null;     try {         result = dateformatter.parse(string.valueof(textview.gettext())).gettime();     } catch (throwable t) {         t.printstacktrace();     }     return result; } 

is there way reference dateformat attribute in inversebindingadapter (passing it's value via tag current workaround)?


Comments

Popular posts from this blog

javascript - Create a stacked percentage column -

Optimising Firebase database by automatically overwriting data -

javascript - Angular UI-Grid customTemplate directive causing rows to load slowly/? -