Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
b494809
chore(gradle): Improve Gradle Configuration
jim-acn Oct 10, 2025
645481a
chore(gradle): Improve Gradle Configuration
jim-acn Oct 10, 2025
9807c02
chore(gradle): Resolve comment
jim-acn Oct 13, 2025
e77fdcd
chore(gradle): Resolve comment
jim-acn Oct 14, 2025
b9b51c8
paginate: local file list adapter
alperozturk96 Oct 1, 2025
aef2b4a
paginate: local file list adapter
alperozturk96 Oct 1, 2025
d3330a5
paginate: local file list adapter
alperozturk96 Oct 1, 2025
e766ef9
refactor: pagination
alperozturk96 Oct 6, 2025
af452ab
refactor: pagination
alperozturk96 Oct 6, 2025
a740cd6
fix: sorting order
alperozturk96 Oct 6, 2025
c3d5bed
add: file helper tests
alperozturk96 Oct 6, 2025
da8afa7
fix: code analytics
alperozturk96 Oct 6, 2025
a2698d2
fix: local file list duplicate item
alperozturk96 Oct 14, 2025
cfaf825
fix(l10n): Update translations from Transifex
nextcloud-bot Oct 15, 2025
71fcc18
fix: folder download
alperozturk96 Oct 14, 2025
d243293
rename to folder download worker
alperozturk96 Oct 14, 2025
da14449
rename to folder download worker
alperozturk96 Oct 15, 2025
5fdd7db
chore: upgrade android sdk 36
alperozturk96 Oct 6, 2025
a9b76a2
refactor: update back press gesture
alperozturk96 Oct 6, 2025
5628c7b
fix: custom back press navigation
alperozturk96 Oct 6, 2025
945fd35
fix: custom back press navigation
alperozturk96 Oct 6, 2025
0544556
fix: code analytics
alperozturk96 Oct 6, 2025
710bdaa
fix: code analytics
alperozturk96 Oct 6, 2025
d12d3a3
add: Unsupported platform APIs and unable to migrate due to outdated …
alperozturk96 Oct 7, 2025
7714335
fix: back press of fda
alperozturk96 Oct 15, 2025
4e277dd
fix: back press of fda
alperozturk96 Oct 15, 2025
1fa87b9
fix: make file upload worker long running task
alperozturk96 Oct 14, 2025
c3fde61
fix: save file for folder download
alperozturk96 Oct 15, 2025
60866b8
fix: save file for folder download
alperozturk96 Oct 15, 2025
6ad8a98
fix(l10n): Update translations from Transifex
nextcloud-bot Oct 16, 2025
f3b0b8a
fix: handle not modified and no content response
alperozturk96 Oct 15, 2025
e299a74
fix: handle not modified
alperozturk96 Oct 15, 2025
ed06c09
fix: git conflict
alperozturk96 Oct 15, 2025
0696850
fix: upload cancel
alperozturk96 Sep 29, 2025
00c8c7c
fix: upload cancel
alperozturk96 Sep 29, 2025
9b04f37
fix: upload cancel
alperozturk96 Sep 30, 2025
54056b9
fix: upload cancel
alperozturk96 Sep 30, 2025
523f822
fix: upload cancel
alperozturk96 Sep 30, 2025
ee69e98
fix: upload cancel
alperozturk96 Sep 30, 2025
506fbe9
fix: upload cancel
alperozturk96 Sep 30, 2025
0c7317b
fix: upload cancel
alperozturk96 Sep 30, 2025
b8c55bd
fix: upload cancel
alperozturk96 Sep 30, 2025
d0402ae
fix: git conflict
alperozturk96 Oct 15, 2025
60ffc50
chore: update lib
alperozturk96 Oct 15, 2025
fa4efa0
chore(gradle): Resolve conflict
jim-acn Oct 17, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: back press of fda
Signed-off-by: alperozturk <[email protected]>
  • Loading branch information
alperozturk96 authored and jim-acn committed Oct 17, 2025
commit 7714335ed11ff9e6208b67660753d5741f2ea2b9
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* Nextcloud - Android Client
*
* SPDX-FileCopyrightText: 2024 Alper Ozturk <[email protected]>
* SPDX-FileCopyrightText: 2025 Alper Ozturk <[email protected]>
* SPDX-License-Identifier: AGPL-3.0-or-later
*/

Expand All @@ -10,22 +10,10 @@ package com.nextcloud.utils.extensions
import android.content.Intent
import com.owncloud.android.MainApp
import com.owncloud.android.R
import com.owncloud.android.datamodel.OCFile
import com.owncloud.android.ui.activity.DrawerActivity
import com.owncloud.android.ui.activity.FileDisplayActivity

@Suppress("ReturnCount")
fun DrawerActivity.handleBackButtonEvent(currentDir: OCFile): Boolean {
if (DrawerActivity.menuItemId == R.id.nav_all_files && currentDir.isRootDirectory) {
moveTaskToBack(true)
return true
}

val isParentDirExists = (storageManager.getFileById(currentDir.parentId) != null)
if (isParentDirExists) {
return false
}

fun DrawerActivity.navigateToAllFiles() {
DrawerActivity.menuItemId = R.id.nav_all_files
setNavigationViewItemChecked()

Expand All @@ -38,6 +26,4 @@ fun DrawerActivity.handleBackButtonEvent(currentDir: OCFile): Boolean {
}.run {
startActivity(this)
}

return true
}
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ import com.nextcloud.utils.extensions.getParcelableArgument
import com.nextcloud.utils.extensions.isActive
import com.nextcloud.utils.extensions.lastFragment
import com.nextcloud.utils.extensions.logFileSize
import com.nextcloud.utils.extensions.navigateToAllFiles
import com.nextcloud.utils.fileNameValidator.FileNameValidator.checkFolderPath
import com.nextcloud.utils.view.FastScrollUtils
import com.owncloud.android.MainApp
Expand Down Expand Up @@ -1137,43 +1138,55 @@ class FileDisplayActivity :
}
}

private val isRootDirectory: Boolean
get() {
val currentDir = getCurrentDir()
return (currentDir == null || currentDir.parentId == FileDataStorageManager.ROOT_PARENT_ID.toLong())
}

/*
* BackPressed priority/hierarchy:
* 1. close search view if opened
* 2. close drawer if opened
* 3. if it is OCFileListFragment and it's in Root -> (finish Activity) or it's not Root -> (browse up)
* 4. otherwise pop up the fragment and sortGroup view visibility and call onBackPressedDispatcher
/**
* Sets up a custom back-press handler for this activity.
*
* This callback determines how the back button behaves based on the current UI state:
* - If the search view is open, it closes it.
* - If the navigation drawer is open, it closes it.
* - If the left fragment is an [OCFileListFragment]:
* - If in the root directory, it either navigates to "All Files" or finishes the activity.
* - Otherwise, it navigates one level up.
* - Otherwise, it pops the current fragment from the back stack.
*
* ### About `isEnabled`
* `isEnabled` is a property of [OnBackPressedCallback].
* When `isEnabled = false`, this callback is **temporarily disabled**,
* allowing the system or other callbacks to handle the back press instead.
*/
private fun handleBackPress() {
onBackPressedDispatcher.addCallback(
this,
object : OnBackPressedCallback(true) {
override fun handleOnBackPressed() {
if (isSearchOpen()) {
resetSearchAction()
return
}
when {
isSearchOpen() -> {
isEnabled = false
resetSearchAction()
}

if (isDrawerOpen) {
isEnabled = false
onBackPressedDispatcher.onBackPressed()
return
}
isDrawerOpen -> {
isEnabled = false
onBackPressedDispatcher.onBackPressed()
}

if ([email protected] is OCFileListFragment) {
if (isRoot(getCurrentDir())) {
finish()
} else {
browseUp(leftFragment as OCFileListFragment)
leftFragment is OCFileListFragment -> {
val fragment = leftFragment as OCFileListFragment
if (isRoot(getCurrentDir())) {
if (fragment.shouldNavigateBackToAllFiles()) {
navigateToAllFiles()
} else {
finish()
}
} else {
browseUp(fragment)
}
}

else -> {
isEnabled = false
popBack()
}
} else {
popBack()
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import android.os.Handler
import android.os.Looper
import android.os.Parcelable
import android.util.DisplayMetrics
import android.view.KeyEvent
import android.view.LayoutInflater
import android.view.Menu
import android.view.MenuInflater
Expand Down Expand Up @@ -57,15 +56,13 @@ import com.nextcloud.client.di.Injectable
import com.nextcloud.client.preferences.AppPreferences
import com.nextcloud.client.preferences.AppPreferencesImpl
import com.nextcloud.utils.extensions.getTypedActivity
import com.nextcloud.utils.extensions.handleBackButtonEvent
import com.owncloud.android.MainApp
import com.owncloud.android.R
import com.owncloud.android.databinding.ListFragmentBinding
import com.owncloud.android.lib.common.utils.Log_OC
import com.owncloud.android.lib.resources.files.SearchRemoteOperation
import com.owncloud.android.lib.resources.status.OwnCloudVersion
import com.owncloud.android.ui.EmptyRecyclerView
import com.owncloud.android.ui.activity.FileActivity
import com.owncloud.android.ui.activity.FileDisplayActivity
import com.owncloud.android.ui.activity.FolderPickerActivity
import com.owncloud.android.ui.activity.OnEnforceableRefreshListener
Expand Down Expand Up @@ -767,19 +764,6 @@ open class ExtendedListFragment :
}
}

protected fun setupBackButtonRedirectToAllFiles() {
view?.isFocusableInTouchMode = true
view?.requestFocus()
view?.setOnKeyListener { _: View, keyCode: Int, event: KeyEvent ->
if (event.action == KeyEvent.ACTION_UP && keyCode == KeyEvent.KEYCODE_BACK) {
val fda = getTypedActivity(FileActivity::class.java)
val currentDir = fda?.currentDir ?: return@setOnKeyListener false
return@setOnKeyListener fda.handleBackButtonEvent(currentDir)
}
false
}
}

private data class EmptyListData(val headline: Int, val message: Int, val icon: Int?, val tintIcon: Boolean)

companion object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,12 +234,6 @@ public void onResume() {
}
}

@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
setupBackButtonRedirectToAllFiles();
}

@Override
public void onMessageEvent(ChangeMenuEvent changeMenuEvent) {
super.onMessageEvent(changeMenuEvent);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,12 +277,6 @@ public void onResume() {
super.onResume();
}

@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
setupBackButtonRedirectToAllFiles();
}

@Override
public void onDestroyView() {
super.onDestroyView();
Expand Down Expand Up @@ -2325,4 +2319,15 @@ public boolean isEmpty() {
public SearchEvent getSearchEvent() {
return searchEvent;
}

public boolean isSearchEventFavorite() {
if (searchEvent == null) {
return false;
}
return searchEvent.getSearchType() == SearchRemoteOperation.SearchType.FAVORITE_SEARCH;
}

public boolean shouldNavigateBackToAllFiles() {
return ((this instanceof GalleryFragment) || isSearchEventFavorite() || DrawerActivity.menuItemId == R.id.nav_favorites);
}
}
Empty file added build.gradle
Empty file.
8 changes: 8 additions & 0 deletions gradle/verification-metadata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17188,6 +17188,14 @@
<sha256 value="f678808af32489394b4e0c41d9554087ee04151370aff34291a9343780d7a0e0" origin="Generated by Gradle" reason="Artifact is not signed"/>
</artifact>
</component>
<component group="com.github.nextcloud" name="android-library" version="9b7c9434bf9002a63d5ac911b89b4abf014fabfd">
<artifact name="android-library-9b7c9434bf9002a63d5ac911b89b4abf014fabfd.aar">
<sha256 value="395f5ffec8a46cfca3158c1fee49ed6f643fe7eae759185b0e134765066772e1" origin="Generated by Gradle" reason="Artifact is not signed"/>
</artifact>
<artifact name="android-library-9b7c9434bf9002a63d5ac911b89b4abf014fabfd.module">
<sha256 value="f8978720f1a573657d8571bfdbc60fd5976bc6911ea41dec422ef63ef8421b46" origin="Generated by Gradle" reason="Artifact is not signed"/>
</artifact>
</component>
<component group="com.github.nextcloud" name="android-library" version="9e3c0046d242d8395855772d1105cb0b9fdd9f1f">
<artifact name="android-library-9e3c0046d242d8395855772d1105cb0b9fdd9f1f.aar">
<sha256 value="8f6337f2494d67ae9732c57850172588b9bf87f4f2ca4aa74e5f8f79f1192928" origin="Generated by Gradle" reason="Artifact is not signed"/>
Expand Down