diff --git a/app/build.gradle b/app/build.gradle index 05fc98f..7355a2d 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -9,8 +9,8 @@ android { applicationId "com.verNANDo57.rulebook_educational" minSdkVersion 22 targetSdk 32 - versionCode 116 - versionName '1.1.6' + versionCode 117 + versionName '1.1.7' multiDexEnabled true } diff --git a/app/src/main/java/com/verNANDo57/rulebook_educational/BottomNavAmongActivitiesFragment.java b/app/src/main/java/com/verNANDo57/rulebook_educational/BottomNavAmongActivitiesFragment.java index afe0a62..6854518 100755 --- a/app/src/main/java/com/verNANDo57/rulebook_educational/BottomNavAmongActivitiesFragment.java +++ b/app/src/main/java/com/verNANDo57/rulebook_educational/BottomNavAmongActivitiesFragment.java @@ -66,4 +66,4 @@ public View onCreateView(LayoutInflater inflater , ViewGroup container, Bundle s }); return viewFragment; } -} +} \ No newline at end of file diff --git a/app/src/main/java/com/verNANDo57/rulebook_educational/app/CustomThemeEngineAppCompatActivity.java b/app/src/main/java/com/verNANDo57/rulebook_educational/app/CustomThemeEngineAppCompatActivity.java index d0e2edc..428dfe5 100644 --- a/app/src/main/java/com/verNANDo57/rulebook_educational/app/CustomThemeEngineAppCompatActivity.java +++ b/app/src/main/java/com/verNANDo57/rulebook_educational/app/CustomThemeEngineAppCompatActivity.java @@ -13,6 +13,7 @@ import android.view.View; import android.view.WindowManager; +import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; import androidx.core.content.ContextCompat; @@ -52,7 +53,7 @@ protected void onCreate (Bundle savedInstanceState) { } @Override - public boolean onCreateOptionsMenu(Menu menu) { + public boolean onCreateOptionsMenu(@NonNull Menu menu) { return super.onCreateOptionsMenu(menu); } diff --git a/app/src/main/java/com/verNANDo57/rulebook_educational/app/CustomThemeEngineFragmentActivity.java b/app/src/main/java/com/verNANDo57/rulebook_educational/app/CustomThemeEngineFragmentActivity.java index 310552a..b071e16 100644 --- a/app/src/main/java/com/verNANDo57/rulebook_educational/app/CustomThemeEngineFragmentActivity.java +++ b/app/src/main/java/com/verNANDo57/rulebook_educational/app/CustomThemeEngineFragmentActivity.java @@ -13,6 +13,7 @@ import android.view.View; import android.view.WindowManager; +import androidx.annotation.NonNull; import androidx.core.content.ContextCompat; import androidx.fragment.app.FragmentActivity; @@ -51,7 +52,7 @@ protected void onCreate (Bundle savedInstanceState) { } @Override - public boolean onCreateOptionsMenu(Menu menu) { + public boolean onCreateOptionsMenu(@NonNull Menu menu) { return super.onCreateOptionsMenu(menu); } diff --git a/app/src/main/java/com/verNANDo57/rulebook_educational/preferences/AppSettingsFragment.java b/app/src/main/java/com/verNANDo57/rulebook_educational/preferences/AppSettingsFragment.java index ef7cce9..38ceb52 100755 --- a/app/src/main/java/com/verNANDo57/rulebook_educational/preferences/AppSettingsFragment.java +++ b/app/src/main/java/com/verNANDo57/rulebook_educational/preferences/AppSettingsFragment.java @@ -85,7 +85,7 @@ public void onClick(DialogInterface dialogInterface, int i) { builder.setIcon(AppCompatResources.getDrawable(requireContext(), R.drawable.app_themeengine_icon)); builder.create(); builder.show(); - return false; + return true; } }); @@ -96,14 +96,14 @@ public void onClick(DialogInterface dialogInterface, int i) { @Override public boolean onPreferenceChange(@NonNull Preference preference, Object newValue) { preferences.setRulebookStatusBarBooleanState(newValue.toString().equals("true")); - return false; + return true; } }); // Functionality androidx.preference.SwitchPreferenceCompat use_sdcard_pref = findPreference(PreferenceKeys.USE_SDCARD_PREF); assert use_sdcard_pref != null; - if (!AppUtils.checkIfSDCardExists()) { + if (!AppUtils.checkIfSDCardExists(requireContext())) { use_sdcard_pref.setEnabled(false); preferences.setRulebookUseSDCardBooleanState(false); } @@ -112,7 +112,7 @@ public boolean onPreferenceChange(@NonNull Preference preference, Object newValu @Override public boolean onPreferenceChange(@NonNull Preference preference, Object newValue) { preferences.setRulebookUseSDCardBooleanState(newValue.toString().equals("true")); - return false; + return true; } }); @@ -129,7 +129,7 @@ public boolean onPreferenceClick(@NonNull Preference preference) { @Override public void onClick(DialogInterface dialog, int which) { AppUtils.removeFolderRecursive(new File(AppUtils.getStorageAbsolutePath(requireContext(), false) + Constants.RULEBOOK_APP_DIRECTORY)); - if (AppUtils.checkIfSDCardExists()) { + if (AppUtils.checkIfSDCardExists(requireContext())) { AppUtils.removeFolderRecursive(new File(AppUtils.getStorageAbsolutePath(requireContext(), true) + Constants.RULEBOOK_APP_DIRECTORY)); } } @@ -142,8 +142,8 @@ public void onClick(DialogInterface dialog, int which) { }); androidx.appcompat.app.AlertDialog alert = builder.create(); alert.show(); - return false; + return true; } }); } -} +} \ No newline at end of file diff --git a/app/src/main/java/com/verNANDo57/rulebook_educational/rules/AppBaseScrollableActivity.java b/app/src/main/java/com/verNANDo57/rulebook_educational/rules/AppBaseScrollableActivity.java index aff2290..36bc26e 100644 --- a/app/src/main/java/com/verNANDo57/rulebook_educational/rules/AppBaseScrollableActivity.java +++ b/app/src/main/java/com/verNANDo57/rulebook_educational/rules/AppBaseScrollableActivity.java @@ -388,4 +388,4 @@ private void shareFile() throws IOException { exportRuleFile.getAbsoluteFile().delete(); }); } -} +} \ No newline at end of file diff --git a/app/src/main/java/com/verNANDo57/rulebook_educational/rules/AppLexiconActivity.java b/app/src/main/java/com/verNANDo57/rulebook_educational/rules/AppLexiconActivity.java index a238f29..5c32f2d 100644 --- a/app/src/main/java/com/verNANDo57/rulebook_educational/rules/AppLexiconActivity.java +++ b/app/src/main/java/com/verNANDo57/rulebook_educational/rules/AppLexiconActivity.java @@ -34,6 +34,7 @@ public void onCreate(Bundle savedInstanceState) toolbar_pdfview = findViewById(R.id.toolbar_pdfview); setSupportActionBar(toolbar_pdfview); + toolbar_pdfview.setTitle(getResources().getString(R.string.lexicon_rules)); toolbar_pdfview.setNavigationOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { diff --git a/app/src/main/java/com/verNANDo57/rulebook_educational/rules/AppRulesInSchemesAndTablesActivity.java b/app/src/main/java/com/verNANDo57/rulebook_educational/rules/AppRulesInSchemesAndTablesActivity.java index 3bcd3d1..ee51c39 100644 --- a/app/src/main/java/com/verNANDo57/rulebook_educational/rules/AppRulesInSchemesAndTablesActivity.java +++ b/app/src/main/java/com/verNANDo57/rulebook_educational/rules/AppRulesInSchemesAndTablesActivity.java @@ -34,6 +34,7 @@ public void onCreate(Bundle savedInstanceState) toolbar_pdfview = findViewById(R.id.toolbar_pdfview); setSupportActionBar(toolbar_pdfview); + toolbar_pdfview.setTitle(getResources().getString(R.string.tables_and_schemes_rules)); toolbar_pdfview.setNavigationOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { diff --git a/app/src/main/java/com/verNANDo57/rulebook_educational/utils/AppUtils.java b/app/src/main/java/com/verNANDo57/rulebook_educational/utils/AppUtils.java index d4030d2..e0cf56e 100644 --- a/app/src/main/java/com/verNANDo57/rulebook_educational/utils/AppUtils.java +++ b/app/src/main/java/com/verNANDo57/rulebook_educational/utils/AppUtils.java @@ -11,7 +11,6 @@ import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.drawable.Drawable; -import android.os.Environment; import android.text.Spannable; import android.text.SpannableString; import android.text.style.BackgroundColorSpan; @@ -26,6 +25,7 @@ import android.widget.TextView; import androidx.annotation.AnimRes; +import androidx.core.content.ContextCompat; import com.google.android.material.snackbar.Snackbar; import com.verNANDo57.rulebook_educational.extradata.R; @@ -51,7 +51,6 @@ public class AppUtils { public static String LOG_TAG = "RULEBOOK_APP"; public static String EXTRA_DATA_KEY = "rule_key"; - public static String EXTRA_DATA_POSITION = "rule_position"; public static String EXTRA_DATA_TITLE = "rule_title"; public static String EXTRA_DATA_SUMMARY = "rule_summary"; @@ -173,7 +172,7 @@ public static String getStorageAbsolutePath(Context context, boolean useSDCard) int slashCount; // Firstly, check if SDCard exist, to avoid issues - if (checkIfSDCardExists() && useSDCard) { + if (checkIfSDCardExists(context) && useSDCard) { // Use SDCard if user wants to outputStorage = new StringBuilder(dirs[1].getAbsolutePath()); slashCount = 2; @@ -197,8 +196,17 @@ public static String getStorageAbsolutePath(Context context, boolean useSDCard) } /* Using this function we can check, if SDCard is inserted */ - public static boolean checkIfSDCardExists() { - return Environment.isExternalStorageRemovable() && Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED); + public static boolean checkIfSDCardExists(Context context) { + //return Environment.isExternalStorageRemovable() && Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED); + if (ContextCompat.getExternalFilesDirs(context, null).length >= 2) { + File[] f = ContextCompat.getExternalFilesDirs(context, null); + for (int i = 0; i < f.length; i++) { + if(f[i]!=null && i ==1) { + return true; + } + } + } + return false; } /* Using this function we can remove all files inside one folder */ @@ -441,4 +449,4 @@ public static Bitmap getBitmapFromView(Context context, View view, int height, i view.draw(canvas); return bitmap; } -} +} \ No newline at end of file diff --git a/app/src/main/java/com/verNANDo57/rulebook_educational/utils/ColorUtils.java b/app/src/main/java/com/verNANDo57/rulebook_educational/utils/ColorUtils.java index 8bcea1e..bdde505 100644 --- a/app/src/main/java/com/verNANDo57/rulebook_educational/utils/ColorUtils.java +++ b/app/src/main/java/com/verNANDo57/rulebook_educational/utils/ColorUtils.java @@ -11,6 +11,8 @@ import androidx.annotation.NonNull; import java.text.DecimalFormat; +import java.text.DecimalFormatSymbols; +import java.util.Locale; public final class ColorUtils { @@ -188,11 +190,14 @@ public static int parseColor(String colorString) { */ public static float[] createColorMatrixFromHex(int colorFromResource) { String hex = Integer.toHexString(colorFromResource); - - float a = Float.parseFloat(new DecimalFormat("#.##").format(Integer.parseInt(hex.substring(0, 2), 16) / 255.0f)); // Alpha (Transparency in percents) [First Two - float r = Float.parseFloat(new DecimalFormat("#.##").format(Integer.parseInt(hex.substring(2, 4), 16) / 255.0f)); // Red - float g = Float.parseFloat(new DecimalFormat("#.##").format(Integer.parseInt(hex.substring(4, 6), 16) / 255.0f)); // Green - float b = Float.parseFloat(new DecimalFormat("#.##").format(Integer.parseInt(hex.substring(6, 8), 16) / 255.0f)); // Blue + // Use this to avoid WrongFormat-related issues + // Caused by: java.lang.NumberFormatException: For input string: "0,94" + DecimalFormatSymbols symbols = new DecimalFormatSymbols(Locale.ENGLISH); + + float a = Float.parseFloat(new DecimalFormat("#.##", symbols).format(Integer.parseInt(hex.substring(0, 2), 16) / 255.0f)); // Alpha (Transparency in percents) [First Two + float r = Float.parseFloat(new DecimalFormat("#.##", symbols).format(Integer.parseInt(hex.substring(2, 4), 16) / 255.0f)); // Red + float g = Float.parseFloat(new DecimalFormat("#.##", symbols).format(Integer.parseInt(hex.substring(4, 6), 16) / 255.0f)); // Green + float b = Float.parseFloat(new DecimalFormat("#.##", symbols).format(Integer.parseInt(hex.substring(6, 8), 16) / 255.0f)); // Blue // Now build a matrix using values from above return new float[] diff --git a/app/src/main/jniLibs/arm64-v8a/libc++_shared.so b/app/src/main/jniLibs/arm64-v8a/libc++_shared.so index b8e89b1..e6909c8 100755 Binary files a/app/src/main/jniLibs/arm64-v8a/libc++_shared.so and b/app/src/main/jniLibs/arm64-v8a/libc++_shared.so differ diff --git a/app/src/main/jniLibs/arm64-v8a/libjniPdfium.so b/app/src/main/jniLibs/arm64-v8a/libjniPdfium.so index 15ace63..939b4a2 100755 Binary files a/app/src/main/jniLibs/arm64-v8a/libjniPdfium.so and b/app/src/main/jniLibs/arm64-v8a/libjniPdfium.so differ diff --git a/app/src/main/jniLibs/armeabi-v7a/libc++_shared.so b/app/src/main/jniLibs/armeabi-v7a/libc++_shared.so index fa0aa15..725127f 100755 Binary files a/app/src/main/jniLibs/armeabi-v7a/libc++_shared.so and b/app/src/main/jniLibs/armeabi-v7a/libc++_shared.so differ diff --git a/app/src/main/jniLibs/armeabi-v7a/libjniPdfium.so b/app/src/main/jniLibs/armeabi-v7a/libjniPdfium.so index d9127cf..29270ad 100755 Binary files a/app/src/main/jniLibs/armeabi-v7a/libjniPdfium.so and b/app/src/main/jniLibs/armeabi-v7a/libjniPdfium.so differ diff --git a/app/src/main/jniLibs/x86/libc++_shared.so b/app/src/main/jniLibs/x86/libc++_shared.so index 94e7f40..a94e6e4 100755 Binary files a/app/src/main/jniLibs/x86/libc++_shared.so and b/app/src/main/jniLibs/x86/libc++_shared.so differ diff --git a/app/src/main/jniLibs/x86/libjniPdfium.so b/app/src/main/jniLibs/x86/libjniPdfium.so index 0eeddfe..75f89d3 100755 Binary files a/app/src/main/jniLibs/x86/libjniPdfium.so and b/app/src/main/jniLibs/x86/libjniPdfium.so differ diff --git a/app/src/main/jniLibs/x86_64/libc++_shared.so b/app/src/main/jniLibs/x86_64/libc++_shared.so index 6a24c40..7018c10 100755 Binary files a/app/src/main/jniLibs/x86_64/libc++_shared.so and b/app/src/main/jniLibs/x86_64/libc++_shared.so differ diff --git a/app/src/main/jniLibs/x86_64/libjniPdfium.so b/app/src/main/jniLibs/x86_64/libjniPdfium.so index 5dc620c..393f391 100755 Binary files a/app/src/main/jniLibs/x86_64/libjniPdfium.so and b/app/src/main/jniLibs/x86_64/libjniPdfium.so differ diff --git a/app/src/main/res/layout/app_bottomappbar_pdfview.xml b/app/src/main/res/layout/app_bottomappbar_pdfview.xml index 9ff5143..b1e9b55 100644 --- a/app/src/main/res/layout/app_bottomappbar_pdfview.xml +++ b/app/src/main/res/layout/app_bottomappbar_pdfview.xml @@ -15,7 +15,7 @@ android:id="@+id/toolbar_pdfview" android:layout_width="match_parent" android:layout_height="@dimen/app_toolbar_height" - app:title="@string/lexicon_rules" + app:title="@string/app_loading" android:layout_margin="@dimen/app_toolbar_margin" android:layout_gravity="bottom"/> diff --git a/app/src/main/res/values-night/styles.xml b/app/src/main/res/values-night/styles.xml index 07b9994..bade82f 100644 --- a/app/src/main/res/values-night/styles.xml +++ b/app/src/main/res/values-night/styles.xml @@ -17,6 +17,7 @@ false true @style/AppBarBottomSheetDialogStyle + @style/AppBarBottomSheetStyle @font/app_rulebook_productsans_fontfamily @font/app_rulebook_productsans_fontfamily @font/app_rulebook_productsans_fontfamily diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index 54c459d..8aa8ad2 100755 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -26,5 +26,4 @@ #FFF0E3DD #FF562C22 #FF562C22 - diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml index 43e8289..56d0817 100755 --- a/app/src/main/res/values/dimens.xml +++ b/app/src/main/res/values/dimens.xml @@ -56,12 +56,12 @@ -1px -1px 0dp - 12dp + 10dp 0dp 128dp 14sp - 14dp - 24dp + 10dp + 20dp 1.0 4dp 8dp @@ -142,4 +142,4 @@ 100dp 20dp - + \ No newline at end of file diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index a3f74e4..b977ef8 100755 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -17,6 +17,7 @@ true @style/ThemeListView @style/AppBarBottomSheetDialogStyle + @style/AppBarBottomSheetStyle @font/app_rulebook_productsans_fontfamily @font/app_rulebook_productsans_fontfamily @font/app_rulebook_productsans_fontfamily @@ -223,21 +224,21 @@ -