Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
reatiny committed Jul 2, 2019
0 parents commit 853a41c
Show file tree
Hide file tree
Showing 101 changed files with 4,786 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto
13 changes: 13 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
*.iml
.gradle
/local.properties
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store
/build
/captures
.externalNativeBuild
29 changes: 29 additions & 0 deletions .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions .idea/runConfigurations.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

174 changes: 174 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
# RSS

## util类

### RSSUtil(RSS解析)

* 入参

RSSUtil rssUtil=new RSSUtil("url");


RSSUtil rssUtil=new RSSUtil();

rssUtil.setRssUrl("url");

* 获取参数

1. 文章数:rssUtil.getFeedSize()
2. RSS标题:rssUtil.getTitleName()
3. RSS描述: rssUtil.getDescription()
4. 文章项:rssUtil.getRssItemBeans()

## 数据库类

### SSRUrlDAL(RSS源表)

**SSRUrlDAL dal=new SSRUrlDALImpl();**

1. 查询所有
```java
/**
* 查询表ssr_url全部内容
* @param rssUrlArrayList 必须保证传进 Adapter 的数据 List 是同一个 List
* @return rssUrlArrayList
*/
ArrayList<RSSUrl> getAllData(ArrayList<RSSUrl> rssUrlArrayList);
```

2. 获取所有已订阅内容

```java
ArrayList<RSSUrl> getSubscribe(ArrayList<RSSUrl> rssUrls);
```

2. 模糊查询
```java
/**
* 模糊查询
* @param rssUrlArrayList 必须保证传进 Adapter 的数据 List 是同一个 List
* @param query 输入的字符串
* @return rssUrlArrayList
*/
ArrayList<RSSUrl> getQueryData(ArrayList<RSSUrl> rssUrlArrayList, String query);
```
3. 查询ssr_url某一项的内容
```java
/**
* 查询ssr_url某一项的内容
* @param id 选中项的id
* @return 一项item
*/
RSSUrl getOneData(Integer id);
```
4. 添加
```java
/**
* 添加一个rss源
* @param url rss url
* @param groupName 组名,default=""
* @param status 订阅状态,主动添加时default=SUBSCRIBED
* @return 是否添加成功
*/
long insertOneData(String url, String groupName, SubscribeStatus status);
```
5. 添加
```java
/**
* 删除某项
* @param id 选中项的id
* @return 一项item
*/
int deleteOneData(Integer id);
```
6. 更改标题名
```java
/**
* 更改标题名
* @param id 选中项的id
* @param name 新的名字
* @return 是否成功
*/
int updateName(Integer id, String name);
```
7. 更改组名
```java
/**
* 更改组名
* @param id 选中项的id
* @param groupName 新的组名
* @return 是否成功
*/
int updateGroupName(Integer id, String groupName);
```
8. 更改订阅状态
```java
/**
* 更改订阅状态
* @param id 选中项的id
* @param status 订阅状态
* @return
*/
int updateSubscribeStatus(Integer id,SubscribeStatus status);
```

### FavorRSSItemDAL(收藏表项)

**FavorRSSItemDAL dal=new FavorRSSItemDALImpl()**

1. 查询表favor_ssr_item全部内容
```
/**
* 查询表favor_ssr_item全部内容
* @param favorRSSItems 必须保证传进 Adapter 的数据 List 是同一个 List
* @return rssUrlArrayList
*/
ArrayList<FavorRSSItem> getAllData(ArrayList<FavorRSSItem> favorRSSItems);
```
2. 模糊查询
```
/**
* 模糊查询|不实现
* @param rssUrlArrayList 必须保证传进 Adapter 的数据 List 是同一个 List
* @param query 输入的字符串
* @return rssUrlArrayList
*/
ArrayList<FavorRSSItem> getQueryData(ArrayList<FavorRSSItem> rssUrlArrayList, String query);
```
3. 查询favor_ssr_item某一项的内容
```
/**
* 查询favor_ssr_item某一项的内容
* @param id 选中项的id
* @return 一项item
*/
FavorRSSItem getOneData(Integer id);
```
4. 收藏
```
/**
* 收藏
* @param url 该item的url
* @param titleName 标题
* @param description 描述
* @return 是否添加成功
*/
long insertOneData(String url,String titleName,String description);
```
5. 取消收藏
```
/**
* 取消收藏
* @param id 选中项的id
* @return 一项item
*/
int deleteOneData(Integer id);
```

## 请注意

1. RSS解析的值可能带有html标签;
2. 更换gradle版本;
3. 注意bean和数据库类参数的不同;
4. 注意RSS解析的时间格式和数据库中的时间格式。
1 change: 1 addition & 0 deletions app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
36 changes: 36 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 28
defaultConfig {
applicationId "xyz.somelou.rss"
minSdkVersion 17
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:support-v4:28.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.android.support:design:28.0.0'

/**
* rome&jdom for rss
*/
implementation 'com.rometools:rome:1.7.0'

}
21 changes: 21 additions & 0 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package xyz.somelou.rss;

import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;

import org.junit.Test;
import org.junit.runner.RunWith;

import static org.junit.Assert.*;

/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();

assertEquals("xyz.somelou.rss", appContext.getPackageName());
}
}
29 changes: 29 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="xyz.somelou.rss">

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.SEND_SMS" />

<application
android:allowBackup="true"
android:icon="@mipmap/appicon"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".my.myGroup.MyGroupRecyclerActivity"
android:label="LinearLayoutManager" />
<activity android:name=".subscribe.channel.ChannelActivity" />
<activity android:name=".article.ArticleActivity" />
</application>

</manifest>
Loading

0 comments on commit 853a41c

Please sign in to comment.