Xorg: add xorg module

This commit is contained in:
zt515 2017-11-28 00:50:10 +08:00
parent e688cc1175
commit ba23d12c19
80 changed files with 12162 additions and 1 deletions

1
Xorg/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/build

39
Xorg/build.gradle Normal file
View File

@ -0,0 +1,39 @@
apply plugin: 'com.android.library'
android {
compileSdkVersion 26
defaultConfig {
minSdkVersion 21
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
sourceSets {
main {
jniLibs.srcDirs = ['src/main/jniLibs']
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}

21
Xorg/proguard-rules.pro vendored Normal file
View File

@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile

View File

@ -0,0 +1,26 @@
package io.neoterm;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("io.neoterm.test", appContext.getPackageName());
}
}

View File

@ -0,0 +1,2 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="io.neoterm" />

View File

@ -0,0 +1,337 @@
// DO NOT EDIT THIS FILE - it is automatically generated, ALL YOUR CHANGES WILL BE OVERWRITTEN, edit the file under $JAVA_SRC_PATH dir
/*
Simple DirectMedia Layer
Java source code (C) 2009-2014 Sergii Pylypenko
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
package io.neoterm;
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.KeyEvent;
import android.view.Window;
import android.view.WindowManager;
import android.os.Vibrator;
import android.hardware.SensorManager;
import android.hardware.SensorEventListener;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.util.Log;
import android.widget.TextView;
import android.os.Build;
import java.util.Arrays;
class AccelerometerReader implements SensorEventListener
{
private SensorManager _manager = null;
public boolean openedBySDL = false;
public static final GyroscopeListener gyro = new GyroscopeListener();
public static final OrientationListener orientation = new OrientationListener();
public AccelerometerReader(Activity context)
{
_manager = (SensorManager) context.getSystemService(Context.SENSOR_SERVICE);
}
public synchronized void stop()
{
if( _manager != null )
{
Log.i("SDL", "libSDL: stopping accelerometer/gyroscope/orientation");
_manager.unregisterListener(this);
_manager.unregisterListener(gyro);
_manager.unregisterListener(orientation);
}
}
public synchronized void start()
{
if( (Globals.UseAccelerometerAsArrowKeys || Globals.AppUsesAccelerometer) &&
_manager != null && _manager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER) != null )
{
Log.i("SDL", "libSDL: starting accelerometer");
_manager.registerListener(this, _manager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER), SensorManager.SENSOR_DELAY_GAME);
}
if( (Globals.AppUsesGyroscope || Globals.MoveMouseWithGyroscope) &&
_manager != null && _manager.getDefaultSensor(Sensor.TYPE_GYROSCOPE) != null )
{
Log.i("SDL", "libSDL: starting gyroscope");
_manager.registerListener(gyro, _manager.getDefaultSensor(Sensor.TYPE_GYROSCOPE), SensorManager.SENSOR_DELAY_GAME);
}
if( (Globals.AppUsesOrientationSensor) && _manager != null &&
_manager.getDefaultSensor(Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2 ? Sensor.TYPE_GAME_ROTATION_VECTOR : Sensor.TYPE_ROTATION_VECTOR) != null )
{
Log.i("SDL", "libSDL: starting orientation sensor");
_manager.registerListener(orientation, _manager.getDefaultSensor(
Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2 ? Sensor.TYPE_GAME_ROTATION_VECTOR : Sensor.TYPE_ROTATION_VECTOR),
SensorManager.SENSOR_DELAY_GAME);
}
}
public void onSensorChanged(SensorEvent event)
{
if( Globals.HorizontalOrientation )
{
if( gyro.invertedOrientation )
nativeAccelerometer(-event.values[1], event.values[0], event.values[2]);
else
nativeAccelerometer(event.values[1], -event.values[0], event.values[2]);
}
else
nativeAccelerometer(event.values[0], event.values[1], event.values[2]); // TODO: not tested!
}
public void onAccuracyChanged(Sensor s, int a)
{
}
static class GyroscopeListener implements SensorEventListener
{
public boolean invertedOrientation = false;
// Noise filter with sane initial values, so user will be able
// to move gyroscope during the first 10 seconds, while the noise is measured.
// After that the values are replaced by noiseMin/noiseMax.
final float filterMin[] = new float[] { -0.05f, -0.05f, -0.05f };
final float filterMax[] = new float[] { 0.05f, 0.05f, 0.05f };
// The noise levels we're measuring.
// Large initial values, they will decrease, but never increase.
float noiseMin[] = new float[] { -1.0f, -1.0f, -1.0f };
float noiseMax[] = new float[] { 1.0f, 1.0f, 1.0f };
// The gyro data buffer, from which we care calculating min/max noise values.
// The bigger it is, the more precise the calclations, and the longer it takes to converge.
float noiseData[][] = new float[200][noiseMin.length];
int noiseDataIdx = 0;
// When we detect movement, we remove last few values of the measured data.
// The movement is detected by comparing values to noiseMin/noiseMax of the previous iteration.
int movementBackoff = 0;
// Difference between min/max in the previous measurement iteration,
// used to determine when we should stop measuring, when the change becomes negligilbe.
float measuredNoiseRange[] = null;
// How long the algorithm is running, to stop it if it does not converge.
int measurementIteration = 0;
public GyroscopeListener()
{
}
void collectNoiseData(final float[] data)
{
for( int i = 0; i < noiseMin.length; i++ )
{
if( data[i] < noiseMin[i] || data[i] > noiseMax[i] )
{
// Movement detected, this can converge our min/max too early, so we're discarding last few values
if( movementBackoff < 0 )
{
int discard = 10;
if( -movementBackoff < discard )
discard = -movementBackoff;
noiseDataIdx -= discard;
if( noiseDataIdx < 0 )
noiseDataIdx = 0;
}
movementBackoff = 10;
return;
}
noiseData[noiseDataIdx][i] = data[i];
}
movementBackoff--;
if( movementBackoff >= 0 )
return; // Also discard several values after the movement stopped
noiseDataIdx++;
if( noiseDataIdx < noiseData.length )
return;
measurementIteration++;
Log.d( "SDL", "GYRO_NOISE: Measuring in progress... " + measurementIteration );
if( measurementIteration > 5 )
{
// We've collected enough data to use our noise min/max values as a new filter
System.arraycopy(noiseMin, 0, filterMin, 0, filterMin.length);
System.arraycopy(noiseMax, 0, filterMax, 0, filterMax.length);
}
if( measurementIteration > 15 )
{
Log.d( "SDL", "GYRO_NOISE: Measuring done! Maximum number of iterations reached: " + measurementIteration );
noiseData = null;
measuredNoiseRange = null;
return;
}
noiseDataIdx = 0;
boolean changed = false;
for( int i = 0; i < noiseMin.length; i++ )
{
float min = 1.0f;
float max = -1.0f;
for( int ii = 0; ii < noiseData.length; ii++ )
{
if( min > noiseData[ii][i] )
min = noiseData[ii][i];
if( max < noiseData[ii][i] )
max = noiseData[ii][i];
}
// Increase the range a bit, for safe conservative filtering
float middle = (min + max) / 2.0f;
min += (min - middle) * 0.2f;
max += (max - middle) * 0.2f;
// Check if range between min/max is less then the current range, as a safety measure,
// and min/max range is not jumping outside of previously measured range
if( max - min < noiseMax[i] - noiseMin[i] && min >= noiseMin[i] && max <= noiseMax[i] )
{
// Move old min/max closer to the measured min/max, but do not replace the values altogether
noiseMin[i] = (noiseMin[i] + min * 4.0f) / 5.0f;
noiseMax[i] = (noiseMax[i] + max * 4.0f) / 5.0f;
changed = true;
}
}
Log.d( "SDL", "GYRO_NOISE: MIN MAX: " + Arrays.toString(noiseMin) + " " + Arrays.toString(noiseMax) );
if( !changed )
return;
// Determine when to stop measuring - check that the previous min/max range is close enough to the current one
float range[] = new float[noiseMin.length];
for( int i = 0; i < noiseMin.length; i++ )
range[i] = noiseMax[i] - noiseMin[i];
Log.d( "SDL", "GYRO_NOISE: RANGE: " + Arrays.toString(range) + " " + Arrays.toString(measuredNoiseRange) );
if( measuredNoiseRange == null )
{
measuredNoiseRange = range;
return; // First iteration, skip further checks
}
for( int i = 0; i < range.length; i++ )
{
if( measuredNoiseRange[i] / range[i] > 1.2f )
{
measuredNoiseRange = range;
return;
}
}
// We converged to the final min/max filter values, stop measuring
System.arraycopy(noiseMin, 0, filterMin, 0, filterMin.length);
System.arraycopy(noiseMax, 0, filterMax, 0, filterMax.length);
noiseData = null;
measuredNoiseRange = null;
Log.d( "SDL", "GYRO_NOISE: Measuring done! Range converged on iteration " + measurementIteration );
}
public void onSensorChanged(final SensorEvent event)
{
boolean filtered = true;
final float[] data = event.values;
if( noiseData != null )
collectNoiseData(data);
for( int i = 0; i < 3; i++ )
{
if( data[i] < filterMin[i] )
{
filtered = false;
data[i] -= filterMin[i];
}
else if( data[i] > filterMax[i] )
{
filtered = false;
data[i] -= filterMax[i];
}
}
if( filtered )
return;
if( Globals.HorizontalOrientation )
{
if( invertedOrientation )
nativeGyroscope(-data[0], -data[1], data[2]);
else
nativeGyroscope(data[0], data[1], data[2]);
}
else
{
if( invertedOrientation )
nativeGyroscope(-data[1], data[0], data[2]);
else
nativeGyroscope(data[1], -data[0], data[2]);
}
}
public void onAccuracyChanged(Sensor s, int a)
{
}
public boolean available(Activity context)
{
SensorManager manager = (SensorManager) context.getSystemService(Context.SENSOR_SERVICE);
return ( manager != null && manager.getDefaultSensor(Sensor.TYPE_GYROSCOPE) != null );
}
public void registerListener(Activity context, SensorEventListener l)
{
SensorManager manager = (SensorManager) context.getSystemService(Context.SENSOR_SERVICE);
if ( manager == null && manager.getDefaultSensor(Sensor.TYPE_GYROSCOPE) == null )
return;
manager.registerListener(gyro, manager.getDefaultSensor(
Globals.AppUsesOrientationSensor ? Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2 ?
Sensor.TYPE_GAME_ROTATION_VECTOR : Sensor.TYPE_ROTATION_VECTOR : Sensor.TYPE_GYROSCOPE),
SensorManager.SENSOR_DELAY_GAME);
}
public void unregisterListener(Activity context,SensorEventListener l)
{
SensorManager manager = (SensorManager) context.getSystemService(Context.SENSOR_SERVICE);
if ( manager == null )
return;
manager.unregisterListener(l);
}
}
static class OrientationListener implements SensorEventListener
{
public OrientationListener()
{
}
public void onSensorChanged(SensorEvent event)
{
nativeOrientation(event.values[0], event.values[1], event.values[2]);
}
public void onAccuracyChanged(Sensor s, int a)
{
}
}
private static native void nativeAccelerometer(float accX, float accY, float accZ);
private static native void nativeGyroscope(float X, float Y, float Z);
private static native void nativeOrientation(float X, float Y, float Z);
}

View File

@ -0,0 +1,331 @@
// DO NOT EDIT THIS FILE - it is automatically generated, ALL YOUR CHANGES WILL BE OVERWRITTEN, edit the file under $JAVA_SRC_PATH dir
/*
Simple DirectMedia Layer
Java source code (C) 2009-2014 Sergii Pylypenko
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
package io.neoterm;
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.KeyEvent;
import android.view.Window;
import android.view.WindowManager;
import android.media.AudioTrack;
import android.media.AudioManager;
import android.media.AudioFormat;
import android.media.AudioRecord;
import android.media.MediaRecorder.AudioSource;
import java.io.*;
import android.util.Log;
import java.util.concurrent.Semaphore;
import android.Manifest;
import android.content.pm.PackageManager;
class AudioThread
{
private MainActivity mParent;
private AudioTrack mAudio;
private byte[] mAudioBuffer;
private int mVirtualBufSize;
public AudioThread(MainActivity parent)
{
mParent = parent;
mAudio = null;
mAudioBuffer = null;
nativeAudioInitJavaCallbacks();
}
public int fillBuffer()
{
if( mParent.isPaused() )
{
try{
Thread.sleep(500);
} catch (InterruptedException e) {}
}
else
{
//if( Globals.AudioBufferConfig == 0 ) // Gives too much spam to logcat, makes things worse
// mAudio.flush();
mAudio.write( mAudioBuffer, 0, mVirtualBufSize );
}
return 1;
}
public int initAudio(int rate, int channels, int encoding, int bufSize)
{
if( mAudio == null )
{
channels = ( channels == 1 ) ? AudioFormat.CHANNEL_CONFIGURATION_MONO :
AudioFormat.CHANNEL_CONFIGURATION_STEREO;
encoding = ( encoding == 1 ) ? AudioFormat.ENCODING_PCM_16BIT :
AudioFormat.ENCODING_PCM_8BIT;
mVirtualBufSize = bufSize;
if( AudioTrack.getMinBufferSize( rate, channels, encoding ) > bufSize )
bufSize = AudioTrack.getMinBufferSize( rate, channels, encoding );
if(Globals.AudioBufferConfig != 0) { // application's choice - use minimal buffer
bufSize = (int)((float)bufSize * (((float)(Globals.AudioBufferConfig - 1) * 2.5f) + 1.0f));
mVirtualBufSize = bufSize;
}
mAudioBuffer = new byte[bufSize];
mAudio = new AudioTrack(AudioManager.STREAM_MUSIC,
rate,
channels,
encoding,
bufSize,
AudioTrack.MODE_STREAM );
mAudio.play();
}
return mVirtualBufSize;
}
public byte[] getBuffer()
{
return mAudioBuffer;
}
public int deinitAudio()
{
if( mAudio != null )
{
mAudio.stop();
mAudio.release();
mAudio = null;
}
mAudioBuffer = null;
return 1;
}
public int initAudioThread()
{
// Make audio thread priority higher so audio thread won't get underrun
Thread.currentThread().setPriority(Thread.MAX_PRIORITY);
return 1;
}
public int pauseAudioPlayback()
{
if( mAudio != null )
{
mAudio.pause();
}
if( mRecordThread != null )
{
mRecordThread.pauseRecording();
}
return 1;
}
public int resumeAudioPlayback()
{
if( mAudio != null )
{
mAudio.play();
}
if( mRecordThread != null )
{
mRecordThread.resumeRecording();
}
return 1;
}
private native int nativeAudioInitJavaCallbacks();
// ----- Audio recording -----
private RecordingThread mRecordThread = null;
private AudioRecord mRecorder = null;
private int mRecorderBufferSize = 0;
private byte[] startRecording(int rate, int channels, int encoding, int bufsize)
{
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M)
{
int permissionCheck = mParent.checkSelfPermission(Manifest.permission.RECORD_AUDIO);
if (permissionCheck != PackageManager.PERMISSION_GRANTED)
{
mParent.requestPermissions(new String[]{Manifest.permission.RECORD_AUDIO}, 0);
return null;
}
}
if( mRecordThread == null )
{
mRecordThread = new RecordingThread();
mRecordThread.start();
}
if( !mRecordThread.isStopped() )
{
Log.i("SDL", "SDL: error: application already opened audio recording device");
return null;
}
mRecordThread.init(bufsize);
int channelConfig = ( channels == 1 ) ? AudioFormat.CHANNEL_IN_MONO :
AudioFormat.CHANNEL_IN_STEREO;
int encodingConfig = ( encoding == 1 ) ? AudioFormat.ENCODING_PCM_16BIT :
AudioFormat.ENCODING_PCM_8BIT;
int minBufDevice = AudioRecord.getMinBufferSize(rate, channelConfig, encodingConfig);
int minBufferSize = Math.max(bufsize * 8, minBufDevice + (bufsize - (minBufDevice % bufsize)));
Log.i("SDL", "SDL: app opened recording device, rate " + rate + " channels " + channels + " sample size " + (encoding+1) + " bufsize " + bufsize + " internal bufsize " + minBufferSize);
if( mRecorder == null || mRecorder.getSampleRate() != rate ||
mRecorder.getChannelCount() != channels ||
mRecorder.getAudioFormat() != encodingConfig ||
mRecorderBufferSize != minBufferSize )
{
if( mRecorder != null )
mRecorder.release();
mRecorder = null;
try {
mRecorder = new AudioRecord(AudioSource.MIC, rate, channelConfig, encodingConfig, minBufferSize);
mRecorderBufferSize = minBufferSize;
} catch (IllegalArgumentException e) {
Log.i("SDL", "SDL: error: failed to open MIC recording device!");
try {
mRecorder = new AudioRecord(AudioSource.VOICE_RECOGNITION, rate, channelConfig, encodingConfig, minBufferSize);
mRecorderBufferSize = minBufferSize;
} catch (IllegalArgumentException eee) {
Log.i("SDL", "SDL: error: failed to open VOICE_RECOGNITION recording device!");
try {
mRecorder = new AudioRecord(AudioSource.DEFAULT, rate, channelConfig, encodingConfig, minBufferSize);
mRecorderBufferSize = minBufferSize;
} catch (IllegalArgumentException eeee) {
Log.i("SDL", "SDL: error: failed to open DEFAULT recording device!");
return null;
}
}
}
}
else
{
Log.i("SDL", "SDL: reusing old recording device");
}
mRecordThread.startRecording();
return mRecordThread.mRecordBuffer;
}
private void stopRecording()
{
if( mRecordThread == null || mRecordThread.isStopped() )
{
Log.i("SDL", "SDL: error: application already closed audio recording device");
return;
}
mRecordThread.stopRecording();
Log.i("SDL", "SDL: app closed recording device");
}
private class RecordingThread extends Thread
{
private boolean stopped = true;
byte[] mRecordBuffer;
private Semaphore waitStarted = new Semaphore(0);
private boolean sleep = false;
RecordingThread()
{
super();
}
void init(int bufsize)
{
if( mRecordBuffer == null || mRecordBuffer.length != bufsize )
mRecordBuffer = new byte[bufsize];
}
public void run()
{
while( true )
{
waitStarted.acquireUninterruptibly();
waitStarted.drainPermits();
stopped = false;
sleep = false;
while( !sleep )
{
int got = mRecorder.read(mRecordBuffer, 0, mRecordBuffer.length);
if( got != mRecordBuffer.length )
{
// Audio is stopped here, sleep a bit.
try{
Thread.sleep(1000);
} catch (InterruptedException e) {}
}
else
{
//Log.i("SDL", "SDL: nativeAudioRecordCallback with len " + mRecordBuffer.length);
nativeAudioRecordCallback();
//Log.i("SDL", "SDL: nativeAudioRecordCallback returned");
}
}
stopped = true;
mRecorder.stop();
}
}
public void startRecording()
{
mRecorder.startRecording();
waitStarted.release();
}
public void stopRecording()
{
sleep = true;
while( !stopped )
{
try{
Thread.sleep(100);
} catch (InterruptedException e) {}
}
}
public void pauseRecording()
{
if( !stopped )
mRecorder.stop();
}
public void resumeRecording()
{
if( !stopped )
mRecorder.startRecording();
}
public boolean isStopped()
{
return stopped;
}
}
private native void nativeAudioRecordCallback();
}

View File

@ -0,0 +1,140 @@
// DO NOT EDIT THIS FILE - it is automatically generated, ALL YOUR CHANGES WILL BE OVERWRITTEN, edit the file under $JAVA_SRC_PATH dir
/*
Simple DirectMedia Layer
Java source code (C) 2009-2014 Sergii Pylypenko
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
package io.neoterm;
import android.os.Bundle;
import android.os.Build;
import android.os.Environment;
import android.util.DisplayMetrics;
import android.util.Log;
import android.content.Context;
import android.content.res.Resources;
import android.content.res.AssetManager;
import android.app.Activity;
import android.view.MotionEvent;
import android.view.KeyEvent;
import android.view.InputDevice;
import android.view.Window;
import android.view.WindowManager;
import android.widget.TextView;
import android.widget.Toast;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.content.ClipboardManager;
import android.content.ClipboardManager.OnPrimaryClipChangedListener;
import android.app.PendingIntent;
import android.app.AlarmManager;
import android.content.Intent;
import android.view.View;
import android.view.Display;
public abstract class Clipboard
{
public static Clipboard get()
{
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB)
return NewerClipboard.Holder.Instance;
return OlderClipboard.Holder.Instance;
}
public abstract void set(final Context context, final String text);
public abstract String get(final Context context);
public abstract void setListener(final Context context, final Runnable listener);
private static class NewerClipboard extends Clipboard
{
private static class Holder
{
private static final NewerClipboard Instance = new NewerClipboard();
}
public void set(final Context context, final String text)
{
try {
ClipboardManager clipboard = (ClipboardManager) context.getSystemService(context.CLIPBOARD_SERVICE);
if( clipboard != null )
clipboard.setText(text);
} catch (Exception e) {
Log.i("SDL", "setClipboardText() exception: " + e.toString());
}
}
public String get(final Context context)
{
String ret = "";
try {
ClipboardManager clipboard = (ClipboardManager) context.getSystemService(context.CLIPBOARD_SERVICE);
if( clipboard != null && clipboard.getText() != null )
ret = clipboard.getText().toString();
} catch (Exception e) {
Log.i("SDL", "getClipboardText() exception: " + e.toString());
}
return ret;
}
public void setListener(final Context context, final Runnable listener)
{
ClipboardManager clipboard = (ClipboardManager) context.getSystemService(context.CLIPBOARD_SERVICE);
clipboard.addPrimaryClipChangedListener(new OnPrimaryClipChangedListener()
{
public void onPrimaryClipChanged()
{
listener.run();
}
});
}
}
private static class OlderClipboard extends Clipboard
{
private static class Holder
{
private static final OlderClipboard Instance = new OlderClipboard();
}
public void set(final Context context, final String text)
{
try {
android.text.ClipboardManager clipboard = (android.text.ClipboardManager) context.getSystemService(context.CLIPBOARD_SERVICE);
if( clipboard != null )
clipboard.setText(text);
} catch (Exception e) {
Log.i("SDL", "setClipboardText() exception: " + e.toString());
}
}
public String get(final Context context)
{
String ret = "";
try {
android.text.ClipboardManager clipboard = (android.text.ClipboardManager) context.getSystemService(context.CLIPBOARD_SERVICE);
if( clipboard != null && clipboard.getText() != null )
ret = clipboard.getText().toString();
} catch (Exception e) {
Log.i("SDL", "getClipboardText() exception: " + e.toString());
}
return ret;
}
public void setListener(final Context context, final Runnable listener)
{
Log.i("SDL", "Cannot set clipboard listener on Android 2.3 or older");
}
}
}

View File

@ -0,0 +1,58 @@
// DO NOT EDIT THIS FILE - it is automatically generated, ALL YOUR CHANGES WILL BE OVERWRITTEN, edit the file under $JAVA_SRC_PATH dir
/*
Simple DirectMedia Layer
Java source code (C) 2009-2014 Sergii Pylypenko
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
package io.neoterm;
import android.app.Activity;
import android.content.Intent;
// Stub class for compiling without cloud save support
class CloudSave
{
public CloudSave(MainActivity p)
{
}
public void onStart() {
}
public void onStop() {
}
public void onActivityResult(int request, int response, Intent data) {
}
public boolean save(String filename, String saveId, String dialogTitle, String description, String imageFile, long playedTimeMs)
{
return false;
}
public boolean load(String filename, String saveId, String dialogTitle)
{
return false;
}
public boolean isSignedIn()
{
return false;
}
}

View File

@ -0,0 +1,862 @@
// DO NOT EDIT THIS FILE - it is automatically generated, ALL YOUR CHANGES WILL BE OVERWRITTEN, edit the file under $JAVA_SRC_PATH dir
/*
Simple DirectMedia Layer
Java source code (C) 2009-2014 Sergii Pylypenko
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
package io.neoterm;
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.KeyEvent;
import android.view.Window;
import android.view.WindowManager;
import android.os.Environment;
import android.view.View;
import android.widget.TextView;
import java.net.URLConnection;
import java.net.HttpURLConnection;
import java.net.URL;
import java.security.cert.*;
import java.security.SecureRandom;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.HttpsURLConnection;
import java.util.zip.*;
import java.io.*;
import android.util.Log;
import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
import android.content.Context;
import android.content.res.Resources;
import java.util.Arrays;
import android.text.SpannedString;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.Manifest;
import android.content.pm.PackageManager;
class CountingInputStream extends BufferedInputStream
{
private long bytesReadMark = 0;
private long bytesRead = 0;
public CountingInputStream(InputStream in, int size) {
super(in, size);
}
public CountingInputStream(InputStream in) {
super(in);
}
public long getBytesRead() {
return bytesRead;
}
public synchronized int read() throws IOException {
int read = super.read();
if (read >= 0) {
bytesRead++;
}
return read;
}
public synchronized int read(byte[] b, int off, int len) throws IOException {
int read = super.read(b, off, len);
if (read >= 0) {
bytesRead += read;
}
return read;
}
public synchronized long skip(long n) throws IOException {
long skipped = super.skip(n);
if (skipped >= 0) {
bytesRead += skipped;
}
return skipped;
}
public synchronized void mark(int readlimit) {
super.mark(readlimit);
bytesReadMark = bytesRead;
}
public synchronized void reset() throws IOException {
super.reset();
bytesRead = bytesReadMark;
}
}
class DataDownloader extends Thread
{
public static final String DOWNLOAD_FLAG_FILENAME = "libsdl-DownloadFinished-";
class StatusWriter
{
private TextView Status;
private MainActivity Parent;
private SpannedString oldText = new SpannedString("");
public StatusWriter( TextView _Status, MainActivity _Parent )
{
Status = _Status;
Parent = _Parent;
}
public void setParent( TextView _Status, MainActivity _Parent )
{
synchronized(DataDownloader.this) {
Status = _Status;
Parent = _Parent;
setText( oldText.toString() );
}
}
public void setText(final String str)
{
class Callback implements Runnable
{
public TextView Status;
public SpannedString text;
public void run()
{
Status.setText(text);
}
}
synchronized(DataDownloader.this) {
Callback cb = new Callback();
oldText = new SpannedString(str);
cb.text = new SpannedString(str);
cb.Status = Status;
if( Parent != null && Status != null )
Parent.runOnUiThread(cb);
}
}
}
public DataDownloader( MainActivity _Parent, TextView _Status )
{
Parent = _Parent;
Status = new StatusWriter( _Status, _Parent );
//Status.setText( "Connecting to " + Globals.DataDownloadUrl );
outFilesDir = Globals.DataDir;
DownloadComplete = false;
this.start();
}
public void setStatusField(TextView _Status)
{
synchronized(this) {
Status.setParent( _Status, Parent );
}
}
@Override
public void run()
{
Parent.getVideoLayout().setOnKeyListener(new BackKeyListener(Parent));
String [] downloadFiles = Globals.DataDownloadUrl;
int total = 0;
int count = 0;
for( int i = 0; i < downloadFiles.length; i++ )
{
if( downloadFiles[i].length() > 0 &&
( Globals.OptionalDataDownload.length > i && Globals.OptionalDataDownload[i] ) ||
( Globals.OptionalDataDownload.length <= i && downloadFiles[i].indexOf("!") == 0 ) )
total += 1;
}
for( int i = 0; i < downloadFiles.length; i++ )
{
if( downloadFiles[i].length() > 0 &&
( Globals.OptionalDataDownload.length > i && Globals.OptionalDataDownload[i] ) ||
( Globals.OptionalDataDownload.length <= i && downloadFiles[i].indexOf("!") == 0 ) )
{
if( ! DownloadDataFile(downloadFiles[i].replace("<ARCH>", android.os.Build.CPU_ABI), DOWNLOAD_FLAG_FILENAME + String.valueOf(i) + ".flag", count+1, total, i) )
{
if ( ! downloadFiles[i].contains("<ARCH>") || (
downloadFiles[i].contains("<ARCH>") &&
! DownloadDataFile(downloadFiles[i].replace("<ARCH>", android.os.Build.CPU_ABI2), DOWNLOAD_FLAG_FILENAME + String.valueOf(i) + ".flag", count+1, total, i) ) )
{
DownloadFailed = true;
return;
}
}
count += 1;
}
}
DownloadComplete = true;
Parent.getVideoLayout().setOnKeyListener(null);
initParent();
}
public boolean DownloadDataFile(final String DataDownloadUrl, final String DownloadFlagFileName, int downloadCount, int downloadTotal, int downloadIndex)
{
DownloadCanBeResumed = false;
Resources res = Parent.getResources();
String [] downloadUrls = DataDownloadUrl.split("[|]");
if( downloadUrls.length < 2 )
{
Log.i("SDL", "Error: download string invalid: '" + DataDownloadUrl + "', your AndroidAppSettigns.cfg is broken");
Status.setText( res.getString(R.string.error_dl_from, DataDownloadUrl) );
return false;
}
boolean forceOverwrite = false;
String path = getOutFilePath(DownloadFlagFileName);
InputStream checkFile = null;
try {
checkFile = new FileInputStream( path );
} catch( FileNotFoundException e ) {
} catch( SecurityException e ) { };
if( checkFile != null )
{
try {
byte b[] = new byte[ Globals.DataDownloadUrl[downloadIndex].getBytes("UTF-8").length + 1 ];
int readed = checkFile.read(b);
String compare = "";
if( readed > 0 )
compare = new String( b, 0, readed, "UTF-8" );
boolean matched = false;
//Log.i("SDL", "Read URL: '" + compare + "'");
for( int i = 1; i < downloadUrls.length; i++ )
{
//Log.i("SDL", "Comparing: '" + downloadUrls[i] + "'");
if( compare.compareTo(downloadUrls[i]) == 0 )
matched = true;
}
//Log.i("SDL", "Matched: " + String.valueOf(matched));
if( ! matched )
throw new IOException();
Status.setText( res.getString(R.string.download_unneeded) );
for( int i = 1; i < downloadUrls.length; i++ )
{
if( downloadUrls[i].indexOf("obb:") == 0 ) // APK expansion file provided by Google Play
{
String url = getObbFilePath(downloadUrls[i]);
if (new File(url).length() > 256)
{
Writer writer = new OutputStreamWriter(new FileOutputStream(url), "UTF-8");
writer.write("Extracted and truncated\n");
writer.close();
Log.i("SDL", "Truncated file from expansion: " + url);
}
}
}
return true;
} catch ( IOException e ) {
forceOverwrite = true;
new File(path).delete();
}
}
checkFile = null;
// Create output directory (not necessary for phone storage)
Log.i("SDL", "Downloading data to: '" + outFilesDir + "'");
try {
File outDir = new File( outFilesDir );
if( !outDir.exists() )
outDir.mkdirs();
OutputStream out = new FileOutputStream( getOutFilePath(".nomedia") );
out.flush();
out.close();
}
catch( SecurityException e ) {}
catch( FileNotFoundException e ) {}
catch( IOException e ) {};
HttpURLConnection request = null;
long totalLen = 0;
long partialDownloadLen = 0;
CountingInputStream stream;
boolean DoNotUnzip = false;
boolean FileInAssets = false;
boolean FileInExpansion = false;
String url = "";
int downloadUrlIndex = 1;
while( downloadUrlIndex < downloadUrls.length )
{
Log.i("SDL", "Processing download " + downloadUrls[downloadUrlIndex]);
DoNotUnzip = false;
FileInAssets = false;
FileInExpansion = false;
partialDownloadLen = 0;
totalLen = 0;
url = new String(downloadUrls[downloadUrlIndex]);
if(url.indexOf(":") == 0)
{
path = getOutFilePath(url.substring( 1, url.indexOf(":", 1) ));
url = url.substring( url.indexOf(":", 1) + 1 );
DoNotUnzip = true;
DownloadCanBeResumed = true;
File partialDownload = new File( path );
if( partialDownload.exists() && !partialDownload.isDirectory() && !forceOverwrite )
partialDownloadLen = partialDownload.length();
}
Status.setText( downloadCount + "/" + downloadTotal + ": " + res.getString(R.string.connecting_to, url) );
if( url.indexOf("obb:") == 0 ) // APK expansion file provided by Google Play
{
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M)
{
int permissionCheck = Parent.checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE);
if (permissionCheck != PackageManager.PERMISSION_GRANTED && !Parent.writeExternalStoragePermissionDialogAnswered)
{
Parent.requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, 0);
while( !Parent.writeExternalStoragePermissionDialogAnswered )
{
try{ Thread.sleep(300); } catch (InterruptedException e) {}
}
}
}
url = getObbFilePath(url);
InputStream stream1 = null;
try {
stream1 = new FileInputStream(url);
stream1.read();
stream1.close();
Log.i("SDL", "Fetching file from expansion: " + url);
FileInExpansion = true;
break;
} catch( Exception e ) {
Log.i("SDL", "Failed to open file: " + url);
downloadUrlIndex++;
continue;
}
}
else if( url.indexOf("http://") == -1 && url.indexOf("https://") == -1 ) // File inside assets
{
InputStream stream1 = null;
try {
stream1 = Parent.getAssets().open(url);
stream1.close();
} catch( Exception e ) {
try {
stream1 = Parent.getAssets().open(url + "000");
stream1.close();
} catch( Exception ee ) {
Log.i("SDL", "Failed to open file in assets: " + url);
downloadUrlIndex++;
continue;
}
}
FileInAssets = true;
Log.i("SDL", "Fetching file from assets: " + url);
break;
}
else
{
Log.i("SDL", "Connecting to: " + url);
try {
request = (HttpURLConnection)(new URL(url).openConnection()); //new HttpGet(url);
while (true)
{
request.setRequestProperty("Accept", "*/*");
request.setFollowRedirects(false);
if( partialDownloadLen > 0 )
{
request.setRequestProperty("Range", "bytes=" + partialDownloadLen + "-");
Log.i("SDL", "Trying to resume download at pos " + partialDownloadLen);
}
request.connect();
Log.i("SDL", "Got HTTP response " + request.getResponseCode() + " " + request.getResponseMessage() + " type " + request.getContentType() + " length " + request.getContentLength());
if (request.getResponseCode() == HttpURLConnection.HTTP_MOVED_TEMP ||
request.getResponseCode() == HttpURLConnection.HTTP_MOVED_PERM ||
request.getResponseCode() == HttpURLConnection.HTTP_SEE_OTHER ||
request.getResponseCode() == 307 || request.getResponseCode() == 308)
{
String oldUrl = request.getURL().toString();
String cookie = request.getHeaderField("Set-Cookie");
request = (HttpURLConnection)(new URL(request.getHeaderField("Location")).openConnection());
Log.i("SDL", "Following HTTP redirect to " + request.getURL().toString());
//request.addRequestProperty("Referer", oldUrl);
//if (cookie != null)
// request.addRequestProperty("Cookie", cookie);
continue;
}
request.getInputStream();
break;
}
} catch ( Exception e ) {
Log.i("SDL", "Failed to connect to " + url + " with error " + e.toString());
request = null;
downloadUrlIndex++;
continue;
}
break;
}
}
if( FileInExpansion )
{
Log.i("SDL", "Count file size: '" + url);
try {
totalLen = new File(url).length();
stream = new CountingInputStream(new FileInputStream(url), 8192);
Log.i("SDL", "Count file size: '" + url + " = " + totalLen);
} catch( IOException e ) {
Log.i("SDL", "Unpacking from filesystem '" + url + "' - error: " + e.toString());
Status.setText( res.getString(R.string.error_dl_from, url) );
return false;
}
}
else if( FileInAssets )
{
int multipartCounter = 0;
InputStream multipart = null;
while( true )
{
try {
// Make string ".zip000", ".zip001" etc for multipart archives
String url1 = url + String.format("%03d", multipartCounter);
CountingInputStream stream1 = new CountingInputStream(Parent.getAssets().open(url1), 8192);
while( stream1.skip(65536) > 0 ) { };
totalLen += stream1.getBytesRead();
stream1.close();
InputStream s = Parent.getAssets().open(url1);
if( multipart == null )
multipart = s;
else
multipart = new SequenceInputStream(multipart, s);
Log.i("SDL", "Multipart archive found: " + url1);
} catch( IOException e ) {
break;
}
multipartCounter += 1;
}
if( multipart != null )
stream = new CountingInputStream(multipart, 8192);
else
{
try {
stream = new CountingInputStream(Parent.getAssets().open(url), 8192);
while( stream.skip(65536) > 0 ) { };
totalLen = stream.getBytesRead();
stream.close();
stream = new CountingInputStream(Parent.getAssets().open(url), 8192);
} catch( IOException e ) {
Log.i("SDL", "Unpacking from assets '" + url + "' - error: " + e.toString());
Status.setText( res.getString(R.string.error_dl_from, url) );
return false;
}
}
}
else
{
if( request == null )
{
Log.i("SDL", "Error connecting to " + url);
Status.setText( res.getString(R.string.failed_connecting_to, url) );
return false;
}
Status.setText( downloadCount + "/" + downloadTotal + ": " + res.getString(R.string.dl_from, url) );
totalLen = request.getContentLength();
try {
stream = new CountingInputStream(request.getInputStream(), 8192);
} catch( IOException e ) {
Status.setText( res.getString(R.string.error_dl_from, url) );
return false;
}
}
if( !copyUnpackFileStream(stream, path, url, DoNotUnzip, FileInAssets, FileInExpansion, totalLen, partialDownloadLen, request, downloadCount, downloadTotal) )
return false;
OutputStream out = null;
path = getOutFilePath(DownloadFlagFileName);
try {
out = new FileOutputStream( path );
out.write(downloadUrls[downloadUrlIndex].getBytes("UTF-8"));
out.flush();
out.close();
} catch( IOException e ) {
Status.setText( res.getString(R.string.error_write, path) + ": " + e.getMessage() );
return false;
};
Status.setText( downloadCount + "/" + downloadTotal + ": " + res.getString(R.string.dl_finished) );
try {
stream.close();
if( FileInExpansion )
{
Writer writer = new OutputStreamWriter(new FileOutputStream(url), "UTF-8");
writer.write("Extracted and truncated\n");
writer.close();
Log.i("SDL", "Truncated file from expansion: " + url);
}
} catch( IOException e ) {
Log.i("SDL", "Error truncating file from expansion: " + url);
};
return true;
};
// Moved part of code to a separate method, because Android imposes a stupid limit on Java method size
private boolean copyUnpackFileStream( CountingInputStream stream, String path, String url,
boolean DoNotUnzip, boolean FileInAssets, boolean FileInExpansion,
long totalLen, long partialDownloadLen, URLConnection response,
int downloadCount, int downloadTotal)
{
long updateStatusTime = 0;
byte[] buf = new byte[16384];
Resources res = Parent.getResources();
if(DoNotUnzip)
{
Log.i("SDL", "Saving file '" + path + "'");
OutputStream out = null;
try {
try {
File outDir = new File( path.substring(0, path.lastIndexOf("/") ));
if( !(outDir.exists() && outDir.isDirectory()) )
outDir.mkdirs();
} catch( SecurityException e ) { };
if( partialDownloadLen > 0 )
{
try {
String range = response.getHeaderField("Content-Range");
if( range != null && range.indexOf("bytes") == 0 )
{
//Log.i("SDL", "Resuming download of file '" + path + "': Content-Range: " + range[0].getValue());
String[] skippedBytes = range.split("/")[0].split("-")[0].split(" ");
if( skippedBytes.length >= 2 && Long.parseLong(skippedBytes[1]) == partialDownloadLen )
{
out = new FileOutputStream( path, true );
Log.i("SDL", "Resuming download of file '" + path + "' at pos " + partialDownloadLen);
}
}
else
Log.i("SDL", "Server does not support partial downloads. ");
} catch (Exception e) { }
}
if( out == null )
{
out = new FileOutputStream( path );
partialDownloadLen = 0;
}
} catch( FileNotFoundException e ) {
Log.i("SDL", "Saving file '" + path + "' - error creating output file: " + e.toString());
} catch( SecurityException e ) {
Log.i("SDL", "Saving file '" + path + "' - error creating output file: " + e.toString());
};
if( out == null )
{
Status.setText( res.getString(R.string.error_write, path) );
Log.i("SDL", "Saving file '" + path + "' - error creating output file");
return false;
}
try {
int len = stream.read(buf);
while (len >= 0)
{
if(len > 0)
out.write(buf, 0, len);
len = stream.read(buf);
float percent = 0.0f;
if( totalLen > 0 )
percent = (stream.getBytesRead() + partialDownloadLen) * 100.0f / (totalLen + partialDownloadLen);
if( System.currentTimeMillis() > updateStatusTime + 1000 )
{
updateStatusTime = System.currentTimeMillis();
Status.setText( downloadCount + "/" + downloadTotal + ": " + res.getString(R.string.dl_progress, percent, path) );
}
}
out.flush();
out.close();
out = null;
} catch( IOException e ) {
Status.setText( res.getString(R.string.error_write, path) + ": " + e.getMessage() );
Log.i("SDL", "Saving file '" + path + "' - error writing: " + e.toString());
return false;
}
Log.i("SDL", "Saving file '" + path + "' done");
}
else
{
Log.i("SDL", "Reading from zip file '" + url + "'");
ZipInputStream zip;
if (url.endsWith(".zip.xz") || url.endsWith(".zip.xz/download"))
try
{
if (!Arrays.asList(Globals.AppLibraries).contains("lzma"))
throw new IOException("LZMA support not compiled in - add lzma to CompiledLibraries inside AndroidAppSettings.cfg");
zip = new ZipInputStream(new XZInputStream(stream));
}
catch (Exception eeeee)
{
Log.i("SDL", "Opening file '" + url + "' failed - cannot open XZ input stream: " + eeeee.toString());
return false;
}
else
zip = new ZipInputStream(stream);
String extpath = getOutFilePath("");
while(true)
{
ZipEntry entry = null;
try {
entry = zip.getNextEntry();
if( entry != null )
Log.i("SDL", "Reading from zip file '" + url + "' entry '" + entry.getName() + "'");
} catch( IOException e ) {
Status.setText( res.getString(R.string.error_dl_from, url) );
Log.i("SDL", "Error reading from zip file '" + url + "': " + e.toString());
return false;
}
if( entry == null )
{
Log.i("SDL", "Reading from zip file '" + url + "' finished");
break;
}
if( entry.isDirectory() )
{
Log.i("SDL", "Creating dir '" + getOutFilePath(entry.getName()) + "'");
try {
File outDir = new File( getOutFilePath(entry.getName()) );
if( !(outDir.exists() && outDir.isDirectory()) )
outDir.mkdirs();
} catch( SecurityException e ) { };
continue;
}
OutputStream out = null;
path = getOutFilePath(entry.getName());
float percent = 0.0f;
Log.i("SDL", "Saving file '" + path + "'");
try {
File outDir = new File( path.substring(0, path.lastIndexOf("/") ));
if( !(outDir.exists() && outDir.isDirectory()) )
outDir.mkdirs();
} catch( SecurityException e ) { };
try {
CheckedInputStream check = new CheckedInputStream( new FileInputStream(path), new CRC32() );
while( check.read(buf, 0, buf.length) >= 0 ) {};
check.close();
if( check.getChecksum().getValue() != entry.getCrc() )
{
File ff = new File(path);
ff.delete();
throw new Exception();
}
Log.i("SDL", "File '" + path + "' exists and passed CRC check - not overwriting it");
if( totalLen > 0 )
percent = stream.getBytesRead() * 100.0f / totalLen;
if( System.currentTimeMillis() > updateStatusTime + 1000 )
{
updateStatusTime = System.currentTimeMillis();
Status.setText( downloadCount + "/" + downloadTotal + ": " + res.getString(R.string.dl_progress, percent, path) );
}
continue;
} catch( Exception e ) { }
try {
out = new FileOutputStream( path );
} catch( FileNotFoundException e ) {
Log.i("SDL", "Saving file '" + path + "' - cannot create file: " + e.toString());
} catch( SecurityException e ) {
Log.i("SDL", "Saving file '" + path + "' - cannot create file: " + e.toString());
};
if( out == null )
{
Status.setText( res.getString(R.string.error_write, path) );
Log.i("SDL", "Saving file '" + path + "' - cannot create file");
return false;
}
if( totalLen > 0 )
percent = stream.getBytesRead() * 100.0f / totalLen;
//Unpacking local zip file into external storage
if( System.currentTimeMillis() > updateStatusTime + 1000 )
{
updateStatusTime = System.currentTimeMillis();
Status.setText( downloadCount + "/" + downloadTotal + ": " + res.getString(R.string.dl_progress, percent, path.replace(extpath, "")) );
}
try {
int len = zip.read(buf);
while (len >= 0)
{
if(len > 0)
out.write(buf, 0, len);
len = zip.read(buf);
percent = 0.0f;
if( totalLen > 0 )
percent = stream.getBytesRead() * 100.0f / totalLen;
if( System.currentTimeMillis() > updateStatusTime + 1000 )
{
updateStatusTime = System.currentTimeMillis();
Status.setText( downloadCount + "/" + downloadTotal + ": " + res.getString(R.string.dl_progress, percent, path.replace(extpath, "")) );
}
}
out.flush();
out.close();
out = null;
} catch( IOException e ) {
Status.setText( res.getString(R.string.error_write, path) + ": " + e.getMessage() );
Log.i("SDL", "Saving file '" + path + "' - error writing or downloading: " + e.toString());
return false;
}
try {
long count = 0, ret = 0;
CheckedInputStream check = new CheckedInputStream( new FileInputStream(path), new CRC32() );
while( ret >= 0 )
{
count += ret;
ret = check.read(buf, 0, buf.length);
}
check.close();
// NOTE: For some reason this not work properly on older Android versions (4.4 and below).
// Setting this to become a warning
if( check.getChecksum().getValue() != entry.getCrc() || count != entry.getSize() )
{
//File ff = new File(path);
//ff.delete();
Log.i("SDL", "Saving file '" + path + "' - CRC check failed, ZIP: " +
String.format("%x", entry.getCrc()) + " actual file: " + String.format("%x", check.getChecksum().getValue()) +
" file size in ZIP: " + entry.getSize() + " actual size " + count );
Log.i("SDL", "If you still get problems try to reset the app or delete file at path " + path );
//throw new Exception();
}
} catch( Exception e ) {
Status.setText( res.getString(R.string.error_write, path) + ": " + e.getMessage() );
return false;
}
Log.i("SDL", "Saving file '" + path + "' done");
}
};
return true;
}
private void initParent()
{
class Callback implements Runnable
{
public MainActivity Parent;
public void run()
{
Parent.initSDL();
}
}
Callback cb = new Callback();
synchronized(this) {
cb.Parent = Parent;
if(Parent != null)
Parent.runOnUiThread(cb);
}
}
private String getOutFilePath(final String filename)
{
return outFilesDir + "/" + filename;
};
private String getObbFilePath(final String url)
{
return Environment.getExternalStorageDirectory().getAbsolutePath() + "/Android/obb/" +
Parent.getPackageName() + "/" + url.substring("obb:".length()) + "." + Parent.getPackageName() + ".obb";
}
public class BackKeyListener implements View.OnKeyListener
{
MainActivity p;
public BackKeyListener(MainActivity _p)
{
p = _p;
}
@Override
public boolean onKey(View v, int keyCode, KeyEvent event)
{
if( DownloadFailed )
System.exit(1);
AlertDialog.Builder builder = new AlertDialog.Builder(p);
builder.setTitle(p.getResources().getString(R.string.cancel_download));
builder.setMessage(p.getResources().getString(R.string.cancel_download) + (DownloadCanBeResumed ? " " + p.getResources().getString(R.string.cancel_download_resume) : ""));
builder.setPositiveButton(p.getResources().getString(R.string.yes), new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int item)
{
System.exit(1);
dialog.dismiss();
}
});
builder.setNegativeButton(p.getResources().getString(R.string.no), new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int item)
{
dialog.dismiss();
}
});
builder.setOnCancelListener(new DialogInterface.OnCancelListener()
{
public void onCancel(DialogInterface dialog)
{
}
});
AlertDialog alert = builder.create();
alert.setOwnerActivity(p);
alert.show();
return true;
}
}
public StatusWriter Status;
public boolean DownloadComplete = false;
public boolean DownloadFailed = false;
public boolean DownloadCanBeResumed = false;
private MainActivity Parent;
private String outFilesDir = null;
}

View File

@ -0,0 +1,139 @@
// DO NOT EDIT THIS FILE - it is automatically generated, ALL YOUR CHANGES WILL BE OVERWRITTEN, edit the file under $JAVA_SRC_PATH dir
/*
Simple DirectMedia Layer
Java source code (C) 2009-2014 Sergii Pylypenko
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
package io.neoterm;
import android.app.Activity;
import android.app.Service;
import android.content.Context;
import android.os.Bundle;
import android.os.IBinder;
import android.view.MotionEvent;
import android.view.KeyEvent;
import android.view.Window;
import android.view.WindowManager;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import android.widget.EditText;
import android.text.Editable;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.FrameLayout;
import android.graphics.drawable.Drawable;
import android.graphics.Color;
import android.content.res.Configuration;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Intent;
import android.view.View.OnKeyListener;
import android.view.MenuItem;
import android.view.Menu;
import android.view.Gravity;
import android.text.method.TextKeyListener;
import java.util.LinkedList;
import java.io.SequenceInputStream;
import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.FileOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
import java.util.zip.CheckedInputStream;
import java.util.zip.CRC32;
import java.util.Set;
import android.text.SpannedString;
import java.io.BufferedReader;
import java.io.BufferedInputStream;
import java.io.InputStreamReader;
import android.view.inputmethod.InputMethodManager;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.os.Handler;
import android.os.Message;
import android.os.SystemClock;
import java.util.concurrent.Semaphore;
import android.content.pm.ActivityInfo;
import android.view.Display;
import android.util.DisplayMetrics;
import android.text.InputType;
import android.util.Log;
import android.view.Surface;
import android.app.ProgressDialog;
import android.app.KeyguardManager;
import android.view.ViewTreeObserver;
import android.graphics.Rect;
import android.view.InputDevice;
import android.inputmethodservice.KeyboardView;
import android.inputmethodservice.Keyboard;
import android.app.Notification;
import android.app.PendingIntent;
import android.widget.RemoteViews;
public class DummyService extends Service
{
public DummyService()
{
super();
}
@Override
public int onStartCommand(Intent intent, int flags, int startId)
{
if (intent != null && Intent.ACTION_DELETE.equals(intent.getAction()))
{
Log.v("SDL", "User dismissed notification, killing myself");
stopSelfResult(5);
stopSelfResult(0);
System.exit(0);
}
Log.v("SDL", "Starting dummy service - displaying notification");
Notification ntf = new Notification();
ntf.flags |= Notification.FLAG_NO_CLEAR;
PendingIntent killIntent = PendingIntent.getService(this, 5, new Intent(Intent.ACTION_DELETE, null, this, DummyService.class), PendingIntent.FLAG_CANCEL_CURRENT);
PendingIntent showIntent = PendingIntent.getActivity(this, 0, new Intent("", null, this, MainActivity.class), PendingIntent.FLAG_CANCEL_CURRENT);
ntf.deleteIntent = killIntent;
ntf.tickerText = getString(getApplicationInfo().labelRes);
RemoteViews view = new RemoteViews(getPackageName(), R.layout.notification);
view.setCharSequence(R.id.notificationText, "setText", getString(R.string.notification_app_is_running, getString(getApplicationInfo().labelRes)));
view.setOnClickPendingIntent(R.id.notificationText, showIntent);
view.setOnClickPendingIntent(R.id.notificationIcon, showIntent);
view.setOnClickPendingIntent(R.id.notificationView, showIntent);
view.setOnClickPendingIntent(R.id.notificationStop, killIntent);
ntf.contentView = view;
startForeground(1, ntf);
return Service.START_NOT_STICKY;
}
@Override
public void onDestroy()
{
}
@Override
public IBinder onBind(Intent intent)
{
return null;
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,145 @@
// DO NOT EDIT THIS FILE - it is automatically generated, ALL YOUR CHANGES WILL BE OVERWRITTEN, edit the file under $JAVA_SRC_PATH dir
/*
Simple DirectMedia Layer
Java source code (C) 2009-2014 Sergii Pylypenko
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
package io.neoterm;
import android.app.Activity;
import android.content.Context;
import java.util.Vector;
import android.view.KeyEvent;
class Globals
{
// These config options are modified by ChangeAppsettings.sh script - see the detailed descriptions there
public static String ApplicationName = "XServerXSDL-NeoTerm";
public static String AppLibraries[] = { "sdl_native_helpers", "sdl-1.2", "sdl_ttf", "crypto" };
public static String AppMainLibraries[] = { "application", "sdl_main" };
public static String LibraryNamesMap[][] = { { "crypto", "crypto.so.sdl.1" }, { "ssl", "ssl.so.sdl.1" }, { "curl", "curl-sdl" } }; // Because some libraries are named differently to not clash with system libs
public static final boolean Using_SDL_1_3 = false;
public static final boolean Using_SDL_2_0 = false;
public static String[] DataDownloadUrl = { "!!Data files|:data.tar.gz:data-1.tgz", "!!Data files|:DroidSansMono.ttf:DroidSansMono.ttf", "Additional fonts (90Mb)|:xfonts.tar.gz:http://sourceforge.net/projects/libsdl-android/files/apk/XServer-XSDL/xfonts.tgz/download", };
public static boolean SwVideoMode = true;
public static boolean NeedDepthBuffer = false;
public static boolean NeedStencilBuffer = false;
public static boolean NeedGles2 = false;
public static boolean NeedGles3 = false;
public static boolean CompatibilityHacksVideo = false;
public static boolean CompatibilityHacksForceScreenUpdateMouseClick = true;
public static boolean CompatibilityHacksStaticInit = false;
public static boolean CompatibilityHacksTextInputEmulatesHwKeyboard = true;
public static int TextInputKeyboard = 0;
public static boolean KeepAspectRatioDefaultSetting = false;
public static boolean InhibitSuspend = true;
public static boolean CreateService = true;
public static String ReadmeText = "";
public static String CommandLine = "XSDL";
public static boolean AppUsesMouse = true;
public static boolean AppNeedsTwoButtonMouse = true;
public static boolean RightMouseButtonLongPress = false;
public static boolean ForceRelativeMouseMode = true; // If both on-screen keyboard and mouse are needed, this will only set the default setting, user may override it later
public static boolean ShowMouseCursor = false; // Draw system mouse cursor, if the app does not do it
public static boolean ScreenFollowsMouse = true; // Move app screen make mouse cursor always visible, when soft keyboard is shown
public static boolean AppNeedsArrowKeys = false;
public static boolean AppNeedsTextInput = false;
public static boolean AppUsesJoystick = false;
public static boolean AppUsesSecondJoystick = false;
public static boolean AppUsesThirdJoystick = false;
public static boolean AppUsesAccelerometer = false;
public static boolean AppUsesGyroscope = false;
public static boolean AppUsesOrientationSensor = false;
public static boolean AppUsesMultitouch = true;
public static boolean NonBlockingSwapBuffers = false;
public static boolean ResetSdlConfigForThisVersion = false;
public static String DeleteFilesOnUpgrade = "%";
public static int AppTouchscreenKeyboardKeysAmount = 3;
public static String[] AppTouchscreenKeyboardKeysNames = "LCTRL LALT LSHIFT RETURN SPACE DELETE KP_PLUS KP_MINUS 1 2".split(" ");
public static int StartupMenuButtonTimeout = 3000;
public static int AppMinimumRAM = 0;
public static SettingsMenu.Menu HiddenMenuOptions [] = { }; // If you see error here - update HiddenMenuOptions in your AndroidAppSettings.cfg: change OptionalDownloadConfig to SettingsMenuMisc.OptionalDownloadConfig etc.
public static SettingsMenu.Menu FirstStartMenuOptions [] = { new SettingsMenuMisc.GyroscopeCalibration(), new SettingsMenuMisc.OptionalDownloadConfig(), };
public static String AdmobPublisherId = "";
public static String AdmobTestDeviceId = "";
public static String AdmobBannerSize = "";
public static String GooglePlayGameServicesId = "";
// Phone-specific config, modified by user in "Change phone config" startup dialog
public static int VideoDepthBpp = 16;
public static boolean HorizontalOrientation = true;
public static boolean AutoDetectOrientation = false;
public static boolean ImmersiveMode = true;
public static boolean HideSystemMousePointer = false;
public static boolean DownloadToSdcard = true;
public static boolean PhoneHasArrowKeys = false;
public static boolean UseAccelerometerAsArrowKeys = false;
public static boolean UseTouchscreenKeyboard = true;
public static int TouchscreenKeyboardSize = 1;
public static final int TOUCHSCREEN_KEYBOARD_CUSTOM = 4;
public static int TouchscreenKeyboardDrawSize = 2;
public static int TouchscreenKeyboardTheme = 0;
public static int TouchscreenKeyboardTransparency = 2;
public static boolean FloatingScreenJoystick = false;
public static int AccelerometerSensitivity = 2;
public static int AccelerometerCenterPos = 2;
public static int AudioBufferConfig = 0;
public static boolean OptionalDataDownload[] = null;
public static int LeftClickMethod = ForceRelativeMouseMode ? Mouse.LEFT_CLICK_WITH_TAP_OR_TIMEOUT : Mouse.LEFT_CLICK_NORMAL;
public static int LeftClickKey = KeyEvent.KEYCODE_DPAD_CENTER;
public static int LeftClickTimeout = 3;
public static int RightClickTimeout = 4;
public static int RightClickMethod = AppNeedsTwoButtonMouse ? Mouse.RIGHT_CLICK_WITH_MULTITOUCH : Mouse.RIGHT_CLICK_NONE;
public static int RightClickKey = KeyEvent.KEYCODE_MENU;
public static boolean MoveMouseWithJoystick = false;
public static int MoveMouseWithJoystickSpeed = 1;
public static int MoveMouseWithJoystickAccel = 0;
public static boolean MoveMouseWithGyroscope = true;
public static int MoveMouseWithGyroscopeSpeed = 2;
public static boolean ClickMouseWithDpad = false;
public static boolean RelativeMouseMovement = ForceRelativeMouseMode; // Laptop touchpad mode
public static boolean ForceHardwareMouse = false;
public static int RelativeMouseMovementSpeed = 2;
public static int RelativeMouseMovementAccel = 0;
public static int ShowScreenUnderFinger = Mouse.ZOOM_NONE;
public static int ClickScreenPressure = 0;
public static int ClickScreenTouchspotSize = 0;
public static boolean FingerHover = true;
public static boolean HoverJitterFilter = true;
public static boolean GenerateSubframeTouchEvents = false;
public static boolean KeepAspectRatio = KeepAspectRatioDefaultSetting;
public static boolean TvBorders = true;
public static int RemapHwKeycode[] = new int[SDL_Keys.JAVA_KEYCODE_LAST];
public static int RemapScreenKbKeycode[] = new int[6];
public static int ScreenKbControlsLayout[][] = AppUsesThirdJoystick ? // Values for 800x480 resolution
new int[][] { { 0, 303, 177, 480 }, { 0, 0, 48, 48 }, { 400, 392, 488, 480 }, { 312, 392, 400, 480 }, { 400, 304, 488, 392 }, { 312, 304, 400, 392 }, { 400, 216, 488, 304 }, { 312, 216, 400, 304 }, { 623, 303, 800, 480 }, { 623, 126, 800, 303 } } :
AppUsesSecondJoystick ?
new int[][] { { 0, 303, 177, 480 }, { 0, 0, 48, 48 }, { 400, 392, 488, 480 }, { 312, 392, 400, 480 }, { 400, 304, 488, 392 }, { 312, 304, 400, 392 }, { 400, 216, 488, 304 }, { 312, 216, 400, 304 }, { 623, 303, 800, 480 } } :
new int[][] { { 0, 303, 177, 480 }, { 0, 0, 48, 48 }, { 712, 392, 800, 480 }, { 624, 392, 712, 480 }, { 712, 304, 800, 392 }, { 624, 304, 712, 392 }, { 712, 216, 800, 304 }, { 624, 216, 712, 304 } };
public static boolean ScreenKbControlsShown[] = new boolean[ScreenKbControlsLayout.length]; /* Also joystick and text input button added */
public static int RemapMultitouchGestureKeycode[] = new int[4];
public static boolean MultitouchGesturesUsed[] = new boolean[4];
public static int MultitouchGestureSensitivity = 1;
public static int TouchscreenCalibration[] = new int[4];
public static String DataDir = new String("");
public static boolean VideoLinearFilter = true;
public static boolean MultiThreadedVideo = false;
public static boolean OuyaEmulation = false; // For debugging
}

View File

@ -0,0 +1,615 @@
// DO NOT EDIT THIS FILE - it is automatically generated, ALL YOUR CHANGES WILL BE OVERWRITTEN, edit the file under $JAVA_SRC_PATH dir
/*
Simple DirectMedia Layer
Java source code (C) 2009-2014 Sergii Pylypenko
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
package io.neoterm;
import java.lang.String;
import java.util.ArrayList;
import java.util.Arrays;
import java.lang.reflect.Field;
// Autogenerated by hand with a command:
// grep 'SDLK_' SDL_keysym.h | sed 's/SDLK_\([a-zA-Z0-9_]\+\).*[=] \([0-9]\+\).*/public static final int SDLK_\1 = \2;/' >> Keycodes.java
class SDL_1_2_Keycodes
{
public static final int SDLK_UNKNOWN = 0;
public static final int SDLK_BACKSPACE = 8;
public static final int SDLK_TAB = 9;
public static final int SDLK_CLEAR = 12;
public static final int SDLK_RETURN = 13;
public static final int SDLK_PAUSE = 19;
public static final int SDLK_ESCAPE = 27;
public static final int SDLK_SPACE = 32;
public static final int SDLK_EXCLAIM = 33;
public static final int SDLK_QUOTEDBL = 34;
public static final int SDLK_HASH = 35;
public static final int SDLK_DOLLAR = 36;
public static final int SDLK_AMPERSAND = 38;
public static final int SDLK_QUOTE = 39;
public static final int SDLK_LEFTPAREN = 40;
public static final int SDLK_RIGHTPAREN = 41;
public static final int SDLK_ASTERISK = 42;
public static final int SDLK_PLUS = 43;
public static final int SDLK_COMMA = 44;
public static final int SDLK_MINUS = 45;
public static final int SDLK_PERIOD = 46;
public static final int SDLK_SLASH = 47;
public static final int SDLK_0 = 48;
public static final int SDLK_1 = 49;
public static final int SDLK_2 = 50;
public static final int SDLK_3 = 51;
public static final int SDLK_4 = 52;
public static final int SDLK_5 = 53;
public static final int SDLK_6 = 54;
public static final int SDLK_7 = 55;
public static final int SDLK_8 = 56;
public static final int SDLK_9 = 57;
public static final int SDLK_COLON = 58;
public static final int SDLK_SEMICOLON = 59;
public static final int SDLK_LESS = 60;
public static final int SDLK_EQUALS = 61;
public static final int SDLK_GREATER = 62;
public static final int SDLK_QUESTION = 63;
public static final int SDLK_AT = 64;
public static final int SDLK_LEFTBRACKET = 91;
public static final int SDLK_BACKSLASH = 92;
public static final int SDLK_RIGHTBRACKET = 93;
public static final int SDLK_CARET = 94;
public static final int SDLK_UNDERSCORE = 95;
public static final int SDLK_BACKQUOTE = 96;
public static final int SDLK_a = 97;
public static final int SDLK_b = 98;
public static final int SDLK_c = 99;
public static final int SDLK_d = 100;
public static final int SDLK_e = 101;
public static final int SDLK_f = 102;
public static final int SDLK_g = 103;
public static final int SDLK_h = 104;
public static final int SDLK_i = 105;
public static final int SDLK_j = 106;
public static final int SDLK_k = 107;
public static final int SDLK_l = 108;
public static final int SDLK_m = 109;
public static final int SDLK_n = 110;
public static final int SDLK_o = 111;
public static final int SDLK_p = 112;
public static final int SDLK_q = 113;
public static final int SDLK_r = 114;
public static final int SDLK_s = 115;
public static final int SDLK_t = 116;
public static final int SDLK_u = 117;
public static final int SDLK_v = 118;
public static final int SDLK_w = 119;
public static final int SDLK_x = 120;
public static final int SDLK_y = 121;
public static final int SDLK_z = 122;
public static final int SDLK_DELETE = 127;
public static final int SDLK_WORLD_0 = 160;
public static final int SDLK_WORLD_1 = 161;
public static final int SDLK_WORLD_2 = 162;
public static final int SDLK_WORLD_3 = 163;
public static final int SDLK_WORLD_4 = 164;
public static final int SDLK_WORLD_5 = 165;
public static final int SDLK_WORLD_6 = 166;
public static final int SDLK_WORLD_7 = 167;
public static final int SDLK_WORLD_8 = 168;
public static final int SDLK_WORLD_9 = 169;
public static final int SDLK_WORLD_10 = 170;
public static final int SDLK_WORLD_11 = 171;
public static final int SDLK_WORLD_12 = 172;
public static final int SDLK_WORLD_13 = 173;
public static final int SDLK_WORLD_14 = 174;
public static final int SDLK_WORLD_15 = 175;
public static final int SDLK_WORLD_16 = 176;
public static final int SDLK_WORLD_17 = 177;
public static final int SDLK_WORLD_18 = 178;
public static final int SDLK_WORLD_19 = 179;
public static final int SDLK_WORLD_20 = 180;
public static final int SDLK_WORLD_21 = 181;
public static final int SDLK_WORLD_22 = 182;
public static final int SDLK_WORLD_23 = 183;
public static final int SDLK_WORLD_24 = 184;
public static final int SDLK_WORLD_25 = 185;
public static final int SDLK_WORLD_26 = 186;
public static final int SDLK_WORLD_27 = 187;
public static final int SDLK_WORLD_28 = 188;
public static final int SDLK_WORLD_29 = 189;
public static final int SDLK_WORLD_30 = 190;
public static final int SDLK_WORLD_31 = 191;
public static final int SDLK_WORLD_32 = 192;
public static final int SDLK_WORLD_33 = 193;
public static final int SDLK_WORLD_34 = 194;
public static final int SDLK_WORLD_35 = 195;
public static final int SDLK_WORLD_36 = 196;
public static final int SDLK_WORLD_37 = 197;
public static final int SDLK_WORLD_38 = 198;
public static final int SDLK_WORLD_39 = 199;
public static final int SDLK_WORLD_40 = 200;
public static final int SDLK_WORLD_41 = 201;
public static final int SDLK_WORLD_42 = 202;
public static final int SDLK_WORLD_43 = 203;
public static final int SDLK_WORLD_44 = 204;
public static final int SDLK_WORLD_45 = 205;
public static final int SDLK_WORLD_46 = 206;
public static final int SDLK_WORLD_47 = 207;
public static final int SDLK_WORLD_48 = 208;
public static final int SDLK_WORLD_49 = 209;
public static final int SDLK_WORLD_50 = 210;
public static final int SDLK_WORLD_51 = 211;
public static final int SDLK_WORLD_52 = 212;
public static final int SDLK_WORLD_53 = 213;
public static final int SDLK_WORLD_54 = 214;
public static final int SDLK_WORLD_55 = 215;
public static final int SDLK_WORLD_56 = 216;
public static final int SDLK_WORLD_57 = 217;
public static final int SDLK_WORLD_58 = 218;
public static final int SDLK_WORLD_59 = 219;
public static final int SDLK_WORLD_60 = 220;
public static final int SDLK_WORLD_61 = 221;
public static final int SDLK_WORLD_62 = 222;
public static final int SDLK_WORLD_63 = 223;
public static final int SDLK_WORLD_64 = 224;
public static final int SDLK_WORLD_65 = 225;
public static final int SDLK_WORLD_66 = 226;
public static final int SDLK_WORLD_67 = 227;
public static final int SDLK_WORLD_68 = 228;
public static final int SDLK_WORLD_69 = 229;
public static final int SDLK_WORLD_70 = 230;
public static final int SDLK_WORLD_71 = 231;
public static final int SDLK_WORLD_72 = 232;
public static final int SDLK_WORLD_73 = 233;
public static final int SDLK_WORLD_74 = 234;
public static final int SDLK_WORLD_75 = 235;
public static final int SDLK_WORLD_76 = 236;
public static final int SDLK_WORLD_77 = 237;
public static final int SDLK_WORLD_78 = 238;
public static final int SDLK_WORLD_79 = 239;
public static final int SDLK_WORLD_80 = 240;
public static final int SDLK_WORLD_81 = 241;
public static final int SDLK_WORLD_82 = 242;
public static final int SDLK_WORLD_83 = 243;
public static final int SDLK_WORLD_84 = 244;
public static final int SDLK_WORLD_85 = 245;
public static final int SDLK_WORLD_86 = 246;
public static final int SDLK_WORLD_87 = 247;
public static final int SDLK_WORLD_88 = 248;
public static final int SDLK_WORLD_89 = 249;
public static final int SDLK_WORLD_90 = 250;
public static final int SDLK_WORLD_91 = 251;
public static final int SDLK_WORLD_92 = 252;
public static final int SDLK_WORLD_93 = 253;
public static final int SDLK_WORLD_94 = 254;
public static final int SDLK_WORLD_95 = 255;
public static final int SDLK_KP0 = 256;
public static final int SDLK_KP1 = 257;
public static final int SDLK_KP2 = 258;
public static final int SDLK_KP3 = 259;
public static final int SDLK_KP4 = 260;
public static final int SDLK_KP5 = 261;
public static final int SDLK_KP6 = 262;
public static final int SDLK_KP7 = 263;
public static final int SDLK_KP8 = 264;
public static final int SDLK_KP9 = 265;
public static final int SDLK_KP_PERIOD = 266;
public static final int SDLK_KP_DIVIDE = 267;
public static final int SDLK_KP_MULTIPLY = 268;
public static final int SDLK_KP_MINUS = 269;
public static final int SDLK_KP_PLUS = 270;
public static final int SDLK_KP_ENTER = 271;
public static final int SDLK_KP_EQUALS = 272;
public static final int SDLK_UP = 273;
public static final int SDLK_DOWN = 274;
public static final int SDLK_RIGHT = 275;
public static final int SDLK_LEFT = 276;
public static final int SDLK_INSERT = 277;
public static final int SDLK_HOME = 278;
public static final int SDLK_END = 279;
public static final int SDLK_PAGEUP = 280;
public static final int SDLK_PAGEDOWN = 281;
public static final int SDLK_F1 = 282;
public static final int SDLK_F2 = 283;
public static final int SDLK_F3 = 284;
public static final int SDLK_F4 = 285;
public static final int SDLK_F5 = 286;
public static final int SDLK_F6 = 287;
public static final int SDLK_F7 = 288;
public static final int SDLK_F8 = 289;
public static final int SDLK_F9 = 290;
public static final int SDLK_F10 = 291;
public static final int SDLK_F11 = 292;
public static final int SDLK_F12 = 293;
public static final int SDLK_F13 = 294;
public static final int SDLK_F14 = 295;
public static final int SDLK_F15 = 296;
public static final int SDLK_NUMLOCK = 300;
public static final int SDLK_CAPSLOCK = 301;
public static final int SDLK_SCROLLOCK = 302;
public static final int SDLK_RSHIFT = 303;
public static final int SDLK_LSHIFT = 304;
public static final int SDLK_RCTRL = 305;
public static final int SDLK_LCTRL = 306;
public static final int SDLK_RALT = 307;
public static final int SDLK_LALT = 308;
public static final int SDLK_RMETA = 309;
public static final int SDLK_LMETA = 310;
public static final int SDLK_LSUPER = 311;
public static final int SDLK_RSUPER = 312;
public static final int SDLK_MODE = 313;
public static final int SDLK_COMPOSE = 314;
public static final int SDLK_HELP = 315;
public static final int SDLK_PRINT = 316;
public static final int SDLK_SYSREQ = 317;
public static final int SDLK_BREAK = 318;
public static final int SDLK_MENU = 319;
public static final int SDLK_POWER = 320;
public static final int SDLK_EURO = 321;
public static final int SDLK_UNDO = 322;
// Mouse buttons can be mapped to on-screen keys
public static final int SDLK_MOUSE_LEFT = 500;
public static final int SDLK_MOUSE_MIDDLE = 501;
public static final int SDLK_MOUSE_RIGHT = 502;
public static final int SDLK_MOUSE_WHEEL_UP = 503;
public static final int SDLK_MOUSE_WHEEL_DOWN = 504;
public static final int SDLK_MOUSE_X1 = 505;
public static final int SDLK_MOUSE_X2 = 506;
public static final int SDLK_NO_REMAP = 512;
}
// Autogenerated by hand with a command:
// grep 'SDL_SCANCODE_' SDL_scancode.h | sed 's/SDL_SCANCODE_\([a-zA-Z0-9_]\+\).*[=] \([0-9]\+\).*/public static final int SDLK_\1 = \2;/' >> Keycodes.java
class SDL_1_3_Keycodes
{
public static final int SDLK_UNKNOWN = 0;
public static final int SDLK_A = 4;
public static final int SDLK_B = 5;
public static final int SDLK_C = 6;
public static final int SDLK_D = 7;
public static final int SDLK_E = 8;
public static final int SDLK_F = 9;
public static final int SDLK_G = 10;
public static final int SDLK_H = 11;
public static final int SDLK_I = 12;
public static final int SDLK_J = 13;
public static final int SDLK_K = 14;
public static final int SDLK_L = 15;
public static final int SDLK_M = 16;
public static final int SDLK_N = 17;
public static final int SDLK_O = 18;
public static final int SDLK_P = 19;
public static final int SDLK_Q = 20;
public static final int SDLK_R = 21;
public static final int SDLK_S = 22;
public static final int SDLK_T = 23;
public static final int SDLK_U = 24;
public static final int SDLK_V = 25;
public static final int SDLK_W = 26;
public static final int SDLK_X = 27;
public static final int SDLK_Y = 28;
public static final int SDLK_Z = 29;
public static final int SDLK_1 = 30;
public static final int SDLK_2 = 31;
public static final int SDLK_3 = 32;
public static final int SDLK_4 = 33;
public static final int SDLK_5 = 34;
public static final int SDLK_6 = 35;
public static final int SDLK_7 = 36;
public static final int SDLK_8 = 37;
public static final int SDLK_9 = 38;
public static final int SDLK_0 = 39;
public static final int SDLK_RETURN = 40;
public static final int SDLK_ESCAPE = 41;
public static final int SDLK_BACKSPACE = 42;
public static final int SDLK_TAB = 43;
public static final int SDLK_SPACE = 44;
public static final int SDLK_MINUS = 45;
public static final int SDLK_EQUALS = 46;
public static final int SDLK_LEFTBRACKET = 47;
public static final int SDLK_RIGHTBRACKET = 48;
public static final int SDLK_BACKSLASH = 49;
public static final int SDLK_NONUSHASH = 50;
public static final int SDLK_SEMICOLON = 51;
public static final int SDLK_APOSTROPHE = 52;
public static final int SDLK_GRAVE = 53;
public static final int SDLK_COMMA = 54;
public static final int SDLK_PERIOD = 55;
public static final int SDLK_SLASH = 56;
public static final int SDLK_CAPSLOCK = 57;
public static final int SDLK_F1 = 58;
public static final int SDLK_F2 = 59;
public static final int SDLK_F3 = 60;
public static final int SDLK_F4 = 61;
public static final int SDLK_F5 = 62;
public static final int SDLK_F6 = 63;
public static final int SDLK_F7 = 64;
public static final int SDLK_F8 = 65;
public static final int SDLK_F9 = 66;
public static final int SDLK_F10 = 67;
public static final int SDLK_F11 = 68;
public static final int SDLK_F12 = 69;
public static final int SDLK_PRINTSCREEN = 70;
public static final int SDLK_SCROLLLOCK = 71;
public static final int SDLK_PAUSE = 72;
public static final int SDLK_INSERT = 73;
public static final int SDLK_HOME = 74;
public static final int SDLK_PAGEUP = 75;
public static final int SDLK_DELETE = 76;
public static final int SDLK_END = 77;
public static final int SDLK_PAGEDOWN = 78;
public static final int SDLK_RIGHT = 79;
public static final int SDLK_LEFT = 80;
public static final int SDLK_DOWN = 81;
public static final int SDLK_UP = 82;
public static final int SDLK_NUMLOCKCLEAR = 83;
public static final int SDLK_KP_DIVIDE = 84;
public static final int SDLK_KP_MULTIPLY = 85;
public static final int SDLK_KP_MINUS = 86;
public static final int SDLK_KP_PLUS = 87;
public static final int SDLK_KP_ENTER = 88;
public static final int SDLK_KP_1 = 89;
public static final int SDLK_KP_2 = 90;
public static final int SDLK_KP_3 = 91;
public static final int SDLK_KP_4 = 92;
public static final int SDLK_KP_5 = 93;
public static final int SDLK_KP_6 = 94;
public static final int SDLK_KP_7 = 95;
public static final int SDLK_KP_8 = 96;
public static final int SDLK_KP_9 = 97;
public static final int SDLK_KP_0 = 98;
public static final int SDLK_KP_PERIOD = 99;
public static final int SDLK_NONUSBACKSLASH = 100;
public static final int SDLK_APPLICATION = 101;
public static final int SDLK_POWER = 102;
public static final int SDLK_KP_EQUALS = 103;
public static final int SDLK_F13 = 104;
public static final int SDLK_F14 = 105;
public static final int SDLK_F15 = 106;
public static final int SDLK_F16 = 107;
public static final int SDLK_F17 = 108;
public static final int SDLK_F18 = 109;
public static final int SDLK_F19 = 110;
public static final int SDLK_F20 = 111;
public static final int SDLK_F21 = 112;
public static final int SDLK_F22 = 113;
public static final int SDLK_F23 = 114;
public static final int SDLK_F24 = 115;
public static final int SDLK_EXECUTE = 116;
public static final int SDLK_HELP = 117;
public static final int SDLK_MENU = 118;
public static final int SDLK_SELECT = 119;
public static final int SDLK_STOP = 120;
public static final int SDLK_AGAIN = 121;
public static final int SDLK_UNDO = 122;
public static final int SDLK_CUT = 123;
public static final int SDLK_COPY = 124;
public static final int SDLK_PASTE = 125;
public static final int SDLK_FIND = 126;
public static final int SDLK_MUTE = 127;
public static final int SDLK_VOLUMEUP = 128;
public static final int SDLK_VOLUMEDOWN = 129;
public static final int SDLK_KP_COMMA = 133;
public static final int SDLK_KP_EQUALSAS400 = 134;
public static final int SDLK_INTERNATIONAL1 = 135;
public static final int SDLK_INTERNATIONAL2 = 136;
public static final int SDLK_INTERNATIONAL3 = 137;
public static final int SDLK_INTERNATIONAL4 = 138;
public static final int SDLK_INTERNATIONAL5 = 139;
public static final int SDLK_INTERNATIONAL6 = 140;
public static final int SDLK_INTERNATIONAL7 = 141;
public static final int SDLK_INTERNATIONAL8 = 142;
public static final int SDLK_INTERNATIONAL9 = 143;
public static final int SDLK_LANG1 = 144;
public static final int SDLK_LANG2 = 145;
public static final int SDLK_LANG3 = 146;
public static final int SDLK_LANG4 = 147;
public static final int SDLK_LANG5 = 148;
public static final int SDLK_LANG6 = 149;
public static final int SDLK_LANG7 = 150;
public static final int SDLK_LANG8 = 151;
public static final int SDLK_LANG9 = 152;
public static final int SDLK_ALTERASE = 153;
public static final int SDLK_SYSREQ = 154;
public static final int SDLK_CANCEL = 155;
public static final int SDLK_CLEAR = 156;
public static final int SDLK_PRIOR = 157;
public static final int SDLK_RETURN2 = 158;
public static final int SDLK_SEPARATOR = 159;
public static final int SDLK_OUT = 160;
public static final int SDLK_OPER = 161;
public static final int SDLK_CLEARAGAIN = 162;
public static final int SDLK_CRSEL = 163;
public static final int SDLK_EXSEL = 164;
public static final int SDLK_KP_00 = 176;
public static final int SDLK_KP_000 = 177;
public static final int SDLK_THOUSANDSSEPARATOR = 178;
public static final int SDLK_DECIMALSEPARATOR = 179;
public static final int SDLK_CURRENCYUNIT = 180;
public static final int SDLK_CURRENCYSUBUNIT = 181;
public static final int SDLK_KP_LEFTPAREN = 182;
public static final int SDLK_KP_RIGHTPAREN = 183;
public static final int SDLK_KP_LEFTBRACE = 184;
public static final int SDLK_KP_RIGHTBRACE = 185;
public static final int SDLK_KP_TAB = 186;
public static final int SDLK_KP_BACKSPACE = 187;
public static final int SDLK_KP_A = 188;
public static final int SDLK_KP_B = 189;
public static final int SDLK_KP_C = 190;
public static final int SDLK_KP_D = 191;
public static final int SDLK_KP_E = 192;
public static final int SDLK_KP_F = 193;
public static final int SDLK_KP_XOR = 194;
public static final int SDLK_KP_POWER = 195;
public static final int SDLK_KP_PERCENT = 196;
public static final int SDLK_KP_LESS = 197;
public static final int SDLK_KP_GREATER = 198;
public static final int SDLK_KP_AMPERSAND = 199;
public static final int SDLK_KP_DBLAMPERSAND = 200;
public static final int SDLK_KP_VERTICALBAR = 201;
public static final int SDLK_KP_DBLVERTICALBAR = 202;
public static final int SDLK_KP_COLON = 203;
public static final int SDLK_KP_HASH = 204;
public static final int SDLK_KP_SPACE = 205;
public static final int SDLK_KP_AT = 206;
public static final int SDLK_KP_EXCLAM = 207;
public static final int SDLK_KP_MEMSTORE = 208;
public static final int SDLK_KP_MEMRECALL = 209;
public static final int SDLK_KP_MEMCLEAR = 210;
public static final int SDLK_KP_MEMADD = 211;
public static final int SDLK_KP_MEMSUBTRACT = 212;
public static final int SDLK_KP_MEMMULTIPLY = 213;
public static final int SDLK_KP_MEMDIVIDE = 214;
public static final int SDLK_KP_PLUSMINUS = 215;
public static final int SDLK_KP_CLEAR = 216;
public static final int SDLK_KP_CLEARENTRY = 217;
public static final int SDLK_KP_BINARY = 218;
public static final int SDLK_KP_OCTAL = 219;
public static final int SDLK_KP_DECIMAL = 220;
public static final int SDLK_KP_HEXADECIMAL = 221;
public static final int SDLK_LCTRL = 224;
public static final int SDLK_LSHIFT = 225;
public static final int SDLK_LALT = 226;
public static final int SDLK_LGUI = 227;
public static final int SDLK_RCTRL = 228;
public static final int SDLK_RSHIFT = 229;
public static final int SDLK_RALT = 230;
public static final int SDLK_RGUI = 231;
public static final int SDLK_MODE = 257;
public static final int SDLK_AUDIONEXT = 258;
public static final int SDLK_AUDIOPREV = 259;
public static final int SDLK_AUDIOSTOP = 260;
public static final int SDLK_AUDIOPLAY = 261;
public static final int SDLK_AUDIOMUTE = 262;
public static final int SDLK_MEDIASELECT = 263;
public static final int SDLK_WWW = 264;
public static final int SDLK_MAIL = 265;
public static final int SDLK_CALCULATOR = 266;
public static final int SDLK_COMPUTER = 267;
public static final int SDLK_AC_SEARCH = 268;
public static final int SDLK_AC_HOME = 269;
public static final int SDLK_AC_BACK = 270;
public static final int SDLK_AC_FORWARD = 271;
public static final int SDLK_AC_STOP = 272;
public static final int SDLK_AC_REFRESH = 273;
public static final int SDLK_AC_BOOKMARKS = 274;
public static final int SDLK_BRIGHTNESSDOWN = 275;
public static final int SDLK_BRIGHTNESSUP = 276;
public static final int SDLK_DISPLAYSWITCH = 277;
public static final int SDLK_KBDILLUMTOGGLE = 278;
public static final int SDLK_KBDILLUMDOWN = 279;
public static final int SDLK_KBDILLUMUP = 280;
public static final int SDLK_EJECT = 281;
public static final int SDLK_SLEEP = 282;
// Mouse buttons can be mapped to on-screen keys
public static final int SDLK_MOUSE_LEFT = 500;
public static final int SDLK_MOUSE_MIDDLE = 501;
public static final int SDLK_MOUSE_RIGHT = 502;
public static final int SDLK_MOUSE_WHEEL_UP = 503;
public static final int SDLK_MOUSE_WHEEL_DOWN = 504;
public static final int SDLK_MOUSE_X1 = 505;
public static final int SDLK_MOUSE_X2 = 506;
public static final int SDLK_NO_REMAP = 512;
}
class SDL_Keys
{
public static String [] names = null;
public static Integer [] values = null;
public static String [] namesSorted = null;
public static Integer [] namesSortedIdx = null;
public static Integer [] namesSortedBackIdx = null;
static final int JAVA_KEYCODE_LAST = 255; // Android 2.3 added several new gaming keys, Android 3.1 added even more - keep in sync with javakeycodes.h
static String getName(int v)
{
for( int f = 0; f < values.length; f++ )
{
if( values[f] == v )
return names[f];
}
return names[0];
}
static
{
ArrayList<String> Names = new ArrayList<String> ();
ArrayList<Integer> Values = new ArrayList<Integer> ();
Field [] fields = SDL_1_2_Keycodes.class.getDeclaredFields();
if( Globals.Using_SDL_1_3 )
{
fields = SDL_1_3_Keycodes.class.getDeclaredFields();
}
try {
for(Field f: fields)
{
if( !f.getName().startsWith("SDLK_") )
{
continue;
}
Values.add(f.getInt(null));
Names.add(f.getName().substring(5).toUpperCase());
}
} catch(IllegalAccessException e) {};
// Sort by value
for( int i = 0; i < Values.size(); i++ )
{
for( int j = i; j < Values.size(); j++ )
{
if( Values.get(i) > Values.get(j) )
{
int x = Values.get(i);
Values.set(i, Values.get(j));
Values.set(j, x);
String s = Names.get(i);
Names.set(i, Names.get(j));
Names.set(j, s);
}
}
}
names = Names.toArray(new String[0]);
values = Values.toArray(new Integer[0]);
namesSorted = Names.toArray(new String[0]);
namesSortedIdx = new Integer[values.length];
namesSortedBackIdx = new Integer[values.length];
Arrays.sort(namesSorted);
for( int i = 0; i < namesSorted.length; i++ )
{
for( int j = 0; j < namesSorted.length; j++ )
{
if( namesSorted[i].equals( names[j] ) )
{
namesSortedIdx[i] = j;
namesSortedBackIdx[j] = i;
break;
}
}
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,151 @@
// DO NOT EDIT THIS FILE - it is automatically generated, ALL YOUR CHANGES WILL BE OVERWRITTEN, edit the file under $JAVA_SRC_PATH dir
/*
Simple DirectMedia Layer
Java source code (C) 2009-2014 Sergii Pylypenko
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
package io.neoterm;
import android.app.Activity;
import android.app.Service;
import android.content.Context;
import android.os.Bundle;
import android.os.IBinder;
import android.view.MotionEvent;
import android.view.KeyEvent;
import android.view.Window;
import android.view.WindowManager;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import android.widget.EditText;
import android.text.Editable;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.FrameLayout;
import android.graphics.drawable.Drawable;
import android.graphics.Color;
import android.content.res.Configuration;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Intent;
import android.view.View.OnKeyListener;
import android.view.MenuItem;
import android.view.Menu;
import android.view.Gravity;
import android.text.method.TextKeyListener;
import java.util.LinkedList;
import java.io.SequenceInputStream;
import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.FileOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.util.zip.*;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
import java.util.Set;
import android.text.SpannedString;
import java.io.BufferedReader;
import java.io.BufferedInputStream;
import java.io.InputStreamReader;
import android.view.inputmethod.InputMethodManager;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.os.Handler;
import android.os.Message;
import android.os.SystemClock;
import java.util.concurrent.Semaphore;
import android.content.pm.ActivityInfo;
import android.view.Display;
import android.util.DisplayMetrics;
import android.text.InputType;
import android.util.Log;
import android.view.Surface;
import android.app.ProgressDialog;
import android.app.KeyguardManager;
import android.view.ViewTreeObserver;
import android.graphics.Rect;
public class RestartMainActivity extends Activity
{
@Override
protected void onCreate(Bundle savedInstanceState)
{
Log.i("SDL", "Restarting main activity");
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
_layout = new LinearLayout(this);
_layout.setOrientation(LinearLayout.VERTICAL);
_layout.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));
//Get the display so we can know the screen size
Display display = getWindowManager().getDefaultDisplay();
int width = display.getWidth();
int height = display.getHeight();
_tv = new TextView(this);
_tv.setMaxLines(2);
_tv.setMinLines(2);
_tv.setText(R.string.restarting_please_wait);
_tv.setTextSize(30f);
_tv.setPadding((int)(width * 0.1), (int)(height * 0.1), (int)(width * 0.1), 0);
_layout.addView(_tv);
_videoLayout = new FrameLayout(this);
_videoLayout.addView(_layout);
setContentView(_videoLayout);
new Thread(new Runnable()
{
public void run()
{
try{
Thread.sleep(2000);
} catch (InterruptedException e) {}
Intent intent = new Intent(RestartMainActivity.this, MainActivity.class);
intent.putExtra(ACTIVITY_AUTODETECT_SCREEN_ORIENTATION, getIntent().getBooleanExtra(ACTIVITY_AUTODETECT_SCREEN_ORIENTATION, false));
String restartParams = getIntent().getStringExtra(SDL_RESTART_PARAMS);
intent.putExtra(SDL_RESTART_PARAMS, restartParams == null ? "" : restartParams);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
RestartMainActivity.this.startActivity(intent);
try{
Thread.sleep(1000);
} catch (InterruptedException e) {}
System.exit(0);
}
}).start();
}
private TextView _tv = null;
private LinearLayout _layout = null;
private FrameLayout _videoLayout = null;
public static final String ACTIVITY_AUTODETECT_SCREEN_ORIENTATION = "libsdl.org.ACTIVITY_AUTODETECT_SCREEN_ORIENTATION";
public static final String SDL_RESTART_PARAMS = "SDL_RESTART_PARAMS";
}

View File

@ -0,0 +1,158 @@
/*
Simple DirectMedia Layer
Java source code (C) 2009-2014 Sergii Pylypenko
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
package io.neoterm;
import android.app.Activity;
import android.app.Service;
import android.content.Context;
import android.os.Bundle;
import android.os.IBinder;
import android.view.MotionEvent;
import android.view.KeyEvent;
import android.view.Window;
import android.view.WindowManager;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import android.widget.EditText;
import android.text.Editable;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.FrameLayout;
import android.graphics.drawable.Drawable;
import android.graphics.Color;
import android.content.res.Configuration;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Intent;
import android.view.View.OnKeyListener;
import android.view.MenuItem;
import android.view.Menu;
import android.view.Gravity;
import android.text.method.TextKeyListener;
import java.util.LinkedList;
import java.io.SequenceInputStream;
import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.FileOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.util.zip.*;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
import java.util.Set;
import android.text.SpannedString;
import java.io.BufferedReader;
import java.io.BufferedInputStream;
import java.io.InputStreamReader;
import android.view.inputmethod.InputMethodManager;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.os.Handler;
import android.os.Message;
import android.os.SystemClock;
import java.util.concurrent.Semaphore;
import android.content.pm.ActivityInfo;
import android.view.Display;
import android.util.DisplayMetrics;
import android.text.InputType;
import android.util.Log;
import android.view.Surface;
import android.app.ProgressDialog;
import android.app.KeyguardManager;
import android.view.ViewTreeObserver;
import android.graphics.Rect;
import android.net.Uri;
import android.content.ComponentName;
public class RunFromOtherApp extends Activity
{
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
Log.i("SDL", "Run from another app, getCallingActivity() is " +( getCallingActivity() == null ? "null" : "not null" ));
Intent main = new Intent(this, MainActivity.class);
main.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
if( getIntent().getScheme() != null && getIntent().getScheme().equals("x11") )
{
int port = getIntent().getData().getPort();
if (port >= 0)
{
if (port >= 6000)
port -= 6000;
//Globals.CommandLine = Globals.CommandLine + " :" + port;
main.putExtra(RestartMainActivity.SDL_RESTART_PARAMS, ":" + port);
}
}
startActivity(main);
new Thread(new Runnable()
{
public void run()
{
Log.i("SDL", "Waiting for env vars to be set");
while( System.getenv("DISPLAY") == null || System.getenv("PULSE_SERVER") == null )
{
try {
Thread.sleep(300);
} catch (InterruptedException e) {}
}
Log.i("SDL", "Env vars set, returning result, getCallingActivity() is " + (getCallingActivity() == null ? "null" : "not null"));
if( getCallingActivity() != null )
{
final ComponentName callingActivity = getCallingActivity().clone();
Log.i("SDL", "Launching calling activity: " + getCallingActivity().toString());
new Thread(new Runnable()
{
public void run()
{
try {
Thread.sleep(500);
} catch (InterruptedException e) {}
Intent caller = new Intent();
caller.setComponent(callingActivity);
caller.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
Log.i("SDL", "Launching calling activity: " + caller.toString());
startActivity(caller);
}
}).start();
}
Intent intent = new Intent(Intent.ACTION_RUN, Uri.parse("x11://run?DISPLAY=" + Uri.encode(System.getenv("DISPLAY")) + "&PULSE_SERVER=" + Uri.encode(System.getenv("PULSE_SERVER"))));
intent.putExtra("DISPLAY", System.getenv("DISPLAY"));
intent.putExtra("PULSE_SERVER", System.getenv("PULSE_SERVER"));
intent.putExtra("run", "export DISPLAY=" + System.getenv("DISPLAY") + " ; export PULSE_SERVER=" + System.getenv("PULSE_SERVER"));
setResult(Activity.RESULT_OK, intent);
finish();
}
}).start();
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,258 @@
// DO NOT EDIT THIS FILE - it is automatically generated, ALL YOUR CHANGES WILL BE OVERWRITTEN, edit the file under $JAVA_SRC_PATH dir
/*
Simple DirectMedia Layer
Java source code (C) 2009-2014 Sergii Pylypenko
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
package io.neoterm;
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.KeyEvent;
import android.view.Window;
import android.view.WindowManager;
import android.widget.TextView;
import android.util.Log;
import java.io.*;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.os.Environment;
import android.os.StatFs;
import java.util.Locale;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.zip.GZIPInputStream;
import java.util.Collections;
import android.content.Context;
import android.content.res.Configuration;
import android.content.res.Resources;
import java.lang.String;
import android.graphics.Matrix;
import android.graphics.RectF;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.FrameLayout;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.BitmapFactory;
import android.graphics.Bitmap;
import android.widget.TextView;
import android.widget.EditText;
import android.widget.ScrollView;
import android.widget.Button;
import android.view.View;
import android.widget.LinearLayout;
import android.text.Editable;
import android.text.SpannedString;
import android.content.Intent;
import android.app.PendingIntent;
import android.app.AlarmManager;
import android.util.DisplayMetrics;
import android.net.Uri;
import java.util.concurrent.Semaphore;
import java.util.Arrays;
import android.graphics.Color;
import android.hardware.SensorEventListener;
import android.hardware.SensorEvent;
import android.hardware.Sensor;
import android.widget.Toast;
class SettingsMenu
{
public static abstract class Menu
{
// Should be overridden by children
abstract void run(final MainActivity p);
abstract String title(final MainActivity p);
boolean enabled()
{
return true;
}
// Should not be overridden
boolean enabledOrHidden()
{
for( Menu m: Globals.HiddenMenuOptions )
{
if( m.getClass().getName().equals( this.getClass().getName() ) )
return false;
}
return enabled();
}
void showMenuOptionsList(final MainActivity p, final Menu[] list)
{
menuStack.add(this);
ArrayList<CharSequence> items = new ArrayList<CharSequence> ();
for( Menu m: list )
{
if(m.enabledOrHidden())
items.add(m.title(p));
}
AlertDialog.Builder builder = new AlertDialog.Builder(p);
builder.setTitle(title(p));
builder.setItems(items.toArray(new CharSequence[0]), new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int item)
{
dialog.dismiss();
int selected = 0;
for( Menu m: list )
{
if(m.enabledOrHidden())
{
if( selected == item )
{
m.run(p);
return;
}
selected ++;
}
}
}
});
builder.setOnCancelListener(new DialogInterface.OnCancelListener()
{
public void onCancel(DialogInterface dialog)
{
goBackOuterMenu(p);
}
});
AlertDialog alert = builder.create();
alert.setOwnerActivity(p);
alert.show();
}
}
static ArrayList<Menu> menuStack = new ArrayList<Menu> ();
public static void showConfig(final MainActivity p, final boolean firstStart)
{
Settings.settingsChanged = true;
if( Globals.OptionalDataDownload == null )
{
String downloads[] = Globals.DataDownloadUrl;
Globals.OptionalDataDownload = new boolean[downloads.length];
boolean oldFormat = true;
for( int i = 0; i < downloads.length; i++ )
{
if( downloads[i].indexOf("!") == 0 )
{
Globals.OptionalDataDownload[i] = true;
oldFormat = false;
}
}
if( oldFormat )
Globals.OptionalDataDownload[0] = true;
}
if(!firstStart)
new MainMenu().run(p);
else
{
if( Globals.StartupMenuButtonTimeout > 0 ) // If we did not disable startup menu altogether
{
for( Menu m: Globals.FirstStartMenuOptions )
{
boolean hidden = false;
for( Menu m1: Globals.HiddenMenuOptions )
{
if( m1.getClass().getName().equals( m.getClass().getName() ) )
hidden = true;
}
if( ! hidden )
menuStack.add(0, m);
}
}
goBack(p);
}
}
static void goBack(final MainActivity p)
{
if(menuStack.isEmpty())
{
Settings.Save(p);
p.startDownloader();
}
else
{
Menu c = menuStack.remove(menuStack.size() - 1);
c.run(p);
}
}
static void goBackOuterMenu(final MainActivity p)
{
if(!menuStack.isEmpty())
menuStack.remove(menuStack.size() - 1);
goBack(p);
}
static class OkButton extends Menu
{
String title(final MainActivity p)
{
return p.getResources().getString(R.string.ok);
}
void run (final MainActivity p)
{
goBackOuterMenu(p);
}
}
static class DummyMenu extends Menu
{
String title(final MainActivity p)
{
return p.getResources().getString(R.string.ok);
}
void run (final MainActivity p)
{
goBack(p);
}
}
static class MainMenu extends Menu
{
String title(final MainActivity p)
{
return p.getResources().getString(R.string.device_config);
}
void run (final MainActivity p)
{
Menu options[] =
{
new SettingsMenuMisc.DownloadConfig(),
new SettingsMenuMisc.OptionalDownloadConfig(false),
new SettingsMenuKeyboard.KeyboardConfigMainMenu(),
new SettingsMenuMouse.MouseConfigMainMenu(),
new SettingsMenuMisc.AudioConfig(),
new SettingsMenuKeyboard.RemapHwKeysConfig(),
new SettingsMenuKeyboard.ScreenGesturesConfig(),
new SettingsMenuMisc.VideoSettingsConfig(),
new SettingsMenuMisc.CommandlineConfig(),
new SettingsMenuMisc.ResetToDefaultsConfig(),
new OkButton(),
};
showMenuOptionsList(p, options);
}
}
}

View File

@ -0,0 +1,917 @@
// DO NOT EDIT THIS FILE - it is automatically generated, ALL YOUR CHANGES WILL BE OVERWRITTEN, edit the file under $JAVA_SRC_PATH dir
/*
Simple DirectMedia Layer
Java source code (C) 2009-2014 Sergii Pylypenko
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
package io.neoterm;
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.KeyEvent;
import android.view.Window;
import android.view.WindowManager;
import android.widget.TextView;
import android.util.Log;
import java.io.*;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.os.Environment;
import android.os.StatFs;
import java.util.Locale;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.zip.GZIPInputStream;
import java.util.Collections;
import android.content.Context;
import android.content.res.Configuration;
import android.content.res.Resources;
import java.lang.String;
import android.graphics.Matrix;
import android.graphics.RectF;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.FrameLayout;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.BitmapFactory;
import android.graphics.Bitmap;
import android.widget.TextView;
import android.widget.EditText;
import android.widget.ScrollView;
import android.widget.Button;
import android.view.View;
import android.widget.LinearLayout;
import android.text.Editable;
import android.text.SpannedString;
import android.content.Intent;
import android.app.PendingIntent;
import android.app.AlarmManager;
import android.util.DisplayMetrics;
import android.net.Uri;
import java.util.concurrent.Semaphore;
import java.util.Arrays;
import android.graphics.Color;
import android.hardware.SensorEventListener;
import android.hardware.SensorEvent;
import android.hardware.Sensor;
import android.widget.Toast;
class SettingsMenuKeyboard extends SettingsMenu
{
static class KeyboardConfigMainMenu extends Menu
{
String title(final MainActivity p)
{
return p.getResources().getString(R.string.controls_screenkb);
}
boolean enabled()
{
return Globals.UseTouchscreenKeyboard;
}
void run (final MainActivity p)
{
Menu options[] =
{
new ScreenKeyboardThemeConfig(),
new ScreenKeyboardSizeConfig(),
new ScreenKeyboardDrawSizeConfig(),
new ScreenKeyboardTransparencyConfig(),
new RemapScreenKbConfig(),
new CustomizeScreenKbLayout(),
new ScreenKeyboardAdvanced(),
new OkButton(),
};
showMenuOptionsList(p, options);
}
}
static class ScreenKeyboardSizeConfig extends Menu
{
String title(final MainActivity p)
{
return p.getResources().getString(R.string.controls_screenkb_size);
}
void run (final MainActivity p)
{
final CharSequence[] items = { p.getResources().getString(R.string.controls_screenkb_large),
p.getResources().getString(R.string.controls_screenkb_medium),
p.getResources().getString(R.string.controls_screenkb_small),
p.getResources().getString(R.string.controls_screenkb_tiny),
p.getResources().getString(R.string.controls_screenkb_custom) };
AlertDialog.Builder builder = new AlertDialog.Builder(p);
builder.setTitle(p.getResources().getString(R.string.controls_screenkb_size));
builder.setSingleChoiceItems(items, Globals.TouchscreenKeyboardSize, new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int item)
{
Globals.TouchscreenKeyboardSize = item;
dialog.dismiss();
if( Globals.TouchscreenKeyboardSize == Globals.TOUCHSCREEN_KEYBOARD_CUSTOM )
new CustomizeScreenKbLayout().run(p);
else
goBack(p);
}
});
builder.setOnCancelListener(new DialogInterface.OnCancelListener()
{
public void onCancel(DialogInterface dialog)
{
goBack(p);
}
});
AlertDialog alert = builder.create();
alert.setOwnerActivity(p);
alert.show();
}
}
static class ScreenKeyboardDrawSizeConfig extends Menu
{
String title(final MainActivity p)
{
return p.getResources().getString(R.string.controls_screenkb_drawsize);
}
void run (final MainActivity p)
{
final CharSequence[] items = { p.getResources().getString(R.string.controls_screenkb_large),
p.getResources().getString(R.string.controls_screenkb_medium),
p.getResources().getString(R.string.controls_screenkb_small),
p.getResources().getString(R.string.controls_screenkb_tiny) };
AlertDialog.Builder builder = new AlertDialog.Builder(p);
builder.setTitle(p.getResources().getString(R.string.controls_screenkb_drawsize));
builder.setSingleChoiceItems(items, Globals.TouchscreenKeyboardDrawSize, new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int item)
{
Globals.TouchscreenKeyboardDrawSize = item;
dialog.dismiss();
goBack(p);
}
});
builder.setOnCancelListener(new DialogInterface.OnCancelListener()
{
public void onCancel(DialogInterface dialog)
{
goBack(p);
}
});
AlertDialog alert = builder.create();
alert.setOwnerActivity(p);
alert.show();
}
}
static class ScreenKeyboardThemeConfig extends Menu
{
String title(final MainActivity p)
{
return p.getResources().getString(R.string.controls_screenkb_theme);
}
void run (final MainActivity p)
{
final CharSequence[] items = {
p.getResources().getString(R.string.controls_screenkb_by, "Ultimate Droid", "Sean Stieber"),
p.getResources().getString(R.string.controls_screenkb_by, "Simple Theme", "Beholder"),
p.getResources().getString(R.string.controls_screenkb_by, "Sun", "Sirea"),
p.getResources().getString(R.string.controls_screenkb_by, "Keen", "Gerstrong"),
p.getResources().getString(R.string.controls_screenkb_by, "Retro", "Santiago Radeff"),
p.getResources().getString(R.string.controls_screenkb_by, "Gba", "from RetroArch"),
p.getResources().getString(R.string.controls_screenkb_by, "Psx", "from RetroArch"),
p.getResources().getString(R.string.controls_screenkb_by, "Snes", "from RetroArch"),
p.getResources().getString(R.string.controls_screenkb_by, "DualShock", "from RetroArch"),
p.getResources().getString(R.string.controls_screenkb_by, "N64", "from RetroArch")
};
AlertDialog.Builder builder = new AlertDialog.Builder(p);
builder.setTitle(p.getResources().getString(R.string.controls_screenkb_theme));
builder.setSingleChoiceItems(items, Globals.TouchscreenKeyboardTheme, new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int item)
{
Globals.TouchscreenKeyboardTheme = item;
dialog.dismiss();
goBack(p);
}
});
builder.setOnCancelListener(new DialogInterface.OnCancelListener()
{
public void onCancel(DialogInterface dialog)
{
goBack(p);
}
});
AlertDialog alert = builder.create();
alert.setOwnerActivity(p);
alert.show();
}
}
static class ScreenKeyboardTransparencyConfig extends Menu
{
String title(final MainActivity p)
{
return p.getResources().getString(R.string.controls_screenkb_transparency);
}
void run (final MainActivity p)
{
final CharSequence[] items = { p.getResources().getString(R.string.controls_screenkb_trans_0),
p.getResources().getString(R.string.controls_screenkb_trans_1),
p.getResources().getString(R.string.controls_screenkb_trans_2),
p.getResources().getString(R.string.controls_screenkb_trans_3),
p.getResources().getString(R.string.controls_screenkb_trans_4) };
AlertDialog.Builder builder = new AlertDialog.Builder(p);
builder.setTitle(p.getResources().getString(R.string.controls_screenkb_transparency));
builder.setSingleChoiceItems(items, Globals.TouchscreenKeyboardTransparency, new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int item)
{
Globals.TouchscreenKeyboardTransparency = item;
dialog.dismiss();
goBack(p);
}
});
builder.setOnCancelListener(new DialogInterface.OnCancelListener()
{
public void onCancel(DialogInterface dialog)
{
goBack(p);
}
});
AlertDialog alert = builder.create();
alert.setOwnerActivity(p);
alert.show();
}
}
static class RemapHwKeysConfig extends Menu
{
String title(final MainActivity p)
{
return p.getResources().getString(R.string.remap_hwkeys);
}
void run (final MainActivity p)
{
p.setText(p.getResources().getString(R.string.remap_hwkeys_press));
p.getVideoLayout().setOnKeyListener(new KeyRemapTool(p));
}
public static class KeyRemapTool implements View.OnKeyListener
{
MainActivity p;
public KeyRemapTool(MainActivity _p)
{
p = _p;
}
@Override
public boolean onKey(View v, int keyCode, KeyEvent event)
{
p.getVideoLayout().setOnKeyListener(null);
int keyIndex = keyCode;
if( keyIndex < 0 )
keyIndex = 0;
if( keyIndex > SDL_Keys.JAVA_KEYCODE_LAST )
keyIndex = 0;
final int KeyIndexFinal = keyIndex;
CharSequence[] items = {
SDL_Keys.names[Globals.RemapScreenKbKeycode[0]],
SDL_Keys.names[Globals.RemapScreenKbKeycode[1]],
SDL_Keys.names[Globals.RemapScreenKbKeycode[2]],
SDL_Keys.names[Globals.RemapScreenKbKeycode[3]],
SDL_Keys.names[Globals.RemapScreenKbKeycode[4]],
SDL_Keys.names[Globals.RemapScreenKbKeycode[5]],
p.getResources().getString(R.string.remap_hwkeys_select_more_keys),
};
for( int i = 0; i < Math.min(6, Globals.AppTouchscreenKeyboardKeysNames.length); i++ )
items[i] = Globals.AppTouchscreenKeyboardKeysNames[i].replace("_", " ");
AlertDialog.Builder builder = new AlertDialog.Builder(p);
builder.setTitle(R.string.remap_hwkeys_select_simple);
builder.setItems(items, new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int item)
{
dialog.dismiss();
if( item >= 6 )
ShowAllKeys(KeyIndexFinal);
else
{
Globals.RemapHwKeycode[KeyIndexFinal] = Globals.RemapScreenKbKeycode[item];
goBack(p);
}
}
});
builder.setOnCancelListener(new DialogInterface.OnCancelListener()
{
public void onCancel(DialogInterface dialog)
{
goBack(p);
}
});
AlertDialog alert = builder.create();
alert.setOwnerActivity(p);
alert.show();
return true;
}
public void ShowAllKeys(final int KeyIndex)
{
AlertDialog.Builder builder = new AlertDialog.Builder(p);
builder.setTitle(R.string.remap_hwkeys_select);
builder.setSingleChoiceItems(SDL_Keys.namesSorted, SDL_Keys.namesSortedBackIdx[Globals.RemapHwKeycode[KeyIndex]], new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int item)
{
Globals.RemapHwKeycode[KeyIndex] = SDL_Keys.namesSortedIdx[item];
dialog.dismiss();
goBack(p);
}
});
builder.setOnCancelListener(new DialogInterface.OnCancelListener()
{
public void onCancel(DialogInterface dialog)
{
goBack(p);
}
});
AlertDialog alert = builder.create();
alert.setOwnerActivity(p);
alert.show();
}
}
}
static class RemapScreenKbConfig extends Menu
{
String title(final MainActivity p)
{
return p.getResources().getString(R.string.remap_screenkb);
}
//boolean enabled() { return true; };
void run (final MainActivity p)
{
CharSequence[] items = {
p.getResources().getString(R.string.remap_screenkb_joystick),
p.getResources().getString(R.string.remap_screenkb_button_text),
p.getResources().getString(R.string.remap_screenkb_button) + " 1",
p.getResources().getString(R.string.remap_screenkb_button) + " 2",
p.getResources().getString(R.string.remap_screenkb_button) + " 3",
p.getResources().getString(R.string.remap_screenkb_button) + " 4",
p.getResources().getString(R.string.remap_screenkb_button) + " 5",
p.getResources().getString(R.string.remap_screenkb_button) + " 6",
};
boolean defaults[] = Arrays.copyOf(Globals.ScreenKbControlsShown, Globals.ScreenKbControlsShown.length);
if( Globals.AppUsesSecondJoystick )
{
items = Arrays.copyOf(items, items.length + 1);
items[items.length - 1] = p.getResources().getString(R.string.remap_screenkb_joystick) + " 2";
defaults = Arrays.copyOf(defaults, defaults.length + 1);
defaults[defaults.length - 1] = true;
}
if( Globals.AppUsesThirdJoystick )
{
items = Arrays.copyOf(items, items.length + 1);
items[items.length - 1] = p.getResources().getString(R.string.remap_screenkb_joystick) + " 3";
defaults = Arrays.copyOf(defaults, defaults.length + 1);
defaults[defaults.length - 1] = true;
}
for( int i = 0; i < Math.min(6, Globals.AppTouchscreenKeyboardKeysNames.length); i++ )
items[i+2] = items[i+2] + " - " + Globals.AppTouchscreenKeyboardKeysNames[i].replace("_", " ");
AlertDialog.Builder builder = new AlertDialog.Builder(p);
builder.setTitle(p.getResources().getString(R.string.remap_screenkb));
builder.setMultiChoiceItems(items, defaults, new DialogInterface.OnMultiChoiceClickListener()
{
public void onClick(DialogInterface dialog, int item, boolean isChecked)
{
Globals.ScreenKbControlsShown[item] = isChecked;
}
});
builder.setPositiveButton(p.getResources().getString(R.string.ok), new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int item)
{
dialog.dismiss();
showRemapScreenKbConfig2(p, 0);
}
});
builder.setOnCancelListener(new DialogInterface.OnCancelListener()
{
public void onCancel(DialogInterface dialog)
{
goBack(p);
}
});
AlertDialog alert = builder.create();
alert.setOwnerActivity(p);
alert.show();
}
static void showRemapScreenKbConfig2(final MainActivity p, final int currentButton)
{
CharSequence[] items = {
p.getResources().getString(R.string.remap_screenkb_button) + " 1",
p.getResources().getString(R.string.remap_screenkb_button) + " 2",
p.getResources().getString(R.string.remap_screenkb_button) + " 3",
p.getResources().getString(R.string.remap_screenkb_button) + " 4",
p.getResources().getString(R.string.remap_screenkb_button) + " 5",
p.getResources().getString(R.string.remap_screenkb_button) + " 6",
};
for( int i = 0; i < Math.min(6, Globals.AppTouchscreenKeyboardKeysNames.length); i++ )
items[i] = items[i] + " - " + Globals.AppTouchscreenKeyboardKeysNames[i].replace("_", " ");
if( currentButton >= Globals.RemapScreenKbKeycode.length )
{
goBack(p);
return;
}
if( ! Globals.ScreenKbControlsShown[currentButton + 2] )
{
showRemapScreenKbConfig2(p, currentButton + 1);
return;
}
AlertDialog.Builder builder = new AlertDialog.Builder(p);
builder.setTitle(items[currentButton]);
builder.setSingleChoiceItems(SDL_Keys.namesSorted, SDL_Keys.namesSortedBackIdx[Globals.RemapScreenKbKeycode[currentButton]], new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int item)
{
Globals.RemapScreenKbKeycode[currentButton] = SDL_Keys.namesSortedIdx[item];
dialog.dismiss();
showRemapScreenKbConfig2(p, currentButton + 1);
}
});
builder.setOnCancelListener(new DialogInterface.OnCancelListener()
{
public void onCancel(DialogInterface dialog)
{
goBack(p);
}
});
AlertDialog alert = builder.create();
alert.setOwnerActivity(p);
alert.show();
}
}
static class ScreenGesturesConfig extends Menu
{
String title(final MainActivity p)
{
return p.getResources().getString(R.string.remap_screenkb_button_gestures);
}
//boolean enabled() { return true; };
void run (final MainActivity p)
{
CharSequence[] items = {
p.getResources().getString(R.string.remap_screenkb_button_zoomin),
p.getResources().getString(R.string.remap_screenkb_button_zoomout),
p.getResources().getString(R.string.remap_screenkb_button_rotateleft),
p.getResources().getString(R.string.remap_screenkb_button_rotateright),
};
boolean defaults[] = {
Globals.MultitouchGesturesUsed[0],
Globals.MultitouchGesturesUsed[1],
Globals.MultitouchGesturesUsed[2],
Globals.MultitouchGesturesUsed[3],
};
AlertDialog.Builder builder = new AlertDialog.Builder(p);
builder.setTitle(p.getResources().getString(R.string.remap_screenkb_button_gestures));
builder.setMultiChoiceItems(items, defaults, new DialogInterface.OnMultiChoiceClickListener()
{
public void onClick(DialogInterface dialog, int item, boolean isChecked)
{
Globals.MultitouchGesturesUsed[item] = isChecked;
}
});
builder.setPositiveButton(p.getResources().getString(R.string.ok), new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int item)
{
dialog.dismiss();
showScreenGesturesConfig2(p);
}
});
builder.setOnCancelListener(new DialogInterface.OnCancelListener()
{
public void onCancel(DialogInterface dialog)
{
goBack(p);
}
});
AlertDialog alert = builder.create();
alert.setOwnerActivity(p);
alert.show();
}
static void showScreenGesturesConfig2(final MainActivity p)
{
final CharSequence[] items = {
p.getResources().getString(R.string.accel_slow),
p.getResources().getString(R.string.accel_medium),
p.getResources().getString(R.string.accel_fast),
p.getResources().getString(R.string.accel_veryfast)
};
AlertDialog.Builder builder = new AlertDialog.Builder(p);
builder.setTitle(R.string.remap_screenkb_button_gestures_sensitivity);
builder.setSingleChoiceItems(items, Globals.MultitouchGestureSensitivity, new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int item)
{
Globals.MultitouchGestureSensitivity = item;
dialog.dismiss();
showScreenGesturesConfig3(p, 0);
}
});
builder.setOnCancelListener(new DialogInterface.OnCancelListener()
{
public void onCancel(DialogInterface dialog)
{
goBack(p);
}
});
AlertDialog alert = builder.create();
alert.setOwnerActivity(p);
alert.show();
}
static void showScreenGesturesConfig3(final MainActivity p, final int currentButton)
{
CharSequence[] items = {
p.getResources().getString(R.string.remap_screenkb_button_zoomin),
p.getResources().getString(R.string.remap_screenkb_button_zoomout),
p.getResources().getString(R.string.remap_screenkb_button_rotateleft),
p.getResources().getString(R.string.remap_screenkb_button_rotateright),
};
if( currentButton >= Globals.RemapMultitouchGestureKeycode.length )
{
goBack(p);
return;
}
if( ! Globals.MultitouchGesturesUsed[currentButton] )
{
showScreenGesturesConfig3(p, currentButton + 1);
return;
}
AlertDialog.Builder builder = new AlertDialog.Builder(p);
builder.setTitle(items[currentButton]);
builder.setSingleChoiceItems(SDL_Keys.namesSorted, SDL_Keys.namesSortedBackIdx[Globals.RemapMultitouchGestureKeycode[currentButton]], new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int item)
{
Globals.RemapMultitouchGestureKeycode[currentButton] = SDL_Keys.namesSortedIdx[item];
dialog.dismiss();
showScreenGesturesConfig3(p, currentButton + 1);
}
});
builder.setOnCancelListener(new DialogInterface.OnCancelListener()
{
public void onCancel(DialogInterface dialog)
{
goBack(p);
}
});
AlertDialog alert = builder.create();
alert.setOwnerActivity(p);
alert.show();
}
}
static class CustomizeScreenKbLayout extends Menu
{
String title(final MainActivity p)
{
return p.getResources().getString(R.string.screenkb_custom_layout);
}
//boolean enabled() { return true; };
void run (final MainActivity p)
{
p.setText(p.getResources().getString(R.string.screenkb_custom_layout_help));
CustomizeScreenKbLayoutTool tool = new CustomizeScreenKbLayoutTool(p);
Globals.TouchscreenKeyboardSize = Globals.TOUCHSCREEN_KEYBOARD_CUSTOM;
}
static class CustomizeScreenKbLayoutTool implements View.OnTouchListener, View.OnKeyListener
{
MainActivity p;
FrameLayout layout = null;
ImageView imgs[] = new ImageView[Globals.ScreenKbControlsLayout.length];
Bitmap bmps[] = new Bitmap[Globals.ScreenKbControlsLayout.length];
ImageView boundary = null;
Bitmap boundaryBmp = null;
int currentButton = 0;
int buttons[] = {
R.drawable.dpad,
R.drawable.keyboard,
R.drawable.b1,
R.drawable.b2,
R.drawable.b3,
R.drawable.b4,
R.drawable.b5,
R.drawable.b6,
R.drawable.dpad,
R.drawable.dpad
};
int oldX = 0, oldY = 0;
boolean resizing = false;
public CustomizeScreenKbLayoutTool(MainActivity _p)
{
p = _p;
layout = new FrameLayout(p);
p.getVideoLayout().addView(layout);
layout.setFocusable(true);
layout.setFocusableInTouchMode(true);
layout.requestFocus();
layout.setOnTouchListener(this);
layout.setOnKeyListener(this);
boundary = new ImageView(p);
boundary.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));
boundary.setScaleType(ImageView.ScaleType.MATRIX);
boundaryBmp = BitmapFactory.decodeResource( p.getResources(), R.drawable.rectangle );
boundary.setImageBitmap(boundaryBmp);
layout.addView(boundary);
currentButton = -1;
if( Globals.TouchscreenKeyboardTheme == 2 )
{
buttons = new int[] {
R.drawable.sun_dpad,
R.drawable.sun_keyboard,
R.drawable.sun_b1,
R.drawable.sun_b2,
R.drawable.sun_b3,
R.drawable.sun_b4,
R.drawable.sun_b5,
R.drawable.sun_b6,
R.drawable.sun_dpad,
R.drawable.sun_dpad
};
}
int displayX = 800;
int displayY = 480;
try {
DisplayMetrics dm = new DisplayMetrics();
p.getWindowManager().getDefaultDisplay().getMetrics(dm);
displayX = dm.widthPixels;
displayY = dm.heightPixels;
} catch (Exception eeeee) {}
for( int i = 0; i < Globals.ScreenKbControlsLayout.length; i++ )
{
if( ! Globals.ScreenKbControlsShown[i] )
continue;
if( currentButton == -1 )
currentButton = i;
//Log.i("SDL", "Screen kb button " + i + " coords " + Globals.ScreenKbControlsLayout[i][0] + ":" + Globals.ScreenKbControlsLayout[i][1] + ":" + Globals.ScreenKbControlsLayout[i][2] + ":" + Globals.ScreenKbControlsLayout[i][3] );
// Check if the button is off screen edge or shrunk to zero
if( Globals.ScreenKbControlsLayout[i][0] > Globals.ScreenKbControlsLayout[i][2] - displayY/12 )
Globals.ScreenKbControlsLayout[i][0] = Globals.ScreenKbControlsLayout[i][2] - displayY/12;
if( Globals.ScreenKbControlsLayout[i][1] > Globals.ScreenKbControlsLayout[i][3] - displayY/12 )
Globals.ScreenKbControlsLayout[i][1] = Globals.ScreenKbControlsLayout[i][3] - displayY/12;
if( Globals.ScreenKbControlsLayout[i][0] < Globals.ScreenKbControlsLayout[i][2] - displayY*2/3 )
Globals.ScreenKbControlsLayout[i][0] = Globals.ScreenKbControlsLayout[i][2] - displayY*2/3;
if( Globals.ScreenKbControlsLayout[i][1] < Globals.ScreenKbControlsLayout[i][3] - displayY*2/3 )
Globals.ScreenKbControlsLayout[i][1] = Globals.ScreenKbControlsLayout[i][3] - displayY*2/3;
if( Globals.ScreenKbControlsLayout[i][0] < 0 )
{
Globals.ScreenKbControlsLayout[i][2] += -Globals.ScreenKbControlsLayout[i][0];
Globals.ScreenKbControlsLayout[i][0] = 0;
}
if( Globals.ScreenKbControlsLayout[i][2] > displayX )
{
Globals.ScreenKbControlsLayout[i][0] -= Globals.ScreenKbControlsLayout[i][2] - displayX;
Globals.ScreenKbControlsLayout[i][2] = displayX;
}
if( Globals.ScreenKbControlsLayout[i][1] < 0 )
{
Globals.ScreenKbControlsLayout[i][3] += -Globals.ScreenKbControlsLayout[i][1];
Globals.ScreenKbControlsLayout[i][1] = 0;
}
if( Globals.ScreenKbControlsLayout[i][3] > displayY )
{
Globals.ScreenKbControlsLayout[i][1] -= Globals.ScreenKbControlsLayout[i][3] - displayY;
Globals.ScreenKbControlsLayout[i][3] = displayY;
}
//Log.i("SDL", "After bounds check coords " + Globals.ScreenKbControlsLayout[i][0] + ":" + Globals.ScreenKbControlsLayout[i][1] + ":" + Globals.ScreenKbControlsLayout[i][2] + ":" + Globals.ScreenKbControlsLayout[i][3] );
imgs[i] = new ImageView(p);
imgs[i].setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));
imgs[i].setScaleType(ImageView.ScaleType.MATRIX);
bmps[i] = BitmapFactory.decodeResource( p.getResources(), buttons[i] );
imgs[i].setImageBitmap(bmps[i]);
imgs[i].setAlpha(128);
layout.addView(imgs[i]);
Matrix m = new Matrix();
RectF src = new RectF(0, 0, bmps[i].getWidth(), bmps[i].getHeight());
RectF dst = new RectF(Globals.ScreenKbControlsLayout[i][0], Globals.ScreenKbControlsLayout[i][1],
Globals.ScreenKbControlsLayout[i][2], Globals.ScreenKbControlsLayout[i][3]);
m.setRectToRect(src, dst, Matrix.ScaleToFit.FILL);
imgs[i].setImageMatrix(m);
}
boundary.bringToFront();
if( currentButton == -1 )
onKey( null, KeyEvent.KEYCODE_BACK, null ); // All buttons disabled - do not show anything
else
setupButton(currentButton);
}
void setupButton(int i)
{
Matrix m = new Matrix();
RectF src = new RectF(0, 0, bmps[i].getWidth(), bmps[i].getHeight());
RectF dst = new RectF(Globals.ScreenKbControlsLayout[i][0], Globals.ScreenKbControlsLayout[i][1],
Globals.ScreenKbControlsLayout[i][2], Globals.ScreenKbControlsLayout[i][3]);
m.setRectToRect(src, dst, Matrix.ScaleToFit.FILL);
imgs[i].setImageMatrix(m);
m = new Matrix();
src = new RectF(0, 0, boundaryBmp.getWidth(), boundaryBmp.getHeight());
m.setRectToRect(src, dst, Matrix.ScaleToFit.FILL);
boundary.setImageMatrix(m);
String buttonText = "";
if( i >= 2 && i <= 7 )
buttonText = p.getResources().getString(R.string.remap_screenkb_button) + (i - 2);
if( i >= 2 && i - 2 < Globals.AppTouchscreenKeyboardKeysNames.length )
buttonText = Globals.AppTouchscreenKeyboardKeysNames[i - 2].replace("_", " ");
if( i == 0 )
buttonText = "Joystick";
if( i == 1 )
buttonText = "Text input";
if( i == 8 )
buttonText = "Joystick 2";
if( i == 9 )
buttonText = "Joystick 3";
p.setText(p.getResources().getString(R.string.screenkb_custom_layout_help) + "\n" + buttonText);
}
@Override
public boolean onTouch(View v, MotionEvent ev)
{
if( ev.getAction() == MotionEvent.ACTION_DOWN )
{
oldX = (int)ev.getX();
oldY = (int)ev.getY();
resizing = true;
for( int i = 0; i < Globals.ScreenKbControlsLayout.length; i++ )
{
if( ! Globals.ScreenKbControlsShown[i] )
continue;
if( Globals.ScreenKbControlsLayout[i][0] <= oldX &&
Globals.ScreenKbControlsLayout[i][2] >= oldX &&
Globals.ScreenKbControlsLayout[i][1] <= oldY &&
Globals.ScreenKbControlsLayout[i][3] >= oldY )
{
currentButton = i;
setupButton(currentButton);
resizing = false;
break;
}
}
}
if( ev.getAction() == MotionEvent.ACTION_MOVE )
{
int dx = (int)ev.getX() - oldX;
int dy = (int)ev.getY() - oldY;
if( resizing )
{
// Resize slowly, with 1/3 of movement speed
dx /= 6;
dy /= 6;
if( Globals.ScreenKbControlsLayout[currentButton][0] <= Globals.ScreenKbControlsLayout[currentButton][2] + dx*2 )
{
Globals.ScreenKbControlsLayout[currentButton][0] -= dx;
Globals.ScreenKbControlsLayout[currentButton][2] += dx;
}
if( Globals.ScreenKbControlsLayout[currentButton][1] <= Globals.ScreenKbControlsLayout[currentButton][3] + dy*2 )
{
Globals.ScreenKbControlsLayout[currentButton][1] += dy;
Globals.ScreenKbControlsLayout[currentButton][3] -= dy;
}
dx *= 6;
dy *= 6;
}
else
{
Globals.ScreenKbControlsLayout[currentButton][0] += dx;
Globals.ScreenKbControlsLayout[currentButton][2] += dx;
Globals.ScreenKbControlsLayout[currentButton][1] += dy;
Globals.ScreenKbControlsLayout[currentButton][3] += dy;
}
oldX += dx;
oldY += dy;
Matrix m = new Matrix();
RectF src = new RectF(0, 0, bmps[currentButton].getWidth(), bmps[currentButton].getHeight());
RectF dst = new RectF(Globals.ScreenKbControlsLayout[currentButton][0], Globals.ScreenKbControlsLayout[currentButton][1],
Globals.ScreenKbControlsLayout[currentButton][2], Globals.ScreenKbControlsLayout[currentButton][3]);
m.setRectToRect(src, dst, Matrix.ScaleToFit.FILL);
imgs[currentButton].setImageMatrix(m);
m = new Matrix();
src = new RectF(0, 0, boundaryBmp.getWidth(), boundaryBmp.getHeight());
m.setRectToRect(src, dst, Matrix.ScaleToFit.FILL);
boundary.setImageMatrix(m);
}
return true;
}
@Override
public boolean onKey(View v, int keyCode, KeyEvent event)
{
if( keyCode == KeyEvent.KEYCODE_BACK )
{
p.getVideoLayout().removeView(layout);
layout = null;
goBack(p);
}
return true;
}
}
}
static class ScreenKeyboardAdvanced extends Menu
{
String title(final MainActivity p)
{
return p.getResources().getString(R.string.advanced);
}
//boolean enabled() { return true; };
void run (final MainActivity p)
{
CharSequence[] items = {
p.getResources().getString(R.string.screenkb_floating_joystick),
};
boolean defaults[] = {
Globals.FloatingScreenJoystick,
};
AlertDialog.Builder builder = new AlertDialog.Builder(p);
builder.setTitle(p.getResources().getString(R.string.advanced));
builder.setMultiChoiceItems(items, defaults, new DialogInterface.OnMultiChoiceClickListener()
{
public void onClick(DialogInterface dialog, int item, boolean isChecked)
{
if( item == 0 )
Globals.FloatingScreenJoystick = isChecked;
}
});
builder.setPositiveButton(p.getResources().getString(R.string.ok), new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int item)
{
dialog.dismiss();
goBack(p);
}
});
builder.setOnCancelListener(new DialogInterface.OnCancelListener()
{
public void onCancel(DialogInterface dialog)
{
goBack(p);
}
});
AlertDialog alert = builder.create();
alert.setOwnerActivity(p);
alert.show();
}
}
}

View File

@ -0,0 +1,648 @@
// DO NOT EDIT THIS FILE - it is automatically generated, ALL YOUR CHANGES WILL BE OVERWRITTEN, edit the file under $JAVA_SRC_PATH dir
/*
Simple DirectMedia Layer
Java source code (C) 2009-2014 Sergii Pylypenko
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
package io.neoterm;
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.KeyEvent;
import android.view.Window;
import android.view.WindowManager;
import android.widget.TextView;
import android.util.Log;
import java.io.*;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.os.Environment;
import android.os.StatFs;
import java.util.Locale;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.zip.GZIPInputStream;
import java.util.Collections;
import android.content.Context;
import android.content.res.Configuration;
import android.content.res.Resources;
import java.lang.String;
import android.graphics.Matrix;
import android.graphics.RectF;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.FrameLayout;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.BitmapFactory;
import android.graphics.Bitmap;
import android.widget.TextView;
import android.widget.EditText;
import android.widget.ScrollView;
import android.widget.Button;
import android.widget.Scroller;
import android.view.View;
import android.view.Gravity;
import android.widget.LinearLayout;
import android.text.Editable;
import android.text.SpannedString;
import android.content.Intent;
import android.app.PendingIntent;
import android.app.AlarmManager;
import android.util.DisplayMetrics;
import android.net.Uri;
import java.util.concurrent.Semaphore;
import java.util.Arrays;
import android.graphics.Color;
import android.hardware.SensorEventListener;
import android.hardware.SensorEvent;
import android.hardware.Sensor;
import android.widget.Toast;
import android.text.InputType;
class SettingsMenuMisc extends SettingsMenu
{
static class DownloadConfig extends Menu
{
String title(final MainActivity p)
{
return p.getResources().getString(R.string.storage_question);
}
void run (final MainActivity p)
{
long freeSdcard = 0;
long freePhone = 0;
try
{
StatFs phone = new StatFs(p.getFilesDir().getAbsolutePath());
freePhone = (long)phone.getAvailableBlocks() * phone.getBlockSize() / 1024 / 1024;
StatFs sdcard = new StatFs(Settings.SdcardAppPath.get().bestPath(p));
freeSdcard = (long)sdcard.getAvailableBlocks() * sdcard.getBlockSize() / 1024 / 1024;
}
catch(Exception e) {}
final CharSequence[] items = { p.getResources().getString(R.string.storage_phone, freePhone),
p.getResources().getString(R.string.storage_sd, freeSdcard),
p.getResources().getString(R.string.storage_custom) };
AlertDialog.Builder builder = new AlertDialog.Builder(p);
builder.setTitle(p.getResources().getString(R.string.storage_question));
builder.setSingleChoiceItems(items, Globals.DownloadToSdcard ? 1 : 0, new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int item)
{
dialog.dismiss();
if( item == 2 )
showCustomDownloadDirConfig(p);
else
{
Globals.DownloadToSdcard = (item != 0);
Globals.DataDir = Globals.DownloadToSdcard ?
Settings.SdcardAppPath.get().bestPath(p) :
p.getFilesDir().getAbsolutePath();
goBack(p);
}
}
});
builder.setOnCancelListener(new DialogInterface.OnCancelListener()
{
public void onCancel(DialogInterface dialog)
{
goBack(p);
}
});
AlertDialog alert = builder.create();
alert.setOwnerActivity(p);
alert.show();
}
static void showCustomDownloadDirConfig(final MainActivity p)
{
AlertDialog.Builder builder = new AlertDialog.Builder(p);
builder.setTitle(p.getResources().getString(R.string.storage_custom));
final EditText edit = new EditText(p);
edit.setFocusableInTouchMode(true);
edit.setFocusable(true);
edit.setText(Globals.DataDir);
builder.setView(edit);
builder.setPositiveButton(p.getResources().getString(R.string.ok), new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int item)
{
Globals.DataDir = edit.getText().toString();
dialog.dismiss();
goBack(p);
}
});
builder.setOnCancelListener(new DialogInterface.OnCancelListener()
{
public void onCancel(DialogInterface dialog)
{
goBack(p);
}
});
AlertDialog alert = builder.create();
alert.setOwnerActivity(p);
alert.show();
}
}
static class OptionalDownloadConfig extends Menu
{
boolean firstStart = false;
OptionalDownloadConfig()
{
firstStart = true;
}
OptionalDownloadConfig(boolean firstStart)
{
this.firstStart = firstStart;
}
String title(final MainActivity p)
{
return p.getResources().getString(R.string.downloads);
}
void run (final MainActivity p)
{
String [] downloadFiles = Globals.DataDownloadUrl;
AlertDialog.Builder builder = new AlertDialog.Builder(p);
builder.setTitle(p.getResources().getString(R.string.downloads));
final int itemsIdx[] = new int[downloadFiles.length];
ArrayList<CharSequence> items = new ArrayList<CharSequence>();
ArrayList<Boolean> enabledItems = new ArrayList<Boolean>();
for(int i = 0; i < downloadFiles.length; i++ )
{
String item = new String(downloadFiles[i].split("[|]")[0]);
boolean enabled = false;
if( item.toString().indexOf("!") == 0 )
{
item = item.toString().substring(1);
enabled = true;
}
if( item.toString().indexOf("!") == 0 ) // Download is mandatory
continue;
itemsIdx[items.size()] = i;
items.add(item);
enabledItems.add(enabled);
}
if( Globals.OptionalDataDownload == null || Globals.OptionalDataDownload.length != downloadFiles.length )
{
Globals.OptionalDataDownload = new boolean[downloadFiles.length];
boolean oldFormat = true;
for( int i = 0; i < downloadFiles.length; i++ )
{
if( downloadFiles[i].indexOf("!") == 0 )
{
Globals.OptionalDataDownload[i] = true;
oldFormat = false;
}
}
if( oldFormat )
Globals.OptionalDataDownload[0] = true;
}
if( enabledItems.size() <= 0 )
{
goBack(p);
return;
}
// Convert Boolean[] to boolean[], meh
boolean[] enabledItems2 = new boolean[enabledItems.size()];
for( int i = 0; i < enabledItems.size(); i++ )
enabledItems2[i] = enabledItems.get(i);
builder.setMultiChoiceItems(items.toArray(new CharSequence[0]), enabledItems2, new DialogInterface.OnMultiChoiceClickListener()
{
public void onClick(DialogInterface dialog, int item, boolean isChecked)
{
Globals.OptionalDataDownload[itemsIdx[item]] = isChecked;
}
});
builder.setPositiveButton(p.getResources().getString(R.string.ok), new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int item)
{
dialog.dismiss();
goBack(p);
}
});
if( firstStart )
{
builder.setNegativeButton(p.getResources().getString(R.string.show_more_options), new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int item)
{
dialog.dismiss();
menuStack.clear();
new MainMenu().run(p);
}
});
}
builder.setOnCancelListener(new DialogInterface.OnCancelListener()
{
public void onCancel(DialogInterface dialog)
{
goBack(p);
}
});
AlertDialog alert = builder.create();
alert.setOwnerActivity(p);
alert.show();
}
}
static class AudioConfig extends Menu
{
String title(final MainActivity p)
{
return p.getResources().getString(R.string.audiobuf_question);
}
void run (final MainActivity p)
{
final CharSequence[] items = { p.getResources().getString(R.string.audiobuf_verysmall),
p.getResources().getString(R.string.audiobuf_small),
p.getResources().getString(R.string.audiobuf_medium),
p.getResources().getString(R.string.audiobuf_large) };
AlertDialog.Builder builder = new AlertDialog.Builder(p);
builder.setTitle(R.string.audiobuf_question);
builder.setSingleChoiceItems(items, Globals.AudioBufferConfig, new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int item)
{
Globals.AudioBufferConfig = item;
dialog.dismiss();
goBack(p);
}
});
builder.setOnCancelListener(new DialogInterface.OnCancelListener()
{
public void onCancel(DialogInterface dialog)
{
goBack(p);
}
});
AlertDialog alert = builder.create();
alert.setOwnerActivity(p);
alert.show();
}
}
static class VideoSettingsConfig extends Menu
{
static int debugMenuShowCount = 0;
String title(final MainActivity p)
{
return p.getResources().getString(R.string.video);
}
//boolean enabled() { return true; };
void run (final MainActivity p)
{
debugMenuShowCount++;
CharSequence[] items = {
p.getResources().getString(R.string.mouse_keepaspectratio),
p.getResources().getString(R.string.video_smooth),
p.getResources().getString(R.string.video_immersive),
p.getResources().getString(R.string.video_orientation_autodetect),
p.getResources().getString(R.string.video_orientation_vertical),
p.getResources().getString(R.string.video_bpp_24),
p.getResources().getString(R.string.tv_borders),
};
boolean defaults[] = {
Globals.KeepAspectRatio,
Globals.VideoLinearFilter,
Globals.ImmersiveMode,
Globals.AutoDetectOrientation,
!Globals.HorizontalOrientation,
Globals.VideoDepthBpp == 24,
Globals.TvBorders,
};
if(Globals.SwVideoMode && !Globals.CompatibilityHacksVideo)
{
CharSequence[] items2 = {
p.getResources().getString(R.string.mouse_keepaspectratio),
p.getResources().getString(R.string.video_smooth),
p.getResources().getString(R.string.video_immersive),
p.getResources().getString(R.string.video_orientation_autodetect),
p.getResources().getString(R.string.video_orientation_vertical),
p.getResources().getString(R.string.video_bpp_24),
p.getResources().getString(R.string.tv_borders),
p.getResources().getString(R.string.video_separatethread),
};
boolean defaults2[] = {
Globals.KeepAspectRatio,
Globals.VideoLinearFilter,
Globals.ImmersiveMode,
Globals.AutoDetectOrientation,
!Globals.HorizontalOrientation,
Globals.VideoDepthBpp == 24,
Globals.TvBorders,
Globals.MultiThreadedVideo,
};
items = items2;
defaults = defaults2;
}
if(Globals.Using_SDL_1_3)
{
CharSequence[] items2 = {
p.getResources().getString(R.string.mouse_keepaspectratio),
};
boolean defaults2[] = {
Globals.KeepAspectRatio,
};
items = items2;
defaults = defaults2;
}
AlertDialog.Builder builder = new AlertDialog.Builder(p);
builder.setTitle(p.getResources().getString(R.string.video));
builder.setMultiChoiceItems(items, defaults, new DialogInterface.OnMultiChoiceClickListener()
{
public void onClick(DialogInterface dialog, int item, boolean isChecked)
{
if( item == 0 )
Globals.KeepAspectRatio = isChecked;
if( item == 1 )
Globals.VideoLinearFilter = isChecked;
if( item == 2 )
Globals.ImmersiveMode = isChecked;
if( item == 3 )
Globals.AutoDetectOrientation = isChecked;
if( item == 4 )
Globals.HorizontalOrientation = !isChecked;
if( item == 5 )
Globals.VideoDepthBpp = (isChecked ? 24 : 16);
if( item == 6 )
Globals.TvBorders = isChecked;
if( item == 7 )
Globals.MultiThreadedVideo = isChecked;
}
});
builder.setPositiveButton(p.getResources().getString(R.string.ok), new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int item)
{
dialog.dismiss();
goBack(p);
}
});
builder.setOnCancelListener(new DialogInterface.OnCancelListener()
{
public void onCancel(DialogInterface dialog)
{
goBack(p);
}
});
AlertDialog alert = builder.create();
alert.setOwnerActivity(p);
alert.show();
}
}
static class ShowReadme extends Menu
{
String title(final MainActivity p)
{
return "Readme";
}
boolean enabled()
{
return true;
}
void run (final MainActivity p)
{
String readmes[] = Globals.ReadmeText.split("\\^");
String lang = new String(Locale.getDefault().getLanguage()) + ":";
if( p.isRunningOnOUYA() )
lang = "tv:";
String readme = readmes[0];
String buttonName = "", buttonUrl = "";
for( String r: readmes )
{
if( r.startsWith(lang) )
readme = r.substring(lang.length());
if( r.startsWith("button:") )
{
buttonName = r.substring("button:".length());
if( buttonName.indexOf(":") != -1 )
{
buttonUrl = buttonName.substring(buttonName.indexOf(":") + 1);
buttonName = buttonName.substring(0, buttonName.indexOf(":"));
}
}
}
readme = readme.trim();
if( readme.length() <= 2 )
{
goBack(p);
return;
}
TextView text = new TextView(p);
text.setMaxLines(100);
//text.setScroller(new Scroller(p));
//text.setVerticalScrollBarEnabled(true);
text.setText(readme);
text.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
text.setPadding(0, 5, 0, 20);
text.setTextSize(20.0f);
text.setGravity(Gravity.CENTER);
text.setFocusable(false);
text.setFocusableInTouchMode(false);
AlertDialog.Builder builder = new AlertDialog.Builder(p);
ScrollView scroll = new ScrollView(p);
scroll.setFocusable(false);
scroll.setFocusableInTouchMode(false);
scroll.addView(text, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
final Button ok = new Button(p);
final AlertDialog alertDismiss[] = new AlertDialog[1];
ok.setOnClickListener(new View.OnClickListener()
{
public void onClick(View v)
{
alertDismiss[0].cancel();
}
});
ok.setText(R.string.ok);
LinearLayout layout = new LinearLayout(p);
layout.setOrientation(LinearLayout.VERTICAL);
layout.addView(scroll);
layout.addView(ok);
if( buttonName.length() > 0 )
{
Button cancel = new Button(p);
cancel.setText(buttonName);
final String url = buttonUrl;
cancel.setOnClickListener(new View.OnClickListener()
{
public void onClick(View v)
{
if( url.length() > 0 )
{
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(url));
p.startActivity(i);
}
alertDismiss[0].cancel();
System.exit(0);
}
});
layout.addView(cancel);
}
builder.setView(layout);
builder.setOnCancelListener(new DialogInterface.OnCancelListener()
{
public void onCancel(DialogInterface dialog)
{
goBack(p);
}
});
AlertDialog alert = builder.create();
alertDismiss[0] = alert;
alert.setOwnerActivity(p);
alert.show();
}
}
static class GyroscopeCalibration extends Menu
{
String title(final MainActivity p)
{
return "";
}
boolean enabled()
{
return false;
}
void run (final MainActivity p)
{
goBack(p);
}
}
static class CommandlineConfig extends Menu
{
String title(final MainActivity p)
{
return p.getResources().getString(R.string.storage_commandline);
}
void run (final MainActivity p)
{
AlertDialog.Builder builder = new AlertDialog.Builder(p);
builder.setTitle(p.getResources().getString(R.string.storage_commandline));
final EditText edit = new EditText(p);
edit.setFocusableInTouchMode(true);
edit.setFocusable(true);
if (Globals.CommandLine.length() == 0)
Globals.CommandLine = "SDL_app";
if (Globals.CommandLine.indexOf(" ") == -1)
Globals.CommandLine += " ";
edit.setText(Globals.CommandLine.substring(Globals.CommandLine.indexOf(" ")).replace(" ", "\n").replace(" ", " "));
edit.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_MULTI_LINE | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
edit.setMinLines(2);
//edit.setMaxLines(100);
builder.setView(edit);
builder.setPositiveButton(p.getResources().getString(R.string.ok), new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int item)
{
Globals.CommandLine = "SDL_app";
String args[] = edit.getText().toString().split("\n");
boolean firstArg = true;
for( String arg: args )
{
Globals.CommandLine += " ";
if( firstArg )
Globals.CommandLine += arg;
else
Globals.CommandLine += arg.replace(" ", " ");
firstArg = false;
}
dialog.dismiss();
goBack(p);
}
});
builder.setOnCancelListener(new DialogInterface.OnCancelListener()
{
public void onCancel(DialogInterface dialog)
{
goBack(p);
}
});
AlertDialog alert = builder.create();
alert.setOwnerActivity(p);
alert.show();
}
}
static class ResetToDefaultsConfig extends Menu
{
String title(final MainActivity p)
{
return p.getResources().getString(R.string.reset_config);
}
boolean enabled()
{
return true;
}
void run (final MainActivity p)
{
AlertDialog.Builder builder = new AlertDialog.Builder(p);
builder.setTitle(p.getResources().getString(R.string.reset_config_ask));
builder.setMessage(p.getResources().getString(R.string.reset_config_ask));
builder.setPositiveButton(p.getResources().getString(R.string.ok), new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int item)
{
Settings.DeleteSdlConfigOnUpgradeAndRestart(p); // Never returns
dialog.dismiss();
goBack(p);
}
});
builder.setNegativeButton(p.getResources().getString(R.string.cancel), new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int item)
{
dialog.dismiss();
goBack(p);
}
});
builder.setOnCancelListener(new DialogInterface.OnCancelListener()
{
public void onCancel(DialogInterface dialog)
{
goBack(p);
}
});
AlertDialog alert = builder.create();
alert.setOwnerActivity(p);
alert.show();
}
}
}

View File

@ -0,0 +1,832 @@
// DO NOT EDIT THIS FILE - it is automatically generated, ALL YOUR CHANGES WILL BE OVERWRITTEN, edit the file under $JAVA_SRC_PATH dir
/*
Simple DirectMedia Layer
Java source code (C) 2009-2014 Sergii Pylypenko
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
package io.neoterm;
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.KeyEvent;
import android.view.Window;
import android.view.WindowManager;
import android.widget.TextView;
import android.util.Log;
import java.io.*;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.os.Environment;
import android.os.StatFs;
import java.util.Locale;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.zip.GZIPInputStream;
import java.util.Collections;
import android.content.Context;
import android.content.res.Configuration;
import android.content.res.Resources;
import java.lang.String;
import android.graphics.Matrix;
import android.graphics.RectF;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.FrameLayout;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.BitmapFactory;
import android.graphics.Bitmap;
import android.widget.TextView;
import android.widget.EditText;
import android.widget.ScrollView;
import android.widget.Button;
import android.view.View;
import android.widget.LinearLayout;
import android.text.Editable;
import android.text.SpannedString;
import android.content.Intent;
import android.app.PendingIntent;
import android.app.AlarmManager;
import android.util.DisplayMetrics;
import android.net.Uri;
import java.util.concurrent.Semaphore;
import java.util.Arrays;
import android.graphics.Color;
import android.hardware.SensorEventListener;
import android.hardware.SensorEvent;
import android.hardware.Sensor;
import android.widget.Toast;
class SettingsMenuMouse extends SettingsMenu
{
static class MouseConfigMainMenu extends Menu
{
String title(final MainActivity p)
{
return p.getResources().getString(R.string.mouse_emulation);
}
boolean enabled()
{
return Globals.AppUsesMouse;
}
void run (final MainActivity p)
{
Menu options[] =
{
new DisplaySizeConfig(false),
new LeftClickConfig(),
new RightClickConfig(),
new AdditionalMouseConfig(),
new JoystickMouseConfig(),
new TouchPressureMeasurementTool(),
new CalibrateTouchscreenMenu(),
new OkButton(),
};
showMenuOptionsList(p, options);
}
}
static class DisplaySizeConfig extends Menu
{
boolean firstStart = false;
DisplaySizeConfig()
{
this.firstStart = true;
}
DisplaySizeConfig(boolean firstStart)
{
this.firstStart = firstStart;
}
String title(final MainActivity p)
{
return p.getResources().getString(R.string.display_size_mouse);
}
void run (final MainActivity p)
{
CharSequence[] items = {
p.getResources().getString(R.string.display_size_small),
p.getResources().getString(R.string.display_size_small_touchpad),
p.getResources().getString(R.string.display_size_large),
p.getResources().getString(R.string.display_size_desktop),
};
int _size_small = 0;
int _size_small_touchpad = 1;
int _size_large = 2;
int _size_desktop = 3;
int _more_options = 4;
if( ! Globals.SwVideoMode )
{
CharSequence[] items2 = {
p.getResources().getString(R.string.display_size_small_touchpad),
p.getResources().getString(R.string.display_size_large),
p.getResources().getString(R.string.display_size_desktop),
};
items = items2;
_size_small_touchpad = 0;
_size_large = 1;
_size_desktop = 2;
_size_small = 1000;
}
if( firstStart )
{
CharSequence[] items2 = {
p.getResources().getString(R.string.display_size_small),
p.getResources().getString(R.string.display_size_small_touchpad),
p.getResources().getString(R.string.display_size_large),
p.getResources().getString(R.string.display_size_desktop),
p.getResources().getString(R.string.show_more_options),
};
items = items2;
if( ! Globals.SwVideoMode )
{
CharSequence[] items3 = {
p.getResources().getString(R.string.display_size_small_touchpad),
p.getResources().getString(R.string.display_size_large),
p.getResources().getString(R.string.display_size_desktop),
p.getResources().getString(R.string.show_more_options),
};
items = items3;
_more_options = 3;
}
}
// Java is so damn worse than C++11
final int size_small = _size_small;
final int size_small_touchpad = _size_small_touchpad;
final int size_large = _size_large;
final int size_desktop = _size_desktop;
final int more_options = _more_options;
AlertDialog.Builder builder = new AlertDialog.Builder(p);
builder.setTitle(R.string.display_size);
class ClickListener implements DialogInterface.OnClickListener
{
public void onClick(DialogInterface dialog, int item)
{
dialog.dismiss();
if( item == size_desktop )
{
Globals.LeftClickMethod = Mouse.LEFT_CLICK_NORMAL;
Globals.RelativeMouseMovement = false;
Globals.ShowScreenUnderFinger = Mouse.ZOOM_NONE;
Globals.ForceHardwareMouse = true;
}
if( item == size_large )
{
Globals.LeftClickMethod = Mouse.LEFT_CLICK_NORMAL;
Globals.RelativeMouseMovement = false;
Globals.ShowScreenUnderFinger = Mouse.ZOOM_NONE;
Globals.ForceHardwareMouse = false;
}
if( item == size_small )
{
Globals.LeftClickMethod = Mouse.LEFT_CLICK_NEAR_CURSOR;
Globals.RelativeMouseMovement = false;
Globals.ShowScreenUnderFinger = Mouse.ZOOM_MAGNIFIER;
Globals.ForceHardwareMouse = false;
}
if( item == size_small_touchpad )
{
Globals.LeftClickMethod = Mouse.LEFT_CLICK_WITH_TAP_OR_TIMEOUT;
Globals.RelativeMouseMovement = true;
Globals.ShowScreenUnderFinger = Mouse.ZOOM_NONE;
Globals.ForceHardwareMouse = false;
}
if( item == more_options )
{
menuStack.clear();
new MainMenu().run(p);
return;
}
goBack(p);
}
}
builder.setItems(items, new ClickListener());
/*
else
builder.setSingleChoiceItems(items,
Globals.ShowScreenUnderFinger == Mouse.ZOOM_NONE ?
( Globals.RelativeMouseMovement ? Globals.SwVideoMode ? 2 : 1 : 0 ) :
( Globals.ShowScreenUnderFinger == Mouse.ZOOM_MAGNIFIER && Globals.SwVideoMode ) ? 1 :
Globals.ShowScreenUnderFinger + 1,
new ClickListener());
*/
builder.setOnCancelListener(new DialogInterface.OnCancelListener()
{
public void onCancel(DialogInterface dialog)
{
goBack(p);
}
});
AlertDialog alert = builder.create();
alert.setOwnerActivity(p);
alert.show();
}
}
static class LeftClickConfig extends Menu
{
String title(final MainActivity p)
{
return p.getResources().getString(R.string.leftclick_question);
}
void run (final MainActivity p)
{
final CharSequence[] items = { p.getResources().getString(R.string.leftclick_normal),
p.getResources().getString(R.string.leftclick_near_cursor),
p.getResources().getString(R.string.leftclick_multitouch),
p.getResources().getString(R.string.leftclick_pressure),
p.getResources().getString(R.string.rightclick_key),
p.getResources().getString(R.string.leftclick_timeout),
p.getResources().getString(R.string.leftclick_tap),
p.getResources().getString(R.string.leftclick_tap_or_timeout) };
AlertDialog.Builder builder = new AlertDialog.Builder(p);
builder.setTitle(R.string.leftclick_question);
builder.setSingleChoiceItems(items, Globals.LeftClickMethod, new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int item)
{
dialog.dismiss();
Globals.LeftClickMethod = item;
if( item == Mouse.LEFT_CLICK_WITH_KEY )
p.getVideoLayout().setOnKeyListener(new KeyRemapToolMouseClick(p, true));
else if( item == Mouse.LEFT_CLICK_WITH_TIMEOUT || item == Mouse.LEFT_CLICK_WITH_TAP_OR_TIMEOUT )
showLeftClickTimeoutConfig(p);
else
goBack(p);
}
});
builder.setOnCancelListener(new DialogInterface.OnCancelListener()
{
public void onCancel(DialogInterface dialog)
{
goBack(p);
}
});
AlertDialog alert = builder.create();
alert.setOwnerActivity(p);
alert.show();
}
static void showLeftClickTimeoutConfig(final MainActivity p) {
final CharSequence[] items = { p.getResources().getString(R.string.leftclick_timeout_time_0),
p.getResources().getString(R.string.leftclick_timeout_time_1),
p.getResources().getString(R.string.leftclick_timeout_time_2),
p.getResources().getString(R.string.leftclick_timeout_time_3),
p.getResources().getString(R.string.leftclick_timeout_time_4) };
AlertDialog.Builder builder = new AlertDialog.Builder(p);
builder.setTitle(R.string.leftclick_timeout_time);
builder.setSingleChoiceItems(items, Globals.LeftClickTimeout, new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int item)
{
Globals.LeftClickTimeout = item;
dialog.dismiss();
goBack(p);
}
});
builder.setOnCancelListener(new DialogInterface.OnCancelListener()
{
public void onCancel(DialogInterface dialog)
{
goBack(p);
}
});
AlertDialog alert = builder.create();
alert.setOwnerActivity(p);
alert.show();
}
}
static class RightClickConfig extends Menu
{
String title(final MainActivity p)
{
return p.getResources().getString(R.string.rightclick_question);
}
boolean enabled()
{
return Globals.AppNeedsTwoButtonMouse;
}
void run (final MainActivity p)
{
final CharSequence[] items = { p.getResources().getString(R.string.rightclick_none),
p.getResources().getString(R.string.rightclick_multitouch),
p.getResources().getString(R.string.rightclick_pressure),
p.getResources().getString(R.string.rightclick_key),
p.getResources().getString(R.string.leftclick_timeout) };
AlertDialog.Builder builder = new AlertDialog.Builder(p);
builder.setTitle(R.string.rightclick_question);
builder.setSingleChoiceItems(items, Globals.RightClickMethod, new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int item)
{
Globals.RightClickMethod = item;
dialog.dismiss();
if( item == Mouse.RIGHT_CLICK_WITH_KEY )
p.getVideoLayout().setOnKeyListener(new KeyRemapToolMouseClick(p, false));
else if( item == Mouse.RIGHT_CLICK_WITH_TIMEOUT )
showRightClickTimeoutConfig(p);
else
goBack(p);
}
});
builder.setOnCancelListener(new DialogInterface.OnCancelListener()
{
public void onCancel(DialogInterface dialog)
{
goBack(p);
}
});
AlertDialog alert = builder.create();
alert.setOwnerActivity(p);
alert.show();
}
static void showRightClickTimeoutConfig(final MainActivity p) {
final CharSequence[] items = { p.getResources().getString(R.string.leftclick_timeout_time_0),
p.getResources().getString(R.string.leftclick_timeout_time_1),
p.getResources().getString(R.string.leftclick_timeout_time_2),
p.getResources().getString(R.string.leftclick_timeout_time_3),
p.getResources().getString(R.string.leftclick_timeout_time_4) };
AlertDialog.Builder builder = new AlertDialog.Builder(p);
builder.setTitle(R.string.leftclick_timeout_time);
builder.setSingleChoiceItems(items, Globals.RightClickTimeout, new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int item)
{
Globals.RightClickTimeout = item;
dialog.dismiss();
goBack(p);
}
});
builder.setOnCancelListener(new DialogInterface.OnCancelListener()
{
public void onCancel(DialogInterface dialog)
{
goBack(p);
}
});
AlertDialog alert = builder.create();
alert.setOwnerActivity(p);
alert.show();
}
}
public static class KeyRemapToolMouseClick implements View.OnKeyListener
{
MainActivity p;
boolean leftClick;
public KeyRemapToolMouseClick(MainActivity _p, boolean leftClick)
{
p = _p;
p.setText(p.getResources().getString(R.string.remap_hwkeys_press));
this.leftClick = leftClick;
}
@Override
public boolean onKey(View v, int keyCode, KeyEvent event)
{
p.getVideoLayout().setOnKeyListener(null);
int keyIndex = keyCode;
if( keyIndex < 0 )
keyIndex = 0;
if( keyIndex > SDL_Keys.JAVA_KEYCODE_LAST )
keyIndex = 0;
if( leftClick )
Globals.LeftClickKey = keyIndex;
else
Globals.RightClickKey = keyIndex;
goBack(p);
return true;
}
}
static class AdditionalMouseConfig extends Menu
{
String title(final MainActivity p)
{
return p.getResources().getString(R.string.advanced);
}
void run (final MainActivity p)
{
CharSequence[] items = {
p.getResources().getString(R.string.mouse_hover_jitter_filter),
p.getResources().getString(R.string.mouse_joystickmouse),
p.getResources().getString(R.string.click_with_dpadcenter),
p.getResources().getString(R.string.mouse_relative),
p.getResources().getString(R.string.mouse_gyroscope_mouse),
p.getResources().getString(R.string.mouse_finger_hover),
p.getResources().getString(R.string.mouse_subframe_touch_events),
};
boolean defaults[] = {
Globals.HoverJitterFilter,
Globals.MoveMouseWithJoystick,
Globals.ClickMouseWithDpad,
Globals.RelativeMouseMovement,
Globals.MoveMouseWithGyroscope,
Globals.FingerHover,
Globals.GenerateSubframeTouchEvents,
};
AlertDialog.Builder builder = new AlertDialog.Builder(p);
builder.setTitle(p.getResources().getString(R.string.advanced));
builder.setMultiChoiceItems(items, defaults, new DialogInterface.OnMultiChoiceClickListener()
{
public void onClick(DialogInterface dialog, int item, boolean isChecked)
{
if( item == 0 )
Globals.HoverJitterFilter = isChecked;
if( item == 1 )
Globals.MoveMouseWithJoystick = isChecked;
if( item == 2 )
Globals.ClickMouseWithDpad = isChecked;
if( item == 3 )
Globals.RelativeMouseMovement = isChecked;
if( item == 4 )
Globals.MoveMouseWithGyroscope = isChecked;
if( item == 5 )
Globals.FingerHover = isChecked;
if( item == 6 )
Globals.GenerateSubframeTouchEvents = isChecked;
}
});
builder.setPositiveButton(p.getResources().getString(R.string.ok), new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int item)
{
dialog.dismiss();
showGyroscopeMouseMovementConfig(p);
}
});
builder.setOnCancelListener(new DialogInterface.OnCancelListener()
{
public void onCancel(DialogInterface dialog)
{
goBack(p);
}
});
AlertDialog alert = builder.create();
alert.setOwnerActivity(p);
alert.show();
}
static void showGyroscopeMouseMovementConfig(final MainActivity p)
{
if( !Globals.MoveMouseWithGyroscope )
{
showRelativeMouseMovementConfig(p);
return;
}
final CharSequence[] items = { p.getResources().getString(R.string.accel_veryslow),
p.getResources().getString(R.string.accel_slow),
p.getResources().getString(R.string.accel_medium),
p.getResources().getString(R.string.accel_fast),
p.getResources().getString(R.string.accel_veryfast) };
AlertDialog.Builder builder = new AlertDialog.Builder(p);
builder.setTitle(R.string.mouse_gyroscope_mouse_sensitivity);
builder.setSingleChoiceItems(items, Globals.MoveMouseWithGyroscopeSpeed, new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int item)
{
Globals.MoveMouseWithGyroscopeSpeed = item;
dialog.dismiss();
showRelativeMouseMovementConfig(p);
}
});
builder.setOnCancelListener(new DialogInterface.OnCancelListener()
{
public void onCancel(DialogInterface dialog)
{
goBack(p);
}
});
AlertDialog alert = builder.create();
alert.setOwnerActivity(p);
alert.show();
}
static void showRelativeMouseMovementConfig(final MainActivity p)
{
if( !Globals.RelativeMouseMovement )
{
goBack(p);
return;
}
final CharSequence[] items = { p.getResources().getString(R.string.accel_veryslow),
p.getResources().getString(R.string.accel_slow),
p.getResources().getString(R.string.accel_medium),
p.getResources().getString(R.string.accel_fast),
p.getResources().getString(R.string.accel_veryfast) };
AlertDialog.Builder builder = new AlertDialog.Builder(p);
builder.setTitle(R.string.mouse_relative_speed);
builder.setSingleChoiceItems(items, Globals.RelativeMouseMovementSpeed, new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int item)
{
Globals.RelativeMouseMovementSpeed = item;
dialog.dismiss();
showRelativeMouseMovementConfig1(p);
}
});
builder.setOnCancelListener(new DialogInterface.OnCancelListener()
{
public void onCancel(DialogInterface dialog)
{
goBack(p);
}
});
AlertDialog alert = builder.create();
alert.setOwnerActivity(p);
alert.show();
}
static void showRelativeMouseMovementConfig1(final MainActivity p)
{
final CharSequence[] items = { p.getResources().getString(R.string.none),
p.getResources().getString(R.string.accel_slow),
p.getResources().getString(R.string.accel_medium),
p.getResources().getString(R.string.accel_fast) };
AlertDialog.Builder builder = new AlertDialog.Builder(p);
builder.setTitle(R.string.mouse_relative_accel);
builder.setSingleChoiceItems(items, Globals.RelativeMouseMovementAccel, new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int item)
{
Globals.RelativeMouseMovementAccel = item;
dialog.dismiss();
goBack(p);
}
});
builder.setOnCancelListener(new DialogInterface.OnCancelListener()
{
public void onCancel(DialogInterface dialog)
{
goBack(p);
}
});
AlertDialog alert = builder.create();
alert.setOwnerActivity(p);
alert.show();
}
}
static class JoystickMouseConfig extends Menu
{
String title(final MainActivity p)
{
return p.getResources().getString(R.string.mouse_joystickmousespeed);
}
boolean enabled()
{
return Globals.MoveMouseWithJoystick;
};
void run (final MainActivity p)
{
final CharSequence[] items = { p.getResources().getString(R.string.accel_slow),
p.getResources().getString(R.string.accel_medium),
p.getResources().getString(R.string.accel_fast) };
AlertDialog.Builder builder = new AlertDialog.Builder(p);
builder.setTitle(R.string.mouse_joystickmousespeed);
builder.setSingleChoiceItems(items, Globals.MoveMouseWithJoystickSpeed, new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int item)
{
Globals.MoveMouseWithJoystickSpeed = item;
dialog.dismiss();
showJoystickMouseAccelConfig(p);
}
});
builder.setOnCancelListener(new DialogInterface.OnCancelListener()
{
public void onCancel(DialogInterface dialog)
{
goBack(p);
}
});
AlertDialog alert = builder.create();
alert.setOwnerActivity(p);
alert.show();
}
static void showJoystickMouseAccelConfig(final MainActivity p)
{
final CharSequence[] items = { p.getResources().getString(R.string.none),
p.getResources().getString(R.string.accel_slow),
p.getResources().getString(R.string.accel_medium),
p.getResources().getString(R.string.accel_fast) };
AlertDialog.Builder builder = new AlertDialog.Builder(p);
builder.setTitle(R.string.mouse_joystickmouseaccel);
builder.setSingleChoiceItems(items, Globals.MoveMouseWithJoystickAccel, new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int item)
{
Globals.MoveMouseWithJoystickAccel = item;
dialog.dismiss();
goBack(p);
}
});
builder.setOnCancelListener(new DialogInterface.OnCancelListener()
{
public void onCancel(DialogInterface dialog)
{
goBack(p);
}
});
AlertDialog alert = builder.create();
alert.setOwnerActivity(p);
alert.show();
}
}
static class TouchPressureMeasurementTool extends Menu
{
String title(final MainActivity p)
{
return p.getResources().getString(R.string.measurepressure);
}
boolean enabled()
{
return Globals.RightClickMethod == Mouse.RIGHT_CLICK_WITH_PRESSURE ||
Globals.LeftClickMethod == Mouse.LEFT_CLICK_WITH_PRESSURE;
};
void run (final MainActivity p)
{
p.setText(p.getResources().getString(R.string.measurepressure_touchplease));
p.getVideoLayout().setOnTouchListener(new TouchMeasurementTool(p));
}
public static class TouchMeasurementTool implements View.OnTouchListener
{
MainActivity p;
ArrayList<Integer> force = new ArrayList<Integer>();
ArrayList<Integer> radius = new ArrayList<Integer>();
static final int maxEventAmount = 100;
public TouchMeasurementTool(MainActivity _p)
{
p = _p;
}
@Override
public boolean onTouch(View v, MotionEvent ev)
{
force.add(new Integer((int)(ev.getPressure() * 1000.0)));
radius.add(new Integer((int)(ev.getSize() * 1000.0)));
p.setText(p.getResources().getString(R.string.measurepressure_response, force.get(force.size()-1), radius.get(radius.size()-1)));
try {
Thread.sleep(10L);
} catch (InterruptedException e) { }
if( force.size() >= maxEventAmount )
{
p.getVideoLayout().setOnTouchListener(null);
Globals.ClickScreenPressure = getAverageForce();
Globals.ClickScreenTouchspotSize = getAverageRadius();
Log.i("SDL", "SDL: measured average force " + Globals.ClickScreenPressure + " radius " + Globals.ClickScreenTouchspotSize);
goBack(p);
}
return true;
}
int getAverageForce()
{
int avg = 0;
for(Integer f: force)
{
avg += f;
}
return avg / force.size();
}
int getAverageRadius()
{
int avg = 0;
for(Integer r: radius)
{
avg += r;
}
return avg / radius.size();
}
}
}
static class CalibrateTouchscreenMenu extends Menu
{
String title(final MainActivity p)
{
return p.getResources().getString(R.string.calibrate_touchscreen);
}
//boolean enabled() { return true; };
void run (final MainActivity p)
{
p.setText(p.getResources().getString(R.string.calibrate_touchscreen_touch));
Globals.TouchscreenCalibration[0] = 0;
Globals.TouchscreenCalibration[1] = 0;
Globals.TouchscreenCalibration[2] = 0;
Globals.TouchscreenCalibration[3] = 0;
ScreenEdgesCalibrationTool tool = new ScreenEdgesCalibrationTool(p);
p.getVideoLayout().setOnTouchListener(tool);
p.getVideoLayout().setOnKeyListener(tool);
}
static class ScreenEdgesCalibrationTool implements View.OnTouchListener, View.OnKeyListener
{
MainActivity p;
ImageView img;
Bitmap bmp;
public ScreenEdgesCalibrationTool(MainActivity _p)
{
p = _p;
img = new ImageView(p);
img.setLayoutParams(new ViewGroup.LayoutParams( ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));
img.setScaleType(ImageView.ScaleType.MATRIX);
bmp = BitmapFactory.decodeResource( p.getResources(), R.drawable.calibrate );
img.setImageBitmap(bmp);
Matrix m = new Matrix();
RectF src = new RectF(0, 0, bmp.getWidth(), bmp.getHeight());
RectF dst = new RectF(Globals.TouchscreenCalibration[0], Globals.TouchscreenCalibration[1],
Globals.TouchscreenCalibration[2], Globals.TouchscreenCalibration[3]);
m.setRectToRect(src, dst, Matrix.ScaleToFit.FILL);
img.setImageMatrix(m);
p.getVideoLayout().addView(img);
}
@Override
public boolean onTouch(View v, MotionEvent ev)
{
if( Globals.TouchscreenCalibration[0] == Globals.TouchscreenCalibration[1] &&
Globals.TouchscreenCalibration[1] == Globals.TouchscreenCalibration[2] &&
Globals.TouchscreenCalibration[2] == Globals.TouchscreenCalibration[3] )
{
Globals.TouchscreenCalibration[0] = (int)ev.getX();
Globals.TouchscreenCalibration[1] = (int)ev.getY();
Globals.TouchscreenCalibration[2] = (int)ev.getX();
Globals.TouchscreenCalibration[3] = (int)ev.getY();
}
if( ev.getX() < Globals.TouchscreenCalibration[0] )
Globals.TouchscreenCalibration[0] = (int)ev.getX();
if( ev.getY() < Globals.TouchscreenCalibration[1] )
Globals.TouchscreenCalibration[1] = (int)ev.getY();
if( ev.getX() > Globals.TouchscreenCalibration[2] )
Globals.TouchscreenCalibration[2] = (int)ev.getX();
if( ev.getY() > Globals.TouchscreenCalibration[3] )
Globals.TouchscreenCalibration[3] = (int)ev.getY();
Matrix m = new Matrix();
RectF src = new RectF(0, 0, bmp.getWidth(), bmp.getHeight());
RectF dst = new RectF(Globals.TouchscreenCalibration[0], Globals.TouchscreenCalibration[1],
Globals.TouchscreenCalibration[2], Globals.TouchscreenCalibration[3]);
m.setRectToRect(src, dst, Matrix.ScaleToFit.FILL);
img.setImageMatrix(m);
return true;
}
@Override
public boolean onKey(View v, int keyCode, KeyEvent event)
{
p.getVideoLayout().setOnTouchListener(null);
p.getVideoLayout().setOnKeyListener(null);
p.getVideoLayout().removeView(img);
goBack(p);
return true;
}
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,161 @@
// DO NOT EDIT THIS FILE - it is automatically generated, ALL YOUR CHANGES WILL BE OVERWRITTEN, edit the file under $JAVA_SRC_PATH dir
/*
Simple DirectMedia Layer
Java source code (C) 2009-2014 Sergii Pylypenko
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
package io.neoterm;
import java.io.InputStream;
import java.io.DataInputStream;
import java.io.IOException;
import java.io.EOFException;
import android.util.Log;
/**
* Decompresses a .xz file in streamed mode (no seeking).
* This is a copy of code from http://git.tukaani.org/xz-java.git
* but using liblzma and JNI instead of Java, because Java heap
* is very limited, and we're hitting memory limit on emulator.
*/
public class XZInputStream extends InputStream
{
private long nativeData = 0;
private InputStream in = null;
private final byte[] inBuf = new byte[8192];
private int inOffset = 0;
private int inAvailable = 0;
private boolean outBufEof = false;
private int offsets[] = new int[2];
private final byte[] tempBuf = new byte[1];
public XZInputStream(InputStream in) throws IOException
{
this.in = in;
if (in == null)
{
throw new NullPointerException("InputStream == null");
}
nativeData = nativeInit();
if (nativeData == 0)
{
throw new OutOfMemoryError("Cannot initialize JNI liblzma object");
}
}
@Override
public int available() throws IOException
{
return 0; // Don't care
}
@Override
public void close() throws IOException
{
synchronized (this)
{
if (nativeData != 0)
nativeClose(nativeData);
nativeData = 0;
if (in != null)
{
try {
in.close();
} finally {
in = null;
}
}
}
}
@Override
protected void finalize() throws IOException
{
try {
close();
} finally {
try {
super.finalize();
} catch (Throwable t) {
throw new AssertionError(t);
}
}
}
@Override
public int read() throws IOException
{
return read(tempBuf, 0, 1) == -1 ? -1 : (tempBuf[0] & 0xFF);
}
@Override
public int read(byte[] outBuf, int outOffset, int outCount) throws IOException
{
//Log.i("SDL", "XZInputStream.read: outOffset " + outOffset + " outCount " + outCount + " outBufEof " + outBufEof +
// " inOffset " + inOffset + " inAvailable " + inAvailable);
if (outBufEof)
return -1;
if (outCount <= 0)
return 0;
int oldOutOffset = outOffset;
if (inOffset >= inAvailable && inAvailable != -1)
{
inAvailable = in.read(inBuf, 0, inBuf.length);
inOffset = 0;
//Log.i("SDL", "XZInputStream.read: in.read: inOffset " + inOffset + " inAvailable " + inAvailable);
}
offsets[0] = inOffset;
offsets[1] = outOffset;
int ret = nativeRead(nativeData, inBuf, inAvailable, outBuf, outCount, offsets);
inOffset = offsets[0];
outOffset = offsets[1];
//Log.i("SDL", "XZInputStream.read: nativeRead: outOffset " + outOffset + " outCount " + outCount + " outBufEof " + outBufEof +
// " inOffset " + inOffset + " inAvailable " + inAvailable + " ret " + ret);
if (ret != 0)
{
if (ret == 1)
{
if (inOffset < inAvailable)
throw new IOException("Garbage at the end of LZMA stream");
if (inAvailable != -1)
inAvailable = in.read(inBuf, 0, inBuf.length);
if (inAvailable != -1)
throw new IOException("Garbage at the end of LZMA stream");
outBufEof = true;
}
else
{
throw new IOException("LZMA error " + ret);
}
}
//Log.i("SDL", "XZInputStream.read: returning " + (outOffset - oldOutOffset));
return outOffset - oldOutOffset;
}
private native long nativeInit();
private native void nativeClose(long nativeData);
private native int nativeRead(long nativeData, byte[] inBuf, int inAvailable, byte[] outBuf, int outCount, int[] offsets);
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 136 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 122 KiB

View File

@ -0,0 +1,49 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:id="@+id/notificationView"
android:clickable="true"
>
<ImageView
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:id="@+id/notificationIcon"
android:gravity="center_vertical"
android:src="@drawable/icon"
android:layout_alignParentLeft="true"
android:clickable="true"
android:scaleType="centerInside"
android:adjustViewBounds="true"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_toRightOf="@id/notificationIcon"
android:id="@+id/notificationText"
android:text="App is running"
android:textAppearance="@android:style/TextAppearance.Material.Notification.Title"
android:gravity="center_vertical"
android:clickable="true"
android:paddingLeft="10dp"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:id="@+id/notificationStop"
android:text="@string/notification_stop"
android:gravity="center_vertical"
android:singleLine="true"
android:layout_alignParentRight="true"
android:textAlignment="center"
/>
</RelativeLayout>

View File

@ -0,0 +1,49 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:id="@+id/notificationView"
android:clickable="true"
>
<ImageView
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:id="@+id/notificationIcon"
android:gravity="center_vertical"
android:src="@drawable/icon"
android:layout_alignParentLeft="true"
android:clickable="true"
android:scaleType="centerInside"
android:adjustViewBounds="true"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_toRightOf="@id/notificationIcon"
android:id="@+id/notificationText"
android:text="App is running"
android:textAppearance="@android:style/TextAppearance.StatusBar.EventContent"
android:gravity="center_vertical"
android:clickable="true"
android:paddingLeft="10dp"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:id="@+id/notificationStop"
android:text="@string/notification_stop"
android:gravity="center_vertical"
android:singleLine="true"
android:layout_alignParentRight="true"
android:textAlignment="center"
/>
</RelativeLayout>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,205 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">XServer XSDL - NeoTerm</string>
<string name="init">初始化中</string>
<string name="please_wait">正在下载数据,请稍候</string>
<string name="device_config">设备配置</string>
<string name="device_change_cfg">更改设备配置</string>
<string name="download_unneeded">没有需要下载的内容</string>
<string name="connecting_to">正在连接到 %s</string>
<string name="failed_connecting_to">连接到 %s 失败</string>
<string name="error_connecting_to"> %s 连接出错</string>
<string name="dl_from">正在从 %s 下载数据</string>
<string name="error_dl_from">从 %s 下载数据时出错</string>
<string name="error_write">写入到 %s 时出错</string>
<string name="dl_progress">%1$.0f%% 已完成: 文件 %2$s</string>
<string name="dl_finished">已完成</string>
<string name="storage_phone">内部储存 - %d MB 空闲</string>
<string name="storage_sd">SD卡储存 - %d MB 空闲</string>
<string name="storage_custom">自定义目录</string>
<string name="storage_commandline">命令行参数,每行一个参数</string>
<string name="storage_question">数据文件安装位置</string>
<string name="optional_downloads">下载</string>
<string name="downloads">下载</string>
<string name="ok">完成</string>
<string name="cancel">取消</string>
<string name="controls_arrows">箭头 / 操纵杆 / 方向键</string>
<string name="controls_trackball">轨迹球</string>
<string name="controls_accel">加速度计</string>
<string name="controls_touch">只使用触屏</string>
<string name="controls_question">您的设备有哪些导航键?</string>
<string name="controls_additional">附加控制</string>
<string name="controls_screenkb">屏幕键盘</string>
<string name="controls_accelnav">加速度计</string>
<string name="controls_screenkb_size">屏幕键盘大小</string>
<string name="controls_screenkb_drawsize">按钮大小</string>
<string name="controls_screenkb_large"></string>
<string name="controls_screenkb_medium"></string>
<string name="controls_screenkb_small"></string>
<string name="controls_screenkb_tiny">微小</string>
<string name="controls_screenkb_custom">自定义</string>
<string name="controls_screenkb_theme">屏幕键盘主题</string>
<string name="controls_screenkb_by">%1$s by %2$s</string>
<string name="controls_screenkb_transparency">屏幕键盘透明度</string>
<string name="controls_screenkb_trans_0">隐形</string>
<string name="controls_screenkb_trans_1">半隐形</string>
<string name="controls_screenkb_trans_2">透明</string>
<string name="controls_screenkb_trans_3">半透明</string>
<string name="controls_screenkb_trans_4">不透明</string>
<string name="trackball_no_dampening">无阻碍</string>
<string name="trackball_fast"></string>
<string name="trackball_medium"></string>
<string name="trackball_slow"></string>
<string name="trackball_question">轨迹球阻碍</string>
<string name="accel_veryfast">非常快</string>
<string name="accel_fast"></string>
<string name="accel_medium"></string>
<string name="accel_slow"></string>
<string name="accel_veryslow">非常慢</string>
<string name="accel_question">加速度计灵敏度</string>
<string name="accel_floating">Floating</string>
<string name="accel_fixed_start">在应用程序启动时修复</string>
<string name="accel_fixed_horiz">Fixed to table desk orientation</string>
<string name="accel_question_center">加速度计中心位置</string>
<string name="mouse_emulation">鼠标模拟</string>
<string name="rightclick_question">单击鼠标右键</string>
<string name="rightclick_menu">菜单键</string>
<string name="rightclick_key">物理按键</string>
<string name="rightclick_multitouch">双指触摸</string>
<string name="rightclick_pressure">使用按压力度</string>
<string name="rightclick_none">禁用鼠标右键</string>
<string name="leftclick_question">鼠标左键单击</string>
<string name="leftclick_normal">正常</string>
<string name="leftclick_near_cursor">触摸靠近鼠标光标</string>
<string name="leftclick_multitouch">双指触摸</string>
<string name="leftclick_pressure">使用按压力度</string>
<string name="leftclick_dpadcenter">轨迹球点击 / 操纵杆中心</string>
<string name="leftclick_timeout">长按一个点</string>
<string name="leftclick_tap">点击</string>
<string name="leftclick_tap_or_timeout">点击或长按</string>
<string name="leftclick_timeout_time">长按超时</string>
<string name="leftclick_timeout_time_0">0.3 秒</string>
<string name="leftclick_timeout_time_1">0.5 秒</string>
<string name="leftclick_timeout_time_2">0.7 秒</string>
<string name="leftclick_timeout_time_3">1 秒</string>
<string name="leftclick_timeout_time_4">1.5 秒</string>
<string name="click_with_dpadcenter">左键点击和轨迹球点击 / 操纵杆中心</string>
<string name="advanced">高级功能</string>
<string name="mouse_keepaspectratio">保持4:3的屏幕宽高比</string>
<string name="mouse_showcreenunderfinger">在单独的窗口中显示屏幕</string>
<string name="mouse_showcreenunderfinger2">屏幕放大镜</string>
<string name="mouse_joystickmouse">使用操纵杆或轨迹球移动鼠标</string>
<string name="mouse_joystickmousespeed">使用操纵杆移动鼠标时的速度</string>
<string name="mouse_joystickmouseaccel">使用操纵杆加速移动鼠标</string>
<string name="mouse_relative">鼠标相对移动(笔记本模式)</string>
<string name="mouse_relative_speed">鼠标相对移动速度</string>
<string name="mouse_relative_accel">鼠标相对移动加速</string>
<string name="mouse_hover_jitter_filter">过滤指针/手指的抖动</string>
<string name="mouse_gyroscope_mouse">用陀螺仪控制鼠标移动</string>
<string name="mouse_gyroscope_mouse_sensitivity">陀螺仪灵敏度</string>
<string name="mouse_finger_hover">手指抖动</string>
<string name="mouse_subframe_touch_events">每一帧的多点触摸事件</string>
<string name="none"></string>
<string name="measurepressure">校准触摸屏压力</string>
<string name="measurepressure_touchplease">请将手指滑过屏幕两秒钟</string>
<string name="measurepressure_response">压力 %1$03d 半径 %2$03d</string>
<string name="audiobuf_verysmall">非常小(较新的设备,延迟低)</string>
<string name="audiobuf_small"></string>
<string name="audiobuf_medium">中等</string>
<string name="audiobuf_large">大(较老的设备,如果声音不稳定请选此项)</string>
<string name="audiobuf_question">音频缓冲大小</string>
<string name="remap_hwkeys">映射物理按键</string>
<string name="remap_hwkeys_press">按下任意按键 除了HOME键和POWER键如音量键</string>
<string name="remap_hwkeys_select">选择SDL按键</string>
<string name="remap_hwkeys_select_simple">选择动作</string>
<string name="remap_hwkeys_select_more_keys">显示所有按键</string>
<string name="remap_screenkb">映射屏幕控件</string>
<string name="remap_screenkb_joystick">手柄</string>
<string name="remap_screenkb_button">按钮</string>
<string name="remap_screenkb_button_text">文本输入按钮</string>
<string name="remap_screenkb_button_gestures">双指手势</string>
<string name="remap_screenkb_button_gestures_sensitivity">双指手势灵敏度</string>
<string name="remap_screenkb_button_zoomin">双指放大</string>
<string name="remap_screenkb_button_zoomout">双指缩小</string>
<string name="remap_screenkb_button_rotateleft">双指向左旋转</string>
<string name="remap_screenkb_button_rotateright">双指向右旋转</string>
<string name="screenkb_custom_layout">自定义屏幕键盘布局</string>
<string name="screenkb_custom_layout_help">按返回键结束,在空白区域滑动调整按钮大小</string>
<string name="screenkb_floating_joystick">浮动操纵杆</string>
<string name="calibrate_touchscreen">校准触摸屏</string>
<string name="calibrate_touchscreen_touch">触摸屏幕的所有边缘,按返回键结束</string>
<string name="video">视频选项</string>
<string name="video_smooth">线性过滤</string>
<string name="video_separatethread">用单线程处理视频可能会提高FPS也可能使程序崩溃</string>
<string name="video_orientation_vertical">切换横屏/竖屏</string>
<string name="video_orientation_autodetect">自动检测屏幕方向</string>
<string name="video_bpp_24">24 bpp颜色深度</string>
<string name="video_immersive">隐藏系统导航按钮/沉浸模式</string>
<string name="tv_borders">电视边框</string>
<string name="text_edit_click_here">点击开始输入,按返回键结束</string>
<string name="display_size_mouse">鼠标仿真模式</string>
<string name="display_size">显示仿真鼠标的大小</string>
<string name="display_size_desktop">桌面版,无仿真</string>
<string name="display_size_large">大(适用于平板电脑)</string>
<string name="display_size_small">小,放大镜</string>
<string name="display_size_small_touchpad">小,触摸模式</string>
<string name="display_size_tiny">很小</string>
<string name="display_size_tiny_touchpad">很小,触摸模式</string>
<string name="show_more_options">显示更多选项</string>
<string name="hardware_mouse_detected">检测到鼠标硬件,禁用鼠标仿真</string>
<string name="not_enough_ram">没有足够的 RAM</string>
<string name="not_enough_ram_size">本程序需要 %1$d Mb 的RAM您的设备有 %2$d Mb</string>
<string name="ignore">忽略</string>
<string name="calibrate_gyroscope">校准陀螺仪</string>
<string name="calibrate_gyroscope_text">将您的设备放在水平表面上</string>
<string name="calibrate_gyroscope_not_supported">您的设备没有陀螺仪</string>
<string name="reset_config">将所有配置重置为默认值</string>
<string name="reset_config_ask">是否将所有选项重置为默认值?</string>
<string name="cancel_download">是否取消数据下载?</string>
<string name="cancel_download_resume">您可以稍后恢复它,数据不会被下载两次。</string>
<string name="yes"></string>
<string name="no"></string>
<!-- Play Game Services strings -->
<string name="gamehelper_sign_in_failed">无法登录,请检查您的网络连接,然后重试。</string>
<string name="gamehelper_app_misconfigured">应用程序配置不正确。请检查包名和签名证书是否与开发者控制台中创建的客户端ID一致。此外如果应用程序尚未发布请检查您的帐户是否为测试人员帐户。详细信息请参阅日志。</string>
<string name="gamehelper_license_failed">许可证检查失败。</string>
<string name="gamehelper_unknown_error">未知错误。</string>
<string name="accessing_network">正在访问网络,请稍候</string>
<string name="restarting_please_wait">重新启动中,请稍候。</string>
<string name="notification_app_is_running">%s 正在运行中</string>
<string name="notification_stop">停止</string>
</resources>

View File

@ -0,0 +1,4 @@
<resources>
<dimen name="screen_border_horizontal">0dp</dimen>
<dimen name="screen_border_vertical">0dp</dimen>
</resources>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<item name="left" type="id" />
<item name="right" type="id" />
<item name="top" type="id" />
<item name="bottom" type="id" />
</resources>

View File

@ -0,0 +1,209 @@
<?xml version="1.0" encoding="utf-8"?>
<resources
xmlns:tools="http://schemas.android.com/tools"
tools:ignore="MissingTranslation">
<string name="app_name">XServer XSDL - NeoTerm</string>
<string name="init">Initializing</string>
<string name="please_wait">Please wait while data is being downloaded</string>
<string name="device_config">Device configuration</string>
<string name="device_change_cfg">Change device configuration</string>
<string name="download_unneeded">No need to download</string>
<string name="connecting_to">Connecting to %s</string>
<string name="failed_connecting_to">Failed connecting to %s</string>
<string name="error_connecting_to">Error connecting to %s</string>
<string name="dl_from">Downloading data from %s</string>
<string name="error_dl_from">Error downloading data from %s</string>
<string name="error_write">Error writing to %s</string>
<string name="dl_progress">%1$.0f%% done: file %2$s</string>
<string name="dl_finished">Finished</string>
<string name="storage_phone">Internal storage - %d MB free</string>
<string name="storage_sd">SD card storage - %d MB free</string>
<string name="storage_custom">Specify directory</string>
<string name="storage_commandline">Command line parameters, one argument per line</string>
<string name="storage_question">Data installation location</string>
<string name="optional_downloads">Downloads</string>
<string name="downloads">Downloads</string>
<string name="ok">OK</string>
<string name="cancel">Cancel</string>
<string name="controls_arrows">Arrows / joystick / dpad</string>
<string name="controls_trackball">Trackball</string>
<string name="controls_accel">Accelerometer</string>
<string name="controls_touch">Touchscreen only</string>
<string name="controls_question">What kind of navigation keys does your device have?</string>
<string name="controls_additional">Additional controls</string>
<string name="controls_screenkb">On-screen keyboard</string>
<string name="controls_accelnav">Accelerometer</string>
<string name="controls_screenkb_size">On-screen keyboard size</string>
<string name="controls_screenkb_drawsize">Size of button images</string>
<string name="controls_screenkb_large">Large</string>
<string name="controls_screenkb_medium">Medium</string>
<string name="controls_screenkb_small">Small</string>
<string name="controls_screenkb_tiny">Tiny</string>
<string name="controls_screenkb_custom">Custom</string>
<string name="controls_screenkb_theme">On-screen keyboard theme</string>
<string name="controls_screenkb_by">%1$s by %2$s</string>
<string name="controls_screenkb_transparency">On-screen keyboard transparency</string>
<string name="controls_screenkb_trans_0">Invisible</string>
<string name="controls_screenkb_trans_1">Almost invisible</string>
<string name="controls_screenkb_trans_2">Transparent</string>
<string name="controls_screenkb_trans_3">Semi-transparent</string>
<string name="controls_screenkb_trans_4">Non-transparent</string>
<string name="trackball_no_dampening">No dampening</string>
<string name="trackball_fast">Fast</string>
<string name="trackball_medium">Medium</string>
<string name="trackball_slow">Slow</string>
<string name="trackball_question">Trackball dampening</string>
<string name="accel_veryfast">Very fast</string>
<string name="accel_fast">Fast</string>
<string name="accel_medium">Medium</string>
<string name="accel_slow">Slow</string>
<string name="accel_veryslow">Very slow</string>
<string name="accel_question">Accelerometer sensitivity</string>
<string name="accel_floating">Floating</string>
<string name="accel_fixed_start">Fixed when application starts</string>
<string name="accel_fixed_horiz">Fixed to table desk orientation</string>
<string name="accel_question_center">Accelerometer center position</string>
<string name="mouse_emulation">Mouse emulation</string>
<string name="rightclick_question">Right mouse click</string>
<string name="rightclick_menu">Menu key</string>
<string name="rightclick_key">Physical key</string>
<string name="rightclick_multitouch">Touch screen with second finger</string>
<string name="rightclick_pressure">Touch screen with force</string>
<string name="rightclick_none">Disable right mouse click</string>
<string name="leftclick_question">Left mouse click</string>
<string name="leftclick_normal">Normal</string>
<string name="leftclick_near_cursor">Touch near mouse cursor</string>
<string name="leftclick_multitouch">Touch screen with second finger</string>
<string name="leftclick_pressure">Touch screen with force</string>
<string name="leftclick_dpadcenter">Trackball click / joystick center</string>
<string name="leftclick_timeout">Hold at the same spot</string>
<string name="leftclick_tap">Tap</string>
<string name="leftclick_tap_or_timeout">Tap or hold</string>
<string name="leftclick_timeout_time">Holding timeout</string>
<string name="leftclick_timeout_time_0">0.3 sec</string>
<string name="leftclick_timeout_time_1">0.5 sec</string>
<string name="leftclick_timeout_time_2">0.7 sec</string>
<string name="leftclick_timeout_time_3">1 sec</string>
<string name="leftclick_timeout_time_4">1.5 sec</string>
<string name="click_with_dpadcenter">Left mouse click with trackball / joystick center</string>
<string name="advanced">Advanced features</string>
<string name="mouse_keepaspectratio">Keep 4:3 screen aspect ratio</string>
<string name="mouse_showcreenunderfinger">Show screen under finger in separate window</string>
<string name="mouse_showcreenunderfinger2">On-screen magnifying glass</string>
<string name="mouse_joystickmouse">Move mouse with joystick or trackball</string>
<string name="mouse_joystickmousespeed">Move mouse with joystick speed</string>
<string name="mouse_joystickmouseaccel">Move mouse with joystick acceleration</string>
<string name="mouse_relative">Relative mouse movement (laptop mode)</string>
<string name="mouse_relative_speed">Relative mouse movement speed</string>
<string name="mouse_relative_accel">Relative mouse movement acceleration</string>
<string name="mouse_hover_jitter_filter">Filter jitter for stylus/finger hover</string>
<string name="mouse_gyroscope_mouse">Control mouse with gyroscope</string>
<string name="mouse_gyroscope_mouse_sensitivity">Gyroscope sensitivity</string>
<string name="mouse_finger_hover">Finger hover</string>
<string name="mouse_subframe_touch_events">Multiple touch events per video frame</string>
<string name="none">None</string>
<string name="measurepressure">Calibrate touchscreen pressure</string>
<string name="measurepressure_touchplease">Please slide finger across the screen for two seconds</string>
<string name="measurepressure_response">Pressure %1$03d radius %2$03d</string>
<string name="audiobuf_verysmall">Very small (fast devices, less lag)</string>
<string name="audiobuf_small">Small</string>
<string name="audiobuf_medium">Medium</string>
<string name="audiobuf_large">Large (older devices, if sound is choppy)</string>
<string name="audiobuf_question">Size of audio buffer</string>
<string name="remap_hwkeys">Remap physical keys</string>
<string name="remap_hwkeys_press">Press any key except HOME and POWER, you may use volume keys</string>
<string name="remap_hwkeys_select">Select SDL keycode</string>
<string name="remap_hwkeys_select_simple">Select action</string>
<string name="remap_hwkeys_select_more_keys">Show all keycodes</string>
<string name="remap_screenkb">Remap on-screen controls</string>
<string name="remap_screenkb_joystick">Joystick</string>
<string name="remap_screenkb_button">Button</string>
<string name="remap_screenkb_button_text">Text input button</string>
<string name="remap_screenkb_button_gestures">Two-finger screen gestures</string>
<string name="remap_screenkb_button_gestures_sensitivity">Two-finger screen gestures sensitivity</string>
<string name="remap_screenkb_button_zoomin">Zoom in two-finger gesture</string>
<string name="remap_screenkb_button_zoomout">Zoom out two-finger gesture</string>
<string name="remap_screenkb_button_rotateleft">Rotate left two-finger gesture</string>
<string name="remap_screenkb_button_rotateright">Rotate right two-finger gesture</string>
<string name="screenkb_custom_layout">Customize on-screen keyboard layout</string>
<string name="screenkb_custom_layout_help">Press BACK when done. Resize buttons by sliding on empty space.</string>
<string name="screenkb_floating_joystick">Floating joystick</string>
<string name="calibrate_touchscreen">Calibrate touchscreen</string>
<string name="calibrate_touchscreen_touch">Touch all edges of the screen, press BACK when done</string>
<string name="video">Video settings</string>
<string name="video_smooth">Linear video filtering</string>
<string name="video_separatethread">Separate thread for video, it can increase FPS, it also can crash the app</string>
<string name="video_orientation_vertical">Portrait/vertical screen orientation</string>
<string name="video_orientation_autodetect">Auto-detect screen orientation</string>
<string name="video_bpp_24">24 bpp screen color depth</string>
<string name="video_immersive">Hide system navigation buttons / immersive mode</string>
<string name="tv_borders">TV borders</string>
<string name="text_edit_click_here">Tap to start typing, press Back when done</string>
<string name="display_size_mouse">Mouse emulation mode</string>
<string name="display_size">Display size for mouse emulation</string>
<string name="display_size_desktop">Desktop, no emulation</string>
<string name="display_size_large">Large (tablets)</string>
<string name="display_size_small">Small, magnifying glass</string>
<string name="display_size_small_touchpad">Small, touchpad mode</string>
<string name="display_size_tiny">Tiny</string>
<string name="display_size_tiny_touchpad">Tiny, touchpad mode</string>
<string name="show_more_options">Show more options</string>
<string name="hardware_mouse_detected">Hardware mouse detected, disabling mouse emulation</string>
<string name="not_enough_ram">Not enough RAM</string>
<string name="not_enough_ram_size">This app needs %1$d Mb RAM, your device has %2$d Mb</string>
<string name="ignore">Ignore</string>
<string name="calibrate_gyroscope">Calibrate gyroscope</string>
<string name="calibrate_gyroscope_text">Put your device on a flat surface</string>
<string name="calibrate_gyroscope_not_supported">Your device does not have gyroscope</string>
<string name="reset_config">Reset config to defaults</string>
<string name="reset_config_ask">Reset all options to default values?</string>
<string name="cancel_download">Cancel data downloading?</string>
<string name="cancel_download_resume">You can resume it later, the data will not be downloaded twice.</string>
<string name="yes">Yes</string>
<string name="no">No</string>
<!-- Play Game Services strings -->
<string name="gamehelper_sign_in_failed">Failed to sign in. Please check your network connection and try again.</string>
<string name="gamehelper_app_misconfigured">The application is incorrectly configured. Check that the package name and signing certificate match the client ID created in Developer Console. Also, if the application is not yet published, check that the account you are trying to sign in with is listed as a tester account. See logs for more information.</string>
<string name="gamehelper_license_failed">License check failed.</string>
<string name="gamehelper_unknown_error">Unknown error.</string>
<string name="accessing_network">Accessing network, please wait</string>
<string name="google_play_game_services_app_id" translatable="false">==GOOGLEPLAYGAMESERVICES_APP_ID==</string>
<string name="restarting_please_wait">Restarting, please wait.</string>
<string name="notification_app_is_running">%s is running</string>
<string name="notification_stop">Stop</string>
</resources>

View File

@ -0,0 +1,49 @@
<?xml version="1.0" encoding="utf-8"?>
<Keyboard android:keyWidth="10.000002%p" android:keyHeight="10.000002%p" android:horizontalGap="0.0px" android:verticalGap="0.0px"
xmlns:android="http://schemas.android.com/apk/res/android">
<Row>
<Key android:codes="45" android:keyEdgeFlags="left" android:keyLabel="q" />
<Key android:codes="51" android:keyLabel="w" />
<Key android:codes="33" android:keyLabel="e" />
<Key android:codes="46" android:keyLabel="r" />
<Key android:codes="48" android:keyLabel="t" />
<Key android:codes="53" android:keyLabel="y" />
<Key android:codes="49" android:keyLabel="u" />
<Key android:codes="37" android:keyLabel="i" />
<Key android:codes="43" android:keyLabel="o" />
<Key android:codes="44" android:keyEdgeFlags="right" android:keyLabel="p" />
</Row>
<Row>
<Key android:codes="29" android:keyEdgeFlags="left" android:keyLabel="a" />
<Key android:codes="47" android:keyLabel="s" />
<Key android:codes="32" android:keyLabel="d" />
<Key android:codes="34" android:keyLabel="f" />
<Key android:codes="35" android:keyLabel="g" />
<Key android:codes="36" android:keyLabel="h" />
<Key android:codes="38" android:keyLabel="j" />
<Key android:codes="39" android:keyLabel="k" />
<Key android:codes="40" android:keyLabel="l" />
<Key android:codes="74" android:keyEdgeFlags="right" android:keyLabel=";" />
</Row>
<Row>
<Key android:codes="-1" android:keyEdgeFlags="left" android:keyLabel="⇪" />
<Key android:codes="54" android:keyLabel="z" />
<Key android:codes="52" android:keyLabel="x" />
<Key android:codes="31" android:keyLabel="c" />
<Key android:codes="50" android:keyLabel="v" />
<Key android:codes="30" android:keyLabel="b" />
<Key android:codes="42" android:keyLabel="n" />
<Key android:codes="41" android:keyLabel="m" />
<Key android:keyWidth="20.000004%p" android:codes="67" android:keyEdgeFlags="right" android:keyLabel="≪ ×" />
</Row>
<Row android:rowEdgeFlags="bottom">
<Key android:codes="-6" android:keyEdgeFlags="left" android:keyLabel="123…" />
<Key android:codes="71" android:keyLabel="[" />
<Key android:codes="72" android:keyLabel="]" />
<Key android:codes="76" android:keyLabel="/" />
<Key android:keyWidth="20.000004%p" android:codes="62" android:keyLabel="Space" />
<Key android:codes="55" android:keyLabel="," />
<Key android:codes="56" android:keyLabel="." />
<Key android:keyWidth="20.000004%p" android:codes="66" android:keyEdgeFlags="right" android:keyLabel="Enter" />
</Row>
</Keyboard>

View File

@ -0,0 +1,57 @@
<?xml version="1.0"?>
<!-- When creating new keyboard layout, add it to TextInputKeyboardList array in project/java/MainActivity.java -->
<Keyboard xmlns:android="http://schemas.android.com/apk/res/android"
android:keyWidth="10%p"
android:horizontalGap="0px"
android:verticalGap="0px"
android:keyHeight="10%p">
<Row>
<Key android:codes="8" android:keyLabel="1" android:keyEdgeFlags="left"/>
<Key android:codes="9" android:keyLabel="2"/>
<Key android:codes="10" android:keyLabel="3"/>
<Key android:codes="11" android:keyLabel="4"/>
<Key android:codes="12" android:keyLabel="5"/>
<Key android:codes="13" android:keyLabel="6"/>
<Key android:codes="14" android:keyLabel="7"/>
<Key android:codes="15" android:keyLabel="8"/>
<Key android:codes="16" android:keyLabel="9"/>
<Key android:codes="7" android:keyLabel="0" android:keyEdgeFlags="right"/>
</Row>
<Row>
<Key android:codes="111" android:keyLabel="Esc" android:keyEdgeFlags="left"/>
<Key android:codes="68" android:keyLabel="`"/>
<Key android:codes="69" android:keyLabel="-"/>
<Key android:codes="70" android:keyLabel="="/>
<Key android:codes="73" android:keyLabel="\\"/>
<Key android:codes="124" android:keyLabel="Ins"/>
<Key android:codes="92" android:keyLabel="PgUp"/>
<Key android:codes="122" android:keyLabel="Home"/>
<Key android:codes="19" android:keyLabel="↑"/>
<Key android:codes="123" android:keyLabel="End" android:keyEdgeFlags="right" />
</Row>
<Row>
<Key android:codes="-1" android:keyLabel="!@#…" android:keyEdgeFlags="left"/>
<Key android:codes="75" android:keyLabel="'"/>
<Key android:codes="100075" android:keyLabel="&quot;"/>
<Key android:codes="61" android:keyLabel="Tab"/>
<Key android:codes="115" android:keyLabel="CapsLk"/>
<Key android:codes="112" android:keyLabel="Del"/>
<Key android:codes="93" android:keyLabel="PgDn"/>
<Key android:codes="21" android:keyLabel="←"/>
<Key android:codes="20" android:keyLabel="↓"/>
<Key android:codes="22" android:keyLabel="→" android:keyEdgeFlags="right"/>
</Row>
<Row android:rowEdgeFlags="bottom">
<Key android:codes="-6" android:keyLabel="abc…" android:keyEdgeFlags="left"/>
<Key android:codes="59" android:keyLabel="Shift" android:isSticky="true"/>
<Key android:codes="113" android:keyLabel="Ctrl" android:isSticky="true"/>
<Key android:codes="117" android:keyLabel="Meta" android:isSticky="true"/>
<Key android:codes="57" android:keyLabel="Alt" android:isSticky="true"/>
<Key android:codes="58" android:keyLabel="Alt" android:isSticky="true"/>
<Key android:codes="118" android:keyLabel="Meta" android:isSticky="true"/>
<Key android:codes="226" android:keyLabel="Menu" android:isSticky="true"/>
<Key android:codes="114" android:keyLabel="Ctrl" android:isSticky="true"/>
<Key android:codes="60" android:keyLabel="Shift" android:isSticky="true"/>
</Row>
</Keyboard>

View File

@ -0,0 +1,57 @@
<?xml version="1.0"?>
<!-- When creating new keyboard layout, add it to TextInputKeyboardList array in project/java/MainActivity.java -->
<Keyboard xmlns:android="http://schemas.android.com/apk/res/android"
android:keyWidth="10%p"
android:horizontalGap="0px"
android:verticalGap="0px"
android:keyHeight="10%p">
<Row>
<Key android:codes="100008" android:keyLabel="!" android:keyEdgeFlags="left"/>
<Key android:codes="100009" android:keyLabel="\@"/>
<Key android:codes="100010" android:keyLabel="#"/>
<Key android:codes="100011" android:keyLabel="$"/>
<Key android:codes="100012" android:keyLabel="%"/>
<Key android:codes="100013" android:keyLabel="^"/>
<Key android:codes="100014" android:keyLabel="&amp;"/>
<Key android:codes="100015" android:keyLabel="*"/>
<Key android:codes="100016" android:keyLabel="("/>
<Key android:codes="100007" android:keyLabel=")" android:keyEdgeFlags="right"/>
</Row>
<Row>
<Key android:codes="111" android:keyLabel="Esc" android:keyEdgeFlags="left"/>
<Key android:codes="124" android:keyLabel="Help"/>
<Key android:codes="100069" android:keyLabel="_"/>
<Key android:codes="100070" android:keyLabel="+"/>
<Key android:codes="100073" android:keyLabel="|"/>
<Key android:codes="100068" android:keyLabel="~"/>
<Key android:codes="131" android:keyLabel="F1"/>
<Key android:codes="132" android:keyLabel="F2"/>
<Key android:codes="133" android:keyLabel="F3"/>
<Key android:codes="134" android:keyLabel="F4" android:keyEdgeFlags="right" />
</Row>
<Row>
<Key android:codes="-1" android:keyLabel="123…" android:keyEdgeFlags="left"/>
<Key android:codes="143" android:keyLabel="NumLk" android:isSticky="true"/>
<Key android:codes="120" android:keyLabel="Print"/>
<Key android:codes="116" android:keyLabel="ScrollLk"/>
<Key android:codes="121" android:keyLabel="Pause"/>
<Key android:codes="158" android:keyLabel="Kp ."/>
<Key android:codes="135" android:keyLabel="F5"/>
<Key android:codes="136" android:keyLabel="F6"/>
<Key android:codes="137" android:keyLabel="F7"/>
<Key android:codes="138" android:keyLabel="F8" android:keyEdgeFlags="right"/>
</Row>
<Row android:rowEdgeFlags="bottom">
<Key android:codes="-6" android:keyLabel="abc…" android:keyEdgeFlags="left"/>
<Key android:codes="154" android:keyLabel="Kp /"/>
<Key android:codes="155" android:keyLabel="Kp *"/>
<Key android:codes="156" android:keyLabel="Kp -"/>
<Key android:codes="157" android:keyLabel="Kp +"/>
<Key android:codes="160" android:keyLabel="Kp ↵"/>
<Key android:codes="139" android:keyLabel="F9" />
<Key android:codes="140" android:keyLabel="F10"/>
<Key android:codes="141" android:keyLabel="F11"/>
<Key android:codes="142" android:keyLabel="F12" android:keyEdgeFlags="right"/>
</Row>
</Keyboard>

View File

@ -0,0 +1,90 @@
<?xml version="1.0"?>
<!-- When creating new keyboard layout, add it to TextInputKeyboardList array in project/java/MainActivity.java -->
<Keyboard xmlns:android="http://schemas.android.com/apk/res/android"
android:keyWidth="10%p"
android:horizontalGap="0px"
android:verticalGap="0px"
android:keyHeight="10%p">
<Row>
<Key android:codes="111" android:keyLabel="ESC" android:keyEdgeFlags="left"/>
<Key android:codes="131" android:keyLabel="F1" />
<Key android:codes="132" android:keyLabel="F2" />
<Key android:codes="133" android:keyLabel="F3" />
<Key android:codes="134" android:keyLabel="F4" />
<Key android:codes="135" android:keyLabel="F5" />
<Key android:codes="136" android:keyLabel="F6" />
<Key android:codes="137" android:keyLabel="F7" />
<Key android:codes="138" android:keyLabel="F8" />
<Key android:codes="139" android:keyLabel="F9" />
<Key android:codes="140" android:keyLabel="F10" />
<Key android:codes="124" android:keyLabel="HELP" android:keyEdgeFlags="right"/>
</Row>
<Row>
<Key android:codes="75" android:keyLabel="`" android:keyEdgeFlags="left"/>
<Key android:codes="8" android:keyLabel="1"/>
<Key android:codes="9" android:keyLabel="2"/>
<Key android:codes="10" android:keyLabel="3"/>
<Key android:codes="11" android:keyLabel="4"/>
<Key android:codes="12" android:keyLabel="5"/>
<Key android:codes="13" android:keyLabel="6"/>
<Key android:codes="14" android:keyLabel="7"/>
<Key android:codes="15" android:keyLabel="8"/>
<Key android:codes="16" android:keyLabel="9"/>
<Key android:codes="7" android:keyLabel="0"/>
<Key android:codes="67" android:keyLabel="DEL" android:keyEdgeFlags="right"/>
</Row>
<Row>
<Key android:codes="61" android:keyLabel="TAB" android:keyEdgeFlags="left"/>
<Key android:codes="45" android:keyLabel="q"/>
<Key android:codes="51" android:keyLabel="w"/>
<Key android:codes="33" android:keyLabel="e"/>
<Key android:codes="46" android:keyLabel="r"/>
<Key android:codes="48" android:keyLabel="t"/>
<Key android:codes="53" android:keyLabel="y"/>
<Key android:codes="49" android:keyLabel="u"/>
<Key android:codes="37" android:keyLabel="i"/>
<Key android:codes="43" android:keyLabel="o"/>
<Key android:codes="44" android:keyLabel="p"/>
<Key android:codes="66" android:keyLabel="RET" android:keyEdgeFlags="right"/>
</Row>
<Row>
<Key android:codes="113" android:keyLabel="CTRL" android:keyEdgeFlags="left"/>
<Key android:codes="115" android:keyLabel="CL"/>
<Key android:codes="29" android:keyLabel="a"/>
<Key android:codes="47" android:keyLabel="s"/>
<Key android:codes="32" android:keyLabel="d"/>
<Key android:codes="34" android:keyLabel="f"/>
<Key android:codes="35" android:keyLabel="g"/>
<Key android:codes="36" android:keyLabel="h"/>
<Key android:codes="38" android:keyLabel="j"/>
<Key android:codes="39" android:keyLabel="k"/>
<Key android:codes="40" android:keyLabel="l"/>
<Key android:codes="74" android:keyLabel=";" android:keyEdgeFlags="right"/>
</Row>
<Row>
<Key android:codes="59" android:keyLabel="SHFT" android:keyEdgeFlags="left"/>
<Key android:codes="54" android:keyLabel="z"/>
<Key android:codes="52" android:keyLabel="x"/>
<Key android:codes="31" android:keyLabel="c"/>
<Key android:codes="50" android:keyLabel="v"/>
<Key android:codes="30" android:keyLabel="b"/>
<Key android:codes="42" android:keyLabel="n"/>
<Key android:codes="41" android:keyLabel="m"/>
<Key android:codes="55" android:keyLabel=","/>
<Key android:codes="56" android:keyLabel="."/>
<Key android:codes="76" android:keyLabel="/"/>
<Key android:codes="60" android:keyLabel="SHFT" android:keyEdgeFlags="right"/>
</Row>
<Row android:rowEdgeFlags="bottom">
<Key android:codes="57" android:keyLabel="ALT" android:keyEdgeFlags="left"/>
<Key android:codes="68" android:keyLabel="'" />
<Key android:codes="73" android:keyLabel="\\"/>
<Key android:codes="69" android:keyLabel="-"/>
<Key android:codes="62" android:keyLabel="SPACE" android:keyWidth="30%p" />
<Key android:codes="70" android:keyLabel="="/>
<Key android:codes="71" android:keyLabel="["/>
<Key android:codes="72" android:keyLabel="]"/>
<Key android:codes="58" android:keyLabel="ALT" android:keyEdgeFlags="right"/>
</Row>
</Keyboard>

View File

@ -0,0 +1,53 @@
<?xml version="1.0"?>
<!-- When creating new keyboard layout, add it to TextInputKeyboardList array in project/java/MainActivity.java -->
<Keyboard xmlns:android="http://schemas.android.com/apk/res/android"
android:keyWidth="10%p"
android:horizontalGap="0px"
android:verticalGap="0px"
android:keyHeight="10%p">
<Row>
<Key android:codes="45" android:keyLabel="Q" android:keyEdgeFlags="left" android:isRepeatable="true"/>
<Key android:codes="51" android:keyLabel="W" android:isRepeatable="true"/>
<Key android:codes="33" android:keyLabel="E" android:isRepeatable="true"/>
<Key android:codes="46" android:keyLabel="R" android:isRepeatable="true"/>
<Key android:codes="48" android:keyLabel="T" android:isRepeatable="true"/>
<Key android:codes="53" android:keyLabel="Y" android:isRepeatable="true"/>
<Key android:codes="49" android:keyLabel="U" android:isRepeatable="true"/>
<Key android:codes="37" android:keyLabel="I" android:isRepeatable="true"/>
<Key android:codes="43" android:keyLabel="O" android:isRepeatable="true"/>
<Key android:codes="44" android:keyLabel="P" android:keyEdgeFlags="right" android:isRepeatable="true"/>
</Row>
<Row>
<Key android:codes="29" android:keyLabel="A" android:keyEdgeFlags="left" android:isRepeatable="true"/>
<Key android:codes="47" android:keyLabel="S" android:isRepeatable="true"/>
<Key android:codes="32" android:keyLabel="D" android:isRepeatable="true"/>
<Key android:codes="34" android:keyLabel="F" android:isRepeatable="true"/>
<Key android:codes="35" android:keyLabel="G" android:isRepeatable="true"/>
<Key android:codes="36" android:keyLabel="H" android:isRepeatable="true"/>
<Key android:codes="38" android:keyLabel="J" android:isRepeatable="true"/>
<Key android:codes="39" android:keyLabel="K" android:isRepeatable="true"/>
<Key android:codes="40" android:keyLabel="L" android:isRepeatable="true"/>
<Key android:codes="74" android:keyLabel=":" android:keyEdgeFlags="right" android:isRepeatable="true"/>
</Row>
<Row>
<Key android:codes="-1" android:keyLabel="⇫" android:keyEdgeFlags="left" android:isRepeatable="true"/>
<Key android:codes="54" android:keyLabel="Z" android:isRepeatable="true"/>
<Key android:codes="52" android:keyLabel="X" android:isRepeatable="true"/>
<Key android:codes="31" android:keyLabel="C" android:isRepeatable="true"/>
<Key android:codes="50" android:keyLabel="V" android:isRepeatable="true"/>
<Key android:codes="30" android:keyLabel="B" android:isRepeatable="true"/>
<Key android:codes="42" android:keyLabel="N" android:isRepeatable="true"/>
<Key android:codes="41" android:keyLabel="M" android:isRepeatable="true"/>
<Key android:codes="67" android:keyLabel="≪ ×" android:keyWidth="20%p" android:keyEdgeFlags="right" android:isRepeatable="true"/>
</Row>
<Row android:rowEdgeFlags="bottom">
<Key android:codes="-6" android:keyLabel="!@#…" android:keyEdgeFlags="left" android:isRepeatable="true"/>
<Key android:codes="71" android:keyLabel="{" android:isRepeatable="true"/>
<Key android:codes="72" android:keyLabel="}" android:isRepeatable="true"/>
<Key android:codes="76" android:keyLabel="\?" android:isRepeatable="true"/>
<Key android:codes="62" android:keyLabel="Space" android:keyWidth="20%p" android:isRepeatable="true"/>
<Key android:codes="55" android:keyLabel="&lt;" android:isRepeatable="true"/>
<Key android:codes="56" android:keyLabel="&gt;" android:isRepeatable="true"/>
<Key android:codes="66" android:keyLabel="Enter" android:keyWidth="20%p" android:keyEdgeFlags="right" android:isRepeatable="true"/>
</Row>
</Keyboard>

View File

@ -0,0 +1,85 @@
<?xml version="1.0"?>
<!-- When creating new keyboard layout, add it to TextInputKeyboardList array in project/java/MainActivity.java -->
<Keyboard xmlns:android="http://schemas.android.com/apk/res/android"
android:keyWidth="10%p"
android:horizontalGap="0px"
android:verticalGap="0px"
android:keyHeight="10%p">
<Row>
<Key android:codes="111" android:keyLabel="Esc" android:keyEdgeFlags="left"/>
<Key android:codes="122" android:keyLabel="Clear" />
<Key android:codes="124" android:keyLabel="Insert" />
<Key android:codes="123" android:keyLabel="Help" />
<Key android:codes="129" android:keyLabel="Start" />
<Key android:codes="128" android:keyLabel="Select" />
<Key android:codes="127" android:keyLabel="Option" />
<Key android:codes="130" android:keyLabel="Reset" android:keyEdgeFlags="right"/>
</Row>
<Row>
<Key android:codes="75" android:keyLabel="`" android:keyEdgeFlags="left"/>
<Key android:codes="8" android:keyLabel="1"/>
<Key android:codes="9" android:keyLabel="2"/>
<Key android:codes="10" android:keyLabel="3"/>
<Key android:codes="11" android:keyLabel="4"/>
<Key android:codes="12" android:keyLabel="5"/>
<Key android:codes="13" android:keyLabel="6"/>
<Key android:codes="14" android:keyLabel="7"/>
<Key android:codes="15" android:keyLabel="8"/>
<Key android:codes="16" android:keyLabel="9"/>
<Key android:codes="7" android:keyLabel="0"/>
<Key android:codes="67" android:keyLabel="DEL" android:keyEdgeFlags="right"/>
</Row>
<Row>
<Key android:codes="61" android:keyLabel="TAB" android:keyEdgeFlags="left"/>
<Key android:codes="45" android:keyLabel="q"/>
<Key android:codes="51" android:keyLabel="w"/>
<Key android:codes="33" android:keyLabel="e"/>
<Key android:codes="46" android:keyLabel="r"/>
<Key android:codes="48" android:keyLabel="t"/>
<Key android:codes="53" android:keyLabel="y"/>
<Key android:codes="49" android:keyLabel="u"/>
<Key android:codes="37" android:keyLabel="i"/>
<Key android:codes="43" android:keyLabel="o"/>
<Key android:codes="44" android:keyLabel="p"/>
<Key android:codes="66" android:keyLabel="RET" android:keyEdgeFlags="right"/>
</Row>
<Row>
<Key android:codes="113" android:keyLabel="CTRL" android:keyEdgeFlags="left"/>
<Key android:codes="29" android:keyLabel="a"/>
<Key android:codes="47" android:keyLabel="s"/>
<Key android:codes="32" android:keyLabel="d"/>
<Key android:codes="34" android:keyLabel="f"/>
<Key android:codes="35" android:keyLabel="g"/>
<Key android:codes="36" android:keyLabel="h"/>
<Key android:codes="38" android:keyLabel="j"/>
<Key android:codes="39" android:keyLabel="k"/>
<Key android:codes="40" android:keyLabel="l"/>
<Key android:codes="74" android:keyLabel=";"/>
<Key android:codes="115" android:keyLabel="Caps" android:keyEdgeFlags="right"/>
</Row>
<Row>
<Key android:codes="59" android:keyLabel="SHFT" android:keyEdgeFlags="left"/>
<Key android:codes="54" android:keyLabel="z"/>
<Key android:codes="52" android:keyLabel="x"/>
<Key android:codes="31" android:keyLabel="c"/>
<Key android:codes="50" android:keyLabel="v"/>
<Key android:codes="30" android:keyLabel="b"/>
<Key android:codes="42" android:keyLabel="n"/>
<Key android:codes="41" android:keyLabel="m"/>
<Key android:codes="55" android:keyLabel=","/>
<Key android:codes="56" android:keyLabel="."/>
<Key android:codes="76" android:keyLabel="/"/>
<Key android:codes="60" android:keyLabel="SHFT" android:keyEdgeFlags="right"/>
</Row>
<Row android:rowEdgeFlags="bottom">
<Key android:codes="73" android:keyLabel="\\" android:keyEdgeFlags="left"/>
<Key android:codes="69" android:keyLabel="-"/>
<Key android:codes="81" android:keyLabel="+"/>
<Key android:codes="70" android:keyLabel="="/>
<Key android:codes="62" android:keyLabel="SPACE" android:keyWidth="30%p" />
<Key android:codes="71" android:keyLabel="["/>
<Key android:codes="72" android:keyLabel="]"/>
<Key android:codes="18" android:keyLabel="#"/>
<Key android:codes="68" android:keyLabel="INV" android:keyEdgeFlags="right"/>
</Row>
</Keyboard>

View File

@ -0,0 +1,85 @@
<?xml version="1.0"?>
<!-- When creating new keyboard layout, add it to TextInputKeyboardList array in project/java/MainActivity.java -->
<Keyboard xmlns:android="http://schemas.android.com/apk/res/android"
android:keyWidth="10%p"
android:horizontalGap="0px"
android:verticalGap="0px"
android:keyHeight="10%p">
<Row>
<Key android:codes="113" android:keyLabel="C=" android:keyEdgeFlags="left"/>
<Key android:codes="111" android:keyLabel="RS" />
<Key android:codes="5" android:keyLabel="CTRL" />
<Key android:codes="126" android:keyLabel="F1" />
<Key android:codes="103" android:keyLabel="F3" />
<Key android:codes="104" android:keyLabel="F5" />
<Key android:codes="105" android:keyLabel="F7" />
<Key android:codes="3" android:keyLabel="Home" />
<Key android:codes="71" android:keyLabel="\@" />
<Key android:codes="67" android:keyLabel="DEL" android:keyEdgeFlags="right"/>
</Row>
<Row>
<Key android:codes="8" android:keyLabel="1" android:keyEdgeFlags="left"/>
<Key android:codes="9" android:keyLabel="2"/>
<Key android:codes="10" android:keyLabel="3"/>
<Key android:codes="11" android:keyLabel="4"/>
<Key android:codes="12" android:keyLabel="5"/>
<Key android:codes="13" android:keyLabel="6"/>
<Key android:codes="14" android:keyLabel="7"/>
<Key android:codes="15" android:keyLabel="8"/>
<Key android:codes="16" android:keyLabel="9"/>
<Key android:codes="7" android:keyLabel="0" />
<Key android:codes="69" android:keyLabel="+" />
<Key android:codes="70" android:keyLabel="-" android:keyEdgeFlags="right"/>
</Row>
<Row>
<Key android:codes="45" android:keyLabel="q" android:keyEdgeFlags="left"/>
<Key android:codes="51" android:keyLabel="w"/>
<Key android:codes="33" android:keyLabel="e"/>
<Key android:codes="46" android:keyLabel="r"/>
<Key android:codes="48" android:keyLabel="t"/>
<Key android:codes="53" android:keyLabel="y"/>
<Key android:codes="49" android:keyLabel="u"/>
<Key android:codes="37" android:keyLabel="i"/>
<Key android:codes="43" android:keyLabel="o"/>
<Key android:codes="44" android:keyLabel="p"/>
<Key android:codes="72" android:keyLabel="*"/>
<Key android:codes="92" android:keyLabel="RST" android:keyEdgeFlags="right"/>
</Row>
<Row>
<Key android:codes="115" android:keyLabel="SL" android:keyEdgeFlags="left"/>
<Key android:codes="29" android:keyLabel="a"/>
<Key android:codes="47" android:keyLabel="s"/>
<Key android:codes="32" android:keyLabel="d"/>
<Key android:codes="34" android:keyLabel="f"/>
<Key android:codes="35" android:keyLabel="g"/>
<Key android:codes="36" android:keyLabel="h"/>
<Key android:codes="38" android:keyLabel="j"/>
<Key android:codes="39" android:keyLabel="k"/>
<Key android:codes="40" android:keyLabel="l"/>
<Key android:codes="74" android:keyLabel=":"/>
<Key android:codes="75" android:keyLabel=";" android:keyEdgeFlags="right"/>
</Row>
<Row>
<Key android:codes="59" android:keyLabel="SHFT" android:keyEdgeFlags="left"/>
<Key android:codes="54" android:keyLabel="z"/>
<Key android:codes="52" android:keyLabel="x"/>
<Key android:codes="31" android:keyLabel="c"/>
<Key android:codes="50" android:keyLabel="v"/>
<Key android:codes="30" android:keyLabel="b"/>
<Key android:codes="42" android:keyLabel="n"/>
<Key android:codes="41" android:keyLabel="m"/>
<Key android:codes="55" android:keyLabel=","/>
<Key android:codes="56" android:keyLabel="."/>
<Key android:codes="76" android:keyLabel="/"/>
<Key android:codes="60" android:keyLabel="SHFT" android:keyEdgeFlags="right"/>
</Row>
<Row android:rowEdgeFlags="bottom">
<Key android:codes="124" android:keyLabel="GBP" android:keyWidth="10%p" android:keyEdgeFlags="left"/>
<Key android:codes="68" android:keyLabel="-" android:keyWidth="10%p"/>
<Key android:codes="112" android:keyLabel="|" android:keyWidth="10%p"/>
<Key android:codes="62" android:keyLabel="SPACE" android:keyWidth="40%p"/>
<Key android:codes="73" android:keyLabel="=" android:keyWidth="10%p"/>
<Key android:codes="23" android:keyLabel="RETURN" android:keyWidth="20%p" android:keyEdgeFlags="right"/>
</Row>
</Keyboard>

View File

@ -0,0 +1,53 @@
<?xml version="1.0"?>
<!-- When creating new keyboard layout, add it to TextInputKeyboardList array in project/java/MainActivity.java -->
<Keyboard xmlns:android="http://schemas.android.com/apk/res/android"
android:keyWidth="10%p"
android:horizontalGap="0px"
android:verticalGap="0px"
android:keyHeight="10%p">
<Row>
<Key android:codes="45" android:keyLabel="q" android:keyEdgeFlags="left" android:isRepeatable="true"/>
<Key android:codes="51" android:keyLabel="w" android:isRepeatable="true"/>
<Key android:codes="33" android:keyLabel="e" android:isRepeatable="true"/>
<Key android:codes="46" android:keyLabel="r" android:isRepeatable="true"/>
<Key android:codes="48" android:keyLabel="t" android:isRepeatable="true"/>
<Key android:codes="53" android:keyLabel="y" android:isRepeatable="true"/>
<Key android:codes="49" android:keyLabel="u" android:isRepeatable="true"/>
<Key android:codes="37" android:keyLabel="i" android:isRepeatable="true"/>
<Key android:codes="43" android:keyLabel="o" android:isRepeatable="true"/>
<Key android:codes="44" android:keyLabel="p" android:keyEdgeFlags="right" android:isRepeatable="true"/>
</Row>
<Row>
<Key android:codes="29" android:keyLabel="a" android:keyEdgeFlags="left" android:isRepeatable="true"/>
<Key android:codes="47" android:keyLabel="s" android:isRepeatable="true"/>
<Key android:codes="32" android:keyLabel="d" android:isRepeatable="true"/>
<Key android:codes="34" android:keyLabel="f" android:isRepeatable="true"/>
<Key android:codes="35" android:keyLabel="g" android:isRepeatable="true"/>
<Key android:codes="36" android:keyLabel="h" android:isRepeatable="true"/>
<Key android:codes="38" android:keyLabel="j" android:isRepeatable="true"/>
<Key android:codes="39" android:keyLabel="k" android:isRepeatable="true"/>
<Key android:codes="40" android:keyLabel="l" android:isRepeatable="true"/>
<Key android:codes="74" android:keyLabel=";" android:keyEdgeFlags="right" android:isRepeatable="true"/>
</Row>
<Row>
<Key android:codes="-1" android:keyLabel="⇪" android:keyEdgeFlags="left"/>
<Key android:codes="54" android:keyLabel="z" android:isRepeatable="true"/>
<Key android:codes="52" android:keyLabel="x" android:isRepeatable="true"/>
<Key android:codes="31" android:keyLabel="c" android:isRepeatable="true"/>
<Key android:codes="50" android:keyLabel="v" android:isRepeatable="true"/>
<Key android:codes="30" android:keyLabel="b" android:isRepeatable="true"/>
<Key android:codes="42" android:keyLabel="n" android:isRepeatable="true"/>
<Key android:codes="41" android:keyLabel="m" android:isRepeatable="true"/>
<Key android:codes="67" android:keyLabel="≪ ×" android:keyWidth="20%p" android:keyEdgeFlags="right" android:isRepeatable="true"/>
</Row>
<Row android:rowEdgeFlags="bottom">
<Key android:codes="-6" android:keyLabel="123…" android:keyEdgeFlags="left"/>
<Key android:codes="71" android:keyLabel="[" android:isRepeatable="true"/>
<Key android:codes="72" android:keyLabel="]" android:isRepeatable="true"/>
<Key android:codes="76" android:keyLabel="/" android:isRepeatable="true"/>
<Key android:codes="62" android:keyLabel="Space" android:keyWidth="20%p" android:isRepeatable="true"/>
<Key android:codes="55" android:keyLabel="," android:isRepeatable="true"/>
<Key android:codes="56" android:keyLabel="." android:isRepeatable="true"/>
<Key android:codes="66" android:keyLabel="Enter" android:keyWidth="20%p" android:keyEdgeFlags="right" android:isRepeatable="true"/>
</Row>
</Keyboard>

View File

@ -0,0 +1,57 @@
<?xml version="1.0"?>
<!-- When creating new keyboard layout, add it to TextInputKeyboardList array in project/java/MainActivity.java -->
<Keyboard xmlns:android="http://schemas.android.com/apk/res/android"
android:keyWidth="10%p"
android:horizontalGap="0px"
android:verticalGap="0px"
android:keyHeight="10%p">
<Row>
<Key android:codes="8" android:keyLabel="1" android:keyEdgeFlags="left" android:isRepeatable="true"/>
<Key android:codes="9" android:keyLabel="2" android:isRepeatable="true"/>
<Key android:codes="10" android:keyLabel="3" android:isRepeatable="true"/>
<Key android:codes="11" android:keyLabel="4" android:isRepeatable="true"/>
<Key android:codes="12" android:keyLabel="5" android:isRepeatable="true"/>
<Key android:codes="13" android:keyLabel="6" android:isRepeatable="true"/>
<Key android:codes="14" android:keyLabel="7" android:isRepeatable="true"/>
<Key android:codes="15" android:keyLabel="8" android:isRepeatable="true"/>
<Key android:codes="16" android:keyLabel="9" android:isRepeatable="true"/>
<Key android:codes="7" android:keyLabel="0" android:keyEdgeFlags="right" android:isRepeatable="true"/>
</Row>
<Row>
<Key android:codes="111" android:keyLabel="Esc" android:keyEdgeFlags="left" android:isRepeatable="true"/>
<Key android:codes="68" android:keyLabel="`" android:isRepeatable="true"/>
<Key android:codes="69" android:keyLabel="-" android:isRepeatable="true"/>
<Key android:codes="70" android:keyLabel="=" android:isRepeatable="true"/>
<Key android:codes="73" android:keyLabel="\\" android:isRepeatable="true"/>
<Key android:codes="124" android:keyLabel="Ins" android:isRepeatable="true"/>
<Key android:codes="92" android:keyLabel="PgUp" android:isRepeatable="true"/>
<Key android:codes="122" android:keyLabel="Home" android:isRepeatable="true"/>
<Key android:codes="19" android:keyLabel="↑" android:isRepeatable="true"/>
<Key android:codes="123" android:keyLabel="End" android:isRepeatable="true" android:keyEdgeFlags="right" />
</Row>
<Row>
<Key android:codes="-1" android:keyLabel="!@#…" android:keyEdgeFlags="left"/>
<Key android:codes="75" android:keyLabel="'" android:isRepeatable="true"/>
<Key android:codes="100075" android:keyLabel="&quot;" android:isRepeatable="true"/>
<Key android:codes="61" android:keyLabel="Tab" android:isRepeatable="true"/>
<Key android:codes="115" android:keyLabel="CapsLk" android:isRepeatable="true"/>
<Key android:codes="112" android:keyLabel="Del" android:isRepeatable="true"/>
<Key android:codes="93" android:keyLabel="PgDn" android:isRepeatable="true"/>
<Key android:codes="21" android:keyLabel="←" android:isRepeatable="true"/>
<Key android:codes="20" android:keyLabel="↓" android:isRepeatable="true"/>
<Key android:codes="22" android:keyLabel="→" android:keyEdgeFlags="right" android:isRepeatable="true"/>
</Row>
<Row android:rowEdgeFlags="bottom">
<Key android:codes="-6" android:keyLabel="abc…" android:keyEdgeFlags="left"/>
<Key android:codes="59" android:keyLabel="Shift" android:isSticky="true"/>
<Key android:codes="113" android:keyLabel="Ctrl" android:isSticky="true"/>
<Key android:codes="117" android:keyLabel="Meta" android:isSticky="true"/>
<Key android:codes="57" android:keyLabel="Alt" android:isSticky="true"/>
<Key android:codes="58" android:keyLabel="Alt" android:isSticky="true"/>
<Key android:codes="118" android:keyLabel="Meta" android:isSticky="true"/>
<Key android:codes="226" android:keyLabel="Menu" android:isRepeatable="true"/>
<Key android:codes="114" android:keyLabel="Ctrl" android:isSticky="true"/>
<Key android:codes="60" android:keyLabel="Shift" android:isSticky="true"/>
</Row>
</Keyboard>

View File

@ -0,0 +1,57 @@
<?xml version="1.0"?>
<!-- When creating new keyboard layout, add it to TextInputKeyboardList array in project/java/MainActivity.java -->
<Keyboard xmlns:android="http://schemas.android.com/apk/res/android"
android:keyWidth="10%p"
android:horizontalGap="0px"
android:verticalGap="0px"
android:keyHeight="10%p">
<Row>
<Key android:codes="100008" android:keyLabel="!" android:keyEdgeFlags="left" android:isRepeatable="true"/>
<Key android:codes="100009" android:keyLabel="\@" android:isRepeatable="true"/>
<Key android:codes="100010" android:keyLabel="#" android:isRepeatable="true"/>
<Key android:codes="100011" android:keyLabel="$" android:isRepeatable="true"/>
<Key android:codes="100012" android:keyLabel="%" android:isRepeatable="true"/>
<Key android:codes="100013" android:keyLabel="^" android:isRepeatable="true"/>
<Key android:codes="100014" android:keyLabel="&amp;" android:isRepeatable="true"/>
<Key android:codes="100015" android:keyLabel="*" android:isRepeatable="true"/>
<Key android:codes="100016" android:keyLabel="(" android:isRepeatable="true"/>
<Key android:codes="100007" android:keyLabel=")" android:keyEdgeFlags="right" android:isRepeatable="true"/>
</Row>
<Row>
<Key android:codes="111" android:keyLabel="Esc" android:keyEdgeFlags="left" android:isRepeatable="true"/>
<Key android:codes="100068" android:keyLabel="~" android:isRepeatable="true"/>
<Key android:codes="100069" android:keyLabel="_" android:isRepeatable="true"/>
<Key android:codes="100070" android:keyLabel="+" android:isRepeatable="true"/>
<Key android:codes="100073" android:keyLabel="|" android:isRepeatable="true"/>
<Key android:codes="100075" android:keyLabel="&quot;" android:isRepeatable="true"/>
<Key android:codes="131" android:keyLabel="F1" android:isRepeatable="true"/>
<Key android:codes="132" android:keyLabel="F2" android:isRepeatable="true"/>
<Key android:codes="133" android:keyLabel="F3" android:isRepeatable="true"/>
<Key android:codes="134" android:keyLabel="F4" android:isRepeatable="true" android:keyEdgeFlags="right" />
</Row>
<Row>
<Key android:codes="-1" android:keyLabel="123…" android:keyEdgeFlags="left"/>
<Key android:codes="143" android:keyLabel="NumLk" android:isSticky="true"/>
<Key android:codes="120" android:keyLabel="Print" android:isRepeatable="true"/>
<Key android:codes="116" android:keyLabel="ScrollLk" android:isRepeatable="true"/>
<Key android:codes="121" android:keyLabel="Pause" android:isRepeatable="true"/>
<Key android:codes="158" android:keyLabel="Kp ." android:isRepeatable="true"/>
<Key android:codes="135" android:keyLabel="F5" android:isRepeatable="true"/>
<Key android:codes="136" android:keyLabel="F6" android:isRepeatable="true"/>
<Key android:codes="137" android:keyLabel="F7" android:isRepeatable="true"/>
<Key android:codes="138" android:keyLabel="F8" android:keyEdgeFlags="right" android:isRepeatable="true"/>
</Row>
<Row android:rowEdgeFlags="bottom">
<Key android:codes="-6" android:keyLabel="abc…" android:keyEdgeFlags="left"/>
<Key android:codes="154" android:keyLabel="Kp /" android:isRepeatable="true"/>
<Key android:codes="155" android:keyLabel="Kp *" android:isRepeatable="true"/>
<Key android:codes="156" android:keyLabel="Kp -" android:isRepeatable="true"/>
<Key android:codes="157" android:keyLabel="Kp +" android:isRepeatable="true"/>
<Key android:codes="160" android:keyLabel="Kp ↵" android:isRepeatable="true"/>
<Key android:codes="139" android:keyLabel="F9" android:isRepeatable="true"/>
<Key android:codes="140" android:keyLabel="F10" android:isRepeatable="true"/>
<Key android:codes="141" android:keyLabel="F11" android:isRepeatable="true"/>
<Key android:codes="142" android:keyLabel="F12" android:keyEdgeFlags="right" android:isRepeatable="true"/>
</Row>
</Keyboard>

View File

@ -0,0 +1,53 @@
<?xml version="1.0"?>
<!-- When creating new keyboard layout, add it to TextInputKeyboardList array in project/java/MainActivity.java -->
<Keyboard xmlns:android="http://schemas.android.com/apk/res/android"
android:keyWidth="10%p"
android:horizontalGap="0px"
android:verticalGap="0px"
android:keyHeight="10%p">
<Row>
<Key android:codes="45" android:keyLabel="Q" android:keyEdgeFlags="left" android:isRepeatable="true"/>
<Key android:codes="51" android:keyLabel="W" android:isRepeatable="true"/>
<Key android:codes="33" android:keyLabel="E" android:isRepeatable="true"/>
<Key android:codes="46" android:keyLabel="R" android:isRepeatable="true"/>
<Key android:codes="48" android:keyLabel="T" android:isRepeatable="true"/>
<Key android:codes="53" android:keyLabel="Y" android:isRepeatable="true"/>
<Key android:codes="49" android:keyLabel="U" android:isRepeatable="true"/>
<Key android:codes="37" android:keyLabel="I" android:isRepeatable="true"/>
<Key android:codes="43" android:keyLabel="O" android:isRepeatable="true"/>
<Key android:codes="44" android:keyLabel="P" android:keyEdgeFlags="right" android:isRepeatable="true"/>
</Row>
<Row>
<Key android:codes="29" android:keyLabel="A" android:keyEdgeFlags="left" android:isRepeatable="true"/>
<Key android:codes="47" android:keyLabel="S" android:isRepeatable="true"/>
<Key android:codes="32" android:keyLabel="D" android:isRepeatable="true"/>
<Key android:codes="34" android:keyLabel="F" android:isRepeatable="true"/>
<Key android:codes="35" android:keyLabel="G" android:isRepeatable="true"/>
<Key android:codes="36" android:keyLabel="H" android:isRepeatable="true"/>
<Key android:codes="38" android:keyLabel="J" android:isRepeatable="true"/>
<Key android:codes="39" android:keyLabel="K" android:isRepeatable="true"/>
<Key android:codes="40" android:keyLabel="L" android:isRepeatable="true"/>
<Key android:codes="74" android:keyLabel=":" android:keyEdgeFlags="right" android:isRepeatable="true"/>
</Row>
<Row>
<Key android:codes="-1" android:keyLabel="⇫" android:keyEdgeFlags="left"/>
<Key android:codes="54" android:keyLabel="Z" android:isRepeatable="true"/>
<Key android:codes="52" android:keyLabel="X" android:isRepeatable="true"/>
<Key android:codes="31" android:keyLabel="C" android:isRepeatable="true"/>
<Key android:codes="50" android:keyLabel="V" android:isRepeatable="true"/>
<Key android:codes="30" android:keyLabel="B" android:isRepeatable="true"/>
<Key android:codes="42" android:keyLabel="N" android:isRepeatable="true"/>
<Key android:codes="41" android:keyLabel="M" android:isRepeatable="true"/>
<Key android:codes="67" android:keyLabel="≪ ×" android:keyWidth="20%p" android:keyEdgeFlags="right" android:isRepeatable="true"/>
</Row>
<Row android:rowEdgeFlags="bottom">
<Key android:codes="-6" android:keyLabel="!@#…" android:keyEdgeFlags="left"/>
<Key android:codes="71" android:keyLabel="{" android:isRepeatable="true"/>
<Key android:codes="72" android:keyLabel="}" android:isRepeatable="true"/>
<Key android:codes="76" android:keyLabel="\?" android:isRepeatable="true"/>
<Key android:codes="62" android:keyLabel="Space" android:keyWidth="20%p" android:isRepeatable="true"/>
<Key android:codes="55" android:keyLabel="&lt;" android:isRepeatable="true"/>
<Key android:codes="56" android:keyLabel="&gt;" android:isRepeatable="true"/>
<Key android:codes="66" android:keyLabel="Enter" android:keyWidth="20%p" android:keyEdgeFlags="right" android:isRepeatable="true"/>
</Row>
</Keyboard>

View File

@ -0,0 +1,17 @@
package io.neoterm;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
}

View File

@ -1 +1 @@
include ':app', ':chrome-tabs', ':NeoLang'
include ':app', ':chrome-tabs', ':NeoLang', ':Xorg'