mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-19 11:39:42 +01:00
Made suggested changes in FullScreenImageActivity.kt, ConversationsListActivity.kt and in some files Signed-off-by: Ezhil Shanmugham ezhil56x.contact@gmail.com
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
parent
d4a4472968
commit
64fa8e830b
@ -4,6 +4,8 @@
|
|||||||
* @author Marcel Hibbe
|
* @author Marcel Hibbe
|
||||||
* @author Dariusz Olszewski
|
* @author Dariusz Olszewski
|
||||||
* @author Andy Scherzinger
|
* @author Andy Scherzinger
|
||||||
|
* @author Ezhil Shanmugham
|
||||||
|
* Copyright (C) 2023 Ezhil Shanmugham <ezhil56x.contact@gmail.com>
|
||||||
* Copyright (C) 2021 Andy Scherzinger <info@andy-scherzinger.de>
|
* Copyright (C) 2021 Andy Scherzinger <info@andy-scherzinger.de>
|
||||||
* Copyright (C) 2021 Marcel Hibbe <dev@mhibbe.de>
|
* Copyright (C) 2021 Marcel Hibbe <dev@mhibbe.de>
|
||||||
* Copyright (C) 2021 Dariusz Olszewski
|
* Copyright (C) 2021 Dariusz Olszewski
|
||||||
@ -45,12 +47,6 @@ import java.io.File
|
|||||||
class FullScreenImageActivity : AppCompatActivity() {
|
class FullScreenImageActivity : AppCompatActivity() {
|
||||||
lateinit var binding: ActivityFullScreenImageBinding
|
lateinit var binding: ActivityFullScreenImageBinding
|
||||||
|
|
||||||
private val callback = object : OnBackPressedCallback(true) {
|
|
||||||
override fun handleOnBackPressed() {
|
|
||||||
finish()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private lateinit var path: String
|
private lateinit var path: String
|
||||||
private var showFullscreen = false
|
private var showFullscreen = false
|
||||||
|
|
||||||
@ -61,8 +57,7 @@ class FullScreenImageActivity : AppCompatActivity() {
|
|||||||
|
|
||||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||||
return if (item.itemId == android.R.id.home) {
|
return if (item.itemId == android.R.id.home) {
|
||||||
// onBackPressed()
|
onBackPressedDispatcher.onBackPressed()
|
||||||
onBackPressedDispatcher.addCallback(this, callback)
|
|
||||||
true
|
true
|
||||||
} else if (item.itemId == R.id.share) {
|
} else if (item.itemId == R.id.share) {
|
||||||
val shareUri = FileProvider.getUriForFile(
|
val shareUri = FileProvider.getUriForFile(
|
||||||
@ -125,6 +120,13 @@ class FullScreenImageActivity : AppCompatActivity() {
|
|||||||
binding.photoView.visibility = View.VISIBLE
|
binding.photoView.visibility = View.VISIBLE
|
||||||
displayImage(path)
|
displayImage(path)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val callback = object : OnBackPressedCallback(true) {
|
||||||
|
override fun handleOnBackPressed() {
|
||||||
|
finish()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
onBackPressedDispatcher.addCallback(this, callback)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun displayImage(path: String) {
|
private fun displayImage(path: String) {
|
||||||
|
@ -3,8 +3,10 @@
|
|||||||
*
|
*
|
||||||
* @author Marcel Hibbe
|
* @author Marcel Hibbe
|
||||||
* @author Andy Scherzinger
|
* @author Andy Scherzinger
|
||||||
|
* @author Ezhil Shanmugham
|
||||||
* Copyright (C) 2021 Andy Scherzinger <info@andy-scherzinger.de>
|
* Copyright (C) 2021 Andy Scherzinger <info@andy-scherzinger.de>
|
||||||
* Copyright (C) 2021 Marcel Hibbe <dev@mhibbe.de>
|
* Copyright (C) 2021 Marcel Hibbe <dev@mhibbe.de>
|
||||||
|
* Copyright (C) 2023 Ezhil Shanmugham <ezhil56x.contact@gmail.com>
|
||||||
*
|
*
|
||||||
* 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
|
||||||
@ -47,12 +49,6 @@ import java.io.File
|
|||||||
class FullScreenMediaActivity : AppCompatActivity(), Player.Listener {
|
class FullScreenMediaActivity : AppCompatActivity(), Player.Listener {
|
||||||
lateinit var binding: ActivityFullScreenMediaBinding
|
lateinit var binding: ActivityFullScreenMediaBinding
|
||||||
|
|
||||||
private val callback = object : OnBackPressedCallback(true) {
|
|
||||||
override fun handleOnBackPressed() {
|
|
||||||
finish()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private lateinit var path: String
|
private lateinit var path: String
|
||||||
private lateinit var player: SimpleExoPlayer
|
private lateinit var player: SimpleExoPlayer
|
||||||
|
|
||||||
@ -63,8 +59,7 @@ class FullScreenMediaActivity : AppCompatActivity(), Player.Listener {
|
|||||||
|
|
||||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||||
return if (item.itemId == android.R.id.home) {
|
return if (item.itemId == android.R.id.home) {
|
||||||
// onBackPressed()
|
onBackPressedDispatcher.onBackPressed()
|
||||||
onBackPressedDispatcher.addCallback(this, callback)
|
|
||||||
true
|
true
|
||||||
} else if (item.itemId == R.id.share) {
|
} else if (item.itemId == R.id.share) {
|
||||||
val shareUri = FileProvider.getUriForFile(
|
val shareUri = FileProvider.getUriForFile(
|
||||||
@ -120,6 +115,13 @@ class FullScreenMediaActivity : AppCompatActivity(), Player.Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
val callback = object : OnBackPressedCallback(true) {
|
||||||
|
override fun handleOnBackPressed() {
|
||||||
|
finish()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
onBackPressedDispatcher.addCallback(this, callback)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onStart() {
|
override fun onStart() {
|
||||||
|
@ -3,8 +3,10 @@
|
|||||||
*
|
*
|
||||||
* @author Marcel Hibbe
|
* @author Marcel Hibbe
|
||||||
* @author Andy Scherzinger
|
* @author Andy Scherzinger
|
||||||
|
* @author Ezhil Shanmugham
|
||||||
* Copyright (C) 2021 Andy Scherzinger <info@andy-scherzinger.de>
|
* Copyright (C) 2021 Andy Scherzinger <info@andy-scherzinger.de>
|
||||||
* Copyright (C) 2021 Marcel Hibbe <dev@mhibbe.de>
|
* Copyright (C) 2021 Marcel Hibbe <dev@mhibbe.de>
|
||||||
|
* Copyright (C) 2023 Ezhil Shanmugham <ezhil56x.contact@gmail.com>
|
||||||
*
|
*
|
||||||
* 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
|
||||||
@ -46,12 +48,6 @@ import javax.inject.Inject
|
|||||||
class FullScreenTextViewerActivity : AppCompatActivity() {
|
class FullScreenTextViewerActivity : AppCompatActivity() {
|
||||||
lateinit var binding: ActivityFullScreenTextBinding
|
lateinit var binding: ActivityFullScreenTextBinding
|
||||||
|
|
||||||
private val callback = object : OnBackPressedCallback(true) {
|
|
||||||
override fun handleOnBackPressed() {
|
|
||||||
finish()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
lateinit var viewThemeUtils: ViewThemeUtils
|
lateinit var viewThemeUtils: ViewThemeUtils
|
||||||
|
|
||||||
@ -64,8 +60,7 @@ class FullScreenTextViewerActivity : AppCompatActivity() {
|
|||||||
|
|
||||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||||
return if (item.itemId == android.R.id.home) {
|
return if (item.itemId == android.R.id.home) {
|
||||||
// onBackPressed()
|
onBackPressedDispatcher.onBackPressed()
|
||||||
onBackPressedDispatcher.addCallback(this, callback)
|
|
||||||
true
|
true
|
||||||
} else if (item.itemId == R.id.share) {
|
} else if (item.itemId == R.id.share) {
|
||||||
val shareUri = FileProvider.getUriForFile(
|
val shareUri = FileProvider.getUriForFile(
|
||||||
@ -122,6 +117,13 @@ class FullScreenTextViewerActivity : AppCompatActivity() {
|
|||||||
ResourcesCompat.getColor(resources, R.color.bg_default, null)
|
ResourcesCompat.getColor(resources, R.color.bg_default, null)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val callback = object : OnBackPressedCallback(true) {
|
||||||
|
override fun handleOnBackPressed() {
|
||||||
|
finish()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
onBackPressedDispatcher.addCallback(this, callback)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun readFile(fileName: String) = File(fileName).inputStream().readBytes().toString(Charsets.UTF_8)
|
private fun readFile(fileName: String) = File(fileName).inputStream().readBytes().toString(Charsets.UTF_8)
|
||||||
|
@ -4,9 +4,11 @@
|
|||||||
* @author Mario Danic
|
* @author Mario Danic
|
||||||
* @author Andy Scherzinger
|
* @author Andy Scherzinger
|
||||||
* @author Marcel Hibbe
|
* @author Marcel Hibbe
|
||||||
|
* @author Ezhil Shanmugham
|
||||||
* Copyright (C) 2023 Marcel Hibbe <dev@mhibbe.de>
|
* Copyright (C) 2023 Marcel Hibbe <dev@mhibbe.de>
|
||||||
* Copyright (C) 2021 Andy Scherzinger (infoi@andy-scherzinger.de)
|
* Copyright (C) 2021 Andy Scherzinger (infoi@andy-scherzinger.de)
|
||||||
* Copyright (C) 2017 Mario Danic (mario@lovelyhq.com)
|
* Copyright (C) 2017 Mario Danic (mario@lovelyhq.com)
|
||||||
|
* Copyright (C) 2023 Ezhil Shanmugham <ezhil56x.contact@gmail.com>
|
||||||
*
|
*
|
||||||
* 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
|
||||||
@ -75,12 +77,6 @@ import javax.inject.Inject
|
|||||||
class MainActivity : BaseActivity(), ActionBarProvider {
|
class MainActivity : BaseActivity(), ActionBarProvider {
|
||||||
lateinit var binding: ActivityMainBinding
|
lateinit var binding: ActivityMainBinding
|
||||||
|
|
||||||
private val callback = object : OnBackPressedCallback(true) {
|
|
||||||
override fun handleOnBackPressed() {
|
|
||||||
finish()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
lateinit var ncApi: NcApi
|
lateinit var ncApi: NcApi
|
||||||
|
|
||||||
@ -143,6 +139,13 @@ class MainActivity : BaseActivity(), ActionBarProvider {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val callback = object : OnBackPressedCallback(true) {
|
||||||
|
override fun handleOnBackPressed() {
|
||||||
|
finish()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
onBackPressedDispatcher.addCallback(this, callback)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun lockScreenIfConditionsApply() {
|
fun lockScreenIfConditionsApply() {
|
||||||
@ -360,10 +363,9 @@ class MainActivity : BaseActivity(), ActionBarProvider {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onBackPressed() {
|
fun handleOnBackPressed() {
|
||||||
if (!router!!.handleBack()) {
|
if (!router!!.handleBack()) {
|
||||||
// super.onBackPressed()
|
onBackPressedDispatcher.onBackPressed()
|
||||||
onBackPressedDispatcher.addCallback(this, callback)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,10 +5,12 @@
|
|||||||
* @author Marcel Hibbe
|
* @author Marcel Hibbe
|
||||||
* @author Andy Scherzinger
|
* @author Andy Scherzinger
|
||||||
* @author Tim Krüger
|
* @author Tim Krüger
|
||||||
|
* @author Ezhil Shanmugham
|
||||||
* Copyright (C) 2021-2022 Tim Krüger <t@timkrueger.me>
|
* Copyright (C) 2021-2022 Tim Krüger <t@timkrueger.me>
|
||||||
* Copyright (C) 2021 Andy Scherzinger <info@andy-scherzinger.de>
|
* Copyright (C) 2021 Andy Scherzinger <info@andy-scherzinger.de>
|
||||||
* Copyright (C) 2021-2022 Marcel Hibbe <dev@mhibbe.de>
|
* Copyright (C) 2021-2022 Marcel Hibbe <dev@mhibbe.de>
|
||||||
* Copyright (C) 2017-2019 Mario Danic <mario@lovelyhq.com>
|
* Copyright (C) 2017-2019 Mario Danic <mario@lovelyhq.com>
|
||||||
|
* Copyright (C) 2023 Ezhil Shanmugham <ezhil56x.contact@gmail.com>
|
||||||
*
|
*
|
||||||
* 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
|
||||||
@ -612,7 +614,7 @@ class ChatActivity :
|
|||||||
private fun setupActionBar() {
|
private fun setupActionBar() {
|
||||||
setSupportActionBar(binding.chatToolbar)
|
setSupportActionBar(binding.chatToolbar)
|
||||||
binding.chatToolbar.setNavigationOnClickListener {
|
binding.chatToolbar.setNavigationOnClickListener {
|
||||||
onBackPressed()
|
handleOnBackPressed()
|
||||||
}
|
}
|
||||||
supportActionBar?.setDisplayHomeAsUpEnabled(true)
|
supportActionBar?.setDisplayHomeAsUpEnabled(true)
|
||||||
supportActionBar?.setDisplayShowHomeEnabled(true)
|
supportActionBar?.setDisplayShowHomeEnabled(true)
|
||||||
@ -621,7 +623,7 @@ class ChatActivity :
|
|||||||
viewThemeUtils.material.themeToolbar(binding.chatToolbar)
|
viewThemeUtils.material.themeToolbar(binding.chatToolbar)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onBackPressed() {
|
fun handleOnBackPressed() {
|
||||||
val intent = Intent(this, ConversationsListActivity::class.java)
|
val intent = Intent(this, ConversationsListActivity::class.java)
|
||||||
intent.putExtras(Bundle())
|
intent.putExtras(Bundle())
|
||||||
startActivity(intent)
|
startActivity(intent)
|
||||||
|
@ -146,12 +146,6 @@ class ConversationsListActivity :
|
|||||||
|
|
||||||
private lateinit var binding: ControllerConversationsRvBinding
|
private lateinit var binding: ControllerConversationsRvBinding
|
||||||
|
|
||||||
private val callback = object : OnBackPressedCallback(true) {
|
|
||||||
override fun handleOnBackPressed() {
|
|
||||||
finish()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
lateinit var userManager: UserManager
|
lateinit var userManager: UserManager
|
||||||
|
|
||||||
@ -195,6 +189,8 @@ class ConversationsListActivity :
|
|||||||
private var searchHelper: MessageSearchHelper? = null
|
private var searchHelper: MessageSearchHelper? = null
|
||||||
private var searchViewDisposable: Disposable? = null
|
private var searchViewDisposable: Disposable? = null
|
||||||
|
|
||||||
|
private lateinit var callback: OnBackPressedCallback
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
NextcloudTalkApplication.sharedApplication!!.componentApplication.inject(this)
|
NextcloudTalkApplication.sharedApplication!!.componentApplication.inject(this)
|
||||||
@ -207,6 +203,13 @@ class ConversationsListActivity :
|
|||||||
viewThemeUtils.material.themeSearchBarText(binding.searchText)
|
viewThemeUtils.material.themeSearchBarText(binding.searchText)
|
||||||
|
|
||||||
forwardMessage = intent.getBooleanExtra(KEY_FORWARD_MSG_FLAG, false)
|
forwardMessage = intent.getBooleanExtra(KEY_FORWARD_MSG_FLAG, false)
|
||||||
|
|
||||||
|
callback = object : OnBackPressedCallback(true) {
|
||||||
|
override fun handleOnBackPressed() {
|
||||||
|
finish()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
onBackPressedDispatcher.addCallback(this, callback)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
@ -1367,22 +1370,6 @@ class ConversationsListActivity :
|
|||||||
showErrorDialog()
|
showErrorDialog()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onBackPressed() {
|
|
||||||
val callback = object : OnBackPressedCallback(true) {
|
|
||||||
override fun handleOnBackPressed() {
|
|
||||||
finish()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
onBackPressedDispatcher.addCallback(this, callback)
|
|
||||||
|
|
||||||
// TODO: replace this when conductor is removed. For now it avoids loading the MainActivity which has no UI.
|
|
||||||
callback.isEnabled = true
|
|
||||||
callback.handleOnBackPressed()
|
|
||||||
|
|
||||||
finishAffinity()
|
|
||||||
}
|
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
const val TAG = "ConvListController"
|
const val TAG = "ConvListController"
|
||||||
const val UNREAD_BUBBLE_DELAY = 2500
|
const val UNREAD_BUBBLE_DELAY = 2500
|
||||||
|
@ -2,7 +2,9 @@
|
|||||||
* Nextcloud Talk application
|
* Nextcloud Talk application
|
||||||
*
|
*
|
||||||
* @author Marcel Hibbe
|
* @author Marcel Hibbe
|
||||||
|
* @author Ezhil Shanmugham
|
||||||
* Copyright (C) 2021 Marcel Hibbe <dev@mhibbe.de>
|
* Copyright (C) 2021 Marcel Hibbe <dev@mhibbe.de>
|
||||||
|
* Copyright (C) 2023 Ezhil Shanmugham <ezhil56x.contact@gmail.com>
|
||||||
*
|
*
|
||||||
* 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
|
||||||
@ -175,7 +177,7 @@ class LocationPickerActivity :
|
|||||||
private fun setupActionBar() {
|
private fun setupActionBar() {
|
||||||
setSupportActionBar(binding.locationPickerToolbar)
|
setSupportActionBar(binding.locationPickerToolbar)
|
||||||
binding.locationPickerToolbar.setNavigationOnClickListener {
|
binding.locationPickerToolbar.setNavigationOnClickListener {
|
||||||
onBackPressed()
|
handleOnBackPressed()
|
||||||
}
|
}
|
||||||
supportActionBar?.setDisplayHomeAsUpEnabled(true)
|
supportActionBar?.setDisplayHomeAsUpEnabled(true)
|
||||||
supportActionBar?.setDisplayShowHomeEnabled(true)
|
supportActionBar?.setDisplayShowHomeEnabled(true)
|
||||||
@ -572,9 +574,9 @@ class LocationPickerActivity :
|
|||||||
// empty
|
// empty
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onBackPressed() {
|
fun handleOnBackPressed() {
|
||||||
setResult(Activity.RESULT_CANCELED)
|
setResult(Activity.RESULT_CANCELED)
|
||||||
finish()
|
finishAffinity()
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
@ -2,8 +2,10 @@
|
|||||||
* Nextcloud Talk application
|
* Nextcloud Talk application
|
||||||
*
|
*
|
||||||
* @author Álvaro Brey
|
* @author Álvaro Brey
|
||||||
|
* @author Ezhil Shanmugham
|
||||||
* Copyright (C) 2022 Álvaro Brey
|
* Copyright (C) 2022 Álvaro Brey
|
||||||
* Copyright (C) 2022 Nextcloud GmbH
|
* Copyright (C) 2022 Nextcloud GmbH
|
||||||
|
* Copyright (C) 2023 Ezhil Shanmugham <ezhil56x.contact@gmail.com>
|
||||||
*
|
*
|
||||||
* 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
|
||||||
@ -210,7 +212,7 @@ class MessageSearchActivity : BaseActivity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onMenuItemActionCollapse(item: MenuItem): Boolean {
|
override fun onMenuItemActionCollapse(item: MenuItem): Boolean {
|
||||||
onBackPressed()
|
handleOnBackPressed()
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -236,15 +238,15 @@ class MessageSearchActivity : BaseActivity() {
|
|||||||
.subscribe { newText -> viewModel.onQueryTextChange(newText) }
|
.subscribe { newText -> viewModel.onQueryTextChange(newText) }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onBackPressed() {
|
fun handleOnBackPressed() {
|
||||||
setResult(Activity.RESULT_CANCELED)
|
setResult(Activity.RESULT_CANCELED)
|
||||||
finish()
|
finishAffinity()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||||
return when (item.itemId) {
|
return when (item.itemId) {
|
||||||
android.R.id.home -> {
|
android.R.id.home -> {
|
||||||
onBackPressed()
|
handleOnBackPressed()
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
else -> super.onOptionsItemSelected(item)
|
else -> super.onOptionsItemSelected(item)
|
||||||
|
@ -194,7 +194,7 @@ class RemoteFileBrowserActivity : AppCompatActivity(), SelectionInterface, Swipe
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onBackPressed() {
|
fun handleOnBackPressed() {
|
||||||
val callback = object : OnBackPressedCallback(true) {
|
val callback = object : OnBackPressedCallback(true) {
|
||||||
override fun handleOnBackPressed() {
|
override fun handleOnBackPressed() {
|
||||||
setResult(Activity.RESULT_CANCELED)
|
setResult(Activity.RESULT_CANCELED)
|
||||||
@ -223,7 +223,7 @@ class RemoteFileBrowserActivity : AppCompatActivity(), SelectionInterface, Swipe
|
|||||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||||
return when (item.itemId) {
|
return when (item.itemId) {
|
||||||
android.R.id.home -> {
|
android.R.id.home -> {
|
||||||
onBackPressed()
|
handleOnBackPressed()
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
R.id.files_selection_done -> {
|
R.id.files_selection_done -> {
|
||||||
|
@ -56,12 +56,6 @@ import javax.inject.Inject
|
|||||||
@AutoInjector(NextcloudTalkApplication::class)
|
@AutoInjector(NextcloudTalkApplication::class)
|
||||||
class SharedItemsActivity : AppCompatActivity() {
|
class SharedItemsActivity : AppCompatActivity() {
|
||||||
|
|
||||||
private val callback = object : OnBackPressedCallback(true) {
|
|
||||||
override fun handleOnBackPressed() {
|
|
||||||
finish()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
lateinit var viewModelFactory: ViewModelProvider.Factory
|
lateinit var viewModelFactory: ViewModelProvider.Factory
|
||||||
|
|
||||||
@ -112,6 +106,13 @@ class SharedItemsActivity : AppCompatActivity() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
viewModel.initialize(user, roomToken)
|
viewModel.initialize(user, roomToken)
|
||||||
|
|
||||||
|
val callback = object : OnBackPressedCallback(true) {
|
||||||
|
override fun handleOnBackPressed() {
|
||||||
|
finish()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
onBackPressedDispatcher.addCallback(this, callback)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun handleModelChange(
|
private fun handleModelChange(
|
||||||
@ -255,7 +256,7 @@ class SharedItemsActivity : AppCompatActivity() {
|
|||||||
|
|
||||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||||
return if (item.itemId == android.R.id.home) {
|
return if (item.itemId == android.R.id.home) {
|
||||||
onBackPressedDispatcher.addCallback(this, callback)
|
onBackPressedDispatcher.onBackPressed()
|
||||||
true
|
true
|
||||||
} else {
|
} else {
|
||||||
super.onOptionsItemSelected(item)
|
super.onOptionsItemSelected(item)
|
||||||
|
Loading…
Reference in New Issue
Block a user