UI updates

This commit is contained in:
Tommaso Berlose 2021-09-29 14:35:15 +02:00
parent dd2a74aaf6
commit 4e5bf62e23
59 changed files with 129 additions and 119 deletions

3
.idea/gradle.xml generated
View File

@ -4,7 +4,7 @@
<component name="GradleSettings"> <component name="GradleSettings">
<option name="linkedExternalProjectsSettings"> <option name="linkedExternalProjectsSettings">
<GradleProjectSettings> <GradleProjectSettings>
<option name="testRunner" value="PLATFORM" /> <option name="testRunner" value="GRADLE" />
<option name="distributionType" value="DEFAULT_WRAPPED" /> <option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" /> <option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="modules"> <option name="modules">
@ -14,7 +14,6 @@
</set> </set>
</option> </option>
<option name="resolveModulePerSourceSet" value="false" /> <option name="resolveModulePerSourceSet" value="false" />
<option name="useQualifiedModuleNames" value="true" />
</GradleProjectSettings> </GradleProjectSettings>
</option> </option>
</component> </component>

2
.idea/misc.xml generated
View File

@ -61,7 +61,7 @@
</profile-state> </profile-state>
</entry> </entry>
</component> </component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK"> <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" /> <output url="file://$PROJECT_DIR$/build/classes" />
</component> </component>
<component name="ProjectType"> <component name="ProjectType">

View File

@ -1,13 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RunConfigurationProducerService">
<option name="ignoredProducers">
<set>
<option value="com.android.tools.idea.compose.preview.runconfiguration.ComposePreviewRunConfigurationProducer" />
<option value="org.jetbrains.plugins.gradle.execution.test.runner.AllInPackageGradleConfigurationProducer" />
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestClassGradleConfigurationProducer" />
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestMethodGradleConfigurationProducer" />
</set>
</option>
</component>
</project>

View File

@ -16,7 +16,6 @@ apikeyProperties.load(new FileInputStream(apikeyPropertiesFile))
android { android {
compileSdkVersion 30 compileSdkVersion 30
buildToolsVersion "29.0.3"
defaultConfig { defaultConfig {
applicationId "com.tommasoberlose.anotherwidget" applicationId "com.tommasoberlose.anotherwidget"
@ -70,7 +69,7 @@ dependencies {
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
// UI // UI
implementation 'androidx.appcompat:appcompat:1.2.0' implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4' implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'com.google.android.material:material:1.3.0' implementation 'com.google.android.material:material:1.3.0'
implementation 'androidx.browser:browser:1.3.0' implementation 'androidx.browser:browser:1.3.0'
@ -115,10 +114,10 @@ dependencies {
implementation 'com.android.billingclient:billing-ktx:3.0.3' implementation 'com.android.billingclient:billing-ktx:3.0.3'
// KTX // KTX
implementation "androidx.core:core-ktx:1.3.2" implementation "androidx.core:core-ktx:1.5.0"
implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.3.1" implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.3.1"
implementation "androidx.palette:palette-ktx:1.0.0" implementation "androidx.palette:palette-ktx:1.0.0"
implementation 'androidx.core:core-ktx:1.3.2' implementation 'androidx.core:core-ktx:1.5.0'
//Retrofit //Retrofit
implementation 'com.squareup.retrofit2:retrofit:2.9.0' implementation 'com.squareup.retrofit2:retrofit:2.9.0'
@ -131,7 +130,7 @@ dependencies {
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.1' implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.1'
// Add the Firebase SDK for Crashlytics. // Add the Firebase SDK for Crashlytics.
implementation 'com.google.firebase:firebase-crashlytics:17.4.1' implementation 'com.google.firebase:firebase-crashlytics:18.0.0'
// Preferences // Preferences
implementation 'com.chibatching.kotpref:kotpref:2.13.1' implementation 'com.chibatching.kotpref:kotpref:2.13.1'

View File

@ -24,13 +24,14 @@
android:usesCleartextTraffic="true" android:usesCleartextTraffic="true"
android:theme="@style/AppTheme" android:theme="@style/AppTheme"
tools:ignore="LockedOrientationActivity"> tools:ignore="LockedOrientationActivity">
<activity android:name=".ui.activities.MainActivity" android:launchMode="singleInstance" android:theme="@style/AppTheme.Main" android:screenOrientation="portrait"> <activity android:name=".ui.activities.SplashActivity" android:launchMode="singleInstance" android:theme="@style/AppTheme.Main" android:screenOrientation="portrait">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" /> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter> </intent-filter>
</activity> </activity>
<activity android:name=".ui.activities.MainActivity" android:launchMode="singleInstance" android:theme="@style/AppTheme" android:screenOrientation="portrait" />
<activity android:name=".ui.activities.tabs.ChooseApplicationActivity" android:launchMode="singleInstance" android:screenOrientation="portrait" /> <activity android:name=".ui.activities.tabs.ChooseApplicationActivity" android:launchMode="singleInstance" android:screenOrientation="portrait" />
<activity android:name=".ui.activities.tabs.CustomFontActivity" android:launchMode="singleInstance" android:screenOrientation="portrait" /> <activity android:name=".ui.activities.tabs.CustomFontActivity" android:launchMode="singleInstance" android:screenOrientation="portrait" />
<activity android:name=".ui.activities.tabs.CustomLocationActivity" android:launchMode="singleInstance" android:screenOrientation="portrait" /> <activity android:name=".ui.activities.tabs.CustomLocationActivity" android:launchMode="singleInstance" android:screenOrientation="portrait" />
@ -102,21 +103,12 @@
<receiver <receiver
android:name=".receivers.WidgetClickListenerReceiver" android:name=".receivers.WidgetClickListenerReceiver"
android:enabled="true" android:enabled="true"
android:exported="false"> android:exported="true">
<intent-filter> <intent-filter>
<action android:name="com.tommasoberlose.anotherwidget.action.ACTION_OPEN_WEATHER_INTENT" /> <action android:name="com.tommasoberlose.anotherwidget.action.ACTION_OPEN_WEATHER_INTENT" />
</intent-filter> </intent-filter>
</receiver> </receiver>
<receiver
android:name=".receivers.CrashlyticsReceiver"
android:enabled="true"
android:exported="false">
<intent-filter>
<action android:name="com.tommasoberlose.anotherwidget.action.ACTION_REPORT_CRASH" />
</intent-filter>
</receiver>
<service android:name=".services.EventListenerJob" android:permission="android.permission.BIND_JOB_SERVICE" /> <service android:name=".services.EventListenerJob" android:permission="android.permission.BIND_JOB_SERVICE" />
<service android:name=".services.BatteryListenerJob" android:permission="android.permission.BIND_JOB_SERVICE" /> <service android:name=".services.BatteryListenerJob" android:permission="android.permission.BIND_JOB_SERVICE" />
@ -141,7 +133,7 @@
</receiver> </receiver>
<receiver android:name=".receivers.ActivityDetectionReceiver" <receiver android:name=".receivers.ActivityDetectionReceiver"
android:exported="false" android:exported="true"
android:permission="com.google.android.gms.permission.ACTIVITY_RECOGNITION"> android:permission="com.google.android.gms.permission.ACTIVITY_RECOGNITION">
<intent-filter> <intent-filter>
<action android:name="com.mypackage.ACTION_PROCESS_ACTIVITY_TRANSITIONS" /> <action android:name="com.mypackage.ACTION_PROCESS_ACTIVITY_TRANSITIONS" />
@ -153,12 +145,12 @@
<service <service
android:name=".services.UpdateCalendarService" android:name=".services.UpdateCalendarService"
android:enabled="true" android:enabled="true"
android:exported="false" android:exported="true"
android:foregroundServiceType="dataSync" /> android:foregroundServiceType="dataSync" />
<service <service
android:name=".services.LocationService" android:name=".services.LocationService"
android:enabled="true" android:enabled="true"
android:exported="false" android:exported="true"
android:foregroundServiceType="location" /> android:foregroundServiceType="location" />
</application> </application>

View File

@ -85,7 +85,7 @@ object Preferences : KotprefModel() {
var weatherIconPack by intPref(default = Constants.WeatherIconPack.DEFAULT.rawValue) var weatherIconPack by intPref(default = Constants.WeatherIconPack.DEFAULT.rawValue)
// UI // UI
var widgetMargin by floatPref(default = Constants.Dimension.SMALL.rawValue) var widgetMargin by floatPref(default = Constants.Dimension.NONE.rawValue)
var widgetPadding by floatPref(default = Constants.Dimension.SMALL.rawValue) var widgetPadding by floatPref(default = Constants.Dimension.SMALL.rawValue)
// Clock // Clock

View File

@ -404,7 +404,7 @@ class WeatherNetworkApi(val context: Context) {
val iconCode = summary["symbol_code"] as String val iconCode = summary["symbol_code"] as String
Preferences.weatherTemp = temp.toFloat() Preferences.weatherTemp = temp.toFloat()
Preferences.weatherIcon = WeatherHelper.getYRIcon(iconCode, now.get(Calendar.HOUR_OF_DAY) >= 22 || now.get(Calendar.HOUR_OF_DAY) <= 8) Preferences.weatherIcon = WeatherHelper.getYRIcon(iconCode, !(now.get(Calendar.HOUR_OF_DAY) >= 22 || now.get(Calendar.HOUR_OF_DAY) <= 8))
Preferences.weatherTempUnit = "C" Preferences.weatherTempUnit = "C"
Preferences.weatherRealTempUnit = Preferences.weatherTempUnit Preferences.weatherRealTempUnit = Preferences.weatherTempUnit
MainWidget.updateWidget(context) MainWidget.updateWidget(context)

View File

@ -1,32 +0,0 @@
package com.tommasoberlose.anotherwidget.receivers
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.util.Log
import com.google.firebase.crashlytics.FirebaseCrashlytics
import com.tommasoberlose.anotherwidget.global.Actions
import java.lang.Exception
class CrashlyticsReceiver : BroadcastReceiver() {
override fun onReceive(context: Context, intent: Intent) {
if (intent.action == Actions.ACTION_REPORT_CRASH) {
val exception: Exception = intent.getSerializableExtra(EXCEPTION) as Exception
FirebaseCrashlytics.getInstance().recordException(exception)
FirebaseCrashlytics.getInstance().sendUnsentReports()
}
}
companion object {
private const val EXCEPTION = "EXCEPTION"
fun sendCrash(context: Context, exception: Exception) {
context.sendBroadcast(Intent(context, CrashlyticsReceiver::class.java).apply {
action = Actions.ACTION_REPORT_CRASH
putExtra(EXCEPTION, exception)
})
}
}
}

View File

@ -46,6 +46,7 @@ class MainActivity : AppCompatActivity(), SharedPreferences.OnSharedPreferenceCh
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
overridePendingTransition(R.anim.nav_default_enter_anim, R.anim.nav_default_exit_anim)
viewModel = ViewModelProvider(this).get(MainViewModel::class.java) viewModel = ViewModelProvider(this).get(MainViewModel::class.java)
binding = ActivityMainBinding.inflate(layoutInflater) binding = ActivityMainBinding.inflate(layoutInflater)

View File

@ -0,0 +1,28 @@
package com.tommasoberlose.anotherwidget.ui.activities
import android.content.Intent
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.lifecycle.ViewModelProvider
import androidx.lifecycle.lifecycleScope
import com.tommasoberlose.anotherwidget.R
import com.tommasoberlose.anotherwidget.databinding.ActivityMainBinding
import com.tommasoberlose.anotherwidget.global.Preferences
import com.tommasoberlose.anotherwidget.ui.viewmodels.MainViewModel
import kotlinx.coroutines.delay
class SplashActivity: AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
lifecycleScope.launchWhenResumed {
delay(1000)
if (!this@SplashActivity.isDestroyed) {
startActivity(Intent(this@SplashActivity, MainActivity::class.java))
finish()
}
}
}
}

View File

@ -12,6 +12,7 @@ import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import android.widget.RemoteViews import android.widget.RemoteViews
import androidx.core.view.isVisible
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import androidx.lifecycle.ViewModelProvider import androidx.lifecycle.ViewModelProvider
import androidx.lifecycle.lifecycleScope import androidx.lifecycle.lifecycleScope
@ -141,6 +142,10 @@ class MainFragment : Fragment() {
binding.toolbar.cardElevation = if (it > 0) 24f else 0f binding.toolbar.cardElevation = if (it > 0) 24f else 0f
} }
viewModel.showPreview.observe(viewLifecycleOwner) {
binding.preview.isVisible = it
}
viewModel.widgetPreferencesUpdate.observe(viewLifecycleOwner) { viewModel.widgetPreferencesUpdate.observe(viewLifecycleOwner) {
onUpdateUiEvent(null) onUpdateUiEvent(null)
} }
@ -160,16 +165,13 @@ class MainFragment : Fragment() {
view.measure(0, 0) view.measure(0, 0)
withContext(Dispatchers.Main) { withContext(Dispatchers.Main) {
binding.widgetLoader.animate().scaleX(1f).scaleY(1f).alpha(1f) binding.widgetLoader.animate().alpha(0f).setDuration(200L).start()
.setDuration(200L).start()
binding.widget.animate().alpha(0f).setDuration(200L).withEndAction { binding.widget.animate().alpha(0f).setDuration(200L).withEndAction {
updatePreviewVisibility(view.measuredHeight)
binding.widget.removeAllViews() binding.widget.removeAllViews()
binding.widget.addView(view) binding.widget.addView(view)
updatePreviewVisibility(view.measuredHeight) binding.widget.animate().setStartDelay(300L).alpha(1f).start()
binding.widgetLoader.animate().scaleX(0f).scaleY(0f).alpha(0f)
.setDuration(200L).start()
binding.widget.animate().alpha(1f).start()
}.start() }.start()
} }
} }
@ -179,28 +181,30 @@ class MainFragment : Fragment() {
} }
private fun updatePreviewVisibility(widgetHeight: Int) { private fun updatePreviewVisibility(widgetHeight: Int) {
val newHeight = widgetHeight + 32f.convertDpToPixel(requireContext()).toInt() if (isAdded) {
if (binding.preview.layoutParams.height != newHeight) { val newHeight = widgetHeight + 32f.convertDpToPixel(requireContext()).toInt()
binding.preview.clearAnimation() if (binding.preview.layoutParams.height != newHeight) {
ValueAnimator.ofInt( binding.preview.clearAnimation()
binding.preview.height, ValueAnimator.ofInt(
newHeight binding.preview.height,
).apply { newHeight
duration = 500L ).apply {
addUpdateListener { duration = 300L
val animatedValue = animatedValue as Int addUpdateListener {
val layoutParams = binding.preview.layoutParams val animatedValue = animatedValue as Int
layoutParams.height = animatedValue val layoutParams = binding.preview.layoutParams
binding.preview.layoutParams = layoutParams layoutParams.height = animatedValue
} binding.preview.layoutParams = layoutParams
}.start() }
}.start()
}
} }
} }
override fun onResume() { override fun onResume() {
super.onResume() super.onResume()
EventBus.getDefault().register(this) EventBus.getDefault().register(this)
updateUI() // updateUI()
} }
override fun onPause() { override fun onPause() {

View File

@ -135,7 +135,6 @@ class MainViewModel(context: Application) : AndroidViewModel(context) {
addSource(Preferences.asLiveData(Preferences::customFontFile)) { value = true } addSource(Preferences.asLiveData(Preferences::customFontFile)) { value = true }
addSource(Preferences.asLiveData(Preferences::customFontName)) { value = true } addSource(Preferences.asLiveData(Preferences::customFontName)) { value = true }
addSource(Preferences.asLiveData(Preferences::customFontVariant)) { value = true } addSource(Preferences.asLiveData(Preferences::customFontVariant)) { value = true }
addSource(Preferences.asLiveData(Preferences::secondRowInformation)) { value = true }
addSource(Preferences.asLiveData(Preferences::widgetAlign)) { value = true } addSource(Preferences.asLiveData(Preferences::widgetAlign)) { value = true }
addSource(Preferences.asLiveData(Preferences::widgetMargin)) { value = true } addSource(Preferences.asLiveData(Preferences::widgetMargin)) { value = true }
addSource(Preferences.asLiveData(Preferences::widgetPadding)) { value = true } addSource(Preferences.asLiveData(Preferences::widgetPadding)) { value = true }

View File

@ -7,7 +7,6 @@ import android.content.Intent
import android.graphics.Color import android.graphics.Color
import android.graphics.Typeface import android.graphics.Typeface
import android.text.format.DateUtils import android.text.format.DateUtils
import android.util.Log
import android.util.TypedValue import android.util.TypedValue
import android.view.Gravity import android.view.Gravity
import android.view.LayoutInflater import android.view.LayoutInflater
@ -16,7 +15,6 @@ import android.view.ViewGroup
import android.widget.* import android.widget.*
import androidx.core.content.ContextCompat import androidx.core.content.ContextCompat
import androidx.core.view.isVisible import androidx.core.view.isVisible
import androidx.core.view.updateMargins
import com.tommasoberlose.anotherwidget.R import com.tommasoberlose.anotherwidget.R
import com.tommasoberlose.anotherwidget.databinding.LeftAlignedWidgetBinding import com.tommasoberlose.anotherwidget.databinding.LeftAlignedWidgetBinding
import com.tommasoberlose.anotherwidget.db.EventRepository import com.tommasoberlose.anotherwidget.db.EventRepository
@ -26,7 +24,6 @@ import com.tommasoberlose.anotherwidget.global.Preferences
import com.tommasoberlose.anotherwidget.helpers.* import com.tommasoberlose.anotherwidget.helpers.*
import com.tommasoberlose.anotherwidget.helpers.ColorHelper.toIntValue import com.tommasoberlose.anotherwidget.helpers.ColorHelper.toIntValue
import com.tommasoberlose.anotherwidget.helpers.ImageHelper.applyShadow import com.tommasoberlose.anotherwidget.helpers.ImageHelper.applyShadow
import com.tommasoberlose.anotherwidget.receivers.CrashlyticsReceiver
import com.tommasoberlose.anotherwidget.receivers.NewCalendarEventReceiver import com.tommasoberlose.anotherwidget.receivers.NewCalendarEventReceiver
import com.tommasoberlose.anotherwidget.receivers.WidgetClickListenerReceiver import com.tommasoberlose.anotherwidget.receivers.WidgetClickListenerReceiver
import com.tommasoberlose.anotherwidget.utils.checkGrantedPermission import com.tommasoberlose.anotherwidget.utils.checkGrantedPermission
@ -69,7 +66,6 @@ class AlignedWidget(val context: Context, val rightAligned: Boolean = false) {
views.setViewPadding(R.id.main_layout, padding, padding, padding, padding) views.setViewPadding(R.id.main_layout, padding, padding, padding, padding)
} catch (ex: Exception) { } catch (ex: Exception) {
ex.printStackTrace() ex.printStackTrace()
CrashlyticsReceiver.sendCrash(context, ex)
} }
// Clock // Clock
@ -86,7 +82,6 @@ class AlignedWidget(val context: Context, val rightAligned: Boolean = false) {
views = updateGridView(generatedBinding, views, appWidgetId) views = updateGridView(generatedBinding, views, appWidgetId)
} catch (ex: Exception) { } catch (ex: Exception) {
ex.printStackTrace() ex.printStackTrace()
CrashlyticsReceiver.sendCrash(context, ex)
} }
return views return views
@ -421,7 +416,6 @@ class AlignedWidget(val context: Context, val rightAligned: Boolean = false) {
) )
} catch (ex: Exception) { } catch (ex: Exception) {
ex.printStackTrace() ex.printStackTrace()
CrashlyticsReceiver.sendCrash(context, ex)
} }
return views return views
@ -989,7 +983,6 @@ class AlignedWidget(val context: Context, val rightAligned: Boolean = false) {
return bindingView return bindingView
} catch (ex: Exception) { } catch (ex: Exception) {
ex.printStackTrace() ex.printStackTrace()
CrashlyticsReceiver.sendCrash(context, ex)
return null return null
} }
} }

View File

@ -3,7 +3,6 @@ package com.tommasoberlose.anotherwidget.ui.widgets
import android.app.PendingIntent import android.app.PendingIntent
import android.content.Context import android.content.Context
import android.util.TypedValue import android.util.TypedValue
import android.view.Gravity
import android.view.View import android.view.View
import android.widget.RemoteViews import android.widget.RemoteViews
import com.tommasoberlose.anotherwidget.R import com.tommasoberlose.anotherwidget.R
@ -11,7 +10,6 @@ import com.tommasoberlose.anotherwidget.global.Constants
import com.tommasoberlose.anotherwidget.global.Preferences import com.tommasoberlose.anotherwidget.global.Preferences
import com.tommasoberlose.anotherwidget.helpers.ColorHelper import com.tommasoberlose.anotherwidget.helpers.ColorHelper
import com.tommasoberlose.anotherwidget.helpers.IntentHelper import com.tommasoberlose.anotherwidget.helpers.IntentHelper
import com.tommasoberlose.anotherwidget.receivers.CrashlyticsReceiver
import com.tommasoberlose.anotherwidget.utils.isDarkTheme import com.tommasoberlose.anotherwidget.utils.isDarkTheme
import com.tommasoberlose.anotherwidget.utils.toPixel import com.tommasoberlose.anotherwidget.utils.toPixel
@ -101,7 +99,6 @@ class ClockWidget(val context: Context) {
} }
} catch (ex: Exception) { } catch (ex: Exception) {
ex.printStackTrace() ex.printStackTrace()
CrashlyticsReceiver.sendCrash(context, ex)
} }
return views return views

View File

@ -2,13 +2,11 @@ package com.tommasoberlose.anotherwidget.ui.widgets
import android.Manifest import android.Manifest
import android.app.PendingIntent import android.app.PendingIntent
import android.appwidget.AppWidgetManager
import android.content.Context import android.content.Context
import android.content.Intent import android.content.Intent
import android.graphics.Color import android.graphics.Color
import android.graphics.Typeface import android.graphics.Typeface
import android.text.format.DateUtils import android.text.format.DateUtils
import android.util.Log
import android.util.TypedValue import android.util.TypedValue
import android.view.Gravity import android.view.Gravity
import android.view.LayoutInflater import android.view.LayoutInflater
@ -28,13 +26,11 @@ import com.tommasoberlose.anotherwidget.global.Preferences
import com.tommasoberlose.anotherwidget.helpers.* import com.tommasoberlose.anotherwidget.helpers.*
import com.tommasoberlose.anotherwidget.helpers.ColorHelper.toIntValue import com.tommasoberlose.anotherwidget.helpers.ColorHelper.toIntValue
import com.tommasoberlose.anotherwidget.helpers.ImageHelper.applyShadow import com.tommasoberlose.anotherwidget.helpers.ImageHelper.applyShadow
import com.tommasoberlose.anotherwidget.receivers.CrashlyticsReceiver
import com.tommasoberlose.anotherwidget.receivers.NewCalendarEventReceiver import com.tommasoberlose.anotherwidget.receivers.NewCalendarEventReceiver
import com.tommasoberlose.anotherwidget.receivers.WidgetClickListenerReceiver import com.tommasoberlose.anotherwidget.receivers.WidgetClickListenerReceiver
import com.tommasoberlose.anotherwidget.utils.checkGrantedPermission import com.tommasoberlose.anotherwidget.utils.checkGrantedPermission
import com.tommasoberlose.anotherwidget.utils.convertDpToPixel import com.tommasoberlose.anotherwidget.utils.convertDpToPixel
import com.tommasoberlose.anotherwidget.utils.isDarkTheme import com.tommasoberlose.anotherwidget.utils.isDarkTheme
import com.tommasoberlose.anotherwidget.utils.toPixel
import java.text.DateFormat import java.text.DateFormat
import java.util.* import java.util.*
import java.util.concurrent.TimeUnit import java.util.concurrent.TimeUnit
@ -72,7 +68,6 @@ class StandardWidget(val context: Context) {
views.setViewPadding(R.id.main_layout, padding, padding, padding, padding) views.setViewPadding(R.id.main_layout, padding, padding, padding, padding)
} catch (ex: Exception) { } catch (ex: Exception) {
ex.printStackTrace() ex.printStackTrace()
CrashlyticsReceiver.sendCrash(context, ex)
} }
// Clock // Clock
@ -89,7 +84,6 @@ class StandardWidget(val context: Context) {
views = updateGridView(generatedBinding, views, appWidgetId) views = updateGridView(generatedBinding, views, appWidgetId)
} catch (ex: Exception) { } catch (ex: Exception) {
ex.printStackTrace() ex.printStackTrace()
CrashlyticsReceiver.sendCrash(context, ex)
} }
return views return views
@ -447,7 +441,6 @@ class StandardWidget(val context: Context) {
} }
} catch (ex: Exception) { } catch (ex: Exception) {
ex.printStackTrace() ex.printStackTrace()
CrashlyticsReceiver.sendCrash(context, ex)
} }
return views return views
@ -1025,7 +1018,6 @@ class StandardWidget(val context: Context) {
} catch (ex: Exception) { } catch (ex: Exception) {
ex.printStackTrace() ex.printStackTrace()
CrashlyticsReceiver.sendCrash(context, ex)
return null return null
} }
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 284 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 302 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 348 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 483 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 590 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.1 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 194 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 179 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 220 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 348 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 389 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 337 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 221 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 377 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 575 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 746 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 348 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 289 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 389 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 590 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 780 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

After

Width:  |  Height:  |  Size: 107 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 483 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 383 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 590 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 893 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 95 KiB

After

Width:  |  Height:  |  Size: 178 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 590 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 520 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 780 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@ -3,9 +3,9 @@
<item> <item>
<shape android:shape="rectangle"> <shape android:shape="rectangle">
<corners <corners
android:radius="9dp" /> android:radius="20dp" />
<solid <solid
android:color="@android:color/white"/> android:color="@color/colorPrimary"/>
</shape> </shape>
</item> </item>
</selector> </selector>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="oval">
<stroke android:color="@android:color/white"
android:width="2dp" />
</shape>
</item>
</selector>

View File

@ -0,0 +1,19 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="20dp"
android:height="20dp"
android:viewportWidth="20"
android:viewportHeight="20"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M16.5,10h-3.04c-0.52,0 -1.02,0.27 -1.28,0.73C11.75,11.49 10.94,12 10,12s-1.75,-0.51 -2.18,-1.27C7.56,10.27 7.07,10 6.54,10H3.5C2.67,10 2,10.67 2,11.5v4C2,16.33 2.67,17 3.5,17h13c0.83,0 1.5,-0.67 1.5,-1.5v-4C18,10.67 17.33,10 16.5,10z"/>
<path
android:fillColor="@android:color/white"
android:pathData="M10,3L10,3C9.59,3 9.25,3.34 9.25,3.75v2.5C9.25,6.66 9.59,7 10,7h0c0.41,0 0.75,-0.34 0.75,-0.75v-2.5C10.75,3.34 10.41,3 10,3z"/>
<path
android:fillColor="@android:color/white"
android:pathData="M16.36,5.64L16.36,5.64c-0.29,-0.29 -0.77,-0.29 -1.06,0L13.54,7.4c-0.29,0.29 -0.29,0.77 0,1.06l0,0c0.29,0.29 0.77,0.29 1.06,0l1.77,-1.77C16.66,6.4 16.66,5.93 16.36,5.64z"/>
<path
android:fillColor="@android:color/white"
android:pathData="M6.46,7.4L4.7,5.64c-0.29,-0.29 -0.77,-0.29 -1.06,0l0,0c-0.29,0.29 -0.29,0.77 0,1.06L5.4,8.46c0.29,0.29 0.77,0.29 1.06,0l0,0C6.76,8.17 6.76,7.7 6.46,7.4z"/>
</vector>

View File

@ -0,0 +1,19 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M20.45,6.55L20.45,6.55c-0.38,-0.38 -1.01,-0.38 -1.39,0L16.89,8.7c-0.39,0.38 -0.39,1.01 0,1.39l0.01,0.01c0.39,0.39 1.01,0.39 1.4,0c0.62,-0.63 1.52,-1.54 2.15,-2.17C20.83,7.55 20.83,6.93 20.45,6.55z"/>
<path
android:fillColor="@android:color/white"
android:pathData="M12.02,3h-0.03C11.44,3 11,3.44 11,3.98v3.03C11,7.56 11.44,8 11.98,8h0.03C12.56,8 13,7.56 13,7.02V3.98C13,3.44 12.56,3 12.02,3z"/>
<path
android:fillColor="@android:color/white"
android:pathData="M7.1,10.11l0.01,-0.01c0.38,-0.38 0.38,-1.01 0,-1.39L4.96,6.54c-0.38,-0.39 -1.01,-0.39 -1.39,0L3.55,6.55c-0.39,0.39 -0.39,1.01 0,1.39c0.63,0.62 1.53,1.54 2.15,2.17C6.09,10.49 6.72,10.49 7.1,10.11z"/>
<path
android:fillColor="@android:color/white"
android:pathData="M12,15c-1.24,0 -2.31,-0.75 -2.76,-1.83C8.92,12.43 8.14,12 7.34,12L4,12c-1.1,0 -2,0.9 -2,2l0,5c0,1.1 0.9,2 2,2h16c1.1,0 2,-0.9 2,-2v-5c0,-1.1 -0.9,-2 -2,-2l-3.34,0c-0.8,0 -1.58,0.43 -1.9,1.17C14.31,14.25 13.24,15 12,15"/>
</vector>

View File

@ -1,4 +1,6 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:clipChildren="false" android:clipChildren="false"
@ -146,7 +148,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:cropToPadding="false" android:cropToPadding="false"
android:clipChildren="false" android:clipChildren="false"
android:layout_marginTop="2dp" android:layout_marginTop="3dp"
android:layout_marginEnd="4dp"> android:layout_marginEnd="4dp">
<ImageView <ImageView
android:layout_width="16dp" android:layout_width="16dp"

View File

@ -1,6 +1,7 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
xmlns:tools="http://schemas.android.com/tools"
android:layout_gravity="center" android:layout_gravity="center"
android:clipChildren="false" android:clipChildren="false"
android:clipToPadding="false" android:clipToPadding="false"
@ -206,12 +207,12 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="center" android:gravity="center"
android:visibility="gone" android:visibility="gone"
android:layout_marginStart="4dp"
android:id="@+id/weather_sub_line"> android:id="@+id/weather_sub_line">
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginEnd="8dp" android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:id="@+id/weather_sub_line_divider" android:id="@+id/weather_sub_line_divider"
android:text="@string/divider" android:text="@string/divider"
android:includeFontPadding="false" android:includeFontPadding="false"
@ -221,7 +222,7 @@
android:layout_height="20dp" android:layout_height="20dp"
android:id="@+id/weather_sub_line_weather_icon" android:id="@+id/weather_sub_line_weather_icon"
android:layout_marginStart="4dp" android:layout_marginStart="4dp"
android:layout_marginEnd="8dp"/> android:layout_marginEnd="4dp"/>
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"

View File

@ -19,6 +19,7 @@
<color name="colorPrimaryDark">#F8F8F8</color> <color name="colorPrimaryDark">#F8F8F8</color>
<color name="colorAccent">#0092ca</color> <color name="colorAccent">#0092ca</color>
<color name="colorAccent_op10">#1A1089FF</color> <color name="colorAccent_op10">#1A1089FF</color>
<color name="colorAccent_op20">#331089FF</color>
<color name="colorAccent_op30">#4D1089FF</color> <color name="colorAccent_op30">#4D1089FF</color>
<color name="colorTitle">#1089FF</color> <color name="colorTitle">#1089FF</color>
<color name="black_op10">#1A000000</color> <color name="black_op10">#1A000000</color>

View File

@ -10,12 +10,12 @@ buildscript {
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:4.2.0' classpath 'com.android.tools.build:gradle:7.0.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.5' classpath 'com.google.gms:google-services:4.3.8'
// Add the Crashlytics Gradle plugin. // Add the Crashlytics Gradle plugin.
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.5.2' classpath 'com.google.firebase:firebase-crashlytics-gradle:2.6.1'
classpath 'io.realm:realm-gradle-plugin:10.4.0' classpath 'io.realm:realm-gradle-plugin:10.4.0'

View File

@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip