Build against android 13, resolve new deprecated APIs

This commit is contained in:
quh4gko8 2022-07-22 18:01:46 +02:00 committed by Daniel Micay
parent fa2db54804
commit ff11df007f
2 changed files with 7 additions and 2 deletions

View File

@ -32,7 +32,7 @@ android {
} }
} }
compileSdk = 32 compileSdk = 33
buildToolsVersion = "33.0.0" buildToolsVersion = "33.0.0"
defaultConfig { defaultConfig {

View File

@ -6,6 +6,7 @@ import android.content.pm.PackageInfo;
import android.content.res.ColorStateList; import android.content.res.ColorStateList;
import android.graphics.Color; import android.graphics.Color;
import android.net.Uri; import android.net.Uri;
import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.util.Log; import android.util.Log;
import android.view.Gravity; import android.view.Gravity;
@ -376,7 +377,11 @@ public class PdfViewer extends AppCompatActivity implements LoaderManager.Loader
} }
if (savedInstanceState != null) { if (savedInstanceState != null) {
mUri = savedInstanceState.getParcelable(STATE_URI); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU) {
mUri = savedInstanceState.getParcelable(STATE_URI);
} else {
mUri = savedInstanceState.getParcelable(STATE_URI, Uri.class);
}
mPage = savedInstanceState.getInt(STATE_PAGE); mPage = savedInstanceState.getInt(STATE_PAGE);
mZoomRatio = savedInstanceState.getFloat(STATE_ZOOM_RATIO); mZoomRatio = savedInstanceState.getFloat(STATE_ZOOM_RATIO);
mDocumentOrientationDegrees = savedInstanceState.getInt(STATE_DOCUMENT_ORIENTATION_DEGREES); mDocumentOrientationDegrees = savedInstanceState.getInt(STATE_DOCUMENT_ORIENTATION_DEGREES);