Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
*.iml
.gradle
/local.properties
/.idea/
/.idea/workspace.xml
/.idea/libraries
.DS_Store
Expand Down
5 changes: 1 addition & 4 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 14 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,22 @@ Almost every app has a login and signup, so why do we re-write code everytime? L
![login](https://raw.githubusercontent.com/sirvar/robin/master/assets/login.png) ![signup](https://raw.githubusercontent.com/sirvar/robin/master/assets/signup.png)

# Usage
Add this to your **build.gradle**
Add it in your root build.gradle at the end of repositories:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't add instructions for your own hosted artifact to the README

```groovy
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
```
Add the dependency

```groovy
compile 'com.sirvar:robin:0.0.1'
dependencies {
compile 'com.github.dustedrob:robin:-SNAPSHOT'
}

```

Create a new activity to handle login and signup requests that extends **RobinActivity**
Expand Down
14 changes: 9 additions & 5 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
compileSdkVersion 27
buildToolsVersion '27.0.3'
defaultConfig {
applicationId "com.sirvar.robin.demo"
minSdkVersion 16
targetSdkVersion 25
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
Expand All @@ -17,15 +17,19 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}

dependencies {
compile project(':robin')
compile fileTree(dir: 'libs', include: ['*.jar'])
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:appcompat-v7:27.0.2'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
}
33 changes: 28 additions & 5 deletions app/src/main/java/com/sirvar/robin/demo/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@

import android.graphics.Typeface;
import android.os.Bundle;
import android.view.View;
import android.widget.Toast;

import com.sirvar.robin.LoginFragment;
import com.sirvar.robin.RobinActivity;
import com.sirvar.robin.SignupFragment;
import com.sirvar.robin.Theme;

public class MainActivity extends RobinActivity {
Expand All @@ -24,31 +27,51 @@ protected void onCreate(Bundle savedInstanceState) {
}

@Override
protected void onLogin(String email, String password) {
public void onSignupFragmentCreated(SignupFragment signupFragment) {
// Example on how to customize the Signup Fragment. If a text input is not
// visible, it won't be validated when the form is submitted
// signupFragment.setNameField(View.VISIBLE,"Your name");
// signupFragment.setEmailField(View.VISIBLE,"Your email");
// signupFragment.setPasswordField(View.GONE,null);
}


@Override
public void onLoginFragmentCreated(LoginFragment loginFragment) {
// Example on how to customize the LoginFragment
// loginFragment.setEmailField(View.VISIBLE,"your email");
// loginFragment.setPasswordField(View.GONE,null);



}

@Override
public void onLogin(String email, String password) {
Toast.makeText(getApplicationContext(), "Login", Toast.LENGTH_SHORT).show();
}

@Override
protected void onSignup(String name, String email, String password) {
public void onSignup(String name, String email, String password) {
Toast.makeText(getApplicationContext(), "Signup", Toast.LENGTH_SHORT).show();
// Make API call
}

@Override
protected void onForgotPassword(String email) {
public void onForgotPassword(String email) {
Toast.makeText(getApplicationContext(), "Forgot Password", Toast.LENGTH_SHORT).show();
// Make API call
// After sent password email callback
startLoginFragment();
}

@Override
protected void onGoogleLogin() {
public void onGoogleLogin() {
Toast.makeText(getApplicationContext(), "Google", Toast.LENGTH_SHORT).show();
}

@Override
protected void onFacebookLogin() {
public void onFacebookLogin() {
Toast.makeText(getApplicationContext(), "Facebook", Toast.LENGTH_SHORT).show();
}
}
4 changes: 3 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
classpath 'com.android.tools.build:gradle:3.0.1'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand All @@ -15,6 +16,7 @@ buildscript {
allprojects {
repositories {
jcenter()
google()
}
}

Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Wed May 17 21:12:05 EDT 2017
#Wed Jan 17 12:36:42 CST 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.0-milestone-1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
18 changes: 11 additions & 7 deletions robin/build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
apply plugin: 'com.android.library'

android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
compileSdkVersion 27
buildToolsVersion "27.0.3"

defaultConfig {
minSdkVersion 16
targetSdkVersion 25
targetSdkVersion 27
versionCode 1
versionName "1.0"

Expand All @@ -19,16 +19,20 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support:appcompat-v7:27.0.2'
compile 'com.android.support:design:27.0.2'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:support-v4:25.3.1'
compile 'com.android.support:support-v4:27.0.2'
testCompile 'junit:junit:4.12'
}
30 changes: 10 additions & 20 deletions robin/src/main/java/com/sirvar/robin/ForgotPasswordFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,26 +42,16 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
View view = inflater.inflate(R.layout.fragment_forgot_password, container, false);

// Initialize views
title = (TextView) view.findViewById(R.id.title);
login = (TextView) view.findViewById(R.id.login);
logo = (ImageView) view.findViewById(R.id.logo);
email = (EditText) view.findViewById(R.id.email);
emailWrapper = (TextInputLayout) view.findViewById(R.id.wrapper_email);
submit = (Button) view.findViewById(R.id.submit);

submit.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
((RobinActivity) getActivity()).onForgotPassword(email.getText().toString());
}
});

login.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
((RobinActivity) getActivity()).startLoginFragment();
}
});
title = view.findViewById(R.id.title);
login = view.findViewById(R.id.login);
logo = view.findViewById(R.id.logo);
email = view.findViewById(R.id.email);
emailWrapper = view.findViewById(R.id.wrapper_email);
submit = view.findViewById(R.id.submit);

submit.setOnClickListener(v -> ((RobinActivity) getActivity()).onForgotPassword(email.getText().toString()));

login.setOnClickListener(v -> ((RobinActivity) getActivity()).startLoginFragment());

setDefaults();

Expand Down
Loading