mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-04-14 19:56:32 +00:00
Improve bottom bar display in verbose languages
This commit is contained in:
parent
8ad0822935
commit
ca68ac1d18
5 changed files with 34 additions and 14 deletions
|
|
@ -28,6 +28,7 @@
|
|||
android:paddingEnd="@dimen/spacing_small"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_below="@id/icon_view"
|
||||
android:gravity="center"
|
||||
/>
|
||||
<TextView
|
||||
android:id="@+id/selected_title_view"
|
||||
|
|
@ -43,6 +44,7 @@
|
|||
android:paddingEnd="@dimen/spacing_small"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_below="@id/icon_view"
|
||||
android:gravity="center"
|
||||
/>
|
||||
<TextView
|
||||
android:id="@+id/badge"
|
||||
|
|
|
|||
|
|
@ -10,20 +10,29 @@
|
|||
<LinearLayout
|
||||
android:id="@+id/bottom_navigation_background"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="62dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:gravity="center_vertical"
|
||||
android:layout_alignTop="@id/item_wrapper"
|
||||
android:clickable="true">
|
||||
<View
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?barColor" />
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
<ImageView
|
||||
android:id="@+id/cutout_background"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/bottom_navigation_inset"/>
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?barColor" />
|
||||
</LinearLayout>
|
||||
<View
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
|
|
@ -31,10 +40,13 @@
|
|||
android:background="?barColor" />
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:id="@+id/item_wrapper"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="62dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="62dp"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:gravity="center_vertical">
|
||||
android:paddingTop="@dimen/spacing_small"
|
||||
android:paddingBottom="@dimen/spacing_small">
|
||||
<com.habitrpg.android.habitica.ui.views.navigation.BottomNavigationItem
|
||||
android:id="@+id/tab_habits"
|
||||
android:layout_width="0dp"
|
||||
|
|
@ -73,8 +85,8 @@
|
|||
android:layout_width="80dp"
|
||||
android:layout_height="80dp"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_alignBottom="@id/bottom_navigation_background"
|
||||
android:layout_marginBottom="21dp"
|
||||
android:layout_alignTop="@id/bottom_navigation_background"
|
||||
android:layout_marginTop="-41dp"
|
||||
android:background="@drawable/fab_background">
|
||||
<ImageButton
|
||||
android:id="@+id/add"
|
||||
|
|
|
|||
|
|
@ -318,8 +318,6 @@ open class MainActivity : BaseActivity(), TutorialView.OnTutorialReaction {
|
|||
super.startActivity(intent, options)
|
||||
}
|
||||
|
||||
|
||||
|
||||
private fun updateWidgets() {
|
||||
updateWidget(AvatarStatsWidgetProvider::class.java)
|
||||
updateWidget(TodoListWidgetProvider::class.java)
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import com.google.android.material.appbar.AppBarLayout
|
|||
import com.google.android.material.tabs.TabLayout
|
||||
import com.habitrpg.android.habitica.data.ApiClient
|
||||
import com.habitrpg.android.habitica.data.UserRepository
|
||||
import com.habitrpg.android.habitica.extensions.setScaledPadding
|
||||
import com.habitrpg.android.habitica.extensions.dpToPx
|
||||
import com.habitrpg.android.habitica.helpers.RxErrorHandler
|
||||
import com.habitrpg.android.habitica.helpers.SoundManager
|
||||
import com.habitrpg.android.habitica.models.user.User
|
||||
|
|
@ -31,7 +31,6 @@ abstract class BaseMainFragment : BaseFragment() {
|
|||
val collapsingToolbar get() = activity?.toolbar
|
||||
val toolbarAccessoryContainer get() = activity?.toolbarAccessoryContainer
|
||||
val bottomNavigation get() = activity?.bottomNavigation
|
||||
val floatingMenuWrapper get() = activity?.snackbarContainer
|
||||
var usesTabLayout: Boolean = false
|
||||
var hidesToolbar: Boolean = false
|
||||
var usesBottomNavigation = false
|
||||
|
|
@ -52,14 +51,10 @@ abstract class BaseMainFragment : BaseFragment() {
|
|||
|
||||
if (this.usesBottomNavigation) {
|
||||
bottomNavigation?.visibility = View.VISIBLE
|
||||
activity?.snackbarContainer?.setScaledPadding(context, 0, 0, 0, 68)
|
||||
} else {
|
||||
bottomNavigation?.visibility = View.GONE
|
||||
activity?.snackbarContainer?.setScaledPadding(context, 0, 0, 0, 0)
|
||||
}
|
||||
|
||||
floatingMenuWrapper?.removeAllViews()
|
||||
|
||||
setHasOptionsMenu(true)
|
||||
|
||||
updateTabLayoutVisibility()
|
||||
|
|
@ -75,6 +70,15 @@ abstract class BaseMainFragment : BaseFragment() {
|
|||
return null
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
if (this.usesBottomNavigation) {
|
||||
activity?.snackbarContainer?.setPadding(0, 0, 0, (bottomNavigation?.barHeight ?: 0) + 12.dpToPx(context))
|
||||
} else {
|
||||
activity?.snackbarContainer?.setPadding(0, 0, 0, 0)
|
||||
}
|
||||
}
|
||||
|
||||
private fun updateTabLayoutVisibility() {
|
||||
if (this.usesTabLayout) {
|
||||
tabLayout?.removeAllTabs()
|
||||
|
|
|
|||
|
|
@ -55,6 +55,9 @@ class HabiticaBottomNavigationView @JvmOverloads constructor(
|
|||
onTabSelectedListener?.invoke(value)
|
||||
}
|
||||
|
||||
val barHeight: Int
|
||||
get() = itemWrapper.measuredHeight
|
||||
|
||||
private val cutoutBackgroundView: ImageView by bindView(R.id.cutout_background)
|
||||
private val habitsTab: BottomNavigationItem by bindView(R.id.tab_habits)
|
||||
private val dailiesTab: BottomNavigationItem by bindView(R.id.tab_dailies)
|
||||
|
|
@ -63,6 +66,7 @@ class HabiticaBottomNavigationView @JvmOverloads constructor(
|
|||
private val addButton: ImageButton by bindView(R.id.add)
|
||||
private val addButtonBackground: ViewGroup by bindView(R.id.add_wrapper)
|
||||
private val submenuWrapper: LinearLayout by bindView(R.id.submenu_wrapper)
|
||||
private val itemWrapper: ViewGroup by bindView(R.id.item_wrapper)
|
||||
|
||||
init {
|
||||
inflate(R.layout.main_navigation_view, true)
|
||||
|
|
|
|||
Loading…
Reference in a new issue