Fix IndexOutOfBoundsException with spannable text

This commit is contained in:
Chumva 2019-11-06 12:32:39 +02:00
parent e14baf1208
commit a82de99f08
27 changed files with 51 additions and 31 deletions

View file

@ -127,7 +127,7 @@
android:textColor="@color/app_bar_title_light"
android:textSize="@dimen/title_text_size"
app:typeface="@string/font_roboto_mono_bold"
tools:text="@string/sharing_enabled" />
tools:text="Sharing: Enabled" />
<ImageView
android:id="@+id/options_title"

View file

@ -65,7 +65,8 @@
<string name="sharing_in_background">Compartición en segundu planu</string>
<string name="go_to_settings">Dir a Axustes</string>
<string name="shared_string_later">Más sero</string>
<string name="sharing_enabled">Compartición: Activada</string>
<string name="location_sharing_status">Compartición: %1$s</string>
<string name="shared_string_enabled">Activada</string>
<string name="no_gps_connection">Nun hai conexón al GPS</string>
<string name="no_internet_connection">Nun hai conexón a internet</string>
<string name="add_device">Amestar un preséu</string>

View file

@ -31,7 +31,8 @@
<string name="re_send_location">Пераадправіць звесткі аб месцазнаходжанні</string>
<string name="last_available_location">Апошняе даступнае месца</string>
<string name="sharing_status">"Статус абмену "</string>
<string name="sharing_enabled">Абмен: Уключаны</string>
<string name="location_sharing_status">Абмен: %1$s</string>
<string name="shared_string_enabled">Уключаны</string>
<string name="shared_string_status">Статус</string>
<string name="no_gps_connection">Злучэнне з GPS адсутнічае</string>
<string name="no_internet_connection">Злучэнне з Інтэрнэтам адсутнічае</string>

View file

@ -103,7 +103,8 @@
<string name="re_send_location">Torna a enviar la ubicació</string>
<string name="last_available_location">Última ubicació disponible</string>
<string name="sharing_status">Estat de la compartició</string>
<string name="sharing_enabled">Compartició: activada</string>
<string name="location_sharing_status">Compartició: %1$s</string>
<string name="shared_string_enabled">activada</string>
<string name="shared_string_status">Estat</string>
<string name="no_gps_connection">No hi ha connexió GPS</string>
<string name="no_internet_connection">No hi ha connexió a internet</string>

View file

@ -11,7 +11,8 @@
<string name="re_send_location">Send placering igen</string>
<string name="last_available_location">Sidste tilgængelige placering</string>
<string name="sharing_status">Delingsstatus</string>
<string name="sharing_enabled">Deling: aktiveret</string>
<string name="location_sharing_status">Deling: %1$s</string>
<string name="shared_string_enabled">aktiveret</string>
<string name="shared_string_status">Status</string>
<string name="no_gps_connection">Ingen GPX-forbindelse</string>
<string name="no_internet_connection">Ingen internetforbindelse</string>

View file

@ -6,7 +6,8 @@
<string name="not_found_yet">Noch nicht gefunden</string>
<string name="re_send_location">Position neu senden</string>
<string name="sharing_status">Freigabestatus</string>
<string name="sharing_enabled">Teilen: Aktiviert</string>
<string name="location_sharing_status">Teilen: %1$s</string>
<string name="shared_string_enabled">Aktiviert</string>
<string name="shared_string_status">Status</string>
<string name="no_gps_connection">Kein GPS-Signal</string>
<string name="no_internet_connection">Keine Internetverbindung</string>

View file

@ -11,7 +11,8 @@
<string name="re_send_location">Reenviar ubicación</string>
<string name="last_available_location">Última ubicación disponible</string>
<string name="sharing_status">Estado de compartición</string>
<string name="sharing_enabled">Compartir: Activado</string>
<string name="location_sharing_status">Compartir: %1$s</string>
<string name="shared_string_enabled">Activado</string>
<string name="shared_string_status">Estado</string>
<string name="no_gps_connection">Sin conexión GPS</string>
<string name="no_internet_connection">Sin conexión a Internet</string>

View file

@ -11,7 +11,8 @@
<string name="re_send_location">Reenviar ubicación</string>
<string name="last_available_location">Última ubicación disponible</string>
<string name="sharing_status">Estado de compartición</string>
<string name="sharing_enabled">Compartir: Activado</string>
<string name="location_sharing_status">Compartir: %1$s</string>
<string name="shared_string_enabled">Activado</string>
<string name="shared_string_status">Estado</string>
<string name="no_gps_connection">Sin conexión GPS</string>
<string name="no_internet_connection">Sin conexión a Internet</string>

View file

@ -18,7 +18,6 @@
<string name="not_sent_yet">هنوز ارسال نشده</string>
<string name="not_found_yet">هنوز پیدا نشده</string>
<string name="re_send_location">بازفرستی موقعیت</string>
<string name="sharing_enabled">اشتراک‌گذاری: فعال</string>
<string name="shared_string_status">وضعیت</string>
<string name="shared_string_close">بستن</string>
<string name="shared_string_hide">نشان نده</string>

View file

@ -10,7 +10,8 @@
<string name="re_send_location">Voltar a enviar a ubicación</string>
<string name="last_available_location">Última ubicación dispoñíbel</string>
<string name="sharing_status">Estado do compartillamento</string>
<string name="sharing_enabled">Compartillar: Activado</string>
<string name="location_sharing_status">Compartillar: %1$s</string>
<string name="shared_string_enabled">Activado</string>
<string name="shared_string_status">Estado</string>
<string name="no_gps_connection">Sen unha conexión GPS</string>
<string name="no_internet_connection">Sen unha conexión á Internet</string>

View file

@ -35,7 +35,6 @@
<string name="re_send_location">שליחת המיקום מחדש</string>
<string name="last_available_location">המיקום האחרון הזמין</string>
<string name="sharing_status">מצב שיתוף</string>
<string name="sharing_enabled">שיתוף: פעיל</string>
<string name="shared_string_status">מצב</string>
<string name="no_gps_connection">אין חיבור ל־GPS</string>
<string name="no_internet_connection">אין חיבור לאינטרנט</string>

View file

@ -61,7 +61,8 @@
<string name="re_send_location">Tartózkodási hely elküldése újra</string>
<string name="last_available_location">Utolsó elérhető tartózkodási hely</string>
<string name="sharing_status">Megosztás állapota</string>
<string name="sharing_enabled">Megosztás: engedélyezve</string>
<string name="location_sharing_status">Megosztás: %1$s</string>
<string name="shared_string_enabled">engedélyezve</string>
<string name="shared_string_status">Állapot</string>
<string name="no_gps_connection">Nincs GPS-kapcsolat</string>
<string name="no_internet_connection">Nincs internetkapcsolat</string>

View file

@ -31,7 +31,8 @@
<string name="re_send_location">Invia nuovamente la posizione</string>
<string name="last_available_location">Ultima posizione disponibile</string>
<string name="sharing_status">Condivisione dello stato</string>
<string name="sharing_enabled">Condivisione: Attivata</string>
<string name="location_sharing_status">Condivisione: %1$s</string>
<string name="shared_string_enabled">Attivata</string>
<string name="shared_string_status">Stato</string>
<string name="no_gps_connection">Nessuna connessione GPS</string>
<string name="no_internet_connection">Nessuna connessione ad Internet</string>

View file

@ -11,7 +11,8 @@
<string name="re_send_location">Send posisjon på nytt</string>
<string name="last_available_location">Sist tilgjengelige posisjon</string>
<string name="sharing_status">Delingsstatus</string>
<string name="sharing_enabled">Deling: Påslått</string>
<string name="location_sharing_status">Deling: %1$s</string>
<string name="shared_string_enabled">Påslått</string>
<string name="shared_string_status">Status</string>
<string name="no_gps_connection">Ingen GPS-tilkobling</string>
<string name="no_internet_connection">Ingen internettilknytning</string>

View file

@ -67,7 +67,8 @@
<string name="re_send_location">Herzend locatie</string>
<string name="last_available_location">Laatst beschikbare locatie</string>
<string name="sharing_status">Delen status</string>
<string name="sharing_enabled">Delen: Ingeschakeld</string>
<string name="location_sharing_status">Delen: %1$s</string>
<string name="shared_string_enabled">Ingeschakeld</string>
<string name="shared_string_status">Status</string>
<string name="no_gps_connection">Geen GPS verbinding</string>
<string name="no_internet_connection">Geen internet verbinding</string>

View file

@ -101,7 +101,8 @@
<string name="re_send_location">Tornar enviar lo posicion</string>
<string name="last_available_location">Darriera posicion disponibla</string>
<string name="sharing_status">Estat dau partatge</string>
<string name="sharing_enabled">Partatge: activat</string>
<string name="location_sharing_status">Partatge: %1$s</string>
<string name="shared_string_enabled">activat</string>
<string name="shared_string_status">Estat</string>
<string name="no_gps_connection">Ges de connexion GPS</string>
<string name="no_internet_connection">Ges de connexion a l\'Internet</string>

View file

@ -11,7 +11,8 @@
<string name="re_send_location">Wyślij ponownie lokalizację</string>
<string name="last_available_location">Ostatnia dostępna lokalizacja</string>
<string name="sharing_status">Status udostępniania</string>
<string name="sharing_enabled">Udostępnianie: Włączone</string>
<string name="location_sharing_status">Udostępnianie: %1$s</string>
<string name="shared_string_enabled">Włączone</string>
<string name="shared_string_status">Status</string>
<string name="no_gps_connection">Brak połączenia GPS</string>
<string name="no_internet_connection">Brak połączenia z internetem</string>

View file

@ -36,7 +36,8 @@
<string name="re_send_location">Reenvie o local</string>
<string name="last_available_location">Última localização disponível</string>
<string name="sharing_status">Status de compartilhamento</string>
<string name="sharing_enabled">Compartilhamento: Ativado</string>
<string name="location_sharing_status">Compartilhamento: %1$s</string>
<string name="shared_string_enabled">Ativado</string>
<string name="shared_string_status">Status</string>
<string name="no_gps_connection">Sem conexão GPS</string>
<string name="no_internet_connection">Sem conexão com a internet</string>

View file

@ -165,7 +165,8 @@
<string name="logout_from_osmand_telegram_descr">Tem certeza de que deseja sair do OsmAnd Tracker para que você não possa compartilhar o local ou ver a localização de outras pessoas\?</string>
<string name="proxy_server">Servidor</string>
<string name="si_m_s">Metros por segundo</string>
<string name="sharing_enabled">Compartilhamento: Ativado</string>
<string name="location_sharing_status">Compartilhamento: %1$s</string>
<string name="shared_string_enabled">Ativado</string>
<string name="by_name">Por nome</string>
<string name="gps_and_location">Posição</string>
<string name="last_response">Última resposta</string>

View file

@ -109,7 +109,8 @@
<string name="re_send_location">Reenvie o local</string>
<string name="last_available_location">Última localização disponível</string>
<string name="sharing_status">Status de compartilhamento</string>
<string name="sharing_enabled">Compartilhamento: Ativado</string>
<string name="location_sharing_status">Compartilhamento: %1$s</string>
<string name="shared_string_enabled">Ativado</string>
<string name="no_gps_connection">Sem conexão GPS</string>
<string name="no_internet_connection">Sem conexão com a internet</string>
<string name="shared_string_disable">Desativar</string>

View file

@ -138,7 +138,8 @@
<string name="re_send_location">Отправить местоположение</string>
<string name="last_available_location">Последнее местоположение</string>
<string name="sharing_status">Статус отправки</string>
<string name="sharing_enabled">Трансляция: включена</string>
<string name="location_sharing_status">Трансляция: %1$s</string>
<string name="shared_string_enabled">включена</string>
<string name="shared_string_status">Статус</string>
<string name="no_gps_connection">Отсутствует GPS</string>
<string name="no_internet_connection">Отсутствует интернет</string>

View file

@ -67,7 +67,8 @@
<string name="re_send_location">Torra a imbiare sa positzione</string>
<string name="last_available_location">Ùrtima positzione disponìbile</string>
<string name="sharing_status">Istadu de cumpartzidura</string>
<string name="sharing_enabled">Cumpartzidura: Abilitada</string>
<string name="location_sharing_status">Cumpartzidura: %1$s</string>
<string name="shared_string_enabled">Abilitada</string>
<string name="no_gps_connection">Peruna connessione GPS</string>
<string name="no_internet_connection">Peruna connessione a ìnternet</string>
<string name="add_device">Annanghe unu dispositivu</string>

View file

@ -25,7 +25,8 @@
<string name="re_send_location">Ponovno pošiljanje trenutnega mesta</string>
<string name="last_available_location">Zadnje določeno mesto</string>
<string name="sharing_status">Objavljanje stanja</string>
<string name="sharing_enabled">Objavljanje: omogočeno</string>
<string name="location_sharing_status">Objavljanje: %1$s</string>
<string name="shared_string_enabled">omogočeno</string>
<string name="shared_string_status">Stanje</string>
<string name="no_gps_connection">Ni povezave z GPS</string>
<string name="no_internet_connection">Ni vzpostavljene internetne povezave</string>

View file

@ -30,7 +30,8 @@
<string name="re_send_location">Повторно надіслати позицію</string>
<string name="last_available_location">Крайнє доступне позиціювання</string>
<string name="sharing_status">Стан трансляції</string>
<string name="sharing_enabled">Трансляція: Увімкнута</string>
<string name="location_sharing_status">Трансляція: %1$s</string>
<string name="shared_string_enabled">Увімкнута</string>
<string name="shared_string_status">Статус</string>
<string name="no_gps_connection">Немає зʼєднання із GPS</string>
<string name="no_internet_connection">Немає зʼєднання із інтернетом</string>

View file

@ -27,7 +27,6 @@
<string name="re_send_location">重新傳送位置</string>
<string name="last_available_location">最後可用的位置</string>
<string name="sharing_status">分享狀態</string>
<string name="sharing_enabled">分享:已啟用</string>
<string name="shared_string_status">狀態</string>
<string name="no_gps_connection">沒有 GPS 連接</string>
<string name="no_internet_connection">沒有網際網路連線</string>

View file

@ -107,7 +107,8 @@
<string name="re_send_location">Re-send location</string>
<string name="last_available_location">Last available location</string>
<string name="sharing_status">Sharing status</string>
<string name="sharing_enabled">Sharing: Enabled</string>
<string name="location_sharing_status">Sharing: %1$s</string>
<string name="shared_string_enabled">Enabled</string>
<string name="shared_string_status">Status</string>
<string name="no_gps_connection">No GPS connection</string>
<string name="no_internet_connection">No internet connection</string>

View file

@ -150,12 +150,13 @@ class MyLocationTabFragment : Fragment(), TelegramListener {
}
mainView.findViewById<TextView>(R.id.status_title).apply {
val sharingStatus = getString(R.string.sharing_enabled)
val enabled = getString(R.string.shared_string_enabled)
val sharingStatus = getString(R.string.location_sharing_status, enabled)
val spannable = SpannableString(sharingStatus)
spannable.setSpan(
ForegroundColorSpan(app.uiUtils.getActiveColor()),
sharingStatus.indexOf(" "), sharingStatus.length, 0
)
val start = sharingStatus.indexOf(enabled)
if (start != -1) {
spannable.setSpan(ForegroundColorSpan(app.uiUtils.getActiveColor()), start, start + enabled.length, 0)
}
text = spannable
}