For #6666: Adds back button to search screen
parent
4fa6edc86e
commit
4fd3eb53d1
|
@ -117,7 +117,7 @@ private fun allowPermissionButton(): UiObject {
|
||||||
|
|
||||||
private fun scanButton(): ViewInteraction {
|
private fun scanButton(): ViewInteraction {
|
||||||
mDevice.waitNotNull(Until.findObject(By.res("org.mozilla.fenix.debug:id/search_scan_button")), TestAssetHelper.waitingTime)
|
mDevice.waitNotNull(Until.findObject(By.res("org.mozilla.fenix.debug:id/search_scan_button")), TestAssetHelper.waitingTime)
|
||||||
return onView(allOf(withId(R.id.searchScanButton)))
|
return onView(allOf(withId(R.id.search_scan_button)))
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun clearButton() = onView(withId(R.id.mozac_browser_toolbar_clear_view))
|
private fun clearButton() = onView(withId(R.id.mozac_browser_toolbar_clear_view))
|
||||||
|
|
|
@ -144,7 +144,7 @@ class SearchFragment : Fragment(), UserInteractionHandler {
|
||||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
super.onViewCreated(view, savedInstanceState)
|
super.onViewCreated(view, savedInstanceState)
|
||||||
|
|
||||||
searchScanButton.visibility = if (context?.hasCamera() == true) View.VISIBLE else View.GONE
|
search_scan_button.visibility = if (context?.hasCamera() == true) View.VISIBLE else View.GONE
|
||||||
layoutComponents(view.search_layout)
|
layoutComponents(view.search_layout)
|
||||||
|
|
||||||
qrFeature.set(
|
qrFeature.set(
|
||||||
|
@ -155,7 +155,7 @@ class SearchFragment : Fragment(), UserInteractionHandler {
|
||||||
requestPermissions(permissions, REQUEST_CODE_CAMERA_PERMISSIONS)
|
requestPermissions(permissions, REQUEST_CODE_CAMERA_PERMISSIONS)
|
||||||
},
|
},
|
||||||
onScanResult = { result ->
|
onScanResult = { result ->
|
||||||
searchScanButton.isChecked = false
|
search_scan_button.isChecked = false
|
||||||
activity?.let {
|
activity?.let {
|
||||||
AlertDialog.Builder(it).apply {
|
AlertDialog.Builder(it).apply {
|
||||||
val spannable = resources.getSpannable(
|
val spannable = resources.getSpannable(
|
||||||
|
@ -189,12 +189,16 @@ class SearchFragment : Fragment(), UserInteractionHandler {
|
||||||
view = view
|
view = view
|
||||||
)
|
)
|
||||||
|
|
||||||
view.searchScanButton.setOnClickListener {
|
view.search_scan_button.setOnClickListener {
|
||||||
toolbarView.view.clearFocus()
|
toolbarView.view.clearFocus()
|
||||||
requireComponents.analytics.metrics.track(Event.QRScannerOpened)
|
requireComponents.analytics.metrics.track(Event.QRScannerOpened)
|
||||||
qrFeature.get()?.scan(R.id.container)
|
qrFeature.get()?.scan(R.id.container)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
view.back_button.setOnClickListener {
|
||||||
|
findNavController().popBackStack()
|
||||||
|
}
|
||||||
|
|
||||||
val stubListener = ViewStub.OnInflateListener { _, inflated ->
|
val stubListener = ViewStub.OnInflateListener { _, inflated ->
|
||||||
inflated.learn_more.setOnClickListener {
|
inflated.learn_more.setOnClickListener {
|
||||||
(activity as HomeActivity)
|
(activity as HomeActivity)
|
||||||
|
@ -287,7 +291,7 @@ class SearchFragment : Fragment(), UserInteractionHandler {
|
||||||
override fun onBackPressed(): Boolean {
|
override fun onBackPressed(): Boolean {
|
||||||
return when {
|
return when {
|
||||||
qrFeature.onBackPressed() -> {
|
qrFeature.onBackPressed() -> {
|
||||||
view?.searchScanButton?.isChecked = false
|
view?.search_scan_button?.isChecked = false
|
||||||
toolbarView.view.requestFocus()
|
toolbarView.view.requestFocus()
|
||||||
}
|
}
|
||||||
else -> awesomeBarView.isKeyboardDismissedProgrammatically
|
else -> awesomeBarView.isKeyboardDismissedProgrammatically
|
||||||
|
@ -322,7 +326,7 @@ class SearchFragment : Fragment(), UserInteractionHandler {
|
||||||
if (context.isPermissionGranted(Manifest.permission.CAMERA)) {
|
if (context.isPermissionGranted(Manifest.permission.CAMERA)) {
|
||||||
permissionDidUpdate = true
|
permissionDidUpdate = true
|
||||||
} else {
|
} else {
|
||||||
view?.searchScanButton?.isChecked = false
|
view?.search_scan_button?.isChecked = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,13 +37,13 @@ internal fun SearchFragment.setInExperimentConstraints(layout: ConstraintLayout)
|
||||||
|
|
||||||
// Move the search bar to the bottom of the layout
|
// Move the search bar to the bottom of the layout
|
||||||
clear(toolbar_wrapper.id, TOP)
|
clear(toolbar_wrapper.id, TOP)
|
||||||
connect(toolbar_wrapper.id, BOTTOM, pillWrapper.id, TOP)
|
connect(toolbar_wrapper.id, BOTTOM, pill_wrapper.id, TOP)
|
||||||
|
|
||||||
connect(awesomeBar.id, TOP, PARENT_ID, TOP)
|
connect(awesomeBar.id, TOP, PARENT_ID, TOP)
|
||||||
connect(awesomeBar.id, BOTTOM, toolbar_wrapper.id, TOP)
|
connect(awesomeBar.id, BOTTOM, toolbar_wrapper.id, TOP)
|
||||||
(awesomeBar.layoutManager as? LinearLayoutManager)?.reverseLayout = true
|
(awesomeBar.layoutManager as? LinearLayoutManager)?.reverseLayout = true
|
||||||
|
|
||||||
connect(pillWrapper.id, BOTTOM, PARENT_ID, BOTTOM)
|
connect(pill_wrapper.id, BOTTOM, PARENT_ID, BOTTOM)
|
||||||
|
|
||||||
applyTo(layout)
|
applyTo(layout)
|
||||||
}
|
}
|
||||||
|
@ -63,10 +63,10 @@ internal fun SearchFragment.setOutOfExperimentConstraints(layout: ConstraintLayo
|
||||||
|
|
||||||
clear(awesomeBar.id, TOP)
|
clear(awesomeBar.id, TOP)
|
||||||
connect(awesomeBar.id, TOP, search_with_shortcuts.id, BOTTOM)
|
connect(awesomeBar.id, TOP, search_with_shortcuts.id, BOTTOM)
|
||||||
connect(awesomeBar.id, BOTTOM, pillWrapper.id, TOP)
|
connect(awesomeBar.id, BOTTOM, pill_wrapper.id, TOP)
|
||||||
(awesomeBar.layoutManager as? LinearLayoutManager)?.reverseLayout = false
|
(awesomeBar.layoutManager as? LinearLayoutManager)?.reverseLayout = false
|
||||||
|
|
||||||
connect(pillWrapper.id, BOTTOM, PARENT_ID, BOTTOM)
|
connect(pill_wrapper.id, BOTTOM, PARENT_ID, BOTTOM)
|
||||||
|
|
||||||
applyTo(layout)
|
applyTo(layout)
|
||||||
}
|
}
|
||||||
|
|
|
@ -176,7 +176,7 @@ class AwesomeBarView(
|
||||||
}
|
}
|
||||||
|
|
||||||
searchSuggestionProviderMap = HashMap()
|
searchSuggestionProviderMap = HashMap()
|
||||||
searchShortcutsButton.setOnClickListener {
|
search_shortcuts_button.setOnClickListener {
|
||||||
interactor.onSearchShortcutsButtonClicked()
|
interactor.onSearchShortcutsButtonClicked()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -213,11 +213,11 @@ class AwesomeBarView(
|
||||||
private fun updateSearchShortcutsIcon(searchState: SearchFragmentState) {
|
private fun updateSearchShortcutsIcon(searchState: SearchFragmentState) {
|
||||||
with(container.context) {
|
with(container.context) {
|
||||||
val showShortcuts = searchState.showSearchShortcuts
|
val showShortcuts = searchState.showSearchShortcuts
|
||||||
searchShortcutsButton?.isChecked = showShortcuts
|
search_shortcuts_button?.isChecked = showShortcuts
|
||||||
|
|
||||||
val color = if (showShortcuts) R.attr.contrastText else R.attr.primaryText
|
val color = if (showShortcuts) R.attr.contrastText else R.attr.primaryText
|
||||||
|
|
||||||
searchShortcutsButton.compoundDrawables[0]?.setTint(getColorFromAttr(color))
|
search_shortcuts_button.compoundDrawables[0]?.setTint(getColorFromAttr(color))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,19 @@
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent" />
|
app:layout_constraintStart_toStartOf="parent" />
|
||||||
|
|
||||||
|
<ImageButton
|
||||||
|
android:id="@+id/back_button"
|
||||||
|
android:layout_width="40dp"
|
||||||
|
android:layout_height="40dp"
|
||||||
|
android:layout_margin="8dp"
|
||||||
|
android:tint="?primaryText"
|
||||||
|
android:src="@drawable/mozac_ic_back"
|
||||||
|
android:background="?selectableItemBackground"
|
||||||
|
android:contentDescription="@string/browser_menu_back"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="@id/toolbar_wrapper"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@id/toolbar_wrapper"/>
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:id="@+id/toolbar_wrapper"
|
android:id="@+id/toolbar_wrapper"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
|
@ -41,7 +54,7 @@
|
||||||
android:outlineProvider="paddedBounds"
|
android:outlineProvider="paddedBounds"
|
||||||
android:transitionName="toolbar_wrapper_transition"
|
android:transitionName="toolbar_wrapper_transition"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toEndOf="@id/back_button"
|
||||||
app:layout_constraintTop_toTopOf="parent">
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
|
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
|
@ -68,7 +81,7 @@
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
app:layout_constraintEnd_toEndOf="@id/toolbar_wrapper"
|
app:layout_constraintEnd_toEndOf="@id/toolbar_wrapper"
|
||||||
app:layout_constraintTop_toBottomOf="@id/toolbar_wrapper"
|
app:layout_constraintTop_toBottomOf="@id/toolbar_wrapper"
|
||||||
app:layout_constraintStart_toStartOf="@id/toolbar_wrapper"
|
app:layout_constraintStart_toStartOf="@id/back_button"
|
||||||
app:layout_constraintBottom_toBottomOf="@id/awesomeBar_barrier">
|
app:layout_constraintBottom_toBottomOf="@id/awesomeBar_barrier">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
|
@ -126,7 +139,7 @@
|
||||||
android:layout_marginTop="@dimen/search_fragment_shortcuts_label_margin_vertical"
|
android:layout_marginTop="@dimen/search_fragment_shortcuts_label_margin_vertical"
|
||||||
android:layout_marginEnd="@dimen/search_fragment_shortcuts_label_margin_horizontal"
|
android:layout_marginEnd="@dimen/search_fragment_shortcuts_label_margin_horizontal"
|
||||||
android:text="@string/search_shortcuts_search_with_2"
|
android:text="@string/search_shortcuts_search_with_2"
|
||||||
app:layout_constraintStart_toStartOf="@id/toolbar_wrapper"
|
app:layout_constraintStart_toStartOf="@id/back_button"
|
||||||
app:layout_constraintTop_toBottomOf="@id/awesomeBar_barrier"
|
app:layout_constraintTop_toBottomOf="@id/awesomeBar_barrier"
|
||||||
tools:text="This time, search with:" />
|
tools:text="This time, search with:" />
|
||||||
|
|
||||||
|
@ -142,12 +155,12 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="1dp"
|
android:layout_height="1dp"
|
||||||
android:background="?neutralFaded"
|
android:background="?neutralFaded"
|
||||||
app:layout_constraintBottom_toTopOf="@id/pillWrapper"
|
app:layout_constraintBottom_toTopOf="@id/pill_wrapper"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent" />
|
app:layout_constraintStart_toStartOf="parent" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/pillWrapper"
|
android:id="@+id/pill_wrapper"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="@dimen/search_fragment_pill_height"
|
android:layout_height="@dimen/search_fragment_pill_height"
|
||||||
android:background="?foundation"
|
android:background="?foundation"
|
||||||
|
@ -161,7 +174,7 @@
|
||||||
app:layout_constraintStart_toStartOf="parent">
|
app:layout_constraintStart_toStartOf="parent">
|
||||||
|
|
||||||
<ToggleButton
|
<ToggleButton
|
||||||
android:id="@+id/searchScanButton"
|
android:id="@+id/search_scan_button"
|
||||||
style="@style/search_pill"
|
style="@style/search_pill"
|
||||||
android:layout_marginEnd="@dimen/search_fragment_scan_button_margin_end"
|
android:layout_marginEnd="@dimen/search_fragment_scan_button_margin_end"
|
||||||
app:drawableStartCompat="@drawable/ic_qr"
|
app:drawableStartCompat="@drawable/ic_qr"
|
||||||
|
@ -169,7 +182,7 @@
|
||||||
android:textOn="@string/search_scan_button" />
|
android:textOn="@string/search_scan_button" />
|
||||||
|
|
||||||
<ToggleButton
|
<ToggleButton
|
||||||
android:id="@+id/searchShortcutsButton"
|
android:id="@+id/search_shortcuts_button"
|
||||||
style="@style/search_pill"
|
style="@style/search_pill"
|
||||||
app:drawableStartCompat="@drawable/ic_search"
|
app:drawableStartCompat="@drawable/ic_search"
|
||||||
android:textOff="@string/search_shortcuts_button"
|
android:textOff="@string/search_shortcuts_button"
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.io.IOException
|
import java.io.IOException
|
||||||
import java.util.concurrent.TimeUnit
|
import java.util.concurrent.TimeUnit
|
||||||
import java.util.stream.Stream
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Script for use when compiling a changelog. It will find all GH mentions in commit
|
* Script for use when compiling a changelog. It will find all GH mentions in commit
|
||||||
|
@ -27,7 +26,7 @@ val DEBUG = false
|
||||||
|
|
||||||
println("Starting PrintMentionedIssuesAndPrs.kts")
|
println("Starting PrintMentionedIssuesAndPrs.kts")
|
||||||
|
|
||||||
val tag = try { args[0] } catch(e: IndexOutOfBoundsException) { getHighestVersionedTag() }
|
val tag = try { args[0] } catch (e: IndexOutOfBoundsException) { getHighestVersionedTag() }
|
||||||
debug { "Last tag: $tag" }
|
debug { "Last tag: $tag" }
|
||||||
|
|
||||||
val commonCommit = getMostRecentCommonAncestorWithMaster(tag)
|
val commonCommit = getMostRecentCommonAncestorWithMaster(tag)
|
||||||
|
@ -91,7 +90,7 @@ fun runCommand(cmd: String, workingDir: File = File(".")): String {
|
||||||
debug { "Err: ${proc.errorStream.bufferedReader().use { it.readText() }}" }
|
debug { "Err: ${proc.errorStream.bufferedReader().use { it.readText() }}" }
|
||||||
|
|
||||||
return proc.inputStream.bufferedReader().use { it.readText() }
|
return proc.inputStream.bufferedReader().use { it.readText() }
|
||||||
} catch(e: IOException) {
|
} catch (e: IOException) {
|
||||||
e.printStackTrace()
|
e.printStackTrace()
|
||||||
throw(e)
|
throw(e)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue