This file contains hidden or 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
| class MainActivity : ComponentActivity() { | |
| override fun onCreate(savedInstanceState: Bundle?) { | |
| super.onCreate(savedInstanceState) | |
| setContent { | |
| MyApplicationTheme { | |
| Surface( | |
| modifier = Modifier.fillMaxSize(), | |
| color = MaterialTheme.colors.background | |
| ) { | |
| GreetingView(Greeting().greet()) |
This file contains hidden or 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
| class IOSPlatform: Platform { | |
| override val name: String = UIDevice.currentDevice.systemName() + " " + UIDevice.currentDevice.model() | |
| } | |
| actual fun getPlatform(): Platform = IOSPlatform() |
This file contains hidden or 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
| class AndroidPlatform : Platform { | |
| override val name: String = "Android ${android.os.Build.BRAND}" | |
| } | |
| actual fun getPlatform(): Platform = AndroidPlatform() |
This file contains hidden or 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
| class Greeting { | |
| private val platform: Platform = getPlatform() | |
| fun greet(): String { | |
| return "Hello, ${platform.name}!" | |
| } | |
| } |
This file contains hidden or 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
| interface Platform { | |
| val name: String | |
| } | |
| expect fun getPlatform(): Platform |
This file contains hidden or 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
| 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); |
This file contains hidden or 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
| <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" |
This file contains hidden or 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
| //Keyring Service | |
| implementation "com.huawei.hms:keyring-credential:6.4.0.302" |
This file contains hidden or 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
| <uses-permission android:name="com.huawei.hms.permission.ACTIVATE_SERVICE"/> |
NewerOlder