Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

include font files and use noto font for emoji and text. tweak theme a bit. #202

Merged
merged 13 commits into from
Apr 7, 2024
Merged
4 changes: 2 additions & 2 deletions .github/workflows/build_without_gitrepo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ jobs:
- name: remove git repo
run: ls -al ; rm -Rf .git/ ; ls -al

- name: build workaround
run: git init
# - name: build workaround
# run: git init

- name: remove git command
run: |
Expand Down
1 change: 1 addition & 0 deletions .localrun/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ ubuntu_18.04_linux
ll.sh
c-toxcore
ubuntu_20.04_linux/
debian_12_linux/
nixos/
32 changes: 32 additions & 0 deletions .localrun/Dockerfile_deb12
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# syntax=docker/dockerfile:1
FROM debian:12

ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update && \
apt-get -y --force-yes install \
ca-certificates \
libconfig-dev \
wget \
unzip \
zip \
automake \
autotools-dev \
build-essential \
check \
checkinstall \
libtool \
pkg-config \
rsync \
git \
gdb \
nano \
g++ \
cmake \
yasm \
openjdk-17-jdk-headless

RUN apt-get update && \
apt-get -y --force-yes install \
nasm \
sudo
124 changes: 124 additions & 0 deletions .localrun/docker_linux_fast_deb12_with_asan.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
#! /bin/bash

_HOME2_=$(dirname "$0")
export _HOME2_
_HOME_=$(cd "$_HOME2_" || exit;pwd)
export _HOME_

echo "$_HOME_"
cd "$_HOME_" || exit

if [ "$1""x" == "buildx" ]; then
docker build -f Dockerfile_deb12 -t trifa_materia_003_deb12 .
exit 0
fi


build_for='debian:12
'


for system_to_build_for in $build_for ; do

system_to_build_for_orig="$system_to_build_for"
system_to_build_for=$(echo "$system_to_build_for_orig" 2>/dev/null|tr ':' '_' 2>/dev/null)"_linux"

cd "$_HOME_"/ || exit
mkdir -p "$_HOME_"/"$system_to_build_for"/

# rm -Rf $_HOME_/"$system_to_build_for"/script 2>/dev/null
# rm -Rf $_HOME_/"$system_to_build_for"/workspace 2>/dev/null

mkdir -p "$_HOME_"/"$system_to_build_for"/artefacts
mkdir -p "$_HOME_"/"$system_to_build_for"/script
mkdir -p "$_HOME_"/"$system_to_build_for"/workspace

ls -al "$_HOME_"/"$system_to_build_for"/

rsync -a ../ --exclude=.localrun "$_HOME_"/"$system_to_build_for"/workspace/data
chmod a+rwx -R "$_HOME_"/"$system_to_build_for"/workspace/data

echo '#! /bin/bash


#------------------------

pwd
ls -al
id -a

mkdir -p /workspace/data/jni-c-toxcore/
cd /workspace/data/jni-c-toxcore/ || exit 1

ls -al

set -x

if [ "$1""x" == "localx" ]; then
WITHASAN=1
if [ "$WITHASAN""x" == "1x" ]; then
echo "*******ASAN*******"
echo "*******ASAN*******"
echo "*******ASAN*******"
../circle_scripts/deps_linux.sh local asan || exit 1
../circle_scripts/java_jni_lib_linux.sh local asan || exit 1
else
../circle_scripts/deps_linux.sh local || exit 1
../circle_scripts/java_jni_lib_linux.sh local || exit 1
fi

else
WITHASAN=1
if [ "$WITHASAN""x" == "1x" ]; then
echo "*******ASAN*******"
echo "*******ASAN*******"
echo "*******ASAN*******"
../circle_scripts/deps_linux.sh "" asan || exit 1
../circle_scripts/java_jni_lib_linux.sh "" asan || exit 1
else
../circle_scripts/deps_linux.sh || exit 1
../circle_scripts/java_jni_lib_linux.sh || exit 1
fi
fi


#------------------------


' > "$_HOME_"/"$system_to_build_for"/script/run.sh

if [ "$1""x" == "localx" ]; then
echo " ******* LOCAL *******"
echo " ******* LOCAL *******"
echo " ******* LOCAL *******"
docker run -ti --rm \
-v "$_HOME_"/"$system_to_build_for"/artefacts:/artefacts \
-v "$_HOME_"/"$system_to_build_for"/script:/script \
-v "$_HOME_"/"$system_to_build_for"/workspace:/workspace \
-v "$_HOME_"/"$system_to_build_for"/c-toxcore:/c-toxcore \
--net=host \
"trifa_materia_002_ub20" \
/bin/sh -c "apk add bash >/dev/null 2>/dev/null; /bin/bash /script/run.sh local"
if [ $? -ne 0 ]; then
echo "** ERROR **:$system_to_build_for_orig"
exit 1
else
echo "--SUCCESS--:$system_to_build_for_orig"
fi
else
docker run -ti --rm \
-v "$_HOME_"/"$system_to_build_for"/artefacts:/artefacts \
-v "$_HOME_"/"$system_to_build_for"/script:/script \
-v "$_HOME_"/"$system_to_build_for"/workspace:/workspace \
--net=host \
"trifa_materia_003_deb12" \
/bin/sh -c "apk add bash >/dev/null 2>/dev/null; /bin/bash /script/run.sh"
if [ $? -ne 0 ]; then
echo "** ERROR **:$system_to_build_for_orig"
exit 1
else
echo "--SUCCESS--:$system_to_build_for_orig"
fi
fi
done

2 changes: 1 addition & 1 deletion asan_run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#
# config:
#
java_17_or_newer_dir=/usr/lib/jvm/java-21-openjdk-amd64/
java_17_or_newer_dir=/usr/lib/jvm/temurin-21-jdk-amd64/
asan_runtime_lib=/usr/lib/x86_64-linux-gnu/libasan.so.6.0.0
#
#
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ org.jetbrains.compose.experimental.uikit.enabled=true
android.defaults.buildfeatures.buildconfig=true
# Enable kotlin/native experimental memory model
kotlin.native.binary.memoryModel=experimental
compose.version=1.6.10-dev1551
compose.version=1.6.10-dev1561
kotlin.version=2.0.0-Beta5
multiplatform.version=2.0.0-Beta5
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionSha256Sum=9631d53cf3e74bfa726893aee1f8994fee4e060c401335946dba2156f440f24c
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
distributionSha256Sum=544c35d6bd849ae8a5ed0bcea39ba677dc40f49df7d1835561582da2009b961d
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
52 changes: 45 additions & 7 deletions src/main/kotlin/Main.kt
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,12 @@ import androidx.compose.ui.res.painterResource
import androidx.compose.ui.semantics.contentDescription
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.text.font.FontLoadingStrategy
import androidx.compose.ui.text.font.FontStyle
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.input.KeyboardCapitalization
import androidx.compose.ui.text.platform.Font
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.DpSize
Expand Down Expand Up @@ -182,8 +187,6 @@ import java.util.*
import java.util.concurrent.Executors
import java.util.prefs.Preferences
import javax.swing.JPanel
import javax.swing.UIManager

import com.vanniktech.emoji.EmojiManager
import com.vanniktech.emoji.ios.IosEmojiProvider
import com.vanniktech.emoji.search.SearchEmojiManager
Expand All @@ -196,6 +199,7 @@ import com.zoffcc.applications.trifa.MainActivity.Companion.DEBUG_COMPOSE_UI_UPD
import com.zoffcc.applications.trifa.MainActivity.Companion.PREF__do_not_sync_av
import com.zoffcc.applications.trifa.MainActivity.Companion.tox_group_peer_get_name
import com.zoffcc.applications.trifa.MainActivity.Companion.toxav_option_set
import com.zoffcc.applications.trifa.OperatingSystem
import org.briarproject.briar.desktop.ui.ExplainerInfoIsRelay
import org.briarproject.briar.desktop.ui.Tooltip

Expand Down Expand Up @@ -276,6 +280,8 @@ const val GENERIC_TOR_USERAGENT = "Mozilla/5.0 (Windows NT 6.1; rv:60.0) Gecko/2
var scaffoldState: ScaffoldState = ScaffoldState(drawerState = DrawerState(initialValue = DrawerValue.Closed), snackbarHostState = SnackbarHostState())
@OptIn(DelicateCoroutinesApi::class)
var ScaffoldCoroutineScope: CoroutineScope = GlobalScope
var NotoEmojiFont: FontFamily? = null
var DefaultFont: FontFamily? = null

@OptIn(DelicateCoroutinesApi::class, ExperimentalFoundationApi::class)
@Composable
Expand Down Expand Up @@ -312,7 +318,7 @@ fun App()

globalstore.loadUiScale()
var ui_scale by remember { mutableStateOf(globalstore.getUiScale()) }
MaterialTheme {
Theme {
scaffoldState = rememberScaffoldState()
ScaffoldCoroutineScope = rememberCoroutineScope()
Scaffold(modifier = Modifier.randomDebugBorder(), scaffoldState = scaffoldState) {
Expand Down Expand Up @@ -1521,7 +1527,7 @@ private fun ToxIDTextField()
TextField(enabled = true, readOnly = true, singleLine = true,
textStyle = TextStyle(fontSize = 13.sp),
modifier = Modifier.width(MYTOXID_WIDTH).height(MYTOXID_HEIGHT).padding(0.dp),
colors = TextFieldDefaults.textFieldColors(backgroundColor = Color.White),
colors = TextFieldDefaults.textFieldColors(backgroundColor = Color(ChatColorsConfig.LIGHT__TEXTFIELD_BGCOLOR)),
keyboardOptions = KeyboardOptions(
capitalization = KeyboardCapitalization.None,
autoCorrect = false,
Expand All @@ -1537,7 +1543,7 @@ private fun SaveDataPath()
TextField(enabled = savepathdata.savePathEnabled, singleLine = true,
textStyle = TextStyle(fontSize = 13.sp),
modifier = Modifier.width(SAVEDATA_PATH_WIDTH).height(SAVEDATA_PATH_HEIGHT).padding(0.dp),
colors = TextFieldDefaults.textFieldColors(backgroundColor = Color.White),
colors = TextFieldDefaults.textFieldColors(backgroundColor = Color(ChatColorsConfig.LIGHT__TEXTFIELD_BGCOLOR)),
keyboardOptions = KeyboardOptions(
capitalization = KeyboardCapitalization.None,
autoCorrect = false,
Expand Down Expand Up @@ -1720,7 +1726,7 @@ fun main() = application(exitProcessOnExit = true) {
}

// ------- set UI look and feel to "system" for java AWT ----------
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName())
// UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName())
// ------- set UI look and feel to "system" for java AWT ----------

init_system_tray(RESOURCESDIR.canonicalPath + File.separator + "icon-linux.png")
Expand Down Expand Up @@ -1884,6 +1890,38 @@ object AboutIcon : Painter() {
@Composable
private fun MainAppStart()
{
try
{
// HINT: for some reason the fonts do not load on macOS
if ((OperatingSystem.getCurrent() != OperatingSystem.MACOS) && (OperatingSystem.getCurrent() != OperatingSystem.MACARM))
{
NotoEmojiFont = FontFamily(
Font(resource = "fonts/NotoColorEmoji.ttf", FontWeight.Normal),
)
}
}
catch(_: Exception)
{
}

try
{
// HINT: for some reason the fonts do not load on macOS
if ((OperatingSystem.getCurrent() != OperatingSystem.MACOS) && (OperatingSystem.getCurrent() != OperatingSystem.MACARM))
{
DefaultFont = FontFamily(
// Font(resource = "fonts/Ubuntu-R.ttf", FontWeight.Normal, FontStyle.Normal),
// Font(resource = "fonts/Ubuntu-B.ttf", FontWeight.Bold, FontStyle.Normal),
Font(resource = "fonts/NotoSans-Regular.ttf", FontWeight.Normal, FontStyle.Normal),
Font(resource = "fonts/NotoSans-SemiBold.ttf", FontWeight.SemiBold, FontStyle.Normal),
Font(resource = "fonts/NotoSans-SemiBold.ttf", FontWeight.Bold, FontStyle.Normal),
)
}
}
catch(_: Exception)
{
}

var showIntroScreen by remember { mutableStateOf(true) }
var firstRun by remember { mutableStateOf(true) }
var inputTextToxSelfName by remember { mutableStateOf(RandomNameGenerator.getFullName(Random())) }
Expand Down Expand Up @@ -1950,7 +1988,7 @@ private fun MainAppStart()
readOnly = false,
singleLine = true,
textStyle = TextStyle(fontSize = 18.sp),
colors = TextFieldDefaults.textFieldColors(backgroundColor = Color.White),
colors = TextFieldDefaults.textFieldColors(backgroundColor = Color(ChatColorsConfig.LIGHT__TEXTFIELD_BGCOLOR)),
keyboardOptions = KeyboardOptions(capitalization = KeyboardCapitalization.None,autoCorrect = false),
value = inputTextToxSelfName,
placeholder = { Text("") },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ fun GroupSettingDetails(selectedGroupId: String?)
TextField(enabled = true, singleLine = true,
textStyle = TextStyle(fontSize = 16.sp),
modifier = Modifier.padding(0.dp).weight(1.0f),
colors = TextFieldDefaults.textFieldColors(backgroundColor = Color.White),
colors = TextFieldDefaults.textFieldColors(backgroundColor = Color(ChatColorsConfig.LIGHT__TEXTFIELD_BGCOLOR)),
keyboardOptions = KeyboardOptions(
capitalization = KeyboardCapitalization.None,
autoCorrect = false,
Expand Down
21 changes: 19 additions & 2 deletions src/main/kotlin/com/zoffcc/applications/trifa2/ChatApp.kt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ import androidx.compose.material.ProvideTextStyle
import androidx.compose.material.Scaffold
import androidx.compose.material.Surface
import androidx.compose.material.Text
import androidx.compose.material.TextFieldDefaults
import androidx.compose.material.TopAppBar
import androidx.compose.material.Typography
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.AttachFile
import androidx.compose.material.icons.filled.Call
Expand Down Expand Up @@ -461,10 +463,25 @@ fun GroupApp(focusRequester: FocusRequester, displayTextField: Boolean = true, s
@Composable
fun Theme(content: @Composable () -> Unit)
{
var Typography: Typography? = null
try
{
Typography = Typography(
defaultFontFamily = DefaultFont!!
)
}
catch(_: Exception)
{
Typography = MaterialTheme.typography
}

// colors = TextFieldDefaults.textFieldColors(backgroundColor = Color.White),
// TextFieldDefaults.textFieldColors(backgroundColor = Color(ChatColorsConfig.LIGHT__TEXTFIELD_BGCOLOR))
MaterialTheme(
typography = Typography!!,
colors = lightColors(
surface = Color(ChatColorsConfig.SURFACE),
background = Color(ChatColorsConfig.TOP_GRADIENT.last()),
surface = Color(ChatColorsConfig.LIGHT__FGCOLOR),
background = Color(ChatColorsConfig.LIGHT__BGCOLOR),
),
) {
ProvideTextStyle(LocalTextStyle.current.copy(letterSpacing = 0.sp)) {
Expand Down
Loading
Loading