org.apache.cordova.LOG#i ( )源码实例Demo

下面列出了org.apache.cordova.LOG#i ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: BigDataPlatform   文件: SystemWebViewEngine.java
private static void exposeJsInterface(WebView webView, CordovaBridge bridge) {
    if ((Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1)) {
        LOG.i(TAG, "Disabled addJavascriptInterface() bridge since Android version is old.");
        // Bug being that Java Strings do not get converted to JS strings automatically.
        // This isn't hard to work-around on the JS side, but it's easier to just
        // use the prompt bridge instead.
        return;
    }
    SystemExposedJsApi exposedJsApi = new SystemExposedJsApi(bridge);
    webView.addJavascriptInterface(exposedJsApi, "_cordovaNative");
}
 
源代码2 项目: xmall   文件: SystemWebViewEngine.java
@SuppressLint("AddJavascriptInterface")
private static void exposeJsInterface(WebView webView, CordovaBridge bridge) {
    if ((Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1)) {
        LOG.i(TAG, "Disabled addJavascriptInterface() bridge since Android version is old.");
        // Bug being that Java Strings do not get converted to JS strings automatically.
        // This isn't hard to work-around on the JS side, but it's easier to just
        // use the prompt bridge instead.
        return;
    }
    SystemExposedJsApi exposedJsApi = new SystemExposedJsApi(bridge);
    webView.addJavascriptInterface(exposedJsApi, "_cordovaNative");
}
 
源代码3 项目: bluemix-parking-meter   文件: App.java
/**
 * Listen for telephony events: RINGING, OFFHOOK and IDLE
 * Send these events to all plugins using
 *      CordovaActivity.onMessage("telephone", "ringing" | "offhook" | "idle")
 */
private void initTelephonyReceiver() {
    IntentFilter intentFilter = new IntentFilter();
    intentFilter.addAction(TelephonyManager.ACTION_PHONE_STATE_CHANGED);
    //final CordovaInterface mycordova = this.cordova;
    this.telephonyReceiver = new BroadcastReceiver() {

        @Override
        public void onReceive(Context context, Intent intent) {

            // If state has changed
            if ((intent != null) && intent.getAction().equals(TelephonyManager.ACTION_PHONE_STATE_CHANGED)) {
                if (intent.hasExtra(TelephonyManager.EXTRA_STATE)) {
                    String extraData = intent.getStringExtra(TelephonyManager.EXTRA_STATE);
                    if (extraData.equals(TelephonyManager.EXTRA_STATE_RINGING)) {
                        LOG.i(TAG, "Telephone RINGING");
                        webView.postMessage("telephone", "ringing");
                    }
                    else if (extraData.equals(TelephonyManager.EXTRA_STATE_OFFHOOK)) {
                        LOG.i(TAG, "Telephone OFFHOOK");
                        webView.postMessage("telephone", "offhook");
                    }
                    else if (extraData.equals(TelephonyManager.EXTRA_STATE_IDLE)) {
                        LOG.i(TAG, "Telephone IDLE");
                        webView.postMessage("telephone", "idle");
                    }
                }
            }
        }
    };

    // Register the receiver
    webView.getContext().registerReceiver(this.telephonyReceiver, intentFilter);
}
 
private static void exposeJsInterface(WebView webView, CordovaBridge bridge) {
    if ((Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1)) {
        LOG.i(TAG, "Disabled addJavascriptInterface() bridge since Android version is old.");
        // Bug being that Java Strings do not get converted to JS strings automatically.
        // This isn't hard to work-around on the JS side, but it's easier to just
        // use the prompt bridge instead.
        return;
    }
    X5ExposedJsApi exposedJsApi = new X5ExposedJsApi(bridge);
    webView.addJavascriptInterface(exposedJsApi, "_cordovaNative");
}
 
源代码5 项目: crosswalk-cordova-android   文件: App.java
/**
 * Listen for telephony events: RINGING, OFFHOOK and IDLE
 * Send these events to all plugins using
 *      CordovaActivity.onMessage("telephone", "ringing" | "offhook" | "idle")
 */
private void initTelephonyReceiver() {
    IntentFilter intentFilter = new IntentFilter();
    intentFilter.addAction(TelephonyManager.ACTION_PHONE_STATE_CHANGED);
    //final CordovaInterface mycordova = this.cordova;
    this.telephonyReceiver = new BroadcastReceiver() {

        @Override
        public void onReceive(Context context, Intent intent) {

            // If state has changed
            if ((intent != null) && intent.getAction().equals(TelephonyManager.ACTION_PHONE_STATE_CHANGED)) {
                if (intent.hasExtra(TelephonyManager.EXTRA_STATE)) {
                    String extraData = intent.getStringExtra(TelephonyManager.EXTRA_STATE);
                    if (extraData.equals(TelephonyManager.EXTRA_STATE_RINGING)) {
                        LOG.i(TAG, "Telephone RINGING");
                        webView.postMessage("telephone", "ringing");
                    }
                    else if (extraData.equals(TelephonyManager.EXTRA_STATE_OFFHOOK)) {
                        LOG.i(TAG, "Telephone OFFHOOK");
                        webView.postMessage("telephone", "offhook");
                    }
                    else if (extraData.equals(TelephonyManager.EXTRA_STATE_IDLE)) {
                        LOG.i(TAG, "Telephone IDLE");
                        webView.postMessage("telephone", "idle");
                    }
                }
            }
        }
    };

    // Register the receiver
    this.cordova.getActivity().registerReceiver(this.telephonyReceiver, intentFilter);
}
 
源代码6 项目: L.TileLayer.Cordova   文件: App.java
/**
 * Override the default behavior of the Android volume buttons.
 * If overridden, when the volume button is pressed, the "volume[up|down]button" JavaScript event will be fired.
 *
 * @param button        volumeup, volumedown
 * @param override      T=override, F=cancel override
 */
public void overrideButton(String button, boolean override) {
    LOG.i("App", "WARNING: Volume Button Default Behavior will be overridden.  The volume event will be fired!");
    if (button.equals("volumeup")) {
        webView.setButtonPlumbedToJs(KeyEvent.KEYCODE_VOLUME_UP, override);
    }
    else if (button.equals("volumedown")) {
        webView.setButtonPlumbedToJs(KeyEvent.KEYCODE_VOLUME_DOWN, override);
    }
}
 
源代码7 项目: IoTgo_Android_App   文件: CordovaActivity.java
/**
 * Called when the activity is first created.
 */
@Override
public void onCreate(Bundle savedInstanceState) {
    LOG.i(TAG, "Apache Cordova native platform version " + CordovaWebView.CORDOVA_VERSION + " is starting");
    LOG.d(TAG, "CordovaActivity.onCreate()");

    // need to activate preferences before super.onCreate to avoid "requestFeature() must be called before adding content" exception
    loadConfig();
    if(!preferences.getBoolean("ShowTitle", false))
    {
        getWindow().requestFeature(Window.FEATURE_NO_TITLE);
    }
    
    if(preferences.getBoolean("SetFullscreen", false))
    {
        Log.d(TAG, "The SetFullscreen configuration is deprecated in favor of Fullscreen, and will be removed in a future version.");
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                WindowManager.LayoutParams.FLAG_FULLSCREEN);
    } else if (preferences.getBoolean("Fullscreen", false)) {
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                WindowManager.LayoutParams.FLAG_FULLSCREEN);
    } else {
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN,
                WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
    }

    super.onCreate(savedInstanceState);

    if(savedInstanceState != null)
    {
        initCallbackClass = savedInstanceState.getString("callbackClass");
    }
}
 
源代码8 项目: cordova-amazon-fireos   文件: Device.java
/**
 * Listen for telephony events: RINGING, OFFHOOK and IDLE
 * Send these events to all plugins using
 *      CordovaActivity.onMessage("telephone", "ringing" | "offhook" | "idle")
 */
private void initTelephonyReceiver() {
    IntentFilter intentFilter = new IntentFilter();
    intentFilter.addAction(TelephonyManager.ACTION_PHONE_STATE_CHANGED);
    //final CordovaInterface mycordova = this.cordova;
    this.telephonyReceiver = new BroadcastReceiver() {

        @Override
        public void onReceive(Context context, Intent intent) {

            // If state has changed
            if ((intent != null) && intent.getAction().equals(TelephonyManager.ACTION_PHONE_STATE_CHANGED)) {
                if (intent.hasExtra(TelephonyManager.EXTRA_STATE)) {
                    String extraData = intent.getStringExtra(TelephonyManager.EXTRA_STATE);
                    if (extraData.equals(TelephonyManager.EXTRA_STATE_RINGING)) {
                        LOG.i(TAG, "Telephone RINGING");
                        webView.postMessage("telephone", "ringing");
                    }
                    else if (extraData.equals(TelephonyManager.EXTRA_STATE_OFFHOOK)) {
                        LOG.i(TAG, "Telephone OFFHOOK");
                        webView.postMessage("telephone", "offhook");
                    }
                    else if (extraData.equals(TelephonyManager.EXTRA_STATE_IDLE)) {
                        LOG.i(TAG, "Telephone IDLE");
                        webView.postMessage("telephone", "idle");
                    }
                }
            }
        }
    };

    // Register the receiver
    this.cordova.getActivity().registerReceiver(this.telephonyReceiver, intentFilter);
}
 
源代码9 项目: reader   文件: App.java
/**
 * Override the default behavior of the Android volume buttons.
 * If overridden, when the volume button is pressed, the "volume[up|down]button" JavaScript event will be fired.
 *
 * @param button        volumeup, volumedown
 * @param override      T=override, F=cancel override
 */
public void overrideButton(String button, boolean override) {
    LOG.i("App", "WARNING: Volume Button Default Behavior will be overridden.  The volume event will be fired!");
    if (button.equals("volumeup")) {
        webView.setButtonPlumbedToJs(KeyEvent.KEYCODE_VOLUME_UP, override);
    }
    else if (button.equals("volumedown")) {
        webView.setButtonPlumbedToJs(KeyEvent.KEYCODE_VOLUME_DOWN, override);
    }
}
 
源代码10 项目: wildfly-samples   文件: App.java
/**
 * Listen for telephony events: RINGING, OFFHOOK and IDLE
 * Send these events to all plugins using
 *      CordovaActivity.onMessage("telephone", "ringing" | "offhook" | "idle")
 */
private void initTelephonyReceiver() {
    IntentFilter intentFilter = new IntentFilter();
    intentFilter.addAction(TelephonyManager.ACTION_PHONE_STATE_CHANGED);
    //final CordovaInterface mycordova = this.cordova;
    this.telephonyReceiver = new BroadcastReceiver() {

        @Override
        public void onReceive(Context context, Intent intent) {

            // If state has changed
            if ((intent != null) && intent.getAction().equals(TelephonyManager.ACTION_PHONE_STATE_CHANGED)) {
                if (intent.hasExtra(TelephonyManager.EXTRA_STATE)) {
                    String extraData = intent.getStringExtra(TelephonyManager.EXTRA_STATE);
                    if (extraData.equals(TelephonyManager.EXTRA_STATE_RINGING)) {
                        LOG.i(TAG, "Telephone RINGING");
                        webView.postMessage("telephone", "ringing");
                    }
                    else if (extraData.equals(TelephonyManager.EXTRA_STATE_OFFHOOK)) {
                        LOG.i(TAG, "Telephone OFFHOOK");
                        webView.postMessage("telephone", "offhook");
                    }
                    else if (extraData.equals(TelephonyManager.EXTRA_STATE_IDLE)) {
                        LOG.i(TAG, "Telephone IDLE");
                        webView.postMessage("telephone", "idle");
                    }
                }
            }
        }
    };

    // Register the receiver
    this.cordova.getActivity().registerReceiver(this.telephonyReceiver, intentFilter);
}
 
源代码11 项目: reader   文件: CordovaActivity.java
/**
 * Called when the activity is first created.
 */
@Override
public void onCreate(Bundle savedInstanceState) {
    LOG.i(TAG, "Apache Cordova native platform version " + CordovaWebView.CORDOVA_VERSION + " is starting");
    LOG.d(TAG, "CordovaActivity.onCreate()");

    // need to activate preferences before super.onCreate to avoid "requestFeature() must be called before adding content" exception
    loadConfig();
    if(!preferences.getBoolean("ShowTitle", false))
    {
        getWindow().requestFeature(Window.FEATURE_NO_TITLE);
    }
    
    if(preferences.getBoolean("SetFullscreen", false))
    {
        Log.d(TAG, "The SetFullscreen configuration is deprecated in favor of Fullscreen, and will be removed in a future version.");
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                WindowManager.LayoutParams.FLAG_FULLSCREEN);
    } else if (preferences.getBoolean("Fullscreen", false)) {
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                WindowManager.LayoutParams.FLAG_FULLSCREEN);
    } else {
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN,
                WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
    }

    super.onCreate(savedInstanceState);

    if(savedInstanceState != null)
    {
        initCallbackClass = savedInstanceState.getString("callbackClass");
    }
}
 
源代码12 项目: phonegapbootcampsite   文件: App.java
/**
 * Listen for telephony events: RINGING, OFFHOOK and IDLE
 * Send these events to all plugins using
 *      CordovaActivity.onMessage("telephone", "ringing" | "offhook" | "idle")
 */
private void initTelephonyReceiver() {
    IntentFilter intentFilter = new IntentFilter();
    intentFilter.addAction(TelephonyManager.ACTION_PHONE_STATE_CHANGED);
    //final CordovaInterface mycordova = this.cordova;
    this.telephonyReceiver = new BroadcastReceiver() {

        @Override
        public void onReceive(Context context, Intent intent) {

            // If state has changed
            if ((intent != null) && intent.getAction().equals(TelephonyManager.ACTION_PHONE_STATE_CHANGED)) {
                if (intent.hasExtra(TelephonyManager.EXTRA_STATE)) {
                    String extraData = intent.getStringExtra(TelephonyManager.EXTRA_STATE);
                    if (extraData.equals(TelephonyManager.EXTRA_STATE_RINGING)) {
                        LOG.i(TAG, "Telephone RINGING");
                        webView.postMessage("telephone", "ringing");
                    }
                    else if (extraData.equals(TelephonyManager.EXTRA_STATE_OFFHOOK)) {
                        LOG.i(TAG, "Telephone OFFHOOK");
                        webView.postMessage("telephone", "offhook");
                    }
                    else if (extraData.equals(TelephonyManager.EXTRA_STATE_IDLE)) {
                        LOG.i(TAG, "Telephone IDLE");
                        webView.postMessage("telephone", "idle");
                    }
                }
            }
        }
    };

    // Register the receiver
    this.cordova.getActivity().registerReceiver(this.telephonyReceiver, intentFilter);
}
 
源代码13 项目: L.TileLayer.Cordova   文件: App.java
/**
 * Override the default behavior of the Android back button.
 * If overridden, when the back button is pressed, the "backKeyDown" JavaScript event will be fired.
 *
 * @param override		T=override, F=cancel override
 */
public void overrideBackbutton(boolean override) {
    LOG.i("App", "WARNING: Back Button Default Behavior will be overridden.  The backbutton event will be fired!");
    webView.setButtonPlumbedToJs(KeyEvent.KEYCODE_BACK, override);
}
 
源代码14 项目: reader   文件: App.java
/**
 * Override the default behavior of the Android back button.
 * If overridden, when the back button is pressed, the "backKeyDown" JavaScript event will be fired.
 *
 * @param override		T=override, F=cancel override
 */
public void overrideBackbutton(boolean override) {
    LOG.i("App", "WARNING: Back Button Default Behavior will be overridden.  The backbutton event will be fired!");
    webView.setButtonPlumbedToJs(KeyEvent.KEYCODE_BACK, override);
}
 
源代码15 项目: IoTgo_Android_App   文件: App.java
/**
 * Override the default behavior of the Android back button.
 * If overridden, when the back button is pressed, the "backKeyDown" JavaScript event will be fired.
 *
 * @param override		T=override, F=cancel override
 */
public void overrideBackbutton(boolean override) {
    LOG.i("App", "WARNING: Back Button Default Behavior will be overridden.  The backbutton event will be fired!");
    webView.setButtonPlumbedToJs(KeyEvent.KEYCODE_BACK, override);
}
 
源代码16 项目: phonegap-plugin-loading-spinner   文件: App.java
/**
 * Override the default behavior of the Android volume buttons.
 * If overridden, when the volume button is pressed, the "volume[up|down]button" JavaScript event will be fired.
 *
 * @param button        volumeup, volumedown
 * @param override      T=override, F=cancel override
 */
public void overrideButton(String button, boolean override) {
    LOG.i("App", "WARNING: Volume Button Default Behaviour will be overridden.  The volume event will be fired!");
    webView.bindButton(button, override);
}
 
源代码17 项目: CordovaYoutubeVideoPlayer   文件: App.java
/**
 * Override the default behavior of the Android back button.
 * If overridden, when the back button is pressed, the "backKeyDown" JavaScript event will be fired.
 *
 * @param override		T=override, F=cancel override
 */
public void overrideBackbutton(boolean override) {
    LOG.i("App", "WARNING: Back Button Default Behavior will be overridden.  The backbutton event will be fired!");
    webView.bindButton(override);
}
 
源代码18 项目: cordova-plugin-intent   文件: CoreAndroid.java
/**
 * Override the default behavior of the Android back button.
 * If overridden, when the back button is pressed, the "backKeyDown" JavaScript event will be fired.
 *
 * @param override		T=override, F=cancel override
 */
public void overrideBackbutton(boolean override) {
    LOG.i("App", "WARNING: Back Button Default Behavior will be overridden.  The backbutton event will be fired!");
    webView.setButtonPlumbedToJs(KeyEvent.KEYCODE_BACK, override);
}
 
源代码19 项目: phonegapbootcampsite   文件: App.java
/**
 * Override the default behavior of the Android back button.
 * If overridden, when the back button is pressed, the "backKeyDown" JavaScript event will be fired.
 *
 * @param override		T=override, F=cancel override
 */
public void overrideBackbutton(boolean override) {
    LOG.i("App", "WARNING: Back Button Default Behavior will be overridden.  The backbutton event will be fired!");
    webView.bindButton(override);
}
 
源代码20 项目: bluemix-parking-meter   文件: App.java
/**
 * Override the default behavior of the Android back button.
 * If overridden, when the back button is pressed, the "backKeyDown" JavaScript event will be fired.
 *
 * @param override		T=override, F=cancel override
 */
public void overrideBackbutton(boolean override) {
    LOG.i("App", "WARNING: Back Button Default Behavior will be overridden.  The backbutton event will be fired!");
    webView.setButtonPlumbedToJs(KeyEvent.KEYCODE_BACK, override);
}