Some changes
This commit is contained in:
parent
49d1a21b42
commit
caa619fb90
|
@ -1,2 +1,5 @@
|
||||||
|
Changed:
|
||||||
|
- Max char with media descriptions increased to 1500
|
||||||
|
|
||||||
Fixed:
|
Fixed:
|
||||||
- Some issue with custom emoji
|
- Some issue with custom emoji
|
|
@ -175,7 +175,7 @@ public class OwnerChartsActivity extends BaseActivity implements OnRetrieveChart
|
||||||
dateEnd = new StatusCacheDAO(OwnerChartsActivity.this, db).getGreaterDate(StatusCacheDAO.ARCHIVE_CACHE);
|
dateEnd = new StatusCacheDAO(OwnerChartsActivity.this, db).getGreaterDate(StatusCacheDAO.ARCHIVE_CACHE);
|
||||||
|
|
||||||
|
|
||||||
if( dateIni == null){
|
if (dateIni == null) {
|
||||||
dateIni = new Date();
|
dateIni = new Date();
|
||||||
dateEnd = new Date();
|
dateEnd = new Date();
|
||||||
}
|
}
|
||||||
|
@ -417,7 +417,7 @@ public class OwnerChartsActivity extends BaseActivity implements OnRetrieveChart
|
||||||
@Override
|
@Override
|
||||||
public MPPointF getOffset() {
|
public MPPointF getOffset() {
|
||||||
if (mOffset == null) {
|
if (mOffset == null) {
|
||||||
mOffset = new MPPointF(-((float)getWidth() / 2), -getHeight());
|
mOffset = new MPPointF(-((float) getWidth() / 2), -getHeight());
|
||||||
}
|
}
|
||||||
return mOffset;
|
return mOffset;
|
||||||
}
|
}
|
||||||
|
|
|
@ -504,7 +504,7 @@ public class OwnerNotificationChartsActivity extends BaseActivity implements OnR
|
||||||
@Override
|
@Override
|
||||||
public MPPointF getOffset() {
|
public MPPointF getOffset() {
|
||||||
if (mOffset == null) {
|
if (mOffset == null) {
|
||||||
mOffset = new MPPointF(-((float)getWidth() / 2), -getHeight());
|
mOffset = new MPPointF(-((float) getWidth() / 2), -getHeight());
|
||||||
}
|
}
|
||||||
return mOffset;
|
return mOffset;
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,7 +67,6 @@ import app.fedilab.android.asynctasks.RetrieveFeedsAsyncTask;
|
||||||
import app.fedilab.android.asynctasks.RetrieveStatsAsyncTask;
|
import app.fedilab.android.asynctasks.RetrieveStatsAsyncTask;
|
||||||
import app.fedilab.android.client.APIResponse;
|
import app.fedilab.android.client.APIResponse;
|
||||||
import app.fedilab.android.client.Entities.Account;
|
import app.fedilab.android.client.Entities.Account;
|
||||||
import app.fedilab.android.client.Entities.Instance;
|
|
||||||
import app.fedilab.android.client.Entities.Statistics;
|
import app.fedilab.android.client.Entities.Statistics;
|
||||||
import app.fedilab.android.client.Entities.Status;
|
import app.fedilab.android.client.Entities.Status;
|
||||||
import app.fedilab.android.client.Entities.StatusDrawerParams;
|
import app.fedilab.android.client.Entities.StatusDrawerParams;
|
||||||
|
|
|
@ -92,13 +92,13 @@ public class SlideMediaActivity extends BaseFragmentActivity implements OnDownlo
|
||||||
Intent shareIntent = new Intent(Intent.ACTION_SEND);
|
Intent shareIntent = new Intent(Intent.ACTION_SEND);
|
||||||
shareIntent.putExtra(Intent.EXTRA_STREAM, uri);
|
shareIntent.putExtra(Intent.EXTRA_STREAM, uri);
|
||||||
ContentResolver cR = context.getContentResolver();
|
ContentResolver cR = context.getContentResolver();
|
||||||
if( cR != null && uri != null) {
|
if (cR != null && uri != null) {
|
||||||
shareIntent.setType(cR.getType(uri));
|
shareIntent.setType(cR.getType(uri));
|
||||||
try {
|
try {
|
||||||
startActivity(shareIntent);
|
startActivity(shareIntent);
|
||||||
} catch (Exception ignored) {
|
} catch (Exception ignored) {
|
||||||
}
|
}
|
||||||
}else {
|
} else {
|
||||||
Toasty.error(context, context.getString(R.string.toast_error), Toasty.LENGTH_LONG).show();
|
Toasty.error(context, context.getString(R.string.toast_error), Toasty.LENGTH_LONG).show();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -2360,7 +2360,7 @@ public class TootActivity extends BaseActivity implements UploadStatusDelegate,
|
||||||
|
|
||||||
//Text for report
|
//Text for report
|
||||||
final EditText input = popup_media_description.findViewById(R.id.media_description);
|
final EditText input = popup_media_description.findViewById(R.id.media_description);
|
||||||
input.setFilters(new InputFilter[]{new InputFilter.LengthFilter(420)});
|
input.setFilters(new InputFilter[]{new InputFilter.LengthFilter(1500)});
|
||||||
final ImageView media_picture = popup_media_description.findViewById(R.id.media_picture);
|
final ImageView media_picture = popup_media_description.findViewById(R.id.media_picture);
|
||||||
Glide.with(TootActivity.this)
|
Glide.with(TootActivity.this)
|
||||||
.asBitmap()
|
.asBitmap()
|
||||||
|
@ -3236,7 +3236,7 @@ public class TootActivity extends BaseActivity implements UploadStatusDelegate,
|
||||||
toot_cw_content.setText("");
|
toot_cw_content.setText("");
|
||||||
toot_cw_content.setVisibility(View.GONE);
|
toot_cw_content.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
if( status.getVisibility() == null) {
|
if (status.getVisibility() == null) {
|
||||||
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
|
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
|
||||||
String defaultVisibility = account.isLocked() ? "private" : "public";
|
String defaultVisibility = account.isLocked() ? "private" : "public";
|
||||||
String settingsVisibility = sharedpreferences.getString(Helper.SET_TOOT_VISIBILITY + "@" + account.getAcct() + "@" + account.getInstance(), defaultVisibility);
|
String settingsVisibility = sharedpreferences.getString(Helper.SET_TOOT_VISIBILITY + "@" + account.getAcct() + "@" + account.getInstance(), defaultVisibility);
|
||||||
|
|
|
@ -709,7 +709,7 @@ public class API {
|
||||||
}
|
}
|
||||||
List<Emojis> emojiList = new ArrayList<>();
|
List<Emojis> emojiList = new ArrayList<>();
|
||||||
try {
|
try {
|
||||||
JSONArray emojisPoll= resobj.getJSONArray("emojis");
|
JSONArray emojisPoll = resobj.getJSONArray("emojis");
|
||||||
for (int j = 0; j < emojisPoll.length(); j++) {
|
for (int j = 0; j < emojisPoll.length(); j++) {
|
||||||
JSONObject emojisObj = emojisPoll.getJSONObject(j);
|
JSONObject emojisObj = emojisPoll.getJSONObject(j);
|
||||||
Emojis emojis = parseEmojis(emojisObj);
|
Emojis emojis = parseEmojis(emojisObj);
|
||||||
|
@ -1452,7 +1452,7 @@ public class API {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if( resobj.has("fields") && resobj.get("fields") instanceof JSONArray) {
|
if (resobj.has("fields") && resobj.get("fields") instanceof JSONArray) {
|
||||||
JSONArray fields = resobj.getJSONArray("fields");
|
JSONArray fields = resobj.getJSONArray("fields");
|
||||||
LinkedHashMap<String, String> fieldsMap = new LinkedHashMap<>();
|
LinkedHashMap<String, String> fieldsMap = new LinkedHashMap<>();
|
||||||
LinkedHashMap<String, Boolean> fieldsMapVerified = new LinkedHashMap<>();
|
LinkedHashMap<String, Boolean> fieldsMapVerified = new LinkedHashMap<>();
|
||||||
|
@ -2452,8 +2452,8 @@ public class API {
|
||||||
Iterator<Map.Entry<String, String>> it = customFields.entrySet().iterator();
|
Iterator<Map.Entry<String, String>> it = customFields.entrySet().iterator();
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
Map.Entry<String, String> pair = it.next();
|
Map.Entry<String, String> pair = it.next();
|
||||||
requestParams.put("fields_attributes[" + i + "][name]", (String) pair.getKey());
|
requestParams.put("fields_attributes[" + i + "][name]", pair.getKey());
|
||||||
requestParams.put("fields_attributes[" + i + "][value]", (String) pair.getValue());
|
requestParams.put("fields_attributes[" + i + "][value]", pair.getValue());
|
||||||
it.remove();
|
it.remove();
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,6 @@ import com.bumptech.glide.request.transition.Transition;
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.lang.ref.WeakReference;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
|
|
@ -74,7 +74,7 @@ public class PollOptions implements Parcelable {
|
||||||
}
|
}
|
||||||
|
|
||||||
public SpannableString getTitleSpan() {
|
public SpannableString getTitleSpan() {
|
||||||
if( titleSpan == null) {
|
if (titleSpan == null) {
|
||||||
titleSpan = new SpannableString(title);
|
titleSpan = new SpannableString(title);
|
||||||
}
|
}
|
||||||
return titleSpan;
|
return titleSpan;
|
||||||
|
|
|
@ -52,11 +52,7 @@ import androidx.core.content.ContextCompat;
|
||||||
import androidx.preference.PreferenceManager;
|
import androidx.preference.PreferenceManager;
|
||||||
|
|
||||||
import com.bumptech.glide.Glide;
|
import com.bumptech.glide.Glide;
|
||||||
import com.bumptech.glide.load.DataSource;
|
|
||||||
import com.bumptech.glide.load.engine.GlideException;
|
|
||||||
import com.bumptech.glide.request.RequestListener;
|
|
||||||
import com.bumptech.glide.request.target.CustomTarget;
|
import com.bumptech.glide.request.target.CustomTarget;
|
||||||
import com.bumptech.glide.request.target.Target;
|
|
||||||
import com.bumptech.glide.request.transition.Transition;
|
import com.bumptech.glide.request.transition.Transition;
|
||||||
|
|
||||||
import java.lang.ref.WeakReference;
|
import java.lang.ref.WeakReference;
|
||||||
|
@ -88,7 +84,6 @@ import app.fedilab.android.helper.CustomQuoteSpan;
|
||||||
import app.fedilab.android.helper.Helper;
|
import app.fedilab.android.helper.Helper;
|
||||||
import app.fedilab.android.helper.LongClickableSpan;
|
import app.fedilab.android.helper.LongClickableSpan;
|
||||||
import app.fedilab.android.helper.ThemeHelper;
|
import app.fedilab.android.helper.ThemeHelper;
|
||||||
import app.fedilab.android.interfaces.OnRetrieveEmojiInterface;
|
|
||||||
import es.dmoral.toasty.Toasty;
|
import es.dmoral.toasty.Toasty;
|
||||||
|
|
||||||
import static android.content.Context.MODE_PRIVATE;
|
import static android.content.Context.MODE_PRIVATE;
|
||||||
|
@ -556,7 +551,7 @@ public class Status implements Parcelable {
|
||||||
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 = it.next();
|
Map.Entry<String, Account> pair = it.next();
|
||||||
String key = pair.getKey();
|
String key = pair.getKey();
|
||||||
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())) {
|
||||||
|
@ -947,7 +942,6 @@ public class Status implements Parcelable {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private static void replaceQuoteSpans(Context context, Spannable spannable) {
|
private static void replaceQuoteSpans(Context context, Spannable spannable) {
|
||||||
QuoteSpan[] quoteSpans = spannable.getSpans(0, spannable.length(), QuoteSpan.class);
|
QuoteSpan[] quoteSpans = spannable.getSpans(0, spannable.length(), QuoteSpan.class);
|
||||||
for (QuoteSpan quoteSpan : quoteSpans) {
|
for (QuoteSpan quoteSpan : quoteSpans) {
|
||||||
|
|
|
@ -147,10 +147,10 @@ public class HttpsConnection {
|
||||||
|
|
||||||
Map<String, Object> params = new LinkedHashMap<>();
|
Map<String, Object> params = new LinkedHashMap<>();
|
||||||
if (paramaters != null) {
|
if (paramaters != null) {
|
||||||
Iterator it = paramaters.entrySet().iterator();
|
Iterator<Map.Entry<String, String>> it = paramaters.entrySet().iterator();
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
Map.Entry pair = (Map.Entry) it.next();
|
Map.Entry<String, String> pair = it.next();
|
||||||
params.put(pair.getKey().toString(), pair.getValue());
|
params.put(pair.getKey(), pair.getValue());
|
||||||
it.remove();
|
it.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -362,25 +362,25 @@ public class HttpsConnection {
|
||||||
|
|
||||||
|
|
||||||
public String post(String urlConnection, int timeout, HashMap<String, String> paramaters, String token) throws IOException, NoSuchAlgorithmException, KeyManagementException, HttpsConnectionException {
|
public String post(String urlConnection, int timeout, HashMap<String, String> paramaters, String token) throws IOException, NoSuchAlgorithmException, KeyManagementException, HttpsConnectionException {
|
||||||
|
URL url = new URL(urlConnection);
|
||||||
|
Map<String, Object> params = new LinkedHashMap<>();
|
||||||
|
if (paramaters != null) {
|
||||||
|
Iterator<Map.Entry<String, String>> it = paramaters.entrySet().iterator();
|
||||||
|
while (it.hasNext()) {
|
||||||
|
Map.Entry<String, String> pair = it.next();
|
||||||
|
params.put(pair.getKey(), pair.getValue());
|
||||||
|
it.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
StringBuilder postData = new StringBuilder();
|
||||||
|
for (Map.Entry<String, Object> param : params.entrySet()) {
|
||||||
|
if (postData.length() != 0) postData.append('&');
|
||||||
|
postData.append(param.getKey());
|
||||||
|
postData.append('=');
|
||||||
|
postData.append(param.getValue());
|
||||||
|
}
|
||||||
|
byte[] postDataBytes = postData.toString().getBytes(StandardCharsets.UTF_8);
|
||||||
if (urlConnection.startsWith("https://")) {
|
if (urlConnection.startsWith("https://")) {
|
||||||
URL url = new URL(urlConnection);
|
|
||||||
Map<String, Object> params = new LinkedHashMap<>();
|
|
||||||
if (paramaters != null) {
|
|
||||||
Iterator it = paramaters.entrySet().iterator();
|
|
||||||
while (it.hasNext()) {
|
|
||||||
Map.Entry pair = (Map.Entry) it.next();
|
|
||||||
params.put(pair.getKey().toString(), pair.getValue());
|
|
||||||
it.remove();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
StringBuilder postData = new StringBuilder();
|
|
||||||
for (Map.Entry<String, Object> param : params.entrySet()) {
|
|
||||||
if (postData.length() != 0) postData.append('&');
|
|
||||||
postData.append(param.getKey());
|
|
||||||
postData.append('=');
|
|
||||||
postData.append(param.getValue());
|
|
||||||
}
|
|
||||||
byte[] postDataBytes = postData.toString().getBytes(StandardCharsets.UTF_8);
|
|
||||||
if (proxy != null)
|
if (proxy != null)
|
||||||
httpsURLConnection = (HttpsURLConnection) url.openConnection(proxy);
|
httpsURLConnection = (HttpsURLConnection) url.openConnection(proxy);
|
||||||
else
|
else
|
||||||
|
@ -429,25 +429,6 @@ public class HttpsConnection {
|
||||||
httpsURLConnection.getInputStream().close();
|
httpsURLConnection.getInputStream().close();
|
||||||
return response;
|
return response;
|
||||||
} else {
|
} else {
|
||||||
URL url = new URL(urlConnection);
|
|
||||||
Map<String, Object> params = new LinkedHashMap<>();
|
|
||||||
if (paramaters != null) {
|
|
||||||
Iterator it = paramaters.entrySet().iterator();
|
|
||||||
while (it.hasNext()) {
|
|
||||||
Map.Entry pair = (Map.Entry) it.next();
|
|
||||||
params.put(pair.getKey().toString(), pair.getValue());
|
|
||||||
it.remove();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
StringBuilder postData = new StringBuilder();
|
|
||||||
for (Map.Entry<String, Object> param : params.entrySet()) {
|
|
||||||
if (postData.length() != 0) postData.append('&');
|
|
||||||
postData.append(param.getKey());
|
|
||||||
postData.append('=');
|
|
||||||
postData.append(param.getValue());
|
|
||||||
}
|
|
||||||
byte[] postDataBytes = postData.toString().getBytes(StandardCharsets.UTF_8);
|
|
||||||
|
|
||||||
if (proxy != null)
|
if (proxy != null)
|
||||||
httpURLConnection = (HttpURLConnection) url.openConnection(proxy);
|
httpURLConnection = (HttpURLConnection) url.openConnection(proxy);
|
||||||
else
|
else
|
||||||
|
@ -499,10 +480,12 @@ public class HttpsConnection {
|
||||||
|
|
||||||
|
|
||||||
String postJson(String urlConnection, int timeout, JsonObject jsonObject, String token) throws IOException, NoSuchAlgorithmException, KeyManagementException, HttpsConnectionException {
|
String postJson(String urlConnection, int timeout, JsonObject jsonObject, String token) throws IOException, NoSuchAlgorithmException, KeyManagementException, HttpsConnectionException {
|
||||||
|
|
||||||
|
URL url = new URL(urlConnection);
|
||||||
|
byte[] postDataBytes;
|
||||||
|
postDataBytes = jsonObject.toString().getBytes(StandardCharsets.UTF_8);
|
||||||
if (urlConnection.startsWith("https://")) {
|
if (urlConnection.startsWith("https://")) {
|
||||||
URL url = new URL(urlConnection);
|
|
||||||
byte[] postDataBytes;
|
|
||||||
postDataBytes = jsonObject.toString().getBytes(StandardCharsets.UTF_8);
|
|
||||||
if (proxy != null)
|
if (proxy != null)
|
||||||
httpsURLConnection = (HttpsURLConnection) url.openConnection(proxy);
|
httpsURLConnection = (HttpsURLConnection) url.openConnection(proxy);
|
||||||
else
|
else
|
||||||
|
@ -553,9 +536,6 @@ public class HttpsConnection {
|
||||||
httpsURLConnection.getInputStream().close();
|
httpsURLConnection.getInputStream().close();
|
||||||
return response;
|
return response;
|
||||||
} else {
|
} else {
|
||||||
URL url = new URL(urlConnection);
|
|
||||||
byte[] postDataBytes = jsonObject.toString().getBytes(StandardCharsets.UTF_8);
|
|
||||||
|
|
||||||
if (proxy != null)
|
if (proxy != null)
|
||||||
httpURLConnection = (HttpURLConnection) url.openConnection(proxy);
|
httpURLConnection = (HttpURLConnection) url.openConnection(proxy);
|
||||||
else
|
else
|
||||||
|
@ -812,9 +792,15 @@ public class HttpsConnection {
|
||||||
|
|
||||||
|
|
||||||
public InputStream getPicture(final String downloadUrl) {
|
public InputStream getPicture(final String downloadUrl) {
|
||||||
|
|
||||||
|
URL url;
|
||||||
|
try {
|
||||||
|
url = new URL(downloadUrl);
|
||||||
|
} catch (MalformedURLException e) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
if (downloadUrl.startsWith("https://")) {
|
if (downloadUrl.startsWith("https://")) {
|
||||||
try {
|
try {
|
||||||
URL url = new URL(downloadUrl);
|
|
||||||
if (proxy != null)
|
if (proxy != null)
|
||||||
httpsURLConnection = (HttpsURLConnection) url.openConnection(proxy);
|
httpsURLConnection = (HttpsURLConnection) url.openConnection(proxy);
|
||||||
else
|
else
|
||||||
|
@ -835,10 +821,8 @@ public class HttpsConnection {
|
||||||
httpsURLConnection.getInputStream().close();
|
httpsURLConnection.getInputStream().close();
|
||||||
} catch (Exception ignored) {
|
} catch (Exception ignored) {
|
||||||
}
|
}
|
||||||
return null;
|
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
URL url = new URL(downloadUrl);
|
|
||||||
if (proxy != null)
|
if (proxy != null)
|
||||||
httpURLConnection = (HttpURLConnection) url.openConnection(proxy);
|
httpURLConnection = (HttpURLConnection) url.openConnection(proxy);
|
||||||
else
|
else
|
||||||
|
@ -858,8 +842,8 @@ public class HttpsConnection {
|
||||||
httpURLConnection.getInputStream().close();
|
httpURLConnection.getInputStream().close();
|
||||||
} catch (Exception ignored) {
|
} catch (Exception ignored) {
|
||||||
}
|
}
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void uploadMedia(String urlConnection, InputStream avatar, InputStream header, String filename) {
|
private void uploadMedia(String urlConnection, InputStream avatar, InputStream header, String filename) {
|
||||||
|
@ -923,27 +907,27 @@ public class HttpsConnection {
|
||||||
|
|
||||||
@SuppressWarnings("SameParameterValue")
|
@SuppressWarnings("SameParameterValue")
|
||||||
public String patch(String urlConnection, int timeout, HashMap<String, String> paramaters, InputStream avatar, String avatarName, InputStream header, String headerName, String token) throws IOException, NoSuchAlgorithmException, KeyManagementException, HttpsConnectionException {
|
public String patch(String urlConnection, int timeout, HashMap<String, String> paramaters, InputStream avatar, String avatarName, InputStream header, String headerName, String token) throws IOException, NoSuchAlgorithmException, KeyManagementException, HttpsConnectionException {
|
||||||
|
|
||||||
|
URL url = new URL(urlConnection);
|
||||||
|
Map<String, Object> params = new LinkedHashMap<>();
|
||||||
|
if (paramaters != null) {
|
||||||
|
Iterator<Map.Entry<String, String>> it = paramaters.entrySet().iterator();
|
||||||
|
while (it.hasNext()) {
|
||||||
|
Map.Entry<String, String> pair = it.next();
|
||||||
|
params.put(pair.getKey(), pair.getValue());
|
||||||
|
it.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
StringBuilder postData = new StringBuilder();
|
||||||
|
for (Map.Entry<String, Object> param : params.entrySet()) {
|
||||||
|
if (postData.length() != 0) postData.append('&');
|
||||||
|
postData.append(param.getKey());
|
||||||
|
postData.append('=');
|
||||||
|
postData.append(param.getValue());
|
||||||
|
}
|
||||||
|
byte[] postDataBytes = (postData.toString()).getBytes(StandardCharsets.UTF_8);
|
||||||
|
|
||||||
if (urlConnection.startsWith("https://")) {
|
if (urlConnection.startsWith("https://")) {
|
||||||
URL url = new URL(urlConnection);
|
|
||||||
Map<String, Object> params = new LinkedHashMap<>();
|
|
||||||
if (paramaters != null) {
|
|
||||||
Iterator it = paramaters.entrySet().iterator();
|
|
||||||
while (it.hasNext()) {
|
|
||||||
Map.Entry pair = (Map.Entry) it.next();
|
|
||||||
params.put(pair.getKey().toString(), pair.getValue());
|
|
||||||
it.remove();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
StringBuilder postData = new StringBuilder();
|
|
||||||
for (Map.Entry<String, Object> param : params.entrySet()) {
|
|
||||||
if (postData.length() != 0) postData.append('&');
|
|
||||||
postData.append(param.getKey());
|
|
||||||
postData.append('=');
|
|
||||||
postData.append(param.getValue());
|
|
||||||
}
|
|
||||||
byte[] postDataBytes = (postData.toString()).getBytes(StandardCharsets.UTF_8);
|
|
||||||
|
|
||||||
|
|
||||||
if (proxy != null)
|
if (proxy != null)
|
||||||
httpsURLConnection = (HttpsURLConnection) url.openConnection(proxy);
|
httpsURLConnection = (HttpsURLConnection) url.openConnection(proxy);
|
||||||
else
|
else
|
||||||
|
@ -1006,25 +990,6 @@ public class HttpsConnection {
|
||||||
httpsURLConnection.getInputStream().close();
|
httpsURLConnection.getInputStream().close();
|
||||||
return response;
|
return response;
|
||||||
} else {
|
} else {
|
||||||
URL url = new URL(urlConnection);
|
|
||||||
Map<String, Object> params = new LinkedHashMap<>();
|
|
||||||
if (paramaters != null) {
|
|
||||||
Iterator it = paramaters.entrySet().iterator();
|
|
||||||
while (it.hasNext()) {
|
|
||||||
Map.Entry pair = (Map.Entry) it.next();
|
|
||||||
params.put(pair.getKey().toString(), pair.getValue());
|
|
||||||
it.remove();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
StringBuilder postData = new StringBuilder();
|
|
||||||
for (Map.Entry<String, Object> param : params.entrySet()) {
|
|
||||||
if (postData.length() != 0) postData.append('&');
|
|
||||||
postData.append(param.getKey());
|
|
||||||
postData.append('=');
|
|
||||||
postData.append(param.getValue());
|
|
||||||
}
|
|
||||||
byte[] postDataBytes = (postData.toString()).getBytes(StandardCharsets.UTF_8);
|
|
||||||
|
|
||||||
if (proxy != null)
|
if (proxy != null)
|
||||||
httpURLConnection = (HttpsURLConnection) url.openConnection(proxy);
|
httpURLConnection = (HttpsURLConnection) url.openConnection(proxy);
|
||||||
else
|
else
|
||||||
|
@ -1088,26 +1053,27 @@ public class HttpsConnection {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String put(String urlConnection, int timeout, HashMap<String, String> paramaters, String token) throws IOException, NoSuchAlgorithmException, KeyManagementException, HttpsConnectionException {
|
public String put(String urlConnection, int timeout, HashMap<String, String> paramaters, String token) throws IOException, NoSuchAlgorithmException, KeyManagementException, HttpsConnectionException {
|
||||||
if (urlConnection.startsWith("https://")) {
|
|
||||||
URL url = new URL(urlConnection);
|
|
||||||
Map<String, Object> params = new LinkedHashMap<>();
|
|
||||||
if (paramaters != null) {
|
|
||||||
Iterator it = paramaters.entrySet().iterator();
|
|
||||||
while (it.hasNext()) {
|
|
||||||
Map.Entry pair = (Map.Entry) it.next();
|
|
||||||
params.put(pair.getKey().toString(), pair.getValue());
|
|
||||||
it.remove();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
StringBuilder postData = new StringBuilder();
|
|
||||||
for (Map.Entry<String, Object> param : params.entrySet()) {
|
|
||||||
if (postData.length() != 0) postData.append('&');
|
|
||||||
postData.append(param.getKey());
|
|
||||||
postData.append('=');
|
|
||||||
postData.append(param.getValue());
|
|
||||||
}
|
|
||||||
byte[] postDataBytes = postData.toString().getBytes(StandardCharsets.UTF_8);
|
|
||||||
|
|
||||||
|
URL url = new URL(urlConnection);
|
||||||
|
Map<String, Object> params = new LinkedHashMap<>();
|
||||||
|
if (paramaters != null) {
|
||||||
|
Iterator<Map.Entry<String, String>> it = paramaters.entrySet().iterator();
|
||||||
|
while (it.hasNext()) {
|
||||||
|
Map.Entry<String, String> pair = it.next();
|
||||||
|
params.put(pair.getKey(), pair.getValue());
|
||||||
|
it.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
StringBuilder postData = new StringBuilder();
|
||||||
|
for (Map.Entry<String, Object> param : params.entrySet()) {
|
||||||
|
if (postData.length() != 0) postData.append('&');
|
||||||
|
postData.append(param.getKey());
|
||||||
|
postData.append('=');
|
||||||
|
postData.append(param.getValue());
|
||||||
|
}
|
||||||
|
byte[] postDataBytes = postData.toString().getBytes(StandardCharsets.UTF_8);
|
||||||
|
|
||||||
|
if (urlConnection.startsWith("https://")) {
|
||||||
if (proxy != null)
|
if (proxy != null)
|
||||||
httpsURLConnection = (HttpsURLConnection) url.openConnection(proxy);
|
httpsURLConnection = (HttpsURLConnection) url.openConnection(proxy);
|
||||||
else
|
else
|
||||||
|
@ -1157,25 +1123,6 @@ public class HttpsConnection {
|
||||||
httpsURLConnection.getInputStream().close();
|
httpsURLConnection.getInputStream().close();
|
||||||
return response;
|
return response;
|
||||||
} else {
|
} else {
|
||||||
URL url = new URL(urlConnection);
|
|
||||||
Map<String, Object> params = new LinkedHashMap<>();
|
|
||||||
if (paramaters != null) {
|
|
||||||
Iterator it = paramaters.entrySet().iterator();
|
|
||||||
while (it.hasNext()) {
|
|
||||||
Map.Entry pair = (Map.Entry) it.next();
|
|
||||||
params.put(pair.getKey().toString(), pair.getValue());
|
|
||||||
it.remove();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
StringBuilder postData = new StringBuilder();
|
|
||||||
for (Map.Entry<String, Object> param : params.entrySet()) {
|
|
||||||
if (postData.length() != 0) postData.append('&');
|
|
||||||
postData.append(param.getKey());
|
|
||||||
postData.append('=');
|
|
||||||
postData.append(param.getValue());
|
|
||||||
}
|
|
||||||
byte[] postDataBytes = postData.toString().getBytes(StandardCharsets.UTF_8);
|
|
||||||
|
|
||||||
if (proxy != null)
|
if (proxy != null)
|
||||||
httpURLConnection = (HttpURLConnection) url.openConnection(proxy);
|
httpURLConnection = (HttpURLConnection) url.openConnection(proxy);
|
||||||
else
|
else
|
||||||
|
@ -1228,26 +1175,27 @@ public class HttpsConnection {
|
||||||
}
|
}
|
||||||
|
|
||||||
public int delete(String urlConnection, int timeout, HashMap<String, String> paramaters, String token) throws IOException, NoSuchAlgorithmException, KeyManagementException, HttpsConnectionException {
|
public int delete(String urlConnection, int timeout, HashMap<String, String> paramaters, String token) throws IOException, NoSuchAlgorithmException, KeyManagementException, HttpsConnectionException {
|
||||||
if (urlConnection.startsWith("https://")) {
|
|
||||||
URL url = new URL(urlConnection);
|
|
||||||
Map<String, Object> params = new LinkedHashMap<>();
|
|
||||||
if (paramaters != null) {
|
|
||||||
Iterator it = paramaters.entrySet().iterator();
|
|
||||||
while (it.hasNext()) {
|
|
||||||
Map.Entry pair = (Map.Entry) it.next();
|
|
||||||
params.put(pair.getKey().toString(), pair.getValue());
|
|
||||||
it.remove();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
StringBuilder postData = new StringBuilder();
|
|
||||||
for (Map.Entry<String, Object> param : params.entrySet()) {
|
|
||||||
if (postData.length() != 0) postData.append('&');
|
|
||||||
postData.append(param.getKey());
|
|
||||||
postData.append('=');
|
|
||||||
postData.append(param.getValue());
|
|
||||||
}
|
|
||||||
byte[] postDataBytes = postData.toString().getBytes(StandardCharsets.UTF_8);
|
|
||||||
|
|
||||||
|
URL url = new URL(urlConnection);
|
||||||
|
Map<String, Object> params = new LinkedHashMap<>();
|
||||||
|
if (paramaters != null) {
|
||||||
|
Iterator<Map.Entry<String, String>> it = paramaters.entrySet().iterator();
|
||||||
|
while (it.hasNext()) {
|
||||||
|
Map.Entry<String, String> pair = it.next();
|
||||||
|
params.put(pair.getKey(), pair.getValue());
|
||||||
|
it.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
StringBuilder postData = new StringBuilder();
|
||||||
|
for (Map.Entry<String, Object> param : params.entrySet()) {
|
||||||
|
if (postData.length() != 0) postData.append('&');
|
||||||
|
postData.append(param.getKey());
|
||||||
|
postData.append('=');
|
||||||
|
postData.append(param.getValue());
|
||||||
|
}
|
||||||
|
byte[] postDataBytes = postData.toString().getBytes(StandardCharsets.UTF_8);
|
||||||
|
|
||||||
|
if (urlConnection.startsWith("https://")) {
|
||||||
if (proxy != null)
|
if (proxy != null)
|
||||||
httpsURLConnection = (HttpsURLConnection) url.openConnection(proxy);
|
httpsURLConnection = (HttpsURLConnection) url.openConnection(proxy);
|
||||||
else
|
else
|
||||||
|
@ -1292,25 +1240,6 @@ public class HttpsConnection {
|
||||||
throw new HttpsConnectionException(responseCode, error);
|
throw new HttpsConnectionException(responseCode, error);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
URL url = new URL(urlConnection);
|
|
||||||
Map<String, Object> params = new LinkedHashMap<>();
|
|
||||||
if (paramaters != null) {
|
|
||||||
Iterator it = paramaters.entrySet().iterator();
|
|
||||||
while (it.hasNext()) {
|
|
||||||
Map.Entry pair = (Map.Entry) it.next();
|
|
||||||
params.put(pair.getKey().toString(), pair.getValue());
|
|
||||||
it.remove();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
StringBuilder postData = new StringBuilder();
|
|
||||||
for (Map.Entry<String, Object> param : params.entrySet()) {
|
|
||||||
if (postData.length() != 0) postData.append('&');
|
|
||||||
postData.append(param.getKey());
|
|
||||||
postData.append('=');
|
|
||||||
postData.append(param.getValue());
|
|
||||||
}
|
|
||||||
byte[] postDataBytes = postData.toString().getBytes(StandardCharsets.UTF_8);
|
|
||||||
|
|
||||||
if (proxy != null)
|
if (proxy != null)
|
||||||
httpURLConnection = (HttpURLConnection) url.openConnection(proxy);
|
httpURLConnection = (HttpURLConnection) url.openConnection(proxy);
|
||||||
else
|
else
|
||||||
|
|
|
@ -47,6 +47,8 @@ import app.fedilab.android.helper.Helper;
|
||||||
import app.fedilab.android.interfaces.OnPostActionInterface;
|
import app.fedilab.android.interfaces.OnPostActionInterface;
|
||||||
import es.dmoral.toasty.Toasty;
|
import es.dmoral.toasty.Toasty;
|
||||||
|
|
||||||
|
import static app.fedilab.android.helper.Helper.makeEmojis;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Thomas on 03/09/2017.
|
* Created by Thomas on 03/09/2017.
|
||||||
|
@ -125,6 +127,7 @@ public class AccountSearchDevAdapter extends BaseAdapter implements OnPostAction
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
holder.account_dn.setText(account.getDisplay_name());
|
holder.account_dn.setText(account.getDisplay_name());
|
||||||
|
makeEmojis(context, holder.account_dn, account.getDisplayNameSpan(), account.getEmojis());
|
||||||
holder.account_un.setText(account.getAcct());
|
holder.account_un.setText(account.getAcct());
|
||||||
holder.account_follow.hide();
|
holder.account_follow.hide();
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,6 +36,8 @@ import app.fedilab.android.client.Entities.AccountAdmin;
|
||||||
import app.fedilab.android.helper.Helper;
|
import app.fedilab.android.helper.Helper;
|
||||||
import app.fedilab.android.interfaces.OnRetrieveEmojiAccountInterface;
|
import app.fedilab.android.interfaces.OnRetrieveEmojiAccountInterface;
|
||||||
|
|
||||||
|
import static app.fedilab.android.helper.Helper.makeEmojis;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Thomas on 19/06/2019.
|
* Created by Thomas on 19/06/2019.
|
||||||
|
@ -74,8 +76,11 @@ public class AccountsAdminListAdapter extends RecyclerView.Adapter<RecyclerView.
|
||||||
else if (account.getDisplay_name() != null) {
|
else if (account.getDisplay_name() != null) {
|
||||||
holder.account_dn.setText(account.getDisplay_name().replace("@", ""));
|
holder.account_dn.setText(account.getDisplay_name().replace("@", ""));
|
||||||
}
|
}
|
||||||
} else
|
} else {
|
||||||
holder.account_dn.setText(account.getDisplayNameSpan(), TextView.BufferType.SPANNABLE);
|
holder.account_dn.setText(account.getDisplayNameSpan(), TextView.BufferType.SPANNABLE);
|
||||||
|
makeEmojis(context, holder.account_dn, account.getDisplayNameSpan(), account.getEmojis());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (account.getDisplayNameSpan() == null || account.getDisplayNameSpan().toString().trim().equals("")) {
|
if (account.getDisplayNameSpan() == null || account.getDisplayNameSpan().toString().trim().equals("")) {
|
||||||
if (account.getDisplay_name() != null && !account.getDisplay_name().trim().equals(""))
|
if (account.getDisplay_name() != null && !account.getDisplay_name().trim().equals(""))
|
||||||
|
|
|
@ -50,6 +50,8 @@ import app.fedilab.android.helper.Helper;
|
||||||
import app.fedilab.android.interfaces.OnPostActionInterface;
|
import app.fedilab.android.interfaces.OnPostActionInterface;
|
||||||
import es.dmoral.toasty.Toasty;
|
import es.dmoral.toasty.Toasty;
|
||||||
|
|
||||||
|
import static app.fedilab.android.helper.Helper.makeEmojis;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Thomas on 07/05/2017.
|
* Created by Thomas on 07/05/2017.
|
||||||
|
@ -88,6 +90,7 @@ public class AccountsFollowRequestAdapter extends RecyclerView.Adapter<RecyclerV
|
||||||
holder.btn_reject.setVisibility(View.GONE);
|
holder.btn_reject.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
holder.account_dn.setText(account.getDisplay_name());
|
holder.account_dn.setText(account.getDisplay_name());
|
||||||
|
makeEmojis(context, holder.account_dn, account.getDisplayNameSpan(), account.getEmojis());
|
||||||
holder.account_un.setText(account.getAcct());
|
holder.account_un.setText(account.getAcct());
|
||||||
//Profile picture
|
//Profile picture
|
||||||
Glide.with(holder.account_pp.getContext())
|
Glide.with(holder.account_pp.getContext())
|
||||||
|
|
|
@ -45,6 +45,8 @@ import app.fedilab.android.helper.Helper;
|
||||||
import app.fedilab.android.interfaces.OnListActionInterface;
|
import app.fedilab.android.interfaces.OnListActionInterface;
|
||||||
import es.dmoral.toasty.Toasty;
|
import es.dmoral.toasty.Toasty;
|
||||||
|
|
||||||
|
import static app.fedilab.android.helper.Helper.makeEmojis;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Thomas on 15/12/2017.
|
* Created by Thomas on 15/12/2017.
|
||||||
|
@ -90,6 +92,7 @@ public class AccountsInAListAdapter extends RecyclerView.Adapter<RecyclerView.Vi
|
||||||
|
|
||||||
|
|
||||||
holder.account_un.setText(account.getDisplay_name());
|
holder.account_un.setText(account.getDisplay_name());
|
||||||
|
makeEmojis(context, holder.account_un, account.getDisplayNameSpan(), account.getEmojis());
|
||||||
holder.account_ac.setText(account.getAcct());
|
holder.account_ac.setText(account.getAcct());
|
||||||
if (account.getDisplay_name().equals(account.getAcct()))
|
if (account.getDisplay_name().equals(account.getAcct()))
|
||||||
holder.account_ac.setVisibility(View.GONE);
|
holder.account_ac.setVisibility(View.GONE);
|
||||||
|
|
|
@ -60,6 +60,8 @@ import app.fedilab.android.sqlite.InstancesDAO;
|
||||||
import app.fedilab.android.sqlite.Sqlite;
|
import app.fedilab.android.sqlite.Sqlite;
|
||||||
import es.dmoral.toasty.Toasty;
|
import es.dmoral.toasty.Toasty;
|
||||||
|
|
||||||
|
import static app.fedilab.android.helper.Helper.makeEmojis;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Thomas on 27/04/2017.
|
* Created by Thomas on 27/04/2017.
|
||||||
|
@ -172,8 +174,10 @@ public class AccountsListAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
|
||||||
holder.account_dn.setText(account.getDisplay_name());
|
holder.account_dn.setText(account.getDisplay_name());
|
||||||
else
|
else
|
||||||
holder.account_dn.setText(account.getUsername().replace("@", ""));
|
holder.account_dn.setText(account.getUsername().replace("@", ""));
|
||||||
} else
|
} else {
|
||||||
holder.account_dn.setText(account.getDisplayNameSpan(), TextView.BufferType.SPANNABLE);
|
holder.account_dn.setText(account.getDisplayNameSpan(), TextView.BufferType.SPANNABLE);
|
||||||
|
makeEmojis(context, holder.account_dn, account.getDisplayNameSpan(), account.getEmojis());
|
||||||
|
}
|
||||||
holder.account_un.setText(String.format("@%s", account.getUsername()));
|
holder.account_un.setText(String.format("@%s", account.getUsername()));
|
||||||
holder.account_ac.setText(account.getAcct());
|
holder.account_ac.setText(account.getAcct());
|
||||||
if (account.getUsername().equals(account.getAcct()))
|
if (account.getUsername().equals(account.getAcct()))
|
||||||
|
|
|
@ -58,6 +58,7 @@ import app.fedilab.android.sqlite.StatusCacheDAO;
|
||||||
import es.dmoral.toasty.Toasty;
|
import es.dmoral.toasty.Toasty;
|
||||||
|
|
||||||
import static android.content.Context.MODE_PRIVATE;
|
import static android.content.Context.MODE_PRIVATE;
|
||||||
|
import static app.fedilab.android.helper.Helper.makeEmojis;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -186,9 +187,10 @@ public class ArtListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
|
||||||
context.startActivity(intent);
|
context.startActivity(intent);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (status.getAccount().getDisplayNameSpan() != null && status.getAccount().getDisplayNameSpan().toString().trim().length() > 0)
|
if (status.getAccount().getDisplayNameSpan() != null && status.getAccount().getDisplayNameSpan().toString().trim().length() > 0) {
|
||||||
holder.art_username.setText(status.getAccount().getDisplayNameSpan(), TextView.BufferType.SPANNABLE);
|
holder.art_username.setText(status.getAccount().getDisplayNameSpan(), TextView.BufferType.SPANNABLE);
|
||||||
else
|
makeEmojis(context, holder.art_username, status.getAccount().getDisplayNameSpan(), status.getAccount().getEmojis());
|
||||||
|
} else
|
||||||
holder.art_username.setText(status.getAccount().getUsername());
|
holder.art_username.setText(status.getAccount().getUsername());
|
||||||
|
|
||||||
holder.art_acct.setText(String.format("@%s", status.getAccount().getAcct()));
|
holder.art_acct.setText(String.format("@%s", status.getAccount().getAcct()));
|
||||||
|
|
|
@ -111,6 +111,7 @@ import es.dmoral.toasty.Toasty;
|
||||||
|
|
||||||
import static android.content.Context.MODE_PRIVATE;
|
import static android.content.Context.MODE_PRIVATE;
|
||||||
import static app.fedilab.android.activities.BaseMainActivity.social;
|
import static app.fedilab.android.activities.BaseMainActivity.social;
|
||||||
|
import static app.fedilab.android.helper.Helper.makeEmojis;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -322,8 +323,10 @@ public class NotificationsListAdapter extends RecyclerView.Adapter<RecyclerView.
|
||||||
if (notification.getAccount().getDisplayNameSpan() == null) {
|
if (notification.getAccount().getDisplayNameSpan() == null) {
|
||||||
holder.notification_type.setText(typeString);
|
holder.notification_type.setText(typeString);
|
||||||
notification.getAccount().setStored_displayname(notification.getAccount().getDisplay_name());
|
notification.getAccount().setStored_displayname(notification.getAccount().getDisplay_name());
|
||||||
} else
|
} else {
|
||||||
holder.notification_type.setText(notification.getAccount().getDisplayNameSpan(), TextView.BufferType.SPANNABLE);
|
holder.notification_type.setText(typeString, TextView.BufferType.SPANNABLE);
|
||||||
|
makeEmojis(context, holder.notification_type, notification.getAccount().getDisplayNameSpan(), notification.getAccount().getEmojis());
|
||||||
|
}
|
||||||
|
|
||||||
if (imgH != null) {
|
if (imgH != null) {
|
||||||
DrawableCompat.setTint(imgH, ContextCompat.getColor(context, R.color.cyanea_accent));
|
DrawableCompat.setTint(imgH, ContextCompat.getColor(context, R.color.cyanea_accent));
|
||||||
|
@ -376,6 +379,7 @@ public class NotificationsListAdapter extends RecyclerView.Adapter<RecyclerView.
|
||||||
holder.status_privacy.setContentDescription(context.getString(R.string.toot_visibility_tilte) + ": " + v);
|
holder.status_privacy.setContentDescription(context.getString(R.string.toot_visibility_tilte) + ": " + v);
|
||||||
});
|
});
|
||||||
holder.notification_status_content.setText(status.getContentSpan(), TextView.BufferType.SPANNABLE);
|
holder.notification_status_content.setText(status.getContentSpan(), TextView.BufferType.SPANNABLE);
|
||||||
|
makeEmojis(context, holder.notification_status_content, status.getContentSpan(), status.getEmojis());
|
||||||
holder.status_spoiler.setText(status.getContentSpanCW(), TextView.BufferType.SPANNABLE);
|
holder.status_spoiler.setText(status.getContentSpanCW(), TextView.BufferType.SPANNABLE);
|
||||||
holder.status_spoiler.setMovementMethod(LinkMovementMethod.getInstance());
|
holder.status_spoiler.setMovementMethod(LinkMovementMethod.getInstance());
|
||||||
holder.notification_status_content.setMovementMethod(LinkMovementMethod.getInstance());
|
holder.notification_status_content.setMovementMethod(LinkMovementMethod.getInstance());
|
||||||
|
@ -541,6 +545,7 @@ public class NotificationsListAdapter extends RecyclerView.Adapter<RecyclerView.
|
||||||
ProgressBar poll_item_value = item.findViewById(R.id.poll_item_value);
|
ProgressBar poll_item_value = item.findViewById(R.id.poll_item_value);
|
||||||
poll_item_percent.setText(String.format("%s %%", (int) value));
|
poll_item_percent.setText(String.format("%s %%", (int) value));
|
||||||
poll_item_text.setText(pollOption.getTitle(), TextView.BufferType.SPANNABLE);
|
poll_item_text.setText(pollOption.getTitle(), TextView.BufferType.SPANNABLE);
|
||||||
|
makeEmojis(context, poll_item_text, pollOption.getTitleSpan(), poll.getEmojis());
|
||||||
poll_item_value.setProgress((int) value);
|
poll_item_value.setProgress((int) value);
|
||||||
holder.rated.addView(item);
|
holder.rated.addView(item);
|
||||||
if (pollOption.getVotes_count() == greaterValue) {
|
if (pollOption.getVotes_count() == greaterValue) {
|
||||||
|
@ -564,6 +569,7 @@ public class NotificationsListAdapter extends RecyclerView.Adapter<RecyclerView.
|
||||||
for (PollOptions pollOption : poll.getOptionsList()) {
|
for (PollOptions pollOption : poll.getOptionsList()) {
|
||||||
CheckBox cb = new CheckBox(context);
|
CheckBox cb = new CheckBox(context);
|
||||||
cb.setText(pollOption.getTitle());
|
cb.setText(pollOption.getTitle());
|
||||||
|
makeEmojis(context, cb, pollOption.getTitleSpan(), poll.getEmojis());
|
||||||
holder.multiple_choice.addView(cb);
|
holder.multiple_choice.addView(cb);
|
||||||
}
|
}
|
||||||
holder.multiple_choice.setVisibility(View.VISIBLE);
|
holder.multiple_choice.setVisibility(View.VISIBLE);
|
||||||
|
@ -573,6 +579,7 @@ public class NotificationsListAdapter extends RecyclerView.Adapter<RecyclerView.
|
||||||
for (PollOptions pollOption : poll.getOptionsList()) {
|
for (PollOptions pollOption : poll.getOptionsList()) {
|
||||||
RadioButton rb = new RadioButton(context);
|
RadioButton rb = new RadioButton(context);
|
||||||
rb.setText(pollOption.getTitle());
|
rb.setText(pollOption.getTitle());
|
||||||
|
makeEmojis(context, rb, pollOption.getTitleSpan(), poll.getEmojis());
|
||||||
holder.radio_group.addView(rb);
|
holder.radio_group.addView(rb);
|
||||||
}
|
}
|
||||||
holder.single_choice.setVisibility(View.VISIBLE);
|
holder.single_choice.setVisibility(View.VISIBLE);
|
||||||
|
|
|
@ -114,7 +114,6 @@ import es.dmoral.toasty.Toasty;
|
||||||
import static android.content.Context.MODE_PRIVATE;
|
import static android.content.Context.MODE_PRIVATE;
|
||||||
import static app.fedilab.android.activities.BaseMainActivity.mutedAccount;
|
import static app.fedilab.android.activities.BaseMainActivity.mutedAccount;
|
||||||
import static app.fedilab.android.activities.BaseMainActivity.social;
|
import static app.fedilab.android.activities.BaseMainActivity.social;
|
||||||
import static app.fedilab.android.helper.Helper.makeEmojis;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -141,7 +141,7 @@ public class SliderAdapter extends SliderViewAdapter<SliderAdapter.SliderAdapter
|
||||||
|
|
||||||
//Text for report
|
//Text for report
|
||||||
final EditText input = popup_media_description.findViewById(R.id.media_description);
|
final EditText input = popup_media_description.findViewById(R.id.media_description);
|
||||||
input.setFilters(new InputFilter[]{new InputFilter.LengthFilter(420)});
|
input.setFilters(new InputFilter[]{new InputFilter.LengthFilter(1500)});
|
||||||
final ImageView media_picture = popup_media_description.findViewById(R.id.media_picture);
|
final ImageView media_picture = popup_media_description.findViewById(R.id.media_picture);
|
||||||
Glide.with(contextWeakReference.get())
|
Glide.with(contextWeakReference.get())
|
||||||
.asBitmap()
|
.asBitmap()
|
||||||
|
|
|
@ -1558,7 +1558,7 @@ public class StatusListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
|
||||||
holder.status_content.setText(status.getContentSpan(), TextView.BufferType.SPANNABLE);
|
holder.status_content.setText(status.getContentSpan(), TextView.BufferType.SPANNABLE);
|
||||||
holder.status_spoiler.setText(status.getContentSpanCW(), TextView.BufferType.SPANNABLE);
|
holder.status_spoiler.setText(status.getContentSpanCW(), TextView.BufferType.SPANNABLE);
|
||||||
}
|
}
|
||||||
makeEmojis(context, holder.status_content, status.getContentSpan(), status.getReblog()!=null?status.getReblog().getEmojis():status.getEmojis());
|
makeEmojis(context, holder.status_content, status.getContentSpan(), status.getReblog() != null ? status.getReblog().getEmojis() : status.getEmojis());
|
||||||
|
|
||||||
|
|
||||||
holder.status_content.setMovementMethod(LongClickLinkMovementMethod.getInstance());
|
holder.status_content.setMovementMethod(LongClickLinkMovementMethod.getInstance());
|
||||||
|
@ -1614,7 +1614,7 @@ public class StatusListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
|
||||||
if (status.getReblog().getAccount().getDisplay_name().length() > 0) {
|
if (status.getReblog().getAccount().getDisplay_name().length() > 0) {
|
||||||
holder.status_account_displayname_owner.setText(displayNameSpan, TextView.BufferType.SPANNABLE);
|
holder.status_account_displayname_owner.setText(displayNameSpan, TextView.BufferType.SPANNABLE);
|
||||||
makeEmojis(context, holder.status_account_displayname_owner, status.getReblog().getAccount().getDisplayNameSpan(), status.getReblog().getAccount().getEmojis());
|
makeEmojis(context, holder.status_account_displayname_owner, status.getReblog().getAccount().getDisplayNameSpan(), status.getReblog().getAccount().getEmojis());
|
||||||
}else
|
} else
|
||||||
holder.status_account_displayname_owner.setText(status.getReblog().getAccount().getAcct().replace("@", ""));
|
holder.status_account_displayname_owner.setText(status.getReblog().getAccount().getAcct().replace("@", ""));
|
||||||
|
|
||||||
holder.status_account_displayname_owner.setVisibility(View.VISIBLE);
|
holder.status_account_displayname_owner.setVisibility(View.VISIBLE);
|
||||||
|
@ -1626,8 +1626,7 @@ public class StatusListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
|
||||||
holder.status_account_displayname.setVisibility(View.GONE);
|
holder.status_account_displayname.setVisibility(View.GONE);
|
||||||
if (displayNameSpan == null || displayNameSpan.toString().trim().length() == 0) {
|
if (displayNameSpan == null || displayNameSpan.toString().trim().length() == 0) {
|
||||||
holder.status_account_displayname_owner.setText(status.getAccount().getUsername().replace("@", ""), TextView.BufferType.SPANNABLE);
|
holder.status_account_displayname_owner.setText(status.getAccount().getUsername().replace("@", ""), TextView.BufferType.SPANNABLE);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
holder.status_account_displayname_owner.setText(displayNameSpan, TextView.BufferType.SPANNABLE);
|
holder.status_account_displayname_owner.setText(displayNameSpan, TextView.BufferType.SPANNABLE);
|
||||||
makeEmojis(context, holder.status_account_displayname_owner, displayNameSpan, status.getAccount().getEmojis());
|
makeEmojis(context, holder.status_account_displayname_owner, displayNameSpan, status.getAccount().getEmojis());
|
||||||
}
|
}
|
||||||
|
@ -1707,7 +1706,7 @@ public class StatusListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
|
||||||
holder.fetch_more.setVisibility(View.GONE);
|
holder.fetch_more.setVisibility(View.GONE);
|
||||||
|
|
||||||
}
|
}
|
||||||
if( type == RetrieveFeedsAsyncTask.Type.CONTEXT ){
|
if (type == RetrieveFeedsAsyncTask.Type.CONTEXT) {
|
||||||
holder.fetch_more.setVisibility(View.GONE);
|
holder.fetch_more.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3956,7 +3955,7 @@ public class StatusListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
|
||||||
status.setTranslationShown(true);
|
status.setTranslationShown(true);
|
||||||
status.setContentTranslated(translate.getTranslatedContent());
|
status.setContentTranslated(translate.getTranslatedContent());
|
||||||
Status.transformTranslation(context, status);
|
Status.transformTranslation(context, status);
|
||||||
makeEmojis(context, view, status.getContentSpan(), status.getReblog()!=null?status.getReblog().getEmojis():status.getEmojis());
|
makeEmojis(context, view, status.getContentSpan(), status.getReblog() != null ? status.getReblog().getEmojis() : status.getEmojis());
|
||||||
notifyStatusChanged(status);
|
notifyStatusChanged(status);
|
||||||
} else {
|
} else {
|
||||||
Toasty.error(context, context.getString(R.string.toast_error_translate), Toast.LENGTH_LONG).show();
|
Toasty.error(context, context.getString(R.string.toast_error_translate), Toast.LENGTH_LONG).show();
|
||||||
|
|
|
@ -110,7 +110,7 @@ public class TrendsAdapter extends BaseAdapter {
|
||||||
uses += _th.getUses();
|
uses += _th.getUses();
|
||||||
tendency.put(_th.getDays(), _th.getUses());
|
tendency.put(_th.getDays(), _th.getUses());
|
||||||
}
|
}
|
||||||
if( days > 0 ) {
|
if (days > 0) {
|
||||||
people = people / days;
|
people = people / days;
|
||||||
uses = uses / days;
|
uses = uses / days;
|
||||||
}
|
}
|
||||||
|
|
|
@ -125,7 +125,7 @@ public class CrossActions {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void doCrossAction(final Context context, RetrieveFeedsAsyncTask.Type type, final Status status, final Account targetedAccount, final API.StatusAction doAction, final RecyclerView.Adapter baseAdapter, final OnPostActionInterface onPostActionInterface, boolean limitedToOwner) {
|
public static void doCrossAction(final Context context, RetrieveFeedsAsyncTask.Type type, final Status status, final Account targetedAccount, final API.StatusAction doAction, final RecyclerView.Adapter<RecyclerView.ViewHolder> baseAdapter, final OnPostActionInterface onPostActionInterface, boolean limitedToOwner) {
|
||||||
List<Account> accounts = connectedAccounts(context, status, limitedToOwner);
|
List<Account> accounts = connectedAccounts(context, status, limitedToOwner);
|
||||||
final SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, android.content.Context.MODE_PRIVATE);
|
final SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, android.content.Context.MODE_PRIVATE);
|
||||||
boolean undoAction = (doAction == API.StatusAction.UNPIN || doAction == API.StatusAction.UNREBLOG || doAction == API.StatusAction.UNFAVOURITE);
|
boolean undoAction = (doAction == API.StatusAction.UNPIN || doAction == API.StatusAction.UNREBLOG || doAction == API.StatusAction.UNFAVOURITE);
|
||||||
|
@ -784,7 +784,7 @@ public class CrossActions {
|
||||||
* @param action int
|
* @param action int
|
||||||
* @param status Status
|
* @param status Status
|
||||||
*/
|
*/
|
||||||
private static void displayConfirmationDialog(final Context context, final API.StatusAction action, final Status status, final RecyclerView.Adapter baseAdapter, final OnPostActionInterface onPostActionInterface) {
|
private static void displayConfirmationDialog(final Context context, final API.StatusAction action, final Status status, final RecyclerView.Adapter<RecyclerView.ViewHolder> baseAdapter, final OnPostActionInterface onPostActionInterface) {
|
||||||
|
|
||||||
String title = null;
|
String title = null;
|
||||||
if (action == API.StatusAction.FAVOURITE) {
|
if (action == API.StatusAction.FAVOURITE) {
|
||||||
|
@ -855,7 +855,7 @@ public class CrossActions {
|
||||||
* @param action int
|
* @param action int
|
||||||
* @param status Status
|
* @param status Status
|
||||||
*/
|
*/
|
||||||
private static void displayConfirmationDialogCrossAction(final Context context, Account currentAccount, final API.StatusAction action, final Status status, final OnPostActionInterface onPostActionInterface, final RecyclerView.Adapter baseAdapter) {
|
private static void displayConfirmationDialogCrossAction(final Context context, Account currentAccount, final API.StatusAction action, final Status status, final OnPostActionInterface onPostActionInterface, final RecyclerView.Adapter<RecyclerView.ViewHolder> baseAdapter) {
|
||||||
|
|
||||||
String title = null;
|
String title = null;
|
||||||
if (action == API.StatusAction.FAVOURITE) {
|
if (action == API.StatusAction.FAVOURITE) {
|
||||||
|
@ -950,7 +950,7 @@ public class CrossActions {
|
||||||
*
|
*
|
||||||
* @param status Status
|
* @param status Status
|
||||||
*/
|
*/
|
||||||
private static void pinAction(Context context, Status status, RecyclerView.Adapter baseAdapter, OnPostActionInterface onPostActionInterface) {
|
private static void pinAction(Context context, Status status, RecyclerView.Adapter<RecyclerView.ViewHolder> baseAdapter, OnPostActionInterface onPostActionInterface) {
|
||||||
|
|
||||||
if (status.isPinned()) {
|
if (status.isPinned()) {
|
||||||
new PostActionAsyncTask(context, API.StatusAction.UNPIN, status.getId(), onPostActionInterface).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
new PostActionAsyncTask(context, API.StatusAction.UNPIN, status.getId(), onPostActionInterface).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||||
|
|
|
@ -46,6 +46,7 @@ public class FullScreenMediaController extends MediaController {
|
||||||
this.context = context;
|
this.context = context;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
public FullScreenMediaController(Context context, Peertube peertube) {
|
public FullScreenMediaController(Context context, Peertube peertube) {
|
||||||
super(context);
|
super(context);
|
||||||
this.peertube = peertube;
|
this.peertube = peertube;
|
||||||
|
@ -80,12 +81,7 @@ public class FullScreenMediaController extends MediaController {
|
||||||
paramsButton.gravity = Gravity.START;
|
paramsButton.gravity = Gravity.START;
|
||||||
paramsButton.rightMargin = 80;
|
paramsButton.rightMargin = 80;
|
||||||
paramsButton.topMargin = 22;
|
paramsButton.topMargin = 22;
|
||||||
resolution.setOnClickListener(new OnClickListener() {
|
resolution.setOnClickListener(v -> ((PeertubeActivity) getContext()).displayResolution());
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
((PeertubeActivity) getContext()).displayResolution();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
addView(resolution, paramsButton);
|
addView(resolution, paramsButton);
|
||||||
|
|
||||||
if (((PeertubeActivity) getContext()).getFullscreen() == fullscreen.ON) {
|
if (((PeertubeActivity) getContext()).getFullscreen() == fullscreen.ON) {
|
||||||
|
@ -97,21 +93,19 @@ public class FullScreenMediaController extends MediaController {
|
||||||
}
|
}
|
||||||
|
|
||||||
//add listener to image button to handle full screen and exit full screen events
|
//add listener to image button to handle full screen and exit full screen events
|
||||||
fullScreen.setOnClickListener(new OnClickListener() {
|
fullScreen.setOnClickListener(v -> {
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
|
|
||||||
if (((PeertubeActivity) getContext()).getFullscreen() == fullscreen.ON) {
|
if (((PeertubeActivity) getContext()).getFullscreen() == fullscreen.ON) {
|
||||||
((PeertubeActivity) getContext()).setFullscreen(fullscreen.OFF);
|
((PeertubeActivity) getContext()).setFullscreen(fullscreen.OFF);
|
||||||
} else {
|
} else {
|
||||||
((PeertubeActivity) getContext()).setFullscreen(fullscreen.ON);
|
((PeertubeActivity) getContext()).setFullscreen(fullscreen.ON);
|
||||||
}
|
|
||||||
((PeertubeActivity) getContext()).change();
|
|
||||||
changeIcon();
|
|
||||||
}
|
}
|
||||||
|
((PeertubeActivity) getContext()).change();
|
||||||
|
changeIcon();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
public void setResolutionVal(String resolutionVal) {
|
public void setResolutionVal(String resolutionVal) {
|
||||||
this.resolutionVal = resolutionVal;
|
this.resolutionVal = resolutionVal;
|
||||||
if (resolution != null)
|
if (resolution != null)
|
||||||
|
|
|
@ -1643,12 +1643,7 @@ public class Helper {
|
||||||
|
|
||||||
public static <K, V> Map<K, V> sortByValue(Map<K, V> map) {
|
public static <K, V> Map<K, V> sortByValue(Map<K, V> map) {
|
||||||
List<Map.Entry<K, V>> list = new LinkedList<>(map.entrySet());
|
List<Map.Entry<K, V>> list = new LinkedList<>(map.entrySet());
|
||||||
Collections.sort(list, new Comparator<Object>() {
|
Collections.sort(list, (Comparator<Object>) (o2, o1) -> ((Comparable<V>) ((Map.Entry<K, V>) (o1)).getValue()).compareTo(((Map.Entry<K, V>) (o2)).getValue()));
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public int compare(Object o2, Object o1) {
|
|
||||||
return ((Comparable<V>) ((Map.Entry<K, V>) (o1)).getValue()).compareTo(((Map.Entry<K, V>) (o2)).getValue());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
Map<K, V> result = new LinkedHashMap<>();
|
Map<K, V> result = new LinkedHashMap<>();
|
||||||
for (Map.Entry<K, V> entry : list) {
|
for (Map.Entry<K, V> entry : list) {
|
||||||
|
@ -2659,7 +2654,8 @@ public class Helper {
|
||||||
public static List<String> restoreArrayFromString(String serializedArray) {
|
public static List<String> restoreArrayFromString(String serializedArray) {
|
||||||
Gson gson = new Gson();
|
Gson gson = new Gson();
|
||||||
try {
|
try {
|
||||||
Type listType = new TypeToken<ArrayList<String>>() {}.getType();
|
Type listType = new TypeToken<ArrayList<String>>() {
|
||||||
|
}.getType();
|
||||||
return gson.fromJson(serializedArray, listType);
|
return gson.fromJson(serializedArray, listType);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -4205,12 +4201,12 @@ public class Helper {
|
||||||
fw.append(',');
|
fw.append(',');
|
||||||
fw.append("COMMENT");
|
fw.append("COMMENT");
|
||||||
fw.append('\n');
|
fw.append('\n');
|
||||||
Iterator it = domainBlocked.entrySet().iterator();
|
Iterator<Map.Entry<String, String>> it = domainBlocked.entrySet().iterator();
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
Map.Entry pair = (Map.Entry) it.next();
|
Map.Entry<String, String> pair = it.next();
|
||||||
fw.append((String) pair.getKey());
|
fw.append(pair.getKey());
|
||||||
fw.append(',');
|
fw.append(',');
|
||||||
fw.append((String) pair.getValue());
|
fw.append(pair.getValue());
|
||||||
fw.append('\n');
|
fw.append('\n');
|
||||||
it.remove();
|
it.remove();
|
||||||
}
|
}
|
||||||
|
@ -4259,16 +4255,16 @@ public class Helper {
|
||||||
|
|
||||||
linearLayout_main.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT));
|
linearLayout_main.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT));
|
||||||
linearLayout_main.setOrientation(LinearLayout.VERTICAL);
|
linearLayout_main.setOrientation(LinearLayout.VERTICAL);
|
||||||
Iterator it = instances.entrySet().iterator();
|
Iterator<Map.Entry<String, String>> it = instances.entrySet().iterator();
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
Map.Entry pair = (Map.Entry) it.next();
|
Map.Entry<String, String> pair = it.next();
|
||||||
View item = inflater.inflate(R.layout.muted_instance_popup, new LinearLayout(context), false);
|
View item = inflater.inflate(R.layout.muted_instance_popup, new LinearLayout(context), false);
|
||||||
CheckBox checkBox = item.findViewById(R.id.popup_domain);
|
CheckBox checkBox = item.findViewById(R.id.popup_domain);
|
||||||
checkBox.setText(pair.getKey().toString().trim());
|
checkBox.setText(pair.getKey().trim());
|
||||||
item.findViewById(R.id.popup_comment).setVisibility(View.GONE);
|
item.findViewById(R.id.popup_comment).setVisibility(View.GONE);
|
||||||
if (pair.getValue() != null) {
|
if (pair.getValue() != null) {
|
||||||
TextView textView = item.findViewById(R.id.comment_text);
|
TextView textView = item.findViewById(R.id.comment_text);
|
||||||
textView.setText(pair.getValue().toString());
|
textView.setText(pair.getValue());
|
||||||
textView.setVisibility(View.VISIBLE);
|
textView.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
linearLayout_main.addView(item);
|
linearLayout_main.addView(item);
|
||||||
|
@ -4289,15 +4285,15 @@ public class Helper {
|
||||||
if (domainBlocked.size() > 0) {
|
if (domainBlocked.size() > 0) {
|
||||||
new Thread() {
|
new Thread() {
|
||||||
public void run() {
|
public void run() {
|
||||||
Iterator it1 = domainBlocked.entrySet().iterator();
|
Iterator<Map.Entry<String, String>> it1 = domainBlocked.entrySet().iterator();
|
||||||
while (it1.hasNext()) {
|
while (it1.hasNext()) {
|
||||||
Map.Entry pair = (Map.Entry) it1.next();
|
Map.Entry<String, String> pair = it1.next();
|
||||||
try {
|
try {
|
||||||
sleep(200);
|
sleep(200);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
new PostActionAsyncTask(context, API.StatusAction.BLOCK_DOMAIN, pair.getKey().toString().trim(), ((MutedInstanceActivity) context)).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
new PostActionAsyncTask(context, API.StatusAction.BLOCK_DOMAIN, pair.getKey().trim(), ((MutedInstanceActivity) context)).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||||
it1.remove();
|
it1.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4404,6 +4400,62 @@ public class Helper {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void makeEmojis(Context context, View customTextView, SpannableString contentSpan, List<Emojis> emojis) {
|
||||||
|
|
||||||
|
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||||
|
boolean disableAnimatedEmoji = sharedpreferences.getBoolean(Helper.SET_DISABLE_ANIMATED_EMOJI, false);
|
||||||
|
|
||||||
|
if (emojis != null && emojis.size() > 0) {
|
||||||
|
for (final Emojis emoji : emojis) {
|
||||||
|
Glide.with(context)
|
||||||
|
.asDrawable()
|
||||||
|
.load(disableAnimatedEmoji ? emoji.getStatic_url() : emoji.getUrl())
|
||||||
|
.into(new CustomTarget<Drawable>() {
|
||||||
|
@Override
|
||||||
|
public void onResourceReady(@NonNull Drawable resource, @Nullable Transition<? super Drawable> transition) {
|
||||||
|
final String targetedEmoji = ":" + emoji.getShortcode() + ":";
|
||||||
|
if (contentSpan != null && contentSpan.toString().contains(targetedEmoji)) {
|
||||||
|
//emojis can be used several times so we have to loop
|
||||||
|
for (int startPosition = -1; (startPosition = contentSpan.toString().indexOf(targetedEmoji, startPosition + 1)) != -1; startPosition++) {
|
||||||
|
final int endPosition = startPosition + targetedEmoji.length();
|
||||||
|
if (endPosition <= contentSpan.toString().length() && endPosition >= startPosition) {
|
||||||
|
ImageSpan imageSpan;
|
||||||
|
try {
|
||||||
|
resource.setBounds(0, 0, (int) Helper.convertDpToPixel(20, context), (int) Helper.convertDpToPixel(20, context));
|
||||||
|
resource.setVisible(true, true);
|
||||||
|
imageSpan = new ImageSpan(resource);
|
||||||
|
contentSpan.setSpan(
|
||||||
|
imageSpan, startPosition,
|
||||||
|
endPosition, Spannable.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||||
|
if (customTextView instanceof CustomTextView) {
|
||||||
|
((CustomTextView) customTextView).setText(contentSpan, TextView.BufferType.SPANNABLE);
|
||||||
|
} else if (customTextView instanceof RadioButton) {
|
||||||
|
((RadioButton) customTextView).setText(contentSpan, TextView.BufferType.SPANNABLE);
|
||||||
|
} else if (customTextView instanceof CheckBox) {
|
||||||
|
((CheckBox) customTextView).setText(contentSpan, TextView.BufferType.SPANNABLE);
|
||||||
|
} else if (customTextView instanceof AppCompatTextView) {
|
||||||
|
((AppCompatTextView) customTextView).setText(contentSpan, TextView.BufferType.SPANNABLE);
|
||||||
|
} else if (customTextView instanceof TextView) {
|
||||||
|
((TextView) customTextView).setText(contentSpan, TextView.BufferType.SPANNABLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception ignored) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onLoadCleared(@Nullable Drawable placeholder) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//Event Type
|
//Event Type
|
||||||
public enum EventStreaming {
|
public enum EventStreaming {
|
||||||
UPDATE,
|
UPDATE,
|
||||||
|
@ -4412,6 +4464,7 @@ public class Helper {
|
||||||
NONE
|
NONE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public enum NotifType {
|
public enum NotifType {
|
||||||
FOLLLOW,
|
FOLLLOW,
|
||||||
MENTION,
|
MENTION,
|
||||||
|
@ -4423,7 +4476,6 @@ public class Helper {
|
||||||
TOOT
|
TOOT
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static class CacheTask extends AsyncTask<Void, Void, Void> {
|
public static class CacheTask extends AsyncTask<Void, Void, Void> {
|
||||||
private float cacheSize;
|
private float cacheSize;
|
||||||
private WeakReference<Context> contextReference;
|
private WeakReference<Context> contextReference;
|
||||||
|
@ -4512,61 +4564,4 @@ public class Helper {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void makeEmojis(Context context, View customTextView, SpannableString contentSpan, List<Emojis> emojis) {
|
|
||||||
|
|
||||||
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
|
||||||
boolean disableAnimatedEmoji = sharedpreferences.getBoolean(Helper.SET_DISABLE_ANIMATED_EMOJI, false);
|
|
||||||
|
|
||||||
if (emojis != null && emojis.size() > 0) {
|
|
||||||
for (final Emojis emoji : emojis) {
|
|
||||||
Glide.with(context)
|
|
||||||
.asDrawable()
|
|
||||||
.load(disableAnimatedEmoji ? emoji.getStatic_url() : emoji.getUrl())
|
|
||||||
.into(new CustomTarget<Drawable>() {
|
|
||||||
@Override
|
|
||||||
public void onResourceReady(@NonNull Drawable resource, @Nullable Transition<? super Drawable> transition) {
|
|
||||||
final String targetedEmoji = ":" + emoji.getShortcode() + ":";
|
|
||||||
if (contentSpan != null && contentSpan.toString().contains(targetedEmoji)) {
|
|
||||||
//emojis can be used several times so we have to loop
|
|
||||||
for (int startPosition = -1; (startPosition = contentSpan.toString().indexOf(targetedEmoji, startPosition + 1)) != -1; startPosition++) {
|
|
||||||
final int endPosition = startPosition + targetedEmoji.length();
|
|
||||||
if (endPosition <= contentSpan.toString().length() && endPosition >= startPosition) {
|
|
||||||
ImageSpan imageSpan;
|
|
||||||
try {
|
|
||||||
resource.setBounds(0, 0, (int) Helper.convertDpToPixel(20, context), (int) Helper.convertDpToPixel(20, context));
|
|
||||||
resource.setVisible(true, true);
|
|
||||||
imageSpan = new ImageSpan(resource);
|
|
||||||
contentSpan.setSpan(
|
|
||||||
imageSpan, startPosition,
|
|
||||||
endPosition, Spannable.SPAN_INCLUSIVE_EXCLUSIVE);
|
|
||||||
if( customTextView instanceof CustomTextView) {
|
|
||||||
((CustomTextView)customTextView).setText(contentSpan, TextView.BufferType.SPANNABLE);
|
|
||||||
}else if (customTextView instanceof RadioButton){
|
|
||||||
((RadioButton)customTextView).setText(contentSpan, TextView.BufferType.SPANNABLE);
|
|
||||||
}else if (customTextView instanceof CheckBox){
|
|
||||||
((CheckBox)customTextView).setText(contentSpan, TextView.BufferType.SPANNABLE);
|
|
||||||
}else if (customTextView instanceof AppCompatTextView){
|
|
||||||
((AppCompatTextView)customTextView).setText(contentSpan, TextView.BufferType.SPANNABLE);
|
|
||||||
}else if (customTextView instanceof TextView){
|
|
||||||
((TextView)customTextView).setText(contentSpan, TextView.BufferType.SPANNABLE);
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (Exception ignored) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onLoadCleared(@Nullable Drawable placeholder) {
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,6 @@ import android.widget.TextView;
|
||||||
//https://stackoverflow.com/a/20435892
|
//https://stackoverflow.com/a/20435892
|
||||||
public class LongClickLinkMovementMethod extends LinkMovementMethod {
|
public class LongClickLinkMovementMethod extends LinkMovementMethod {
|
||||||
|
|
||||||
private static int LONG_CLICK_TIME = 1000;
|
|
||||||
private static LongClickLinkMovementMethod sInstance;
|
private static LongClickLinkMovementMethod sInstance;
|
||||||
private Handler mLongClickHandler;
|
private Handler mLongClickHandler;
|
||||||
private boolean mIsLongPressed = false;
|
private boolean mIsLongPressed = false;
|
||||||
|
@ -68,13 +67,11 @@ public class LongClickLinkMovementMethod extends LinkMovementMethod {
|
||||||
Selection.setSelection(buffer,
|
Selection.setSelection(buffer,
|
||||||
buffer.getSpanStart(link[0]),
|
buffer.getSpanStart(link[0]),
|
||||||
buffer.getSpanEnd(link[0]));
|
buffer.getSpanEnd(link[0]));
|
||||||
mLongClickHandler.postDelayed(new Runnable() {
|
int LONG_CLICK_TIME = 1000;
|
||||||
@Override
|
mLongClickHandler.postDelayed(() -> {
|
||||||
public void run() {
|
link[0].onLongClick(widget);
|
||||||
link[0].onLongClick(widget);
|
mIsLongPressed = true;
|
||||||
mIsLongPressed = true;
|
widget.invalidate();
|
||||||
widget.invalidate();
|
|
||||||
}
|
|
||||||
}, LONG_CLICK_TIME);
|
}, LONG_CLICK_TIME);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -5,6 +5,7 @@ import android.content.Context;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.content.res.TypedArray;
|
import android.content.res.TypedArray;
|
||||||
import android.graphics.Paint;
|
import android.graphics.Paint;
|
||||||
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
|
@ -14,7 +15,6 @@ import android.view.inputmethod.InputConnection;
|
||||||
import androidx.annotation.CallSuper;
|
import androidx.annotation.CallSuper;
|
||||||
import androidx.annotation.DimenRes;
|
import androidx.annotation.DimenRes;
|
||||||
import androidx.annotation.Px;
|
import androidx.annotation.Px;
|
||||||
import androidx.core.os.BuildCompat;
|
|
||||||
import androidx.core.view.inputmethod.EditorInfoCompat;
|
import androidx.core.view.inputmethod.EditorInfoCompat;
|
||||||
import androidx.core.view.inputmethod.InputConnectionCompat;
|
import androidx.core.view.inputmethod.InputConnectionCompat;
|
||||||
import androidx.core.view.inputmethod.InputContentInfoCompat;
|
import androidx.core.view.inputmethod.InputContentInfoCompat;
|
||||||
|
@ -39,7 +39,7 @@ public class MastalabAutoCompleteTextView extends androidx.appcompat.widget.AppC
|
||||||
int flags, Bundle opts) {
|
int flags, Bundle opts) {
|
||||||
|
|
||||||
// read and display inputContentInfo asynchronously
|
// read and display inputContentInfo asynchronously
|
||||||
if (BuildCompat.isAtLeastNMR1() && (flags &
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1 && (flags &
|
||||||
InputConnectionCompat.INPUT_CONTENT_GRANT_READ_URI_PERMISSION) != 0) {
|
InputConnectionCompat.INPUT_CONTENT_GRANT_READ_URI_PERMISSION) != 0) {
|
||||||
try {
|
try {
|
||||||
inputContentInfo.requestPermission();
|
inputContentInfo.requestPermission();
|
||||||
|
@ -118,10 +118,12 @@ public class MastalabAutoCompleteTextView extends androidx.appcompat.widget.AppC
|
||||||
this.keyBoardInputCallbackListener = keyBoardInputCallbackListener;
|
this.keyBoardInputCallbackListener = keyBoardInputCallbackListener;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
public String[] getImgTypeString() {
|
public String[] getImgTypeString() {
|
||||||
return imgTypeString;
|
return imgTypeString;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
public void setImgTypeString(String[] imgTypeString) {
|
public void setImgTypeString(String[] imgTypeString) {
|
||||||
this.imgTypeString = imgTypeString;
|
this.imgTypeString = imgTypeString;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,6 @@ package app.fedilab.android.helper;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
|
|
||||||
import android.view.Gravity;
|
import android.view.Gravity;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
@ -47,7 +46,8 @@ public class MenuFloating extends com.oguzdev.circularfloatingactionmenu.library
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Attaches it to the content view with specified LayoutParams.
|
* Attaches it to the content view with specified LayoutParams.
|
||||||
* @param view View
|
*
|
||||||
|
* @param view View
|
||||||
* @param layoutParams ViewGroup.LayoutParams
|
* @param layoutParams ViewGroup.LayoutParams
|
||||||
*/
|
*/
|
||||||
public void attach(View view, ViewGroup.LayoutParams layoutParams) {
|
public void attach(View view, ViewGroup.LayoutParams layoutParams) {
|
||||||
|
|
Loading…
Reference in New Issue