diff options
author | Ed Falk <efalk@cyngn.com> | 2015-09-14 12:34:44 -0700 |
---|---|---|
committer | Michael Bestas <mikeioannina@gmail.com> | 2017-01-04 20:05:25 +0200 |
commit | ae15236e56097a6b0c727dc7f27629457592eef5 (patch) | |
tree | edadb530cc61cc56cd2a1b7fada54eb4ca4b5669 /fmapp2 | |
parent | 2456533666f6af0bfcb7d6d7ffe35fab2b493122 (diff) | |
download | android_hardware_qcom_fm-ae15236e56097a6b0c727dc7f27629457592eef5.tar.gz android_hardware_qcom_fm-ae15236e56097a6b0c727dc7f27629457592eef5.tar.bz2 android_hardware_qcom_fm-ae15236e56097a6b0c727dc7f27629457592eef5.zip |
FMRadio : Localization of band types
Previously, FmRadio could only display the type names for English and
two dialects of Chinese, despite already having a full set of localized
names in the resources. This change moves the names from <array>s to
<string>s and then uses them in PresetStation.java
This looks like a massive change, but it's mostly moving strings to
different resource files.
Change-Id: I6be12d05f9efdec7ec189d30f625d7f82746b5a6
Issue-id: CYNGNOS-995
Fix compile
Partial revert of I6be12d05f9efdec7ec189d30f625d7f82746b5a6 to fix
build.
Change-Id: I5161a726287585624d756fbaf721eb7a814a4794
Fix camel case
Change-Id: I8d3bf40aa1ab4643b3062eb86a89ccd21577ce23
Diffstat (limited to 'fmapp2')
-rw-r--r-- | fmapp2/res/values/arrays.xml | 122 | ||||
-rw-r--r-- | fmapp2/res/values/strings.xml | 56 | ||||
-rw-r--r-- | fmapp2/src/com/caf/fmradio/PresetStation.java | 660 |
3 files changed, 161 insertions, 677 deletions
diff --git a/fmapp2/res/values/arrays.xml b/fmapp2/res/values/arrays.xml index 3ca47df..ffa4494 100644 --- a/fmapp2/res/values/arrays.xml +++ b/fmapp2/res/values/arrays.xml @@ -68,34 +68,34 @@ <item>1 hour</item> </string-array> - <string-array name="search_category_rbds_entries"> - <item>All stations</item> - <item>Adult hits</item> - <item>Classical</item> - <item>Classic Rock</item> - <item>College</item> - <item>Country</item> - <item>Emergency</item> - <item>Emergency test</item> - <item>Foreign language</item> - <item>Information</item> - <item>Jazz</item> - <item>News</item> - <item>Nostalgia</item> - <item>Oldies</item> - <item>Personality</item> - <item>Public</item> - <item>Religious music</item> - <item>Religious talk</item> - <item>Rhythm and Blues</item> - <item>Rock</item> - <item>Soft</item> - <item>Soft Rock</item> - <item>Soft Rhythm and Blues</item> - <item>Sports</item> - <item>Talk</item> - <item>Top 40</item> - <item>Weather</item> + <string-array name="search_category_rbds_entries" translatable="false"> + <item>@string/typ_All_stations</item> + <item>@string/typ_Adult_hits</item> + <item>@string/typ_Classical</item> + <item>@string/typ_Classic_Rock</item> + <item>@string/typ_College</item> + <item>@string/typ_Country</item> + <item>@string/typ_Emergency</item> + <item>@string/typ_Emergency_test</item> + <item>@string/typ_Foreign_language</item> + <item>@string/typ_Information</item> + <item>@string/typ_Jazz</item> + <item>@string/typ_News</item> + <item>@string/typ_Nostalgia</item> + <item>@string/typ_Oldies</item> + <item>@string/typ_Personality</item> + <item>@string/typ_Public</item> + <item>@string/typ_Religious_music</item> + <item>@string/typ_Religious_talk</item> + <item>@string/typ_Rhythm_and_Blues</item> + <item>@string/typ_Rock</item> + <item>@string/typ_Soft</item> + <item>@string/typ_Soft_Rock</item> + <item>@string/typ_Soft_Rhythm_and_Blues</item> + <item>@string/typ_Sports</item> + <item>@string/typ_Talk</item> + <item>@string/typ_Top_40</item> + <item>@string/typ_Weather</item> </string-array> <string-array name="search_category_rbds_values" translatable="false"> @@ -128,39 +128,39 @@ <item>29</item> </string-array> - <string-array name="search_category_rds_entries"> - <item>All stations</item> - <item>Culture</item> - <item>Current affairs</item> - <item>Children programs</item> - <item>Country music</item> - <item>Documentary</item> - <item>Drama</item> - <item>Easy listening music</item> - <item>Education</item> - <item>Emergency</item> - <item>Emergency test</item> - <item>Finance</item> - <item>Folk music</item> - <item>Information</item> - <item>Jazz music</item> - <item>Light classical</item> - <item>Leisure</item> - <item>News</item> - <item>National music</item> - <item>Other music</item> - <item>Oldies music</item> - <item>Phone in</item> - <item>Pop music</item> - <item>Religion</item> - <item>Rock music</item> - <item>Science</item> - <item>Serious classical</item> - <item>Social affairs</item> - <item>Sport</item> - <item>Travel</item> - <item>Varied</item> - <item>Weather</item> + <string-array name="search_category_rds_entries" translatable="false"> + <item>@string/typ_All_stations</item> + <item>@string/typ_Culture</item> + <item>@string/typ_Current_affairs</item> + <item>@string/typ_Children</item> + <item>@string/typ_Country</item> + <item>@string/typ_Documentary</item> + <item>@string/typ_Drama</item> + <item>@string/typ_Easy_listening</item> + <item>@string/typ_Education</item> + <item>@string/typ_Emergency</item> + <item>@string/typ_Emergency_test</item> + <item>@string/typ_Finance</item> + <item>@string/typ_Folk</item> + <item>@string/typ_Information</item> + <item>@string/typ_Jazz</item> + <item>@string/typ_Light_classical</item> + <item>@string/typ_Leisure</item> + <item>@string/typ_News</item> + <item>@string/typ_National</item> + <item>@string/typ_Other</item> + <item>@string/typ_Oldies</item> + <item>@string/typ_Phone_in</item> + <item>@string/typ_Pop</item> + <item>@string/typ_Religion</item> + <item>@string/typ_Rock</item> + <item>@string/typ_Science</item> + <item>@string/typ_Serious_classical</item> + <item>@string/typ_Social_affairs</item> + <item>@string/typ_Sport</item> + <item>@string/typ_Travel</item> + <item>@string/typ_Varied</item> + <item>@string/typ_Weather</item> </string-array> <string-array name="search_category_rds_values" translatable="false"> diff --git a/fmapp2/res/values/strings.xml b/fmapp2/res/values/strings.xml index e7c833e..3f2f2b6 100644 --- a/fmapp2/res/values/strings.xml +++ b/fmapp2/res/values/strings.xml @@ -142,4 +142,60 @@ <string name="user_defind_band_msg">Enter frequency from 76.0 - 108.0, with minimum 1 channel spacing and 100KHz space between max and min freq</string> <string name="save_record_file">Recorded FM file saved to "<xliff:g id="record_file">%1$s</xliff:g>"</string> <string name="fm_search_no_results">No compatible stations found</string> + + <!-- program types --> + <string name="typ_All_stations">All stations</string> + <string name="typ_Culture">Culture</string> + <string name="typ_Current_affairs">Current affairs</string> + <string name="typ_Children">Children programs</string> + <string name="typ_Country">Country music</string> + <string name="typ_Documentary">Documentary</string> + <string name="typ_Drama">Drama</string> + <string name="typ_Easy_listening">Easy listening music</string> + <string name="typ_Education">Education</string> + <string name="typ_Emergency">Emergency</string> + <string name="typ_Emergency_test">Emergency test</string> + <string name="typ_Finance">Finance</string> + <string name="typ_Folk">Folk music</string> + <string name="typ_Information">Information</string> + <string name="typ_Jazz">Jazz music</string> + <string name="typ_Light_classical">Light classical</string> + <string name="typ_Leisure">Leisure</string> + <string name="typ_News">News</string> + <string name="typ_National">National music</string> + <string name="typ_Other">Other music</string> + <string name="typ_Oldies">Oldies music</string> + <string name="typ_Phone_in">Phone in</string> + <string name="typ_Pop">Pop music</string> + <string name="typ_Religion">Religion</string> + <string name="typ_Rock">Rock music</string> + <string name="typ_Science">Science</string> + <string name="typ_Serious_classical">Serious classical</string> + <string name="typ_Social_affairs">Social affairs</string> + <string name="typ_Sport">Sport</string> + <string name="typ_Travel">Travel</string> + <string name="typ_Varied">Varied</string> + <string name="typ_Weather">Weather</string> + + <!-- RBDS (North America) --> + <string name="typ_Adult_hits">Adult hits</string> + <string name="typ_Classical">Classical</string> + <string name="typ_Classic_Rock">Classic Rock</string> + <string name="typ_College">College</string> + <string name="typ_Foreign_language">Foreign language</string> + <string name="typ_Hiphop">Hip Hop</string> + <string name="typ_Nostalgia">Nostalgia</string> + <string name="typ_Personality">Personality</string> + <string name="typ_Public">Public</string> + <string name="typ_Religious_music">Religious music</string> + <string name="typ_Religious_talk">Religious talk</string> + <string name="typ_Rhythm_and_Blues">Rhythm and Blues</string> + <string name="typ_Spanish_music">Spanish music</string> + <string name="typ_Spanish_talk">Spanish talk</string> + <string name="typ_Soft">Soft</string> + <string name="typ_Soft_Rock">Soft Rock</string> + <string name="typ_Soft_Rhythm_and_Blues">Soft Rhythm and Blues</string> + <string name="typ_Sports">Sports</string> + <string name="typ_Talk">Talk</string> + <string name="typ_Top_40">Top 40</string> </resources> diff --git a/fmapp2/src/com/caf/fmradio/PresetStation.java b/fmapp2/src/com/caf/fmradio/PresetStation.java index 698cdb6..7d09d01 100644 --- a/fmapp2/src/com/caf/fmradio/PresetStation.java +++ b/fmapp2/src/com/caf/fmradio/PresetStation.java @@ -30,6 +30,7 @@ package com.caf.fmradio; import qcom.fmradio.FmReceiver; import java.util.Locale; +import android.content.res.Resources; import android.text.TextUtils; //import android.util.Log; @@ -616,622 +617,49 @@ public class PresetStation public static String parsePTY(int pty) { String ptyStr=""; + Resources res = FMAdapterApp.context.getResources(); int rdsStd = FmSharedPreferences.getFMConfiguration().getRdsStd(); - if(rdsStd == FmReceiver.FM_RDS_STD_RBDS) - { - ptyStr = getRBDSPtyString(pty); - } - else if(rdsStd == FmReceiver.FM_RDS_STD_RDS) - { - ptyStr = getRDSPtyString(pty); - } - return (ptyStr); - } - - /** - * get the Text String for the RBDS Program type Code - */ - public static String getRBDSPtyString(int pty) - { - String ptyStr = ""; - - switch (pty) - { - case 1: - { - if (Locale.getDefault().toString().equals("zh_HK")) - ptyStr = "新聞"; - else if (Locale.getDefault().toString().equals("zh_CN")) - ptyStr = "新闻"; - else - ptyStr = "News"; - break; - } - case 2: - { - if (Locale.getDefault().toString().equals("zh_HK")) - ptyStr = "資訊"; - else if (Locale.getDefault().toString().equals("zh_CN")) - ptyStr = "信息频道"; - else - ptyStr = "Information"; - break; - } - case 3: - { - if (Locale.getDefault().toString().equals("zh_HK")) - ptyStr = ""; - else if (Locale.getDefault().toString().equals("zh_CN")) - ptyStr = "体育"; - else - ptyStr = "Sports"; - break; - } - case 4: - { - if (Locale.getDefault().toString().equals("zh_HK")) - ptyStr = "討論"; - else if (Locale.getDefault().toString().equals("zh_CN")) - ptyStr = "交流"; - else - ptyStr = "Talk"; - break; - } - case 5: - { - if (Locale.getDefault().toString().equals("zh_HK")) - ptyStr = "搖滾"; - else if (Locale.getDefault().toString().equals("zh_CN")) - ptyStr = "摇滚"; - else - ptyStr = "Rock"; - break; - } - case 6: - { - if (Locale.getDefault().toString().equals("zh_HK")) - ptyStr = "古典搖滾"; - else if (Locale.getDefault().toString().equals("zh_CN")) - ptyStr = "经典摇滚"; - else - ptyStr = "Classic Rock"; - break; - } - case 7: - { - if (Locale.getDefault().toString().equals("zh_HK")) - ptyStr = "成人熱門精選"; - else if (Locale.getDefault().toString().equals("zh_CN")) - ptyStr = "成人点击"; - else - ptyStr = "Adult Hits"; - break; - } - case 8: - { - if (Locale.getDefault().toString().equals("zh_HK")) - ptyStr = "輕柔搖滾樂"; - else if (Locale.getDefault().toString().equals("zh_CN")) - ptyStr = "轻摇滚"; - else - ptyStr = "Soft Rock"; - break; - } - case 9: - { - if (Locale.getDefault().toString().equals("zh_HK")) - ptyStr = "前40首最熱門歌曲"; - else if (Locale.getDefault().toString().equals("zh_CN")) - ptyStr = "前40"; - else - ptyStr = "Top 40"; - break; - } - case 10: - { - if (Locale.getDefault().toString().equals("zh_HK")) - ptyStr = "鄉村音樂"; - else if (Locale.getDefault().toString().equals("zh_CN")) - ptyStr = "乡村"; - else - ptyStr = "Country"; - break; - } - case 11: - { - if (Locale.getDefault().toString().equals("zh_HK")) - ptyStr = "懷舊"; - else if (Locale.getDefault().toString().equals("zh_CN")) - ptyStr = "老歌"; - else - ptyStr = "Oldies"; - break; - } - case 12: - { - if (Locale.getDefault().toString().equals("zh_HK")) - ptyStr = "輕柔"; - else if (Locale.getDefault().toString().equals("zh_CN")) - ptyStr = "轻音乐"; - else - ptyStr = "Soft"; - break; - } - case 13: - { - if (Locale.getDefault().toString().equals("zh_HK")) - ptyStr = "思鄉"; - else if (Locale.getDefault().toString().equals("zh_CN")) - ptyStr = "怀旧"; - else - ptyStr = "Nostalgia"; - break; - } - case 14: - { - if (Locale.getDefault().toString().equals("zh_HK")) - ptyStr = "爵士樂"; - else if (Locale.getDefault().toString().equals("zh_CN")) - ptyStr = "爵士"; - else - ptyStr = "Jazz"; - break; - } - case 15: - { - if (Locale.getDefault().toString().equals("zh_HK")) - ptyStr = "古典"; - else if (Locale.getDefault().toString().equals("zh_CN")) - ptyStr = "古典"; - else - ptyStr = "Classical"; - break; - } - case 16: - { - if (Locale.getDefault().toString().equals("zh_HK")) - ptyStr = "節奏藍調"; - else if (Locale.getDefault().toString().equals("zh_CN")) - ptyStr = "节奏布鲁斯"; - else - ptyStr = "Rhythm and Blues"; - break; - } - case 17: - { - if (Locale.getDefault().toString().equals("zh_HK")) - ptyStr = "輕柔節奏藍調"; - else if (Locale.getDefault().toString().equals("zh_CN")) - ptyStr = "轻节奏布鲁斯"; - else - ptyStr = "Soft Rhythm and Blues"; - break; - } - case 18: - { - if (Locale.getDefault().toString().equals("zh_HK")) - ptyStr = "外語"; - else if (Locale.getDefault().toString().equals("zh_CN")) - ptyStr = "外语频道"; - else - ptyStr = "Foreign Language"; - break; - } - case 19: - { - if (Locale.getDefault().toString().equals("zh_HK")) - ptyStr = "宗教音樂"; - else if (Locale.getDefault().toString().equals("zh_CN")) - ptyStr = "宗教音乐"; - else - ptyStr = "Religious Music"; - break; - } - case 20: - { - if (Locale.getDefault().toString().equals("zh_HK")) - ptyStr = "宗教討論"; - else if (Locale.getDefault().toString().equals("zh_CN")) - ptyStr = "宗教交流"; - else - ptyStr = "Religious Talk"; - break; - } - case 21: - { - if (Locale.getDefault().toString().equals("zh_HK")) - ptyStr = "個人"; - else if (Locale.getDefault().toString().equals("zh_CN")) - ptyStr = "个性"; - else - ptyStr = "Personality"; - break; - } - case 22: - { - if (Locale.getDefault().toString().equals("zh_HK")) - ptyStr = "公開"; - else if (Locale.getDefault().toString().equals("zh_CN")) - ptyStr = "公共频道"; - else - ptyStr = "Public"; - break; - } - case 23: - { - if (Locale.getDefault().toString().equals("zh_HK")) - ptyStr = "學院"; - else if (Locale.getDefault().toString().equals("zh_CN")) - ptyStr = "校园"; - else - ptyStr = "College"; - break; - } - case 29: - { - if (Locale.getDefault().toString().equals("zh_HK")) - ptyStr = "天氣"; - else if (Locale.getDefault().toString().equals("zh_CN")) - ptyStr = "天气"; - else - ptyStr = "Weather"; - break; - } - case 30: - { - if (Locale.getDefault().toString().equals("zh_HK")) - ptyStr = "緊急測試"; - else if (Locale.getDefault().toString().equals("zh_CN")) - ptyStr = "紧急 测试"; - else - ptyStr = "Emergency Test"; - break; - } - case 31: - { - if (Locale.getDefault().toString().equals("zh_HK")) - ptyStr = "緊急"; - else if (Locale.getDefault().toString().equals("zh_CN")) - ptyStr = "紧急"; - else - ptyStr = "Emergency"; - break; - } - default: - { - ptyStr = ""; - //Log.e(FMRadio.LOGTAG, "Unknown RBDS ProgramType [" + pty + "]"); - break; - } - } - return ptyStr; - } - - /** get the Text String for the Program type Code */ - public static String getRDSPtyString(int pty) - { - String ptyStr = ""; - switch (pty) - { - case 1: - { - if (Locale.getDefault().toString().equals("zh_HK")) - ptyStr = "新聞"; - else if (Locale.getDefault().toString().equals("zh_CN")) - ptyStr = "新闻"; - else - ptyStr = "News"; - break; - } - case 2: - { - if (Locale.getDefault().toString().equals("zh_HK")) - ptyStr = "新聞時事"; - else if (Locale.getDefault().toString().equals("zh_CN")) - ptyStr = "新闻时事"; - else - ptyStr = "Current Affairs"; - break; - } - case 3: - { - if (Locale.getDefault().toString().equals("zh_HK")) - ptyStr = "資訊"; - else if (Locale.getDefault().toString().equals("zh_CN")) - ptyStr = "信息"; - else - ptyStr = "Information"; - break; - } - case 4: - { - if (Locale.getDefault().toString().equals("zh_HK")) - ptyStr = "體育"; - else if (Locale.getDefault().toString().equals("zh_CN")) - ptyStr = "体育"; - else - ptyStr = "Sport"; - break; - } - case 5: - { - if (Locale.getDefault().toString().equals("zh_HK")) - ptyStr = "教育"; - else if (Locale.getDefault().toString().equals("zh_CN")) - ptyStr = "教育"; - else - ptyStr = "Education"; - break; - } - case 6: - { - if (Locale.getDefault().toString().equals("zh_HK")) - ptyStr = "戲劇"; - else if (Locale.getDefault().toString().equals("zh_CN")) - ptyStr = "戏剧"; - else - ptyStr = "Drama"; - break; - } - case 7: - { - if (Locale.getDefault().toString().equals("zh_HK")) - ptyStr = "文化"; - else if (Locale.getDefault().toString().equals("zh_CN")) - ptyStr = "文化"; - else - ptyStr = "Culture"; - break; - } - case 8: - { - if (Locale.getDefault().toString().equals("zh_HK")) - ptyStr = "科學"; - else if (Locale.getDefault().toString().equals("zh_CN")) - ptyStr = "科学"; - else - ptyStr = "Science"; - break; - } - case 9: - { - if (Locale.getDefault().toString().equals("zh_HK")) - ptyStr = "多樣化"; - else if (Locale.getDefault().toString().equals("zh_CN")) - ptyStr = "变奏"; - else - ptyStr = "Varied"; - break; - } - case 10: - { - if (Locale.getDefault().toString().equals("zh_HK")) - ptyStr = "流行音樂"; - else if (Locale.getDefault().toString().equals("zh_CN")) - ptyStr = "流行音乐"; - else - ptyStr = "Pop Music"; - break; - } - case 11: - { - if (Locale.getDefault().toString().equals("zh_HK")) - ptyStr = "搖滾樂"; - else if (Locale.getDefault().toString().equals("zh_CN")) - ptyStr = "摇滚音乐"; - else - ptyStr = "Rock Music"; - break; - } - case 12: - { - if (Locale.getDefault().toString().equals("zh_HK")) - ptyStr = "輕音樂"; - else if (Locale.getDefault().toString().equals("zh_CN")) - ptyStr = "轻音乐"; - else - ptyStr = "Easy Listening Music"; - break; - } - case 13: - { - if (Locale.getDefault().toString().equals("zh_HK")) - ptyStr = "輕古典音樂"; - else if (Locale.getDefault().toString().equals("zh_CN")) - ptyStr = "轻古典音乐"; - else - ptyStr = "Light classical"; - break; - } - case 14: - { - if (Locale.getDefault().toString().equals("zh_HK")) - ptyStr = "正統古典"; - else if (Locale.getDefault().toString().equals("zh_CN")) - ptyStr = "古典"; - else - ptyStr = "Serious classical"; - break; - } - case 15: - { - if (Locale.getDefault().toString().equals("zh_HK")) - ptyStr = "其他音樂"; - else if (Locale.getDefault().toString().equals("zh_CN")) - ptyStr = "其他音乐"; - else - ptyStr = "Other Music"; - break; - } - case 16: - { - if (Locale.getDefault().toString().equals("zh_HK")) - ptyStr = "天氣"; - else if (Locale.getDefault().toString().equals("zh_CN")) - ptyStr = "天气"; - else - ptyStr = "Weather"; - break; - } - case 17: - { - if (Locale.getDefault().toString().equals("zh_HK")) - ptyStr = "財政"; - else if (Locale.getDefault().toString().equals("zh_CN")) - ptyStr = "经济"; - else - ptyStr = "Finance"; - break; - } - case 18: - { - if (Locale.getDefault().toString().equals("zh_HK")) - ptyStr = "少兒節目"; - else if (Locale.getDefault().toString().equals("zh_CN")) - ptyStr = "儿童节目"; - else - ptyStr = "Children programs"; - break; - } - case 19: - { - if (Locale.getDefault().toString().equals("zh_HK")) - ptyStr = "社會事務"; - else if (Locale.getDefault().toString().equals("zh_CN")) - ptyStr = "社会事务"; - else - ptyStr = "Social Affairs"; - break; - } - case 20: - { - if (Locale.getDefault().toString().equals("zh_HK")) - ptyStr = "宗教"; - else if (Locale.getDefault().toString().equals("zh_CN")) - ptyStr = "宗教"; - else - ptyStr = "Religion"; - break; - } - case 21: - { - if (Locale.getDefault().toString().equals("zh_HK")) - ptyStr = "聽眾來得"; - else if (Locale.getDefault().toString().equals("zh_CN")) - ptyStr = "听众来电"; - else - ptyStr = "Phone In"; - break; - } - case 22: - { - if (Locale.getDefault().toString().equals("zh_HK")) - ptyStr = "旅遊"; - else if (Locale.getDefault().toString().equals("zh_CN")) - ptyStr = "旅行"; - else - ptyStr = "Travel"; - break; - } - case 23: - { - if (Locale.getDefault().toString().equals("zh_HK")) - ptyStr = "休閒"; - else if (Locale.getDefault().toString().equals("zh_CN")) - ptyStr = "休闲"; - else - ptyStr = "Leisure"; - break; - } - case 24: - { - if (Locale.getDefault().toString().equals("zh_HK")) - ptyStr = "爵士樂"; - else if (Locale.getDefault().toString().equals("zh_CN")) - ptyStr = "爵士音乐"; - else - ptyStr = "Jazz Music"; - break; - } - case 25: - { - if (Locale.getDefault().toString().equals("zh_HK")) - ptyStr = "鄉村音樂"; - else if (Locale.getDefault().toString().equals("zh_CN")) - ptyStr = "乡村音乐"; - else - ptyStr = "Country Music"; - break; - } - case 26: - { - if (Locale.getDefault().toString().equals("zh_HK")) - ptyStr = "國樂"; - else if (Locale.getDefault().toString().equals("zh_CN")) - ptyStr = "民族音乐"; - else - ptyStr = "National Music"; - break; - } - case 27: - { - if (Locale.getDefault().toString().equals("zh_HK")) - ptyStr = "懷舊金曲"; - else if (Locale.getDefault().toString().equals("zh_CN")) - ptyStr = "怀旧"; - else - ptyStr = "Oldies Music"; - break; - } - case 28: - { - if (Locale.getDefault().toString().equals("zh_HK")) - ptyStr = "民俗音樂"; - else if (Locale.getDefault().toString().equals("zh_CN")) - ptyStr = "民族音乐"; - else - ptyStr = "Folk Music"; - break; - } - case 29: - { - if (Locale.getDefault().toString().equals("zh_HK")) - ptyStr = "紀實"; - else if (Locale.getDefault().toString().equals("zh_CN")) - ptyStr = "记录"; - else - ptyStr = "Documentary"; - break; - } - case 30: - { - if (Locale.getDefault().toString().equals("zh_HK")) - ptyStr = "緊急測試"; - else if (Locale.getDefault().toString().equals("zh_CN")) - ptyStr = "紧急测试"; - else - ptyStr = "Emergency Test"; - break; - } - case 31: - { - if (Locale.getDefault().toString().equals("zh_HK")) - ptyStr = "緊急"; - else if (Locale.getDefault().toString().equals("zh_CN")) - ptyStr = "紧急"; - else - ptyStr = "Emergency"; - break; - } - default: - { - ptyStr = ""; - //Log.e(FMRadio.LOGTAG, "Unknown RDS ProgramType [" + pty + "]"); - break; - } - } - return ptyStr; + int resid; + final int[][] typeCodes = { // RDS, RDBS + {0, 0}, + {R.string.typ_News, R.string.typ_News}, + {R.string.typ_Current_affairs, R.string.typ_Information}, + {R.string.typ_Information, R.string.typ_Sports}, + {R.string.typ_Sport, R.string.typ_Talk}, + {R.string.typ_Education, R.string.typ_Rock}, + {R.string.typ_Drama, R.string.typ_Classic_Rock}, + {R.string.typ_Culture, R.string.typ_Adult_hits}, + {R.string.typ_Science, R.string.typ_Soft_Rock}, + {R.string.typ_Varied, R.string.typ_Top_40}, + {R.string.typ_Pop, R.string.typ_Country}, + {R.string.typ_Rock, R.string.typ_Oldies}, + {R.string.typ_Easy_listening, R.string.typ_Soft}, + {R.string.typ_Light_classical, R.string.typ_Nostalgia}, + {R.string.typ_Serious_classical, R.string.typ_Jazz}, + {R.string.typ_Other, R.string.typ_Classical}, + {R.string.typ_Weather, R.string.typ_Rhythm_and_Blues}, + {R.string.typ_Finance, R.string.typ_Soft_Rhythm_and_Blues}, + {R.string.typ_Children, R.string.typ_Foreign_language}, + {R.string.typ_Social_affairs, R.string.typ_Religious_music}, + {R.string.typ_Religion, R.string.typ_Religious_talk}, + {R.string.typ_Phone_in, R.string.typ_Personality}, + {R.string.typ_Travel, R.string.typ_Public}, + {R.string.typ_Leisure, R.string.typ_College}, + {R.string.typ_Jazz, R.string.typ_Spanish_talk}, + {R.string.typ_Country, R.string.typ_Spanish_music}, + {R.string.typ_National, R.string.typ_Hiphop}, + {R.string.typ_Oldies, 0}, + {R.string.typ_Folk, 0}, + {R.string.typ_Documentary, R.string.typ_Weather}, + {R.string.typ_Emergency_test, R.string.typ_Emergency_test}, + {R.string.typ_Emergency, R.string.typ_Emergency}, + }; + if (pty < 0 || pty >= typeCodes.length) + return ptyStr; + resid = typeCodes[pty][rdsStd == FmReceiver.FM_RDS_STD_RDS ? 0 : 1]; + if (resid == 0) + return ptyStr; + String s = res.getString(resid); + return s; } - - } |