• This repository has been archived on 08/Sep/2023
  • Stars
    star
    132
  • Rank 265,534 (Top 6 %)
  • Language
    Kotlin
  • License
    MIT License
  • Created over 5 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Collection of classes that helps you to manage a screen state.

State Delegator

Logo

Version License

State delegator is a collection of classes that helps you to manage a screen state and reduces boilerplate code.

Example

When changing a screen state you always have to show or hide the certain views:

when (state) {
    LOADING -> {
        loading_view.visibility = View.VISIBLE
        content_view.visibility = View.GONE
        stub_view.visibility = View.GONE
    }
    CONTENT -> {
        loading_view.visibility = View.GONE
        content_view.visibility = View.VISIBLE
        stub_view.visibility = View.GONE
    }
    STUB -> {
        loading_view.visibility = View.GONE
        content_view.visibility = View.GONE
        stub_view.visibility = View.VISIBLE
    }
}

To reduce a boilerplate code we use LoadingStateDelegate class:

val screenState = LoadingStateDelegate(content_view, loading_view, stub_view)
...
when (state) {
    LOADING -> screenState.showLoading()
    CONTENT -> screenState.showContent()
    STUB -> screenState.showStub()
}

Overview

Check documentation

Check sample

Download

To get started using state-delegator is to add it as a gradle dependency. You need to make sure you have the MavenCentral repository included in the build.gradle file in the root of your project:

repositories {
    mavenCentral()
}

Next add a dependency in the build.gradle file of your app module. The following will add a dependency to the library:

dependencies {
    ...

    implementation "com.redmadrobot:state-delegator:1.7"
}

And that's all! :-)

License

MIT License

Copyright (c) 2020 Redmadrobot

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:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

More Repositories

1

input-mask-android

User input masking library repo.
Kotlin
1,210
star
2

figma-export

Command line utility to export colors, typography, icons and images from Figma to Xcode / Android Studio project
Swift
705
star
3

input-mask-ios

User input masking library repo.
Swift
573
star
4

Chronos

Android library that handles asynchronous jobs.
Java
133
star
5

kotlin-style-guide

red_mad_robot Kotlin Style Guide
87
star
6

PINkman

PINkman is a library to help implementing an authentication by a PIN code in a secure manner. The library derives hash from the user's PIN using Argon2 function and stores it in an encrypted file. The file is encrypted with the AES-256 algorithm in the GCM mode and keys are stored in the AndroidKeystore.
Kotlin
85
star
7

DAO

Swift
74
star
8

flipper

Flipper is a simple and useful tool to deal with feature toggles
Kotlin
70
star
9

gradle-version-catalogs

Version catalogs used in red_mad_robot Android team
Kotlin
68
star
10

RMRColorTools-iOS

Objective-C
67
star
11

catbird

Mock server for UI tests
Swift
50
star
12

edge-to-edge-decorator

Edge to edge decorator - is a utility class that is responsible for coloring the statusBar and navigationBar to maintain edge to edge (e2e) mode.
Kotlin
47
star
13

apexy-ios

The library for organizing a network layer in your awesome project.
Swift
44
star
14

NeumorphicWallet

๐Ÿ’ณ Neumorphic Wallet app concept in SwiftUI
Swift
43
star
15

PrioritizedTabBar

๐Ÿ“ฑ Native iOS TabBar with prioritized layout
Swift
42
star
16

gradle-infrastructure

Set of small plugins to reduce boilerplate in Gradle build scripts.
Kotlin
42
star
17

omega-bank-ios

The Bank you really need.
Swift
28
star
18

redmadrobot-android-ktx

Missing Android KTX extensions.
Kotlin
27
star
19

figmiro-plugin

Figma Integration with Miro (Plugin)
TypeScript
26
star
20

Alarm-Clock

โฐ Alarm Clock / Proof of concept for our Colored Alarm Clock Interface shot @ Dribbble
Swift
26
star
21

perspective-animation-ios

Example of perspective photo animation from camera
Swift
24
star
22

mapmemory

Simple in-memory cache conception built on Map.
Kotlin
22
star
23

acronym-avatar

Library to show avatars with acronyms.
Kotlin
18
star
24

ACSlider

๐ŸŽš A slider displaying selected value
Swift
16
star
25

fastlane-plugin-jira_release_notes

Fastlane Plugin for Jira Release Notes
Ruby
15
star
26

synopsis

Swift source code scanner.
Swift
13
star
27

itemsadapter

The simple adapter to render static data in RecyclerView
Kotlin
13
star
28

golden-key

Security framework compatible with CryptoKit
Swift
12
star
29

android-mad-showcase

Welcome to Modern Android Development (MAD) Showcase, the Android application following modern practices: Kotlin, Coroutines, Flow, Compose, GraphQL etc
Kotlin
11
star
30

VolumeButtons

VolumeButtons provides interface for handle clicks on hardware volume buttons on iOS devices
Swift
10
star
31

navidux

Swift
10
star
32

DAO-generator

Swift
10
star
33

AndroidStudioTemplates

Templates for android studio
FreeMarker
9
star
34

android-docker-images

Docker images used in red_mad_robot Android team
Shell
7
star
35

fastlane-plugin-gmail

Fastlane Plugin for Gmail
Ruby
7
star
36

rmr_django

Template Django project
Python
7
star
37

http-transport

Synchronous HTTP transport library.
Swift
7
star
38

figmiro-server

This is proxy server for Figmiro plugin that works with Miro's REST API
TypeScript
6
star
39

FitnessAppWithDynamicIsland

Demo app designed to demostrate the capabilities of the new Apple Dynamic Island.
Swift
6
star
40

debug-panel-android

Library for easy application debugging
Kotlin
5
star
41

autograph

Swift source code generation kit.
Swift
5
star
42

frontend-robopractice-test-task

HTML
5
star
43

use-dropdown

HTML
4
star
44

FitnessDynamicIsland

Swift
4
star
45

service-autograph

Service generation utility.
Swift
4
star
46

fastlane-plugin-imessage

Ruby
4
star
47

model-compiler

Swift
4
star
48

danger-jira_issue_links

Danger plugin
Ruby
4
star
49

techradar-android

RMR Technology Radar
Kotlin
3
star
50

core-parser-generator

Swift
3
star
51

core-parser

Swift
3
star
52

parser-autograph

Object parser generation utility.
Swift
3
star
53

floating-text-input

Swift
2
star
54

opensource

Redmadrobot opensource
Ruby
2
star
55

homebrew-formulae

Redmadrobot Homebrew tap
Ruby
2
star
56

rmr-docker

Shell
1
star
57

service-generator

Swift
1
star
58

Toaster

Swift
1
star