mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 12:23:58 +01:00
navbar now visible in details page (#6316)
This commit is contained in:
parent
f45f26e602
commit
5850de5e2d
2 changed files with 53 additions and 2 deletions
|
|
@ -132,6 +132,9 @@ import java.util.regex.Matcher
|
|||
import java.util.regex.Pattern
|
||||
import javax.inject.Inject
|
||||
import javax.inject.Named
|
||||
import fr.free.nrw.commons.navtab.NavTabLayout
|
||||
import fr.free.nrw.commons.contributions.MainActivity
|
||||
import fr.free.nrw.commons.navtab.NavTab
|
||||
|
||||
class MediaDetailFragment : CommonsDaggerSupportFragment(), CategoryEditHelper.Callback {
|
||||
private var editable: Boolean = false
|
||||
|
|
@ -246,6 +249,8 @@ class MediaDetailFragment : CommonsDaggerSupportFragment(), CategoryEditHelper.C
|
|||
initialListTop = binding.mediaDetailScrollView.scrollY
|
||||
}
|
||||
|
||||
private lateinit var navTabLayout: NavTabLayout
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater,
|
||||
container: ViewGroup?,
|
||||
|
|
@ -418,6 +423,40 @@ class MediaDetailFragment : CommonsDaggerSupportFragment(), CategoryEditHelper.C
|
|||
return view
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
// Hide MainActivity nav tabs when this fragment is open
|
||||
(requireActivity() as MainActivity).hideTabs()
|
||||
|
||||
// Initialize NavTabLayout
|
||||
navTabLayout = binding.fragmentMainNavTabLayout
|
||||
|
||||
navTabLayout.setOnNavigationItemSelectedListener { item ->
|
||||
val navTab = NavTab.of(item.order)
|
||||
when (navTab) {
|
||||
NavTab.CONTRIBUTIONS -> {
|
||||
(requireActivity() as MainActivity).setSelectedItemId(NavTab.CONTRIBUTIONS.code())
|
||||
true
|
||||
}
|
||||
NavTab.NEARBY -> {
|
||||
(requireActivity() as MainActivity).setSelectedItemId(NavTab.NEARBY.code())
|
||||
true
|
||||
}
|
||||
NavTab.EXPLORE -> {
|
||||
(requireActivity() as MainActivity).setSelectedItemId(NavTab.EXPLORE.code())
|
||||
true
|
||||
}
|
||||
NavTab.MORE -> {
|
||||
(requireActivity() as MainActivity).setSelectedItemId(NavTab.MORE.code())
|
||||
true
|
||||
}
|
||||
else -> false
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun launchZoomActivity(view: View) {
|
||||
val hasPermission: Boolean = hasPermission(requireActivity(), PERMISSIONS_STORAGE)
|
||||
if (hasPermission) {
|
||||
|
|
@ -2263,4 +2302,4 @@ fun FileUsagesContainer(
|
|||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -45,6 +45,7 @@
|
|||
android:id="@+id/mediaDetailScrollView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="?attr/actionBarSize"
|
||||
android:background="@android:color/transparent"
|
||||
android:cacheColorHint="@android:color/transparent"
|
||||
android:fillViewport="true">
|
||||
|
|
@ -512,4 +513,15 @@
|
|||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
||||
</FrameLayout>
|
||||
<fr.free.nrw.commons.navtab.NavTabLayout
|
||||
android:id="@+id/fragment_main_nav_tab_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_gravity="bottom"
|
||||
android:background="?attr/nav_bar_background"
|
||||
android:elevation="6dp"
|
||||
app:itemIconTint="?attr/nav_tab_item_color_state"
|
||||
app:itemTextColor="?attr/navbar_item_text_color" />
|
||||
|
||||
</FrameLayout>
|
||||
Loading…
Add table
Add a link
Reference in a new issue