|
|
@ -17,9 +17,7 @@ import android.view.ViewGroup
|
|
|
|
import android.view.ViewStub
|
|
|
|
import android.view.ViewStub
|
|
|
|
import androidx.appcompat.app.AlertDialog
|
|
|
|
import androidx.appcompat.app.AlertDialog
|
|
|
|
import androidx.core.view.isVisible
|
|
|
|
import androidx.core.view.isVisible
|
|
|
|
import androidx.core.view.marginStart
|
|
|
|
|
|
|
|
import androidx.fragment.app.Fragment
|
|
|
|
import androidx.fragment.app.Fragment
|
|
|
|
import androidx.interpolator.view.animation.FastOutSlowInInterpolator
|
|
|
|
|
|
|
|
import androidx.navigation.fragment.findNavController
|
|
|
|
import androidx.navigation.fragment.findNavController
|
|
|
|
import androidx.navigation.fragment.navArgs
|
|
|
|
import androidx.navigation.fragment.navArgs
|
|
|
|
import androidx.transition.TransitionInflater
|
|
|
|
import androidx.transition.TransitionInflater
|
|
|
@ -108,8 +106,7 @@ class SearchFragment : Fragment(), UserInteractionHandler {
|
|
|
|
showBookmarkSuggestions = requireContext().settings().shouldShowBookmarkSuggestions,
|
|
|
|
showBookmarkSuggestions = requireContext().settings().shouldShowBookmarkSuggestions,
|
|
|
|
session = session,
|
|
|
|
session = session,
|
|
|
|
pastedText = pastedText,
|
|
|
|
pastedText = pastedText,
|
|
|
|
searchAccessPoint = searchAccessPoint,
|
|
|
|
searchAccessPoint = searchAccessPoint
|
|
|
|
isAnimatingOut = false
|
|
|
|
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -196,10 +193,6 @@ class SearchFragment : Fragment(), UserInteractionHandler {
|
|
|
|
qrFeature.get()?.scan(R.id.container)
|
|
|
|
qrFeature.get()?.scan(R.id.container)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
view.back_button.setOnClickListener {
|
|
|
|
|
|
|
|
searchInteractor.onEditingCanceled()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
val stubListener = ViewStub.OnInflateListener { _, inflated ->
|
|
|
|
val stubListener = ViewStub.OnInflateListener { _, inflated ->
|
|
|
|
inflated.learn_more.setOnClickListener {
|
|
|
|
inflated.learn_more.setOnClickListener {
|
|
|
|
(activity as HomeActivity)
|
|
|
|
(activity as HomeActivity)
|
|
|
@ -251,7 +244,6 @@ class SearchFragment : Fragment(), UserInteractionHandler {
|
|
|
|
updateSearchWithLabel(it)
|
|
|
|
updateSearchWithLabel(it)
|
|
|
|
updateClipboardSuggestion(it, requireContext().components.clipboardHandler.url)
|
|
|
|
updateClipboardSuggestion(it, requireContext().components.clipboardHandler.url)
|
|
|
|
updateSearchSuggestionsHintVisibility(it)
|
|
|
|
updateSearchSuggestionsHintVisibility(it)
|
|
|
|
updateBackButton(it)
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
startPostponedEnterTransition()
|
|
|
|
startPostponedEnterTransition()
|
|
|
@ -315,13 +307,6 @@ class SearchFragment : Fragment(), UserInteractionHandler {
|
|
|
|
clipboard_url.text = clipboardUrl
|
|
|
|
clipboard_url.text = clipboardUrl
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private fun updateBackButton(searchState: SearchFragmentState) {
|
|
|
|
|
|
|
|
if (searchState.isAnimatingOut) {
|
|
|
|
|
|
|
|
searchStore.dispatch(SearchFragmentAction.ConsumeEditingCancelled)
|
|
|
|
|
|
|
|
animateBackButtonAway()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
override fun onRequestPermissionsResult(
|
|
|
|
override fun onRequestPermissionsResult(
|
|
|
|
requestCode: Int,
|
|
|
|
requestCode: Int,
|
|
|
|
permissions: Array<String>,
|
|
|
|
permissions: Array<String>,
|
|
|
@ -358,18 +343,6 @@ class SearchFragment : Fragment(), UserInteractionHandler {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private fun animateBackButtonAway() {
|
|
|
|
|
|
|
|
val backButton = requireView().back_button
|
|
|
|
|
|
|
|
val xTranslation = with(backButton) {
|
|
|
|
|
|
|
|
-(width + marginStart + paddingStart).toFloat()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
backButton
|
|
|
|
|
|
|
|
.animate()
|
|
|
|
|
|
|
|
.translationX(xTranslation)
|
|
|
|
|
|
|
|
.interpolator = FastOutSlowInInterpolator()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
companion object {
|
|
|
|
companion object {
|
|
|
|
private const val SHARED_TRANSITION_MS = 200L
|
|
|
|
private const val SHARED_TRANSITION_MS = 200L
|
|
|
|
private const val REQUEST_CODE_CAMERA_PERMISSIONS = 1
|
|
|
|
private const val REQUEST_CODE_CAMERA_PERMISSIONS = 1
|
|
|
|