Skip to content

Instantly share code, notes, and snippets.

View utsmannn's full-sized avatar
😼
kerja

Muhammad Utsman utsmannn

😼
kerja
View GitHub Profile
@utsmannn
utsmannn / qris_parser.py
Last active August 30, 2024 15:10
Qris parser
from dataclasses import dataclass, field
from typing import Optional
@dataclass
class MerchantAccount:
identifier: str = "" # 26/51 / 00
merchant_id: str = "" # 26/51 / 02
merchant_pan: str = "" # 26/51 / 01
merchant_criteria: str = "" # 26/51 / 03
map.setOnCameraIdleListener {
val newPosition = map.cameraPosition.target
if (newPosition != oldPosition) {
// drag ended
icon_marker.animate().translationY(0f).start()
icon_marker_shadow.animate().withStartAction {
icon_marker_shadow.setPadding(0)
}.start()
getLocation(newPosition) { item ->
private fun getLocation(latLng: LatLng, done: (Item) -> Unit) {
val at = "${latLng.latitude},${latLng.longitude}"
if (!hasFetch) {
animateMarker = false
progress_circular.visibility = View.VISIBLE
GlobalScope.launch {
try {
val places = retrofitInstance.getLocation(at).items
runOnUiThread {
if (places.isNotEmpty()) {
interface RetrofitInstance {
@GET("/v1/revgeocode")
suspend fun getLocation(
@Query("at") at: String,
@Query("apiKey") apiKey: String = Constant.apiKey
): Places
companion object {
fun create(): RetrofitInstance {
data class Places (
val items: List<Item>
)
data class Item (
val title: String,
val id: String,
val resultType: String,
val address: Address,
val position: Position,
(map_view as SupportMapFragment).getMapAsync { map ->
map.moveCamera(CameraUpdateFactory.newLatLngZoom(jakartaLatLng, 18f))
val oldPosition = map.cameraPosition.target
map.setOnCameraMoveStartedListener {
// drag started
// start animation
icon_marker.animate().translationY(-50f).start()
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout 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=".MainActivity">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/bottom_sheet"
android:layout_width="match_parent"
android:layout_height="100dp"
android:background="@android:color/white"
android:padding="12dp"
app:behavior_hideable="true"
app:behavior_peekHeight="100dp"
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<size
android:width="120dp"
android:height="30dp"/>
<solid android:color="#000000"/>
</shape>
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M0 0h24v24H0z" />
<path