Remove version handling in some methods due to min version increase
This commit is contained in:
parent
cfd204faea
commit
8dc310bcee
@ -1,7 +1,6 @@
|
||||
package org.cryptomator.data.cloud.local;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Build;
|
||||
|
||||
import org.cryptomator.data.cloud.local.file.LocalStorageContentRepository;
|
||||
import org.cryptomator.data.cloud.local.storageaccessframework.LocalStorageAccessFrameworkContentRepository;
|
||||
@ -43,7 +42,7 @@ public class LocalStorageContentRepositoryFactory implements CloudContentReposit
|
||||
if (!hasPermissions(WRITE_EXTERNAL_STORAGE, READ_EXTERNAL_STORAGE)) {
|
||||
throw new NoAuthenticationProvidedException(cloud);
|
||||
}
|
||||
if (((LocalStorageCloud) cloud).rootUri() != null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
if (((LocalStorageCloud) cloud).rootUri() != null) {
|
||||
return new LocalStorageAccessFrameworkContentRepository(context, mimeTypes, (LocalStorageCloud) cloud);
|
||||
} else {
|
||||
return new LocalStorageContentRepository(context, (LocalStorageCloud) cloud);
|
||||
|
@ -1,6 +1,5 @@
|
||||
package org.cryptomator.presentation.model
|
||||
|
||||
import android.os.Build
|
||||
import org.cryptomator.domain.CloudType
|
||||
import org.cryptomator.presentation.R
|
||||
|
||||
@ -22,14 +21,13 @@ enum class CloudTypeModel(builder: Builder) {
|
||||
.withMultiInstances()), //
|
||||
LOCAL(Builder("LOCAL", R.string.cloud_names_local_storage) //
|
||||
.withCloudImageResource(R.drawable.storage_type_local) //
|
||||
.withCloudImageLargeResource(R.drawable.storage_type_local_large) //
|
||||
.withMultiInstancesIfLollipopOrLater());
|
||||
.withCloudImageLargeResource(R.drawable.storage_type_local_large));
|
||||
|
||||
val cloudName: String
|
||||
val displayNameResource: Int
|
||||
val cloudImageResource: Int
|
||||
val cloudImageLargeResource: Int
|
||||
val isMultiInstance: Boolean
|
||||
val cloudName: String = builder.cloudName
|
||||
val displayNameResource: Int = builder.displayNameResource
|
||||
val cloudImageResource: Int = builder.cloudImageResource
|
||||
val cloudImageLargeResource: Int = builder.cloudImageLargeResource
|
||||
val isMultiInstance: Boolean = builder.multiInstances
|
||||
|
||||
private class Builder(val cloudName: String, val displayNameResource: Int) {
|
||||
var cloudImageResource = 0
|
||||
@ -50,11 +48,6 @@ enum class CloudTypeModel(builder: Builder) {
|
||||
multiInstances = true
|
||||
return this
|
||||
}
|
||||
|
||||
fun withMultiInstancesIfLollipopOrLater(): Builder {
|
||||
multiInstances = Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP
|
||||
return this
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
@ -66,12 +59,4 @@ enum class CloudTypeModel(builder: Builder) {
|
||||
return CloudType.valueOf(type.name)
|
||||
}
|
||||
}
|
||||
|
||||
init {
|
||||
cloudName = builder.cloudName
|
||||
displayNameResource = builder.displayNameResource
|
||||
cloudImageResource = builder.cloudImageResource
|
||||
cloudImageLargeResource = builder.cloudImageLargeResource
|
||||
isMultiInstance = builder.multiInstances
|
||||
}
|
||||
}
|
||||
|
@ -673,22 +673,11 @@ class BrowseFilesPresenter @Inject constructor( //
|
||||
}
|
||||
|
||||
fun onExportFileClicked(cloudFile: CloudFileModel, trigger: ExportOperation) {
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
|
||||
exportFileToDownloadDirectory(cloudFile, trigger)
|
||||
} else {
|
||||
exportFileToUserSelectedLocation(cloudFile, trigger)
|
||||
}
|
||||
exportFileToUserSelectedLocation(cloudFile, trigger)
|
||||
}
|
||||
|
||||
fun onExportNodesClicked(selectedCloudFiles: ArrayList<CloudNodeModel<*>>, trigger: ExportOperation) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
exportNodesToUserSelectedLocation(selectedCloudFiles, trigger)
|
||||
}
|
||||
}
|
||||
|
||||
private fun exportFileToDownloadDirectory(fileToExport: CloudFileModel, exportOperation: ExportOperation) {
|
||||
requestPermissions(PermissionsResultCallbacks.exportFileToDownloadDirectory(fileToExport, exportOperation), //
|
||||
R.string.permission_message_export_file, Manifest.permission.WRITE_EXTERNAL_STORAGE)
|
||||
exportNodesToUserSelectedLocation(selectedCloudFiles, trigger)
|
||||
}
|
||||
|
||||
@Callback
|
||||
|
@ -103,7 +103,7 @@ class CloudConnectionListPresenter @Inject constructor( //
|
||||
}
|
||||
|
||||
private fun releaseUriPermissionForLocalStorageCloud(cloudModel: LocalStorageModel) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT && (cloudModel.toCloud() as LocalStorageCloud).rootUri() != null) {
|
||||
if ((cloudModel.toCloud() as LocalStorageCloud).rootUri() != null) {
|
||||
releaseUriPermission(cloudModel.uri())
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
package org.cryptomator.presentation.ui.activity
|
||||
|
||||
import android.net.Uri
|
||||
import android.os.Build
|
||||
import android.view.View.*
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.fragment.app.Fragment
|
||||
@ -91,9 +90,7 @@ class ImagePreviewActivity : BaseActivity(), ImagePreviewView, ConfirmDeleteClou
|
||||
}
|
||||
|
||||
private fun setupStatusBar() {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
window.statusBarColor = ContextCompat.getColor(this, R.color.colorBlack)
|
||||
}
|
||||
window.statusBarColor = ContextCompat.getColor(this, R.color.colorBlack)
|
||||
}
|
||||
|
||||
private fun setupToolbar(index: Int) {
|
||||
@ -131,10 +128,7 @@ class ImagePreviewActivity : BaseActivity(), ImagePreviewView, ConfirmDeleteClou
|
||||
var newUiOptions = window.decorView.systemUiVisibility
|
||||
newUiOptions = newUiOptions or SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
|
||||
newUiOptions = newUiOptions xor SYSTEM_UI_FLAG_FULLSCREEN
|
||||
|
||||
if (Build.VERSION.SDK_INT >= 19) {
|
||||
newUiOptions = newUiOptions xor SYSTEM_UI_FLAG_IMMERSIVE_STICKY
|
||||
}
|
||||
newUiOptions = newUiOptions xor SYSTEM_UI_FLAG_IMMERSIVE_STICKY
|
||||
|
||||
window.decorView.systemUiVisibility = newUiOptions
|
||||
}
|
||||
|
@ -179,11 +179,7 @@ class SettingsFragment : PreferenceFragmentCompat() {
|
||||
val strDate: String = dateFormatUser.format(lastUpdateCheck)
|
||||
format(getString(R.string.screen_settings_last_check_updates), strDate)
|
||||
} else {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
getString(R.string.screen_settings_last_check_updates_never)
|
||||
} else {
|
||||
getString(R.string.screen_settings_last_check_updates_never_pre_marshmallow)
|
||||
}
|
||||
getString(R.string.screen_settings_last_check_updates_never)
|
||||
}
|
||||
|
||||
val date = SpannableString(readableDate)
|
||||
|
@ -342,7 +342,6 @@
|
||||
<string name="screen_settings_check_updates">Nach Aktualisierungen suchen</string>
|
||||
<string name="screen_settings_last_check_updates">Letzte Ausführung %1$s</string>
|
||||
<string name="screen_settings_last_check_updates_never">@string/lock_timeout_never</string>
|
||||
<string name="screen_settings_last_check_updates_never_pre_marshmallow">Noch nie ~ Wenn aus technischen Gründen keine Update-Prüfung durchgeführt werden kann, können Updates manuell über die Website https://cryptomator.org/android/ heruntergeladen und installiert werden.</string>
|
||||
<string name="dialog_cache_size_title">Zwischenspeichergröße pro Cloud</string>
|
||||
<!-- lock timeout names -->
|
||||
<string name="lock_timeout_instant">Sofort</string>
|
||||
|
@ -350,7 +350,6 @@
|
||||
<string name="screen_settings_check_updates">Vérifier les mises à jour</string>
|
||||
<string name="screen_settings_last_check_updates">Dernière exécution %1$s</string>
|
||||
<string name="screen_settings_last_check_updates_never">@string/lock_timeout_never</string>
|
||||
<string name="screen_settings_last_check_updates_never_pre_marshmallow">Jamais ~ Si la vérification de mise à jour ne peut être effectué pour des raisons techniques, les mises à jour peuvent être téléchargées et installées manuellement à partir du site https://cryptomator.org/android/.</string>
|
||||
<string name="dialog_cache_size_title">Taille du cache par cloud</string>
|
||||
<!-- lock timeout names -->
|
||||
<string name="lock_timeout_instant">Instantané</string>
|
||||
|
@ -342,7 +342,6 @@
|
||||
<string name="screen_settings_check_updates">Güncellemeleri kontrol et</string>
|
||||
<string name="screen_settings_last_check_updates">Son çalıştırma %1$s</string>
|
||||
<string name="screen_settings_last_check_updates_never">@string/lock_timeout_never</string>
|
||||
<string name="screen_settings_last_check_updates_never_pre_marshmallow">Teknik nedenlerle güncelleme kontrolü yapılamıyorsa, güncellemeler, https://cryptomator.org/android/ web sitesinden manuel olarak indirilebilir ve yüklenebilir.</string>
|
||||
<string name="dialog_cache_size_title">Bulut başına önbellek boyutu</string>
|
||||
<!-- lock timeout names -->
|
||||
<string name="lock_timeout_instant">Anında</string>
|
||||
|
@ -510,7 +510,6 @@
|
||||
<string name="screen_settings_check_updates">Check for updates</string>
|
||||
<string name="screen_settings_last_check_updates">Last run %1$s</string>
|
||||
<string name="screen_settings_last_check_updates_never">@string/lock_timeout_never</string>
|
||||
<string name="screen_settings_last_check_updates_never_pre_marshmallow">Never ~ If an update check cannot be performed for technical reasons, updates can be downloaded and installed manually from the website https://cryptomator.org/android/.</string>
|
||||
|
||||
<string name="dialog_cache_size_title">Cache size per Cloud</string>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user