mirror of
https://github.com/Julow/Unexpected-Keyboard.git
synced 2025-06-19 17:31:30 +02:00
Remove unsupported API readAllBytes
This commit is contained in:
parent
7caf60c93b
commit
c524caa6f1
@ -210,8 +210,7 @@ public class LayoutsPreference extends ListGroupPreference<LayoutsPreference.Lay
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
Resources res = getContext().getResources();
|
Resources res = getContext().getResources();
|
||||||
byte[] raw = res.openRawResource(R.raw.latn_qwerty_us).readAllBytes();
|
return Utils.read_all_utf8(res.openRawResource(R.raw.latn_qwerty_us));
|
||||||
return new String(raw, "UTF-8");
|
|
||||||
}
|
}
|
||||||
catch (Exception _e)
|
catch (Exception _e)
|
||||||
{
|
{
|
||||||
|
@ -4,6 +4,8 @@ import android.app.AlertDialog;
|
|||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
import android.view.Window;
|
import android.view.Window;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
|
||||||
class Utils
|
class Utils
|
||||||
{
|
{
|
||||||
@ -27,4 +29,16 @@ class Utils
|
|||||||
win.addFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
|
win.addFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
|
||||||
dialog.show();
|
dialog.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String read_all_utf8(InputStream inp) throws Exception
|
||||||
|
{
|
||||||
|
InputStreamReader reader = new InputStreamReader(inp, "UTF-8");
|
||||||
|
StringBuilder out = new StringBuilder();
|
||||||
|
int buff_length = 8000;
|
||||||
|
char[] buff = new char[buff_length];
|
||||||
|
int l;
|
||||||
|
while ((l = reader.read(buff, 0, buff_length)) != -1)
|
||||||
|
out.append(buff, 0, l);
|
||||||
|
return out.toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user