├── .gitignore ├── .idea ├── .name ├── compiler.xml ├── copyright │ └── profiles_settings.xml ├── dictionaries │ └── apple.xml ├── encodings.xml ├── gradle.xml ├── misc.xml ├── modules.xml ├── runConfigurations.xml └── vcs.xml ├── README.md ├── app ├── .gitignore ├── build.gradle ├── debug.keystore.jks ├── libs │ └── lite-orm-1.9.1.jar ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── lives │ │ └── allyn │ │ └── com │ │ └── lives │ │ └── ApplicationTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── allyn │ │ │ └── lives │ │ │ ├── activity │ │ │ ├── AvatarImageBehavior.java │ │ │ ├── ConstMainActivity.java │ │ │ ├── MainActivity.java │ │ │ ├── base │ │ │ │ ├── BaseActivity.java │ │ │ │ └── ToolbarActivity.java │ │ │ ├── books │ │ │ │ ├── BooksClassifyDetailsActivity.java │ │ │ │ └── BooksDetailsActivity.java │ │ │ └── music │ │ │ │ └── MusicPlayActivivy.java │ │ │ ├── adapter │ │ │ ├── BookTitleAdapter.java │ │ │ ├── BooksClassAdapter.java │ │ │ ├── BooksClassItemAdapter.java │ │ │ ├── BooksViewPagerAdapter.java │ │ │ ├── MusicListAdapter.java │ │ │ ├── MusicLocalViewPagerAdapter.java │ │ │ └── SortAdapter.java │ │ │ ├── app │ │ │ └── MainApp.java │ │ │ ├── bean │ │ │ ├── AlbumBean.java │ │ │ ├── BooksBean.java │ │ │ ├── BooksClassifyBean.java │ │ │ ├── BooksDetailBean.java │ │ │ ├── MusicBean.java │ │ │ └── TranslationBean.java │ │ │ ├── events │ │ │ ├── MusicBeamEvent.java │ │ │ └── MusicCodeEvent.java │ │ │ ├── fragment │ │ │ ├── SettingsFragment.java │ │ │ ├── TranslationFragment.java │ │ │ ├── base │ │ │ │ └── BaseFragment.java │ │ │ ├── books │ │ │ │ ├── BooksClassifyFragment.java │ │ │ │ ├── BooksListFragment.java │ │ │ │ ├── BooksMainFragment.java │ │ │ │ └── RecommendBooksFragment.java │ │ │ ├── music │ │ │ │ ├── MusicLocalFragment.java │ │ │ │ ├── MusicLocalLikeFragment.java │ │ │ │ └── MusicLocalListFragment.java │ │ │ └── video │ │ │ │ └── TVFragment.java │ │ │ ├── holder │ │ │ ├── BooksClassifyTipHolder.java │ │ │ ├── BooksDetailHolder.java │ │ │ ├── BooksHolder.java │ │ │ └── MusicLocalHolder.java │ │ │ ├── manage │ │ │ └── PlayMainage.java │ │ │ ├── model │ │ │ ├── BooksModel.java │ │ │ ├── MusicModel.java │ │ │ └── TranslationModel.java │ │ │ ├── netwoarks │ │ │ ├── IPConfig.java │ │ │ ├── Invoking.java │ │ │ ├── LiveApi.java │ │ │ └── LiveRetrofit.java │ │ │ ├── presenter │ │ │ ├── BooksClassifyDetailsPresenter.java │ │ │ ├── BooksClassifyFragmentPresenter.java │ │ │ ├── BooksDetailPresenter.java │ │ │ ├── BooksListFragmentPresenter.java │ │ │ ├── MusicLikePresenter.java │ │ │ └── NewImagePreenter.java │ │ │ ├── service │ │ │ └── MusicService.java │ │ │ ├── utils │ │ │ ├── Config.java │ │ │ ├── Dialog.java │ │ │ ├── NetworkUtils.java │ │ │ ├── RxBus.java │ │ │ ├── StatusBarCompat.java │ │ │ ├── TextFormater.java │ │ │ ├── Transition.java │ │ │ └── blur │ │ │ │ ├── BlurTransformation.java │ │ │ │ ├── FastBlur.java │ │ │ │ └── RSBlur.java │ │ │ └── view │ │ │ ├── bottontab │ │ │ ├── BottomBarTab.java │ │ │ ├── BottomNavigationBar.java │ │ │ └── BottomNavigationBehavior.java │ │ │ └── widgets │ │ │ ├── CharacterParser.java │ │ │ ├── CommonDateUtils.java │ │ │ ├── CommonRefreshDateUtils.java │ │ │ ├── DividerItemDecoration.java │ │ │ ├── FlowTagLayout.java │ │ │ ├── PinyinComparator.java │ │ │ ├── RefreshListView.java │ │ │ ├── SlideLinerLayout.java │ │ │ └── SortModel.java │ └── res │ │ ├── drawable-xhdpi │ │ ├── ic_def.png │ │ ├── ic_delete.png │ │ ├── ic_music.png │ │ └── ic_nonetwork.png │ │ ├── drawable-xxhdpi │ │ ├── ic_arrow_back.png │ │ ├── ic_book_remove.png │ │ └── ic_classfiy.png │ │ ├── drawable-xxxhdpi │ │ └── ic_settings.png │ │ ├── drawable │ │ ├── bg_round_rectangle.xml │ │ ├── bg_round_rectangle_text_bg.xml │ │ ├── bg_searchview_contact.xml │ │ ├── btn_bg.xml │ │ ├── btn_status.xml │ │ ├── common_listview_footer_arrow.png │ │ ├── common_listview_header_arrow.png │ │ ├── large.png │ │ ├── red_dot.png │ │ ├── show_head_toast_bg.9.png │ │ ├── sidebar_background.xml │ │ └── small.png │ │ ├── layout │ │ ├── activity_books_classify_details.xml │ │ ├── activity_const.xml │ │ ├── activity_details.xml │ │ ├── activity_main.xml │ │ ├── activity_music_play_activivy.xml │ │ ├── common_list_view_foot_view.xml │ │ ├── common_list_view_head_view.xml │ │ ├── content_main.xml │ │ ├── error_layout.xml │ │ ├── fragment__img_tab.xml │ │ ├── fragment_books.xml │ │ ├── fragment_books_main.xml │ │ ├── fragment_booksetattle.xml │ │ ├── fragment_music_list.xml │ │ ├── fragment_music_tab.xml │ │ ├── fragment_settings.xml │ │ ├── fragment_translation.xml │ │ ├── fragment_tv.xml │ │ ├── item.xml │ │ ├── item_books_classify_content.xml │ │ ├── item_books_classify_tip.xml │ │ ├── item_bottom_navigation.xml │ │ ├── item_date.xml │ │ ├── item_details_title.xml │ │ ├── item_local_music.xml │ │ ├── item_music_list_title.xml │ │ ├── list_layout.xml │ │ ├── menu_main_head.xml │ │ ├── more_layout.xml │ │ ├── music_local_main.xml │ │ ├── myview_dialog.xml │ │ ├── nul_layout.xml │ │ ├── pp_bar_main.xml │ │ ├── progress_layout.xml │ │ └── tv_fragment_main.xml │ │ ├── menu │ │ └── activity_main_drawer.xml │ │ ├── mipmap-hdpi │ │ ├── ic_launcher.png │ │ ├── logo.png │ │ └── phone.png │ │ ├── mipmap-mdpi │ │ ├── ic_Previou_black.png │ │ ├── ic_book_people.png │ │ ├── ic_change.png │ │ ├── ic_circulation.png │ │ ├── ic_classity.png │ │ ├── ic_code_play_list.png │ │ ├── ic_delete.png │ │ ├── ic_image_book.png │ │ ├── ic_launcher.png │ │ ├── ic_like_red.png │ │ ├── ic_like_white.png │ │ ├── ic_mroe.png │ │ ├── ic_musicList.png │ │ ├── ic_new_book.png │ │ ├── ic_next_black.png │ │ ├── ic_order.png │ │ ├── ic_pause_black.png │ │ ├── ic_play_black.png │ │ ├── ic_random.png │ │ ├── ic_remove.png │ │ ├── ic_save.png │ │ ├── ic_unlike_red.png │ │ ├── ic_unlike_white.png │ │ ├── ic_unsave.png │ │ ├── ic_unvoice.png │ │ ├── ic_voice.png │ │ └── red_dot.png │ │ ├── mipmap-xhdpi │ │ ├── ic_book_default.png │ │ ├── ic_book_selected.png │ │ ├── ic_favorite_white.png │ │ ├── ic_history_white.png │ │ ├── ic_launcher.png │ │ ├── ic_movie_default.png │ │ ├── ic_movie_selected.png │ │ ├── ic_music_default.png │ │ ├── ic_music_selected.png │ │ ├── ic_news_default.png │ │ ├── ic_news_selected.png │ │ └── iocn_logo.png │ │ ├── mipmap-xxhdpi │ │ ├── ic_launcher.png │ │ └── ic_placeholder.png │ │ ├── mipmap-xxxhdpi │ │ ├── ic_launcher.png │ │ ├── ic_next.png │ │ ├── ic_pause.png │ │ ├── ic_play.png │ │ └── ic_previous.png │ │ ├── values-w820dp │ │ └── dimens.xml │ │ └── values │ │ ├── attr.xml │ │ ├── colors.xml │ │ ├── dimens.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── test │ └── java │ └── lives │ └── allyn │ └── com │ └── lives │ └── ExampleUnitTest.java ├── build.gradle ├── common ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── common │ │ ├── Constant.java │ │ ├── EasyApp.java │ │ ├── api │ │ ├── CallBack.java │ │ ├── OkHttpApi.java │ │ └── RestApi.java │ │ ├── comm │ │ ├── ArrayRecyclerAdapter.java │ │ ├── CommonAdapter.java │ │ ├── MainFragmentPagerAdapter.java │ │ └── ViewHolder.java │ │ ├── db │ │ ├── DBHelper.java │ │ └── DBManager.java │ │ ├── ui │ │ ├── BaseActivity.java │ │ ├── BaseFragment.java │ │ ├── EasyToolBar.java │ │ ├── ListViewFragment.java │ │ ├── ReplaceActivity.java │ │ └── WebViewActivity.java │ │ ├── utils │ │ ├── DateUtils.java │ │ ├── IntentUtils.java │ │ ├── NetworkUtils.java │ │ ├── ScreenUtils.java │ │ └── WebViewUtil.java │ │ └── widget │ │ └── EndlessScrollListener.java │ └── res │ ├── drawable-xxhdpi │ └── icon_arrow.png │ ├── drawable │ └── layerlist_webview_progress.xml │ ├── layout │ ├── activity_hosting.xml │ ├── activity_webview.xml │ ├── fragment_list.xml │ ├── layout_nav_toolbar.xml │ └── view_tool_bar.xml │ └── values │ ├── attrs.xml │ ├── colors.xml │ ├── dimens.xml │ └── strings.xml ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── img ├── 54F171BC28ED5C6A4AEC296B3FCF19E1.png ├── 71C85EC481B47886E842013DE4BC677B.png ├── 7477E4DAAF2AB3AEB408BB7E21EAA9A9.png ├── 7505C39DFA9E3C54B6272A749CDA5125.png ├── 92A2B8D2C1878D9FBCBC2C0BCBFE45BE.png ├── 98AE2857147B9DC2A130B9C821D6E601.png └── C7075614E4A7DD3AD34F62426A557E9B.png ├── live2.gif └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | -------------------------------------------------------------------------------- /.idea/.name: -------------------------------------------------------------------------------- 1 | Lives -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /.idea/dictionaries/apple.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17 | 18 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 19 | 29 | 30 | 31 | 32 | 33 | 34 | 36 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Lives 2 | 主要功能: 3 | 4 | 图书 5 | 翻译 6 | 音乐 7 | 视频 8 | 9 | # 效果图 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 使用技术: 20 | 21 | Rxjava 22 | 23 | RxBus 24 | 25 | Retrofit 26 | 27 | MVP Beam架构 28 | 29 | material 设计界面 30 | 31 | 相关链接 32 | 33 | 34 | https://github.com/Jude95/Beam/wiki 35 | 36 | 37 | https://github.com/wenhuaijun/SearchPictureTool 38 | 39 | http://www.tngou.net/doc 40 | 41 | 42 | {"status":true, "total":752,"tngou":[{"count":173,"fcount":0,"galleryclass":4,"id":766,"img":"/ext/160717/0cac4d91e152e76d9e50f700a1025fca.jpg","rcount":0,"size":6,"time":1468728796000,"title":"妩媚的裸身性感美女一丝不挂销魂床上私房照"},{"count":106,"fcount":0,"galleryclass":5,"id":747,"img":"/ext/160711/b5308c4afc253ab8df4c04b3e7b38538.jpg","rcount":0,"size":8,"time":1468237071000,"title":"气质美女包臀短裙性感美腿写真图片"}]} 43 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 23 5 | buildToolsVersion '25.0.0' 6 | 7 | defaultConfig { 8 | applicationId "com.szcx.caraide" 9 | minSdkVersion 14 10 | targetSdkVersion 23 11 | versionCode 2 12 | versionName "1.0.1" 13 | } 14 | buildTypes { 15 | release { 16 | minifyEnabled false 17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 18 | } 19 | } 20 | } 21 | 22 | 23 | dependencies { 24 | compile fileTree(include: ['*.jar'], dir: 'libs') 25 | testCompile 'junit:junit:4.12' 26 | compile('com.github.afollestad.material-dialogs:core:0.8.5.4@aar') { 27 | transitive = true 28 | } 29 | compile files('libs/lite-orm-1.9.1.jar') 30 | compile 'com.android.support:appcompat-v7:23.4.0' 31 | compile 'com.android.support:design:23.4.0' 32 | compile 'com.android.support:support-v4:23.4.0' 33 | compile 'com.github.bumptech.glide:glide:3.7.0' 34 | compile 'com.jakewharton:butterknife:7.0.1' 35 | compile 'com.pnikosis:materialish-progress:1.7' 36 | compile 'com.jude:beam:2.8.8' 37 | compile 'com.jude:utils:1.0.7' 38 | compile 'com.squareup.retrofit2:retrofit:2.0.2' 39 | compile 'com.squareup.retrofit2:converter-gson:2.0.2' 40 | compile 'com.squareup.retrofit2:adapter-rxjava:2.0.2' 41 | compile 'io.reactivex:rxjava:1.1.0' 42 | compile 'com.squareup.okhttp3:okhttp:3.2.0' 43 | compile 'com.android.support:cardview-v7:23.4.0' 44 | compile 'com.facebook.stetho:stetho-okhttp3:1.3.1' 45 | compile 'com.github.javiersantos:BottomDialogs:1.1' 46 | compile 'com.minimize.library:seekbar-compat:0.2.5' 47 | compile 'me.yokeyword:indexablestickylistview:0.6.2' 48 | compile 'de.hdodenhof:circleimageview:1.3.0' 49 | 50 | } -------------------------------------------------------------------------------- /app/debug.keystore.jks: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Allyns/Lives/453dec65e8f7d9a49f0642fdc698fe9066e34907/app/debug.keystore.jks -------------------------------------------------------------------------------- /app/libs/lite-orm-1.9.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Allyns/Lives/453dec65e8f7d9a49f0642fdc698fe9066e34907/app/libs/lite-orm-1.9.1.jar -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in G:\android\sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /app/src/androidTest/java/lives/allyn/com/lives/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package lives.allyn.com.lives; 2 | 3 | import android.app.Application; 4 | import android.test.ApplicationTestCase; 5 | 6 | /** 7 | * Testing Fundamentals 8 | */ 9 | public class ApplicationTest extends ApplicationTestCase { 10 | public ApplicationTest() { 11 | super(Application.class); 12 | } 13 | } -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 19 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 34 | 35 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /app/src/main/java/com/allyn/lives/activity/base/BaseActivity.java: -------------------------------------------------------------------------------- 1 | package com.allyn.lives.activity.base; 2 | 3 | import android.support.v7.app.AppCompatActivity; 4 | 5 | /** 6 | * Created by Administrator on 2016/3/29. 7 | */ 8 | public class BaseActivity extends AppCompatActivity { 9 | 10 | 11 | } 12 | -------------------------------------------------------------------------------- /app/src/main/java/com/allyn/lives/activity/base/ToolbarActivity.java: -------------------------------------------------------------------------------- 1 | package com.allyn.lives.activity.base; 2 | 3 | /** 4 | * Created by Administrator on 2016/6/27. 5 | */ 6 | public class ToolbarActivity extends BaseActivity{ 7 | 8 | 9 | } 10 | -------------------------------------------------------------------------------- /app/src/main/java/com/allyn/lives/activity/books/BooksClassifyDetailsActivity.java: -------------------------------------------------------------------------------- 1 | package com.allyn.lives.activity.books; 2 | import android.os.Bundle; 3 | import android.support.v7.widget.Toolbar; 4 | import android.view.ViewGroup; 5 | 6 | import com.allyn.lives.R; 7 | import com.allyn.lives.bean.BooksBean; 8 | import com.allyn.lives.holder.BooksHolder; 9 | import com.allyn.lives.presenter.BooksClassifyDetailsPresenter; 10 | import com.allyn.lives.utils.Config; 11 | import com.jude.beam.bijection.RequiresPresenter; 12 | import com.jude.beam.expansion.list.BeamListActivity; 13 | import com.jude.beam.expansion.list.ListConfig; 14 | import com.jude.easyrecyclerview.EasyRecyclerView; 15 | import com.jude.easyrecyclerview.adapter.BaseViewHolder; 16 | 17 | import butterknife.Bind; 18 | import butterknife.ButterKnife; 19 | 20 | @RequiresPresenter(BooksClassifyDetailsPresenter.class) 21 | public class BooksClassifyDetailsActivity extends BeamListActivity { 22 | 23 | @Bind(R.id.toolbar) 24 | Toolbar toolbar; 25 | @Bind(R.id.recycler) 26 | EasyRecyclerView recyclerView; 27 | 28 | @Override 29 | protected BaseViewHolder getViewHolder(ViewGroup parent, int viewType) { 30 | return new BooksHolder(parent); 31 | } 32 | 33 | @Override 34 | protected void onCreate(Bundle savedInstanceState) { 35 | super.onCreate(savedInstanceState); 36 | ButterKnife.bind(BooksClassifyDetailsActivity.this); 37 | setSupportActionBar(toolbar); 38 | toolbar.setTitle(getIntent().getStringExtra(Config.BookClassifyName)); 39 | } 40 | 41 | @Override 42 | public int getLayout() { 43 | return R.layout.activity_books_classify_details; 44 | } 45 | 46 | @Override 47 | protected ListConfig getConfig() { 48 | return super.getConfig() 49 | .setLoadMoreRes(R.layout.more_layout) 50 | .setLoadmoreAble(true) 51 | .setRefreshAble(true) 52 | .setContainerProgressAble(true) 53 | .setContainerProgressRes(R.layout.progress_layout); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /app/src/main/java/com/allyn/lives/activity/books/BooksDetailsActivity.java: -------------------------------------------------------------------------------- 1 | package com.allyn.lives.activity.books; 2 | 3 | import android.support.design.widget.FloatingActionButton; 4 | import android.os.Bundle; 5 | import android.support.v7.widget.Toolbar; 6 | import android.view.View; 7 | import android.widget.ImageView; 8 | import android.widget.TextView; 9 | 10 | import com.allyn.lives.R; 11 | import com.allyn.lives.presenter.BooksDetailPresenter; 12 | import com.allyn.lives.utils.Config; 13 | import com.jude.beam.bijection.RequiresPresenter; 14 | import com.jude.beam.expansion.BeamBaseActivity; 15 | import com.jude.easyrecyclerview.EasyRecyclerView; 16 | import com.pnikosis.materialishprogress.ProgressWheel; 17 | 18 | import butterknife.Bind; 19 | import butterknife.ButterKnife; 20 | 21 | @RequiresPresenter(BooksDetailPresenter.class) 22 | public class BooksDetailsActivity extends BeamBaseActivity { 23 | 24 | @Bind(R.id.toolbar) 25 | public Toolbar toolbar; 26 | @Bind(R.id.loading_progre) 27 | public ProgressWheel loading_progre; 28 | @Bind(R.id.fab) 29 | public FloatingActionButton fab; 30 | @Bind(R.id.tvAuthor) 31 | public TextView mAuthor; 32 | @Bind(R.id.tvClassifyName) 33 | public TextView mTvClassifyName; 34 | @Bind(R.id.recycler) 35 | public EasyRecyclerView recyclerView; 36 | @Bind(R.id.ivMsg) 37 | public ImageView mMsg; 38 | @Bind(R.id.ivBg) 39 | public ImageView mivBg; 40 | 41 | 42 | @Override 43 | protected void onCreate(Bundle savedInstanceState) { 44 | super.onCreate(savedInstanceState); 45 | setContentView(R.layout.activity_details); 46 | ButterKnife.bind(this); 47 | setSupportActionBar(toolbar); 48 | toolbar.setTitle(getIntent().getStringExtra(Config.Title)); 49 | recyclerView.setErrorView(R.layout.error_layout); 50 | } 51 | 52 | 53 | } 54 | -------------------------------------------------------------------------------- /app/src/main/java/com/allyn/lives/adapter/BookTitleAdapter.java: -------------------------------------------------------------------------------- 1 | package com.allyn.lives.adapter; 2 | 3 | import android.content.Context; 4 | import android.view.ViewGroup; 5 | 6 | import com.allyn.lives.bean.BooksDetailBean; 7 | import com.allyn.lives.holder.BooksDetailHolder; 8 | import com.jude.easyrecyclerview.adapter.BaseViewHolder; 9 | import com.jude.easyrecyclerview.adapter.RecyclerArrayAdapter; 10 | 11 | import java.util.List; 12 | 13 | /** 14 | * Created by Administrator on 2016/6/28. 15 | */ 16 | public class BookTitleAdapter extends RecyclerArrayAdapter{ 17 | 18 | public BookTitleAdapter(Context context){ 19 | super(context); 20 | } 21 | 22 | @Override 23 | public void onBindViewHolder(BaseViewHolder holder, int position, List payloads) { 24 | super.onBindViewHolder(holder, position, payloads); 25 | } 26 | 27 | @Override 28 | public BaseViewHolder OnCreateViewHolder(ViewGroup parent, int viewType) { 29 | return new BooksDetailHolder(parent); 30 | } 31 | 32 | @Override 33 | public int getCount() { 34 | return super.getCount(); 35 | } 36 | 37 | @Override 38 | public int getViewType(int position) { 39 | return super.getViewType(position); 40 | } 41 | 42 | } 43 | 44 | -------------------------------------------------------------------------------- /app/src/main/java/com/allyn/lives/adapter/BooksClassAdapter.java: -------------------------------------------------------------------------------- 1 | package com.allyn.lives.adapter; 2 | 3 | import android.content.Context; 4 | import android.view.ViewGroup; 5 | 6 | import com.allyn.lives.holder.BooksClassifyTipHolder; 7 | import com.allyn.lives.bean.BooksClassifyBean; 8 | import com.jude.easyrecyclerview.adapter.BaseViewHolder; 9 | import com.jude.easyrecyclerview.adapter.RecyclerArrayAdapter; 10 | 11 | import java.util.List; 12 | 13 | /** 14 | * Created by Administrator on 2016/6/22. 15 | */ 16 | public class BooksClassAdapter extends RecyclerArrayAdapter { 17 | 18 | public BooksClassAdapter(Context context) { 19 | super(context); 20 | } 21 | 22 | @Override 23 | public BaseViewHolder OnCreateViewHolder(ViewGroup parent, int viewType) { 24 | return new BooksClassifyTipHolder(parent); 25 | } 26 | 27 | @Override 28 | public void onBindViewHolder(BaseViewHolder holder, int position, List payloads) { 29 | super.onBindViewHolder(holder, position, payloads); 30 | } 31 | 32 | @Override 33 | public long getItemId(int position) { 34 | return super.getItemId(position); 35 | } 36 | 37 | @Override 38 | public int getCount() { 39 | return super.getCount(); 40 | } 41 | 42 | @Override 43 | public int getViewType(int position) { 44 | return super.getViewType(position); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /app/src/main/java/com/allyn/lives/adapter/BooksClassItemAdapter.java: -------------------------------------------------------------------------------- 1 | package com.allyn.lives.adapter; 2 | 3 | import android.content.Context; 4 | import android.view.ViewGroup; 5 | 6 | import com.allyn.lives.holder.BooksHolder; 7 | import com.allyn.lives.bean.BooksBean; 8 | import com.jude.easyrecyclerview.adapter.BaseViewHolder; 9 | import com.jude.easyrecyclerview.adapter.RecyclerArrayAdapter; 10 | 11 | import java.util.List; 12 | 13 | /** 14 | * Created by Administrator on 2016/6/22. 15 | */ 16 | public class BooksClassItemAdapter extends RecyclerArrayAdapter { 17 | 18 | public BooksClassItemAdapter(Context context) { 19 | super(context); 20 | } 21 | 22 | @Override 23 | public BaseViewHolder OnCreateViewHolder(ViewGroup parent, int viewType) { 24 | return new BooksHolder(parent); 25 | } 26 | 27 | @Override 28 | public void onBindViewHolder(BaseViewHolder holder, int position, List payloads) { 29 | super.onBindViewHolder(holder, position, payloads); 30 | } 31 | 32 | @Override 33 | public int getCount() { 34 | return super.getCount(); 35 | } 36 | 37 | @Override 38 | public int getViewType(int position) { 39 | return super.getViewType(position); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /app/src/main/java/com/allyn/lives/adapter/BooksViewPagerAdapter.java: -------------------------------------------------------------------------------- 1 | package com.allyn.lives.adapter; 2 | 3 | import android.support.v4.app.Fragment; 4 | import android.support.v4.app.FragmentManager; 5 | import android.support.v4.app.FragmentPagerAdapter; 6 | 7 | import com.allyn.lives.R; 8 | import com.allyn.lives.app.MainApp; 9 | import com.allyn.lives.fragment.books.BooksClassifyFragment; 10 | import com.allyn.lives.fragment.books.BooksListFragment; 11 | 12 | /** 13 | * Created by apple on 16/6/11. 14 | */ 15 | public class BooksViewPagerAdapter extends FragmentPagerAdapter { 16 | 17 | String[] tab_title; 18 | 19 | public BooksViewPagerAdapter(FragmentManager manager) { 20 | super(manager); 21 | tab_title = MainApp.getContexts().getResources().getStringArray(R.array.books_classify_tab); 22 | } 23 | 24 | @Override 25 | public Fragment getItem(int position) { 26 | Fragment fragment = null; 27 | switch (position) { 28 | case 0: 29 | fragment = BooksClassifyFragment.newInstance(); 30 | break; 31 | case 1: 32 | fragment = BooksListFragment.newInstance(9); 33 | break; 34 | case 2: 35 | fragment = BooksListFragment.newInstance(7); 36 | break; 37 | case 3: 38 | fragment = BooksListFragment.newInstance(4); 39 | break; 40 | case 4: 41 | fragment = BooksListFragment.newInstance(3); 42 | break; 43 | case 5: 44 | fragment = BooksListFragment.newInstance(5); 45 | break; 46 | } 47 | return fragment; 48 | } 49 | 50 | @Override 51 | public int getCount() { 52 | return tab_title.length; 53 | } 54 | 55 | @Override 56 | public CharSequence getPageTitle(int position) { 57 | return tab_title[position]; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /app/src/main/java/com/allyn/lives/adapter/MusicListAdapter.java: -------------------------------------------------------------------------------- 1 | package com.allyn.lives.adapter; 2 | 3 | import android.content.Context; 4 | import android.content.Intent; 5 | import android.os.Bundle; 6 | import android.util.Log; 7 | import android.view.LayoutInflater; 8 | import android.view.View; 9 | import android.view.ViewGroup; 10 | import android.widget.ImageView; 11 | import android.widget.TextView; 12 | 13 | import com.allyn.lives.R; 14 | import com.allyn.lives.activity.music.MusicPlayActivivy; 15 | import com.allyn.lives.bean.MusicBean; 16 | import com.allyn.lives.service.MusicService; 17 | import com.allyn.lives.utils.Config; 18 | 19 | import butterknife.Bind; 20 | import butterknife.ButterKnife; 21 | import me.yokeyword.indexablelistview.IndexableAdapter; 22 | 23 | /** 24 | * Created by Administrator on 2016/7/8. 25 | */ 26 | public class MusicListAdapter extends IndexableAdapter { 27 | 28 | Context context; 29 | 30 | public MusicListAdapter(Context context) { 31 | this.context = context; 32 | } 33 | 34 | @Override 35 | protected TextView onCreateTitleViewHolder(ViewGroup parent) { 36 | View view = LayoutInflater.from(context).inflate(R.layout.item_music_list_title, parent, false); 37 | return (TextView) view.findViewById(R.id.tvTitle); 38 | } 39 | 40 | @Override 41 | protected ViewHolder onCreateViewHolder(ViewGroup parent) { 42 | View view = LayoutInflater.from(context).inflate(R.layout.item_local_music, parent, false); 43 | return new MusicLocalHolder(view); 44 | } 45 | 46 | 47 | @Override 48 | protected void onBindViewHolder(ViewHolder holder, MusicBean cityEntity) { 49 | MusicLocalHolder musicLocalHolder = (MusicLocalHolder) holder; 50 | musicLocalHolder.mName.setText(cityEntity.getName()); 51 | musicLocalHolder.mMsg.setText(cityEntity.getArtist() + " - " + cityEntity.getAlbum()); 52 | } 53 | 54 | class MusicLocalHolder extends IndexableAdapter.ViewHolder { 55 | 56 | @Bind(R.id.local_music_name) 57 | TextView mName; 58 | @Bind(R.id.local_music_msg) 59 | TextView mMsg; 60 | @Bind(R.id.local_music_img) 61 | ImageView mImg; 62 | 63 | public MusicLocalHolder(View view) { 64 | super(view); 65 | ButterKnife.bind(this, view); 66 | } 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /app/src/main/java/com/allyn/lives/adapter/MusicLocalViewPagerAdapter.java: -------------------------------------------------------------------------------- 1 | package com.allyn.lives.adapter; 2 | 3 | import android.support.v4.app.Fragment; 4 | import android.support.v4.app.FragmentManager; 5 | import android.support.v4.app.FragmentPagerAdapter; 6 | 7 | import com.allyn.lives.R; 8 | import com.allyn.lives.app.MainApp; 9 | import com.allyn.lives.fragment.music.MusicLocalLikeFragment; 10 | import com.allyn.lives.fragment.music.MusicLocalListFragment; 11 | 12 | /** 13 | * Created by apple on 16/6/11. 14 | */ 15 | public class MusicLocalViewPagerAdapter extends FragmentPagerAdapter { 16 | 17 | String[] tab_title; 18 | 19 | public MusicLocalViewPagerAdapter(FragmentManager manager) { 20 | super(manager); 21 | tab_title = MainApp.getContexts().getResources().getStringArray(R.array.local_music_tab); 22 | } 23 | 24 | @Override 25 | public Fragment getItem(int position) { 26 | Fragment fragment = null; 27 | switch (position) { 28 | case 0: 29 | fragment = MusicLocalListFragment.newInstance(); 30 | break; 31 | case 1: 32 | fragment = MusicLocalLikeFragment.newInstance(); 33 | break; 34 | } 35 | return fragment; 36 | 37 | } 38 | 39 | @Override 40 | public int getCount() { 41 | return tab_title.length; 42 | } 43 | 44 | @Override 45 | public CharSequence getPageTitle(int position) { 46 | return tab_title[position]; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /app/src/main/java/com/allyn/lives/app/MainApp.java: -------------------------------------------------------------------------------- 1 | package com.allyn.lives.app; 2 | 3 | import android.app.Application; 4 | 5 | import com.jude.beam.Beam; 6 | import com.jude.utils.JUtils; 7 | import com.litesuits.orm.LiteOrm; 8 | 9 | /** 10 | * Created by Administrator on 2016/3/25. 11 | */ 12 | public class MainApp extends Application { 13 | 14 | static MainApp mainApp; 15 | static LiteOrm liteOrm; 16 | 17 | @Override 18 | public void onCreate() { 19 | mainApp = this; 20 | super.onCreate(); 21 | JUtils.initialize(this); 22 | Beam.init(this); 23 | } 24 | 25 | @Override 26 | public void onTerminate() { 27 | super.onTerminate(); 28 | if (liteOrm != null) { 29 | liteOrm.close(); 30 | } 31 | } 32 | 33 | public static MainApp getContexts() { 34 | return mainApp; 35 | } 36 | 37 | public static LiteOrm getLiteOrm() { 38 | if (liteOrm == null) { 39 | liteOrm = LiteOrm.newCascadeInstance(mainApp.getApplicationContext(), "musiclike.db"); 40 | } 41 | return liteOrm; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /app/src/main/java/com/allyn/lives/bean/AlbumBean.java: -------------------------------------------------------------------------------- 1 | package com.allyn.lives.bean; 2 | 3 | /** 4 | * Created by apple on 16/6/12. 5 | */ 6 | public class AlbumBean { 7 | 8 | private int id; 9 | private String name; 10 | private int size; 11 | private String Singer; 12 | private String imageUrl; 13 | 14 | public AlbumBean() { 15 | 16 | } 17 | 18 | public AlbumBean(int id, String name, int size, String singer, String imageUrl) { 19 | this.id = id; 20 | this.name = name; 21 | this.size = size; 22 | Singer = singer; 23 | this.imageUrl = imageUrl; 24 | } 25 | 26 | public int getId() { 27 | return id; 28 | } 29 | 30 | public void setId(int id) { 31 | this.id = id; 32 | } 33 | 34 | public String getName() { 35 | return name; 36 | } 37 | 38 | public void setName(String name) { 39 | this.name = name; 40 | } 41 | 42 | public int getSize() { 43 | return size; 44 | } 45 | 46 | public void setSize(int size) { 47 | this.size = size; 48 | } 49 | 50 | public String getSinger() { 51 | return Singer; 52 | } 53 | 54 | public void setSinger(String singer) { 55 | Singer = singer; 56 | } 57 | 58 | public String getImageUrl() { 59 | return imageUrl; 60 | } 61 | 62 | public void setImageUrl(String imageUrl) { 63 | this.imageUrl = imageUrl; 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /app/src/main/java/com/allyn/lives/events/MusicBeamEvent.java: -------------------------------------------------------------------------------- 1 | package com.allyn.lives.events; 2 | 3 | import com.allyn.lives.bean.MusicBean; 4 | 5 | /** 6 | * Created by Administrator on 2016/7/1. 7 | */ 8 | public class MusicBeamEvent { 9 | 10 | private MusicBean bean; 11 | 12 | public int getIndex() { 13 | return index; 14 | } 15 | 16 | public void setIndex(int index) { 17 | this.index = index; 18 | } 19 | 20 | private int index; 21 | 22 | public MusicBean getBean() { 23 | return bean; 24 | } 25 | 26 | public void setBean(MusicBean bean) { 27 | this.bean = bean; 28 | } 29 | 30 | public MusicBeamEvent(MusicBean bean) { 31 | this.bean = bean; 32 | } 33 | 34 | public MusicBeamEvent(int index) { 35 | this.index = index; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /app/src/main/java/com/allyn/lives/events/MusicCodeEvent.java: -------------------------------------------------------------------------------- 1 | package com.allyn.lives.events; 2 | 3 | /** 4 | * Created by Administrator on 2016/11/7. 5 | */ 6 | 7 | public class MusicCodeEvent { 8 | 9 | } 10 | -------------------------------------------------------------------------------- /app/src/main/java/com/allyn/lives/fragment/SettingsFragment.java: -------------------------------------------------------------------------------- 1 | package com.allyn.lives.fragment; 2 | 3 | 4 | import android.content.Intent; 5 | import android.os.Bundle; 6 | import android.support.v4.app.Fragment; 7 | import android.view.LayoutInflater; 8 | import android.view.View; 9 | import android.view.ViewGroup; 10 | import android.widget.Button; 11 | import android.widget.Toast; 12 | 13 | import com.allyn.lives.R; 14 | import com.allyn.lives.activity.ConstMainActivity; 15 | import com.allyn.lives.bean.AlbumBean; 16 | 17 | import butterknife.Bind; 18 | import butterknife.ButterKnife; 19 | 20 | /** 21 | * A simple {@link Fragment} subclass. 22 | */ 23 | public class SettingsFragment extends Fragment { 24 | public static SettingsFragment newInstance() { 25 | SettingsFragment fragment = new SettingsFragment(); 26 | return fragment; 27 | } 28 | 29 | @Bind(R.id.button) 30 | Button button; 31 | 32 | @Override 33 | public View onCreateView(LayoutInflater inflater, ViewGroup container, 34 | Bundle savedInstanceState) { 35 | View v = inflater.inflate(R.layout.fragment_settings, container, false); 36 | ButterKnife.bind(this, v); 37 | button.setOnClickListener(new View.OnClickListener() { 38 | @Override 39 | public void onClick(View v) { 40 | getActivity().startActivity(new Intent(getActivity(), ConstMainActivity.class)); 41 | // Ttest("allyn",123456,"hahahha",0.22); 42 | Objecttest("allyn",123456,"hahahha",0.22); 43 | } 44 | }); 45 | return v; 46 | } 47 | //泛型测试 48 | public void Ttest(T... pag){ 49 | Toast.makeText(getActivity(), pag[0]+"", Toast.LENGTH_SHORT).show(); 50 | Toast.makeText(getActivity(), pag[1]+"", Toast.LENGTH_SHORT).show(); 51 | Toast.makeText(getActivity(), pag[2]+"", Toast.LENGTH_SHORT).show(); 52 | for (T t : pag) { 53 | Toast.makeText(getActivity(), t+"", Toast.LENGTH_SHORT).show(); 54 | } 55 | } 56 | public void Objecttest(Object... pag){ 57 | Toast.makeText(getActivity(), pag[0]+"", Toast.LENGTH_SHORT).show(); 58 | Toast.makeText(getActivity(), pag[1]+"", Toast.LENGTH_SHORT).show(); 59 | Toast.makeText(getActivity(), pag[2]+"", Toast.LENGTH_SHORT).show(); 60 | for (Object t : pag) { 61 | Toast.makeText(getActivity(), t+"", Toast.LENGTH_SHORT).show(); 62 | } 63 | } 64 | 65 | } 66 | -------------------------------------------------------------------------------- /app/src/main/java/com/allyn/lives/fragment/base/BaseFragment.java: -------------------------------------------------------------------------------- 1 | package com.allyn.lives.fragment.base; 2 | 3 | import android.os.Bundle; 4 | import android.support.annotation.Nullable; 5 | import android.support.v4.app.Fragment; 6 | 7 | import com.allyn.lives.netwoarks.LiveApi; 8 | import com.allyn.lives.netwoarks.LiveRetrofit; 9 | import com.allyn.lives.utils.StatusBarCompat; 10 | 11 | import rx.Subscription; 12 | import rx.subscriptions.CompositeSubscription; 13 | 14 | /** 15 | * Created by Administrator on 2016/4/6. 16 | */ 17 | public class BaseFragment extends Fragment { 18 | 19 | 20 | @Override 21 | public void onCreate(@Nullable Bundle savedInstanceState) { 22 | super.onCreate(savedInstanceState); 23 | // StatusBarCompat.setStatusBarColor(getActivity()); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /app/src/main/java/com/allyn/lives/fragment/books/BooksClassifyFragment.java: -------------------------------------------------------------------------------- 1 | package com.allyn.lives.fragment.books; 2 | 3 | 4 | import android.os.Bundle; 5 | import android.view.LayoutInflater; 6 | import android.view.View; 7 | import android.view.ViewGroup; 8 | 9 | import com.allyn.lives.R; 10 | import com.allyn.lives.presenter.BooksClassifyFragmentPresenter; 11 | import com.jude.beam.bijection.BeamFragment; 12 | import com.jude.beam.bijection.RequiresPresenter; 13 | import com.jude.easyrecyclerview.EasyRecyclerView; 14 | 15 | /** 16 | * 2016-6-21 17 | */ 18 | @RequiresPresenter(BooksClassifyFragmentPresenter.class) 19 | public class BooksClassifyFragment extends BeamFragment { 20 | 21 | 22 | public static BooksClassifyFragment newInstance() { 23 | BooksClassifyFragment imageFragment = new BooksClassifyFragment(); 24 | return imageFragment; 25 | } 26 | 27 | public EasyRecyclerView recyclerView; 28 | 29 | @Override 30 | public View onCreateView(LayoutInflater inflater, ViewGroup container, 31 | Bundle savedInstanceState) { 32 | View v = inflater.inflate(R.layout.fragment_books, container, false); 33 | recyclerView = (EasyRecyclerView) v.findViewById(R.id.recycler); 34 | recyclerView.setErrorView(R.layout.error_layout); 35 | recyclerView.setProgressView(R.layout.progress_layout); 36 | return v; 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /app/src/main/java/com/allyn/lives/fragment/books/BooksListFragment.java: -------------------------------------------------------------------------------- 1 | package com.allyn.lives.fragment.books; 2 | 3 | 4 | import android.os.Bundle; 5 | import android.support.annotation.Nullable; 6 | import android.support.v4.app.Fragment; 7 | import android.view.LayoutInflater; 8 | import android.view.View; 9 | import android.view.ViewGroup; 10 | 11 | import com.allyn.lives.R; 12 | import com.allyn.lives.bean.BooksBean; 13 | import com.allyn.lives.holder.BooksHolder; 14 | import com.allyn.lives.presenter.BooksListFragmentPresenter; 15 | import com.allyn.lives.utils.Config; 16 | import com.jude.beam.bijection.RequiresPresenter; 17 | import com.jude.beam.expansion.list.BeamListFragment; 18 | import com.jude.beam.expansion.list.ListConfig; 19 | import com.jude.easyrecyclerview.adapter.BaseViewHolder; 20 | 21 | /** 22 | * A simple {@link Fragment} subclass. 23 | */ 24 | @RequiresPresenter(BooksListFragmentPresenter.class) 25 | public class BooksListFragment extends BeamListFragment { 26 | 27 | 28 | public static BooksListFragment newInstance(int typeId) { 29 | Bundle bundle = new Bundle(); 30 | bundle.putInt(Config.Type, typeId); 31 | BooksListFragment fragment = new BooksListFragment(); 32 | fragment.setArguments(bundle); 33 | return fragment; 34 | } 35 | 36 | @Nullable 37 | @Override 38 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { 39 | return super.onCreateView(inflater, container, savedInstanceState); 40 | 41 | } 42 | 43 | @Override 44 | protected BaseViewHolder getViewHolder(ViewGroup parent, int viewType) { 45 | return new BooksHolder(parent); 46 | } 47 | 48 | @Override 49 | protected ListConfig getConfig() { 50 | return super.getConfig() 51 | .setRefreshAble(true) 52 | .setErrorAble(true) 53 | .setLoadMoreRes(R.layout.more_layout) 54 | .setLoadmoreAble(true) 55 | .setContainerErrorAble(true) 56 | .setContainerProgressRes(R.layout.progress_layout) 57 | .setNoMoreAble(true); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /app/src/main/java/com/allyn/lives/fragment/books/BooksMainFragment.java: -------------------------------------------------------------------------------- 1 | package com.allyn.lives.fragment.books; 2 | 3 | 4 | import android.os.Bundle; 5 | import android.support.annotation.Nullable; 6 | import android.support.design.widget.TabLayout; 7 | import android.support.v4.app.Fragment; 8 | import android.support.v4.view.ViewPager; 9 | import android.support.v7.widget.Toolbar; 10 | import android.view.LayoutInflater; 11 | import android.view.View; 12 | import android.view.ViewGroup; 13 | 14 | import com.allyn.lives.R; 15 | import com.allyn.lives.adapter.BooksViewPagerAdapter; 16 | import com.allyn.lives.fragment.base.BaseFragment; 17 | import com.allyn.lives.utils.Config; 18 | 19 | import butterknife.Bind; 20 | import butterknife.ButterKnife; 21 | 22 | 23 | /** 24 | * A simple {@link Fragment} subclass. 25 | */ 26 | public class BooksMainFragment extends BaseFragment { 27 | 28 | 29 | @Bind(R.id.tablayout) 30 | TabLayout mTabLayout; 31 | @Bind(R.id.viewpager) 32 | ViewPager mViewpager; 33 | 34 | 35 | public static BooksMainFragment newInstance() { 36 | BooksMainFragment imageMainFragment = new BooksMainFragment(); 37 | return imageMainFragment; 38 | } 39 | 40 | @Nullable 41 | @Override 42 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { 43 | View v = inflater.inflate(R.layout.fragment__img_tab, container, false); 44 | ButterKnife.bind(this, v); 45 | initView(); 46 | return v; 47 | } 48 | 49 | private void initView() { 50 | BooksViewPagerAdapter viewpageradapter = new BooksViewPagerAdapter(getChildFragmentManager()); 51 | mViewpager.setAdapter(viewpageradapter); 52 | // mViewpager.setOffscreenPageLimit(6); 53 | mTabLayout.setupWithViewPager(mViewpager); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /app/src/main/java/com/allyn/lives/fragment/books/RecommendBooksFragment.java: -------------------------------------------------------------------------------- 1 | package com.allyn.lives.fragment.books; 2 | 3 | import android.support.v4.app.Fragment; 4 | import android.view.ViewGroup; 5 | 6 | import com.allyn.lives.R; 7 | import com.allyn.lives.bean.BooksBean; 8 | import com.allyn.lives.holder.BooksHolder; 9 | import com.allyn.lives.presenter.NewImagePreenter; 10 | import com.jude.beam.bijection.RequiresPresenter; 11 | import com.jude.beam.expansion.list.BeamListFragment; 12 | import com.jude.beam.expansion.list.ListConfig; 13 | import com.jude.easyrecyclerview.adapter.BaseViewHolder; 14 | 15 | /** 16 | * A simple {@link Fragment} subclass. 17 | */ 18 | @RequiresPresenter(NewImagePreenter.class) 19 | public class RecommendBooksFragment extends BeamListFragment { 20 | 21 | 22 | public static RecommendBooksFragment newInstance() { 23 | RecommendBooksFragment newImageFragment = new RecommendBooksFragment(); 24 | return newImageFragment; 25 | } 26 | 27 | @Override 28 | protected BaseViewHolder getViewHolder(ViewGroup parent, int viewType) { 29 | return new BooksHolder(parent); 30 | } 31 | 32 | @Override 33 | protected ListConfig getConfig() { 34 | return super.getConfig() 35 | .setContainerProgressRes(R.layout.progress_layout) 36 | .setLoadmoreAble(true) 37 | .setLoadMoreRes(R.layout.more_layout); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /app/src/main/java/com/allyn/lives/fragment/music/MusicLocalFragment.java: -------------------------------------------------------------------------------- 1 | package com.allyn.lives.fragment.music; 2 | 3 | import android.os.Bundle; 4 | import android.support.annotation.Nullable; 5 | import android.support.design.widget.TabLayout; 6 | import android.support.v4.view.ViewPager; 7 | import android.support.v7.widget.Toolbar; 8 | import android.view.LayoutInflater; 9 | import android.view.View; 10 | import android.view.ViewGroup; 11 | 12 | import com.allyn.lives.R; 13 | import com.allyn.lives.adapter.MusicLocalViewPagerAdapter; 14 | import com.allyn.lives.fragment.base.BaseFragment; 15 | 16 | import butterknife.Bind; 17 | import butterknife.ButterKnife; 18 | 19 | /** 20 | * Created by apple on 16/6/11. 21 | */ 22 | public class MusicLocalFragment extends BaseFragment { 23 | 24 | 25 | @Bind(R.id.tablayout) 26 | TabLayout mTabLayout; 27 | @Bind(R.id.viewpager) 28 | ViewPager mViewpager; 29 | 30 | 31 | public static MusicLocalFragment newInstance() { 32 | MusicLocalFragment localFragment = new MusicLocalFragment(); 33 | return localFragment; 34 | } 35 | 36 | @Nullable 37 | @Override 38 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { 39 | View v = inflater.inflate(R.layout.fragment_music_tab, container, false); 40 | ButterKnife.bind(this, v); 41 | initView(); 42 | return v; 43 | } 44 | 45 | private void initView() { 46 | MusicLocalViewPagerAdapter viewpageradapter = new MusicLocalViewPagerAdapter(getChildFragmentManager()); 47 | mViewpager.setAdapter(viewpageradapter); 48 | mViewpager.setOffscreenPageLimit(3); 49 | mTabLayout.setupWithViewPager(mViewpager); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /app/src/main/java/com/allyn/lives/fragment/music/MusicLocalLikeFragment.java: -------------------------------------------------------------------------------- 1 | package com.allyn.lives.fragment.music; 2 | 3 | import android.view.ViewGroup; 4 | 5 | import com.allyn.lives.R; 6 | import com.allyn.lives.bean.MusicBean; 7 | import com.allyn.lives.holder.MusicLocalHolder; 8 | import com.allyn.lives.presenter.MusicLikePresenter; 9 | import com.jude.beam.bijection.RequiresPresenter; 10 | import com.jude.beam.expansion.list.BeamListFragment; 11 | import com.jude.beam.expansion.list.ListConfig; 12 | import com.jude.easyrecyclerview.adapter.BaseViewHolder; 13 | 14 | @RequiresPresenter(MusicLikePresenter.class) 15 | public class MusicLocalLikeFragment extends BeamListFragment { 16 | 17 | public static MusicLocalLikeFragment newInstance() { 18 | MusicLocalLikeFragment musicLocalAlbumFragment = new MusicLocalLikeFragment(); 19 | return musicLocalAlbumFragment; 20 | } 21 | 22 | @Override 23 | protected BaseViewHolder getViewHolder(ViewGroup parent, int viewType) { 24 | return new MusicLocalHolder(parent); 25 | } 26 | 27 | @Override 28 | protected ListConfig getConfig() { 29 | return super.getConfig() 30 | .setContainerProgressRes(R.layout.progress_layout) 31 | .setErrorRes(R.layout.nul_layout) 32 | .setRefreshAble(true) 33 | .setErrorAble(true); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /app/src/main/java/com/allyn/lives/fragment/video/TVFragment.java: -------------------------------------------------------------------------------- 1 | package com.allyn.lives.fragment.video; 2 | 3 | 4 | import android.os.Bundle; 5 | import android.support.annotation.Nullable; 6 | import android.support.v7.widget.Toolbar; 7 | import android.text.Html; 8 | import android.text.method.ScrollingMovementMethod; 9 | import android.view.LayoutInflater; 10 | import android.view.View; 11 | import android.view.ViewGroup; 12 | import android.widget.TextView; 13 | 14 | import com.allyn.lives.R; 15 | import com.allyn.lives.fragment.base.BaseFragment; 16 | 17 | import butterknife.Bind; 18 | import butterknife.ButterKnife; 19 | 20 | /** 21 | * Created by Administrator on 2016/3/22. 22 | */ 23 | public class TVFragment extends BaseFragment { 24 | 25 | @Bind(R.id.toolbar) 26 | Toolbar toolbar; 27 | 28 | public static TVFragment newInstance() { 29 | TVFragment fragment = new TVFragment(); 30 | return fragment; 31 | } 32 | 33 | @Nullable 34 | @Override 35 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { 36 | View v = inflater.inflate(R.layout.tv_fragment_main, container, false); 37 | ButterKnife.bind(this, v); 38 | toolbar.setTitle("视频"); 39 | return v; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /app/src/main/java/com/allyn/lives/holder/BooksClassifyTipHolder.java: -------------------------------------------------------------------------------- 1 | package com.allyn.lives.holder; 2 | 3 | import android.content.Intent; 4 | import android.support.v7.widget.GridLayoutManager; 5 | import android.view.View; 6 | import android.view.ViewGroup; 7 | import android.widget.Button; 8 | import android.widget.TextView; 9 | 10 | import com.allyn.lives.R; 11 | import com.allyn.lives.activity.books.BooksClassifyDetailsActivity; 12 | import com.allyn.lives.adapter.BooksClassItemAdapter; 13 | import com.allyn.lives.bean.BooksBean; 14 | import com.allyn.lives.bean.BooksClassifyBean; 15 | import com.allyn.lives.model.BooksModel; 16 | import com.allyn.lives.utils.Config; 17 | import com.jude.easyrecyclerview.EasyRecyclerView; 18 | import com.jude.easyrecyclerview.adapter.BaseViewHolder; 19 | 20 | import java.util.Random; 21 | 22 | import rx.Subscriber; 23 | 24 | /** 25 | * Created by Administrator on 2016/6/21. 26 | */ 27 | public class BooksClassifyTipHolder extends BaseViewHolder { 28 | 29 | TextView mClassityName; 30 | Button btnMore; 31 | EasyRecyclerView recyclerView; 32 | BooksClassItemAdapter adapter; 33 | 34 | public BooksClassifyTipHolder(ViewGroup viewGroup) { 35 | super(viewGroup, R.layout.item_books_classify_tip); 36 | mClassityName = $(R.id.tvClassifyName); 37 | btnMore = $(R.id.btnMore); 38 | recyclerView = $(R.id.recycler); 39 | adapter = new BooksClassItemAdapter(getContext()); 40 | recyclerView.setLayoutManager(new GridLayoutManager(getContext(), 2)); 41 | recyclerView.setErrorView(R.layout.error_layout); 42 | recyclerView.setProgressView(R.layout.progress_layout); 43 | recyclerView.setAdapterWithProgress(adapter); 44 | } 45 | 46 | @Override 47 | public void setData(final BooksClassifyBean.TngouEntity data) { 48 | super.setData(data); 49 | mClassityName.setText(data.getName()); 50 | 51 | final int Id = data.getId(); 52 | 53 | btnMore.setOnClickListener(new View.OnClickListener() { 54 | @Override 55 | public void onClick(View view) { 56 | Intent intent = new Intent(getContext(), BooksClassifyDetailsActivity.class); 57 | intent.putExtra(Config.BookId, Id); 58 | intent.putExtra(Config.BookClassifyName, data.getName()); 59 | getContext().startActivity(intent); 60 | } 61 | }); 62 | 63 | BooksModel.getBooksList(2, Config.classify_size, Id, new Subscriber() { 64 | @Override 65 | public void onNext(BooksBean imageBean) { 66 | adapter.clear(); 67 | adapter.addAll(imageBean.getList()); 68 | } 69 | 70 | @Override 71 | public void onCompleted() { 72 | recyclerView.showProgress(); 73 | } 74 | 75 | @Override 76 | public void onError(Throwable e) { 77 | recyclerView.showError(); 78 | } 79 | 80 | }); 81 | 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /app/src/main/java/com/allyn/lives/holder/BooksDetailHolder.java: -------------------------------------------------------------------------------- 1 | package com.allyn.lives.holder; 2 | 3 | import android.support.design.widget.BottomSheetDialog; 4 | import android.support.v7.widget.CardView; 5 | import android.text.Html; 6 | import android.view.LayoutInflater; 7 | import android.view.View; 8 | import android.view.ViewGroup; 9 | import android.widget.Button; 10 | import android.widget.ImageView; 11 | import android.widget.TextView; 12 | 13 | import com.allyn.lives.R; 14 | import com.allyn.lives.bean.BooksDetailBean; 15 | import com.allyn.lives.netwoarks.IPConfig; 16 | import com.allyn.lives.utils.Dialog; 17 | import com.jude.easyrecyclerview.adapter.BaseViewHolder; 18 | 19 | /** 20 | * Created by Administrator on 2016/6/28. 21 | */ 22 | public class BooksDetailHolder extends BaseViewHolder implements View.OnClickListener { 23 | 24 | TextView mtitle; 25 | TextView mtitleSize; 26 | CardView card_action; 27 | 28 | String mContent; 29 | String mTitle; 30 | 31 | public BooksDetailHolder(ViewGroup viewGroup) { 32 | super(viewGroup, R.layout.item_details_title); 33 | mtitle = $(R.id.tvTitle); 34 | card_action = $(R.id.card_action); 35 | mtitleSize = $(R.id.tvTitleSize); 36 | card_action.setOnClickListener(this); 37 | } 38 | 39 | @Override 40 | public void setData(BooksDetailBean.ListEntity data) { 41 | super.setData(data); 42 | mContent=data.getMessage(); 43 | mTitle=data.getTitle(); 44 | mtitle.setText(mTitle); 45 | int index = getLayoutPosition() + 1; 46 | mtitleSize.setText(String.valueOf(index + ". ")); 47 | } 48 | 49 | @Override 50 | public void onClick(View view) { 51 | Dialog.showMsg(getContext(),mTitle,mContent); 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /app/src/main/java/com/allyn/lives/holder/BooksHolder.java: -------------------------------------------------------------------------------- 1 | package com.allyn.lives.holder; 2 | 3 | import android.content.Intent; 4 | import android.support.v7.widget.CardView; 5 | import android.view.View; 6 | import android.view.ViewGroup; 7 | import android.widget.ImageView; 8 | import android.widget.TextView; 9 | 10 | import com.allyn.lives.R; 11 | import com.allyn.lives.activity.books.BooksDetailsActivity; 12 | import com.allyn.lives.bean.BooksBean; 13 | import com.allyn.lives.netwoarks.IPConfig; 14 | import com.allyn.lives.utils.Config; 15 | import com.jude.easyrecyclerview.adapter.BaseViewHolder; 16 | 17 | /** 18 | * Created by Administrator on 2016/6/21. 19 | */ 20 | public class BooksHolder extends BaseViewHolder implements View.OnClickListener { 21 | 22 | 23 | ImageView mivClassify; 24 | TextView mtvTitle; 25 | TextView mtvContent; 26 | CardView card_action; 27 | 28 | int id; 29 | String title; 30 | 31 | public BooksHolder(ViewGroup viewParent) { 32 | super(viewParent, R.layout.item_books_classify_content); 33 | mivClassify = $(R.id.ivClassify); 34 | mtvTitle = $(R.id.tvTitle); 35 | mtvContent = $(R.id.tvContent); 36 | card_action = $(R.id.card_action); 37 | } 38 | 39 | @Override 40 | public void setData(BooksBean.ListEntity data) { 41 | super.setData(data); 42 | card_action.setOnClickListener(this); 43 | id = data.getId(); 44 | title = data.getName(); 45 | com.bumptech.glide.Glide.with(getContext()) 46 | .load(IPConfig.ImageUrl + data.getImg()) 47 | .crossFade() 48 | .placeholder(R.mipmap.ic_placeholder) 49 | .into(mivClassify); 50 | mtvTitle.setText(title); 51 | mtvContent.setText(data.getSummary()); 52 | } 53 | 54 | @Override 55 | public void onClick(View view) { 56 | Intent intent = new Intent(getContext(), BooksDetailsActivity.class); 57 | intent.putExtra(Config.DetailId, id); 58 | intent.putExtra(Config.Title, title); 59 | getContext().startActivity(intent); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /app/src/main/java/com/allyn/lives/holder/MusicLocalHolder.java: -------------------------------------------------------------------------------- 1 | package com.allyn.lives.holder; 2 | 3 | import android.content.Context; 4 | import android.view.ViewGroup; 5 | import android.view.ViewParent; 6 | import android.widget.ImageView; 7 | import android.widget.TextView; 8 | 9 | import com.allyn.lives.R; 10 | import com.allyn.lives.bean.MusicBean; 11 | import com.jude.easyrecyclerview.adapter.BaseViewHolder; 12 | 13 | import butterknife.Bind; 14 | 15 | /** 16 | * Created by Administrator on 2016/7/11. 17 | */ 18 | public class MusicLocalHolder extends BaseViewHolder { 19 | 20 | 21 | @Bind(R.id.local_music_name) 22 | TextView mName; 23 | @Bind(R.id.local_music_msg) 24 | TextView mMsg; 25 | @Bind(R.id.local_music_img) 26 | ImageView mImg; 27 | 28 | public MusicLocalHolder(ViewGroup viewGroup) { 29 | super(viewGroup, R.layout.item_local_music); 30 | mName = $(R.id.local_music_name); 31 | mMsg = $(R.id.local_music_msg); 32 | mImg = $(R.id.local_music_img); 33 | } 34 | 35 | @Override 36 | public void setData(MusicBean data) { 37 | mName.setText(data.getName()); 38 | mMsg.setText(data.getArtist() + " - " + data.getAlbum()); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /app/src/main/java/com/allyn/lives/model/MusicModel.java: -------------------------------------------------------------------------------- 1 | package com.allyn.lives.model; 2 | 3 | 4 | import android.database.Cursor; 5 | import android.net.Uri; 6 | 7 | import com.allyn.lives.app.MainApp; 8 | import com.allyn.lives.bean.MusicBean; 9 | 10 | import java.util.ArrayList; 11 | import android.provider.MediaStore.Audio.Media; 12 | 13 | import java.util.List; 14 | 15 | 16 | /** 17 | * Created by apple on 16/6/8. 18 | */ 19 | public class MusicModel { 20 | static private Uri contentUri = Media.EXTERNAL_CONTENT_URI; 21 | // static private String sortOrder = Media._ID + " DESC"; 22 | static String sortOrder = Media.DATA; 23 | 24 | public static List getLocaleMusic() { 25 | 26 | List musicList = new ArrayList<>(); 27 | Cursor cursor = MainApp.getContexts().getContentResolver().query(contentUri, null, null, null, sortOrder); 28 | 29 | while (cursor.moveToNext()) { 30 | int idCol = cursor.getColumnIndex(Media._ID); 31 | int title = cursor.getColumnIndex(Media.TITLE); 32 | int albumCol = cursor.getColumnIndex(Media.ALBUM); 33 | int durationCol = cursor.getColumnIndex(Media.DURATION); 34 | int sizeCol = cursor.getColumnIndex(Media.SIZE); 35 | int artistCol = cursor.getColumnIndex(Media.ARTIST); 36 | int urlCol = cursor.getColumnIndex(Media.DATA); 37 | String name = cursor.getString(title); 38 | String album = cursor.getString(albumCol); 39 | 40 | int id = cursor.getInt(idCol); 41 | 42 | int duration = cursor.getInt(durationCol); 43 | long size = cursor.getLong(sizeCol); 44 | String artist = cursor.getString(artistCol); 45 | String url = cursor.getString(urlCol); 46 | if (album.equals("")) { 47 | album = ""; 48 | } 49 | if (artist.equals("")) { 50 | artist = "未知"; 51 | } 52 | MusicBean musicInfo = new MusicBean(); 53 | musicInfo.setAlbum(album); 54 | musicInfo.setDuration(duration); 55 | musicInfo.setSize(size); 56 | musicInfo.setArtist(artist); 57 | musicInfo.setFileData(url); 58 | musicInfo.setId(id); 59 | musicInfo.setName(name); 60 | musicList.add(musicInfo); 61 | } 62 | return musicList; 63 | } 64 | 65 | } 66 | -------------------------------------------------------------------------------- /app/src/main/java/com/allyn/lives/model/TranslationModel.java: -------------------------------------------------------------------------------- 1 | package com.allyn.lives.model; 2 | 3 | import com.allyn.lives.bean.TranslationBean; 4 | import com.allyn.lives.netwoarks.Invoking; 5 | 6 | import rx.Observable; 7 | import rx.Subscriber; 8 | import rx.android.schedulers.AndroidSchedulers; 9 | import rx.functions.Action1; 10 | import rx.schedulers.Schedulers; 11 | 12 | /** 13 | * Created by apple on 16/6/17. 14 | */ 15 | public class TranslationModel { 16 | public static void getData(final String content, Subscriber S) { 17 | Observable.create(new Observable.OnSubscribe() { 18 | @Override 19 | public void call(final Subscriber subscriber) { 20 | Invoking.translateRetrofit.getTranslationData("allynlive", "650717794", "data", "json", "1.1", content) 21 | .subscribe(new Action1() { 22 | @Override 23 | public void call(TranslationBean translationBean) { 24 | subscriber.onNext(translationBean); 25 | } 26 | }, new Action1() { 27 | @Override 28 | public void call(Throwable throwable) { 29 | subscriber.onError(throwable); 30 | } 31 | }); 32 | } 33 | }).observeOn(AndroidSchedulers.mainThread()) 34 | .subscribeOn(Schedulers.io()) 35 | .subscribe(S); 36 | 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /app/src/main/java/com/allyn/lives/netwoarks/IPConfig.java: -------------------------------------------------------------------------------- 1 | package com.allyn.lives.netwoarks; 2 | 3 | /** 4 | * Created by Administrator on 2016/6/17. 5 | */ 6 | public class IPConfig { 7 | 8 | public static final String TranslationApkUrl = "http://fanyi.youdao.com/"; 9 | 10 | 11 | public static final String BooksClassifyApiUrl ="http://www.tngou.net/"; 12 | 13 | public static final String ImageUrl ="http://tnfs.tngou.net/image"; 14 | 15 | } 16 | -------------------------------------------------------------------------------- /app/src/main/java/com/allyn/lives/netwoarks/Invoking.java: -------------------------------------------------------------------------------- 1 | package com.allyn.lives.netwoarks; 2 | 3 | /** 4 | * Created by Administrator on 2016/6/22. 5 | */ 6 | public class Invoking { 7 | 8 | public static final LiveApi translateRetrofit = new LiveRetrofit(IPConfig.TranslationApkUrl).getliveService(); 9 | 10 | public static final LiveApi BooksClassifyRetrofit = new LiveRetrofit(IPConfig.BooksClassifyApiUrl).getliveService(); 11 | 12 | } 13 | -------------------------------------------------------------------------------- /app/src/main/java/com/allyn/lives/netwoarks/LiveApi.java: -------------------------------------------------------------------------------- 1 | package com.allyn.lives.netwoarks; 2 | 3 | import com.allyn.lives.bean.BooksBean; 4 | import com.allyn.lives.bean.BooksClassifyBean; 5 | import com.allyn.lives.bean.BooksDetailBean; 6 | import com.allyn.lives.bean.TranslationBean; 7 | 8 | import retrofit2.http.GET; 9 | import retrofit2.http.Query; 10 | import rx.Observable; 11 | 12 | /** 13 | * Created by Administrator on 2016/6/17. 14 | */ 15 | public interface LiveApi { 16 | 17 | /**** 18 | * 翻译结果 19 | * 20 | * @param keyfrom 21 | * @param key 22 | * @param type 23 | * @param doctype 24 | * @param version 25 | * @param q 26 | * @return 27 | */ 28 | @GET("openapi.do") 29 | rx.Observable getTranslationData(@Query("keyfrom") String keyfrom, @Query("key") String key, @Query("type") String type, @Query("doctype") String doctype, @Query("version") String version, @Query("q") String q); 30 | 31 | /*** 32 | * 图书分类 33 | * 34 | * @return 35 | */ 36 | @GET("http://www.tngou.net/api/book/classify") 37 | Observable getBooksClassifyData(); 38 | 39 | 40 | /*** 41 | * 图书列表 42 | * http://www.tngou.net/api/book/list?page=1&rows=4&id=4 43 | * 44 | * @param page 45 | * @param rows 46 | * @param id 47 | * @return 48 | */ 49 | @GET("api/book/list") 50 | Observable getBooksList(@Query("page") int page, @Query("rows") int rows, @Query("id") int id); 51 | 52 | /*** 53 | * 图书详情 54 | * http://www.tngou.net/api/book/show?id=125 55 | * 56 | * @param id 57 | * @return 58 | */ 59 | @GET("api/book/show") 60 | Observable getBookDetails(@Query("id") int id); 61 | 62 | } 63 | -------------------------------------------------------------------------------- /app/src/main/java/com/allyn/lives/presenter/BooksClassifyDetailsPresenter.java: -------------------------------------------------------------------------------- 1 | package com.allyn.lives.presenter; 2 | 3 | import android.os.Bundle; 4 | import android.support.annotation.NonNull; 5 | import android.support.v4.widget.SwipeRefreshLayout; 6 | import android.support.v7.widget.GridLayoutManager; 7 | import android.support.v7.widget.Toolbar; 8 | 9 | import com.allyn.lives.R; 10 | import com.allyn.lives.activity.books.BooksClassifyDetailsActivity; 11 | import com.allyn.lives.bean.BooksBean; 12 | import com.allyn.lives.model.BooksModel; 13 | import com.allyn.lives.utils.Config; 14 | import com.jude.beam.expansion.list.BeamListActivityPresenter; 15 | 16 | import rx.Subscriber; 17 | 18 | /** 19 | * Created by Administrator on 2016/6/27. 20 | */ 21 | public class BooksClassifyDetailsPresenter extends BeamListActivityPresenter implements SwipeRefreshLayout.OnRefreshListener { 22 | 23 | 24 | int index = 1; 25 | 26 | @Override 27 | protected void onCreate(@NonNull BooksClassifyDetailsActivity view, Bundle savedState) { 28 | super.onCreate(view, savedState); 29 | onRefresh(); 30 | } 31 | 32 | @Override 33 | protected void onCreateView(@NonNull BooksClassifyDetailsActivity view) { 34 | super.onCreateView(view); 35 | getView().getListView().setLayoutManager(new GridLayoutManager(view, 2)); 36 | getView().getListView().setRefreshListener(this); 37 | } 38 | 39 | @Override 40 | public void onRefresh() { 41 | super.onRefresh(); 42 | getData(Config.def_size); 43 | } 44 | 45 | @Override 46 | public void onLoadMore() { 47 | super.onLoadMore(); 48 | index++; 49 | getData(index); 50 | } 51 | 52 | public void getData(int page) { 53 | BooksModel.getBooksList(page, Config.size, getView().getIntent().getIntExtra(Config.BookId, 1), new Subscriber() { 54 | @Override 55 | public void onCompleted() { 56 | 57 | } 58 | 59 | @Override 60 | public void onError(Throwable e) { 61 | getView().getListView().showError(); 62 | } 63 | 64 | @Override 65 | public void onNext(BooksBean booksBean) { 66 | getAdapter().addAll(booksBean.getList()); 67 | } 68 | }); 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /app/src/main/java/com/allyn/lives/presenter/BooksClassifyFragmentPresenter.java: -------------------------------------------------------------------------------- 1 | package com.allyn.lives.presenter; 2 | 3 | import android.os.Bundle; 4 | import android.support.annotation.NonNull; 5 | import android.support.v4.widget.SwipeRefreshLayout; 6 | import android.support.v7.widget.LinearLayoutManager; 7 | import android.support.v7.widget.RecyclerView; 8 | 9 | import com.allyn.lives.activity.books.BooksDetailsActivity; 10 | import com.allyn.lives.adapter.BooksClassAdapter; 11 | import com.allyn.lives.fragment.books.BooksClassifyFragment; 12 | import com.allyn.lives.model.BooksModel; 13 | import com.allyn.lives.bean.BooksClassifyBean; 14 | import com.jude.easyrecyclerview.adapter.RecyclerArrayAdapter; 15 | 16 | import rx.Subscriber; 17 | 18 | /** 19 | * Created by Administrator on 2016/6/21. 20 | */ 21 | public class BooksClassifyFragmentPresenter extends com.jude.beam.expansion.BeamBasePresenter implements SwipeRefreshLayout.OnRefreshListener { 22 | 23 | BooksClassAdapter adapter; 24 | BooksClassifyBean imageclassify; 25 | 26 | @Override 27 | protected void onCreate(@NonNull BooksClassifyFragment view, Bundle savedState) { 28 | super.onCreate(view, savedState); 29 | adapter = new BooksClassAdapter(getView().getContext()); 30 | onRefresh(); 31 | } 32 | 33 | @Override 34 | protected void onCreateView(@NonNull BooksClassifyFragment view) { 35 | super.onCreateView(view); 36 | RecyclerView.LayoutManager manager = new LinearLayoutManager(getView().getContext()); 37 | getView().recyclerView.setLayoutManager(manager); 38 | getView().recyclerView.setAdapterWithProgress(adapter); 39 | getView().recyclerView.setRefreshListener(this); 40 | } 41 | 42 | @Override 43 | public void onRefresh() { 44 | BooksModel.getDataClassify(new Subscriber() { 45 | @Override 46 | public void onNext(BooksClassifyBean imageClassifyBean) { 47 | imageclassify = imageClassifyBean; 48 | adapter.clear(); 49 | adapter.addAll(imageClassifyBean.getTngou()); 50 | } 51 | 52 | @Override 53 | public void onCompleted() { 54 | getView().recyclerView.showProgress(); 55 | } 56 | 57 | @Override 58 | public void onError(Throwable e) { 59 | if (getView().recyclerView != null) { 60 | getView().recyclerView.showError(); 61 | } 62 | } 63 | }); 64 | } 65 | } 66 | 67 | -------------------------------------------------------------------------------- /app/src/main/java/com/allyn/lives/presenter/BooksListFragmentPresenter.java: -------------------------------------------------------------------------------- 1 | package com.allyn.lives.presenter; 2 | 3 | import android.os.Bundle; 4 | import android.support.annotation.NonNull; 5 | import android.support.v4.widget.SwipeRefreshLayout; 6 | 7 | import com.allyn.lives.bean.BooksBean; 8 | import com.allyn.lives.fragment.books.BooksListFragment; 9 | import com.allyn.lives.model.BooksModel; 10 | import com.allyn.lives.utils.Config; 11 | import com.jude.beam.expansion.list.BeamListFragmentPresenter; 12 | 13 | import rx.Subscriber; 14 | 15 | /** 16 | * Created by Administrator on 2016/6/24. 17 | */ 18 | public class BooksListFragmentPresenter extends BeamListFragmentPresenter implements SwipeRefreshLayout.OnRefreshListener { 19 | 20 | int index = 1; 21 | 22 | @Override 23 | protected void onCreate(@NonNull BooksListFragment view, Bundle savedState) { 24 | super.onCreate(view, savedState); 25 | onRefresh(); 26 | } 27 | 28 | @Override 29 | protected void onCreateView(@NonNull BooksListFragment view) { 30 | super.onCreateView(view); 31 | getView().getListView().setRefreshListener(this); 32 | } 33 | 34 | @Override 35 | public void onRefresh() { 36 | super.onRefresh(); 37 | getData(Config.def_size); 38 | } 39 | 40 | public void getData(int page) { 41 | BooksModel.getBooksList(page, Config.size, getView().getArguments().getInt(Config.Type, 1), new Subscriber() { 42 | @Override 43 | public void onCompleted() { 44 | 45 | } 46 | 47 | @Override 48 | public void onError(Throwable e) { 49 | } 50 | 51 | @Override 52 | public void onNext(BooksBean imageBean) { 53 | getAdapter().addAll(imageBean.getList()); 54 | } 55 | }); 56 | } 57 | 58 | @Override 59 | public void onLoadMore() { 60 | super.onLoadMore(); 61 | index++; 62 | getData(index); 63 | } 64 | 65 | 66 | } 67 | -------------------------------------------------------------------------------- /app/src/main/java/com/allyn/lives/presenter/MusicLikePresenter.java: -------------------------------------------------------------------------------- 1 | package com.allyn.lives.presenter; 2 | 3 | import android.content.Intent; 4 | import android.os.Bundle; 5 | import android.support.annotation.NonNull; 6 | import android.support.v4.widget.SwipeRefreshLayout; 7 | import android.util.Log; 8 | import android.widget.Toast; 9 | 10 | import com.allyn.lives.activity.music.MusicPlayActivivy; 11 | import com.allyn.lives.app.MainApp; 12 | import com.allyn.lives.bean.MusicBean; 13 | import com.allyn.lives.fragment.music.MusicLocalLikeFragment; 14 | import com.allyn.lives.service.MusicService; 15 | import com.allyn.lives.utils.Config; 16 | import com.jude.beam.expansion.list.BeamListFragment; 17 | import com.jude.beam.expansion.list.BeamListFragmentPresenter; 18 | import com.jude.easyrecyclerview.adapter.RecyclerArrayAdapter; 19 | 20 | import java.util.Collections; 21 | import java.util.List; 22 | 23 | /** 24 | * Created by Administrator on 2016/7/11. 25 | */ 26 | public class MusicLikePresenter extends BeamListFragmentPresenter implements RecyclerArrayAdapter.OnItemClickListener,SwipeRefreshLayout.OnRefreshListener { 27 | 28 | 29 | List musicBean; 30 | 31 | @Override 32 | protected void onCreate(@NonNull MusicLocalLikeFragment view, Bundle savedState) { 33 | super.onCreate(view, savedState); 34 | onRefresh(); 35 | } 36 | 37 | @Override 38 | protected void onCreateView(@NonNull MusicLocalLikeFragment view) { 39 | super.onCreateView(view); 40 | getView().getListView().setRefreshListener(this); 41 | if (musicBean.size() == 0) { 42 | getView().getListView().showError(); 43 | } 44 | } 45 | 46 | @Override 47 | public void onRefresh() { 48 | super.onRefresh(); 49 | getAdapter().clear(); 50 | musicBean = MainApp.getLiteOrm().query(MusicBean.class); 51 | Collections.reverse(musicBean); 52 | getAdapter().addAll(musicBean); 53 | getAdapter().setOnItemClickListener(this); 54 | } 55 | 56 | @Override 57 | public void onItemClick(int position) { 58 | Intent intent = new Intent(getView().getActivity(), MusicService.class); 59 | Bundle bundle = new Bundle(); 60 | bundle.putInt(Config.position_liteorm, position); 61 | intent.putExtra(Config.bunder, bundle); 62 | getView().getActivity().startService(intent); 63 | getView().getActivity().startActivity(new Intent(getView().getActivity(), MusicPlayActivivy.class)); 64 | 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /app/src/main/java/com/allyn/lives/presenter/NewImagePreenter.java: -------------------------------------------------------------------------------- 1 | package com.allyn.lives.presenter; 2 | 3 | import android.os.Bundle; 4 | import android.support.annotation.NonNull; 5 | import android.support.v4.widget.SwipeRefreshLayout; 6 | import android.support.v7.widget.GridLayoutManager; 7 | 8 | import com.allyn.lives.bean.BooksBean; 9 | import com.allyn.lives.fragment.books.RecommendBooksFragment; 10 | import com.allyn.lives.model.BooksModel; 11 | import com.allyn.lives.utils.Config; 12 | import com.jude.beam.expansion.list.BeamListFragmentPresenter; 13 | 14 | import java.util.Random; 15 | 16 | import rx.Subscriber; 17 | 18 | /** 19 | * Created by Administrator on 2016/6/27. 20 | */ 21 | public class NewImagePreenter extends BeamListFragmentPresenter implements SwipeRefreshLayout.OnRefreshListener { 22 | 23 | @Override 24 | protected void onCreate(@NonNull RecommendBooksFragment view, Bundle savedState) { 25 | super.onCreate(view, savedState); 26 | onRefresh(); 27 | } 28 | 29 | @Override 30 | protected void onCreateView(@NonNull RecommendBooksFragment view) { 31 | super.onCreateView(view); 32 | getView().getListView().setLayoutManager(new GridLayoutManager(view.getActivity(), 2)); 33 | getView().getListView().setRefreshListener(this); 34 | } 35 | 36 | @Override 37 | public void onLoadMore() { 38 | super.onLoadMore(); 39 | getData(); 40 | } 41 | 42 | @Override 43 | public void onRefresh() { 44 | super.onRefresh(); 45 | getData(); 46 | } 47 | 48 | 49 | public void getData() { 50 | BooksModel.getBooksList(new Random().nextInt(3), Config.size, new Random().nextInt(9), new Subscriber() { 51 | @Override 52 | public void onCompleted() { 53 | 54 | } 55 | 56 | @Override 57 | public void onError(Throwable e) { 58 | 59 | } 60 | 61 | @Override 62 | public void onNext(BooksBean imageBean) { 63 | getAdapter().addAll(imageBean.getList()); 64 | } 65 | }); 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /app/src/main/java/com/allyn/lives/utils/Config.java: -------------------------------------------------------------------------------- 1 | package com.allyn.lives.utils; 2 | 3 | /** 4 | * Created by Administrator on 2016/6/24. 5 | */ 6 | public class Config { 7 | 8 | public static final String Type="list_typeId"; 9 | 10 | public static final String BookId="book_Id"; 11 | 12 | public static final String Title="title"; 13 | 14 | public static final String BookClassifyName="classify_name"; 15 | 16 | public static final String DetailId="detail_id"; 17 | 18 | public static final String position ="music_indedx"; 19 | 20 | public static final String position_liteorm="position_liteorm"; 21 | 22 | public static final String bunder ="bunder"; 23 | 24 | public static final int size=15; 25 | 26 | public static final int classify_size=2; 27 | 28 | public static final int def_size=1; 29 | 30 | public static final int random_size=10; 31 | 32 | 33 | 34 | } 35 | -------------------------------------------------------------------------------- /app/src/main/java/com/allyn/lives/utils/Dialog.java: -------------------------------------------------------------------------------- 1 | package com.allyn.lives.utils; 2 | 3 | import android.content.Context; 4 | import android.support.design.widget.BottomSheetDialog; 5 | import android.text.Html; 6 | import android.view.LayoutInflater; 7 | import android.view.View; 8 | import android.widget.TextView; 9 | 10 | import com.allyn.lives.R; 11 | 12 | /** 13 | * Created by Administrator on 2016/6/29. 14 | */ 15 | public class Dialog { 16 | 17 | public static void showMsg(Context context, String title, String Content) { 18 | final BottomSheetDialog sheetDialog = new BottomSheetDialog(context, R.style.AppTheme_BottomSheetDialog); 19 | View view1 = LayoutInflater.from(context).inflate(R.layout.myview_dialog, null); 20 | TextView tvClassTitle = (TextView) view1.findViewById(R.id.tvClassTitle); 21 | TextView tvContent = (TextView) view1.findViewById(R.id.tvContent); 22 | sheetDialog.setContentView(view1); 23 | tvContent.setText(Html.fromHtml(Content)); 24 | tvClassTitle.setText(Html.fromHtml(title)); 25 | // sheetDialog.setCanceledOnTouchOutside(false); 26 | sheetDialog.show(); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /app/src/main/java/com/allyn/lives/utils/NetworkUtils.java: -------------------------------------------------------------------------------- 1 | package com.allyn.lives.utils; 2 | 3 | import android.content.Context; 4 | import android.net.ConnectivityManager; 5 | import android.net.NetworkInfo; 6 | 7 | /** 8 | * Created by C on 21/3/2016. 9 | * https://github.com/nukc 10 | */ 11 | public class NetworkUtils { 12 | 13 | /** 14 | * 判断当前网络是否是移动数据网络. 15 | * 16 | * @param context the context 17 | * @return boolean 18 | */ 19 | public static boolean isMobile(Context context) { 20 | ConnectivityManager connectivityManager = (ConnectivityManager) context 21 | .getSystemService(Context.CONNECTIVITY_SERVICE); 22 | NetworkInfo activeNetInfo = connectivityManager.getActiveNetworkInfo(); 23 | if (activeNetInfo != null 24 | && activeNetInfo.getType() == ConnectivityManager.TYPE_MOBILE) { 25 | return true; 26 | } 27 | return false; 28 | } 29 | 30 | 31 | /** 32 | * 检查是否有wifi 33 | * @param context Context 34 | * @return boolean 35 | */ 36 | public static boolean isWifi(Context context) { 37 | ConnectivityManager mConnectivity = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); 38 | NetworkInfo info = mConnectivity.getActiveNetworkInfo(); 39 | if (info == null) { 40 | return false; 41 | } 42 | int netType = info.getType(); 43 | return netType == ConnectivityManager.TYPE_WIFI && info.isConnected(); 44 | } 45 | 46 | /** 47 | * 描述:判断网络是否有效. 48 | * 49 | * @param context the context 50 | * @return true, if is network available 51 | */ 52 | public static boolean isNetworkAvailable(Context context) { 53 | try { 54 | ConnectivityManager connectivity = (ConnectivityManager) context 55 | .getSystemService(Context.CONNECTIVITY_SERVICE); 56 | if (connectivity != null) { 57 | NetworkInfo info = connectivity.getActiveNetworkInfo(); 58 | if (info != null && info.isConnected()) { 59 | if (info.getState() == NetworkInfo.State.CONNECTED) { 60 | return true; 61 | } 62 | } 63 | } 64 | } catch (Exception e) { 65 | e.printStackTrace(); 66 | return false; 67 | } 68 | return false; 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /app/src/main/java/com/allyn/lives/utils/RxBus.java: -------------------------------------------------------------------------------- 1 | package com.allyn.lives.utils; 2 | 3 | import rx.Observable; 4 | import rx.functions.Func1; 5 | import rx.subjects.PublishSubject; 6 | import rx.subjects.SerializedSubject; 7 | import rx.subjects.Subject; 8 | 9 | /** 10 | * Created by C on 9/3/2016. 11 | * https://github.com/nukc 12 | *

13 | * this is the middleman object 14 | */ 15 | public class RxBus { 16 | 17 | private static RxBus mInstance; 18 | private final Subject bus = new SerializedSubject<>(PublishSubject.create()); 19 | 20 | public static RxBus getDefault() { 21 | if (mInstance == null) { 22 | synchronized (RxBus.class) { 23 | if (mInstance == null) { 24 | mInstance = new RxBus(); 25 | } 26 | } 27 | } 28 | 29 | return mInstance; 30 | } 31 | 32 | public void post(Object o) { 33 | bus.onNext(o); 34 | } 35 | 36 | 37 | public Observable toObserverable(final Class eventType) { 38 | return bus.filter(new Func1() { 39 | @Override 40 | public Boolean call(Object o) { 41 | return eventType.isInstance(o); 42 | } 43 | }).cast(eventType); 44 | } 45 | 46 | 47 | 48 | //发送 49 | // RxBus.getDefault().post(new OnTransfeDatarEvent()); 50 | 51 | 52 | //接收 53 | // RxBus.getDefault() 54 | // .toObserverable(OnTransfeDatarEvent.class) 55 | // .subscribe(new Action1() { 56 | // @Override 57 | // public void call(OnTransfeDatarEvent onInstallEvent) { 58 | // loadApps(); 59 | // } 60 | // }); 61 | 62 | 63 | // public class OnTransfeDatarEvent { 64 | // 65 | // public int amount; 66 | // public String packageNamee; 67 | // public boolean isInstall; 68 | // 69 | // public int getAmount() { 70 | // return amount; 71 | // } 72 | // 73 | // public void setAmount(int amount) { 74 | // this.amount = amount; 75 | // } 76 | // 77 | // public String getPackageNamee() { 78 | // return packageNamee; 79 | // } 80 | // 81 | // public void setPackageNamee(String packageNamee) { 82 | // this.packageNamee = packageNamee; 83 | // } 84 | // 85 | // public boolean isInstall() { 86 | // return isInstall; 87 | // } 88 | // 89 | // public void setInstall(boolean install) { 90 | // isInstall = install; 91 | // } 92 | // } 93 | } 94 | -------------------------------------------------------------------------------- /app/src/main/java/com/allyn/lives/utils/TextFormater.java: -------------------------------------------------------------------------------- 1 | package com.allyn.lives.utils; 2 | 3 | import android.annotation.SuppressLint; 4 | 5 | import java.text.DecimalFormat; 6 | 7 | public class TextFormater { 8 | 9 | @SuppressLint("DefaultLocale") 10 | public static String dataSizeFormat(long size) { 11 | long kb = 1024; 12 | long mb = kb * 1024; 13 | long gb = mb * 1024; 14 | 15 | if (size >= gb) { 16 | return String.format("%.1f GB", (float) size / gb); 17 | } else if (size >= mb) { 18 | float f = (float) size / mb; 19 | return String.format(f > 100 ? "%.0f MB" : "%.1f MB", f); 20 | } else if (size >= kb) { 21 | float f = (float) size / kb; 22 | return String.format(f > 100 ? "%.0f KB" : "%.1f KB", f); 23 | } else 24 | return String.format("%d B", size); 25 | } 26 | 27 | public static String numberFormat(long number) { 28 | DecimalFormat df = new DecimalFormat("0.0"); 29 | 30 | if (number >= 10000){ 31 | if (number % 10000 < 1000) 32 | return number / 10000 + "万次"; 33 | return df.format((float) number / 10000) + "万次"; 34 | }else if (number >= 100000000){ 35 | if (number % 100000000 < 10000000) 36 | return number / 100000000 + "亿次"; 37 | return df.format((float) number / 100000000) + "亿次"; 38 | }else { 39 | return number + "次"; 40 | } 41 | } 42 | 43 | public static String getCacheSize(long cacheSize){ 44 | double size = (cacheSize + 0.00) / (1024 * 1024); 45 | 46 | DecimalFormat df = new DecimalFormat("0.00"); 47 | String sSize = df.format(size); 48 | return sSize + " M"; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /app/src/main/java/com/allyn/lives/utils/Transition.java: -------------------------------------------------------------------------------- 1 | package com.allyn.lives.utils; 2 | 3 | /** 4 | * Created by Administrator on 2016/6/28. 5 | */ 6 | public class Transition { 7 | 8 | public static String getClassifyName(int typeId) { 9 | String typeNmae = ""; 10 | switch (typeId) { 11 | case 1: 12 | typeNmae = "孕妇育儿"; 13 | break; 14 | case 2: 15 | typeNmae = "美容时尚"; 16 | break; 17 | case 3: 18 | typeNmae = "健康养生"; 19 | break; 20 | case 4: 21 | typeNmae = "两性生活"; 22 | break; 23 | case 5: 24 | typeNmae = "美食烹饪"; 25 | break; 26 | case 6: 27 | typeNmae = "修养心里"; 28 | break; 29 | case 7: 30 | typeNmae = "家庭教育"; 31 | break; 32 | case 8: 33 | typeNmae = "幽默笑话"; 34 | break; 35 | case 9: 36 | typeNmae = "生活杂谈"; 37 | break; 38 | default: 39 | typeNmae = "其他"; 40 | break; 41 | } 42 | return typeNmae; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /app/src/main/java/com/allyn/lives/utils/blur/RSBlur.java: -------------------------------------------------------------------------------- 1 | package com.allyn.lives.utils.blur; 2 | 3 | import android.annotation.TargetApi; 4 | import android.content.Context; 5 | import android.graphics.Bitmap; 6 | import android.os.Build; 7 | import android.renderscript.Allocation; 8 | import android.renderscript.Element; 9 | import android.renderscript.RSRuntimeException; 10 | import android.renderscript.RenderScript; 11 | import android.renderscript.ScriptIntrinsicBlur; 12 | 13 | /** 14 | * Copyright (C) 2015 Wasabeef 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the "License"); 17 | * you may not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * http://www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an "AS IS" BASIS, 24 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | public class RSBlur { 29 | 30 | @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1) 31 | public static Bitmap blur(Context context, Bitmap bitmap, int radius) throws RSRuntimeException { 32 | RenderScript rs = null; 33 | try { 34 | rs = RenderScript.create(context); 35 | Allocation input = 36 | Allocation.createFromBitmap(rs, bitmap, Allocation.MipmapControl.MIPMAP_NONE, 37 | Allocation.USAGE_SCRIPT); 38 | Allocation output = Allocation.createTyped(rs, input.getType()); 39 | ScriptIntrinsicBlur blur = ScriptIntrinsicBlur.create(rs, Element.U8_4(rs)); 40 | 41 | blur.setInput(input); 42 | blur.setRadius(radius); 43 | blur.forEach(output); 44 | output.copyTo(bitmap); 45 | } finally { 46 | if (rs != null) { 47 | rs.destroy(); 48 | } 49 | } 50 | 51 | return bitmap; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /app/src/main/java/com/allyn/lives/view/bottontab/BottomBarTab.java: -------------------------------------------------------------------------------- 1 | package com.allyn.lives.view.bottontab; 2 | 3 | import android.content.Context; 4 | import android.view.LayoutInflater; 5 | import android.widget.ImageView; 6 | import android.widget.RelativeLayout; 7 | import android.widget.TextView; 8 | 9 | import com.allyn.lives.R; 10 | 11 | public class BottomBarTab extends RelativeLayout { 12 | 13 | public ImageView imageView; 14 | 15 | public TextView textView; 16 | 17 | public int color; 18 | 19 | public BottomBarTab(Context context) { 20 | super(context); 21 | LayoutInflater.from(context).inflate(R.layout.item_bottom_navigation, this, true); 22 | imageView = (ImageView) findViewById(R.id.imageView); 23 | textView = (TextView) findViewById(R.id.textView); 24 | } 25 | 26 | public void setImageResource(int imageResource) { 27 | this.imageView.setImageResource(imageResource); 28 | } 29 | 30 | public void setText(String text) { 31 | this.textView.setText(text); 32 | } 33 | 34 | public void setSelected(boolean selected) { 35 | this.imageView.setSelected(selected); 36 | } 37 | 38 | public boolean isSelected() { 39 | return imageView.isSelected(); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /app/src/main/java/com/allyn/lives/view/bottontab/BottomNavigationBehavior.java: -------------------------------------------------------------------------------- 1 | package com.allyn.lives.view.bottontab; 2 | 3 | import android.content.Context; 4 | import android.support.design.widget.CoordinatorLayout; 5 | import android.support.v4.view.ViewCompat; 6 | import android.util.AttributeSet; 7 | import android.util.Log; 8 | import android.view.Gravity; 9 | import android.view.View; 10 | 11 | /** 12 | * Created by hwt on 2016/3/16. 13 | */ 14 | public class BottomNavigationBehavior extends CoordinatorLayout.Behavior { 15 | 16 | public BottomNavigationBehavior(Context context, AttributeSet attrs) { 17 | super(context, attrs); 18 | } 19 | 20 | @Override 21 | public boolean onStartNestedScroll(CoordinatorLayout coordinatorLayout, V child, View directTargetChild, View target, int nestedScrollAxes) { 22 | return (nestedScrollAxes & ViewCompat.SCROLL_AXIS_VERTICAL) != 0; 23 | } 24 | 25 | @Override 26 | public boolean onLayoutChild(CoordinatorLayout parent, V child, int layoutDirection) { 27 | CoordinatorLayout.LayoutParams layoutParams = (CoordinatorLayout.LayoutParams) child.getLayoutParams(); 28 | layoutParams.gravity = Gravity.BOTTOM; 29 | return super.onLayoutChild(parent, child, layoutDirection); 30 | } 31 | 32 | @Override 33 | public void onNestedPreScroll(CoordinatorLayout coordinatorLayout, V child, View target, int dx, int dy, int[] consumed) { 34 | if (dy > 0) { 35 | if (child.getY() == coordinatorLayout.getHeight() - child.getHeight()) { 36 | child.animate().translationY(child.getHeight()).setDuration(200).start(); 37 | } 38 | } else { 39 | if (child.getY() == coordinatorLayout.getHeight()) { 40 | Log.i("etong", "onNestedPreScroll"); 41 | child.animate().translationY(0).setDuration(250).start(); 42 | } 43 | } 44 | } 45 | 46 | @Override 47 | public void onStopNestedScroll(CoordinatorLayout coordinatorLayout, V child, View target) { 48 | super.onStopNestedScroll(coordinatorLayout, child, target); 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /app/src/main/java/com/allyn/lives/view/widgets/CommonRefreshDateUtils.java: -------------------------------------------------------------------------------- 1 | package com.allyn.lives.view.widgets; 2 | 3 | import android.content.Context; 4 | import android.text.TextUtils; 5 | 6 | import java.util.Date; 7 | 8 | /** 9 | * 记录列表上次更新时间Utils 10 | * Created by liukun on 15/4/3. 11 | */ 12 | public class CommonRefreshDateUtils { 13 | /** 14 | * 获取当前使用View的class的最后更新时间 15 | * 16 | * @param currentClassName 当前调用到的className 17 | * @param mContext 18 | * @return 19 | */ 20 | public synchronized static String getLastRefreshDate(Context mContext, String currentClassName) { 21 | String lastRefreshDate = mContext.getSharedPreferences("COMMONLIST", Context.MODE_PRIVATE).getString(currentClassName,""); 22 | if (TextUtils.isEmpty(lastRefreshDate)) { 23 | return "刚刚"; 24 | } 25 | return CommonDateUtils.getDate(lastRefreshDate, new Date()); 26 | } 27 | 28 | /** 29 | * 保存最后刷新时间 30 | * 31 | * @param mContext 32 | * @param currentClassName 33 | */ 34 | public synchronized static void saveLastRefreshDate(Context mContext, String currentClassName) { 35 | mContext.getSharedPreferences("COMMONLIST", Context.MODE_PRIVATE).edit().putString(currentClassName, CommonDateUtils.getSimpleDateFormatDefault().format(new Date())); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /app/src/main/java/com/allyn/lives/view/widgets/PinyinComparator.java: -------------------------------------------------------------------------------- 1 | package com.allyn.lives.view.widgets; 2 | 3 | import java.util.Comparator; 4 | 5 | /** 6 | * 7 | * @author xiaanming 8 | * 9 | */ 10 | public class PinyinComparator implements Comparator { 11 | 12 | public int compare(SortModel o1, SortModel o2) { 13 | if (o1.getSortLetters().equals("@") 14 | || o2.getSortLetters().equals("#")) { 15 | return -1; 16 | } else if (o1.getSortLetters().equals("#") 17 | || o2.getSortLetters().equals("@")) { 18 | return 1; 19 | } else { 20 | return o1.getSortLetters().compareTo(o2.getSortLetters()); 21 | } 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /app/src/main/java/com/allyn/lives/view/widgets/SortModel.java: -------------------------------------------------------------------------------- 1 | package com.allyn.lives.view.widgets; 2 | 3 | public class SortModel { 4 | 5 | private String name; 6 | private String sortLetters; 7 | 8 | public String getName() { 9 | return name; 10 | } 11 | public void setName(String name) { 12 | this.name = name; 13 | } 14 | public String getSortLetters() { 15 | return sortLetters; 16 | } 17 | public void setSortLetters(String sortLetters) { 18 | this.sortLetters = sortLetters; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_def.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Allyns/Lives/453dec65e8f7d9a49f0642fdc698fe9066e34907/app/src/main/res/drawable-xhdpi/ic_def.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_delete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Allyns/Lives/453dec65e8f7d9a49f0642fdc698fe9066e34907/app/src/main/res/drawable-xhdpi/ic_delete.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_music.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Allyns/Lives/453dec65e8f7d9a49f0642fdc698fe9066e34907/app/src/main/res/drawable-xhdpi/ic_music.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_nonetwork.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Allyns/Lives/453dec65e8f7d9a49f0642fdc698fe9066e34907/app/src/main/res/drawable-xhdpi/ic_nonetwork.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_arrow_back.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Allyns/Lives/453dec65e8f7d9a49f0642fdc698fe9066e34907/app/src/main/res/drawable-xxhdpi/ic_arrow_back.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_book_remove.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Allyns/Lives/453dec65e8f7d9a49f0642fdc698fe9066e34907/app/src/main/res/drawable-xxhdpi/ic_book_remove.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_classfiy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Allyns/Lives/453dec65e8f7d9a49f0642fdc698fe9066e34907/app/src/main/res/drawable-xxhdpi/ic_classfiy.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_settings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Allyns/Lives/453dec65e8f7d9a49f0642fdc698fe9066e34907/app/src/main/res/drawable-xxxhdpi/ic_settings.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/bg_round_rectangle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/bg_round_rectangle_text_bg.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/bg_searchview_contact.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/btn_bg.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/btn_status.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/common_listview_footer_arrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Allyns/Lives/453dec65e8f7d9a49f0642fdc698fe9066e34907/app/src/main/res/drawable/common_listview_footer_arrow.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/common_listview_header_arrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Allyns/Lives/453dec65e8f7d9a49f0642fdc698fe9066e34907/app/src/main/res/drawable/common_listview_header_arrow.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/large.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Allyns/Lives/453dec65e8f7d9a49f0642fdc698fe9066e34907/app/src/main/res/drawable/large.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/red_dot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Allyns/Lives/453dec65e8f7d9a49f0642fdc698fe9066e34907/app/src/main/res/drawable/red_dot.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/show_head_toast_bg.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Allyns/Lives/453dec65e8f7d9a49f0642fdc698fe9066e34907/app/src/main/res/drawable/show_head_toast_bg.9.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/sidebar_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Allyns/Lives/453dec65e8f7d9a49f0642fdc698fe9066e34907/app/src/main/res/drawable/small.png -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_books_classify_details.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 15 | 16 | 23 | 24 | 25 | 26 | 27 | 28 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 15 | 16 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /app/src/main/res/layout/common_list_view_foot_view.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 11 | 12 | 20 | 21 | 26 | 27 | 28 | 29 | 37 | 38 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /app/src/main/res/layout/common_list_view_head_view.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 12 | 13 | 20 | 21 | 26 | 27 | 31 | 32 | 37 | 38 | 43 | 44 | 45 | 46 | 54 | 55 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /app/src/main/res/layout/content_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 13 | 14 | 18 | 19 | -------------------------------------------------------------------------------- /app/src/main/res/layout/error_layout.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 15 | 16 | 25 | 26 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment__img_tab.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 19 | 20 | 25 | 26 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_books.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_books_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 18 | 19 | 24 | 25 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_booksetattle.xml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_music_list.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 11 | 12 | 21 | 22 | 26 | 27 | 38 | 39 | 51 | 52 | 53 | 54 | 64 | 65 | 72 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_music_tab.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | 20 | 21 | 26 | 27 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_settings.xml: -------------------------------------------------------------------------------- 1 | 8 | 9 | 10 | 14 | 15 | 23 | 24 | 31 | 32 | 33 |