-
-
Notifications
You must be signed in to change notification settings - Fork 469
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
Rewrite navigation #2132
Rewrite navigation #2132
Conversation
import org.jellyfin.sdk.model.api.SeriesTimerInfoDto | ||
import java.util.UUID | ||
|
||
object Destinations { |
Check warning
Code scanning / detekt
Too many functions inside a/an file/class/object/interface always indicate a violation of the single responsibility principle. Maybe the file/class/object/interface wants to manage too many things at once. Extract functionality which clearly belongs together.
private val nowPlaying by lazy { HomeFragmentNowPlayingRow(mediaManager) } | ||
private val liveTVRow by lazy { HomeFragmentLiveTVRow(requireActivity(), userRepository, navigationRepository) } | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { |
Check warning
Code scanning / detekt
One method should have one responsibility. Long methods tend to handle many things at once. Prefer smaller methods to make them easier to understand.
private val nowPlaying by lazy { HomeFragmentNowPlayingRow(mediaManager) } | ||
private val liveTVRow by lazy { HomeFragmentLiveTVRow(requireActivity(), userRepository, navigationRepository) } | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { |
Check warning
Code scanning / detekt
Prefer splitting up complex methods into smaller, easier to understand methods.
super.onResume() | ||
|
||
//React to deletion | ||
if (activity != null && !requireActivity().isFinishing && currentRow != null && currentItem != null && currentItem!!.getItemId() != null && currentItem!!.getItemId().equals(dataRefreshService.lastDeletedItemId)) { |
Check warning
Code scanning / detekt
Complex conditions should be simplified and extracted into well-named methods if necessary.
Extras.Folder to Json.Default.encodeToString(item), | ||
) | ||
|
||
fun displayPreferences(displayPreferencesId: String, allowViewSelection: Boolean) = preferenceDestination<DisplayPreferencesScreen>( |
Check warning
Code scanning / detekt
Line detected, which is longer than the defined maximum line length in the code style.
SpeechRecognizer.isRecognitionAvailable(this) | ||
&& ContextCompat.checkSelfPermission(this, Manifest.permission.RECORD_AUDIO) != PackageManager.PERMISSION_DENIED | ||
SpeechRecognizer.isRecognitionAvailable(requireContext()) | ||
&& ContextCompat.checkSelfPermission(requireContext(), Manifest.permission.RECORD_AUDIO) != PackageManager.PERMISSION_DENIED |
Check warning
Code scanning / detekt
Line detected, which is longer than the defined maximum line length in the code style.
super.onResume() | ||
|
||
//React to deletion | ||
if (activity != null && !requireActivity().isFinishing && currentRow != null && currentItem != null && currentItem!!.getItemId() != null && currentItem!!.getItemId().equals(dataRefreshService.lastDeletedItemId)) { |
Check warning
Code scanning / detekt
Line detected, which is longer than the defined maximum line length in the code style.
|
||
private fun refreshCurrentItem() { | ||
currentItem?.let { item -> | ||
if (item.getBaseItemType() == BaseItemKind.USER_VIEW || item.getBaseItemType() == BaseItemKind.COLLECTION_FOLDER) return |
Check warning
Code scanning / detekt
Line detected, which is longer than the defined maximum line length in the code style.
668135f
to
4fef2f3
Compare
} | ||
|
||
public static void createUserViewIntent(final org.jellyfin.sdk.model.api.BaseItemDto baseItem, final Context context, final Consumer<Intent> callback) { | ||
public static void launchUserView(final org.jellyfin.sdk.model.api.BaseItemDto baseItem) { |
Check notice
Code scanning / Android Lint
Unknown nullness
} | ||
|
||
public static void launch(final BaseRowItem rowItem, ItemRowAdapter adapter, int pos, final Activity activity, final boolean noHistory) { | ||
public static void launch(final BaseRowItem rowItem, ItemRowAdapter adapter, int pos, final Activity activity) { |
Check notice
Code scanning / Android Lint
Unknown nullness
} | ||
|
||
public static void launch(final BaseRowItem rowItem, ItemRowAdapter adapter, int pos, final Activity activity, final boolean noHistory) { | ||
public static void launch(final BaseRowItem rowItem, ItemRowAdapter adapter, int pos, final Activity activity) { |
Check notice
Code scanning / Android Lint
Unknown nullness
} | ||
|
||
public static void launch(final BaseRowItem rowItem, ItemRowAdapter adapter, int pos, final Activity activity, final boolean noHistory) { | ||
public static void launch(final BaseRowItem rowItem, ItemRowAdapter adapter, int pos, final Activity activity) { |
Check notice
Code scanning / Android Lint
Unknown nullness
657d025
to
c959355
Compare
c959355
to
123d285
Compare
I've fixed all issues I could find except for the lifecycle thing (will be done in separate future pull requests). There might still be issues I haven't found myself, it's quite a big change after all. |
After years of work we're finally merging (most) activities into a single activity with proper navigation code.
Some parts are not migrated to the new navigation code:
Some future changes include:
Re-enable display mirroring in the SocketListenerUpdate PlaybackLauncher to return destination instead of a "playbackActivityClass"This PR introduces a major change to the code and it has some known issues:
The back stack from the FragmentManager is not used, this forces fragments to refresh when going backI'm investigating this issue before marking the PR as readyChanges
Issues