-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit dd315d2
Showing
53 changed files
with
1,500 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Auto detect text files and perform LF normalization | ||
* text=auto |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
*.iml | ||
.gradle | ||
/local.properties | ||
/.idea/caches | ||
/.idea/libraries | ||
/.idea/modules.xml | ||
/.idea/workspace.xml | ||
/.idea/navEditor.xml | ||
/.idea/assetWizardSettings.xml | ||
.DS_Store | ||
/build | ||
/captures | ||
.externalNativeBuild | ||
.cxx | ||
local.properties |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
plugins { | ||
id 'com.android.application' | ||
id 'com.google.gms.google-services' | ||
} | ||
|
||
android { | ||
namespace 'com.floki.barber_new' | ||
compileSdk 33 | ||
|
||
defaultConfig { | ||
applicationId "com.floki.barber_new" | ||
minSdk 24 | ||
targetSdk 33 | ||
versionCode 1 | ||
versionName "1.0" | ||
|
||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" | ||
} | ||
|
||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' | ||
} | ||
} | ||
compileOptions { | ||
sourceCompatibility JavaVersion.VERSION_1_8 | ||
targetCompatibility JavaVersion.VERSION_1_8 | ||
} | ||
} | ||
|
||
dependencies { | ||
|
||
implementation 'androidx.appcompat:appcompat:1.6.1' | ||
implementation 'com.google.android.material:material:1.8.0' | ||
implementation 'androidx.constraintlayout:constraintlayout:2.1.4' | ||
testImplementation 'junit:junit:4.13.2' | ||
androidTestImplementation 'androidx.test.ext:junit:1.1.5' | ||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1' | ||
implementation 'com.google.firebase:firebase-auth:21.2.0' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
{ | ||
"project_info": { | ||
"project_number": "253058213866", | ||
"project_id": "barber-otp", | ||
"storage_bucket": "barber-otp.appspot.com" | ||
}, | ||
"client": [ | ||
{ | ||
"client_info": { | ||
"mobilesdk_app_id": "1:253058213866:android:8ea86a4f6da7b643087493", | ||
"android_client_info": { | ||
"package_name": "com.floki.barber_new" | ||
} | ||
}, | ||
"oauth_client": [ | ||
{ | ||
"client_id": "253058213866-jrcj1ujghgjohcfsil2ul6e1uahut0dv.apps.googleusercontent.com", | ||
"client_type": 1, | ||
"android_info": { | ||
"package_name": "com.floki.barber_new", | ||
"certificate_hash": "8ce7c5159ad065a09072273efa654ed43057e041" | ||
} | ||
}, | ||
{ | ||
"client_id": "253058213866-hkqmf8ejsotvnfo7junsss5jn6k1oicj.apps.googleusercontent.com", | ||
"client_type": 3 | ||
} | ||
], | ||
"api_key": [ | ||
{ | ||
"current_key": "AIzaSyDFoahhyUjyk6hlJibyupWJs-TNPPZDiT8" | ||
} | ||
], | ||
"services": { | ||
"appinvite_service": { | ||
"other_platform_oauth_client": [ | ||
{ | ||
"client_id": "253058213866-hkqmf8ejsotvnfo7junsss5jn6k1oicj.apps.googleusercontent.com", | ||
"client_type": 3 | ||
} | ||
] | ||
} | ||
} | ||
} | ||
], | ||
"configuration_version": "1" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Add project specific ProGuard rules here. | ||
# You can control the set of applied configuration files using the | ||
# proguardFiles setting in build.gradle. | ||
# | ||
# For more details, see | ||
# http://developer.android.com/guide/developing/tools/proguard.html | ||
|
||
# If your project uses WebView with JS, uncomment the following | ||
# and specify the fully qualified class name to the JavaScript interface | ||
# class: | ||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview { | ||
# public *; | ||
#} | ||
|
||
# Uncomment this to preserve the line number information for | ||
# debugging stack traces. | ||
#-keepattributes SourceFile,LineNumberTable | ||
|
||
# If you keep the line number information, uncomment this to | ||
# hide the original source file name. | ||
#-renamesourcefileattribute SourceFile |
26 changes: 26 additions & 0 deletions
26
app/src/androidTest/java/com/floki/barber_new/ExampleInstrumentedTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package com.floki.barber_new; | ||
|
||
import android.content.Context; | ||
|
||
import androidx.test.platform.app.InstrumentationRegistry; | ||
import androidx.test.ext.junit.runners.AndroidJUnit4; | ||
|
||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
|
||
import static org.junit.Assert.*; | ||
|
||
/** | ||
* Instrumented test, which will execute on an Android device. | ||
* | ||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a> | ||
*/ | ||
@RunWith(AndroidJUnit4.class) | ||
public class ExampleInstrumentedTest { | ||
@Test | ||
public void useAppContext() { | ||
// Context of the app under test. | ||
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); | ||
assertEquals("com.floki.barber_new", appContext.getPackageName()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:tools="http://schemas.android.com/tools"> | ||
|
||
<application | ||
android:allowBackup="true" | ||
android:dataExtractionRules="@xml/data_extraction_rules" | ||
android:fullBackupContent="@xml/backup_rules" | ||
android:icon="@mipmap/ic_launcher" | ||
android:label="@string/app_name" | ||
android:supportsRtl="true" | ||
android:theme="@style/Theme.Barber_New" | ||
tools:targetApi="31"> | ||
<activity | ||
android:name=".VerifyOTPActivity" | ||
android:screenOrientation="portrait" | ||
android:windowSoftInputMode="adjustResize"/> | ||
<activity | ||
android:name=".SendOTPActivity" | ||
android:screenOrientation="portrait" | ||
android:exported="true" | ||
android:windowSoftInputMode="adjustResize"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
|
||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
<activity | ||
android:name=".MainActivity" | ||
android:screenOrientation="portrait" | ||
> | ||
</activity> | ||
</application> | ||
|
||
</manifest> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package com.floki.barber_new; | ||
|
||
import androidx.appcompat.app.AppCompatActivity; | ||
|
||
import android.content.Intent; | ||
import android.os.Bundle; | ||
import android.view.View; | ||
import android.widget.Button; | ||
|
||
public class MainActivity extends AppCompatActivity { | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_main); | ||
|
||
} | ||
|
||
} |
77 changes: 77 additions & 0 deletions
77
app/src/main/java/com/floki/barber_new/SendOTPActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
package com.floki.barber_new; | ||
|
||
import androidx.annotation.NonNull; | ||
import androidx.appcompat.app.AppCompatActivity; | ||
|
||
import android.content.Intent; | ||
import android.os.Bundle; | ||
import android.view.View; | ||
import android.widget.Button; | ||
import android.widget.EditText; | ||
import android.widget.ProgressBar; | ||
import android.widget.Toast; | ||
|
||
import com.google.firebase.FirebaseException; | ||
import com.google.firebase.auth.FirebaseAuth; | ||
import com.google.firebase.auth.PhoneAuthCredential; | ||
import com.google.firebase.auth.PhoneAuthOptions; | ||
import com.google.firebase.auth.PhoneAuthProvider; | ||
|
||
import java.lang.ref.PhantomReference; | ||
import java.util.concurrent.TimeUnit; | ||
|
||
public class SendOTPActivity extends AppCompatActivity { | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_send_otpactivity); | ||
|
||
final ProgressBar progressBar = findViewById(R.id.progressBar); | ||
final EditText inputMobile = findViewById(R.id.inputMobile); | ||
Button buttonGetOTP = findViewById(R.id.buttonGetOTP); | ||
buttonGetOTP.setOnClickListener(new View.OnClickListener() { | ||
@Override | ||
public void onClick(View v) { | ||
if (inputMobile.getText().toString().trim().isEmpty()) { | ||
Toast.makeText(SendOTPActivity.this, "Enter Mobile", Toast.LENGTH_SHORT).show(); | ||
return; | ||
} | ||
progressBar.setVisibility(View.VISIBLE); | ||
buttonGetOTP.setVisibility(View.INVISIBLE); | ||
PhoneAuthOptions options = PhoneAuthOptions.newBuilder(FirebaseAuth.getInstance()) | ||
.setPhoneNumber("+84" + inputMobile.getText().toString()) | ||
.setTimeout(20L, TimeUnit.SECONDS) | ||
.setActivity(SendOTPActivity.this) | ||
.setCallbacks(new PhoneAuthProvider.OnVerificationStateChangedCallbacks() { | ||
@Override | ||
public void onVerificationCompleted(@NonNull PhoneAuthCredential phoneAuthCredential) { | ||
progressBar.setVisibility(View.GONE); | ||
buttonGetOTP.setVisibility(View.VISIBLE); | ||
} | ||
|
||
@Override | ||
public void onVerificationFailed(@NonNull FirebaseException e) { | ||
progressBar.setVisibility(View.GONE); | ||
buttonGetOTP.setVisibility(View.VISIBLE); | ||
Toast.makeText(getApplicationContext(), e.getMessage(), Toast.LENGTH_SHORT).show(); | ||
} | ||
|
||
@Override | ||
public void onCodeSent(@NonNull String verificationId, @NonNull PhoneAuthProvider.ForceResendingToken forceResendingToken) { | ||
super.onCodeSent(verificationId, forceResendingToken); | ||
progressBar.setVisibility(View.GONE); | ||
buttonGetOTP.setVisibility(View.VISIBLE); | ||
Intent intent = new Intent(getApplicationContext(), VerifyOTPActivity.class); | ||
intent.putExtra("mobile", inputMobile.getText().toString()); | ||
intent.putExtra("verificationId",verificationId); | ||
startActivity(intent); | ||
} | ||
}) | ||
.build(); | ||
PhoneAuthProvider.verifyPhoneNumber(options); | ||
|
||
} | ||
}); | ||
} | ||
} |
Oops, something went wrong.