package com.eje_c.meganekko.sample;

import com.eje_c.meganekko.Meganekko;
import com.eje_c.meganekko.MeganekkoApp;
import com.eje_c.meganekko.utility.Log;

/**
 * Meganekko's main app logics.
 */
public class MyApp extends MeganekkoApp {
    private static final String TAG = "MGN";
    private FirstScene firstScene; // cache first scene for returning from switched scene

    public MyApp(Meganekko meganekko) {
        super(meganekko);

        // Set first scene
        setSceneFromXML(R.xml.first_scene);
    }

    /**
     * Called on every frame update.
     */
    @Override
    public void update() {
        super.update(); // This is important! Don't forget to call super.update();
//        Log.d(TAG, "update");
    }

    @Override
    public void shutdown() {
        Log.d(TAG, "shutdown");
    }

    /**
     * Called when {@code Activity.onResume} was called.
     * Note: This method will not be called on first launch.
     */
    @Override
    public void onResume() {
        Log.d(TAG, "resumed");
    }

    /**
     * Called when {@code Activity.onPause} was called.
     * Note: This method will be called about after 10 seconds from device is detached from Gear VR.
     */
    @Override
    public void onPause() {
        Log.d(TAG, "paused");
    }

    /**
     * Called from {@link FirstScene}.
     */
    public void onTapButton() {
        if (getScene() instanceof FirstScene) {
            firstScene = (FirstScene) getScene();
            setSceneFromXML(R.xml.second_scene);
        }
    }

    /**
     * Called from {@link FirstScene}.
     */
    public void onTapVideocam() {
        if (getScene() instanceof FirstScene) {
            firstScene = (FirstScene) getScene();
            setSceneFromXML(R.xml.video_scene);
        }
    }

    /**
     * Called from {@link SecondScene} and {@link VideoScene}.
     */
    public void returnToHome() {
        setScene(firstScene);
    }
}

@@ -150,16 +150,39 @@
 y.Log;%0A%0A
+import ovr.JoyButton;%0A%0A
 /**%0A * M
@@ -712,16 +712,847 @@
 pdate();
+%0A%0A        final int buttonPressed = getFrame().getButtonPressed();%0A        if (JoyButton.contains(buttonPressed, JoyButton.BUTTON_TOUCH_SINGLE)) %7B%0A            Log.d(TAG, %22on single tap%22);%0A        %7D else if (JoyButton.contains(buttonPressed, JoyButton.BUTTON_TOUCH_DOUBLE)) %7B%0A            Log.d(TAG, %22on double tap%22);%0A        %7D else if (JoyButton.contains(buttonPressed, JoyButton.BUTTON_SWIPE_BACK)) %7B%0A            Log.d(TAG, %22on swipe back%22);%0A        %7D else if (JoyButton.contains(buttonPressed, JoyButton.BUTTON_SWIPE_FORWARD)) %7B%0A            Log.d(TAG, %22on swipe forward%22);%0A        %7D else if (JoyButton.contains(buttonPressed, JoyButton.BUTTON_SWIPE_UP)) %7B%0A            Log.d(TAG, %22on swipe up%22);%0A        %7D else if (JoyButton.contains(buttonPressed, JoyButton.BUTTON_SWIPE_DOWN)) %7B%0A            Log.d(TAG, %22on swipe down%22);%0A        %7D
 %0A//     

Update sample