Skip to content

Instantly share code, notes, and snippets.

View Kolyall's full-sized avatar
📱

Nick Unuchek Kolyall

📱
View GitHub Profile
@bmc08gt
bmc08gt / StaggeredVerticalGrid.kt
Last active March 13, 2023 04:42
A StaggeredVerticalGrid with support for lazyPagingItems in Jetpack Compose
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.BoxWithConstraints
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.lazy.GridCells
import androidx.compose.foundation.lazy.LazyColumn
@rnkoaa
rnkoaa / FlowableUtils.java
Created January 11, 2017 18:12
Convert a listenable future to an rxjava-2 flowable or single
import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import io.reactivex.*;
/**
* Created on 1/11/2017.
*/
public class FlowableUtils {
@webserveis
webserveis / material text sizes.md
Last active August 10, 2024 02:29 — forked from passsy/material text sizes.md
Material font sizes

Material text sizes XML for Android

Simple helper file for standard text sizes in material design. The sizes are provided by the material design documentation https://www.google.com/design/spec/style/typography.html#typography-roboto

material typography

Standard Styles

Too many type sizes and styles at once can wreck any layout. A typographic scale is a limited set of type sizes that work well together, along with the layout grid. The basic set of styles are based on a typographic scale of 12, 14, 16, 20, and 34.

@arthtilva
arthtilva / download.java
Last active March 21, 2023 12:15
DownloadManager - download files using DownloadManager
public class NewsDetailActivity extends AppCompatActivity implements View.OnClickListener {
Activity activity;
Toolbar toolbar;
File TEMP_FILE_SAVE_PATH = Environment.getExternalStorageDirectory();
String TEMP_FILE_NAME = "news_";
String URL="";
private DownloadManager downloadManager;
@Override
package com.amulyakhare.textdrawable;
import android.graphics.*;
import android.graphics.drawable.ShapeDrawable;
import android.graphics.drawable.shapes.OvalShape;
import android.graphics.drawable.shapes.RectShape;
import android.graphics.drawable.shapes.RoundRectShape;
/**
* @author amulya
@lopspower
lopspower / README.md
Last active January 20, 2024 09:18
Publish AAR to jCenter and Maven Central

Publish AAR to jCenter and Maven Central

Twitter

EDIT: You can find this same updated tutorial here -> Medium

Now I'm going to list how to publish an Android libray to jCenter and then syncronize it with Maven Central:

  1. I use "Android Studio" and I have this simple android lib that I would like to be available on maven: CircularImageView
Observable.just(1)
.doOnSubscribe(() -> System.out.println("before 1st doOnSubscribe: " + Thread.currentThread().getName()))
.subscribeOn(Schedulers.newThread())
.doOnSubscribe(() -> System.out.println("before 2nd doOnSubscribe: " + Thread.currentThread().getName()))
.subscribeOn(Schedulers.io())
.doOnSubscribe(() -> System.out.println("before 3rd doOnSubscribe: " + Thread.currentThread().getName()))
.subscribeOn(Schedulers.computation())
.doOnSubscribe(() -> System.out.println("before subscribe: " + Thread.currentThread().getName()))
.subscribe(new Subscriber<Integer>() {
@Override
@cesarferreira
cesarferreira / RxJava.md
Last active February 2, 2022 07:28
Party tricks with RxJava, RxAndroid & Retrolambda

View Click

Instead of the verbose setOnClickListener:

RxView.clicks(submitButton).subscribe(o -> log("submit button clicked!"));

Filter even numbers

Observable
    .just(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
@carlonzo
carlonzo / CacheFragmentStatePagerAdapter.java
Created August 2, 2015 17:08
FragmentStatePagerAdapter that caches each pages.
/*
* Copyright 2014 Soichiro Kashima
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@Dogesmith
Dogesmith / Code.java
Last active January 31, 2022 12:35
Android Multi-line EditText which prevents newline characters from being added
mContent = (EditText) v.findViewById(R.id.dialog_item_content_EditText);
mContent.setText(mContentInit);
mContent.setRawInputType(InputType.TYPE_CLASS_TEXT);
mContent.setImeActionLabel(getResources().getString(R.string.done), EditorInfo.IME_ACTION_DONE);
mContent.setImeOptions(EditorInfo.IME_ACTION_DONE);
mContent.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (event == null) {