use of org.thoughtcrime.securesms.util.TextSecurePreferences.MediaKeyboardMode in project Signal-Android by WhisperSystems.
the class ConversationParentFragment method initializeStickerObserver.
private void initializeStickerObserver() {
StickerSearchRepository repository = new StickerSearchRepository(requireContext());
stickerViewModel = new ViewModelProvider(this, new ConversationStickerViewModel.Factory(requireActivity().getApplication(), repository)).get(ConversationStickerViewModel.class);
stickerViewModel.getStickerResults().observe(getViewLifecycleOwner(), stickers -> {
if (stickers == null)
return;
inputPanel.setStickerSuggestions(stickers);
});
stickerViewModel.getStickersAvailability().observe(getViewLifecycleOwner(), stickersAvailable -> {
if (stickersAvailable == null)
return;
boolean isSystemEmojiPreferred = SignalStore.settings().isPreferSystemEmoji();
MediaKeyboardMode keyboardMode = TextSecurePreferences.getMediaKeyboardMode(requireContext());
boolean stickerIntro = !TextSecurePreferences.hasSeenStickerIntroTooltip(requireContext());
if (stickersAvailable) {
inputPanel.showMediaKeyboardToggle(true);
switch(keyboardMode) {
case EMOJI:
inputPanel.setMediaKeyboardToggleMode(isSystemEmojiPreferred ? KeyboardPage.STICKER : KeyboardPage.EMOJI);
break;
case STICKER:
inputPanel.setMediaKeyboardToggleMode(KeyboardPage.STICKER);
break;
case GIF:
inputPanel.setMediaKeyboardToggleMode(KeyboardPage.GIF);
break;
}
if (stickerIntro)
showStickerIntroductionTooltip();
}
if (emojiDrawerStub.resolved()) {
initializeMediaKeyboardProviders();
}
});
}
Aggregations