package no.ntnu.capgeminitest.dbacalculator;

import no.ntnu.capgeminitest.binding.android.BindingActivity;
import android.content.Context;
import android.os.Bundle;
import android.util.AttributeSet;
import android.util.Log;
import android.view.View;

public class DbaCalculator extends BindingActivity {
    public static final String TAG = "DbaCalculator";
    public static final String dbaNamespace = "http://org.ntnu.no/groups/capgeminitest/data-binding/";
    
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Log.d(TAG, "onCreate()");
        
//        LayoutInflater.Factory viewFactory = new LayoutInflater.Factory() {
//            @Override public View onCreateView(String name, Context context, AttributeSet attrs) {
//                return calcOnCreateView(name, context, attrs);
//            }
//        };
//        
//        LayoutInflater inflater = (LayoutInflater)this.getSystemService(
//                Context.LAYOUT_INFLATER_SERVICE);
//        inflater = inflater.cloneInContext(this);
//        inflater.setFactory(viewFactory);
//        View layout = inflater.inflate(R.layout.main, null, false);
        setContentViewWithBindings(R.layout.main, null);
    }
    
    public View calcOnCreateView(String name, Context context, AttributeSet attrs) {
        Log.d(TAG, "Creating view with name " + name + " and attributes: ");
        printAttributes(attrs);
        return null;
    }
    
    private void printAttributes(AttributeSet attrs) {
        int count = attrs.getAttributeCount();
        for (int i = 0; i < count; i++) {
            String attrName = attrs.getAttributeName(i);
            String attrValue = attrs.getAttributeValue(i);
            Log.d(TAG, "\t" + attrName + ": " + attrValue);
        }
    }
}
@@ -611,34 +611,32 @@
 );%0A        %0A
-//
         
 LayoutInflat
@@ -627,609 +627,27 @@
     
-LayoutInflater.Factory viewFactory = new LayoutInflater.Factory() %7B%0A//            @Override public View onCreateView(String name, Context context, AttributeSet attrs) %7B%0A//                return calcOnCreateView(name, context, attrs);%0A//            %7D%0A//        %7D;%0A//        %0A//        LayoutInflater inflater = (LayoutInflater)this.getSystemService(%0A//                Context.LAYOUT_INFLATER_SERVICE);%0A//        inflater = inflater.cloneInContext(this);%0A//        inflater.setFactory(viewFactory);%0A//        View layout = inflater.inflate(R.layout.main, null, false);%0A        setContentViewWithBindings
+setBoundContentView
 (R.l

Fix DbaCalculator.