From ba69cb21608ac1bc16cbaad843cc2d5698876ab7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Abel=20Garc=C3=ADa=20de=20Prada?= Date: Wed, 11 Dec 2019 12:38:59 +0100 Subject: [PATCH 1/2] Stop supporting android kitkat --- build.gradle | 2 +- owncloud-android-library | 2 +- .../ConnectivityActionReceiver.java | 14 ---- .../services/AvailableOfflineHandler.java | 2 - .../AvailableOfflineSyncJobService.java | 1 - .../files/services/CameraUploadsHandler.java | 78 +++++++++---------- .../services/CameraUploadsSyncJobService.java | 1 - .../services/RetryDownloadJobService.java | 1 - .../files/services/RetryUploadJobService.java | 1 - .../files/services/TransferRequester.java | 65 +++++++--------- .../android/media/MediaControlView.java | 3 - .../android/providers/cursors/FileCursor.kt | 4 +- .../android/ui/activity/DrawerActivity.java | 13 +--- .../ui/activity/FileDisplayActivity.kt | 1 - .../ui/activity/PrivacyPolicyActivity.java | 1 - .../ReceiveExternalFilesActivity.java | 22 +----- .../ui/dialog/OwnCloudListPreference.java | 2 - .../android/ui/dialog/RateMeDialog.java | 13 +--- .../ui/fragment/FileDetailFragment.java | 1 - .../ui/fragment/OCFileListFragment.java | 15 ++-- .../ui/helpers/FileOperationsHelper.java | 8 +- .../ui/preview/FileDownloadFragment.java | 1 - .../ui/preview/PreviewAudioFragment.java | 1 - .../ui/preview/PreviewImageActivity.java | 33 ++++---- .../ui/preview/PreviewImageFragment.java | 1 - .../ui/preview/PreviewTextFragment.java | 1 - .../ui/preview/PreviewVideoActivity.java | 22 ++---- .../ui/preview/PreviewVideoFragment.java | 32 +++----- .../owncloud/android/utils/BitmapUtils.java | 8 +- .../owncloud/android/utils/DisplayUtils.java | 31 -------- .../com/owncloud/android/utils/UriUtils.java | 5 +- .../cube/GridViewWithHeaderAndFooter.java | 17 +--- .../src/main/res/values-v21/styles.xml | 34 -------- owncloudApp/src/main/res/values/styles.xml | 5 +- .../android/test/FileContentProviderTest.java | 1 - 35 files changed, 134 insertions(+), 308 deletions(-) delete mode 100644 owncloudApp/src/main/res/values-v21/styles.xml diff --git a/build.gradle b/build.gradle index d6ba88f4500..bd390ac0d23 100644 --- a/build.gradle +++ b/build.gradle @@ -2,7 +2,7 @@ buildscript { ext { // SDK sdkCompileVersion = 28 - sdkMinVersion = 19 + sdkMinVersion = 21 sdkTargetVersion = 28 // Android jetpack diff --git a/owncloud-android-library b/owncloud-android-library index fdeb504d87e..3d9d943825c 160000 --- a/owncloud-android-library +++ b/owncloud-android-library @@ -1 +1 @@ -Subproject commit fdeb504d87e99ea9dcd87f14836da6480d8d69fc +Subproject commit 3d9d943825c421c065f0c70582263c184cf2fad7 diff --git a/owncloudApp/src/main/java/com/owncloud/android/broadcastreceivers/ConnectivityActionReceiver.java b/owncloudApp/src/main/java/com/owncloud/android/broadcastreceivers/ConnectivityActionReceiver.java index 3530310a14d..410750c9b39 100755 --- a/owncloudApp/src/main/java/com/owncloud/android/broadcastreceivers/ConnectivityActionReceiver.java +++ b/owncloudApp/src/main/java/com/owncloud/android/broadcastreceivers/ConnectivityActionReceiver.java @@ -169,20 +169,6 @@ private void wifiConnected(Context context) { Log_OC.d(TAG, "Requesting retry of camera uploads (& friends)"); TransferRequester requester = new TransferRequester(); - //Avoid duplicate uploads, because uploads retry is also managed in FileUploader - //by using jobs in versions 5 or higher - if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.LOLLIPOP) { - requester.retryFailedUploads( - MainApp.Companion.getAppContext(), - null, - // for the interrupted when Wifi fell, if any - // (side effect: any upload failed due to network error will be - // retried too, instant or not) - UploadResult.NETWORK_CONNECTION, - true - ); - } - requester.retryFailedUploads( MainApp.Companion.getAppContext(), null, diff --git a/owncloudApp/src/main/java/com/owncloud/android/files/services/AvailableOfflineHandler.java b/owncloudApp/src/main/java/com/owncloud/android/files/services/AvailableOfflineHandler.java index cbea01b3636..92471053103 100644 --- a/owncloudApp/src/main/java/com/owncloud/android/files/services/AvailableOfflineHandler.java +++ b/owncloudApp/src/main/java/com/owncloud/android/files/services/AvailableOfflineHandler.java @@ -46,7 +46,6 @@ public class AvailableOfflineHandler { private String mAccountName; private JobScheduler mJobScheduler; - @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) public AvailableOfflineHandler(Context context, String accountName) { mAccountName = accountName; mJobScheduler = (JobScheduler) context.getSystemService(Context.JOB_SCHEDULER_SERVICE); @@ -55,7 +54,6 @@ public AvailableOfflineHandler(Context context, String accountName) { /** * Schedule a periodic job to check whether recently updated available offline files need to be synchronized */ - @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) public void scheduleAvailableOfflineJob(Context context) { ComponentName serviceComponent = new ComponentName(context, AvailableOfflineSyncJobService.class); JobInfo.Builder builder; diff --git a/owncloudApp/src/main/java/com/owncloud/android/files/services/AvailableOfflineSyncJobService.java b/owncloudApp/src/main/java/com/owncloud/android/files/services/AvailableOfflineSyncJobService.java index 30192bd26dc..d7533297811 100644 --- a/owncloudApp/src/main/java/com/owncloud/android/files/services/AvailableOfflineSyncJobService.java +++ b/owncloudApp/src/main/java/com/owncloud/android/files/services/AvailableOfflineSyncJobService.java @@ -50,7 +50,6 @@ * This job should be executed every 15 minutes since a file is set as available offline for the first time and stopped * when there's no available offline files */ -@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) public class AvailableOfflineSyncJobService extends JobService { private static final String TAG = "AvOfflineSyncJobService"; diff --git a/owncloudApp/src/main/java/com/owncloud/android/files/services/CameraUploadsHandler.java b/owncloudApp/src/main/java/com/owncloud/android/files/services/CameraUploadsHandler.java index 02c4785f823..6e90357c58a 100644 --- a/owncloudApp/src/main/java/com/owncloud/android/files/services/CameraUploadsHandler.java +++ b/owncloudApp/src/main/java/com/owncloud/android/files/services/CameraUploadsHandler.java @@ -55,64 +55,60 @@ public CameraUploadsHandler(CameraUploadsConfiguration cameraUploadsConfiguratio * Schedule a periodic job to check pictures and videos to be uploaded */ public void scheduleCameraUploadsSyncJob(Context context) { + // DB Connection + CameraUploadsSyncStorageManager cameraUploadsSyncStorageManager = new + CameraUploadsSyncStorageManager(context.getContentResolver()); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - - // DB Connection - CameraUploadsSyncStorageManager cameraUploadsSyncStorageManager = new - CameraUploadsSyncStorageManager(context.getContentResolver()); - - OCCameraUploadSync ocCameraUploadSync = cameraUploadsSyncStorageManager. - getCameraUploadSync(null, null, null); + OCCameraUploadSync ocCameraUploadSync = cameraUploadsSyncStorageManager. + getCameraUploadSync(null, null, null); - // Initialize synchronization timestamps for pictures/videos, if needed - if (ocCameraUploadSync == null || - ocCameraUploadSync.getPicturesLastSync() == 0 || - ocCameraUploadSync.getVideosLastSync() == 0) { + // Initialize synchronization timestamps for pictures/videos, if needed + if (ocCameraUploadSync == null || + ocCameraUploadSync.getPicturesLastSync() == 0 || + ocCameraUploadSync.getVideosLastSync() == 0) { - initializeCameraUploadSync(cameraUploadsSyncStorageManager, ocCameraUploadSync); - } + initializeCameraUploadSync(cameraUploadsSyncStorageManager, ocCameraUploadSync); + } - ComponentName serviceComponent = new ComponentName(context, CameraUploadsSyncJobService.class); - JobInfo.Builder builder; + ComponentName serviceComponent = new ComponentName(context, CameraUploadsSyncJobService.class); + JobInfo.Builder builder; - builder = new JobInfo.Builder(JOB_ID_CAMERA_UPLOAD, serviceComponent); + builder = new JobInfo.Builder(JOB_ID_CAMERA_UPLOAD, serviceComponent); - builder.setPersisted(true); + builder.setPersisted(true); - // Execute job every 15 minutes - builder.setPeriodic(MILLISECONDS_INTERVAL_CAMERA_UPLOAD); + // Execute job every 15 minutes + builder.setPeriodic(MILLISECONDS_INTERVAL_CAMERA_UPLOAD); - // Extra data - PersistableBundle extras = new PersistableBundle(); + // Extra data + PersistableBundle extras = new PersistableBundle(); - extras.putInt(Extras.EXTRA_CAMERA_UPLOADS_SYNC_JOB_ID, JOB_ID_CAMERA_UPLOAD); + extras.putInt(Extras.EXTRA_CAMERA_UPLOADS_SYNC_JOB_ID, JOB_ID_CAMERA_UPLOAD); - extras.putString(Extras.EXTRA_ACCOUNT_NAME, mCameraUploadsConfig.getUploadAccountName()); + extras.putString(Extras.EXTRA_ACCOUNT_NAME, mCameraUploadsConfig.getUploadAccountName()); - if (mCameraUploadsConfig.isEnabledForPictures()) { - extras.putString(Extras.EXTRA_CAMERA_UPLOADS_PICTURES_PATH, mCameraUploadsConfig. - getUploadPathForPictures()); - } + if (mCameraUploadsConfig.isEnabledForPictures()) { + extras.putString(Extras.EXTRA_CAMERA_UPLOADS_PICTURES_PATH, mCameraUploadsConfig. + getUploadPathForPictures()); + } - if (mCameraUploadsConfig.isEnabledForVideos()) { - extras.putString(Extras.EXTRA_CAMERA_UPLOADS_VIDEOS_PATH, mCameraUploadsConfig. - getUploadPathForVideos()); - } + if (mCameraUploadsConfig.isEnabledForVideos()) { + extras.putString(Extras.EXTRA_CAMERA_UPLOADS_VIDEOS_PATH, mCameraUploadsConfig. + getUploadPathForVideos()); + } - extras.putString(Extras.EXTRA_CAMERA_UPLOADS_SOURCE_PATH, mCameraUploadsConfig.getSourcePath()); + extras.putString(Extras.EXTRA_CAMERA_UPLOADS_SOURCE_PATH, mCameraUploadsConfig.getSourcePath()); - extras.putInt(Extras.EXTRA_CAMERA_UPLOADS_BEHAVIOR_AFTER_UPLOAD, mCameraUploadsConfig. - getBehaviourAfterUpload()); + extras.putInt(Extras.EXTRA_CAMERA_UPLOADS_BEHAVIOR_AFTER_UPLOAD, mCameraUploadsConfig. + getBehaviourAfterUpload()); - builder.setExtras(extras); + builder.setExtras(extras); - Log_OC.d(TAG, "Scheduling a CameraUploadsSyncJobService"); + Log_OC.d(TAG, "Scheduling a CameraUploadsSyncJobService"); - JobScheduler jobScheduler = (JobScheduler) context.getSystemService(Context.JOB_SCHEDULER_SERVICE); + JobScheduler jobScheduler = (JobScheduler) context.getSystemService(Context.JOB_SCHEDULER_SERVICE); - jobScheduler.schedule(builder.build()); - } + jobScheduler.schedule(builder.build()); } /** @@ -161,6 +157,7 @@ private void initializeCameraUploadSync(CameraUploadsSyncStorageManager cameraUp /** * Update timestamp (in milliseconds) from which to start checking pictures to upload + * * @param lastSyncTimestamp */ public void updatePicturesLastSync(Context context, long lastSyncTimestamp) { @@ -181,6 +178,7 @@ public void updatePicturesLastSync(Context context, long lastSyncTimestamp) { /** * Update timestamp (in milliseconds) from which to start checking videos to upload + * * @param lastSyncTimestamp */ public void updateVideosLastSync(Context context, long lastSyncTimestamp) { diff --git a/owncloudApp/src/main/java/com/owncloud/android/files/services/CameraUploadsSyncJobService.java b/owncloudApp/src/main/java/com/owncloud/android/files/services/CameraUploadsSyncJobService.java index fd563f3a602..b5fe8001a15 100644 --- a/owncloudApp/src/main/java/com/owncloud/android/files/services/CameraUploadsSyncJobService.java +++ b/owncloudApp/src/main/java/com/owncloud/android/files/services/CameraUploadsSyncJobService.java @@ -45,7 +45,6 @@ import java.util.Date; import java.util.Locale; -@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) public class CameraUploadsSyncJobService extends JobService { private static final String TAG = CameraUploadsSyncJobService.class.getSimpleName(); diff --git a/owncloudApp/src/main/java/com/owncloud/android/files/services/RetryDownloadJobService.java b/owncloudApp/src/main/java/com/owncloud/android/files/services/RetryDownloadJobService.java index 55022e564d4..2424d5b6a2f 100644 --- a/owncloudApp/src/main/java/com/owncloud/android/files/services/RetryDownloadJobService.java +++ b/owncloudApp/src/main/java/com/owncloud/android/files/services/RetryDownloadJobService.java @@ -34,7 +34,6 @@ import com.owncloud.android.lib.common.utils.Log_OC; import com.owncloud.android.utils.Extras; -@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) public class RetryDownloadJobService extends JobService { private static final String TAG = RetryDownloadJobService.class.getName(); diff --git a/owncloudApp/src/main/java/com/owncloud/android/files/services/RetryUploadJobService.java b/owncloudApp/src/main/java/com/owncloud/android/files/services/RetryUploadJobService.java index 0594b69a1b2..247a815cfd2 100644 --- a/owncloudApp/src/main/java/com/owncloud/android/files/services/RetryUploadJobService.java +++ b/owncloudApp/src/main/java/com/owncloud/android/files/services/RetryUploadJobService.java @@ -31,7 +31,6 @@ import com.owncloud.android.lib.common.utils.Log_OC; import com.owncloud.android.utils.Extras; -@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) public class RetryUploadJobService extends JobService { private static final String TAG = RetryUploadJobService.class.getName(); diff --git a/owncloudApp/src/main/java/com/owncloud/android/files/services/TransferRequester.java b/owncloudApp/src/main/java/com/owncloud/android/files/services/TransferRequester.java index f528a971703..f1435c875da 100644 --- a/owncloudApp/src/main/java/com/owncloud/android/files/services/TransferRequester.java +++ b/owncloudApp/src/main/java/com/owncloud/android/files/services/TransferRequester.java @@ -53,9 +53,9 @@ /** * Facade class providing methods to ease requesting commands to transfer services {@link FileUploader} and * {@link FileDownloader}. - * + *

* Protects client objects from the verbosity of {@link android.content.Intent}s. - * + *

* TODO add methods for {@link FileDownloader}, right now it's just about uploads */ @@ -171,13 +171,13 @@ public void retry(Context context, OCUpload upload, boolean requestedFromWifiBac /** * Retry a subset of all the stored failed uploads. * - * @param context Caller {@link Context} - * @param account If not null, only failed uploads to this OC account will be retried; otherwise, - * uploads of all accounts will be retried. - * @param uploadResult If not null, only failed uploads with the result specified will be retried; - * otherwise, failed uploads due to any result will be retried. - * @param requestedFromWifiBackEvent true if the retry was requested because wifi connection was back, - * false otherwise + * @param context Caller {@link Context} + * @param account If not null, only failed uploads to this OC account will be retried; otherwise, + * uploads of all accounts will be retried. + * @param uploadResult If not null, only failed uploads with the result specified will be retried; + * otherwise, failed uploads due to any result will be retried. + * @param requestedFromWifiBackEvent true if the retry was requested because wifi connection was back, + * false otherwise */ public void retryFailedUploads(Context context, Account account, UploadResult uploadResult, boolean requestedFromWifiBackEvent) { @@ -201,9 +201,9 @@ public void retryFailedUploads(Context context, Account account, UploadResult up /** * Private implementation of retry. * - * @param context Caller {@link Context} - * @param account OC account where the upload will be retried. - * @param upload Persisted upload to retry. + * @param context Caller {@link Context} + * @param account OC account where the upload will be retried. + * @param upload Persisted upload to retry. * @param requestedFromWifiBackEvent true if the retry was requested because wifi connection was back, * false otherwise */ @@ -235,8 +235,8 @@ private void retry(Context context, Account account, OCUpload upload, boolean re /** * Return 'true' when conditions for a scheduled retry are met. * - * @param context Caller {@link Context} - * @return 'true' when conditions for a scheduled retry are met, 'false' otherwise. + * @param context Caller {@link Context} + * @return 'true' when conditions for a scheduled retry are met, 'false' otherwise. */ boolean shouldScheduleRetry(Context context, Exception exception) { return ( @@ -251,10 +251,10 @@ boolean shouldScheduleRetry(Context context, Exception exception) { * Schedule a future retry of an upload, to be done when a connection via an unmetered network (free Wifi) * is available. * - * @param context Caller {@link Context}. - * @param jobId Identifier to set to the retry job. - * @param accountName Local name of the OC account where the upload will be retried. - * @param remotePath Full path of the file to upload, relative to root of the OC account. + * @param context Caller {@link Context}. + * @param jobId Identifier to set to the retry job. + * @param accountName Local name of the OC account where the upload will be retried. + * @param remotePath Full path of the file to upload, relative to root of the OC account. */ void scheduleUpload(Context context, int jobId, String accountName, String remotePath) { boolean scheduled = scheduleTransfer( @@ -281,10 +281,10 @@ void scheduleUpload(Context context, int jobId, String accountName, String remot * Schedule a future retry of a download, to be done when a connection via an unmetered network (free Wifi) * is available. * - * @param context Caller {@link Context}. - * @param jobId Identifier to set to the retry job. - * @param accountName Local name of the OC account where the download will be retried. - * @param remotePath Full path of the file to download, relative to root of the OC account. + * @param context Caller {@link Context}. + * @param jobId Identifier to set to the retry job. + * @param accountName Local name of the OC account where the download will be retried. + * @param remotePath Full path of the file to download, relative to root of the OC account. */ void scheduleDownload(Context context, int jobId, String accountName, String remotePath) { boolean scheduled = scheduleTransfer( @@ -311,12 +311,12 @@ void scheduleDownload(Context context, int jobId, String accountName, String rem * Schedule a future transfer of an upload, to be done when a connection via an unmetered network (free Wifi) * is available. * - * @param context Caller {@link Context}. - * @param scheduledRetryService Class of the appropriate retry service, either to retry downloads - * or to retry uploads. - * @param jobId Identifier to set to the retry job. - * @param accountName Local name of the OC account where the upload will be retried. - * @param remotePath Full path of the file to upload, relative to root of the OC account. + * @param context Caller {@link Context}. + * @param scheduledRetryService Class of the appropriate retry service, either to retry downloads + * or to retry uploads. + * @param jobId Identifier to set to the retry job. + * @param accountName Local name of the OC account where the upload will be retried. + * @param remotePath Full path of the file to upload, relative to root of the OC account. */ private boolean scheduleTransfer( Context context, @@ -325,12 +325,6 @@ private boolean scheduleTransfer( String accountName, String remotePath ) { - - // JobShceduler requires Android >= 5.0 ; do not remove this protection while minSdkVersion is lower - if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { - return false; - } - ComponentName serviceComponent = new ComponentName( context, scheduledRetryService @@ -361,9 +355,10 @@ private boolean scheduleTransfer( /** * Retrieve the type of network connection required to schedule the last upload for an account + * * @param context * @param accountName - * @param remotePath to upload the file + * @param remotePath to upload the file * @return 2 if only wifi is required, 1 if any internet connection is required (wifi or cellular) */ private int getRequiredNetworkType(Context context, String accountName, String remotePath) { diff --git a/owncloudApp/src/main/java/com/owncloud/android/media/MediaControlView.java b/owncloudApp/src/main/java/com/owncloud/android/media/MediaControlView.java index 6f005eed095..1f0fcf43666 100644 --- a/owncloudApp/src/main/java/com/owncloud/android/media/MediaControlView.java +++ b/owncloudApp/src/main/java/com/owncloud/android/media/MediaControlView.java @@ -124,10 +124,7 @@ private void initControllerView(View v) { if (mProgress != null) { if (mProgress instanceof SeekBar) { SeekBar seeker = (SeekBar) mProgress; - DisplayUtils.colorPreLollipopHorizontalSeekBar(seeker); seeker.setOnSeekBarChangeListener(this); - } else { - DisplayUtils.colorPreLollipopHorizontalProgressBar(mProgress); } mProgress.setMax(1000); } diff --git a/owncloudApp/src/main/java/com/owncloud/android/providers/cursors/FileCursor.kt b/owncloudApp/src/main/java/com/owncloud/android/providers/cursors/FileCursor.kt index 87ae4e636f8..e2c983322ed 100644 --- a/owncloudApp/src/main/java/com/owncloud/android/providers/cursors/FileCursor.kt +++ b/owncloudApp/src/main/java/com/owncloud/android/providers/cursors/FileCursor.kt @@ -49,9 +49,7 @@ class FileCursor(projection: Array?) : MatrixCursor(projection ?: DEFAUL flags = flags or Document.FLAG_DIR_SUPPORTS_CREATE } - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - flags = flags or Document.FLAG_SUPPORTS_RENAME - } + flags = flags or Document.FLAG_SUPPORTS_RENAME if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { flags = flags or Document.FLAG_SUPPORTS_COPY diff --git a/owncloudApp/src/main/java/com/owncloud/android/ui/activity/DrawerActivity.java b/owncloudApp/src/main/java/com/owncloud/android/ui/activity/DrawerActivity.java index ba13e262e6e..afc7faf5b5c 100644 --- a/owncloudApp/src/main/java/com/owncloud/android/ui/activity/DrawerActivity.java +++ b/owncloudApp/src/main/java/com/owncloud/android/ui/activity/DrawerActivity.java @@ -143,12 +143,6 @@ protected void setupDrawer() { mAccountMiddleAccountAvatar = (ImageView) findNavigationViewChildById(R.id.drawer_account_middle); mAccountEndAccountAvatar = (ImageView) findNavigationViewChildById(R.id.drawer_account_end); - // on pre lollipop the light theme adds a black tint to icons with white coloring - // ruining the generic avatars, so tinting for icons is deactivated pre lollipop - if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { - mNavigationView.setItemIconTintList(null); - } - //Notch support mNavigationView.addOnAttachStateChangeListener(new View.OnAttachStateChangeListener() { @Override @@ -163,8 +157,8 @@ public void onViewAttachedToWindow(View v) { int orientation = getResources().getConfiguration().orientation; if (orientation == Configuration.ORIENTATION_PORTRAIT) { int displayCutoutDP = (displayCutout.getSafeInsetTop()) / - (getResources().getDisplayMetrics().densityDpi / - DisplayMetrics.DENSITY_DEFAULT); + (getResources().getDisplayMetrics().densityDpi / + DisplayMetrics.DENSITY_DEFAULT); rlDrawerActiveUser.getLayoutParams().height = (int) getResources().getDimension(R.dimen.nav_drawer_header_height) + displayCutoutDP; @@ -175,6 +169,7 @@ public void onViewAttachedToWindow(View v) { } } } + @Override public void onViewDetachedFromWindow(View v) { } @@ -793,7 +788,7 @@ private void populateDrawerOwnCloudAccounts() { /** * Adds other listeners to react on changes of the drawer layout. * - * @param listener Object interested in changes of the drawer layout. + * @param listener Object interested in changes of the drawer layout. */ public void addDrawerListener(DrawerLayout.DrawerListener listener) { if (mDrawerLayout != null) { diff --git a/owncloudApp/src/main/java/com/owncloud/android/ui/activity/FileDisplayActivity.kt b/owncloudApp/src/main/java/com/owncloud/android/ui/activity/FileDisplayActivity.kt index 8b433b8903b..adab7343d17 100644 --- a/owncloudApp/src/main/java/com/owncloud/android/ui/activity/FileDisplayActivity.kt +++ b/owncloudApp/src/main/java/com/owncloud/android/ui/activity/FileDisplayActivity.kt @@ -654,7 +654,6 @@ class FileDisplayActivity : FileActivity(), FileFragment.ContainerActivity, OnEn /** * Called, when the user selected something for uploading */ - @TargetApi(Build.VERSION_CODES.JELLY_BEAN) override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { diff --git a/owncloudApp/src/main/java/com/owncloud/android/ui/activity/PrivacyPolicyActivity.java b/owncloudApp/src/main/java/com/owncloud/android/ui/activity/PrivacyPolicyActivity.java index 31794b8b320..6060f5bc004 100644 --- a/owncloudApp/src/main/java/com/owncloud/android/ui/activity/PrivacyPolicyActivity.java +++ b/owncloudApp/src/main/java/com/owncloud/android/ui/activity/PrivacyPolicyActivity.java @@ -54,7 +54,6 @@ protected void onCreate(Bundle savedInstanceState) { // Display the progress in a progress bar, like the browser app does. final ProgressBar mProgressBar = findViewById(R.id.syncProgressBar); - DisplayUtils.colorPreLollipopHorizontalProgressBar(mProgressBar); // Allow or disallow touches with other visible windows LinearLayout activityPrivacyPolicyLayout = findViewById(R.id.activityPrivacyPolicyLayout); diff --git a/owncloudApp/src/main/java/com/owncloud/android/ui/activity/ReceiveExternalFilesActivity.java b/owncloudApp/src/main/java/com/owncloud/android/ui/activity/ReceiveExternalFilesActivity.java index 4b36b409d95..83bda05c4c1 100644 --- a/owncloudApp/src/main/java/com/owncloud/android/ui/activity/ReceiveExternalFilesActivity.java +++ b/owncloudApp/src/main/java/com/owncloud/android/ui/activity/ReceiveExternalFilesActivity.java @@ -253,25 +253,9 @@ protected Dialog onCreateDialog(final int id) { builder.setPositiveButton(R.string.uploader_wrn_no_account_setup_btn_text, new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { - if (android.os.Build.VERSION.SDK_INT > - android.os.Build.VERSION_CODES.ECLAIR_MR1) { - // using string value since in API7 this - // constatn is not defined - // in API7 < this constatant is defined in - // Settings.ADD_ACCOUNT_SETTINGS - // and Settings.EXTRA_AUTHORITIES - Intent intent = new Intent(android.provider.Settings.ACTION_ADD_ACCOUNT); - intent.putExtra("authorities", new String[]{MainApp.Companion.getAuthTokenType()}); - startActivityForResult(intent, REQUEST_CODE__SETUP_ACCOUNT); - } else { - // since in API7 there is no direct call for - // account setup, so we need to - // show our own AccountSetupAcricity, get - // desired results and setup - // everything for ourself - Intent intent = new Intent(getBaseContext(), AccountAuthenticator.class); - startActivityForResult(intent, REQUEST_CODE__SETUP_ACCOUNT); - } + Intent intent = new Intent(android.provider.Settings.ACTION_ADD_ACCOUNT); + intent.putExtra("authorities", new String[]{MainApp.Companion.getAuthTokenType()}); + startActivityForResult(intent, REQUEST_CODE__SETUP_ACCOUNT); } }); builder.setNegativeButton(R.string.uploader_wrn_no_account_quit_btn_text, new OnClickListener() { diff --git a/owncloudApp/src/main/java/com/owncloud/android/ui/dialog/OwnCloudListPreference.java b/owncloudApp/src/main/java/com/owncloud/android/ui/dialog/OwnCloudListPreference.java index 23133166a81..c075e9a5d2d 100644 --- a/owncloudApp/src/main/java/com/owncloud/android/ui/dialog/OwnCloudListPreference.java +++ b/owncloudApp/src/main/java/com/owncloud/android/ui/dialog/OwnCloudListPreference.java @@ -30,12 +30,10 @@ public OwnCloudListPreference(Context context, AttributeSet attrs) { this.mContext = context; } - @TargetApi(Build.VERSION_CODES.LOLLIPOP) public OwnCloudListPreference(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { super(context, attrs, defStyleAttr, defStyleRes); } - @TargetApi(Build.VERSION_CODES.LOLLIPOP) public OwnCloudListPreference(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); } diff --git a/owncloudApp/src/main/java/com/owncloud/android/ui/dialog/RateMeDialog.java b/owncloudApp/src/main/java/com/owncloud/android/ui/dialog/RateMeDialog.java index 9e850d71d37..5e7d910e842 100644 --- a/owncloudApp/src/main/java/com/owncloud/android/ui/dialog/RateMeDialog.java +++ b/owncloudApp/src/main/java/com/owncloud/android/ui/dialog/RateMeDialog.java @@ -61,8 +61,8 @@ public void onCreate(Bundle savedInstanceState) { /** * Public factory method to get dialog instances. * - * @param packageName The package name of the application - * @param cancelable If 'true', the dialog can be cancelled by the user input (BACK button, touch outside...) + * @param packageName The package name of the application + * @param cancelable If 'true', the dialog can be cancelled by the user input (BACK button, touch outside...) * @return New dialog instance, ready to show. */ public static RateMeDialog newInstance(String packageName, boolean cancelable) { @@ -102,13 +102,8 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa /// To count with Play market back stack, After pressing back button, /// to taken back to our application, we need to add following flags to intent. - int flags = Intent.FLAG_ACTIVITY_NO_HISTORY | - Intent.FLAG_ACTIVITY_MULTIPLE_TASK; - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - flags |= Intent.FLAG_ACTIVITY_NEW_DOCUMENT; - } else { - flags |= Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET; - } + int flags = + Intent.FLAG_ACTIVITY_NO_HISTORY | Intent.FLAG_ACTIVITY_MULTIPLE_TASK | Intent.FLAG_ACTIVITY_NEW_DOCUMENT; goToMarket.addFlags(flags); try { diff --git a/owncloudApp/src/main/java/com/owncloud/android/ui/fragment/FileDetailFragment.java b/owncloudApp/src/main/java/com/owncloud/android/ui/fragment/FileDetailFragment.java index a0eb048ee34..9f82fb24326 100644 --- a/owncloudApp/src/main/java/com/owncloud/android/ui/fragment/FileDetailFragment.java +++ b/owncloudApp/src/main/java/com/owncloud/android/ui/fragment/FileDetailFragment.java @@ -113,7 +113,6 @@ public void onActivityCreated(Bundle savedInstanceState) { setHasOptionsMenu(true); mProgressController = new TransferProgressController((ComponentsGetter) getActivity()); ProgressBar progressBar = mView.findViewById(R.id.fdProgressBar); - DisplayUtils.colorPreLollipopHorizontalProgressBar(progressBar); mProgressController.setProgressBar(progressBar); // Allow or disallow touches with other visible windows diff --git a/owncloudApp/src/main/java/com/owncloud/android/ui/fragment/OCFileListFragment.java b/owncloudApp/src/main/java/com/owncloud/android/ui/fragment/OCFileListFragment.java index 5c3af885251..561543a9df1 100644 --- a/owncloudApp/src/main/java/com/owncloud/android/ui/fragment/OCFileListFragment.java +++ b/owncloudApp/src/main/java/com/owncloud/android/ui/fragment/OCFileListFragment.java @@ -533,11 +533,9 @@ public boolean onCreateActionMode(ActionMode mode, Menu menu) { mode.invalidate(); //set gray color - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - Window w = getActivity().getWindow(); - mStatusBarColor = w.getStatusBarColor(); - w.setStatusBarColor(mStatusBarColorActionMode); - } + Window w = getActivity().getWindow(); + mStatusBarColor = w.getStatusBarColor(); + w.setStatusBarColor(mStatusBarColorActionMode); // hide FAB in multi selection mode setFabEnabled(false); @@ -584,9 +582,7 @@ public void onDestroyActionMode(ActionMode mode) { mActiveActionMode = null; // reset to previous color - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - getActivity().getWindow().setStatusBarColor(mStatusBarColor); - } + getActivity().getWindow().setStatusBarColor(mStatusBarColor); // show FAB on multi selection mode exit if (!mHideFab) { @@ -744,8 +740,7 @@ private void listDirectoryWithAnimationDown(final OCFile file) { private boolean isInPowerSaveMode() { PowerManager powerManager = (PowerManager) getActivity().getSystemService(Context.POWER_SERVICE); - return android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP - && powerManager.isPowerSaveMode(); + return powerManager.isPowerSaveMode(); } private void listDirectoryWidthAnimationUp(final OCFile file) { diff --git a/owncloudApp/src/main/java/com/owncloud/android/ui/helpers/FileOperationsHelper.java b/owncloudApp/src/main/java/com/owncloud/android/ui/helpers/FileOperationsHelper.java index 53abdcd4c62..d1306830431 100644 --- a/owncloudApp/src/main/java/com/owncloud/android/ui/helpers/FileOperationsHelper.java +++ b/owncloudApp/src/main/java/com/owncloud/android/ui/helpers/FileOperationsHelper.java @@ -312,11 +312,9 @@ public void toggleAvailableOffline(OCFile file, boolean isAvailableOffline) { if (success) { // Schedule job to check to watch for local changes in available offline files and sync them - if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) { - AvailableOfflineHandler availableOfflineHandler = - new AvailableOfflineHandler(mFileActivity, mFileActivity.getAccount().name); - availableOfflineHandler.scheduleAvailableOfflineJob(mFileActivity); - } + AvailableOfflineHandler availableOfflineHandler = + new AvailableOfflineHandler(mFileActivity, mFileActivity.getAccount().name); + availableOfflineHandler.scheduleAvailableOfflineJob(mFileActivity); /// immediate content synchronization if (OCFile.AvailableOfflineStatus.AVAILABLE_OFFLINE == file.getAvailableOfflineStatus()) { diff --git a/owncloudApp/src/main/java/com/owncloud/android/ui/preview/FileDownloadFragment.java b/owncloudApp/src/main/java/com/owncloud/android/ui/preview/FileDownloadFragment.java index 0105c893ad0..c04084c729d 100644 --- a/owncloudApp/src/main/java/com/owncloud/android/ui/preview/FileDownloadFragment.java +++ b/owncloudApp/src/main/java/com/owncloud/android/ui/preview/FileDownloadFragment.java @@ -130,7 +130,6 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, View rootView = inflater.inflate(R.layout.file_download_fragment, container, false); mProgressBar = rootView.findViewById(R.id.progressBar); - DisplayUtils.colorPreLollipopHorizontalProgressBar(mProgressBar); (rootView.findViewById(R.id.cancelBtn)).setOnClickListener(this); diff --git a/owncloudApp/src/main/java/com/owncloud/android/ui/preview/PreviewAudioFragment.java b/owncloudApp/src/main/java/com/owncloud/android/ui/preview/PreviewAudioFragment.java index cd5db0f7edb..06d0b3e1779 100644 --- a/owncloudApp/src/main/java/com/owncloud/android/ui/preview/PreviewAudioFragment.java +++ b/owncloudApp/src/main/java/com/owncloud/android/ui/preview/PreviewAudioFragment.java @@ -153,7 +153,6 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, mImagePreview = view.findViewById(R.id.image_preview); mMediaController = view.findViewById(R.id.media_controller); mProgressBar = view.findViewById(R.id.syncProgressBar); - DisplayUtils.colorPreLollipopHorizontalProgressBar(mProgressBar); return view; } diff --git a/owncloudApp/src/main/java/com/owncloud/android/ui/preview/PreviewImageActivity.java b/owncloudApp/src/main/java/com/owncloud/android/ui/preview/PreviewImageActivity.java index 81cab266e19..fe4074181be 100644 --- a/owncloudApp/src/main/java/com/owncloud/android/ui/preview/PreviewImageActivity.java +++ b/owncloudApp/src/main/java/com/owncloud/android/ui/preview/PreviewImageActivity.java @@ -61,7 +61,7 @@ import com.owncloud.android.utils.PreferenceUtils; /** - * Holds a swiping galley where image files contained in an ownCloud directory are shown + * Holds a swiping galley where image files contained in an ownCloud directory are shown */ public class PreviewImageActivity extends FileActivity implements FileFragment.ContainerActivity, @@ -115,9 +115,7 @@ public void onSystemUiVisibilityChange(int flags) { } }); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - getWindow().setStatusBarColor(getResources().getColor(R.color.owncloud_blue_dark_transparent)); - } + getWindow().setStatusBarColor(getResources().getColor(R.color.owncloud_blue_dark_transparent)); mLocalBroadcastManager = LocalBroadcastManager.getInstance(this); @@ -228,7 +226,9 @@ protected ServiceConnection newTransferenceServiceConnection() { return new PreviewImageServiceConnection(); } - /** Defines callbacks for service binding, passed to bindService() */ + /** + * Defines callbacks for service binding, passed to bindService() + */ private class PreviewImageServiceConnection implements ServiceConnection { @Override @@ -322,7 +322,7 @@ public void showDetails(OCFile file) { * This method will be invoked when a new page becomes selected. Animation is not necessarily * complete. * - * @param position Position index of the new selected page + * @param position Position index of the new selected page */ @Override public void onPageSelected(int position) { @@ -356,10 +356,10 @@ public void run() { } /** - * Called when the scroll state changes. Useful for discovering when the user begins dragging, + * Called when the scroll state changes. Useful for discovering when the user begins dragging, * when the pager is automatically settling to the current page. when it is fully stopped/idle. * - * @param state The new scroll state (SCROLL_STATE_IDLE, _DRAGGING, _SETTLING + * @param state The new scroll state (SCROLL_STATE_IDLE, _DRAGGING, _SETTLING */ @Override public void onPageScrollStateChanged(int state) { @@ -369,13 +369,12 @@ public void onPageScrollStateChanged(int state) { * This method will be invoked when the current page is scrolled, either as part of a * programmatically initiated smooth scroll or a user initiated touch scroll. * - * @param position Position index of the first page currently being displayed. - * Page position+1 will be visible if positionOffset is - * nonzero. - * - * @param positionOffset Value from [0, 1) indicating the offset from the page - * at position. - * @param positionOffsetPixels Value in pixels indicating the offset from position. + * @param position Position index of the first page currently being displayed. + * Page position+1 will be visible if positionOffset is + * nonzero. + * @param positionOffset Value from [0, 1) indicating the offset from the page + * at position. + * @param positionOffsetPixels Value in pixels indicating the offset from position. */ @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { @@ -383,7 +382,7 @@ public void onPageScrolled(int position, float positionOffset, int positionOffse /** * Class waiting for broadcast events from the {@link FileDownloader} service. - * + *

* Updates the UI when a download is started or finished, provided that it is relevant for the * folder displayed in the gallery. */ @@ -485,7 +484,7 @@ public void allFilesOption() { } @Override - public void onlyAvailableOfflineOption(){ + public void onlyAvailableOfflineOption() { backToDisplayActivity(); super.onlyAvailableOfflineOption(); } diff --git a/owncloudApp/src/main/java/com/owncloud/android/ui/preview/PreviewImageFragment.java b/owncloudApp/src/main/java/com/owncloud/android/ui/preview/PreviewImageFragment.java index da1057d2980..2a2e0ae2e55 100644 --- a/owncloudApp/src/main/java/com/owncloud/android/ui/preview/PreviewImageFragment.java +++ b/owncloudApp/src/main/java/com/owncloud/android/ui/preview/PreviewImageFragment.java @@ -158,7 +158,6 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa ); mProgressBar = view.findViewById(R.id.syncProgressBar); - DisplayUtils.colorPreLollipopHorizontalProgressBar(mProgressBar); mImageView = view.findViewById(R.id.photo_view); mImageView.setVisibility(View.GONE); mImageView.setOnClickListener(v -> { diff --git a/owncloudApp/src/main/java/com/owncloud/android/ui/preview/PreviewTextFragment.java b/owncloudApp/src/main/java/com/owncloud/android/ui/preview/PreviewTextFragment.java index 482a26eff31..dfe9ee06e3e 100644 --- a/owncloudApp/src/main/java/com/owncloud/android/ui/preview/PreviewTextFragment.java +++ b/owncloudApp/src/main/java/com/owncloud/android/ui/preview/PreviewTextFragment.java @@ -116,7 +116,6 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, ); mProgressBar = ret.findViewById(R.id.syncProgressBar); - DisplayUtils.colorPreLollipopHorizontalProgressBar(mProgressBar); mTextPreview = ret.findViewById(R.id.text_preview); return ret; diff --git a/owncloudApp/src/main/java/com/owncloud/android/ui/preview/PreviewVideoActivity.java b/owncloudApp/src/main/java/com/owncloud/android/ui/preview/PreviewVideoActivity.java index 98dbac08bd5..68047b5d365 100644 --- a/owncloudApp/src/main/java/com/owncloud/android/ui/preview/PreviewVideoActivity.java +++ b/owncloudApp/src/main/java/com/owncloud/android/ui/preview/PreviewVideoActivity.java @@ -147,21 +147,13 @@ public void onWindowFocusChanged(boolean hasFocus) { super.onWindowFocusChanged(hasFocus); if (hasFocus) { // Let app go truly full screen using immersive mode, user swipes to display the system bars - if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT) { - getWindow().getDecorView().setSystemUiVisibility( - View.SYSTEM_UI_FLAG_LAYOUT_STABLE - | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION - | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN - | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION - | View.SYSTEM_UI_FLAG_FULLSCREEN - | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY); - } else { - /** - * Use full screen but with a limitation, the least user interaction will cause - * navigation controls to reappear immediately - */ - getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION); - } + getWindow().getDecorView().setSystemUiVisibility( + View.SYSTEM_UI_FLAG_LAYOUT_STABLE + | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION + | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN + | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION + | View.SYSTEM_UI_FLAG_FULLSCREEN + | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY); } } diff --git a/owncloudApp/src/main/java/com/owncloud/android/ui/preview/PreviewVideoFragment.java b/owncloudApp/src/main/java/com/owncloud/android/ui/preview/PreviewVideoFragment.java index b686a77c502..8a48659607a 100644 --- a/owncloudApp/src/main/java/com/owncloud/android/ui/preview/PreviewVideoFragment.java +++ b/owncloudApp/src/main/java/com/owncloud/android/ui/preview/PreviewVideoFragment.java @@ -6,16 +6,16 @@ * @author Christian Schabesberger * @author Shashvat Kedia * Copyright (C) 2019 ownCloud GmbH. - * + *

* This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2, * as published by the Free Software Foundation. - * + *

* This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + *

* You should have received a copy of the GNU General Public License * along with this program. If not, see . */ @@ -172,7 +172,6 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, View view = inflater.inflate(R.layout.video_preview, container, false); mProgressBar = view.findViewById(R.id.syncProgressBar); - DisplayUtils.colorPreLollipopHorizontalProgressBar(mProgressBar); mProgressBar.setVisibility(View.GONE); simpleExoPlayerView = view.findViewById(R.id.video_player); @@ -446,26 +445,19 @@ private void preparePlayer() { trackSelector = new DefaultTrackSelector(videoTrackSelectionFactory); // Video streaming is only supported at Jelly Bean or higher Android versions (>= API 16) - if (Util.SDK_INT >= 16) { - // Create the player - player = ExoPlayerFactory.newSimpleInstance(getContext(), trackSelector, - new DefaultLoadControl()); + // Create the player + player = ExoPlayerFactory.newSimpleInstance(getContext(), trackSelector, + new DefaultLoadControl()); - player.addListener(this); + player.addListener(this); - // Bind the player to the view. - simpleExoPlayerView.setPlayer(player); + // Bind the player to the view. + simpleExoPlayerView.setPlayer(player); - // Prepare video player asynchronously - new PrepareVideoPlayerAsyncTask(getActivity(), this, - getFile(), mAccount, mainHandler).execute(); - } else { - - // Show dialog with error and starts file download - showAlertDialog(new PreviewVideoError(getString(R.string.previewing_video_not_supported), - true, false)); - } + // Prepare video player asynchronously + new PrepareVideoPlayerAsyncTask(getActivity(), this, + getFile(), mAccount, mainHandler).execute(); } /** diff --git a/owncloudApp/src/main/java/com/owncloud/android/utils/BitmapUtils.java b/owncloudApp/src/main/java/com/owncloud/android/utils/BitmapUtils.java index 9b55e0f1ea2..f1b8b028d79 100644 --- a/owncloudApp/src/main/java/com/owncloud/android/utils/BitmapUtils.java +++ b/owncloudApp/src/main/java/com/owncloud/android/utils/BitmapUtils.java @@ -62,12 +62,8 @@ public static Bitmap decodeSampledBitmapFromFile(String srcPath, int reqWidth, i final Options options = new Options(); options.inScaled = true; options.inPurgeable = true; - if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.GINGERBREAD_MR1) { - options.inPreferQualityOverSpeed = false; - } - if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) { - options.inMutable = false; - } + options.inPreferQualityOverSpeed = false; + options.inMutable = false; // make a false load of the bitmap to get its dimensions options.inJustDecodeBounds = true; diff --git a/owncloudApp/src/main/java/com/owncloud/android/utils/DisplayUtils.java b/owncloudApp/src/main/java/com/owncloud/android/utils/DisplayUtils.java index 67ed183f0da..ab5625a134f 100644 --- a/owncloudApp/src/main/java/com/owncloud/android/utils/DisplayUtils.java +++ b/owncloudApp/src/main/java/com/owncloud/android/utils/DisplayUtils.java @@ -157,7 +157,6 @@ public static int getSeasonalIconId() { * @param toASCII if true converts from Unicode to ASCII, if false converts from ASCII to Unicode * @return the URL containing the converted domain name */ - @TargetApi(Build.VERSION_CODES.GINGERBREAD) public static String convertIdn(String url, boolean toASCII) { String urlNoDots = url; @@ -256,36 +255,6 @@ public static Point getScreenSize(Activity caller) { return size; } - /** - * sets the coloring of the given progress bar to color_accent. - * - * @param progressBar the progress bar to be colored - */ - public static void colorPreLollipopHorizontalProgressBar(ProgressBar progressBar) { - if (progressBar != null && Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { - int color = progressBar.getResources().getColor(R.color.color_accent); - progressBar.getIndeterminateDrawable().setColorFilter(color, PorterDuff.Mode.SRC_IN); - progressBar.getProgressDrawable().setColorFilter(color, PorterDuff.Mode.SRC_IN); - } - } - - /** - * sets the coloring of the given seek bar to color_accent. - * - * @param seekBar the seek bar to be colored - */ - public static void colorPreLollipopHorizontalSeekBar(SeekBar seekBar) { - if (seekBar != null && Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { - colorPreLollipopHorizontalProgressBar(seekBar); - - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { - int color = seekBar.getResources().getColor(R.color.color_accent); - seekBar.getThumb().setColorFilter(color, PorterDuff.Mode.SRC_IN); - seekBar.getThumb().setColorFilter(color, PorterDuff.Mode.SRC_IN); - } - } - } - /** * set the owncloud standard colors for the snackbar. * diff --git a/owncloudApp/src/main/java/com/owncloud/android/utils/UriUtils.java b/owncloudApp/src/main/java/com/owncloud/android/utils/UriUtils.java index f8c40408d71..d24c6999631 100644 --- a/owncloudApp/src/main/java/com/owncloud/android/utils/UriUtils.java +++ b/owncloudApp/src/main/java/com/owncloud/android/utils/UriUtils.java @@ -119,12 +119,9 @@ public static boolean isContentDocument(Uri uri) { * @param uri The URI to resolve * @return The path in the file system to the content or null if it could not be found (not a file) */ - @TargetApi(Build.VERSION_CODES.KITKAT) public static String getLocalPath(Uri uri, Context context) { - final boolean isKitKatOrLater = Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT; - // DocumentProvider - if (isKitKatOrLater && DocumentsContract.isDocumentUri(context, uri)) { + if ( DocumentsContract.isDocumentUri(context, uri)) { // ExternalStorageProvider if (UriUtils.isExternalStorageDocument(uri)) { final String docId = DocumentsContract.getDocumentId(uri); diff --git a/owncloudApp/src/main/java/third_parties/in/srain/cube/GridViewWithHeaderAndFooter.java b/owncloudApp/src/main/java/third_parties/in/srain/cube/GridViewWithHeaderAndFooter.java index 54e6f343813..8503001f65e 100644 --- a/owncloudApp/src/main/java/third_parties/in/srain/cube/GridViewWithHeaderAndFooter.java +++ b/owncloudApp/src/main/java/third_parties/in/srain/cube/GridViewWithHeaderAndFooter.java @@ -254,24 +254,11 @@ private void removeFixedViewInfo(View v, ArrayList where) { } private int getNumColumnsCompatible() { - return super.getNumColumns(); + return super.getNumColumns(); } - @TargetApi(16) private int getColumnWidthCompatible() { - if (Build.VERSION.SDK_INT >= 16) { - return super.getColumnWidth(); - } else { - try { - Field numColumns = getClass().getSuperclass().getDeclaredField("mColumnWidth"); - numColumns.setAccessible(true); - return numColumns.getInt(this); - } catch (NoSuchFieldException e) { - throw new RuntimeException(e); - } catch (IllegalAccessException e) { - throw new RuntimeException(e); - } - } + return super.getColumnWidth(); } @Override diff --git a/owncloudApp/src/main/res/values-v21/styles.xml b/owncloudApp/src/main/res/values-v21/styles.xml deleted file mode 100644 index db9f5bb4e22..00000000000 --- a/owncloudApp/src/main/res/values-v21/styles.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/owncloudApp/src/main/res/values/styles.xml b/owncloudApp/src/main/res/values/styles.xml index 72c479f2352..3de2155d55a 100644 --- a/owncloudApp/src/main/res/values/styles.xml +++ b/owncloudApp/src/main/res/values/styles.xml @@ -57,10 +57,13 @@ - + diff --git a/tests/src/com/owncloud/android/test/FileContentProviderTest.java b/tests/src/com/owncloud/android/test/FileContentProviderTest.java index 730db303a12..0de4c870679 100644 --- a/tests/src/com/owncloud/android/test/FileContentProviderTest.java +++ b/tests/src/com/owncloud/android/test/FileContentProviderTest.java @@ -10,7 +10,6 @@ import com.owncloud.android.db.ProviderMeta.ProviderTableMeta; import com.owncloud.android.providers.FileContentProvider; -@TargetApi(Build.VERSION_CODES.CUPCAKE) public class FileContentProviderTest extends ProviderTestCase2 { private static final String TAG = FileContentProvider.class.getName(); From f2b7f650513395f3dcbaf9991104c364aedaf110 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Abel=20Garc=C3=ADa=20de=20Prada?= <47524927+abelgardep@users.noreply.github.com> Date: Thu, 12 Dec 2019 11:24:16 +0100 Subject: [PATCH 2/2] Remove additional white space --- .../src/main/java/com/owncloud/android/utils/UriUtils.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/owncloudApp/src/main/java/com/owncloud/android/utils/UriUtils.java b/owncloudApp/src/main/java/com/owncloud/android/utils/UriUtils.java index d24c6999631..58187c00829 100644 --- a/owncloudApp/src/main/java/com/owncloud/android/utils/UriUtils.java +++ b/owncloudApp/src/main/java/com/owncloud/android/utils/UriUtils.java @@ -121,7 +121,7 @@ public static boolean isContentDocument(Uri uri) { */ public static String getLocalPath(Uri uri, Context context) { // DocumentProvider - if ( DocumentsContract.isDocumentUri(context, uri)) { + if (DocumentsContract.isDocumentUri(context, uri)) { // ExternalStorageProvider if (UriUtils.isExternalStorageDocument(uri)) { final String docId = DocumentsContract.getDocumentId(uri);