Merge branch 'clean' into develop
This commit is contained in:
commit
1593849e37
|
@ -1,2 +1,5 @@
|
|||
Changed:
|
||||
- Max char with media descriptions increased to 1500
|
||||
|
||||
Fixed:
|
||||
- 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);
|
||||
|
||||
|
||||
if( dateIni == null){
|
||||
if (dateIni == null) {
|
||||
dateIni = new Date();
|
||||
dateEnd = new Date();
|
||||
}
|
||||
|
@ -417,7 +417,7 @@ public class OwnerChartsActivity extends BaseActivity implements OnRetrieveChart
|
|||
@Override
|
||||
public MPPointF getOffset() {
|
||||
if (mOffset == null) {
|
||||
mOffset = new MPPointF(-((float)getWidth() / 2), -getHeight());
|
||||
mOffset = new MPPointF(-((float) getWidth() / 2), -getHeight());
|
||||
}
|
||||
return mOffset;
|
||||
}
|
||||
|
|
|
@ -504,7 +504,7 @@ public class OwnerNotificationChartsActivity extends BaseActivity implements OnR
|
|||
@Override
|
||||
public MPPointF getOffset() {
|
||||
if (mOffset == null) {
|
||||
mOffset = new MPPointF(-((float)getWidth() / 2), -getHeight());
|
||||
mOffset = new MPPointF(-((float) getWidth() / 2), -getHeight());
|
||||
}
|
||||
return mOffset;
|
||||
}
|
||||
|
|
|
@ -67,7 +67,6 @@ import app.fedilab.android.asynctasks.RetrieveFeedsAsyncTask;
|
|||
import app.fedilab.android.asynctasks.RetrieveStatsAsyncTask;
|
||||
import app.fedilab.android.client.APIResponse;
|
||||
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.Status;
|
||||
import app.fedilab.android.client.Entities.StatusDrawerParams;
|
||||
|
|
|
@ -18,6 +18,7 @@ import android.Manifest;
|
|||
import android.annotation.SuppressLint;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Typeface;
|
||||
import android.net.Uri;
|
||||
|
@ -33,6 +34,8 @@ import androidx.annotation.NonNull;
|
|||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
import androidx.constraintlayout.widget.ConstraintSet;
|
||||
import androidx.core.app.ActivityCompat;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.exifinterface.media.ExifInterface;
|
||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
|
@ -74,6 +77,7 @@ public class PhotoEditorActivity extends BaseActivity implements OnPhotoEditorLi
|
|||
|
||||
private static final int CAMERA_REQUEST = 52;
|
||||
private static final int PICK_REQUEST = 53;
|
||||
private final int STORE_REQUEST = 54;
|
||||
private PhotoEditor mPhotoEditor;
|
||||
private PhotoEditorView mPhotoEditorView;
|
||||
private PropertiesBSFragment mPropertiesBSFragment;
|
||||
|
@ -302,6 +306,13 @@ public class PhotoEditorActivity extends BaseActivity implements OnPhotoEditorLi
|
|||
.setClearViewsEnabled(true)
|
||||
.setTransparencyEnabled(true)
|
||||
.build();
|
||||
if (ContextCompat.checkSelfPermission(PhotoEditorActivity.this, Manifest.permission.READ_EXTERNAL_STORAGE) !=
|
||||
PackageManager.PERMISSION_GRANTED) {
|
||||
ActivityCompat.requestPermissions(PhotoEditorActivity.this,
|
||||
new String[]{Manifest.permission.READ_EXTERNAL_STORAGE},
|
||||
STORE_REQUEST);
|
||||
return;
|
||||
}
|
||||
mPhotoEditor.saveAsFile(file.getAbsolutePath(), saveSettings, new PhotoEditor.OnSaveListener() {
|
||||
@Override
|
||||
public void onSuccess(@NonNull String imagePath) {
|
||||
|
@ -332,6 +343,18 @@ public class PhotoEditorActivity extends BaseActivity implements OnPhotoEditorLi
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRequestPermissionsResult(int requestCode,
|
||||
@NonNull String[] permissions, @NonNull int[] grantResults) {
|
||||
if (requestCode == STORE_REQUEST) {// If request is cancelled, the result arrays are empty.
|
||||
if (grantResults.length > 0
|
||||
&& grantResults[0] == PackageManager.PERMISSION_GRANTED) {
|
||||
// We have the permission.
|
||||
saveImage();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
|
|
|
@ -254,8 +254,7 @@ public class PixelfedComposeActivity extends BaseActivity implements UploadStatu
|
|||
final int[] currentCursorPosition = {toot_content.getSelectionStart()};
|
||||
final String[] newContent = {null};
|
||||
final int[] searchLength = {searchDeep};
|
||||
TextWatcher textw = null;
|
||||
TextWatcher finalTextw = textw;
|
||||
TextWatcher textw;
|
||||
textw = new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||
|
@ -270,7 +269,7 @@ public class PixelfedComposeActivity extends BaseActivity implements UploadStatu
|
|||
public void afterTextChanged(Editable s) {
|
||||
|
||||
if (autocomplete) {
|
||||
toot_content.removeTextChangedListener(finalTextw);
|
||||
toot_content.removeTextChangedListener(this);
|
||||
Thread thread = new Thread() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
@ -697,6 +696,9 @@ public class PixelfedComposeActivity extends BaseActivity implements UploadStatu
|
|||
}
|
||||
restored = b.getLong("restored", -1);
|
||||
}
|
||||
if (!sharedUri.isEmpty()) {
|
||||
uploadSharedImage(sharedUri);
|
||||
}
|
||||
if (scheduledstatus != null)
|
||||
toot_it.setText(R.string.modify);
|
||||
if (restoredScheduled) {
|
||||
|
|
|
@ -92,13 +92,13 @@ public class SlideMediaActivity extends BaseFragmentActivity implements OnDownlo
|
|||
Intent shareIntent = new Intent(Intent.ACTION_SEND);
|
||||
shareIntent.putExtra(Intent.EXTRA_STREAM, uri);
|
||||
ContentResolver cR = context.getContentResolver();
|
||||
if( cR != null && uri != null) {
|
||||
if (cR != null && uri != null) {
|
||||
shareIntent.setType(cR.getType(uri));
|
||||
try {
|
||||
startActivity(shareIntent);
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
}else {
|
||||
} else {
|
||||
Toasty.error(context, context.getString(R.string.toast_error), Toasty.LENGTH_LONG).show();
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -330,7 +330,7 @@ public class TootActivity extends BaseActivity implements UploadStatusDelegate,
|
|||
final String[] newContent = {null};
|
||||
final int[] searchLength = {searchDeep};
|
||||
TextWatcher textw = null;
|
||||
TextWatcher finalTextw = textw;
|
||||
|
||||
textw = new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||
|
@ -348,7 +348,7 @@ public class TootActivity extends BaseActivity implements UploadStatusDelegate,
|
|||
status.setQuickReplyContent(s.toString());
|
||||
}
|
||||
if (autocomplete) {
|
||||
toot_content.removeTextChangedListener(finalTextw);
|
||||
toot_content.removeTextChangedListener(this);
|
||||
Thread thread = new Thread() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
@ -2360,7 +2360,7 @@ public class TootActivity extends BaseActivity implements UploadStatusDelegate,
|
|||
|
||||
//Text for report
|
||||
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);
|
||||
Glide.with(TootActivity.this)
|
||||
.asBitmap()
|
||||
|
@ -3236,7 +3236,7 @@ public class TootActivity extends BaseActivity implements UploadStatusDelegate,
|
|||
toot_cw_content.setText("");
|
||||
toot_cw_content.setVisibility(View.GONE);
|
||||
}
|
||||
if( status.getVisibility() == null) {
|
||||
if (status.getVisibility() == null) {
|
||||
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
|
||||
String defaultVisibility = account.isLocked() ? "private" : "public";
|
||||
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<>();
|
||||
try {
|
||||
JSONArray emojisPoll= resobj.getJSONArray("emojis");
|
||||
JSONArray emojisPoll = resobj.getJSONArray("emojis");
|
||||
for (int j = 0; j < emojisPoll.length(); j++) {
|
||||
JSONObject emojisObj = emojisPoll.getJSONObject(j);
|
||||
Emojis emojis = parseEmojis(emojisObj);
|
||||
|
@ -1452,7 +1452,7 @@ public class API {
|
|||
}
|
||||
|
||||
try {
|
||||
if( resobj.has("fields") && resobj.get("fields") instanceof JSONArray) {
|
||||
if (resobj.has("fields") && resobj.get("fields") instanceof JSONArray) {
|
||||
JSONArray fields = resobj.getJSONArray("fields");
|
||||
LinkedHashMap<String, String> fieldsMap = new LinkedHashMap<>();
|
||||
LinkedHashMap<String, Boolean> fieldsMapVerified = new LinkedHashMap<>();
|
||||
|
@ -2452,8 +2452,8 @@ public class API {
|
|||
Iterator<Map.Entry<String, String>> it = customFields.entrySet().iterator();
|
||||
while (it.hasNext()) {
|
||||
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());
|
||||
requestParams.put("fields_attributes[" + i + "][name]", pair.getKey());
|
||||
requestParams.put("fields_attributes[" + i + "][value]", pair.getValue());
|
||||
it.remove();
|
||||
i++;
|
||||
}
|
||||
|
|
|
@ -78,7 +78,6 @@ public class APIResponse {
|
|||
private Context context = null;
|
||||
private List<PixelFedStory> pixelFedStories = null;
|
||||
private List<PixelFedStoryItem> pixelFedStoryItems = null;
|
||||
private PixelFedStory pixelFedStory = null;
|
||||
private List<Trends> trends = null;
|
||||
private List<IdentityProof> identityProofs = null;
|
||||
|
||||
|
|
|
@ -47,7 +47,6 @@ import com.bumptech.glide.request.transition.Transition;
|
|||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.Iterator;
|
||||
|
|
|
@ -74,7 +74,7 @@ public class PollOptions implements Parcelable {
|
|||
}
|
||||
|
||||
public SpannableString getTitleSpan() {
|
||||
if( titleSpan == null) {
|
||||
if (titleSpan == null) {
|
||||
titleSpan = new SpannableString(title);
|
||||
}
|
||||
return titleSpan;
|
||||
|
|
|
@ -52,11 +52,7 @@ import androidx.core.content.ContextCompat;
|
|||
import androidx.preference.PreferenceManager;
|
||||
|
||||
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.Target;
|
||||
import com.bumptech.glide.request.transition.Transition;
|
||||
|
||||
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.LongClickableSpan;
|
||||
import app.fedilab.android.helper.ThemeHelper;
|
||||
import app.fedilab.android.interfaces.OnRetrieveEmojiInterface;
|
||||
import es.dmoral.toasty.Toasty;
|
||||
|
||||
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();
|
||||
while (it.hasNext()) {
|
||||
Map.Entry<String, Account> pair = it.next();
|
||||
String key = pair.getKey();
|
||||
String key = pair.getKey();
|
||||
Account account = pair.getValue();
|
||||
String targetedAccount = "@" + account.getAcct();
|
||||
if (spannableStringT.toString().toLowerCase().contains(targetedAccount.toLowerCase())) {
|
||||
|
@ -947,7 +942,6 @@ public class Status implements Parcelable {
|
|||
}
|
||||
|
||||
|
||||
|
||||
private static void replaceQuoteSpans(Context context, Spannable spannable) {
|
||||
QuoteSpan[] quoteSpans = spannable.getSpans(0, spannable.length(), QuoteSpan.class);
|
||||
for (QuoteSpan quoteSpan : quoteSpans) {
|
||||
|
|
|
@ -1476,24 +1476,20 @@ public class GNUAPI {
|
|||
case FAVOURITE:
|
||||
if (MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.GNU) {
|
||||
action = "/favorites/create.json";
|
||||
params = new HashMap<>();
|
||||
params.put("id", targetedId);
|
||||
} else {
|
||||
action = "/friendica/activity/like.json";
|
||||
params = new HashMap<>();
|
||||
params.put("id", targetedId);
|
||||
}
|
||||
params = new HashMap<>();
|
||||
params.put("id", targetedId);
|
||||
break;
|
||||
case UNFAVOURITE:
|
||||
if (MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.GNU) {
|
||||
action = "/favorites/destroy.json";
|
||||
params = new HashMap<>();
|
||||
params.put("id", targetedId);
|
||||
} else {
|
||||
action = "/friendica/activity/unlike.json";
|
||||
params = new HashMap<>();
|
||||
params.put("id", targetedId);
|
||||
}
|
||||
params = new HashMap<>();
|
||||
params.put("id", targetedId);
|
||||
break;
|
||||
case REBLOG:
|
||||
action = String.format("/statuses/retweet/%s.json", targetedId);
|
||||
|
|
|
@ -147,10 +147,10 @@ public class HttpsConnection {
|
|||
|
||||
Map<String, Object> params = new LinkedHashMap<>();
|
||||
if (paramaters != null) {
|
||||
Iterator it = paramaters.entrySet().iterator();
|
||||
Iterator<Map.Entry<String, String>> it = paramaters.entrySet().iterator();
|
||||
while (it.hasNext()) {
|
||||
Map.Entry pair = (Map.Entry) it.next();
|
||||
params.put(pair.getKey().toString(), pair.getValue());
|
||||
Map.Entry<String, String> pair = it.next();
|
||||
params.put(pair.getKey(), pair.getValue());
|
||||
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 {
|
||||
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://")) {
|
||||
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)
|
||||
httpsURLConnection = (HttpsURLConnection) url.openConnection(proxy);
|
||||
else
|
||||
|
@ -429,25 +429,6 @@ public class HttpsConnection {
|
|||
httpsURLConnection.getInputStream().close();
|
||||
return response;
|
||||
} 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)
|
||||
httpURLConnection = (HttpURLConnection) url.openConnection(proxy);
|
||||
else
|
||||
|
@ -499,10 +480,12 @@ public class HttpsConnection {
|
|||
|
||||
|
||||
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://")) {
|
||||
URL url = new URL(urlConnection);
|
||||
byte[] postDataBytes;
|
||||
postDataBytes = jsonObject.toString().getBytes(StandardCharsets.UTF_8);
|
||||
|
||||
if (proxy != null)
|
||||
httpsURLConnection = (HttpsURLConnection) url.openConnection(proxy);
|
||||
else
|
||||
|
@ -553,9 +536,6 @@ public class HttpsConnection {
|
|||
httpsURLConnection.getInputStream().close();
|
||||
return response;
|
||||
} else {
|
||||
URL url = new URL(urlConnection);
|
||||
byte[] postDataBytes = jsonObject.toString().getBytes(StandardCharsets.UTF_8);
|
||||
|
||||
if (proxy != null)
|
||||
httpURLConnection = (HttpURLConnection) url.openConnection(proxy);
|
||||
else
|
||||
|
@ -812,9 +792,15 @@ public class HttpsConnection {
|
|||
|
||||
|
||||
public InputStream getPicture(final String downloadUrl) {
|
||||
|
||||
URL url;
|
||||
try {
|
||||
url = new URL(downloadUrl);
|
||||
} catch (MalformedURLException e) {
|
||||
return null;
|
||||
}
|
||||
if (downloadUrl.startsWith("https://")) {
|
||||
try {
|
||||
URL url = new URL(downloadUrl);
|
||||
if (proxy != null)
|
||||
httpsURLConnection = (HttpsURLConnection) url.openConnection(proxy);
|
||||
else
|
||||
|
@ -835,10 +821,8 @@ public class HttpsConnection {
|
|||
httpsURLConnection.getInputStream().close();
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
return null;
|
||||
} else {
|
||||
try {
|
||||
URL url = new URL(downloadUrl);
|
||||
if (proxy != null)
|
||||
httpURLConnection = (HttpURLConnection) url.openConnection(proxy);
|
||||
else
|
||||
|
@ -858,8 +842,8 @@ public class HttpsConnection {
|
|||
httpURLConnection.getInputStream().close();
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private void uploadMedia(String urlConnection, InputStream avatar, InputStream header, String filename) {
|
||||
|
@ -923,27 +907,27 @@ public class HttpsConnection {
|
|||
|
||||
@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 {
|
||||
|
||||
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://")) {
|
||||
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)
|
||||
httpsURLConnection = (HttpsURLConnection) url.openConnection(proxy);
|
||||
else
|
||||
|
@ -1006,25 +990,6 @@ public class HttpsConnection {
|
|||
httpsURLConnection.getInputStream().close();
|
||||
return response;
|
||||
} 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)
|
||||
httpURLConnection = (HttpsURLConnection) url.openConnection(proxy);
|
||||
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 {
|
||||
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)
|
||||
httpsURLConnection = (HttpsURLConnection) url.openConnection(proxy);
|
||||
else
|
||||
|
@ -1157,25 +1123,6 @@ public class HttpsConnection {
|
|||
httpsURLConnection.getInputStream().close();
|
||||
return response;
|
||||
} 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)
|
||||
httpURLConnection = (HttpURLConnection) url.openConnection(proxy);
|
||||
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 {
|
||||
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)
|
||||
httpsURLConnection = (HttpsURLConnection) url.openConnection(proxy);
|
||||
else
|
||||
|
@ -1292,25 +1240,6 @@ public class HttpsConnection {
|
|||
throw new HttpsConnectionException(responseCode, error);
|
||||
}
|
||||
} 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)
|
||||
httpURLConnection = (HttpURLConnection) url.openConnection(proxy);
|
||||
else
|
||||
|
|
|
@ -47,6 +47,8 @@ import app.fedilab.android.helper.Helper;
|
|||
import app.fedilab.android.interfaces.OnPostActionInterface;
|
||||
import es.dmoral.toasty.Toasty;
|
||||
|
||||
import static app.fedilab.android.helper.Helper.makeEmojis;
|
||||
|
||||
|
||||
/**
|
||||
* Created by Thomas on 03/09/2017.
|
||||
|
@ -125,6 +127,7 @@ public class AccountSearchDevAdapter extends BaseAdapter implements OnPostAction
|
|||
}
|
||||
} else {
|
||||
holder.account_dn.setText(account.getDisplay_name());
|
||||
makeEmojis(context, holder.account_dn, account.getDisplayNameSpan(), account.getEmojis());
|
||||
holder.account_un.setText(account.getAcct());
|
||||
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.interfaces.OnRetrieveEmojiAccountInterface;
|
||||
|
||||
import static app.fedilab.android.helper.Helper.makeEmojis;
|
||||
|
||||
|
||||
/**
|
||||
* Created by Thomas on 19/06/2019.
|
||||
|
@ -74,8 +76,11 @@ public class AccountsAdminListAdapter extends RecyclerView.Adapter<RecyclerView.
|
|||
else if (account.getDisplay_name() != null) {
|
||||
holder.account_dn.setText(account.getDisplay_name().replace("@", ""));
|
||||
}
|
||||
} else
|
||||
} else {
|
||||
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.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 es.dmoral.toasty.Toasty;
|
||||
|
||||
import static app.fedilab.android.helper.Helper.makeEmojis;
|
||||
|
||||
|
||||
/**
|
||||
* 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.account_dn.setText(account.getDisplay_name());
|
||||
makeEmojis(context, holder.account_dn, account.getDisplayNameSpan(), account.getEmojis());
|
||||
holder.account_un.setText(account.getAcct());
|
||||
//Profile picture
|
||||
Glide.with(holder.account_pp.getContext())
|
||||
|
|
|
@ -45,6 +45,8 @@ import app.fedilab.android.helper.Helper;
|
|||
import app.fedilab.android.interfaces.OnListActionInterface;
|
||||
import es.dmoral.toasty.Toasty;
|
||||
|
||||
import static app.fedilab.android.helper.Helper.makeEmojis;
|
||||
|
||||
|
||||
/**
|
||||
* 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());
|
||||
makeEmojis(context, holder.account_un, account.getDisplayNameSpan(), account.getEmojis());
|
||||
holder.account_ac.setText(account.getAcct());
|
||||
if (account.getDisplay_name().equals(account.getAcct()))
|
||||
holder.account_ac.setVisibility(View.GONE);
|
||||
|
|
|
@ -60,6 +60,8 @@ import app.fedilab.android.sqlite.InstancesDAO;
|
|||
import app.fedilab.android.sqlite.Sqlite;
|
||||
import es.dmoral.toasty.Toasty;
|
||||
|
||||
import static app.fedilab.android.helper.Helper.makeEmojis;
|
||||
|
||||
|
||||
/**
|
||||
* 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());
|
||||
else
|
||||
holder.account_dn.setText(account.getUsername().replace("@", ""));
|
||||
} else
|
||||
} else {
|
||||
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_ac.setText(account.getAcct());
|
||||
if (account.getUsername().equals(account.getAcct()))
|
||||
|
|
|
@ -58,6 +58,7 @@ import app.fedilab.android.sqlite.StatusCacheDAO;
|
|||
import es.dmoral.toasty.Toasty;
|
||||
|
||||
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);
|
||||
});
|
||||
|
||||
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);
|
||||
else
|
||||
makeEmojis(context, holder.art_username, status.getAccount().getDisplayNameSpan(), status.getAccount().getEmojis());
|
||||
} else
|
||||
holder.art_username.setText(status.getAccount().getUsername());
|
||||
|
||||
holder.art_acct.setText(String.format("@%s", status.getAccount().getAcct()));
|
||||
|
|
|
@ -88,7 +88,9 @@ public class CustomEmojiAdapter extends BaseAdapter {
|
|||
@Override
|
||||
public void onResourceReady(@NonNull Drawable resource, @Nullable Transition<? super Drawable> transition) {
|
||||
emoji.setDrawable(resource);
|
||||
imageView.setImageDrawable(emoji.getDrawable());
|
||||
if( imageView != null && emoji.getDrawable() != null) {
|
||||
imageView.setImageDrawable(emoji.getDrawable());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -111,6 +111,7 @@ import es.dmoral.toasty.Toasty;
|
|||
|
||||
import static android.content.Context.MODE_PRIVATE;
|
||||
import static app.fedilab.android.activities.BaseMainActivity.social;
|
||||
import static app.fedilab.android.helper.Helper.makeEmojis;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -261,7 +262,7 @@ public class NotificationsListAdapter extends RecyclerView.Adapter<RecyclerView.
|
|||
else
|
||||
typeString = String.format("@%s %s", notification.getAccount().getUsername(), context.getString(R.string.notif_mention));
|
||||
imgH = ContextCompat.getDrawable(context, R.drawable.ic_chat_bubble_outline);
|
||||
if (notification.getStatus().getVisibility().equals("direct")) {
|
||||
if (notification.getStatus() != null && notification.getStatus().getVisibility().equals("direct")) {
|
||||
holder.main_container_trans.setVisibility(View.GONE);
|
||||
} else {
|
||||
holder.main_container_trans.setVisibility(View.VISIBLE);
|
||||
|
@ -322,8 +323,10 @@ public class NotificationsListAdapter extends RecyclerView.Adapter<RecyclerView.
|
|||
if (notification.getAccount().getDisplayNameSpan() == null) {
|
||||
holder.notification_type.setText(typeString);
|
||||
notification.getAccount().setStored_displayname(notification.getAccount().getDisplay_name());
|
||||
} else
|
||||
holder.notification_type.setText(notification.getAccount().getDisplayNameSpan(), TextView.BufferType.SPANNABLE);
|
||||
} else {
|
||||
holder.notification_type.setText(typeString, TextView.BufferType.SPANNABLE);
|
||||
makeEmojis(context, holder.notification_type, notification.getAccount().getDisplayNameSpan(), notification.getAccount().getEmojis());
|
||||
}
|
||||
|
||||
if (imgH != null) {
|
||||
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.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.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);
|
||||
poll_item_percent.setText(String.format("%s %%", (int) value));
|
||||
poll_item_text.setText(pollOption.getTitle(), TextView.BufferType.SPANNABLE);
|
||||
makeEmojis(context, poll_item_text, pollOption.getTitleSpan(), poll.getEmojis());
|
||||
poll_item_value.setProgress((int) value);
|
||||
holder.rated.addView(item);
|
||||
if (pollOption.getVotes_count() == greaterValue) {
|
||||
|
@ -564,6 +569,7 @@ public class NotificationsListAdapter extends RecyclerView.Adapter<RecyclerView.
|
|||
for (PollOptions pollOption : poll.getOptionsList()) {
|
||||
CheckBox cb = new CheckBox(context);
|
||||
cb.setText(pollOption.getTitle());
|
||||
makeEmojis(context, cb, pollOption.getTitleSpan(), poll.getEmojis());
|
||||
holder.multiple_choice.addView(cb);
|
||||
}
|
||||
holder.multiple_choice.setVisibility(View.VISIBLE);
|
||||
|
@ -573,6 +579,7 @@ public class NotificationsListAdapter extends RecyclerView.Adapter<RecyclerView.
|
|||
for (PollOptions pollOption : poll.getOptionsList()) {
|
||||
RadioButton rb = new RadioButton(context);
|
||||
rb.setText(pollOption.getTitle());
|
||||
makeEmojis(context, rb, pollOption.getTitleSpan(), poll.getEmojis());
|
||||
holder.radio_group.addView(rb);
|
||||
}
|
||||
holder.single_choice.setVisibility(View.VISIBLE);
|
||||
|
|
|
@ -114,7 +114,6 @@ import es.dmoral.toasty.Toasty;
|
|||
import static android.content.Context.MODE_PRIVATE;
|
||||
import static app.fedilab.android.activities.BaseMainActivity.mutedAccount;
|
||||
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
|
||||
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);
|
||||
Glide.with(contextWeakReference.get())
|
||||
.asBitmap()
|
||||
|
|
|
@ -1558,7 +1558,7 @@ public class StatusListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
|
|||
holder.status_content.setText(status.getContentSpan(), 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());
|
||||
|
@ -1614,7 +1614,7 @@ public class StatusListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
|
|||
if (status.getReblog().getAccount().getDisplay_name().length() > 0) {
|
||||
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());
|
||||
}else
|
||||
} else
|
||||
holder.status_account_displayname_owner.setText(status.getReblog().getAccount().getAcct().replace("@", ""));
|
||||
|
||||
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);
|
||||
if (displayNameSpan == null || displayNameSpan.toString().trim().length() == 0) {
|
||||
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);
|
||||
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);
|
||||
|
||||
}
|
||||
if( type == RetrieveFeedsAsyncTask.Type.CONTEXT ){
|
||||
if (type == RetrieveFeedsAsyncTask.Type.CONTEXT) {
|
||||
holder.fetch_more.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
|
@ -3956,7 +3955,7 @@ public class StatusListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
|
|||
status.setTranslationShown(true);
|
||||
status.setContentTranslated(translate.getTranslatedContent());
|
||||
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);
|
||||
} else {
|
||||
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();
|
||||
tendency.put(_th.getDays(), _th.getUses());
|
||||
}
|
||||
if( days > 0 ) {
|
||||
if (days > 0) {
|
||||
people = people / 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);
|
||||
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);
|
||||
|
@ -784,7 +784,7 @@ public class CrossActions {
|
|||
* @param action int
|
||||
* @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;
|
||||
if (action == API.StatusAction.FAVOURITE) {
|
||||
|
@ -855,7 +855,7 @@ public class CrossActions {
|
|||
* @param action int
|
||||
* @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;
|
||||
if (action == API.StatusAction.FAVOURITE) {
|
||||
|
@ -950,7 +950,7 @@ public class CrossActions {
|
|||
*
|
||||
* @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()) {
|
||||
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;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public FullScreenMediaController(Context context, Peertube peertube) {
|
||||
super(context);
|
||||
this.peertube = peertube;
|
||||
|
@ -80,12 +81,7 @@ public class FullScreenMediaController extends MediaController {
|
|||
paramsButton.gravity = Gravity.START;
|
||||
paramsButton.rightMargin = 80;
|
||||
paramsButton.topMargin = 22;
|
||||
resolution.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
((PeertubeActivity) getContext()).displayResolution();
|
||||
}
|
||||
});
|
||||
resolution.setOnClickListener(v -> ((PeertubeActivity) getContext()).displayResolution());
|
||||
addView(resolution, paramsButton);
|
||||
|
||||
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
|
||||
fullScreen.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
fullScreen.setOnClickListener(v -> {
|
||||
|
||||
if (((PeertubeActivity) getContext()).getFullscreen() == fullscreen.ON) {
|
||||
((PeertubeActivity) getContext()).setFullscreen(fullscreen.OFF);
|
||||
} else {
|
||||
((PeertubeActivity) getContext()).setFullscreen(fullscreen.ON);
|
||||
}
|
||||
((PeertubeActivity) getContext()).change();
|
||||
changeIcon();
|
||||
if (((PeertubeActivity) getContext()).getFullscreen() == fullscreen.ON) {
|
||||
((PeertubeActivity) getContext()).setFullscreen(fullscreen.OFF);
|
||||
} else {
|
||||
((PeertubeActivity) getContext()).setFullscreen(fullscreen.ON);
|
||||
}
|
||||
((PeertubeActivity) getContext()).change();
|
||||
changeIcon();
|
||||
});
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public void setResolutionVal(String resolutionVal) {
|
||||
this.resolutionVal = resolutionVal;
|
||||
if (resolution != null)
|
||||
|
|
|
@ -1643,12 +1643,7 @@ public class Helper {
|
|||
|
||||
public static <K, V> Map<K, V> sortByValue(Map<K, V> map) {
|
||||
List<Map.Entry<K, V>> list = new LinkedList<>(map.entrySet());
|
||||
Collections.sort(list, new Comparator<Object>() {
|
||||
@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());
|
||||
}
|
||||
});
|
||||
Collections.sort(list, (Comparator<Object>) (o2, o1) -> ((Comparable<V>) ((Map.Entry<K, V>) (o1)).getValue()).compareTo(((Map.Entry<K, V>) (o2)).getValue()));
|
||||
|
||||
Map<K, V> result = new LinkedHashMap<>();
|
||||
for (Map.Entry<K, V> entry : list) {
|
||||
|
@ -2659,7 +2654,8 @@ public class Helper {
|
|||
public static List<String> restoreArrayFromString(String serializedArray) {
|
||||
Gson gson = new Gson();
|
||||
try {
|
||||
Type listType = new TypeToken<ArrayList<String>>() {}.getType();
|
||||
Type listType = new TypeToken<ArrayList<String>>() {
|
||||
}.getType();
|
||||
return gson.fromJson(serializedArray, listType);
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
|
@ -4205,12 +4201,12 @@ public class Helper {
|
|||
fw.append(',');
|
||||
fw.append("COMMENT");
|
||||
fw.append('\n');
|
||||
Iterator it = domainBlocked.entrySet().iterator();
|
||||
Iterator<Map.Entry<String, String>> it = domainBlocked.entrySet().iterator();
|
||||
while (it.hasNext()) {
|
||||
Map.Entry pair = (Map.Entry) it.next();
|
||||
fw.append((String) pair.getKey());
|
||||
Map.Entry<String, String> pair = it.next();
|
||||
fw.append(pair.getKey());
|
||||
fw.append(',');
|
||||
fw.append((String) pair.getValue());
|
||||
fw.append(pair.getValue());
|
||||
fw.append('\n');
|
||||
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.setOrientation(LinearLayout.VERTICAL);
|
||||
Iterator it = instances.entrySet().iterator();
|
||||
Iterator<Map.Entry<String, String>> it = instances.entrySet().iterator();
|
||||
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);
|
||||
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);
|
||||
if (pair.getValue() != null) {
|
||||
TextView textView = item.findViewById(R.id.comment_text);
|
||||
textView.setText(pair.getValue().toString());
|
||||
textView.setText(pair.getValue());
|
||||
textView.setVisibility(View.VISIBLE);
|
||||
}
|
||||
linearLayout_main.addView(item);
|
||||
|
@ -4289,15 +4285,15 @@ public class Helper {
|
|||
if (domainBlocked.size() > 0) {
|
||||
new Thread() {
|
||||
public void run() {
|
||||
Iterator it1 = domainBlocked.entrySet().iterator();
|
||||
Iterator<Map.Entry<String, String>> it1 = domainBlocked.entrySet().iterator();
|
||||
while (it1.hasNext()) {
|
||||
Map.Entry pair = (Map.Entry) it1.next();
|
||||
Map.Entry<String, String> pair = it1.next();
|
||||
try {
|
||||
sleep(200);
|
||||
} catch (InterruptedException e) {
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
@ -4404,6 +4400,62 @@ public class Helper {
|
|||
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
|
||||
public enum EventStreaming {
|
||||
UPDATE,
|
||||
|
@ -4412,6 +4464,7 @@ public class Helper {
|
|||
NONE
|
||||
}
|
||||
|
||||
|
||||
public enum NotifType {
|
||||
FOLLLOW,
|
||||
MENTION,
|
||||
|
@ -4423,7 +4476,6 @@ public class Helper {
|
|||
TOOT
|
||||
}
|
||||
|
||||
|
||||
public static class CacheTask extends AsyncTask<Void, Void, Void> {
|
||||
private float cacheSize;
|
||||
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
|
||||
public class LongClickLinkMovementMethod extends LinkMovementMethod {
|
||||
|
||||
private static int LONG_CLICK_TIME = 1000;
|
||||
private static LongClickLinkMovementMethod sInstance;
|
||||
private Handler mLongClickHandler;
|
||||
private boolean mIsLongPressed = false;
|
||||
|
@ -68,13 +67,11 @@ public class LongClickLinkMovementMethod extends LinkMovementMethod {
|
|||
Selection.setSelection(buffer,
|
||||
buffer.getSpanStart(link[0]),
|
||||
buffer.getSpanEnd(link[0]));
|
||||
mLongClickHandler.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
link[0].onLongClick(widget);
|
||||
mIsLongPressed = true;
|
||||
widget.invalidate();
|
||||
}
|
||||
int LONG_CLICK_TIME = 1000;
|
||||
mLongClickHandler.postDelayed(() -> {
|
||||
link[0].onLongClick(widget);
|
||||
mIsLongPressed = true;
|
||||
widget.invalidate();
|
||||
}, LONG_CLICK_TIME);
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -5,6 +5,7 @@ import android.content.Context;
|
|||
import android.content.SharedPreferences;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.Paint;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.KeyEvent;
|
||||
|
@ -14,7 +15,6 @@ import android.view.inputmethod.InputConnection;
|
|||
import androidx.annotation.CallSuper;
|
||||
import androidx.annotation.DimenRes;
|
||||
import androidx.annotation.Px;
|
||||
import androidx.core.os.BuildCompat;
|
||||
import androidx.core.view.inputmethod.EditorInfoCompat;
|
||||
import androidx.core.view.inputmethod.InputConnectionCompat;
|
||||
import androidx.core.view.inputmethod.InputContentInfoCompat;
|
||||
|
@ -39,7 +39,7 @@ public class MastalabAutoCompleteTextView extends androidx.appcompat.widget.AppC
|
|||
int flags, Bundle opts) {
|
||||
|
||||
// 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) {
|
||||
try {
|
||||
inputContentInfo.requestPermission();
|
||||
|
@ -118,10 +118,12 @@ public class MastalabAutoCompleteTextView extends androidx.appcompat.widget.AppC
|
|||
this.keyBoardInputCallbackListener = keyBoardInputCallbackListener;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public String[] getImgTypeString() {
|
||||
return imgTypeString;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public void setImgTypeString(String[] imgTypeString) {
|
||||
this.imgTypeString = imgTypeString;
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@ package app.fedilab.android.helper;
|
|||
|
||||
import android.app.Activity;
|
||||
import android.graphics.drawable.Drawable;
|
||||
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
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.
|
||||
* @param view View
|
||||
*
|
||||
* @param view View
|
||||
* @param layoutParams ViewGroup.LayoutParams
|
||||
*/
|
||||
public void attach(View view, ViewGroup.LayoutParams layoutParams) {
|
||||
|
|
|
@ -65,6 +65,7 @@ public class ScheduledBoostsSyncJob extends Job {
|
|||
return jobId;
|
||||
}
|
||||
|
||||
@SuppressWarnings("UnusedReturnValue")
|
||||
public static int scheduleUpdate(Context context, int tootStoredId, long timestampScheduling) {
|
||||
|
||||
long startMs = (timestampScheduling - new Date().getTime());
|
||||
|
|
Loading…
Reference in New Issue