Skip to content

Instantly share code, notes, and snippets.

View virendersran01's full-sized avatar
💻
Working from home

Virender Srxn virendersran01

💻
Working from home
  • India
View GitHub Profile
@koocbor
koocbor / CreateDialog.java
Last active June 20, 2022 15:50
Full Screen Dialog in Android
FullScreenDialog dialog = new FullScreenDialog();
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
dialog.show(ft, FullScreenDialog.TAG);
@polbins
polbins / README.md
Last active February 29, 2024 09:58
Simple RecyclerView Divider

Simple RecyclerView Divider

Simple Horizontal Divider Item Decoration for RecyclerView

    mRecyclerView.addItemDecoration(new SimpleDividerItemDecoration(
            getApplicationContext()
    	));

NOTE: Add item decoration prior to setting the adapter

@heinrichreimer
heinrichreimer / LICENSE
Last active August 29, 2023 14:28
LinearLayoutManager implementation that stretches to fit all list items on screen and disables scrolling. Useful for dashboards etc.
MIT License
Copyright (c) 2020 Jan Heinrich Reimer
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:
@maxirosson
maxirosson / build.gradle
Last active December 28, 2022 12:02
Versioning Android apps
apply plugin: 'com.android.application'
ext.versionMajor = 1
ext.versionMinor = 2
ext.versionPatch = 3
ext.versionClassifier = null
ext.isSnapshot = true
ext.minimumSdkVersion = 19
android {
@mksantoki
mksantoki / MainActivity.java
Created October 31, 2017 17:52
FileChooser in Android webview
/*
reference link ->https://www.opengeeks.me/2015/08/filechooser-and-android-webview/
https://github.com/OpenGeeksMe/Android-File-Chooser
*/
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Intent;
import android.graphics.Bitmap;
import android.net.Uri;
@saschpe
saschpe / Enum.kt
Last active May 24, 2022 21:50
Kotlin enum class extension for Android (SharedPreference, Parcelable, Bundle, Intent)
import android.content.SharedPreferences
import android.os.Bundle
import android.os.Parcel
inline fun <reified T : Enum<T>> Bundle.getEnum(key: String, default: T) =
getInt(key).let { if (it >= 0) enumValues<T>()[it] else default }
fun <T : Enum<T>> Bundle.putEnum(key: String, value: T?) =
putInt(key, value?.ordinal ?: -1)
@atanasovdejan
atanasovdejan / UpdateProfileInfo.swift
Created August 4, 2018 11:13
Update Profile Picture and Display Name in Firebase User
func updateProfileInfo(withImage image: Data? = nil, name: String? = nil, _ callback: ((Error?) -> ())? = nil){
guard let user = Auth.auth().currentUser else {
callback?(nil)
return
}
if let image = image{
let profileImgReference = Storage.storage().reference().child("profile_pictures").child("\(user.uid).png")
_ = profileImgReference.putData(image, metadata: nil) { (metadata, error) in
@bolot
bolot / PeekingLinearLayoutManager.kt
Last active August 30, 2023 07:19
LinearLayoutManager subclass that "peeks", shows a portion of the adjacent child views.
class PeekingLinearLayoutManager : LinearLayoutManager {
@Suppress("Unused")
@JvmOverloads
constructor(context: Context?, @RecyclerView.Orientation orientation: Int = RecyclerView.VERTICAL, reverseLayout: Boolean = false) : super(context, orientation, reverseLayout)
@Suppress("Unused")
constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int, defStyleRes: Int) : super(context, attrs, defStyleAttr, defStyleRes)
override fun generateDefaultLayoutParams() =
scaledLayoutParams(super.generateDefaultLayoutParams())
@quentin41500
quentin41500 / CartManager.kt
Last active June 8, 2021 12:28
Using Sealed class and LiveData to handle network request through the repository layer.
/**
* Observable manager for saving the [Cart]'s resource information.
*/
class CartManager : LiveData<Resource<Cart?>>() {
init {
value = Success(null)
}
/**
@wajahatkarim3
wajahatkarim3 / ActivitiesLaunchingWay.kt
Last active April 3, 2023 08:12
Kotlin Extensions for simpler, easier and funw way of launching of Activities
/**
* Kotlin Extensions for simpler, easier and funw way
* of launching of Activities
*/
inline fun <reified T : Any> Activity.launchActivity (
requestCode: Int = -1,
options: Bundle? = null,
noinline init: Intent.() -> Unit = {})
{