├── app ├── .gitignore ├── src │ ├── main │ │ ├── res │ │ │ ├── drawable-xhdpi │ │ │ │ └── icon.png │ │ │ ├── mipmap-hdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-mdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxxhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── color │ │ │ │ └── button_text.xml │ │ │ ├── xml │ │ │ │ └── authenticator.xml │ │ │ ├── anim │ │ │ │ └── raise.xml │ │ │ ├── menu │ │ │ │ └── menu_drawer.xml │ │ │ ├── layout │ │ │ │ ├── activity_base.xml │ │ │ │ ├── fragment_listview.xml │ │ │ │ ├── item_nav_drawer_header.xml │ │ │ │ ├── include_empty_list.xml │ │ │ │ ├── toolbar.xml │ │ │ │ ├── activity_base_drawer.xml │ │ │ │ ├── fragment_resetpassword.xml │ │ │ │ ├── fragment_main_login.xml │ │ │ │ ├── fragment_register.xml │ │ │ │ ├── fragment_login.xml │ │ │ │ └── item_listview.xml │ │ │ ├── drawable │ │ │ │ └── button.xml │ │ │ └── values │ │ │ │ ├── dimens.xml │ │ │ │ ├── themes.xml │ │ │ │ ├── styles.xml │ │ │ │ └── strings.xml │ │ ├── java │ │ │ └── com │ │ │ │ └── twolinessoftware │ │ │ │ ├── authentication │ │ │ │ ├── AccountNotFoundException.java │ │ │ │ ├── AccountNotLoggedInException.java │ │ │ │ ├── AuthChangedListener.java │ │ │ │ ├── Token.java │ │ │ │ ├── AuthenticationModule.java │ │ │ │ └── UserManager.java │ │ │ │ ├── network │ │ │ │ ├── BaseApiService.java │ │ │ │ ├── ApiResponse.java │ │ │ │ ├── NetworkModule.java │ │ │ │ └── UserNetworkApi.java │ │ │ │ ├── activities │ │ │ │ ├── main │ │ │ │ │ ├── MainActivityCallback.java │ │ │ │ │ ├── MainPresenter.java │ │ │ │ │ └── MainActivity.java │ │ │ │ ├── UICallback.java │ │ │ │ ├── BasePresenter.java │ │ │ │ ├── BaseViewCallback.java │ │ │ │ ├── login │ │ │ │ │ ├── LoginViewCallback.java │ │ │ │ │ ├── MainLoginSplashPresenter.java │ │ │ │ │ ├── ResetPasswordPresenter.java │ │ │ │ │ ├── MainLoginSplashFragment.java │ │ │ │ │ ├── LoginPresenter.java │ │ │ │ │ └── RegisterPresenter.java │ │ │ │ ├── AlertDialogFragment.java │ │ │ │ ├── ButtonsEnabledTextWatcher.java │ │ │ │ └── BaseFragment.java │ │ │ │ ├── adapters │ │ │ │ ├── LayoutViewBinder.java │ │ │ │ └── RxAdapter.java │ │ │ │ ├── utils │ │ │ │ ├── ValidationUtil.java │ │ │ │ ├── ThemeUtil.java │ │ │ │ ├── AndroidUtils.java │ │ │ │ ├── GsonUtil.java │ │ │ │ └── ViewUtils.java │ │ │ │ ├── ErrorException.java │ │ │ │ ├── data │ │ │ │ ├── DataChange.java │ │ │ │ ├── DataManager.java │ │ │ │ ├── DataManagerModule.java │ │ │ │ ├── ApplicationDatabaseHelper.java │ │ │ │ └── FirebaseMonitor.java │ │ │ │ ├── model │ │ │ │ ├── User.java │ │ │ │ └── DataModel.java │ │ │ │ ├── Config.java │ │ │ │ ├── services │ │ │ │ ├── AnalyticsService.java │ │ │ │ ├── ServicesModule.java │ │ │ │ ├── SyncNotificationsService.java │ │ │ │ └── SpatialService.java │ │ │ │ ├── ApplicationComponent.java │ │ │ │ ├── ApplicationModule.java │ │ │ │ ├── PreferencesHelper.java │ │ │ │ ├── views │ │ │ │ └── PasswordEditText.java │ │ │ │ └── BaseApplication.java │ │ └── AndroidManifest.xml │ ├── debug │ │ └── res │ │ │ └── xml │ │ │ └── analytics.xml │ ├── release │ │ └── res │ │ │ └── xml │ │ │ └── analytics.xml │ ├── androidTest │ │ └── java │ │ │ └── com │ │ │ └── twolinessoftware │ │ │ ├── MockComponent.java │ │ │ ├── MockNetworkModule.java │ │ │ ├── ScreenshotUtil.java │ │ │ └── MockApplicationModule.java │ └── test │ │ └── java │ │ └── com │ │ └── twolinessoftware │ │ └── android │ │ └── test │ │ ├── ui │ │ ├── MainLoginPresenterTest.java │ │ ├── ResetPasswordPresenterTest.java │ │ ├── LoginPresenterTest.java │ │ └── RegisterPresenterTest.java │ │ └── network │ │ └── UserNetworkApiTest.java ├── google-services.json └── proguard-rules.pro ├── settings.gradle ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── .gitignore ├── config └── quality │ ├── findbugs │ └── android-exclude-filter.xml │ ├── pmd │ └── pmd-ruleset.xml │ └── quality.gradle ├── gradle.properties ├── circle.yml ├── gradlew.bat └── README.md /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | *.iml -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/johncarpenter/AndroidFramework/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/johncarpenter/AndroidFramework/HEAD/app/src/main/res/drawable-xhdpi/icon.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/johncarpenter/AndroidFramework/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/johncarpenter/AndroidFramework/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/johncarpenter/AndroidFramework/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/johncarpenter/AndroidFramework/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/johncarpenter/AndroidFramework/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.apk 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | /.idea 7 | .DS_Store 8 | /build 9 | /captures 10 | 11 | *.iml 12 | /.idea/* 13 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Oct 21 09:45:24 MDT 2016 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip 7 | -------------------------------------------------------------------------------- /config/quality/findbugs/android-exclude-filter.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /app/src/main/java/com/twolinessoftware/authentication/AccountNotFoundException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 2LinesSoftware Inc 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | * 15 | */ 16 | 17 | package com.twolinessoftware.authentication; 18 | 19 | public class AccountNotFoundException extends RuntimeException { 20 | } 21 | -------------------------------------------------------------------------------- /app/src/main/java/com/twolinessoftware/network/BaseApiService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 2LinesSoftware Inc 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | * 15 | */ 16 | 17 | package com.twolinessoftware.network; 18 | 19 | 20 | public interface BaseApiService { 21 | 22 | 23 | // Retrofit API Interfaces Here 24 | 25 | } 26 | 27 | -------------------------------------------------------------------------------- /app/src/main/java/com/twolinessoftware/authentication/AccountNotLoggedInException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 2LinesSoftware Inc 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | * 15 | */ 16 | 17 | package com.twolinessoftware.authentication; 18 | 19 | /** 20 | * Created by johncarpenter on 2016-04-19. 21 | */ 22 | public class AccountNotLoggedInException extends Exception { 23 | } 24 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 14 | 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | # org.gradle.parallel=true 19 | -------------------------------------------------------------------------------- /app/src/main/java/com/twolinessoftware/activities/main/MainActivityCallback.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 2LinesSoftware Inc 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | * 15 | */ 16 | 17 | package com.twolinessoftware.activities.main; 18 | 19 | import com.twolinessoftware.activities.BaseViewCallback; 20 | 21 | public interface MainActivityCallback extends BaseViewCallback { 22 | 23 | } 24 | -------------------------------------------------------------------------------- /app/src/main/java/com/twolinessoftware/authentication/AuthChangedListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 2LinesSoftware Inc 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | * 15 | */ 16 | 17 | package com.twolinessoftware.authentication; 18 | 19 | /** 20 | * Created by johncarpenter on 2016-04-20. 21 | */ 22 | public interface AuthChangedListener { 23 | 24 | void onLoggedOut(); 25 | } 26 | -------------------------------------------------------------------------------- /app/src/main/java/com/twolinessoftware/adapters/LayoutViewBinder.java: -------------------------------------------------------------------------------- 1 | package com.twolinessoftware.adapters; 2 | 3 | import android.support.v7.widget.RecyclerView; 4 | import android.view.View; 5 | 6 | /** 7 | * 8 | */ 9 | public class LayoutViewBinder extends RecyclerView.ViewHolder { 10 | 11 | private T mData; 12 | 13 | private int mPosition; 14 | 15 | private View mView; 16 | 17 | public LayoutViewBinder(View itemView) { 18 | super(itemView); 19 | mView = itemView; 20 | } 21 | 22 | public final void setData(T data) { 23 | mData = data; 24 | } 25 | 26 | 27 | public T getData() { 28 | return mData; 29 | } 30 | 31 | public View getView() { 32 | return mView; 33 | } 34 | 35 | public int getPositionIndex() { 36 | return mPosition; 37 | } 38 | 39 | public void setPositionIndex(int position) { 40 | mPosition = position; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /app/src/main/java/com/twolinessoftware/activities/UICallback.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 2LinesSoftware Inc 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | * 15 | */ 16 | 17 | package com.twolinessoftware.activities; 18 | 19 | import com.twolinessoftware.ErrorException; 20 | 21 | public interface UICallback { 22 | 23 | void setButtonsEnabled(boolean busy); 24 | 25 | void handleError(ErrorException.Code code); 26 | 27 | } 28 | -------------------------------------------------------------------------------- /app/src/main/res/color/button_text.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /app/src/main/java/com/twolinessoftware/activities/BasePresenter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 2LinesSoftware Inc 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | * 15 | */ 16 | 17 | package com.twolinessoftware.activities; 18 | 19 | /** 20 | * Created by johncarpenter on 2016-04-18. 21 | */ 22 | public interface BasePresenter { 23 | 24 | void attachView(V baseView); 25 | 26 | void detachView(); 27 | 28 | 29 | } 30 | -------------------------------------------------------------------------------- /app/src/main/res/xml/authenticator.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | -------------------------------------------------------------------------------- /app/src/main/java/com/twolinessoftware/activities/BaseViewCallback.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 2LinesSoftware Inc 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | * 15 | */ 16 | 17 | package com.twolinessoftware.activities; 18 | 19 | import com.twolinessoftware.ErrorException; 20 | 21 | public interface BaseViewCallback { 22 | 23 | void showProgress(boolean show); 24 | 25 | void onError(ErrorException.Code code); 26 | 27 | void onLogout(); 28 | 29 | } 30 | -------------------------------------------------------------------------------- /app/src/main/java/com/twolinessoftware/network/ApiResponse.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 2LinesSoftware Inc 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | * 15 | */ 16 | 17 | package com.twolinessoftware.network; 18 | 19 | /** 20 | * Created by John on 2015-04-02. 21 | */ 22 | public class ApiResponse { 23 | public String getMessage() { 24 | return message; 25 | } 26 | 27 | public void setMessage(String message) { 28 | this.message = message; 29 | } 30 | 31 | private String message; 32 | 33 | } 34 | -------------------------------------------------------------------------------- /app/src/main/java/com/twolinessoftware/utils/ValidationUtil.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 2LinesSoftware Inc 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | * 15 | */ 16 | 17 | package com.twolinessoftware.utils; 18 | 19 | /** 20 | * Created by johncarpenter on 2015-12-08. 21 | */ 22 | public class ValidationUtil { 23 | 24 | public final static boolean isValidEmail(CharSequence target) { 25 | if (target == null) 26 | return false; 27 | 28 | return android.util.Patterns.EMAIL_ADDRESS.matcher(target).matches(); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /app/src/debug/res/xml/analytics.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | UA- 20 | 21 | true 22 | 23 | 300 24 | 25 | 26 | true 27 | 28 | 29 | -------------------------------------------------------------------------------- /app/src/release/res/xml/analytics.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | UA- 20 | 21 | true 22 | 23 | 300 24 | 25 | 26 | true 27 | 28 | 29 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/twolinessoftware/MockComponent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 2LinesSoftware Inc 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | * 15 | */ 16 | 17 | package com.twolinessoftware; 18 | 19 | import com.twolinessoftware.data.DataManagerModule; 20 | 21 | import javax.inject.Singleton; 22 | 23 | import dagger.Component; 24 | 25 | 26 | @Singleton 27 | @Component(modules = {MockApplicationModule.class, MockNetworkModule.class, GoogleServicesModule.class, DataManagerModule.class}) 28 | public interface MockComponent extends ApplicationComponent { 29 | void inject(BaseTest basetTest); 30 | } 31 | -------------------------------------------------------------------------------- /circle.yml: -------------------------------------------------------------------------------- 1 | dependencies: 2 | pre: 3 | - if ! $(grep -q "Revision=25.2.2" $ANDROID_HOME/tools/source.properties); then echo y | android update sdk -u -a -t "tools"; fi 4 | - if [ ! -e $ANDROID_HOME/build-tools/24.0.2 ]; then echo yes | android update sdk -u -a -t "build-tools-24.0.2"; fi 5 | cache_directories: 6 | - /usr/local/android-sdk-linux/build-tools/24.0.2 7 | - /usr/local/android-sdk-linux/extras 8 | - /usr/local/android-sdk-linux/tools 9 | machine: 10 | java: 11 | version: 12 | oraclejdk8 13 | environment: 14 | _JAVA_OPTIONS: "-Xms512m -Xmx2048m" 15 | GRADLE_OPTS: '-Dorg.gradle.jvmargs="-Xmx2048m -XX:+HeapDumpOnOutOfMemoryError"' 16 | test: 17 | override: 18 | - (./gradlew assemble): 19 | timeout: 360 20 | 21 | # copy artifacts 22 | - mv app/build/reports/checkstyle $CIRCLE_TEST_REPORTS/Checkstyle 23 | - mv app/build/reports/findbugs $CIRCLE_TEST_REPORTS/Findbugs 24 | - mv app/build/reports/pmd $CIRCLE_TEST_REPORTS/PMD 25 | - mv app/build/reports/tests $CIRCLE_TEST_REPORTS/Tests 26 | - mv app/build/reports/lint $CIRCLE_TEST_REPORTS/Lint 27 | - mv app/build/outputs/apk $CIRCLE_ARTIFACTS/APK 28 | -------------------------------------------------------------------------------- /app/google-services.json: -------------------------------------------------------------------------------- 1 | { 2 | "project_info": { 3 | "project_number": "558161287895", 4 | "firebase_url": "https://radiant-torch-1344.firebaseio.com", 5 | "project_id": "radiant-torch-1344", 6 | "storage_bucket": "radiant-torch-1344.appspot.com" 7 | }, 8 | "client": [ 9 | { 10 | "client_info": { 11 | "mobilesdk_app_id": "1:558161287895:android:94366c3113595c77", 12 | "android_client_info": { 13 | "package_name": "com.twolinessoftware" 14 | } 15 | }, 16 | "oauth_client": [ 17 | { 18 | "client_id": "558161287895-pl6cu22j9r4cv4n8knubbtv1s2jvfek4.apps.googleusercontent.com", 19 | "client_type": 3 20 | } 21 | ], 22 | "api_key": [ 23 | { 24 | "current_key": "AIzaSyBXtZPu2x36KyJM1a8YlhNziLpU94HxutM" 25 | } 26 | ], 27 | "services": { 28 | "analytics_service": { 29 | "status": 1 30 | }, 31 | "appinvite_service": { 32 | "status": 1, 33 | "other_platform_oauth_client": [] 34 | }, 35 | "ads_service": { 36 | "status": 2 37 | } 38 | } 39 | } 40 | ], 41 | "configuration_version": "1" 42 | } -------------------------------------------------------------------------------- /app/src/main/java/com/twolinessoftware/activities/login/LoginViewCallback.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 2LinesSoftware Inc 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | * 15 | */ 16 | 17 | package com.twolinessoftware.activities.login; 18 | 19 | import android.content.Intent; 20 | 21 | import com.twolinessoftware.activities.BaseViewCallback; 22 | 23 | /** 24 | * Created by johncarpenter on 2016-04-18. 25 | */ 26 | public interface LoginViewCallback extends BaseViewCallback { 27 | 28 | void onNavigateToForgotPassword(); 29 | 30 | void onNavigateToRegister(); 31 | 32 | void onNavigateToLogin(); 33 | 34 | void onFinishLogin(Intent intent); 35 | 36 | void onPasswordReset(); 37 | 38 | } 39 | -------------------------------------------------------------------------------- /app/src/main/java/com/twolinessoftware/ErrorException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 2LinesSoftware Inc 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | * 15 | */ 16 | 17 | package com.twolinessoftware; 18 | 19 | /** 20 | * Used for handling internal error exceptions 21 | */ 22 | public class ErrorException extends Exception { 23 | 24 | public enum Code { 25 | INVALID_CREDENTIALS, 26 | EMAIL_TAKEN, NO_DATA_AVAILABLE, FIREBASE_ERROR_GENERIC, EMAIL_MALFORMED, WEAK_PASSWORD, NO_EMAIL, GENERIC_ERROR 27 | } 28 | 29 | private final Code mCode; 30 | 31 | public ErrorException(Code code) { 32 | this.mCode = code; 33 | } 34 | 35 | public Code getCode() { 36 | return mCode; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /app/src/main/java/com/twolinessoftware/activities/main/MainPresenter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 2LinesSoftware Inc 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | * 15 | */ 16 | 17 | package com.twolinessoftware.activities.main; 18 | 19 | import com.twolinessoftware.activities.BasePresenter; 20 | 21 | /** 22 | * Created by johncarpenter on 2016-04-27. 23 | */ 24 | public class MainPresenter implements BasePresenter { 25 | 26 | private MainActivityCallback mCallback; 27 | 28 | @Override 29 | public void attachView(MainActivityCallback baseView) { 30 | mCallback = baseView; 31 | } 32 | 33 | @Override 34 | public void detachView() { 35 | mCallback = null; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /app/src/main/java/com/twolinessoftware/data/DataChange.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 2LinesSoftware Inc 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | * 15 | */ 16 | 17 | package com.twolinessoftware.data; 18 | 19 | /** 20 | * Created by johncarpenter on 2016-01-26. 21 | */ 22 | public class DataChange { 23 | 24 | 25 | public enum State { 26 | Added, Changed, Removed, Empty, Data 27 | } 28 | 29 | private State mState; 30 | private T mValue; 31 | 32 | public DataChange(State state, T value) { 33 | mState = state; 34 | mValue = value; 35 | } 36 | 37 | public State getState() { 38 | return mState; 39 | } 40 | 41 | public T getValue() { 42 | return mValue; 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /app/src/main/java/com/twolinessoftware/data/DataManager.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 2LinesSoftware Inc 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | * 15 | */ 16 | 17 | package com.twolinessoftware.data; 18 | 19 | import android.content.Context; 20 | import android.database.sqlite.SQLiteDatabase; 21 | 22 | import javax.inject.Inject; 23 | 24 | /** 25 | * 26 | */ 27 | public class DataManager { 28 | 29 | private final SQLiteDatabase mDatabase; 30 | 31 | private final Context mContext; 32 | 33 | public SQLiteDatabase getDatabase() { 34 | return mDatabase; 35 | } 36 | 37 | @Inject 38 | public DataManager(Context context, SQLiteDatabase database) { 39 | mDatabase = database; 40 | mContext = context; 41 | } 42 | 43 | 44 | } 45 | -------------------------------------------------------------------------------- /app/src/main/java/com/twolinessoftware/model/User.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 2LinesSoftware Inc 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | * 15 | */ 16 | 17 | package com.twolinessoftware.model; 18 | 19 | import com.google.gson.annotations.SerializedName; 20 | 21 | /** 22 | * Created by johncarpenter on 2016-04-18. 23 | */ 24 | public class User extends DataModel { 25 | 26 | @SerializedName("email") 27 | private String mEmail; 28 | 29 | 30 | public User(String email) { 31 | this.mEmail = email; 32 | } 33 | 34 | public User() { 35 | } 36 | 37 | @Override 38 | public String toString() { 39 | return "User{" + 40 | ", mEmail='" + mEmail + '\'' + 41 | ", mUid='" + getUid() + '\'' + 42 | '}'; 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /app/src/main/java/com/twolinessoftware/authentication/Token.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 2LinesSoftware Inc 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | * 15 | */ 16 | 17 | package com.twolinessoftware.authentication; 18 | 19 | import com.google.gson.annotations.SerializedName; 20 | 21 | /** 22 | * Created by John on 14/05/14. 23 | */ 24 | public class Token { 25 | 26 | @SerializedName("token") 27 | private String accessToken; 28 | 29 | @SerializedName("expires_in") 30 | private long expiresIn; 31 | 32 | public Token(String accessToken, long expiresIn) { 33 | this.accessToken = accessToken; 34 | this.expiresIn = expiresIn; 35 | } 36 | 37 | public String getAccessToken() { 38 | return accessToken; 39 | } 40 | 41 | public long getExpiresIn() { 42 | return expiresIn; 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /app/src/main/java/com/twolinessoftware/Config.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 2LinesSoftware Inc 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | * 15 | */ 16 | 17 | package com.twolinessoftware; 18 | 19 | 20 | /** 21 | * 22 | */ 23 | public class Config { 24 | 25 | // Shared Preferences FIle 26 | public static final String SHARED_PREFERENCES_FILE = "com.twolinessoftware.SHARED_PREFERENCES"; 27 | 28 | /** 29 | * GPS Location Settings 30 | */ 31 | public static final float GPS_SMALLEST_DISPLACEMENT_IN_M = 15; 32 | public static final long GPS_UPDATE_INTERVAL_IN_SEC = 2; 33 | public static final float GPS_MIN_ACCURACY_IN_M = 150; 34 | 35 | /** 36 | * Account Names 37 | */ 38 | public static final String BASE_ACCOUNT_TYPE = "com.twolinessoftware"; 39 | public static final String BASE_TOKEN_TYPE = "api"; 40 | 41 | } 42 | -------------------------------------------------------------------------------- /app/src/main/res/anim/raise.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 19 | 22 | 27 | 28 | 29 | 34 | 35 | -------------------------------------------------------------------------------- /app/src/main/res/menu/menu_drawer.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | 23 | 24 | 25 | 26 | 29 | 32 | 35 | 36 | -------------------------------------------------------------------------------- /app/src/main/java/com/twolinessoftware/utils/ThemeUtil.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 2LinesSoftware Inc 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | * 15 | */ 16 | 17 | package com.twolinessoftware.utils; 18 | 19 | import android.app.Activity; 20 | import android.util.TypedValue; 21 | 22 | import com.twolinessoftware.R; 23 | 24 | /** 25 | * Created by johncarpenter on 2016-04-27. 26 | */ 27 | public class ThemeUtil { 28 | 29 | public static int getPrimaryColor(Activity activity) { 30 | TypedValue typedValue = new TypedValue(); 31 | activity.getTheme().resolveAttribute(R.attr.colorPrimary, typedValue, true); 32 | return typedValue.data; 33 | } 34 | 35 | public static int getAccentColor(Activity activity) { 36 | TypedValue typedValue = new TypedValue(); 37 | activity.getTheme().resolveAttribute(R.attr.colorAccent, typedValue, true); 38 | return typedValue.data; 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /app/src/main/java/com/twolinessoftware/services/AnalyticsService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 2LinesSoftware Inc 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | * 15 | */ 16 | 17 | package com.twolinessoftware.services; 18 | 19 | import android.content.Context; 20 | import android.os.Bundle; 21 | 22 | import com.google.firebase.analytics.FirebaseAnalytics; 23 | 24 | import javax.inject.Inject; 25 | 26 | /** 27 | * Placeholder for Analytics 28 | */ 29 | public class AnalyticsService { 30 | 31 | private FirebaseAnalytics mTracker; 32 | private Context mContext; 33 | 34 | @Inject 35 | public AnalyticsService(Context context) { 36 | this.mContext = context; 37 | mTracker = FirebaseAnalytics.getInstance(context); 38 | } 39 | 40 | public void trackSample(String name) { 41 | 42 | Bundle bundle = new Bundle(); 43 | bundle.putString("EXTRA", name); 44 | mTracker.logEvent("SAMPLE", bundle); 45 | 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /app/src/main/java/com/twolinessoftware/data/DataManagerModule.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 2LinesSoftware Inc 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | * 15 | */ 16 | 17 | package com.twolinessoftware.data; 18 | 19 | import android.app.Application; 20 | import android.database.sqlite.SQLiteDatabase; 21 | 22 | import dagger.Module; 23 | import dagger.Provides; 24 | 25 | /** 26 | * 27 | */ 28 | @Module 29 | public class DataManagerModule { 30 | 31 | private final Application mApplication; 32 | 33 | public DataManagerModule(Application application) { 34 | mApplication = application; 35 | } 36 | 37 | @Provides 38 | ApplicationDatabaseHelper provideDatabaseHelper() { 39 | return new ApplicationDatabaseHelper(mApplication); 40 | } 41 | 42 | @Provides 43 | SQLiteDatabase provideDatabase(ApplicationDatabaseHelper applicationDatabaseHelper) { 44 | return applicationDatabaseHelper.getWritableDatabase(); 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /app/src/main/java/com/twolinessoftware/services/ServicesModule.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 2LinesSoftware Inc 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | * 15 | */ 16 | 17 | package com.twolinessoftware.services; 18 | 19 | import android.content.Context; 20 | 21 | import com.twolinessoftware.PreferencesHelper; 22 | 23 | import dagger.Module; 24 | import dagger.Provides; 25 | import de.greenrobot.event.EventBus; 26 | 27 | /** 28 | * 29 | */ 30 | @Module 31 | public class ServicesModule { 32 | 33 | private final Context mContext; 34 | 35 | public ServicesModule(Context context) { 36 | mContext = context; 37 | } 38 | 39 | @Provides 40 | SpatialService providesSpatialService(PreferencesHelper preferencesHelper, EventBus eventBus) { 41 | return new SpatialService(mContext, preferencesHelper, eventBus); 42 | } 43 | 44 | @Provides 45 | AnalyticsService providesAnalyticsService() { 46 | return new AnalyticsService(mContext); 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_base.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 24 | 25 | 28 | 29 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /app/src/main/java/com/twolinessoftware/activities/main/MainActivity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 2LinesSoftware Inc 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | * 15 | */ 16 | 17 | package com.twolinessoftware.activities.main; 18 | 19 | import android.os.Bundle; 20 | 21 | import com.twolinessoftware.ErrorException; 22 | import com.twolinessoftware.R; 23 | import com.twolinessoftware.activities.BaseNavigationActivity; 24 | 25 | /** 26 | * Created by johncarpenter on 2016-04-20. 27 | */ 28 | public class MainActivity extends BaseNavigationActivity implements MainActivityCallback { 29 | 30 | @Override 31 | public int getDrawerMenuId() { 32 | return R.id.menu_main; 33 | } 34 | 35 | @Override 36 | protected void onCreate(Bundle savedInstanceState) { 37 | super.onCreate(savedInstanceState); 38 | 39 | // Check for login 40 | requiresLogin(); 41 | } 42 | 43 | 44 | @Override 45 | public void onError(ErrorException.Code code) { 46 | 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_listview.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 20 | 21 | 25 | 26 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /app/src/main/java/com/twolinessoftware/authentication/AuthenticationModule.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 2LinesSoftware Inc 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | * 15 | */ 16 | 17 | package com.twolinessoftware.authentication; 18 | 19 | import android.accounts.AccountManager; 20 | import android.content.Context; 21 | 22 | import com.twolinessoftware.PreferencesHelper; 23 | 24 | import javax.inject.Singleton; 25 | 26 | import dagger.Module; 27 | import dagger.Provides; 28 | 29 | /** 30 | * 31 | */ 32 | @Module 33 | public class AuthenticationModule { 34 | 35 | private final Context mContext; 36 | 37 | public AuthenticationModule(Context context) { 38 | mContext = context; 39 | } 40 | 41 | @Provides 42 | AccountManager provideAccountManager() { 43 | return (AccountManager) mContext.getSystemService(Context.ACCOUNT_SERVICE); 44 | } 45 | 46 | @Provides 47 | @Singleton 48 | UserManager provideUserManager(PreferencesHelper preferencesHelper) { 49 | return new FirebaseUserManager(preferencesHelper); 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /app/src/main/java/com/twolinessoftware/activities/login/MainLoginSplashPresenter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 2LinesSoftware Inc 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | * 15 | */ 16 | 17 | package com.twolinessoftware.activities.login; 18 | 19 | import com.twolinessoftware.activities.BasePresenter; 20 | 21 | import javax.inject.Inject; 22 | 23 | /** 24 | * Created by johncarpenter on 2016-04-20. 25 | */ 26 | public class MainLoginSplashPresenter implements BasePresenter { 27 | @Inject 28 | public MainLoginSplashPresenter() { 29 | } 30 | 31 | private LoginViewCallback mLoginViewCallback; 32 | 33 | @Override 34 | public void attachView(LoginViewCallback baseView) { 35 | mLoginViewCallback = baseView; 36 | } 37 | 38 | @Override 39 | public void detachView() { 40 | mLoginViewCallback = null; 41 | } 42 | 43 | public void navigateToSignIn() { 44 | mLoginViewCallback.onNavigateToLogin(); 45 | } 46 | 47 | public void navigateToCreate() { 48 | mLoginViewCallback.onNavigateToRegister(); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /app/src/main/java/com/twolinessoftware/authentication/UserManager.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 2LinesSoftware Inc 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | * 15 | */ 16 | 17 | package com.twolinessoftware.authentication; 18 | 19 | import com.twolinessoftware.model.User; 20 | 21 | import rx.Observable; 22 | import rx.observables.BlockingObservable; 23 | 24 | /** 25 | * Created by johncarpenter on 2016-04-19. 26 | */ 27 | public interface UserManager { 28 | 29 | 30 | Observable createUser(String uid, User user); 31 | 32 | Observable getMe(); 33 | 34 | // Use with caution. This is a blocking call (obviously) 35 | BlockingObservable loginBlocking(String email, String password); 36 | 37 | Observable login(String email, String password); 38 | 39 | Observable register(String email, String password); 40 | 41 | Observable forgotPassword(String email); 42 | 43 | Observable logout(); 44 | 45 | void registerAuthListener(AuthChangedListener listener); 46 | 47 | void unregisterAuthListener(AuthChangedListener listener); 48 | 49 | 50 | } 51 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_nav_drawer_header.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 24 | 25 | 35 | 36 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /config/quality/pmd/pmd-ruleset.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | Custom ruleset for ribot Android application 8 | 9 | .*/R.java 10 | .*/gen/.* 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/button.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /app/src/main/java/com/twolinessoftware/model/DataModel.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 2LinesSoftware Inc 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | * 15 | */ 16 | 17 | package com.twolinessoftware.model; 18 | 19 | import com.google.gson.annotations.SerializedName; 20 | 21 | import org.joda.time.DateTime; 22 | 23 | import java.util.UUID; 24 | 25 | /** 26 | * Created by johncarpenter on 2016-04-26. 27 | */ 28 | public abstract class DataModel { 29 | 30 | @SerializedName("uid") 31 | private String mUid; 32 | 33 | @SerializedName("created") 34 | private DateTime mCreated; 35 | 36 | @SerializedName("updated") 37 | private DateTime mUpdated; 38 | 39 | 40 | public DataModel() { 41 | setUid(UUID.randomUUID().toString()); 42 | } 43 | 44 | public DataModel(String uid) { 45 | mUid = uid; 46 | } 47 | 48 | public void setCreated(DateTime created) { 49 | mCreated = created; 50 | } 51 | 52 | public DateTime getCreated() { 53 | return mCreated; 54 | } 55 | 56 | public void setUpdated(DateTime updated) { 57 | this.mUpdated = updated; 58 | } 59 | 60 | public String getUid() { 61 | return mUid; 62 | } 63 | 64 | public void setUid(String uid) { 65 | mUid = uid; 66 | } 67 | 68 | } 69 | -------------------------------------------------------------------------------- /app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 19 | 2dp 20 | 4dp 21 | 8dp 22 | 16dp 23 | 72dp 24 | 25 | 26 | 48dp 27 | 28 | 30 | 320dp 31 | 128dp 32 | 168dp 33 | 34 | 35 | 16sp 36 | 20sp 37 | 24sp 38 | 30sp 39 | 44sp 40 | 14sp 41 | 42 | 43 | 44 | 42dp 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /app/src/test/java/com/twolinessoftware/android/test/ui/MainLoginPresenterTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 2LinesSoftware Inc 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | * 15 | */ 16 | 17 | package com.twolinessoftware.android.test.ui; 18 | 19 | import android.test.suitebuilder.annotation.SmallTest; 20 | 21 | import com.twolinessoftware.activities.login.LoginViewCallback; 22 | import com.twolinessoftware.activities.login.MainLoginSplashPresenter; 23 | 24 | import org.junit.Before; 25 | import org.junit.Test; 26 | import org.mockito.Mock; 27 | 28 | import static org.mockito.Mockito.verify; 29 | import static org.mockito.MockitoAnnotations.initMocks; 30 | 31 | @SmallTest 32 | public class MainLoginPresenterTest { 33 | 34 | @Mock 35 | LoginViewCallback mLoginViewCallback; 36 | 37 | private MainLoginSplashPresenter mMainLoginPresenter; 38 | 39 | 40 | @Before 41 | public void before() { 42 | initMocks(this); 43 | mMainLoginPresenter = new MainLoginSplashPresenter(); 44 | mMainLoginPresenter.attachView(mLoginViewCallback); 45 | } 46 | 47 | @Test 48 | public void mainLoginPresenter_ShouldRedirectToSignIn() { 49 | mMainLoginPresenter.navigateToSignIn(); 50 | verify(mLoginViewCallback).onNavigateToLogin(); 51 | } 52 | 53 | @Test 54 | public void mainLoginPresenter_ShouldRedirectToCreate() { 55 | mMainLoginPresenter.navigateToCreate(); 56 | verify(mLoginViewCallback).onNavigateToRegister(); 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /app/src/main/java/com/twolinessoftware/utils/AndroidUtils.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 2LinesSoftware Inc 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | * 15 | */ 16 | 17 | package com.twolinessoftware.utils; 18 | 19 | import android.app.ActivityManager; 20 | import android.content.Context; 21 | import android.content.pm.PackageInfo; 22 | import android.content.pm.PackageManager; 23 | 24 | public class AndroidUtils { 25 | 26 | public static boolean isServiceRunning(Context context, Class serviceClass) { 27 | ActivityManager manager = 28 | (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); 29 | for (ActivityManager.RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) { 30 | if (serviceClass.getName().equals(service.service.getClassName())) { 31 | return true; 32 | } 33 | } 34 | return false; 35 | } 36 | 37 | /** 38 | * @return Application's version code from the {@code PackageManager}. 39 | */ 40 | public static int getAppVersion(Context context) { 41 | try { 42 | PackageInfo packageInfo = context.getPackageManager() 43 | .getPackageInfo(context.getPackageName(), 0); 44 | return packageInfo.versionCode; 45 | } catch (PackageManager.NameNotFoundException e) { 46 | // should never happen 47 | throw new RuntimeException("Could not get package name: " + e); 48 | } 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/twolinessoftware/MockNetworkModule.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 2LinesSoftware Inc 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | * 15 | */ 16 | 17 | package com.twolinessoftware; 18 | 19 | import android.content.Context; 20 | 21 | import com.squareup.okhttp.mockwebserver.MockWebServer; 22 | import com.twolinessoftware.network.BaseApiService; 23 | 24 | import java.io.IOException; 25 | 26 | import dagger.Module; 27 | import dagger.Provides; 28 | import rx.Scheduler; 29 | import rx.schedulers.Schedulers; 30 | 31 | import static junit.framework.Assert.fail; 32 | 33 | /** 34 | * 35 | */ 36 | @Module 37 | public class MockNetworkModule { 38 | 39 | private final Context mContext; 40 | private final MockWebServer mMockWebServer; 41 | 42 | public MockNetworkModule(Context context) { 43 | mContext = context; 44 | 45 | mMockWebServer = new MockWebServer(); 46 | try { 47 | mMockWebServer.start(); 48 | } catch (IOException e) { 49 | fail("Unable to start mock server:" + e.getMessage()); 50 | } 51 | 52 | } 53 | 54 | @Provides 55 | BaseApiService provideAppreciadoApiService() { 56 | return new BaseRetrofitHelper().newAppreciadoApiService(mMockWebServer.url("/").toString()); 57 | } 58 | 59 | 60 | @Provides 61 | Scheduler provideSubscribeScheduler() { 62 | return Schedulers.io(); 63 | } 64 | 65 | @Provides 66 | MockWebServer providerMockWebServer() { 67 | return mMockWebServer; 68 | } 69 | 70 | 71 | } 72 | -------------------------------------------------------------------------------- /app/src/main/java/com/twolinessoftware/network/NetworkModule.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 2LinesSoftware Inc 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | * 15 | */ 16 | 17 | package com.twolinessoftware.network; 18 | 19 | import android.content.Context; 20 | 21 | import com.google.gson.Gson; 22 | import com.twolinessoftware.BuildConfig; 23 | import com.twolinessoftware.utils.GsonUtil; 24 | 25 | import java.util.concurrent.TimeUnit; 26 | 27 | import dagger.Module; 28 | import dagger.Provides; 29 | import okhttp3.CacheControl; 30 | import okhttp3.logging.HttpLoggingInterceptor; 31 | import rx.Scheduler; 32 | import rx.schedulers.Schedulers; 33 | 34 | /** 35 | * 36 | */ 37 | @Module 38 | public class NetworkModule { 39 | 40 | private final Context mContext; 41 | 42 | public NetworkModule(Context context) { 43 | mContext = context; 44 | } 45 | 46 | /** 47 | * API Services are defined here 48 | * 49 | * @return 50 | */ 51 | 52 | @Provides 53 | Scheduler provideSubscribeScheduler() { 54 | return Schedulers.io(); 55 | } 56 | 57 | @Provides 58 | CacheControl provideCache() { 59 | return new CacheControl.Builder().maxAge(4, TimeUnit.HOURS).build(); 60 | } 61 | 62 | @Provides 63 | HttpLoggingInterceptor provideLoggingInterceptor() { 64 | HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor(); 65 | interceptor.setLevel(BuildConfig.DEBUG ? HttpLoggingInterceptor.Level.BODY : HttpLoggingInterceptor.Level.NONE); 66 | return interceptor; 67 | } 68 | 69 | @Provides 70 | Gson providesGson() { 71 | return GsonUtil.buildGsonAdapter(); 72 | } 73 | 74 | } 75 | -------------------------------------------------------------------------------- /app/src/main/res/layout/include_empty_list.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 20 | 21 | 30 | 31 | 32 | 37 | 38 | 44 | 45 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /app/src/main/res/layout/toolbar.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 24 | 25 | 32 | 33 | 34 | 35 | 53 | 54 | 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /app/src/main/java/com/twolinessoftware/activities/AlertDialogFragment.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 2LinesSoftware Inc 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | * 15 | */ 16 | 17 | package com.twolinessoftware.activities; 18 | 19 | import android.app.Dialog; 20 | import android.content.DialogInterface; 21 | import android.os.Bundle; 22 | import android.support.annotation.NonNull; 23 | import android.support.v4.app.DialogFragment; 24 | import android.support.v7.app.AlertDialog; 25 | 26 | import com.twolinessoftware.R; 27 | 28 | public class AlertDialogFragment extends DialogFragment { 29 | 30 | 31 | private static final String EXTRA_TITLE = "EXTRA_TITLE"; 32 | private static final String EXTRA_MESSAGE = "EXTRA_MESSAGE"; 33 | 34 | private String mTitle; 35 | private String mMessage; 36 | 37 | public static AlertDialogFragment newInstance(String title, String message) { 38 | Bundle args = new Bundle(); 39 | args.putString(EXTRA_TITLE, title); 40 | args.putString(EXTRA_MESSAGE, message); 41 | 42 | AlertDialogFragment fragment = new AlertDialogFragment(); 43 | fragment.setArguments(args); 44 | 45 | return fragment; 46 | } 47 | 48 | @NonNull 49 | @Override 50 | public Dialog onCreateDialog(Bundle savedInstanceState) { 51 | 52 | mTitle = getArguments().getString(EXTRA_TITLE); 53 | mMessage = getArguments().getString(EXTRA_MESSAGE); 54 | 55 | return new AlertDialog.Builder(getContext()) 56 | .setTitle(mTitle) 57 | .setMessage(mMessage) 58 | .setPositiveButton(R.string.dialog_ok, new DialogInterface.OnClickListener() { 59 | @Override 60 | public void onClick(DialogInterface dialog, int which) { 61 | dismiss(); 62 | } 63 | }) 64 | .create(); 65 | } 66 | 67 | 68 | } 69 | -------------------------------------------------------------------------------- /app/src/main/java/com/twolinessoftware/utils/GsonUtil.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 2LinesSoftware Inc 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | * 15 | */ 16 | 17 | package com.twolinessoftware.utils; 18 | 19 | import com.google.gson.Gson; 20 | import com.google.gson.GsonBuilder; 21 | import com.google.gson.JsonDeserializationContext; 22 | import com.google.gson.JsonDeserializer; 23 | import com.google.gson.JsonElement; 24 | import com.google.gson.JsonParseException; 25 | import com.google.gson.JsonPrimitive; 26 | import com.google.gson.JsonSerializationContext; 27 | import com.google.gson.JsonSerializer; 28 | 29 | import org.joda.time.DateTime; 30 | 31 | import java.lang.reflect.Type; 32 | 33 | public class GsonUtil { 34 | 35 | public static Gson buildGsonAdapter() { 36 | 37 | return new GsonBuilder() 38 | .registerTypeAdapter(DateTime.class, new DateTimeDeserializer()) 39 | .registerTypeAdapter(DateTime.class, new DateTimeSerializer()) 40 | .create(); 41 | } 42 | 43 | private static class DateTimeSerializer implements JsonSerializer { 44 | 45 | @Override 46 | public JsonElement serialize(DateTime src, Type typeOfSrc, JsonSerializationContext context) { 47 | 48 | return new JsonPrimitive(src.getMillis()); 49 | } 50 | } 51 | 52 | private static class DateTimeDeserializer implements JsonDeserializer { 53 | 54 | @Override 55 | public DateTime deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext jsonDeserializationContext) throws JsonParseException { 56 | 57 | if (jsonElement.getAsString() == null || jsonElement.getAsString().isEmpty()) { 58 | return null; 59 | } 60 | 61 | long timestamp = jsonElement.getAsLong(); 62 | 63 | return new DateTime(timestamp); 64 | 65 | } 66 | 67 | } 68 | 69 | 70 | } 71 | -------------------------------------------------------------------------------- /app/src/main/res/values/themes.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_base_drawer.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 25 | 26 | 30 | 31 | 34 | 35 | 40 | 41 | 45 | 46 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /app/src/main/java/com/twolinessoftware/activities/ButtonsEnabledTextWatcher.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 2LinesSoftware Inc 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | * 15 | */ 16 | 17 | package com.twolinessoftware.activities; 18 | 19 | import android.text.Editable; 20 | import android.text.TextWatcher; 21 | 22 | import com.mobsandgeeks.saripaar.ValidationError; 23 | import com.mobsandgeeks.saripaar.Validator; 24 | 25 | import java.lang.ref.WeakReference; 26 | import java.util.List; 27 | 28 | import timber.log.Timber; 29 | 30 | public class ButtonsEnabledTextWatcher implements TextWatcher, Validator.ValidationListener { 31 | 32 | private Validator mInternalValidator; 33 | private WeakReference mBaseFragment; 34 | 35 | public ButtonsEnabledTextWatcher(BaseFragment baseFragment) { 36 | Timber.v("Created Button Watcher"); 37 | this.mInternalValidator = new Validator(baseFragment); 38 | this.mInternalValidator.setValidationListener(this); 39 | this.mInternalValidator.setValidationMode(Validator.Mode.IMMEDIATE); 40 | this.mBaseFragment = new WeakReference(baseFragment); 41 | } 42 | 43 | 44 | @Override 45 | public void beforeTextChanged(CharSequence s, int start, int count, int after) { 46 | 47 | } 48 | 49 | @Override 50 | public void onTextChanged(CharSequence s, int start, int before, int count) { 51 | mInternalValidator.validate(); 52 | } 53 | 54 | @Override 55 | public void afterTextChanged(Editable s) { 56 | 57 | } 58 | 59 | @Override 60 | public void onValidationSucceeded() { 61 | Timber.v("Internal Validation Passed"); 62 | if (mBaseFragment.get() != null) { 63 | mBaseFragment.get().setButtonsEnabled(true); 64 | } 65 | } 66 | 67 | @Override 68 | public void onValidationFailed(List errors) { 69 | Timber.v("Internal Validation Failed"); 70 | if (mBaseFragment.get() != null) { 71 | mBaseFragment.get().setButtonsEnabled(false); 72 | } 73 | } 74 | 75 | 76 | public void check() { 77 | mInternalValidator.validate(); 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_resetpassword.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 21 | 22 | 27 | 28 | 34 | 35 | 47 | 48 | 49 |