Search in sources :

Example 6 with PrintStreamPrinter

use of android.util.PrintStreamPrinter in project android_frameworks_base by DirtyUnicorns.

the class Ime method runList.

/**
     * Execute the list sub-command.
     */
private void runList() {
    String opt;
    boolean all = false;
    boolean brief = false;
    while ((opt = nextOption()) != null) {
        if (opt.equals("-a")) {
            all = true;
        } else if (opt.equals("-s")) {
            brief = true;
        } else {
            System.err.println("Error: Unknown option: " + opt);
            showUsage();
            return;
        }
    }
    List<InputMethodInfo> methods;
    if (!all) {
        try {
            methods = mImm.getEnabledInputMethodList();
        } catch (RemoteException e) {
            System.err.println(e.toString());
            System.err.println(IMM_NOT_RUNNING_ERR);
            return;
        }
    } else {
        try {
            methods = mImm.getInputMethodList();
        } catch (RemoteException e) {
            System.err.println(e.toString());
            System.err.println(IMM_NOT_RUNNING_ERR);
            return;
        }
    }
    if (methods != null) {
        Printer pr = new PrintStreamPrinter(System.out);
        for (int i = 0; i < methods.size(); i++) {
            InputMethodInfo imi = methods.get(i);
            if (brief) {
                System.out.println(imi.getId());
            } else {
                System.out.println(imi.getId() + ":");
                imi.dump(pr, "  ");
            }
        }
    }
}
Also used : PrintStreamPrinter(android.util.PrintStreamPrinter) RemoteException(android.os.RemoteException) PrintStreamPrinter(android.util.PrintStreamPrinter) Printer(android.util.Printer) InputMethodInfo(android.view.inputmethod.InputMethodInfo)

Example 7 with PrintStreamPrinter

use of android.util.PrintStreamPrinter in project android_frameworks_base by AOSPA.

the class Ime method runList.

/**
     * Execute the list sub-command.
     */
private void runList() {
    String opt;
    boolean all = false;
    boolean brief = false;
    while ((opt = nextOption()) != null) {
        if (opt.equals("-a")) {
            all = true;
        } else if (opt.equals("-s")) {
            brief = true;
        } else {
            System.err.println("Error: Unknown option: " + opt);
            showUsage();
            return;
        }
    }
    List<InputMethodInfo> methods;
    if (!all) {
        try {
            methods = mImm.getEnabledInputMethodList();
        } catch (RemoteException e) {
            System.err.println(e.toString());
            System.err.println(IMM_NOT_RUNNING_ERR);
            return;
        }
    } else {
        try {
            methods = mImm.getInputMethodList();
        } catch (RemoteException e) {
            System.err.println(e.toString());
            System.err.println(IMM_NOT_RUNNING_ERR);
            return;
        }
    }
    if (methods != null) {
        Printer pr = new PrintStreamPrinter(System.out);
        for (int i = 0; i < methods.size(); i++) {
            InputMethodInfo imi = methods.get(i);
            if (brief) {
                System.out.println(imi.getId());
            } else {
                System.out.println(imi.getId() + ":");
                imi.dump(pr, "  ");
            }
        }
    }
}
Also used : PrintStreamPrinter(android.util.PrintStreamPrinter) RemoteException(android.os.RemoteException) PrintStreamPrinter(android.util.PrintStreamPrinter) Printer(android.util.Printer) InputMethodInfo(android.view.inputmethod.InputMethodInfo)

Example 8 with PrintStreamPrinter

use of android.util.PrintStreamPrinter in project android_frameworks_base by crdroidandroid.

the class Ime method runList.

/**
     * Execute the list sub-command.
     */
private void runList() {
    String opt;
    boolean all = false;
    boolean brief = false;
    while ((opt = nextOption()) != null) {
        if (opt.equals("-a")) {
            all = true;
        } else if (opt.equals("-s")) {
            brief = true;
        } else {
            System.err.println("Error: Unknown option: " + opt);
            showUsage();
            return;
        }
    }
    List<InputMethodInfo> methods;
    if (!all) {
        try {
            methods = mImm.getEnabledInputMethodList();
        } catch (RemoteException e) {
            System.err.println(e.toString());
            System.err.println(IMM_NOT_RUNNING_ERR);
            return;
        }
    } else {
        try {
            methods = mImm.getInputMethodList();
        } catch (RemoteException e) {
            System.err.println(e.toString());
            System.err.println(IMM_NOT_RUNNING_ERR);
            return;
        }
    }
    if (methods != null) {
        Printer pr = new PrintStreamPrinter(System.out);
        for (int i = 0; i < methods.size(); i++) {
            InputMethodInfo imi = methods.get(i);
            if (brief) {
                System.out.println(imi.getId());
            } else {
                System.out.println(imi.getId() + ":");
                imi.dump(pr, "  ");
            }
        }
    }
}
Also used : PrintStreamPrinter(android.util.PrintStreamPrinter) RemoteException(android.os.RemoteException) PrintStreamPrinter(android.util.PrintStreamPrinter) Printer(android.util.Printer) InputMethodInfo(android.view.inputmethod.InputMethodInfo)

Aggregations

PrintStreamPrinter (android.util.PrintStreamPrinter)8 RemoteException (android.os.RemoteException)6 Printer (android.util.Printer)6 InputMethodInfo (android.view.inputmethod.InputMethodInfo)6 EphemeralResolveInfo (android.content.pm.EphemeralResolveInfo)2 ResolveInfo (android.content.pm.ResolveInfo)2