filter bug fix

This commit is contained in:
nuclearfog 2023-09-07 20:31:49 +02:00
parent ed12d47941
commit 5c453f7dff
No known key found for this signature in database
GPG Key ID: 03488A185C476379
3 changed files with 8 additions and 8 deletions

View File

@ -38,7 +38,7 @@ public class FilterUpdate implements Serializable {
* @param filter existing filter
*/
public FilterUpdate(Filter filter) {
int expires_at = (int) (filter.getExpirationTime() - System.currentTimeMillis());
int expires_at = (int) ((filter.getExpirationTime() - System.currentTimeMillis()) / 1000L);
Keyword[] keywords = filter.getKeywords();
id = filter.getId();
title = filter.getTitle();

View File

@ -36,7 +36,7 @@ public interface Filter extends Serializable {
/**
* get date time where the filter expires
*
* @return date time or '0' if not defined
* @return ISO 8601 Datetime or '0' if not defined
*/
long getExpirationTime();

View File

@ -129,14 +129,14 @@ public class FilterDialog extends Dialog implements OnClickListener, OnCheckedCh
sw_thread.setCheckedImmediately(update.filterThreadSet());
sw_hide.setCheckedImmediately(update.getFilterAction() == Filter.ACTION_HIDE);
txt_title.setText(update.getTitle());
if (update.getExpirationTime() > 86400000L) {
txt_duration.setText(Long.toString(Math.round(update.getExpirationTime() / 86400000d)));
if (update.getExpirationTime() > 86400) {
txt_duration.setText(Long.toString(Math.round(update.getExpirationTime() / 86400d)));
timeunit.setSelection(2);
} else if (update.getExpirationTime() > 3600000L) {
txt_duration.setText(Long.toString(Math.round(update.getExpirationTime() / 3600000d)));
} else if (update.getExpirationTime() > 3600) {
txt_duration.setText(Long.toString(Math.round(update.getExpirationTime() / 3600d)));
timeunit.setSelection(1);
} else if (update.getExpirationTime() > 60000L) {
txt_duration.setText(Long.toString(Math.round(update.getExpirationTime() / 60000d)));
} else if (update.getExpirationTime() > 60) {
txt_duration.setText(Long.toString(Math.round(update.getExpirationTime() / 60d)));
timeunit.setSelection(0);
} else {
timeunit.setSelection(2);