File tree 2 files changed +28
-16
lines changed
builds/android/app/src/main/java/org/easyrpg/player
2 files changed +28
-16
lines changed Original file line number Diff line number Diff line change 1
1
package org .easyrpg .player ;
2
2
3
3
import android .os .Bundle ;
4
+ import android .util .Log ;
5
+
4
6
import androidx .appcompat .app .AppCompatActivity ;
5
7
import org .easyrpg .player .settings .SettingsManager ;
6
8
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
+
8
28
@ Override
9
29
protected void onCreate (Bundle savedInstanceState ) {
10
30
super .onCreate (savedInstanceState );
11
31
12
- // Retrieve User's preferences
13
- SettingsManager .init (getApplicationContext ());
32
+ init ();
14
33
}
15
34
16
35
@ Override
17
36
protected void onResume () {
18
37
super .onResume ();
19
38
39
+ init ();
40
+ }
41
+
42
+ protected void init () {
20
43
// Retrieve User's preferences
21
44
SettingsManager .init (getApplicationContext ());
45
+
46
+ loadNativeLibraries ();
22
47
}
23
48
}
Original file line number Diff line number Diff line change 44
44
45
45
public class GameBrowserActivity extends BaseActivity
46
46
implements NavigationView .OnNavigationItemSelectedListener {
47
- public static Boolean libraryLoaded = false ;
48
-
49
47
private static final int THUMBNAIL_HORIZONTAL_SIZE_DPI = 290 ;
50
48
private static Game selectedGame ;
51
49
@@ -58,17 +56,6 @@ public class GameBrowserActivity extends BaseActivity
58
56
protected void onCreate (Bundle savedInstanceState ) {
59
57
super .onCreate (savedInstanceState );
60
58
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
-
72
59
SDL .setContext (getApplicationContext ());
73
60
74
61
setContentView (R .layout .activity_games_browser );
You can’t perform that action at this time.
0 commit comments