Skip to content

Commit

Permalink
Merge pull request EasyRPG#3258 from Ghabry/android
Browse files Browse the repository at this point in the history
Android: Replace assets with SVG
  • Loading branch information
Ghabry authored Sep 1, 2024
2 parents bb498df + 933aadb commit 1efa7a9
Show file tree
Hide file tree
Showing 106 changed files with 177 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ private boolean isXboxOneController(UsbDevice usbDevice, UsbInterface usbInterfa
0x044f, // Thrustmaster
0x045e, // Microsoft
0x0738, // Mad Catz
0x0b05, // ASUS
0x0e6f, // PDP
0x0f0d, // Hori
0x10f5, // Turtle Beach
Expand Down Expand Up @@ -590,7 +591,13 @@ public boolean openDevice(int deviceID) {
} else {
flags = 0;
}
mUsbManager.requestPermission(usbDevice, PendingIntent.getBroadcast(mContext, 0, new Intent(HIDDeviceManager.ACTION_USB_PERMISSION), flags));
if (Build.VERSION.SDK_INT >= 33 /* Android 14.0 (U) */) {
Intent intent = new Intent(HIDDeviceManager.ACTION_USB_PERMISSION);
intent.setPackage(mContext.getPackageName());
mUsbManager.requestPermission(usbDevice, PendingIntent.getBroadcast(mContext, 0, intent, flags));
} else {
mUsbManager.requestPermission(usbDevice, PendingIntent.getBroadcast(mContext, 0, new Intent(HIDDeviceManager.ACTION_USB_PERMISSION), flags));
}
} catch (Exception e) {
Log.v(TAG, "Couldn't request permission for USB device " + usbDevice);
HIDDeviceOpenResult(deviceID, false);
Expand Down
14 changes: 9 additions & 5 deletions builds/android/app/src/main/java/org/libsdl/app/SDL.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ public static Context getContext() {
}

public static void loadLibrary(String libraryName) throws UnsatisfiedLinkError, SecurityException, NullPointerException {
loadLibrary(libraryName, mContext);
}

public static void loadLibrary(String libraryName, Context context) throws UnsatisfiedLinkError, SecurityException, NullPointerException {

if (libraryName == null) {
throw new NullPointerException("No library name provided.");
Expand All @@ -53,10 +57,10 @@ public static void loadLibrary(String libraryName) throws UnsatisfiedLinkError,
// To use ReLinker, just add it as a dependency. For more information, see
// https://github.com/KeepSafe/ReLinker for ReLinker's repository.
//
Class<?> relinkClass = mContext.getClassLoader().loadClass("com.getkeepsafe.relinker.ReLinker");
Class<?> relinkListenerClass = mContext.getClassLoader().loadClass("com.getkeepsafe.relinker.ReLinker$LoadListener");
Class<?> contextClass = mContext.getClassLoader().loadClass("android.content.Context");
Class<?> stringClass = mContext.getClassLoader().loadClass("java.lang.String");
Class<?> relinkClass = context.getClassLoader().loadClass("com.getkeepsafe.relinker.ReLinker");
Class<?> relinkListenerClass = context.getClassLoader().loadClass("com.getkeepsafe.relinker.ReLinker$LoadListener");
Class<?> contextClass = context.getClassLoader().loadClass("android.content.Context");
Class<?> stringClass = context.getClassLoader().loadClass("java.lang.String");

// Get a 'force' instance of the ReLinker, so we can ensure libraries are reinstalled if
// they've changed during updates.
Expand All @@ -66,7 +70,7 @@ public static void loadLibrary(String libraryName) throws UnsatisfiedLinkError,

// Actually load the library!
Method loadMethod = relinkInstanceClass.getDeclaredMethod("loadLibrary", contextClass, stringClass, stringClass, relinkListenerClass);
loadMethod.invoke(relinkInstance, mContext, libraryName, null, null);
loadMethod.invoke(relinkInstance, context, libraryName, null, null);
}
catch (final Throwable e) {
// Fall back
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -546,13 +546,15 @@ public void pollHapticDevices() {
if (haptic == null) {
InputDevice device = InputDevice.getDevice(deviceIds[i]);
Vibrator vib = device.getVibrator();
if (vib.hasVibrator()) {
haptic = new SDLHaptic();
haptic.device_id = deviceIds[i];
haptic.name = device.getName();
haptic.vib = vib;
mHaptics.add(haptic);
SDLControllerManager.nativeAddHaptic(haptic.device_id, haptic.name);
if (vib != null) {
if (vib.hasVibrator()) {
haptic = new SDLHaptic();
haptic.device_id = deviceIds[i];
haptic.name = device.getName();
haptic.vib = vib;
mHaptics.add(haptic);
SDLControllerManager.nativeAddHaptic(haptic.device_id, haptic.name);
}
}
}
}
Expand Down
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.
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.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960">
<path
android:pathData="M204,642q-22,-38 -33,-78t-11,-82q0,-134 93,-228t227,-94h7l-64,-64 56,-56 160,160 -160,160 -56,-56 64,-64h-7q-100,0 -170,70.5T240,482q0,26 6,51t18,49l-60,60ZM481,920 L321,760l160,-160 56,56 -64,64h7q100,0 170,-70.5T720,478q0,-26 -6,-51t-18,-49l60,-60q22,38 33,78t11,82q0,134 -93,228t-227,94h-7l64,64 -56,56Z"
android:fillColor="#ffffff"/>
</vector>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960">
<path
android:pathData="m480,840 l-58,-52q-101,-91 -167,-157T150,512.5Q111,460 95.5,416T80,326q0,-94 63,-157t157,-63q52,0 99,22t81,62q34,-40 81,-62t99,-22q94,0 157,63t63,157q0,46 -15.5,90T810,512.5Q771,565 705,631T538,788l-58,52ZM480,732q96,-86 158,-147.5t98,-107q36,-45.5 50,-81t14,-70.5q0,-60 -40,-100t-100,-40q-47,0 -87,26.5T518,280h-76q-15,-41 -55,-67.5T300,186q-60,0 -100,40t-40,100q0,35 14,70.5t50,81q36,45.5 98,107T480,732ZM480,459Z"
android:fillColor="#5f6368"/>
</vector>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960">
<path
android:pathData="m480,840 l-58,-52q-101,-91 -167,-157T150,512.5Q111,460 95.5,416T80,326q0,-94 63,-157t157,-63q52,0 99,22t81,62q34,-40 81,-62t99,-22q94,0 157,63t63,157q0,46 -15.5,90T810,512.5Q771,565 705,631T538,788l-58,52ZM480,732q96,-86 158,-147.5t98,-107q36,-45.5 50,-81t14,-70.5q0,-60 -40,-100t-100,-40q-47,0 -87,26.5T518,280h-76q-15,-41 -55,-67.5T300,186q-60,0 -100,40t-40,100q0,35 14,70.5t50,81q36,45.5 98,107T480,732ZM480,459Z"
android:fillColor="#ffffff"/>
</vector>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960">
<path
android:pathData="m480,840 l-58,-52q-101,-91 -167,-157T150,512.5Q111,460 95.5,416T80,326q0,-94 63,-157t157,-63q52,0 99,22t81,62q34,-40 81,-62t99,-22q94,0 157,63t63,157q0,46 -15.5,90T810,512.5Q771,565 705,631T538,788l-58,52Z"
android:fillColor="#5f6368"/>
</vector>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960">
<path
android:pathData="m480,840 l-58,-52q-101,-91 -167,-157T150,512.5Q111,460 95.5,416T80,326q0,-94 63,-157t157,-63q52,0 99,22t81,62q34,-40 81,-62t99,-22q94,0 157,63t63,157q0,46 -15.5,90T810,512.5Q771,565 705,631T538,788l-58,52Z"
android:fillColor="#ffffff"/>
</vector>
9 changes: 9 additions & 0 deletions builds/android/app/src/main/res/drawable/ic_article_black.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960">
<path
android:pathData="M280,680h280v-80L280,600v80ZM280,520h400v-80L280,440v80ZM280,360h400v-80L280,280v80ZM200,840q-33,0 -56.5,-23.5T120,760v-560q0,-33 23.5,-56.5T200,120h560q33,0 56.5,23.5T840,200v560q0,33 -23.5,56.5T760,840L200,840ZM200,760h560v-560L200,200v560ZM200,200v560,-560Z"
android:fillColor="#5f6368"/>
</vector>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960">
<path
android:pathData="M160,800q-33,0 -56.5,-23.5T80,720v-480q0,-33 23.5,-56.5T160,160h240l80,80h320q33,0 56.5,23.5T880,320v400q0,33 -23.5,56.5T800,800L160,800ZM160,720h640v-400L447,320l-80,-80L160,240v480ZM160,720v-480,480Z"
android:fillColor="#5f6368"/>
</vector>
9 changes: 9 additions & 0 deletions builds/android/app/src/main/res/drawable/ic_gamepad_black.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960">
<path
android:pathData="M480,420 L360,300v-220h240v220L480,420ZM660,600L540,480l120,-120h220v240L660,600ZM80,600v-240h220l120,120 -120,120L80,600ZM360,880v-220l120,-120 120,120v220L360,880Z"
android:fillColor="#5f6368"/>
</vector>
9 changes: 9 additions & 0 deletions builds/android/app/src/main/res/drawable/ic_home_dark.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960">
<path
android:pathData="M160,840v-480l320,-240 320,240v480L560,840v-280L400,560v280L160,840Z"
android:fillColor="#5f6368"/>
</vector>
9 changes: 9 additions & 0 deletions builds/android/app/src/main/res/drawable/ic_info.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960">
<path
android:pathData="M440,680h80v-240h-80v240ZM480,360q17,0 28.5,-11.5T520,320q0,-17 -11.5,-28.5T480,280q-17,0 -28.5,11.5T440,320q0,17 11.5,28.5T480,360ZM480,880q-83,0 -156,-31.5T197,763q-54,-54 -85.5,-127T80,480q0,-83 31.5,-156T197,197q54,-54 127,-85.5T480,80q83,0 156,31.5T763,197q54,54 85.5,127T880,480q0,83 -31.5,156T763,763q-54,54 -127,85.5T480,880Z"
android:fillColor="#5f6368"/>
</vector>
9 changes: 9 additions & 0 deletions builds/android/app/src/main/res/drawable/ic_refresh_white.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960">
<path
android:pathData="M480,800q-134,0 -227,-93t-93,-227q0,-134 93,-227t227,-93q69,0 132,28.5T720,270v-110h80v280L520,440v-80h168q-32,-56 -87.5,-88T480,240q-100,0 -170,70t-70,170q0,100 70,170t170,70q77,0 139,-44t87,-116h84q-28,106 -114,173t-196,67Z"
android:fillColor="#ffffff"/>
</vector>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960">
<path
android:pathData="m370,880 l-16,-128q-13,-5 -24.5,-12T307,725l-119,50L78,585l103,-78q-1,-7 -1,-13.5v-27q0,-6.5 1,-13.5L78,375l110,-190 119,50q11,-8 23,-15t24,-12l16,-128h220l16,128q13,5 24.5,12t22.5,15l119,-50 110,190 -103,78q1,7 1,13.5v27q0,6.5 -2,13.5l103,78 -110,190 -118,-50q-11,8 -23,15t-24,12L590,880L370,880ZM482,620q58,0 99,-41t41,-99q0,-58 -41,-99t-99,-41q-59,0 -99.5,41T342,480q0,58 40.5,99t99.5,41Z"
android:fillColor="#5f6368"/>
</vector>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960">
<path
android:pathData="m370,880 l-16,-128q-13,-5 -24.5,-12T307,725l-119,50L78,585l103,-78q-1,-7 -1,-13.5v-27q0,-6.5 1,-13.5L78,375l110,-190 119,50q11,-8 23,-15t24,-12l16,-128h220l16,128q13,5 24.5,12t22.5,15l119,-50 110,190 -103,78q1,7 1,13.5v27q0,6.5 -2,13.5l103,78 -110,190 -118,-50q-11,8 -23,15t-24,12L590,880L370,880ZM482,620q58,0 99,-41t41,-99q0,-58 -41,-99t-99,-41q-59,0 -99.5,41T342,480q0,58 40.5,99t99.5,41Z"
android:fillColor="#ffffff"/>
</vector>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960">
<path
android:pathData="M160,800q-33,0 -56.5,-23.5T80,720v-480q0,-33 23.5,-56.5T160,160h640q33,0 56.5,23.5T880,240v480q0,33 -23.5,56.5T800,800L160,800ZM160,600h640v-360L160,240v360Z"
android:fillColor="#5f6368"/>
</vector>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960">
<path
android:pathData="M560,829v-82q90,-26 145,-100t55,-168q0,-94 -55,-168T560,211v-82q124,28 202,125.5T840,479q0,127 -78,224.5T560,829ZM120,600v-240h160l200,-200v640L280,600L120,600ZM560,640v-322q47,22 73.5,66t26.5,96q0,51 -26.5,94.5T560,640Z"
android:fillColor="#5f6368"/>
</vector>
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@
android:layout_centerVertical="true"
android:padding="0dp"

android:src="@drawable/ic_action_settings_black" />
android:src="@drawable/ic_settings_black" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
Expand Down Expand Up @@ -201,7 +201,7 @@
android:layout_centerVertical="true"
android:padding="0dp"

android:src="@drawable/ic_action_settings_black" />
android:src="@drawable/ic_settings_black" />
</RelativeLayout>
<TextView
android:layout_width="match_parent"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,39 +8,39 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/video"
android:drawableStart="@drawable/ic_video_label_black_36dp"
android:drawableStart="@drawable/ic_video_label_black"
style="?android:attr/borderlessButtonStyle" />

<Button
android:id="@+id/settings_main_audio"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/audio"
android:drawableStart="@drawable/ic_volume_up_black_36dp"
android:drawableStart="@drawable/ic_volume_up_black"
style="?android:attr/borderlessButtonStyle" />

<Button
android:id="@+id/settings_main_input"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/input"
android:drawableStart="@drawable/ic_gamepad_black_36dp"
android:drawableStart="@drawable/ic_gamepad_black"
style="?android:attr/borderlessButtonStyle" />

<Button
android:id="@+id/settings_main_font"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/font"
android:drawableStart="@drawable/ic_gamepad_black_36dp"
android:drawableStart="@drawable/ic_article_black"
style="?android:attr/borderlessButtonStyle" />

<Button
android:id="@+id/settings_main_easyrpg_folders"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/easyrpg_folders"
android:drawableStart="@drawable/ic_folder_open_black_36dp"
android:drawableStart="@drawable/ic_folder_open_black"
style="?android:attr/borderlessButtonStyle" />

</LinearLayout>
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@

<ImageButton
android:id="@+id/game_browser_thumbnail_option_button"
android:src="@drawable/ic_action_settings_white"
android:src="@drawable/ic_settings_white"
android:background="@android:color/transparent"

android:layout_width="wrap_content"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
android:layout_below="@+id/title"
android:padding="4dp"

android:src="@drawable/ic_action_settings_black"
android:src="@drawable/ic_settings_black"
android:background="@android:color/transparent"
/>
<ImageButton
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:src="@drawable/ic_action_action_settings" />
android:src="@drawable/ic_settings_black" />

</RelativeLayout>
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@
android:layout_centerVertical="true"
android:padding="0dp"

android:src="@drawable/ic_action_settings_black" />
android:src="@drawable/ic_settings_black" />

</RelativeLayout>
4 changes: 2 additions & 2 deletions builds/android/app/src/main/res/menu/game_browser.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
android:orderInCategory="100"
android:title="@string/refresh"
app:showAsAction="ifRoom"
android:icon="@drawable/ic_refresh_white_24dp"/>
android:icon="@drawable/ic_refresh_white"/>
<item
android:id="@+id/menu"
android:orderInCategory="100"
android:title="@string/refresh"
app:showAsAction="ifRoom"
android:icon="@drawable/ic_settings_white_24dp"/>
android:icon="@drawable/ic_settings_white"/>
</menu>
6 changes: 3 additions & 3 deletions builds/android/app/src/main/res/menu/game_browser_drawer.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
<group android:checkableBehavior="single">
<item
android:id="@+id/nav_manage"
android:icon="@drawable/ic_menu_manage"
android:icon="@drawable/ic_settings_black"
android:title="@string/settings"/>
<item
android:id="@+id/nav_help"
android:icon="@drawable/ic_menu_slideshow"
android:icon="@drawable/ic_info"
android:title="@string/how_to_use_easy_rpg"/>
<item
android:id="@+id/nav_website"
android:icon="@drawable/ic_video_label_black_36dp"
android:icon="@drawable/ic_home_dark"
android:title="@string/visit_website"/>
</group>

Expand Down

0 comments on commit 1efa7a9

Please sign in to comment.