### Full Glide BlurTransformation Example with Error Handling
Source: https://context7.com/qmdeve/qmblurview/llms.txt
A comprehensive example of using Glide's BlurTransformation with placeholders, error images, and disk caching. This ensures robust image loading.
```java
Glide.with(context)
.load(imageUrl)
.transform(new BlurTransformation(25f))
.placeholder(R.drawable.placeholder)
.error(R.drawable.error)
.diskCacheStrategy(DiskCacheStrategy.ALL)
.into(imageView);
```
--------------------------------
### Picasso Blur Transformation Examples
Source: https://context7.com/qmdeve/qmblurview/llms.txt
Demonstrates how to apply the BlurTransformation to images loaded with Picasso. Supports default and custom blur radii, rounded corners, and includes error handling with placeholders.
```java
Picasso.get()
.load(imageUrl)
.transform(new BlurTransformation())
.into(imageView);
```
```java
Picasso.get()
.load(imageUrl)
.transform(new BlurTransformation(30f))
.into(imageView);
```
```java
Picasso.get()
.load(imageUrl)
.transform(new BlurTransformation(25f, 16f)) // radius, cornerRadius
.into(imageView);
```
```java
Picasso.get()
.load(imageUrl)
.transform(new BlurTransformation(20f, 8f))
.placeholder(R.drawable.placeholder)
.error(R.drawable.error)
.into(imageView);
```
--------------------------------
### Configure QmBlur CMake Project
Source: https://github.com/qmdeve/qmblurview/blob/master/core/src/main/cpp/CMakeLists.txt
Sets up the CMake build system for the QmBlur project, defining the minimum required version and project name.
```cmake
cmake_minimum_required(VERSION 3.22.1)
project("QmBlur")
```
--------------------------------
### Programmatic Configuration of BlurBottomNavigationView
Source: https://context7.com/qmdeve/qmblurview/llms.txt
Configure BlurBottomNavigationView programmatically, including binding to ViewPager2, setting menus, colors, blur properties, tab styling, and listeners. Remember to release resources when done.
```java
BlurBottomNavigationView bottomNav = findViewById(R.id.bottomNav);
ViewPager2 viewPager = findViewById(R.id.viewPager);
// Bind with ViewPager2 for automatic synchronization
bottomNav.bind(viewPager);
// Or bind with ViewPager (legacy)
// bottomNav.bind(viewPager1);
// Set menu programmatically
bottomNav.setMenu(R.menu.bottom_nav_menu);
// Set colors
bottomNav.setSelectedColor(Color.parseColor("#007AFF"));
bottomNav.setUnselectedColor(Color.parseColor("#8E8E93"));
// Set blur properties
bottomNav.setBlurRadius(25f);
bottomNav.setOverlayColor(0xEEFFFFFF);
// Set tab styling
bottomNav.setIconSize(24f);
bottomNav.setTextSize(12f);
bottomNav.setTextBold(false);
// Manually select a tab
bottomNav.setSelectedTab(1);
// Get current selection
int currentTab = bottomNav.getCurrentSelected();
// Listen for tab selection changes
bottomNav.setOnTabSelectedListener((newPosition, oldPosition) -> {
Log.d("Navigation", "Switched from tab " + oldPosition + " to " + newPosition);
});
// Release resources when done
bottomNav.release();
```
--------------------------------
### Bottom Navigation Menu Resource
Source: https://context7.com/qmdeve/qmblurview/llms.txt
Define menu items for BlurBottomNavigationView in an XML resource file. Each item requires an ID, icon, and title.
```xml
```
--------------------------------
### Set Linker Options for QmBlur
Source: https://github.com/qmdeve/qmblurview/blob/master/core/src/main/cpp/CMakeLists.txt
Applies a specific linker option to the QmBlur project to set the maximum page size to 16384 bytes.
```cmake
target_link_options(${CMAKE_PROJECT_NAME} PRIVATE "-Wl,-z,max-page-size=16384")
```
--------------------------------
### Find System Libraries
Source: https://github.com/qmdeve/qmblurview/blob/master/core/src/main/cpp/CMakeLists.txt
Locates the 'log' and 'jnigraphics' libraries, which are necessary for Android NDK development.
```cmake
find_library(
log-lib
log
)
find_library(
jni-graphics-lib
jnigraphics
)
```
--------------------------------
### Programmatic Configuration of BlurFloatingButtonView
Source: https://context7.com/qmdeve/qmblurview/llms.txt
Configure BlurFloatingButtonView programmatically by setting its icon, size, corner radius, colors, blur radius, position, and click/long press listeners.
```java
BlurFloatingButtonView fab = findViewById(R.id.fab);
// Set icon from resource
fab.setIcon(R.drawable.ic_add);
// Or set icon drawable
fab.setIconDrawable(ContextCompat.getDrawable(this, R.drawable.ic_edit));
// Set icon tint color
fab.setIconTint(Color.WHITE);
// Set icon size in DP
fab.setIconSize(28f);
// Set button size in DP
fab.setButtonSize(60f);
// Set corner radius
fab.setCornerRadius(16f);
// Set overlay color
fab.setOverlayColor(Color.WHITE);
// Set blur radius
fab.setBlurRadius(20f);
// Set position (LEFT or RIGHT)
fab.setPosition(BlurFloatingButtonView.POSITION_RIGHT);
// fab.setPosition(BlurFloatingButtonView.POSITION_LEFT);
// Set click listener
fab.setOnClickListener(v -> {
createNewItem();
});
// Set long press listener
fab.setOnLongPressListener(view -> {
showContextMenu();
});
```
--------------------------------
### Create QmBlur Shared Library
Source: https://github.com/qmdeve/qmblurview/blob/master/core/src/main/cpp/CMakeLists.txt
Defines the QmBlur library as a shared library, including the native source file.
```cmake
add_library(
QmBlur
SHARED
BlurNative.c
)
```
--------------------------------
### ProgressiveBlurView Programmatic Configuration
Source: https://context7.com/qmdeve/qmblurview/llms.txt
Configure ProgressiveBlurView properties like gradient direction, blur radius, and overlay color programmatically. Ensure the view is found by its ID.
```java
// Programmatic configuration
ProgressiveBlurView progressiveBlur = findViewById(R.id.progressiveBlur);
// Set gradient direction
// Options: DIRECTION_TOP_TO_BOTTOM (0), DIRECTION_BOTTOM_TO_TOP (1),
// DIRECTION_LEFT_TO_RIGHT (2), DIRECTION_RIGHT_TO_LEFT (3)
progressiveBlur.setGradientDirection(ProgressiveBlurView.DIRECTION_TOP_TO_BOTTOM);
// Set blur radius
progressiveBlur.setBlurRadius(30f);
// Set overlay color (applied as gradient)
progressiveBlur.setOverlayColor(0xAAFFFFFF);
// Or use color resource
progressiveBlur.setOverlayColorRes(R.color.blur_overlay);
```
--------------------------------
### BlurSwitchButtonView Programmatic Configuration
Source: https://context7.com/qmdeve/qmblurview/llms.txt
Programmatically control the BlurSwitchButtonView's state, colors, and mode. Set checked state with or without animation, toggle, and listen for changes.
```java
// Programmatic configuration
BlurSwitchButtonView switchView = findViewById(R.id.blurSwitch);
// Set checked state
switchView.setChecked(true, true); // (checked, animate)
// Toggle state
switchView.toggle();
// Check current state
boolean isChecked = switchView.isChecked();
// Set base color for blur mode
switchView.setBaseColor(Color.parseColor("#0161F2"));
// Switch to solid color mode
switchView.setUseSolidColorMode(true);
// Set solid colors for on/off states
switchView.setSolidColors(
Color.parseColor("#34C759"), // On color (green)
Color.parseColor("#E5E5EA") // Off color (gray)
);
// Listen for state changes
switchView.setOnCheckedChangeListener(isChecked -> {
if (isChecked) {
enableFeature();
} else {
disableFeature();
}
});
```
--------------------------------
### Link Libraries to QmBlur
Source: https://github.com/qmdeve/qmblurview/blob/master/core/src/main/cpp/CMakeLists.txt
Links the found 'log' and 'jnigraphics' libraries to the QmBlur target library.
```cmake
target_link_libraries(
QmBlur
${log-lib}
${jni-graphics-lib}
)
```
--------------------------------
### XML Layout for BlurBottomNavigationView
Source: https://context7.com/qmdeve/qmblurview/llms.txt
Declare a BlurBottomNavigationView in your layout, specifying the menu resource and various styling attributes for blur, colors, and item sizes.
```xml
```
--------------------------------
### Programmatically Configure BlurButtonView
Source: https://context7.com/qmdeve/qmblurview/llms.txt
Configure BlurButtonView properties such as text, text styling, icon, corner radius, and gravity programmatically. You can also set click listeners and enable/disable the button.
```java
// Programmatic configuration
BlurButtonView blurButton = findViewById(R.id.blurButton);
// Set button textlurButton.setText("Submit");
// Set text stylinglurButton.setTextSize(18f); // in SP
blurButton.setTextColor(Color.BLACK);
blurButton.setTextColorPressed(Color.GRAY);
blurButton.setTextBold(true);
// Set icon from resourcelurButton.setIconResource(R.drawable.ic_send);
blurButton.setIconSize(24); // in DP
blurButton.setIconPadding(8); // in DP
blurButton.setIconTintColor(Color.DKGRAY);
// Set corner radius
blurButton.setButtonCornerRadius(16f);
// Set gravity for content alignment
blurButton.setGravity(Gravity.CENTER);
// Set click listener
blurButton.setOnClickListener(v -> {
Toast.makeText(this, "Button clicked!", Toast.LENGTH_SHORT).show();
});
// Enable/disable button
blurButton.setEnabled(false);
```
--------------------------------
### Programmatically Configure BlurView
Source: https://context7.com/qmdeve/qmblurview/llms.txt
Configure BlurView properties like blur radius, overlay color, corner radius, downsample factor, and blur rounds programmatically in your Java/Kotlin code. Remember to release resources when done.
```java
// Programmatic configuration
BlurView blurView = findViewById(R.id.blurView);
// Set blur intensity (higher value = more blur)
blurView.setBlurRadius(30f);
// Set overlay color with transparency
blurView.setOverlayColor(0xAAFFFFFF); // Semi-transparent white
// Set corner radius for rounded corners
blurView.setCornerRadius(24f);
// Set downsample factor for performance (higher = faster but lower quality)
blurView.setDownsampleFactor(3f);
// Set blur iterations for stronger blur effect
blurView.setBlurRounds(3);
// Get the blurred bitmap if needed
Bitmap blurredBitmap = blurView.getBlurredBitmap();
// Release resources when done
blurView.release();
```
--------------------------------
### Configure BlurButtonView in XML Layout
Source: https://context7.com/qmdeve/qmblurview/llms.txt
Define a BlurButtonView in your XML layout to create a button with a real-time blur background. Customize text, icon, colors, corner radius, and text boldness.
```xml
```
--------------------------------
### BlurSwitchButtonView XML Layout (Solid Color Mode)
Source: https://context7.com/qmdeve/qmblurview/llms.txt
Define a BlurSwitchButtonView in XML for solid color mode. Set 'useSolidColorMode' to true and specify 'solidOnColor' and 'solidOffColor'.
```xml
```
--------------------------------
### XML Layout for BlurFloatingButtonView
Source: https://context7.com/qmdeve/qmblurview/llms.txt
Use this XML to declare a BlurFloatingButtonView in your layout file. It supports standard layout attributes.
```xml
```
--------------------------------
### BlurSwitchButtonView XML Layout (Blur Mode)
Source: https://context7.com/qmdeve/qmblurview/llms.txt
Define a BlurSwitchButtonView in XML for blur mode. Set the base color and ensure 'useSolidColorMode' is false.
```xml
```
--------------------------------
### Glide BlurTransformation with Other Transformations
Source: https://context7.com/qmdeve/qmblurview/llms.txt
Combine BlurTransformation with other Glide transformations like CenterCrop. Ensure the order of transformations is appropriate for the desired effect.
```java
Glide.with(context)
.load(imageUrl)
.transform(
new CenterCrop(),
new BlurTransformation(20f, 12f)
)
.into(imageView);
```
--------------------------------
### BlurTitlebarView Programmatic Configuration
Source: https://context7.com/qmdeve/qmblurview/llms.txt
Configure BlurTitlebarView properties like title, subtitle, back button visibility, icons, and click listeners programmatically. Supports animated title centering.
```java
// Programmatic configuration
BlurTitlebarView titlebar = findViewById(R.id.blurTitlebar);
// Set title and subtitle
titlebar.setTitle("Settings");
titlebar.setSubtitle("Account settings");
// Show/hide back button
titlebar.setShowBack(true);
// Set custom back icon
titlebar.setBackIcon(ContextCompat.getDrawable(this, R.drawable.ic_arrow_back));
titlebar.setBackIconTint(Color.BLACK);
// Set menu text or icon (mutually exclusive - icon takes priority)
titlebar.setMenuText("Done");
titlebar.setMenuIcon(ContextCompat.getDrawable(this, R.drawable.ic_settings));
titlebar.setMenuIconTint(Color.BLACK);
// Center or left-align title (with animation)
titlebar.setCenterTitle(true);
// Set click listeners
titlebar.setOnBackClickListener(() -> {
finish(); // Close activity
});
titlebar.setOnMenuClickListener(() -> {
// Handle menu action
saveSettings();
});
```
--------------------------------
### Add QmBlurView Dependencies to build.gradle
Source: https://github.com/qmdeve/qmblurview/blob/master/README.md
Include these dependencies in your module's build.gradle file to integrate QmBlurView into your Android project. The core library is required, while navigation and image loading transformations are optional.
```gradle
dependencies {
// Core Library (Required)
implementation 'com.qmdeve.blurview:core:1.1.4'
// Navigation Support (Optional)
implementation 'com.qmdeve.blurview:navigation:1.1.4'
// Image Loading Transformations (Optional - Glide/Picasso)
implementation 'com.qmdeve.blurview:transform:1.1.4'
}
```
--------------------------------
### Configure BlurView in XML Layout
Source: https://context7.com/qmdeve/qmblurview/llms.txt
Use the BlurView component in your XML layout to apply real-time Gaussian blur effects to the underlying content. Customize blur radius, overlay color, corner radius, and downsample factor.
```xml
```
--------------------------------
### BlurTitlebarView XML Layout
Source: https://context7.com/qmdeve/qmblurview/llms.txt
Integrate BlurTitlebarView into your layout using XML. Customize title, subtitle, colors, back button, and menu actions with attributes.
```xml
```
--------------------------------
### ProgressiveBlurView XML Layout
Source: https://context7.com/qmdeve/qmblurview/llms.txt
Use this XML to add a ProgressiveBlurView to your layout. Configure blur radius, overlay color, and direction via attributes.
```xml
```
--------------------------------
### BlurSwitchButtonView XML Attributes
Source: https://context7.com/qmdeve/qmblurview/llms.txt
Reference for XML attributes specific to BlurSwitchButtonView. These attributes define base colors, whether to use solid colors, and specific colors for the on/off states.
```xml
```
```xml
```
```xml
```
```xml
```
--------------------------------
### Glide BlurTransformation with Rounded Corners
Source: https://context7.com/qmdeve/qmblurview/llms.txt
Apply blur and rounded corners to images using Glide's BlurTransformation. Provide both the blur radius and the corner radius.
```java
Glide.with(context)
.load(imageUrl)
.transform(new BlurTransformation(25f, 16f)) // radius, cornerRadius
.into(imageView);
```
--------------------------------
### BlurView XML Attributes
Source: https://context7.com/qmdeve/qmblurview/llms.txt
Reference for XML attributes used to configure BlurView components. These control blur intensity, overlay color, corner radius, and performance.
```xml
```
```xml
```
```xml
```
```xml
```
--------------------------------
### BlurButtonView XML Attributes
Source: https://context7.com/qmdeve/qmblurview/llms.txt
Reference for XML attributes specific to BlurButtonView. Includes standard text attributes and custom properties for button appearance and behavior.
```xml
```
```xml
```
```xml
```
```xml
```
```xml
```
```xml
```
```xml
```
```xml
```
```xml
```
```xml
```
```xml
```
```xml
```
--------------------------------
### Glide BlurTransformation with Custom Radius
Source: https://context7.com/qmdeve/qmblurview/llms.txt
Apply a blur effect with a custom blur radius using Glide's BlurTransformation. Specify the desired radius in pixels.
```java
Glide.with(context)
.load(imageUrl)
.transform(new BlurTransformation(30f))
.into(imageView);
```
--------------------------------
### ProgressiveBlurView XML Attributes
Source: https://context7.com/qmdeve/qmblurview/llms.txt
Reference for XML attributes used to configure ProgressiveBlurView. These attributes control the blur radius, overlay color, and the direction of the progressive blur effect.
```xml
```
```xml
```
```xml
```
--------------------------------
### Basic Glide BlurTransformation
Source: https://context7.com/qmdeve/qmblurview/llms.txt
Apply a basic blur effect to images loaded with Glide using the BlurTransformation. The default blur radius is 25.
```java
Glide.with(context)
.load(imageUrl)
.transform(new BlurTransformation())
.into(imageView);
```
=== COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.