Skip to content

Commit

Permalink
added more icons for image actions such as search, add, placeholder
Browse files Browse the repository at this point in the history
  • Loading branch information
cjimenezsanchez committed Jul 19, 2023
1 parent 0faf843 commit db609f5
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
package com.architectcoders.aacboard.ui.fragments.adapter

import android.content.Context
import android.view.LayoutInflater
import android.view.ViewGroup
import android.widget.ImageView
import androidx.annotation.DrawableRes
import androidx.core.content.res.ResourcesCompat
import androidx.core.view.isVisible
import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.architectcoders.aacboard.R
import com.architectcoders.aacboard.databinding.ItemDashboardCellBinding
import com.architectcoders.aacboard.domain.data.cell.Cell
import com.architectcoders.aacboard.domain.data.cell.CellPictogram
import com.architectcoders.aacboard.ui.utils.basicDiffUtil
import com.architectcoders.aacboard.ui.utils.getScreenSize
import com.architectcoders.aacboard.ui.utils.loadUrl
Expand Down Expand Up @@ -76,10 +77,12 @@ class DashboardCellsAdapter(
}

private fun ItemDashboardCellBinding.renderCell(item: Cell) {
if (editionEnabled) {
cellAddPictogram.isVisible = item.cellPictogram?.url == null
}
if (editionEnabled) cellPictogram.setDrawableResource(root.context, R.drawable.ic_image_add)
item.cellPictogram?.url?.let { url -> cellPictogram.loadUrl(url) }
item.cellPictogram?.keyword?.let { cellPictogramKeyword.text = it }
}
}

private fun ImageView.setDrawableResource(context: Context, @DrawableRes id: Int) {
setImageDrawable(ResourcesCompat.getDrawable(context.resources, id, null))
}
9 changes: 9 additions & 0 deletions app/src/main/res/drawable/ic_image_add.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector android:height="24dp" android:tint="#BCBCBC"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M10.21,16.83l-1.96,-2.36L5.5,18h11l-3.54,-4.71z"/>
<path android:fillAlpha="0.3"
android:fillColor="@android:color/white"
android:pathData="M16.5,18h-11l2.75,-3.53 1.96,2.36 2.75,-3.54L16.5,18zM17,7h-3V6H4v14h14V10h-1V7z" android:strokeAlpha="0.3"/>
<path android:fillColor="@android:color/white" android:pathData="M20,4L20,1h-2v3h-3v2h3v2.99h2L20,6h3L23,4zM18,20L4,20L4,6h10L14,4L4,4c-1.1,0 -2,0.9 -2,2v14c0,1.1 0.9,2 2,2h14c1.1,0 2,-0.9 2,-2L20,10h-2v10z"/>
</vector>
8 changes: 8 additions & 0 deletions app/src/main/res/drawable/ic_image_placeholder.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<vector android:height="24dp" android:tint="#BCBCBC"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillAlpha="0.3"
android:fillColor="@android:color/white"
android:pathData="M5,19h14L19,5L5,5v14zM9,13.14l2.14,2.58 3,-3.87L18,17L6,17l3,-3.86z" android:strokeAlpha="0.3"/>
<path android:fillColor="@android:color/white" android:pathData="M19,3L5,3c-1.1,0 -2,0.9 -2,2v14c0,1.1 0.9,2 2,2h14c1.1,0 2,-0.9 2,-2L21,5c0,-1.1 -0.9,-2 -2,-2zM19,19L5,19L5,5h14v14zM14.14,11.86l-3,3.86L9,13.14 6,17h12z"/>
</vector>
8 changes: 8 additions & 0 deletions app/src/main/res/drawable/ic_image_search.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<vector android:height="24dp" android:tint="#BCBCBC"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillAlpha="0.3"
android:fillColor="@android:color/white"
android:pathData="M17.7,11.53c-0.7,0.31 -1.45,0.47 -2.21,0.47C12.46,12 10,9.53 10,6.5c0,-0.17 0.01,-0.34 0.03,-0.5H4v14h14v-8.17l-0.3,-0.3zM5.5,18l2.75,-3.53 1.96,2.36 2.75,-3.54L16.5,18h-11z" android:strokeAlpha="0.3"/>
<path android:fillColor="@android:color/white" android:pathData="M10.21,16.83l-1.96,-2.36L5.5,18h11l-3.54,-4.71zM20,6.5C20,4.01 17.99,2 15.5,2S11,4.01 11,6.5s2.01,4.5 4.49,4.5c0.88,0 1.7,-0.26 2.39,-0.7L21,13.42 22.42,12 19.3,8.89c0.44,-0.7 0.7,-1.51 0.7,-2.39zM15.5,9C14.12,9 13,7.88 13,6.5S14.12,4 15.5,4 18,5.12 18,6.5 16.88,9 15.5,9zM18,20H4V6h6.03c0.06,-0.72 0.27,-1.39 0.58,-2H4c-1.1,0 -2,0.9 -2,2v14c0,1.1 0.9,2 2,2h14c1.1,0 2,-0.9 2,-2v-6.17l-2,-2V20z"/>
</vector>
2 changes: 1 addition & 1 deletion app/src/main/res/layout/fragment_edit_board_cell.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
android:layout_height="100dp"
android:scaleType="fitCenter"
android:adjustViewBounds="true"
app:srcCompat="@drawable/ic_no_image"
app:srcCompat="@drawable/ic_image_search"
android:layout_gravity="center_horizontal"/>
<TextView
android:id="@+id/keywordLabel"
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/fragment_new_dashboard.xml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
android:scaleType="fitCenter"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/text_input_dashboard_name"
app:srcCompat="@drawable/ic_no_image" />
app:srcCompat="@drawable/ic_image_search" />

<ProgressBar
android:id="@+id/progress_circular"
Expand Down

0 comments on commit db609f5

Please sign in to comment.