diff --git a/build.gradle b/build.gradle index 708fc12de4..b621f6437f 100644 --- a/build.gradle +++ b/build.gradle @@ -126,7 +126,7 @@ android { compileSdkVersion 29 defaultConfig { - minSdkVersion 17 + minSdkVersion 18 targetSdkVersion 29 // arguments to be passed to functional tests diff --git a/src/main/java/com/owncloud/android/MainApp.java b/src/main/java/com/owncloud/android/MainApp.java index ca92e5980b..570882f9ab 100644 --- a/src/main/java/com/owncloud/android/MainApp.java +++ b/src/main/java/com/owncloud/android/MainApp.java @@ -473,12 +473,10 @@ public class MainApp extends MultiDexApplication implements HasAndroidInjector { connectivityService, powerManagementService); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { - ReceiversHelper.registerPowerChangeReceiver(uploadsStorageManager, - accountManager, - connectivityService, - powerManagementService); - } + ReceiversHelper.registerPowerChangeReceiver(uploadsStorageManager, + accountManager, + connectivityService, + powerManagementService); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { ReceiversHelper.registerPowerSaveReceiver(uploadsStorageManager, diff --git a/src/main/java/com/owncloud/android/ui/adapter/ActivityListAdapter.java b/src/main/java/com/owncloud/android/ui/adapter/ActivityListAdapter.java index 67a49a836a..b9009e616f 100644 --- a/src/main/java/com/owncloud/android/ui/adapter/ActivityListAdapter.java +++ b/src/main/java/com/owncloud/android/ui/adapter/ActivityListAdapter.java @@ -449,11 +449,8 @@ public class ActivityListAdapter extends RecyclerView.Adapter= android.os.Build.VERSION_CODES.JELLY_BEAN_MR2) { - pattern = DateFormat.getBestDateTimePattern(Locale.getDefault(), "EEEE, MMMM d"); - } - return DateFormat.format(pattern, modificationTimestamp); + return DateFormat.format(DateFormat.getBestDateTimePattern( + Locale.getDefault(), "EEEE, MMMM d"), modificationTimestamp); } } diff --git a/src/main/java/com/owncloud/android/ui/dialog/SyncedFolderPreferencesDialogFragment.java b/src/main/java/com/owncloud/android/ui/dialog/SyncedFolderPreferencesDialogFragment.java index ccbfe2aace..f0cee82d33 100644 --- a/src/main/java/com/owncloud/android/ui/dialog/SyncedFolderPreferencesDialogFragment.java +++ b/src/main/java/com/owncloud/android/ui/dialog/SyncedFolderPreferencesDialogFragment.java @@ -230,9 +230,8 @@ public class SyncedFolderPreferencesDialogFragment extends DialogFragment { } mUploadOnWifiCheckbox.setChecked(mSyncedFolder.isWifiOnly()); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { - mUploadOnChargingCheckbox.setChecked(mSyncedFolder.isChargingOnly()); - } + mUploadOnChargingCheckbox.setChecked(mSyncedFolder.isChargingOnly()); + mUploadExistingCheckbox.setChecked(mSyncedFolder.isExisting()); mUploadUseSubfoldersCheckbox.setChecked(mSyncedFolder.isSubfolderByDate()); @@ -330,10 +329,8 @@ public class SyncedFolderPreferencesDialogFragment extends DialogFragment { view.findViewById(R.id.setting_instant_upload_on_wifi_container).setEnabled(enable); view.findViewById(R.id.setting_instant_upload_on_wifi_container).setAlpha(alpha); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { - view.findViewById(R.id.setting_instant_upload_on_charging_container).setEnabled(enable); - view.findViewById(R.id.setting_instant_upload_on_charging_container).setAlpha(alpha); - } + view.findViewById(R.id.setting_instant_upload_on_charging_container).setEnabled(enable); + view.findViewById(R.id.setting_instant_upload_on_charging_container).setAlpha(alpha); view.findViewById(R.id.setting_instant_upload_existing_container).setEnabled(enable); view.findViewById(R.id.setting_instant_upload_existing_container).setAlpha(alpha); @@ -377,25 +374,22 @@ public class SyncedFolderPreferencesDialogFragment extends DialogFragment { view.findViewById(R.id.delete).setOnClickListener(new OnSyncedFolderDeleteClickListener()); view.findViewById(R.id.setting_instant_upload_on_wifi_container).setOnClickListener( - new OnClickListener() { - @Override - public void onClick(View v) { - mSyncedFolder.setWifiOnly(!mSyncedFolder.isWifiOnly()); - mUploadOnWifiCheckbox.toggle(); - } - }); + new OnClickListener() { + @Override + public void onClick(View v) { + mSyncedFolder.setWifiOnly(!mSyncedFolder.isWifiOnly()); + mUploadOnWifiCheckbox.toggle(); + } + }); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { - - view.findViewById(R.id.setting_instant_upload_on_charging_container).setOnClickListener( - new OnClickListener() { - @Override - public void onClick(View v) { - mSyncedFolder.setChargingOnly(!mSyncedFolder.isChargingOnly()); - mUploadOnChargingCheckbox.toggle(); - } - }); - } + view.findViewById(R.id.setting_instant_upload_on_charging_container).setOnClickListener( + new OnClickListener() { + @Override + public void onClick(View v) { + mSyncedFolder.setChargingOnly(!mSyncedFolder.isChargingOnly()); + mUploadOnChargingCheckbox.toggle(); + } + }); view.findViewById(R.id.setting_instant_upload_existing_container).setOnClickListener( new OnClickListener() { diff --git a/src/main/java/com/owncloud/android/ui/fragment/OCFileListFragment.java b/src/main/java/com/owncloud/android/ui/fragment/OCFileListFragment.java index ddc22183c5..d786acb2ff 100644 --- a/src/main/java/com/owncloud/android/ui/fragment/OCFileListFragment.java +++ b/src/main/java/com/owncloud/android/ui/fragment/OCFileListFragment.java @@ -428,10 +428,8 @@ public class OCFileListFragment extends ExtendedListFragment implements public void uploadFromApp() { Intent action = new Intent(Intent.ACTION_GET_CONTENT); action = action.setType("*/*").addCategory(Intent.CATEGORY_OPENABLE); - //Intent.EXTRA_ALLOW_MULTIPLE is only supported on api level 18+, Jelly Bean - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) { - action.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true); - } + action.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true); + getActivity().startActivityForResult( Intent.createChooser(action, getString(R.string.upload_chooser_title)), FileDisplayActivity.REQUEST_CODE__SELECT_CONTENT_FROM_APPS diff --git a/src/main/java/com/owncloud/android/ui/helpers/FileOperationsHelper.java b/src/main/java/com/owncloud/android/ui/helpers/FileOperationsHelper.java index 64deefa0d4..b9a6b42b9e 100755 --- a/src/main/java/com/owncloud/android/ui/helpers/FileOperationsHelper.java +++ b/src/main/java/com/owncloud/android/ui/helpers/FileOperationsHelper.java @@ -1057,14 +1057,6 @@ public class FileOperationsHelper { return -1L; } - long availableBytesOnDevice; - if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN_MR2) { - availableBytesOnDevice = stat.getBlockSizeLong() * stat.getAvailableBlocksLong(); - } else { - availableBytesOnDevice = (long) stat.getBlockSize() * (long) stat.getAvailableBlocks(); - } - - return availableBytesOnDevice; + return stat.getBlockSizeLong() * stat.getAvailableBlocksLong(); } - }