Simple UI for Managing and Importing RSS Feeds

Closes #517
This commit is contained in:
Torsten Grote
2016-07-26 14:24:28 -03:00
parent 6454acdaa5
commit 62c1c3e08d
16 changed files with 809 additions and 9 deletions

View File

@@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:alpha="0.56"
android:viewportHeight="24.0"
android:viewportWidth="24.0">
<path
android:fillColor="#000000"
android:pathData="M6,19c0,1.1 0.9,2 2,2h8c1.1,0 2,-0.9 2,-2V7H6v12zM19,4h-3.5l-1,-1h-5l-1,1H5v2h14V4z"/>
</vector>

View File

@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="@dimen/margin_small"
tools:context=".android.blogs.RssFeedImportActivity">
<EditText
android:id="@+id/urlInput"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:gravity="top"
android:hint="@string/blogs_rss_feeds_import_hint"
android:inputType="textMultiLine|textUri"/>
<Button
android:id="@+id/importButton"
style="@style/BriarButton"
android:enabled="false"
android:text="@string/blogs_rss_feeds_import_button"/>
<ProgressBar
android:id="@+id/progressBar"
style="?android:attr/progressBarStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:visibility="gone"/>
</LinearLayout>

View File

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<org.briarproject.android.util.BriarRecyclerView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/feedList"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:scrollToEnd="false"
app:emptyText="@string/blogs_rss_feeds_manage_empty_state"
tools:listitem="@layout/list_item_rss_feed"/>

View File

@@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/listitem_horizontal_margin"
android:layout_marginStart="@dimen/listitem_horizontal_margin"
android:layout_marginTop="@dimen/listitem_horizontal_margin"
android:background="?attr/selectableItemBackground">
<TextView
android:id="@+id/titleView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:maxLines="2"
android:textColor="@color/briar_text_primary"
android:textSize="@dimen/text_size_medium"
tools:text="This is a name of a RSS Feed"/>
<ImageView
android:id="@+id/deleteButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_marginEnd="@dimen/listitem_horizontal_margin"
android:layout_marginRight="@dimen/listitem_horizontal_margin"
android:contentDescription="@string/delete_button"
android:src="@drawable/action_delete_black"/>
<TextView
android:id="@+id/author"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/titleView"
android:layout_marginRight="@dimen/margin_small"
android:paddingTop="@dimen/margin_tiny"
android:text="@string/blogs_rss_feeds_manage_author"
android:textColor="@color/briar_text_secondary"
android:textSize="@dimen/text_size_small"/>
<TextView
android:id="@+id/authorView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/author"
android:layout_marginEnd="@dimen/listitem_horizontal_margin"
android:layout_marginRight="@dimen/listitem_horizontal_margin"
android:layout_toRightOf="@+id/author"
android:textColor="@color/briar_text_secondary"
android:textSize="@dimen/text_size_small"
tools:text="Bruce Schneier"/>
<TextView
android:id="@+id/imported"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/author"
android:layout_marginRight="@dimen/margin_small"
android:paddingTop="@dimen/margin_tiny"
android:text="@string/blogs_rss_feeds_manage_imported"
android:textColor="@color/briar_text_secondary"
android:textSize="@dimen/text_size_small"/>
<TextView
android:id="@+id/importedView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/imported"
android:layout_marginEnd="@dimen/listitem_horizontal_margin"
android:layout_marginRight="@dimen/listitem_horizontal_margin"
android:layout_toRightOf="@+id/imported"
android:textColor="@color/briar_text_secondary"
android:textSize="@dimen/text_size_small"
tools:text="July 4"/>
<TextView
android:id="@+id/updated"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/imported"
android:layout_marginEnd="@dimen/listitem_horizontal_margin"
android:layout_marginRight="@dimen/margin_small"
android:paddingTop="@dimen/margin_tiny"
android:text="@string/blogs_rss_feeds_manage_updated"
android:textColor="@color/briar_text_secondary"
android:textSize="@dimen/text_size_small"/>
<TextView
android:id="@+id/updatedView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/updated"
android:layout_marginEnd="@dimen/listitem_horizontal_margin"
android:layout_marginRight="@dimen/listitem_horizontal_margin"
android:layout_toRightOf="@+id/updated"
android:textColor="@color/briar_text_secondary"
android:textSize="@dimen/text_size_small"
tools:text="5 min. ago"/>
<TextView
android:id="@+id/descriptionView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/updated"
android:layout_marginEnd="@dimen/listitem_horizontal_margin"
android:layout_marginRight="@dimen/listitem_horizontal_margin"
android:paddingTop="@dimen/margin_medium"
android:textColor="@color/briar_text_secondary"
android:textSize="@dimen/text_size_small"
tools:text="This is a description of the RSS feed. It can be several lines long, but it can also not exist at all if it is not present in the feed itself."/>
<View
style="@style/Divider.ForumList"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="@+id/descriptionView"
android:layout_marginTop="@dimen/listitem_horizontal_margin"/>
</RelativeLayout>

View File

@@ -9,4 +9,14 @@
android:title="@string/blogs_write_blog_post"
app:showAsAction="always"/>
<item
android:id="@+id/action_rss_feeds_import"
android:title="@string/blogs_rss_feeds_import"
app:showAsAction="never"/>
<item
android:id="@+id/action_rss_feeds_manage"
android:title="@string/blogs_rss_feeds_manage"
app:showAsAction="never"/>
</menu>

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<menu
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/action_rss_feeds_import"
android:icon="@drawable/ic_add_white"
android:title="@string/blogs_rss_feeds_import"
app:showAsAction="always"/>
</menu>

View File

@@ -2,6 +2,7 @@
<resources>
<declare-styleable name="BriarRecyclerView">
<attr name="scrollToEnd" format="boolean" />
<attr name="emptyText" format="string" />
</declare-styleable>
</resources>

View File

@@ -309,4 +309,17 @@
<string name="blogs_available_blogs">Available Blogs</string>
<string name="blogs_drafts">Drafts</string>
<!-- RSS Feeds -->
<string name="blogs_rss_feeds_import">Import RSS Feed</string>
<string name="blogs_rss_feeds_import_button">Import</string>
<string name="blogs_rss_feeds_import_hint">Enter the URL of the RSS feed</string>
<string name="blogs_rss_feeds_import_error">We are sorry! There was an error importing your feed.</string>
<string name="blogs_rss_feeds_manage">Manage RSS Feeds</string>
<string name="blogs_rss_feeds_manage_imported">Imported:</string>
<string name="blogs_rss_feeds_manage_author">Author:</string>
<string name="blogs_rss_feeds_manage_updated">Last Updated:</string>
<string name="blogs_rss_feeds_manage_delete_error">The feed could not be deleted!</string>
<string name="blogs_rss_feeds_manage_empty_state">You haven\'t imported any RSS feeds.\n\nWhy don\'t you click the plus in the top right screen corner to add your first?</string>
<string name="blogs_rss_feeds_manage_error">There was a problem loading your feeds. Please try again later.</string>
</resources>