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:
|
Fixed:
|
||||||
- Some issues with content and URLs
|
- Issue with not clickable URLs
|
||||||
- Some crashes
|
- 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.RemoteInstance;
|
||||||
import app.fedilab.android.client.Entities.Results;
|
import app.fedilab.android.client.Entities.Results;
|
||||||
import app.fedilab.android.client.Entities.RetrieveFeedsParam;
|
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.GNUAPI;
|
||||||
import app.fedilab.android.client.PeertubeAPI;
|
import app.fedilab.android.client.PeertubeAPI;
|
||||||
import app.fedilab.android.helper.FilterToots;
|
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.fillSpan(contextReference, status);
|
||||||
app.fedilab.android.client.Entities.Status.makeEmojiPoll(contextReference, status.getReblog() != null ? status.getReblog().getPoll() : status.getPoll());
|
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());
|
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 {
|
} else {
|
||||||
statuses = new ArrayList<>();
|
statuses = new ArrayList<>();
|
||||||
|
|
|
@ -707,6 +707,18 @@ public class API {
|
||||||
} else {
|
} else {
|
||||||
poll.setVoters_count(resobj.getInt("votes_count"));
|
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"));
|
poll.setVoted(resobj.getBoolean("voted"));
|
||||||
JSONArray options = resobj.getJSONArray("options");
|
JSONArray options = resobj.getJSONArray("options");
|
||||||
List<PollOptions> pollOptions = new ArrayList<>();
|
List<PollOptions> pollOptions = new ArrayList<>();
|
||||||
|
@ -738,7 +750,6 @@ public class API {
|
||||||
* @param resobj JSONObject
|
* @param resobj JSONObject
|
||||||
* @return Status
|
* @return Status
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("InfiniteRecursion")
|
|
||||||
public static Status parseStatuses(Context context, JSONObject resobj) {
|
public static Status parseStatuses(Context context, JSONObject resobj) {
|
||||||
Status status = new Status();
|
Status status = new Status();
|
||||||
try {
|
try {
|
||||||
|
@ -1377,7 +1388,6 @@ public class API {
|
||||||
* @param resobj JSONObject
|
* @param resobj JSONObject
|
||||||
* @return Account
|
* @return Account
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("InfiniteRecursion")
|
|
||||||
private static Account parseAccountResponse(Context context, JSONObject resobj) {
|
private static Account parseAccountResponse(Context context, JSONObject resobj) {
|
||||||
|
|
||||||
Account account = new Account();
|
Account account = new Account();
|
||||||
|
@ -2443,9 +2453,9 @@ public class API {
|
||||||
requestParams.put("locked", privacy == accountPrivacy.LOCKED ? "true" : "false");
|
requestParams.put("locked", privacy == accountPrivacy.LOCKED ? "true" : "false");
|
||||||
int i = 0;
|
int i = 0;
|
||||||
if (customFields != null && customFields.size() > 0) {
|
if (customFields != null && customFields.size() > 0) {
|
||||||
Iterator it = customFields.entrySet().iterator();
|
Iterator<Map.Entry<String, String>> it = customFields.entrySet().iterator();
|
||||||
while (it.hasNext()) {
|
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 + "][name]", (String) pair.getKey());
|
||||||
requestParams.put("fields_attributes[" + i + "][value]", (String) pair.getValue());
|
requestParams.put("fields_attributes[" + i + "][value]", (String) pair.getValue());
|
||||||
it.remove();
|
it.remove();
|
||||||
|
|
|
@ -556,9 +556,9 @@ public class Status implements Parcelable {
|
||||||
if (accountsMentionUnknown.size() > 0) {
|
if (accountsMentionUnknown.size() > 0) {
|
||||||
Iterator<Map.Entry<String, Account>> it = accountsMentionUnknown.entrySet().iterator();
|
Iterator<Map.Entry<String, Account>> it = accountsMentionUnknown.entrySet().iterator();
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
Map.Entry<String, Account> pair = (Map.Entry<String, Account>) it.next();
|
Map.Entry<String, Account> pair = it.next();
|
||||||
String key = (String) pair.getKey();
|
String key = pair.getKey();
|
||||||
Account account = (Account) pair.getValue();
|
Account account = pair.getValue();
|
||||||
String targetedAccount = "@" + account.getAcct();
|
String targetedAccount = "@" + account.getAcct();
|
||||||
if (spannableStringT.toString().toLowerCase().contains(targetedAccount.toLowerCase())) {
|
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();
|
Iterator<Map.Entry<String, String>> it = targetedURL.entrySet().iterator();
|
||||||
int endPosition = 0;
|
int endPosition = 0;
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
Map.Entry<String, String> pair = (Map.Entry<String, String>) it.next();
|
Map.Entry<String, String> pair = it.next();
|
||||||
String key = ((String) pair.getKey()).split("\\|")[0];
|
String key = (pair.getKey()).split("\\|")[0];
|
||||||
|
String url = pair.getValue();
|
||||||
String url = (String) pair.getValue();
|
|
||||||
if (spannableStringT.toString().toLowerCase().contains(key.toLowerCase())) {
|
if (spannableStringT.toString().toLowerCase().contains(key.toLowerCase())) {
|
||||||
//Accounts can be mentioned several times so we have to loop
|
//Accounts can be mentioned several times so we have to loop
|
||||||
int startPosition = spannableStringT.toString().toLowerCase().indexOf(key.toLowerCase(), endPosition);
|
int startPosition = spannableStringT.toString().toLowerCase().indexOf(key.toLowerCase(), endPosition);
|
||||||
if (startPosition > 0) {
|
if (startPosition >= 0) {
|
||||||
endPosition = startPosition + key.length();
|
endPosition = startPosition + key.length();
|
||||||
if (key.contains("…") && !key.endsWith("…")) {
|
if (key.contains("…") && !key.endsWith("…")) {
|
||||||
key = key.split("…")[0] + "…";
|
key = key.split("…")[0] + "…";
|
||||||
|
|
Loading…
Reference in New Issue