Smart Protection UI Customization
Malwarelytics for Android offers customization of its UI elements.
Smart protection feature has the following UI elements:
- Threat screen that displays list of dangerous apps.
- Notification about a dangerous app.
You can customize these UI parts of smart protection in the AppProtection
class
initialization through setting ThreatMitigationUIConfig
in the AntivirusConfig.Builder
instance:
val threatMitigationUIConfig = AntivirusConfig.ThreatMitigationUIConfig.Builder()
.notificationSmallIcon(R.drawable.my_notification_icon)
.notificationChannelId("AV-CHANNEL")
.screenDeleteIcon(R.drawable.custom_delete_icon)
.screenSettingsIcon(R.drawable.custom_settings_icon)
.screenTheme(R.style.CustomThreatScreenTheme)
.customLocalization("cs")
.build()
val antivirusConfig = AntivirusConfig.Builder()
// ...
.threatMitigationUIConfig(threatMitigationUIConfig)
.build()
Styling Threat Screen
Main portion of threat screen customization is done with Android styles that are set in
ThreatMitigationUIConfig
with screenTheme(Int)
. The expected argument is
an Android resource id pointing to a theme.
Config items screenDeleteIcon(Int)
and screenSettingsIcon(Int)
define drawables for image buttons,
the expected values are Android resource ids pointing to drawables.
Styling Notifications
Config items notificationSmallIcon(Int)
and notificationChannelId(String)
which define
small icon for notification and notification channel ID, respectively.
Changing Default Localization
Default string resources in an Android app can be written in any language. Malwarelytics for Android
use English locale (“en-US”) as the default. In order to change the default the developer has to define
which locale to use. As an example changing the default localization of the SDK
to Czech requires the developer to set customLocalization("cs")
.
The default localization can be later changed after initialization by calling:
val smartProtectionManager = antivirus.getSmartProtectionManager()
smartProtectionManager.setCustomLocalization(languageCode)