update IntentUtils

androidx
Zhanty 5 years ago
parent 85950fa151
commit dd20085bc4
  1. 15
      lib_base/src/main/java/com/android/base/utils/android/XIntentUtils.java
  2. 1
      lib_social/build.gradle

@ -7,11 +7,13 @@ import android.content.pm.ActivityInfo;
import android.content.pm.ResolveInfo;
import android.net.Uri;
import android.provider.CalendarContract;
import android.provider.MediaStore;
import android.provider.Settings;
import android.support.annotation.Nullable;
import android.text.TextUtils;
import android.util.Log;
import java.io.FileNotFoundException;
import java.util.Arrays;
import java.util.Calendar;
import java.util.List;
@ -147,4 +149,17 @@ public class XIntentUtils {
}
}
/**
* 通知系统有图片保存了
*/
public static void notifyImageSaved(Context context, String path) {
//https://juejin.im/post/5ae0541df265da0b9d77e45a
try {
MediaStore.Images.Media.insertImage(context.getContentResolver(), path, "", "");
context.sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, Uri.parse("file://" + path)));
} catch (FileNotFoundException e) {
e.printStackTrace();
}
}
}

@ -6,7 +6,6 @@ android {
buildToolsVersion rootProject.buildToolsVersion
defaultConfig {
minSdkVersion rootProject.minSdkVersion
targetSdkVersion rootProject.targetSdkVersion
versionCode 1

Loading…
Cancel
Save