public class

ShortcutBuilder

extends <any>

 java.lang.Object

↳<any>

↳androidx.core.google.shortcuts.builders.ShortcutBuilder

Gradle dependencies

compile group: 'androidx.core', name: 'core-google-shortcuts', version: '1.1.0-alpha01'

  • groupId: androidx.core
  • artifactId: core-google-shortcuts
  • version: 1.1.0-alpha01

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

Overview

Builder for the Shortcut Corpus.

Summary

Constructors
publicShortcutBuilder()

Methods
public ShortcutBuildersetCapability(CapabilityBuilder capability[])

Sets one or more capabilities for the shortcut.

public ShortcutBuildersetShortcutDescription(java.lang.String shortcutDescription)

Sets the description for the shortcut.

public ShortcutBuildersetShortcutLabel(java.lang.String shortcutLabel)

Sets the label for the shortcut.

public ShortcutBuildersetShortcutUrl(java.lang.String shortcutUrl)

Sets the url for the shortcut.

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

Constructors

public ShortcutBuilder()

Methods

public ShortcutBuilder setShortcutLabel(java.lang.String shortcutLabel)

Sets the label for the shortcut.

public ShortcutBuilder setShortcutDescription(java.lang.String shortcutDescription)

Sets the description for the shortcut.

public ShortcutBuilder setShortcutUrl(java.lang.String shortcutUrl)

Sets the url for the shortcut.

public ShortcutBuilder setCapability(CapabilityBuilder capability[])

Sets one or more capabilities for the shortcut.

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.core.google.shortcuts.builders;

import static androidx.annotation.RestrictTo.Scope.LIBRARY;
import static androidx.core.google.shortcuts.builders.Constants.SHORTCUT_CAPABILITY_KEY;
import static androidx.core.google.shortcuts.builders.Constants.SHORTCUT_DESCRIPTION_KEY;
import static androidx.core.google.shortcuts.builders.Constants.SHORTCUT_LABEL_KEY;
import static androidx.core.google.shortcuts.builders.Constants.SHORTCUT_TYPE;
import static androidx.core.google.shortcuts.builders.Constants.SHORTCUT_URL_KEY;

import androidx.annotation.NonNull;
import androidx.annotation.RestrictTo;

import com.google.firebase.appindexing.builders.IndexableBuilder;

/**
 * Builder for the Shortcut Corpus.
 *
 * @hide
 */
@RestrictTo(LIBRARY)
public class ShortcutBuilder extends IndexableBuilder<ShortcutBuilder> {
    public ShortcutBuilder() {
        super(SHORTCUT_TYPE);
    }

    /** Sets the label for the shortcut. */
    @NonNull
    public ShortcutBuilder setShortcutLabel(@NonNull String shortcutLabel) {
        setName(shortcutLabel);
        return put(SHORTCUT_LABEL_KEY, shortcutLabel);
    }

    /** Sets the description for the shortcut. */
    @NonNull
    public ShortcutBuilder setShortcutDescription(@NonNull String shortcutDescription) {
        setDescription(shortcutDescription);
        return put(SHORTCUT_DESCRIPTION_KEY, shortcutDescription);
    }

    /** Sets the {@link android.content.Intent} url for the shortcut. */
    @NonNull
    public ShortcutBuilder setShortcutUrl(@NonNull String shortcutUrl) {
        return put(SHORTCUT_URL_KEY, shortcutUrl);
    }

    /** Sets one or more capabilities for the shortcut. */
    @NonNull
    public ShortcutBuilder setCapability(@NonNull CapabilityBuilder... capability) {
        return put(SHORTCUT_CAPABILITY_KEY, capability);
    }
}