Skip to content

Instantly share code, notes, and snippets.

View kalaiselvan369's full-sized avatar
🎯
Focusing

Kalaiselvan kalaiselvan369

🎯
Focusing
View GitHub Profile

Diagram Coroutines: suspend

1. Preface

Coroutines is the most amazing feature in Kotlin.

In this post, I'll briefly introduce Kotlin coroutines, and then explain Coroutines in the form of Diagram + Animation. After reading this post, you may find out that Coroutines is not that difficult.

Coroutines-dispatch

@matteocrippa
matteocrippa / flutter.md
Last active April 20, 2025 03:41
Flutter Cheatsheet

Flutter

A quick cheatsheet of useful snippet for Flutter

Widget

A widget is the basic type of controller in Flutter Material. There are two type of basic Widget we can extend our classes: StatefulWidget or StatelessWidget.

Stateful

StatefulWidget are all the widget that interally have a dynamic value that can change during usage. It can receive an input value in the constructor or reference to functions. You need to create two classes like:

@chinmaygarde
chinmaygarde / Dockerfile
Created July 2, 2018 18:09
Flutter Android on Docker
# Flutter (https://flutter.io) Developement Environment for Linux
# ===============================================================
#
# This environment passes all Linux Flutter Doctor checks and is sufficient
# for building Android applications and running Flutter tests.
#
# To build iOS applications, a Mac development environment is necessary.
#
FROM debian:stretch
@FrancescoJo
FrancescoJo / AndroidAESCipherHelper.kt
Last active December 3, 2022 20:18
Android AES cipher helper with system generated key. No more static final String key in our class - an approach which is very vulnerable to reverse engineering attack. Available only API Level 23(M)+
import android.annotation.TargetApi
import android.os.Build
import android.security.keystore.KeyGenParameterSpec
import android.security.keystore.KeyProperties
import android.util.Base64
import timber.log.Timber
import java.security.GeneralSecurityException
import java.security.KeyStore
import javax.crypto.Cipher
import javax.crypto.KeyGenerator
@chethann
chethann / WebviewResourceMappingHelper.java
Created November 24, 2017 09:19
WebviewResourceMappingHelper Sample Code
package com.test.android.helpers;
import android.os.Build;
import android.webkit.WebResourceResponse;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.test.android.Application;
import org.apache.commons.collections.CollectionUtils;
@yitz-grocerkey
yitz-grocerkey / ErrorInterceptor.kt
Created June 13, 2017 19:32
Retrofit RxJava global error handling in Kotlin
// for any errors that should be handled before being handed off to RxJava.
// In other words global error logic.
// An example might be 401 when not logging in
import okhttp3.Interceptor
import okhttp3.Response
class ErrorInterceptor: Interceptor {
override fun intercept(chain: Interceptor.Chain?): Response {
@koesie10
koesie10 / ApiModule.java
Created October 3, 2015 07:40
Retrofit 1 error handling behaviour in Retrofit 2
// Dagger 1 example
@Module(
complete = false,
library = true
)
public final class ApiModule {
@Provides
@Singleton
Retrofit provideRetrofit(Gson gson, Application app) {
return new Retrofit.Builder()
@gabrielemariotti
gabrielemariotti / Readme.md
Last active January 1, 2025 22:35
A SimpleSectionedRecyclerViewAdapter: use this class to realize a simple sectioned `RecyclerView.Adapter`.

You can use this class to realize a simple sectioned RecyclerView.Adapter without changing your code.

The RecyclerView should use a LinearLayoutManager. You can use this code also with the TwoWayView with the ListLayoutManager (https://github.com/lucasr/twoway-view)

This is a porting of the class SimpleSectionedListAdapter provided by Google

Screen

Example:

@dafi
dafi / ClickableTextView.java
Created November 26, 2013 12:49
Android TextView changing color when clicked. It uses the setSelect(); to change color. Show how to change text color and background
package com.ternaryop.phototumblrshare.widget;
import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnTouchListener;
import android.widget.TextView;
public class ClickableTextView extends TextView implements OnTouchListener {
@sunnyone
sunnyone / AndroidBluetoothSppClientSample.java
Created September 25, 2013 13:48
Android Bluetooth SPP Client Sample
final String command = "HELO\n";
final UUID sppUuid = UUID.fromString("00001101-0000-1000-8000-00805F9B34FB");
BluetoothAdapter.getDefaultAdapter();
if (btAdapter == null) {
sendLogMessage("Bluetooth adapter is not available.");
return;
}
sendLogMessage("Bluetooth adapter is found.");