Skip to content

Conversation

hansemannn
Copy link
Collaborator

@hansemannn hansemannn commented Sep 13, 2025

As discussed in m1ga/ti.blurview#2

This pull request introduces a new cross-platform-style BlurView for Android, providing a background blur effect similar to iOS' UIVisualEffectView. It adds a new Ti.UI.BlurView component, exposes cross-platform blur effect constants, and updates build dependencies to support the feature. Documentation is also added for the new component and its properties.

It uses Dimezis/BlurView for maximized backwards compatiblity - and iOS has also moved to the same API!

const win = Ti.UI.createWindow({ backgroundColor: '#fff' });
const target = Ti.UI.createView({ width: Ti.UI.FILL, height: Ti.UI.FILL });

target.add(Ti.UI.createImageView({
	image: '/DefaultIcon.png'
}));

const blur = Ti.UI.createBlurView({
	width: 200,
	height: 200,
	effect: Ti.UI.BLUR_EFFECT_STYLE_LIGHT
});

win.add(target);
win.add(blur);
win.open();
Static Animating
Screenshot_1757782898 https://github.com/user-attachments/assets/1d6df851-4706-4d49-a970-2e8b19b7b64d

@hansemannn hansemannn requested a review from m1ga September 13, 2025 17:04
@hansemannn hansemannn changed the title feat(android): add parity for BlurView API feat(android): add parity for BlurView API, move iOS to Ti.UI namespace Sep 13, 2025
@hansemannn
Copy link
Collaborator Author

@m1ga iOS is now also moved over - we have the unique chance to do deprecate the old one in 13.0.0, so I will restore the Ti.UI.iOS.BlurView deprecate it in 13.0.0 and then we can remove it in 14.0.0

Co-authored-by: Michael Gangolf <m1ga@users.noreply.github.com>
@hansemannn hansemannn requested a review from m1ga September 14, 2025 16:19
<attr name="ti_footerTitleColor" format="color" />
<attr name="ti_footerTitleBackground" format="reference" />
<attr name="ti_footerTitleBackgroundColor" format="color" />
<declare-styleable name="BlurView">
Copy link
Collaborator Author

@hansemannn hansemannn Sep 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prefix with Ti to prevent clashes with other libs

<attr name="ti_footerTitleBackground" format="reference" />
<attr name="ti_footerTitleBackgroundColor" format="color" />
<declare-styleable name="BlurView">
<attr name="blurOverlayColor" format="color"/>
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<attr name="blurOverlayColor" format="color"/>
<attr name="ti_blurOverlayColor" format="color" />

@@ -0,0 +1,171 @@
package eightbitlab.com.blurview;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a readme file to the package to link to the repo and explain why it's bundled like this?

private void init(AttributeSet attrs, int defStyleAttr)
{
TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.BlurView, defStyleAttr, 0);
overlayColor = a.getColor(R.styleable.BlurView_blurOverlayColor, TRANSPARENT);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be like this then?

Suggested change
overlayColor = a.getColor(R.styleable.BlurView_blurOverlayColor, TRANSPARENT);
overlayColor = a.getColor(R.styleable.TiBlurView_ti_blurOverlayColor, TRANSPARENT);

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we even need that in the XML? Devs should rather use the top-level APIs, making this more clean / genuine as well

@hansemannn
Copy link
Collaborator Author

Let's move it to a module - but not in 13.0.0 anymore, the release is big enough already. We can keep this open and I'll prepare a blur view module under tidev that has the sources of this PR bundled in one repo. Alright?

@m1ga
Copy link
Contributor

m1ga commented Sep 15, 2025

Let's move it to a module - but not in 13.0.0 anymore, the release is big enough already. We can keep this open and I'll prepare a blur view module under tidev that has the sources of this PR bundled in one repo. Alright?

sounds good. There we could also use the gradle module to reduce the code size if you want or this internal code setup

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants