Skip to content
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

Use dependency injection for ItemLauncher, KeyProcessor and ReportingHelper #3572

Merged
merged 5 commits into from
May 14, 2024

Conversation

nielsvanvelzen
Copy link
Member

Wanted to add replay gain support to playback rewrite but need to convert all item calls to use the SDK first so we can actually read the value from BaseItemDto. sad

Changes

  • Use dependency injection for ItemLauncher
  • Move addBlockText to ProgramGridCell
  • Use dependency injection for KeyProcessor
  • Use dependency injection for ReportingHelper
  • Remove unused methods from StreamHelper

Issues

@nielsvanvelzen nielsvanvelzen added the refactor Improvements to code realiability, readability and quality label May 14, 2024
@nielsvanvelzen nielsvanvelzen added this to the v0.17.0 milestone May 14, 2024
}

if (liveTvPreferences.get(LiveTvPreferences.Companion.getShowRepeatIndicator()) && Utils.isTrue(program.getIsRepeat())) {
InfoLayoutHelper.addBlockText(context, mInfoRow, context.getString(R.string.lbl_repeat), 10, Color.GRAY, androidx.leanback.R.color.lb_default_brand_color);
addBlockText(context.getString(R.string.lbl_repeat), 10, Color.GRAY, androidx.leanback.R.color.lb_default_brand_color);

Check warning

Code scanning / Android Lint

Using private resources Warning

The resource @color/lb_default_brand_color is marked as private in androidx.leanback:leanback-preference:1.1.0-rc01
TextView view = new TextView(getContext());
view.setTextSize(size);
view.setTextColor(textColor);
view.setText(" " + text + " ");

Check warning

Code scanning / Android Lint

TextView Internationalization Warning

Do not concatenate text displayed with setText. Use resource string with placeholders.
}

public static Destination.Fragment getUserViewDestination(@Nullable final BaseItemDto baseItem) {
public Destination.Fragment getUserViewDestination(@Nullable final BaseItemDto baseItem) {

Check notice

Code scanning / Android Lint

Unknown nullness Note

Unknown nullability; explicitly declare as @Nullable or @NonNull to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations
public static void launch(final BaseRowItem rowItem, ItemRowAdapter adapter, int pos, final Context context) {
NavigationRepository navigationRepository = KoinJavaComponent.<NavigationRepository>get(NavigationRepository.class);

public void launch(final BaseRowItem rowItem, ItemRowAdapter adapter, int pos, final Context context) {

Check notice

Code scanning / Android Lint

Unknown nullness Note

Unknown nullability; explicitly declare as @Nullable or @NonNull to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations
public static void launch(final BaseRowItem rowItem, ItemRowAdapter adapter, int pos, final Context context) {
NavigationRepository navigationRepository = KoinJavaComponent.<NavigationRepository>get(NavigationRepository.class);

public void launch(final BaseRowItem rowItem, ItemRowAdapter adapter, int pos, final Context context) {

Check notice

Code scanning / Android Lint

Unknown nullness Note

Unknown nullability; explicitly declare as @Nullable or @NonNull to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations
private final Lazy<DataRefreshService> dataRefreshService = KoinJavaComponent.<DataRefreshService>inject(DataRefreshService.class);
private final Lazy<ApiClient> apiClient = KoinJavaComponent.<ApiClient>inject(ApiClient.class);

public void reportStopped(org.jellyfin.sdk.model.api.BaseItemDto item, StreamInfo streamInfo, long pos) {

Check notice

Code scanning / Android Lint

Unknown nullness Note

Unknown nullability; explicitly declare as @Nullable or @NonNull to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations
break;
}
}
}

public static void reportStart(org.jellyfin.sdk.model.api.BaseItemDto item, long pos) {
public void reportStart(org.jellyfin.sdk.model.api.BaseItemDto item, long pos) {

Check notice

Code scanning / Android Lint

Unknown nullness Note

Unknown nullability; explicitly declare as @Nullable or @NonNull to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations
Timber.i("Playback of %s started.", item.getName());
}

public static void reportProgress(@Nullable PlaybackController playbackController, org.jellyfin.sdk.model.api.BaseItemDto item, StreamInfo currentStreamInfo, Long position, boolean isPaused) {
public void reportProgress(@Nullable PlaybackController playbackController, org.jellyfin.sdk.model.api.BaseItemDto item, StreamInfo currentStreamInfo, Long position, boolean isPaused) {

Check notice

Code scanning / Android Lint

Unknown nullness Note

Unknown nullability; explicitly declare as @Nullable or @NonNull to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations
Timber.i("Playback of %s started.", item.getName());
}

public static void reportProgress(@Nullable PlaybackController playbackController, org.jellyfin.sdk.model.api.BaseItemDto item, StreamInfo currentStreamInfo, Long position, boolean isPaused) {
public void reportProgress(@Nullable PlaybackController playbackController, org.jellyfin.sdk.model.api.BaseItemDto item, StreamInfo currentStreamInfo, Long position, boolean isPaused) {

Check notice

Code scanning / Android Lint

Unknown nullness Note

Unknown nullability; explicitly declare as @Nullable or @NonNull to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations
Timber.i("Playback of %s started.", item.getName());
}

public static void reportProgress(@Nullable PlaybackController playbackController, org.jellyfin.sdk.model.api.BaseItemDto item, StreamInfo currentStreamInfo, Long position, boolean isPaused) {
public void reportProgress(@Nullable PlaybackController playbackController, org.jellyfin.sdk.model.api.BaseItemDto item, StreamInfo currentStreamInfo, Long position, boolean isPaused) {

Check notice

Code scanning / Android Lint

Unknown nullness Note

Unknown nullability; explicitly declare as @Nullable or @NonNull to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations
@nielsvanvelzen nielsvanvelzen merged commit 5db06f1 into jellyfin:master May 14, 2024
5 checks passed
@nielsvanvelzen nielsvanvelzen deleted the no-statics branch May 14, 2024 14:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactor Improvements to code realiability, readability and quality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants