Skip to content

Instantly share code, notes, and snippets.

View mmobin789's full-sized avatar
💭
Vene Vidi Vici

Mobin Munir mmobin789

💭
Vene Vidi Vici
View GitHub Profile
@mmobin789
mmobin789 / InternetMonitor.kt
Last active July 29, 2021 10:41
An Internet Monitor class which can be registered in Android to listen for internet connectivity states.
import android.annotation.TargetApi
import android.content.Context
import android.net.ConnectivityManager
import android.net.Network
import android.net.NetworkRequest
import android.os.Build
/**
@mmobin789
mmobin789 / Pixel.kt
Last active May 28, 2020 00:17
Shows use-cases for image loading using Pixel library.
// Loads an image without a placeholder.
Pixel.load("https://example.com/image.jpg", iv)
// Loads an image with a placeholder resource.
Pixel.load("https://example.com/image.jpg", iv3, PixelOptions.Builder().setPlaceholderResource(R.drawable.ic_loading_android).build())
// Loads an image of 30x30 pixels with a placeholder resource.
Pixel.load("https://example.com/image.jpg", holder.iv, PixelOptions.Builder().setPlaceholderResource(R.drawable.ic_loading_android)
.setImageSize(30, 30).build())
@mmobin789
mmobin789 / DrawRoute Usage.kt
Last active October 30, 2020 20:08
A sample for using DrawRoute Library.
override fun onMapReady(p0: GoogleMap?) {
this.googleMap = p0
val source = LatLng(31.490127, 74.316971) //starting point (LatLng)
val destination = LatLng(31.474316, 74.316112) // ending point (LatLng)
googleMap?.run {
moveCameraOnMap(latLng = source)
@mmobin789
mmobin789 / build.gradle (Maven Central Migration specific)
Created April 23, 2021 20:13
An example build.gradle file (project level) for maven central migration.
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.4.32'
ext.espressoVersion = "3.3.0"
repositories {
google()
jcenter()
}
@mmobin789
mmobin789 / build.gradle (Library's Maven Central Example)
Last active April 25, 2021 19:49
A sample library module's maven central's custom plugged in file.
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'com.vanniktech.maven.publish' // NEW
publishing {
@mmobin789
mmobin789 / gradle.properties (Sample for maven central)
Last active April 24, 2021 02:59
A gradle properties file required by maven central to publish & update a library.
GROUP=io.github.mmobin789.pixel
POM_ARTIFACT_ID=pixel
VERSION_NAME=1.0.0-alpha
POM_NAME=pixel
POM_PACKAGING=aar
POM_DESCRIPTION=A lightweight image loader for Android backed by Kotlin Coroutines.
POM_INCEPTION_YEAR=2020
@mmobin789
mmobin789 / Include Pixel in Android
Created April 25, 2021 21:45
This dependency is used to include pixel library in any android project.
//pixel
implementation 'io.github.mmobin789.pixel:pixel:1.0.0-alpha'