Skip to content

Draft: Changes from branch 0.9.0 #17

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 42 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
6ad6193
Flipper: Add StringValue support for Flipper plugin
Dec 29, 2022
b992195
Dependencies: Add Jetpack Compose support
Sep 30, 2022
8a075c3
Account:Migrate account plugin to Jetpack Compose
Oct 3, 2022
79596f4
Account: Rename package to com.redmadrobot.debug.account
Oct 3, 2022
99179ab
Common:Rename 'debug-panel-common' module package to com.redmadrobot.…
Dec 6, 2022
2814222
Common: Rename 'debug-panel-common' module to 'common'
Dec 6, 2022
e8d3505
Core: Rename 'debug-panel-core' module package to com.redmadrobot.deb…
Dec 6, 2022
94a9d43
Core:Rename 'debug-panel-core' module to 'core'
Dec 6, 2022
758810c
Noop:Rename 'debug-panel-no-op' module to 'no-op'
Dec 6, 2022
4fe182a
Noop:Rename 'no-op' package to to 'com.redmadrobot.debug.noop'
Dec 6, 2022
4240ba4
Accounts:Rename 'accounts-plugin' module to 'accounts'
Dec 6, 2022
a3cd88f
AppSettings:Rename 'app-settings-plugin' module to 'app-settings'
Dec 6, 2022
8481123
AppSettings: Rename 'app-settings-plugin' package to 'com.redmadrobot…
Dec 6, 2022
a1601c7
Noop:Fix package names for no-op module
Dec 6, 2022
bbe354f
Flipper: Rename 'flipper-plugin' module to 'flipper'
Dec 6, 2022
c402306
Flipper: Rename 'flipper-plugin' package to 'com.redmadrobot.debug.fl…
Dec 6, 2022
5c38feb
Servers: Rename 'servers-plugin' module to 'servers'
Dec 6, 2022
12a8371
Servers: Rename 'servers-plugin' package to 'com.redmadrobot.debug.se…
Dec 6, 2022
a5283dc
Variable: Rename 'variable-plugin' module to 'variable'
Dec 6, 2022
910fa1f
Variable: Rename 'variable-plugin' package to 'com.redmadrobot.debug.…
Dec 6, 2022
e3b10b0
Common: Fix package names for release build
Dec 6, 2022
dd75af8
Accounts: Fix package name
Dec 6, 2022
9619b03
Docs:Update changelog.md
Dec 6, 2022
07cc0bf
Base:Fix Broadcast receiver action name
Dec 6, 2022
aee2512
Core:Add 'content' and `settingsContent` composable functions for Plu…
Dec 8, 2022
4ae86d3
Deps:Update `common` module dependencies
Dec 8, 2022
340cf05
Accounts: Add the ability to open `accounts` plugin from JetpackCompose
Dec 8, 2022
b430ba9
Servers: Add the ability to open `servers` plugin from JetpackCompose
Dec 8, 2022
464f02b
Flipper:Add the ability to open `flipper` plugin from JetpackCompose
Dec 8, 2022
3e3a3d0
AppSettings: Add the ability to open `appsettings` plugin from Jetpac…
Dec 8, 2022
9860da6
Variable:Add the ability to open `variable` plugin from JetpackCompose
Dec 8, 2022
c8dfcbc
Core: Add ability to open panel without fragment manager
Dec 26, 2022
4f04b44
Servers: Add the ability to add a stage with multiple hosts
Jan 12, 2023
2237426
No-op: update no-op module
Jan 12, 2023
16dac5e
Servers: Migrate to Jetpack Compose UI
Jan 16, 2023
7d9f57c
Sample: Update sample project
Jan 16, 2023
525ba73
Servers: Add methods to get the selected stage and the default stage
Jan 16, 2023
2d9b5ea
AppSettings: Migrate App-settings plugin to the Jetpack Compose
Jan 21, 2023
646ca86
Flipper: Migrate Flipper plugin to the Jetpack Compose
Mar 1, 2023
3e689a0
Fix: Fix rebase conflicts
Sep 23, 2023
e7a5e8f
Base: Migrate to view binding from 'synthetics'
Sep 24, 2023
5b59e3a
Build: Fix module namespaces
Sep 27, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ plugins {
subprojects {
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
kotlinOptions.freeCompilerArgs += listOf(
"-opt-in=com.redmadrobot.debug_panel_core.annotation.DebugPanelInternal"
"-opt-in=com.redmadrobot.debug.core.annotation.DebugPanelInternal"
)
}
}
Expand Down
File renamed without changes.
34 changes: 23 additions & 11 deletions debug-panel-common/build.gradle.kts → common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -40,27 +40,39 @@ android {
buildFeatures {
viewBinding = true
}
namespace = "com.redmadrobot.debug_panel_common"
namespace = "com.redmadrobot.debug.panel.common"
}

dependencies {
api(kotlin("stdlib"))
api(androidx.compose.animation)
api(stack.accompanist.themeadapter.material)
api(androidx.compose.material)
api(androidx.compose.foundation)
api(androidx.compose.ui)
api(androidx.compose.ui.viewbinding)
api(androidx.compose.ui.tooling)
api(androidx.fragment)
api(androidx.constraintlayout.compose)
api(androidx.activity.compose)
api(androidx.compose.ui.tooling.preview)
api(androidx.lifecycle.viewmodel.compose)
api(androidx.room.runtime)
api(androidx.room)
api(androidx.core)
api(stack.okhttp)
api(stack.kotlinx.coroutines.android)
api(stack.timber)
api(rmr.itemsadapter.viewbinding)
api(rmr.flipper)
kapt(androidx.room.compiler)
// legacy
api(androidx.appcompat)
api(stack.material)
api(androidx.constraintlayout)
api(stack.kotlinx.coroutines.android)
api(androidx.lifecycle.viewmodel)
api(androidx.lifecycle.runtime)
api(androidx.lifecycle.livedata)
api(androidx.lifecycle.livedata.core)
api(androidx.lifecycle.viewmodel)
api(androidx.room.runtime)
api(androidx.room)
api(androidx.core)
api(rmr.itemsadapter.viewbinding)
api(rmr.flipper)
api(stack.timber)
kapt(androidx.room.compiler)
}

tasks.register("prepareKotlinBuildScriptModel") {}
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
package com.redmadrobot.debug_panel_common.base
package com.redmadrobot.debug.common.base

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.appcompat.view.ContextThemeWrapper
import androidx.fragment.app.Fragment
import com.redmadrobot.debug_panel_common.R
import com.redmadrobot.debug.panel.common.R

public open class PluginFragment(private val layoutId: Int) : Fragment() {

protected val isSettingMode: Boolean by lazy {
activity?.javaClass?.simpleName == "DebugActivity"
}

override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.redmadrobot.debug_panel_common.base
package com.redmadrobot.debug.common.base

import androidx.lifecycle.ViewModel

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.redmadrobot.debug_panel_common.extension
package com.redmadrobot.debug.common.extension

import kotlinx.coroutines.CancellationException
import kotlinx.coroutines.CoroutineScope
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.redmadrobot.debug_panel_common.extension
package com.redmadrobot.debug.common.extension

import androidx.annotation.MainThread
import androidx.fragment.app.Fragment
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@
<color name="black">#000000</color>
<color name="red">#EF0000</color>
<color name="green">#009688</color>
<color name="gray">#E1E5EA</color>
<color name="super_light_gray">#E1E5EA</color>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,3 @@
<item name="colorOnSurface">@color/colorOnSurface</item>
</style>
</resources>

File renamed without changes.
9 changes: 7 additions & 2 deletions debug-panel-core/build.gradle.kts → core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,20 @@ android {

buildFeatures {
viewBinding = true
compose = true
}
namespace = "com.redmadrobot.panel_core"

composeOptions {
kotlinCompilerExtensionVersion = androidx.versions.compose.compiler.get()
}
namespace = "com.redmadrobot.debug.panel.core"
}

kotlin {
explicitApi()
}

dependencies {
implementation(project(":debug-panel-common"))
implementation(project(":common"))
kapt(androidx.room.compiler)
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<application>
<activity
android:name="com.redmadrobot.debug_panel_core.ui.debugpanel.DebugActivity"
android:name="com.redmadrobot.debug.core.ui.debugpanel.DebugActivity"
android:exported="false"
android:taskAffinity="com.redmadrobot.debug_panel.DebugActivity"
android:theme="@style/DebugPanelTheme" />
Expand All @@ -14,7 +14,7 @@
android:enabled="true"
android:exported="true"
android:label="@string/debug_panel"
android:targetActivity="com.redmadrobot.debug_panel_core.ui.debugpanel.DebugActivity"
android:targetActivity="com.redmadrobot.debug.core.ui.debugpanel.DebugActivity"
android:taskAffinity="com.redmadrobot.debug_panel.DebugActivity"
android:theme="@style/DebugPanelTheme">
<intent-filter>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.redmadrobot.debug.core

import android.content.Context
import com.redmadrobot.debug.core.annotation.DebugPanelInternal
import com.redmadrobot.debug.core.plugin.PluginDependencyContainer

@DebugPanelInternal
public class CommonContainer(public val context: Context) : PluginDependencyContainer
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package com.redmadrobot.debug_panel_core
package com.redmadrobot.debug.core

import android.app.Application
import android.content.Context
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import com.redmadrobot.debug_panel_core.internal.DebugEvent
import com.redmadrobot.debug_panel_core.plugin.Plugin
import com.redmadrobot.debug_panel_core.plugin.PluginManager
import com.redmadrobot.debug.core.internal.DebugEvent
import com.redmadrobot.debug.core.plugin.Plugin
import com.redmadrobot.debug.core.plugin.PluginManager
import kotlinx.coroutines.channels.BufferOverflow
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.MutableSharedFlow
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package com.redmadrobot.debug_panel_core.annotation
package com.redmadrobot.debug.core.annotation

@RequiresOptIn(
level = RequiresOptIn.Level.ERROR,
message = "This is an internal part of DebugPanel. You shouldn't use it, cause it can be changed in future"
)
@Retention(AnnotationRetention.BINARY)
@Target(AnnotationTarget.CLASS, AnnotationTarget.FUNCTION)
public annotation class DebugPanelInternal
public annotation class DebugPanelInternal
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.redmadrobot.debug_panel_core.data
package com.redmadrobot.debug.core.data

public interface DebugDataProvider<T> {
public fun provideData(): T
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package com.redmadrobot.debug.core.extension

import androidx.compose.runtime.Composable
import androidx.compose.runtime.DisposableEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.rememberUpdatedState
import androidx.compose.ui.platform.LocalLifecycleOwner
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleEventObserver
import androidx.lifecycle.ViewModel
import androidx.lifecycle.ViewModelProvider
import androidx.lifecycle.viewmodel.compose.viewModel
import com.redmadrobot.debug.core.annotation.DebugPanelInternal

@DebugPanelInternal
@Composable
public inline fun <reified T : ViewModel> provideViewModel(crossinline block: () -> T): T {
return viewModel(
factory = object : ViewModelProvider.Factory {
override fun <T : ViewModel> create(modelClass: Class<T>): T {
@Suppress("UNCHECKED_CAST")
return block() as T
}
}
)
}


@DebugPanelInternal
@Composable
public fun OnLifecycleEvent(onEvent: (event: Lifecycle.Event) -> Unit) {
val eventHandler by rememberUpdatedState(onEvent)
val lifecycleOwner by rememberUpdatedState(LocalLifecycleOwner.current)

DisposableEffect(lifecycleOwner) {
val lifecycle = lifecycleOwner.lifecycle
val observer = LifecycleEventObserver { _, event ->
eventHandler(event)
}

lifecycle.addObserver(observer)
onDispose {
lifecycle.removeObserver(observer)
}
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.redmadrobot.debug_panel_core.extension
package com.redmadrobot.debug.core.extension

import com.redmadrobot.debug_panel_core.DebugPanelInstance
import com.redmadrobot.debug_panel_core.annotation.DebugPanelInternal
import com.redmadrobot.debug_panel_core.plugin.Plugin
import com.redmadrobot.debug.core.DebugPanelInstance
import com.redmadrobot.debug.core.annotation.DebugPanelInternal
import com.redmadrobot.debug.core.plugin.Plugin

@PublishedApi
internal fun getPlugin(pluginName: String): Plugin {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.redmadrobot.debug_panel_core.inapp
package com.redmadrobot.debug.core.inapp

import android.app.Dialog
import android.os.Bundle
Expand All @@ -10,9 +10,10 @@ import com.google.android.material.bottomsheet.BottomSheetBehavior
import com.google.android.material.bottomsheet.BottomSheetDialog
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
import com.google.android.material.tabs.TabLayoutMediator
import com.redmadrobot.debug_panel_core.extension.getAllPlugins
import com.redmadrobot.panel_core.databinding.BottomSheetDebugPanelBinding
import com.redmadrobot.debug_panel_common.R as CommonR
import com.redmadrobot.debug.core.extension.getAllPlugins
import com.redmadrobot.debug.panel.core.databinding.BottomSheetDebugPanelBinding
import com.redmadrobot.debug.panel.common.R as CommonR


internal class DebugBottomSheet : BottomSheetDialogFragment() {

Expand Down Expand Up @@ -40,7 +41,7 @@ internal class DebugBottomSheet : BottomSheetDialogFragment() {
setBottomSheetSize()
}
dialog.setContentView(binding.root)
setViews(binding)
binding.setViews()
return dialog
}

Expand All @@ -49,12 +50,12 @@ internal class DebugBottomSheet : BottomSheetDialogFragment() {
_binding = null
}

private fun setViews(binding: BottomSheetDebugPanelBinding) {
private fun BottomSheetDebugPanelBinding.setViews() {
val plugins = getAllPlugins()
/*Only Plugins with Fragment*/
.filter { it.getFragment() != null }

binding.debugSheetViewpager.adapter = DebugSheetViewPagerAdapter(
debugSheetViewpager.adapter = DebugSheetViewPagerAdapter(
requireActivity(),
plugins
)
Expand All @@ -64,13 +65,14 @@ internal class DebugBottomSheet : BottomSheetDialogFragment() {
}

TabLayoutMediator(
binding.debugSheetTabLayout,
binding.debugSheetViewpager,
debugSheetTabLayout,
debugSheetViewpager,
tabConfigurationStrategy
).attach()
}

private fun setBottomSheetSize() {
if (_binding == null) return
val dialogContainer = binding.root.parent as? FrameLayout
dialogContainer?.apply {
layoutParams?.height = ViewGroup.LayoutParams.MATCH_PARENT
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package com.redmadrobot.debug_panel_core.inapp
package com.redmadrobot.debug.core.inapp

import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentActivity
import androidx.viewpager2.adapter.FragmentStateAdapter
import com.redmadrobot.debug_panel_core.plugin.Plugin
import com.redmadrobot.debug.core.plugin.Plugin

internal class DebugSheetViewPagerAdapter(
fragmentActivity: FragmentActivity,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.redmadrobot.debug_panel_core.inapp
package com.redmadrobot.debug.core.inapp

import android.content.Context
import android.graphics.Canvas
Expand All @@ -7,8 +7,8 @@ import android.graphics.RectF
import android.util.AttributeSet
import androidx.coordinatorlayout.widget.CoordinatorLayout
import androidx.core.content.ContextCompat
import com.redmadrobot.panel_core.R
import com.redmadrobot.debug_panel_common.R as CommonR
import com.redmadrobot.debug.panel.core.R
import com.redmadrobot.debug.panel.common.R as CommonR

internal class ModalLayout @JvmOverloads constructor(
context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0
Expand All @@ -18,7 +18,7 @@ internal class ModalLayout @JvmOverloads constructor(
* Paint для отрисовки "ручки" модального окна
*/
private val handlePaint = Paint().apply {
color = ContextCompat.getColor(context, CommonR.color.gray)
color = ContextCompat.getColor(context, CommonR.color.super_light_gray)
style = Paint.Style.FILL
}

Expand Down
Loading
Loading