Skip to content

Commit 3ba399a

Browse files
alperozturk96backportbot[bot]
authored andcommitted
add missing documentations
Signed-off-by: alperozturk <[email protected]>
1 parent 0db720c commit 3ba399a

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

app/src/main/java/it/niedermann/owncloud/notes/branding/BrandedFragment.kt

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,18 @@ import com.nextcloud.android.common.ui.util.extensions.adjustUIForAPILevel35
1919
import kotlinx.coroutines.Dispatchers
2020
import kotlinx.coroutines.launch
2121

22+
/**
23+
* An abstract base [Fragment] implementation that provides common branding support for UI
24+
* components.
25+
*
26+
* This class reads and applies brand-specific colors (`colorPrimary`, `colorAccent`, etc.) when the
27+
* fragment starts, and adjusts UI elements such as toolbar menu icons accordingly.
28+
*
29+
* Subclasses can extend this to inherit branding behavior while implementing their specific logic.
30+
*
31+
* @see BrandingUtil for brand color resolution and application.
32+
* @see Branded for the interface definition related to branding behavior.
33+
*/
2234
abstract class BrandedFragment : Fragment(), Branded {
2335
@JvmField
2436
@ColorInt
@@ -74,12 +86,29 @@ abstract class BrandedFragment : Fragment(), Branded {
7486
}
7587
}
7688

89+
/**
90+
* Launches the given [block] of code in the [Dispatchers.IO] context using the [lifecycleScope].
91+
*
92+
* This is useful for running long-running or blocking operations (e.g., file or network I/O)
93+
* that should not block the main thread. The coroutine will be automatically canceled when
94+
* the lifecycle is destroyed.
95+
*
96+
* @param block The code block to be executed on the IO dispatcher.
97+
*/
7798
fun lifecycleScopeIOJob(block: () -> Unit) {
7899
lifecycleScope.launch(Dispatchers.IO) {
79100
block()
80101
}
81102
}
82103

104+
/**
105+
* Executes the given [block] on the main (UI) thread.
106+
*
107+
* This is typically used to perform UI-related tasks such as updating views from a background
108+
* thread. Requires [activity] to be non-null; otherwise, the block will not be executed.
109+
*
110+
* @param block The code block to be executed on the main thread.
111+
*/
83112
fun onMainThread(block: () -> Unit) {
84113
activity?.runOnUiThread {
85114
block()

0 commit comments

Comments
 (0)