Skip to content

Commit 335574e

Browse files
committed
Add explicit visibility to Android libraries.
1 parent d2711d8 commit 335574e

File tree

29 files changed

+160
-194
lines changed

29 files changed

+160
-194
lines changed

android/libraries/rib-android-compose/src/main/kotlin/com/uber/rib/core/BasicComposeRouter.kt

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ package com.uber.rib.core
1818
import androidx.compose.runtime.Composable
1919
import androidx.compose.runtime.MutableState
2020

21-
open class BasicComposeRouter<I : BasicInteractor<*, *>>(
22-
val presenter: ComposePresenter,
21+
public open class BasicComposeRouter<I : BasicInteractor<*, *>>(
22+
public val presenter: ComposePresenter,
2323
interactor: I,
24-
val slot: MutableState<(@Composable () -> Unit)>,
24+
public val slot: MutableState<(@Composable () -> Unit)>,
2525
) : BasicRouter<I>(interactor) {
2626
override fun willAttach() {
2727
slot.value = presenter.composable

android/libraries/rib-android-compose/src/main/kotlin/com/uber/rib/core/ComposePresenter.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ package com.uber.rib.core
1717

1818
import androidx.compose.runtime.Composable
1919

20-
abstract class ComposePresenter : Presenter() {
21-
abstract val composable: @Composable () -> Unit
20+
public abstract class ComposePresenter : Presenter() {
21+
public abstract val composable: @Composable () -> Unit
2222
}

android/libraries/rib-android-core/src/main/kotlin/com/uber/rib/core/ActivityDelegate.kt

+9-9
Original file line numberDiff line numberDiff line change
@@ -25,35 +25,35 @@ import androidx.annotation.IntRange
2525
* functionality. This allows [RibActivity] and any other type of [Activity] that you need to
2626
* support to share [CoreAppCompatActivity] as a common parent.
2727
*/
28-
interface ActivityDelegate {
28+
public interface ActivityDelegate {
2929
/** @see [Activity.onCreate] */
30-
fun onCreate(savedInstanceState: Bundle?) {}
30+
public fun onCreate(savedInstanceState: Bundle?) {}
3131

3232
/** @see [Activity.onStart] */
33-
fun onStart() {}
33+
public fun onStart() {}
3434

3535
/** @see [Activity.onResume] */
36-
fun onResume() {}
36+
public fun onResume() {}
3737

3838
/** @see [Activity.onPause] */
39-
fun onPause() {}
39+
public fun onPause() {}
4040

4141
/** @see [Activity.onStop] */
42-
fun onStop() {}
42+
public fun onStop() {}
4343

4444
/** @see [Activity.onDestroy] */
45-
fun onDestroy() {}
45+
public fun onDestroy() {}
4646

4747
/** @see [Activity.onActivityResult] */
48-
fun onActivityResult(
48+
public fun onActivityResult(
4949
activity: Activity,
5050
requestCode: Int,
5151
resultCode: Int,
5252
data: Intent?,
5353
) {}
5454

5555
/** @see [Activity.onRequestPermissionsResult] */
56-
fun onRequestPermissionsResult(
56+
public fun onRequestPermissionsResult(
5757
activity: Activity,
5858
@IntRange(from = 0, to = 255) requestCode: Int,
5959
permissions: Array<String>,

android/libraries/rib-android-core/src/main/kotlin/com/uber/rib/core/CoreAppCompatActivity.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import androidx.lifecycle.ViewTreeViewModelStoreOwner
2525
import androidx.savedstate.ViewTreeSavedStateRegistryOwner
2626

2727
/** Core Support v7 AppCompat Activity. */
28-
abstract class CoreAppCompatActivity : AppCompatActivity() {
28+
public abstract class CoreAppCompatActivity : AppCompatActivity() {
2929

3030
private var activityDelegate: ActivityDelegate? = null
3131

android/libraries/rib-android-core/src/main/kotlin/com/uber/rib/core/HasActivityDelegate.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@
1616
package com.uber.rib.core
1717

1818
/** Interface to indicate an object has an [ActivityDelegate]. */
19-
interface HasActivityDelegate {
19+
public interface HasActivityDelegate {
2020
/**
2121
* Get the delegate.
2222
*
2323
* @return The delegate.
2424
*/
25-
fun activityDelegate(): ActivityDelegate
25+
public fun activityDelegate(): ActivityDelegate
2626
}

android/libraries/rib-android/src/main/kotlin/com/uber/rib/core/ActivityContext.kt

+1-3
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@
1515
*/
1616
package com.uber.rib.core
1717

18-
import java.lang.annotation.Retention
19-
import java.lang.annotation.RetentionPolicy.RUNTIME
2018
import javax.inject.Qualifier
2119

2220
/** Injection qualifier for an Activity Context. */
23-
@Qualifier @Retention(RUNTIME) annotation class ActivityContext
21+
@Qualifier @Retention public annotation class ActivityContext

android/libraries/rib-android/src/main/kotlin/com/uber/rib/core/ActivityStarter.kt

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ import android.content.Intent
2121
* Start activities. A much cleaner dependency than an entire activity or context, and easier to
2222
* inject and mock in tests.
2323
*/
24-
interface ActivityStarter {
24+
public interface ActivityStarter {
2525
/**
2626
* Start an activity with the given intent.
2727
*
2828
* @param intent The intent to open a new activity.
2929
*/
30-
fun startActivity(intent: Intent)
30+
public fun startActivity(intent: Intent)
3131

3232
/**
3333
* Start an activity with the given intent, to be notified when that activity finishes.
@@ -37,5 +37,5 @@ interface ActivityStarter {
3737
* from this request.
3838
*/
3939
@Deprecated("""use plain Activity instead""")
40-
fun startActivityForResult(intent: Intent, requestCode: Int)
40+
public fun startActivityForResult(intent: Intent, requestCode: Int)
4141
}

android/libraries/rib-android/src/main/kotlin/com/uber/rib/core/BasicViewRouter.kt

+2-4
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,5 @@ import android.view.View
2222
*
2323
* @param <I> type of interactor.
2424
*/
25-
abstract class BasicViewRouter<V : View, I : Interactor<*, *>>(
26-
view: V,
27-
interactor: I,
28-
) : ViewRouter<V, I>(view, interactor)
25+
public abstract class BasicViewRouter<V : View, I : Interactor<*, *>>(view: V, interactor: I) :
26+
ViewRouter<V, I>(view, interactor)

android/libraries/rib-android/src/main/kotlin/com/uber/rib/core/IntentCreator.kt

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ package com.uber.rib.core
1818
import android.content.Intent
1919

2020
/** Creates intent objects. */
21-
interface IntentCreator {
21+
public interface IntentCreator {
2222
/**
2323
* Create an explicit intent targeted at a particular class, which is guaranteed to be limited to
2424
* your app's package.
2525
*
2626
* @param cls The class that you intend to receive this intent.
2727
* @return The intent.
2828
*/
29-
fun create(cls: Class<*>): Intent
29+
public fun create(cls: Class<*>): Intent
3030

3131
/**
3232
* Create an implicit intent targeted at an action, which may end up resolving to your app or to
@@ -37,5 +37,5 @@ interface IntentCreator {
3737
* @param action The intent action, which any app may register to receive.
3838
* @return The intent.
3939
*/
40-
fun create(action: String): Intent
40+
public fun create(action: String): Intent
4141
}

android/libraries/rib-android/src/main/kotlin/com/uber/rib/core/IntentCreatorImpl.kt

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ import android.content.Context
1919
import android.content.Intent
2020

2121
/** A default implementation of [IntentCreator]. */
22-
open class IntentCreatorImpl(private val context: Context) : IntentCreator {
23-
override fun create(cls: Class<*>) = Intent(context, cls)
22+
public open class IntentCreatorImpl(private val context: Context) : IntentCreator {
23+
override fun create(cls: Class<*>): Intent = Intent(context, cls)
2424

25-
override fun create(action: String) = Intent(action)
25+
override fun create(action: String): Intent = Intent(action)
2626
}

android/libraries/rib-android/src/main/kotlin/com/uber/rib/core/IntentFactory.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ package com.uber.rib.core
1818
import android.content.Intent
1919

2020
/** Factory for an [Intent] that opens an activity. */
21-
interface IntentFactory {
21+
public interface IntentFactory {
2222
/**
2323
* Create a view router to be displayed for an [Intent].
2424
*
2525
* @param intentCreator to create the [Intent].
2626
* @return the activity [Intent].
2727
*/
28-
fun create(intentCreator: IntentCreator): Intent
28+
public fun create(intentCreator: IntentCreator): Intent
2929
}

android/libraries/rib-android/src/main/kotlin/com/uber/rib/core/RibDebugOverlay.kt

+4-4
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ import android.graphics.Paint
2222
import android.graphics.PixelFormat
2323
import android.graphics.drawable.Drawable
2424

25-
open class RibDebugOverlay : Drawable() {
25+
public open class RibDebugOverlay : Drawable() {
2626
private var enabled = true
2727

28-
open fun setEnabled(enabled: Boolean) {
28+
public open fun setEnabled(enabled: Boolean) {
2929
this.enabled = enabled
3030
}
3131

@@ -43,9 +43,9 @@ open class RibDebugOverlay : Drawable() {
4343

4444
override fun setColorFilter(colorFilter: ColorFilter?) {}
4545

46-
override fun getOpacity() = PixelFormat.TRANSLUCENT
46+
@Deprecated("Deprecated in upstream.") override fun getOpacity(): Int = PixelFormat.TRANSLUCENT
4747

48-
companion object {
48+
private companion object {
4949
private const val OVERLAY_COLOR = Color.RED
5050
private const val OVERLAY_ALPHA = 35
5151
}

android/libraries/rib-android/src/main/kotlin/com/uber/rib/core/RxActivityEvents.kt

+7-9
Original file line numberDiff line numberDiff line change
@@ -20,32 +20,30 @@ import com.uber.rib.core.lifecycle.ActivityLifecycleEvent
2020
import io.reactivex.Observable
2121

2222
/** Interface for reactive activities. */
23-
interface RxActivityEvents {
23+
public interface RxActivityEvents {
2424
/** @return an observable of this activity's lifecycle events. */
25-
fun lifecycle(): Observable<ActivityLifecycleEvent>
25+
public fun lifecycle(): Observable<ActivityLifecycleEvent>
2626

2727
/** @return an observable of this activity's lifecycle events. */
28-
fun callbacks(): Observable<ActivityCallbackEvent>
28+
public fun callbacks(): Observable<ActivityCallbackEvent>
2929

3030
/**
3131
* @param <T> The type of [ActivityLifecycleEvent] subclass you want.
3232
* @param clazz The [ActivityLifecycleEvent] subclass you want.
3333
* @return an observable of this activity's lifecycle events.
3434
*/
35-
fun <T : ActivityLifecycleEvent> lifecycle(clazz: Class<T>): Observable<T> {
36-
return lifecycle()
35+
public fun <T : ActivityLifecycleEvent> lifecycle(clazz: Class<T>): Observable<T> =
36+
lifecycle()
3737
.filter { activityEvent -> clazz.isAssignableFrom(activityEvent.javaClass) }
3838
.cast(clazz)
39-
}
4039

4140
/**
4241
* @param <T> The type of [ActivityCallbackEvent] subclass you want.
4342
* @param clazz The [ActivityCallbackEvent] subclass you want.
4443
* @return an observable of this activity's callbacks events.
4544
*/
46-
fun <T : ActivityCallbackEvent> callbacks(clazz: Class<T>): Observable<T> {
47-
return callbacks()
45+
public fun <T : ActivityCallbackEvent> callbacks(clazz: Class<T>): Observable<T> =
46+
callbacks()
4847
.filter { activityEvent -> clazz.isAssignableFrom(activityEvent.javaClass) }
4948
.cast(clazz)
50-
}
5149
}

android/libraries/rib-android/src/main/kotlin/com/uber/rib/core/ViewBuilder.kt

+4-6
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,16 @@ import android.view.ViewGroup
2727
* @param <RouterT> type of router built by this builder.
2828
* @param <DependencyT> dependency required to create this router.
2929
*/
30-
abstract class ViewBuilder<ViewType : View, RouterT : Router<*>, DependencyT>(
31-
dependency: DependencyT,
30+
public abstract class ViewBuilder<ViewType : View, RouterT : Router<*>, DependencyT>(
31+
dependency: DependencyT
3232
) : Builder<RouterT, DependencyT>(dependency) {
3333
/**
3434
* Utility method to create the view for this router.
3535
*
3636
* @param parentViewGroup to inflate view with.
3737
* @return the view for a new router.
3838
*/
39-
fun createView(parentViewGroup: ViewGroup): ViewType {
39+
public fun createView(parentViewGroup: ViewGroup): ViewType {
4040
val context = parentViewGroup.context
4141
return inflateView(LayoutInflater.from(onThemeContext(context)), parentViewGroup)
4242
}
@@ -59,7 +59,5 @@ abstract class ViewBuilder<ViewType : View, RouterT : Router<*>, DependencyT>(
5959
* overridden.
6060
* @return the possibly themed context.
6161
*/
62-
protected open fun onThemeContext(parentContext: Context): Context {
63-
return parentContext
64-
}
62+
protected open fun onThemeContext(parentContext: Context): Context = parentContext
6563
}

android/libraries/rib-android/src/main/kotlin/com/uber/rib/core/ViewPresenter.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import android.view.View
2222
*
2323
* @param <V> the view type.
2424
*/
25-
abstract class ViewPresenter<V : View>(
25+
public abstract class ViewPresenter<V : View>(
2626
/** @return the view fronted by the page. */
27-
val view: V,
27+
public val view: V
2828
) : Presenter()

android/libraries/rib-android/src/main/kotlin/com/uber/rib/core/ViewRouter.kt

+3-3
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ import android.view.View
2323
* @param <V> type of view owned by the router.
2424
* @param <I> type of interactor owned by the router.
2525
*/
26-
abstract class ViewRouter<V : View, I : Interactor<*, *>> : Router<I> {
26+
public abstract class ViewRouter<V : View, I : Interactor<*, *>> : Router<I> {
2727
/** @return the router's view. */
28-
open val view: V
28+
public val view: V
2929

30-
constructor(
30+
public constructor(
3131
view: V,
3232
interactor: I,
3333
component: InteractorBaseComponent<*>,

android/libraries/rib-android/src/main/kotlin/com/uber/rib/core/XRay.kt

+8-11
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,10 @@ import android.view.Gravity
2525
import android.view.View
2626

2727
/** Utility class that shows riblets name in its background. */
28-
class XRay private constructor() {
28+
public class XRay private constructor() {
2929
private var isEnabled = false
3030
private var textPaint: Paint? = null
31+
3132
private fun writeOnBitmap(bitmap: Bitmap, text: String) {
3233
val canvas = Canvas(bitmap)
3334
val textPaint = getTextPaint()
@@ -47,7 +48,7 @@ class XRay private constructor() {
4748
return textPaint!!
4849
}
4950

50-
companion object {
51+
public companion object {
5152
private val INSTANCE = XRay()
5253
private const val FRAME_WIDTH = 500
5354
private const val FRAME_HEIGHT = 150
@@ -57,15 +58,12 @@ class XRay private constructor() {
5758

5859
/** Toggles state of XRay. */
5960
@JvmStatic
60-
fun toggle() {
61+
public fun toggle() {
6162
INSTANCE.isEnabled = !INSTANCE.isEnabled
6263
}
6364

6465
/** @return `true` if XRay is enabled, `false` otherwise. */
65-
@JvmStatic
66-
fun isEnabled(): Boolean {
67-
return INSTANCE.isEnabled
68-
}
66+
@JvmStatic public fun isEnabled(): Boolean = INSTANCE.isEnabled
6967

7068
/**
7169
* Puts [ViewBuilder]s riblet name in the background of the [View]
@@ -74,7 +72,7 @@ class XRay private constructor() {
7472
* @param view a [View] to put the name behind.
7573
*/
7674
@JvmStatic
77-
fun apply(viewRouter: ViewRouter<*, *>, view: View) {
75+
public fun apply(viewRouter: ViewRouter<*, *>, view: View) {
7876
val oldBackground = view.background
7977
val bitmap: Bitmap =
8078
if (oldBackground != null) {
@@ -110,8 +108,7 @@ class XRay private constructor() {
110108
return bitmap
111109
}
112110

113-
private fun getRibletName(viewRouter: ViewRouter<*, *>): String {
114-
return viewRouter.javaClass.simpleName.replace("Router", "")
115-
}
111+
private fun getRibletName(viewRouter: ViewRouter<*, *>): String =
112+
viewRouter.javaClass.simpleName.replace("Router", "")
116113
}
117114
}

0 commit comments

Comments
 (0)