From cc27191f82f8e4f9bb2aaac15cda8ec1eb4b14d2 Mon Sep 17 00:00:00 2001 From: GiKode <827266641@qq.com> Date: Thu, 10 Oct 2019 19:41:38 +0800 Subject: [PATCH] 1. Fix ViewModel Signed-off-by: Gikode <827266641@qq.com> --- app/build.gradle | 4 +- app/release/output.json | 1 + .../netsearch/NetSearchFragment.java | 10 ++ app/src/main/res/menu/menu_drawer.xml | 2 +- app/src/playstore/res/menu/menu_drawer.xml | 92 +++++++++++++++++++ 5 files changed, 106 insertions(+), 3 deletions(-) create mode 100644 app/release/output.json create mode 100644 app/src/playstore/res/menu/menu_drawer.xml diff --git a/app/build.gradle b/app/build.gradle index 7c9cfb9..1cc253a 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -49,8 +49,8 @@ android { renderscriptTargetApi 29 vectorDrawables.useSupportLibrary = true applicationId 'top.geek_studio.chenlongcould.musicplayer' - versionCode 169 - versionName '1.4.9.3' + versionCode 170 + versionName '1.4.9.4' multiDexEnabled = true multiDexKeepFile file('multidex-config.txt') applicationIdSuffix = 'Common' diff --git a/app/release/output.json b/app/release/output.json new file mode 100644 index 0000000..eba07cb --- /dev/null +++ b/app/release/output.json @@ -0,0 +1 @@ +[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":170,"versionName":"1.4.9.4","enabled":true,"outputFile":"app-release.apk","fullName":"release","baseName":"release"},"path":"app-release.apk","properties":{}}] \ No newline at end of file diff --git a/app/src/main/java/top/geek_studio/chenlongcould/musicplayer/ui/fragments/mainactivity/netsearch/NetSearchFragment.java b/app/src/main/java/top/geek_studio/chenlongcould/musicplayer/ui/fragments/mainactivity/netsearch/NetSearchFragment.java index 0d5dc5d..7ce5e40 100644 --- a/app/src/main/java/top/geek_studio/chenlongcould/musicplayer/ui/fragments/mainactivity/netsearch/NetSearchFragment.java +++ b/app/src/main/java/top/geek_studio/chenlongcould/musicplayer/ui/fragments/mainactivity/netsearch/NetSearchFragment.java @@ -18,6 +18,7 @@ import androidx.annotation.Nullable; import androidx.annotation.UiThread; import androidx.appcompat.widget.Toolbar; +import androidx.lifecycle.ViewModelProviders; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.transition.Fade; @@ -37,6 +38,7 @@ import butterknife.Unbinder; import top.geek_studio.chenlongcould.musicplayer.adapter.song.NetSearchSongAdapter; import top.geek_studio.chenlongcould.musicplayer.interfaces.TransDataCallback; +import top.geek_studio.chenlongcould.musicplayer.model.DataViewModel; import top.geek_studio.chenlongcould.musicplayer.model.NetSearchSong; import top.geek_studio.chenlongcould.musicplayer.threadPool.CustomThreadPool; import top.geek_studio.chenlongcould.musicplayer.ui.fragments.mainactivity.AbsMainActivityFragment; @@ -78,6 +80,8 @@ public class NetSearchFragment extends AbsMainActivityFragment { @BindView(R.id.toolbar) Toolbar toolbar; + private DataViewModel dataViewModel; + public static NetSearchFragment newInstance() { return new NetSearchFragment(); } @@ -122,6 +126,12 @@ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceStat // ... } + @Override + public void onActivityCreated(Bundle savedInstanceState) { + super.onActivityCreated(savedInstanceState); + dataViewModel = ViewModelProviders.of(getMainActivity()).get(DataViewModel.class); + } + private synchronized void initPlayer() { mediaPlayer = new MediaPlayer(); mediaPlayer.setOnErrorListener((mp, what, extra) -> { diff --git a/app/src/main/res/menu/menu_drawer.xml b/app/src/main/res/menu/menu_drawer.xml index 7d49dc5..7ec8dce 100644 --- a/app/src/main/res/menu/menu_drawer.xml +++ b/app/src/main/res/menu/menu_drawer.xml @@ -18,7 +18,7 @@ android:id="@+id/nav_net_search" android:icon="@drawable/ic_search_white_24dp" android:title="@string/netsearch" - android:visible="false" /> + android:visible="true" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +