This commit is contained in:
Thomas 2022-09-20 11:43:47 +02:00
parent dcb41be114
commit f4bfe12abe
4 changed files with 12 additions and 10 deletions

View File

@ -78,18 +78,21 @@ public class FilterActivity extends BaseActivity implements FilterAdapter.Delete
expire[0] = -1;
break;
case 1:
expire[0] = 3600;
expire[0] = 1800;
break;
case 2:
expire[0] = 21600;
expire[0] = 3600;
break;
case 3:
expire[0] = 43200;
expire[0] = 21600;
break;
case 4:
expire[0] = 86400;
expire[0] = 43200;
break;
case 5:
expire[0] = 86400;
break;
case 6:
expire[0] = 604800;
break;
}
@ -99,6 +102,7 @@ public class FilterActivity extends BaseActivity implements FilterAdapter.Delete
public void onNothingSelected(AdapterView<?> parent1) {
}
});
if (filter != null) {
popupAddFilterBinding.addPhrase.setText(filter.phrase);
if (filter.context != null)

View File

@ -339,7 +339,7 @@ public interface MastodonAccountsService {
@Field("context[]") List<String> context,
@Field("irreversible") boolean irreversible,
@Field("whole_word") boolean whole_word,
@Field("expires_in") long expires_in
@Field("expires_in") String expires_in
);
//Edit a filter
@ -352,7 +352,7 @@ public interface MastodonAccountsService {
@Field("context[]") List<String> context,
@Field("irreversible") boolean irreversible,
@Field("whole_word") boolean whole_word,
@Field("expires_in") long expires_in
@Field("expires_in") String expires_in
);
//Remove a filter

View File

@ -56,7 +56,6 @@ import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.widget.AppCompatEditText;
import androidx.appcompat.widget.LinearLayoutCompat;
@ -560,7 +559,6 @@ public class ComposeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
.asBitmap()
.load(attachmentPath)
.into(new CustomTarget<Bitmap>() {
@RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN)
@Override
public void onResourceReady(@NonNull Bitmap resource, Transition<? super Bitmap> transition) {
popupMediaDescriptionBinding.mediaPicture.setImageBitmap(resource);

View File

@ -1164,7 +1164,7 @@ public class AccountsVM extends AndroidViewModel {
MastodonAccountsService mastodonAccountsService = init(instance);
new Thread(() -> {
Filter filter = null;
Call<Filter> addFilterCall = mastodonAccountsService.addFilter(token, phrase, filterContext, irreversible, wholeWord, expiresIn);
Call<Filter> addFilterCall = mastodonAccountsService.addFilter(token, phrase, filterContext, irreversible, wholeWord, expiresIn == -1 ? "" : String.valueOf(expiresIn));
if (addFilterCall != null) {
try {
Response<Filter> addFiltersResponse = addFilterCall.execute();
@ -1199,7 +1199,7 @@ public class AccountsVM extends AndroidViewModel {
MastodonAccountsService mastodonAccountsService = init(instance);
new Thread(() -> {
Filter filter = null;
Call<Filter> editFilterCall = mastodonAccountsService.editFilter(token, id, phrase, filterContext, irreversible, wholeWord, expiresIn);
Call<Filter> editFilterCall = mastodonAccountsService.editFilter(token, id, phrase, filterContext, irreversible, wholeWord, expiresIn == -1 ? "" : String.valueOf(expiresIn));
if (editFilterCall != null) {
try {
Response<Filter> editFiltersResponse = editFilterCall.execute();