├── app
├── .gitignore
├── src
│ ├── main
│ │ ├── res
│ │ │ ├── values
│ │ │ │ ├── strings.xml
│ │ │ │ ├── colors.xml
│ │ │ │ └── styles.xml
│ │ │ ├── drawable
│ │ │ │ ├── welcome.jpg
│ │ │ │ └── ic_launcher_background.xml
│ │ │ ├── mipmap-hdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-mdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── drawable-hdpi
│ │ │ │ └── ic_refresh.png
│ │ │ ├── drawable-mdpi
│ │ │ │ └── ic_refresh.png
│ │ │ ├── drawable-xhdpi
│ │ │ │ └── ic_refresh.png
│ │ │ ├── drawable-xxhdpi
│ │ │ │ └── ic_refresh.png
│ │ │ ├── mipmap-xhdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xxxhdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-anydpi-v26
│ │ │ │ ├── ic_launcher.xml
│ │ │ │ └── ic_launcher_round.xml
│ │ │ ├── menu
│ │ │ │ └── main_menu.xml
│ │ │ ├── layout
│ │ │ │ ├── activity_main.xml
│ │ │ │ ├── activity_news_detail.xml
│ │ │ │ ├── activity_news_list.xml
│ │ │ │ └── row.xml
│ │ │ └── drawable-v24
│ │ │ │ └── ic_launcher_foreground.xml
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── example
│ │ │ │ └── androidrss
│ │ │ │ ├── Interface
│ │ │ │ └── ItemClickListener.java
│ │ │ │ ├── Model
│ │ │ │ ├── RSSObject.java
│ │ │ │ ├── Feed.java
│ │ │ │ └── Item.java
│ │ │ │ ├── Common
│ │ │ │ ├── HTTPDataHandler.java
│ │ │ │ └── DynamicTimeFormat.java
│ │ │ │ ├── MainActivity.java
│ │ │ │ ├── NewsDetail.java
│ │ │ │ ├── Adapter
│ │ │ │ └── FeedAdapter.java
│ │ │ │ └── NewsList.java
│ │ └── AndroidManifest.xml
│ ├── test
│ │ └── java
│ │ │ └── com
│ │ │ └── example
│ │ │ └── androidrss
│ │ │ └── ExampleUnitTest.java
│ └── androidTest
│ │ └── java
│ │ └── com
│ │ └── example
│ │ └── androidrss
│ │ └── ExampleInstrumentedTest.java
├── proguard-rules.pro
└── build.gradle
├── settings.gradle
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── .idea
└── runConfigurations.xml
├── gradle.properties
├── gradlew.bat
├── gradlew
└── .gitignore
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | AndroidRSS
3 |
4 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fewtime/AndroidRSS/HEAD/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/app/src/main/res/drawable/welcome.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fewtime/AndroidRSS/HEAD/app/src/main/res/drawable/welcome.jpg
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fewtime/AndroidRSS/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fewtime/AndroidRSS/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_refresh.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fewtime/AndroidRSS/HEAD/app/src/main/res/drawable-hdpi/ic_refresh.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_refresh.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fewtime/AndroidRSS/HEAD/app/src/main/res/drawable-mdpi/ic_refresh.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_refresh.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fewtime/AndroidRSS/HEAD/app/src/main/res/drawable-xhdpi/ic_refresh.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_refresh.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fewtime/AndroidRSS/HEAD/app/src/main/res/drawable-xxhdpi/ic_refresh.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fewtime/AndroidRSS/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fewtime/AndroidRSS/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fewtime/AndroidRSS/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fewtime/AndroidRSS/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fewtime/AndroidRSS/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fewtime/AndroidRSS/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fewtime/AndroidRSS/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fewtime/AndroidRSS/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Tue Oct 31 20:18:55 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-4.1-all.zip
7 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/androidrss/Interface/ItemClickListener.java:
--------------------------------------------------------------------------------
1 | package com.example.androidrss.Interface;
2 |
3 | import android.view.View;
4 |
5 | /**
6 | * Created by cowlog on 17-10-31.
7 | */
8 |
9 | public interface ItemClickListener {
10 | void onClick(View view, int position, boolean isLongCilck);
11 | }
12 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/main_menu.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/test/java/com/example/androidrss/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.example.androidrss;
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/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_news_detail.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/example/androidrss/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.example.androidrss;
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 | * Instrumented 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.androidrss", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | ## Project-wide Gradle settings.
2 | #
3 | # For more details on how to configure your build environment visit
4 | # http://www.gradle.org/docs/current/userguide/build_environment.html
5 | #
6 | # Specifies the JVM arguments used for the daemon process.
7 | # The setting is particularly useful for tweaking memory settings.
8 | # Default value: -Xmx1024m -XX:MaxPermSize=256m
9 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
10 | #
11 | # When configured, Gradle will run in incubating parallel mode.
12 | # This option should only be used with decoupled projects. More details, visit
13 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
14 | # org.gradle.parallel=true
15 | #Tue Oct 31 20:18:58 CST 2017
16 | systemProp.http.proxyHost=127.0.0.1
17 | org.gradle.jvmargs=-Xmx1536m
18 | systemProp.http.proxyPort=8118
19 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/androidrss/Model/RSSObject.java:
--------------------------------------------------------------------------------
1 | package com.example.androidrss.Model;
2 |
3 | import java.util.List;
4 |
5 | /**
6 | * Created by cowlog on 17-10-31.
7 | */
8 |
9 |
10 | public class RSSObject
11 | {
12 | public String status;
13 | public Feed feed;
14 | public List- items;
15 |
16 | public RSSObject(String status, Feed feed, List
- items) {
17 | this.status = status;
18 | this.feed = feed;
19 | this.items = items;
20 | }
21 |
22 | public String getStatus() {
23 | return status;
24 | }
25 |
26 | public void setStatus(String status) {
27 | this.status = status;
28 | }
29 |
30 | public Feed getFeed() {
31 | return feed;
32 | }
33 |
34 | public void setFeed(Feed feed) {
35 | this.feed = feed;
36 | }
37 |
38 | public List
- getItems() {
39 | return items;
40 | }
41 |
42 | public void setItems(List
- items) {
43 | this.items = items;
44 | }
45 | }
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 26
5 | defaultConfig {
6 | applicationId "com.example.androidrss"
7 | minSdkVersion 23
8 | targetSdkVersion 26
9 | versionCode 1
10 | versionName "1.0"
11 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
12 | }
13 | buildTypes {
14 | release {
15 | minifyEnabled false
16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
17 | }
18 | }
19 | }
20 |
21 | dependencies {
22 | implementation fileTree(dir: 'libs', include: ['*.jar'])
23 | implementation 'com.android.support:appcompat-v7:26.1.0'
24 | implementation 'com.android.support.constraint:constraint-layout:1.0.2'
25 | testImplementation 'junit:junit:4.12'
26 | androidTestImplementation 'com.android.support.test:runner:1.0.1'
27 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
28 |
29 | // Add Library
30 | compile 'com.android.support:cardview-v7:26.1.0'
31 | compile 'com.android.support:recyclerview-v7:26.1.0'
32 | compile 'com.google.code.gson:gson:2.8.0'
33 |
34 | compile 'com.scwang.smartrefresh:SmartRefreshLayout:1.0.3'
35 | compile 'com.android.support:appcompat-v7:26.1.0'
36 | compile 'com.android.support:design:26.1.0'
37 | }
38 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_news_list.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
17 |
18 |
19 |
24 |
31 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/androidrss/Common/HTTPDataHandler.java:
--------------------------------------------------------------------------------
1 | package com.example.androidrss.Common;
2 |
3 | import java.io.BufferedInputStream;
4 | import java.io.BufferedReader;
5 | import java.io.IOException;
6 | import java.io.InputStream;
7 | import java.io.InputStreamReader;
8 | import java.net.HttpURLConnection;
9 | import java.net.MalformedURLException;
10 | import java.net.URL;
11 |
12 | /**
13 | * Created by cowlog on 17-10-31.
14 | */
15 |
16 | public class HTTPDataHandler {
17 | static String stream = null;
18 |
19 | public HTTPDataHandler() {
20 |
21 | }
22 |
23 | public String GetHTTPData(String urlString) {
24 | try {
25 | URL url = new URL(urlString);
26 | HttpURLConnection urlConnection = (HttpURLConnection)url.openConnection();
27 |
28 | if (urlConnection.getResponseCode() == HttpURLConnection.HTTP_OK) {
29 | InputStream in = new BufferedInputStream(urlConnection.getInputStream());
30 |
31 | BufferedReader r = new BufferedReader(new InputStreamReader(in));
32 | StringBuilder sb = new StringBuilder();
33 | String line;
34 |
35 | while ((line = r.readLine()) != null) {
36 | sb.append(line);
37 | }
38 | stream = sb.toString();
39 | urlConnection.disconnect();
40 | }
41 |
42 | } catch (MalformedURLException e) {
43 | e.printStackTrace();
44 | } catch (IOException e) {
45 | e.printStackTrace();
46 | }
47 |
48 | return stream;
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/row.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
12 |
17 |
18 |
25 |
26 |
33 |
34 |
41 |
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/androidrss/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.example.androidrss;
2 |
3 | import android.app.Activity;
4 | import android.content.Intent;
5 | import android.os.Bundle;
6 | import android.support.v7.app.AppCompatActivity;
7 | import android.view.animation.AlphaAnimation;
8 | import android.view.animation.Animation;
9 | import android.view.animation.Animation.AnimationListener;
10 | import android.widget.ImageView;
11 |
12 | import com.example.androidrss.R;
13 |
14 | public class MainActivity extends Activity {
15 | private ImageView welcomeImg = null;
16 |
17 | @Override
18 | protected void onCreate(Bundle savedInstanceState) {
19 | super.onCreate(savedInstanceState);
20 | setContentView(R.layout.activity_main);
21 | welcomeImg = (ImageView) this.findViewById(R.id.welcomeImg);
22 | AlphaAnimation anima = new AlphaAnimation(0.3f, 1.0f);
23 | anima.setDuration(3000);
24 | welcomeImg.startAnimation(anima);
25 | anima.setAnimationListener(new AnimationImpl());
26 |
27 | }
28 |
29 | private class AnimationImpl implements AnimationListener {
30 |
31 | @Override
32 | public void onAnimationStart(Animation animation) {
33 | welcomeImg.setBackgroundResource(R.drawable.welcome);
34 | }
35 |
36 | @Override
37 | public void onAnimationEnd(Animation animation) {
38 | skip();
39 | }
40 |
41 | @Override
42 | public void onAnimationRepeat(Animation animation) {
43 |
44 | }
45 |
46 | }
47 |
48 | private void skip() {
49 | startActivity(new Intent(this, NewsList.class));
50 | finish();
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/androidrss/Model/Feed.java:
--------------------------------------------------------------------------------
1 | package com.example.androidrss.Model;
2 |
3 | /**
4 | * Created by cowlog on 17-10-31.
5 | */
6 |
7 | public class Feed
8 | {
9 | public String url;
10 | public String title;
11 | public String link;
12 | public String author;
13 | public String description;
14 | public String image;
15 |
16 | public Feed(String url, String title, String link, String author, String description, String image) {
17 | this.url = url;
18 | this.title = title;
19 | this.link = link;
20 | this.author = author;
21 | this.description = description;
22 | this.image = image;
23 | }
24 |
25 | public String getUrl() {
26 | return url;
27 | }
28 |
29 | public void setUrl(String url) {
30 | this.url = url;
31 | }
32 |
33 | public String getTitle() {
34 | return title;
35 | }
36 |
37 | public void setTitle(String title) {
38 | this.title = title;
39 | }
40 |
41 | public String getLink() {
42 | return link;
43 | }
44 |
45 | public void setLink(String link) {
46 | this.link = link;
47 | }
48 |
49 | public String getAuthor() {
50 | return author;
51 | }
52 |
53 | public void setAuthor(String author) {
54 | this.author = author;
55 | }
56 |
57 | public String getDescription() {
58 | return description;
59 | }
60 |
61 | public void setDescription(String description) {
62 | this.description = description;
63 | }
64 |
65 | public String getImage() {
66 | return image;
67 | }
68 |
69 | public void setImage(String image) {
70 | this.image = image;
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v24/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
12 |
13 |
19 |
22 |
25 |
26 |
27 |
28 |
34 |
35 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/androidrss/NewsDetail.java:
--------------------------------------------------------------------------------
1 | package com.example.androidrss;
2 |
3 | import android.content.Intent;
4 | import android.net.Uri;
5 | import android.os.Build;
6 | import android.support.v7.app.AppCompatActivity;
7 | import android.os.Bundle;
8 | import android.webkit.WebResourceRequest;
9 | import android.webkit.WebSettings;
10 | import android.webkit.WebView;
11 | import android.webkit.WebViewClient;
12 | import android.widget.TextView;
13 |
14 | import org.w3c.dom.Text;
15 |
16 | public class NewsDetail extends AppCompatActivity {
17 |
18 |
19 | @Override
20 | protected void onCreate(Bundle savedInstanceState) {
21 | super.onCreate(savedInstanceState);
22 | setContentView(R.layout.activity_news_detail);
23 |
24 | initView();
25 | }
26 |
27 | private void initView() {
28 | Intent intent = getIntent();
29 | String uri = intent.getStringExtra("com.example.androidrss.uri");
30 |
31 | WebView webView = (WebView) this.findViewById(R.id.webView);
32 | webView.getSettings().setJavaScriptEnabled(true);
33 | webView.getSettings().setSupportZoom(true);
34 | webView.getSettings().setBuiltInZoomControls(true);
35 | webView.getSettings().setUseWideViewPort(true);
36 | webView.getSettings().setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN);
37 | webView.getSettings().setLoadWithOverviewMode(true);
38 |
39 | webView.setWebViewClient(new WebViewClient() {
40 | @Override
41 | public boolean shouldOverrideUrlLoading(WebView view, String url) {
42 | if (url.toString().contains("sina.cn")){
43 | view.loadUrl("http://ask.csdn.net/questions/178242");
44 | return true;
45 | }
46 | return false;
47 | }
48 |
49 | @Override
50 | public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) {
51 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
52 | if (request.getUrl().toString().contains("sina.cn")){
53 | view.loadUrl("http://ask.csdn.net/questions/178242");
54 | return true;
55 | }
56 | }
57 | return false;
58 | }
59 | });
60 |
61 | webView.loadUrl(uri);
62 | }
63 |
64 | }
65 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/androidrss/Model/Item.java:
--------------------------------------------------------------------------------
1 | package com.example.androidrss.Model;
2 |
3 | import java.util.List;
4 |
5 | /**
6 | * Created by cowlog on 17-10-31.
7 | */
8 |
9 | public class Item
10 | {
11 | public String title;
12 | public String pubDate;
13 | public String link;
14 | public String guid;
15 | public String author;
16 | public String thumbnail;
17 | public String description;
18 | public String content;
19 | public Object enclosure;
20 | public List categories;
21 |
22 | public Item(String title, String pubDate, String link, String guid, String author, String thumbnail, String description, String content, Object enclosure, List categories) {
23 | this.title = title;
24 | this.pubDate = pubDate;
25 | this.link = link;
26 | this.guid = guid;
27 | this.author = author;
28 | this.thumbnail = thumbnail;
29 | this.description = description;
30 | this.content = content;
31 | this.enclosure = enclosure;
32 | this.categories = categories;
33 | }
34 |
35 | public String getTitle() {
36 | return title;
37 | }
38 |
39 | public void setTitle(String title) {
40 | this.title = title;
41 | }
42 |
43 | public String getPubDate() {
44 | return pubDate;
45 | }
46 |
47 | public void setPubDate(String pubDate) {
48 | this.pubDate = pubDate;
49 | }
50 |
51 | public String getLink() {
52 | return link;
53 | }
54 |
55 | public void setLink(String link) {
56 | this.link = link;
57 | }
58 |
59 | public String getGuid() {
60 | return guid;
61 | }
62 |
63 | public void setGuid(String guid) {
64 | this.guid = guid;
65 | }
66 |
67 | public String getAuthor() {
68 | return author;
69 | }
70 |
71 | public void setAuthor(String author) {
72 | this.author = author;
73 | }
74 |
75 | public String getThumbnail() {
76 | return thumbnail;
77 | }
78 |
79 | public void setThumbnail(String thumbnail) {
80 | this.thumbnail = thumbnail;
81 | }
82 |
83 | public String getDescription() {
84 | return description;
85 | }
86 |
87 | public void setDescription(String description) {
88 | this.description = description;
89 | }
90 |
91 | public String getContent() {
92 | return content;
93 | }
94 |
95 | public void setContent(String content) {
96 | this.content = content;
97 | }
98 |
99 | public Object getEnclosure() {
100 | return enclosure;
101 | }
102 |
103 | public void setEnclosure(Object enclosure) {
104 | this.enclosure = enclosure;
105 | }
106 |
107 | public List getCategories() {
108 | return categories;
109 | }
110 |
111 | public void setCategories(List categories) {
112 | this.categories = categories;
113 | }
114 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/example/androidrss/Adapter/FeedAdapter.java:
--------------------------------------------------------------------------------
1 | package com.example.androidrss.Adapter;
2 |
3 |
4 | import android.content.Context;
5 | import android.content.Intent;
6 | import android.net.Uri;
7 | import android.support.v7.widget.RecyclerView;
8 | import android.view.LayoutInflater;
9 | import android.view.View;
10 | import android.view.ViewGroup;
11 | import android.webkit.WebView;
12 | import android.widget.TextView;
13 |
14 | import com.example.androidrss.Interface.ItemClickListener;
15 | import com.example.androidrss.Model.RSSObject;
16 | import com.example.androidrss.NewsDetail;
17 | import com.example.androidrss.R;
18 |
19 |
20 | /**
21 | * Created by cowlog on 17-10-31.
22 | */
23 |
24 |
25 | class FeedViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener,
26 | View.OnLongClickListener {
27 |
28 | public TextView txtTitle, txtPubDate, txtContent;
29 | public WebView webView;
30 | private ItemClickListener itemClickListener;
31 |
32 | public FeedViewHolder(View itemView) {
33 | super(itemView);
34 |
35 | txtTitle = (TextView)itemView.findViewById(R.id.txtTitle);
36 | txtPubDate = (TextView)itemView.findViewById(R.id.txtPubDate);
37 | txtContent = (TextView)itemView.findViewById(R.id.txtContent);
38 |
39 | // Set Event
40 | itemView.setOnClickListener(this);
41 | itemView.setOnLongClickListener(this);
42 | }
43 |
44 | public void setItemClickListener(ItemClickListener itemClickListener) {
45 | this.itemClickListener = itemClickListener;
46 | }
47 |
48 | @Override
49 | public void onClick(View v) {
50 | itemClickListener.onClick(v, getAdapterPosition(), false);
51 | }
52 |
53 | @Override
54 | public boolean onLongClick(View v) {
55 | itemClickListener.onClick(v, getAdapterPosition(), true);
56 | return true;
57 | }
58 | }
59 |
60 | public class FeedAdapter extends RecyclerView.Adapter{
61 |
62 | private RSSObject rssObject;
63 | private Context mContext;
64 | private LayoutInflater inflater;
65 |
66 | public FeedAdapter(RSSObject rssObject, Context mContext) {
67 | this.rssObject = rssObject;
68 | this.mContext = mContext;
69 | inflater = LayoutInflater.from(mContext);
70 | }
71 |
72 | @Override
73 | public FeedViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
74 | View itemView = inflater.inflate(R.layout.row, parent, false);
75 | return new FeedViewHolder(itemView);
76 | }
77 |
78 | @Override
79 | public void onBindViewHolder(FeedViewHolder holder, int position) {
80 | holder.txtTitle.setText(rssObject.getItems().get(position).getTitle());
81 | holder.txtPubDate.setText(rssObject.getItems().get(position).getPubDate());
82 | holder.txtContent.setText(rssObject.getItems().get(position).getContent());
83 |
84 | holder.setItemClickListener(new ItemClickListener() {
85 | @Override
86 | public void onClick(View view, int position, boolean isLongCilck) {
87 | if (!isLongCilck) {
88 | // Intent browserIntent = new Intent(Intent.ACTION_VIEW,
89 | // Uri.parse(rssObject.getItems().get(position).getLink()));
90 | Intent intent = new Intent();
91 | intent.setClass(mContext, NewsDetail.class);
92 | intent.putExtra("com.example.androidrss.uri", rssObject.getItems().get(position).getLink());
93 | mContext.startActivity(intent);
94 | }
95 | }
96 | });
97 | }
98 |
99 | @Override
100 | public int getItemCount() {
101 | return rssObject.items.size();
102 | }
103 | }
104 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/androidrss/NewsList.java:
--------------------------------------------------------------------------------
1 | package com.example.androidrss;
2 |
3 | import android.app.ProgressDialog;
4 | import android.os.AsyncTask;
5 | import android.support.v7.app.AppCompatActivity;
6 | import android.os.Bundle;
7 | import android.support.v7.widget.LinearLayoutManager;
8 | import android.support.v7.widget.RecyclerView;
9 | import android.support.v7.widget.Toolbar;
10 | import android.view.Menu;
11 | import android.view.MenuItem;
12 |
13 | import com.example.androidrss.Adapter.FeedAdapter;
14 | import com.example.androidrss.Common.HTTPDataHandler;
15 | import com.example.androidrss.Common.DynamicTimeFormat;
16 | import com.example.androidrss.Model.RSSObject;
17 | import com.google.gson.Gson;
18 | import com.scwang.smartrefresh.layout.api.RefreshLayout;
19 | import com.scwang.smartrefresh.layout.header.ClassicsHeader;
20 | import com.scwang.smartrefresh.layout.listener.OnLoadmoreListener;
21 | import com.scwang.smartrefresh.layout.listener.OnRefreshListener;
22 |
23 | public class NewsList extends AppCompatActivity {
24 |
25 | Toolbar toolbar;
26 | RecyclerView recyclerView;
27 | RSSObject rssObject;
28 |
29 | // RSS link
30 | private final String RSS_link = "http://news.qq.com/newsgn/rss_newsgn.xml";
31 | private final String RSS_to_Json_API = "https://api.rss2json.com/v1/api.json?rss_url=";
32 |
33 |
34 | @Override
35 | protected void onCreate(Bundle savedInstanceState) {
36 | super.onCreate(savedInstanceState);
37 | setContentView(R.layout.activity_news_list);
38 |
39 | toolbar = (Toolbar)findViewById(R.id.toolbar);
40 | toolbar.setTitle("新闻助手");
41 | setSupportActionBar(toolbar);
42 |
43 | recyclerView = (RecyclerView)findViewById(R.id.recyclerView);
44 | LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getBaseContext(),
45 | LinearLayoutManager.VERTICAL, false);
46 | recyclerView.setLayoutManager(linearLayoutManager);
47 |
48 | RefreshLayout refreshLayout = (RefreshLayout)findViewById(R.id.refreshLayout);
49 | refreshLayout.setRefreshHeader(new ClassicsHeader(this).setTimeFormat(new DynamicTimeFormat("更新于 %s")));
50 |
51 | refreshLayout.setOnRefreshListener(new OnRefreshListener() {
52 | @Override
53 | public void onRefresh(RefreshLayout refreshlayout) {
54 | loadRSS();
55 | refreshlayout.finishRefresh(2000);
56 | }
57 | });
58 | refreshLayout.setOnLoadmoreListener(new OnLoadmoreListener() {
59 | @Override
60 | public void onLoadmore(RefreshLayout refreshlayout) {
61 | refreshlayout.finishLoadmore(2000);
62 | }
63 | });
64 |
65 |
66 | loadRSS();
67 | }
68 |
69 | private void loadRSS() {
70 | AsyncTask loadRSSAsync = new AsyncTask() {
71 |
72 | @Override
73 | protected String doInBackground(String... params) {
74 | String result;
75 | HTTPDataHandler http = new HTTPDataHandler();
76 | result = http.GetHTTPData(params[0]);
77 | return result;
78 | }
79 |
80 | @Override
81 | protected void onPostExecute(String s) {
82 | // mDialog.dismiss();
83 | rssObject = new Gson().fromJson(s, RSSObject.class);
84 | FeedAdapter adapter = new FeedAdapter(rssObject, getBaseContext());
85 | recyclerView.setAdapter(adapter);
86 | adapter.notifyDataSetChanged();
87 | }
88 | };
89 |
90 | StringBuilder url_get_data = new StringBuilder(RSS_to_Json_API);
91 | url_get_data.append(RSS_link);
92 | loadRSSAsync.execute(url_get_data.toString());
93 | }
94 |
95 | // @Override
96 | // public boolean onCreateOptionsMenu(Menu menu) {
97 | // getMenuInflater().inflate(R.menu.main_menu, menu);
98 | // return true;
99 | // }
100 |
101 | // @Override
102 | // public boolean onOptionsItemSelected(MenuItem item) {
103 | // if (item.getItemId() == R.id.menu_refresh)
104 | // loadRSS();
105 | // return true;
106 | // }
107 | }
108 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/androidrss/Common/DynamicTimeFormat.java:
--------------------------------------------------------------------------------
1 | package com.example.androidrss.Common;
2 |
3 |
4 | import android.support.annotation.NonNull;
5 |
6 | import java.text.FieldPosition;
7 | import java.text.SimpleDateFormat;
8 | import java.util.Calendar;
9 | import java.util.Date;
10 | import java.util.Locale;
11 |
12 | /**
13 | * 动态时间格式化
14 | * Created by SCWANG on 2017/6/17.
15 | */
16 |
17 | public class DynamicTimeFormat extends SimpleDateFormat {
18 |
19 | private static Locale locale = Locale.CHINA;
20 | private static String weeks[] = {"周日", "周一", "周二", "周三", "周四", "周五", "周六"};
21 | private static String moments[] = {"中午", "凌晨", "早上", "下午", "晚上"};
22 |
23 | private String mFormat = "%s";
24 |
25 | public DynamicTimeFormat() {
26 | this("%s", "yyyy年", "M月d日", "HH:mm");
27 | }
28 |
29 | public DynamicTimeFormat(String format) {
30 | this();
31 | this.mFormat = format;
32 | }
33 |
34 | public DynamicTimeFormat(String yearFormat, String dateFormat, String timeFormat) {
35 | super(String.format(locale, "%s %s %s", yearFormat, dateFormat, timeFormat), locale);
36 | }
37 |
38 | public DynamicTimeFormat(String format, String yearFormat, String dateFormat, String timeFormat) {
39 | this(yearFormat, dateFormat, timeFormat);
40 | this.mFormat = format;
41 | }
42 |
43 | @Override
44 | public StringBuffer format(@NonNull Date date, @NonNull StringBuffer toAppendTo, @NonNull FieldPosition pos) {
45 | toAppendTo = super.format(date, toAppendTo, pos);
46 |
47 | Calendar otherCalendar = calendar;
48 | Calendar todayCalendar = Calendar.getInstance();
49 |
50 | int hour = otherCalendar.get(Calendar.HOUR_OF_DAY);
51 |
52 | String[] times = toAppendTo.toString().split(" ");
53 | String moment = hour == 12 ? moments[0] : moments[hour / 6 + 1];
54 | String timeFormat = moment + " " + times[2];
55 | String dateFormat = times[1] + " " + timeFormat;
56 | String yearFormat = times[0] + dateFormat;
57 | toAppendTo.delete(0, toAppendTo.length());
58 |
59 | boolean yearTemp = todayCalendar.get(Calendar.YEAR) == otherCalendar.get(Calendar.YEAR);
60 | if (yearTemp) {
61 | int todayMonth = todayCalendar.get(Calendar.MONTH);
62 | int otherMonth = otherCalendar.get(Calendar.MONTH);
63 | if (todayMonth == otherMonth) {//表示是同一个月
64 | int temp = todayCalendar.get(Calendar.DATE) - otherCalendar.get(Calendar.DATE);
65 | switch (temp) {
66 | case 0:
67 | toAppendTo.append(timeFormat);
68 | break;
69 | case 1:
70 | toAppendTo.append("昨天 ");
71 | toAppendTo.append(timeFormat);
72 | break;
73 | case 2:
74 | toAppendTo.append("前天 ");
75 | toAppendTo.append(timeFormat);
76 | break;
77 | case 3:
78 | case 4:
79 | case 5:
80 | case 6:
81 | int dayOfMonth = otherCalendar.get(Calendar.WEEK_OF_MONTH);
82 | int todayOfMonth = todayCalendar.get(Calendar.WEEK_OF_MONTH);
83 | if (dayOfMonth == todayOfMonth) {//表示是同一周
84 | int dayOfWeek = otherCalendar.get(Calendar.DAY_OF_WEEK);
85 | if (dayOfWeek != 1) {//判断当前是不是星期日 如想显示为:周日 12:09 可去掉此判断
86 | toAppendTo.append(weeks[otherCalendar.get(Calendar.DAY_OF_WEEK) - 1]);
87 | toAppendTo.append(' ');
88 | toAppendTo.append(timeFormat);
89 | } else {
90 | toAppendTo.append(dateFormat);
91 | }
92 | } else {
93 | toAppendTo.append(dateFormat);
94 | }
95 | break;
96 | default:
97 | toAppendTo.append(dateFormat);
98 | break;
99 | }
100 | } else {
101 | toAppendTo.append(dateFormat);
102 | }
103 | } else {
104 | toAppendTo.append(yearFormat);
105 | }
106 |
107 | int length = toAppendTo.length();
108 | toAppendTo.append(String.format(locale, mFormat, toAppendTo.toString()));
109 | toAppendTo.delete(0, length);
110 | return toAppendTo;
111 | }
112 |
113 | }
114 |
115 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_launcher_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
10 |
15 |
20 |
25 |
30 |
35 |
40 |
45 |
50 |
55 |
60 |
65 |
70 |
75 |
80 |
85 |
90 |
95 |
100 |
105 |
110 |
115 |
120 |
125 |
130 |
135 |
140 |
145 |
150 |
155 |
160 |
165 |
170 |
171 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 |
2 | # Created by https://www.gitignore.io/api/android,androidstudio
3 |
4 | ### Android ###
5 | # Built application files
6 | *.apk
7 | *.ap_
8 |
9 | # Files for the ART/Dalvik VM
10 | *.dex
11 |
12 | # Java class files
13 | *.class
14 |
15 | # Generated files
16 | bin/
17 | gen/
18 | out/
19 |
20 | # Gradle files
21 | .gradle/
22 | build/
23 |
24 | # Local configuration file (sdk path, etc)
25 | local.properties
26 |
27 | # Proguard folder generated by Eclipse
28 | proguard/
29 |
30 | # Log Files
31 | *.log
32 |
33 | # Android Studio Navigation editor temp files
34 | .navigation/
35 |
36 | # Android Studio captures folder
37 | captures/
38 |
39 | # Intellij
40 | *.iml
41 | .idea/workspace.xml
42 | .idea/tasks.xml
43 | .idea/gradle.xml
44 | .idea/dictionaries
45 | .idea/libraries
46 |
47 | # External native build folder generated in Android Studio 2.2 and later
48 | .externalNativeBuild
49 |
50 | # Freeline
51 | freeline.py
52 | freeline/
53 | freeline_project_description.json
54 |
55 | ### Android Patch ###
56 | gen-external-apklibs
57 |
58 | ### AndroidStudio ###
59 | # Covers files to be ignored for android development using Android Studio.
60 |
61 | # Built application files
62 |
63 | # Files for the ART/Dalvik VM
64 |
65 | # Java class files
66 |
67 | # Generated files
68 |
69 | # Gradle files
70 | .gradle
71 |
72 | # Signing files
73 | .signing/
74 |
75 | # Local configuration file (sdk path, etc)
76 |
77 | # Proguard folder generated by Eclipse
78 |
79 | # Log Files
80 |
81 | # Android Studio
82 | /*/build/
83 | /*/local.properties
84 | /*/out
85 | /*/*/build
86 | /*/*/production
87 | *.ipr
88 | *~
89 | *.swp
90 |
91 | # Android Patch
92 |
93 | # External native build folder generated in Android Studio 2.2 and later
94 |
95 | # NDK
96 | obj/
97 |
98 | # IntelliJ IDEA
99 | *.iws
100 | /out/
101 |
102 | # User-specific configurations
103 | .idea/libraries/
104 | .idea/.name
105 | .idea/compiler.xml
106 | .idea/copyright/profiles_settings.xml
107 | .idea/encodings.xml
108 | .idea/misc.xml
109 | .idea/modules.xml
110 | .idea/scopes/scope_settings.xml
111 | .idea/vcs.xml
112 | .idea/jsLibraryMappings.xml
113 | .idea/datasources.xml
114 | .idea/dataSources.ids
115 | .idea/sqlDataSources.xml
116 | .idea/dynamic.xml
117 | .idea/uiDesigner.xml
118 |
119 | # OS-specific files
120 | .DS_Store
121 | .DS_Store?
122 | ._*
123 | .Spotlight-V100
124 | .Trashes
125 | ehthumbs.db
126 | Thumbs.db
127 |
128 | # Legacy Eclipse project files
129 | .classpath
130 | .project
131 |
132 | # Mobile Tools for Java (J2ME)
133 | .mtj.tmp/
134 |
135 | # Package Files #
136 | *.war
137 | *.ear
138 |
139 | # virtual machine crash logs (Reference: http://www.java.com/en/download/help/error_hotspot.xml)
140 | hs_err_pid*
141 |
142 | ## Plugin-specific files:
143 |
144 | # mpeltonen/sbt-idea plugin
145 | .idea_modules/
146 |
147 | # JIRA plugin
148 | atlassian-ide-plugin.xml
149 |
150 | # Mongo Explorer plugin
151 | .idea/mongoSettings.xml
152 |
153 | # Crashlytics plugin (for Android Studio and IntelliJ)
154 | com_crashlytics_export_strings.xml
155 | crashlytics.properties
156 | crashlytics-build.properties
157 | fabric.properties
158 |
159 | ### AndroidStudio Patch ###
160 |
161 | !/gradle/wrapper/gradle-wrapper.jar
162 |
163 | # End of https://www.gitignore.io/api/android,androidstudio
164 |
165 | # Created by https://www.gitignore.io/api/android,androidstudio
166 |
167 | ### Android ###
168 | # Built application files
169 | *.apk
170 | *.ap_
171 |
172 | # Files for the ART/Dalvik VM
173 | *.dex
174 |
175 | # Java class files
176 | *.class
177 |
178 | # Generated files
179 | bin/
180 | gen/
181 | out/
182 |
183 | # Gradle files
184 | .gradle/
185 | build/
186 |
187 | # Local configuration file (sdk path, etc)
188 | local.properties
189 |
190 | # Proguard folder generated by Eclipse
191 | proguard/
192 |
193 | # Log Files
194 | *.log
195 |
196 | # Android Studio Navigation editor temp files
197 | .navigation/
198 |
199 | # Android Studio captures folder
200 | captures/
201 |
202 | # Intellij
203 | *.iml
204 | .idea/workspace.xml
205 | .idea/tasks.xml
206 | .idea/gradle.xml
207 | .idea/dictionaries
208 | .idea/libraries
209 |
210 | # External native build folder generated in Android Studio 2.2 and later
211 | .externalNativeBuild
212 |
213 | # Freeline
214 | freeline.py
215 | freeline/
216 | freeline_project_description.json
217 |
218 | ### Android Patch ###
219 | gen-external-apklibs
220 |
221 | ### AndroidStudio ###
222 | # Covers files to be ignored for android development using Android Studio.
223 |
224 | # Built application files
225 |
226 | # Files for the ART/Dalvik VM
227 |
228 | # Java class files
229 |
230 | # Generated files
231 |
232 | # Gradle files
233 | .gradle
234 |
235 | # Signing files
236 | .signing/
237 |
238 | # Local configuration file (sdk path, etc)
239 |
240 | # Proguard folder generated by Eclipse
241 |
242 | # Log Files
243 |
244 | # Android Studio
245 | /*/build/
246 | /*/local.properties
247 | /*/out
248 | /*/*/build
249 | /*/*/production
250 | *.ipr
251 | *~
252 | *.swp
253 |
254 | # Android Patch
255 |
256 | # External native build folder generated in Android Studio 2.2 and later
257 |
258 | # NDK
259 | obj/
260 |
261 | # IntelliJ IDEA
262 | *.iws
263 | /out/
264 |
265 | # User-specific configurations
266 | .idea/libraries/
267 | .idea/.name
268 | .idea/compiler.xml
269 | .idea/copyright/profiles_settings.xml
270 | .idea/encodings.xml
271 | .idea/misc.xml
272 | .idea/modules.xml
273 | .idea/scopes/scope_settings.xml
274 | .idea/vcs.xml
275 | .idea/jsLibraryMappings.xml
276 | .idea/datasources.xml
277 | .idea/dataSources.ids
278 | .idea/sqlDataSources.xml
279 | .idea/dynamic.xml
280 | .idea/uiDesigner.xml
281 |
282 | # OS-specific files
283 | .DS_Store
284 | .DS_Store?
285 | ._*
286 | .Spotlight-V100
287 | .Trashes
288 | ehthumbs.db
289 | Thumbs.db
290 |
291 | # Legacy Eclipse project files
292 | .classpath
293 | .project
294 |
295 | # Mobile Tools for Java (J2ME)
296 | .mtj.tmp/
297 |
298 | # Package Files #
299 | *.war
300 | *.ear
301 |
302 | # virtual machine crash logs (Reference: http://www.java.com/en/download/help/error_hotspot.xml)
303 | hs_err_pid*
304 |
305 | ## Plugin-specific files:
306 |
307 | # mpeltonen/sbt-idea plugin
308 | .idea_modules/
309 |
310 | # JIRA plugin
311 | atlassian-ide-plugin.xml
312 |
313 | # Mongo Explorer plugin
314 | .idea/mongoSettings.xml
315 |
316 | # Crashlytics plugin (for Android Studio and IntelliJ)
317 | com_crashlytics_export_strings.xml
318 | crashlytics.properties
319 | crashlytics-build.properties
320 | fabric.properties
321 |
322 | ### AndroidStudio Patch ###
323 |
324 | !/gradle/wrapper/gradle-wrapper.jar
325 |
326 | # End of https://www.gitignore.io/api/android,androidstudio
327 |
--------------------------------------------------------------------------------