Theming
Getting Started with Theming
The LikeMinds Feed SDK simplifies the process of customizing the appearance of all UI views. The SDK allows you to change the appearance of components such as colors and fonts with the help of dedicated class for theming LMFeedAppearance
.
With LMFeedAppearance
, you can adjust various aspects of UI widgets by defining attributes through LMFeedAppearanceRequest
. LikeMinds Feed uses a top-level configuration to apply theming information throughout your application. You can customize the appearance of all UI widgets provided by the LikeMinds Feed SDK by adjusting properties such as button color, text link color, fonts, character limit in post, notification icon through the LMFeedAppearance
class. To implement your custom appearance, create an instance of LMFeedAppearanceRequest
and pass it when initializing the SDK with LMFeedCore.setup()
.
Detailed Overview of LMFeedAppearanceRequest
The LMFeedAppearanceRequest
class allows you to create a request to customize various aspects of the LikeMinds Feed SDK's UI using builder pattern. By passing properties in the LMFeedAppearanceRequest
class, you can control the appearance of all UI widgets to ensure a consistent appearance throughout your application.
Font-related Attributes:
fontResource
: Set the font for your app by providing@FontRes
.fontAssetsPath
: Set the font for your app by providing the path of the font assests.
Choose either fontResource
or fontAssetsPath
. fontResource
is preferred.
Color-related Attributes:
textLinkColor
: Set the color of link text throughout your app by providing@ColorRes
.buttonColor
: Set the color of clickables throughout your app by providing@ColorRes
Other Attributes:
postCharacterLimit
: Set the maximum number of characters allowed in a post before the content is truncated.postHeadingLimit
: Set the maximum number of characters allowed in a post heading before the heading is truncated.notificationIcon
: Set the icon to be shown in the notifications by providing@DrawableRes
.
@FontRes
is an annotation used to indicate that a parameter is expected to reference a font resource.
@ColorRes
indicates a parameter is expected to reference a color resource.
@DrawableRes
indicates a parameter is expected to reference a drawable resource.
Applying LMFeedAppearance
in your Application
Here’s an example of how to apply LMFeedAppearance
using LMFeedAppearanceRequest
while setting up LMFeedCore
in your application class.
- MyApplication.class
- colors.xml
val appearanceRequest = LMFeedAppearanceRequest.Builder()
.fontResource(R.font.roboto)
.textLinkColor(R.color.text_link_color)
.buttonColor(R.color.button_color)
.postCharacterLimit(200)
.postHeadingLimit(100)
.notificationIcon(R.drawable.ic_notification)
.build()
LMFeedCore.setup(
application = this,
theme = LMFeedTheme.SOCIAL_FEED,
enablePushNotifications = true,
deviceId = deviceId,
domain = "https://www.samplefeed.com", // Change this as per your shareable domain
lmFeedAppearance = appearanceRequest,
lmFeedCoreCallback = this
)
<resources>
<color name="text_link_color">#007AFF</color>
<color name="text_link_color">#5046E5</color>
</resources>
In this example, LMFeedAppearanceRequest
is configured using the lmFeedAppearance
parameter in the LMFeedCore.setup()
method, applying the custom appearance globally.