Skip to content

Commit

Permalink
code clean
Browse files Browse the repository at this point in the history
add zh-rTW
modify BroadcastReceiverDemo
delete Chinese
  • Loading branch information
Trinea committed Jan 4, 2014
1 parent 347a2d2 commit 747b8ab
Show file tree
Hide file tree
Showing 12 changed files with 309 additions and 87 deletions.
59 changes: 52 additions & 7 deletions res/layout/broadcast_receiver_demo.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,31 +13,76 @@
android:layout_height="wrap_content" >

<Button
android:id="@+id/sendGeneralBroadcast"
android:id="@+id/send_general_broadcast"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/send_general_broadcast" />

<TextView
android:id="@+id/general_broadcast_msg"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/send_general_broadcast" />

<include
android:id="@+id/divider_1"
android:layout_width="match_parent"
android:layout_height="@dimen/divider_height"
android:layout_below="@+id/general_broadcast_msg"
layout="@layout/divider" />

<Button
android:id="@+id/sendLocalBroadcast"
android:id="@+id/send_local_broadcast"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/sendGeneralBroadcast"
android:layout_below="@+id/divider_1"
android:text="@string/send_local_broadcast" />

<TextView
android:id="@+id/local_broadcast_msg"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/send_local_broadcast" />

<include
android:id="@+id/divider_2"
android:layout_width="match_parent"
android:layout_height="@dimen/divider_height"
android:layout_below="@+id/local_broadcast_msg"
layout="@layout/divider" />

<Button
android:id="@+id/sendOrderedBroadcast"
android:id="@+id/send_ordered_broadcast"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/sendLocalBroadcast"
android:layout_below="@+id/divider_2"
android:text="@string/send_ordered_broadcast" />

<TextView
android:id="@+id/ordered_broadcast_msg"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/send_ordered_broadcast" />

<include
android:id="@+id/divider_3"
android:layout_width="match_parent"
android:layout_height="@dimen/divider_height"
android:layout_below="@+id/ordered_broadcast_msg"
layout="@layout/divider" />

<Button
android:id="@+id/sendStickyBroadcast"
android:id="@+id/send_sticky_broadcast"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/sendOrderedBroadcast"
android:layout_below="@+id/divider_3"
android:text="@string/send_sticky_broadcast" />

<TextView
android:id="@+id/sticky_broadcast_msg"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/send_sticky_broadcast" />
</RelativeLayout>
</ScrollView>

Expand Down
5 changes: 5 additions & 0 deletions res/layout/divider.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<View xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="@dimen/divider_height"
android:background="#000000" />
15 changes: 14 additions & 1 deletion res/values-zh-rCN/strings.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<resources xmlns:android="http://schemas.android.com/apk/res/android" xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">

<string name="send_general_broadcast">发送广播</string>
<string name="send_local_broadcast">发送Local广播</string>
<string name="send_ordered_broadcast">发送有序广播</string>
<string name="send_sticky_broadcast">发送Sticky广播</string>
<string name="general_broadcast_msg">普通广播告知:好声音马上开始了啦</string>
<string name="local_broadcast_msg">Local广播告知:好声音马上开始了啦</string>
<string name="ordered_broadcast_msg">有序广播告知:好声音马上开始了啦</string>
<string name="sticky_broadcast_msg">Sticky广播告知:好声音马上开始了啦</string>
<string name="sticky_broadcast_wait_tip">请等候<xliff:g>%1$s</xliff:g>毫秒</string>
<string name="ordered_broadcast_high_tip">优先级最高的接收者接收到广播,内容为: <xliff:g>%1$s</xliff:g></string>
<string name="ordered_broadcast_medium_tip">优先级中等的接收者接收到广播,内容为: <xliff:g>%1$s</xliff:g>,上一个接收者为:<xliff:g>%2$s</xliff:g></string>
<string name="ordered_broadcast_medium_cancel_tip">优先级中等的接收者接收到广播并已取消广播继续传递,内容为: <xliff:g>%1$s</xliff:g>,上一个接收者为:<xliff:g>%2$s</xliff:g></string>
<string name="ordered_broadcast_low_tip">优先级最低的接收者接收到广播,内容为: <xliff:g>%1$s</xliff:g>,上一个接收者为:<xliff:g>%2$s</xliff:g></string>
<string name="ordered_broadcast_tip">默认优先级接收者接收到广播,内容为: <xliff:g>%1$s</xliff:g>,上一个接收者为:<xliff:g>%2$s</xliff:g></string>

<string name="start_general_service">启动普通服务</string>
<string name="stop_general_service">停止普通服务</string>
Expand All @@ -15,6 +25,9 @@
<string name="unbound_service">解除绑定服务</string>
<string name="start_aidl_service">启动AIDL服务</string>
<string name="stop_aidl_service">停止AIDL服务</string>
<string name="operate_value_success">增加成功,当前值为: <xliff:g>%1$s</xliff:g></string>
<string name="operate_value_tip">当前值为: <xliff:g>%1$s</xliff:g></string>
<string name="bind_service_tip">请先绑定服务</string>

<string name="app_status_download">点击下载美丽说APK</string>
<string name="app_status_downloaded">已下载过,点击重新下载</string>
Expand Down
62 changes: 62 additions & 0 deletions res/values-zh-rTW/strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:android="http://schemas.android.com/apk/res/android" xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">

<string name="send_general_broadcast">發送廣播</string>
<string name="send_local_broadcast">發送Local廣播</string>
<string name="send_ordered_broadcast">發送有序廣播</string>
<string name="send_sticky_broadcast">發送Sticky廣播</string>
<string name="general_broadcast_msg">普通廣播告知:好聲音馬上開始了啦</string>
<string name="local_broadcast_msg">Local廣播告知:好聲音馬上開始了啦</string>
<string name="ordered_broadcast_msg">有序廣播告知:好聲音馬上開始了啦</string>
<string name="sticky_broadcast_msg">Sticky廣播告知:好聲音馬上開始了啦</string>
<string name="sticky_broadcast_wait_tip">請等候<xliff:g>%1$s</xliff:g>毫秒</string>
<string name="ordered_broadcast_high_tip">優先級最高的接收者接收到廣播,內容爲: <xliff:g>%1$s</xliff:g></string>
<string name="ordered_broadcast_medium_tip">優先級中等的接收者接收到廣播,內容爲: <xliff:g>%1$s</xliff:g>,上一個接收者爲:<xliff:g>%2$s</xliff:g></string>
<string name="ordered_broadcast_medium_cancel_tip">優先級中等的接收者接收到廣播並已取消廣播繼續傳遞,內容爲: <xliff:g>%1$s</xliff:g>,上一個接收者爲:<xliff:g>%2$s</xliff:g></string>
<string name="ordered_broadcast_low_tip">優先級最低的接收者接收到廣播,內容爲: <xliff:g>%1$s</xliff:g>,上一個接收者爲:<xliff:g>%2$s</xliff:g></string>
<string name="ordered_broadcast_tip">默認優先級接收者接收到廣播,內容爲: <xliff:g>%1$s</xliff:g>,上一個接收者爲:<xliff:g>%2$s</xliff:g></string>

<string name="start_general_service">啓動普通服務</string>
<string name="stop_general_service">停止普通服務</string>
<string name="start_intent_service">啓動Intent Service</string>
<string name="bound_service">綁定服務</string>
<string name="operate_bound_service">增加綁定服務的count屬性</string>
<string name="get_bound_service_pro">獲取綁定服務的count屬性</string>
<string name="unbound_service">解除綁定服務</string>
<string name="start_aidl_service">啓動AIDL服務</string>
<string name="stop_aidl_service">停止AIDL服務</string>
<string name="operate_value_success">增加成功,當前值爲: <xliff:g>%1$s</xliff:g></string>
<string name="operate_value_tip">當前值爲: <xliff:g>%1$s</xliff:g></string>
<string name="bind_service_tip">請先綁定服務</string>

<string name="app_status_download">點擊下載美麗說APK</string>
<string name="app_status_downloaded">已下載過,點擊重新下載</string>
<string name="app_status_download_fail">下載失敗,點擊重新下載</string>
<string name="progress_tip">下載進度:</string>
<string name="download_notification_title">美麗說</string>
<string name="download_begin">開始下載</string>
<string name="download_fail">下載失敗</string>
<string name="app_status_pending">等待下載</string>
<string name="app_status_pause">暫停</string>
<string name="app_status_downloading">下載中</string>
<string name="tip_download_file">文件將下載到:</string>

<string name="update_at">更新于:&#160;</string>

<string name="profile">個人主頁:&#160;</string>
<string name="description">更多介紹:&#160;</string>
<string name="http_cache_get">獲取內容</string>

<string name="desc_search_view">SearchView介紹及搜索提示實現</string>
<string name="desc_view_pager_multi_page">viewpager實現畫廊效果</string>
<string name="desc_download_manager">系統下載管理使用</string>
<string name="desc_slide_gallery">Gallery滑動一頁(一個Item)效果</string>
<string name="desc_view_pager">ViewPager、Fragment使用</string>
<string name="desc_service">Service介紹</string>
<string name="desc_broadcast_receiver">BroadcastReceiver介紹</string>
<string name="desc_border_scroll_view">BorderScrollViewDemo介紹</string>
<string name="desc_drop_down_listview">下拉刷新及底部加載更多Listview</string>
<string name="desc_image_cache">ImageCache使用</string>
<string name="desc_image_sdcard_cache">ImageSDCardCache使用</string>
<string name="desc_default">Trinea</string>
</resources>
1 change: 1 addition & 0 deletions res/values/dimens.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@
<dimen name="dp_40">40dp</dimen>
<dimen name="sp_16">16sp</dimen>
<dimen name="search_view_margin_left">55dp</dimen>
<dimen name="divider_height">1px</dimen>

</resources>
19 changes: 16 additions & 3 deletions res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<resources xmlns:android="http://schemas.android.com/apk/res/android" xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">

<string name="app_name">Trinea Android Demo</string>

Expand All @@ -21,7 +21,17 @@
<string name="send_local_broadcast">send local broadcast</string>
<string name="send_ordered_broadcast">send ordered broadcast</string>
<string name="send_sticky_broadcast">send sticky broadcast</string>

<string name="general_broadcast_msg">general broadcast say: Voice of America begin</string>
<string name="local_broadcast_msg">local broadcast say: Voice of America begin</string>
<string name="ordered_broadcast_msg">ordered broadcast say: Voice of America begin</string>
<string name="sticky_broadcast_msg">sticky broadcast say: Voice of America begin</string>
<string name="sticky_broadcast_wait_tip">Please wait <xliff:g>%1$s</xliff:g> millseconds</string>
<string name="ordered_broadcast_high_tip">High priority receiver receive, content is: <xliff:g>%1$s</xliff:g></string>
<string name="ordered_broadcast_medium_tip">Medium priority receiver receive, content is: <xliff:g>%1$s</xliff:g>, last receiver is <xliff:g>%2$s</xliff:g></string>
<string name="ordered_broadcast_medium_cancel_tip">Medium priority receiver receive and calcel broadcast deliver, content is: <xliff:g>%1$s</xliff:g>, last receiver is <xliff:g>%2$s</xliff:g></string>
<string name="ordered_broadcast_low_tip">Low priority receiver receive, content is: <xliff:g>%1$s</xliff:g>, last receiver is <xliff:g>%2$s</xliff:g></string>
<string name="ordered_broadcast_tip">Default priority receiver receive, content is: <xliff:g>%1$s</xliff:g>, last receiver is <xliff:g>%2$s</xliff:g></string>

<string name="start_general_service">start general service</string>
<string name="stop_general_service">stop_general service</string>
<string name="start_intent_service">start intent service</string>
Expand All @@ -31,7 +41,10 @@
<string name="unbound_service">unbound service</string>
<string name="start_aidl_service">start aidl service</string>
<string name="stop_aidl_service">stop aidl service</string>

<string name="operate_value_success">Add value success, current value is:<xliff:g>%1$s</xliff:g></string>
<string name="operate_value_tip">Current value is: <xliff:g>%1$s</xliff:g></string>
<string name="bind_service_tip">Please bind service first</string>

<string name="app_status_download">click to download</string>
<string name="app_status_downloaded">downloaded, click to download again</string>
<string name="app_status_download_fail">download fail, click to download again</string>
Expand Down
5 changes: 4 additions & 1 deletion src/cn/trinea/android/demo/BaseActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import android.app.ActionBar;
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.view.MenuItem;
import android.widget.Button;
Expand All @@ -16,12 +17,14 @@
*/
public class BaseActivity extends Activity {

private Button trineaInfoTv;
protected Context context;
private Button trineaInfoTv;

protected void onCreate(Bundle savedInstanceState, int layoutResID) {
super.onCreate(savedInstanceState);
setContentView(layoutResID);

context = getApplicationContext();
AppUtils.initTrineaInfo(this, trineaInfoTv, getClass());

ActionBar bar = getActionBar();
Expand Down
Loading

0 comments on commit 747b8ab

Please sign in to comment.