Friday, September 28, 2012

香港快拍+ v5.1.0 更新



v5.1.0 (2012-09-28)

- 增加穩定性
- 轉用另一個天氣資訊供應商,因早前 google weather api 正式關閉引致本 app 經常 force close 之問題亦隨之解決。
- 新增以下位置:
粉嶺公路近港鐵粉嶺站
獅子山隧道公路近紅梅谷路
港深西部公路近廈村
元朗公路近丹桂村
大欖隧道元朗入口
大欖隧道汀九入口
南灣隧道昂船洲大橋入口
沙田嶺隧道沙田入口
象鼻山路近美環街
西區海底隧道香港入口
西區海底隧道九龍入口
大老山隧道九龍入口
東區海底隧道九龍入口
大老山隧道沙田入口


Download From Google Play



Monday, September 24, 2012

增加按鈕可按面積

在設計 ui 時侯因為要遷就版面, 有時按鈕被迫佔用較少位置, 手指頭大的用家當然會按得較吃力, 解決方法好簡單, 使用 TouchDelegates 增大可按面積就可以了:

以下 example 來自: http://www.thomas-manthey.net/2012/03/04/android-basics-using-touchdelegates/


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/**
     * Adds a touchable padding around a View by constructing a TouchDelegate
     * and adding it to parent View.
     * @param parent The "outer" parent View
     * @param delegate The delegate that handles the TouchEvents
     * @param topPadding Additional touch area in pixels above View
     * @param bootomPadding Additional touch area in pixels below View
     * @param topPadding Additional touch area in pixels left to View
     * @param topPadding Additional touch area in pixels right to View
     * @return A runnable that you can post as action to a Views event queue
     */
    private static Runnable getTouchDelegateAction(final View parent, final View delegate, final int topPadding, final int bottomPadding, final int leftPadding, final int rightPadding) {
        return new Runnable() {
            @Override
            public void run() {
                
                //Construct a new Rectangle and let the Delegate set its values
                Rect touchRect = new Rect();
                delegate.getHitRect(touchRect);
                
                //Modify the dimensions of the Rectangle
                //Padding values below zero are replaced by zeros
                touchRect.top-=Math.max(0, topPadding);
                touchRect.bottom+=Math.max(0, bottomPadding);
                touchRect.left-=Math.max(0, leftPadding);
                touchRect.right+=Math.max(0, rightPadding);
                
                //Now we are going to construct the TouchDelegate
                TouchDelegate touchDelegate = new TouchDelegate(touchRect, delegate);
                
                //And set it on the parent
                parent.setTouchDelegate(touchDelegate);
                
            }


使用方法:

1
2
3
4
5
6
        //Get references to the View in the layout
        parent = (View) findViewById(R.id.parent);
        delegateButton = (View) findViewById(R.id.cmdClickMe);
        
         //The TouchDelegate has to be set after everything has been calculated and drawn
        parent.post(getTouchDelegateAction(parent, delegateButton, 50,50,50,50));


將 getTouchDelegateAction 放入自己常用 library, 以後按需要直接使用, 紅黑紅紅黑, 就係咁簡單.

Tuesday, September 18, 2012

Android 華麗介面匯聚

Android 工程師 Romain Guy 剛分享了一個連結, 內含大量華麗軟件截圖, 要設計一個吸引人的軟件絶不容易, 現在不妨參考一下高手的作品吧.

http://androidniceties.tumblr.com/