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


Java ConsoleMessage类代码示例

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


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

示例1: onConsoleMessage

import android.webkit.ConsoleMessage; //导入依赖的package包/类
@Override
public boolean onConsoleMessage(ConsoleMessage m) {
    switch (m.messageLevel()) {
        case LOG:
            Log.i(LOG_TAG, String.format("%s (%s:%d)", m.message(), m.sourceId(), m.lineNumber()));
            return true;
        case TIP:
            Log.v(LOG_TAG, String.format("%s (%s:%d)", m.message(), m.sourceId(), m.lineNumber()));
            return true;
        case DEBUG:
            Log.d(LOG_TAG, String.format("%s (%s:%d)", m.message(), m.sourceId(), m.lineNumber()));
            return true;
        case WARNING:
            Log.w(LOG_TAG, String.format("%s (%s:%d)", m.message(), m.sourceId(), m.lineNumber()));
            return true;
        case ERROR:
            Log.e(LOG_TAG, String.format("%s (%s:%d)", m.message(), m.sourceId(), m.lineNumber()));
            return true;
    }
    return false;
}
 
开发者ID:hyb1996,项目名称:Auto.js,代码行数:22,代码来源:CodeMirrorEditor.java

示例2: init

import android.webkit.ConsoleMessage; //导入依赖的package包/类
private void init(AttributeSet attrs) {
        setAttrs(attrs);

//        setWebViewClient(new WebViewClient());
        setWebChromeClient(new WebChromeClient() {
            public boolean onConsoleMessage(ConsoleMessage cm) {
                Log.d("MyApplication", cm.message() + " -- From line "
                        + cm.lineNumber() + " of "
                        + cm.sourceId() );
                return true;
            }
        });

        setVerticalScrollBarEnabled(false);
        setHorizontalScrollBarEnabled(false);
        WebSettings webSettings = getSettings();
        webSettings.setJavaScriptEnabled(true);
    }
 
开发者ID:adplugg,项目名称:android-ad-sdk,代码行数:19,代码来源:AdView.java

示例3: onConsoleMessage

import android.webkit.ConsoleMessage; //导入依赖的package包/类
@Override
public boolean onConsoleMessage(ConsoleMessage consoleMessage) {
    String msg = consoleMessage.message();
    if (msg == null)
        return false;
    Uri uri = Uri.parse(msg);
    if (uri != null && null != uri.getScheme() && uri.getScheme().equals(SMALL_SCHEME))
    {
        String host = uri.getHost();
        String ret = uri.getQueryParameter(SMALL_QUERY_KEY_RET);
        if (host.equals(SMALL_HOST_POP)) {
            WebActivity activity = mWebView.getActivity();
            if (activity != null) {
                activity.finish(ret);
            }
        } else if (host.equals(SMALL_HOST_EXEC)) {
            if (mWebView.mOnResultListener != null) {
                mWebView.mOnResultListener.onResult(ret);
            }
        }
        return true;
    }
    Log.d(consoleMessage.sourceId(),
            "line" + consoleMessage.lineNumber() + ": " + consoleMessage.message());
    return true;
}
 
开发者ID:ChanJLee,项目名称:SmallPatch,代码行数:27,代码来源:WebView.java

示例4: onConsoleMessage

import android.webkit.ConsoleMessage; //导入依赖的package包/类
public final boolean onConsoleMessage(ConsoleMessage paramConsoleMessage)
{
  String str = "JS: " + paramConsoleMessage.message() + " (" + paramConsoleMessage.sourceId() + ":" + paramConsoleMessage.lineNumber() + ")";
  if (str.contains("Application Cache")) {
    return super.onConsoleMessage(paramConsoleMessage);
  }
  switch (7.zzNj[paramConsoleMessage.messageLevel().ordinal()])
  {
  default: 
    zzb.i(str);
  }
  for (;;)
  {
    return super.onConsoleMessage(paramConsoleMessage);
    zzb.e(str);
    continue;
    zzb.w(str);
    continue;
    zzb.i(str);
    continue;
    zzb.d(str);
  }
}
 
开发者ID:ChiangC,项目名称:FMTech,代码行数:24,代码来源:zzju.java

示例5: onConsoleMessage

import android.webkit.ConsoleMessage; //导入依赖的package包/类
public boolean onConsoleMessage(ConsoleMessage consolemessage)
{
    Log.i("WebConsole", (new StringBuilder()).append(consolemessage.message()).append(" -- From  111 line ").append(consolemessage.lineNumber()).append(" of ").append(consolemessage.sourceId()).toString());
    if (android.os.Build.VERSION.SDK_INT > 7)
    {
        d d1 = a;
        String s;
        if (consolemessage == null)
        {
            s = "";
        } else
        {
            s = consolemessage.message();
        }
        d1.onConsoleMessage(s);
    }
    return true;
}
 
开发者ID:vishnudevk,项目名称:MiBandDecompiled,代码行数:19,代码来源:H.java

示例6: onConsoleMessage

import android.webkit.ConsoleMessage; //导入依赖的package包/类
public final boolean onConsoleMessage(ConsoleMessage paramConsoleMessage)
{
  String str = "JS: " + paramConsoleMessage.message() + " (" + paramConsoleMessage.sourceId() + ":" + paramConsoleMessage.lineNumber() + ")";
  switch (7.jg[paramConsoleMessage.messageLevel().ordinal()])
  {
  default:
    break;
  case 1:
    ct.s(str);
    break;
  case 2:
    ct.v(str);
    break;
  case 3:
  case 4:
    ct.t(str);
    break;
  case 5:
    ct.r(str);
    break;
  }
  ct.t(str);
  return super.onConsoleMessage(paramConsoleMessage);
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:25,代码来源:cy.java

示例7: SoomlaTwitterWebView

import android.webkit.ConsoleMessage; //导入依赖的package包/类
/**
 * Constructor
 *
 * @param parentActivity the parent activity of the web-view, which will
 *                       be used as a context
 */
public SoomlaTwitterWebView(Activity parentActivity) {
    super(parentActivity);

    this.getSettings().setJavaScriptEnabled(true);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
        this.getSettings().setAllowUniversalAccessFromFileURLs(true);
    }

    this.mHandler = new Handler(Looper.getMainLooper());

    this.setWebChromeClient(new WebChromeClient() {
        public boolean onConsoleMessage(ConsoleMessage cm) {
            Log.d(TAG, cm.message() + " -- From line " + cm.lineNumber() + " of " + cm.sourceId());
            return true;
        }
    });

    this.setBackgroundColor(0x00000000);
    this.mTranslucent = true;
    postInvalidate();
}
 
开发者ID:soomla,项目名称:android-profile,代码行数:29,代码来源:SoomlaTwitterWebView.java

示例8: onViewCreated

import android.webkit.ConsoleMessage; //导入依赖的package包/类
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
  super.onViewCreated(view, savedInstanceState);
  mToolbar.setNavigationOnClickListener(v -> getFragmentManager().popBackStack());
  if (Build.VERSION.SDK_INT >= 11) {
    mWebView.getSettings().setDisplayZoomControls(false);
  }
  mWebView.getSettings().setJavaScriptEnabled(true);
  mWebView.getSettings().setBuiltInZoomControls(true);
  mWebView.getSettings().setUseWideViewPort(true);
  mWebView.getSettings().setDomStorageEnabled(true);
  mWebView.setInitialScale(1);
  mWebView.setWebViewClient(new CustomWebViewClient());
  mWebView.setWebChromeClient(new WebChromeClient() {
    public boolean onConsoleMessage(ConsoleMessage cm) {
      Timber.d("Webview Console", cm.message() + " -- From line "
          + cm.lineNumber() + " of "
          + cm.sourceId());
      return true;
    }
  });
  prepareSplitActionBar();
}
 
开发者ID:jacobtabak,项目名称:Cakeday,代码行数:24,代码来源:MyWebViewFragment.java

示例9: addMessageToConsole

import android.webkit.ConsoleMessage; //导入依赖的package包/类
@Override
public boolean addMessageToConsole(int level, String message, int lineNumber,
        String sourceId) {
    ConsoleMessage.MessageLevel messageLevel = ConsoleMessage.MessageLevel.DEBUG;
    switch(level) {
        case LOG_LEVEL_TIP:
            messageLevel = ConsoleMessage.MessageLevel.TIP;
            break;
        case LOG_LEVEL_LOG:
            messageLevel = ConsoleMessage.MessageLevel.LOG;
            break;
        case LOG_LEVEL_WARNING:
            messageLevel = ConsoleMessage.MessageLevel.WARNING;
            break;
        case LOG_LEVEL_ERROR:
            messageLevel = ConsoleMessage.MessageLevel.ERROR;
            break;
        default:
            Log.w(TAG, "Unknown message level, defaulting to DEBUG");
            break;
    }

    return mContentsClient.onConsoleMessage(
            new ConsoleMessage(message, sourceId, lineNumber, messageLevel));
}
 
开发者ID:mogoweb,项目名称:chromium_webview,代码行数:26,代码来源:AwWebContentsDelegateAdapter.java

示例10: onConsoleMessage

import android.webkit.ConsoleMessage; //导入依赖的package包/类
/**
 * @see AwContentsClient#onConsoleMessage(android.webkit.ConsoleMessage)
 */
@Override
public boolean onConsoleMessage(ConsoleMessage consoleMessage) {
    TraceEvent.begin();
    boolean result;
    if (mWebChromeClient != null) {
        if (TRACE) Log.d(TAG, "onConsoleMessage");
        result = mWebChromeClient.onConsoleMessage(consoleMessage);
        String message = consoleMessage.message();
        if (result && message != null && message.startsWith("[blocked]")) {
            Log.e(TAG, "Blocked URL: " + message);
        }
    } else {
        result = false;
    }
    TraceEvent.end();
    return result;
}
 
开发者ID:mogoweb,项目名称:chromium_webview,代码行数:21,代码来源:WebViewContentsClientAdapter.java

示例11: onConsoleMessage

import android.webkit.ConsoleMessage; //导入依赖的package包/类
public boolean onConsoleMessage(final ConsoleMessage cm) {
	final MessageLevel level = cm.messageLevel();

	final String msg = cm.message() + " -- From line " + cm.lineNumber()
			+ " of " + cm.sourceId();

	if (level.compareTo(MessageLevel.DEBUG) == 0) {
		Log.d(Constants.LOG_TAG, msg);
	} else if (level.compareTo(MessageLevel.ERROR) == 0) {
		Log.e(Constants.LOG_TAG, msg);
	} else if (level.compareTo(MessageLevel.WARNING) == 0) {
		Log.w(Constants.LOG_TAG, msg);
	} else {
		Log.d(Constants.LOG_TAG, msg);
	}

	return true;
}
 
开发者ID:drdrej,项目名称:android-webview-example,代码行数:19,代码来源:WebChromeClient.java

示例12: onConsoleMessage

import android.webkit.ConsoleMessage; //导入依赖的package包/类
@TargetApi(8)
@Override
public boolean onConsoleMessage(ConsoleMessage consoleMessage)
{
    if (consoleMessage.message() != null)
        LOG.d(LOG_TAG, "%s: Line %d : %s" , consoleMessage.sourceId() , consoleMessage.lineNumber(), consoleMessage.message());
     return super.onConsoleMessage(consoleMessage);
}
 
开发者ID:Andy-Ta,项目名称:COB,代码行数:9,代码来源:SystemWebChromeClient.java

示例13: onConsoleMessage

import android.webkit.ConsoleMessage; //导入依赖的package包/类
public boolean onConsoleMessage(ConsoleMessage consoleMessage) {
    /*onConsoleMessage(consoleMessage.message(), consoleMessage.lineNumber(),
            consoleMessage.sourceId());*/

    if (this.mRealWebChromeClient != null)
        return this.mRealWebChromeClient.onConsoleMessage(consoleMessage);
    return super.onConsoleMessage(consoleMessage);
}
 
开发者ID:Justson,项目名称:AgentWeb,代码行数:9,代码来源:WebChromeClientWrapper.java

示例14: onConsoleMessage

import android.webkit.ConsoleMessage; //导入依赖的package包/类
@Override
public boolean onConsoleMessage(ConsoleMessage consoleMessage) {
	if (consoleMessage.messageLevel() == ConsoleMessage.MessageLevel.DEBUG) {
		Log.d(TAG, "onConsoleMessage " + consoleMessage.sourceId() + " "
			+ consoleMessage.lineNumber() + ":" + consoleMessage.message()) ;
		return true;
	}

	return super.onConsoleMessage(consoleMessage);
}
 
开发者ID:fengshihao,项目名称:WebPager,代码行数:11,代码来源:PagerChromeClient.java

示例15: onConsoleMessage

import android.webkit.ConsoleMessage; //导入依赖的package包/类
public boolean onConsoleMessage(ConsoleMessage consoleMessage) {
    if (consoleMessage == null) {
        return false;
    }
    f.c("WebConsole", consoleMessage.message() + " -- From  111 line " + consoleMessage.lineNumber() + " of " + consoleMessage.sourceId());
    if (VERSION.SDK_INT > 7) {
        this.a.onConsoleMessage(consoleMessage == null ? "" : consoleMessage.message());
    }
    return true;
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:11,代码来源:b.java


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