public class

Registry

extends java.lang.Object

 java.lang.Object

↳androidx.constraintlayout.core.state.Registry

Gradle dependencies

compile group: 'androidx.constraintlayout', name: 'constraintlayout-core', version: '1.1.0-beta01'

  • groupId: androidx.constraintlayout
  • artifactId: constraintlayout-core
  • version: 1.1.0-beta01

Artifact androidx.constraintlayout:constraintlayout-core:1.1.0-beta01 it located at Google repository (https://maven.google.com/)

Summary

Constructors
publicRegistry()

Methods
public java.lang.StringcurrentContent(java.lang.String name)

public java.lang.StringcurrentLayoutInformation(java.lang.String name)

public static RegistrygetInstance()

public longgetLastModified(java.lang.String name)

public java.util.Set<java.lang.String>getLayoutList()

public voidregister(java.lang.String name, RegistryCallback callback)

public voidsetDrawDebug(java.lang.String name, int debugMode)

public voidsetLayoutInformationMode(java.lang.String name, int mode)

public voidunregister(java.lang.String name, RegistryCallback callback)

public voidupdateContent(java.lang.String name, java.lang.String content)

public voidupdateDimensions(java.lang.String name, int width, int height)

public voidupdateProgress(java.lang.String name, float progress)

from java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructors

public Registry()

Methods

public static Registry getInstance()

public void register(java.lang.String name, RegistryCallback callback)

public void unregister(java.lang.String name, RegistryCallback callback)

public void updateContent(java.lang.String name, java.lang.String content)

public void updateProgress(java.lang.String name, float progress)

public java.lang.String currentContent(java.lang.String name)

public java.lang.String currentLayoutInformation(java.lang.String name)

public void setDrawDebug(java.lang.String name, int debugMode)

public void setLayoutInformationMode(java.lang.String name, int mode)

public java.util.Set<java.lang.String> getLayoutList()

public long getLastModified(java.lang.String name)

public void updateDimensions(java.lang.String name, int width, int height)

Source

/*
 * Copyright 2021 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package androidx.constraintlayout.core.state;

import java.util.HashMap;
import java.util.Set;

public class Registry {

    private static final Registry sRegistry = new Registry();

    public static Registry getInstance() {
        return sRegistry;
    }

    private HashMap<String, RegistryCallback> mCallbacks = new HashMap<>();

    // @TODO: add description
    public void register(String name, RegistryCallback callback) {
        mCallbacks.put(name, callback);
    }

    // @TODO: add description
    public void unregister(String name, RegistryCallback callback) {
        mCallbacks.remove(name);
    }

    // @TODO: add description
    public void updateContent(String name, String content) {
        RegistryCallback callback = mCallbacks.get(name);
        if (callback != null) {
            callback.onNewMotionScene(content);
        }
    }

    // @TODO: add description
    public void updateProgress(String name, float progress) {
        RegistryCallback callback = mCallbacks.get(name);
        if (callback != null) {
            callback.onProgress(progress);
        }
    }

    // @TODO: add description
    public String currentContent(String name) {
        RegistryCallback callback = mCallbacks.get(name);
        if (callback != null) {
            return callback.currentMotionScene();
        }
        return null;
    }

    // @TODO: add description
    public String currentLayoutInformation(String name) {
        RegistryCallback callback = mCallbacks.get(name);
        if (callback != null) {
            return callback.currentLayoutInformation();
        }
        return null;
    }

    // @TODO: add description
    public void setDrawDebug(String name, int debugMode) {
        RegistryCallback callback = mCallbacks.get(name);
        if (callback != null) {
            callback.setDrawDebug(debugMode);
        }
    }

    // @TODO: add description
    public void setLayoutInformationMode(String name, int mode) {
        RegistryCallback callback = mCallbacks.get(name);
        if (callback != null) {
            callback.setLayoutInformationMode(mode);
        }
    }

    public Set<String> getLayoutList() {
        return mCallbacks.keySet();
    }

    // @TODO: add description
    public long getLastModified(String name) {
        RegistryCallback callback = mCallbacks.get(name);
        if (callback != null) {
            return callback.getLastModified();
        }
        return Long.MAX_VALUE;
    }

    // @TODO: add description
    public void updateDimensions(String name, int width, int height) {
        RegistryCallback callback = mCallbacks.get(name);
        if (callback != null) {
            callback.onDimensions(width, height);
        }
    }
}