Add the notification permission to the permission setting

This commit is contained in:
Nicolas Pomepuy 2024-10-22 09:53:41 +02:00 committed by Duncan McNamara
parent ba9420b3a1
commit 9e90826844
6 changed files with 225 additions and 5 deletions

View File

@ -0,0 +1,57 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="32mm"
height="32mm"
viewBox="0 0 32 32"
version="1.1"
id="svg869"
sodipodi:docname="ic_permission_check_checked.svg"
inkscape:version="1.1.2 (0a00cf5339, 2022-02-04)"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<sodipodi:namedview
id="namedview871"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
inkscape:document-units="mm"
showgrid="true"
inkscape:zoom="3.1108586"
inkscape:cx="12.376005"
inkscape:cy="96.275672"
inkscape:window-width="2560"
inkscape:window-height="1376"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="layer1">
<inkscape:grid
type="xygrid"
id="grid930" />
</sodipodi:namedview>
<defs
id="defs866" />
<g
inkscape:label="Calque 1"
inkscape:groupmode="layer"
id="layer1">
<path
id="path954"
style="fill:#757575;stroke-width:3.52754"
d="M 60.472656 7.5585938 A 52.913386 52.913386 0 0 0 7.5585938 60.472656 A 52.913386 52.913386 0 0 0 60.472656 113.38672 A 52.913386 52.913386 0 0 0 113.38672 60.472656 A 52.913386 52.913386 0 0 0 60.472656 7.5585938 z M 60.472656 11.337891 A 49.133858 49.133858 0 0 1 109.60547 60.472656 A 49.133858 49.133858 0 0 1 60.472656 109.60547 A 49.133858 49.133858 0 0 1 11.337891 60.472656 A 49.133858 49.133858 0 0 1 60.472656 11.337891 z "
transform="scale(0.26458333)" />
<circle
style="fill:#c83737;stroke-width:0.799999"
id="path1186"
cx="16"
cy="16"
r="10" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

@ -0,0 +1,33 @@
<!--
~ *************************************************************************
~ ic_check_disabled.xml
~ **************************************************************************
~ Copyright © 2024 VLC authors and VideoLAN
~ Author: Nicolas POMEPUY
~ This program is free software; you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation; either version 2 of the License, or
~ (at your option) any later version.
~
~ This program is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with this program; if not, write to the Free Software
~ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
~ ***************************************************************************
~
~
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@color/grey900transparent"
android:pathData="M9,16.17L4.83,12l-1.42,1.41L9,19 21,7l-1.41,-1.41z" />
</vector>

View File

@ -0,0 +1,35 @@
<!--
~ *************************************************************************
~ ic_permission_check_checked.xml
~ **************************************************************************
~ Copyright © 2024 VLC authors and VideoLAN
~ Author: Nicolas POMEPUY
~ This program is free software; you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation; either version 2 of the License, or
~ (at your option) any later version.
~
~ This program is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with this program; if not, write to the Free Software
~ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
~ ***************************************************************************
~
~
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:width="32dp"
android:height="32dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
tools:fillColor="@color/orange500"
android:fillColor="?attr/colorPrimary"
android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM10,17l-5,-5 1.41,-1.41L10,14.17l7.59,-7.59L19,8l-9,9z"/>
</vector>

View File

@ -0,0 +1,35 @@
<!--
~ *************************************************************************
~ ic_permission_check_unchecked.xml
~ **************************************************************************
~ Copyright © 2024 VLC authors and VideoLAN
~ Author: Nicolas POMEPUY
~ This program is free software; you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation; either version 2 of the License, or
~ (at your option) any later version.
~
~ This program is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with this program; if not, write to the Free Software
~ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
~ ***************************************************************************
~
~
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:width="32dp"
android:height="32dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
tools:fillColor="@color/grey600"
android:fillColor="@color/grey600"
android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM10,17l-5,-5 1.41,-1.41L10,14.17l7.59,-7.59L19,8l-9,9z"/>
</vector>

View File

@ -49,18 +49,64 @@
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/textView37"
android:id="@+id/textView38"
style="@style/Theme.VLC.BottomSheetTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="24dp"
android:text="@string/manage_storage_permission"
android:text="@string/notification_permission"
android:textColor="?attr/colorPrimary"
android:textSize="16sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/permission_title" />
<LinearLayout
android:id="@+id/notification_permission_container"
android:layout_width="0dp"
android:layout_height="48dp"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="16dp"
android:background="?attr/selectableItemBackground"
android:gravity="center_vertical"
android:orientation="horizontal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView38">
<ImageView
android:id="@+id/notification_permission_check"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:srcCompat="@drawable/ic_permission_check_checked" />
<TextView
android:id="@+id/textView39"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginEnd="16dp"
android:layout_weight="1"
android:text="@string/notification_permission"
android:textColor="?attr/font_default"
android:textSize="16sp" />
</LinearLayout>
<TextView
android:id="@+id/textView37"
style="@style/Theme.VLC.BottomSheetTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:text="@string/manage_storage_permission"
android:textColor="?attr/colorPrimary"
android:textSize="16sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/notification_permission_container" />
<TextView
android:id="@+id/file_access_explanation"
android:layout_width="0dp"
@ -107,10 +153,11 @@
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
android:layout_weight="1"
android:enabled="true"
android:paddingStart="16dp"
android:paddingStart="24dp"
android:text="@string/permission_no_access"
android:textColor="?attr/font_default"
android:textSize="16sp"
@ -127,7 +174,7 @@
android:layout_marginEnd="16dp"
android:layout_weight="1"
android:enabled="true"
android:paddingStart="16dp"
android:paddingStart="24dp"
android:text="@string/permission_media_title"
android:textColor="?attr/font_default"
android:textSize="16sp"
@ -172,7 +219,7 @@
android:layout_marginEnd="16dp"
android:layout_weight="1"
android:enabled="true"
android:paddingStart="16dp"
android:paddingStart="24dp"
android:text="@string/permission_all_title"
android:textColor="?attr/font_default"
android:textSize="16sp"

View File

@ -101,6 +101,19 @@ class PermissionListDialog : VLCBottomSheetDialogFragment() {
private fun updateStorageState() {
//Notification
binding.notificationPermissionCheck.setImageDrawable(ContextCompat.getDrawable(requireActivity(), if (Permissions.canSendNotifications(requireActivity())) R.drawable.ic_permission_check_checked else R.drawable.ic_permission_check_unchecked))
binding.notificationPermissionContainer.setOnClickListener {
if (Permissions.canSendNotifications(requireActivity())) {
Permissions.showAppSettingsPage(requireActivity())
} else ActivityCompat.requestPermissions(
requireActivity(), arrayOf(
Manifest.permission.POST_NOTIFICATIONS
), Permissions.FINE_STORAGE_PERMISSION_REQUEST_CODE
)
}
// radio states
arrayOf(