Showing
43 changed files
with
1109 additions
and
0 deletions
.gitignore
0 → 100644
.idea/compiler.xml
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<project version="4"> | ||
3 | + <component name="CompilerConfiguration"> | ||
4 | + <resourceExtensions /> | ||
5 | + <wildcardResourcePatterns> | ||
6 | + <entry name="!?*.java" /> | ||
7 | + <entry name="!?*.form" /> | ||
8 | + <entry name="!?*.class" /> | ||
9 | + <entry name="!?*.groovy" /> | ||
10 | + <entry name="!?*.scala" /> | ||
11 | + <entry name="!?*.flex" /> | ||
12 | + <entry name="!?*.kt" /> | ||
13 | + <entry name="!?*.clj" /> | ||
14 | + <entry name="!?*.aj" /> | ||
15 | + </wildcardResourcePatterns> | ||
16 | + <annotationProcessing> | ||
17 | + <profile default="true" name="Default" enabled="false"> | ||
18 | + <processorPath useClasspath="true" /> | ||
19 | + </profile> | ||
20 | + </annotationProcessing> | ||
21 | + </component> | ||
22 | +</project> | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
.idea/copyright/profiles_settings.xml
0 → 100644
.idea/gradle.xml
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<project version="4"> | ||
3 | + <component name="GradleSettings"> | ||
4 | + <option name="linkedExternalProjectsSettings"> | ||
5 | + <GradleProjectSettings> | ||
6 | + <option name="distributionType" value="DEFAULT_WRAPPED" /> | ||
7 | + <option name="externalProjectPath" value="$PROJECT_DIR$" /> | ||
8 | + <option name="modules"> | ||
9 | + <set> | ||
10 | + <option value="$PROJECT_DIR$" /> | ||
11 | + <option value="$PROJECT_DIR$/app" /> | ||
12 | + </set> | ||
13 | + </option> | ||
14 | + <option name="resolveModulePerSourceSet" value="false" /> | ||
15 | + </GradleProjectSettings> | ||
16 | + </option> | ||
17 | + </component> | ||
18 | +</project> | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
.idea/inspectionProfiles/Project_Default.xml
0 → 100644
1 | +<component name="InspectionProjectProfileManager"> | ||
2 | + <profile version="1.0"> | ||
3 | + <option name="myName" value="Project Default" /> | ||
4 | + <inspection_tool class="AndroidLintMissingConstraints" enabled="false" level="ERROR" enabled_by_default="false" /> | ||
5 | + <inspection_tool class="LoggerInitializedWithForeignClass" enabled="false" level="WARNING" enabled_by_default="false"> | ||
6 | + <option name="loggerClassName" value="org.apache.log4j.Logger,org.slf4j.LoggerFactory,org.apache.commons.logging.LogFactory,java.util.logging.Logger" /> | ||
7 | + <option name="loggerFactoryMethodName" value="getLogger,getLogger,getLog,getLogger" /> | ||
8 | + </inspection_tool> | ||
9 | + </profile> | ||
10 | +</component> | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +<component name="InspectionProjectProfileManager"> | ||
2 | + <settings> | ||
3 | + <option name="PROJECT_PROFILE" value="Project Default" /> | ||
4 | + <option name="USE_PROJECT_PROFILE" value="true" /> | ||
5 | + <version value="1.0" /> | ||
6 | + </settings> | ||
7 | +</component> | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
.idea/misc.xml
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<project version="4"> | ||
3 | + <component name="EntryPointsManager"> | ||
4 | + <entry_points version="2.0" /> | ||
5 | + </component> | ||
6 | + <component name="NullableNotNullManager"> | ||
7 | + <option name="myDefaultNullable" value="android.support.annotation.Nullable" /> | ||
8 | + <option name="myDefaultNotNull" value="android.support.annotation.NonNull" /> | ||
9 | + <option name="myNullables"> | ||
10 | + <value> | ||
11 | + <list size="4"> | ||
12 | + <item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" /> | ||
13 | + <item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" /> | ||
14 | + <item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.Nullable" /> | ||
15 | + <item index="3" class="java.lang.String" itemvalue="android.support.annotation.Nullable" /> | ||
16 | + </list> | ||
17 | + </value> | ||
18 | + </option> | ||
19 | + <option name="myNotNulls"> | ||
20 | + <value> | ||
21 | + <list size="4"> | ||
22 | + <item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" /> | ||
23 | + <item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" /> | ||
24 | + <item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" /> | ||
25 | + <item index="3" class="java.lang.String" itemvalue="android.support.annotation.NonNull" /> | ||
26 | + </list> | ||
27 | + </value> | ||
28 | + </option> | ||
29 | + </component> | ||
30 | + <component name="ProjectLevelVcsManager" settingsEditedManually="false"> | ||
31 | + <OptionsSetting value="true" id="Add" /> | ||
32 | + <OptionsSetting value="true" id="Remove" /> | ||
33 | + <OptionsSetting value="true" id="Checkout" /> | ||
34 | + <OptionsSetting value="true" id="Update" /> | ||
35 | + <OptionsSetting value="true" id="Status" /> | ||
36 | + <OptionsSetting value="true" id="Edit" /> | ||
37 | + <ConfirmationsSetting value="0" id="Add" /> | ||
38 | + <ConfirmationsSetting value="0" id="Remove" /> | ||
39 | + </component> | ||
40 | + <component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK"> | ||
41 | + <output url="file://$PROJECT_DIR$/build/classes" /> | ||
42 | + </component> | ||
43 | + <component name="ProjectType"> | ||
44 | + <option name="id" value="Android" /> | ||
45 | + </component> | ||
46 | +</project> | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
.idea/modules.xml
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<project version="4"> | ||
3 | + <component name="ProjectModuleManager"> | ||
4 | + <modules> | ||
5 | + <module fileurl="file://$PROJECT_DIR$/FirebaseAuthDemo.iml" filepath="$PROJECT_DIR$/FirebaseAuthDemo.iml" /> | ||
6 | + <module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" /> | ||
7 | + </modules> | ||
8 | + </component> | ||
9 | +</project> | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
.idea/runConfigurations.xml
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<project version="4"> | ||
3 | + <component name="RunConfigurationProducerService"> | ||
4 | + <option name="ignoredProducers"> | ||
5 | + <set> | ||
6 | + <option value="org.jetbrains.plugins.gradle.execution.test.runner.AllInPackageGradleConfigurationProducer" /> | ||
7 | + <option value="org.jetbrains.plugins.gradle.execution.test.runner.TestClassGradleConfigurationProducer" /> | ||
8 | + <option value="org.jetbrains.plugins.gradle.execution.test.runner.TestMethodGradleConfigurationProducer" /> | ||
9 | + </set> | ||
10 | + </option> | ||
11 | + </component> | ||
12 | +</project> | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
app/.gitignore
0 → 100644
1 | +/build |
app/build.gradle
0 → 100644
1 | +apply plugin: 'com.android.application' | ||
2 | + | ||
3 | +android { | ||
4 | + compileSdkVersion 25 | ||
5 | + buildToolsVersion "26.0.1" | ||
6 | + defaultConfig { | ||
7 | + applicationId "com.example.user.firebaseauthdemo" | ||
8 | + minSdkVersion 15 | ||
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 fileTree(dir: 'libs', include: ['*.jar']) | ||
24 | + androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { | ||
25 | + exclude group: 'com.android.support', module: 'support-annotations' | ||
26 | + }) | ||
27 | + compile 'com.android.support:appcompat-v7:25.3.1' | ||
28 | + compile 'com.android.support.constraint:constraint-layout:1.0.2' | ||
29 | + compile 'com.google.firebase:firebase-auth:10.2.6' | ||
30 | + compile 'com.google.firebase:firebase-database:10.2.6' | ||
31 | + testCompile 'junit:junit:4.12' | ||
32 | +} | ||
33 | + | ||
34 | + | ||
35 | + | ||
36 | +apply plugin: 'com.google.gms.google-services' | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
app/google-services.json
0 → 100644
1 | +{ | ||
2 | + "project_info": { | ||
3 | + "project_number": "650248608909", | ||
4 | + "firebase_url": "https://myfirebaseauthapp-bc28e.firebaseio.com", | ||
5 | + "project_id": "myfirebaseauthapp-bc28e", | ||
6 | + "storage_bucket": "myfirebaseauthapp-bc28e.appspot.com" | ||
7 | + }, | ||
8 | + "client": [ | ||
9 | + { | ||
10 | + "client_info": { | ||
11 | + "mobilesdk_app_id": "1:650248608909:android:40da2d4f194c6ed6", | ||
12 | + "android_client_info": { | ||
13 | + "package_name": "com.example.user.firebaseauthdemo" | ||
14 | + } | ||
15 | + }, | ||
16 | + "oauth_client": [ | ||
17 | + { | ||
18 | + "client_id": "650248608909-hdue5s7mau87ansut50cjnruf9o7gg5b.apps.googleusercontent.com", | ||
19 | + "client_type": 3 | ||
20 | + } | ||
21 | + ], | ||
22 | + "api_key": [ | ||
23 | + { | ||
24 | + "current_key": "AIzaSyAoVCpBjQ1EfVPGDNdhnQ4EpSdyOIvqrsM" | ||
25 | + } | ||
26 | + ], | ||
27 | + "services": { | ||
28 | + "analytics_service": { | ||
29 | + "status": 1 | ||
30 | + }, | ||
31 | + "appinvite_service": { | ||
32 | + "status": 1, | ||
33 | + "other_platform_oauth_client": [] | ||
34 | + }, | ||
35 | + "ads_service": { | ||
36 | + "status": 2 | ||
37 | + } | ||
38 | + } | ||
39 | + } | ||
40 | + ], | ||
41 | + "configuration_version": "1" | ||
42 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
app/proguard-rules.pro
0 → 100644
1 | +# Add project specific ProGuard rules here. | ||
2 | +# By default, the flags in this file are appended to flags specified | ||
3 | +# in C:\Users\user\AppData\Local\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 |
1 | +package com.example.user.firebaseauthdemo; | ||
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 <a href="http://d.android.com/tools/testing">Testing documentation</a> | ||
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.example.user.firebaseauthdemo", appContext.getPackageName()); | ||
25 | + } | ||
26 | +} |
app/src/main/AndroidManifest.xml
0 → 100644
1 | +<?xml version="1.0" encoding="utf-8"?> | ||
2 | +<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
3 | + package="com.example.user.firebaseauthdemo"> | ||
4 | + | ||
5 | + <user-permission android:name="android.permission.INTERNET" /> | ||
6 | + | ||
7 | + | ||
8 | + <application | ||
9 | + android:allowBackup="true" | ||
10 | + android:icon="@mipmap/ic_launcher" | ||
11 | + android:label="@string/app_name" | ||
12 | + android:roundIcon="@mipmap/ic_launcher_round" | ||
13 | + android:supportsRtl="true" | ||
14 | + android:theme="@style/AppTheme"> | ||
15 | + <activity android:name=".MainActivity"> | ||
16 | + <intent-filter> | ||
17 | + <action android:name="android.intent.action.MAIN" /> | ||
18 | + | ||
19 | + <category android:name="android.intent.category.LAUNCHER" /> | ||
20 | + </intent-filter> | ||
21 | + </activity> | ||
22 | + <activity android:name=".LoginActivity" /> | ||
23 | + <activity android:name=".ProfileActivity"></activity> | ||
24 | + </application> | ||
25 | + | ||
26 | + | ||
27 | +</manifest> |
1 | +package com.example.user.firebaseauthdemo; | ||
2 | + | ||
3 | +import android.app.ProgressDialog; | ||
4 | +import android.content.Intent; | ||
5 | +import android.support.annotation.NonNull; | ||
6 | +import android.support.v7.app.AppCompatActivity; | ||
7 | +import android.os.Bundle; | ||
8 | +import android.text.TextUtils; | ||
9 | +import android.view.View; | ||
10 | +import android.widget.Button; | ||
11 | +import android.widget.EditText; | ||
12 | +import android.widget.TextView; | ||
13 | +import android.widget.Toast; | ||
14 | + | ||
15 | +import com.google.android.gms.tasks.OnCompleteListener; | ||
16 | +import com.google.android.gms.tasks.Task; | ||
17 | +import com.google.firebase.auth.AuthResult; | ||
18 | +import com.google.firebase.auth.FirebaseAuth; | ||
19 | + | ||
20 | +public class LoginActivity extends AppCompatActivity implements View.OnClickListener { | ||
21 | + | ||
22 | + private Button buttonSignIn; | ||
23 | + private EditText editTextEmail; | ||
24 | + private EditText editTextPassword; | ||
25 | + private TextView textViewSignUp; | ||
26 | + | ||
27 | + private ProgressDialog progressDialog; | ||
28 | + private FirebaseAuth firebaseAuth; | ||
29 | + | ||
30 | + @Override | ||
31 | + protected void onCreate(Bundle savedInstanceState) { | ||
32 | + super.onCreate(savedInstanceState); | ||
33 | + setContentView(R.layout.activity_login); | ||
34 | + | ||
35 | + firebaseAuth = firebaseAuth.getInstance(); | ||
36 | + | ||
37 | + if(firebaseAuth.getCurrentUser() != null){ | ||
38 | + //profile activity here | ||
39 | + finish(); | ||
40 | + startActivity(new Intent(getApplicationContext(), ProfileActivity.class)); | ||
41 | + } | ||
42 | + | ||
43 | + editTextEmail = (EditText)findViewById(R.id.editTextEmail); | ||
44 | + editTextPassword = (EditText)findViewById(R.id.editTextPassword); | ||
45 | + buttonSignIn = (Button) findViewById(R.id.buttonSignIn); | ||
46 | + textViewSignUp = (TextView)findViewById(R.id.textViewSignUp); | ||
47 | + | ||
48 | + progressDialog = new ProgressDialog(this); | ||
49 | + buttonSignIn.setOnClickListener(this); | ||
50 | + textViewSignUp.setOnClickListener(this); | ||
51 | + } | ||
52 | + | ||
53 | + private void userLogin(){ | ||
54 | + String email = editTextEmail.getText().toString().trim(); | ||
55 | + String password = editTextPassword.getText().toString().trim(); | ||
56 | + | ||
57 | + if(TextUtils.isEmpty(email)){ | ||
58 | + //email is empty | ||
59 | + Toast.makeText(this, "Please enter email", Toast.LENGTH_SHORT).show(); | ||
60 | + //stopping the function execution further | ||
61 | + return; | ||
62 | + } | ||
63 | + | ||
64 | + if(TextUtils.isEmpty(password)) { | ||
65 | + //password is empty | ||
66 | + Toast.makeText(this, "Please enter password", Toast.LENGTH_SHORT).show(); | ||
67 | + //stopping the function execution further | ||
68 | + return; | ||
69 | + } | ||
70 | + //if validation are ok | ||
71 | + //we will first show a progressbar | ||
72 | + | ||
73 | + progressDialog.setTitle("Loading..."); | ||
74 | + progressDialog.setMessage("Registering User..."); | ||
75 | + progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER); | ||
76 | + progressDialog.show(); | ||
77 | + | ||
78 | + firebaseAuth.signInWithEmailAndPassword(email, password) | ||
79 | + .addOnCompleteListener(this, new OnCompleteListener<AuthResult>() { | ||
80 | + @Override | ||
81 | + public void onComplete(@NonNull Task<AuthResult> task) { | ||
82 | + progressDialog.dismiss(); | ||
83 | + if(task.isSuccessful()){ | ||
84 | + //start the profile activity | ||
85 | + finish(); | ||
86 | + startActivity(new Intent(getApplicationContext(), ProfileActivity.class)); | ||
87 | + } | ||
88 | + } | ||
89 | + }); | ||
90 | + } | ||
91 | + | ||
92 | + @Override | ||
93 | + public void onClick(View view){ | ||
94 | + if(view == buttonSignIn){ | ||
95 | + userLogin(); | ||
96 | + } | ||
97 | + if(view == textViewSignUp){ | ||
98 | + finish(); | ||
99 | + startActivity(new Intent(this, MainActivity.class)); | ||
100 | + } | ||
101 | + } | ||
102 | + | ||
103 | +} |
1 | +package com.example.user.firebaseauthdemo; | ||
2 | + | ||
3 | +import android.app.ProgressDialog; | ||
4 | +import android.content.Intent; | ||
5 | +import android.support.annotation.NonNull; | ||
6 | +import android.support.v7.app.AppCompatActivity; | ||
7 | +import android.os.Bundle; | ||
8 | +import android.text.TextUtils; | ||
9 | +import android.view.View; | ||
10 | +import android.widget.Button; | ||
11 | +import android.widget.EditText; | ||
12 | +import android.widget.ProgressBar; | ||
13 | +import android.widget.TextView; | ||
14 | +import android.widget.Toast; | ||
15 | + | ||
16 | +import com.google.android.gms.tasks.OnCompleteListener; | ||
17 | +import com.google.android.gms.tasks.Task; | ||
18 | +import com.google.firebase.auth.AuthResult; | ||
19 | +import com.google.firebase.auth.FirebaseAuth; | ||
20 | + | ||
21 | +public class MainActivity extends AppCompatActivity implements View.OnClickListener{ | ||
22 | + | ||
23 | + private Button buttonRegister; | ||
24 | + private EditText editTextEmail; | ||
25 | + private EditText editTextPassword; | ||
26 | + private TextView textViewSignIn; | ||
27 | + | ||
28 | + private ProgressDialog progressDialog; | ||
29 | + | ||
30 | + private FirebaseAuth firebaseAuth; | ||
31 | + | ||
32 | + @Override | ||
33 | + protected void onCreate(Bundle savedInstanceState) { | ||
34 | + super.onCreate(savedInstanceState); | ||
35 | + setContentView(R.layout.activity_main); | ||
36 | + | ||
37 | + progressDialog = new ProgressDialog(MainActivity.this); | ||
38 | + firebaseAuth = FirebaseAuth.getInstance(); | ||
39 | + | ||
40 | + if(firebaseAuth.getCurrentUser() != null){ | ||
41 | + //profile activity here | ||
42 | + finish(); | ||
43 | + startActivity(new Intent(getApplicationContext(), ProfileActivity.class)); | ||
44 | + } | ||
45 | + | ||
46 | + buttonRegister = (Button) findViewById(R.id.buttonRegister); | ||
47 | + | ||
48 | + editTextEmail = (EditText) findViewById(R.id.editTextEmail); | ||
49 | + editTextPassword = (EditText) findViewById(R.id.editTextPassword); | ||
50 | + | ||
51 | + textViewSignIn = (TextView) findViewById(R.id.textViewSignIn); | ||
52 | + | ||
53 | + buttonRegister.setOnClickListener(this); | ||
54 | + textViewSignIn.setOnClickListener(this); | ||
55 | + } | ||
56 | + | ||
57 | + private void registerUser(){ | ||
58 | + String email = editTextEmail.getText().toString().trim(); | ||
59 | + String password = editTextPassword.getText().toString().trim(); | ||
60 | + | ||
61 | + if(TextUtils.isEmpty(email)){ | ||
62 | + //email is empty | ||
63 | + Toast.makeText(this, "Please enter email", Toast.LENGTH_SHORT).show(); | ||
64 | + //stopping the function execution further | ||
65 | + return; | ||
66 | + } | ||
67 | + | ||
68 | + if(TextUtils.isEmpty(password)) { | ||
69 | + //password is empty | ||
70 | + Toast.makeText(this, "Please enter password", Toast.LENGTH_SHORT).show(); | ||
71 | + //stopping the function execution further | ||
72 | + return; | ||
73 | + } | ||
74 | + //if validation are ok | ||
75 | + //we will first show a progressbar | ||
76 | + | ||
77 | + progressDialog.setTitle("Loading..."); | ||
78 | + progressDialog.setMessage("Registering User..."); | ||
79 | + progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER); | ||
80 | + progressDialog.show(); | ||
81 | + //creating a new user | ||
82 | + firebaseAuth.createUserWithEmailAndPassword(email,password) | ||
83 | + .addOnCompleteListener(this, new OnCompleteListener<AuthResult>() { | ||
84 | + @Override | ||
85 | + public void onComplete(@NonNull Task<AuthResult> task) { | ||
86 | + if(task.isSuccessful()){ | ||
87 | + finish(); | ||
88 | + startActivity(new Intent(getApplicationContext(), ProfileActivity.class)); | ||
89 | + }else{ | ||
90 | + Toast.makeText(MainActivity.this, "Could not register.. Try again", Toast.LENGTH_SHORT).show(); | ||
91 | + } | ||
92 | + progressDialog.dismiss(); | ||
93 | + } | ||
94 | + }); | ||
95 | + } | ||
96 | + | ||
97 | + @Override | ||
98 | + public void onClick(View view) { | ||
99 | + if(view == buttonRegister){ | ||
100 | + registerUser(); | ||
101 | + } | ||
102 | + | ||
103 | + if(view == textViewSignIn){ | ||
104 | + //will open login activity here | ||
105 | + startActivity(new Intent(this, LoginActivity.class)); | ||
106 | + } | ||
107 | + } | ||
108 | +} |
1 | +package com.example.user.firebaseauthdemo; | ||
2 | + | ||
3 | +import android.content.Intent; | ||
4 | +import android.support.v7.app.AppCompatActivity; | ||
5 | +import android.os.Bundle; | ||
6 | +import android.view.View; | ||
7 | +import android.widget.Button; | ||
8 | +import android.widget.EditText; | ||
9 | +import android.widget.TextView; | ||
10 | +import android.widget.Toast; | ||
11 | + | ||
12 | +import com.google.firebase.auth.FirebaseAuth; | ||
13 | +import com.google.firebase.auth.FirebaseUser; | ||
14 | +import com.google.firebase.database.DatabaseReference; | ||
15 | +import com.google.firebase.database.FirebaseDatabase; | ||
16 | + | ||
17 | +public class ProfileActivity extends AppCompatActivity implements View.OnClickListener{ | ||
18 | + | ||
19 | + private FirebaseAuth firebaseAuth; | ||
20 | + | ||
21 | + private TextView textViewUserEmail; | ||
22 | + private Button buttonLogout; | ||
23 | + | ||
24 | + private DatabaseReference databaseReference; | ||
25 | + private EditText editTextName, editTextAddress; | ||
26 | + private Button buttonSave; | ||
27 | + | ||
28 | + @Override | ||
29 | + protected void onCreate(Bundle savedInstanceState) { | ||
30 | + super.onCreate(savedInstanceState); | ||
31 | + setContentView(R.layout.activity_profile); | ||
32 | + firebaseAuth = FirebaseAuth.getInstance(); | ||
33 | + if(firebaseAuth.getCurrentUser() == null){ | ||
34 | + finish(); | ||
35 | + startActivity(new Intent(this,LoginActivity.class)); | ||
36 | + } | ||
37 | + databaseReference = FirebaseDatabase.getInstance().getReference(); | ||
38 | + editTextAddress = (EditText) findViewById(R.id.editTextAddress); | ||
39 | + editTextName = (EditText)findViewById(R.id.editTextName); | ||
40 | + buttonSave = (Button)findViewById(R.id.buttonSave); | ||
41 | + | ||
42 | + FirebaseUser user = firebaseAuth.getCurrentUser(); | ||
43 | + | ||
44 | + textViewUserEmail = (TextView) findViewById(R.id.textViewUserEmail); | ||
45 | + textViewUserEmail.setText("Welcome " + user.getEmail()); | ||
46 | + buttonLogout = (Button)findViewById(R.id.buttonLogout); | ||
47 | + buttonLogout.setOnClickListener(this); | ||
48 | + buttonSave.setOnClickListener(this); | ||
49 | + } | ||
50 | + | ||
51 | + private void saveUserInformation(){ | ||
52 | + String name = editTextName.getText().toString().trim(); | ||
53 | + String add = editTextAddress.getText().toString().trim(); | ||
54 | + | ||
55 | + UserInformation userInformation = new UserInformation(name, add); | ||
56 | + | ||
57 | + FirebaseUser user = firebaseAuth.getCurrentUser(); | ||
58 | + databaseReference.child(user.getUid()).setValue(userInformation); | ||
59 | + | ||
60 | + Toast.makeText(this, "Information Saved...", Toast.LENGTH_LONG).show(); | ||
61 | + | ||
62 | + } | ||
63 | + | ||
64 | + @Override | ||
65 | + public void onClick(View view) { | ||
66 | + if(view == buttonLogout){ | ||
67 | + firebaseAuth.signOut(); | ||
68 | + finish(); | ||
69 | + startActivity(new Intent(this, LoginActivity.class)); | ||
70 | + } | ||
71 | + | ||
72 | + if(view == buttonSave){ | ||
73 | + saveUserInformation(); | ||
74 | + } | ||
75 | + } | ||
76 | +} |
1 | +package com.example.user.firebaseauthdemo; | ||
2 | + | ||
3 | +/** | ||
4 | + * Created by user on 2017-09-23. | ||
5 | + */ | ||
6 | + | ||
7 | +public class UserInformation { | ||
8 | + | ||
9 | + public String name; | ||
10 | + public String address; | ||
11 | + | ||
12 | + public UserInformation(String name, String address) { | ||
13 | + this.name = name; | ||
14 | + this.address = address; | ||
15 | + } | ||
16 | + | ||
17 | + public UserInformation(String name) { | ||
18 | + } | ||
19 | +} |
app/src/main/res/layout/activity_login.xml
0 → 100644
1 | +<?xml version="1.0" encoding="utf-8"?> | ||
2 | +<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
3 | + xmlns:app="http://schemas.android.com/apk/res-auto" | ||
4 | + xmlns:tools="http://schemas.android.com/tools" | ||
5 | + android:layout_width="match_parent" | ||
6 | + android:layout_height="match_parent" | ||
7 | + tools:context="com.example.user.firebaseauthdemo.LoginActivity"> | ||
8 | + | ||
9 | + <LinearLayout | ||
10 | + android:layout_centerHorizontal="true" | ||
11 | + android:layout_centerVertical="true" | ||
12 | + android:orientation="vertical" | ||
13 | + android:layout_width="368dp" | ||
14 | + android:layout_height="wrap_content" | ||
15 | + tools:layout_editor_absoluteY="0dp" | ||
16 | + tools:layout_editor_absoluteX="8dp" > | ||
17 | + | ||
18 | + <TextView | ||
19 | + android:layout_margin="30dp" | ||
20 | + android:text="User Login" | ||
21 | + android:id="@+id/textView" | ||
22 | + android:layout_width="wrap_content" | ||
23 | + android:textAppearance="?android:attr/textAppearanceLarge" | ||
24 | + android:layout_height="wrap_content" | ||
25 | + android:layout_gravity="center_horizontal"/> | ||
26 | + | ||
27 | + <EditText | ||
28 | + android:layout_margin="15dp" | ||
29 | + android:inputType="textEmailAddress" | ||
30 | + android:hint="Enter your email" | ||
31 | + android:id="@+id/editTextEmail" | ||
32 | + android:layout_width="368dp" | ||
33 | + android:layout_height="wrap_content" | ||
34 | + tools:layout_editor_absoluteY="0dp" | ||
35 | + tools:layout_editor_absoluteX="8dp" /> | ||
36 | + | ||
37 | + <EditText | ||
38 | + android:layout_margin="15dp" | ||
39 | + android:inputType="textPassword" | ||
40 | + android:hint="Enter your password" | ||
41 | + android:id="@+id/editTextPassword" | ||
42 | + android:layout_width="match_parent" | ||
43 | + android:layout_height="wrap_content" | ||
44 | + tools:layout_editor_absoluteY="0dp" | ||
45 | + tools:layout_editor_absoluteX="8dp" /> | ||
46 | + | ||
47 | + <Button | ||
48 | + android:layout_margin="15dp" | ||
49 | + android:id="@+id/buttonSignIn" | ||
50 | + android:text="SignUp" | ||
51 | + android:layout_width="match_parent" | ||
52 | + android:layout_height="wrap_content" /> | ||
53 | + | ||
54 | + <TextView | ||
55 | + android:textAlignment="center" | ||
56 | + android:text="Not have an account? Signup Here" | ||
57 | + android:id="@+id/textViewSignUp" | ||
58 | + android:layout_width="match_parent" | ||
59 | + android:layout_height="wrap_content" /> | ||
60 | + | ||
61 | + </LinearLayout> | ||
62 | +</android.support.constraint.ConstraintLayout> |
app/src/main/res/layout/activity_main.xml
0 → 100644
1 | +<?xml version="1.0" encoding="utf-8"?> | ||
2 | +<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
3 | + xmlns:app="http://schemas.android.com/apk/res-auto" | ||
4 | + xmlns:tools="http://schemas.android.com/tools" | ||
5 | + android:layout_width="match_parent" | ||
6 | + android:layout_height="match_parent" | ||
7 | + tools:context="com.example.user.firebaseauthdemo.MainActivity"> | ||
8 | + | ||
9 | + <LinearLayout | ||
10 | + android:layout_centerHorizontal="true" | ||
11 | + android:layout_centerVertical="true" | ||
12 | + android:orientation="vertical" | ||
13 | + android:layout_width="368dp" | ||
14 | + android:layout_height="wrap_content" | ||
15 | + tools:layout_editor_absoluteY="0dp" | ||
16 | + tools:layout_editor_absoluteX="8dp" > | ||
17 | + | ||
18 | + <TextView | ||
19 | + android:layout_margin="30dp" | ||
20 | + android:text="User Registration" | ||
21 | + android:id="@+id/textView" | ||
22 | + android:layout_width="wrap_content" | ||
23 | + android:textAppearance="?android:attr/textAppearanceLarge" | ||
24 | + android:layout_height="wrap_content" | ||
25 | + android:layout_gravity="center_horizontal"/> | ||
26 | + | ||
27 | + <EditText | ||
28 | + android:layout_margin="15dp" | ||
29 | + android:inputType="textEmailAddress" | ||
30 | + android:hint="Enter your email" | ||
31 | + android:id="@+id/editTextEmail" | ||
32 | + android:layout_width="368dp" | ||
33 | + android:layout_height="wrap_content" | ||
34 | + tools:layout_editor_absoluteY="0dp" | ||
35 | + tools:layout_editor_absoluteX="8dp" /> | ||
36 | + | ||
37 | + <EditText | ||
38 | + android:layout_margin="15dp" | ||
39 | + android:inputType="textPassword" | ||
40 | + android:hint="Enter your password" | ||
41 | + android:id="@+id/editTextPassword" | ||
42 | + android:layout_width="match_parent" | ||
43 | + android:layout_height="wrap_content" | ||
44 | + tools:layout_editor_absoluteY="0dp" | ||
45 | + tools:layout_editor_absoluteX="8dp" /> | ||
46 | + | ||
47 | + <Button | ||
48 | + android:layout_margin="15dp" | ||
49 | + android:id="@+id/buttonRegister" | ||
50 | + android:text="Register User" | ||
51 | + android:layout_width="match_parent" | ||
52 | + android:layout_height="wrap_content" /> | ||
53 | + | ||
54 | + <TextView | ||
55 | + android:textAlignment="center" | ||
56 | + android:text="Already Registered? Sign in here" | ||
57 | + android:id="@+id/textViewSignIn" | ||
58 | + android:layout_width="match_parent" | ||
59 | + android:layout_height="wrap_content" /> | ||
60 | + | ||
61 | + </LinearLayout> | ||
62 | +</android.support.constraint.ConstraintLayout> | ||
63 | + |
app/src/main/res/layout/activity_profile.xml
0 → 100644
1 | +<?xml version="1.0" encoding="utf-8"?> | ||
2 | +<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
3 | + xmlns:app="http://schemas.android.com/apk/res-auto" | ||
4 | + xmlns:tools="http://schemas.android.com/tools" | ||
5 | + android:layout_width="match_parent" | ||
6 | + android:layout_height="match_parent" | ||
7 | + tools:context="com.example.user.firebaseauthdemo.ProfileActivity"> | ||
8 | + | ||
9 | + <LinearLayout | ||
10 | + android:layout_width="368dp" | ||
11 | + android:layout_height="495dp" | ||
12 | + android:orientation="vertical" | ||
13 | + tools:layout_editor_absoluteX="8dp" | ||
14 | + tools:layout_editor_absoluteY="8dp"> | ||
15 | + | ||
16 | + <TextView | ||
17 | + android:layout_margin="15dp" | ||
18 | + android:id="@+id/textViewUserEmail" | ||
19 | + android:layout_width="wrap_content" | ||
20 | + android:layout_height="wrap_content" | ||
21 | + android:textAppearance="?android:attr/textAppearanceLarge" | ||
22 | + android:text="TextView" | ||
23 | + android:layout_gravity="center_horizontal"/> | ||
24 | + | ||
25 | + <EditText | ||
26 | + android:id="@+id/editTextAddress" | ||
27 | + android:hint="Enter Address" | ||
28 | + android:layout_width="match_parent" | ||
29 | + android:layout_height="wrap_content" /> | ||
30 | + | ||
31 | + <EditText | ||
32 | + android:id="@+id/editTextName" | ||
33 | + android:hint="Enter your Name" | ||
34 | + android:layout_width="match_parent" | ||
35 | + android:layout_height="wrap_content" /> | ||
36 | + | ||
37 | + <Button | ||
38 | + android:layout_margin="15dp" | ||
39 | + android:id="@+id/buttonSave" | ||
40 | + android:layout_width="match_parent" | ||
41 | + android:layout_height="wrap_content" | ||
42 | + android:text="Save information" /> | ||
43 | + | ||
44 | + <Button | ||
45 | + android:id="@+id/buttonLogout" | ||
46 | + android:layout_width="wrap_content" | ||
47 | + android:layout_height="wrap_content" | ||
48 | + android:layout_gravity="center_horizontal" | ||
49 | + android:text="Logout" /> | ||
50 | + </LinearLayout> | ||
51 | +</android.support.constraint.ConstraintLayout> |
app/src/main/res/mipmap-hdpi/ic_launcher.png
0 → 100644
3.34 KB
4.11 KB
app/src/main/res/mipmap-mdpi/ic_launcher.png
0 → 100644
2.15 KB
2.5 KB
4.73 KB
5.97 KB
7.54 KB
9.82 KB
10.2 KB
14.4 KB
app/src/main/res/values/colors.xml
0 → 100644
app/src/main/res/values/strings.xml
0 → 100644
app/src/main/res/values/styles.xml
0 → 100644
1 | +<resources> | ||
2 | + | ||
3 | + <!-- Base application theme. --> | ||
4 | + <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> | ||
5 | + <!-- Customize your theme here. --> | ||
6 | + <item name="colorPrimary">@color/colorPrimary</item> | ||
7 | + <item name="colorPrimaryDark">@color/colorPrimaryDark</item> | ||
8 | + <item name="colorAccent">@color/colorAccent</item> | ||
9 | + </style> | ||
10 | + | ||
11 | +</resources> |
1 | +package com.example.user.firebaseauthdemo; | ||
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 <a href="http://d.android.com/tools/testing">Testing documentation</a> | ||
11 | + */ | ||
12 | +public class ExampleUnitTest { | ||
13 | + @Test | ||
14 | + public void addition_isCorrect() throws Exception { | ||
15 | + assertEquals(4, 2 + 2); | ||
16 | + } | ||
17 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
build.gradle
0 → 100644
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 | + classpath 'com.google.gms:google-services:3.1.0' | ||
10 | + // NOTE: Do not place your application dependencies here; they belong | ||
11 | + // in the individual module build.gradle files | ||
12 | + } | ||
13 | +} | ||
14 | + | ||
15 | +allprojects { | ||
16 | + repositories { | ||
17 | + jcenter() | ||
18 | + } | ||
19 | +} | ||
20 | + | ||
21 | +task clean(type: Delete) { | ||
22 | + delete rootProject.buildDir | ||
23 | +} |
gradle.properties
0 → 100644
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 |
gradle/wrapper/gradle-wrapper.jar
0 → 100644
No preview for this file type
gradle/wrapper/gradle-wrapper.properties
0 → 100644
gradlew
0 → 100644
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 "$@" |
gradlew.bat
0 → 100644
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 |
settings.gradle
0 → 100644
1 | +include ':app' |
-
Please register or login to post a comment