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

View File

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

View File

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

View File

@ -1164,7 +1164,7 @@ public class AccountsVM extends AndroidViewModel {
MastodonAccountsService mastodonAccountsService = init(instance); MastodonAccountsService mastodonAccountsService = init(instance);
new Thread(() -> { new Thread(() -> {
Filter filter = null; 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) { if (addFilterCall != null) {
try { try {
Response<Filter> addFiltersResponse = addFilterCall.execute(); Response<Filter> addFiltersResponse = addFilterCall.execute();
@ -1199,7 +1199,7 @@ public class AccountsVM extends AndroidViewModel {
MastodonAccountsService mastodonAccountsService = init(instance); MastodonAccountsService mastodonAccountsService = init(instance);
new Thread(() -> { new Thread(() -> {
Filter filter = null; 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) { if (editFilterCall != null) {
try { try {
Response<Filter> editFiltersResponse = editFilterCall.execute(); Response<Filter> editFiltersResponse = editFilterCall.execute();