diff --git a/.gitignore b/.gitignore
index 7cae86d..2e823af 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,8 @@
# Built application files
*.apk
+*.aar
*.ap_
+*.aab
mapping.txt
output.json
@@ -14,6 +16,8 @@ output.json
bin/
gen/
out/
+# Uncomment the following line in case you need and you don't have the release build type files in your app
+# release/
# Gradle files
.gradle/
@@ -34,15 +38,17 @@ proguard/
# Android Studio captures folder
captures/
-# Intellij
+# IntelliJ
*.iml
.idea/
# Keystore files
*.jks
+*.keystore
# External native build folder generated in Android Studio 2.2 and later
.externalNativeBuild
+.cxx/
# Google Services (e.g. APIs or Firebase)
google-services.json
@@ -51,3 +57,23 @@ google-services.json
freeline.py
freeline/
freeline_project_description.json
+
+# fastlane
+fastlane/report.xml
+fastlane/Preview.html
+fastlane/screenshots
+fastlane/test_output
+fastlane/readme.md
+
+# Version control
+vcs.xml
+
+# lint
+lint/intermediates/
+lint/generated/
+lint/outputs/
+lint/tmp/
+# lint/reports/
+
+# Android Profiling
+*.hprof
\ No newline at end of file
diff --git a/app/src/main/java/com/trianguloy/urlchecker/modules/list/DebugModule.java b/app/src/main/java/com/trianguloy/urlchecker/modules/list/DebugModule.java
index c4a6d8e..335d70c 100644
--- a/app/src/main/java/com/trianguloy/urlchecker/modules/list/DebugModule.java
+++ b/app/src/main/java/com/trianguloy/urlchecker/modules/list/DebugModule.java
@@ -1,6 +1,8 @@
package com.trianguloy.urlchecker.modules.list;
import android.view.View;
+import android.widget.CheckBox;
+import android.widget.CompoundButton;
import android.widget.TextView;
import com.trianguloy.urlchecker.R;
@@ -9,11 +11,13 @@ import com.trianguloy.urlchecker.dialogs.MainDialog;
import com.trianguloy.urlchecker.modules.AModuleConfig;
import com.trianguloy.urlchecker.modules.AModuleData;
import com.trianguloy.urlchecker.modules.AModuleDialog;
-import com.trianguloy.urlchecker.modules.DescriptionConfig;
+import com.trianguloy.urlchecker.services.CustomTabs;
+import com.trianguloy.urlchecker.utilities.GenericPref;
/**
* A textview with debug info.
* Currently shows the original intent (as uri)
+ * Allows also to enable/disable ctabs toasts
*/
public class DebugModule extends AModuleData {
@Override
@@ -38,7 +42,7 @@ public class DebugModule extends AModuleData {
@Override
public AModuleConfig getConfig(ConfigActivity cntx) {
- return new DescriptionConfig(R.string.dbg_desc);
+ return new DebugConfig(cntx);
}
}
@@ -64,4 +68,36 @@ class DebugDialog extends AModuleDialog {
getActivity().getIntent().toUri(0)
);
}
+}
+
+class DebugConfig extends AModuleConfig {
+
+ GenericPref.Bool show_toasts = CustomTabs.SHOWTOAST_PREF();
+
+ public DebugConfig(ConfigActivity activity) {
+ super(activity);
+ show_toasts.init(activity);
+ }
+
+ @Override
+ public boolean canBeEnabled() {
+ return true;
+ }
+
+ @Override
+ public int getLayoutId() {
+ return R.layout.config_debug;
+ }
+
+ @Override
+ public void onInitialize(View views) {
+ CheckBox chk_ctabs = views.findViewById(R.id.chk_ctabs);
+ chk_ctabs.setChecked(show_toasts.get());
+ chk_ctabs.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
+ @Override
+ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
+ show_toasts.set(isChecked);
+ }
+ });
+ }
}
\ No newline at end of file
diff --git a/app/src/main/java/com/trianguloy/urlchecker/services/CustomTabs.java b/app/src/main/java/com/trianguloy/urlchecker/services/CustomTabs.java
index e2249eb..00007b8 100644
--- a/app/src/main/java/com/trianguloy/urlchecker/services/CustomTabs.java
+++ b/app/src/main/java/com/trianguloy/urlchecker/services/CustomTabs.java
@@ -6,7 +6,7 @@ import android.os.IBinder;
import android.util.Log;
import android.widget.Toast;
-import com.trianguloy.urlchecker.BuildConfig;
+import com.trianguloy.urlchecker.utilities.GenericPref;
/**
* Empty service for fake custom tabs.
@@ -15,28 +15,31 @@ import com.trianguloy.urlchecker.BuildConfig;
*/
public class CustomTabs extends Service {
+ public static GenericPref.Bool SHOWTOAST_PREF() {
+ return new GenericPref.Bool("ctabs_toast", false);
+ }
@Override
public void onCreate() {
super.onCreate();
- log("onCreate", true);
+ log("onCreate");
}
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
- log("onStartCommand\n" + intent.toUri(0), true);
+ log("onStartCommand\n" + intent.toUri(0));
return super.onStartCommand(intent, flags, startId);
}
@Override
public void onDestroy() {
- log("onDestroy", true);
+ log("onDestroy");
super.onDestroy();
}
@Override
public IBinder onBind(Intent intent) {
- log("onBind\n" + intent.toUri(0), false); // a toast here, for some reason, isn't shown and later it crashes
+ log("onBind\n" + intent.toUri(0)); // a toast here, for some reason, isn't shown and later it crashes
return null;
// return new IBinder() {
// @Override
@@ -96,9 +99,11 @@ public class CustomTabs extends Service {
private static final String TAG = "CUSTOMTABS";
- private void log(String message, boolean toast) {
+ private void log(String message) {
Log.d(TAG, message);
- if (BuildConfig.DEBUG && toast) {
+ GenericPref.Bool showToast = SHOWTOAST_PREF();
+ showToast.init(this);
+ if (showToast.get()) {
Toast.makeText(this, TAG + ": " + message, Toast.LENGTH_LONG).show();
}
}
diff --git a/app/src/main/res/layout/config_debug.xml b/app/src/main/res/layout/config_debug.xml
new file mode 100644
index 0000000..78c5206
--- /dev/null
+++ b/app/src/main/res/layout/config_debug.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/dialog_debug.xml b/app/src/main/res/layout/dialog_debug.xml
index 7c7426c..8da6d2c 100644
--- a/app/src/main/res/layout/dialog_debug.xml
+++ b/app/src/main/res/layout/dialog_debug.xml
@@ -1,2 +1,7 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index b637062..b8698a7 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -64,6 +64,7 @@
Can\'t connect to VirusTotal. Make sure the api key is valid or try again later.
Debug module
- Displays debug data, intended for developers.
+ Displays the received intent as uri, intended for developers.
+ Show debug messages from the custom tabs service