mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-20 03:59:35 +01:00
migrate scope dialog to native view binding
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
parent
c680888dba
commit
fd754f582b
@ -2,7 +2,9 @@
|
|||||||
* Nextcloud Talk application
|
* Nextcloud Talk application
|
||||||
*
|
*
|
||||||
* @author Marcel Hibbe
|
* @author Marcel Hibbe
|
||||||
|
* @author Andy Scherzinger
|
||||||
* Copyright (C) 2021 Marcel Hibbe <dev@mhibbe.de>
|
* Copyright (C) 2021 Marcel Hibbe <dev@mhibbe.de>
|
||||||
|
* Copyright (C) 2021 Andy Scherzinger <info@andy-scherzinger.de>
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -2,7 +2,9 @@
|
|||||||
* Nextcloud Talk application
|
* Nextcloud Talk application
|
||||||
*
|
*
|
||||||
* @author Tobias Kaminsky
|
* @author Tobias Kaminsky
|
||||||
|
* @author Andy Scherzinger
|
||||||
* Copyright (C) 2021 Tobias Kaminsky <tobias.kaminsky@nextcloud.com>
|
* Copyright (C) 2021 Tobias Kaminsky <tobias.kaminsky@nextcloud.com>
|
||||||
|
* Copyright (C) 2021 Andy Scherzinger <info@andy-scherzinger.de>
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -24,11 +26,11 @@ import android.content.Context
|
|||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.widget.LinearLayout
|
|
||||||
import com.google.android.material.bottomsheet.BottomSheetBehavior
|
import com.google.android.material.bottomsheet.BottomSheetBehavior
|
||||||
import com.google.android.material.bottomsheet.BottomSheetDialog
|
import com.google.android.material.bottomsheet.BottomSheetDialog
|
||||||
import com.nextcloud.talk.R
|
import com.nextcloud.talk.R
|
||||||
import com.nextcloud.talk.controllers.ProfileController
|
import com.nextcloud.talk.controllers.ProfileController
|
||||||
|
import com.nextcloud.talk.databinding.DialogScopeBinding
|
||||||
import com.nextcloud.talk.models.json.userprofile.Scope
|
import com.nextcloud.talk.models.json.userprofile.Scope
|
||||||
|
|
||||||
class ScopeDialog(
|
class ScopeDialog(
|
||||||
@ -38,33 +40,36 @@ class ScopeDialog(
|
|||||||
private val position: Int
|
private val position: Int
|
||||||
) :
|
) :
|
||||||
BottomSheetDialog(con) {
|
BottomSheetDialog(con) {
|
||||||
|
|
||||||
|
private lateinit var dialogScopeBinding: DialogScopeBinding
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
val view = layoutInflater.inflate(R.layout.dialog_scope, null)
|
dialogScopeBinding = DialogScopeBinding.inflate(layoutInflater)
|
||||||
setContentView(view)
|
setContentView(dialogScopeBinding.root)
|
||||||
|
|
||||||
window?.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
|
window?.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
|
||||||
|
|
||||||
if (field == ProfileController.Field.DISPLAYNAME || field == ProfileController.Field.EMAIL) {
|
if (field == ProfileController.Field.DISPLAYNAME || field == ProfileController.Field.EMAIL) {
|
||||||
findViewById<LinearLayout>(R.id.scope_private)?.visibility = View.GONE
|
dialogScopeBinding.scopePrivate.visibility = View.GONE
|
||||||
}
|
}
|
||||||
|
|
||||||
findViewById<LinearLayout>(R.id.scope_private)?.setOnClickListener {
|
dialogScopeBinding.scopePrivate.setOnClickListener {
|
||||||
userInfoAdapter.updateScope(position, Scope.PRIVATE)
|
userInfoAdapter.updateScope(position, Scope.PRIVATE)
|
||||||
dismiss()
|
dismiss()
|
||||||
}
|
}
|
||||||
|
|
||||||
findViewById<LinearLayout>(R.id.scope_local)?.setOnClickListener {
|
dialogScopeBinding.scopeLocal.setOnClickListener {
|
||||||
userInfoAdapter.updateScope(position, Scope.LOCAL)
|
userInfoAdapter.updateScope(position, Scope.LOCAL)
|
||||||
dismiss()
|
dismiss()
|
||||||
}
|
}
|
||||||
|
|
||||||
findViewById<LinearLayout>(R.id.scope_federated)?.setOnClickListener {
|
dialogScopeBinding.scopeFederated.setOnClickListener {
|
||||||
userInfoAdapter.updateScope(position, Scope.FEDERATED)
|
userInfoAdapter.updateScope(position, Scope.FEDERATED)
|
||||||
dismiss()
|
dismiss()
|
||||||
}
|
}
|
||||||
|
|
||||||
findViewById<LinearLayout>(R.id.scope_published)?.setOnClickListener {
|
dialogScopeBinding.scopePublished.setOnClickListener {
|
||||||
userInfoAdapter.updateScope(position, Scope.PUBLISHED)
|
userInfoAdapter.updateScope(position, Scope.PUBLISHED)
|
||||||
dismiss()
|
dismiss()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user