diff --git a/.gitignore b/.gitignore index ef21e5d..0eabe3d 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,5 @@ local.properties app/release /.idea/inspectionProfiles/Project_Default.xml +/.idea/deploymentTargetSelector.xml +/.idea/studiobot.xml diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 3c90c5b..08b5324 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -16,7 +16,7 @@ android:theme="@style/Theme.Android101"> diff --git a/app/src/main/java/uk/kagurach/android101/MainActivity.java b/app/src/main/java/uk/kagurach/android101/MainActivity.java index 691c7d7..15707d5 100644 --- a/app/src/main/java/uk/kagurach/android101/MainActivity.java +++ b/app/src/main/java/uk/kagurach/android101/MainActivity.java @@ -25,6 +25,8 @@ import androidx.core.view.WindowInsetsCompat; import java.util.Arrays; +import uk.kagurach.android101.helper.PageHelper; + public class MainActivity extends AppCompatActivity { PageHelper pageHelper; diff --git a/app/src/main/java/uk/kagurach/android101/MainActivity2.java b/app/src/main/java/uk/kagurach/android101/MainActivity2.java index eb47bef..d5b4b03 100644 --- a/app/src/main/java/uk/kagurach/android101/MainActivity2.java +++ b/app/src/main/java/uk/kagurach/android101/MainActivity2.java @@ -4,7 +4,6 @@ import android.annotation.SuppressLint; import android.content.Context; import android.graphics.Color; import android.os.Bundle; -import android.os.IBinder; import android.util.TypedValue; import android.view.MotionEvent; import android.view.View; @@ -21,7 +20,9 @@ import androidx.appcompat.app.AppCompatActivity; import androidx.core.graphics.Insets; import androidx.core.view.ViewCompat; import androidx.core.view.WindowInsetsCompat; -import androidx.room.util.StringUtil; + +import uk.kagurach.android101.helper.PageHelper; +import uk.kagurach.android101.helper.ToastHelper; public class MainActivity2 extends AppCompatActivity { diff --git a/app/src/main/java/uk/kagurach/android101/Page3.java b/app/src/main/java/uk/kagurach/android101/Page3.java index 8abb09c..bbf10df 100644 --- a/app/src/main/java/uk/kagurach/android101/Page3.java +++ b/app/src/main/java/uk/kagurach/android101/Page3.java @@ -1,6 +1,6 @@ package uk.kagurach.android101; -import static uk.kagurach.android101.KaculateKt.Kaculate; +import static uk.kagurach.android101.misc.KaculateKt.Kaculate; import android.os.Bundle; import android.view.View; @@ -14,6 +14,8 @@ import androidx.core.graphics.Insets; import androidx.core.view.ViewCompat; import androidx.core.view.WindowInsetsCompat; +import uk.kagurach.android101.helper.PageHelper; + public class Page3 extends AppCompatActivity { PageHelper pageHelper; diff --git a/app/src/main/java/uk/kagurach/android101/Page4.java b/app/src/main/java/uk/kagurach/android101/Page4.java index 5885318..78c5152 100644 --- a/app/src/main/java/uk/kagurach/android101/Page4.java +++ b/app/src/main/java/uk/kagurach/android101/Page4.java @@ -19,7 +19,8 @@ import androidx.core.graphics.Insets; import androidx.core.view.ViewCompat; import androidx.core.view.WindowInsetsCompat; -import uk.kagurach.android101.vibrationBroadcastReceiver.vibrationBroadcastReceiver; +import uk.kagurach.android101.helper.PageHelper; +import uk.kagurach.android101.misc.vibrationBroadcastReceiver.vibrationBroadcastReceiver; public class Page4 extends AppCompatActivity { diff --git a/app/src/main/java/uk/kagurach/android101/Page4OtherActivity.java b/app/src/main/java/uk/kagurach/android101/Page4OtherActivity.java index 302665b..d30d035 100644 --- a/app/src/main/java/uk/kagurach/android101/Page4OtherActivity.java +++ b/app/src/main/java/uk/kagurach/android101/Page4OtherActivity.java @@ -8,6 +8,8 @@ import android.util.Log; import androidx.appcompat.app.AppCompatActivity; +import uk.kagurach.android101.helper.ToastHelper; + public class Page4OtherActivity extends AppCompatActivity { @Override diff --git a/app/src/main/java/uk/kagurach/android101/Page5.java b/app/src/main/java/uk/kagurach/android101/Page5.java index c2f18c1..dfa70a7 100644 --- a/app/src/main/java/uk/kagurach/android101/Page5.java +++ b/app/src/main/java/uk/kagurach/android101/Page5.java @@ -21,7 +21,9 @@ import java.io.IOException; import java.util.Objects; import chatgpt.AnimalDatabaseHelper; -import uk.kagurach.android101.misc.AutoCompleHelper.AnimalTypeAutoCompleteHelper; +import uk.kagurach.android101.helper.PageHelper; +import uk.kagurach.android101.helper.ToastHelper; +import uk.kagurach.android101.helper.AutoCompleHelper.AnimalTypeAutoCompleteHelper; public class Page5 extends AppCompatActivity { diff --git a/app/src/main/java/uk/kagurach/android101/misc/AutoCompleHelper/AbstractAutoCompleteHelper.java b/app/src/main/java/uk/kagurach/android101/helper/AutoCompleHelper/AbstractAutoCompleteHelper.java similarity index 98% rename from app/src/main/java/uk/kagurach/android101/misc/AutoCompleHelper/AbstractAutoCompleteHelper.java rename to app/src/main/java/uk/kagurach/android101/helper/AutoCompleHelper/AbstractAutoCompleteHelper.java index 598a96c..decbfe1 100644 --- a/app/src/main/java/uk/kagurach/android101/misc/AutoCompleHelper/AbstractAutoCompleteHelper.java +++ b/app/src/main/java/uk/kagurach/android101/helper/AutoCompleHelper/AbstractAutoCompleteHelper.java @@ -1,4 +1,4 @@ -package uk.kagurach.android101.misc.AutoCompleHelper; +package uk.kagurach.android101.helper.AutoCompleHelper; import android.content.Context; import android.widget.ArrayAdapter; diff --git a/app/src/main/java/uk/kagurach/android101/misc/AutoCompleHelper/AnimalTypeAutoCompleteHelper.java b/app/src/main/java/uk/kagurach/android101/helper/AutoCompleHelper/AnimalTypeAutoCompleteHelper.java similarity index 95% rename from app/src/main/java/uk/kagurach/android101/misc/AutoCompleHelper/AnimalTypeAutoCompleteHelper.java rename to app/src/main/java/uk/kagurach/android101/helper/AutoCompleHelper/AnimalTypeAutoCompleteHelper.java index 3be1d23..2a32b37 100644 --- a/app/src/main/java/uk/kagurach/android101/misc/AutoCompleHelper/AnimalTypeAutoCompleteHelper.java +++ b/app/src/main/java/uk/kagurach/android101/helper/AutoCompleHelper/AnimalTypeAutoCompleteHelper.java @@ -1,4 +1,4 @@ -package uk.kagurach.android101.misc.AutoCompleHelper; +package uk.kagurach.android101.helper.AutoCompleHelper; import android.content.Context; import android.widget.ArrayAdapter; diff --git a/app/src/main/java/uk/kagurach/android101/PageHelper.java b/app/src/main/java/uk/kagurach/android101/helper/PageHelper.java similarity index 92% rename from app/src/main/java/uk/kagurach/android101/PageHelper.java rename to app/src/main/java/uk/kagurach/android101/helper/PageHelper.java index 75f8515..2292b5b 100644 --- a/app/src/main/java/uk/kagurach/android101/PageHelper.java +++ b/app/src/main/java/uk/kagurach/android101/helper/PageHelper.java @@ -1,4 +1,4 @@ -package uk.kagurach.android101; +package uk.kagurach.android101.helper; import static androidx.core.content.ContextCompat.startActivity; @@ -16,14 +16,14 @@ public class PageHelper { private final Class _next; private Activity _activity = null; - PageHelper(Context curr, Class prev, Class next) { + public PageHelper(Context curr, Class prev, Class next) { _curr = curr; _prev = prev; _next = next; } - PageHelper(Context curr, Class prev, Class next, Activity activity) { + public PageHelper(Context curr, Class prev, Class next, Activity activity) { _curr = curr; _prev = prev; _next = next; diff --git a/app/src/main/java/uk/kagurach/android101/ToastHelper.kt b/app/src/main/java/uk/kagurach/android101/helper/ToastHelper.kt similarity index 94% rename from app/src/main/java/uk/kagurach/android101/ToastHelper.kt rename to app/src/main/java/uk/kagurach/android101/helper/ToastHelper.kt index 6d9ca6b..10505bb 100644 --- a/app/src/main/java/uk/kagurach/android101/ToastHelper.kt +++ b/app/src/main/java/uk/kagurach/android101/helper/ToastHelper.kt @@ -1,4 +1,4 @@ -package uk.kagurach.android101 +package uk.kagurach.android101.helper import android.content.Context import android.widget.Toast diff --git a/app/src/main/java/uk/kagurach/android101/Kaculate.kt b/app/src/main/java/uk/kagurach/android101/misc/Kaculate.kt similarity index 92% rename from app/src/main/java/uk/kagurach/android101/Kaculate.kt rename to app/src/main/java/uk/kagurach/android101/misc/Kaculate.kt index de3d0aa..dac3337 100644 --- a/app/src/main/java/uk/kagurach/android101/Kaculate.kt +++ b/app/src/main/java/uk/kagurach/android101/misc/Kaculate.kt @@ -1,6 +1,7 @@ -package uk.kagurach.android101 +package uk.kagurach.android101.misc import android.content.Context +import uk.kagurach.android101.helper.ToastHelper import kotlin.math.pow fun Kaculate(src: String, ctx: Context): String { @@ -14,6 +15,13 @@ fun Kaculate(src: String, ctx: Context): String { var _curnum = "" + // Fix for expression starts with operator + val src = if (src[0] in OpList){ + "0" + src + }else{ + src + } + for (i in src.indices) { if (src[i] in '0'..'9' || src[i] == '.') { _curnum += src[i] diff --git a/app/src/main/java/uk/kagurach/android101/vibrationBroadcastReceiver/vibrationBroadcastReceiver.java b/app/src/main/java/uk/kagurach/android101/misc/vibrationBroadcastReceiver/vibrationBroadcastReceiver.java similarity index 93% rename from app/src/main/java/uk/kagurach/android101/vibrationBroadcastReceiver/vibrationBroadcastReceiver.java rename to app/src/main/java/uk/kagurach/android101/misc/vibrationBroadcastReceiver/vibrationBroadcastReceiver.java index 9330be8..53dbae0 100644 --- a/app/src/main/java/uk/kagurach/android101/vibrationBroadcastReceiver/vibrationBroadcastReceiver.java +++ b/app/src/main/java/uk/kagurach/android101/misc/vibrationBroadcastReceiver/vibrationBroadcastReceiver.java @@ -1,4 +1,4 @@ -package uk.kagurach.android101.vibrationBroadcastReceiver; +package uk.kagurach.android101.misc.vibrationBroadcastReceiver; import android.content.BroadcastReceiver; import android.content.Context;