Skip to content

Commit

Permalink
[build]: moved setup to standalone module
Browse files Browse the repository at this point in the history
  • Loading branch information
F0x1d committed Jun 29, 2024
1 parent 07ea66c commit ce59aa6
Show file tree
Hide file tree
Showing 122 changed files with 97 additions and 2,169 deletions.
1 change: 1 addition & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ dependencies {
implementation(project(":feature:feature-recordings"))
implementation(project(":feature:feature-recordings-core"))
implementation(project(":feature:feature-settings"))
implementation(project(":feature:feature-setup"))

implementation(libs.insetter)
implementation(libs.bundles.shizuku)
Expand Down
7 changes: 4 additions & 3 deletions app/src/main/kotlin/com/f0x1d/logfox/LogFoxApp.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import com.f0x1d.logfox.context.CRASHES_CHANNEL_ID
import com.f0x1d.logfox.context.LOGGING_STATUS_CHANNEL_ID
import com.f0x1d.logfox.context.RECORDING_STATUS_CHANNEL_ID
import com.f0x1d.logfox.context.notificationManagerCompat
import com.f0x1d.logfox.strings.Strings
import com.google.android.material.color.DynamicColors
import dagger.hilt.android.HiltAndroidApp

Expand All @@ -22,15 +23,15 @@ class LogFoxApp: Application() {
LOGGING_STATUS_CHANNEL_ID,
NotificationManagerCompat.IMPORTANCE_MIN
)
.setName(getString(R.string.logging_status))
.setName(getString(Strings.logging_status))
.setShowBadge(false)
.build()

val crashesChannel = NotificationChannelCompat.Builder(
CRASHES_CHANNEL_ID,
NotificationManagerCompat.IMPORTANCE_HIGH
)
.setName(getString(R.string.crashes))
.setName(getString(Strings.crashes))
.setLightsEnabled(true)
.setVibrationEnabled(true)
.build()
Expand All @@ -39,7 +40,7 @@ class LogFoxApp: Application() {
RECORDING_STATUS_CHANNEL_ID,
NotificationManagerCompat.IMPORTANCE_DEFAULT
)
.setName(getString(R.string.recording_status))
.setName(getString(Strings.recording_status))
.setLightsEnabled(false)
.setVibrationEnabled(false)
.setSound(null, null)
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/kotlin/com/f0x1d/logfox/receiver/BootReceiver.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import com.f0x1d.feature.logging.service.LoggingService
import com.f0x1d.logfox.R
import com.f0x1d.logfox.arch.startForegroundServiceAvailable
import com.f0x1d.logfox.context.hasPermissionToReadLogs
import com.f0x1d.logfox.context.toast
import com.f0x1d.logfox.preferences.shared.AppPreferences
import com.f0x1d.logfox.strings.Strings
import com.f0x1d.logfox.terminals.ShizukuTerminal
import dagger.hilt.android.AndroidEntryPoint
import javax.inject.Inject
Expand All @@ -22,7 +22,7 @@ class BootReceiver: BroadcastReceiver() {
override fun onReceive(context: Context, intent: Intent) {
if (intent.action == Intent.ACTION_BOOT_COMPLETED && appPreferences.startOnBoot) {
if (appPreferences.selectedTerminalIndex == ShizukuTerminal.INDEX) {
context.toast(R.string.shizuku_reminder)
context.toast(Strings.shizuku_reminder)
}

if (context.hasPermissionToReadLogs) {
Expand Down
39 changes: 21 additions & 18 deletions app/src/main/kotlin/com/f0x1d/logfox/ui/activity/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ import android.os.Bundle
import androidx.activity.result.contract.ActivityResultContracts
import androidx.activity.viewModels
import androidx.constraintlayout.widget.ConstraintSet
import androidx.core.os.bundleOf
import androidx.navigation.NavController
import androidx.navigation.NavDestination
import androidx.navigation.fragment.NavHostFragment
import androidx.navigation.ui.setupWithNavController
import androidx.transition.ChangeBounds
import androidx.transition.TransitionManager
import com.f0x1d.logfox.NavGraphDirections
import com.f0x1d.logfox.R
import com.f0x1d.logfox.arch.contrastedNavBarAvailable
import com.f0x1d.logfox.arch.gesturesAvailable
Expand All @@ -23,6 +23,9 @@ import com.f0x1d.logfox.context.hasNotificationsPermission
import com.f0x1d.logfox.context.isHorizontalOrientation
import com.f0x1d.logfox.databinding.ActivityMainBinding
import com.f0x1d.logfox.model.event.Event
import com.f0x1d.logfox.navigation.Directions
import com.f0x1d.logfox.strings.Strings
import com.f0x1d.logfox.ui.Icons
import com.f0x1d.logfox.viewmodel.MainViewModel
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import dagger.hilt.android.AndroidEntryPoint
Expand All @@ -35,8 +38,7 @@ class MainActivity: BaseViewModelActivity<MainViewModel, ActivityMainBinding>(),

private val requestNotificationPermissionLauncher = registerForActivityResult(
ActivityResultContracts.RequestPermission(),
{}
)
) { }

private var barShown = true
private val barScene by lazy {
Expand All @@ -60,7 +62,7 @@ class MainActivity: BaseViewModelActivity<MainViewModel, ActivityMainBinding>(),
@SuppressLint("InlinedApi")
override fun ActivityMainBinding.onCreate(savedInstanceState: Bundle?) {
val navHostFragment = supportFragmentManager.findFragmentById(
R.id.nav_host_fragment_content_main
R.id.nav_host_fragment_content_main,
) as NavHostFragment
navController = navHostFragment.navController

Expand All @@ -73,14 +75,14 @@ class MainActivity: BaseViewModelActivity<MainViewModel, ActivityMainBinding>(),

if (!hasNotificationsPermission() && !viewModel.askedNotificationsPermission) {
MaterialAlertDialogBuilder(this@MainActivity)
.setIcon(R.drawable.ic_dialog_notification_important)
.setTitle(R.string.no_notification_permission)
.setMessage(R.string.notification_permission_is_required)
.setIcon(Icons.ic_dialog_notification_important)
.setTitle(Strings.no_notification_permission)
.setMessage(Strings.notification_permission_is_required)
.setCancelable(false)
.setPositiveButton(android.R.string.ok) { _, _ ->
requestNotificationPermissionLauncher.launch(Manifest.permission.POST_NOTIFICATIONS)
}
.setNegativeButton(R.string.close, null)
.setNegativeButton(Strings.close, null)
.show()

viewModel.askedNotificationsPermission = true
Expand Down Expand Up @@ -108,31 +110,32 @@ class MainActivity: BaseViewModelActivity<MainViewModel, ActivityMainBinding>(),

when (intent.action) {
Intent.ACTION_VIEW -> navController.navigate(
NavGraphDirections.actionGlobalLogsFragment(fileUri = intent.data)
resId = Directions.action_global_logsFragment,
args = bundleOf("file_uri" to intent.data),
)
}
}

override fun onEvent(event: Event) {
when (event.type) {
MainViewModel.EVENT_TYPE_SETUP -> navController.navigate(NavGraphDirections.actionGlobalSetupFragment())
MainViewModel.EVENT_TYPE_SETUP -> navController.navigate(Directions.action_global_setupFragment)
}
}

override fun onDestinationChanged(controller: NavController, destination: NavDestination, arguments: Bundle?) {
val barShown = when (destination.id) {
R.id.setupFragment -> false
R.id.logsExtendedCopyFragment -> false
R.id.filtersFragment -> false
R.id.editFilterFragment -> false
R.id.chooseAppFragment -> false
R.id.appCrashesFragment -> false
R.id.crashDetailsFragment -> false
Directions.setupFragment -> false
Directions.logsExtendedCopyFragment -> false
Directions.filtersFragment -> false
Directions.editFilterFragment -> false
Directions.chooseAppFragment -> false
Directions.appCrashesFragment -> false
Directions.crashDetailsFragment -> false

else -> true
}
val animateBarTransition = when (destination.id) {
R.id.setupFragment -> false
Directions.setupFragment -> false

else -> true
}
Expand Down
10 changes: 0 additions & 10 deletions app/src/main/res/drawable/ic_adb.xml

This file was deleted.

9 changes: 0 additions & 9 deletions app/src/main/res/drawable/ic_add.xml

This file was deleted.

9 changes: 0 additions & 9 deletions app/src/main/res/drawable/ic_alert.xml

This file was deleted.

10 changes: 0 additions & 10 deletions app/src/main/res/drawable/ic_android.xml

This file was deleted.

16 changes: 0 additions & 16 deletions app/src/main/res/drawable/ic_android_anim.xml

This file was deleted.

38 changes: 0 additions & 38 deletions app/src/main/res/drawable/ic_android_avd.xml

This file was deleted.

10 changes: 0 additions & 10 deletions app/src/main/res/drawable/ic_archive.xml

This file was deleted.

11 changes: 0 additions & 11 deletions app/src/main/res/drawable/ic_arrow_back.xml

This file was deleted.

10 changes: 0 additions & 10 deletions app/src/main/res/drawable/ic_arrow_drop_down.xml

This file was deleted.

9 changes: 0 additions & 9 deletions app/src/main/res/drawable/ic_bug.xml

This file was deleted.

16 changes: 0 additions & 16 deletions app/src/main/res/drawable/ic_bug_anim.xml

This file was deleted.

Loading

0 comments on commit ce59aa6

Please sign in to comment.