Skip to content

Commit

Permalink
Dev (#8)
Browse files Browse the repository at this point in the history
update 1.2.1: blocks, unicode 15
  • Loading branch information
vadiole authored Mar 10, 2022
1 parent 875d26f commit 46ad171
Show file tree
Hide file tree
Showing 51 changed files with 73,370 additions and 498 deletions.
11 changes: 5 additions & 6 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
plugins {
id("com.android.application")
kotlin("android")
// kotlin("kapt")
}

android {
Expand All @@ -11,24 +10,24 @@ android {
applicationId = "vadiole.unicode"
minSdk = 26
targetSdk = 31
versionCode = 11
versionName = "1.1"
versionCode = 121
versionName = "1.2.1"
resourceConfigurations.addAll(listOf("en"))
setProperty("archivesBaseName", "Unicode-v$versionName")
setProperty("archivesBaseName", "unicode-v$versionName")
}

buildTypes {
getByName("debug") {
applicationIdSuffix = ".debug"
isMinifyEnabled = false
isShrinkResources = false
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
proguardFiles("proguard-rules.pro")
}

getByName("release") {
isMinifyEnabled = true
isShrinkResources = true
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
proguardFiles("proguard-rules.pro")
}
}

Expand Down
101 changes: 18 additions & 83 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -1,103 +1,38 @@
# Default PV proguard file - use it and abuse it if its useful.

# If you keep the line number information, uncomment this to
# hide the original source file name.
-renamesourcefileattribute SourceFile

-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclassmembers
-verbose
-optimizationpasses 5
-overloadaggressively
-allowaccessmodification

# Optimization is turned off by default. Dex does not like code run
# through the ProGuard optimize and preverify steps (and performs some of these optimisations on its own).
-dontpreverify

# Note that if you want to enable optimization, you cannot just
# include optimization flags in your own project configuration file;
# instead you will need to point to the
# "proguard-android-optimize.txt" file instead of this one from your
# project.properties file.
-repackageclasses ""
-renamesourcefileattribute ""

##########
# Android:
##########

##########
# Parcelables: Mantain the parcelables working
##########
-keep class * implements android.os.Parcelable {
public static final android.os.Parcelable$Creator *;
-assumenosideeffects class kotlin.jvm.internal.Intrinsics {
public static void checkExpressionValueIsNotNull(java.lang.Object, java.lang.String);
public static void checkFieldIsNotNull(java.lang.Object, java.lang.String);
public static void checkFieldIsNotNull(java.lang.Object, java.lang.String, java.lang.String);
public static void checkNotNull(java.lang.Object);
public static void checkNotNull(java.lang.Object, java.lang.String);
public static void checkNotNullExpressionValue(java.lang.Object, java.lang.String);
public static void checkNotNullParameter(java.lang.Object, java.lang.String);
public static void checkParameterIsNotNull(java.lang.Object, java.lang.String);
public static void checkReturnedValueIsNotNull(java.lang.Object, java.lang.String);
public static void checkReturnedValueIsNotNull(java.lang.Object, java.lang.String, java.lang.String);
}

-keepclassmembers class * implements android.os.Parcelable {
static ** CREATOR;
public static final android.os.Parcelable$Creator CREATOR;
}

-keepclassmembers class **.R$* {
public static <fields>;
}

#############
# Serializables
#############
-keepclassmembers class * implements java.io.Serializable {
static final long serialVersionUID;
private static final java.io.ObjectStreamField[] serialPersistentFields;
private void writeObject(java.io.ObjectOutputStream);
private void readObject(java.io.ObjectInputStream);
java.lang.Object writeReplace();
java.lang.Object readResolve();
}
##########
# Kotlin
##########
-dontwarn kotlin.**
-dontnote kotlin.**
-dontwarn kotlinx.atomicfu.AtomicBoolean
-keepclassmembers class **$WhenMappings {
<fields>;
}
-keep class kotlin.** { *; }
-keep class kotlin.Metadata { *; }
# Guarded by a NoClassDefFoundError try/catch and only used when on the classpath.
-dontwarn kotlin.Unit
#Ignore null checks at runtime
-assumenosideeffects class kotlin.jvm.internal.Intrinsics {
static void checkParameterIsNotNull(java.lang.Object, java.lang.String);
}

-keepclassmembers class **$WhenMappings {
<fields>;
}
-keepclassmembers class kotlin.Metadata {
public <methods>;
}
-assumenosideeffects class kotlin.jvm.internal.Intrinsics {
static void checkParameterIsNotNull(java.lang.Object, java.lang.String);
}
##########
# Coroutines
##########
# ServiceLoader support
-keepnames class kotlinx.coroutines.internal.MainDispatcherFactory {}
-keepnames class kotlinx.coroutines.CoroutineExceptionHandler {}

########################################
# External Libraries
########################################

##########
# Android architecture components: Lifecycle ( https://issuetracker.google.com/issues/62113696 )
##########

# HttpClient Legacy (Ignore) - org.apache.http legacy
#############
-dontnote android.net.http.*
-dontnote org.apache.commons.codec.**
-dontnote org.apache.http.**
##########

##########
# JSR 305 annotations are for embedding nullability information.
##########
-dontwarn javax.annotation.**
-keepnames class kotlinx.coroutines.CoroutineExceptionHandler {}
4 changes: 4 additions & 0 deletions app/src/debug/res/drawable/ic_launcher_foreground_debug.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/ic_launcher_foreground" />
<item android:drawable="@drawable/ic_launcher_overlay_debug" />
</layer-list>
12 changes: 12 additions & 0 deletions app/src/debug/res/drawable/ic_launcher_overlay_debug.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:fillColor="#FF8800"
android:pathData="M0 73h108v35H0V73Z" />
<path
android:fillColor="#FFFFFFFF"
android:pathData="M40.8 84.1c-0.7 0-1.2-0.2-1.6-0.7-0.4-0.4-0.6-1-0.6-1.8v-1.9c0-0.8 0.2-1.4 0.6-1.8 0.4-0.4 0.9-0.7 1.6-0.7 0.5 0 1 0.2 1.3 0.4 0.3 0.3 0.5 0.7 0.5 1.2l-0.2-0.3h0.2l0-1.5v-1.9h1.1V84h-1.1v-1.3h-0.2l0.2-0.3c0 0.5-0.2 0.9-0.5 1.2-0.3 0.3-0.8 0.4-1.3 0.4Zm0.4-0.9c0.5 0 0.8-0.1 1.1-0.4 0.3-0.3 0.4-0.7 0.4-1.2v-1.8c0-0.5-0.1-0.9-0.4-1.2-0.3-0.3-0.6-0.4-1.1-0.4-0.5 0-0.8 0.1-1.1 0.4-0.3 0.3-0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1.4-0.2-1.8-0.7-0.5-0.5-0.7-1.1-0.7-1.9v-4.2h1.1v4.2c0 0.5 0.1 0.9 0.4 1.2 0.3 0.3 0.6 0.4 1.1 0.4 0.4 0 0.8-0.1 1.1-0.4 0.3-0.3 0.4-0.7 0.4-1.2v-4.2h1.1v4.2c0 0.8-0.2 1.4-0.7 1.9-0.5 0.5-1.1 0.7-1.8 0.7Zm4.8 2v-1h2.1c0.3 0 0.6-0.1 0.7-0.2 0.2-0.2 0.2-0.4 0.2-0.7V83.4l0-1.2h-0.2l0.2-0.2c0 0.5-0.2 0.9-0.5 1.1-0.3 0.3-0.8 0.4-1.3 0.4-0.7 0-1.2-0.2-1.6-0.7-0.4-0.5-0.6-1.1-0.6-1.8v-1.4c0-0.7 0.2-1.3 0.6-1.8 0.4-0.4 0.9-0.7 1.6-0.7 0.5 0 1 0.1 1.3 0.4 0.3 0.3 0.5 0.7 0.5 1.1l-0.2-0.2h0.2V77.4h1.1v6.8c0 0.6-0.2 1.1-0.6 1.4-0.4 0.4-0.9 0.5-1.5 0.5h-2.1Zm1.6-3.5c0.5 0 0.8-0.1 1.1-0.4 0.3-0.3 0.4-0.7 0.4-1.2V79.8c0-0.5-0.1-0.9-0.4-1.2-0.3-0.3-0.6-0.4-1.1-0.4-0.5 0-0.8 0.1-1.1 0.4-0.3 0.3-0.4 0.7-0.4 1.2v1.3c0 0.5 0.1 0.9 0.4 1.2 0.3 0.3 0.6 0.4 1.1 0.4Z" />
</vector>
28 changes: 28 additions & 0 deletions app/src/debug/res/drawable/splash_screen.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:width="184dp"
android:height="184dp"
android:drawable="@drawable/ic_launcher_background"
android:gravity="center" />
<item
android:width="184dp"
android:height="184dp"
android:drawable="@drawable/ic_launcher_foreground"
android:gravity="center" />
<item
android:width="184dp"
android:height="184dp"
android:drawable="@drawable/ic_launcher_overlay_debug"
android:gravity="center" />
<item
android:width="270dp"
android:height="270dp"
android:gravity="center">
<shape android:shape="oval">
<stroke
android:width="74dp"
android:color="@color/windowBackground" />
</shape>
</item>
</layer-list>
5 changes: 5 additions & 0 deletions app/src/debug/res/mipmap/ic_launcher.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground_debug" />
</adaptive-icon>
5 changes: 5 additions & 0 deletions app/src/debug/res/mipmap/ic_launcher_round.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground_debug" />
</adaptive-icon>
5 changes: 0 additions & 5 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@
xmlns:tools="http://schemas.android.com/tools"
package="vadiole.unicode">

<queries>
<intent>
<action android:name="android.support.customtabs.action.CustomTabsService" />
</intent>
</queries>
<application
android:name=".UnicodeApp"
android:allowBackup="false"
Expand Down
Binary file removed app/src/main/assets/u14_v2.sqlite
Binary file not shown.
Binary file added app/src/main/assets/u15.sqlite
Binary file not shown.
140 changes: 140 additions & 0 deletions app/src/main/kotlin/vadiole/generator/generator.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
import java.io.File
import java.io.PrintWriter

class Version(
val start: Int,
val end: Int?,
val version: String,
) {
fun contains(codePoint: Int): Boolean {
return if (end == null) {
codePoint == start
} else {
codePoint >= start && codePoint <= end
}
}
}

class Block(
val id: Int,
val start: Int,
val end: Int,
val name: String,
) {
fun print(out: PrintWriter) {
out.println("$id,$name,$start,$end")
}
}

class Char(
val id: Int,
val codePoint: Int,
val name: String,
val name2: String,
val blockId: Int,
val version: String,
) {
fun print(out: PrintWriter) {
out.println("$id,$codePoint,$name,$name2,$blockId,$version")
}
}

fun main() {
val root = "app/src/main/kotlin/vadiole/generator"
val blocks = File("$root/input/block.txt")
.readCsv(";")
.mapIndexed { id, lineData ->
val limits = lineData.first().split("..")
val start = limits[0].toInt(16)
val end = limits[1].toInt(16)
val name = lineData[1]
Block(id, start, end, name)
}
val versions = File("$root/input/version.txt")
.readCsv(";")
.map { lineData ->
val limits = lineData.first().split("..")
return@map if (limits.size == 1) {
Version(
limits[0].toInt(16),
null,
lineData[1],
)
} else {
Version(
limits[0].toInt(16),
limits[1].toInt(16),
lineData[1],
)
}
}
val chars = File("$root/input/data.txt")
.readCsv(";")
.mapIndexed { id, lineData ->
val codePoint = lineData[0].toInt(16)
var name = lineData[1]
var name2 = lineData[10]
if (name == "<control>") {
name = name2
name2 = ""
// chars 128, 129, 132 has no names in unicode data
when (codePoint) {
128 -> {
name = "PADDING CHARACTER"
}
129 -> {
name = "HIGH OCTET PRESET"
}
132 -> {
name = "INDEX"
}
153 -> {
name = "SINGLE GRAPHIC CHARACTER INTRODUCER"
}
}
}
if (name.isEmpty()) {
throw RuntimeException("char with code point $codePoint has no name")
}
val blockId = blocks
.find { block ->
codePoint >= block.start && codePoint <= block.end
}!!
.id
val version = versions
.find { version ->
version.contains(codePoint)
}?.version ?: "1.0"
Char(id, codePoint, name, name2, blockId, version)
}

File("$root/output/char.csv").printWriter().use { out ->
chars.forEach { char ->
char.print(out)
}
}

File("$root/output/block.csv").printWriter().use { out ->
blocks.forEach { block ->
block.print(out)
}
}
}

fun File.readCsv(delimiter: String): List<List<String>> {
return readLines()
.filterNot { line ->
line.startsWith("#")
}
.filter { line ->
line.isNotBlank()
}
.map { line ->
line
.substringBefore("#")
.split(delimiter)
.map { string ->
string.trim()
}
}
}
Loading

0 comments on commit 46ad171

Please sign in to comment.