mirror of
https://github.com/nextcloud/talk-android
synced 2025-03-06 06:15:12 +00:00
move refresh action to swipe action
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
parent
d785d3aa21
commit
1b29038dbd
@ -30,6 +30,7 @@ import android.view.MenuItem
|
||||
import android.view.View
|
||||
import androidx.fragment.app.DialogFragment
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||
import autodagger.AutoInjector
|
||||
import com.nextcloud.talk.R
|
||||
import com.nextcloud.talk.activities.MainActivity
|
||||
@ -73,6 +74,7 @@ abstract class BrowserController(args: Bundle) :
|
||||
),
|
||||
ListingInterface,
|
||||
FlexibleAdapter.OnItemClickListener,
|
||||
SwipeRefreshLayout.OnRefreshListener,
|
||||
SelectionInterface {
|
||||
|
||||
private val binding: ControllerBrowserBinding by viewBinding(ControllerBrowserBinding::bind)
|
||||
@ -136,7 +138,6 @@ abstract class BrowserController(args: Bundle) :
|
||||
override fun onAttach(view: View) {
|
||||
super.onAttach(view)
|
||||
|
||||
binding.bottomNavigation.menu.findItem(R.id.action_refresh)?.setOnMenuItemClickListener { refreshCurrentPath() }
|
||||
binding.pathNavigation.menu.findItem(R.id.action_back)?.setOnMenuItemClickListener { goBack() }
|
||||
binding.sortButton.setOnClickListener { changeSorting() }
|
||||
|
||||
@ -147,6 +148,10 @@ abstract class BrowserController(args: Bundle) :
|
||||
refreshCurrentPath()
|
||||
}
|
||||
|
||||
override fun onRefresh() {
|
||||
refreshCurrentPath()
|
||||
}
|
||||
|
||||
fun changeSorting() {
|
||||
val newFragment: DialogFragment = SortingOrderDialogFragment
|
||||
.newInstance(FileSortOrder.getFileSortOrder(appPreferences?.sorting))
|
||||
@ -174,7 +179,6 @@ abstract class BrowserController(args: Bundle) :
|
||||
|
||||
@SuppressLint("RestrictedApi")
|
||||
private fun changeEnabledStatusForBarItems(shouldBeEnabled: Boolean) {
|
||||
binding.bottomNavigation.menu.findItem(R.id.action_refresh)?.isEnabled = shouldBeEnabled
|
||||
binding.pathNavigation.menu.findItem(R.id.action_back)?.isEnabled = shouldBeEnabled && currentPath != "/"
|
||||
}
|
||||
|
||||
@ -211,6 +215,8 @@ abstract class BrowserController(args: Bundle) :
|
||||
changeEnabledStatusForBarItems(true)
|
||||
}
|
||||
}
|
||||
|
||||
binding.swipeRefreshList.isRefreshing = false
|
||||
}
|
||||
|
||||
private fun shouldPathBeSelectedDueToParent(currentPath: String): Boolean {
|
||||
@ -270,6 +276,8 @@ abstract class BrowserController(args: Bundle) :
|
||||
return@setBubbleTextCreator ""
|
||||
}
|
||||
}
|
||||
|
||||
binding.swipeRefreshList.setOnRefreshListener(this)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -82,23 +82,19 @@
|
||||
app:itemTextColor="@color/fg_default"
|
||||
app:menu="@menu/file_browser_path" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recycler_view"
|
||||
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||
android:id="@+id/swipe_refresh_list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_above="@id/bottom_navigation"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_below="@id/path_navigation"
|
||||
tools:listitem="@layout/rv_item_browser_file" />
|
||||
android:footerDividersEnabled="false">
|
||||
|
||||
<com.google.android.material.bottomnavigation.BottomNavigationView
|
||||
android:id="@+id/bottom_navigation"
|
||||
style="@style/BottomNavigationView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="64dp"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:background="@color/bg_default"
|
||||
app:itemTextColor="@color/fg_default"
|
||||
app:itemIconTint="@color/fg_default"
|
||||
app:menu="@menu/file_browser_bottom" />
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recycler_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
tools:listitem="@layout/rv_item_browser_file" />
|
||||
|
||||
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
||||
|
||||
</RelativeLayout>
|
@ -1,28 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Nextcloud Talk application
|
||||
~
|
||||
~ @author Mario Danic
|
||||
~ Copyright (C) 2017-2018 Mario Danic <mario@lovelyhq.com>
|
||||
~
|
||||
~ 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
|
||||
~ the Free Software Foundation, either version 3 of the License, or
|
||||
~ at your option) any later version.
|
||||
~
|
||||
~ This program is distributed in the hope that it will be useful,
|
||||
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
~ GNU General Public License for more details.
|
||||
~
|
||||
~ You should have received a copy of the GNU General Public License
|
||||
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item
|
||||
android:id="@+id/action_refresh"
|
||||
android:icon="@drawable/ic_refresh_black_24dp"
|
||||
android:title="@string/nc_file_browser_refresh"/>
|
||||
|
||||
</menu>
|
Loading…
Reference in New Issue
Block a user