diff options
Diffstat (limited to 'src/contrib/SDL-3.2.20/test/android/cmake')
5 files changed, 257 insertions, 0 deletions
diff --git a/src/contrib/SDL-3.2.20/test/android/cmake/AndroidManifest.xml.cmake b/src/contrib/SDL-3.2.20/test/android/cmake/AndroidManifest.xml.cmake new file mode 100644 index 0000000..06d87af --- /dev/null +++ b/src/contrib/SDL-3.2.20/test/android/cmake/AndroidManifest.xml.cmake | |||
@@ -0,0 +1,74 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
3 | xmlns:tools="http://schemas.android.com/tools" | ||
4 | package="@ANDROID_MANIFEST_PACKAGE@"> | ||
5 | |||
6 | <!-- OpenGL ES 2.0 --> | ||
7 | <uses-feature android:glEsVersion="0x00020000" /> | ||
8 | |||
9 | <!-- Touchscreen support --> | ||
10 | <uses-feature | ||
11 | android:name="android.hardware.touchscreen" | ||
12 | android:required="false" /> | ||
13 | |||
14 | <!-- Game controller support --> | ||
15 | <uses-feature | ||
16 | android:name="android.hardware.bluetooth" | ||
17 | android:required="false" /> | ||
18 | <uses-feature | ||
19 | android:name="android.hardware.gamepad" | ||
20 | android:required="false" /> | ||
21 | <uses-feature | ||
22 | android:name="android.hardware.usb.host" | ||
23 | android:required="false" /> | ||
24 | |||
25 | <!-- External mouse input events --> | ||
26 | <uses-feature | ||
27 | android:name="android.hardware.type.pc" | ||
28 | android:required="false" /> | ||
29 | |||
30 | <!-- Allow access to the vibrator --> | ||
31 | <uses-permission android:name="android.permission.VIBRATE" /> | ||
32 | |||
33 | <!-- Allow access to the microphone --> | ||
34 | <uses-permission android:name="android.permission.RECORD_AUDIO" /> | ||
35 | |||
36 | <!-- Allow access to the camera --> | ||
37 | <uses-permission android:name="android.permission.CAMERA" /> | ||
38 | <uses-feature android:name="android.hardware.camera" /> | ||
39 | |||
40 | <application | ||
41 | android:allowBackup="true" | ||
42 | android:icon="@mipmap/sdl-test" | ||
43 | android:roundIcon="@mipmap/sdl-test_round" | ||
44 | android:label="@string/label" | ||
45 | android:supportsRtl="true" | ||
46 | android:theme="@style/AppTheme" | ||
47 | android:hardwareAccelerated="true"> | ||
48 | <activity | ||
49 | android:name="@ANDROID_MANIFEST_PACKAGE@.SDLTestActivity" | ||
50 | android:exported="true" | ||
51 | android:label="@string/label" | ||
52 | android:alwaysRetainTaskState="true" | ||
53 | android:launchMode="singleInstance" | ||
54 | android:configChanges="layoutDirection|locale|orientation|uiMode|screenLayout|screenSize|smallestScreenSize|keyboard|keyboardHidden|navigation" | ||
55 | android:preferMinimalPostProcessing="true" | ||
56 | android:screenOrientation="fullSensor"> | ||
57 | <intent-filter> | ||
58 | <action android:name="android.intent.action.MAIN" /> | ||
59 | <category android:name="android.intent.category.LAUNCHER" /> | ||
60 | </intent-filter> | ||
61 | <intent-filter> | ||
62 | <action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" /> | ||
63 | </intent-filter> | ||
64 | <meta-data | ||
65 | android:name="android.app.shortcuts" | ||
66 | android:resource="@xml/shortcuts" /> | ||
67 | </activity> | ||
68 | <activity | ||
69 | android:name="@ANDROID_MANIFEST_PACKAGE@.SDLEntryTestActivity" | ||
70 | android:exported="false" | ||
71 | android:label="@string/label"> | ||
72 | </activity> | ||
73 | </application> | ||
74 | </manifest> | ||
diff --git a/src/contrib/SDL-3.2.20/test/android/cmake/SDLEntryTestActivity.java.cmake b/src/contrib/SDL-3.2.20/test/android/cmake/SDLEntryTestActivity.java.cmake new file mode 100644 index 0000000..f8d08f1 --- /dev/null +++ b/src/contrib/SDL-3.2.20/test/android/cmake/SDLEntryTestActivity.java.cmake | |||
@@ -0,0 +1,121 @@ | |||
1 | package @ANDROID_MANIFEST_PACKAGE@; | ||
2 | |||
3 | import android.app.Activity; | ||
4 | import android.app.AlertDialog; | ||
5 | import android.content.Context; | ||
6 | import android.content.DialogInterface; | ||
7 | import android.content.Intent; | ||
8 | import android.os.Bundle; | ||
9 | import android.util.Log; | ||
10 | |||
11 | import org.libsdl.app.SDL; | ||
12 | import org.libsdl.app.SDLActivity; | ||
13 | |||
14 | import android.widget.Button; | ||
15 | import android.widget.EditText; | ||
16 | import android.widget.TextView; | ||
17 | |||
18 | import android.view.View; | ||
19 | import android.view.ViewGroup; | ||
20 | import android.view.LayoutInflater; | ||
21 | |||
22 | public class SDLEntryTestActivity extends Activity { | ||
23 | |||
24 | public String MODIFY_ARGUMENTS = "@ANDROID_MANIFEST_PACKAGE@.MODIFY_ARGUMENTS"; | ||
25 | boolean isModifyingArguments; | ||
26 | |||
27 | @Override | ||
28 | protected void onCreate(Bundle savedInstanceState) { | ||
29 | Log.v("SDL", "SDLEntryTestActivity onCreate"); | ||
30 | super.onCreate(savedInstanceState); | ||
31 | |||
32 | String intent_action = getIntent().getAction(); | ||
33 | Log.v("SDL", "SDLEntryTestActivity intent.action = " + intent_action); | ||
34 | |||
35 | if (intent_action == MODIFY_ARGUMENTS) { | ||
36 | isModifyingArguments = true; | ||
37 | createArgumentLayout(); | ||
38 | } else { | ||
39 | startChildActivityAndFinish(); | ||
40 | } | ||
41 | } | ||
42 | |||
43 | protected void createArgumentLayout() { | ||
44 | LayoutInflater inflater = getLayoutInflater(); | ||
45 | View view = inflater.inflate(R.layout.arguments_layout, null); | ||
46 | setContentView(view); | ||
47 | |||
48 | Button button = (Button)requireViewById(R.id.arguments_start_button); | ||
49 | button.setOnClickListener(new View.OnClickListener() { | ||
50 | public void onClick(View v) { | ||
51 | startChildActivityAndFinish(); | ||
52 | } | ||
53 | }); | ||
54 | } | ||
55 | |||
56 | protected String[] getArguments() { | ||
57 | if (!isModifyingArguments) { | ||
58 | return new String[0]; | ||
59 | } | ||
60 | EditText editText = (EditText)findViewById(R.id.arguments_edit); | ||
61 | String text = editText.getText().toString(); | ||
62 | String new_text = text.replace("[ \t]*[ \t\n]+[ \t]+", "\n").strip(); | ||
63 | Log.v("SDL", "text = " + text + "\n becomes \n" + new_text); | ||
64 | return new_text.split("\n", 0); | ||
65 | } | ||
66 | |||
67 | @Override | ||
68 | protected void onStart() { | ||
69 | Log.v("SDL", "SDLEntryTestActivity onStart"); | ||
70 | super.onStart(); | ||
71 | } | ||
72 | |||
73 | @Override | ||
74 | protected void onResume() { | ||
75 | Log.v("SDL", "SDLEntryTestActivity onResume"); | ||
76 | super.onResume(); | ||
77 | } | ||
78 | |||
79 | @Override | ||
80 | protected void onPause() { | ||
81 | Log.v("SDL", "SDLEntryTestActivity onPause"); | ||
82 | super.onPause(); | ||
83 | } | ||
84 | |||
85 | @Override | ||
86 | protected void onStop() { | ||
87 | Log.v("SDL", "SDLEntryTestActivity onStop"); | ||
88 | super.onStop(); | ||
89 | } | ||
90 | |||
91 | @Override | ||
92 | protected void onDestroy() { | ||
93 | Log.v("SDL", "SDLEntryTestActivity onDestroy"); | ||
94 | super.onDestroy(); | ||
95 | } | ||
96 | |||
97 | @Override | ||
98 | protected void onRestoreInstanceState(Bundle savedInstanceState) { | ||
99 | Log.v("SDL", "SDLEntryTestActivity onRestoreInstanceState"); | ||
100 | super.onRestoreInstanceState(savedInstanceState); | ||
101 | EditText editText = (EditText)findViewById(R.id.arguments_edit); | ||
102 | editText.setText(savedInstanceState.getCharSequence("args", ""), TextView.BufferType.EDITABLE); | ||
103 | } | ||
104 | |||
105 | @Override | ||
106 | protected void onSaveInstanceState(Bundle outState) { | ||
107 | Log.v("SDL", "SDLEntryTestActivity onSaveInstanceState"); | ||
108 | EditText editText = (EditText)findViewById(R.id.arguments_edit); | ||
109 | outState.putCharSequence("args", editText.getText()); | ||
110 | super.onSaveInstanceState(outState); | ||
111 | } | ||
112 | |||
113 | private void startChildActivityAndFinish() { | ||
114 | Intent intent = new Intent(Intent.ACTION_MAIN); | ||
115 | intent.addCategory(Intent.CATEGORY_LAUNCHER); | ||
116 | intent.setClassName("@ANDROID_MANIFEST_PACKAGE@", "@ANDROID_MANIFEST_PACKAGE@.SDLTestActivity"); | ||
117 | intent.putExtra("arguments", getArguments()); | ||
118 | startActivity(intent); | ||
119 | finish(); | ||
120 | } | ||
121 | } | ||
diff --git a/src/contrib/SDL-3.2.20/test/android/cmake/SDLTestActivity.java.cmake b/src/contrib/SDL-3.2.20/test/android/cmake/SDLTestActivity.java.cmake new file mode 100644 index 0000000..c43955d --- /dev/null +++ b/src/contrib/SDL-3.2.20/test/android/cmake/SDLTestActivity.java.cmake | |||
@@ -0,0 +1,33 @@ | |||
1 | package @ANDROID_MANIFEST_PACKAGE@; | ||
2 | |||
3 | import org.libsdl.app.SDLActivity; | ||
4 | |||
5 | import android.os.Bundle; | ||
6 | import android.util.Log; | ||
7 | |||
8 | public class SDLTestActivity extends SDLActivity { | ||
9 | private String[] m_arguments; | ||
10 | |||
11 | @Override | ||
12 | protected void onCreate(Bundle savedInstanceState) { | ||
13 | m_arguments = getIntent().getStringArrayExtra("arguments"); | ||
14 | if (m_arguments == null) { | ||
15 | m_arguments = new String[0]; | ||
16 | } | ||
17 | super.onCreate(savedInstanceState); | ||
18 | } | ||
19 | |||
20 | @Override | ||
21 | protected String[] getLibraries() { | ||
22 | return new String[] { getString(R.string.lib_name) }; | ||
23 | } | ||
24 | |||
25 | @Override | ||
26 | protected String[] getArguments() { | ||
27 | Log.v("SDLTest", "#arguments = " + m_arguments.length); | ||
28 | for(int i = 0; i < m_arguments.length; i++) { | ||
29 | Log.v("SDLTest", "argument[" + i + "] = " + m_arguments[i]); | ||
30 | } | ||
31 | return m_arguments; | ||
32 | } | ||
33 | } | ||
diff --git a/src/contrib/SDL-3.2.20/test/android/cmake/res/values/strings.xml.cmake b/src/contrib/SDL-3.2.20/test/android/cmake/res/values/strings.xml.cmake new file mode 100644 index 0000000..871c17f --- /dev/null +++ b/src/contrib/SDL-3.2.20/test/android/cmake/res/values/strings.xml.cmake | |||
@@ -0,0 +1,5 @@ | |||
1 | <resources> | ||
2 | <string name="app_name">@ANDROID_MANIFEST_APP_NAME@</string> | ||
3 | <string name="lib_name">@ANDROID_MANIFEST_LIB_NAME@</string> | ||
4 | <string name="label">@ANDROID_MANIFEST_LABEL@</string> | ||
5 | </resources> | ||
diff --git a/src/contrib/SDL-3.2.20/test/android/cmake/res/xml/shortcuts.xml.cmake b/src/contrib/SDL-3.2.20/test/android/cmake/res/xml/shortcuts.xml.cmake new file mode 100644 index 0000000..a29a2de --- /dev/null +++ b/src/contrib/SDL-3.2.20/test/android/cmake/res/xml/shortcuts.xml.cmake | |||
@@ -0,0 +1,24 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <shortcuts xmlns:android="http://schemas.android.com/apk/res/android"> | ||
3 | <shortcut | ||
4 | android:shortcutId="modifyArguments" | ||
5 | android:enabled="true" | ||
6 | android:icon="@drawable/sdl-test_foreground" | ||
7 | android:shortcutShortLabel="@string/shortcutModifyArgumentsShortLabel"> | ||
8 | <intent | ||
9 | android:action="@ANDROID_MANIFEST_PACKAGE@.MODIFY_ARGUMENTS" | ||
10 | android:targetPackage="@ANDROID_MANIFEST_PACKAGE@" | ||
11 | android:targetClass="@ANDROID_MANIFEST_PACKAGE@.SDLEntryTestActivity" /> | ||
12 | </shortcut> | ||
13 | <shortcut | ||
14 | android:shortcutId="intermediateActivity" | ||
15 | android:enabled="true" | ||
16 | android:icon="@drawable/sdl-test_foreground" | ||
17 | android:shortcutShortLabel="@string/shortcutIntermediateActivityShortLabel"> | ||
18 | <intent | ||
19 | android:action="android.intent.action.MAIN" | ||
20 | android:targetPackage="@ANDROID_MANIFEST_PACKAGE@" | ||
21 | android:targetClass="@ANDROID_MANIFEST_PACKAGE@.SDLEntryTestActivity" /> | ||
22 | </shortcut> | ||
23 | <!-- Specify more shortcuts here. --> | ||
24 | </shortcuts> | ||