package no.ntnu.capgeminitest.binding.android.propertyprovider;

import android.view.View;
import no.ntnu.capgeminitest.binding.Property;
import no.ntnu.capgeminitest.binding.android.propertyprovider.listener.OnClickListenerProperty;
import no.ntnu.capgeminitest.data.Property;

public class ViewPropertyProvider extends AbstractPropertyProvider implements PropertyProvider {

    @Override
    public Property<?> getBoundProperty(View view, String bindingName) {
        if (bindingName.equals("OnClickTo")) {
            OnClickListenerProperty onClickListenerProperty = new OnClickListenerProperty();
            view.setOnClickListener(onClickListenerProperty);
            return onClickListenerProperty.property;
        } else if (bindingName.equals("OnClickFrom")) {
            final View view_ = view;
            Property<Object> property = new Property<Object>(null) {
              @Override protected void onChange(Object unused) {
                  view_.performClick();
              }
            };
            
            return property;
        } else {
            return null;
        }
    }

    @Override
    public Class<?> providerForClass() {
        return android.view.View.class;
    }

}

@@ -230,52 +230,8 @@
 rty;
-%0Aimport no.ntnu.capgeminitest.data.Property;
 %0A%0Apu
@@ -299,36 +299,8 @@
 der 
-implements PropertyProvider 
 %7B%0A%0A 

Remove unneccessary implements.