Home

26.6.12

Replace Fragment

http://stackoverflow.com/questions/7723964/replace-fragment-inside-a-viewpager
http://pastebin.com/QqrUaVzk

23.6.12

Android Color Hex

screen_background_light                     #FFFFFFFF   RGBA(255,255,255,1)
screen_background_dark                      #FF000000   RGBA(0,0,0,1)
status_bar_closed_default_background        #FF000000   RGBA(0,0,0,1)
status_bar_opened_default_background        #FF000000   RGBA(0,0,0,1)
search_bar_default_color                    #FF000000   RGBA(0,0,0,1)
safe_mode_background                        #60000000   RGBA(0,0,0,0.38)
screen_background_dark_transparent          #80000000   RGBA(0,0,0,0.5)
screen_background_light_transparent         #80FFFFFF   RGBA(255,255,255,0.5)
safe_mode_text                              #80FFFFFF   RGBA(255,255,255,0.5)
white                                       #FFFFFFFF   RGBA(255,255,255,1)
black                                       #FF000000   RGBA(0,0,0,1)
transparent                                 #00000000   RGBA(0,0,0,0)
background_dark                             #FF000000   RGBA(0,0,0,1)
background_light                            #FFFFFFFF   RGBA(255,255,255,1)
bright_foreground_dark                      #FF000000   RGBA(0,0,0,1)
bright_foreground_light                     #FFFFFFFF   RGBA(255,255,255,1)
bright_foreground_dark_disabled             #80FFFFFF   RGBA(255,255,255,0.5)
bright_foreground_light_disabled            #80000000   RGBA(0,0,0,0.5)
bright_foreground_dark_inverse              #FFFFFFFF   RGBA(255,255,255,1)
bright_foreground_light_inverse             #FF000000   RGBA(0,0,0,1)
dim_foreground_dark                         #BEBEBE     RGBA(190,190,190,1)
dim_foreground_dark_disabled                #80BEBEBE   RGBA(190,190,190,0.5)
dim_foreground_dark_inverse                 #323232     RGBA(50,50,50,1)
dim_foreground_dark_inverse_disabled        #80323232   RGBA(50,50,50,0.5)
hint_foreground_dark                        #808080     RGBA(128,128,128,1)
dim_foreground_light                        #323232     RGBA(50,50,50,1)
dim_foreground_light_disabled               #80323232   RGBA(50,50,50,0.5)
dim_foreground_light_inverse                #BEBEBE     RGBA(190,190,190,1)
dim_foreground_light_inverse_disabled       #80BEBEBE   RGBA(190,190,190,0.5)
hint_foreground_light                       #808080     RGBA(128,128,128,1)
highlighted_text_dark                       #9983CC39   RGBA(131,204,57,0.6)
highlighted_text_light                      #9983CC39   RGBA(131,204,57,0.6)
link_text_dark                              #5C5CFF     RGBA(92,92,255,1)
link_text_light                             #0000EE     RGBA(0,0,238,1)
suggestion_highlight_text                   #177BBD     RGBA(23,123,189,1)
input_method_fullscreen_background          #FFF9F9F9   RGBA(249,249,249,1)
input_method_fullscreen_background_holo     #80000000   RGBA(0,0,0,0.5)
selected_day_background                     #FF0092F4   RGBA(0,146,244,1)
lighter_gray                                #DDD        RGBA(221,221,221,1)
darker_gray                                 #AAA        RGBA(170,170,170,1)
perms_dangerous_grp_color                   #33B5E5     RGBA(51,181,229,1)
perms_dangerous_perm_color                  #33B5E5     RGBA(51,181,229,1)
shadow                                      #CC222222   RGBA(34,34,34,0.8)
search_url_text_normal                      #7FA87F     RGBA(127,168,127,1)
search_url_text_selected                    #FF000000   RGBA(0,0,0,1)
search_url_text_pressed                     #FF000000   RGBA(0,0,0,1)
search_widget_corpus_item_background        #DDD        RGBA(221,221,221,1)
sliding_tab_text_color_active               #FF000000   RGBA(0,0,0,1)
sliding_tab_text_color_shadow               #FF000000   RGBA(0,0,0,1)
keyguard_text_color_normal                  #FFFFFF     RGBA(255,255,255,1)
keyguard_text_color_unlock                  #A7D84C     RGBA(167,216,76,1)
keyguard_text_color_soundoff                #FFFFFF     RGBA(255,255,255,1)
keyguard_text_color_soundon                 #E69310     RGBA(230,147,16,1)
keyguard_text_color_decline                 #FE0A5A     RGBA(254,10,90,1)
lockscreen_clock_background                 #FFFFFFFF   RGBA(255,255,255,1)
lockscreen_clock_foreground                 #FFFFFFFF   RGBA(255,255,255,1)
lockscreen_clock_am_pm                      #FFFFFFFF   RGBA(255,255,255,1)
lockscreen_owner_info                       #FF9A9A9A   RGBA(154,154,154,1)
facelock_color_background                   #000000     RGBA(0,0,0,1)
screen_background_holo_light                #FFF3F3F3   RGBA(243,243,243,1)
screen_background_holo_dark                 #FF000000   RGBA(0,0,0,1)
background_holo_dark                        #FF000000   RGBA(0,0,0,1)
background_holo_light                       #FFF3F3F3   RGBA(243,243,243,1)
bright_foreground_holo_dark                 #FFF3F3F3   RGBA(243,243,243,1)
bright_foreground_holo_light                #FF000000   RGBA(0,0,0,1)
bright_foreground_disabled_holo_dark        #FF4C4C4C   RGBA(76,76,76,1)
bright_foreground_disabled_holo_light       #FFB2B2B2   RGBA(178,178,178,1)
bright_foreground_inverse_holo_dark         #FF000000   RGBA(0,0,0,1)
bright_foreground_inverse_holo_light        #FF000000   RGBA(0,0,0,1)
dim_foreground_holo_dark                    #BEBEBE     RGBA(190,190,190,1)
dim_foreground_disabled_holo_dark           #80BEBEBE   RGBA(190,190,190,0.5)
dim_foreground_inverse_holo_dark            #323232     RGBA(50,50,50,1)
dim_foreground_inverse_disabled_holo_dark   #80323232   RGBA(50,50,50,0.5)
hint_foreground_holo_dark                   #808080     RGBA(128,128,128,1)
dim_foreground_holo_light                   #323232     RGBA(50,50,50,1)
dim_foreground_disabled_holo_light          #80323232   RGBA(50,50,50,0.5)
dim_foreground_inverse_holo_light           #BEBEBE     RGBA(190,190,190,1)
dim_foreground_inverse_disabled_holo_light  #80BEBEBE   RGBA(190,190,190,0.5)
hint_foreground_holo_light                  #808080     RGBA(128,128,128,1)
highlighted_text_holo_dark                  #6633B5E5   RGBA(51,181,229,0.4)
highlighted_text_holo_light                 #6633B5E5   RGBA(51,181,229,0.4)
link_text_holo_dark                         #5C5CFF     RGBA(92,92,255,1)
link_text_holo_light                        #0000EE     RGBA(0,0,238,1)
group_button_dialog_pressed_holo_dark       #46C5C1FF   RGBA(197,193,255,0.27)
group_button_dialog_focused_holo_dark       #2699CC00   RGBA(153,204,0,0.15)
group_button_dialog_pressed_holo_light      #FFFFFFFF   RGBA(255,255,255,1)
group_button_dialog_focused_holo_light      #4699CC00   RGBA(153,204,0,0.27)
legacy_pressed_highlight                    #FFFEAA0C   RGBA(254,170,12,1)
legacy_selected_highlight                   #FFF17A0A   RGBA(241,122,10,1)
legacy_long_pressed_highlight               #FFFFFFFF   RGBA(255,255,255,1)
holo_blue_light                             #FF33B5E5   RGBA(51,181,229,1)
holo_green_light                            #FF99CC00   RGBA(153,204,0,1)
holo_red_light                              #FFFF4444   RGBA(255,68,68,1)
holo_blue_dark                              #FF0099CC   RGBA(0,153,204,1)
holo_green_dark                             #FF669900   RGBA(102,153,0,1)
holo_red_dark                               #FFCC0000   RGBA(204,0,0,1)
holo_purple                                 #FFAA66CC   RGBA(170,102,204,1)
holo_orange_light                           #FFFFBB33   RGBA(255,187,51,1)
holo_orange_dark                            #FFFF8800   RGBA(255,136,0,1)
holo_blue_bright                            #FF00DDFF   RGBA(0,221,255,1)

From http://forum.xda-developers.com/showthread.php?t=1458666&page=2

Parse ftw

Manage to 'sync' Asynctasker with Parse's database. Next step, deriving data from Parse, and run background thread occasionally.

Note: Better save a copy of the code.

http://stackoverflow.com/questions/10976843/run-my-code-in-background-every-1-sec-effectively-in-android

http://stackoverflow.com/questions/5774092/running-a-repeating-task-in-background-on-a-real-time-application

Success hampered by speed

Parsing Match Type
Good. Fast and no complications.

Parsing Tweet & News
Bad. Takes 2.5s to parse one tweet/news. 

Possible solutions
  1. Make use of Parse's platform. First, put data into Parse's database. Subsequently, listfragment will be built from Parse's database. Update database every 6 hours.
  2. Find a way to scrape data on a server, and publish it on a simple HTML website.

18.6.12

onListItemClick, a new beginning

http://android-er.blogspot.sg/2012/01/listfragment.html


No matter on the chosen solution, replacing the displayed fragment in an activity is done like this:
FragmentTransaction transaction = getFragmentManager().beginTransaction();transaction.replace(android.R.id.content, new MyFragment());transaction.commit();


Trying to implement more features to the ListFragment. May consider SimpleAdapter.


Another consideration: new ArrayList>(); from http://eureka.ykyuen.info/2010/01/03/android-simple-listview-using-simpleadapter/

Another consideration: Custom ArrayAdapter
from http://android-er.blogspot.sg/2010/06/custom-arrayadapter-with-with-different.html
http://www.vogella.com/articles/AndroidListView/article.html

Changing Colour of TextView base on Conditions (THE KEY)
http://stackoverflow.com/questions/4134875/android-listactivity-row-color-based-on-object-state

Moving on

NullPointerException(when switching off the screen)
http://stackoverflow.com/questions/8748064/starting-activity-from-fragment-causes-nullpointerexception

Fragment calling Fragment (the next big headache)
http://blog.radioactiveyak.com/2011/02/android-app-surgery-earthquake-redux.html
http://stackoverflow.com/questions/9281797/cant-refresh-data-in-listfragment#_=_

Communications between Fragments
http://stackoverflow.com/questions/5194548/how-to-pass-data-between-fragments


14.6.12

Fragment Adapter code that might be useful

public static class PagerAdapter extends FragmentPagerAdapter {

    public PagerAdapter(FragmentManager fm) {
        super(fm);
    }

    @Override
    public int getCount() {
        return VIEW_COUNT;
    }

    @Override
    public Fragment getItem(int position) {

        Fragment fragment = null;

        switch (position) {
        case 0:
            fragment = Fragment1.newInstance(context_);
            break;

        case 1:
            fragment = Fragment2.newInstance(context_);
            break;

        case 2:
            fragment = Fragment3.newInstance(context_);
            break;

        default:
            break;
        }

        return fragment;
    }
}
 
 
via http://stackoverflow.com/questions/7445437/replace-fragment-with-another-fragment-inside-viewpager 

Sounds like a plan: Ops Jake viewpagerindicator

Met a deadend on my own. Might as well use Jake's lib. This means starting all over again. I should dedicate at most 1 more day to fix the interface. Implementing Fragments is going to be challenging.

Will analyse the sample code, together with the app on my android phone. Need to start digging the real code.



Keywords, directions

Horizontal View Swiping with ViewPager

http://blog.stylingandroid.com/archives/537
http://android-developers.blogspot.sg/2011/08/horizontal-view-swiping-with-viewpager.html
http://developer.android.com/guide/developing/projects/projects-eclipse.html
http://www.developer.com/ws/android/programming/add-horizontal-paging-to-your-android-applications.html

Tab Problems

Huge problem trying to settle the horizontal scrolling part. Added a 3rd tab to confirm the problem. Considering applying ViewPager Indicator. Might be a huge hassle though.

*update*
Setting TextView to android:layout_height="60sp" seems to solve part of the problem. But the main problem is the tab seems to end at the edge of the screen.
 

13.6.12

Swipping, done! (not perfect though)

Done combining tabs and swiping. Its not perfect though.

  1. No horizontal scrolling of tabs
  2. Tabs fit the screen. Should be solvable by implementing horizontal scrolling
  3. Selector for text in tab needed
  4. Roboto kinda weird, but I shall stick to it for now
So far so good! Although its mostly the interface. But once horizontal scrolling and selectors are done, its down to the hard & dirty data extraction and processing!

12.6.12

TextView cannot be resolved to a type

Or [insert whatever] cannot be resolved to a type.

You probably forgot to import eg. the widget package for the TextView. Try to add: "import android.widget.TextView;" At the top of your file.

Tab Interface, problems!

Finally manage to adjust the font size on the tab. However, the tab's width seems to be off. The blue line at the bottom of the tag went missing. Tab works normally.

Customise
http://stackoverflow.com/questions/9958303/create-custom-tab-in-fragmentactivity

Tab Code
http://thepseudocoder.wordpress.com/2011/10/04/android-tabs-the-fragment-way/

ytzBet: Codename Briefcase. Developer Note.

Tab Interface, Contact/Metro Style

http://www.lucazanini.eu/2012/android/tab-layout-in-android/?lang=en
http://www.lucazanini.eu/2012/android/tab-layout-in-android-with-actionbar-and-fragment/?lang=en
http://thepseudocoder.wordpress.com/2011/10/04/android-tabs-the-fragment-way/
http://android.codeandmagic.org/2011/07/android-tabs-with-fragments/
http://thepseudocoder.wordpress.com/2011/10/04/android-tabs-the-fragment-way/ 
http://developer.android.com/resources/tutorials/views/hello-tabwidget.html
http://joshclemm.com/blog/?p=136

http://developer.android.com/resources/samples/Support4Demos/src/com/example/android/supportv4/app/FragmentTabsPager.html

Tab Interface, Swipe and Animation

Swiping
http://android-developers.blogspot.sg/2011/08/horizontal-view-swiping-with-viewpager.html/


Changing Font

Activity Transition

Map Locator

 

Resources

http://windowsphonegeek.com/Resources/UX
http://android-ui-utils.googlecode.com/hg/asset-studio/dist/index.html
http://developer.android.com/sdk/compatibility-library.html
http://stackoverflow.com/questions/5788971/how-to-change-the-font-size-of-tabhost-in-android
http://stackoverflow.com/questions/4146037/android-tabstyle?rq=1

http://m.microsoft.com/windowsphone/en-us/demo/default.aspx


10.6.12

DIY Project

  1. Add new feature to ytzConvert. Convert USD to SGD vice versa. Need to think of a way to connect to the Internet to retrieve this information
  2. Make a "SGPools" app, but better. With notifications

Singapore Pools Soccer Stats

Tried to develop my own little app that tracks the soccer odds at Singapore Pools. Sadly, I've failed miserably.

Here's a few site I found that might be of interest.

http://www.chenlim.com/odds/


Update: BREAKTHROUGH!!

I finally have an idea on how that singapore odds app works.
http://www.singaporepools.com.sg/mobile?function=odds

This will by-pass all the nasty tables and stuff. The menu looks similar to the app.
Related Posts Plugin for WordPress, Blogger...