Skip to content

Instantly share code, notes, and snippets.

Материалы для вхождения в MVI

Открытые вопросы

  • Что такое единый стейт? Если экран сложный, то как описывать сложные стейты. Если через seald class, то по какому принципу описывать seald class со стейтом?
  • Как работать с single liveData (map/distinct?)
  • Как работать с command liveData? Нужно разделить общие команды и приватные для каждого экрана.
  • Как подружить liveData и state-delegate? Какую сделать структуры обертки для загружаемых данных(Loading, Content, Error).
  • Как обрабатывать пересоздание диалогов (как подсунуть новую лямбду) Нужно посмотреть сюда.
@Shipaaaa
Shipaaaa / Knock_Knock!_Who_s_there?_Open.md
Last active July 2, 2021 07:07
Источники и полезные материалы к докладу "Тук-тук! Кто там? Открыто…"
@gabrielemariotti
gabrielemariotti / README.MD
Last active September 24, 2024 09:22
How to use the ShapeableImageView.

The Material Components Library introduced with the 1.2.0-alpha03 the new ShapeableImageView.

In your layout you can use:

 <com.google.android.material.imageview.ShapeableImageView
      android:id="@+id/image_view"
      app:srcCompat="@drawable/..." />

Then in your code apply the ShapeAppearanceModel to define your custom corners:

@Benjiko99
Benjiko99 / DbMigrationsHelper.kt
Last active February 2, 2022 18:16
Android Room Database migration helper for ALTER TABLE
object Example {
fun alterTableUsage(database: SupportSQLiteDatabase) {
DbMigrationsHelper.alterTable(
db = database,
tableName = "Reservations",
columns = mapOf(
"id INTEGER".toExisting(), // Retains without changes
"title TEXT".toExisting("name"), // Renames column "name" to "title"
"description TEXT".toNothing(), // Adds a new column
@mrblrrd
mrblrrd / AppActivity.kt
Created October 29, 2019 13:26
Sample methods for logging received push notifications on Android.
package com.example.ui
import android.app.Activity
import android.content.Intent
import android.os.Bundle
import com.example.util.toKeyValueString
import timber.log.Timber
class AppActivity : Activity() {
@wilik16
wilik16 / build.gradle
Last active November 8, 2022 12:52
Archive/Copy debug or release APK / AAB (Android App Bundle) file and/or mapping.txt to a versioned folder
android {
applicationVariants.all { variant ->
variant.outputs.all {
def fileName = "app"
switch (variant.buildType.name) {
case "debug":
fileName = "${appNameDebug}-${variant.versionCode}"
break
case "release":
fileName = "${appNameRelease}-${variant.versionCode}"
@Glorfindel83
Glorfindel83 / broken-image-repairer.md
Last active August 19, 2023 14:08
Broken Image Repairer

Broken Image Repairer

What is the problem?

A long time ago, it was possible to inline images from all kinds of external sources. Since the switch from HTTP to HTTPS, this is no longer possible; only HTTPS sources are allowed. This leads to ugly blurbs like

alt text http://example.com/image.png

instead of a nicely formatted page with images. Sometimes, the links don't even work anymore, even with HTTPS images, which will show like this: ... Luckily, we have the Wayback Machine which is able to rescue some of the lost images. Since a picture often says more than a thousand words, it's important to bring back the post into its original state; important enough to justify the occasional bump of an old post (see below).

@darnmason
darnmason / SwipeView.kt
Last active February 19, 2024 17:10
A custom Android ViewGroup that contains a single child and allows you to swipe it to the left, with a callback once the swipe is complete. For example to dismiss a view. Works well in a LinearLayout with animateLayoutChanges=true when setting the SwipeView visibility to GONE on swipe.
import android.content.Context
import android.support.v4.view.ViewCompat
import android.support.v4.widget.ViewDragHelper
import android.util.AttributeSet
import android.view.MotionEvent
import android.view.View
import android.widget.FrameLayout
class SwipeView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0) : FrameLayout(context, attrs, defStyleAttr) {
@BenoitDuffez
BenoitDuffez / mig
Last active October 12, 2023 18:52
Parse migration failed exception (Android Room)
#!/bin/bash
# Clean up on exit
function finish {
rm -f expected found
}
trap finish EXIT
# How to parse JSON
JQ="jq --sort-keys"