Flickr Authentication in Flutter (Part II)

Flickr Authentication in Flutter (II) Following the steps described in last article, you can have a working version of Flickr authentication module in Flutter. However, it’s very tedious to remember the pin code, and input it in the dialog in step 2. By reading closely the “Getting a request token” part in Flickr website, you’ll find that, in fact, there’s another way to get the verifier we need without user intervention. A parameter called “oauth_callback” is used to specify a url. If it’s defined in the request; after authorization is complete, Flickr will redirect the user back to your application using the oauth_callback specified with your Request Token. It looks like this: ...

July 25, 2019

Summary of Clean Architecture (I)

上高地。日本 Clean Architecture: A Craftsman’s Guide to Software Structure and Design, First Edition Part I writing working codes is easy; to write codes that are easy to maintain and extend is really hard. Ch1 What is Design & Architecture In this book, design and architecture means the same thing: it’s simply a continuum of decisions from the highest to the lowest levels. ...

July 25, 2019

Flickr API integration in Flutter with Dart

Flickr used to be a cool photo service that gathered many talented photographers. I started uploading all my photos to it since 2005, and now I’ve uploaded more than 160k photos. With so many memories in Flickr, I would like to have an app to randomly show me my own photos in order to refresh good old memories. There are many Flickr API Kits in different programming languages in Flickr official website; however, Dart is not one of them. I either need to implement the API wrapper by referencing its Web API document or find another solution on the internet. ...

July 23, 2019

幻滅,是成長的開始 — Flutter 的 async 與 isolate

原以為 Flutter 寫起來很開心,有任何耗時比較長的工作,就塞到一個 Future someFunction(…) async {…} 中就好,不需要像 Android 裡還需要用到 rxJava 或是自己建 thread 來處理。但後來發現其實沒有那麼單純。就像下面這篇文章開頭講的一樣:剛接觸 Flutter 的人通常不會管到 asynchronous 的問題,直到 UI 開始變得很卡的時候。 ...

May 28, 2019

如何移掉 flutter app 中的 debug label

在開發的時候,會注意到畫面的右上角有個 Debug 的標籤。官方的說法是,因為開發的版本開啟了很多協助開發或除錯的功能,所以運行速度會跟正式版差很多。為了避免使用的人以為這就是 flutter app 的速度,所以針對測試中的版本,預設都會加上 debug 標籤,讓人比較不會誤會 (真的這樣就不會誤會嗎?) ...

May 11, 2019

Flutter 中處理 Image 的方式

Image processing in flutter (remove white background) 在 Android 中,把圖片顯示出來前,如果對 Image 做點變化的話,通常會將 Image 先轉成 Bitmap,再針對 Bitmap 中的每個 pixel 去做處理,最終轉成 Drawable,再送給 View 去繪製。作法可以參加 CalliImageView 中的 adjust function。 ...

April 13, 2019

Extract translated strings in Android project

Hakone.Japan It’s common that an android developer is working on several projects. Sometimes, you just need some existing string translations from another Android project. Usually, the translated strings are scattered in strings.xml file in tens of folders named values-xx. There’s no easy way to copy these string definitions from multiple folders into new project. Therefore, I wrote a simple python script to do the job. All you have to do is: ...

April 3, 2019

青森八甲田滑雪攻略

青森八甲田樹冰 滑雪滑這麼多年了,第一次滑到這麼特別的雪場。整個雪場只有一條纜車;雖然一次可以載一百個人,但每次排隊可能要等20分到1個多小時,一天有可能只滑得到三趟。儘管如此,每天前往朝聖的人還是絡繹不絕。究竟它有怎樣的魅力呢,下面會一一道來。我們先來看看怎麼前往這個神奇雪場。 ...

February 17, 2019

如何在 javadoc 中做到隱藏部分 public function 和 class 的定義

有時,雖然部分的 classes 或是 functions 是設為 public 的,但在產生 javadoc 文件時,我們卻希望不要將這些資訊呈現給看文件的使用者。一種可能的情況是,我們在程式碼中已經有實作某些新的功能,卻不希望使用者事前知道這些功能的存在。 ...

October 20, 2018

支援 Android multi-window 模式時需要注意的事情

Chamonix, France 通常在 Activity 中使用 WebView 時,會習慣在 onPause 裡頭,呼叫 WebView.onPause(),順著 Activity 的生命週期,將 WebView 順手停下來 ;然後在 onResume 來的時候,再呼叫 WebView.onResume() 讓 WebView 可以繼續運作。 ...

October 19, 2018