use of org.hwyl.sexytopo.control.util.InputMode in project sexytopo by richsmith.
the class SurveyManager method getInputMode.
public InputMode getInputMode() {
SharedPreferences preferences = context.getSharedPreferences(SexyTopo.GENERAL_PREFS, android.content.Context.MODE_PRIVATE);
String modeName = preferences.getString(SexyTopo.INPUT_MODE_PREFERENCE, InputMode.FORWARD.name());
InputMode inputMode = InputMode.valueOf(modeName);
return inputMode;
}
use of org.hwyl.sexytopo.control.util.InputMode in project sexytopo by richsmith.
the class SexyTopoActivity method setInputModePreference.
private void setInputModePreference(MenuItem item) {
item.setChecked(!item.isChecked());
SharedPreferences preferences = getSharedPreferences(SexyTopo.GENERAL_PREFS, android.content.Context.MODE_PRIVATE);
SharedPreferences.Editor editor = preferences.edit();
int id = item.getItemId();
InputMode inputMode = InputMode.byMenuId(id);
editor.putString(SexyTopo.INPUT_MODE_PREFERENCE, inputMode.name());
editor.apply();
}
use of org.hwyl.sexytopo.control.util.InputMode in project sexytopo by richsmith.
the class SexyTopoActivity method onCreateOptionsMenu.
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.action_bar, menu);
InputMode inputMode = getInputMode();
MenuItem inputModeMenuItem = menu.findItem(inputMode.getMenuId());
inputModeMenuItem.setChecked(true);
return true;
}
use of org.hwyl.sexytopo.control.util.InputMode in project sexytopo by richsmith.
the class SurveyManager method updateSurvey.
public void updateSurvey(List<Leg> legs) {
if (legs.size() > 0) {
InputMode inputMode = getInputMode();
boolean stationAdded = SurveyUpdater.update(currentSurvey, legs, inputMode);
// survey update event should be generated first so the survey can be synced before
// dealing with any special station created events
broadcastSurveyUpdated();
if (stationAdded) {
Log.i("New station added");
broadcastNewStationCreated();
}
new AutosaveTask().execute(context);
}
}
Aggregations