本文整理汇总了Java中com.tencent.smtt.sdk.QbSdk类的典型用法代码示例。如果您正苦于以下问题:Java QbSdk类的具体用法?Java QbSdk怎么用?Java QbSdk使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
QbSdk类属于com.tencent.smtt.sdk包,在下文中一共展示了QbSdk类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import com.tencent.smtt.sdk.QbSdk; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
WindowManager.LayoutParams localLayoutParams = getWindow().getAttributes();
localLayoutParams.flags = (WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS | localLayoutParams.flags);
}
setContentView(R.layout.activity_main);
ButterKnife.bind(this);
QbSdk.initX5Environment(this, null);
init();
setViewPager();
setNavigationView();
setBackGround();
setReceiver();
}
示例2: initApplication
import com.tencent.smtt.sdk.QbSdk; //导入依赖的package包/类
private void initApplication() {
//初始化日志
Logger.init(getPackageName()).hideThreadInfo();
//初始化错误收集
// CrashHandler.init(new CrashHandler(getApplicationContext()));
initBugly();
//初始化内存泄漏检测
LeakCanary.install(App.getInstance());
//初始化过度绘制检测
BlockCanary.install(getApplicationContext(), new AppBlockCanaryContext()).start();
//初始化tbs x5 webview
QbSdk.allowThirdPartyAppDownload(true);
QbSdk.initX5Environment(getApplicationContext(), QbSdk.WebviewInitType.FIRSTUSE_AND_PRELOAD, new QbSdk.PreInitCallback() {
@Override
public void onCoreInitFinished() {
}
@Override
public void onViewInitFinished(boolean b) {
}
});
}
示例3: initHybrid
import com.tencent.smtt.sdk.QbSdk; //导入依赖的package包/类
private void initHybrid() {
// 初始化WebView池
WebViewPool.getInstance().initWebViewPool(getApplicationContext());
// 初始化x5内核
QbSdk.initX5Environment(getApplicationContext(), new QbSdk.PreInitCallback() {
@Override
public void onCoreInitFinished() {
Log.i("initX5Environment", "x5 core init finished.");
}
@Override
public void onViewInitFinished(boolean b) {
Log.i("initX5Environment", "x5 view has " + (b ? "" : "not") + " finished.");
}
});
}
示例4: onCreate
import com.tencent.smtt.sdk.QbSdk; //导入依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
QbSdk.PreInitCallback cb = new QbSdk.PreInitCallback() {
@Override
public void onViewInitFinished(boolean arg0) {
// TODO Auto-generated method stub
//x5內核初始化完成的回调,为true表示x5内核加载成功,否则表示x5内核加载失败,会自动切换到系统内核。
Log.d("app", " onViewInitFinished is " + arg0);
}
@Override
public void onCoreInitFinished() {
// TODO Auto-generated method stub
}
};
//x5内核初始化接口
QbSdk.initX5Environment(getApplicationContext(), cb);
changeLanguage(this);
}
示例5: initX5Environment
import com.tencent.smtt.sdk.QbSdk; //导入依赖的package包/类
/**
* x5内核初始化接口
*/
private void initX5Environment() {
//搜集本地tbs内核信息并上报服务器,服务器返回结果决定使用哪个内核。
QbSdk.PreInitCallback cb = new QbSdk.PreInitCallback() {
@Override
public void onViewInitFinished(boolean arg0) {
//x5內核初始化完成的回调,为true表示x5内核加载成功,否则表示x5内核加载失败,会自动切换到系统内核。
LogUtils.e("myApplication", " onViewInitFinished is " + arg0);
}
@Override
public void onCoreInitFinished() {
}
};
//x5内核初始化接口
QbSdk.initX5Environment(getApplicationContext(), cb);
}
示例6: onCreate
import com.tencent.smtt.sdk.QbSdk; //导入依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
QbSdk.initX5Environment(this, new QbSdk.PreInitCallback() {
@Override
public void onCoreInitFinished() {
Log.d("MainApplication", "x5 core load success");
Toast.makeText(MyApplication.this, "x5 core load success", Toast.LENGTH_SHORT).show();
}
@Override
public void onViewInitFinished(boolean b) {
}
});
}
示例7: drawChild
import com.tencent.smtt.sdk.QbSdk; //导入依赖的package包/类
@Override
protected boolean drawChild(Canvas canvas, View child, long drawingTime) {
boolean ret = super.drawChild(canvas, child, drawingTime);
canvas.save();
Paint paint = new Paint();
paint.setColor(0x7fff0000);
paint.setTextSize(24.f);
paint.setAntiAlias(true);
if (getX5WebViewExtension() != null) {
canvas.drawText(this.getContext().getPackageName() + "-pid:"
+ android.os.Process.myPid(), 10, 50, paint);
canvas.drawText(
"X5 Core:" + QbSdk.getTbsVersion(this.getContext()), 10,
100, paint);
} else {
canvas.drawText(this.getContext().getPackageName() + "-pid:"
+ android.os.Process.myPid(), 10, 50, paint);
canvas.drawText("Sys Core", 10, 100, paint);
}
canvas.drawText(Build.MANUFACTURER, 10, 150, paint);
canvas.drawText(Build.MODEL, 10, 200, paint);
canvas.restore();
return ret;
}
示例8: onCreate
import com.tencent.smtt.sdk.QbSdk; //导入依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
QbSdk.PreInitCallback cb = new QbSdk.PreInitCallback() {
@Override
public void onViewInitFinished(boolean b) {
//x5內核初始化完成的回调,为true表示x5内核加载成功,否则表示x5内核加载失败,会自动切换到系统内核。
Log.d("app", " onViewInitFinished is " + b);
}
@Override
public void onCoreInitFinished() {
// TODO Auto-generated method stub
}
};
//x5内核初始化接口
QbSdk.initX5Environment(getApplicationContext(), cb);
}
示例9: X5WebViewEngine
import com.tencent.smtt.sdk.QbSdk; //导入依赖的package包/类
/** Used when created via reflection. */
public X5WebViewEngine(Context context, CordovaPreferences preferences) {
if(!isInit)
{
QbSdk.PreInitCallback cb = new QbSdk.PreInitCallback() {
@Override
public void onViewInitFinished(boolean arg0) {
}
@Override
public void onCoreInitFinished() {
isInit = true;
}
};
QbSdk.initX5Environment(context, cb);
}
this.preferences = preferences;
this.webView = new X5WebView(context);
cookieManager = new X5CookieManager(webView);
}
示例10: initQbSdk
import com.tencent.smtt.sdk.QbSdk; //导入依赖的package包/类
private void initQbSdk() {
try {
QbSdk.allowThirdPartyAppDownload(true);
QbSdk.initX5Environment(getApplicationContext(), QbSdk.WebviewInitType.FIRSTUSE_AND_PRELOAD, new QbSdk.PreInitCallback() {
@Override
public void onCoreInitFinished() {
}
@Override
public void onViewInitFinished(boolean b) {
}
});
} catch (Exception e) {
e.printStackTrace();
}
}
示例11: getWebViewKernelInfo
import com.tencent.smtt.sdk.QbSdk; //导入依赖的package包/类
public String getWebViewKernelInfo() {
KernelInfoVO infoVO = new KernelInfoVO();
if (getX5WebViewExtension() != null) {
infoVO.setKernelType("X5");
infoVO.setKernelVersion(QbSdk.getTbsVersion(this.getContext()) + "");
} else {
if (Build.VERSION.SDK_INT > 18) {
infoVO.setKernelType("System(Blink)");
try {
PackageManager pm = this.getContext().getPackageManager();
PackageInfo pinfo = pm.getPackageInfo("com.google.android.webview",
PackageManager.GET_CONFIGURATIONS);
infoVO.setKernelVersion(pinfo.versionName);
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
}
} else {
infoVO.setKernelType("System(Webkit)");
}
}
String info = DataHelper.gson.toJson(infoVO);
return info;
}
示例12: onCreate
import com.tencent.smtt.sdk.QbSdk; //导入依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
//增加这句话
QbSdk.initX5Environment(this,null);
ExceptionHandler.getInstance().initConfig(this);
}
示例13: onCreate
import com.tencent.smtt.sdk.QbSdk; //导入依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
if (LeakCanary.isInAnalyzerProcess(this)) {
// This process is dedicated to LeakCanary for heap analysis.
// You should not init your app in this process.
return;
}
LeakCanary.install(this);
// Normal app init code...
QbSdk.PreInitCallback cb = new QbSdk.PreInitCallback() {
@Override
public void onViewInitFinished(boolean arg0) {
// TODO Auto-generated method stub
//x5內核初始化完成的回调,为true表示x5内核加载成功,否则表示x5内核加载失败,会自动切换到系统内核。
Log.d("app", " onViewInitFinished is " + arg0);
}
@Override
public void onCoreInitFinished() {
// TODO Auto-generated method stub
}
};
//x5内核初始化接口
QbSdk.initX5Environment(getApplicationContext(), cb);
}
示例14: onCreate
import com.tencent.smtt.sdk.QbSdk; //导入依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
instance = this;
//初始化日志
Logger.init(getPackageName()).hideThreadInfo();
//初始化tbs x5 webview
QbSdk.allowThirdPartyAppDownload(true);
QbSdk.initX5Environment(getApplicationContext(), QbSdk.WebviewInitType.FIRSTUSE_AND_PRELOAD, null);
}
示例15: drawChild
import com.tencent.smtt.sdk.QbSdk; //导入依赖的package包/类
@Override
protected boolean drawChild(Canvas canvas, View child, long drawingTime) {
//Debug使用,用于在debug时在页面呈现内核类型和版本
boolean ret = super.drawChild(canvas, child, drawingTime);
if (WDataManager.sRootWgt==null){
return ret;
}
int debug = WDataManager.sRootWgt.m_appdebug;
if (debug == 1&& BDebug.DEBUG) {
canvas.save();
Paint paint = new Paint();
paint.setColor(0x7fff0000);
paint.setTextSize(24.f);
paint.setAntiAlias(true);
if (getX5WebViewExtension() != null) {
canvas.drawText(this.getContext().getPackageName() + "-pid:"
+ android.os.Process.myPid(), 10, 50, paint);
canvas.drawText(
"X5 Core:" + QbSdk.getTbsVersion(this.getContext()),
10, 100, paint);
} else {
canvas.drawText(this.getContext().getPackageName() + "-pid:"
+ android.os.Process.myPid(), 10, 50, paint);
canvas.drawText("Sys Core", 10, 100, paint);
}
canvas.drawText(Build.MANUFACTURER, 10, 150, paint);
canvas.drawText(Build.MODEL, 10, 200, paint);
canvas.restore();
}
return ret;
}