Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
shaobin0604 committed Jul 3, 2010
1 parent 0aed5b5 commit 8d866d1
Show file tree
Hide file tree
Showing 18 changed files with 90 additions and 44 deletions.
2 changes: 0 additions & 2 deletions .classpath
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry kind="lib" path="libs/admob-sdk-android.jar"/>
<classpathentry kind="lib" path="libs/adlib_android.jar"/>
<classpathentry kind="lib" path="libs/youmiad-android1.1.jar"/>
<classpathentry kind="lib" path="libs/acra-2.0.3.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
2 changes: 1 addition & 1 deletion AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="cn.yo2.aquarium.pocketvoa" android:versionName="@string/app_version" android:versionCode="8">
package="cn.yo2.aquarium.pocketvoa" android:versionName="@string/app_version" android:versionCode="9">
<application android:icon="@drawable/icon" android:label="@string/app_name"
android:name=".App">
<activity android:name=".Main" android:label="@string/app_name"
Expand Down
4 changes: 4 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
Pocket VOA - An online/offline reader for Voice of America news program.

Version 1.2.2 [04/07/2010]
- New: Add "Keep Screen On" option in Settings page.
- Fix Bug: Text is truncated when article is viewed in local.

Version 1.2.1 [02/07/2010]
- New: Add crash report system.
- Fix Bug: Crash when play audio complete.
Expand Down
4 changes: 4 additions & 0 deletions assets/whatsnew.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
Pocket VOA - An online/offline reader for Voice of America news program.

Version 1.2.2 [04/07/2010]
- New: Add "Keep Screen On" option in Settings page.
- Fix Bug: Text is truncated when article is viewed in local.

Version 1.2.1 [02/07/2010]
- New: Add crash report system.
- Fix Bug: Crash when play audio complete.
Expand Down
4 changes: 4 additions & 0 deletions assets/whatsnew_zh_CN.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
口袋VOA - 在线/离线美国之音阅读器

版本 1.2.2 [2010-07-04]
- 改进:设置页面增加“保持屏幕常亮”选项。
- 修正:文章下载不完全。

版本 1.2.1 [2010-07-02]
- 改进:增加错误报告系统。
- 修正:音频播放结束时程序崩溃。
Expand Down
4 changes: 4 additions & 0 deletions assets/whatsnew_zh_TW.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
口袋VOA - 在線/離線美國之音閱讀器

版本 1.2.2 [2010-07-04]
- 改進:設置頁面增加“保持屏幕常亮”選項。
- 修正:文章下載不完全。

版本 1.2.1 [2010-07-02]
- 改進:增加錯誤報告系統。
- 修正:音頻播放結束時程序崩潰。
Expand Down
4 changes: 2 additions & 2 deletions gen/cn/yo2/aquarium/pocketvoa/IMediaPlaybackService.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* This file is auto-generated. DO NOT MODIFY.
* Original file: E:\\SDK\\Motorola\\workspace\\pocket-voa\\src\\cn\\yo2\\aquarium\\pocketvoa\\IMediaPlaybackService.aidl
* Original file: D:\\SDK\\eclipse-java-galileo-SR1-win32\\workspace\\Pocket VOA\\src\\cn\\yo2\\aquarium\\pocketvoa\\IMediaPlaybackService.aidl
*/
package cn.yo2.aquarium.pocketvoa;
import java.lang.String;
Expand Down Expand Up @@ -39,7 +39,7 @@ public android.os.IBinder asBinder()
{
return this;
}
@Override public boolean onTransact(int code, android.os.Parcel data, android.os.Parcel reply, int flags) throws android.os.RemoteException
public boolean onTransact(int code, android.os.Parcel data, android.os.Parcel reply, int flags) throws android.os.RemoteException
{
switch (code)
{
Expand Down
33 changes: 19 additions & 14 deletions gen/cn/yo2/aquarium/pocketvoa/R.java
Original file line number Diff line number Diff line change
Expand Up @@ -268,14 +268,19 @@ public static final class string {
*/
public static final int prefs_key_acra_disable=0x7f060068;
public static final int prefs_key_help=0x7f06005f;
/** keep screen on preference
*/
public static final int prefs_key_keep_screen_on=0x7f06006a;
public static final int prefs_key_whatsnew=0x7f06005e;
public static final int prefs_list_count_dialog_title=0x7f060044;
public static final int prefs_list_count_key=0x7f060041;
public static final int prefs_list_count_summary=0x7f060043;
public static final int prefs_list_count_title=0x7f060042;
public static final int prefs_summary_keep_screen_on=0x7f06006c;
public static final int prefs_title_about=0x7f06005d;
public static final int prefs_title_disable_acra=0x7f060069;
public static final int prefs_title_help=0x7f06005c;
public static final int prefs_title_keep_screen_on=0x7f06006b;
public static final int prefs_title_whatsnew=0x7f06005b;
public static final int progressbar_download_title=0x7f060025;
public static final int progressspin_loadlist_msg=0x7f060027;
Expand Down Expand Up @@ -306,14 +311,14 @@ public static final class xml {
public static final class styleable {
/** Attributes that can be used with a cn_yo2_aquarium_pocketvoa_lyric_LyricView.
<p>Includes the following attributes:</p>
<table>
<table border="2" width="85%" align="center" frame="hsides" rules="all" cellpadding="5">
<colgroup align="left" />
<colgroup align="left" />
<tr><th>Attribute</th><th>Description</th></tr>
<tr><td><code>{@link #cn_yo2_aquarium_pocketvoa_lyric_LyricView_errorMessage cn.yo2.aquarium.pocketvoa:errorMessage}</code></td><td></td></tr>
<tr><td><code>{@link #cn_yo2_aquarium_pocketvoa_lyric_LyricView_focusLineColor cn.yo2.aquarium.pocketvoa:focusLineColor}</code></td><td></td></tr>
<tr><td><code>{@link #cn_yo2_aquarium_pocketvoa_lyric_LyricView_otherLineColor cn.yo2.aquarium.pocketvoa:otherLineColor}</code></td><td></td></tr>
<tr><td><code>{@link #cn_yo2_aquarium_pocketvoa_lyric_LyricView_textSize cn.yo2.aquarium.pocketvoa:textSize}</code></td><td></td></tr>
<tr><th>Attribute<th>Summary</tr>
<tr><th><code>{@link #cn_yo2_aquarium_pocketvoa_lyric_LyricView_errorMessage cn.yo2.aquarium.pocketvoa:errorMessage}</code><td></tr>
<tr><th><code>{@link #cn_yo2_aquarium_pocketvoa_lyric_LyricView_focusLineColor cn.yo2.aquarium.pocketvoa:focusLineColor}</code><td></tr>
<tr><th><code>{@link #cn_yo2_aquarium_pocketvoa_lyric_LyricView_otherLineColor cn.yo2.aquarium.pocketvoa:otherLineColor}</code><td></tr>
<tr><th><code>{@link #cn_yo2_aquarium_pocketvoa_lyric_LyricView_textSize cn.yo2.aquarium.pocketvoa:textSize}</code><td></tr>
</table>
@see #cn_yo2_aquarium_pocketvoa_lyric_LyricView_errorMessage
@see #cn_yo2_aquarium_pocketvoa_lyric_LyricView_focusLineColor
Expand Down Expand Up @@ -385,16 +390,16 @@ theme attribute (in the form
public static final int cn_yo2_aquarium_pocketvoa_lyric_LyricView_textSize = 2;
/** Attributes that can be used with a com_admob_android_ads_AdView.
<p>Includes the following attributes:</p>
<table>
<table border="2" width="85%" align="center" frame="hsides" rules="all" cellpadding="5">
<colgroup align="left" />
<colgroup align="left" />
<tr><th>Attribute</th><th>Description</th></tr>
<tr><td><code>{@link #com_admob_android_ads_AdView_backgroundColor cn.yo2.aquarium.pocketvoa:backgroundColor}</code></td><td></td></tr>
<tr><td><code>{@link #com_admob_android_ads_AdView_isGoneWithoutAd cn.yo2.aquarium.pocketvoa:isGoneWithoutAd}</code></td><td></td></tr>
<tr><td><code>{@link #com_admob_android_ads_AdView_keywords cn.yo2.aquarium.pocketvoa:keywords}</code></td><td></td></tr>
<tr><td><code>{@link #com_admob_android_ads_AdView_refreshInterval cn.yo2.aquarium.pocketvoa:refreshInterval}</code></td><td></td></tr>
<tr><td><code>{@link #com_admob_android_ads_AdView_testing cn.yo2.aquarium.pocketvoa:testing}</code></td><td></td></tr>
<tr><td><code>{@link #com_admob_android_ads_AdView_textColor cn.yo2.aquarium.pocketvoa:textColor}</code></td><td></td></tr>
<tr><th>Attribute<th>Summary</tr>
<tr><th><code>{@link #com_admob_android_ads_AdView_backgroundColor cn.yo2.aquarium.pocketvoa:backgroundColor}</code><td></tr>
<tr><th><code>{@link #com_admob_android_ads_AdView_isGoneWithoutAd cn.yo2.aquarium.pocketvoa:isGoneWithoutAd}</code><td></tr>
<tr><th><code>{@link #com_admob_android_ads_AdView_keywords cn.yo2.aquarium.pocketvoa:keywords}</code><td></tr>
<tr><th><code>{@link #com_admob_android_ads_AdView_refreshInterval cn.yo2.aquarium.pocketvoa:refreshInterval}</code><td></tr>
<tr><th><code>{@link #com_admob_android_ads_AdView_testing cn.yo2.aquarium.pocketvoa:testing}</code><td></tr>
<tr><th><code>{@link #com_admob_android_ads_AdView_textColor cn.yo2.aquarium.pocketvoa:textColor}</code><td></tr>
</table>
@see #com_admob_android_ads_AdView_backgroundColor
@see #com_admob_android_ads_AdView_isGoneWithoutAd
Expand Down
Binary file added release/Pocket-VOA-1.2.2-signed.apk
Binary file not shown.
3 changes: 3 additions & 0 deletions res/values-zh-rCN/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -141,4 +141,7 @@
<!-- crash report preference -->
<string name="prefs_key_acra.disable">acra.disable</string>
<string name="prefs_title_disable_acra">关闭错误报告</string>

<string name="prefs_title_keep_screen_on">常亮背景灯</string>
<string name="prefs_summary_keep_screen_on">阅读文章时保持屏幕常亮</string>
</resources>
12 changes: 8 additions & 4 deletions res/values-zh-rTW/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -122,18 +122,22 @@
<string name="prefs_key_whatsnew">prefs_key_whatsnew</string>
<string name="prefs_key_help">prefs_key_help</string>
<string name="prefs_key_about">prefs_key_about</string>

<!-- crash report dialog resource -->
<string name="crash_notif_ticker_text">意想不到的錯誤發生了,請發送錯誤報告...</string>
<string name="crash_notif_ticker_text">意想不到的錯誤發生了,請發送錯誤報告...</string>
<string name="crash_notif_title">口袋VOA崩潰了...</string>
<string name="crash_notif_text">請點擊這裏以幫助我們修正錯誤.</string>

<string name="crash_dialog_title">錯誤報告</string>
<string name="crash_dialog_text">口袋VOA遇到未知錯誤需要關閉,我們對此引起的不便表示抱歉。我們已經產生了一個關於此錯誤的報告,希望您選擇發送此報告給我們以幫助改善口袋VOA的質量。</string>
<string name="crash_dialog_text">口袋VOA遇到未知錯誤需要關閉,我們對此引起的不便表示抱歉。我們已經產生了一個關於此錯誤的報告,希望您選擇發送此報告給我們以幫助改善口袋VOA的質量。
</string>
<string name="crash_dialog_comment_prompt">這個問題是如何出現的?</string>
<string name="crash_dialog_ok_toast">謝謝 !</string>

<!-- crash report preference -->
<string name="prefs_key_acra.disable">acra.disable</string>
<string name="prefs_title_disable_acra">關閉錯誤報告</string>

<string name="prefs_title_keep_screen_on">常亮背景燈</string>
<string name="prefs_summary_keep_screen_on">閱讀文章時保持屏幕常亮</string>
</resources>
7 changes: 6 additions & 1 deletion res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<resources>


<string name="app_version">1.2.1</string>
<string name="app_version">1.2.2</string>


<string name="app_website">http://pocketvoa.72pines.com</string>
Expand Down Expand Up @@ -154,4 +154,9 @@
<!-- crash report preference -->
<string name="prefs_key_acra.disable">acra.disable</string>
<string name="prefs_title_disable_acra">Disable Crash Report</string>

<!-- keep screen on preference -->
<string name="prefs_key_keep_screen_on">prefs_key_keep_screen_on</string>
<string name="prefs_title_keep_screen_on">Keep Screen On</string>
<string name="prefs_summary_keep_screen_on">keep screen on when show article</string>
</resources>
4 changes: 4 additions & 0 deletions res/xml/settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@
/>
-->

<CheckBoxPreference android:key="@string/prefs_key_keep_screen_on"
android:title="@string/prefs_title_keep_screen_on"
android:defaultValue="true"
android:summary="@string/prefs_summary_keep_screen_on"/>

<CheckBoxPreference android:key="@string/prefs_key_acra.disable"
android:title="@string/prefs_title_disable_acra"
Expand Down
13 changes: 8 additions & 5 deletions src/cn/yo2/aquarium/pocketvoa/DownloadTask.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package cn.yo2.aquarium.pocketvoa;

import java.io.BufferedWriter;
import java.io.File;
import java.io.FileOutputStream;
import java.io.FileWriter;
Expand Down Expand Up @@ -97,13 +98,14 @@ private boolean downloadTextFile(String text, File local, int which,
}
return false;
} else {
FileWriter fw = null;
BufferedWriter bw = null;

try {
if (!local.exists())
local.createNewFile();

fw = new FileWriter(local);
fw.write(text);
bw = new BufferedWriter(new FileWriter(local));
bw.write(text);
for (IProgressListener listener : mListeners) {
listener.setSuccess(which);
}
Expand All @@ -115,11 +117,12 @@ private boolean downloadTextFile(String text, File local, int which,
}
return false;
} finally {
if (fw != null)
if (bw != null)
try {
fw.close();
bw.close();
} catch (IOException e) {
// ignore
Log.e(CLASSTAG, "[downloadTextFile] error close Writer", e);
}
}
}
Expand Down
4 changes: 0 additions & 4 deletions src/cn/yo2/aquarium/pocketvoa/Help.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package cn.yo2.aquarium.pocketvoa;

import java.util.Locale;

import android.app.Activity;
import android.content.res.Configuration;
import android.os.Bundle;
Expand All @@ -18,8 +16,6 @@ public class Help extends Activity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

Utils.setKeepScreenOn(this);

setContentView(R.layout.help);

WebView webView = (WebView)findViewById(R.id.webview);
Expand Down
2 changes: 1 addition & 1 deletion src/cn/yo2/aquarium/pocketvoa/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ public void onConfigurationChanged(Configuration newConfig) {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

Utils.setKeepScreenOn(this);
// Utils.setKeepScreenOn(this);

setContentView(R.layout.main);

Expand Down
10 changes: 6 additions & 4 deletions src/cn/yo2/aquarium/pocketvoa/Show.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
import android.widget.ViewFlipper;
import cn.yo2.aquarium.pocketvoa.lyric.LyricView;

import com.admob.android.ads.AdView;
//import com.admob.android.ads.AdView;
import com.wooboo.adlib_android.WoobooAdView;

public class Show extends Activity {
Expand Down Expand Up @@ -121,7 +121,7 @@ private enum Error {
private ProgressDialog mProgressDialogSpin;
private ProgressDialog mProgressDialogBar;

private AdView mAdView;
// private AdView mAdView;
private ViewFlipper mViewFlipper;
private WebView mWebViewEn;
private WebView mWebViewZh;
Expand Down Expand Up @@ -690,8 +690,6 @@ protected void onCreate(Bundle savedInstanceState) {

setVolumeControlStream(AudioManager.STREAM_MUSIC);

Utils.setKeepScreenOn(this);

setContentView(R.layout.show);

mApp = (App) getApplication();
Expand Down Expand Up @@ -1052,6 +1050,10 @@ public void onServiceDisconnected(ComponentName classname) {
protected void onStart() {
super.onStart();

boolean keepScreenOn = mApp.mSharedPreferences.getBoolean(getString(R.string.prefs_key_keep_screen_on), true);

Utils.setKeepScreenOn(this, keepScreenOn);

paused = false;

if (false == Utils.bindToService(this, mConnection)) {
Expand Down
22 changes: 16 additions & 6 deletions src/cn/yo2/aquarium/pocketvoa/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,17 @@ public void onServiceDisconnected(ComponentName className) {
}
}

public static void setKeepScreenOn(Activity activity) {
activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
/**
* set screen on or off
*
* @param activity
* @param on
*/
public static void setKeepScreenOn(Activity activity, boolean on) {
if (on)
activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
else
activity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
}

public static Article getArticleFromIntent(Intent intent) {
Expand Down Expand Up @@ -134,11 +143,12 @@ public static String loadTextZh(Article article) throws IOException {
}

public static String loadTextFile(File file) throws IOException {
FileReader fr = new FileReader(file);
BufferedReader br = new BufferedReader(new FileReader(file));

StringBuilder text = new StringBuilder();
char[] buf = new char[1024];
while (fr.read(buf) != -1) {
text.append(buf);
String line = null;
while ((line = br.readLine()) != null) {
text.append(line);
}
return text.toString();
}
Expand Down

0 comments on commit 8d866d1

Please sign in to comment.