sap.ui.define(

[
  "jquery.sap.global",
  "sap/m/MessageToast",
  "sap/ui/core/Fragment",
  "sap/ui/core/mvc/Controller",
  "sap/ui/model/Filter",
  "sap/ui/model/odata/ODataModel"
],
function(jQuery, MessageToast, Fragment, Controller, Filter, ODataModel) {
  "use strict";

  var CController = Controller.extend("fivea.controller.FiveApplesApp", {
    onOrientationChange: function(oEvent) {
      var bLandscapeOrientation = oEvent.getParameter("landscape"),
        sMsg =
          "Orientation now is: " +
          (bLandscapeOrientation ? "Landscape" : "Portrait");
      MessageToast.show(sMsg, { duration: 5000 });
    },

    onPressNavToDetail: function(oEvent) {
      this.getSplitAppObj().to(this.createId("detailDetail"));
    },

    onPressDetailBack: function() {
      this.getSplitAppObj().backDetail();
    },

    onPressMasterBack: function() {
      this.getSplitAppObj().backMaster();
    },

    onPressGoToMaster: function() {
      this.getSplitAppObj().toMaster(this.createId("master"));
    },

    onListItemPress: function(oEvent) {
      var sToPageId = oEvent
        .getParameter("listItem")
        .getCustomData()[0]
        .getValue();

      this.getSplitAppObj().toDetail(this.createId(sToPageId));
    },

    onPressModeBtn: function(oEvent) {
      var sSplitAppMode = oEvent
        .getSource()
        .getSelectedButton()
        .getCustomData()[0]
        .getValue();

      this.getSplitAppObj().setMode(sSplitAppMode);
      MessageToast.show(
        "Split Container mode is changed to: " + sSplitAppMode,
        { duration: 5000 }
      );
    },

    getSplitAppObj: function() {
      var result = this.byId("FiveApplesApp");
      if (!result) {
        jQuery.sap.log.info("FiveApplesApp object can't be found");
      }
      return result;
    }
  });

  return CController;
}

);