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