Navigation voice changer app for Android
Revision | 1340326a2fb9177d5987738fcd2e987c6bd6f54d (tree) |
---|---|
Time | 2013-08-02 04:53:09 |
Author | HMML <hmml3939@gmai...> |
Commiter | HMML |
Show alert screen on first startup.
@@ -37,22 +37,29 @@ | ||
37 | 37 | android:orientation="vertical" |
38 | 38 | android:visibility="gone" > |
39 | 39 | |
40 | - <ProgressBar | |
41 | - android:id="@+id/progressBar" | |
42 | - style="?android:attr/progressBarStyle" | |
40 | + <LinearLayout | |
43 | 41 | android:layout_width="wrap_content" |
44 | 42 | android:layout_height="wrap_content" |
45 | - android:layout_centerVertical="true" | |
46 | - android:padding="16dp" /> | |
43 | + android:layout_centerInParent="true" > | |
44 | + | |
45 | + <ProgressBar | |
46 | + android:id="@+id/progressBar" | |
47 | + style="?android:attr/progressBarStyle" | |
48 | + android:layout_width="wrap_content" | |
49 | + android:layout_height="wrap_content" | |
50 | + android:layout_gravity="center_vertical" | |
51 | + android:padding="16dp" /> | |
52 | + | |
53 | + <TextView | |
54 | + android:layout_width="match_parent" | |
55 | + android:layout_height="wrap_content" | |
56 | + android:layout_gravity="center_vertical" | |
57 | + android:text="@string/download_progress" | |
58 | + android:textColor="@android:color/white" | |
59 | + android:textSize="24sp" /> | |
60 | + | |
61 | + </LinearLayout> | |
47 | 62 | |
48 | - <TextView | |
49 | - android:layout_width="match_parent" | |
50 | - android:layout_height="wrap_content" | |
51 | - android:layout_centerVertical="true" | |
52 | - android:layout_toRightOf="@id/progressBar" | |
53 | - android:text="@string/download_progress" | |
54 | - android:textColor="@android:color/white" | |
55 | - android:textSize="24sp" /> | |
56 | 63 | </RelativeLayout> |
57 | 64 | |
58 | 65 | </RelativeLayout> |
\ No newline at end of file |
@@ -4,8 +4,8 @@ | ||
4 | 4 | <string name="app_name">ナビボイスチェンジャー</string> |
5 | 5 | <string name="action_settings">設定</string> |
6 | 6 | <string name="hello_world">Hello world!</string> |
7 | - <string name="menu_install">音声データのインストール</string> | |
8 | - <string name="menu_download">音声データのダウンロード</string> | |
7 | + <string name="menu_install">音声のインストール</string> | |
8 | + <string name="menu_download">音声のダウンロード</string> | |
9 | 9 | <string name="menu_maint">メンテナンス</string> |
10 | 10 | <string name="title_activity_install_list">音声データのインストール</string> |
11 | 11 | <string name="err_broken_archive">音声データが壊れています。ダウンロードしなおしてください。</string> |
@@ -35,5 +35,10 @@ | ||
35 | 35 | <string name="err_no_sd">外部ストレージが見つかりません。SDカードをチェックするか、ストレージの設定を確認してください。</string> |
36 | 36 | <string name="err_no_sd_title">メディアエラー</string> |
37 | 37 | <string name="c_menu_download">ダウンロード</string> |
38 | + <string name="accept">わかった</string> | |
39 | + <string name="decline">断る!</string> | |
40 | + <string name="tos_title">おことわり</string> | |
41 | + <string name="tos">ダウンロードありがとうございます。すみませんが使うにあたり、以下に注意してください。\n\nこのアプリはマップと Android OS の現状の挙動に固定的に依存しています。それらは非公開のものであるため、将来の変更時にこのアプリは動作しなくなります。その場合の対応は全く保証できません。</string> | |
42 | + | |
38 | 43 | |
39 | 44 | </resources> |
\ No newline at end of file |
@@ -37,5 +37,9 @@ | ||
37 | 37 | <string name="err_no_sd">No external storage is detected. You need to check your SD card or storage setting.</string> |
38 | 38 | <string name="err_no_sd_title">Medium Error</string> |
39 | 39 | <string name="c_menu_download">Download</string> |
40 | + <string name="accept">Accept</string> | |
41 | + <string name="decline">Decline</string> | |
42 | + <string name="tos_title">Notice</string> | |
43 | + <string name="tos">Thank you for downloading! Please keep mind following terms;\n\nThis app is depends on CURRENT behavior of Maps and Android OS statically. These are closed and un-documented, then this app WILL STOP WORKING on future changes. In that case, I can NOT promise to contienu to support.</string> | |
40 | 44 | |
41 | 45 | </resources> |
@@ -45,7 +45,7 @@ public class Config { | ||
45 | 45 | } |
46 | 46 | } |
47 | 47 | |
48 | - public static Properties getProp(Context context) { | |
48 | + private static Properties getProp(Context context) { | |
49 | 49 | Properties prop = new Properties(); |
50 | 50 | File conf = getConfFile(context); |
51 | 51 | if (conf == null) return prop; |
@@ -59,7 +59,7 @@ public class Config { | ||
59 | 59 | return prop; |
60 | 60 | } |
61 | 61 | |
62 | - public static File getConfFile(Context context) { | |
62 | + private static File getConfFile(Context context) { | |
63 | 63 | File dir = context.getExternalFilesDir(null); |
64 | 64 | if (dir == null) return null; |
65 | 65 | if (!dir.exists()) dir.mkdirs(); |
@@ -1,8 +1,14 @@ | ||
1 | 1 | package jp.nekoteki.android.navivoicechanger; |
2 | 2 | |
3 | +import java.io.IOException; | |
4 | +import java.util.zip.ZipException; | |
5 | + | |
3 | 6 | import android.os.Bundle; |
4 | 7 | import android.app.Activity; |
8 | +import android.app.AlertDialog; | |
9 | +import android.content.DialogInterface; | |
5 | 10 | import android.content.Intent; |
11 | +import android.util.Log; | |
6 | 12 | import android.view.Menu; |
7 | 13 | import android.view.View; |
8 | 14 |
@@ -35,6 +41,27 @@ public class MainMenuActivity extends Activity { | ||
35 | 41 | |
36 | 42 | } |
37 | 43 | }); |
44 | + | |
45 | + String tos_agree = Config.get(getApplicationContext(), "tos_agree"); | |
46 | + if (tos_agree == null || !tos_agree.equals("1")) { | |
47 | + AlertDialog.Builder dialog = new AlertDialog.Builder(this); | |
48 | + dialog.setNegativeButton(R.string.decline, new DialogInterface.OnClickListener() { | |
49 | + @Override | |
50 | + public void onClick(DialogInterface dialog, int which) { | |
51 | + StaticUtils.terminateSelf(getApplicationContext()); | |
52 | + } | |
53 | + }); | |
54 | + dialog.setPositiveButton(R.string.accept, new DialogInterface.OnClickListener() { | |
55 | + @Override | |
56 | + public void onClick(DialogInterface arg0, int arg1) { | |
57 | + Config.set(getApplicationContext(), "tos_agree", "1"); | |
58 | + } | |
59 | + }); | |
60 | + dialog.setCancelable(false); | |
61 | + dialog.setTitle(R.string.tos_title); | |
62 | + dialog.setMessage(R.string.tos); | |
63 | + dialog.show(); | |
64 | + } | |
38 | 65 | } |
39 | 66 | |
40 | 67 | @Override |
@@ -28,6 +28,7 @@ public class MaintActivity extends Activity { | ||
28 | 28 | progress.setMessage("Purging files..."); |
29 | 29 | progress.show(); |
30 | 30 | VoiceData.purgeVoiceDataFromNavi(v.getContext()); |
31 | + StaticUtils.killMapsProcess(v.getContext()); | |
31 | 32 | progress.dismiss(); |
32 | 33 | Toast.makeText(v.getContext(), R.string.msg_installed_removed, Toast.LENGTH_SHORT).show(); |
33 | 34 | } |
@@ -15,16 +15,16 @@ import android.net.http.AndroidHttpClient; | ||
15 | 15 | import android.util.Log; |
16 | 16 | |
17 | 17 | public class RemoteVoiceData { |
18 | - protected int id; | |
19 | - protected String ini_url; | |
20 | - protected String archive_url; | |
21 | - protected String preview_url; | |
22 | - protected float rating; | |
23 | - protected String title; | |
24 | - protected String unit; | |
25 | - protected String author; | |
26 | - protected String description; | |
27 | - protected VoiceData voice_data; | |
18 | + private int id; | |
19 | + private String ini_url; | |
20 | + private String archive_url; | |
21 | + private String preview_url; | |
22 | + private float rating; | |
23 | + private String title; | |
24 | + private String unit; | |
25 | + private String author; | |
26 | + private String description; | |
27 | + private VoiceData voice_data; | |
28 | 28 | |
29 | 29 | public VoiceData getVoiceData() { |
30 | 30 | return voice_data; |
@@ -0,0 +1,26 @@ | ||
1 | +package jp.nekoteki.android.navivoicechanger; | |
2 | + | |
3 | +import android.app.Activity; | |
4 | +import android.app.ActivityManager; | |
5 | +import android.app.ActivityManager.RunningAppProcessInfo; | |
6 | +import android.content.Context; | |
7 | +import android.os.Process; | |
8 | +import android.util.Log; | |
9 | + | |
10 | +public class StaticUtils { | |
11 | + public static void killMapsProcess(Context context) { | |
12 | + Log.i("Utils", "Trying to kill Maps..."); | |
13 | + ActivityManager am = ((ActivityManager) context.getSystemService(Activity.ACTIVITY_SERVICE)); | |
14 | + am.killBackgroundProcesses("com.google.android.apps.maps"); | |
15 | + for (RunningAppProcessInfo pi: am.getRunningAppProcesses()) { | |
16 | + if (pi.processName != "com.google.android.apps.maps") | |
17 | + continue; | |
18 | + Log.d("Utils", "Killing pid="+Integer.toString(pi.pid)); | |
19 | + android.os.Process.killProcess(pi.pid); | |
20 | + } | |
21 | + } | |
22 | + | |
23 | + public static void terminateSelf(Context context) { | |
24 | + Process.killProcess(Process.myPid()); | |
25 | + } | |
26 | +} |
@@ -57,17 +57,17 @@ public class VoiceData { | ||
57 | 57 | public final static String ARCHIVE_FILENAME = "voice_instructions.zip"; |
58 | 58 | public static final String PREVIEW_FILESNAME = "preview.ogg"; |
59 | 59 | |
60 | - protected int id; | |
61 | - protected String title; | |
62 | - protected float rating; | |
63 | - protected String description; | |
64 | - protected String archive_md5; | |
65 | - protected String unit; | |
66 | - protected String lang; | |
67 | - protected String path; | |
68 | - protected int version; | |
69 | - protected String author; | |
70 | - protected Context context; | |
60 | + private int id; | |
61 | + private String title; | |
62 | + private float rating; | |
63 | + private String description; | |
64 | + private String archive_md5; | |
65 | + private String unit; | |
66 | + private String lang; | |
67 | + private String path; | |
68 | + private int version; | |
69 | + private String author; | |
70 | + private Context context; | |
71 | 71 | |
72 | 72 | static List<VoiceData> scanVoiceData(Context context) { |
73 | 73 | Log.d(VoiceData.class.getClass().getName(), "Start voice data dir scan."); |
@@ -445,15 +445,7 @@ public class VoiceData { | ||
445 | 445 | // ignore |
446 | 446 | } |
447 | 447 | |
448 | - ActivityManager am = ((ActivityManager) this.getContext().getSystemService(Activity.ACTIVITY_SERVICE)); | |
449 | - am.killBackgroundProcesses("com.google.android.apps.maps"); | |
450 | - for (RunningAppProcessInfo pi: am.getRunningAppProcesses()) { | |
451 | - if (pi.processName != "com.google.android.apps.maps") | |
452 | - continue; | |
453 | - android.os.Process.killProcess(pi.pid); | |
454 | - } | |
455 | - | |
456 | - | |
448 | + StaticUtils.killMapsProcess(this.getContext()); | |
457 | 449 | Log.i("VoiceData", "Install finished!"); |
458 | 450 | } |
459 | 451 |