diff --git a/changelogs/214.md b/changelogs/214.md new file mode 100644 index 000000000..5734cd786 --- /dev/null +++ b/changelogs/214.md @@ -0,0 +1,210 @@ +# [](https://github.com/AndroidIDEOfficial/AndroidIDE/compare/v2.1.3-beta...v) (2023-01-04) + + +### Bug Fixes + +* NPE when appending log lines (closes [#605](https://github.com/AndroidIDEOfficial/AndroidIDE/issues/605)) ([5d5a3cf](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/5d5a3cfd71e1eec36d3347878160bd56465f5b9f)) +* activity is restarted when it is not focused during installation process (fixes [#628](https://github.com/AndroidIDEOfficial/AndroidIDE/issues/628)) ([89d7ea4](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/89d7ea40ba1f16f1fb88cf8064f179eb3e76ac7a)) +* adapter index test ([99f7496](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/99f749684f4dbe4cc85afd9a3a16225dfd77ce86)) +* avoid unnecessary attribute lookup ([39803a8](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/39803a835c87d96d7ae163a21243084ce298a6fe)) +* basic attributes applied but not added ([3808eed](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/3808eedec2d825008e457aeda6441264b4bf439a)) +* basic attributes not updated from XML attributes ([5a95dcd](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/5a95dcd6cd9689155c43dae02a5c3b5a04ace937)) +* build service is not unbound even after application exit ([c9af7f1](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/c9af7f1ccb87147791699fece25b84c5d91c7e32)) +* build warnings due to jvmTarget not set properly for KotlinCompile tasks ([50fb3f4](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/50fb3f4b17b4c5317161e12543335ba40b7de0a1)) +* closed files are reopened on activity restart ([6dd8338](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/6dd8338b0b32e0dc03c6b7e8207cca26c5f3c12d)) +* code actions are not shown in editor ([9648447](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/96484478d3e770c4cbbe5bf4272b9d0d765683ee)) +* code actions are now shown sometimes ([dd3275d](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/dd3275d83bfede74e655a352653de005115cca3e)) +* color contrast issues ([47a9a89](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/47a9a89e6924b96ba694aaee9047ee43d958003a)) +* color schemes are always extracted ([edcb9c9](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/edcb9c91eb3b3bba73ac844a99352f34ad9a75a8)) +* color schemes are not properly applied to completion window ([8ddf4a9](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/8ddf4a92e8eec2e54859da6068bc7afa44f919d0)) +* configuration change in another activity re-triggers project initialization ([9126d01](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/9126d01fb74f78ed6fa41a2a05b574ebbcb98843)) +* crash due to invalid attribute reference ([903e307](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/903e3074af0269a560ee8fa382ef78f353cf2c1f)) +* crash in PreviewLayoutAction when opening a non-xml file (closes [#666](https://github.com/AndroidIDEOfficial/AndroidIDE/issues/666)) ([fdab10c](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/fdab10cc476ab72743220f24e81a922d39206fed)) +* crash on creating searching progress sheet while creating find in project dialog (closes [#676](https://github.com/AndroidIDEOfficial/AndroidIDE/issues/676)) ([efe3530](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/efe35306c74566e615df2607e0f54e9add1508ef)) +* crash selecting empty line while opening recently opened files ([c7791b2](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/c7791b25064b8484f1f4bb4ffddf7cef450b4e21)) +* crash when reorganizing the root inflated layout ([dfbe4d8](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/dfbe4d875d42219b26f4d8ddf8026a1c075fde51)) +* crash when undoing attribute addition ([70f48d4](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/70f48d4c20b29f22e7971123f04ea9cc6da8dedf)) +* **deps:** update dependency androidx.test.espresso:espresso-core to v3.5.1 ([#720](https://github.com/AndroidIDEOfficial/AndroidIDE/issues/720)) ([829d5bc](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/829d5bc9b6334c87d502885eb502317fbd036491)) +* **deps:** update dependency androidx.test.ext:junit to v1.1.5 ([#721](https://github.com/AndroidIDEOfficial/AndroidIDE/issues/721)) ([3b237ed](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/3b237ed631f3e29769413560779f8c7f3898a7dd)) +* **deps:** update dependency com.github.javaparser:javaparser-symbol-solver-core to v3.24.10 ([#707](https://github.com/AndroidIDEOfficial/AndroidIDE/issues/707)) ([696e17f](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/696e17f10f23943dd25e70fa31c0f39aa0409cae)) +* **deps:** update dependency com.google.auto.value:auto-value to v1.10.1 ([#695](https://github.com/AndroidIDEOfficial/AndroidIDE/issues/695)) ([a4a7ff0](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/a4a7ff030b3272abb7ae6e0f09ff1b54cf9c0d72)) +* **deps:** update dependency org.jetbrains:annotations to v23.1.0 ([#712](https://github.com/AndroidIDEOfficial/AndroidIDE/issues/712)) ([0ee1503](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/0ee1503ec375f754957dbef9c76b6e695e72d1f3)) +* **deps:** update dependency org.robolectric:robolectric to v4.9.2 ([#698](https://github.com/AndroidIDEOfficial/AndroidIDE/issues/698)) ([2bdf2e3](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/2bdf2e33f70d8e9a2a8127b708fb4f085ed876e4)) +* **deps:** update editor to v0.20.4 ([#699](https://github.com/AndroidIDEOfficial/AndroidIDE/issues/699)) ([67f0b31](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/67f0b3126148cc3e5c775f1d859367b084dcac07)) +* **deps:** update gradle to v7.6 ([da5c4d3](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/da5c4d3cd13ad7baf71980a6d4f35a7255808bf1)) +* **deps:** update Gradle to v7.6 to fix source set issues ([b4df9f8](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/b4df9f82b0d47a67a065385bee92654038c5465a)) +* disable jetifier ([4f27c31](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/4f27c315634e1d2d17860d6cfa0688bfdf3766c0)) +* do not accept drag for the same view ([4559dae](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/4559dae42bee3b96f23325d43eda739a0fb19f5f)) +* drag listener has too much sensitivity ([26e6f54](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/26e6f54645a0a321a1b6a9fb0b5ab92138627161)) +* duplicate 'idepref_about' preference key ([11dc12a](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/11dc12aaef25574a8d3a30d9444a570398df3f90)) +* editor overlapped by the SymbolInputView (closes [#589](https://github.com/AndroidIDEOfficial/AndroidIDE/issues/589)) ([908c79f](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/908c79f0b645aa6d42204305dcabb674bc12ca24)) +* **editor:** IllegalAccessError due to conflicting field name in CompletionItem ([ff11a49](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/ff11a49a14a30cece46c2576c6e312776f0fc641)) +* **editor:** NPE trying to get ILanguageClient from null ILanguageServer ([2d1815c](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/2d1815c5c524db6f1b50451fe0cb04ac34576cce)) +* error message is not shown when git clone fails ([4fd85d0](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/4fd85d09dd8fe9bcea2d771c48937bffeaa903a7)) +* fix UndoManager tests ([af2cfa8](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/af2cfa868509360f8b3bd60bbf6d8b12d01f448f)) +* git clone does not cancel even when 'Cancel' button is clicked (closes [#653](https://github.com/AndroidIDEOfficial/AndroidIDE/issues/653)) ([602db36](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/602db3602540ce5f8685bb0c969853faf307958f)) +* improve completion popup position in attribute value editor ([e057284](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/e05728451f6b4a120e4e11daaf061d17de2aecd9)) +* inconsistent background color in view info sheet ([903a572](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/903a572cd99987818db076ee6c921eb8e4b090f4)) +* inconsistent status bar color ([d8843ce](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/d8843ce8c8d07a3e51fb0e9cd68c9a59b2596a16)) +* inconsistent system bar colors in terminal activity ([f8ab310](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/f8ab3101f9e3eea1deda7d6c80fb04d5bc358009)) +* IndexOutOfBoundsException in IDEEditor.validateRange ([9cfb0ce](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/9cfb0cecce7e9f2ed4ed5d1ef17543d84ea2228a)) +* invalid color scheme in ShowXmlActivity ([7085180](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/708518052e54f3558731882f1bc6118b962ab92c)) +* lag when run tasks dialog is opened ([745fc60](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/745fc60cce139eb7d136ee474b7b8c428fa2e032)), closes [#584](https://github.com/AndroidIDEOfficial/AndroidIDE/issues/584) +* layout files is custom resource directories are not previewable ([e5588e9](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/e5588e9fafe935fd1aa6678d2ab1fcb205e236d4)) +* layout hierarchy view is not scrollable ([0d9e69b](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/0d9e69bb89003259ba76b686b833287204275114)) +* listeners and foreground is added again when moving views ([ba1d953](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/ba1d95323fe856cbe4dec23412b7e15bc06784ab)) +* navigation bar color is not changed in UI designer ([8aab8bf](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/8aab8bf3dc6516883ed3b77cb6e2335f5fb52eca)) +* newly added TextView has android:text attribute by default ([7d70fde](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/7d70fde7c03b7371809e9c7b9029026a4fd6af28)) +* newly added views do not have proper foreground ([a33862d](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/a33862da5549114a1cd486cc37e1e03d5b99557c)) +* no views error is shown even when views have been added ([0700b70](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/0700b70e2e9aaddf5da52549856b5c99ff5a40ce)) +* NPE when dropping views into workspace ([016cd62](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/016cd623af0e855f8ed95e6ecd62b1d8709db7e4)) +* occasional lag when saving XML files ([1138520](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/11385205d3957192b3ee7276f1824dfe6011ac8f)) +* options menu in editor is not updated after build execution ([56a52d4](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/56a52d4b39a22faf2b837ab5edb75b6e3b530865)) +* parent highlight state not updated on widget drop ([06c4f67](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/06c4f67f179def5c69e8a74bbdf1e5f8e3249edc)) +* partially revert 9126d01fb74f78ed6fa41a2a05b574ebbcb98843 to fix tests ([c09a87e](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/c09a87e3d1b0a9eb07c4cb2a6a9268e072362be4)) +* partially revert e213fbb1 ([a04f4db](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/a04f4db5382e4df08d56bc681d48df02de537ecf)) +* path issue in tests ([5660615](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/566061565d23a8ef848a07d54483bd2df7a4844f)) +* preferences fragment is recreated after configuration change ([b676ceb](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/b676ceb6078031bac1b82b7af8b3cf380a260356)) +* project initialization does not start if the project is closed and reopened quickly ([d97ba5e](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/d97ba5e415dc8378d5cebee16637fe62470c4e85)) +* pseudolocale nested tags ([2fcb9dd](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/2fcb9dd71ac6a643e21d435599b9a034e4453e62)) +* R.jar completions are not updated after resource updates ([fe12c2c](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/fe12c2c10613407c673093b175f74dce5a44ecc1)) +* reset build related viewModel properties when destroying editor activity ([0167452](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/0167452b201fd2e3269ee0faa9f7f0e70b3e3132)) +* ServiceRegisteredException in ToolingServerRunner ([117752e](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/117752ef5f13e41ed3f6e4f6a008e9bfc94ffed5)) +* startParse() not called ([c2c21c5](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/c2c21c5b948f75eb521c05eae982187683cd87b7)) +* StringIndexOutOfBoundsException while setting selection range for recently opened files ([ef50985](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/ef5098575a6531d911c42369a4ee16ead63aa21a)), closes [#681](https://github.com/AndroidIDEOfficial/AndroidIDE/issues/681) +* test color schemes ([ac78d70](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/ac78d70f43c087b41d9f92a9b3dfe6a1e6679d58)) +* test compilation error ([07fb230](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/07fb2300ad59fbb3f639ad231dd86b3cda8d3fca)) +* test compilation issue ([429421f](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/429421f2986158d5b2b347dd773533e82dd0773f)) +* **tests:** compilation issue ([da74ffc](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/da74ffc91853cd589c8d55b84c67c9d938b9cb1e)) +* **uidesigner:** end tag element is not indented in generated XML ([a0311c3](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/a0311c3098ac13ba71e59f394d40ac809d5676e8)) +* **uidesigner:** incorrect child count computation in hierarchy layout ([3f97b7c](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/3f97b7cf6ce4d81e4a4739bfb905ecbcddce0b82)) +* **uidesigner:** only one line is copied in ShowXmlActivity ([7398b58](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/7398b58d925108b998b838ce682fc2351fa591fa)) +* **uidesigner:** view info sheet is not dismissed when selected view is deleted ([956f76d](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/956f76dc159d8687954f34aa6bf0afba7367277b)) +* use ViewCompat for starting drag and drop ([fbabb19](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/fbabb19708416db69ade69af7d6c574497114ded)) +* view info sheet is not dismissed when view is deleted ([ec025c5](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/ec025c5c76f7c659f87d5711a7230cbd062f0075)) +* views are setup multiple times when inflating ([e58f287](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/e58f28735822dae1c28b09471d92a3c1a7c31182)) +* widget drop index is always actualDropIndex - 1 ([80a421c](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/80a421cc4843ea3246c1ffb364df0fbf33087999)) +* **xml-inflater:** fix typo in IViewGroup.canAcceptChild() ([42b3d46](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/42b3d463c78bc974118bf4919bb2ad3a3e2a3472)) + + +### Code Refactoring + +* move EditorActivity logic to base classes ([d16c09f](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/d16c09fb188049f1120c6fa25a688115f41c03ba)) + + +### Features + +* add ability to remove attributes from views ([c4cb67f](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/c4cb67fc184e839b100e390237cabb00573c98fe)) +* add API to listen for IView attribute changes ([e8fda92](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/e8fda92985ffb4b0a2a69ee2723f9abda1fa0d0e)) +* add basic drag and drop ([58cb8bf](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/58cb8bf45ac49fd6eed057c1d2195b881279a682)) +* add basic implementation of UndoManager for UI Designer ([140aec0](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/140aec072a4d82a0e13c6770d60086fca0f41cfc)) +* add basic layout for attribute value editor ([f04e2b4](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/f04e2b44e8fbf0dfdfde65ef62320d783bf7eb61)) +* add basic support for handling configuration changes ([9235885](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/9235885c682d38ed02440bb20b4691c1a0504f99)) +* add code block lines query for XML language ([89ff283](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/89ff28319899ad97f7ecb487237bc4ec2d1d3187)) +* add color IDs for configuration the completion window ([4beaf58](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/4beaf584564dd7c582afeecdab9c1e951ae941c7)) +* add completions for attribute value in UI Designer ([8fdf930](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/8fdf930ae9227a20a8258fc8261b94412a45de4e)) +* add custom IView implementation for UI Designer ([e407ff6](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/e407ff6633de9e7a8b9edbf094c3302d4f92db3a)) +* add default dark color scheme ([3688ad7](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/3688ad7592ba93e0e369e87c6224424c46be62fa)) +* add indentation support for XML language ([88db257](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/88db25767a51276fb46cf5fc2239c631cd2f4266)) +* add indentation support in TreeSitterLanguage ([3db99be](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/3db99be59993d57f0408746675da251ab02d9c29)) +* add initial padding when creating drag and drop layouts ([8fcd844](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/8fcd844f80c7c663fb0bc0da9fbd4353e772c558)) +* add LSP support in TreeSitterLanguage ([7facb96](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/7facb96a4318686ec52e5ec7a53c3a218b9e2552)) +* add missing editor color scheme ids ([691b630](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/691b630a5a5018f17a484f5046ade01404a12a76)) +* add option to clone git repository ([#632](https://github.com/AndroidIDEOfficial/AndroidIDE/issues/632)) ([b6afb51](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/b6afb516cb721ef2c0a3ad39a2c15fbdeb794285)) +* add option to see generated XML directly from UI Designer ([1ff2658](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/1ff2658d1f6a17595659fadf4f374b5ade1645c4)) +* add preference to choose color schemes ([a18d857](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/a18d85726809b4208cbe693651c1fec745b288c8)) +* add preference to switch UI mode ([5521bb3](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/5521bb37b85dfb1c13c4df404007f568c6c2cd98)) +* add preference to toggle dynamic colors ([2eb05af](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/2eb05af11aea0719c5154e30baef12fbfc2e4196)) +* add support for editor scheme file reference in JSON color scheme ([257c5f5](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/257c5f5bdf3355a026c6f08f9c0f55145e070297)) +* add support for language file references in color scheme files ([e05d761](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/e05d7610af281d3b25dcbee1e74139276715a768)) +* add tree-sitter language for XML ([4e621f7](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/4e621f7150ce590cd23d46fca818a529c3d76a5c)) +* add TreeSitterLanguage implementation for editor ([53f3ada](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/53f3ada14b7e3fc5c119854fe563223334d0ac4e)) +* add undo redo actions in UI Designer ([f1abb07](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/f1abb0711049d73839b84dc2fd97182880ff5002)) +* add undo/redo support for view attributes ([f14030e](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/f14030e542e6d445f4061bd2620b16687cbb0809)) +* add view info bottom sheet in UI Designer ([d98d0c9](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/d98d0c90a3bec6db75057964b0409a74a38834e0)) +* added basic layout preview ([5da73f1](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/5da73f110f87e4d99a25a8334633fed6f1e71f5a)) +* added empty project without AndroidX library ([#620](https://github.com/AndroidIDEOfficial/AndroidIDE/issues/620)) ([bf6ced8](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/bf6ced8c596c19773fb8df8ef82816e8fdcff991)) +* added support for and tags ([87ae3a5](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/87ae3a5cb691d5428f30f02a71eac63cac13277c)) +* animate hierarchy change ([0971a44](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/0971a446edc2bd144cf478dd870648d41a670be3)) +* API to create instances of IDEEditor from other modules ([1cb6c1a](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/1cb6c1a0057f22199783da5fee056cab03ecd9d3)) +* apply attributes on to included root layout ([bf96f08](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/bf96f085e63f4973c758b83e32c5c4cc6a148ca1)) +* apply new attribute value when changed in UI designer ([167ed67](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/167ed6713c4632457e23f9bbc674bea9e731cc5e)) +* automatically switch between light and dark variants of a color scheme ([dd21251](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/dd212514e8c8416b35893169a04c6e742419aee3)) +* categorize general preferences ([777cc17](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/777cc1780ae019b655682de20bb5604943233084)) +* center main activity actions ([8a683d1](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/8a683d17bf221a216b71bc8538c5580ed503609d)) +* change tint color for view info actions ([d782751](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/d78275164b885a13bc4bcae34d08457da35e82da)) +* clear registered actions before re-registrations ([9411c67](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/9411c672fc09f8c63966e8ff2ed87a74420bbee9)) +* collapsible widget list in UI Designer ([088721d](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/088721d7c8fb5dcad261d90ba7372d82e34b875b)) +* complete constant dimension values in XML files ([7d14ae4](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/7d14ae48c233a8ac76d0a63240ac08b9750edddd)) +* define interface for IViewAdapterIndex to resolve unresolved references in UI designer ([1ee192f](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/1ee192f3144f687d6246d64c3faaedf58e4b9ff8)) +* do not create XMLLanguage reflectively in UI Designer ([4f33807](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/4f33807e8a65da74b63b9254c32684124b03ba7f)) +* do not set drag listener to view groups which cannot accept children ([c25f7ab](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/c25f7ab3425b80cb8903f7626726b7e2d64546db)) +* dynamic colors in UI Designer ([24bab22](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/24bab22ddbca7db7e520360c542d85792eb87324)) +* dynamic colors support ([7c467dd](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/7c467ddc3fb3391db90f14c6b96ea70dccf0bbd3)) +* **editor:** add JSON color scheme parser ([b1abee8](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/b1abee8ba610faa243be008550a792a4a6684a14)) +* extract color schemes based on scheme.version property ([20ef62f](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/20ef62f4fee05decd1ad432d2b9916f6ec6bf395)) +* extract color schemes only if 'scheme.prop' file does not exist ([fcce7e8](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/fcce7e804bc8bdab83b0804576de24d89f0f1a72)) +* handle error in case current color scheme cannot be parsed ([9856066](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/9856066c4158f37c3995649082450597761d1e5a)) +* hide 'Show XML' action if not views has been inflated ([0bc184f](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/0bc184fb8fdb0a67ae4659e1b6afc2c7f1d7c318)) +* improved error handling in case color scheme cannot be parsed ([b57eb26](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/b57eb26fbefc3aa43029a20e2c94fb9c8d67e185)) +* include view module namespace in IViewAdapter ([341931c](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/341931c902df49e60f5d710b78a54e92155a4687)) +* include view superclass hierarchy in IViewAdapter ([6caadeb](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/6caadebd91a43945abdc7deb51a959096bfbff56)) +* initialize and destroy color schemes in editor activity ([e213fbb](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/e213fbb1e3a7aa59a5224a5a0115bfbc67d741c9)) +* italicize Java comment in default scheme ([93ab1dd](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/93ab1dd1f9d9723bf0f0f721a81dd7b1de6febef)) +* maintain insertion and inflation order of ActionItems ([aea356f](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/aea356f26c8f6789eaca0ca25a6b55e4d16c6e89)) +* moved project info destruction logic to ProjectManager ([a8247e7](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/a8247e75e2232dd4866a62de11eaa7dd2a2027ca)) +* option to add attributes to an inflated view ([dbd0e5b](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/dbd0e5b4ba672e7ea472dca45f1b3b7d74a69c77)) +* permit dynamic mnc qualifier values ([c7b4ad8](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/c7b4ad8a62d33bb7915d59704e3bc0713f2ebb1c)) +* prevent multiple touch slop computation ([b4881d8](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/b4881d8d1d60f9e6023a9b8fadeb6570480d69f1)) +* replaced quick action menu with popup menu ([f3bba11](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/f3bba1186dc24cd2cf2746b6f88755f82477114b)) +* require 'scheme.name' in color schemes ([1adf297](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/1adf2971b1cb60d3d1f8d6bac4d16463ded05c85)) +* require version code in color scheme props ([2a8d4bc](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/2a8d4bc0baa797d70b8265beb38d39c7bb4e1b66)) +* restore opened files when project is reopened ([aed7853](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/aed7853e25bfc676ddc6e3794a8d4e294d17d4c1)) +* run build workflow on colorschemes branch ([19f35e2](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/19f35e2b938e6f868e65f3fa173ad1a2a39d2559)) +* show text when no views have been added to workspace ([5a46104](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/5a461042f6077cecd37a7e6a69cfa1d49db3fcfb)) +* store color IDs for color values ([2eb4603](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/2eb4603ed0272a5fc666dc53473fa53d858b7d9b)) +* support for multiple color schemes ([2b676eb](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/2b676eb988cbc6513bc586662810d5d67e260695)) +* **uidesigner,xml-inflater:** add support for MultiAutoCompleteTextView ([f20a2ac](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/f20a2acdb6eb60d7bdf4cd80e71357b99ba7e489)) +* **uidesigner,xml-inflater:** add support for RadioGroup ([54be1ea](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/54be1eab4181a00c06af703a0d34ec1f827903dd)) +* **uidesigner,xml-inflater:** add support for vertical and horizontal scroll views ([74d7ada](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/74d7ada354dad38288bcd40ff73858cb26d433e1)) +* **uidesigner,xml-inflater:** automate process of adding widgets in UI Designer with annotations ([aeb3146](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/aeb314624f41d029329e89d1744cb3451eb46cd3)) +* **uidesigner:** add action to open view hierarchy layout ([d19557e](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/d19557e973f590bbbe6c275b1b22324adc008276)) +* **uidesigner:** add view hierarchy layout in UI designer ([5fb200a](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/5fb200aadaa82cb6b364798a4c459d99a06f38af)) +* **uidesigner:** allow IViewGroup implementations to accept or reject a child in drag events ([369a0ad](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/369a0ad904ad07566bec945a2521aef566fcad42)) +* **uidesigner:** implement copy function in ShowXmlActivity ([a042b82](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/a042b82579caa68e0550a262b6366857a30f9158)) +* **uidesigner:** provide generated XML to EditorActivity when user exists UI Designer ([5f7b1fb](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/5f7b1fb0f05387a5f1a332709f84c16f4aa8ef27)) +* **uidesigner:** show view info on hierarchy text click ([f7dfe35](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/f7dfe3515b3d6d83cad0503b1b544cbb672d824b)) +* **uidesigner:** use navigation component to navigate between fragments ([a959f78](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/a959f78d3840a177f885307ecd0e6949dee46fe1)) +* update attribute value in list when updated ([31ee94e](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/31ee94ed4ff56e8cf755b2345cc271c565208fbb)) +* update completion window background ([1b8110c](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/1b8110c61d6e86f09df6de8a52c5918962f95a33)) +* update default AndroidIDE theme ([29860ad](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/29860ad3a7885675421d6b755a0a8a653d6c1f8e)) +* update default dark color scheme ([61fedd9](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/61fedd91c2d951709e041d06038493ba4e4f3b78)) +* update default java color scheme ([55a090d](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/55a090dd6da86a65144edce7064429df5cc31b76)) +* update default light color scheme ([9ee0c43](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/9ee0c43efe21b676b67dec49fd729bc3a3684cf7)) +* update default scheme and update editor to v0.20.2 ([6e4b1cd](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/6e4b1cd8c6b536dca5e616a9e49764641160d0a5)) +* update location ids for ActionItem ([eab7ca9](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/eab7ca9d954b305f616fcaeb41dd149cb18fed15)) +* update navigation bar color dynamically ([809913f](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/809913f37cdec1f9bf35fb674cd74c193d5fa6bc)) +* update selected text background color in default scheme ([06fecb9](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/06fecb9476960b50eff1434deef94cd78f89c776)) +* update translations ([#631](https://github.com/AndroidIDEOfficial/AndroidIDE/issues/631)) ([2574586](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/2574586c7e85842b8316b6f6eee96eefaa9a54c6)) +* update view index computation logic ([9ba0257](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/9ba025758956df49da371f6abc6bc3162c7fe004)) +* updated AGP to version 7.4.0-rc01 ([b086283](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/b086283f56729604aa3967ac434776ec890f95e7)) +* updated default color scheme ([edfed37](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/edfed3730b18447f425cd765015ac65ddb51a00e)) +* updated translations ([#626](https://github.com/AndroidIDEOfficial/AndroidIDE/issues/626)) ([067596b](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/067596b9dccc30f88d96c990677d7e2161da9279)) +* updated TreeSitterLanguage implementation ([d4c787e](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/d4c787ec28ef35d9bec5979fd3ede18bbb17285a)) +* use attribute handlers to apply attributes in IViewAdapter ([97193ca](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/97193ca11d113c91ae4913f91aa499d5ad87fb53)) +* use Gradle ANTLR plugin to generate lexers ([3090632](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/3090632c66ee15be8841ec6631281b354200ab6c)) +* use Kotlin Symbol Processor to generate IViewAdapterIndex implementation ([34e09dc](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/34e09dc0d437bd3a1f17cf573a01d162bdaf232b)) +* use MaterialSharedAxis for bottom bar visibility change transitions ([e072bbb](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/e072bbbc6464035b04744ef0d3f5bf5c95755915)) +* use saved instance state to retrive project initialization state ([bce589c](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/bce589ce29001d2df58cd929f7e190d438e6de21)) +* validate range with editor before applying selection ([c2523e0](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/c2523e0f5105a81bdbc982efcd400bb20fb48a79)) +* **xml-inflater:** fallback to default values in case attribute value is empty ([4630002](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/46300029ba2067bffcf9184d5af5a55768d444a8)) +* **xml-inflater:** replace unsupported views/layouts with error views ([9138244](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/91382440c7e668821c8dde3110c8cc2940a094bc)) +* **xml-inflater:** require view adapters to be non-final ([006b110](https://github.com/AndroidIDEOfficial/AndroidIDE/commit/006b1105c938b6f4ed33aae66efd8077e6f105b9)) + + +### BREAKING CHANGES + +* This moves the logic for various editor activity function to base classes ProjectHandlerActivity and EditorHandlerActivity + + + diff --git a/changelogs/v2.1.4-beta.md b/changelogs/v2.1.4-beta.md new file mode 100644 index 000000000..c20eaafc9 --- /dev/null +++ b/changelogs/v2.1.4-beta.md @@ -0,0 +1,31 @@ +# **AndroidIDE v2.1.4-beta** + +This release improves the UI Designer, adds support for custom custom color schemes in editor, uses tree sitter for syntax highlighting and much more. + +## Important notes +- Enjoy an experience closer to your device with Dynamic colors support in AndroidIDE. This is enabled by default but can be disabled in IDE preferences. +- The IDE now has a light theme. The light/dark theme is automatically used based on your system theme. However, you can switch to other theme in IDE preferences. +- The IDE now supports custom color schemes for Java and XML languages. The color schemes can be customized by editing the files in `$HOME/.androidide/editor/schemes` folder. +- The UI designer has been rewritten from scratch. It now has better support to resource resolution, support for more views, undo/redo support, etc. + +## Additions +- Light IDE theme. +- Material You (dynamic colors) support. +- Support for custom color schemes. +- Empty project template without AndroidX libraries. Thanks to @Rystars (#620). +- Option to clone Git repository. Thanks to @Deenu143 (#632). + +## Fixes + +The following issues has been fixed : + +- Activity is restarted when it is not focused during installation process (#628). +- NPE when appending log lines (#605). +- Editor is overlapped by SymbolInputView (#589). +- Crash in when clicking the `Preview layout` action and a non-XML file is opened (#666). +- R.jar completions are not updated after resource updates. + +## Improvements +- Replaced file tab actions' `quick action menu` with `PopupMenu`. +- Improved transitions for bottom bar in editor activity. +- Updated translations. Thanks to all Crowdin contributors. \ No newline at end of file diff --git a/editor/src/main/java/com/itsaky/androidide/editor/language/cpp/CppLanguage.java b/editor/src/main/java/com/itsaky/androidide/editor/language/cpp/CppLanguage.java index 3686003b4..b69e94756 100644 --- a/editor/src/main/java/com/itsaky/androidide/editor/language/cpp/CppLanguage.java +++ b/editor/src/main/java/com/itsaky/androidide/editor/language/cpp/CppLanguage.java @@ -20,9 +20,9 @@ import android.os.Bundle; import androidx.annotation.NonNull; -import com.itsaky.androidide.editor.language.BraceHandler; -import com.itsaky.androidide.editor.language.CommonSymbolPairs; +import com.itsaky.androidide.editor.language.utils.CommonSymbolPairs; import com.itsaky.androidide.editor.language.IDELanguage; +import com.itsaky.androidide.editor.language.utils.CStyleBracketsHandler; import com.itsaky.androidide.lexers.cpp.CPP14Lexer; import com.itsaky.androidide.utils.ILogger; @@ -43,7 +43,7 @@ public class CppLanguage extends IDELanguage { private static final ILogger LOG = ILogger.newInstance("CppLanguage"); private final NewlineHandler[] newlineHandlers = - new NewlineHandler[] {new BraceHandler(this::getIndentAdvance, this::useTab)}; + new NewlineHandler[] {new CStyleBracketsHandler(this::getIndentAdvance, this::useTab)}; private final CommonSymbolPairs symbolPairs = new CommonSymbolPairs(); private CppAnalyzer analyzer; diff --git a/editor/src/main/java/com/itsaky/androidide/editor/language/groovy/GroovyLanguage.java b/editor/src/main/java/com/itsaky/androidide/editor/language/groovy/GroovyLanguage.java index 50def6406..d8f747a5e 100755 --- a/editor/src/main/java/com/itsaky/androidide/editor/language/groovy/GroovyLanguage.java +++ b/editor/src/main/java/com/itsaky/androidide/editor/language/groovy/GroovyLanguage.java @@ -20,9 +20,10 @@ import android.os.Bundle; import androidx.annotation.NonNull; -import com.itsaky.androidide.editor.language.CommonSymbolPairs; +import com.itsaky.androidide.editor.language.utils.CStyleBracketsHandler; +import com.itsaky.androidide.editor.language.utils.CommonSymbolPairs; import com.itsaky.androidide.editor.language.IDELanguage; -import com.itsaky.androidide.editor.language.BraceHandler; +import com.itsaky.androidide.editor.language.utils.BracketsNewlineHandler; import com.itsaky.androidide.lexers.groovy.GroovyLexer; import com.itsaky.androidide.utils.CharSequenceReader; import com.itsaky.androidide.utils.ILogger; @@ -46,7 +47,7 @@ public class GroovyLanguage extends IDELanguage { private final GroovyAnalyzer analyzer; private final GroovyAutoComplete completer; private final NewlineHandler[] newlineHandlers = - new NewlineHandler[] {new BraceHandler(this::getIndentAdvance, this::useTab)}; + new NewlineHandler[] {new CStyleBracketsHandler(this::getIndentAdvance, this::useTab)}; private final CommonSymbolPairs symbolPairs = new CommonSymbolPairs(); public GroovyLanguage() { diff --git a/editor/src/main/java/com/itsaky/androidide/editor/language/java/JavaLanguage.kt b/editor/src/main/java/com/itsaky/androidide/editor/language/java/JavaLanguage.kt index 478b2402c..555ff1144 100644 --- a/editor/src/main/java/com/itsaky/androidide/editor/language/java/JavaLanguage.kt +++ b/editor/src/main/java/com/itsaky/androidide/editor/language/java/JavaLanguage.kt @@ -18,15 +18,14 @@ package com.itsaky.androidide.editor.language.java import android.content.Context -import com.itsaky.androidide.editor.language.BraceHandler -import com.itsaky.androidide.editor.language.CommonSymbolPairs +import com.itsaky.androidide.editor.language.utils.CommonSymbolPairs import com.itsaky.androidide.editor.language.treesitter.TreeSitterLanguage +import com.itsaky.androidide.editor.language.utils.CStyleBracketsHandler import com.itsaky.androidide.lsp.api.ILanguageServer import com.itsaky.androidide.lsp.api.ILanguageServerRegistry import com.itsaky.androidide.lsp.java.JavaLanguageServer import com.itsaky.androidide.treesitter.java.TSLanguageJava import io.github.rosemoe.sora.lang.smartEnter.NewlineHandler -import io.github.rosemoe.sora.text.ContentReference import io.github.rosemoe.sora.util.MyCharacter import io.github.rosemoe.sora.widget.SymbolPairMatch @@ -59,7 +58,7 @@ class JavaLanguage(context: Context) : } override fun getNewlineHandlers(): Array { - return arrayOf(BraceHandler({ line -> this.getIndentAdvance(line!!) }) { useTab() }) + return arrayOf(CStyleBracketsHandler({ line -> this.getIndentAdvance(line!!) }) { useTab() }) } internal open class JavaSymbolPairs : CommonSymbolPairs() { diff --git a/editor/src/main/java/com/itsaky/androidide/editor/language/kotlin/KotlinLanguage.java b/editor/src/main/java/com/itsaky/androidide/editor/language/kotlin/KotlinLanguage.java index f506e31e5..f440ee7f7 100644 --- a/editor/src/main/java/com/itsaky/androidide/editor/language/kotlin/KotlinLanguage.java +++ b/editor/src/main/java/com/itsaky/androidide/editor/language/kotlin/KotlinLanguage.java @@ -20,8 +20,9 @@ import android.os.Bundle; import androidx.annotation.NonNull; -import com.itsaky.androidide.editor.language.BraceHandler; -import com.itsaky.androidide.editor.language.CommonSymbolPairs; +import com.itsaky.androidide.editor.language.utils.BracketsNewlineHandler; +import com.itsaky.androidide.editor.language.utils.CStyleBracketsHandler; +import com.itsaky.androidide.editor.language.utils.CommonSymbolPairs; import com.itsaky.androidide.editor.language.IDELanguage; import com.itsaky.androidide.editor.language.java.JavaLanguage; import com.itsaky.androidide.lexers.kotlin.KotlinLexer; @@ -45,8 +46,7 @@ public class KotlinLanguage extends IDELanguage { private static final ILogger LOG = ILogger.newInstance("KotlinLanguage"); private final NewlineHandler[] newlineHandlers = - new NewlineHandler[] {new BraceHandler(this::getIndentAdvance, this::useTab)}; - private final CommonSymbolPairs symbolPairs = new KotlinSymbolPairs(); + new NewlineHandler[] {new CStyleBracketsHandler(this::getIndentAdvance, this::useTab)}; private KotlinAnalyzer analyzer; public KotlinLanguage() { diff --git a/editor/src/main/java/com/itsaky/androidide/editor/language/treesitter/TreeSitterLanguage.kt b/editor/src/main/java/com/itsaky/androidide/editor/language/treesitter/TreeSitterLanguage.kt index 7de3262aa..34bab0b43 100644 --- a/editor/src/main/java/com/itsaky/androidide/editor/language/treesitter/TreeSitterLanguage.kt +++ b/editor/src/main/java/com/itsaky/androidide/editor/language/treesitter/TreeSitterLanguage.kt @@ -18,7 +18,7 @@ package com.itsaky.androidide.editor.language.treesitter import android.content.Context -import com.itsaky.androidide.editor.language.CommonSymbolPairs +import com.itsaky.androidide.editor.language.utils.CommonSymbolPairs import com.itsaky.androidide.editor.language.IDELanguage import com.itsaky.androidide.editor.schemes.IDEColorScheme import com.itsaky.androidide.editor.schemes.IDEColorSchemeProvider diff --git a/editor/src/main/java/com/itsaky/androidide/editor/language/BraceHandler.kt b/editor/src/main/java/com/itsaky/androidide/editor/language/utils/BracketsNewlineHandler.kt similarity index 86% rename from editor/src/main/java/com/itsaky/androidide/editor/language/BraceHandler.kt rename to editor/src/main/java/com/itsaky/androidide/editor/language/utils/BracketsNewlineHandler.kt index 321719bbc..aeda26b02 100644 --- a/editor/src/main/java/com/itsaky/androidide/editor/language/BraceHandler.kt +++ b/editor/src/main/java/com/itsaky/androidide/editor/language/utils/BracketsNewlineHandler.kt @@ -15,7 +15,7 @@ * along with AndroidIDE. If not, see . */ -package com.itsaky.androidide.editor.language +package com.itsaky.androidide.editor.language.utils import io.github.rosemoe.sora.lang.smartEnter.NewlineHandleResult import io.github.rosemoe.sora.lang.smartEnter.NewlineHandler @@ -27,12 +27,16 @@ import io.github.rosemoe.sora.text.TextUtils import kotlin.math.max import kotlin.math.min -internal class BraceHandler(val getIndentAdvance : (String?) -> Int, val useTab: () -> Boolean) : NewlineHandler { +internal open class BracketsNewlineHandler(val getIndentAdvance : (String?) -> Int, val useTab: () -> Boolean) : NewlineHandler { + + protected val openingBrackets = mutableListOf("{") + protected val closingBrackets = mutableListOf("}") + override fun matchesRequirement(text: Content, position: CharPosition, style: Styles?): Boolean { val line = text.getLine(position.line) return !StylesUtils.checkNoCompletion(style, position) && - (getNonEmptyTextBefore(line, position.column, 1) == "{") && - (getNonEmptyTextAfter(line, position.column, 1) == "}") + (getNonEmptyTextBefore(line, position.column, 1) in openingBrackets) && + (getNonEmptyTextAfter(line, position.column, 1) in closingBrackets) } override fun handleNewline( diff --git a/editor/src/main/java/com/itsaky/androidide/editor/language/utils/CStyleBracketsHandler.kt b/editor/src/main/java/com/itsaky/androidide/editor/language/utils/CStyleBracketsHandler.kt new file mode 100644 index 000000000..ebb7a3807 --- /dev/null +++ b/editor/src/main/java/com/itsaky/androidide/editor/language/utils/CStyleBracketsHandler.kt @@ -0,0 +1,34 @@ +/* + * This file is part of AndroidIDE. + * + * AndroidIDE is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * AndroidIDE is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with AndroidIDE. If not, see . + */ + +package com.itsaky.androidide.editor.language.utils + +/** + * Newline handler for brackets in Java language. + * + * @author Akash Yadav + */ +internal class CStyleBracketsHandler( + getIndentAdvance: (String?) -> Int, + useTab: () -> Boolean +) : BracketsNewlineHandler(getIndentAdvance, useTab) { + + init { + openingBrackets.add("(") + closingBrackets.add(")") + } +} diff --git a/editor/src/main/java/com/itsaky/androidide/editor/language/CommonSymbolPairs.kt b/editor/src/main/java/com/itsaky/androidide/editor/language/utils/CommonSymbolPairs.kt similarity index 96% rename from editor/src/main/java/com/itsaky/androidide/editor/language/CommonSymbolPairs.kt rename to editor/src/main/java/com/itsaky/androidide/editor/language/utils/CommonSymbolPairs.kt index d958f8e6a..c770eb717 100644 --- a/editor/src/main/java/com/itsaky/androidide/editor/language/CommonSymbolPairs.kt +++ b/editor/src/main/java/com/itsaky/androidide/editor/language/utils/CommonSymbolPairs.kt @@ -15,7 +15,7 @@ * along with AndroidIDE. If not, see . */ -package com.itsaky.androidide.editor.language +package com.itsaky.androidide.editor.language.utils import io.github.rosemoe.sora.text.Content import io.github.rosemoe.sora.widget.SymbolPairMatch