Skip to content

Instantly share code, notes, and snippets.

View canergulgec's full-sized avatar

Caner Gülgeç canergulgec

View GitHub Profile
@yusufceylan
yusufceylan / OpenCameraAndSavePhoto.kt
Last active February 6, 2023 03:18
Take photo from camera and save it to gallery
// Take photo from camera and save it to public gallery
// Before Q and After Q implementations
// Answer riginally taken from this SO answer
// https://stackoverflow.com/a/59482148/5695091
private val REQUEST_TAKE_PHOTO = 101
private val REQUEST_PICK_PHOTO = 102
private var photoURI : Uri? = null
@murgupluoglu
murgupluoglu / WaitInstrumentedTest.kt
Last active April 15, 2019 11:31
suspend for loop
import android.os.AsyncTask
import android.util.Log
import androidx.test.ext.junit.runners.AndroidJUnit4
import org.junit.Test
import org.junit.runner.RunWith
import java.io.BufferedInputStream
import java.net.URL
/**
* Created by Mustafa Urgupluoglu on 12.04.2019.
@adavis
adavis / CommonExtensions.kt
Last active April 2, 2024 20:51
Common Android Extensions in Kotlin
fun View.visible() {
visibility = View.VISIBLE
}
fun View.invisible() {
visibility = View.INVISIBLE
}
fun View.gone() {
visibility = View.GONE
@ccjeng
ccjeng / CustomInfoWindowAdapter.java
Last active February 27, 2024 12:40
Custom InfoWindow Layout for Google Map in Android
public class CustomInfoWindowAdapter implements GoogleMap.InfoWindowAdapter {
private Activity context;
public CustomInfoWindowAdapter(Activity context){
this.context = context;
}
@Override
@lopspower
lopspower / README.md
Last active May 3, 2024 13:26
Hexadecimal color code for transparency

Hexadecimal color code for transparency

Twitter

How to set transparency with hex value ?

For example, you want to set 40% alpha transparence to #000000 (black color), you need to add 66 like this #66000000.

Download This sample on Google Play Store

@alexfu
alexfu / EqualSpacingItemDecoration.java
Last active August 22, 2023 07:53
Add equal spacing to RecyclerView items automatically. Can handle horizontal, vertical, and grid display modes
import android.graphics.Rect;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
public class EqualSpacingItemDecoration extends RecyclerView.ItemDecoration {
private final int spacing;
private int displayMode;
public static final int HORIZONTAL = 0;
@patrickhammond
patrickhammond / ParcelableHelper.java
Last active April 20, 2021 02:22
A Parcelable is not always immediately deep copied; this forces an immediate deep copy into a new Parcelable instance.
import android.os.Parcel;
import android.os.Parcelable;
public class ParcelableHelper {
/**
* There is not always a guarantee that Parcelable values will be immediately written out and
* read back in. For data data that mutable (its own issue), this can be a problem. This is
* for the times when it would be great to have confidence that you will be working with a copy
* of that data.
*/