Change clouds from grid to list view
@ -7,42 +7,54 @@ enum class CloudTypeModel(builder: Builder) {
|
||||
|
||||
CRYPTO(Builder("CRYPTO", R.string.cloud_names_crypto)), //
|
||||
DROPBOX(Builder("DROPBOX", R.string.cloud_names_dropbox) //
|
||||
.withCloudImageResource(R.drawable.cloud_type_dropbox) //
|
||||
.withCloudImageLargeResource(R.drawable.cloud_type_dropbox_large)), //
|
||||
.withCloudImageResource(R.drawable.dropbox) //
|
||||
.withVaultImageResource(R.drawable.dropbox_vault) //
|
||||
.withVaultSelectedImageResource(R.drawable.dropbox_vault_selected)), //
|
||||
GOOGLE_DRIVE(Builder("GOOGLE_DRIVE", R.string.cloud_names_google_drive) //
|
||||
.withCloudImageResource(R.drawable.cloud_type_google_drive) //
|
||||
.withCloudImageLargeResource(R.drawable.cloud_type_google_drive_large)), //
|
||||
.withCloudImageResource(R.drawable.google_drive) //
|
||||
.withVaultImageResource(R.drawable.google_drive_vault) //
|
||||
.withVaultSelectedImageResource(R.drawable.google_drive_vault_selected)), //
|
||||
ONEDRIVE(Builder("ONEDRIVE", R.string.cloud_names_onedrive) //
|
||||
.withCloudImageResource(R.drawable.cloud_type_onedrive) //
|
||||
.withCloudImageLargeResource(R.drawable.cloud_type_onedrive_large)), //
|
||||
.withCloudImageResource(R.drawable.onedrive) //
|
||||
.withVaultImageResource(R.drawable.onedrive_vault) //
|
||||
.withVaultSelectedImageResource(R.drawable.onedrive_vault_selected)), //
|
||||
WEBDAV(Builder("WEBDAV", R.string.cloud_names_webdav) //
|
||||
.withCloudImageResource(R.drawable.cloud_type_webdav) //
|
||||
.withCloudImageLargeResource(R.drawable.cloud_type_webdav_large) //
|
||||
.withCloudImageResource(R.drawable.webdav) //
|
||||
.withVaultImageResource(R.drawable.webdav_vault) //
|
||||
.withVaultSelectedImageResource(R.drawable.webdav_vault_selected) //
|
||||
.withMultiInstances()), //
|
||||
LOCAL(Builder("LOCAL", R.string.cloud_names_local_storage) //
|
||||
.withCloudImageResource(R.drawable.storage_type_local) //
|
||||
.withCloudImageLargeResource(R.drawable.storage_type_local_large) //
|
||||
.withCloudImageResource(R.drawable.local_fs) //
|
||||
.withVaultImageResource(R.drawable.local_fs_vault) //
|
||||
.withVaultSelectedImageResource(R.drawable.local_fs_vault_selected) //
|
||||
.withMultiInstances());
|
||||
|
||||
val cloudName: String = builder.cloudName
|
||||
val displayNameResource: Int = builder.displayNameResource
|
||||
val cloudImageResource: Int = builder.cloudImageResource
|
||||
val cloudImageLargeResource: Int = builder.cloudImageLargeResource
|
||||
val vaultImageResource: Int = builder.vaultImageResource
|
||||
val vaultSelectedImageResource: Int = builder.vaultSelectedImageResource
|
||||
val isMultiInstance: Boolean = builder.multiInstances
|
||||
|
||||
private class Builder(val cloudName: String, val displayNameResource: Int) {
|
||||
|
||||
var cloudImageResource = 0
|
||||
var cloudImageLargeResource = 0
|
||||
var vaultImageResource = 0
|
||||
var vaultSelectedImageResource = 0
|
||||
var multiInstances = false
|
||||
|
||||
fun withCloudImageResource(cloudImageResource: Int): Builder {
|
||||
this.cloudImageResource = cloudImageResource
|
||||
fun withCloudImageResource(cloudImageLargeResource: Int): Builder {
|
||||
this.cloudImageResource = cloudImageLargeResource
|
||||
return this
|
||||
}
|
||||
|
||||
fun withCloudImageLargeResource(cloudImageLargeResource: Int): Builder {
|
||||
this.cloudImageLargeResource = cloudImageLargeResource
|
||||
fun withVaultImageResource(vaultImageResource: Int): Builder {
|
||||
this.vaultImageResource = vaultImageResource
|
||||
return this
|
||||
}
|
||||
|
||||
fun withVaultSelectedImageResource(vaultSelectedImageResource: Int): Builder {
|
||||
this.vaultSelectedImageResource = vaultSelectedImageResource
|
||||
return this
|
||||
}
|
||||
|
||||
|
@ -29,7 +29,7 @@ class ChooseCloudServiceActivity : BaseActivity(), ChooseCloudServiceView {
|
||||
setSupportActionBar(toolbar)
|
||||
}
|
||||
|
||||
override fun createFragment(): Fragment? = ChooseCloudServiceFragment()
|
||||
override fun createFragment(): Fragment = ChooseCloudServiceFragment()
|
||||
|
||||
override fun getCustomMenuResource(): Int = R.menu.menu_cloud_services
|
||||
|
||||
|
@ -48,7 +48,7 @@ constructor() : RecyclerViewBaseAdapter<VaultModel, BiometricAuthSettingsAdapter
|
||||
val vaultModel = getItem(position)
|
||||
|
||||
itemView.vaultName.text = vaultModel.name
|
||||
itemView.cloud.setImageResource(vaultModel.cloudType.cloudImageResource)
|
||||
itemView.cloud.setImageResource(vaultModel.cloudType.vaultImageResource)
|
||||
|
||||
itemView.toggleBiometricAuth.isChecked = vaultModel.password != null
|
||||
|
||||
|
@ -48,7 +48,7 @@ internal constructor(context: Context) : RecyclerViewBaseAdapter<CloudModel, Clo
|
||||
private fun internalBind(cloudModel: CloudModel) {
|
||||
itemView.settings.setOnClickListener { callback.onCloudSettingsClicked(cloudModel) }
|
||||
|
||||
itemView.cloudImage.setImageResource(cloudModel.cloudType().cloudImageResource)
|
||||
itemView.cloudImage.setImageResource(cloudModel.cloudType().vaultImageResource)
|
||||
|
||||
itemView.setOnClickListener { callback.onCloudConnectionClicked(cloudModel) }
|
||||
|
||||
|
@ -5,7 +5,7 @@ import org.cryptomator.presentation.R
|
||||
import org.cryptomator.presentation.model.CloudTypeModel
|
||||
import org.cryptomator.presentation.ui.adapter.CloudsAdapter.CloudViewHolder
|
||||
import javax.inject.Inject
|
||||
import kotlinx.android.synthetic.main.item_cloud.view.cloud
|
||||
import kotlinx.android.synthetic.main.item_cloud.view.cloudImage
|
||||
import kotlinx.android.synthetic.main.item_cloud.view.cloudName
|
||||
|
||||
class CloudsAdapter @Inject
|
||||
@ -28,10 +28,10 @@ constructor() : RecyclerViewBaseAdapter<CloudTypeModel, CloudsAdapter.OnItemClic
|
||||
|
||||
override fun bind(position: Int) {
|
||||
val cloudTypeModel = getItem(position)
|
||||
itemView.cloud.setImageResource(cloudTypeModel.cloudImageLargeResource)
|
||||
itemView.cloudImage.setImageResource(cloudTypeModel.cloudImageResource)
|
||||
itemView.cloudName.setText(cloudTypeModel.displayNameResource)
|
||||
|
||||
itemView.cloud.setOnClickListener { callback.onCloudClicked(cloudTypeModel) }
|
||||
itemView.setOnClickListener { callback.onCloudClicked(cloudTypeModel) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ constructor() : RecyclerViewBaseAdapter<VaultModel, SharedLocationsAdapter.Callb
|
||||
boundVault = getItem(position)
|
||||
|
||||
boundVault?.let {
|
||||
itemView.cloudImage.setImageResource(it.cloudType.cloudImageResource)
|
||||
itemView.cloudImage.setImageResource(it.cloudType.vaultImageResource)
|
||||
itemView.vaultName.text = it.name
|
||||
|
||||
val boundVaultSelected = it == selectedVault
|
||||
|
@ -60,7 +60,7 @@ internal constructor() : RecyclerViewBaseAdapter<VaultModel, VaultsAdapter.OnIte
|
||||
itemView.vaultName.text = vaultModel.name
|
||||
itemView.vaultPath.text = vaultModel.path
|
||||
|
||||
itemView.cloudImage.setImageResource(vaultModel.cloudType.cloudImageResource)
|
||||
itemView.cloudImage.setImageResource(vaultModel.cloudType.vaultImageResource)
|
||||
|
||||
if (vaultModel.isLocked) {
|
||||
itemView.unlockedImage.visibility = View.GONE
|
||||
@ -68,7 +68,10 @@ internal constructor() : RecyclerViewBaseAdapter<VaultModel, VaultsAdapter.OnIte
|
||||
itemView.unlockedImage.visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
itemView.setOnClickListener { callback.onVaultClicked(vaultModel) }
|
||||
itemView.setOnClickListener {
|
||||
itemView.cloudImage.setImageResource(vaultModel.cloudType.vaultSelectedImageResource)
|
||||
callback.onVaultClicked(vaultModel)
|
||||
}
|
||||
|
||||
itemView.unlockedImage.setOnClickListener { callback.onVaultLockClicked(vaultModel) }
|
||||
|
||||
|
@ -32,7 +32,7 @@ class CloudConnectionSettingsBottomSheet : BaseBottomSheet<CloudConnectionSettin
|
||||
else -> throw IllegalStateException("Cloud model is not binded in the view")
|
||||
}
|
||||
|
||||
iv_cloud_image.setImageResource(cloudModel.cloudType().cloudImageResource)
|
||||
iv_cloud_image.setImageResource(cloudModel.cloudType().vaultImageResource)
|
||||
change_cloud.setOnClickListener {
|
||||
callback?.onChangeCloudClicked(cloudModel)
|
||||
dismiss()
|
||||
|
@ -31,7 +31,7 @@ class SettingsVaultBottomSheet : BaseBottomSheet<SettingsVaultBottomSheet.Callba
|
||||
lock_vault.visibility = LinearLayout.GONE
|
||||
}
|
||||
val cloudType = vaultModel.cloudType
|
||||
cloud_image.setImageResource(cloudType.cloudImageResource)
|
||||
cloud_image.setImageResource(cloudType.vaultImageResource)
|
||||
vault_name.text = vaultModel.name
|
||||
vault_path.text = vaultModel.path
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
package org.cryptomator.presentation.ui.fragment
|
||||
|
||||
import androidx.recyclerview.widget.GridLayoutManager
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import org.cryptomator.generator.Fragment
|
||||
import org.cryptomator.presentation.R
|
||||
import org.cryptomator.presentation.model.CloudTypeModel
|
||||
@ -36,7 +36,7 @@ class ChooseCloudServiceFragment : BaseFragment() {
|
||||
|
||||
private fun setupRecyclerView() {
|
||||
cloudsAdapter.setCallback(onItemClickListener)
|
||||
recyclerView.layoutManager = GridLayoutManager(context(), 2)
|
||||
recyclerView.layoutManager = LinearLayoutManager(context())
|
||||
recyclerView.adapter = cloudsAdapter
|
||||
// smoother scrolling
|
||||
recyclerView.setHasFixedSize(true)
|
||||
|
Before Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 5.5 KiB |
Before Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 9.2 KiB |
BIN
presentation/src/main/res/drawable-mdpi/dropbox.png
Normal file
After Width: | Height: | Size: 516 B |
Before Width: | Height: | Size: 765 B After Width: | Height: | Size: 765 B |
After Width: | Height: | Size: 489 B |
BIN
presentation/src/main/res/drawable-mdpi/google_drive.png
Normal file
After Width: | Height: | Size: 962 B |
Before Width: | Height: | Size: 849 B After Width: | Height: | Size: 849 B |
After Width: | Height: | Size: 518 B |
BIN
presentation/src/main/res/drawable-mdpi/local_fs.png
Normal file
After Width: | Height: | Size: 298 B |
Before Width: | Height: | Size: 726 B After Width: | Height: | Size: 726 B |
After Width: | Height: | Size: 459 B |
BIN
presentation/src/main/res/drawable-mdpi/onedrive.png
Normal file
After Width: | Height: | Size: 510 B |
Before Width: | Height: | Size: 936 B After Width: | Height: | Size: 936 B |
After Width: | Height: | Size: 564 B |
BIN
presentation/src/main/res/drawable-mdpi/pcloud.png
Normal file
After Width: | Height: | Size: 525 B |
BIN
presentation/src/main/res/drawable-mdpi/pcloud_vault.png
Normal file
After Width: | Height: | Size: 912 B |
After Width: | Height: | Size: 551 B |
Before Width: | Height: | Size: 1.9 KiB |
BIN
presentation/src/main/res/drawable-mdpi/webdav.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 651 B |
Before Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 3.4 KiB |
Before Width: | Height: | Size: 26 KiB |
BIN
presentation/src/main/res/drawable-xhdpi/dropbox.png
Normal file
After Width: | Height: | Size: 998 B |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 883 B |
BIN
presentation/src/main/res/drawable-xhdpi/google_drive.png
Normal file
After Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 1000 B |
BIN
presentation/src/main/res/drawable-xhdpi/local_fs.png
Normal file
After Width: | Height: | Size: 541 B |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 848 B |
BIN
presentation/src/main/res/drawable-xhdpi/onedrive.png
Normal file
After Width: | Height: | Size: 890 B |
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 1.1 KiB |
BIN
presentation/src/main/res/drawable-xhdpi/pcloud.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
presentation/src/main/res/drawable-xhdpi/pcloud_vault.png
Normal file
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 3.9 KiB |
BIN
presentation/src/main/res/drawable-xhdpi/webdav.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 5.1 KiB |
Before Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 5.5 KiB |
Before Width: | Height: | Size: 52 KiB |
BIN
presentation/src/main/res/drawable-xxhdpi/dropbox.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 1.4 KiB |
BIN
presentation/src/main/res/drawable-xxhdpi/google_drive.png
Normal file
After Width: | Height: | Size: 3.3 KiB |
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 1.4 KiB |
BIN
presentation/src/main/res/drawable-xxhdpi/local_fs.png
Normal file
After Width: | Height: | Size: 827 B |
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 1.2 KiB |
BIN
presentation/src/main/res/drawable-xxhdpi/onedrive.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.7 KiB |
After Width: | Height: | Size: 1.6 KiB |
BIN
presentation/src/main/res/drawable-xxhdpi/pcloud.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
presentation/src/main/res/drawable-xxhdpi/pcloud_vault.png
Normal file
After Width: | Height: | Size: 2.7 KiB |
After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 6.0 KiB |
BIN
presentation/src/main/res/drawable-xxhdpi/webdav.png
Normal file
After Width: | Height: | Size: 5.4 KiB |
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 2.0 KiB |
@ -1,23 +1,42 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="6dp"
|
||||
android:layout_marginBottom="6dp"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
android:layout_height="72dp"
|
||||
android:background="?android:attr/selectableItemBackground">
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/cloud"
|
||||
android:layout_width="128dp"
|
||||
android:layout_height="128dp"
|
||||
android:background="@android:color/transparent" />
|
||||
<ImageView
|
||||
android:id="@+id/cloudImage"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginStart="16dp" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_toEndOf="@+id/cloudImage"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/cloudName"
|
||||
style="@style/AppTheme.ListItemDarkTextColor"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
android:textSize="18sp" />
|
||||
<!-- using android:singleLine to fix https://code.google.com/p/android/issues/detail?id=33868 -->
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/cloudName"
|
||||
style="@style/AppTheme.ListItemDarkTextColor"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="18sp" />
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_toEndOf="@+id/cloudImage"
|
||||
android:background="@color/list_divider" />
|
||||
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
|