6
6
import android .widget .Button ;
7
7
import android .widget .ImageView ;
8
8
import android .widget .TextView ;
9
-
10
-
11
9
import androidx .cardview .widget .CardView ;
12
10
import androidx .fragment .app .Fragment ;
13
-
14
11
import com .google .android .gms .common .util .ArrayUtils ;
15
-
16
- import java .util .Locale ;
17
-
18
12
import de .lmu .treeapp .R ;
19
13
import de .lmu .treeapp .activities .minigames .base .GameActivity_Base ;
20
14
import de .lmu .treeapp .popup .Popup ;
21
15
import de .lmu .treeapp .popup .PopupAction ;
22
16
import de .lmu .treeapp .popup .PopupInterface ;
23
17
import de .lmu .treeapp .popup .PopupType ;
24
18
19
+ import java .util .Locale ;
20
+
25
21
public class GameActivity_SlidePuzzle extends GameActivity_Base implements PopupInterface , Runnable {
26
22
DragDropGrid grid , gridFalse ;
27
23
int dimension = 3 ;
@@ -45,27 +41,6 @@ enum BlossomType {
45
41
protected void onCreate (Bundle savedInstanceState ) {
46
42
super .onCreate (savedInstanceState );
47
43
48
- setContentView (R .layout .activity_game__picture_puzzle );
49
- Button helpButton = findViewById (R .id .helpImageButton );
50
- Button continueButton = findViewById (R .id .continueButton );
51
- doneButton = findViewById (R .id .game_picture_puzzle_sendButton );
52
- Button falseTilesButton = findViewById (R .id .falseTilesButton );
53
- imgView = findViewById (R .id .doneImage );
54
- CardView helpView = findViewById (R .id .finishedImageView );
55
- helpView .setVisibility (View .GONE );
56
- doneButton .setVisibility (View .GONE );
57
- popup = new Popup (this );
58
- popup .setWinTitle (getString (R .string .slidepuzzle_wonderful ));
59
- doneButton .setOnClickListener (e -> {
60
- setDone (true );
61
- popup .showWithButtonText (PopupType .POSITIVE_ANIMATION , getString (R .string .popup_btn_finished ), getString (R .string .popup_puzzle_won_text , time ));
62
- });
63
-
64
- falseTilesButton .setOnClickListener (e -> gridFalse .markFalseTiles (grid .getFalseTiles ()));
65
-
66
- helpButton .setOnClickListener (e -> helpView .setVisibility (View .VISIBLE ));
67
- continueButton .setOnClickListener (e -> helpView .setVisibility (View .GONE ));
68
-
69
44
int treeId = parentTree .getId ();
70
45
if (ArrayUtils .contains (mwTrees , treeId )) {
71
46
int imgM = selectImage (BlossomType .male );
@@ -85,6 +60,28 @@ protected void onCreate(Bundle savedInstanceState) {
85
60
}
86
61
87
62
public void startPuzzle (BlossomType type ) {
63
+ setContentView (R .layout .activity_game__slide_puzzle );
64
+ doneButton = findViewById (R .id .game_slide_puzzle_sendButton );
65
+
66
+ Button helpButton = findViewById (R .id .helpImageButton );
67
+ Button continueButton = findViewById (R .id .continueButton );
68
+ Button falseTilesButton = findViewById (R .id .falseTilesButton );
69
+ imgView = findViewById (R .id .doneImage );
70
+ CardView helpView = findViewById (R .id .finishedImageView );
71
+ helpView .setVisibility (View .GONE );
72
+ doneButton .setVisibility (View .GONE );
73
+ popup = new Popup (this );
74
+ popup .setWinTitle (getString (R .string .slidepuzzle_wonderful ));
75
+ doneButton .setOnClickListener (e -> {
76
+ setDone (true );
77
+ popup .showWithButtonText (PopupType .POSITIVE_ANIMATION , getString (R .string .popup_btn_finished ), getString (R .string .popup_puzzle_won_text , time ));
78
+ });
79
+
80
+ falseTilesButton .setOnClickListener (e -> gridFalse .markFalseTiles (grid .getFalseTiles ()));
81
+
82
+ helpButton .setOnClickListener (e -> helpView .setVisibility (View .VISIBLE ));
83
+ continueButton .setOnClickListener (e -> helpView .setVisibility (View .GONE ));
84
+
88
85
if (ArrayUtils .contains (mwTrees , treeId )) {
89
86
getSupportFragmentManager ().beginTransaction ()
90
87
.detach (imageSelectFragment ).commit ();
@@ -113,7 +110,7 @@ public void run() {
113
110
114
111
@ Override
115
112
protected int getLayoutId () {
116
- return R .layout .activity_game__picture_puzzle ;
113
+ return R .layout .activity_game__slide_puzzle ;
117
114
}
118
115
119
116
@ Override
0 commit comments