Skip to content

Commit

Permalink
Upgrade Gradle; fix crashes on Android L; add checkbox to turn crash …
Browse files Browse the repository at this point in the history
…collection on or off (off by default).
  • Loading branch information
Mikhail Barashkov committed Jul 29, 2021
1 parent c61c907 commit 56097f4
Show file tree
Hide file tree
Showing 12 changed files with 57 additions and 12 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ android {
applicationId "com.handydev.financier"
minSdkVersion 21
targetSdkVersion 29
versionCode 217
versionName "2.0.17"
versionCode 218
versionName "2.0.18"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
multiDexEnabled true
javaCompileOptions {
Expand Down
5 changes: 5 additions & 0 deletions app/src/googleplay/res/xml/preferences.xml
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,11 @@
android:key="restore_missed_scheduled_transactions"
android:summary="@string/restore_missed_scheduled_transactions_summary"
android:title="@string/restore_missed_scheduled_transactions" />
<CheckBoxPreference
android:defaultValue="false"
android:key="acra.enable"
android:summary="@string/enable_crash_reporting_summary"
android:title="@string/enable_crash_reporting" />
</PreferenceCategory>

</PreferenceScreen>
11 changes: 11 additions & 0 deletions app/src/main/assets/whatsnew.htm
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,17 @@
</head>
<body>

<p><b>2.0.18</b></p>
<p>
[*]Fix crashes on Android L.
[+]Add checkbox to turn off crash collection.
</p>

<p><b>2.0.17</b></p>
<p>
[+]Crash reports using Acra service.
</p>

<p><b>2.0.16</b></p>
<p>
[*]Crash fixed when going back from Add Category screen.<br/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
package com.handydev.financier

import android.content.Context
import android.preference.PreferenceManager
import androidx.multidex.MultiDexApplication
import com.handydev.financier.activity.PreferencesActivity
import com.handydev.financier.utils.MyPreferences
import org.acra.ACRA
import org.acra.config.httpSender
import org.acra.data.StringFormat
Expand All @@ -12,6 +15,10 @@ import java.lang.RuntimeException
open class FinancierApplication : MultiDexApplication() {
override fun attachBaseContext(base: Context) {
super.attachBaseContext(base)
val acraPrefExists = PreferenceManager.getDefaultSharedPreferences(this).contains("acra.enable")
if(!acraPrefExists) {
PreferenceManager.getDefaultSharedPreferences(this).edit().putBoolean("acra.enable", false).commit()
}

initAcra {
//core configuration:
Expand All @@ -24,6 +31,6 @@ open class FinancierApplication : MultiDexApplication() {
httpMethod = HttpSender.Method.POST
}
}
ACRA.DEV_LOGGING = true
//ACRA.DEV_LOGGING = true
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import com.handydev.financier.model.*
import com.handydev.financier.utils.ArrUtils
import com.handydev.financier.utils.TransactionUtils
import com.handydev.financier.utils.Utils
import com.handydev.financier.utils.getColorHelper
import com.handydev.financier.view.AttributeView
import com.handydev.financier.view.AttributeViewFactory
import java.util.*
Expand Down Expand Up @@ -128,9 +129,10 @@ class CategorySelector<A : AbstractActivity?> @JvmOverloads constructor(private
categoryText = filterNode?.textView
autoCompleteTextView = filterNode?.autoCompleteTextView
if(darkUI) {
categoryText?.setTextColor(activity!!.resources.getColor(R.color.main_text_color, null))
autoCompleteTextView?.setTextColor(activity!!.resources.getColor(R.color.main_text_color, null))
autoCompleteTextView?.setHintTextColor(activity!!.resources.getColor(R.color.main_text_color, null))
val color = getColorHelper(activity!!, R.color.main_text_color)
categoryText?.setTextColor(color)
autoCompleteTextView?.setTextColor(color)
autoCompleteTextView?.setHintTextColor(color)
}
return categoryText
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import com.handydev.financier.model.MultiChoiceItem
import com.handydev.financier.model.MyEntity
import com.handydev.financier.utils.ArrUtils
import com.handydev.financier.utils.Utils
import com.handydev.financier.utils.getColorHelper
import java.util.*

abstract class MyEntitySelector<T : MyEntity, A : AbstractActivity?> internal constructor(
Expand Down Expand Up @@ -68,9 +69,10 @@ abstract class MyEntitySelector<T : MyEntity, A : AbstractActivity?> internal co
node = filterNode!!.nodeLayout
autoCompleteView = filterNode!!.autoCompleteTextView
if(darkUI) {
text?.setTextColor(activity!!.resources.getColor(R.color.main_text_color, null))
autoCompleteView?.setTextColor(activity!!.resources.getColor(R.color.main_text_color, null))
autoCompleteView?.setHintTextColor(activity!!.resources.getColor(R.color.main_text_color, null))
val color = getColorHelper(activity!!, R.color.main_text_color)
text?.setTextColor(color)
autoCompleteView?.setTextColor(color)
autoCompleteView?.setHintTextColor(color)
}
}
return text
Expand Down
11 changes: 11 additions & 0 deletions app/src/main/java/com/handydev/financier/utils/Utils.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.handydev.financier.utils

import android.content.Context
import android.os.Build
import androidx.annotation.ColorInt
import androidx.annotation.ColorRes

@Suppress("DEPRECATION")
@ColorInt
fun getColorHelper(context: Context, @ColorRes id: Int) =
if (Build.VERSION.SDK_INT >= 23) context.getColor(id) else context.resources.getColor(id);
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import com.handydev.financier.BuildConfig
import com.handydev.financier.R
import com.handydev.financier.activity.RequestPermission
import com.handydev.financier.utils.PicturesUtil
import com.handydev.financier.utils.getColorHelper

class NodeInflater(var inflater: LayoutInflater) {

Expand Down Expand Up @@ -45,7 +46,7 @@ class NodeInflater(var inflater: LayoutInflater) {
val labelView = v.findViewById<TextView>(R.id.label)
labelView.setText(labelId)
if (darkUI) {
labelView.setTextColor(inflater.context.resources.getColor(R.color.main_text_color, null))
labelView.setTextColor(getColorHelper(inflater.context, R.color.main_text_color))
}
return this
}
Expand Down
3 changes: 3 additions & 0 deletions app/src/main/res/values-ru/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -945,5 +945,8 @@
<string name="create_new_entity_with_title">%1$s: не удалось найти \"%2$s\"? Создать новую сущность?</string>
<string name="complete_category_selection">Категория: не удалось найти \"%s\"? Создайте новую категорию нажав кнопку +.</string>
<string name="list_all">Список</string>
<string name="enable_crash_reporting">Позволить отправлять отчёты о ошибках</string>
<string name="enable_crash_reporting_summary">Ошибки собираются и отправляются с использованием открытой библиотеки ACRA на наш внутренний сервер Acrarium, без передачи личных данных</string>


</resources>
3 changes: 3 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1003,6 +1003,9 @@
<string name="list_all">List all</string>
<string name="type_template">Type template…</string>

<string name="enable_crash_reporting">Allow to send anonymous crash reports</string>
<string name="enable_crash_reporting_summary">Crashes are collected and sent using the open-source ACRA library to our internal Acrarium server</string>

<string-array name="entity_selector_entities">
<item>Show Filter</item>
<item>Show List</item>
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.2.2'
classpath 'com.android.tools.build:gradle:7.0.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}

Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip

0 comments on commit 56097f4

Please sign in to comment.