diff --git a/app/build.gradle b/app/build.gradle index bf3d4b0..b183b04 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -6,8 +6,8 @@ android { applicationId "rocks.poopjournal.morse" minSdkVersion 19 targetSdkVersion 33 - versionCode 8 - versionName "1.7" + versionCode 9 + versionName "1.8" } buildTypes { @@ -26,10 +26,14 @@ android { packagingOptions { exclude 'META-INF/*' } + + lintOptions { + baseline file("lint-baseline.xml") + } } dependencies { - implementation 'androidx.appcompat:appcompat:1.5.0' + implementation 'androidx.appcompat:appcompat:1.5.1' implementation 'androidx.constraintlayout:constraintlayout:2.1.4' implementation 'com.google.android.material:material:1.6.1' } diff --git a/app/lint-baseline.xml b/app/lint-baseline.xml new file mode 100644 index 0000000..55762b8 --- /dev/null +++ b/app/lint-baseline.xml @@ -0,0 +1,390 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/java/rocks/poopjournal/morse/MainActivity.java b/app/src/main/java/rocks/poopjournal/morse/MainActivity.java index 2f6f60e..6c15fe0 100644 --- a/app/src/main/java/rocks/poopjournal/morse/MainActivity.java +++ b/app/src/main/java/rocks/poopjournal/morse/MainActivity.java @@ -1,5 +1,9 @@ package rocks.poopjournal.morse; +import static android.hardware.Camera.Parameters.FLASH_MODE_AUTO; +import static android.hardware.Camera.Parameters.FLASH_MODE_ON; +import static android.hardware.Camera.Parameters.FLASH_MODE_TORCH; + import android.Manifest; import android.annotation.SuppressLint; import android.app.Activity; @@ -42,18 +46,17 @@ import android.widget.TextView; import android.widget.Toast; +import androidx.annotation.Nullable; import androidx.appcompat.app.AppCompatActivity; import androidx.core.content.ContextCompat; +import androidx.core.graphics.drawable.DrawableCompat; import java.util.ArrayList; import java.util.HashMap; import java.util.List; +import java.util.Locale; import java.util.concurrent.atomic.AtomicBoolean; -import static android.hardware.Camera.Parameters.FLASH_MODE_AUTO; -import static android.hardware.Camera.Parameters.FLASH_MODE_ON; -import static android.hardware.Camera.Parameters.FLASH_MODE_TORCH; - public class MainActivity extends AppCompatActivity implements Camera.AutoFocusCallback { public static Camera camera = null;// has to be static, otherwise onDestroy() destroys it @@ -77,12 +80,16 @@ public class MainActivity extends AppCompatActivity implements Camera.AutoFocusC RelativeLayout space; RelativeLayout makeInputVisible; RelativeLayout backspace; - RelativeLayout containerTools; - RelativeLayout telegraphContainer; - RelativeLayout telegraphAudio; - RelativeLayout telegraphFlash; - RelativeLayout telegraphKey; - ImageView telegraphKeyboard,telegraphFlashIV, telegraphAudioIV; + + // These views are only supported in Portrait mode for now, the corresponding variables should be nullable. + @Nullable RelativeLayout containerTools; + @Nullable RelativeLayout telegraphContainer; + @Nullable RelativeLayout telegraphAudio; + @Nullable RelativeLayout telegraphFlash; + @Nullable RelativeLayout telegraphKey; + @Nullable ImageView telegraphKeyboard; + @Nullable ImageView telegraphFlashIV; + @Nullable ImageView telegraphAudioIV; boolean visibilityCheck = false; ArrayList popularMorse = new ArrayList<>(); HashMap popularMorseConversion = new HashMap<>(); @@ -174,8 +181,7 @@ public static void hideKeyboard(Activity activity) { static String morseEncode(String x) { // refer to the Morse table // image attached in the article - x = x.toLowerCase(); - switch (x) { + switch (x.toLowerCase(Locale.getDefault())) { case "a": return ".-"; case "b": @@ -318,8 +324,11 @@ static String morseEncode(String x) { return "..--"; case "я": return ".-.-"; + case "ñ": + return "--.--"; + default: + return ""; } - return ""; } static String morseDecode(String morse) { @@ -400,7 +409,8 @@ static String morseDecode(String morse) { return "8"; case "----.": return "9"; - + case "--.--": + return "ñ"; } return ""; @@ -455,68 +465,21 @@ protected void onCreate(Bundle savedInstanceState) { popularMorseConversionText.put(".--.....--.....--....--.----...--.-.---..---.....-", "What hath God wrought"); popularMorseConversionText.put(".-..--...", "rats"); - telegraphKeyboard.setOnClickListener(view -> hideTelegraphKey()); + if (telegraphKeyboard != null) { + telegraphKeyboard.setOnClickListener(view -> hideTelegraphKey()); + } fullscreen.setOnClickListener(view -> showTelegraphKey()); - telegraphFlash.setOnClickListener(v -> setFlashSelectedForTelegraph()); - telegraphAudio.setOnClickListener(v -> setAudioSelectedForTelegraph()); + if (telegraphFlash != null) { + telegraphFlash.setOnClickListener(v -> setFlashSelectedForTelegraph()); + } + if (telegraphAudio != null) { + telegraphAudio.setOnClickListener(v -> setAudioSelectedForTelegraph()); + } telegraphPlayer= MediaPlayer.create(MainActivity.this,R.raw.beepflac); - telegraphKey.setOnTouchListener((v, event) -> { - if(event.getAction() == MotionEvent.ACTION_DOWN){ - if (telegraphSelected==1){ - time = System.currentTimeMillis(); - telegraphPlayer.start(); - } - else { time = System.currentTimeMillis(); - camera = Camera.open(); - turnOn(); - } - - - return true; - } - if(event.getAction() == MotionEvent.ACTION_UP){ - if (telegraphSelected ==1){ - if (System.currentTimeMillis()-time>=200){ - telegraphPlayer.pause(); - telegraphPlayer.seekTo(0); - } - else { - final Handler handler = new Handler(Looper.getMainLooper()); - handler.postDelayed(new Runnable() { - @Override - public void run() { - telegraphPlayer.pause(); - telegraphPlayer.seekTo(0); - } - }, 100); - } - } - else { - - if (System.currentTimeMillis()-time>=200){ - turnOff(); - camera.release(); - camera = null; - } - else { - final Handler handler = new Handler(Looper.getMainLooper()); - handler.postDelayed(new Runnable() { - @Override - public void run() { - turnOff(); - camera.release(); - camera = null; - } - }, 100); - } - } - - - return true; - } - return false; - }); + if (telegraphKey != null) { + telegraphKey.setOnTouchListener((v, event) -> setKeySelectedForTelegraph(event)); + } flash.setOnClickListener(view -> { @@ -1196,6 +1159,10 @@ protected void onProgressUpdate(String... text) { private void showTelegraphKey(){ + if (containerTools == null || telegraphContainer == null) { + return; + } + bottomNavigation.setVisibility(View.GONE); containerTools.setVisibility(View.GONE); telegraphContainer.setVisibility(View.VISIBLE); @@ -1206,33 +1173,96 @@ private void showTelegraphKey(){ } private void hideTelegraphKey(){ + if (containerTools == null || telegraphContainer == null) { + return; + } + bottomNavigation.setVisibility(View.VISIBLE); containerTools.setVisibility(View.VISIBLE); telegraphContainer.setVisibility(View.GONE); - } private void setAudioSelectedForTelegraph(){ - Drawable d = (GradientDrawable)telegraphAudio.getBackground(); - d.setTint(Color.parseColor("#227DD3D8")); + Drawable d; + if (telegraphAudio != null) { + d = (GradientDrawable) telegraphAudio.getBackground(); + DrawableCompat.setTint(d, Color.parseColor("#227DD3D8")); + } - Drawable d2 = (GradientDrawable)telegraphFlash.getBackground(); - d2.setTint(Color.parseColor("#373945")); + Drawable d2; + if (telegraphFlash != null) { + d2 = (GradientDrawable) telegraphFlash.getBackground(); + DrawableCompat.setTint(d2, Color.parseColor("#373945")); + } - telegraphFlashIV.setColorFilter(Color.parseColor("#9C9CA4"), PorterDuff.Mode.SRC_IN); - telegraphAudioIV.setColorFilter(Color.parseColor("#7DD3D8"), android.graphics.PorterDuff.Mode.SRC_IN); + if (telegraphFlashIV != null && telegraphAudioIV != null) { + telegraphFlashIV.setColorFilter(Color.parseColor("#9C9CA4"), PorterDuff.Mode.SRC_IN); + telegraphAudioIV.setColorFilter(Color.parseColor("#7DD3D8"), android.graphics.PorterDuff.Mode.SRC_IN); + } telegraphSelected =1; } private void setFlashSelectedForTelegraph(){ Log.d("flashselected","yes"); - Drawable d = (GradientDrawable)telegraphFlash.getBackground(); - d.setTint(Color.parseColor("#227DD3D8")); + Drawable d; + if (telegraphFlash != null) { + d = (GradientDrawable) telegraphFlash.getBackground(); + DrawableCompat.setTint(d, Color.parseColor("#227DD3D8")); + } - Drawable d2 = (GradientDrawable)telegraphAudio.getBackground(); - d2.setTint(Color.parseColor("#373945")); + Drawable d2; + if (telegraphAudio != null) { + d2 = (GradientDrawable) telegraphAudio.getBackground(); + DrawableCompat.setTint(d2, Color.parseColor("#373945")); + } - telegraphAudioIV.setColorFilter(Color.parseColor("#9C9CA4"), android.graphics.PorterDuff.Mode.SRC_IN); - telegraphFlashIV.setColorFilter(Color.parseColor("#7DD3D8"), android.graphics.PorterDuff.Mode.SRC_IN); + if (telegraphFlashIV != null && telegraphAudioIV != null) { + telegraphAudioIV.setColorFilter(Color.parseColor("#9C9CA4"), PorterDuff.Mode.SRC_IN); + telegraphFlashIV.setColorFilter(Color.parseColor("#7DD3D8"), android.graphics.PorterDuff.Mode.SRC_IN); + } telegraphSelected =2; } + + private boolean setKeySelectedForTelegraph(MotionEvent event) { + if (event.getAction() == MotionEvent.ACTION_DOWN) { + if (telegraphSelected == 1) { + time = System.currentTimeMillis(); + telegraphPlayer.start(); + } else { + time = System.currentTimeMillis(); + camera = Camera.open(); + turnOn(); + } + return true; + } + if (event.getAction() == MotionEvent.ACTION_UP) { + if (telegraphSelected == 1) { + if (System.currentTimeMillis() - time >= 200) { + telegraphPlayer.pause(); + telegraphPlayer.seekTo(0); + } else { + final Handler handler = new Handler(Looper.getMainLooper()); + handler.postDelayed(() -> { + telegraphPlayer.pause(); + telegraphPlayer.seekTo(0); + }, 100); + } + } else { + + if (System.currentTimeMillis() - time >= 200) { + turnOff(); + camera.release(); + camera = null; + } else { + final Handler handler = new Handler(Looper.getMainLooper()); + handler.postDelayed(() -> { + turnOff(); + camera.release(); + camera = null; + }, 100); + } + } + return true; + } + return false; + } } diff --git a/app/src/main/res/drawable/ic_launcher_monochrome.xml b/app/src/main/res/drawable/ic_launcher_monochrome.xml new file mode 100644 index 0000000..8522bcc --- /dev/null +++ b/app/src/main/res/drawable/ic_launcher_monochrome.xml @@ -0,0 +1,13 @@ + + + + diff --git a/app/src/main/res/layout-land/activity_main.xml b/app/src/main/res/layout-land/activity_main.xml index 2c8887b..76fe45f 100644 --- a/app/src/main/res/layout-land/activity_main.xml +++ b/app/src/main/res/layout-land/activity_main.xml @@ -1,5 +1,6 @@ + app:tint="@color/colorMorse" /> + app:tint="@color/colorMorse" /> + app:tint="@color/colorMorse" /> + app:tint="#FFFFFF" /> + diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml index 3ba4e35..238b82d 100644 --- a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml +++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml @@ -2,4 +2,5 @@ + diff --git a/app/src/main/res/values-ca/strings.xml b/app/src/main/res/values-ca/strings.xml new file mode 100644 index 0000000..7a1453e --- /dev/null +++ b/app/src/main/res/values-ca/strings.xml @@ -0,0 +1,4 @@ + + + Morse + \ No newline at end of file diff --git a/build.gradle b/build.gradle index d54ad67..c6a62f8 100644 --- a/build.gradle +++ b/build.gradle @@ -6,7 +6,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:7.2.2' + classpath 'com.android.tools.build:gradle:7.3.0' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files diff --git a/fastlane/metadata/android/ca/changelogs/1.txt b/fastlane/metadata/android/ca/changelogs/1.txt index cc7498e..f7ea9fe 100644 --- a/fastlane/metadata/android/ca/changelogs/1.txt +++ b/fastlane/metadata/android/ca/changelogs/1.txt @@ -1 +1 @@ -Initial Release +Versió inicial diff --git a/fastlane/metadata/android/ca/changelogs/2.txt b/fastlane/metadata/android/ca/changelogs/2.txt index d7aec9c..12eb610 100644 --- a/fastlane/metadata/android/ca/changelogs/2.txt +++ b/fastlane/metadata/android/ca/changelogs/2.txt @@ -1 +1 @@ -Fix Force Crash After Audio Playback 😎 +Arreglo del bloqueig de forçat després de la reproducció d'àudio 😎 diff --git a/fastlane/metadata/android/ca/changelogs/3.txt b/fastlane/metadata/android/ca/changelogs/3.txt index 4a0bca6..79a7433 100644 --- a/fastlane/metadata/android/ca/changelogs/3.txt +++ b/fastlane/metadata/android/ca/changelogs/3.txt @@ -1,2 +1,2 @@ -The app now offers intelligent suggestions -It is now possible to use the flashlight for Morse signals +L'aplicació ara ofereix suggeriments intel·ligents +Ara és possible utilitzar la llanterna per als senyals Morse diff --git a/fastlane/metadata/android/ca/changelogs/4.txt b/fastlane/metadata/android/ca/changelogs/4.txt index a769b01..5ff95da 100644 --- a/fastlane/metadata/android/ca/changelogs/4.txt +++ b/fastlane/metadata/android/ca/changelogs/4.txt @@ -1,5 +1,5 @@ -Add phrasebook -Migrate to AndroidX -Update SDK -Improve accessability -Update dependencies +Afegir llibre de frases +Migrar a AndroidX +Sdk d'actualitzacions +Millorar l'accessibilitat +Actualitzar dependències diff --git a/fastlane/metadata/android/ca/changelogs/6.txt b/fastlane/metadata/android/ca/changelogs/6.txt index 1f55d65..f137b18 100644 --- a/fastlane/metadata/android/ca/changelogs/6.txt +++ b/fastlane/metadata/android/ca/changelogs/6.txt @@ -1,2 +1,2 @@ -Support digits -Under the hood improvements +Suport per a números +Petites millores internes diff --git a/fastlane/metadata/android/ca/changelogs/7.txt b/fastlane/metadata/android/ca/changelogs/7.txt index 1fdb0d4..7ee79d6 100644 --- a/fastlane/metadata/android/ca/changelogs/7.txt +++ b/fastlane/metadata/android/ca/changelogs/7.txt @@ -1,3 +1,4 @@ -Add option to modify the audio output speed (Standard, Farnsworth or custom) -Fix Bugs & Crashes -Target Android 11 +- Nou mode d'entrada: Clau telegràfica +- Petites millores internes +- Correcció d'errors i problemes +- Suport Android 11 diff --git a/fastlane/metadata/android/ca/changelogs/8.txt b/fastlane/metadata/android/ca/changelogs/8.txt new file mode 100644 index 0000000..18e9a61 --- /dev/null +++ b/fastlane/metadata/android/ca/changelogs/8.txt @@ -0,0 +1,2 @@ +- Petites millores i actualitzacions +- Actualitzacions de traducció diff --git a/fastlane/metadata/android/ca/full_description.txt b/fastlane/metadata/android/ca/full_description.txt index 6fa8867..95d588d 100644 --- a/fastlane/metadata/android/ca/full_description.txt +++ b/fastlane/metadata/android/ca/full_description.txt @@ -1,41 +1,41 @@ -Decipher Morse code to text or text to Morse code +Desxifrar codi Morse a text o text a codi Morse -Turn any text into Morse code, or translate Morse code to text and hear the results. +Converteix qualsevol text en codi Morse o tradueix el codi Morse a text i escolta els resultats. -• Clean, modern app design and interface. -• Made to be simple to use for everyone. -• Realtime translation: type in the word or code and have it translated immediately. -• Decode from Morse to text, or text to Morse. -• Press the speaker button to hear the code. -• Copy the text by pressing the "Copy" button. -• Type in dot and dash using our built-in Morse keyboard. -• Libre software (https://github.com/Crazy-Marvin/Morse) -+ More features planned. +• Disseny i interfície d'aplicacions nets i moderns. +• Dissenyat per ser senzill d'utilitzar per a tothom. +• Traducció en temps real: escriviu la paraula o el codi i feu-lo traduir immediatament. +• Descodificar de Morse a text, o text a Morse. +• Premeu el botó de l'altaveu per escoltar el codi. +• Copieu el text prement el botó “Copiar”. +• Escriu punt i guió amb el nostre teclat Morse integrat. +• Programari lliure (https://github.com/Crazy-Marvin/Morse) ++ Més funcions previstes. -Don’t let the special characters or dots and dashes befuddle you. +No deixeu que els caràcters especials o els punts i els guions us confonguin. -Morse code is a system to encode letters and numbers to dash and dot signs. -The duration of the dash is three times the duration of a dot. -Each dot or dash is followed by period of signal absence, called a space, equal to the dot duration. +El codi Morse és un sistema per codificar lletres i números a guionets i signes de punts. +La durada del guió és tres vegades la durada d'un punt. +Cada punt o guió va seguit d'un període d'absència de senyal, anomenat espai, igual a la durada del punt. -Morse code was first used for communicating via telegraph. -The most well-known Morse code is SOS, which is used to signal an emergency. -Aside from typing dots and dashed, you can also signal Morse code by turning light on and off, sounding a horn or tapping, etc. -All means of transmitting Mores code require the recipient understands it. -If not, our cipher tool can be used to find out the password, secret number, or any info you want to relay. -Since people rarely communicate via telegraph, or learn it in the military, very few people have Morse codes memorized. -Instead, it has become a way to encode something for special purposes. -It’s a useful language to know even if you just want to learn cryptography or solve cryptograms for fun. +El codi Morse es va utilitzar per primera vegada per comunicar-se per telègraf. +El codi Morse més conegut és SOS, que s'utilitza per senyalitzar una emergència. +A part d'escriure punts i guionets, també podeu senyalitzar el codi Morse encenent i apagant la llum, fent sonar una botzina o tocant, etc. +Tots els mitjans per transmetre el codi Mores requereixen que el destinatari l'entengui. +Si no, la nostra eina de xifratge es pot utilitzar per esbrinar la contrasenya, el número secret o qualsevol informació que vulgueu transmetre. +Atès que la gent poques vegades es comunica per telègraf, o l'aprèn a l'exèrcit, molt poques persones tenen codis Morse memoritzats. +En canvi, s'ha convertit en una manera de codificar alguna cosa amb finalitats especials. +És un llenguatge útil per saber fins i tot si només voleu aprendre criptografia o resoldre criptogrames per diversió. -1. Tell others when you are in a dangerous situation (SOS). -2. Hide your secret number or password via dots and dashes. -3. Cipher or decipher hidden clues in games. -4. Learn cryptography or cryptogram through learning Morse codes. -5. Become a codebreaker by breaking secret codes in real time translation. -6. Create a secret number. -+ Many more +1. Digues als altres quan estàs en una situació perillosa (SOS). +2. Amaga el teu número secret o contrasenya mitjançant punts i guions. +3. Xifrar o desxifrar pistes amagades en jocs. +4. Aprèn criptografia o criptograma mitjançant l'aprenentatge de codis Morse. +5. Converteix-te en un trencador de codis trencant codis secrets en traducció en temps real. +6. Creeu un número secret. ++ Molts més --- -It really helps to leave a review or to star the project in the source code repsitory, and it means the world to us. -If you have problems using the app, please write an e-mail or open an issue on GitHub. -Responses are most often immediate, and bugs are fixed as soon as possible. +Realment ajuda deixar una ressenya o destacar el projecte al repositori de codi font, i significa el món per a nosaltres. +Si teniu problemes amb l'aplicació, escriviu un correu electrònic o obriu un problema a GitHub. +Les respostes solen ser immediates i els errors es solucionen tan aviat com sigui possible. diff --git a/fastlane/metadata/android/ca/short_description.txt b/fastlane/metadata/android/ca/short_description.txt index e1547d6..da68a6d 100644 --- a/fastlane/metadata/android/ca/short_description.txt +++ b/fastlane/metadata/android/ca/short_description.txt @@ -1 +1 @@ -Translate text to Morse code or vice versa in real time +Traduir text a codi Morse o viceversa en temps real diff --git a/fastlane/metadata/android/en-US/changelogs/8.txt b/fastlane/metadata/android/en-US/changelogs/8.txt index 46eaa2b..23e1538 100644 --- a/fastlane/metadata/android/en-US/changelogs/8.txt +++ b/fastlane/metadata/android/en-US/changelogs/8.txt @@ -1,2 +1,2 @@ -- Add option to modify the audio output speed (Standard, Farnsworth or custom) -- Under the hood improvements +- Under the hood improvements and updates +- Translation updates diff --git a/fastlane/metadata/android/en-US/changelogs/9.txt b/fastlane/metadata/android/en-US/changelogs/9.txt new file mode 100644 index 0000000..c05adcf --- /dev/null +++ b/fastlane/metadata/android/en-US/changelogs/9.txt @@ -0,0 +1,5 @@ +- Fix bug/crash in when switching to landscape mode 🐛 (#126) +- Support Ñ ➕ (#124) +- Add support for Themed Icons on Android 13+ 🎨 (#117) +- Dependency updates ⚙️ +- Translation updates 🗺️ diff --git a/fastlane/metadata/android/id/changelogs/8.txt b/fastlane/metadata/android/id/changelogs/8.txt index 26d1ea8..fdf9503 100644 --- a/fastlane/metadata/android/id/changelogs/8.txt +++ b/fastlane/metadata/android/id/changelogs/8.txt @@ -1,2 +1,2 @@ -- Menambahkan opsi untuk mengubah kecepatan output audio (Standar, Farnsworth, atau kustom) -- Memperbaiki beberapa masalah +- Perbaikan dan pembaruan +- Pembaruan terjemahan