Fix crashes

This commit is contained in:
NekoInverter committed 2021-01-03 15:16:01 +08:00
1 parent c20faa7259
commit 5a0aafc8e8
2 files changed
+23 -2

No files matched your search

@@ -7,7 +7,7 @@ import android.view.MotionEvent;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
public class BridgeRecyclerView extends RecyclerView{
public class BridgeRecyclerView extends RecyclerView {
public BridgeRecyclerView(@NonNull Context context) {
super(context);
}
@@ -20,9 +20,26 @@ public class BridgeRecyclerView extends RecyclerView{
super(context, attrs, defStyleAttr);
}
@Override
void scrollStep(int dx, int dy, @Nullable int[] consumed) {
try {
super.scrollStep(dx, dy, consumed);
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public boolean scrollByInternal(int x, int y, MotionEvent ev, int type) {
return super.scrollByInternal(x, y, ev, type);
}
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
try {
super.onLayout(changed, l, t, r, b);
} catch (Exception e) {
e.printStackTrace();
}
}
}
@@ -862,7 +862,11 @@ public class GalleryActivity extends EhActivity implements SeekBar.OnSeekBarChan
return;
}
if (!mGalleryProvider.save(page, UniFile.fromMediaUri(this, imageUri))) {
resolver.delete(imageUri, null, null);
try {
resolver.delete(imageUri, null, null);
} catch (Exception e) {
e.printStackTrace();
}
Toast.makeText(this, R.string.error_cant_save_image, Toast.LENGTH_SHORT).show();
return;
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {