Skip to content

Commit

Permalink
Resolved an issue with the android hardware back button causing a bla…
Browse files Browse the repository at this point in the history
…nk screen that redraws when touched. closes #174

Adding the suggested labels to the quiz selection screen. closes #206
  • Loading branch information
PeterWithers committed Feb 3, 2015
1 parent e6c3e2c commit 88c9e9b
Show file tree
Hide file tree
Showing 7 changed files with 71 additions and 31 deletions.
2 changes: 1 addition & 1 deletion gwt-cordova/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<groupId>nl.ru.languageininteraction</groupId>
<artifactId>synquiz</artifactId>
<packaging>war</packaging>
<version>1.0.95-testing</version>
<version>1.0.96-testing</version>
<name>SynQuiz</name>
<organization>
<name>Language In Interaction</name>
Expand Down
2 changes: 1 addition & 1 deletion gwt-cordova/setup-cordova.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#mvn install
cd target
synquizname=synquiz-1.0.95-testing
synquizname=synquiz-1.0.96-testing
rm -rf $synquizname-cordova
unzip $synquizname-cordova.zip -d $synquizname-cordova
cd $synquizname-cordova
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@

import com.google.gwt.core.client.GWT;
import com.google.gwt.core.client.JavaScriptException;
import com.google.gwt.core.client.Scheduler;
import com.google.gwt.user.client.Command;
import nl.ru.languageininteraction.synaesthesia.client.service.LocalStorage;
import nl.ru.languageininteraction.synaesthesia.client.service.StimuliProvider;
import nl.ru.languageininteraction.synaesthesia.client.model.UserResults;
Expand Down Expand Up @@ -179,7 +181,12 @@ public void start() {
}

public void backAction() {
presenter.fireBackEvent();
Scheduler.get().scheduleDeferred(new Command() {
@Override
public void execute() {
presenter.fireBackEvent();
}
});
}

public void resizeAction() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,43 +33,50 @@
public class StimulusMenuPresenter extends MenuPresenter implements Presenter {

private final StimuliProvider stimuliProvider;
private final UserResults userResults;

public StimulusMenuPresenter(RootLayoutPanel widgetTag, StimuliProvider stimuliProvider, UserResults userResults) {
super(widgetTag, userResults);
this.stimuliProvider = stimuliProvider;
this.userResults = userResults;
}

@Override
protected void setTitle(PresenterEventListner titleBarListner) {
simpleView.addTitle(messages.stimulusMenuTitle(), titleBarListner);
}

@Override
protected void setContent(final AppEventListner appEventListner) {
// setMenuOption(appEventListner, AppEventListner.ApplicationState.setuser);
for (final StimuliGroup stimuliGroup : stimuliProvider.getStimuli()) {
final String buttonLabel;
if (userResults.getStimulusResponseGroup(stimuliGroup) != null) {
buttonLabel = messages.stimulusMenuDoneButton(stimuliGroup.getGroupLabel());
} else {
buttonLabel = messages.stimulusMenuNotDoneButton(stimuliGroup.getGroupLabel());
private void addMenuItem(final AppEventListner appEventListner, final StimuliGroup stimuliGroup) {
final String buttonLabel;
if (userResults.getStimulusResponseGroup(stimuliGroup) != null) {
buttonLabel = messages.stimulusMenuDoneButton(stimuliGroup.getGroupLabel());
} else {
buttonLabel = messages.stimulusMenuNotDoneButton(stimuliGroup.getGroupLabel());
}
((MenuView) simpleView).addMenuItem(new PresenterEventListner() {

@Override
public void eventFired(Button button) {
userResults.setPendingStimuliGroup(stimuliGroup);
appEventListner.requestApplicationState(AppEventListner.ApplicationState.instructions);
}
((MenuView) simpleView).addMenuItem(new PresenterEventListner() {

@Override
public void eventFired(Button button) {
userResults.setPendingStimuliGroup(stimuliGroup);
appEventListner.requestApplicationState(AppEventListner.ApplicationState.instructions);
}
@Override
public String getLabel() {
return buttonLabel;
}
}, true);
}

@Override
public String getLabel() {
return buttonLabel;
}
}, true);
}
@Override
protected void setContent(final AppEventListner appEventListner) {
// setMenuOption(appEventListner, AppEventListner.ApplicationState.setuser);
((MenuView) simpleView).addMenuLabel(messages.stimulusMenuShortTestLabel(), true);
final StimuliGroup[] stimuliGroups = stimuliProvider.getStimuli();
addMenuItem(appEventListner, stimuliGroups[0]);
addMenuItem(appEventListner, stimuliGroups[1]);
addMenuItem(appEventListner, stimuliGroups[2]);
((MenuView) simpleView).addMenuLabel(messages.stimulusMenuLongTestLabelBold(), true);
((MenuView) simpleView).addMenuLabel(messages.stimulusMenuLongTestLabel(), false);
addMenuItem(appEventListner, stimuliGroups[3]);
// setMenuOption(appEventListner, AppEventListner.ApplicationState.report);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@
import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.FlexTable;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
import com.google.gwt.user.client.ui.IsWidget;
import com.google.gwt.user.client.ui.Label;
import java.util.ArrayList;
import nl.ru.languageininteraction.synaesthesia.client.listener.PresenterEventListner;
Expand All @@ -36,17 +38,21 @@
*/
public class MenuView extends ComplexView {

final private ArrayList<Button> buttonsArray = new ArrayList<>();
final private ArrayList<IsWidget> buttonsArray = new ArrayList<>();
private FlexTable flexTable = null;

public void addMenuItem(final PresenterEventListner menuItemListerner, final boolean menuEnabled) {
private void checkFlexTableExists() {
if (flexTable == null) {
flexTable = new FlexTable();
flexTable.setStylePrimaryName("menuTable");
outerPanel.setStylePrimaryName("menuOuter");
outerPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
outerPanel.add(flexTable);
}
}

public void addMenuItem(final PresenterEventListner menuItemListerner, final boolean menuEnabled) {
checkFlexTableExists();
final Button menuButton = new Button(new SafeHtmlBuilder().appendEscapedLines(menuItemListerner.getLabel()).toSafeHtml());
buttonsArray.add(menuButton);
menuButton.addStyleName("menuButton");
Expand All @@ -73,6 +79,17 @@ public void onTouchEnd(TouchEndEvent event) {
flexTable.setWidget(rowCount, 0, menuButton);
}

public void addMenuLabel(String textString, boolean boldText) {
checkFlexTableExists();
HTML html = new HTML(new SafeHtmlBuilder().appendEscapedLines(textString).toSafeHtml());
if (boldText) {
html.addStyleName("highlightedText");
}
buttonsArray.add(html);
final int rowCount = flexTable.getRowCount();
flexTable.setWidget(rowCount, 0, html);
}

@Override
protected void parentResized(int height, int width, String units) {
super.parentResized(height, width, units);
Expand All @@ -86,8 +103,10 @@ protected void parentResized(int height, int width, String units) {
int col = 0;
flexTable.removeAllRows();
flexTable.setCellPadding(textHeight / 7);
for (Button menuButton : buttonsArray) {
menuButton.getElement().getStyle().setFontSize(textHeight, Style.Unit.PX);
for (IsWidget menuButton : buttonsArray) {
if (menuButton instanceof Button) {
((Button) menuButton).getElement().getStyle().setFontSize(textHeight, Style.Unit.PX);
}
flexTable.setWidget(row, col, menuButton);
row++;
if (!portrate) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,4 +103,7 @@ socialMediaPostUrl=https://www.languageininteraction.nl/
registrationCompleteTitle=Registration
registrationCompleteText=Registration complete.
registrationFailedTitle=Registration
registrationFailedText=Registration failed on the server. You can try again later or if you continue having trouble submitting your registration please go to www.mpi.nl/synaesthesia to register and participate in the study!
registrationFailedText=Registration failed on the server. You can try again later or if you continue having trouble submitting your registration please go to www.mpi.nl/synaesthesia to register and participate in the study!
stimulusMenuShortTestLabel=Find out if you have synaesthesia!
stimulusMenuLongTestLabelBold=Do you have synaesthesia? Join your fellow synaesthetes in a study!
stimulusMenuLongTestLabel=In order to participate in the study, you have to complete the full test.\nPlease make sure, you can do it in one go.
4 changes: 4 additions & 0 deletions gwt-cordova/src/main/webapp/GraphemeColour.css
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,10 @@ canvas {
*/
}

.menuTable .gwt-HTML, .menuTable.gwt-HTML .highlightedText {
text-align: center;
}

.gwt-HTML.highlightedText {
font-weight: bold;
/*text-transform: uppercase;*/
Expand Down

0 comments on commit 88c9e9b

Please sign in to comment.