Aria 2.0.0
C++23 MVVM framework (C++20 minimum) — reactive, coroutine-first, ABI-layered
Loading...
Searching...
No Matches
aria::adapters::jni Namespace Reference

JniAdapter — Android JNI implementation of aria::binding::IViewAdapter. More...

Classes

class  JniAdapter
 Android JNI implementation of IViewAdapter. More...
class  JniListSource
class  JniRecyclerNotifier
 Holds a global reference to a managed RecyclerView.Adapter and exposes a JniListSource<T>::NotifySink that drives its notifyItem* methods. More...
class  JniView
 Wraps an Android View (jobject) as an IView. More...
struct  RecyclerNotification
 position is the changed row (the destination for a move); from_position is meaningful only for ItemMoved. More...

Enumerations

enum class  RecyclerNotify {
  ItemInserted , ItemRemoved , ItemChanged , ItemMoved ,
  DataSetChanged
}

Detailed Description

JniAdapter — Android JNI implementation of aria::binding::IViewAdapter.

JNI (Java Native Interface) is the only bridge between the Aria C++ core and the Android Java/Kotlin UI layer, so this single adapter is the Android adapter. It is named after the bridging technology (JNI) to match the project's convention — APPKIT (macOS), UIKIT (iOS), QT6, HTTP (Web) — all named after framework/tech rather than platform.

Provides two-way binding for:

  • TextView / EditText — text two-way binding
  • CheckBox / Switch / CompoundButton — bool two-way binding
  • SeekBar / ProgressBar — int two-way binding
  • Button / ImageButton — click events
  • View — visibility / enabled state

The adapter uses JNI to talk to the Java/Kotlin layer. The companion Kotlin/Java classes ship in the Aria Android SDK library.

Lifetime

  • JniView holds a JNI global reference (NewGlobalRef) to its jobject, so the Java-side view survives as long as the C++ wrapper does. ~JniView() releases it via DeleteGlobalRef.
  • ~JniView() calls fire_destroy_() while the native handle is still valid — this lets BindingEngine drop the per-view subscription bucket before storage is reclaimed.
  • Every subscription returned from on_*_changed / on_click detaches its signal slot when released.

Threading

Android UI widgets live on the main (Looper) thread; the adapter assumes its methods run there. Cross-thread Property writes must be marshalled through a Dispatcher before reaching the adapter.

This header requires <jni.h> from the Android NDK, or a JDK when running host tests. Text uses standard UTF-8, including embedded NUL; malformed UTF-8 and isolated Java surrogate units become U+FFFD.

Enumeration Type Documentation

◆ RecyclerNotify

Enumerator
ItemInserted 
ItemRemoved 
ItemChanged 
ItemMoved 
DataSetChanged