Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 55
ADFA-2106 | Enable text selection in build logs#732
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+61
−15
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
4fe040e
feat: enable text selection in logs and move help to context menu Upd…
jatezzz fdcb1b3
Merge branch 'stage' into feat/ADFA-2106-enable-log-text-selection
jatezzz 01540fc
refactor: Add validation for coordinates and prevent a possible NPE a…
jatezzz 1f9c787
feat: Attach the corresponding tag for each log tab
jatezzz 0f7f905
fix: Remove unused import
jatezzz a81c256
Merge branch 'stage' into feat/ADFA-2106-enable-log-text-selection
jatezzz 0803aab
Merge branch 'stage' into feat/ADFA-2106-enable-log-text-selection
jatezzz 3495bce
Merge branch 'stage' into feat/ADFA-2106-enable-log-text-selection
jatezzz 2d07792
Merge branch 'stage' into feat/ADFA-2106-enable-log-text-selection
jatezzz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
23 changes: 18 additions & 5 deletions
23 app/src/main/java/com/itsaky/androidide/actions/file/ShowTooltipAction.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 20 additions & 3 deletions
23 app/src/main/java/com/itsaky/androidide/fragments/EmptyStateFragment.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -13,6 +13,7 @@ import androidx.lifecycle.repeatOnLifecycle | ||
| import androidx.viewbinding.ViewBinding | ||
| import com.itsaky.androidide.databinding.FragmentEmptyStateBinding | ||
| import com.itsaky.androidide.editor.ui.EditorLongPressEvent | ||
| import com.itsaky.androidide.editor.ui.IDEEditor | ||
| import com.itsaky.androidide.idetooltips.TooltipManager | ||
| import com.itsaky.androidide.utils.viewLifecycleScope | ||
| import com.itsaky.androidide.viewmodel.EmptyStateFragmentViewModel | ||
| @@ -40,16 +41,31 @@ abstract class EmptyStateFragment<T : ViewBinding> : FragmentWithBinding<T> { | ||
| @Volatile | ||
| private var cachedIsEmpty: Boolean = true | ||
| open val currentEditor: IDEEditor? get() = null | ||
| /** | ||
| * Called when a long press is detected on the fragment's root view. | ||
| * Subclasses must implement this to define the action (e.g., show a tooltip). | ||
| */ | ||
| protected abstract fun onFragmentLongPressed() | ||
| open fun onFragmentLongPressed(x: Float = -1f, y: Float = -1f) { | ||
| currentEditor?.let { editor -> | ||
| if (x >= 0 && y >= 0) { | ||
| editor.setSelectionFromPoint(x, y) | ||
| } | ||
| } | ||
| onFragmentLongPressed() | ||
| } | ||
jatezzz marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| open fun onFragmentLongPressed() { | ||
| val currentEditor = currentEditor ?: return | ||
| currentEditor.selectCurrentWord() | ||
| } | ||
coderabbitai[bot] marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| private val gestureListener = | ||
| object : GestureDetector.SimpleOnGestureListener() { | ||
| override fun onLongPress(e: MotionEvent) { | ||
| onFragmentLongPressed() | ||
| if (currentEditor?.isReadOnlyContext == true) return | ||
| onFragmentLongPressed(e.x, e.y) | ||
| } | ||
| } | ||
| @@ -160,6 +176,7 @@ abstract class EmptyStateFragment<T : ViewBinding> : FragmentWithBinding<T> { | ||
| // This method will be called when an EditorLongPressEvent is posted | ||
| @Subscribe(threadMode = ThreadMode.MAIN) | ||
| fun onEditorLongPressed(event: EditorLongPressEvent) { | ||
| onFragmentLongPressed() | ||
| val motionEvent = event.motionEvent | ||
| onFragmentLongPressed(motionEvent.x, motionEvent.y) | ||
| } | ||
| } | ||
6 changes: 3 additions & 3 deletions
6 app/src/main/java/com/itsaky/androidide/fragments/output/BuildOutputFragment.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 4 additions & 4 deletions
8 app/src/main/java/com/itsaky/androidide/fragments/output/LogViewFragment.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16 editor/src/main/java/com/itsaky/androidide/editor/ui/IDEEditor.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1131,4 +1131,20 @@ constructor( | ||
| ) { | ||
| editorFeatures.setSelectionAround(line, column) | ||
| } | ||
| fun setSelectionFromPoint(x: Float, y: Float) { | ||
| if (isReleased) return | ||
| try { | ||
| val packedPos = getPointPosition(x, y) | ||
| val line = (packedPos ushr 32).toInt() | ||
| val column = (packedPos and 0xffffffffL).toInt() | ||
| if (line < 0 || column < 0) return | ||
| setSelection(line, column) | ||
| } catch (e: Exception) { | ||
| log.error("Error setting selection from point", e) | ||
| } | ||
| } | ||
coderabbitai[bot] marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| } | ||
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.