File tree 1 file changed +7
-0
lines changed
lib/utilcode/src/main/java/com/blankj/utilcode/util
1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -1709,6 +1709,7 @@ public static File save2Album(final Bitmap src,
1709
1709
contentUri = MediaStore .Images .Media .INTERNAL_CONTENT_URI ;
1710
1710
}
1711
1711
contentValues .put (MediaStore .Images .Media .RELATIVE_PATH , Environment .DIRECTORY_DCIM + "/" + Utils .getApp ().getPackageName ());
1712
+ contentValues .put (MediaStore .MediaColumns .IS_PENDING , 1 );
1712
1713
Uri uri = Utils .getApp ().getContentResolver ().insert (contentUri , contentValues );
1713
1714
if (uri == null ) {
1714
1715
return null ;
@@ -1717,8 +1718,14 @@ public static File save2Album(final Bitmap src,
1717
1718
try {
1718
1719
os = Utils .getApp ().getContentResolver ().openOutputStream (uri );
1719
1720
src .compress (format , quality , os );
1721
+
1722
+ contentValues .clear ();
1723
+ contentValues .put (MediaStore .MediaColumns .IS_PENDING , 0 );
1724
+ Utils .getApp ().getContentResolver ().update (uri , contentValues , null , null );
1725
+
1720
1726
return UtilsBridge .uri2File (uri );
1721
1727
} catch (Exception e ) {
1728
+ Utils .getApp ().getContentResolver ().delete (uri , null , null );
1722
1729
e .printStackTrace ();
1723
1730
return null ;
1724
1731
} finally {
You can’t perform that action at this time.
0 commit comments