I have created android studio module that is supposed to be a android ui framework. Framework has few components like custom buttons, custom layouts etc. and if I include it into app i can see them in palette under "Project"
Next steps in development is to enable user to import framework using gradle and I managed to to that using jfrog but when you import into your project you are not able to see components in palette.
I tried importing just .jar and .aar files but nothing happened. And if you write xml manually components are shown in preview window normally
here is git and jfrog
P.S.: keep in mind that project is still in development so git documentations is not full!
Thanks in advance, Leo
EDIT:
If you open new project you can import framework using gradle.
Just add:
maven {
url "https://cmykui.bintray.com/maven"
}
to your root build.gradle file and
implementation 'hr.foi.air2018.cmykui:cmykui:0.3.6'
to your app build.gradle
if you want to try out a component you can add
<hr.foi.air.cmykui.component.ButtonComponent
android:id="#+id/button"
android:layout_width="match_parent"
android:layout_height="50dp" />
to see if framework is imported.
I think this is an Android Studio problem. It doesn't show View subclasses in imported modules to the Project tab of Design panel of XML.
Reason 1.
Android Studio doesn't show View subclasses in dependencies to the Project tab of Design panel.
For example, even if implementation 'com.android.support:percent:28.0.0' exists in module(app) build.gradle, android.support.percent.PercentFrameLayout doesn't show up in the Project tab of design panel. As auto-complete prompts it in Text tab of the xml, indexer can find them. So, Android Stuidio should check them if it is a public View class or not and add to Project tab, but it doesn't.
Reason 2.
I also tried with a quite simple module which contains a View subclass. It is shown in development stage (having source codes in that module), but if once built and imported as aar, it isn't.
I've tried with this.
public class CustomView extends View
{
public CustomView(final Context context, #Nullable final AttributeSet attrs)
{
super(context, attrs);
}
}
I also checked with cmykui module in the question, but the result is same. If imported from Git with source code, it appears. If imported as aar , it doesn't.
Related
I wanted to make settings fragment for my app so I added preference dependency to my build.gradle
def preference_version = "1.1.1"
implementation "androidx.preference:preference:$preference_version"
implementation "androidx.preference:preference-ktx:$preference_version"
but when I want to use any class from this library in XML Layout like for example
<PreferenceScreen
xmlns:app="http://schemas.android.com/apk/res-auto">
<SwitchPreferenceCompat
app:key="notifications"
app:title="Enable message notifications"/>
<Preference
app:key="feedback"
app:title="Send feedback"
app:summary="Report technical issues or suggest new features"/>
</PreferenceScreen>
I'm getting errors:
Cannot resolve class PreferenceScreen
Cannot resolve class SwitchPreferenceCompat
Cannot resolve class Preference
I tried to build project after using /gradlew clean but nothing helped, I tried to use different versions of dependencies, different versions of gradle and use only dependency for java and only dependency for kotlin multiple times with different configurations but nothing helped. What is strange outside of XML files everything seems to work just fine and I can use classes from this library just fine, but I need to make layout with PreferenceScreen class and it's not recognising it.
Did you put the xml file under the "xml" folder?
It must be placed under "xml" folder not under "layout" folder
You have to use a PreferenceActivity and call the file with:
addPreferencesFromResource(R.xml.settings);
Official documentation: https://developer.android.com/guide/topics/ui/settings
I'm hoping to modularize an Android project so it will be easy to maintain in future use. I want to know whether its possible or not, to make an Android project used as a module within another Android project?
For example, let's say in my main android project I have three buttons for login, signup, forget password. and I have three separate projects for login, signup and forget password with their own views, activities and libraries. How can I use these separate android projects in the main Android project so when I click any of the three options in the main activity view so it will load the relevant view from those three module projects? (click the login button in the main view and load login view from the separate login project activities). I have tried to fiddle with build files and library module importing but couldn't do it. help me with saying if this approach is possible or not? if possible how to achieve it?
settings.gradle in root project include each project.
include ':loginApp'
include ':signupApp'
include ':resetpasswordApp'
project(':loginApp').projectDir = file('path/to/LoginApp')
project(':signupApp').projectDir = file('path/to/SignupApp')
project(':resetpasswordApp').projectDir = file('path/to/ResetpasswordApp')
build.gradle Of main module
implementation project(':loginApp')
implementation project(':signupApp')
implementation project(':resetpasswordApp')
Yes, it's possible.
Your current project is basically a module too. See the app folder.
An easy way is to create a new module (android library) with a different name from the current one which by default is app. Let's call it bigapp. This module will have all properties just like your app and you can select to run it from the debug configuration too.
Go to settings.gradle and ensure the file reads include ':app', ':bigapp'
To use the bigapp and call its functions, import it in your dependency. This will be the build.gradle file of the app module.
dependencies {
implementation project(":bigapp")
}
Lets now start the MainActivity from our app module
startActivity(new Intent(this, com.lucemanb.bigapp.MainActivity.class));
You can also import it at the top and simply call the MainActivity
import com.lucemanb.bigapp.MainActivity;
---
private void startActivity(){
startActivity(new Intent(this, MainActivity.class));
}
I'm using eclipse neon. I have created a maven project and create a package com.prueba.account and then I have created many packages inside.
But eclipse shows me all packages as an independent project and without the full path like in the image. Notice that checking package is inside com.prueba.account
Just Click on the Drop Down in Project explorer. All you need is to change Package presentation from Hierarchical to Flat.
Hope it helps !!!!
First of all, welcome to Stack Overflow Gary.
Then to extend on Adyas Answer:
In Eclipse there are two ways to display the package-structure.
Hierarchical :
And Flat:
I personally find the Hierarchical view way more convenient, for when you're working on a bigger project, you often get really long package names which, when in Flat view, might clutter the whole window.
But in the end, it's up to your personal taste.
The way to change between this two modes is to click on the down arrow icon at the top of the Project Explorer and under Package Presentation you can choose between the two.
Is it possible to change the default images of the import and export wizards in an Eclipse 3.x application? I do not mean the wizard image which can be configured in the wizard extension point but images in the surrounding wizard that shows up when calling for example:
IHandlerService service = (IHandlerService) PlatformUI.getWorkbench()
.getService(IHandlerService.class);
service.executeCommand(ActionFactory.IMPORT.getCommandId(), null);
There is an extension point for changing the default images for standard commands (save, save as, delete etc.): org.eclipse.ui.commandImages. However, I did not found something similar for the images in the import and export dialog (wizard and category icons)
(The application is an Eclipse 3.x RCP application running on Eclipse 4.4 using the compatibility layer.)
Thank you,
Michael
I'm not quite sure which images you mean. For the large images at the top of the wizard there is no support for this.
The Import/Export wizard (org.eclipse.ui.internal.dialogs.ImportExportWizard) gets the images from org.eclipse.ui.internal.WorkbenchImages.
The paths in WorkbenchImages are hard coded to be in the icons directory of the org.eclipse.ui plugin.
The images in the tree part of the wizard come from the individual import/export wizard extension point declaration.
As described in the accepted answer there is no official method to do this but it
is possible via the declareImage of the internal class org.eclipse.ui.internal.WorkbenchImages.
In my initialize of my WorkbenchAdvisor I replaced the shared images in the following way:
#SuppressWarnings("restriction")
public class MyWorkbenchAdvisor extends WorkbenchAdvisor {
...
#Override
public void initialize(IWorkbenchConfigurer conf) {
...
try {
// wizard icon
WorkbenchImages.declareImage(
IWorkbenchGraphicConstants.IMG_WIZBAN_IMPORT_WIZ,
<get image descriptor>, true);
// folder icon
WorkbenchImages.declareImage(
ISharedImages.IMG_OBJ_FOLDER,
<get image descriptor>, true);
}...
This can break with every Eclipse version because I access the internal API but
it solved the problem for me.
I have run into this annoyance over and over again and have been unable to find a solution or an answer here for it:
When I create a package in my application and then add a package within it, if I do not have a file in the directory already it will auto collapse my package in the left-side navigation of Android Studio. This prevents me from adding other sub-packages to the parent package, without manually resolving the issue within the file system.
For Example:
What I want is:
-presentation
-screens
-devicescreen
-adapters
-presenters
-views
In the 1:Project view, you have Hide Empty Middle Packages turned ON. You need to turn it off. Once turned off it will be shown as Compact Empty Middle Package. Please look at the screenshot attached.
With Android Studio Electric Eel | 2022.1.1 you need to switch to Project View and then click on Settings icon from the right top side and then disable Compact Middle Packages under the Tree Appearance and then you create your sub package folder it will not merge/collapse and work as a sub-package as we need.
This will prevent Android Studio to automatically collapse the package and sub-package.