Search in sources :

Example 1 with KeyboardPagerFragment

use of org.thoughtcrime.securesms.keyboard.KeyboardPagerFragment in project Signal-Android by WhisperSystems.

the class MediaKeyboard method initView.

private void initView() {
    if (!isInitialised) {
        LayoutInflater.from(getContext()).inflate(R.layout.media_keyboard, this, true);
        if (fragmentManager == null) {
            FragmentActivity activity = resolveActivity(getContext());
            fragmentManager = activity.getSupportFragmentManager();
        }
        keyboardPagerFragment = new KeyboardPagerFragment();
        fragmentManager.beginTransaction().replace(R.id.media_keyboard_fragment_container, keyboardPagerFragment).commitNowAllowingStateLoss();
        keyboardState = State.NORMAL;
        latestKeyboardHeight = -1;
        isInitialised = true;
    }
}
Also used : FragmentActivity(androidx.fragment.app.FragmentActivity) KeyboardPagerFragment(org.thoughtcrime.securesms.keyboard.KeyboardPagerFragment)

Example 2 with KeyboardPagerFragment

use of org.thoughtcrime.securesms.keyboard.KeyboardPagerFragment in project Signal-Android by WhisperSystems.

the class MediaKeyboard method onCloseEmojiSearchInternal.

private void onCloseEmojiSearchInternal(boolean showAfterCommit) {
    if (keyboardState == State.NORMAL) {
        return;
    }
    keyboardState = State.NORMAL;
    Fragment emojiSearch = fragmentManager.findFragmentByTag(EMOJI_SEARCH);
    if (emojiSearch == null) {
        return;
    }
    FragmentTransaction transaction = fragmentManager.beginTransaction().remove(emojiSearch).show(keyboardPagerFragment).setCustomAnimations(R.anim.fade_in, R.anim.fade_out);
    if (showAfterCommit) {
        transaction.runOnCommit(() -> show(latestKeyboardHeight, false));
    }
    transaction.commitAllowingStateLoss();
}
Also used : FragmentTransaction(androidx.fragment.app.FragmentTransaction) EmojiSearchFragment(org.thoughtcrime.securesms.keyboard.emoji.search.EmojiSearchFragment) Fragment(androidx.fragment.app.Fragment) KeyboardPagerFragment(org.thoughtcrime.securesms.keyboard.KeyboardPagerFragment)

Example 3 with KeyboardPagerFragment

use of org.thoughtcrime.securesms.keyboard.KeyboardPagerFragment in project Signal-Android by signalapp.

the class MediaKeyboard method initView.

private void initView() {
    if (!isInitialised) {
        LayoutInflater.from(getContext()).inflate(R.layout.media_keyboard, this, true);
        if (fragmentManager == null) {
            FragmentActivity activity = resolveActivity(getContext());
            fragmentManager = activity.getSupportFragmentManager();
        }
        keyboardPagerFragment = new KeyboardPagerFragment();
        fragmentManager.beginTransaction().replace(R.id.media_keyboard_fragment_container, keyboardPagerFragment).commitNowAllowingStateLoss();
        keyboardState = State.NORMAL;
        latestKeyboardHeight = -1;
        isInitialised = true;
    }
}
Also used : FragmentActivity(androidx.fragment.app.FragmentActivity) KeyboardPagerFragment(org.thoughtcrime.securesms.keyboard.KeyboardPagerFragment)

Example 4 with KeyboardPagerFragment

use of org.thoughtcrime.securesms.keyboard.KeyboardPagerFragment in project Signal-Android by signalapp.

the class MediaKeyboard method onCloseEmojiSearchInternal.

private void onCloseEmojiSearchInternal(boolean showAfterCommit) {
    if (keyboardState == State.NORMAL) {
        return;
    }
    keyboardState = State.NORMAL;
    Fragment emojiSearch = fragmentManager.findFragmentByTag(EMOJI_SEARCH);
    if (emojiSearch == null) {
        return;
    }
    FragmentTransaction transaction = fragmentManager.beginTransaction().remove(emojiSearch).show(keyboardPagerFragment).setCustomAnimations(R.anim.fade_in, R.anim.fade_out);
    if (showAfterCommit) {
        transaction.runOnCommit(() -> show(latestKeyboardHeight, false));
    }
    transaction.commitAllowingStateLoss();
}
Also used : FragmentTransaction(androidx.fragment.app.FragmentTransaction) EmojiSearchFragment(org.thoughtcrime.securesms.keyboard.emoji.search.EmojiSearchFragment) Fragment(androidx.fragment.app.Fragment) KeyboardPagerFragment(org.thoughtcrime.securesms.keyboard.KeyboardPagerFragment)

Aggregations

KeyboardPagerFragment (org.thoughtcrime.securesms.keyboard.KeyboardPagerFragment)4 Fragment (androidx.fragment.app.Fragment)2 FragmentActivity (androidx.fragment.app.FragmentActivity)2 FragmentTransaction (androidx.fragment.app.FragmentTransaction)2 EmojiSearchFragment (org.thoughtcrime.securesms.keyboard.emoji.search.EmojiSearchFragment)2