Fix crashing on seekbar and file sharing

This commit is contained in:
h4h13 2019-07-24 00:02:41 +05:30
parent 67ea2a40a9
commit d593e7cf78
30 changed files with 172 additions and 136 deletions

View file

@ -73,7 +73,7 @@ public class MusicUtil {
@NonNull
public static Intent createShareSongFileIntent(@NonNull final Song song, @NonNull Context context) {
Uri file = FileProvider.getUriForFile(context, context.getPackageName() + ".provider", new File(song.getData()));
/*Uri file = FileProvider.getUriForFile(context, context.getPackageName() + ".provider", new File(song.getData()));
try {
return new Intent().setAction(Intent.ACTION_SEND).putExtra(Intent.EXTRA_STREAM, file)
.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
@ -82,6 +82,19 @@ public class MusicUtil {
e.printStackTrace();
Toast.makeText(context, "Could not share this file, I'm aware of the issue.", Toast.LENGTH_SHORT).show();
return new Intent();
}*/
try {
return new Intent()
.setAction(Intent.ACTION_SEND)
.putExtra(Intent.EXTRA_STREAM, FileProvider.getUriForFile(context, context.getApplicationContext().getPackageName(), new File(song.getData())))
.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
.setType("audio/*");
} catch (IllegalArgumentException e) {
// TODO the path is most likely not like /storage/emulated/0/... but something like /storage/28C7-75B0/...
e.printStackTrace();
Toast.makeText(context, "Could not share this file, I'm aware of the issue.", Toast.LENGTH_SHORT).show();
return new Intent();
}
}

View file

@ -53,20 +53,7 @@ object ViewUtil {
if (thumbTint) {
progressSlider.thumbTintList = ColorStateList.valueOf(newColor)
}
if (progressSlider.progressDrawable is LayerDrawable) {
val ld = progressSlider.progressDrawable as LayerDrawable?
if (ld != null) {
val clipDrawableProgress = ld.findDrawableByLayerId(android.R.id.progress)
clipDrawableProgress.setColorFilter(newColor, PorterDuff.Mode.SRC_IN)
val clipDrawableBackground = ld.findDrawableByLayerId(android.R.id.background)
clipDrawableBackground.setColorFilter(MaterialValueHelper.getPrimaryDisabledTextColor(progressSlider.context, ColorUtil.isColorLight(ThemeStore.primaryColor(progressSlider.context))), PorterDuff.Mode.SRC_IN)
}
} else {
progressSlider.progressTintList = ColorStateList.valueOf(newColor)
}
progressSlider.progressTintList = ColorStateList.valueOf(newColor)
}
fun setProgressDrawable(progressSlider: ProgressBar, newColor: Int) {