Fix number of icons

This commit is contained in:
J-Jamet
2021-02-25 15:44:23 +01:00
parent 80521f8ec2
commit b609ed3ad4
5 changed files with 16 additions and 28 deletions

View File

@@ -32,7 +32,7 @@ class IconImageStandard : Parcelable {
} }
constructor(iconId: Int) { constructor(iconId: Int) {
if (iconId < 0 || iconId > NB_ICONS) if (iconId < 0 || iconId >= NB_ICONS)
this.id = KEY_ID this.id = KEY_ID
else else
this.id = iconId this.id = iconId

View File

@@ -78,7 +78,7 @@ class IconPack(packageName: String, resources: Resources, resourceId: Int) {
// Build the list of icons // Build the list of icons
var num = 0 var num = 0
while (num <= NB_ICONS) { while (num < NB_ICONS) {
// To construct the id with name_ic_XX_32dp (ex : classic_ic_08_32dp ) // To construct the id with name_ic_XX_32dp (ex : classic_ic_08_32dp )
val resId = resources.getIdentifier( val resId = resources.getIdentifier(
id + "_" + String.format(Locale.ENGLISH, "%02d", num) + "_32dp", id + "_" + String.format(Locale.ENGLISH, "%02d", num) + "_32dp",
@@ -134,6 +134,6 @@ class IconPack(packageName: String, resources: Resources, resourceId: Int) {
} }
companion object { companion object {
const val NB_ICONS = 68 const val NB_ICONS = 69
} }
} }

View File

@@ -24,12 +24,4 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager" app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
app:spanCount="2" app:spanCount="4" />
android:verticalSpacing="32dp"
android:paddingTop="20dp"
android:gravity="center"
android:layout_gravity="center"
android:columnWidth="64dp"
android:numColumns="auto_fit"
android:stretchMode="spacingWidthUniform">
</androidx.recyclerview.widget.RecyclerView>

View File

@@ -24,12 +24,4 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager" app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
app:spanCount="2" app:spanCount="4" />
android:verticalSpacing="32dp"
android:paddingTop="20dp"
android:gravity="center"
android:layout_gravity="center"
android:columnWidth="64dp"
android:numColumns="auto_fit"
android:stretchMode="spacingWidthUniform">
</androidx.recyclerview.widget.RecyclerView>

View File

@@ -17,11 +17,15 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with KeePassDX. If not, see <http://www.gnu.org/licenses/>. along with KeePassDX. If not, see <http://www.gnu.org/licenses/>.
--> -->
<androidx.appcompat.widget.AppCompatImageView <FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/icon_image" android:layout_width="match_parent"
android:layout_width="wrap_content" android:layout_height="wrap_content">
android:layout_height="wrap_content" <androidx.appcompat.widget.AppCompatImageView
android:layout_gravity="center" android:id="@+id/icon_image"
android:layout_margin="32dp"> android:layout_width="wrap_content"
</androidx.appcompat.widget.AppCompatImageView> android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="16dp">
</androidx.appcompat.widget.AppCompatImageView>
</FrameLayout>