Skip to content

Instantly share code, notes, and snippets.

View code-n-roll's full-sized avatar

Roman Karanchuk code-n-roll

View GitHub Profile
https://www.platformer.news/
https://snacks.robinhood.com/
https://future.a16z.com/
https://app.mailbrew.com/unreadit/tech-Rrjzlxqyv6Q1
https://www.deararchitects.xyz/
@skgmn
skgmn / README.md
Last active May 6, 2024 09:21
Step by step to use Android library which has been published to GitHub Packages.
  1. Go to [Your Profile] => [Developer settings] => [Personal access token] => [Generate new token] on github.com
  2. Check read:packages
  3. Click Generate token
  4. Copy the generated token
  5. Add below lines to your ~/.gradle/gradle.properties (the path may be different on Windows)
GITHUB_ID={your github id}
GITHUB_PACKAGES_TOKEN={the generated token}
  1. Merge below lines to your <project root>/settings.gradle (If you are using the recent version of Android Gradle Plugin)
@agnostic-apollo
agnostic-apollo / hasFragileUserData.md
Last active May 13, 2024 18:29
Android hasFragileUserData AndroidManifest.xml flag

The hasFragileUserData flag can be added to the application node of AndroidManifest.xml. If its value is true, then when the user uninstalls the app, a prompt will be shown to the user asking him whether to keep the app's data.

<application
	...
    android:hasFragileUserData="true" tools:targetApi="q">
...
</application>
@cmargonis
cmargonis / ExampleUsage.kt
Last active May 4, 2022 09:35
Gradient span which can be applied to an Android TextView
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
val textView: TextView = findViewById(R.id.tv_hello)
val text = "Hello World!"
val purple = getColor(R.color.purple_200)
val teal = getColor(R.color.teal_200)
@Shipaaaa
Shipaaaa / Navigation-Battle-Navigation-component-links.md
Last active January 29, 2024 05:49
Полезные материалы, которые встречались в навигационной битве в Android Broadcast.
@southerton81
southerton81 / Retrofit2WithRxJava2TestCase.kt
Created July 2, 2020 11:20
Retrofit2WithRxJava2TestCase
package com.example.myapplication
import io.reactivex.Observable
import okhttp3.mockwebserver.MockWebServer
import org.junit.Rule
import org.junit.Test
import retrofit2.Retrofit
import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory
import retrofit2.converter.gson.GsonConverterFactory
import retrofit2.http.*
@iamnaran
iamnaran / activity_layout.xml
Last active September 20, 2023 17:21
Layout And RecyclerView Animation Android (Made Simple with XML only)
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layoutAnimation="@anim/layout_animation"
android:orientation="vertical">
</ScrollView>
@michaeltys
michaeltys / ShareFileToInstagram
Created October 10, 2018 15:13
Sharing an image to instagram stories or create a post
private void shareFileToInstagram(Uri uri, boolean isVideo, Post post) {
Intent feedIntent = new Intent(Intent.ACTION_SEND);
feedIntent.setType(isVideo ? "video/*" : "image/*");
feedIntent.putExtra(Intent.EXTRA_STREAM, uri);
feedIntent.setPackage(Constants.INSTAGRAM_PACKAGE_NAME);
Intent storiesIntent = new Intent("com.instagram.share.ADD_TO_STORY");
storiesIntent.setDataAndType(uri, isVideo ? "mp4" : "jpg");
storiesIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
storiesIntent.setPackage(Constants.INSTAGRAM_PACKAGE_NAME);
@mirceanis
mirceanis / SuspendExtensionTest.kt
Created August 6, 2018 18:08
Mocking suspend functions that wrap callbacks - works as long as they're not extensions
import com.nhaarman.mockitokotlin2.any
import com.nhaarman.mockitokotlin2.doReturn
import com.nhaarman.mockitokotlin2.mock
import com.nhaarman.mockitokotlin2.whenever
import kotlinx.coroutines.experimental.runBlocking
import org.junit.Assert
import org.junit.Test
import kotlin.coroutines.experimental.suspendCoroutine
/**
@saber-solooki
saber-solooki / SimpleRecyclerView.java
Created July 7, 2018 18:40
Sticky Header RecyclerView
package com.saber.customstickyheader;
import android.graphics.Color;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;