Skip to content

Commit

Permalink
Fix deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
jdelga committed Dec 5, 2024
1 parent d05defa commit 2ee5a07
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ import android.util.Log
import androidx.core.content.FileProvider
import com.elvishew.xlog.XLog
import com.elvishew.xlog.flattener.ClassicFlattener
import com.elvishew.xlog.flattener.Flattener2
import com.elvishew.xlog.printer.file.FilePrinter
import com.elvishew.xlog.printer.file.backup.FileSizeBackupStrategy
import com.elvishew.xlog.printer.file.backup.BackupStrategy2.NO_LIMIT
import com.elvishew.xlog.printer.file.backup.FileSizeBackupStrategy2
import com.elvishew.xlog.printer.file.naming.ChangelessFileNameGenerator
import com.telefonica.androidlogger.domain.LogPriority
import com.telefonica.androidlogger.io.executor.Executor
Expand All @@ -33,8 +35,8 @@ internal open class AppFileLogger(
open fun init() {
logPrinter = FilePrinter.Builder(appContext.cacheDir.path)
.fileNameGenerator(ChangelessFileNameGenerator(PERSISTED_LOGS_FILE_NAME))
.backupStrategy(FileSizeBackupStrategy(MAX_PERSISTED_LOGS_FILE_SIZE_BYTES))
.logFlattener(ClassicFlattener())
.backupStrategy(FileSizeBackupStrategy2(MAX_PERSISTED_LOGS_FILE_SIZE_BYTES, NO_LIMIT))
.flattener(ClassicFlattener())
.build()
.apply {
XLog.init(this)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,35 +11,32 @@ import android.os.Handler
import android.os.Looper
import android.util.TypedValue
import android.view.LayoutInflater
import android.view.View
import android.view.Menu
import android.view.MenuItem
import android.view.View
import android.view.ViewGroup
import android.widget.CompoundButton
import android.widget.TextView
import android.widget.Toast
import androidx.annotation.AttrRes
import androidx.annotation.ColorInt

import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.widget.SearchView
import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProvider
import androidx.recyclerview.widget.DefaultItemAnimator
import androidx.recyclerview.widget.DividerItemDecoration
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.google.android.material.chip.Chip
import com.google.android.material.chip.ChipGroup

import com.telefonica.androidlogger.R
import com.telefonica.androidlogger.ui.adapter.LogListAdapter
import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProviders
import com.telefonica.androidlogger.domain.LogCategory
import com.telefonica.androidlogger.io.executor.TaskCallback
import com.telefonica.androidlogger.ui.adapter.LogListAdapter
import com.telefonica.androidlogger.ui.viewmodel.AppLoggerViewModel
import com.telefonica.androidlogger.ui.viewmodel.LogCategoryViewModel
import com.telefonica.androidlogger.ui.viewmodel.LogPriorityViewModel
import java.io.File
import java.security.InvalidParameterException

class AppLoggerActivity : AppCompatActivity() {
Expand All @@ -62,7 +59,7 @@ class AppLoggerActivity : AppCompatActivity() {

setContentView(R.layout.activity_app_logger)

viewModel = ViewModelProviders.of(this)
viewModel = ViewModelProvider(this)
.get(AppLoggerViewModel::class.java)
.apply {
init(intent.getStringArrayListExtra(EXTRA_CATEGORIES_NAMES) ?: emptyList())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ internal class AppLoggerViewModel : ViewModel() {
} ?: this

private fun String.lowerCaseContains(anotherString: String) =
toLowerCase(Locale.ROOT).contains(anotherString.toLowerCase(Locale.ROOT))
lowercase(Locale.ROOT).contains(anotherString.lowercase(Locale.ROOT))

private fun List<LogEntry>.filterBySelectedCategories(): List<LogEntry> {
val isEmptyCategoriesSelection = selectedCategories.isEmpty()
Expand Down

0 comments on commit 2ee5a07

Please sign in to comment.