Skip to content

Commit

Permalink
simplify code
Browse files Browse the repository at this point in the history
  • Loading branch information
KunMinX committed Jun 14, 2023
1 parent 5460514 commit 37b0ab5
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 18 deletions.
6 changes: 4 additions & 2 deletions app/src/main/java/com/kunminx/puremusic/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand All @@ -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
Expand All @@ -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);
Expand Down
8 changes: 0 additions & 8 deletions app/src/main/java/com/kunminx/puremusic/data/api/APIs.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,5 +138,4 @@ public void pause() {
mAnimatorSet.setDuration(PLAY_PAUSE_ANIMATION_DURATION);
pausePlayAnim.start();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -201,5 +201,4 @@ public IBinder onBind(Intent intent) {
return null;
}


}

0 comments on commit 37b0ab5

Please sign in to comment.