mirror of
https://github.com/nextcloud/talk-android
synced 2025-03-06 14:27:24 +00:00
Theme ProfileController
Signed-off-by: Álvaro Brey <alvaro.brey@nextcloud.com>
This commit is contained in:
parent
4c31f6f2e9
commit
a4c01978a8
@ -69,6 +69,7 @@ import com.nextcloud.talk.models.json.userprofile.UserProfileFieldsOverall
|
|||||||
import com.nextcloud.talk.models.json.userprofile.UserProfileOverall
|
import com.nextcloud.talk.models.json.userprofile.UserProfileOverall
|
||||||
import com.nextcloud.talk.remotefilebrowser.activities.RemoteFileBrowserActivity
|
import com.nextcloud.talk.remotefilebrowser.activities.RemoteFileBrowserActivity
|
||||||
import com.nextcloud.talk.ui.dialog.ScopeDialog
|
import com.nextcloud.talk.ui.dialog.ScopeDialog
|
||||||
|
import com.nextcloud.talk.ui.theme.ViewThemeUtils
|
||||||
import com.nextcloud.talk.users.UserManager
|
import com.nextcloud.talk.users.UserManager
|
||||||
import com.nextcloud.talk.utils.ApiUtils
|
import com.nextcloud.talk.utils.ApiUtils
|
||||||
import com.nextcloud.talk.utils.DisplayUtils
|
import com.nextcloud.talk.utils.DisplayUtils
|
||||||
@ -110,6 +111,9 @@ class ProfileController : NewBaseController(R.layout.controller_profile) {
|
|||||||
@Inject
|
@Inject
|
||||||
lateinit var permissionUtil: PlatformPermissionUtil
|
lateinit var permissionUtil: PlatformPermissionUtil
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
lateinit var viewThemeUtils: ViewThemeUtils
|
||||||
|
|
||||||
private var currentUser: User? = null
|
private var currentUser: User? = null
|
||||||
private var edit = false
|
private var edit = false
|
||||||
private var adapter: UserInfoAdapter? = null
|
private var adapter: UserInfoAdapter? = null
|
||||||
@ -196,7 +200,7 @@ class ProfileController : NewBaseController(R.layout.controller_profile) {
|
|||||||
|
|
||||||
override fun onAttach(view: View) {
|
override fun onAttach(view: View) {
|
||||||
super.onAttach(view)
|
super.onAttach(view)
|
||||||
adapter = UserInfoAdapter(null, activity!!.resources.getColor(R.color.colorPrimary), this)
|
adapter = UserInfoAdapter(null, viewThemeUtils.getElementColor(activity!!), this)
|
||||||
binding.userinfoList.adapter = adapter
|
binding.userinfoList.adapter = adapter
|
||||||
binding.userinfoList.setItemViewCacheSize(DEFAULT_CACHE_SIZE)
|
binding.userinfoList.setItemViewCacheSize(DEFAULT_CACHE_SIZE)
|
||||||
currentUser = userManager.currentUser.blockingGet()
|
currentUser = userManager.currentUser.blockingGet()
|
||||||
@ -260,6 +264,13 @@ class ProfileController : NewBaseController(R.layout.controller_profile) {
|
|||||||
// unused atm
|
// unused atm
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
colorIcons()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun colorIcons() {
|
||||||
|
viewThemeUtils.colorImageView(binding.avatarChoose)
|
||||||
|
viewThemeUtils.colorImageView(binding.avatarCamera)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun isAllEmpty(items: Array<String?>): Boolean {
|
private fun isAllEmpty(items: Array<String?>): Boolean {
|
||||||
@ -301,7 +312,8 @@ class ProfileController : NewBaseController(R.layout.controller_profile) {
|
|||||||
binding.emptyList.root.visibility = View.VISIBLE
|
binding.emptyList.root.visibility = View.VISIBLE
|
||||||
setErrorMessageForMultiList(
|
setErrorMessageForMultiList(
|
||||||
activity!!.getString(R.string.userinfo_no_info_headline),
|
activity!!.getString(R.string.userinfo_no_info_headline),
|
||||||
activity!!.getString(R.string.userinfo_no_info_text), R.drawable.ic_user
|
activity!!.getString(R.string.userinfo_no_info_text),
|
||||||
|
R.drawable.ic_user
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
binding.emptyList.root.visibility = View.GONE
|
binding.emptyList.root.visibility = View.GONE
|
||||||
@ -616,11 +628,13 @@ class ProfileController : NewBaseController(R.layout.controller_profile) {
|
|||||||
val builder = MultipartBody.Builder()
|
val builder = MultipartBody.Builder()
|
||||||
builder.setType(MultipartBody.FORM)
|
builder.setType(MultipartBody.FORM)
|
||||||
builder.addFormDataPart(
|
builder.addFormDataPart(
|
||||||
"files[]", file!!.name,
|
"files[]",
|
||||||
|
file!!.name,
|
||||||
file.asRequestBody(IMAGE_PREFIX_GENERIC.toMediaTypeOrNull())
|
file.asRequestBody(IMAGE_PREFIX_GENERIC.toMediaTypeOrNull())
|
||||||
)
|
)
|
||||||
val filePart: MultipartBody.Part = MultipartBody.Part.createFormData(
|
val filePart: MultipartBody.Part = MultipartBody.Part.createFormData(
|
||||||
"files[]", file.name,
|
"files[]",
|
||||||
|
file.name,
|
||||||
file.asRequestBody(IMAGE_JPG.toMediaTypeOrNull())
|
file.asRequestBody(IMAGE_JPG.toMediaTypeOrNull())
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -643,7 +657,8 @@ class ProfileController : NewBaseController(R.layout.controller_profile) {
|
|||||||
|
|
||||||
override fun onError(e: Throwable) {
|
override fun onError(e: Throwable) {
|
||||||
Toast.makeText(
|
Toast.makeText(
|
||||||
applicationContext, context.getString(R.string.default_error_msg),
|
applicationContext,
|
||||||
|
context.getString(R.string.default_error_msg),
|
||||||
Toast
|
Toast
|
||||||
.LENGTH_LONG
|
.LENGTH_LONG
|
||||||
).show()
|
).show()
|
||||||
@ -688,7 +703,8 @@ class ProfileController : NewBaseController(R.layout.controller_profile) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class UserInfoDetailsItem(
|
class UserInfoDetailsItem(
|
||||||
@field:DrawableRes @param:DrawableRes var icon: Int,
|
@field:DrawableRes @param:DrawableRes
|
||||||
|
var icon: Int,
|
||||||
var text: String?,
|
var text: String?,
|
||||||
var hint: String,
|
var hint: String,
|
||||||
val field: Field,
|
val field: Field,
|
||||||
|
Loading…
Reference in New Issue
Block a user