diff --git a/app/src/main/java/sayan/apps/numplex/MainActivity.kt b/app/src/main/java/sayan/apps/numplex/MainActivity.kt index 9be5a97..f3fa4d1 100644 --- a/app/src/main/java/sayan/apps/numplex/MainActivity.kt +++ b/app/src/main/java/sayan/apps/numplex/MainActivity.kt @@ -1,9 +1,12 @@ package sayan.apps.numplex +import android.content.Intent import android.os.Bundle import android.os.Handler import android.os.Looper import android.view.MenuItem +import android.view.inputmethod.InputMethodManager +import android.widget.TextView import android.widget.Toast import androidx.activity.enableEdgeToEdge import androidx.appcompat.app.ActionBarDrawerToggle @@ -11,14 +14,13 @@ import androidx.appcompat.app.AppCompatActivity import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen import androidx.core.view.ViewCompat import androidx.core.view.WindowInsetsCompat +import androidx.drawerlayout.widget.DrawerLayout import androidx.fragment.app.Fragment -import com.google.android.material.navigation.NavigationView import com.google.android.gms.auth.api.signin.GoogleSignIn import com.google.android.gms.auth.api.signin.GoogleSignInClient import com.google.android.gms.auth.api.signin.GoogleSignInOptions +import com.google.android.material.navigation.NavigationView import com.google.firebase.auth.FirebaseAuth -import android.content.Intent -import android.widget.TextView import com.squareup.picasso.Picasso class MainActivity : AppCompatActivity() { @@ -62,6 +64,10 @@ class MainActivity : AppCompatActivity() { mGoogleSignInClient = GoogleSignIn.getClient(this, gso) drawerLayout = findViewById(R.id.drawerLayout) + drawerLayout.addDrawerListener(object : DrawerLayout.SimpleDrawerListener() { + // Close the keyboard when the drawer starts moving + override fun onDrawerStateChanged(newState: Int) = closeKeyboard() + }) val navView: NavigationView = findViewById(R.id.navView) toggle = ActionBarDrawerToggle(this, drawerLayout, R.string.open, R.string.close) drawerLayout.addDrawerListener(toggle) @@ -113,7 +119,11 @@ class MainActivity : AppCompatActivity() { } R.id.nav_update -> { - Toast.makeText(applicationContext, "Latest Version is already Installed !!", Toast.LENGTH_SHORT).show() + Toast.makeText( + applicationContext, + "Latest Version is already Installed !!", + Toast.LENGTH_SHORT + ).show() } R.id.nav_feedback -> { @@ -128,6 +138,14 @@ class MainActivity : AppCompatActivity() { } } + private fun closeKeyboard() { + val view = this.currentFocus + if (view != null) { + val imm = getSystemService(INPUT_METHOD_SERVICE) as InputMethodManager + imm.hideSoftInputFromWindow(view.windowToken, 0) + } + } + private fun goToSignInActivity() { val intent = Intent(this, SignInActivity::class.java) startActivity(intent) diff --git a/app/src/main/java/sayan/apps/numplex/SignInActivity.kt b/app/src/main/java/sayan/apps/numplex/SignInActivity.kt index 96d6c58..93d8ccc 100644 --- a/app/src/main/java/sayan/apps/numplex/SignInActivity.kt +++ b/app/src/main/java/sayan/apps/numplex/SignInActivity.kt @@ -1,14 +1,13 @@ package sayan.apps.numplex import android.content.Intent -import androidx.appcompat.app.AppCompatActivity import android.os.Bundle -import android.widget.Button -import android.widget.ImageButton -import android.widget.LinearLayout import android.widget.Toast +import androidx.activity.enableEdgeToEdge +import androidx.appcompat.app.AppCompatActivity import com.google.android.gms.auth.api.signin.GoogleSignIn import com.google.android.gms.auth.api.signin.GoogleSignInOptions +import com.google.android.gms.common.SignInButton import com.google.android.gms.common.api.ApiException import com.google.firebase.auth.FirebaseAuth import com.google.firebase.auth.GoogleAuthProvider @@ -25,6 +24,7 @@ class SignInActivity : AppCompatActivity() { super.onCreate(savedInstanceState) setContentView(R.layout.activity_signin) + enableEdgeToEdge() auth = FirebaseAuth.getInstance() @@ -37,7 +37,7 @@ class SignInActivity : AppCompatActivity() { finish() // finish the current activity to prevent the user from coming back to the SignInActivity using the back button } - val signInButton = findViewById(R.id.google_sign_in_button) + val signInButton = findViewById(R.id.google_sign_in_button) signInButton.setOnClickListener { signIn() } diff --git a/app/src/main/res/drawable/ic_launcher_background.xml b/app/src/main/res/drawable/ic_launcher_background.xml deleted file mode 100644 index 07d5da9..0000000 --- a/app/src/main/res/drawable/ic_launcher_background.xml +++ /dev/null @@ -1,170 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/app/src/main/res/drawable/ic_launcher_foreground.xml b/app/src/main/res/drawable/ic_launcher_foreground.xml deleted file mode 100644 index 2b068d1..0000000 --- a/app/src/main/res/drawable/ic_launcher_foreground.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/drawable/sign_in_image_google.png b/app/src/main/res/drawable/sign_in_image_google.png deleted file mode 100644 index e70e72a..0000000 Binary files a/app/src/main/res/drawable/sign_in_image_google.png and /dev/null differ diff --git a/app/src/main/res/layout/activity_signin.xml b/app/src/main/res/layout/activity_signin.xml index 97652b9..70db4d8 100644 --- a/app/src/main/res/layout/activity_signin.xml +++ b/app/src/main/res/layout/activity_signin.xml @@ -10,22 +10,16 @@ + android:layout_marginTop="100dp" + android:src="@drawable/app_icon" /> - + android:contentDescription="@string/google_sign_in" /> \ No newline at end of file diff --git a/app/src/main/res/mipmap-anydpi/ic_launcher.xml b/app/src/main/res/mipmap-anydpi/ic_launcher.xml deleted file mode 100644 index 6f3b755..0000000 --- a/app/src/main/res/mipmap-anydpi/ic_launcher.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/app/src/main/res/mipmap-anydpi/ic_launcher_round.xml b/app/src/main/res/mipmap-anydpi/ic_launcher_round.xml deleted file mode 100644 index 6f3b755..0000000 --- a/app/src/main/res/mipmap-anydpi/ic_launcher_round.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.webp b/app/src/main/res/mipmap-hdpi/ic_launcher.webp deleted file mode 100644 index c209e78..0000000 Binary files a/app/src/main/res/mipmap-hdpi/ic_launcher.webp and /dev/null differ diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp deleted file mode 100644 index b2dfe3d..0000000 Binary files a/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp and /dev/null differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.webp b/app/src/main/res/mipmap-mdpi/ic_launcher.webp deleted file mode 100644 index 4f0f1d6..0000000 Binary files a/app/src/main/res/mipmap-mdpi/ic_launcher.webp and /dev/null differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp deleted file mode 100644 index 62b611d..0000000 Binary files a/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp and /dev/null differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.webp b/app/src/main/res/mipmap-xhdpi/ic_launcher.webp deleted file mode 100644 index 948a307..0000000 Binary files a/app/src/main/res/mipmap-xhdpi/ic_launcher.webp and /dev/null differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp deleted file mode 100644 index 1b9a695..0000000 Binary files a/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp and /dev/null differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp b/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp deleted file mode 100644 index 28d4b77..0000000 Binary files a/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp and /dev/null differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp deleted file mode 100644 index 9287f50..0000000 Binary files a/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp and /dev/null differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp deleted file mode 100644 index aa7d642..0000000 Binary files a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp and /dev/null differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp deleted file mode 100644 index 9126ae3..0000000 Binary files a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp and /dev/null differ