Skip to content

Commit

Permalink
app: introduce 1.1.7
Browse files Browse the repository at this point in the history
- pdfviewer fixed
- typo fixed
- some UI bug fixes
- code cleanup
  • Loading branch information
verNANDo57 committed Aug 31, 2022
1 parent c7a3e94 commit 43e07a3
Show file tree
Hide file tree
Showing 23 changed files with 56 additions and 36 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,4 @@ public View onCreateView(LayoutInflater inflater , ViewGroup container, Bundle s
});
return viewFragment;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
});

Expand All @@ -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);
}
Expand All @@ -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;
}
});

Expand All @@ -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));
}
}
Expand All @@ -142,8 +142,8 @@ public void onClick(DialogInterface dialog, int which) {
});
androidx.appcompat.app.AlertDialog alert = builder.create();
alert.show();
return false;
return true;
}
});
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -388,4 +388,4 @@ private void shareFile() throws IOException {
exportRuleFile.getAbsoluteFile().delete();
});
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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";

Expand Down Expand Up @@ -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;
Expand All @@ -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 */
Expand Down Expand Up @@ -441,4 +449,4 @@ public static Bitmap getBitmapFromView(Context context, View view, int height, i
view.draw(canvas);
return bitmap;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
import androidx.annotation.NonNull;

import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.util.Locale;

public final class ColorUtils {

Expand Down Expand Up @@ -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[]
Expand Down
Binary file modified app/src/main/jniLibs/arm64-v8a/libc++_shared.so
Binary file not shown.
Binary file modified app/src/main/jniLibs/arm64-v8a/libjniPdfium.so
Binary file not shown.
Binary file modified app/src/main/jniLibs/armeabi-v7a/libc++_shared.so
Binary file not shown.
Binary file modified app/src/main/jniLibs/armeabi-v7a/libjniPdfium.so
Binary file not shown.
Binary file modified app/src/main/jniLibs/x86/libc++_shared.so
Binary file not shown.
Binary file modified app/src/main/jniLibs/x86/libjniPdfium.so
Binary file not shown.
Binary file modified app/src/main/jniLibs/x86_64/libc++_shared.so
Binary file not shown.
Binary file modified app/src/main/jniLibs/x86_64/libjniPdfium.so
Binary file not shown.
2 changes: 1 addition & 1 deletion app/src/main/res/layout/app_bottomappbar_pdfview.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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"/>

Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values-night/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="bottomSheetDialogTheme">@style/AppBarBottomSheetDialogStyle</item>
<item name="bottomSheetStyle">@style/AppBarBottomSheetStyle</item>
<item name="fontProviderSystemFontFamily">@font/app_rulebook_productsans_fontfamily</item>
<item name="android:fontFamily">@font/app_rulebook_productsans_fontfamily</item>
<item name="fontFamily">@font/app_rulebook_productsans_fontfamily</item>
Expand Down
1 change: 0 additions & 1 deletion app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,4 @@
<color name="app_snackbar_default_background_color">#FFF0E3DD</color>
<color name="app_snackbar_default_accent_color">#FF562C22</color>
<color name="app_snackbar_default_text_color">#FF562C22</color>

</resources>
8 changes: 4 additions & 4 deletions app/src/main/res/values/dimens.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@
<dimen name="app_design_snackbar_min_width">-1px</dimen>
<dimen name="app_design_snackbar_max_width">-1px</dimen>
<dimen name="app_design_snackbar_background_corner_radius">0dp</dimen>
<dimen name="app_design_snackbar_padding_horizontal">12dp</dimen>
<dimen name="app_design_snackbar_margin_horizontal">10dp</dimen>
<dimen name="app_design_snackbar_extra_spacing_horizontal">0dp</dimen>
<dimen name="app_design_snackbar_action_inline_max_width">128dp</dimen>
<dimen name="app_design_snackbar_text_size">14sp</dimen>
<dimen name="app_design_snackbar_padding_vertical">14dp</dimen>
<dimen name="app_design_snackbar_padding_vertical_2lines">24dp</dimen>
<dimen name="app_design_snackbar_margin_vertical">10dp</dimen>
<dimen name="app_design_snackbar_margin_vertical_2lines">20dp</dimen>
<item name="app_design_snackbar_action_text_color_alpha" format="float" type="dimen">1.0</item>
<dimen name="app_mtrl_snackbar_background_corner_radius">4dp</dimen>
<dimen name="app_mtrl_snackbar_margin">8dp</dimen>
Expand Down Expand Up @@ -142,4 +142,4 @@
<dimen name="app_bar_icon_width_width">100dp</dimen>

<dimen name="title_text_size">20dp</dimen>
</resources>
</resources>
15 changes: 9 additions & 6 deletions app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<item name="windowNoTitle">true</item>
<item name="android:listViewStyle">@style/ThemeListView</item>
<item name="bottomSheetDialogTheme">@style/AppBarBottomSheetDialogStyle</item>
<item name="bottomSheetStyle">@style/AppBarBottomSheetStyle</item>
<item name="fontProviderSystemFontFamily">@font/app_rulebook_productsans_fontfamily</item>
<item name="android:fontFamily">@font/app_rulebook_productsans_fontfamily</item>
<item name="fontFamily">@font/app_rulebook_productsans_fontfamily</item>
Expand Down Expand Up @@ -223,21 +224,21 @@
</style>

<style name="RulebookButtonTop" parent="Widget.AppCompat.Button">
<item name="android:stateListAnimator" >@animator/btn_anim_zoom</item>
<item name="android:stateListAnimator">@animator/btn_anim_zoom</item>
<item name="android:background">@drawable/buttonshape_top_rightandleft</item>
<item name="android:textSize">@dimen/action_smallbutton_textsize</item>
<item name="android:textStyle">bold</item>
</style>

<style name="RulebookButtonBottom" parent="Widget.AppCompat.Button">
<item name="android:stateListAnimator" >@animator/btn_anim_zoom</item>
<item name="android:stateListAnimator">@animator/btn_anim_zoom</item>
<item name="android:background">@drawable/buttonshape_bottom_rightandleft</item>
<item name="android:textSize">@dimen/action_smallbutton_textsize</item>
<item name="android:textStyle">bold</item>
</style>

<style name="RulebookButtonDefault" parent="Widget.AppCompat.Button">
<item name="android:stateListAnimator" >@animator/btn_anim_zoom</item>
<item name="android:stateListAnimator">@animator/btn_anim_zoom</item>
<item name="android:background">@drawable/buttonshape</item>
<item name="android:textSize">@dimen/action_smallbutton_textsize</item>
<item name="android:textStyle">bold</item>
Expand All @@ -262,12 +263,14 @@
<item name="colorControlActivated">@color/colorPrimary</item>
</style>

<style name="SnackBar" parent="Widget.MaterialComponents.Snackbar">
<style name="SnackBar" parent="Widget.Design.Snackbar">
<item name="android:minWidth">@dimen/app_design_snackbar_min_width</item>
<item name="android:maxWidth">@dimen/app_design_snackbar_max_width</item>
<item name="android:background">@drawable/shape_snackbar</item>
<item name="android:paddingLeft">@dimen/app_design_snackbar_padding_horizontal</item>
<item name="android:paddingRight">@dimen/app_design_snackbar_padding_horizontal</item>
<item name="android:layout_marginLeft">@dimen/app_design_snackbar_margin_horizontal</item>
<item name="android:layout_marginRight">@dimen/app_design_snackbar_margin_horizontal</item>
<item name="android:layout_marginTop">@dimen/app_design_snackbar_margin_vertical</item>
<item name="android:layout_marginBottom">@dimen/app_design_snackbar_margin_vertical</item>
<item name="maxActionInlineWidth">@dimen/app_design_snackbar_action_inline_max_width</item>
</style>

Expand Down

0 comments on commit 43e07a3

Please sign in to comment.