Browse Source

- now shows the current filter on remote rss feeds in toolbar subtitle

- scroll to top after setting new remote rss items
- format the item timestamp
pull/313/head
twig 9 years ago
parent
commit
c16a0149fa
  1. 11
      app/src/main/java/org/transdroid/core/gui/remoterss/RemoteRssActivity.java
  2. 1
      app/src/main/java/org/transdroid/core/gui/remoterss/RemoteRssFragment.java
  3. 13
      app/src/main/java/org/transdroid/core/gui/remoterss/RemoteRssItemView.java

11
app/src/main/java/org/transdroid/core/gui/remoterss/RemoteRssActivity.java

@ -119,11 +119,11 @@ public class RemoteRssActivity extends AppCompatActivity {
ServerSetting lastUsed = applicationSettings.getLastUsedServer(); ServerSetting lastUsed = applicationSettings.getLastUsedServer();
currentConnection = lastUsed.createServerAdapter(connectivityHelper.getConnectedNetworkName(), this); currentConnection = lastUsed.createServerAdapter(connectivityHelper.getConnectedNetworkName(), this);
// Show all items
showRecentItems();
// Fill in the filter list // Fill in the filter list
showChannelFilters(); showChannelFilters();
// Show all items
showRecentItems();
} }
@ -172,6 +172,8 @@ public class RemoteRssActivity extends AppCompatActivity {
} }
fragmentRemoteRss.updateTorrentFiles(recentItems); fragmentRemoteRss.updateTorrentFiles(recentItems);
RemoteRssChannel channel = (RemoteRssChannel) drawerList.getAdapter().getItem(0);
getSupportActionBar().setSubtitle(channel.getName());
} }
protected void showChannelFilters() { protected void showChannelFilters() {
@ -200,6 +202,9 @@ public class RemoteRssActivity extends AppCompatActivity {
fragmentRemoteRss.updateTorrentFiles(feeds.get(position -1).getItems()); fragmentRemoteRss.updateTorrentFiles(feeds.get(position -1).getItems());
} }
RemoteRssChannel channel = (RemoteRssChannel) drawerList.getAdapter().getItem(position);
getSupportActionBar().setSubtitle(channel.getName());
drawerLayout.closeDrawers(); drawerLayout.closeDrawers();
} }

1
app/src/main/java/org/transdroid/core/gui/remoterss/RemoteRssFragment.java

@ -110,6 +110,7 @@ public class RemoteRssFragment extends Fragment {
public void updateTorrentFiles(List<RemoteRssItem> remoteRssFiles) { public void updateTorrentFiles(List<RemoteRssItem> remoteRssFiles) {
torrentFiles = new ArrayList<>(remoteRssFiles); torrentFiles = new ArrayList<>(remoteRssFiles);
adapter.updateFiles(torrentFiles); adapter.updateFiles(torrentFiles);
torrentsList.smoothScrollToPosition(0);
} }
@ItemClick(resName = "torrents_list") @ItemClick(resName = "torrents_list")

13
app/src/main/java/org/transdroid/core/gui/remoterss/RemoteRssItemView.java

@ -17,6 +17,7 @@
package org.transdroid.core.gui.remoterss; package org.transdroid.core.gui.remoterss;
import android.content.Context; import android.content.Context;
import android.text.format.DateFormat;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.TextView; import android.widget.TextView;
@ -41,10 +42,14 @@ public class RemoteRssItemView extends LinearLayout {
super(context); super(context);
} }
public void bind(RemoteRssItem file) { public void bind(RemoteRssItem item) {
nameText.setText(file.getName()); labelText.setText(item.getSourceName());
dateText.setText(String.valueOf(file.getTimestamp())); nameText.setText(item.getName());
labelText.setText(file.getSourceName()); dateText.setText(
DateFormat.getDateFormat(getContext()).format(item.getTimestamp()) +
" " +
DateFormat.getTimeFormat(getContext()).format(item.getTimestamp())
);
} }
} }

Loading…
Cancel
Save