Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
e
os
BlissLauncher
Commits
2ff37d27
Commit
2ff37d27
authored
Apr 25, 2022
by
Suphon Thanakornpakapong
Browse files
Fix IndexOutOfBoundsException while loading items
parent
691765cc
Pipeline
#180643
passed with stage
in 2 minutes and 48 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
app/src/main/java/foundation/e/blisslauncher/core/database/model/LauncherItem.java
View file @
2ff37d27
...
...
@@ -140,7 +140,7 @@ public class LauncherItem {
@Override
public
String
toString
()
{
return
"[id: "
+
id
+
"item_type: "
+
itemType
+
", container: "
+
container
+
", screen: "
+
screenId
return
"[id: "
+
id
+
"
,
item_type: "
+
itemType
+
", container: "
+
container
+
", screen: "
+
screenId
+
", cell: "
+
cell
+
"]"
;
}
...
...
app/src/main/java/foundation/e/blisslauncher/features/launcher/AppProvider.java
View file @
2ff37d27
...
...
@@ -337,6 +337,8 @@ public class AppProvider {
if
(
index
!=
null
)
{
FolderItem
folderItem
=
(
FolderItem
)
mLauncherItems
.
get
(
index
);
folderItem
.
items
.
add
(
applicationItem
);
}
else
{
Log
.
e
(
"AppProvider"
,
"folder not found for item: "
+
applicationItem
.
id
);
}
}
}
else
if
(
databaseItem
.
itemType
==
Constants
.
ITEM_TYPE_SHORTCUT
)
{
...
...
@@ -377,17 +379,22 @@ public class AppProvider {
}
}
if
(
foldersIndex
.
size
()
>
0
)
{
for
(
int
i
=
0
;
i
<
foldersIndex
.
size
();
i
++)
{
FolderItem
folderItem
=
(
FolderItem
)
mLauncherItems
.
get
(
foldersIndex
.
get
(
foldersIndex
.
keyAt
(
i
)));
if
(
folderItem
.
items
==
null
||
folderItem
.
items
.
size
()
==
0
)
{
DatabaseManager
.
getManager
(
mContext
).
removeLauncherItem
(
folderItem
.
id
);
mLauncherItems
.
remove
((
int
)
foldersIndex
.
get
(
foldersIndex
.
keyAt
(
i
)));
}
else
{
folderItem
.
icon
=
new
GraphicsUtil
(
mContext
).
generateFolderIcon
(
mContext
,
folderItem
);
}
List
<
Integer
>
folderItemsIndex
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
foldersIndex
.
size
();
i
++)
{
int
itemIndex
=
foldersIndex
.
get
(
foldersIndex
.
keyAt
(
i
));
folderItemsIndex
.
add
(
itemIndex
);
}
Collections
.
sort
(
folderItemsIndex
);
for
(
int
i
=
folderItemsIndex
.
size
()
-
1
;
i
>=
0
;
i
--)
{
int
itemIndex
=
folderItemsIndex
.
get
(
i
);
FolderItem
folderItem
=
(
FolderItem
)
mLauncherItems
.
get
(
itemIndex
);
if
(
folderItem
.
items
==
null
||
folderItem
.
items
.
size
()
==
0
)
{
DatabaseManager
.
getManager
(
mContext
).
removeLauncherItem
(
folderItem
.
id
);
mLauncherItems
.
remove
(
itemIndex
);
}
else
{
folderItem
.
icon
=
new
GraphicsUtil
(
mContext
).
generateFolderIcon
(
mContext
,
folderItem
);
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment