Search in sources :

Example 1 with InputMode

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;
}
Also used : InputMode(org.hwyl.sexytopo.control.util.InputMode) SharedPreferences(android.content.SharedPreferences)

Example 2 with 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();
}
Also used : InputMode(org.hwyl.sexytopo.control.util.InputMode) SharedPreferences(android.content.SharedPreferences) SuppressLint(android.annotation.SuppressLint)

Example 3 with InputMode

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;
}
Also used : InputMode(org.hwyl.sexytopo.control.util.InputMode) MenuItem(android.view.MenuItem)

Example 4 with InputMode

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);
    }
}
Also used : InputMode(org.hwyl.sexytopo.control.util.InputMode)

Aggregations

InputMode (org.hwyl.sexytopo.control.util.InputMode)4 SharedPreferences (android.content.SharedPreferences)2 SuppressLint (android.annotation.SuppressLint)1 MenuItem (android.view.MenuItem)1