The Activities kit provides application the ability to show member activities - from their registration to profile updates, reward responses or challenge completions.
On this page:
Overview
The Activities kit is a simple view with one screen which contains a list. Each list item represents a Cheetah Digital Activity and if applicable will redirect to an Activity Details screen.
To include the Activities kit, open the Gradle Scripts | build.gradle (Module: app)
and add the following to the
dependencies section:
implementation 'com.cheetahdigital.android:activities:<version>'
Launching the Activities Screen
To use the built in Activities screen, you must include it in the app’s AndroidManifest.xml
:
<activity android:name="com.cheetahdigital.activities.ui.ActivityListActivity">
<intent-filter>
<action android:name="${applicationId}.ACTIVITY_LIST" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
Then start the activity with the use of the StellarActions from the MainActivity.java
:
startActivity(new Intent(Action.Activities.getListAction
(MainActivity.this))
If applicable an item in the list will launch the corresponding details page of the item based on its type. The details page for each item type is launched using intent actions:
-
Challenge - launches the Challenge Response Details page with action
"${applicationId}.CHALLENGE_RESPONSE_DETAILS"
-
Code - launches Code Scanner page with action
"${applicationId}.CODE_SCANNER_ACTIVITY"
-
Newsfeed Post - launches the Newsfeed Post Details page with action
"${applicationId}.NEWSFEED_DETAILS"
-
Offer - launches the Offer Response Details page with action
"${applicationId}.OFFER_RESPONSE_DETAILS"
-
Preference Update - launches the Preferences page with action
"${applicationId}.PREFERENCE"
-
Profile Update - launches the Profile page with action
"${applicationId}.PROFILE_VIEW_EDIT"
-
Reward - launches the Redemption Details page with action
"${applicationId}.REWARD_REDEMPTION_DETAILS"
-
Receipt - launches the Receipt Details page with action
"${applicationId}.RECEIPT_DETAILS"
Theme Customization
The kit leverages on Android’s built-in support for Styles and Themes. Overriding Styles and Themes of the app will also change the corresponding Views used in this kit.
Layout Customization
Customizing Layouts via XML
In the Activities kit, you can customize how the list and the items are presented. Follow these simple steps to change the look and feel of the activities pre-built views.
For the list Activity, you must modify the fragment_activities.xml
, copy this file in your app’s main resource directory and modify it accordingly.
For the list items, you must modify list_item_activities.xml,
copy this file in your app’s main resource directory and modify it accordingly.
To read more about this, please visit Layout Customization via XML.
Customizing Layouts via Code
There are certain cases when you may want to use a highly-customized layout for an Activity. To read more about this, please visit the Layout Customization via Code document. The classes used by the Activities Kit are:
ActivityListActivity
ActivitiesFragment
Fully Custom UI
For the Activities Kit, a full customization can be done using the methods found in ActivitiesAPI
:
Querying Activities Data
getActivities(ActivityParams activityParams, boolean clearCache, ListenerModel<BaseModel<Activities>, Activities> listener)