Tweakr
Android Library for Remote Debugging, Autogenerating Settings/Preference UIs, and Wizard-of-Ozing
|
Public Member Functions | |
CompletableFuture< String > | getUserKey () |
void | addListener (OnChangeListener listener) |
void | removeListener (OnChangeListener listener) |
void | add (String name, int targetId, ValueType valueType, Object initialValue, TweakMetadata tweakMetadata) |
void | addListener (OnChangeListener listener) |
void | removeListener (OnChangeListener listener) |
void | add (String name, int targetId, ValueType valueType, Object initialValue, TweakMetadata tweakMetadata) |
Protected Member Functions | |
CompletableFuture< Boolean > | authenticate () |
FirebaseDatabase | getDatabase () |
String | getRootCollectionKey () |
Static Protected Attributes | |
static final String | TAG = "TweakrRepo" |
Additional Inherited Members | |
Public Attributes inherited from com.google.tweakr.TweakrRepo | |
String | FIELD_SEPARATOR = ":" |
A TweakrRepo that uses Firebase to store and manipulate values with a Web UI.
void com.google.tweakr.TweakrFirebaseRepo.add | ( | String | name, |
int | targetId, | ||
ValueType | valueType, | ||
Object | initialValue, | ||
TweakMetadata | tweakMetadata | ||
) |
Add a new Tweak.
name | fully-qualified name of the tweak: may be a path of parent objects to the actual field's name, separated by FIELD_SEPARATOR . |
targetId | monotonically increasing ID of the target object. |
valueType | ValueType for converting the UI value before passing it to OnChangeListener#onFieldChanged . |
initialValue | Initial value of the field as it exists in the target object. |
tweakMetadata | Metadata from the annotation for the UI to display. |
Implements com.google.tweakr.TweakrRepo.
void com.google.tweakr.TweakrFirebaseRepo.addListener | ( | OnChangeListener | listener | ) |
Registers a listener to be notified whenever a value changes in the UI.
Implements com.google.tweakr.TweakrRepo.
|
protected |
Authenticates with Firebase before adding any Tweaks.
This will be called repeatedly so you should cache by checking FirebaseAuth.getCurrentUser(), and simply returning that if it already exists.
If your database allows anonymous users and does not require authentication, you may simply return a Future that resolves to null. This is the default behavior.
|
protected |
Returns the Firebase database to use. You may override this if you would like to use multiple Firebase instances in your app.
|
protected |
Returns the name of the root-level collection in the database to add all Tweaks.
Override this if you are using the same database for multiple apps.
CompletableFuture< String > com.google.tweakr.TweakrFirebaseRepo.getUserKey | ( | ) |
Returns the user's sub-collection key. Use this if you want each user to be able to Tweak their own set of values, which will not change the other users' values.
Reimplemented in com.google.tweakr.TweakrFirebaseRepoMultiuser.
void com.google.tweakr.TweakrFirebaseRepo.removeListener | ( | OnChangeListener | listener | ) |
Removes a listener added with addListener(OnChangeListener)
Implements com.google.tweakr.TweakrRepo.