Java Code Examples for org.telegram.messenger.AndroidUtilities#showKeyboard()

The following examples show how to use org.telegram.messenger.AndroidUtilities#showKeyboard() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ChatActivityEnterView.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
public void onResume()
{
    isPaused = false;
    if (showKeyboardOnResume)
    {
        showKeyboardOnResume = false;
        if (!searchingStickers)
        {
            messageEditText.requestFocus();
        }
        AndroidUtilities.showKeyboard(messageEditText);
        if (!AndroidUtilities.usingHardwareInput && !keyboardVisible && !AndroidUtilities.isInMultiwindow)
        {
            waitingForKeyboardOpen = true;
            AndroidUtilities.cancelRunOnUIThread(openKeyboardRunnable);
            AndroidUtilities.runOnUIThread(openKeyboardRunnable, 100);
        }
    }
}
 
Example 2
Source File: ChatUsersActivity.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected void onTransitionAnimationEnd(boolean isOpen, boolean backward) {
    if (isOpen && !backward && needOpenSearch) {
        searchItem.getSearchField().requestFocus();
        AndroidUtilities.showKeyboard(searchItem.getSearchField());
    }
}
 
Example 3
Source File: ReportOtherActivity.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onResume() {
    super.onResume();
    SharedPreferences preferences = MessagesController.getGlobalMainSettings();
    boolean animations = preferences.getBoolean("view_animations", true);
    if (!animations) {
        firstNameField.requestFocus();
        AndroidUtilities.showKeyboard(firstNameField);
    }
}
 
Example 4
Source File: ContactAddActivity.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onResume() {
    super.onResume();
    updateAvatarLayout();
    SharedPreferences preferences = MessagesController.getGlobalMainSettings();
    boolean animations = preferences.getBoolean("view_animations", true);
    if (!animations) {
        firstNameField.requestFocus();
        AndroidUtilities.showKeyboard(firstNameField);
    }
}
 
Example 5
Source File: ChangePhoneActivity.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onShow() {
    super.onShow();
    if (phoneField != null) {
        if (codeField.length() != 0) {
            AndroidUtilities.showKeyboard(phoneField);
            phoneField.requestFocus();
            phoneField.setSelection(phoneField.length());
        } else {
            AndroidUtilities.showKeyboard(codeField);
            codeField.requestFocus();
        }
    }
}
 
Example 6
Source File: NewContactActivity.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onResume() {
    super.onResume();
    SharedPreferences preferences = MessagesController.getGlobalMainSettings();
    boolean animations = preferences.getBoolean("view_animations", true);
    if (!animations) {
        firstNameField.requestFocus();
        AndroidUtilities.showKeyboard(firstNameField);
    }
}
 
Example 7
Source File: ChangeUsernameActivity.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onTransitionAnimationEnd(boolean isOpen, boolean backward)
{
    if (isOpen)
    {
        firstNameField.requestFocus();
        AndroidUtilities.showKeyboard(firstNameField);
    }
}
 
Example 8
Source File: EditTextEmoji.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void run() {
    if (!destroyed && editText != null && waitingForKeyboardOpen && !keyboardVisible && !AndroidUtilities.usingHardwareInput && !AndroidUtilities.isInMultiwindow && AndroidUtilities.isTablet()) {
        editText.requestFocus();
        AndroidUtilities.showKeyboard(editText);
        AndroidUtilities.cancelRunOnUIThread(openKeyboardRunnable);
        AndroidUtilities.runOnUIThread(openKeyboardRunnable, 100);
    }
}
 
Example 9
Source File: ChangeBioActivity.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onTransitionAnimationEnd(boolean isOpen, boolean backward) {
    if (isOpen) {
        firstNameField.requestFocus();
        AndroidUtilities.showKeyboard(firstNameField);
    }
}
 
Example 10
Source File: ThemeSetUrlActivity.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onResume() {
    super.onResume();
    SharedPreferences preferences = MessagesController.getGlobalMainSettings();
    boolean animations = preferences.getBoolean("view_animations", true);
    if (!animations && creatingNewTheme) {
        linkField.requestFocus();
        AndroidUtilities.showKeyboard(linkField);
    }
    AndroidUtilities.requestAdjustResize(getParentActivity(), classGuid);
    AndroidUtilities.removeAdjustResize(getParentActivity(), classGuid);
}
 
Example 11
Source File: PasscodeView.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
private void checkRetryTextView() {
    long currentTime = SystemClock.elapsedRealtime();
    if (currentTime > SharedConfig.lastUptimeMillis) {
        SharedConfig.passcodeRetryInMs -= (currentTime - SharedConfig.lastUptimeMillis);
        if (SharedConfig.passcodeRetryInMs < 0) {
            SharedConfig.passcodeRetryInMs = 0;
        }
    }
    SharedConfig.lastUptimeMillis = currentTime;
    SharedConfig.saveConfig();
    if (SharedConfig.passcodeRetryInMs > 0) {
        int value = Math.max(1, (int) Math.ceil(SharedConfig.passcodeRetryInMs / 1000.0));
        if (value != lastValue) {
            retryTextView.setText(LocaleController.formatString("TooManyTries", R.string.TooManyTries, LocaleController.formatPluralString("Seconds", value)));
            lastValue = value;
        }
        if (retryTextView.getVisibility() != VISIBLE) {
            retryTextView.setVisibility(VISIBLE);
            passwordFrameLayout.setVisibility(INVISIBLE);
            if (numbersFrameLayout.getVisibility() == VISIBLE) {
                numbersFrameLayout.setVisibility(INVISIBLE);
            }
            AndroidUtilities.hideKeyboard(passwordEditText);
            AndroidUtilities.cancelRunOnUIThread(checkRunnable);
            AndroidUtilities.runOnUIThread(checkRunnable, 100);
        }
    } else {
        AndroidUtilities.cancelRunOnUIThread(checkRunnable);
        if (passwordFrameLayout.getVisibility() != VISIBLE) {
            retryTextView.setVisibility(INVISIBLE);
            passwordFrameLayout.setVisibility(VISIBLE);
            if (SharedConfig.passcodeType == 0) {
                numbersFrameLayout.setVisibility(VISIBLE);
            } else if (SharedConfig.passcodeType == 1) {
                AndroidUtilities.showKeyboard(passwordEditText);
            }
        }
    }
}
 
Example 12
Source File: ChangeNameActivity.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onResume() {
    super.onResume();
    SharedPreferences preferences = MessagesController.getGlobalMainSettings();
    boolean animations = preferences.getBoolean("view_animations", true);
    if (!animations) {
        firstNameField.requestFocus();
        AndroidUtilities.showKeyboard(firstNameField);
    }
}
 
Example 13
Source File: ThemeSetUrlActivity.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onResume() {
    super.onResume();
    SharedPreferences preferences = MessagesController.getGlobalMainSettings();
    boolean animations = preferences.getBoolean("view_animations", true);
    if (!animations && creatingNewTheme) {
        linkField.requestFocus();
        AndroidUtilities.showKeyboard(linkField);
    }
    AndroidUtilities.requestAdjustResize(getParentActivity(), classGuid);
    AndroidUtilities.removeAdjustResize(getParentActivity(), classGuid);
}
 
Example 14
Source File: ProxySettingsActivity.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected void onTransitionAnimationEnd(boolean isOpen, boolean backward) {
    if (isOpen && !backward && addingNewProxy) {
        inputFields[FIELD_IP].requestFocus();
        AndroidUtilities.showKeyboard(inputFields[FIELD_IP]);
    }
}
 
Example 15
Source File: ChangeChatNameActivity.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onResume()
{
    super.onResume();
    SharedPreferences preferences = MessagesController.getGlobalMainSettings();
    boolean animations = preferences.getBoolean("view_animations", true);
    if (!animations)
    {
        nameTextView.requestFocus();
        AndroidUtilities.showKeyboard(nameTextView);
    }
}
 
Example 16
Source File: PhotoPickerActivity.java    From Telegram-FOSS with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void onTransitionAnimationEnd(boolean isOpen, boolean backward) {
    if (isOpen && searchItem != null) {
        AndroidUtilities.showKeyboard(searchItem.getSearchField());
    }
}
 
Example 17
Source File: TwoStepVerificationActivity.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void onTransitionAnimationEnd(boolean isOpen, boolean backward) {
    if (isOpen && type == 1) {
        AndroidUtilities.showKeyboard(passwordEditText);
    }
}
 
Example 18
Source File: TwoStepVerificationActivity.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void onTransitionAnimationEnd(boolean isOpen, boolean backward) {
    if (isOpen && type == 1) {
        AndroidUtilities.showKeyboard(passwordEditText);
    }
}
 
Example 19
Source File: ActionBarMenuItem.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
public boolean toggleSearch(boolean openKeyboard)
{
    if (searchContainer == null)
    {
        return false;
    }
    if (searchContainer.getVisibility() == VISIBLE)
    {
        if (listener == null || listener != null && listener.canCollapseSearch())
        {
            searchContainer.setVisibility(GONE);
            searchField.clearFocus();
            setVisibility(VISIBLE);
            if (openKeyboard)
            {
                AndroidUtilities.hideKeyboard(searchField);
            }
            if (listener != null)
            {
                listener.onSearchCollapse();
            }
        }
        return false;
    }
    else
    {
        searchContainer.setVisibility(VISIBLE);
        setVisibility(GONE);
        searchField.setText("");
        searchField.requestFocus();
        if (openKeyboard)
        {
            AndroidUtilities.showKeyboard(searchField);
        }
        if (listener != null)
        {
            listener.onSearchExpand();
        }
        return true;
    }
}
 
Example 20
Source File: CancelAccountDeletionActivity.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void setParams(Bundle params, boolean restore) {
    if (params == null) {
        return;
    }
    codeField.setText("");
    waitingForEvent = true;
    if (currentType == 2) {
        AndroidUtilities.setWaitingForSms(true);
        NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.didReceiveSmsCode);
    } else if (currentType == 3) {
        AndroidUtilities.setWaitingForCall(true);
        NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.didReceiveCall);
    }

    currentParams = params;
    phone = params.getString("phone");
    phoneHash = params.getString("phoneHash");
    timeout = time = params.getInt("timeout");
    openTime = (int) (System.currentTimeMillis() / 1000);
    nextType = params.getInt("nextType");
    pattern = params.getString("pattern");
    length = params.getInt("length");

    if (length != 0) {
        InputFilter[] inputFilters = new InputFilter[1];
        inputFilters[0] = new InputFilter.LengthFilter(length);
        codeField.setFilters(inputFilters);
    } else {
        codeField.setFilters(new InputFilter[0]);
    }
    if (progressView != null) {
        progressView.setVisibility(nextType != 0 ? VISIBLE : GONE);
    }

    if (phone == null) {
        return;
    }

    String number = PhoneFormat.getInstance().format(phone);
    CharSequence str;
    /*if (currentType == 1) {
        str = AndroidUtilities.replaceTags(LocaleController.getString("SentAppCode", R.string.SentAppCode));
    } else if (currentType == 2) {*/
    str = AndroidUtilities.replaceTags(LocaleController.formatString("CancelAccountResetInfo", R.string.CancelAccountResetInfo, PhoneFormat.getInstance().format("+" + number)));
    /*} else if (currentType == 3) {
        str = AndroidUtilities.replaceTags(LocaleController.formatString("SentCallCode", R.string.SentCallCode, number));
    } else if (currentType == 4) {
        str = AndroidUtilities.replaceTags(LocaleController.formatString("SentCallOnly", R.string.SentCallOnly, number));
    }*/
    confirmTextView.setText(str);

    if (currentType != 3) {
        AndroidUtilities.showKeyboard(codeField);
        codeField.requestFocus();
    } else {
        AndroidUtilities.hideKeyboard(codeField);
    }

    destroyTimer();
    destroyCodeTimer();

    lastCurrentTime = System.currentTimeMillis();
    if (currentType == 1) {
        problemText.setVisibility(VISIBLE);
        timeText.setVisibility(GONE);
    } else if (currentType == 3 && (nextType == 4 || nextType == 2)) {
        problemText.setVisibility(GONE);
        timeText.setVisibility(VISIBLE);
        if (nextType == 4) {
            timeText.setText(LocaleController.formatString("CallText", R.string.CallText, 1, 0));
        } else if (nextType == 2) {
            timeText.setText(LocaleController.formatString("SmsText", R.string.SmsText, 1, 0));
        }
        createTimer();
    } else if (currentType == 2 && (nextType == 4 || nextType == 3)) {
        timeText.setVisibility(VISIBLE);
        timeText.setText(LocaleController.formatString("CallText", R.string.CallText, 2, 0));
        problemText.setVisibility(time < 1000 ? VISIBLE : GONE);
        createTimer();
    } else {
        timeText.setVisibility(GONE);
        problemText.setVisibility(GONE);
        createCodeTimer();
    }
}