Skip to content

Commit be4007e

Browse files
committed
Fixed GetImageFromGallery's callback returning null on Meizu 18X (fixed #348)
1 parent e05fc5a commit be4007e

File tree

6 files changed

+16
-7
lines changed

6 files changed

+16
-7
lines changed

.github/AAR Source (Android)/java/com/yasirkula/unity/NativeGalleryMediaPickerFragment.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ else if( mediaType == NativeGallery.MEDIA_TYPE_VIDEO )
128128
try
129129
{
130130
// MIUI devices have issues with Intent.createChooser on at least Android 11 (https://stackoverflow.com/questions/67785661/taking-and-picking-photos-on-poco-x3-with-android-11-does-not-work)
131-
if( useDefaultGalleryApp || ( Build.VERSION.SDK_INT == 30 && NativeGalleryUtils.IsXiaomiOrMIUI() ) )
131+
if( useDefaultGalleryApp || ( Build.VERSION.SDK_INT == 30 && NativeGalleryUtils.IsXiaomiOrMIUI() ) || NativeGalleryUtils.IsMeizu() )
132132
startActivityForResult( intent, MEDIA_REQUEST_CODE );
133133
else
134134
startActivityForResult( Intent.createChooser( intent, title ), MEDIA_REQUEST_CODE );

.github/AAR Source (Android)/java/com/yasirkula/unity/NativeGalleryUtils.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ public class NativeGalleryUtils
3030
{
3131
private static String secondaryStoragePath = null;
3232
private static int isXiaomiOrMIUI = 0; // 1: true, -1: false
33+
private static int isMeizu = 0; // 1: true, -1: false
3334

3435
public static boolean IsXiaomiOrMIUI()
3536
{
@@ -85,6 +86,14 @@ else if( isXiaomiOrMIUI < 0 )
8586
}
8687
}
8788

89+
public static boolean IsMeizu()
90+
{
91+
if( isMeizu == 0 )
92+
isMeizu = android.os.Build.MANUFACTURER.equalsIgnoreCase( "meizu" ) ? 1 : -1;
93+
94+
return isMeizu == 1;
95+
}
96+
8897
// Credit: https://stackoverflow.com/a/36714242/2373034
8998
public static String GetPathFromURI( Context context, Uri uri )
9099
{
100 Bytes
Binary file not shown.

Plugins/NativeGallery/NativeGallery.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -643,10 +643,10 @@ private static byte[] GetTextureBytes( Texture2D texture, bool isJpeg )
643643
{
644644
return GetTextureBytesFromCopy( texture, isJpeg );
645645
}
646-
647-
#pragma warning disable 0162
648-
return null;
649-
#pragma warning restore 0162
646+
catch
647+
{
648+
return null;
649+
}
650650
}
651651

652652
private static byte[] GetTextureBytesFromCopy( Texture2D texture, bool isJpeg )

Plugins/NativeGallery/README.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
= Native Gallery for Android & iOS (v1.9.1) =
1+
= Native Gallery for Android & iOS (v1.9.2) =
22

33
Documentation: https://github.com/yasirkula/UnityNativeGallery
44
FAQ: https://github.com/yasirkula/UnityNativeGallery#faq

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "com.yasirkula.nativegallery",
33
"displayName": "Native Gallery",
4-
"version": "1.9.1",
4+
"version": "1.9.2",
55
"documentationUrl": "https://github.com/yasirkula/UnityNativeGallery",
66
"changelogUrl": "https://github.com/yasirkula/UnityNativeGallery/releases",
77
"licensesUrl": "https://github.com/yasirkula/UnityNativeGallery/blob/master/LICENSE.txt",

0 commit comments

Comments
 (0)