当前位置: 首页>>代码示例>>Java>>正文


Java CallbackContext.success方法代码示例

本文整理汇总了Java中org.apache.cordova.CallbackContext.success方法的典型用法代码示例。如果您正苦于以下问题:Java CallbackContext.success方法的具体用法?Java CallbackContext.success怎么用?Java CallbackContext.success使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.cordova.CallbackContext的用法示例。


在下文中一共展示了CallbackContext.success方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: execute

import org.apache.cordova.CallbackContext; //导入方法依赖的package包/类
@Override
public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException {
    if (action.equals("hide")) {
        cordova.getActivity().runOnUiThread(new Runnable() {
            public void run() {
                webView.postMessage("splashscreen", "hide");
            }
        });
    } else if (action.equals("show")) {
        cordova.getActivity().runOnUiThread(new Runnable() {
            public void run() {
                webView.postMessage("splashscreen", "show");
            }
        });
    } else {
        return false;
    }

    callbackContext.success();
    return true;
}
 
开发者ID:Andy-Ta,项目名称:COB,代码行数:22,代码来源:SplashScreen.java

示例2: execute

import org.apache.cordova.CallbackContext; //导入方法依赖的package包/类
/**
 * Executes the request and returns PluginResult.
 *
 * @param action            The action to execute.
 * @param args              JSONArry of arguments for the plugin.
 * @param callbackContext   The callback id used when calling back into JavaScript.
 * @return                  True if the action was valid, false if not.
 */
public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException {
    if ("getDeviceInfo".equals(action)) {
        JSONObject r = new JSONObject();
        r.put("uuid", Device.uuid);
        r.put("version", this.getOSVersion());
        r.put("platform", this.getPlatform());
        r.put("model", this.getModel());
        r.put("manufacturer", this.getManufacturer());
     r.put("isVirtual", this.isVirtual());
        r.put("serial", this.getSerialNumber());
        callbackContext.success(r);
    }
    else {
        return false;
    }
    return true;
}
 
开发者ID:SUTFutureCoder,项目名称:localcloud_fe,代码行数:26,代码来源:Device.java

示例3: jsSetPluginOptions

import org.apache.cordova.CallbackContext; //导入方法依赖的package包/类
/**
 * Set plugin options. Method is called from JavaScript.
 *
 * @param arguments arguments from JavaScript
 * @param callback  callback where to send result
 */
@Deprecated
private void jsSetPluginOptions(CordovaArgs arguments, CallbackContext callback) {
    if (!isPluginReadyForWork) {
        sendPluginNotReadyToWork("", callback);
        return;
    }

    try {
        JSONObject jsonObject = (JSONObject) arguments.get(0);
        chcpXmlConfig.mergeOptionsFromJs(jsonObject);
        // TODO: store them somewhere?
    } catch (JSONException e) {
        Log.d("CHCP", "Failed to process plugin options, received from JS.", e);
    }

    callback.success();
}
 
开发者ID:SUTFutureCoder,项目名称:localcloud_fe,代码行数:24,代码来源:HotCodePushPlugin.java

示例4: getWhiteBalanceMode

import org.apache.cordova.CallbackContext; //导入方法依赖的package包/类
private boolean getWhiteBalanceMode(CallbackContext callbackContext) {
  if(this.hasCamera(callbackContext) == false){
    return true;
  }

  Camera camera = fragment.getCamera();
  Camera.Parameters params = camera.getParameters();

  String whiteBalanceMode;

  if (camera.getParameters().isAutoWhiteBalanceLockSupported()) {
    if (camera.getParameters().getAutoWhiteBalanceLock()) {
      whiteBalanceMode = "lock";
    } else {
      whiteBalanceMode = camera.getParameters().getWhiteBalance();
    };
  } else {
    whiteBalanceMode = camera.getParameters().getWhiteBalance();
  }
  if (whiteBalanceMode != null) {
    callbackContext.success(whiteBalanceMode);
  } else {
    callbackContext.error("White balance mode not supported");
  }
  return true;
}
 
开发者ID:MrShakes,项目名称:cameraPreviewStream,代码行数:27,代码来源:CameraPreview.java

示例5: setExposureCompensation

import org.apache.cordova.CallbackContext; //导入方法依赖的package包/类
private boolean setExposureCompensation(int exposureCompensation, CallbackContext callbackContext) {
  if(this.hasCamera(callbackContext) == false){
    return true;
  }

  Camera camera = fragment.getCamera();
  Camera.Parameters params = camera.getParameters();

  int minExposureCompensation = camera.getParameters().getMinExposureCompensation();
  int maxExposureCompensation = camera.getParameters().getMaxExposureCompensation();

  if ( minExposureCompensation == 0 && maxExposureCompensation == 0) {
    callbackContext.error("Exposure corection not supported");
  } else {
    if (exposureCompensation < minExposureCompensation) {
      exposureCompensation = minExposureCompensation;
    } else if (exposureCompensation > maxExposureCompensation) {
      exposureCompensation = maxExposureCompensation;
    }
    params.setExposureCompensation(exposureCompensation);
    fragment.setCameraParameters(params);

    callbackContext.success(exposureCompensation);
  }
return true;
}
 
开发者ID:MrShakes,项目名称:cameraPreviewStream,代码行数:27,代码来源:CameraPreview.java

示例6: setFocusMode

import org.apache.cordova.CallbackContext; //导入方法依赖的package包/类
private boolean setFocusMode(String focusMode, CallbackContext callbackContext) {
  if(this.hasCamera(callbackContext) == false){
    return true;
  }

  Camera camera = fragment.getCamera();
  Camera.Parameters params = camera.getParameters();

  List<String> supportedFocusModes;
  List<String> supportedAutoFocusModes = Arrays.asList("auto", "continuous-picture", "continuous-video","macro");
  supportedFocusModes = params.getSupportedFocusModes();
  if (supportedFocusModes.indexOf(focusMode) > -1) {
    params.setFocusMode(focusMode);
    fragment.setCameraParameters(params);
    callbackContext.success(focusMode);
    return true;
  } else {
    callbackContext.error("Focus mode not recognised: " + focusMode);
    return true;
  }
}
 
开发者ID:MrShakes,项目名称:cameraPreviewStream,代码行数:22,代码来源:CameraPreview.java

示例7: execute

import org.apache.cordova.CallbackContext; //导入方法依赖的package包/类
@Override
public boolean execute(String action, JSONArray args, final CallbackContext callbackContext) throws JSONException {
    if (action.equals("upload") || action.equals("download")) {
        String source = args.getString(0);
        String target = args.getString(1);

        if (action.equals("upload")) {
            upload(source, target, args, callbackContext);
        } else {
            download(source, target, args, callbackContext);
        }
        return true;
    } else if (action.equals("abort")) {
        String objectId = args.getString(0);
        abort(objectId);
        callbackContext.success();
        return true;
    }
    return false;
}
 
开发者ID:disit,项目名称:siiMobilityAppKit,代码行数:21,代码来源:FileTransfer.java

示例8: getSupportedFlashModes

import org.apache.cordova.CallbackContext; //导入方法依赖的package包/类
private boolean getSupportedFlashModes(CallbackContext callbackContext) {
  if(this.hasCamera(callbackContext) == false){
    return true;
  }

  Camera camera = fragment.getCamera();
  Camera.Parameters params = camera.getParameters();
  List<String> supportedFlashModes;
  supportedFlashModes = params.getSupportedFlashModes();
  JSONArray jsonFlashModes = new JSONArray();

  if (supportedFlashModes != null) {
    for (int i=0; i<supportedFlashModes.size(); i++) {
        jsonFlashModes.put(new String(supportedFlashModes.get(i)));
    }
  }

  callbackContext.success(jsonFlashModes);
  return true;
}
 
开发者ID:MrShakes,项目名称:cameraPreviewStream,代码行数:21,代码来源:CameraPreview.java

示例9: showCamera

import org.apache.cordova.CallbackContext; //导入方法依赖的package包/类
private boolean showCamera(CallbackContext callbackContext) {
  if(this.hasView(callbackContext) == false){
    return true;
  }

  FragmentManager fragmentManager = cordova.getActivity().getFragmentManager();
  FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
  fragmentTransaction.show(fragment);
  fragmentTransaction.commit();

  callbackContext.success();
  return true;
}
 
开发者ID:MrShakes,项目名称:cameraPreviewStream,代码行数:14,代码来源:CameraPreview.java

示例10: routeScreenOrientation

import org.apache.cordova.CallbackContext; //导入方法依赖的package包/类
private boolean routeScreenOrientation(JSONArray args, CallbackContext callbackContext) {
    
    String action = args.optString(0);
    
    
    
    String orientation = args.optString(1);
    
    Log.d(TAG, "Requested ScreenOrientation: " + orientation);
    
    Activity activity = cordova.getActivity();
    
    if (orientation.equals(ANY)) {
        activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
    } else if (orientation.equals(LANDSCAPE_PRIMARY)) {
        activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
    } else if (orientation.equals(PORTRAIT_PRIMARY)) {
        activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
    } else if (orientation.equals(LANDSCAPE)) {
        activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE);
    } else if (orientation.equals(PORTRAIT)) {
        activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT);
    } else if (orientation.equals(LANDSCAPE_SECONDARY)) {
        activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE);
    } else if (orientation.equals(PORTRAIT_SECONDARY)) {
        activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT);
    }
    
    callbackContext.success();
    return true;
    
    
}
 
开发者ID:disit,项目名称:siiMobilityAppKit,代码行数:34,代码来源:CDVOrientation.java

示例11: executeUnconnect

import org.apache.cordova.CallbackContext; //导入方法依赖的package包/类
private PluginResult executeUnconnect(JSONArray args, final CallbackContext callbackContext){
    Log.w(LOG_TAG, "executeUnconnect");

    finding = false;
    if (wifitosg != null)
        wifitosg.UnConnect();
    callbackContext.success();
    return null;
}
 
开发者ID:vidding,项目名称:cordova-plugins-auto-wifi,代码行数:10,代码来源:AutoWifi.java

示例12: getJcLogPath

import org.apache.cordova.CallbackContext; //导入方法依赖的package包/类
private void getJcLogPath(final CallbackContext callbackContext) {
    final File fileToCopy = FileTools.prepareDownload(lcFile, lcBak, lcCon);
    if (fileToCopy != null && fileToCopy.exists()) {
        callbackContext.success(fileToCopy.getAbsolutePath());
    } else {
        callbackContext.error(RETURN_CODE.NO_LOG_FILES_FOUND.name());
    }
}
 
开发者ID:kolbasa,项目名称:cordova-logcat-filelogger,代码行数:9,代码来源:LogCatPlugin.java

示例13: getTriggeredIds

import org.apache.cordova.CallbackContext; //导入方法依赖的package包/类
/**
 * Set of IDs from all triggered notifications.
 *
 * @param command
 *      The callback context used when calling back into JavaScript.
 */
private void getTriggeredIds (CallbackContext command) {
    List<Integer> ids = getNotificationMgr().getIdsByType(
            Notification.Type.TRIGGERED);

    command.success(new JSONArray(ids));
}
 
开发者ID:disit,项目名称:siiMobilityAppKit,代码行数:13,代码来源:LocalNotification.java

示例14: stopCamera

import org.apache.cordova.CallbackContext; //导入方法依赖的package包/类
private boolean stopCamera(CallbackContext callbackContext) {
  if(this.hasView(callbackContext) == false){
    return true;
  }

  FragmentManager fragmentManager = cordova.getActivity().getFragmentManager();
  FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
  fragmentTransaction.remove(fragment);
  fragmentTransaction.commit();
  fragment = null;

  callbackContext.success();
  return true;
}
 
开发者ID:MrShakes,项目名称:cameraPreviewStream,代码行数:15,代码来源:CameraPreview.java

示例15: stopLogging

import org.apache.cordova.CallbackContext; //导入方法依赖的package包/类
private void stopLogging(final CallbackContext callbackContext) {
    if (this.bashExecuter != null) {
        this.bashExecuter.killProcess();
        this.bashExecuter = null;
    }

    if (this.loggerThread != null) {
        this.loggerThread.interrupt();
        this.loggerThread = null;
    }

    if (callbackContext != null) {
        callbackContext.success();
    }
}
 
开发者ID:kolbasa,项目名称:cordova-logcat-filelogger,代码行数:16,代码来源:LogCatPlugin.java


注:本文中的org.apache.cordova.CallbackContext.success方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。