Comments (6)
Hi!
Thanks for bringing this up.
Indeed the current version of the library expects a Material theme.
But you're right, there's no reason for using MaterialButton (if your Activity has a Material theme, the layout inflater will replace all Views with their Material counterparts - something I didn't know back then).
I'll make sure to fix this in the next update, hopefully in the coming days. I'll keep you posted!
from beagle.
@pandulapeter thanks for the reply.
If you expect material-theme in this library, what about to wrap context with material-themed context?
This is code snippet I am using in my project
fun Activity.toMaterialContext(): Context {
// this code is dangerous - using private material theme attribute
val typedArray = this.theme.obtainStyledAttributes(intArrayOf(com.google.android.material.R.attr.isMaterialTheme))
val isMaterialTheme = typedArray.getBoolean(0, false)
typedArray.recycle()
return if (isMaterialTheme) {
this
} else {
wrapMaterialTheme( R.style.my_default_material_theeme )
)
}
}
fun Activity.wrapMaterialTheme(@StyleRes newMaterialThemeResId: Int): Context {
return ContextThemeWrapper(
this,
newMaterialThemeResId
).apply {
val materialContext = this
val delegate = AppCompatDelegate.create(
materialContext,
requireNotNull(this),
null
)
val inflater = LayoutInflater.from(materialContext)
LayoutInflaterCompat.setFactory2(
inflater,
delegate as LayoutInflater.Factory2
)
}
}
If you apply this code, you can ensure library is using material themed context. But if user is applyed non-material theme, their theme is overridden. But I don't think this cause big(?) problem.
from beagle.
Thanks, that's really useful!
I'll try to take care of this as soon as possible :)
from beagle.
Related Issues (20)
- TextInputModule Crash HOT 2
- On SDK 31 and above the screen recording crashes when started HOT 1
- Beagle crash logging doesn't work HOT 2
- Crash with DrawerLayout when getting permissions HOT 3
- Drawer doesn't appear when using content.viewTreeObserver.addOnPreDrawListener on the Acitivty HOT 5
- Beagle should not cause a crash if a value is set to the Slider module that is outside the specified range HOT 1
- The drawer opening gesture does not respect the value of `shouldShowDebugMenu` HOT 1
- Can't open Activity when try to forceCrash from debug panel HOT 7
- ListModules should support the isEnabled flag.
- TextInputModule. Suggestion for improving the validator
- Buggy inset handling in edge-to-edge apps
- SwitchModule. Ui data not re-initialize. Reset selected state HOT 5
- Double debug-panel HOT 3
- Implement dynamic notification permission support HOT 1
- Android 14 and gesture to preview back HOT 2
- Incorrect permissions for creating a screen recording / screenshot HOT 1
- After granting the notificaiton permission, the app needs to be restarted for screenshots / screen recordings to work HOT 1
- Screen recording issues on foldables
- Beagle causes the application class to crash when opening the app from a push notification HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from beagle.