Skip to content

Commit d966ca6

Browse files
committed
Add notes
1 parent bffbea1 commit d966ca6

16 files changed

+205
-7
lines changed

Java/Cloneable 和 Clone.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@
99
## 深克隆(deep clone)
1010

1111
对基本数据类型进行值传递,对引用数据类型,创建一个新的对象,并复制其内容,此为深拷贝。
12+

README.md

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,23 @@
1-
# android-article
2-
Summaries in Android development.
1+
## 示例Demo
2+
播放周杰伦的歌 :
3+
4+
```
5+
qqmusic://qq.com/ns/method?p={"action":"playSpecificSong","songIdList":["403778","5105986","410316","102066257","102065750","102065753","680279","107192078","449205","718477","97761","101091484","102340965","97771","97773","212877900","102340966","102065756","97744","718475"]}
6+
```
7+
8+
9+
## Action类型:
10+
- const val PLAY_SPECIFIC_SONG = "playSpecificSong" // 播放在线歌曲
11+
- const val PLAY_ALBUM = "playAlbum" // 播放在线歌单
12+
- const val PLAY_COLLECT_SONG = "playCollectSong" // 播放收藏歌曲
13+
- const val COLLECT_SONG = "collectSong" // 收藏歌曲
14+
- const val CANCEL_COLLECTED_SONG = "cancelCollectedSong" // 取消收藏歌曲
15+
- const val PLAY_SINGLE_MODE = "playSingleMode" // 单曲循环
16+
- const val PLAY_LIST_MODE = "playListMode" // 顺序播放
17+
- const val PLAY_NEXT = "playNext" // 播放下一首
18+
- const val PLAY_PREV = "playPrev" // 播放上一首
19+
- const val PLAY_PAUSE = "playPause" // 暂停
20+
- const val PLAY_RESUME = "playResume" // 继续
21+
22+
## songIdList
23+
通过OpenAPI进行获取

android/AIDL.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,9 @@
1919

2020
## 总结
2121

22-
AIDL中的定向 tag 表示了在跨进程通信中数据的流向,其中 in 表示数据只能由客户端流向服务端, out 表示数据只能由服务端流向客户端,而 inout 则表示数据可在服务端与客户端之间双向流通。其中,数据流向是针对在客户端中的那个传入方法的对象而言的。in 为定向 tag 的话表现为服务端将会接收到一个那个对象的完整数据,但是客户端的那个对象不会因为服务端对传参的修改而发生变动;out 的话表现为服务端将会接收到那个对象的参数为空的对象,但是在服务端对接收到的空对象有任何修改之后客户端将会同步变动;inout 为定向 tag 的情况下,服务端将会接收到客户端传来对象的完整信息,并且客户端将会同步服务端对该对象的任何变动。
22+
AIDL中的定向 tag 表示了在跨进程通信中数据的流向,其中 in 表示数据只能由客户端流向服务端, out 表示数据只能由服务端流向客户端,而 inout 则表示数据可在服务端与客户端之间双向流通。其中,数据流向是针对在客户端中的那个传入方法的对象而言的。in 为定向 tag 的话表现为服务端将会接收到一个那个对象的完整数据,但是客户端的那个对象不会因为服务端对传参的修改而发生变动;out 的话表现为服务端将会接收到那个对象的参数为空的对象,但是在服务端对接收到的空对象有任何修改之后客户端将会同步变动;inout 为定向 tag 的情况下,服务端将会接收到客户端传来对象的完整信息,并且客户端将会同步服务端对该对象的任何变动。
23+
24+
25+
26+
[]: https://blog.csdn.net/luoyanglizi/article/details/51958091 "你真的理解AIDL中的in,out,inout么?"
27+

android/APK 打包过程.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,7 @@
88
4. 通过dex命令,将.class文件和第三方库中的.class文件处理生成classes.dex
99
5. 通过apkbuilder工具,将aapt生成的resources.arsc和res文件、assets文件和classes.dex一起打包生成apk
1010
6. 通过Jarsigner工具,对上面的apk进行debug或release签名
11-
7. 通过zipalign工具,将签名后的apk进行对齐处理。
11+
7. 通过zipalign工具,将签名后的apk进行对齐处理。
12+
13+
[1]: https://juejin.im/entry/5a6ed6836fb9a01ca3258b5f "3个知识点让你了解Android签名机制"
14+

android/RecyclerView 中的坑.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# RecyclerView 中碰过的坑
2+
3+
1. ViewHolder views must not be attached when created. Ensure that you are not passing ‘true’ to the attachToRoot parameter of LayoutInflater.inflate(…, boolean attachToRoot)
4+
5+
解决:
6+
7+
虽然网上有众多和这个 exception 相关的文章,但是和我们遇到的情况都不一样。这个问题源自 onCreateViewHolder 在创建 holder 的时候将一个已经 attach 到 recyclerview 中的 view 又传给了新 new 出来的 holder 导致了这个问题。
8+
9+
解决方法有两种:
10+
11+
- 通过 layoutmanager 将 view remove 后交给新的 holder
12+
- new 一个新的 view 交给 holder
13+
14+
15+
16+
17+
18+
[]: https://lber19535.github.io/2019/02/28/2019-2019-2-bug汇总/
19+

android/View 布局过程.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
# View 布局过程
22

3-
![这里写图片描述](https://img-blog.csdn.net/20150529163153998)
3+
![这里写图片描述](https://img-blog.csdn.net/20150529163153998)
4+

kotlin/Kotlin 函数类型.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Kotlin 函数类型
2+
3+
4+
5+
[]: https://www.kotlincn.net/docs/reference/lambdas.html#函数类型实例调用 "高阶函数与 lambda 表达式"
6+

kotlin/Kotlin 总结.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,8 +358,9 @@ fun postItem(item: Item) {
358358

359359
`CoroutineBuilder`
360360
`CoroutineScope.launch`函数属于协程构建器 `Coroutine builders``Kotlin` 中还有其他几种 Builders,负责创建协程:
361+
361362
- `CoroutineScope.launch {}`: 不阻塞当前线程,在后台创建一个新协程
362-
- `runBlocking {}`: 创建一个新的协程,同时**与其子协程共同阻塞**当前线程,直到协程结束.。主要作用为桥接普通阻塞代码和挂起代码的非阻塞代码。(保活 JVM)
363+
- `runBlocking {}`: 创建一个新的协程,同时**与其子协程共同阻塞**当前线程,直到协程结束。主要作用为桥接普通阻塞代码和挂起代码的非阻塞代码。(保活 JVM)
363364
- `withContext {}`: 不会创建新的协程,在指定协程上运行挂起代码块,并挂起该协程直至代码块运行完成。
364365
- `async {}`: 创建一个新协程,唯一的区别是它有返回值
365366

net/HTTP 中的 Message Format.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# HTTP 中的 Message Format
2+
3+
所有訊息都是由:
4+
5+
- 起始行 (start-line) 開始
6+
- 0 或多個 表頭欄位 (header-field) + CRLF
7+
[合稱為 表頭 (headers) 或是 表頭部分 (header section)]
8+
- 再加上一個 CRLF
9+
- 最後是 **可選的 (optional)** 訊息主體 (message-body)
10+
11+
12+
13+
請求訊息 (request message) 範例 :
14+
(顏色對應上方格式)
15+
16+
```
17+
POST /?id=1 HTTP/1.1
18+
Host: echo.paw.cloud
19+
Content-Type: application/json; charset=utf-8
20+
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:53.0) Gecko/20100101 Firefox/53.0
21+
Connection: close
22+
Content-Length: 136
23+
24+
{
25+
"status": "ok",
26+
"extended": true,
27+
"results": [
28+
{"value": 0, "type": "int64"},
29+
{"value": 1.0e+3, "type": "decimal"}
30+
]
31+
}
32+
```
33+
34+
35+
36+
回應訊息 (response message) 範例 :
37+
(顏色對應上方格式)
38+
39+
```
40+
HTTP/1.1 200 OK
41+
Content-Type: text/html; charset=utf-8
42+
Date: Sat, 18 Feb 2017 00:01:57 GMT
43+
Server: nginx/1.11.8
44+
transfer-encoding: chunked
45+
Connection: Close
46+
47+
<!doctype html>
48+
<html lang="en">
49+
<head>
50+
<meta charset="utf-8">
51+
<title>echo</title>
52+
....略
53+
```
54+
55+
56+
57+
[]: https://notfalse.net/39/http-message-format "HTTP/1.1 — 訊息格式 (Message Format)"
58+

net/HTTP 中的 Method.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# HTTP中的方法
2+
3+
## Get 和 Post 的区别
4+
5+
> Get Method — 向指定的資源要求資料,類似於查詢操作。
6+
7+
- 資料傳遞方式 — 將參數以 Query String方式(name/value),由URL帶至Server端,EX: /test/demo_get**?name1=value1&name2=value2**
8+
- 參數長度限制 — 長度限制根據瀏覽器、Server 的不同會有所不同。
9+
- 安全性 — 較POST不安全,因為傳遞的參數會在URL上顯示。
10+
- 資料種類 — 只允許 ASCII。
11+
- **可以**重新載入或按上一頁並不會有任何問題。
12+
- 傳遞的參數****被儲存在瀏覽器的歷史紀錄中。
13+
- **可以**加入瀏覽器書籤。
14+
15+
```
16+
GET /?id=xxxxx&password=xxxxx HTTP/1.1
17+
Host: www.example.com
18+
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-TW; rv:1.9.2.13)
19+
Gecko/20101203 Firefox/3.6.13 GTB7.1 ( .NET CLR 3.5.30729)
20+
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
21+
Accept-Language: zh-tw,en-us;q=0.7,en;q=0.3
22+
Accept-Encoding: gzip,deflate
23+
Accept-Charset: UTF-8,*
24+
Keep-Alive: 115
25+
Connection: keep-alive
26+
```
27+
28+
http GET
29+
30+
------
31+
32+
> Post Method — 將要處理的資料提交給指定的資源,類似於更新操作。
33+
34+
- 資料傳遞方式 — 將參數放至 Request 的 message body 中,因此不會在URL看到參數,適合用於隱密性較高的資料,EX: Signup、Signin帳號、密碼等。
35+
- 參數長度限制 — 長度不受限制。
36+
- 安全性 — 較POST安全,實際上傳遞的參數皆可以在封包(Request- line 和 Message-body)上看到。
37+
- 資料種類 — 無限制。
38+
- 重新載入或按上一頁瀏覽器會出現將重新提交(re-submitted)資料的提示。
39+
- 傳遞的參數**不會**被儲存在瀏覽器的歷史紀錄中。
40+
- **無法**加入瀏覽器書籤。
41+
42+
```
43+
44+
POST / HTTP/1.1
45+
Host: xxx.toright.com
46+
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-TW; rv:1.9.2.13)
47+
Gecko/20101203 Firefox/3.6.13 GTB7.1 ( .NET CLR 3.5.30729)
48+
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
49+
Accept-Language: zh-tw,en-us;q=0.7,en;q=0.3
50+
Accept-Encoding: gzip,deflate
51+
Accept-Charset: UTF-8,*
52+
Keep-Alive: 115
53+
Connection: keep-alive
54+
55+
Content-Type: application/x-www-form-urlencoded
56+
</code><code>Content-Length: 9
57+
id=xxxxx&password=xxxxx
58+
```
59+

net/HTTP 协议.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# dHTTP 协议
1+
# HTTP 协议
22

33
## 版本差异
44

other/字符集和字符编码.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# 字符集和字符编码
2+
3+
[]: http://cenalulu.github.io/linux/character-encoding/ "十分钟搞清字符集和字符编码"
4+

other/常用命令.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# 常用shell命令
22

3+
## Mac 中显示/隐藏文件
4+
5+
defaults write com.apple.finder AppleShowAllFiles -bool true
6+
7+
defaults write com.apple.finder AppleShowAllFiles -bool false
8+
9+
10+
311
## push APK
412
adb root
513
adb remount
@@ -8,6 +16,10 @@ adb push TPCamera.apk /system/app/TPCamera
816
## adb logcat
917
adb logcat -c
1018

19+
**kill application**
20+
21+
adb shell am force-stop com.tencent.qqmusicwatch
22+
1123
## switch JDK
1224
sudo update-alternatives --config java
1325
sudo update-alternatives --config javac

shell/shell 语法.md

Whitespace-only changes.

设计模式/责任链模式.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# 责任链模式
2+

音频开发/音频名词解释.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# 音频名词解释
2+
3+
4+
5+
[]: https://www.jianshu.com/p/09610fe52fba "音频采样率和码率简介"
6+

0 commit comments

Comments
 (0)