package jp.co.recruit_lifestyle.sample;

import android.arch.lifecycle.LifecycleActivity;
import android.arch.lifecycle.ViewModelProviders;
import android.databinding.DataBindingUtil;
import android.os.Bundle;
import android.support.annotation.Nullable;

import jp.co.recruit.floatingview.R;
import jp.co.recruit.floatingview.databinding.ActivityTestBinding;

/**
 *
 * Created by 201502042 on 2017/9/1.
 */

public class TestActivity extends LifecycleActivity implements TestView{

    private TestPresenter presenter;
    private ActivityTestBinding binding;
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        binding = DataBindingUtil.setContentView(this, R.layout.activity_test);
        binding.setUser(new User(2,3,"Init set user"));
        presenter = new TestPresenter(this);
        ViewModelProviders.of(this).get(UserModel.class).getUserLiveData().observe(this, user -> {
            //update UI
            presenter.inflateUser(user);
        });
    }
    @Override
    public void updateUserInfo(User user) {
        if (user!=null){
            binding.setUser(user);
        }
    }

    @Override
    protected void onStart() {
        super.onStart();
    }
}

@@ -246,16 +246,45 @@
 ullable;
+%0Aimport android.widget.Toast;
 %0A%0Aimport
@@ -502,16 +502,29 @@
 TestView
+,EventHandler
 %7B%0A%0A    p
@@ -857,16 +857,50 @@
 ser%22));%0A
+        binding.setHandler(this);%0A
         
@@ -1112,22 +1112,158 @@
     %7D);%0A
-
     %7D%0A
+%0A    @Override%0A    public void onVClick(User user) %7B%0A        Toast.makeText(this, %22%22+user.getName(), Toast.LENGTH_SHORT).show();%0A    %7D%0A%0A
     @Ove

change some thing