List of usage examples for com.badlogic.gdx Preferences flush
public void flush();
From source file:app.badlogicgames.superjumper.RegisterScreen.java
License:Apache License
private void savePref() { Preferences prefs = Gdx.app.getPreferences("my-preferences"); if (Util.NAME.length() > 0 && Util.EMAIL.length() > 0 && Util.PASSWORD.length() > 0) { prefs.putString("name", Util.NAME); prefs.putString("email", Util.EMAIL); prefs.putString("password", Util.PASSWORD); prefs.flush(); notification = "Saved Successfully"; game.setScreen(new MainMenuScreen(game)); } else {// w w w . j a va 2 s .c o m notification = "All Fields are mandatory"; } }
From source file:at.juggle.games.memory.GameOptions.java
License:Apache License
public void toggleSoundOn() { soundOn = !soundOn;/* ww w . ja v a2 s . c om*/ Preferences preferences = Gdx.app.getPreferences("memory_free_hd.prefs"); preferences.putBoolean("soundOn", soundOn); preferences.flush(); }
From source file:at.therefactory.jewelthief.input.MenuScreenInputAdapter.java
License:Open Source License
@Override public boolean touchUp(int screenX, int screenY, int pointer, int button) { super.touchUp(screenX, screenY, pointer, button); Preferences prefs = JewelThief.getInstance().getPreferences(); numTouches = Math.max(0, numTouches - 1); if (menuScreen.buttonExitToMainMenu.isPressed()) { menuScreen.buttonExitToMainMenu.release(); menuScreen.setShowLicenseYOffset(0); menuScreen.setState(MenuScreen.MenuState.ShowMenu); } else if (menuScreen.getState().equals(MenuScreen.MenuState.ShowAbout)) { if (menuScreen.buttonShowLicense.isPressed()) { menuScreen.buttonShowLicense.release(); if (menuScreen.getShowLicenseYOffset() == 0) { menuScreen.setShowLicenseYOffset(54); } else { menuScreen.setShowLicenseYOffset(0); }//from ww w . j av a 2s . c o m } else if (menuScreen.buttonSoundtrack.isPressed()) { menuScreen.buttonSoundtrack.release(); Gdx.net.openURI(URL_TO_SOUNDTRACK); } else if (menuScreen.buttonRate.isPressed()) { menuScreen.buttonRate.release(); Gdx.net.openURI(URL_TO_PLAY_STORE); } } else if (menuScreen.getState().equals(MenuScreen.MenuState.ShowHighscores)) { if (menuScreen.buttonUpdateHighscores.isPressed()) { menuScreen.buttonUpdateHighscores.release(); menuScreen.setFetchingHighscores(true); HttpServer.fetchHighscores(menuScreen, prefs.getString(PrefsKeys.ID), prefs.getString(PrefsKeys.PLAYER_NAME), prefs.getInteger(PrefsKeys.BEST_SCORE_NUM_JEWELS), prefs.getInteger(PrefsKeys.BEST_SCORE_NUM_SECONDS)); } } else if (menuScreen.getState().equals(MenuScreen.MenuState.ShowSettings)) { if (menuScreen.buttonChangePlayername.isPressed()) { menuScreen.buttonChangePlayername.release(); Gdx.input.getTextInput(listener, bundle.get(PLEASE_ENTER_YOUR_NAME), prefs.getString(PrefsKeys.PLAYER_NAME), ""); } else if (menuScreen.buttonToggleSound.isPressed()) { menuScreen.buttonToggleSound.release(); menuScreen.buttonToggleSound.nextState(); prefs.putBoolean(PrefsKeys.ENABLE_SOUND, !prefs.getBoolean(PrefsKeys.ENABLE_SOUND)); prefs.flush(); } else if (menuScreen.buttonToggleMusic.isPressed()) { menuScreen.buttonToggleMusic.release(); menuScreen.buttonToggleMusic.nextState(); prefs.putBoolean(PrefsKeys.ENABLE_MUSIC, !prefs.getBoolean(PrefsKeys.ENABLE_MUSIC)); prefs.flush(); if (prefs.getBoolean(PrefsKeys.ENABLE_MUSIC)) { JewelThief.getInstance().playMusicFile(true); } else { JewelThief.getInstance().pauseMusic(); } } else if (menuScreen.buttonChangeLanguage.isPressed()) { menuScreen.buttonChangeLanguage.release(); menuScreen.buttonChangeLanguage.nextState(); bundle = JewelThief.getInstance() .setLocale(menuScreen.buttonChangeLanguage.getState() == 0 ? "en" : "de"); menuScreen.setBundle(bundle); } else if (menuScreen.buttonResetHighscore.isPressed()) { menuScreen.buttonResetHighscore.release(); if (timestampLastClickOnResetHighscoreSettingButton > System.currentTimeMillis() - 1000) { timestampLastClickOnResetHighscoreSettingButton = 0; prefs.remove(PrefsKeys.MY_RANK); prefs.remove(PrefsKeys.BEST_SCORE); prefs.remove(PrefsKeys.BEST_SCORE_NUM_JEWELS); prefs.remove(PrefsKeys.BEST_SCORE_NUM_SECONDS); JewelThief.getInstance().toast(bundle.get(HIGHSCORE_IS_RESET), true); } else { timestampLastClickOnResetHighscoreSettingButton = System.currentTimeMillis(); JewelThief.getInstance().toast(bundle.get(TAP_AGAIN_TO_RESET_HIGHSCORE), false); } } } // main menu else { if (menuScreen.buttonStartSinglePlayerGame.isPressed()) { JewelThief.getInstance().showIntroScreen(); menuScreen.buttonStartSinglePlayerGame.release(); } else if (menuScreen.buttonShowHighscores.isPressed()) { deltaY = 0; menuScreen.setScrollbarPositionY(Config.INITIAL_SCROLLBAR_POSITION_Y); if (prefs.contains(PrefsKeys.CACHED_HIGHSCORES)) { menuScreen.setHighscores(prefs.getString(PrefsKeys.CACHED_HIGHSCORES).split("\n")); } menuScreen.setState(MenuScreen.MenuState.ShowHighscores); menuScreen.buttonShowHighscores.release(); } else if (menuScreen.buttonShowSettings.isPressed()) { menuScreen.setState(MenuScreen.MenuState.ShowSettings); menuScreen.buttonShowSettings.release(); } else if (menuScreen.buttonShowAbout.isPressed()) { menuScreen.setState(MenuScreen.MenuState.ShowAbout); menuScreen.buttonShowAbout.release(); } } lastDeltaY = -deltaY; touchDragging = false; return true; }
From source file:com.a2client.Config.java
License:Open Source License
public static void SaveOptions() { // Preferences p = getPrefs(); Preferences p = Gdx.app.getPreferences(CONFIG_FILE); p.putInteger("window_width", WindowWidth); p.putInteger("window_height", WindowHeight); p.putInteger("screen_width", ScreenWidth_to_save); p.putInteger("screen_height", ScreenHeight_to_save); p.putInteger("frame_rate", FrameFate); p.putBoolean("use_vsync", vSync); p.putBoolean("reduce_bg", ReduceInBackground); p.putBoolean("start_fullscreen", isFullscreen); // AppSettings.put("sound_enabled", SoundEnabled); // AppSettings.put("sound_vol", SoundVolume); // AppSettings.put("music_vol", MusicVolume); // AppSettings.put("debug_engine", DebugEngine); p.putString("language", current_lang); // AppSettings.put("count_objs", count_objs); // AppSettings.put("hide_overlapped", hide_overlapped); // AppSettings.put("move_inst_left_mouse", move_inst_left_mouse); // AppSettings.put("zoom_by_wheel", zoom_by_wheel); // AppSettings.put("zoom_over_mouse", zoom_over_mouse); // AppSettings.put("fullscreen_alt_enter", fullscreen_alt_enter); // AppSettings.put("minimap_draw_objects", minimap_draw_objects); p.putString("account", account); if (save_pass) { p.putString("password", password); } else {// w w w . j a va 2 s . c o m p.putString("password", ""); } p.putBoolean("save_pass", save_pass); p.flush(); }
From source file:com.digitale.screens.InGameOptions.java
License:Open Source License
public InGameOptions(Stage stage) { originalsfxVolume = Stardust3d.sfxVolume; originalMusicVolume = Stardust3d.musicVolume; originalaccellXsensitivity = Stardust3d.accelXsensitivity; originalaccellYsensitivity = Stardust3d.accelYsensitivity; originalDeadzoneX = Stardust3d.deadzoneX; originalDeadzoneY = Stardust3d.deadzoneY; skin = new Skin(Gdx.files.internal("data/uiskin.json"), Gdx.files.internal("data/uiskin.png")); Gdx.input.setInputProcessor(stage);/*from www . j a va 2 s . com*/ // Group.debug = true; final Button buttonClose = new TextButton("Close", skin.getStyle(TextButtonStyle.class), "buttonClose"); final Button buttonCancel = new TextButton("Cancel", skin.getStyle(TextButtonStyle.class), "buttonCancel"); ; final CheckBox checkBoxSFX = new CheckBox("Sound Effects", skin.getStyle(CheckBoxStyle.class), "checkbox"); final CheckBox checkBoxFontsize = new CheckBox("Use Small Font", skin.getStyle(CheckBoxStyle.class), "checkboxfont"); final Slider slidersfx = new Slider(0, 2, .1f, skin.getStyle(SliderStyle.class), "slidersfx"); final Slider sliderdzy = new Slider(.1f, 2, .1f, skin.getStyle(SliderStyle.class), "sliderdzy"); final Slider sliderdzx = new Slider(.1f, 2, .1f, skin.getStyle(SliderStyle.class), "sliderdzx"); //sensitivty final Slider slidersy = new Slider(.1f, 2, .1f, skin.getStyle(SliderStyle.class), "sliderdsy"); final Slider slidersx = new Slider(.1f, 2, .1f, skin.getStyle(SliderStyle.class), "sliderdsx"); //stardust final Slider sliderdust = new Slider(20, 500, 10f, skin.getStyle(SliderStyle.class), "sliderdust"); final Slider slidermusic = new Slider(0, 1, .01f, skin.getStyle(SliderStyle.class), "slidersmusic"); final Slider slidergfxquality = new Slider(0, 10, 1, skin.getStyle(SliderStyle.class), "slidergfx"); slidersfx.setValue(Stardust3d.sfxVolume); slidermusic.setValue(Stardust3d.musicVolume); sliderdzx.setValue(Stardust3d.deadzoneX); sliderdzy.setValue(Stardust3d.deadzoneY); sliderdust.setValue(Stardust3d.dustsize); slidersx.setValue(Stardust3d.accelXsensitivity); slidersy.setValue(Stardust3d.accelYsensitivity); final Label lablesfx = new Label("Sound effect volume", skin.getStyle(LabelStyle.class), "lablesfx"); final Label lablemusic = new Label("Music volume", skin.getStyle(LabelStyle.class), "lablemusic"); final Label lablegfx = new Label("Graphics quality", skin.getStyle(LabelStyle.class), "lablegfx"); final Label lablesliderdzx = new Label("Horizontal Deadzone", skin.getStyle(LabelStyle.class), "lablesliderdzx"); final Label lablesliderdzy = new Label("Vertical Deadzone", skin.getStyle(LabelStyle.class), "lablesliderdzy"); final Label lableslidersx = new Label("Horizontal Sensitivity", skin.getStyle(LabelStyle.class), "lableslidersx"); final Label lableslidersy = new Label("Vertical Sensitivity", skin.getStyle(LabelStyle.class), "lableslidersy"); final Label lablesliderdust = new Label("Spacedust Density", skin.getStyle(LabelStyle.class), "lablesliderdust"); final Preferences prefs = Gdx.app.getPreferences("stardustpreferences"); final Label lablestilt = new Label("Android Tilt Settings", skin.getStyle(LabelStyle.class), "labletilt"); Window window = new Window("Options Screen", skin.getStyle(WindowStyle.class), "optionsWindow"); if (Stardust3d.DEBUG) window.debug(); window.x = window.y = 0; window.defaults().pad(2); window.setFillParent(true); window.setMovable(false); // build table window.row().fill().expandX().maxHeight(28); window.add(); window.add(); window.add(buttonCancel).colspan(1); window.add(buttonClose).colspan(1); // audio slider lables window.row().fill().expandX().maxHeight(28); window.add(checkBoxFontsize); window.add(); window.add(lablestilt).maxWidth(350).fillX().colspan(2); window.row().fill().expandX().maxHeight(28); //top row window.add(lablesfx).maxWidth(350).fillX().colspan(2); window.add(lablesliderdzx).maxWidth(350).fillX().colspan(2); window.row().fill().expandX().maxHeight(28); window.add(slidersfx).fillX().colspan(2); window.add(sliderdzx).fillX().colspan(2); window.row().fill().expandX().maxHeight(28); window.add(lablemusic).maxWidth(350).fillX().colspan(2); window.add(lablesliderdzy).maxWidth(350).fillX().colspan(2); window.row().fill().expandX().maxHeight(28); window.add(slidermusic).fillX().colspan(2); window.add(sliderdzy).fillX().colspan(2); window.row().fill().expandX().maxHeight(28); window.add(lablesliderdust).maxWidth(350).fillX().colspan(2); window.add(lableslidersx).maxWidth(350).fillX().colspan(2); window.row().fill().expandX().maxHeight(28); window.add(sliderdust).fillX().colspan(2); window.add(slidersx).fillX().colspan(2); window.row().fill().expandX().maxHeight(28); window.add().minWidth(100).maxWidth(350).fillX().colspan(2); window.add(lableslidersy).maxWidth(350).fillX().colspan(2); window.row().fill().expandX().maxHeight(28); window.add().fillX().colspan(2); window.add(slidersy).fillX().colspan(2); window.row(); // audio sliders window.pack(); stage.addActor(window); buttonClose.setClickListener(new ClickListener() { public void click(Actor actor, float x, float y) { System.out.println("Options Close"); SoundManager.playuiclick(); prefs.putFloat("musicvolume", Stardust3d.musicVolume); prefs.putFloat("sfxvolume", Stardust3d.sfxVolume); prefs.putFloat("dzx", Stardust3d.deadzoneX); prefs.putFloat("dzy", Stardust3d.deadzoneY); prefs.putFloat("sx", Stardust3d.accelXsensitivity); prefs.putFloat("sy", Stardust3d.accelYsensitivity); prefs.putFloat("dustsize", Stardust3d.dustsize); Simulation.populateDust(); prefs.flush(); Stardust3d.stationScreen = 107; } }); checkBoxFontsize.setClickListener(new ClickListener() { public void click(Actor actor, float x, float y) { SoundManager.playuiclick(); if (Stardust3d.DEBUG) System.out.println("smallfont"); Stardust3d.tinyfont = checkBoxFontsize.isChecked(); // if user wants to change fontsize prefs.putBoolean("fontsize", Stardust3d.tinyfont); prefs.flush(); } }); buttonCancel.setClickListener(new ClickListener() { public void click(Actor actor, float x, float y) { System.out.println("Options Close"); SoundManager.playuiclick(); resetSettings(); Stardust3d.stationScreen = 107; } }); slidersfx.setValueChangedListener(new ValueChangedListener() { public void changed(Slider slider, float value) { if (value == 0) value = 0.001f; Stardust3d.sfxVolume = value; SoundManager.setSFXVolume(); SoundManager.playconfirm(); } }); slidermusic.setValueChangedListener(new ValueChangedListener() { public void changed(Slider slider, float value) { if (value == 0) value = 0.001f; Stardust3d.musicVolume = value; SoundManager.setMusicVolume(); } }); sliderdzx.setValueChangedListener(new ValueChangedListener() { public void changed(Slider slider, float value) { if (value == 0) value = 0.001f; Stardust3d.deadzoneX = value; } }); sliderdzy.setValueChangedListener(new ValueChangedListener() { public void changed(Slider slider, float value) { if (value == 0) value = 0.001f; Stardust3d.deadzoneY = value; } }); slidersx.setValueChangedListener(new ValueChangedListener() { public void changed(Slider slider, float value) { if (value == 0) value = 0.001f; Stardust3d.accelXsensitivity = value; } }); slidersy.setValueChangedListener(new ValueChangedListener() { public void changed(Slider slider, float value) { if (value == 0) value = 0.001f; Stardust3d.accelYsensitivity = value; } }); sliderdust.setValueChangedListener(new ValueChangedListener() { public void changed(Slider slider, float value) { if (value == 0) value = 0.001f; Stardust3d.dustsize = value; SoundManager.setMusicVolume(); } }); }
From source file:com.digitale.screens.Options.java
License:Open Source License
public Options() { originalsfxVolume = Stardust3d.sfxVolume; originalMusicVolume = Stardust3d.musicVolume; batch = new SpriteBatch(); skin = new Skin(Gdx.files.internal("data/uiskin.json"), Gdx.files.internal("data/uiskin.png")); background = new Texture(Gdx.files.internal("data/bgpland.jpg")); stage = new Stage(Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), false); Gdx.input.setInputProcessor(stage);// ww w.j av a 2s . c o m // Group.debug = true; final Button buttonClose = new TextButton("Close", skin.getStyle(TextButtonStyle.class), "buttonClose"); final Button buttonCancel = new TextButton("Cancel", skin.getStyle(TextButtonStyle.class), "buttonCancel"); ; final CheckBox checkBoxSFX = new CheckBox("Sound Effects", skin.getStyle(CheckBoxStyle.class), "checkbox"); final CheckBox checkBoxFontsize = new CheckBox("Use Small Font", skin.getStyle(CheckBoxStyle.class), "checkboxfont"); final Slider slidersfx = new Slider(0, 1, .01f, skin.getStyle(SliderStyle.class), "slidersfx"); final Slider slidermusic = new Slider(0, 1, .01f, skin.getStyle(SliderStyle.class), "slidersmusic"); final Slider slidergfxquality = new Slider(0, 10, 1, skin.getStyle(SliderStyle.class), "slidergfx"); slidersfx.setValue(Stardust3d.sfxVolume); slidermusic.setValue(Stardust3d.musicVolume); final Label lablesfx = new Label("Sound effect volume", skin.getStyle(LabelStyle.class), "lablesfx"); final Label lablemusic = new Label("Music volume", skin.getStyle(LabelStyle.class), "lablemusic"); final Label lablegfx = new Label("Graphics quality", skin.getStyle(LabelStyle.class), "lablegfx"); final Preferences prefs = Gdx.app.getPreferences("stardustpreferences"); Window window = new Window("Options Screen", skin.getStyle(WindowStyle.class), "window"); if (Stardust3d.DEBUG) window.debug(); window.x = window.y = 0; window.defaults().pad(5); window.setFillParent(true); window.setMovable(false); //build table window.row().expandX().fill(); window.add(); window.add(); window.add(buttonCancel).colspan(1); window.add(buttonClose).colspan(1); //audio slider lables window.row(); window.add(checkBoxFontsize); window.row(); window.row(); window.row(); window.row(); window.add(lablesfx).minWidth(100).colspan(2); window.add(lablemusic).minWidth(100).colspan(2); // audio sliders window.row().expand(); window.add(slidersfx).minWidth(100).maxWidth(350).fillX().colspan(2); window.add(slidermusic).minWidth(100).maxWidth(350).fillX().colspan(2); window.row(); window.pack(); stage.addActor(window); buttonClose.setClickListener(new ClickListener() { public void click(Actor actor, float x, float y) { System.out.println("Options Close"); SoundManager.playuiclick(); prefs.putFloat("musicvolume", Stardust3d.musicVolume); prefs.putFloat("sfxvolume", Stardust3d.sfxVolume); prefs.flush(); if (Stardust3d.mloginOK) { Stardust3d.gameMode = 4; doneflag = true; } else { Stardust3d.gameMode = 2; doneflag = true; } } }); checkBoxFontsize.setClickListener(new ClickListener() { public void click(Actor actor, float x, float y) { SoundManager.playuiclick(); if (Stardust3d.DEBUG) System.out.println("smallfont"); Stardust3d.tinyfont = checkBoxFontsize.isChecked(); //if user wants to change fontsize prefs.putBoolean("fontsize", Stardust3d.tinyfont); prefs.flush(); } }); buttonCancel.setClickListener(new ClickListener() { public void click(Actor actor, float x, float y) { System.out.println("Options Close"); SoundManager.playuiclick(); if (Stardust3d.mloginOK) { Stardust3d.gameMode = 4; resetSettings(); doneflag = true; } else { Stardust3d.gameMode = 2; doneflag = true; } } }); slidersfx.setValueChangedListener(new ValueChangedListener() { public void changed(Slider slider, float value) { if (value == 0) value = 0.001f; Stardust3d.sfxVolume = value; Gdx.app.log("Options", "sfxslider: " + value); SoundManager.setSFXVolume(); SoundManager.playconfirm(); } }); slidermusic.setValueChangedListener(new ValueChangedListener() { public void changed(Slider slider, float value) { if (value == 0) value = 0.001f; Stardust3d.musicVolume = value; Gdx.app.log("Options", "musicslider: " + value); SoundManager.setMusicVolume(); } }); }
From source file:com.esotericsoftware.spine.SkeletonViewer.java
License:Open Source License
void loadSkeleton(FileHandle skeletonFile, boolean reload) { if (skeletonFile == null) return;// www . j a va 2 s . co m // A regular texture atlas would normally usually be used. This returns a white image for images not found in the atlas. Pixmap pixmap = new Pixmap(32, 32, Format.RGBA8888); pixmap.setColor(new Color(1, 1, 1, 0.33f)); pixmap.fill(); final AtlasRegion fake = new AtlasRegion(new Texture(pixmap), 0, 0, 32, 32); pixmap.dispose(); String atlasFileName = skeletonFile.nameWithoutExtension(); if (atlasFileName.endsWith(".json")) atlasFileName = new FileHandle(atlasFileName).nameWithoutExtension(); FileHandle atlasFile = skeletonFile.sibling(atlasFileName + ".atlas"); if (!atlasFile.exists()) atlasFile = skeletonFile.sibling(atlasFileName + ".atlas.txt"); TextureAtlasData data = !atlasFile.exists() ? null : new TextureAtlasData(atlasFile, atlasFile.parent(), false); TextureAtlas atlas = new TextureAtlas(data) { public AtlasRegion findRegion(String name) { AtlasRegion region = super.findRegion(name); return region != null ? region : fake; } }; try { String extension = skeletonFile.extension(); if (extension.equalsIgnoreCase("json") || extension.equalsIgnoreCase("txt")) { SkeletonJson json = new SkeletonJson(atlas); json.setScale(ui.scaleSlider.getValue()); skeletonData = json.readSkeletonData(skeletonFile); } else { SkeletonBinary binary = new SkeletonBinary(atlas); binary.setScale(ui.scaleSlider.getValue()); skeletonData = binary.readSkeletonData(skeletonFile); } } catch (Exception ex) { ex.printStackTrace(); ui.toast("Error loading skeleton: " + skeletonFile.name()); lastModifiedCheck = 5; return; } skeleton = new Skeleton(skeletonData); skeleton.setToSetupPose(); skeleton = new Skeleton(skeleton); skeleton.updateWorldTransform(); state = new AnimationState(new AnimationStateData(skeletonData)); this.skeletonFile = skeletonFile; Preferences prefs = Gdx.app.getPreferences("spine-skeletontest"); prefs.putString("lastFile", skeletonFile.path()); prefs.flush(); lastModified = skeletonFile.lastModified(); lastModifiedCheck = checkModifiedInterval; // Populate UI. ui.skeletonLabel.setText(skeletonFile.name()); { Array<String> items = new Array(); for (Skin skin : skeletonData.getSkins()) items.add(skin.getName()); ui.skinList.setItems(items); } { Array<String> items = new Array(); for (Animation animation : skeletonData.getAnimations()) items.add(animation.getName()); ui.animationList.setItems(items); } // Configure skeleton from UI. skeleton.setSkin(ui.skinList.getSelected()); state.setAnimation(0, ui.animationList.getSelected(), ui.loopCheckbox.isChecked()); if (reload) ui.toast("Reloaded."); }
From source file:com.gamestudio24.martianrun.utils.AudioUtils.java
License:Apache License
private void saveBoolean(String key, boolean value) { Preferences preferences = getPreferences(); preferences.putBoolean(key, value);/*from w ww. j a v a 2s .c o m*/ preferences.flush(); }
From source file:com.gamestudio24.martianrun.utils.GameManager.java
License:Apache License
public void saveScore(int score) { Preferences preferences = getPreferences(); int maxScore = preferences.getInteger(MAX_SCORE_PREFERENCE, 0); if (score > maxScore) { preferences.putInteger(MAX_SCORE_PREFERENCE, score); preferences.flush(); }//ww w.j av a 2 s . c o m }
From source file:com.gamestudio24.martianrun.utils.GameManager.java
License:Apache License
public void submitSavedMaxScore() { Preferences preferences = getPreferences(); submitScore(preferences.getInteger(MAX_SCORE_PREFERENCE, 0)); preferences.remove(MAX_SCORE_PREFERENCE); preferences.flush(); }