create different ssh key according the article Mac Set-Up Git
$ ssh-keygen -t rsa -C "your_email@youremail.com"
class MainActivity : ComponentActivity() { | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
setContent { | |
PlaygroundTheme { | |
Surface( | |
modifier = Modifier.fillMaxSize(), | |
color = MaterialTheme.colorScheme.background, | |
) { | |
Box { |
create different ssh key according the article Mac Set-Up Git
$ ssh-keygen -t rsa -C "your_email@youremail.com"
/* | |
Copyright 2020 Cedric Kring. | |
Licensed under the Apache License, Version 2.0 (the "License"); | |
you may not use this file except in compliance with the License. | |
You may obtain a copy of the License at | |
http://www.apache.org/licenses/LICENSE-2.0 | |
Unless required by applicable law or agreed to in writing, software | |
distributed under the License is distributed on an "AS IS" BASIS, |
enum class Status { | |
SUCCESS, | |
ERROR, | |
LOADING | |
} | |
data class APIResponse<out T>(val status: Status, val data: T?, val message: String?) { | |
companion object { | |
fun <T> success(data: T): APIResponse<T> = APIResponse( |
fun MainActivity.findDeviceModelManufacturerAndOS() { | |
val status = StringBuilder() | |
.append("\nOS Version: ${Build.VERSION.SDK_INT}") | |
.append("\nMANUFACTURER: ${Build.MANUFACTURER}") | |
.append("\nMODEL: ${Build.MODEL}") | |
"findDeviceModelManufacturerAndOS() $status".logWarn(TAG) | |
} | |
/** |
private fun generateKeyHashFromSHA() { | |
try { | |
val info = packageManager.getPackageInfo(packageName, PackageManager.GET_SIGNATURES) | |
for (signature in info.signatures) { | |
val md = MessageDigest.getInstance("SHA") | |
md.update(signature.toByteArray()) | |
val hashKey = String(Base64.getEncoder().encode(md.digest())) | |
"key: $hashKey".logDebug(TAG) | |
Log.d(TAG, "generateSha1: $hashKey") | |
} |
const val APP_TAG = "Test App" | |
fun String.logVerbose(tag: String = APP_TAG) { | |
if (BuildConfig.DEBUG) | |
Log.v(tag, this) | |
} | |
fun String.logDebug(tag: String = APP_TAG) { | |
if (BuildConfig.DEBUG) | |
Log.d(tag, this) |
private fun translucentStatusBarWithFixedNavigationButtons() { | |
window.apply { | |
clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS) | |
addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS) | |
decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | |
statusBarColor = Color.TRANSPARENT | |
} | |
} |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
setContentView(R.layout.xyz) | |
checkCameraPermission() | |
} | |
private fun checkCameraPermission() { | |
if (ContextCompat.checkSelfPermission(this, Manifest.permission.CAMERA) | |
!= PackageManager.PERMISSION_GRANTED) { |
private fun showDatePickerDialog() { | |
val c = Calendar.getInstance() | |
val year = c.get(Calendar.YEAR) | |
val month = c.get(Calendar.MONTH) | |
val day = c.get(Calendar.DAY_OF_MONTH) | |
getContext()?.let { it -> | |
// Create a new instance of DatePickerDialog and return it | |
val dpd = DatePickerDialog( | |
it, |