diff --git a/app/build.gradle b/app/build.gradle index 0099592..9205473 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -12,8 +12,8 @@ android { applicationId "me.hgj.jetpackmvvm.demo" minSdkVersion 21 targetSdkVersion 29 - versionCode 5 - versionName "1.0.5" + versionCode 6 + versionName "1.0.6" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" /* ndk { // 设置支持的SO库架构 一般只设置这个就阔以设配所有的设备了,还可以减少apk的大小 @@ -70,7 +70,7 @@ android { dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" - implementation 'androidx.core:core-ktx:1.2.0' + implementation 'androidx.core:core-ktx:1.3.0' //test testImplementation 'junit:junit:4.13' androidTestImplementation 'androidx.test.ext:junit:1.1.1' @@ -80,7 +80,7 @@ dependencies { //androidx UI implementation 'androidx.appcompat:appcompat:1.1.0' implementation 'androidx.constraintlayout:constraintlayout:1.1.3' - implementation 'com.google.android.material:material:1.2.0-alpha06' + implementation 'com.google.android.material:material:1.3.0-alpha01' implementation 'androidx.cardview:cardview:1.0.0' implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0" implementation 'androidx.preference:preference:1.1.1' @@ -100,7 +100,7 @@ dependencies { implementation 'com.tencent:mmkv:1.0.22' //项目核心框架 implementation project(path: ':JetpackMvvm') -// implementation 'me.hegj:JetpackMvvm:1.1.0' +// implementation 'me.hegj:JetpackMvvm:1.1.1' //轮播图 implementation 'com.github.zhpanvip:BannerViewPager:2.6.6' //BaseAdapter @@ -114,14 +114,16 @@ dependencies { //官方的 implementation 'com.google.android:flexbox:2.0.1' //加载webview - implementation 'com.just.agentweb:agentweb:4.1.2' + implementation 'com.just.agentweb:agentweb:4.1.3' + implementation 'com.just.agentweb:filechooser:4.1.3' + implementation 'com.download.library:Downloader:4.1.3' //Bugly implementation'com.tencent.bugly:crashreport_upgrade:1.4.5' implementation'com.tencent.bugly:nativecrashreport:3.7.1' //glide implementation 'com.github.bumptech.glide:glide:4.11.0' //屏幕适配 - implementation 'me.jessyan:autosize:1.2.0' + implementation 'me.jessyan:autosize:1.2.1' //防崩溃 implementation 'cat.ereza:customactivityoncrash:2.3.0' diff --git a/app/priguardMapping.txt b/app/priguardMapping.txt index a22c4cd..f0b60f3 100644 --- a/app/priguardMapping.txt +++ b/app/priguardMapping.txt @@ -1,7 +1,7 @@ # compiler: R8 # compiler_version: 1.6.82 # min_api: 21 -# pg_map_id: a168504 +# pg_map_id: e742143 # common_typos_disable $$ServiceLoaderMethods -> a: java.util.Iterator $load1() -> a @@ -4944,6 +4944,284 @@ com.chad.library.adapter.base.provider.BaseItemProvider$longClickViewIds$2 -> co com.chad.library.adapter.base.provider.BaseItemProvider$longClickViewIds$2 INSTANCE -> a com.chad.library.adapter.base.util.AdapterUtilsKt -> com.chad.library.adapter.base.g.a: android.view.View getItemView(android.view.ViewGroup,int) -> a +com.download.library.DefaultFileComparator -> com.download.library.a: + int compare(java.lang.String,java.io.File,java.lang.String,java.lang.String) -> a +com.download.library.DefaultFileComparator$DefaultFileComparatorFactory -> com.download.library.a$a: + com.download.library.FileComparator newFileComparator() -> a +com.download.library.DefaultStorageEngine -> com.download.library.b: + android.content.Context mContext -> a + void save(java.lang.String,java.lang.String) -> a + java.lang.String get(java.lang.String,java.lang.String) -> b +com.download.library.DefaultStorageEngine$DefaultStorageEngineFactory -> com.download.library.b$a: + com.download.library.StorageEngine newStoraEngine(android.content.Context) -> a +com.download.library.DownloadImpl -> com.download.library.c: + android.content.Context mContext -> c + java.util.concurrent.ConcurrentHashMap mTasks -> a + com.download.library.DownloadImpl sInstance -> b + com.download.library.DownloadTask cancel(java.lang.String) -> a + boolean enqueue(com.download.library.DownloadTask) -> a + com.download.library.DownloadImpl getInstance() -> a + com.download.library.ResourceRequest with(android.content.Context) -> a + boolean exist(java.lang.String) -> b + void safe(com.download.library.DownloadTask) -> b + com.download.library.ResourceRequest with(java.lang.String) -> c + void remove(java.lang.String) -> d +com.download.library.DownloadListener -> com.download.library.d: +com.download.library.DownloadListenerAdapter -> com.download.library.e: +com.download.library.DownloadNotifier -> com.download.library.f: + java.lang.String mChannelId -> f + long sLastUpdateNoticationTime -> l + java.lang.String TAG -> k + java.lang.String mContent -> j + android.app.NotificationManager mNotificationManager -> b + androidx.core.app.NotificationCompat$Builder mBuilder -> d + android.content.Context mContext -> e + com.download.library.DownloadTask mDownloadTask -> i + int mNotificationId -> a + androidx.core.app.NotificationCompat$Action mAction -> h + android.os.Handler NOTIFICATION_UPDATE_QUEUE -> m + android.app.Notification mNotification -> c + boolean mAddedCancelAction -> g + void access$000(com.download.library.DownloadNotifier) -> a + android.app.PendingIntent buildCancelContent(android.content.Context,int,java.lang.String) -> a + void cancel() -> a + void initBuilder(com.download.library.DownloadTask) -> a + void onDownloaded(long) -> a + void onDownloading(int) -> a + void setDelecte(android.app.PendingIntent) -> a + void setProgress(int,int,boolean) -> a + java.lang.String byte2FitMemorySize(long) -> b + void onDownloadFinished() -> b + void updateTitle(com.download.library.DownloadTask) -> b + void cancel(com.download.library.DownloadTask) -> c + void onDownloadPaused() -> c + java.lang.String getTitle(com.download.library.DownloadTask) -> d + void onPreDownload() -> d + long getDelayTime() -> e + boolean hasDeleteContent() -> f + void removeCancelAction() -> g + void sent() -> h +com.download.library.DownloadNotifier$1 -> com.download.library.f$a: + com.download.library.DownloadNotifier this$0 -> a +com.download.library.DownloadNotifier$2 -> com.download.library.f$b: + com.download.library.DownloadNotifier this$0 -> a +com.download.library.DownloadTask -> com.download.library.DownloadTask: + java.lang.String TAG -> a + android.content.Context getContext() -> A + com.download.library.DownloadListener getDownloadListener() -> B + com.download.library.DownloadingListener getDownloadingListener() -> C + java.io.File getFile() -> D + android.net.Uri getFileUri() -> E + int getId() -> F + int getStatus() -> G + long getTotalsLength() -> H + long getUsedTime() -> I + boolean isCustomFile() -> J + boolean isUniquePath() -> K + void pause() -> L + void resetConnectTimes() -> M + void resetTime() -> N + com.download.library.DownloadTask setBlockMaxTime(long) -> a + com.download.library.DownloadTask setBreakPointDownload(boolean) -> a + com.download.library.DownloadTask setContentDisposition(java.lang.String) -> a + com.download.library.DownloadTask setContext(android.content.Context) -> a + com.download.library.DownloadTask setDownloadListener(com.download.library.DownloadListener) -> a + com.download.library.DownloadTask setDownloadListenerAdapter(com.download.library.DownloadListenerAdapter) -> a + com.download.library.DownloadTask setDownloadingListener(com.download.library.DownloadingListener) -> a + com.download.library.DownloadTask setFileSafe(java.io.File) -> a + com.download.library.DownloadTask setIcon(int) -> a + com.download.library.DownloadTask setConnectTimeOut(long) -> b + com.download.library.DownloadTask setEnableIndicator(boolean) -> b + com.download.library.DownloadTask setFileMD5(java.lang.String) -> b + void setStatus(int) -> b + com.download.library.DownloadTask setContentLength(long) -> c + com.download.library.DownloadTask setForceDownload(boolean) -> c + com.download.library.DownloadTask setMimetype(java.lang.String) -> c + com.download.library.DownloadTask setDownloadTimeOut(long) -> d + com.download.library.DownloadTask setParallelDownload(boolean) -> d + com.download.library.DownloadTask setUrl(java.lang.String) -> d + void setLoaded(long) -> e + com.download.library.DownloadTask setUserAgent(java.lang.String) -> e + void setTotalsLength(long) -> f + void updateTime(long) -> g + java.lang.String getFileMD5() -> j + com.download.library.DownloadTask autoOpenIgnoreMD5() -> v + com.download.library.DownloadTask closeAutoOpen() -> w + void completed() -> x + void destroy() -> y + java.lang.String getAuthority() -> z +com.download.library.Downloader -> com.download.library.g: + long mConnectTimeOut -> j + long mDownloadTimeOut -> i + android.os.Handler HANDLER -> u + boolean enableProgress -> o + com.download.library.DownloadNotifier mDownloadNotifier -> k + boolean mCallbackInMainThread -> p + android.util.SparseArray DOWNLOAD_MESSAGE -> s + long mLastTime -> f + com.download.library.DownloadTask mDownloadTask -> a + long mUsedTime -> e + long mBeginTime -> g + long mLoaded -> b + java.lang.Throwable mThrowable -> h + long mLastLoaded -> d + long mTotals -> c + boolean quickProgress -> q + java.lang.String TAG -> r + java.util.concurrent.Executor SERIAL_EXECUTOR -> t + java.util.concurrent.atomic.AtomicBoolean mIsShutdown -> n + java.util.concurrent.atomic.AtomicBoolean mIsPaused -> m + java.util.concurrent.atomic.AtomicBoolean mIsCanceled -> l + void access$000(com.download.library.Downloader,com.download.library.DownloadTask) -> a + long access$100(com.download.library.Downloader) -> a + long access$102(com.download.library.Downloader,long) -> a + void access$400(com.download.library.Downloader,java.lang.Object[]) -> a + com.download.library.DownloadTask cancelDownload() -> a + void checkIsNullTask(com.download.library.DownloadTask) -> a + void closeIO(java.io.Closeable) -> a + java.net.HttpURLConnection createUrlConnection(java.net.URL) -> a + java.lang.Integer doInBackground(java.lang.Void[]) -> a + long getHeaderFieldLong(java.net.HttpURLConnection,java.lang.String) -> a + java.io.InputStream getInputStream(java.net.HttpURLConnection) -> a + void onPostExecute(java.lang.Integer) -> a + void onProgressUpdate(java.lang.Integer[]) -> a + void rangeHeaders(com.download.library.DownloadTask,java.net.HttpURLConnection) -> a + int transferData(java.io.InputStream,java.io.RandomAccessFile,boolean) -> a + long access$200(com.download.library.Downloader) -> b + long access$302(com.download.library.Downloader,long) -> b + void access$500(com.download.library.Downloader,java.lang.Object[]) -> b + com.download.library.DownloadTask cancel() -> b + boolean doCallback(java.lang.Integer) -> b + boolean download(com.download.library.DownloadTask) -> b + void saveEtag(java.net.HttpURLConnection) -> b + void settingHeaders(com.download.library.DownloadTask,java.net.HttpURLConnection) -> b + long access$300(com.download.library.Downloader) -> c + void access$600(com.download.library.Downloader,java.lang.Object[]) -> c + void destroyTask() -> c + boolean downloadInternal(com.download.library.DownloadTask) -> c + void start(java.net.HttpURLConnection) -> c + void onStart() -> d + void run(com.download.library.DownloadTask) -> d + boolean checkNet() -> e + boolean checkSpace() -> f + void createNotifier() -> g + int doDownload() -> h + long getAvailableStorage() -> i + java.lang.String getEtag() -> j + void updateNotifierTitle() -> k +com.download.library.Downloader$1 -> com.download.library.g$a: + com.download.library.DownloadTask val$downloadTask -> a +com.download.library.Downloader$2 -> com.download.library.g$b: + com.download.library.DownloadTask val$downloadTask -> a + com.download.library.Downloader this$0 -> b +com.download.library.Downloader$LoadingRandomAccessFile -> com.download.library.g$c: + com.download.library.Downloader this$0 -> a +com.download.library.DownloadingListener -> com.download.library.h: +com.download.library.DownloadingListener$MainThread -> com.download.library.h$a: +com.download.library.ExecuteTask -> com.download.library.i: + com.download.library.DownloadTask cancelDownload() -> a +com.download.library.ExecuteTasksMap -> com.download.library.j: + java.util.concurrent.ConcurrentHashMap mTasks -> a + void addTask(java.lang.String,com.download.library.ExecuteTask) -> a + com.download.library.DownloadTask cancelTask(java.lang.String) -> a + com.download.library.ExecuteTasksMap getInstance() -> a + boolean exist(java.lang.String) -> b + void removeTask(java.lang.String) -> c +com.download.library.ExecuteTasksMap$1 -> com.download.library.j$a: +com.download.library.ExecuteTasksMap$ExecuteTaskHolder -> com.download.library.j$b: + com.download.library.ExecuteTasksMap INSTANCE -> a + com.download.library.ExecuteTasksMap access$000() -> a +com.download.library.Extra -> com.download.library.Extra: + long getBlockMaxTime() -> a + long getConnectTimeOut() -> b + java.lang.String getContentDisposition() -> e + int getDownloadDoneIcon() -> f + int getDownloadIcon() -> h + long getDownloadTimeOut() -> i + java.lang.String getFileMD5() -> j + java.util.Map getHeaders() -> k + java.lang.String getMimetype() -> l + java.lang.String getTargetCompareMD5() -> m + java.lang.String getUrl() -> n + java.lang.String getUserAgent() -> o + boolean isAutoOpen() -> p + boolean isBreakPointDownload() -> q + boolean isEnableIndicator() -> r + boolean isForceDownload() -> s + boolean isParallelDownload() -> t + boolean isQuickProgress() -> u +com.download.library.FileComparator -> com.download.library.k: + int compare(java.lang.String,java.io.File,java.lang.String,java.lang.String) -> a +com.download.library.FileComparator$FileComparatorFactory -> com.download.library.k$a: + com.download.library.FileComparator newFileComparator() -> a +com.download.library.ResourceRequest -> com.download.library.l: + com.download.library.DownloadTask mDownloadTask -> a + com.download.library.ResourceRequest addHeader(java.lang.String,java.lang.String) -> a + com.download.library.ResourceRequest autoOpenIgnoreMD5() -> a + void enqueue(com.download.library.DownloadListenerAdapter) -> a + com.download.library.ResourceRequest setEnableIndicator(boolean) -> a + com.download.library.ResourceRequest url(java.lang.String) -> a + com.download.library.ResourceRequest with(android.content.Context) -> a + com.download.library.DownloadTask getDownloadTask() -> b + com.download.library.ResourceRequest setDownloadListenerAdapter(com.download.library.DownloadListenerAdapter) -> b + com.download.library.ResourceRequest setForceDownload(boolean) -> b +com.download.library.Runtime -> com.download.library.m: + java.lang.String authority -> f + java.io.File mDownloadDir -> d + com.download.library.DownloadTask sDefaultDownloadTask -> a + java.util.regex.Pattern CONTENT_DISPOSITION_WITHOUT_ASTERISK_PATTERN -> m + java.util.regex.Pattern DISPOSITION_PATTERN -> l + com.download.library.Runtime sInstance -> k + java.util.concurrent.atomic.AtomicInteger mThreadGlobalCounter -> c + java.util.concurrent.atomic.AtomicInteger mIDGenerator -> b + com.download.library.FileComparator$FileComparatorFactory mFileComparatorFactory -> i + boolean DEBUG -> e + com.download.library.StorageEngine mStorageEngine -> g + com.download.library.FileComparator mFileComparator -> j + com.download.library.StorageEngine$StorageEngineFactory mStorageEngineFactory -> h + boolean checkNetwork(android.content.Context) -> a + java.io.File createFile(android.content.Context,com.download.library.Extra) -> a + java.io.File createFile(android.content.Context,com.download.library.Extra,java.io.File) -> a + java.io.File createFileByName(java.io.File,android.content.Context,java.lang.String,boolean) -> a + int generateGlobalId() -> a + android.content.Intent getCommonFileIntentCompat(android.content.Context,com.download.library.DownloadTask) -> a + java.io.File getDir(android.content.Context,boolean) -> a + java.lang.String getFileNameByContentDisposition(java.lang.String) -> a + java.lang.String getMIMEType(java.io.File) -> a + android.net.Uri getUriFromFile(android.content.Context,java.io.File,java.lang.String) -> a + void log(java.lang.String,java.lang.String) -> a + void setIntentDataAndType(android.content.Context,android.content.Intent,java.lang.String,java.io.File,boolean,java.lang.String) -> a + java.io.File uniqueFile(com.download.library.DownloadTask,java.io.File) -> a + boolean checkWifi(android.content.Context) -> b + int generateGlobalThreadId() -> b + void logError(java.lang.String,java.lang.String) -> b + java.lang.String md5(java.io.File) -> b + java.lang.String md5(java.lang.String) -> b + java.lang.String getApplicationName(android.content.Context) -> c + com.download.library.DownloadTask getDefaultDownloadTask() -> c + com.download.library.FileComparator getFileComparator() -> d + com.download.library.StorageEngine getStorageEngine(android.content.Context) -> d + java.lang.String getAuthority(android.content.Context) -> e + com.download.library.FileComparator$FileComparatorFactory getFileComparatorFactory() -> e + java.lang.String getIdentify() -> f + com.download.library.StorageEngine$StorageEngineFactory getStorageEngineFactory() -> g + java.lang.String getVersion() -> h + boolean isDebug() -> i + void createDefaultDownloadTask() -> j + com.download.library.Runtime getInstance() -> k +com.download.library.SerialExecutor -> com.download.library.n: + java.lang.Runnable mActive -> b + java.util.concurrent.Executor THREAD_POOL_EXECUTOR -> c + java.util.ArrayDeque mTasks -> a + void scheduleNext() -> a +com.download.library.SerialExecutor$1 -> com.download.library.n$a: + com.download.library.SerialExecutor this$0 -> b + java.lang.Runnable val$r -> a +com.download.library.StorageEngine -> com.download.library.o: + void save(java.lang.String,java.lang.String) -> a + java.lang.String get(java.lang.String,java.lang.String) -> b +com.download.library.StorageEngine$StorageEngineFactory -> com.download.library.o$a: + com.download.library.StorageEngine newStoraEngine(android.content.Context) -> a com.franmontiel.persistentcookiejar.PersistentCookieJar -> com.franmontiel.persistentcookiejar.PersistentCookieJar: com.franmontiel.persistentcookiejar.cache.CookieCache cache -> b com.franmontiel.persistentcookiejar.persistence.CookiePersistor persistor -> c @@ -9784,10 +10062,8 @@ kotlin.collections.EmptySet -> kotlin.collections.EmptySet: kotlin.collections.IntIterator -> kotlin.collections.u: kotlin.collections.LongIterator -> kotlin.collections.v: kotlin.collections.MapsKt -> kotlin.collections.w: - java.util.Map emptyMap() -> a int mapCapacity(int) -> a java.util.Map toMap(java.lang.Iterable) -> a - java.util.List toList(java.util.Map) -> c kotlin.collections.MapsKt__MapWithDefaultKt -> kotlin.collections.x: kotlin.collections.MapsKt__MapsJVMKt -> kotlin.collections.y: int mapCapacity(int) -> a @@ -9800,7 +10076,6 @@ kotlin.collections.MapsKt__MapsKt -> kotlin.collections.z: java.util.Map toMap(java.lang.Iterable,java.util.Map) -> a java.util.Map optimizeReadOnlyMap(java.util.Map) -> b kotlin.collections.MapsKt___MapsKt -> kotlin.collections.a0: - java.util.List toList(java.util.Map) -> c kotlin.collections.SetsKt__SetsJVMKt -> kotlin.collections.b0: java.util.Set setOf(java.lang.Object) -> a kotlin.collections.SetsKt__SetsKt -> kotlin.collections.c0: @@ -11300,16 +11575,20 @@ me.hgj.jetpackmvvm.base.Ktx -> me.hgj.jetpackmvvm.base.Ktx: me.hgj.jetpackmvvm.base.Ktx$Companion -> me.hgj.jetpackmvvm.base.Ktx$a: android.app.Application getApp() -> a me.hgj.jetpackmvvm.base.activity.BaseVmActivity -> me.hgj.jetpackmvvm.base.activity.BaseVmActivity: - me.hgj.jetpackmvvm.base.viewmodel.BaseViewModel mViewModel -> a + me.hgj.jetpackmvvm.base.viewmodel.BaseViewModel mViewModel -> b + boolean isUserDb -> a void createObserver() -> a void initView(android.os.Bundle) -> a void onNetworkStateChanged(me.hgj.jetpackmvvm.network.manager.NetState) -> a void showLoading(java.lang.String) -> a + void userDataBinding(boolean) -> a void dismissLoading() -> b - int layoutId() -> c - me.hgj.jetpackmvvm.base.viewmodel.BaseViewModel createViewModel() -> d - void registerUiChange() -> e -me.hgj.jetpackmvvm.base.activity.BaseVmActivity$onCreate$1 -> me.hgj.jetpackmvvm.base.activity.BaseVmActivity$a: + void init(android.os.Bundle) -> b + void initDataBind() -> c + int layoutId() -> d + me.hgj.jetpackmvvm.base.viewmodel.BaseViewModel createViewModel() -> e + void registerUiChange() -> f +me.hgj.jetpackmvvm.base.activity.BaseVmActivity$init$1 -> me.hgj.jetpackmvvm.base.activity.BaseVmActivity$a: me.hgj.jetpackmvvm.base.activity.BaseVmActivity this$0 -> a void onChanged(me.hgj.jetpackmvvm.network.manager.NetState) -> a me.hgj.jetpackmvvm.base.activity.BaseVmActivity$registerUiChange$1 -> me.hgj.jetpackmvvm.base.activity.BaseVmActivity$b: @@ -11319,56 +11598,14 @@ me.hgj.jetpackmvvm.base.activity.BaseVmActivity$registerUiChange$2 -> me.hgj.jet me.hgj.jetpackmvvm.base.activity.BaseVmActivity this$0 -> a void onChanged(java.lang.Void) -> a me.hgj.jetpackmvvm.base.activity.BaseVmDbActivity -> me.hgj.jetpackmvvm.base.activity.BaseVmDbActivity: - me.hgj.jetpackmvvm.base.viewmodel.BaseViewModel mViewModel -> a - androidx.databinding.ViewDataBinding mDatabind -> b - void createObserver() -> a - void initView(android.os.Bundle) -> a - void onNetworkStateChanged(me.hgj.jetpackmvvm.network.manager.NetState) -> a - void showLoading(java.lang.String) -> a - void dismissLoading() -> b - androidx.databinding.ViewDataBinding getMDatabind() -> c - int layoutId() -> d - void createViewDataBinding() -> e - me.hgj.jetpackmvvm.base.viewmodel.BaseViewModel createViewModel() -> f - void registorDefUIChange() -> g -me.hgj.jetpackmvvm.base.activity.BaseVmDbActivity$onCreate$1 -> me.hgj.jetpackmvvm.base.activity.BaseVmDbActivity$a: - me.hgj.jetpackmvvm.base.activity.BaseVmDbActivity this$0 -> a - void onChanged(me.hgj.jetpackmvvm.network.manager.NetState) -> a -me.hgj.jetpackmvvm.base.activity.BaseVmDbActivity$registorDefUIChange$1 -> me.hgj.jetpackmvvm.base.activity.BaseVmDbActivity$b: - me.hgj.jetpackmvvm.base.activity.BaseVmDbActivity this$0 -> a - void onChanged(java.lang.String) -> a -me.hgj.jetpackmvvm.base.activity.BaseVmDbActivity$registorDefUIChange$2 -> me.hgj.jetpackmvvm.base.activity.BaseVmDbActivity$c: - me.hgj.jetpackmvvm.base.activity.BaseVmDbActivity this$0 -> a - void onChanged(java.lang.Void) -> a -me.hgj.jetpackmvvm.base.fragment.BaseVmDbFragment -> me.hgj.jetpackmvvm.base.fragment.BaseVmDbFragment: - me.hgj.jetpackmvvm.base.viewmodel.BaseViewModel mViewModel -> b androidx.databinding.ViewDataBinding mDatabind -> c - boolean isFirst -> a - java.util.HashMap _$_findViewCache -> d - void initView(android.os.Bundle) -> a - void onNetworkStateChanged(me.hgj.jetpackmvvm.network.manager.NetState) -> a - void showLoading(java.lang.String) -> a - void showLoading$default(me.hgj.jetpackmvvm.base.fragment.BaseVmDbFragment,java.lang.String,int,java.lang.Object) -> a + void initDataBind() -> c + androidx.databinding.ViewDataBinding getMDatabind() -> e +me.hgj.jetpackmvvm.base.fragment.BaseVmDbFragment -> me.hgj.jetpackmvvm.base.fragment.BaseVmDbFragment: + androidx.databinding.ViewDataBinding mDatabind -> d + java.util.HashMap _$_findViewCache -> e void _$_clearFindViewByIdCache() -> d - void createObserver() -> e - void dismissLoading() -> f - androidx.databinding.ViewDataBinding getMDatabind() -> g - me.hgj.jetpackmvvm.base.viewmodel.BaseViewModel getMViewModel() -> h - void initData() -> i - int layoutId() -> j - void lazyLoadData() -> k - me.hgj.jetpackmvvm.base.viewmodel.BaseViewModel createViewModel() -> l - void onVisible() -> m - void registorDefUIChange() -> n -me.hgj.jetpackmvvm.base.fragment.BaseVmDbFragment$onVisible$1 -> me.hgj.jetpackmvvm.base.fragment.BaseVmDbFragment$a: - me.hgj.jetpackmvvm.base.fragment.BaseVmDbFragment this$0 -> a - void onChanged(me.hgj.jetpackmvvm.network.manager.NetState) -> a -me.hgj.jetpackmvvm.base.fragment.BaseVmDbFragment$registorDefUIChange$1 -> me.hgj.jetpackmvvm.base.fragment.BaseVmDbFragment$b: - me.hgj.jetpackmvvm.base.fragment.BaseVmDbFragment this$0 -> a - void onChanged(java.lang.String) -> a -me.hgj.jetpackmvvm.base.fragment.BaseVmDbFragment$registorDefUIChange$2 -> me.hgj.jetpackmvvm.base.fragment.BaseVmDbFragment$c: - me.hgj.jetpackmvvm.base.fragment.BaseVmDbFragment this$0 -> a - void onChanged(java.lang.Void) -> a + androidx.databinding.ViewDataBinding getMDatabind() -> k me.hgj.jetpackmvvm.base.fragment.BaseVmFragment -> me.hgj.jetpackmvvm.base.fragment.BaseVmFragment: me.hgj.jetpackmvvm.base.viewmodel.BaseViewModel mViewModel -> b boolean isFirst -> a @@ -11380,12 +11617,13 @@ me.hgj.jetpackmvvm.base.fragment.BaseVmFragment -> me.hgj.jetpackmvvm.base.fragm void _$_clearFindViewByIdCache() -> d void createObserver() -> e void dismissLoading() -> f - void initData() -> g - int layoutId() -> h - void lazyLoadData() -> i - me.hgj.jetpackmvvm.base.viewmodel.BaseViewModel createViewModel() -> j - void onVisible() -> k - void registorDefUIChange() -> l + me.hgj.jetpackmvvm.base.viewmodel.BaseViewModel getMViewModel() -> g + void initData() -> h + int layoutId() -> i + void lazyLoadData() -> j + me.hgj.jetpackmvvm.base.viewmodel.BaseViewModel createViewModel() -> k + void onVisible() -> l + void registorDefUIChange() -> m me.hgj.jetpackmvvm.base.fragment.BaseVmFragment$onViewCreated$1 -> me.hgj.jetpackmvvm.base.fragment.BaseVmFragment$a: me.hgj.jetpackmvvm.base.fragment.BaseVmFragment this$0 -> a void onChanged(me.hgj.jetpackmvvm.network.manager.NetState) -> a @@ -11401,16 +11639,81 @@ me.hgj.jetpackmvvm.base.viewmodel.BaseViewModel -> me.hgj.jetpackmvvm.base.viewm me.hgj.jetpackmvvm.base.viewmodel.BaseViewModel$UiLoadingChange -> me.hgj.jetpackmvvm.base.viewmodel.BaseViewModel$UiLoadingChange: kotlin.Lazy dismissDialog$delegate -> b kotlin.Lazy showDialog$delegate -> a - me.hgj.jetpackmvvm.state.SingleLiveEvent getDismissDialog() -> a - me.hgj.jetpackmvvm.state.SingleLiveEvent getShowDialog() -> b + me.hgj.jetpackmvvm.callback.livedata.SingleLiveEvent getDismissDialog() -> a + me.hgj.jetpackmvvm.callback.livedata.SingleLiveEvent getShowDialog() -> b me.hgj.jetpackmvvm.base.viewmodel.BaseViewModel$UiLoadingChange$dismissDialog$2 -> me.hgj.jetpackmvvm.base.viewmodel.BaseViewModel$UiLoadingChange$dismissDialog$2: me.hgj.jetpackmvvm.base.viewmodel.BaseViewModel$UiLoadingChange$dismissDialog$2 INSTANCE -> a me.hgj.jetpackmvvm.base.viewmodel.BaseViewModel$UiLoadingChange$showDialog$2 -> me.hgj.jetpackmvvm.base.viewmodel.BaseViewModel$UiLoadingChange$showDialog$2: me.hgj.jetpackmvvm.base.viewmodel.BaseViewModel$UiLoadingChange$showDialog$2 INSTANCE -> a +me.hgj.jetpackmvvm.callback.livedata.SingleLiveEvent -> me.hgj.jetpackmvvm.callback.livedata.SingleLiveEvent: + java.util.concurrent.atomic.AtomicBoolean mPending -> a + java.util.concurrent.atomic.AtomicBoolean access$getMPending$p(me.hgj.jetpackmvvm.callback.livedata.SingleLiveEvent) -> a + void call() -> a +me.hgj.jetpackmvvm.callback.livedata.SingleLiveEvent$observe$1 -> me.hgj.jetpackmvvm.callback.livedata.SingleLiveEvent$a: + androidx.lifecycle.Observer $observer -> b + me.hgj.jetpackmvvm.callback.livedata.SingleLiveEvent this$0 -> a me.hgj.jetpackmvvm.callback.livedata.UnPeekLiveData -> me.hgj.jetpackmvvm.callback.livedata.UnPeekLiveData: void hook(androidx.lifecycle.Observer) -> a me.hgj.jetpackmvvm.callback.livedata.UnPeekNotNullLiveData -> me.hgj.jetpackmvvm.callback.livedata.UnPeekNotNullLiveData: void hook(androidx.lifecycle.Observer) -> a +me.hgj.jetpackmvvm.callback.livedata.event.Event -> me.hgj.jetpackmvvm.callback.livedata.event.a: + java.lang.Object content -> b + boolean hasHandled -> a + java.lang.Object getContent() -> a +me.hgj.jetpackmvvm.callback.livedata.event.EventBaseLiveData -> me.hgj.jetpackmvvm.callback.livedata.event.EventBaseLiveData: + java.lang.Object NOT_SET -> j + me.hgj.jetpackmvvm.callback.livedata.event.EventBaseLiveData$Companion Companion -> k + java.lang.Runnable mPostValueRunnable -> i + java.lang.Object mData -> d + java.lang.Object mPendingData -> e + androidx.arch.core.internal.SafeIterableMap mObservers -> b + int version -> f + boolean mDispatchingValue -> g + java.lang.Object mDataLock -> a + boolean mDispatchInvalidated -> h + int mActiveCount -> c + java.lang.Object access$getMDataLock$p(me.hgj.jetpackmvvm.callback.livedata.event.EventBaseLiveData) -> a + void considerNotify(me.hgj.jetpackmvvm.callback.livedata.event.EventBaseLiveData$ObserverWrapper,java.lang.Object) -> a + void dispatchingValue(me.hgj.jetpackmvvm.callback.livedata.event.EventBaseLiveData$ObserverWrapper) -> a + int getMActiveCount() -> a + void observe(androidx.lifecycle.LifecycleOwner,androidx.lifecycle.Observer) -> a + void postValue(me.hgj.jetpackmvvm.callback.livedata.event.Event) -> a + void removeObserver(androidx.lifecycle.Observer) -> a + void setMActiveCount(int) -> a + void setMPendingData(java.lang.Object) -> a + java.lang.Object getMPendingData() -> b + void setValue(me.hgj.jetpackmvvm.callback.livedata.event.Event) -> b + void onActive() -> c + void onInactive() -> d + java.lang.Object access$getNOT_SET$cp() -> e +me.hgj.jetpackmvvm.callback.livedata.event.EventBaseLiveData$Companion -> me.hgj.jetpackmvvm.callback.livedata.event.EventBaseLiveData$a: + void assertMainThread(java.lang.String) -> a + java.lang.Object getNOT_SET() -> a +me.hgj.jetpackmvvm.callback.livedata.event.EventBaseLiveData$LifecycleBoundObserver -> me.hgj.jetpackmvvm.callback.livedata.event.EventBaseLiveData$LifecycleBoundObserver: + androidx.lifecycle.LifecycleOwner mOwner -> e + me.hgj.jetpackmvvm.callback.livedata.event.EventBaseLiveData this$0 -> f + void detachObserver() -> a + boolean isAttachedTo(androidx.lifecycle.LifecycleOwner) -> a + boolean shouldBeActive() -> e +me.hgj.jetpackmvvm.callback.livedata.event.EventBaseLiveData$ObserverWrapper -> me.hgj.jetpackmvvm.callback.livedata.event.EventBaseLiveData$b: + androidx.lifecycle.Observer mEventObserver -> c + boolean mActive -> a + int mLastVersion -> b + me.hgj.jetpackmvvm.callback.livedata.event.EventBaseLiveData this$0 -> d + void activeStateChanged(boolean) -> a + void detachObserver() -> a + boolean isAttachedTo(androidx.lifecycle.LifecycleOwner) -> a + void setMLastVersion(int) -> a + boolean getMActive() -> b + androidx.lifecycle.Observer getMEventObserver() -> c + int getMLastVersion() -> d + boolean shouldBeActive() -> e +me.hgj.jetpackmvvm.callback.livedata.event.EventBaseLiveData$mPostValueRunnable$1 -> me.hgj.jetpackmvvm.callback.livedata.event.EventBaseLiveData$c: + me.hgj.jetpackmvvm.callback.livedata.event.EventBaseLiveData this$0 -> a +me.hgj.jetpackmvvm.callback.livedata.event.EventLiveData -> me.hgj.jetpackmvvm.callback.livedata.event.b: + void postValue(me.hgj.jetpackmvvm.callback.livedata.event.Event) -> a + void postValue(java.lang.Object) -> b + void setValue(me.hgj.jetpackmvvm.callback.livedata.event.Event) -> b me.hgj.jetpackmvvm.demo.DataBinderMapperImpl -> me.hgj.jetpackmvvm.demo.DataBinderMapperImpl: android.util.SparseIntArray INTERNAL_LAYOUT_ID_LOOKUP -> a me.hgj.jetpackmvvm.demo.DataBinderMapperImpl$InnerBrLookup -> me.hgj.jetpackmvvm.demo.DataBinderMapperImpl$a: @@ -11424,42 +11727,39 @@ me.hgj.jetpackmvvm.demo.app.App -> me.hgj.jetpackmvvm.demo.app.App: me.hgj.jetpackmvvm.demo.app.App$Companion -> me.hgj.jetpackmvvm.demo.app.App$a: me.hgj.jetpackmvvm.demo.app.App getInstance() -> a me.hgj.jetpackmvvm.demo.app.base.BaseActivity -> me.hgj.jetpackmvvm.demo.app.base.BaseActivity: - kotlin.Lazy shareViewModel$delegate -> d - com.afollestad.materialdialogs.MaterialDialog dialog -> c + com.afollestad.materialdialogs.MaterialDialog dialog -> d + kotlin.Lazy shareViewModel$delegate -> e void createObserver() -> a void showLoading(java.lang.String) -> a void dismissLoading() -> b - me.hgj.jetpackmvvm.demo.app.event.AppViewModel getShareViewModel() -> e + me.hgj.jetpackmvvm.demo.app.event.AppViewModel getShareViewModel() -> f me.hgj.jetpackmvvm.demo.app.base.BaseFragment -> me.hgj.jetpackmvvm.demo.app.base.BaseFragment: - com.afollestad.materialdialogs.MaterialDialog dialog -> e - java.util.HashMap _$_findViewCache -> h - kotlin.Lazy shareViewModel$delegate -> f - kotlin.Lazy eventViewModel$delegate -> g + java.util.HashMap _$_findViewCache -> i + com.afollestad.materialdialogs.MaterialDialog dialog -> f + kotlin.Lazy shareViewModel$delegate -> g + kotlin.Lazy eventViewModel$delegate -> h void showLoading(java.lang.String) -> a void _$_clearFindViewByIdCache() -> d void createObserver() -> e void dismissLoading() -> f - void initData() -> i + void initData() -> h + void lazyLoadData() -> j me.hgj.jetpackmvvm.demo.app.event.EventViewModel getEventViewModel() -> l me.hgj.jetpackmvvm.demo.app.event.AppViewModel getShareViewModel() -> m me.hgj.jetpackmvvm.demo.app.event.AppViewModel -> me.hgj.jetpackmvvm.demo.app.event.AppViewModel: - me.hgj.jetpackmvvm.callback.livedata.UnPeekLiveData userinfo -> d - me.hgj.jetpackmvvm.callback.livedata.UnPeekNotNullLiveData appAnimation -> f - me.hgj.jetpackmvvm.callback.livedata.UnPeekNotNullLiveData appColor -> e - me.hgj.jetpackmvvm.callback.livedata.UnPeekNotNullLiveData isLogin -> c - me.hgj.jetpackmvvm.callback.livedata.UnPeekNotNullLiveData isFirst -> b + me.hgj.jetpackmvvm.callback.livedata.UnPeekLiveData userinfo -> b + me.hgj.jetpackmvvm.callback.livedata.UnPeekNotNullLiveData appAnimation -> d + me.hgj.jetpackmvvm.callback.livedata.UnPeekNotNullLiveData appColor -> c me.hgj.jetpackmvvm.callback.livedata.UnPeekNotNullLiveData getAppAnimation() -> b me.hgj.jetpackmvvm.callback.livedata.UnPeekNotNullLiveData getAppColor() -> c me.hgj.jetpackmvvm.callback.livedata.UnPeekLiveData getUserinfo() -> d - me.hgj.jetpackmvvm.callback.livedata.UnPeekNotNullLiveData isFirst() -> e - me.hgj.jetpackmvvm.callback.livedata.UnPeekNotNullLiveData isLogin() -> f me.hgj.jetpackmvvm.demo.app.event.EventViewModel -> me.hgj.jetpackmvvm.demo.app.event.EventViewModel: - me.hgj.jetpackmvvm.callback.livedata.UnPeekLiveData collect -> b - me.hgj.jetpackmvvm.callback.livedata.UnPeekLiveData addTodo -> d - me.hgj.jetpackmvvm.callback.livedata.UnPeekLiveData shareArticle -> c - me.hgj.jetpackmvvm.callback.livedata.UnPeekLiveData getAddTodo() -> b - me.hgj.jetpackmvvm.callback.livedata.UnPeekLiveData getCollect() -> c - me.hgj.jetpackmvvm.callback.livedata.UnPeekLiveData getShareArticle() -> d + me.hgj.jetpackmvvm.callback.livedata.event.EventLiveData shareArticleEvent -> c + me.hgj.jetpackmvvm.callback.livedata.event.EventLiveData todoEvent -> d + me.hgj.jetpackmvvm.callback.livedata.event.EventLiveData collectEvent -> b + me.hgj.jetpackmvvm.callback.livedata.event.EventLiveData getCollectEvent() -> b + me.hgj.jetpackmvvm.callback.livedata.event.EventLiveData getShareArticleEvent() -> c + me.hgj.jetpackmvvm.callback.livedata.event.EventLiveData getTodoEvent() -> d me.hgj.jetpackmvvm.demo.app.ext.AdapterExtKt -> me.hgj.jetpackmvvm.demo.app.ext.a: long adapterchildlastClickTime -> b long adapterlastClickTime -> a @@ -11504,13 +11804,13 @@ me.hgj.jetpackmvvm.demo.app.ext.AppExtKt$showMessage$4 -> me.hgj.jetpackmvvm.dem me.hgj.jetpackmvvm.demo.app.ext.AppExtKt$showMessage$5 -> me.hgj.jetpackmvvm.demo.app.ext.AppExtKt$showMessage$5: me.hgj.jetpackmvvm.demo.app.ext.AppExtKt$showMessage$5 INSTANCE -> a me.hgj.jetpackmvvm.demo.app.ext.CustomViewExtKt -> me.hgj.jetpackmvvm.demo.app.ext.CustomViewExtKt: - com.kingja.loadsir.core.LoadService LoadServiceInit(android.view.View,kotlin.jvm.functions.Function0) -> a void bindViewPager2(net.lucode.hackware.magicindicator.MagicIndicator,androidx.viewpager2.widget.ViewPager2,java.util.ArrayList,java.util.ArrayList,kotlin.jvm.functions.Function1) -> a void bindViewPager2$default(net.lucode.hackware.magicindicator.MagicIndicator,androidx.viewpager2.widget.ViewPager2,java.util.ArrayList,java.util.ArrayList,kotlin.jvm.functions.Function1,int,java.lang.Object) -> a void hideSoftKeyboard(android.app.Activity) -> a androidx.appcompat.widget.Toolbar init(androidx.appcompat.widget.Toolbar,java.lang.String) -> a androidx.recyclerview.widget.RecyclerView init(androidx.recyclerview.widget.RecyclerView,androidx.recyclerview.widget.RecyclerView$LayoutManager,androidx.recyclerview.widget.RecyclerView$Adapter,boolean) -> a androidx.viewpager2.widget.ViewPager2 init(androidx.viewpager2.widget.ViewPager2,androidx.fragment.app.Fragment,java.util.ArrayList,boolean) -> a + com.ittianyu.bottomnavigationviewex.BottomNavigationViewEx init(com.ittianyu.bottomnavigationviewex.BottomNavigationViewEx,kotlin.jvm.functions.Function1) -> a com.yanzhenjie.recyclerview.SwipeRecyclerView init(com.yanzhenjie.recyclerview.SwipeRecyclerView,androidx.recyclerview.widget.RecyclerView$LayoutManager,androidx.recyclerview.widget.RecyclerView$Adapter,boolean) -> a void init(androidx.swiperefreshlayout.widget.SwipeRefreshLayout,kotlin.jvm.functions.Function0) -> a androidx.viewpager2.widget.ViewPager2 init$default(androidx.viewpager2.widget.ViewPager2,androidx.fragment.app.Fragment,java.util.ArrayList,boolean,int,java.lang.Object) -> a @@ -11519,10 +11819,16 @@ me.hgj.jetpackmvvm.demo.app.ext.CustomViewExtKt -> me.hgj.jetpackmvvm.demo.app.e androidx.appcompat.widget.Toolbar initClose$default(androidx.appcompat.widget.Toolbar,java.lang.String,int,kotlin.jvm.functions.Function1,int,java.lang.Object) -> a void initFloatBtn(androidx.recyclerview.widget.RecyclerView,com.google.android.material.floatingactionbutton.FloatingActionButton) -> a me.hgj.jetpackmvvm.demo.app.weight.recyclerview.DefineLoadMoreView initFooter(com.yanzhenjie.recyclerview.SwipeRecyclerView,com.yanzhenjie.recyclerview.SwipeRecyclerView$LoadMoreListener) -> a + androidx.viewpager2.widget.ViewPager2 initMain(androidx.viewpager2.widget.ViewPager2,androidx.fragment.app.Fragment) -> a + void loadListData(me.hgj.jetpackmvvm.demo.app.network.stateCallback.ListDataUiState,com.chad.library.adapter.base.BaseQuickAdapter,com.kingja.loadsir.core.LoadService,com.yanzhenjie.recyclerview.SwipeRecyclerView,androidx.swiperefreshlayout.widget.SwipeRefreshLayout) -> a + com.kingja.loadsir.core.LoadService loadServiceInit(android.view.View,kotlin.jvm.functions.Function0) -> a void setAdapterAnimion(com.chad.library.adapter.base.BaseQuickAdapter,int) -> a void setErrorText(com.kingja.loadsir.core.LoadService,java.lang.String) -> a void setPageListener(com.zhpan.bannerview.BannerViewPager,kotlin.jvm.functions.Function1) -> a void setUiTheme(int,java.lang.Object[]) -> a + void showEmpty(com.kingja.loadsir.core.LoadService) -> a + void showError(com.kingja.loadsir.core.LoadService,java.lang.String) -> b + void showLoading(com.kingja.loadsir.core.LoadService) -> b me.hgj.jetpackmvvm.demo.app.ext.CustomViewExtKt$bindViewPager2$1 -> me.hgj.jetpackmvvm.demo.app.ext.CustomViewExtKt$bindViewPager2$1: me.hgj.jetpackmvvm.demo.app.ext.CustomViewExtKt$bindViewPager2$1 INSTANCE -> a void invoke(int) -> a @@ -11544,19 +11850,21 @@ me.hgj.jetpackmvvm.demo.app.ext.CustomViewExtKt$init$$inlined$run$lambda$1 -> me kotlin.jvm.functions.Function0 $onRefreshListener$inlined -> a me.hgj.jetpackmvvm.demo.app.ext.CustomViewExtKt$init$2 -> me.hgj.jetpackmvvm.demo.app.ext.CustomViewExtKt$init$2: java.util.ArrayList $fragments -> a -me.hgj.jetpackmvvm.demo.app.ext.CustomViewExtKt$initClose$1 -> me.hgj.jetpackmvvm.demo.app.ext.CustomViewExtKt$c: +me.hgj.jetpackmvvm.demo.app.ext.CustomViewExtKt$init$3 -> me.hgj.jetpackmvvm.demo.app.ext.CustomViewExtKt$c: + kotlin.jvm.functions.Function1 $navigationItemSelectedAction -> a +me.hgj.jetpackmvvm.demo.app.ext.CustomViewExtKt$initClose$1 -> me.hgj.jetpackmvvm.demo.app.ext.CustomViewExtKt$d: androidx.appcompat.widget.Toolbar $this_initClose -> a kotlin.jvm.functions.Function1 $onBack -> b me.hgj.jetpackmvvm.demo.app.ext.CustomViewExtKt$initFloatBtn$1 -> me.hgj.jetpackmvvm.demo.app.ext.CustomViewExtKt$initFloatBtn$1: com.google.android.material.floatingactionbutton.FloatingActionButton $floatbtn -> b androidx.recyclerview.widget.RecyclerView $this_initFloatBtn -> a -me.hgj.jetpackmvvm.demo.app.ext.CustomViewExtKt$initFloatBtn$2 -> me.hgj.jetpackmvvm.demo.app.ext.CustomViewExtKt$d: +me.hgj.jetpackmvvm.demo.app.ext.CustomViewExtKt$initFloatBtn$2 -> me.hgj.jetpackmvvm.demo.app.ext.CustomViewExtKt$e: androidx.recyclerview.widget.RecyclerView $this_initFloatBtn -> a -me.hgj.jetpackmvvm.demo.app.ext.CustomViewExtKt$initFooter$1 -> me.hgj.jetpackmvvm.demo.app.ext.CustomViewExtKt$e: +me.hgj.jetpackmvvm.demo.app.ext.CustomViewExtKt$initFooter$1 -> me.hgj.jetpackmvvm.demo.app.ext.CustomViewExtKt$f: me.hgj.jetpackmvvm.demo.app.weight.recyclerview.DefineLoadMoreView $footerView -> a com.yanzhenjie.recyclerview.SwipeRecyclerView$LoadMoreListener $loadmoreListener -> b void onLoadMore() -> a -me.hgj.jetpackmvvm.demo.app.ext.CustomViewExtKt$setErrorText$1 -> me.hgj.jetpackmvvm.demo.app.ext.CustomViewExtKt$f: +me.hgj.jetpackmvvm.demo.app.ext.CustomViewExtKt$setErrorText$1 -> me.hgj.jetpackmvvm.demo.app.ext.CustomViewExtKt$g: java.lang.String $message -> a me.hgj.jetpackmvvm.demo.app.ext.CustomViewExtKt$setPageListener$1 -> me.hgj.jetpackmvvm.demo.app.ext.CustomViewExtKt$setPageListener$1: kotlin.jvm.functions.Function1 $onPageSelected -> a @@ -11598,6 +11906,8 @@ me.hgj.jetpackmvvm.demo.app.network.ApiService -> me.hgj.jetpackmvvm.demo.app.ne java.lang.Object uncollect(int,kotlin.coroutines.Continuation) -> n me.hgj.jetpackmvvm.demo.app.network.ApiService$Companion -> me.hgj.jetpackmvvm.demo.app.network.a$a: me.hgj.jetpackmvvm.demo.app.network.ApiService$Companion $$INSTANCE -> a +me.hgj.jetpackmvvm.demo.app.network.MyHeadInterceptor -> me.hgj.jetpackmvvm.demo.app.network.b: + okhttp3.Response intercept(okhttp3.Interceptor$Chain) -> a me.hgj.jetpackmvvm.demo.app.network.NetworkApi -> me.hgj.jetpackmvvm.demo.app.network.NetworkApi: kotlin.Lazy instance$delegate -> b kotlin.Lazy service$delegate -> c @@ -11617,7 +11927,7 @@ me.hgj.jetpackmvvm.demo.app.network.NetworkApi$Companion$service$2 -> me.hgj.jet me.hgj.jetpackmvvm.demo.app.network.NetworkApi$Companion$service$2 INSTANCE -> a me.hgj.jetpackmvvm.demo.app.network.NetworkApi$cookieJar$2 -> me.hgj.jetpackmvvm.demo.app.network.NetworkApi$cookieJar$2: me.hgj.jetpackmvvm.demo.app.network.NetworkApi$cookieJar$2 INSTANCE -> a -me.hgj.jetpackmvvm.demo.app.network.stateCallback.CollectUiState -> me.hgj.jetpackmvvm.demo.app.network.b.a: +me.hgj.jetpackmvvm.demo.app.network.stateCallback.CollectUiState -> me.hgj.jetpackmvvm.demo.app.network.c.a: boolean isSuccess -> a boolean collect -> b int id -> c @@ -11626,7 +11936,7 @@ me.hgj.jetpackmvvm.demo.app.network.stateCallback.CollectUiState -> me.hgj.jetpa java.lang.String getErrorMsg() -> b int getId() -> c boolean isSuccess() -> d -me.hgj.jetpackmvvm.demo.app.network.stateCallback.ListDataUiState -> me.hgj.jetpackmvvm.demo.app.network.b.b: +me.hgj.jetpackmvvm.demo.app.network.stateCallback.ListDataUiState -> me.hgj.jetpackmvvm.demo.app.network.c.b: boolean hasMore -> e java.util.ArrayList listData -> g boolean isFirstEmpty -> f @@ -11641,7 +11951,7 @@ me.hgj.jetpackmvvm.demo.app.network.stateCallback.ListDataUiState -> me.hgj.jetp boolean isFirstEmpty() -> e boolean isRefresh() -> f boolean isSuccess() -> g -me.hgj.jetpackmvvm.demo.app.network.stateCallback.UpdateUiState -> me.hgj.jetpackmvvm.demo.app.network.b.c: +me.hgj.jetpackmvvm.demo.app.network.stateCallback.UpdateUiState -> me.hgj.jetpackmvvm.demo.app.network.c.c: java.lang.Object data -> b boolean isSuccess -> a java.lang.String errorMsg -> c @@ -11685,6 +11995,7 @@ me.hgj.jetpackmvvm.demo.app.util.DatetimeUtil -> me.hgj.jetpackmvvm.demo.app.a.e java.lang.String DATE_PATTERN_SS -> b java.lang.String formatDate(long,java.lang.String) -> a java.lang.String formatDate(java.util.Date,java.lang.String) -> a + java.util.Date formatDate(java.lang.String,java.lang.String) -> a java.util.Date formatDate(java.lang.String,java.util.Date) -> a java.lang.String getDATE_PATTERN() -> a java.lang.String getDATE_PATTERN_SS() -> b @@ -11799,11 +12110,6 @@ me.hgj.jetpackmvvm.demo.databinding.ActivityMainBindingImpl -> me.hgj.jetpackmvv androidx.constraintlayout.widget.ConstraintLayout mboundView0 -> a androidx.databinding.ViewDataBinding$IncludedLayouts sIncludes -> c long mDirtyFlags -> b -me.hgj.jetpackmvvm.demo.databinding.ActivityTestBindingImpl -> me.hgj.jetpackmvvm.demo.databinding.ActivityTestBindingImpl: - android.util.SparseIntArray sViewsWithIds -> d - android.widget.LinearLayout mboundView0 -> a - androidx.databinding.ViewDataBinding$IncludedLayouts sIncludes -> c - long mDirtyFlags -> b me.hgj.jetpackmvvm.demo.databinding.ActivityWelcomeBinding -> me.hgj.jetpackmvvm.demo.databinding.ActivityWelcomeBinding: androidx.constraintlayout.widget.ConstraintLayout welcomeBaseview -> a android.widget.TextView welcomeJoin -> b @@ -12088,7 +12394,7 @@ me.hgj.jetpackmvvm.demo.generated.callback.OnClickListener -> me.hgj.jetpackmvvm me.hgj.jetpackmvvm.demo.generated.callback.OnClickListener$Listener -> me.hgj.jetpackmvvm.demo.a.a.a$a: void _internalCallbackOnClick(int,android.view.View) -> a me.hgj.jetpackmvvm.demo.ui.activity.ErrorActivity -> me.hgj.jetpackmvvm.demo.ui.activity.ErrorActivity: - java.util.HashMap _$_findViewCache -> e + java.util.HashMap _$_findViewCache -> f android.view.View _$_findCachedViewById(int) -> a void initView(android.os.Bundle) -> a int layoutId() -> d @@ -12105,9 +12411,9 @@ me.hgj.jetpackmvvm.demo.ui.activity.MainActivity$createObserver$1 -> me.hgj.jetp me.hgj.jetpackmvvm.demo.ui.activity.MainActivity this$0 -> a void onChanged(java.lang.Integer) -> a me.hgj.jetpackmvvm.demo.ui.activity.WelcomeActivity -> me.hgj.jetpackmvvm.demo.ui.activity.WelcomeActivity: - com.zhpan.bannerview.BannerViewPager mViewPager -> f - java.util.HashMap _$_findViewCache -> g - java.lang.String[] resList -> e + java.util.HashMap _$_findViewCache -> h + com.zhpan.bannerview.BannerViewPager mViewPager -> g + java.lang.String[] resList -> f android.view.View _$_findCachedViewById(int) -> a java.lang.String[] access$getResList$p(me.hgj.jetpackmvvm.demo.ui.activity.WelcomeActivity) -> a void initView(android.os.Bundle) -> a @@ -12241,51 +12547,29 @@ me.hgj.jetpackmvvm.demo.ui.adapter.TodoAdapter -> me.hgj.jetpackmvvm.demo.ui.ada void convert(com.chad.library.adapter.base.viewholder.BaseViewHolder,java.lang.Object) -> a void convert(com.chad.library.adapter.base.viewholder.BaseViewHolder,me.hgj.jetpackmvvm.demo.data.model.bean.TodoResponse) -> a me.hgj.jetpackmvvm.demo.ui.fragment.MainFragment -> me.hgj.jetpackmvvm.demo.ui.fragment.MainFragment: - java.util.ArrayList fragments -> i - kotlin.Lazy homeFragment$delegate -> j - kotlin.Lazy projectFragment$delegate -> k - kotlin.Lazy treeArrFragment$delegate -> l - kotlin.Lazy publicNumberFragment$delegate -> m - java.util.HashMap _$_findViewCache -> o - kotlin.Lazy meFragment$delegate -> n + java.util.HashMap _$_findViewCache -> j android.view.View _$_findCachedViewById(int) -> a void initView(android.os.Bundle) -> a void _$_clearFindViewByIdCache() -> d void createObserver() -> e - int layoutId() -> j - void lazyLoadData() -> k - me.hgj.jetpackmvvm.demo.ui.fragment.home.HomeFragment getHomeFragment() -> n - me.hgj.jetpackmvvm.demo.ui.fragment.me.MeFragment getMeFragment() -> o - me.hgj.jetpackmvvm.demo.ui.fragment.project.ProjectFragment getProjectFragment() -> p - me.hgj.jetpackmvvm.demo.ui.fragment.publicNumber.PublicNumberFragment getPublicNumberFragment() -> q - me.hgj.jetpackmvvm.demo.ui.fragment.tree.TreeArrFragment getTreeArrFragment() -> r + int layoutId() -> i me.hgj.jetpackmvvm.demo.ui.fragment.MainFragment$createObserver$1 -> me.hgj.jetpackmvvm.demo.ui.fragment.MainFragment$a: me.hgj.jetpackmvvm.demo.ui.fragment.MainFragment this$0 -> a void onChanged(java.lang.Integer) -> a -me.hgj.jetpackmvvm.demo.ui.fragment.MainFragment$homeFragment$2 -> me.hgj.jetpackmvvm.demo.ui.fragment.MainFragment$homeFragment$2: - me.hgj.jetpackmvvm.demo.ui.fragment.MainFragment$homeFragment$2 INSTANCE -> a -me.hgj.jetpackmvvm.demo.ui.fragment.MainFragment$initView$$inlined$run$lambda$1 -> me.hgj.jetpackmvvm.demo.ui.fragment.MainFragment$b: - me.hgj.jetpackmvvm.demo.ui.fragment.MainFragment this$0 -> a -me.hgj.jetpackmvvm.demo.ui.fragment.MainFragment$meFragment$2 -> me.hgj.jetpackmvvm.demo.ui.fragment.MainFragment$meFragment$2: - me.hgj.jetpackmvvm.demo.ui.fragment.MainFragment$meFragment$2 INSTANCE -> a -me.hgj.jetpackmvvm.demo.ui.fragment.MainFragment$projectFragment$2 -> me.hgj.jetpackmvvm.demo.ui.fragment.MainFragment$projectFragment$2: - me.hgj.jetpackmvvm.demo.ui.fragment.MainFragment$projectFragment$2 INSTANCE -> a -me.hgj.jetpackmvvm.demo.ui.fragment.MainFragment$publicNumberFragment$2 -> me.hgj.jetpackmvvm.demo.ui.fragment.MainFragment$publicNumberFragment$2: - me.hgj.jetpackmvvm.demo.ui.fragment.MainFragment$publicNumberFragment$2 INSTANCE -> a -me.hgj.jetpackmvvm.demo.ui.fragment.MainFragment$treeArrFragment$2 -> me.hgj.jetpackmvvm.demo.ui.fragment.MainFragment$treeArrFragment$2: - me.hgj.jetpackmvvm.demo.ui.fragment.MainFragment$treeArrFragment$2 INSTANCE -> a +me.hgj.jetpackmvvm.demo.ui.fragment.MainFragment$initView$1 -> me.hgj.jetpackmvvm.demo.ui.fragment.MainFragment$initView$1: + void invoke(int) -> a me.hgj.jetpackmvvm.demo.ui.fragment.collect.CollectAriticleFragment -> me.hgj.jetpackmvvm.demo.ui.fragment.collect.CollectAriticleFragment: - com.kingja.loadsir.core.LoadService loadsir -> i - java.util.HashMap _$_findViewCache -> k - kotlin.Lazy articleAdapter$delegate -> j + com.kingja.loadsir.core.LoadService loadsir -> j + java.util.HashMap _$_findViewCache -> l + kotlin.Lazy articleAdapter$delegate -> k android.view.View _$_findCachedViewById(int) -> a me.hgj.jetpackmvvm.demo.ui.adapter.CollectAdapter access$getArticleAdapter$p(me.hgj.jetpackmvvm.demo.ui.fragment.collect.CollectAriticleFragment) -> a void initView(android.os.Bundle) -> a com.kingja.loadsir.core.LoadService access$getLoadsir$p(me.hgj.jetpackmvvm.demo.ui.fragment.collect.CollectAriticleFragment) -> b void _$_clearFindViewByIdCache() -> d void createObserver() -> e - int layoutId() -> j - void lazyLoadData() -> k + int layoutId() -> i + void lazyLoadData() -> j me.hgj.jetpackmvvm.demo.ui.adapter.CollectAdapter getArticleAdapter() -> n me.hgj.jetpackmvvm.demo.ui.fragment.collect.CollectAriticleFragment$articleAdapter$2 -> me.hgj.jetpackmvvm.demo.ui.fragment.collect.CollectAriticleFragment$articleAdapter$2: me.hgj.jetpackmvvm.demo.ui.fragment.collect.CollectAriticleFragment$articleAdapter$2 INSTANCE -> a @@ -12308,29 +12592,27 @@ me.hgj.jetpackmvvm.demo.ui.fragment.collect.CollectAriticleFragment$initView$$in java.lang.Object invoke(java.lang.Object,java.lang.Object,java.lang.Object) -> a void invoke(com.chad.library.adapter.base.BaseQuickAdapter,android.view.View,int) -> a me.hgj.jetpackmvvm.demo.ui.fragment.collect.CollectFragment -> me.hgj.jetpackmvvm.demo.ui.fragment.collect.CollectFragment: - java.util.ArrayList fragments -> j - java.util.ArrayList titleData -> i - java.util.HashMap _$_findViewCache -> k + java.util.ArrayList fragments -> k + java.util.ArrayList titleData -> j + java.util.HashMap _$_findViewCache -> l android.view.View _$_findCachedViewById(int) -> a void initView(android.os.Bundle) -> a void _$_clearFindViewByIdCache() -> d - void createObserver() -> e - int layoutId() -> j - void lazyLoadData() -> k + int layoutId() -> i me.hgj.jetpackmvvm.demo.ui.fragment.collect.CollectFragment$initView$2 -> me.hgj.jetpackmvvm.demo.ui.fragment.collect.CollectFragment$initView$2: void invoke(androidx.appcompat.widget.Toolbar) -> a me.hgj.jetpackmvvm.demo.ui.fragment.collect.CollectUrlFragment -> me.hgj.jetpackmvvm.demo.ui.fragment.collect.CollectUrlFragment: - com.kingja.loadsir.core.LoadService loadsir -> i - java.util.HashMap _$_findViewCache -> k - kotlin.Lazy articleAdapter$delegate -> j + com.kingja.loadsir.core.LoadService loadsir -> j + java.util.HashMap _$_findViewCache -> l + kotlin.Lazy articleAdapter$delegate -> k android.view.View _$_findCachedViewById(int) -> a me.hgj.jetpackmvvm.demo.ui.adapter.CollectUrlAdapter access$getArticleAdapter$p(me.hgj.jetpackmvvm.demo.ui.fragment.collect.CollectUrlFragment) -> a void initView(android.os.Bundle) -> a com.kingja.loadsir.core.LoadService access$getLoadsir$p(me.hgj.jetpackmvvm.demo.ui.fragment.collect.CollectUrlFragment) -> b void _$_clearFindViewByIdCache() -> d void createObserver() -> e - int layoutId() -> j - void lazyLoadData() -> k + int layoutId() -> i + void lazyLoadData() -> j me.hgj.jetpackmvvm.demo.ui.adapter.CollectUrlAdapter getArticleAdapter() -> n me.hgj.jetpackmvvm.demo.ui.fragment.collect.CollectUrlFragment$articleAdapter$2 -> me.hgj.jetpackmvvm.demo.ui.fragment.collect.CollectUrlFragment$articleAdapter$2: me.hgj.jetpackmvvm.demo.ui.fragment.collect.CollectUrlFragment$articleAdapter$2 INSTANCE -> a @@ -12350,24 +12632,22 @@ me.hgj.jetpackmvvm.demo.ui.fragment.collect.CollectUrlFragment$initView$$inlined java.lang.Object invoke(java.lang.Object,java.lang.Object,java.lang.Object) -> a void invoke(com.chad.library.adapter.base.BaseQuickAdapter,android.view.View,int) -> a me.hgj.jetpackmvvm.demo.ui.fragment.demo.DemoFragment -> me.hgj.jetpackmvvm.demo.ui.fragment.demo.DemoFragment: - java.util.HashMap _$_findViewCache -> j - kotlin.Lazy requestViewModel$delegate -> i + java.util.HashMap _$_findViewCache -> k + kotlin.Lazy requestViewModel$delegate -> j void initView(android.os.Bundle) -> a void _$_clearFindViewByIdCache() -> d - void createObserver() -> e - int layoutId() -> j - void lazyLoadData() -> k + int layoutId() -> i me.hgj.jetpackmvvm.demo.viewmodel.request.RequestDemoViewModel getRequestViewModel() -> n me.hgj.jetpackmvvm.demo.ui.fragment.demo.DemoFragment$ProxClick -> me.hgj.jetpackmvvm.demo.ui.fragment.demo.DemoFragment$a: me.hgj.jetpackmvvm.demo.ui.fragment.demo.DemoFragment this$0 -> a void download() -> a me.hgj.jetpackmvvm.demo.ui.fragment.home.HomeFragment -> me.hgj.jetpackmvvm.demo.ui.fragment.home.HomeFragment: - me.hgj.jetpackmvvm.demo.app.weight.recyclerview.DefineLoadMoreView footView -> k - com.kingja.loadsir.core.LoadService loadsir -> j - java.util.HashMap _$_findViewCache -> n - kotlin.Lazy articleAdapter$delegate -> i - kotlin.Lazy requestCollectViewModel$delegate -> l - kotlin.Lazy requestHomeViewModel$delegate -> m + me.hgj.jetpackmvvm.demo.app.weight.recyclerview.DefineLoadMoreView footView -> l + com.kingja.loadsir.core.LoadService loadsir -> k + kotlin.Lazy articleAdapter$delegate -> j + kotlin.Lazy requestCollectViewModel$delegate -> m + java.util.HashMap _$_findViewCache -> o + kotlin.Lazy requestHomeViewModel$delegate -> n android.view.View _$_findCachedViewById(int) -> a me.hgj.jetpackmvvm.demo.ui.adapter.AriticleAdapter access$getArticleAdapter$p(me.hgj.jetpackmvvm.demo.ui.fragment.home.HomeFragment) -> a void initView(android.os.Bundle) -> a @@ -12377,8 +12657,8 @@ me.hgj.jetpackmvvm.demo.ui.fragment.home.HomeFragment -> me.hgj.jetpackmvvm.demo me.hgj.jetpackmvvm.demo.viewmodel.request.RequestCollectViewModel access$getRequestCollectViewModel$p(me.hgj.jetpackmvvm.demo.ui.fragment.home.HomeFragment) -> d me.hgj.jetpackmvvm.demo.viewmodel.request.RequestHomeViewModel access$getRequestHomeViewModel$p(me.hgj.jetpackmvvm.demo.ui.fragment.home.HomeFragment) -> e void createObserver() -> e - int layoutId() -> j - void lazyLoadData() -> k + int layoutId() -> i + void lazyLoadData() -> j me.hgj.jetpackmvvm.demo.ui.adapter.AriticleAdapter getArticleAdapter() -> n me.hgj.jetpackmvvm.demo.viewmodel.request.RequestCollectViewModel getRequestCollectViewModel() -> o me.hgj.jetpackmvvm.demo.viewmodel.request.RequestHomeViewModel getRequestHomeViewModel() -> p @@ -12433,11 +12713,11 @@ me.hgj.jetpackmvvm.demo.ui.fragment.home.HomeFragment$initView$$inlined$run$lamb java.lang.Object invoke(java.lang.Object,java.lang.Object,java.lang.Object) -> a void invoke(com.chad.library.adapter.base.BaseQuickAdapter,android.view.View,int) -> a me.hgj.jetpackmvvm.demo.ui.fragment.integral.IntegralFragment -> me.hgj.jetpackmvvm.demo.ui.fragment.integral.IntegralFragment: - me.hgj.jetpackmvvm.demo.data.model.bean.IntegralResponse rank -> i - com.kingja.loadsir.core.LoadService loadsir -> k - java.util.HashMap _$_findViewCache -> m - me.hgj.jetpackmvvm.demo.ui.adapter.IntegralAdapter integralAdapter -> j - kotlin.Lazy requestIntegralViewModel$delegate -> l + me.hgj.jetpackmvvm.demo.data.model.bean.IntegralResponse rank -> j + java.util.HashMap _$_findViewCache -> n + me.hgj.jetpackmvvm.demo.ui.adapter.IntegralAdapter integralAdapter -> k + kotlin.Lazy requestIntegralViewModel$delegate -> m + com.kingja.loadsir.core.LoadService loadsir -> l android.view.View _$_findCachedViewById(int) -> a me.hgj.jetpackmvvm.demo.ui.adapter.IntegralAdapter access$getIntegralAdapter$p(me.hgj.jetpackmvvm.demo.ui.fragment.integral.IntegralFragment) -> a void initView(android.os.Bundle) -> a @@ -12446,8 +12726,8 @@ me.hgj.jetpackmvvm.demo.ui.fragment.integral.IntegralFragment -> me.hgj.jetpackm void _$_clearFindViewByIdCache() -> d me.hgj.jetpackmvvm.demo.viewmodel.request.RequestIntegralViewModel access$getRequestIntegralViewModel$p(me.hgj.jetpackmvvm.demo.ui.fragment.integral.IntegralFragment) -> d void createObserver() -> e - int layoutId() -> j - void lazyLoadData() -> k + int layoutId() -> i + void lazyLoadData() -> j me.hgj.jetpackmvvm.demo.viewmodel.request.RequestIntegralViewModel getRequestIntegralViewModel() -> n me.hgj.jetpackmvvm.demo.ui.fragment.integral.IntegralFragment$createObserver$1 -> me.hgj.jetpackmvvm.demo.ui.fragment.integral.IntegralFragment$a: me.hgj.jetpackmvvm.demo.ui.fragment.integral.IntegralFragment this$0 -> a @@ -12460,10 +12740,10 @@ me.hgj.jetpackmvvm.demo.ui.fragment.integral.IntegralFragment$initView$$inlined$ me.hgj.jetpackmvvm.demo.ui.fragment.integral.IntegralFragment$initView$$inlined$run$lambda$2 -> me.hgj.jetpackmvvm.demo.ui.fragment.integral.IntegralFragment$initView$$inlined$run$lambda$2: void invoke(androidx.appcompat.widget.Toolbar) -> a me.hgj.jetpackmvvm.demo.ui.fragment.integral.IntegralHistoryFragment -> me.hgj.jetpackmvvm.demo.ui.fragment.integral.IntegralHistoryFragment: - com.kingja.loadsir.core.LoadService loadsir -> j - java.util.HashMap _$_findViewCache -> l - kotlin.Lazy integralAdapter$delegate -> i - kotlin.Lazy requestIntegralViewModel$delegate -> k + com.kingja.loadsir.core.LoadService loadsir -> k + java.util.HashMap _$_findViewCache -> m + kotlin.Lazy integralAdapter$delegate -> j + kotlin.Lazy requestIntegralViewModel$delegate -> l android.view.View _$_findCachedViewById(int) -> a me.hgj.jetpackmvvm.demo.ui.adapter.IntegralHistoryAdapter access$getIntegralAdapter$p(me.hgj.jetpackmvvm.demo.ui.fragment.integral.IntegralHistoryFragment) -> a void initView(android.os.Bundle) -> a @@ -12471,8 +12751,8 @@ me.hgj.jetpackmvvm.demo.ui.fragment.integral.IntegralHistoryFragment -> me.hgj.j me.hgj.jetpackmvvm.demo.viewmodel.request.RequestIntegralViewModel access$getRequestIntegralViewModel$p(me.hgj.jetpackmvvm.demo.ui.fragment.integral.IntegralHistoryFragment) -> c void _$_clearFindViewByIdCache() -> d void createObserver() -> e - int layoutId() -> j - void lazyLoadData() -> k + int layoutId() -> i + void lazyLoadData() -> j me.hgj.jetpackmvvm.demo.ui.adapter.IntegralHistoryAdapter getIntegralAdapter() -> n me.hgj.jetpackmvvm.demo.viewmodel.request.RequestIntegralViewModel getRequestIntegralViewModel() -> o me.hgj.jetpackmvvm.demo.ui.fragment.integral.IntegralHistoryFragment$createObserver$1 -> me.hgj.jetpackmvvm.demo.ui.fragment.integral.IntegralHistoryFragment$a: @@ -12486,15 +12766,14 @@ me.hgj.jetpackmvvm.demo.ui.fragment.integral.IntegralHistoryFragment$initView$1 me.hgj.jetpackmvvm.demo.ui.fragment.integral.IntegralHistoryFragment$integralAdapter$2 -> me.hgj.jetpackmvvm.demo.ui.fragment.integral.IntegralHistoryFragment$integralAdapter$2: me.hgj.jetpackmvvm.demo.ui.fragment.integral.IntegralHistoryFragment$integralAdapter$2 INSTANCE -> a me.hgj.jetpackmvvm.demo.ui.fragment.login.LoginFragment -> me.hgj.jetpackmvvm.demo.ui.fragment.login.LoginFragment: - java.util.HashMap _$_findViewCache -> j - kotlin.Lazy requestLoginRegisterViewModel$delegate -> i + java.util.HashMap _$_findViewCache -> k + kotlin.Lazy requestLoginRegisterViewModel$delegate -> j android.view.View _$_findCachedViewById(int) -> a me.hgj.jetpackmvvm.demo.viewmodel.request.RequestLoginRegisterViewModel access$getRequestLoginRegisterViewModel$p(me.hgj.jetpackmvvm.demo.ui.fragment.login.LoginFragment) -> a void initView(android.os.Bundle) -> a void _$_clearFindViewByIdCache() -> d void createObserver() -> e - int layoutId() -> j - void lazyLoadData() -> k + int layoutId() -> i me.hgj.jetpackmvvm.demo.viewmodel.request.RequestLoginRegisterViewModel getRequestLoginRegisterViewModel() -> n me.hgj.jetpackmvvm.demo.ui.fragment.login.LoginFragment$ProxyClick -> me.hgj.jetpackmvvm.demo.ui.fragment.login.LoginFragment$a: android.widget.CompoundButton$OnCheckedChangeListener onCheckedChangeListener -> a @@ -12515,15 +12794,14 @@ me.hgj.jetpackmvvm.demo.ui.fragment.login.LoginFragment$createObserver$1$2 -> me me.hgj.jetpackmvvm.demo.ui.fragment.login.LoginFragment$initView$1 -> me.hgj.jetpackmvvm.demo.ui.fragment.login.LoginFragment$initView$1: void invoke(androidx.appcompat.widget.Toolbar) -> a me.hgj.jetpackmvvm.demo.ui.fragment.login.RegisterFrgment -> me.hgj.jetpackmvvm.demo.ui.fragment.login.RegisterFrgment: - java.util.HashMap _$_findViewCache -> j - kotlin.Lazy requestLoginRegisterViewModel$delegate -> i + java.util.HashMap _$_findViewCache -> k + kotlin.Lazy requestLoginRegisterViewModel$delegate -> j android.view.View _$_findCachedViewById(int) -> a me.hgj.jetpackmvvm.demo.viewmodel.request.RequestLoginRegisterViewModel access$getRequestLoginRegisterViewModel$p(me.hgj.jetpackmvvm.demo.ui.fragment.login.RegisterFrgment) -> a void initView(android.os.Bundle) -> a void _$_clearFindViewByIdCache() -> d void createObserver() -> e - int layoutId() -> j - void lazyLoadData() -> k + int layoutId() -> i me.hgj.jetpackmvvm.demo.viewmodel.request.RequestLoginRegisterViewModel getRequestLoginRegisterViewModel() -> n me.hgj.jetpackmvvm.demo.ui.fragment.login.RegisterFrgment$ProxyClick -> me.hgj.jetpackmvvm.demo.ui.fragment.login.RegisterFrgment$a: android.widget.CompoundButton$OnCheckedChangeListener onCheckedChangeListener2 -> b @@ -12547,12 +12825,12 @@ me.hgj.jetpackmvvm.demo.ui.fragment.login.RegisterFrgment$createObserver$1$2 -> me.hgj.jetpackmvvm.demo.ui.fragment.login.RegisterFrgment$initView$1 -> me.hgj.jetpackmvvm.demo.ui.fragment.login.RegisterFrgment$initView$1: void invoke(androidx.appcompat.widget.Toolbar) -> a me.hgj.jetpackmvvm.demo.ui.fragment.lookinfo.LookInfoFragment -> me.hgj.jetpackmvvm.demo.ui.fragment.lookinfo.LookInfoFragment: - com.kingja.loadsir.core.LoadService loadsir -> j - java.util.HashMap _$_findViewCache -> n - int shareId -> i - kotlin.Lazy articleAdapter$delegate -> k - kotlin.Lazy requestCollectViewModel$delegate -> l - kotlin.Lazy requestLookInfoViewModel$delegate -> m + com.kingja.loadsir.core.LoadService loadsir -> k + int shareId -> j + kotlin.Lazy articleAdapter$delegate -> l + kotlin.Lazy requestCollectViewModel$delegate -> m + java.util.HashMap _$_findViewCache -> o + kotlin.Lazy requestLookInfoViewModel$delegate -> n android.view.View _$_findCachedViewById(int) -> a me.hgj.jetpackmvvm.demo.ui.adapter.AriticleAdapter access$getArticleAdapter$p(me.hgj.jetpackmvvm.demo.ui.fragment.lookinfo.LookInfoFragment) -> a void initView(android.os.Bundle) -> a @@ -12562,8 +12840,8 @@ me.hgj.jetpackmvvm.demo.ui.fragment.lookinfo.LookInfoFragment -> me.hgj.jetpackm me.hgj.jetpackmvvm.demo.viewmodel.request.RequestLookInfoViewModel access$getRequestLookInfoViewModel$p(me.hgj.jetpackmvvm.demo.ui.fragment.lookinfo.LookInfoFragment) -> d int access$getShareId$p(me.hgj.jetpackmvvm.demo.ui.fragment.lookinfo.LookInfoFragment) -> e void createObserver() -> e - int layoutId() -> j - void lazyLoadData() -> k + int layoutId() -> i + void lazyLoadData() -> j me.hgj.jetpackmvvm.demo.ui.adapter.AriticleAdapter getArticleAdapter() -> n me.hgj.jetpackmvvm.demo.viewmodel.request.RequestCollectViewModel getRequestCollectViewModel() -> o me.hgj.jetpackmvvm.demo.viewmodel.request.RequestLookInfoViewModel getRequestLookInfoViewModel() -> p @@ -12596,9 +12874,9 @@ me.hgj.jetpackmvvm.demo.ui.fragment.lookinfo.LookInfoFragment$initView$$inlined$ me.hgj.jetpackmvvm.demo.ui.fragment.lookinfo.LookInfoFragment$initView$3 -> me.hgj.jetpackmvvm.demo.ui.fragment.lookinfo.LookInfoFragment$initView$3: void invoke(androidx.appcompat.widget.Toolbar) -> a me.hgj.jetpackmvvm.demo.ui.fragment.me.MeFragment -> me.hgj.jetpackmvvm.demo.ui.fragment.me.MeFragment: - me.hgj.jetpackmvvm.demo.data.model.bean.IntegralResponse rank -> i - java.util.HashMap _$_findViewCache -> k - kotlin.Lazy requestMeViewModel$delegate -> j + me.hgj.jetpackmvvm.demo.data.model.bean.IntegralResponse rank -> j + java.util.HashMap _$_findViewCache -> l + kotlin.Lazy requestMeViewModel$delegate -> k android.view.View _$_findCachedViewById(int) -> a me.hgj.jetpackmvvm.demo.data.model.bean.IntegralResponse access$getRank$p(me.hgj.jetpackmvvm.demo.ui.fragment.me.MeFragment) -> a void access$setRank$p(me.hgj.jetpackmvvm.demo.ui.fragment.me.MeFragment,me.hgj.jetpackmvvm.demo.data.model.bean.IntegralResponse) -> a @@ -12606,8 +12884,8 @@ me.hgj.jetpackmvvm.demo.ui.fragment.me.MeFragment -> me.hgj.jetpackmvvm.demo.ui. me.hgj.jetpackmvvm.demo.viewmodel.request.RequestMeViewModel access$getRequestMeViewModel$p(me.hgj.jetpackmvvm.demo.ui.fragment.me.MeFragment) -> b void _$_clearFindViewByIdCache() -> d void createObserver() -> e - int layoutId() -> j - void lazyLoadData() -> k + int layoutId() -> i + void lazyLoadData() -> j me.hgj.jetpackmvvm.demo.viewmodel.request.RequestMeViewModel getRequestMeViewModel() -> n me.hgj.jetpackmvvm.demo.ui.fragment.me.MeFragment$ProxyClick -> me.hgj.jetpackmvvm.demo.ui.fragment.me.MeFragment$ProxyClick: me.hgj.jetpackmvvm.demo.ui.fragment.me.MeFragment this$0 -> a @@ -12649,15 +12927,15 @@ me.hgj.jetpackmvvm.demo.ui.fragment.me.MeFragment$createObserver$1$2 -> me.hgj.j me.hgj.jetpackmvvm.demo.ui.fragment.me.MeFragment$createObserver$1$2 INSTANCE -> a void invoke(me.hgj.jetpackmvvm.network.AppException) -> a me.hgj.jetpackmvvm.demo.ui.fragment.project.ProjectChildFragment -> me.hgj.jetpackmvvm.demo.ui.fragment.project.ProjectChildFragment: - me.hgj.jetpackmvvm.demo.app.weight.recyclerview.DefineLoadMoreView footView -> k - com.kingja.loadsir.core.LoadService loadsir -> j - int cid -> m - kotlin.Lazy articleAdapter$delegate -> i - boolean isNew -> l - me.hgj.jetpackmvvm.demo.ui.fragment.project.ProjectChildFragment$Companion Companion -> q - java.util.HashMap _$_findViewCache -> p - kotlin.Lazy requestCollectViewModel$delegate -> n - kotlin.Lazy requestProjectViewModel$delegate -> o + me.hgj.jetpackmvvm.demo.app.weight.recyclerview.DefineLoadMoreView footView -> l + boolean isNew -> m + int cid -> n + com.kingja.loadsir.core.LoadService loadsir -> k + kotlin.Lazy articleAdapter$delegate -> j + me.hgj.jetpackmvvm.demo.ui.fragment.project.ProjectChildFragment$Companion Companion -> r + java.util.HashMap _$_findViewCache -> q + kotlin.Lazy requestCollectViewModel$delegate -> o + kotlin.Lazy requestProjectViewModel$delegate -> p android.view.View _$_findCachedViewById(int) -> a me.hgj.jetpackmvvm.demo.ui.adapter.AriticleAdapter access$getArticleAdapter$p(me.hgj.jetpackmvvm.demo.ui.fragment.project.ProjectChildFragment) -> a void initView(android.os.Bundle) -> a @@ -12669,8 +12947,8 @@ me.hgj.jetpackmvvm.demo.ui.fragment.project.ProjectChildFragment -> me.hgj.jetpa void createObserver() -> e me.hgj.jetpackmvvm.demo.viewmodel.request.RequestProjectViewModel access$getRequestProjectViewModel$p(me.hgj.jetpackmvvm.demo.ui.fragment.project.ProjectChildFragment) -> f boolean access$isNew$p(me.hgj.jetpackmvvm.demo.ui.fragment.project.ProjectChildFragment) -> g - int layoutId() -> j - void lazyLoadData() -> k + int layoutId() -> i + void lazyLoadData() -> j me.hgj.jetpackmvvm.demo.ui.adapter.AriticleAdapter getArticleAdapter() -> n me.hgj.jetpackmvvm.demo.viewmodel.request.RequestCollectViewModel getRequestCollectViewModel() -> o me.hgj.jetpackmvvm.demo.viewmodel.request.RequestProjectViewModel getRequestProjectViewModel() -> p @@ -12696,32 +12974,32 @@ me.hgj.jetpackmvvm.demo.ui.fragment.project.ProjectChildFragment$createObserver$ me.hgj.jetpackmvvm.demo.ui.fragment.project.ProjectChildFragment$createObserver$2 -> me.hgj.jetpackmvvm.demo.ui.fragment.project.ProjectChildFragment$g: me.hgj.jetpackmvvm.demo.ui.fragment.project.ProjectChildFragment this$0 -> a void onChanged(me.hgj.jetpackmvvm.demo.app.network.stateCallback.CollectUiState) -> a -me.hgj.jetpackmvvm.demo.ui.fragment.project.ProjectChildFragment$lazyLoadData$$inlined$let$lambda$1 -> me.hgj.jetpackmvvm.demo.ui.fragment.project.ProjectChildFragment$h: +me.hgj.jetpackmvvm.demo.ui.fragment.project.ProjectChildFragment$initView$$inlined$let$lambda$1 -> me.hgj.jetpackmvvm.demo.ui.fragment.project.ProjectChildFragment$h: me.hgj.jetpackmvvm.demo.ui.fragment.project.ProjectChildFragment this$0 -> a void onLoadMore() -> a -me.hgj.jetpackmvvm.demo.ui.fragment.project.ProjectChildFragment$lazyLoadData$$inlined$run$lambda$1 -> me.hgj.jetpackmvvm.demo.ui.fragment.project.ProjectChildFragment$i: +me.hgj.jetpackmvvm.demo.ui.fragment.project.ProjectChildFragment$initView$$inlined$run$lambda$1 -> me.hgj.jetpackmvvm.demo.ui.fragment.project.ProjectChildFragment$i: me.hgj.jetpackmvvm.demo.ui.fragment.project.ProjectChildFragment this$0 -> a void onClick(me.hgj.jetpackmvvm.demo.data.model.bean.AriticleResponse,me.hgj.jetpackmvvm.demo.app.weight.customview.CollectView,int) -> a -me.hgj.jetpackmvvm.demo.ui.fragment.project.ProjectChildFragment$lazyLoadData$$inlined$run$lambda$2 -> me.hgj.jetpackmvvm.demo.ui.fragment.project.ProjectChildFragment$lazyLoadData$$inlined$run$lambda$2: +me.hgj.jetpackmvvm.demo.ui.fragment.project.ProjectChildFragment$initView$$inlined$run$lambda$2 -> me.hgj.jetpackmvvm.demo.ui.fragment.project.ProjectChildFragment$initView$$inlined$run$lambda$2: java.lang.Object invoke(java.lang.Object,java.lang.Object,java.lang.Object) -> a void invoke(com.chad.library.adapter.base.BaseQuickAdapter,android.view.View,int) -> a -me.hgj.jetpackmvvm.demo.ui.fragment.project.ProjectChildFragment$lazyLoadData$$inlined$run$lambda$3 -> me.hgj.jetpackmvvm.demo.ui.fragment.project.ProjectChildFragment$lazyLoadData$$inlined$run$lambda$3: +me.hgj.jetpackmvvm.demo.ui.fragment.project.ProjectChildFragment$initView$$inlined$run$lambda$3 -> me.hgj.jetpackmvvm.demo.ui.fragment.project.ProjectChildFragment$initView$$inlined$run$lambda$3: java.lang.Object invoke(java.lang.Object,java.lang.Object,java.lang.Object) -> a void invoke(com.chad.library.adapter.base.BaseQuickAdapter,android.view.View,int) -> a me.hgj.jetpackmvvm.demo.ui.fragment.project.ProjectFragment -> me.hgj.jetpackmvvm.demo.ui.fragment.project.ProjectFragment: - com.kingja.loadsir.core.LoadService loadsir -> i - java.util.ArrayList mDataList -> k - java.util.ArrayList fragments -> j - java.util.HashMap _$_findViewCache -> m - kotlin.Lazy requestProjectViewModel$delegate -> l + com.kingja.loadsir.core.LoadService loadsir -> j + java.util.ArrayList mDataList -> l + java.util.ArrayList fragments -> k + java.util.HashMap _$_findViewCache -> n + kotlin.Lazy requestProjectViewModel$delegate -> m android.view.View _$_findCachedViewById(int) -> a com.kingja.loadsir.core.LoadService access$getLoadsir$p(me.hgj.jetpackmvvm.demo.ui.fragment.project.ProjectFragment) -> a void initView(android.os.Bundle) -> a me.hgj.jetpackmvvm.demo.viewmodel.request.RequestProjectViewModel access$getRequestProjectViewModel$p(me.hgj.jetpackmvvm.demo.ui.fragment.project.ProjectFragment) -> b void _$_clearFindViewByIdCache() -> d void createObserver() -> e - int layoutId() -> j - void lazyLoadData() -> k + int layoutId() -> i + void lazyLoadData() -> j java.util.ArrayList getFragments() -> n java.util.ArrayList getMDataList() -> o me.hgj.jetpackmvvm.demo.viewmodel.request.RequestProjectViewModel getRequestProjectViewModel() -> p @@ -12736,14 +13014,14 @@ me.hgj.jetpackmvvm.demo.ui.fragment.project.ProjectFragment$createObserver$2 -> me.hgj.jetpackmvvm.demo.ui.fragment.project.ProjectFragment this$0 -> a void onChanged(java.lang.Integer) -> a me.hgj.jetpackmvvm.demo.ui.fragment.publicNumber.PublicChildFragment -> me.hgj.jetpackmvvm.demo.ui.fragment.publicNumber.PublicChildFragment: - me.hgj.jetpackmvvm.demo.app.weight.recyclerview.DefineLoadMoreView footView -> k - com.kingja.loadsir.core.LoadService loadsir -> j - int cid -> l - kotlin.Lazy articleAdapter$delegate -> i - kotlin.Lazy requestCollectViewModel$delegate -> m - java.util.HashMap _$_findViewCache -> o - kotlin.Lazy requestPublicNumberViewModel$delegate -> n - me.hgj.jetpackmvvm.demo.ui.fragment.publicNumber.PublicChildFragment$Companion Companion -> p + me.hgj.jetpackmvvm.demo.app.weight.recyclerview.DefineLoadMoreView footView -> l + com.kingja.loadsir.core.LoadService loadsir -> k + int cid -> m + kotlin.Lazy articleAdapter$delegate -> j + java.util.HashMap _$_findViewCache -> p + kotlin.Lazy requestCollectViewModel$delegate -> n + kotlin.Lazy requestPublicNumberViewModel$delegate -> o + me.hgj.jetpackmvvm.demo.ui.fragment.publicNumber.PublicChildFragment$Companion Companion -> q android.view.View _$_findCachedViewById(int) -> a me.hgj.jetpackmvvm.demo.ui.adapter.AriticleAdapter access$getArticleAdapter$p(me.hgj.jetpackmvvm.demo.ui.fragment.publicNumber.PublicChildFragment) -> a void initView(android.os.Bundle) -> a @@ -12754,8 +13032,8 @@ me.hgj.jetpackmvvm.demo.ui.fragment.publicNumber.PublicChildFragment -> me.hgj.j me.hgj.jetpackmvvm.demo.viewmodel.request.RequestCollectViewModel access$getRequestCollectViewModel$p(me.hgj.jetpackmvvm.demo.ui.fragment.publicNumber.PublicChildFragment) -> e void createObserver() -> e me.hgj.jetpackmvvm.demo.viewmodel.request.RequestPublicNumberViewModel access$getRequestPublicNumberViewModel$p(me.hgj.jetpackmvvm.demo.ui.fragment.publicNumber.PublicChildFragment) -> f - int layoutId() -> j - void lazyLoadData() -> k + int layoutId() -> i + void lazyLoadData() -> j me.hgj.jetpackmvvm.demo.ui.adapter.AriticleAdapter getArticleAdapter() -> n me.hgj.jetpackmvvm.demo.viewmodel.request.RequestCollectViewModel getRequestCollectViewModel() -> o me.hgj.jetpackmvvm.demo.viewmodel.request.RequestPublicNumberViewModel getRequestPublicNumberViewModel() -> p @@ -12781,23 +13059,23 @@ me.hgj.jetpackmvvm.demo.ui.fragment.publicNumber.PublicChildFragment$createObser me.hgj.jetpackmvvm.demo.ui.fragment.publicNumber.PublicChildFragment$createObserver$2 -> me.hgj.jetpackmvvm.demo.ui.fragment.publicNumber.PublicChildFragment$g: me.hgj.jetpackmvvm.demo.ui.fragment.publicNumber.PublicChildFragment this$0 -> a void onChanged(me.hgj.jetpackmvvm.demo.app.network.stateCallback.CollectUiState) -> a -me.hgj.jetpackmvvm.demo.ui.fragment.publicNumber.PublicChildFragment$lazyLoadData$$inlined$let$lambda$1 -> me.hgj.jetpackmvvm.demo.ui.fragment.publicNumber.PublicChildFragment$h: +me.hgj.jetpackmvvm.demo.ui.fragment.publicNumber.PublicChildFragment$initView$$inlined$let$lambda$1 -> me.hgj.jetpackmvvm.demo.ui.fragment.publicNumber.PublicChildFragment$h: me.hgj.jetpackmvvm.demo.ui.fragment.publicNumber.PublicChildFragment this$0 -> a void onLoadMore() -> a -me.hgj.jetpackmvvm.demo.ui.fragment.publicNumber.PublicChildFragment$lazyLoadData$$inlined$run$lambda$1 -> me.hgj.jetpackmvvm.demo.ui.fragment.publicNumber.PublicChildFragment$i: +me.hgj.jetpackmvvm.demo.ui.fragment.publicNumber.PublicChildFragment$initView$$inlined$run$lambda$1 -> me.hgj.jetpackmvvm.demo.ui.fragment.publicNumber.PublicChildFragment$i: me.hgj.jetpackmvvm.demo.ui.fragment.publicNumber.PublicChildFragment this$0 -> a void onClick(me.hgj.jetpackmvvm.demo.data.model.bean.AriticleResponse,me.hgj.jetpackmvvm.demo.app.weight.customview.CollectView,int) -> a -me.hgj.jetpackmvvm.demo.ui.fragment.publicNumber.PublicChildFragment$lazyLoadData$$inlined$run$lambda$2 -> me.hgj.jetpackmvvm.demo.ui.fragment.publicNumber.PublicChildFragment$lazyLoadData$$inlined$run$lambda$2: +me.hgj.jetpackmvvm.demo.ui.fragment.publicNumber.PublicChildFragment$initView$$inlined$run$lambda$2 -> me.hgj.jetpackmvvm.demo.ui.fragment.publicNumber.PublicChildFragment$initView$$inlined$run$lambda$2: java.lang.Object invoke(java.lang.Object,java.lang.Object,java.lang.Object) -> a void invoke(com.chad.library.adapter.base.BaseQuickAdapter,android.view.View,int) -> a -me.hgj.jetpackmvvm.demo.ui.fragment.publicNumber.PublicChildFragment$lazyLoadData$$inlined$run$lambda$3 -> me.hgj.jetpackmvvm.demo.ui.fragment.publicNumber.PublicChildFragment$lazyLoadData$$inlined$run$lambda$3: +me.hgj.jetpackmvvm.demo.ui.fragment.publicNumber.PublicChildFragment$initView$$inlined$run$lambda$3 -> me.hgj.jetpackmvvm.demo.ui.fragment.publicNumber.PublicChildFragment$initView$$inlined$run$lambda$3: java.lang.Object invoke(java.lang.Object,java.lang.Object,java.lang.Object) -> a void invoke(com.chad.library.adapter.base.BaseQuickAdapter,android.view.View,int) -> a me.hgj.jetpackmvvm.demo.ui.fragment.publicNumber.PublicNumberFragment -> me.hgj.jetpackmvvm.demo.ui.fragment.publicNumber.PublicNumberFragment: - com.kingja.loadsir.core.LoadService loadsir -> i - java.util.ArrayList mDataList -> k - java.util.ArrayList fragments -> j - java.util.HashMap _$_findViewCache -> l + com.kingja.loadsir.core.LoadService loadsir -> j + java.util.ArrayList mDataList -> l + java.util.ArrayList fragments -> k + java.util.HashMap _$_findViewCache -> m android.view.View _$_findCachedViewById(int) -> a java.util.ArrayList access$getFragments$p(me.hgj.jetpackmvvm.demo.ui.fragment.publicNumber.PublicNumberFragment) -> a void initView(android.os.Bundle) -> a @@ -12805,8 +13083,8 @@ me.hgj.jetpackmvvm.demo.ui.fragment.publicNumber.PublicNumberFragment -> me.hgj. java.util.ArrayList access$getMDataList$p(me.hgj.jetpackmvvm.demo.ui.fragment.publicNumber.PublicNumberFragment) -> c void _$_clearFindViewByIdCache() -> d void createObserver() -> e - int layoutId() -> j - void lazyLoadData() -> k + int layoutId() -> i + void lazyLoadData() -> j me.hgj.jetpackmvvm.demo.ui.fragment.publicNumber.PublicNumberFragment$createObserver$1 -> me.hgj.jetpackmvvm.demo.ui.fragment.publicNumber.PublicNumberFragment$createObserver$1: me.hgj.jetpackmvvm.demo.ui.fragment.publicNumber.PublicNumberFragment this$0 -> a void onChanged(me.hgj.jetpackmvvm.state.ResultState) -> a @@ -12818,10 +13096,10 @@ me.hgj.jetpackmvvm.demo.ui.fragment.publicNumber.PublicNumberFragment$createObse me.hgj.jetpackmvvm.demo.ui.fragment.publicNumber.PublicNumberFragment this$0 -> a void onChanged(java.lang.Integer) -> a me.hgj.jetpackmvvm.demo.ui.fragment.search.SearchFragment -> me.hgj.jetpackmvvm.demo.ui.fragment.search.SearchFragment: - me.hgj.jetpackmvvm.demo.ui.adapter.SearcHistoryAdapter historyAdapter -> i - java.util.HashMap _$_findViewCache -> l - kotlin.Lazy requestSearchViewModel$delegate -> k - me.hgj.jetpackmvvm.demo.ui.adapter.SearcHotAdapter hotAdapter -> j + java.util.HashMap _$_findViewCache -> m + me.hgj.jetpackmvvm.demo.ui.adapter.SearcHistoryAdapter historyAdapter -> j + kotlin.Lazy requestSearchViewModel$delegate -> l + me.hgj.jetpackmvvm.demo.ui.adapter.SearcHotAdapter hotAdapter -> k android.view.View _$_findCachedViewById(int) -> a me.hgj.jetpackmvvm.demo.ui.adapter.SearcHistoryAdapter access$getHistoryAdapter$p(me.hgj.jetpackmvvm.demo.ui.fragment.search.SearchFragment) -> a void initView(android.os.Bundle) -> a @@ -12830,8 +13108,8 @@ me.hgj.jetpackmvvm.demo.ui.fragment.search.SearchFragment -> me.hgj.jetpackmvvm. me.hgj.jetpackmvvm.demo.viewmodel.request.RequestSearchViewModel access$getRequestSearchViewModel$p(me.hgj.jetpackmvvm.demo.ui.fragment.search.SearchFragment) -> c void _$_clearFindViewByIdCache() -> d void createObserver() -> e - int layoutId() -> j - void lazyLoadData() -> k + int layoutId() -> i + void lazyLoadData() -> j me.hgj.jetpackmvvm.demo.viewmodel.request.RequestSearchViewModel getRequestSearchViewModel() -> n me.hgj.jetpackmvvm.demo.ui.fragment.search.SearchFragment$createObserver$$inlined$run$lambda$1 -> me.hgj.jetpackmvvm.demo.ui.fragment.search.SearchFragment$createObserver$$inlined$run$lambda$1: me.hgj.jetpackmvvm.demo.ui.fragment.search.SearchFragment this$0 -> a @@ -12859,12 +13137,12 @@ me.hgj.jetpackmvvm.demo.ui.fragment.search.SearchFragment$initView$5$$special$$i me.hgj.jetpackmvvm.demo.ui.fragment.search.SearchFragment$onCreateOptionsMenu$$inlined$run$lambda$1 -> me.hgj.jetpackmvvm.demo.ui.fragment.search.SearchFragment$onCreateOptionsMenu$$inlined$run$lambda$1: me.hgj.jetpackmvvm.demo.ui.fragment.search.SearchFragment this$0 -> a me.hgj.jetpackmvvm.demo.ui.fragment.search.SearchResultFragment -> me.hgj.jetpackmvvm.demo.ui.fragment.search.SearchResultFragment: - java.lang.String searchKey -> i - com.kingja.loadsir.core.LoadService loadsir -> k - java.util.HashMap _$_findViewCache -> n - kotlin.Lazy articleAdapter$delegate -> j - kotlin.Lazy requestCollectViewModel$delegate -> l - kotlin.Lazy requestSearchViewModel$delegate -> m + java.lang.String searchKey -> j + kotlin.Lazy articleAdapter$delegate -> k + kotlin.Lazy requestCollectViewModel$delegate -> m + java.util.HashMap _$_findViewCache -> o + com.kingja.loadsir.core.LoadService loadsir -> l + kotlin.Lazy requestSearchViewModel$delegate -> n android.view.View _$_findCachedViewById(int) -> a me.hgj.jetpackmvvm.demo.ui.adapter.AriticleAdapter access$getArticleAdapter$p(me.hgj.jetpackmvvm.demo.ui.fragment.search.SearchResultFragment) -> a void initView(android.os.Bundle) -> a @@ -12874,8 +13152,8 @@ me.hgj.jetpackmvvm.demo.ui.fragment.search.SearchResultFragment -> me.hgj.jetpac me.hgj.jetpackmvvm.demo.viewmodel.request.RequestSearchViewModel access$getRequestSearchViewModel$p(me.hgj.jetpackmvvm.demo.ui.fragment.search.SearchResultFragment) -> d java.lang.String access$getSearchKey$p(me.hgj.jetpackmvvm.demo.ui.fragment.search.SearchResultFragment) -> e void createObserver() -> e - int layoutId() -> j - void lazyLoadData() -> k + int layoutId() -> i + void lazyLoadData() -> j me.hgj.jetpackmvvm.demo.ui.adapter.AriticleAdapter getArticleAdapter() -> n me.hgj.jetpackmvvm.demo.viewmodel.request.RequestCollectViewModel getRequestCollectViewModel() -> o me.hgj.jetpackmvvm.demo.viewmodel.request.RequestSearchViewModel getRequestSearchViewModel() -> p @@ -12912,12 +13190,11 @@ me.hgj.jetpackmvvm.demo.ui.fragment.search.SearchResultFragment$initView$$inline me.hgj.jetpackmvvm.demo.ui.fragment.search.SearchResultFragment$initView$2 -> me.hgj.jetpackmvvm.demo.ui.fragment.search.SearchResultFragment$initView$2: void invoke(androidx.appcompat.widget.Toolbar) -> a me.hgj.jetpackmvvm.demo.ui.fragment.setting.SettingFragment -> me.hgj.jetpackmvvm.demo.ui.fragment.setting.SettingFragment: - kotlin.Lazy shareViewModel$delegate -> b - me.hgj.jetpackmvvm.demo.app.weight.preference.IconPreference colorPreview -> c - androidx.appcompat.widget.Toolbar toolbar -> a + me.hgj.jetpackmvvm.demo.app.weight.preference.IconPreference colorPreview -> b + android.view.View toolbarView -> c java.util.HashMap _$_findViewCache -> d - androidx.appcompat.widget.Toolbar access$getToolbar$p(me.hgj.jetpackmvvm.demo.ui.fragment.setting.SettingFragment) -> a - void access$setText(me.hgj.jetpackmvvm.demo.ui.fragment.setting.SettingFragment) -> b + kotlin.Lazy shareViewModel$delegate -> a + void access$setText(me.hgj.jetpackmvvm.demo.ui.fragment.setting.SettingFragment) -> a void _$_clearFindViewByIdCache() -> d me.hgj.jetpackmvvm.demo.app.event.AppViewModel getShareViewModel() -> e void setText() -> f @@ -12945,15 +13222,14 @@ me.hgj.jetpackmvvm.demo.ui.fragment.setting.SettingFragment$onCreatePreferences$ me.hgj.jetpackmvvm.demo.ui.fragment.setting.SettingFragment$onViewCreated$$inlined$let$lambda$1 -> me.hgj.jetpackmvvm.demo.ui.fragment.setting.SettingFragment$onViewCreated$$inlined$let$lambda$1: void invoke(androidx.appcompat.widget.Toolbar) -> a me.hgj.jetpackmvvm.demo.ui.fragment.share.AddAriticleFragment -> me.hgj.jetpackmvvm.demo.ui.fragment.share.AddAriticleFragment: - java.util.HashMap _$_findViewCache -> j - kotlin.Lazy requestViewModel$delegate -> i + java.util.HashMap _$_findViewCache -> k + kotlin.Lazy requestViewModel$delegate -> j android.view.View _$_findCachedViewById(int) -> a me.hgj.jetpackmvvm.demo.viewmodel.request.RequestAriticleViewModel access$getRequestViewModel$p(me.hgj.jetpackmvvm.demo.ui.fragment.share.AddAriticleFragment) -> a void initView(android.os.Bundle) -> a void _$_clearFindViewByIdCache() -> d void createObserver() -> e - int layoutId() -> j - void lazyLoadData() -> k + int layoutId() -> i me.hgj.jetpackmvvm.demo.viewmodel.request.RequestAriticleViewModel getRequestViewModel() -> n me.hgj.jetpackmvvm.demo.ui.fragment.share.AddAriticleFragment$createObserver$1 -> me.hgj.jetpackmvvm.demo.ui.fragment.share.AddAriticleFragment$createObserver$1: me.hgj.jetpackmvvm.demo.ui.fragment.share.AddAriticleFragment this$0 -> a @@ -12967,10 +13243,10 @@ me.hgj.jetpackmvvm.demo.ui.fragment.share.AddAriticleFragment$initView$$inlined$ me.hgj.jetpackmvvm.demo.ui.fragment.share.AddAriticleFragment$initView$4 -> me.hgj.jetpackmvvm.demo.ui.fragment.share.AddAriticleFragment$initView$4: void invoke(android.view.View) -> a me.hgj.jetpackmvvm.demo.ui.fragment.share.AriticleFragment -> me.hgj.jetpackmvvm.demo.ui.fragment.share.AriticleFragment: - com.kingja.loadsir.core.LoadService loadsir -> j - java.util.HashMap _$_findViewCache -> l - kotlin.Lazy articleAdapter$delegate -> i - kotlin.Lazy requestViewModel$delegate -> k + com.kingja.loadsir.core.LoadService loadsir -> k + java.util.HashMap _$_findViewCache -> m + kotlin.Lazy articleAdapter$delegate -> j + kotlin.Lazy requestViewModel$delegate -> l android.view.View _$_findCachedViewById(int) -> a me.hgj.jetpackmvvm.demo.ui.adapter.ShareAdapter access$getArticleAdapter$p(me.hgj.jetpackmvvm.demo.ui.fragment.share.AriticleFragment) -> a void initView(android.os.Bundle) -> a @@ -12978,8 +13254,8 @@ me.hgj.jetpackmvvm.demo.ui.fragment.share.AriticleFragment -> me.hgj.jetpackmvvm me.hgj.jetpackmvvm.demo.viewmodel.request.RequestAriticleViewModel access$getRequestViewModel$p(me.hgj.jetpackmvvm.demo.ui.fragment.share.AriticleFragment) -> c void _$_clearFindViewByIdCache() -> d void createObserver() -> e - int layoutId() -> j - void lazyLoadData() -> k + int layoutId() -> i + void lazyLoadData() -> j me.hgj.jetpackmvvm.demo.ui.adapter.ShareAdapter getArticleAdapter() -> n me.hgj.jetpackmvvm.demo.viewmodel.request.RequestAriticleViewModel getRequestViewModel() -> o me.hgj.jetpackmvvm.demo.ui.fragment.share.AriticleFragment$articleAdapter$2 -> me.hgj.jetpackmvvm.demo.ui.fragment.share.AriticleFragment$articleAdapter$2: @@ -13007,17 +13283,16 @@ me.hgj.jetpackmvvm.demo.ui.fragment.share.AriticleFragment$initView$$inlined$run java.lang.Object invoke(java.lang.Object,java.lang.Object,java.lang.Object) -> a void invoke(com.chad.library.adapter.base.BaseQuickAdapter,android.view.View,int) -> a me.hgj.jetpackmvvm.demo.ui.fragment.todo.AddTodoFragment -> me.hgj.jetpackmvvm.demo.ui.fragment.todo.AddTodoFragment: - me.hgj.jetpackmvvm.demo.data.model.bean.TodoResponse todoResponse -> i - java.util.HashMap _$_findViewCache -> k - kotlin.Lazy requestViewModel$delegate -> j + me.hgj.jetpackmvvm.demo.data.model.bean.TodoResponse todoResponse -> j + java.util.HashMap _$_findViewCache -> l + kotlin.Lazy requestViewModel$delegate -> k android.view.View _$_findCachedViewById(int) -> a me.hgj.jetpackmvvm.demo.viewmodel.request.RequestTodoViewModel access$getRequestViewModel$p(me.hgj.jetpackmvvm.demo.ui.fragment.todo.AddTodoFragment) -> a void initView(android.os.Bundle) -> a me.hgj.jetpackmvvm.demo.data.model.bean.TodoResponse access$getTodoResponse$p(me.hgj.jetpackmvvm.demo.ui.fragment.todo.AddTodoFragment) -> b void _$_clearFindViewByIdCache() -> d void createObserver() -> e - int layoutId() -> j - void lazyLoadData() -> k + int layoutId() -> i me.hgj.jetpackmvvm.demo.viewmodel.request.RequestTodoViewModel getRequestViewModel() -> n me.hgj.jetpackmvvm.demo.ui.fragment.todo.AddTodoFragment$ProxyClick -> me.hgj.jetpackmvvm.demo.ui.fragment.todo.AddTodoFragment$ProxyClick: me.hgj.jetpackmvvm.demo.ui.fragment.todo.AddTodoFragment this$0 -> a @@ -13035,10 +13310,10 @@ me.hgj.jetpackmvvm.demo.ui.fragment.todo.AddTodoFragment$createObserver$1 -> me. me.hgj.jetpackmvvm.demo.ui.fragment.todo.AddTodoFragment$initView$2 -> me.hgj.jetpackmvvm.demo.ui.fragment.todo.AddTodoFragment$initView$2: void invoke(androidx.appcompat.widget.Toolbar) -> a me.hgj.jetpackmvvm.demo.ui.fragment.todo.TodoListFragment -> me.hgj.jetpackmvvm.demo.ui.fragment.todo.TodoListFragment: - com.kingja.loadsir.core.LoadService loadsir -> j - java.util.HashMap _$_findViewCache -> l - kotlin.Lazy articleAdapter$delegate -> i - kotlin.Lazy requestViewModel$delegate -> k + com.kingja.loadsir.core.LoadService loadsir -> k + java.util.HashMap _$_findViewCache -> m + kotlin.Lazy articleAdapter$delegate -> j + kotlin.Lazy requestViewModel$delegate -> l android.view.View _$_findCachedViewById(int) -> a me.hgj.jetpackmvvm.demo.ui.adapter.TodoAdapter access$getArticleAdapter$p(me.hgj.jetpackmvvm.demo.ui.fragment.todo.TodoListFragment) -> a void initView(android.os.Bundle) -> a @@ -13046,8 +13321,8 @@ me.hgj.jetpackmvvm.demo.ui.fragment.todo.TodoListFragment -> me.hgj.jetpackmvvm. me.hgj.jetpackmvvm.demo.viewmodel.request.RequestTodoViewModel access$getRequestViewModel$p(me.hgj.jetpackmvvm.demo.ui.fragment.todo.TodoListFragment) -> c void _$_clearFindViewByIdCache() -> d void createObserver() -> e - int layoutId() -> j - void lazyLoadData() -> k + int layoutId() -> i + void lazyLoadData() -> j me.hgj.jetpackmvvm.demo.ui.adapter.TodoAdapter getArticleAdapter() -> n me.hgj.jetpackmvvm.demo.viewmodel.request.RequestTodoViewModel getRequestViewModel() -> o me.hgj.jetpackmvvm.demo.ui.fragment.todo.TodoListFragment$articleAdapter$2 -> me.hgj.jetpackmvvm.demo.ui.fragment.todo.TodoListFragment$articleAdapter$2: @@ -13081,11 +13356,11 @@ me.hgj.jetpackmvvm.demo.ui.fragment.todo.TodoListFragment$initView$$inlined$run$ java.lang.Object invoke(java.lang.Object,java.lang.Object,java.lang.Object) -> a void invoke(com.afollestad.materialdialogs.MaterialDialog,int,java.lang.CharSequence) -> a me.hgj.jetpackmvvm.demo.ui.fragment.tree.AskFragment -> me.hgj.jetpackmvvm.demo.ui.fragment.tree.AskFragment: - com.kingja.loadsir.core.LoadService loadsir -> i - java.util.HashMap _$_findViewCache -> m - kotlin.Lazy requestTreeViewModel$delegate -> j - kotlin.Lazy articleAdapter$delegate -> k - kotlin.Lazy requestCollectViewModel$delegate -> l + com.kingja.loadsir.core.LoadService loadsir -> j + java.util.HashMap _$_findViewCache -> n + kotlin.Lazy requestTreeViewModel$delegate -> k + kotlin.Lazy articleAdapter$delegate -> l + kotlin.Lazy requestCollectViewModel$delegate -> m android.view.View _$_findCachedViewById(int) -> a me.hgj.jetpackmvvm.demo.ui.adapter.AriticleAdapter access$getArticleAdapter$p(me.hgj.jetpackmvvm.demo.ui.fragment.tree.AskFragment) -> a void initView(android.os.Bundle) -> a @@ -13094,8 +13369,8 @@ me.hgj.jetpackmvvm.demo.ui.fragment.tree.AskFragment -> me.hgj.jetpackmvvm.demo. void _$_clearFindViewByIdCache() -> d me.hgj.jetpackmvvm.demo.viewmodel.request.RequestTreeViewModel access$getRequestTreeViewModel$p(me.hgj.jetpackmvvm.demo.ui.fragment.tree.AskFragment) -> d void createObserver() -> e - int layoutId() -> j - void lazyLoadData() -> k + int layoutId() -> i + void lazyLoadData() -> j me.hgj.jetpackmvvm.demo.ui.adapter.AriticleAdapter getArticleAdapter() -> n me.hgj.jetpackmvvm.demo.viewmodel.request.RequestCollectViewModel getRequestCollectViewModel() -> o me.hgj.jetpackmvvm.demo.viewmodel.request.RequestTreeViewModel getRequestTreeViewModel() -> p @@ -13132,10 +13407,10 @@ me.hgj.jetpackmvvm.demo.ui.fragment.tree.AskFragment$initView$$inlined$run$lambd java.lang.Object invoke(java.lang.Object,java.lang.Object,java.lang.Object) -> a void invoke(com.chad.library.adapter.base.BaseQuickAdapter,android.view.View,int) -> a me.hgj.jetpackmvvm.demo.ui.fragment.tree.NavigationFragment -> me.hgj.jetpackmvvm.demo.ui.fragment.tree.NavigationFragment: - com.kingja.loadsir.core.LoadService loadsir -> i - java.util.HashMap _$_findViewCache -> l - kotlin.Lazy navigationAdapter$delegate -> j - kotlin.Lazy requestTreeViewModel$delegate -> k + com.kingja.loadsir.core.LoadService loadsir -> j + java.util.HashMap _$_findViewCache -> m + kotlin.Lazy navigationAdapter$delegate -> k + kotlin.Lazy requestTreeViewModel$delegate -> l android.view.View _$_findCachedViewById(int) -> a com.kingja.loadsir.core.LoadService access$getLoadsir$p(me.hgj.jetpackmvvm.demo.ui.fragment.tree.NavigationFragment) -> a void initView(android.os.Bundle) -> a @@ -13143,8 +13418,8 @@ me.hgj.jetpackmvvm.demo.ui.fragment.tree.NavigationFragment -> me.hgj.jetpackmvv me.hgj.jetpackmvvm.demo.viewmodel.request.RequestTreeViewModel access$getRequestTreeViewModel$p(me.hgj.jetpackmvvm.demo.ui.fragment.tree.NavigationFragment) -> c void _$_clearFindViewByIdCache() -> d void createObserver() -> e - int layoutId() -> j - void lazyLoadData() -> k + int layoutId() -> i + void lazyLoadData() -> j me.hgj.jetpackmvvm.demo.ui.adapter.NavigationAdapter getNavigationAdapter() -> n me.hgj.jetpackmvvm.demo.viewmodel.request.RequestTreeViewModel getRequestTreeViewModel() -> o me.hgj.jetpackmvvm.demo.ui.fragment.tree.NavigationFragment$createObserver$$inlined$run$lambda$1 -> me.hgj.jetpackmvvm.demo.ui.fragment.tree.NavigationFragment$a: @@ -13162,11 +13437,11 @@ me.hgj.jetpackmvvm.demo.ui.fragment.tree.NavigationFragment$initView$4 -> me.hgj me.hgj.jetpackmvvm.demo.ui.fragment.tree.NavigationFragment$navigationAdapter$2 -> me.hgj.jetpackmvvm.demo.ui.fragment.tree.NavigationFragment$navigationAdapter$2: me.hgj.jetpackmvvm.demo.ui.fragment.tree.NavigationFragment$navigationAdapter$2 INSTANCE -> a me.hgj.jetpackmvvm.demo.ui.fragment.tree.PlazaFragment -> me.hgj.jetpackmvvm.demo.ui.fragment.tree.PlazaFragment: - com.kingja.loadsir.core.LoadService loadsir -> i - java.util.HashMap _$_findViewCache -> m - kotlin.Lazy requestCollectViewModel$delegate -> j - kotlin.Lazy requestTreeViewModel$delegate -> k - kotlin.Lazy articleAdapter$delegate -> l + com.kingja.loadsir.core.LoadService loadsir -> j + java.util.HashMap _$_findViewCache -> n + kotlin.Lazy requestCollectViewModel$delegate -> k + kotlin.Lazy requestTreeViewModel$delegate -> l + kotlin.Lazy articleAdapter$delegate -> m android.view.View _$_findCachedViewById(int) -> a me.hgj.jetpackmvvm.demo.ui.adapter.AriticleAdapter access$getArticleAdapter$p(me.hgj.jetpackmvvm.demo.ui.fragment.tree.PlazaFragment) -> a void initView(android.os.Bundle) -> a @@ -13175,8 +13450,8 @@ me.hgj.jetpackmvvm.demo.ui.fragment.tree.PlazaFragment -> me.hgj.jetpackmvvm.dem void _$_clearFindViewByIdCache() -> d me.hgj.jetpackmvvm.demo.viewmodel.request.RequestTreeViewModel access$getRequestTreeViewModel$p(me.hgj.jetpackmvvm.demo.ui.fragment.tree.PlazaFragment) -> d void createObserver() -> e - int layoutId() -> j - void lazyLoadData() -> k + int layoutId() -> i + void lazyLoadData() -> j me.hgj.jetpackmvvm.demo.ui.adapter.AriticleAdapter getArticleAdapter() -> n me.hgj.jetpackmvvm.demo.viewmodel.request.RequestCollectViewModel getRequestCollectViewModel() -> o me.hgj.jetpackmvvm.demo.viewmodel.request.RequestTreeViewModel getRequestTreeViewModel() -> p @@ -13213,29 +13488,29 @@ me.hgj.jetpackmvvm.demo.ui.fragment.tree.PlazaFragment$initView$$inlined$run$lam java.lang.Object invoke(java.lang.Object,java.lang.Object,java.lang.Object) -> a void invoke(com.chad.library.adapter.base.BaseQuickAdapter,android.view.View,int) -> a me.hgj.jetpackmvvm.demo.ui.fragment.tree.SystemArrFragment -> me.hgj.jetpackmvvm.demo.ui.fragment.tree.SystemArrFragment: - int index -> j - java.util.ArrayList fragments -> k - java.util.HashMap _$_findViewCache -> l - me.hgj.jetpackmvvm.demo.data.model.bean.SystemResponse data -> i + java.util.ArrayList fragments -> l + int index -> k + java.util.HashMap _$_findViewCache -> m + me.hgj.jetpackmvvm.demo.data.model.bean.SystemResponse data -> j android.view.View _$_findCachedViewById(int) -> a void initView(android.os.Bundle) -> a void _$_clearFindViewByIdCache() -> d void createObserver() -> e - int layoutId() -> j - void lazyLoadData() -> k + int layoutId() -> i + void lazyLoadData() -> j int getIndex() -> n me.hgj.jetpackmvvm.demo.ui.fragment.tree.SystemArrFragment$initView$2 -> me.hgj.jetpackmvvm.demo.ui.fragment.tree.SystemArrFragment$initView$2: void invoke(androidx.appcompat.widget.Toolbar) -> a me.hgj.jetpackmvvm.demo.ui.fragment.tree.SystemArrFragment$lazyLoadData$2 -> me.hgj.jetpackmvvm.demo.ui.fragment.tree.SystemArrFragment$a: me.hgj.jetpackmvvm.demo.ui.fragment.tree.SystemArrFragment this$0 -> a me.hgj.jetpackmvvm.demo.ui.fragment.tree.SystemChildFragment -> me.hgj.jetpackmvvm.demo.ui.fragment.tree.SystemChildFragment: - me.hgj.jetpackmvvm.demo.ui.fragment.tree.SystemChildFragment$Companion Companion -> o - com.kingja.loadsir.core.LoadService loadsir -> i - int cid -> j - java.util.HashMap _$_findViewCache -> n - kotlin.Lazy articleAdapter$delegate -> k - kotlin.Lazy requestCollectViewModel$delegate -> l - kotlin.Lazy requestTreeViewModel$delegate -> m + com.kingja.loadsir.core.LoadService loadsir -> j + int cid -> k + kotlin.Lazy articleAdapter$delegate -> l + kotlin.Lazy requestCollectViewModel$delegate -> m + java.util.HashMap _$_findViewCache -> o + kotlin.Lazy requestTreeViewModel$delegate -> n + me.hgj.jetpackmvvm.demo.ui.fragment.tree.SystemChildFragment$Companion Companion -> p android.view.View _$_findCachedViewById(int) -> a me.hgj.jetpackmvvm.demo.ui.adapter.AriticleAdapter access$getArticleAdapter$p(me.hgj.jetpackmvvm.demo.ui.fragment.tree.SystemChildFragment) -> a void initView(android.os.Bundle) -> a @@ -13245,8 +13520,8 @@ me.hgj.jetpackmvvm.demo.ui.fragment.tree.SystemChildFragment -> me.hgj.jetpackmv me.hgj.jetpackmvvm.demo.viewmodel.request.RequestCollectViewModel access$getRequestCollectViewModel$p(me.hgj.jetpackmvvm.demo.ui.fragment.tree.SystemChildFragment) -> d me.hgj.jetpackmvvm.demo.viewmodel.request.RequestTreeViewModel access$getRequestTreeViewModel$p(me.hgj.jetpackmvvm.demo.ui.fragment.tree.SystemChildFragment) -> e void createObserver() -> e - int layoutId() -> j - void lazyLoadData() -> k + int layoutId() -> i + void lazyLoadData() -> j me.hgj.jetpackmvvm.demo.ui.adapter.AriticleAdapter getArticleAdapter() -> n me.hgj.jetpackmvvm.demo.viewmodel.request.RequestCollectViewModel getRequestCollectViewModel() -> o me.hgj.jetpackmvvm.demo.viewmodel.request.RequestTreeViewModel getRequestTreeViewModel() -> p @@ -13279,10 +13554,10 @@ me.hgj.jetpackmvvm.demo.ui.fragment.tree.SystemChildFragment$initView$$inlined$r java.lang.Object invoke(java.lang.Object,java.lang.Object,java.lang.Object) -> a void invoke(com.chad.library.adapter.base.BaseQuickAdapter,android.view.View,int) -> a me.hgj.jetpackmvvm.demo.ui.fragment.tree.SystemFragment -> me.hgj.jetpackmvvm.demo.ui.fragment.tree.SystemFragment: - com.kingja.loadsir.core.LoadService loadsir -> i - java.util.HashMap _$_findViewCache -> l - kotlin.Lazy systemAdapter$delegate -> j - kotlin.Lazy requestTreeViewModel$delegate -> k + com.kingja.loadsir.core.LoadService loadsir -> j + java.util.HashMap _$_findViewCache -> m + kotlin.Lazy systemAdapter$delegate -> k + kotlin.Lazy requestTreeViewModel$delegate -> l android.view.View _$_findCachedViewById(int) -> a com.kingja.loadsir.core.LoadService access$getLoadsir$p(me.hgj.jetpackmvvm.demo.ui.fragment.tree.SystemFragment) -> a void initView(android.os.Bundle) -> a @@ -13290,8 +13565,8 @@ me.hgj.jetpackmvvm.demo.ui.fragment.tree.SystemFragment -> me.hgj.jetpackmvvm.de me.hgj.jetpackmvvm.demo.ui.adapter.SystemAdapter access$getSystemAdapter$p(me.hgj.jetpackmvvm.demo.ui.fragment.tree.SystemFragment) -> c void _$_clearFindViewByIdCache() -> d void createObserver() -> e - int layoutId() -> j - void lazyLoadData() -> k + int layoutId() -> i + void lazyLoadData() -> j me.hgj.jetpackmvvm.demo.viewmodel.request.RequestTreeViewModel getRequestTreeViewModel() -> n me.hgj.jetpackmvvm.demo.ui.adapter.SystemAdapter getSystemAdapter() -> o me.hgj.jetpackmvvm.demo.ui.fragment.tree.SystemFragment$createObserver$$inlined$run$lambda$1 -> me.hgj.jetpackmvvm.demo.ui.fragment.tree.SystemFragment$a: @@ -13312,15 +13587,15 @@ me.hgj.jetpackmvvm.demo.ui.fragment.tree.SystemFragment$initView$$inlined$run$la me.hgj.jetpackmvvm.demo.ui.fragment.tree.SystemFragment$systemAdapter$2 -> me.hgj.jetpackmvvm.demo.ui.fragment.tree.SystemFragment$systemAdapter$2: me.hgj.jetpackmvvm.demo.ui.fragment.tree.SystemFragment$systemAdapter$2 INSTANCE -> a me.hgj.jetpackmvvm.demo.ui.fragment.tree.TreeArrFragment -> me.hgj.jetpackmvvm.demo.ui.fragment.tree.TreeArrFragment: - java.util.ArrayList fragments -> j - java.util.ArrayList titleData -> i - java.util.HashMap _$_findViewCache -> k + java.util.ArrayList fragments -> k + java.util.ArrayList titleData -> j + java.util.HashMap _$_findViewCache -> l android.view.View _$_findCachedViewById(int) -> a void initView(android.os.Bundle) -> a void _$_clearFindViewByIdCache() -> d void createObserver() -> e - int layoutId() -> j - void lazyLoadData() -> k + int layoutId() -> i + void lazyLoadData() -> j me.hgj.jetpackmvvm.demo.ui.fragment.tree.TreeArrFragment$createObserver$1 -> me.hgj.jetpackmvvm.demo.ui.fragment.tree.TreeArrFragment$a: me.hgj.jetpackmvvm.demo.ui.fragment.tree.TreeArrFragment this$0 -> a void onChanged(java.lang.Integer) -> a @@ -13329,16 +13604,16 @@ me.hgj.jetpackmvvm.demo.ui.fragment.tree.TreeArrFragment$initView$$inlined$run$l me.hgj.jetpackmvvm.demo.ui.fragment.tree.TreeArrFragment$lazyLoadData$1 -> me.hgj.jetpackmvvm.demo.ui.fragment.tree.TreeArrFragment$lazyLoadData$1: void invoke(int) -> a me.hgj.jetpackmvvm.demo.ui.fragment.web.WebFragment -> me.hgj.jetpackmvvm.demo.ui.fragment.web.WebFragment: - com.just.agentweb.AgentWeb mAgentWeb -> i - java.util.HashMap _$_findViewCache -> k - kotlin.Lazy requestCollectViewModel$delegate -> j + java.util.HashMap _$_findViewCache -> l + kotlin.Lazy requestCollectViewModel$delegate -> k + com.just.agentweb.AgentWeb mAgentWeb -> j android.view.View _$_findCachedViewById(int) -> a com.just.agentweb.AgentWeb access$getMAgentWeb$p(me.hgj.jetpackmvvm.demo.ui.fragment.web.WebFragment) -> a void initView(android.os.Bundle) -> a void _$_clearFindViewByIdCache() -> d void createObserver() -> e - int layoutId() -> j - void lazyLoadData() -> k + int layoutId() -> i + void lazyLoadData() -> j me.hgj.jetpackmvvm.demo.viewmodel.request.RequestCollectViewModel getRequestCollectViewModel() -> n me.hgj.jetpackmvvm.demo.ui.fragment.web.WebFragment$createObserver$1 -> me.hgj.jetpackmvvm.demo.ui.fragment.web.WebFragment$a: me.hgj.jetpackmvvm.demo.ui.fragment.web.WebFragment this$0 -> a @@ -13598,6 +13873,8 @@ me.hgj.jetpackmvvm.demo.viewmodel.state.LookInfoViewModel -> me.hgj.jetpackmvvm. me.hgj.jetpackmvvm.callback.livedata.StringLiveData getImageUrl() -> b me.hgj.jetpackmvvm.callback.livedata.StringLiveData getInfo() -> c me.hgj.jetpackmvvm.callback.livedata.StringLiveData getName() -> d +me.hgj.jetpackmvvm.demo.viewmodel.state.MainViewModel -> me.hgj.jetpackmvvm.demo.viewmodel.state.MainViewModel: + me.hgj.jetpackmvvm.callback.livedata.UnPeekNotNullLiveData name2 -> b me.hgj.jetpackmvvm.demo.viewmodel.state.MeViewModel -> me.hgj.jetpackmvvm.demo.viewmodel.state.MeViewModel: me.hgj.jetpackmvvm.callback.livedata.IntLiveData integral -> c me.hgj.jetpackmvvm.callback.livedata.StringLiveData imageUrl -> e @@ -13635,13 +13912,13 @@ me.hgj.jetpackmvvm.demo.viewmodel.state.WebViewModel -> me.hgj.jetpackmvvm.demo. java.lang.String getShowTitle() -> e java.lang.String getUrl() -> f me.hgj.jetpackmvvm.ext.BaseViewModelExtKt -> me.hgj.jetpackmvvm.ext.BaseViewModelExtKt: - java.lang.Object executeResponse(me.hgj.jetpackmvvm.base.viewmodel.BaseViewModel,me.hgj.jetpackmvvm.network.BaseResponse,kotlin.jvm.functions.Function3,kotlin.coroutines.Continuation) -> a - void parseState(me.hgj.jetpackmvvm.base.fragment.BaseVmDbFragment,me.hgj.jetpackmvvm.state.ResultState,kotlin.jvm.functions.Function1,kotlin.jvm.functions.Function1,kotlin.jvm.functions.Function0) -> a - void parseState$default(me.hgj.jetpackmvvm.base.fragment.BaseVmDbFragment,me.hgj.jetpackmvvm.state.ResultState,kotlin.jvm.functions.Function1,kotlin.jvm.functions.Function1,kotlin.jvm.functions.Function0,int,java.lang.Object) -> a - void request(me.hgj.jetpackmvvm.base.viewmodel.BaseViewModel,kotlin.jvm.functions.Function1,androidx.lifecycle.MutableLiveData,boolean,java.lang.String) -> a - void request(me.hgj.jetpackmvvm.base.viewmodel.BaseViewModel,kotlin.jvm.functions.Function1,kotlin.jvm.functions.Function1,kotlin.jvm.functions.Function1,boolean,java.lang.String) -> a - void request$default(me.hgj.jetpackmvvm.base.viewmodel.BaseViewModel,kotlin.jvm.functions.Function1,androidx.lifecycle.MutableLiveData,boolean,java.lang.String,int,java.lang.Object) -> a - void request$default(me.hgj.jetpackmvvm.base.viewmodel.BaseViewModel,kotlin.jvm.functions.Function1,kotlin.jvm.functions.Function1,kotlin.jvm.functions.Function1,boolean,java.lang.String,int,java.lang.Object) -> a + java.lang.Object executeResponse(me.hgj.jetpackmvvm.network.BaseResponse,kotlin.jvm.functions.Function3,kotlin.coroutines.Continuation) -> a + void parseState(me.hgj.jetpackmvvm.base.fragment.BaseVmFragment,me.hgj.jetpackmvvm.state.ResultState,kotlin.jvm.functions.Function1,kotlin.jvm.functions.Function1,kotlin.jvm.functions.Function0) -> a + void parseState$default(me.hgj.jetpackmvvm.base.fragment.BaseVmFragment,me.hgj.jetpackmvvm.state.ResultState,kotlin.jvm.functions.Function1,kotlin.jvm.functions.Function1,kotlin.jvm.functions.Function0,int,java.lang.Object) -> a + kotlinx.coroutines.Job request(me.hgj.jetpackmvvm.base.viewmodel.BaseViewModel,kotlin.jvm.functions.Function1,androidx.lifecycle.MutableLiveData,boolean,java.lang.String) -> a + kotlinx.coroutines.Job request(me.hgj.jetpackmvvm.base.viewmodel.BaseViewModel,kotlin.jvm.functions.Function1,kotlin.jvm.functions.Function1,kotlin.jvm.functions.Function1,boolean,java.lang.String) -> a + kotlinx.coroutines.Job request$default(me.hgj.jetpackmvvm.base.viewmodel.BaseViewModel,kotlin.jvm.functions.Function1,androidx.lifecycle.MutableLiveData,boolean,java.lang.String,int,java.lang.Object) -> a + kotlinx.coroutines.Job request$default(me.hgj.jetpackmvvm.base.viewmodel.BaseViewModel,kotlin.jvm.functions.Function1,kotlin.jvm.functions.Function1,kotlin.jvm.functions.Function1,boolean,java.lang.String,int,java.lang.Object) -> a me.hgj.jetpackmvvm.ext.BaseViewModelExtKt$request$2 -> me.hgj.jetpackmvvm.ext.BaseViewModelExtKt$request$2: me.hgj.jetpackmvvm.ext.BaseViewModelExtKt$request$2 INSTANCE -> a void invoke(me.hgj.jetpackmvvm.network.AppException) -> a @@ -13707,14 +13984,20 @@ me.hgj.jetpackmvvm.navigation.DialogFragmentNavigator -> me.hgj.jetpackmvvm.navi androidx.navigation.NavDestination navigate(me.hgj.jetpackmvvm.navigation.DialogFragmentNavigator$Destination,android.os.Bundle,androidx.navigation.NavOptions,androidx.navigation.Navigator$Extras) -> a me.hgj.jetpackmvvm.navigation.DialogFragmentNavigator$Destination -> me.hgj.jetpackmvvm.navigation.DialogFragmentNavigator$Destination: java.lang.String mClassName -> a + java.lang.String getClassName() -> a + me.hgj.jetpackmvvm.navigation.DialogFragmentNavigator$Destination setClassName(java.lang.String) -> a me.hgj.jetpackmvvm.navigation.FragmentNavigator -> me.hgj.jetpackmvvm.navigation.FragmentNavigator: android.content.Context mContext -> a androidx.fragment.app.FragmentManager mFragmentManager -> b java.util.ArrayDeque mBackStack -> d int mContainerId -> c + java.lang.String generateBackStackName(int,int) -> a + androidx.fragment.app.Fragment instantiateFragment(android.content.Context,androidx.fragment.app.FragmentManager,java.lang.String,android.os.Bundle) -> a androidx.navigation.NavDestination navigate(me.hgj.jetpackmvvm.navigation.FragmentNavigator$Destination,android.os.Bundle,androidx.navigation.NavOptions,androidx.navigation.Navigator$Extras) -> a me.hgj.jetpackmvvm.navigation.FragmentNavigator$Destination -> me.hgj.jetpackmvvm.navigation.FragmentNavigator$Destination: java.lang.String mClassName -> a + java.lang.String getClassName() -> a + me.hgj.jetpackmvvm.navigation.FragmentNavigator$Destination setClassName(java.lang.String) -> a me.hgj.jetpackmvvm.navigation.FragmentNavigator$Extras -> me.hgj.jetpackmvvm.navigation.FragmentNavigator$Extras: java.util.LinkedHashMap mSharedElements -> a java.util.Map getSharedElements() -> a @@ -13723,6 +14006,10 @@ me.hgj.jetpackmvvm.navigation.NavHostFragment -> me.hgj.jetpackmvvm.navigation.N int mGraphId -> c java.lang.Boolean mIsPrimaryBeforeOnCreate -> b boolean mDefaultNavHost -> d + androidx.navigation.NavController findNavController(androidx.fragment.app.Fragment) -> a + void onCreateNavController(androidx.navigation.NavController) -> a + androidx.navigation.Navigator createFragmentNavigator() -> d + int getContainerId() -> e me.hgj.jetpackmvvm.network.AppException -> me.hgj.jetpackmvvm.network.AppException: java.lang.String getErrorMsg() -> a me.hgj.jetpackmvvm.network.BaseNetworkApi -> me.hgj.jetpackmvvm.network.a: @@ -13762,9 +14049,6 @@ me.hgj.jetpackmvvm.network.NetworkUtil -> me.hgj.jetpackmvvm.network.d: me.hgj.jetpackmvvm.network.interceptor.CacheInterceptor -> me.hgj.jetpackmvvm.network.e.a: int day -> a okhttp3.Response intercept(okhttp3.Interceptor$Chain) -> a -me.hgj.jetpackmvvm.network.interceptor.HeadInterceptor -> me.hgj.jetpackmvvm.network.e.b: - java.util.Map headers -> a - okhttp3.Response intercept(okhttp3.Interceptor$Chain) -> a me.hgj.jetpackmvvm.network.interceptor.logging.DefaultFormatPrinter -> me.hgj.jetpackmvvm.network.interceptor.logging.a: java.lang.String[] ARMS -> e java.lang.ThreadLocal last -> f @@ -13826,31 +14110,24 @@ me.hgj.jetpackmvvm.network.manager.NetworkStateManager$Companion -> me.hgj.jetpa me.hgj.jetpackmvvm.network.manager.NetworkStateManager$Companion$instance$2 -> me.hgj.jetpackmvvm.network.manager.NetworkStateManager$Companion$instance$2: me.hgj.jetpackmvvm.network.manager.NetworkStateManager$Companion$instance$2 INSTANCE -> a me.hgj.jetpackmvvm.network.manager.NetworkStateReceive -> me.hgj.jetpackmvvm.network.manager.b: -me.hgj.jetpackmvvm.state.ResultState -> me.hgj.jetpackmvvm.state.a: +me.hgj.jetpackmvvm.state.ResultState -> me.hgj.jetpackmvvm.a.a: me.hgj.jetpackmvvm.state.ResultState$Companion Companion -> a -me.hgj.jetpackmvvm.state.ResultState$Companion -> me.hgj.jetpackmvvm.state.a$a: +me.hgj.jetpackmvvm.state.ResultState$Companion -> me.hgj.jetpackmvvm.a.a$a: me.hgj.jetpackmvvm.state.ResultState onAppError(me.hgj.jetpackmvvm.network.AppException) -> a me.hgj.jetpackmvvm.state.ResultState onAppLoading(java.lang.String) -> a me.hgj.jetpackmvvm.state.ResultState onAppSuccess(java.lang.Object) -> a -me.hgj.jetpackmvvm.state.ResultState$Error -> me.hgj.jetpackmvvm.state.a$b: +me.hgj.jetpackmvvm.state.ResultState$Error -> me.hgj.jetpackmvvm.a.a$b: me.hgj.jetpackmvvm.network.AppException error -> b me.hgj.jetpackmvvm.network.AppException getError() -> a -me.hgj.jetpackmvvm.state.ResultState$Loading -> me.hgj.jetpackmvvm.state.a$c: +me.hgj.jetpackmvvm.state.ResultState$Loading -> me.hgj.jetpackmvvm.a.a$c: java.lang.String loadingMessage -> b java.lang.String getLoadingMessage() -> a -me.hgj.jetpackmvvm.state.ResultState$Success -> me.hgj.jetpackmvvm.state.a$d: +me.hgj.jetpackmvvm.state.ResultState$Success -> me.hgj.jetpackmvvm.a.a$d: java.lang.Object data -> b java.lang.Object getData() -> a -me.hgj.jetpackmvvm.state.ResultStateKt -> me.hgj.jetpackmvvm.state.b: +me.hgj.jetpackmvvm.state.ResultStateKt -> me.hgj.jetpackmvvm.a.b: void paresException(androidx.lifecycle.MutableLiveData,java.lang.Throwable) -> a void paresResult(androidx.lifecycle.MutableLiveData,me.hgj.jetpackmvvm.network.BaseResponse) -> a -me.hgj.jetpackmvvm.state.SingleLiveEvent -> me.hgj.jetpackmvvm.state.SingleLiveEvent: - java.util.concurrent.atomic.AtomicBoolean mPending -> a - java.util.concurrent.atomic.AtomicBoolean access$getMPending$p(me.hgj.jetpackmvvm.state.SingleLiveEvent) -> a - void call() -> a -me.hgj.jetpackmvvm.state.SingleLiveEvent$observe$1 -> me.hgj.jetpackmvvm.state.SingleLiveEvent$a: - me.hgj.jetpackmvvm.state.SingleLiveEvent this$0 -> a - androidx.lifecycle.Observer $observer -> b me.hgj.jetpackmvvm.util.CharacterHandler -> me.hgj.jetpackmvvm.util.a: java.lang.String jsonFormat(java.lang.String) -> a java.lang.String xmlFormat(java.lang.String) -> b diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro index d77528a..c6525a8 100644 --- a/app/proguard-rules.pro +++ b/app/proguard-rules.pro @@ -86,6 +86,7 @@ -keep class com.just.agentweb.** { *; } + -dontwarn com.just.agentweb.** -keepattributes *Annotation* diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index b3872fa..23c6e8c 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -4,6 +4,7 @@ package="me.hgj.jetpackmvvm.demo"> + - @@ -44,7 +44,7 @@ android:value="375" /> + android:value="667" /> diff --git a/app/src/main/java/me/hgj/jetpackmvvm/demo/app/base/BaseFragment.kt b/app/src/main/java/me/hgj/jetpackmvvm/demo/app/base/BaseFragment.kt index edbc418..3d9f496 100644 --- a/app/src/main/java/me/hgj/jetpackmvvm/demo/app/base/BaseFragment.kt +++ b/app/src/main/java/me/hgj/jetpackmvvm/demo/app/base/BaseFragment.kt @@ -44,16 +44,16 @@ abstract class BaseFragment : BaseVmDb /** * 懒加载 只有当前fragment视图显示时才会触发该方法 */ - abstract override fun lazyLoadData() + override fun lazyLoadData(){} /** - * 创建LiveData观察者 懒加载之后才会触发 + * 创建LiveData观察者 Fragment执行onViewCreated后触发 */ override fun createObserver() {} /** - * Fragment执行onViewCreated后触发的方法 + * Fragment执行onViewCreated后触发 */ override fun initData() { diff --git a/app/src/main/java/me/hgj/jetpackmvvm/demo/app/event/AppViewModel.kt b/app/src/main/java/me/hgj/jetpackmvvm/demo/app/event/AppViewModel.kt index 775fb08..8a0d500 100644 --- a/app/src/main/java/me/hgj/jetpackmvvm/demo/app/event/AppViewModel.kt +++ b/app/src/main/java/me/hgj/jetpackmvvm/demo/app/event/AppViewModel.kt @@ -15,32 +15,17 @@ import me.hgj.jetpackmvvm.demo.data.model.bean.UserInfo * 比如 全局可使用的 地理位置信息,账户信息,App的基本配置等等, */ class AppViewModel(app: Application) : BaseViewModel(app) { - - //是否是第一次启动 - var isFirst = - UnPeekNotNullLiveData() - - //是否已经登录过 - var isLogin = - UnPeekNotNullLiveData() //App的账户信息 使用UnPeekLiveData 因为账户信息有可能为空 - var userinfo = - UnPeekLiveData() + var userinfo = UnPeekLiveData() //App主题颜色 中大型项目不推荐以这种方式改变主题颜色,比较繁琐耦合,且容易有遗漏某些控件没有设置主题色 - var appColor = - UnPeekNotNullLiveData() + var appColor = UnPeekNotNullLiveData() //App 列表动画 - var appAnimation = - UnPeekNotNullLiveData() + var appAnimation = UnPeekNotNullLiveData() init { - //初始化 - isFirst.value = CacheUtil.isFirst() - //初始化 - isLogin.value = CacheUtil.isLogin() //默认值保存的账户信息,没有登陆过则为null userinfo.value = CacheUtil.getUser() //默认值颜色 diff --git a/app/src/main/java/me/hgj/jetpackmvvm/demo/app/event/EventViewModel.kt b/app/src/main/java/me/hgj/jetpackmvvm/demo/app/event/EventViewModel.kt index d3f82cd..1e59651 100644 --- a/app/src/main/java/me/hgj/jetpackmvvm/demo/app/event/EventViewModel.kt +++ b/app/src/main/java/me/hgj/jetpackmvvm/demo/app/event/EventViewModel.kt @@ -2,7 +2,7 @@ package me.hgj.jetpackmvvm.demo.app.event import android.app.Application import me.hgj.jetpackmvvm.base.viewmodel.BaseViewModel -import me.hgj.jetpackmvvm.callback.livedata.UnPeekLiveData +import me.hgj.jetpackmvvm.callback.livedata.event.EventLiveData import me.hgj.jetpackmvvm.demo.data.model.bean.CollectBus /** @@ -13,14 +13,12 @@ import me.hgj.jetpackmvvm.demo.data.model.bean.CollectBus class EventViewModel(app: Application) : BaseViewModel(app) { //全局收藏,在任意一个地方收藏或取消收藏,监听该值的界面都会收到消息 - var collect = - UnPeekLiveData() + val collectEvent = EventLiveData() //分享文章通知 - var shareArticle = - UnPeekLiveData() + val shareArticleEvent = EventLiveData() - //添加toto通知 - var addTodo = UnPeekLiveData() + //添加TODO通知 + val todoEvent = EventLiveData() } \ No newline at end of file diff --git a/app/src/main/java/me/hgj/jetpackmvvm/demo/app/ext/AppExt.kt b/app/src/main/java/me/hgj/jetpackmvvm/demo/app/ext/AppExt.kt index 3a96f59..045bafa 100644 --- a/app/src/main/java/me/hgj/jetpackmvvm/demo/app/ext/AppExt.kt +++ b/app/src/main/java/me/hgj/jetpackmvvm/demo/app/ext/AppExt.kt @@ -144,9 +144,7 @@ fun NavController.jumpByLogin(action: (NavController) -> Unit) { if (CacheUtil.isLogin()) { action(this) } else { - //注意一下,这里我是确定我所有的拦截登录都是在MainFragment中的,所以我可以写死,但是如果不在MainFragment中时跳转,你会报错, - //当然你也可以执行下面那个方法 自己写跳转 - this.navigate(R.id.action_mainFragment_to_loginFragment) + this.navigate(R.id.action_to_loginFragment) } } diff --git a/app/src/main/java/me/hgj/jetpackmvvm/demo/app/ext/CustomViewExt.kt b/app/src/main/java/me/hgj/jetpackmvvm/demo/app/ext/CustomViewExt.kt index 8bceacd..96a22a1 100644 --- a/app/src/main/java/me/hgj/jetpackmvvm/demo/app/ext/CustomViewExt.kt +++ b/app/src/main/java/me/hgj/jetpackmvvm/demo/app/ext/CustomViewExt.kt @@ -27,16 +27,22 @@ import com.kingja.loadsir.core.LoadService import com.kingja.loadsir.core.LoadSir import com.yanzhenjie.recyclerview.SwipeRecyclerView import com.zhpan.bannerview.BannerViewPager +import me.hgj.jetpackmvvm.base.Ktx import me.hgj.jetpackmvvm.demo.R import me.hgj.jetpackmvvm.demo.app.App -import me.hgj.jetpackmvvm.demo.app.util.CacheUtil +import me.hgj.jetpackmvvm.demo.app.network.stateCallback.ListDataUiState import me.hgj.jetpackmvvm.demo.app.util.SettingUtil +import me.hgj.jetpackmvvm.demo.app.weight.loadCallBack.EmptyCallback import me.hgj.jetpackmvvm.demo.app.weight.loadCallBack.ErrorCallback import me.hgj.jetpackmvvm.demo.app.weight.loadCallBack.LoadingCallback import me.hgj.jetpackmvvm.demo.app.weight.recyclerview.DefineLoadMoreView import me.hgj.jetpackmvvm.demo.app.weight.viewpager.ScaleTransitionPagerTitleView import me.hgj.jetpackmvvm.demo.data.model.bean.ClassifyResponse -import me.hgj.jetpackmvvm.ext.nav +import me.hgj.jetpackmvvm.demo.ui.fragment.home.HomeFragment +import me.hgj.jetpackmvvm.demo.ui.fragment.me.MeFragment +import me.hgj.jetpackmvvm.demo.ui.fragment.project.ProjectFragment +import me.hgj.jetpackmvvm.demo.ui.fragment.publicNumber.PublicNumberFragment +import me.hgj.jetpackmvvm.demo.ui.fragment.tree.TreeArrFragment import me.hgj.jetpackmvvm.ext.util.toHtml import net.lucode.hackware.magicindicator.MagicIndicator import net.lucode.hackware.magicindicator.buildins.UIUtil @@ -70,18 +76,43 @@ fun BannerViewPager<*, *>.setPageListener(onPageSelected: (Int) -> Unit) { }) } + fun LoadService<*>.setErrorText(message: String) { - this.setCallBack(ErrorCallback::class.java) { _, view -> - view.findViewById(R.id.error_text).text = message + if (message.isNotEmpty()) { + this.setCallBack(ErrorCallback::class.java) { _, view -> + view.findViewById(R.id.error_text).text = message + } } } -fun LoadServiceInit(view: View, callback: () -> Unit): LoadService { +/** + * 设置错误布局 + * @param message 错误布局显示的提示内容 + */ +fun LoadService<*>.showError(message: String = "") { + this.setErrorText(message) + this.showCallback(ErrorCallback::class.java) +} + +/** + * 设置空布局 + */ +fun LoadService<*>.showEmpty() { + this.showCallback(EmptyCallback::class.java) +} + +/** + * 设置加载中 + */ +fun LoadService<*>.showLoading() { + this.showCallback(LoadingCallback::class.java) +} + +fun loadServiceInit(view: View, callback: () -> Unit): LoadService { val loadsir = LoadSir.getDefault().register(view) { //点击重试时触发的操作 callback.invoke() } - loadsir.showCallback(LoadingCallback::class.java) SettingUtil.setLoadingColor(SettingUtil.getColor(App.instance), loadsir) return loadsir } @@ -194,23 +225,25 @@ fun Toolbar.initClose( * 列如下面的BottomNavigationViewEx他的顶级父控件为FragmentLayout,如果先 is Fragmentlayout判断在 is BottomNavigationViewEx上面 * 那么就会直接去执行 is FragmentLayout的代码块 跳过 is BottomNavigationViewEx的代码块了 */ -fun setUiTheme(color: Int, vararg anylist: Any) { - anylist.forEach { - when (it) { - is LoadService<*> -> SettingUtil.setLoadingColor(color, it as LoadService) - is FloatingActionButton -> it.backgroundTintList = - SettingUtil.getOneColorStateList(color) - is SwipeRefreshLayout -> it.setColorSchemeColors(color) - is DefineLoadMoreView -> it.setLoadViewColor(SettingUtil.getOneColorStateList(color)) - is BottomNavigationViewEx -> { - it.itemIconTintList = SettingUtil.getColorStateList(color) - it.itemTextColor = SettingUtil.getColorStateList(color) +fun setUiTheme(color: Int, vararg anylist: Any?) { + anylist.forEach { view -> + view?.let { + when (it) { + is LoadService<*> -> SettingUtil.setLoadingColor(color, it as LoadService) + is FloatingActionButton -> it.backgroundTintList = + SettingUtil.getOneColorStateList(color) + is SwipeRefreshLayout -> it.setColorSchemeColors(color) + is DefineLoadMoreView -> it.setLoadViewColor(SettingUtil.getOneColorStateList(color)) + is BottomNavigationViewEx -> { + it.itemIconTintList = SettingUtil.getColorStateList(color) + it.itemTextColor = SettingUtil.getColorStateList(color) + } + is Toolbar -> it.setBackgroundColor(color) + is TextView -> it.setTextColor(color) + is LinearLayout -> it.setBackgroundColor(color) + is ConstraintLayout -> it.setBackgroundColor(color) + is FrameLayout -> it.setBackgroundColor(color) } - is Toolbar -> it.setBackgroundColor(color) - is TextView -> it.setTextColor(color) - is LinearLayout -> it.setBackgroundColor(color) - is ConstraintLayout -> it.setBackgroundColor(color) - is FrameLayout -> it.setBackgroundColor(color) } } } @@ -314,6 +347,54 @@ fun ViewPager2.init( return this } +fun ViewPager2.initMain(fragment: Fragment): ViewPager2 { + //是否可滑动 + this.isUserInputEnabled = false + this.offscreenPageLimit = 5 + //设置适配器 + adapter = object : FragmentStateAdapter(fragment) { + override fun createFragment(position: Int): Fragment { + when (position) { + 0 -> { + return HomeFragment() + } + 1 -> { + return ProjectFragment() + } + 2 -> { + return TreeArrFragment() + } + 3 -> { + return PublicNumberFragment() + } + 4 -> { + return MeFragment() + } + else -> { + return HomeFragment() + } + } + } + + override fun getItemCount() = 5 + } + return this +} + +fun BottomNavigationViewEx.init(navigationItemSelectedAction: (Int) -> Unit): BottomNavigationViewEx { + enableAnimation(false) + enableShiftingMode(false) + enableItemShiftingMode(false) + itemIconTintList = SettingUtil.getColorStateList(SettingUtil.getColor(Ktx.app)) + itemTextColor = SettingUtil.getColorStateList(Ktx.app) + setTextSize(12F) + setOnNavigationItemSelectedListener { + navigationItemSelectedAction.invoke(it.itemId) + true + } + return this +} + /** * 隐藏软键盘 */ @@ -331,48 +412,40 @@ fun hideSoftKeyboard(activity: Activity?) { } } -/** - * 防止重复点击事件 默认0.5秒内不可重复点击 跳转前做登录校验 - * @param interval 时间间隔 默认0.5秒 - * @param action 执行方法 - */ -var lastloginClickTime = 0L -fun View.clickNoRepeatLogin(interval: Long = 500, action: (view: View) -> Unit) { - setOnClickListener { - val currentTime = System.currentTimeMillis() - if (lastloginClickTime != 0L && (currentTime - lastloginClickTime < interval)) { - return@setOnClickListener - } - lastloginClickTime = currentTime - if (CacheUtil.isLogin()) { - action(it) - } else { - //注意一下,这里我是确定我所有的拦截登录都是在MainFragment中的,所以我可以写死,但是如果不在MainFragment中时跳转,你会报错 - nav(it).navigate(R.id.action_mainFragment_to_loginFragment) - } - } -} - -/** - * 防止重复点击事件 默认0.5秒内不可重复点击 跳转前做登录校验 - * @param view 触发的view集合 - * @param interval 时间间隔 默认0.5秒 - * @param action 执行方法 - */ -fun clickNoRepeatLogin(vararg view: View?, interval: Long = 500, action: (view: View) -> Unit) { - view.forEach {view1 -> - view1?.setOnClickListener { view2 -> - val currentTime = System.currentTimeMillis() - if (lastloginClickTime != 0L && (currentTime - lastloginClickTime < interval)) { - return@setOnClickListener +fun loadListData( + data: ListDataUiState, + baseQuickAdapter: BaseQuickAdapter, + loadService: LoadService<*>, + recyclerView: SwipeRecyclerView, + swipeRefreshLayout: SwipeRefreshLayout +) { + swipeRefreshLayout.isRefreshing = false + recyclerView.loadMoreFinish(data.isEmpty, data.hasMore) + if (data.isSuccess) { + //成功 + when { + //第一页并没有数据 显示空布局界面 + data.isFirstEmpty -> { + loadService.showEmpty() } - lastloginClickTime = currentTime - if (CacheUtil.isLogin()) { - action(view2) - } else { - //注意一下,这里我是确定我所有的拦截登录都是在MainFragment中的,所以我可以写死,但是如果不在MainFragment中时跳转,你会报错 - nav(view2).navigate(R.id.action_mainFragment_to_loginFragment) + //是第一页 + data.isRefresh -> { + loadService.showSuccess() + baseQuickAdapter.setNewInstance(data.listData) + } + //不是第一页 + else -> { + loadService.showSuccess() + baseQuickAdapter.addData(data.listData) } } + } else { + //失败 + if (data.isRefresh) { + //如果是第一页,则显示错误界面,并提示错误信息 + loadService.showError(data.errMessage) + } else { + recyclerView.loadMoreError(0, data.errMessage) + } } -} +} \ No newline at end of file diff --git a/app/src/main/java/me/hgj/jetpackmvvm/demo/app/network/MyHeadInterceptor.kt b/app/src/main/java/me/hgj/jetpackmvvm/demo/app/network/MyHeadInterceptor.kt new file mode 100644 index 0000000..ee7a8bb --- /dev/null +++ b/app/src/main/java/me/hgj/jetpackmvvm/demo/app/network/MyHeadInterceptor.kt @@ -0,0 +1,20 @@ +package me.hgj.jetpackmvvm.demo.app.network + +import okhttp3.Interceptor +import okhttp3.Response +import java.io.IOException + +/** + * 自定义头部参数拦截器,传入heads + */ +class MyHeadInterceptor : Interceptor { + + @Throws(IOException::class) + override fun intercept(chain: Interceptor.Chain): Response { + val builder = chain.request().newBuilder() + builder.addHeader("token", "token123456").build() + builder.addHeader("device", "Android").build() + return chain.proceed(builder.build()) + } + +} \ No newline at end of file diff --git a/app/src/main/java/me/hgj/jetpackmvvm/demo/app/network/NetworkApi.kt b/app/src/main/java/me/hgj/jetpackmvvm/demo/app/network/NetworkApi.kt index 065f474..7b78352 100644 --- a/app/src/main/java/me/hgj/jetpackmvvm/demo/app/network/NetworkApi.kt +++ b/app/src/main/java/me/hgj/jetpackmvvm/demo/app/network/NetworkApi.kt @@ -17,6 +17,7 @@ import retrofit2.Retrofit import retrofit2.converter.gson.GsonConverterFactory import java.io.File import java.util.concurrent.TimeUnit +import javax.net.ssl.HostnameVerifier /** * 作者 : hegaojian @@ -48,8 +49,8 @@ class NetworkApi : BaseNetworkApi() { cache(Cache(File(App.instance.cacheDir, "cxk_cache"), 10 * 1024 * 1024)) //添加Cookies自动持久化 cookieJar(cookieJar) - //添加公共heads 注意要设置在日志拦截器之前,不然Log中会不显示head信息 - addInterceptor(HeadInterceptor(mapOf())) + //示例:添加公共heads 注意要设置在日志拦截器之前,不然Log中会不显示head信息 + addInterceptor(MyHeadInterceptor()) //添加缓存拦截器 可传入缓存天数,不传默认7天 addInterceptor(CacheInterceptor()) // 日志拦截器 diff --git a/app/src/main/java/me/hgj/jetpackmvvm/demo/app/network/stateCallback/UpdateUiState.kt b/app/src/main/java/me/hgj/jetpackmvvm/demo/app/network/stateCallback/UpdateUiState.kt index dc77442..41a949d 100644 --- a/app/src/main/java/me/hgj/jetpackmvvm/demo/app/network/stateCallback/UpdateUiState.kt +++ b/app/src/main/java/me/hgj/jetpackmvvm/demo/app/network/stateCallback/UpdateUiState.kt @@ -9,7 +9,7 @@ data class UpdateUiState( //请求是否成功 var isSuccess: Boolean = true, //操作的对象 - var data : T, + var data: T? = null, //请求失败的错误信息 var errorMsg: String = "" ) \ No newline at end of file diff --git a/app/src/main/java/me/hgj/jetpackmvvm/demo/app/weight/preference/PreferenceCategory.java b/app/src/main/java/me/hgj/jetpackmvvm/demo/app/weight/preference/PreferenceCategory.java index 6236fce..4bdde81 100644 --- a/app/src/main/java/me/hgj/jetpackmvvm/demo/app/weight/preference/PreferenceCategory.java +++ b/app/src/main/java/me/hgj/jetpackmvvm/demo/app/weight/preference/PreferenceCategory.java @@ -38,7 +38,9 @@ * 可以设置标题颜色 */ public class PreferenceCategory extends PreferenceGroup { - TextView titleView; + + TextView titleView; + public PreferenceCategory( Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { super(context, attrs, defStyleAttr, defStyleRes); @@ -89,7 +91,7 @@ public void onBindViewHolder(PreferenceViewHolder holder) { // Return if the attribute could not be resolved return; } - titleView = (TextView) holder.findViewById(android.R.id.title); + titleView = (TextView) holder.findViewById(android.R.id.title); if (titleView == null) { return; } @@ -105,8 +107,8 @@ public void onBindViewHolder(PreferenceViewHolder holder) { } } - public void setTitleColor(int color){ - if(titleView!=null){ + public void setTitleColor(int color) { + if (titleView != null) { titleView.setTextColor(color); } } @@ -129,7 +131,7 @@ public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfoCompat info) existingItemInfo.getRowSpan(), existingItemInfo.getColumnIndex(), existingItemInfo.getColumnSpan(), - true /* heading */, + true, existingItemInfo.isSelected()); info.setCollectionItemInfo(newItemInfo); } diff --git a/app/src/main/java/me/hgj/jetpackmvvm/demo/data/bindadapter/CustomBindAdapter.kt b/app/src/main/java/me/hgj/jetpackmvvm/demo/data/bindadapter/CustomBindAdapter.kt index f9be73c..3db0073 100644 --- a/app/src/main/java/me/hgj/jetpackmvvm/demo/data/bindadapter/CustomBindAdapter.kt +++ b/app/src/main/java/me/hgj/jetpackmvvm/demo/data/bindadapter/CustomBindAdapter.kt @@ -81,17 +81,4 @@ object CustomBindAdapter { }) } - /* @BindingAdapter(value = ["android:onClick"]) - fun setOnClick(view: View, clickListener: View.OnClickListener) { - val mHits = LongArray(2) - view.setOnClickListener { - System.arraycopy(mHits, 1, mHits, 0, mHits.size - 1); - mHits[mHits.size - 1] = SystemClock.uptimeMillis() - if (mHits[0] < (SystemClock.uptimeMillis() - 500)) { - clickListener.onClick(it) - } - } - }*/ - - } \ No newline at end of file diff --git a/app/src/main/java/me/hgj/jetpackmvvm/demo/data/model/bean/ApiResponse.kt b/app/src/main/java/me/hgj/jetpackmvvm/demo/data/model/bean/ApiResponse.kt index e87061e..12a808e 100644 --- a/app/src/main/java/me/hgj/jetpackmvvm/demo/data/model/bean/ApiResponse.kt +++ b/app/src/main/java/me/hgj/jetpackmvvm/demo/data/model/bean/ApiResponse.kt @@ -20,7 +20,7 @@ data class ApiResponse(var errorCode: Int, var errorMsg: String, var data: T) override fun getResponseCode() = errorCode - override fun getResponseData() =data + override fun getResponseData() = data override fun getResponseMsg() = errorMsg diff --git a/app/src/main/java/me/hgj/jetpackmvvm/demo/data/model/bean/ApiResponseTest.kt b/app/src/main/java/me/hgj/jetpackmvvm/demo/data/model/bean/ApiResponseTest.kt new file mode 100644 index 0000000..9ff3f0d --- /dev/null +++ b/app/src/main/java/me/hgj/jetpackmvvm/demo/data/model/bean/ApiResponseTest.kt @@ -0,0 +1,27 @@ +package me.hgj.jetpackmvvm.demo.data.model.bean + +import me.hgj.jetpackmvvm.network.BaseResponse + +/** + * 作者 : hegaojian + * 时间 : 2019/12/23 + * 描述 :服务器返回数据的基类 + * 如果你的项目中有基类,那美滋滋,可以继承BaseResponse,请求时框架可以帮你自动脱壳,自动判断是否请求成功,怎么做: + * 1.继承 BaseResponse + * 2.重写isSucces 方法,编写你的业务需求,根据自己的条件判断数据是否请求成功 + * 3.重写 getResponseCode、getResponseData、getResponseMsg方法,传入你的 code data msg + */ + + +data class ApiResponseTest(var errorCode: Int, var errorMsg: String, var data: T) : BaseResponse() { + + // 这里是示例,wanandroid 网站返回的 错误码为 0 就代表请求成功,请你根据自己的业务需求来改变 + override fun isSucces() = errorCode == 0 + + override fun getResponseCode() = errorCode + + override fun getResponseData() = data + + override fun getResponseMsg() = errorMsg + +} \ No newline at end of file diff --git a/app/src/main/java/me/hgj/jetpackmvvm/demo/data/model/bean/TodoResponse.kt b/app/src/main/java/me/hgj/jetpackmvvm/demo/data/model/bean/TodoResponse.kt index 6c43e93..5c91c53 100644 --- a/app/src/main/java/me/hgj/jetpackmvvm/demo/data/model/bean/TodoResponse.kt +++ b/app/src/main/java/me/hgj/jetpackmvvm/demo/data/model/bean/TodoResponse.kt @@ -4,29 +4,35 @@ import android.annotation.SuppressLint import android.os.Parcelable import kotlinx.android.parcel.Parcelize import me.hgj.jetpackmvvm.demo.app.util.DatetimeUtil +import java.util.* /** * 项目分类 */ @SuppressLint("ParcelCreator") @Parcelize -data class TodoResponse(var completeDate: Long, - var completeDateStr: String, - var content: String, - var date: Long, - var dateStr: String, - var id: Int, - var priority: Int, - var status: Int, - var title: String, - var type: Int, - var userId: Int) : Parcelable { +data class TodoResponse( + var completeDate: Long, + var completeDateStr: String, + var content: String, + var date: Long, + var dateStr: String, + var id: Int, + var priority: Int, + var status: Int, + var title: String, + var type: Int, + var userId: Int +) : Parcelable { fun isDone(): Boolean { //判断是否已完成或者已过期 return if (status == 1) { true } else { - date < DatetimeUtil.nows.time + DatetimeUtil.nows.time > DatetimeUtil.formatDate( + DatetimeUtil.DATE_PATTERN, + dateStr + ).time } } } diff --git a/app/src/main/java/me/hgj/jetpackmvvm/demo/data/repository/local/LocalDataManger.kt b/app/src/main/java/me/hgj/jetpackmvvm/demo/data/repository/local/LocalDataManger.kt index 27b6b01..bdd48db 100644 --- a/app/src/main/java/me/hgj/jetpackmvvm/demo/data/repository/local/LocalDataManger.kt +++ b/app/src/main/java/me/hgj/jetpackmvvm/demo/data/repository/local/LocalDataManger.kt @@ -5,7 +5,7 @@ import me.hgj.jetpackmvvm.demo.app.util.CacheUtil /** * 作者 : hegaojian * 时间 : 2020/5/4 - * 描述 :从本地获取的数据,可以从数据库,Sp等等中获取 + * 描述 :从本地获取的数据,可以从数据库,本地存储,Sp等等中获取 */ class LocalDataManger { @@ -16,7 +16,7 @@ class LocalDataManger { } /** - * 获取本地存储的搜索数据 + * 获取本地存储的历史搜索数据 */ fun getHistoryData(): ArrayList { return CacheUtil.getSearchHistoryData() diff --git a/app/src/main/java/me/hgj/jetpackmvvm/demo/ui/activity/MainActivity.kt b/app/src/main/java/me/hgj/jetpackmvvm/demo/ui/activity/MainActivity.kt index 4ae1e21..1483014 100644 --- a/app/src/main/java/me/hgj/jetpackmvvm/demo/ui/activity/MainActivity.kt +++ b/app/src/main/java/me/hgj/jetpackmvvm/demo/ui/activity/MainActivity.kt @@ -52,4 +52,5 @@ class MainActivity : BaseActivity() { ToastUtils.showShort("没有网络") } } + } diff --git a/app/src/main/java/me/hgj/jetpackmvvm/demo/ui/activity/WelcomeActivity.kt b/app/src/main/java/me/hgj/jetpackmvvm/demo/ui/activity/WelcomeActivity.kt index 8011e51..4eb6d76 100644 --- a/app/src/main/java/me/hgj/jetpackmvvm/demo/ui/activity/WelcomeActivity.kt +++ b/app/src/main/java/me/hgj/jetpackmvvm/demo/ui/activity/WelcomeActivity.kt @@ -39,7 +39,7 @@ class WelcomeActivity : BaseActivity() { mDatabind.click = ProxyClick() welcome_baseview.setBackgroundColor(SettingUtil.getColor(this)) mViewPager = findViewById(R.id.banner_view) - if (shareViewModel.isFirst.value) { + if (CacheUtil.isFirst()) { //是第一次打开App 显示引导页 welcome_image.gone() mViewPager.setHolderCreator { @@ -67,7 +67,6 @@ class WelcomeActivity : BaseActivity() { inner class ProxyClick { fun toMain() { - shareViewModel.isFirst.postValue(false) CacheUtil.setFirst(false) startActivity(Intent(this@WelcomeActivity, MainActivity::class.java)) finish() diff --git a/app/src/main/java/me/hgj/jetpackmvvm/demo/ui/adapter/TodoAdapter.kt b/app/src/main/java/me/hgj/jetpackmvvm/demo/ui/adapter/TodoAdapter.kt index 8a4bb46..b706ba5 100644 --- a/app/src/main/java/me/hgj/jetpackmvvm/demo/ui/adapter/TodoAdapter.kt +++ b/app/src/main/java/me/hgj/jetpackmvvm/demo/ui/adapter/TodoAdapter.kt @@ -37,7 +37,7 @@ class TodoAdapter(data: ArrayList) : BaseQuickAdapter(R.id.item_todo_cardview).foreground = context.getDrawable(R.drawable.forground_shap) } else { - if (date < DatetimeUtil.nows.time) { + if (isDone()) { //未完成并且超过了预定完成时间 holder.setVisible(R.id.item_todo_status, true) holder.setImageResource(R.id.item_todo_status, R.drawable.ic_yiguoqi) diff --git a/app/src/main/java/me/hgj/jetpackmvvm/demo/ui/fragment/MainFragment.kt b/app/src/main/java/me/hgj/jetpackmvvm/demo/ui/fragment/MainFragment.kt index de8384f..950d304 100644 --- a/app/src/main/java/me/hgj/jetpackmvvm/demo/ui/fragment/MainFragment.kt +++ b/app/src/main/java/me/hgj/jetpackmvvm/demo/ui/fragment/MainFragment.kt @@ -1,20 +1,14 @@ package me.hgj.jetpackmvvm.demo.ui.fragment import android.os.Bundle -import androidx.fragment.app.Fragment import androidx.lifecycle.Observer import kotlinx.android.synthetic.main.fragment_main.* import me.hgj.jetpackmvvm.demo.R import me.hgj.jetpackmvvm.demo.app.base.BaseFragment import me.hgj.jetpackmvvm.demo.app.ext.init +import me.hgj.jetpackmvvm.demo.app.ext.initMain import me.hgj.jetpackmvvm.demo.app.ext.setUiTheme -import me.hgj.jetpackmvvm.demo.app.util.SettingUtil import me.hgj.jetpackmvvm.demo.databinding.FragmentMainBinding -import me.hgj.jetpackmvvm.demo.ui.fragment.home.HomeFragment -import me.hgj.jetpackmvvm.demo.ui.fragment.me.MeFragment -import me.hgj.jetpackmvvm.demo.ui.fragment.project.ProjectFragment -import me.hgj.jetpackmvvm.demo.ui.fragment.publicNumber.PublicNumberFragment -import me.hgj.jetpackmvvm.demo.ui.fragment.tree.TreeArrFragment import me.hgj.jetpackmvvm.demo.viewmodel.state.MainViewModel /** @@ -25,60 +19,27 @@ import me.hgj.jetpackmvvm.demo.viewmodel.state.MainViewModel @Suppress("DEPRECATION") class MainFragment : BaseFragment() { - var fragments = arrayListOf() - private val homeFragment: HomeFragment by lazy { HomeFragment() } - private val projectFragment: ProjectFragment by lazy { ProjectFragment() } - private val treeArrFragment: TreeArrFragment by lazy { TreeArrFragment() } - private val publicNumberFragment: PublicNumberFragment by lazy { PublicNumberFragment() } - private val meFragment: MeFragment by lazy { MeFragment() } - - init { - fragments.apply { - add(homeFragment) - add(projectFragment) - add(treeArrFragment) - add(publicNumberFragment) - add(meFragment) - } - } - override fun layoutId() = R.layout.fragment_main - override fun initView(savedInstanceState: Bundle?) { + override fun initView(savedInstanceState: Bundle?) { //初始化viewpager2 - main_viewpager.init(this,fragments,false).run { - offscreenPageLimit = fragments.size - } + mainViewpager.initMain(this) //初始化 bottombar - main_bottom.run { - enableAnimation(false) - enableShiftingMode(false) - enableItemShiftingMode(false) - shareViewModel.appColor.value.let { - itemIconTintList = SettingUtil.getColorStateList(it) - itemTextColor = SettingUtil.getColorStateList(it) - } - setTextSize(12F) - setOnNavigationItemSelectedListener { - when (it.itemId) { - R.id.menu_main -> main_viewpager.setCurrentItem(0, false) - R.id.menu_project -> main_viewpager.setCurrentItem(1, false) - R.id.menu_system -> main_viewpager.setCurrentItem(2, false) - R.id.menu_public -> main_viewpager.setCurrentItem(3, false) - R.id.menu_me -> main_viewpager.setCurrentItem(4, false) - } - true + mainBottom.init{ + when (it) { + R.id.menu_main -> mainViewpager.setCurrentItem(0, false) + R.id.menu_project -> mainViewpager.setCurrentItem(1, false) + R.id.menu_system -> mainViewpager.setCurrentItem(2, false) + R.id.menu_public -> mainViewpager.setCurrentItem(3, false) + R.id.menu_me -> mainViewpager.setCurrentItem(4, false) } } } - override fun lazyLoadData() { - - } - override fun createObserver() { shareViewModel.appColor.observe(viewLifecycleOwner, Observer { - setUiTheme(it, main_bottom) + setUiTheme(it, mainBottom) }) + } } \ No newline at end of file diff --git a/app/src/main/java/me/hgj/jetpackmvvm/demo/ui/fragment/collect/CollectAriticleFragment.kt b/app/src/main/java/me/hgj/jetpackmvvm/demo/ui/fragment/collect/CollectAriticleFragment.kt index 1701b39..e165221 100644 --- a/app/src/main/java/me/hgj/jetpackmvvm/demo/ui/fragment/collect/CollectAriticleFragment.kt +++ b/app/src/main/java/me/hgj/jetpackmvvm/demo/ui/fragment/collect/CollectAriticleFragment.kt @@ -14,10 +14,6 @@ import me.hgj.jetpackmvvm.demo.viewmodel.request.RequestCollectViewModel import me.hgj.jetpackmvvm.demo.app.base.BaseFragment import me.hgj.jetpackmvvm.demo.app.ext.* import me.hgj.jetpackmvvm.demo.app.weight.customview.CollectView -import me.hgj.jetpackmvvm.demo.app.weight.loadCallBack.EmptyCallback -import me.hgj.jetpackmvvm.demo.app.weight.loadCallBack.LoadingCallback -import me.hgj.jetpackmvvm.demo.app.weight.loadCallBack.ErrorCallback -import me.hgj.jetpackmvvm.demo.app.weight.recyclerview.DefineLoadMoreView import me.hgj.jetpackmvvm.demo.app.weight.recyclerview.SpaceItemDecoration import me.hgj.jetpackmvvm.demo.data.model.bean.CollectBus import me.hgj.jetpackmvvm.demo.data.model.bean.CollectResponse @@ -40,9 +36,9 @@ class CollectAriticleFragment : BaseFragment - nav().navigate(R.id.action_collectFragment_to_webFragment, Bundle().apply { + nav().navigate(R.id.action_to_webFragment, Bundle().apply { putParcelable("collect", articleAdapter.data[position]) }) } @@ -79,46 +75,19 @@ class CollectAriticleFragment : BaseFragment { - loadsir.showCallback(EmptyCallback::class.java) - } - //是第一页 - it.isRefresh -> { - loadsir.showSuccess() - articleAdapter.setNewInstance(it.listData) - } - //不是第一页 - else -> { - loadsir.showSuccess() - articleAdapter.addData(it.listData) - } - } - } else { - //失败 - if (it.isRefresh) { - //如果是第一页,则显示错误界面,并提示错误信息 - loadsir.setErrorText(it.errMessage) - loadsir.showCallback(ErrorCallback::class.java) - } else { - recyclerView.loadMoreError(0, it.errMessage) - } - } + //设值 新写了个拓展函数,搞死了这个恶心的重复代码 + loadListData(it, articleAdapter, loadsir, recyclerView,swipeRefresh) }) mViewModel.collectUiState.observe(viewLifecycleOwner, Observer { if (it.isSuccess) { //收藏或取消收藏操作成功,发送全局收藏消息 - eventViewModel.collect.postValue(CollectBus(it.id, it.collect)) + eventViewModel.collectEvent.postValue(CollectBus(it.id, it.collect)) } else { showMessage(it.errorMsg) for (index in articleAdapter.data.indices) { @@ -131,12 +100,12 @@ class CollectAriticleFragment : BaseFragment - nav().navigate(R.id.action_collectFragment_to_webFragment, Bundle().apply { - putParcelable("collectUrl", articleAdapter.data[position]) - }) + nav().navigate(R.id.action_to_webFragment, Bundle().apply { + putParcelable("collectUrl", articleAdapter.data[position]) + }) } } } override fun lazyLoadData() { + //设置界面 加载中 + loadsir.showLoading() mViewModel.getCollectUrlData() } @@ -86,7 +85,7 @@ class CollectUrlFragment : BaseFragment { - loadsir.showCallback(EmptyCallback::class.java) + loadsir.showEmpty() } else -> { loadsir.showSuccess() @@ -95,8 +94,7 @@ class CollectUrlFragment : BaseFragment() { - val requestViewModel: RequestDemoViewModel by lazy { getViewModel() } + val requestViewModel: RequestDemoViewModel by viewModels() override fun layoutId() = R.layout.fragment_demo @@ -18,13 +18,6 @@ class DemoFragment : BaseFragment() { } - override fun lazyLoadData() { - - } - - override fun createObserver() { - super.createObserver() - } inner class ProxClick { fun download() { requestViewModel.dowload() diff --git a/app/src/main/java/me/hgj/jetpackmvvm/demo/ui/fragment/home/HomeFragment.kt b/app/src/main/java/me/hgj/jetpackmvvm/demo/ui/fragment/home/HomeFragment.kt index 1c26f93..20c77bc 100644 --- a/app/src/main/java/me/hgj/jetpackmvvm/demo/ui/fragment/home/HomeFragment.kt +++ b/app/src/main/java/me/hgj/jetpackmvvm/demo/ui/fragment/home/HomeFragment.kt @@ -2,6 +2,7 @@ package me.hgj.jetpackmvvm.demo.ui.fragment.home import android.os.Bundle import android.view.LayoutInflater +import androidx.fragment.app.viewModels import androidx.lifecycle.Observer import androidx.recyclerview.widget.LinearLayoutManager import com.blankj.utilcode.util.ConvertUtils @@ -11,14 +12,13 @@ import com.zhpan.bannerview.BannerViewPager import kotlinx.android.synthetic.main.include_list.* import kotlinx.android.synthetic.main.include_recyclerview.* import kotlinx.android.synthetic.main.include_toolbar.* +import me.hgj.jetpackmvvm.callback.livedata.event.Event import me.hgj.jetpackmvvm.demo.R import me.hgj.jetpackmvvm.demo.app.base.BaseFragment import me.hgj.jetpackmvvm.demo.app.ext.* +import me.hgj.jetpackmvvm.demo.app.util.CacheUtil import me.hgj.jetpackmvvm.demo.app.weight.banner.HomeBannerViewHolder import me.hgj.jetpackmvvm.demo.app.weight.customview.CollectView -import me.hgj.jetpackmvvm.demo.app.weight.loadCallBack.EmptyCallback -import me.hgj.jetpackmvvm.demo.app.weight.loadCallBack.ErrorCallback -import me.hgj.jetpackmvvm.demo.app.weight.loadCallBack.LoadingCallback import me.hgj.jetpackmvvm.demo.app.weight.recyclerview.DefineLoadMoreView import me.hgj.jetpackmvvm.demo.app.weight.recyclerview.SpaceItemDecoration import me.hgj.jetpackmvvm.demo.data.model.bean.AriticleResponse @@ -29,7 +29,6 @@ import me.hgj.jetpackmvvm.demo.ui.adapter.AriticleAdapter import me.hgj.jetpackmvvm.demo.viewmodel.request.RequestCollectViewModel import me.hgj.jetpackmvvm.demo.viewmodel.request.RequestHomeViewModel import me.hgj.jetpackmvvm.demo.viewmodel.state.HomeViewModel -import me.hgj.jetpackmvvm.ext.getViewModel import me.hgj.jetpackmvvm.ext.nav import me.hgj.jetpackmvvm.ext.parseState @@ -39,6 +38,7 @@ import me.hgj.jetpackmvvm.ext.parseState * 描述 : */ class HomeFragment : BaseFragment() { + //适配器 private val articleAdapter: AriticleAdapter by lazy { AriticleAdapter(arrayListOf(), true) } @@ -48,19 +48,19 @@ class HomeFragment : BaseFragment() { //recyclerview的底部加载view 因为在首页要动态改变他的颜色,所以加了他这个字段 private lateinit var footView: DefineLoadMoreView - //收藏viewmodel 注意,在by lazy中使用getViewModel一定要使用泛型,虽然他提示不报错,但是你不写是不行的 - private val requestCollectViewModel: RequestCollectViewModel by lazy { getViewModel() } + //收藏viewmodel + private val requestCollectViewModel: RequestCollectViewModel by viewModels() - //请求数据ViewModel 注意,在by lazy中使用getViewModel一定要使用泛型,虽然他提示不报错,但是你不写是不行的 - private val requestHomeViewModel: RequestHomeViewModel by lazy { getViewModel() } + //请求数据ViewModel + private val requestHomeViewModel: RequestHomeViewModel by viewModels() override fun layoutId() = R.layout.fragment_home override fun initView(savedInstanceState: Bundle?) { //状态页配置 - loadsir = LoadServiceInit(swipeRefresh) { + loadsir = loadServiceInit(swipeRefresh) { //点击重试时触发的操作 - loadsir.showCallback(LoadingCallback::class.java) + loadsir.showLoading() requestHomeViewModel.getBannerData() requestHomeViewModel.getHomeData(true) } @@ -96,38 +96,29 @@ class HomeFragment : BaseFragment() { setOnCollectViewClickListener(object : AriticleAdapter.OnCollectViewClickListener { override fun onClick(item: AriticleResponse, v: CollectView, position: Int) { - if (shareViewModel.isLogin.value) { + if (CacheUtil.isLogin()) { if (v.isChecked) { requestCollectViewModel.uncollect(item.id) } else { requestCollectViewModel.collect(item.id) } - } else { v.isChecked = true - nav().navigate(R.id.action_mainFragment_to_loginFragment) + nav().navigate(R.id.action_to_loginFragment) } } }) setNbOnItemClickListener { adapter, view, position -> - nav().navigate(R.id.action_mainfragment_to_webFragment, Bundle().apply { - putParcelable( - "ariticleData", - articleAdapter.data[position - recyclerView.headerCount] - ) + nav().navigate(R.id.action_to_webFragment, Bundle().apply { + putParcelable("ariticleData",articleAdapter.data[position - recyclerView.headerCount]) }) } addChildClickViewIds(R.id.item_home_author, R.id.item_project_author) setNbOnItemChildClickListener { adapter, view, position -> when (view.id) { R.id.item_home_author, R.id.item_project_author -> { - nav().navigate( - R.id.action_mainfragment_to_lookInfoFragment, - Bundle().apply { - putInt( - "id", - articleAdapter.data[position - recyclerView.headerCount].userId - ) + nav().navigate(R.id.action_mainfragment_to_lookInfoFragment,Bundle().apply { + putInt("id",articleAdapter.data[position - recyclerView.headerCount].userId) }) } } @@ -140,7 +131,7 @@ class HomeFragment : BaseFragment() { */ override fun lazyLoadData() { //设置界面 加载中 - loadsir.showCallback(LoadingCallback::class.java) + loadsir.showLoading() //请求轮播图数据 requestHomeViewModel.getBannerData() //请求文章列表数据 @@ -151,36 +142,8 @@ class HomeFragment : BaseFragment() { requestHomeViewModel.run { //监听首页文章列表请求的数据变化 homeDataState.observe(viewLifecycleOwner, Observer { - swipeRefresh.isRefreshing = false - recyclerView.loadMoreFinish(it.isEmpty, it.hasMore) - if (it.isSuccess) { - //成功 - when { - //第一页并没有数据 显示空布局界面 - it.isFirstEmpty -> { - loadsir.showCallback(EmptyCallback::class.java) - } - //是第一页 - it.isRefresh -> { - loadsir.showSuccess() - articleAdapter.setNewInstance(it.listData) - } - //不是第一页 - else -> { - loadsir.showSuccess() - articleAdapter.addData(it.listData) - } - } - } else { - //失败 - if (it.isRefresh) { - //如果是第一页,则显示错误界面,并提示错误信息 - loadsir.setErrorText(it.errMessage) - loadsir.showCallback(ErrorCallback::class.java) - } else { - recyclerView.loadMoreError(0, it.errMessage) - } - } + //设值 新写了个拓展函数,搞死了这个恶心的重复代码 + loadListData(it, articleAdapter, loadsir, recyclerView,swipeRefresh) }) //监听轮播图请求的数据变化 bannerData.observe(viewLifecycleOwner, Observer { resultState -> @@ -188,16 +151,12 @@ class HomeFragment : BaseFragment() { //请求轮播图数据成功,添加轮播图到headview ,如果等于0说明没有添加过头部,添加一个 if (recyclerView.headerCount == 0) { val headview = - LayoutInflater.from(context).inflate(R.layout.include_banner, null) - .apply { - val bannerview = - findViewById>( - R.id.banner_view - ) + LayoutInflater.from(context).inflate(R.layout.include_banner, null).apply { + val bannerview =findViewById>(R.id.banner_view) bannerview.setHolderCreator { HomeBannerViewHolder() }.setOnPageClickListener { - nav().navigate(R.id.action_mainfragment_to_webFragment, + nav().navigate(R.id.action_to_webFragment, Bundle().apply { putParcelable("bannerdata", data[it]) } @@ -211,10 +170,11 @@ class HomeFragment : BaseFragment() { }) }) } + requestCollectViewModel.collectUiState.observe(viewLifecycleOwner, Observer { if (it.isSuccess) { //收藏或取消收藏操作成功,发送全局收藏消息 - eventViewModel.collect.postValue(CollectBus(it.id, it.collect)) + eventViewModel.collectEvent.postValue(Event(CollectBus(it.id, it.collect))) } else { showMessage(it.errorMsg) for (index in articleAdapter.data.indices) { @@ -254,7 +214,7 @@ class HomeFragment : BaseFragment() { articleAdapter.setAdapterAnimion(it) }) //监听全局的收藏信息 收藏的Id跟本列表的数据id匹配则需要更新 - eventViewModel.collect.observe(viewLifecycleOwner, Observer { + eventViewModel.collectEvent.observe(viewLifecycleOwner, Observer { for (index in articleAdapter.data.indices) { if (articleAdapter.data[index].id == it.id) { articleAdapter.data[index].collect = it.collect diff --git a/app/src/main/java/me/hgj/jetpackmvvm/demo/ui/fragment/integral/IntegralFragment.kt b/app/src/main/java/me/hgj/jetpackmvvm/demo/ui/fragment/integral/IntegralFragment.kt index 71a89ca..8b1b8c8 100644 --- a/app/src/main/java/me/hgj/jetpackmvvm/demo/ui/fragment/integral/IntegralFragment.kt +++ b/app/src/main/java/me/hgj/jetpackmvvm/demo/ui/fragment/integral/IntegralFragment.kt @@ -1,6 +1,7 @@ package me.hgj.jetpackmvvm.demo.ui.fragment.integral import android.os.Bundle +import androidx.fragment.app.viewModels import androidx.lifecycle.Observer import androidx.recyclerview.widget.LinearLayoutManager import com.blankj.utilcode.util.ConvertUtils @@ -13,9 +14,6 @@ import kotlinx.android.synthetic.main.include_toolbar.* import me.hgj.jetpackmvvm.demo.R import me.hgj.jetpackmvvm.demo.app.base.BaseFragment import me.hgj.jetpackmvvm.demo.app.ext.* -import me.hgj.jetpackmvvm.demo.app.weight.loadCallBack.EmptyCallback -import me.hgj.jetpackmvvm.demo.app.weight.loadCallBack.ErrorCallback -import me.hgj.jetpackmvvm.demo.app.weight.loadCallBack.LoadingCallback import me.hgj.jetpackmvvm.demo.app.weight.recyclerview.SpaceItemDecoration import me.hgj.jetpackmvvm.demo.data.model.bean.BannerResponse import me.hgj.jetpackmvvm.demo.data.model.bean.IntegralResponse @@ -23,7 +21,6 @@ import me.hgj.jetpackmvvm.demo.databinding.FragmentIntegralBinding import me.hgj.jetpackmvvm.demo.ui.adapter.IntegralAdapter import me.hgj.jetpackmvvm.demo.viewmodel.request.RequestIntegralViewModel import me.hgj.jetpackmvvm.demo.viewmodel.state.IntegralViewModel -import me.hgj.jetpackmvvm.ext.getViewModel import me.hgj.jetpackmvvm.ext.nav import me.hgj.jetpackmvvm.ext.util.notNull import me.hgj.jetpackmvvm.ext.view.gone @@ -42,8 +39,8 @@ class IntegralFragment : BaseFragment - //请求的ViewModel /** 注意,在by lazy中使用getViewModel一定要使用泛型,虽然他提示不报错,但是你不写是不行的 */ - private val requestIntegralViewModel: RequestIntegralViewModel by lazy { getViewModel() } + //请求的ViewModel /** */ + private val requestIntegralViewModel: RequestIntegralViewModel by viewModels() override fun layoutId() = R.layout.fragment_integral @@ -61,7 +58,7 @@ class IntegralFragment : BaseFragment { - nav().navigate(R.id.action_integralFragment_to_webFragment, + nav().navigate(R.id.action_to_webFragment, Bundle().apply { putParcelable( "bannerdata", @@ -84,9 +81,9 @@ class IntegralFragment : BaseFragment { - loadsir.showCallback(EmptyCallback::class.java) - } - //是第一页 - it.isRefresh -> { - loadsir.showSuccess() - integralAdapter.setNewInstance(it.listData) - } - //不是第一页 - else -> { - loadsir.showSuccess() - integralAdapter.addData(it.listData) - } - } - } else { - //失败 - if (it.isRefresh) { - //如果是第一页,则显示错误界面,并提示错误信息 - loadsir.setErrorText(it.errMessage) - loadsir.showCallback(ErrorCallback::class.java) - } else { - recyclerView.loadMoreError(0, it.errMessage) - } - } + //设值 新写了个拓展函数,搞死了这个恶心的重复代码 + loadListData(it, integralAdapter, loadsir, recyclerView,swipeRefresh) }) } } \ No newline at end of file diff --git a/app/src/main/java/me/hgj/jetpackmvvm/demo/ui/fragment/integral/IntegralHistoryFragment.kt b/app/src/main/java/me/hgj/jetpackmvvm/demo/ui/fragment/integral/IntegralHistoryFragment.kt index 576a82d..90c9bc6 100644 --- a/app/src/main/java/me/hgj/jetpackmvvm/demo/ui/fragment/integral/IntegralHistoryFragment.kt +++ b/app/src/main/java/me/hgj/jetpackmvvm/demo/ui/fragment/integral/IntegralHistoryFragment.kt @@ -1,6 +1,7 @@ package me.hgj.jetpackmvvm.demo.ui.fragment.integral import android.os.Bundle +import androidx.fragment.app.viewModels import androidx.lifecycle.Observer import androidx.recyclerview.widget.LinearLayoutManager import com.blankj.utilcode.util.ConvertUtils @@ -12,15 +13,11 @@ import kotlinx.android.synthetic.main.include_toolbar.* import me.hgj.jetpackmvvm.demo.R import me.hgj.jetpackmvvm.demo.app.base.BaseFragment import me.hgj.jetpackmvvm.demo.app.ext.* -import me.hgj.jetpackmvvm.demo.app.weight.loadCallBack.EmptyCallback -import me.hgj.jetpackmvvm.demo.app.weight.loadCallBack.ErrorCallback -import me.hgj.jetpackmvvm.demo.app.weight.loadCallBack.LoadingCallback import me.hgj.jetpackmvvm.demo.app.weight.recyclerview.SpaceItemDecoration import me.hgj.jetpackmvvm.demo.databinding.FragmentListBinding import me.hgj.jetpackmvvm.demo.ui.adapter.IntegralHistoryAdapter import me.hgj.jetpackmvvm.demo.viewmodel.request.RequestIntegralViewModel import me.hgj.jetpackmvvm.demo.viewmodel.state.IntegralViewModel -import me.hgj.jetpackmvvm.ext.getViewModel import me.hgj.jetpackmvvm.ext.nav /** @@ -36,8 +33,8 @@ class IntegralHistoryFragment : BaseFragment - //请求的ViewModel /** 注意,在by lazy中使用getViewModel一定要使用泛型,虽然他提示不报错,但是你不写是不行的 */ - private val requestIntegralViewModel: RequestIntegralViewModel by lazy { getViewModel() } + //请求的ViewModel /** */ + private val requestIntegralViewModel: RequestIntegralViewModel by viewModels() override fun layoutId() = R.layout.fragment_list @@ -46,9 +43,9 @@ class IntegralHistoryFragment : BaseFragment { - loadsir.showCallback(EmptyCallback::class.java) - } - //是第一页 - it.isRefresh -> { - loadsir.showSuccess() - integralAdapter.setNewInstance(it.listData) - } - //不是第一页 - else -> { - loadsir.showSuccess() - integralAdapter.addData(it.listData) - } - } - } else { - //失败 - if (it.isRefresh) { - //如果是第一页,则显示错误界面,并提示错误信息 - loadsir.setErrorText(it.errMessage) - loadsir.showCallback(ErrorCallback::class.java) - } else { - recyclerView.loadMoreError(0, it.errMessage) - } - } + //设值 新写了个拓展函数,搞死了这个恶心的重复代码 + loadListData(it, integralAdapter, loadsir, recyclerView,swipeRefresh) }) } } \ No newline at end of file diff --git a/app/src/main/java/me/hgj/jetpackmvvm/demo/ui/fragment/login/LoginFragment.kt b/app/src/main/java/me/hgj/jetpackmvvm/demo/ui/fragment/login/LoginFragment.kt index 2e4254b..3a69a06 100644 --- a/app/src/main/java/me/hgj/jetpackmvvm/demo/ui/fragment/login/LoginFragment.kt +++ b/app/src/main/java/me/hgj/jetpackmvvm/demo/ui/fragment/login/LoginFragment.kt @@ -2,6 +2,7 @@ package me.hgj.jetpackmvvm.demo.ui.fragment.login import android.os.Bundle import android.widget.CompoundButton +import androidx.fragment.app.viewModels import androidx.lifecycle.Observer import kotlinx.android.synthetic.main.fragment_login.* import kotlinx.android.synthetic.main.include_toolbar.* @@ -15,11 +16,8 @@ import me.hgj.jetpackmvvm.demo.app.util.SettingUtil import me.hgj.jetpackmvvm.demo.databinding.FragmentLoginBinding import me.hgj.jetpackmvvm.demo.viewmodel.request.RequestLoginRegisterViewModel import me.hgj.jetpackmvvm.demo.viewmodel.state.LoginRegisterViewModel -import me.hgj.jetpackmvvm.ext.getViewModel import me.hgj.jetpackmvvm.ext.nav import me.hgj.jetpackmvvm.ext.parseState -import me.hgj.jetpackmvvm.ext.util.logd -import me.hgj.jetpackmvvm.ext.util.toJson /** * 作者 : hegaojian @@ -28,8 +26,9 @@ import me.hgj.jetpackmvvm.ext.util.toJson */ class LoginFragment : BaseFragment() { - /** 注意,在by lazy中使用getViewModel一定要使用泛型,虽然他提示不报错,但是你不写是不行的 */ - private val requestLoginRegisterViewModel: RequestLoginRegisterViewModel by lazy { getViewModel() } + /** */ + private val requestLoginRegisterViewModel: RequestLoginRegisterViewModel by viewModels() + override fun layoutId() = R.layout.fragment_login @@ -50,14 +49,11 @@ class LoginFragment : BaseFragment } override fun createObserver() { - //监听请求结果 - requestLoginRegisterViewModel.loginResult.observe( - viewLifecycleOwner, - Observer { resultState -> + requestLoginRegisterViewModel.loginResult.observe(viewLifecycleOwner,Observer { resultState -> parseState(resultState, { //登录成功 通知账户数据发生改变鸟 CacheUtil.setUser(it) - shareViewModel.isLogin.postValue(true) + CacheUtil.setIsLogin(true) shareViewModel.userinfo.postValue(it) nav().navigateUp() }, { @@ -67,9 +63,6 @@ class LoginFragment : BaseFragment }) } - override fun lazyLoadData() {} - - inner class ProxyClick { fun clear() { @@ -96,6 +89,5 @@ class LoginFragment : BaseFragment CompoundButton.OnCheckedChangeListener { buttonView, isChecked -> mViewModel.isShowPwd.postValue(isChecked) } - } } \ No newline at end of file diff --git a/app/src/main/java/me/hgj/jetpackmvvm/demo/ui/fragment/login/RegisterFrgment.kt b/app/src/main/java/me/hgj/jetpackmvvm/demo/ui/fragment/login/RegisterFrgment.kt index ceeb19f..4acbf29 100644 --- a/app/src/main/java/me/hgj/jetpackmvvm/demo/ui/fragment/login/RegisterFrgment.kt +++ b/app/src/main/java/me/hgj/jetpackmvvm/demo/ui/fragment/login/RegisterFrgment.kt @@ -2,6 +2,7 @@ package me.hgj.jetpackmvvm.demo.ui.fragment.login import android.os.Bundle import android.widget.CompoundButton +import androidx.fragment.app.viewModels import androidx.lifecycle.Observer import kotlinx.android.synthetic.main.fragment_register.* import kotlinx.android.synthetic.main.include_toolbar.* @@ -14,7 +15,6 @@ import me.hgj.jetpackmvvm.demo.app.util.SettingUtil import me.hgj.jetpackmvvm.demo.databinding.FragmentRegisterBinding import me.hgj.jetpackmvvm.demo.viewmodel.request.RequestLoginRegisterViewModel import me.hgj.jetpackmvvm.demo.viewmodel.state.LoginRegisterViewModel -import me.hgj.jetpackmvvm.ext.getViewModel import me.hgj.jetpackmvvm.ext.nav import me.hgj.jetpackmvvm.ext.parseState @@ -25,7 +25,7 @@ import me.hgj.jetpackmvvm.ext.parseState */ class RegisterFrgment : BaseFragment() { - private val requestLoginRegisterViewModel:RequestLoginRegisterViewModel by lazy { getViewModel()} + private val requestLoginRegisterViewModel:RequestLoginRegisterViewModel by viewModels() override fun layoutId() = R.layout.fragment_register @@ -47,7 +47,7 @@ class RegisterFrgment : BaseFragment parseState(resultState, { - shareViewModel.isLogin.postValue(true) + CacheUtil.setIsLogin(true) CacheUtil.setUser(it) shareViewModel.userinfo.postValue(it) nav().navigate(R.id.action_registerFrgment_to_mainFragment) @@ -57,7 +57,6 @@ class RegisterFrgment : BaseFragment() } + //收藏viewmodel + private val requestCollectViewModel: RequestCollectViewModel by viewModels() - //专门负责请求数据的Viewmodel 注意,在by lazy中使用getViewModel一定要使用泛型,虽然他提示不报错,但是你不写是不行的 - private val requestLookInfoViewModel: RequestLookInfoViewModel by lazy { getViewModel() } + //专门负责请求数据的Viewmodel + private val requestLookInfoViewModel: RequestLookInfoViewModel by viewModels() override fun layoutId() = R.layout.fragment_lookinfo @@ -63,8 +62,8 @@ class LookInfoFragment : BaseFragment - nav().navigate(R.id.action_lookInfoFragment_to_webFragment, Bundle().apply { + nav().navigate(R.id.action_to_webFragment, Bundle().apply { putParcelable( "ariticleData", articleAdapter.data[position - recyclerView.headerCount] @@ -105,6 +104,8 @@ class LookInfoFragment : BaseFragment { - loadsir.showCallback(EmptyCallback::class.java) - } - //是第一页 - it.isRefresh -> { - loadsir.showSuccess() - articleAdapter.setNewInstance(it.listData) - } - //不是第一页 - else -> { - loadsir.showSuccess() - articleAdapter.addData(it.listData) - } - } - } else { - //失败 - if (it.isRefresh) { - //如果是第一页,则显示错误界面,并提示错误信息 - loadsir.setErrorText(it.errMessage) - loadsir.showCallback(ErrorCallback::class.java) - } else { - recyclerView.loadMoreError(0, it.errMessage) - } - } + //设值 新写了个拓展函数,搞死了这个恶心的重复代码 + loadListData(it, articleAdapter, loadsir, recyclerView,swipeRefresh) }) requestCollectViewModel.collectUiState.observe(viewLifecycleOwner, Observer { if (it.isSuccess) { //收藏或取消收藏操作成功,发送全局收藏消息 - eventViewModel.collect.postValue( - CollectBus( - it.id, - it.collect - ) - ) + eventViewModel.collectEvent.postValue(Event(CollectBus(it.id, it.collect))) } else { showMessage(it.errorMsg) for (index in articleAdapter.data.indices) { @@ -185,7 +153,7 @@ class LookInfoFragment : BaseFragment() { private var rank: IntegralResponse? = null - /** 注意,在by lazy中使用getViewModel一定要使用泛型,虽然他提示不报错,但是你不写是不行的 */ - private val requestMeViewModel: RequestMeViewModel by lazy { getViewModel() } + /** */ + private val requestMeViewModel: RequestMeViewModel by viewModels() override fun layoutId() = R.layout.fragment_me @@ -52,7 +55,6 @@ class MeFragment : BaseFragment() { } override fun createObserver() { - requestMeViewModel.meData.observe(viewLifecycleOwner, Observer { resultState -> me_swipe.isRefreshing = false parseState(resultState, { @@ -68,7 +70,6 @@ class MeFragment : BaseFragment() { appColor.observe(viewLifecycleOwner, Observer { setUiTheme(it, me_linear, me_swipe, me_integral) }) - userinfo.observe(viewLifecycleOwner, Observer { it.notNull({ me_swipe.isRefreshing = true @@ -124,7 +125,7 @@ class MeFragment : BaseFragment() { /** 玩Android开源网站 */ fun about() { - nav().navigate(R.id.action_mainfragment_to_webFragment, Bundle().apply { + nav().navigate(R.id.action_to_webFragment, Bundle().apply { putParcelable( "bannerdata", BannerResponse( @@ -140,10 +141,11 @@ class MeFragment : BaseFragment() { joinQQGroup("9n4i5sHt4189d4DvbotKiCHy-5jZtD4D") } - /** 设置 */ + /** 设置*/ fun setting() { nav().navigate(R.id.action_mainfragment_to_settingFragment) } + /**demo*/ fun demo() { nav().navigate(R.id.action_mainfragment_to_demoFragment) diff --git a/app/src/main/java/me/hgj/jetpackmvvm/demo/ui/fragment/project/ProjectChildFragment.kt b/app/src/main/java/me/hgj/jetpackmvvm/demo/ui/fragment/project/ProjectChildFragment.kt index b2f564b..5f4aa46 100644 --- a/app/src/main/java/me/hgj/jetpackmvvm/demo/ui/fragment/project/ProjectChildFragment.kt +++ b/app/src/main/java/me/hgj/jetpackmvvm/demo/ui/fragment/project/ProjectChildFragment.kt @@ -1,6 +1,7 @@ package me.hgj.jetpackmvvm.demo.ui.fragment.project import android.os.Bundle +import androidx.fragment.app.viewModels import androidx.lifecycle.Observer import androidx.recyclerview.widget.LinearLayoutManager import com.blankj.utilcode.util.ConvertUtils @@ -8,13 +9,12 @@ import com.kingja.loadsir.core.LoadService import com.yanzhenjie.recyclerview.SwipeRecyclerView import kotlinx.android.synthetic.main.include_list.* import kotlinx.android.synthetic.main.include_recyclerview.* +import me.hgj.jetpackmvvm.callback.livedata.event.Event import me.hgj.jetpackmvvm.demo.R import me.hgj.jetpackmvvm.demo.app.base.BaseFragment import me.hgj.jetpackmvvm.demo.app.ext.* +import me.hgj.jetpackmvvm.demo.app.util.CacheUtil import me.hgj.jetpackmvvm.demo.app.weight.customview.CollectView -import me.hgj.jetpackmvvm.demo.app.weight.loadCallBack.EmptyCallback -import me.hgj.jetpackmvvm.demo.app.weight.loadCallBack.ErrorCallback -import me.hgj.jetpackmvvm.demo.app.weight.loadCallBack.LoadingCallback import me.hgj.jetpackmvvm.demo.app.weight.recyclerview.DefineLoadMoreView import me.hgj.jetpackmvvm.demo.app.weight.recyclerview.SpaceItemDecoration import me.hgj.jetpackmvvm.demo.data.model.bean.AriticleResponse @@ -24,7 +24,6 @@ import me.hgj.jetpackmvvm.demo.ui.adapter.AriticleAdapter import me.hgj.jetpackmvvm.demo.viewmodel.request.RequestCollectViewModel import me.hgj.jetpackmvvm.demo.viewmodel.request.RequestProjectViewModel import me.hgj.jetpackmvvm.demo.viewmodel.state.ProjectViewModel -import me.hgj.jetpackmvvm.ext.getViewModel import me.hgj.jetpackmvvm.ext.nav /** @@ -49,11 +48,11 @@ class ProjectChildFragment : BaseFragment( //改项目对应的id private var cid = 0 - //收藏viewmodel 注意,在by lazy中使用getViewModel一定要使用泛型,虽然他提示不报错,但是你不写是不行的 - private val requestCollectViewModel: RequestCollectViewModel by lazy { getViewModel() } + //收藏viewmodel + private val requestCollectViewModel: RequestCollectViewModel by viewModels() - //请求的ViewModel 注意,在by lazy中使用getViewModel一定要使用泛型,虽然他提示不报错,但是你不写是不行的 - private val requestProjectViewModel: RequestProjectViewModel by lazy { getViewModel() } + //请求的ViewModel + private val requestProjectViewModel: RequestProjectViewModel by viewModels() override fun layoutId() = R.layout.include_list @@ -62,13 +61,10 @@ class ProjectChildFragment : BaseFragment( isNew = it.getBoolean("isNew") cid = it.getInt("cid") } - } - - override fun lazyLoadData() { //状态页配置 - loadsir = LoadServiceInit(swipeRefresh) { + loadsir = loadServiceInit(swipeRefresh) { //点击重试时触发的操作 - loadsir.showCallback(LoadingCallback::class.java) + loadsir.showLoading() requestProjectViewModel.getProjectData(true, cid, isNew) } //初始化recyclerView @@ -91,7 +87,7 @@ class ProjectChildFragment : BaseFragment( setOnCollectViewClickListener(object : AriticleAdapter.OnCollectViewClickListener { override fun onClick(item: AriticleResponse, v: CollectView, position: Int) { - if (shareViewModel.isLogin.value) { + if (CacheUtil.isLogin()) { if (v.isChecked) { requestCollectViewModel.uncollect(item.id) } else { @@ -99,12 +95,12 @@ class ProjectChildFragment : BaseFragment( } } else { v.isChecked = true - nav().navigate(R.id.action_mainFragment_to_loginFragment) + nav().navigate(R.id.action_to_loginFragment) } } }) setNbOnItemClickListener { adapter, view, position -> - nav().navigate(R.id.action_mainfragment_to_webFragment, Bundle().apply { + nav().navigate(R.id.action_to_webFragment, Bundle().apply { putParcelable("ariticleData", articleAdapter.data[position]) }) } @@ -121,50 +117,22 @@ class ProjectChildFragment : BaseFragment( } } } + + } + + override fun lazyLoadData() { + loadsir.showLoading() requestProjectViewModel.getProjectData(true, cid, isNew) } override fun createObserver() { requestProjectViewModel.projectDataState.observe(viewLifecycleOwner, Observer { - swipeRefresh.isRefreshing = false - recyclerView.loadMoreFinish(it.isEmpty, it.hasMore) - if (it.isSuccess) { - //成功 - when { - //第一页并没有数据 显示空布局界面 - it.isFirstEmpty -> { - loadsir.showCallback(EmptyCallback::class.java) - } - //是第一页 - it.isRefresh -> { - loadsir.showSuccess() - articleAdapter.setNewInstance(it.listData) - } - //不是第一页 - else -> { - loadsir.showSuccess() - articleAdapter.addData(it.listData) - } - } - } else { - //失败 - if (it.isRefresh) { - //如果是第一页,则显示错误界面,并提示错误信息 - loadsir.setErrorText(it.errMessage) - loadsir.showCallback(ErrorCallback::class.java) - } else { - recyclerView.loadMoreError(0, it.errMessage) - } - } + //设值 新写了个拓展函数,搞死了这个恶心的重复代码 + loadListData(it, articleAdapter, loadsir, recyclerView,swipeRefresh) }) requestCollectViewModel.collectUiState.observe(viewLifecycleOwner, Observer { if (it.isSuccess) { - eventViewModel.collect.postValue( - CollectBus( - it.id, - it.collect - ) - ) + eventViewModel.collectEvent.postValue(Event(CollectBus(it.id, it.collect))) } else { showMessage(it.errorMsg) for (index in articleAdapter.data.indices) { @@ -204,7 +172,7 @@ class ProjectChildFragment : BaseFragment( articleAdapter.setAdapterAnimion(it) }) //监听全局的收藏信息 收藏的Id跟本列表的数据id匹配则需要更新 - eventViewModel.collect.observe(viewLifecycleOwner, Observer { + eventViewModel.collectEvent.observe(viewLifecycleOwner, Observer { for (index in articleAdapter.data.indices) { if (articleAdapter.data[index].id == it.id) { articleAdapter.data[index].collect = it.collect diff --git a/app/src/main/java/me/hgj/jetpackmvvm/demo/ui/fragment/project/ProjectFragment.kt b/app/src/main/java/me/hgj/jetpackmvvm/demo/ui/fragment/project/ProjectFragment.kt index 68cd698..1a2e91d 100644 --- a/app/src/main/java/me/hgj/jetpackmvvm/demo/ui/fragment/project/ProjectFragment.kt +++ b/app/src/main/java/me/hgj/jetpackmvvm/demo/ui/fragment/project/ProjectFragment.kt @@ -2,6 +2,7 @@ package me.hgj.jetpackmvvm.demo.ui.fragment.project import android.os.Bundle import androidx.fragment.app.Fragment +import androidx.fragment.app.viewModels import androidx.lifecycle.Observer import com.kingja.loadsir.core.LoadService import kotlinx.android.synthetic.main.include_viewpager.* @@ -9,12 +10,10 @@ import me.hgj.jetpackmvvm.demo.R import me.hgj.jetpackmvvm.demo.app.base.BaseFragment import me.hgj.jetpackmvvm.demo.app.ext.* import me.hgj.jetpackmvvm.demo.app.weight.loadCallBack.ErrorCallback -import me.hgj.jetpackmvvm.demo.app.weight.loadCallBack.LoadingCallback import me.hgj.jetpackmvvm.demo.data.model.bean.ClassifyResponse import me.hgj.jetpackmvvm.demo.databinding.FragmentViewpagerBinding import me.hgj.jetpackmvvm.demo.viewmodel.request.RequestProjectViewModel import me.hgj.jetpackmvvm.demo.viewmodel.state.ProjectViewModel -import me.hgj.jetpackmvvm.ext.getViewModel import me.hgj.jetpackmvvm.ext.parseState /** @@ -33,16 +32,16 @@ class ProjectFragment : BaseFragment //标题集合 var mDataList: ArrayList = arrayListOf() - /** 注意,在by lazy中使用getViewModel一定要使用泛型,虽然他提示不报错,但是你不写是不行的 */ - private val requestProjectViewModel: RequestProjectViewModel by lazy { getViewModel() } + /** */ + private val requestProjectViewModel: RequestProjectViewModel by viewModels() override fun layoutId() = R.layout.fragment_viewpager override fun initView(savedInstanceState: Bundle?) { //状态页配置 - loadsir = LoadServiceInit(view_pager) { + loadsir = loadServiceInit(view_pager) { //点击重试时触发的操作 - loadsir.showCallback(LoadingCallback::class.java) + loadsir.showLoading() requestProjectViewModel.getProjectTitleData() } //初始化viewpager2 @@ -57,6 +56,8 @@ class ProjectFragment : BaseFragment * 懒加载 */ override fun lazyLoadData() { + //设置界面 加载中 + loadsir.showLoading() //请求标题数据 requestProjectViewModel.getProjectTitleData() } diff --git a/app/src/main/java/me/hgj/jetpackmvvm/demo/ui/fragment/publicNumber/PublicChildFragment.kt b/app/src/main/java/me/hgj/jetpackmvvm/demo/ui/fragment/publicNumber/PublicChildFragment.kt index f10d5c7..268a2c9 100644 --- a/app/src/main/java/me/hgj/jetpackmvvm/demo/ui/fragment/publicNumber/PublicChildFragment.kt +++ b/app/src/main/java/me/hgj/jetpackmvvm/demo/ui/fragment/publicNumber/PublicChildFragment.kt @@ -1,6 +1,7 @@ package me.hgj.jetpackmvvm.demo.ui.fragment.publicNumber import android.os.Bundle +import androidx.fragment.app.viewModels import androidx.lifecycle.Observer import androidx.recyclerview.widget.LinearLayoutManager import com.blankj.utilcode.util.ConvertUtils @@ -8,23 +9,21 @@ import com.kingja.loadsir.core.LoadService import com.yanzhenjie.recyclerview.SwipeRecyclerView import kotlinx.android.synthetic.main.include_list.* import kotlinx.android.synthetic.main.include_recyclerview.* +import me.hgj.jetpackmvvm.callback.livedata.event.Event import me.hgj.jetpackmvvm.demo.R import me.hgj.jetpackmvvm.demo.app.base.BaseFragment import me.hgj.jetpackmvvm.demo.app.ext.* +import me.hgj.jetpackmvvm.demo.app.util.CacheUtil import me.hgj.jetpackmvvm.demo.app.weight.customview.CollectView -import me.hgj.jetpackmvvm.demo.app.weight.loadCallBack.EmptyCallback -import me.hgj.jetpackmvvm.demo.app.weight.loadCallBack.ErrorCallback -import me.hgj.jetpackmvvm.demo.app.weight.loadCallBack.LoadingCallback import me.hgj.jetpackmvvm.demo.app.weight.recyclerview.DefineLoadMoreView import me.hgj.jetpackmvvm.demo.app.weight.recyclerview.SpaceItemDecoration import me.hgj.jetpackmvvm.demo.data.model.bean.AriticleResponse import me.hgj.jetpackmvvm.demo.data.model.bean.CollectBus import me.hgj.jetpackmvvm.demo.databinding.IncludeListBinding import me.hgj.jetpackmvvm.demo.ui.adapter.AriticleAdapter -import me.hgj.jetpackmvvm.demo.viewmodel.request.RequestPublicNumberViewModel import me.hgj.jetpackmvvm.demo.viewmodel.request.RequestCollectViewModel +import me.hgj.jetpackmvvm.demo.viewmodel.request.RequestPublicNumberViewModel import me.hgj.jetpackmvvm.demo.viewmodel.state.PublicNumberViewModel -import me.hgj.jetpackmvvm.ext.getViewModel import me.hgj.jetpackmvvm.ext.nav /** @@ -46,10 +45,11 @@ class PublicChildFragment : BaseFragment() } + //收藏viewmodel + private val requestCollectViewModel: RequestCollectViewModel by viewModels() + //请求viewmodel - private val requestPublicNumberViewModel: RequestPublicNumberViewModel by lazy { getViewModel() } + private val requestPublicNumberViewModel: RequestPublicNumberViewModel by viewModels() override fun layoutId() = R.layout.include_list @@ -57,13 +57,10 @@ class PublicChildFragment : BaseFragment - nav().navigate(R.id.action_mainfragment_to_webFragment, Bundle().apply { + nav().navigate(R.id.action_to_webFragment, Bundle().apply { putParcelable("ariticleData", articleAdapter.data[position]) }) } @@ -117,49 +114,22 @@ class PublicChildFragment : BaseFragment { - loadsir.showCallback(EmptyCallback::class.java) - } - //是第一页 - it.isRefresh -> { - loadsir.showSuccess() - articleAdapter.setNewInstance(it.listData) - } - //不是第一页 - else -> { - loadsir.showSuccess() - articleAdapter.addData(it.listData) - } - } - } else { - //失败 - if (it.isRefresh) { - //如果是第一页,则显示错误界面,并提示错误信息 - loadsir.setErrorText(it.errMessage) - loadsir.showCallback(ErrorCallback::class.java) - } else { - recyclerView.loadMoreError(0, it.errMessage) - } - } + //设值 新写了个拓展函数,搞死了这个恶心的重复代码 + loadListData(it, articleAdapter, loadsir, recyclerView, swipeRefresh) }) requestCollectViewModel.collectUiState.observe(viewLifecycleOwner, Observer { if (it.isSuccess) { - eventViewModel.collect.postValue( - CollectBus( - it.id, - it.collect - ) + eventViewModel.collectEvent.postValue( + Event(CollectBus(it.id, it.collect)) ) } else { showMessage(it.errorMsg) @@ -200,7 +170,7 @@ class PublicChildFragment : BaseFragment() { private val hotAdapter: SearcHotAdapter = SearcHotAdapter(arrayListOf()) - private val requestSearchViewModel: RequestSearchViewModel by lazy { getViewModel() } + private val requestSearchViewModel: RequestSearchViewModel by viewModels() override fun layoutId() = R.layout.fragment_search diff --git a/app/src/main/java/me/hgj/jetpackmvvm/demo/ui/fragment/search/SearchResultFragment.kt b/app/src/main/java/me/hgj/jetpackmvvm/demo/ui/fragment/search/SearchResultFragment.kt index 85b3d31..fb427d9 100644 --- a/app/src/main/java/me/hgj/jetpackmvvm/demo/ui/fragment/search/SearchResultFragment.kt +++ b/app/src/main/java/me/hgj/jetpackmvvm/demo/ui/fragment/search/SearchResultFragment.kt @@ -1,6 +1,7 @@ package me.hgj.jetpackmvvm.demo.ui.fragment.search import android.os.Bundle +import androidx.fragment.app.viewModels import androidx.lifecycle.Observer import androidx.recyclerview.widget.LinearLayoutManager import com.blankj.utilcode.util.ConvertUtils @@ -9,13 +10,13 @@ import com.yanzhenjie.recyclerview.SwipeRecyclerView import kotlinx.android.synthetic.main.include_list.* import kotlinx.android.synthetic.main.include_recyclerview.* import kotlinx.android.synthetic.main.include_toolbar.* +import me.hgj.jetpackmvvm.callback.livedata.event.Event import me.hgj.jetpackmvvm.demo.R import me.hgj.jetpackmvvm.demo.app.base.BaseFragment import me.hgj.jetpackmvvm.demo.app.ext.* +import me.hgj.jetpackmvvm.demo.app.util.CacheUtil import me.hgj.jetpackmvvm.demo.app.weight.customview.CollectView -import me.hgj.jetpackmvvm.demo.app.weight.loadCallBack.EmptyCallback import me.hgj.jetpackmvvm.demo.app.weight.loadCallBack.ErrorCallback -import me.hgj.jetpackmvvm.demo.app.weight.loadCallBack.LoadingCallback import me.hgj.jetpackmvvm.demo.app.weight.recyclerview.SpaceItemDecoration import me.hgj.jetpackmvvm.demo.data.model.bean.AriticleResponse import me.hgj.jetpackmvvm.demo.data.model.bean.CollectBus @@ -24,7 +25,6 @@ import me.hgj.jetpackmvvm.demo.ui.adapter.AriticleAdapter import me.hgj.jetpackmvvm.demo.viewmodel.request.RequestCollectViewModel import me.hgj.jetpackmvvm.demo.viewmodel.request.RequestSearchViewModel import me.hgj.jetpackmvvm.demo.viewmodel.state.SearchViewModel -import me.hgj.jetpackmvvm.ext.getViewModel import me.hgj.jetpackmvvm.ext.nav import me.hgj.jetpackmvvm.ext.parseState @@ -43,11 +43,11 @@ class SearchResultFragment : BaseFragment( //界面状态管理者 private lateinit var loadsir: LoadService - //收藏viewmodel 注意,在by lazy中使用getViewModel一定要使用泛型,虽然他提示不报错,但是你不写是不行的 - private val requestCollectViewModel: RequestCollectViewModel by lazy { getViewModel() } + //收藏viewmodel + private val requestCollectViewModel: RequestCollectViewModel by viewModels() - /** 注意,在by lazy中使用getViewModel一定要使用泛型,虽然他提示不报错,但是你不写是不行的 */ - private val requestSearchViewModel: RequestSearchViewModel by lazy { getViewModel() } + /** */ + private val requestSearchViewModel: RequestSearchViewModel by viewModels() override fun layoutId() = R.layout.fragment_list @@ -58,9 +58,9 @@ class SearchResultFragment : BaseFragment( nav().navigateUp() } //状态页配置 - loadsir = LoadServiceInit(swipeRefresh) { + loadsir = loadServiceInit(swipeRefresh) { //点击重试时触发的操作 - loadsir.showCallback(LoadingCallback::class.java) + loadsir.showLoading() requestSearchViewModel.getSearchResultData(searchKey, true) } @@ -84,7 +84,7 @@ class SearchResultFragment : BaseFragment( setOnCollectViewClickListener(object : AriticleAdapter.OnCollectViewClickListener { override fun onClick(item: AriticleResponse, v: CollectView, position: Int) { - if (shareViewModel.isLogin.value) { + if (CacheUtil.isLogin()) { if (v.isChecked) { requestCollectViewModel.uncollect(item.id) } else { @@ -92,12 +92,12 @@ class SearchResultFragment : BaseFragment( } } else { v.isChecked = true - nav().navigate(R.id.action_searchResultFragment_to_loginFragment) + nav().navigate(R.id.action_to_loginFragment) } } }) setNbOnItemClickListener { adapter, view, position -> - nav().navigate(R.id.action_searchResultFragment_to_webFragment, Bundle().apply { + nav().navigate(R.id.action_to_webFragment, Bundle().apply { putParcelable("ariticleData", articleAdapter.data[position]) }) } @@ -118,6 +118,8 @@ class SearchResultFragment : BaseFragment( } override fun lazyLoadData() { + //设置界面 加载中 + loadsir.showLoading() requestSearchViewModel.getSearchResultData(searchKey, true) } @@ -129,7 +131,7 @@ class SearchResultFragment : BaseFragment( requestSearchViewModel.pageNo++ if (it.isRefresh() && it.datas.size == 0) { //如果是第一页,并且没有数据,页面提示空布局 - loadsir.showCallback(EmptyCallback::class.java) + loadsir.showEmpty() } else if (it.isRefresh()) { //如果是刷新的,有数据 loadsir.showSuccess() @@ -154,7 +156,7 @@ class SearchResultFragment : BaseFragment( }) requestCollectViewModel.collectUiState.observe(viewLifecycleOwner, Observer { if (it.isSuccess) { - eventViewModel.collect.postValue(CollectBus(it.id, it.collect)) + eventViewModel.collectEvent.postValue(Event(CollectBus(it.id, it.collect))) } else { showMessage(it.errorMsg) for (index in articleAdapter.data.indices) { @@ -187,7 +189,7 @@ class SearchResultFragment : BaseFragment( }) //监听全局的收藏信息 收藏的Id跟本列表的数据id匹配则需要更新 - eventViewModel.collect.observe(viewLifecycleOwner, Observer { + eventViewModel.collectEvent.observe(viewLifecycleOwner, Observer { for (index in articleAdapter.data.indices) { if (articleAdapter.data[index].id == it.id) { articleAdapter.data[index].collect = it.collect diff --git a/app/src/main/java/me/hgj/jetpackmvvm/demo/ui/fragment/setting/SettingFragment.kt b/app/src/main/java/me/hgj/jetpackmvvm/demo/ui/fragment/setting/SettingFragment.kt index 200d74b..be1b2bf 100644 --- a/app/src/main/java/me/hgj/jetpackmvvm/demo/ui/fragment/setting/SettingFragment.kt +++ b/app/src/main/java/me/hgj/jetpackmvvm/demo/ui/fragment/setting/SettingFragment.kt @@ -18,7 +18,9 @@ import com.afollestad.materialdialogs.lifecycle.lifecycleOwner import com.afollestad.materialdialogs.list.listItemsSingleChoice import com.blankj.utilcode.util.AppUtils import com.tencent.bugly.beta.Beta +import kotlinx.android.synthetic.main.include_toolbar.* import me.hgj.jetpackmvvm.demo.R +import me.hgj.jetpackmvvm.demo.app.event.AppViewModel import me.hgj.jetpackmvvm.demo.app.ext.initClose import me.hgj.jetpackmvvm.demo.app.ext.showMessage import me.hgj.jetpackmvvm.demo.app.network.NetworkApi @@ -26,7 +28,6 @@ import me.hgj.jetpackmvvm.demo.app.util.CacheDataManager import me.hgj.jetpackmvvm.demo.app.util.CacheUtil import me.hgj.jetpackmvvm.demo.app.util.ColorUtil import me.hgj.jetpackmvvm.demo.app.util.SettingUtil -import me.hgj.jetpackmvvm.demo.app.event.AppViewModel import me.hgj.jetpackmvvm.demo.app.weight.preference.CheckBoxPreference import me.hgj.jetpackmvvm.demo.app.weight.preference.IconPreference import me.hgj.jetpackmvvm.demo.app.weight.preference.PreferenceCategory @@ -42,13 +43,13 @@ import me.hgj.jetpackmvvm.ext.nav class SettingFragment : PreferenceFragmentCompat(), SharedPreferences.OnSharedPreferenceChangeListener { - private var toolbar: Toolbar? = null - //这里不能继承BaseFragment了,所以手动获取一下 AppViewModel val shareViewModel: AppViewModel by lazy { getAppViewModel() } private var colorPreview: IconPreference? = null + var toolbarView: View? = null + override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) //这里重写根据PreferenceFragmentCompat 的布局 ,往他的根布局插入了一个toolbar @@ -57,14 +58,14 @@ class SettingFragment : PreferenceFragmentCompat(), //转为线性布局 val linearLayout = it.parent as? LinearLayout linearLayout?.run { - val toolbarView = - LayoutInflater.from(activity).inflate(R.layout.include_toolbar, null) - toolbar = toolbarView.findViewById(R.id.toolbar) - toolbar?.initClose("设置") { toolbar -> - nav().navigateUp() + toolbarView = LayoutInflater.from(activity).inflate(R.layout.include_toolbar, null) + toolbarView?.let {view -> + view.findViewById(R.id.toolbar)?.initClose("设置") { + nav().navigateUp() + } + //添加到第一个 + addView(toolbarView, 0) } - //添加到第一个 - addView(toolbarView, 0) } } @@ -75,7 +76,7 @@ class SettingFragment : PreferenceFragmentCompat(), colorPreview = findPreference("color") setText() - findPreference("exit")?.isVisible = shareViewModel.isLogin.value//未登录时,退出登录需要隐藏 + findPreference("exit")?.isVisible = CacheUtil.isLogin()//未登录时,退出登录需要隐藏 findPreference("exit")?.setOnPreferenceClickListener { preference -> showMessage( @@ -84,13 +85,11 @@ class SettingFragment : PreferenceFragmentCompat(), negativeButtonText = "取消", positiveAction = { //清空cookie - NetworkApi().cookieJar.clear() - shareViewModel.userinfo.postValue(null) + NetworkApi.instance.cookieJar.clear() CacheUtil.setUser(null) - shareViewModel.isLogin.postValue(false) - view?.let { - nav().navigateUp() - } + shareViewModel.userinfo.postValue(null) + nav().navigateUp() +// activity?.finish() }) false } @@ -153,7 +152,6 @@ class SettingFragment : PreferenceFragmentCompat(), findPreference("other")?.setTitleColor(color) findPreference("about")?.setTitleColor(color) findPreference("top")?.setBottonColor() - toolbar?.setBackgroundColor(color) //通知其他界面立马修改配置 shareViewModel.appColor.postValue(color) } @@ -197,15 +195,11 @@ class SettingFragment : PreferenceFragmentCompat(), url = findPreference("project")?.summary.toString() ) view?.let { - nav().navigate(R.id.action_settingFragment_to_webFragment, Bundle() + nav().navigate(R.id.action_to_webFragment, Bundle() .apply { putParcelable("bannerdata", data) }) } false } - /*findPreference("open")?.setOnPreferenceClickListener { - parentActivity.launchActivity(Intent(parentActivity, OpenProjectActivity::class.java)) - false - }*/ } /** diff --git a/app/src/main/java/me/hgj/jetpackmvvm/demo/ui/fragment/share/AddAriticleFragment.kt b/app/src/main/java/me/hgj/jetpackmvvm/demo/ui/fragment/share/AddAriticleFragment.kt index 687677f..24351ca 100644 --- a/app/src/main/java/me/hgj/jetpackmvvm/demo/ui/fragment/share/AddAriticleFragment.kt +++ b/app/src/main/java/me/hgj/jetpackmvvm/demo/ui/fragment/share/AddAriticleFragment.kt @@ -1,6 +1,7 @@ package me.hgj.jetpackmvvm.demo.ui.fragment.share import android.os.Bundle +import androidx.fragment.app.viewModels import androidx.lifecycle.Observer import com.afollestad.materialdialogs.MaterialDialog import com.afollestad.materialdialogs.WhichButton @@ -18,7 +19,6 @@ import me.hgj.jetpackmvvm.demo.app.util.SettingUtil import me.hgj.jetpackmvvm.demo.databinding.FragmentShareAriticleBinding import me.hgj.jetpackmvvm.demo.viewmodel.request.RequestAriticleViewModel import me.hgj.jetpackmvvm.demo.viewmodel.state.AriticleViewModel -import me.hgj.jetpackmvvm.ext.getViewModel import me.hgj.jetpackmvvm.ext.nav import me.hgj.jetpackmvvm.ext.parseState import me.hgj.jetpackmvvm.ext.view.clickNoRepeat @@ -30,8 +30,8 @@ import me.hgj.jetpackmvvm.ext.view.clickNoRepeat */ class AddAriticleFragment : BaseFragment() { - /** 注意,在by lazy中使用getViewModel一定要使用泛型,虽然他提示不报错,但是你不写是不行的 */ - private val requestViewModel: RequestAriticleViewModel by lazy { getViewModel() } + /** */ + private val requestViewModel: RequestAriticleViewModel by viewModels() override fun layoutId() = R.layout.fragment_share_ariticle @@ -100,14 +100,10 @@ class AddAriticleFragment : BaseFragment parseState(resultState, { - eventViewModel.shareArticle.postValue(true) + eventViewModel.shareArticleEvent.postValue(true) nav().navigateUp() }, { showMessage(it.errorMsg) diff --git a/app/src/main/java/me/hgj/jetpackmvvm/demo/ui/fragment/share/AriticleFragment.kt b/app/src/main/java/me/hgj/jetpackmvvm/demo/ui/fragment/share/AriticleFragment.kt index 5ac0179..d10a14f 100644 --- a/app/src/main/java/me/hgj/jetpackmvvm/demo/ui/fragment/share/AriticleFragment.kt +++ b/app/src/main/java/me/hgj/jetpackmvvm/demo/ui/fragment/share/AriticleFragment.kt @@ -1,6 +1,7 @@ package me.hgj.jetpackmvvm.demo.ui.fragment.share import android.os.Bundle +import androidx.fragment.app.viewModels import androidx.lifecycle.Observer import androidx.recyclerview.widget.LinearLayoutManager import com.blankj.utilcode.util.ConvertUtils @@ -12,15 +13,11 @@ import kotlinx.android.synthetic.main.include_toolbar.* import me.hgj.jetpackmvvm.demo.R import me.hgj.jetpackmvvm.demo.app.base.BaseFragment import me.hgj.jetpackmvvm.demo.app.ext.* -import me.hgj.jetpackmvvm.demo.app.weight.loadCallBack.EmptyCallback -import me.hgj.jetpackmvvm.demo.app.weight.loadCallBack.ErrorCallback -import me.hgj.jetpackmvvm.demo.app.weight.loadCallBack.LoadingCallback import me.hgj.jetpackmvvm.demo.app.weight.recyclerview.SpaceItemDecoration import me.hgj.jetpackmvvm.demo.databinding.FragmentListBinding import me.hgj.jetpackmvvm.demo.ui.adapter.ShareAdapter import me.hgj.jetpackmvvm.demo.viewmodel.request.RequestAriticleViewModel import me.hgj.jetpackmvvm.demo.viewmodel.state.AriticleViewModel -import me.hgj.jetpackmvvm.ext.getViewModel import me.hgj.jetpackmvvm.ext.nav /** @@ -37,7 +34,7 @@ class AriticleFragment : BaseFragment() private lateinit var loadsir: LoadService //记得要写泛型,虽然在 by lazy中 提示不用写,但是你不写就会报错 - private val requestViewModel: RequestAriticleViewModel by lazy { getViewModel() } + private val requestViewModel: RequestAriticleViewModel by viewModels() override fun layoutId() = R.layout.fragment_list @@ -57,9 +54,9 @@ class AriticleFragment : BaseFragment() } } //状态页配置 - loadsir = LoadServiceInit(swipeRefresh) { + loadsir = loadServiceInit(swipeRefresh) { //点击重试时触发的操作 - loadsir.showCallback(LoadingCallback::class.java) + loadsir.showLoading() requestViewModel.getShareData(true) } @@ -81,7 +78,7 @@ class AriticleFragment : BaseFragment() articleAdapter.run { setNbOnItemClickListener { adapter, view, position -> - nav().navigate(R.id.action_ariticleFragment_to_webFragment, Bundle().apply { + nav().navigate(R.id.action_to_webFragment, Bundle().apply { putParcelable("ariticleData", articleAdapter.data[position]) }) } @@ -102,58 +99,32 @@ class AriticleFragment : BaseFragment() } override fun lazyLoadData() { + //设置界面 加载中 + loadsir.showLoading() requestViewModel.getShareData(true) } override fun createObserver() { requestViewModel.shareDataState.observe(viewLifecycleOwner, Observer { - swipeRefresh.isRefreshing = false - recyclerView.loadMoreFinish(it.isEmpty, it.hasMore) - if (it.isSuccess) { - //成功 - when { - //第一页并没有数据 显示空布局界面 - it.isFirstEmpty -> { - loadsir.showCallback(EmptyCallback::class.java) - } - //是第一页 - it.isRefresh -> { - loadsir.showSuccess() - articleAdapter.setNewInstance(it.listData) - } - //不是第一页 - else -> { - loadsir.showSuccess() - articleAdapter.addData(it.listData) - } - } - } else { - //失败 - if (it.isRefresh) { - //如果是第一页,则显示错误界面,并提示错误信息 - loadsir.setErrorText(it.errMessage) - loadsir.showCallback(ErrorCallback::class.java) - } else { - recyclerView.loadMoreError(0, it.errMessage) - } - } + //设值 新写了个拓展函数,搞死了这个恶心的重复代码 + loadListData(it, articleAdapter, loadsir, recyclerView,swipeRefresh) }) requestViewModel.delDataState.observe(viewLifecycleOwner, Observer { if (it.isSuccess) { //删除成功 如果是删除的最后一个了,那么直接把界面设置为空布局 if (articleAdapter.data.size == 1) { - loadsir.showCallback(EmptyCallback::class.java) + loadsir.showEmpty() } - articleAdapter.remove(it.data) + articleAdapter.remove(it.data!!) } else { //删除失败,提示 showMessage(it.errorMsg) } }) - eventViewModel.shareArticle.observe(viewLifecycleOwner, Observer { + eventViewModel.shareArticleEvent.observe(viewLifecycleOwner, Observer { if (articleAdapter.data.size == 0) { //界面没有数据时,变为加载中 增强一丢丢体验 - loadsir.showCallback(LoadingCallback::class.java) + loadsir.showLoading() } else { //有数据时,swipeRefresh 显示刷新状态 swipeRefresh.isRefreshing = true diff --git a/app/src/main/java/me/hgj/jetpackmvvm/demo/ui/fragment/todo/AddTodoFragment.kt b/app/src/main/java/me/hgj/jetpackmvvm/demo/ui/fragment/todo/AddTodoFragment.kt index e81438c..360ed5b 100644 --- a/app/src/main/java/me/hgj/jetpackmvvm/demo/ui/fragment/todo/AddTodoFragment.kt +++ b/app/src/main/java/me/hgj/jetpackmvvm/demo/ui/fragment/todo/AddTodoFragment.kt @@ -1,6 +1,7 @@ package me.hgj.jetpackmvvm.demo.ui.fragment.todo import android.os.Bundle +import androidx.fragment.app.viewModels import androidx.lifecycle.Observer import com.afollestad.materialdialogs.MaterialDialog import com.afollestad.materialdialogs.datetime.datePicker @@ -19,7 +20,6 @@ import me.hgj.jetpackmvvm.demo.data.model.enums.TodoType import me.hgj.jetpackmvvm.demo.databinding.FragmentAddtodoBinding import me.hgj.jetpackmvvm.demo.viewmodel.request.RequestTodoViewModel import me.hgj.jetpackmvvm.demo.viewmodel.state.TodoViewModel -import me.hgj.jetpackmvvm.ext.getViewModel import me.hgj.jetpackmvvm.ext.nav import me.hgj.jetpackmvvm.ext.util.notNull import java.util.* @@ -33,8 +33,8 @@ class AddTodoFragment : BaseFragment() { private var todoResponse: TodoResponse? = null - //请求数据Viewmodel 注意,在by lazy中使用getViewModel一定要使用泛型,虽然他提示不报错,但是你不写是不行的 - private val requestViewModel: RequestTodoViewModel by lazy { getViewModel() } + //请求数据Viewmodel + private val requestViewModel: RequestTodoViewModel by viewModels() override fun layoutId() = R.layout.fragment_addtodo @@ -57,13 +57,11 @@ class AddTodoFragment : BaseFragment() { shareViewModel.appColor.value.let { SettingUtil.setShapColor(addtodoSubmit, it) } } - override fun lazyLoadData() {} - override fun createObserver() { requestViewModel.updateDataState.observe(viewLifecycleOwner, Observer { if (it.isSuccess) { nav().navigateUp() - eventViewModel.addTodo.postValue(true) + eventViewModel.todoEvent.postValue(true) } else { showMessage(it.errorMsg) } diff --git a/app/src/main/java/me/hgj/jetpackmvvm/demo/ui/fragment/todo/TodoListFragment.kt b/app/src/main/java/me/hgj/jetpackmvvm/demo/ui/fragment/todo/TodoListFragment.kt index 1eb0500..04d50d2 100644 --- a/app/src/main/java/me/hgj/jetpackmvvm/demo/ui/fragment/todo/TodoListFragment.kt +++ b/app/src/main/java/me/hgj/jetpackmvvm/demo/ui/fragment/todo/TodoListFragment.kt @@ -1,6 +1,7 @@ package me.hgj.jetpackmvvm.demo.ui.fragment.todo import android.os.Bundle +import androidx.fragment.app.viewModels import androidx.lifecycle.Observer import androidx.recyclerview.widget.LinearLayoutManager import com.afollestad.materialdialogs.MaterialDialog @@ -17,15 +18,11 @@ import kotlinx.android.synthetic.main.include_toolbar.* import me.hgj.jetpackmvvm.demo.R import me.hgj.jetpackmvvm.demo.app.base.BaseFragment import me.hgj.jetpackmvvm.demo.app.ext.* -import me.hgj.jetpackmvvm.demo.app.weight.loadCallBack.EmptyCallback -import me.hgj.jetpackmvvm.demo.app.weight.loadCallBack.ErrorCallback -import me.hgj.jetpackmvvm.demo.app.weight.loadCallBack.LoadingCallback import me.hgj.jetpackmvvm.demo.app.weight.recyclerview.SpaceItemDecoration import me.hgj.jetpackmvvm.demo.databinding.FragmentListBinding import me.hgj.jetpackmvvm.demo.ui.adapter.TodoAdapter import me.hgj.jetpackmvvm.demo.viewmodel.request.RequestTodoViewModel import me.hgj.jetpackmvvm.demo.viewmodel.state.TodoViewModel -import me.hgj.jetpackmvvm.ext.getViewModel import me.hgj.jetpackmvvm.ext.nav /** @@ -41,8 +38,8 @@ class TodoListFragment : BaseFragment() { //界面状态管理者 private lateinit var loadsir: LoadService - //请求数据Viewmodel 注意,在by lazy中使用getViewModel一定要使用泛型,虽然他提示不报错,但是你不写是不行的 - private val requestViewModel: RequestTodoViewModel by lazy { getViewModel() } + //请求数据Viewmodel + private val requestViewModel: RequestTodoViewModel by viewModels() override fun layoutId() = R.layout.fragment_list @@ -62,9 +59,9 @@ class TodoListFragment : BaseFragment() { } } //状态页配置 swipeRefresh参数表示你要包裹的布局 - loadsir = LoadServiceInit(swipeRefresh) { + loadsir = loadServiceInit(swipeRefresh) { //点击错误重试时触发的操作 - loadsir.showCallback(LoadingCallback::class.java) + loadsir.showLoading() //请求数据 requestViewModel.getTodoData(true) } @@ -143,48 +140,23 @@ class TodoListFragment : BaseFragment() { } override fun lazyLoadData() { + //设置界面 加载中 + loadsir.showLoading() requestViewModel.getTodoData(true) + } override fun createObserver() { requestViewModel.todoDataState.observe(viewLifecycleOwner, Observer { - swipeRefresh.isRefreshing = false - recyclerView.loadMoreFinish(it.isEmpty, it.hasMore) - if (it.isSuccess) { - //成功 - when { - //第一页并没有数据 显示空布局界面 - it.isFirstEmpty -> { - loadsir.showCallback(EmptyCallback::class.java) - } - //是第一页 - it.isRefresh -> { - loadsir.showSuccess() - articleAdapter.setNewInstance(it.listData) - } - //不是第一页 - else -> { - loadsir.showSuccess() - articleAdapter.addData(it.listData) - } - } - } else { - //失败 - if (it.isRefresh) { - //如果是第一页,则显示错误界面,并提示错误信息 - loadsir.setErrorText(it.errMessage) - loadsir.showCallback(ErrorCallback::class.java) - } else { - recyclerView.loadMoreError(0, it.errMessage) - } - } + //设值 新写了个拓展函数,搞死了这个恶心的重复代码 + loadListData(it, articleAdapter, loadsir, recyclerView,swipeRefresh) }) requestViewModel.delDataState.observe(viewLifecycleOwner, Observer { if (it.isSuccess) { if (articleAdapter.data.size == 1) { - loadsir.showCallback(EmptyCallback::class.java) + loadsir.showEmpty() } - articleAdapter.remove(it.data) + articleAdapter.remove(it.data!!) } else { showMessage(it.errorMsg) } @@ -197,16 +169,18 @@ class TodoListFragment : BaseFragment() { showMessage(it.errorMsg) } }) - eventViewModel.addTodo.observe(viewLifecycleOwner, Observer { + + eventViewModel.todoEvent.observe(viewLifecycleOwner, Observer { if (articleAdapter.data.size == 0) { //界面没有数据时,变为加载中 增强一丢丢体验 - loadsir.showCallback(LoadingCallback::class.java) + loadsir.showLoading() } else { //有数据时,swipeRefresh 显示刷新状态 swipeRefresh.isRefreshing = true } requestViewModel.getTodoData(true) }) + } } \ No newline at end of file diff --git a/app/src/main/java/me/hgj/jetpackmvvm/demo/ui/fragment/tree/AskFragment.kt b/app/src/main/java/me/hgj/jetpackmvvm/demo/ui/fragment/tree/AskFragment.kt index 92d87c4..8e572d7 100644 --- a/app/src/main/java/me/hgj/jetpackmvvm/demo/ui/fragment/tree/AskFragment.kt +++ b/app/src/main/java/me/hgj/jetpackmvvm/demo/ui/fragment/tree/AskFragment.kt @@ -1,6 +1,7 @@ package me.hgj.jetpackmvvm.demo.ui.fragment.tree import android.os.Bundle +import androidx.fragment.app.viewModels import androidx.lifecycle.Observer import androidx.recyclerview.widget.LinearLayoutManager import com.blankj.utilcode.util.ConvertUtils @@ -8,13 +9,12 @@ import com.kingja.loadsir.core.LoadService import com.yanzhenjie.recyclerview.SwipeRecyclerView import kotlinx.android.synthetic.main.include_list.* import kotlinx.android.synthetic.main.include_recyclerview.* +import me.hgj.jetpackmvvm.callback.livedata.event.Event import me.hgj.jetpackmvvm.demo.R import me.hgj.jetpackmvvm.demo.app.base.BaseFragment import me.hgj.jetpackmvvm.demo.app.ext.* +import me.hgj.jetpackmvvm.demo.app.util.CacheUtil import me.hgj.jetpackmvvm.demo.app.weight.customview.CollectView -import me.hgj.jetpackmvvm.demo.app.weight.loadCallBack.EmptyCallback -import me.hgj.jetpackmvvm.demo.app.weight.loadCallBack.ErrorCallback -import me.hgj.jetpackmvvm.demo.app.weight.loadCallBack.LoadingCallback import me.hgj.jetpackmvvm.demo.app.weight.recyclerview.DefineLoadMoreView import me.hgj.jetpackmvvm.demo.app.weight.recyclerview.SpaceItemDecoration import me.hgj.jetpackmvvm.demo.data.model.bean.AriticleResponse @@ -24,7 +24,6 @@ import me.hgj.jetpackmvvm.demo.ui.adapter.AriticleAdapter import me.hgj.jetpackmvvm.demo.viewmodel.request.RequestCollectViewModel import me.hgj.jetpackmvvm.demo.viewmodel.request.RequestTreeViewModel import me.hgj.jetpackmvvm.demo.viewmodel.state.TreeViewModel -import me.hgj.jetpackmvvm.ext.getViewModel import me.hgj.jetpackmvvm.ext.nav /** @@ -37,24 +36,29 @@ class AskFragment : BaseFragment() { //界面状态管理者 private lateinit var loadsir: LoadService - /** 注意,在by lazy中使用getViewModel一定要使用泛型,虽然他提示不报错,但是你不写是不行的 */ - private val requestTreeViewModel: RequestTreeViewModel by lazy { getViewModel() } + /** */ + private val requestTreeViewModel: RequestTreeViewModel by viewModels() //recyclerview的底部加载view 因为在首页要动态改变他的颜色,所以加了他这个字段 private lateinit var footView: DefineLoadMoreView - private val articleAdapter: AriticleAdapter by lazy { AriticleAdapter(arrayListOf(),showTag = true) } + private val articleAdapter: AriticleAdapter by lazy { + AriticleAdapter( + arrayListOf(), + showTag = true + ) + } //收藏viewmodel - private val requestCollectViewModel: RequestCollectViewModel by lazy { getViewModel() } + private val requestCollectViewModel: RequestCollectViewModel by viewModels() override fun layoutId() = R.layout.include_list override fun initView(savedInstanceState: Bundle?) { //状态页配置 - loadsir = LoadServiceInit(swipeRefresh) { + loadsir = loadServiceInit(swipeRefresh) { //点击重试时触发的操作 - loadsir.showCallback(LoadingCallback::class.java) + loadsir.showLoading() requestTreeViewModel.getAskData(true) } //初始化recyclerView @@ -75,7 +79,7 @@ class AskFragment : BaseFragment() { setOnCollectViewClickListener(object : AriticleAdapter.OnCollectViewClickListener { override fun onClick(item: AriticleResponse, v: CollectView, position: Int) { - if (shareViewModel.isLogin.value) { + if (CacheUtil.isLogin()) { if (v.isChecked) { requestCollectViewModel.uncollect(item.id) } else { @@ -83,12 +87,12 @@ class AskFragment : BaseFragment() { } } else { v.isChecked = true - nav().navigate(R.id.action_mainFragment_to_loginFragment) + nav().navigate(R.id.action_to_loginFragment) } } }) setNbOnItemClickListener { _, view, position -> - nav().navigate(R.id.action_mainfragment_to_webFragment, Bundle().apply { + nav().navigate(R.id.action_to_webFragment, Bundle().apply { putParcelable("ariticleData", articleAdapter.data[position]) }) } @@ -111,51 +115,20 @@ class AskFragment : BaseFragment() { } override fun lazyLoadData() { + //设置界面 加载中 + loadsir.showLoading() requestTreeViewModel.getAskData(true) } override fun createObserver() { requestTreeViewModel.askDataState.observe(viewLifecycleOwner, Observer { - swipeRefresh.isRefreshing = false - recyclerView.loadMoreFinish(it.isEmpty, it.hasMore) - if (it.isSuccess) { - //成功 - when { - //第一页并没有数据 显示空布局界面 - it.isFirstEmpty -> { - loadsir.showCallback(EmptyCallback::class.java) - } - //是第一页 - it.isRefresh -> { - loadsir.showSuccess() - articleAdapter.setNewInstance(it.listData) - } - //不是第一页 - else -> { - loadsir.showSuccess() - articleAdapter.addData(it.listData) - } - } - } else { - //失败 - if (it.isRefresh) { - //如果是第一页,则显示错误界面,并提示错误信息 - loadsir.setErrorText(it.errMessage) - loadsir.showCallback(ErrorCallback::class.java) - } else { - recyclerView.loadMoreError(0, it.errMessage) - } - } + //设值 新写了个拓展函数,搞死了这个恶心的重复代码 + loadListData(it, articleAdapter, loadsir, recyclerView,swipeRefresh) }) requestCollectViewModel.collectUiState.observe(viewLifecycleOwner, Observer { if (it.isSuccess) { //收藏或取消收藏操作成功,发送全局收藏消息 - eventViewModel.collect.postValue( - CollectBus( - it.id, - it.collect - ) - ) + eventViewModel.collectEvent.postValue(Event(CollectBus(it.id, it.collect))) } else { showMessage(it.errorMsg) for (index in articleAdapter.data.indices) { @@ -196,7 +169,7 @@ class AskFragment : BaseFragment() { }) } //监听全局的收藏信息 收藏的Id跟本列表的数据id匹配则需要更新 - eventViewModel.collect.observe(viewLifecycleOwner, Observer { + eventViewModel.collectEvent.observe(viewLifecycleOwner, Observer { for (index in articleAdapter.data.indices) { if (articleAdapter.data[index].id == it.id) { articleAdapter.data[index].collect = it.collect diff --git a/app/src/main/java/me/hgj/jetpackmvvm/demo/ui/fragment/tree/NavigationFragment.kt b/app/src/main/java/me/hgj/jetpackmvvm/demo/ui/fragment/tree/NavigationFragment.kt index ea4d9f8..930a094 100644 --- a/app/src/main/java/me/hgj/jetpackmvvm/demo/ui/fragment/tree/NavigationFragment.kt +++ b/app/src/main/java/me/hgj/jetpackmvvm/demo/ui/fragment/tree/NavigationFragment.kt @@ -2,6 +2,7 @@ package me.hgj.jetpackmvvm.demo.ui.fragment.tree import android.os.Bundle import android.view.View +import androidx.fragment.app.viewModels import androidx.lifecycle.Observer import androidx.recyclerview.widget.LinearLayoutManager import com.blankj.utilcode.util.ConvertUtils @@ -11,15 +12,12 @@ import kotlinx.android.synthetic.main.include_recyclerview.* import me.hgj.jetpackmvvm.demo.R import me.hgj.jetpackmvvm.demo.app.base.BaseFragment import me.hgj.jetpackmvvm.demo.app.ext.* -import me.hgj.jetpackmvvm.demo.app.weight.loadCallBack.ErrorCallback -import me.hgj.jetpackmvvm.demo.app.weight.loadCallBack.LoadingCallback import me.hgj.jetpackmvvm.demo.app.weight.recyclerview.SpaceItemDecoration import me.hgj.jetpackmvvm.demo.data.model.bean.AriticleResponse import me.hgj.jetpackmvvm.demo.databinding.IncludeListBinding import me.hgj.jetpackmvvm.demo.ui.adapter.NavigationAdapter import me.hgj.jetpackmvvm.demo.viewmodel.request.RequestTreeViewModel import me.hgj.jetpackmvvm.demo.viewmodel.state.TreeViewModel -import me.hgj.jetpackmvvm.ext.getViewModel import me.hgj.jetpackmvvm.ext.nav /** @@ -36,14 +34,14 @@ class NavigationFragment : BaseFragment() { private val navigationAdapter: NavigationAdapter by lazy { NavigationAdapter(arrayListOf()) } - /** 注意,在by lazy中使用getViewModel一定要使用泛型,虽然他提示不报错,但是你不写是不行的 */ - private val requestTreeViewModel: RequestTreeViewModel by lazy { getViewModel() } + /** */ + private val requestTreeViewModel: RequestTreeViewModel by viewModels() override fun initView(savedInstanceState: Bundle?) { //状态页配置 - loadsir = LoadServiceInit(swipeRefresh) { + loadsir = loadServiceInit(swipeRefresh) { //点击重试时触发的操作 - loadsir.showCallback(LoadingCallback::class.java) + loadsir.showLoading() requestTreeViewModel.getNavigationData() } //初始化recyclerView @@ -59,7 +57,7 @@ class NavigationFragment : BaseFragment() { navigationAdapter.setNavigationClickInterFace(object : NavigationAdapter.NavigationClickInterFace { override fun onNavigationClickListener(item: AriticleResponse, view: View) { - nav().navigate(R.id.action_mainfragment_to_webFragment, + nav().navigate(R.id.action_to_webFragment, Bundle().apply { putParcelable("ariticleData", item) } @@ -69,6 +67,8 @@ class NavigationFragment : BaseFragment() { } override fun lazyLoadData() { + //设置界面 加载中 + loadsir.showLoading() requestTreeViewModel.getNavigationData() } @@ -79,8 +79,7 @@ class NavigationFragment : BaseFragment() { loadsir.showSuccess() navigationAdapter.setNewInstance(it.listData) } else { - loadsir.setErrorText(it.errMessage) - loadsir.showCallback(ErrorCallback::class.java) + loadsir.showError(it.errMessage) } }) shareViewModel.run { diff --git a/app/src/main/java/me/hgj/jetpackmvvm/demo/ui/fragment/tree/PlazaFragment.kt b/app/src/main/java/me/hgj/jetpackmvvm/demo/ui/fragment/tree/PlazaFragment.kt index 55a361d..7c502be 100644 --- a/app/src/main/java/me/hgj/jetpackmvvm/demo/ui/fragment/tree/PlazaFragment.kt +++ b/app/src/main/java/me/hgj/jetpackmvvm/demo/ui/fragment/tree/PlazaFragment.kt @@ -1,6 +1,7 @@ package me.hgj.jetpackmvvm.demo.ui.fragment.tree import android.os.Bundle +import androidx.fragment.app.viewModels import androidx.lifecycle.Observer import androidx.recyclerview.widget.LinearLayoutManager import com.blankj.utilcode.util.ConvertUtils @@ -8,13 +9,12 @@ import com.kingja.loadsir.core.LoadService import com.yanzhenjie.recyclerview.SwipeRecyclerView import kotlinx.android.synthetic.main.include_list.* import kotlinx.android.synthetic.main.include_recyclerview.* +import me.hgj.jetpackmvvm.callback.livedata.event.Event import me.hgj.jetpackmvvm.demo.R import me.hgj.jetpackmvvm.demo.app.base.BaseFragment import me.hgj.jetpackmvvm.demo.app.ext.* +import me.hgj.jetpackmvvm.demo.app.util.CacheUtil import me.hgj.jetpackmvvm.demo.app.weight.customview.CollectView -import me.hgj.jetpackmvvm.demo.app.weight.loadCallBack.EmptyCallback -import me.hgj.jetpackmvvm.demo.app.weight.loadCallBack.ErrorCallback -import me.hgj.jetpackmvvm.demo.app.weight.loadCallBack.LoadingCallback import me.hgj.jetpackmvvm.demo.app.weight.recyclerview.DefineLoadMoreView import me.hgj.jetpackmvvm.demo.app.weight.recyclerview.SpaceItemDecoration import me.hgj.jetpackmvvm.demo.data.model.bean.AriticleResponse @@ -24,7 +24,6 @@ import me.hgj.jetpackmvvm.demo.ui.adapter.AriticleAdapter import me.hgj.jetpackmvvm.demo.viewmodel.request.RequestCollectViewModel import me.hgj.jetpackmvvm.demo.viewmodel.request.RequestTreeViewModel import me.hgj.jetpackmvvm.demo.viewmodel.state.TreeViewModel -import me.hgj.jetpackmvvm.ext.getViewModel import me.hgj.jetpackmvvm.ext.nav /** @@ -37,24 +36,26 @@ class PlazaFragment : BaseFragment() { //界面状态管理者 private lateinit var loadsir: LoadService - //收藏viewmodel 注意,在by lazy中使用getViewModel一定要使用泛型,虽然他提示不报错,但是你不写是不行的 - private val requestCollectViewModel:RequestCollectViewModel by lazy { getViewModel() } + //收藏viewmodel + private val requestCollectViewModel: RequestCollectViewModel by viewModels() - //请求Viewmodel 注意,在by lazy中使用getViewModel一定要使用泛型,虽然他提示不报错,但是你不写是不行的 - private val requestTreeViewModel: RequestTreeViewModel by lazy { getViewModel() } + //请求Viewmodel + private val requestTreeViewModel: RequestTreeViewModel by viewModels() //recyclerview的底部加载view 因为要在首页动态改变他的颜色,所以加了他这个字段 private lateinit var footView: DefineLoadMoreView - private val articleAdapter: AriticleAdapter by lazy { AriticleAdapter(arrayListOf(),showTag = true ) } + private val articleAdapter: AriticleAdapter by lazy { + AriticleAdapter(arrayListOf(), showTag = true) + } override fun layoutId() = R.layout.include_list override fun initView(savedInstanceState: Bundle?) { //状态页配置 - loadsir = LoadServiceInit(swipeRefresh) { + loadsir = loadServiceInit(swipeRefresh) { //点击重试时触发的操作 - loadsir.showCallback(LoadingCallback::class.java) + loadsir.showLoading() requestTreeViewModel.getPlazaData(true) } //初始化recyclerView @@ -75,7 +76,7 @@ class PlazaFragment : BaseFragment() { setOnCollectViewClickListener(object : AriticleAdapter.OnCollectViewClickListener { override fun onClick(item: AriticleResponse, v: CollectView, position: Int) { - if (shareViewModel.isLogin.value) { + if (CacheUtil.isLogin()) { if (v.isChecked) { requestCollectViewModel.uncollect(item.id) } else { @@ -83,12 +84,12 @@ class PlazaFragment : BaseFragment() { } } else { v.isChecked = true - nav().navigate(R.id.action_mainFragment_to_loginFragment) + nav().navigate(R.id.action_to_loginFragment) } } }) setNbOnItemClickListener { _, view, position -> - nav().navigate(R.id.action_mainfragment_to_webFragment, Bundle().apply { + nav().navigate(R.id.action_to_webFragment, Bundle().apply { putParcelable("ariticleData", articleAdapter.data[position]) }) } @@ -111,51 +112,20 @@ class PlazaFragment : BaseFragment() { } override fun lazyLoadData() { + //设置界面 加载中 + loadsir.showLoading() requestTreeViewModel.getPlazaData(true) } override fun createObserver() { requestTreeViewModel.plazaDataState.observe(viewLifecycleOwner, Observer { - swipeRefresh.isRefreshing = false - recyclerView.loadMoreFinish(it.isEmpty, it.hasMore) - if (it.isSuccess) { - //成功 - when { - //第一页并没有数据 显示空布局界面 - it.isFirstEmpty -> { - loadsir.showCallback(EmptyCallback::class.java) - } - //是第一页 - it.isRefresh -> { - loadsir.showSuccess() - articleAdapter.setNewInstance(it.listData) - } - //不是第一页 - else -> { - loadsir.showSuccess() - articleAdapter.addData(it.listData) - } - } - } else { - //失败 - if (it.isRefresh) { - //如果是第一页,则显示错误界面,并提示错误信息 - loadsir.setErrorText(it.errMessage) - loadsir.showCallback(ErrorCallback::class.java) - } else { - recyclerView.loadMoreError(0, it.errMessage) - } - } + //设值 新写了个拓展函数,搞死了这个恶心的重复代码 + loadListData(it, articleAdapter, loadsir, recyclerView,swipeRefresh) }) requestCollectViewModel.collectUiState.observe(viewLifecycleOwner, Observer { if (it.isSuccess) { //收藏或取消收藏操作成功,发送全局收藏消息 - eventViewModel.collect.postValue( - CollectBus( - it.id, - it.collect - ) - ) + eventViewModel.collectEvent.postValue(Event(CollectBus(it.id, it.collect))) } else { showMessage(it.errorMsg) for (index in articleAdapter.data.indices) { @@ -196,7 +166,7 @@ class PlazaFragment : BaseFragment() { }) } //监听全局的收藏信息 收藏的Id跟本列表的数据id匹配则需要更新 - eventViewModel.collect.observe(viewLifecycleOwner, Observer { + eventViewModel.collectEvent.observe(viewLifecycleOwner, Observer { for (index in articleAdapter.data.indices) { if (articleAdapter.data[index].id == it.id) { articleAdapter.data[index].collect = it.collect diff --git a/app/src/main/java/me/hgj/jetpackmvvm/demo/ui/fragment/tree/SystemChildFragment.kt b/app/src/main/java/me/hgj/jetpackmvvm/demo/ui/fragment/tree/SystemChildFragment.kt index b999c49..0a89bb9 100644 --- a/app/src/main/java/me/hgj/jetpackmvvm/demo/ui/fragment/tree/SystemChildFragment.kt +++ b/app/src/main/java/me/hgj/jetpackmvvm/demo/ui/fragment/tree/SystemChildFragment.kt @@ -1,6 +1,7 @@ package me.hgj.jetpackmvvm.demo.ui.fragment.tree import android.os.Bundle +import androidx.fragment.app.viewModels import androidx.lifecycle.Observer import androidx.recyclerview.widget.LinearLayoutManager import com.blankj.utilcode.util.ConvertUtils @@ -8,13 +9,12 @@ import com.kingja.loadsir.core.LoadService import com.yanzhenjie.recyclerview.SwipeRecyclerView import kotlinx.android.synthetic.main.include_list.* import kotlinx.android.synthetic.main.include_recyclerview.* +import me.hgj.jetpackmvvm.callback.livedata.event.Event import me.hgj.jetpackmvvm.demo.R import me.hgj.jetpackmvvm.demo.app.base.BaseFragment import me.hgj.jetpackmvvm.demo.app.ext.* +import me.hgj.jetpackmvvm.demo.app.util.CacheUtil import me.hgj.jetpackmvvm.demo.app.weight.customview.CollectView -import me.hgj.jetpackmvvm.demo.app.weight.loadCallBack.EmptyCallback -import me.hgj.jetpackmvvm.demo.app.weight.loadCallBack.ErrorCallback -import me.hgj.jetpackmvvm.demo.app.weight.loadCallBack.LoadingCallback import me.hgj.jetpackmvvm.demo.app.weight.recyclerview.DefineLoadMoreView import me.hgj.jetpackmvvm.demo.app.weight.recyclerview.SpaceItemDecoration import me.hgj.jetpackmvvm.demo.data.model.bean.AriticleResponse @@ -24,7 +24,6 @@ import me.hgj.jetpackmvvm.demo.ui.adapter.AriticleAdapter import me.hgj.jetpackmvvm.demo.viewmodel.request.RequestCollectViewModel import me.hgj.jetpackmvvm.demo.viewmodel.request.RequestTreeViewModel import me.hgj.jetpackmvvm.demo.viewmodel.state.TreeViewModel -import me.hgj.jetpackmvvm.ext.getViewModel import me.hgj.jetpackmvvm.ext.nav /** @@ -45,11 +44,11 @@ class SystemChildFragment : BaseFragment() { //适配器 private val articleAdapter: AriticleAdapter by lazy { AriticleAdapter(arrayListOf()) } - //收藏viewmodel 注意,在by lazy中使用getViewModel一定要使用泛型,虽然他提示不报错,但是你不写是不行的 - private val requestCollectViewModel: RequestCollectViewModel by lazy { getViewModel() } + //收藏viewmodel + private val requestCollectViewModel: RequestCollectViewModel by viewModels() - /** 注意,在by lazy中使用getViewModel一定要使用泛型,虽然他提示不报错,但是你不写是不行的 */ - private val requestTreeViewModel: RequestTreeViewModel by lazy { getViewModel() } + /** 请求Viewmodel */ + private val requestTreeViewModel: RequestTreeViewModel by viewModels() override fun layoutId() = R.layout.include_list @@ -58,9 +57,9 @@ class SystemChildFragment : BaseFragment() { cid = it.getInt("cid") } //状态页配置 - loadsir = LoadServiceInit(swipeRefresh) { + loadsir = loadServiceInit(swipeRefresh) { //点击重试时触发的操作 - loadsir.showCallback(LoadingCallback::class.java) + loadsir.showLoading() requestTreeViewModel.getSystemChildData(true, cid) } //初始化recyclerView @@ -81,7 +80,7 @@ class SystemChildFragment : BaseFragment() { setOnCollectViewClickListener(object : AriticleAdapter.OnCollectViewClickListener { override fun onClick(item: AriticleResponse, v: CollectView, position: Int) { - if (shareViewModel.isLogin.value) { + if (CacheUtil.isLogin()) { if (v.isChecked) { requestCollectViewModel.uncollect(item.id) } else { @@ -89,12 +88,12 @@ class SystemChildFragment : BaseFragment() { } } else { v.isChecked = true - nav().navigate(R.id.action_systemArrFragment_to_loginFragment) + nav().navigate(R.id.action_to_loginFragment) } } }) setNbOnItemClickListener { adapter, view, position -> - nav().navigate(R.id.action_systemArrFragment_to_webFragment, Bundle().apply { + nav().navigate(R.id.action_to_webFragment, Bundle().apply { putParcelable("ariticleData", articleAdapter.data[position]) }) } @@ -114,52 +113,21 @@ class SystemChildFragment : BaseFragment() { } override fun lazyLoadData() { + //设置界面 加载中 + loadsir.showLoading() requestTreeViewModel.getSystemChildData(true, cid) } override fun createObserver() { requestTreeViewModel.systemChildDataState.observe(viewLifecycleOwner, Observer { - swipeRefresh.isRefreshing = false - recyclerView.loadMoreFinish(it.isEmpty, it.hasMore) - if (it.isSuccess) { - //成功 - when { - //第一页并没有数据 显示空布局界面 - it.isFirstEmpty -> { - loadsir.showCallback(EmptyCallback::class.java) - } - //是第一页 - it.isRefresh -> { - loadsir.showSuccess() - articleAdapter.setNewInstance(it.listData) - } - //不是第一页 - else -> { - loadsir.showSuccess() - articleAdapter.addData(it.listData) - } - } - } else { - //失败 - if (it.isRefresh) { - //如果是第一页,则显示错误界面,并提示错误信息 - loadsir.setErrorText(it.errMessage) - loadsir.showCallback(ErrorCallback::class.java) - } else { - recyclerView.loadMoreError(0, it.errMessage) - } - } + //设值 新写了个拓展函数,搞死了这个恶心的重复代码 + loadListData(it, articleAdapter, loadsir, recyclerView,swipeRefresh) }) requestCollectViewModel.collectUiState.observe(viewLifecycleOwner, Observer { if (it.isSuccess) { //收藏或取消收藏操作成功,发送全局收藏消息 - eventViewModel.collect.postValue( - CollectBus( - it.id, - it.collect - ) - ) + eventViewModel.collectEvent.postValue(Event(CollectBus(it.id, it.collect))) } else { showMessage(it.errorMsg) for (index in articleAdapter.data.indices) { @@ -192,7 +160,7 @@ class SystemChildFragment : BaseFragment() { }) } //监听全局的收藏信息 收藏的Id跟本列表的数据id匹配则需要更新 - eventViewModel.collect.observe(viewLifecycleOwner, Observer { + eventViewModel.collectEvent.observe(viewLifecycleOwner, Observer { for (index in articleAdapter.data.indices) { if (articleAdapter.data[index].id == it.id) { articleAdapter.data[index].collect = it.collect diff --git a/app/src/main/java/me/hgj/jetpackmvvm/demo/ui/fragment/tree/SystemFragment.kt b/app/src/main/java/me/hgj/jetpackmvvm/demo/ui/fragment/tree/SystemFragment.kt index 4f28aee..75b07f1 100644 --- a/app/src/main/java/me/hgj/jetpackmvvm/demo/ui/fragment/tree/SystemFragment.kt +++ b/app/src/main/java/me/hgj/jetpackmvvm/demo/ui/fragment/tree/SystemFragment.kt @@ -1,6 +1,7 @@ package me.hgj.jetpackmvvm.demo.ui.fragment.tree import android.os.Bundle +import androidx.fragment.app.viewModels import androidx.lifecycle.Observer import androidx.recyclerview.widget.LinearLayoutManager import com.blankj.utilcode.util.ConvertUtils @@ -10,15 +11,12 @@ import kotlinx.android.synthetic.main.include_recyclerview.* import me.hgj.jetpackmvvm.demo.R import me.hgj.jetpackmvvm.demo.app.base.BaseFragment import me.hgj.jetpackmvvm.demo.app.ext.* -import me.hgj.jetpackmvvm.demo.app.weight.loadCallBack.ErrorCallback -import me.hgj.jetpackmvvm.demo.app.weight.loadCallBack.LoadingCallback import me.hgj.jetpackmvvm.demo.app.weight.recyclerview.SpaceItemDecoration import me.hgj.jetpackmvvm.demo.data.model.bean.SystemResponse import me.hgj.jetpackmvvm.demo.databinding.IncludeListBinding import me.hgj.jetpackmvvm.demo.ui.adapter.SystemAdapter import me.hgj.jetpackmvvm.demo.viewmodel.request.RequestTreeViewModel import me.hgj.jetpackmvvm.demo.viewmodel.state.TreeViewModel -import me.hgj.jetpackmvvm.ext.getViewModel import me.hgj.jetpackmvvm.ext.nav /** @@ -35,14 +33,14 @@ class SystemFragment : BaseFragment() { private val systemAdapter: SystemAdapter by lazy { SystemAdapter(arrayListOf()) } - /** 注意,在by lazy中使用getViewModel一定要使用泛型,虽然他提示不报错,但是你不写是不行的 */ - private val requestTreeViewModel:RequestTreeViewModel by lazy { getViewModel() } + /** */ + private val requestTreeViewModel:RequestTreeViewModel by viewModels() override fun initView(savedInstanceState: Bundle?) { //状态页配置 - loadsir = LoadServiceInit(swipeRefresh) { + loadsir = loadServiceInit(swipeRefresh) { //点击重试时触发的操作 - loadsir.showCallback(LoadingCallback::class.java) + loadsir.showLoading() requestTreeViewModel.getSystemData() } //初始化recyclerView @@ -75,6 +73,8 @@ class SystemFragment : BaseFragment() { } override fun lazyLoadData() { + //设置界面 加载中 + loadsir.showLoading() requestTreeViewModel.getSystemData() } @@ -85,8 +85,7 @@ class SystemFragment : BaseFragment() { loadsir.showSuccess() systemAdapter.setNewInstance(it.listData) } else { - loadsir.setErrorText(it.errMessage) - loadsir.showCallback(ErrorCallback::class.java) + loadsir.showError(it.errMessage) } }) diff --git a/app/src/main/java/me/hgj/jetpackmvvm/demo/ui/fragment/tree/TreeArrFragment.kt b/app/src/main/java/me/hgj/jetpackmvvm/demo/ui/fragment/tree/TreeArrFragment.kt index 248f286..0269557 100644 --- a/app/src/main/java/me/hgj/jetpackmvvm/demo/ui/fragment/tree/TreeArrFragment.kt +++ b/app/src/main/java/me/hgj/jetpackmvvm/demo/ui/fragment/tree/TreeArrFragment.kt @@ -9,6 +9,7 @@ import me.hgj.jetpackmvvm.demo.app.base.BaseFragment import me.hgj.jetpackmvvm.demo.app.ext.bindViewPager2 import me.hgj.jetpackmvvm.demo.app.ext.init import me.hgj.jetpackmvvm.demo.app.ext.setUiTheme +import me.hgj.jetpackmvvm.demo.app.util.CacheUtil import me.hgj.jetpackmvvm.demo.databinding.FragmentViewpagerBinding import me.hgj.jetpackmvvm.demo.viewmodel.state.TreeViewModel import me.hgj.jetpackmvvm.ext.nav @@ -41,12 +42,11 @@ class TreeArrFragment : BaseFragment() setOnMenuItemClickListener { when (it.itemId) { R.id.todo_add -> { - if(shareViewModel.isLogin.value){ + if(CacheUtil.isLogin()){ nav().navigate(R.id.action_mainfragment_to_addAriticleFragment) }else{ - nav().navigate(R.id.action_mainFragment_to_loginFragment) + nav().navigate(R.id.action_to_loginFragment) } - } } true diff --git a/app/src/main/java/me/hgj/jetpackmvvm/demo/ui/fragment/web/WebFragment.kt b/app/src/main/java/me/hgj/jetpackmvvm/demo/ui/fragment/web/WebFragment.kt index 794db64..7137e9b 100644 --- a/app/src/main/java/me/hgj/jetpackmvvm/demo/ui/fragment/web/WebFragment.kt +++ b/app/src/main/java/me/hgj/jetpackmvvm/demo/ui/fragment/web/WebFragment.kt @@ -11,21 +11,23 @@ import android.widget.LinearLayout import androidx.activity.OnBackPressedCallback import androidx.appcompat.app.AppCompatActivity import androidx.core.content.ContextCompat +import androidx.fragment.app.viewModels import androidx.lifecycle.Observer import com.just.agentweb.AgentWeb import kotlinx.android.synthetic.main.fragment_web.* import kotlinx.android.synthetic.main.include_toolbar.* +import me.hgj.jetpackmvvm.callback.livedata.event.Event import me.hgj.jetpackmvvm.demo.R import me.hgj.jetpackmvvm.demo.app.base.BaseFragment import me.hgj.jetpackmvvm.demo.app.ext.hideSoftKeyboard import me.hgj.jetpackmvvm.demo.app.ext.initClose import me.hgj.jetpackmvvm.demo.app.ext.showMessage +import me.hgj.jetpackmvvm.demo.app.util.CacheUtil import me.hgj.jetpackmvvm.demo.data.model.bean.* import me.hgj.jetpackmvvm.demo.data.model.enums.CollectType import me.hgj.jetpackmvvm.demo.databinding.FragmentWebBinding import me.hgj.jetpackmvvm.demo.viewmodel.request.RequestCollectViewModel import me.hgj.jetpackmvvm.demo.viewmodel.state.WebViewModel -import me.hgj.jetpackmvvm.ext.getViewModel import me.hgj.jetpackmvvm.ext.nav /** @@ -38,8 +40,8 @@ class WebFragment : BaseFragment() { private var mAgentWeb: AgentWeb? = null - /** 注意,在by lazy中使用getViewModel一定要使用泛型,虽然他提示不报错,但是你不写是不行的 */ - private val requestCollectViewModel: RequestCollectViewModel by lazy { getViewModel() } + /** */ + private val requestCollectViewModel: RequestCollectViewModel by viewModels() override fun layoutId() = R.layout.fragment_web @@ -120,7 +122,7 @@ class WebFragment : BaseFragment() { requestCollectViewModel.collectUiState.observe(viewLifecycleOwner, Observer { if (it.isSuccess) { mViewModel.collect = it.collect - eventViewModel.collect.postValue(CollectBus(it.id, it.collect)) + eventViewModel.collectEvent.postValue(Event( CollectBus(it.id, it.collect))) //刷新一下menu activity?.window?.invalidatePanelMenu(Window.FEATURE_OPTIONS_PANEL) activity?.invalidateOptionsMenu() @@ -130,7 +132,7 @@ class WebFragment : BaseFragment() { }) requestCollectViewModel.collectUrlUiState.observe(viewLifecycleOwner, Observer { if (it.isSuccess) { - eventViewModel.collect.postValue(CollectBus(it.id, it.collect)) + eventViewModel.collectEvent.postValue(Event(CollectBus(it.id, it.collect))) mViewModel.collect = it.collect //刷新一下menu activity?.window?.invalidatePanelMenu(Window.FEATURE_OPTIONS_PANEL) @@ -180,7 +182,7 @@ class WebFragment : BaseFragment() { R.id.web_collect -> { //点击收藏 //是否已经登录了,没登录需要跳转到登录页去 - if (shareViewModel.isLogin.value) { + if (CacheUtil.isLogin()) { //是否已经收藏了 if (mViewModel.collect) { if (mViewModel.collectType == CollectType.Url.type) { @@ -201,7 +203,7 @@ class WebFragment : BaseFragment() { } } else { //跳转到登录页 - nav().navigate(R.id.action_webFragment_to_loginFragment) + nav().navigate(R.id.action_to_loginFragment) } } R.id.web_liulanqi -> { diff --git a/app/src/main/java/me/hgj/jetpackmvvm/demo/viewmodel/request/RequestLoginRegisterViewModel.kt b/app/src/main/java/me/hgj/jetpackmvvm/demo/viewmodel/request/RequestLoginRegisterViewModel.kt index d02a911..f77c409 100644 --- a/app/src/main/java/me/hgj/jetpackmvvm/demo/viewmodel/request/RequestLoginRegisterViewModel.kt +++ b/app/src/main/java/me/hgj/jetpackmvvm/demo/viewmodel/request/RequestLoginRegisterViewModel.kt @@ -29,7 +29,6 @@ class RequestLoginRegisterViewModel(application: Application) : BaseViewModel(ap true,//是否显示等待框,,默认false不显示 可以默认不传 "正在登录中..."//等待框内容,可以默认不填请求网络中... ) - //2.这种是在Activity/Fragment中的监听拿到未脱壳的数据,你可以自己根据code做业务需求操作(项目没有基类的可以用) /*requestNoCheck({HttpRequestManger.instance.login(username,password)},loginResult2,true)*/ diff --git a/app/src/main/java/me/hgj/jetpackmvvm/demo/viewmodel/request/RequestTodoViewModel.kt b/app/src/main/java/me/hgj/jetpackmvvm/demo/viewmodel/request/RequestTodoViewModel.kt index 7a7ddc4..c2457e7 100644 --- a/app/src/main/java/me/hgj/jetpackmvvm/demo/viewmodel/request/RequestTodoViewModel.kt +++ b/app/src/main/java/me/hgj/jetpackmvvm/demo/viewmodel/request/RequestTodoViewModel.kt @@ -99,8 +99,10 @@ class RequestTodoViewModel(application: Application) : BaseViewModel(application val uistate = UpdateUiState(isSuccess = true, data = 0) updateDataState.postValue(uistate) }, { - val uistate = UpdateUiState(isSuccess = false, data = 0, errorMsg = it.errorMsg) + val uistate = UpdateUiState(isSuccess = false, errorMsg = it.errorMsg) updateDataState.postValue(uistate) + }, isShowDialog = true) } -} \ No newline at end of file +} + diff --git a/app/src/main/java/me/hgj/jetpackmvvm/demo/viewmodel/state/HomeViewModel.kt b/app/src/main/java/me/hgj/jetpackmvvm/demo/viewmodel/state/HomeViewModel.kt index 1627a03..0f7ffcc 100644 --- a/app/src/main/java/me/hgj/jetpackmvvm/demo/viewmodel/state/HomeViewModel.kt +++ b/app/src/main/java/me/hgj/jetpackmvvm/demo/viewmodel/state/HomeViewModel.kt @@ -9,4 +9,5 @@ import me.hgj.jetpackmvvm.base.viewmodel.BaseViewModel */ class HomeViewModel(application: Application) : BaseViewModel(application){ + } \ No newline at end of file diff --git a/app/src/main/java/me/hgj/jetpackmvvm/demo/viewmodel/state/MainViewModel.kt b/app/src/main/java/me/hgj/jetpackmvvm/demo/viewmodel/state/MainViewModel.kt index 32f3370..5ab4a2f 100644 --- a/app/src/main/java/me/hgj/jetpackmvvm/demo/viewmodel/state/MainViewModel.kt +++ b/app/src/main/java/me/hgj/jetpackmvvm/demo/viewmodel/state/MainViewModel.kt @@ -1,9 +1,20 @@ package me.hgj.jetpackmvvm.demo.viewmodel.state import android.app.Application +import androidx.lifecycle.MutableLiveData import me.hgj.jetpackmvvm.base.viewmodel.BaseViewModel +import me.hgj.jetpackmvvm.callback.livedata.StringLiveData +import me.hgj.jetpackmvvm.callback.livedata.UnPeekLiveData +import me.hgj.jetpackmvvm.callback.livedata.UnPeekNotNullLiveData +import me.hgj.jetpackmvvm.demo.app.ext.showMessage -class MainViewModel(application: Application): - BaseViewModel(application) { +class MainViewModel(application: Application):BaseViewModel(application) { + + var name = UnPeekNotNullLiveData("你是谁") + var name1 = UnPeekNotNullLiveData(0.0) + var name2 = UnPeekNotNullLiveData() + init { + name2.value = "你是谁111" + } } \ No newline at end of file diff --git a/app/src/main/res/layout/activity_test.xml b/app/src/main/res/layout/activity_test.xml deleted file mode 100644 index ab826f4..0000000 --- a/app/src/main/res/layout/activity_test.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_main.xml b/app/src/main/res/layout/fragment_main.xml index 8a2f6fa..a58d881 100644 --- a/app/src/main/res/layout/fragment_main.xml +++ b/app/src/main/res/layout/fragment_main.xml @@ -13,10 +13,10 @@ android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" - android:id="@+id/main_viewpager" + android:id="@+id/mainViewpager" /> - - - - + + + - - + android:label="SearchResultFragment" + app:startDestination="@id/action_searchResultFragment_to_lookInfoFragment"> - - + android:label="WebFragment" /> + - - - - - - - - + android:label="LookInfoFragment" /> - + - - + android:label="CollectFragment" /> + - + + + + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 971499b..6bad37f 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -22,7 +22,7 @@ 列表动画 版权声明 - 本App使用的Api均为 玩安卓网站 提供,仅供于大家学习交流 + 本App使用的Api均为 玩Android网站 提供,仅供于大家学习交流 仅作个人及非商业用途 作者 一个练习时长两年半的安卓开发者→_→ diff --git a/app/src/main/res/xml/root_preferences.xml b/app/src/main/res/xml/root_preferences.xml index c8a7192..737553e 100644 --- a/app/src/main/res/xml/root_preferences.xml +++ b/app/src/main/res/xml/root_preferences.xml @@ -17,7 +17,6 @@ android:summary="退出登录" android:title="@string/setting_exit" /> -