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 org.ntlab.radishforandroidstudio.R;
import org.ntlab.radishforandroidstudio.cactusClient.PlayerActivity;
import org.ntlab.radishforandroidstudio.framework.event.PadEvent;
import org.ntlab.radishforandroidstudio.framework.listener.PadListener;

import static android.view.View.*;

public class RWTUIFragment extends Fragment implements OnTouchListener,PadListener {
    PlayerActivity 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 void setListener(PlayerActivity activity) {
        listener = activity;
    }

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

}