blob: 9f1ecf4b0338998c24f37d3958dc9536a8f584e7 [file] [log] [blame]
// Copyright 2016 The Vanadium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
/**
* This package is the entry point into the Baku Toolkit. The easiest way for an application to take
* advantage of Baku is for its activities with distributed state to inherit from
* {@link io.v.baku.toolkit.BakuActivity} (or {@link io.v.baku.toolkit.BakuAppCompatActivity}; see
* {@link io.v.baku.toolkit.BakuActivityMixin} for custom inheritance trees). Then, for any UI
* widget that should have distributed state, the client application should build data bindings by
* chaining methods from a {@link io.v.baku.toolkit.BakuActivityTrait#binder() binder()} call,
* binding shared data fields in the Syncbase distributed storage system to UI widget properties.
* For [example](https://goo.gl/P0Ag9a), the following binds a data key named `"text"` to the text
* of a {@link android.widget.TextView} with ID `textView`:
*
* ```java
* {@literal @}Override
* protected void onCreate(final Bundle savedInstanceState) {
* super.onCreate(savedInstanceState);
* setContentView(R.layout.my_activity_layout);
*
* {@link io.v.baku.toolkit.BakuActivityTrait#binder() binder}().{@link
* io.v.baku.toolkit.bind.SyncbaseBinding.Builder#key(java.lang.String) key}("myDataRow")
* .{@link io.v.baku.toolkit.bind.SyncbaseBinding.Builder#bindTo(int)
* bindTo}(R.id.myTextView);
* }
* }
* ```
*
* Collection bindings (from vector data to list/recycler views) are similarly exposed through a
* {@link io.v.baku.toolkit.BakuActivityTrait#collectionBinder() collectionBinder()} builder. Writes
* can be performed directly via {@link io.v.baku.toolkit.syncbase.BakuTable#put(java.lang.String,
* java.lang.Object) getSyncbaseTable().put(key, value)}. More information about data bindings is
* available in the {@link io.v.baku.toolkit.bind} package documentation.
*
* The Baku Toolkit creates a Syncbase table to use by default for data binding, and creates and
* manages a default {@linkplain io.v.rx.syncbase.UserCloudSyncgroup global user-level cloud
* syncgroup} to sync distributed data across all instances of the application belonging to a user.
*
* Baku components are built in layers bundling common sets of functionality. This allows
* application developers the flexibility to selectively interact with APIs when they need to work
* around our high-level abstractions which potentially don't meet their use cases.
*
* Sample code is available in the [baku projects repo]
* (https://vanadium.googlesource.com/release.projects.baku).
*/
package io.v.baku.toolkit;