From 37b0ab52318700229469a01b0a45fb2b4b73cebc Mon Sep 17 00:00:00 2001 From: kunminx Date: Wed, 14 Jun 2023 09:38:14 +0800 Subject: [PATCH] simplify code --- app/src/main/java/com/kunminx/puremusic/MainActivity.java | 6 ++++-- .../main/java/com/kunminx/puremusic/data/api/APIs.java | 8 -------- .../java/com/kunminx/puremusic/ui/page/MainFragment.java | 6 ------ .../java/com/kunminx/puremusic/ui/view/PlayPauseView.java | 1 - .../com/kunminx/puremusic/ui/widget/PlayerService.java | 1 - 5 files changed, 4 insertions(+), 18 deletions(-) delete mode 100644 app/src/main/java/com/kunminx/puremusic/data/api/APIs.java diff --git a/app/src/main/java/com/kunminx/puremusic/MainActivity.java b/app/src/main/java/com/kunminx/puremusic/MainActivity.java index 7c180c3..918c857 100755 --- a/app/src/main/java/com/kunminx/puremusic/MainActivity.java +++ b/app/src/main/java/com/kunminx/puremusic/MainActivity.java @@ -32,6 +32,8 @@ import com.kunminx.puremusic.domain.message.PageMessenger; import com.kunminx.puremusic.domain.proxy.PlayerManager; +import java.util.Objects; + /** * Create by KunMinX at 19/10/16 */ @@ -50,7 +52,7 @@ protected void initViewModel() { @Override protected DataBindingConfig getDataBindingConfig() { return new DataBindingConfig(R.layout.activity_main, BR.vm, mStates) - .addBindingParam(BR.listener, new ListenerHandler()); + .addBindingParam(BR.listener, new ListenerHandler()); } @Override @@ -61,7 +63,7 @@ protected void onCreate(Bundle savedInstanceState) { switch (messages.eventId) { case Messages.EVENT_CLOSE_ACTIVITY_IF_ALLOWED: NavController nav = Navigation.findNavController(this, R.id.main_fragment_host); - if (nav.getCurrentDestination() != null && nav.getCurrentDestination().getId() != R.id.mainFragment) { + if (Objects.requireNonNull(nav.getCurrentDestination()).getId() != R.id.mainFragment) { nav.navigateUp(); } else if (Boolean.TRUE.equals(mStates.isDrawerOpened.get())) { mStates.openDrawer.set(false); diff --git a/app/src/main/java/com/kunminx/puremusic/data/api/APIs.java b/app/src/main/java/com/kunminx/puremusic/data/api/APIs.java deleted file mode 100644 index 1f48f86..0000000 --- a/app/src/main/java/com/kunminx/puremusic/data/api/APIs.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.kunminx.puremusic.data.api; - -/** - * Create by KunMinX at 2021/6/3 - */ -public class APIs { - public final static String BASE_URL = "https://test.com/"; -} diff --git a/app/src/main/java/com/kunminx/puremusic/ui/page/MainFragment.java b/app/src/main/java/com/kunminx/puremusic/ui/page/MainFragment.java index bd5f976..4c74fc7 100755 --- a/app/src/main/java/com/kunminx/puremusic/ui/page/MainFragment.java +++ b/app/src/main/java/com/kunminx/puremusic/ui/page/MainFragment.java @@ -96,12 +96,6 @@ public class ClickProxy { public void openMenu() { mMessenger.input(new Messages(Messages.EVENT_OPEN_DRAWER)); } - public void login() { - nav().navigate(R.id.action_mainFragment_to_loginFragment); - } - public void search() { - nav().navigate(R.id.action_mainFragment_to_searchFragment); - } } public static class MainStates extends StateHolder { diff --git a/app/src/main/java/com/kunminx/puremusic/ui/view/PlayPauseView.java b/app/src/main/java/com/kunminx/puremusic/ui/view/PlayPauseView.java index e3d1b80..1edcb2a 100755 --- a/app/src/main/java/com/kunminx/puremusic/ui/view/PlayPauseView.java +++ b/app/src/main/java/com/kunminx/puremusic/ui/view/PlayPauseView.java @@ -138,5 +138,4 @@ public void pause() { mAnimatorSet.setDuration(PLAY_PAUSE_ANIMATION_DURATION); pausePlayAnim.start(); } - } diff --git a/app/src/main/java/com/kunminx/puremusic/ui/widget/PlayerService.java b/app/src/main/java/com/kunminx/puremusic/ui/widget/PlayerService.java index 1491939..cf4bb89 100755 --- a/app/src/main/java/com/kunminx/puremusic/ui/widget/PlayerService.java +++ b/app/src/main/java/com/kunminx/puremusic/ui/widget/PlayerService.java @@ -201,5 +201,4 @@ public IBinder onBind(Intent intent) { return null; } - }