Add a notification bell
Add the notification bell in your layout
Add the notification bell in the place where you want it to appear inside your app.
<com.viafourasdk.src.view.notificationBell.VFNotificationBellView
android:layout_width="wrap_content"
android:id="@+id/home_bell"
android:layout_alignParentRight="true"
android:layout_marginRight="16dp"
android:layout_above="@id/home_bottom_navigation"
android:layout_marginBottom="16dp"
android:layout_height="wrap_content">
</com.viafourasdk.src.view.notificationBell.VFNotificationBellView>
Initialize the notification bell
VFNotificationBellView bellView = findViewById(R.id.home_bell);
bellView.applySettings(settings);
bellView.setBellClickedInterface(new NotificationBellClickedInterface() {
@Override
public void bellPressed(UUID userUUID) {
Intent intent = new Intent(MainActivity.this, ProfileActivity.class);
intent.putExtra(IntentKeys.INTENT_USER_UUID, userUUID.toString());
intent.putExtra(IntentKeys.INTENT_USER_PRESENTATION_TYPE, "feed");
startActivity(intent);
}
});
bellView.setActionCallback(new VFActionsInterface() {
@Override
public void onNewAction(VFActionType actionType, VFActionData action) {
if(actionType == VFActionType.authPressed){
startActivity(new Intent(getApplicationContext(), LoginActivity.class));
}
}
});
val bellView = findViewById<VFNotificationBellView>(R.id.home_bell)
bellView.applySettings(settings)
bellView.setBellClickedInterface(object : NotificationBellClickedInterface {
override fun bellPressed(userUUID: UUID) {
val intent = Intent(this@JavaInUse, ProfileActivity::class.java)
intent.putExtra(IntentKeys.INTENT_USER_UUID, userUUID.toString())
intent.putExtra(IntentKeys.INTENT_USER_PRESENTATION_TYPE, "feed")
startActivity(intent)
}
})
bellView.setLoginInterface(object : VFLoginInterface {
override fun startLogin() {
startActivity(Intent(applicationContext, LoginActivity::class.java))
}
})
Set theme
In case your app has a light/dark mode setting, you can customize the look of the bell view with the following method
bellView.setTheme(VFTheme.dark);
bellView.setTheme(VFTheme.dark)
Updated 21 days ago