Skip to content

Instantly share code, notes, and snippets.

View devrath's full-sized avatar
💭
I'm grateful when for one drop in glass. Since I knw exactly what to do with it

Devrath devrath

💭
I'm grateful when for one drop in glass. Since I knw exactly what to do with it
View GitHub Profile
@devrath
devrath / ConnectivityExtension.kt
Created March 17, 2021 03:28 — forked from alana-mullen/ConnectivityExtension.kt
Android Kotlin extension to check network connectivity
import android.content.Context
import android.net.ConnectivityManager
import android.net.NetworkCapabilities
import android.os.Build
val Context.isConnected: Boolean
get() {
val connectivityManager = this.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager
return when {
Build.VERSION.SDK_INT >= Build.VERSION_CODES.M -> {
@Schadenfeude
Schadenfeude / app.build.gradle
Last active May 15, 2023 12:08
Gradle configuration for better dependency management in a multi-module project
apply plugin: 'com.android.application'
apply from: "$rootDir/common.gradle"
apply plugin: 'androidx.navigation.safeargs.kotlin'
android {
defaultConfig {
applicationId app_config.app_id
setProperty("archivesBaseName", app_config.archive_file)
}
@joyrexus
joyrexus / README.md
Last active February 24, 2024 15:16
collapsible markdown

collapsible markdown?

CLICK ME

yes, even hidden code blocks!

print("hello world!")
import android.annotation.TargetApi;
import android.content.Context;
import android.content.res.ColorStateList;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.os.Build;
import android.text.Editable;
import android.util.AttributeSet;
import android.util.TypedValue;
@gabrielemariotti
gabrielemariotti / README.md
Last active March 9, 2023 06:02
A SectionedGridRecyclerViewAdapter: use this class to realize a simple sectioned grid `RecyclerView.Adapter`.

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

Screen

The RecyclerView has to use a GridLayoutManager.

This is a porting of the class SimpleSectionedListAdapter provided by Google

If you are looking for a sectioned list RecyclerView.Adapter you can take a look here

@emil2k
emil2k / Locator.java
Last active April 29, 2022 04:25
Android utility class for getting device location using various methods. Depends on `Connectivity` class found here: https://gist.github.com/emil2k/5130324
/*
* Copyright (c) 2017 Emil Davtyan
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
@emil2k
emil2k / Connectivity.java
Last active December 22, 2023 06:03
Android utility class for checking device's network connectivity and speed.
/*
* Copyright (c) 2017 Emil Davtyan
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions: