From 65719f3f94480b8ece131caab558fb8e73502b6f Mon Sep 17 00:00:00 2001 From: Michael Ritchie Date: Mon, 30 Aug 2021 10:34:44 -0300 Subject: [PATCH] * updated crash reporting library * merged pull request to fix camera preferences * reordered screensavers to show clock on top of image --- WallPanelApp/build.gradle | 15 +++-- WallPanelApp/src/main/AndroidManifest.xml | 60 ++++++------------- .../thanksmister/iot/wallpanel/WallPanel.kt | 6 +- .../ui/activities/BaseBrowserActivity.kt | 2 + .../ui/activities/BrowserActivityNative.kt | 3 + .../wallpanel/ui/activities/TestActivity.kt | 40 +++++++++++++ .../ui/fragments/SettingsFragment.kt | 6 +- .../iot/wallpanel/ui/views/ScreenSaverView.kt | 12 ++-- .../res/layout-land/dialog_screen_saver.xml | 29 ++++----- .../dialog_screen_saver.xml | 28 ++++----- .../layout-sw600dp/dialog_screen_saver.xml | 28 ++++----- .../dialog_screen_saver.xml | 28 ++++----- .../layout-sw720dp/dialog_screen_saver.xml | 28 ++++----- .../src/main/res/layout/activity_test.xml | 25 ++++++++ .../main/res/layout/dialog_screen_saver.xml | 28 ++++----- build.gradle | 4 +- 16 files changed, 199 insertions(+), 143 deletions(-) create mode 100644 WallPanelApp/src/main/java/com/thanksmister/iot/wallpanel/ui/activities/TestActivity.kt create mode 100644 WallPanelApp/src/main/res/layout/activity_test.xml diff --git a/WallPanelApp/build.gradle b/WallPanelApp/build.gradle index 75cba73..3079d70 100644 --- a/WallPanelApp/build.gradle +++ b/WallPanelApp/build.gradle @@ -25,7 +25,7 @@ apply plugin: 'com.google.firebase.crashlytics' def versionMajor = 0 def versionMinor = 9 def versionPatch = 5 -def versionBuild = 6 // bump for dog food builds, public betas, etc. +def versionBuild = 9 // bump for dog food builds, public betas, etc. def CODE() { Properties properties = new Properties() @@ -148,6 +148,7 @@ dependencies { // LiveData + ViewModel implementation "androidx.lifecycle:lifecycle-extensions:$versions.lifecycle" + implementation 'com.google.firebase:firebase-analytics:17.2.2' annotationProcessor "androidx.lifecycle:lifecycle-compiler:$versions.lifecycle" implementation "androidx.lifecycle:lifecycle-reactivestreams:$versions.lifecycle" implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$versions.lifecycle" @@ -179,10 +180,16 @@ dependencies { // Logging implementation 'com.jakewharton.timber:timber:4.5.1' + // Import the BoM for the Firebase platform + implementation platform('com.google.firebase:firebase-bom:28.4.0') + + // Declare the dependencies for the Crashlytics and Analytics libraries + // When using the BoM, you don't specify versions in Firebase library dependencies + implementation 'com.google.firebase:firebase-analytics-ktx' + implementation 'com.google.firebase:firebase-crashlytics-ktx' + // Firebase - implementation 'com.google.firebase:firebase-core:19.0.0' - implementation 'com.google.firebase:firebase-crashlytics:18.0.1' - implementation 'com.google.firebase:firebase-analytics:19.0.0' + implementation 'com.google.firebase:firebase-core:19.0.1' // Picasso image loading implementation 'com.squareup.picasso:picasso:2.71828' diff --git a/WallPanelApp/src/main/AndroidManifest.xml b/WallPanelApp/src/main/AndroidManifest.xml index a1ca0ec..517575a 100644 --- a/WallPanelApp/src/main/AndroidManifest.xml +++ b/WallPanelApp/src/main/AndroidManifest.xml @@ -1,23 +1,7 @@ - - + - @@ -25,22 +9,14 @@ - - - - - - + + - - - + - - + tools:ignore="ProtectedPermissions" /> @@ -61,7 +37,7 @@ android:required="false" /> + - - @@ -121,15 +101,9 @@ - - - - \ No newline at end of file diff --git a/WallPanelApp/src/main/java/com/thanksmister/iot/wallpanel/WallPanel.kt b/WallPanelApp/src/main/java/com/thanksmister/iot/wallpanel/WallPanel.kt index 2b68f4f..1aa0277 100644 --- a/WallPanelApp/src/main/java/com/thanksmister/iot/wallpanel/WallPanel.kt +++ b/WallPanelApp/src/main/java/com/thanksmister/iot/wallpanel/WallPanel.kt @@ -19,7 +19,9 @@ package com.thanksmister.iot.wallpanel import android.content.Context import androidx.multidex.MultiDex import com.google.firebase.FirebaseApp +import com.google.firebase.analytics.FirebaseAnalytics import com.thanksmister.iot.wallpanel.di.DaggerApplicationComponent +import com.thanksmister.iot.wallpanel.utils.CrashlyticsTree import com.thanksmister.iot.wallpanel.utils.LauncherShortcuts import dagger.android.AndroidInjector import dagger.android.support.DaggerApplication @@ -27,6 +29,7 @@ import timber.log.Timber class WallPanel : DaggerApplication() { + override fun applicationInjector(): AndroidInjector { return DaggerApplicationComponent.builder().create(this); } @@ -37,7 +40,8 @@ class WallPanel : DaggerApplication() { Timber.plant(Timber.DebugTree()) } LauncherShortcuts.createShortcuts(this) - FirebaseApp.initializeApp(applicationContext) + //FirebaseApp.initializeApp(applicationContext) + //FirebaseAnalytics.getInstance(applicationContext) } override fun attachBaseContext(base: Context) { diff --git a/WallPanelApp/src/main/java/com/thanksmister/iot/wallpanel/ui/activities/BaseBrowserActivity.kt b/WallPanelApp/src/main/java/com/thanksmister/iot/wallpanel/ui/activities/BaseBrowserActivity.kt index 8b24433..2bf869f 100644 --- a/WallPanelApp/src/main/java/com/thanksmister/iot/wallpanel/ui/activities/BaseBrowserActivity.kt +++ b/WallPanelApp/src/main/java/com/thanksmister/iot/wallpanel/ui/activities/BaseBrowserActivity.kt @@ -25,8 +25,10 @@ import android.os.Build import android.os.Bundle import android.os.Handler import android.view.View +import android.view.ViewGroup import android.view.ViewTreeObserver import android.view.WindowManager +import android.widget.Button import android.widget.Toast import androidx.appcompat.app.AppCompatDelegate import androidx.localbroadcastmanager.content.LocalBroadcastManager diff --git a/WallPanelApp/src/main/java/com/thanksmister/iot/wallpanel/ui/activities/BrowserActivityNative.kt b/WallPanelApp/src/main/java/com/thanksmister/iot/wallpanel/ui/activities/BrowserActivityNative.kt index 89da355..75a9ddb 100644 --- a/WallPanelApp/src/main/java/com/thanksmister/iot/wallpanel/ui/activities/BrowserActivityNative.kt +++ b/WallPanelApp/src/main/java/com/thanksmister/iot/wallpanel/ui/activities/BrowserActivityNative.kt @@ -26,6 +26,7 @@ import android.os.Bundle import android.os.Handler import android.view.* import android.webkit.* +import android.widget.Button import android.widget.Toast import androidx.annotation.RequiresApi import androidx.appcompat.app.AlertDialog @@ -180,6 +181,8 @@ class BrowserActivityNative : BaseBrowserActivity(), LifecycleObserver { } return true } + + } mWebView.webViewClient = object : WebViewClient() { diff --git a/WallPanelApp/src/main/java/com/thanksmister/iot/wallpanel/ui/activities/TestActivity.kt b/WallPanelApp/src/main/java/com/thanksmister/iot/wallpanel/ui/activities/TestActivity.kt new file mode 100644 index 0000000..40ea247 --- /dev/null +++ b/WallPanelApp/src/main/java/com/thanksmister/iot/wallpanel/ui/activities/TestActivity.kt @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2021 ThanksMister LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed + * under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.thanksmister.iot.wallpanel.ui.activities + +import androidx.appcompat.app.AppCompatActivity +import android.os.Bundle +import android.view.ViewGroup +import android.widget.Button +import com.thanksmister.iot.wallpanel.R + +class TestActivity : AppCompatActivity() { + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + setContentView(R.layout.activity_test) + + val crashButton = Button(this) + crashButton.text = "Test Crash" + crashButton.setOnClickListener { + throw RuntimeException("Test Crash") // Force a crash + } + + addContentView(crashButton, ViewGroup.LayoutParams( + ViewGroup.LayoutParams.MATCH_PARENT, + ViewGroup.LayoutParams.WRAP_CONTENT)) + } +} \ No newline at end of file diff --git a/WallPanelApp/src/main/java/com/thanksmister/iot/wallpanel/ui/fragments/SettingsFragment.kt b/WallPanelApp/src/main/java/com/thanksmister/iot/wallpanel/ui/fragments/SettingsFragment.kt index 14da6ed..653ba26 100644 --- a/WallPanelApp/src/main/java/com/thanksmister/iot/wallpanel/ui/fragments/SettingsFragment.kt +++ b/WallPanelApp/src/main/java/com/thanksmister/iot/wallpanel/ui/fragments/SettingsFragment.kt @@ -378,10 +378,8 @@ class SettingsFragment : BaseSettingsFragment() { } PREF_SETTINGS_USER_AGENT -> { val value = userAgentPreference.text.orEmpty() - if (value.isNotEmpty()) { - configuration.browserUserAgent = value - userAgentPreference.summary = value - } + configuration.browserUserAgent = value + userAgentPreference.summary = value } PREF_SETTINGS_WEB_SCREENSAVER_URL -> { val value = webScreenSaverUrl.text.orEmpty() diff --git a/WallPanelApp/src/main/java/com/thanksmister/iot/wallpanel/ui/views/ScreenSaverView.kt b/WallPanelApp/src/main/java/com/thanksmister/iot/wallpanel/ui/views/ScreenSaverView.kt index a49eb70..f3e9bf0 100644 --- a/WallPanelApp/src/main/java/com/thanksmister/iot/wallpanel/ui/views/ScreenSaverView.kt +++ b/WallPanelApp/src/main/java/com/thanksmister/iot/wallpanel/ui/views/ScreenSaverView.kt @@ -129,19 +129,21 @@ class ScreenSaverView : RelativeLayout { setClockViews() timeHandler = Handler() timeHandler?.postDelayed(timeRunnable, 10) - screenSaverImageLayout.visibility = View.INVISIBLE - screenSaverWebViewLayout.visibility = View.GONE + screenSaverClockLayout.visibility = View.VISIBLE + //screenSaverWebViewLayout.visibility = View.GONE + } else { + screenSaverClockLayout.visibility = View.GONE } // show optional screensaver layers if (showWallpaper) { wallPaperHandler = Handler() wallPaperHandler?.postDelayed(wallPaperRunnable, 10) - screenSaverClockLayout.visibility = View.INVISIBLE + screenSaverImageLayout.visibility = View.VISIBLE screenSaverWebViewLayout.visibility = View.GONE } else if (showWebPage) { - screenSaverClockLayout.visibility = View.INVISIBLE - screenSaverImageLayout.visibility = View.INVISIBLE + //c + screenSaverImageLayout.visibility = View.GONE screenSaverWebViewLayout.visibility = View.VISIBLE startWebScreenSaver(webUrl) } diff --git a/WallPanelApp/src/main/res/layout-land/dialog_screen_saver.xml b/WallPanelApp/src/main/res/layout-land/dialog_screen_saver.xml index 3817922..6340686 100644 --- a/WallPanelApp/src/main/res/layout-land/dialog_screen_saver.xml +++ b/WallPanelApp/src/main/res/layout-land/dialog_screen_saver.xml @@ -31,6 +31,21 @@ android:layout_gravity="center" tools:ignore="HardcodedText" /> + + + + + + + - - - - - - \ No newline at end of file diff --git a/WallPanelApp/src/main/res/layout-sw600dp-land/dialog_screen_saver.xml b/WallPanelApp/src/main/res/layout-sw600dp-land/dialog_screen_saver.xml index a4ffec4..357289a 100644 --- a/WallPanelApp/src/main/res/layout-sw600dp-land/dialog_screen_saver.xml +++ b/WallPanelApp/src/main/res/layout-sw600dp-land/dialog_screen_saver.xml @@ -31,6 +31,20 @@ android:layout_gravity="center" tools:ignore="HardcodedText"/> + + + + + + - - - - - - \ No newline at end of file diff --git a/WallPanelApp/src/main/res/layout-sw600dp/dialog_screen_saver.xml b/WallPanelApp/src/main/res/layout-sw600dp/dialog_screen_saver.xml index a4ffec4..357289a 100644 --- a/WallPanelApp/src/main/res/layout-sw600dp/dialog_screen_saver.xml +++ b/WallPanelApp/src/main/res/layout-sw600dp/dialog_screen_saver.xml @@ -31,6 +31,20 @@ android:layout_gravity="center" tools:ignore="HardcodedText"/> + + + + + + - - - - - - \ No newline at end of file diff --git a/WallPanelApp/src/main/res/layout-sw720dp-land/dialog_screen_saver.xml b/WallPanelApp/src/main/res/layout-sw720dp-land/dialog_screen_saver.xml index ee5ae87..a6210b9 100644 --- a/WallPanelApp/src/main/res/layout-sw720dp-land/dialog_screen_saver.xml +++ b/WallPanelApp/src/main/res/layout-sw720dp-land/dialog_screen_saver.xml @@ -32,6 +32,20 @@ android:scaleType="centerCrop" tools:ignore="HardcodedText" /> + + + + + + - - - - - - \ No newline at end of file diff --git a/WallPanelApp/src/main/res/layout-sw720dp/dialog_screen_saver.xml b/WallPanelApp/src/main/res/layout-sw720dp/dialog_screen_saver.xml index 67e3820..f460376 100644 --- a/WallPanelApp/src/main/res/layout-sw720dp/dialog_screen_saver.xml +++ b/WallPanelApp/src/main/res/layout-sw720dp/dialog_screen_saver.xml @@ -31,6 +31,20 @@ android:layout_gravity="center" tools:ignore="HardcodedText"/> + + + + + + - - - - - - \ No newline at end of file diff --git a/WallPanelApp/src/main/res/layout/activity_test.xml b/WallPanelApp/src/main/res/layout/activity_test.xml new file mode 100644 index 0000000..76d2ec2 --- /dev/null +++ b/WallPanelApp/src/main/res/layout/activity_test.xml @@ -0,0 +1,25 @@ + + + + + + \ No newline at end of file diff --git a/WallPanelApp/src/main/res/layout/dialog_screen_saver.xml b/WallPanelApp/src/main/res/layout/dialog_screen_saver.xml index 03a05e9..f7c7707 100644 --- a/WallPanelApp/src/main/res/layout/dialog_screen_saver.xml +++ b/WallPanelApp/src/main/res/layout/dialog_screen_saver.xml @@ -16,6 +16,20 @@ android:layout_gravity="center" tools:ignore="HardcodedText" /> + + + + + + - - - - - - \ No newline at end of file diff --git a/build.gradle b/build.gradle index b253111..ec71621 100644 --- a/build.gradle +++ b/build.gradle @@ -27,8 +27,8 @@ buildscript { dependencies { classpath 'com.android.tools.build:gradle:4.1.3' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - classpath 'com.google.gms:google-services:4.3.8' - classpath 'com.google.firebase:firebase-crashlytics-gradle:2.7.0' + classpath 'com.google.firebase:firebase-crashlytics-gradle:2.7.1' + classpath 'com.google.gms:google-services:4.3.10' } }