Skip to content

Commit

Permalink
New release with bug fixes, improvements and translation updates
Browse files Browse the repository at this point in the history
  • Loading branch information
mmarif4u committed Oct 11, 2024
1 parent 4522262 commit c7bd4d1
Show file tree
Hide file tree
Showing 10 changed files with 153 additions and 34 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ android {
applicationId "com.swatian.nexnotes"
minSdk 27
targetSdk 34
versionCode 16
versionName "1.6"
versionCode 17
versionName "1.7"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,25 @@ public void onCreate(Bundle savedInstanceState) {
AppSettingsInit.updateSettingsValue(
getApplicationContext(), "false", AppSettingsInit.APP_BIOMETRIC_LIFE_CYCLE_KEY);

String[] locale =
AppSettingsInit.getSettingsValue(ctx, AppSettingsInit.APP_LOCALE_KEY).split("\\|");

if (locale[0].equals("0")) {
Utils.setAppLocale(
ctx.getResources().getConfiguration().getLocales().get(0).getLanguage());
} else {
Utils.setAppLocale(locale[1]);
}
applyLocale();
}

private void applyLocale() {

String savedLocale =
getSharedPreferences("nexnotes_preferences", MODE_PRIVATE)
.getString("app_locale", "en");
Utils.setLocale(this, savedLocale);
}

@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(Utils.setLocale(base, getCurrentLocaleFromPreferences(base)));
}

private String getCurrentLocaleFromPreferences(Context context) {
return context.getSharedPreferences("nexnotes_preferences", MODE_PRIVATE)
.getString("app_locale", "en");
}

public void onResume() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package com.swatian.nexnotes.fragments;

import static android.content.Context.MODE_PRIVATE;
import static androidx.biometric.BiometricManager.Authenticators.BIOMETRIC_STRONG;
import static androidx.biometric.BiometricManager.Authenticators.DEVICE_CREDENTIAL;

import android.app.KeyguardManager;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
Expand Down Expand Up @@ -110,12 +112,33 @@ public View onCreateView(
i + "|" + selectedLanguage,
AppSettingsInit.APP_LOCALE_KEY);

/*if (selectedLanguage.equalsIgnoreCase("sys")) {
selectedLanguage =
requireContext()
.getResources()
.getConfiguration()
.getLocales()
.get(0)
.getLanguage();
}*/

String[] multiCodeLang =
selectedLanguage.split("-");
if (selectedLanguage.contains("-")) {
selectedLanguage = multiCodeLang[0];
}

SharedPreferences prefs =
requireContext()
.getSharedPreferences(
"nexnotes_preferences",
MODE_PRIVATE);
prefs.edit()
.putString("app_locale", selectedLanguage)
.apply();

Utils.setLocale(requireContext(), selectedLanguage);
dialogInterface.dismiss();
Snackbar.info(
requireActivity(),
requireActivity()
.findViewById(R.id.nav_view),
getString(R.string.settings_saved));
requireActivity().recreate();
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
public class AppSettingsInit {

public static String APP_LOCALE_KEY = "app_locale";
public static String APP_LOCALE_KEY_DEFAULT = "0|sys";
public static String APP_LOCALE_KEY_DEFAULT = "1|en";
public static String APP_BIOMETRIC_KEY = "app_biometric";
public static String APP_BIOMETRIC_DEFAULT = "false";
public static String APP_BIOMETRIC_LIFE_CYCLE_KEY = "app_biometric_life_cycle";
Expand Down
19 changes: 10 additions & 9 deletions app/src/main/java/com/swatian/nexnotes/helpers/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.net.Uri;
import android.view.View;
import androidx.appcompat.app.AppCompatDelegate;
import androidx.core.content.pm.PackageInfoCompat;
import androidx.core.os.LocaleListCompat;
import com.swatian.nexnotes.R;
import java.util.ArrayList;
import java.util.List;
Expand All @@ -24,15 +24,16 @@
*/
public class Utils {

public static void setAppLocale(String locCode) {
public static Context setLocale(Context context, String languageCode) {

String[] multiCodeLang = locCode.split("-");
if (locCode.contains("-")) {
locCode = multiCodeLang[0];
}
Locale locale = new Locale(languageCode);
Locale.setDefault(locale);

Resources resources = context.getResources();
Configuration config = resources.getConfiguration();

AppCompatDelegate.setApplicationLocales(
LocaleListCompat.create(Locale.forLanguageTag(locCode)));
config.setLocale(locale);
return context.createConfigurationContext(config);
}

public static int getAppBuildNo(Context context) {
Expand Down
76 changes: 76 additions & 0 deletions app/src/main/res/values-be-rBY/strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools">
<string name="settings_biometric_header">Біяметрычны замок</string>
<string name="created_with">Стварылі %s</string>
<string name="updated_with">Абноўлены %s</string>
<string name="nothing_found">Нічога не знойдзена</string>
<string name="delete_note_dialog_message">Вы сапраўды хочаце выдаліць гэтую нататку?</string>
<plurals name="note_delete_message">
<item quantity="one" tools:ignore="ImpliedQuantity">Нататка паспяхова выдалена</item>
<item quantity="few">Нататкі паспяхова выдалены</item>
<item quantity="many">Нататкі паспяхова выдалены</item>
<item quantity="other">Нататкі паспяхова выдалены</item>
</plurals>
<string name="all_good">Вы ўсё зрабілі</string>
<string name="delete_notes">Выдаліць усе нататкі</string>
<string name="note_content_hint">Пачніце рабіць нататкі тут…</string>
<string name="delete_all_notes_dialog_message">Гэта выдаліць усе вашы нататкі. Гэта дзеянне нельга адмяніць.</string>
<string name="delete_topic_dialog_message">Вы збіраецеся выдаліць тэму. Націсніце \"Выдаліць\", каб працягнуць.</string>
<string name="delete_topic_message">Тэма паспяхова выдалена</string>
<string name="topic_created">Тэма створана</string>
<string name="biometric_auth_title">Біяметрычная аўтэнтыфікацыя</string>
<string name="biometric_auth_sub_title">Разблакіраваць з дапамогай біяметрычных уліковых дадзеных</string>
<string name="settings_saved">Налады захаваны</string>
<string name="enroll_biometric">Зарэгістраваць біяметрыю з налад тэлефона</string>
<string name="biometric_not_supported">На гэтай прыладзе няма біяметрычных функцый</string>
<string name="biometric_not_available">Біяметрычныя функцыі зараз недаступныя</string>
<string name="settings_language_selector_dialog_title">Выберыце мову</string>
<string name="source_code">Зыходны код</string>
<!-- errors -->
<string name="generic_error">Нешта пайшло не так</string>
<string name="browser_open_failed">Не знойдзена праграма для адкрыцця гэтай спасылкі</string>
<string name="topic_exists">Тэма ўжо існуе</string>
<string name="topic_min_characters">Тэма павінна быць не менш за 2 сімвалы</string>
<!-- errors -->
<!-- generic terms -->
<string name="notes">Нататкі</string>
<string name="topics">Тэмы</string>
<string name="topic">Тэма</string>
<string name="settings">Налады</string>
<string name="notifications">Апавяшчэнні</string>
<string name="app">Прыкладанне</string>
<string name="generic_img_copy">малюнак</string>
<string name="cancel">Адмяніць</string>
<string name="update">Абнаўленне</string>
<string name="add">Дадаць</string>
<string name="new_text">Новая</string>
<string name="error">памылка</string>
<string name="ok">Добра</string>
<string name="proceed">Працягвайце</string>
<string name="theme">Тэма</string>
<string name="language">Мова</string>
<string name="active">Актыўны</string>
<string name="delete">Выдаліць</string>
<string name="accounts">Колькасць</string>
<string name="edit">Правіць</string>
<string name="remove">Выдаліць</string>
<string name="name">Імя</string>
<string name="about">Аб</string>
<string name="website">Сайт</string>
<string name="system">Сістэма</string>
<string name="search">Пошук</string>
<string name="display">Адлюстраванне</string>
<string name="appearance">Знешні выгляд</string>
<string name="translation">Пераклад</string>
<string name="security">Бяспека</string>
<string name="version">Версія</string>
<string name="links">Спасылкі</string>
<string name="close">Зачыніць</string>
<string name="description">Апісанне</string>
<string name="create">Стварыць</string>
<string name="database">База дадзеных</string>
<string name="title">Назва (абавязкова)</string>
<string name="general">Галоўны</string>
<string name="save">Захаваць</string>
<!-- generic terms -->
</resources>
2 changes: 2 additions & 0 deletions app/src/main/res/values-ru-rRU/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
<string name="system">Системный</string>
<string name="search">Поиск</string>
<string name="display">Отобразить</string>
<string name="appearance">Внешний вид</string>
<string name="translation">Перевод</string>
<string name="security">Охрана</string>
<string name="version">Версия</string>
Expand All @@ -70,5 +71,6 @@
<string name="database">База данных</string>
<string name="title">Заголовок (обязательно)</string>
<string name="general">В целом</string>
<string name="save">Сохранить</string>
<!-- generic terms -->
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values/settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@
<item>ru</item>
<item>zh</item>
<item>fr</item>
<item>be</item>
</string-array>
</resources>
16 changes: 8 additions & 8 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
[versions]
agp = "8.4.2"
junit = "4.13.2"
junitVersion = "1.2.0"
espressoCore = "3.6.0"
junitVersion = "1.2.1"
espressoCore = "3.6.1"
appcompat = "1.7.0"
material = "1.12.0"
constraintlayout = "2.1.4"
lifecycleLivedataKtx = "2.8.2"
lifecycleViewmodelKtx = "2.8.2"
navigationFragment = "2.7.7"
navigationUi = "2.7.7"
lifecycleLivedataKtx = "2.8.6"
lifecycleViewmodelKtx = "2.8.6"
navigationFragment = "2.8.2"
navigationUi = "2.8.2"
notiesMarkwon = "4.6.2"
prettytime = "5.0.7.Final"
roomDB = "2.6.1"
biometric = "1.1.0"
annotation = "1.8.0"
annotation = "1.8.2"
swiperefreshlayout = "1.1.0"
desugar_jdk_libs = "2.0.4"
desugar_jdk_libs = "2.1.2"
emoji-java = "v5.1.2"
browser = "1.8.0"

Expand Down
6 changes: 6 additions & 0 deletions metadata/en-US/changelogs/17.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
1.7

- Add new languages and translation updates
- Fix switching languages in Android 12 and below

https://github.com/Swatian/nexnotes/releases

0 comments on commit c7bd4d1

Please sign in to comment.