├── app
├── .gitignore
├── src
│ ├── main
│ │ ├── res
│ │ │ ├── drawable
│ │ │ │ └── logo.png
│ │ │ ├── values
│ │ │ │ ├── strings.xml
│ │ │ │ ├── colors.xml
│ │ │ │ └── styles.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
│ │ │ └── layout
│ │ │ │ └── activity_main.xml
│ │ ├── assets
│ │ │ └── Montserrat-Medium.ttf
│ │ ├── AndroidManifest.xml
│ │ └── java
│ │ │ └── com
│ │ │ └── sirvar
│ │ │ └── robin
│ │ │ └── demo
│ │ │ └── MainActivity.java
│ ├── test
│ │ └── java
│ │ │ └── com
│ │ │ └── sirvar
│ │ │ └── robin
│ │ │ └── demo
│ │ │ └── ExampleUnitTest.java
│ └── androidTest
│ │ └── java
│ │ └── com
│ │ └── sirvar
│ │ └── robin
│ │ └── demo
│ │ └── ExampleInstrumentedTest.java
├── proguard-rules.pro
└── build.gradle
├── robin
├── .gitignore
├── src
│ ├── main
│ │ ├── res
│ │ │ ├── drawable
│ │ │ │ ├── facebook.png
│ │ │ │ ├── google_light.png
│ │ │ │ └── button.xml
│ │ │ ├── values
│ │ │ │ ├── dimens.xml
│ │ │ │ └── strings.xml
│ │ │ └── layout
│ │ │ │ ├── activity_robin.xml
│ │ │ │ ├── fragment_forgot_password.xml
│ │ │ │ ├── fragment_signup.xml
│ │ │ │ └── fragment_login.xml
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── sirvar
│ │ │ │ └── robin
│ │ │ │ ├── Theme.java
│ │ │ │ ├── ForgotPasswordFragment.java
│ │ │ │ ├── SignupFragment.java
│ │ │ │ ├── LoginFragment.java
│ │ │ │ └── RobinActivity.java
│ │ └── AndroidManifest.xml
│ ├── test
│ │ └── java
│ │ │ └── com
│ │ │ └── sirvar
│ │ │ └── robin
│ │ │ └── ExampleUnitTest.java
│ └── androidTest
│ │ └── java
│ │ └── com
│ │ └── sirvar
│ │ └── robin
│ │ └── ExampleInstrumentedTest.java
├── proguard-rules.pro
└── build.gradle
├── settings.gradle
├── assets
├── logo.png
├── login.png
└── signup.png
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── .idea
├── copyright
│ └── profiles_settings.xml
├── encodings.xml
├── vcs.xml
├── modules.xml
├── runConfigurations.xml
├── gradle.xml
├── compiler.xml
└── misc.xml
├── .gitignore
├── .github
└── FUNDING.yml
├── gradle.properties
├── LICENSE
├── gradlew.bat
├── README.md
└── gradlew
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/robin/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app', ':robin'
2 |
--------------------------------------------------------------------------------
/assets/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sirvar/robin/HEAD/assets/logo.png
--------------------------------------------------------------------------------
/assets/login.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sirvar/robin/HEAD/assets/login.png
--------------------------------------------------------------------------------
/assets/signup.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sirvar/robin/HEAD/assets/signup.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sirvar/robin/HEAD/app/src/main/res/drawable/logo.png
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Demo
3 |
4 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sirvar/robin/HEAD/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/.idea/copyright/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/robin/src/main/res/drawable/facebook.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sirvar/robin/HEAD/robin/src/main/res/drawable/facebook.png
--------------------------------------------------------------------------------
/app/src/main/assets/Montserrat-Medium.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sirvar/robin/HEAD/app/src/main/assets/Montserrat-Medium.ttf
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sirvar/robin/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sirvar/robin/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sirvar/robin/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/robin/src/main/res/drawable/google_light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sirvar/robin/HEAD/robin/src/main/res/drawable/google_light.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sirvar/robin/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sirvar/robin/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/robin/src/main/java/com/sirvar/robin/Theme.java:
--------------------------------------------------------------------------------
1 | package com.sirvar.robin;
2 |
3 | public enum Theme {
4 | LIGHT,
5 | DARK;
6 | }
7 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sirvar/robin/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sirvar/robin/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sirvar/robin/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sirvar/robin/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sirvar/robin/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/.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 |
--------------------------------------------------------------------------------
/.idea/encodings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/robin/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 32dp
5 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #1BC19A
4 | #478384
5 | #0DBA91
6 |
7 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Wed May 17 21:12:05 EDT 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-4.0-milestone-1-all.zip
7 |
--------------------------------------------------------------------------------
/robin/src/main/res/drawable/button.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
11 |
--------------------------------------------------------------------------------
/robin/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/test/java/com/sirvar/robin/demo/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.sirvar.robin.demo;
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 | }
--------------------------------------------------------------------------------
/robin/src/test/java/com/sirvar/robin/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.sirvar.robin;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.assertEquals;
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 | }
--------------------------------------------------------------------------------
/robin/src/main/res/layout/activity_robin.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
11 |
12 |
--------------------------------------------------------------------------------
/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | # These are supported funding model platforms
2 |
3 | github: [sirvar] # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
4 | patreon: # Replace with a single Patreon username
5 | open_collective: # Replace with a single Open Collective username
6 | ko_fi: # Replace with a single Ko-fi username
7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9 | liberapay: # Replace with a single Liberapay username
10 | issuehunt: # Replace with a single IssueHunt username
11 | otechie: # Replace with a single Otechie username
12 | custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
13 |
--------------------------------------------------------------------------------
/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/sirvar/robin/demo/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.sirvar.robin.demo;
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.sirvar.robin.demo", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/robin/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Robin
3 | Email
4 | Password
5 | Sign In
6 | Don\'t have an account? Sign up
7 | Forgot Password
8 |
9 |
10 | Hello blank fragment
11 | Full Name
12 | Confirm Password
13 | Sign Up
14 | Already have an account? Sign in
15 | Reset Password
16 | Remember your password? Login
17 |
18 |
--------------------------------------------------------------------------------
/robin/src/androidTest/java/com/sirvar/robin/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.sirvar.robin;
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.assertEquals;
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.sirvar.robin.test", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/app/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/katyalrikin/Android SDK/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 |
--------------------------------------------------------------------------------
/robin/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/katyalrikin/Android SDK/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 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 25
5 | buildToolsVersion "25.0.2"
6 | defaultConfig {
7 | applicationId "com.sirvar.robin.demo"
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(':robin')
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 | compile 'com.android.support:appcompat-v7:25.3.1'
29 | compile 'com.android.support.constraint:constraint-layout:1.0.2'
30 | testCompile 'junit:junit:4.12'
31 | }
32 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2017 Rikin Katyal
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/robin/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 |
3 | android {
4 | compileSdkVersion 25
5 | buildToolsVersion "25.0.2"
6 |
7 | defaultConfig {
8 | minSdkVersion 16
9 | targetSdkVersion 25
10 | versionCode 1
11 | versionName "1.0"
12 |
13 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
14 |
15 | }
16 | buildTypes {
17 | release {
18 | minifyEnabled false
19 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
20 | }
21 | }
22 | }
23 |
24 | dependencies {
25 | compile fileTree(dir: 'libs', include: ['*.jar'])
26 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
27 | exclude group: 'com.android.support', module: 'support-annotations'
28 | })
29 | compile 'com.android.support:appcompat-v7:25.3.1'
30 | compile 'com.android.support:design:25.3.1'
31 | compile 'com.android.support.constraint:constraint-layout:1.0.2'
32 | compile 'com.android.support:support-v4:25.3.1'
33 | testCompile 'junit:junit:4.12'
34 | }
35 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/app/src/main/java/com/sirvar/robin/demo/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.sirvar.robin.demo;
2 |
3 | import android.graphics.Typeface;
4 | import android.os.Bundle;
5 | import android.widget.Toast;
6 |
7 | import com.sirvar.robin.RobinActivity;
8 | import com.sirvar.robin.Theme;
9 |
10 | public class MainActivity extends RobinActivity {
11 |
12 | @Override
13 | protected void onCreate(Bundle savedInstanceState) {
14 | super.onCreate(savedInstanceState);
15 |
16 | setLoginTitle("Sign in to Robin");
17 | setSignupTitle("Welcome to Robin");
18 | setForgotPasswordTitle("Forgot Password");
19 | setImage(getResources().getDrawable(R.drawable.logo));
20 | setFont(Typeface.createFromAsset(getAssets(), "Montserrat-Medium.ttf"));
21 | setTheme(Theme.LIGHT);
22 | enableSocialLogin();
23 | showLoginFirst();
24 | }
25 |
26 | @Override
27 | protected void onLogin(String email, String password) {
28 | Toast.makeText(getApplicationContext(), "Login", Toast.LENGTH_SHORT).show();
29 | }
30 |
31 | @Override
32 | protected void onSignup(String name, String email, String password) {
33 | Toast.makeText(getApplicationContext(), "Signup", Toast.LENGTH_SHORT).show();
34 | // Make API call
35 | }
36 |
37 | @Override
38 | protected void onForgotPassword(String email) {
39 | Toast.makeText(getApplicationContext(), "Forgot Password", Toast.LENGTH_SHORT).show();
40 | // Make API call
41 | // After sent password email callback
42 | startLoginFragment();
43 | }
44 |
45 | @Override
46 | protected void onGoogleLogin() {
47 | Toast.makeText(getApplicationContext(), "Google", Toast.LENGTH_SHORT).show();
48 | }
49 |
50 | @Override
51 | protected void onFacebookLogin() {
52 | Toast.makeText(getApplicationContext(), "Facebook", Toast.LENGTH_SHORT).show();
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |

2 |
3 | 🚀 Android login, made simple
4 |
5 |
6 |
7 |
8 |
9 |
10 | Almost every app has a login and signup, so why do we re-write code everytime? Let robin handle that for you.
11 |
12 |  
13 |
14 | # Usage
15 | Add this to your **build.gradle**
16 |
17 | ```groovy
18 | compile 'com.sirvar:robin:0.0.1'
19 | ```
20 |
21 | Create a new activity to handle login and signup requests that extends **RobinActivity**
22 |
23 | ```java
24 | public class MainActivity extends RobinActivity {
25 |
26 | @Override
27 | protected void onCreate(Bundle savedInstanceState) {
28 | super.onCreate(savedInstanceState);
29 | // DO NOT call setContentView();
30 |
31 | // Set title for each screen
32 | setLoginTitle("Sign in to Robin");
33 | setSignupTitle("Welcome to Robin");
34 | setForgotPasswordTitle("Forgot Password");
35 |
36 | // Set logo for screens
37 | setImage(getResources().getDrawable(R.mipmap.ic_launcher));
38 |
39 | // Use custom font across all views
40 | setFont(Typeface.createFromAsset(getAssets(), "Montserrat-Medium.ttf"));
41 |
42 | // Choose theme (default is LIGHT)
43 | setTheme(Theme.LIGHT);
44 | }
45 | }
46 | ```
47 |
48 | ## Configuration Options
49 | | Method | Description |
50 | | ------ | -----------:|
51 | | `setLoginTitle(String title)` | Set the title of the login screen |
52 | | `setSignupTitle(String title)` | Set the title of the signup screen |
53 | | `setForgotPasswordTitle(String title)` | Set the title of the forgot password screen |
54 | | `setTheme(Theme theme)` | Set theme from Theme enum, options above |
55 | | `setImage(Drawable image)` | Set the Drawable image of all screens |
56 | | `setImage(Bitmap image)` | Set the Bitmap image of all screens |
57 | | `setFont(Typeface typeface)` | Set custom typeface to use across all screens |
58 | | `startLoginFragment()` | Changes the visible fragment to login |
59 | | `startSignupFragment()` | Changes the visible fragment to signup |
60 | | `startForgotPasswordFragment()` | Changes the visible fragment to forgot password |
61 | | `showLoginFirst()` | Shows login fragment on Activity launch |
62 | | `showSignupFirst()` | Shows signup fragment on Activity launch |
63 | | `enableSocialLogin()` | Displays Google and Facebook login buttons |
64 | | `disableSocialLogin()` | Hides Google and Facebook login buttons |
65 |
66 | ## Override Methods
67 | ```java
68 | onLogin(String email, String password)
69 | ```
70 | ```java
71 | onSignup(String name, String email, String password)
72 | ```
73 | ```java
74 | onForgotPassword(String email)
75 | ```
76 | ```java
77 | onGoogleLogin()
78 | ```
79 | ```java
80 | onFacebookLogin()
81 | ```
82 |
83 | ## Contributing
84 | Want to design a new theme for robin? Follow the same format as previously done and make a PR! Also update the README adding the new theme and give yourself credit right next to it!
85 |
--------------------------------------------------------------------------------
/robin/src/main/res/layout/fragment_forgot_password.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
14 |
15 |
23 |
24 |
31 |
32 |
41 |
42 |
50 |
51 |
52 |
64 |
65 |
76 |
77 |
78 |
79 |
80 |
--------------------------------------------------------------------------------
/robin/src/main/java/com/sirvar/robin/ForgotPasswordFragment.java:
--------------------------------------------------------------------------------
1 | package com.sirvar.robin;
2 |
3 | import android.graphics.Bitmap;
4 | import android.graphics.Typeface;
5 | import android.graphics.drawable.Drawable;
6 | import android.os.Bundle;
7 | import android.support.design.widget.TextInputLayout;
8 | import android.support.v4.app.Fragment;
9 | import android.view.LayoutInflater;
10 | import android.view.View;
11 | import android.view.ViewGroup;
12 | import android.widget.Button;
13 | import android.widget.EditText;
14 | import android.widget.ImageButton;
15 | import android.widget.ImageView;
16 | import android.widget.TextView;
17 |
18 | /**
19 | * A simple {@link Fragment} subclass.
20 | */
21 | public class ForgotPasswordFragment extends Fragment {
22 |
23 | private TextView title;
24 | private TextView login;
25 | private ImageView logo;
26 | private EditText email;
27 | private TextInputLayout emailWrapper;
28 | private Button submit;
29 | private Typeface typeface;
30 | private String titleText;
31 | private Drawable logoDrawable;
32 | private Bitmap logoBitmap;
33 |
34 | public ForgotPasswordFragment() {
35 | // Required empty public constructor
36 | }
37 |
38 | @Override
39 | public View onCreateView(LayoutInflater inflater, ViewGroup container,
40 | Bundle savedInstanceState) {
41 | // Inflate the layout for this fragment
42 | View view = inflater.inflate(R.layout.fragment_forgot_password, container, false);
43 |
44 | // Initialize views
45 | title = (TextView) view.findViewById(R.id.title);
46 | login = (TextView) view.findViewById(R.id.login);
47 | logo = (ImageView) view.findViewById(R.id.logo);
48 | email = (EditText) view.findViewById(R.id.email);
49 | emailWrapper = (TextInputLayout) view.findViewById(R.id.wrapper_email);
50 | submit = (Button) view.findViewById(R.id.submit);
51 |
52 | submit.setOnClickListener(new View.OnClickListener() {
53 | @Override
54 | public void onClick(View v) {
55 | ((RobinActivity) getActivity()).onForgotPassword(email.getText().toString());
56 | }
57 | });
58 |
59 | login.setOnClickListener(new View.OnClickListener() {
60 | @Override
61 | public void onClick(View v) {
62 | ((RobinActivity) getActivity()).startLoginFragment();
63 | }
64 | });
65 |
66 | setDefaults();
67 |
68 | return view;
69 | }
70 |
71 | /**
72 | * Get title for fragment
73 | *
74 | * @param titleText fragment title
75 | */
76 | public void setTitle(String titleText) {
77 | this.titleText = titleText;
78 | }
79 |
80 | /**
81 | * Set title for fragment
82 | */
83 | private void setTitle() {
84 | title.setText(titleText);
85 | }
86 |
87 | /**
88 | * Get drawable image for logo
89 | *
90 | * @param drawable drawable logo
91 | */
92 | public void setImage(Drawable drawable) {
93 | logoDrawable = drawable;
94 | }
95 |
96 | /**
97 | * Set bitmap image for logo
98 | *
99 | * @param bitmap bitmap logo
100 | */
101 | public void setImage(Bitmap bitmap) {
102 | logoBitmap = bitmap;
103 | }
104 |
105 | /**
106 | * Set image for logo
107 | */
108 | private void setImage() {
109 | if (logoDrawable != null) {
110 | logo.setImageDrawable(logoDrawable);
111 | } else if (logoBitmap != null) {
112 | logo.setImageBitmap(logoBitmap);
113 | }
114 | }
115 |
116 | /**
117 | * Get custom font for all Views
118 | *
119 | * @param typeface custom typeface
120 | */
121 | public void setFont(Typeface typeface) {
122 | this.typeface = typeface;
123 | }
124 |
125 | /**
126 | * Set custom font for all Views
127 | */
128 | private void setFont() {
129 | title.setTypeface(typeface);
130 | login.setTypeface(typeface);
131 | email.setTypeface(typeface);
132 | emailWrapper.setTypeface(typeface);
133 | submit.setTypeface(typeface);
134 | }
135 |
136 | private void setDefaults() {
137 | setTitle();
138 | setImage();
139 | setFont();
140 | }
141 | }
142 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/robin/src/main/java/com/sirvar/robin/SignupFragment.java:
--------------------------------------------------------------------------------
1 | package com.sirvar.robin;
2 |
3 | import android.graphics.Bitmap;
4 | import android.graphics.Typeface;
5 | import android.graphics.drawable.Drawable;
6 | import android.os.Bundle;
7 | import android.support.design.widget.TextInputLayout;
8 | import android.support.v4.app.Fragment;
9 | import android.util.Log;
10 | import android.view.LayoutInflater;
11 | import android.view.View;
12 | import android.view.ViewGroup;
13 | import android.widget.Button;
14 | import android.widget.EditText;
15 | import android.widget.ImageView;
16 | import android.widget.TextView;
17 | import android.widget.Toast;
18 |
19 | public class SignupFragment extends Fragment {
20 |
21 | private TextView title;
22 | private TextView login;
23 | private ImageView logo;
24 | private EditText name;
25 | private EditText email;
26 | private EditText password;
27 | private EditText confirmPassword;
28 | private TextInputLayout nameWrapper;
29 | private TextInputLayout emailWrapper;
30 | private TextInputLayout passwordWrapper;
31 | private TextInputLayout confirmPasswordWrapper;
32 | private Button submit;
33 |
34 | private Typeface typeface;
35 | private String titleText;
36 | private Drawable logoDrawable;
37 | private Bitmap logoBitmap;
38 |
39 | public SignupFragment() {
40 | // Required empty public constructor
41 | }
42 |
43 | @Override
44 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
45 | // Inflate the layout for this fragment
46 | View view = inflater.inflate(R.layout.fragment_signup, container, false);
47 |
48 | // Initialize views
49 | title = (TextView) view.findViewById(R.id.title);
50 | login = (TextView) view.findViewById(R.id.login);
51 | logo = (ImageView) view.findViewById(R.id.logo);
52 | name = (EditText) view.findViewById(R.id.name);
53 | email = (EditText) view.findViewById(R.id.email);
54 | password = (EditText) view.findViewById(R.id.password);
55 | confirmPassword = (EditText) view.findViewById(R.id.confirm_password);
56 | nameWrapper = (TextInputLayout) view.findViewById(R.id.wrapper_name);
57 | emailWrapper = (TextInputLayout) view.findViewById(R.id.wrapper_email);
58 | passwordWrapper = (TextInputLayout) view.findViewById(R.id.wrapper_password);
59 | confirmPasswordWrapper = (TextInputLayout) view.findViewById(R.id.wrapper_confirm_password);
60 | submit = (Button) view.findViewById(R.id.submit);
61 |
62 | login.setOnClickListener(new View.OnClickListener() {
63 | @Override
64 | public void onClick(View v) {
65 | ((RobinActivity) getActivity()).startLoginFragment();
66 | }
67 | });
68 |
69 | submit.setOnClickListener(new View.OnClickListener() {
70 | @Override
71 | public void onClick(View v) {
72 | if (fieldsFilled()) {
73 | ((RobinActivity) getActivity()).onSignup(name.getText().toString(), email.getText().toString(), password.getText().toString());
74 | } else {
75 | Toast.makeText(getActivity().getApplicationContext(), "Some information is missing.", Toast.LENGTH_SHORT).show();
76 | }
77 | }
78 | });
79 |
80 | setDefaults();
81 |
82 | return view;
83 | }
84 |
85 | /**
86 | * Get title for fragment
87 | *
88 | * @param titleText fragment title
89 | */
90 | public void setTitle(String titleText) {
91 | this.titleText = titleText;
92 | }
93 |
94 | /**
95 | * Set title for fragment
96 | */
97 | private void setTitle() {
98 | title.setText(titleText);
99 | }
100 |
101 | /**
102 | * Get drawable image for logo
103 | *
104 | * @param drawable drawable logo
105 | */
106 | public void setImage(Drawable drawable) {
107 | logoDrawable = drawable;
108 | }
109 |
110 | /**
111 | * Set bitmap image for logo
112 | *
113 | * @param bitmap bitmap logo
114 | */
115 | public void setImage(Bitmap bitmap) {
116 | logoBitmap = bitmap;
117 | }
118 |
119 | /**
120 | * Set image for logo
121 | */
122 | private void setImage() {
123 | if (logoDrawable != null) {
124 | logo.setImageDrawable(logoDrawable);
125 | } else if (logoBitmap != null) {
126 | logo.setImageBitmap(logoBitmap);
127 | }
128 | }
129 |
130 | /**
131 | * Get custom font for all Views
132 | *
133 | * @param typeface custom typeface
134 | */
135 | protected void setFont(Typeface typeface) {
136 | this.typeface = typeface;
137 | }
138 |
139 | /**
140 | * Set custom font for all Views
141 | */
142 | private void setFont() {
143 | title.setTypeface(typeface);
144 | login.setTypeface(typeface);
145 | name.setTypeface(typeface);
146 | email.setTypeface(typeface);
147 | password.setTypeface(typeface);
148 | confirmPassword.setTypeface(typeface);
149 | nameWrapper.setTypeface(typeface);
150 | emailWrapper.setTypeface(typeface);
151 | passwordWrapper.setTypeface(typeface);
152 | confirmPasswordWrapper.setTypeface(typeface);
153 | submit.setTypeface(typeface);
154 | }
155 |
156 | private boolean fieldsFilled() {
157 | return (!(name.getText().toString().isEmpty() || email.getText().toString().isEmpty() || password.getText().toString().isEmpty()) && (password.getText().toString().equals(confirmPassword.getText().toString())));
158 | }
159 |
160 | private void setDefaults() {
161 | setTitle();
162 | setFont();
163 | setImage();
164 | }
165 | }
166 |
--------------------------------------------------------------------------------
/robin/src/main/res/layout/fragment_signup.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
14 |
15 |
23 |
24 |
31 |
32 |
41 |
42 |
50 |
51 |
52 |
61 |
62 |
70 |
71 |
72 |
81 |
82 |
90 |
91 |
92 |
101 |
102 |
110 |
111 |
112 |
124 |
125 |
136 |
137 |
138 |
139 |
140 |
--------------------------------------------------------------------------------
/robin/src/main/java/com/sirvar/robin/LoginFragment.java:
--------------------------------------------------------------------------------
1 | package com.sirvar.robin;
2 |
3 | import android.graphics.Bitmap;
4 | import android.graphics.Typeface;
5 | import android.graphics.drawable.Drawable;
6 | import android.media.Image;
7 | import android.os.Bundle;
8 | import android.support.design.widget.TextInputLayout;
9 | import android.support.v4.app.Fragment;
10 | import android.util.Log;
11 | import android.view.LayoutInflater;
12 | import android.view.View;
13 | import android.view.ViewGroup;
14 | import android.widget.Button;
15 | import android.widget.EditText;
16 | import android.widget.ImageButton;
17 | import android.widget.ImageView;
18 | import android.widget.TextView;
19 | import android.widget.Toast;
20 |
21 | public class LoginFragment extends Fragment {
22 |
23 | private TextView title;
24 | private TextView signup;
25 | private TextView forgotPassword;
26 | private ImageView logo;
27 | private EditText email;
28 | private EditText password;
29 | private TextInputLayout emailWrapper;
30 | private TextInputLayout passwordWrapper;
31 | private Button submit;
32 |
33 | private ImageButton google;
34 | private ImageButton facebook;
35 | private boolean showLogin;
36 |
37 | private Typeface typeface;
38 | private String titleText;
39 | private Drawable logoDrawable;
40 | private Bitmap logoBitmap;
41 |
42 | public LoginFragment() {
43 | // Required empty public constructor
44 | }
45 |
46 | @Override
47 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
48 | // Inflate the layout for this fragment
49 | View view = inflater.inflate(R.layout.fragment_login, container, false);
50 |
51 | // Initialize views
52 | title = (TextView) view.findViewById(R.id.title);
53 | signup = (TextView) view.findViewById(R.id.signup);
54 | forgotPassword = (TextView) view.findViewById(R.id.forgotPassword);
55 | logo = (ImageView) view.findViewById(R.id.logo);
56 | email = (EditText) view.findViewById(R.id.email);
57 | password = (EditText) view.findViewById(R.id.password);
58 | emailWrapper = (TextInputLayout) view.findViewById(R.id.wrapper_email);
59 | passwordWrapper = (TextInputLayout) view.findViewById(R.id.wrapper_password);
60 | submit = (Button) view.findViewById(R.id.submit);
61 | google = (ImageButton) view.findViewById(R.id.google_login);
62 | facebook = (ImageButton) view.findViewById(R.id.facebook_login);
63 |
64 | // Login form submitted
65 | submit.setOnClickListener(new View.OnClickListener() {
66 | @Override
67 | public void onClick(View v) {
68 | if (fieldsFilled()) {
69 | ((RobinActivity) getActivity()).onLogin(email.getText().toString(), password.getText().toString());
70 | } else {
71 | Toast.makeText(getContext(), "Some information is missing.", Toast.LENGTH_SHORT).show();
72 | }
73 | }
74 | });
75 |
76 | google.setOnClickListener(new View.OnClickListener() {
77 | @Override
78 | public void onClick(View v) {
79 | ((RobinActivity) getActivity()).onGoogleLogin();
80 | }
81 | });
82 |
83 | facebook.setOnClickListener(new View.OnClickListener() {
84 | @Override
85 | public void onClick(View v) {
86 | ((RobinActivity) getActivity()).onFacebookLogin();
87 | }
88 | });
89 |
90 | forgotPassword.setOnClickListener(new View.OnClickListener() {
91 | @Override
92 | public void onClick(View v) {
93 | ((RobinActivity) getActivity()).startForgotPasswordFragment();
94 | }
95 | });
96 |
97 | signup.setOnClickListener(new View.OnClickListener() {
98 | @Override
99 | public void onClick(View v) {
100 | ((RobinActivity) getActivity()).startSignupFragment();
101 | }
102 | });
103 |
104 | if (!showLogin) {
105 | google.setVisibility(View.INVISIBLE);
106 | facebook.setVisibility(View.INVISIBLE);
107 | }
108 |
109 | setDefaults();
110 |
111 | return view;
112 | }
113 |
114 | /**
115 | * Get title for fragment
116 | *
117 | * @param titleText fragment title
118 | */
119 | public void setTitle(String titleText) {
120 | this.titleText = titleText;
121 | }
122 |
123 | /**
124 | * Set title for fragment
125 | */
126 | private void setTitle() {
127 | title.setText(titleText);
128 | }
129 |
130 | /**
131 | * Get drawable image for logo
132 | *
133 | * @param drawable drawable logo
134 | */
135 | public void setImage(Drawable drawable) {
136 | logoDrawable = drawable;
137 | }
138 |
139 | /**
140 | * Set bitmap image for logo
141 | *
142 | * @param bitmap bitmap logo
143 | */
144 | public void setImage(Bitmap bitmap) {
145 | logoBitmap = bitmap;
146 | }
147 |
148 | /**
149 | * Set image for logo
150 | */
151 | private void setImage() {
152 | if (logoDrawable != null) {
153 | logo.setImageDrawable(logoDrawable);
154 | } else if (logoBitmap != null) {
155 | logo.setImageBitmap(logoBitmap);
156 | }
157 | }
158 |
159 | /**
160 | * Get custom font for all Views
161 | *
162 | * @param typeface custom typeface
163 | */
164 | public void setFont(Typeface typeface) {
165 | this.typeface = typeface;
166 | }
167 |
168 | /**
169 | * Set custom font for all Views
170 | */
171 | private void setFont() {
172 | title.setTypeface(typeface);
173 | signup.setTypeface(typeface);
174 | forgotPassword.setTypeface(typeface);
175 | email.setTypeface(typeface);
176 | password.setTypeface(typeface);
177 | emailWrapper.setTypeface(typeface);
178 | passwordWrapper.setTypeface(typeface);
179 | submit.setTypeface(typeface);
180 | }
181 |
182 | protected void showSocialLogin(boolean showLogin) {
183 | this.showLogin = showLogin;
184 | }
185 |
186 | private boolean fieldsFilled() {
187 | return !(email.getText().toString().isEmpty() || password.getText().toString().isEmpty());
188 | }
189 |
190 | private void setDefaults() {
191 | setTitle();
192 | setFont();
193 | setImage();
194 | }
195 |
196 | }
197 |
--------------------------------------------------------------------------------
/robin/src/main/java/com/sirvar/robin/RobinActivity.java:
--------------------------------------------------------------------------------
1 | package com.sirvar.robin;
2 |
3 | import android.graphics.Bitmap;
4 | import android.graphics.Typeface;
5 | import android.graphics.drawable.Drawable;
6 | import android.media.Image;
7 | import android.os.Bundle;
8 | import android.support.v7.app.AppCompatActivity;
9 | import android.widget.ImageButton;
10 | import android.widget.ImageView;
11 |
12 | public abstract class RobinActivity extends AppCompatActivity {
13 |
14 | private LoginFragment loginFragment;
15 | private SignupFragment signupFragment;
16 | private ForgotPasswordFragment forgotPasswordFragment;
17 |
18 | private String loginTitle;
19 | private String signupTitle;
20 | private String forgotPasswordTitle;
21 | private Drawable logoDrawable;
22 | private Bitmap logoBitmap;
23 | private Typeface typeface;
24 |
25 | private boolean loginFirst = true;
26 | private boolean socialLogin = true;
27 |
28 | private Theme theme;
29 |
30 | @Override
31 | protected void onCreate(Bundle savedInstanceState) {
32 | super.onCreate(savedInstanceState);
33 | setContentView(R.layout.activity_robin);
34 |
35 | // Don't show toolbar
36 | getSupportActionBar().hide();
37 |
38 | loginFragment = new LoginFragment();
39 | signupFragment = new SignupFragment();
40 | forgotPasswordFragment = new ForgotPasswordFragment();
41 |
42 | setDefaults();
43 | }
44 |
45 | /**
46 | * Override form login
47 | *
48 | * @param email username or email address entered by user
49 | * @param password raw password
50 | */
51 | protected abstract void onLogin(String email, String password);
52 |
53 | /**
54 | * Override form signup
55 | *
56 | * @param email username or email address entered by user
57 | * @param password raw password
58 | */
59 | protected abstract void onSignup(String name, String email, String password);
60 |
61 | /**
62 | * Override form forgot password
63 | *
64 | * @param email username or email address entered by user
65 | */
66 | protected abstract void onForgotPassword(String email);
67 |
68 | /**
69 | * Override form Google login
70 | */
71 | protected abstract void onGoogleLogin();
72 |
73 | /**
74 | * Override form Facebook login
75 | */
76 | protected abstract void onFacebookLogin();
77 |
78 | /**
79 | * Enables social login button
80 | */
81 | protected void enableSocialLogin() {
82 | socialLogin = true;
83 | loginFragment.showSocialLogin(socialLogin);
84 | }
85 |
86 | /**
87 | * Hides social login buttons
88 | */
89 | protected void disableSocialLogin() {
90 | socialLogin = false;
91 | loginFragment.showSocialLogin(socialLogin);
92 | }
93 |
94 | protected void showLoginFirst() {
95 | loginFirst = true;
96 | if (findViewById(R.id.fragment_container) != null) {
97 | startLoginFragment();
98 | }
99 | }
100 |
101 | protected void showSignupFirst() {
102 | loginFirst = false;
103 | if (findViewById(R.id.fragment_container) != null) {
104 | startSignupFragment();
105 | }
106 | }
107 |
108 | /**
109 | * Launches login fragment
110 | */
111 | protected void startLoginFragment() {
112 | getSupportFragmentManager()
113 | .beginTransaction()
114 | .replace(R.id.fragment_container, loginFragment)
115 | .commit();
116 | }
117 |
118 | /**
119 | * Launches forgot password fragment
120 | */
121 | protected void startForgotPasswordFragment() {
122 | getSupportFragmentManager()
123 | .beginTransaction()
124 | .replace(R.id.fragment_container, forgotPasswordFragment)
125 | .commit();
126 | }
127 |
128 | /**
129 | * Launches signup fragment
130 | */
131 | protected void startSignupFragment() {
132 | getSupportFragmentManager()
133 | .beginTransaction()
134 | .replace(R.id.fragment_container, signupFragment)
135 | .commit();
136 | }
137 |
138 | /**
139 | * Set title for login fragment
140 | *
141 | * @param title login title
142 | */
143 | protected void setLoginTitle(String title) {
144 | loginTitle = title;
145 | loginFragment.setTitle(loginTitle);
146 | }
147 |
148 | /**
149 | * Set title for signup fragment
150 | *
151 | * @param title login title
152 | */
153 | protected void setSignupTitle(String title) {
154 | signupTitle = title;
155 | signupFragment.setTitle(signupTitle);
156 | }
157 |
158 | /**
159 | * Set title for forgot password fragment
160 | *
161 | * @param title login title
162 | */
163 | protected void setForgotPasswordTitle(String title) {
164 | forgotPasswordTitle = title;
165 | forgotPasswordFragment.setTitle(forgotPasswordTitle);
166 | }
167 |
168 | /**
169 | * Set theme for activity
170 | *
171 | * @param theme from list of themes in enum
172 | */
173 | protected void setTheme(Theme theme) {
174 | this.theme = theme;
175 | }
176 |
177 | /**
178 | * Set drawable image for logo
179 | *
180 | * @param drawable drawable logo
181 | */
182 | protected void setImage(Drawable drawable) {
183 | logoDrawable = drawable;
184 | loginFragment.setImage(logoDrawable);
185 | signupFragment.setImage(logoDrawable);
186 | forgotPasswordFragment.setImage(logoDrawable);
187 | }
188 |
189 | /**
190 | * Set bitmap image for logo
191 | *
192 | * @param bitmap bitmap logo
193 | */
194 | protected void setImage(Bitmap bitmap) {
195 | logoBitmap = bitmap;
196 | loginFragment.setImage(logoBitmap);
197 | signupFragment.setImage(logoBitmap);
198 | forgotPasswordFragment.setImage(logoBitmap);
199 | }
200 |
201 | /**
202 | * Use custom font for all Views
203 | *
204 | * @param typeface custom typeface
205 | */
206 | protected void setFont(Typeface typeface) {
207 | this.typeface = typeface;
208 | loginFragment.setFont(typeface);
209 | signupFragment.setFont(typeface);
210 | forgotPasswordFragment.setFont(typeface);
211 | }
212 |
213 | /**
214 | * Set default values
215 | */
216 | private void setDefaults() {
217 | showLoginFirst();
218 | theme = Theme.LIGHT;
219 | }
220 | }
221 |
--------------------------------------------------------------------------------
/robin/src/main/res/layout/fragment_login.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
14 |
15 |
23 |
24 |
31 |
32 |
41 |
42 |
50 |
51 |
52 |
57 |
58 |
66 |
67 |
75 |
76 |
77 |
87 |
88 |
89 |
101 |
102 |
110 |
119 |
120 |
129 |
130 |
131 |
142 |
143 |
144 |
145 |
146 |
--------------------------------------------------------------------------------