1
0
Fork 0
mirror of https://github.com/anyproto/anytype-kotlin.git synced 2025-06-08 05:47:05 +09:00

Integrate page icon picker (#280)

This commit is contained in:
Evgenii Kozlov 2020-03-10 17:41:25 +03:00 committed by GitHub
parent b4a3401671
commit ab1b602176
Signed by: github
GPG key ID: 4AEE18F83AFDEB23
67 changed files with 1206 additions and 230 deletions

1
library-emojifier/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
/build

View file

@ -0,0 +1,46 @@
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
def config = rootProject.extensions.getByName("ext")
compileSdkVersion config["compile_sdk"]
defaultConfig {
minSdkVersion config["min_sdk"]
targetSdkVersion config["target_sdk"]
versionCode config["version_code"]
versionName config["version_name"]
testInstrumentationRunner config["test_runner"]
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
testOptions {
unitTests {
includeAndroidResources = true
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
}
}
dependencies {
implementation project(':domain')
def lib = rootProject.ext.libraryPageIconPicker
implementation lib.emojiJava
}

View file

21
library-emojifier/proguard-rules.pro vendored Normal file
View file

@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile

View file

@ -0,0 +1 @@
<manifest package="com.agileburo.anytype.emojifier" />

View file

@ -0,0 +1,24 @@
package com.agileburo.anytype.emojifier
import com.agileburo.anytype.domain.emoji.Emoji
import com.agileburo.anytype.domain.emoji.Emojifier
import com.vdurmont.emoji.EmojiManager
class DefaultEmojifier : Emojifier {
override suspend fun fromAlias(alias: String): Emoji {
check(alias.isNotEmpty()) { "Alias cannot be empty" }
return EmojiManager.getForAlias(alias).let { result ->
Emoji(
unicode = result.unicode,
alias = result.aliases.first()
)
}
}
override suspend fun fromShortName(name: String): Emoji {
check(name.isNotEmpty()) { "Short name cannot be empty" }
val alias = name.substring(1, name.length - 1)
return fromAlias(alias)
}
}

View file

@ -0,0 +1,3 @@
<resources>
<string name="app_name">Library Emojifier</string>
</resources>