├── .gitignore ├── .idea ├── compiler.xml ├── copyright │ └── profiles_settings.xml ├── encodings.xml ├── gradle.xml ├── inspectionProfiles │ ├── Project_Default.xml │ └── profiles_settings.xml ├── misc.xml ├── modules.xml ├── runConfigurations.xml └── vcs.xml ├── README.MD ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro ├── src │ ├── androidTest │ │ └── java │ │ │ └── com │ │ │ └── liuzhi │ │ │ └── one │ │ │ └── ExampleInstrumentedTest.java │ ├── main │ │ ├── AndroidManifest.xml │ │ ├── java │ │ │ └── com │ │ │ │ └── liuzh │ │ │ │ └── one │ │ │ │ ├── activity │ │ │ │ ├── AuthorActivity.java │ │ │ │ ├── BaseActivity.java │ │ │ │ ├── MainActivity.java │ │ │ │ ├── MovieActivity.java │ │ │ │ ├── MusicActivity.java │ │ │ │ ├── QuestionActivity.java │ │ │ │ ├── ReadActivity.java │ │ │ │ ├── SplashActivity.java │ │ │ │ └── VideoActivity.java │ │ │ │ ├── adapter │ │ │ │ ├── CommentRvAdapter.java │ │ │ │ ├── ListRvAdapter.java │ │ │ │ └── ViewsPagerAdapter.java │ │ │ │ ├── application │ │ │ │ └── App.java │ │ │ │ ├── bean │ │ │ │ ├── Author.java │ │ │ │ ├── ContentList.java │ │ │ │ ├── DataList.java │ │ │ │ ├── Qq.java │ │ │ │ ├── ShareList.java │ │ │ │ ├── Tag.java │ │ │ │ ├── Weibo.java │ │ │ │ ├── Wx.java │ │ │ │ ├── comment │ │ │ │ │ ├── Comment.java │ │ │ │ │ ├── CommentData.java │ │ │ │ │ ├── Datum.java │ │ │ │ │ └── User.java │ │ │ │ ├── list │ │ │ │ │ ├── Data.java │ │ │ │ │ ├── Icons.java │ │ │ │ │ ├── OneDay.java │ │ │ │ │ ├── OneListId.java │ │ │ │ │ ├── ShareInfo.java │ │ │ │ │ └── Weather.java │ │ │ │ ├── movie │ │ │ │ │ ├── Movie.java │ │ │ │ │ └── MovieData.java │ │ │ │ ├── music │ │ │ │ │ ├── Music.java │ │ │ │ │ └── MusicData.java │ │ │ │ ├── question │ │ │ │ │ ├── Question.java │ │ │ │ │ └── QuestionData.java │ │ │ │ └── read │ │ │ │ │ ├── Read.java │ │ │ │ │ └── ReadData.java │ │ │ │ ├── dialog │ │ │ │ ├── MovieProfilePopupWindow.java │ │ │ │ ├── OneImgPopupWindow.java │ │ │ │ └── SharePopupWindow.java │ │ │ │ ├── fragment │ │ │ │ ├── BaseFragment.java │ │ │ │ ├── HomeFragment.java │ │ │ │ ├── ListFragment.java │ │ │ │ └── OneContentFragment.java │ │ │ │ ├── utils │ │ │ │ ├── BitmapUtil.java │ │ │ │ ├── CircleTransform.java │ │ │ │ ├── Constant.java │ │ │ │ ├── DateUtil.java │ │ │ │ ├── DensityUtil.java │ │ │ │ ├── FileUtil.java │ │ │ │ ├── HtmlFmtUtil.java │ │ │ │ ├── RetrofitUtil.java │ │ │ │ └── SPUtil.java │ │ │ │ └── view │ │ │ │ ├── AppToolbar.java │ │ │ │ ├── AuthorsView.java │ │ │ │ ├── CDView.java │ │ │ │ └── ScrollRecyclerView.java │ │ └── res │ │ │ ├── anim │ │ │ ├── pop_enter_b2t.xml │ │ │ ├── pop_enter_r2l.xml │ │ │ ├── pop_exit_l2r.xml │ │ │ └── pop_exit_t2b.xml │ │ │ ├── drawable-v21 │ │ │ └── click_bg.xml │ │ │ ├── drawable │ │ │ ├── back.png │ │ │ ├── click_bg.xml │ │ │ ├── click_default.xml │ │ │ ├── click_pressed.xml │ │ │ ├── collect.png │ │ │ ├── collect_high_light.png │ │ │ ├── comment.png │ │ │ ├── comment_laud.png │ │ │ ├── comment_laud_selected.png │ │ │ ├── decoration.xml │ │ │ ├── edit.png │ │ │ ├── feeds_music.png │ │ │ ├── feeds_music_story.png │ │ │ ├── follow_bg.xml │ │ │ ├── frame_loading.xml │ │ │ ├── like.png │ │ │ ├── like_high_light.png │ │ │ ├── listen.png │ │ │ ├── loading_1.png │ │ │ ├── loading_10.png │ │ │ ├── loading_11.png │ │ │ ├── loading_12.png │ │ │ ├── loading_2.png │ │ │ ├── loading_3.png │ │ │ ├── loading_4.png │ │ │ ├── loading_5.png │ │ │ ├── loading_6.png │ │ │ ├── loading_7.png │ │ │ ├── loading_8.png │ │ │ ├── loading_9.png │ │ │ ├── movie_bottom_bg.xml │ │ │ ├── movie_info.png │ │ │ ├── one_icon.png │ │ │ ├── one_placeholder.png │ │ │ ├── pause.png │ │ │ ├── placeholder.png │ │ │ ├── play.png │ │ │ ├── qq.png │ │ │ ├── search.png │ │ │ ├── share.png │ │ │ ├── tab_home_checked.png │ │ │ ├── tab_home_unchecked.png │ │ │ ├── tab_movie_checked.png │ │ │ ├── tab_movie_unchecked.png │ │ │ ├── tab_music_checked.png │ │ │ ├── tab_music_unchecked.png │ │ │ ├── tab_read_checked.png │ │ │ ├── tab_read_unchecked.png │ │ │ ├── url.png │ │ │ ├── user.png │ │ │ ├── weibo.png │ │ │ ├── weichat.png │ │ │ ├── weichat_friendes.png │ │ │ └── xiami.png │ │ │ ├── layout │ │ │ ├── activity_author.xml │ │ │ ├── activity_main.xml │ │ │ ├── activity_movie.xml │ │ │ ├── activity_music.xml │ │ │ ├── activity_play_video.xml │ │ │ ├── activity_question.xml │ │ │ ├── activity_read.xml │ │ │ ├── activity_splash.xml │ │ │ ├── fragment_content.xml │ │ │ ├── fragment_home.xml │ │ │ ├── item_rv_commet.xml │ │ │ ├── item_rv_day_one.xml │ │ │ ├── item_rv_movie.xml │ │ │ ├── item_rv_music.xml │ │ │ ├── item_rv_read.xml │ │ │ ├── layout_author.xml │ │ │ ├── layout_detail_authors.xml │ │ │ ├── layout_detail_bottombar.xml │ │ │ ├── layout_detail_comments.xml │ │ │ ├── layout_detail_content.xml │ │ │ ├── layout_detail_head.xml │ │ │ ├── layout_hot_decoration.xml │ │ │ ├── layout_loading.xml │ │ │ ├── layout_main_content.xml │ │ │ ├── layout_main_head.xml │ │ │ ├── layout_play_movie.xml │ │ │ ├── layout_popup_movie_profile.xml │ │ │ ├── layout_popup_one_img.xml │ │ │ ├── layout_popup_share.xml │ │ │ ├── layout_rv_item_bottom.xml │ │ │ └── layout_toolbar_content.xml │ │ │ ├── menu │ │ │ └── menu.xml │ │ │ ├── mipmap-hdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-mdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xhdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxhdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxxhdpi │ │ │ └── ic_launcher.png │ │ │ ├── values-w820dp │ │ │ └── dimens.xml │ │ │ └── values │ │ │ ├── attrs.xml │ │ │ ├── colors.xml │ │ │ ├── dimens.xml │ │ │ ├── strings.xml │ │ │ └── styles.xml │ └── test │ │ └── java │ │ └── com │ │ └── liuzhi │ │ └── one │ │ └── ExampleUnitTest.java └── 《ONE一个》.apk ├── build.gradle ├── gif ├── home.gif ├── movie.gif ├── music.gif └── read.gif ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── 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 | .externalNativeBuild 10 | -------------------------------------------------------------------------------- /.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/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17 | 18 | -------------------------------------------------------------------------------- /.idea/inspectionProfiles/Project_Default.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 35 | -------------------------------------------------------------------------------- /.idea/inspectionProfiles/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 19 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 46 | -------------------------------------------------------------------------------- /.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 | 2 | # 说高仿,其实做成了个山寨... 3 | 4 | - **目前完成度看图:** 5 | 6 | ![home.gif](https://github.com/liuzho/ONE/raw/master/gif/home.gif)![read.gif](https://github.com/liuzho/ONE/raw/master/gif/read.gif)![music.gif](https://github.com/liuzho/ONE/raw/master/gif/music.gif)![movie.gif](https://github.com/liuzho/ONE/raw/master/gif/movie.gif) 7 | 8 | ## 关于我 9 | 1. 最近火力全开正在实现中,感兴趣的朋友可以**Star**一下,关注我的后续动作 10 | 2. 虽是火力全开,但学生党目前还有课,有进度但效率可能不太高 11 | 3. 联系我:qq354295878@gmail.com(一个邮箱暴露两个联系方式,完美) 12 | 4. 另:大三狗一枚,求安卓开发实习岗位中 13 | 14 | 15 | ## 开发相关 16 | 17 | ### 更新: 18 | ``` 19 | -2017-4-14 : 20 | 1. 发现Picasso的Target工作在主线程,遂用AsyncTask装一下 21 | 2. 解决在电影详情页按back程序挂掉的bug 22 | 23 | -2017-4-12 : 24 | 1. 所有圆形图片的ImageView换成CircleImageView:新增依赖CircleImageView 25 | 2. API请求APP版本更换成4.1.0 26 | 27 | -2017-4-9 : 28 | 1. 删除电影简介activity,替换成popupWindow展示 29 | 2. 每日一图的popupWindow长按图片实现通过Picasso保存图片到制定路径 30 | 31 | -2017-4-8 : 32 | 1. 自定义RecyclerView实现滚动实时监听,彻底解决RecyclerView滚动时toolbar显示bug 33 | 2. 添加水波纹点击效果 34 | 3. 添加分享按钮弹出popupWindow,包含弹出动画/退出动画 35 | 4. OneList的每日一图点击弹出popupWindow,长按pop图片,弹出Snackbar提示是否保存图片 36 | 37 | -2017-4-7 : 38 | 1. 更换部分图片 39 | 2. 添加各详情页的评论列表 40 | 3. 优化部分代码 41 | 注:后期更新频率会减少 42 | 43 | -2017-4-6 : 44 | 1. 添加BaseFragment、优化fragment代码/逻辑 45 | 2. 自定义RecyclerView实现滚动实时监听(未完成) 46 | 3. 添加作者信息Activity(未完成/无法完成:无作者文章API) 47 | 48 | -2017-4-5 : 49 | 1. 解决tab切换时toolbar显示异常的bug 50 | 2. 优化fragment代码/逻辑 51 | 52 | -2017-4-2 : 53 | 1. 添加页面加载动画(帧动画) 54 | 55 | -2017-3-30: 56 | 1. 优化代码结构:baseActivity&adapter&布局 57 | 58 | -2017-3-27: 59 | 1. 实现底部tab点击,主界面所有tab均有内容展现 60 | 61 | -2017-3-25: 62 | 1. 增加音乐详情页(所有详情页均无显示评论列表,后续加) 63 | 64 | -2017-3-24: 65 | 1. 增加电影详情页以及部分细节调整/实现 66 | 67 | -...再早没写。一次性出来的... 68 | ``` 69 | 70 | ### 大致内容: 71 | 72 | 1. Retrofit进行网络请求 73 | 2. Picasso图片加载;Picasso保存图片到SD卡 74 | 3. RecycleView显示不同类型item 75 | 4. ViewPager切换动画+Fragment 76 | 5. WebView的JS交互(一丢丢,在MovieActivity);WebView加载HTML 77 | 6. 等等...细节说不了那么多,也不好表述,都在项目里 78 | 79 | ### ONE的API:[ONE-API](https://github.com/jokermonn/-Api/blob/master/ONEv3.5.0~.md) 80 | 81 | API来自网络,若侵犯《ONE一个》权利,本人将及时停止使用并删除相关内容 82 | 83 | **PS**:感谢分享的哥们儿;也提示各位朋友不要用于商业用途 84 | 85 | **废话**:《ONE》这个APP的API和JSON不忍直视,原APP卡顿明显,体验差强人意。 86 | 87 | ### 使用到的库: 88 | ``` 89 | - compile 'com.squareup.retrofit2:retrofit:2.2.0'//Retrofit 90 | - compile 'com.squareup.retrofit2:converter-gson:2.0.2'//Gson 91 | - compile 'com.squareup.picasso:picasso:2.5.2'//picasso 92 | - compile 'com.android.support:design:25.3.1'//MD 93 | - compile 'com.android.support:recyclerview-v7:25.3.1'//recyclerView 94 | - compile 'de.hdodenhof:circleimageview:2.1.0'//CircleIV 95 | ``` -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 25 5 | buildToolsVersion '25.0.2' 6 | defaultConfig { 7 | applicationId "com.liuzh.one" 8 | minSdkVersion 16 9 | targetSdkVersion 25 10 | versionCode 1 11 | versionName "1.0" 12 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 13 | } 14 | buildTypes { 15 | release { 16 | minifyEnabled false 17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 18 | } 19 | } 20 | } 21 | 22 | dependencies { 23 | compile fileTree(include: ['*.jar'], dir: 'libs') 24 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 25 | exclude group: 'com.android.support', module: 'support-annotations' 26 | }) 27 | 28 | compile 'com.android.support:appcompat-v7:25.3.1' 29 | 30 | testCompile 'junit:junit:4.12' 31 | //noinspection GradleCompatible 32 | 33 | compile 'com.android.support:recyclerview-v7:25.3.1'//recyclerView 34 | compile 'com.squareup.retrofit2:retrofit:2.2.0'//Retrofit 35 | compile 'com.squareup.retrofit2:converter-gson:2.0.2'//GSon 36 | compile 'com.squareup.picasso:picasso:2.5.2'//picasso 37 | compile 'com.android.support:design:25.3.1'//MaterialDesign 38 | compile 'de.hdodenhof:circleimageview:2.1.0'//CircleImageView 39 | } 40 | -------------------------------------------------------------------------------- /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 D:\AndroidDevelopment\android-sdk-windows/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/com/liuzhi/one/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.liuzhi.one; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumentation test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() throws Exception { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.liuzhi.one", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /app/src/main/java/com/liuzh/one/activity/AuthorActivity.java: -------------------------------------------------------------------------------- 1 | package com.liuzh.one.activity; 2 | 3 | import android.content.Context; 4 | import android.content.Intent; 5 | import android.view.View; 6 | import android.widget.ImageView; 7 | import android.widget.TextView; 8 | 9 | import com.liuzh.one.R; 10 | import com.liuzh.one.bean.Author; 11 | import com.liuzh.one.utils.Constant; 12 | import com.squareup.picasso.Picasso; 13 | 14 | import de.hdodenhof.circleimageview.CircleImageView; 15 | 16 | /** 17 | * 作者信息activity 18 | * Created by 刘晓彬 on 2017/4/6. 19 | */ 20 | 21 | public class AuthorActivity extends BaseActivity { 22 | 23 | private ImageView mIvBack; 24 | private CircleImageView mCivHead; 25 | private TextView mTvName; 26 | private TextView mTvSummary; 27 | private TextView mTvDesc; 28 | private TextView mTvFansNum; 29 | private TextView mTvTitle; 30 | 31 | 32 | public static void start(Context context, Author author) { 33 | Intent starter = new Intent(context, AuthorActivity.class); 34 | starter.putExtra(Constant.INTENT_KEY_AUTHOR, author); 35 | context.startActivity(starter); 36 | } 37 | 38 | @Override 39 | protected int getContentId() { 40 | return R.layout.activity_author; 41 | } 42 | 43 | @Override 44 | protected void findViews() { 45 | mCivHead = (CircleImageView) findViewById(R.id.iv_head); 46 | mTvName = (TextView) findViewById(R.id.tv_author_name); 47 | mTvSummary = (TextView) findViewById(R.id.tv_summary); 48 | mTvDesc = (TextView) findViewById(R.id.tv_desc); 49 | mTvFansNum = (TextView) findViewById(R.id.tv_fans_num); 50 | mIvBack = (ImageView) findViewById(R.id.iv_back); 51 | mTvTitle = (TextView) findViewById(R.id.tv_title); 52 | } 53 | 54 | @Override 55 | protected void initViewData() { 56 | Author author = (Author) getIntent().getSerializableExtra(Constant.INTENT_KEY_AUTHOR); 57 | Picasso.with(mContext) 58 | .load(author.web_url) 59 | .placeholder(R.mipmap.ic_launcher) 60 | .into(mCivHead); 61 | mTvName.setText(author.user_name); 62 | mTvSummary.setText(author.summary); 63 | mTvDesc.setText(author.desc); 64 | mTvFansNum.setText(author.fans_total + "关注"); 65 | mIvBack.setOnClickListener(new View.OnClickListener() { 66 | @Override 67 | public void onClick(View view) { 68 | finish(); 69 | } 70 | }); 71 | mTvTitle.setText(author.user_name); 72 | mTvTitle.setAlpha(0); 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /app/src/main/java/com/liuzh/one/activity/BaseActivity.java: -------------------------------------------------------------------------------- 1 | package com.liuzh.one.activity; 2 | 3 | import android.content.Context; 4 | import android.graphics.drawable.AnimationDrawable; 5 | import android.os.Build; 6 | import android.os.Bundle; 7 | import android.support.annotation.Nullable; 8 | import android.support.v7.app.AppCompatActivity; 9 | import android.view.View; 10 | import android.widget.ImageView; 11 | 12 | import com.liuzh.one.R; 13 | 14 | /** 15 | * base activity 16 | * Created by 刘晓彬 on 2017/3/26. 17 | */ 18 | 19 | public abstract class BaseActivity extends AppCompatActivity { 20 | 21 | protected Context mContext; 22 | private ImageView mIvLoading; 23 | 24 | @Override 25 | protected void onCreate(@Nullable Bundle savedInstanceState) { 26 | super.onCreate(savedInstanceState); 27 | mContext = this; 28 | setContentView(getContentId()); 29 | findViews(); 30 | initViewData(); 31 | fetchData(); 32 | setDarkStatusIcon(true); 33 | } 34 | 35 | public void setDarkStatusIcon(boolean bDark) { 36 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { 37 | View decorView = getWindow().getDecorView(); 38 | if (decorView != null) { 39 | int vis = decorView.getSystemUiVisibility(); 40 | if (bDark) { 41 | vis |= View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR; 42 | } else { 43 | vis &= ~View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR; 44 | } 45 | decorView.setSystemUiVisibility(vis); 46 | } 47 | } 48 | } 49 | 50 | protected abstract int getContentId(); 51 | 52 | protected void fetchData() { 53 | } 54 | 55 | protected abstract void findViews(); 56 | 57 | protected abstract void initViewData(); 58 | 59 | protected void hiddenLoadingView() { 60 | mIvLoading.setVisibility(View.GONE); 61 | } 62 | 63 | protected void showLoadingView() { 64 | if (mIvLoading == null) { 65 | mIvLoading = (ImageView) findViewById(R.id.iv_loading); 66 | } 67 | ((AnimationDrawable) mIvLoading.getDrawable()).start(); 68 | mIvLoading.setVisibility(View.VISIBLE); 69 | } 70 | 71 | @Override 72 | public void onBackPressed() { 73 | super.onBackPressed(); 74 | } 75 | 76 | 77 | } 78 | -------------------------------------------------------------------------------- /app/src/main/java/com/liuzh/one/activity/MusicActivity.java: -------------------------------------------------------------------------------- 1 | package com.liuzh.one.activity; 2 | 3 | import android.content.Context; 4 | import android.content.Intent; 5 | import android.support.v7.widget.DividerItemDecoration; 6 | import android.support.v7.widget.LinearLayoutManager; 7 | import android.support.v7.widget.RecyclerView; 8 | import android.view.View; 9 | import android.webkit.WebView; 10 | import android.widget.TextView; 11 | 12 | import com.liuzh.one.R; 13 | import com.liuzh.one.adapter.CommentRvAdapter; 14 | import com.liuzh.one.application.App; 15 | import com.liuzh.one.bean.Tag; 16 | import com.liuzh.one.bean.comment.Comment; 17 | import com.liuzh.one.bean.comment.CommentData; 18 | import com.liuzh.one.bean.music.Music; 19 | import com.liuzh.one.bean.music.MusicData; 20 | import com.liuzh.one.utils.Constant; 21 | import com.liuzh.one.utils.HtmlFmtUtil; 22 | import com.liuzh.one.utils.RetrofitUtil; 23 | import com.liuzh.one.view.AppToolbar; 24 | import com.liuzh.one.view.AuthorsView; 25 | import com.liuzh.one.view.CDView; 26 | import com.squareup.picasso.Picasso; 27 | 28 | import java.util.List; 29 | 30 | import retrofit2.Call; 31 | import retrofit2.Callback; 32 | import retrofit2.Response; 33 | 34 | /** 35 | * music activity 36 | * Created by 刘晓彬 on 2017/3/23. 37 | */ 38 | 39 | public class MusicActivity extends BaseActivity { 40 | 41 | 42 | private AppToolbar mToolbar; 43 | private CDView mCdvMusic; 44 | private TextView mTvMusicAuthor; 45 | private TextView mTvTitle; 46 | private TextView mTvAuthorName; 47 | private WebView mWvContent; 48 | private TextView mTvEditorInfo; 49 | private TextView mTvCopyright; 50 | private TextView mTvLikeComment; 51 | private AuthorsView mAvAuthors; 52 | private Call mMusicCall; 53 | private Call mCommentCall; 54 | private RecyclerView mRvComments; 55 | 56 | public static void start(Context context, int id) { 57 | Intent intent = new Intent(context, MusicActivity.class); 58 | intent.putExtra(Constant.INTENT_KEY_ID, id); 59 | context.startActivity(intent); 60 | } 61 | 62 | @Override 63 | protected int getContentId() { 64 | return R.layout.activity_music; 65 | } 66 | 67 | @Override 68 | protected void findViews() { 69 | mToolbar = (AppToolbar) findViewById(R.id.toolbar); 70 | mCdvMusic = (CDView) findViewById(R.id.cdv_music); 71 | mTvMusicAuthor = (TextView) findViewById(R.id.tv_music_author); 72 | mTvTitle = (TextView) findViewById(R.id.tv_title); 73 | mTvAuthorName = (TextView) findViewById(R.id.tv_author_name); 74 | mWvContent = (WebView) findViewById(R.id.webView); 75 | mTvEditorInfo = (TextView) findViewById(R.id.tv_info); 76 | mTvCopyright = (TextView) findViewById(R.id.tv_copyright); 77 | mTvLikeComment = (TextView) findViewById(R.id.tv_like_comment); 78 | mAvAuthors = (AuthorsView) findViewById(R.id.av_authors); 79 | mRvComments = (RecyclerView) findViewById(R.id.rv_comments); 80 | } 81 | 82 | @Override 83 | protected void initViewData() { 84 | showLoadingView(); 85 | // init toolbar 86 | mToolbar.setLBtnDrawable(R.drawable.back); 87 | mToolbar.setLBtnClickListener(new View.OnClickListener() { 88 | @Override 89 | public void onClick(View view) { 90 | finish(); 91 | } 92 | }); 93 | mToolbar.setRRDrawable(R.drawable.share); 94 | mToolbar.initShareListener(findViewById(R.id.main)); 95 | setSupportActionBar(mToolbar); 96 | LinearLayoutManager layoutManager = new LinearLayoutManager(mContext) { 97 | @Override 98 | public boolean canScrollVertically() { 99 | return false; 100 | } 101 | }; 102 | mRvComments.setLayoutManager(layoutManager); 103 | mRvComments.addItemDecoration(new DividerItemDecoration( 104 | mContext, DividerItemDecoration.VERTICAL)); 105 | } 106 | 107 | private void setData(MusicData data) { 108 | String toolbarTitle = getString(R.string.one_music); 109 | List tags = data.tag_list; 110 | if (tags.size() != 0) { 111 | toolbarTitle = tags.get(0).title; 112 | } 113 | mToolbar.setToolbarTitle(toolbarTitle); 114 | Picasso.with(mContext) 115 | .load(data.cover) 116 | .into(mCdvMusic); 117 | mTvMusicAuthor.setText(" · " + data.title + " · \n" + 118 | data.author.user_name + " | " + data.album); 119 | mTvTitle.setText(data.story_title); 120 | mTvAuthorName.setText("文 / " + data.story_author.user_name); 121 | mWvContent.loadDataWithBaseURL("about:blank", 122 | HtmlFmtUtil.fmt(data.story), "text/html", "utf-8", null); 123 | mTvEditorInfo.setText(data.charge_edt + " " + data.editor_email); 124 | mTvCopyright.setText(data.copyright); 125 | mTvLikeComment.setText(data.praisenum + " 喜欢 · " + data.commentnum + " 评论"); 126 | mAvAuthors.setAuthors(data.author_list); 127 | } 128 | 129 | @Override 130 | protected void fetchData() { 131 | int id = getIntent().getIntExtra(Constant.INTENT_KEY_ID, -1); 132 | if (id == -1) { 133 | App.showToast("id=-1"); 134 | return; 135 | } 136 | fetchMusic(id); 137 | fetchComment(id); 138 | } 139 | 140 | private void fetchComment(final int id) { 141 | mCommentCall = RetrofitUtil.getMusicCommentCall(id); 142 | mCommentCall.enqueue(new Callback() { 143 | @Override 144 | public void onResponse(Call call, Response response) { 145 | setComment(response.body().data); 146 | } 147 | 148 | @Override 149 | public void onFailure(Call call, Throwable t) { 150 | fetchComment(id); 151 | } 152 | }); 153 | } 154 | 155 | public void setComment(CommentData comment) { 156 | mRvComments.setAdapter(new CommentRvAdapter(mContext, comment)); 157 | } 158 | 159 | private void fetchMusic(final int id) { 160 | mMusicCall = RetrofitUtil.getMusicCall(id); 161 | mMusicCall.enqueue(new Callback() { 162 | @Override 163 | public void onResponse(Call call, Response response) { 164 | setData(response.body().data); 165 | hiddenLoadingView(); 166 | } 167 | 168 | @Override 169 | public void onFailure(Call call, Throwable t) { 170 | App.showToast("失败-再次请求"); 171 | fetchMusic(id); 172 | } 173 | }); 174 | } 175 | 176 | @Override 177 | protected void onDestroy() { 178 | super.onDestroy(); 179 | mMusicCall.cancel(); 180 | mCommentCall.cancel(); 181 | } 182 | 183 | @Override 184 | public void onBackPressed() { 185 | if (mToolbar.popIsShowing()) { 186 | mToolbar.dismissPop(); 187 | } else { 188 | finish(); 189 | } 190 | } 191 | } 192 | -------------------------------------------------------------------------------- /app/src/main/java/com/liuzh/one/activity/QuestionActivity.java: -------------------------------------------------------------------------------- 1 | package com.liuzh.one.activity; 2 | 3 | import android.content.Context; 4 | import android.content.Intent; 5 | import android.support.v7.widget.DividerItemDecoration; 6 | import android.support.v7.widget.LinearLayoutManager; 7 | import android.support.v7.widget.RecyclerView; 8 | import android.text.TextUtils; 9 | import android.view.View; 10 | import android.webkit.WebView; 11 | import android.webkit.WebViewClient; 12 | import android.widget.TextView; 13 | 14 | import com.liuzh.one.R; 15 | import com.liuzh.one.adapter.CommentRvAdapter; 16 | import com.liuzh.one.application.App; 17 | import com.liuzh.one.bean.Tag; 18 | import com.liuzh.one.bean.comment.Comment; 19 | import com.liuzh.one.bean.comment.CommentData; 20 | import com.liuzh.one.bean.question.Question; 21 | import com.liuzh.one.bean.question.QuestionData; 22 | import com.liuzh.one.utils.Constant; 23 | import com.liuzh.one.utils.HtmlFmtUtil; 24 | import com.liuzh.one.utils.RetrofitUtil; 25 | import com.liuzh.one.view.AppToolbar; 26 | 27 | import java.util.List; 28 | 29 | import retrofit2.Call; 30 | import retrofit2.Callback; 31 | import retrofit2.Response; 32 | 33 | /** 34 | * Created by 刘晓彬 on 2017/3/28. 35 | */ 36 | 37 | public class QuestionActivity extends BaseActivity { 38 | 39 | private AppToolbar mToolbar; 40 | private TextView mTvQuestionTitle; 41 | private TextView mTvQuestionContent; 42 | private TextView mTvQuestionAsker; 43 | private TextView mTvAnswerer; 44 | private TextView mTvEditorInfo; 45 | private TextView mTvCopyright; 46 | private WebView mWvContent; 47 | private Call mQuestionCall; 48 | private Call mCommentCall; 49 | private RecyclerView mRvComments; 50 | 51 | public static void start(Context context, int id) { 52 | Intent intent = new Intent(context, QuestionActivity.class); 53 | intent.putExtra(Constant.INTENT_KEY_ID, id); 54 | context.startActivity(intent); 55 | } 56 | 57 | @Override 58 | protected int getContentId() { 59 | return R.layout.activity_question; 60 | } 61 | 62 | 63 | @Override 64 | protected void findViews() { 65 | mToolbar = (AppToolbar) findViewById(R.id.toolbar); 66 | mTvQuestionTitle = (TextView) findViewById(R.id.tv_question_title); 67 | mTvQuestionContent = (TextView) findViewById(R.id.tv_question_content); 68 | mTvQuestionAsker = (TextView) findViewById(R.id.tv_question_asker); 69 | mTvAnswerer = (TextView) findViewById(R.id.tv_answerer); 70 | mWvContent = (WebView) findViewById(R.id.webView); 71 | mTvEditorInfo = (TextView) findViewById(R.id.tv_info); 72 | mTvCopyright = (TextView) findViewById(R.id.tv_copyright); 73 | mRvComments = (RecyclerView) findViewById(R.id.rv_comments); 74 | } 75 | 76 | @Override 77 | protected void initViewData() { 78 | showLoadingView(); 79 | // init toolbar 80 | mToolbar.setLBtnDrawable(R.drawable.back); 81 | mToolbar.setLBtnClickListener(new View.OnClickListener() { 82 | @Override 83 | public void onClick(View view) { 84 | finish(); 85 | } 86 | }); 87 | mToolbar.setRRDrawable(R.drawable.share); 88 | mToolbar.initShareListener(findViewById(R.id.main)); 89 | setSupportActionBar(mToolbar); 90 | mWvContent.setWebViewClient(new WebViewClient() { 91 | @Override 92 | public void onPageFinished(WebView view, String url) { 93 | super.onPageFinished(view, url); 94 | hiddenLoadingView(); 95 | } 96 | }); 97 | LinearLayoutManager layoutManager = new LinearLayoutManager(mContext) { 98 | @Override 99 | public boolean canScrollVertically() { 100 | return false; 101 | } 102 | }; 103 | mRvComments.setLayoutManager(layoutManager); 104 | mRvComments.addItemDecoration(new DividerItemDecoration( 105 | mContext, DividerItemDecoration.VERTICAL)); 106 | } 107 | 108 | 109 | 110 | private void setData(QuestionData data) { 111 | List tags = data.tag_list; 112 | String toolbarTitle = getString(R.string.one_question); 113 | if (tags.size() != 0) { 114 | toolbarTitle = tags.get(0).title; 115 | } 116 | mToolbar.setToolbarTitle(toolbarTitle); 117 | mTvQuestionTitle.setText(data.question_title); 118 | mTvQuestionContent.setText(data.question_content); 119 | mTvQuestionAsker.setText("————" + data.asker.user_name + "问道"); 120 | mTvAnswerer.setText(data.answerer.user_name + "答:"); 121 | mWvContent.loadDataWithBaseURL("about:blank", 122 | HtmlFmtUtil.fmt(data.answer_content), "text/html", "utf-8", null); 123 | mTvEditorInfo.setText(data.charge_edt + " " + data.charge_email); 124 | if (TextUtils.isEmpty(data.copyright)) { 125 | mTvCopyright.setVisibility(View.GONE); 126 | } else { 127 | mTvCopyright.setText(data.copyright + ""); 128 | } 129 | } 130 | 131 | @Override 132 | protected void fetchData() { 133 | int id = getIntent().getIntExtra(Constant.INTENT_KEY_ID, -1); 134 | if (id == -1) { 135 | App.showToast("ID = -1"); 136 | return; 137 | } 138 | fetchQuestion(id); 139 | fetchComment(id); 140 | 141 | } 142 | 143 | private void fetchComment(final int id) { 144 | mCommentCall = RetrofitUtil.getQuestionCommentCall(id); 145 | mCommentCall.enqueue(new Callback() { 146 | @Override 147 | public void onResponse(Call call, Response response) { 148 | setComment(response.body().data); 149 | } 150 | 151 | @Override 152 | public void onFailure(Call call, Throwable t) { 153 | fetchComment(id); 154 | } 155 | }); 156 | } 157 | 158 | 159 | private void setComment(CommentData comment) { 160 | mRvComments.setAdapter(new CommentRvAdapter(mContext, comment)); 161 | } 162 | 163 | private void fetchQuestion(final int id) { 164 | mQuestionCall = RetrofitUtil.getQuestionCall(id); 165 | mQuestionCall.enqueue(new Callback() { 166 | @Override 167 | public void onResponse(Call call, Response response) { 168 | setData(response.body().data); 169 | hiddenLoadingView(); 170 | } 171 | 172 | @Override 173 | public void onFailure(Call call, Throwable t) { 174 | App.showToast("失败,再次尝试"); 175 | fetchQuestion(id); 176 | } 177 | }); 178 | } 179 | 180 | @Override 181 | protected void onDestroy() { 182 | super.onDestroy(); 183 | mQuestionCall.cancel(); 184 | } 185 | 186 | @Override 187 | public void onBackPressed() { 188 | if (mToolbar.popIsShowing()) { 189 | mToolbar.dismissPop(); 190 | } else { 191 | finish(); 192 | } 193 | } 194 | } 195 | -------------------------------------------------------------------------------- /app/src/main/java/com/liuzh/one/activity/SplashActivity.java: -------------------------------------------------------------------------------- 1 | package com.liuzh.one.activity; 2 | 3 | import android.os.Bundle; 4 | import android.support.annotation.Nullable; 5 | import android.support.v7.app.AppCompatActivity; 6 | 7 | import com.liuzh.one.R; 8 | import com.liuzh.one.application.App; 9 | import com.liuzh.one.bean.list.OneListId; 10 | import com.liuzh.one.utils.DateUtil; 11 | import com.liuzh.one.utils.RetrofitUtil; 12 | import com.liuzh.one.utils.SPUtil; 13 | 14 | import java.util.ArrayList; 15 | import java.util.Collections; 16 | 17 | import retrofit2.Call; 18 | import retrofit2.Callback; 19 | import retrofit2.Response; 20 | 21 | /** 22 | * 首屏页 23 | * Created by 刘晓彬 on 2017/3/19. 24 | */ 25 | 26 | public class SplashActivity extends AppCompatActivity { 27 | private static final String TAG = "SplashActivity"; 28 | 29 | @Override 30 | protected void onCreate(@Nullable Bundle savedInstanceState) { 31 | super.onCreate(savedInstanceState); 32 | setContentView(R.layout.activity_splash); 33 | fetchOneListId(); 34 | } 35 | 36 | /** 37 | * 获取oneListId 38 | */ 39 | public void fetchOneListId() { 40 | String nowDate = DateUtil.getFmtYMD(); 41 | String lastOpenDate = SPUtil.getString(SPUtil.SP_KEY_OPEN_DATE, ""); 42 | //根据SP存储的年月日信息,如果当天打开过应用即当天获取过oneListId, 43 | // 则不再获取直接从SP中读取IDs然后进入MainActivity 44 | if (lastOpenDate.equals(nowDate)) { 45 | String listIdStr = SPUtil.getString(SPUtil.SP_KEY_ONE_LIST_ID, ""); 46 | ArrayList listId = new ArrayList<>(); 47 | Collections.addAll(listId, listIdStr.split(",")); 48 | startMainActivity(listId); 49 | return; 50 | } 51 | //如果当天第一次打开应用,则获取oneListId数据 52 | RetrofitUtil.getOneListIdCall() 53 | .enqueue(new Callback() { 54 | @Override 55 | public void onResponse(Call call, Response response) { 56 | //向SP写入打开应用的日期 57 | SPUtil.putString(SPUtil.SP_KEY_OPEN_DATE, DateUtil.getFmtYMD()); 58 | OneListId listId = response.body(); 59 | //将oneListId全部存入SP 60 | String content = listId.data.get(0); 61 | for (int i = 1; i < listId.data.size(); i++) { 62 | content = content + "," + listId.data.get(i); 63 | } 64 | SPUtil.putString(SPUtil.SP_KEY_ONE_LIST_ID, content); 65 | 66 | startMainActivity(listId.data); 67 | } 68 | 69 | @Override 70 | public void onFailure(Call call, Throwable t) { 71 | App.showToast("失败,再次尝试"); 72 | fetchOneListId(); 73 | } 74 | }); 75 | } 76 | 77 | /** 78 | * 进入MainActivity 79 | */ 80 | private void startMainActivity(ArrayList listId) { 81 | MainActivity.start(this, listId); 82 | finish(); 83 | } 84 | 85 | } 86 | -------------------------------------------------------------------------------- /app/src/main/java/com/liuzh/one/activity/VideoActivity.java: -------------------------------------------------------------------------------- 1 | package com.liuzh.one.activity; 2 | 3 | import android.content.Context; 4 | import android.content.Intent; 5 | import android.net.Uri; 6 | import android.os.Bundle; 7 | import android.support.annotation.Nullable; 8 | import android.support.v7.app.AppCompatActivity; 9 | import android.widget.MediaController; 10 | import android.widget.VideoView; 11 | 12 | import com.liuzh.one.R; 13 | import com.liuzh.one.utils.Constant; 14 | 15 | /** 16 | * 播放视频 activity 17 | * Created by 刘晓彬 on 2017/4/2. 18 | */ 19 | 20 | public class VideoActivity extends AppCompatActivity { 21 | 22 | 23 | private VideoView mVideoView; 24 | 25 | public static void start(Context context, String url) { 26 | Intent starter = new Intent(context, VideoActivity.class); 27 | starter.putExtra(Constant.INTENT_KEY_URL, url); 28 | context.startActivity(starter); 29 | } 30 | 31 | @Override 32 | protected void onCreate(@Nullable Bundle savedInstanceState) { 33 | super.onCreate(savedInstanceState); 34 | setContentView(R.layout.activity_play_video); 35 | mVideoView = (VideoView) findViewById(R.id.webView); 36 | String url = getIntent().getStringExtra(Constant.INTENT_KEY_URL); 37 | mVideoView.setVideoURI(Uri.parse(url)); 38 | mVideoView.setMediaController(new MediaController(this)); 39 | mVideoView.start(); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /app/src/main/java/com/liuzh/one/adapter/CommentRvAdapter.java: -------------------------------------------------------------------------------- 1 | package com.liuzh.one.adapter; 2 | 3 | import android.content.Context; 4 | import android.support.v7.widget.RecyclerView; 5 | import android.text.TextUtils; 6 | import android.view.LayoutInflater; 7 | import android.view.View; 8 | import android.view.ViewGroup; 9 | import android.widget.ImageView; 10 | import android.widget.LinearLayout; 11 | import android.widget.TextView; 12 | 13 | import com.liuzh.one.R; 14 | import com.liuzh.one.bean.comment.CommentData; 15 | import com.liuzh.one.bean.comment.Datum; 16 | import com.squareup.picasso.Picasso; 17 | 18 | import java.util.List; 19 | 20 | import de.hdodenhof.circleimageview.CircleImageView; 21 | 22 | /** 23 | * Created by 刘晓彬 on 2017/4/7. 24 | */ 25 | 26 | public class CommentRvAdapter extends RecyclerView.Adapter { 27 | private CommentData mCommentData; 28 | private Context mContext; 29 | 30 | public CommentRvAdapter(Context context, CommentData data) { 31 | mContext = context; 32 | mCommentData = data; 33 | boolean added = false; 34 | boolean hasHot = false; 35 | List datums = mCommentData.data; 36 | for (int i = 0; i < datums.size(); i++) { 37 | Datum datum = datums.get(i); 38 | if (datum.type == 0) { 39 | hasHot = true; 40 | } else if (datum.type == 1 && !added && hasHot) { 41 | Datum d = new Datum(); 42 | d.type = 3; 43 | datums.add(i, d); 44 | added = true; 45 | } 46 | } 47 | } 48 | 49 | 50 | @Override 51 | public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { 52 | LayoutInflater inflater = LayoutInflater.from(mContext); 53 | RecyclerView.ViewHolder holder; 54 | switch (viewType) { 55 | case 3: 56 | holder = new DecorHolder(inflater.inflate( 57 | R.layout.layout_hot_decoration, parent, false)); 58 | break; 59 | default: 60 | holder = new CommentHolder(inflater.inflate( 61 | R.layout.item_rv_commet, parent, false)); 62 | } 63 | return holder; 64 | } 65 | 66 | @Override 67 | public int getItemViewType(int position) { 68 | return mCommentData.data.get(position).type; 69 | } 70 | 71 | @Override 72 | public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { 73 | if (holder instanceof CommentHolder) { 74 | Datum datum = mCommentData.data.get(position); 75 | if (!TextUtils.isEmpty(datum.user.web_url)) { 76 | Picasso.with(mContext) 77 | .load(datum.user.web_url) 78 | .into(((CommentHolder) holder).civHead); 79 | } 80 | ((CommentHolder) holder).tvUserName.setText(datum.user.user_name); 81 | ((CommentHolder) holder).tvTime.setText(datum.created_at); 82 | ((CommentHolder) holder).tvContent.setText(datum.content); 83 | ((CommentHolder) holder).tvLaudNum.setText(datum.praisenum + ""); 84 | if (datum.touser != null) { 85 | ((CommentHolder) holder).llToUser.setVisibility(View.VISIBLE); 86 | ((CommentHolder) holder).tvToUserName.setText(datum.touser.user_name + ":"); 87 | ((CommentHolder) holder).tvToUserContent.setText(datum.quote); 88 | } else { 89 | ((CommentHolder) holder).llToUser.setVisibility(View.GONE); 90 | } 91 | } 92 | } 93 | 94 | @Override 95 | public int getItemCount() { 96 | return mCommentData.data.size(); 97 | } 98 | 99 | 100 | class CommentHolder extends RecyclerView.ViewHolder { 101 | 102 | CircleImageView civHead; 103 | ImageView ivComment; 104 | ImageView ivLaud; 105 | TextView tvUserName; 106 | TextView tvTime; 107 | TextView tvContent; 108 | TextView tvLaudNum; 109 | LinearLayout llToUser; 110 | TextView tvToUserName; 111 | TextView tvToUserContent; 112 | 113 | public CommentHolder(View itemView) { 114 | super(itemView); 115 | civHead = (CircleImageView) itemView.findViewById(R.id.iv_head); 116 | ivComment = (ImageView) itemView.findViewById(R.id.iv_comment); 117 | ivLaud = (ImageView) itemView.findViewById(R.id.iv_laud); 118 | tvUserName = (TextView) itemView.findViewById(R.id.tv_username); 119 | tvTime = (TextView) itemView.findViewById(R.id.tv_time); 120 | tvContent = (TextView) itemView.findViewById(R.id.tv_content); 121 | tvLaudNum = (TextView) itemView.findViewById(R.id.tv_laud_num); 122 | llToUser = (LinearLayout) itemView.findViewById(R.id.ll_to_user); 123 | tvToUserName = (TextView) itemView.findViewById(R.id.tv_to_user_username); 124 | tvToUserContent = (TextView) itemView.findViewById(R.id.tv_to_user_content); 125 | } 126 | } 127 | 128 | class DecorHolder extends RecyclerView.ViewHolder { 129 | 130 | public DecorHolder(View itemView) { 131 | super(itemView); 132 | } 133 | } 134 | } 135 | -------------------------------------------------------------------------------- /app/src/main/java/com/liuzh/one/adapter/ViewsPagerAdapter.java: -------------------------------------------------------------------------------- 1 | package com.liuzh.one.adapter; 2 | 3 | import android.content.Context; 4 | import android.support.v4.view.PagerAdapter; 5 | import android.text.TextUtils; 6 | import android.view.View; 7 | import android.view.ViewGroup; 8 | 9 | import com.liuzh.one.R; 10 | import com.liuzh.one.activity.VideoActivity; 11 | 12 | import java.util.List; 13 | 14 | /** 15 | * images view pager adapter 16 | * Created by 刘晓彬 on 2017/3/30. 17 | */ 18 | 19 | public class ViewsPagerAdapter extends PagerAdapter { 20 | private static final String TAG = "ViewsPagerAdapter"; 21 | private List mViews; 22 | 23 | public ViewsPagerAdapter(final Context context, List views) { 24 | mViews = views; 25 | View v = mViews.get(0); 26 | final String videoUrl = (String) v.getTag(); 27 | if (!TextUtils.isEmpty(videoUrl)) { 28 | v.findViewById(R.id.iv_play).setOnClickListener(new View.OnClickListener() { 29 | @Override 30 | public void onClick(View view) { 31 | VideoActivity.start(context, videoUrl); 32 | } 33 | }); 34 | } 35 | } 36 | 37 | @Override 38 | public int getCount() { 39 | return mViews.size(); 40 | } 41 | 42 | @Override 43 | public boolean isViewFromObject(View view, Object object) { 44 | return view == object; 45 | } 46 | 47 | @Override 48 | public void destroyItem(ViewGroup container, int position, Object object) { 49 | // container.removeView(mIVList.get(position % mIVList.size())); 50 | } 51 | 52 | @Override 53 | public Object instantiateItem(ViewGroup container, int position) { 54 | View view = mViews.get(position); 55 | ViewGroup parent = (ViewGroup) view.getParent(); 56 | //如果当前要显示的view有父布局先将父布局移除(view只能有一个父布局) 57 | if (parent != null) { 58 | parent.removeView(view); 59 | } 60 | container.addView(view); 61 | return view; 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /app/src/main/java/com/liuzh/one/application/App.java: -------------------------------------------------------------------------------- 1 | package com.liuzh.one.application; 2 | 3 | import android.app.Activity; 4 | import android.app.Application; 5 | import android.content.Context; 6 | import android.os.Bundle; 7 | import android.util.Log; 8 | import android.widget.Toast; 9 | 10 | import java.lang.ref.Reference; 11 | import java.lang.ref.WeakReference; 12 | import java.util.ArrayList; 13 | import java.util.List; 14 | 15 | /** 16 | * application 17 | * Created by 刘晓彬 on 2017/3/16. 18 | */ 19 | 20 | public class App extends Application { 21 | private static final String TAG = "ActivityLC"; 22 | 23 | private static Context mContext; 24 | private static Toast toast; 25 | 26 | @Override 27 | public void onCreate() { 28 | super.onCreate(); 29 | mContext = this; 30 | } 31 | 32 | public static Context getContext() { 33 | return mContext; 34 | } 35 | 36 | public static void showToast(String msg) { 37 | if (toast == null) { 38 | toast = Toast.makeText(mContext, msg, Toast.LENGTH_SHORT); 39 | } else { 40 | toast.setText(msg); 41 | } 42 | toast.show(); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /app/src/main/java/com/liuzh/one/bean/Author.java: -------------------------------------------------------------------------------- 1 | 2 | package com.liuzh.one.bean; 3 | 4 | import java.io.Serializable; 5 | 6 | public class Author implements Serializable{ 7 | 8 | public String user_id; 9 | public String user_name; 10 | public String desc; 11 | public String wb_name; 12 | public String is_settled; 13 | public String settled_type; 14 | public String summary; 15 | public String fans_total; 16 | public String web_url; 17 | } 18 | -------------------------------------------------------------------------------- /app/src/main/java/com/liuzh/one/bean/ContentList.java: -------------------------------------------------------------------------------- 1 | 2 | package com.liuzh.one.bean; 3 | 4 | import com.liuzh.one.bean.list.ShareInfo; 5 | 6 | import java.util.List; 7 | 8 | public class ContentList { 9 | 10 | public String id; 11 | public String category; 12 | public Integer display_category; 13 | public String item_id; 14 | public String title; 15 | public String forward; 16 | public String img_url; 17 | public Integer like_count; 18 | public String post_date; 19 | public String last_update_date; 20 | public Author author; 21 | public String video_url; 22 | public String audio_url; 23 | public Integer audio_platform; 24 | public String start_video; 25 | public String volume; 26 | public String pic_info; 27 | public String words_info; 28 | public String subtitle; 29 | public Integer number; 30 | public Integer serial_id; 31 | public List serial_list = null; 32 | public String movie_story_id; 33 | public Integer ad_id; 34 | public Integer ad_type; 35 | public String ad_pvurl; 36 | public String ad_linkurl; 37 | public String ad_makettime; 38 | public String ad_closetime; 39 | public String ad_shareCnt; 40 | public String ad_pvurl_vendor; 41 | public String content_id; 42 | public String content_type; 43 | public String content_bgcolor; 44 | public String share_url; 45 | public ShareInfo share_info; 46 | public ShareList share_list; 47 | public List tag_list = null; 48 | public String orientation; 49 | public String music_name; 50 | public String audio_author; 51 | public String audio_album; 52 | public Author answerer; 53 | } 54 | -------------------------------------------------------------------------------- /app/src/main/java/com/liuzh/one/bean/DataList.java: -------------------------------------------------------------------------------- 1 | package com.liuzh.one.bean; 2 | 3 | import java.util.List; 4 | 5 | /** 6 | * Created by 刘晓彬 on 2017/3/27. 7 | */ 8 | 9 | public class DataList { 10 | public Integer res; 11 | public List data = null; 12 | } 13 | -------------------------------------------------------------------------------- /app/src/main/java/com/liuzh/one/bean/Qq.java: -------------------------------------------------------------------------------- 1 | 2 | package com.liuzh.one.bean; 3 | 4 | public class Qq { 5 | 6 | public String title; 7 | public String desc; 8 | public String link; 9 | public String img_url; 10 | 11 | } 12 | -------------------------------------------------------------------------------- /app/src/main/java/com/liuzh/one/bean/ShareList.java: -------------------------------------------------------------------------------- 1 | 2 | package com.liuzh.one.bean; 3 | 4 | public class ShareList { 5 | 6 | public Wx wx; 7 | public Weibo weibo; 8 | public Qq qq; 9 | 10 | } 11 | -------------------------------------------------------------------------------- /app/src/main/java/com/liuzh/one/bean/Tag.java: -------------------------------------------------------------------------------- 1 | 2 | package com.liuzh.one.bean; 3 | 4 | public class Tag { 5 | 6 | public String id; 7 | public String title; 8 | 9 | } 10 | -------------------------------------------------------------------------------- /app/src/main/java/com/liuzh/one/bean/Weibo.java: -------------------------------------------------------------------------------- 1 | 2 | package com.liuzh.one.bean; 3 | 4 | public class Weibo { 5 | 6 | public String title; 7 | public String desc; 8 | public String link; 9 | public String img_url; 10 | } 11 | -------------------------------------------------------------------------------- /app/src/main/java/com/liuzh/one/bean/Wx.java: -------------------------------------------------------------------------------- 1 | 2 | package com.liuzh.one.bean; 3 | 4 | public class Wx { 5 | 6 | public String title; 7 | public String desc; 8 | public String link; 9 | public String img_url; 10 | } 11 | -------------------------------------------------------------------------------- /app/src/main/java/com/liuzh/one/bean/comment/Comment.java: -------------------------------------------------------------------------------- 1 | 2 | package com.liuzh.one.bean.comment; 3 | 4 | public class Comment { 5 | 6 | public Integer res; 7 | public CommentData data; 8 | 9 | } 10 | -------------------------------------------------------------------------------- /app/src/main/java/com/liuzh/one/bean/comment/CommentData.java: -------------------------------------------------------------------------------- 1 | 2 | package com.liuzh.one.bean.comment; 3 | 4 | import java.util.List; 5 | 6 | public class CommentData { 7 | 8 | public Integer count; 9 | public List data = null; 10 | 11 | 12 | } 13 | -------------------------------------------------------------------------------- /app/src/main/java/com/liuzh/one/bean/comment/Datum.java: -------------------------------------------------------------------------------- 1 | 2 | package com.liuzh.one.bean.comment; 3 | 4 | public class Datum { 5 | 6 | public String id; 7 | public String quote; 8 | public String content; 9 | public Integer praisenum; 10 | public String device_token; 11 | public String del_flag; 12 | public String reviewed; 13 | public String user_info_id; 14 | public String input_date; 15 | public String created_at; 16 | public String updated_at; 17 | public User user; 18 | public User touser; 19 | public Integer type; 20 | 21 | } 22 | -------------------------------------------------------------------------------- /app/src/main/java/com/liuzh/one/bean/comment/User.java: -------------------------------------------------------------------------------- 1 | 2 | package com.liuzh.one.bean.comment; 3 | 4 | public class User { 5 | 6 | public String user_id; 7 | public String user_name; 8 | public String web_url; 9 | 10 | } 11 | -------------------------------------------------------------------------------- /app/src/main/java/com/liuzh/one/bean/list/Data.java: -------------------------------------------------------------------------------- 1 | 2 | package com.liuzh.one.bean.list; 3 | 4 | import com.liuzh.one.bean.ContentList; 5 | 6 | import java.util.List; 7 | 8 | public class Data { 9 | 10 | public String id; 11 | public Weather weather; 12 | public String date; 13 | public List content_list = null; 14 | } 15 | -------------------------------------------------------------------------------- /app/src/main/java/com/liuzh/one/bean/list/Icons.java: -------------------------------------------------------------------------------- 1 | 2 | package com.liuzh.one.bean.list; 3 | 4 | public class Icons { 5 | 6 | public String day; 7 | public String night; 8 | } 9 | -------------------------------------------------------------------------------- /app/src/main/java/com/liuzh/one/bean/list/OneDay.java: -------------------------------------------------------------------------------- 1 | 2 | package com.liuzh.one.bean.list; 3 | 4 | public class OneDay { 5 | 6 | public Integer res; 7 | public Data data; 8 | 9 | } 10 | -------------------------------------------------------------------------------- /app/src/main/java/com/liuzh/one/bean/list/OneListId.java: -------------------------------------------------------------------------------- 1 | package com.liuzh.one.bean.list; 2 | 3 | /** 4 | * Created by 刘晓彬 on 2017/3/19. 5 | */ 6 | 7 | import java.util.ArrayList; 8 | 9 | public class OneListId { 10 | 11 | public Integer res; 12 | public ArrayList data = null; 13 | 14 | } 15 | -------------------------------------------------------------------------------- /app/src/main/java/com/liuzh/one/bean/list/ShareInfo.java: -------------------------------------------------------------------------------- 1 | 2 | package com.liuzh.one.bean.list; 3 | 4 | public class ShareInfo { 5 | 6 | public String url; 7 | public String image; 8 | public String title; 9 | public String content; 10 | 11 | } 12 | -------------------------------------------------------------------------------- /app/src/main/java/com/liuzh/one/bean/list/Weather.java: -------------------------------------------------------------------------------- 1 | 2 | package com.liuzh.one.bean.list; 3 | 4 | public class Weather { 5 | 6 | public String city_name; 7 | public String date; 8 | public String temperature; 9 | public String humidity; 10 | public String climate; 11 | public String wind_direction; 12 | public String hurricane; 13 | public Icons icons; 14 | } 15 | -------------------------------------------------------------------------------- /app/src/main/java/com/liuzh/one/bean/movie/Movie.java: -------------------------------------------------------------------------------- 1 | 2 | package com.liuzh.one.bean.movie; 3 | 4 | public class Movie { 5 | 6 | public Integer res; 7 | public MovieData data; 8 | 9 | 10 | } 11 | -------------------------------------------------------------------------------- /app/src/main/java/com/liuzh/one/bean/movie/MovieData.java: -------------------------------------------------------------------------------- 1 | 2 | package com.liuzh.one.bean.movie; 3 | 4 | import com.liuzh.one.bean.ShareList; 5 | import com.liuzh.one.bean.Tag; 6 | 7 | import java.util.List; 8 | 9 | public class MovieData { 10 | 11 | public String id; 12 | public String title; 13 | public String indexcover; 14 | public String detailcover; 15 | public String video; 16 | public String verse; 17 | public String verse_en; 18 | public Object score; 19 | public String revisedscore; 20 | public String review; 21 | public String keywords; 22 | public String movie_id; 23 | public String info; 24 | public String officialstory; 25 | public String hide_flag; 26 | public String charge_edt; 27 | public String web_url; 28 | public Integer praisenum; 29 | public String sort; 30 | public String releasetime; 31 | public String scoretime; 32 | public String maketime; 33 | public String last_update_date; 34 | public String read_num; 35 | public String directors; 36 | public String editor_email; 37 | public String related; 38 | public String directors_id; 39 | public String start_video; 40 | public String media_type; 41 | public String poster; 42 | public List photo = null; 43 | public String next_id; 44 | public String previous_id; 45 | public List tag_list = null; 46 | public ShareList share_list; 47 | public Integer sharenum; 48 | public Integer commentnum; 49 | public Integer servertime; 50 | 51 | 52 | } 53 | -------------------------------------------------------------------------------- /app/src/main/java/com/liuzh/one/bean/music/Music.java: -------------------------------------------------------------------------------- 1 | 2 | package com.liuzh.one.bean.music; 3 | 4 | public class Music { 5 | 6 | public Integer res; 7 | public MusicData data; 8 | 9 | } 10 | -------------------------------------------------------------------------------- /app/src/main/java/com/liuzh/one/bean/music/MusicData.java: -------------------------------------------------------------------------------- 1 | 2 | package com.liuzh.one.bean.music; 3 | 4 | import com.liuzh.one.bean.Author; 5 | import com.liuzh.one.bean.ShareList; 6 | import com.liuzh.one.bean.Tag; 7 | 8 | import java.util.List; 9 | 10 | public class MusicData { 11 | 12 | public String id; 13 | public String title; 14 | public String cover; 15 | public String isfirst; 16 | public String story_title; 17 | public String story; 18 | public String lyric; 19 | public String info; 20 | public String platform; 21 | public String music_id; 22 | public String charge_edt; 23 | public String related_to; 24 | public String web_url; 25 | public Integer praisenum; 26 | public String hide_flag; 27 | public String sort; 28 | public String maketime; 29 | public String last_update_date; 30 | public String read_num; 31 | public String story_summary; 32 | public String audio; 33 | public String anchor; 34 | public String editor_email; 35 | public String related_musics; 36 | public String album; 37 | public String start_video; 38 | public String media_type; 39 | public String copyright; 40 | public Author author; 41 | public Author story_author; 42 | public List author_list = null; 43 | public String next_id; 44 | public String previous_id; 45 | public List tag_list = null; 46 | public ShareList share_list; 47 | public Integer sharenum; 48 | public Integer commentnum; 49 | 50 | } 51 | -------------------------------------------------------------------------------- /app/src/main/java/com/liuzh/one/bean/question/Question.java: -------------------------------------------------------------------------------- 1 | 2 | package com.liuzh.one.bean.question; 3 | 4 | public class Question { 5 | 6 | public Integer res; 7 | public QuestionData data; 8 | 9 | } 10 | -------------------------------------------------------------------------------- /app/src/main/java/com/liuzh/one/bean/question/QuestionData.java: -------------------------------------------------------------------------------- 1 | 2 | package com.liuzh.one.bean.question; 3 | 4 | import com.liuzh.one.bean.Author; 5 | import com.liuzh.one.bean.ShareList; 6 | import com.liuzh.one.bean.Tag; 7 | 8 | import java.util.List; 9 | 10 | public class QuestionData { 11 | 12 | public String question_id; 13 | public String question_title; 14 | public String question_content; 15 | public String answer_title; 16 | public String answer_content; 17 | public String question_makettime; 18 | public String recommend_flag; 19 | public String charge_edt; 20 | public String charge_email; 21 | public String last_update_date; 22 | public String web_url; 23 | public String read_num; 24 | public String guide_word; 25 | public String audio; 26 | public String anchor; 27 | public String cover; 28 | public String content_bgcolor; 29 | public String cover_media_type; 30 | public String cover_media_file; 31 | public String start_video; 32 | public String copyright; 33 | public Author answerer; 34 | public Author asker; 35 | public List author_list = null; 36 | public List asker_list = null; 37 | public Integer next_id; 38 | public String previous_id; 39 | public List tag_list = null; 40 | public ShareList share_list; 41 | public Integer praisenum; 42 | public Integer sharenum; 43 | public Integer commentnum; 44 | 45 | 46 | } 47 | -------------------------------------------------------------------------------- /app/src/main/java/com/liuzh/one/bean/read/Read.java: -------------------------------------------------------------------------------- 1 | 2 | package com.liuzh.one.bean.read; 3 | 4 | public class Read { 5 | 6 | public Integer res; 7 | public ReadData data; 8 | 9 | 10 | } 11 | -------------------------------------------------------------------------------- /app/src/main/java/com/liuzh/one/bean/read/ReadData.java: -------------------------------------------------------------------------------- 1 | 2 | package com.liuzh.one.bean.read; 3 | 4 | import com.liuzh.one.bean.Author; 5 | import com.liuzh.one.bean.ShareList; 6 | import com.liuzh.one.bean.Tag; 7 | 8 | import java.util.List; 9 | 10 | public class ReadData { 11 | 12 | public String content_id; 13 | public String hp_title; 14 | public String sub_title; 15 | public String hp_author; 16 | public String auth_it; 17 | public String hp_author_introduce; 18 | public String hp_content; 19 | public String hp_makettime; 20 | public String hide_flag; 21 | public String wb_name; 22 | public String wb_img_url; 23 | public String last_update_date; 24 | public String web_url; 25 | public String guide_word; 26 | public String audio; 27 | public String anchor; 28 | public String editor_email; 29 | public String top_media_type; 30 | public String top_media_file; 31 | public String top_media_image; 32 | public String start_video; 33 | public String copyright; 34 | public List author = null; 35 | public String maketime; 36 | public List author_list = null; 37 | public String next_id; 38 | public String previous_id; 39 | public List tag_list = null; 40 | public ShareList share_list; 41 | public Integer praisenum; 42 | public Integer sharenum; 43 | public Integer commentnum; 44 | 45 | } 46 | -------------------------------------------------------------------------------- /app/src/main/java/com/liuzh/one/dialog/MovieProfilePopupWindow.java: -------------------------------------------------------------------------------- 1 | package com.liuzh.one.dialog; 2 | 3 | import android.content.Context; 4 | import android.view.View; 5 | import android.view.ViewGroup; 6 | import android.widget.ImageView; 7 | import android.widget.LinearLayout; 8 | import android.widget.PopupWindow; 9 | import android.widget.TextView; 10 | 11 | import com.liuzh.one.R; 12 | import com.squareup.picasso.Picasso; 13 | 14 | /** 15 | * Created by 刘晓彬 on 2017/4/9. 16 | */ 17 | 18 | public class MovieProfilePopupWindow extends PopupWindow { 19 | private ImageView mIvPoster; 20 | private TextView mTvMovieName; 21 | private TextView mTvDesc; 22 | private TextView mTvInfo; 23 | private TextView mTvOfficialStory; 24 | private LinearLayout mLlContent; 25 | 26 | public MovieProfilePopupWindow(View contentView) { 27 | super(contentView, ViewGroup.LayoutParams.MATCH_PARENT, 28 | ViewGroup.LayoutParams.MATCH_PARENT); 29 | mTvMovieName = ((TextView) contentView.findViewById(R.id.tv_movie_name)); 30 | mIvPoster = (ImageView) contentView.findViewById(R.id.iv_poster); 31 | mTvDesc = ((TextView) contentView.findViewById(R.id.tv_desc)); 32 | mTvInfo = ((TextView) contentView.findViewById(R.id.tv_info)); 33 | mTvOfficialStory = ((TextView) contentView.findViewById(R.id.tv_official_story)); 34 | mLlContent = (LinearLayout) contentView.findViewById(R.id.ll_content); 35 | this.setAnimationStyle(R.style.PopupWindowAnimationRight); 36 | } 37 | 38 | public void initData(Context context, String name, String url, 39 | String desc, String info, String official_story) { 40 | mTvMovieName.setText(name); 41 | mTvDesc.setText(desc); 42 | mTvInfo.setText(info); 43 | mTvOfficialStory.setText(official_story); 44 | mLlContent.setOnClickListener(new View.OnClickListener() { 45 | @Override 46 | public void onClick(View view) { 47 | dismiss(); 48 | } 49 | }); 50 | Picasso.with(context) 51 | .load(url) 52 | .into(mIvPoster); 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /app/src/main/java/com/liuzh/one/dialog/OneImgPopupWindow.java: -------------------------------------------------------------------------------- 1 | package com.liuzh.one.dialog; 2 | 3 | import android.app.Activity; 4 | import android.content.Context; 5 | import android.support.design.widget.Snackbar; 6 | import android.view.View; 7 | import android.view.ViewGroup; 8 | import android.widget.ImageView; 9 | import android.widget.PopupWindow; 10 | import android.widget.TextView; 11 | 12 | import com.liuzh.one.R; 13 | import com.liuzh.one.utils.DensityUtil; 14 | import com.liuzh.one.utils.FileUtil; 15 | import com.squareup.picasso.Picasso; 16 | 17 | /** 18 | * Created by 刘晓彬 on 2017/4/8. 19 | */ 20 | 21 | public class OneImgPopupWindow extends PopupWindow implements View.OnClickListener { 22 | 23 | private TextView mTvVolume; 24 | private TextView mTvInfo; 25 | private ImageView mIvImg; 26 | 27 | public OneImgPopupWindow(View contentView) { 28 | super(contentView, ViewGroup.LayoutParams.MATCH_PARENT, 29 | ViewGroup.LayoutParams.MATCH_PARENT); 30 | mTvVolume = (TextView) contentView.findViewById(R.id.tv_volume); 31 | mTvInfo = (TextView) contentView.findViewById(R.id.tv_info); 32 | mIvImg = (ImageView) contentView.findViewById(R.id.iv_img); 33 | mIvImg.setOnClickListener(this); 34 | 35 | contentView.setOnClickListener(this); 36 | 37 | this.setAnimationStyle(R.style.PopupWindowAnimationRight); 38 | 39 | } 40 | 41 | public void setData(final Context context, String volume, String info, final String url) { 42 | mTvVolume.setText(volume); 43 | mTvInfo.setText(info); 44 | Picasso.with(context) 45 | .load(url) 46 | .placeholder(R.drawable.one_placeholder) 47 | .into(mIvImg); 48 | int maxWidth = DensityUtil.getWinWidth((Activity) context) - DensityUtil.dip2px(30); 49 | mIvImg.setMaxWidth(maxWidth); 50 | mIvImg.setMinimumWidth(maxWidth); 51 | mIvImg.setMaxHeight(maxWidth * 5); 52 | mIvImg.setOnLongClickListener(new View.OnLongClickListener() { 53 | @Override 54 | public boolean onLongClick(View view) { 55 | Snackbar.make(view.getRootView(), "要保存图片吗", 2000) 56 | .setAction("保存", new View.OnClickListener() { 57 | @Override 58 | public void onClick(View view) { 59 | FileUtil.savePic(context, url); 60 | } 61 | }) 62 | .show(); 63 | return true; 64 | } 65 | }); 66 | } 67 | 68 | @Override 69 | public void onClick(View view) { 70 | if (view == getContentView()) { 71 | dismiss(); 72 | } 73 | } 74 | 75 | } 76 | -------------------------------------------------------------------------------- /app/src/main/java/com/liuzh/one/dialog/SharePopupWindow.java: -------------------------------------------------------------------------------- 1 | package com.liuzh.one.dialog; 2 | 3 | import android.view.View; 4 | import android.view.ViewGroup; 5 | import android.widget.PopupWindow; 6 | 7 | import com.liuzh.one.R; 8 | import com.liuzh.one.application.App; 9 | 10 | /** 11 | * Created by 刘晓彬 on 2017/4/8. 12 | */ 13 | 14 | public class SharePopupWindow extends PopupWindow implements View.OnClickListener { 15 | 16 | private View mContentView; 17 | private View mShareWeichatFriends; 18 | private View mShareWeichat; 19 | private View mShareQQ; 20 | private View mShareWeibo; 21 | private View mShareUrl; 22 | 23 | public SharePopupWindow(View contentView) { 24 | super(contentView, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); 25 | mContentView = contentView; 26 | mShareWeichatFriends = mContentView.findViewById(R.id.iv_share_friends); 27 | mShareWeichat = mContentView.findViewById(R.id.iv_share_weichat); 28 | mShareQQ = mContentView.findViewById(R.id.iv_share_qq); 29 | mShareWeibo = mContentView.findViewById(R.id.iv_share_weibo); 30 | mShareUrl = mContentView.findViewById(R.id.iv_share_url); 31 | 32 | mShareWeichatFriends.setOnClickListener(this); 33 | mShareWeichat.setOnClickListener(this); 34 | mShareQQ.setOnClickListener(this); 35 | mShareWeibo.setOnClickListener(this); 36 | mShareUrl.setOnClickListener(this); 37 | mContentView.setOnClickListener(this); 38 | 39 | 40 | this.setAnimationStyle(R.style.PopupWindowAnimationBottom); 41 | } 42 | 43 | 44 | @Override 45 | public void onClick(View view) { 46 | if (view != mContentView) { 47 | App.showToast("分享"); 48 | } 49 | dismiss(); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /app/src/main/java/com/liuzh/one/fragment/BaseFragment.java: -------------------------------------------------------------------------------- 1 | package com.liuzh.one.fragment; 2 | 3 | import android.os.Bundle; 4 | import android.support.annotation.Nullable; 5 | import android.support.v4.app.Fragment; 6 | import android.view.LayoutInflater; 7 | import android.view.View; 8 | import android.view.ViewGroup; 9 | 10 | import com.liuzh.one.utils.DensityUtil; 11 | 12 | /** 13 | * base fragment 14 | * Created by 刘晓彬 on 2017/4/6. 15 | */ 16 | 17 | public abstract class BaseFragment extends Fragment { 18 | 19 | private View mRootView; 20 | 21 | @Nullable 22 | @Override 23 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, 24 | @Nullable Bundle savedInstanceState) { 25 | if (mRootView == null) { 26 | mRootView = inflater.inflate(getRootViewId(), null); 27 | initView(mRootView); 28 | initData(); 29 | } 30 | return mRootView; 31 | } 32 | 33 | protected abstract void initData(); 34 | 35 | protected abstract void initView(View rootView); 36 | 37 | protected abstract int getRootViewId(); 38 | 39 | } 40 | -------------------------------------------------------------------------------- /app/src/main/java/com/liuzh/one/fragment/HomeFragment.java: -------------------------------------------------------------------------------- 1 | package com.liuzh.one.fragment; 2 | 3 | import android.os.Bundle; 4 | import android.support.v4.app.Fragment; 5 | import android.support.v4.app.FragmentPagerAdapter; 6 | import android.support.v4.view.ViewPager; 7 | import android.view.View; 8 | 9 | import com.liuzh.one.R; 10 | import com.liuzh.one.activity.MainActivity; 11 | 12 | import java.util.ArrayList; 13 | import java.util.List; 14 | 15 | /** 16 | * homeFragment 17 | * Created by 刘晓彬 on 2017/3/16. 18 | */ 19 | 20 | public class HomeFragment extends BaseFragment { 21 | private ViewPager mViewPager;//viewpager 22 | private ArrayList mFragments;//all fragment 23 | private FragmentPagerAdapter mPagerAdapter;//adapter 24 | private List mIdList;//one ids 25 | private MainActivity mMainActivity; 26 | private String[] mDayArr; 27 | 28 | @Override 29 | protected int getRootViewId() { 30 | return R.layout.fragment_home; 31 | } 32 | 33 | @Override 34 | public void onCreate(Bundle savedInstanceState) { 35 | super.onCreate(savedInstanceState); 36 | mMainActivity = (MainActivity) getActivity(); 37 | mDayArr = getResources().getStringArray(R.array.day); 38 | initFragments(); 39 | } 40 | 41 | /** 42 | * init fragments 43 | */ 44 | private void initFragments() { 45 | //从依附的activity的intent中取一天的list id 46 | mIdList = mMainActivity.getListId(); 47 | //创建2个fragment,其余fragment通过view pager滑动监听来动态创建 48 | mFragments = new ArrayList<>(); 49 | for (int i = 0; i < 2; i++) { 50 | int id = Integer.valueOf(mIdList.get(i)); 51 | OneContentFragment fragment = new OneContentFragment(id); 52 | mFragments.add(fragment); 53 | } 54 | } 55 | 56 | /** 57 | * 当前fragment: 58 | * 被隐藏的时候:停止当前ContentFragment中的RecycleView的滚动(防止toolbar的显示异常) 59 | * 被显示的时候:设置toolbar显示状态、设置toolbar的title 60 | * 61 | * @param hidden 是否隐藏 62 | */ 63 | @Override 64 | public void onHiddenChanged(boolean hidden) { 65 | super.onHiddenChanged(hidden); 66 | int pos = mViewPager.getCurrentItem(); 67 | if (hidden) { 68 | mFragments.get(pos).stopRvScroll(); 69 | } else { 70 | mFragments.get(pos).controlToolbarVisibility(); 71 | mMainActivity.setToolbarTitle(mDayArr[pos]); 72 | } 73 | } 74 | 75 | @Override 76 | protected void initView(View rootView) { 77 | mViewPager = (ViewPager) rootView.findViewById(R.id.viewPager); 78 | } 79 | 80 | @Override 81 | protected void initData() { 82 | mPagerAdapter = new FragmentPagerAdapter(getChildFragmentManager()) { 83 | @Override 84 | public int getCount() { 85 | return mFragments.size(); 86 | } 87 | 88 | @Override 89 | public Fragment getItem(int position) { 90 | return mFragments.get(position); 91 | } 92 | }; 93 | mViewPager.setAdapter(mPagerAdapter); 94 | /*设置pager切换动画后,在4.1.2有奇怪的问题 95 | * 滑动当前页,实际滑动的是下一页*/ 96 | mViewPager.setPageTransformer(true, new DepthPageTransformer()); 97 | mViewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() { 98 | @Override 99 | public void onPageScrolled(int position, float positionOffset, 100 | int positionOffsetPixels) { 101 | } 102 | 103 | @Override 104 | public void onPageSelected(int position) { 105 | mMainActivity.setToolbarTitle(mDayArr[position]); 106 | //如果当前页是最后一页则新建下一页的fragment 107 | if (position == mFragments.size() - 1 108 | && position != mIdList.size() - 1) { 109 | int id = Integer.valueOf(mIdList.get(position + 1)); 110 | OneContentFragment fragment = new OneContentFragment(id); 111 | mFragments.add(fragment); 112 | mPagerAdapter.notifyDataSetChanged(); 113 | } 114 | mFragments.get(position).controlToolbarVisibility(); 115 | } 116 | 117 | @Override 118 | public void onPageScrollStateChanged(int state) { 119 | } 120 | }); 121 | } 122 | 123 | /** 124 | * viewpager切换动画 125 | * 4.1上有神奇的bug 126 | */ 127 | private class DepthPageTransformer implements ViewPager.PageTransformer { 128 | 129 | public void transformPage(View view, float position) { 130 | if (position <= -1) { // [-Infinity,-1) 131 | view.setAlpha(0); 132 | } else if (position <= 0) { // [-1,0] 133 | view.setAlpha(1); 134 | view.setTranslationX(0); 135 | } else if (position <= 1) { // (0,1] 136 | view.setAlpha(1 - position); 137 | view.setTranslationX(view.getMeasuredWidth() * -position); 138 | } else { // (1,+Infinity] 139 | view.setAlpha(0); 140 | } 141 | } 142 | } 143 | 144 | public boolean currentPagePopIsShowing() { 145 | return mFragments.get(mViewPager.getCurrentItem()).getAdapter().popIsShowing(); 146 | } 147 | public void dismissPop(){ 148 | mFragments.get(mViewPager.getCurrentItem()).getAdapter().dismissPop(); 149 | } 150 | } -------------------------------------------------------------------------------- /app/src/main/java/com/liuzh/one/fragment/ListFragment.java: -------------------------------------------------------------------------------- 1 | package com.liuzh.one.fragment; 2 | 3 | import android.annotation.SuppressLint; 4 | import android.graphics.drawable.AnimationDrawable; 5 | import android.os.Bundle; 6 | import android.support.annotation.Nullable; 7 | import android.support.v7.widget.DividerItemDecoration; 8 | import android.support.v7.widget.LinearLayoutManager; 9 | import android.support.v7.widget.RecyclerView; 10 | import android.view.View; 11 | import android.widget.ImageView; 12 | 13 | import com.liuzh.one.R; 14 | import com.liuzh.one.adapter.ListRvAdapter; 15 | import com.liuzh.one.application.App; 16 | import com.liuzh.one.bean.DataList; 17 | import com.liuzh.one.bean.list.Data; 18 | import com.liuzh.one.utils.DensityUtil; 19 | import com.liuzh.one.utils.RetrofitUtil; 20 | 21 | import retrofit2.Call; 22 | import retrofit2.Callback; 23 | import retrofit2.Response; 24 | 25 | /** 26 | * 展现内容list的fragment,可创建类型:Read、Music、movie 27 | * Created by 刘晓彬 on 2017/3/27. 28 | */ 29 | 30 | public class ListFragment extends BaseFragment { 31 | public static final int TYPE_READ = 0; 32 | public static final int TYPE_MUSIC = 1; 33 | public static final int TYPE_MOVIE = 2; 34 | 35 | private int mType; 36 | 37 | private RecyclerView mRecyclerView; 38 | private ImageView mIvLoading; 39 | 40 | public ListFragment() { 41 | } 42 | 43 | @SuppressLint("ValidFragment") 44 | public ListFragment(int type) { 45 | mType = type; 46 | } 47 | 48 | @Override 49 | protected int getRootViewId() { 50 | return R.layout.fragment_content; 51 | } 52 | 53 | @Override 54 | public void onCreate(@Nullable Bundle savedInstanceState) { 55 | super.onCreate(savedInstanceState); 56 | fetchData(); 57 | } 58 | 59 | @Override 60 | protected void initData() { 61 | mIvLoading.setVisibility(View.VISIBLE); 62 | ((AnimationDrawable) mIvLoading.getDrawable()).start(); 63 | mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext())); 64 | mRecyclerView.addItemDecoration(new DividerItemDecoration( 65 | getActivity(), DividerItemDecoration.VERTICAL)); 66 | } 67 | 68 | @Override 69 | protected void initView(View rootView) { 70 | rootView.setPadding(0, DensityUtil.dip2px(50), 0, 0); 71 | mIvLoading = (ImageView) rootView.findViewById(R.id.iv_loading); 72 | mRecyclerView = (RecyclerView) rootView.findViewById(R.id.recyclerView); 73 | } 74 | 75 | private void fetchData() { 76 | Callback callback = new Callback() { 77 | @Override 78 | public void onResponse(Call call, Response response) { 79 | Data data = new Data(); 80 | data.content_list = response.body().data; 81 | mRecyclerView.setAdapter(new ListRvAdapter(getActivity(), data)); 82 | mIvLoading.setVisibility(View.GONE); 83 | } 84 | 85 | @Override 86 | public void onFailure(Call call, Throwable t) { 87 | App.showToast("失败,再次链接"); 88 | fetchData(); 89 | } 90 | }; 91 | 92 | Call call; 93 | switch (mType) { 94 | case TYPE_READ: 95 | call = RetrofitUtil.getReadListCall(); 96 | break; 97 | case TYPE_MUSIC: 98 | call = RetrofitUtil.getMusicListCall(); 99 | break; 100 | case TYPE_MOVIE: 101 | call = RetrofitUtil.getMovieListCall(); 102 | break; 103 | default: 104 | App.showToast("Error:ListFragment type error"); 105 | return; 106 | } 107 | call.enqueue(callback); 108 | } 109 | 110 | } -------------------------------------------------------------------------------- /app/src/main/java/com/liuzh/one/fragment/OneContentFragment.java: -------------------------------------------------------------------------------- 1 | package com.liuzh.one.fragment; 2 | 3 | import android.annotation.SuppressLint; 4 | import android.graphics.drawable.AnimationDrawable; 5 | import android.os.Bundle; 6 | import android.support.annotation.Nullable; 7 | import android.support.v7.widget.DividerItemDecoration; 8 | import android.support.v7.widget.LinearLayoutManager; 9 | import android.view.View; 10 | import android.widget.ImageView; 11 | 12 | import com.liuzh.one.R; 13 | import com.liuzh.one.activity.MainActivity; 14 | import com.liuzh.one.adapter.ListRvAdapter; 15 | import com.liuzh.one.application.App; 16 | import com.liuzh.one.bean.list.OneDay; 17 | import com.liuzh.one.utils.RetrofitUtil; 18 | import com.liuzh.one.view.ScrollRecyclerView; 19 | 20 | import retrofit2.Call; 21 | import retrofit2.Callback; 22 | import retrofit2.Response; 23 | 24 | /** 25 | * HomeFragment中viewpager控制滑动的fragment 26 | * Created by 刘晓彬 on 2017/3/20. 27 | */ 28 | 29 | public class OneContentFragment extends BaseFragment { 30 | private int mID;//fragment对应的one list的id 31 | private ScrollRecyclerView mRecyclerView;//recycler view 32 | private ImageView mIvLoading; 33 | private Call mCall; 34 | private MainActivity mMainActivity; 35 | 36 | public OneContentFragment() { 37 | } 38 | 39 | @SuppressLint("ValidFragment") 40 | public OneContentFragment(int id) { 41 | this.mID = id; 42 | } 43 | 44 | @Override 45 | protected int getRootViewId() { 46 | return R.layout.fragment_content; 47 | } 48 | 49 | @Override 50 | public void onCreate(@Nullable Bundle savedInstanceState) { 51 | super.onCreate(savedInstanceState); 52 | mMainActivity = (MainActivity) getActivity(); 53 | fetchOneList(); 54 | } 55 | 56 | @Override 57 | protected void initView(View rootView) { 58 | mRecyclerView = (ScrollRecyclerView) rootView.findViewById(R.id.recyclerView); 59 | mIvLoading = (ImageView) rootView.findViewById(R.id.iv_loading); 60 | 61 | } 62 | 63 | @Override 64 | protected void initData() { 65 | mIvLoading.setVisibility(View.VISIBLE); 66 | ((AnimationDrawable) mIvLoading.getDrawable()).start(); 67 | 68 | mRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity())); 69 | 70 | mRecyclerView.setOnTopListener(new ScrollRecyclerView.OnTopListener() { 71 | @Override 72 | public void onTopListener() { 73 | mMainActivity.hideToolbar(); 74 | } 75 | }); 76 | mRecyclerView.setOnLeaveTopListener(new ScrollRecyclerView.OnLeaveTopListener() { 77 | @Override 78 | public void onLeaveTopListener() { 79 | mMainActivity.showToolbar(); 80 | } 81 | }); 82 | 83 | DividerItemDecoration decoration = new DividerItemDecoration( 84 | getActivity(), DividerItemDecoration.VERTICAL); 85 | mRecyclerView.addItemDecoration(decoration); 86 | 87 | } 88 | 89 | 90 | /** 91 | * 控制toolbar的显示隐藏 92 | * 如果recycleView滑动在顶部,则隐藏 93 | * 其余情况显示 94 | */ 95 | public void controlToolbarVisibility() { 96 | boolean inTop = mRecyclerView.isInTop(); 97 | if (inTop) { 98 | mMainActivity.hideToolbar(); 99 | } else { 100 | mMainActivity.showToolbar(); 101 | } 102 | } 103 | 104 | /** 105 | * 获取oneList数据 106 | */ 107 | private void fetchOneList() { 108 | mCall = RetrofitUtil.getOneListCall(mID); 109 | mCall.enqueue(new Callback() { 110 | @Override 111 | public void onResponse(Call call, Response response) { 112 | ListRvAdapter adapter = 113 | new ListRvAdapter(getActivity(), response.body().data); 114 | mRecyclerView.setAdapter(adapter); 115 | mIvLoading.setVisibility(View.GONE); 116 | } 117 | 118 | @Override 119 | public void onFailure(Call call, Throwable t) { 120 | App.showToast("失败,再次尝试"); 121 | fetchOneList(); 122 | } 123 | }); 124 | } 125 | 126 | /** 127 | * 停止recycleView的滚动 128 | */ 129 | public void stopRvScroll() { 130 | mRecyclerView.stopScroll(); 131 | } 132 | 133 | public ListRvAdapter getAdapter() { 134 | return (ListRvAdapter) mRecyclerView.getAdapter(); 135 | } 136 | } 137 | -------------------------------------------------------------------------------- /app/src/main/java/com/liuzh/one/utils/BitmapUtil.java: -------------------------------------------------------------------------------- 1 | package com.liuzh.one.utils; 2 | 3 | import android.graphics.Bitmap; 4 | import android.graphics.BitmapShader; 5 | import android.graphics.Canvas; 6 | import android.graphics.Paint; 7 | 8 | /** 9 | * bitmap工具类 10 | * Created by LiuZh on 2017/3/15. 11 | */ 12 | 13 | public class BitmapUtil { 14 | 15 | /** 16 | * 生成一个圆形的图片 17 | * 18 | * @param src 原图片 19 | * @return 圆形图片 20 | */ 21 | public static Bitmap createCircleBitmap(Bitmap src) { 22 | int size = Math.min(src.getWidth(), src.getHeight()); 23 | 24 | int x = (src.getWidth() - size) / 2; 25 | int y = (src.getHeight() - size) / 2; 26 | 27 | Bitmap squaredBitmap = Bitmap.createBitmap(src, x, y, size, size); 28 | if (squaredBitmap != src) { 29 | src.recycle(); 30 | } 31 | 32 | Bitmap bitmap = Bitmap.createBitmap(size, size, src.getConfig()); 33 | 34 | if (bitmap == null) { 35 | return src; 36 | } 37 | Canvas canvas = new Canvas(bitmap); 38 | Paint paint = new Paint(); 39 | BitmapShader shader = new BitmapShader(squaredBitmap, 40 | BitmapShader.TileMode.CLAMP, BitmapShader.TileMode.CLAMP); 41 | paint.setShader(shader); 42 | paint.setAntiAlias(true); 43 | 44 | float r = size / 2f; 45 | canvas.drawCircle(r, r, r, paint); 46 | 47 | squaredBitmap.recycle(); 48 | return bitmap; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /app/src/main/java/com/liuzh/one/utils/CircleTransform.java: -------------------------------------------------------------------------------- 1 | package com.liuzh.one.utils; 2 | 3 | import android.graphics.Bitmap; 4 | 5 | import com.squareup.picasso.Transformation; 6 | 7 | /** 8 | * Picasso裁切圆形图 9 | * Created by 刘晓彬 on 2017/3/21. 10 | */ 11 | 12 | public class CircleTransform implements Transformation { 13 | 14 | @Override 15 | public Bitmap transform(Bitmap source) { 16 | return BitmapUtil.createCircleBitmap(source); 17 | } 18 | 19 | @Override 20 | public String key() { 21 | return "circle"; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /app/src/main/java/com/liuzh/one/utils/Constant.java: -------------------------------------------------------------------------------- 1 | package com.liuzh.one.utils; 2 | 3 | /** 4 | * 常量 5 | * Created by 刘晓彬 on 2017/3/19. 6 | */ 7 | 8 | public class Constant { 9 | //intent key : id 10 | public static final String INTENT_KEY_ID = "intent_key_id"; 11 | //intent key : like count 12 | public static final String INTENT_KEY_LIKE_COUNT = "intent_key_like_count"; 13 | //intent key : title 14 | public static final String INTENT_KEY_TITLE = "intent_key_title"; 15 | //intent key : url 16 | public static final String INTENT_KEY_URL = "intent_key_url"; 17 | //intent key : list id 18 | public static final String INTENT_KEY_LIST_ID = "intent_key_list_id"; 19 | //intent key : author 20 | public static final String INTENT_KEY_AUTHOR = "intent_key_author"; 21 | /** 22 | * -1 下拉刷新head 23 | * -2 上拉加载bottom 24 | * 0 one day 25 | * 1 read 软糖漫画 26 | * 2 连载 27 | * 3 问答 28 | * 4 音乐 29 | * 5 影视 30 | */ 31 | public static final int ITEM_TYPE_HEAD = -1; 32 | public static final int ITEM_TYPE_BOTTOM = -2; 33 | public static final int ITEM_TYPE_DAY_ONE = 0; 34 | public static final int ITEM_TYPE_READ_CARTOON = 1; 35 | public static final int ITEM_TYPE_SERIAL = 2; 36 | public static final int ITEM_TYPE_QUESTION = 3; 37 | public static final int ITEM_TYPE_MUSIC = 4; 38 | public static final int ITEM_TYPE_MOVIE = 5; 39 | } 40 | -------------------------------------------------------------------------------- /app/src/main/java/com/liuzh/one/utils/DateUtil.java: -------------------------------------------------------------------------------- 1 | package com.liuzh.one.utils; 2 | 3 | import java.text.SimpleDateFormat; 4 | import java.util.Date; 5 | 6 | /** 7 | * 日期的工具类 8 | * Created by 刘晓彬 on 2017/3/19. 9 | */ 10 | 11 | public class DateUtil { 12 | /** 13 | * 获取格式化后的年月日 14 | * 15 | * @return 格式化后的年月日 16 | */ 17 | public static String getFmtYMD() { 18 | SimpleDateFormat sdf = new SimpleDateFormat("yy / MM / dd"); 19 | return sdf.format(new Date()); 20 | } 21 | 22 | public static String getFormatYMDHMS() { 23 | SimpleDateFormat sdf = new SimpleDateFormat("yy / MM / dd hh:mm:ss"); 24 | return sdf.format(new Date()); 25 | } 26 | 27 | /** 28 | * 获取小时数 29 | * 30 | * @return 小时数 31 | */ 32 | public static String getFmtH() { 33 | SimpleDateFormat sdf = new SimpleDateFormat("hh"); 34 | return sdf.format(new Date()); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /app/src/main/java/com/liuzh/one/utils/DensityUtil.java: -------------------------------------------------------------------------------- 1 | package com.liuzh.one.utils; 2 | 3 | import android.app.Activity; 4 | import android.util.DisplayMetrics; 5 | import android.view.Display; 6 | 7 | import com.liuzh.one.application.App; 8 | 9 | /** 10 | * 分辨率相关工具类 11 | * Created by 刘晓彬 on 2017/3/21. 12 | */ 13 | 14 | public class DensityUtil { 15 | 16 | /** 17 | * 根据手机的分辨率从 dp 的单位 转成为 px(像素) 18 | */ 19 | public static int dip2px(float dpValue) { 20 | final float scale = App.getContext().getResources().getDisplayMetrics().density; 21 | return (int) (dpValue * scale + 0.5f); 22 | } 23 | 24 | /** 25 | * 根据手机的分辨率从 px(像素) 的单位 转成为 dp 26 | */ 27 | public static int px2dip(float pxValue) { 28 | final float scale = App.getContext().getResources().getDisplayMetrics().density; 29 | return (int) (pxValue / scale + 0.5f); 30 | } 31 | 32 | /** 33 | * 获取屏幕的宽 34 | * 35 | * @param activity activity 36 | * @return 宽度 px 37 | */ 38 | public static int getWinWidth(Activity activity) { 39 | Display d = activity.getWindowManager().getDefaultDisplay(); 40 | DisplayMetrics dm = new DisplayMetrics(); 41 | d.getMetrics(dm); 42 | return dm.widthPixels; 43 | } 44 | 45 | /** 46 | * 获取屏幕的高 47 | * 48 | * @param activity activity 49 | * @return 高度 px 50 | */ 51 | public static int getWinHeight(Activity activity) { 52 | Display d = activity.getWindowManager().getDefaultDisplay(); 53 | DisplayMetrics dm = new DisplayMetrics(); 54 | d.getMetrics(dm); 55 | return dm.heightPixels; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /app/src/main/java/com/liuzh/one/utils/FileUtil.java: -------------------------------------------------------------------------------- 1 | package com.liuzh.one.utils; 2 | 3 | import android.Manifest; 4 | import android.app.Activity; 5 | import android.content.Context; 6 | import android.content.pm.PackageManager; 7 | import android.graphics.Bitmap; 8 | import android.graphics.drawable.Drawable; 9 | import android.os.AsyncTask; 10 | import android.os.Build; 11 | import android.os.Environment; 12 | import android.support.v4.app.ActivityCompat; 13 | import android.support.v4.content.ContextCompat; 14 | import android.util.Log; 15 | 16 | import com.liuzh.one.application.App; 17 | import com.squareup.picasso.Picasso; 18 | import com.squareup.picasso.Target; 19 | 20 | import java.io.File; 21 | import java.io.FileOutputStream; 22 | import java.io.IOException; 23 | 24 | /** 25 | * Created by 刘晓彬 on 2017/4/9. 26 | */ 27 | 28 | public class FileUtil { 29 | private static final String TAG = "FileUtil"; 30 | public static void savePic(final Context context, String url) { 31 | if (Build.VERSION.SDK_INT >= 23) { 32 | int checkPermission = ContextCompat.checkSelfPermission(context, 33 | Manifest.permission.WRITE_EXTERNAL_STORAGE); 34 | if (checkPermission != PackageManager.PERMISSION_GRANTED) { 35 | ActivityCompat.requestPermissions((Activity) context, 36 | new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, 111); 37 | return; 38 | } 39 | } 40 | Target target = new Target() { 41 | @Override 42 | public void onBitmapLoaded(final Bitmap bitmap, Picasso.LoadedFrom from) { 43 | Log.i(TAG, "onBitmapLoaded: " + Thread.currentThread()); 44 | //事实证明这里是在主线程执行的,改吧,改到子线程去做 45 | //暂时为了方便,不用框架和麻烦的写法,直接new一个线程吧 46 | //也不行,这样没办法弹出Toast 47 | //那就new AsyncTask吧 48 | new AsyncTask(){ 49 | @Override 50 | protected Void doInBackground(Void... voids) { 51 | String fileName = System.currentTimeMillis() + ".png"; 52 | File dir = new File(getOnePath()); 53 | if (!dir.exists()) { 54 | dir.mkdirs(); 55 | } 56 | File file = new File(getOnePath() + "/" + fileName); 57 | FileOutputStream os; 58 | try { 59 | file.createNewFile(); 60 | os = new FileOutputStream(file); 61 | bitmap.compress(Bitmap.CompressFormat.PNG, 100, os); 62 | os.close(); 63 | } catch (IOException e) { 64 | e.printStackTrace(); 65 | } 66 | return null; 67 | } 68 | 69 | @Override 70 | protected void onPostExecute(Void aVoid) { 71 | super.onPostExecute(aVoid); 72 | App.showToast("图片保存路径:SD卡/ONE/"); 73 | } 74 | }.execute(); 75 | 76 | } 77 | 78 | @Override 79 | public void onBitmapFailed(Drawable errorDrawable) { 80 | 81 | } 82 | 83 | @Override 84 | public void onPrepareLoad(Drawable placeHolderDrawable) { 85 | 86 | } 87 | }; 88 | 89 | Picasso.with(context) 90 | .load(url) 91 | .into(target); 92 | } 93 | 94 | public static String getOnePath() { 95 | return Environment.getExternalStorageDirectory() + "/ONE"; 96 | } 97 | 98 | } 99 | -------------------------------------------------------------------------------- /app/src/main/java/com/liuzh/one/utils/HtmlFmtUtil.java: -------------------------------------------------------------------------------- 1 | package com.liuzh.one.utils; 2 | 3 | import java.util.regex.Matcher; 4 | import java.util.regex.Pattern; 5 | 6 | /** 7 | * Created by 刘晓彬 on 2017/3/24. 8 | */ 9 | 10 | public class HtmlFmtUtil { 11 | 12 | public static String fmt(String str) { 13 | //用正则将img的style置为空 14 | Pattern pattern = Pattern.compile("style=\"([^\"]+)\""); 15 | Matcher matcher = pattern.matcher(str); 16 | str = matcher.replaceAll(""); 17 | 18 | return "" + 19 | "" + 20 | "" + 21 | "Sign in | Score System" + 22 | "" + 26 | "" + 27 | "" + 28 | str + 29 | "" + 30 | ""; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /app/src/main/java/com/liuzh/one/utils/SPUtil.java: -------------------------------------------------------------------------------- 1 | package com.liuzh.one.utils; 2 | 3 | import android.content.SharedPreferences; 4 | 5 | import com.liuzh.one.application.App; 6 | 7 | /** 8 | * SharedPreferences 工具类 9 | * Created by 刘晓彬 on 2017/3/19. 10 | */ 11 | 12 | public class SPUtil { 13 | //one list id的key 14 | public static final String SP_KEY_ONE_LIST_ID = "one_list_id"; 15 | //打开应用时间的key 16 | public static final String SP_KEY_OPEN_DATE = "open_date"; 17 | 18 | 19 | private static SharedPreferences getSP() { 20 | return App.getContext().getSharedPreferences( 21 | App.getContext().getPackageName(), App.MODE_PRIVATE); 22 | } 23 | 24 | 25 | public static void putString(String key, String value) { 26 | SharedPreferences.Editor editor = getSP().edit(); 27 | editor.putString(key, value); 28 | editor.apply(); 29 | } 30 | 31 | 32 | public static void putBoolean(String key, boolean value) { 33 | SharedPreferences.Editor editor = getSP().edit(); 34 | editor.putBoolean(key, value); 35 | editor.apply(); 36 | } 37 | 38 | 39 | public static void putInt(String key, int value) { 40 | SharedPreferences.Editor editor = getSP().edit(); 41 | editor.putInt(key, value); 42 | editor.apply(); 43 | } 44 | 45 | 46 | public static String getString(String key, String defValue) { 47 | return getSP().getString(key, defValue); 48 | } 49 | 50 | 51 | public static boolean getBoolean(String key, boolean defValue) { 52 | return getSP().getBoolean(key, defValue); 53 | } 54 | 55 | 56 | public static int getInt(String key, int defValue) { 57 | return getSP().getInt(key, defValue); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /app/src/main/java/com/liuzh/one/view/AppToolbar.java: -------------------------------------------------------------------------------- 1 | package com.liuzh.one.view; 2 | 3 | import android.content.Context; 4 | import android.support.annotation.Nullable; 5 | import android.support.v7.widget.Toolbar; 6 | import android.util.AttributeSet; 7 | import android.view.Gravity; 8 | import android.view.LayoutInflater; 9 | import android.view.View; 10 | import android.widget.ImageView; 11 | import android.widget.TextView; 12 | 13 | import com.liuzh.one.R; 14 | import com.liuzh.one.dialog.SharePopupWindow; 15 | 16 | /** 17 | * 自定义的Toolbar 18 | * Created by 刘晓彬 on 2017/3/23. 19 | */ 20 | 21 | public class AppToolbar extends Toolbar { 22 | 23 | private ImageView mIvLBtn; 24 | private ImageView mIvRLBtn; 25 | private ImageView mIvRRBtn; 26 | private TextView mTvTitle; 27 | private Context mContext; 28 | private SharePopupWindow mShareWindow; 29 | 30 | public AppToolbar(Context context) { 31 | this(context, null, 0); 32 | } 33 | 34 | public AppToolbar(Context context, @Nullable AttributeSet attrs) { 35 | this(context, attrs, 0); 36 | } 37 | 38 | public AppToolbar(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { 39 | super(context, attrs, defStyleAttr); 40 | init(context); 41 | } 42 | 43 | private void init(Context context) { 44 | mContext = context; 45 | View view = View.inflate(context, R.layout.layout_toolbar_content, this); 46 | mIvLBtn = (ImageView) view.findViewById(R.id.iv_toolbar_left); 47 | mTvTitle = (TextView) view.findViewById(R.id.tv_toolbar_title); 48 | mIvRLBtn = (ImageView) view.findViewById(R.id.iv_toolbar_right_l); 49 | mIvRRBtn = (ImageView) findViewById(R.id.iv_toolbar_right_r); 50 | setBackgroundResource(R.color.toolbar); 51 | } 52 | 53 | @Override 54 | protected void onLayout(boolean changed, int l, int t, int r, int b) { 55 | super.onLayout(changed, l, t, r, b); 56 | setPadding(0, 0, 0, 0); 57 | } 58 | 59 | public void setToolbarTitle(String title) { 60 | mTvTitle.setText(title); 61 | } 62 | 63 | public void setLBtnDrawable(int resId) { 64 | mIvLBtn.setImageResource(resId); 65 | } 66 | 67 | public void setLBtnClickListener(OnClickListener listener) { 68 | mIvLBtn.setOnClickListener(listener); 69 | } 70 | 71 | public void setRLDrawable(int resId) { 72 | mIvRLBtn.setImageResource(resId); 73 | } 74 | 75 | public void setRLClickListener(OnClickListener listener) { 76 | mIvRLBtn.setOnClickListener(listener); 77 | } 78 | 79 | public void setRRDrawable(int resId) { 80 | mIvRRBtn.setImageResource(resId); 81 | } 82 | 83 | public void setRRClickListener(OnClickListener listener) { 84 | mIvRRBtn.setOnClickListener(listener); 85 | } 86 | 87 | public void initShareListener(final View parent) { 88 | mIvRRBtn.setOnClickListener(new OnClickListener() { 89 | @Override 90 | public void onClick(View view) { 91 | if (mShareWindow == null) { 92 | View contentView = LayoutInflater.from(mContext) 93 | .inflate(R.layout.layout_popup_share, null); 94 | mShareWindow = new SharePopupWindow(contentView); 95 | } 96 | if (mShareWindow.isShowing()) { 97 | mShareWindow.dismiss(); 98 | } else { 99 | mShareWindow.showAtLocation(parent, Gravity.BOTTOM, 0, 0); 100 | } 101 | } 102 | }); 103 | } 104 | 105 | public boolean popIsShowing() { 106 | return mShareWindow != null && mShareWindow.isShowing(); 107 | } 108 | 109 | public void dismissPop(){ 110 | mShareWindow.dismiss(); 111 | } 112 | 113 | public TextView getTvTitle() { 114 | return mTvTitle; 115 | } 116 | } 117 | -------------------------------------------------------------------------------- /app/src/main/java/com/liuzh/one/view/AuthorsView.java: -------------------------------------------------------------------------------- 1 | package com.liuzh.one.view; 2 | 3 | import android.content.Context; 4 | import android.support.annotation.Nullable; 5 | import android.util.AttributeSet; 6 | import android.view.View; 7 | import android.widget.FrameLayout; 8 | import android.widget.LinearLayout; 9 | import android.widget.TextView; 10 | 11 | import com.liuzh.one.R; 12 | import com.liuzh.one.activity.AuthorActivity; 13 | import com.liuzh.one.application.App; 14 | import com.liuzh.one.bean.Author; 15 | import com.squareup.picasso.Picasso; 16 | 17 | import java.util.List; 18 | 19 | import de.hdodenhof.circleimageview.CircleImageView; 20 | 21 | /** 22 | * 作者列表view 23 | * Created by 刘晓彬 on 2017/3/23. 24 | */ 25 | 26 | public class AuthorsView extends FrameLayout { 27 | private static final String TAG = "AuthorsView"; 28 | private LinearLayout ll_authors; 29 | private Context mContext; 30 | 31 | public AuthorsView(Context context) { 32 | this(context, null, 0); 33 | } 34 | 35 | public AuthorsView(Context context, @Nullable AttributeSet attrs) { 36 | this(context, attrs, 0); 37 | } 38 | 39 | public AuthorsView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { 40 | super(context, attrs, defStyleAttr); 41 | View.inflate(context, R.layout.layout_detail_authors, this); 42 | ll_authors = (LinearLayout) findViewById(R.id.ll_authors); 43 | mContext = context; 44 | } 45 | 46 | /** 47 | * 设置作者列表 48 | * 49 | * @param authors 作者list 50 | */ 51 | public void setAuthors(List authors) { 52 | if (authors.size() == 0) { 53 | this.setVisibility(GONE); 54 | return; 55 | } 56 | int count = 0; 57 | for (int i = 0; i < authors.size(); i++) { 58 | final Author author = authors.get(i); 59 | if (author.user_id.equals("0")) { 60 | continue; 61 | } 62 | View authorView = View.inflate(mContext, R.layout.layout_author, null); 63 | CircleImageView civHead = (CircleImageView) authorView.findViewById(R.id.iv_head); 64 | TextView tvAuthorName = (TextView) authorView.findViewById(R.id.tv_author_name); 65 | TextView tvAuthorSummary = (TextView) authorView.findViewById(R.id.tv_summary); 66 | TextView tvAuthorWbName = (TextView) authorView.findViewById(R.id.tv_wb_name); 67 | TextView tvFollowBtn = (TextView) authorView.findViewById(R.id.tv_follow); 68 | Picasso.with(mContext) 69 | .load(author.web_url) 70 | .placeholder(R.mipmap.ic_launcher) 71 | .into(civHead); 72 | tvAuthorName.setText(author.user_name); 73 | tvAuthorSummary.setText(author.summary); 74 | tvAuthorWbName.setText(author.wb_name); 75 | authorView.setOnClickListener(new OnClickListener() { 76 | @Override 77 | public void onClick(View view) { 78 | AuthorActivity.start(mContext, author); 79 | } 80 | }); 81 | tvFollowBtn.setOnClickListener(new OnClickListener() { 82 | @Override 83 | public void onClick(View view) { 84 | App.showToast("关注"); 85 | } 86 | }); 87 | ll_authors.addView(authorView); 88 | count++; 89 | } 90 | if (count == 0) { 91 | this.setVisibility(GONE); 92 | } 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /app/src/main/java/com/liuzh/one/view/ScrollRecyclerView.java: -------------------------------------------------------------------------------- 1 | package com.liuzh.one.view; 2 | 3 | import android.content.Context; 4 | import android.support.annotation.Nullable; 5 | import android.support.v7.widget.RecyclerView; 6 | import android.util.AttributeSet; 7 | import android.view.View; 8 | 9 | /** 10 | * Created by 刘晓彬 on 2017/4/6. 11 | */ 12 | 13 | public class ScrollRecyclerView extends RecyclerView { 14 | private static final String TAG = "MyRecyclerView"; 15 | 16 | public ScrollRecyclerView(Context context) { 17 | super(context); 18 | } 19 | 20 | public ScrollRecyclerView(Context context, @Nullable AttributeSet attrs) { 21 | super(context, attrs); 22 | } 23 | 24 | public ScrollRecyclerView(Context context, @Nullable AttributeSet attrs, int defStyle) { 25 | super(context, attrs, defStyle); 26 | } 27 | 28 | 29 | private boolean mInTop = true; 30 | private int mPos = 0;//当前能获取到的最顶部的view的position 31 | private float mPosTop;//当前可获取view的top坐标 32 | private OnTopListener mOnTopListener; 33 | private OnLeaveTopListener mOnLeaveTopListener; 34 | private boolean mPerformedLeaveListener = false; 35 | 36 | @Override 37 | protected void onScrollChanged(int l, int t, int oldl, int oldt) { 38 | super.onScrollChanged(l, t, oldl, oldt); 39 | LayoutManager layoutManager = getLayoutManager(); 40 | //找到能找到的最顶部的非空的view 41 | View v = layoutManager.findViewByPosition(mPos); 42 | //v==null,表示这个position找不到view了,将mPos++并结束方法,继续找最顶部的view 43 | if (v == null) { 44 | mPos++; 45 | return; 46 | } 47 | //更新当前可获取view的top坐标 48 | mPosTop = v.getTop(); 49 | //如果当前view的top大于等于0(就是完全露出来了),并且当前view的position不是0,即不是第一个 50 | //就需要将mPos回减,因为此时表示RecyclerView的内容在向下滚动 51 | if (mPosTop >= 0 && mPos != 0) { 52 | mPos--; 53 | } 54 | 55 | //如果当前view的position是0,并且当前view的top也是0,表示滑动到了顶部 56 | mInTop = mPos == 0 && mPosTop == 0; 57 | if (mInTop) { 58 | //滑动到顶部,执行顶部监听 59 | if (mOnTopListener != null) { 60 | mOnTopListener.onTopListener(); 61 | } 62 | //设置离开顶部的监听为未执行状态 63 | mPerformedLeaveListener = false; 64 | } else if (!mPerformedLeaveListener) { 65 | //如果不在顶部,并且没有执行过离开顶部监听 66 | //执行离开顶部监听 67 | if (mOnLeaveTopListener != null) { 68 | mOnLeaveTopListener.onLeaveTopListener(); 69 | } 70 | //设置离开顶部监听为已执行状态 71 | mPerformedLeaveListener = true; 72 | } 73 | } 74 | 75 | public interface OnTopListener { 76 | void onTopListener(); 77 | } 78 | 79 | public void setOnTopListener(OnTopListener listener) { 80 | mOnTopListener = listener; 81 | } 82 | 83 | public interface OnLeaveTopListener { 84 | void onLeaveTopListener(); 85 | } 86 | 87 | public void setOnLeaveTopListener(OnLeaveTopListener listener) { 88 | mOnLeaveTopListener = listener; 89 | } 90 | 91 | public boolean isInTop() { 92 | return mInTop; 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /app/src/main/res/anim/pop_enter_b2t.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 8 | 12 | -------------------------------------------------------------------------------- /app/src/main/res/anim/pop_enter_r2l.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/anim/pop_exit_l2r.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/anim/pop_exit_t2b.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 8 | 12 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-v21/click_bg.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/back.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liuzho/ONE/41d1f8b2a2f60fb4bf40b919f7db37bfc5fce558/app/src/main/res/drawable/back.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/click_bg.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/click_default.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/click_pressed.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/collect.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liuzho/ONE/41d1f8b2a2f60fb4bf40b919f7db37bfc5fce558/app/src/main/res/drawable/collect.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/collect_high_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liuzho/ONE/41d1f8b2a2f60fb4bf40b919f7db37bfc5fce558/app/src/main/res/drawable/collect_high_light.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/comment.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liuzho/ONE/41d1f8b2a2f60fb4bf40b919f7db37bfc5fce558/app/src/main/res/drawable/comment.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/comment_laud.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liuzho/ONE/41d1f8b2a2f60fb4bf40b919f7db37bfc5fce558/app/src/main/res/drawable/comment_laud.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/comment_laud_selected.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liuzho/ONE/41d1f8b2a2f60fb4bf40b919f7db37bfc5fce558/app/src/main/res/drawable/comment_laud_selected.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/decoration.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 8 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/edit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liuzho/ONE/41d1f8b2a2f60fb4bf40b919f7db37bfc5fce558/app/src/main/res/drawable/edit.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/feeds_music.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liuzho/ONE/41d1f8b2a2f60fb4bf40b919f7db37bfc5fce558/app/src/main/res/drawable/feeds_music.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/feeds_music_story.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liuzho/ONE/41d1f8b2a2f60fb4bf40b919f7db37bfc5fce558/app/src/main/res/drawable/feeds_music_story.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/follow_bg.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/frame_loading.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 7 | 10 | 13 | 16 | 19 | 22 | 25 | 28 | 31 | 34 | 37 | 40 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/like.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liuzho/ONE/41d1f8b2a2f60fb4bf40b919f7db37bfc5fce558/app/src/main/res/drawable/like.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/like_high_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liuzho/ONE/41d1f8b2a2f60fb4bf40b919f7db37bfc5fce558/app/src/main/res/drawable/like_high_light.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/listen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liuzho/ONE/41d1f8b2a2f60fb4bf40b919f7db37bfc5fce558/app/src/main/res/drawable/listen.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/loading_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liuzho/ONE/41d1f8b2a2f60fb4bf40b919f7db37bfc5fce558/app/src/main/res/drawable/loading_1.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/loading_10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liuzho/ONE/41d1f8b2a2f60fb4bf40b919f7db37bfc5fce558/app/src/main/res/drawable/loading_10.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/loading_11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liuzho/ONE/41d1f8b2a2f60fb4bf40b919f7db37bfc5fce558/app/src/main/res/drawable/loading_11.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/loading_12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liuzho/ONE/41d1f8b2a2f60fb4bf40b919f7db37bfc5fce558/app/src/main/res/drawable/loading_12.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/loading_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liuzho/ONE/41d1f8b2a2f60fb4bf40b919f7db37bfc5fce558/app/src/main/res/drawable/loading_2.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/loading_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liuzho/ONE/41d1f8b2a2f60fb4bf40b919f7db37bfc5fce558/app/src/main/res/drawable/loading_3.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/loading_4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liuzho/ONE/41d1f8b2a2f60fb4bf40b919f7db37bfc5fce558/app/src/main/res/drawable/loading_4.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/loading_5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liuzho/ONE/41d1f8b2a2f60fb4bf40b919f7db37bfc5fce558/app/src/main/res/drawable/loading_5.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/loading_6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liuzho/ONE/41d1f8b2a2f60fb4bf40b919f7db37bfc5fce558/app/src/main/res/drawable/loading_6.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/loading_7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liuzho/ONE/41d1f8b2a2f60fb4bf40b919f7db37bfc5fce558/app/src/main/res/drawable/loading_7.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/loading_8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liuzho/ONE/41d1f8b2a2f60fb4bf40b919f7db37bfc5fce558/app/src/main/res/drawable/loading_8.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/loading_9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liuzho/ONE/41d1f8b2a2f60fb4bf40b919f7db37bfc5fce558/app/src/main/res/drawable/loading_9.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/movie_bottom_bg.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/movie_info.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liuzho/ONE/41d1f8b2a2f60fb4bf40b919f7db37bfc5fce558/app/src/main/res/drawable/movie_info.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/one_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liuzho/ONE/41d1f8b2a2f60fb4bf40b919f7db37bfc5fce558/app/src/main/res/drawable/one_icon.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/one_placeholder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liuzho/ONE/41d1f8b2a2f60fb4bf40b919f7db37bfc5fce558/app/src/main/res/drawable/one_placeholder.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/pause.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liuzho/ONE/41d1f8b2a2f60fb4bf40b919f7db37bfc5fce558/app/src/main/res/drawable/pause.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/placeholder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liuzho/ONE/41d1f8b2a2f60fb4bf40b919f7db37bfc5fce558/app/src/main/res/drawable/placeholder.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/play.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liuzho/ONE/41d1f8b2a2f60fb4bf40b919f7db37bfc5fce558/app/src/main/res/drawable/play.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/qq.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liuzho/ONE/41d1f8b2a2f60fb4bf40b919f7db37bfc5fce558/app/src/main/res/drawable/qq.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/search.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liuzho/ONE/41d1f8b2a2f60fb4bf40b919f7db37bfc5fce558/app/src/main/res/drawable/search.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/share.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liuzho/ONE/41d1f8b2a2f60fb4bf40b919f7db37bfc5fce558/app/src/main/res/drawable/share.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/tab_home_checked.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liuzho/ONE/41d1f8b2a2f60fb4bf40b919f7db37bfc5fce558/app/src/main/res/drawable/tab_home_checked.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/tab_home_unchecked.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liuzho/ONE/41d1f8b2a2f60fb4bf40b919f7db37bfc5fce558/app/src/main/res/drawable/tab_home_unchecked.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/tab_movie_checked.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liuzho/ONE/41d1f8b2a2f60fb4bf40b919f7db37bfc5fce558/app/src/main/res/drawable/tab_movie_checked.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/tab_movie_unchecked.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liuzho/ONE/41d1f8b2a2f60fb4bf40b919f7db37bfc5fce558/app/src/main/res/drawable/tab_movie_unchecked.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/tab_music_checked.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liuzho/ONE/41d1f8b2a2f60fb4bf40b919f7db37bfc5fce558/app/src/main/res/drawable/tab_music_checked.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/tab_music_unchecked.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liuzho/ONE/41d1f8b2a2f60fb4bf40b919f7db37bfc5fce558/app/src/main/res/drawable/tab_music_unchecked.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/tab_read_checked.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liuzho/ONE/41d1f8b2a2f60fb4bf40b919f7db37bfc5fce558/app/src/main/res/drawable/tab_read_checked.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/tab_read_unchecked.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liuzho/ONE/41d1f8b2a2f60fb4bf40b919f7db37bfc5fce558/app/src/main/res/drawable/tab_read_unchecked.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/url.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liuzho/ONE/41d1f8b2a2f60fb4bf40b919f7db37bfc5fce558/app/src/main/res/drawable/url.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/user.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liuzho/ONE/41d1f8b2a2f60fb4bf40b919f7db37bfc5fce558/app/src/main/res/drawable/user.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/weibo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liuzho/ONE/41d1f8b2a2f60fb4bf40b919f7db37bfc5fce558/app/src/main/res/drawable/weibo.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/weichat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liuzho/ONE/41d1f8b2a2f60fb4bf40b919f7db37bfc5fce558/app/src/main/res/drawable/weichat.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/weichat_friendes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liuzho/ONE/41d1f8b2a2f60fb4bf40b919f7db37bfc5fce558/app/src/main/res/drawable/weichat_friendes.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/xiami.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liuzho/ONE/41d1f8b2a2f60fb4bf40b919f7db37bfc5fce558/app/src/main/res/drawable/xiami.png -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_author.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 13 | 14 | 21 | 22 | 30 | 31 | 32 | 33 | 36 | 37 | 42 | 43 | 50 | 51 | 59 | 60 | 70 | 71 | 82 | 83 | 95 | 96 | 104 | 105 | 110 | 111 | 112 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | 17 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_movie.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 14 | 15 | 21 | 22 | 26 | 27 | 32 | 33 | 37 | 38 | 47 | 48 | 52 | 53 | 57 | 58 | 62 | 63 | 64 | 65 | 66 | 71 | 72 | 78 | 79 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_music.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 14 | 15 | 20 | 21 | 25 | 26 | 32 | 33 | 43 | 44 | 56 | 57 | 67 | 68 | 72 | 73 | 79 | 80 | 84 | 85 | 86 | 87 | 92 | 93 | 99 | 100 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_play_video.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 13 | 14 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_question.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 14 | 15 | 20 | 21 | 25 | 26 | 36 | 37 | 48 | 49 | 58 | 59 | 67 | 68 | 77 | 78 | 79 | 80 | 88 | 89 | 93 | 94 | 95 | 96 | 101 | 102 | 108 | 109 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_read.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 13 | 14 | 19 | 20 | 24 | 25 | 26 | 27 | 28 | 29 | 35 | 36 | 40 | 41 | 42 | 43 | 48 | 49 | 55 | 56 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_splash.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 13 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_content.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_home.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_rv_commet.xml: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 17 | 18 | 28 | 29 | 37 | 38 | 53 | 54 | 62 | 63 | 73 | 74 | 75 | 76 | 89 | 90 | 100 | 101 | 111 | 112 | 125 | 126 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_rv_day_one.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 18 | 19 | 27 | 28 | 34 | 35 | 41 | 42 | 54 | 55 | 56 | 65 | 66 | 76 | 77 | 88 | 89 | 92 | 93 | 100 | 101 | 105 | 106 | 114 | 115 | 116 | 125 | 126 | 135 | 136 | 144 | 145 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_rv_movie.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 21 | 22 | 33 | 34 | 44 | 45 | 55 | 56 | 66 | 67 | 78 | 79 | 80 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_rv_music.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 21 | 22 | 33 | 34 | 44 | 45 | 48 | 49 | 55 | 56 | 61 | 62 | 70 | 71 | 72 | 73 | 85 | 86 | 96 | 97 | 98 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_rv_read.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 21 | 22 | 33 | 34 | 44 | 45 | 55 | 56 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /app/src/main/res/layout/layout_author.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 16 | 17 | 27 | 28 | 39 | 40 | 53 | 54 | 72 | -------------------------------------------------------------------------------- /app/src/main/res/layout/layout_detail_authors.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 15 | 16 | 22 | 23 | 28 | -------------------------------------------------------------------------------- /app/src/main/res/layout/layout_detail_bottombar.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 14 | 15 | 23 | 24 | 33 | 34 | 43 | 44 | 54 | 55 | -------------------------------------------------------------------------------- /app/src/main/res/layout/layout_detail_comments.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 13 | 14 | 22 | 23 | 28 | -------------------------------------------------------------------------------- /app/src/main/res/layout/layout_detail_content.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 12 | 13 | 24 | 25 | 35 | -------------------------------------------------------------------------------- /app/src/main/res/layout/layout_detail_head.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 15 | 16 | 24 | 25 | 32 | 33 | 40 | 41 | 49 | 50 | -------------------------------------------------------------------------------- /app/src/main/res/layout/layout_hot_decoration.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/layout/layout_loading.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/layout/layout_main_content.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 11 | 12 | 17 | 18 | 25 | 26 | 35 | 36 | 45 | 46 | 55 | 56 | 65 | 66 | 67 | 73 | 74 | -------------------------------------------------------------------------------- /app/src/main/res/layout/layout_main_head.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 15 | 16 | 23 | 24 | -------------------------------------------------------------------------------- /app/src/main/res/layout/layout_play_movie.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 10 | 11 | 17 | -------------------------------------------------------------------------------- /app/src/main/res/layout/layout_popup_movie_profile.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 17 | 18 | 22 | 23 | 29 | 30 | 38 | 39 | 47 | 48 | 60 | 61 | 73 | 74 | 83 | 84 | 94 | 95 | 96 | 97 | 102 | -------------------------------------------------------------------------------- /app/src/main/res/layout/layout_popup_one_img.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 19 | 20 | 28 | 29 | 37 | -------------------------------------------------------------------------------- /app/src/main/res/layout/layout_popup_share.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 18 | 19 | 27 | 28 | 36 | 37 | 45 | 46 | 54 | -------------------------------------------------------------------------------- /app/src/main/res/layout/layout_rv_item_bottom.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 18 | 19 | 28 | 29 | 38 | 39 | 47 | -------------------------------------------------------------------------------- /app/src/main/res/layout/layout_toolbar_content.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 18 | 19 | 27 | 28 | 39 | 40 | 51 | 52 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /app/src/main/res/menu/menu.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 9 | 12 | 15 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liuzho/ONE/41d1f8b2a2f60fb4bf40b919f7db37bfc5fce558/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liuzho/ONE/41d1f8b2a2f60fb4bf40b919f7db37bfc5fce558/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liuzho/ONE/41d1f8b2a2f60fb4bf40b919f7db37bfc5fce558/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liuzho/ONE/41d1f8b2a2f60fb4bf40b919f7db37bfc5fce558/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liuzho/ONE/41d1f8b2a2f60fb4bf40b919f7db37bfc5fce558/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/values/attrs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #E9E9E9 5 | #FF4081 6 | #888 7 | #fff 8 | #eee 9 | #fff 10 | #444 11 | 12 | -------------------------------------------------------------------------------- /app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 30dp 4 | 10dp 5 | 12sp 6 | 14sp 7 | 15sp 8 | 20sp 9 | 8dp 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | ONE 3 | 一个阅读 4 | 一个音乐 5 | 一个影视 6 | 阅读·问答 7 | 评论列表 8 | loading… 9 | 影讯 10 | ---- 剧情简介 ---- 11 | 作者 12 | 复杂世界里,一个就够了 13 | 关注 14 | 以上是热门评论 15 | 未登录 16 | 17 | ONE 18 | 昨天 19 | 前天 20 | 三天前 21 | 四天前 22 | 五天前 23 | 六天前 24 | 七天前 25 | 八天前 26 | 九天前 27 | 28 | 29 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 12 | 13 | 17 | 18 | 22 | 23 | -------------------------------------------------------------------------------- /app/src/test/java/com/liuzhi/one/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.liuzhi.one; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() throws Exception { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /app/《ONE一个》.apk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liuzho/ONE/41d1f8b2a2f60fb4bf40b919f7db37bfc5fce558/app/《ONE一个》.apk -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | repositories { 5 | jcenter() 6 | } 7 | dependencies { 8 | classpath 'com.android.tools.build:gradle:2.3.1' 9 | 10 | // NOTE: Do not place your application dependencies here; they belong 11 | // in the individual module build.gradle files 12 | } 13 | } 14 | 15 | allprojects { 16 | repositories { 17 | jcenter() 18 | } 19 | } 20 | 21 | task clean(type: Delete) { 22 | delete rootProject.buildDir 23 | } 24 | -------------------------------------------------------------------------------- /gif/home.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liuzho/ONE/41d1f8b2a2f60fb4bf40b919f7db37bfc5fce558/gif/home.gif -------------------------------------------------------------------------------- /gif/movie.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liuzho/ONE/41d1f8b2a2f60fb4bf40b919f7db37bfc5fce558/gif/movie.gif -------------------------------------------------------------------------------- /gif/music.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liuzho/ONE/41d1f8b2a2f60fb4bf40b919f7db37bfc5fce558/gif/music.gif -------------------------------------------------------------------------------- /gif/read.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liuzho/ONE/41d1f8b2a2f60fb4bf40b919f7db37bfc5fce558/gif/read.gif -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | org.gradle.jvmargs=-Xmx1536m 13 | 14 | # When configured, Gradle will run in incubating parallel mode. 15 | # This option should only be used with decoupled projects. More details, visit 16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 17 | # org.gradle.parallel=true 18 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liuzho/ONE/41d1f8b2a2f60fb4bf40b919f7db37bfc5fce558/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Sun Mar 19 16:05:28 CST 2017 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip 7 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # Attempt to set APP_HOME 46 | # Resolve links: $0 may be a link 47 | PRG="$0" 48 | # Need this for relative symlinks. 49 | while [ -h "$PRG" ] ; do 50 | ls=`ls -ld "$PRG"` 51 | link=`expr "$ls" : '.*-> \(.*\)$'` 52 | if expr "$link" : '/.*' > /dev/null; then 53 | PRG="$link" 54 | else 55 | PRG=`dirname "$PRG"`"/$link" 56 | fi 57 | done 58 | SAVED="`pwd`" 59 | cd "`dirname \"$PRG\"`/" >/dev/null 60 | APP_HOME="`pwd -P`" 61 | cd "$SAVED" >/dev/null 62 | 63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 64 | 65 | # Determine the Java command to use to start the JVM. 66 | if [ -n "$JAVA_HOME" ] ; then 67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 68 | # IBM's JDK on AIX uses strange locations for the executables 69 | JAVACMD="$JAVA_HOME/jre/sh/java" 70 | else 71 | JAVACMD="$JAVA_HOME/bin/java" 72 | fi 73 | if [ ! -x "$JAVACMD" ] ; then 74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 75 | 76 | Please set the JAVA_HOME variable in your environment to match the 77 | location of your Java installation." 78 | fi 79 | else 80 | JAVACMD="java" 81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 82 | 83 | Please set the JAVA_HOME variable in your environment to match the 84 | location of your Java installation." 85 | fi 86 | 87 | # Increase the maximum file descriptors if we can. 88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 89 | MAX_FD_LIMIT=`ulimit -H -n` 90 | if [ $? -eq 0 ] ; then 91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 92 | MAX_FD="$MAX_FD_LIMIT" 93 | fi 94 | ulimit -n $MAX_FD 95 | if [ $? -ne 0 ] ; then 96 | warn "Could not set maximum file descriptor limit: $MAX_FD" 97 | fi 98 | else 99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 100 | fi 101 | fi 102 | 103 | # For Darwin, add options to specify how the application appears in the dock 104 | if $darwin; then 105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 106 | fi 107 | 108 | # For Cygwin, switch paths to Windows format before running java 109 | if $cygwin ; then 110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 112 | JAVACMD=`cygpath --unix "$JAVACMD"` 113 | 114 | # We build the pattern for arguments to be converted via cygpath 115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 116 | SEP="" 117 | for dir in $ROOTDIRSRAW ; do 118 | ROOTDIRS="$ROOTDIRS$SEP$dir" 119 | SEP="|" 120 | done 121 | OURCYGPATTERN="(^($ROOTDIRS))" 122 | # Add a user-defined pattern to the cygpath arguments 123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 125 | fi 126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 127 | i=0 128 | for arg in "$@" ; do 129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 131 | 132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 134 | else 135 | eval `echo args$i`="\"$arg\"" 136 | fi 137 | i=$((i+1)) 138 | done 139 | case $i in 140 | (0) set -- ;; 141 | (1) set -- "$args0" ;; 142 | (2) set -- "$args0" "$args1" ;; 143 | (3) set -- "$args0" "$args1" "$args2" ;; 144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 150 | esac 151 | fi 152 | 153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 154 | function splitJvmOpts() { 155 | JVM_OPTS=("$@") 156 | } 157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 159 | 160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 161 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | --------------------------------------------------------------------------------