Newer
Older
Cactus-CleanArchitecture / app / src / main / java / org / ntlab / radishforandroidstudio / framework / RWT / RWTUIFragment.java
package org.ntlab.radishforandroidstudio.framework.RWT;


import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;


import org.ntlab.radishforandroidstudio.R;
import org.ntlab.radishforandroidstudio.cactusClient.models.OwnPlayer;
import org.ntlab.radishforandroidstudio.cactusClient.views.PlayerFragment;
import org.ntlab.radishforandroidstudio.framework.event.PadEvent;
import org.ntlab.radishforandroidstudio.framework.listener.PadListener;
import org.ntlab.radishforandroidstudio.framework.physics.Velocity3D;

import static android.view.View.*;
import static org.ntlab.radishforandroidstudio.framework.subject.PadSubject.own;

public class RWTUIFragment extends Fragment implements OnTouchListener,PadListener {
    PlayerFragment listener = null;
    View v = null;

    public RWTUIFragment() {}

    @Override
    public void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);

    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        v = inflater.inflate(R.layout.ui_fragment, container, false);
        RWTPad pad = v.findViewById(R.id.pad);
        pad.addListener(this);

        if (listener != null) {
            listener.onCreateFragmentEvent(this);
        }
        return inflater.inflate(R.layout.ui_fragment, null);
    }

    @Override
    public boolean onTouch(View v, MotionEvent event) {
        System.out.println("RWTUIFragment touch");
        return false;
    }

    @Override
    public boolean onEvent(PadEvent event) {
        return false;
    }

    public View findViewById(int id) {
        return v.findViewById(id);
    }

    public void setListener(PlayerFragment playerFragment) {
        listener = playerFragment;
    }
}