forked from len0rd/rockbox
Use a Native keyboard GUI instead of rockbox's internal one on android
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28407 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
26f7ee13ce
commit
eaff333bf5
11 changed files with 261 additions and 4 deletions
69
android/src/org/rockbox/RockboxKeyboardInput.java
Normal file
69
android/src/org/rockbox/RockboxKeyboardInput.java
Normal file
|
@ -0,0 +1,69 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2010 Jonathan Gordon
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
package org.rockbox;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Intent;
|
||||
import android.util.Log;
|
||||
|
||||
public class RockboxKeyboardInput
|
||||
{
|
||||
private BroadcastReceiver b;
|
||||
private String result;
|
||||
|
||||
public RockboxKeyboardInput()
|
||||
{
|
||||
result = null;
|
||||
}
|
||||
|
||||
public void kbd_input(String text)
|
||||
{
|
||||
RockboxActivity a = (RockboxActivity) RockboxService.get_instance().get_activity();
|
||||
Intent kbd = new Intent(a, KeyboardActivity.class);
|
||||
kbd.putExtra("value", text);
|
||||
a.waitForActivity(kbd, new HostCallback(){
|
||||
|
||||
@Override
|
||||
public void onComplete(int resultCode, Intent data) {
|
||||
if (resultCode == Activity.RESULT_OK)
|
||||
{
|
||||
result = data.getStringExtra("value");
|
||||
}
|
||||
else {
|
||||
result = "";
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
public String get_result()
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
public boolean is_usable()
|
||||
{
|
||||
return RockboxService.get_instance().get_activity() != null;
|
||||
}
|
||||
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue