Example usage for android.inputmethodservice Keyboard Keyboard

List of usage examples for android.inputmethodservice Keyboard Keyboard

Introduction

In this page you can find the example usage for android.inputmethodservice Keyboard Keyboard.

Prototype

public Keyboard(Context context, int xmlLayoutResId) 

Source Link

Document

Creates a keyboard from the given xml key layout file.

Usage

From source file:keyboard.ecloga.com.eclogakeyboard.EclogaKeyboard.java

public void onSwipeRight() {
    slideAnimation();/*from   w w w  .j a  va 2  s.c  o m*/
    switch (screen) {
    case 1:
        if (orient.equals("portrait")) {
            keyboard = new Keyboard(this, R.xml.numeric);
        } else if (orient.equals("landscape")) {
            keyboard = new Keyboard(this, R.xml.numeric_landscape);
        }
        kv.setKeyboard(keyboard);
        kv.invalidateAllKeys();
        screen = 2;
        number = 1;
        break;
    case 2:
        keyboard = new Keyboard(this, R.xml.emoji_a1);
        kv.setKeyboard(keyboard);
        kv.invalidateAllKeys();
        screen = 3;
        break;
    case 3:
        if (orient.equals("portrait")) {
            keyboard = prilang;
        } else if (orient.equals("landscape")) {
            keyboard = prilang_landscape;
        }
        kv.setKeyboard(keyboard);
        kv.invalidateAllKeys();
        if (caps) {
            caps = true;
            kv.setShifted(caps);
            kv.invalidateAllKeys();
        } else {
            if (allCaps) {
                caps = true;
                capsLock = false;
            } else {
                caps = false;
            }

            kv.setShifted(caps);
            kv.invalidateAllKeys();
        }
        screen = 1;
        break;
    }
}

From source file:keyboard.ecloga.com.eclogakeyboard.EclogaKeyboard.java

public void onSwipeUp() {
    doubleUp = doubleUp + 1;//from   ww w.  ja v  a 2s  . c o  m

    if (allCaps) {
        capsLock = false;
    }

    caps = true;
    keyboard.setShifted(caps);
    kv.invalidateAllKeys();
    printChar = false;

    if (screen == 3) {
        switchEmojiUp();
    } else if (screen == 2) {
        switch (number) {
        case 1:
            if (orient.equals("portrait")) {
                keyboard = new Keyboard(this, R.xml.symbols);
            } else if (orient.equals("landscape")) {
                keyboard = new Keyboard(this, R.xml.symbols_landscape);
            }
            kv.setKeyboard(keyboard);
            kv.invalidateAllKeys();
            number = 2;
            break;
        case 2:
            if (orient.equals("portrait")) {
                keyboard = new Keyboard(this, R.xml.numeric);
            } else if (orient.equals("landscape")) {
                keyboard = new Keyboard(this, R.xml.numeric_landscape);
            }
            kv.setKeyboard(keyboard);
            kv.invalidateAllKeys();
            number = 1;
            break;
        }
    }
}

From source file:keyboard.ecloga.com.eclogakeyboard.EclogaKeyboard.java

private void initializeKeyboard() {
    sPrilang = Preferences.getDefaults("prilang", getApplicationContext());
    sSeclang = Preferences.getDefaults("seclang", getApplicationContext());

    size = Integer.parseInt(Preferences.getDefaults("size", getApplicationContext()));

    switch (sPrilang) {
    case "en":
        if (size == 1) {
            prilang = new Keyboard(this, R.xml.english_small);
            prilang_landscape = new Keyboard(this, R.xml.english);
        } else if (size == 2) {
            prilang = new Keyboard(this, R.xml.english);
            prilang_landscape = new Keyboard(this, R.xml.english_landscape);
        } else if (size == 3) {
            prilang = new Keyboard(this, R.xml.english_landscape);
            prilang_landscape = new Keyboard(this, R.xml.english_big);
        }/*from   w  w w.  ja v  a2 s .co  m*/
        break;
    case "sr":
        if (size == 1) {
            prilang = new Keyboard(this, R.xml.serbian_small);
            prilang_landscape = new Keyboard(this, R.xml.serbian);
        } else if (size == 2) {
            prilang = new Keyboard(this, R.xml.serbian);
            prilang_landscape = new Keyboard(this, R.xml.serbian_landscape);
        } else if (size == 3) {
            prilang = new Keyboard(this, R.xml.serbian_landscape);
            prilang_landscape = new Keyboard(this, R.xml.serbian_big);
        }
        break;
    case "el":
        if (size == 1) {
            prilang = new Keyboard(this, R.xml.greek_small);
            prilang_landscape = new Keyboard(this, R.xml.greek);
        } else if (size == 2) {
            prilang = new Keyboard(this, R.xml.greek);
            prilang_landscape = new Keyboard(this, R.xml.greek_landscape);
        } else if (size == 3) {
            prilang = new Keyboard(this, R.xml.greek_landscape);
            prilang_landscape = new Keyboard(this, R.xml.greek_big);
        }
        break;
    case "fr":
        if (size == 1) {
            prilang = new Keyboard(this, R.xml.french_small);
            prilang_landscape = new Keyboard(this, R.xml.french);
        } else if (size == 2) {
            prilang = new Keyboard(this, R.xml.french);
            prilang_landscape = new Keyboard(this, R.xml.french_landscape);
        } else if (size == 3) {
            prilang = new Keyboard(this, R.xml.french_landscape);
            prilang_landscape = new Keyboard(this, R.xml.french_big);
        }
        break;
    case "cz":
        if (size == 1) {
            prilang = new Keyboard(this, R.xml.czech_small);
            prilang_landscape = new Keyboard(this, R.xml.czech);
        } else if (size == 2) {
            prilang = new Keyboard(this, R.xml.czech);
            prilang_landscape = new Keyboard(this, R.xml.czech_landscape);
        } else if (size == 3) {
            prilang = new Keyboard(this, R.xml.czech_landscape);
            prilang_landscape = new Keyboard(this, R.xml.czech_big);
        }
        break;
    case "de":
        if (size == 1) {
            prilang = new Keyboard(this, R.xml.german_small);
            prilang_landscape = new Keyboard(this, R.xml.german);
        } else if (size == 2) {
            prilang = new Keyboard(this, R.xml.german);
            prilang_landscape = new Keyboard(this, R.xml.german_landscape);
        } else if (size == 3) {
            prilang = new Keyboard(this, R.xml.german_landscape);
            prilang_landscape = new Keyboard(this, R.xml.german_big);
        }
        break;
    case "it":
        if (size == 1) {
            prilang = new Keyboard(this, R.xml.english_small);
            prilang_landscape = new Keyboard(this, R.xml.english);
        } else if (size == 2) {
            prilang = new Keyboard(this, R.xml.english);
            prilang_landscape = new Keyboard(this, R.xml.english_landscape);
        } else if (size == 3) {
            prilang = new Keyboard(this, R.xml.english_landscape);
            prilang_landscape = new Keyboard(this, R.xml.english_big);
        }
        break;
    case "es":
        if (size == 1) {
            prilang = new Keyboard(this, R.xml.english_small);
            prilang_landscape = new Keyboard(this, R.xml.english);
        } else if (size == 2) {
            prilang = new Keyboard(this, R.xml.english);
            prilang_landscape = new Keyboard(this, R.xml.english_landscape);
        } else if (size == 3) {
            prilang = new Keyboard(this, R.xml.english_landscape);
            prilang_landscape = new Keyboard(this, R.xml.english_big);
        }
        break;
    case "ru":
        if (size == 1) {
            prilang = new Keyboard(this, R.xml.russian_small);
            prilang_landscape = new Keyboard(this, R.xml.russian);
        } else if (size == 2) {
            prilang = new Keyboard(this, R.xml.russian);
            prilang_landscape = new Keyboard(this, R.xml.russian_landscape);
        } else if (size == 3) {
            prilang = new Keyboard(this, R.xml.russian_landscape);
            prilang_landscape = new Keyboard(this, R.xml.russian_big);
        }
        break;
    case "tr":
        if (size == 1) {
            prilang = new Keyboard(this, R.xml.turkish_small);
            prilang_landscape = new Keyboard(this, R.xml.turkish);
        } else if (size == 2) {
            prilang = new Keyboard(this, R.xml.turkish);
            prilang_landscape = new Keyboard(this, R.xml.turkish_landscape);
        } else if (size == 3) {
            prilang = new Keyboard(this, R.xml.turkish_landscape);
            prilang_landscape = new Keyboard(this, R.xml.turkish_big);
        }
        break;
    case "hu":
        if (size == 1) {
            prilang = new Keyboard(this, R.xml.hungarian_small);
            prilang_landscape = new Keyboard(this, R.xml.hungarian);
        } else if (size == 2) {
            prilang = new Keyboard(this, R.xml.hungarian);
            prilang_landscape = new Keyboard(this, R.xml.hungarian_landscape);
        } else if (size == 3) {
            prilang = new Keyboard(this, R.xml.hungarian_landscape);
            prilang_landscape = new Keyboard(this, R.xml.hungarian_big);
        }
        break;
    }

    switch (sSeclang) {
    case "en":
        if (size == 1) {
            seclang = new Keyboard(this, R.xml.english_small);
            seclang_landscape = new Keyboard(this, R.xml.english);
        } else if (size == 2) {
            seclang = new Keyboard(this, R.xml.english);
            seclang_landscape = new Keyboard(this, R.xml.english_landscape);
        } else if (size == 3) {
            seclang = new Keyboard(this, R.xml.english_landscape);
            seclang_landscape = new Keyboard(this, R.xml.english_big);
        }
        break;
    case "sr":
        if (size == 1) {
            seclang = new Keyboard(this, R.xml.serbian_small);
            seclang_landscape = new Keyboard(this, R.xml.serbian);
        } else if (size == 2) {
            seclang = new Keyboard(this, R.xml.serbian);
            seclang_landscape = new Keyboard(this, R.xml.serbian_landscape);
        } else if (size == 3) {
            seclang = new Keyboard(this, R.xml.serbian_landscape);
            seclang_landscape = new Keyboard(this, R.xml.serbian_big);
        }
        break;
    case "el":
        if (size == 1) {
            seclang = new Keyboard(this, R.xml.greek_small);
            seclang_landscape = new Keyboard(this, R.xml.greek);
        } else if (size == 2) {
            seclang = new Keyboard(this, R.xml.greek);
            seclang_landscape = new Keyboard(this, R.xml.greek_landscape);
        } else if (size == 3) {
            seclang = new Keyboard(this, R.xml.greek_landscape);
            seclang_landscape = new Keyboard(this, R.xml.greek_big);
        }
        break;
    case "fr":
        if (size == 1) {
            seclang = new Keyboard(this, R.xml.french_small);
            seclang_landscape = new Keyboard(this, R.xml.french);
        } else if (size == 2) {
            seclang = new Keyboard(this, R.xml.french);
            seclang_landscape = new Keyboard(this, R.xml.french_landscape);
        } else if (size == 3) {
            seclang = new Keyboard(this, R.xml.french_landscape);
            seclang_landscape = new Keyboard(this, R.xml.french_big);
        }
        break;
    case "cz":
        if (size == 1) {
            seclang = new Keyboard(this, R.xml.czech_small);
            seclang_landscape = new Keyboard(this, R.xml.czech);
        } else if (size == 2) {
            seclang = new Keyboard(this, R.xml.czech);
            seclang_landscape = new Keyboard(this, R.xml.czech_landscape);
        } else if (size == 3) {
            seclang = new Keyboard(this, R.xml.czech_landscape);
            seclang_landscape = new Keyboard(this, R.xml.czech_big);
        }
        break;
    case "de":
        if (size == 1) {
            seclang = new Keyboard(this, R.xml.german_small);
            seclang_landscape = new Keyboard(this, R.xml.german);
        } else if (size == 2) {
            seclang = new Keyboard(this, R.xml.german);
            seclang_landscape = new Keyboard(this, R.xml.german_landscape);
        } else if (size == 3) {
            seclang = new Keyboard(this, R.xml.german_landscape);
            seclang_landscape = new Keyboard(this, R.xml.german_big);
        }
        break;
    case "it":
        if (size == 1) {
            seclang = new Keyboard(this, R.xml.english_small);
            seclang_landscape = new Keyboard(this, R.xml.english);
        } else if (size == 2) {
            seclang = new Keyboard(this, R.xml.english);
            seclang_landscape = new Keyboard(this, R.xml.english_landscape);
        } else if (size == 3) {
            seclang = new Keyboard(this, R.xml.english_landscape);
            seclang_landscape = new Keyboard(this, R.xml.english_big);
        }
        break;
    case "es":
        if (size == 1) {
            seclang = new Keyboard(this, R.xml.english_small);
            seclang_landscape = new Keyboard(this, R.xml.english);
        } else if (size == 2) {
            seclang = new Keyboard(this, R.xml.english);
            seclang_landscape = new Keyboard(this, R.xml.english_landscape);
        } else if (size == 3) {
            seclang = new Keyboard(this, R.xml.english_landscape);
            seclang_landscape = new Keyboard(this, R.xml.english_big);
        }
        break;
    case "ru":
        if (size == 1) {
            seclang = new Keyboard(this, R.xml.russian_small);
            seclang_landscape = new Keyboard(this, R.xml.russian);
        } else if (size == 2) {
            seclang = new Keyboard(this, R.xml.russian);
            seclang_landscape = new Keyboard(this, R.xml.russian_landscape);
        } else if (size == 3) {
            seclang = new Keyboard(this, R.xml.russian_landscape);
            seclang_landscape = new Keyboard(this, R.xml.russian_big);
        }
        break;
    case "tr":
        if (size == 1) {
            seclang = new Keyboard(this, R.xml.turkish_small);
            seclang_landscape = new Keyboard(this, R.xml.turkish);
        } else if (size == 2) {
            seclang = new Keyboard(this, R.xml.turkish);
            seclang_landscape = new Keyboard(this, R.xml.turkish_landscape);
        } else if (size == 3) {
            seclang = new Keyboard(this, R.xml.turkish_landscape);
            seclang_landscape = new Keyboard(this, R.xml.turkish_big);
        }
        break;
    case "hu":
        if (size == 1) {
            seclang = new Keyboard(this, R.xml.hungarian_small);
            seclang_landscape = new Keyboard(this, R.xml.hungarian);
        } else if (size == 2) {
            seclang = new Keyboard(this, R.xml.hungarian);
            seclang_landscape = new Keyboard(this, R.xml.hungarian_landscape);
        } else if (size == 3) {
            seclang = new Keyboard(this, R.xml.hungarian_landscape);
            seclang_landscape = new Keyboard(this, R.xml.hungarian_big);
        }
        break;
    }
}