• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java CordovaInterface类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



CordovaInterface类属于org.apache.cordova.api包,在下文中一共展示了CordovaInterface类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: initialize

import org.apache.cordova.api.CordovaInterface; //导入依赖的package包/类
public void initialize(CordovaInterface paramCordovaInterface, CordovaWebView paramCordovaWebView)
{
  super.initialize(paramCordovaInterface, paramCordovaWebView);
  this.sockMan = ((ConnectivityManager)paramCordovaInterface.getActivity().getSystemService("connectivity"));
  this.connectionCallbackContext = null;
  IntentFilter localIntentFilter = new IntentFilter();
  localIntentFilter.addAction("android.net.conn.CONNECTIVITY_CHANGE");
  if (this.receiver == null)
  {
    this.receiver = new BroadcastReceiver()
    {
      public void onReceive(Context paramContext, Intent paramIntent)
      {
        if (NetworkManager.this.webView != null)
          NetworkManager.this.updateConnectionInfo(NetworkManager.this.sockMan.getActiveNetworkInfo());
      }
    };
    paramCordovaInterface.getActivity().registerReceiver(this.receiver, localIntentFilter);
    this.registered = true;
  }
}
 
开发者ID:zhangjianying,项目名称:12306-android-Decompile,代码行数:22,代码来源:NetworkManager.java


示例2: CordovaWebView

import org.apache.cordova.api.CordovaInterface; //导入依赖的package包/类
@TargetApi(11)
public CordovaWebView(Context paramContext, AttributeSet paramAttributeSet, int paramInt, boolean paramBoolean)
{
  super(paramContext, paramAttributeSet, paramInt, paramBoolean);
  if (CordovaInterface.class.isInstance(paramContext))
    this.cordova = ((CordovaInterface)paramContext);
  while (true)
  {
    setWebChromeClient(new CordovaChromeClient(this.cordova));
    initWebViewClient(this.cordova);
    loadConfiguration();
    setup();
    return;
    Log.d("CordovaWebView", "Your activity must implement CordovaInterface to work");
  }
}
 
开发者ID:zhangjianying,项目名称:12306-android-Decompile,代码行数:17,代码来源:CordovaWebView.java


示例3: getRealPath

import org.apache.cordova.api.CordovaInterface; //导入依赖的package包/类
public static String getRealPath(String paramString, CordovaInterface paramCordovaInterface)
{
  String str;
  if (paramString.startsWith("content://"))
  {
    String[] arrayOfString = { "_data" };
    Cursor localCursor = paramCordovaInterface.getActivity().managedQuery(Uri.parse(paramString), arrayOfString, null, null, null);
    int i = localCursor.getColumnIndexOrThrow("_data");
    localCursor.moveToFirst();
    str = localCursor.getString(i);
    if (str == null)
      LOG.e("FileUtils", "Could get real path for URI string %s", new Object[] { paramString });
  }
  while (true)
  {
    return str;
    if (!paramString.startsWith("file://"))
      break;
    str = paramString.substring(7);
    if (!str.startsWith("/android_asset/"))
      continue;
    LOG.e("FileUtils", "Cannot get real path for URI string %s because it is a file:///android_asset/ URI.", new Object[] { paramString });
    return null;
  }
  return paramString;
}
 
开发者ID:zhangjianying,项目名称:12306-android-Decompile,代码行数:27,代码来源:FileHelper.java


示例4: dispatch

import org.apache.cordova.api.CordovaInterface; //导入依赖的package包/类
public PluginResult dispatch(CordovaInterface paramCordovaInterface, JSONArray paramJSONArray)
  throws Throwable
{
  Context localContext = new Context(paramCordovaInterface);
  collectParameters(localContext, paramJSONArray);
  if (this.logger.isLoggable(3))
  {
    this.logger.logDebug("invoking action dispatcher \"" + this.name + "\" with parameters:");
    Iterator localIterator = this.parameters.iterator();
    while (localIterator.hasNext())
    {
      Parameter localParameter = (Parameter)localIterator.next();
      String str = localParameter.getName();
      if (localParameter.isLoggable())
      {
        this.logger.logDebug("   " + str + "=" + localContext.getUntypedParameter(str));
        continue;
      }
      this.logger.logDebug("   " + str + "=[value not logged]");
    }
  }
  return dispatch(localContext);
}
 
开发者ID:zhangjianying,项目名称:12306-android-Decompile,代码行数:24,代码来源:BaseActionDispatcher.java


示例5: initialize

import org.apache.cordova.api.CordovaInterface; //导入依赖的package包/类
/**
 * Sets the context of the Command. This can then be used to do things like
 * get file paths associated with the Activity.
 *
 * @param cordova The context of the main Activity.
 * @param webView The CordovaWebView Cordova is running in.
 */
public void initialize(CordovaInterface cordova, CordovaWebView webView) {
    super.initialize(cordova, webView);
    this.sockMan = (ConnectivityManager) cordova.getActivity().getSystemService(Context.CONNECTIVITY_SERVICE);
    this.connectionCallbackContext = null;

    // We need to listen to connectivity events to update navigator.connection
    IntentFilter intentFilter = new IntentFilter();
    intentFilter.addAction(ConnectivityManager.CONNECTIVITY_ACTION);
    if (this.receiver == null) {
        this.receiver = new BroadcastReceiver() {
            @Override
            public void onReceive(Context context, Intent intent) {
                // (The null check is for the ARM Emulator, please use Intel Emulator for better results)
                if(NetworkManager.this.webView != null)                        
                    updateConnectionInfo(sockMan.getActiveNetworkInfo());
            }
        };
        cordova.getActivity().registerReceiver(this.receiver, intentFilter);
        this.registered = true;
    }

}
 
开发者ID:thedracle,项目名称:cordova-android-chromeview,代码行数:30,代码来源:NetworkManager.java


示例6: CordovaWebView

import org.apache.cordova.api.CordovaInterface; //导入依赖的package包/类
/**
 * Constructor.
 *
 * @param context
 * @param attrs
 */
public CordovaWebView(Context context, AttributeSet attrs) {
    super(context, attrs);
    if (CordovaInterface.class.isInstance(context))
    {
        this.cordova = (CordovaInterface) context;
    }
    else
    {
        Log.d(TAG, "Your activity must implement CordovaInterface to work");
    }
    this.setWebChromeClient(new CordovaChromeClient(this.cordova, this));
    this.initWebViewClient(this.cordova);
    this.loadConfiguration();
    this.setup();
}
 
开发者ID:thedracle,项目名称:cordova-android-chromeview,代码行数:22,代码来源:CordovaWebView.java


示例7: getRealPath

import org.apache.cordova.api.CordovaInterface; //导入依赖的package包/类
/**
 * Returns the real path of the given URI string.
 * If the given URI string represents a content:// URI, the real path is retrieved from the media store.
 *
 * @param uriString the URI string of the audio/image/video
 * @param cordova the current application context
 * @return the full path to the file
 */
@SuppressWarnings("deprecation")
public static String getRealPath(String uriString, CordovaInterface cordova) {
    String realPath = null;

    if (uriString.startsWith("content://")) {
        String[] proj = { _DATA };
        Cursor cursor = cordova.getActivity().managedQuery(Uri.parse(uriString), proj, null, null, null);
        int column_index = cursor.getColumnIndexOrThrow(_DATA);
        cursor.moveToFirst();
        realPath = cursor.getString(column_index);
        if (realPath == null) {
            LOG.e(LOG_TAG, "Could get real path for URI string %s", uriString);
        }
    } else if (uriString.startsWith("file://")) {
        realPath = uriString.substring(7);
        if (realPath.startsWith("/android_asset/")) {
            LOG.e(LOG_TAG, "Cannot get real path for URI string %s because it is a file:///android_asset/ URI.", uriString);
            realPath = null;
        }
    } else {
        realPath = uriString;
    }

    return realPath;
}
 
开发者ID:thedracle,项目名称:cordova-android-chromeview,代码行数:34,代码来源:FileHelper.java


示例8: getMimeType

import org.apache.cordova.api.CordovaInterface; //导入依赖的package包/类
/**
 * Returns the mime type of the data specified by the given URI string.
 *
 * @param uriString the URI string of the data
 * @return the mime type of the specified data
 */
public static String getMimeType(String uriString, CordovaInterface cordova) {
    String mimeType = null;

    Uri uri = Uri.parse(uriString);
    if (uriString.startsWith("content://")) {
        mimeType = cordova.getActivity().getContentResolver().getType(uri);
    } else {
        // MimeTypeMap.getFileExtensionFromUrl() fails when there are query parameters.
        String extension = uri.getPath();
        int lastDot = extension.lastIndexOf('.');
        if (lastDot != -1) {
            extension = extension.substring(lastDot + 1);
        }
        // Convert the URI string to lower case to ensure compatibility with MimeTypeMap (see CB-2185).
        extension = extension.toLowerCase();
        if (extension.equals("3ga")) {
            mimeType = "audio/3gpp";
        } else {
            mimeType = MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension);
        }
    }

    return mimeType;
}
 
开发者ID:thedracle,项目名称:cordova-android-chromeview,代码行数:31,代码来源:FileHelper.java


示例9: activityStart

import org.apache.cordova.api.CordovaInterface; //导入依赖的package包/类
/**
 * Show the spinner.
 *
 * @param title     Title of the dialog
 * @param message   The message of the dialog
 */
public synchronized void activityStart(final String title, final String message) {
    if (this.spinnerDialog != null) {
        this.spinnerDialog.dismiss();
        this.spinnerDialog = null;
    }
    final CordovaInterface cordova = this.cordova;
    Runnable runnable = new Runnable() {
        public void run() {
            Notification.this.spinnerDialog = ProgressDialog.show(cordova.getActivity(), title, message, true, true,
                    new DialogInterface.OnCancelListener() {
                        public void onCancel(DialogInterface dialog) {
                            Notification.this.spinnerDialog = null;
                        }
                    });
        }
    };
    this.cordova.getActivity().runOnUiThread(runnable);
}
 
开发者ID:thedracle,项目名称:cordova-android-chromeview,代码行数:25,代码来源:Notification.java


示例10: CordovaWebView

import org.apache.cordova.api.CordovaInterface; //导入依赖的package包/类
/**
 * Constructor.
 *
 * @param context
 * @param attrs
 */
public CordovaWebView(Context context, AttributeSet attrs) {
    super(context, attrs);
    if (CordovaInterface.class.isInstance(context))
    {
        this.cordova = (CordovaInterface) context;
    }
    else
    {
        Log.d(TAG, "Your activity must implement CordovaInterface to work");
    }
    this.setWebChromeClient(new CordovaChromeClient(this.cordova, this));
    this.initWebViewClient(this.cordova);
    this.loadConfiguration();
    //this.setup();
}
 
开发者ID:R4md4c,项目名称:cordova-android-chromium,代码行数:22,代码来源:CordovaWebView.java


示例11: NativeToJsMessageQueue

import org.apache.cordova.api.CordovaInterface; //导入依赖的package包/类
public NativeToJsMessageQueue(CordovaWebView paramCordovaWebView, CordovaInterface paramCordovaInterface)
{
  this.cordova = paramCordovaInterface;
  this.webView = paramCordovaWebView;
  this.registeredListeners = new BridgeMode[4];
  this.registeredListeners[0] = null;
  this.registeredListeners[1] = new LoadUrlBridgeMode(null);
  this.registeredListeners[2] = new OnlineEventsBridgeMode();
  this.registeredListeners[3] = new PrivateApiBridgeMode(null);
  reset();
}
 
开发者ID:zhangjianying,项目名称:12306-android-Decompile,代码行数:12,代码来源:NativeToJsMessageQueue.java


示例12: initWebViewClient

import org.apache.cordova.api.CordovaInterface; //导入依赖的package包/类
private void initWebViewClient(CordovaInterface paramCordovaInterface)
{
  if ((Build.VERSION.SDK_INT < 11) || (Build.VERSION.SDK_INT > 17))
  {
    setWebViewClient(new CordovaWebViewClient(this.cordova, this));
    return;
  }
  setWebViewClient(new IceCreamCordovaWebViewClient(this.cordova, this));
}
 
开发者ID:zhangjianying,项目名称:12306-android-Decompile,代码行数:10,代码来源:CordovaWebView.java


示例13: getInputStreamFromUriString

import org.apache.cordova.api.CordovaInterface; //导入依赖的package包/类
public static InputStream getInputStreamFromUriString(String paramString, CordovaInterface paramCordovaInterface)
  throws IOException
{
  if (paramString.startsWith("content"))
  {
    Uri localUri = Uri.parse(paramString);
    return paramCordovaInterface.getActivity().getContentResolver().openInputStream(localUri);
  }
  if (paramString.startsWith("file:///android_asset/"))
  {
    String str = paramString.substring(22);
    return paramCordovaInterface.getActivity().getAssets().open(str);
  }
  return new FileInputStream(getRealPath(paramString, paramCordovaInterface));
}
 
开发者ID:zhangjianying,项目名称:12306-android-Decompile,代码行数:16,代码来源:FileHelper.java


示例14: getMimeType

import org.apache.cordova.api.CordovaInterface; //导入依赖的package包/类
public static String getMimeType(String paramString, CordovaInterface paramCordovaInterface)
{
  if (paramString.startsWith("content://"))
  {
    Uri localUri = Uri.parse(paramString);
    return paramCordovaInterface.getActivity().getContentResolver().getType(localUri);
  }
  String str = MimeTypeMap.getFileExtensionFromUrl(paramString.replace(" ", "%20").toLowerCase());
  if (str.equals("3ga"))
    return "audio/3gpp";
  return MimeTypeMap.getSingleton().getMimeTypeFromExtension(str);
}
 
开发者ID:zhangjianying,项目名称:12306-android-Decompile,代码行数:13,代码来源:FileHelper.java


示例15: initialize

import org.apache.cordova.api.CordovaInterface; //导入依赖的package包/类
public void initialize(CordovaInterface paramCordovaInterface, CordovaWebView paramCordovaWebView)
{
  super.initialize(paramCordovaInterface, paramCordovaWebView);
  validateGCMSetup();
  if (this.isGCMSetupValid)
  {
    unregisterReceivers();
    if (paramCordovaInterface != null)
    {
      if (this.onMessageReceiver == null)
        this.onMessageReceiver = new BroadcastReceiver()
        {
          public void onReceive(Context paramContext, Intent paramIntent)
          {
            WLUtils.debug("Queuing message for dispatch to javascript");
            synchronized (Push.this.pending)
            {
              Push.this.pending.add((WLGCMIntentService.Message)paramIntent.getParcelableExtra("message"));
              Push.this.dispatchPending();
              if (!paramIntent.getBooleanExtra("notificationBar", false))
                setResultCode(-1);
              return;
            }
          }
        };
      paramCordovaInterface.getActivity().registerReceiver(this.onMessageReceiver, new IntentFilter(WLUtils.getFullAppName(paramCordovaInterface.getActivity()) + ".C2DM_MESSAGE"));
      Activity localActivity = (Activity)paramCordovaInterface;
      if ((WLUtils.getFullAppName(this.cordova.getActivity()) + ".NOTIFICATION").equals(localActivity.getIntent().getAction()))
      {
        WLUtils.debug("Activity started from message notification");
        localActivity.getIntent().putExtra("notificationBar", true);
        this.onMessageReceiver.onReceive(this.cordova.getActivity(), localActivity.getIntent());
      }
    }
    dispatchPending();
  }
}
 
开发者ID:zhangjianying,项目名称:12306-android-Decompile,代码行数:38,代码来源:Push.java


示例16: ActionDispatcherRunnable

import org.apache.cordova.api.CordovaInterface; //导入依赖的package包/类
private ActionDispatcherRunnable(ActionDispatcher paramJSONArray, JSONArray paramCordovaInterface, CordovaInterface paramCallbackContext, CallbackContext arg5)
{
  this.args = paramCordovaInterface;
  Object localObject;
  this.callbackContext = localObject;
  this.context = paramCallbackContext;
  this.dispatcher = paramJSONArray;
}
 
开发者ID:zhangjianying,项目名称:12306-android-Decompile,代码行数:9,代码来源:DispatchingPlugin.java


示例17: initialize

import org.apache.cordova.api.CordovaInterface; //导入依赖的package包/类
/**
 * Initialize the Plugin, Cordova handles this.
 * 
 * @param cordova	Used to get register Handler with the Context accessible from this interface 
 * @param view		Passed straight to super's initialization.
 */
public void initialize(CordovaInterface cordova, CordovaWebView view)
{
	super.initialize(cordova, view);

	_bluetooth = new BluetoothWrapper(cordova.getActivity().getBaseContext(), _handler);
	_wasDiscoveryCanceled = false;
}
 
开发者ID:nadavelyashiv,项目名称:metal-finder-new,代码行数:14,代码来源:BluetoothPlugin.java


示例18: NativeToJsMessageQueue

import org.apache.cordova.api.CordovaInterface; //导入依赖的package包/类
public NativeToJsMessageQueue(CordovaWebView webView, CordovaInterface cordova) {
    this.cordova = cordova;
    this.webView = webView;
    registeredListeners = new BridgeMode[4];
    registeredListeners[0] = null;  // Polling. Requires no logic.
    registeredListeners[1] = new LoadUrlBridgeMode();
    registeredListeners[2] = new OnlineEventsBridgeMode();
    registeredListeners[3] = new PrivateApiBridgeMode();
    reset();
}
 
开发者ID:thedracle,项目名称:cordova-android-chromeview,代码行数:11,代码来源:NativeToJsMessageQueue.java


示例19: initWebViewClient

import org.apache.cordova.api.CordovaInterface; //导入依赖的package包/类
private void initWebViewClient(CordovaInterface cordova) {
    if(android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.HONEYCOMB ||
            android.os.Build.VERSION.SDK_INT > android.os.Build.VERSION_CODES.JELLY_BEAN_MR1)
    {
        this.setWebViewClient(new CordovaWebViewClient(this.cordova, this));
    }
    else
    {
        this.setWebViewClient(new IceCreamCordovaWebViewClient(this.cordova, this));
    }
}
 
开发者ID:thedracle,项目名称:cordova-android-chromeview,代码行数:12,代码来源:CordovaWebView.java


示例20: progressStart

import org.apache.cordova.api.CordovaInterface; //导入依赖的package包/类
/**
 * Show the progress dialog.
 *
 * @param title     Title of the dialog
 * @param message   The message of the dialog
 */
public synchronized void progressStart(final String title, final String message) {
    if (this.progressDialog != null) {
        this.progressDialog.dismiss();
        this.progressDialog = null;
    }
    final Notification notification = this;
    final CordovaInterface cordova = this.cordova;
    Runnable runnable = new Runnable() {
        public void run() {
            notification.progressDialog = new ProgressDialog(cordova.getActivity());
            notification.progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
            notification.progressDialog.setTitle(title);
            notification.progressDialog.setMessage(message);
            notification.progressDialog.setCancelable(true);
            notification.progressDialog.setMax(100);
            notification.progressDialog.setProgress(0);
            notification.progressDialog.setOnCancelListener(
                    new DialogInterface.OnCancelListener() {
                        public void onCancel(DialogInterface dialog) {
                            notification.progressDialog = null;
                        }
                    });
            notification.progressDialog.show();
        }
    };
    this.cordova.getActivity().runOnUiThread(runnable);
}
 
开发者ID:thedracle,项目名称:cordova-android-chromeview,代码行数:34,代码来源:Notification.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ICellRegistry类代码示例发布时间:2022-05-23
下一篇:
Java DoFinalizeResponseProto类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap