Minor UI tweaks regarding S3
This commit is contained in:
parent
939f3d2c1d
commit
56c60703a6
@ -51,7 +51,7 @@ class CloudConnectionListActivity : BaseActivity(),
|
||||
|
||||
private fun connectionListFragment(): CloudConnectionListFragment = getCurrentFragment(R.id.fragmentContainer) as CloudConnectionListFragment
|
||||
|
||||
override fun createFragment(): Fragment? = CloudConnectionListFragment()
|
||||
override fun createFragment(): Fragment = CloudConnectionListFragment()
|
||||
|
||||
override fun showNodeSettings(cloudModel: CloudModel) {
|
||||
val cloudNodeSettingDialog = //
|
||||
|
@ -8,6 +8,7 @@ import org.cryptomator.presentation.R
|
||||
import org.cryptomator.presentation.model.CloudModel
|
||||
import org.cryptomator.presentation.model.LocalStorageModel
|
||||
import org.cryptomator.presentation.model.PCloudModel
|
||||
import org.cryptomator.presentation.model.S3CloudModel
|
||||
import org.cryptomator.presentation.model.WebDavCloudModel
|
||||
import org.cryptomator.presentation.model.comparator.CloudModelComparator
|
||||
import org.cryptomator.presentation.ui.adapter.CloudConnectionListAdapter.CloudConnectionHolder
|
||||
@ -53,12 +54,19 @@ internal constructor(context: Context) : RecyclerViewBaseAdapter<CloudModel, Clo
|
||||
|
||||
itemView.setOnClickListener { callback.onCloudConnectionClicked(cloudModel) }
|
||||
|
||||
if (cloudModel is WebDavCloudModel) {
|
||||
bindWebDavCloudModel(cloudModel)
|
||||
} else if (cloudModel is PCloudModel) {
|
||||
bindPCloudModel(cloudModel)
|
||||
} else if (cloudModel is LocalStorageModel) {
|
||||
bindLocalStorageCloudModel(cloudModel)
|
||||
when (cloudModel) {
|
||||
is WebDavCloudModel -> {
|
||||
bindWebDavCloudModel(cloudModel)
|
||||
}
|
||||
is PCloudModel -> {
|
||||
bindPCloudModel(cloudModel)
|
||||
}
|
||||
is S3CloudModel -> {
|
||||
bindS3loudModel(cloudModel)
|
||||
}
|
||||
is LocalStorageModel -> {
|
||||
bindLocalStorageCloudModel(cloudModel)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -70,7 +78,6 @@ internal constructor(context: Context) : RecyclerViewBaseAdapter<CloudModel, Clo
|
||||
} catch (e: URISyntaxException) {
|
||||
throw FatalBackendException("path in WebDAV cloud isn't correct (no uri)")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private fun bindPCloudModel(cloudModel: PCloudModel) {
|
||||
@ -78,6 +85,12 @@ internal constructor(context: Context) : RecyclerViewBaseAdapter<CloudModel, Clo
|
||||
itemView.cloudSubText.visibility = View.GONE
|
||||
}
|
||||
|
||||
|
||||
private fun bindS3loudModel(cloudModel: S3CloudModel) {
|
||||
itemView.cloudText.text = cloudModel.username() // FIXME what to display
|
||||
itemView.cloudSubText.visibility = View.GONE
|
||||
}
|
||||
|
||||
private fun bindLocalStorageCloudModel(cloudModel: LocalStorageModel) {
|
||||
if (cloudModel.location().isEmpty()) {
|
||||
itemView.cloudText.text = cloudModel.storage()
|
||||
|
@ -8,6 +8,7 @@ import org.cryptomator.presentation.model.CloudModel
|
||||
import org.cryptomator.presentation.model.CloudTypeModel
|
||||
import org.cryptomator.presentation.model.LocalStorageModel
|
||||
import org.cryptomator.presentation.model.PCloudModel
|
||||
import org.cryptomator.presentation.model.S3CloudModel
|
||||
import org.cryptomator.presentation.model.WebDavCloudModel
|
||||
import kotlinx.android.synthetic.main.dialog_bottom_sheet_cloud_settings.change_cloud
|
||||
import kotlinx.android.synthetic.main.dialog_bottom_sheet_cloud_settings.delete_cloud
|
||||
@ -30,6 +31,7 @@ class CloudConnectionSettingsBottomSheet : BaseBottomSheet<CloudConnectionSettin
|
||||
when (cloudModel.cloudType()) {
|
||||
CloudTypeModel.WEBDAV -> bindViewForWebDAV(cloudModel as WebDavCloudModel)
|
||||
CloudTypeModel.PCLOUD -> bindViewForPCloud(cloudModel as PCloudModel)
|
||||
CloudTypeModel.S3 -> bindViewForS3(cloudModel as S3CloudModel)
|
||||
CloudTypeModel.LOCAL -> bindViewForLocal(cloudModel as LocalStorageModel)
|
||||
else -> throw IllegalStateException("Cloud model is not binded in the view")
|
||||
}
|
||||
@ -66,6 +68,11 @@ class CloudConnectionSettingsBottomSheet : BaseBottomSheet<CloudConnectionSettin
|
||||
tv_cloud_name.text = cloudModel.username()
|
||||
}
|
||||
|
||||
private fun bindViewForS3(cloudModel: S3CloudModel) {
|
||||
change_cloud.visibility = View.VISIBLE
|
||||
tv_cloud_name.text = cloudModel.username() // FIXME what to display
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
private const val CLOUD_NODE_ARG = "cloudModel"
|
||||
|
@ -40,6 +40,14 @@ class S3AddOrChangeFragment : BaseFragment() {
|
||||
}
|
||||
false
|
||||
}
|
||||
|
||||
s3CloudModel?.let {
|
||||
if(it.s3Endpoint().isNotEmpty()) {
|
||||
toggleCustomS3.isChecked = false
|
||||
ll_custom_s3.visibility = View.VISIBLE
|
||||
}
|
||||
}
|
||||
|
||||
toggleCustomS3.setOnClickListener { switch ->
|
||||
toggleCustomS3Changed((switch as SwitchMaterial).isChecked)
|
||||
}
|
||||
|
@ -64,6 +64,7 @@
|
||||
android:id="@+id/ll_custom_s3"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:orientation="vertical"
|
||||
android:visibility="gone">
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user