mirror of
https://github.com/nextcloud/talk-android
synced 2025-07-11 06:44:09 +01:00
ReplaceController with Activity for Contacts
Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
parent
85dd7c3996
commit
e359db66ec
@ -214,6 +214,10 @@
|
|||||||
android:name=".conversation.info.ConversationInfoActivity"
|
android:name=".conversation.info.ConversationInfoActivity"
|
||||||
android:theme="@style/AppTheme" />
|
android:theme="@style/AppTheme" />
|
||||||
|
|
||||||
|
<activity
|
||||||
|
android:name=".contacts.ContactsActivity"
|
||||||
|
android:theme="@style/AppTheme" />
|
||||||
|
|
||||||
<receiver android:name=".receivers.PackageReplacedReceiver"
|
<receiver android:name=".receivers.PackageReplacedReceiver"
|
||||||
android:exported="false">
|
android:exported="false">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
|
@ -21,17 +21,17 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.nextcloud.talk.controllers
|
package com.nextcloud.talk.contacts
|
||||||
|
|
||||||
import android.app.SearchManager
|
import android.app.SearchManager
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.graphics.PorterDuff
|
import android.graphics.PorterDuff
|
||||||
|
import android.graphics.drawable.ColorDrawable
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.text.InputType
|
import android.text.InputType
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import android.view.Menu
|
import android.view.Menu
|
||||||
import android.view.MenuInflater
|
|
||||||
import android.view.MenuItem
|
import android.view.MenuItem
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.inputmethod.EditorInfo
|
import android.view.inputmethod.EditorInfo
|
||||||
@ -44,14 +44,12 @@ import androidx.work.WorkManager
|
|||||||
import autodagger.AutoInjector
|
import autodagger.AutoInjector
|
||||||
import com.bluelinelabs.logansquare.LoganSquare
|
import com.bluelinelabs.logansquare.LoganSquare
|
||||||
import com.nextcloud.talk.R
|
import com.nextcloud.talk.R
|
||||||
|
import com.nextcloud.talk.activities.BaseActivity
|
||||||
import com.nextcloud.talk.adapters.items.ContactItem
|
import com.nextcloud.talk.adapters.items.ContactItem
|
||||||
import com.nextcloud.talk.adapters.items.GenericTextHeaderItem
|
import com.nextcloud.talk.adapters.items.GenericTextHeaderItem
|
||||||
import com.nextcloud.talk.api.NcApi
|
import com.nextcloud.talk.api.NcApi
|
||||||
import com.nextcloud.talk.application.NextcloudTalkApplication
|
import com.nextcloud.talk.application.NextcloudTalkApplication
|
||||||
import com.nextcloud.talk.application.NextcloudTalkApplication.Companion.sharedApplication
|
|
||||||
import com.nextcloud.talk.controllers.base.BaseController
|
|
||||||
import com.nextcloud.talk.controllers.bottomsheet.ConversationOperationEnum
|
import com.nextcloud.talk.controllers.bottomsheet.ConversationOperationEnum
|
||||||
import com.nextcloud.talk.controllers.util.viewBinding
|
|
||||||
import com.nextcloud.talk.data.user.model.User
|
import com.nextcloud.talk.data.user.model.User
|
||||||
import com.nextcloud.talk.databinding.ControllerContactsRvBinding
|
import com.nextcloud.talk.databinding.ControllerContactsRvBinding
|
||||||
import com.nextcloud.talk.events.OpenConversationEvent
|
import com.nextcloud.talk.events.OpenConversationEvent
|
||||||
@ -66,9 +64,9 @@ import com.nextcloud.talk.models.json.participants.Participant
|
|||||||
import com.nextcloud.talk.ui.dialog.ContactsBottomDialog
|
import com.nextcloud.talk.ui.dialog.ContactsBottomDialog
|
||||||
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.bundle.BundleKeys
|
import com.nextcloud.talk.utils.bundle.BundleKeys
|
||||||
import com.nextcloud.talk.utils.database.user.CapabilitiesUtilNew
|
import com.nextcloud.talk.utils.database.user.CapabilitiesUtilNew
|
||||||
import com.nextcloud.talk.utils.remapchat.ConductorRemapping
|
|
||||||
import eu.davidea.flexibleadapter.FlexibleAdapter
|
import eu.davidea.flexibleadapter.FlexibleAdapter
|
||||||
import eu.davidea.flexibleadapter.SelectableAdapter
|
import eu.davidea.flexibleadapter.SelectableAdapter
|
||||||
import eu.davidea.flexibleadapter.common.SmoothScrollLinearLayoutManager
|
import eu.davidea.flexibleadapter.common.SmoothScrollLinearLayoutManager
|
||||||
@ -78,7 +76,6 @@ import io.reactivex.android.schedulers.AndroidSchedulers
|
|||||||
import io.reactivex.disposables.Disposable
|
import io.reactivex.disposables.Disposable
|
||||||
import io.reactivex.schedulers.Schedulers
|
import io.reactivex.schedulers.Schedulers
|
||||||
import okhttp3.ResponseBody
|
import okhttp3.ResponseBody
|
||||||
import org.greenrobot.eventbus.EventBus
|
|
||||||
import org.greenrobot.eventbus.Subscribe
|
import org.greenrobot.eventbus.Subscribe
|
||||||
import org.greenrobot.eventbus.ThreadMode
|
import org.greenrobot.eventbus.ThreadMode
|
||||||
import org.parceler.Parcels
|
import org.parceler.Parcels
|
||||||
@ -88,18 +85,15 @@ import java.util.Locale
|
|||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
@AutoInjector(NextcloudTalkApplication::class)
|
@AutoInjector(NextcloudTalkApplication::class)
|
||||||
class ContactsController(args: Bundle) :
|
class ContactsActivity :
|
||||||
BaseController(R.layout.controller_contacts_rv),
|
BaseActivity(),
|
||||||
SearchView.OnQueryTextListener,
|
SearchView.OnQueryTextListener,
|
||||||
FlexibleAdapter.OnItemClickListener {
|
FlexibleAdapter.OnItemClickListener {
|
||||||
private val binding: ControllerContactsRvBinding? by viewBinding(ControllerContactsRvBinding::bind)
|
private lateinit var binding: ControllerContactsRvBinding
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
lateinit var userManager: UserManager
|
lateinit var userManager: UserManager
|
||||||
|
|
||||||
@Inject
|
|
||||||
lateinit var eventBus: EventBus
|
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
lateinit var ncApi: NcApi
|
lateinit var ncApi: NcApi
|
||||||
|
|
||||||
@ -126,18 +120,29 @@ class ContactsController(args: Bundle) :
|
|||||||
private var conversationToken: String? = null
|
private var conversationToken: String? = null
|
||||||
private var contactsBottomDialog: ContactsBottomDialog? = null
|
private var contactsBottomDialog: ContactsBottomDialog? = null
|
||||||
|
|
||||||
init {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
setHasOptionsMenu(true)
|
super.onCreate(savedInstanceState)
|
||||||
sharedApplication!!.componentApplication.inject(this)
|
NextcloudTalkApplication.sharedApplication!!.componentApplication.inject(this)
|
||||||
|
|
||||||
|
binding = ControllerContactsRvBinding.inflate(layoutInflater)
|
||||||
|
setupActionBar()
|
||||||
|
setupSystemColors()
|
||||||
|
setContentView(binding.root)
|
||||||
|
|
||||||
|
if (savedInstanceState != null) {
|
||||||
|
if (adapter != null) {
|
||||||
|
adapter?.onRestoreInstanceState(savedInstanceState)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
existingParticipants = ArrayList()
|
existingParticipants = ArrayList()
|
||||||
if (args.containsKey(BundleKeys.KEY_NEW_CONVERSATION)) {
|
if (intent.hasExtra(BundleKeys.KEY_NEW_CONVERSATION)) {
|
||||||
isNewConversationView = true
|
isNewConversationView = true
|
||||||
} else if (args.containsKey(BundleKeys.KEY_ADD_PARTICIPANTS)) {
|
} else if (intent.hasExtra(BundleKeys.KEY_ADD_PARTICIPANTS)) {
|
||||||
isAddingParticipantsView = true
|
isAddingParticipantsView = true
|
||||||
conversationToken = args.getString(BundleKeys.KEY_TOKEN)
|
conversationToken = intent.getStringExtra(BundleKeys.KEY_TOKEN)
|
||||||
if (args.containsKey(BundleKeys.KEY_EXISTING_PARTICIPANTS)) {
|
if (intent.hasExtra(BundleKeys.KEY_EXISTING_PARTICIPANTS)) {
|
||||||
existingParticipants = args.getStringArrayList(BundleKeys.KEY_EXISTING_PARTICIPANTS)
|
existingParticipants = intent.getStringArrayListExtra(BundleKeys.KEY_EXISTING_PARTICIPANTS)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
selectedUserIds = HashSet()
|
selectedUserIds = HashSet()
|
||||||
@ -146,34 +151,31 @@ class ContactsController(args: Bundle) :
|
|||||||
selectedCircleIds = HashSet()
|
selectedCircleIds = HashSet()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onAttach(view: View) {
|
override fun onResume() {
|
||||||
super.onAttach(view)
|
super.onResume()
|
||||||
eventBus.register(this)
|
|
||||||
if (isNewConversationView) {
|
if (isNewConversationView) {
|
||||||
toggleConversationPrivacyLayout(!isPublicCall)
|
toggleConversationPrivacyLayout(!isPublicCall)
|
||||||
}
|
}
|
||||||
if (isAddingParticipantsView) {
|
if (isAddingParticipantsView) {
|
||||||
binding?.joinConversationViaLink?.joinConversationViaLinkRelativeLayout?.visibility = View.GONE
|
binding.joinConversationViaLink.joinConversationViaLinkRelativeLayout.visibility = View.GONE
|
||||||
binding?.conversationPrivacyToggle?.callHeaderLayout?.visibility = View.GONE
|
binding.conversationPrivacyToggle.callHeaderLayout.visibility = View.GONE
|
||||||
} else {
|
} else {
|
||||||
binding?.joinConversationViaLink?.joinConversationViaLinkRelativeLayout?.setOnClickListener {
|
binding.joinConversationViaLink.joinConversationViaLinkRelativeLayout.setOnClickListener {
|
||||||
joinConversationViaLink()
|
joinConversationViaLink()
|
||||||
}
|
}
|
||||||
binding?.conversationPrivacyToggle?.callHeaderLayout?.setOnClickListener {
|
binding.conversationPrivacyToggle.callHeaderLayout.setOnClickListener {
|
||||||
toggleCallHeader()
|
toggleCallHeader()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
override fun onViewBound(view: View) {
|
|
||||||
super.onViewBound(view)
|
|
||||||
currentUser = userManager.currentUser.blockingGet()
|
currentUser = userManager.currentUser.blockingGet()
|
||||||
if (currentUser != null) {
|
if (currentUser != null) {
|
||||||
credentials = ApiUtils.getCredentials(currentUser!!.username, currentUser!!.token)
|
credentials = ApiUtils.getCredentials(currentUser!!.username, currentUser!!.token)
|
||||||
}
|
}
|
||||||
if (adapter == null) {
|
if (adapter == null) {
|
||||||
contactItems = ArrayList<AbstractFlexibleItem<*>>()
|
contactItems = ArrayList<AbstractFlexibleItem<*>>()
|
||||||
adapter = FlexibleAdapter(contactItems, activity, false)
|
adapter = FlexibleAdapter(contactItems, this, false)
|
||||||
if (currentUser != null) {
|
if (currentUser != null) {
|
||||||
fetchData()
|
fetchData()
|
||||||
}
|
}
|
||||||
@ -182,6 +184,91 @@ class ContactsController(args: Bundle) :
|
|||||||
prepareViews()
|
prepareViews()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun setupActionBar() {
|
||||||
|
setSupportActionBar(binding.contactsToolbar)
|
||||||
|
binding.contactsToolbar.setNavigationOnClickListener {
|
||||||
|
onBackPressed()
|
||||||
|
}
|
||||||
|
supportActionBar?.setDisplayHomeAsUpEnabled(true)
|
||||||
|
supportActionBar?.setDisplayShowHomeEnabled(true)
|
||||||
|
supportActionBar?.setIcon(ColorDrawable(resources!!.getColor(android.R.color.transparent)))
|
||||||
|
supportActionBar?.title = when {
|
||||||
|
isAddingParticipantsView -> {
|
||||||
|
resources!!.getString(R.string.nc_add_participants)
|
||||||
|
}
|
||||||
|
isNewConversationView -> {
|
||||||
|
resources!!.getString(R.string.nc_select_participants)
|
||||||
|
}
|
||||||
|
else -> {
|
||||||
|
resources!!.getString(R.string.nc_app_product_name)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun setupSystemColors() {
|
||||||
|
DisplayUtils.applyColorToStatusBar(
|
||||||
|
this,
|
||||||
|
ResourcesCompat.getColor(
|
||||||
|
resources,
|
||||||
|
R.color.appbar,
|
||||||
|
null
|
||||||
|
)
|
||||||
|
)
|
||||||
|
DisplayUtils.applyColorToNavigationBar(
|
||||||
|
this.window,
|
||||||
|
ResourcesCompat.getColor(resources, R.color.bg_default, null)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onSaveInstanceState(bundle: Bundle) {
|
||||||
|
super.onSaveInstanceState(bundle)
|
||||||
|
adapter?.onSaveInstanceState(bundle)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onCreateOptionsMenu(menu: Menu): Boolean {
|
||||||
|
super.onCreateOptionsMenu(menu)
|
||||||
|
menuInflater.inflate(R.menu.menu_contacts, menu)
|
||||||
|
searchItem = menu.findItem(R.id.action_search)
|
||||||
|
doneMenuItem = menu.findItem(R.id.contacts_selection_done)
|
||||||
|
initSearchView()
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onPrepareOptionsMenu(menu: Menu): Boolean {
|
||||||
|
super.onPrepareOptionsMenu(menu)
|
||||||
|
if (searchItem != null) {
|
||||||
|
binding?.titleTextView?.let {
|
||||||
|
viewThemeUtils.platform.colorToolbarMenuIcon(
|
||||||
|
it.context,
|
||||||
|
searchItem!!
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
checkAndHandleDoneMenuItem()
|
||||||
|
if (adapter?.hasFilter() == true) {
|
||||||
|
searchItem!!.expandActionView()
|
||||||
|
searchView!!.setQuery(adapter!!.getFilter(String::class.java) as CharSequence, false)
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||||
|
return when (item.itemId) {
|
||||||
|
R.id.home -> {
|
||||||
|
finish()
|
||||||
|
true
|
||||||
|
}
|
||||||
|
R.id.contacts_selection_done -> {
|
||||||
|
selectionDone()
|
||||||
|
true
|
||||||
|
}
|
||||||
|
else -> {
|
||||||
|
super.onOptionsItemSelected(item)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun setupAdapter() {
|
private fun setupAdapter() {
|
||||||
adapter?.setNotifyChangeOfUnfilteredItems(true)?.mode = SelectableAdapter.Mode.MULTI
|
adapter?.setNotifyChangeOfUnfilteredItems(true)?.mode = SelectableAdapter.Mode.MULTI
|
||||||
adapter?.setStickyHeaderElevation(HEADER_ELEVATION)
|
adapter?.setStickyHeaderElevation(HEADER_ELEVATION)
|
||||||
@ -285,13 +372,16 @@ class ContactsController(args: Bundle) :
|
|||||||
BundleKeys.KEY_ACTIVE_CONVERSATION,
|
BundleKeys.KEY_ACTIVE_CONVERSATION,
|
||||||
Parcels.wrap(roomOverall.ocs!!.data!!)
|
Parcels.wrap(roomOverall.ocs!!.data!!)
|
||||||
)
|
)
|
||||||
ConductorRemapping.remapChatController(
|
|
||||||
router,
|
// TODO: fix to open chat (go via MainActivity and open RemapChat... if conductor is still used)
|
||||||
currentUser!!.id!!,
|
|
||||||
roomOverall.ocs!!.data!!.token!!,
|
// ConductorRemapping.remapChatController(
|
||||||
bundle,
|
// router,
|
||||||
true
|
// currentUser!!.id!!,
|
||||||
)
|
// roomOverall.ocs!!.data!!.token!!,
|
||||||
|
// bundle,
|
||||||
|
// true
|
||||||
|
// )
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onError(e: Throwable) {
|
override fun onError(e: Throwable) {
|
||||||
@ -330,12 +420,11 @@ class ContactsController(args: Bundle) :
|
|||||||
AddParticipantsToConversation::class.java
|
AddParticipantsToConversation::class.java
|
||||||
).setInputData(data.build()).build()
|
).setInputData(data.build()).build()
|
||||||
WorkManager.getInstance().enqueue(addParticipantsToConversationWorker)
|
WorkManager.getInstance().enqueue(addParticipantsToConversationWorker)
|
||||||
router.popCurrentController()
|
finish()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun initSearchView() {
|
private fun initSearchView() {
|
||||||
if (activity != null) {
|
val searchManager: SearchManager? = getSystemService(Context.SEARCH_SERVICE) as SearchManager?
|
||||||
val searchManager: SearchManager? = activity?.getSystemService(Context.SEARCH_SERVICE) as SearchManager?
|
|
||||||
if (searchItem != null) {
|
if (searchItem != null) {
|
||||||
searchView = MenuItemCompat.getActionView(searchItem) as SearchView
|
searchView = MenuItemCompat.getActionView(searchItem) as SearchView
|
||||||
viewThemeUtils.talk.themeSearchView(searchView!!)
|
viewThemeUtils.talk.themeSearchView(searchView!!)
|
||||||
@ -350,54 +439,11 @@ class ContactsController(args: Bundle) :
|
|||||||
searchView!!.imeOptions = imeOptions
|
searchView!!.imeOptions = imeOptions
|
||||||
searchView!!.queryHint = resources!!.getString(R.string.nc_search)
|
searchView!!.queryHint = resources!!.getString(R.string.nc_search)
|
||||||
if (searchManager != null) {
|
if (searchManager != null) {
|
||||||
searchView!!.setSearchableInfo(searchManager.getSearchableInfo(activity?.componentName))
|
searchView!!.setSearchableInfo(searchManager.getSearchableInfo(componentName))
|
||||||
}
|
}
|
||||||
searchView!!.setOnQueryTextListener(this)
|
searchView!!.setOnQueryTextListener(this)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
|
||||||
return when (item.itemId) {
|
|
||||||
R.id.home -> {
|
|
||||||
router.popCurrentController()
|
|
||||||
}
|
|
||||||
R.id.contacts_selection_done -> {
|
|
||||||
selectionDone()
|
|
||||||
true
|
|
||||||
}
|
|
||||||
else -> {
|
|
||||||
super.onOptionsItemSelected(item)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
|
|
||||||
super.onCreateOptionsMenu(menu, inflater)
|
|
||||||
inflater.inflate(R.menu.menu_contacts, menu)
|
|
||||||
searchItem = menu.findItem(R.id.action_search)
|
|
||||||
doneMenuItem = menu.findItem(R.id.contacts_selection_done)
|
|
||||||
initSearchView()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onPrepareOptionsMenu(menu: Menu) {
|
|
||||||
super.onPrepareOptionsMenu(menu)
|
|
||||||
|
|
||||||
if (searchItem != null) {
|
|
||||||
binding?.titleTextView?.let {
|
|
||||||
viewThemeUtils.platform.colorToolbarMenuIcon(
|
|
||||||
it.context,
|
|
||||||
searchItem!!
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
checkAndHandleDoneMenuItem()
|
|
||||||
if (adapter?.hasFilter() == true) {
|
|
||||||
searchItem!!.expandActionView()
|
|
||||||
searchView!!.setQuery(adapter!!.getFilter(String::class.java) as CharSequence, false)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun fetchData() {
|
private fun fetchData() {
|
||||||
dispose(null)
|
dispose(null)
|
||||||
@ -626,7 +672,7 @@ class ContactsController(args: Bundle) :
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun prepareViews() {
|
private fun prepareViews() {
|
||||||
layoutManager = SmoothScrollLinearLayoutManager(activity)
|
layoutManager = SmoothScrollLinearLayoutManager(this)
|
||||||
binding?.controllerGenericRv?.recyclerView?.layoutManager = layoutManager
|
binding?.controllerGenericRv?.recyclerView?.layoutManager = layoutManager
|
||||||
binding?.controllerGenericRv?.recyclerView?.setHasFixedSize(true)
|
binding?.controllerGenericRv?.recyclerView?.setHasFixedSize(true)
|
||||||
binding?.controllerGenericRv?.recyclerView?.adapter = adapter
|
binding?.controllerGenericRv?.recyclerView?.adapter = adapter
|
||||||
@ -671,18 +717,6 @@ class ContactsController(args: Bundle) :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onSaveViewState(view: View, outState: Bundle) {
|
|
||||||
adapter?.onSaveInstanceState(outState)
|
|
||||||
super.onSaveViewState(view, outState)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onRestoreViewState(view: View, savedViewState: Bundle) {
|
|
||||||
super.onRestoreViewState(view, savedViewState)
|
|
||||||
if (adapter != null) {
|
|
||||||
adapter?.onRestoreInstanceState(savedViewState)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onDestroy() {
|
override fun onDestroy() {
|
||||||
super.onDestroy()
|
super.onDestroy()
|
||||||
dispose(null)
|
dispose(null)
|
||||||
@ -716,43 +750,26 @@ class ContactsController(args: Bundle) :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override val title: String
|
|
||||||
get() = when {
|
|
||||||
isAddingParticipantsView -> {
|
|
||||||
resources!!.getString(R.string.nc_add_participants)
|
|
||||||
}
|
|
||||||
isNewConversationView -> {
|
|
||||||
resources!!.getString(R.string.nc_select_participants)
|
|
||||||
}
|
|
||||||
else -> {
|
|
||||||
resources!!.getString(R.string.nc_app_product_name)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun prepareAndShowBottomSheetWithBundle(bundle: Bundle) {
|
private fun prepareAndShowBottomSheetWithBundle(bundle: Bundle) {
|
||||||
// 11: create conversation-enter name for new conversation
|
// 11: create conversation-enter name for new conversation
|
||||||
// 10: get&join room when enter link
|
// 10: get&join room when enter link
|
||||||
contactsBottomDialog = ContactsBottomDialog(activity!!, bundle)
|
contactsBottomDialog = ContactsBottomDialog(this, bundle)
|
||||||
contactsBottomDialog?.show()
|
contactsBottomDialog?.show()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||||
fun onMessageEvent(openConversationEvent: OpenConversationEvent) {
|
fun onMessageEvent(openConversationEvent: OpenConversationEvent) {
|
||||||
ConductorRemapping.remapChatController(
|
// TODO: fix to open chat
|
||||||
router,
|
// ConductorRemapping.remapChatController(
|
||||||
currentUser!!.id!!,
|
// router,
|
||||||
openConversationEvent.conversation!!.token!!,
|
// currentUser!!.id!!,
|
||||||
openConversationEvent.bundle!!,
|
// openConversationEvent.conversation!!.token!!,
|
||||||
true
|
// openConversationEvent.bundle!!,
|
||||||
)
|
// true
|
||||||
|
// )
|
||||||
contactsBottomDialog?.dismiss()
|
contactsBottomDialog?.dismiss()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onDetach(view: View) {
|
|
||||||
super.onDetach(view)
|
|
||||||
eventBus.unregister(this)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onItemClick(view: View, position: Int): Boolean {
|
override fun onItemClick(view: View, position: Int): Boolean {
|
||||||
if (adapter?.getItem(position) is ContactItem) {
|
if (adapter?.getItem(position) is ContactItem) {
|
||||||
if (!isNewConversationView && !isAddingParticipantsView) {
|
if (!isNewConversationView && !isAddingParticipantsView) {
|
||||||
@ -812,7 +829,6 @@ class ContactsController(args: Bundle) :
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onNext(roomOverall: RoomOverall) {
|
override fun onNext(roomOverall: RoomOverall) {
|
||||||
if (activity != null) {
|
|
||||||
val bundle = Bundle()
|
val bundle = Bundle()
|
||||||
bundle.putParcelable(BundleKeys.KEY_USER_ENTITY, currentUser)
|
bundle.putParcelable(BundleKeys.KEY_USER_ENTITY, currentUser)
|
||||||
bundle.putString(BundleKeys.KEY_ROOM_TOKEN, roomOverall.ocs!!.data!!.token)
|
bundle.putString(BundleKeys.KEY_ROOM_TOKEN, roomOverall.ocs!!.data!!.token)
|
||||||
@ -821,14 +837,15 @@ class ContactsController(args: Bundle) :
|
|||||||
BundleKeys.KEY_ACTIVE_CONVERSATION,
|
BundleKeys.KEY_ACTIVE_CONVERSATION,
|
||||||
Parcels.wrap(roomOverall.ocs!!.data!!)
|
Parcels.wrap(roomOverall.ocs!!.data!!)
|
||||||
)
|
)
|
||||||
ConductorRemapping.remapChatController(
|
|
||||||
router,
|
// TODO: fix to open chat
|
||||||
currentUser!!.id!!,
|
// ConductorRemapping.remapChatController(
|
||||||
roomOverall.ocs!!.data!!.token!!,
|
// router,
|
||||||
bundle,
|
// currentUser!!.id!!,
|
||||||
true
|
// roomOverall.ocs!!.data!!.token!!,
|
||||||
)
|
// bundle,
|
||||||
}
|
// true
|
||||||
|
// )
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onError(e: Throwable) {
|
override fun onError(e: Throwable) {
|
@ -61,7 +61,6 @@ import coil.request.ImageRequest
|
|||||||
import coil.target.Target
|
import coil.target.Target
|
||||||
import coil.transform.CircleCropTransformation
|
import coil.transform.CircleCropTransformation
|
||||||
import com.bluelinelabs.conductor.RouterTransaction
|
import com.bluelinelabs.conductor.RouterTransaction
|
||||||
import com.bluelinelabs.conductor.changehandler.HorizontalChangeHandler
|
|
||||||
import com.bluelinelabs.conductor.changehandler.VerticalChangeHandler
|
import com.bluelinelabs.conductor.changehandler.VerticalChangeHandler
|
||||||
import com.google.android.material.button.MaterialButton
|
import com.google.android.material.button.MaterialButton
|
||||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||||
@ -76,6 +75,7 @@ import com.nextcloud.talk.adapters.items.MessagesTextHeaderItem
|
|||||||
import com.nextcloud.talk.api.NcApi
|
import com.nextcloud.talk.api.NcApi
|
||||||
import com.nextcloud.talk.application.NextcloudTalkApplication
|
import com.nextcloud.talk.application.NextcloudTalkApplication
|
||||||
import com.nextcloud.talk.application.NextcloudTalkApplication.Companion.sharedApplication
|
import com.nextcloud.talk.application.NextcloudTalkApplication.Companion.sharedApplication
|
||||||
|
import com.nextcloud.talk.contacts.ContactsActivity
|
||||||
import com.nextcloud.talk.controllers.base.BaseController
|
import com.nextcloud.talk.controllers.base.BaseController
|
||||||
import com.nextcloud.talk.controllers.util.viewBinding
|
import com.nextcloud.talk.controllers.util.viewBinding
|
||||||
import com.nextcloud.talk.data.user.model.User
|
import com.nextcloud.talk.data.user.model.User
|
||||||
@ -767,13 +767,9 @@ class ConversationsListController(bundle: Bundle) :
|
|||||||
conversation.type === Conversation.ConversationType.ROOM_TYPE_ONE_TO_ONE_CALL
|
conversation.type === Conversation.ConversationType.ROOM_TYPE_ONE_TO_ONE_CALL
|
||||||
|
|
||||||
private fun showNewConversationsScreen() {
|
private fun showNewConversationsScreen() {
|
||||||
val bundle = Bundle()
|
val intent = Intent(context, ContactsActivity::class.java)
|
||||||
bundle.putBoolean(KEY_NEW_CONVERSATION, true)
|
intent.putExtra(KEY_NEW_CONVERSATION, true)
|
||||||
router.pushController(
|
startActivity(intent)
|
||||||
RouterTransaction.with(ContactsController(bundle))
|
|
||||||
.pushChangeHandler(HorizontalChangeHandler())
|
|
||||||
.popChangeHandler(HorizontalChangeHandler())
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun dispose(disposable: Disposable?) {
|
private fun dispose(disposable: Disposable?) {
|
||||||
|
@ -97,7 +97,7 @@ import java.util.Locale
|
|||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
@AutoInjector(NextcloudTalkApplication::class)
|
@AutoInjector(NextcloudTalkApplication::class)
|
||||||
class ConversationInfoActivity() :
|
class ConversationInfoActivity :
|
||||||
BaseActivity(),
|
BaseActivity(),
|
||||||
FlexibleAdapter.OnItemClickListener {
|
FlexibleAdapter.OnItemClickListener {
|
||||||
|
|
||||||
@ -214,29 +214,6 @@ class ConversationInfoActivity() :
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
// override fun onCreateOptionsMenu(menu: Menu): Boolean {
|
|
||||||
// super.onCreateOptionsMenu(menu)
|
|
||||||
// menuInflater.inflate(R.menu.menu_locationpicker, menu)
|
|
||||||
// return true
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// override fun onPrepareOptionsMenu(menu: Menu): Boolean {
|
|
||||||
// super.onPrepareOptionsMenu(menu)
|
|
||||||
// // searchItem = menu.findItem(R.id.location_action_search)
|
|
||||||
// // initSearchView()
|
|
||||||
// return true
|
|
||||||
// }
|
|
||||||
|
|
||||||
// override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
|
||||||
// when (item.itemId) {
|
|
||||||
// android.R.id.home -> {
|
|
||||||
// finish()
|
|
||||||
// return true
|
|
||||||
// }
|
|
||||||
// else -> return super.onOptionsItemSelected(item)
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
private fun themeSwitchPreferences() {
|
private fun themeSwitchPreferences() {
|
||||||
binding.run {
|
binding.run {
|
||||||
listOf(
|
listOf(
|
||||||
|
@ -19,11 +19,29 @@
|
|||||||
-->
|
-->
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:animateLayoutChanges="true">
|
android:animateLayoutChanges="true">
|
||||||
|
|
||||||
|
<com.google.android.material.appbar.AppBarLayout
|
||||||
|
android:id="@+id/contacts_appbar"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
<com.google.android.material.appbar.MaterialToolbar
|
||||||
|
android:id="@+id/contacts_toolbar"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="?attr/actionBarSize"
|
||||||
|
android:background="@color/appbar"
|
||||||
|
android:theme="?attr/actionBarPopupTheme"
|
||||||
|
app:layout_scrollFlags="scroll|enterAlways"
|
||||||
|
app:navigationIconTint="@color/fontAppbar"
|
||||||
|
app:popupTheme="@style/appActionBarPopupMenu"
|
||||||
|
app:titleTextColor="@color/fontAppbar"
|
||||||
|
tools:title="@string/nc_app_product_name" />
|
||||||
|
</com.google.android.material.appbar.AppBarLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/loading_content"
|
android:id="@+id/loading_content"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
Loading…
Reference in New Issue
Block a user