Created
July 17, 2013 00:39
-
-
Save acidjazz/6016632 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.plugin.drawer; | |
import org.apache.cordova.api.CallbackContext; | |
import org.apache.cordova.api.CordovaPlugin; | |
import org.apache.cordova.api.PluginResult; | |
import org.json.JSONArray; | |
import android.util.Log; | |
import android.support.v4.widget.DrawerLayout.DrawerListener; | |
import android.view.View; | |
import com.samsung.gea.NavDrawerDroidGap; | |
public class NavDrawerPlugin extends CordovaPlugin implements DrawerListener { | |
protected NavDrawerDroidGap drawerActivity; | |
protected CallbackContext context; | |
public void initDrawer() { | |
NavDrawerDroidGap drawerActivity = (NavDrawerDroidGap) cordova.getActivity(); | |
drawerActivity.setDrawerListener(this); | |
} | |
public boolean execute(String action, JSONArray args, CallbackContext callbackContext) { | |
if (action.equals("init")) { | |
initDrawer(); | |
this.context = callbackContext; | |
//this.context.success("inited"); | |
PluginResult result = new PluginResult(PluginResult.Status.OK, "inited"); | |
result.setKeepCallback(true); | |
this.context.sendPluginResult(result); | |
Log.w("DRAWER", "DRAWER INIT COMPLETE"); | |
} | |
return true; | |
} | |
@Override | |
public void onDrawerClosed(View arg0) { | |
// TODO Auto-generated method stub | |
PluginResult result = new PluginResult(PluginResult.Status.OK, "close"); | |
result.setKeepCallback(true); | |
this.context.sendPluginResult(result); | |
} | |
@Override | |
public void onDrawerOpened(View arg0) { | |
// TODO Auto-generated method stub | |
PluginResult result = new PluginResult(PluginResult.Status.OK, "open"); | |
result.setKeepCallback(true); | |
this.context.sendPluginResult(result); | |
} | |
@Override | |
public void onDrawerSlide(View arg0, float arg1) { | |
// TODO Auto-generated method stub | |
//this.context.success("onDrawerSlide"); | |
} | |
@Override | |
public void onDrawerStateChanged(int arg0) { | |
// TODO Auto-generated method stub | |
//this.context.success("onDrawerStateChanged"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment