Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -107,17 +107,27 @@ class FullscreenManager(
private var pendingTransitionToken = 0L

private val transitionDurationMs = 350L

private var isFullscreenState = false

private val defaultEditorBottomMargin by lazy {
private val defaultEditorBottomMargin =
(editorContainer.layoutParams as ViewGroup.MarginLayoutParams).bottomMargin
}



private val offsetListener = AppBarLayout.OnOffsetChangedListener { appBarLayout, verticalOffset ->
val totalScrollRange = appBarLayout.totalScrollRange
if (totalScrollRange > 0) {
val collapseFraction = abs(verticalOffset).toFloat() / totalScrollRange.toFloat()
appBarContent.alpha = 1f - collapseFraction
}

if (!isFullscreenState) {
val visibleAppBarHeight = totalScrollRange + verticalOffset
editorContainer.updateLayoutParams<ViewGroup.MarginLayoutParams> {
bottomMargin = defaultEditorBottomMargin + visibleAppBarHeight
}
}
}

private val bottomSheetCallback = object : BottomSheetBehavior.BottomSheetCallback() {
Expand Down Expand Up @@ -234,13 +244,10 @@ class FullscreenManager(
} else {
bottomSheetBehavior.isHideable = false
}

editorContainer.updateLayoutParams<ViewGroup.MarginLayoutParams> {
bottomMargin = defaultEditorBottomMargin
}
}

private fun syncToggleUi(state: FullscreenUiState) {
isFullscreenState = state.isFullscreen
if (state.isFullscreen) {
fullscreenToggle.setImageResource(R.drawable.ic_fullscreen_exit)
fullscreenToggle.contentDescription =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,8 @@ constructor(
*/
fun setImeVisible(isVisible: Boolean) {
isImeVisible = isVisible
behavior.isGestureInsetBottomIgnored = isVisible
behavior.isGestureInsetBottomIgnored = true
behavior.peekHeight = if (isVisible) 0 else collapsedHeight.toInt()
}

fun setOffsetAnchor(view: View) {
Expand All @@ -350,7 +351,7 @@ constructor(

behavior.peekHeight = collapsedHeight.roundToInt()
behavior.expandedOffset = anchorOffset
behavior.isGestureInsetBottomIgnored = isImeVisible
behavior.isGestureInsetBottomIgnored = true

binding.root.updatePadding(bottom = anchorOffset + insetBottom)
binding.headerContainer.apply {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ open class SwipeRevealLayout @JvmOverloads constructor(
hiddenContent.layout(0, paddingTop, r, paddingTop + hiddenContent.measuredHeight)

val olapTop = paddingTop + (hiddenContent.height * dragProgress).toInt()
overlappingContent.layout(0, olapTop, r, b)
overlappingContent.layout(0, olapTop, r, olapTop + overlappingContent.measuredHeight)
}

override fun onInterceptTouchEvent(ev: MotionEvent): Boolean {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ class EditorSearchLayout(context: Context, val editor: IDEEditor) : FrameLayout(

addView(
findInFileBinding.root,
LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)
LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)
)
}

Expand Down
20 changes: 16 additions & 4 deletions editor/src/main/res/layout/layout_find_in_file.xml
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,13 @@
android:layout_height="40dp"
android:text="@string/previous"
android:textAllCaps="true"
android:minWidth="0dp"
android:paddingHorizontal="4dp"
app:layout_constraintEnd_toStartOf="@+id/next"
app:layout_constraintHorizontal_weight="0.25"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/search_input" />
app:layout_constraintTop_toBottomOf="@+id/search_input"
app:layout_constraintBottom_toBottomOf="parent" />


<com.google.android.material.button.MaterialButton
Expand All @@ -82,11 +85,14 @@
android:layout_height="40dp"
android:text="@string/next"
android:textAllCaps="true"
android:minWidth="0dp"
android:paddingHorizontal="4dp"
app:layout_constraintEnd_toStartOf="@+id/replace"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintHorizontal_weight="0.25"
app:layout_constraintStart_toEndOf="@+id/prev"
app:layout_constraintTop_toBottomOf="@+id/search_input" />
app:layout_constraintTop_toBottomOf="@+id/search_input"
app:layout_constraintBottom_toBottomOf="parent" />

<com.google.android.material.button.MaterialButton
android:id="@+id/replace"
Expand All @@ -95,11 +101,14 @@
android:layout_height="40dp"
android:text="@string/replace"
android:textAllCaps="true"
android:minWidth="0dp"
android:paddingHorizontal="4dp"
app:layout_constraintEnd_toStartOf="@+id/close"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintHorizontal_weight="0.25"
app:layout_constraintStart_toEndOf="@+id/next"
app:layout_constraintTop_toBottomOf="@+id/search_input" />
app:layout_constraintTop_toBottomOf="@+id/search_input"
app:layout_constraintBottom_toBottomOf="parent" />

<com.google.android.material.button.MaterialButton
android:id="@+id/close"
Expand All @@ -108,10 +117,13 @@
android:layout_height="40dp"
android:text="@string/btn_close"
android:textAllCaps="true"
android:minWidth="0dp"
android:paddingHorizontal="4dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintHorizontal_weight="0.25"
app:layout_constraintStart_toEndOf="@+id/replace"
app:layout_constraintTop_toBottomOf="@+id/search_input" />
app:layout_constraintTop_toBottomOf="@+id/search_input"
app:layout_constraintBottom_toBottomOf="parent" />

</androidx.constraintlayout.widget.ConstraintLayout>
Loading