Android coding log

初始化一个Button

Button btn = (Button) findViewById(R.id.button);
btn.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            /* action here*/
        }
});

setOnClickListener Method传递一个OnClickListener Interface Object. 从而Interface的OnClick方法被调用.

Kotlin的{} curly braces 可以是一个匿名函数Anonymous functions , shell 里面叫group command .

Java 子类不能override 父类没有定义的method.

The Activity class is a crucial component of an Android app, and the way activities are launched and put together is a fundamental part of the platform’s application model. Unlike programming paradigms in which apps are launched with a main() method, the Android system initiates code in an Activity instance by invoking specific callback methods that correspond to specific stages of its lifecycle.

A Fragment represents a behavior or a portion of user interface in a FragmentActivity. You can combine multiple fragments in a single activity to build a multi-pane UI and reuse a fragment in multiple activities. You can think of a fragment as a modular section of an activity, which has its own lifecycle, receives its own input events, and which you can add or remove while the activity is running (sort of like a “sub activity” that you can reuse in different activities).

Shell 脚本链接

https://github.com/LineageOS/android_device_xiaomi_mido/blob/lineage-15.1/extract-files.sh

https://github.com/LineageOS/android_device_xiaomi_msm8953-common/blob/lineage-15.1/extract-files.sh

https://github.com/LineageOS/android_vendor_lineage/blob/lineage-15.1/build/tools/extract_utils.sh

https://github.com/LineageOS/android_device_xiaomi_mido/blob/lineage-15.1/proprietary-files.txt

What are the minimum and recommended requirements to play PUBG?

Minimum requirements for PUBG is as follows:

OS: 64-bit Windows 7, Windows 8.1, Windows 10
CPU: Intel i5-4430 / AMD FX-6300
Memory: 8 GB RAM
GPU: nVidia GeForce GTX 960 2GB / AMD Radeon R7 370 2GB
Direct: 11.0
Network: Broadband Internet Connection
Storage: 30 GB available space

Minimum requirements are minimum requirements to run PUBG and may not provide the smoothest game play experience.

Recommended requirements for PUBG is as follows:

OS: 64-bit Windows 7, Windows 8.1, Windows 10
CPU: Intel i5-6600K / AMD Ryzend 5 1600
Memory: 16 GB RAM
GPU: nVidia GeForce GTX 1060 3GB / AMD Radeon RX 580 4GB
Direct: 11.0
Network: Broadband Internet Connection
Storage: 30 GB available space

Android GMS Barcode Scanner代码跟踪

用Android Studio看SS-Android 关于Barcode Scanner部分的代码,就想知道Detector是怎么实现Barcode识别的,到最后发现都是系统调用。

类跟踪:BarcodeDetector->zzh->zzn.zza->zzg->IInterface(Binder)->Barcode

Binder is an Android-specific interprocess communication mechanism, and remote method invocation system.

Container for a message: Parcel https://developer.android.com/reference/android/os/Parcel.html

GMS —Google Mobile Services brings Google’s most popular apps and APIs to your Android devices.

With the release of Google Play services 7.8 we’re excited to announce that we’ve added new Mobile Vision APIs which provide bar code detection APIs that read and decode a myriad of different bar code types, quickly, easily and locally.

Google Sample Android -Vision : The Mobile Vision API is now a part of ML Kit. We strongly encourage you to try it out, as it comes with new capabilities like on-device image labeling! Also, note that we ultimately plan to wind down the Mobile Vision API, with all new on-device ML capabilities released via ML Kit. Check out this codelab to use the vision APIs in ML Kit.

Firebase gives you the tools to develop high-quality apps, grow your user base, and earn more money. We cover the essentials so you can monetize your business and focus on your users.

ML Kit (for Firebase) is a mobile SDK that brings Google’s machine learning expertise to Android and iOS apps in a powerful yet easy-to-use package. Whether you’re new or experienced in machine learning, you can implement the functionality you need in just a few lines of code. There’s no need to have deep knowledge of neural networks or model optimization to get started. On the other hand, if you are an experienced ML developer, ML Kit provides convenient APIs that help you use your custom TensorFlow Lite models in your mobile apps.

TensorFlow Lite is a set of tools to help developers run TensorFlow models on mobile, embedded, and IoT devices. It enables on-device machine learning inference with low latency and a small binary size.

The live camera object detection feature uses both existing Material Design components and new elements specific to camera interaction. For code samples and demos of new elements (such as the reticle), check out the ML Kit Material Design showcase apps’ source code for Android and iOS.

Android 和 Google的产品各有偏重,Google强调跨平台,Android 的AOSP强调生态and系统行为模式,GMS 会慢慢简化,能做到跨平台的功能都转到Google去。

Interfaces

Interfaces in Kotlin can contain declarations of abstract methods, as well as method implementations. What makes them different from abstract classes is that interfaces cannot store state. They can have properties but these need to be abstract or to provide accessor implementations.

美网络电视

广播/点播:

HBO,CBS等同时都推出了两项服务。

台/平台:

台:Amazon Prime Video,HBO,StarZ,Showtime等属于点播,可独立App也可平台上订阅.

平台: Youtube TV,Apple TV,Sony Vue, AT&T TV Now, Spectrum包含传统Cable电视台,也可订阅点播台.

Netflix只作独立点播网台.

腾达AC9折腾记

京东上买了两台AC9 ,都刷了恩山论坛上提供的改版asuswrt.

经过几天的折腾,发现/jffs/script 是工作的,一开始忘记了脚本+x, 浪费了些时间.

通过测试发现下面这些config都是不工作的.

/jffs/configs/dnsmasq.conf.add

/jffs/configs/dnsmasq.conf

/jffs/configs/dnsmasq.d/dnsmasq.conf

/jffs/configs/dnsmasq.d/dnsmasq.conf.add

然后尝试cp /jffs/configs/dnsmasq.conf /etc/ ,然后kill 掉lsof -c dnsmasq得来的进程号,发现dnsmasq很快再启动后,自定义的配置仍然被覆盖.

 

Win7 救援实录

家里机器Win7上的Intel® Driver & Support Assistant 更新的Bluetooth 驱动无论如何安装都失败。而且近期Windows Update上的.net 以及VC++ Redistributable Package更新经常失败。安装和卸载程序控制面板上很多软件都变成了灰色,不能卸载也不能修复。

追寻原因,可能是前段时间清理了系统垃圾,C:\Windows\Installer 下部分安装原文件被清理,导致安装信息丢失。

通过搜索,发现了一个微软有提供一个troubleshooter ,于是一顿疯狂卸载,把2008版的VC++ Redistributable Package全部清理掉。

BT的驱动包问题,通过System Essentials 工具包分析了一晚上,没找到原因,最终意外发现是一个服务iBtSiva导致安装失败。通过删除服务,重新安装驱动顺利完成。

最后突然发现Windows Temp文件夹有100G还多,删除后长出一口气,睡觉。