Skip to content

Instantly share code, notes, and snippets.

View erdalkaymak's full-sized avatar

erdalkaymak

View GitHub Profile
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
MyApplicationTheme {
Surface(
modifier = Modifier.fillMaxSize(),
color = MaterialTheme.colors.background
) {
GreetingView(Greeting().greet())
class IOSPlatform: Platform {
override val name: String = UIDevice.currentDevice.systemName() + " " + UIDevice.currentDevice.model()
}
actual fun getPlatform(): Platform = IOSPlatform()
class AndroidPlatform : Platform {
override val name: String = "Android ${android.os.Build.BRAND}"
}
actual fun getPlatform(): Platform = AndroidPlatform()
class Greeting {
private val platform: Platform = getPlatform()
fun greet(): String {
return "Hello, ${platform.name}!"
}
}
interface Platform {
val name: String
}
expect fun getPlatform(): Platform
plugins {
kotlin("multiplatform")
id("com.android.library")
//Kotlinx Serialization
kotlin("plugin.serialization") version "1.8.0"
}
kotlin {
public class KeyringServiceActivity extends AppCompatActivity {
private EditText mUsername;
private EditText mPassword;
private boolean mShowPassword = false;
private CredentialClient mCredentialClient;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_keyring_service);
<androidx.constraintlayout.widget.ConstraintLayout 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"
tools:context="com.hms.explorehms.keyring.KeyringServiceIntroductionActivity">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar_keyring_example"
style="@style/ToolbarAppearance.ExploreHMS.Normal"
//Keyring Service
implementation "com.huawei.hms:keyring-credential:6.4.0.302"
<uses-permission android:name="com.huawei.hms.permission.ACTIVATE_SERVICE"/>