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
95ced923
Commit
95ced923
authored
Sep 15, 2021
by
Amit Kumar
💻
Browse files
Fix notification badging issue with folder
parent
f58da8ec
Pipeline
#135492
passed with stage
in 1 minute and 55 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
app/src/main/java/foundation/e/blisslauncher/core/customviews/LauncherPagedView.java
View file @
95ced923
...
@@ -33,6 +33,7 @@ import android.view.animation.Animation;
...
@@ -33,6 +33,7 @@ import android.view.animation.Animation;
import
android.view.animation.AnimationUtils
;
import
android.view.animation.AnimationUtils
;
import
android.widget.GridLayout
;
import
android.widget.GridLayout
;
import
android.widget.Toast
;
import
android.widget.Toast
;
import
foundation.e.blisslauncher.BuildConfig
;
import
foundation.e.blisslauncher.BuildConfig
;
import
foundation.e.blisslauncher.R
;
import
foundation.e.blisslauncher.R
;
import
foundation.e.blisslauncher.core.Utilities
;
import
foundation.e.blisslauncher.core.Utilities
;
...
@@ -68,11 +69,13 @@ import foundation.e.blisslauncher.features.test.dragndrop.DropTarget;
...
@@ -68,11 +69,13 @@ import foundation.e.blisslauncher.features.test.dragndrop.DropTarget;
import
foundation.e.blisslauncher.features.test.dragndrop.SpringLoadedDragController
;
import
foundation.e.blisslauncher.features.test.dragndrop.SpringLoadedDragController
;
import
foundation.e.blisslauncher.features.test.graphics.DragPreviewProvider
;
import
foundation.e.blisslauncher.features.test.graphics.DragPreviewProvider
;
import
foundation.e.blisslauncher.features.test.uninstall.UninstallHelper
;
import
foundation.e.blisslauncher.features.test.uninstall.UninstallHelper
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.HashSet
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Set
;
import
java.util.Set
;
import
java.util.function.Predicate
;
import
java.util.function.Predicate
;
import
org.jetbrains.annotations.NotNull
;
import
org.jetbrains.annotations.NotNull
;
public
class
LauncherPagedView
extends
PagedView
<
PageIndicatorDots
>
implements
View
.
OnTouchListener
,
public
class
LauncherPagedView
extends
PagedView
<
PageIndicatorDots
>
implements
View
.
OnTouchListener
,
...
@@ -2301,7 +2304,7 @@ public class LauncherPagedView extends PagedView<PageIndicatorDots> implements V
...
@@ -2301,7 +2304,7 @@ public class LauncherPagedView extends PagedView<PageIndicatorDots> implements V
final
int
childCount
=
folder
.
items
.
size
();
final
int
childCount
=
folder
.
items
.
size
();
for
(
int
childIdx
=
0
;
childIdx
<
childCount
;
childIdx
++)
{
for
(
int
childIdx
=
0
;
childIdx
<
childCount
;
childIdx
++)
{
LauncherItem
childItem
=
folderChildren
.
get
(
childIdx
);
LauncherItem
childItem
=
folderChildren
.
get
(
childIdx
);
if
(
op
.
evaluate
(
info
,
item
,
itemIdx
))
{
if
(
op
.
evaluate
(
childItem
,
item
,
itemIdx
))
{
return
true
;
return
true
;
}
}
}
}
...
@@ -2321,7 +2324,7 @@ public class LauncherPagedView extends PagedView<PageIndicatorDots> implements V
...
@@ -2321,7 +2324,7 @@ public class LauncherPagedView extends PagedView<PageIndicatorDots> implements V
if
((
info
instanceof
ApplicationItem
||
info
instanceof
ShortcutItem
)
&&
v
instanceof
IconTextView
)
{
if
((
info
instanceof
ApplicationItem
||
info
instanceof
ShortcutItem
)
&&
v
instanceof
IconTextView
)
{
if
(!
packageUserKey
.
updateFromItemInfo
(
info
)
if
(!
packageUserKey
.
updateFromItemInfo
(
info
)
||
updatedDots
.
test
(
packageUserKey
))
{
||
updatedDots
.
test
(
packageUserKey
))
{
((
IconTextView
)
v
).
applyDotState
(
info
,
true
/* animate */
);
((
IconTextView
)
v
).
applyDotState
(
info
,
true
);
folderIds
.
add
(
String
.
valueOf
(
info
.
container
));
folderIds
.
add
(
String
.
valueOf
(
info
.
container
));
}
}
}
}
...
@@ -2337,7 +2340,7 @@ public class LauncherPagedView extends PagedView<PageIndicatorDots> implements V
...
@@ -2337,7 +2340,7 @@ public class LauncherPagedView extends PagedView<PageIndicatorDots> implements V
for
(
LauncherItem
si
:
((
FolderItem
)
info
).
items
)
{
for
(
LauncherItem
si
:
((
FolderItem
)
info
).
items
)
{
folderDotInfo
.
addDotInfo
(
mLauncher
.
getDotInfoForItem
(
si
));
folderDotInfo
.
addDotInfo
(
mLauncher
.
getDotInfoForItem
(
si
));
}
}
((
IconTextView
)
v
).
applyDotState
(
info
,
true
/* animate */
);
((
IconTextView
)
v
).
setDotInfo
((
FolderItem
)
info
,
folderDotInfo
);
}
}
// process all the shortcuts
// process all the shortcuts
return
false
;
return
false
;
...
...
app/src/main/java/foundation/e/blisslauncher/features/test/IconTextView.kt
View file @
95ced923
...
@@ -12,7 +12,6 @@ import android.graphics.Rect
...
@@ -12,7 +12,6 @@ import android.graphics.Rect
import
android.graphics.drawable.Drawable
import
android.graphics.drawable.Drawable
import
android.text.TextUtils.TruncateAt
import
android.text.TextUtils.TruncateAt
import
android.util.AttributeSet
import
android.util.AttributeSet
import
android.util.Log
import
android.util.Property
import
android.util.Property
import
android.util.TypedValue
import
android.util.TypedValue
import
android.view.MotionEvent
import
android.view.MotionEvent
...
@@ -22,11 +21,13 @@ import android.widget.TextView
...
@@ -22,11 +21,13 @@ import android.widget.TextView
import
androidx.core.graphics.ColorUtils
import
androidx.core.graphics.ColorUtils
import
foundation.e.blisslauncher.core.Utilities
import
foundation.e.blisslauncher.core.Utilities
import
foundation.e.blisslauncher.core.database.model.ApplicationItem
import
foundation.e.blisslauncher.core.database.model.ApplicationItem
import
foundation.e.blisslauncher.core.database.model.FolderItem
import
foundation.e.blisslauncher.core.database.model.LauncherItem
import
foundation.e.blisslauncher.core.database.model.LauncherItem
import
foundation.e.blisslauncher.core.database.model.ShortcutItem
import
foundation.e.blisslauncher.core.database.model.ShortcutItem
import
foundation.e.blisslauncher.core.utils.Constants
import
foundation.e.blisslauncher.core.utils.Constants
import
foundation.e.blisslauncher.features.notification.DotInfo
import
foundation.e.blisslauncher.features.notification.DotInfo
import
foundation.e.blisslauncher.features.notification.DotRenderer
import
foundation.e.blisslauncher.features.notification.DotRenderer
import
foundation.e.blisslauncher.features.notification.FolderDotInfo
import
foundation.e.blisslauncher.features.test.uninstall.UninstallButtonRenderer
import
foundation.e.blisslauncher.features.test.uninstall.UninstallButtonRenderer
import
kotlin.math.roundToInt
import
kotlin.math.roundToInt
...
@@ -189,14 +190,26 @@ class IconTextView @JvmOverloads constructor(
...
@@ -189,14 +190,26 @@ class IconTextView @JvmOverloads constructor(
fun
getIcon
()
=
mIcon
fun
getIcon
()
=
mIcon
fun
applyDotState
(
itemInfo
:
LauncherItem
,
animate
:
Boolean
)
{
fun
applyDotState
(
itemInfo
:
LauncherItem
,
animate
:
Boolean
)
{
val
wasDotted
=
mDotInfo
!=
null
if
(
tag
!
is
FolderItem
)
{
mDotInfo
=
mActivity
.
getDotInfoForItem
(
itemInfo
)
val
wasDotted
=
mDotInfo
!=
null
val
isDotted
=
mDotInfo
!=
null
mDotInfo
=
mActivity
.
getDotInfoForItem
(
itemInfo
)
val
isDotted
=
mDotInfo
!=
null
updateDotScale
(
wasDotted
,
isDotted
,
animate
)
}
}
fun
setDotInfo
(
item
:
FolderItem
,
dotInfo
:
FolderDotInfo
)
{
val
wasDotted
=
mDotInfo
is
FolderDotInfo
&&
(
mDotInfo
as
FolderDotInfo
).
hasDot
()
updateDotScale
(
wasDotted
,
dotInfo
.
hasDot
(),
true
)
mDotInfo
=
dotInfo
}
private
fun
updateDotScale
(
wasDotted
:
Boolean
,
isDotted
:
Boolean
,
animate
:
Boolean
)
{
val
newDotScale
:
Float
=
if
(
isDotted
)
1f
else
0f
val
newDotScale
:
Float
=
if
(
isDotted
)
1f
else
0f
mDotRenderer
=
mActivity
.
deviceProfile
.
mDotRenderer
mDotRenderer
=
mActivity
.
deviceProfile
.
mDotRenderer
if
(
wasDotted
||
isDotted
)
{
if
(
wasDotted
||
isDotted
)
{
// Animate when a dot is first added or when it is removed.
// Animate when a dot is first added or when it is removed.
if
(
animate
&&
wasDotted
xor
isDotted
&&
isShown
)
{
if
(
animate
&&
(
wasDotted
xor
isDotted
)
&&
isShown
)
{
animateDotScale
(
newDotScale
)
animateDotScale
(
newDotScale
)
}
else
{
}
else
{
cancelDotScaleAnim
()
cancelDotScaleAnim
()
...
@@ -221,7 +234,6 @@ class IconTextView @JvmOverloads constructor(
...
@@ -221,7 +234,6 @@ class IconTextView @JvmOverloads constructor(
}
}
private
fun
cancelUninstallScaleAnim
()
{
private
fun
cancelUninstallScaleAnim
()
{
Log
.
d
(
TAG
,
"cancelUninstallScaleAnim() called"
)
mUninstallIconScaleAnim
?.
cancel
()
mUninstallIconScaleAnim
?.
cancel
()
}
}
...
@@ -229,12 +241,12 @@ class IconTextView @JvmOverloads constructor(
...
@@ -229,12 +241,12 @@ class IconTextView @JvmOverloads constructor(
mDotScaleAnim
?.
cancel
()
mDotScaleAnim
?.
cancel
()
}
}
private
fun
animateDotScale
(
vararg
dotScales
:
Float
)
{
private
fun
animateDotScale
(
dotScales
:
Float
)
{
cancelDotScaleAnim
()
cancelDotScaleAnim
()
mDotScaleAnim
=
ObjectAnimator
.
ofFloat
(
mDotScaleAnim
=
ObjectAnimator
.
ofFloat
(
this
,
this
,
DOT_SCALE_PROPERTY
,
DOT_SCALE_PROPERTY
,
*
dotScales
dotScales
).
apply
{
).
apply
{
addListener
(
object
:
AnimatorListenerAdapter
()
{
addListener
(
object
:
AnimatorListenerAdapter
()
{
override
fun
onAnimationEnd
(
animation
:
Animator
)
{
override
fun
onAnimationEnd
(
animation
:
Animator
)
{
...
@@ -343,6 +355,9 @@ class IconTextView @JvmOverloads constructor(
...
@@ -343,6 +355,9 @@ class IconTextView @JvmOverloads constructor(
}
}
private
fun
hasDot
():
Boolean
{
private
fun
hasDot
():
Boolean
{
if
(
mDotInfo
!=
null
&&
mDotInfo
is
FolderDotInfo
)
{
return
(
mDotInfo
as
FolderDotInfo
).
hasDot
()
}
return
mDotInfo
!=
null
return
mDotInfo
!=
null
}
}
...
@@ -364,7 +379,6 @@ class IconTextView @JvmOverloads constructor(
...
@@ -364,7 +379,6 @@ class IconTextView @JvmOverloads constructor(
*/
*/
private
fun
drawUninstallIcon
(
canvas
:
Canvas
?)
{
private
fun
drawUninstallIcon
(
canvas
:
Canvas
?)
{
if
(
isUninstallVisible
||
uninstallButtonScale
>
0
)
{
if
(
isUninstallVisible
||
uninstallButtonScale
>
0
)
{
Log
.
d
(
TAG
,
"drawUninstallIcon() called with: $isUninstallVisible $uninstallButtonScale"
)
val
tempBounds
=
Rect
()
val
tempBounds
=
Rect
()
getIconBounds
(
tempBounds
)
getIconBounds
(
tempBounds
)
val
scrollX
=
scrollX
val
scrollX
=
scrollX
...
@@ -376,7 +390,6 @@ class IconTextView @JvmOverloads constructor(
...
@@ -376,7 +390,6 @@ class IconTextView @JvmOverloads constructor(
}
}
fun
applyUninstallIconState
(
showUninstallIcon
:
Boolean
)
{
fun
applyUninstallIconState
(
showUninstallIcon
:
Boolean
)
{
Log
.
d
(
TAG
,
"applyUninstallIconState() called with: showUninstallIcon = $showUninstallIcon"
)
val
wasUninstallVisible
=
isUninstallVisible
val
wasUninstallVisible
=
isUninstallVisible
isUninstallVisible
=
showUninstallIcon
isUninstallVisible
=
showUninstallIcon
val
newScale
:
Float
=
if
(
isUninstallVisible
)
1f
else
0f
val
newScale
:
Float
=
if
(
isUninstallVisible
)
1f
else
0f
...
...
app/src/main/java/foundation/e/blisslauncher/features/test/TestActivity.kt
View file @
95ced923
...
@@ -452,8 +452,6 @@ class TestActivity : BaseDraggingActivity(), AutoCompleteAdapter.OnSuggestionCli
...
@@ -452,8 +452,6 @@ class TestActivity : BaseDraggingActivity(), AutoCompleteAdapter.OnSuggestionCli
)
)
}
}
// divided by 2 because of left and right padding.
// divided by 2 because of left and right padding.
// divided by 2 because of left and right padding.
val
padding
=
(
mDeviceProfile
.
availableWidthPx
/
2
-
Utilities
.
pxFromDp
(
8
,
this
)
-
val
padding
=
(
mDeviceProfile
.
availableWidthPx
/
2
-
Utilities
.
pxFromDp
(
8
,
this
)
-
(
2
*
(
2
*
...
...
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