Changed dialoges to ConfirmDialog
This commit is contained in:
parent
3ca689dd60
commit
1ca222187e
@ -483,15 +483,15 @@ public final class R {
|
||||
public static final int checkbox = 0x7f080015;
|
||||
public static final int chronometer = 0x7f080016;
|
||||
public static final int collapseActionView = 0x7f080017;
|
||||
public static final int contentPanel = 0x7f080018;
|
||||
public static final int custom = 0x7f080019;
|
||||
public static final int customPanel = 0x7f08001a;
|
||||
public static final int decor_content_parent = 0x7f08001b;
|
||||
public static final int default_activity_button = 0x7f08001c;
|
||||
public static final int disableHome = 0x7f08001d;
|
||||
public static final int edit_query = 0x7f08001e;
|
||||
public static final int end = 0x7f08001f;
|
||||
public static final int end_padder = 0x7f080020;
|
||||
public static final int contentPanel = 0x7f08001b;
|
||||
public static final int custom = 0x7f08001c;
|
||||
public static final int customPanel = 0x7f08001d;
|
||||
public static final int decor_content_parent = 0x7f08001e;
|
||||
public static final int default_activity_button = 0x7f08001f;
|
||||
public static final int disableHome = 0x7f080020;
|
||||
public static final int edit_query = 0x7f080021;
|
||||
public static final int end = 0x7f080022;
|
||||
public static final int end_padder = 0x7f080023;
|
||||
public static final int expand_activities_button = 0x7f080024;
|
||||
public static final int expanded_menu = 0x7f080025;
|
||||
public static final int home = 0x7f08003e;
|
||||
@ -619,7 +619,7 @@ public final class R {
|
||||
public static final int abc_shareactionprovider_share_with = 0x7f0d0010;
|
||||
public static final int abc_shareactionprovider_share_with_application = 0x7f0d0011;
|
||||
public static final int abc_toolbar_collapse_description = 0x7f0d0012;
|
||||
public static final int status_bar_notification_info_overflow = 0x7f0d004e;
|
||||
public static final int status_bar_notification_info_overflow = 0x7f0d0050;
|
||||
}
|
||||
public static final class style {
|
||||
public static final int AlertDialog_AppCompat = 0x7f0e0000;
|
||||
|
File diff suppressed because one or more lines are too long
@ -585,18 +585,18 @@ int id cancel_action 0x7f080014
|
||||
int id checkbox 0x7f080015
|
||||
int id chronometer 0x7f080016
|
||||
int id collapseActionView 0x7f080017
|
||||
int id contentPanel 0x7f080018
|
||||
int id custom 0x7f080019
|
||||
int id customPanel 0x7f08001a
|
||||
int id decor_content_parent 0x7f08001b
|
||||
int id default_activity_button 0x7f08001c
|
||||
int id disableHome 0x7f08001d
|
||||
int id edit_query 0x7f08001e
|
||||
int id end 0x7f08001f
|
||||
int id end_padder 0x7f080020
|
||||
int id exit_confirm_dialog_no_button 0x7f080021
|
||||
int id exit_confirm_dialog_textview 0x7f080022
|
||||
int id exit_confirm_dialog_yes_button 0x7f080023
|
||||
int id confirm_dialog_no_button 0x7f080018
|
||||
int id confirm_dialog_textview 0x7f080019
|
||||
int id confirm_dialog_yes_button 0x7f08001a
|
||||
int id contentPanel 0x7f08001b
|
||||
int id custom 0x7f08001c
|
||||
int id customPanel 0x7f08001d
|
||||
int id decor_content_parent 0x7f08001e
|
||||
int id default_activity_button 0x7f08001f
|
||||
int id disableHome 0x7f080020
|
||||
int id edit_query 0x7f080021
|
||||
int id end 0x7f080022
|
||||
int id end_padder 0x7f080023
|
||||
int id expand_activities_button 0x7f080024
|
||||
int id expanded_menu 0x7f080025
|
||||
int id game_countdown 0x7f080026
|
||||
@ -809,7 +809,7 @@ int layout abc_screen_toolbar 0x7f0a0015
|
||||
int layout abc_search_dropdown_item_icons_2line 0x7f0a0016
|
||||
int layout abc_search_view 0x7f0a0017
|
||||
int layout abc_select_dialog_material 0x7f0a0018
|
||||
int layout exit_confirm_dialog 0x7f0a0019
|
||||
int layout confirm_dialog 0x7f0a0019
|
||||
int layout game 0x7f0a001a
|
||||
int layout game_over_message 0x7f0a001b
|
||||
int layout gl_test_screen 0x7f0a001c
|
||||
@ -879,114 +879,116 @@ int string bounty_message_resource_format_s 0x7f0d0014
|
||||
int string bounty_message_shape_unlocked 0x7f0d0015
|
||||
int string bounty_message_tool_format_s 0x7f0d0016
|
||||
int string bounty_message_tool_slot 0x7f0d0017
|
||||
int string exit_confirm_dialog_no 0x7f0d0018
|
||||
int string exit_confirm_dialog_question 0x7f0d0019
|
||||
int string exit_confirm_dialog_yes 0x7f0d001a
|
||||
int string game_countdown_placeholder 0x7f0d001b
|
||||
int string game_fps_format_d 0x7f0d001c
|
||||
int string game_fps_placeholder 0x7f0d001d
|
||||
int string game_playerprogress_format_f 0x7f0d001e
|
||||
int string game_playerprogress_placeholder 0x7f0d001f
|
||||
int string game_playerspeed_format_f 0x7f0d0020
|
||||
int string game_playerspeed_placeholder 0x7f0d0021
|
||||
int string goal_message_next_level_format_d 0x7f0d0022
|
||||
int string goal_message_restart_format_d 0x7f0d0023
|
||||
int string level_button_format_d 0x7f0d0024
|
||||
int string levelup 0x7f0d0025
|
||||
int string message_game_over 0x7f0d0026
|
||||
int string message_level_finished 0x7f0d0027
|
||||
int string message_next_level 0x7f0d0028
|
||||
int string message_restart 0x7f0d0029
|
||||
int string message_to_menu 0x7f0d002a
|
||||
int string message_tools 0x7f0d002b
|
||||
int string message_try_again 0x7f0d002c
|
||||
int string placeholder_button 0x7f0d002d
|
||||
int string placeholder_number 0x7f0d002e
|
||||
int string placeholder_percent 0x7f0d002f
|
||||
int string placeholder_textview 0x7f0d0030
|
||||
int string playershape_description_ball 0x7f0d0031
|
||||
int string playershape_description_clock 0x7f0d0032
|
||||
int string playershape_description_hypno_spiral 0x7f0d0033
|
||||
int string playershape_description_locked 0x7f0d0034
|
||||
int string playershape_description_pacman 0x7f0d0035
|
||||
int string playershape_description_smiley 0x7f0d0036
|
||||
int string playershape_description_sun 0x7f0d0037
|
||||
int string playershape_description_wheel 0x7f0d0038
|
||||
int string playershape_name_ball 0x7f0d0039
|
||||
int string playershape_name_clock 0x7f0d003a
|
||||
int string playershape_name_hypno_spiral 0x7f0d003b
|
||||
int string playershape_name_locked 0x7f0d003c
|
||||
int string playershape_name_pacman 0x7f0d003d
|
||||
int string playershape_name_smiley 0x7f0d003e
|
||||
int string playershape_name_sun 0x7f0d003f
|
||||
int string playershape_name_wheel 0x7f0d0040
|
||||
int string pre_start_screen_loading 0x7f0d0041
|
||||
int string price_button_buy 0x7f0d0042
|
||||
int string price_button_upgrade 0x7f0d0043
|
||||
int string reset_dialog_question 0x7f0d0044
|
||||
int string settings_reset 0x7f0d0045
|
||||
int string short_menu_continue 0x7f0d0046
|
||||
int string short_menu_exit 0x7f0d0047
|
||||
int string short_menu_restart 0x7f0d0048
|
||||
int string start_screen_finish_world_1 0x7f0d0049
|
||||
int string start_screen_gain_90_ep 0x7f0d004a
|
||||
int string start_screen_play 0x7f0d004b
|
||||
int string start_screen_to_gl_test_screen 0x7f0d004c
|
||||
int string start_screen_unlock_all_levels 0x7f0d004d
|
||||
int string status_bar_notification_info_overflow 0x7f0d004e
|
||||
int string task_collect_energy_format_d 0x7f0d004f
|
||||
int string task_collect_energy_progress_format_ddd 0x7f0d0050
|
||||
int string task_collect_stars_format_d 0x7f0d0051
|
||||
int string task_collect_stars_progress_format_ddd 0x7f0d0052
|
||||
int string task_complete_world_format_d 0x7f0d0053
|
||||
int string task_completed 0x7f0d0054
|
||||
int string task_empty 0x7f0d0055
|
||||
int string tool_description_bomb 0x7f0d0056
|
||||
int string tool_description_locked_format_d 0x7f0d0057
|
||||
int string tool_description_magnet 0x7f0d0058
|
||||
int string tool_description_power_mushroom 0x7f0d0059
|
||||
int string tool_description_ramp 0x7f0d005a
|
||||
int string tool_description_spring 0x7f0d005b
|
||||
int string tool_description_stasis 0x7f0d005c
|
||||
int string tool_level_format_d 0x7f0d005d
|
||||
int string tool_name_bomb 0x7f0d005e
|
||||
int string tool_name_locked 0x7f0d005f
|
||||
int string tool_name_magnet 0x7f0d0060
|
||||
int string tool_name_power_mushroom 0x7f0d0061
|
||||
int string tool_name_ramp 0x7f0d0062
|
||||
int string tool_name_spring 0x7f0d0063
|
||||
int string tool_name_stasis 0x7f0d0064
|
||||
int string tool_upgrade_force 0x7f0d0065
|
||||
int string tool_upgrade_none 0x7f0d0066
|
||||
int string tool_upgrade_radius 0x7f0d0067
|
||||
int string tool_upgrade_time 0x7f0d0068
|
||||
int string tool_upgrade_title_format_sd 0x7f0d0069
|
||||
int string tool_upgrade_title_placeholder 0x7f0d006a
|
||||
int string tool_upgrade_value_max 0x7f0d006b
|
||||
int string topbar_level_format_d 0x7f0d006c
|
||||
int string topbar_level_placeholder 0x7f0d006d
|
||||
int string topbar_toolshop 0x7f0d006e
|
||||
int string tutorial_leveled_up_to_toolshop 0x7f0d006f
|
||||
int string tutorial_place_ramp_air 0x7f0d0070
|
||||
int string tutorial_place_ramp_air_2 0x7f0d0071
|
||||
int string tutorial_place_ramp_gap 0x7f0d0072
|
||||
int string tutorial_place_ramp_obstacle 0x7f0d0073
|
||||
int string tutorial_place_tools 0x7f0d0074
|
||||
int string tutorial_placeholder 0x7f0d0075
|
||||
int string tutorial_spring_equipped 0x7f0d0076
|
||||
int string tutorial_switch_tools_switch 0x7f0d0077
|
||||
int string tutorial_switch_tools_two_neccessary 0x7f0d0078
|
||||
int string tutorial_toolshop_all_tools 0x7f0d0079
|
||||
int string tutorial_toolshop_equip_spring 0x7f0d007a
|
||||
int string tutorial_toolshop_inspector 0x7f0d007b
|
||||
int string tutorial_toolshop_select_buy_spring 0x7f0d007c
|
||||
int string tutorial_toolshop_toolbar 0x7f0d007d
|
||||
int string tutorial_toolshop_welcome 0x7f0d007e
|
||||
int string tutorial_welcome 0x7f0d007f
|
||||
int string unlock_message_placeholder 0x7f0d0080
|
||||
int string world_button_count_format_dd 0x7f0d0081
|
||||
int string world_button_progress_placeholder 0x7f0d0082
|
||||
int string world_button_title_placeholder 0x7f0d0083
|
||||
int string confirm_dialog_button_no 0x7f0d0018
|
||||
int string confirm_dialog_button_yes 0x7f0d0019
|
||||
int string confirm_dialog_exit 0x7f0d001a
|
||||
int string confirm_dialog_finish_world_1 0x7f0d001b
|
||||
int string confirm_dialog_placeholder 0x7f0d001c
|
||||
int string confirm_dialog_reset 0x7f0d001d
|
||||
int string game_countdown_placeholder 0x7f0d001e
|
||||
int string game_fps_format_d 0x7f0d001f
|
||||
int string game_fps_placeholder 0x7f0d0020
|
||||
int string game_playerprogress_format_f 0x7f0d0021
|
||||
int string game_playerprogress_placeholder 0x7f0d0022
|
||||
int string game_playerspeed_format_f 0x7f0d0023
|
||||
int string game_playerspeed_placeholder 0x7f0d0024
|
||||
int string goal_message_next_level_format_d 0x7f0d0025
|
||||
int string goal_message_restart_format_d 0x7f0d0026
|
||||
int string level_button_format_d 0x7f0d0027
|
||||
int string levelup 0x7f0d0028
|
||||
int string message_game_over 0x7f0d0029
|
||||
int string message_level_finished 0x7f0d002a
|
||||
int string message_next_level 0x7f0d002b
|
||||
int string message_restart 0x7f0d002c
|
||||
int string message_to_menu 0x7f0d002d
|
||||
int string message_tools 0x7f0d002e
|
||||
int string message_try_again 0x7f0d002f
|
||||
int string placeholder_button 0x7f0d0030
|
||||
int string placeholder_number 0x7f0d0031
|
||||
int string placeholder_percent 0x7f0d0032
|
||||
int string placeholder_textview 0x7f0d0033
|
||||
int string playershape_description_ball 0x7f0d0034
|
||||
int string playershape_description_clock 0x7f0d0035
|
||||
int string playershape_description_hypno_spiral 0x7f0d0036
|
||||
int string playershape_description_locked 0x7f0d0037
|
||||
int string playershape_description_pacman 0x7f0d0038
|
||||
int string playershape_description_smiley 0x7f0d0039
|
||||
int string playershape_description_sun 0x7f0d003a
|
||||
int string playershape_description_wheel 0x7f0d003b
|
||||
int string playershape_name_ball 0x7f0d003c
|
||||
int string playershape_name_clock 0x7f0d003d
|
||||
int string playershape_name_hypno_spiral 0x7f0d003e
|
||||
int string playershape_name_locked 0x7f0d003f
|
||||
int string playershape_name_pacman 0x7f0d0040
|
||||
int string playershape_name_smiley 0x7f0d0041
|
||||
int string playershape_name_sun 0x7f0d0042
|
||||
int string playershape_name_wheel 0x7f0d0043
|
||||
int string pre_start_screen_loading 0x7f0d0044
|
||||
int string price_button_buy 0x7f0d0045
|
||||
int string price_button_upgrade 0x7f0d0046
|
||||
int string settings_reset 0x7f0d0047
|
||||
int string short_menu_continue 0x7f0d0048
|
||||
int string short_menu_exit 0x7f0d0049
|
||||
int string short_menu_restart 0x7f0d004a
|
||||
int string start_screen_finish_world_1 0x7f0d004b
|
||||
int string start_screen_gain_90_ep 0x7f0d004c
|
||||
int string start_screen_play 0x7f0d004d
|
||||
int string start_screen_to_gl_test_screen 0x7f0d004e
|
||||
int string start_screen_unlock_all_levels 0x7f0d004f
|
||||
int string status_bar_notification_info_overflow 0x7f0d0050
|
||||
int string task_collect_energy_format_d 0x7f0d0051
|
||||
int string task_collect_energy_progress_format_ddd 0x7f0d0052
|
||||
int string task_collect_stars_format_d 0x7f0d0053
|
||||
int string task_collect_stars_progress_format_ddd 0x7f0d0054
|
||||
int string task_complete_world_format_d 0x7f0d0055
|
||||
int string task_completed 0x7f0d0056
|
||||
int string task_empty 0x7f0d0057
|
||||
int string tool_description_bomb 0x7f0d0058
|
||||
int string tool_description_locked_format_d 0x7f0d0059
|
||||
int string tool_description_magnet 0x7f0d005a
|
||||
int string tool_description_power_mushroom 0x7f0d005b
|
||||
int string tool_description_ramp 0x7f0d005c
|
||||
int string tool_description_spring 0x7f0d005d
|
||||
int string tool_description_stasis 0x7f0d005e
|
||||
int string tool_level_format_d 0x7f0d005f
|
||||
int string tool_name_bomb 0x7f0d0060
|
||||
int string tool_name_locked 0x7f0d0061
|
||||
int string tool_name_magnet 0x7f0d0062
|
||||
int string tool_name_power_mushroom 0x7f0d0063
|
||||
int string tool_name_ramp 0x7f0d0064
|
||||
int string tool_name_spring 0x7f0d0065
|
||||
int string tool_name_stasis 0x7f0d0066
|
||||
int string tool_upgrade_force 0x7f0d0067
|
||||
int string tool_upgrade_none 0x7f0d0068
|
||||
int string tool_upgrade_radius 0x7f0d0069
|
||||
int string tool_upgrade_time 0x7f0d006a
|
||||
int string tool_upgrade_title_format_sd 0x7f0d006b
|
||||
int string tool_upgrade_title_placeholder 0x7f0d006c
|
||||
int string tool_upgrade_value_max 0x7f0d006d
|
||||
int string topbar_level_format_d 0x7f0d006e
|
||||
int string topbar_level_placeholder 0x7f0d006f
|
||||
int string topbar_toolshop 0x7f0d0070
|
||||
int string tutorial_leveled_up_to_toolshop 0x7f0d0071
|
||||
int string tutorial_place_ramp_air 0x7f0d0072
|
||||
int string tutorial_place_ramp_air_2 0x7f0d0073
|
||||
int string tutorial_place_ramp_gap 0x7f0d0074
|
||||
int string tutorial_place_ramp_obstacle 0x7f0d0075
|
||||
int string tutorial_place_tools 0x7f0d0076
|
||||
int string tutorial_placeholder 0x7f0d0077
|
||||
int string tutorial_spring_equipped 0x7f0d0078
|
||||
int string tutorial_switch_tools_switch 0x7f0d0079
|
||||
int string tutorial_switch_tools_two_neccessary 0x7f0d007a
|
||||
int string tutorial_toolshop_all_tools 0x7f0d007b
|
||||
int string tutorial_toolshop_equip_spring 0x7f0d007c
|
||||
int string tutorial_toolshop_inspector 0x7f0d007d
|
||||
int string tutorial_toolshop_select_buy_spring 0x7f0d007e
|
||||
int string tutorial_toolshop_toolbar 0x7f0d007f
|
||||
int string tutorial_toolshop_welcome 0x7f0d0080
|
||||
int string tutorial_welcome 0x7f0d0081
|
||||
int string unlock_message_placeholder 0x7f0d0082
|
||||
int string world_button_count_format_dd 0x7f0d0083
|
||||
int string world_button_progress_placeholder 0x7f0d0084
|
||||
int string world_button_title_placeholder 0x7f0d0085
|
||||
int style AlertDialog_AppCompat 0x7f0e0000
|
||||
int style AlertDialog_AppCompat_Light 0x7f0e0001
|
||||
int style Animation_AppCompat_Dialog 0x7f0e0002
|
||||
|
@ -24,9 +24,9 @@ public enum PlayerShape {
|
||||
SMILEY(R.string.playershape_name_smiley, R.string.playershape_description_smiley,
|
||||
R.drawable.playershapes_smiley, new CollectStarTask(30)),
|
||||
WHEEL(R.string.playershape_name_wheel, R.string.playershape_description_wheel,
|
||||
R.drawable.playershapes_wheel, new CollectStarTask(48)),
|
||||
R.drawable.playershapes_wheel, new CollectStarTask(45)),
|
||||
SUN(R.string.playershape_name_sun, R.string.playershape_description_sun,
|
||||
R.drawable.playershapes_sun, new CollectEnergyTask(16));
|
||||
R.drawable.playershapes_sun, new CollectEnergyTask(10));
|
||||
|
||||
@StringRes
|
||||
private int nameId;
|
||||
|
@ -242,6 +242,7 @@ public class GameActivity extends Activity implements ExceptionHandler, User.LvU
|
||||
type.reset();
|
||||
database.writeToolData();
|
||||
database.close();
|
||||
checkForAlreadyUnlockedPlayerShapes();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -7,20 +7,22 @@ import android.widget.ToggleButton;
|
||||
|
||||
import de.frajul.endlessroll.R;
|
||||
import de.frajul.endlessroll.main.GameActivity;
|
||||
import de.frajul.endlessroll.views.ResetConfirmDialog;
|
||||
import de.frajul.endlessroll.views.ConfirmDialog;
|
||||
import de.frajul.endlessroll.views.TopBar;
|
||||
|
||||
/**
|
||||
* Created by Julian on 10.09.2017.
|
||||
*/
|
||||
|
||||
public class SettingsScreen extends Screen<LinearLayout> implements View.OnClickListener {
|
||||
public class SettingsScreen extends Screen<LinearLayout> implements View.OnClickListener, ConfirmDialog.ConfirmDialogListener {
|
||||
|
||||
private final int CALL_ID_CONFIRM_RESET = 1;
|
||||
|
||||
private TopBar topBar;
|
||||
private ToggleButton soundToggle;
|
||||
private Button resetButton;
|
||||
|
||||
private ResetConfirmDialog resetConfirmDialog;
|
||||
private ConfirmDialog resetConfirmDialog;
|
||||
|
||||
public SettingsScreen(GameActivity gameActivity) {
|
||||
super(ScreenType.SETTINGS, gameActivity, R.layout.settings);
|
||||
@ -30,7 +32,7 @@ public class SettingsScreen extends Screen<LinearLayout> implements View.OnClick
|
||||
resetButton = (Button) layout.findViewById(R.id.settings_reset);
|
||||
resetButton.setOnClickListener(this);
|
||||
|
||||
resetConfirmDialog = new ResetConfirmDialog(gameActivity, this);
|
||||
resetConfirmDialog = new ConfirmDialog(gameActivity, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -54,7 +56,15 @@ public class SettingsScreen extends Screen<LinearLayout> implements View.OnClick
|
||||
if (v.equals(soundToggle)) {
|
||||
gameActivity.getSoundManager().setSoundOn(soundToggle.isChecked());
|
||||
} else if (v.equals(resetButton)) {
|
||||
resetConfirmDialog.show();
|
||||
resetConfirmDialog.show(CALL_ID_CONFIRM_RESET, R.string.confirm_dialog_reset);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConfirmed(int callId) {
|
||||
if (callId == CALL_ID_CONFIRM_RESET) {
|
||||
gameActivity.resetData();
|
||||
prepareToBeShown();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -12,12 +12,15 @@ import de.frajul.endlessroll.main.GameActivity;
|
||||
import de.frajul.endlessroll.main.MyGlSurfaceView;
|
||||
import de.frajul.endlessroll.rendering.Rendering;
|
||||
import de.frajul.endlessroll.sqlDatabase.MyDatabase;
|
||||
import de.frajul.endlessroll.views.ExitConfirmDialog;
|
||||
import de.frajul.endlessroll.views.ConfirmDialog;
|
||||
|
||||
/**
|
||||
* Created by Julian on 07.07.2016.
|
||||
*/
|
||||
public class StartScreen extends GLScreen<RelativeLayout> implements View.OnClickListener {
|
||||
public class StartScreen extends GLScreen<RelativeLayout> implements View.OnClickListener, ConfirmDialog.ConfirmDialogListener {
|
||||
|
||||
private final int CALL_ID_CONFIRM_EXIT = 1;
|
||||
private final int CALL_ID_CONFIRM_FINISH_WORLD = 2;
|
||||
|
||||
private Rendering rendering;
|
||||
|
||||
@ -28,7 +31,7 @@ public class StartScreen extends GLScreen<RelativeLayout> implements View.OnClic
|
||||
private Button toGlTestScreen;
|
||||
private Button settings;
|
||||
|
||||
private ExitConfirmDialog exitConfirmDialog;
|
||||
private ConfirmDialog confirmDialog;
|
||||
|
||||
public StartScreen(GameActivity gameActivity, MyGlSurfaceView glSurfaceView) throws Exception {
|
||||
super(ScreenType.START, gameActivity, R.layout.start_screen, glSurfaceView);
|
||||
@ -43,7 +46,7 @@ public class StartScreen extends GLScreen<RelativeLayout> implements View.OnClic
|
||||
settings = (Button) layout.findViewById(R.id.startscreen_settings);
|
||||
settings.setOnClickListener(this);
|
||||
|
||||
exitConfirmDialog = new ExitConfirmDialog(gameActivity);
|
||||
confirmDialog = new ConfirmDialog(gameActivity, this);
|
||||
|
||||
rendering = new StartScreenRendering(gameActivity);
|
||||
glView.addRendering(rendering);
|
||||
@ -63,7 +66,7 @@ public class StartScreen extends GLScreen<RelativeLayout> implements View.OnClic
|
||||
|
||||
@Override
|
||||
public void onBackKeyDown() {
|
||||
exitConfirmDialog.show();
|
||||
confirmDialog.show(CALL_ID_CONFIRM_EXIT, R.string.confirm_dialog_exit);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -84,6 +87,18 @@ public class StartScreen extends GLScreen<RelativeLayout> implements View.OnClic
|
||||
database.writeAllLevelAndPackStatus(gameActivity.getLevelManager());
|
||||
database.close();
|
||||
} else if (v.equals(finishFirstWorld)) {
|
||||
confirmDialog
|
||||
.show(CALL_ID_CONFIRM_FINISH_WORLD, R.string.confirm_dialog_finish_world_1);
|
||||
} else if (v.equals(toGlTestScreen))
|
||||
gameActivity.flipToScreen(ScreenType.GL_TEST);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onConfirmed(int callId) {
|
||||
if (callId == CALL_ID_CONFIRM_EXIT) {
|
||||
gameActivity.exitGame();
|
||||
} else if (callId == CALL_ID_CONFIRM_FINISH_WORLD) {
|
||||
gameActivity.resetData();
|
||||
gameActivity.getUser().gainEp(320, false);
|
||||
gameActivity.getLevelManager().finishFirstPack();
|
||||
@ -96,9 +111,6 @@ public class StartScreen extends GLScreen<RelativeLayout> implements View.OnClic
|
||||
database.open();
|
||||
database.writeAllLevelAndPackStatus(gameActivity.getLevelManager());
|
||||
database.close();
|
||||
} else if (v.equals(toGlTestScreen))
|
||||
gameActivity.flipToScreen(ScreenType.GL_TEST);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package de.frajul.endlessroll.views;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.StringRes;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.widget.Button;
|
||||
@ -14,36 +15,54 @@ import de.frajul.endlessroll.main.GameActivity;
|
||||
* Created by Julian on 31.10.2017.
|
||||
*/
|
||||
|
||||
public class ExitConfirmDialog extends Dialog implements View.OnClickListener {
|
||||
public class ConfirmDialog extends Dialog implements View.OnClickListener {
|
||||
|
||||
public interface ConfirmDialogListener {
|
||||
void onConfirmed(int callId);
|
||||
}
|
||||
|
||||
private GameActivity gameActivity;
|
||||
private int callId = -1;
|
||||
@StringRes
|
||||
private int text = -1;
|
||||
private ConfirmDialogListener listener;
|
||||
|
||||
private TextView textView;
|
||||
private Button yesButton;
|
||||
private Button noButton;
|
||||
|
||||
public ExitConfirmDialog(GameActivity gameActivity) {
|
||||
public ConfirmDialog(GameActivity gameActivity, ConfirmDialogListener listener) {
|
||||
super(gameActivity);
|
||||
this.gameActivity = gameActivity;
|
||||
this.listener = listener;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
setContentView(R.layout.exit_confirm_dialog);
|
||||
TextView textView = (TextView) findViewById(R.id.exit_confirm_dialog_textview);
|
||||
setContentView(R.layout.confirm_dialog);
|
||||
textView = (TextView) findViewById(R.id.confirm_dialog_textview);
|
||||
textView.setTypeface(gameActivity.getTypeface());
|
||||
noButton = (Button) findViewById(R.id.exit_confirm_dialog_no_button);
|
||||
noButton = (Button) findViewById(R.id.confirm_dialog_no_button);
|
||||
noButton.setTypeface(gameActivity.getTypeface());
|
||||
noButton.setOnClickListener(this);
|
||||
yesButton = (Button) findViewById(R.id.exit_confirm_dialog_yes_button);
|
||||
yesButton = (Button) findViewById(R.id.confirm_dialog_yes_button);
|
||||
yesButton.setTypeface(gameActivity.getTypeface());
|
||||
yesButton.setOnClickListener(this);
|
||||
}
|
||||
|
||||
public void show(int callId, @StringRes int text) {
|
||||
this.callId = callId;
|
||||
this.text = text;
|
||||
super.show();
|
||||
textView.setText(text);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
dismiss();
|
||||
if (v.equals(yesButton))
|
||||
gameActivity.exitGame();
|
||||
listener.onConfirmed(callId);
|
||||
}
|
||||
}
|
@ -1,55 +0,0 @@
|
||||
package de.frajul.endlessroll.views;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
|
||||
import de.frajul.endlessroll.R;
|
||||
import de.frajul.endlessroll.main.GameActivity;
|
||||
import de.frajul.endlessroll.main.screens.SettingsScreen;
|
||||
|
||||
/**
|
||||
* Created by Julian on 31.10.2017.
|
||||
*/
|
||||
|
||||
public class ResetConfirmDialog extends Dialog implements View.OnClickListener {
|
||||
|
||||
private GameActivity gameActivity;
|
||||
private SettingsScreen settingsScreen;
|
||||
private Button yesButton;
|
||||
private Button noButton;
|
||||
|
||||
public ResetConfirmDialog(GameActivity gameActivity, SettingsScreen settingsScreen) {
|
||||
super(gameActivity);
|
||||
this.gameActivity = gameActivity;
|
||||
this.settingsScreen = settingsScreen;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
setContentView(R.layout.exit_confirm_dialog);
|
||||
TextView textView = (TextView) findViewById(R.id.exit_confirm_dialog_textview);
|
||||
textView.setTypeface(gameActivity.getTypeface());
|
||||
textView.setText(R.string.reset_dialog_question);
|
||||
noButton = (Button) findViewById(R.id.exit_confirm_dialog_no_button);
|
||||
noButton.setTypeface(gameActivity.getTypeface());
|
||||
noButton.setOnClickListener(this);
|
||||
yesButton = (Button) findViewById(R.id.exit_confirm_dialog_yes_button);
|
||||
yesButton.setTypeface(gameActivity.getTypeface());
|
||||
yesButton.setOnClickListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
dismiss();
|
||||
if (v.equals(yesButton)) {
|
||||
gameActivity.resetData();
|
||||
settingsScreen.prepareToBeShown();
|
||||
}
|
||||
}
|
||||
}
|
@ -6,11 +6,11 @@
|
||||
android:background="@drawable/xml_background_exit_confirm_dialog">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/exit_confirm_dialog_textview"
|
||||
android:id="@+id/confirm_dialog_textview"
|
||||
android:layout_width="wrap_content"
|
||||
android:textAlignment="center"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/exit_confirm_dialog_question"
|
||||
android:text="@string/confirm_dialog_placeholder"
|
||||
android:textSize="20sp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:layout_gravity="center_horizontal"/>
|
||||
@ -20,22 +20,22 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
<Button
|
||||
android:id="@+id/exit_confirm_dialog_yes_button"
|
||||
android:id="@+id/confirm_dialog_yes_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAlignment="center"
|
||||
android:layout_marginRight="1dp"
|
||||
style="@style/DialogButton"
|
||||
android:text="@string/exit_confirm_dialog_yes"/>
|
||||
android:text="@string/confirm_dialog_button_yes"/>
|
||||
<Button
|
||||
android:id="@+id/exit_confirm_dialog_no_button"
|
||||
android:id="@+id/confirm_dialog_no_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:textAlignment="center"
|
||||
style="@style/DialogButton"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/exit_confirm_dialog_no"/>
|
||||
android:text="@string/confirm_dialog_button_no"/>
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
@ -95,10 +95,12 @@
|
||||
<string name="tool_upgrade_force">Force</string>
|
||||
<string name="tool_upgrade_value_max">Max.</string>
|
||||
|
||||
<string name="exit_confirm_dialog_yes">Yes</string>
|
||||
<string name="exit_confirm_dialog_no">No</string>
|
||||
<string name="exit_confirm_dialog_question">Do you really want to exit the game?</string>
|
||||
<string name="reset_dialog_question">Do you really want to reset ALL your progress?</string>
|
||||
<string name="confirm_dialog_button_yes">Yes</string>
|
||||
<string name="confirm_dialog_button_no">No</string>
|
||||
<string name="confirm_dialog_placeholder">This is a beautiful ConfirmDialog placeholder!</string>
|
||||
<string name="confirm_dialog_exit">Do you really want to exit the game?</string>
|
||||
<string name="confirm_dialog_reset">Do you really want to reset ALL your progress?</string>
|
||||
<string name="confirm_dialog_finish_world_1">Do you really want to finish the first world?\nYour old progress will be DELETED!</string>
|
||||
|
||||
<string name="tutorial_placeholder">This is a multiline placeholder\nfor all the tutorials I made!!!\nAwesome! - Isn\'t it?</string>
|
||||
<string name="tutorial_welcome">Welcome to Endless Roll!\nHave fun!</string>
|
||||
|
Loading…
x
Reference in New Issue
Block a user