├── .gitignore ├── .idea ├── .name ├── codeStyles │ └── Project.xml ├── compiler.xml ├── gradle.xml ├── inspectionProfiles │ └── Project_Default.xml ├── jarRepositories.xml ├── misc.xml ├── runConfigurations.xml ├── smartfox_info.xml └── vcs.xml ├── README.md ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── example │ │ └── myapplication │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── assets │ │ └── address.json │ ├── java │ │ └── com │ │ │ └── example │ │ │ └── myapplication │ │ │ ├── base │ │ │ ├── BaseActivity.java │ │ │ ├── BaseFragment.java │ │ │ ├── BindingAdapterUtil.java │ │ │ ├── adapter │ │ │ │ └── BasePagerAdapter.java │ │ │ └── viewmodel │ │ │ │ └── BaseViewModel.java │ │ │ ├── bean │ │ │ ├── ActivitySkip.java │ │ │ ├── GitHubProject.java │ │ │ ├── UpdatePlan.java │ │ │ └── responsebean │ │ │ │ ├── ArticleBean.java │ │ │ │ ├── ArticleListBean.java │ │ │ │ ├── Coin.java │ │ │ │ ├── CoinBean.java │ │ │ │ ├── CoinRankBean.java │ │ │ │ ├── CollectArticleBean.java │ │ │ │ ├── HomeBanner.java │ │ │ │ ├── ImageBean.java │ │ │ │ ├── LoginBean.java │ │ │ │ ├── NavigationBean.java │ │ │ │ ├── ToDoListBean.java │ │ │ │ ├── UserShareArticleBean.java │ │ │ │ ├── WeChatBean.java │ │ │ │ └── home │ │ │ │ ├── BannerData.java │ │ │ │ └── HomeData.java │ │ │ ├── behavior │ │ │ ├── BottomNavigationBehavior.java │ │ │ └── FloatingActionButtonBehavior.java │ │ │ ├── config │ │ │ ├── App.java │ │ │ ├── Constants.java │ │ │ └── LoadState.java │ │ │ ├── http │ │ │ ├── data │ │ │ │ ├── HttpBaseResponse.java │ │ │ │ ├── HttpDisposable.java │ │ │ │ └── HttpResponseInterface.java │ │ │ ├── httptool │ │ │ │ ├── AddCookiesInterceptor.java │ │ │ │ ├── HttpException.java │ │ │ │ ├── HttpInterceptor.java │ │ │ │ ├── ResponseConverterFactory.java │ │ │ │ └── UploadUtils.java │ │ │ └── request │ │ │ │ ├── APIConstants.java │ │ │ │ ├── ApiAddress.java │ │ │ │ ├── HttpFactory.java │ │ │ │ ├── HttpRequest.java │ │ │ │ └── ServerAddress.java │ │ │ ├── manager │ │ │ ├── MyActivityManager.java │ │ │ └── ThreadManager.java │ │ │ ├── navinterface │ │ │ └── ScrollToTop.java │ │ │ ├── room │ │ │ └── AppDataBase.java │ │ │ ├── ui │ │ │ ├── activity │ │ │ │ ├── login │ │ │ │ │ ├── FragmentLogin.java │ │ │ │ │ ├── FragmentRegister.java │ │ │ │ │ ├── LoginActivity.java │ │ │ │ │ └── LoginViewModel.java │ │ │ │ ├── main │ │ │ │ │ ├── MainActivity.java │ │ │ │ │ └── MainViewModel.java │ │ │ │ ├── splash │ │ │ │ │ ├── SplashActivity.java │ │ │ │ │ └── SplashViewModel.java │ │ │ │ └── web │ │ │ │ │ ├── DetailsActivity.java │ │ │ │ │ └── DetailsViewModel.java │ │ │ ├── adapter │ │ │ │ ├── ArticleListPagerAdapter.java │ │ │ │ ├── BannerViewHolder.java │ │ │ │ ├── CommonAdapter.java │ │ │ │ ├── CommonViewHolder.java │ │ │ │ ├── FmPagerAdapter.java │ │ │ │ ├── HomeAdapter.java │ │ │ │ ├── NavigationAdapter.java │ │ │ │ └── SystemAdapter.java │ │ │ ├── articlelist │ │ │ │ ├── ArticleListFragment.java │ │ │ │ └── ArticleListViewModel.java │ │ │ ├── bottom │ │ │ │ ├── navi │ │ │ │ │ ├── NaviViewModel.java │ │ │ │ │ └── NavigationFragment.java │ │ │ │ ├── project │ │ │ │ │ ├── ProjectFragment.java │ │ │ │ │ └── ProjectViewModel.java │ │ │ │ ├── system │ │ │ │ │ ├── SystemFragment.java │ │ │ │ │ ├── SystemViewModel.java │ │ │ │ │ └── systemchildren │ │ │ │ │ │ ├── SystemChildrenFragment.java │ │ │ │ │ │ └── SystemChildrenViewModel.java │ │ │ │ └── wechat │ │ │ │ │ ├── WeChatFragment.java │ │ │ │ │ └── WeChatViewModel.java │ │ │ ├── home │ │ │ │ ├── HomeFragment.java │ │ │ │ └── HomeViewModel.java │ │ │ ├── nav │ │ │ │ ├── about │ │ │ │ │ ├── AboutFragment.java │ │ │ │ │ └── AboutViewModel.java │ │ │ │ ├── collect │ │ │ │ │ ├── CollectFragment.java │ │ │ │ │ └── CollectViewModel.java │ │ │ │ ├── mine │ │ │ │ │ ├── MineFragment.java │ │ │ │ │ ├── coin │ │ │ │ │ │ ├── CoinListFragment.java │ │ │ │ │ │ └── CoinViewModel.java │ │ │ │ │ ├── coinrank │ │ │ │ │ │ ├── CoinRankListFragment.java │ │ │ │ │ │ └── CoinRankViewModel.java │ │ │ │ │ └── share │ │ │ │ │ │ ├── ShareFragment.java │ │ │ │ │ │ └── ShareViewModel.java │ │ │ │ ├── qa │ │ │ │ │ ├── QaFragment.java │ │ │ │ │ └── QaViewModel.java │ │ │ │ ├── square │ │ │ │ │ ├── SquareFragment.java │ │ │ │ │ └── SquareViewModel.java │ │ │ │ ├── todo │ │ │ │ │ ├── ToDoFragment.java │ │ │ │ │ ├── ToDoViewModel.java │ │ │ │ │ ├── addtodo │ │ │ │ │ │ ├── AddToDoFragment.java │ │ │ │ │ │ └── AddToDoViewModel.java │ │ │ │ │ └── todocontent │ │ │ │ │ │ ├── ToDoContentFragment.java │ │ │ │ │ │ └── ToDoContentViewModel.java │ │ │ │ └── update │ │ │ │ │ ├── UpdateFragment.java │ │ │ │ │ └── UpdateViewModel.java │ │ │ └── view │ │ │ │ ├── CircleImageView.java │ │ │ │ ├── EditTextWithTitle.java │ │ │ │ ├── MultiRadioGroup.java │ │ │ │ └── SlideRecyclerView.java │ │ │ └── util │ │ │ ├── CommonUtils.java │ │ │ ├── GlideUtil.java │ │ │ ├── ImageSelectUtil.java │ │ │ ├── NetworkUtils.java │ │ │ ├── ShellUtils.java │ │ │ ├── TimeUtils.java │ │ │ └── ToastUtils.java │ └── res │ │ ├── color │ │ └── qmui_btn_bg.xml │ │ ├── drawable-v21 │ │ ├── ic_menu_camera.xml │ │ ├── ic_menu_gallery.xml │ │ ├── ic_menu_manage.xml │ │ ├── ic_menu_send.xml │ │ ├── ic_menu_share.xml │ │ └── ic_menu_slideshow.xml │ │ ├── drawable-v24 │ │ └── ic_launcher_foreground.xml │ │ ├── drawable │ │ ├── animated_rotate_loading.xml │ │ ├── bg_pop_view.xml │ │ ├── edit_text_bg.xml │ │ ├── ic_arrow_upward_black_24dp.xml │ │ ├── ic_dashboard_black_24dp.xml │ │ ├── ic_home_black_24dp.xml │ │ ├── ic_launcher_background.xml │ │ ├── ic_notifications_black_24dp.xml │ │ ├── radiobutton_background.xml │ │ ├── radiobutton_background_checked.xml │ │ ├── radiobutton_background_unchecked.xml │ │ ├── radiobutton_textcolor.xml │ │ ├── shape_label_blue.xml │ │ ├── shape_label_green.xml │ │ ├── shape_label_red.xml │ │ ├── side_nav_bar.xml │ │ └── skip_btn_bg.xml │ │ ├── layout │ │ ├── activity_base.xml │ │ ├── activity_details.xml │ │ ├── activity_login.xml │ │ ├── activity_main.xml │ │ ├── activity_splash.xml │ │ ├── app_bar_main.xml │ │ ├── edit_text_with_title.xml │ │ ├── fragment_about.xml │ │ ├── fragment_base.xml │ │ ├── fragment_list.xml │ │ ├── fragment_mine.xml │ │ ├── fragment_notifications.xml │ │ ├── fragment_project_view_pager.xml │ │ ├── fragment_share.xml │ │ ├── fragment_slideshow.xml │ │ ├── fragment_to_do_add.xml │ │ ├── fragment_to_do_content.xml │ │ ├── fragment_todo_list.xml │ │ ├── fragment_tools.xml │ │ ├── fragment_view_pager.xml │ │ ├── item_article.xml │ │ ├── item_coin_layout.xml │ │ ├── item_coin_rank.xml │ │ ├── item_collect_article.xml │ │ ├── item_home_banner.xml │ │ ├── item_home_top.xml │ │ ├── item_navigation_layout.xml │ │ ├── item_navigation_tag_layout.xml │ │ ├── item_open_source_project.xml │ │ ├── item_system_layout.xml │ │ ├── item_system_tag_layout.xml │ │ ├── item_todo_data.xml │ │ ├── item_top_article.xml │ │ ├── item_update_plan.xml │ │ ├── layout_no_more_data.xml │ │ ├── login_fragment.xml │ │ ├── nav_header_main.xml │ │ ├── navi_fragment.xml │ │ ├── register_fragment.xml │ │ ├── remote_banner_item.xml │ │ ├── text_view_with_title.xml │ │ ├── update_fragment.xml │ │ ├── view_load_error.xml │ │ ├── view_loading.xml │ │ ├── view_no_data.xml │ │ └── view_no_network.xml │ │ ├── menu │ │ ├── activity_main_drawer.xml │ │ ├── bottom_nav_menu.xml │ │ └── main.xml │ │ ├── mipmap-anydpi-v26 │ │ ├── ic_launcher.xml │ │ └── ic_launcher_round.xml │ │ ├── mipmap-hdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-mdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxhdpi │ │ ├── ic_add.png │ │ ├── ic_bookmark.png │ │ ├── ic_checkbox_check.png │ │ ├── ic_checkbox_uncheck.png │ │ ├── ic_chevron_down.png │ │ ├── ic_chevron_right.png │ │ ├── ic_chevron_up.png │ │ ├── ic_collect_no.png │ │ ├── ic_collect_yes.png │ │ ├── ic_collectbroken.png │ │ ├── ic_copy.png │ │ ├── ic_github.png │ │ ├── ic_hot.png │ │ ├── ic_launcher.png │ │ ├── ic_launcher_round.png │ │ ├── ic_link.png │ │ ├── ic_link_grey.png │ │ ├── ic_load_error.png │ │ ├── ic_logo.png │ │ ├── ic_mine_coin.png │ │ ├── ic_mine_collect.png │ │ ├── ic_mine_setting.png │ │ ├── ic_mine_share.png │ │ ├── ic_nav_about.png │ │ ├── ic_nav_collect.png │ │ ├── ic_nav_qa.png │ │ ├── ic_nav_square.png │ │ ├── ic_nav_todo.png │ │ ├── ic_nav_update.png │ │ ├── ic_navigation.png │ │ ├── ic_no_net.png │ │ ├── ic_nodata.png │ │ ├── ic_project.png │ │ ├── ic_rank.png │ │ ├── ic_rank_first.png │ │ ├── ic_rank_second.png │ │ ├── ic_rank_thred.png │ │ ├── ic_star.png │ │ ├── ic_star_outline.png │ │ ├── ic_system.png │ │ ├── ic_todo.png │ │ ├── ic_top.png │ │ ├── ic_update.png │ │ ├── ic_wechat.png │ │ ├── nodata.png │ │ └── splash_bg.jpg │ │ ├── mipmap-xxxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── navigation │ │ └── mobile_navigation.xml │ │ ├── values-v21 │ │ └── styles.xml │ │ └── values │ │ ├── arrays.xml │ │ ├── colors.xml │ │ ├── dimens.xml │ │ ├── drawables.xml │ │ ├── strings.xml │ │ ├── strings_behavior.xml │ │ └── styles.xml │ └── test │ └── java │ └── com │ └── example │ └── myapplication │ └── ExampleUnitTest.java ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── image ├── wanandroid_about.png ├── wanandroid_collect.png ├── wanandroid_home.png ├── wanandroid_login.png ├── wanandroid_mine.png ├── wanandroid_nav.png ├── wanandroid_navagation.png ├── wanandroid_project.png ├── wanandroid_qa.png ├── wanandroid_splash.webp ├── wanandroid_sys.png ├── wanandroid_todo.png ├── wanandroid_update.png └── wanandroid_wechat.png └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/caches 5 | /.idea/libraries 6 | /.idea/modules.xml 7 | /.idea/workspace.xml 8 | /.idea/navEditor.xml 9 | /.idea/assetWizardSettings.xml 10 | /.idea/vcs.xml 11 | .DS_Store 12 | /build 13 | /captures 14 | .externalNativeBuild 15 | .cxx 16 | -------------------------------------------------------------------------------- /.idea/.name: -------------------------------------------------------------------------------- 1 | My Application -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 21 | 22 | -------------------------------------------------------------------------------- /.idea/jarRepositories.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 9 | 10 | 14 | 15 | 19 | 20 | 24 | 25 | 29 | 30 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 9 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/smartfox_info.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | 23 | 24 | -keep class **_FragmentFinder { *; } 25 | -keep class com.qmuiteam.qmui.arch.record.** { *; } 26 | -keep class androidx.fragment.app.* { *; } 27 | 28 | -dontwarn com.ccj.poptabview.** 29 | -keep class com.ccj.poptabview.**{*;} 30 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/example/myapplication/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.example.myapplication; 2 | 3 | import android.content.Context; 4 | 5 | import androidx.test.platform.app.InstrumentationRegistry; 6 | import androidx.test.ext.junit.runners.AndroidJUnit4; 7 | 8 | import org.junit.Test; 9 | import org.junit.runner.RunWith; 10 | 11 | import static org.junit.Assert.*; 12 | 13 | /** 14 | * Instrumented test, which will execute on an Android device. 15 | * 16 | * @see Testing documentation 17 | */ 18 | @RunWith(AndroidJUnit4.class) 19 | public class ExampleInstrumentedTest { 20 | @Test 21 | public void useAppContext() { 22 | // Context of the app under test. 23 | Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); 24 | 25 | assertEquals("com.example.myapplication", appContext.getPackageName()); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 21 | 26 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/myapplication/base/adapter/BasePagerAdapter.java: -------------------------------------------------------------------------------- 1 | package com.example.myapplication.base.adapter; 2 | 3 | 4 | import android.util.SparseArray; 5 | 6 | import java.util.List; 7 | 8 | import androidx.fragment.app.Fragment; 9 | import androidx.fragment.app.FragmentManager; 10 | import androidx.fragment.app.FragmentPagerAdapter; 11 | 12 | /** 13 | * PagerAdapter的基类 14 | * @author devel 15 | */ 16 | public abstract class BasePagerAdapter extends FragmentPagerAdapter { 17 | 18 | protected SparseArray mFragmentMap = new SparseArray<>(); 19 | 20 | protected List mDataList; 21 | 22 | public BasePagerAdapter(FragmentManager fragmentManager) { 23 | super(fragmentManager); 24 | } 25 | 26 | @Override 27 | public int getCount() { 28 | return mDataList != null ? mDataList.size() : 0; 29 | } 30 | 31 | /** 32 | * 设置数据列表 33 | * 34 | * @param dataList 数据列表 35 | */ 36 | public void setDataList(List dataList) { 37 | mDataList = dataList; 38 | notifyDataSetChanged(); 39 | } 40 | 41 | /** 42 | * 释放缓存的Fragment 43 | */ 44 | public void release() { 45 | mFragmentMap.clear(); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/myapplication/base/viewmodel/BaseViewModel.java: -------------------------------------------------------------------------------- 1 | package com.example.myapplication.base.viewmodel; 2 | 3 | 4 | import android.content.res.Resources; 5 | 6 | import com.example.myapplication.config.App; 7 | import com.example.myapplication.R; 8 | import com.example.myapplication.config.LoadState; 9 | import com.example.myapplication.http.data.HttpDisposable; 10 | import com.example.myapplication.http.request.HttpFactory; 11 | import com.example.myapplication.http.request.HttpRequest; 12 | 13 | import androidx.lifecycle.DefaultLifecycleObserver; 14 | import androidx.lifecycle.LiveData; 15 | import androidx.lifecycle.MutableLiveData; 16 | import androidx.lifecycle.ViewModel; 17 | 18 | /** 19 | * ViewModel的基类 20 | * 21 | * @author devel 22 | */ 23 | public abstract class BaseViewModel extends ViewModel implements DefaultLifecycleObserver { 24 | 25 | public Resources resources; 26 | 27 | /** 28 | * 收藏文章 29 | */ 30 | public MutableLiveData collect = new MutableLiveData<>(); 31 | 32 | /** 33 | * 加载状态 34 | */ 35 | public MutableLiveData loadState = new MutableLiveData<>(); 36 | 37 | public MutableLiveData errorMsg = new MutableLiveData<>(getResources().getString(R.string.load_error)); 38 | 39 | /** 40 | * 是否为刷新数据 41 | */ 42 | public boolean mRefresh; 43 | 44 | /** 45 | * 重新加载数据。没有网络,点击重试时回调 46 | */ 47 | public void reloadData() { 48 | 49 | } 50 | 51 | public Resources getResources() { 52 | if (resources == null) { 53 | resources = App.getContext().getResources(); 54 | } 55 | return resources; 56 | } 57 | 58 | /** 59 | * 改变文章收藏状态 60 | */ 61 | public void changeArticleCollect(boolean collect, int id) { 62 | 63 | if (collect) { 64 | collectArticle(id); 65 | } else { 66 | unCollectArticle(id); 67 | } 68 | } 69 | 70 | public LiveData getCollectStatus() { 71 | return collect; 72 | } 73 | 74 | /** 75 | * 收藏文章 76 | * 77 | * @param id 78 | */ 79 | private void collectArticle(int id) { 80 | 81 | HttpRequest.getInstance() 82 | .collectArticle(id) 83 | .compose(HttpFactory.schedulers()) 84 | .subscribe(new HttpDisposable() { 85 | @Override 86 | public void success(Object mArticleListBean) { 87 | collect.postValue(mArticleListBean); 88 | } 89 | 90 | @Override 91 | public void onError(Throwable e) { 92 | collect.postValue(null); 93 | } 94 | }); 95 | } 96 | 97 | /** 98 | * 取消收藏文章 99 | * 100 | * @param id 101 | */ 102 | private void unCollectArticle(int id) { 103 | HttpRequest.getInstance() 104 | .unCollectArticle(id) 105 | .compose(HttpFactory.schedulers()) 106 | .subscribe(new HttpDisposable() { 107 | @Override 108 | public void success(Object mArticleListBean) { 109 | collect.postValue(mArticleListBean); 110 | } 111 | }); 112 | } 113 | } 114 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/myapplication/bean/ActivitySkip.java: -------------------------------------------------------------------------------- 1 | package com.example.myapplication.bean; 2 | 3 | 4 | public class ActivitySkip { 5 | 6 | private String mActivity; 7 | 8 | private String param1; 9 | 10 | private boolean param2; 11 | 12 | private String param3; 13 | 14 | public String getmActivity() { 15 | return mActivity; 16 | } 17 | 18 | public void setmActivity(String mActivity) { 19 | this.mActivity = mActivity; 20 | } 21 | 22 | public String getParam1() { 23 | return param1; 24 | } 25 | 26 | public void setParam1(String param1) { 27 | this.param1 = param1; 28 | } 29 | 30 | public boolean getParam2() { 31 | return param2; 32 | } 33 | 34 | public void setParam2(boolean param2) { 35 | this.param2 = param2; 36 | } 37 | 38 | public String getParam3() { 39 | return param3; 40 | } 41 | 42 | public void setParam3(String param3) { 43 | this.param3 = param3; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/myapplication/bean/GitHubProject.java: -------------------------------------------------------------------------------- 1 | package com.example.myapplication.bean; 2 | 3 | /** 4 | * @author : devel 5 | * @date : 2020/3/3 14:57 6 | * @desc :开源项目 7 | */ 8 | public class GitHubProject { 9 | 10 | private String name; 11 | 12 | private String info; 13 | 14 | private String address; 15 | 16 | public GitHubProject() { 17 | } 18 | 19 | public GitHubProject(String name, String info, String address) { 20 | this.name = name; 21 | this.info = info; 22 | this.address = address; 23 | } 24 | 25 | public String getName() { 26 | return name; 27 | } 28 | 29 | public void setName(String name) { 30 | this.name = name; 31 | } 32 | 33 | public String getInfo() { 34 | return info; 35 | } 36 | 37 | public void setInfo(String info) { 38 | this.info = info; 39 | } 40 | 41 | public String getAddress() { 42 | return address; 43 | } 44 | 45 | public void setAddress(String address) { 46 | this.address = address; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/myapplication/bean/UpdatePlan.java: -------------------------------------------------------------------------------- 1 | package com.example.myapplication.bean; 2 | 3 | /** 4 | * @author : devel 5 | * @date : 2020/3/3 15:29 6 | * @desc : 7 | */ 8 | public class UpdatePlan { 9 | 10 | private String plan; 11 | 12 | private Boolean complete; 13 | 14 | public UpdatePlan(String plan, Boolean complete) { 15 | this.plan = plan; 16 | this.complete = complete; 17 | } 18 | 19 | public Boolean getComplete() { 20 | return complete; 21 | } 22 | 23 | public void setComplete(Boolean complete) { 24 | this.complete = complete; 25 | } 26 | 27 | public String getPlan() { 28 | return plan; 29 | } 30 | 31 | public void setPlan(String plan) { 32 | this.plan = plan; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/myapplication/bean/responsebean/Coin.java: -------------------------------------------------------------------------------- 1 | package com.example.myapplication.bean.responsebean; 2 | 3 | /** 4 | * 用户积分信息 5 | */ 6 | public class Coin { 7 | 8 | /** 9 | * coinCount : 451 10 | * rank : 7 11 | * userId : 2 12 | * username : x**oyang 13 | */ 14 | 15 | private int coinCount; 16 | private int rank; 17 | private int userId; 18 | private String username; 19 | 20 | 21 | public String getCoinCount() { 22 | return coinCount+"分"; 23 | } 24 | 25 | public void setCoinCount(int coinCount) { 26 | this.coinCount = coinCount; 27 | } 28 | 29 | public int getRank() { 30 | return rank; 31 | } 32 | 33 | public void setRank(int rank) { 34 | this.rank = rank; 35 | } 36 | 37 | public int getUserId() { 38 | return userId; 39 | } 40 | 41 | public void setUserId(int userId) { 42 | this.userId = userId; 43 | } 44 | 45 | public String getUsername() { 46 | return username; 47 | } 48 | 49 | public void setUsername(String username) { 50 | this.username = username; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/myapplication/bean/responsebean/HomeBanner.java: -------------------------------------------------------------------------------- 1 | package com.example.myapplication.bean.responsebean; 2 | 3 | /** 4 | * 主页Banner信息 5 | */ 6 | public class HomeBanner { 7 | /** 8 | * desc : 享学~ 9 | * id : 29 10 | * imagePath : https://www.wanandroid.com/blogimgs/ade5fbf7-57d7-4fec-ad02-402dcf12acd2.jpeg 11 | * isVisible : 1 12 | * order : 0 13 | * title : 今年找工作会更难吗? 14 | * type : 0 15 | * url : https://mp.weixin.qq.com/s/cASgy1B6yfIu9v6usm7rPA 16 | */ 17 | 18 | private String desc; 19 | private int id; 20 | private String imagePath; 21 | private int isVisible; 22 | private int order; 23 | private String title; 24 | private int type; 25 | private String url; 26 | 27 | public String getDesc() { 28 | return desc; 29 | } 30 | 31 | public void setDesc(String desc) { 32 | this.desc = desc; 33 | } 34 | 35 | public int getId() { 36 | return id; 37 | } 38 | 39 | public void setId(int id) { 40 | this.id = id; 41 | } 42 | 43 | public String getImagePath() { 44 | return imagePath; 45 | } 46 | 47 | public void setImagePath(String imagePath) { 48 | this.imagePath = imagePath; 49 | } 50 | 51 | public int getIsVisible() { 52 | return isVisible; 53 | } 54 | 55 | public void setIsVisible(int isVisible) { 56 | this.isVisible = isVisible; 57 | } 58 | 59 | public int getOrder() { 60 | return order; 61 | } 62 | 63 | public void setOrder(int order) { 64 | this.order = order; 65 | } 66 | 67 | public String getTitle() { 68 | return title; 69 | } 70 | 71 | public void setTitle(String title) { 72 | this.title = title; 73 | } 74 | 75 | public int getType() { 76 | return type; 77 | } 78 | 79 | public void setType(int type) { 80 | this.type = type; 81 | } 82 | 83 | public String getUrl() { 84 | return url; 85 | } 86 | 87 | public void setUrl(String url) { 88 | this.url = url; 89 | } 90 | 91 | } 92 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/myapplication/bean/responsebean/LoginBean.java: -------------------------------------------------------------------------------- 1 | package com.example.myapplication.bean.responsebean; 2 | 3 | import java.util.List; 4 | 5 | /** 6 | * 用户登录信息 7 | */ 8 | public class LoginBean { 9 | 10 | /** 11 | * admin : false 12 | * chapterTops : [] 13 | * collectIds : [11963] 14 | * email : 15 | * icon : 16 | * id : 44330 17 | * nickname : ccaong@outlook.com 18 | * password : 19 | * publicName : ccaong@outlook.com 20 | * token : 21 | * type : 0 22 | * username : ccaong@outlook.com 23 | */ 24 | 25 | private boolean admin; 26 | private String email; 27 | private String icon; 28 | private int id; 29 | private String nickname; 30 | private String password; 31 | private String publicName; 32 | private String token; 33 | private int type; 34 | private String username; 35 | private List chapterTops; 36 | private List collectIds; 37 | 38 | public boolean isAdmin() { 39 | return admin; 40 | } 41 | 42 | public void setAdmin(boolean admin) { 43 | this.admin = admin; 44 | } 45 | 46 | public String getEmail() { 47 | return email; 48 | } 49 | 50 | public void setEmail(String email) { 51 | this.email = email; 52 | } 53 | 54 | public String getIcon() { 55 | return icon; 56 | } 57 | 58 | public void setIcon(String icon) { 59 | this.icon = icon; 60 | } 61 | 62 | public int getId() { 63 | return id; 64 | } 65 | 66 | public void setId(int id) { 67 | this.id = id; 68 | } 69 | 70 | public String getNickname() { 71 | return nickname; 72 | } 73 | 74 | public void setNickname(String nickname) { 75 | this.nickname = nickname; 76 | } 77 | 78 | public String getPassword() { 79 | return password; 80 | } 81 | 82 | public void setPassword(String password) { 83 | this.password = password; 84 | } 85 | 86 | public String getPublicName() { 87 | return publicName; 88 | } 89 | 90 | public void setPublicName(String publicName) { 91 | this.publicName = publicName; 92 | } 93 | 94 | public String getToken() { 95 | return token; 96 | } 97 | 98 | public void setToken(String token) { 99 | this.token = token; 100 | } 101 | 102 | public int getType() { 103 | return type; 104 | } 105 | 106 | public void setType(int type) { 107 | this.type = type; 108 | } 109 | 110 | public String getUsername() { 111 | return username; 112 | } 113 | 114 | public void setUsername(String username) { 115 | this.username = username; 116 | } 117 | 118 | public List getChapterTops() { 119 | return chapterTops; 120 | } 121 | 122 | public void setChapterTops(List chapterTops) { 123 | this.chapterTops = chapterTops; 124 | } 125 | 126 | public List getCollectIds() { 127 | return collectIds; 128 | } 129 | 130 | public void setCollectIds(List collectIds) { 131 | this.collectIds = collectIds; 132 | } 133 | } 134 | 135 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/myapplication/bean/responsebean/NavigationBean.java: -------------------------------------------------------------------------------- 1 | package com.example.myapplication.bean.responsebean; 2 | 3 | import java.util.List; 4 | 5 | /** 6 | * @author devel 7 | * 导航信息 8 | */ 9 | public class NavigationBean { 10 | 11 | private Integer cid; 12 | private String name; 13 | private List articles; 14 | 15 | public Integer getCid() { 16 | return cid; 17 | } 18 | 19 | public void setCid(Integer cid) { 20 | this.cid = cid; 21 | } 22 | 23 | public String getName() { 24 | return name; 25 | } 26 | 27 | public void setName(String name) { 28 | this.name = name; 29 | } 30 | 31 | public List getArticles() { 32 | return articles; 33 | } 34 | 35 | public void setArticles(List articles) { 36 | this.articles = articles; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/myapplication/bean/responsebean/WeChatBean.java: -------------------------------------------------------------------------------- 1 | package com.example.myapplication.bean.responsebean; 2 | 3 | import java.io.Serializable; 4 | import java.util.List; 5 | 6 | /** 7 | * @author devel 8 | * 公众号,体系,项目分类列表 9 | */ 10 | public class WeChatBean implements Serializable { 11 | /** 12 | * children : [] 13 | * courseId : 13 14 | * id : 408 15 | * name : 鸿洋 16 | * order : 190000 17 | * parentChapterId : 407 18 | * userControlSetTop : false 19 | * visible : 1 20 | */ 21 | private int id; 22 | private int courseId; 23 | private String name; 24 | private int order; 25 | private int parentChapterId; 26 | private boolean userControlSetTop; 27 | private int visible; 28 | private List children; 29 | 30 | 31 | public int getCourseId() { 32 | return courseId; 33 | } 34 | 35 | public void setCourseId(int courseId) { 36 | this.courseId = courseId; 37 | } 38 | 39 | public int getId() { 40 | return id; 41 | } 42 | 43 | public void setId(int id) { 44 | this.id = id; 45 | } 46 | 47 | public String getName() { 48 | return name; 49 | } 50 | 51 | public void setName(String name) { 52 | this.name = name; 53 | } 54 | 55 | public int getOrder() { 56 | return order; 57 | } 58 | 59 | public void setOrder(int order) { 60 | this.order = order; 61 | } 62 | 63 | public int getParentChapterId() { 64 | return parentChapterId; 65 | } 66 | 67 | public void setParentChapterId(int parentChapterId) { 68 | this.parentChapterId = parentChapterId; 69 | } 70 | 71 | public boolean isUserControlSetTop() { 72 | return userControlSetTop; 73 | } 74 | 75 | public void setUserControlSetTop(boolean userControlSetTop) { 76 | this.userControlSetTop = userControlSetTop; 77 | } 78 | 79 | public int getVisible() { 80 | return visible; 81 | } 82 | 83 | public void setVisible(int visible) { 84 | this.visible = visible; 85 | } 86 | 87 | public List getChildren() { 88 | return children; 89 | } 90 | 91 | public void setChildren(List children) { 92 | this.children = children; 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/myapplication/bean/responsebean/home/BannerData.java: -------------------------------------------------------------------------------- 1 | package com.example.myapplication.bean.responsebean.home; 2 | 3 | import com.example.myapplication.bean.responsebean.HomeBanner; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * @author : devel 9 | * @date : 2020/2/25 13:36 10 | * @desc : 11 | */ 12 | public class BannerData { 13 | 14 | private List bannerData; 15 | 16 | public BannerData() { 17 | } 18 | 19 | public BannerData(List bannerData) { 20 | this.bannerData = bannerData; 21 | } 22 | 23 | public List getBannerData() { 24 | return bannerData; 25 | } 26 | 27 | public void setBannerData(List bannerData) { 28 | this.bannerData = bannerData; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/myapplication/bean/responsebean/home/HomeData.java: -------------------------------------------------------------------------------- 1 | package com.example.myapplication.bean.responsebean.home; 2 | 3 | import com.example.myapplication.bean.responsebean.ArticleBean; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * @author : devel 9 | * @date : 2020/2/25 13:27 10 | * @desc : 11 | */ 12 | public class HomeData { 13 | 14 | private BannerData bannerData; 15 | private TopArticle topArticleList; 16 | private ArticleBean articleList; 17 | 18 | public BannerData getBannerData() { 19 | return bannerData; 20 | } 21 | 22 | public void setBannerData(BannerData bannerData) { 23 | this.bannerData = bannerData; 24 | } 25 | 26 | public void setTopArticleList(TopArticle topArticleList) { 27 | this.topArticleList = topArticleList; 28 | } 29 | 30 | public TopArticle getTopArticleList() { 31 | return topArticleList; 32 | } 33 | 34 | public ArticleBean getArticleList() { 35 | return articleList; 36 | } 37 | 38 | public void setArticleList(ArticleBean articleList) { 39 | this.articleList = articleList; 40 | } 41 | 42 | 43 | public static class TopArticle { 44 | private String name; 45 | 46 | private List articleBeanList; 47 | 48 | public String getName() { 49 | return name; 50 | } 51 | 52 | public void setName(String name) { 53 | this.name = name; 54 | } 55 | 56 | public List getArticleBeanList() { 57 | return articleBeanList; 58 | } 59 | 60 | public void setArticleBeanList(List articleBeanList) { 61 | this.articleBeanList = articleBeanList; 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/myapplication/behavior/BottomNavigationBehavior.java: -------------------------------------------------------------------------------- 1 | package com.example.myapplication.behavior; 2 | 3 | import android.animation.ObjectAnimator; 4 | import android.content.Context; 5 | 6 | import android.util.AttributeSet; 7 | import android.view.View; 8 | 9 | import androidx.annotation.NonNull; 10 | import androidx.annotation.Nullable; 11 | import androidx.coordinatorlayout.widget.CoordinatorLayout; 12 | import androidx.core.view.ViewCompat; 13 | 14 | /** 15 | * 底部导航的Behavior 16 | */ 17 | public class BottomNavigationBehavior extends CoordinatorLayout.Behavior{ 18 | 19 | private ObjectAnimator mAnimatorOut; 20 | 21 | private ObjectAnimator mAnimatorIn; 22 | 23 | public BottomNavigationBehavior(Context context, @Nullable AttributeSet attrs) { 24 | super(context, attrs); 25 | } 26 | 27 | @Override 28 | public boolean onStartNestedScroll(@NonNull CoordinatorLayout coordinatorLayout, @NonNull View child, 29 | @NonNull View directTargetChild, @NonNull View target, int axes, int type) { 30 | return axes == ViewCompat.SCROLL_AXIS_VERTICAL; 31 | } 32 | 33 | @Override 34 | public void onNestedPreScroll(@NonNull CoordinatorLayout coordinatorLayout, @NonNull View child, 35 | @NonNull View target, int dx, int dy, @NonNull int[] consumed, int type) { 36 | // 上滑隐藏底部导航,下滑显示底部导航 37 | if (dy > 0 && child.getTranslationY() == 0) { 38 | if (mAnimatorOut == null) { 39 | mAnimatorOut = ObjectAnimator.ofFloat(child, "translationY", 0, child.getHeight()) 40 | .setDuration(300); 41 | } 42 | 43 | if (!mAnimatorOut.isRunning()) { 44 | mAnimatorOut.start(); 45 | } 46 | } else if (dy < 0 && child.getTranslationY() == child.getHeight()) { 47 | if (mAnimatorIn == null) { 48 | mAnimatorIn = ObjectAnimator.ofFloat(child, "translationY", child.getHeight(), 0) 49 | .setDuration(300); 50 | } 51 | 52 | if (!mAnimatorIn.isRunning()) { 53 | mAnimatorIn.start(); 54 | } 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/myapplication/behavior/FloatingActionButtonBehavior.java: -------------------------------------------------------------------------------- 1 | package com.example.myapplication.behavior; 2 | 3 | import android.content.Context; 4 | import android.util.AttributeSet; 5 | import android.view.View; 6 | 7 | import androidx.annotation.NonNull; 8 | import androidx.annotation.Nullable; 9 | import androidx.coordinatorlayout.widget.CoordinatorLayout; 10 | import androidx.core.view.ViewCompat; 11 | 12 | import com.google.android.material.floatingactionbutton.FloatingActionButton; 13 | 14 | /** 15 | * 悬浮按钮的Behavior 16 | */ 17 | public class FloatingActionButtonBehavior extends FloatingActionButton.Behavior { 18 | 19 | public FloatingActionButtonBehavior(Context context, @Nullable AttributeSet attrs) { 20 | super(context, attrs); 21 | } 22 | 23 | @Override 24 | public boolean onStartNestedScroll(@NonNull CoordinatorLayout coordinatorLayout, @NonNull FloatingActionButton child, 25 | @NonNull View directTargetChild, @NonNull View target, int axes, int type) { 26 | return axes == ViewCompat.SCROLL_AXIS_VERTICAL; 27 | } 28 | 29 | @SuppressWarnings("RestrictedApi") 30 | @Override 31 | public void onNestedScroll(@NonNull CoordinatorLayout coordinatorLayout, @NonNull FloatingActionButton child, 32 | @NonNull View target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed, int type) { 33 | // 上滑隐藏悬浮按钮,下滑显示悬浮按钮 34 | if (dyConsumed > 0 && child.getVisibility() == View.VISIBLE) { 35 | child.setVisibility(View.INVISIBLE); 36 | } else if (dyConsumed < 0 && child.getVisibility() != View.VISIBLE) { 37 | child.show(); 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/myapplication/config/Constants.java: -------------------------------------------------------------------------------- 1 | package com.example.myapplication.config; 2 | 3 | /** 4 | * @author : devel 5 | * @date : 2020/2/19 12:28 6 | * @desc : 全局常量 7 | */ 8 | public final class Constants { 9 | 10 | public static final class ParamCode { 11 | public static final String KEY_URL = "key_url"; 12 | public static final String PARAM1 = "param_1"; 13 | public static final String PARAM2 = "param_2"; 14 | public static final String PARAM3 = "param_3"; 15 | } 16 | 17 | public static final class HawkCode { 18 | public static final String LOGIN_DATA = "login_data"; 19 | public static final String COOKIE = "cookie"; 20 | public static final String HEADER_IMAGE = "header_image"; 21 | public static final String SPLASH_IMAGE_URL = "splash_image_url"; 22 | 23 | } 24 | 25 | public static final class RequestCode { 26 | public static int SELECT_PICTURE = 10000; 27 | 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/myapplication/config/LoadState.java: -------------------------------------------------------------------------------- 1 | package com.example.myapplication.config; 2 | 3 | /** 4 | * 加载状态 5 | */ 6 | public enum LoadState { 7 | 8 | /** 9 | * 加载中 10 | */ 11 | LOADING, 12 | 13 | /** 14 | * 没有网络 15 | */ 16 | NO_NETWORK, 17 | 18 | /** 19 | * 没有数据 20 | */ 21 | NO_DATA, 22 | 23 | /** 24 | * 加载出错 25 | */ 26 | ERROR, 27 | 28 | /** 29 | * 加载成功 30 | */ 31 | SUCCESS 32 | } 33 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/myapplication/http/data/HttpBaseResponse.java: -------------------------------------------------------------------------------- 1 | package com.example.myapplication.http.data; 2 | 3 | import com.google.gson.annotations.Expose; 4 | 5 | import java.io.Serializable; 6 | 7 | /** 8 | * 数据封装类型 9 | * 10 | * @author devel 11 | */ 12 | public class HttpBaseResponse implements Serializable { 13 | 14 | @Expose 15 | public int errorCode; 16 | 17 | @Expose 18 | public String errorMsg; 19 | 20 | @Expose 21 | public T data; 22 | 23 | } -------------------------------------------------------------------------------- /app/src/main/java/com/example/myapplication/http/data/HttpDisposable.java: -------------------------------------------------------------------------------- 1 | package com.example.myapplication.http.data; 2 | 3 | import io.reactivex.observers.DisposableObserver; 4 | 5 | 6 | /** 7 | * @author devel 8 | * 返回数据 9 | */ 10 | public abstract class HttpDisposable extends DisposableObserver { 11 | 12 | public HttpDisposable() { 13 | } 14 | 15 | @Override 16 | protected void onStart() { 17 | } 18 | 19 | @Override 20 | public void onNext(T value) { 21 | success(value); 22 | } 23 | 24 | @Override 25 | public void onError(Throwable e) { 26 | 27 | } 28 | 29 | @Override 30 | public void onComplete() { 31 | 32 | } 33 | 34 | public abstract void success(T t); 35 | } 36 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/myapplication/http/data/HttpResponseInterface.java: -------------------------------------------------------------------------------- 1 | package com.example.myapplication.http.data; 2 | 3 | import com.google.gson.Gson; 4 | 5 | /** 6 | * @author devel 7 | */ 8 | public interface HttpResponseInterface { 9 | 10 | /** 11 | * 获取处理掉code和msg后的信息 12 | * 13 | * @param gson 14 | * @param response 15 | * @return 16 | */ 17 | String getResponseData(Gson gson, String response); 18 | 19 | } 20 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/myapplication/http/httptool/AddCookiesInterceptor.java: -------------------------------------------------------------------------------- 1 | package com.example.myapplication.http.httptool; 2 | 3 | import android.util.Log; 4 | 5 | import com.example.myapplication.config.Constants; 6 | import com.example.myapplication.util.NetworkUtils; 7 | import com.orhanobut.hawk.Hawk; 8 | 9 | import java.io.IOException; 10 | import java.util.HashSet; 11 | 12 | import okhttp3.Interceptor; 13 | import okhttp3.Request; 14 | import okhttp3.Response; 15 | 16 | public class AddCookiesInterceptor implements Interceptor { 17 | 18 | @Override 19 | public Response intercept(Chain chain) throws IOException { 20 | 21 | if (!NetworkUtils.isConnected()) { 22 | throw new HttpException("网络连接异常,请检查网络后重试"); 23 | } 24 | Request.Builder builder = chain.request().newBuilder(); 25 | HashSet preferences = Hawk.get(Constants.HawkCode.COOKIE); 26 | if (preferences != null) { 27 | for (String cookie : preferences) { 28 | builder.addHeader("Cookie", cookie); 29 | Log.v("OkHttp", "Adding Header: " + cookie); 30 | // This is done so I know which headers are being added; this interceptor is used after the normal logging of OkHttp 31 | 32 | } 33 | } 34 | return chain.proceed(builder.build()); 35 | } 36 | } -------------------------------------------------------------------------------- /app/src/main/java/com/example/myapplication/http/httptool/HttpException.java: -------------------------------------------------------------------------------- 1 | package com.example.myapplication.http.httptool; 2 | 3 | import android.text.TextUtils; 4 | 5 | 6 | /** 7 | * 自定义异常抛出 8 | * 9 | * @author devel 10 | */ 11 | public class HttpException extends RuntimeException { 12 | 13 | public HttpException(String message) { 14 | this.message = message; 15 | } 16 | 17 | public HttpException(int code, String message) { 18 | this.message = message; 19 | this.code = code; 20 | } 21 | 22 | @Override 23 | public String getMessage() { 24 | return TextUtils.isEmpty(message) ? "" : message; 25 | } 26 | 27 | 28 | public int getCode() { 29 | return code; 30 | } 31 | 32 | private int code; 33 | private String message; 34 | 35 | } 36 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/myapplication/http/httptool/ResponseConverterFactory.java: -------------------------------------------------------------------------------- 1 | package com.example.myapplication.http.httptool; 2 | 3 | import android.text.TextUtils; 4 | 5 | import com.example.myapplication.http.request.HttpFactory; 6 | import com.google.gson.Gson; 7 | 8 | import java.lang.annotation.Annotation; 9 | import java.lang.reflect.Type; 10 | 11 | import okhttp3.RequestBody; 12 | import okhttp3.ResponseBody; 13 | import retrofit2.Converter; 14 | import retrofit2.Retrofit; 15 | import retrofit2.converter.gson.GsonConverterFactory; 16 | 17 | /** 18 | * 处理服务器返回数据 19 | * 将数据转换成对象 20 | * 21 | * @author devel 22 | */ 23 | public class ResponseConverterFactory extends Converter.Factory { 24 | 25 | private final Gson mGson; 26 | 27 | public ResponseConverterFactory(Gson gson) { 28 | this.mGson = gson; 29 | } 30 | 31 | public static ResponseConverterFactory create() { 32 | return create(new Gson()); 33 | } 34 | 35 | public static ResponseConverterFactory create(Gson gson) { 36 | if (gson == null) throw new NullPointerException("gson == null"); 37 | return new ResponseConverterFactory(gson); 38 | } 39 | 40 | @Override 41 | public Converter responseBodyConverter(Type type, Annotation[] annotations, Retrofit retrofit) { 42 | return new BaseResponseBodyConverter(type); 43 | } 44 | 45 | @Override 46 | public Converter requestBodyConverter(Type type, Annotation[] parameterAnnotations, Annotation[] methodAnnotations, Retrofit retrofit) { 47 | return GsonConverterFactory.create().requestBodyConverter(type, parameterAnnotations, methodAnnotations, retrofit); 48 | } 49 | 50 | private class BaseResponseBodyConverter implements Converter { 51 | private Type mType; 52 | 53 | private BaseResponseBodyConverter(Type mType) { 54 | this.mType = mType; 55 | } 56 | 57 | @Override 58 | public T convert(ResponseBody response) { 59 | Object object; 60 | try { 61 | String strResponse = response.string(); 62 | if (TextUtils.isEmpty(strResponse)) { 63 | throw new HttpException("返回值是空的—-—"); 64 | } 65 | 66 | if (HttpFactory.httpResponseInterface == null) { 67 | throw new HttpException("请实现接口HttpResponseInterface—-—"); 68 | } else { 69 | String strData = HttpFactory.httpResponseInterface.getResponseData(mGson, strResponse); 70 | object = mGson.fromJson(strData, mType); 71 | } 72 | } catch (Exception e) { 73 | throw new HttpException(e.getMessage()); 74 | } finally { 75 | response.close(); 76 | } 77 | return (T) object; 78 | } 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/myapplication/http/httptool/UploadUtils.java: -------------------------------------------------------------------------------- 1 | package com.example.myapplication.http.httptool; 2 | 3 | import android.text.TextUtils; 4 | 5 | import java.io.File; 6 | import java.util.List; 7 | 8 | import okhttp3.MediaType; 9 | import okhttp3.MultipartBody; 10 | import okhttp3.RequestBody; 11 | 12 | /** 13 | * Created by iCong. 14 | * Time:2017年7月6日. 15 | * Retrofit文件上传 16 | */ 17 | 18 | public class UploadUtils { 19 | private static final String FILE_NOT_NULL = "文件不能为空"; 20 | private static final String FILE_PATH_NOT_NULL = "文件路径不能为空"; 21 | 22 | public static MultipartBody.Part getMultipartBody(String path) { 23 | if (TextUtils.isEmpty(path)) throw new NullPointerException(FILE_PATH_NOT_NULL); 24 | File file = new File(path); 25 | if (file.exists()) { 26 | RequestBody requestFile = 27 | RequestBody.create(MediaType.parse("application/octet-stream"), file); 28 | MultipartBody.Part body = 29 | MultipartBody.Part.createFormData("imgFile", file.getName(), requestFile); 30 | return body; 31 | } else { 32 | // throw new NullPointerException(FILE_NOT_NULL); 33 | return null; 34 | } 35 | } 36 | 37 | public static MultipartBody.Part getMultipartBody(File file) { 38 | if (file.exists()) { 39 | RequestBody requestFile = 40 | RequestBody.create(MediaType.parse("application/octet-stream"), file); 41 | MultipartBody.Part body = 42 | MultipartBody.Part.createFormData("file", file.getName(), requestFile); 43 | return body; 44 | } else { 45 | throw new NullPointerException(FILE_NOT_NULL); 46 | } 47 | } 48 | 49 | public static List getMultipartBodysForFile(List files) { 50 | if (files.isEmpty()) throw new NullPointerException(FILE_NOT_NULL); 51 | MultipartBody.Builder builder = new MultipartBody.Builder(); 52 | for (File file : files) { 53 | if (file.exists()) { 54 | RequestBody requestFile = 55 | RequestBody.create(MediaType.parse("application/octet-stream"), file); 56 | builder.addFormDataPart("file", file.getName(), requestFile); 57 | } else { 58 | throw new NullPointerException(FILE_NOT_NULL); 59 | } 60 | } 61 | return builder.build().parts(); 62 | } 63 | 64 | public static List getMultipartBodysForPath(List paths) { 65 | if (paths.isEmpty()) throw new NullPointerException(FILE_PATH_NOT_NULL); 66 | MultipartBody.Builder builder = new MultipartBody.Builder(); 67 | for (String path : paths) { 68 | File file = new File(path); 69 | if (file.exists()) { 70 | RequestBody requestFile = 71 | RequestBody.create(MediaType.parse("application/octet-stream"), file); 72 | builder.addFormDataPart("file", file.getName(), requestFile); 73 | } else { 74 | throw new NullPointerException(FILE_NOT_NULL); 75 | } 76 | } 77 | return builder.build().parts(); 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/myapplication/http/request/APIConstants.java: -------------------------------------------------------------------------------- 1 | package com.example.myapplication.http.request; 2 | 3 | 4 | /** 5 | * 服务器地址 6 | * 7 | * @author devel 8 | */ 9 | public class APIConstants { 10 | 11 | public static String API_DEFAULT_HOST = "https://cn.bing.com/"; 12 | 13 | } 14 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/myapplication/http/request/HttpFactory.java: -------------------------------------------------------------------------------- 1 | package com.example.myapplication.http.request; 2 | 3 | 4 | import com.example.myapplication.http.data.HttpResponseInterface; 5 | import com.example.myapplication.http.httptool.AddCookiesInterceptor; 6 | import com.example.myapplication.http.httptool.HttpInterceptor; 7 | import com.example.myapplication.http.httptool.ResponseConverterFactory; 8 | 9 | import java.util.concurrent.TimeUnit; 10 | 11 | import io.reactivex.Observable; 12 | import io.reactivex.ObservableSource; 13 | import io.reactivex.ObservableTransformer; 14 | import io.reactivex.android.schedulers.AndroidSchedulers; 15 | import io.reactivex.schedulers.Schedulers; 16 | import okhttp3.OkHttpClient; 17 | import okhttp3.OkHttpClient.Builder; 18 | import retrofit2.Retrofit; 19 | import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory; 20 | 21 | 22 | /** 23 | * @author devel 24 | * 网络请求 25 | */ 26 | public class HttpFactory { 27 | 28 | public static String HTTP_HOST_URL = ""; 29 | public static HttpResponseInterface httpResponseInterface = null; 30 | 31 | private HttpFactory() { 32 | } 33 | 34 | /** 35 | * 设置HttpClient 36 | */ 37 | private static OkHttpClient HTTP_CLIENT = 38 | new Builder() 39 | //添加自定义拦截器 40 | .addInterceptor(new HttpInterceptor()) 41 | .addInterceptor(new AddCookiesInterceptor()) 42 | //设置超时时间 43 | .connectTimeout(60, TimeUnit.SECONDS) 44 | .readTimeout(60, TimeUnit.SECONDS) 45 | .build(); 46 | 47 | private static Retrofit retrofit = null; 48 | 49 | public static T getChangeUrlInstance(String url, Class service) { 50 | return new Retrofit.Builder().baseUrl(url) 51 | .addConverterFactory(ResponseConverterFactory.create()) 52 | .addCallAdapterFactory(RxJava2CallAdapterFactory.create()) 53 | .client(HTTP_CLIENT) 54 | .build() 55 | .create(service); 56 | } 57 | 58 | public static T getInstance(Class service) { 59 | if (retrofit == null) { 60 | retrofit = new Retrofit.Builder().baseUrl(HTTP_HOST_URL) 61 | .addConverterFactory(ResponseConverterFactory.create()) 62 | .addCallAdapterFactory(RxJava2CallAdapterFactory.create()) 63 | .client(HTTP_CLIENT) 64 | .build(); 65 | } 66 | return retrofit.create(service); 67 | } 68 | 69 | 70 | @SuppressWarnings("unchecked") 71 | public static ObservableTransformer schedulers() { 72 | return new ObservableTransformer() { 73 | @Override 74 | public ObservableSource apply(Observable upstream) { 75 | return upstream.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()); 76 | } 77 | }; 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/myapplication/http/request/HttpRequest.java: -------------------------------------------------------------------------------- 1 | package com.example.myapplication.http.request; 2 | 3 | 4 | /** 5 | * @author devel 6 | */ 7 | public class HttpRequest { 8 | 9 | private static ApiAddress Instance; 10 | 11 | public static ApiAddress getInstance() { 12 | if (Instance == null) { 13 | synchronized (HttpRequest.class) { 14 | if (Instance == null) { 15 | Instance = HttpFactory.getInstance(ApiAddress.class); 16 | } 17 | } 18 | } 19 | return Instance; 20 | } 21 | 22 | public static ApiAddress getInstance(String url) { 23 | return HttpFactory.getChangeUrlInstance(url, ApiAddress.class); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/myapplication/http/request/ServerAddress.java: -------------------------------------------------------------------------------- 1 | package com.example.myapplication.http.request; 2 | 3 | 4 | /** 5 | * 服务器地址 6 | * 7 | * @author devel 8 | */ 9 | public class ServerAddress { 10 | 11 | public static final String API_BING = "https://www.bing.com/"; 12 | 13 | public static final String API_DEFAULT_HOST = "https://wanandroid.com/"; 14 | 15 | 16 | public static String getApiDefaultHost() { 17 | return API_DEFAULT_HOST; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/myapplication/manager/MyActivityManager.java: -------------------------------------------------------------------------------- 1 | package com.example.myapplication.manager; 2 | 3 | import android.app.Activity; 4 | 5 | import java.lang.ref.WeakReference; 6 | 7 | /** 8 | * @author : devel 9 | * @date : 2020/2/26 14:30 10 | * @desc : Activity管理类 11 | */ 12 | public class MyActivityManager { 13 | private static MyActivityManager sInstance = new MyActivityManager(); 14 | /** 15 | * 若引用当前Activity 16 | */ 17 | private WeakReference sCurrentActivityWeakRef; 18 | 19 | 20 | private MyActivityManager() { 21 | 22 | } 23 | 24 | public static MyActivityManager getInstance() { 25 | return sInstance; 26 | } 27 | 28 | /** 29 | * 获取当前的Activity 30 | * 31 | * @return 32 | */ 33 | public Activity getCurrentActivity() { 34 | Activity currentActivity = null; 35 | if (sCurrentActivityWeakRef != null) { 36 | currentActivity = sCurrentActivityWeakRef.get(); 37 | } 38 | return currentActivity; 39 | } 40 | 41 | /** 42 | * 保存Activity 43 | * 44 | * @param activity 45 | */ 46 | public void setCurrentActivity(Activity activity) { 47 | sCurrentActivityWeakRef = new WeakReference(activity); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/myapplication/manager/ThreadManager.java: -------------------------------------------------------------------------------- 1 | package com.example.myapplication.manager; 2 | 3 | import java.util.concurrent.Executors; 4 | import java.util.concurrent.LinkedBlockingDeque; 5 | import java.util.concurrent.ThreadPoolExecutor; 6 | import java.util.concurrent.TimeUnit; 7 | 8 | /** 9 | * 本应用的线程管理器,1:首先要做一个池子 2:必须做成单例模式(懒汉),防止创建多个线程,达不到管理效果 10 | * 3:考虑线程安全问题 11 | * Created by 2018/9/10. 12 | */ 13 | 14 | public class ThreadManager { 15 | 16 | private static ThreadPool mThreadPool; 17 | 18 | /** 19 | * 获取单例的线程池对象 20 | * 21 | * @return 22 | */ 23 | public static ThreadPool getThreadPool() { 24 | if (mThreadPool == null) { 25 | synchronized (ThreadManager.class) { 26 | if (mThreadPool == null) { 27 | int cpuNum = Runtime.getRuntime().availableProcessors(); 28 | int threadNum = cpuNum * 2 + 1; 29 | mThreadPool = new ThreadPool(threadNum, threadNum, 0L); 30 | } 31 | } 32 | } 33 | return mThreadPool; 34 | } 35 | 36 | 37 | public static class ThreadPool { 38 | 39 | private ThreadPoolExecutor mExecutor; 40 | private int corePoolSize; 41 | private int maximumPoolSize; 42 | private long keepAliveTime; 43 | 44 | private ThreadPool(int corePoolSize, int maximumPoolSize, long keepAliveTime) { 45 | this.corePoolSize = corePoolSize; 46 | this.maximumPoolSize = maximumPoolSize; 47 | this.keepAliveTime = keepAliveTime; 48 | } 49 | 50 | public void execute(Runnable runnable) { 51 | if (runnable == null) { 52 | return; 53 | } 54 | 55 | if (mExecutor == null) { 56 | mExecutor = new ThreadPoolExecutor(corePoolSize,// 核心线程数 57 | maximumPoolSize, // 最大线程数 58 | keepAliveTime, // 闲置线程存活时间 59 | TimeUnit.MILLISECONDS,// 时间单位 60 | new LinkedBlockingDeque(),// 线程队列 61 | Executors.defaultThreadFactory(),// 线程工厂 62 | new ThreadPoolExecutor.AbortPolicy()// 队列已满,而且当前线程数已经超过最大线程数时的异常处理策略 63 | ); 64 | } 65 | mExecutor.execute(runnable); 66 | } 67 | 68 | // 从线程队列中移除对象 69 | public void cancel(Runnable runnable) { 70 | if (mExecutor != null) { 71 | mExecutor.getQueue().remove(runnable); 72 | } 73 | } 74 | } 75 | } -------------------------------------------------------------------------------- /app/src/main/java/com/example/myapplication/navinterface/ScrollToTop.java: -------------------------------------------------------------------------------- 1 | package com.example.myapplication.navinterface; 2 | 3 | /** 4 | * 滚动到顶部接口 5 | */ 6 | public interface ScrollToTop { 7 | 8 | /** 9 | * 滚动到顶部 10 | */ 11 | void scrollToTop(); 12 | 13 | } 14 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/myapplication/room/AppDataBase.java: -------------------------------------------------------------------------------- 1 | package com.example.myapplication.room; 2 | 3 | import android.content.Context; 4 | 5 | import androidx.room.Room; 6 | import androidx.room.RoomDatabase; 7 | 8 | /** 9 | * @author : devel 10 | * @date : 2019/11/18 11:04 11 | * @desc : 12 | */ 13 | 14 | //@Database(entities = {WeChatBean.class}, version = 1, exportSchema = false) 15 | public abstract class AppDataBase extends RoomDatabase { 16 | 17 | /** 18 | * 19 | * 20 | * @return 21 | */ 22 | 23 | 24 | private static final String DB_NAME = "room_test"; 25 | 26 | private static volatile AppDataBase appDataBase; 27 | 28 | public static AppDataBase getInstance(Context context) { 29 | if (appDataBase == null) { 30 | synchronized (AppDataBase.class) { 31 | if (appDataBase == null) { 32 | appDataBase = Room.databaseBuilder(context, AppDataBase.class, DB_NAME) 33 | .build(); 34 | } 35 | } 36 | } 37 | return appDataBase; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/myapplication/ui/activity/login/FragmentLogin.java: -------------------------------------------------------------------------------- 1 | package com.example.myapplication.ui.activity.login; 2 | 3 | import com.example.myapplication.R; 4 | import com.example.myapplication.base.BaseFragment; 5 | import com.example.myapplication.databinding.LoginFragmentBinding; 6 | 7 | import androidx.lifecycle.ViewModelProviders; 8 | 9 | /** 10 | * @author : devel 11 | * @date : 2020/2/28 14:28 12 | * @desc : 登录 13 | */ 14 | public class FragmentLogin extends BaseFragment { 15 | @Override 16 | protected int getLayoutResId() { 17 | return R.layout.login_fragment; 18 | } 19 | 20 | @Override 21 | protected void initViewModel() { 22 | mViewModel = ViewModelProviders.of(getActivity()).get(LoginViewModel.class); 23 | 24 | } 25 | 26 | @Override 27 | protected void bindViewModel() { 28 | mDataBinding.setViewModel(mViewModel); 29 | mDataBinding.setActivity((LoginActivity) getActivity()); 30 | } 31 | 32 | @Override 33 | protected void init() { 34 | 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/myapplication/ui/activity/login/FragmentRegister.java: -------------------------------------------------------------------------------- 1 | package com.example.myapplication.ui.activity.login; 2 | 3 | import com.example.myapplication.R; 4 | import com.example.myapplication.base.BaseFragment; 5 | import com.example.myapplication.databinding.RegisterFragmentBinding; 6 | 7 | import androidx.lifecycle.ViewModelProviders; 8 | 9 | /** 10 | * @author : devel 11 | * @date : 2020/2/28 14:28 12 | * @desc :注册 13 | */ 14 | public class FragmentRegister extends BaseFragment { 15 | 16 | @Override 17 | protected int getLayoutResId() { 18 | return R.layout.register_fragment; 19 | } 20 | 21 | @Override 22 | protected void initViewModel() { 23 | mViewModel = ViewModelProviders.of(getActivity()).get(LoginViewModel.class); 24 | } 25 | 26 | @Override 27 | protected void bindViewModel() { 28 | mDataBinding.setViewModel(mViewModel); 29 | mDataBinding.setActivity((LoginActivity) getActivity()); 30 | } 31 | 32 | @Override 33 | protected void init() { 34 | 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/myapplication/ui/activity/login/LoginActivity.java: -------------------------------------------------------------------------------- 1 | package com.example.myapplication.ui.activity.login; 2 | 3 | import android.content.Context; 4 | import android.content.Intent; 5 | import android.widget.Toast; 6 | 7 | import com.example.myapplication.R; 8 | import com.example.myapplication.base.BaseActivity; 9 | import com.example.myapplication.databinding.ActivityLoginBinding; 10 | import com.example.myapplication.bean.responsebean.LoginBean; 11 | import com.example.myapplication.ui.activity.main.MainActivity; 12 | import com.example.myapplication.ui.adapter.FmPagerAdapter; 13 | 14 | import java.util.ArrayList; 15 | import java.util.List; 16 | 17 | import androidx.fragment.app.Fragment; 18 | import androidx.lifecycle.Observer; 19 | import androidx.lifecycle.ViewModelProviders; 20 | 21 | /** 22 | * @author : devel 23 | * @date : 2020/2/28 14:20 24 | * @desc : 25 | */ 26 | public class LoginActivity extends BaseActivity { 27 | 28 | public static void start(Context context) { 29 | Intent intent = new Intent(context, LoginActivity.class); 30 | context.startActivity(intent); 31 | } 32 | 33 | @Override 34 | protected int getLayoutResId() { 35 | return R.layout.activity_login; 36 | } 37 | 38 | @Override 39 | protected void initViewModel() { 40 | mViewModel = ViewModelProviders.of(this).get(LoginViewModel.class); 41 | } 42 | 43 | @Override 44 | protected void bindViewModel() { 45 | 46 | } 47 | 48 | @Override 49 | protected void init() { 50 | List fragments = new ArrayList<>(); 51 | fragments.add(new FragmentLogin()); 52 | fragments.add(new FragmentRegister()); 53 | 54 | FmPagerAdapter adapter = new FmPagerAdapter(getSupportFragmentManager(), fragments); 55 | mDataBinding.viewPager.setAdapter(adapter); 56 | 57 | initData(); 58 | } 59 | 60 | public void initData() { 61 | mViewModel.getUserBean().observe(this, new Observer() { 62 | @Override 63 | public void onChanged(LoginBean bean) { 64 | if (bean != null) { 65 | //登录成功,跳转到首页 66 | MainActivity.start(LoginActivity.this, true); 67 | finish(); 68 | } 69 | } 70 | }); 71 | 72 | mViewModel.getRegisterStatus().observe(this, new Observer() { 73 | @Override 74 | public void onChanged(Object register) { 75 | //注册成功,返回到登录界面 76 | Toast.makeText(LoginActivity.this, "注册成功", Toast.LENGTH_SHORT).show(); 77 | mViewModel.clearUserPwd(); 78 | goToLogin(); 79 | } 80 | }); 81 | } 82 | 83 | /** 84 | * 跳转到登录界面 85 | */ 86 | public void goToLogin() { 87 | mDataBinding.viewPager.setCurrentItem(0); 88 | } 89 | 90 | 91 | /** 92 | * 跳转到注册界面 93 | */ 94 | public void goToRegister() { 95 | mViewModel.clearUserPwd(); 96 | mDataBinding.viewPager.setCurrentItem(1); 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/myapplication/ui/activity/splash/SplashActivity.java: -------------------------------------------------------------------------------- 1 | package com.example.myapplication.ui.activity.splash; 2 | 3 | import android.os.Bundle; 4 | 5 | import com.bumptech.glide.Glide; 6 | import com.example.myapplication.config.App; 7 | import com.example.myapplication.R; 8 | import com.example.myapplication.base.BaseActivity; 9 | import com.example.myapplication.config.Constants; 10 | import com.example.myapplication.databinding.ActivitySplashBinding; 11 | import com.example.myapplication.bean.ActivitySkip; 12 | import com.example.myapplication.bean.responsebean.ImageBean; 13 | import com.example.myapplication.ui.activity.main.MainActivity; 14 | import com.example.myapplication.ui.activity.web.DetailsActivity; 15 | import com.example.myapplication.util.CommonUtils; 16 | import com.orhanobut.hawk.Hawk; 17 | 18 | import androidx.annotation.Nullable; 19 | import androidx.lifecycle.Observer; 20 | import androidx.lifecycle.ViewModelProviders; 21 | 22 | /** 23 | * @author : devel 24 | * @date : 2020/2/21 17:00 25 | * @desc : 闪屏页 26 | */ 27 | public class SplashActivity extends BaseActivity { 28 | 29 | @Override 30 | protected void onCreate(@Nullable Bundle savedInstanceState) { 31 | App.firstOpen = true; 32 | super.onCreate(savedInstanceState); 33 | } 34 | 35 | @Override 36 | protected boolean isNoActionBar() { 37 | //沉浸式主题 38 | return true; 39 | } 40 | 41 | @Override 42 | protected int getLayoutResId() { 43 | return R.layout.activity_splash; 44 | } 45 | 46 | @Override 47 | protected void initViewModel() { 48 | mViewModel = ViewModelProviders.of(this).get(SplashViewModel.class); 49 | } 50 | 51 | @Override 52 | protected void bindViewModel() { 53 | mDataBinding.setViewModel(mViewModel); 54 | } 55 | 56 | @Override 57 | protected void init() { 58 | //加载闪屏页图片 59 | mViewModel.getImageData().observe(this, imageBean -> { 60 | if (imageBean != null) { 61 | String url = imageBean.getImages().get(0).getBaseUrl() 62 | + imageBean.getImages().get(0).getUrl(); 63 | 64 | Glide.with(SplashActivity.this) 65 | .load(url) 66 | .into(mDataBinding.ivSplash); 67 | 68 | Hawk.put(Constants.HawkCode.SPLASH_IMAGE_URL, url); 69 | } else { 70 | //从网络获取图片失败,加载本地默认图片 71 | Glide.with(SplashActivity.this) 72 | .load(R.mipmap.splash_bg) 73 | .into(mDataBinding.ivSplash); 74 | } 75 | }); 76 | 77 | //跳转到指定的界面 78 | mViewModel.getActivitySkip().observe(this, activitySkip -> { 79 | if ("DetailsActivity".equals(activitySkip.getmActivity())) { 80 | if (!CommonUtils.isStringEmpty(activitySkip.getParam1())) { 81 | DetailsActivity.start(SplashActivity.this, 82 | activitySkip.getParam1(), true); 83 | finish(); 84 | } else { 85 | MainActivity.start(SplashActivity.this, false); 86 | finish(); 87 | } 88 | } else if ("MainActivity".equals(activitySkip.getmActivity())) { 89 | MainActivity.start(SplashActivity.this, false); 90 | finish(); 91 | } 92 | }); 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/myapplication/ui/activity/web/DetailsViewModel.java: -------------------------------------------------------------------------------- 1 | package com.example.myapplication.ui.activity.web; 2 | 3 | 4 | import com.example.myapplication.base.viewmodel.BaseViewModel; 5 | 6 | /** 7 | * 详情页的ViewModel 8 | */ 9 | public class DetailsViewModel extends BaseViewModel { 10 | 11 | 12 | public DetailsViewModel() { 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/myapplication/ui/adapter/ArticleListPagerAdapter.java: -------------------------------------------------------------------------------- 1 | package com.example.myapplication.ui.adapter; 2 | 3 | import com.example.myapplication.base.adapter.BasePagerAdapter; 4 | import com.example.myapplication.bean.responsebean.WeChatBean; 5 | import com.example.myapplication.ui.articlelist.ArticleListFragment; 6 | 7 | import androidx.annotation.Nullable; 8 | import androidx.fragment.app.Fragment; 9 | import androidx.fragment.app.FragmentManager; 10 | 11 | /** 12 | * 微信公众号列表PagerAdapter 13 | * 14 | * @author devel 15 | */ 16 | public class ArticleListPagerAdapter extends BasePagerAdapter { 17 | 18 | public ArticleListPagerAdapter(FragmentManager fragmentManager) { 19 | super(fragmentManager); 20 | } 21 | 22 | @Override 23 | public Fragment getItem(int position) { 24 | Fragment fragment = mFragmentMap.get(position); 25 | if (fragment == null) { 26 | WeChatBean chapter = mDataList.get(position); 27 | fragment = ArticleListFragment.newInstance(0, chapter.getId()); 28 | mFragmentMap.put(position, fragment); 29 | } 30 | return fragment; 31 | } 32 | 33 | @Nullable 34 | @Override 35 | public CharSequence getPageTitle(int position) { 36 | WeChatBean chapter = mDataList.get(position); 37 | return chapter.getName(); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/myapplication/ui/adapter/BannerViewHolder.java: -------------------------------------------------------------------------------- 1 | package com.example.myapplication.ui.adapter; 2 | 3 | import android.content.Context; 4 | import android.view.LayoutInflater; 5 | import android.view.View; 6 | import android.widget.ImageView; 7 | 8 | import com.bumptech.glide.Glide; 9 | import com.example.myapplication.R; 10 | import com.example.myapplication.bean.responsebean.HomeBanner; 11 | import com.zhouwei.mzbanner.holder.MZViewHolder; 12 | 13 | /** 14 | * @author : devel 15 | * @date : 2020/2/20 8:55 16 | * @desc : 17 | */ 18 | public class BannerViewHolder implements MZViewHolder { 19 | private ImageView mImageView; 20 | 21 | @Override 22 | public View createView(Context context) { 23 | View view = LayoutInflater.from(context).inflate(R.layout.remote_banner_item, null); 24 | mImageView = (ImageView) view.findViewById(R.id.remote_item_image); 25 | return view; 26 | } 27 | 28 | @Override 29 | public void onBind(Context context, int i, HomeBanner homeBanner) { 30 | Glide.with(context).load(homeBanner.getImagePath()).into(mImageView); 31 | } 32 | } -------------------------------------------------------------------------------- /app/src/main/java/com/example/myapplication/ui/adapter/CommonViewHolder.java: -------------------------------------------------------------------------------- 1 | package com.example.myapplication.ui.adapter; 2 | 3 | 4 | import androidx.annotation.NonNull; 5 | import androidx.databinding.ViewDataBinding; 6 | import androidx.recyclerview.widget.RecyclerView; 7 | 8 | /** 9 | * @author devel 10 | */ 11 | public class CommonViewHolder extends RecyclerView.ViewHolder { 12 | 13 | ViewDataBinding binding; 14 | 15 | public CommonViewHolder(@NonNull ViewDataBinding binding) { 16 | super(binding.getRoot()); 17 | this.binding = binding; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/myapplication/ui/adapter/FmPagerAdapter.java: -------------------------------------------------------------------------------- 1 | package com.example.myapplication.ui.adapter; 2 | 3 | import android.view.ViewGroup; 4 | 5 | import java.util.ArrayList; 6 | import java.util.List; 7 | 8 | import androidx.annotation.NonNull; 9 | import androidx.annotation.Nullable; 10 | import androidx.fragment.app.Fragment; 11 | import androidx.fragment.app.FragmentManager; 12 | import androidx.fragment.app.FragmentPagerAdapter; 13 | 14 | /** 15 | * @author devel 16 | */ 17 | public class FmPagerAdapter extends FragmentPagerAdapter { 18 | 19 | private Fragment mCurrentFragment; 20 | private List fragmentList = new ArrayList<>(); 21 | private List sTitle = new ArrayList<>(); 22 | 23 | public FmPagerAdapter(@NonNull FragmentManager fm, List fragments) { 24 | super(fm); 25 | fragmentList = fragments; 26 | } 27 | 28 | public FmPagerAdapter(@NonNull FragmentManager fm, List fragments, List list) { 29 | super(fm); 30 | fragmentList = fragments; 31 | sTitle = list; 32 | } 33 | 34 | @NonNull 35 | @Override 36 | public Fragment getItem(int position) { 37 | return fragmentList.get(position); 38 | } 39 | 40 | @Override 41 | public int getCount() { 42 | return fragmentList.size(); 43 | } 44 | 45 | @Nullable 46 | @Override 47 | public CharSequence getPageTitle(int position) { 48 | if (sTitle != null && sTitle.size() != 0) { 49 | return sTitle.get(position); 50 | } else { 51 | return null; 52 | } 53 | } 54 | 55 | 56 | @Override 57 | public void setPrimaryItem(ViewGroup container, int position, Object object) { 58 | mCurrentFragment = (Fragment) object; 59 | super.setPrimaryItem(container, position, object); 60 | } 61 | 62 | 63 | public Fragment getCurrentFragment() { 64 | return mCurrentFragment; 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/myapplication/ui/bottom/navi/NaviViewModel.java: -------------------------------------------------------------------------------- 1 | package com.example.myapplication.ui.bottom.navi; 2 | 3 | import com.example.myapplication.base.viewmodel.BaseViewModel; 4 | import com.example.myapplication.config.LoadState; 5 | import com.example.myapplication.bean.responsebean.NavigationBean; 6 | import com.example.myapplication.http.data.HttpDisposable; 7 | import com.example.myapplication.http.request.HttpFactory; 8 | import com.example.myapplication.http.request.HttpRequest; 9 | import com.example.myapplication.util.CommonUtils; 10 | import com.example.myapplication.util.NetworkUtils; 11 | 12 | import java.util.List; 13 | 14 | import androidx.databinding.ObservableArrayList; 15 | import androidx.databinding.ObservableList; 16 | import androidx.lifecycle.LiveData; 17 | import androidx.lifecycle.MutableLiveData; 18 | 19 | /** 20 | * @author devel 21 | */ 22 | public class NaviViewModel extends BaseViewModel { 23 | 24 | public MutableLiveData> dataList; 25 | 26 | /** 27 | * 标题 28 | */ 29 | public final ObservableList mTitlesList = new ObservableArrayList<>(); 30 | 31 | public NaviViewModel() { 32 | dataList = new MutableLiveData<>(); 33 | } 34 | 35 | public LiveData> getDataList() { 36 | return dataList; 37 | } 38 | 39 | public void loadNavigationData() { 40 | //判断网络 41 | if (!NetworkUtils.isConnected()) { 42 | loadState.postValue(LoadState.NO_NETWORK); 43 | return; 44 | } 45 | loadState.postValue(LoadState.LOADING); 46 | HttpRequest.getInstance() 47 | .getNavigationBean() 48 | .compose(HttpFactory.schedulers()) 49 | .subscribe(new HttpDisposable>() { 50 | @Override 51 | public void success(List listBean) { 52 | if (!CommonUtils.isListEmpty(listBean)) { 53 | loadState.postValue(LoadState.SUCCESS); 54 | for (NavigationBean baan : listBean) { 55 | mTitlesList.add(baan.getName()); 56 | } 57 | dataList.postValue(listBean); 58 | } else { 59 | loadState.postValue(LoadState.NO_DATA); 60 | } 61 | } 62 | 63 | @Override 64 | public void onError(Throwable e) { 65 | loadState.postValue(LoadState.ERROR); 66 | } 67 | }); 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/myapplication/ui/bottom/project/ProjectFragment.java: -------------------------------------------------------------------------------- 1 | package com.example.myapplication.ui.bottom.project; 2 | 3 | import android.os.Bundle; 4 | 5 | import com.example.myapplication.R; 6 | import com.example.myapplication.base.BaseFragment; 7 | import com.example.myapplication.navinterface.ScrollToTop; 8 | import com.example.myapplication.config.Constants; 9 | import com.example.myapplication.databinding.FragmentProjectViewPagerBinding; 10 | import com.example.myapplication.bean.responsebean.WeChatBean; 11 | import com.example.myapplication.ui.adapter.FmPagerAdapter; 12 | import com.example.myapplication.ui.articlelist.ArticleListFragment; 13 | 14 | import java.util.ArrayList; 15 | import java.util.List; 16 | 17 | import androidx.fragment.app.Fragment; 18 | import androidx.lifecycle.Observer; 19 | import androidx.lifecycle.ViewModelProviders; 20 | 21 | /** 22 | * @author devel 23 | */ 24 | public class ProjectFragment extends BaseFragment implements ScrollToTop { 25 | 26 | private FmPagerAdapter adapter; 27 | private int pos; 28 | 29 | @Override 30 | protected void handleArguments(Bundle args) { 31 | super.handleArguments(args); 32 | pos = args.getInt(Constants.ParamCode.PARAM2, 0); 33 | } 34 | 35 | 36 | @Override 37 | protected int getLayoutResId() { 38 | return R.layout.fragment_project_view_pager; 39 | } 40 | 41 | @Override 42 | protected void initViewModel() { 43 | mViewModel = ViewModelProviders.of(this).get(ProjectViewModel.class); 44 | } 45 | 46 | @Override 47 | protected void bindViewModel() { 48 | mDataBinding.setViewModel(mViewModel); 49 | } 50 | 51 | @Override 52 | protected boolean isSupportLoad() { 53 | return true; 54 | } 55 | 56 | @Override 57 | protected void init() { 58 | 59 | mViewModel.loadProject(); 60 | initData(); 61 | } 62 | 63 | private void initData() { 64 | mViewModel.getDataList().observe(this, new Observer>() { 65 | @Override 66 | public void onChanged(List weChatBeans) { 67 | initViewPager(weChatBeans); 68 | } 69 | }); 70 | } 71 | 72 | private void initViewPager(List mList) { 73 | List fragments = new ArrayList<>(); 74 | List sTitle = new ArrayList<>(); 75 | for (WeChatBean system : mList) { 76 | mDataBinding.tabLayout.addTab(mDataBinding.tabLayout.newTab().setText(system.getName())); 77 | sTitle.add(system.getName()); 78 | fragments.add(ArticleListFragment.newInstance(2, system.getId())); 79 | } 80 | mDataBinding.tabLayout.setupWithViewPager(mDataBinding.viewPager); 81 | 82 | adapter = new FmPagerAdapter(getChildFragmentManager(), fragments, sTitle); 83 | mDataBinding.viewPager.setAdapter(adapter); 84 | mDataBinding.viewPager.setCurrentItem(pos); 85 | } 86 | 87 | @Override 88 | public void scrollToTop() { 89 | ArticleListFragment fragment = (ArticleListFragment) adapter.getCurrentFragment(); 90 | if (fragment != null) { 91 | fragment.scrollToTop(); 92 | } 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/myapplication/ui/bottom/project/ProjectViewModel.java: -------------------------------------------------------------------------------- 1 | package com.example.myapplication.ui.bottom.project; 2 | 3 | import com.example.myapplication.base.viewmodel.BaseViewModel; 4 | import com.example.myapplication.config.LoadState; 5 | import com.example.myapplication.bean.responsebean.WeChatBean; 6 | import com.example.myapplication.http.data.HttpDisposable; 7 | import com.example.myapplication.http.request.HttpFactory; 8 | import com.example.myapplication.http.request.HttpRequest; 9 | import com.example.myapplication.util.CommonUtils; 10 | import com.example.myapplication.util.NetworkUtils; 11 | 12 | import java.util.List; 13 | 14 | import androidx.lifecycle.LiveData; 15 | import androidx.lifecycle.MutableLiveData; 16 | 17 | /** 18 | * @author devel 19 | */ 20 | public class ProjectViewModel extends BaseViewModel { 21 | 22 | public MutableLiveData> dataList; 23 | 24 | public ProjectViewModel() { 25 | dataList = new MutableLiveData<>(); 26 | } 27 | 28 | 29 | public LiveData> getDataList() { 30 | return dataList; 31 | } 32 | 33 | /** 34 | * 获取项目分类列表 35 | */ 36 | public void loadProject() { 37 | //判断网络 38 | if (!NetworkUtils.isConnected()) { 39 | loadState.postValue(LoadState.NO_NETWORK); 40 | return; 41 | } 42 | loadState.postValue(LoadState.LOADING); 43 | HttpRequest.getInstance() 44 | .getProjectListData() 45 | .compose(HttpFactory.schedulers()) 46 | .subscribe(new HttpDisposable>() { 47 | @Override 48 | public void success(List listHttpBaseResponse) { 49 | if (!CommonUtils.isListEmpty(listHttpBaseResponse)) { 50 | dataList.postValue(listHttpBaseResponse); 51 | loadState.postValue(LoadState.SUCCESS); 52 | } else { 53 | loadState.postValue(LoadState.NO_DATA); 54 | } 55 | } 56 | }); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/myapplication/ui/bottom/system/SystemViewModel.java: -------------------------------------------------------------------------------- 1 | package com.example.myapplication.ui.bottom.system; 2 | 3 | import com.example.myapplication.base.viewmodel.BaseViewModel; 4 | import com.example.myapplication.config.LoadState; 5 | import com.example.myapplication.bean.responsebean.WeChatBean; 6 | import com.example.myapplication.http.data.HttpDisposable; 7 | import com.example.myapplication.http.request.HttpFactory; 8 | import com.example.myapplication.http.request.HttpRequest; 9 | import com.example.myapplication.util.CommonUtils; 10 | import com.example.myapplication.util.NetworkUtils; 11 | 12 | import java.util.List; 13 | 14 | import androidx.lifecycle.LiveData; 15 | import androidx.lifecycle.MutableLiveData; 16 | 17 | /** 18 | * @author devel 19 | */ 20 | public class SystemViewModel extends BaseViewModel { 21 | 22 | private MutableLiveData> mSystemList; 23 | 24 | 25 | public SystemViewModel() { 26 | mSystemList = new MutableLiveData<>(); 27 | } 28 | 29 | public LiveData> getSystemList() { 30 | return mSystemList; 31 | } 32 | 33 | /** 34 | * 刷新 35 | */ 36 | public void refreshData() { 37 | querySystemList(); 38 | } 39 | 40 | /** 41 | * 重新加载 42 | */ 43 | @Override 44 | public void reloadData() { 45 | loadData(); 46 | } 47 | 48 | /** 49 | * 第一次加载数据 50 | */ 51 | public void loadData() { 52 | loadState.postValue(LoadState.LOADING); 53 | querySystemList(); 54 | } 55 | 56 | /** 57 | * 获取体系列表详情 58 | */ 59 | private void querySystemList() { 60 | //判断网络 61 | if (!NetworkUtils.isConnected()) { 62 | loadState.postValue(LoadState.NO_NETWORK); 63 | return; 64 | } 65 | HttpRequest.getInstance() 66 | .getSystemList() 67 | .compose(HttpFactory.schedulers()) 68 | .subscribe(new HttpDisposable>() { 69 | @Override 70 | public void success(List bean) { 71 | if (!CommonUtils.isListEmpty(bean)) { 72 | loadState.postValue(LoadState.SUCCESS); 73 | mSystemList.postValue(bean); 74 | } else { 75 | loadState.postValue(LoadState.NO_DATA); 76 | } 77 | } 78 | @Override 79 | public void onError(Throwable e) { 80 | loadState.postValue(LoadState.ERROR); 81 | } 82 | }); 83 | } 84 | 85 | } -------------------------------------------------------------------------------- /app/src/main/java/com/example/myapplication/ui/bottom/system/systemchildren/SystemChildrenFragment.java: -------------------------------------------------------------------------------- 1 | package com.example.myapplication.ui.bottom.system.systemchildren; 2 | 3 | import android.os.Bundle; 4 | 5 | import com.example.myapplication.R; 6 | import com.example.myapplication.base.BaseFragment; 7 | import com.example.myapplication.navinterface.ScrollToTop; 8 | import com.example.myapplication.config.Constants; 9 | import com.example.myapplication.databinding.FragmentViewPagerBinding; 10 | import com.example.myapplication.bean.responsebean.WeChatBean; 11 | import com.example.myapplication.ui.adapter.FmPagerAdapter; 12 | import com.example.myapplication.ui.articlelist.ArticleListFragment; 13 | 14 | import java.util.ArrayList; 15 | import java.util.List; 16 | 17 | import androidx.fragment.app.Fragment; 18 | import androidx.lifecycle.ViewModelProviders; 19 | 20 | /** 21 | * @author : devel 22 | * @date : 2020/2/27 9:46 23 | * @desc : 24 | */ 25 | public class SystemChildrenFragment extends BaseFragment implements ScrollToTop { 26 | 27 | private FmPagerAdapter adapter; 28 | private List mList; 29 | private int pos; 30 | 31 | @Override 32 | protected void handleArguments(Bundle args) { 33 | super.handleArguments(args); 34 | pos = args.getInt(Constants.ParamCode.PARAM2); 35 | mList = (List) args.getSerializable(Constants.ParamCode.PARAM1); 36 | } 37 | 38 | 39 | @Override 40 | protected int getLayoutResId() { 41 | return R.layout.fragment_view_pager; 42 | } 43 | 44 | @Override 45 | protected void initViewModel() { 46 | mViewModel = ViewModelProviders.of(this).get(SystemChildrenViewModel.class); 47 | } 48 | 49 | @Override 50 | protected void bindViewModel() { 51 | 52 | } 53 | 54 | @Override 55 | protected void init() { 56 | 57 | List fragments = new ArrayList<>(); 58 | List sTitle = new ArrayList<>(); 59 | for (WeChatBean system : mList) { 60 | mDataBinding.tabLayout.addTab(mDataBinding.tabLayout.newTab().setText(system.getName())); 61 | sTitle.add(system.getName()); 62 | fragments.add(ArticleListFragment.newInstance(1, system.getId())); 63 | } 64 | mDataBinding.tabLayout.setupWithViewPager(mDataBinding.viewPager); 65 | 66 | adapter = new FmPagerAdapter(getChildFragmentManager(), fragments, sTitle); 67 | mDataBinding.viewPager.setAdapter(adapter); 68 | 69 | mDataBinding.viewPager.setCurrentItem(pos); 70 | } 71 | 72 | @Override 73 | public void scrollToTop() { 74 | ArticleListFragment fragment = (ArticleListFragment) adapter.getCurrentFragment(); 75 | if (fragment != null) { 76 | fragment.scrollToTop(); 77 | } 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/myapplication/ui/bottom/system/systemchildren/SystemChildrenViewModel.java: -------------------------------------------------------------------------------- 1 | package com.example.myapplication.ui.bottom.system.systemchildren; 2 | 3 | import com.example.myapplication.base.viewmodel.BaseViewModel; 4 | 5 | /** 6 | * @author : devel 7 | * @date : 2020/2/27 9:47 8 | * @desc : 9 | */ 10 | public class SystemChildrenViewModel extends BaseViewModel { 11 | } 12 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/myapplication/ui/bottom/wechat/WeChatFragment.java: -------------------------------------------------------------------------------- 1 | package com.example.myapplication.ui.bottom.wechat; 2 | 3 | import android.os.Bundle; 4 | 5 | import com.example.myapplication.R; 6 | import com.example.myapplication.base.BaseFragment; 7 | import com.example.myapplication.navinterface.ScrollToTop; 8 | import com.example.myapplication.config.Constants; 9 | import com.example.myapplication.databinding.FragmentViewPagerBinding; 10 | import com.example.myapplication.bean.responsebean.WeChatBean; 11 | import com.example.myapplication.ui.adapter.ArticleListPagerAdapter; 12 | 13 | import java.util.List; 14 | 15 | import androidx.lifecycle.ViewModelProviders; 16 | 17 | 18 | /** 19 | * @author devel 20 | */ 21 | public class WeChatFragment extends BaseFragment implements ScrollToTop { 22 | 23 | private ArticleListPagerAdapter mPagerAdapter; 24 | 25 | private List mList; 26 | private int pos; 27 | 28 | @Override 29 | protected void handleArguments(Bundle args) { 30 | super.handleArguments(args); 31 | pos = args.getInt(Constants.ParamCode.PARAM2, 0); 32 | mList = (List) args.getSerializable(Constants.ParamCode.PARAM1); 33 | } 34 | 35 | 36 | @Override 37 | protected int getLayoutResId() { 38 | return R.layout.fragment_view_pager; 39 | } 40 | 41 | @Override 42 | protected void initViewModel() { 43 | mViewModel = ViewModelProviders.of(this).get(WeChatViewModel.class); 44 | } 45 | 46 | @Override 47 | protected void bindViewModel() { 48 | mDataBinding.setViewModel(mViewModel); 49 | } 50 | 51 | @Override 52 | protected boolean isSupportLoad() { 53 | return true; 54 | } 55 | 56 | @Override 57 | protected void init() { 58 | if (mList != null) { 59 | mViewModel.setDataList(mList); 60 | } else { 61 | mViewModel.loadWeChatList(); 62 | } 63 | 64 | mPagerAdapter = new ArticleListPagerAdapter(getChildFragmentManager()); 65 | mDataBinding.viewPager.setAdapter(mPagerAdapter); 66 | mDataBinding.tabLayout.setupWithViewPager(mDataBinding.viewPager); 67 | 68 | mDataBinding.viewPager.setCurrentItem(pos); 69 | } 70 | 71 | @Override 72 | public void onDestroyView() { 73 | super.onDestroyView(); 74 | if (mPagerAdapter != null) { 75 | mPagerAdapter.release(); 76 | } 77 | } 78 | 79 | @Override 80 | public void scrollToTop() { 81 | 82 | } 83 | } -------------------------------------------------------------------------------- /app/src/main/java/com/example/myapplication/ui/bottom/wechat/WeChatViewModel.java: -------------------------------------------------------------------------------- 1 | package com.example.myapplication.ui.bottom.wechat; 2 | 3 | import com.example.myapplication.base.viewmodel.BaseViewModel; 4 | import com.example.myapplication.config.LoadState; 5 | import com.example.myapplication.bean.responsebean.WeChatBean; 6 | import com.example.myapplication.http.data.HttpDisposable; 7 | import com.example.myapplication.http.request.HttpFactory; 8 | import com.example.myapplication.http.request.HttpRequest; 9 | import com.example.myapplication.util.CommonUtils; 10 | import com.example.myapplication.util.NetworkUtils; 11 | 12 | import java.util.List; 13 | 14 | import androidx.databinding.ObservableArrayList; 15 | import androidx.databinding.ObservableList; 16 | 17 | /** 18 | * @author devel 19 | */ 20 | public class WeChatViewModel extends BaseViewModel { 21 | 22 | public ObservableList dataList; 23 | 24 | public WeChatViewModel() { 25 | dataList = new ObservableArrayList<>(); 26 | } 27 | 28 | public void setDataList(List mList) { 29 | dataList.addAll(mList); 30 | } 31 | 32 | /** 33 | * 获取微信公众号列表 34 | */ 35 | public void loadWeChatList() { 36 | if (!NetworkUtils.isConnected()) { 37 | loadState.postValue(LoadState.NO_NETWORK); 38 | return; 39 | } 40 | loadState.postValue(LoadState.LOADING); 41 | HttpRequest.getInstance() 42 | .getWechatList() 43 | .compose(HttpFactory.>schedulers()) 44 | .subscribe(new HttpDisposable>() { 45 | @Override 46 | public void success(List listHttpBaseResponse) { 47 | if (!CommonUtils.isListEmpty(listHttpBaseResponse)) { 48 | dataList.addAll(listHttpBaseResponse); 49 | loadState.postValue(LoadState.SUCCESS); 50 | } else { 51 | loadState.postValue(LoadState.NO_DATA); 52 | } 53 | } 54 | 55 | @Override 56 | public void onError(Throwable e) { 57 | super.onError(e); 58 | } 59 | }); 60 | } 61 | } -------------------------------------------------------------------------------- /app/src/main/java/com/example/myapplication/ui/nav/collect/CollectFragment.java: -------------------------------------------------------------------------------- 1 | package com.example.myapplication.ui.nav.collect; 2 | 3 | import android.view.View; 4 | import android.widget.ImageView; 5 | 6 | import com.example.myapplication.BR; 7 | import com.example.myapplication.R; 8 | import com.example.myapplication.base.BaseFragment; 9 | import com.example.myapplication.bean.responsebean.CollectArticleBean; 10 | import com.example.myapplication.databinding.FragmentListBinding; 11 | import com.example.myapplication.ui.activity.web.DetailsActivity; 12 | import com.example.myapplication.ui.adapter.CommonAdapter; 13 | 14 | import androidx.lifecycle.ViewModelProviders; 15 | import androidx.recyclerview.widget.LinearLayoutManager; 16 | 17 | /** 18 | * @author devel 19 | */ 20 | public class CollectFragment extends BaseFragment { 21 | 22 | private CommonAdapter commonAdapter; 23 | 24 | @Override 25 | protected boolean isSupportLoad() { 26 | return true; 27 | } 28 | 29 | @Override 30 | protected int getLayoutResId() { 31 | return R.layout.fragment_list; 32 | } 33 | 34 | @Override 35 | protected void initViewModel() { 36 | mViewModel = ViewModelProviders.of(this).get(CollectViewModel.class); 37 | } 38 | 39 | @Override 40 | protected void bindViewModel() { 41 | mDataBinding.setCollectViewModel(mViewModel); 42 | } 43 | 44 | @Override 45 | protected void init() { 46 | mViewModel.loadData(); 47 | initRefreshLayout(); 48 | initRecyclerView(); 49 | initData(); 50 | } 51 | 52 | private void initRefreshLayout() { 53 | mDataBinding.refreshLayout.setOnRefreshListener(refreshlayout -> mViewModel.refreshData(true)); 54 | mDataBinding.refreshLayout.setOnLoadMoreListener(refreshlayout -> mViewModel.refreshData(false)); 55 | } 56 | 57 | private void initRecyclerView() { 58 | commonAdapter = new CommonAdapter(R.layout.item_collect_article, BR.collectArticle) { 59 | @Override 60 | public void addListener(View root, CollectArticleBean.CollectBean itemData, int position) { 61 | super.addListener(root, itemData, position); 62 | root.findViewById(R.id.card_view).setOnClickListener(v -> DetailsActivity.start(getActivity(), itemData.getLink())); 63 | 64 | root.findViewById(R.id.iv_collect).setOnClickListener(v -> { 65 | ((ImageView) root.findViewById(R.id.iv_collect)).setImageResource(R.mipmap.ic_collectbroken); 66 | mViewModel.collectCancel(itemData); 67 | }); 68 | 69 | } 70 | }; 71 | mDataBinding.recycle.setAdapter(commonAdapter); 72 | mDataBinding.recycle.setLayoutManager(new LinearLayoutManager(getContext())); 73 | } 74 | 75 | private void initData() { 76 | mViewModel.getArticleList().observe(this, collectArticleBean -> { 77 | 78 | if (collectArticleBean.getCurPage() >= collectArticleBean.getPageCount()) { 79 | mDataBinding.refreshLayout.finishLoadMoreWithNoMoreData(); 80 | } 81 | mDataBinding.refreshLayout.finishRefresh(); 82 | mDataBinding.refreshLayout.finishLoadMore(); 83 | 84 | if (commonAdapter != null) { 85 | commonAdapter.onItemDatasChanged(collectArticleBean.getDatas()); 86 | } 87 | }); 88 | } 89 | } -------------------------------------------------------------------------------- /app/src/main/java/com/example/myapplication/ui/nav/mine/coin/CoinListFragment.java: -------------------------------------------------------------------------------- 1 | package com.example.myapplication.ui.nav.mine.coin; 2 | 3 | import com.example.myapplication.R; 4 | import com.example.myapplication.base.BaseFragment; 5 | import com.example.myapplication.databinding.FragmentListBinding; 6 | import com.example.myapplication.bean.responsebean.CoinBean; 7 | import com.example.myapplication.ui.adapter.CommonAdapter; 8 | import com.scwang.smart.refresh.layout.api.RefreshLayout; 9 | import com.scwang.smart.refresh.layout.listener.OnLoadMoreListener; 10 | import com.scwang.smart.refresh.layout.listener.OnRefreshListener; 11 | 12 | import androidx.lifecycle.Observer; 13 | import androidx.lifecycle.ViewModelProviders; 14 | import androidx.recyclerview.widget.LinearLayoutManager; 15 | 16 | /** 17 | * @author devel 18 | */ 19 | public class CoinListFragment extends BaseFragment { 20 | 21 | 22 | @Override 23 | protected int getLayoutResId() { 24 | return R.layout.fragment_list; 25 | } 26 | 27 | @Override 28 | protected void initViewModel() { 29 | mViewModel = ViewModelProviders.of(this).get(CoinViewModel.class); 30 | } 31 | 32 | @Override 33 | protected void bindViewModel() { 34 | 35 | } 36 | 37 | @Override 38 | protected boolean isSupportLoad() { 39 | return true; 40 | } 41 | 42 | @Override 43 | protected void init() { 44 | mViewModel.loadData(); 45 | initRecycler(); 46 | initRefreshLayout(); 47 | } 48 | 49 | /** 50 | * 下拉刷新 51 | */ 52 | private void initRefreshLayout() { 53 | mDataBinding.refreshLayout.setOnRefreshListener(new OnRefreshListener() { 54 | @Override 55 | public void onRefresh(RefreshLayout refreshlayout) { 56 | mViewModel.refreshData(true); 57 | } 58 | }); 59 | mDataBinding.refreshLayout.setOnLoadMoreListener(new OnLoadMoreListener() { 60 | @Override 61 | public void onLoadMore(RefreshLayout refreshlayout) { 62 | mViewModel.refreshData(false); 63 | } 64 | }); 65 | } 66 | 67 | private void initRecycler() { 68 | 69 | CommonAdapter commonAdapter = new CommonAdapter(R.layout.item_coin_layout, com.example.myapplication.BR.coinData); 70 | mDataBinding.recycle.setAdapter(commonAdapter); 71 | mDataBinding.recycle.setLayoutManager(new LinearLayoutManager(getContext())); 72 | 73 | mViewModel.getCoinList().observe(this, new Observer() { 74 | @Override 75 | public void onChanged(CoinBean coinBean) { 76 | if (coinBean.getCurPage() >= coinBean.getPageCount()) { 77 | mDataBinding.refreshLayout.finishLoadMoreWithNoMoreData(); 78 | } 79 | mDataBinding.refreshLayout.finishRefresh(); 80 | mDataBinding.refreshLayout.finishLoadMore(); 81 | 82 | commonAdapter.onItemDatasChanged(coinBean.getDatas()); 83 | } 84 | }); 85 | 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/myapplication/ui/nav/mine/coinrank/CoinRankListFragment.java: -------------------------------------------------------------------------------- 1 | package com.example.myapplication.ui.nav.mine.coinrank; 2 | 3 | import com.example.myapplication.R; 4 | import com.example.myapplication.base.BaseFragment; 5 | import com.example.myapplication.navinterface.ScrollToTop; 6 | import com.example.myapplication.databinding.FragmentListBinding; 7 | import com.example.myapplication.bean.responsebean.CoinBean; 8 | import com.example.myapplication.bean.responsebean.CoinRankBean; 9 | import com.example.myapplication.ui.adapter.CommonAdapter; 10 | import com.scwang.smart.refresh.layout.api.RefreshLayout; 11 | import com.scwang.smart.refresh.layout.listener.OnLoadMoreListener; 12 | import com.scwang.smart.refresh.layout.listener.OnRefreshListener; 13 | 14 | import androidx.lifecycle.Observer; 15 | import androidx.lifecycle.ViewModelProviders; 16 | import androidx.recyclerview.widget.LinearLayoutManager; 17 | 18 | /** 19 | * @author : devel 20 | * @date : 2020/2/26 16:27 21 | * @desc : 22 | */ 23 | public class CoinRankListFragment extends BaseFragment 24 | implements ScrollToTop { 25 | 26 | @Override 27 | protected boolean isSupportLoad() { 28 | return true; 29 | } 30 | 31 | @Override 32 | protected int getLayoutResId() { 33 | return R.layout.fragment_list; 34 | } 35 | 36 | @Override 37 | protected void initViewModel() { 38 | 39 | mViewModel = ViewModelProviders.of(this).get(CoinRankViewModel.class); 40 | } 41 | 42 | @Override 43 | protected void bindViewModel() { 44 | 45 | } 46 | 47 | @Override 48 | protected void init() { 49 | mViewModel.loadData(); 50 | initRecycler(); 51 | initRefreshLayout(); 52 | } 53 | 54 | /** 55 | * 下拉刷新 56 | */ 57 | private void initRefreshLayout() { 58 | mDataBinding.refreshLayout.setOnRefreshListener(new OnRefreshListener() { 59 | @Override 60 | public void onRefresh(RefreshLayout refreshlayout) { 61 | mViewModel.refreshData(true); 62 | } 63 | }); 64 | mDataBinding.refreshLayout.setOnLoadMoreListener(new OnLoadMoreListener() { 65 | @Override 66 | public void onLoadMore(RefreshLayout refreshlayout) { 67 | mViewModel.refreshData(false); 68 | } 69 | }); 70 | } 71 | 72 | private void initRecycler() { 73 | 74 | CommonAdapter commonAdapter = new CommonAdapter(R.layout.item_coin_rank, com.example.myapplication.BR.coinRank); 75 | mDataBinding.recycle.setAdapter(commonAdapter); 76 | mDataBinding.recycle.setLayoutManager(new LinearLayoutManager(getContext())); 77 | 78 | mViewModel.getCoinList().observe(this, new Observer() { 79 | @Override 80 | public void onChanged(CoinRankBean coinBean) { 81 | if (coinBean.getCurPage() >= coinBean.getPageCount()) { 82 | mDataBinding.refreshLayout.finishLoadMoreWithNoMoreData(); 83 | } 84 | mDataBinding.refreshLayout.finishRefresh(); 85 | mDataBinding.refreshLayout.finishLoadMore(); 86 | commonAdapter.onItemDatasChanged(coinBean.getDatas()); 87 | } 88 | }); 89 | 90 | } 91 | 92 | @Override 93 | public void scrollToTop() { 94 | mDataBinding.recycle.smoothScrollToPosition(0); 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/myapplication/ui/nav/todo/addtodo/AddToDoFragment.java: -------------------------------------------------------------------------------- 1 | package com.example.myapplication.ui.nav.todo.addtodo; 2 | 3 | import android.widget.RadioGroup; 4 | import android.widget.Toast; 5 | 6 | import com.example.myapplication.R; 7 | import com.example.myapplication.base.BaseFragment; 8 | import com.example.myapplication.databinding.FragmentToDoAddBinding; 9 | 10 | import androidx.lifecycle.Observer; 11 | import androidx.lifecycle.ViewModelProvider; 12 | import androidx.navigation.fragment.NavHostFragment; 13 | 14 | /** 15 | * @author devel 16 | */ 17 | public class AddToDoFragment extends BaseFragment { 18 | 19 | @Override 20 | protected int getLayoutResId() { 21 | return R.layout.fragment_to_do_add; 22 | } 23 | 24 | @Override 25 | protected void initViewModel() { 26 | mViewModel = new ViewModelProvider(this).get(AddToDoViewModel.class); 27 | } 28 | 29 | @Override 30 | protected void bindViewModel() { 31 | mDataBinding.setViewModel(mViewModel); 32 | } 33 | 34 | @Override 35 | protected void init() { 36 | 37 | mViewModel.getAdddata().observe(this, new Observer() { 38 | @Override 39 | public void onChanged(Object object) { 40 | Toast.makeText(getActivity(), "新增待办事项成功!", Toast.LENGTH_SHORT).show(); 41 | NavHostFragment.findNavController(AddToDoFragment.this).navigateUp(); 42 | } 43 | }); 44 | 45 | mDataBinding.radioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { 46 | @Override 47 | public void onCheckedChanged(RadioGroup group, int checkedId) { 48 | switch (checkedId) { 49 | case R.id.btn1: 50 | mViewModel.type.postValue(1); 51 | break; 52 | case R.id.btn2: 53 | mViewModel.type.postValue(2); 54 | break; 55 | case R.id.btn3: 56 | mViewModel.type.postValue(3); 57 | break; 58 | case R.id.btn4: 59 | mViewModel.type.postValue(4); 60 | break; 61 | default: 62 | break; 63 | } 64 | } 65 | }); 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/myapplication/ui/nav/update/UpdateFragment.java: -------------------------------------------------------------------------------- 1 | package com.example.myapplication.ui.nav.update; 2 | 3 | import android.view.View; 4 | 5 | import com.example.myapplication.R; 6 | import com.example.myapplication.base.BaseFragment; 7 | import com.example.myapplication.databinding.UpdateFragmentBinding; 8 | import com.example.myapplication.bean.UpdatePlan; 9 | import com.example.myapplication.ui.activity.web.DetailsActivity; 10 | import com.example.myapplication.ui.adapter.CommonAdapter; 11 | 12 | import java.util.List; 13 | 14 | import androidx.lifecycle.Observer; 15 | import androidx.lifecycle.ViewModelProvider; 16 | import androidx.recyclerview.widget.LinearLayoutManager; 17 | 18 | public class UpdateFragment extends BaseFragment { 19 | 20 | @Override 21 | protected int getLayoutResId() { 22 | return R.layout.update_fragment; 23 | } 24 | 25 | @Override 26 | protected void initViewModel() { 27 | mViewModel = new ViewModelProvider(this).get(UpdateViewModel.class); 28 | } 29 | 30 | @Override 31 | protected void bindViewModel() { 32 | mDataBinding.setViewModel(mViewModel); 33 | mDataBinding.setFragment(UpdateFragment.this); 34 | } 35 | 36 | @Override 37 | protected void init() { 38 | 39 | CommonAdapter updateAdapter = new CommonAdapter(R.layout.item_update_plan, com.example.myapplication.BR.updatePlan); 40 | mDataBinding.recyclerViewPlan.setAdapter(updateAdapter); 41 | mDataBinding.recyclerViewPlan.setLayoutManager(new LinearLayoutManager(getContext())); 42 | 43 | mViewModel.getUpdateList().observe(this, list -> updateAdapter.onItemDatasChanged(list)); 44 | } 45 | 46 | /** 47 | * 展示更新计划 48 | */ 49 | public void showUpdatePlan() { 50 | if (mDataBinding.recyclerViewPlan.getVisibility() == View.VISIBLE) { 51 | mDataBinding.recyclerViewPlan.setVisibility(View.GONE); 52 | mDataBinding.ivPlan.setImageResource(R.mipmap.ic_chevron_down); 53 | } else { 54 | mDataBinding.recyclerViewPlan.setVisibility(View.VISIBLE); 55 | mDataBinding.ivPlan.setImageResource(R.mipmap.ic_chevron_up); 56 | } 57 | } 58 | 59 | /** 60 | * 展示更新计划 61 | */ 62 | public void showUpdateRecord() { 63 | if (mDataBinding.llRecord.getVisibility() == View.VISIBLE) { 64 | mDataBinding.llRecord.setVisibility(View.GONE); 65 | mDataBinding.ivRecord.setImageResource(R.mipmap.ic_chevron_down); 66 | } else { 67 | mDataBinding.llRecord.setVisibility(View.VISIBLE); 68 | mDataBinding.ivRecord.setImageResource(R.mipmap.ic_chevron_up); 69 | } 70 | } 71 | 72 | public void startProject(){ 73 | DetailsActivity.start(getContext(),"https://github.com/ccaong/JetpackDemo"); 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/myapplication/ui/nav/update/UpdateViewModel.java: -------------------------------------------------------------------------------- 1 | package com.example.myapplication.ui.nav.update; 2 | 3 | import androidx.lifecycle.LiveData; 4 | import androidx.lifecycle.MutableLiveData; 5 | 6 | import com.example.myapplication.R; 7 | import com.example.myapplication.base.viewmodel.BaseViewModel; 8 | import com.example.myapplication.bean.UpdatePlan; 9 | 10 | import java.util.ArrayList; 11 | import java.util.List; 12 | 13 | 14 | public class UpdateViewModel extends BaseViewModel { 15 | 16 | private MutableLiveData> updatePlanList; 17 | 18 | 19 | public UpdateViewModel() { 20 | updatePlanList = new MutableLiveData<>(); 21 | initUpdatePlanList(); 22 | } 23 | 24 | public LiveData> getUpdateList() { 25 | return updatePlanList; 26 | } 27 | 28 | private void initUpdatePlanList() { 29 | List mList = new ArrayList<>(); 30 | mList.add(new UpdatePlan(getResources().getString(R.string.update_plan_1), false)); 31 | mList.add(new UpdatePlan(getResources().getString(R.string.update_plan_2), false)); 32 | mList.add(new UpdatePlan(getResources().getString(R.string.update_plan_3), false)); 33 | mList.add(new UpdatePlan(getResources().getString(R.string.update_plan_4), false)); 34 | mList.add(new UpdatePlan(getResources().getString(R.string.update_plan_5), false)); 35 | mList.add(new UpdatePlan(getResources().getString(R.string.update_plan_6), false)); 36 | 37 | updatePlanList.postValue(mList); 38 | } 39 | 40 | 41 | } 42 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/myapplication/ui/view/CircleImageView.java: -------------------------------------------------------------------------------- 1 | package com.example.myapplication.ui.view; 2 | 3 | import android.content.Context; 4 | import android.graphics.Bitmap; 5 | import android.graphics.BitmapShader; 6 | import android.graphics.Canvas; 7 | import android.graphics.Matrix; 8 | import android.graphics.Paint; 9 | import android.graphics.Shader; 10 | import android.graphics.drawable.BitmapDrawable; 11 | import android.graphics.drawable.Drawable; 12 | import android.util.AttributeSet; 13 | 14 | import androidx.annotation.Nullable; 15 | import androidx.appcompat.widget.AppCompatImageView; 16 | 17 | public class CircleImageView extends AppCompatImageView { 18 | private float width; 19 | private float height; 20 | private float radius; 21 | private Paint paint; 22 | private Matrix matrix; 23 | 24 | public CircleImageView(Context context) { 25 | this(context, null); 26 | } 27 | 28 | public CircleImageView(Context context, @Nullable AttributeSet attrs) { 29 | this(context, attrs, 0); 30 | } 31 | 32 | public CircleImageView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { 33 | super(context, attrs, defStyleAttr); 34 | paint = new Paint(); 35 | paint.setAntiAlias(true); //设置抗锯齿 36 | matrix = new Matrix(); //初始化缩放矩阵 37 | } 38 | 39 | /** 40 | * 测量控件的宽高,并获取其内切圆的半径 41 | */ 42 | @Override 43 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { 44 | super.onMeasure(widthMeasureSpec, heightMeasureSpec); 45 | width = getMeasuredWidth(); 46 | height = getMeasuredHeight(); 47 | radius = Math.min(width, height) / 2; 48 | } 49 | 50 | @Override 51 | protected void onDraw(Canvas canvas) { 52 | Drawable drawable = getDrawable(); 53 | if (drawable == null) { 54 | super.onDraw(canvas); 55 | return; 56 | } 57 | if (drawable instanceof BitmapDrawable) { 58 | paint.setShader(initBitmapShader((BitmapDrawable) drawable));//将着色器设置给画笔 59 | canvas.drawCircle(width / 2, height / 2, radius, paint);//使用画笔在画布上画圆 60 | return; 61 | } 62 | super.onDraw(canvas); 63 | } 64 | 65 | /** 66 | * 获取ImageView中资源图片的Bitmap,利用Bitmap初始化图片着色器,通过缩放矩阵将原资源图片缩放到铺满整个绘制区域,避免边界填充 67 | */ 68 | private BitmapShader initBitmapShader(BitmapDrawable drawable) { 69 | Bitmap bitmap = drawable.getBitmap(); 70 | BitmapShader bitmapShader = new BitmapShader(bitmap, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP); 71 | float scale = Math.max(width / bitmap.getWidth(), height / bitmap.getHeight()); 72 | matrix.setScale(scale, scale);//将图片宽高等比例缩放,避免拉伸 73 | bitmapShader.setLocalMatrix(matrix); 74 | return bitmapShader; 75 | } 76 | } 77 | 78 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/myapplication/util/CommonUtils.java: -------------------------------------------------------------------------------- 1 | package com.example.myapplication.util; 2 | 3 | import com.example.myapplication.config.App; 4 | 5 | import java.util.List; 6 | 7 | import androidx.annotation.ColorRes; 8 | import androidx.annotation.StringRes; 9 | import androidx.core.content.ContextCompat; 10 | 11 | /** 12 | * 工具类 13 | */ 14 | public final class CommonUtils { 15 | 16 | private CommonUtils() { 17 | 18 | } 19 | 20 | /** 21 | * 判断列表是否为空 22 | * 23 | * @param list 列表 24 | * @return true表示为空,false表示不为空 25 | */ 26 | public static boolean isListEmpty(List list) { 27 | return list == null || list.size() == 0; 28 | } 29 | 30 | public static boolean isStringEmpty(String string) { 31 | return string == null || "".equals(string); 32 | } 33 | 34 | /** 35 | * 获取字符串资源 36 | * 37 | * @param resId 字符串资源ID 38 | * @return 字符串 39 | */ 40 | public static String getString(@StringRes int resId) { 41 | return App.getContext().getString(resId); 42 | } 43 | 44 | /** 45 | * 获取字符串资源 46 | * 47 | * @param i 48 | * @return 字符串 49 | */ 50 | public static String int2String(@StringRes int i) { 51 | return i + ""; 52 | } 53 | 54 | 55 | /** 56 | * 获取颜色资源 57 | * 58 | * @param resId 颜色资源ID 59 | * @return 颜色 60 | */ 61 | public static int getColor(@ColorRes int resId) { 62 | return ContextCompat.getColor(App.getContext(), resId); 63 | } 64 | 65 | } 66 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/myapplication/util/GlideUtil.java: -------------------------------------------------------------------------------- 1 | package com.example.myapplication.util; 2 | 3 | import android.widget.ImageView; 4 | 5 | import com.bumptech.glide.Glide; 6 | import com.bumptech.glide.load.resource.bitmap.CircleCrop; 7 | import com.bumptech.glide.request.RequestOptions; 8 | import com.example.myapplication.config.App; 9 | import com.example.myapplication.R; 10 | 11 | import jp.wasabeef.glide.transformations.BlurTransformation; 12 | 13 | /** 14 | * @author : devel 15 | * @date : 2020/2/28 16:50 16 | * @desc : 17 | */ 18 | public class GlideUtil { 19 | 20 | 21 | public static void loadImageWithDefault(ImageView imageView, String url) { 22 | RequestOptions options = new RequestOptions(); 23 | options.placeholder(R.mipmap.ic_logo) 24 | .error(R.mipmap.ic_logo).fallback(R.mipmap.ic_logo) 25 | .transform(new CircleCrop()); 26 | 27 | Glide.with(App.getContext()) 28 | .load(url) 29 | .apply(options) 30 | .into(imageView); 31 | } 32 | 33 | 34 | public static void loadImageWithGoss(ImageView imageView, String url) { 35 | Glide.with(App.getContext()) 36 | .load(url) 37 | .apply(RequestOptions.bitmapTransform(new BlurTransformation(25, 3))) 38 | .into(imageView); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/myapplication/util/ImageSelectUtil.java: -------------------------------------------------------------------------------- 1 | package com.example.myapplication.util; 2 | 3 | import android.app.Activity; 4 | 5 | import androidx.fragment.app.Fragment; 6 | 7 | import com.guoxiaoxing.phoenix.core.PhoenixOption; 8 | import com.guoxiaoxing.phoenix.core.model.MimeType; 9 | import com.guoxiaoxing.phoenix.picker.Phoenix; 10 | 11 | public class ImageSelectUtil { 12 | 13 | /** 14 | * 选择图片并编辑 15 | * 16 | * @param activity 17 | * @param requestCode 18 | */ 19 | public static void selectPictureWithActivity(final Activity activity, final int requestCode) { 20 | 21 | Phoenix.with() 22 | .theme(PhoenixOption.THEME_DEFAULT)// 主题 23 | .fileType(MimeType.ofImage())//显示的文件类型图片、视频、图片和视频 24 | .maxPickNumber(1)// 最大选择数量 25 | .minPickNumber(0)// 最小选择数量 26 | .spanCount(4)// 每行显示个数 27 | .enablePreview(true)// 是否开启预览 28 | .enableCamera(true)// 是否开启拍照 29 | .enableAnimation(true)// 选择界面图片点击效果 30 | .enableCompress(true)// 是否开启压缩 31 | .compressPictureFilterSize(124)//多少kb以下的图片不压缩 32 | .compressVideoFilterSize(2018)//多少kb以下的视频不压缩 33 | .thumbnailHeight(160)// 选择界面图片高度 34 | .thumbnailWidth(160)// 选择界面图片宽度 35 | .enableClickSound(false)// 是否开启点击声音 36 | .mediaFilterSize(10000)//显示多少kb以下的图片/视频,默认为0,表示不限制 37 | //如果是在Activity里使用就传Activity,如果是在Fragment里使用就传Fragment 38 | .start(activity, PhoenixOption.TYPE_PICK_MEDIA, requestCode); 39 | } 40 | 41 | 42 | /** 43 | * 选择图片并编辑 44 | * 45 | * @param fragment 46 | * @param requestCode 47 | */ 48 | public static void selectPictureWithFragment(final Fragment fragment, final int requestCode) { 49 | 50 | Phoenix.with() 51 | .theme(PhoenixOption.THEME_DEFAULT)// 主题 52 | .fileType(MimeType.ofImage())//显示的文件类型图片、视频、图片和视频 53 | .maxPickNumber(1)// 最大选择数量 54 | .minPickNumber(0)// 最小选择数量 55 | .spanCount(4)// 每行显示个数 56 | .enablePreview(true)// 是否开启预览 57 | .enableCamera(true)// 是否开启拍照 58 | .enableAnimation(true)// 选择界面图片点击效果 59 | .enableCompress(true)// 是否开启压缩 60 | .compressPictureFilterSize(124)//多少kb以下的图片不压缩 61 | .compressVideoFilterSize(2018)//多少kb以下的视频不压缩 62 | .thumbnailHeight(160)// 选择界面图片高度 63 | .thumbnailWidth(160)// 选择界面图片宽度 64 | .enableClickSound(false)// 是否开启点击声音 65 | .mediaFilterSize(10000)//显示多少kb以下的图片/视频,默认为0,表示不限制 66 | //如果是在Activity里使用就传Activity,如果是在Fragment里使用就传Fragment 67 | .start(fragment, PhoenixOption.TYPE_PICK_MEDIA, requestCode); 68 | } 69 | 70 | 71 | } 72 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/myapplication/util/ToastUtils.java: -------------------------------------------------------------------------------- 1 | package com.example.myapplication.util; 2 | 3 | 4 | import android.content.Context; 5 | import android.widget.Toast; 6 | 7 | /** 8 | * @author devel 9 | */ 10 | public class ToastUtils { 11 | 12 | private static Toast mShortToast; 13 | private static Toast mLongToast; 14 | 15 | public static void showToast(Context context, String message) { 16 | if (mShortToast == null) { 17 | mShortToast = Toast.makeText(context, message, Toast.LENGTH_SHORT); 18 | } 19 | mShortToast.setText(message); 20 | mShortToast.show(); 21 | } 22 | 23 | public static void showLongToast(Context context, String message) { 24 | if (mLongToast == null) { 25 | mLongToast = Toast.makeText(context, message, Toast.LENGTH_LONG); 26 | } 27 | mLongToast.setText(message); 28 | mLongToast.show(); 29 | } 30 | 31 | } 32 | 33 | -------------------------------------------------------------------------------- /app/src/main/res/color/qmui_btn_bg.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-v21/ic_menu_camera.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 12 | 13 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-v21/ic_menu_gallery.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-v21/ic_menu_manage.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-v21/ic_menu_send.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-v21/ic_menu_share.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-v21/ic_menu_slideshow.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 12 | 13 | 19 | 22 | 25 | 26 | 27 | 28 | 34 | 35 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/animated_rotate_loading.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 13 | 14 | 19 | 20 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/bg_pop_view.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 10 | 11 | 12 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/edit_text_bg.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_arrow_upward_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_dashboard_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_home_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_notifications_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/radiobutton_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/radiobutton_background_checked.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/radiobutton_background_unchecked.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/radiobutton_textcolor.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/shape_label_blue.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 8 | 9 | 14 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/shape_label_green.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 8 | 9 | 14 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/shape_label_red.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 8 | 9 | 14 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/side_nav_bar.xml: -------------------------------------------------------------------------------- 1 | 3 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/skip_btn_bg.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | 10 | 15 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_base.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_details.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 11 | 12 | 13 | 18 | 19 | 23 | 24 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_login.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 12 | 13 | 20 | 21 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_splash.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 11 | 12 | 15 | 16 | 17 | 20 | 21 | 30 | 31 | 32 | 45 | 46 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /app/src/main/res/layout/app_bar_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 13 | 14 | 20 | 21 | 22 | 23 | 28 | 29 | 41 | 42 | 43 | 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /app/src/main/res/layout/edit_text_with_title.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 13 | 14 | 22 | 23 | 24 | 25 | 32 | 33 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_base.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_list.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 10 | 11 | 14 | 15 | 16 | 19 | 20 | 25 | 26 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_notifications.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 19 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_project_view_pager.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 10 | 11 | 12 | 15 | 16 | 24 | 25 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_slideshow.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 19 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_todo_list.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 10 | 11 | 12 | 13 | 17 | 18 | 24 | 25 | 30 | 31 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_tools.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 12 | 13 | 25 | 26 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_view_pager.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 10 | 11 | 12 | 15 | 16 | 24 | 25 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_coin_layout.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 11 | 12 | 13 | 14 | 17 | 18 | 23 | 24 | 28 | 29 | 39 | 40 | 47 | 48 | 56 | 57 | 58 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_coin_rank.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 11 | 12 | 13 | 17 | 18 | 22 | 23 | 27 | 28 | 37 | 38 | 39 | 50 | 51 | 52 | 62 | 63 | 64 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_home_banner.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 10 | 11 | 12 | 15 | 16 | 25 | 26 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_home_top.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | 10 | 11 | 15 | 16 | 27 | 28 | 33 | 34 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_navigation_layout.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 10 | 11 | 12 | 16 | 17 | 26 | 27 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_navigation_tag_layout.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | 10 | 11 | 15 | 16 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_open_source_project.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 11 | 12 | 13 | 19 | 20 | 30 | 31 | 39 | 40 | 51 | 52 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_system_layout.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 10 | 11 | 12 | 13 | 17 | 18 | 23 | 24 | 29 | 30 | 37 | 38 | 39 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_system_tag_layout.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | 10 | 11 | 15 | 16 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_update_plan.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 10 | 11 | 12 | 19 | 20 | 25 | 26 | 36 | 37 | -------------------------------------------------------------------------------- /app/src/main/res/layout/layout_no_more_data.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/layout/nav_header_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 14 | 15 | 22 | 23 | 30 | 31 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /app/src/main/res/layout/navi_fragment.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 11 | 12 | 13 | 19 | 20 | 31 | 32 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /app/src/main/res/layout/remote_banner_item.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 12 | -------------------------------------------------------------------------------- /app/src/main/res/layout/text_view_with_title.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 13 | 14 | 21 | 22 | 23 | 24 | 31 | 32 | -------------------------------------------------------------------------------- /app/src/main/res/layout/view_load_error.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 10 | 11 | 12 | 16 | 17 | 27 | 28 | 40 | 41 | -------------------------------------------------------------------------------- /app/src/main/res/layout/view_loading.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 9 | 10 | 20 | 21 | -------------------------------------------------------------------------------- /app/src/main/res/layout/view_no_data.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 9 | 10 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /app/src/main/res/layout/view_no_network.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 10 | 11 | 12 | 17 | 18 | 28 | 29 | 41 | 42 | -------------------------------------------------------------------------------- /app/src/main/res/menu/activity_main_drawer.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 11 | 15 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 29 | 30 | 34 | 35 | 36 | 37 | 38 | 39 | 43 | 47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /app/src/main/res/menu/bottom_nav_menu.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 9 | 10 | 14 | 15 | 19 | 20 | 24 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /app/src/main/res/menu/main.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccaong/JetpackDemo/ad7ccdadab687c8ee3dec92577a7397809ebe2d5/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccaong/JetpackDemo/ad7ccdadab687c8ee3dec92577a7397809ebe2d5/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccaong/JetpackDemo/ad7ccdadab687c8ee3dec92577a7397809ebe2d5/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccaong/JetpackDemo/ad7ccdadab687c8ee3dec92577a7397809ebe2d5/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccaong/JetpackDemo/ad7ccdadab687c8ee3dec92577a7397809ebe2d5/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccaong/JetpackDemo/ad7ccdadab687c8ee3dec92577a7397809ebe2d5/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccaong/JetpackDemo/ad7ccdadab687c8ee3dec92577a7397809ebe2d5/app/src/main/res/mipmap-xxhdpi/ic_add.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_bookmark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccaong/JetpackDemo/ad7ccdadab687c8ee3dec92577a7397809ebe2d5/app/src/main/res/mipmap-xxhdpi/ic_bookmark.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_checkbox_check.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccaong/JetpackDemo/ad7ccdadab687c8ee3dec92577a7397809ebe2d5/app/src/main/res/mipmap-xxhdpi/ic_checkbox_check.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_checkbox_uncheck.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccaong/JetpackDemo/ad7ccdadab687c8ee3dec92577a7397809ebe2d5/app/src/main/res/mipmap-xxhdpi/ic_checkbox_uncheck.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_chevron_down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccaong/JetpackDemo/ad7ccdadab687c8ee3dec92577a7397809ebe2d5/app/src/main/res/mipmap-xxhdpi/ic_chevron_down.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_chevron_right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccaong/JetpackDemo/ad7ccdadab687c8ee3dec92577a7397809ebe2d5/app/src/main/res/mipmap-xxhdpi/ic_chevron_right.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_chevron_up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccaong/JetpackDemo/ad7ccdadab687c8ee3dec92577a7397809ebe2d5/app/src/main/res/mipmap-xxhdpi/ic_chevron_up.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_collect_no.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccaong/JetpackDemo/ad7ccdadab687c8ee3dec92577a7397809ebe2d5/app/src/main/res/mipmap-xxhdpi/ic_collect_no.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_collect_yes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccaong/JetpackDemo/ad7ccdadab687c8ee3dec92577a7397809ebe2d5/app/src/main/res/mipmap-xxhdpi/ic_collect_yes.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_collectbroken.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccaong/JetpackDemo/ad7ccdadab687c8ee3dec92577a7397809ebe2d5/app/src/main/res/mipmap-xxhdpi/ic_collectbroken.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_copy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccaong/JetpackDemo/ad7ccdadab687c8ee3dec92577a7397809ebe2d5/app/src/main/res/mipmap-xxhdpi/ic_copy.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_github.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccaong/JetpackDemo/ad7ccdadab687c8ee3dec92577a7397809ebe2d5/app/src/main/res/mipmap-xxhdpi/ic_github.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_hot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccaong/JetpackDemo/ad7ccdadab687c8ee3dec92577a7397809ebe2d5/app/src/main/res/mipmap-xxhdpi/ic_hot.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccaong/JetpackDemo/ad7ccdadab687c8ee3dec92577a7397809ebe2d5/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccaong/JetpackDemo/ad7ccdadab687c8ee3dec92577a7397809ebe2d5/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_link.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccaong/JetpackDemo/ad7ccdadab687c8ee3dec92577a7397809ebe2d5/app/src/main/res/mipmap-xxhdpi/ic_link.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_link_grey.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccaong/JetpackDemo/ad7ccdadab687c8ee3dec92577a7397809ebe2d5/app/src/main/res/mipmap-xxhdpi/ic_link_grey.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_load_error.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccaong/JetpackDemo/ad7ccdadab687c8ee3dec92577a7397809ebe2d5/app/src/main/res/mipmap-xxhdpi/ic_load_error.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccaong/JetpackDemo/ad7ccdadab687c8ee3dec92577a7397809ebe2d5/app/src/main/res/mipmap-xxhdpi/ic_logo.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_mine_coin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccaong/JetpackDemo/ad7ccdadab687c8ee3dec92577a7397809ebe2d5/app/src/main/res/mipmap-xxhdpi/ic_mine_coin.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_mine_collect.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccaong/JetpackDemo/ad7ccdadab687c8ee3dec92577a7397809ebe2d5/app/src/main/res/mipmap-xxhdpi/ic_mine_collect.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_mine_setting.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccaong/JetpackDemo/ad7ccdadab687c8ee3dec92577a7397809ebe2d5/app/src/main/res/mipmap-xxhdpi/ic_mine_setting.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_mine_share.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccaong/JetpackDemo/ad7ccdadab687c8ee3dec92577a7397809ebe2d5/app/src/main/res/mipmap-xxhdpi/ic_mine_share.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_nav_about.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccaong/JetpackDemo/ad7ccdadab687c8ee3dec92577a7397809ebe2d5/app/src/main/res/mipmap-xxhdpi/ic_nav_about.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_nav_collect.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccaong/JetpackDemo/ad7ccdadab687c8ee3dec92577a7397809ebe2d5/app/src/main/res/mipmap-xxhdpi/ic_nav_collect.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_nav_qa.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccaong/JetpackDemo/ad7ccdadab687c8ee3dec92577a7397809ebe2d5/app/src/main/res/mipmap-xxhdpi/ic_nav_qa.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_nav_square.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccaong/JetpackDemo/ad7ccdadab687c8ee3dec92577a7397809ebe2d5/app/src/main/res/mipmap-xxhdpi/ic_nav_square.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_nav_todo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccaong/JetpackDemo/ad7ccdadab687c8ee3dec92577a7397809ebe2d5/app/src/main/res/mipmap-xxhdpi/ic_nav_todo.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_nav_update.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccaong/JetpackDemo/ad7ccdadab687c8ee3dec92577a7397809ebe2d5/app/src/main/res/mipmap-xxhdpi/ic_nav_update.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_navigation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccaong/JetpackDemo/ad7ccdadab687c8ee3dec92577a7397809ebe2d5/app/src/main/res/mipmap-xxhdpi/ic_navigation.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_no_net.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccaong/JetpackDemo/ad7ccdadab687c8ee3dec92577a7397809ebe2d5/app/src/main/res/mipmap-xxhdpi/ic_no_net.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_nodata.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccaong/JetpackDemo/ad7ccdadab687c8ee3dec92577a7397809ebe2d5/app/src/main/res/mipmap-xxhdpi/ic_nodata.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_project.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccaong/JetpackDemo/ad7ccdadab687c8ee3dec92577a7397809ebe2d5/app/src/main/res/mipmap-xxhdpi/ic_project.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_rank.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccaong/JetpackDemo/ad7ccdadab687c8ee3dec92577a7397809ebe2d5/app/src/main/res/mipmap-xxhdpi/ic_rank.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_rank_first.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccaong/JetpackDemo/ad7ccdadab687c8ee3dec92577a7397809ebe2d5/app/src/main/res/mipmap-xxhdpi/ic_rank_first.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_rank_second.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccaong/JetpackDemo/ad7ccdadab687c8ee3dec92577a7397809ebe2d5/app/src/main/res/mipmap-xxhdpi/ic_rank_second.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_rank_thred.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccaong/JetpackDemo/ad7ccdadab687c8ee3dec92577a7397809ebe2d5/app/src/main/res/mipmap-xxhdpi/ic_rank_thred.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_star.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccaong/JetpackDemo/ad7ccdadab687c8ee3dec92577a7397809ebe2d5/app/src/main/res/mipmap-xxhdpi/ic_star.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_star_outline.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccaong/JetpackDemo/ad7ccdadab687c8ee3dec92577a7397809ebe2d5/app/src/main/res/mipmap-xxhdpi/ic_star_outline.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_system.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccaong/JetpackDemo/ad7ccdadab687c8ee3dec92577a7397809ebe2d5/app/src/main/res/mipmap-xxhdpi/ic_system.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_todo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccaong/JetpackDemo/ad7ccdadab687c8ee3dec92577a7397809ebe2d5/app/src/main/res/mipmap-xxhdpi/ic_todo.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_top.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccaong/JetpackDemo/ad7ccdadab687c8ee3dec92577a7397809ebe2d5/app/src/main/res/mipmap-xxhdpi/ic_top.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_update.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccaong/JetpackDemo/ad7ccdadab687c8ee3dec92577a7397809ebe2d5/app/src/main/res/mipmap-xxhdpi/ic_update.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_wechat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccaong/JetpackDemo/ad7ccdadab687c8ee3dec92577a7397809ebe2d5/app/src/main/res/mipmap-xxhdpi/ic_wechat.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/nodata.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccaong/JetpackDemo/ad7ccdadab687c8ee3dec92577a7397809ebe2d5/app/src/main/res/mipmap-xxhdpi/nodata.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/splash_bg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccaong/JetpackDemo/ad7ccdadab687c8ee3dec92577a7397809ebe2d5/app/src/main/res/mipmap-xxhdpi/splash_bg.jpg -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccaong/JetpackDemo/ad7ccdadab687c8ee3dec92577a7397809ebe2d5/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccaong/JetpackDemo/ad7ccdadab687c8ee3dec92577a7397809ebe2d5/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/values-v21/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/values/arrays.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | @color/colorPrimaryDark 5 | @color/colorPrimary 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #455A64 4 | #4F636C 5 | #D81B60 6 | 7 | 8 | #D4000000 9 | #8A000000 10 | #42000000 11 | #1E000000 12 | 13 | 14 | #FFFFFF 15 | #000000 16 | #F44336 17 | #4CAF50 18 | #2196f3 19 | #9E9E9E 20 | #616161 21 | #F5F5F5 22 | #00000000 23 | #515151 24 | #80FFFFFF 25 | #f0eff4 26 | 27 | 28 | #4A5A64 29 | #4F636C 30 | #929EA4 31 | 32 | #1967D2 33 | #1452A8 34 | 35 | #FBBC04 36 | #E37400 37 | 38 | #6CAE4E 39 | #78C257 40 | 41 | #757575 42 | #C6C6C6 43 | #9E9E9E 44 | #5E5E5E 45 | 46 | 47 | #EF5362 48 | #FE6D4B 49 | #FFCF47 50 | #9FD661 51 | #3FD0AD 52 | #2BBDF3 53 | #5A9AEF 54 | #AC8FEF 55 | #EE85C1 56 | 57 | 58 | -------------------------------------------------------------------------------- /app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 8dp 6 | 176dp 7 | 16dp 8 | 9 | 16dp 10 | 8dp 11 | 10dp 12 | 13 | 4dp 14 | 8dp 15 | 12dp 16 | 16dp 17 | 24dp 18 | 32dp 19 | 40dp 20 | 48dp 21 | 56dp 22 | 64dp 23 | 80dp 24 | 100dp 25 | 160dp 26 | 240dp 27 | 280dp 28 | 320dp 29 | 30 | 31 | 10sp 32 | 12sp 33 | 15sp 34 | 16sp 35 | 18sp 36 | 20sp 37 | 22sp 38 | 39 | -------------------------------------------------------------------------------- /app/src/main/res/values/drawables.xml: -------------------------------------------------------------------------------- 1 | 2 | @android:drawable/ic_menu_camera 3 | @android:drawable/ic_menu_gallery 4 | @android:drawable/ic_menu_slideshow 5 | @android:drawable/ic_menu_manage 6 | @android:drawable/ic_menu_share 7 | @android:drawable/ic_menu_send 8 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings_behavior.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | com.example.myapplication.behavior.BottomNavigationBehavior 4 | com.example.myapplication.behavior.FloatingActionButtonBehavior 5 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 15 | 16 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 50 | 51 | -------------------------------------------------------------------------------- /app/src/test/java/com/example/myapplication/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.example.myapplication; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | repositories { 5 | google() 6 | jcenter() 7 | maven { url 'https://jitpack.io' } 8 | 9 | } 10 | dependencies { 11 | classpath 'com.android.tools.build:gradle:3.5.3' 12 | 13 | // NOTE: Do not place your application dependencies here; they belong 14 | // in the individual module build.gradle files 15 | } 16 | } 17 | 18 | allprojects { 19 | repositories { 20 | google() 21 | jcenter() 22 | maven { url 'https://jitpack.io' } 23 | 24 | } 25 | } 26 | 27 | task clean(type: Delete) { 28 | delete rootProject.buildDir 29 | } 30 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | # IDE (e.g. Android Studio) users: 3 | # Gradle settings configured through the IDE *will override* 4 | # any settings specified in this file. 5 | # For more details on how to configure your build environment visit 6 | # http://www.gradle.org/docs/current/userguide/build_environment.html 7 | # Specifies the JVM arguments used for the daemon process. 8 | # The setting is particularly useful for tweaking memory settings. 9 | org.gradle.jvmargs=-Xmx1536m 10 | # When configured, Gradle will run in incubating parallel mode. 11 | # This option should only be used with decoupled projects. More details, visit 12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 13 | # org.gradle.parallel=true 14 | # AndroidX package structure to make it clearer which packages are bundled with the 15 | # Android operating system, and which are packaged with your app's APK 16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn 17 | android.useAndroidX=true 18 | # Automatically convert third-party libraries to use AndroidX 19 | android.enableJetifier=true 20 | 21 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccaong/JetpackDemo/ad7ccdadab687c8ee3dec92577a7397809ebe2d5/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Tue Feb 18 19:52:31 CST 2020 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip 7 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | set DIRNAME=%~dp0 12 | if "%DIRNAME%" == "" set DIRNAME=. 13 | set APP_BASE_NAME=%~n0 14 | set APP_HOME=%DIRNAME% 15 | 16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 17 | set DEFAULT_JVM_OPTS= 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windows variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | 53 | :win9xME_args 54 | @rem Slurp the command line arguments. 55 | set CMD_LINE_ARGS= 56 | set _SKIP=2 57 | 58 | :win9xME_args_slurp 59 | if "x%~1" == "x" goto execute 60 | 61 | set CMD_LINE_ARGS=%* 62 | 63 | :execute 64 | @rem Setup the command line 65 | 66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 67 | 68 | @rem Execute Gradle 69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 70 | 71 | :end 72 | @rem End local scope for the variables with windows NT shell 73 | if "%ERRORLEVEL%"=="0" goto mainEnd 74 | 75 | :fail 76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 77 | rem the _cmd.exe /c_ return code! 78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 79 | exit /b 1 80 | 81 | :mainEnd 82 | if "%OS%"=="Windows_NT" endlocal 83 | 84 | :omega 85 | -------------------------------------------------------------------------------- /image/wanandroid_about.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccaong/JetpackDemo/ad7ccdadab687c8ee3dec92577a7397809ebe2d5/image/wanandroid_about.png -------------------------------------------------------------------------------- /image/wanandroid_collect.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccaong/JetpackDemo/ad7ccdadab687c8ee3dec92577a7397809ebe2d5/image/wanandroid_collect.png -------------------------------------------------------------------------------- /image/wanandroid_home.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccaong/JetpackDemo/ad7ccdadab687c8ee3dec92577a7397809ebe2d5/image/wanandroid_home.png -------------------------------------------------------------------------------- /image/wanandroid_login.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccaong/JetpackDemo/ad7ccdadab687c8ee3dec92577a7397809ebe2d5/image/wanandroid_login.png -------------------------------------------------------------------------------- /image/wanandroid_mine.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccaong/JetpackDemo/ad7ccdadab687c8ee3dec92577a7397809ebe2d5/image/wanandroid_mine.png -------------------------------------------------------------------------------- /image/wanandroid_nav.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccaong/JetpackDemo/ad7ccdadab687c8ee3dec92577a7397809ebe2d5/image/wanandroid_nav.png -------------------------------------------------------------------------------- /image/wanandroid_navagation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccaong/JetpackDemo/ad7ccdadab687c8ee3dec92577a7397809ebe2d5/image/wanandroid_navagation.png -------------------------------------------------------------------------------- /image/wanandroid_project.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccaong/JetpackDemo/ad7ccdadab687c8ee3dec92577a7397809ebe2d5/image/wanandroid_project.png -------------------------------------------------------------------------------- /image/wanandroid_qa.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccaong/JetpackDemo/ad7ccdadab687c8ee3dec92577a7397809ebe2d5/image/wanandroid_qa.png -------------------------------------------------------------------------------- /image/wanandroid_splash.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccaong/JetpackDemo/ad7ccdadab687c8ee3dec92577a7397809ebe2d5/image/wanandroid_splash.webp -------------------------------------------------------------------------------- /image/wanandroid_sys.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccaong/JetpackDemo/ad7ccdadab687c8ee3dec92577a7397809ebe2d5/image/wanandroid_sys.png -------------------------------------------------------------------------------- /image/wanandroid_todo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccaong/JetpackDemo/ad7ccdadab687c8ee3dec92577a7397809ebe2d5/image/wanandroid_todo.png -------------------------------------------------------------------------------- /image/wanandroid_update.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccaong/JetpackDemo/ad7ccdadab687c8ee3dec92577a7397809ebe2d5/image/wanandroid_update.png -------------------------------------------------------------------------------- /image/wanandroid_wechat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccaong/JetpackDemo/ad7ccdadab687c8ee3dec92577a7397809ebe2d5/image/wanandroid_wechat.png -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | rootProject.name='My Application' 3 | --------------------------------------------------------------------------------