Merge commit 'dec0d4ec4153bf9fc2b78ae6c2df45b6ea8dde7a' as 'external/sdl/SDL'
70
external/sdl/SDL/test/android/cmake/AndroidManifest.xml.cmake
vendored
Normal file
@ -0,0 +1,70 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
package="@ANDROID_MANIFEST_PACKAGE@">
|
||||
|
||||
<!-- OpenGL ES 2.0 -->
|
||||
<uses-feature android:glEsVersion="0x00020000" />
|
||||
|
||||
<!-- Touchscreen support -->
|
||||
<uses-feature
|
||||
android:name="android.hardware.touchscreen"
|
||||
android:required="false" />
|
||||
|
||||
<!-- Game controller support -->
|
||||
<uses-feature
|
||||
android:name="android.hardware.bluetooth"
|
||||
android:required="false" />
|
||||
<uses-feature
|
||||
android:name="android.hardware.gamepad"
|
||||
android:required="false" />
|
||||
<uses-feature
|
||||
android:name="android.hardware.usb.host"
|
||||
android:required="false" />
|
||||
|
||||
<!-- External mouse input events -->
|
||||
<uses-feature
|
||||
android:name="android.hardware.type.pc"
|
||||
android:required="false" />
|
||||
|
||||
<!-- Allow access to the vibrator -->
|
||||
<uses-permission android:name="android.permission.VIBRATE" />
|
||||
|
||||
<!-- Allow access to the microphone -->
|
||||
<uses-permission android:name="android.permission.RECORD_AUDIO" />
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:icon="@mipmap/sdl-test"
|
||||
android:roundIcon="@mipmap/sdl-test_round"
|
||||
android:label="@string/label"
|
||||
android:supportsRtl="true"
|
||||
android:hardwareAccelerated="true"
|
||||
tools:targetApi="31">
|
||||
<activity
|
||||
android:name="@ANDROID_MANIFEST_PACKAGE@.SDLTestActivity"
|
||||
android:exported="true"
|
||||
android:label="@string/label"
|
||||
android:alwaysRetainTaskState="true"
|
||||
android:launchMode="singleInstance"
|
||||
android:configChanges="layoutDirection|locale|orientation|uiMode|screenLayout|screenSize|smallestScreenSize|keyboard|keyboardHidden|navigation"
|
||||
android:preferMinimalPostProcessing="true"
|
||||
android:screenOrientation="fullSensor">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" />
|
||||
</intent-filter>
|
||||
<meta-data
|
||||
android:name="android.app.shortcuts"
|
||||
android:resource="@xml/shortcuts" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name="@ANDROID_MANIFEST_PACKAGE@.SDLEntryTestActivity"
|
||||
android:exported="false"
|
||||
android:label="@string/label">
|
||||
</activity>
|
||||
</application>
|
||||
</manifest>
|
121
external/sdl/SDL/test/android/cmake/SDLEntryTestActivity.java.cmake
vendored
Normal file
@ -0,0 +1,121 @@
|
||||
package @ANDROID_MANIFEST_PACKAGE@;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
|
||||
import org.libsdl.app.SDL;
|
||||
import org.libsdl.app.SDLActivity;
|
||||
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.LayoutInflater;
|
||||
|
||||
public class SDLEntryTestActivity extends Activity {
|
||||
|
||||
public String MODIFY_ARGUMENTS = "@ANDROID_MANIFEST_PACKAGE@.MODIFY_ARGUMENTS";
|
||||
boolean isModifyingArguments;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
Log.v("SDL", "SDLEntryTestActivity onCreate");
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
String intent_action = getIntent().getAction();
|
||||
Log.v("SDL", "SDLEntryTestActivity intent.action = " + intent_action);
|
||||
|
||||
if (intent_action == MODIFY_ARGUMENTS) {
|
||||
isModifyingArguments = true;
|
||||
createArgumentLayout();
|
||||
} else {
|
||||
startChildActivityAndFinish();
|
||||
}
|
||||
}
|
||||
|
||||
protected void createArgumentLayout() {
|
||||
LayoutInflater inflater = getLayoutInflater();
|
||||
View view = inflater.inflate(R.layout.arguments_layout, null);
|
||||
setContentView(view);
|
||||
|
||||
Button button = (Button)requireViewById(R.id.arguments_start_button);
|
||||
button.setOnClickListener(new View.OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
startChildActivityAndFinish();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected String[] getArguments() {
|
||||
if (!isModifyingArguments) {
|
||||
return new String[0];
|
||||
}
|
||||
EditText editText = (EditText)findViewById(R.id.arguments_edit);
|
||||
String text = editText.getText().toString();
|
||||
String new_text = text.replace("[ \t]*[ \t\n]+[ \t]+", "\n").strip();
|
||||
Log.v("SDL", "text = " + text + "\n becomes \n" + new_text);
|
||||
return new_text.split("\n", 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStart() {
|
||||
Log.v("SDL", "SDLEntryTestActivity onStart");
|
||||
super.onStart();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
Log.v("SDL", "SDLEntryTestActivity onResume");
|
||||
super.onResume();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
Log.v("SDL", "SDLEntryTestActivity onPause");
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
Log.v("SDL", "SDLEntryTestActivity onStop");
|
||||
super.onStop();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
Log.v("SDL", "SDLEntryTestActivity onDestroy");
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onRestoreInstanceState(Bundle savedInstanceState) {
|
||||
Log.v("SDL", "SDLEntryTestActivity onRestoreInstanceState");
|
||||
super.onRestoreInstanceState(savedInstanceState);
|
||||
EditText editText = (EditText)findViewById(R.id.arguments_edit);
|
||||
editText.setText(savedInstanceState.getCharSequence("args", ""), TextView.BufferType.EDITABLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onSaveInstanceState(Bundle outState) {
|
||||
Log.v("SDL", "SDLEntryTestActivity onSaveInstanceState");
|
||||
EditText editText = (EditText)findViewById(R.id.arguments_edit);
|
||||
outState.putCharSequence("args", editText.getText());
|
||||
super.onSaveInstanceState(outState);
|
||||
}
|
||||
|
||||
private void startChildActivityAndFinish() {
|
||||
Intent intent = new Intent(Intent.ACTION_MAIN);
|
||||
intent.addCategory(Intent.CATEGORY_LAUNCHER);
|
||||
intent.setClassName("@ANDROID_MANIFEST_PACKAGE@", "@ANDROID_MANIFEST_PACKAGE@.SDLTestActivity");
|
||||
intent.putExtra("arguments", getArguments());
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}
|
||||
}
|
33
external/sdl/SDL/test/android/cmake/SDLTestActivity.java.cmake
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
package @ANDROID_MANIFEST_PACKAGE@;
|
||||
|
||||
import org.libsdl.app.SDLActivity;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
|
||||
public class SDLTestActivity extends SDLActivity {
|
||||
private String[] m_arguments;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
m_arguments = getIntent().getStringArrayExtra("arguments");
|
||||
if (m_arguments == null) {
|
||||
m_arguments = new String[0];
|
||||
}
|
||||
super.onCreate(savedInstanceState);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String[] getLibraries() {
|
||||
return new String[] { getString(R.string.lib_name) };
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String[] getArguments() {
|
||||
Log.v("SDLTest", "#arguments = " + m_arguments.length);
|
||||
for(int i = 0; i < m_arguments.length; i++) {
|
||||
Log.v("SDLTest", "argument[" + i + "] = " + m_arguments[i]);
|
||||
}
|
||||
return m_arguments;
|
||||
}
|
||||
}
|
5
external/sdl/SDL/test/android/cmake/res/values/strings.xml.cmake
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
<resources>
|
||||
<string name="app_name">@ANDROID_MANIFEST_APP_NAME@</string>
|
||||
<string name="lib_name">@ANDROID_MANIFEST_LIB_NAME@</string>
|
||||
<string name="label">@ANDROID_MANIFEST_LABEL@</string>
|
||||
</resources>
|
24
external/sdl/SDL/test/android/cmake/res/xml/shortcuts.xml.cmake
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shortcuts xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<shortcut
|
||||
android:shortcutId="modifyArguments"
|
||||
android:enabled="true"
|
||||
android:icon="@drawable/sdl-test_foreground"
|
||||
android:shortcutShortLabel="@string/shortcutModifyArgumentsShortLabel">
|
||||
<intent
|
||||
android:action="@ANDROID_MANIFEST_PACKAGE@.MODIFY_ARGUMENTS"
|
||||
android:targetPackage="@ANDROID_MANIFEST_PACKAGE@"
|
||||
android:targetClass="@ANDROID_MANIFEST_PACKAGE@.SDLEntryTestActivity" />
|
||||
</shortcut>
|
||||
<shortcut
|
||||
android:shortcutId="intermediateActivity"
|
||||
android:enabled="true"
|
||||
android:icon="@drawable/sdl-test_foreground"
|
||||
android:shortcutShortLabel="@string/shortcutIntermediateActivityShortLabel">
|
||||
<intent
|
||||
android:action="android.intent.action.MAIN"
|
||||
android:targetPackage="@ANDROID_MANIFEST_PACKAGE@"
|
||||
android:targetClass="@ANDROID_MANIFEST_PACKAGE@.SDLEntryTestActivity" />
|
||||
</shortcut>
|
||||
<!-- Specify more shortcuts here. -->
|
||||
</shortcuts>
|
102
external/sdl/SDL/test/android/res/drawable/sdl-test_foreground.xml
vendored
Normal file
26
external/sdl/SDL/test/android/res/layout/arguments_layout.xml
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="16dp"
|
||||
android:orientation="vertical" >
|
||||
<TextView
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:inputType="textImeMultiLine|textNoSuggestions"
|
||||
android:text="@string/label_enter_arguments" />
|
||||
<EditText
|
||||
android:id="@+id/arguments_edit"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:gravity="top"
|
||||
android:hint="@string/hint_enter_arguments_here" />
|
||||
<Button
|
||||
android:id="@+id/arguments_start_button"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="end"
|
||||
android:text="@string/button_start_app" />
|
||||
</LinearLayout>
|
5
external/sdl/SDL/test/android/res/mipmap-anydpi-v26/sdl-test.xml
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@color/sdl-test_background"/>
|
||||
<foreground android:drawable="@drawable/sdl-test_foreground"/>
|
||||
</adaptive-icon>
|
5
external/sdl/SDL/test/android/res/mipmap-anydpi-v26/sdl-test_round.xml
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@color/sdl-test_background"/>
|
||||
<foreground android:drawable="@drawable/sdl-test_foreground"/>
|
||||
</adaptive-icon>
|
BIN
external/sdl/SDL/test/android/res/mipmap-hdpi/sdl-test.png
vendored
Normal file
After Width: | Height: | Size: 3.0 KiB |
BIN
external/sdl/SDL/test/android/res/mipmap-hdpi/sdl-test_round.png
vendored
Normal file
After Width: | Height: | Size: 5.2 KiB |
BIN
external/sdl/SDL/test/android/res/mipmap-mdpi/sdl-test.png
vendored
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
external/sdl/SDL/test/android/res/mipmap-mdpi/sdl-test_round.png
vendored
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
external/sdl/SDL/test/android/res/mipmap-xhdpi/sdl-test.png
vendored
Normal file
After Width: | Height: | Size: 4.3 KiB |
BIN
external/sdl/SDL/test/android/res/mipmap-xhdpi/sdl-test_round.png
vendored
Normal file
After Width: | Height: | Size: 7.6 KiB |
BIN
external/sdl/SDL/test/android/res/mipmap-xxhdpi/sdl-test.png
vendored
Normal file
After Width: | Height: | Size: 7.2 KiB |
BIN
external/sdl/SDL/test/android/res/mipmap-xxhdpi/sdl-test_round.png
vendored
Normal file
After Width: | Height: | Size: 13 KiB |
BIN
external/sdl/SDL/test/android/res/mipmap-xxxhdpi/sdl-test.png
vendored
Normal file
After Width: | Height: | Size: 11 KiB |
BIN
external/sdl/SDL/test/android/res/mipmap-xxxhdpi/sdl-test_round.png
vendored
Normal file
After Width: | Height: | Size: 19 KiB |
7
external/sdl/SDL/test/android/res/values/arg_strings.xml
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
<resources>
|
||||
<string name="label_enter_arguments">Arguments</string>
|
||||
<string name="hint_enter_arguments_here">One argument per line.\ne.g.\n--track-mem\n--windows\n3</string>
|
||||
<string name="button_start_app">Start</string>
|
||||
<string name="shortcutModifyArgumentsShortLabel">Modify arguments</string>
|
||||
<string name="shortcutIntermediateActivityShortLabel">Pass through activity</string>
|
||||
</resources>
|
4
external/sdl/SDL/test/android/res/values/sdl-test_background.xml
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="sdl-test_background">#FFFFFF</color>
|
||||
</resources>
|