public void onServerSettingSaveButtonClicked() { SharedPreferences sharedPreferences = getActivity().getSharedPreferences(GlobalValues.PREFS_FILE_NAME, 0); float compileWeight = Float.parseFloat(binder.serverSettingCompileWeight.getEditText().getText().toString()); binder.setCompileWeight(compileWeight); sharedPreferences.edit().putFloat(GlobalValues.PREFS_COMPILE_WEIGHT, compileWeight).apply(); }
@Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); new GetEventsTask().execute(); SharedPreferences sharedPreferences = getActivity().getSharedPreferences(GlobalValues.PREFS_FILE_NAME, 0); float compileWeight = sharedPreferences.getFloat(GlobalValues.PREFS_COMPILE_WEIGHT, 1.0f); binder.hostToggle.setOnCheckedChangeListener(this); binder.serverSettingsSave.setOnClickListener(this); binder.serverSettingsRestoreDefaults.setOnClickListener(this); binder.excel.setOnClickListener(this); binder.viewEvent.setOnClickListener(this); binder.setCompileWeight(compileWeight); EventBus.getDefault().post(new ServerStateRequestEvent()); }
@Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { binder = DataBindingUtil.inflate(inflater, R.layout.fragment_server, null, false); return binder.getRoot(); }
public void onRestoreButtonClicked() { SharedPreferences sharedPreferences = getActivity().getSharedPreferences(GlobalValues.PREFS_FILE_NAME, 0); sharedPreferences.edit().putFloat(GlobalValues.PREFS_COMPILE_WEIGHT, 1.0f).apply(); binder.setCompileWeight(1.0f); }