mirror of https://github.com/readrops/Readrops.git
Fix rss 2.0 creator tag support and add it to the item activity
This commit is contained in:
parent
8bf62465ff
commit
cc88fc8334
|
@ -10,11 +10,13 @@ import android.support.v7.app.AppCompatActivity;
|
|||
import android.os.Bundle;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.webkit.WebSettings;
|
||||
import android.webkit.WebView;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.readrops.app.database.ItemWithFeed;
|
||||
import com.readrops.app.database.entities.Item;
|
||||
import com.readrops.app.utils.GlideApp;
|
||||
import com.readrops.app.utils.ReadropsWebView;
|
||||
|
@ -35,6 +37,10 @@ public class ItemActivity extends AppCompatActivity {
|
|||
private TextView author;
|
||||
private TextView readTime;
|
||||
|
||||
private CollapsingToolbarLayout toolbarLayout;
|
||||
private ReadropsWebView webView;
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
@ -50,7 +56,7 @@ public class ItemActivity extends AppCompatActivity {
|
|||
if (getSupportActionBar() != null)
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
CollapsingToolbarLayout toolbarLayout = findViewById(R.id.collapsing_layout);
|
||||
toolbarLayout = findViewById(R.id.collapsing_layout);
|
||||
AppBarLayout appBarLayout = findViewById(R.id.app_bar_layout);
|
||||
if (imageUrl == null)
|
||||
appBarLayout.setExpanded(false);
|
||||
|
@ -61,20 +67,26 @@ public class ItemActivity extends AppCompatActivity {
|
|||
.load(imageUrl)
|
||||
.into(imageView);
|
||||
|
||||
ReadropsWebView webView = findViewById(R.id.item_webview);
|
||||
webView = findViewById(R.id.item_webview);
|
||||
title = findViewById(R.id.activity_item_title);
|
||||
author = findViewById(R.id.activity_item_author);
|
||||
readTime = findViewById(R.id.activity_item_readtime);
|
||||
|
||||
viewModel = ViewModelProvider.AndroidViewModelFactory.getInstance(getApplication()).create(ItemViewModel.class);
|
||||
viewModel.getItemById(itemId).observe(this, itemWithFeed -> {
|
||||
Item item = itemWithFeed.getItem();
|
||||
viewModel.getItemById(itemId).observe(this, this::bindUI);
|
||||
}
|
||||
|
||||
toolbarLayout.setTitle(itemWithFeed.getFeedName());
|
||||
toolbar.setTitle(itemWithFeed.getFeedName());
|
||||
title.setText(item.getTitle());
|
||||
private void bindUI(ItemWithFeed itemWithFeed) {
|
||||
Item item = itemWithFeed.getItem();
|
||||
|
||||
webView.setItem(itemWithFeed);
|
||||
});
|
||||
toolbarLayout.setTitle(itemWithFeed.getFeedName());
|
||||
title.setText(item.getTitle());
|
||||
|
||||
if (item.getAuthor() != null) {
|
||||
author.setText(getString(R.string.by_author, item.getAuthor()));
|
||||
author.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
webView.setItem(itemWithFeed);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,5 +16,6 @@
|
|||
<string name="add_feed_no_result">Aucune adresse de flux trouvée</string>
|
||||
<string name="add_feed_connexion_error">Erreur de connexion au site</string>
|
||||
<string name="add_feed_unknownhost_error">Site inconnu</string>
|
||||
<string name="by_author">par %1$s</string>
|
||||
|
||||
</resources>
|
|
@ -17,4 +17,5 @@
|
|||
<string name="add_feed_no_result">No feed url found</string>
|
||||
<string name="add_feed_connexion_error">Connection error</string>
|
||||
<string name="add_feed_unknownhost_error">Unknown host</string>
|
||||
<string name="by_author">by %1$s</string>
|
||||
</resources>
|
||||
|
|
|
@ -25,7 +25,8 @@ public class RSSItem extends AItem {
|
|||
@Namespace(prefix = "media")
|
||||
private RSSMediaContent mediaContent;
|
||||
|
||||
@Element(name = "author", required = false)
|
||||
@Element(name = "creator", required = false)
|
||||
@Namespace(prefix = "dc", reference = "http://purl.org/dc/elements/1.1/")
|
||||
private String author;
|
||||
|
||||
@Element(name = "pubDate", required = false)
|
||||
|
|
Loading…
Reference in New Issue