Is there any way to seperate Glance import and Com...
# compose
c
Is there any way to seperate Glance import and Compose import? I always need to select one of them when I code... I also make Widget so I use both of them.
k
You can use import aliases
Copy code
import org.example.Message // Message is accessible
import org.test.Message as testMessage // testMessage stands for 'org.test.Message'
m
i think the best is having seperate modules for app and widget 🙂
c
Well, I can't' do the aliases in all the kt files.
And at the moment, I can't seperate the modules
k
Use fully qualified class names. There's not a lot of options here
c
What do you mean? fully qualified class names?
Compose library and Glance library have the same names.
k
Perhaps I misunderstand the question. Can you show a snippet of your code?
c
For example, in compose library, There's
Text
, and in the Glance library, it also has
Text
. So, when I code, I sometimes, select it from Glance library that I didn't mean it. It disturbs me a lot..
k
But they are not in the same package
What do you mean by "separate"? Use them in the same file? Not see one of them in auto complete?
c
It shows like this, and I select Glance one by mistake.
And then I need to correct it again to the Compose one.
seperate means, Mustafa Ozhan suggested and I also considered. But the widget part is not my work. So, I don't want to touch that.
Hmm maybe if the Compose library is always on the top in the auto select box. Then, there would be less mistakes
k
I still don't understand what you want. To not see glance composables in auto complete at all? To not see them when you edit a particular file? To change how intellij / studio lists available functions in that auto complete pop-up?
c
If I can hide it in the specific folder then, would be nice too.
because Compose is mostly used in view package.
m
His problem is, the project has both
compose
and
glance
library in same module so when he writes Text, Android studio start suggesting both Texts from both • androidx.glance.text.Text • androidx.compose.material3.Text
c
or if I can give name like the aliases in whole project. then, it would be nicer too.
Yes, right. And it's not only
Text
problem. I encounter in other names too.
ex. GlanceText or something..
m
It was enjoying me also but i seperate the modules and it is gone, since glance is now only in widget module. on the other hand in the picture you shared you can see the imports, that was how i was distinguished in the past, (the picture on the write at the bottom)
c
I see. I'm glad you suffered the same thing and share your idea. I might ask the maker to separate the module. Thank you!