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
4baa2db3
Commit
4baa2db3
authored
Aug 10, 2021
by
Amit Kumar
💻
Browse files
Fix bug related to uninstall button and notification badge
parent
d1f5ebce
Changes
3
Hide whitespace changes
Inline
Side-by-side
app/src/main/java/foundation/e/blisslauncher/features/test/IconTextView.kt
View file @
4baa2db3
...
...
@@ -233,7 +233,7 @@ class IconTextView @JvmOverloads constructor(
cancelDotScaleAnim
()
mDotScaleAnim
=
ObjectAnimator
.
ofFloat
(
this
,
UNINSTALL
_SCALE_PROPERTY
,
DOT
_SCALE_PROPERTY
,
*
dotScales
).
apply
{
addListener
(
object
:
AnimatorListenerAdapter
()
{
...
...
app/src/main/java/foundation/e/blisslauncher/features/test/TestActivity.kt
View file @
4baa2db3
...
...
@@ -26,6 +26,7 @@ import android.location.LocationManager
import
android.net.Uri
import
android.os.Bundle
import
android.os.Handler
import
android.os.Process
import
android.os.StrictMode
import
android.os.StrictMode.VmPolicy
import
android.provider.Settings
...
...
@@ -274,28 +275,36 @@ class TestActivity : BaseDraggingActivity(), AutoCompleteAdapter.OnSuggestionCli
val
cr
=
contentResolver
val
setting
=
"enabled_notification_listeners"
var
permissionString
=
Settings
.
Secure
.
getString
(
cr
,
setting
)
if
(
permissionString
==
null
||
!
permissionString
.
contains
(
packageName
))
{
if
(
BuildConfig
.
DEBUG
)
{
val
cn
=
ComponentName
(
this
,
NotificationListener
::
class
.
java
)
val
enabled
=
permissionString
!=
null
&&
(
permissionString
.
contains
(
cn
.
flattenToString
())
||
permissionString
.
contains
(
cn
.
flattenToShortString
()))
if
(!
enabled
)
{
val
launcherApps
:
LauncherApps
=
getSystemService
(
LAUNCHER_APPS_SERVICE
)
as
LauncherApps
val
launcherInfo
=
launcherApps
.
getApplicationInfo
(
packageName
,
0
,
Process
.
myUserHandle
())
if
(
launcherInfo
.
flags
and
ApplicationInfo
.
FLAG_SYSTEM
==
0
)
{
val
args
=
Bundle
()
args
.
putString
(
":settings:fragment_args_key"
,
cn
.
flattenToString
())
val
intent
=
Intent
(
Settings
.
ACTION_NOTIFICATION_LISTENER_SETTINGS
)
.
addFlags
(
Intent
.
FLAG_ACTIVITY_NEW_TASK
)
.
putExtra
(
":settings:fragment_args_key"
,
cn
.
flattenToString
())
.
putExtra
(
":settings:show_fragment_args"
,
args
)
startActivity
(
Intent
(
"android.settings.ACTION_NOTIFICATION_LISTENER_SETTINGS"
)
)
}
else
if
(!
Preferences
.
shouldAskForNotificationAccess
(
this
))
{
val
cn
=
ComponentName
(
this
,
NotificationService
::
class
.
java
intent
)
}
else
{
if
(
permissionString
==
null
)
{
permissionString
=
""
}
else
{
permissionString
+=
":"
}
permissionString
+=
cn
.
flattenToString
()
val
success
=
Settings
.
Secure
.
putString
(
cr
,
setting
,
permissionString
)
if
(
success
)
{
Preferences
.
setNotToAskForNotificationAccess
(
this
)
}
// Requires WRITE_SECURE_SETTINGS permission.
Settings
.
Secure
.
putString
(
cr
,
setting
,
permissionString
)
}
}
Preferences
.
setNotToAskForNotificationAccess
(
this
)
}
}
...
...
app/src/main/java/foundation/e/blisslauncher/features/test/uninstall/UninstallButtonRenderer.java
View file @
4baa2db3
...
...
@@ -6,6 +6,11 @@ import android.graphics.BitmapFactory;
import
android.graphics.Canvas
;
import
android.graphics.Paint
;
import
android.graphics.Rect
;
import
android.graphics.drawable.Drawable
;
import
android.graphics.drawable.VectorDrawable
;
import
androidx.core.content.res.ResourcesCompat
;
import
androidx.vectordrawable.graphics.drawable.VectorDrawableCompat
;
import
foundation.e.blisslauncher.R
;
...
...
@@ -27,14 +32,10 @@ public class UninstallButtonRenderer {
}
public
void
draw
(
Canvas
canvas
,
Rect
iconBounds
)
{
Bitmap
myBitmap
=
BitmapFactory
.
decodeResource
(
mContext
.
getResources
(),
R
.
drawable
.
ic_minus
);
Bitmap
scaledBitmap
=
Bitmap
.
createScaledBitmap
(
myBitmap
,
mSize
,
mSize
,
true
);
canvas
.
drawBitmap
(
scaledBitmap
,
iconBounds
.
right
-
scaledBitmap
.
getWidth
()
/
2
,
iconBounds
.
top
-
scaledBitmap
.
getHeight
()
/
2
,
mPaint
);
//canvas.drawCircle(badgeCenterX, badgeCenterY, mSize/2, mPaint);
Drawable
uninstallDrawable
=
ResourcesCompat
.
getDrawable
(
mContext
.
getResources
(),
R
.
drawable
.
ic_minus_white_16dp
,
mContext
.
getTheme
());
uninstallDrawable
.
setBounds
(
iconBounds
.
right
-
mSize
/
2
,
iconBounds
.
top
-
mSize
/
2
,
iconBounds
.
right
+
mSize
/
2
,
iconBounds
.
top
+
mSize
/
2
);
uninstallDrawable
.
draw
(
canvas
);
}
/**
...
...
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