Fixed
Status Update
Comments
uc...@google.com <uc...@google.com> #2
Not reproduces, can you share a sample project where this issue can be reproducible.
ro...@gmail.com <ro...@gmail.com> #3
Adding 2 zips:
NavigaionCreateTest.zip generates correct files.
Sunflower004 does NOT create correct files.
RG
NavigaionCreateTest.zip generates correct files.
Sunflower004 does NOT create correct files.
RG
uc...@google.com <uc...@google.com>
rp...@google.com <rp...@google.com>
be...@google.com <be...@google.com> #4
reproduced with Canary 6
ni...@google.com <ni...@google.com>
jb...@google.com <jb...@google.com> #5
This isn't related to the navigation editor. Right now it looks like the template mechanism generates old-style fragments if you're not using an appcompat theme.
Reassigning to Jose to confirm that this is the desired behavior.
Reassigning to Jose to confirm that this is the desired behavior.
pa...@google.com <pa...@google.com> #6
Progress so far...
- Can reproduce using #3 Sunflower, but is OK on a new Project (or #3 NavigationCreateTest).
It will reproduce just by adding a new BlankFragment from right click "app" > New > Fragment > Fragment (Blank)
- The template code that adds the import is:
import ${getMaterialComponentName('android${SupportPackage}.app.Fragment', useAndroidX)};
- ${SupportPackage} is (wrongly) set to "", so the package used is the deprecated "android.app.Fragment"
- ${SupportPackage} is defined as: <global id="SupportPackage" value="${useSupport?string('.support.v4','')}" />
and ${useSupport} is (wrongly) set to false
- "useSupport" is provided by Android Studio through FmGetApplicationThemeMethod
and the value is determined by ThemeHelper@isAppCompatTheme(themeName)
I'll try to find out what is the difference in the two App Theme, that would cause isAppCompatTheme() to return false
- Can reproduce using #3 Sunflower, but is OK on a new Project (or #3 NavigationCreateTest).
It will reproduce just by adding a new BlankFragment from right click "app" > New > Fragment > Fragment (Blank)
- The template code that adds the import is:
import ${getMaterialComponentName('android${SupportPackage}.app.Fragment', useAndroidX)};
- ${SupportPackage} is (wrongly) set to "", so the package used is the deprecated "android.app.Fragment"
- ${SupportPackage} is defined as: <global id="SupportPackage" value="${useSupport?string('.support.v4','')}" />
and ${useSupport} is (wrongly) set to false
- "useSupport" is provided by Android Studio through FmGetApplicationThemeMethod
and the value is determined by ThemeHelper@isAppCompatTheme(themeName)
I'll try to find out what is the difference in the two App Theme, that would cause isAppCompatTheme() to return false
pa...@google.com <pa...@google.com> #7
Following on #6, the "problem" boils down to the fact that
Sunflower project theme is Theme.MaterialComponents.Light.DarkActionBar and
NavigationCreateTest theme is Theme.AppCompat.Light.DarkActionBar
If I change Sunflower theme to Theme.AppCompat.Light.DarkActionBar, then adding a new Fragment will use an import for "androidx.fragment.app.Fragment"
I'm not sure how to progress this. I'm a bit confused why we check the theme of the Application to determine the support for "app compat", instead of checking if the "app compat library" is one of project dependency...
@Diego @Jens do you have any background on this?
Sunflower project theme is Theme.MaterialComponents.Light.DarkActionBar and
NavigationCreateTest theme is Theme.AppCompat.Light.DarkActionBar
If I change Sunflower theme to Theme.AppCompat.Light.DarkActionBar, then adding a new Fragment will use an import for "androidx.fragment.app.Fragment"
I'm not sure how to progress this. I'm a bit confused why we check the theme of the Application to determine the support for "app compat", instead of checking if the "app compat library" is one of project dependency...
@Diego @Jens do you have any background on this?
jl...@google.com <jl...@google.com> #8
This is a while ago, but I think the thinking at the time was:
A project can have a dependency on appcompat without actually using it.
However when the theme is an appcompat theme the activity generated must be: AppCompatActivity.
Perhaps that is no longer a valid assumption ??!
On a side note: It is interesting that the SunFlower project is using a non appcompat theme but is using the material library.
That will normally create problems.
A project can have a dependency on appcompat without actually using it.
However when the theme is an appcompat theme the activity generated must be: AppCompatActivity.
Perhaps that is no longer a valid assumption ??!
On a side note: It is interesting that the SunFlower project is using a non appcompat theme but is using the material library.
That will normally create problems.
pa...@google.com <pa...@google.com> #9
#8 Thanks Jens!
Trevor, can you please take a look at this? We are not sure if this a bug or if the Wizard templates need to be updated
Trevor, can you please take a look at this? We are not sure if this a bug or if the Wizard templates need to be updated
il...@google.com <il...@google.com>
th...@google.com <th...@google.com> #10
I think we should use android.support.v4.app.Fragment or androidx.fragment.app.Fragment in the imporrt statement.
import ${getMaterialComponentName('android${SupportPackage}.app.Fragment', useAndroidX)};
So the logic around ${SupportPackage} should be removed. There is no reason to support android.app.Fragment at this moment.
import ${getMaterialComponentName('android${SupportPackage}.app.Fragment', useAndroidX)};
So the logic around ${SupportPackage} should be removed. There is no reason to support android.app.Fragment at this moment.
Description
AI-182.3208.16.33.4924367, JRE 1.8.0_152-release-1136-b05x64 JetBrains s.r.o, OS Windows 10(amd64) v10.0 , screens 1600x900, 1920x1080
Android Gradle Plugin: 3.3.0-alpha04
Gradle: 4.9
NDK: from local.properties: (not specified); latest from SDK: (not found);
LLDB: pinned revision 3.1 not found; latest from SDK: (package not found);
CMake: from local.properties: (not specified); latest from SDK: (not found); from PATH: (not found);
IMPORTANT: Please read
---
FYI:
When generating fragments with navigation designer, the template uses deprecated android.app.Fragment module...
See picture
RG