Example usage for android.text.method SingleLineTransformationMethod getInstance

List of usage examples for android.text.method SingleLineTransformationMethod getInstance

Introduction

In this page you can find the example usage for android.text.method SingleLineTransformationMethod getInstance.

Prototype

public static SingleLineTransformationMethod getInstance() 

Source Link

Usage

From source file:dk.bearware.gui.MainActivity.java

private void joinChannel(final Channel channel) {
    if (channel.bPassword) {
        AlertDialog.Builder alert = new AlertDialog.Builder(this);
        alert.setTitle(R.string.pref_title_join_channel);
        alert.setMessage(R.string.channel_password_prompt);
        final EditText input = new EditText(this);
        input.setTransformationMethod(SingleLineTransformationMethod.getInstance());
        input.setText(channel.szPassword);
        alert.setView(input);//from   w w w  .  ja v a2 s .  c o  m
        alert.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int whichButton) {
                joinChannel(channel, input.getText().toString());
            }
        });
        alert.setNegativeButton(android.R.string.cancel, null);
        alert.show();
    } else {
        joinChannel(channel, "");
    }
}

From source file:org.woltage.irssiconnectbot.ConsoleActivity.java

/**
 * Show any prompts requested by the currently visible {@link TerminalView}.
 *//*from w w  w  .ja v  a2 s  . c  o  m*/
protected void updatePromptVisible() {
    // check if our currently-visible terminalbridge is requesting any
    // prompt services
    View view = findCurrentView(R.id.console_flip);

    // Hide all the prompts in case a prompt request was canceled
    hideAllPrompts();

    if (!(view instanceof TerminalView)) {
        // we dont have an active view, so hide any prompts
        return;
    }

    PromptHelper prompt = ((TerminalView) view).bridge.promptHelper;
    if (String.class.equals(prompt.promptRequested)) {
        stringPromptGroup.setVisibility(View.VISIBLE);

        String instructions = prompt.promptInstructions;
        boolean password = prompt.passwordRequested;
        if (instructions != null && instructions.length() > 0) {
            stringPromptInstructions.setVisibility(View.VISIBLE);
            stringPromptInstructions.setText(instructions);
        } else
            stringPromptInstructions.setVisibility(View.GONE);

        if (password) {
            stringPrompt.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
            stringPrompt.setTransformationMethod(PasswordTransformationMethod.getInstance());
        } else {
            stringPrompt.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_AUTO_CORRECT);
            stringPrompt.setTransformationMethod(SingleLineTransformationMethod.getInstance());
        }

        stringPrompt.setText("");
        stringPrompt.setHint(prompt.promptHint);
        stringPrompt.requestFocus();

    } else if (Boolean.class.equals(prompt.promptRequested)) {
        booleanPromptGroup.setVisibility(View.VISIBLE);
        booleanPrompt.setText(prompt.promptHint);
        booleanYes.requestFocus();

    } else {
        hideAllPrompts();
        view.requestFocus();
    }
}