/** refresh the ui elements with values from act_size / act_handicap */ public void refresh_ui() { size_text.setText(getString(R.string.size) + " " + act_size + "x" + act_size); handicap_text.setText(getString(R.string.handicap) + " " + act_handicap); // the checks for change here are important - otherwise samsung moment // will die here with stack overflow if ((act_size - size_offset) != size_seek.getProgress()) size_seek.setProgress(act_size - size_offset); if (act_handicap != handicap_seek.getProgress()) handicap_seek.setProgress(act_handicap); if (getApp().getInteractionScope().getMode() == InteractionScope.MODE_GNUGO) size_seek.setMax(19 - size_offset); // only enable handicap seeker when the size is 9x9 or 13x13 or 19x19 handicap_seek.setEnabled((act_size == 9) || (act_size == 13) || (act_size == 19)); GoPrefs.setLastBoardSize(act_size); GoPrefs.setLastHandicap(act_handicap); InteractionScope is = getApp().getInteractionScope(); if (is.getGame().getSize() != act_size || is.getGame().getHandicap() != act_handicap) { getApp().getInteractionScope().setGame(new GoGame(act_size, act_handicap)); } if (getActivity() instanceof GoActivity) { GoBoardViewHD board = ((GoActivity) getActivity()).getBoard(); if (board != null) { board.regenerateStroneImagesWithNewSize(); board.invalidate(); } } }
@Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { GoPrefs.init(getActivity()); // TODO remove legacy View view = inflater.inflate(R.layout.game_setup_inner, null); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); view.setLayoutParams(lp); size_seek = findById(view, R.id.size_slider); size_seek.setOnSeekBarChangeListener(this); size_text = findById(view, R.id.game_size_label); size_button9x9 = findById(view, R.id.size_button9x9); size_button9x9.setOnClickListener(this); size_button13x13 = findById(view, R.id.size_button13x13); size_button13x13.setOnClickListener(this); size_button19x19 = findById(view, R.id.size_button19x19); size_button19x19.setOnClickListener(this); handicap_text = findById(view, R.id.handicap_label); handicap_seek = findById(view, R.id.handicap_seek); handicap_seek.setOnSeekBarChangeListener(this); // set defaults act_size = (byte) GoPrefs.getLastBoardSize(); act_handicap = (byte) GoPrefs.getLastHandicap(); refresh_ui(); return view; }
public void transition() { final GoPrefs prefs = GoPrefs.INSTANCE; prefs.setFullscreenEnabled(isFullscreenEnabled()); prefs.setSoundWanted(isSoundEnabled()); prefs.setLegendEnabled(isLegendEnabled()); prefs.setSGFLegendEnabled(isSGFLegendEnabled()); prefs.setConstantLightWanted(isConstantLightWanted()); prefs.setGridEmbossEnabled(isGridEmbossEnabled()); prefs.setTsumegoPushEnabled(isTsumegoPushEnabled()); prefs.setUsername(getUsername()); prefs.setRank(getRank()); prefs.isVersionSeen(getPreferences().getInt("VERSION", 0)); }