Skip to content

Commit

Permalink
LangToggle button only toggles language if allowed by build
Browse files Browse the repository at this point in the history
  • Loading branch information
kevindeland committed Mar 23, 2018
1 parent 1708fed commit 9f95577
Showing 1 changed file with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import android.view.View;
import android.widget.ToggleButton;

import cmu.xprize.robotutor.BuildConfig;
import cmu.xprize.robotutor.RoboTutor;
import cmu.xprize.robotutor.tutorengine.CMediaController;
import cmu.xprize.robotutor.tutorengine.CMediaManager;
Expand Down Expand Up @@ -78,11 +79,17 @@ public void onDestroy() {

@Override
public void onClick(View v) {
mLangState = !mLangState;

Log.v(QGRAPH_MSG, "event.click: " + " TLangToggle: " + mLangState);
// if the LangToggle button remains showing for some reason, and is clicked, don't actually change the language.
if(!BuildConfig.LANGUAGE_OVERRIDE) {
mLangState = !mLangState;

CTutorEngine.setDefaultLanguage(mLangState? TCONST.LANG_EN: TCONST.LANG_SW);
Log.v(QGRAPH_MSG, "event.click: " + " TLangToggle: " + mLangState);

CTutorEngine.setDefaultLanguage(mLangState? TCONST.LANG_EN: TCONST.LANG_SW);
} else {
Log.v(QGRAPH_MSG, "event.click: " + " TLangToggle: IGNORING");
}

// #Mod 329 language switch capability
// When switching languages it may occur on any Selector screens so we want to
Expand Down

0 comments on commit 9f95577

Please sign in to comment.