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
# Use the latest 2.1 version of CircleCI pipeline process engine. | |
# See: https://circleci.com/docs/2.0/configuration-reference | |
# For a detailed guide to building and testing on Android, read the docs: | |
# https://circleci.com/docs/2.0/language-android/ for more details. | |
version: 2.1 | |
# Orbs are reusable packages of CircleCI configuration that you may share across projects, enabling you to create encapsulated, parameterized commands, jobs, and executors that can be used across multiple projects. | |
# See: https://circleci.com/docs/2.0/orb-intro/ | |
orbs: | |
android: circleci/[email protected] |
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
fun String.convertDate(context: Context): String? { | |
return try{ | |
// "2021-11=10T16:24:21.579537Z" | |
val currentLocale = ConfigurationCompat.getLocales(context.resources.configuration)[0] | |
val inputFormat = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", Locale.getDefault()) | |
inputFormat.timeZone = TimeZone.getTimeZone("GMT") | |
val passedDate: Date = inputFormat.parse(this) as Date | |
// Form example Mon, Nov *, 2021, 12:10 pm |
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
// 1. The Interface | |
// --> Two ways to do it, | |
``` | |
@Multipart | |
@POST("the_endpoint") | |
suspend fun postImage( | |
@Part profile_photo: MultipartBody.Part, | |
@Part ("profile_photo") requestBody: RequestBody |
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
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { | |
val parsedDate = LocalDateTime.parse(item.created_at, DateTimeFormatter.ISO_DATE_TIME) | |
val formattedDate = parsedDate.format(DateTimeFormatter.ofPattern("dd.MM.yyyy | HH:mm")) | |
textCreatedTime.text = formattedDate | |
} else { | |
val parser = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss") | |
val formatter = SimpleDateFormat("dd.MM.yyyy | HH:mm") | |
val formattedDate = formatter.format(parser.parse(item.created_at)!!) | |
textCreatedTime.text = formattedDate | |
} |
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
<?xml version="1.0" encoding="utf-8"?> | |
<shape xmlns:android="http://schemas.android.com/apk/res/android"> | |
<gradient | |
android:type="linear" | |
android:angle="45" | |
android:startColor="@color/green" | |
android:centerColor="@color/white" | |
android:endColor="@color/orange" /> | |
</shape> |
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
val regionId = MutableLiveData<Int>() | |
fun setRegionId(id: Int){ | |
regionId.value = id | |
} | |
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
val builder = LatLngBounds.Builder() | |
val locBounds = LatLngBounds(LatLng(53.394655, 10.09989), LatLng(53.694865, 9.75758)) | |
builder.include(locBounds.southwest) | |
builder.include(locBounds.northeast) | |
googleMap.animateCamera(CameraUpdateFactory.newLatLngBounds(builder.build(), 100)) |
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 Solution { | |
fun reverse(x: Int): Int { | |
var res = 0 | |
var n = x | |
while (n != 0) { | |
if (Math.abs(res) > Int.MAX_VALUE/10) return 0 | |
res = res*10 + n % 10 | |
n /= 10 | |
} |
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 Solution { | |
fun findMedianSortedArrays(nums1: IntArray, nums2: IntArray): Double { | |
// Check if num1 is smaller than num2 | |
// If not, then we will swap num1 with num2 | |
if (nums1.size > nums2.size) { | |
return findMedianSortedArrays(nums2, nums1) | |
} | |
// Lengths of two arrays | |
val m = nums1.size | |
val n = nums2.size |
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
//Finding the length of the longest substring without repeating characters | |
//Solution | |
// Iterate through an array, evaluating if new substring should be the max substring | |
//Time complexity is O(n)..since we're iterating through an array once | |
//Space complexity is constant | |
class Solution { | |
fun lengthOfLongestSubstring(str: String): Int{ | |
val map: HashMap<Char, Int> = hashMapOf() | |
var max = 0 | |
// last repeat of any character |
NewerOlder