From 9faaf90c7b681e259fe6736a35c94290f19bb3fa Mon Sep 17 00:00:00 2001 From: Unpublished Date: Sun, 31 Mar 2024 22:58:19 +0200 Subject: [PATCH 1/2] Rename .java to .kt Signed-off-by: Unpublished --- .../{RssItemCardViewHolder.java => RssItemCardViewHolder.kt} | 0 ...ssItemFullTextViewHolder.java => RssItemFullTextViewHolder.kt} | 0 ...bnailViewHolder.java => RssItemHeadlineThumbnailViewHolder.kt} | 0 ...ssItemHeadlineViewHolder.java => RssItemHeadlineViewHolder.kt} | 0 .../{RssItemTextViewHolder.java => RssItemTextViewHolder.kt} | 0 ...ItemThumbnailViewHolder.java => RssItemThumbnailViewHolder.kt} | 0 .../{RssItemWebViewHolder.java => RssItemWebViewHolder.kt} | 0 7 files changed, 0 insertions(+), 0 deletions(-) rename News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/adapter/{RssItemCardViewHolder.java => RssItemCardViewHolder.kt} (100%) rename News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/adapter/{RssItemFullTextViewHolder.java => RssItemFullTextViewHolder.kt} (100%) rename News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/adapter/{RssItemHeadlineThumbnailViewHolder.java => RssItemHeadlineThumbnailViewHolder.kt} (100%) rename News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/adapter/{RssItemHeadlineViewHolder.java => RssItemHeadlineViewHolder.kt} (100%) rename News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/adapter/{RssItemTextViewHolder.java => RssItemTextViewHolder.kt} (100%) rename News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/adapter/{RssItemThumbnailViewHolder.java => RssItemThumbnailViewHolder.kt} (100%) rename News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/adapter/{RssItemWebViewHolder.java => RssItemWebViewHolder.kt} (100%) diff --git a/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/adapter/RssItemCardViewHolder.java b/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/adapter/RssItemCardViewHolder.kt similarity index 100% rename from News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/adapter/RssItemCardViewHolder.java rename to News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/adapter/RssItemCardViewHolder.kt diff --git a/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/adapter/RssItemFullTextViewHolder.java b/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/adapter/RssItemFullTextViewHolder.kt similarity index 100% rename from News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/adapter/RssItemFullTextViewHolder.java rename to News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/adapter/RssItemFullTextViewHolder.kt diff --git a/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/adapter/RssItemHeadlineThumbnailViewHolder.java b/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/adapter/RssItemHeadlineThumbnailViewHolder.kt similarity index 100% rename from News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/adapter/RssItemHeadlineThumbnailViewHolder.java rename to News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/adapter/RssItemHeadlineThumbnailViewHolder.kt diff --git a/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/adapter/RssItemHeadlineViewHolder.java b/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/adapter/RssItemHeadlineViewHolder.kt similarity index 100% rename from News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/adapter/RssItemHeadlineViewHolder.java rename to News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/adapter/RssItemHeadlineViewHolder.kt diff --git a/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/adapter/RssItemTextViewHolder.java b/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/adapter/RssItemTextViewHolder.kt similarity index 100% rename from News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/adapter/RssItemTextViewHolder.java rename to News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/adapter/RssItemTextViewHolder.kt diff --git a/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/adapter/RssItemThumbnailViewHolder.java b/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/adapter/RssItemThumbnailViewHolder.kt similarity index 100% rename from News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/adapter/RssItemThumbnailViewHolder.java rename to News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/adapter/RssItemThumbnailViewHolder.kt diff --git a/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/adapter/RssItemWebViewHolder.java b/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/adapter/RssItemWebViewHolder.kt similarity index 100% rename from News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/adapter/RssItemWebViewHolder.java rename to News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/adapter/RssItemWebViewHolder.kt From 8d97c0a46137931b329adec0634e1ca310e1890b Mon Sep 17 00:00:00 2001 From: Unpublished Date: Mon, 1 Apr 2024 13:50:09 +0200 Subject: [PATCH 2/2] Use one Glide instance per NewsListRecyclerAdapter Signed-off-by: Unpublished --- .../adapter/NewsListRecyclerAdapter.java | 57 +- .../adapter/RssItemCardViewHolder.kt | 97 +-- .../adapter/RssItemFullTextViewHolder.kt | 26 +- .../RssItemHeadlineThumbnailViewHolder.kt | 166 ++-- .../adapter/RssItemHeadlineViewHolder.kt | 104 ++- .../adapter/RssItemTextViewHolder.kt | 104 ++- .../adapter/RssItemThumbnailViewHolder.kt | 163 ++-- .../adapter/RssItemViewHolder.java | 15 +- .../adapter/RssItemWebViewHolder.kt | 111 ++- config/detekt/detekt.yml | 785 ++++++++++++++++++ 10 files changed, 1206 insertions(+), 422 deletions(-) create mode 100644 config/detekt/detekt.yml diff --git a/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/adapter/NewsListRecyclerAdapter.java b/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/adapter/NewsListRecyclerAdapter.java index 7a3f0ef51..92ace3a39 100644 --- a/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/adapter/NewsListRecyclerAdapter.java +++ b/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/adapter/NewsListRecyclerAdapter.java @@ -13,6 +13,9 @@ import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; +import com.bumptech.glide.Glide; +import com.bumptech.glide.RequestManager; + import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.Subscribe; @@ -32,6 +35,7 @@ import de.luhmer.owncloudnewsreader.databinding.SubscriptionDetailListItemWebLayoutBinding; import de.luhmer.owncloudnewsreader.events.podcast.PodcastCompletedEvent; import de.luhmer.owncloudnewsreader.helper.AsyncTaskHelper; +import de.luhmer.owncloudnewsreader.helper.FavIconHandler; import de.luhmer.owncloudnewsreader.helper.PostDelayHandler; import de.luhmer.owncloudnewsreader.helper.StopWatch; import de.luhmer.owncloudnewsreader.interfaces.IPlayPausePodcastClicked; @@ -43,6 +47,8 @@ public class NewsListRecyclerAdapter extends RecyclerView.Adapter { - RssItemCardViewHolder(@NonNull SubscriptionDetailListItemCardViewBinding binding, SharedPreferences sharedPreferences) { - super(binding, sharedPreferences); - } - - @Override - protected ImageView getImageViewFavIcon() { - return binding.imgViewFavIcon; +class RssItemCardViewHolder internal constructor( + binding: SubscriptionDetailListItemCardViewBinding, + faviconHandler: FavIconHandler, + glide: RequestManager, + sharedPreferences: SharedPreferences, +) : RssItemViewHolder( + binding, + faviconHandler, + glide, + sharedPreferences, + ) { + override fun getImageViewFavIcon(): ImageView { + return binding.imgViewFavIcon } - @Override - protected ImageView getStar() { - return binding.starImageview; + override fun getStar(): ImageView { + return binding.starImageview } - @Override - protected ImageView getPlayPausePodcastButton() { - return binding.podcastWrapper.btnPlayPausePodcast; + override fun getPlayPausePodcastButton(): ImageView { + return binding.podcastWrapper.btnPlayPausePodcast } - @Override - protected View getColorFeed() { - return binding.colorLineFeed; + override fun getColorFeed(): View { + return binding.colorLineFeed } - @Override - protected TextView getTextViewTitle() { - return binding.tvSubscription; + override fun getTextViewTitle(): TextView { + return binding.tvSubscription } - @Override - protected TextView getTextViewSummary() { - return binding.summary; + override fun getTextViewSummary(): TextView { + return binding.summary } - @Override - protected TextView getTextViewBody() { - return binding.body; + override fun getTextViewBody(): TextView { + return binding.body } - @Override - protected TextView getTextViewItemDate() { - return binding.tvItemDate; + override fun getTextViewItemDate(): TextView { + return binding.tvItemDate } - @Override - protected FrameLayout getPlayPausePodcastWrapper() { - return binding.podcastWrapper.flPlayPausePodcastWrapper; + override fun getPlayPausePodcastWrapper(): FrameLayout { + return binding.podcastWrapper.flPlayPausePodcastWrapper } - @Override - protected ProgressBar getPodcastDownloadProgress() { - return binding.podcastWrapper.podcastDownloadProgress; + override fun getPodcastDownloadProgress(): ProgressBar { + return binding.podcastWrapper.podcastDownloadProgress } @CallSuper - public void bind(@NonNull RssItem rssItem) { - super.bind(rssItem); + override fun bind(rssItem: RssItem) { + super.bind(rssItem) } -} \ No newline at end of file +} diff --git a/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/adapter/RssItemFullTextViewHolder.kt b/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/adapter/RssItemFullTextViewHolder.kt index d8db05d30..485db7e28 100644 --- a/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/adapter/RssItemFullTextViewHolder.kt +++ b/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/adapter/RssItemFullTextViewHolder.kt @@ -1,13 +1,13 @@ -package de.luhmer.owncloudnewsreader.adapter; - -import android.content.SharedPreferences; - -import androidx.annotation.NonNull; - -import de.luhmer.owncloudnewsreader.databinding.SubscriptionDetailListItemTextBinding; - -public class RssItemFullTextViewHolder extends RssItemTextViewHolder { - RssItemFullTextViewHolder(@NonNull SubscriptionDetailListItemTextBinding binding, SharedPreferences sharedPreferences) { - super(binding, sharedPreferences); - } -} \ No newline at end of file +package de.luhmer.owncloudnewsreader.adapter + +import android.content.SharedPreferences +import com.bumptech.glide.RequestManager +import de.luhmer.owncloudnewsreader.databinding.SubscriptionDetailListItemTextBinding +import de.luhmer.owncloudnewsreader.helper.FavIconHandler + +class RssItemFullTextViewHolder internal constructor( + binding: SubscriptionDetailListItemTextBinding, + faviconHandler: FavIconHandler, + glide: RequestManager, + sharedPreferences: SharedPreferences, +) : RssItemTextViewHolder(binding, faviconHandler, glide, sharedPreferences) diff --git a/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/adapter/RssItemHeadlineThumbnailViewHolder.kt b/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/adapter/RssItemHeadlineThumbnailViewHolder.kt index cba73b7d6..0bb6a3029 100644 --- a/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/adapter/RssItemHeadlineThumbnailViewHolder.kt +++ b/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/adapter/RssItemHeadlineThumbnailViewHolder.kt @@ -1,115 +1,105 @@ -package de.luhmer.owncloudnewsreader.adapter; - -import android.content.SharedPreferences; -import android.graphics.drawable.Drawable; -import android.view.View; -import android.widget.FrameLayout; -import android.widget.ImageView; -import android.widget.ProgressBar; -import android.widget.TextView; - -import androidx.annotation.CallSuper; -import androidx.annotation.NonNull; -import androidx.vectordrawable.graphics.drawable.VectorDrawableCompat; - -import com.bumptech.glide.load.MultiTransformation; -import com.bumptech.glide.load.engine.DiskCacheStrategy; -import com.bumptech.glide.load.resource.bitmap.CenterCrop; -import com.bumptech.glide.load.resource.bitmap.RoundedCorners; - -import de.luhmer.owncloudnewsreader.R; -import de.luhmer.owncloudnewsreader.database.DatabaseConnectionOrm; -import de.luhmer.owncloudnewsreader.database.model.RssItem; -import de.luhmer.owncloudnewsreader.databinding.SubscriptionDetailListItemHeadlineThumbnailBinding; - -public class RssItemHeadlineThumbnailViewHolder extends RssItemViewHolder { - - Drawable feedIcon = VectorDrawableCompat.create(itemView.getResources(), R.drawable.feed_icon, null); - - RssItemHeadlineThumbnailViewHolder(@NonNull SubscriptionDetailListItemHeadlineThumbnailBinding binding, SharedPreferences sharedPreferences) { - super(binding, sharedPreferences); +package de.luhmer.owncloudnewsreader.adapter + +import android.content.SharedPreferences +import android.view.View +import android.widget.FrameLayout +import android.widget.ImageView +import android.widget.ProgressBar +import android.widget.TextView +import androidx.annotation.CallSuper +import androidx.vectordrawable.graphics.drawable.VectorDrawableCompat +import com.bumptech.glide.RequestManager +import com.bumptech.glide.load.MultiTransformation +import com.bumptech.glide.load.engine.DiskCacheStrategy +import com.bumptech.glide.load.resource.bitmap.CenterCrop +import com.bumptech.glide.load.resource.bitmap.RoundedCorners +import de.luhmer.owncloudnewsreader.R +import de.luhmer.owncloudnewsreader.database.DatabaseConnectionOrm +import de.luhmer.owncloudnewsreader.database.model.RssItem +import de.luhmer.owncloudnewsreader.databinding.SubscriptionDetailListItemHeadlineThumbnailBinding +import de.luhmer.owncloudnewsreader.helper.FavIconHandler + +private const val RADIUS_IN_DP = 60 + +class RssItemHeadlineThumbnailViewHolder internal constructor( + binding: SubscriptionDetailListItemHeadlineThumbnailBinding, + faviconHandler: FavIconHandler, + glide: RequestManager, + sharedPreferences: SharedPreferences, +) : RssItemViewHolder( + binding, + faviconHandler, + glide, + sharedPreferences, + ) { + var feedIcon = VectorDrawableCompat.create(itemView.resources, R.drawable.feed_icon, null) + + override fun getImageViewFavIcon(): ImageView { + return binding.imgViewFavIcon } - @Override - protected ImageView getImageViewFavIcon() { - return binding.imgViewFavIcon; + override fun getStar(): ImageView { + return binding.starImageview } - @Override - protected ImageView getStar() { - return binding.starImageview; + override fun getPlayPausePodcastButton(): ImageView { + return binding.podcastWrapper.btnPlayPausePodcast } - @Override - protected ImageView getPlayPausePodcastButton() { - return binding.podcastWrapper.btnPlayPausePodcast; + override fun getColorFeed(): View? { + return null } - @Override - protected View getColorFeed() { - return null; + override fun getTextViewTitle(): TextView { + return binding.tvSubscription } - @Override - protected TextView getTextViewTitle() { - return binding.tvSubscription; + override fun getTextViewSummary(): TextView { + return binding.summary } - @Override - protected TextView getTextViewSummary() { - return binding.summary; + override fun getTextViewBody(): TextView? { + return null } - @Override - protected TextView getTextViewBody() { - return null; + override fun getTextViewItemDate(): TextView? { + return null } - @Override - protected TextView getTextViewItemDate() { - return null; + override fun getPlayPausePodcastWrapper(): FrameLayout { + return binding.podcastWrapper.flPlayPausePodcastWrapper } - - @Override - protected FrameLayout getPlayPausePodcastWrapper() { - return binding.podcastWrapper.flPlayPausePodcastWrapper; - } - - @Override - protected ProgressBar getPodcastDownloadProgress() { - return binding.podcastWrapper.podcastDownloadProgress; + override fun getPodcastDownloadProgress(): ProgressBar { + return binding.podcastWrapper.podcastDownloadProgress } @CallSuper - public void bind(@NonNull RssItem rssItem) { - super.bind(rssItem); - - binding.starImageview.setVisibility(rssItem.getStarred_temp() ? View.VISIBLE : View.GONE); - - binding.imgViewThumbnail.setColorFilter(null); - String mediaThumbnail = rssItem.getMediaThumbnail(); - if (mediaThumbnail != null && !mediaThumbnail.isEmpty()) { - binding.imgViewThumbnail.setVisibility(View.VISIBLE); - + override fun bind(rssItem: RssItem) { + super.bind(rssItem) + binding.starImageview.visibility = if (rssItem.starred_temp) View.VISIBLE else View.GONE + binding.imgViewThumbnail.colorFilter = null + val mediaThumbnail = rssItem.mediaThumbnail + if (mediaThumbnail.isNullOrEmpty()) { + binding.imgViewThumbnail.visibility = View.VISIBLE mGlide - .load(mediaThumbnail) - .diskCacheStrategy(DiskCacheStrategy.DATA) - .placeholder(feedIcon) - .error(feedIcon) - .transform(new MultiTransformation<>(new CenterCrop(), new RoundedCorners(60))) - .into(binding.imgViewThumbnail); + .load(mediaThumbnail) + .diskCacheStrategy(DiskCacheStrategy.DATA) + .placeholder(feedIcon) + .error(feedIcon) + .transform(MultiTransformation(CenterCrop(), RoundedCorners(RADIUS_IN_DP))) + .into(binding.imgViewThumbnail) } else { - // Show Podcast Icon if no thumbnail is available but it is a podcast (otherwise the podcast button will go missing) - if (DatabaseConnectionOrm.ALLOWED_PODCASTS_TYPES.contains(rssItem.getEnclosureMime())) { - binding.imgViewThumbnail.setVisibility(View.VISIBLE); - //imgViewThumbnail.setColorFilter(Color.parseColor("#d8d8d8")); - Drawable feedIcon = VectorDrawableCompat.create(itemView.getResources(), R.drawable.feed_icon, null); - binding.imgViewThumbnail.setImageDrawable(feedIcon); + // Show Podcast Icon if no thumbnail is available but it is a podcast + // (otherwise the podcast button will go missing) + if (DatabaseConnectionOrm.ALLOWED_PODCASTS_TYPES.contains(rssItem.enclosureMime)) { + binding.imgViewThumbnail.visibility = View.VISIBLE + // imgViewThumbnail.setColorFilter(Color.parseColor("#d8d8d8")); + binding.imgViewThumbnail.setImageDrawable(feedIcon) } else { - binding.imgViewThumbnail.setImageDrawable(null); - binding.imgViewThumbnail.setVisibility(View.GONE); + binding.imgViewThumbnail.setImageDrawable(null) + binding.imgViewThumbnail.visibility = View.GONE } } } -} \ No newline at end of file +} diff --git a/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/adapter/RssItemHeadlineViewHolder.kt b/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/adapter/RssItemHeadlineViewHolder.kt index 66f3cb5a9..c2a73d3a6 100644 --- a/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/adapter/RssItemHeadlineViewHolder.kt +++ b/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/adapter/RssItemHeadlineViewHolder.kt @@ -1,77 +1,71 @@ -package de.luhmer.owncloudnewsreader.adapter; - -import android.content.SharedPreferences; -import android.view.View; -import android.widget.FrameLayout; -import android.widget.ImageView; -import android.widget.ProgressBar; -import android.widget.TextView; - -import androidx.annotation.CallSuper; -import androidx.annotation.NonNull; -import androidx.viewbinding.ViewBinding; - -import de.luhmer.owncloudnewsreader.database.model.RssItem; -import de.luhmer.owncloudnewsreader.databinding.SubscriptionDetailListItemHeadlineBinding; - -public class RssItemHeadlineViewHolder extends RssItemViewHolder { - - RssItemHeadlineViewHolder(@NonNull ViewBinding binding, SharedPreferences sharedPreferences) { - super(binding, sharedPreferences); - } - - @Override - protected ImageView getImageViewFavIcon() { - return binding.imgViewFavIcon; +package de.luhmer.owncloudnewsreader.adapter + +import android.content.SharedPreferences +import android.view.View +import android.widget.FrameLayout +import android.widget.ImageView +import android.widget.ProgressBar +import android.widget.TextView +import androidx.annotation.CallSuper +import androidx.viewbinding.ViewBinding +import com.bumptech.glide.RequestManager +import de.luhmer.owncloudnewsreader.database.model.RssItem +import de.luhmer.owncloudnewsreader.databinding.SubscriptionDetailListItemHeadlineBinding +import de.luhmer.owncloudnewsreader.helper.FavIconHandler + +class RssItemHeadlineViewHolder internal constructor( + binding: ViewBinding, + faviconHandler: FavIconHandler, + glide: RequestManager, + sharedPreferences: SharedPreferences, +) : RssItemViewHolder( + binding, + faviconHandler, + glide, + sharedPreferences, + ) { + override fun getImageViewFavIcon(): ImageView { + return binding.imgViewFavIcon } - @Override - protected ImageView getStar() { - return binding.starImageview; + override fun getStar(): ImageView { + return binding.starImageview } - @Override - protected ImageView getPlayPausePodcastButton() { - return binding.podcastWrapper.btnPlayPausePodcast; + override fun getPlayPausePodcastButton(): ImageView { + return binding.podcastWrapper.btnPlayPausePodcast } - @Override - protected View getColorFeed() { - return binding.colorLineFeed; + override fun getColorFeed(): View { + return binding.colorLineFeed } - @Override - protected TextView getTextViewTitle() { - return binding.tvSubscription; + override fun getTextViewTitle(): TextView { + return binding.tvSubscription } - @Override - protected TextView getTextViewSummary() { - return binding.summary; + override fun getTextViewSummary(): TextView { + return binding.summary } - @Override - protected TextView getTextViewBody() { - return null; + override fun getTextViewBody(): TextView? { + return null } - @Override - protected TextView getTextViewItemDate() { - return binding.tvItemDate; + override fun getTextViewItemDate(): TextView { + return binding.tvItemDate } - @Override - protected FrameLayout getPlayPausePodcastWrapper() { - return binding.podcastWrapper.flPlayPausePodcastWrapper; + override fun getPlayPausePodcastWrapper(): FrameLayout { + return binding.podcastWrapper.flPlayPausePodcastWrapper } - @Override - protected ProgressBar getPodcastDownloadProgress() { - return binding.podcastWrapper.podcastDownloadProgress; + override fun getPodcastDownloadProgress(): ProgressBar { + return binding.podcastWrapper.podcastDownloadProgress } @CallSuper - public void bind(@NonNull RssItem rssItem) { - super.bind(rssItem); + override fun bind(rssItem: RssItem) { + super.bind(rssItem) } -} \ No newline at end of file +} diff --git a/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/adapter/RssItemTextViewHolder.kt b/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/adapter/RssItemTextViewHolder.kt index d3e5a61ae..abfca0f20 100644 --- a/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/adapter/RssItemTextViewHolder.kt +++ b/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/adapter/RssItemTextViewHolder.kt @@ -1,77 +1,71 @@ -package de.luhmer.owncloudnewsreader.adapter; - -import android.content.SharedPreferences; -import android.view.View; -import android.widget.FrameLayout; -import android.widget.ImageView; -import android.widget.ProgressBar; -import android.widget.TextView; - -import androidx.annotation.CallSuper; -import androidx.annotation.NonNull; -import androidx.viewbinding.ViewBinding; - -import de.luhmer.owncloudnewsreader.database.model.RssItem; -import de.luhmer.owncloudnewsreader.databinding.SubscriptionDetailListItemTextBinding; - -public class RssItemTextViewHolder extends RssItemViewHolder { - - RssItemTextViewHolder(@NonNull ViewBinding binding, SharedPreferences sharedPreferences) { - super(binding, sharedPreferences); - } - - @Override - protected ImageView getImageViewFavIcon() { - return binding.imgViewFavIcon; +package de.luhmer.owncloudnewsreader.adapter + +import android.content.SharedPreferences +import android.view.View +import android.widget.FrameLayout +import android.widget.ImageView +import android.widget.ProgressBar +import android.widget.TextView +import androidx.annotation.CallSuper +import androidx.viewbinding.ViewBinding +import com.bumptech.glide.RequestManager +import de.luhmer.owncloudnewsreader.database.model.RssItem +import de.luhmer.owncloudnewsreader.databinding.SubscriptionDetailListItemTextBinding +import de.luhmer.owncloudnewsreader.helper.FavIconHandler + +open class RssItemTextViewHolder internal constructor( + binding: ViewBinding, + faviconHandler: FavIconHandler, + glide: RequestManager, + sharedPreferences: SharedPreferences, +) : RssItemViewHolder( + binding, + faviconHandler, + glide, + sharedPreferences, + ) { + override fun getImageViewFavIcon(): ImageView { + return binding.imgViewFavIcon } - @Override - protected ImageView getStar() { - return binding.starImageview; + override fun getStar(): ImageView { + return binding.starImageview } - @Override - protected ImageView getPlayPausePodcastButton() { - return binding.podcastWrapper.btnPlayPausePodcast; + override fun getPlayPausePodcastButton(): ImageView { + return binding.podcastWrapper.btnPlayPausePodcast } - @Override - protected View getColorFeed() { - return binding.colorLineFeed; + override fun getColorFeed(): View { + return binding.colorLineFeed } - @Override - protected TextView getTextViewTitle() { - return binding.tvSubscription; + override fun getTextViewTitle(): TextView { + return binding.tvSubscription } - @Override - protected TextView getTextViewSummary() { - return binding.summary; + override fun getTextViewSummary(): TextView { + return binding.summary } - @Override - protected TextView getTextViewBody() { - return binding.body; + override fun getTextViewBody(): TextView { + return binding.body } - @Override - protected TextView getTextViewItemDate() { - return binding.tvItemDate; + override fun getTextViewItemDate(): TextView { + return binding.tvItemDate } - @Override - protected FrameLayout getPlayPausePodcastWrapper() { - return binding.podcastWrapper.flPlayPausePodcastWrapper; + override fun getPlayPausePodcastWrapper(): FrameLayout { + return binding.podcastWrapper.flPlayPausePodcastWrapper } - @Override - protected ProgressBar getPodcastDownloadProgress() { - return binding.podcastWrapper.podcastDownloadProgress; + override fun getPodcastDownloadProgress(): ProgressBar { + return binding.podcastWrapper.podcastDownloadProgress } @CallSuper - public void bind(@NonNull RssItem rssItem) { - super.bind(rssItem); + override fun bind(rssItem: RssItem) { + super.bind(rssItem) } -} \ No newline at end of file +} diff --git a/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/adapter/RssItemThumbnailViewHolder.kt b/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/adapter/RssItemThumbnailViewHolder.kt index 62225e5a3..6bb6c5b34 100644 --- a/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/adapter/RssItemThumbnailViewHolder.kt +++ b/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/adapter/RssItemThumbnailViewHolder.kt @@ -1,114 +1,103 @@ -package de.luhmer.owncloudnewsreader.adapter; - -import static android.view.View.GONE; - -import android.content.SharedPreferences; -import android.graphics.drawable.Drawable; -import android.view.View; -import android.widget.FrameLayout; -import android.widget.ImageView; -import android.widget.ProgressBar; -import android.widget.TextView; - -import androidx.annotation.CallSuper; -import androidx.annotation.NonNull; -import androidx.vectordrawable.graphics.drawable.VectorDrawableCompat; - -import com.bumptech.glide.load.MultiTransformation; -import com.bumptech.glide.load.engine.DiskCacheStrategy; -import com.bumptech.glide.load.resource.bitmap.CenterCrop; -import com.bumptech.glide.load.resource.bitmap.RoundedCorners; - -import de.luhmer.owncloudnewsreader.R; -import de.luhmer.owncloudnewsreader.database.DatabaseConnectionOrm; -import de.luhmer.owncloudnewsreader.database.model.RssItem; -import de.luhmer.owncloudnewsreader.databinding.SubscriptionDetailListItemThumbnailBinding; - -public class RssItemThumbnailViewHolder extends RssItemViewHolder { - - Drawable feedIcon = VectorDrawableCompat.create(itemView.getResources(), R.drawable.feed_icon, null); - - RssItemThumbnailViewHolder(@NonNull SubscriptionDetailListItemThumbnailBinding binding, SharedPreferences sharedPreferences) { - super(binding, sharedPreferences); - } - - @Override - protected ImageView getImageViewFavIcon() { - return binding.imgViewFavIcon; +package de.luhmer.owncloudnewsreader.adapter + +import android.content.SharedPreferences +import android.view.View +import android.widget.FrameLayout +import android.widget.ImageView +import android.widget.ProgressBar +import android.widget.TextView +import androidx.annotation.CallSuper +import androidx.vectordrawable.graphics.drawable.VectorDrawableCompat +import com.bumptech.glide.RequestManager +import com.bumptech.glide.load.MultiTransformation +import com.bumptech.glide.load.engine.DiskCacheStrategy +import com.bumptech.glide.load.resource.bitmap.CenterCrop +import com.bumptech.glide.load.resource.bitmap.RoundedCorners +import de.luhmer.owncloudnewsreader.R +import de.luhmer.owncloudnewsreader.database.DatabaseConnectionOrm +import de.luhmer.owncloudnewsreader.database.model.RssItem +import de.luhmer.owncloudnewsreader.databinding.SubscriptionDetailListItemThumbnailBinding +import de.luhmer.owncloudnewsreader.helper.FavIconHandler + +private const val RADIUS_IN_DP = 60 + +class RssItemThumbnailViewHolder internal constructor( + binding: SubscriptionDetailListItemThumbnailBinding, + faviconHandler: FavIconHandler, + glide: RequestManager, + sharedPreferences: SharedPreferences, +) : RssItemViewHolder( + binding, + faviconHandler, + glide, + sharedPreferences, + ) { + var feedIcon = VectorDrawableCompat.create(itemView.resources, R.drawable.feed_icon, null) + + override fun getImageViewFavIcon(): ImageView { + return binding.imgViewFavIcon } - @Override - protected ImageView getStar() { - return binding.starImageview; + override fun getStar(): ImageView { + return binding.starImageview } - @Override - protected ImageView getPlayPausePodcastButton() { - return binding.podcastWrapper.btnPlayPausePodcast; + override fun getPlayPausePodcastButton(): ImageView { + return binding.podcastWrapper.btnPlayPausePodcast } - @Override - protected View getColorFeed() { - return null; + override fun getColorFeed(): View? { + return null } - @Override - protected TextView getTextViewTitle() { - return binding.tvSubscription; + override fun getTextViewTitle(): TextView { + return binding.tvSubscription } - @Override - protected TextView getTextViewSummary() { - return binding.summary; + override fun getTextViewSummary(): TextView { + return binding.summary } - @Override - protected TextView getTextViewBody() { - return binding.body; + override fun getTextViewBody(): TextView { + return binding.body } - @Override - protected TextView getTextViewItemDate() { - return binding.tvItemDate; + override fun getTextViewItemDate(): TextView { + return binding.tvItemDate } - @Override - protected FrameLayout getPlayPausePodcastWrapper() { - return binding.podcastWrapper.flPlayPausePodcastWrapper; + override fun getPlayPausePodcastWrapper(): FrameLayout { + return binding.podcastWrapper.flPlayPausePodcastWrapper } - @Override - protected ProgressBar getPodcastDownloadProgress() { - return binding.podcastWrapper.podcastDownloadProgress; + override fun getPodcastDownloadProgress(): ProgressBar { + return binding.podcastWrapper.podcastDownloadProgress } @CallSuper - public void bind(@NonNull RssItem rssItem) { - super.bind(rssItem); - - binding.imgViewThumbnail.setColorFilter(null); - String mediaThumbnail = rssItem.getMediaThumbnail(); - if (mediaThumbnail != null && !mediaThumbnail.isEmpty()) { - binding.imgViewThumbnail.setVisibility(View.VISIBLE); - + override fun bind(rssItem: RssItem) { + super.bind(rssItem) + binding.imgViewThumbnail.colorFilter = null + val mediaThumbnail = rssItem.mediaThumbnail + if (!mediaThumbnail.isNullOrEmpty()) { + binding.imgViewThumbnail.visibility = View.VISIBLE mGlide - .load(mediaThumbnail) - .diskCacheStrategy(DiskCacheStrategy.DATA) - .placeholder(feedIcon) - .error(feedIcon) - .transform(new MultiTransformation<>(new CenterCrop(), new RoundedCorners(60))) - .into(binding.imgViewThumbnail); - + .load(mediaThumbnail) + .diskCacheStrategy(DiskCacheStrategy.DATA) + .placeholder(feedIcon) + .error(feedIcon) + .transform(MultiTransformation(CenterCrop(), RoundedCorners(RADIUS_IN_DP))) + .into(binding.imgViewThumbnail) } else { - // Show Podcast Icon if no thumbnail is available but it is a podcast (otherwise the podcast button will go missing) - if (DatabaseConnectionOrm.ALLOWED_PODCASTS_TYPES.contains(rssItem.getEnclosureMime())) { - binding.imgViewThumbnail.setVisibility(View.VISIBLE); - //imgViewThumbnail.setColorFilter(Color.parseColor("#d8d8d8")); - Drawable feedIcon = VectorDrawableCompat.create(itemView.getResources(), R.drawable.feed_icon, null); - binding.imgViewThumbnail.setImageDrawable(feedIcon); + // Show Podcast Icon if no thumbnail is available but it is a podcast + // (otherwise the podcast button will go missing) + if (DatabaseConnectionOrm.ALLOWED_PODCASTS_TYPES.contains(rssItem.enclosureMime)) { + binding.imgViewThumbnail.visibility = View.VISIBLE + // imgViewThumbnail.setColorFilter(Color.parseColor("#d8d8d8")); + binding.imgViewThumbnail.setImageDrawable(feedIcon) } else { - binding.imgViewThumbnail.setVisibility(GONE); + binding.imgViewThumbnail.visibility = View.GONE } } } -} \ No newline at end of file +} diff --git a/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/adapter/RssItemViewHolder.java b/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/adapter/RssItemViewHolder.java index 0d4986e4c..a325259b8 100644 --- a/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/adapter/RssItemViewHolder.java +++ b/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/adapter/RssItemViewHolder.java @@ -44,7 +44,7 @@ public abstract class RssItemViewHolder extends RecyclerV protected T binding; private static final SparseIntArray downloadProgressList = new SparseIntArray(); - private static FavIconHandler favIconHandler = null; + private final FavIconHandler favIconHandler; protected final SharedPreferences mPrefs; @SuppressWarnings("FieldCanBeLocal") private final int LengthBody = 400; @@ -59,7 +59,12 @@ public abstract class RssItemViewHolder extends RecyclerV private final SparseIntArray initalFontSizes = new SparseIntArray(); - RssItemViewHolder(@NonNull ViewBinding binding, SharedPreferences sharedPreferences) { + RssItemViewHolder( + @NonNull ViewBinding binding, + FavIconHandler favIconHandler, + RequestManager glide, + SharedPreferences sharedPreferences + ) { super(binding.getRoot()); this.binding = (T) binding; this.mPrefs = sharedPreferences; @@ -67,11 +72,9 @@ public abstract class RssItemViewHolder extends RecyclerV Context context = itemView.getContext(); bodyForegroundColor = new ForegroundColorSpan(ContextCompat.getColor(context, android.R.color.secondary_text_dark)); - mGlide = Glide.with(context); + mGlide = glide; - if (favIconHandler == null) { - favIconHandler = new FavIconHandler(context); - } + this.favIconHandler = favIconHandler; itemView.setOnClickListener(this); itemView.setOnLongClickListener(this); diff --git a/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/adapter/RssItemWebViewHolder.kt b/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/adapter/RssItemWebViewHolder.kt index ace937b7e..d588f6536 100644 --- a/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/adapter/RssItemWebViewHolder.kt +++ b/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/adapter/RssItemWebViewHolder.kt @@ -1,82 +1,73 @@ -package de.luhmer.owncloudnewsreader.adapter; - -import android.content.SharedPreferences; -import android.widget.FrameLayout; -import android.widget.ImageView; -import android.widget.ProgressBar; -import android.widget.TextView; - -import androidx.annotation.CallSuper; -import androidx.annotation.NonNull; -import androidx.viewbinding.ViewBinding; - -import de.luhmer.owncloudnewsreader.async_tasks.RssItemToHtmlTask; -import de.luhmer.owncloudnewsreader.database.model.RssItem; -import de.luhmer.owncloudnewsreader.databinding.SubscriptionDetailListItemWebLayoutBinding; - -public class RssItemWebViewHolder extends RssItemViewHolder { - - - public RssItemWebViewHolder(@NonNull ViewBinding binding, SharedPreferences sharedPreferences) { - super(binding, sharedPreferences); - } - - @Override - protected ImageView getImageViewFavIcon() { - return binding.layoutThumbnail.imgViewFavIcon; +package de.luhmer.owncloudnewsreader.adapter + +import android.content.SharedPreferences +import android.widget.FrameLayout +import android.widget.ImageView +import android.widget.ProgressBar +import android.widget.TextView +import androidx.annotation.CallSuper +import androidx.viewbinding.ViewBinding +import com.bumptech.glide.RequestManager +import de.luhmer.owncloudnewsreader.async_tasks.RssItemToHtmlTask +import de.luhmer.owncloudnewsreader.database.model.RssItem +import de.luhmer.owncloudnewsreader.databinding.SubscriptionDetailListItemWebLayoutBinding +import de.luhmer.owncloudnewsreader.helper.FavIconHandler + +class RssItemWebViewHolder( + binding: ViewBinding, + faviconHandler: FavIconHandler, + glide: RequestManager, + sharedPreferences: SharedPreferences, +) : RssItemViewHolder( + binding, + faviconHandler, + glide, + sharedPreferences, + ) { + override fun getImageViewFavIcon(): ImageView { + return binding.layoutThumbnail.imgViewFavIcon } - @Override - protected ImageView getStar() { - return binding.layoutThumbnail.starImageview; + override fun getStar(): ImageView { + return binding.layoutThumbnail.starImageview } - @Override - protected ImageView getPlayPausePodcastButton() { - return binding.layoutThumbnail.podcastWrapper.btnPlayPausePodcast; + override fun getPlayPausePodcastButton(): ImageView { + return binding.layoutThumbnail.podcastWrapper.btnPlayPausePodcast } - @Override - protected ImageView getColorFeed() { - return null; + override fun getColorFeed(): ImageView? { + return null } - @Override - protected TextView getTextViewTitle() { - return binding.layoutThumbnail.tvSubscription; + override fun getTextViewTitle(): TextView { + return binding.layoutThumbnail.tvSubscription } - @Override - protected TextView getTextViewSummary() { - return binding.layoutThumbnail.summary; + override fun getTextViewSummary(): TextView { + return binding.layoutThumbnail.summary } - @Override - protected TextView getTextViewBody() { - return binding.layoutThumbnail.body; + override fun getTextViewBody(): TextView { + return binding.layoutThumbnail.body } - @Override - protected TextView getTextViewItemDate() { - return binding.layoutThumbnail.tvItemDate; + override fun getTextViewItemDate(): TextView { + return binding.layoutThumbnail.tvItemDate } - @Override - protected FrameLayout getPlayPausePodcastWrapper() { - return binding.layoutThumbnail.podcastWrapper.flPlayPausePodcastWrapper; + override fun getPlayPausePodcastWrapper(): FrameLayout { + return binding.layoutThumbnail.podcastWrapper.flPlayPausePodcastWrapper } - @Override - protected ProgressBar getPodcastDownloadProgress() { - return binding.layoutThumbnail.podcastWrapper.podcastDownloadProgress; + override fun getPodcastDownloadProgress(): ProgressBar { + return binding.layoutThumbnail.podcastWrapper.podcastDownloadProgress } @CallSuper - public void bind(@NonNull RssItem rssItem) { - super.bind(rssItem); - - String htmlPage = RssItemToHtmlTask.getHtmlPage(this.mGlide, rssItem, false, mPrefs, itemView.getContext()); - binding.webViewBody.loadDataWithBaseURL("file:///android_asset/", htmlPage, "text/html", "UTF-8", ""); - + override fun bind(rssItem: RssItem) { + super.bind(rssItem) + val htmlPage: String = RssItemToHtmlTask.getHtmlPage(mGlide, rssItem, false, mPrefs, itemView.context) + binding.webViewBody.loadDataWithBaseURL("file:///android_asset/", htmlPage, "text/html", "UTF-8", "") } -} \ No newline at end of file +} diff --git a/config/detekt/detekt.yml b/config/detekt/detekt.yml new file mode 100644 index 000000000..f223c49bb --- /dev/null +++ b/config/detekt/detekt.yml @@ -0,0 +1,785 @@ +build: + maxIssues: 0 + excludeCorrectable: false + weights: + # complexity: 2 + # LongParameterList: 1 + # style: 1 + # comments: 1 + +config: + validation: true + warningsAsErrors: false + checkExhaustiveness: false + # when writing own rules with new properties, exclude the property path e.g.: 'my_rule_set,.*>.*>[my_property]' + excludes: '' + +processors: + active: true + exclude: + - 'DetektProgressListener' + # - 'KtFileCountProcessor' + # - 'PackageCountProcessor' + # - 'ClassCountProcessor' + # - 'FunctionCountProcessor' + # - 'PropertyCountProcessor' + # - 'ProjectComplexityProcessor' + # - 'ProjectCognitiveComplexityProcessor' + # - 'ProjectLLOCProcessor' + # - 'ProjectCLOCProcessor' + # - 'ProjectLOCProcessor' + # - 'ProjectSLOCProcessor' + # - 'LicenseHeaderLoaderExtension' + +console-reports: + active: true + exclude: + - 'ProjectStatisticsReport' + - 'ComplexityReport' + - 'NotificationReport' + - 'FindingsReport' + - 'FileBasedFindingsReport' + # - 'LiteFindingsReport' + +output-reports: + active: true + exclude: + # - 'TxtOutputReport' + # - 'XmlOutputReport' + # - 'HtmlOutputReport' + # - 'MdOutputReport' + # - 'SarifOutputReport' + +comments: + active: true + AbsentOrWrongFileLicense: + active: false + licenseTemplateFile: 'license.template' + licenseTemplateIsRegex: false + CommentOverPrivateFunction: + active: false + CommentOverPrivateProperty: + active: false + DeprecatedBlockTag: + active: false + EndOfSentenceFormat: + active: false + endOfSentenceFormat: '([.?!][ \t\n\r\f<])|([.?!:]$)' + KDocReferencesNonPublicProperty: + active: false + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/androidUnitTest/**', '**/androidInstrumentedTest/**', '**/jsTest/**', '**/iosTest/**'] + OutdatedDocumentation: + active: false + matchTypeParameters: true + matchDeclarationsOrder: true + allowParamOnConstructorProperties: false + UndocumentedPublicClass: + active: false + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/androidUnitTest/**', '**/androidInstrumentedTest/**', '**/jsTest/**', '**/iosTest/**'] + searchInNestedClass: true + searchInInnerClass: true + searchInInnerObject: true + searchInInnerInterface: true + searchInProtectedClass: false + UndocumentedPublicFunction: + active: false + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/androidUnitTest/**', '**/androidInstrumentedTest/**', '**/jsTest/**', '**/iosTest/**'] + searchProtectedFunction: false + UndocumentedPublicProperty: + active: false + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/androidUnitTest/**', '**/androidInstrumentedTest/**', '**/jsTest/**', '**/iosTest/**'] + searchProtectedProperty: false + +complexity: + active: true + CognitiveComplexMethod: + active: false + threshold: 15 + ComplexCondition: + active: true + threshold: 4 + ComplexInterface: + active: false + threshold: 10 + includeStaticDeclarations: false + includePrivateDeclarations: false + ignoreOverloaded: false + CyclomaticComplexMethod: + active: true + threshold: 15 + ignoreSingleWhenExpression: false + ignoreSimpleWhenEntries: false + ignoreNestingFunctions: false + nestingFunctions: + - 'also' + - 'apply' + - 'forEach' + - 'isNotNull' + - 'ifNull' + - 'let' + - 'run' + - 'use' + - 'with' + LabeledExpression: + active: false + ignoredLabels: [] + LargeClass: + active: true + threshold: 600 + LongMethod: + active: true + threshold: 60 + LongParameterList: + active: true + functionThreshold: 6 + constructorThreshold: 7 + ignoreDefaultParameters: false + ignoreDataClasses: true + ignoreAnnotatedParameter: [] + MethodOverloading: + active: false + threshold: 6 + NamedArguments: + active: false + threshold: 3 + ignoreArgumentsMatchingNames: false + NestedBlockDepth: + active: true + threshold: 4 + NestedScopeFunctions: + active: false + threshold: 1 + functions: + - 'kotlin.apply' + - 'kotlin.run' + - 'kotlin.with' + - 'kotlin.let' + - 'kotlin.also' + ReplaceSafeCallChainWithRun: + active: false + StringLiteralDuplication: + active: false + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/androidUnitTest/**', '**/androidInstrumentedTest/**', '**/jsTest/**', '**/iosTest/**'] + threshold: 3 + ignoreAnnotation: true + excludeStringsWithLessThan5Characters: true + ignoreStringsRegex: '$^' + TooManyFunctions: + active: true + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/androidUnitTest/**', '**/androidInstrumentedTest/**', '**/jsTest/**', '**/iosTest/**'] + thresholdInFiles: 11 + thresholdInClasses: 11 + thresholdInInterfaces: 11 + thresholdInObjects: 11 + thresholdInEnums: 11 + ignoreDeprecated: false + ignorePrivate: false + ignoreOverridden: true + ignoreAnnotatedFunctions: [] + +coroutines: + active: true + GlobalCoroutineUsage: + active: false + InjectDispatcher: + active: true + dispatcherNames: + - 'IO' + - 'Default' + - 'Unconfined' + RedundantSuspendModifier: + active: true + SleepInsteadOfDelay: + active: true + SuspendFunSwallowedCancellation: + active: false + SuspendFunWithCoroutineScopeReceiver: + active: false + SuspendFunWithFlowReturnType: + active: true + +empty-blocks: + active: true + EmptyCatchBlock: + active: true + allowedExceptionNameRegex: '_|(ignore|expected).*' + EmptyClassBlock: + active: true + EmptyDefaultConstructor: + active: true + EmptyDoWhileBlock: + active: true + EmptyElseBlock: + active: true + EmptyFinallyBlock: + active: true + EmptyForBlock: + active: true + EmptyFunctionBlock: + active: true + ignoreOverridden: false + EmptyIfBlock: + active: true + EmptyInitBlock: + active: true + EmptyKtFile: + active: true + EmptySecondaryConstructor: + active: true + EmptyTryBlock: + active: true + EmptyWhenBlock: + active: true + EmptyWhileBlock: + active: true + +exceptions: + active: true + ExceptionRaisedInUnexpectedLocation: + active: true + methodNames: + - 'equals' + - 'finalize' + - 'hashCode' + - 'toString' + InstanceOfCheckForException: + active: true + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/androidUnitTest/**', '**/androidInstrumentedTest/**', '**/jsTest/**', '**/iosTest/**'] + NotImplementedDeclaration: + active: false + ObjectExtendsThrowable: + active: false + PrintStackTrace: + active: true + RethrowCaughtException: + active: true + ReturnFromFinally: + active: true + ignoreLabeled: false + SwallowedException: + active: true + ignoredExceptionTypes: + - 'InterruptedException' + - 'MalformedURLException' + - 'NumberFormatException' + - 'ParseException' + allowedExceptionNameRegex: '_|(ignore|expected).*' + ThrowingExceptionFromFinally: + active: true + ThrowingExceptionInMain: + active: false + ThrowingExceptionsWithoutMessageOrCause: + active: true + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/androidUnitTest/**', '**/androidInstrumentedTest/**', '**/jsTest/**', '**/iosTest/**'] + exceptions: + - 'ArrayIndexOutOfBoundsException' + - 'Exception' + - 'IllegalArgumentException' + - 'IllegalMonitorStateException' + - 'IllegalStateException' + - 'IndexOutOfBoundsException' + - 'NullPointerException' + - 'RuntimeException' + - 'Throwable' + ThrowingNewInstanceOfSameException: + active: true + TooGenericExceptionCaught: + active: true + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/androidUnitTest/**', '**/androidInstrumentedTest/**', '**/jsTest/**', '**/iosTest/**'] + exceptionNames: + - 'ArrayIndexOutOfBoundsException' + - 'Error' + - 'Exception' + - 'IllegalMonitorStateException' + - 'IndexOutOfBoundsException' + - 'NullPointerException' + - 'RuntimeException' + - 'Throwable' + allowedExceptionNameRegex: '_|(ignore|expected).*' + TooGenericExceptionThrown: + active: true + exceptionNames: + - 'Error' + - 'Exception' + - 'RuntimeException' + - 'Throwable' + +naming: + active: true + BooleanPropertyNaming: + active: false + allowedPattern: '^(is|has|are)' + ClassNaming: + active: true + classPattern: '[A-Z][a-zA-Z0-9]*' + ConstructorParameterNaming: + active: true + parameterPattern: '[a-z][A-Za-z0-9]*' + privateParameterPattern: '[a-z][A-Za-z0-9]*' + excludeClassPattern: '$^' + EnumNaming: + active: true + enumEntryPattern: '[A-Z][_a-zA-Z0-9]*' + ForbiddenClassName: + active: false + forbiddenName: [] + FunctionMaxLength: + active: false + maximumFunctionNameLength: 30 + FunctionMinLength: + active: false + minimumFunctionNameLength: 3 + FunctionNaming: + active: true + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/androidUnitTest/**', '**/androidInstrumentedTest/**', '**/jsTest/**', '**/iosTest/**'] + functionPattern: '[a-z][a-zA-Z0-9]*' + excludeClassPattern: '$^' + FunctionParameterNaming: + active: true + parameterPattern: '[a-z][A-Za-z0-9]*' + excludeClassPattern: '$^' + InvalidPackageDeclaration: + active: true + rootPackage: '' + requireRootInDeclaration: false + LambdaParameterNaming: + active: false + parameterPattern: '[a-z][A-Za-z0-9]*|_' + MatchingDeclarationName: + active: true + mustBeFirst: true + MemberNameEqualsClassName: + active: true + ignoreOverridden: true + NoNameShadowing: + active: true + NonBooleanPropertyPrefixedWithIs: + active: false + ObjectPropertyNaming: + active: true + constantPattern: '[A-Za-z][_A-Za-z0-9]*' + propertyPattern: '[A-Za-z][_A-Za-z0-9]*' + privatePropertyPattern: '(_)?[A-Za-z][_A-Za-z0-9]*' + PackageNaming: + active: true + packagePattern: '[a-z]+(\.[a-z][A-Za-z0-9]*)*' + TopLevelPropertyNaming: + active: true + constantPattern: '[A-Z][_A-Z0-9]*' + propertyPattern: '[A-Za-z][_A-Za-z0-9]*' + privatePropertyPattern: '_?[A-Za-z][_A-Za-z0-9]*' + VariableMaxLength: + active: false + maximumVariableNameLength: 64 + VariableMinLength: + active: false + minimumVariableNameLength: 1 + VariableNaming: + active: true + variablePattern: '[a-z][A-Za-z0-9]*' + privateVariablePattern: '(_)?[a-z][A-Za-z0-9]*' + excludeClassPattern: '$^' + +performance: + active: true + ArrayPrimitive: + active: true + CouldBeSequence: + active: false + threshold: 3 + ForEachOnRange: + active: true + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/androidUnitTest/**', '**/androidInstrumentedTest/**', '**/jsTest/**', '**/iosTest/**'] + SpreadOperator: + active: true + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/androidUnitTest/**', '**/androidInstrumentedTest/**', '**/jsTest/**', '**/iosTest/**'] + UnnecessaryPartOfBinaryExpression: + active: false + UnnecessaryTemporaryInstantiation: + active: true + +potential-bugs: + active: true + AvoidReferentialEquality: + active: true + forbiddenTypePatterns: + - 'kotlin.String' + CastNullableToNonNullableType: + active: false + CastToNullableType: + active: false + Deprecation: + active: false + DontDowncastCollectionTypes: + active: false + DoubleMutabilityForCollection: + active: true + mutableTypes: + - 'kotlin.collections.MutableList' + - 'kotlin.collections.MutableMap' + - 'kotlin.collections.MutableSet' + - 'java.util.ArrayList' + - 'java.util.LinkedHashSet' + - 'java.util.HashSet' + - 'java.util.LinkedHashMap' + - 'java.util.HashMap' + ElseCaseInsteadOfExhaustiveWhen: + active: false + ignoredSubjectTypes: [] + EqualsAlwaysReturnsTrueOrFalse: + active: true + EqualsWithHashCodeExist: + active: true + ExitOutsideMain: + active: false + ExplicitGarbageCollectionCall: + active: true + HasPlatformType: + active: true + IgnoredReturnValue: + active: true + restrictToConfig: true + returnValueAnnotations: + - 'CheckResult' + - '*.CheckResult' + - 'CheckReturnValue' + - '*.CheckReturnValue' + ignoreReturnValueAnnotations: + - 'CanIgnoreReturnValue' + - '*.CanIgnoreReturnValue' + returnValueTypes: + - 'kotlin.sequences.Sequence' + - 'kotlinx.coroutines.flow.*Flow' + - 'java.util.stream.*Stream' + ignoreFunctionCall: [] + ImplicitDefaultLocale: + active: true + ImplicitUnitReturnType: + active: false + allowExplicitReturnType: true + InvalidRange: + active: true + IteratorHasNextCallsNextMethod: + active: true + IteratorNotThrowingNoSuchElementException: + active: true + LateinitUsage: + active: false + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/androidUnitTest/**', '**/androidInstrumentedTest/**', '**/jsTest/**', '**/iosTest/**'] + ignoreOnClassesPattern: '' + MapGetWithNotNullAssertionOperator: + active: true + MissingPackageDeclaration: + active: false + excludes: ['**/*.kts'] + NullCheckOnMutableProperty: + active: false + NullableToStringCall: + active: false + PropertyUsedBeforeDeclaration: + active: false + UnconditionalJumpStatementInLoop: + active: false + UnnecessaryNotNullCheck: + active: false + UnnecessaryNotNullOperator: + active: true + UnnecessarySafeCall: + active: true + UnreachableCatchBlock: + active: true + UnreachableCode: + active: true + UnsafeCallOnNullableType: + active: true + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/androidUnitTest/**', '**/androidInstrumentedTest/**', '**/jsTest/**', '**/iosTest/**'] + UnsafeCast: + active: true + UnusedUnaryOperator: + active: true + UselessPostfixExpression: + active: true + WrongEqualsTypeParameter: + active: true + +style: + active: true + AlsoCouldBeApply: + active: false + BracesOnIfStatements: + active: false + singleLine: 'never' + multiLine: 'always' + BracesOnWhenStatements: + active: false + singleLine: 'necessary' + multiLine: 'consistent' + CanBeNonNullable: + active: false + CascadingCallWrapping: + active: false + includeElvis: true + ClassOrdering: + active: false + CollapsibleIfStatements: + active: false + DataClassContainsFunctions: + active: false + conversionFunctionPrefix: + - 'to' + allowOperators: false + DataClassShouldBeImmutable: + active: false + DestructuringDeclarationWithTooManyEntries: + active: true + maxDestructuringEntries: 3 + DoubleNegativeLambda: + active: false + negativeFunctions: + - reason: 'Use `takeIf` instead.' + value: 'takeUnless' + - reason: 'Use `all` instead.' + value: 'none' + negativeFunctionNameParts: + - 'not' + - 'non' + EqualsNullCall: + active: true + EqualsOnSignatureLine: + active: false + ExplicitCollectionElementAccessMethod: + active: false + ExplicitItLambdaParameter: + active: true + ExpressionBodySyntax: + active: false + includeLineWrapping: false + ForbiddenAnnotation: + active: false + annotations: + - reason: 'it is a java annotation. Use `Suppress` instead.' + value: 'java.lang.SuppressWarnings' + - reason: 'it is a java annotation. Use `kotlin.Deprecated` instead.' + value: 'java.lang.Deprecated' + - reason: 'it is a java annotation. Use `kotlin.annotation.MustBeDocumented` instead.' + value: 'java.lang.annotation.Documented' + - reason: 'it is a java annotation. Use `kotlin.annotation.Target` instead.' + value: 'java.lang.annotation.Target' + - reason: 'it is a java annotation. Use `kotlin.annotation.Retention` instead.' + value: 'java.lang.annotation.Retention' + - reason: 'it is a java annotation. Use `kotlin.annotation.Repeatable` instead.' + value: 'java.lang.annotation.Repeatable' + - reason: 'Kotlin does not support @Inherited annotation, see https://youtrack.jetbrains.com/issue/KT-22265' + value: 'java.lang.annotation.Inherited' + ForbiddenComment: + active: true + comments: + - reason: 'Forbidden FIXME todo marker in comment, please fix the problem.' + value: 'FIXME:' + - reason: 'Forbidden STOPSHIP todo marker in comment, please address the problem before shipping the code.' + value: 'STOPSHIP:' + - reason: 'Forbidden TODO todo marker in comment, please do the changes.' + value: 'TODO:' + allowedPatterns: '' + ForbiddenImport: + active: false + imports: [] + forbiddenPatterns: '' + ForbiddenMethodCall: + active: false + methods: + - reason: 'print does not allow you to configure the output stream. Use a logger instead.' + value: 'kotlin.io.print' + - reason: 'println does not allow you to configure the output stream. Use a logger instead.' + value: 'kotlin.io.println' + ForbiddenSuppress: + active: false + rules: [] + ForbiddenVoid: + active: true + ignoreOverridden: false + ignoreUsageInGenerics: false + FunctionOnlyReturningConstant: + active: true + ignoreOverridableFunction: true + ignoreActualFunction: true + excludedFunctions: [] + LoopWithTooManyJumpStatements: + active: true + maxJumpCount: 1 + MagicNumber: + active: true + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/androidUnitTest/**', '**/androidInstrumentedTest/**', '**/jsTest/**', '**/iosTest/**', '**/*.kts'] + ignoreNumbers: + - '-1' + - '0' + - '1' + - '2' + ignoreHashCodeFunction: true + ignorePropertyDeclaration: false + ignoreLocalVariableDeclaration: false + ignoreConstantDeclaration: true + ignoreCompanionObjectPropertyDeclaration: true + ignoreAnnotation: false + ignoreNamedArgument: true + ignoreEnums: false + ignoreRanges: false + ignoreExtensionFunctions: true + MandatoryBracesLoops: + active: false + MaxChainedCallsOnSameLine: + active: false + maxChainedCalls: 5 + MaxLineLength: + active: true + maxLineLength: 120 + excludePackageStatements: true + excludeImportStatements: true + excludeCommentStatements: false + excludeRawStrings: true + MayBeConst: + active: true + ModifierOrder: + active: true + MultilineLambdaItParameter: + active: false + MultilineRawStringIndentation: + active: false + indentSize: 4 + trimmingMethods: + - 'trimIndent' + - 'trimMargin' + NestedClassesVisibility: + active: true + NewLineAtEndOfFile: + active: true + NoTabs: + active: false + NullableBooleanCheck: + active: false + ObjectLiteralToLambda: + active: true + OptionalAbstractKeyword: + active: true + OptionalUnit: + active: false + PreferToOverPairSyntax: + active: false + ProtectedMemberInFinalClass: + active: true + RedundantExplicitType: + active: false + RedundantHigherOrderMapUsage: + active: true + RedundantVisibilityModifierRule: + active: false + ReturnCount: + active: true + max: 2 + excludedFunctions: + - 'equals' + excludeLabeled: false + excludeReturnFromLambda: true + excludeGuardClauses: false + SafeCast: + active: true + SerialVersionUIDInSerializableClass: + active: true + SpacingBetweenPackageAndImports: + active: false + StringShouldBeRawString: + active: false + maxEscapedCharacterCount: 2 + ignoredCharacters: [] + ThrowsCount: + active: true + max: 2 + excludeGuardClauses: false + TrailingWhitespace: + active: false + TrimMultilineRawString: + active: false + trimmingMethods: + - 'trimIndent' + - 'trimMargin' + UnderscoresInNumericLiterals: + active: false + acceptableLength: 4 + allowNonStandardGrouping: false + UnnecessaryAbstractClass: + active: true + UnnecessaryAnnotationUseSiteTarget: + active: false + UnnecessaryApply: + active: true + UnnecessaryBackticks: + active: false + UnnecessaryBracesAroundTrailingLambda: + active: false + UnnecessaryFilter: + active: true + UnnecessaryInheritance: + active: true + UnnecessaryInnerClass: + active: false + UnnecessaryLet: + active: false + UnnecessaryParentheses: + active: false + allowForUnclearPrecedence: false + UntilInsteadOfRangeTo: + active: false + UnusedImports: + active: false + UnusedParameter: + active: true + allowedNames: 'ignored|expected' + UnusedPrivateClass: + active: true + UnusedPrivateMember: + active: true + allowedNames: '' + UnusedPrivateProperty: + active: true + allowedNames: '_|ignored|expected|serialVersionUID' + UseAnyOrNoneInsteadOfFind: + active: true + UseArrayLiteralsInAnnotations: + active: true + UseCheckNotNull: + active: true + UseCheckOrError: + active: true + UseDataClass: + active: false + allowVars: false + UseEmptyCounterpart: + active: false + UseIfEmptyOrIfBlank: + active: false + UseIfInsteadOfWhen: + active: false + ignoreWhenContainingVariableDeclaration: false + UseIsNullOrEmpty: + active: true + UseLet: + active: false + UseOrEmpty: + active: true + UseRequire: + active: true + UseRequireNotNull: + active: true + UseSumOfInsteadOfFlatMapSize: + active: false + UselessCallOnNotNull: + active: true + UtilityClassWithPublicConstructor: + active: true + VarCouldBeVal: + active: true + ignoreLateinitVar: false + WildcardImport: + active: true + excludeImports: + - 'java.util.*'