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
4 changes: 2 additions & 2 deletions plugins/AI-Core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ android {
applicationId = "com.itsaky.androidide.plugins.aicore"
minSdk = 33
targetSdk = 36
versionCode = 11
versionName = "3.7.0"
versionCode = 12
versionName = "3.7.1"
}

buildFeatures {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -604,9 +604,10 @@ open class ChatFragment : Fragment(), ApprovalDialogFragment.Host {

// The field scrolls its own long prompts, and answers the chat's keyboard chords.
binding.promptInputEdittext.keepVerticalDragsToItself()
binding.root.fitContentToVisibleBottom()
binding.promptInputEdittext.growUpTo(
resources.getInteger(R.integer.chat_input_max_lines),
binding.root,
binding.chatColumn,
)
binding.promptInputEdittext.bindShortcuts(ChatShortcuts.SEND_MESSAGE runs ::sendPrompt)
binding.promptInputEdittext.doAfterTextChanged { viewModel.setComposerDraft(it?.toString().orEmpty()) }
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.itsaky.androidide.plugins.aicore.fragments

import android.graphics.Rect
import android.view.View
import android.view.ViewTreeObserver
import androidx.core.view.updatePadding

internal fun View.fitContentToVisibleBottom() {
val visible = Rect()
val fit = ViewTreeObserver.OnPreDrawListener {
if (getLocalVisibleRect(visible)) {
val hidden = (height - visible.bottom).coerceAtLeast(0)
if (hidden != paddingBottom) updatePadding(bottom = hidden)
}
true
}
addOnAttachStateChangeListener(object : View.OnAttachStateChangeListener {
override fun onViewAttachedToWindow(v: View) = v.viewTreeObserver.addOnPreDrawListener(fit)
override fun onViewDetachedFromWindow(v: View) = v.viewTreeObserver.removeOnPreDrawListener(fit)
})
if (isAttachedToWindow) viewTreeObserver.addOnPreDrawListener(fit)
}
1 change: 1 addition & 0 deletions plugins/AI-Core/src/main/res/layout/fragment_chat.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
android:background="@color/plugin_surface">

<LinearLayout
android:id="@+id/chat_column"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
Expand Down
Loading