Fix links for unknown accounts

This commit is contained in:
stom79 2018-09-15 09:10:47 +02:00
parent fcac0ca990
commit b72726a407
3 changed files with 9 additions and 1 deletions

View File

@ -825,7 +825,6 @@ public class Status implements Parcelable{
if (spannableStringT.toString().toLowerCase().contains(targetedAccount.toLowerCase())) {
//Accounts can be mentioned several times so we have to loop
for(int startPosition = -1 ; (startPosition = spannableStringT.toString().toLowerCase().indexOf(targetedAccount.toLowerCase(), startPosition + 1)) != -1 ; startPosition++){
int endPosition = startPosition + targetedAccount.length();
URLSpan[] spans = spannableStringT.getSpans(startPosition, endPosition, URLSpan.class);
for (URLSpan span : spans) {

View File

@ -26,6 +26,7 @@ import android.os.Bundle;
import android.support.v7.app.AlertDialog;
import android.support.v7.widget.RecyclerView;
import android.text.Html;
import android.widget.Toast;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
@ -201,9 +202,16 @@ public class CrossActions {
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
SQLiteDatabase db = Sqlite.getInstance(context, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
Account account = new AccountDAO(context, db).getAccountByID(userId);
new AsyncTask<Void, Void, Void>() {
private WeakReference<Context> contextReference = new WeakReference<>(context);
Results response;
@Override
protected void onPreExecute() {
Toast.makeText(contextReference.get(), R.string.retrieve_remote_account, Toast.LENGTH_SHORT).show();
}
@Override
protected Void doInBackground(Void... voids) {
API api = new API(contextReference.get(), account.getInstance(), account.getToken());

View File

@ -600,6 +600,7 @@
<string name="about_trunk">Who to follow</string>
<string name="about_trunk_action">Trunk API</string>
<string name="toast_impossible_to_follow">Account(s) can\'t be followed</string>
<string name="retrieve_remote_account">Fetching remote account</string>
<string-array translatable="false" name="proxy_type_choice">