From 9a786a6b4e23af2caf278482460dcbb4ddea399e Mon Sep 17 00:00:00 2001 From: raulhaag <2048339+raulhaag@users.noreply.github.com> Date: Fri, 8 Nov 2019 20:24:58 -0300 Subject: [PATCH] v1.113 --- README.md | 7 ++ app/build.gradle | 4 +- .../utils/CustomExceptionHandler.java | 77 +++++++++++++++++++ app/src/main/res/values-es/strings.xml | 2 +- app/src/main/res/values/strings.xml | 2 +- 5 files changed, 88 insertions(+), 4 deletions(-) create mode 100644 app/src/main/java/ar/rulosoft/mimanganu/utils/CustomExceptionHandler.java diff --git a/README.md b/README.md index d290e953..606349b9 100644 --- a/README.md +++ b/README.md @@ -49,6 +49,13 @@ Downloads Changelog --------- +Cambios en v1.113: +* Fix tmo +* Fix la búsqueda en mangaeden, mangapanda, readmangatoday y taad para dispositivos para un api vieja. + +Changes in v1.113: +* Fix tmo +* Fix mangaeden, mangapanda, readmangatoday and taad search on low api devices. Cambios en v1.112: * Fix TMO. diff --git a/app/build.gradle b/app/build.gradle index 9f0bf410..92032c55 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -5,8 +5,8 @@ android { buildToolsVersion '28.0.3' defaultConfig { applicationId "ar.rulosoft.mimanganu" - versionCode 112 - versionName "1.112" + versionCode 113 + versionName "1.113" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" minSdkVersion 15 } diff --git a/app/src/main/java/ar/rulosoft/mimanganu/utils/CustomExceptionHandler.java b/app/src/main/java/ar/rulosoft/mimanganu/utils/CustomExceptionHandler.java new file mode 100644 index 00000000..801e2bab --- /dev/null +++ b/app/src/main/java/ar/rulosoft/mimanganu/utils/CustomExceptionHandler.java @@ -0,0 +1,77 @@ +package ar.rulosoft.mimanganu.utils; + +import android.content.Context; +import android.content.SharedPreferences; +import android.os.Environment; +import android.preference.PreferenceManager; +import android.text.format.DateFormat; + +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileWriter; +import java.io.PrintWriter; +import java.io.StringWriter; +import java.io.Writer; + +// taken from https://stackoverflow.com/questions/601503/how-do-i-obtain-crash-data-from-my-android-application +// rrainn / Prags +// only minimal changes + + +public class CustomExceptionHandler implements Thread.UncaughtExceptionHandler { + + private Thread.UncaughtExceptionHandler defaultUEH; + + private String localPath; + private Context ctx; + + + /* + * if any of the parameters is null, the respective functionality + * will not be used + */ + public CustomExceptionHandler(String localPath) { + this.localPath = localPath; + this.defaultUEH = Thread.getDefaultUncaughtExceptionHandler(); + } + + public static void Attach(Context ctx) { + SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(ctx); + String dir = prefs.getString("directorio", Environment.getExternalStorageDirectory().getAbsolutePath()) + "/MiMangaNu/logs/"; + if (!new File(dir).exists()) { + new File(dir).mkdir(); + } + if (!(Thread.getDefaultUncaughtExceptionHandler() instanceof CustomExceptionHandler)) { + Thread.setDefaultUncaughtExceptionHandler(new CustomExceptionHandler(dir)); + } + } + + public void uncaughtException(Thread t, Throwable e) { + String timestamp = (DateFormat.format("dd-MM-yyyy--hh-mm-ss", new java.util.Date()).toString()); + final Writer result = new StringWriter(); + final PrintWriter printWriter = new PrintWriter(result); + e.printStackTrace(printWriter); + String stacktrace = result.toString(); + printWriter.close(); + String filename = timestamp + ".txt"; + + if (localPath != null) { + writeToFile(stacktrace, filename); + } + defaultUEH.uncaughtException(t, e); + } + + private void writeToFile(String stacktrace, String filename) { + try { + BufferedWriter bos = new BufferedWriter(new FileWriter( + localPath + "/" + filename)); + bos.write(stacktrace); + bos.flush(); + bos.close(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + +} \ No newline at end of file diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index bc745729..24ed7e77 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -1,6 +1,6 @@ - Cambios en v1.112:\n\t*Fix TMO. + Cambios en v1.113:\n\t* Fix tmo\n\t* Fix la búsqueda en mangaeden, mangapanda, readmangatoday y taad para dispositivos para un api vieja. Ajustar a Descargas Datos de diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index a7029613..18b3b67a 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1,6 +1,6 @@ - Changes in v1.112:\n\t*Fix TMO. + Changes in v1.113:\n\t* fix tmo\n\t* fix mangaeden, mangapanda, readmangatoday and taad search on low api devices. 12 Hours 1 day 2 days