File tree Expand file tree Collapse file tree 2 files changed +28
-16
lines changed
builds/android/app/src/main/java/org/easyrpg/player Expand file tree Collapse file tree 2 files changed +28
-16
lines changed Original file line number Diff line number Diff line change 11package org .easyrpg .player ;
22
33import android .os .Bundle ;
4+ import android .util .Log ;
5+
46import androidx .appcompat .app .AppCompatActivity ;
57import org .easyrpg .player .settings .SettingsManager ;
68
7- public class BaseActivity extends AppCompatActivity {
9+ /**
10+ * This activity is used by the GameBrowser and the settings.
11+ */
12+ public class BaseActivity extends AppCompatActivity {
13+ public static Boolean libraryLoaded = false ;
14+
15+ private static void loadNativeLibraries () {
16+ if (!libraryLoaded ) {
17+ try {
18+ System .loadLibrary ("easyrpg_android" );
19+ System .loadLibrary ("gamebrowser" );
20+ libraryLoaded = true ;
21+ } catch (UnsatisfiedLinkError e ) {
22+ Log .e ("EasyRPG Player" , "Couldn't load libgamebrowser: " + e .getMessage ());
23+ throw e ;
24+ }
25+ }
26+ }
27+
828 @ Override
929 protected void onCreate (Bundle savedInstanceState ) {
1030 super .onCreate (savedInstanceState );
1131
12- // Retrieve User's preferences
13- SettingsManager .init (getApplicationContext ());
32+ init ();
1433 }
1534
1635 @ Override
1736 protected void onResume () {
1837 super .onResume ();
1938
39+ init ();
40+ }
41+
42+ protected void init () {
2043 // Retrieve User's preferences
2144 SettingsManager .init (getApplicationContext ());
45+
46+ loadNativeLibraries ();
2247 }
2348}
Original file line number Diff line number Diff line change 4444
4545public class GameBrowserActivity extends BaseActivity
4646 implements NavigationView .OnNavigationItemSelectedListener {
47- public static Boolean libraryLoaded = false ;
48-
4947 private static final int THUMBNAIL_HORIZONTAL_SIZE_DPI = 290 ;
5048 private static Game selectedGame ;
5149
@@ -58,17 +56,6 @@ public class GameBrowserActivity extends BaseActivity
5856 protected void onCreate (Bundle savedInstanceState ) {
5957 super .onCreate (savedInstanceState );
6058
61- if (!libraryLoaded ) {
62- try {
63- System .loadLibrary ("easyrpg_android" );
64- System .loadLibrary ("gamebrowser" );
65- libraryLoaded = true ;
66- } catch (UnsatisfiedLinkError e ) {
67- Log .e ("EasyRPG Player" , "Couldn't load libgamebrowser: " + e .getMessage ());
68- throw e ;
69- }
70- }
71-
7259 SDL .setContext (getApplicationContext ());
7360
7461 setContentView (R .layout .activity_games_browser );
You can’t perform that action at this time.
0 commit comments