mirror of
https://github.com/nicobo/dataprovence.git
synced 2026-04-10 16:06:23 +02:00
corrige utf-8
This commit is contained in:
parent
5a4774ff77
commit
99b951e5f6
1
bin/classes/Copy of RestaurantsGastronomiques.json
Normal file
1
bin/classes/Copy of RestaurantsGastronomiques.json
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
bin/classes/bma/groomservice/tts/Speaker.class
Normal file
BIN
bin/classes/bma/groomservice/tts/Speaker.class
Normal file
Binary file not shown.
Binary file not shown.
1
src/Copy of RestaurantsGastronomiques.json
Normal file
1
src/Copy of RestaurantsGastronomiques.json
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -38,6 +38,8 @@ public class Poi implements Parcelable, Comparable<Poi> {
|
||||||
/** Ex: "RD7" */
|
/** Ex: "RD7" */
|
||||||
public String voie;
|
public String voie;
|
||||||
|
|
||||||
|
public String theme;
|
||||||
|
|
||||||
public Poi() {
|
public Poi() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
@ -63,6 +65,7 @@ public class Poi implements Parcelable, Comparable<Poi> {
|
||||||
type = p.readString();
|
type = p.readString();
|
||||||
ville = p.readString();
|
ville = p.readString();
|
||||||
voie = p.readString();
|
voie = p.readString();
|
||||||
|
theme = p.readString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final Parcelable.Creator<Poi> CREATOR = new Parcelable.Creator<Poi>() {
|
public static final Parcelable.Creator<Poi> CREATOR = new Parcelable.Creator<Poi>() {
|
||||||
|
|
@ -98,6 +101,7 @@ public class Poi implements Parcelable, Comparable<Poi> {
|
||||||
p.writeString(type);
|
p.writeString(type);
|
||||||
p.writeString(ville);
|
p.writeString(ville);
|
||||||
p.writeString(voie);
|
p.writeString(voie);
|
||||||
|
p.writeString(theme);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ package bma.groomservice.data.dataprovence;
|
||||||
import java.io.BufferedInputStream;
|
import java.io.BufferedInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
import java.net.HttpURLConnection;
|
import java.net.HttpURLConnection;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
@ -17,6 +18,7 @@ import bma.groomservice.data.Poi;
|
||||||
import bma.groomservice.data.PoiList;
|
import bma.groomservice.data.PoiList;
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
|
import com.google.gson.stream.JsonReader;
|
||||||
|
|
||||||
public class DataprovenceHelper {
|
public class DataprovenceHelper {
|
||||||
|
|
||||||
|
|
@ -99,11 +101,12 @@ public class DataprovenceHelper {
|
||||||
*/
|
*/
|
||||||
protected PoiList getContent(InputStream is) throws IOException {
|
protected PoiList getContent(InputStream is) throws IOException {
|
||||||
|
|
||||||
String json = readStream(is);
|
// String json = readStream(is);
|
||||||
// logger.debug("json={}", json);
|
// logger.debug("json={}", json);
|
||||||
Gson gson = new Gson();
|
Gson gson = new Gson();
|
||||||
|
|
||||||
PoiList all = gson.fromJson(json, PoiList.class);
|
PoiList all = gson.fromJson(new JsonReader(new InputStreamReader(is,
|
||||||
|
"UTF-8")), PoiList.class);
|
||||||
return all;
|
return all;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
38
src/bma/groomservice/tts/Speaker.java
Normal file
38
src/bma/groomservice/tts/Speaker.java
Normal file
|
|
@ -0,0 +1,38 @@
|
||||||
|
package bma.groomservice.tts;
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.speech.tts.TextToSpeech;
|
||||||
|
import android.speech.tts.TextToSpeech.OnInitListener;
|
||||||
|
|
||||||
|
public class Speaker implements OnInitListener {
|
||||||
|
|
||||||
|
private static Logger logger = LoggerFactory.getLogger(Speaker.class);
|
||||||
|
public static final int MY_DATA_CHECK_CODE = 1;
|
||||||
|
|
||||||
|
Activity activity;
|
||||||
|
String sentence;
|
||||||
|
|
||||||
|
public Speaker(Activity activity) {
|
||||||
|
this.activity = activity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void say(String sentence) {
|
||||||
|
logger.debug("say");
|
||||||
|
this.sentence = sentence;
|
||||||
|
Intent checkIntent = new Intent();
|
||||||
|
checkIntent.setAction(TextToSpeech.Engine.ACTION_CHECK_TTS_DATA);
|
||||||
|
activity.startActivityForResult(checkIntent, MY_DATA_CHECK_CODE);
|
||||||
|
}
|
||||||
|
|
||||||
|
private TextToSpeech mTts;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onInit(int status) {
|
||||||
|
logger.debug("onInit({})", status);
|
||||||
|
mTts.speak(sentence, TextToSpeech.QUEUE_ADD, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue