Win10+Chrome内核浏览器访问蓝屏的地址
注意不要轻易访问,真的会导致蓝屏的!请保存自己的数据后再实验,数据丢失概不负责
请自己复制到浏览器地址栏访问
网盘搜索索引汇总
kotlin越用越难受,还是java好
Android Studio Build乱码的问题
编译的时候报错了,提示内容全是������
我:??????
然后在网上搜到了解决方法
https://blog.csdn.net/qq_31796651/article/details/108249199
Android蓝牙权限的判断
经常要用到,所以记录下来
/**
* 请求权限的Code
*/
public static final int REQUEST_PERMISSION_CODE = 1500;
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == REQUEST_PERMISSION_CODE) {
checkPermission();
}
}
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
if (requestCode == REQUEST_PERMISSION_CODE) {
checkPermission();
}
}
/**
* 检查权限
*/
private void checkPermission() {
// 没有打开蓝牙就请求打开蓝牙
if (!hasBluetooth()) {
requestBluetooth();
return;
}
// 没有定位权限就请求定位权限
if (!hasLocationPermission()) {
requestLocationPermission(this);
return;
}
// 没有定位服务就请求定位服务
if (!hasLocationService()) {
requestLocationService();
return;
}
// 权限都有了,OK
// TODO
}
/**
* 是否有定位权限
*
* @return boolean
*/
private boolean hasLocationPermission() {
return ActivityCompat.checkSelfPermission(mContext, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED;
}
/**
* 蓝牙是否打开
*
* @return boolean
*/
private boolean hasBluetooth() {
return BluetoothAdapter.getDefaultAdapter().isEnabled();
}
/**
* 定位服务是否打开
*
* @return boolean
*/
private boolean hasLocationService() {
LocationManager locationManager = (LocationManager) mContext.getSystemService(Context.LOCATION_SERVICE);
if (locationManager == null) {
return false;
}
return locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER) || locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER);
}
/**
* 申请定位权限
*/
private void requestLocationPermission(Activity activity) {
ActivityCompat.requestPermissions(activity, new String[]{Manifest.permission.ACCESS_FINE_LOCATION}, REQUEST_PERMISSION_CODE);
}
/**
* 申请打开蓝牙
*/
private void requestBluetooth() {
Intent intent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
startActivityForResult(intent, REQUEST_PERMISSION_CODE);
}
/**
* 申请打开定位服务
*/
private void requestLocationService() {
Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
startActivityForResult(intent, REQUEST_PERMISSION_CODE);
}
百度SEO插件BaiduSubmit不支持SQLite的坑
整了个百度SEO插件,使用之后发布文章时报错。
看了看报错信息,是因为找不到表,所以感觉是SQLite数据库创建表时出了问题,就又在魔改的基础下再改了下。
魔改版原址下载:https://minirizhi.com/104.html
自己修改仅支持SQLite版:https://cym123.lanzous.com/iSmdoji5n9e
打字速度遇到瓶颈了,难受
把博客的搜索框也加上了pjax
之前搜索会导致页面刷新,现在不会了
可以看到,博客现在点击不同的文章,或者搜索文章,背景图片都不会刷新了
js如下
// 搜索使用pjax
$(document).on('submit', '#search', function (event) {
$.pjax.submit(event, '#pjax_container', {
fragment:'#pjax_container', timeout:6000
})
})
Android多语言突然失效的坑
项目的多语言突然失效了,就很奇怪,根本没碰过这方面的代码
总之找到原因了,androidx.appcompat:appcompat
的版本不经意间升到1.2.0导致的问题
解决方法
- 降级回1.1.0 (:
- 看大佬源码解析:https://zhuanlan.zhihu.com/p/259595928