diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 0000000..b1b9eb9
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,9 @@
+# editorconfig.org
+root = true
+
+[*]
+charset = utf-8
+end_of_line = lf
+indent_style = space
+insert_final_newline = true
+trim_trailing_whitespace = true
diff --git a/.gitignore b/.gitignore
index 31ba903..403d695 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,16 +1,7 @@
-*.iml
-.gradle
-/local.properties
-/.idea/caches
-/.idea/libraries
-/.idea/modules.xml
-/.idea/workspace.xml
-/.idea/navEditor.xml
-/.idea/assetWizardSettings.xml
.DS_Store
-/build
-/captures
-.externalNativeBuild
+app/debug/
+app/release/
+
=======
# Built application files
@@ -51,13 +42,7 @@ captures/
# IntelliJ
*.iml
-.idea/workspace.xml
-.idea/tasks.xml
-.idea/gradle.xml
-.idea/assetWizardSettings.xml
-.idea/dictionaries
-.idea/libraries
-.idea/caches
+.idea/
# Keystore files
# Uncomment the following line if you do not want to check your keystore files in.
diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml
deleted file mode 100644
index 681f41a..0000000
--- a/.idea/codeStyles/Project.xml
+++ /dev/null
@@ -1,116 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
- xmlns:android
-
- ^$
-
-
-
-
-
-
-
-
- xmlns:.*
-
- ^$
-
-
- BY_NAME
-
-
-
-
-
-
- .*:id
-
- http://schemas.android.com/apk/res/android
-
-
-
-
-
-
-
-
- .*:name
-
- http://schemas.android.com/apk/res/android
-
-
-
-
-
-
-
-
- name
-
- ^$
-
-
-
-
-
-
-
-
- style
-
- ^$
-
-
-
-
-
-
-
-
- .*
-
- ^$
-
-
- BY_NAME
-
-
-
-
-
-
- .*
-
- http://schemas.android.com/apk/res/android
-
-
- ANDROID_ATTRIBUTE_ORDER
-
-
-
-
-
-
- .*
-
- .*
-
-
- BY_NAME
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/encodings.xml b/.idea/encodings.xml
deleted file mode 100644
index 15a15b2..0000000
--- a/.idea/encodings.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/.idea/gradle.xml b/.idea/gradle.xml
index 2996d53..674414f 100644
--- a/.idea/gradle.xml
+++ b/.idea/gradle.xml
@@ -1,13 +1,19 @@
+
diff --git a/.idea/misc.xml b/.idea/misc.xml
deleted file mode 100644
index 37a7509..0000000
--- a/.idea/misc.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml
deleted file mode 100644
index 7f68460..0000000
--- a/.idea/runConfigurations.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
deleted file mode 100644
index 35eb1dd..0000000
--- a/.idea/vcs.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/README.md b/README.md
index 464f487..d8630b5 100644
--- a/README.md
+++ b/README.md
@@ -9,7 +9,7 @@
[![codecov](https://codecov.io/gh/Crazy-Marvin/Morse/branch/master/graph/badge.svg)](https://codecov.io/gh/Crazy-Marvin/Morse)
[![Crowdin](https://d322cqt584bo4o.cloudfront.net/morse/localized.svg)](https://crowdin.com/project/morse)
[![Known Vulnerabilities](https://snyk.io/test/github/Crazy-Marvin/Morse/badge.svg?targetFile=app%2Fbuild.gradle)](https://snyk.io/test/github/Crazy-Marvin/Morse?targetFile=app%2Fbuild.gradle)
-[![API](https://img.shields.io/badge/API-19%2B-brightgreen.svg?style=flat-square)](https://android-arsenal.com/api?level=19)
+[![API](https://img.shields.io/badge/API-19%2B-brightgreen.svg?style=flat)](https://android-arsenal.com/api?level=19)
![F-Droid](https://img.shields.io/f-droid/v/rocks.poopjournal.morse.svg)
[![Google Play](https://badgen.net/badge/icon/googleplay?icon=googleplay&label)](https://play.google.com/store/apps/details?id=rocks.poopjournal.morse)
diff --git a/app/.gitignore b/app/.gitignore
deleted file mode 100644
index 796b96d..0000000
--- a/app/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/build
diff --git a/app/build.gradle b/app/build.gradle
index 71bb9ff..01e741a 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -6,27 +6,30 @@ android {
applicationId "rocks.poopjournal.morse"
minSdkVersion 19
targetSdkVersion 29
- versionCode 4
- versionName "1.4"
- testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
+ versionCode 5
+ versionName "1.5"
}
+
buildTypes {
release {
minifyEnabled false
- proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
+
+ compileOptions {
+ encoding = 'UTF-8'
+ sourceCompatibility JavaVersion.VERSION_1_8
+ targetCompatibility JavaVersion.VERSION_1_8
+ }
+
+ packagingOptions {
+ exclude 'META-INF/*'
+ }
}
dependencies {
- implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
- testImplementation 'junit:junit:4.12'
- androidTestImplementation 'androidx.test:runner:1.2.0'
- androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
-
-
- implementation 'com.google.android.material:material:1.0.0'
- implementation 'androidx.legacy:legacy-support-v4:1.0.0'
+ implementation 'com.google.android.material:material:1.1.0'
}
diff --git a/app/debug/app-debug.apk b/app/debug/app-debug.apk
index cc312da..1eeb885 100644
Binary files a/app/debug/app-debug.apk and b/app/debug/app-debug.apk differ
diff --git a/app/debug/output.json b/app/debug/output.json
index 5d5e0a3..7bb067e 100644
--- a/app/debug/output.json
+++ b/app/debug/output.json
@@ -1 +1 @@
-[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":2,"versionName":"1.1","enabled":true,"outputFile":"app-debug.apk","fullName":"debug","baseName":"debug"},"path":"app-debug.apk","properties":{}}]
\ No newline at end of file
+[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":3,"versionName":"1.2","enabled":true,"outputFile":"app-debug.apk","fullName":"debug","baseName":"debug"},"path":"app-debug.apk","properties":{}}]
\ No newline at end of file
diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro
deleted file mode 100644
index f1b4245..0000000
--- a/app/proguard-rules.pro
+++ /dev/null
@@ -1,21 +0,0 @@
-# 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
diff --git a/app/src/androidTest/java/rocks/poopjournal/morse/ExampleInstrumentedTest.java b/app/src/androidTest/java/rocks/poopjournal/morse/ExampleInstrumentedTest.java
deleted file mode 100644
index cd454a4..0000000
--- a/app/src/androidTest/java/rocks/poopjournal/morse/ExampleInstrumentedTest.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package rocks.poopjournal.morse;
-
-import android.content.Context;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import static org.junit.Assert.*;
-
-/**
- * Instrumented test, which will execute on an Android device.
- *
- * @see Testing documentation
- */
-@RunWith(AndroidJUnit4.class)
-public class ExampleInstrumentedTest {
- @Test
- public void useAppContext() {
- // Context of the app under test.
- Context appContext = InstrumentationRegistry.getTargetContext();
-
- assertEquals("rocks.poopjournal.morse", appContext.getPackageName());
- }
-}
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 4523616..f502fa9 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -1,7 +1,10 @@
+
+
@@ -12,9 +15,11 @@
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
- android:theme="@style/AppTheme">
+ android:theme="@style/AppTheme"
+ tools:ignore="GoogleAppIndexingWarning">
+
diff --git a/app/src/main/java/rocks/poopjournal/morse/DBHelper.java b/app/src/main/java/rocks/poopjournal/morse/DBHelper.java
index bbb224f..9dcf554 100644
--- a/app/src/main/java/rocks/poopjournal/morse/DBHelper.java
+++ b/app/src/main/java/rocks/poopjournal/morse/DBHelper.java
@@ -8,9 +8,7 @@
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;
-
import java.util.ArrayList;
-import java.util.Calendar;
public class DBHelper extends SQLiteOpenHelper {
@@ -44,49 +42,47 @@ public void onCreate(SQLiteDatabase db) {
public void onUpgrade(SQLiteDatabase sqLiteDatabase, int i, int i1) {
}
- public void addPhrase(String text, String morse){
- for (PhrasebookModel model: getAllPhrases()){
- if (model.text.trim().equals(text.trim())){
+ public void addPhrase(String text, String morse) {
+
+ for (PhrasebookModel model : getAllPhrases()) {
+ if (model.text.trim().equals(text.trim())) {
deleteNote(model.id);
- Log.d("debug_star","deleted note, now returning");
+ Log.d("debug_star", "deleted note, now returning");
return;
}
}
- Log.d("debug_star","adding note, now returning");
+ Log.d("debug_star", "adding note, now returning");
SQLiteDatabase db = this.getWritableDatabase();
ContentValues values = new ContentValues();
values.put("sentence", text);
- values.put("morse",morse);
+ values.put("morse", morse);
- db.insert(TABLE_PHRASEBOOK, null,values);
+ db.insert(TABLE_PHRASEBOOK, null, values);
db.close(); // Closing database connection
}
-
-
-
- public void deleteNote(int id){
+ public void deleteNote(int id) {
SQLiteDatabase db = this.getWritableDatabase();
- db.delete(TABLE_PHRASEBOOK,"id= " + id,null);
+ db.delete(TABLE_PHRASEBOOK, "id= " + id, null);
db.close(); // Closing database connection
}
public ArrayList getAllPhrases() {
String selectQuery = "SELECT * FROM " + TABLE_PHRASEBOOK;
- ArrayList mList = new ArrayList();
+ ArrayList mList = new ArrayList<>();
try {
SQLiteDatabase db = this.getWritableDatabase();
Cursor cursor = db.rawQuery(selectQuery, null);
while (cursor.moveToNext()) {
- mList.add(new PhrasebookModel(cursor.getInt(0),cursor.getString(1),cursor.getString(2)));
- // Log.d(TAG, "title"+cursor.getString(3)+" notes="+cursor.getString(4));
+ mList.add(new PhrasebookModel(cursor.getInt(0), cursor.getString(1), cursor.getString(2)));
+ // Log.d(TAG, "title"+cursor.getString(3)+" notes="+cursor.getString(4));
}
db.close();
return mList;
diff --git a/app/src/main/java/rocks/poopjournal/morse/DialogsUtil.java b/app/src/main/java/rocks/poopjournal/morse/DialogsUtil.java
index ad435f4..68a77bc 100644
--- a/app/src/main/java/rocks/poopjournal/morse/DialogsUtil.java
+++ b/app/src/main/java/rocks/poopjournal/morse/DialogsUtil.java
@@ -9,13 +9,13 @@
public class DialogsUtil {
- public static Dialog showVerificationDialog(Activity activity){
+ public static Dialog showVerificationDialog(Activity activity) {
Dialog dialog;
- dialog = new Dialog(activity,android.R.style.Theme_Black_NoTitleBar_Fullscreen);
+ dialog = new Dialog(activity, android.R.style.Theme_Black_NoTitleBar_Fullscreen);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.getWindow().setBackgroundDrawable(
- new ColorDrawable(activity.getResources().getColor(R.color.colorDialogTransclucent)));
+ new ColorDrawable(activity.getResources().getColor(R.color.colorDialogTranslucent)));
dialog.getWindow().setLayout(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT);
dialog.setContentView(R.layout.dialog_verification);
dialog.setCancelable(true);
diff --git a/app/src/main/java/rocks/poopjournal/morse/EditTextTouch.java b/app/src/main/java/rocks/poopjournal/morse/EditTextTouch.java
index f9264de..4bfa226 100644
--- a/app/src/main/java/rocks/poopjournal/morse/EditTextTouch.java
+++ b/app/src/main/java/rocks/poopjournal/morse/EditTextTouch.java
@@ -3,12 +3,12 @@
import android.annotation.SuppressLint;
import android.content.Context;
import android.util.AttributeSet;
-import android.view.MotionEvent;
-import android.view.View;
import android.widget.EditText;
@SuppressLint("AppCompatCustomView")
public class EditTextTouch extends EditText {
+ public final OnTouchListener mOnTouchListener = (v, rawEvent) -> false;
+
public EditTextTouch(Context context) {
super(context);
}
@@ -20,10 +20,4 @@ public EditTextTouch(Context context, AttributeSet attrs) {
public EditTextTouch(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
- public final OnTouchListener mOnTouchListener = new OnTouchListener() {
- @Override
- public boolean onTouch(View v, MotionEvent rawEvent) {
- return false;
- }
- };
}
diff --git a/app/src/main/java/rocks/poopjournal/morse/MainActivity.java b/app/src/main/java/rocks/poopjournal/morse/MainActivity.java
index 656e828..7c9d2e3 100644
--- a/app/src/main/java/rocks/poopjournal/morse/MainActivity.java
+++ b/app/src/main/java/rocks/poopjournal/morse/MainActivity.java
@@ -16,12 +16,9 @@
import android.media.MediaPlayer;
import android.os.AsyncTask;
import android.os.Build;
+import android.os.Bundle;
import android.os.Handler;
import android.os.SystemClock;
-
-import androidx.appcompat.app.AppCompatActivity;
-import androidx.core.content.ContextCompat;
-import android.os.Bundle;
import android.text.Editable;
import android.text.SpannableStringBuilder;
import android.text.Spanned;
@@ -30,7 +27,6 @@
import android.text.style.ForegroundColorSpan;
import android.text.style.StyleSpan;
import android.util.Log;
-import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewTreeObserver;
@@ -40,6 +36,9 @@
import android.widget.TextView;
import android.widget.Toast;
+import androidx.appcompat.app.AppCompatActivity;
+import androidx.core.content.ContextCompat;
+
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -51,6 +50,8 @@
public class MainActivity extends AppCompatActivity implements Camera.AutoFocusCallback {
+ public static Camera camera = null;// has to be static, otherwise onDestroy() destroys it
+ final AtomicBoolean textToMorse = new AtomicBoolean(true);
ImageView settings, history, flash;
TextView buttonOne;
TextView buttonTwo;
@@ -61,7 +62,7 @@ public class MainActivity extends AppCompatActivity implements Camera.AutoFocusC
ImageView copy;
ImageView sound;
RelativeLayout container, mic, fullscreen;
- int global_counter=0;
+ int global_counter = 0;
RelativeLayout bottomNavigation;
RelativeLayout flare_view;
RelativeLayout morseInputContainer;
@@ -70,7 +71,6 @@ public class MainActivity extends AppCompatActivity implements Camera.AutoFocusC
RelativeLayout space;
RelativeLayout makeInputVisible;
RelativeLayout backspace;
- public static Camera camera = null;// has to be static, otherwise onDestroy() destroys it
boolean visibilityCheck = false;
ArrayList popularMorse = new ArrayList<>();
HashMap popularMorseConversion = new HashMap<>();
@@ -79,7 +79,252 @@ public class MainActivity extends AppCompatActivity implements Camera.AutoFocusC
DBHelper helper;
ImageView star;
ArrayList arrayList;
- final AtomicBoolean textToMorse = new AtomicBoolean(true);
+ ViewTreeObserver.OnGlobalLayoutListener listener = new ViewTreeObserver.OnGlobalLayoutListener() {
+ @Override
+ public void onGlobalLayout() {
+
+ final String[] something = flashText.trim().replaceAll("\\s+", "").split("(?!^)");
+ Log.d("flare", "flash_text: " + flashText);
+ Log.d("flare", "counter: " + global_counter);
+ if (global_counter == something.length) {
+ flare_view.setVisibility(View.GONE);
+ flare_view.setTag(flare_view.getVisibility());
+ flare_view.getViewTreeObserver().removeOnGlobalLayoutListener(this);
+ return;
+ }
+
+ /* Log.d("flare","here");
+ Log.d("flare","current character: " + something[global_counter]);
+ Log.d("flare","string" + flashText);
+ for (int i=0;i {
+ Log.d("flare", "dot_post_delayed");
+ flare_view.setVisibility(View.GONE);
+ global_counter++;
+ flare_view.setTag(flare_view.getVisibility());
+ if (global_counter != something.length) {
+ handler.postDelayed(MainActivity.this::flash_display, 150);
+ }
+
+ }, 350);
+ } else if (something[global_counter].equals("-")) {
+ final Handler handler = new Handler();
+ Log.d("flare", "dash");
+ handler.postDelayed(() -> {
+ Log.d("flare", "dash_post_delayed");
+ flare_view.setVisibility(View.GONE);
+ global_counter++;
+ flare_view.setTag(flare_view.getVisibility());
+ if (global_counter != something.length) {
+ handler.postDelayed(MainActivity.this::flash_display, 150);
+ }
+ }, 1000);
+ } else {
+ Log.d("flare", "can't identifyt");
+ }
+
+ }
+ }
+ };
+ private View.OnTouchListener otl = (v, event) -> {
+ return true; // the listener has consumed the event
+ };
+
+ public static void setMargins(View v, int l, int t, int r, int b) {
+ if (v.getLayoutParams() instanceof ViewGroup.MarginLayoutParams) {
+ ViewGroup.MarginLayoutParams p = (ViewGroup.MarginLayoutParams) v.getLayoutParams();
+ p.setMargins(l, t, r, b);
+ v.requestLayout();
+ }
+ }
+
+ public static void hideKeyboard(Activity activity) {
+ InputMethodManager imm = (InputMethodManager) activity.getSystemService(Activity.INPUT_METHOD_SERVICE);
+ //Find the currently focused view, so we can grab the correct window token from it.
+ View view = activity.getCurrentFocus();
+ //If no view currently has focus, create a new one, just so we can grab a window token from it
+ if (view == null) {
+ view = new View(activity);
+ }
+ imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
+ }
+
+ static String morseEncode(String x) {
+ // refer to the Morse table
+ // image attached in the article
+ x = x.toLowerCase();
+ switch (x) {
+ case "a":
+ return ".-";
+ case "b":
+ return "-...";
+ case "c":
+ return "-.-.";
+ case "d":
+ return "-..";
+ case "e":
+ return ".";
+ case "f":
+ return "..-.";
+ case "g":
+ return "--.";
+ case "h":
+ return "....";
+ case "i":
+ return "..";
+ case "j":
+ return ".---";
+ case "k":
+ return "-.-";
+ case "l":
+ return ".-..";
+ case "m":
+ return "--";
+ case "n":
+ return "-.";
+ case "o":
+ return "---";
+ case "p":
+ return ".--.";
+ case "q":
+ return "--.-";
+ case "r":
+ return ".-.";
+ case "s":
+ return "...";
+ case "t":
+ return "-";
+ case "u":
+ return "..-";
+ case "v":
+ return "...-";
+ case "w":
+ return ".--";
+ case "x":
+ return "-..-";
+ case "y":
+ return "-.--";
+ case " ":
+ return " ";
+ case "z":
+ return "--..";
+ case " ":
+ return " ";
+ case "0":
+ return "-----";
+ case "1":
+ return ".----";
+ case "2":
+ return "..---";
+ case "3":
+ return "...--";
+ case "4":
+ return "....-";
+ case "5":
+ return ".....";
+ case "6":
+ return "-....";
+ case "7":
+ return "--...";
+ case "8":
+ return "---..";
+ case "9":
+ return "----.";
+ }
+ return "";
+ }
+
+ static String morseDecode(String morse) {
+ // refer to the Morse table
+ // image attached in the article
+ switch (morse) {
+ case ".-":
+ return "a";
+ case "-...":
+ return "b";
+ case "-.-.":
+ return "c";
+ case "-..":
+ return "d";
+ case ".":
+ return "e";
+ case "..-.":
+ return "f";
+ case "--.":
+ return "g";
+ case "....":
+ return "h";
+ case "..":
+ return "i";
+ case ".---":
+ return "j";
+ case "-.-":
+ return "k";
+ case ".-..":
+ return "l";
+ case "--":
+ return "m";
+ case "-.":
+ return "n";
+ case "---":
+ return "o";
+ case ".--.":
+ return "p";
+ case "--.-":
+ return "q";
+ case ".-.":
+ return "r";
+ case "...":
+ return "s";
+ case "-":
+ return "t";
+ case "..-":
+ return "u";
+ case "...-":
+ return "v";
+ case ".--":
+ return "w";
+ case "-..-":
+ return "x";
+ case "-.--":
+ return "y";
+ case "--..":
+ return "z";
+ case " ":
+ return " ";
+ case "-----":
+ return "0";
+ case ".----":
+ return "1";
+ case "..---":
+ return "2";
+ case "...--":
+ return "3";
+ case "....-":
+ return "4";
+ case ".....":
+ return "5";
+ case "-....":
+ return "6";
+ case "--...":
+ return "7";
+ case "---..":
+ return "8";
+ case "----.":
+ return "9";
+
+ }
+
+ return "";
+ }
+
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -110,284 +355,230 @@ protected void onCreate(Bundle savedInstanceState) {
popularMorse.add(".-..--...");
flare_view.setVisibility(View.GONE);
- popularMorseConversion.put("...---...","... --- ...");
- popularMorseConversion.put("-.-.--.--..","-.-. --.- -..");
- popularMorseConversion.put(".--.....--.....--....--.----...--.-.---..---.....-",".-- .... .- - .... .- - .... --. --- -.. .-- .-. --- ..- --. .... -");
- popularMorseConversion.put(".-..--...",".-. .- - ...");
-
- popularMorseConversionText.put("...---...","SOS");
- popularMorseConversionText.put("-.-.--.--..","CQD");
- popularMorseConversionText.put(".--.....--.....--....--.----...--.-.---..---.....-","What hath God wrought");
- popularMorseConversionText.put(".-..--...","rats");
- flash.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View view) {
-
- int hasCameraPermission = checkSelfPermission(Manifest.permission.CAMERA);
+ popularMorseConversion.put("...---...", "... --- ...");
+ popularMorseConversion.put("-.-.--.--..", "-.-. --.- -..");
+ popularMorseConversion.put(".--.....--.....--....--.----...--.-.---..---.....-", ".-- .... .- - .... .- - .... --. --- -.. .-- .-. --- ..- --. .... -");
+ popularMorseConversion.put(".-..--...", ".-. .- - ...");
+
+ popularMorseConversionText.put("...---...", "SOS");
+ popularMorseConversionText.put("-.-.--.--..", "CQD");
+ popularMorseConversionText.put(".--.....--.....--....--.----...--.-.---..---.....-", "What hath God wrought");
+ popularMorseConversionText.put(".-..--...", "rats");
+ flash.setOnClickListener(view -> {
+
+ int hasCameraPermission = 0;
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
+ hasCameraPermission = checkSelfPermission(Manifest.permission.CAMERA);
+ }
- if (hasCameraPermission != PackageManager.PERMISSION_GRANTED) {
- Toast.makeText(getApplicationContext(),"Please give camera permission to use flash",Toast.LENGTH_SHORT).show();
- return;
- }
- turnOff();
- if (textToMorse.get()){
- if (!TextUtils.isEmpty(output.getText().toString())){
- String[] something = TextUtils.split(output.getText().toString().trim().replaceAll("\\s+",""),"");
- Log.d("test_string",output.getText().toString().trim().replace(" ","").replace(" ",""));
- Log.d("test_string",".....");
- Log.d("test_length_string",String.valueOf(something.length))
- ;
- for (String s: something){
- Log.d("skkk",s);
- }
+ if (hasCameraPermission != PackageManager.PERMISSION_GRANTED) {
+ Toast.makeText(getApplicationContext(), "Please give camera permission to use flash", Toast.LENGTH_SHORT).show();
+ return;
+ }
+ turnOff();
+ if (textToMorse.get()) {
+ if (!TextUtils.isEmpty(output.getText().toString())) {
+ String[] something = TextUtils.split(output.getText().toString().trim().replaceAll("\\s+", ""), "");
+ Log.d("test_string", output.getText().toString().trim().replace(" ", "").replace(" ", ""));
+ Log.d("test_string", ".....");
+ Log.d("test_length_string", String.valueOf(something.length))
+ ;
+ for (String s : something) {
+ Log.d("skkk", s);
+ }
- int len = something.length;
+ int len = something.length;
- int currentcounter =0;
- for (String s : something) {
- if (s.equals(".")) {
- turnOn();
- SystemClock.sleep(200);
- turnOff();
- } else if (s.equals("-")) {
- turnOn();
- SystemClock.sleep(600);
- turnOff();
- }
+ int currentcounter = 0;
+ for (String s : something) {
+ if (s.equals(".")) {
+ turnOn();
+ SystemClock.sleep(200);
+ turnOff();
+ } else if (s.equals("-")) {
+ turnOn();
+ SystemClock.sleep(600);
+ turnOff();
}
-
}
+
}
- else {
- if (!TextUtils.isEmpty(input.getText().toString())){
- String[] something = TextUtils.split(input.getText().toString().trim().replaceAll("\\s+",""),"");
- Log.d("test_string",input.getText().toString().trim().replace(" ","").replace(" ",""));
- Log.d("test_string",".....");
- Log.d("test_length_string",String.valueOf(something.length))
- ;
- for (String s: something){
- Log.d("skkk",s);
- }
+ } else {
+ if (!TextUtils.isEmpty(input.getText().toString())) {
+ String[] something = TextUtils.split(input.getText().toString().trim().replaceAll("\\s+", ""), "");
+ Log.d("test_string", input.getText().toString().trim().replace(" ", "").replace(" ", ""));
+ Log.d("test_string", ".....");
+ Log.d("test_length_string", String.valueOf(something.length))
+ ;
+ for (String s : something) {
+ Log.d("skkk", s);
+ }
- int len = something.length;
+ int len = something.length;
- int currentcounter =0;
- for (String s : something) {
- if (s.equals(".")) {
- turnOn();
- SystemClock.sleep(200);
- turnOff();
- } else if (s.equals("-")) {
- turnOn();
- SystemClock.sleep(600);
- turnOff();
- }
+ int currentcounter = 0;
+ for (String s : something) {
+ if (s.equals(".")) {
+ turnOn();
+ SystemClock.sleep(200);
+ turnOff();
+ } else if (s.equals("-")) {
+ turnOn();
+ SystemClock.sleep(600);
+ turnOff();
}
-
}
+
}
}
});
- history.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View view) {
-
- startActivity(new Intent(MainActivity.this, PhraseBookActivity.class));
- }
- });
- mic.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View view) {
- Toast.makeText(getApplicationContext(),"To be implemented in a future release", Toast.LENGTH_SHORT).show();
- }
- });
- fullscreen.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View view) {
- Toast.makeText(getApplicationContext(),"To be implemented in a future release", Toast.LENGTH_SHORT).show();
- }
- });
- settings.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- Toast.makeText(getApplicationContext(),"To be implemented in a future release", Toast.LENGTH_SHORT).show();
- }
- });
+ history.setOnClickListener(view -> startActivity(new Intent(MainActivity.this, PhraseBookActivity.class)));
+ mic.setOnClickListener(view -> Toast.makeText(getApplicationContext(), "To be implemented in a future release", Toast.LENGTH_SHORT).show());
+ fullscreen.setOnClickListener(view -> Toast.makeText(getApplicationContext(), "To be implemented in a future release", Toast.LENGTH_SHORT).show());
+ settings.setOnClickListener(v -> Toast.makeText(getApplicationContext(), "To be implemented in a future release", Toast.LENGTH_SHORT).show());
container = findViewById(R.id.container);
bottomNavigation = findViewById(R.id.bottomLayout);
morseInputContainer = findViewById(R.id.morseInputContainer);
makeInputVisible = findViewById(R.id.input_visible_container);
- makeInputVisible.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- if (morseInputContainer.getVisibility()==View.GONE)
- morseInputContainer.setVisibility(View.VISIBLE);
- else {
- morseInputContainer.setVisibility(View.GONE);
- }
+ makeInputVisible.setOnClickListener(v -> {
+ if (morseInputContainer.getVisibility() == View.GONE)
+ morseInputContainer.setVisibility(View.VISIBLE);
+ else {
+ morseInputContainer.setVisibility(View.GONE);
}
});
- copy.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- ClipboardManager clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
- ClipData clip = ClipData.newPlainText("something", output.getText().toString());
- clipboard.setPrimaryClip(clip);
- Toast.makeText(getApplicationContext(),"Text copied",Toast.LENGTH_SHORT).show();
- }
+ copy.setOnClickListener(v -> {
+ ClipboardManager clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
+ ClipData clip = ClipData.newPlainText("something", output.getText().toString());
+ clipboard.setPrimaryClip(clip);
+ Toast.makeText(getApplicationContext(), "Text copied", Toast.LENGTH_SHORT).show();
});
- addKeyboardVisibilityListener(container, new KeyboardVisibilityCallback() {
- @Override
- public void onChange(boolean isVisible) {
- visibilityCheck = isVisible;
- }
- });
+ addKeyboardVisibilityListener(container, isVisible -> visibilityCheck = isVisible);
final ImageView flare = findViewById(R.id.flare);
- final Runnable hide = new Runnable() {
- @Override
- public void run() {
- flare_view.setVisibility(View.GONE);
+ final Runnable hide = () -> {
+ flare_view.setVisibility(View.GONE);
- Log.d("flare","set to gone");
- }
+ Log.d("flare", "set to gone");
};
- star.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View view) {
- if (!TextUtils.isEmpty(output.getText().toString().trim()) && !TextUtils.isEmpty(input.getText().toString().trim())){
- if (textToMorse.get())
- helper.addPhrase(input.getText().toString(),output.getText().toString());
- else {
- helper.addPhrase(output.getText().toString(),input.getText().toString());
- }
+ star.setOnClickListener(view -> {
+ if (!TextUtils.isEmpty(output.getText().toString().trim()) && !TextUtils.isEmpty(input.getText().toString().trim())) {
+ if (textToMorse.get())
+ helper.addPhrase(input.getText().toString(), output.getText().toString());
+ else {
+ helper.addPhrase(output.getText().toString(), input.getText().toString());
}
-
- arrayList = helper.getAllPhrases();
- checkForStarColor();
}
- });
- flare.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View view) {
- if (textToMorse.get()){
- if (!TextUtils.isEmpty(output.getText().toString())){
-
- /* new Thread() {
- public void run() {
- String[] something = TextUtils.split(output.getText().toString().trim().replaceAll("\\s+",""),"");
- for (String s : something) {
- try {
-
- flare_view.setVisibility(View.VISIBLE);
- sleep(500);
- flare_view.setVisibility(View.INVISIBLE);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
+ arrayList = helper.getAllPhrases();
+ checkForStarColor();
+ });
+ flare.setOnClickListener(view -> {
+ if (textToMorse.get()) {
+ if (!TextUtils.isEmpty(output.getText().toString())) {
+/*
+ new Thread() {
+ public void run() {
+ String[] something = TextUtils.split(output.getText().toString().trim().replaceAll("\\s+", ""), "");
+ for (String s : something) {
+ try {
+ flare_view.setVisibility(View.VISIBLE);
+ sleep(500);
+ flare_view.setVisibility(View.INVISIBLE);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
}
- }
- }.run();
+ }
+ }
+ }.run();
*/
- flare_view.getViewTreeObserver().addOnGlobalLayoutListener(listener);
- flashText = output.getText().toString().trim().replace(" ","").replaceAll("\\s+","");
- global_counter=0;
- flash_display();
-
-
+ flare_view.getViewTreeObserver().addOnGlobalLayoutListener(listener);
+ flashText = output.getText().toString().trim().replace(" ", "").replaceAll("\\s+", "");
+ global_counter = 0;
+ flash_display();
-
- }
}
- else {
- if (!TextUtils.isEmpty(input.getText().toString())){
-
- /* new Thread() {
- public void run() {
- String[] something = TextUtils.split(output.getText().toString().trim().replaceAll("\\s+",""),"");
- for (String s : something) {
-
- try {
-
- flare_view.setVisibility(View.VISIBLE);
- sleep(500);
- flare_view.setVisibility(View.INVISIBLE);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
+ } else {
+ if (!TextUtils.isEmpty(input.getText().toString())) {
+/*
+ new Thread() {
+ public void run() {
+ String[] something = TextUtils.split(output.getText().toString().trim().replaceAll("\\s+", ""), "");
+ for (String s : something) {
+ try {
+ flare_view.setVisibility(View.VISIBLE);
+ sleep(500);
+ flare_view.setVisibility(View.INVISIBLE);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
}
- }
- }.run();
+ }
+ }
+ }.run();
*/
- flare_view.getViewTreeObserver().addOnGlobalLayoutListener(listener);
- flashText = input.getText().toString().trim().replace(" ","").replaceAll("\\s+","");
- global_counter=0;
- flash_display();
-
-
+ flare_view.getViewTreeObserver().addOnGlobalLayoutListener(listener);
+ flashText = input.getText().toString().trim().replace(" ", "").replaceAll("\\s+", "");
+ global_counter = 0;
+ flash_display();
-
- }
}
}
});
sound.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
- if (textToMorse.get()){
- if (!TextUtils.isEmpty(output.getText().toString())){
- String[] something = TextUtils.split(output.getText().toString().trim().replaceAll("\\s+",""),"");
- Log.d("test_string",output.getText().toString().trim().replace(" ","").replace(" ",""));
- Log.d("test_string",".....");
- Log.d("test_length_string",String.valueOf(something.length))
- ;
- for (String s: something){
- Log.d("skkk",s);
- }
-
- int len = something.length;
- final int[] tracks = new int[len];
+ if (textToMorse.get()) {
+ if (!TextUtils.isEmpty(output.getText().toString())) {
+ String[] something = TextUtils.split(output.getText().toString().trim().replaceAll("\\s+", ""), "");
+ Log.d("test_string", output.getText().toString().trim().replace(" ", "").replace(" ", ""));
+ Log.d("test_string", ".....");
+ Log.d("test_length_string", String.valueOf(something.length))
+ ;
+ for (String s : something) {
+ Log.d("skkk", s);
+ }
+
+ int len = something.length;
+ final int[] tracks = new int[len];
int counter = 0;
- for (String s: something){
- if (s.equals(".")){
- tracks[counter] = R.raw.dot;
- counter++;
- }
- else if (s.equals("-")){
- tracks[counter] = R.raw.dash;
- counter++;
- }
- }
-
- Log.d("test_length",String.valueOf(tracks.length));
+ for (String s : something) {
+ if (s.equals(".")) {
+ tracks[counter] = R.raw.dot;
+ counter++;
+ } else if (s.equals("-")) {
+ tracks[counter] = R.raw.dash;
+ counter++;
+ }
+ }
+
+ Log.d("test_length", String.valueOf(tracks.length));
final int[] trackcounter = {0};
- MediaPlayer mediaPlayer = MediaPlayer.create(getApplicationContext(), tracks[trackcounter[0]]);
+ MediaPlayer mediaPlayer = MediaPlayer.create(getApplicationContext(), tracks[trackcounter[0]]);
mediaPlayer.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
@Override
public void onCompletion(MediaPlayer mp) {
mp.release();
- if (trackcounter[0] < tracks.length-3) {
+ if (trackcounter[0] < tracks.length - 3) {
trackcounter[0]++;
mp = MediaPlayer.create(getApplicationContext(), tracks[trackcounter[0]]);
mp.setOnCompletionListener(this);
@@ -397,40 +588,38 @@ public void onCompletion(MediaPlayer mp) {
});
mediaPlayer.start();
}
- }
- else{
- if (!TextUtils.isEmpty(input.getText().toString())){
- String[] something = TextUtils.split(input.getText().toString().trim().replaceAll("\\s+",""),"");
- Log.d("test_string",input.getText().toString().trim().replace(" ","").replace(" ",""));
- Log.d("test_string",".....");
- Log.d("test_length_string",String.valueOf(something.length))
+ } else {
+ if (!TextUtils.isEmpty(input.getText().toString())) {
+ String[] something = TextUtils.split(input.getText().toString().trim().replaceAll("\\s+", ""), "");
+ Log.d("test_string", input.getText().toString().trim().replace(" ", "").replace(" ", ""));
+ Log.d("test_string", ".....");
+ Log.d("test_length_string", String.valueOf(something.length))
;
- for (String s: something){
- Log.d("skkk",s);
+ for (String s : something) {
+ Log.d("skkk", s);
}
int len = something.length;
final int[] tracks = new int[len];
int counter = 0;
- for (String s: something){
- if (s.equals(".")){
+ for (String s : something) {
+ if (s.equals(".")) {
tracks[counter] = R.raw.dot;
counter++;
- }
- else if (s.equals("-")){
+ } else if (s.equals("-")) {
tracks[counter] = R.raw.dash;
counter++;
}
}
- Log.d("test_length",String.valueOf(tracks.length));
+ Log.d("test_length", String.valueOf(tracks.length));
final int[] trackcounter = {0};
MediaPlayer mediaPlayer = MediaPlayer.create(getApplicationContext(), tracks[trackcounter[0]]);
mediaPlayer.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
@Override
public void onCompletion(MediaPlayer mp) {
mp.release();
- if (trackcounter[0] < tracks.length-3) {
+ if (trackcounter[0] < tracks.length - 3) {
trackcounter[0]++;
mp = MediaPlayer.create(getApplicationContext(), tracks[trackcounter[0]]);
mp.setOnCompletionListener(this);
@@ -443,82 +632,56 @@ public void onCompletion(MediaPlayer mp) {
}
}
});
- switchImageContainer.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- if (textToMorse.get()){
- buttonOne.setText("MORSE");
- buttonTwo.setText("TEXT");
- input.setText("");
- output.setText("");
- textToMorse.set(false);
- input.setOnTouchListener(otl);
-
- bottomNavigation.setVisibility(View.VISIBLE);
- morseInputContainer.setVisibility(View.VISIBLE);
-
- if (visibilityCheck)
- hideKeyboard(MainActivity.this);
- dot = findViewById(R.id.inputDotContainer);
- dash = findViewById(R.id.inputDashContainer);
- space = findViewById(R.id.input_space_container);
- backspace = findViewById(R.id.input_clear_container);
-
- dot.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- input.append(".");
- Log.d("test","clicked");
- }
- });
- dash.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- input.append("-");
- }
- });
- space.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- input.append(" ");
- }
- });
- backspace.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- if (input.getText().toString().length()==0)
- return;
- input.setText(input.getText().toString().substring(0,input.getText().toString().length()-1));
- input.setSelection(input.getText().toString().length());
+ switchImageContainer.setOnClickListener(v -> {
+ if (textToMorse.get()) {
+ buttonOne.setText("MORSE");
+ buttonTwo.setText("TEXT");
+ input.setText("");
+ output.setText("");
+ textToMorse.set(false);
+ input.setOnTouchListener(otl);
+
+ bottomNavigation.setVisibility(View.VISIBLE);
+ morseInputContainer.setVisibility(View.VISIBLE);
+
+ if (visibilityCheck)
+ hideKeyboard(MainActivity.this);
+ dot = findViewById(R.id.inputDotContainer);
+ dash = findViewById(R.id.inputDashContainer);
+ space = findViewById(R.id.input_space_container);
+ backspace = findViewById(R.id.input_clear_container);
+
+ dot.setOnClickListener(v1 -> {
+ input.append(".");
+ Log.d("test", "clicked");
+ });
+ dash.setOnClickListener(v12 -> input.append("-"));
+ space.setOnClickListener(v13 -> input.append(" "));
+ backspace.setOnClickListener(v14 -> {
+ if (input.getText().toString().length() == 0)
+ return;
+ input.setText(input.getText().toString().substring(0, input.getText().toString().length() - 1));
+ input.setSelection(input.getText().toString().length());
- }
- });
- backspace.setOnLongClickListener(new View.OnLongClickListener() {
- @Override
- public boolean onLongClick(View v) {
- input.setText("");
- return false;
- }
- });
- }
- else { input.setText("");
- output.setText("");
- buttonOne.setText("TEXT");
- buttonTwo.setText("MORSE");
- textToMorse.set(true);
- input.setOnTouchListener(new View.OnTouchListener() {
-
- @Override
- public boolean onTouch(View v, MotionEvent event) {
- v.setOnTouchListener(input.mOnTouchListener);
- return false;
- }
- });
- bottomNavigation.setVisibility(View.GONE);
- morseInputContainer.setVisibility(View.GONE);
+ });
+ backspace.setOnLongClickListener(v15 -> {
+ input.setText("");
+ return false;
+ });
+ } else {
+ input.setText("");
+ output.setText("");
+ buttonOne.setText("TEXT");
+ buttonTwo.setText("MORSE");
+ textToMorse.set(true);
+ input.setOnTouchListener((v16, event) -> {
+ v16.setOnTouchListener(input.mOnTouchListener);
+ return false;
+ });
+ bottomNavigation.setVisibility(View.GONE);
+ morseInputContainer.setVisibility(View.GONE);
- }
}
});
@@ -531,94 +694,79 @@ public void beforeTextChanged(CharSequence s, int start, int count, int after) {
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
- if (TextUtils.isEmpty(s.toString())){
+ if (TextUtils.isEmpty(s.toString())) {
output.setText("");
return;
}
- if (textToMorse.get()){
+ if (textToMorse.get()) {
output.setText("");
String text = input.getText().toString();
String[] letters = text.split("");
for (String letter : letters) {
- output.append(morseEncode(letter)+" ");
+ output.append(morseEncode(letter) + " ");
}
- }
- else {
- if (popularMorse.contains(input.getText().toString())){
- /* final Dialog confirm = DialogsUtil.showVerificationDialog(MainActivity.this);
+ } else {
+ if (popularMorse.contains(input.getText().toString())) {
+/*
+ final Dialog confirm = DialogsUtil.showVerificationDialog(MainActivity.this);
TextView original, converted, discard, yes;
original = confirm.findViewById(R.id.successTV);
converted = confirm.findViewById(R.id.descTV);
discard = confirm.findViewById(R.id.discardBtnVerify);
yes = confirm.findViewById(R.id.import_playlist);
-
original.setText(input.getText().toString());
- converted.setText("Do you mean " + popularMorseConversionText.get(input.getText().toString())+ " " + popularMorseConversion.get(input.getText().toString()) +"?");
- discard.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View view) {
- confirm.dismiss();
- }
+ converted.setText("Do you mean " + popularMorseConversionText.get(input.getText().toString()) + " " + popularMorseConversion.get(input.getText().toString()) + "?");
+ discard.setOnClickListener(view -> confirm.dismiss());
+ yes.setOnClickListener(view -> {
+ input.setText(popularMorseConversion.get(input.getText().toString()));
+ Toast.makeText(getApplicationContext(), "Changed morse", Toast.LENGTH_SHORT).show();
+ confirm.dismiss();
});
- yes.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View view) {
- input.setText(popularMorseConversion.get(input.getText().toString()));
- Toast.makeText(getApplicationContext(),"Changed morse",Toast.LENGTH_SHORT).show();
- confirm.dismiss();
- }
- });*/
- Log.d("popular_morse","true");
- RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams)input.getLayoutParams();
- setMargins(input,params.leftMargin,params.topMargin,params.rightMargin,2);
- input.setBackground(ContextCompat.getDrawable(getApplicationContext(),R.drawable.bg_top_suggestion));
+*/
+ Log.d("popular_morse", "true");
+ RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) input.getLayoutParams();
+ setMargins(input, params.leftMargin, params.topMargin, params.rightMargin, 2);
+ input.setBackground(ContextCompat.getDrawable(getApplicationContext(), R.drawable.bg_top_suggestion));
popularMorseSuggestionContainer.setVisibility(View.VISIBLE);
TextView suggestionTV = findViewById(R.id.suggestion_text_tv);
TextView replace = findViewById(R.id.replace_suggestion);
TextView ignore = findViewById(R.id.ignore_suggestion);
-
- suggestionTV.setText("Did you mean " + popularMorseConversion.get(input.getText().toString())+ " (" + popularMorseConversionText.get(input.getText().toString()) +")?");
- change(suggestionTV.getText().toString(),popularMorseConversion.get(input.getText().toString()), suggestionTV);
-
- replace.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View view) {
- input.setText(popularMorseConversion.get(input.getText().toString()));
- input.setSelection(input.getText().length());
- Toast.makeText(getApplicationContext(),"Changed morse",Toast.LENGTH_SHORT).show();
- RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams)input.getLayoutParams();
- setMargins(input,params.leftMargin,params.topMargin,params.rightMargin,20);
- input.setBackground(ContextCompat.getDrawable(getApplicationContext(),R.drawable.et_morse));
- popularMorseSuggestionContainer.setVisibility(View.GONE);
- }
+
+ suggestionTV.setText("Did you mean " + popularMorseConversion.get(input.getText().toString()) + " (" + popularMorseConversionText.get(input.getText().toString()) + ")?");
+ change(suggestionTV.getText().toString(), popularMorseConversion.get(input.getText().toString()), suggestionTV);
+
+ replace.setOnClickListener(view -> {
+ input.setText(popularMorseConversion.get(input.getText().toString()));
+ input.setSelection(input.getText().length());
+ Toast.makeText(getApplicationContext(), "Changed morse", Toast.LENGTH_SHORT).show();
+ RelativeLayout.LayoutParams params1 = (RelativeLayout.LayoutParams) input.getLayoutParams();
+ setMargins(input, params1.leftMargin, params1.topMargin, params1.rightMargin, 20);
+ input.setBackground(ContextCompat.getDrawable(getApplicationContext(), R.drawable.et_morse));
+ popularMorseSuggestionContainer.setVisibility(View.GONE);
});
- ignore.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View view) {
- RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams)input.getLayoutParams();
- setMargins(input,params.leftMargin,params.topMargin,params.rightMargin,20);
- input.setBackground(ContextCompat.getDrawable(getApplicationContext(),R.drawable.et_morse));
- popularMorseSuggestionContainer.setVisibility(View.GONE);
- }
+ ignore.setOnClickListener(view -> {
+ RelativeLayout.LayoutParams params12 = (RelativeLayout.LayoutParams) input.getLayoutParams();
+ setMargins(input, params12.leftMargin, params12.topMargin, params12.rightMargin, 20);
+ input.setBackground(ContextCompat.getDrawable(getApplicationContext(), R.drawable.et_morse));
+ popularMorseSuggestionContainer.setVisibility(View.GONE);
});
- }
- else {
- RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams)input.getLayoutParams();
- setMargins(input,params.leftMargin,params.topMargin,params.rightMargin,20);
- input.setBackground(ContextCompat.getDrawable(getApplicationContext(),R.drawable.et_morse));
+ } else {
+ RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) input.getLayoutParams();
+ setMargins(input, params.leftMargin, params.topMargin, params.rightMargin, 20);
+ input.setBackground(ContextCompat.getDrawable(getApplicationContext(), R.drawable.et_morse));
popularMorseSuggestionContainer.setVisibility(View.GONE);
}
output.setText("");
String text = input.getText().toString();
String[] letters = text.split("\\s");
- for (String morse: letters){
+ for (String morse : letters) {
output.append(morseDecode(morse));
}
}
@@ -635,309 +783,74 @@ public void afterTextChanged(Editable s) {
private void checkForStarColor() {
boolean isTrue = false;
- if (arrayList==null || arrayList.size()==0){
- star.setImageDrawable(ContextCompat.getDrawable(getApplicationContext(),R.drawable.ic_star_border_black_24dp));
+ if (arrayList == null || arrayList.size() == 0) {
+ star.setImageDrawable(ContextCompat.getDrawable(getApplicationContext(), R.drawable.ic_star_border_black_24dp));
star.setColorFilter(Color.parseColor("#7DD3D8"));
- Log.d("debug_star","did not match new text: " + input.getText().toString() + ", setting star to off");
+ Log.d("debug_star", "did not match new text: " + input.getText().toString() + ", setting star to off");
return;
}
- if (textToMorse.get()){
- for (PhrasebookModel model: arrayList){
- if (model.text.trim().equals(input.getText().toString().trim())){
- star.setImageDrawable(ContextCompat.getDrawable(getApplicationContext(),R.drawable.ic_star_black_24dp));
+ if (textToMorse.get()) {
+ for (PhrasebookModel model : arrayList) {
+ if (model.text.trim().equals(input.getText().toString().trim())) {
+ star.setImageDrawable(ContextCompat.getDrawable(getApplicationContext(), R.drawable.ic_star_black_24dp));
star.setColorFilter(Color.parseColor("#F9A825"));
- Log.d("debug_star","matched new text: " + input.getText().toString() + ", setting star to on");
+ Log.d("debug_star", "matched new text: " + input.getText().toString() + ", setting star to on");
return;
- }
- else {
+ } else {
isTrue = true;
}
}
- if (isTrue){
- star.setImageDrawable(ContextCompat.getDrawable(getApplicationContext(),R.drawable.ic_star_border_black_24dp));
+ if (isTrue) {
+ star.setImageDrawable(ContextCompat.getDrawable(getApplicationContext(), R.drawable.ic_star_border_black_24dp));
star.setColorFilter(Color.parseColor("#7DD3D8"));
- Log.d("debug_star","did not match new text: " + input.getText().toString() + ", setting star to on");
+ Log.d("debug_star", "did not match new text: " + input.getText().toString() + ", setting star to on");
}
- }
- else {
- for (PhrasebookModel model: arrayList){
- if (model.text.trim().equals(output.getText().toString().trim())){
- star.setImageDrawable(ContextCompat.getDrawable(getApplicationContext(),R.drawable.ic_star_black_24dp));
+ } else {
+ for (PhrasebookModel model : arrayList) {
+ if (model.text.trim().equals(output.getText().toString().trim())) {
+ star.setImageDrawable(ContextCompat.getDrawable(getApplicationContext(), R.drawable.ic_star_black_24dp));
star.setColorFilter(Color.parseColor("#F9A825"));
- Log.d("debug_star","matched new text: " + output.getText().toString() + ", setting star to on");
+ Log.d("debug_star", "matched new text: " + output.getText().toString() + ", setting star to on");
return;
- }
- else {
+ } else {
isTrue = true;
}
}
- if (isTrue){
- star.setImageDrawable(ContextCompat.getDrawable(getApplicationContext(),R.drawable.ic_star_border_black_24dp));
+ if (isTrue) {
+ star.setImageDrawable(ContextCompat.getDrawable(getApplicationContext(), R.drawable.ic_star_border_black_24dp));
star.setColorFilter(Color.parseColor("#7DD3D8"));
- Log.d("debug_star","did not match new text: " + output.getText().toString() + ", setting star to on");
+ Log.d("debug_star", "did not match new text: " + output.getText().toString() + ", setting star to on");
}
}
}
- private View.OnTouchListener otl = new View.OnTouchListener() {
- public boolean onTouch (View v, MotionEvent event) {
- return true; // the listener has consumed the event
- }
- };
-
-
void flash_display() {
flare_view.setVisibility(View.VISIBLE);
flare_view.bringToFront();
flare_view.setTag(flare_view.getVisibility());
- Log.d("flare","in flash dispaly");
-
- }
-
- public static void setMargins (View v, int l, int t, int r, int b) {
- if (v.getLayoutParams() instanceof ViewGroup.MarginLayoutParams) {
- ViewGroup.MarginLayoutParams p = (ViewGroup.MarginLayoutParams) v.getLayoutParams();
- p.setMargins(l, t, r, b);
- v.requestLayout();
- }
- }
-
- ViewTreeObserver.OnGlobalLayoutListener listener = new ViewTreeObserver.OnGlobalLayoutListener() {
- @Override
- public void onGlobalLayout() {
-
- final String[] something = flashText.trim().replaceAll("\\s+","").split("(?!^)");
- Log.d("flare","flash_text: " + flashText);
- Log.d("flare","counter: " + global_counter);
- if (global_counter==something.length){
- flare_view.setVisibility(View.GONE);
- flare_view.setTag(flare_view.getVisibility());
- flare_view.getViewTreeObserver().removeOnGlobalLayoutListener(this);return;
- }
-
- /* Log.d("flare","here");
- Log.d("flare","current character: " + something[global_counter]);
- Log.d("flare","string" + flashText);
- for (int i=0;i screenHeight * 0.15) {
- callback.onChange(true);
- } else {
- callback.onChange(false);
- }
+ () -> {
+ Rect r = new Rect();
+
+ rootView.getWindowVisibleDisplayFrame(r);
+ int screenHeight = rootView.getRootView().getHeight();
+ int keypadHeight = screenHeight - r.bottom;
+
+ if (keypadHeight > screenHeight * 0.15) {
+ callback.onChange(true);
+ } else {
+ callback.onChange(false);
}
});
}
@@ -947,15 +860,6 @@ public void onAutoFocus(boolean b, Camera camera) {
}
-
- public interface KeyboardVisibilityCallback{
- /**
- * On change of keyboard visibility
- * @param isVisible : Make keyboard visible.
- */
- void onChange(boolean isVisible);
- }
-
public void turnOn() {
camera = Camera.open();
@@ -973,6 +877,7 @@ public void turnOn() {
// We are expecting this to happen on devices that don't support autofocus.
}
}
+
private String getFlashOnParameter() {
List flashModes = camera.getParameters().getSupportedFlashModes();
@@ -985,6 +890,7 @@ private String getFlashOnParameter() {
}
throw new RuntimeException();
}
+
public void turnOff() {
try {
camera.stopPreview();
@@ -994,6 +900,7 @@ public void turnOff() {
// This will happen if the camera fails to turn on.
}
}
+
@Override
protected void onStart() {
super.onStart();
@@ -1002,56 +909,84 @@ protected void onStart() {
int hasCameraPermission = checkSelfPermission(Manifest.permission.CAMERA);
- List permissions = new ArrayList();
+ List permissions = new ArrayList<>();
if (hasCameraPermission != PackageManager.PERMISSION_GRANTED) {
permissions.add(Manifest.permission.CAMERA);
}
if (!permissions.isEmpty()) {
- requestPermissions(permissions.toArray(new String[permissions.size()]), 111);
+ requestPermissions(permissions.toArray(new String[0]), 111);
}
}
}
+
@Override
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
- switch (requestCode) {
- case 111: {
- for (int i = 0; i < permissions.length; i++) {
- if (grantResults[i] == PackageManager.PERMISSION_GRANTED) {
- System.out.println("Permissions --> " + "Permission Granted: " + permissions[i]);
+ if (requestCode == 111) {
+ for (int i = 0; i < permissions.length; i++) {
+ if (grantResults[i] == PackageManager.PERMISSION_GRANTED) {
+ System.out.println("Permissions --> " + "Permission Granted: " + permissions[i]);
- } else if (grantResults[i] == PackageManager.PERMISSION_DENIED) {
- System.out.println("Permissions --> " + "Permission Denied: " + permissions[i]);
+ } else if (grantResults[i] == PackageManager.PERMISSION_DENIED) {
+ System.out.println("Permissions --> " + "Permission Denied: " + permissions[i]);
- }
}
}
- break;
- default: {
- super.onRequestPermissionsResult(requestCode, permissions, grantResults);
- }
+ } else {
+ super.onRequestPermissionsResult(requestCode, permissions, grantResults);
}
}
- private class AsyncTaskRunner extends AsyncTask {
+ void change(String s, String newSuggestion, TextView t) {
+ int i = s.indexOf(newSuggestion);
+ SpannableStringBuilder sb = new SpannableStringBuilder(s);
+ sb.setSpan(new ForegroundColorSpan(ContextCompat.getColor(getApplicationContext(), R.color.colorMorse)), i, i + newSuggestion.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
+ int k = s.indexOf("(");
+ sb.setSpan(new StyleSpan(Typeface.ITALIC), k + 1, k + popularMorseConversionText.get(input.getText().toString()).length() + 1, 0);
+ sb.setSpan(new ForegroundColorSpan(ContextCompat.getColor(getApplicationContext(), R.color.colorMorse)), k + 1, k + popularMorseConversionText.get(input.getText().toString()).length() + 1, 0);
+ t.setText(sb);
+ }
+
+ @Override
+ protected void onResume() {
+ super.onResume();
+
+ arrayList = helper.getAllPhrases();
+ }
+
+ @Override
+ public void onConfigurationChanged(Configuration newConfig) {
+ super.onConfigurationChanged(newConfig);
+ helper = new DBHelper(getApplicationContext());
+ arrayList = helper.getAllPhrases();
+ // Checks the orientation of the scree
+ }
+
+
+ public interface KeyboardVisibilityCallback {
+ /**
+ * On change of keyboard visibility
+ *
+ * @param isVisible : Make keyboard visible.
+ */
+ void onChange(boolean isVisible);
+ }
- private String resp;
+ private class AsyncTaskRunner extends AsyncTask {
@Override
protected String doInBackground(String... params) {
publishProgress("Sleeping..."); // Calls onProgressUpdate()
+ String resp;
try {
int time = Integer.parseInt(params[0]);
Thread.sleep(time);
resp = "Slept for " + params[0] + " seconds";
- } catch (InterruptedException e) {
- e.printStackTrace();
- resp = e.getMessage();
} catch (Exception e) {
e.printStackTrace();
resp = e.getMessage();
@@ -1070,7 +1005,7 @@ protected void onPostExecute(String result) {
@Override
protected void onPreExecute() {
- flare_view.setVisibility(View.VISIBLE);
+ flare_view.setVisibility(View.VISIBLE);
}
@@ -1080,30 +1015,6 @@ protected void onProgressUpdate(String... text) {
}
}
- void change(String s, String newSuggestion, TextView t){
- int i = s.indexOf(newSuggestion);
- SpannableStringBuilder sb = new SpannableStringBuilder(s);
- sb.setSpan(new ForegroundColorSpan(ContextCompat.getColor(getApplicationContext(),R.color.colorMorse)), i, i+newSuggestion.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
- int k = s.indexOf("(");
- sb.setSpan(new StyleSpan(Typeface.ITALIC), k+1, k+popularMorseConversionText.get(input.getText().toString()).length()+1, 0);
- sb.setSpan(new ForegroundColorSpan(ContextCompat.getColor(getApplicationContext(),R.color.colorMorse)), k+1, k+popularMorseConversionText.get(input.getText().toString()).length() +1, 0);
- t.setText(sb);
- }
-
-
- @Override
- protected void onResume() {
- super.onResume();
-
- arrayList = helper.getAllPhrases();
- }
- @Override
- public void onConfigurationChanged(Configuration newConfig) {
- super.onConfigurationChanged(newConfig);
- helper = new DBHelper(getApplicationContext());
- arrayList = helper.getAllPhrases();
- // Checks the orientation of the scree
- }
}
diff --git a/app/src/main/java/rocks/poopjournal/morse/PhraseBookActivity.java b/app/src/main/java/rocks/poopjournal/morse/PhraseBookActivity.java
index 3846077..2869ac4 100644
--- a/app/src/main/java/rocks/poopjournal/morse/PhraseBookActivity.java
+++ b/app/src/main/java/rocks/poopjournal/morse/PhraseBookActivity.java
@@ -1,10 +1,8 @@
package rocks.poopjournal.morse;
import android.os.Bundle;
-import android.view.View;
import android.widget.ImageView;
-import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.ItemTouchHelper;
import androidx.recyclerview.widget.LinearLayoutManager;
@@ -18,24 +16,19 @@ public class PhraseBookActivity extends AppCompatActivity {
PhrasebookAdapter phrasebookAdapter;
DBHelper helper;
ImageView back;
+
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_phrasebook);
- helper =new DBHelper(getApplicationContext());
+ helper = new DBHelper(getApplicationContext());
back = findViewById(R.id.back);
- back.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View view) {
- finish();
- }
- });
+ back.setOnClickListener(view -> finish());
ArrayList arrayList = helper.getAllPhrases();
-
phrasebookAdapter = new PhrasebookAdapter(this, helper);
phrasebookRv = findViewById(R.id.rv_phrasebook);
diff --git a/app/src/main/java/rocks/poopjournal/morse/PhrasebookAdapter.java b/app/src/main/java/rocks/poopjournal/morse/PhrasebookAdapter.java
index 9cd5d45..45d6b1e 100644
--- a/app/src/main/java/rocks/poopjournal/morse/PhrasebookAdapter.java
+++ b/app/src/main/java/rocks/poopjournal/morse/PhrasebookAdapter.java
@@ -17,14 +17,15 @@
public class PhrasebookAdapter extends RecyclerView.Adapter {
+ DBHelper helper;
private Context context;
private ArrayList list = new ArrayList<>();
- DBHelper helper;
- public PhrasebookAdapter(Context context, DBHelper helper){
+ public PhrasebookAdapter(Context context, DBHelper helper) {
this.context = context;
this.helper = helper;
}
+
// Overrides
@NonNull
@Override
@@ -56,14 +57,23 @@ public int getItemCount() {
}
- public void setPhrasebookList(ArrayList list){
- if (list==null || list.size()==0)
+ public void setPhrasebookList(ArrayList list) {
+ if (list == null || list.size() == 0)
return;
this.list = list;
notifyDataSetChanged();
}
+
+ public void deleteItem(int position) {
+ Log.d("gotcalled", "true" + list.get(position).id);
+ helper.deleteNote(list.get(position).id);
+ list.remove(position);
+ notifyItemRemoved(position);
+ Toast.makeText(context, "Deleted entry", Toast.LENGTH_SHORT).show();
+ }
+
// View Holders
public static class ClientViewHolder extends RecyclerView.ViewHolder {
@@ -78,12 +88,4 @@ public ClientViewHolder(View itemView) {
}
}
- public void deleteItem(int position) {
- Log.d("gotcalled","true" + list.get(position).id);
- helper.deleteNote(list.get(position).id);
- list.remove(position);
- notifyItemRemoved(position);
- Toast.makeText(context,"Deleted entry",Toast.LENGTH_SHORT).show();
- }
-
-}
\ No newline at end of file
+}
diff --git a/app/src/main/java/rocks/poopjournal/morse/PhrasebookModel.java b/app/src/main/java/rocks/poopjournal/morse/PhrasebookModel.java
index c422cfe..c475383 100644
--- a/app/src/main/java/rocks/poopjournal/morse/PhrasebookModel.java
+++ b/app/src/main/java/rocks/poopjournal/morse/PhrasebookModel.java
@@ -1,9 +1,9 @@
package rocks.poopjournal.morse;
public class PhrasebookModel {
- int id;
public String text;
public String morse;
+ int id;
public PhrasebookModel(int id, String text, String morse) {
this.id = id;
diff --git a/app/src/main/java/rocks/poopjournal/morse/SwipeToDeleteCallback.java b/app/src/main/java/rocks/poopjournal/morse/SwipeToDeleteCallback.java
index 2adaad9..82df7af 100644
--- a/app/src/main/java/rocks/poopjournal/morse/SwipeToDeleteCallback.java
+++ b/app/src/main/java/rocks/poopjournal/morse/SwipeToDeleteCallback.java
@@ -4,23 +4,18 @@
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
-import android.graphics.drawable.GradientDrawable;
import android.view.View;
-import android.widget.RelativeLayout;
import androidx.annotation.NonNull;
-import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.ItemTouchHelper;
import androidx.recyclerview.widget.RecyclerView;
-import static androidx.recyclerview.widget.ItemTouchHelper.ACTION_STATE_DRAG;
-import static androidx.recyclerview.widget.ItemTouchHelper.ACTION_STATE_IDLE;
-
public class SwipeToDeleteCallback extends ItemTouchHelper.SimpleCallback {
+ private final ColorDrawable background;
private PhrasebookAdapter mAdapter;
private Drawable icon;
- private final ColorDrawable background;
+
public SwipeToDeleteCallback(PhrasebookAdapter adapter) {
super(0, ItemTouchHelper.LEFT);
mAdapter = adapter;
@@ -44,9 +39,6 @@ public void onSwiped(@NonNull RecyclerView.ViewHolder viewHolder, int direction)
}
-
-
-
@Override
public void onChildDraw(Canvas c, RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder, float dX, float dY, int actionState, boolean isCurrentlyActive) {
super.onChildDraw(c, recyclerView, viewHolder, dX,
@@ -80,4 +72,4 @@ public void onChildDraw(Canvas c, RecyclerView recyclerView, RecyclerView.ViewHo
background.draw(c);
icon.draw(c);
}
-}
\ No newline at end of file
+}
diff --git a/app/src/main/res/drawable-v24/continue_btn_success.xml b/app/src/main/res/drawable-v24/continue_btn_success.xml
index 9074c74..dedc6fb 100644
--- a/app/src/main/res/drawable-v24/continue_btn_success.xml
+++ b/app/src/main/res/drawable-v24/continue_btn_success.xml
@@ -2,7 +2,8 @@
-
-
+
+
diff --git a/app/src/main/res/drawable-v24/continue_shopping_button.xml b/app/src/main/res/drawable-v24/continue_shopping_button.xml
index ff50e3d..f45e6a0 100644
--- a/app/src/main/res/drawable-v24/continue_shopping_button.xml
+++ b/app/src/main/res/drawable-v24/continue_shopping_button.xml
@@ -2,5 +2,5 @@
-
+
diff --git a/app/src/main/res/drawable/background_icons.xml b/app/src/main/res/drawable/background_icons.xml
index ca512ee..2edf9db 100644
--- a/app/src/main/res/drawable/background_icons.xml
+++ b/app/src/main/res/drawable/background_icons.xml
@@ -1,9 +1,6 @@
-
-
-
-
\ No newline at end of file
+
+
+
+
diff --git a/app/src/main/res/drawable/background_ring.xml b/app/src/main/res/drawable/background_ring.xml
index 5953f6f..918216a 100644
--- a/app/src/main/res/drawable/background_ring.xml
+++ b/app/src/main/res/drawable/background_ring.xml
@@ -1,10 +1,8 @@
-
-
+
+
-
\ No newline at end of file
+ android:height="36dp" />
+
diff --git a/app/src/main/res/drawable/backspace.xml b/app/src/main/res/drawable/backspace.xml
index 27c9760..e3fe668 100644
--- a/app/src/main/res/drawable/backspace.xml
+++ b/app/src/main/res/drawable/backspace.xml
@@ -3,7 +3,7 @@
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
-
+
diff --git a/app/src/main/res/drawable/bg_bottom_suggestion.xml b/app/src/main/res/drawable/bg_bottom_suggestion.xml
index c94d576..fd12c47 100644
--- a/app/src/main/res/drawable/bg_bottom_suggestion.xml
+++ b/app/src/main/res/drawable/bg_bottom_suggestion.xml
@@ -1,13 +1,11 @@
-
+
-
+
-
\ No newline at end of file
+ android:width="0.5dp"
+ android:color="#1E2129" />
+
diff --git a/app/src/main/res/drawable/bg_item_swipe.xml b/app/src/main/res/drawable/bg_item_swipe.xml
index 3a75744..f705d7b 100644
--- a/app/src/main/res/drawable/bg_item_swipe.xml
+++ b/app/src/main/res/drawable/bg_item_swipe.xml
@@ -1,8 +1,6 @@
-
-
-
-
\ No newline at end of file
+
+
+
+
diff --git a/app/src/main/res/drawable/bg_top_suggestion.xml b/app/src/main/res/drawable/bg_top_suggestion.xml
index 2469458..8aff939 100644
--- a/app/src/main/res/drawable/bg_top_suggestion.xml
+++ b/app/src/main/res/drawable/bg_top_suggestion.xml
@@ -1,13 +1,11 @@
-
+
-
+ android:topLeftRadius="8dp"
+ android:topRightRadius="8dp" />
+
-
\ No newline at end of file
+ android:width="0.5dp"
+ android:color="#1E2129" />
+
diff --git a/app/src/main/res/drawable/container_audio_copy.xml b/app/src/main/res/drawable/container_audio_copy.xml
index 834deb8..f50a114 100644
--- a/app/src/main/res/drawable/container_audio_copy.xml
+++ b/app/src/main/res/drawable/container_audio_copy.xml
@@ -1,12 +1,9 @@
-
-
-
+
+
+
-
\ No newline at end of file
+ android:height="36dp" />
+
diff --git a/app/src/main/res/drawable/copy.xml b/app/src/main/res/drawable/copy.xml
index e11b3d1..bc57178 100644
--- a/app/src/main/res/drawable/copy.xml
+++ b/app/src/main/res/drawable/copy.xml
@@ -3,7 +3,7 @@
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
-
+
diff --git a/app/src/main/res/drawable/et_morse.xml b/app/src/main/res/drawable/et_morse.xml
index df2f025..6555e53 100644
--- a/app/src/main/res/drawable/et_morse.xml
+++ b/app/src/main/res/drawable/et_morse.xml
@@ -1,12 +1,9 @@
-
-
-
+
+
+
-
\ No newline at end of file
+ android:width="0.5dp"
+ android:color="#1E2129" />
+
diff --git a/app/src/main/res/drawable/fullscreen.xml b/app/src/main/res/drawable/fullscreen.xml
index d450b4d..7cdba84 100644
--- a/app/src/main/res/drawable/fullscreen.xml
+++ b/app/src/main/res/drawable/fullscreen.xml
@@ -3,7 +3,7 @@
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
-
+
diff --git a/app/src/main/res/drawable/gradient_bg.xml b/app/src/main/res/drawable/gradient_bg.xml
index 5bcc122..0356619 100644
--- a/app/src/main/res/drawable/gradient_bg.xml
+++ b/app/src/main/res/drawable/gradient_bg.xml
@@ -2,11 +2,7 @@
-
-
+
-
\ No newline at end of file
+
diff --git a/app/src/main/res/drawable/ic_baseline_arrow_upward_24px.xml b/app/src/main/res/drawable/ic_baseline_arrow_upward_24px.xml
index d5974f6..0efbcd6 100644
--- a/app/src/main/res/drawable/ic_baseline_arrow_upward_24px.xml
+++ b/app/src/main/res/drawable/ic_baseline_arrow_upward_24px.xml
@@ -3,7 +3,7 @@
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
-
+
diff --git a/app/src/main/res/drawable/ic_delete_black_24dp.xml b/app/src/main/res/drawable/ic_delete_black_24dp.xml
index 39e64d6..962e033 100644
--- a/app/src/main/res/drawable/ic_delete_black_24dp.xml
+++ b/app/src/main/res/drawable/ic_delete_black_24dp.xml
@@ -1,9 +1,9 @@
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24.0"
+ android:viewportHeight="24.0">
+ android:pathData="M6,19c0,1.1 0.9,2 2,2h8c1.1,0 2,-0.9 2,-2V7H6v12zM19,4h-3.5l-1,-1h-5l-1,1H5v2h14V4z" />
diff --git a/app/src/main/res/drawable/ic_flare_24px.xml b/app/src/main/res/drawable/ic_flare_24px.xml
index b9d4243..e840049 100644
--- a/app/src/main/res/drawable/ic_flare_24px.xml
+++ b/app/src/main/res/drawable/ic_flare_24px.xml
@@ -3,7 +3,7 @@
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
-
+
diff --git a/app/src/main/res/drawable/ic_history.xml b/app/src/main/res/drawable/ic_history.xml
index 78f4105..5daa776 100644
--- a/app/src/main/res/drawable/ic_history.xml
+++ b/app/src/main/res/drawable/ic_history.xml
@@ -3,7 +3,7 @@
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
-
+
diff --git a/app/src/main/res/drawable/ic_launcher_background.xml b/app/src/main/res/drawable/ic_launcher_background.xml
index 2408e30..0d025f9 100644
--- a/app/src/main/res/drawable/ic_launcher_background.xml
+++ b/app/src/main/res/drawable/ic_launcher_background.xml
@@ -1,74 +1,170 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ android:viewportHeight="108">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/drawable/ic_mic.xml b/app/src/main/res/drawable/ic_mic.xml
index 3903ba5..59bbc14 100644
--- a/app/src/main/res/drawable/ic_mic.xml
+++ b/app/src/main/res/drawable/ic_mic.xml
@@ -3,7 +3,7 @@
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
-
+
diff --git a/app/src/main/res/drawable/ic_settings.xml b/app/src/main/res/drawable/ic_settings.xml
index 8a60832..5fdf17e 100644
--- a/app/src/main/res/drawable/ic_settings.xml
+++ b/app/src/main/res/drawable/ic_settings.xml
@@ -3,12 +3,12 @@
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
-
-
+
+
diff --git a/app/src/main/res/drawable/ic_star_black_24dp.xml b/app/src/main/res/drawable/ic_star_black_24dp.xml
index 01e5dfd..b9f8305 100644
--- a/app/src/main/res/drawable/ic_star_black_24dp.xml
+++ b/app/src/main/res/drawable/ic_star_black_24dp.xml
@@ -1,9 +1,9 @@
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24.0"
+ android:viewportHeight="24.0">
+ android:pathData="M12,17.27L18.18,21l-1.64,-7.03L22,9.24l-7.19,-0.61L12,2 9.19,8.63 2,9.24l5.46,4.73L5.82,21z" />
diff --git a/app/src/main/res/drawable/ic_star_border_black_24dp.xml b/app/src/main/res/drawable/ic_star_border_black_24dp.xml
index b36536b..c452e47 100644
--- a/app/src/main/res/drawable/ic_star_border_black_24dp.xml
+++ b/app/src/main/res/drawable/ic_star_border_black_24dp.xml
@@ -1,9 +1,9 @@
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24.0"
+ android:viewportHeight="24.0">
+ android:pathData="M22,9.24l-7.19,-0.62L12,2 9.19,8.63 2,9.24l5.46,4.73L5.82,21 12,17.27 18.18,21l-1.63,-7.03L22,9.24zM12,15.4l-3.76,2.27 1,-4.28 -3.32,-2.88 4.38,-0.38L12,6.1l1.71,4.04 4.38,0.38 -3.32,2.88 1,4.28L12,15.4z" />
diff --git a/app/src/main/res/drawable/ic_switch.xml b/app/src/main/res/drawable/ic_switch.xml
index 5917ba7..2e11e03 100644
--- a/app/src/main/res/drawable/ic_switch.xml
+++ b/app/src/main/res/drawable/ic_switch.xml
@@ -3,10 +3,10 @@
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
-
-
+
+
diff --git a/app/src/main/res/drawable/ic_torch.xml b/app/src/main/res/drawable/ic_torch.xml
index 019605c..b622736 100644
--- a/app/src/main/res/drawable/ic_torch.xml
+++ b/app/src/main/res/drawable/ic_torch.xml
@@ -3,14 +3,14 @@
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
-
-
-
+
+
+
diff --git a/app/src/main/res/drawable/input_dash.xml b/app/src/main/res/drawable/input_dash.xml
index 95c10c8..f27c534 100644
--- a/app/src/main/res/drawable/input_dash.xml
+++ b/app/src/main/res/drawable/input_dash.xml
@@ -1,10 +1,8 @@
-
+
-
-
\ No newline at end of file
+ android:height="6dp" />
+
+
diff --git a/app/src/main/res/drawable/input_dot.xml b/app/src/main/res/drawable/input_dot.xml
index 7c7fb2f..03452cb 100644
--- a/app/src/main/res/drawable/input_dot.xml
+++ b/app/src/main/res/drawable/input_dot.xml
@@ -1,10 +1,8 @@
-
-
+
+
-
\ No newline at end of file
+ android:height="16dp" />
+
diff --git a/app/src/main/res/drawable/mic.xml b/app/src/main/res/drawable/mic.xml
index 3903ba5..59bbc14 100644
--- a/app/src/main/res/drawable/mic.xml
+++ b/app/src/main/res/drawable/mic.xml
@@ -3,7 +3,7 @@
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
-
+
diff --git a/app/src/main/res/drawable/volume.xml b/app/src/main/res/drawable/volume.xml
index 981461a..bdd7aa6 100644
--- a/app/src/main/res/drawable/volume.xml
+++ b/app/src/main/res/drawable/volume.xml
@@ -3,7 +3,7 @@
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
-
+
diff --git a/app/src/main/res/layout-land/activity_main.xml b/app/src/main/res/layout-land/activity_main.xml
index 913413e..2c8887b 100644
--- a/app/src/main/res/layout-land/activity_main.xml
+++ b/app/src/main/res/layout-land/activity_main.xml
@@ -1,394 +1,425 @@
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:background="@color/colorBackground">
+ android:visibility="gone" />
+
+
+ android:src="@drawable/ic_history" />
-
-
-
+
+ />
+
+
-
+ android:layout_height="wrap_content"
+ android:layout_above="@id/bottomLayout"
+ android:layout_below="@id/topContainer">
-
-
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content">
+
-
- android:contentDescription="Switch Input"
+
-
-
-
+ android:layout_marginTop="10dp"
+ android:layout_marginBottom="10dp">
-
-
-
-
-
-
-
+
-
+
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
+
+
+
+
+ android:layout_below="@id/output"
+ android:layout_alignParentEnd="true"
+ android:layout_marginTop="10dp"
+ android:layout_marginEnd="20dp">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+ android:visibility="gone">
+
-
+ android:padding="45dp">
+
+
+
-
+ android:layout_height="wrap_content"
+ android:layout_marginStart="80dp"
+ android:layout_toEndOf="@id/inputDotContainer"
+ android:padding="45dp">
+
+
+
+ android:layout_height="80dp"
+ android:layout_alignParentBottom="true"
+ android:background="#292C33"
+ android:visibility="visible">
+
+ android:padding="8dp">
+
+ android:src="@drawable/fullscreen" />
+
+ android:padding="8dp">
+
+ android:layout_height="24dp"
+ android:contentDescription="Make keyboard for morse input visible"
+ android:src="@drawable/ic_baseline_arrow_upward_24px" />
-
+ android:layout_height="40dp"
+ android:layout_centerInParent="true"
+ android:background="@drawable/background_icons" />
+
+ android:padding="8dp">
+
+ android:src="@drawable/backspace" />
+
+ android:padding="8dp">
+
+ android:src="@drawable/mic" />
-
\ No newline at end of file
+
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index c36145a..2198a50 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -1,398 +1,423 @@
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:background="@color/colorBackground">
+ android:visibility="gone" />
+
+
+ android:layout_marginStart="20dp"
+ android:contentDescription="Open Phrasebook"
+ android:src="@drawable/ic_history" />
-
-
+
+
+
+
-
+ android:layout_below="@id/topContainer">
+
+
+
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
-
-
-
+ android:layout_below="@id/output"
+ android:layout_alignParentEnd="true"
+ android:layout_marginTop="10dp"
+ android:layout_marginEnd="20dp">
-
-
-
-
-
-
+
+
-
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+ android:visibility="gone">
+
-
+ android:padding="45dp">
+
+
+
-
+ android:layout_height="wrap_content"
+ android:layout_marginStart="80dp"
+ android:layout_toEndOf="@id/inputDotContainer"
+ android:padding="45dp">
+
+
+
+ android:layout_height="80dp"
+ android:layout_alignParentBottom="true"
+ android:background="#292C33"
+ android:visibility="visible">
+
+ android:padding="8dp">
+
+ android:contentDescription="full screen"
+ android:src="@drawable/fullscreen" />
+
+ android:padding="8dp">
+
+ android:contentDescription="Make keyboard for morse input visible"
+ android:src="@drawable/ic_baseline_arrow_upward_24px" />
-
+ android:layout_height="40dp"
+ android:layout_centerInParent="true"
+ android:background="@drawable/background_icons" />
+
+ android:padding="8dp">
+
+ android:contentDescription="Clear input"
+ android:src="@drawable/backspace" />
+
+ android:padding="8dp">
+
+ android:contentDescription="Mic"
+ android:src="@drawable/mic" />
-
\ No newline at end of file
+
diff --git a/app/src/main/res/layout/activity_phrasebook.xml b/app/src/main/res/layout/activity_phrasebook.xml
index c75d78d..bcc366f 100644
--- a/app/src/main/res/layout/activity_phrasebook.xml
+++ b/app/src/main/res/layout/activity_phrasebook.xml
@@ -1,43 +1,44 @@
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:background="@color/colorBackground">
+ android:layout_height="wrap_content"
+ android:layout_marginTop="25dp">
-
+
-
+
-
\ No newline at end of file
+ android:layout_height="match_parent"
+ android:layout_below="@id/topcontainer"
+ android:layout_marginTop="25dp" />
+
diff --git a/app/src/main/res/layout/dialog_verification.xml b/app/src/main/res/layout/dialog_verification.xml
index ea0a1fa..6a8522f 100644
--- a/app/src/main/res/layout/dialog_verification.xml
+++ b/app/src/main/res/layout/dialog_verification.xml
@@ -1,96 +1,94 @@
+ android:background="@color/colorBackground">
-
-
+ android:layout_height="wrap_content">
+
+
-
+ android:text="Do you mean --...--?"
+ android:textColor="@color/colorMorse"
+ android:textSize="22sp" />
-
+
-
-
+
+
-
-
+
+
-
\ No newline at end of file
+
diff --git a/app/src/main/res/layout/item_list_phrasebook.xml b/app/src/main/res/layout/item_list_phrasebook.xml
index 613be45..eda7d69 100644
--- a/app/src/main/res/layout/item_list_phrasebook.xml
+++ b/app/src/main/res/layout/item_list_phrasebook.xml
@@ -1,30 +1,31 @@
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="20dp"
+ android:background="@drawable/bg_item_swipe">
+ android:textColor="#FFFFFF"
+ android:textSize="15sp"
+ android:textStyle="italic" />
-
\ No newline at end of file
+ android:textColor="#FFFFFF"
+ android:textSize="20sp" />
+
diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
index c4a603d..3ba4e35 100644
--- a/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
+++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
@@ -1,5 +1,5 @@
-
-
-
\ No newline at end of file
+
+
+
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 c4a603d..3ba4e35 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
@@ -1,5 +1,5 @@
-
-
-
\ No newline at end of file
+
+
+
diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml
index 9cd9680..2b5de8c 100644
--- a/app/src/main/res/values/colors.xml
+++ b/app/src/main/res/values/colors.xml
@@ -9,10 +9,10 @@
#252830
#282B34
- #8f000000
+ #8f000000
- #323643
+ #323643
- #FF9B9B9B
+ #FF9B9B9B
#7DD3D8
diff --git a/app/src/test/java/rocks/poopjournal/morse/ExampleUnitTest.java b/app/src/test/java/rocks/poopjournal/morse/ExampleUnitTest.java
deleted file mode 100644
index 5c23220..0000000
--- a/app/src/test/java/rocks/poopjournal/morse/ExampleUnitTest.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package rocks.poopjournal.morse;
-
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-/**
- * Example local unit test, which will execute on the development machine (host).
- *
- * @see Testing documentation
- */
-public class ExampleUnitTest {
- @Test
- public void addition_isCorrect() {
- assertEquals(4, 2 + 2);
- }
-}
\ No newline at end of file
diff --git a/build.gradle b/build.gradle
index a5bb815..6b80ead 100644
--- a/build.gradle
+++ b/build.gradle
@@ -4,11 +4,10 @@ buildscript {
repositories {
google()
jcenter()
-
}
dependencies {
- classpath 'com.android.tools.build:gradle:3.5.3'
-
+ classpath 'com.android.tools.build:gradle:3.6.3'
+
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
@@ -18,7 +17,6 @@ allprojects {
repositories {
google()
jcenter()
-
}
}
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
index f6b961f..490fda8 100644
Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index b599acb..6623300 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,5 @@
-#Sun Oct 06 21:04:14 PKT 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.1-all.zip
diff --git a/gradlew b/gradlew
index cccdd3d..2fe81a7 100644
--- a/gradlew
+++ b/gradlew
@@ -1,5 +1,21 @@
#!/usr/bin/env sh
+#
+# Copyright 2015 the original author or authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
##############################################################################
##
## Gradle start up script for UN*X
@@ -28,7 +44,7 @@ APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-DEFAULT_JVM_OPTS=""
+DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
@@ -109,8 +125,8 @@ if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
-# For Cygwin, switch paths to Windows format before running java
-if $cygwin ; then
+# For Cygwin or MSYS, switch paths to Windows format before running java
+if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
@@ -138,19 +154,19 @@ if $cygwin ; then
else
eval `echo args$i`="\"$arg\""
fi
- i=$((i+1))
+ i=`expr $i + 1`
done
case $i in
- (0) set -- ;;
- (1) set -- "$args0" ;;
- (2) set -- "$args0" "$args1" ;;
- (3) set -- "$args0" "$args1" "$args2" ;;
- (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
- (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
- (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
- (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
- (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
- (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+ 0) set -- ;;
+ 1) set -- "$args0" ;;
+ 2) set -- "$args0" "$args1" ;;
+ 3) set -- "$args0" "$args1" "$args2" ;;
+ 4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+ 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+ 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+ 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+ 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+ 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
@@ -159,14 +175,9 @@ save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
-APP_ARGS=$(save "$@")
+APP_ARGS=`save "$@"`
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
-# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
-if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
- cd "$(dirname "$0")"
-fi
-
exec "$JAVACMD" "$@"
diff --git a/gradlew.bat b/gradlew.bat
index f955316..62bd9b9 100644
--- a/gradlew.bat
+++ b/gradlew.bat
@@ -1,3 +1,19 @@
+@rem
+@rem Copyright 2015 the original author or authors.
+@rem
+@rem Licensed under the Apache License, Version 2.0 (the "License");
+@rem you may not use this file except in compliance with the License.
+@rem You may obtain a copy of the License at
+@rem
+@rem https://www.apache.org/licenses/LICENSE-2.0
+@rem
+@rem Unless required by applicable law or agreed to in writing, software
+@rem distributed under the License is distributed on an "AS IS" BASIS,
+@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+@rem See the License for the specific language governing permissions and
+@rem limitations under the License.
+@rem
+
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@@ -13,8 +29,11 @@ if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
+@rem Resolve any "." and ".." in APP_HOME to make it shorter.
+for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
+
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-set DEFAULT_JVM_OPTS=
+set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome