├── .gitignore
├── .idea
├── compiler.xml
├── copyright
│ └── profiles_settings.xml
├── gradle.xml
├── markdown-navigator.xml
├── markdown-navigator
│ └── profiles_settings.xml
├── misc.xml
├── modules.xml
├── runConfigurations.xml
└── vcs.xml
├── app
├── .gitignore
├── app-release.apk
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── example
│ │ └── laravelchen
│ │ └── toutiao
│ │ └── ExampleInstrumentedTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── com
│ │ │ └── example
│ │ │ └── laravelchen
│ │ │ └── toutiao
│ │ │ ├── ArticleContentShow.java
│ │ │ ├── Auth
│ │ │ ├── LoginFragment.java
│ │ │ └── RegisterFragment.java
│ │ │ ├── Constant.java
│ │ │ ├── Interface
│ │ │ └── OnItemClickListener.java
│ │ │ ├── JokeContent.java
│ │ │ ├── MainActivity.java
│ │ │ ├── PathRandom.java
│ │ │ ├── PhotoActivity.java
│ │ │ ├── UserLoginAndRegister.java
│ │ │ ├── UserSetting.java
│ │ │ ├── VideoActivity.java
│ │ │ ├── alladapter
│ │ │ ├── JokeAdapter.java
│ │ │ ├── MyFragmentPagerAdapter.java
│ │ │ ├── PhotoAdapter.java
│ │ │ ├── RecommendAdapter.java
│ │ │ └── VideoAdapter.java
│ │ │ ├── allbean
│ │ │ ├── JokeBean.java
│ │ │ ├── PhotoBean.java
│ │ │ ├── RecommendBean.java
│ │ │ └── VideoBean.java
│ │ │ ├── allfragment
│ │ │ ├── HomeFragment.java
│ │ │ ├── JokeFragment.java
│ │ │ ├── PageFragment.java
│ │ │ ├── PhotoFragment.java
│ │ │ ├── UserFragment.java
│ │ │ └── VideoFragment.java
│ │ │ └── extra
│ │ │ ├── GetJson.java
│ │ │ ├── ImgLoader.java
│ │ │ └── ImgUtils.java
│ └── res
│ │ ├── drawable
│ │ └── login.xml
│ │ ├── layout
│ │ ├── activity_article_content_show.xml
│ │ ├── activity_joke_content.xml
│ │ ├── activity_main.xml
│ │ ├── activity_photo.xml
│ │ ├── activity_user_login_and_register.xml
│ │ ├── activity_user_setting.xml
│ │ ├── activity_video.xml
│ │ ├── fragment_home.xml
│ │ ├── fragment_login.xml
│ │ ├── fragment_page.xml
│ │ ├── fragment_photo.xml
│ │ ├── fragment_register.xml
│ │ ├── fragment_user.xml
│ │ ├── fragment_video.xml
│ │ ├── fragment_wei_tou_tiao.xml
│ │ ├── joke_main.xml
│ │ ├── navigation_header.xml
│ │ ├── navigation_header_before.xml
│ │ ├── photo_main.xml
│ │ ├── recommend_home.xml
│ │ ├── recommend_home_has_image.xml
│ │ ├── recommend_home_no_image.xml
│ │ ├── theme_choose.xml
│ │ ├── user_share.xml
│ │ └── video_main.xml
│ │ ├── menu
│ │ ├── drawer.xml
│ │ └── main.xml
│ │ ├── mipmap-hdpi
│ │ ├── app.png
│ │ ├── app1.png
│ │ ├── avatar.jpeg
│ │ ├── home_view.jpeg
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-mdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xhdpi
│ │ ├── comment.png
│ │ ├── email.png
│ │ ├── fanhui.png
│ │ ├── fenxiang.png
│ │ ├── github.png
│ │ ├── githubblue.png
│ │ ├── home.png
│ │ ├── home2.png
│ │ ├── ic_launcher.png
│ │ ├── ic_launcher_round.png
│ │ ├── login.jpeg
│ │ ├── loginbck.jpg
│ │ ├── password.png
│ │ ├── photo.png
│ │ ├── play.png
│ │ ├── qq.png
│ │ ├── right.png
│ │ ├── search2.png
│ │ ├── share_moment.png
│ │ ├── share_qq.png
│ │ ├── share_qzone.png
│ │ ├── share_wechat.png
│ │ ├── share_weibo.png
│ │ ├── shezhi.png
│ │ ├── shoucang.png
│ │ ├── theme_black.png
│ │ ├── theme_blue.png
│ │ ├── theme_purple.png
│ │ ├── theme_yellow.png
│ │ ├── themem_pink.png
│ │ ├── tuichu.png
│ │ ├── user.png
│ │ ├── username.png
│ │ ├── video.png
│ │ ├── weibo.png
│ │ └── zhuti.png
│ │ ├── mipmap-xxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ └── values
│ │ ├── colors.xml
│ │ ├── dimen.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ └── test
│ └── java
│ └── com
│ └── example
│ └── laravelchen
│ └── toutiao
│ └── ExampleUnitTest.java
├── build.gradle
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── image
├── home.gif
├── info.gif
├── login.gif
├── logout.gif
├── photo.gif
└── video.gif
├── readme.md
└── 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/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
17 |
18 |
--------------------------------------------------------------------------------
/.idea/markdown-navigator.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
--------------------------------------------------------------------------------
/.idea/markdown-navigator/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/app/app-release.apk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LaravelChen/TouTiao/c1f1bfa9c9d37013723a4cfaf9f02a357cad68d1/app/app-release.apk
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 25
5 | buildToolsVersion "25.0.3"
6 | defaultConfig {
7 | applicationId "com.example.laravelchen.toutiao"
8 | minSdkVersion 21
9 | targetSdkVersion 25
10 | versionCode 1
11 | versionName "1.0"
12 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
13 | manifestPlaceholders = [
14 | // 替换成你的qq_id
15 | qq_id: "101410114"
16 | ]
17 | }
18 | buildTypes {
19 | release {
20 | minifyEnabled false
21 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
22 | }
23 | }
24 | }
25 |
26 | dependencies {
27 | compile fileTree(dir: 'libs', include: ['*.jar'])
28 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
29 | exclude group: 'com.android.support', module: 'support-annotations'
30 | })
31 |
32 | compile('com.dou361.dialogui:jjdxm-dialogui:1.0.3') {
33 | // exclude group: 'com.android.support', module: 'support-v7'
34 | // exclude group: 'com.android.support', module: 'design'
35 | }
36 |
37 | compile('com.dou361.ijkplayer:jjdxm-ijkplayer:1.0.5') {
38 | exclude group: 'com.android.support', module: 'appcompat-v7'
39 | }
40 |
41 | //最小版本21
42 | //最小版本21
43 | compile 'com.android.support:appcompat-v7:25.3.1'
44 | compile 'com.android.support.constraint:constraint-layout:1.0.2'
45 | compile 'com.android.support:recyclerview-v7:25.3.1'
46 | compile 'com.android.support:cardview-v7:25.3.1'
47 | compile 'com.android.support:design:25.3.1'
48 | compile 'com.android.support:support-v4:25.3.1'
49 | compile 'com.ashokvarma.android:bottom-navigation-bar:1.4.3'
50 | compile 'com.github.bumptech.glide:glide:3.7.0'
51 | compile 'com.squareup.okhttp3:okhttp:3.7.0'
52 | compile 'org.jsoup:jsoup:1.10.1'
53 | compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
54 | compile 'de.hdodenhof:circleimageview:2.1.0'
55 | compile 'com.tamic.novate:novate:1.5.0'
56 | compile 'me.shaohui.shareutil:shareutil:1.3.8'
57 | compile 'com.rengwuxian.materialedittext:library:2.1.4'
58 | compile 'com.contrarywind:Android-PickerView:3.2.5'
59 | compile 'tv.danmaku.ijk.media:ijkplayer-java:0.6.0'
60 | compile 'tv.danmaku.ijk.media:ijkplayer-armv7a:0.6.0'
61 | compile 'tv.danmaku.ijk.media:ijkplayer-armv5:0.6.0'
62 | compile 'tv.danmaku.ijk.media:ijkplayer-arm64:0.6.0'
63 | compile 'tv.danmaku.ijk.media:ijkplayer-x86:0.6.0'
64 | compile 'tv.danmaku.ijk.media:ijkplayer-x86_64:0.6.0'
65 | testCompile 'junit:junit:4.12'
66 | debugCompile 'com.squareup.okhttp3:logging-interceptor:3.7.0'
67 | }
68 |
--------------------------------------------------------------------------------
/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 /Users/apple/Library/Android/sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
19 | # Uncomment this to preserve the line number information for
20 | # debugging stack traces.
21 | #-keepattributes SourceFile,LineNumberTable
22 |
23 | # If you keep the line number information, uncomment this to
24 | # hide the original source file name.
25 | #-renamesourcefileattribute SourceFile
26 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/example/laravelchen/toutiao/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.example.laravelchen.toutiao;
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.example.laravelchen.toutiao", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
18 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
31 |
34 |
37 |
40 |
43 |
47 |
48 |
49 |
50 |
51 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/laravelchen/toutiao/ArticleContentShow.java:
--------------------------------------------------------------------------------
1 | package com.example.laravelchen.toutiao;
2 |
3 | import android.app.Activity;
4 | import android.app.ProgressDialog;
5 | import android.content.Intent;
6 | import android.content.SharedPreferences;
7 | import android.graphics.Color;
8 | import android.os.Build;
9 | import android.support.annotation.RequiresApi;
10 | import android.support.v7.app.AppCompatActivity;
11 | import android.os.Bundle;
12 | import android.support.v7.widget.Toolbar;
13 | import android.view.KeyEvent;
14 | import android.view.MenuItem;
15 | import android.view.View;
16 | import android.webkit.WebChromeClient;
17 | import android.webkit.WebSettings;
18 | import android.webkit.WebView;
19 | import android.webkit.WebViewClient;
20 | import android.widget.TextView;
21 |
22 | public class ArticleContentShow extends AppCompatActivity {
23 | private WebView webView = null;
24 |
25 | private ProgressDialog dialog = null;
26 |
27 | private Intent data;
28 | private String share_url;
29 | private Toolbar toolbar;
30 | private SharedPreferences sp;
31 |
32 |
33 | @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
34 | @Override
35 | protected void onCreate(Bundle savedInstanceState) {
36 | super.onCreate(savedInstanceState);
37 | setContentView(R.layout.activity_article_content_show);
38 | toolbar = (Toolbar) findViewById(R.id.contentToolbar);
39 | toolbar.setTitle("今日头条 - 文章内容");
40 | toolbar.setNavigationOnClickListener(new View.OnClickListener() {
41 | @Override
42 | public void onClick(View v) {
43 | finish();
44 | }
45 | });
46 | setSupportActionBar(toolbar);
47 | sp=getSharedPreferences("user_auth", Activity.MODE_PRIVATE);
48 | toolbar.setBackgroundColor(Color.parseColor(sp.getString("theme", "#3F51B5")));
49 |
50 | //初始化页面
51 | initViews();
52 |
53 | // 启用支持JavaScript
54 | WebSettings webSettings = webView.getSettings();
55 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
56 | webSettings.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
57 | }
58 | webSettings.setJavaScriptEnabled(true);
59 | webSettings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN);
60 | webSettings.setDomStorageEnabled(true);
61 | webSettings.setAppCacheEnabled(true);// 应用可以有缓存
62 | webSettings.setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);// 优先使用缓存
63 | webSettings.setAppCacheEnabled(true);// 缓存最多可以有10M
64 |
65 | // 进度条显示网页的加载过程
66 | download();
67 | // 优先使用缓存优化效率
68 | webSettings.setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);
69 | }
70 |
71 |
72 | private void download() {
73 | webView.setWebChromeClient(new WebChromeClient() {
74 | @Override
75 | public void onProgressChanged(WebView view, int newProgress) {
76 |
77 | if (newProgress == 100) {
78 | // 加载完毕
79 | closeDialog(newProgress);
80 | } else {
81 | openDialog(newProgress);
82 | }
83 |
84 |
85 | super.onProgressChanged(view, newProgress);
86 | }
87 |
88 | private void openDialog(int newProgress) {
89 | if (dialog == null) {
90 | dialog = new ProgressDialog(ArticleContentShow.this);
91 | dialog.setTitle("正在加载");
92 | dialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
93 | dialog.setProgress(newProgress);
94 | dialog.show();
95 | } else {
96 | dialog.setProgress(newProgress);
97 | }
98 | }
99 |
100 | private void closeDialog(int newProgress) {
101 | if (dialog != null && dialog.isShowing()) {
102 | dialog.dismiss();
103 | dialog = null;
104 | }
105 | }
106 | });
107 | }
108 |
109 | private void initViews() {
110 | getSupportActionBar().setDisplayShowHomeEnabled(true);
111 | getSupportActionBar().setDisplayUseLogoEnabled(true);
112 | webView = (WebView) findViewById(R.id.webView);
113 | data = getIntent();
114 | share_url = data.getStringExtra("share_url");
115 | webView.loadUrl(share_url);
116 | webView.setWebViewClient(new WebViewClient() {
117 | @Override
118 | public boolean shouldOverrideUrlLoading(WebView view, String url) {
119 | view.loadUrl(url);
120 | return true;
121 | }
122 | });
123 | }
124 |
125 | }
126 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/laravelchen/toutiao/Auth/LoginFragment.java:
--------------------------------------------------------------------------------
1 | package com.example.laravelchen.toutiao.Auth;
2 |
3 |
4 | import android.content.Context;
5 | import android.content.Intent;
6 | import android.content.SharedPreferences;
7 | import android.os.Bundle;
8 | import android.support.v4.app.Fragment;
9 | import android.view.LayoutInflater;
10 | import android.view.View;
11 | import android.view.ViewGroup;
12 | import android.widget.EditText;
13 |
14 | import com.example.laravelchen.toutiao.Constant;
15 | import com.example.laravelchen.toutiao.MainActivity;
16 | import com.example.laravelchen.toutiao.R;
17 | import com.example.laravelchen.toutiao.UserLoginAndRegister;
18 | import com.tamic.novate.Novate;
19 | import com.tamic.novate.Throwable;
20 | import com.tamic.novate.callback.ResponseCallback;
21 |
22 | import org.json.JSONObject;
23 |
24 | import java.util.HashMap;
25 | import java.util.Map;
26 | import java.util.regex.Matcher;
27 | import java.util.regex.Pattern;
28 |
29 | import de.hdodenhof.circleimageview.CircleImageView;
30 | import okhttp3.Call;
31 | import okhttp3.ResponseBody;
32 |
33 | /**
34 | * A simple {@link Fragment} subclass.
35 | */
36 | public class LoginFragment extends Fragment implements View.OnClickListener {
37 |
38 |
39 | private EditText email;
40 | private EditText password;
41 | private Novate novate;
42 |
43 | public LoginFragment() {
44 | // Required empty public constructor
45 | }
46 |
47 |
48 | @Override
49 | public View onCreateView(LayoutInflater inflater, ViewGroup container,
50 | Bundle savedInstanceState) {
51 | // Inflate the layout for this fragment
52 | View view = inflater.inflate(R.layout.fragment_login, container, false);
53 |
54 | email = (EditText) view.findViewById(R.id.email);
55 | password = (EditText) view.findViewById(R.id.password);
56 |
57 | //初始化novate
58 | novate = new Novate.Builder(getContext())
59 | .baseUrl("http://cxboss.cn/laravelandroid/public/api/")
60 | .build();
61 |
62 | view.findViewById(R.id.register).setOnClickListener(this);
63 | view.findViewById(R.id.fanhui).setOnClickListener(this);
64 | view.findViewById(R.id.login).setOnClickListener(this);
65 | return view;
66 | }
67 |
68 | @Override
69 | public void onClick(View v) {
70 | switch (v.getId()) {
71 | case R.id.register:
72 | getFragmentManager().beginTransaction().replace(R.id.usermainfragment, new RegisterFragment()).commit();
73 | break;
74 | case R.id.fanhui:
75 | getActivity().finish();
76 | break;
77 | case R.id.login:
78 | login(email.getText().toString(), password.getText().toString());
79 | break;
80 | }
81 | }
82 |
83 | private void login(String emailstr, String passwordstr) {
84 | Boolean is_validate = validate(emailstr, passwordstr);
85 | Map map = new HashMap();
86 | map.put("email", emailstr);
87 | map.put("password", passwordstr);
88 | if (is_validate) {
89 | novate.rxPost("user_login", map, new ResponseCallback