Search in sources :

Example 26 with EditText

use of android.widget.EditText in project androidannotations by androidannotations.

the class EditorActionsActivityTest method testKeyEventPassed.

@Test
public void testKeyEventPassed() {
    assertThat(activity.keyEvent).isNull();
    EditText editText = (EditText) activity.findViewById(R.id.editText3);
    OnEditorActionListener listener = getOnEditorActionListener(editText);
    KeyEvent event = new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_F);
    listener.onEditorAction(editText, 0, event);
    assertThat(activity.keyEvent).isEqualTo(event);
}
Also used : EditText(android.widget.EditText) KeyEvent(android.view.KeyEvent) OnEditorActionListener(android.widget.TextView.OnEditorActionListener) Test(org.junit.Test)

Example 27 with EditText

use of android.widget.EditText in project androidannotations by androidannotations.

the class EditorActionsActivityTest method testTrueReturnedFromVoidEditorActionMethod.

@Test
public void testTrueReturnedFromVoidEditorActionMethod() {
    EditText editText = (EditText) activity.findViewById(R.id.editText3);
    OnEditorActionListener listener = getOnEditorActionListener(editText);
    assertThat(listener.onEditorAction(editText, 0, null)).isTrue();
}
Also used : EditText(android.widget.EditText) OnEditorActionListener(android.widget.TextView.OnEditorActionListener) Test(org.junit.Test)

Example 28 with EditText

use of android.widget.EditText in project platform_frameworks_base by android.

the class BiDiTestGridLayoutCodeRtl method create.

public static View create(Context context) {
    GridLayout layout = new GridLayout(context);
    layout.setUseDefaultMargins(true);
    layout.setAlignmentMode(ALIGN_BOUNDS);
    layout.setRowOrderPreserved(false);
    layout.setLayoutDirection(View.LAYOUT_DIRECTION_RTL);
    Spec row1 = spec(0);
    Spec row2 = spec(1);
    Spec row3 = spec(2, BASELINE);
    Spec row4 = spec(3, BASELINE);
    // allow the last two rows to overlap the middle two
    Spec row5 = spec(2, 3, FILL);
    Spec row6 = spec(5);
    Spec row7 = spec(6);
    Spec col1a = spec(0, 4, CENTER);
    Spec col1b = spec(0, 4, LEFT);
    Spec col1c = spec(0, RIGHT);
    Spec col2 = spec(1, START);
    Spec col3 = spec(2, FILL);
    Spec col4a = spec(3);
    Spec col4b = spec(3, FILL);
    {
        TextView c = new TextView(context);
        c.setTextSize(32);
        c.setText("Email setup");
        layout.addView(c, new GridLayout.LayoutParams(row1, col1a));
    }
    {
        TextView c = new TextView(context);
        c.setTextSize(16);
        c.setText("You can configure email in just a few steps:");
        layout.addView(c, new GridLayout.LayoutParams(row2, col1b));
    }
    {
        TextView c = new TextView(context);
        c.setText("Email address:");
        layout.addView(c, new GridLayout.LayoutParams(row3, col1c));
    }
    {
        EditText c = new EditText(context);
        c.setEms(10);
        c.setInputType(TYPE_CLASS_TEXT | TYPE_TEXT_VARIATION_EMAIL_ADDRESS);
        layout.addView(c, new GridLayout.LayoutParams(row3, col2));
    }
    {
        TextView c = new TextView(context);
        c.setText("Password:");
        layout.addView(c, new GridLayout.LayoutParams(row4, col1c));
    }
    {
        TextView c = new EditText(context);
        c.setEms(8);
        c.setInputType(TYPE_CLASS_TEXT | TYPE_TEXT_VARIATION_PASSWORD);
        layout.addView(c, new GridLayout.LayoutParams(row4, col2));
    }
    {
        Space c = new Space(context);
        layout.addView(c, new GridLayout.LayoutParams(row5, col3));
    }
    {
        Button c = new Button(context);
        c.setText("Manual setup");
        layout.addView(c, new GridLayout.LayoutParams(row6, col4a));
    }
    {
        Button c = new Button(context);
        c.setText("Next");
        layout.addView(c, new GridLayout.LayoutParams(row7, col4b));
    }
    return layout;
}
Also used : EditText(android.widget.EditText) Space(android.widget.Space) GridLayout(android.widget.GridLayout) Button(android.widget.Button) TextView(android.widget.TextView) Spec(android.widget.GridLayout.Spec)

Example 29 with EditText

use of android.widget.EditText in project platform_frameworks_base by android.

the class BiDiTestBasic method useSpans.

private void useSpans() {
    EditText urlEdit = (EditText) currentView.findViewById(R.id.edittext_url);
    Editable url = urlEdit.getText();
    if (url.length() < 1) {
        return;
    }
    String urlString = url.toString();
    int urlLength = urlString.length();
    String domainAndRegistry = "amazon.co.uk";
    int startSchemeIndex = urlString.startsWith("https") ? 5 : 0;
    int startDomainIndex = urlString.indexOf(domainAndRegistry);
    if (startDomainIndex == -1) {
        assert false;
        return;
    }
    int stopIndex = startDomainIndex + domainAndRegistry.length();
    if (startDomainIndex != 0) {
        url.setSpan(new ForegroundColorSpan(0xfff00fff), startSchemeIndex, startDomainIndex, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
    }
    url.setSpan(new ForegroundColorSpan(0xff548aff), startDomainIndex, stopIndex, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
    if (stopIndex < urlString.length()) {
        url.setSpan(new ForegroundColorSpan(0xfff00fff), stopIndex, urlLength, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
    }
}
Also used : EditText(android.widget.EditText) ForegroundColorSpan(android.text.style.ForegroundColorSpan) Editable(android.text.Editable)

Example 30 with EditText

use of android.widget.EditText in project platform_frameworks_base by android.

the class BiDiTestGridLayoutCodeLtr method create.

public static View create(Context context) {
    GridLayout layout = new GridLayout(context);
    layout.setUseDefaultMargins(true);
    layout.setAlignmentMode(ALIGN_BOUNDS);
    layout.setRowOrderPreserved(false);
    layout.setLayoutDirection(View.LAYOUT_DIRECTION_LTR);
    Spec row1 = spec(0);
    Spec row2 = spec(1);
    Spec row3 = spec(2, BASELINE);
    Spec row4 = spec(3, BASELINE);
    // allow the last two rows to overlap the middle two
    Spec row5 = spec(2, 3, FILL);
    Spec row6 = spec(5);
    Spec row7 = spec(6);
    Spec col1a = spec(0, 4, CENTER);
    Spec col1b = spec(0, 4, LEFT);
    Spec col1c = spec(0, RIGHT);
    Spec col2 = spec(1, START);
    Spec col3 = spec(2, FILL);
    Spec col4a = spec(3);
    Spec col4b = spec(3, FILL);
    {
        TextView c = new TextView(context);
        c.setTextSize(32);
        c.setText("Email setup");
        layout.addView(c, new GridLayout.LayoutParams(row1, col1a));
    }
    {
        TextView c = new TextView(context);
        c.setTextSize(16);
        c.setText("You can configure email in just a few steps:");
        layout.addView(c, new GridLayout.LayoutParams(row2, col1b));
    }
    {
        TextView c = new TextView(context);
        c.setText("Email address:");
        layout.addView(c, new GridLayout.LayoutParams(row3, col1c));
    }
    {
        EditText c = new EditText(context);
        c.setEms(10);
        c.setInputType(TYPE_CLASS_TEXT | TYPE_TEXT_VARIATION_EMAIL_ADDRESS);
        layout.addView(c, new GridLayout.LayoutParams(row3, col2));
    }
    {
        TextView c = new TextView(context);
        c.setText("Password:");
        layout.addView(c, new GridLayout.LayoutParams(row4, col1c));
    }
    {
        TextView c = new EditText(context);
        c.setEms(8);
        c.setInputType(TYPE_CLASS_TEXT | TYPE_TEXT_VARIATION_PASSWORD);
        layout.addView(c, new GridLayout.LayoutParams(row4, col2));
    }
    {
        Space c = new Space(context);
        layout.addView(c, new GridLayout.LayoutParams(row5, col3));
    }
    {
        Button c = new Button(context);
        c.setText("Manual setup");
        layout.addView(c, new GridLayout.LayoutParams(row6, col4a));
    }
    {
        Button c = new Button(context);
        c.setText("Next");
        layout.addView(c, new GridLayout.LayoutParams(row7, col4b));
    }
    return layout;
}
Also used : EditText(android.widget.EditText) Space(android.widget.Space) GridLayout(android.widget.GridLayout) Button(android.widget.Button) TextView(android.widget.TextView) Spec(android.widget.GridLayout.Spec)

Aggregations

EditText (android.widget.EditText)655 View (android.view.View)309 TextView (android.widget.TextView)220 DialogInterface (android.content.DialogInterface)143 AlertDialog (android.app.AlertDialog)126 Button (android.widget.Button)126 Intent (android.content.Intent)99 LinearLayout (android.widget.LinearLayout)79 ImageView (android.widget.ImageView)61 AlertDialog (android.support.v7.app.AlertDialog)54 ScrollView (android.widget.ScrollView)52 LayoutInflater (android.view.LayoutInflater)48 AdapterView (android.widget.AdapterView)46 ViewGroup (android.view.ViewGroup)42 Editable (android.text.Editable)41 Context (android.content.Context)40 RecyclerView (android.support.v7.widget.RecyclerView)40 ListView (android.widget.ListView)39 Dialog (android.app.Dialog)36 Bundle (android.os.Bundle)36