Skip to content

Commit

Permalink
Replace log with timber
Browse files Browse the repository at this point in the history
  • Loading branch information
hieuwu committed Dec 21, 2023
1 parent 0136b17 commit 393a25f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 19 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package dev.arkbuilders.navigator.presentation.screen.folders

import android.util.Log
import androidx.lifecycle.ViewModel
import androidx.lifecycle.ViewModelProvider
import androidx.lifecycle.viewModelScope
Expand All @@ -23,6 +22,7 @@ import org.orbitmvi.orbit.syntax.simple.intent
import org.orbitmvi.orbit.syntax.simple.postSideEffect
import org.orbitmvi.orbit.syntax.simple.reduce
import org.orbitmvi.orbit.viewmodel.container
import timber.log.Timber
import java.nio.file.Path
import javax.inject.Inject

Expand Down Expand Up @@ -125,13 +125,13 @@ class FoldersViewModel @Inject constructor(
}

if (deleteFromMemory) {
Log.d(
Timber.d(
LogTags.FOLDERS_TREE,
"forgetting and deleting root folder $root"
)
foldersRepo.deleteRoot(root)
} else {
Log.d(
Timber.d(
LogTags.FOLDERS_TREE,
"forgetting root folder $root"
)
Expand All @@ -158,13 +158,13 @@ class FoldersViewModel @Inject constructor(
)
}
if (deleteFromMemory) {
Log.d(
Timber.d(
LogTags.FOLDERS_TREE,
"forgetting and deleting favorite $favorite"
)
foldersRepo.deleteFavorite(root, favorite)
} else {
Log.d(
Timber.d(
LogTags.FOLDERS_TREE,
"forgetting favorite $favorite"
)
Expand Down Expand Up @@ -205,7 +205,7 @@ class FoldersViewModel @Inject constructor(
)
}

Log.d(LogTags.FOLDERS_SCREEN, "root $root added in RootsPresenter")
Timber.d(LogTags.FOLDERS_SCREEN, "root $root added in RootsPresenter")
val path = withContext(defaultDispatcher) {
root.toRealPath()
}
Expand Down Expand Up @@ -245,7 +245,7 @@ class FoldersViewModel @Inject constructor(
ProgressWithText(true, "Adding favorite folder")
)
}
Log.d(
Timber.d(
LogTags.FOLDERS_SCREEN,
"favorite $favorite added in RootsPresenter"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import android.content.ActivityNotFoundException
import android.content.Intent
import android.net.Uri
import android.os.Bundle
import android.util.Log
import android.util.TypedValue
import android.view.View
import android.widget.Toast
Expand Down Expand Up @@ -74,7 +73,7 @@ class GalleryFragment :
)
.toMutableList(),
).apply {
Log.d(GALLERY_SCREEN, "creating GalleryPresenter")
Timber.d(GALLERY_SCREEN, "creating GalleryPresenter")
App.instance.appComponent.inject(this)
}
}
Expand All @@ -85,7 +84,7 @@ class GalleryFragment :
}

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
Log.d(GALLERY_SCREEN, "view created in GalleryFragment")
Timber.d(GALLERY_SCREEN, "view created in GalleryFragment")
super.onViewCreated(view, savedInstanceState)
App.instance.appComponent.inject(this)
}
Expand All @@ -96,7 +95,7 @@ class GalleryFragment :
}

override fun init() {
Log.d(GALLERY_SCREEN, "currentItem = ${binding.viewPager.currentItem}")
Timber.d(GALLERY_SCREEN, "currentItem = ${binding.viewPager.currentItem}")

animatePagerAppearance()
initResultListener()
Expand Down Expand Up @@ -306,7 +305,7 @@ class GalleryFragment :

override fun displayPreviewTags(resource: ResourceId, tags: Tags) {
lifecycleScope.launch {
Log.d(
Timber.d(
GALLERY_SCREEN,
"displaying tags of resource $resource for preview"
)
Expand All @@ -329,7 +328,7 @@ class GalleryFragment :
override fun showEditTagsDialog(
resource: ResourceId
) {
Log.d(
Timber.d(
GALLERY_SCREEN,
"showing [edit-tags] dialog for resource $resource"
)
Expand Down Expand Up @@ -501,9 +500,10 @@ class GalleryFragment :
actionType: String,
detachProcess: Boolean
) {
Log.i(GALLERY_SCREEN, "Opening resource in an external application")
Log.i(GALLERY_SCREEN, "path: $resourcePath")
Log.i(GALLERY_SCREEN, "action: $actionType")
Timber.i(GALLERY_SCREEN, "Opening resource in an external application " +
"path: $resourcePath" +
"action: $actionType"
)

val intent = getExternalAppIntent(resourcePath, actionType, detachProcess)
val title = when (actionType) {
Expand Down Expand Up @@ -544,8 +544,10 @@ class GalleryFragment :
addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
}
}
Log.d(GALLERY_SCREEN, "URI: ${intent.data}")
Log.d(GALLERY_SCREEN, "MIME: ${intent.type}")
Timber.d(
GALLERY_SCREEN, "URI: ${intent.data}" +
"MIME: ${intent.type}"
)
return intent
}

Expand All @@ -570,7 +572,7 @@ class GalleryFragment :

setOnClickListener {
val position = binding.viewPager.currentItem
Log.d(
Timber.d(
GALLERY_SCREEN,
"[edit_tags] clicked at position $position"
)
Expand Down

0 comments on commit 393a25f

Please sign in to comment.