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:
parent
b4a3401671
commit
ab1b602176
67 changed files with 1206 additions and 230 deletions
1
library-emojifier/.gitignore
vendored
Normal file
1
library-emojifier/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
/build
|
46
library-emojifier/build.gradle
Normal file
46
library-emojifier/build.gradle
Normal 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
|
||||
}
|
0
library-emojifier/consumer-rules.pro
Normal file
0
library-emojifier/consumer-rules.pro
Normal file
21
library-emojifier/proguard-rules.pro
vendored
Normal file
21
library-emojifier/proguard-rules.pro
vendored
Normal 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
|
1
library-emojifier/src/main/AndroidManifest.xml
Normal file
1
library-emojifier/src/main/AndroidManifest.xml
Normal file
|
@ -0,0 +1 @@
|
|||
<manifest package="com.agileburo.anytype.emojifier" />
|
|
@ -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)
|
||||
}
|
||||
}
|
3
library-emojifier/src/main/res/values/strings.xml
Normal file
3
library-emojifier/src/main/res/values/strings.xml
Normal file
|
@ -0,0 +1,3 @@
|
|||
<resources>
|
||||
<string name="app_name">Library Emojifier</string>
|
||||
</resources>
|
Loading…
Add table
Add a link
Reference in a new issue