• 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

Revisionf494f2b361899892c9e8e93112a826bb1b8b967b (tree)
Time2013-07-30 19:45:45
AuthorHMML <hmml3939@gmai...>
CommiterHMML

Log Message

Fix crush without SD, and show warning.

Change Summary

Incremental Difference

--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -35,5 +35,7 @@
3535 <string name="title_activity_download">DownloadActivity</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>
38+ <string name="err_no_sd">No external storage is detected. You need to check your SD card or storage setting.</string>
39+ <string name="err_no_sd_title">Medium Error</string>
3840
3941 </resources>
--- a/src/jp/nekoteki/android/navivoicechanger/DownloadActivity.java
+++ b/src/jp/nekoteki/android/navivoicechanger/DownloadActivity.java
@@ -3,7 +3,6 @@ package jp.nekoteki.android.navivoicechanger;
33 import java.io.IOException;
44 import java.io.InputStream;
55 import java.util.ArrayList;
6-import java.util.LinkedHashMap;
76 import java.util.List;
87
98 import net.arnx.jsonic.JSON;
@@ -24,10 +23,8 @@ import android.view.ViewGroup.LayoutParams;
2423 import android.widget.AbsListView.OnScrollListener;
2524 import android.widget.AbsListView;
2625 import android.widget.AdapterView;
27-import android.widget.AdapterViewFlipper;
2826 import android.widget.BaseAdapter;
2927 import android.widget.LinearLayout;
30-import android.widget.ListAdapter;
3128 import android.widget.ListView;
3229 import android.widget.RelativeLayout;
3330 import android.widget.TextView;
--- a/src/jp/nekoteki/android/navivoicechanger/VoiceData.java
+++ b/src/jp/nekoteki/android/navivoicechanger/VoiceData.java
@@ -4,7 +4,6 @@ import java.io.BufferedInputStream;
44 import java.io.File;
55 import java.io.FileFilter;
66 import java.io.FileInputStream;
7-import java.io.FileNotFoundException;
87 import java.io.FileOutputStream;
98 import java.io.IOException;
109 import java.io.InputStream;
@@ -21,6 +20,7 @@ import java.util.zip.ZipException;
2120 import android.media.MediaPlayer;
2221 import android.net.Uri;
2322 import android.util.Log;
23+import android.app.AlertDialog;
2424 import android.content.Context;
2525 import android.content.res.AssetManager;
2626
@@ -69,6 +69,7 @@ public class VoiceData {
6969 ArrayList<VoiceData> list = new ArrayList<VoiceData>();
7070
7171 File vdDir = getBaseDir(context);
72+ if (vdDir == null) return list;
7273 Log.d(VoiceData.class.getClass().getName(), "Voice Data Dir = "+vdDir.getAbsolutePath());
7374
7475 File[] vddlist = vdDir.listFiles();
@@ -94,6 +95,10 @@ public class VoiceData {
9495 File baseDir = context.getExternalFilesDir(null);
9596 if (baseDir == null) {
9697 Log.i("VoiceData", "Can't get external storage path.");
98+ AlertDialog.Builder builder = new AlertDialog.Builder(context);
99+ builder.setMessage(R.string.err_no_sd).setTitle(R.string.err_no_sd_title);
100+ AlertDialog dialog = builder.create();
101+ dialog.show();
97102 return null;
98103 }
99104 File vdDir = new File(baseDir, "voicedata");