Skip to content

Commit

Permalink
Update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
Domi04151309 committed Jun 8, 2023
1 parent db5e0bc commit 4db4138
Show file tree
Hide file tree
Showing 11 changed files with 55 additions and 46 deletions.
6 changes: 3 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ preBuild.doFirst {
}

dependencies {
implementation 'androidx.appcompat:appcompat:1.4.2'
implementation 'androidx.preference:preference-ktx:1.1.1'
implementation "androidx.recyclerview:recyclerview:1.2.1"
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'androidx.preference:preference-ktx:1.2.0'
implementation "androidx.recyclerview:recyclerview:1.3.0"
implementation 'com.jaredrummler:colorpicker:1.1.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'com.android.volley:volley:1.2.1'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,10 @@ class AlwaysOnCustomView : View {
}

constructor(context: Context) : super(context) {
init()
init(context)
}

private fun init(context: Context? = null) {
private fun init(context: Context) {
prefs = P(PreferenceManager.getDefaultSharedPreferences(context))

padding2 = dpToPx(2f).toInt()
Expand Down Expand Up @@ -221,7 +221,7 @@ class AlwaysOnCustomView : View {
else "h:mm"
} else "H:mm", Locale.getDefault()
)
if (Permissions.hasCalendarPermission(context ?: throw IllegalStateException())) {
if (Permissions.hasCalendarPermission(context)) {
val cursor = context.contentResolver.query(
CalendarContract.Events.CONTENT_URI,
arrayOf("title", "dtstart", "dtend"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,19 @@ class LAFBackgroundActivity : AppCompatActivity() {
true
}
if (Build.VERSION.SDK_INT < 28)
preferenceScreen.removePreference(findPreference("hide_display_cutouts"))
preferenceScreen.removePreference(
findPreference("hide_display_cutouts") ?: throw IllegalStateException()
)
}

override fun onStart() {
super.onStart()
preferenceManager.sharedPreferences.registerOnSharedPreferenceChangeListener(this)
preferenceManager.sharedPreferences?.registerOnSharedPreferenceChangeListener(this)
}

override fun onStop() {
super.onStop()
preferenceManager.sharedPreferences.unregisterOnSharedPreferenceChangeListener(this)
preferenceManager.sharedPreferences?.unregisterOnSharedPreferenceChangeListener(this)
}

override fun onSharedPreferenceChanged(p0: SharedPreferences?, p1: String?) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class LAFBehaviorActivity : AppCompatActivity() {
startActivity(Intent(context, LAFBrightnessActivity::class.java))
true
}
if (!preferenceManager.sharedPreferences.getBoolean(P.ROOT_MODE, false)) {
if (preferenceManager.sharedPreferences?.getBoolean(P.ROOT_MODE, false) != true) {
findPreference<SwitchPreference>(P.POWER_SAVING_MODE)?.isEnabled = false
findPreference<SwitchPreference>(P.DISABLE_HEADS_UP_NOTIFICATIONS)
?.isEnabled = false
Expand All @@ -41,12 +41,12 @@ class LAFBehaviorActivity : AppCompatActivity() {

override fun onStart() {
super.onStart()
preferenceManager.sharedPreferences.registerOnSharedPreferenceChangeListener(this)
preferenceManager.sharedPreferences?.registerOnSharedPreferenceChangeListener(this)
}

override fun onStop() {
super.onStop()
preferenceManager.sharedPreferences.unregisterOnSharedPreferenceChangeListener(this)
preferenceManager.sharedPreferences?.unregisterOnSharedPreferenceChangeListener(this)
}

override fun onSharedPreferenceChanged(p0: SharedPreferences?, p1: String?) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class LAFFilterNotificationsActivity : AppCompatActivity() {
override fun onStart() {
super.onStart()
blockedArray = JSONArray(
preferenceManager.sharedPreferences.getString("blocked_notifications", "[]")
preferenceManager.sharedPreferences?.getString("blocked_notifications", "[]")
)
if (!JSON.isEmpty(blockedArray)) {
blocked.removeAll()
Expand Down Expand Up @@ -83,9 +83,9 @@ class LAFFilterNotificationsActivity : AppCompatActivity() {

override fun onStop() {
super.onStop()
preferenceManager.sharedPreferences.edit()
.putString("blocked_notifications", blockedArray.toString())
.apply()
preferenceManager.sharedPreferences?.edit()
?.putString("blocked_notifications", blockedArray.toString())
?.apply()
AlwaysOn.finish()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class LAFRulesActivity : AppCompatActivity() {
rulesBatteryLevel = findPreference(P.RULES_BATTERY) ?: return
rulesTime = findPreference("rules_time") ?: return
rulesTimeout = findPreference(P.RULES_TIMEOUT) ?: return
val is24Hour = !preferenceManager.sharedPreferences.getBoolean("hour", false)
val is24Hour = preferenceManager.sharedPreferences?.getBoolean("hour", false) != true

if (!Permissions.isNotificationServiceEnabled(requireContext())) {
var currentPref: Preference?
Expand Down Expand Up @@ -99,17 +99,17 @@ class LAFRulesActivity : AppCompatActivity() {
TimePickerDialog(
context,
{ _, selectedStartHour, selectedStartMinute ->
preferenceManager.sharedPreferences.edit().putString(
preferenceManager.sharedPreferences?.edit()?.putString(
"rules_time_start",
formatTime(selectedStartHour, selectedStartMinute)
).apply()
)?.apply()
TimePickerDialog(
context,
{ _, selectedEndHour, selectedEndMinute ->
preferenceManager.sharedPreferences.edit().putString(
preferenceManager.sharedPreferences?.edit()?.putString(
"rules_time_end",
formatTime(selectedEndHour, selectedEndMinute)
).apply()
)?.apply()
},
parseInt(rulesTimeEndValue.substringBefore(":")),
parseInt(rulesTimeEndValue.substringAfter(":")),
Expand All @@ -126,21 +126,27 @@ class LAFRulesActivity : AppCompatActivity() {

private fun updateSummaries() {
val rulesBatteryLevelValue =
preferenceManager.sharedPreferences.getInt(P.RULES_BATTERY, P.RULES_BATTERY_DEFAULT)
rulesTimeStartValue = preferenceManager.sharedPreferences.getString(
preferenceManager.sharedPreferences?.getInt(
P.RULES_BATTERY,
P.RULES_BATTERY_DEFAULT
) ?: P.RULES_BATTERY_DEFAULT
rulesTimeStartValue = preferenceManager.sharedPreferences?.getString(
"rules_time_start",
DEFAULT_START_TIME
)
?: DEFAULT_START_TIME
) ?: DEFAULT_START_TIME
rulesTimeEndValue =
preferenceManager.sharedPreferences.getString("rules_time_end", DEFAULT_END_TIME)
preferenceManager.sharedPreferences?.getString("rules_time_end", DEFAULT_END_TIME)
?: DEFAULT_END_TIME
val rulesTimeoutValue =
preferenceManager.sharedPreferences.getInt(P.RULES_TIMEOUT, P.RULES_TIMEOUT_DEFAULT)
preferenceManager.sharedPreferences?.getInt(
P.RULES_TIMEOUT,
P.RULES_TIMEOUT_DEFAULT
) ?: P.RULES_TIMEOUT_DEFAULT

if (rulesBatteryLevelValue > 100) {
preferenceManager.sharedPreferences.edit().putInt(P.RULES_BATTERY, 100)
.apply()
preferenceManager.sharedPreferences?.edit()
?.putInt(P.RULES_BATTERY, 100)
?.apply()
return
}

Expand Down Expand Up @@ -173,12 +179,12 @@ class LAFRulesActivity : AppCompatActivity() {

override fun onStart() {
super.onStart()
preferenceManager.sharedPreferences.registerOnSharedPreferenceChangeListener(this)
preferenceManager.sharedPreferences?.registerOnSharedPreferenceChangeListener(this)
}

override fun onStop() {
super.onStop()
preferenceManager.sharedPreferences.unregisterOnSharedPreferenceChangeListener(this)
preferenceManager.sharedPreferences?.unregisterOnSharedPreferenceChangeListener(this)
}

override fun onSharedPreferenceChanged(p0: SharedPreferences?, p1: String?) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ class LAFWFColorsActivity : AppCompatActivity() {

override fun onStart() {
super.onStart()
preferenceManager.sharedPreferences.registerOnSharedPreferenceChangeListener(this)
preferenceManager.sharedPreferences?.registerOnSharedPreferenceChangeListener(this)
}

override fun onStop() {
super.onStop()
preferenceManager.sharedPreferences.unregisterOnSharedPreferenceChangeListener(this)
preferenceManager.sharedPreferences?.unregisterOnSharedPreferenceChangeListener(this)
}

override fun onSharedPreferenceChanged(p0: SharedPreferences?, p1: String?) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class LAFWatchFaceActivity : AppCompatActivity() {
val dialogView = layoutInflater.inflate(R.layout.dialog_edit_text, null, false)
val editText = dialogView.findViewById<EditText>(R.id.editText)
editText.setText(
preferenceManager.sharedPreferences.getString(
preferenceManager.sharedPreferences?.getString(
P.DATE_FORMAT,
P.DATE_FORMAT_DEFAULT
)
Expand All @@ -101,8 +101,9 @@ class LAFWatchFaceActivity : AppCompatActivity() {
dialog.getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener {
try {
SimpleDateFormat(editText.text.toString(), Locale.getDefault())
preferenceManager.sharedPreferences.edit()
.putString(P.DATE_FORMAT, editText.text.toString()).apply()
preferenceManager.sharedPreferences?.edit()
?.putString(P.DATE_FORMAT, editText.text.toString())
?.apply()
dialog.dismiss()
} catch (e: Exception) {
Toast.makeText(
Expand Down Expand Up @@ -144,12 +145,12 @@ class LAFWatchFaceActivity : AppCompatActivity() {

override fun onStart() {
super.onStart()
preferenceManager.sharedPreferences.registerOnSharedPreferenceChangeListener(this)
preferenceManager.sharedPreferences?.registerOnSharedPreferenceChangeListener(this)
}

override fun onStop() {
super.onStop()
preferenceManager.sharedPreferences.unregisterOnSharedPreferenceChangeListener(this)
preferenceManager.sharedPreferences?.unregisterOnSharedPreferenceChangeListener(this)
}

override fun onSharedPreferenceChanged(p0: SharedPreferences?, p1: String?) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class LAFWeatherActivity : AppCompatActivity() {
val dialogView = layoutInflater.inflate(R.layout.dialog_edit_text, null, false)
val editText = dialogView.findViewById<EditText>(R.id.editText)
editText.setText(
preferenceManager.sharedPreferences.getString(
preferenceManager.sharedPreferences?.getString(
P.WEATHER_FORMAT,
P.WEATHER_FORMAT_DEFAULT
)
Expand All @@ -44,8 +44,8 @@ class LAFWeatherActivity : AppCompatActivity() {
.setTitle(R.string.pref_look_and_feel_weather_format)
.setView(dialogView)
.setPositiveButton(android.R.string.ok) { _, _ ->
preferenceManager.sharedPreferences.edit()
.putString(P.WEATHER_FORMAT, editText.text.toString()).apply()
preferenceManager.sharedPreferences?.edit()
?.putString(P.WEATHER_FORMAT, editText.text.toString())?.apply()
}
.setNegativeButton(android.R.string.cancel) { _, _ -> }
.setNeutralButton(R.string.pref_ao_date_format_dialog_neutral) { _, _ ->
Expand Down Expand Up @@ -83,12 +83,12 @@ class LAFWeatherActivity : AppCompatActivity() {

override fun onStart() {
super.onStart()
preferenceManager.sharedPreferences.registerOnSharedPreferenceChangeListener(this)
preferenceManager.sharedPreferences?.registerOnSharedPreferenceChangeListener(this)
}

override fun onStop() {
super.onStop()
preferenceManager.sharedPreferences.unregisterOnSharedPreferenceChangeListener(this)
preferenceManager.sharedPreferences?.unregisterOnSharedPreferenceChangeListener(this)
}

override fun onSharedPreferenceChanged(p0: SharedPreferences?, p1: String?) {
Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.2.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.10"
classpath 'com.android.tools.build:gradle:7.4.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.21"

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Sun Jul 24 15:44:39 CEST 2022
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME

0 comments on commit 4db4138

Please sign in to comment.