読み上げ時にURL略を繰り返さないようにした
This commit is contained in:
parent
35aa48e1bc
commit
7d770b4e2e
|
@ -9,8 +9,8 @@ android {
|
||||||
applicationId "jp.juggler.subwaytooter"
|
applicationId "jp.juggler.subwaytooter"
|
||||||
minSdkVersion 21
|
minSdkVersion 21
|
||||||
targetSdkVersion 25
|
targetSdkVersion 25
|
||||||
versionCode 82
|
versionCode 83
|
||||||
versionName "0.8.2"
|
versionName "0.8.3"
|
||||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -211,6 +211,7 @@ class AppState {
|
||||||
String str_text = text.toString();
|
String str_text = text.toString();
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
int last_end = 0;
|
int last_end = 0;
|
||||||
|
boolean has_url = false;
|
||||||
for( MyClickableSpan span : span_list ){
|
for( MyClickableSpan span : span_list ){
|
||||||
int start = text.getSpanStart( span );
|
int start = text.getSpanStart( span );
|
||||||
int end = text.getSpanEnd( span );
|
int end = text.getSpanEnd( span );
|
||||||
|
@ -228,7 +229,8 @@ class AppState {
|
||||||
sb.append( span_text );
|
sb.append( span_text );
|
||||||
}else{
|
}else{
|
||||||
// それ以外はURL省略
|
// それ以外はURL省略
|
||||||
sb.append( context.getString( R.string.url_omitted ) );
|
has_url = true;
|
||||||
|
sb.append( " " );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -236,6 +238,9 @@ class AppState {
|
||||||
if( text_end > last_end ){
|
if( text_end > last_end ){
|
||||||
sb.append( str_text.substring( last_end, text_end ) );
|
sb.append( str_text.substring( last_end, text_end ) );
|
||||||
}
|
}
|
||||||
|
if( has_url){
|
||||||
|
sb.append( context.getString( R.string.url_omitted ) );
|
||||||
|
}
|
||||||
addSpeech( sb.toString() );
|
addSpeech( sb.toString() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue