diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
new file mode 100644
index 00000000..61018a7d
--- /dev/null
+++ b/.github/PULL_REQUEST_TEMPLATE.md
@@ -0,0 +1,7 @@
+Please make sure these boxes are checked before submitting your pull request - thanks!
+
+- [ ] Apply the `AndroidStyle.xml` style template to your code in Android Studio.
+
+- [ ] Run the checks with `./gradlew check` to make sure you didn't break anything
+
+- [ ] If you have multiple commits please combine them into one commit by squashing them.
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
index f8b44c36..ece08a20 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,9 +3,11 @@
/.idea/workspace.xml
/.idea/libraries
.DS_Store
-/build
-/.idea/
+build/
+.idea/
/app/build
/app/app.iml
/simple-xml-2.7.1
-
+incubator-taverna-mobile.iml
+TavernaMobile2.iml
+projectFilesBackup/
\ No newline at end of file
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 00000000..39f1ba8a
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,34 @@
+## Licensed to the Apache Software Foundation (ASF) under one
+## or more contributor license agreements. See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership. The ASF licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License. You may obtain a copy of the License at
+##
+## http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing,
+## software distributed under the License is distributed on an
+## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+## KIND, either express or implied. See the License for the
+## specific language governing permissions and limitations
+## under the License.
+
+language: android
+jdk: oraclejdk8
+android:
+ components:
+ - tools
+ - extra-android-support
+ - extra-google-google_play_services
+ - extra-android-m2repository
+ - extra-google-m2repository
+ - build-tools-28.0.3
+ - android-28
+
+before_install:
+ - yes | sdkmanager "platforms;android-28"
+ - gradle -b wrapper.gradle wrapper
+
+script: "./gradlew build --stacktrace"
diff --git a/AndroidStyle.xml b/AndroidStyle.xml
new file mode 100644
index 00000000..ff32f74d
--- /dev/null
+++ b/AndroidStyle.xml
@@ -0,0 +1,151 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/DISCLAIMER b/DISCLAIMER
index 3e3a5cee..aa10f6e0 100644
--- a/DISCLAIMER
+++ b/DISCLAIMER
@@ -1,10 +1,2 @@
-Apache Taverna is an effort undergoing incubation at the Apache Software
-Foundation (ASF), sponsored by the Apache Incubator PMC.
-
-Incubation is required of all newly accepted projects until a further review
-indicates that the infrastructure, communications, and decision making process
-have stabilized in a manner consistent with other successful ASF projects.
-
-While incubation status is not necessarily a reflection of the completeness
-or stability of the code, it does indicate that the project has yet to be
-fully endorsed by the ASF.
+Taverna is no longer maintained and this code base
+is provided for archive purposes only.
diff --git a/NOTICE b/NOTICE
index 2755a6bf..2311d4dd 100644
--- a/NOTICE
+++ b/NOTICE
@@ -1,5 +1,6 @@
+This product is based on:
Apache Taverna Mobile
-Copyright 2015-2016 The Apache Software Foundation
+Copyright 2015-2020 The Apache Software Foundation
This product includes software developed at
The Apache Software Foundation (http://www.apache.org/).
diff --git a/README.md b/README.md
index 99f7787d..bbab7da3 100644
--- a/README.md
+++ b/README.md
@@ -14,12 +14,45 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-# Apache Taverna Mobile
-Apache Taverna Mobile is an Android app
-for controlling an [Apache Taverna Server](http://taverna.incubator.apache.org/documentation/server/)
+
+
+
+## Taverna Project Retired
+
+> tl;dr: The Taverna code base is **no longer maintained**
+> and is provided here for archival purposes.
+
+From 2014 till 2020 this code base was maintained by the
+[Apache Incubator](https://incubator.apache.org/) project _Apache Taverna (incubating)_
+(see [web archive](https://web.archive.org/web/20200312133332/https://taverna.incubator.apache.org/)
+and [podling status](https://incubator.apache.org/projects/taverna.html)).
+
+In 2020 the Taverna community
+[voted](https://lists.apache.org/thread.html/r559e0dd047103414fbf48a6ce1bac2e17e67504c546300f2751c067c%40%3Cdev.taverna.apache.org%3E)
+to **retire** Taverna as a project and withdraw the code base from the Apache Software Foundation.
+
+This code base remains available under the Apache License 2.0
+(see _License_ below), but is now simply called
+_Taverna_ rather than ~~Apache Taverna (incubating)~~.
+
+While the code base is no longer actively maintained,
+Pull Requests are welcome to the
+[GitHub organization taverna](http://github.com/taverna/),
+which may infrequently be considered by remaining
+volunteer caretakers.
+
+
+### Previous releases
+
+This code has not yet been formally released.
+
+
+# Taverna Mobile
+
+Taverna Mobile is an Android app for controlling an [Taverna Server](https://web.archive.org/web/*/https://taverna.incubator.apache.org/documentation/server/)
for remotely running
-[Apache Taverna](http://taverna.incubator.apache.org/) workflows.
+[Taverna](https://web.archive.org/web/*/https://taverna.incubator.apache.org/) workflows.
It can also talk to a [Taverna Player](https://github.com/myGrid/taverna-player-portal).
@@ -29,7 +62,7 @@ This module was created during Google Summer of Code 2015.
## License
-(c) 2015-2016 Apache Software Foundation
+(c) 2015-2020 Apache Software Foundation
This product includes software developed at The [Apache Software
Foundation](http://www.apache.org/).
@@ -44,41 +77,31 @@ details about embedded third-party libraries and source code.
# Contribute
-Please subscribe to and contact the
-[dev@taverna](http://taverna.incubator.apache.org/community/lists#dev mailing list)
-for any questions, suggestions and discussions about
-Apache Taverna Mobile.
-
-Bugs and feature plannings are tracked in the Jira
-[Issue tracker](https://issues.apache.org/jira/browse/TAVERNA/component/12326901)
-under the `TAVERNA` component _GSOC Taverna Mobile._ Feel free
-to add an issue!
-
-To suggest changes to this source code, feel free to raise a
-[GitHub pull request](https://github.com/apache/incubator-taverna-mobile/pulls).
Any contributions received are assumed to be covered by the [Apache License
-2.0](https://www.apache.org/licenses/LICENSE-2.0). We might ask you
-to sign a [Contributor License Agreement](https://www.apache.org/licenses/#clas)
-before accepting a larger contribution.
+2.0](https://www.apache.org/licenses/LICENSE-2.0).
+
# Building and install requirements
-* Android Studio at least version 1.1.0
-* Android Build tools version 21.1.2+
-* gradle version 1.1.0+
+* Android Studio at least version 3.0.0+
+* Android Build tools version 28
+* Android SDK for API 28
+* gradle version 4.10.1 (a higher version might work)
+Use `gradle wrapper --gradle-version 4.10.1` to create the gradle wrapper. Do not commit the `gradlew` file or the `gradle` directory to the repository.
* Support libraries for CardViews and recycler views. These are already configured in the gradle files
Import the project as Android Studio Project into Android Studio after downloading from the github repository.
Create and startup a virtual device or connecct your mobile device if ready.
-Once the devices are ready, build and run the project. Select the target devvice on which to install and launch the app.
+Once the devices are ready, build and run the project. Select the target device on which to install and launch the app.
Once installed, you get a flash screen containing the logo and Name of the app and some powered by Text.
+* Also import AndroidStyle.xml to your android studio's codestyle. ( You can found this file at the project's root [file link](https://github.com/apache/incubator-taverna-mobile/blob/master/AndroidStyle.xml))
# Usage | Quick start
## Launch and Login
-Launch the application to get started. For first time use when the application is started, you will be prompted with a login screen. This login accepts MyExperiment accounts. You will need to first create one such account in order to login. You can decide whether to remain logged-in or be logged-out when your session expires. You can also configure the login persistence from the settings option in the menu after you login.
+Launch the application to get started. For first time use when the application is started, you will be prompted with tutorial screens which explains the usage of the applicationn and then you prompted to login screen. This login accepts MyExperiment accounts. You will need to first create one such account [here](https://www.myexperiment.org/users/new) in order to login. You can decide whether to remain logged-in or be logged-out when your session expires. You can also configure the login persistence from the settings option in the menu after you login.
A successful login would lead you to a dashboard or home screen of the application.
Users need to go to the settings page and configure their Taverna Player accounts and mount points to indicate which server should be used to run their workflows. This setting could change per organisation.
@@ -87,20 +110,23 @@ Users need to go to the settings page and configure their Taverna Player account
The dashboard has two swipeable tabs. These tabs represent screens that hosts workflow streams.
once logged-in a stream of workflows should appear on the first screen(Wrofklows). The second tab holds workflows that have been favorited or saved for offline reference.
On the first tab, you could pull down to referesh initial workflows. To load more workflows, just scroll to the end of the current stream. more workflows would be loaded and added to the current ones as the user reaches the end of the current stream.
-The search bar icon allows you to search and find workfows by author or by name. the results are provided in real-time in the first tab (First page).
-To mark a workflow as favorite, you can just tap the favorite button for the given workflow.
+The search bar icon allows you to search and find workfows by author or by name. The results are provided in real-time in the first tab (First page).
## Workflow Detail
-To view details and actually run a workflow, click the view button for the given workflow. Details are fetched from myxperiment and presented on the current page. The details page has three main swipeable tabs. The second tab shows a list of the runs performed on this workflow and the last tab is for some policy information. On the first page of the details, users can initiate a workflow run, download a workflow or mark them as favorite with the appropriate button.
+To view details and actually run a workflow, click the view button for the given workflow. Details are fetched from myxperiment and presented on the current page. The details page has three main swipeable tabs. The second tab shows a list of the runs performed on this workflow and the last tab is for some policy information. On the first page of the details, users can initiate a workflow run, download a workflow or mark them as favorite with the appropriate button.To mark a workflow as favorite, you can just tap the favorite toggle button for the given workflow.
## Application Menus
The navigation drawer can be pulled out from the home page by swiping the extreme left of screen across the screen. This menu contains the following items:
- - Workflows: enters the workflow screen from any other screen.
- - Open workflow: prompts users to pick a workflow to run from an external storage location or Dropbox.
- - Usage: presents usrs with usage dialog with usage information.
- - About: presents an about dialog for the application.
+ - All Workflows: Enters the workflow screen from any other screen where all the workflows are avialable.
+ - My Workflows: Presents all the workflows created by you.
+ - Favourite Workflows: Presents all the workflows which you marked as favorite.
+ - Announcement: List all the announcements about Taverna.
+ - Usage: Presents users usage information using usage activity.
+ - About: Presents an about dialog box for the application.
+ - Licence info: Presents a dialogue box with licence file of everything.
+ - Apache Licence/Notice: Presents a dialouge box of terms and conditions, reproduction, and distribution.
- Settings: Provides a settings page for users to configure preference paramters an options like player portal location and credentials.
- Logout: Logs a user out of the application and closes the app.
@@ -143,7 +169,7 @@ testing from a mobile/tablet, you may have to use WiFi to get access to the
Taverna Server on the local network.
You can alternatively install the [Taverna
-Server](http://taverna.incubator.apache.org/download/server/) WAR file in your
+Server](https://web.archive.org/web/*/https://taverna.incubator.apache.org/download/server/) WAR file in your
favourite servlet container, e.g. [Apache Tomcat](http://tomcat.apache.org/) - see
the [Taverna Server installation guide](https://launchpad.net/taverna-server/2.5.x/2.5.4/+download/install.pdf)
for details.
diff --git a/TavernaMobile2.iml b/TavernaMobile2.iml
deleted file mode 100644
index 0bb6048a..00000000
--- a/TavernaMobile2.iml
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/app/build.gradle b/app/build.gradle
index 110480ab..145d2afb 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -1,27 +1,70 @@
apply plugin: 'com.android.application'
-apply plugin: 'com.neenbedankt.android-apt'
+apply plugin: 'com.jakewharton.butterknife'
+apply from: '../config/quality/quality.gradle'
android {
- compileSdkVersion 23
- buildToolsVersion "21.1.2"
+ compileSdkVersion rootProject.ext.compileSdkVersion
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_1_8
+ targetCompatibility JavaVersion.VERSION_1_8
+ }
useLibrary 'org.apache.http.legacy'
lintOptions {
abortOnError false
}
defaultConfig {
- applicationId "mobile.taverna.apache.org.tavernamobile"
- minSdkVersion 16
- targetSdkVersion 21
+ applicationId "org.apache.taverna.mobile"
+ minSdkVersion rootProject.ext.minSdkVersion
+ targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"
+ multiDexEnabled true
+ testInstrumentationRunner 'org.apache.taverna.mobile.runner.RxAndroidJUnitRunner'
+ }
+
+ sourceSets {
+ def commonTestDir = 'src/commonTest/java'
+
+ main {
+ java.srcDirs = ['src/main/java']
+ }
+ androidTest {
+ java.srcDirs = ['src/androidTest/java/']
+ java.srcDir commonTestDir
+ resources.srcDirs += 'src/commonTest/resources'
+
+ }
+ test {
+ java.srcDirs = ['src/test/java/']
+ java.srcDir commonTestDir
+ resources.srcDirs += 'src/commonTest/resources'
+ }
}
+
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
+ debug {
+ debuggable true
+ }
+ }
+
+ testOptions {
+ unitTests.returnDefaultValues = true
}
+
+ packagingOptions {
+ exclude 'META-INF/rxjava.properties'
+ }
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_1_8
+ targetCompatibility JavaVersion.VERSION_1_8
+ }
+
+ buildToolsVersion rootProject.ext.buildToolsVersion
}
repositories {
jcenter()
@@ -29,33 +72,95 @@ repositories {
}
dependencies {
- compile fileTree(dir: 'libs', include: ['*.jar'])
- compile 'com.android.support:appcompat-v7:23.3.0'
- compile 'com.android.support:cardview-v7:23.3.0'
- compile 'com.android.support:recyclerview-v7:23.3.0'
- compile 'com.android.support:support-v4:23.3.0'
- compile files('libs/dropbox-android-sdk-1.6.3.jar')
- compile 'com.android.support:design:23.3.0'
-
- compile 'com.squareup.retrofit2:retrofit:2.0.2'
- compile "com.squareup.retrofit2:adapter-rxjava:2.0.2"
- compile('com.squareup.retrofit2:converter-simplexml:2.0.2') {
+ implementation fileTree(dir: 'libs', include: ['*.jar'])
+ //Dependencies for support library
+ implementation "com.android.support:appcompat-v7:$rootProject.supportLibraryVersion"
+ implementation "com.android.support:cardview-v7:$rootProject.supportLibraryVersion"
+ implementation "com.android.support:recyclerview-v7:$rootProject.supportLibraryVersion"
+ implementation "com.android.support:support-v4:$rootProject.supportLibraryVersion"
+ implementation "com.android.support:support-annotations:$rootProject.supportLibraryVersion"
+
+ implementation "com.android.support:design:$rootProject.supportLibraryVersion"
+ implementation "com.android.support:preference-v7:$rootProject.supportLibraryVersion"
+ implementation "com.android.support:preference-v14:$rootProject.supportLibraryVersion"
+
+ //Dependencies for retofit and okhhtp3
+ implementation "com.squareup.retrofit2:retrofit:$rootProject.retrofitVersionLatest"
+ implementation "com.squareup.retrofit2:adapter-rxjava2:$rootProject.retrofitVersionLatest"
+ implementation "com.squareup.okhttp3:logging-interceptor:$rootProject.okHttp3Version"
+ implementation "com.squareup.retrofit2:converter-gson:$rootProject.retrofitVersionLatest"
+
+ implementation("com.squareup.retrofit2:converter-simplexml:$rootProject.retrofitVersionLatest") {
exclude group: 'xpp3', module: 'xpp3'
exclude group: 'stax', module: 'stax-api'
exclude group: 'stax', module: 'stax'
}
- compile 'com.jakewharton:butterknife:8.0.1'
- apt 'com.jakewharton:butterknife-compiler:8.0.1'
+ //Dependencies for butterknife
+ implementation "com.jakewharton:butterknife:$rootProject.butterKnifeVersion"
+ annotationProcessor "com.jakewharton:butterknife-compiler:$rootProject.butterKnifeVersion"
- compile 'io.reactivex:rxandroid:1.2.0'
-// Because RxAndroid releases are few and far between, it is recommended you also
-// explicitly depend on RxJava's latest version for bug fixes and new features.
- compile 'io.reactivex:rxjava:1.1.4'
+ implementation "io.reactivex.rxjava2:rxjava:$rootProject.rxJava2Version"
+ implementation "io.reactivex.rxjava2:rxandroid:$rootProject.rxJava2Version"
- compile('org.simpleframework:simple-xml:2.7.+'){
+ implementation("org.simpleframework:simple-xml:2.7.1") {
exclude module: 'stax'
exclude module: 'stax-api'
exclude module: 'xpp3'
}
+
+ implementation "com.android.support:customtabs:$rootProject.supportLibraryVersion"
+ implementation 'com.github.bumptech.glide:glide:3.6.0'
+ implementation 'com.caverock:androidsvg:1.2.1'
+
+ //Dependencies for dbflow
+ annotationProcessor "com.github.Raizlabs.DBFlow:dbflow-processor:$rootProject.raizLabsDBFlow"
+ implementation "com.github.Raizlabs.DBFlow:dbflow-core:$rootProject.raizLabsDBFlow"
+ implementation "com.github.Raizlabs.DBFlow:dbflow:$rootProject.raizLabsDBFlow"
+
+ //Dependencies for db debug
+ implementation "com.facebook.stetho:stetho:$rootProject.stetho"
+ implementation "com.facebook.stetho:stetho-okhttp3:$rootProject.stetho"
+
+ //Dependencies for Image zoom
+ implementation "com.github.chrisbanes:PhotoView:1.2.6"
+ implementation "com.android.support:multidex:1.0.2"
+ implementation "com.google.code.gson:gson:2.8.2"
+
+ implementation 'de.hdodenhof:circleimageview:2.2.0'
+ implementation "com.anton46:stepsview:0.0.2"
+
+ //Dependencies for LeakCanary
+ debugImplementation "com.squareup.leakcanary:leakcanary-android:$rootProject.leakcanary"
+ releaseImplementation "com.squareup.leakcanary:leakcanary-android-no-op:$rootProject.leakcanary"
+ testImplementation "com.squareup.leakcanary:leakcanary-android-no-op:$rootProject.leakcanary"
+
+ //Dependencies for JUNit and unit tests.
+ testImplementation "junit:junit:4.12"
+ testImplementation "org.mockito:mockito-core:2.8.47"
+
+ androidTestImplementation "junit:junit:4.12"
+ androidTestImplementation "org.mockito:mockito-core:2.8.47"
+
+ androidTestImplementation "org.mockito:mockito-android:2.8.47"
+ androidTestImplementation "com.android.support:support-annotations:$rootProject.supportLibraryVersion"
+ androidTestImplementation("com.android.support.test.espresso:espresso-contrib:$rootProject.espresso") {
+ exclude group: 'com.android.support', module: 'appcompat'
+ exclude group: 'com.android.support', module: 'support-v4'
+ exclude group: 'com.android.support', module: 'recyclerview-v7'
+ }
+ androidTestImplementation "com.android.support.test.espresso:espresso-core:$rootProject.espresso"
+ androidTestImplementation ("com.android.support.test.espresso:espresso-intents:$rootProject.espresso")
+
+ androidTestImplementation "com.android.support.test:runner:$rootProject.runner"
+ androidTestImplementation "com.android.support.test:rules:$rootProject.runner"
+
+ //Dependencies for Dagger 2
+ implementation "com.google.dagger:dagger:$rootProject.dagger"
+ testImplementation "com.google.dagger:dagger:$rootProject.dagger"
+ androidTestImplementation "com.google.dagger:dagger:$rootProject.dagger"
+ annotationProcessor "com.google.dagger:dagger-compiler:$rootProject.dagger"
+ androidTestAnnotationProcessor "com.google.dagger:dagger-compiler:$rootProject.dagger"
+ testAnnotationProcessor "com.google.dagger:dagger-compiler:$rootProject.dagger"
+
}
diff --git a/app/libs/dropbox-android-sdk-1.6.3.jar b/app/libs/dropbox-android-sdk-1.6.3.jar
deleted file mode 100644
index 1a0ee368..00000000
Binary files a/app/libs/dropbox-android-sdk-1.6.3.jar and /dev/null differ
diff --git a/app/libs/json_simple-1.1.jar b/app/libs/json_simple-1.1.jar
deleted file mode 100644
index f395f414..00000000
Binary files a/app/libs/json_simple-1.1.jar and /dev/null differ
diff --git a/app/libs/sjxp-2.2.jar b/app/libs/sjxp-2.2.jar
deleted file mode 100644
index 67960bc4..00000000
Binary files a/app/libs/sjxp-2.2.jar and /dev/null differ
diff --git a/app/src/androidTest/java/org/apache/taverna/mobile/DashboardActivityTest.java b/app/src/androidTest/java/org/apache/taverna/mobile/DashboardActivityTest.java
new file mode 100644
index 00000000..5e6f7212
--- /dev/null
+++ b/app/src/androidTest/java/org/apache/taverna/mobile/DashboardActivityTest.java
@@ -0,0 +1,296 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.taverna.mobile;
+
+import android.support.test.espresso.contrib.DrawerActions;
+import android.support.test.espresso.contrib.NavigationViewActions;
+import android.support.test.espresso.intent.Intents;
+import android.support.test.rule.ActivityTestRule;
+import android.support.test.runner.AndroidJUnit4;
+import android.view.Gravity;
+
+import org.apache.taverna.mobile.ui.DashboardActivity;
+import org.apache.taverna.mobile.ui.login.LoginActivity;
+import org.apache.taverna.mobile.ui.usage.UsageActivity;
+import org.apache.taverna.mobile.ui.userprofile.UserProfileActivity;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import static android.os.SystemClock.sleep;
+import static android.support.test.espresso.Espresso.onView;
+import static android.support.test.espresso.action.ViewActions.click;
+import static android.support.test.espresso.assertion.ViewAssertions.matches;
+import static android.support.test.espresso.contrib.DrawerMatchers.isClosed;
+import static android.support.test.espresso.contrib.DrawerMatchers.isOpen;
+import static android.support.test.espresso.intent.Intents.intended;
+import static android.support.test.espresso.intent.matcher.IntentMatchers.hasComponent;
+import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
+import static android.support.test.espresso.matcher.ViewMatchers.withId;
+import static android.support.test.espresso.matcher.ViewMatchers.withText;
+
+
+@RunWith(AndroidJUnit4.class)
+public class DashboardActivityTest {
+
+ @Rule
+ public ActivityTestRule mActivityTestRule
+ = new ActivityTestRule<>(DashboardActivity.class);
+
+ @Before
+ public void setUp() {
+ mActivityTestRule.getActivity()
+ .getSupportFragmentManager().beginTransaction();
+ }
+
+ /**
+ * Check if the username, password and userAvatar are visible and verify when click on
+ * userAvatar UserProfileActivity will open
+ */
+ @Test
+ public void checkAllViewsVisible_and_OnClickAvatar_openUserProfileActivity() throws Exception {
+
+ Intents.init();
+ onView(withId(R.id.drawer_layout))
+ .check(matches(isClosed(Gravity.LEFT)))
+ .perform(DrawerActions.open());
+
+ //Please Login first otherwise it will not find username and email
+ onView(withId(R.id.nav_user_avatar)).check(matches((isDisplayed())));
+ onView(withId(R.id.nav_user_name)).check(matches((isDisplayed())));
+ onView(withId(R.id.nav_user_email)).check(matches((isDisplayed())));
+
+ onView(withId(R.id.nav_user_avatar)).perform(click());
+
+ intended(hasComponent(UserProfileActivity.class.getName()));
+ Intents.release();
+ }
+
+ /**
+ * Checks if the Workflow fragment is launched when we click on Workflow in nav drawer
+ */
+ @Test
+ public void onClickNavAllWorkflows_openWorkflowsFragment() throws Exception {
+
+ onView(withId(R.id.drawer_layout))
+ .check(matches(isClosed(Gravity.LEFT)))
+ .perform(DrawerActions.open());
+
+ onView(withId(R.id.nav_view))
+ .perform(NavigationViewActions.navigateTo(R.id.nav_workflows));
+
+ onView(withId(R.id.frame_container)).check(matches((isDisplayed())));
+
+ }
+
+ /**
+ * Checks if the myWorkflow fragment is launched when we click on myWorkflow in nav drawer.
+ * Without login, The app does not have any user then it also does not have any myworkflow
+ * Without login it will fail
+ */
+ @Test
+ public void onClickNavMyWorkflows_openMyWorkflowActivity() throws Exception {
+
+ onView(withId(R.id.drawer_layout))
+ .check(matches(isClosed(Gravity.LEFT)))
+ .perform(DrawerActions.open());
+
+ onView(withId(R.id.nav_view))
+ .perform(NavigationViewActions.navigateTo(R.id.nav_my_workflows));
+
+ onView(withId(R.id.frame_container)).check(matches((isDisplayed())));
+
+ }
+
+ /**
+ * Checks if the favoriteWorkflow fragment is launched when we click on
+ * favoriteWorkflow in nav drawer
+ */
+ @Test
+ public void onClickNavFavWorkflows_openFavoriteWorkflowActivity() throws Exception {
+
+ onView(withId(R.id.drawer_layout))
+ .check(matches(isClosed(Gravity.LEFT)))
+ .perform(DrawerActions.open());
+
+ onView(withId(R.id.nav_view))
+ .perform(NavigationViewActions.navigateTo(R.id.nav_favourite_workflow));
+
+ sleep(3000);
+
+ onView(withId(R.id.frame_container)).check(matches((isDisplayed())));
+
+ }
+
+ /**
+ * Checks if the Announcement fragment is launched when we click on
+ * announcement in nav drawer
+ */
+ @Test
+ public void onClickNavAnnouncement_openAnnouncementActivity() throws Exception {
+
+ onView(withId(R.id.drawer_layout))
+ .check(matches(isClosed(Gravity.LEFT)))
+ .perform(DrawerActions.open());
+
+ onView(withId(R.id.nav_view))
+ .perform(NavigationViewActions.navigateTo(R.id.nav_announcement));
+
+ sleep(3000);
+
+ onView(withId(R.id.frame_container)).check(matches((isDisplayed())));
+
+ }
+
+ /**
+ * Checks if the usage activity is launched when we click on usage in nav drawer
+ */
+ @Test
+ public void onClickNavUsage_openUsageActivity() throws Exception {
+
+ Intents.init();
+
+ onView(withId(R.id.drawer_layout))
+ .check(matches(isClosed(Gravity.LEFT)))
+ .perform(DrawerActions.open());
+
+ onView(withId(R.id.nav_view))
+ .perform(NavigationViewActions.navigateTo(R.id.nav_usage));
+
+ intended(hasComponent(UsageActivity.class.getName()));
+
+ Intents.release();
+ }
+
+ /**
+ * Checks if the About dialouge is launched when we click on about in nav drawer
+ */
+ @Test
+ public void onClickNavAbout_checkAboutDialogue() throws Exception {
+
+ onView(withId(R.id.drawer_layout))
+ .check(matches(isClosed(Gravity.LEFT)))
+ .perform(DrawerActions.open());
+
+ onView(withId(R.id.nav_view))
+ .perform(NavigationViewActions.navigateTo(R.id.nav_about));
+
+ onView(withId(R.id.about_dialouge_layout)).check(matches((isDisplayed())));
+
+ }
+
+ /**
+ * Checks if the Licence dialouge is launched when we click on licence in nav drawer
+ */
+ @Test
+ public void onClickNavLicence_openLicenceDialouge() throws Exception {
+
+ onView(withId(R.id.drawer_layout))
+ .check(matches(isClosed(Gravity.LEFT)))
+ .perform(DrawerActions.open());
+
+ onView(withId(R.id.nav_view))
+ .perform(NavigationViewActions.navigateTo(R.id.os_licences));
+
+ onView(withText(R.string.title_nav_os_licences)).check(matches(isDisplayed()));
+
+ }
+
+ /**
+ * Checks if the Licence dialogue is launched when we click on licence in nav drawer
+ */
+ @Test
+ public void onClickNavApacheLicence_openApacheLicence_NoticeDialouge() throws Exception {
+
+ onView(withId(R.id.drawer_layout))
+ .check(matches(isClosed(Gravity.LEFT)))
+ .perform(DrawerActions.open());
+
+ onView(withId(R.id.nav_view))
+ .perform(NavigationViewActions.navigateTo(R.id.apache_licences));
+
+ onView(withText(R.string.title_nav_apache_licences)).check(matches(isDisplayed()));
+
+ }
+
+ /**
+ * Checks if the setting fragment is launched
+ * when we click on settings in navigation drawer
+ */
+ @Test
+ public void onClickNavSetting_openSettingFragment() throws Exception {
+
+ onView(withId(R.id.drawer_layout))
+ .check(matches(isClosed(Gravity.LEFT)))
+ .perform(DrawerActions.open());
+
+ onView(withId(R.id.nav_view))
+ .perform(NavigationViewActions.navigateTo(R.id.nav_settings));
+
+ onView(withId(R.id.frame_container)).check(matches((isDisplayed())));
+
+ }
+
+ /**
+ * Checks if the login is launched when click on logout in nav drawer and click on
+ * sign out in alert dialouge box
+ */
+ @Test
+ public void onClickLogout_ClickSignOut_OpenLoginScreen() throws Exception {
+
+ Intents.init();
+ onView(withId(R.id.drawer_layout))
+ .check(matches(isClosed(Gravity.LEFT)))
+ .perform(DrawerActions.open());
+
+ onView(withId(R.id.nav_view))
+ .perform(NavigationViewActions.navigateTo(R.id.nav_logout));
+
+ onView(withId(android.R.id.button1)).perform(click());
+
+ intended(hasComponent(LoginActivity.class.getName()));
+
+ Intents.release();
+ }
+
+ /**
+ * Checks if alert dialogue box is dismiss when click on cancel in logout alert sign in box
+ */
+ @Test
+ public void onClickLogout_clickCancel_dismissDialogueBoz() throws Exception {
+
+ Intents.init();
+ onView(withId(R.id.drawer_layout))
+ .check(matches(isClosed(Gravity.LEFT)))
+ .perform(DrawerActions.open());
+
+ onView(withId(R.id.nav_view))
+ .perform(NavigationViewActions.navigateTo(R.id.nav_logout));
+
+ onView(withId(android.R.id.button2)).perform(click());
+
+ onView(withId(R.id.drawer_layout))
+ .check(matches(isOpen(Gravity.LEFT)));
+
+ Intents.release();
+ }
+
+
+}
\ No newline at end of file
diff --git a/app/src/androidTest/java/org/apache/taverna/mobile/TestComponentRule.java b/app/src/androidTest/java/org/apache/taverna/mobile/TestComponentRule.java
new file mode 100644
index 00000000..9c5b5f87
--- /dev/null
+++ b/app/src/androidTest/java/org/apache/taverna/mobile/TestComponentRule.java
@@ -0,0 +1,103 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.taverna.mobile;
+
+import org.apache.taverna.mobile.data.DataManager;
+import org.apache.taverna.mobile.injection.component.DaggerTestComponent;
+import org.apache.taverna.mobile.injection.component.TestComponent;
+import org.apache.taverna.mobile.injection.module.ApplicationTestModule;
+
+
+import org.junit.rules.TestRule;
+import org.junit.runner.Description;
+import org.junit.runners.model.Statement;
+
+import android.content.Context;
+
+import java.util.concurrent.Callable;
+
+import io.reactivex.Scheduler;
+import io.reactivex.android.plugins.RxAndroidPlugins;
+import io.reactivex.functions.Function;
+import io.reactivex.plugins.RxJavaPlugins;
+import io.reactivex.schedulers.Schedulers;
+
+public class TestComponentRule implements TestRule {
+
+ private final TestComponent mTestComponent;
+ private final Context mContext;
+
+ private Scheduler schedulerInstance = Schedulers.trampoline();
+
+ private Function schedulerMapper = new Function() {
+ @Override
+ public Scheduler apply(Scheduler scheduler) throws Exception {
+ return schedulerInstance;
+ }
+ };
+ private Function, Scheduler> schedulerMapperLazy =
+ new Function, Scheduler>() {
+
+
+ @Override
+ public Scheduler apply(Callable schedulerCallable) throws Exception {
+ return schedulerInstance;
+ }
+ };
+
+ public TestComponentRule(Context context) {
+ mContext = context;
+ TavernaApplication application = TavernaApplication.get(context);
+ mTestComponent = DaggerTestComponent.builder()
+ .applicationTestModule(new ApplicationTestModule(application))
+ .build();
+ }
+
+ public Context getContext() {
+ return mContext;
+ }
+
+ public DataManager getMockDataManager() {
+ return mTestComponent.dataManager();
+ }
+
+ @Override
+ public Statement apply(final Statement base, Description description) {
+ return new Statement() {
+ @Override
+ public void evaluate() throws Throwable {
+ RxAndroidPlugins.reset();
+ RxAndroidPlugins.setInitMainThreadSchedulerHandler(schedulerMapperLazy);
+
+ RxJavaPlugins.reset();
+ RxJavaPlugins.setIoSchedulerHandler(schedulerMapper);
+ RxJavaPlugins.setNewThreadSchedulerHandler(schedulerMapper);
+ RxJavaPlugins.setComputationSchedulerHandler(schedulerMapper);
+
+ TavernaApplication application = TavernaApplication.get(mContext);
+ application.setComponent(mTestComponent);
+
+ base.evaluate();
+ application.setComponent(null);
+ RxAndroidPlugins.reset();
+ RxJavaPlugins.reset();
+ }
+ };
+ }
+}
\ No newline at end of file
diff --git a/app/src/androidTest/java/org/apache/taverna/mobile/announcement/AnnouncementActivityTest.java b/app/src/androidTest/java/org/apache/taverna/mobile/announcement/AnnouncementActivityTest.java
new file mode 100644
index 00000000..d763b7f1
--- /dev/null
+++ b/app/src/androidTest/java/org/apache/taverna/mobile/announcement/AnnouncementActivityTest.java
@@ -0,0 +1,104 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.taverna.mobile.announcement;
+
+import org.apache.taverna.mobile.FakeRemoteDataSource;
+import org.apache.taverna.mobile.R;
+import org.apache.taverna.mobile.SingleFragmentActivity;
+import org.apache.taverna.mobile.TestComponentRule;
+import org.apache.taverna.mobile.data.model.Announcements;
+import org.apache.taverna.mobile.ui.anouncements.AnnouncementFragment;
+import org.apache.taverna.mobile.utils.RecyclerViewItemCountAssertion;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.RuleChain;
+import org.junit.rules.TestRule;
+import org.junit.runner.RunWith;
+import org.mockito.Mockito;
+
+import android.content.Intent;
+import android.support.test.InstrumentationRegistry;
+import android.support.test.rule.ActivityTestRule;
+import android.support.test.runner.AndroidJUnit4;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import io.reactivex.Observable;
+
+import static android.os.SystemClock.sleep;
+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;
+
+@RunWith(AndroidJUnit4.class)
+public class AnnouncementActivityTest {
+
+ private Announcements announcements;
+ private Map option;
+
+ private final TestComponentRule component =
+ new TestComponentRule(InstrumentationRegistry.getTargetContext());
+ private final ActivityTestRule mAnnouncementActivityTestRule =
+ new ActivityTestRule(SingleFragmentActivity.class,
+ false, false) {
+ @Override
+ protected Intent getActivityIntent() {
+
+ return new Intent(InstrumentationRegistry.getTargetContext(),
+ SingleFragmentActivity.class);
+ }
+ };
+
+ /**
+ * TestComponentRule needs to go first to make sure the Dagger ApplicationTestComponent is set
+ * in the Application before any Activity is launched.
+ */
+ @Rule
+ public final TestRule chain = RuleChain.outerRule(component)
+ .around(mAnnouncementActivityTestRule);
+
+
+ @Before
+ public void setUp() {
+ announcements = FakeRemoteDataSource.getAnnouncements();
+ option = new HashMap<>();
+ option.put("order", "reverse");
+ option.put("page", String.valueOf(1));
+ }
+
+ @Test
+ public void CheckIfRecyclerViewIsLoaded() {
+
+
+ Mockito.when(component.getMockDataManager().getAllAnnouncement(option))
+ .thenReturn(Observable.just(announcements));
+ mAnnouncementActivityTestRule.launchActivity(null);
+ mAnnouncementActivityTestRule.getActivity().setFragment(new AnnouncementFragment());
+
+ onView(withId(R.id.rv_movies)).check(new RecyclerViewItemCountAssertion(5));
+
+
+
+ }
+
+
+}
diff --git a/app/src/androidTest/java/org/apache/taverna/mobile/fragments/workflowdetails/WorkflowdetailFragmentTest.java b/app/src/androidTest/java/org/apache/taverna/mobile/fragments/workflowdetails/WorkflowdetailFragmentTest.java
index 634d1056..1c9657c3 100644
--- a/app/src/androidTest/java/org/apache/taverna/mobile/fragments/workflowdetails/WorkflowdetailFragmentTest.java
+++ b/app/src/androidTest/java/org/apache/taverna/mobile/fragments/workflowdetails/WorkflowdetailFragmentTest.java
@@ -1,3 +1,28 @@
+/*
+* Apache Taverna Mobile
+* Copyright 2016 The Apache Software Foundation
+
+* This product includes software developed at
+* The Apache Software Foundation (http://www.apache.org/).
+
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
package org.apache.taverna.mobile.fragments.workflowdetails;
import junit.framework.TestCase;
diff --git a/app/src/androidTest/java/org/apache/taverna/mobile/injection/component/TestComponent.java b/app/src/androidTest/java/org/apache/taverna/mobile/injection/component/TestComponent.java
new file mode 100644
index 00000000..76ac0e86
--- /dev/null
+++ b/app/src/androidTest/java/org/apache/taverna/mobile/injection/component/TestComponent.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.taverna.mobile.injection.component;
+
+import org.apache.taverna.mobile.injection.module.ApplicationTestModule;
+
+import javax.inject.Singleton;
+
+import dagger.Component;
+
+@Singleton
+@Component(modules = ApplicationTestModule.class)
+public interface TestComponent extends ApplicationComponent {
+
+}
\ No newline at end of file
diff --git a/app/src/androidTest/java/org/apache/taverna/mobile/injection/module/ApplicationTestModule.java b/app/src/androidTest/java/org/apache/taverna/mobile/injection/module/ApplicationTestModule.java
new file mode 100644
index 00000000..e8a683f3
--- /dev/null
+++ b/app/src/androidTest/java/org/apache/taverna/mobile/injection/module/ApplicationTestModule.java
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.taverna.mobile.injection.module;
+
+import org.apache.taverna.mobile.data.DataManager;
+import org.apache.taverna.mobile.injection.ApplicationContext;
+import org.mockito.Mockito;
+
+import android.app.Application;
+import android.content.Context;
+
+import javax.inject.Singleton;
+
+import dagger.Module;
+import dagger.Provides;
+
+@Module
+public class ApplicationTestModule {
+
+ private final Application mApplication;
+
+ public ApplicationTestModule(Application application) {
+ mApplication = application;
+ }
+
+ @Provides
+ Application provideApplication() {
+ return mApplication;
+ }
+
+ @Provides
+ @ApplicationContext
+ Context provideContext() {
+ return mApplication;
+ }
+
+ /************* MOCKS *************/
+
+ @Provides
+ @Singleton
+ DataManager provideDataManager() {
+ return Mockito.mock(DataManager.class);
+ }
+
+
+}
\ No newline at end of file
diff --git a/app/src/androidTest/java/org/apache/taverna/mobile/login/LoginActivityTest.java b/app/src/androidTest/java/org/apache/taverna/mobile/login/LoginActivityTest.java
new file mode 100644
index 00000000..b94a5e76
--- /dev/null
+++ b/app/src/androidTest/java/org/apache/taverna/mobile/login/LoginActivityTest.java
@@ -0,0 +1,201 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.taverna.mobile.login;
+
+import org.apache.taverna.mobile.FakeRemoteDataSource;
+import org.apache.taverna.mobile.TestComponentRule;
+
+import org.apache.taverna.mobile.R;
+
+import org.apache.taverna.mobile.data.model.User;
+import org.apache.taverna.mobile.ui.login.LoginActivity;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.RuleChain;
+import org.junit.rules.TestRule;
+import org.junit.runner.RunWith;
+import org.mockito.Mockito;
+
+import android.content.Intent;
+import android.support.test.InstrumentationRegistry;
+import android.support.test.espresso.Espresso;
+import android.support.test.rule.ActivityTestRule;
+import android.support.test.runner.AndroidJUnit4;
+
+import io.reactivex.Observable;
+
+import static android.os.SystemClock.sleep;
+import static android.support.test.espresso.Espresso.onView;
+import static android.support.test.espresso.action.ViewActions.click;
+import static android.support.test.espresso.action.ViewActions.closeSoftKeyboard;
+import static android.support.test.espresso.action.ViewActions.typeText;
+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;
+import static android.support.test.espresso.matcher.ViewMatchers.withText;
+import static org.hamcrest.core.AllOf.allOf;
+
+@RunWith(AndroidJUnit4.class)
+public class LoginActivityTest {
+
+ private User testUser;
+
+
+ private final TestComponentRule component =
+ new TestComponentRule(InstrumentationRegistry.getTargetContext());
+ private final ActivityTestRule mLoginActivityActivityTestRule =
+ new ActivityTestRule(LoginActivity.class, false, false) {
+ @Override
+ protected Intent getActivityIntent() {
+
+ return new Intent(InstrumentationRegistry.getTargetContext(), LoginActivity
+ .class);
+ }
+ };
+
+ /**
+ * TestComponentRule needs to go first to make sure the Dagger ApplicationTestComponent is set
+ * in the Application before any Activity is launched.
+ */
+ @Rule
+ public final TestRule chain = RuleChain.outerRule(component)
+ .around(mLoginActivityActivityTestRule);
+
+ @Before
+ public void setUp() {
+ testUser = FakeRemoteDataSource.getLoginUser();
+ }
+
+ /**
+ * Checks if all the views are visible on the login activity
+ */
+ @Test
+ public void checkAllViewAreVisible() throws Exception {
+ mLoginActivityActivityTestRule.launchActivity(null);
+ onView(withId(R.id.logo)).check(matches(isDisplayed()));
+ onView(withId(R.id.tvAppName)).check(matches(withText(R.string.app_name)));
+ onView(withId(R.id.loginlayout)).check(matches(isDisplayed()));
+ onView(withId(R.id.myExperimentIcon)).check(matches(isDisplayed()));
+ onView(withId(R.id.input_layout_email)).check(matches(isDisplayed()));
+ onView(withId(R.id.input_layout_password)).check(matches(isDisplayed()));
+ onView(withId(R.id.etEmail)).check(matches(isDisplayed()));
+ onView(withId(R.id.etPassword)).check(matches(isDisplayed()));
+ Espresso.closeSoftKeyboard();
+ onView(withId(R.id.bLogin)).check(matches(isDisplayed()));
+ onView(withId(R.id.bRegister)).check(matches(isDisplayed()));
+ }
+
+ /**
+ * This test demonstrates that when user enters the invalid username and password both then
+ * it verify if the correct snackbar is shown or not
+ */
+ @Test
+ public void invalidLoginCredentials_showErrorSnackBar() throws Exception {
+
+ testUser = new User();
+ Mockito.when(component.getMockDataManager()
+ .getLoginUserDetail("Basic cG9zdG1hbjpwYXNzd29yZA==", true))
+ .thenReturn(Observable.error(new Throwable()));
+ mLoginActivityActivityTestRule.launchActivity(null);
+
+ onView(withId(R.id.etEmail))
+ .perform(typeText("postman"), closeSoftKeyboard());
+ onView(withId(R.id.etPassword))
+ .perform(typeText("password"), closeSoftKeyboard());
+
+ onView(withId(R.id.bLogin)).perform(click());
+
+ onView(allOf(withId(android.support.design.R.id.snackbar_text),
+ withText("Please enter valid credential")))
+ .check(matches(isDisplayed()));
+ }
+
+ /**
+ * This test demonstrates that when user enters the valid/invalid password and empty username
+ * then it verify if the correct snackbar is shown or not
+ */
+ @Test
+ public void emptyUsername_invalidCredentials_showErrorSnackBar() throws Exception {
+
+ testUser = new User();
+ Mockito.when(component.getMockDataManager()
+ .getLoginUserDetail("Basic OnRlc3QNCg==", true))
+ .thenReturn(Observable.just(testUser));
+ mLoginActivityActivityTestRule.launchActivity(null);
+
+ onView(withId(R.id.etEmail))
+ .perform(typeText(""), closeSoftKeyboard());
+ onView(withId(R.id.etPassword))
+ .perform(typeText("test"), closeSoftKeyboard());
+ onView(withId(R.id.bLogin)).perform(click());
+ sleep(2000);
+
+ onView(allOf(withId(android.support.design.R.id.snackbar_text),
+ withText("Please enter valid credential")))
+ .check(matches(isDisplayed()));
+ }
+
+ /**
+ * This test demonstrates that when user enters the valid/invalid username and empty password
+ * then it verify if the correct snackbar is shown or not
+ */
+ @Test
+ public void invalidPassword_invalidLoginCredentials_showErrorSnackBar() throws Exception {
+
+ testUser = new User();
+ Mockito.when(component.getMockDataManager()
+ .getLoginUserDetail("Basic dGVzdDoNCg==", true))
+ .thenReturn(Observable.just(testUser));
+ mLoginActivityActivityTestRule.launchActivity(null);
+
+ onView(withId(R.id.etEmail))
+ .perform(typeText("test"), closeSoftKeyboard());
+ onView(withId(R.id.etPassword))
+ .perform(typeText(""), closeSoftKeyboard());
+
+ onView(withId(R.id.bLogin)).perform(click());
+ sleep(2000);
+
+ onView(allOf(withId(android.support.design.R.id.snackbar_text),
+ withText("Please enter valid credential")))
+ .check(matches(isDisplayed()));
+ }
+
+ /**
+ * This test demonstrates that when user does not enters anything inside the username
+ * and password then it verify if the correct snackbar is shown or not
+ */
+ @Test
+ public void nullLoginCredentials_showErrorSnackBar() throws Exception {
+
+ mLoginActivityActivityTestRule.launchActivity(null);
+
+ onView(withId(R.id.etEmail))
+ .perform(typeText(""), closeSoftKeyboard());
+ onView(withId(R.id.etPassword))
+ .perform(typeText(""), closeSoftKeyboard());
+
+ onView(withId(R.id.bLogin)).perform(click());
+
+ onView(allOf(withId(android.support.design.R.id.snackbar_text),
+ withText("Please enter valid credential")))
+ .check(matches(isDisplayed()));
+ }
+}
\ No newline at end of file
diff --git a/app/src/androidTest/java/org/apache/taverna/mobile/runner/RxAndroidJUnitRunner.java b/app/src/androidTest/java/org/apache/taverna/mobile/runner/RxAndroidJUnitRunner.java
new file mode 100644
index 00000000..42b320c5
--- /dev/null
+++ b/app/src/androidTest/java/org/apache/taverna/mobile/runner/RxAndroidJUnitRunner.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.taverna.mobile.runner;
+
+import org.apache.taverna.mobile.utils.RxEspressoScheduleHandler;
+
+import android.os.Bundle;
+import android.support.test.espresso.Espresso;
+
+import io.reactivex.plugins.RxJavaPlugins;
+
+public class RxAndroidJUnitRunner extends UnlockDeviceAndroidJUnitRunner {
+
+ @Override
+ public void onCreate(Bundle arguments) {
+ super.onCreate(arguments);
+
+ RxEspressoScheduleHandler rxEspressoScheduleHandler = new RxEspressoScheduleHandler();
+ RxJavaPlugins.setScheduleHandler(rxEspressoScheduleHandler);
+ Espresso.registerIdlingResources(rxEspressoScheduleHandler.getIdlingResource());
+ }
+
+}
\ No newline at end of file
diff --git a/app/src/androidTest/java/org/apache/taverna/mobile/runner/UnlockDeviceAndroidJUnitRunner.java b/app/src/androidTest/java/org/apache/taverna/mobile/runner/UnlockDeviceAndroidJUnitRunner.java
new file mode 100644
index 00000000..9760a4a4
--- /dev/null
+++ b/app/src/androidTest/java/org/apache/taverna/mobile/runner/UnlockDeviceAndroidJUnitRunner.java
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.taverna.mobile.runner;
+
+import android.annotation.SuppressLint;
+import android.app.Application;
+import android.app.KeyguardManager;
+import android.content.Context;
+import android.os.PowerManager;
+import android.support.test.runner.AndroidJUnitRunner;
+
+public class UnlockDeviceAndroidJUnitRunner extends AndroidJUnitRunner {
+
+ private PowerManager.WakeLock mWakeLock;
+
+ @SuppressLint("MissingPermission")
+ @Override
+ public void onStart() {
+ Application application = (Application) getTargetContext().getApplicationContext();
+ String simpleName = UnlockDeviceAndroidJUnitRunner.class.getSimpleName();
+ // Unlock the device so that the tests can input keystrokes.
+ ((KeyguardManager) application.getSystemService(Context.KEYGUARD_SERVICE))
+ .newKeyguardLock(simpleName)
+ .disableKeyguard();
+ // Wake up the screen.
+ PowerManager powerManager = ((PowerManager) application.getSystemService(Context
+ .POWER_SERVICE));
+ mWakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK |
+ PowerManager.ACQUIRE_CAUSES_WAKEUP | PowerManager.ON_AFTER_RELEASE, simpleName);
+ mWakeLock.acquire();
+ super.onStart();
+ }
+
+ @Override
+ public void onDestroy() {
+ super.onDestroy();
+ mWakeLock.release();
+ }
+}
\ No newline at end of file
diff --git a/app/src/androidTest/java/org/apache/taverna/mobile/tutorial/TutorialActivityTest.java b/app/src/androidTest/java/org/apache/taverna/mobile/tutorial/TutorialActivityTest.java
new file mode 100644
index 00000000..8762f7fc
--- /dev/null
+++ b/app/src/androidTest/java/org/apache/taverna/mobile/tutorial/TutorialActivityTest.java
@@ -0,0 +1,123 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.taverna.mobile.tutorial;
+
+import android.support.test.espresso.intent.Intents;
+import android.support.test.rule.ActivityTestRule;
+import android.support.test.runner.AndroidJUnit4;
+
+import org.apache.taverna.mobile.R;
+import org.apache.taverna.mobile.ui.login.LoginActivity;
+import org.apache.taverna.mobile.ui.tutorial.TutorialActivity;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import static android.support.test.espresso.Espresso.onView;
+import static android.support.test.espresso.action.ViewActions.click;
+import static android.support.test.espresso.action.ViewActions.swipeLeft;
+import static android.support.test.espresso.action.ViewActions.swipeRight;
+import static android.support.test.espresso.assertion.ViewAssertions.matches;
+import static android.support.test.espresso.intent.Intents.intended;
+import static android.support.test.espresso.intent.matcher.IntentMatchers.hasComponent;
+import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
+import static android.support.test.espresso.matcher.ViewMatchers.withId;
+import static android.support.test.espresso.matcher.ViewMatchers.withText;
+import static org.hamcrest.CoreMatchers.not;
+
+@RunWith(AndroidJUnit4.class)
+public class TutorialActivityTest {
+
+ @Rule
+ public ActivityTestRule mActivityTestRule
+ = new ActivityTestRule<>(TutorialActivity.class);
+
+ @Before
+ public void setUp() {
+ mActivityTestRule.getActivity()
+ .getSupportFragmentManager().beginTransaction();
+ }
+
+ /**
+ * Check all the views present are visible
+ */
+ @Test
+ public void CheckAllViewAreVisible() throws Exception {
+
+ onView(withId(R.id.layoutDots)).check(matches((isDisplayed())));
+ onView(withId(R.id.btn_next)).check(matches((isDisplayed())));
+ onView(withId(R.id.btn_skip)).check(matches((isDisplayed())));
+ onView(withId(R.id.layoutDots)).check(matches((isDisplayed())));
+ onView(withId(R.id.slide_pager)).check(matches((isDisplayed())));
+ }
+
+ /**
+ * Checks while clicking on skip button should start login activity
+ */
+ @Test
+ public void clickingSkip_shouldStartLoginActivity() throws Exception {
+
+ Intents.init();
+ onView(withId(R.id.btn_skip)).perform(click());
+ intended(hasComponent(LoginActivity.class.getName()));
+ Intents.release();
+ }
+
+ /**
+ * Check swipes are working on tutorial screens and on last tutorial screen while clicking on
+ * GOT IT it should go to login activity
+ */
+ @Test
+ public void clickingNext_shouldGotoNextTutorial_onClickGotIt_ShouldGoToLoginActivity()
+ throws Exception {
+
+ Intents.init();
+ onView(withText(R.string.next)).check(matches(isDisplayed()));
+ onView(withId(R.id.slide_pager)).perform(swipeLeft());
+ onView(withId(R.id.slide_pager)).perform(swipeLeft());
+ onView(withId(R.id.slide_pager)).perform(swipeLeft());
+ onView(withId(R.id.slide_pager)).perform(swipeLeft());
+ onView(withText("SKIP")).check(matches(not(isDisplayed())));
+ onView(withText("GOT IT")).check(matches(isDisplayed()));
+ onView(withText("GOT IT")).perform(click());
+ intended(hasComponent(LoginActivity.class.getName()));
+ Intents.release();
+
+ }
+
+ /**
+ * First it swipes two times and then swipe back. Then this test will check while clicking
+ * on the skip button should go the login activity
+ */
+ @Test
+ public void swipeRightLeft_clickOnSkip_shouldGoToLoginActivity() throws Exception {
+
+ Intents.init();
+ onView(withText(R.string.next)).check(matches(isDisplayed()));
+ onView(withId(R.id.slide_pager)).perform(swipeLeft());
+ onView(withId(R.id.slide_pager)).perform(swipeLeft());
+ onView(withId(R.id.slide_pager)).perform(swipeRight());
+ onView(withText("SKIP")).check(matches(isDisplayed()));
+ onView(withId(R.id.btn_skip)).perform(click());
+ intended(hasComponent(LoginActivity.class.getName()));
+ Intents.release();
+ }
+
+}
diff --git a/app/src/androidTest/java/org/apache/taverna/mobile/utils/RecyclerViewItemCountAssertion.java b/app/src/androidTest/java/org/apache/taverna/mobile/utils/RecyclerViewItemCountAssertion.java
new file mode 100644
index 00000000..88f40014
--- /dev/null
+++ b/app/src/androidTest/java/org/apache/taverna/mobile/utils/RecyclerViewItemCountAssertion.java
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.taverna.mobile.utils;
+
+import android.support.test.espresso.NoMatchingViewException;
+import android.support.test.espresso.ViewAssertion;
+import android.support.test.espresso.matcher.ViewMatchers;
+import android.support.v7.widget.RecyclerView;
+import android.view.View;
+import static org.hamcrest.Matchers.equalTo;
+
+
+public class RecyclerViewItemCountAssertion implements ViewAssertion {
+ private final int expectedCount;
+
+ public RecyclerViewItemCountAssertion(int expectedCount) {
+ this.expectedCount = expectedCount;
+ }
+
+ @Override
+ public void check(View view, NoMatchingViewException noViewFoundException) {
+ if (noViewFoundException != null) {
+ throw noViewFoundException;
+ }
+
+ RecyclerView recyclerView = (RecyclerView) view;
+ RecyclerView.Adapter adapter = recyclerView.getAdapter();
+ ViewMatchers.assertThat(adapter.getItemCount(), equalTo(5));
+ }
+}
\ No newline at end of file
diff --git a/app/src/androidTest/java/org/apache/taverna/mobile/utils/RxEspressoScheduleHandler.java b/app/src/androidTest/java/org/apache/taverna/mobile/utils/RxEspressoScheduleHandler.java
new file mode 100644
index 00000000..9c609724
--- /dev/null
+++ b/app/src/androidTest/java/org/apache/taverna/mobile/utils/RxEspressoScheduleHandler.java
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.taverna.mobile.utils;
+
+import android.support.annotation.NonNull;
+import android.support.test.espresso.IdlingResource;
+import android.support.test.espresso.contrib.CountingIdlingResource;
+
+
+import io.reactivex.functions.Function;
+public class RxEspressoScheduleHandler implements Function {
+
+ private final CountingIdlingResource mCountingIdlingResource =
+ new CountingIdlingResource("rxJava");
+
+ @Override
+ public Runnable apply(@NonNull final Runnable runnable) throws Exception {
+ return new Runnable() {
+ @Override
+ public void run() {
+ mCountingIdlingResource.increment();
+
+ try {
+ runnable.run();
+ } finally {
+ mCountingIdlingResource.decrement();
+ }
+ }
+ };
+ }
+
+ public IdlingResource getIdlingResource() {
+ return mCountingIdlingResource;
+ }
+
+}
\ No newline at end of file
diff --git a/app/src/commonTest/java/org/apache/taverna/mobile/FakeRemoteDataSource.java b/app/src/commonTest/java/org/apache/taverna/mobile/FakeRemoteDataSource.java
new file mode 100644
index 00000000..383ab0b1
--- /dev/null
+++ b/app/src/commonTest/java/org/apache/taverna/mobile/FakeRemoteDataSource.java
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.taverna.mobile;
+
+import org.apache.taverna.mobile.data.model.Announcements;
+import org.apache.taverna.mobile.data.model.DetailAnnouncement;
+import org.apache.taverna.mobile.data.model.User;
+import org.apache.taverna.mobile.data.model.Workflows;
+
+public class FakeRemoteDataSource {
+
+ private static TestDataFactory mTestDataFactory = new TestDataFactory();
+
+
+ public static Announcements getAnnouncements() {
+ return mTestDataFactory.getObjectTypeBean(Announcements.class, FakeXMLName
+ .ANNOUNCEMENTS_XML);
+ }
+
+ public static DetailAnnouncement getAnnouncement() {
+ return mTestDataFactory.getObjectTypeBean(DetailAnnouncement.class,
+ FakeXMLName.ANNOUNCEMENT_XML);
+ }
+
+ public static Workflows getWorkflowList() {
+ return mTestDataFactory.getObjectTypeBean(Workflows.class, FakeXMLName.WORKFLOWS_XML);
+ }
+
+
+ public static User getLoginUser() {
+ return mTestDataFactory.getObjectTypeBean(User.class, FakeXMLName.USER_XML);
+ }
+}
\ No newline at end of file
diff --git a/app/src/commonTest/java/org/apache/taverna/mobile/FakeXMLName.java b/app/src/commonTest/java/org/apache/taverna/mobile/FakeXMLName.java
new file mode 100644
index 00000000..60edcae5
--- /dev/null
+++ b/app/src/commonTest/java/org/apache/taverna/mobile/FakeXMLName.java
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.taverna.mobile;
+
+public class FakeXMLName {
+
+ public static final String ANNOUNCEMENTS_XML = "announcements.xml";
+ public static final String ANNOUNCEMENT_XML = "announcement.xml";
+ public static final String WORKFLOWS_XML = "workflows.xml";
+ public static final String USER_XML = "user.xml";
+}
\ No newline at end of file
diff --git a/app/src/commonTest/java/org/apache/taverna/mobile/TestDataFactory.java b/app/src/commonTest/java/org/apache/taverna/mobile/TestDataFactory.java
new file mode 100644
index 00000000..b1aabba1
--- /dev/null
+++ b/app/src/commonTest/java/org/apache/taverna/mobile/TestDataFactory.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.taverna.mobile;
+
+import android.util.Log;
+
+import org.simpleframework.xml.Serializer;
+import org.simpleframework.xml.core.Persister;
+
+import java.io.InputStream;
+import java.io.InputStreamReader;
+
+public class TestDataFactory {
+
+ private static final String TAG = TestDataFactory.class.getSimpleName();
+
+ public T getObjectTypeBean(Class model, String jsonName) {
+
+ InputStream in = getClass().getClassLoader().getResourceAsStream(jsonName);
+ Serializer serializer = new Persister();
+ T xmlBean = null;
+ try {
+ xmlBean = serializer.read(model, new InputStreamReader(in));
+ } catch (Exception e) {
+ Log.e(TAG, "getObjectTypeBean: ", e);
+ }
+
+ return xmlBean;
+ }
+
+}
\ No newline at end of file
diff --git a/app/src/main/res/values-sw600dp/refs.xml b/app/src/commonTest/resources/announcement.xml
similarity index 53%
rename from app/src/main/res/values-sw600dp/refs.xml
rename to app/src/commonTest/resources/announcement.xml
index 32bdd106..aecc3a26 100644
--- a/app/src/main/res/values-sw600dp/refs.xml
+++ b/app/src/commonTest/resources/announcement.xml
@@ -1,9 +1,5 @@
+
-
-
-
- @layout/fragment_item_grid
-
-
\ No newline at end of file
+
+ 1
+ David De Roure
+ myExperiment in IEEE Intelligent Systems
+ <p>myExperiment is discussed by Jim Hendler in his article <i>Reinventing Academic Publishing, Part 3 </i>in IEEE Intelligent Systems January/February 2008, page 2-3.</p>
+ Sat Mar 08 10:56:15 +0000 2008
+
\ No newline at end of file
diff --git a/app/src/commonTest/resources/announcements.xml b/app/src/commonTest/resources/announcements.xml
new file mode 100644
index 00000000..9d4c3ad9
--- /dev/null
+++ b/app/src/commonTest/resources/announcements.xml
@@ -0,0 +1,22 @@
+
+
+
+ New announcements feature!
+ New reviews feature!
+ New updates and additions
+ Updated Group sharing!
+ myExperiment mentioned in Nature magazine!
+
\ No newline at end of file
diff --git a/app/src/main/res/values-large/refs.xml b/app/src/commonTest/resources/user.xml
similarity index 58%
rename from app/src/main/res/values-large/refs.xml
rename to app/src/commonTest/resources/user.xml
index 32bdd106..02192e23 100644
--- a/app/src/main/res/values-large/refs.xml
+++ b/app/src/commonTest/resources/user.xml
@@ -1,9 +1,5 @@
+
-
-
-
- @layout/fragment_item_grid
-
-
\ No newline at end of file
+
+ 65265
+ 2016-04-27 04:48:05 UTC
+ Sagar Sagar
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/commonTest/resources/workflows.xml b/app/src/commonTest/resources/workflows.xml
new file mode 100644
index 00000000..26901f19
--- /dev/null
+++ b/app/src/commonTest/resources/workflows.xml
@@ -0,0 +1,111 @@
+
+
+
+
+ Get ontology parents
+ Taverna 2
+ Kristina Hettne
+ 2015-11-16 09:56:17 UTC
+ http://www.myexperiment.org/workflows/4766/versions/2/previews/full
+ http://www.myexperiment.org/workflows/4766/download/Get_ontology_parents-v.t2flow
+
+
+ Texture classification: Knime Image Analytics
+ KNIME
+ Insilicoconsulting
+ 2015-11-10 08:28:37 UTC
+ http://www.myexperiment.org/workflows/4764/versions/1/previews/full
+
+ http://www.myexperiment.org/workflows/4764/download/Texture_classification__Knime_Image_Analytics-v.zip
+
+
+
+
+ Define one query and retrieve Molecular Interactions from PSICQUIC Services (filtered by tag) registered in the PSICQUIC registry.
+
+ Taverna 2
+ Maximilian Koch
+ 2015-11-05 23:35:13 UTC
+ http://www.myexperiment.org/workflows/4763/versions/1/previews/full
+
+ http://www.myexperiment.org/workflows/4763/download/Define_one_query_and_retrieve_Molecular_Interactions_from_PSICQUIC_Services__filtered_by_tag__registered_in_the_PSICQUIC_registry.-v.t2flow
+
+
+
+ Query for all PISCQUIC services (Name+URL)
+ Taverna 2
+ Maximilian Koch
+ 2015-11-05 23:01:06 UTC
+ http://www.myexperiment.org/workflows/4761/versions/1/previews/full
+
+ http://www.myexperiment.org/workflows/4761/download/Query_for_all_PISCQUIC_services__Name_URL_-v.t2flow
+
+
+
+ Query PSICQUIC and filter by idA and idB (REST)
+ Taverna 2
+ Maximilian Koch
+ 2015-11-05 22:53:27 UTC
+ http://www.myexperiment.org/workflows/4760/versions/1/previews/full
+
+ http://www.myexperiment.org/workflows/4760/download/Query_PSICQUIC_and_filter_by_idA_and_idB__REST_-v.t2flow
+
+
+
+ FInd/filter idA and idB from MITAB
+ Taverna 2
+ Maximilian Koch
+ 2015-11-05 22:27:17 UTC
+ http://www.myexperiment.org/workflows/4759/versions/1/previews/full
+ http://www.myexperiment.org/workflows/4759/download/FInd_filter_idA_and_idB_from_MITAB-v.t2flow
+
+
+ Get all PSICQUIC
+ Bioinformatics
+ Maximilian Koch
+ 2015-11-04 18:10:28 UTC
+ http://www.myexperiment.org/workflows/4755/versions/1/previews/full
+ http://www.myexperiment.org/workflows/4755/download/Get_all_PSICQUIC-v.t2flow
+
+
+
+ KNIME workflow used to collate data for the paper 'Selectivity profiling of BCRP versus P-gp inhibition: from automated collection of polypharmacology data to multi-label learning' by F. Montanari, B. Zdrazil et al., J. Cheminform., 2016, PMID: 26855674
+
+ KNIME
+ Barbara Zdrazil
+ 2015-11-02 19:13:35 UTC
+ http://www.myexperiment.org/workflows/4754/versions/1/previews/full
+
+ http://www.myexperiment.org/workflows/4754/download/KNIME_workflow_used_to_collate_data_for_the_paper__Selectivity_profiling_of_BCRP_versus_P-gp_inhibition__from_automated_collection_of_polypharmacology_data_to_multi-label_learning__by_F._Montanari__B._Zdrazil_et_al.__J._Cheminform.__2016__PMID__26855674_-v.zip
+
+
+
+ Pubmed -Google Tag Cloud
+ KNIME
+ Insilicoconsulting
+ 2015-11-01 17:38:29 UTC
+ http://www.myexperiment.org/workflows/4753/versions/1/previews/full
+ http://www.myexperiment.org/workflows/4753/download/Pubmed_-Google_Tag_Cloud_-v.zip
+
+
+ Author Citation Network
+ Taverna 2
+ Magnus Palmblad
+ 2015-10-20 10:10:33 UTC
+ http://www.myexperiment.org/workflows/4750/versions/1/previews/full
+ http://www.myexperiment.org/workflows/4750/download/Author_Citation_Network-v.t2flow
+
+
\ No newline at end of file
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 9590e792..4e09b399 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -1,10 +1,5 @@
+ package="org.apache.taverna.mobile">
-
-
+
+
+
+
+ android:name=".TavernaApplication"
+ android:allowBackup="true"
+ android:icon="@mipmap/ic_launcher"
+ android:largeHeap="true"
+ android:label="@string/app_name"
+ android:theme="@style/Theme.Taverna"
+ android:networkSecurityConfig="@xml/network_security_config">
+ android:name=".ui.login.LoginActivity"
+ android:label="@string/app_name">
+ android:name=".ui.FlashScreenActivity">
-
+
-
+
+ android:name=".ui.tutorial.TutorialActivity"
+ android:theme="@style/Tutorial.Theme.Taverna"
+ android:label="@string/title_activity_flash_screen">
+
+
-
+
+ android:name="android.app.searchable"
+ android:resource="@xml/searchable"/>
+
+
+ android:name=".activities.SettingsActivity"
+ android:label="@string/title_activity_settings"
+ android:parentActivityName=".ui.DashboardActivity">
+ android:name="android.support.PARENT_ACTIVITY"
+ android:value="org.apache.taverna.mobile.ui.DashboardActivity"/>
-
-
-
-
-
+ android:name=".ui.workflowdetail.WorkflowDetailActivity"
+ android:label="@string/title_activity_run_result"
+ android:parentActivityName=".ui.DashboardActivity">
+ android:name="android.support.PARENT_ACTIVITY"
+ android:value="org.apache.taverna.mobile.ui.DashboardActivity"/>
+
+ android:parentActivityName=".ui.DashboardActivity">
-
-
-
-
-
-
-
-
-
+ android:value="org.apache.taverna.mobile.ui.DashboardActivity"/>
+
+
+
+
+
+
+
+
+
-
+
\ No newline at end of file
diff --git a/app/src/main/assets/apache_licence_notice.html b/app/src/main/assets/apache_licence_notice.html
new file mode 100644
index 00000000..70c75e68
--- /dev/null
+++ b/app/src/main/assets/apache_licence_notice.html
@@ -0,0 +1,239 @@
+
+
+
+
+
+
+
+
+
+Apache Licence
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
+Notice
+
+
+ Apache Taverna Mobile
+Copyright 2015-2019 The Apache Software Foundation
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
+
+myExperiment's Logo is nothing to do with Apache Taverna and is copyright myExperiment.
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/assets/licences.html b/app/src/main/assets/licences.html
new file mode 100644
index 00000000..e9820ff2
--- /dev/null
+++ b/app/src/main/assets/licences.html
@@ -0,0 +1,350 @@
+
+
+
+
+
+
+
+
+
+Glide
+
+License for everything not in third_party and not otherwise marked:
+
+Copyright 2014 Google, Inc. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification, are
+permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice, this list of
+ conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright notice, this list
+ of conditions and the following disclaimer in the documentation and/or other materials
+ provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY GOOGLE, INC. ``AS IS'' AND ANY EXPRESS OR IMPLIED
+WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GOOGLE, INC. OR
+CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+The views and conclusions contained in the software and documentation are those of the
+authors and should not be interpreted as representing official policies, either expressed
+or implied, of Google, Inc.
+---------------------------------------------------------------------------------------------
+License for third_party/disklrucache:
+
+Copyright 2012 Jake Wharton
+Copyright 2011 The Android Open Source Project
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+---------------------------------------------------------------------------------------------
+License for third_party/gif_decoder:
+
+Copyright (c) 2013 Xcellent Creations, Inc.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+---------------------------------------------------------------------------------------------
+License for third_party/gif_encoder/AnimatedGifEncoder.java and
+third_party/gif_encoder/LZWEncoder.java:
+
+No copyright asserted on the source code of this class. May be used for any
+purpose, however, refer to the Unisys LZW patent for restrictions on use of
+the associated LZWEncoder class. Please forward any corrections to
+kweiner@fmsware.com.
+
+-----------------------------------------------------------------------------
+License for third_party/gif_encoder/NeuQuant.java
+
+Copyright (c) 1994 Anthony Dekker
+
+NEUQUANT Neural-Net quantization algorithm by Anthony Dekker, 1994. See
+"Kohonen neural networks for optimal colour quantization" in "Network:
+Computation in Neural Systems" Vol. 5 (1994) pp 351-367. for a discussion of
+the algorithm.
+
+Any party obtaining a copy of these files from the author, directly or
+indirectly, is granted, free of charge, a full and unrestricted irrevocable,
+world-wide, paid up, royalty-free, nonexclusive right and license to deal in
+this software and documentation files (the "Software"), including without
+limitation the rights to use, copy, modify, merge, publish, distribute,
+sublicense, and/or sell copies of the Software, and to permit persons who
+receive copies from any such party to do so, with the only requirement being
+that this copyright notice remain intact.
+
+Copyright 2008 Google, Inc.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+
+Retrofit, RXJava Adapter
+
+Copyright 2013 Square, Inc.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+
+OKHttp, Logging Interceptor, Simple XML Converter
+
+Copyright 2014 Square, Inc.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+LeakCanary
+
+Copyright 2015 Square, Inc.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Butterknife, Butterknife Compiler
+
+Copyright 2013 Jake Wharton
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+RxAndroid
+
+Copyright 2015 The RxAndroid authors
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+RxJava
+
+Copyright 2013 Netflix, Inc.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Simple XML
+
+Copyright unknown
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Android SVG
+
+Copyright unknown
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+
+Photo View
+
+Copyright 2016 Chris Banes
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+
+Steps View
+
+Copyright 2015 Anton Nurdin Tuhadiansyah
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+
+DBFlow, DBFlow Processor, DBDlow Core
+
+Copyright (c) 2014 Raizlabs
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+Stetho, Stetho OKHttp
+
+Copyright (c) 2015, Facebook, Inc. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ * Neither the name Facebook nor the names of its contributors may be used to
+ endorse or promote products derived from this software without specific
+ prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+
\ No newline at end of file
diff --git a/app/src/main/java/org/apache/taverna/mobile/SingleFragmentActivity.java b/app/src/main/java/org/apache/taverna/mobile/SingleFragmentActivity.java
new file mode 100644
index 00000000..a075ecb8
--- /dev/null
+++ b/app/src/main/java/org/apache/taverna/mobile/SingleFragmentActivity.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.taverna.mobile;
+
+import android.os.Bundle;
+import android.support.annotation.Nullable;
+import android.support.v4.app.Fragment;
+import android.view.ViewGroup;
+import android.widget.FrameLayout;
+
+import org.apache.taverna.mobile.ui.base.BaseActivity;
+
+public class SingleFragmentActivity extends BaseActivity {
+ FrameLayout content;
+
+ @Override
+ protected void onCreate(@Nullable Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ content = new FrameLayout(this);
+ content.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
+ ViewGroup.LayoutParams.MATCH_PARENT));
+ content.setId(R.id.container1);
+ setContentView(content);
+ }
+
+ public void setFragment(Fragment fragment) {
+
+ getSupportFragmentManager().beginTransaction()
+ .add(R.id.container1, fragment, "TEST")
+ .commit();
+ }
+
+ public void replaceFragment(Fragment fragment) {
+ getSupportFragmentManager().beginTransaction()
+ .replace(R.id.container1, fragment).commit();
+ }
+
+}
diff --git a/app/src/main/java/org/apache/taverna/mobile/TavernaApplication.java b/app/src/main/java/org/apache/taverna/mobile/TavernaApplication.java
new file mode 100644
index 00000000..a0bd6966
--- /dev/null
+++ b/app/src/main/java/org/apache/taverna/mobile/TavernaApplication.java
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.taverna.mobile;
+
+
+import com.facebook.stetho.Stetho;
+import com.raizlabs.android.dbflow.config.FlowConfig;
+import com.raizlabs.android.dbflow.config.FlowManager;
+import com.squareup.leakcanary.LeakCanary;
+
+import org.apache.taverna.mobile.injection.component.ApplicationComponent;
+import org.apache.taverna.mobile.injection.component.DaggerApplicationComponent;
+import org.apache.taverna.mobile.injection.module.ApplicationModule;
+
+import android.app.Application;
+import android.content.Context;
+
+public class TavernaApplication extends Application {
+
+ ApplicationComponent mApplicationComponent;
+
+ public static TavernaApplication get(Context context) {
+ return (TavernaApplication) context.getApplicationContext();
+ }
+
+ @Override
+ public void onCreate() {
+ super.onCreate();
+
+ FlowManager.init(new FlowConfig.Builder(this).build());
+ if (BuildConfig.DEBUG) {
+ Stetho.initializeWithDefaults(this);
+ }
+
+ if (LeakCanary.isInAnalyzerProcess(this)) {
+ return;
+ }
+ LeakCanary.install(this);
+
+ }
+
+ public ApplicationComponent getComponent() {
+ if (mApplicationComponent == null) {
+ mApplicationComponent = DaggerApplicationComponent.builder()
+ .applicationModule(new ApplicationModule(this))
+ .build();
+ }
+ return mApplicationComponent;
+ }
+
+
+ public void setComponent(ApplicationComponent applicationComponent) {
+ mApplicationComponent = applicationComponent;
+ }
+
+}
diff --git a/app/src/main/java/org/apache/taverna/mobile/activities/DashboardMainActivity.java b/app/src/main/java/org/apache/taverna/mobile/activities/DashboardMainActivity.java
deleted file mode 100644
index 1d74cbd2..00000000
--- a/app/src/main/java/org/apache/taverna/mobile/activities/DashboardMainActivity.java
+++ /dev/null
@@ -1,307 +0,0 @@
-package org.apache.taverna.mobile.activities;
-
-/**
- * Apache Taverna Mobile
-* Copyright 2015 The Apache Software Foundation
-
-* This product includes software developed at
-* The Apache Software Foundation (http://www.apache.org/).
-
-* Licensed to the Apache Software Foundation (ASF) under one
-* or more contributor license agreements. See the NOTICE file
-* distributed with this work for additional information
-* regarding copyright ownership. The ASF licenses this file
-* to you under the Apache License, Version 2.0 (the
-* "License"); you may not use this file except in compliance
-* with the License. You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing,
-* software distributed under the License is distributed on an
-* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-* KIND, either express or implied. See the License for the
-* specific language governing permissions and limitations
-* under the License.
-*/
-
-import android.app.Dialog;
-import android.content.Context;
-import android.content.Intent;
-import android.content.SharedPreferences;
-import android.net.Uri;
-import android.os.Bundle;
-import android.os.Environment;
-import android.preference.PreferenceManager;
-import android.support.design.widget.NavigationView;
-import android.support.v4.app.Fragment;
-import android.support.v4.app.FragmentManager;
-import android.support.v4.app.FragmentTransaction;
-import android.support.v4.view.GravityCompat;
-import android.support.v4.widget.DrawerLayout;
-import android.support.v7.app.ActionBar;
-import android.support.v7.app.AppCompatActivity;
-import android.view.Menu;
-import android.view.MenuItem;
-import android.webkit.MimeTypeMap;
-import android.widget.TableLayout;
-import android.widget.Toast;
-
-import org.apache.taverna.mobile.R;
-import org.apache.taverna.mobile.fragments.Workflow_viewpager;
-import org.apache.taverna.mobile.ui.anouncements.AnnouncementFragment;
-import org.apache.taverna.mobile.utils.WorkflowOpen;
-
-import java.io.File;
-
-public class DashboardMainActivity extends AppCompatActivity
-{
-
- /**
- * Used to store the last screen title. For use in {@link #restoreActionBar()}.
- */
- private CharSequence mTitle = "Dashboard";
- private final int SELECT_WORKFLOW = 10;
- public static final String APP_DIRECTORY_NAME = "TavernaMobile";
- private Dialog aboutDialog;
- private DrawerLayout mDrawerLayout;
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_dashboard_main);
-
- NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
- if (navigationView != null) {
- setupDrawerContent(navigationView);
- }
-
-
- mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
-
- setUpWorkflowDirectory(this);
- aboutDialog = new Dialog(this);
-
- /**
- * Setting the Fragment in FrameLayout
- */
- if (savedInstanceState == null) {
-
- FragmentManager fragmentManager = getSupportFragmentManager();
- Fragment fragment;
-
- fragment = new Workflow_viewpager();
- fragmentManager.beginTransaction()
- .replace(R.id.frame_container, fragment)
- .setTransition(FragmentTransaction.TRANSIT_FRAGMENT_CLOSE)
- .commit();
-
-
- }
-
- }
-
-
- /**
- *
- * @param navigationView Design Support NavigationView OnClick Listener Event
- */
- private void setupDrawerContent(final NavigationView navigationView) {
- navigationView.setNavigationItemSelectedListener(
- new NavigationView.OnNavigationItemSelectedListener()
- {
-
- @Override
- public boolean onNavigationItemSelected(MenuItem menuItem)
- {
-
-
- FragmentManager fragmentManager = getSupportFragmentManager();
- Fragment fragment;
-
- switch (menuItem.getItemId())
- {
- case R.id.nav_dashboard:
-
- fragment = new Workflow_viewpager();
- fragmentManager.beginTransaction()
- .replace(R.id.frame_container, fragment)
- .setTransition(FragmentTransaction.TRANSIT_FRAGMENT_CLOSE)
- .commit();
-
- menuItem.setChecked(true);
- mDrawerLayout.closeDrawers();
- return true;
- case R.id.nav_announcement:
-
- fragment = new AnnouncementFragment();
- fragmentManager.beginTransaction()
- .replace(R.id.frame_container, fragment)
- .setTransition(FragmentTransaction.TRANSIT_FRAGMENT_CLOSE)
- .commit();
-
- menuItem.setChecked(true);
- mDrawerLayout.closeDrawers();
- return true;
-
- case R.id.nav_openworkflow:
-
- Intent workflowSelectIntent =
- new Intent(Intent.ACTION_GET_CONTENT)
- .setDataAndTypeAndNormalize(Uri.parse(String.format("%s%s%s",
- Environment.getExternalStorageDirectory(),
- File.separator, APP_DIRECTORY_NAME)),
- "application/vnd.taverna.t2flow+xml");
-
- Intent loadWorkflowIntent = Intent.createChooser(workflowSelectIntent,
- "Choose Workflow (t2flow or xml)");
- startActivityForResult(loadWorkflowIntent, SELECT_WORKFLOW);
- menuItem.setChecked(true);
- mDrawerLayout.closeDrawers();
- return true;
- case R.id.nav_usage:
-
- aboutDialog.setCanceledOnTouchOutside(true);
- aboutDialog.setTitle("Usage");
- aboutDialog.setContentView(R.layout.usage_layout);
- aboutDialog.show();
-
- menuItem.setChecked(true);
- mDrawerLayout.closeDrawers();
- return true;
-
- case R.id.nav_about:
-
- TableLayout about = (TableLayout) getLayoutInflater().inflate(R.layout.about, null);
-
- aboutDialog.setCanceledOnTouchOutside(true);
- aboutDialog.setTitle("About Taverna Mobile");
- aboutDialog.setContentView(about);
- aboutDialog.show();
-
- menuItem.setChecked(true);
- mDrawerLayout.closeDrawers();
- return true;
-
- case R.id.nav_settings:
-
- startActivity(new Intent(getApplicationContext(), SettingsActivity.class));
- overridePendingTransition(android.R.anim.slide_in_left, android.R.anim.slide_out_right);
-
- menuItem.setChecked(true);
- mDrawerLayout.closeDrawers();
- return true;
-
- case R.id.nav_logout:
-
- finish();
- menuItem.setChecked(true);
- mDrawerLayout.closeDrawers();
- return true;
-
- }
- return true;
- }
- });
- }
-
-
-
-
-
- @Override
- public void onActivityResult(int requestCode , int resultCode, Intent data){
- if(resultCode == RESULT_OK){
- if(requestCode == SELECT_WORKFLOW){
- String workflowPath = data.getData().getPath();
- // Toast.makeText(getBaseContext(), "Path: "+workflowPath, Toast.LENGTH_LONG).show();
- String type = getMimeType(data.getData().getPath());
- if (type == "text/xml" || type == "application/vnd.taverna.t2flow+xml"){
-
- new WorkflowOpen(this).execute(workflowPath);
- }else {
- Toast.makeText(getBaseContext(), "Invalid worklow. Please try again", Toast.LENGTH_LONG).show();
-
- }
- }
- }
- }
-
- /**
- * Return the mimetype of the file selected to be run as a workflow
- * @param url the path to the seleted file
- * @return the mimetype of the file selected
- */
- private String getMimeType(String url) {
- String type = null;
- String extension = MimeTypeMap.getFileExtensionFromUrl(url);
- if (extension != null) {
- type = MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension);
- }
- return type;
- }
-
-
-
- public void restoreActionBar() {
- ActionBar actionBar = getSupportActionBar();
- actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
- actionBar.setDisplayShowTitleEnabled(true);
- actionBar.setTitle(mTitle);
- }
-
- private void setUpWorkflowDirectory(Context context){
-
- SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
- if(Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
- File workflowDirectory = new File(Environment.getExternalStorageDirectory()+File.separator+APP_DIRECTORY_NAME);
- if (!workflowDirectory.exists()) {
- boolean state = workflowDirectory.mkdirs();
- if (state) {
- Toast.makeText(context, "Storage Ready", Toast.LENGTH_SHORT).show();
- sp.edit().putString(APP_DIRECTORY_NAME, workflowDirectory.getAbsolutePath()).commit();
- Toast.makeText(context, "Home dir: "+workflowDirectory.getAbsolutePath(), Toast.LENGTH_LONG).show();
- } else { //directory can't be created either because of restricted access or lack of an external storage media.
- //we assume the lack of secondary storage so we have to switch to internal storage
- // File dir = new File(Environment.getExternalStoragePublicDirectory(Environment.))
- // Toast.makeText(context, "Storage Error. Directory not created", Toast.LENGTH_SHORT).show();
- }
-// workflowDirectory.list();
- }else {
- // Toast.makeText(context, "Directory exists. Home dir: "+workflowDirectory.getAbsolutePath(), Toast.LENGTH_LONG).show();
- sp.edit().putString(APP_DIRECTORY_NAME, workflowDirectory.getAbsolutePath()).commit();
- /*else {
- File mainDir = new File(Environment.getExternalStorageDirectory() + File.separator + APP_DIRECTORY_NAME);
- if (mainDir.mkdirs())
- sp.edit().putString(APP_DIRECTORY_NAME, mainDir.getAbsolutePath()).commit();
- else
- Toast.makeText(context, "Workflow home not created. Permission issues", Toast.LENGTH_SHORT).show();
- }*/
- }
- }else{//use internal memory to save the data
- File home = context.getDir("Workflows", Context.MODE_PRIVATE);
- sp.edit().putString(APP_DIRECTORY_NAME, home.getAbsolutePath()).commit();
- // Toast.makeText(context, "Home dir: "+home.getAbsolutePath(), Toast.LENGTH_LONG).show();
- }
- }
-
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- getMenuInflater().inflate(R.menu.dashboard_main, menu);
- restoreActionBar();
- return true;
- }
-
-
- @Override
- public boolean onOptionsItemSelected(MenuItem item) {
- switch (item.getItemId()) {
- case android.R.id.home:
- mDrawerLayout.openDrawer(GravityCompat.START);
- return true;
- }
- return super.onOptionsItemSelected(item);
- }
-
-}
diff --git a/app/src/main/java/org/apache/taverna/mobile/activities/FlashScreenActivity.java b/app/src/main/java/org/apache/taverna/mobile/activities/FlashScreenActivity.java
deleted file mode 100644
index e56ce4a0..00000000
--- a/app/src/main/java/org/apache/taverna/mobile/activities/FlashScreenActivity.java
+++ /dev/null
@@ -1,84 +0,0 @@
-package org.apache.taverna.mobile.activities;
-
-/*
-* Apache Taverna Mobile
-* Copyright 2015 The Apache Software Foundation
-
-* This product includes software developed at
-* The Apache Software Foundation (http://www.apache.org/).
-
-* Licensed to the Apache Software Foundation (ASF) under one
-* or more contributor license agreements. See the NOTICE file
-* distributed with this work for additional information
-* regarding copyright ownership. The ASF licenses this file
-* to you under the Apache License, Version 2.0 (the
-* "License"); you may not use this file except in compliance
-* with the License. You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing,
-* software distributed under the License is distributed on an
-* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-* KIND, either express or implied. See the License for the
-* specific language governing permissions and limitations
-* under the License.
-*/
-
-import android.content.Context;
-import android.content.Intent;
-import android.os.Handler;
-import android.preference.PreferenceManager;
-import android.support.v7.app.ActionBarActivity;
-import android.os.Bundle;
-import android.view.Menu;
-import android.view.MenuItem;
-
-import org.apache.taverna.mobile.R;
-
-public class FlashScreenActivity extends ActionBarActivity {
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_flash_screen);
- //getSupportActionBar().hide();
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- return false;
- }
-
- @Override
- public boolean onOptionsItemSelected(MenuItem item) {
-
- return super.onOptionsItemSelected(item);
- }
- @Override
- public void onResume(){
- super.onResume();
- final Context context = this;
- //setup initial app settings
- if(!PreferenceManager.getDefaultSharedPreferences(context).getBoolean("pref_set", false)){
- PreferenceManager.getDefaultSharedPreferences(context).edit().putString("pref_server_url", "http://heater.cs.man.ac.uk:8090/taverna-2.5.4/").commit();
- PreferenceManager.getDefaultSharedPreferences(context).edit().putString("pref_player_url", "http://heater.cs.man.ac.uk:3000/").commit();
- }else{
- PreferenceManager.getDefaultSharedPreferences(context).edit().putBoolean("pref_set", true).commit();
- }
- Handler mhandler = new Handler();
- mhandler.postDelayed(new Runnable() {
- @Override
- public void run() {
- if(!PreferenceManager.getDefaultSharedPreferences(context).getBoolean("pref_logged_in", false)) {
- startActivity(new Intent(FlashScreenActivity.this, LoginActivity.class));
- (FlashScreenActivity.this).finish();
- }else{
- startActivity(new Intent(FlashScreenActivity.this, DashboardMainActivity.class));
- (FlashScreenActivity.this).finish();
- }
- }
- }, 2500);
-
- }
-}
diff --git a/app/src/main/java/org/apache/taverna/mobile/activities/LoginActivity.java b/app/src/main/java/org/apache/taverna/mobile/activities/LoginActivity.java
deleted file mode 100644
index 4a67b48c..00000000
--- a/app/src/main/java/org/apache/taverna/mobile/activities/LoginActivity.java
+++ /dev/null
@@ -1,249 +0,0 @@
-package org.apache.taverna.mobile.activities;
-
-/*
-* Apache Taverna Mobile
-* Copyright 2015 The Apache Software Foundation
-
-* This product includes software developed at
-* The Apache Software Foundation (http://www.apache.org/).
-
-* Licensed to the Apache Software Foundation (ASF) under one
-* or more contributor license agreements. See the NOTICE file
-* distributed with this work for additional information
-* regarding copyright ownership. The ASF licenses this file
-* to you under the Apache License, Version 2.0 (the
-* "License"); you may not use this file except in compliance
-* with the License. You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing,
-* software distributed under the License is distributed on an
-* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-* KIND, either express or implied. See the License for the
-* specific language governing permissions and limitations
-* under the License.
-*/
-
-import android.app.Activity;
-import android.app.ProgressDialog;
-import android.content.Context;
-import android.content.Intent;
-import android.os.AsyncTask;
-import android.preference.PreferenceManager;
-import android.support.v7.app.ActionBarActivity;
-import android.support.v4.app.Fragment;
-import android.os.Bundle;
-import android.text.TextUtils;
-import android.util.Base64;
-import android.util.Log;
-import android.view.LayoutInflater;
-import android.view.Menu;
-import android.view.MenuItem;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.Button;
-import android.widget.CheckBox;
-import android.widget.EditText;
-import android.widget.Toast;
-
-import org.apache.taverna.mobile.R;
-import org.apache.taverna.mobile.tavernamobile.TavernaPlayerAPI;
-import org.apache.taverna.mobile.tavernamobile.User;
-import org.apache.taverna.mobile.tavernamobile.Workflow;
-import org.apache.taverna.mobile.utils.HttpUtil;
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.net.Authenticator;
-import java.net.HttpURLConnection;
-import java.net.MalformedURLException;
-import java.net.URL;
-
-
-public class LoginActivity extends ActionBarActivity {
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_login);
- //getSupportActionBar().hide();
- if (savedInstanceState == null) {
- getSupportFragmentManager().beginTransaction()
- .add(R.id.container, new LoginFragment())
- .commit();
- }
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- return false;
- }
-
- @Override
- public boolean onOptionsItemSelected(MenuItem item) {
- return super.onOptionsItemSelected(item);
- }
-
- /**
- * A placeholder fragment containing a simple view.
- */
- public static class LoginFragment extends Fragment implements View.OnClickListener{
-
- private View rootView;
- private Button loginButton;
- private EditText email, password;
- private boolean logginRemain;
- private CheckBox loginCheck;
-
- public LoginFragment() {
- }
-
- @Override
- public View onCreateView(LayoutInflater inflater, ViewGroup container,
- Bundle savedInstanceState) {
- rootView = inflater.inflate(R.layout.fragment_login, container, false);
- email = (EditText) rootView.findViewById(R.id.editTextUsername);
- password = (EditText) rootView.findViewById(R.id.edittextPassword);
- loginCheck = (CheckBox) rootView.findViewById(R.id.rememberCheckbox);
- loginButton = (Button) rootView.findViewById(R.id.loginbutton);
- loginButton.setOnClickListener(this);
- return rootView;
- }
-
- @Override
- public void onClick(View view) {
- int i = view.getId();
- if (i == R.id.loginbutton) {
- logginRemain = loginCheck.isChecked();
- if (logginRemain) {
- PreferenceManager.getDefaultSharedPreferences(getActivity()).edit().putBoolean("pref_logged_in",true).apply();
- } else {
- PreferenceManager.getDefaultSharedPreferences(getActivity()).edit().putBoolean("pref_logged_in",false).apply();
- }
- if (email.getText().toString().isEmpty()) {
- email.setError(getString(R.string.emailerr));
- } else if (password.getText().toString().isEmpty()) {
- password.setError(getString(R.string.passworderr));
- } else {
- // login request
- new LoginTask(getActivity()).execute(email.getText().toString(), password.getText().toString());
- }
-
- }
- }
-
- private class LoginTask extends AsyncTask{
- private Context context;
- private ProgressDialog pd;
- String cookie;
- String userurl;
-
- private LoginTask(Context context) {
- this.context = context;
- pd = new ProgressDialog(this.context);
- pd.setMessage("Logging in");
- }
-
- @Override
- protected void onPreExecute() {
- super.onPreExecute();
- pd.setCancelable(false);
- pd.show();
- }
-
- @Override
- protected String doInBackground(String... params) {
- //http://sandbox.myexperiment.org/users
-
- String whoAmI = "http://www.myexperiment.org/whoami.xml";
-
- String response = null;
- HttpURLConnection con = null;
- try {
- URL url = new URL(whoAmI);
- con = (HttpURLConnection) url.openConnection();
- String userName = params[0];
- String password = params[1];
- boolean redirect = false;
-
- String authentication = userName + ":" + password;
- con.setRequestMethod("GET");
- con.setRequestProperty("Authorization", "Basic " + Base64.encodeToString(authentication.getBytes(), Base64.DEFAULT));
- con.setInstanceFollowRedirects(true);
- HttpURLConnection.setFollowRedirects(true);
- con.connect();
- int status = con.getResponseCode();
- response = String.valueOf(status);
- if(status != HttpURLConnection.HTTP_OK){
- if (status == HttpURLConnection.HTTP_MOVED_PERM ||
- status == HttpURLConnection.HTTP_MOVED_TEMP ||
- status == HttpURLConnection.HTTP_SEE_OTHER || status == 307){
- redirect = true;
- }
-
- }
- System.out.println("Status code: "+status);
- if(redirect) {
- // get redirect url from "location" header field
- String newUrl = con.getHeaderField("Location");
- this.userurl = newUrl;
- // get the cookie needed, for login
- String cookies = con.getHeaderField("Set-Cookie");
- this.cookie = cookies;
- // open the new connection again
- con = (HttpURLConnection) new URL(newUrl).openConnection();
- con.setRequestProperty("Cookie", cookies);
- System.out.println("Redirect to URL : " + newUrl);
- con.connect();
- }
- BufferedReader br = new BufferedReader(new InputStreamReader(con.getInputStream()));
- StringBuilder sb = new StringBuilder();
- String s = "";
- while((s = br.readLine())!= null ){
- sb.append(s);
- }
- br.close();
- System.out.println("data: "+sb.toString());
-
- con.disconnect();
-
- return response;
-
- } catch (MalformedURLException e) {
- e.printStackTrace();
- } catch (IOException e) {
- e.printStackTrace();
- }
-
- return response;
- }
-
- @Override
- protected void onPostExecute(String response) {
- pd.dismiss();
- if(response != null) {
- switch(Integer.parseInt(response)){
- case 401:
- Toast.makeText(getActivity(), getActivity().getString(R.string.auth_err), Toast.LENGTH_LONG).show();
- break;
- case 200:
- case 307:
- this.context.startActivity(new Intent(this.context, DashboardMainActivity.class));
- getActivity().overridePendingTransition(R.anim.abc_slide_in_bottom, R.anim.abc_slide_out_top);
- getActivity().finish();
- break;
- }
- }else{
- Toast.makeText(getActivity(), getActivity().getString(R.string.servererr), Toast.LENGTH_LONG).show();
- }
- }
- }
- }
-
-}
diff --git a/app/src/main/java/org/apache/taverna/mobile/activities/RunResult.java b/app/src/main/java/org/apache/taverna/mobile/activities/RunResult.java
deleted file mode 100644
index 54593444..00000000
--- a/app/src/main/java/org/apache/taverna/mobile/activities/RunResult.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package org.apache.taverna.mobile.activities;
-
-import android.os.Bundle;
-import android.support.v7.app.ActionBarActivity;
-import android.view.Menu;
-import android.view.MenuItem;
-
-import org.apache.taverna.mobile.R;
-import org.apache.taverna.mobile.fragments.workflowdetails.RunFragment;
-
-public class RunResult extends ActionBarActivity {
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_run_result);
- if (savedInstanceState == null) {
- getSupportFragmentManager().beginTransaction()
- .add(R.id.container, RunFragment.newInstance())
- .commit();
- }
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- return false;
- }
-
- @Override
- public boolean onOptionsItemSelected(MenuItem item) {
-
- this.finish();
-
- return super.onOptionsItemSelected(item);
- }
-
-}
diff --git a/app/src/main/java/org/apache/taverna/mobile/activities/SettingsActivity.java b/app/src/main/java/org/apache/taverna/mobile/activities/SettingsActivity.java
deleted file mode 100644
index 4a5048de..00000000
--- a/app/src/main/java/org/apache/taverna/mobile/activities/SettingsActivity.java
+++ /dev/null
@@ -1,244 +0,0 @@
-package org.apache.taverna.mobile.activities;
-/**
- * Apache Taverna Mobile
- * Copyright 2015 The Apache Software Foundation
-
- * This product includes software developed at
- * The Apache Software Foundation (http://www.apache.org/).
-
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import android.annotation.TargetApi;
-import android.content.Context;
-import android.content.res.Configuration;
-import android.os.Build;
-import android.os.Bundle;
-import android.preference.ListPreference;
-import android.preference.Preference;
-import android.preference.PreferenceActivity;
-import android.preference.PreferenceFragment;
-import android.preference.PreferenceManager;
-import android.support.annotation.NonNull;
-import android.support.v4.app.NavUtils;
-import android.view.MenuItem;
-
-import org.apache.taverna.mobile.R;
-
-import java.util.List;
-
-/**
- * A {@link PreferenceActivity} that presents a set of application settings. On
- * handset devices, settings are presented as a single list. On tablets,
- * settings are split by category, with category headers shown to the left of
- * the list of settings.
- *
- * See
- * Android Design: Settings for design guidelines and the Settings
- * API Guide for more information on developing a Settings UI.
- */
-public class SettingsActivity extends PreferenceActivity {
- /**
- * Determines whether to always show the simplified settings UI, where
- * settings are presented in a single list. When false, settings are shown
- * as a master/detail two-pane view on tablets. When true, a single pane is
- * shown on tablets.
- */
- private static final boolean ALWAYS_SIMPLE_PREFS = false;
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- // setupActionBar();
- }
-
- /**
- * Set up the {@link android.app.ActionBar}, if the API is available.
- */
- /* @NonNull
- @TargetApi(Build.VERSION_CODES.HONEYCOMB)
- private void setupActionBar() {
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
- // Show the Up button in the action bar.
- getActionBar().setDisplayHomeAsUpEnabled(true);
- }
- }
-*/
- @Override
- public boolean onOptionsItemSelected(MenuItem item) {
- int id = item.getItemId();
- if (id == android.R.id.home) {
- // This ID represents the Home or Up button. In the case of this
- // activity, the Up button is shown. Use NavUtils to allow users
- // to navigate up one level in the application structure. For
- // more details, see the Navigation pattern on Android Design:
- //
- // http://developer.android.com/design/patterns/navigation.html#up-vs-back
- //
- // TODO: If Settings has multiple levels, Up should navigate up
- // that hierarchy.
- NavUtils.navigateUpFromSameTask(this);
- return true;
- }
- return super.onOptionsItemSelected(item);
- }
-
- @Override
- protected void onPostCreate(Bundle savedInstanceState) {
- super.onPostCreate(savedInstanceState);
-
- setupSimplePreferencesScreen();
- }
-
- /**
- * Shows the simplified settings UI if the device configuration if the
- * device configuration dictates that a simplified, single-pane UI should be
- * shown.
- */
- private void setupSimplePreferencesScreen() {
- if (!isSimplePreferences(this)) {
- return;
- }
-
- // In the simplified UI, fragments are not used at all and we instead
- // use the older PreferenceActivity APIs.
-
- // Add 'general' preferences.
- addPreferencesFromResource(R.xml.pref_general);
-
- // Bind the summaries of EditText/List/Dialog/Ringtone preferences to
- // their values. When their values change, their summaries are updated
- // to reflect the new value, per the Android Design guidelines.
- bindPreferenceSummaryToValue(findPreference("pref_server_url"));
- bindPreferenceSummaryToValue(findPreference("pref_player_url"));
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean onIsMultiPane() {
- return isXLargeTablet(this) && !isSimplePreferences(this);
- }
-
- /**
- * Helper method to determine if the device has an extra-large screen. For
- * example, 10" tablets are extra-large.
- */
- private static boolean isXLargeTablet(Context context) {
- return (context.getResources().getConfiguration().screenLayout
- & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_XLARGE;
- }
-
- /**
- * Determines whether the simplified settings UI should be shown. This is
- * true if this is forced via {@link #ALWAYS_SIMPLE_PREFS}, or the device
- * doesn't have newer APIs like {@link PreferenceFragment}, or the device
- * doesn't have an extra-large screen. In these cases, a single-pane
- * "simplified" settings UI should be shown.
- */
- private static boolean isSimplePreferences(Context context) {
- return ALWAYS_SIMPLE_PREFS
- || Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB
- || !isXLargeTablet(context);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- @TargetApi(Build.VERSION_CODES.HONEYCOMB)
- public void onBuildHeaders(List target) {
- if (!isSimplePreferences(this)) {
- loadHeadersFromResource(R.xml.pref_headers, target);
- }
- }
-
- /**
- * A preference value change listener that updates the preference's summary
- * to reflect its new value.
- */
- private static Preference.OnPreferenceChangeListener sBindPreferenceSummaryToValueListener = new Preference.OnPreferenceChangeListener() {
- @Override
- public boolean onPreferenceChange(Preference preference, Object value) {
- String stringValue = value.toString();
-
- if (preference instanceof ListPreference) {
- // For list preferences, look up the correct display value in
- // the preference's 'entries' list.
- ListPreference listPreference = (ListPreference) preference;
- int index = listPreference.findIndexOfValue(stringValue);
-
- // Set the summary to reflect the new value.
- preference.setSummary(
- index >= 0
- ? listPreference.getEntries()[index]
- : null);
-
- } else {
- // For all other preferences, set the summary to the value's
- // simple string representation.
- preference.setSummary(stringValue);
- }
- return true;
- }
- };
-
- /**
- * Binds a preference's summary to its value. More specifically, when the
- * preference's value is changed, its summary (line of text below the
- * preference title) is updated to reflect the value. The summary is also
- * immediately updated upon calling this method. The exact display format is
- * dependent on the type of preference.
- *
- * @see #sBindPreferenceSummaryToValueListener
- */
- private static void bindPreferenceSummaryToValue(Preference preference) {
- // Set the listener to watch for value changes.
- preference.setOnPreferenceChangeListener(sBindPreferenceSummaryToValueListener);
-
- // Trigger the listener immediately with the preference's
- // current value.
- sBindPreferenceSummaryToValueListener.onPreferenceChange(preference,
- PreferenceManager
- .getDefaultSharedPreferences(preference.getContext())
- .getString(preference.getKey(), ""));
- }
-
- /**
- * This fragment shows general preferences only. It is used when the
- * activity is showing a two-pane settings UI.
- */
- @TargetApi(Build.VERSION_CODES.HONEYCOMB)
- public static class GeneralPreferenceFragment extends PreferenceFragment {
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- addPreferencesFromResource(R.xml.pref_general);
-
- // Bind the summaries of EditText/List/Dialog/Ringtone preferences
- // to their values. When their values change, their summaries are
- // updated to reflect the new value, per the Android Design
- // guidelines.
- bindPreferenceSummaryToValue(findPreference("pref_server_url"));
- bindPreferenceSummaryToValue(findPreference("pref_player_url"));
- }
- }
-
-}
diff --git a/app/src/main/java/org/apache/taverna/mobile/activities/WorkflowDetailActivity.java b/app/src/main/java/org/apache/taverna/mobile/activities/WorkflowDetailActivity.java
deleted file mode 100644
index 170621b6..00000000
--- a/app/src/main/java/org/apache/taverna/mobile/activities/WorkflowDetailActivity.java
+++ /dev/null
@@ -1,144 +0,0 @@
-package org.apache.taverna.mobile.activities;
-
-/**
- * Apache Taverna Mobile
- * Copyright 2015 The Apache Software Foundation
-
- * This product includes software developed at
- * The Apache Software Foundation (http://www.apache.org/).
-
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import android.os.Bundle;
-import android.support.v4.app.Fragment;
-import android.support.v4.app.FragmentManager;
-import android.support.v4.app.FragmentPagerAdapter;
-import android.support.v4.view.ViewPager;
-import android.support.v7.app.ActionBarActivity;
-import android.view.Menu;
-import android.view.MenuItem;
-
-import org.apache.taverna.mobile.R;
-import org.apache.taverna.mobile.fragments.workflowdetails.WorkflowAboutFragment;
-import org.apache.taverna.mobile.fragments.workflowdetails.WorkflowLicenceFragment;
-import org.apache.taverna.mobile.fragments.workflowdetails.WorkflowRunHistoryFragment;
-import org.apache.taverna.mobile.fragments.workflowdetails.WorkflowdetailFragment;
-
-import java.util.Locale;
-
-public class WorkflowDetailActivity extends ActionBarActivity {
-
- /**
- * The {@link android.support.v4.view.PagerAdapter} that will provide
- * fragments for each of the sections. We use a
- * {@link FragmentPagerAdapter} derivative, which will keep every
- * loaded fragment in memory. If this becomes too memory intensive, it
- * may be best to switch to a
- * {@link android.support.v4.app.FragmentStatePagerAdapter}.
- */
- SectionsPagerAdapter mSectionsPagerAdapter;
-
- /**
- * The {@link ViewPager} that will host the section contents.
- */
- ViewPager mViewPager;
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_workflow_detail);
- // Create the adapter that will return a fragment for each of the three
- // primary sections of the activity.
- mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());
-
- // Set up the ViewPager with the sections adapter.
- mViewPager = (ViewPager) findViewById(R.id.pager);
- mViewPager.setAdapter(mSectionsPagerAdapter);
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- return false;
- }
-
- @Override
- public boolean onOptionsItemSelected(MenuItem item) {
- // Handle action bar item clicks here. The action bar will
- if(item.getItemId() == android.R.id.home){
- finish();
- this.overridePendingTransition(android.R.anim.fade_in, android.R.anim.slide_out_right );
- }
- return super.onOptionsItemSelected(item);
- }
- @Override
- public void onBackPressed(){
- finish();
- this.overridePendingTransition(android.R.anim.fade_in, android.R.anim.slide_out_right );
- }
-
- /**
- * A {@link FragmentPagerAdapter} that returns a fragment corresponding to
- * one of the sections/tabs/pages.
- */
- public class SectionsPagerAdapter extends FragmentPagerAdapter {
-
- public SectionsPagerAdapter(FragmentManager fm) {
- super(fm);
- }
-
- @Override
- public Fragment getItem(int position) {
- switch(position +1){
- case 1:
- return WorkflowdetailFragment.newInstance(position + 1);
- case 2:
- //System.out.println(""+getIntent().getStringExtra("wtitle"));
- return WorkflowRunHistoryFragment.newInstance(getIntent().getStringExtra("wtitle"));
- case 3:
- return WorkflowLicenceFragment.newInstance("","");
- case 4:
- return WorkflowAboutFragment.newInstance("","");
- }
- return WorkflowdetailFragment.newInstance(position + 1);
- }
-
- @Override
- public int getCount() {
- // Show 4 total pages.
- return 3;
- }
-
- @Override
- public CharSequence getPageTitle(int position) {
- Locale l = Locale.getDefault();
- switch (position) {
- case 0:
- return getString(R.string.detail_title_section1).toUpperCase(l);
- case 1:
- return getString(R.string.detail_title_section2).toUpperCase(l);
- case 2:
- return getString(R.string.detail_title_section3).toUpperCase(l);
- case 3:
- return getString(R.string.detail_title_section4).toUpperCase(l);
- }
- return "";
- }
- }
-
-}
diff --git a/app/src/main/java/org/apache/taverna/mobile/adapters/FavoriteWorkflowAdapter.java b/app/src/main/java/org/apache/taverna/mobile/adapters/FavoriteWorkflowAdapter.java
deleted file mode 100644
index a32be485..00000000
--- a/app/src/main/java/org/apache/taverna/mobile/adapters/FavoriteWorkflowAdapter.java
+++ /dev/null
@@ -1,183 +0,0 @@
-package org.apache.taverna.mobile.adapters;
-/**
- * Apache Taverna Mobile
- * Copyright 2015 The Apache Software Foundation
-
- * This product includes software developed at
- * The Apache Software Foundation (http://www.apache.org/).
-
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import android.app.Dialog;
-import android.content.Context;
-import android.content.SharedPreferences;
-import android.graphics.Color;
-import android.preference.PreferenceManager;
-import android.support.design.widget.FloatingActionButton;
-import android.support.v7.widget.RecyclerView;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.Button;
-import android.widget.ImageButton;
-import android.widget.ImageView;
-import android.widget.TextView;
-import android.widget.Toast;
-
-import org.apache.taverna.mobile.R;
-import org.apache.taverna.mobile.utils.Workflow_DB;
-import org.json.JSONException;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Created by Larry Akah on 6/9/15.
- */
-public class FavoriteWorkflowAdapter extends RecyclerView.Adapter {
-
- private Context context;
- private List> dataSet;
- public Workflow_DB favDB;
-
- public FavoriteWorkflowAdapter(Context c, List> data) {
- context = c;
- dataSet = data;
- favDB = new Workflow_DB(context, WorkflowAdapter.WORKFLOW_FAVORITE_KEY);
- }
-
- @Override
- public FViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) {
- View itemview = LayoutInflater.from(context).inflate(R.layout.favorite_item_layout, viewGroup, false);
- FViewHolder vh = new FViewHolder(itemview);
- return vh;
- }
- /**
- * Register a new observer to listen for data changes.
- *
- *
The adapter may publish a variety of events describing specific changes.
- * Not all adapters may support all change types and some may fall back to a generic
- * {@link android.support.v7.widget.RecyclerView.AdapterDataObserver#onChanged()
- * "something changed"} event if more specific data is not available.
- *
- *
Components registering observers with an adapter are responsible for
- * {@link #unregisterAdapterDataObserver(android.support.v7.widget.RecyclerView.AdapterDataObserver)
- * unregistering} those observers when finished.
- *
- * @param observer Observer to register
- * @see #unregisterAdapterDataObserver(android.support.v7.widget.RecyclerView.AdapterDataObserver)
- */
- @Override
- public void registerAdapterDataObserver(RecyclerView.AdapterDataObserver observer) {
- super.registerAdapterDataObserver(observer);
- //observer.onChanged();
- }
- /**
- * Unregister an observer currently listening for data changes.
- *
- *
The unregistered observer will no longer receive events about changes
- * to the adapter.
- *
- * @param observer Observer to unregister
- * @see #registerAdapterDataObserver(android.support.v7.widget.RecyclerView.AdapterDataObserver)
- */
- @Override
- public void unregisterAdapterDataObserver(RecyclerView.AdapterDataObserver observer) {
- super.unregisterAdapterDataObserver(observer);
- }
-
- @Override
- public void onBindViewHolder(FViewHolder fViewHolder, int i) {
- //get data 0,1,3 from set;
- final ArrayList