├── .gitignore
├── LICENSE.txt
├── Readme.md
├── argus
├── .gitignore
├── bintray.gradle
├── build.gradle
├── config
│ └── quality
│ │ └── checkstyle.xml
├── install.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── moldedbits
│ │ └── argus
│ │ └── ExampleInstrumentedTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── com
│ │ │ └── moldedbits
│ │ │ └── argus
│ │ │ ├── Argus.java
│ │ │ ├── ArgusActivity.java
│ │ │ ├── ArgusSessionManager.java
│ │ │ ├── ArgusState.java
│ │ │ ├── ArgusTheme.java
│ │ │ ├── BaseFragment.java
│ │ │ ├── ForgotPasswordFragment.java
│ │ │ ├── LoginFragment.java
│ │ │ ├── SignupFragment.java
│ │ │ ├── handler
│ │ │ └── ThemeHelper.java
│ │ │ ├── listener
│ │ │ └── ResultListener.java
│ │ │ ├── logger
│ │ │ └── ArgusLogger.java
│ │ │ ├── nextscreenproviders
│ │ │ ├── IntentNextScreenProvider.java
│ │ │ ├── NextScreenProvider.java
│ │ │ └── SimpleNextScreenProvider.java
│ │ │ ├── provider
│ │ │ ├── BaseProvider.java
│ │ │ ├── ForgotPasswordProvider.java
│ │ │ ├── login
│ │ │ │ └── EmailLoginProvider.java
│ │ │ ├── signup
│ │ │ │ ├── EmailSignupProvider.java
│ │ │ │ ├── EmailVerificationFragment.java
│ │ │ │ └── ValidationActivity.java
│ │ │ └── social
│ │ │ │ ├── FacebookOnBoardingProvider.java
│ │ │ │ ├── GoogleOnBoardingProvider.java
│ │ │ │ └── helper
│ │ │ │ ├── FacebookConfig.java
│ │ │ │ ├── FacebookHelper.java
│ │ │ │ └── GoogleHelper.java
│ │ │ ├── storage
│ │ │ ├── ArgusStorage.java
│ │ │ └── DefaultArgusStorage.java
│ │ │ ├── utils
│ │ │ └── ViewUtils.java
│ │ │ └── validations
│ │ │ ├── AbstractValidation.java
│ │ │ ├── LengthValidation.java
│ │ │ ├── RegexValidation.java
│ │ │ ├── Validation.java
│ │ │ └── ValidationEngine.java
│ └── res
│ │ ├── drawable-xxxhdpi
│ │ ├── email_icon.png
│ │ ├── fbxxxhdpi.png
│ │ ├── google_xxxhdpi.png
│ │ ├── ic_hide_pwd.png
│ │ ├── icn_show_pwd.png
│ │ └── password_icon.png
│ │ ├── layout
│ │ ├── activity_argus.xml
│ │ ├── facebook_login.xml
│ │ ├── facebook_signup.xml
│ │ ├── forgot_password.xml
│ │ ├── fragment_email_verification.xml
│ │ ├── fragment_forgot_password.xml
│ │ ├── fragment_login.xml
│ │ ├── fragment_signup.xml
│ │ ├── google_signup.xml
│ │ ├── login_email.xml
│ │ ├── login_google.xml
│ │ └── signup_email.xml
│ │ └── values
│ │ ├── dimens.xml
│ │ ├── ids.xml
│ │ └── strings.xml
│ └── test
│ └── java
│ └── com
│ └── moldedbits
│ └── argus
│ └── ExampleUnitTest.java
├── build.gradle
├── email-login-sample
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── moldedbits
│ │ └── com
│ │ └── emailloginsample
│ │ └── ExampleInstrumentedTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── com
│ │ │ └── moldedbits
│ │ │ └── argus
│ │ │ └── samples
│ │ │ └── simplelogin
│ │ │ ├── HomeActivity.java
│ │ │ ├── SimpleEmailLoginApplication.java
│ │ │ └── SimpleEmailLoginProvider.java
│ └── res
│ │ ├── layout
│ │ └── activity_home.xml
│ │ ├── mipmap-hdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-mdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ └── values
│ │ ├── colors.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ └── test
│ └── java
│ └── moldedbits
│ └── com
│ └── emailloginsample
│ └── ExampleUnitTest.java
├── email-login-signup-sample
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── moldedbits
│ │ └── argus
│ │ └── samples
│ │ └── ExampleInstrumentedTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── com
│ │ │ └── moldedbits
│ │ │ └── argus
│ │ │ └── samples
│ │ │ └── email_login_signup
│ │ │ ├── EmailLoginSignupApplication.java
│ │ │ ├── HomeActivity.java
│ │ │ ├── SimpleEmailLoginProvider.java
│ │ │ ├── SimpleEmailSignupProvider.java
│ │ │ └── SimpleForgotPasswordProvider.java
│ └── res
│ │ ├── layout
│ │ ├── activity_main.xml
│ │ ├── custom_login_fragment.xml
│ │ └── custom_signup_layout.xml
│ │ ├── mipmap-hdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-mdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── values-v21
│ │ └── styles.xml
│ │ └── values
│ │ ├── colors.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ └── test
│ └── java
│ └── com
│ └── moldedbits
│ └── argus
│ └── samples
│ └── ExampleUnitTest.java
├── email-social-login-sample
├── .gitignore
├── build.gradle
├── google-services.json
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── moldedbits
│ │ └── argus
│ │ └── samples
│ │ └── ExampleInstrumentedTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── com
│ │ │ └── moldedbits
│ │ │ └── argus
│ │ │ └── samples
│ │ │ └── email_social_login
│ │ │ ├── EmailSocialLoginApplication.java
│ │ │ ├── FacebookSignupProvider.java
│ │ │ ├── GoogleSignupProvider.java
│ │ │ ├── HomeActivity.java
│ │ │ ├── SimpleEmailLoginProvider.java
│ │ │ ├── SimpleEmailSignupProvider.java
│ │ │ ├── SimpleForgotPasswordProvider.java
│ │ │ └── api
│ │ │ ├── ApiModule.java
│ │ │ └── ApiService.java
│ └── res
│ │ ├── drawable-xxhdpi
│ │ ├── argus_logo.png
│ │ └── login_bg.png
│ │ ├── drawable
│ │ ├── bg.xml
│ │ └── button_bg.xml
│ │ ├── layout
│ │ ├── activity_main.xml
│ │ ├── custom_login_fragment.xml
│ │ └── custom_signup_layout.xml
│ │ ├── values-v21
│ │ └── styles.xml
│ │ └── values
│ │ ├── colors.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ └── test
│ └── java
│ └── com
│ └── moldedbits
│ └── argus
│ └── samples
│ └── ExampleUnitTest.java
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── images
├── ArgusForgotPassword.png
├── ArgusLogin.png
├── ArgusSignup.png
├── argus1.png
├── argus2.png
└── argus3.png
└── settings.gradle
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/**
5 | .DS_Store
6 | /build
7 | build/
8 | /captures
9 | .externalNativeBuild
10 | /buildSrc/build
--------------------------------------------------------------------------------
/LICENSE.txt:
--------------------------------------------------------------------------------
1 |
2 | Apache License
3 | Version 2.0, January 2004
4 | http://www.apache.org/licenses/
5 |
6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7 |
8 | 1. Definitions.
9 |
10 | "License" shall mean the terms and conditions for use, reproduction,
11 | and distribution as defined by Sections 1 through 9 of this document.
12 |
13 | "Licensor" shall mean the copyright owner or entity authorized by
14 | the copyright owner that is granting the License.
15 |
16 | "Legal Entity" shall mean the union of the acting entity and all
17 | other entities that control, are controlled by, or are under common
18 | control with that entity. For the purposes of this definition,
19 | "control" means (i) the power, direct or indirect, to cause the
20 | direction or management of such entity, whether by contract or
21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
22 | outstanding shares, or (iii) beneficial ownership of such entity.
23 |
24 | "You" (or "Your") shall mean an individual or Legal Entity
25 | exercising permissions granted by this License.
26 |
27 | "Source" form shall mean the preferred form for making modifications,
28 | including but not limited to software source code, documentation
29 | source, and configuration files.
30 |
31 | "Object" form shall mean any form resulting from mechanical
32 | transformation or translation of a Source form, including but
33 | not limited to compiled object code, generated documentation,
34 | and conversions to other media types.
35 |
36 | "Work" shall mean the work of authorship, whether in Source or
37 | Object form, made available under the License, as indicated by a
38 | copyright notice that is included in or attached to the work
39 | (an example is provided in the Appendix below).
40 |
41 | "Derivative Works" shall mean any work, whether in Source or Object
42 | form, that is based on (or derived from) the Work and for which the
43 | editorial revisions, annotations, elaborations, or other modifications
44 | represent, as a whole, an original work of authorship. For the purposes
45 | of this License, Derivative Works shall not include works that remain
46 | separable from, or merely link (or bind by name) to the interfaces of,
47 | the Work and Derivative Works thereof.
48 |
49 | "Contribution" shall mean any work of authorship, including
50 | the original version of the Work and any modifications or additions
51 | to that Work or Derivative Works thereof, that is intentionally
52 | submitted to Licensor for inclusion in the Work by the copyright owner
53 | or by an individual or Legal Entity authorized to submit on behalf of
54 | the copyright owner. For the purposes of this definition, "submitted"
55 | means any form of electronic, verbal, or written communication sent
56 | to the Licensor or its representatives, including but not limited to
57 | communication on electronic mailing lists, source code control systems,
58 | and issue tracking systems that are managed by, or on behalf of, the
59 | Licensor for the purpose of discussing and improving the Work, but
60 | excluding communication that is conspicuously marked or otherwise
61 | designated in writing by the copyright owner as "Not a Contribution."
62 |
63 | "Contributor" shall mean Licensor and any individual or Legal Entity
64 | on behalf of whom a Contribution has been received by Licensor and
65 | subsequently incorporated within the Work.
66 |
67 | 2. Grant of Copyright License. Subject to the terms and conditions of
68 | this License, each Contributor hereby grants to You a perpetual,
69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70 | copyright license to reproduce, prepare Derivative Works of,
71 | publicly display, publicly perform, sublicense, and distribute the
72 | Work and such Derivative Works in Source or Object form.
73 |
74 | 3. Grant of Patent License. Subject to the terms and conditions of
75 | this License, each Contributor hereby grants to You a perpetual,
76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77 | (except as stated in this section) patent license to make, have made,
78 | use, offer to sell, sell, import, and otherwise transfer the Work,
79 | where such license applies only to those patent claims licensable
80 | by such Contributor that are necessarily infringed by their
81 | Contribution(s) alone or by combination of their Contribution(s)
82 | with the Work to which such Contribution(s) was submitted. If You
83 | institute patent litigation against any entity (including a
84 | cross-claim or counterclaim in a lawsuit) alleging that the Work
85 | or a Contribution incorporated within the Work constitutes direct
86 | or contributory patent infringement, then any patent licenses
87 | granted to You under this License for that Work shall terminate
88 | as of the date such litigation is filed.
89 |
90 | 4. Redistribution. You may reproduce and distribute copies of the
91 | Work or Derivative Works thereof in any medium, with or without
92 | modifications, and in Source or Object form, provided that You
93 | meet the following conditions:
94 |
95 | (a) You must give any other recipients of the Work or
96 | Derivative Works a copy of this License; and
97 |
98 | (b) You must cause any modified files to carry prominent notices
99 | stating that You changed the files; and
100 |
101 | (c) You must retain, in the Source form of any Derivative Works
102 | that You distribute, all copyright, patent, trademark, and
103 | attribution notices from the Source form of the Work,
104 | excluding those notices that do not pertain to any part of
105 | the Derivative Works; and
106 |
107 | (d) If the Work includes a "NOTICE" text file as part of its
108 | distribution, then any Derivative Works that You distribute must
109 | include a readable copy of the attribution notices contained
110 | within such NOTICE file, excluding those notices that do not
111 | pertain to any part of the Derivative Works, in at least one
112 | of the following places: within a NOTICE text file distributed
113 | as part of the Derivative Works; within the Source form or
114 | documentation, if provided along with the Derivative Works; or,
115 | within a display generated by the Derivative Works, if and
116 | wherever such third-party notices normally appear. The contents
117 | of the NOTICE file are for informational purposes only and
118 | do not modify the License. You may add Your own attribution
119 | notices within Derivative Works that You distribute, alongside
120 | or as an addendum to the NOTICE text from the Work, provided
121 | that such additional attribution notices cannot be construed
122 | as modifying the License.
123 |
124 | You may add Your own copyright statement to Your modifications and
125 | may provide additional or different license terms and conditions
126 | for use, reproduction, or distribution of Your modifications, or
127 | for any such Derivative Works as a whole, provided Your use,
128 | reproduction, and distribution of the Work otherwise complies with
129 | the conditions stated in this License.
130 |
131 | 5. Submission of Contributions. Unless You explicitly state otherwise,
132 | any Contribution intentionally submitted for inclusion in the Work
133 | by You to the Licensor shall be under the terms and conditions of
134 | this License, without any additional terms or conditions.
135 | Notwithstanding the above, nothing herein shall supersede or modify
136 | the terms of any separate license agreement you may have executed
137 | with Licensor regarding such Contributions.
138 |
139 | 6. Trademarks. This License does not grant permission to use the trade
140 | names, trademarks, service marks, or product names of the Licensor,
141 | except as required for reasonable and customary use in describing the
142 | origin of the Work and reproducing the content of the NOTICE file.
143 |
144 | 7. Disclaimer of Warranty. Unless required by applicable law or
145 | agreed to in writing, Licensor provides the Work (and each
146 | Contributor provides its Contributions) on an "AS IS" BASIS,
147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148 | implied, including, without limitation, any warranties or conditions
149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150 | PARTICULAR PURPOSE. You are solely responsible for determining the
151 | appropriateness of using or redistributing the Work and assume any
152 | risks associated with Your exercise of permissions under this License.
153 |
154 | 8. Limitation of Liability. In no event and under no legal theory,
155 | whether in tort (including negligence), contract, or otherwise,
156 | unless required by applicable law (such as deliberate and grossly
157 | negligent acts) or agreed to in writing, shall any Contributor be
158 | liable to You for damages, including any direct, indirect, special,
159 | incidental, or consequential damages of any character arising as a
160 | result of this License or out of the use or inability to use the
161 | Work (including but not limited to damages for loss of goodwill,
162 | work stoppage, computer failure or malfunction, or any and all
163 | other commercial damages or losses), even if such Contributor
164 | has been advised of the possibility of such damages.
165 |
166 | 9. Accepting Warranty or Additional Liability. While redistributing
167 | the Work or Derivative Works thereof, You may choose to offer,
168 | and charge a fee for, acceptance of support, warranty, indemnity,
169 | or other liability obligations and/or rights consistent with this
170 | License. However, in accepting such obligations, You may act only
171 | on Your own behalf and on Your sole responsibility, not on behalf
172 | of any other Contributor, and only if You agree to indemnify,
173 | defend, and hold each Contributor harmless for any liability
174 | incurred by, or claims asserted against, such Contributor by reason
175 | of your accepting any such warranty or additional liability.
176 |
177 | END OF TERMS AND CONDITIONS
178 |
179 | APPENDIX: How to apply the Apache License to your work.
180 |
181 | To apply the Apache License to your work, attach the following
182 | boilerplate notice, with the fields enclosed by brackets "[]"
183 | replaced with your own identifying information. (Don't include
184 | the brackets!) The text should be enclosed in the appropriate
185 | comment syntax for the file format. We also recommend that a
186 | file or class name and description of purpose be included on the
187 | same "printed page" as the copyright notice for easier
188 | identification within third-party archives.
189 |
190 | Copyright [yyyy] [name of copyright owner]
191 |
192 | Licensed under the Apache License, Version 2.0 (the "License");
193 | you may not use this file except in compliance with the License.
194 | You may obtain a copy of the License at
195 |
196 | http://www.apache.org/licenses/LICENSE-2.0
197 |
198 | Unless required by applicable law or agreed to in writing, software
199 | distributed under the License is distributed on an "AS IS" BASIS,
200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201 | See the License for the specific language governing permissions and
202 | limitations under the License.
203 |
--------------------------------------------------------------------------------
/Readme.md:
--------------------------------------------------------------------------------
1 | # Argus- Onboarding Simplified
2 |
3 | Argus Android makes it hassle free of managing all onboarding related tasks such as Signup/Login/Forgot Password and Social Logins.
4 |
5 | ## Gradle
6 | `compile 'com.moldedbits.argus:argus:0.2.0'`
7 |
8 | ## Maven
9 |
10 | com.moldedbits.argus
11 | argus
12 | 0.1.0
13 | pom
14 |
15 |
16 | ## Screenshots
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 | ## Features
31 | #### 1. Built in Login/Signup Providers
32 | Argus comes with built in social login providers as well as an `EmailLoginProvider` which can be easily
33 | integrated with your custom APIs. Adding different providers is as simple as this
34 |
35 | ```Java
36 | List loginProviders = new ArrayList<>();
37 | loginProviders.add(new GoogleOnBoardingProvider());
38 | loginProviders.add(new FacebookOnBoardingProvider())
39 | ```
40 |
41 | and then supply these providers to Argus object
42 |
43 | ```Java
44 | new Argus.Builder().loginProviders(loginProviders)
45 | ```
46 |
47 | #### 2. Custom Layouts for Signup and Login
48 | If you don't like Argus default UI you can provide your own layout and Argus will take care of rest
49 |
50 | ```Java
51 | new Argus.Builder().signupLayout(R.layout.custom_signup_layout)
52 | ```
53 |
54 | #### 3. Adaptive Look and Feel
55 | Argus is built keeping Material design in mind it automatically adapts colors defined in your `styles.xml`
56 |
57 |
58 | #### 4. Customizable Look and Feel
59 | Argus can be customized as per your needs using `ArgusTheme`
60 |
61 | ```Java
62 | ArgusTheme argusTheme
63 | = new ArgusTheme.Builder()
64 | .buttonColor(R.color.com_facebook_blue)
65 | .logo(R.drawable.app_logo)
66 | .build();
67 | ```
68 |
69 | ## Usage
70 | Argus exposes `ArgusActivity` which can be set as launcher activity in `AndroidManifest` or started using an Intent.
71 | Currently it redirects to Login screen by default but in future we would let developer choose where he want to start.
72 |
73 | A basic configuration of Argus looks like this
74 | ```Java
75 | // initialize Argus
76 | ArrayList loginProviders = new ArrayList<>();
77 | ArrayList signupProviders = new ArrayList<>();
78 | PlaygroundSignupProvider playgroundSignupProvider = new PlaygroundSignupProvider(false);
79 | playgroundSignupProvider.getValidationEngine()
80 | .addPasswordValidation(new LengthValidation(4, 8, getString(R.string.password_length)));
81 |
82 | loginProviders.add(new PlaygroundLoginProvider());
83 | signupProviders.add(playgroundSignupProvider);
84 |
85 | ArgusTheme.Builder themeBuilder = new ArgusTheme.Builder();
86 | themeBuilder.logo(R.drawable.logo_3x);
87 |
88 | new Argus.Builder()
89 | .argusStorage(new DefaultArgusStorage(getApplicationContext()))
90 | .nextScreenProvider(new SimpleNextScreenProvider(ProjectListActivity.class))
91 | .signupProviders(signupProviders)
92 | .loginProviders(loginProviders)
93 | .theme(themeBuilder.build())
94 | .build();
95 | ```
96 |
97 | Please feel free to contribute or report issues.
98 |
99 | License
100 | =======
101 |
102 | Copyright 2013 moldedbits
103 |
104 | Licensed under the Apache License, Version 2.0 (the "License");
105 | you may not use this file except in compliance with the License.
106 | You may obtain a copy of the License at
107 |
108 | http://www.apache.org/licenses/LICENSE-2.0
109 |
110 | Unless required by applicable law or agreed to in writing, software
111 | distributed under the License is distributed on an "AS IS" BASIS,
112 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
113 | See the License for the specific language governing permissions and
114 | limitations under the License.
115 |
--------------------------------------------------------------------------------
/argus/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/argus/bintray.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.jfrog.bintray'
2 |
3 | version = libraryVersion
4 |
5 | if (project.hasProperty("android")) { // Android libraries
6 | task sourcesJar(type: Jar) {
7 | classifier = 'sources'
8 | from android.sourceSets.main.java.srcDirs
9 | }
10 |
11 | task javadoc(type: Javadoc) {
12 | source = android.sourceSets.main.java.srcDirs
13 | classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
14 | }
15 | } else { // Java libraries
16 | task sourcesJar(type: Jar, dependsOn: classes) {
17 | classifier = 'sources'
18 | from sourceSets.main.allSource
19 | }
20 | }
21 |
22 | task javadocJar(type: Jar, dependsOn: javadoc) {
23 | classifier = 'javadoc'
24 | from javadoc.destinationDir
25 | }
26 |
27 | artifacts {
28 | archives javadocJar
29 | archives sourcesJar
30 | }
31 |
32 | // Bintray
33 | Properties properties = new Properties()
34 | properties.load(project.rootProject.file('local.properties').newDataInputStream())
35 |
36 | bintray {
37 | user = properties.getProperty("bintray.user")
38 | key = properties.getProperty("bintray.apikey")
39 |
40 | configurations = ['archives']
41 | pkg {
42 | repo = bintrayRepo
43 | name = bintrayName
44 | userOrg = properties.getProperty("bintray.organization")
45 | desc = libraryDescription
46 | websiteUrl = siteUrl
47 | vcsUrl = gitUrl
48 | licenses = allLicenses
49 | publish = true
50 | publicDownloadNumbers = true
51 | version {
52 | desc = libraryDescription
53 | gpg {
54 | sign = true //Determines whether to GPG sign the files. The default is false
55 | passphrase = properties.getProperty("bintray.gpg.password")
56 | //Optional. The passphrase for GPG signing'
57 | }
58 | }
59 | }
60 | }
--------------------------------------------------------------------------------
/argus/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | repositories {
3 | jcenter()
4 | }
5 |
6 | dependencies {
7 | classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
8 | classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
9 | }
10 | }
11 |
12 | apply plugin: 'com.android.library'
13 | apply plugin: 'checkstyle'
14 |
15 | preBuild.dependsOn 'checkstyle'
16 | check.dependsOn 'checkstyle'
17 |
18 | task checkstyle(type: Checkstyle) {
19 | configFile file("${project.projectDir}/config/quality/checkstyle.xml")
20 | source 'src'
21 | include '**/*.java'
22 | exclude '**/gen/**'
23 |
24 | classpath = files()
25 |
26 | // set to false if you want to consider warning as error
27 | ignoreFailures = true
28 | }
29 |
30 | android {
31 | compileSdkVersion 25
32 | buildToolsVersion "25.0.3"
33 |
34 | defaultConfig {
35 | minSdkVersion 16
36 | targetSdkVersion 25
37 | versionCode 5
38 | versionName "0.2.0"
39 |
40 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
41 |
42 | // setting custom name for output
43 | project.ext.set("archivesBaseName", "Argus-android-" + defaultConfig.versionName
44 | + "-vc" + defaultConfig.versionCode);
45 | }
46 |
47 | buildTypes {
48 | release {
49 | minifyEnabled false
50 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
51 | }
52 | }
53 |
54 | lintOptions {
55 | // set to true to turn off analysis progress reporting by lint
56 | quiet true
57 | // if true, stop the gradle build if errors are found
58 | abortOnError false
59 | // if true, only report errors
60 | ignoreWarnings false
61 | // if true, emit full/absolute paths to files with errors (true by default)
62 | //absolutePaths true
63 | // if true, check all issues, including those that are off by default
64 | checkAllWarnings true
65 | // if true, treat all warnings as errors
66 | warningsAsErrors false
67 | // turn off checking the given issue id's
68 | disable 'TypographyFractions', 'TypographyQuotes'
69 | // turn on the given issue id's
70 | enable 'RtlHardcoded', 'RtlCompat', 'RtlEnabled'
71 | // check *only* the given issue id's
72 | //check 'NewApi', 'InlinedApi'
73 | // if true, don't include source code lines in the error output
74 | noLines false
75 | // if true, show all locations for an error, do not truncate lists, etc.
76 | showAll true
77 | // Fallback lint configuration (default severities, etc.)
78 | lintConfig file("default-lint.xml")
79 | // if true, generate a text report of issues (false by default)
80 | textReport false
81 | // location to write the output; can be a file or 'stdout'
82 | textOutput 'stdout'
83 | // if true, generate an XML report for use by for example Jenkins
84 | xmlReport false
85 | // file to write report to (if not specified, defaults to lint-results.xml)
86 | xmlOutput file("build/reports/lint/lint-report.xml")
87 | // if true, generate an HTML report (with issue explanations, sourcecode, etc)
88 | htmlReport true
89 | // optional path to report (default will be lint-results.html in the builddir)
90 | htmlOutput file("build/reports/lint/lint-report.html")
91 | }
92 | }
93 |
94 | dependencies {
95 | compile fileTree(dir: 'libs', include: ['*.jar'])
96 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
97 | exclude group: 'com.android.support', module: 'support-annotations'
98 | })
99 | compile 'com.google.android.gms:play-services-auth:11.0.4'
100 | compile 'com.android.support:design:25.3.1'
101 | compile 'com.android.support:appcompat-v7:25.3.1'
102 | compile 'com.android.support:support-v4:25.3.1'
103 | compile 'com.facebook.android:facebook-android-sdk:4.22.0'
104 | compile 'com.google.code.gson:gson:2.7'
105 | testCompile 'junit:junit:4.12'
106 | provided 'org.projectlombok:lombok:1.16.16'
107 | provided 'org.glassfish:javax.annotation:10.0-b28'
108 | }
109 |
110 | ext {
111 | bintrayRepo = 'maven'
112 | bintrayName = 'argus'
113 |
114 | publishedGroupId = 'com.moldedbits.argus'
115 | libraryName = 'argus'
116 | artifact = 'argus'
117 |
118 | libraryDescription = 'Argus is a library to make onboarding simple in Android apps'
119 |
120 | siteUrl = 'https://github.com/moldedbits/argus-android'
121 | gitUrl = 'https://github.com/moldedbits/argus-android.git'
122 |
123 | libraryVersion = '0.2.0'
124 |
125 | developerId = 'moldedbits'
126 | developerName = 'Moldedbits'
127 | developerEmail = 'hello@moldedbits.com'
128 |
129 | licenseName = 'Apache 2.0'
130 | licenseUrl = 'https://opensource.org/licenses/Apache-2.0'
131 | allLicenses = ["Apache-2.0"]
132 | }
133 |
134 | apply from: 'install.gradle'
135 | apply from: 'bintray.gradle'
--------------------------------------------------------------------------------
/argus/config/quality/checkstyle.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
63 |
64 |
65 |
66 |
67 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
77 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
104 |
105 |
106 |
108 |
109 |
110 |
111 |
113 |
114 |
115 |
116 |
117 |
118 |
120 |
121 |
122 |
123 |
124 |
125 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
139 |
140 |
141 |
142 |
144 |
145 |
146 |
147 |
149 |
150 |
151 |
152 |
154 |
155 |
156 |
157 |
159 |
161 |
163 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
184 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
197 |
198 |
199 |
200 |
201 |
202 |
203 |
204 |
205 |
206 |
207 |
208 |
209 |
210 |
211 |
212 |
213 |
214 |
215 |
216 |
217 |
218 |
219 |
220 |
221 |
222 |
223 |
224 |
225 |
226 |
227 |
228 |
230 |
231 |
232 |
233 |
234 |
235 |
236 |
237 |
238 |
239 |
--------------------------------------------------------------------------------
/argus/install.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.github.dcendents.android-maven'
2 |
3 | group = publishedGroupId // Maven Group ID for the artifact
4 |
5 | install {
6 | repositories.mavenInstaller {
7 | // This generates POM.xml with proper parameters
8 | pom.project {
9 | packaging 'aar'
10 | groupId publishedGroupId
11 | artifactId artifact
12 | version libraryVersion
13 |
14 | // Add your description here
15 | name libraryName
16 | description libraryDescription
17 | url siteUrl
18 |
19 | // Set your license
20 | licenses {
21 | license {
22 | name licenseName
23 | url licenseUrl
24 | }
25 | }
26 | developers {
27 | developer {
28 | id developerId
29 | name developerName
30 | email developerEmail
31 | }
32 | }
33 | scm {
34 | connection gitUrl
35 | developerConnection gitUrl
36 | url siteUrl
37 |
38 | }
39 | }
40 | }
41 | }
42 |
43 |
--------------------------------------------------------------------------------
/argus/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /Users/anuj/Library/Android/sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
19 | # Uncomment this to preserve the line number information for
20 | # debugging stack traces.
21 | #-keepattributes SourceFile,LineNumberTable
22 |
23 | # If you keep the line number information, uncomment this to
24 | # hide the original source file name.
25 | #-renamesourcefileattribute SourceFile
26 |
--------------------------------------------------------------------------------
/argus/src/androidTest/java/com/moldedbits/argus/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.moldedbits.argus;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumentation test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() throws Exception {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("com.moldedbits.argus.test", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/argus/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/argus/src/main/java/com/moldedbits/argus/Argus.java:
--------------------------------------------------------------------------------
1 | package com.moldedbits.argus;
2 |
3 | import com.moldedbits.argus.nextscreenproviders.NextScreenProvider;
4 | import com.moldedbits.argus.provider.BaseProvider;
5 | import com.moldedbits.argus.storage.ArgusStorage;
6 |
7 | import java.util.ArrayList;
8 | import java.util.List;
9 |
10 | import lombok.Getter;
11 | import lombok.Setter;
12 |
13 | /**
14 | * Single contact point for client
15 | */
16 | public class Argus {
17 | private static Argus _instance;
18 |
19 | private ArgusSessionManager argusSessionManager;
20 |
21 | @Getter
22 | @Setter
23 | private NextScreenProvider nextScreenProvider;
24 |
25 | @Getter
26 | private List signupProviders;
27 |
28 | @Getter
29 | private List loginProviders;
30 |
31 | @Getter
32 | private BaseProvider forgotPasswordProvider;
33 |
34 | @Getter
35 | private int loginLayout;
36 |
37 | @Getter
38 | private int signupLayout;
39 |
40 | @Getter
41 | private ArgusTheme argusTheme;
42 |
43 | @Getter
44 | private int forgotPasswordLayout;
45 |
46 | @Getter
47 | boolean skipLoginEnable;
48 |
49 | @Getter
50 | String skipLoginText;
51 |
52 | private Argus() {
53 | }
54 |
55 | /**
56 | * Required Argus storage instance in order to store ArgusUser
57 | */
58 | private ArgusStorage argusStorage;
59 |
60 |
61 | public static Argus getInstance() {
62 | return _instance;
63 | }
64 |
65 | /**
66 | * Is a user currently logged in.
67 | *
68 | * @return True if a user is logged in, false otherwise
69 | */
70 | public boolean isLoggedIn() {
71 | return argusSessionManager.isLoggedIn();
72 | }
73 |
74 | /**
75 | * Get the currently logged in user.
76 | *
77 | * @return Currently logged in user, or null if no user is logged in.
78 | */
79 |
80 | public ArgusState getState() {
81 | return argusSessionManager.getCurrentState();
82 | }
83 |
84 | public void setState(ArgusState argusState) {
85 | argusSessionManager.setCurrentState(argusState);
86 | }
87 |
88 | public ArgusStorage getStorage() {
89 | return argusStorage;
90 | }
91 |
92 |
93 | public static class Builder {
94 |
95 | private Argus argus;
96 |
97 | public Builder() {
98 | argus = new Argus();
99 | }
100 |
101 | public Builder nextScreenProvider(NextScreenProvider provider) {
102 | argus.nextScreenProvider = provider;
103 | return this;
104 | }
105 |
106 | public Builder loginLayout(int layout) {
107 | argus.loginLayout = layout;
108 | return this;
109 | }
110 |
111 | public Builder signupLayout(int layout) {
112 | argus.signupLayout = layout;
113 | return this;
114 | }
115 |
116 | public Builder forgotPasswordLayout(int layout) {
117 | argus.forgotPasswordLayout = layout;
118 | return this;
119 | }
120 |
121 | public Builder loginProvider(BaseProvider provider) {
122 | if (argus.loginProviders == null) {
123 | argus.loginProviders = new ArrayList<>();
124 | }
125 | argus.loginProviders.add(provider);
126 | return this;
127 | }
128 |
129 | public Builder signupProviders(List providers) {
130 | if (argus.signupProviders == null) {
131 | argus.signupProviders = new ArrayList<>();
132 | }
133 | argus.signupProviders = providers;
134 | return this;
135 | }
136 |
137 | public Builder forgotPasswordProvider(BaseProvider provider) {
138 | argus.forgotPasswordProvider = provider;
139 | return this;
140 | }
141 |
142 | public Builder loginProviders(List providers) {
143 | if (argus.loginProviders == null) {
144 | argus.loginProviders = new ArrayList<>();
145 | }
146 | argus.loginProviders = providers;
147 | return this;
148 | }
149 |
150 | public Builder argusStorage(ArgusStorage argusStorage) {
151 | if (argusStorage == null) {
152 | throw new IllegalArgumentException("Argus Storage cannot be null");
153 | }
154 |
155 | argus.argusStorage = argusStorage;
156 | argus.argusSessionManager = new ArgusSessionManager(argusStorage);
157 | return this;
158 | }
159 |
160 | public Builder theme(ArgusTheme argusTheme) {
161 | argus.argusTheme = argusTheme;
162 | return this;
163 | }
164 |
165 | public Builder enableSkipLogin(boolean isSkip) {
166 | argus.skipLoginEnable = isSkip;
167 | return this;
168 | }
169 |
170 | public Builder skipLoginText(String text) {
171 | argus.skipLoginText = text;
172 | return this;
173 | }
174 |
175 | public Argus build() {
176 | if (argus.argusStorage == null) {
177 | throw new IllegalStateException("No ArgusStorage was provided.");
178 | }
179 | Argus._instance = argus;
180 | return Argus.getInstance();
181 | }
182 | }
183 | }
184 |
--------------------------------------------------------------------------------
/argus/src/main/java/com/moldedbits/argus/ArgusActivity.java:
--------------------------------------------------------------------------------
1 | package com.moldedbits.argus;
2 |
3 | import android.os.Bundle;
4 | import android.support.v7.app.AppCompatActivity;
5 | import android.view.View;
6 | import android.widget.Toast;
7 |
8 | import com.moldedbits.argus.listener.ResultListener;
9 |
10 | public class ArgusActivity extends AppCompatActivity
11 | implements ResultListener {
12 |
13 | @Override
14 | protected void onCreate(Bundle savedInstanceState) {
15 | super.onCreate(savedInstanceState);
16 |
17 | if (Argus.getInstance() == null) {
18 | throw new RuntimeException("Argus not initialized");
19 | }
20 | // If user is logged in, proceed to next screen
21 | if (Argus.getInstance().getState() == ArgusState.SIGNED_IN) {
22 | showNextScreen();
23 | return;
24 | }
25 |
26 | // Otherwise, show login flow
27 | setContentView(R.layout.activity_argus);
28 |
29 | int backgroundDrawable = Argus.getInstance().getArgusTheme().getBackgroundDrawable();
30 | if (backgroundDrawable > 0) {
31 | findViewById(R.id.argus_content).setBackgroundResource(backgroundDrawable);
32 | }
33 |
34 | showLoginFragment();
35 | }
36 |
37 | private void showLoginFragment() {
38 | BaseFragment baseFragment = LoginFragment.newInstance();
39 | getSupportFragmentManager()
40 | .beginTransaction()
41 | .replace(R.id.argus_content, baseFragment)
42 | .commit();
43 | }
44 |
45 | @Override
46 | public void onSuccess(ArgusState argusState) {
47 | Argus.getInstance().setState(argusState);
48 | if (argusState == ArgusState.SIGNED_IN) {
49 | showNextScreen();
50 | }
51 | }
52 |
53 | @Override
54 | public void onFailure(String message) {
55 | //TODO handle failure correctly
56 | Toast.makeText(this, message, Toast.LENGTH_SHORT).show();
57 | }
58 |
59 | private void showNextScreen() {
60 | startActivity(Argus.getInstance().getNextScreenProvider().getNextScreen(this));
61 | finish();
62 | }
63 |
64 | public void onSignupClick(View view) {
65 | showSignupFragment();
66 | }
67 |
68 | private void showSignupFragment() {
69 | BaseFragment baseFragment = SignupFragment.newInstance();
70 | getSupportFragmentManager()
71 | .beginTransaction()
72 | .replace(R.id.argus_content, baseFragment)
73 | .addToBackStack("login")
74 | .commit();
75 | }
76 | }
77 |
--------------------------------------------------------------------------------
/argus/src/main/java/com/moldedbits/argus/ArgusSessionManager.java:
--------------------------------------------------------------------------------
1 | package com.moldedbits.argus;
2 |
3 | import com.moldedbits.argus.storage.ArgusStorage;
4 |
5 | /**
6 | * Helper to access Session information
7 | */
8 | class ArgusSessionManager {
9 |
10 | private static final String KEY_ARGUS_STATE = "argus_state";
11 |
12 | /**
13 | * Responsible for storing all data in shared preferences
14 | */
15 | private ArgusStorage argusStorage;
16 |
17 | ArgusSessionManager(ArgusStorage argusStorage) {
18 | this.argusStorage = argusStorage;
19 | }
20 |
21 | /**
22 | * Is a user currently logged in.
23 | *
24 | * @return True if a user is logged in, false otherwise
25 | */
26 | boolean isLoggedIn() {
27 | return ArgusState.valueOf(argusStorage.getString(KEY_ARGUS_STATE, null)).equals(ArgusState.SIGNED_IN);
28 | }
29 |
30 | /**
31 | * Get the currently logged in user.
32 | *
33 | * @return Currently logged in user, or null if no user is logged in.
34 | */
35 |
36 | ArgusState getCurrentState() {
37 | return ArgusState.valueOf(argusStorage.getString(KEY_ARGUS_STATE,
38 | ArgusState.SIGNED_OUT.toString()));
39 | }
40 |
41 | void setCurrentState(ArgusState argusState) {
42 | argusStorage.putString(KEY_ARGUS_STATE, argusState.toString());
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/argus/src/main/java/com/moldedbits/argus/ArgusState.java:
--------------------------------------------------------------------------------
1 | package com.moldedbits.argus;
2 |
3 | /**
4 | * Overall state of the system.
5 | */
6 |
7 | public enum ArgusState {
8 | SIGNED_OUT,
9 | SIGNED_IN
10 | }
11 |
--------------------------------------------------------------------------------
/argus/src/main/java/com/moldedbits/argus/ArgusTheme.java:
--------------------------------------------------------------------------------
1 | package com.moldedbits.argus;
2 |
3 | import android.graphics.Color;
4 | import android.support.annotation.ColorInt;
5 | import android.support.annotation.DrawableRes;
6 | import android.view.View;
7 |
8 | import lombok.Getter;
9 |
10 | public class ArgusTheme {
11 |
12 | @Getter
13 | @DrawableRes
14 | private int logo;
15 |
16 | @Getter
17 | @DrawableRes
18 | private int backgroundDrawable;
19 |
20 | @Getter
21 | @DrawableRes
22 | private int buttonDrawable;
23 |
24 | @Getter
25 | private String welcomeText;
26 |
27 | @Getter
28 | private float welcomeTextSize;
29 |
30 | @Getter
31 | private int welcomeTextVisibility;
32 |
33 | @Getter
34 | @ColorInt
35 | private int welcomeTextColor;
36 |
37 | @Getter
38 | private boolean showEditTextDrawables;
39 |
40 | public static class Builder {
41 |
42 | ArgusTheme argusTheme;
43 |
44 | public Builder() {
45 | argusTheme = new ArgusTheme();
46 | argusTheme.welcomeTextSize = 14;
47 | argusTheme.welcomeTextColor = Color.BLACK;
48 | argusTheme.welcomeTextVisibility = View.VISIBLE;
49 | }
50 |
51 | public Builder buttonDrawable(@DrawableRes int buttonDrawable) {
52 | argusTheme.buttonDrawable = buttonDrawable;
53 | return this;
54 | }
55 |
56 | public Builder logo(@DrawableRes int logo) {
57 | argusTheme.logo = logo;
58 | return this;
59 | }
60 |
61 | public Builder backgroundDrawable(@DrawableRes int backgroundDrawable) {
62 | argusTheme.backgroundDrawable = backgroundDrawable;
63 | return this;
64 | }
65 |
66 | public Builder welcomeText(String welcomeText) {
67 | argusTheme.welcomeText = welcomeText;
68 | return this;
69 | }
70 |
71 | public Builder welcomeTextSize(float welcomeTextSize) {
72 | argusTheme.welcomeTextSize = welcomeTextSize;
73 | return this;
74 | }
75 |
76 | public Builder welcomeTextColor(int welcomeTextColor) {
77 | argusTheme.welcomeTextColor = welcomeTextColor;
78 | return this;
79 | }
80 |
81 | public Builder showEditTextDrawables(boolean show) {
82 | argusTheme.showEditTextDrawables = show;
83 | return this;
84 | }
85 |
86 | public Builder showWelcomeText() {
87 | argusTheme.welcomeTextVisibility = View.VISIBLE;
88 | return this;
89 | }
90 |
91 | public Builder hideWelcomeText() {
92 | argusTheme.welcomeTextVisibility = View.GONE;
93 | return this;
94 | }
95 |
96 | public ArgusTheme build() {
97 | return argusTheme;
98 | }
99 | }
100 | }
101 |
--------------------------------------------------------------------------------
/argus/src/main/java/com/moldedbits/argus/BaseFragment.java:
--------------------------------------------------------------------------------
1 | package com.moldedbits.argus;
2 |
3 | import android.content.Context;
4 | import android.content.Intent;
5 | import android.graphics.PorterDuff;
6 | import android.graphics.PorterDuffColorFilter;
7 | import android.os.Bundle;
8 | import android.support.v4.app.Fragment;
9 | import android.support.v4.content.ContextCompat;
10 | import android.view.LayoutInflater;
11 | import android.view.View;
12 | import android.view.ViewGroup;
13 | import android.widget.ImageView;
14 |
15 | import com.moldedbits.argus.listener.ResultListener;
16 | import com.moldedbits.argus.provider.BaseProvider;
17 | import com.moldedbits.argus.utils.ViewUtils;
18 |
19 | import java.util.List;
20 |
21 |
22 | public abstract class BaseFragment extends Fragment implements ResultListener {
23 |
24 | private ResultListener resultListener;
25 |
26 | private View rootView;
27 |
28 | @Override
29 | public View onCreateView(LayoutInflater inflater, ViewGroup container,
30 | Bundle savedInstanceState) {
31 | rootView = inflater.inflate(getLayoutId(), container, false);
32 | setView(rootView, getProviders());
33 | applyTheme(rootView);
34 | return rootView;
35 | }
36 |
37 | private void applyTheme(final View view) {
38 | ArgusTheme theme = Argus.getInstance().getArgusTheme();
39 | if (theme.getLogo() != 0) {
40 | ImageView iv = (ImageView) view.findViewById(R.id.iv_logo);
41 | if (iv != null) {
42 | iv.setImageResource(theme.getLogo());
43 | }
44 | }
45 |
46 | PorterDuffColorFilter filter = new PorterDuffColorFilter(
47 | ViewUtils.fetchAccentColor(getContext()), PorterDuff.Mode.MULTIPLY);
48 | ContextCompat.getDrawable(getContext(), R.drawable.email_icon).setColorFilter(filter);
49 | ContextCompat.getDrawable(getContext(), R.drawable.password_icon).setColorFilter(filter);
50 | ContextCompat.getDrawable(getContext(), R.drawable.icn_show_pwd).setColorFilter(filter);
51 | ContextCompat.getDrawable(getContext(), R.drawable.ic_hide_pwd).setColorFilter(filter);
52 | }
53 |
54 | protected void setView(View view, List providerList) {
55 | // First set result resultListener for all providers
56 | for (BaseProvider provider : providerList) {
57 | provider.setResultListener(this);
58 |
59 | View containerView = view.findViewById(provider.getContainerId());
60 | if (containerView == null || !(containerView instanceof ViewGroup)) {
61 | throw new RuntimeException("Did you forget to define container in your layout");
62 | }
63 |
64 | ((ViewGroup) containerView)
65 | .addView(provider.providerView(this, (ViewGroup) containerView));
66 | }
67 |
68 | ViewGroup viewGroup = (ViewGroup) view.findViewById(R.id.container_social);
69 | if (viewGroup != null) {
70 | if (viewGroup.getChildCount() == 0) {
71 | if (view.findViewById(R.id.tv_social_header) != null) {
72 | view.findViewById(R.id.tv_social_header).setVisibility(View.GONE);
73 | }
74 | }
75 | }
76 | }
77 |
78 | @Override
79 | public void onSuccess(ArgusState argusState) {
80 | resultListener.onSuccess(argusState);
81 | }
82 |
83 | @Override
84 | public void onFailure(String message) {
85 | resultListener.onFailure(message);
86 | }
87 |
88 | @Override
89 | public void onAttach(Context context) {
90 | super.onAttach(context);
91 | if (context instanceof ResultListener) {
92 | resultListener = (ResultListener) context;
93 | } else {
94 | throw new RuntimeException(context.toString() + " must implement ResultListener");
95 | }
96 | }
97 |
98 | @Override
99 | public void onDetach() {
100 | super.onDetach();
101 | resultListener = null;
102 | }
103 |
104 | @Override
105 | public void onActivityResult(int requestCode, int resultCode, Intent data) {
106 | super.onActivityResult(requestCode, resultCode, data);
107 | onProviderActivityResult(requestCode, resultCode, data, getProviders());
108 | }
109 |
110 | protected void onProviderActivityResult(int requestCode, int resultCode, Intent data,
111 | List
112 | providerList) {
113 | for (BaseProvider provider : providerList) {
114 | provider.onActivityResult(requestCode, resultCode, data);
115 | }
116 | }
117 |
118 | protected abstract int getLayoutId();
119 |
120 | protected abstract List getProviders();
121 |
122 | }
123 |
--------------------------------------------------------------------------------
/argus/src/main/java/com/moldedbits/argus/ForgotPasswordFragment.java:
--------------------------------------------------------------------------------
1 | package com.moldedbits.argus;
2 |
3 |
4 | import android.content.Context;
5 | import android.os.Bundle;
6 | import android.support.annotation.Nullable;
7 | import android.support.v4.app.Fragment;
8 | import android.view.LayoutInflater;
9 | import android.view.View;
10 | import android.view.ViewGroup;
11 |
12 | import com.moldedbits.argus.listener.ResultListener;
13 | import com.moldedbits.argus.provider.BaseProvider;
14 |
15 | public class ForgotPasswordFragment extends Fragment implements ResultListener {
16 |
17 | private ResultListener resultListener;
18 |
19 | public static ForgotPasswordFragment newInstance() {
20 | return new ForgotPasswordFragment();
21 | }
22 |
23 | @Nullable
24 | @Override
25 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
26 | @Nullable Bundle savedInstanceState) {
27 | View view = inflater.inflate(getLayoutId(), container, false);
28 | BaseProvider provider = Argus.getInstance().getForgotPasswordProvider();
29 | provider.setResultListener(this);
30 | View containerView = view.findViewById(provider.getContainerId());
31 | if (containerView == null || !(containerView instanceof ViewGroup)) {
32 | throw new RuntimeException("Did you forget to define container in your layout");
33 | }
34 |
35 | ((ViewGroup) view)
36 | .addView(provider.providerView(this, (ViewGroup) containerView));
37 | return containerView;
38 | }
39 |
40 | @Override
41 | public void onSuccess(ArgusState argusState) {
42 | resultListener.onSuccess(argusState);
43 | }
44 |
45 | @Override
46 | public void onFailure(String message) {
47 | resultListener.onFailure(message);
48 | }
49 |
50 | @Override
51 | public void onAttach(Context context) {
52 | super.onAttach(context);
53 | if (context instanceof ResultListener) {
54 | resultListener = (ResultListener) context;
55 | } else {
56 | throw new RuntimeException(context.toString() + " must implement ResultListener");
57 | }
58 | }
59 |
60 | @Override
61 | public void onDetach() {
62 | super.onDetach();
63 | resultListener = null;
64 | }
65 |
66 | private int getLayoutId() {
67 | if (Argus.getInstance().getForgotPasswordLayout() != 0) {
68 | return Argus.getInstance().getLoginLayout();
69 | }
70 | return R.layout.fragment_forgot_password;
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/argus/src/main/java/com/moldedbits/argus/LoginFragment.java:
--------------------------------------------------------------------------------
1 | package com.moldedbits.argus;
2 |
3 | import android.os.Bundle;
4 | import android.text.TextUtils;
5 | import android.view.LayoutInflater;
6 | import android.view.View;
7 | import android.view.ViewGroup;
8 | import android.widget.TextView;
9 |
10 | import com.moldedbits.argus.provider.BaseProvider;
11 |
12 | import java.util.List;
13 |
14 | /**
15 | * Login Fragment
16 | */
17 | public class LoginFragment extends BaseFragment {
18 |
19 | public static LoginFragment newInstance() {
20 | LoginFragment fragment = new LoginFragment();
21 | Bundle args = new Bundle();
22 | fragment.setArguments(args);
23 | return fragment;
24 | }
25 |
26 | @Override
27 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
28 | View rootView = super.onCreateView(inflater, container, savedInstanceState);
29 | if (Argus.getInstance().getSignupProviders() == null && rootView != null) {
30 | View view2 = rootView.findViewById(R.id.tv_dont_have_account);
31 | if (view2 != null) {
32 | view2.setVisibility(View.GONE);
33 | }
34 | }
35 | if (rootView != null) {
36 | if (Argus.getInstance().isSkipLoginEnable()) {
37 | TextView textView = (TextView) rootView.findViewById(R.id.tv_skip_login);
38 | if (textView != null) {
39 | String skipText = Argus.getInstance().getSkipLoginText();
40 | if (Argus.getInstance().isSkipLoginEnable()) {
41 | if (!TextUtils.isEmpty(skipText)) {
42 | textView.setText(skipText);
43 | }
44 | }
45 | textView.setVisibility(View.VISIBLE);
46 | setSkipClick(textView);
47 | }
48 | }
49 | }
50 | return rootView;
51 | }
52 |
53 | private void setSkipClick(TextView textView) {
54 | textView.setOnClickListener(new View.OnClickListener() {
55 | @Override
56 | public void onClick(View v) {
57 | onSkipLogin();
58 | }
59 | });
60 | }
61 |
62 | public void onSkipLogin() {
63 | //TODO if needed other activity for this we can also do that later
64 | startActivity(Argus.getInstance().getNextScreenProvider().getNextScreen(getActivity()));
65 | getActivity().finish();
66 | }
67 |
68 | public int getLayoutId() {
69 | if (Argus.getInstance().getLoginLayout() != 0) {
70 | return Argus.getInstance().getLoginLayout();
71 | }
72 | return R.layout.fragment_login;
73 | }
74 |
75 | @Override
76 | protected List getProviders() {
77 | return Argus.getInstance().getLoginProviders();
78 | }
79 | }
80 |
--------------------------------------------------------------------------------
/argus/src/main/java/com/moldedbits/argus/SignupFragment.java:
--------------------------------------------------------------------------------
1 | package com.moldedbits.argus;
2 |
3 | import com.moldedbits.argus.provider.BaseProvider;
4 |
5 | import java.util.List;
6 |
7 | public class SignupFragment extends BaseFragment {
8 |
9 | public static SignupFragment newInstance() {
10 | return new SignupFragment();
11 | }
12 |
13 |
14 | @Override
15 | protected int getLayoutId() {
16 | if (Argus.getInstance().getSignupLayout() != 0) {
17 | return Argus.getInstance().getSignupLayout();
18 | }
19 | return R.layout.fragment_signup;
20 | }
21 |
22 | @Override
23 | protected List getProviders() {
24 | return Argus.getInstance().getSignupProviders();
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/argus/src/main/java/com/moldedbits/argus/handler/ThemeHelper.java:
--------------------------------------------------------------------------------
1 | package com.moldedbits.argus.handler;
2 |
3 | import android.text.TextUtils;
4 | import android.view.View;
5 | import android.widget.Button;
6 | import android.widget.TextView;
7 |
8 | import com.moldedbits.argus.ArgusTheme;
9 | import com.moldedbits.argus.R;
10 |
11 | /**
12 | * Helper for theme related handling of Argus Login and SignUp Providers
13 | */
14 | public class ThemeHelper {
15 |
16 | public void applyTheme(View view, ArgusTheme theme) {
17 | TextView welcomeTv = (TextView) view.findViewById(R.id.tv_welcome_text);
18 | if (welcomeTv != null && !TextUtils.isEmpty(theme.getWelcomeText())) {
19 | if (theme.getWelcomeTextVisibility() == View.VISIBLE) {
20 | welcomeTv.setVisibility(View.VISIBLE);
21 | welcomeTv.setText(theme.getWelcomeText());
22 | welcomeTv.setTextSize(theme.getWelcomeTextSize());
23 | welcomeTv.setTextColor(theme.getWelcomeTextColor());
24 | } else {
25 | welcomeTv.setVisibility(View.GONE);
26 | }
27 | }
28 |
29 | if (theme.getButtonDrawable() != 0) {
30 | Button actionButton = (Button) view.findViewById(R.id.action_button);
31 | if (actionButton != null) {
32 | actionButton.setBackgroundResource(theme.getButtonDrawable());
33 | }
34 | }
35 |
36 | if (!theme.isShowEditTextDrawables()) {
37 | View emailIv = view.findViewById(R.id.iv_email_et);
38 | if (emailIv != null) {
39 | emailIv.setVisibility(View.GONE);
40 | }
41 |
42 | View passwordIv = view.findViewById(R.id.iv_password_et);
43 | if (passwordIv != null) {
44 | passwordIv.setVisibility(View.GONE);
45 | }
46 | }
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/argus/src/main/java/com/moldedbits/argus/listener/ResultListener.java:
--------------------------------------------------------------------------------
1 | package com.moldedbits.argus.listener;
2 |
3 | import com.moldedbits.argus.ArgusState;
4 |
5 | public interface ResultListener {
6 | void onSuccess(ArgusState argusState);
7 |
8 | void onFailure(String message);
9 | }
10 |
--------------------------------------------------------------------------------
/argus/src/main/java/com/moldedbits/argus/logger/ArgusLogger.java:
--------------------------------------------------------------------------------
1 | package com.moldedbits.argus.logger;
2 |
3 | import android.util.Log;
4 |
5 | /**
6 | * Created by abhishek
7 | * on 10/05/17.
8 | */
9 |
10 | // TODO: 10/05/17 define log levels and log as per current log level
11 | public final class ArgusLogger {
12 | // no need to create an object
13 | private ArgusLogger(){}
14 |
15 | public static void d(String tag, String message) {
16 | Log.d(tag, message);
17 | }
18 |
19 | public static void w(String tag, String message) {
20 | Log.w(tag, message);
21 | }
22 |
23 | public static void e(String tag, String message) {
24 | Log.e(tag, message);
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/argus/src/main/java/com/moldedbits/argus/nextscreenproviders/IntentNextScreenProvider.java:
--------------------------------------------------------------------------------
1 | package com.moldedbits.argus.nextscreenproviders;
2 |
3 | import android.content.Context;
4 | import android.content.Intent;
5 |
6 | /**
7 | * Created by abhishek
8 | * on 20/06/17.
9 | */
10 |
11 | public class IntentNextScreenProvider implements NextScreenProvider {
12 | private Intent intent;
13 |
14 | public IntentNextScreenProvider(Intent intent) {
15 | this.intent = intent;
16 | }
17 |
18 | @Override
19 | public Intent getNextScreen(Context context) {
20 | return intent;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/argus/src/main/java/com/moldedbits/argus/nextscreenproviders/NextScreenProvider.java:
--------------------------------------------------------------------------------
1 | package com.moldedbits.argus.nextscreenproviders;
2 |
3 | import android.content.Context;
4 | import android.content.Intent;
5 |
6 | /**
7 | * Provide the first screen to launch after logging in
8 | */
9 |
10 | public interface NextScreenProvider {
11 |
12 | Intent getNextScreen(Context context);
13 | }
14 |
--------------------------------------------------------------------------------
/argus/src/main/java/com/moldedbits/argus/nextscreenproviders/SimpleNextScreenProvider.java:
--------------------------------------------------------------------------------
1 | package com.moldedbits.argus.nextscreenproviders;
2 |
3 | import android.content.Context;
4 | import android.content.Intent;
5 |
6 | public class SimpleNextScreenProvider implements NextScreenProvider {
7 |
8 | private Class nextScreen;
9 |
10 | public SimpleNextScreenProvider(Class nextScreen) {
11 | this.nextScreen = nextScreen;
12 | }
13 |
14 | @Override
15 | public Intent getNextScreen(Context context) {
16 | return new Intent(context, nextScreen);
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/argus/src/main/java/com/moldedbits/argus/provider/BaseProvider.java:
--------------------------------------------------------------------------------
1 | package com.moldedbits.argus.provider;
2 |
3 | import android.app.ProgressDialog;
4 | import android.content.Context;
5 | import android.content.Intent;
6 | import android.support.annotation.Nullable;
7 | import android.support.v4.app.Fragment;
8 | import android.view.View;
9 | import android.view.ViewGroup;
10 |
11 | import com.moldedbits.argus.ArgusTheme;
12 | import com.moldedbits.argus.R;
13 | import com.moldedbits.argus.handler.ThemeHelper;
14 | import com.moldedbits.argus.listener.ResultListener;
15 | import com.moldedbits.argus.validations.ValidationEngine;
16 |
17 | import lombok.Getter;
18 | import lombok.Setter;
19 |
20 | /**
21 | * Provides login functionality for specific end point
22 | */
23 | public abstract class BaseProvider {
24 |
25 | private static final int DEFAULT_CONTAINER_ID = -1;
26 |
27 | @Nullable
28 | protected Context context;
29 |
30 | @Nullable
31 | @Setter
32 | protected ResultListener resultListener;
33 |
34 | protected Fragment fragment;
35 |
36 | @Getter
37 | protected ValidationEngine validationEngine;
38 | protected ArgusTheme theme;
39 | protected ThemeHelper themeHelper;
40 | private ProgressDialog progressDialog;
41 |
42 | /**
43 | * Provide the login view which will be shown on the login screen for this provider
44 | *
45 | * @param fragment Login fragment. This is needed to inject activity result callbacks
46 | * @param parentView Parent view in which this view will be inflated.
47 | * @return Inflated view to be shown on screen
48 | */
49 | public View providerView(Fragment fragment, ViewGroup parentView) {
50 | this.context = fragment.getContext();
51 | this.fragment = fragment;
52 |
53 | themeHelper = new ThemeHelper();
54 |
55 | View view = inflateView(parentView);
56 | View actionView = view.findViewById(getActionButtonId());
57 | if (actionView == null) {
58 | throw new RuntimeException("BaseProvider view needs a button with id R.id.login");
59 | }
60 |
61 | view.findViewById(getActionButtonId()).setOnClickListener(new View.OnClickListener() {
62 | @Override
63 | public void onClick(View v) {
64 | performAction();
65 | }
66 | });
67 |
68 | return view;
69 | }
70 |
71 | /**
72 | * Override this if you want a custom id for your login button
73 | *
74 | * @return Login button id
75 | */
76 | protected int getActionButtonId() {
77 | return R.id.action_button;
78 | }
79 |
80 | /**
81 | * Override this if you want to listen to the onActivityResult of the parent fragment
82 | */
83 | public void onActivityResult(int requestCode, int resultCode, Intent data) {
84 | }
85 |
86 | /**
87 | * Inflate your login view here
88 | *
89 | * @param parentView Parent view
90 | * @return Inflated view
91 | */
92 | abstract protected View inflateView(ViewGroup parentView);
93 |
94 | /**
95 | * Perform login here. Implementations should take care of showing loading overlay to block
96 | * out UI
97 | */
98 | protected abstract void performAction();
99 |
100 | public int getContainerId() {
101 | return DEFAULT_CONTAINER_ID;
102 | }
103 |
104 | public boolean isInProgress() {
105 | return false;
106 | }
107 |
108 | protected void showProgressDialog(String message) {
109 | hideProgressDialog();
110 | progressDialog = new ProgressDialog(context);
111 | progressDialog.setMessage(message);
112 | progressDialog.setCancelable(false);
113 | progressDialog.setCanceledOnTouchOutside(false);
114 | progressDialog.show();
115 | }
116 |
117 | protected void hideProgressDialog() {
118 | if (progressDialog != null && progressDialog.isShowing()) {
119 | progressDialog.dismiss();
120 | }
121 | }
122 | }
123 |
--------------------------------------------------------------------------------
/argus/src/main/java/com/moldedbits/argus/provider/ForgotPasswordProvider.java:
--------------------------------------------------------------------------------
1 | package com.moldedbits.argus.provider;
2 |
3 | import android.support.design.widget.Snackbar;
4 | import android.util.Patterns;
5 | import android.view.LayoutInflater;
6 | import android.view.View;
7 | import android.view.ViewGroup;
8 | import android.widget.Button;
9 | import android.widget.EditText;
10 | import android.widget.TextView;
11 |
12 | import com.moldedbits.argus.Argus;
13 | import com.moldedbits.argus.ArgusTheme;
14 | import com.moldedbits.argus.R;
15 | import com.moldedbits.argus.logger.ArgusLogger;
16 | import com.moldedbits.argus.validations.RegexValidation;
17 | import com.moldedbits.argus.validations.ValidationEngine;
18 |
19 | import static com.facebook.login.widget.ProfilePictureView.TAG;
20 |
21 |
22 | public abstract class ForgotPasswordProvider extends BaseProvider {
23 |
24 | private EditText emailInput;
25 |
26 | public ForgotPasswordProvider() {
27 | validationEngine = new ValidationEngine();
28 | }
29 |
30 | @Override
31 | protected View inflateView(ViewGroup parentView) {
32 | if (context == null)
33 | return null;
34 |
35 | getValidationEngine().addEmailValidation(new RegexValidation(
36 | Patterns.EMAIL_ADDRESS.pattern(), context.getString(R.string.invalid_email)));
37 |
38 | if (context != null) {
39 | View forgotPasswordView = LayoutInflater.from(context)
40 | .inflate(R.layout.forgot_password, parentView, false);
41 |
42 | emailInput = (EditText) forgotPasswordView.findViewById(R.id.email);
43 | applyTheme(forgotPasswordView);
44 |
45 | return forgotPasswordView;
46 | } else {
47 | throw new RuntimeException("Context cannot be null");
48 | }
49 | }
50 |
51 | private void applyTheme(View view) {
52 | ArgusTheme theme = Argus.getInstance().getArgusTheme();
53 |
54 | if(theme.getButtonDrawable() != 0) {
55 | Button actionButton = (Button) view.findViewById(R.id.action_button);
56 | if(actionButton != null) {
57 | actionButton.setBackgroundResource(theme.getButtonDrawable());
58 | }
59 | }
60 | }
61 |
62 | @Override
63 | protected void performAction() {
64 | if (validate()) {
65 | sendPasswordResetEmail(emailInput.getText().toString());
66 | }
67 | }
68 |
69 | private boolean validate() {
70 | if (validationEngine == null) {
71 | ArgusLogger.w(TAG, "ValidationEngine is null not validating Email field");
72 | return true;
73 | }
74 |
75 | return ValidationEngine.validateEditText(emailInput, validationEngine);
76 | }
77 |
78 | @Override
79 | public int getContainerId() {
80 | return R.id.container_forgot_password;
81 | }
82 |
83 | public abstract void sendPasswordResetEmail(String email);
84 |
85 | protected void showSuccessDialog(String s) {
86 | //TODO need to create dialogbox or can be override in app dialog according to app.
87 | Snackbar snackbar = Snackbar.make(emailInput, s, Snackbar.LENGTH_SHORT);
88 | View view = snackbar.getView();
89 | TextView textView= (TextView) view.findViewById(android.support.design.R.id.snackbar_text);
90 | textView.setMaxLines(5);
91 | snackbar.show();
92 | }
93 |
94 | //Made the snackbar view 2 lines so it can handle lengthy error messages from server
95 | protected void showFailureDialog(String s) {
96 | //TODO need to create dialog box for handling error messages
97 | Snackbar snackbar = Snackbar.make(emailInput, s, Snackbar.LENGTH_SHORT);
98 | View view = snackbar.getView();
99 | TextView textView= (TextView) view.findViewById(android.support.design.R.id.snackbar_text);
100 | textView.setMaxLines(2);
101 | snackbar.show();
102 | }
103 | }
104 |
--------------------------------------------------------------------------------
/argus/src/main/java/com/moldedbits/argus/provider/login/EmailLoginProvider.java:
--------------------------------------------------------------------------------
1 | package com.moldedbits.argus.provider.login;
2 |
3 | import android.support.annotation.Nullable;
4 | import android.text.method.PasswordTransformationMethod;
5 | import android.util.Patterns;
6 | import android.view.LayoutInflater;
7 | import android.view.View;
8 | import android.view.ViewGroup;
9 | import android.widget.EditText;
10 | import android.widget.ImageView;
11 |
12 | import com.moldedbits.argus.Argus;
13 | import com.moldedbits.argus.ForgotPasswordFragment;
14 | import com.moldedbits.argus.R;
15 | import com.moldedbits.argus.logger.ArgusLogger;
16 | import com.moldedbits.argus.provider.BaseProvider;
17 | import com.moldedbits.argus.validations.RegexValidation;
18 | import com.moldedbits.argus.validations.ValidationEngine;
19 |
20 | import lombok.Setter;
21 |
22 | /**
23 | * Allow user to login with email and password
24 | */
25 | public abstract class EmailLoginProvider extends BaseProvider {
26 |
27 | private static final String TAG = "EmailLoginProvider";
28 |
29 | private EditText usernameInput;
30 | private EditText passwordInput;
31 | private ImageView ivShowPassword;
32 |
33 | @Setter
34 | private boolean showPasswordEnabled;
35 |
36 | public EmailLoginProvider() {
37 | validationEngine = new ValidationEngine();
38 | }
39 |
40 | @Nullable
41 | @Override
42 | public View inflateView(ViewGroup parentView) {
43 | getValidationEngine()
44 | .addEmailValidation(new RegexValidation(Patterns.EMAIL_ADDRESS.pattern(),
45 | context.getString(R.string.invalid_email)));
46 |
47 | if (context != null) {
48 | View loginView = LayoutInflater.from(context)
49 | .inflate(R.layout.login_email, parentView, false);
50 |
51 | usernameInput = (EditText) loginView.findViewById(R.id.username);
52 | passwordInput = (EditText) loginView.findViewById(R.id.password);
53 |
54 | if (showPasswordEnabled) {
55 | ivShowPassword = (ImageView) loginView.findViewById(R.id.iv_show_pwd);
56 | ivShowPassword.setVisibility(View.VISIBLE);
57 | if (ivShowPassword != null) {
58 | ivShowPassword.setOnClickListener(new View.OnClickListener() {
59 | @Override
60 | public void onClick(View v) {
61 | toggleShowPwd();
62 | }
63 | });
64 | }
65 | }
66 |
67 | if (Argus.getInstance().getForgotPasswordProvider() == null) {
68 | loginView.findViewById(R.id.tv_forgot_password).setVisibility(View.GONE);
69 | } else {
70 | loginView.findViewById(R.id.tv_forgot_password).setOnClickListener(
71 | new View.OnClickListener() {
72 | @Override
73 | public void onClick(View v) {
74 | showForgotPasswordFragment();
75 | }
76 | });
77 | }
78 |
79 | theme = Argus.getInstance().getArgusTheme();
80 |
81 | themeHelper.applyTheme(loginView, theme);
82 |
83 | return loginView;
84 | } else {
85 | throw new RuntimeException("Context cannot be null");
86 | }
87 | }
88 |
89 | @Override
90 | public void performAction() {
91 | if (validateInput() && resultListener != null) {
92 | doServerLogin(usernameInput.getText().toString(), passwordInput.getText().toString());
93 | }
94 | }
95 |
96 | private boolean validateInput() {
97 | if (validationEngine == null) {
98 | ArgusLogger.w(TAG, "ValidationEngine is null not validating SignUp form");
99 | return true;
100 | }
101 |
102 | // we want to run all validations
103 | boolean result1 = ValidationEngine.validateEditText(usernameInput, validationEngine);
104 | boolean result2 = ValidationEngine.validateEditText(passwordInput, validationEngine);
105 |
106 | return result1 && result2;
107 | }
108 |
109 | @Override
110 | public int getContainerId() {
111 | return R.id.container_email;
112 | }
113 |
114 | protected abstract void doServerLogin(String username, String password);
115 |
116 | private void showForgotPasswordFragment() {
117 | fragment.getFragmentManager()
118 | .beginTransaction()
119 | .replace(R.id.argus_content, ForgotPasswordFragment.newInstance())
120 | .commit();
121 | }
122 |
123 | protected void toggleShowPwd() {
124 | if (passwordInput.getTransformationMethod() != null) {
125 | passwordInput.setTransformationMethod(null);
126 | passwordInput.setSelection(passwordInput.getText().length());
127 | ivShowPassword.setImageResource(R.drawable.ic_hide_pwd);
128 | } else {
129 | passwordInput.setTransformationMethod(new PasswordTransformationMethod());
130 | passwordInput.setSelection(passwordInput.getText().length());
131 | ivShowPassword.setImageResource(R.drawable.icn_show_pwd);
132 | }
133 | }
134 | }
135 |
--------------------------------------------------------------------------------
/argus/src/main/java/com/moldedbits/argus/provider/signup/EmailSignupProvider.java:
--------------------------------------------------------------------------------
1 | package com.moldedbits.argus.provider.signup;
2 |
3 | import android.content.Intent;
4 | import android.util.Patterns;
5 | import android.view.LayoutInflater;
6 | import android.view.View;
7 | import android.view.ViewGroup;
8 | import android.widget.EditText;
9 | import android.widget.TextView;
10 |
11 | import com.moldedbits.argus.Argus;
12 | import com.moldedbits.argus.ArgusState;
13 | import com.moldedbits.argus.R;
14 | import com.moldedbits.argus.logger.ArgusLogger;
15 | import com.moldedbits.argus.provider.BaseProvider;
16 | import com.moldedbits.argus.validations.RegexValidation;
17 | import com.moldedbits.argus.validations.ValidationEngine;
18 |
19 | public abstract class EmailSignupProvider extends BaseProvider {
20 |
21 | private static final String TAG = "EmailSignupProvider";
22 | private static final String KEY_STATE = "email_signup_provider_state";
23 |
24 | private EditText usernameEt;
25 | private EditText emailEt;
26 | private EditText passwordEt;
27 | private TextView welcomeTv;
28 | private boolean isValidationRequired;
29 |
30 | public EmailSignupProvider(boolean isValidationRequired) {
31 | this.isValidationRequired = isValidationRequired;
32 | validationEngine = new ValidationEngine();
33 | }
34 |
35 | @Override
36 | protected void performAction() {
37 | if (validate()) {
38 | doServerSignup(usernameEt.getText().toString(), emailEt.getText().toString(),
39 | passwordEt.getText().toString());
40 | }
41 | }
42 |
43 | @Override
44 | protected View inflateView(ViewGroup parentView) {
45 | if (context != null) {
46 | getValidationEngine()
47 | .addEmailValidation(new RegexValidation(Patterns.EMAIL_ADDRESS.pattern(),
48 | context.getString(
49 | R.string.invalid_email)));
50 | }
51 |
52 | View signUpView = LayoutInflater.from(context)
53 | .inflate(R.layout.signup_email, parentView, false);
54 | usernameEt = (EditText) signUpView.findViewById(R.id.username);
55 | emailEt = (EditText) signUpView.findViewById(R.id.email);
56 | passwordEt = (EditText) signUpView.findViewById(R.id.password);
57 | welcomeTv = (TextView) signUpView.findViewById(R.id.tv_welcome_text);
58 |
59 | theme = Argus.getInstance().getArgusTheme();
60 |
61 | themeHelper.applyTheme(signUpView, theme);
62 | return signUpView;
63 | }
64 |
65 | private boolean validate() {
66 | if (validationEngine == null) {
67 | ArgusLogger.w(TAG, "ValidationEngine is null not validating SignUp form");
68 | return true;
69 | }
70 |
71 | // we want to run all validations
72 | boolean result1 = ValidationEngine.validateEditText(usernameEt, validationEngine);
73 | boolean result2 = ValidationEngine.validateEditText(passwordEt, validationEngine);
74 | boolean result3 = ValidationEngine.validateEditText(emailEt, validationEngine);
75 |
76 | return result1 && result2 && result3;
77 | }
78 |
79 | @Override
80 | public int getContainerId() {
81 | return R.id.container_email;
82 | }
83 |
84 |
85 | private void startValidationActivity() {
86 | fragment.startActivity(new Intent(fragment.getActivity(), ValidationActivity.class));
87 | }
88 |
89 | protected void onSignupSuccess() {
90 | if (isValidationRequired) {
91 | startValidationActivity();
92 | return;
93 | }
94 | if (resultListener != null) {
95 | resultListener.onSuccess(ArgusState.SIGNED_IN);
96 | }
97 | }
98 |
99 | public abstract void doServerSignup(String username, String email, String password);
100 | }
101 |
--------------------------------------------------------------------------------
/argus/src/main/java/com/moldedbits/argus/provider/signup/EmailVerificationFragment.java:
--------------------------------------------------------------------------------
1 | package com.moldedbits.argus.provider.signup;
2 |
3 | import android.os.Bundle;
4 | import android.support.annotation.Nullable;
5 | import android.support.v4.app.Fragment;
6 | import android.view.LayoutInflater;
7 | import android.view.View;
8 | import android.view.ViewGroup;
9 |
10 | import com.moldedbits.argus.R;
11 |
12 |
13 | public class EmailVerificationFragment extends Fragment {
14 |
15 |
16 | public static EmailVerificationFragment newInstance() {
17 | return new EmailVerificationFragment();
18 | }
19 |
20 | @Nullable
21 | @Override
22 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
23 | @Nullable Bundle savedInstanceState) {
24 | return inflater.inflate(R.layout.fragment_email_verification, container, false);
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/argus/src/main/java/com/moldedbits/argus/provider/signup/ValidationActivity.java:
--------------------------------------------------------------------------------
1 | package com.moldedbits.argus.provider.signup;
2 |
3 | import android.os.Bundle;
4 | import android.support.v7.app.AppCompatActivity;
5 |
6 | import com.moldedbits.argus.R;
7 |
8 | public class ValidationActivity extends AppCompatActivity {
9 |
10 | @Override
11 | protected void onCreate(Bundle savedInstanceState) {
12 | super.onCreate(savedInstanceState);
13 | setContentView(R.layout.activity_argus);
14 | showProgressFragment();
15 | }
16 |
17 | private void showProgressFragment() {
18 | EmailVerificationFragment emailVerificationFragment = EmailVerificationFragment
19 | .newInstance();
20 | getSupportFragmentManager()
21 | .beginTransaction()
22 | .replace(R.id.argus_content, emailVerificationFragment)
23 | .commit();
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/argus/src/main/java/com/moldedbits/argus/provider/social/FacebookOnBoardingProvider.java:
--------------------------------------------------------------------------------
1 | package com.moldedbits.argus.provider.social;
2 |
3 | import android.content.Intent;
4 | import android.view.LayoutInflater;
5 | import android.view.View;
6 | import android.view.ViewGroup;
7 |
8 | import com.facebook.AccessToken;
9 | import com.moldedbits.argus.ArgusState;
10 | import com.moldedbits.argus.R;
11 | import com.moldedbits.argus.provider.BaseProvider;
12 | import com.moldedbits.argus.provider.social.helper.FacebookConfig;
13 | import com.moldedbits.argus.provider.social.helper.FacebookHelper;
14 |
15 | import java.util.List;
16 |
17 | public class FacebookOnBoardingProvider extends BaseProvider
18 | implements FacebookHelper.FBLoginResultListener {
19 |
20 | private FacebookHelper facebookHelper;
21 |
22 | /**
23 | * This is used to set permissions for facebook token and if no permissions are set then default
24 | * "public_profile" will be used to generate the token.
25 | */
26 | private FacebookConfig facebookConfig;
27 |
28 | public FacebookOnBoardingProvider() {
29 | facebookHelper = new FacebookHelper(this);
30 | facebookHelper.initialize();
31 | facebookConfig = new FacebookConfig();
32 | }
33 |
34 | @Override
35 | protected void performAction() {
36 | List permissionList = facebookConfig.getFaceBookPermissions();
37 | if (permissionList == null || permissionList.size() == 0) {
38 | facebookConfig.getFaceBookPermissions().add(FacebookConfig.PUBLIC_PROFILE);
39 | facebookHelper.initiateLogin(fragment, facebookConfig.getFaceBookPermissions());
40 | } else {
41 | facebookHelper.initiateLogin(fragment, permissionList);
42 | }
43 | }
44 |
45 | @Override
46 | protected View inflateView(ViewGroup parentView) {
47 | return LayoutInflater.from(context)
48 | .inflate(R.layout.facebook_signup, parentView, false);
49 | }
50 |
51 | @Override
52 | public void onActivityResult(int requestCode, int resultCode, Intent data) {
53 | super.onActivityResult(requestCode, resultCode, data);
54 | facebookHelper.onActivityResult(requestCode, resultCode, data);
55 | }
56 |
57 | @Override
58 | public int getContainerId() {
59 | return R.id.container_social;
60 | }
61 |
62 | @Override
63 | public void onSuccess(AccessToken token) {
64 | if (resultListener != null) {
65 | resultListener.onSuccess(ArgusState.SIGNED_IN);
66 | }
67 | }
68 |
69 | @Override
70 | public void onFailure(String message) {
71 | if (resultListener != null) {
72 | resultListener.onFailure(message);
73 | }
74 | }
75 |
76 | public void setFacebookPermission(List permissionList) {
77 | facebookConfig.setFaceBookPermissions(permissionList);
78 | }
79 | }
80 |
--------------------------------------------------------------------------------
/argus/src/main/java/com/moldedbits/argus/provider/social/GoogleOnBoardingProvider.java:
--------------------------------------------------------------------------------
1 | package com.moldedbits.argus.provider.social;
2 |
3 | import android.content.Intent;
4 | import android.text.TextUtils;
5 | import android.view.LayoutInflater;
6 | import android.view.View;
7 | import android.view.ViewGroup;
8 |
9 | import com.google.android.gms.auth.api.signin.GoogleSignInAccount;
10 | import com.moldedbits.argus.ArgusState;
11 | import com.moldedbits.argus.R;
12 | import com.moldedbits.argus.provider.BaseProvider;
13 | import com.moldedbits.argus.provider.social.helper.GoogleHelper;
14 |
15 | import lombok.Getter;
16 |
17 | public class GoogleOnBoardingProvider extends BaseProvider
18 | implements GoogleHelper.GoogleLoginResultListener {
19 |
20 | private GoogleHelper googleHelper;
21 |
22 |
23 | /**
24 | * This is Web Client ID autogenerated by google console when the configuration files are generated
25 | * for google login in the application and it will be used to generate a token which can be verified
26 | * on custom backend.
27 | */
28 | @Getter
29 | private String serverClientId;
30 |
31 | @Override
32 | protected void performAction() {
33 | googleHelper = new GoogleHelper(fragment, this);
34 |
35 | if (TextUtils.isEmpty(getServerClientId())) {
36 | googleHelper.initializeGoogleApiClient();
37 | } else {
38 | googleHelper.initializeGoogleApiClient(getServerClientId());
39 | }
40 | googleHelper.onSignInClicked();
41 | }
42 |
43 | @Override
44 | protected View inflateView(ViewGroup parentView) {
45 | return LayoutInflater.from(context).inflate(R.layout.google_signup, parentView, false);
46 | }
47 |
48 | @Override
49 | public void onActivityResult(int requestCode, int resultCode, Intent data) {
50 | super.onActivityResult(requestCode, resultCode, data);
51 | // Result returned from launching the Intent from GoogleSignInApi.getSignInIntent(...);
52 | if (requestCode == GoogleHelper.RC_SIGN_IN) {
53 | googleHelper.onActivityResult(requestCode, resultCode, data);
54 | }
55 | }
56 |
57 | @Override
58 | public int getContainerId() {
59 | return R.id.container_social;
60 | }
61 |
62 | @Override
63 | public void onSuccess(GoogleSignInAccount account) {
64 | if (resultListener != null) {
65 | resultListener.onSuccess(ArgusState.SIGNED_IN);
66 | }
67 | }
68 |
69 | @Override
70 | public void onFailure(String message) {
71 | if (resultListener != null) {
72 | resultListener.onFailure(message);
73 | }
74 | }
75 |
76 | public void setServerClientId(String serverClientId) {
77 | this.serverClientId = serverClientId;
78 | }
79 | }
80 |
--------------------------------------------------------------------------------
/argus/src/main/java/com/moldedbits/argus/provider/social/helper/FacebookConfig.java:
--------------------------------------------------------------------------------
1 | package com.moldedbits.argus.provider.social.helper;
2 |
3 | import java.util.ArrayList;
4 | import java.util.List;
5 |
6 | import lombok.Getter;
7 | import lombok.Setter;
8 |
9 | /*
10 | This class will set the permission need by user to login with facebook
11 | */
12 | public class FacebookConfig {
13 |
14 | public static final String PUBLIC_PROFILE = "public_profile";
15 | public static final String EMAIL = "email";
16 | public static final String USER_PHOTOS = "user_photos";
17 | public static final String USER_FRIENDS = "user_friends";
18 | public static final String USER_ABOUT_ME = "user_about_me";
19 | public static final String USER_BIRTHDAY = "user_birthday";
20 | public static final String USER_LOCATION = "user_location";
21 | public static final String USER_VIDEOS = "user_videos";
22 |
23 | @Getter
24 | @Setter
25 | public List faceBookPermissions;
26 |
27 | public FacebookConfig() {
28 | setDefaultPermission();
29 | }
30 |
31 | private void setDefaultPermission() {
32 | faceBookPermissions = new ArrayList<>();
33 | faceBookPermissions.add(PUBLIC_PROFILE);
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/argus/src/main/java/com/moldedbits/argus/provider/social/helper/FacebookHelper.java:
--------------------------------------------------------------------------------
1 | package com.moldedbits.argus.provider.social.helper;
2 |
3 |
4 | import android.content.Intent;
5 | import android.os.Bundle;
6 | import android.support.v4.app.Fragment;
7 |
8 | import com.facebook.AccessToken;
9 | import com.facebook.CallbackManager;
10 | import com.facebook.FacebookCallback;
11 | import com.facebook.FacebookException;
12 | import com.facebook.GraphRequest;
13 | import com.facebook.GraphResponse;
14 | import com.facebook.HttpMethod;
15 | import com.facebook.login.LoginManager;
16 | import com.facebook.login.LoginResult;
17 |
18 | import org.json.JSONObject;
19 |
20 | import java.util.List;
21 |
22 | public class FacebookHelper {
23 |
24 | private List facebookPermissions;
25 |
26 | public interface FBLoginResultListener {
27 | void onSuccess(AccessToken token);
28 |
29 | void onFailure(String message);
30 | }
31 |
32 | private AccessToken token;
33 | private CallbackManager callbackManager;
34 | private FBLoginResultListener resultListener;
35 |
36 | public FacebookHelper(FBLoginResultListener resultListener) {
37 | this.resultListener = resultListener;
38 | callbackManager = CallbackManager.Factory.create();
39 | }
40 |
41 | public void initialize() {
42 | LoginManager.getInstance()
43 | .registerCallback(callbackManager, new FacebookCallback() {
44 | @Override
45 | public void onSuccess(LoginResult loginResult) {
46 |
47 | GraphRequest graphRequest = GraphRequest
48 | .newMeRequest(loginResult.getAccessToken(),
49 | new GraphRequest.GraphJSONObjectCallback() {
50 | @Override
51 | public void onCompleted(JSONObject object,
52 | GraphResponse response) {
53 | token = AccessToken.getCurrentAccessToken();
54 | if (resultListener != null) {
55 | resultListener.onSuccess(token);
56 | }
57 | }
58 | });
59 | Bundle parameters = new Bundle();
60 | graphRequest.setParameters(parameters);
61 | graphRequest.executeAsync();
62 | }
63 |
64 | @Override
65 | public void onCancel() {
66 | }
67 |
68 | @Override
69 | public void onError(FacebookException error) {
70 | resultListener.onFailure(error.getMessage());
71 | }
72 | });
73 | }
74 |
75 |
76 | public void logout() {
77 | if (AccessToken.getCurrentAccessToken() == null) {
78 | return;
79 | // already logged out
80 | }
81 | new GraphRequest(AccessToken.getCurrentAccessToken(), "/me/permissions/",
82 | null, HttpMethod.DELETE, new GraphRequest
83 | .Callback() {
84 | @Override
85 | public void onCompleted(GraphResponse graphResponse) {
86 | LoginManager.getInstance().logOut();
87 | }
88 | }).executeAsync();
89 | }
90 |
91 | public void onActivityResult(int requestCode, int resultCode, Intent data) {
92 | callbackManager.onActivityResult(requestCode, resultCode, data);
93 | }
94 |
95 | public void initiateLogin(Fragment fragment, List faceBookPermissions) {
96 | this.facebookPermissions = faceBookPermissions;
97 | LoginManager.getInstance()
98 | .logInWithReadPermissions(fragment, faceBookPermissions);
99 | }
100 | }
101 |
102 |
--------------------------------------------------------------------------------
/argus/src/main/java/com/moldedbits/argus/provider/social/helper/GoogleHelper.java:
--------------------------------------------------------------------------------
1 | package com.moldedbits.argus.provider.social.helper;
2 |
3 | import android.content.Intent;
4 | import android.content.IntentSender;
5 | import android.os.Bundle;
6 | import android.support.v4.app.Fragment;
7 |
8 | import com.google.android.gms.auth.api.Auth;
9 | import com.google.android.gms.auth.api.signin.GoogleSignInAccount;
10 | import com.google.android.gms.auth.api.signin.GoogleSignInOptions;
11 | import com.google.android.gms.auth.api.signin.GoogleSignInResult;
12 | import com.google.android.gms.common.ConnectionResult;
13 | import com.google.android.gms.common.api.GoogleApiClient;
14 | import com.google.android.gms.common.api.ResultCallback;
15 | import com.google.android.gms.common.api.Status;
16 |
17 | public class GoogleHelper implements GoogleApiClient.ConnectionCallbacks,
18 | GoogleApiClient.OnConnectionFailedListener {
19 |
20 | public interface GoogleLoginResultListener {
21 | void onSuccess(GoogleSignInAccount account);
22 |
23 | void onFailure(String message);
24 | }
25 |
26 | public static final int RC_SIGN_IN = 10001;
27 | private Fragment fragment;
28 | private GoogleLoginResultListener listener;
29 | private GoogleApiClient googleApiClient = null;
30 | private boolean isResolving;
31 | private boolean shouldResolve;
32 | private Boolean mGooglePlusLogoutClicked;
33 |
34 | public GoogleHelper(Fragment fragment, GoogleLoginResultListener listener) {
35 | this.fragment = fragment;
36 | this.listener = listener;
37 | }
38 |
39 | /**
40 | * Initializing google api client when client id provided for token verification on a custom backend
41 | *
42 | * @param serverClientId It is a Web Client Id autocreated on
43 | * @see Google developer console on
44 | * creating project configuration.
45 | */
46 | public void initializeGoogleApiClient(String serverClientId) {
47 | GoogleSignInOptions gso = new GoogleSignInOptions.Builder(
48 | GoogleSignInOptions.DEFAULT_SIGN_IN)
49 | .requestProfile()
50 | .requestEmail()
51 | .requestIdToken(serverClientId)
52 | .build();
53 | googleApiClient = new GoogleApiClient.Builder(fragment.getContext())
54 | .addConnectionCallbacks(this)
55 | .addOnConnectionFailedListener(this)
56 | .addApi(Auth.GOOGLE_SIGN_IN_API, gso)
57 | .build();
58 | }
59 |
60 | /**
61 | * Initializing google api client if no client id provided
62 | * It will throw null pointer exception while requesting Id token from GoogleSignInAccount
63 | */
64 | public void initializeGoogleApiClient() {
65 | GoogleSignInOptions gso = new GoogleSignInOptions.Builder(
66 | GoogleSignInOptions.DEFAULT_SIGN_IN)
67 | .requestProfile()
68 | .requestEmail()
69 | .build();
70 | googleApiClient = new GoogleApiClient.Builder(fragment.getContext())
71 | .addConnectionCallbacks(this)
72 | .addOnConnectionFailedListener(this)
73 | .addApi(Auth.GOOGLE_SIGN_IN_API, gso)
74 | .build();
75 | }
76 |
77 | @Override
78 | public void onConnected(Bundle bundle) {
79 | if (mGooglePlusLogoutClicked != null && mGooglePlusLogoutClicked) {
80 | logOut();
81 | mGooglePlusLogoutClicked = false;
82 | }
83 | shouldResolve = false;
84 | }
85 |
86 | @Override
87 | public void onConnectionSuspended(int i) {
88 | }
89 |
90 | @Override
91 | public void onConnectionFailed(ConnectionResult connectionResult) {
92 |
93 | if (!isResolving && shouldResolve) {
94 | if (connectionResult.hasResolution()) {
95 | try {
96 | connectionResult.startResolutionForResult(fragment.getActivity(), RC_SIGN_IN);
97 | isResolving = true;
98 | } catch (IntentSender.SendIntentException e) {
99 | isResolving = false;
100 | googleApiClient.connect();
101 | }
102 | } else {
103 | showErrorDialog(connectionResult);
104 | }
105 | }
106 | }
107 |
108 | private void showErrorDialog(ConnectionResult connectionResult) {
109 | }
110 |
111 | private void connectClient() {
112 | googleApiClient.connect();
113 | }
114 |
115 | public void onSignInClicked() {
116 | shouldResolve = true;
117 | connectClient();
118 | Intent signInIntent = Auth.GoogleSignInApi.getSignInIntent(googleApiClient);
119 | fragment.startActivityForResult(signInIntent, RC_SIGN_IN);
120 | }
121 |
122 | private void logOut() {
123 | mGooglePlusLogoutClicked = true;
124 | if (googleApiClient.isConnected()) {
125 | Auth.GoogleSignInApi.signOut(googleApiClient)
126 | .setResultCallback(new ResultCallback() {
127 | @Override
128 | public void onResult(Status status) {
129 | //TODO handle logic for onlogout
130 | }
131 | });
132 | } else {
133 | googleApiClient.connect();
134 | }
135 | }
136 |
137 | private void handleSignInResult(GoogleSignInResult result) {
138 | if (result.isSuccess()) {
139 | // Signed in successfully, show authenticated UI.
140 | GoogleSignInAccount acct = result.getSignInAccount();
141 | if (acct != null) {
142 | listener.onSuccess(acct);
143 | } else {
144 | listener.onFailure("login failed");
145 | }
146 | } else {
147 | // Signed out, show unauthenticated UI.
148 | // TODO Show correct message
149 | listener.onFailure("Error");
150 | }
151 | }
152 |
153 | public void onActivityResult(int requestCode, int resultCode, Intent data) {
154 | GoogleSignInResult result = Auth.GoogleSignInApi.getSignInResultFromIntent(data);
155 | handleSignInResult(result);
156 | }
157 | }
--------------------------------------------------------------------------------
/argus/src/main/java/com/moldedbits/argus/storage/ArgusStorage.java:
--------------------------------------------------------------------------------
1 | package com.moldedbits.argus.storage;
2 |
3 | /**
4 | * Created by abhishek
5 | * on 04/05/17.
6 | * Custom user storage should implement this interface in order to be able to talk to Argus
7 | * There is a default implementation available @link{com.moldedbits.argus.storage.DefaultArgusStorage}
8 | */
9 | // TODO: 30/05/17 change this to something specific
10 | public interface ArgusStorage {
11 |
12 | void putString(String key, String value);
13 |
14 | String getString(String key, String defaultValue);
15 | }
16 |
--------------------------------------------------------------------------------
/argus/src/main/java/com/moldedbits/argus/storage/DefaultArgusStorage.java:
--------------------------------------------------------------------------------
1 | package com.moldedbits.argus.storage;
2 |
3 | import android.annotation.SuppressLint;
4 | import android.content.Context;
5 | import android.content.SharedPreferences;
6 | import android.content.SharedPreferences.Editor;
7 | import android.support.annotation.NonNull;
8 |
9 |
10 | public class DefaultArgusStorage implements ArgusStorage {
11 | private static final String ARGUS_PREFERENCES_STORE = "com.moldedbits.argus.sharedprefs";
12 | private static final String ARGUS_USER = "com.moldedbits.argus.argususer";
13 | private SharedPreferences mSharedPreferences = null;
14 |
15 | private Editor mSharedPreferencesEditor = null;
16 |
17 | public void clearPrefs() {
18 | mSharedPreferencesEditor.clear().commit();
19 | }
20 |
21 | @SuppressLint("CommitPrefEdits")
22 | public DefaultArgusStorage(@NonNull final Context context) {
23 | if(context == null) {
24 | throw new IllegalArgumentException("Context provided to storage is null");
25 | }
26 | mSharedPreferences = context.getSharedPreferences(ARGUS_PREFERENCES_STORE, 0); // 0 - for private mode
27 | mSharedPreferencesEditor = mSharedPreferences.edit();
28 | }
29 |
30 | @Override
31 | public void putString(String key, String value) {
32 | mSharedPreferencesEditor.putString(key, value).apply();
33 | }
34 |
35 | @Override
36 | public String getString(String key, String defaultValue) {
37 | return mSharedPreferences.getString(key, defaultValue);
38 | }
39 | }
--------------------------------------------------------------------------------
/argus/src/main/java/com/moldedbits/argus/utils/ViewUtils.java:
--------------------------------------------------------------------------------
1 | package com.moldedbits.argus.utils;
2 |
3 | import android.content.Context;
4 | import android.content.res.TypedArray;
5 | import android.util.TypedValue;
6 |
7 | import com.moldedbits.argus.R;
8 |
9 | /**
10 | * Created by abhishek
11 | * on 11/05/17.
12 | */
13 |
14 | public final class ViewUtils {
15 | // utility class fo not create an object
16 | private ViewUtils() {
17 | throw new RuntimeException("Not suppose to create an object of utility class");
18 | }
19 |
20 | // caching accent color
21 | private static int accentColor = -1;
22 | public static int fetchAccentColor(final Context context) {
23 | if(accentColor == -1) {
24 | TypedValue typedValue = new TypedValue();
25 | TypedArray a = context.obtainStyledAttributes(typedValue.data, new int[]{R.attr.colorAccent});
26 | accentColor = a.getColor(0, 0);
27 | a.recycle();
28 | }
29 |
30 | return accentColor;
31 | }
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/argus/src/main/java/com/moldedbits/argus/validations/AbstractValidation.java:
--------------------------------------------------------------------------------
1 | package com.moldedbits.argus.validations;
2 |
3 | /**
4 | * Created by abhishek
5 | * on 10/05/17.
6 | */
7 |
8 | public abstract class AbstractValidation implements Validation {
9 | private final String errorMessage;
10 |
11 | AbstractValidation(String errorMessage) {
12 | this.errorMessage = errorMessage;
13 | }
14 |
15 | @Override
16 | public String getErrorMessage() {
17 | return errorMessage;
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/argus/src/main/java/com/moldedbits/argus/validations/LengthValidation.java:
--------------------------------------------------------------------------------
1 | package com.moldedbits.argus.validations;
2 |
3 | import android.text.TextUtils;
4 |
5 | import lombok.Getter;
6 | import lombok.Setter;
7 |
8 | /**
9 | * Created by abhishek
10 | * on 09/05/17.
11 | */
12 |
13 | public class LengthValidation extends AbstractValidation {
14 | @Getter @Setter
15 | private int maxLength;
16 |
17 | @Getter @Setter
18 | private int minLength;
19 |
20 | public LengthValidation(int min, int max, String errorMessage) {
21 | super(errorMessage);
22 | if(min > max) {
23 | throw new IllegalArgumentException("Minimum length must be less than max value");
24 | }
25 |
26 | this.minLength = min;
27 | this.maxLength = max;
28 | }
29 |
30 | @Override
31 | public boolean validate(String str) {
32 | return isInCharacterLimit(str);
33 | }
34 |
35 | private boolean isInCharacterLimit(String str) {
36 | int count = getCharacterCount(str);
37 | return count >= minLength && count <= maxLength;
38 | }
39 |
40 | private int getCharacterCount(String str) {
41 | if(TextUtils.isEmpty(str)) {
42 | return 0;
43 | }
44 |
45 | return str.length();
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/argus/src/main/java/com/moldedbits/argus/validations/RegexValidation.java:
--------------------------------------------------------------------------------
1 | package com.moldedbits.argus.validations;
2 |
3 | import java.util.regex.Matcher;
4 | import java.util.regex.Pattern;
5 |
6 | import lombok.Getter;
7 | import lombok.Setter;
8 |
9 | /**
10 | * Created by abhishek
11 | * on 09/05/17.
12 | */
13 |
14 | public class RegexValidation extends AbstractValidation {
15 |
16 | @Setter @Getter
17 | private Pattern pattern;
18 |
19 | public RegexValidation(String regex, String errorMessage) {
20 | super(errorMessage);
21 | this.pattern = Pattern.compile(regex);
22 | }
23 |
24 | @Override
25 | public boolean validate(String str) {
26 | Matcher matcher = pattern.matcher(str);
27 | return matcher.matches();
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/argus/src/main/java/com/moldedbits/argus/validations/Validation.java:
--------------------------------------------------------------------------------
1 | package com.moldedbits.argus.validations;
2 |
3 | /**
4 | * Created by abhishek
5 | * on 09/05/17.
6 | */
7 |
8 | public interface Validation {
9 | boolean validate(String str);
10 | String getErrorMessage();
11 | }
12 |
--------------------------------------------------------------------------------
/argus/src/main/java/com/moldedbits/argus/validations/ValidationEngine.java:
--------------------------------------------------------------------------------
1 | package com.moldedbits.argus.validations;
2 |
3 | import android.support.annotation.Nullable;
4 | import android.text.TextUtils;
5 | import android.widget.EditText;
6 |
7 | import com.moldedbits.argus.logger.ArgusLogger;
8 |
9 | import java.util.ArrayList;
10 | import java.util.HashMap;
11 | import java.util.List;
12 | import java.util.Map;
13 |
14 | /**
15 | * Created by abhishek
16 | * on 09/05/17.
17 | */
18 |
19 | public class ValidationEngine {
20 | private static final String EMAIL_KEY = "email";
21 | private static final String PASSWORD_KEY = "password";
22 | private static final String TAG = "ValidationEngine";
23 | private final Map> validators;
24 |
25 | public ValidationEngine() {
26 | validators = new HashMap<>();
27 | }
28 |
29 | private ValidationEngine addValidation(final String key, Validation validation) {
30 | if(!validators.containsKey(key)) {
31 | List validations = new ArrayList<>();
32 | validations.add(validation);
33 | validators.put(key, validations);
34 | } else {
35 | validators.get(key).add(validation);
36 | }
37 |
38 | return this;
39 | }
40 |
41 | private ValidationEngine addValidations(final String key, List validations) {
42 | if(!validators.containsKey(key)) {
43 | validators.put(EMAIL_KEY, validations);
44 | } else {
45 | validators.get(EMAIL_KEY).addAll(validations);
46 | }
47 |
48 | return this;
49 | }
50 |
51 | public ValidationEngine addEmailValidation(Validation validation) {
52 | return addValidation(EMAIL_KEY, validation);
53 | }
54 |
55 | public ValidationEngine addEmailValidations(List emailValidations) {
56 | return addValidations(EMAIL_KEY, emailValidations);
57 | }
58 |
59 | public ValidationEngine addPasswordValidation(Validation validation) {
60 | return addValidation(PASSWORD_KEY, validation);
61 | }
62 |
63 | public ValidationEngine addPasswordValidations(List passwordValidations) {
64 | return addValidations(PASSWORD_KEY, passwordValidations);
65 | }
66 |
67 | @Nullable
68 | public List getValidationsByKey(String key) {
69 | if(validators.containsKey(key)) {
70 | return validators.get(key);
71 | }
72 |
73 | return null;
74 | }
75 |
76 | public static String validate(String text, List rules) {
77 | String errors = "";
78 | for(Validation rule: rules) {
79 | if(!rule.validate(text)) {
80 | errors += "\n" + rule.getErrorMessage();
81 | }
82 | }
83 |
84 | return errors;
85 | }
86 |
87 | public static boolean validateEditText(final EditText editText, final ValidationEngine validationEngine) {
88 | if(editText.getTag() == null) {
89 | ArgusLogger.w(TAG, "Not performing validations for this EditText");
90 | }
91 |
92 | boolean allWell = true;
93 |
94 | // get validations for tag
95 | List validations = validationEngine.getValidationsByKey(editText.getTag().toString());
96 | if(validations != null && !validations.isEmpty()) {
97 | String errors = ValidationEngine.validate(editText.getText().toString(), validations);
98 | if(!TextUtils.isEmpty(errors)) {
99 | editText.setError(errors);
100 | allWell = false;
101 | }
102 | }
103 |
104 | return allWell;
105 | }
106 | }
107 |
--------------------------------------------------------------------------------
/argus/src/main/res/drawable-xxxhdpi/email_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/moldedbits/argus-android/4e074bc975a3ba2d14d866cec972adc1e35eedad/argus/src/main/res/drawable-xxxhdpi/email_icon.png
--------------------------------------------------------------------------------
/argus/src/main/res/drawable-xxxhdpi/fbxxxhdpi.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/moldedbits/argus-android/4e074bc975a3ba2d14d866cec972adc1e35eedad/argus/src/main/res/drawable-xxxhdpi/fbxxxhdpi.png
--------------------------------------------------------------------------------
/argus/src/main/res/drawable-xxxhdpi/google_xxxhdpi.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/moldedbits/argus-android/4e074bc975a3ba2d14d866cec972adc1e35eedad/argus/src/main/res/drawable-xxxhdpi/google_xxxhdpi.png
--------------------------------------------------------------------------------
/argus/src/main/res/drawable-xxxhdpi/ic_hide_pwd.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/moldedbits/argus-android/4e074bc975a3ba2d14d866cec972adc1e35eedad/argus/src/main/res/drawable-xxxhdpi/ic_hide_pwd.png
--------------------------------------------------------------------------------
/argus/src/main/res/drawable-xxxhdpi/icn_show_pwd.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/moldedbits/argus-android/4e074bc975a3ba2d14d866cec972adc1e35eedad/argus/src/main/res/drawable-xxxhdpi/icn_show_pwd.png
--------------------------------------------------------------------------------
/argus/src/main/res/drawable-xxxhdpi/password_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/moldedbits/argus-android/4e074bc975a3ba2d14d866cec972adc1e35eedad/argus/src/main/res/drawable-xxxhdpi/password_icon.png
--------------------------------------------------------------------------------
/argus/src/main/res/layout/activity_argus.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
--------------------------------------------------------------------------------
/argus/src/main/res/layout/facebook_login.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
13 |
14 |
--------------------------------------------------------------------------------
/argus/src/main/res/layout/facebook_signup.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/argus/src/main/res/layout/forgot_password.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
16 |
17 |
25 |
26 |
32 |
33 |
43 |
44 |
45 |
54 |
--------------------------------------------------------------------------------
/argus/src/main/res/layout/fragment_email_verification.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
15 |
16 |
--------------------------------------------------------------------------------
/argus/src/main/res/layout/fragment_forgot_password.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
--------------------------------------------------------------------------------
/argus/src/main/res/layout/fragment_login.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
16 |
17 |
23 |
24 |
28 |
29 |
36 |
37 |
43 |
44 |
51 |
52 |
58 |
59 |
71 |
72 |
73 |
86 |
87 |
--------------------------------------------------------------------------------
/argus/src/main/res/layout/fragment_signup.xml:
--------------------------------------------------------------------------------
1 |
2 |
12 |
13 |
18 |
19 |
23 |
24 |
31 |
32 |
38 |
39 |
--------------------------------------------------------------------------------
/argus/src/main/res/layout/google_signup.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/argus/src/main/res/layout/login_email.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
17 |
18 |
24 |
25 |
30 |
31 |
38 |
39 |
40 |
46 |
47 |
48 |
49 |
56 |
57 |
62 |
63 |
66 |
67 |
75 |
76 |
77 |
85 |
86 |
87 |
96 |
97 |
98 |
99 |
100 |
111 |
112 |
120 |
--------------------------------------------------------------------------------
/argus/src/main/res/layout/login_google.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
13 |
14 |
--------------------------------------------------------------------------------
/argus/src/main/res/layout/signup_email.xml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
18 |
19 |
24 |
25 |
34 |
35 |
36 |
37 |
42 |
43 |
53 |
54 |
55 |
56 |
61 |
62 |
73 |
74 |
75 |
82 |
--------------------------------------------------------------------------------
/argus/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 | 8dp
6 | 4dp
7 | 8dp
8 | 24dp
9 | 50dp
10 | 14sp
11 | 12sp
12 | 16sp
13 | 24sp
14 | 112dp
15 |
--------------------------------------------------------------------------------
/argus/src/main/res/values/ids.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/argus/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Argus
3 | Username
4 | Password
5 | Login
6 |
7 | Invalid
8 | Invalid
9 | Invalid Email
10 | Email
11 | I already have an Account
12 | Forgot Password?
13 | Email
14 | Sign In
15 | Sign in with
16 | Name
17 | Sign Up
18 | Reset Password
19 | Don\'t have an account?
20 | Please click on the link sent over the mail to you to validate your Account.
21 | Please enter your registered Email Id for password reset instructions
22 | Skip
23 |
24 |
--------------------------------------------------------------------------------
/argus/src/test/java/com/moldedbits/argus/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.moldedbits.argus;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() throws Exception {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | repositories {
5 | jcenter()
6 | }
7 | dependencies {
8 | classpath 'com.android.tools.build:gradle:2.3.3'
9 | // NOTE: Do not place your application dependencies here; they belong
10 | // in the individual module build.gradle files
11 | }
12 | }
13 |
14 | allprojects {
15 | repositories {
16 | jcenter()
17 | }
18 | }
19 |
20 | task clean(type: Delete) {
21 | delete rootProject.buildDir
22 | }
23 |
--------------------------------------------------------------------------------
/email-login-sample/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/email-login-sample/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 25
5 | buildToolsVersion "25.0.3"
6 |
7 | defaultConfig {
8 | applicationId "com.moldedbits.argus.samples.simplelogin"
9 | minSdkVersion 16
10 | targetSdkVersion 25
11 | versionCode 1
12 | versionName "1.0"
13 |
14 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
15 |
16 | }
17 | buildTypes {
18 | release {
19 | minifyEnabled false
20 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
21 | }
22 | }
23 | }
24 |
25 | dependencies {
26 | compile project(':argus')
27 | compile fileTree(dir: 'libs', include: ['*.jar'])
28 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
29 | exclude group: 'com.android.support', module: 'support-annotations'
30 | })
31 | compile 'com.android.support:appcompat-v7:25.3.1'
32 | compile 'com.android.support.constraint:constraint-layout:1.0.2'
33 | testCompile 'junit:junit:4.12'
34 | }
35 |
--------------------------------------------------------------------------------
/email-login-sample/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /Users/abhishek/Development/AndroidSDK/sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
19 | # Uncomment this to preserve the line number information for
20 | # debugging stack traces.
21 | #-keepattributes SourceFile,LineNumberTable
22 |
23 | # If you keep the line number information, uncomment this to
24 | # hide the original source file name.
25 | #-renamesourcefileattribute SourceFile
26 |
--------------------------------------------------------------------------------
/email-login-sample/src/androidTest/java/moldedbits/com/emailloginsample/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package moldedbits.com.emailloginsample;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 |
11 | import static org.junit.Assert.*;
12 |
13 | /**
14 | * Instrumentation test, which will execute on an Android device.
15 | *
16 | * @see Testing documentation
17 | */
18 | @RunWith(AndroidJUnit4.class)
19 | public class ExampleInstrumentedTest {
20 | @Test
21 | public void useAppContext() throws Exception {
22 | // Context of the app under test.
23 | Context appContext = InstrumentationRegistry.getTargetContext();
24 |
25 | assertEquals("moldedbits.com.emailloginsample", appContext.getPackageName());
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/email-login-sample/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
13 |
14 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/email-login-sample/src/main/java/com/moldedbits/argus/samples/simplelogin/HomeActivity.java:
--------------------------------------------------------------------------------
1 | package com.moldedbits.argus.samples.simplelogin;
2 |
3 | import android.support.v7.app.AppCompatActivity;
4 | import android.os.Bundle;
5 |
6 | public class HomeActivity extends AppCompatActivity {
7 | @Override
8 | protected void onCreate(Bundle savedInstanceState) {
9 | super.onCreate(savedInstanceState);
10 | setContentView(R.layout.activity_home);
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/email-login-sample/src/main/java/com/moldedbits/argus/samples/simplelogin/SimpleEmailLoginApplication.java:
--------------------------------------------------------------------------------
1 | package com.moldedbits.argus.samples.simplelogin;
2 |
3 | import android.app.Application;
4 |
5 | import com.moldedbits.argus.Argus;
6 | import com.moldedbits.argus.ArgusTheme;
7 | import com.moldedbits.argus.nextscreenproviders.SimpleNextScreenProvider;
8 | import com.moldedbits.argus.provider.BaseProvider;
9 | import com.moldedbits.argus.storage.DefaultArgusStorage;
10 |
11 | import java.util.ArrayList;
12 |
13 | public class SimpleEmailLoginApplication extends Application {
14 |
15 | @Override
16 | public void onCreate() {
17 | super.onCreate();
18 |
19 | ArrayList loginProviders = new ArrayList<>();
20 | loginProviders.add(new SimpleEmailLoginProvider());
21 |
22 | // argus is customizable, supplying my custom logo to argus
23 | ArgusTheme argusTheme = new ArgusTheme.Builder()
24 | .logo(R.mipmap.ic_launcher)
25 | .build();
26 |
27 | new Argus.Builder()
28 | // using default storage, dont want to do anything fancy here
29 | .argusStorage(new DefaultArgusStorage(getApplicationContext()))
30 | // this is the screen which should open after login is successfully completed
31 | .nextScreenProvider(new SimpleNextScreenProvider(HomeActivity.class))
32 | // we only want to implement login screen
33 | .loginProviders(loginProviders)
34 | // set custom theme
35 | .theme(argusTheme)
36 | .build();
37 | }
38 | }
--------------------------------------------------------------------------------
/email-login-sample/src/main/java/com/moldedbits/argus/samples/simplelogin/SimpleEmailLoginProvider.java:
--------------------------------------------------------------------------------
1 | package com.moldedbits.argus.samples.simplelogin;
2 |
3 | import android.widget.Toast;
4 |
5 | import com.moldedbits.argus.ArgusState;
6 |
7 | /**
8 | * Created by abhishek
9 | * on 16/06/17.
10 | *
11 | * This is a sample implementation of default login provider available in Argus
12 | */
13 |
14 | public class SimpleEmailLoginProvider extends com.moldedbits.argus.provider.login.EmailLoginProvider {
15 |
16 | /**
17 | * this function is called after user input was validated
18 | * this is where actual API call to your server will go
19 | */
20 | @Override
21 | protected void doServerLogin(String username, String password) {
22 | // need to set state signed-in in Argus here
23 | if(username.equals("valid@user.com") && password.equals("password")) {
24 | // do a real API call here and in on success do following
25 | if (resultListener != null) {
26 | resultListener.onSuccess(ArgusState.SIGNED_IN);
27 | }
28 | } else {
29 | if (context != null) {
30 | Toast.makeText(context, context.getString(R.string.invalid_email),
31 | Toast.LENGTH_LONG).show();
32 | }
33 | }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/email-login-sample/src/main/res/layout/activity_home.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
18 |
19 |
--------------------------------------------------------------------------------
/email-login-sample/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/moldedbits/argus-android/4e074bc975a3ba2d14d866cec972adc1e35eedad/email-login-sample/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/email-login-sample/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/moldedbits/argus-android/4e074bc975a3ba2d14d866cec972adc1e35eedad/email-login-sample/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/email-login-sample/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/moldedbits/argus-android/4e074bc975a3ba2d14d866cec972adc1e35eedad/email-login-sample/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/email-login-sample/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/moldedbits/argus-android/4e074bc975a3ba2d14d866cec972adc1e35eedad/email-login-sample/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/email-login-sample/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/moldedbits/argus-android/4e074bc975a3ba2d14d866cec972adc1e35eedad/email-login-sample/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/email-login-sample/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/moldedbits/argus-android/4e074bc975a3ba2d14d866cec972adc1e35eedad/email-login-sample/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/email-login-sample/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/moldedbits/argus-android/4e074bc975a3ba2d14d866cec972adc1e35eedad/email-login-sample/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/email-login-sample/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/moldedbits/argus-android/4e074bc975a3ba2d14d866cec972adc1e35eedad/email-login-sample/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/email-login-sample/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/moldedbits/argus-android/4e074bc975a3ba2d14d866cec972adc1e35eedad/email-login-sample/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/email-login-sample/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/moldedbits/argus-android/4e074bc975a3ba2d14d866cec972adc1e35eedad/email-login-sample/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/email-login-sample/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/email-login-sample/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | EmailLoginSample
3 |
4 |
--------------------------------------------------------------------------------
/email-login-sample/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/email-login-sample/src/test/java/moldedbits/com/emailloginsample/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package moldedbits.com.emailloginsample;
2 |
3 | import org.junit.Test;
4 |
5 |
6 | import static org.junit.Assert.*;
7 |
8 | /**
9 | * Example local unit test, which will execute on the development machine (host).
10 | *
11 | * @see Testing documentation
12 | */
13 | public class ExampleUnitTest {
14 | @Test
15 | public void addition_isCorrect() throws Exception {
16 | assertEquals(4, 2 + 2);
17 | }
18 | }
--------------------------------------------------------------------------------
/email-login-signup-sample/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/workspace.xml
5 | /.idea/libraries
6 | .DS_Store
7 | /build
8 | /captures
9 | .externalNativeBuild
10 |
--------------------------------------------------------------------------------
/email-login-signup-sample/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 25
5 | buildToolsVersion "25.0.3"
6 | defaultConfig {
7 | applicationId "com.moldedbits.argus.samples.email_login_signup"
8 | minSdkVersion 16
9 | targetSdkVersion 25
10 | versionCode 1
11 | versionName "1.0"
12 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
13 | }
14 | buildTypes {
15 | release {
16 | minifyEnabled false
17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18 | }
19 | }
20 | }
21 |
22 | dependencies {
23 | compile project(':argus')
24 | compile fileTree(dir: 'libs', include: ['*.jar'])
25 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
26 | exclude group: 'com.android.support', module: 'support-annotations'
27 | })
28 |
29 | testCompile 'junit:junit:4.12'
30 | }
31 |
--------------------------------------------------------------------------------
/email-login-signup-sample/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /Users/anuj/Library/Android/sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
19 | # Uncomment this to preserve the line number information for
20 | # debugging stack traces.
21 | #-keepattributes SourceFile,LineNumberTable
22 |
23 | # If you keep the line number information, uncomment this to
24 | # hide the original source file name.
25 | #-renamesourcefileattribute SourceFile
26 |
--------------------------------------------------------------------------------
/email-login-signup-sample/src/androidTest/java/com/moldedbits/argus/samples/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.moldedbits.argus.samples;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumentation test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() throws Exception {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("com.moldedbits.argus.sample", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/email-login-signup-sample/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
15 |
16 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/email-login-signup-sample/src/main/java/com/moldedbits/argus/samples/email_login_signup/EmailLoginSignupApplication.java:
--------------------------------------------------------------------------------
1 | package com.moldedbits.argus.samples.email_login_signup;
2 |
3 | import android.app.Application;
4 |
5 | import com.moldedbits.argus.Argus;
6 | import com.moldedbits.argus.ArgusTheme;
7 | import com.moldedbits.argus.nextscreenproviders.SimpleNextScreenProvider;
8 | import com.moldedbits.argus.provider.BaseProvider;
9 | import com.moldedbits.argus.provider.login.EmailLoginProvider;
10 | import com.moldedbits.argus.storage.DefaultArgusStorage;
11 | import com.moldedbits.argus.validations.LengthValidation;
12 |
13 | import java.util.ArrayList;
14 |
15 | public class EmailLoginSignupApplication extends Application {
16 |
17 | @Override
18 | public void onCreate() {
19 | super.onCreate();
20 |
21 | // initialize Argus
22 | ArrayList loginProviders = new ArrayList<>();
23 | ArrayList signupProviders = new ArrayList<>();
24 | SimpleEmailSignupProvider emailSignupProvider = new SimpleEmailSignupProvider(false);
25 | emailSignupProvider.getValidationEngine()
26 | .addPasswordValidation(new LengthValidation(4, 8, getString(R.string.password_length)));
27 |
28 | EmailLoginProvider loginProvider = new SimpleEmailLoginProvider();
29 | loginProvider.setShowPasswordEnabled(false);
30 | loginProviders.add(loginProvider);
31 | signupProviders.add(emailSignupProvider);
32 |
33 | ArgusTheme.Builder themeBuilder = new ArgusTheme.Builder();
34 | themeBuilder.logo(R.mipmap.ic_launcher);
35 |
36 | new Argus.Builder()
37 | .argusStorage(new DefaultArgusStorage(getApplicationContext()))
38 | .nextScreenProvider(new SimpleNextScreenProvider(HomeActivity.class))
39 | .signupProviders(signupProviders)
40 | .loginProviders(loginProviders)
41 | .theme(themeBuilder.build())
42 | .forgotPasswordProvider(new SimpleForgotPasswordProvider())
43 | .build();
44 | }
45 | }
--------------------------------------------------------------------------------
/email-login-signup-sample/src/main/java/com/moldedbits/argus/samples/email_login_signup/HomeActivity.java:
--------------------------------------------------------------------------------
1 | package com.moldedbits.argus.samples.email_login_signup;
2 |
3 | import android.os.Bundle;
4 | import android.support.v7.app.AppCompatActivity;
5 |
6 | public class HomeActivity extends AppCompatActivity {
7 |
8 | @Override
9 | protected void onCreate(Bundle savedInstanceState) {
10 | super.onCreate(savedInstanceState);
11 | setContentView(R.layout.activity_main);
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/email-login-signup-sample/src/main/java/com/moldedbits/argus/samples/email_login_signup/SimpleEmailLoginProvider.java:
--------------------------------------------------------------------------------
1 | package com.moldedbits.argus.samples.email_login_signup;
2 |
3 | import android.widget.Toast;
4 |
5 | import com.moldedbits.argus.ArgusState;
6 |
7 | /**
8 | * Created by abhishek
9 | * on 16/06/17.
10 | *
11 | * This is a sample implementation of default login provider available in Argus
12 | */
13 |
14 | public class SimpleEmailLoginProvider extends com.moldedbits.argus.provider.login.EmailLoginProvider {
15 |
16 | /**
17 | * this function is called after user input was validated
18 | * this is where actual API call to your server will go
19 | */
20 | @Override
21 | protected void doServerLogin(String username, String password) {
22 | // need to set state signed-in in Argus here
23 | if(username.equals("valid@user.com") && password.equals("password")) {
24 | // do a real API call here and in on success do following
25 | if (resultListener != null) {
26 | resultListener.onSuccess(ArgusState.SIGNED_IN);
27 | }
28 | } else {
29 | if (context != null) {
30 | Toast.makeText(context, context.getString(R.string.invalid_email),
31 | Toast.LENGTH_LONG).show();
32 | }
33 | }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/email-login-signup-sample/src/main/java/com/moldedbits/argus/samples/email_login_signup/SimpleEmailSignupProvider.java:
--------------------------------------------------------------------------------
1 | package com.moldedbits.argus.samples.email_login_signup;
2 |
3 | import android.widget.Toast;
4 |
5 | import com.moldedbits.argus.provider.signup.EmailSignupProvider;
6 |
7 | /**
8 | * Created by abhishek
9 | * on 23/06/17.
10 | */
11 |
12 | class SimpleEmailSignupProvider extends EmailSignupProvider {
13 | SimpleEmailSignupProvider(boolean isValidationRequired) {
14 | super(isValidationRequired);
15 | }
16 |
17 | @Override
18 | public void doServerSignup(String username, String email, String password) {
19 | // need to set state signed-in in Argus here
20 | if(username.equals("valid@user.com") && password.equals("password")) {
21 | // do a real API call here and in on success do following
22 | if (context != null) {
23 | Toast.makeText(context, context.getString(R.string.signing_up),
24 | Toast.LENGTH_LONG).show();
25 | }
26 | } else {
27 | if (context != null) {
28 | Toast.makeText(context, context.getString(R.string.invalid_email),
29 | Toast.LENGTH_LONG).show();
30 | }
31 | }
32 | }
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/email-login-signup-sample/src/main/java/com/moldedbits/argus/samples/email_login_signup/SimpleForgotPasswordProvider.java:
--------------------------------------------------------------------------------
1 | package com.moldedbits.argus.samples.email_login_signup;
2 |
3 | import android.widget.Toast;
4 |
5 | import com.moldedbits.argus.provider.ForgotPasswordProvider;
6 |
7 | /**
8 | * Created by abhishek
9 | * on 23/06/17.
10 | */
11 |
12 | public class SimpleForgotPasswordProvider extends ForgotPasswordProvider {
13 | @Override
14 | public void sendPasswordResetEmail(final String email) {
15 | Toast.makeText(context, "Sending email to:" + email, Toast.LENGTH_LONG).show();
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/email-login-signup-sample/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
13 |
14 |
--------------------------------------------------------------------------------
/email-login-signup-sample/src/main/res/layout/custom_login_fragment.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
11 |
12 |
17 |
18 |
23 |
24 |
--------------------------------------------------------------------------------
/email-login-signup-sample/src/main/res/layout/custom_signup_layout.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
12 |
13 |
18 |
19 |
24 |
25 |
--------------------------------------------------------------------------------
/email-login-signup-sample/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/moldedbits/argus-android/4e074bc975a3ba2d14d866cec972adc1e35eedad/email-login-signup-sample/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/email-login-signup-sample/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/moldedbits/argus-android/4e074bc975a3ba2d14d866cec972adc1e35eedad/email-login-signup-sample/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/email-login-signup-sample/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/moldedbits/argus-android/4e074bc975a3ba2d14d866cec972adc1e35eedad/email-login-signup-sample/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/email-login-signup-sample/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/moldedbits/argus-android/4e074bc975a3ba2d14d866cec972adc1e35eedad/email-login-signup-sample/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/email-login-signup-sample/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/moldedbits/argus-android/4e074bc975a3ba2d14d866cec972adc1e35eedad/email-login-signup-sample/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/email-login-signup-sample/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/moldedbits/argus-android/4e074bc975a3ba2d14d866cec972adc1e35eedad/email-login-signup-sample/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/email-login-signup-sample/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/moldedbits/argus-android/4e074bc975a3ba2d14d866cec972adc1e35eedad/email-login-signup-sample/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/email-login-signup-sample/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/moldedbits/argus-android/4e074bc975a3ba2d14d866cec972adc1e35eedad/email-login-signup-sample/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/email-login-signup-sample/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/moldedbits/argus-android/4e074bc975a3ba2d14d866cec972adc1e35eedad/email-login-signup-sample/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/email-login-signup-sample/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/moldedbits/argus-android/4e074bc975a3ba2d14d866cec972adc1e35eedad/email-login-signup-sample/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/email-login-signup-sample/src/main/res/values-v21/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
21 |
22 |
26 |
27 |
--------------------------------------------------------------------------------
/email-login-signup-sample/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 | #f5a838
7 | #f8f8cf
8 | #33f47d31
9 | #f58843
10 |
11 |
--------------------------------------------------------------------------------
/email-login-signup-sample/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | ArgusSample
3 | 423872077970261
4 | Password length should be in between 4 to 8 characters.
5 | Please enter valid email address.
6 | Signing Up
7 |
8 |
--------------------------------------------------------------------------------
/email-login-signup-sample/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
16 |
17 |
21 |
22 |
--------------------------------------------------------------------------------
/email-login-signup-sample/src/test/java/com/moldedbits/argus/samples/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.moldedbits.argus.samples;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() throws Exception {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/email-social-login-sample/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/workspace.xml
5 | /.idea/libraries
6 | .DS_Store
7 | /build
8 | /captures
9 | .externalNativeBuild
10 |
--------------------------------------------------------------------------------
/email-social-login-sample/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 25
5 | buildToolsVersion "25.0.3"
6 |
7 | final API_URL_DEV = "";
8 | final API_URL_PROD = "";
9 |
10 | defaultConfig {
11 | applicationId "com.moldedbits.argus.samples.email_social_login"
12 | minSdkVersion 16
13 | targetSdkVersion 25
14 | versionCode 1
15 | versionName "1.0"
16 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
17 | }
18 | buildTypes {
19 | debug {
20 | minifyEnabled false
21 | buildConfigField 'String', 'API_URL', "\"" + API_URL_DEV + "\""
22 | }
23 |
24 | release {
25 | buildConfigField 'String', 'API_URL', "\"" + API_URL_DEV + "\""
26 | minifyEnabled true
27 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
28 | }
29 |
30 | }
31 | }
32 |
33 | dependencies {
34 | compile project(':argus')
35 | compile fileTree(dir: 'libs', include: ['*.jar'])
36 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
37 | exclude group: 'com.android.support', module: 'support-annotations'
38 | })
39 |
40 | testCompile 'junit:junit:4.12'
41 |
42 | // Use Retrofit for API interaction
43 | compile 'com.squareup.retrofit2:retrofit:2.1.0'
44 | compile 'com.squareup.retrofit2:converter-gson:2.1.0'
45 | compile 'com.squareup.okhttp3:logging-interceptor:3.4.0'
46 |
47 | // RX Android
48 | compile 'io.reactivex:rxandroid:1.0.1'
49 | compile 'io.reactivex:rxjava:1.0.14'
50 | compile 'com.squareup.retrofit2:adapter-rxjava:2.1.0'
51 | }
52 |
--------------------------------------------------------------------------------
/email-social-login-sample/google-services.json:
--------------------------------------------------------------------------------
1 | {
2 | "project_info": {
3 | "project_number": "519829002492",
4 | "project_id": "argus-social-demo"
5 | },
6 | "client": [
7 | {
8 | "client_info": {
9 | "mobilesdk_app_id": "1:519829002492:android:0758bcfb72d6d346",
10 | "android_client_info": {
11 | "package_name": "com.moldedbits.argus.samples.email_social_login"
12 | }
13 | },
14 | "oauth_client": [
15 | {
16 | "client_id": "519829002492-9ae71uje3i4lko42rn4ea1b7tcbh04rd.apps.googleusercontent.com",
17 | "client_type": 3
18 | },
19 | {
20 | "client_id": "519829002492-lloas3k7r1re7g8o98l2fdvnajgd7at0.apps.googleusercontent.com",
21 | "client_type": 1,
22 | "android_info": {
23 | "package_name": "com.moldedbits.argus.samples.email_social_login",
24 | "certificate_hash": "e308f1e632e73b5649a61a43527d8a74de003992"
25 | }
26 | }
27 | ],
28 | "api_key": [
29 | {
30 | "current_key": "AIzaSyB3Yc68UpSgDDfl4N3tf7hLkAnC62Zvro0"
31 | }
32 | ],
33 | "services": {
34 | "analytics_service": {
35 | "status": 1
36 | },
37 | "appinvite_service": {
38 | "status": 1,
39 | "other_platform_oauth_client": []
40 | },
41 | "ads_service": {
42 | "status": 1
43 | }
44 | }
45 | }
46 | ],
47 | "configuration_version": "1"
48 | }
--------------------------------------------------------------------------------
/email-social-login-sample/src/androidTest/java/com/moldedbits/argus/samples/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.moldedbits.argus.samples;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumentation test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() throws Exception {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("com.moldedbits.argus.sample", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/email-social-login-sample/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
15 |
16 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
32 |
33 |
37 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
--------------------------------------------------------------------------------
/email-social-login-sample/src/main/java/com/moldedbits/argus/samples/email_social_login/EmailSocialLoginApplication.java:
--------------------------------------------------------------------------------
1 | package com.moldedbits.argus.samples.email_social_login;
2 |
3 | import android.app.Application;
4 | import android.graphics.Color;
5 |
6 | import com.facebook.FacebookSdk;
7 | import com.facebook.LoggingBehavior;
8 | import com.moldedbits.argus.Argus;
9 | import com.moldedbits.argus.ArgusTheme;
10 | import com.moldedbits.argus.nextscreenproviders.SimpleNextScreenProvider;
11 | import com.moldedbits.argus.provider.BaseProvider;
12 | import com.moldedbits.argus.provider.login.EmailLoginProvider;
13 | import com.moldedbits.argus.provider.social.FacebookOnBoardingProvider;
14 | import com.moldedbits.argus.provider.social.GoogleOnBoardingProvider;
15 | import com.moldedbits.argus.provider.social.helper.FacebookConfig;
16 | import com.moldedbits.argus.storage.DefaultArgusStorage;
17 | import com.moldedbits.argus.validations.LengthValidation;
18 |
19 | import java.util.ArrayList;
20 | import java.util.List;
21 |
22 | public class EmailSocialLoginApplication extends Application {
23 |
24 | @Override
25 | public void onCreate() {
26 | super.onCreate();
27 |
28 | if (BuildConfig.DEBUG) {
29 | FacebookSdk.setIsDebugEnabled(true);
30 | FacebookSdk.addLoggingBehavior(LoggingBehavior.INCLUDE_ACCESS_TOKENS);
31 | }
32 |
33 | // initialize Argus
34 | ArrayList signupProviders = new ArrayList<>();
35 | SimpleEmailSignupProvider emailSignupProvider = new SimpleEmailSignupProvider(false);
36 | emailSignupProvider.getValidationEngine()
37 | .addPasswordValidation(new LengthValidation(4, 8, getString(R.string.password_length)));
38 | signupProviders.add(emailSignupProvider);
39 |
40 |
41 | GoogleOnBoardingProvider googleProvider = new GoogleSignupProvider();
42 |
43 | FacebookOnBoardingProvider facebookProvider = new FacebookSignupProvider();
44 |
45 | //setting permissions required by facebook to get specific data
46 | List permissionList = new ArrayList<>();
47 | permissionList.add(FacebookConfig.PUBLIC_PROFILE);
48 | permissionList.add(FacebookConfig.EMAIL);
49 | facebookProvider.setFacebookPermission(permissionList);
50 |
51 | //setting serverClientId
52 | googleProvider.setServerClientId(getString(R.string.server_client_id));
53 |
54 | ArrayList loginProviders = new ArrayList<>();
55 | EmailLoginProvider loginProvider = new SimpleEmailLoginProvider();
56 | loginProvider.setShowPasswordEnabled(false);
57 | loginProviders.add(loginProvider);
58 |
59 | // add google login provider
60 | loginProviders.add(googleProvider);
61 |
62 | // add facebook login provider
63 | loginProviders.add(facebookProvider);
64 |
65 | // add facebook signup provider
66 | signupProviders.add(facebookProvider);
67 |
68 | // add google signup provider
69 | signupProviders.add(googleProvider);
70 |
71 | ArgusTheme.Builder themeBuilder = new ArgusTheme.Builder();
72 | themeBuilder.logo(R.drawable.argus_logo)
73 | .backgroundDrawable(R.drawable.bg)
74 | .buttonDrawable(R.drawable.button_bg)
75 | .welcomeText(getString(R.string.welcome))
76 | .welcomeTextColor(Color.WHITE)
77 | .welcomeTextSize(18.0f)
78 | .showEditTextDrawables(false);
79 |
80 | new Argus.Builder()
81 | .argusStorage(new DefaultArgusStorage(getApplicationContext()))
82 | .nextScreenProvider(new SimpleNextScreenProvider(HomeActivity.class))
83 | .enableSkipLogin(true)
84 | .skipLoginText(getString(R.string.skip_login))
85 | .signupProviders(signupProviders)
86 | .loginProviders(loginProviders)
87 | .theme(themeBuilder.build())
88 | .forgotPasswordProvider(new SimpleForgotPasswordProvider())
89 | .build();
90 | }
91 | }
--------------------------------------------------------------------------------
/email-social-login-sample/src/main/java/com/moldedbits/argus/samples/email_social_login/FacebookSignupProvider.java:
--------------------------------------------------------------------------------
1 | package com.moldedbits.argus.samples.email_social_login;
2 |
3 | import com.facebook.AccessToken;
4 | import com.moldedbits.argus.provider.social.FacebookOnBoardingProvider;
5 |
6 | public class FacebookSignupProvider extends FacebookOnBoardingProvider {
7 |
8 | @Override
9 | public void onSuccess(AccessToken token) {
10 | super.onSuccess(token);
11 | }
12 |
13 | @Override
14 | public void onFailure(String message) {
15 | super.onFailure(message);
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/email-social-login-sample/src/main/java/com/moldedbits/argus/samples/email_social_login/GoogleSignupProvider.java:
--------------------------------------------------------------------------------
1 | package com.moldedbits.argus.samples.email_social_login;
2 |
3 | import com.google.android.gms.auth.api.signin.GoogleSignInAccount;
4 | import com.moldedbits.argus.provider.social.GoogleOnBoardingProvider;
5 |
6 | public class GoogleSignupProvider extends GoogleOnBoardingProvider {
7 |
8 | @Override
9 | public void onSuccess(GoogleSignInAccount account) {
10 | super.onSuccess(account);
11 | }
12 |
13 | @Override
14 | public void onFailure(String message) {
15 | super.onFailure(message);
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/email-social-login-sample/src/main/java/com/moldedbits/argus/samples/email_social_login/HomeActivity.java:
--------------------------------------------------------------------------------
1 | package com.moldedbits.argus.samples.email_social_login;
2 |
3 | import android.os.Bundle;
4 | import android.support.v7.app.AppCompatActivity;
5 |
6 | public class HomeActivity extends AppCompatActivity {
7 |
8 | @Override
9 | protected void onCreate(Bundle savedInstanceState) {
10 | super.onCreate(savedInstanceState);
11 | setContentView(R.layout.activity_main);
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/email-social-login-sample/src/main/java/com/moldedbits/argus/samples/email_social_login/SimpleEmailLoginProvider.java:
--------------------------------------------------------------------------------
1 | package com.moldedbits.argus.samples.email_social_login;
2 |
3 | import android.widget.Toast;
4 |
5 | import com.moldedbits.argus.ArgusState;
6 |
7 | /**
8 | * Created by abhishek
9 | * on 16/06/17.
10 | *
11 | * This is a sample implementation of default login provider available in Argus
12 | */
13 |
14 | public class SimpleEmailLoginProvider extends com.moldedbits.argus.provider.login.EmailLoginProvider {
15 |
16 | /**
17 | * this function is called after user input was validated
18 | * this is where actual API call to your server will go
19 | */
20 | @Override
21 | protected void doServerLogin(String username, String password) {
22 | // need to set state signed-in in Argus here
23 | if(username.equals("valid@user.com") && password.equals("password")) {
24 | // do a real API call here and in on success do following
25 | if (resultListener != null) {
26 | resultListener.onSuccess(ArgusState.SIGNED_IN);
27 | }
28 | } else {
29 | if (context != null) {
30 | Toast.makeText(context, context.getString(R.string.invalid_email),
31 | Toast.LENGTH_LONG).show();
32 | }
33 | }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/email-social-login-sample/src/main/java/com/moldedbits/argus/samples/email_social_login/SimpleEmailSignupProvider.java:
--------------------------------------------------------------------------------
1 | package com.moldedbits.argus.samples.email_social_login;
2 |
3 | import android.widget.Toast;
4 |
5 | import com.moldedbits.argus.provider.signup.EmailSignupProvider;
6 |
7 | /**
8 | * Created by abhishek
9 | * on 23/06/17.
10 | */
11 |
12 | class SimpleEmailSignupProvider extends EmailSignupProvider {
13 | SimpleEmailSignupProvider(boolean isValidationRequired) {
14 | super(isValidationRequired);
15 | }
16 |
17 | @Override
18 | public void doServerSignup(String username, String email, String password) {
19 | // need to set state signed-in in Argus here
20 | if(username.equals("valid@user.com") && password.equals("password")) {
21 | // do a real API call here and in on success do following
22 | if (context != null) {
23 | Toast.makeText(context, context.getString(R.string.signing_up),
24 | Toast.LENGTH_LONG).show();
25 | }
26 | } else {
27 | if (context != null) {
28 | Toast.makeText(context, context.getString(R.string.invalid_email),
29 | Toast.LENGTH_LONG).show();
30 | }
31 | }
32 | }
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/email-social-login-sample/src/main/java/com/moldedbits/argus/samples/email_social_login/SimpleForgotPasswordProvider.java:
--------------------------------------------------------------------------------
1 | package com.moldedbits.argus.samples.email_social_login;
2 |
3 | import com.moldedbits.argus.provider.ForgotPasswordProvider;
4 |
5 | public class SimpleForgotPasswordProvider extends ForgotPasswordProvider {
6 | @Override
7 | public void sendPasswordResetEmail(final String email) {
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/email-social-login-sample/src/main/java/com/moldedbits/argus/samples/email_social_login/api/ApiModule.java:
--------------------------------------------------------------------------------
1 | package com.moldedbits.argus.samples.email_social_login.api;
2 |
3 | import com.google.gson.FieldNamingPolicy;
4 | import com.google.gson.Gson;
5 | import com.google.gson.GsonBuilder;
6 | import com.moldedbits.argus.samples.email_social_login.BuildConfig;
7 |
8 | import java.io.IOException;
9 | import java.util.concurrent.TimeUnit;
10 |
11 | import javax.net.ssl.HostnameVerifier;
12 | import javax.net.ssl.SSLSession;
13 |
14 | import okhttp3.Interceptor;
15 | import okhttp3.OkHttpClient;
16 | import okhttp3.Request;
17 | import okhttp3.Response;
18 | import okhttp3.logging.HttpLoggingInterceptor;
19 | import retrofit2.Retrofit;
20 | import retrofit2.adapter.rxjava.RxJavaCallAdapterFactory;
21 | import retrofit2.converter.gson.GsonConverterFactory;
22 | import rx.schedulers.Schedulers;
23 |
24 | public class ApiModule {
25 |
26 | ApiService providesApiService() {
27 | OkHttpClient.Builder builder = new OkHttpClient.Builder();
28 | builder.hostnameVerifier(new HostnameVerifier() {
29 | @Override
30 | public boolean verify(String str, SSLSession sslSession) {
31 | return true;
32 | }
33 | });
34 |
35 | builder.connectTimeout(30, TimeUnit.SECONDS);
36 | builder.readTimeout(30, TimeUnit.SECONDS);
37 | builder.writeTimeout(30, TimeUnit.SECONDS);
38 |
39 | // Add headers
40 | builder.interceptors().add(new Interceptor() {
41 | @Override
42 | public Response intercept(Chain chain) throws IOException {
43 | Request request = chain.request();
44 |
45 | request = request.newBuilder()
46 | .addHeader("Authorization", "Basic YWRtaW46ZG90c2xhc2g=")
47 | .build();
48 | return chain.proceed(request);
49 |
50 | }
51 | });
52 |
53 | // Logging
54 | HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor();
55 | interceptor.setLevel(HttpLoggingInterceptor.Level.BODY);
56 | builder.interceptors().add(interceptor);
57 |
58 | Gson gson = new GsonBuilder()
59 | .setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES)
60 | .setDateFormat("yyyy-MM-dd")
61 | .create();
62 |
63 | RxJavaCallAdapterFactory rxAdapter = RxJavaCallAdapterFactory
64 | .createWithScheduler(Schedulers.io());
65 |
66 | Retrofit retrofit = new Retrofit.Builder()
67 | .baseUrl(BuildConfig.API_URL)
68 | .client(builder.build())
69 | .addConverterFactory(GsonConverterFactory.create(gson))
70 | .addCallAdapterFactory(rxAdapter)
71 | .build();
72 |
73 | return retrofit.create(ApiService.class);
74 | }
75 | }
--------------------------------------------------------------------------------
/email-social-login-sample/src/main/java/com/moldedbits/argus/samples/email_social_login/api/ApiService.java:
--------------------------------------------------------------------------------
1 | package com.moldedbits.argus.samples.email_social_login.api;
2 |
3 | public interface ApiService {
4 | }
5 |
--------------------------------------------------------------------------------
/email-social-login-sample/src/main/res/drawable-xxhdpi/argus_logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/moldedbits/argus-android/4e074bc975a3ba2d14d866cec972adc1e35eedad/email-social-login-sample/src/main/res/drawable-xxhdpi/argus_logo.png
--------------------------------------------------------------------------------
/email-social-login-sample/src/main/res/drawable-xxhdpi/login_bg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/moldedbits/argus-android/4e074bc975a3ba2d14d866cec972adc1e35eedad/email-social-login-sample/src/main/res/drawable-xxhdpi/login_bg.png
--------------------------------------------------------------------------------
/email-social-login-sample/src/main/res/drawable/bg.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/email-social-login-sample/src/main/res/drawable/button_bg.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
7 |
--------------------------------------------------------------------------------
/email-social-login-sample/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
13 |
14 |
--------------------------------------------------------------------------------
/email-social-login-sample/src/main/res/layout/custom_login_fragment.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
10 |
11 |
16 |
17 |
22 |
23 |
--------------------------------------------------------------------------------
/email-social-login-sample/src/main/res/layout/custom_signup_layout.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
12 |
13 |
18 |
19 |
24 |
25 |
--------------------------------------------------------------------------------
/email-social-login-sample/src/main/res/values-v21/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
17 |
18 |
22 |
--------------------------------------------------------------------------------
/email-social-login-sample/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #1c7e78
4 | #0e4541
5 | #fcfcfc
6 | #f1f1f1
7 | #f8f8cf
8 | #33f47d31
9 | #f58843
10 | #af092d2a
11 |
12 |
--------------------------------------------------------------------------------
/email-social-login-sample/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | ArgusEmailSocialLoginSample
3 | 538268433171885
4 | fb538268433171885
5 | Password length should be in between 4 to 8 characters.
6 | Please enter valid email address.
7 | Signing Up
8 | Welcome
9 | Skip Login
10 | Something went wrong
11 | Internet is either very slow or disconnected
12 | 519829002492-9ae71uje3i4lko42rn4ea1b7tcbh04rd.apps.googleusercontent.com
13 |
14 |
--------------------------------------------------------------------------------
/email-social-login-sample/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
15 |
16 |
20 |
21 |
--------------------------------------------------------------------------------
/email-social-login-sample/src/test/java/com/moldedbits/argus/samples/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.moldedbits.argus.samples;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() throws Exception {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/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 | org.gradle.jvmargs=-Xmx1536m
13 |
14 | # When configured, Gradle will run in incubating parallel mode.
15 | # This option should only be used with decoupled projects. More details, visit
16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
17 | # org.gradle.parallel=true
18 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/moldedbits/argus-android/4e074bc975a3ba2d14d866cec972adc1e35eedad/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Wed Apr 26 17:03:22 IST 2017
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-3.3-all.zip
7 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # Attempt to set APP_HOME
46 | # Resolve links: $0 may be a link
47 | PRG="$0"
48 | # Need this for relative symlinks.
49 | while [ -h "$PRG" ] ; do
50 | ls=`ls -ld "$PRG"`
51 | link=`expr "$ls" : '.*-> \(.*\)$'`
52 | if expr "$link" : '/.*' > /dev/null; then
53 | PRG="$link"
54 | else
55 | PRG=`dirname "$PRG"`"/$link"
56 | fi
57 | done
58 | SAVED="`pwd`"
59 | cd "`dirname \"$PRG\"`/" >/dev/null
60 | APP_HOME="`pwd -P`"
61 | cd "$SAVED" >/dev/null
62 |
63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
64 |
65 | # Determine the Java command to use to start the JVM.
66 | if [ -n "$JAVA_HOME" ] ; then
67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
68 | # IBM's JDK on AIX uses strange locations for the executables
69 | JAVACMD="$JAVA_HOME/jre/sh/java"
70 | else
71 | JAVACMD="$JAVA_HOME/bin/java"
72 | fi
73 | if [ ! -x "$JAVACMD" ] ; then
74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
75 |
76 | Please set the JAVA_HOME variable in your environment to match the
77 | location of your Java installation."
78 | fi
79 | else
80 | JAVACMD="java"
81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
82 |
83 | Please set the JAVA_HOME variable in your environment to match the
84 | location of your Java installation."
85 | fi
86 |
87 | # Increase the maximum file descriptors if we can.
88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
89 | MAX_FD_LIMIT=`ulimit -H -n`
90 | if [ $? -eq 0 ] ; then
91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
92 | MAX_FD="$MAX_FD_LIMIT"
93 | fi
94 | ulimit -n $MAX_FD
95 | if [ $? -ne 0 ] ; then
96 | warn "Could not set maximum file descriptor limit: $MAX_FD"
97 | fi
98 | else
99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
100 | fi
101 | fi
102 |
103 | # For Darwin, add options to specify how the application appears in the dock
104 | if $darwin; then
105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
106 | fi
107 |
108 | # For Cygwin, switch paths to Windows format before running java
109 | if $cygwin ; then
110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
112 | JAVACMD=`cygpath --unix "$JAVACMD"`
113 |
114 | # We build the pattern for arguments to be converted via cygpath
115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
116 | SEP=""
117 | for dir in $ROOTDIRSRAW ; do
118 | ROOTDIRS="$ROOTDIRS$SEP$dir"
119 | SEP="|"
120 | done
121 | OURCYGPATTERN="(^($ROOTDIRS))"
122 | # Add a user-defined pattern to the cygpath arguments
123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
125 | fi
126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
127 | i=0
128 | for arg in "$@" ; do
129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
131 |
132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
134 | else
135 | eval `echo args$i`="\"$arg\""
136 | fi
137 | i=$((i+1))
138 | done
139 | case $i in
140 | (0) set -- ;;
141 | (1) set -- "$args0" ;;
142 | (2) set -- "$args0" "$args1" ;;
143 | (3) set -- "$args0" "$args1" "$args2" ;;
144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
150 | esac
151 | fi
152 |
153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
154 | function splitJvmOpts() {
155 | JVM_OPTS=("$@")
156 | }
157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
159 |
160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
161 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/images/ArgusForgotPassword.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/moldedbits/argus-android/4e074bc975a3ba2d14d866cec972adc1e35eedad/images/ArgusForgotPassword.png
--------------------------------------------------------------------------------
/images/ArgusLogin.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/moldedbits/argus-android/4e074bc975a3ba2d14d866cec972adc1e35eedad/images/ArgusLogin.png
--------------------------------------------------------------------------------
/images/ArgusSignup.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/moldedbits/argus-android/4e074bc975a3ba2d14d866cec972adc1e35eedad/images/ArgusSignup.png
--------------------------------------------------------------------------------
/images/argus1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/moldedbits/argus-android/4e074bc975a3ba2d14d866cec972adc1e35eedad/images/argus1.png
--------------------------------------------------------------------------------
/images/argus2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/moldedbits/argus-android/4e074bc975a3ba2d14d866cec972adc1e35eedad/images/argus2.png
--------------------------------------------------------------------------------
/images/argus3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/moldedbits/argus-android/4e074bc975a3ba2d14d866cec972adc1e35eedad/images/argus3.png
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':email-login-signup-sample', ':argus', ':email-login-sample', ':email-social-login-sample'
--------------------------------------------------------------------------------