• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javaandroidc++linuxc#windowsobjective-ccocoaqt誰得pythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Navigation voice changer app for Android


Commit MetaInfo

Revision789e2b0c9f5bc4877eb3640eda44103d8515985f (tree)
Time2013-07-31 03:18:42
AuthorHMML <hmml3939@gmai...>
CommiterHMML

Log Message

Add action menu.

Change Summary

Incremental Difference

--- a/res/layout/activity_main_menu.xml
+++ b/res/layout/activity_main_menu.xml
@@ -14,18 +14,25 @@
1414 android:id="@+id/btn_menu_install"
1515 android:layout_width="fill_parent"
1616 android:layout_height="wrap_content"
17+ android:drawableLeft="@android:drawable/ic_menu_add"
18+ android:paddingRight="32dp"
1719 android:text="@string/menu_install" />
1820
1921 <Button
2022 android:id="@+id/btn_download"
2123 android:layout_width="fill_parent"
2224 android:layout_height="wrap_content"
25+ android:drawableLeft="@android:drawable/ic_menu_search"
26+ android:gravity="center_vertical|center_horizontal"
27+ android:paddingRight="32dp"
2328 android:text="@string/menu_download" />
2429
2530 <Button
2631 android:id="@+id/btn_menu_maint"
2732 android:layout_width="fill_parent"
2833 android:layout_height="wrap_content"
34+ android:drawableLeft="@android:drawable/ic_menu_manage"
35+ android:paddingRight="32dp"
2936 android:text="@string/menu_maint" />
3037
3138 </LinearLayout>
\ No newline at end of file
--- a/res/menu/download.xml
+++ b/res/menu/download.xml
@@ -1,9 +1,4 @@
11 <menu xmlns:android="http://schemas.android.com/apk/res/android" >
2-
3- <item
4- android:id="@+id/text_download_guide"
5- android:orderInCategory="100"
6- android:showAsAction="never"
7- android:title="@string/action_settings"/>
2+ <item android:id="@+id/menu_go_install" android:showAsAction="always" android:icon="@android:drawable/ic_menu_add" android:onClick="goInstallListFromMenu" android:title="@string/title_activity_install_list"></item>
83
94 </menu>
--- a/res/menu/install_list.xml
+++ b/res/menu/install_list.xml
@@ -1,3 +1,4 @@
11 <menu xmlns:android="http://schemas.android.com/apk/res/android" >
2+ <item android:id="@+id/menu_go_download" android:showAsAction="always" android:icon="@android:drawable/ic_menu_search" android:title="@string/title_activity_download" android:onClick="goDownloadActivityFromMenu"></item>
23
34 </menu>
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -32,7 +32,7 @@
3232
3333 <string name="msg_installed_removed">Installed data has been removed.</string>
3434 <string name="msg_downloaded_removed">Downloaded data has been removed.</string>
35- <string name="title_activity_download">DownloadActivity</string>
35+ <string name="title_activity_download">Download Voice Data</string>
3636 <string name="guide_download">Tap to download. Then push back button to move to install view to install.</string>
3737 <string name="download_progress">Donwloading...</string>
3838 <string name="err_no_sd">No external storage is detected. You need to check your SD card or storage setting.</string>
--- a/src/jp/nekoteki/android/navivoicechanger/Config.java
+++ b/src/jp/nekoteki/android/navivoicechanger/Config.java
@@ -5,15 +5,32 @@ import java.io.FileInputStream;
55 import java.io.FileOutputStream;
66 import java.io.InputStreamReader;
77 import java.io.OutputStreamWriter;
8+import java.util.Collections;
9+import java.util.HashMap;
10+import java.util.Map;
811 import java.util.Properties;
912
1013 import android.content.Context;
14+import android.util.Log;
1115
1216 public class Config {
1317 final static public String CONF_FILE = "config.ini";
1418
19+ final static Map<String, String> DEFAULTS;
20+ static {
21+ Map<String, String> c = new HashMap<String, String>();
22+ c.put("server_url_base", "http://nvc.nekoteki.jp");
23+ DEFAULTS = Collections.unmodifiableMap(c);
24+ }
25+
26+
1527 public static String get(Context context, String name) {
16- return (String) getProp(context).get(name);
28+ Log.d("Config", "Getting config key: "+name);
29+ String v = (String) getProp(context).get(name);
30+ if (v != null && !v.equals(""))
31+ return v;
32+ Log.d("Config", "Fallback to default for key: "+name);
33+ return DEFAULTS.get(name);
1734 }
1835
1936 public static void set(Context context, String name, String value) {
@@ -32,6 +49,7 @@ public class Config {
3249 Properties prop = new Properties();
3350 File conf = getConfFile(context);
3451 if (conf == null) return prop;
52+ Log.d("Config", "Config prop file: "+conf.getAbsolutePath());
3553 if (!conf.exists()) return prop;
3654 try {
3755 prop.load(new InputStreamReader(new FileInputStream(conf), "UTF-8"));
--- a/src/jp/nekoteki/android/navivoicechanger/DownloadActivity.java
+++ b/src/jp/nekoteki/android/navivoicechanger/DownloadActivity.java
@@ -31,14 +31,13 @@ import android.widget.TextView;
3131 import android.support.v4.app.NavUtils;
3232 import android.annotation.TargetApi;
3333 import android.content.Context;
34+import android.content.Intent;
3435 import android.graphics.Color;
3536 import android.os.Build;
3637
3738 public class DownloadActivity extends Activity {
3839
3940 public class RemoteVoiceDataAdapter extends BaseAdapter {
40- final static String SERVER_BASE_URL = "http://tempest.private.nemui.org:3000";
41-
4241 protected boolean eol = false;
4342 protected Context context;
4443 protected List<RemoteVoiceData> list;
@@ -78,8 +77,9 @@ public class DownloadActivity extends Activity {
7877
7978 public void loadList(AbsListView view) {
8079 if (this.loading || this.eol) return;
80+ if (this.loading || this.eol) return;
8181 this.loading = true;
82- String url = SERVER_BASE_URL+"/navi_voices.json?page="+Integer.toString(this.cur_page);
82+ String url = Config.get(context, "server_url_base") +"/navi_voices.json?page="+Integer.toString(this.cur_page);
8383
8484 new AsyncTask<Object, Void, RemoteVoiceData[]>() {
8585 protected RemoteVoiceDataAdapter adapter;
@@ -295,4 +295,8 @@ public class DownloadActivity extends Activity {
295295 view.setVisibility(View.GONE);
296296 }
297297 }
298+
299+ public void goInstallListFromMenu(MenuItem item) {
300+ startActivity(new Intent(DownloadActivity.this, InstallListActivity.class));
301+ }
298302 }
--- a/src/jp/nekoteki/android/navivoicechanger/InstallListActivity.java
+++ b/src/jp/nekoteki/android/navivoicechanger/InstallListActivity.java
@@ -125,7 +125,6 @@ public class InstallListActivity extends Activity {
125125 @Override
126126 public void onClick(View arg0) {
127127 startActivity(new Intent(InstallListActivity.this, DownloadActivity.class));
128-
129128 }
130129 });
131130 }
@@ -233,4 +232,8 @@ public class InstallListActivity extends Activity {
233232 }
234233 dialog.show();
235234 }
235+
236+ public void goDownloadActivityFromMenu(MenuItem item) {
237+ startActivity(new Intent(InstallListActivity.this, DownloadActivity.class));
238+ }
236239 }