diff --git a/Jenkinsfile b/Jenkinsfile index 260ac443..b525f089 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,10 +1,17 @@ -stage 'Build' +stage 'assemble' node { checkout scm - sh "./gradlew clean :android:build" + sh "./gradlew clean assembleWithMapsWithAnalyticsforPlay" +} + +stage 'lint' +node { + checkout scm + sh "./gradlew lintWithMapsWithAnalyticsforPlayRelease" + publishHTML(target:[allowMissing: false, alwaysLinkToLastBuild: false, keepAll: false, reportDir: 'android/build/outputs/', reportFiles: 'lint-results-withMapsWithAnalyticsForPlayRelease.html', reportName: 'Lint reports']) } stage 'UITest' node { - sh "./gradlew spoonWithMapsWithAnalyticsforFDroid" + sh "./gradlew spoonWithMapsWithAnalyticsforPlay" } \ No newline at end of file diff --git a/android/src/androidTest/java/org/ligi/passandroid/steps/HelpSteps.java b/android/src/androidTest/java/org/ligi/passandroid/steps/HelpSteps.java index f42a3e4a..48e3da47 100644 --- a/android/src/androidTest/java/org/ligi/passandroid/steps/HelpSteps.java +++ b/android/src/androidTest/java/org/ligi/passandroid/steps/HelpSteps.java @@ -1,13 +1,17 @@ package org.ligi.passandroid.steps; -import android.support.test.espresso.web.assertion.WebViewAssertions; +import org.ligi.passandroid.R; -import static android.support.test.espresso.web.matcher.DomMatchers.containingTextInBody; -import static android.support.test.espresso.web.sugar.Web.onWebView; +import static android.support.test.espresso.Espresso.onView; +import static android.support.test.espresso.assertion.ViewAssertions.matches; +import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed; +import static android.support.test.espresso.matcher.ViewMatchers.withId; public class HelpSteps { + public static void checkThatHelpIsThere() { - onWebView().check(WebViewAssertions.webContent(containingTextInBody("Example passes"))); + onView(withId(R.id.help_text)).check(matches(isDisplayed())); } + } diff --git a/android/src/main/java/org/ligi/passandroid/ui/HelpActivity.java b/android/src/main/java/org/ligi/passandroid/ui/HelpActivity.java index 82afff13..f0761b58 100644 --- a/android/src/main/java/org/ligi/passandroid/ui/HelpActivity.java +++ b/android/src/main/java/org/ligi/passandroid/ui/HelpActivity.java @@ -3,19 +3,23 @@ package org.ligi.passandroid.ui; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; +import android.text.Editable; +import android.text.Html; +import android.text.Spanned; +import android.text.method.LinkMovementMethod; import android.view.MenuItem; -import android.webkit.WebSettings; -import android.webkit.WebView; +import android.widget.TextView; import org.ligi.passandroid.R; +import org.xml.sax.XMLReader; import butterknife.Bind; import butterknife.ButterKnife; public class HelpActivity extends AppCompatActivity { - @Bind(R.id.help_webview) - WebView helpWebView; + @Bind(R.id.help_text) + TextView helpText; @Bind(R.id.toolbar) Toolbar toolbar; @@ -26,16 +30,30 @@ public class HelpActivity extends AppCompatActivity { setContentView(R.layout.activity_help); ButterKnife.bind(this); - WebSettings webSettings = helpWebView.getSettings(); - webSettings.setJavaScriptEnabled(true); - webSettings.setStandardFontFamily("Sans-Serif"); + final Spanned html = Html.fromHtml(getString(R.string.help_content), null, new ListTagHandler()); - helpWebView.loadData(getString(R.string.help_content),"text/html","utf-8"); + helpText.setText(html); + helpText.setMovementMethod(new LinkMovementMethod()); setSupportActionBar(toolbar); - getSupportActionBar().setDisplayHomeAsUpEnabled(true); + if (getSupportActionBar()!=null) { + getSupportActionBar().setDisplayHomeAsUpEnabled(true); + } } + class ListTagHandler implements Html.TagHandler { + + @Override + public void handleTag(boolean opening, String tag, Editable output, XMLReader xmlReader) { + if (tag.equalsIgnoreCase("li")) { + if (opening) { + output.append("\u2022 "); + } else { + output.append("\n"); + } + } + } + } @Override public boolean onOptionsItemSelected(MenuItem item) { diff --git a/android/src/main/res/layout/activity_help.xml b/android/src/main/res/layout/activity_help.xml index f22f69bb..d68fd9f3 100644 --- a/android/src/main/res/layout/activity_help.xml +++ b/android/src/main/res/layout/activity_help.xml @@ -27,8 +27,8 @@ android:layout_height="match_parent" app:layout_behavior="@string/appbar_scrolling_view_behavior"> -