Skip to content

Instantly share code, notes, and snippets.

View necatisozer's full-sized avatar
👨‍💻
You don't know me, you're about to...

Necati Sözer necatisozer

👨‍💻
You don't know me, you're about to...
View GitHub Profile
@necatisozer
necatisozer / App.kt
Created March 8, 2024 22:29
Movie App
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.lazy.grid.GridCells
import androidx.compose.foundation.lazy.grid.LazyVerticalGrid
import androidx.compose.foundation.lazy.grid.items
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.*
import androidx.compose.runtime.*
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
@necatisozer
necatisozer / ExponentialRetry.kt
Created October 1, 2023 15:37
ExponentialRetry.kt
private suspend fun <T> exponentialRetry(
maxTries: Int = Int.MAX_VALUE,
initialDelay: Long = Long.MAX_VALUE,
retryFactor: Int = Int.MAX_VALUE,
block: suspend () -> T
): T? {
var currentDelay = initialDelay
var retryAttempt = 1
do {
runCatching {
/*
* Copyright 2023 Lyrebird Studio
*/
package com.lyrebirdstudio.facelab.ui.photoedit
import android.graphics.Matrix
import androidx.activity.compose.BackHandler
import androidx.compose.animation.AnimatedVisibility
import androidx.compose.animation.AnimatedVisibilityScope
import androidx.compose.animation.EnterTransition
class BindingAdapterInitializer @Inject constructor(
private val bindingAdapter: GenericBindingAdapter
) : ApplicationInitializer {
override fun invoke(context: Context) {
DataBindingUtil.setDefaultComponent(object : DataBindingComponent {
override fun getGenericBindingAdapter() = bindingAdapter
})
}
}
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<DatePicker
android:id="@+id/datePicker"
package tr.com.bisu.app.core.presentation.base.extension
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.content.IntentFilter
import android.os.Build
import android.widget.DatePicker
import android.widget.TimePicker
import androidx.annotation.CheckResult
import org.json.JSONException
import org.json.JSONObject
@Throws(JSONException::class)
fun jsonOf(vararg pairs: Pair<String, Any?>) = JSONObject().apply {
for ((key, value) in pairs) {
when (value) {
is Boolean -> put(key, value)
is Double -> put(key, value)
is Int -> put(key, value)
@necatisozer
necatisozer / change_notifier_provider_builder.dart
Last active April 26, 2020 02:07
A ChangeNotifierProvider wrapper for consuming the value immediately.
import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart';
import 'package:provider/provider.dart';
import 'package:provider/single_child_widget.dart';
typedef Build<T> = Widget Function(BuildContext context, T value, Widget child);
/// A [ChangeNotifierProvider] wrapper for consuming [T] value immediately.
///
/// ## Creating a [ChangeNotifierProviderBuilder]
class Response {
List<Data> data;
Response({this.data});
Response.fromJson(Map<String, dynamic> json) {
if (json['data'] != null) {
data = new List<Data>();
json['data'].forEach((v) {
data.add(new Data.fromJson(v));