在Arch Linux中调整部分联想主板风扇转速(ThinkServer TS540)
部分联想主板BIOS风扇控制只有 Intelligent Cooling Engine (ICE) 功能,无法手动修改风扇转速曲线。
我发现手上这块主板在进入系统后风扇就变成固定转速,而且
sensors
sensors
看不到转速,那第一步就是先安装驱动。通过
sensors-detect
sensors-detect
得知控制器为IT8792E,从网上找到了可用的驱动:a1wong/it87 (github.com) 按照文档
make & make install
make & make install
安装即可。
继续阅读“在Arch Linux中调整部分联想主板风扇转速(ThinkServer TS540)” Android WebView相关交互实现
一、支持网页视频播放
设置自定义WebChromeClient,覆写 onShowCustomView
、onHideCustomView
,将WebChromeClient提供的 view 添加到布局中即可。
webChromeClient = object : WebChromeClient() {
override fun onShowCustomView(view: View?, callback: CustomViewCallback?) {
requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE
mViewBinding.flVideoContainer.run {
visibility = View.VISIBLE
addView(view)
}
}
override fun onHideCustomView() {
requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_SENSOR
mViewBinding.flVideoContainer.run {
visibility = View.GONE
removeAllViews()
}
}
}
webChromeClient = object : WebChromeClient() {
override fun onShowCustomView(view: View?, callback: CustomViewCallback?) {
requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE
mViewBinding.flVideoContainer.run {
visibility = View.VISIBLE
addView(view)
}
}
override fun onHideCustomView() {
requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_SENSOR
mViewBinding.flVideoContainer.run {
visibility = View.GONE
removeAllViews()
}
}
}
webChromeClient = object : WebChromeClient() { override fun onShowCustomView(view: View?, callback: CustomViewCallback?) { requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE mViewBinding.flVideoContainer.run { visibility = View.VISIBLE addView(view) } } override fun onHideCustomView() { requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_SENSOR mViewBinding.flVideoContainer.run { visibility = View.GONE removeAllViews() } } }继续阅读“Android WebView相关交互实现”
Android:修改当前App某个窗口参数
try {
WindowManager manager = getWindowManager();
Field mGlobal_field = manager.getClass().getDeclaredField("mGlobal");
mGlobal_field.setAccessible(true);
Object managerGlobal = mGlobal_field.get(manager);
//noinspection ConstantConditions
Field mViews_field = managerGlobal.getClass().getDeclaredField("mViews");
mViews_field.setAccessible(true);
//noinspection unchecked
ArrayList<View> mViews = (ArrayList<View>) mViews_field.get(managerGlobal);
//noinspection ConstantConditions
View dialogDecorView = mViews.get(mViews.size() - 1);// TODO 这里需要做一下判断,是不是dialog的decorView
WindowManager.LayoutParams params = (WindowManager.LayoutParams) dialogDecorView.getLayoutParams();
params.gravity = Gravity.TOP;
dialogDecorView.setLayoutParams(params);
manager.removeView(dialogDecorView);
manager.addView(dialogDecorView, params);
} catch (Exception e) {
e.printStackTrace();
}
try {
WindowManager manager = getWindowManager();
Field mGlobal_field = manager.getClass().getDeclaredField("mGlobal");
mGlobal_field.setAccessible(true);
Object managerGlobal = mGlobal_field.get(manager);
//noinspection ConstantConditions
Field mViews_field = managerGlobal.getClass().getDeclaredField("mViews");
mViews_field.setAccessible(true);
//noinspection unchecked
ArrayList<View> mViews = (ArrayList<View>) mViews_field.get(managerGlobal);
//noinspection ConstantConditions
View dialogDecorView = mViews.get(mViews.size() - 1);// TODO 这里需要做一下判断,是不是dialog的decorView
WindowManager.LayoutParams params = (WindowManager.LayoutParams) dialogDecorView.getLayoutParams();
params.gravity = Gravity.TOP;
dialogDecorView.setLayoutParams(params);
manager.removeView(dialogDecorView);
manager.addView(dialogDecorView, params);
} catch (Exception e) {
e.printStackTrace();
}
try { WindowManager manager = getWindowManager(); Field mGlobal_field = manager.getClass().getDeclaredField("mGlobal"); mGlobal_field.setAccessible(true); Object managerGlobal = mGlobal_field.get(manager); //noinspection ConstantConditions Field mViews_field = managerGlobal.getClass().getDeclaredField("mViews"); mViews_field.setAccessible(true); //noinspection unchecked ArrayList<View> mViews = (ArrayList<View>) mViews_field.get(managerGlobal); //noinspection ConstantConditions View dialogDecorView = mViews.get(mViews.size() - 1);// TODO 这里需要做一下判断,是不是dialog的decorView WindowManager.LayoutParams params = (WindowManager.LayoutParams) dialogDecorView.getLayoutParams(); params.gravity = Gravity.TOP; dialogDecorView.setLayoutParams(params); manager.removeView(dialogDecorView); manager.addView(dialogDecorView, params); } catch (Exception e) { e.printStackTrace(); }
Getting Over It 一些技巧分享

不知不觉就拿到了通关50次成就,在这里总结一下《Getting Over It WIth Bennett Foddy》的一些心得吧。
继续阅读“Getting Over It 一些技巧分享”Java 一些自用工具类
密码保护:二维路径规划: 蚁群算法+2Opt邻域搜索
编译 GDAL For Android
需要编译的项目:GDAL2.4.4 + PROJ5.2.0 + SQLite3.22.0
一、安装NDK
从官网下载NDK https://developer.android.google.cn/ndk/downloads
解压并配置环境变量,我的路径是 /usr/local/android-ndk
,可以写到 /etc/profile
里,更改配置重新 source /etc/profile
就行了。
export NDK_HOME=/usr/local/android-ndk/android-ndk-r21继续阅读“编译 GDAL For Android”
几个常用排序算法
插入排序
fun insertSort(arr: IntArray) {
for (i in 1 <em>until </em>arr.size) {
val temp = arr[i]
var preIndex = i - 1
while (preIndex >= 0 && arr[preIndex] > temp) {
arr[preIndex + 1] = arr[preIndex]
preIndex--
}
arr[preIndex + 1] = temp
}
}
fun insertSort(arr: IntArray) {
for (i in 1 <em>until </em>arr.size) {
val temp = arr[i]
var preIndex = i - 1
while (preIndex >= 0 && arr[preIndex] > temp) {
arr[preIndex + 1] = arr[preIndex]
preIndex--
}
arr[preIndex + 1] = temp
}
}
fun insertSort(arr: IntArray) { for (i in 1 <em>until </em>arr.size) { val temp = arr[i] var preIndex = i - 1 while (preIndex >= 0 && arr[preIndex] > temp) { arr[preIndex + 1] = arr[preIndex] preIndex-- } arr[preIndex + 1] = temp } }继续阅读“几个常用排序算法”
RxJava简析
注:本文章代码基于 RxJava:3.0.0-RC4
一、概述
官方描述: RxJava是反应式编程扩展的JVM实现:该库用于通过使用可观察的序列来组成异步和基于事件的程序。
即:RxJava 是一个用反应式编程特性来扩展观察者模式的事件处理库。
