diff --git a/app/src/main/res/layout/ps_custom_fragment_selector.xml b/app/src/main/res/layout/ps_custom_fragment_selector.xml index ea43072d7..71b0ac4b3 100644 --- a/app/src/main/res/layout/ps_custom_fragment_selector.xml +++ b/app/src/main/res/layout/ps_custom_fragment_selector.xml @@ -15,7 +15,7 @@ app:layout_constraintBottom_toTopOf="@+id/bottom_nar_bar" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toBottomOf="@+id/title_bar" /> + app:layout_constraintTop_toBottomOf="@+id/media_reselection_tip_view" /> + app:layout_constraintTop_toBottomOf="@+id/media_reselection_tip_view" /> + + permissionGrou } } - public void onRequestPermissionsResult(Context context,String[] permissions,int[] grantResults, PermissionResultCallback action) { + public void onRequestPermissionsResult(Context context, String[] permissions, int[] grantResults, PermissionResultCallback action) { Activity activity = (Activity) context; for (String permission : permissions) { boolean should = ActivityCompat.shouldShowRequestPermissionRationale(activity, permission); @@ -143,6 +143,19 @@ public static boolean isCheckReadStorage(int chooseMode, Context context) { } } + /** + * 检查 READ_MEDIA_VISUAL_USER_SELECTED 权限是否存在 + */ + public static boolean isCheckUserSelected(int chooseMode, Context context) { + if (SdkVersionUtils.isUPSIDE_DOWN_CAKE()) { + if (chooseMode != SelectMimeType.ofAudio()) { + return PermissionChecker.checkSelfPermission(context, + new String[]{PermissionConfig.READ_MEDIA_VISUAL_USER_SELECTED}); + } else return false; + } else { + return false; + } + } /** * 检查读取图片权限是否存在 diff --git a/selector/src/main/java/com/luck/picture/lib/widget/MediaReselectionTipView.java b/selector/src/main/java/com/luck/picture/lib/widget/MediaReselectionTipView.java new file mode 100644 index 000000000..ad07b2abe --- /dev/null +++ b/selector/src/main/java/com/luck/picture/lib/widget/MediaReselectionTipView.java @@ -0,0 +1,124 @@ +package com.luck.picture.lib.widget; + +import android.content.Context; +import android.util.AttributeSet; +import android.view.LayoutInflater; +import android.view.View; +import android.widget.FrameLayout; +import android.widget.TextView; + +import androidx.constraintlayout.widget.ConstraintLayout; +import androidx.core.content.ContextCompat; + +import com.luck.picture.lib.R; +import com.luck.picture.lib.config.SelectorConfig; +import com.luck.picture.lib.config.SelectorProviders; +import com.luck.picture.lib.style.BottomNavBarStyle; +import com.luck.picture.lib.style.PictureSelectorStyle; +import com.luck.picture.lib.utils.StyleUtils; + +/** + * Created on 2024/1/17. + * + * @author wdeo3601@163.com + * @description 安卓34+,READ_MEDIA_VISUAL_USER_SELECTED 授权后,提示用户重选媒体 + */ +public class MediaReselectionTipView extends FrameLayout implements View.OnClickListener { + + protected TextView tvTip; + protected TextView tvManage; + protected SelectorConfig config; + protected ConstraintLayout mediaReselectionTipLayout; + + public TextView getTitleManageView() { + return tvManage; + } + + public MediaReselectionTipView(Context context) { + super(context); + init(); + } + + public MediaReselectionTipView(Context context, AttributeSet attrs) { + super(context, attrs); + init(); + } + + public MediaReselectionTipView(Context context, AttributeSet attrs, int defStyleAttr) { + super(context, attrs, defStyleAttr); + init(); + } + + protected void init() { + inflateLayout(); + setClickable(true); + setFocusable(true); + config = SelectorProviders.getInstance().getSelectorConfig(); + mediaReselectionTipLayout = findViewById(R.id.cl_media_reselection_tip); + tvTip = findViewById(R.id.ps_tv_title); + tvManage = findViewById(R.id.ps_tv_manage); + tvManage.setOnClickListener(this); + mediaReselectionTipLayout.setOnClickListener(this); + setBackgroundColor(ContextCompat.getColor(getContext(), R.color.ps_color_grey)); + handleLayoutUI(); + } + + protected void inflateLayout() { + LayoutInflater.from(getContext()).inflate(R.layout.ps_media_reselection_tip_view, this); + } + + protected void handleLayoutUI() { + + } + + public void setMediaReselectionTipViewStyle() { + PictureSelectorStyle selectorStyle = config.selectorStyle; + BottomNavBarStyle bottomBarStyle = selectorStyle.getBottomBarStyle(); + + int backgroundColor = bottomBarStyle.getBottomNarBarBackgroundColor(); + if (StyleUtils.checkStyleValidity(backgroundColor)) { + setBackgroundColor(backgroundColor); + } + + int previewNormalTextColor = bottomBarStyle.getBottomPreviewNormalTextColor(); + if (StyleUtils.checkSizeValidity(previewNormalTextColor)) { + tvTip.setTextColor(previewNormalTextColor); + } + + int previewSelectTextColor = bottomBarStyle.getBottomPreviewSelectTextColor(); + if (StyleUtils.checkStyleValidity(previewSelectTextColor)) { + tvManage.setTextColor(previewSelectTextColor); + } + int previewNormalTextSize = bottomBarStyle.getBottomPreviewNormalTextSize(); + if (StyleUtils.checkSizeValidity(previewNormalTextSize)) { + tvManage.setTextSize(previewNormalTextSize); + } + } + + @Override + public void onClick(View view) { + int id = view.getId(); + if (id == R.id.ps_tv_manage) { + if (mediaReselectionListener != null) { + mediaReselectionListener.onManageClick(); + } + } + } + + protected OnMediaReselectionListener mediaReselectionListener; + + /** + * 功能事件回调 + * + * @param listener + */ + public void setOnMediaReselectionListener(OnMediaReselectionListener listener) { + this.mediaReselectionListener = listener; + } + + public static class OnMediaReselectionListener { + public void onManageClick() { + + } + } +} diff --git a/selector/src/main/res/layout/ps_fragment_selector.xml b/selector/src/main/res/layout/ps_fragment_selector.xml index 641cb6e53..9217ff251 100644 --- a/selector/src/main/res/layout/ps_fragment_selector.xml +++ b/selector/src/main/res/layout/ps_fragment_selector.xml @@ -13,7 +13,7 @@ app:layout_constraintBottom_toTopOf="@+id/bottom_nar_bar" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toBottomOf="@+id/title_bar" /> + app:layout_constraintTop_toBottomOf="@+id/media_reselection_tip_view" /> + app:layout_constraintTop_toBottomOf="@+id/media_reselection_tip_view" /> + + diff --git a/selector/src/main/res/layout/ps_media_reselection_tip_view.xml b/selector/src/main/res/layout/ps_media_reselection_tip_view.xml new file mode 100644 index 000000000..cbc5f07cc --- /dev/null +++ b/selector/src/main/res/layout/ps_media_reselection_tip_view.xml @@ -0,0 +1,44 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/selector/src/main/res/values-ar-rAE/strings.xml b/selector/src/main/res/values-ar-rAE/strings.xml index f586dd4b4..f1932af93 100644 --- a/selector/src/main/res/values-ar-rAE/strings.xml +++ b/selector/src/main/res/values-ar-rAE/strings.xml @@ -75,4 +75,6 @@ ختيار الصوت أكبر من %1$d ثانية اختيار الصوت أقل من %1$d ثوان اختيار نوع غير معتمد +  إدارة  + لقد منحت حق الوصول إلى عدد محدد من الصور ومقاطع الفيديو. diff --git a/selector/src/main/res/values-cs-rCZ/string.xml b/selector/src/main/res/values-cs-rCZ/string.xml index 906de8931..5e001fb23 100644 --- a/selector/src/main/res/values-cs-rCZ/string.xml +++ b/selector/src/main/res/values-cs-rCZ/string.xml @@ -79,4 +79,6 @@ Vyberte zvuk delší než %1$d s Vyberte zvuk kratší než %1$d s Nepodporovaný typ výběru + Podávání + udělili jste přístup k vybranému počtu fotografií a videí. \ No newline at end of file diff --git a/selector/src/main/res/values-de-rDE/strings.xml b/selector/src/main/res/values-de-rDE/strings.xml index b3ae69903..020f86e63 100644 --- a/selector/src/main/res/values-de-rDE/strings.xml +++ b/selector/src/main/res/values-de-rDE/strings.xml @@ -75,4 +75,6 @@ Audio für mehr als %1$d Sekunden auswählen Audio für weniger als %1$d Sekunden auswählen Nicht unterstützter Auswahltyp + Verwaltung + Sie haben Zugriff auf eine ausgewählte Anzahl von Fotos und Videos gewährt. diff --git a/selector/src/main/res/values-en-rUS/string.xml b/selector/src/main/res/values-en-rUS/string.xml index 1e92ddb70..90b790034 100644 --- a/selector/src/main/res/values-en-rUS/string.xml +++ b/selector/src/main/res/values-en-rUS/string.xml @@ -78,4 +78,6 @@ Select audio for more than %1$d s Select audio for less than %1$d s Unsupported selection type + Manage + you\'ve given access to a select number of photos and videos. \ No newline at end of file diff --git a/selector/src/main/res/values-es-rES/strings.xml b/selector/src/main/res/values-es-rES/strings.xml index 0396a4a81..cabad9582 100644 --- a/selector/src/main/res/values-es-rES/strings.xml +++ b/selector/src/main/res/values-es-rES/strings.xml @@ -76,4 +76,6 @@ Seleccionar audio durante más de %1$d segundos Seleccionar audio durante menos de %1$d segundos Tipos de selección no soportados + administrar + le has dado acceso a un número selecto de fotos y videos. \ No newline at end of file diff --git a/selector/src/main/res/values-fr-rFR/strings.xml b/selector/src/main/res/values-fr-rFR/strings.xml index 4f9909ddf..9d2f37a4c 100644 --- a/selector/src/main/res/values-fr-rFR/strings.xml +++ b/selector/src/main/res/values-fr-rFR/strings.xml @@ -75,4 +75,6 @@ Sélectionnez audio plus de %1$d secondes Sélectionnez audio moins de %1$d secondes Type de sélection non pris en charge + Gestion + vous avez donné accès à un certain nombre de photos et de vidéos. diff --git a/selector/src/main/res/values-ja-rJP/strings.xml b/selector/src/main/res/values-ja-rJP/strings.xml index 0f996c499..29c295857 100644 --- a/selector/src/main/res/values-ja-rJP/strings.xml +++ b/selector/src/main/res/values-ja-rJP/strings.xml @@ -75,4 +75,6 @@ %1$d秒以上のオーディオを選択 %1$d秒未満のオーディオを選択 サポートされていない選択タイプ + 管理 + 選択した数の写真とビデオへのアクセスが許可されました。 diff --git a/selector/src/main/res/values-kk-rKZ/string.xml b/selector/src/main/res/values-kk-rKZ/string.xml index 5cfde9e93..a6a90dc7a 100644 --- a/selector/src/main/res/values-kk-rKZ/string.xml +++ b/selector/src/main/res/values-kk-rKZ/string.xml @@ -79,4 +79,6 @@ %1$d секундан артық аудионы таңдау %1$d секундан аз аудионы таңдау Таңдау типі қолдау көрсетілмейді + басқару + фотосуреттер мен бейнелердің таңдаулы санына рұқсат бердіңіз. \ No newline at end of file diff --git a/selector/src/main/res/values-ko-rKR/strings.xml b/selector/src/main/res/values-ko-rKR/strings.xml index 242f44d2e..bc9cb4299 100644 --- a/selector/src/main/res/values-ko-rKR/strings.xml +++ b/selector/src/main/res/values-ko-rKR/strings.xml @@ -75,4 +75,6 @@ %1$d초 이상의 음성파일을 선택해주세요. %1$d초 미만의 음성파일을 선택해주세요. 지원되지 않는 선택 유형입니다. + 관리하다 + 선택한 수의 사진과 비디오에 대한 액세스 권한을 부여했습니다. diff --git a/selector/src/main/res/values-pt-rPT/strings.xml b/selector/src/main/res/values-pt-rPT/strings.xml index 1ae3f308f..9997dacc9 100644 --- a/selector/src/main/res/values-pt-rPT/strings.xml +++ b/selector/src/main/res/values-pt-rPT/strings.xml @@ -76,4 +76,6 @@ Selecionar áudio por mais de %1$d segundos Selecionar áudio por menos de %1$d segundos Tipo de selecção não suportado + gerenciar + você deu acesso a um número selecionado de fotos e vídeos. diff --git a/selector/src/main/res/values-ru-rRU/strings.xml b/selector/src/main/res/values-ru-rRU/strings.xml index f28cea33f..a7950e04c 100644 --- a/selector/src/main/res/values-ru-rRU/strings.xml +++ b/selector/src/main/res/values-ru-rRU/strings.xml @@ -75,4 +75,6 @@ Выберите звук больше %1$d секунд Выберите звук меньше %1$d секунд не поддерживается тип выделения + управлять + вы предоставили доступ к определенному количеству фотографий и видео. diff --git a/selector/src/main/res/values-vi-rVN/string.xml b/selector/src/main/res/values-vi-rVN/string.xml index 08e1b248c..a9650574e 100644 --- a/selector/src/main/res/values-vi-rVN/string.xml +++ b/selector/src/main/res/values-vi-rVN/string.xml @@ -76,4 +76,6 @@ Chọn tiếng lớn hơn %1$d giây Chọn tiếng dưới %1$d giây Kiểu chọn không được sắp xếp + quản lý + bạn đã cấp quyền truy cập vào một số ảnh và video được chọn. \ No newline at end of file diff --git a/selector/src/main/res/values-zh-rCN/strings.xml b/selector/src/main/res/values-zh-rCN/strings.xml index 885762e03..36b15eacf 100644 --- a/selector/src/main/res/values-zh-rCN/strings.xml +++ b/selector/src/main/res/values-zh-rCN/strings.xml @@ -75,4 +75,6 @@ 选择音频大于%1$d秒 选择音频小于%1$d秒 不支持的选择类型 + 管理 + 您已授予对选定数量的照片和视频的访问权限。 diff --git a/selector/src/main/res/values-zh-rTW/strings.xml b/selector/src/main/res/values-zh-rTW/strings.xml index d185ef28d..21e2af149 100644 --- a/selector/src/main/res/values-zh-rTW/strings.xml +++ b/selector/src/main/res/values-zh-rTW/strings.xml @@ -75,4 +75,6 @@ 選擇錄音大於%1$d秒 選擇錄音小於%1$d秒 不支援的選擇類型 + 管理 + 您已授予對選定數量的照片和影片的存取權。 diff --git a/selector/src/main/res/values/strings.xml b/selector/src/main/res/values/strings.xml index 885762e03..2367cf536 100644 --- a/selector/src/main/res/values/strings.xml +++ b/selector/src/main/res/values/strings.xml @@ -75,4 +75,6 @@ 选择音频大于%1$d秒 选择音频小于%1$d秒 不支持的选择类型 + 您已授予对选定数量的照片和视频的访问权限。 + 管理