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
private val loginResultcontract = | |
registerForActivityResult(ActivityResultContracts.StartActivityForResult()) { | |
if (it.resultCode == AppCompatActivity.RESULT_OK) { | |
val intent = Intent(this@MainActivity, ProfileActivity::class.java) | |
startActivity(intent) | |
} | |
} |
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
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
setContentView(R.layout.activity_main) | |
AGConnectInstance.initialize(this) | |
val authParams: AccountAuthParams = | |
AccountAuthParamsHelper(AccountAuthParams.DEFAULT_AUTH_REQUEST_PARAM) | |
.setProfile() | |
.setEmail() | |
.setAuthorizationCode().createParams() |
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
<?xml version="1.0" encoding="utf-8"?> | |
<selector xmlns:android="http://schemas.android.com/apk/res/android"> | |
<item> | |
<shape> | |
<gradient android:angle="90" | |
android:endColor="#f2fcfe" | |
android:startColor="#1c92d2" /> | |
</shape> | |
</item> | |
</selector> |
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
dependencies { | |
implementation 'androidx.core:core-ktx:1.7.0' | |
implementation 'androidx.appcompat:appcompat:1.4.2' | |
implementation 'com.google.android.material:material:1.6.1' | |
implementation 'androidx.constraintlayout:constraintlayout:2.1.4' | |
testImplementation 'junit:junit:4.13.2' | |
androidTestImplementation 'androidx.test.ext:junit:1.1.3' | |
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.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
<?xml version="1.0" encoding="utf-8"?> | |
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
xmlns:tools="http://schemas.android.com/tools" | |
android:paddingTop="32dp"> | |
<com.google.android.gms.common.SignInButton | |
android:id="@+id/btn_login" |
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
<?xml version="1.0" encoding="utf-8"?> | |
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
xmlns:tools="http://schemas.android.com/tools" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
android:background="@drawable/login_background" | |
android:gravity="center" | |
android:orientation="vertical" | |
tools:context=".MainActivity"> |
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
flavorDimensions "store" | |
productFlavors{ | |
playStore{ | |
dimension "store" | |
applicationIdSuffix ".gms" | |
versionNameSuffix "-gms" | |
minSdk 21 | |
buildConfigField "String","STORE_TYPE",'\"Google Play Store\"' | |
} | |
appGallery{ |
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
fun isHmsAvailable(context: Context?): Boolean { | |
var isAvailable = false | |
if (null != context) { | |
val result = HuaweiApiAvailability.getInstance().isHuaweiMobileServicesAvailable(context) | |
isAvailable = ConnectionResult.SUCCESS == result | |
} | |
Log.i(TAG, "isHmsAvailable: $isAvailable") | |
return isAvailable | |
} |
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
buildscript { | |
ext { | |
... | |
compose_version = '1.0.1' | |
kotlin_version = '1.5.21' | |
} | |
dependencies { | |
... | |
classpath 'com.android.tools.build:gradle:7.0.0' | |
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" |