Fix some issues
This commit is contained in:
parent
9db260572c
commit
6a4fc6fd85
|
@ -1,6 +1,3 @@
|
|||
Added:
|
||||
- Automatically add hashtag to messages when composing from a search
|
||||
|
||||
Fixed:
|
||||
- Some issues with content and URLs
|
||||
- Some crashes
|
||||
- Issue with not clickable URLs
|
||||
- Custom emoji in polls not displayed
|
|
@ -31,6 +31,7 @@ import app.fedilab.android.client.Entities.Peertube;
|
|||
import app.fedilab.android.client.Entities.RemoteInstance;
|
||||
import app.fedilab.android.client.Entities.Results;
|
||||
import app.fedilab.android.client.Entities.RetrieveFeedsParam;
|
||||
import app.fedilab.android.client.Entities.Status;
|
||||
import app.fedilab.android.client.GNUAPI;
|
||||
import app.fedilab.android.client.PeertubeAPI;
|
||||
import app.fedilab.android.helper.FilterToots;
|
||||
|
@ -372,6 +373,9 @@ public class RetrieveFeedsAsyncTask extends AsyncTask<Void, Void, Void> {
|
|||
app.fedilab.android.client.Entities.Status.fillSpan(contextReference, status);
|
||||
app.fedilab.android.client.Entities.Status.makeEmojiPoll(contextReference, status.getReblog() != null ? status.getReblog().getPoll() : status.getPoll());
|
||||
Account.makeAccountNameEmoji(contextReference, status.getReblog() != null ? status.getReblog().getAccount() : status.getAccount());
|
||||
if( status.getPoll() != null) {
|
||||
app.fedilab.android.client.Entities.Status.makeEmojiPoll(contextReference, status.getPoll());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
statuses = new ArrayList<>();
|
||||
|
|
|
@ -707,6 +707,18 @@ public class API {
|
|||
} else {
|
||||
poll.setVoters_count(resobj.getInt("votes_count"));
|
||||
}
|
||||
List<Emojis> emojiList = new ArrayList<>();
|
||||
try {
|
||||
JSONArray emojisPoll= resobj.getJSONArray("emojis");
|
||||
for (int j = 0; j < emojisPoll.length(); j++) {
|
||||
JSONObject emojisObj = emojisPoll.getJSONObject(j);
|
||||
Emojis emojis = parseEmojis(emojisObj);
|
||||
emojiList.add(emojis);
|
||||
}
|
||||
poll.setEmojis(emojiList);
|
||||
} catch (Exception e) {
|
||||
poll.setEmojis(new ArrayList<>());
|
||||
}
|
||||
poll.setVoted(resobj.getBoolean("voted"));
|
||||
JSONArray options = resobj.getJSONArray("options");
|
||||
List<PollOptions> pollOptions = new ArrayList<>();
|
||||
|
@ -738,7 +750,6 @@ public class API {
|
|||
* @param resobj JSONObject
|
||||
* @return Status
|
||||
*/
|
||||
@SuppressWarnings("InfiniteRecursion")
|
||||
public static Status parseStatuses(Context context, JSONObject resobj) {
|
||||
Status status = new Status();
|
||||
try {
|
||||
|
@ -1377,7 +1388,6 @@ public class API {
|
|||
* @param resobj JSONObject
|
||||
* @return Account
|
||||
*/
|
||||
@SuppressWarnings("InfiniteRecursion")
|
||||
private static Account parseAccountResponse(Context context, JSONObject resobj) {
|
||||
|
||||
Account account = new Account();
|
||||
|
@ -2443,9 +2453,9 @@ public class API {
|
|||
requestParams.put("locked", privacy == accountPrivacy.LOCKED ? "true" : "false");
|
||||
int i = 0;
|
||||
if (customFields != null && customFields.size() > 0) {
|
||||
Iterator it = customFields.entrySet().iterator();
|
||||
Iterator<Map.Entry<String, String>> it = customFields.entrySet().iterator();
|
||||
while (it.hasNext()) {
|
||||
Map.Entry pair = (Map.Entry) it.next();
|
||||
Map.Entry<String, String> pair = it.next();
|
||||
requestParams.put("fields_attributes[" + i + "][name]", (String) pair.getKey());
|
||||
requestParams.put("fields_attributes[" + i + "][value]", (String) pair.getValue());
|
||||
it.remove();
|
||||
|
|
|
@ -556,9 +556,9 @@ public class Status implements Parcelable {
|
|||
if (accountsMentionUnknown.size() > 0) {
|
||||
Iterator<Map.Entry<String, Account>> it = accountsMentionUnknown.entrySet().iterator();
|
||||
while (it.hasNext()) {
|
||||
Map.Entry<String, Account> pair = (Map.Entry<String, Account>) it.next();
|
||||
String key = (String) pair.getKey();
|
||||
Account account = (Account) pair.getValue();
|
||||
Map.Entry<String, Account> pair = it.next();
|
||||
String key = pair.getKey();
|
||||
Account account = pair.getValue();
|
||||
String targetedAccount = "@" + account.getAcct();
|
||||
if (spannableStringT.toString().toLowerCase().contains(targetedAccount.toLowerCase())) {
|
||||
|
||||
|
@ -607,14 +607,13 @@ public class Status implements Parcelable {
|
|||
Iterator<Map.Entry<String, String>> it = targetedURL.entrySet().iterator();
|
||||
int endPosition = 0;
|
||||
while (it.hasNext()) {
|
||||
Map.Entry<String, String> pair = (Map.Entry<String, String>) it.next();
|
||||
String key = ((String) pair.getKey()).split("\\|")[0];
|
||||
|
||||
String url = (String) pair.getValue();
|
||||
Map.Entry<String, String> pair = it.next();
|
||||
String key = (pair.getKey()).split("\\|")[0];
|
||||
String url = pair.getValue();
|
||||
if (spannableStringT.toString().toLowerCase().contains(key.toLowerCase())) {
|
||||
//Accounts can be mentioned several times so we have to loop
|
||||
int startPosition = spannableStringT.toString().toLowerCase().indexOf(key.toLowerCase(), endPosition);
|
||||
if (startPosition > 0) {
|
||||
if (startPosition >= 0) {
|
||||
endPosition = startPosition + key.length();
|
||||
if (key.contains("…") && !key.endsWith("…")) {
|
||||
key = key.split("…")[0] + "…";
|
||||
|
|
Loading…
Reference in New Issue