Manually set referenced resource ID for barriers

This commit is contained in:
topjohnwu 2020-02-11 20:54:23 -08:00
parent c8d050c3e3
commit 9a8274130b
2 changed files with 23 additions and 6 deletions

View File

@ -1,8 +1,7 @@
package com.topjohnwu.magisk.ui.home
import android.view.Menu
import android.view.MenuInflater
import android.view.MenuItem
import android.os.Bundle
import android.view.*
import com.topjohnwu.magisk.R
import com.topjohnwu.magisk.databinding.FragmentHomeMd2Binding
import com.topjohnwu.magisk.model.navigation.Navigation
@ -20,6 +19,24 @@ class HomeFragment : BaseUIFragment<HomeViewModel, FragmentHomeMd2Binding>() {
setHasOptionsMenu(true)
}
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
super.onCreateView(inflater, container, savedInstanceState)
// Set barrier reference IDs in code, since resource IDs will be stripped in release mode
binding.homeDeviceWrapper.homeDeviceTitleBarrier.referencedIds =
intArrayOf(R.id.home_device_action, R.id.home_device_title, R.id.home_device_icon)
binding.homeMagiskWrapper.homeMagiskTitleBarrier.referencedIds =
intArrayOf(R.id.home_magisk_action, R.id.home_magisk_title, R.id.home_magisk_icon)
binding.homeManagerWrapper.homeManagerTitleBarrier.referencedIds =
intArrayOf(R.id.home_manager_action, R.id.home_manager_title, R.id.home_manager_icon)
return binding.root
}
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
inflater.inflate(R.menu.menu_home_md2, menu)
}

View File

@ -52,12 +52,12 @@
android:textAppearance="@style/AppearanceFoundation.Title"
android:textColor="?colorPrimary"
app:layout_constraintBottom_toBottomOf="@+id/home_device_icon"
app:layout_constraintEnd_toStartOf="@+id/home_device_action_reboot"
app:layout_constraintEnd_toStartOf="@+id/home_device_action"
app:layout_constraintStart_toEndOf="@+id/home_device_icon"
app:layout_constraintTop_toTopOf="@+id/home_device_icon" />
<com.google.android.material.button.MaterialButton
android:id="@+id/home_device_action_reboot"
android:id="@+id/home_device_action"
style="@style/WidgetFoundation.Button.Text"
invisibleUnless="@{XSUKt.hasRoot}"
popupMenu="@{R.menu.menu_reboot}"
@ -76,7 +76,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:barrierDirection="bottom"
app:constraint_referenced_ids="home_device_action_reboot,home_device_title,home_device_icon" />
app:constraint_referenced_ids="home_device_action,home_device_title,home_device_icon" />
<HorizontalScrollView
android:layout_width="match_parent"