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
44bf8496
Commit
44bf8496
authored
Jun 29, 2020
by
Amit Kumar
💻
Browse files
Delete pwa from Provider when shortcut is deleted
parent
e05debcb
Pipeline
#60676
passed with stage
in 4 minutes and 32 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
app/src/main/AndroidManifest.xml
View file @
44bf8496
...
...
@@ -43,6 +43,8 @@
<uses-permission
android:name=
"lineageos.permission.READ_WEATHER"
/>
<!-- LineageOS specific permissions END -->
<uses-permission
android:name=
"foundation.e.pwaplayer.provider.READ_WRITE"
/>
<application
android:name=
".BlissLauncher"
android:hardwareAccelerated=
"true"
...
...
app/src/main/java/foundation/e/blisslauncher/features/launcher/LauncherActivity.java
View file @
44bf8496
...
...
@@ -39,6 +39,7 @@ import android.os.UserManager;
import
android.provider.Settings
;
import
android.text.Editable
;
import
android.text.TextWatcher
;
import
android.util.Log
;
import
android.view.ContextThemeWrapper
;
import
android.view.DragEvent
;
import
android.view.Gravity
;
...
...
@@ -1977,12 +1978,16 @@ public class LauncherActivity extends AppCompatActivity implements
startActivity
(
i
);
}
}
else
if
(
launcherItem
.
itemType
==
Constants
.
ITEM_TYPE_SHORTCUT
)
{
AlertDialog
dialog
=
new
AlertDialog
.
Builder
(
new
ContextThemeWrapper
(
this
,
R
.
style
.
AlertDialogCustom
))
AlertDialog
dialog
=
new
AlertDialog
.
Builder
(
new
ContextThemeWrapper
(
this
,
R
.
style
.
AlertDialogCustom
))
.
setTitle
(
launcherItem
.
title
)
.
setMessage
(
R
.
string
.
uninstall_shortcut_dialog
)
.
setPositiveButton
(
R
.
string
.
ok
,
(
dialog1
,
which
)
->
{
DeepShortcutManager
.
getInstance
(
this
).
unpinShortcut
(
ShortcutKey
.
fromItem
((
ShortcutItem
)
launcherItem
));
removeShortcutView
((
ShortcutItem
)
launcherItem
,
blissFrameLayout
);
ShortcutItem
shortcut
=
(
ShortcutItem
)
launcherItem
;
DeepShortcutManager
.
getInstance
(
this
).
unpinShortcut
(
ShortcutKey
.
fromItem
(
shortcut
));
if
(
DeepShortcutManager
.
getInstance
(
this
).
wasLastCallSuccess
())
{
deleteShortcutFromProvider
(
shortcut
.
id
);
removeShortcutView
(
shortcut
,
blissFrameLayout
);
}
})
.
setNegativeButton
(
R
.
string
.
cancel
,
null
)
.
setIcon
(
launcherItem
.
icon
)
...
...
@@ -2000,6 +2005,12 @@ public class LauncherActivity extends AppCompatActivity implements
blissFrameLayout
.
addView
(
imageView
,
layoutParams
);
}
private
void
deleteShortcutFromProvider
(
String
id
)
{
ContentResolver
resolver
=
getContentResolver
();
int
count
=
resolver
.
delete
(
Uri
.
parse
(
"content://foundation.e.pwaplayer.provider/pwa"
),
null
,
new
String
[]{
id
});
Log
.
d
(
"LauncherActivity"
,
"Items deleted from pwa provider: "
+
count
);
}
private
void
removeShortcutView
(
ShortcutItem
shortcutItem
,
BlissFrameLayout
blissFrameLayout
)
{
DatabaseManager
.
getManager
(
this
).
removeLauncherItem
(
shortcutItem
.
id
);
if
(
mFolderWindowContainer
.
getVisibility
()
==
View
.
VISIBLE
)
{
...
...
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