Use Koin to retrieve RelativeDateTimeFormatter

This commit is contained in:
cketti 2022-10-30 02:20:35 +02:00
parent 20f7e3eafe
commit 55557e7736
2 changed files with 5 additions and 4 deletions

View file

@ -1,7 +1,9 @@
package com.fsck.k9.view
import com.fsck.k9.ui.helper.RelativeDateTimeFormatter
import org.koin.dsl.module
val viewModule = module {
single { WebViewConfigProvider(get()) }
single { WebViewConfigProvider(themeManager = get()) }
factory { RelativeDateTimeFormatter(context = get(), clock = get()) }
}

View file

@ -16,7 +16,6 @@ import androidx.annotation.NonNull;
import androidx.appcompat.widget.PopupMenu;
import androidx.appcompat.widget.PopupMenu.OnMenuItemClickListener;
import com.fsck.k9.Account;
import com.fsck.k9.Clock;
import com.fsck.k9.DI;
import com.fsck.k9.activity.misc.ContactPicture;
import com.fsck.k9.contacts.ContactPictureLoader;
@ -43,7 +42,7 @@ public class MessageHeader extends LinearLayout implements OnClickListener, OnLo
private TextView dateView;
private MessageHelper messageHelper;
private final RelativeDateTimeFormatter relativeDateTimeFormatter;
private RelativeDateTimeFormatter relativeDateTimeFormatter;
private OnMenuItemClickListener onMenuItemClickListener;
@ -53,8 +52,8 @@ public class MessageHeader extends LinearLayout implements OnClickListener, OnLo
if (!isInEditMode()) {
messageHelper = MessageHelper.getInstance(getContext());
relativeDateTimeFormatter = DI.get(RelativeDateTimeFormatter.class);
}
relativeDateTimeFormatter = new RelativeDateTimeFormatter(getContext(), DI.get(Clock.class));
}
@Override