Instagram-like story editor in compose

Related tags

App story-editor
Overview

Release

Story Editor

Instagram-like story editor to add content to your pictures.

Note: this is still a WIP

Setup

First, add jitpack in your build.gradle at the end of repositories:

repositories {
   // ...
   maven { url "https://jitpack.io" }
}

Then, add the library dependency:

implementation 'com.github.badoualy:story-editor:0.1.0'

Usage

(See MainActivity sample)

In your manifest:

android:windowSoftInputMode="adjustResize"

In your activity (important to handle keyboard correctly):

WindowCompat.setDecorFitsSystemWindows(window, false)

Then:

val elements = remember { mutableStateListOf() }
StoryEditor(
  state = rememberStoryEditorState(),
  elements = elements,
  modifier = modifier.fillMaxSize(),
  onClick = {
    val element = StoryTextElement()
    editorState.focusedElement = element
    elements.add(element)
  },
  onDeleteElement = {
    elements.remove(it)
  },
) {
  AsyncImage(
    "https://i.ytimg.com/vi/h78qlOYCXJQ/maxresdefault.jpg",
    contentDescription = null,
    contentScale = ContentScale.Crop,
    modifier = Modifier.aspectRatio(9f / 16f)
  )
}

@Composable
private fun rememberStoryEditorState(): StoryEditorState {
  return remember {
    StoryEditorState(
      elementsBoundsFraction = Rect(0.01f, 0.1f, 0.99f, 0.99f),
      editMode = true,
      debug = true, // draws hitbox red box
      screenshotMode = StoryEditorState.ScreenshotMode.FULL
    )
  }
}

Screenshot

You can take a screenshot of the editor's content via editorState.takeScreenshot().

  • Specify a screenshot mode when creating your StoryEditorState.
  • A ComposeView is used to render the editor inside an AndroidView, which can then be rendered on a bitmap. Because of this overhead, this feature is opt-in and disabled by default.

Current restrictions:

  • Make sure you background doesn't have any hardware bitmap, or you'll get the exception: Software rendering doesn't support hardware bitmaps. If you're using Coil/Glide/... you can disable hardware bitmap when creating the request.
  • If your background is clipped to a given shape, the bitmap will also be clipped.

Screenshot mode:

  • DISABLED: Screenshot support is disabled, no AndroidView used
  • FULL: Screenshot support is enabled, and the screenshot will contain background + content
  • FULL_NOT_CLIPPED: Same as FULL, but the screenshot won't be clipped to the StoryEditor's shape. This is useful when you specify a shape for the background, and you don't want the screenshot to be clipped.
  • CONTENT: Screenshot support is enabled, and the screenshot will contain only the content without the background

Elements

By default, only a TextElement is provided, but you can easily add your own components to the editor. Check TextElement implementation to do so.

You might also like...
📦📦Video downloader for Android - Download videos from Youtube, Facebook, Twitter, Instagram, Dailymotion, Vimeo and more than 1000 other sites
📦📦Video downloader for Android - Download videos from Youtube, Facebook, Twitter, Instagram, Dailymotion, Vimeo and more than 1000 other sites

youtube-dl-android 📦 An Android client for youtube-dl: https://github.com/rg3/youtube-dl Major technologies Language: Kotlin Architecture: MVVM Andro

A minimalist clone of the popular Social Media Platform "Instagram"

InstaLocal A minimalist clone of the popular Social Media Platform "Instagram" powered by Firebase and written in Kotlin. The app allows users to sign

KotinInstagramClone - Kotlin Instagram Clone
KotinInstagramClone - Kotlin Instagram Clone

Kotin Instagram Clone Bu uygulamayı yazarken çeşitli kaynaklardan yardım alarak

Instagram clone App in android using Kotlin, LiveData, MVVM, Dagger, RxJava and Retrofit.
Instagram clone App in android using Kotlin, LiveData, MVVM, Dagger, RxJava and Retrofit.

Instagram-Project-in-android-with-MVVM-architecture Project from MindOrks Professional Bootcamp with self practice work and added some additional feat

A clone of Instagram I made with Firebase.
A clone of Instagram I made with Firebase.

InstagramClone In this project, I made an Instagram clone. I used firebase auth, firestore database and storage, I wrote it according to mvvm architec

Android-stories: A simple stories library inspired by Instagram and alike
Android-stories: A simple stories library inspired by Instagram and alike

A simple stories library inspired by Instagram and alike. Requirements Min SDK = 22 Installation Add these dependencies to your proje

This is a practical project for Professional Android Developers that covers clean Architecture basics using the following: skills: Real-like coding with Kotlin, MVVM Design pattern, Kotlin Coroutines, Room database, Navigation Controller, Jetpack compose, Use cases, and Dependency injection using Dagger-Hilt. MVVM + Kotlin + Jetpack Compose +Navigation Compose + Hilt + Retrofit + Unit Testing + Compose Testing + Coroutines + Kotlin Flow + Io mockK
MVVM + Kotlin + Jetpack Compose +Navigation Compose + Hilt + Retrofit + Unit Testing + Compose Testing + Coroutines + Kotlin Flow + Io mockK

MvvmKotlinJetpackCompose Why do we need an architecture even when you can make an app without it? let's say you created a project without any architec

An app that is a one-stop destination for all the CS enthusiasts, providing resources like Information scrapping techniques, best YT channels, courses available free-of-cost, etc.  & knowledge about every domain and field that exists on the Internet related to Computer Science along with News, Jobs, and Internships opportunities in these domains along with valuable tips and hacks from mentors for a particular domain.
An app that is a one-stop destination for all the CS enthusiasts, providing resources like Information scrapping techniques, best YT channels, courses available free-of-cost, etc. & knowledge about every domain and field that exists on the Internet related to Computer Science along with News, Jobs, and Internships opportunities in these domains along with valuable tips and hacks from mentors for a particular domain.

An app that is a one-stop destination for all the CS enthusiasts, providing resources like Information scrapping techniques, best YT channels, courses available free-of-cost, etc. & knowledge about every domain and field that exists on the Internet related to Computer Science along with News, Jobs, and Internships opportunities in these domains along with valuable tips and hacks from mentors for a particular domain.

Releases(v1.0.1)
Owner
Yann Badoual
Yann Badoual
APK Explorer & Editor, an open-source tool to explore the contents of an installed APK

APK Explorer & Editor, an open-source tool to explore the contents of an installed APK, is strictly made with an aim to inspect an installed APK file.

APK Explorer & Editor 270 Dec 25, 2022
A file manager,apk editor....

A file manager,apk editor....

FlyingYu 41 Oct 20, 2022
🌄 Photo editor using native modules for iOS and Android. Inherit from 2 available libraries, Brightroom (iOS) and PhotoEditor (Android)

React Native Photo Editor (RNPE) ?? Image editor using native modules for iOS and Android. Inherit from 2 available libraries, Brightroom (iOS) and Ph

Baron Ha. 242 Dec 28, 2022
An advanced DEX editor for Android.

An advanced DEX editor for Android.

Mike Anderson 75 Jan 3, 2023
A truly hackable editor: simple, lightweight, understandable

kanvas A very simple editor built in Kotlin and intended to be extended and hacked. It is very simple to customize it to handle a language defined usi

Federico Tomassetti 139 Dec 28, 2022
JBytedit - Java bytecode editor

JBytedit - Java bytecode editor JBytedit was a free, fully featured graphical Java Bytecode editor made by (Matthew Dupraz). This is an archival copy

null 1 Jan 22, 2022
Android Kotlin Fundamentals: 02.3 ConstraintLayout using the Layout Editor

ColorMyViews Android Kotlin Bootcamp from Google Developer website Android Kotli

Marcelo Viana 0 Feb 13, 2022
A capable — pixel art editor for Android.

A capable — pixel art editor for Android.

thebluepandabear 128 Dec 31, 2022
Turtle Graphics 🐢 implementation for Android Platform with Code Editor, Preview Screen and packages

Turtle Graphics Download Turtle is an Android Application inspired from the original Turtle Graphics and Logo, Logo is an educational programming lang

Amr Hesham 15 Dec 30, 2022
Implementation of Instagram with Material Design (originally based on Emmanuel Pacamalan's concept)

InstaMaterial Updated Current source code contains UI elements from Design Support Library. If you still want to see how custom implementations of e.g

Mirosław Stanek 5k Dec 27, 2022