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
c26428d8
Commit
c26428d8
authored
Sep 19, 2021
by
Amit Kumar
💻
Browse files
Fix database integration crash and save layout after folder
parent
613c4237
Pipeline
#136245
passed with stage
in 3 minutes and 13 seconds
Changes
7
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
app/src/main/java/foundation/e/blisslauncher/core/customviews/LauncherPagedView.java
View file @
c26428d8
...
...
@@ -46,7 +46,8 @@ import foundation.e.blisslauncher.core.touch.ItemClickHandler;
import
foundation.e.blisslauncher.core.touch.ItemLongClickListener
;
import
foundation.e.blisslauncher.core.utils.Constants
;
import
foundation.e.blisslauncher.core.utils.GraphicsUtil
;
import
foundation.e.blisslauncher.core.utils.LongArrayMap
;
import
foundation.e.blisslauncher.core.utils.IntSparseArrayMap
;
import
foundation.e.blisslauncher.core.utils.IntegerArray
;
import
foundation.e.blisslauncher.core.utils.PackageUserKey
;
import
foundation.e.blisslauncher.features.launcher.Hotseat
;
import
foundation.e.blisslauncher.features.notification.FolderDotInfo
;
...
...
@@ -95,7 +96,7 @@ public class LauncherPagedView extends PagedView<PageIndicatorDots> implements V
private
static
final
boolean
MAP_RECURSE
=
true
;
// The screen id used for the empty screen always present to the right.
public
static
final
long
EXTRA_EMPTY_SCREEN_ID
=
-
201
;
public
static
final
int
EXTRA_EMPTY_SCREEN_ID
=
-
201
;
// The is the first screen. It is always present, even if its empty.
public
static
final
long
FIRST_SCREEN_ID
=
0
;
private
static
final
int
ADJACENT_SCREEN_DROP_DURATION
=
300
;
...
...
@@ -105,8 +106,8 @@ public class LauncherPagedView extends PagedView<PageIndicatorDots> implements V
private
LayoutTransition
mLayoutTransition
;
final
WallpaperManager
mWallpaperManager
;
public
final
Long
ArrayMap
<
CellLayout
>
mWorkspaceScreens
=
new
Long
ArrayMap
<>();
final
ArrayList
<
Long
>
mScreenOrder
=
new
ArrayList
<>
();
public
final
IntSparse
ArrayMap
<
CellLayout
>
mWorkspaceScreens
=
new
IntSparse
ArrayMap
<>();
final
IntegerArray
mScreenOrder
=
new
IntegerArray
();
// Variables relating to touch disambiguation (scrolling workspace vs. scrolling a widget)
private
float
mXDown
;
...
...
@@ -275,7 +276,7 @@ public class LauncherPagedView extends PagedView<PageIndicatorDots> implements V
enableLayoutTransitions
();
}
public
void
insertNewWorkspaceScreenBeforeEmptyScreen
(
long
screenId
)
{
public
void
insertNewWorkspaceScreenBeforeEmptyScreen
(
int
screenId
)
{
// Find the index to insert this view into. If the empty screen exists, then
// insert it before that.
int
insertIndex
=
mScreenOrder
.
indexOf
(
EXTRA_EMPTY_SCREEN_ID
);
...
...
@@ -285,9 +286,18 @@ public class LauncherPagedView extends PagedView<PageIndicatorDots> implements V
insertNewWorkspaceScreen
(
screenId
,
insertIndex
);
}
public
void
bindScreens
(
@NotNull
IntegerArray
orderedScreenIds
)
{
if
(
orderedScreenIds
.
isEmpty
())
{
addExtraEmptyScreen
();
}
for
(
int
i
=
0
;
i
<
orderedScreenIds
.
size
();
i
++)
{
int
screenId
=
orderedScreenIds
.
get
(
i
);
insertNewWorkspaceScreenBeforeEmptyScreen
(
screenId
);
}
}
public
void
bindItems
(
@NotNull
List
<?
extends
LauncherItem
>
launcherItems
)
{
removeAllWorkspaceScreens
();
GridLayout
workspaceScreen
=
insertNewWorkspaceScreen
(
0
);
for
(
LauncherItem
launcherItem
:
launcherItems
)
{
IconTextView
appView
=
(
IconTextView
)
LayoutInflater
.
from
(
getContext
())
.
inflate
(
R
.
layout
.
app_icon
,
null
,
false
);
...
...
@@ -295,10 +305,9 @@ public class LauncherPagedView extends PagedView<PageIndicatorDots> implements V
appView
.
setOnClickListener
(
ItemClickHandler
.
INSTANCE
);
appView
.
setOnLongClickListener
(
ItemLongClickListener
.
INSTANCE_WORKSPACE
);
if
(
launcherItem
.
container
==
Constants
.
CONTAINER_DESKTOP
)
{
if
(
workspaceScreen
.
getChildCount
()
>=
mLauncher
.
getDeviceProfile
().
getInv
()
.
getNumRows
()
*
mLauncher
.
getDeviceProfile
().
getInv
().
getNumColumns
()
||
launcherItem
.
screenId
>
mScreenOrder
.
size
()
-
1
)
{
workspaceScreen
=
insertNewWorkspaceScreen
(
mScreenOrder
.
size
());
CellLayout
cl
=
getScreenWithId
(
launcherItem
.
screenId
);
if
(
cl
!=
null
&&
cl
.
isOccupied
(
launcherItem
.
cell
))
{
// TODO: Add item to the end of the list
}
GridLayout
.
Spec
rowSpec
=
GridLayout
.
spec
(
GridLayout
.
UNDEFINED
);
GridLayout
.
Spec
colSpec
=
GridLayout
.
spec
(
GridLayout
.
UNDEFINED
);
...
...
@@ -306,29 +315,27 @@ public class LauncherPagedView extends PagedView<PageIndicatorDots> implements V
new
GridLayout
.
LayoutParams
(
rowSpec
,
colSpec
);
iconLayoutParams
.
height
=
mLauncher
.
getDeviceProfile
().
getCellHeightPx
();
iconLayoutParams
.
width
=
mLauncher
.
getDeviceProfile
().
getCellWidthPx
();
iconLayoutParams
.
setGravity
(
Gravity
.
CENTER
);
appView
.
setLayoutParams
(
iconLayoutParams
);
appView
.
setTextVisibility
(
true
);
workspaceScreen
.
addView
(
appView
);
addInScreenFromBind
(
appView
,
launcherItem
);
}
else
if
(
launcherItem
.
container
==
Constants
.
CONTAINER_HOTSEAT
)
{
GridLayout
.
Spec
rowSpec
=
GridLayout
.
spec
(
GridLayout
.
UNDEFINED
);
GridLayout
.
Spec
colSpec
=
GridLayout
.
spec
(
GridLayout
.
UNDEFINED
);
GridLayout
.
LayoutParams
iconLayoutParams
=
new
GridLayout
.
LayoutParams
(
rowSpec
,
colSpec
);
iconLayoutParams
.
setGravity
(
Gravity
.
CENTER
);
iconLayoutParams
.
height
=
mLauncher
.
getDeviceProfile
().
getHotseatCellHeightPx
();
iconLayoutParams
.
width
=
mLauncher
.
getDeviceProfile
().
getCellWidthPx
();
appView
.
setLayoutParams
(
iconLayoutParams
);
mLauncher
.
getHotseat
().
getLayout
().
addView
(
appView
);
addInScreenFromBind
(
appView
,
launcherItem
);
}
}
}
public
GridLayout
insertNewWorkspaceScreen
(
long
screenId
)
{
public
GridLayout
insertNewWorkspaceScreen
(
int
screenId
)
{
return
insertNewWorkspaceScreen
(
screenId
,
getChildCount
());
}
public
GridLayout
insertNewWorkspaceScreen
(
long
screenId
,
int
insertIndex
)
{
public
GridLayout
insertNewWorkspaceScreen
(
int
screenId
,
int
insertIndex
)
{
if
(
mWorkspaceScreens
.
containsKey
(
screenId
))
{
throw
new
RuntimeException
(
"Screen id "
+
screenId
+
" already exists!"
);
}
...
...
@@ -346,8 +353,6 @@ public class LauncherPagedView extends PagedView<PageIndicatorDots> implements V
mWorkspaceScreens
.
put
(
screenId
,
newScreen
);
mScreenOrder
.
add
(
insertIndex
,
screenId
);
addView
(
newScreen
,
insertIndex
);
/*mStateTransitionAnimation.applyChildState(
mLauncher.getStateManager().getState(), newScreen, insertIndex);*/
return
newScreen
;
}
...
...
@@ -393,14 +398,14 @@ public class LauncherPagedView extends PagedView<PageIndicatorDots> implements V
}
if
(
hasExtraEmptyScreen
()
||
mScreenOrder
.
size
()
==
0
)
return
;
long
finalScreenId
=
mScreenOrder
.
get
(
mScreenOrder
.
size
()
-
1
);
int
finalScreenId
=
mScreenOrder
.
get
(
mScreenOrder
.
size
()
-
1
);
CellLayout
finalScreen
=
mWorkspaceScreens
.
get
(
finalScreenId
);
// If the final screen is empty, convert it to the extra empty screen
if
(
finalScreen
.
getChildCount
()
==
0
)
{
mWorkspaceScreens
.
remove
(
finalScreenId
);
mScreenOrder
.
remove
(
finalScreenId
);
mScreenOrder
.
remove
Value
(
finalScreenId
);
// if this is the last screen, convert it to the empty screen
mWorkspaceScreens
.
put
(
EXTRA_EMPTY_SCREEN_ID
,
finalScreen
);
...
...
@@ -473,7 +478,7 @@ public class LauncherPagedView extends PagedView<PageIndicatorDots> implements V
mRemoveEmptyScreenRunnable
=
()
->
{
if
(
hasExtraEmptyScreen
())
{
mWorkspaceScreens
.
remove
(
EXTRA_EMPTY_SCREEN_ID
);
mScreenOrder
.
remove
(
EXTRA_EMPTY_SCREEN_ID
);
mScreenOrder
.
remove
Value
(
EXTRA_EMPTY_SCREEN_ID
);
removeView
(
cl
);
if
(
stripEmptyScreens
)
{
stripEmptyScreens
();
...
...
@@ -512,9 +517,9 @@ public class LauncherPagedView extends PagedView<PageIndicatorDots> implements V
CellLayout
cl
=
mWorkspaceScreens
.
get
(
EXTRA_EMPTY_SCREEN_ID
);
mWorkspaceScreens
.
remove
(
EXTRA_EMPTY_SCREEN_ID
);
mScreenOrder
.
remove
(
EXTRA_EMPTY_SCREEN_ID
);
mScreenOrder
.
remove
Value
(
EXTRA_EMPTY_SCREEN_ID
);
long
newId
=
mScreenOrder
.
size
();
int
newId
=
mScreenOrder
.
size
();
mWorkspaceScreens
.
put
(
newId
,
cl
);
mScreenOrder
.
add
(
newId
);
...
...
@@ -524,11 +529,11 @@ public class LauncherPagedView extends PagedView<PageIndicatorDots> implements V
return
newId
;
}
public
CellLayout
getScreenWithId
(
long
screenId
)
{
public
CellLayout
getScreenWithId
(
int
screenId
)
{
return
mWorkspaceScreens
.
get
(
screenId
);
}
public
long
getIdForScreen
(
CellLayout
layout
)
{
public
int
getIdForScreen
(
CellLayout
layout
)
{
int
index
=
mWorkspaceScreens
.
indexOfValue
(
layout
);
if
(
index
!=
-
1
)
{
return
mWorkspaceScreens
.
keyAt
(
index
);
...
...
@@ -628,7 +633,7 @@ public class LauncherPagedView extends PagedView<PageIndicatorDots> implements V
return
iconView
;
}
public
int
getPageIndexForScreenId
(
long
screenId
)
{
public
int
getPageIndexForScreenId
(
int
screenId
)
{
return
indexOfChild
(
mWorkspaceScreens
.
get
(
screenId
));
}
...
...
@@ -639,7 +644,7 @@ public class LauncherPagedView extends PagedView<PageIndicatorDots> implements V
return
-
1
;
}
public
ArrayList
<
Long
>
getScreenOrder
()
{
public
IntegerArray
getScreenOrder
()
{
return
mScreenOrder
;
}
...
...
@@ -656,10 +661,10 @@ public class LauncherPagedView extends PagedView<PageIndicatorDots> implements V
}
int
currentPage
=
getNextPage
();
ArrayList
<
Long
>
removeScreens
=
new
ArrayList
<>
();
IntegerArray
removeScreens
=
new
IntegerArray
();
int
total
=
mWorkspaceScreens
.
size
();
for
(
int
i
=
0
;
i
<
total
;
i
++)
{
long
id
=
mWorkspaceScreens
.
keyAt
(
i
);
int
id
=
mWorkspaceScreens
.
keyAt
(
i
);
GridLayout
cl
=
mWorkspaceScreens
.
valueAt
(
i
);
removeScreens
.
add
(
id
);
}
...
...
@@ -669,10 +674,11 @@ public class LauncherPagedView extends PagedView<PageIndicatorDots> implements V
int
minScreens
=
1
;
int
pageShift
=
0
;
for
(
Long
id
:
removeScreens
)
{
for
(
int
i
=
0
;
i
<
removeScreens
.
size
();
i
++)
{
int
id
=
removeScreens
.
get
(
i
);
CellLayout
cl
=
mWorkspaceScreens
.
get
(
id
);
mWorkspaceScreens
.
remove
(
id
);
mScreenOrder
.
remove
(
id
);
mScreenOrder
.
remove
Value
(
id
);
if
(
getChildCount
()
>
minScreens
)
{
if
(
indexOfChild
(
cl
)
<
currentPage
)
{
...
...
@@ -711,7 +717,7 @@ public class LauncherPagedView extends PagedView<PageIndicatorDots> implements V
private
void
addInScreen
(
View
child
,
long
container
,
long
screenId
,
int
screenId
,
int
x
,
int
y
,
boolean
animate
...
...
@@ -744,7 +750,7 @@ public class LauncherPagedView extends PagedView<PageIndicatorDots> implements V
* @param screenId The screen in which to add the child.
* @param index The index of the child in grid.
*/
private
void
addInScreen
(
View
child
,
long
container
,
long
screenId
,
int
index
)
{
private
void
addInScreen
(
View
child
,
long
container
,
int
screenId
,
int
index
)
{
if
(
container
==
Constants
.
CONTAINER_DESKTOP
)
{
if
(
getScreenWithId
(
screenId
)
==
null
)
{
Log
.
e
(
TAG
,
"Skipping child, screenId "
+
screenId
+
" not found"
);
...
...
@@ -815,7 +821,7 @@ public class LauncherPagedView extends PagedView<PageIndicatorDots> implements V
}
public
void
addInScreenFromBind
(
View
child
,
LauncherItem
info
)
{
mWorkspaceScreens
.
get
(
info
.
screenId
).
addView
(
child
);
addInScreen
(
child
,
info
.
container
,
info
.
screenId
,
info
.
cell
);
}
/**
...
...
@@ -1346,7 +1352,7 @@ public class LauncherPagedView extends PagedView<PageIndicatorDots> implements V
long
container
=
hasMovedIntoHotseat
?
Constants
.
CONTAINER_HOTSEAT
:
Constants
.
CONTAINER_DESKTOP
;
long
screenId
=
(
mTargetCell
[
0
]
<
0
)
?
int
screenId
=
(
mTargetCell
[
0
]
<
0
)
?
mDragInfo
.
getScreenId
()
:
getIdForScreen
(
dropTargetLayout
);
int
spanX
=
1
;
int
spanY
=
1
;
...
...
@@ -1397,8 +1403,6 @@ public class LauncherPagedView extends PagedView<PageIndicatorDots> implements V
);
}*/
Log
.
i
(
TAG
,
"onDrop: Test here"
);
int
[]
resultSpan
=
new
int
[
2
];
mTargetCell
=
dropTargetLayout
.
performReorder
((
int
)
mDragViewVisualCenter
[
0
],
(
int
)
mDragViewVisualCenter
[
1
],
1
,
1
,
spanX
,
spanY
,
cell
,
...
...
@@ -1456,8 +1460,6 @@ public class LauncherPagedView extends PagedView<PageIndicatorDots> implements V
}
}
Log
.
i
(
TAG
,
"onDrop: Test here2"
);
final
CellLayout
parent
=
(
CellLayout
)
cell
.
getParent
();
if
(
d
.
dragView
.
hasDrawn
())
{
if
(
droppedOnOriginalCellDuringTransition
)
{
...
...
@@ -1490,7 +1492,7 @@ public class LauncherPagedView extends PagedView<PageIndicatorDots> implements V
List
<
LauncherItem
>
items
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
layouts
.
size
();
i
++)
{
CellLayout
cellLayout
=
layouts
.
get
(
i
);
long
screenId
=
getIdForScreen
(
cellLayout
);
int
screenId
=
getIdForScreen
(
cellLayout
);
long
container
;
if
(
cellLayout
.
getContainerType
()
==
CellLayout
.
WORKSPACE
)
{
container
=
Constants
.
CONTAINER_DESKTOP
;
...
...
@@ -1540,7 +1542,7 @@ public class LauncherPagedView extends PagedView<PageIndicatorDots> implements V
if
(
targetView
==
null
||
hasntMoved
||
!
mCreateUserFolderOnDrop
)
return
false
;
mCreateUserFolderOnDrop
=
false
;
final
long
screenId
=
getIdForScreen
(
target
);
final
int
screenId
=
getIdForScreen
(
target
);
boolean
aboveShortcut
=
(
targetView
.
getTag
()
instanceof
ApplicationItem
)
||
(
targetView
...
...
@@ -1590,6 +1592,7 @@ public class LauncherPagedView extends PagedView<PageIndicatorDots> implements V
dragView
.
remove
();
dragView
=
null
;
invalidate
();
updateDatabase
(
getWorkspaceAndHotseatCellLayouts
());
post
(()
->
{
if
(
fi
.
cell
%
2
==
0
)
{
folderView
...
...
@@ -1636,6 +1639,7 @@ public class LauncherPagedView extends PagedView<PageIndicatorDots> implements V
d
.
dragView
.
remove
();
d
.
dragView
=
null
;
invalidate
();
updateDatabase
(
getWorkspaceAndHotseatCellLayouts
());
return
true
;
}
return
false
;
...
...
@@ -2103,7 +2107,7 @@ public class LauncherPagedView extends PagedView<PageIndicatorDots> implements V
}
boolean
willAddToExistingUserFolder
(
LauncherItem
dragInfo
,
View
dropOverView
)
{
if
(
dropOverView
.
getTag
()
instanceof
FolderItem
)
{
if
(
dropOverView
!=
null
&&
dropOverView
.
getTag
()
instanceof
FolderItem
)
{
return
true
;
}
return
false
;
...
...
@@ -2469,6 +2473,8 @@ public class LauncherPagedView extends PagedView<PageIndicatorDots> implements V
computeScrollHelper
(
false
);
}
public
interface
ItemOperator
{
/**
* Process the next itemInfo, possibly with side-effect on the next item.
...
...
app/src/main/java/foundation/e/blisslauncher/core/database/model/LauncherItem.java
View file @
c26428d8
...
...
@@ -67,7 +67,7 @@ public class LauncherItem {
* {@link Constants#CONTAINER_HOTSEAT})
*/
@ColumnInfo
(
name
=
"screen_id"
)
public
long
screenId
=
-
1
;
public
int
screenId
=
-
1
;
/**
* Indicates the position of the associated cell.
...
...
app/src/main/java/foundation/e/blisslauncher/core/utils/IntSet.java
View file @
c26428d8
...
...
@@ -22,7 +22,7 @@ import java.util.Arrays;
*/
public
class
IntSet
{
final
IntArray
mArray
=
new
IntArray
();
final
Int
eger
Array
mArray
=
new
Int
eger
Array
();
/**
* Appends the specified value to the set if it does not exist.
...
...
@@ -61,7 +61,7 @@ public class IntSet {
return
(
obj
instanceof
IntSet
)
&&
((
IntSet
)
obj
).
mArray
.
equals
(
mArray
);
}
public
IntArray
getArray
()
{
public
Int
eger
Array
getArray
()
{
return
mArray
;
}
...
...
@@ -72,7 +72,7 @@ public class IntSet {
mArray
.
copyFrom
(
other
.
mArray
);
}
public
static
IntSet
wrap
(
IntArray
array
)
{
public
static
IntSet
wrap
(
Int
eger
Array
array
)
{
IntSet
set
=
new
IntSet
();
set
.
mArray
.
addAll
(
array
);
Arrays
.
sort
(
set
.
mArray
.
mValues
,
0
,
set
.
mArray
.
mSize
);
...
...
app/src/main/java/foundation/e/blisslauncher/core/utils/IntSparseArrayMap.java
0 → 100644
View file @
c26428d8
/*
* Copyright (C) 2015 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
foundation.e.blisslauncher.core.utils
;
import
android.util.SparseArray
;
import
java.util.Iterator
;
/**
* Extension of {@link SparseArray} with some utility methods.
*/
public
class
IntSparseArrayMap
<
E
>
extends
SparseArray
<
E
>
implements
Iterable
<
E
>
{
public
boolean
containsKey
(
int
key
)
{
return
indexOfKey
(
key
)
>=
0
;
}
public
boolean
isEmpty
()
{
return
size
()
<=
0
;
}
@Override
public
IntSparseArrayMap
<
E
>
clone
()
{
return
(
IntSparseArrayMap
<
E
>)
super
.
clone
();
}
@Override
public
Iterator
<
E
>
iterator
()
{
return
new
ValueIterator
();
}
class
ValueIterator
implements
Iterator
<
E
>
{
private
int
mNextIndex
=
0
;
@Override
public
boolean
hasNext
()
{
return
mNextIndex
<
size
();
}
@Override
public
E
next
()
{
return
valueAt
(
mNextIndex
++);
}
@Override
public
void
remove
()
{
throw
new
UnsupportedOperationException
();
}
}
}
app/src/main/java/foundation/e/blisslauncher/core/utils/IntArray.java
→
app/src/main/java/foundation/e/blisslauncher/core/utils/Int
eger
Array.java
View file @
c26428d8
...
...
@@ -22,7 +22,7 @@ import java.util.Arrays;
* Copy of the platform hidden implementation of android.util.IntArray.
* Implements a growing array of int primitives.
*/
public
class
IntArray
implements
Cloneable
{
public
class
Int
eger
Array
implements
Cloneable
{
private
static
final
int
MIN_CAPACITY_INCREMENT
=
12
;
private
static
final
int
[]
EMPTY_INT
=
new
int
[
0
];
...
...
@@ -30,7 +30,7 @@ public class IntArray implements Cloneable {
/* package private */
int
[]
mValues
;
/* package private */
int
mSize
;
private
IntArray
(
int
[]
array
,
int
size
)
{
private
Int
eger
Array
(
int
[]
array
,
int
size
)
{
mValues
=
array
;
mSize
=
size
;
}
...
...
@@ -38,14 +38,14 @@ public class IntArray implements Cloneable {
/**
* Creates an empty IntArray with the default initial capacity.
*/
public
IntArray
()
{
public
Int
eger
Array
()
{
this
(
10
);
}
/**
* Creates an empty IntArray with the specified initial capacity.
*/
public
IntArray
(
int
initialCapacity
)
{
public
Int
eger
Array
(
int
initialCapacity
)
{
if
(
initialCapacity
==
0
)
{
mValues
=
EMPTY_INT
;
}
else
{
...
...
@@ -57,8 +57,8 @@ public class IntArray implements Cloneable {
/**
* Creates an IntArray wrapping the given primitive int array.
*/
public
static
IntArray
wrap
(
int
...
array
)
{
return
new
IntArray
(
array
,
array
.
length
);
public
static
Int
eger
Array
wrap
(
int
...
array
)
{
return
new
Int
eger
Array
(
array
,
array
.
length
);
}
/**
...
...
@@ -91,7 +91,7 @@ public class IntArray implements Cloneable {
/**
* Adds the values in the specified array to this array.
*/
public
void
addAll
(
IntArray
values
)
{
public
void
addAll
(
Int
eger
Array
values
)
{
final
int
count
=
values
.
mSize
;
ensureCapacity
(
count
);
...
...
@@ -102,7 +102,7 @@ public class IntArray implements Cloneable {
/**
* Sets the array to be same as {@param other}
*/
public
void
copyFrom
(
IntArray
other
)
{
public
void
copyFrom
(
Int
eger
Array
other
)
{
clear
();
addAll
(
other
);
}
...
...
@@ -131,7 +131,7 @@ public class IntArray implements Cloneable {
}
@Override
public
IntArray
clone
()
{
public
Int
eger
Array
clone
()
{
return
wrap
(
toArray
());
}
...
...
@@ -140,8 +140,8 @@ public class IntArray implements Cloneable {
if
(
obj
==
this
)
{
return
true
;
}
if
(
obj
instanceof
IntArray
)
{
IntArray
arr
=
(
IntArray
)
obj
;
if
(
obj
instanceof
Int
eger
Array
)
{
Int
eger
Array
arr
=
(
Int
eger
Array
)
obj
;
if
(
mSize
==
arr
.
mSize
)
{
for
(
int
i
=
0
;
i
<
mSize
;
i
++)
{
if
(
arr
.
mValues
[
i
]
!=
mValues
[
i
])
{
...
...
@@ -214,7 +214,7 @@ public class IntArray implements Cloneable {
/**
* Removes the values if it exists
*/
public
void
removeAllValues
(
IntArray
values
)
{
public
void
removeAllValues
(
Int
eger
Array
values
)
{
for
(
int
i
=
0
;
i
<
values
.
mSize
;
i
++)
{
removeValue
(
values
.
mValues
[
i
]);
}
...
...
app/src/main/java/foundation/e/blisslauncher/features/test/CellLayout.kt
View file @
c26428d8
...
...
@@ -13,7 +13,6 @@ import android.graphics.Point
import
android.graphics.Rect
import
android.util.ArrayMap
import
android.util.AttributeSet
import
android.util.Log
import
android.view.View
import
android.view.ViewGroup
import
android.view.animation.AnimationUtils
...
...
@@ -113,7 +112,6 @@ open class CellLayout @JvmOverloads constructor(
init
{
val
a
=
context
.
obtainStyledAttributes
(
attrs
,
R
.
styleable
.
CellLayout
,
defStyleAttr
,
0
)
mContainerType
=
a
.
getInteger
(
R
.
styleable
.
CellLayout_containerType
,
WORKSPACE
)
Log
.
i
(
TAG
,
"Container type: $mContainerType"
)
a
.
recycle
()
setWillNotDraw
(
false
)
...
...
@@ -151,10 +149,6 @@ open class CellLayout @JvmOverloads constructor(
if
(
outline
==
null
)
{
val
`val`
=
animation
.
animatedValue
Log
.
d
(
TAG
,
"anim "
+
i
+
" update: "
+
`val`
+
", isStopped "
+
anim
.
isStopped
)
// Try to prevent it from continuing to run
animation
.
cancel
()
}
else
{
...
...
@@ -266,7 +260,6 @@ open class CellLayout @JvmOverloads constructor(
override
fun
onViewAdded
(
child
:
View
?)
{
super
.
onViewAdded
(
child
)
Log
.
d
(
TAG
,
"onViewAdded() called with: child = $child"
)
}
fun
addViewToCellLayout
(
...
...
@@ -291,14 +284,7 @@ open class CellLayout @JvmOverloads constructor(
// Generate an id for each view, this assumes we have at most 256x256 cells
// per workspace screen
if
(
index
>=
0
&&
index
<=
mCountX
*
mCountY
-
1
)
{
child
.
id
=
childId
/* val rowSpec = spec(UNDEFINED)
val colSpec = spec(UNDEFINED)
val iconLayoutParams = LayoutParams(rowSpec, colSpec)
iconLayoutParams.height = launcher.deviceProfile.cellHeightPx
iconLayoutParams.width = launcher.deviceProfile.cellWidthPx
iconLayoutParams.setGravity(Gravity.CENTER)*/
addView
(
child
,
index
,
lp
)
if
(
markCells
)
markCellsAsOccupiedForView
(
child
)
...
...
@@ -561,7 +547,7 @@ open class CellLayout @JvmOverloads constructor(
pixelX
:
Int
,
pixelY
:
Int
,
result
:
IntArray
?
):
IntArray
?
{
):
IntArray
{
return
findNearestArea
(
pixelX
,
pixelY
,
false
,
result
,
null
)
}
...
...
@@ -583,7 +569,7 @@ open class CellLayout @JvmOverloads constructor(
ignoreOccupied
:
Boolean
,
result
:
IntArray
?,
resultSpan
:
IntArray
?
):
IntArray
?
{
):
IntArray
{
var
pixelX
=
pixelX
var
pixelY
=
pixelY
lazyInitTempRectStack
()
...
...
@@ -601,7 +587,6 @@ open class CellLayout @JvmOverloads constructor(
val
spanX
=
1
val
spanY
=
1
Log
.
d
(
TAG
,
"FINDING START"
)
for
(
y
in
0
until
countY
-
(
minSpanY
-
1
))
{
inner
@
for
(
x
in
0
until
countX
-
(
minSpanX
-
1
))
{
var
ySize
=
-
1
...
...
@@ -695,7 +680,6 @@ open class CellLayout @JvmOverloads constructor(
bestXY
[
1
]
=
-
1
}
recycleTempRects
(
validRegions
)
Log
.
d
(
TAG
,
"FINDING END"
)
return
bestXY
}
...
...
@@ -722,7 +706,6 @@ open class CellLayout @JvmOverloads constructor(
open
fun
regionToCenterPoint
(
cellX
:
Int
,
cellY
:
Int
,
spanX
:
Int
,
spanY
:
Int
,
result
:
IntArray
)
{
val
hStartPadding
=
paddingLeft
val
vStartPadding
=
paddingTop