本文整理汇总了Java中com.google.firebase.appindexing.builders.Indexables类的典型用法代码示例。如果您正苦于以下问题:Java Indexables类的具体用法?Java Indexables怎么用?Java Indexables使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Indexables类属于com.google.firebase.appindexing.builders包,在下文中一共展示了Indexables类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getMessageIndexable
import com.google.firebase.appindexing.builders.Indexables; //导入依赖的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;
}
开发者ID:firebase,项目名称:friendlychat-android,代码行数:20,代码来源:MainActivity.java
示例2: getIndexableStickerPack
import com.google.firebase.appindexing.builders.Indexables; //导入依赖的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();
}
开发者ID:firebase,项目名称:quickstart-android,代码行数:27,代码来源:AppIndexingUtil.java
示例3: indexNote
import com.google.firebase.appindexing.builders.Indexables; //导入依赖的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]
}
开发者ID:googlecodelabs,项目名称:app-indexing,代码行数:27,代码来源:RecipeActivity.java
示例4: onHandleIntent
import com.google.firebase.appindexing.builders.Indexables; //导入依赖的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);
}
}
开发者ID:googlecodelabs,项目名称:app-indexing,代码行数:26,代码来源:AppIndexingService.java
示例5: getIndexable
import com.google.firebase.appindexing.builders.Indexables; //导入依赖的package包/类
private Indexable getIndexable(Message message) {
return Indexables.messageBuilder()
.setName(message.text())
.setUrl(getUrl(message.uuid()))
.setRecipient(getRecipient(message))
.setSender(getSender(message))
.build();
}
开发者ID:ashdavies,项目名称:eternity,代码行数:9,代码来源:MessageIndexer.java
示例6: getSender
import com.google.firebase.appindexing.builders.Indexables; //导入依赖的package包/类
private PersonBuilder getSender(Message message) {
String uid = FirebaseAuth.getInstance()
.getCurrentUser()
.getUid();
return Indexables.personBuilder()
.setIsSelf(uid.equals(message.author().uuid()))
.setName(message.author().name())
.setUrl(getUrl(message.uuid(), "sender"));
}
开发者ID:ashdavies,项目名称:eternity,代码行数:11,代码来源:MessageIndexer.java
示例7: getIndexableStickers
import com.google.firebase.appindexing.builders.Indexables; //导入依赖的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;
}
开发者ID:firebase,项目名称:quickstart-android,代码行数:16,代码来源:AppIndexingUtil.java
示例8: getStickerBuilders
import com.google.firebase.appindexing.builders.Indexables; //导入依赖的package包/类
private static List<StickerBuilder> getStickerBuilders(Context context) throws IOException {
List<StickerBuilder> stickerBuilders = new ArrayList<>();
int[] stickerColors = new int[] {Color.GREEN, Color.RED, Color.BLUE,
Color.YELLOW, Color.MAGENTA};
File stickersDir = new File(context.getFilesDir(), "stickers");
if (!stickersDir.exists() && !stickersDir.mkdirs()) {
throw new IOException("Stickers directory does not exist");
}
for (int i = 0; i < stickerColors.length; i++) {
String stickerFilename = getStickerFilename(i);
File stickerFile = new File(stickersDir, stickerFilename);
String imageUrl = getStickerUrl(stickerFilename);
writeSolidColorBitmapToFile(stickerFile, stickerColors[i]);
StickerBuilder stickerBuilder = Indexables.stickerBuilder()
.setName(getStickerFilename(i))
// Firebase App Indexing unique key that must match an intent-filter
// (e.g. mystickers://sticker/0)
.setUrl(String.format(STICKER_URL_PATTERN, i))
// http url or content uri that resolves to the sticker
// (e.g. http://www.google.com/sticker.png or content://some/path/0)
.setImage(imageUrl)
.setDescription("content description")
.setIsPartOf(Indexables.stickerPackBuilder()
.setName(STICKER_PACK_NAME))
.put("keywords", "tag1", "tag2");
stickerBuilders.add(stickerBuilder);
}
return stickerBuilders;
}
开发者ID:firebase,项目名称:quickstart-android,代码行数:35,代码来源:AppIndexingUtil.java
示例9: getRecipient
import com.google.firebase.appindexing.builders.Indexables; //导入依赖的package包/类
private PersonBuilder getRecipient(Message message) {
return Indexables.personBuilder()
.setName(message.author().name())
.setUrl(getUrl(message.uuid(), "recipient"));
}
开发者ID:ashdavies,项目名称:eternity,代码行数:6,代码来源:MessageIndexer.java
示例10: getIndexable
import com.google.firebase.appindexing.builders.Indexables; //导入依赖的package包/类
private Indexable getIndexable() {
return Indexables.newSimple(titleString, urlInWeb.toString());
}
开发者ID:StepicOrg,项目名称:stepik-android,代码行数:4,代码来源:CourseDetailFragment.java
示例11: getIndexable
import com.google.firebase.appindexing.builders.Indexables; //导入依赖的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);
}
开发者ID:StepicOrg,项目名称:stepik-android,代码行数:7,代码来源:LessonFragment.java
示例12: getIndexable
import com.google.firebase.appindexing.builders.Indexables; //导入依赖的package包/类
private Indexable getIndexable() {
return Indexables.newSimple(title, urlInWeb.toString());
}
开发者ID:StepicOrg,项目名称:stepik-android,代码行数:4,代码来源:SectionsFragment.java
注:本文中的com.google.firebase.appindexing.builders.Indexables类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论