| | |
| | | package com.auto.lyric.ui.collect; |
| | | |
| | | import com.auto.lyric.base.activities.BaseActivity; |
| | | import com.auto.lyric.base.model.BaseViewModel; |
| | | import com.auto.lyric.data.UserInfo; |
| | | import com.auto.lyric.retrofit.api.CollectApiCenter; |
| | | import com.auto.lyric.retrofit.observable.LoadingHttpObserver; |
| | | import com.auto.lyric.retrofit.utils.RetrofitUtils; |
| | | import com.google.gson.Gson; |
| | | |
| | | /** |
| | | * Created by Runt (qingingrunt2010@qq.com) on 2022/5/29. |
| | | */ |
| | | public class CollectViewModel extends BaseViewModel { |
| | | |
| | | public void getLrcList(LoadingHttpObserver<CollectListResult> observer){ |
| | | CollectApiCenter apiCenter; |
| | | UserInfo userInfo; |
| | | |
| | | public CollectViewModel(){ |
| | | apiCenter = RetrofitUtils.getInstance().getRetrofit(CollectApiCenter.class); |
| | | } |
| | | |
| | | @Override |
| | | public void onCreate(BaseActivity activity) { |
| | | super.onCreate(activity); |
| | | String key = activity.getStringProjectPrefrence("activeKey"); |
| | | userInfo = new Gson().fromJson(key,UserInfo.class); |
| | | } |
| | | |
| | | public void getLrcList(LoadingHttpObserver<CollectListResult> observer){ |
| | | httpObserverOn(apiCenter.getCollectList(getApiFileds(userInfo.userId,userInfo.activeKey)),observer); |
| | | } |
| | | |
| | | } |