本文整理汇总了Java中com.google.firebase.appindexing.Indexable类的典型用法代码示例。如果您正苦于以下问题:Java Indexable类的具体用法?Java Indexable怎么用?Java Indexable使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Indexable类属于com.google.firebase.appindexing包,在下文中一共展示了Indexable类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getMessageIndexable
import com.google.firebase.appindexing.Indexable; //导入依赖的package包/类
private Indexable getMessageIndexable(FriendlyMessage friendlyMessage) {
PersonBuilder sender = Indexables.personBuilder()
.setIsSelf(mUsername.equals(friendlyMessage.getName()))
.setName(friendlyMessage.getName())
.setUrl(MESSAGE_URL.concat(friendlyMessage.getId() + "/sender"));
PersonBuilder recipient = Indexables.personBuilder()
.setName(mUsername)
.setUrl(MESSAGE_URL.concat(friendlyMessage.getId() + "/recipient"));
Indexable messageToIndex = Indexables.messageBuilder()
.setName(friendlyMessage.getText())
.setUrl(MESSAGE_URL.concat(friendlyMessage.getId()))
.setSender(sender)
.setRecipient(recipient)
.build();
return messageToIndex;
}
示例2: getIndexableStickerPack
import com.google.firebase.appindexing.Indexable; //导入依赖的package包/类
private static Indexable getIndexableStickerPack(Context context)
throws IOException, FirebaseAppIndexingInvalidArgumentException {
List<StickerBuilder> stickerBuilders = getStickerBuilders(context);
File stickersDir = new File(context.getFilesDir(), "stickers");
if (!stickersDir.exists() && !stickersDir.mkdirs()) {
throw new IOException("Stickers directory does not exist");
}
// Use the last sticker for category image for the sticker pack.
final int lastIndex = stickerBuilders.size() - 1;
final String stickerName = getStickerFilename(lastIndex);
final String imageUrl = getStickerUrl(stickerName);
StickerPackBuilder stickerPackBuilder = Indexables.stickerPackBuilder()
.setName(STICKER_PACK_NAME)
// Firebase App Indexing unique key that must match an intent-filter.
// (e.g. mystickers://sticker/pack/0)
.setUrl(String.format(STICKER_PACK_URL_PATTERN, lastIndex))
// Defaults to the first sticker in "hasSticker". Used to select between sticker
// packs so should be representative of the sticker pack.
.setImage(imageUrl)
.setHasSticker(stickerBuilders.toArray(new StickerBuilder[stickerBuilders.size()]))
.setDescription("content description");
return stickerPackBuilder.build();
}
示例3: indexNote
import com.google.firebase.appindexing.Indexable; //导入依赖的package包/类
private void indexNote() {
Note note = mRecipe.getNote();
Indexable noteToIndex = Indexables.noteDigitalDocumentBuilder()
.setName(mRecipe.getTitle() + " Note")
.setText(note.getText())
.setUrl(mRecipe.getNoteUrl())
.build();
Task<Void> task = FirebaseAppIndex.getInstance().update(noteToIndex);
// [START_EXCLUDE]
task.addOnSuccessListener(new OnSuccessListener<Void>() {
@Override
public void onSuccess(Void aVoid) {
Log.d(TAG, "App Indexing API: Successfully added note to index");
}
});
task.addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception exception) {
Log.e(TAG, "App Indexing API: Failed to add note to index. " + exception
.getMessage());
}
});
// [END_EXCLUDE]
}
示例4: indexRecipe
import com.google.firebase.appindexing.Indexable; //导入依赖的package包/类
private void indexRecipe() {
Indexable recipeToIndex = new Indexable.Builder()
.setName(mRecipe.getTitle())
.setUrl(mRecipe.getRecipeUrl())
.setImage(mRecipe.getPhoto())
.setDescription(mRecipe.getDescription())
.build();
Task<Void> task = FirebaseAppIndex.getInstance().update(recipeToIndex);
task.addOnSuccessListener(new OnSuccessListener<Void>() {
@Override
public void onSuccess(Void aVoid) {
Log.d(TAG, "App Indexing API: Successfully added " + mRecipe.getTitle() + " to " +
"index");
}
});
task.addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception exception) {
Log.e(TAG, "App Indexing API: Failed to add " + mRecipe.getTitle() + " to index. " +
"" + exception.getMessage());
}
});
}
示例5: onHandleIntent
import com.google.firebase.appindexing.Indexable; //导入依赖的package包/类
@Override
protected void onHandleIntent(Intent intent) {
ArrayList<Indexable> indexableNotes = new ArrayList<>();
for (Recipe recipe : getAllRecipes()) {
Note note = recipe.getNote();
if (note != null) {
Indexable noteToIndex = Indexables.noteDigitalDocumentBuilder()
.setName(recipe.getTitle() + " Note")
.setText(note.getText())
.setUrl(recipe.getNoteUrl())
.build();
indexableNotes.add(noteToIndex);
}
}
if (indexableNotes.size() > 0) {
Indexable[] notesArr = new Indexable[indexableNotes.size()];
notesArr = indexableNotes.toArray(notesArr);
// batch insert indexable notes into index
FirebaseAppIndex.getInstance().update(notesArr);
}
}
示例6: getIndexable
import com.google.firebase.appindexing.Indexable; //导入依赖的package包/类
private Indexable getIndexable(Message message) {
return Indexables.messageBuilder()
.setName(message.text())
.setUrl(getUrl(message.uuid()))
.setRecipient(getRecipient(message))
.setSender(getSender(message))
.build();
}
示例7: getIndexableStickers
import com.google.firebase.appindexing.Indexable; //导入依赖的package包/类
private static List<Indexable> getIndexableStickers(Context context) throws IOException,
FirebaseAppIndexingInvalidArgumentException {
List<Indexable> indexableStickers = new ArrayList<>();
List<StickerBuilder> stickerBuilders = getStickerBuilders(context);
for (StickerBuilder stickerBuilder : stickerBuilders) {
stickerBuilder
.setIsPartOf(Indexables.stickerPackBuilder()
.setName(STICKER_PACK_NAME))
.put("keywords", "tag1", "tag2");
indexableStickers.add(stickerBuilder.build());
}
return indexableStickers;
}
示例8: getIndexable
import com.google.firebase.appindexing.Indexable; //导入依赖的package包/类
private Indexable getIndexable() {
return Indexables.newSimple(titleString, urlInWeb.toString());
}
示例9: getIndexable
import com.google.firebase.appindexing.Indexable; //导入依赖的package包/类
private Indexable getIndexable(Step step) {
String urlInWeb = getUrlInWeb(step);
String title = getTitle(step);
getAnalytic().reportEventWithIdName(Analytic.AppIndexing.STEP, urlInWeb, title);
return Indexables.newSimple(title, urlInWeb);
}
示例10: getIndexable
import com.google.firebase.appindexing.Indexable; //导入依赖的package包/类
private Indexable getIndexable() {
return Indexables.newSimple(title, urlInWeb.toString());
}