mirror of
https://github.com/nextcloud/android.git
synced 2024-11-30 08:25:21 +03:00
Fix detekt findings
Signed-off-by: Alper Ozturk <alperozturk@lions-macbook.local> Signed-off-by: alperozturk <alper_ozturk@proton.me>
This commit is contained in:
parent
b38c54a4c9
commit
7458ba3d60
4 changed files with 10 additions and 9 deletions
|
@ -51,10 +51,8 @@ class GroupfolderListAdapter(
|
|||
}
|
||||
|
||||
private fun getFolderIcon(): LayerDrawable? {
|
||||
val folderDrawable = MimeTypeUtil.getDefaultFolderIcon(context, viewThemeUtils) ?: return null
|
||||
val overlayDrawable = ContextCompat.getDrawable(context, R.drawable.ic_folder_overlay_account_group) ?: return null
|
||||
val drawableUtil = DrawableUtil()
|
||||
return drawableUtil.addDrawableAsOverlay(context, folderDrawable, overlayDrawable)
|
||||
val overlayDrawableId = R.drawable.ic_folder_overlay_account_group
|
||||
return MimeTypeUtil.getFileIcon(false, overlayDrawableId, context, viewThemeUtils)
|
||||
}
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
|
||||
|
|
|
@ -19,8 +19,11 @@ class DrawableUtil {
|
|||
fun addDrawableAsOverlay(context: Context, backgroundDrawable: Drawable, overlayDrawable: Drawable): LayerDrawable {
|
||||
val isLowDensityScreen = context.resources.displayMetrics.isLowDensityScreen()
|
||||
|
||||
val overlayIconSize = if (isLowDensityScreen) { 12 } else { 24 }
|
||||
val overlayIconTopMargin = if (isLowDensityScreen) { 3 } else { 6 }
|
||||
val defaultIconSize = 24
|
||||
val defaultIconTopMargin = 6
|
||||
|
||||
val overlayIconSize = if (isLowDensityScreen) { defaultIconSize / 2 } else { defaultIconSize }
|
||||
val overlayIconTopMargin = if (isLowDensityScreen) { defaultIconTopMargin / 2 } else { defaultIconTopMargin }
|
||||
|
||||
val layerDrawable = LayerDrawable(arrayOf(backgroundDrawable, overlayDrawable))
|
||||
layerDrawable.setLayerSizeWithInsetTop(1, overlayIconSize, overlayIconTopMargin)
|
||||
|
|
Loading…
Reference in a new issue