Browse Source
- added test menu to access it - now parses uTorrent server RSS feeds/itemspull/313/head
twig
9 years ago
13 changed files with 1074 additions and 1 deletions
@ -0,0 +1,317 @@
@@ -0,0 +1,317 @@
|
||||
/* |
||||
* Copyright 2010-2013 Eric Kok et al. |
||||
* |
||||
* Transdroid is free software: you can redistribute it and/or modify |
||||
* it under the terms of the GNU General Public License as published by |
||||
* the Free Software Foundation, either version 3 of the License, or |
||||
* (at your option) any later version. |
||||
* |
||||
* Transdroid is distributed in the hope that it will be useful, |
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
* GNU General Public License for more details. |
||||
* |
||||
* You should have received a copy of the GNU General Public License |
||||
* along with Transdroid. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/ |
||||
package org.transdroid.core.gui.remoterss; |
||||
|
||||
import android.annotation.TargetApi; |
||||
import android.content.Intent; |
||||
import android.os.Build; |
||||
import android.os.Bundle; |
||||
import android.support.v7.app.AppCompatActivity; |
||||
import android.support.v7.widget.Toolbar; |
||||
|
||||
import org.androidannotations.annotations.AfterViews; |
||||
import org.androidannotations.annotations.EActivity; |
||||
import org.androidannotations.annotations.Extra; |
||||
import org.androidannotations.annotations.FragmentById; |
||||
import org.androidannotations.annotations.InstanceState; |
||||
import org.androidannotations.annotations.OptionsItem; |
||||
import org.androidannotations.annotations.OptionsMenu; |
||||
import org.androidannotations.annotations.ViewById; |
||||
import org.transdroid.R; |
||||
import org.transdroid.core.app.settings.SystemSettings_; |
||||
import org.transdroid.core.gui.TorrentsActivity; |
||||
import org.transdroid.core.gui.TorrentsActivity_; |
||||
import org.transdroid.daemon.Utorrent.data.UTorrentRssFeed; |
||||
|
||||
import java.util.ArrayList; |
||||
|
||||
/** |
||||
* An activity that holds a single torrents details fragment. It is used on devices (i.e. phones) where there is no room to show details in the {@link |
||||
* TorrentsActivity} directly. Task execution, such as loading of more details and updating file priorities, is performed in this activity via |
||||
* background methods. |
||||
* @author Eric Kok |
||||
*/ |
||||
@EActivity(R.layout.activity_remoterss) |
||||
@OptionsMenu(R.menu.activity_details) |
||||
public class RemoteRssActivity extends AppCompatActivity { |
||||
@Extra |
||||
@InstanceState |
||||
protected ArrayList<UTorrentRssFeed> feeds; |
||||
|
||||
// Settings
|
||||
// private IDaemonAdapter currentConnection = null;
|
||||
|
||||
// Details view components
|
||||
@ViewById |
||||
protected Toolbar torrentsToolbar; |
||||
|
||||
@FragmentById(R.id.remoterss_fragment) |
||||
protected RemoteRssFragment fragmentRemoteRss; |
||||
|
||||
@Override |
||||
public void onCreate(Bundle savedInstanceState) { |
||||
// Set the theme according to the user preference
|
||||
if (SystemSettings_.getInstance_(this).useDarkTheme()) { |
||||
setTheme(R.style.TransdroidTheme_Dark); |
||||
} |
||||
super.onCreate(savedInstanceState); |
||||
} |
||||
|
||||
@AfterViews |
||||
protected void init() { |
||||
|
||||
// We require feeds to be specified; otherwise close the activity
|
||||
if (feeds == null) { |
||||
finish(); |
||||
return; |
||||
} |
||||
|
||||
// Simple action bar with up, torrent name as title and refresh button
|
||||
setSupportActionBar(torrentsToolbar); |
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true); |
||||
// getSupportActionBar().setTitle(NavigationHelper.buildCondensedFontString(torrent.getName()));
|
||||
|
||||
// // Connect to the last used server
|
||||
// ServerSetting lastUsed = applicationSettings.getLastUsedServer();
|
||||
// fragmentDetails.setCurrentServerSettings(lastUsed);
|
||||
// currentConnection = lastUsed.createServerAdapter(connectivityHelper.getConnectedNetworkName(), this);
|
||||
|
||||
// // Show details and load fine stats and torrent files
|
||||
// fragmentDetails.updateTorrent(torrent);
|
||||
// fragmentDetails.updateLabels(currentLabels);
|
||||
|
||||
// TODO: show all items
|
||||
fragmentRemoteRss.updateTorrentFiles(feeds.get(0).files); |
||||
} |
||||
|
||||
@TargetApi(Build.VERSION_CODES.HONEYCOMB) |
||||
@OptionsItem(android.R.id.home) |
||||
protected void navigateUp() { |
||||
TorrentsActivity_.intent(this) |
||||
.flags(Intent.FLAG_ACTIVITY_CLEAR_TOP) |
||||
.start(); |
||||
} |
||||
|
||||
// @OptionsItem(R.id.action_refresh)
|
||||
// public void refreshScreen() {
|
||||
// fragmentRemoteRss.updateIsLoading(true, null);
|
||||
// refreshTorrent();
|
||||
// refreshTorrentDetails(torrent);
|
||||
// refreshTorrentFiles(torrent);
|
||||
// }
|
||||
|
||||
// @Background
|
||||
// protected void refreshTorrent() {
|
||||
// DaemonTaskResult result = RetrieveTask.create(currentConnection).execute(log);
|
||||
// if (result instanceof RetrieveTaskSuccessResult) {
|
||||
// onTorrentsRetrieved(((RetrieveTaskSuccessResult) result).getTorrents(), ((RetrieveTaskSuccessResult) result).getLabels());
|
||||
// } else {
|
||||
// onCommunicationError((DaemonTaskFailureResult) result, true);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Background
|
||||
// public void refreshTorrentDetails(Torrent torrent) {
|
||||
// if (!Daemon.supportsFineDetails(torrent.getDaemon())) {
|
||||
// return;
|
||||
// }
|
||||
// DaemonTaskResult result = GetTorrentDetailsTask.create(currentConnection, torrent).execute(log);
|
||||
// if (result instanceof GetTorrentDetailsTaskSuccessResult) {
|
||||
// onTorrentDetailsRetrieved(torrent, ((GetTorrentDetailsTaskSuccessResult) result).getTorrentDetails());
|
||||
// } else {
|
||||
// onCommunicationError((DaemonTaskFailureResult) result, false);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Background
|
||||
// public void refreshTorrentFiles(Torrent torrent) {
|
||||
// if (!Daemon.supportsFileListing(torrent.getDaemon())) {
|
||||
// return;
|
||||
// }
|
||||
// DaemonTaskResult result = GetFileListTask.create(currentConnection, torrent).execute(log);
|
||||
// if (result instanceof GetFileListTaskSuccessResult) {
|
||||
// onTorrentFilesRetrieved(torrent, ((GetFileListTaskSuccessResult) result).getFiles());
|
||||
// } else {
|
||||
// onCommunicationError((DaemonTaskFailureResult) result, false);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Background
|
||||
// @Override
|
||||
// public void resumeTorrent(Torrent torrent) {
|
||||
// torrent.mimicResume();
|
||||
// DaemonTaskResult result = ResumeTask.create(currentConnection, torrent).execute(log);
|
||||
// if (result instanceof DaemonTaskSuccessResult) {
|
||||
// onTaskSucceeded((DaemonTaskSuccessResult) result, getString(R.string.result_resumed, torrent.getName()));
|
||||
// } else {
|
||||
// onCommunicationError((DaemonTaskFailureResult) result, false);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Background
|
||||
// @Override
|
||||
// public void pauseTorrent(Torrent torrent) {
|
||||
// torrent.mimicPause();
|
||||
// DaemonTaskResult result = PauseTask.create(currentConnection, torrent).execute(log);
|
||||
// if (result instanceof DaemonTaskSuccessResult) {
|
||||
// onTaskSucceeded((DaemonTaskSuccessResult) result, getString(R.string.result_paused, torrent.getName()));
|
||||
// } else {
|
||||
// onCommunicationError((DaemonTaskFailureResult) result, false);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Background
|
||||
// @Override
|
||||
// public void startTorrent(Torrent torrent, boolean forced) {
|
||||
// torrent.mimicStart();
|
||||
// DaemonTaskResult result = StartTask.create(currentConnection, torrent, forced).execute(log);
|
||||
// if (result instanceof DaemonTaskSuccessResult) {
|
||||
// onTaskSucceeded((DaemonTaskSuccessResult) result, getString(R.string.result_started, torrent.getName()));
|
||||
// } else {
|
||||
// onCommunicationError((DaemonTaskFailureResult) result, false);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Background
|
||||
// @Override
|
||||
// public void stopTorrent(Torrent torrent) {
|
||||
// torrent.mimicStop();
|
||||
// DaemonTaskResult result = StopTask.create(currentConnection, torrent).execute(log);
|
||||
// if (result instanceof DaemonTaskSuccessResult) {
|
||||
// onTaskSucceeded((DaemonTaskSuccessResult) result, getString(R.string.result_stopped, torrent.getName()));
|
||||
// } else {
|
||||
// onCommunicationError((DaemonTaskFailureResult) result, false);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Background
|
||||
// @Override
|
||||
// public void removeTorrent(Torrent torrent, boolean withData) {
|
||||
// DaemonTaskResult result = RemoveTask.create(currentConnection, torrent, withData).execute(log);
|
||||
// if (result instanceof DaemonTaskSuccessResult) {
|
||||
// // Close the details activity (as the torrent is now removed)
|
||||
// closeActivity(getString(withData ? R.string.result_removed_with_data : R.string.result_removed, torrent.getName()));
|
||||
// } else {
|
||||
// onCommunicationError((DaemonTaskFailureResult) result, false);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @UiThread
|
||||
// protected void closeActivity(String closeText) {
|
||||
// setResult(RESULT_OK, new Intent().putExtra("torrent_removed", true).putExtra("affected_torrent", torrent));
|
||||
// finish();
|
||||
// if (closeText != null) {
|
||||
// SnackbarManager.show(Snackbar.with(this).text(closeText));
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Background
|
||||
// @Override
|
||||
// public void updateLabel(Torrent torrent, String newLabel) {
|
||||
// torrent.mimicNewLabel(newLabel);
|
||||
// DaemonTaskResult result = SetLabelTask.create(currentConnection, torrent, newLabel == null ? "" : newLabel).execute(log);
|
||||
// if (result instanceof DaemonTaskSuccessResult) {
|
||||
// onTaskSucceeded((DaemonTaskSuccessResult) result, getString(R.string.result_labelset, newLabel));
|
||||
// } else {
|
||||
// onCommunicationError((DaemonTaskFailureResult) result, false);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Background
|
||||
// @Override
|
||||
// public void forceRecheckTorrent(Torrent torrent) {
|
||||
// torrent.mimicCheckingStatus();
|
||||
// DaemonTaskResult result = ForceRecheckTask.create(currentConnection, torrent).execute(log);
|
||||
// if (result instanceof DaemonTaskSuccessResult) {
|
||||
// onTaskSucceeded((DaemonTaskSuccessResult) result, getString(R.string.result_recheckedstarted, torrent.getName()));
|
||||
// } else {
|
||||
// onCommunicationError((DaemonTaskFailureResult) result, false);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Background
|
||||
// @Override
|
||||
// public void updateTrackers(Torrent torrent, List<String> newTrackers) {
|
||||
// DaemonTaskResult result = SetTrackersTask.create(currentConnection, torrent, newTrackers).execute(log);
|
||||
// if (result instanceof DaemonTaskSuccessResult) {
|
||||
// onTaskSucceeded((DaemonTaskSuccessResult) result, getString(R.string.result_trackersupdated));
|
||||
// } else {
|
||||
// onCommunicationError((DaemonTaskFailureResult) result, false);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Background
|
||||
// @Override
|
||||
// public void updateLocation(Torrent torrent, String newLocation) {
|
||||
// DaemonTaskResult result = SetDownloadLocationTask.create(currentConnection, torrent, newLocation).execute(log);
|
||||
// if (result instanceof DaemonTaskSuccessResult) {
|
||||
// onTaskSucceeded((DaemonTaskSuccessResult) result, getString(R.string.result_locationset, newLocation));
|
||||
// } else {
|
||||
// onCommunicationError((DaemonTaskFailureResult) result, false);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Background
|
||||
// @Override
|
||||
// public void updatePriority(Torrent torrent, List<TorrentFile> files, Priority priority) {
|
||||
// DaemonTaskResult result = SetFilePriorityTask.create(currentConnection, torrent, priority, new ArrayList<>(files)).execute(log);
|
||||
// if (result instanceof DaemonTaskSuccessResult) {
|
||||
// onTaskSucceeded((DaemonTaskSuccessResult) result, getString(R.string.result_priotitiesset));
|
||||
// } else {
|
||||
// onCommunicationError((DaemonTaskFailureResult) result, false);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @UiThread
|
||||
// protected void onTaskSucceeded(DaemonTaskSuccessResult result, String successMessage) {
|
||||
// // Set the activity result so the calling activity knows it needs to update its view
|
||||
// setResult(RESULT_OK, new Intent().putExtra("torrent_updated", true).putExtra("affected_torrent", torrent));
|
||||
// // Refresh the screen as well
|
||||
// refreshTorrent();
|
||||
// refreshTorrentDetails(torrent);
|
||||
// SnackbarManager.show(Snackbar.with(this).text(successMessage));
|
||||
// }
|
||||
//
|
||||
// @UiThread
|
||||
// protected void onTorrentDetailsRetrieved(Torrent torrent, TorrentDetails torrentDetails) {
|
||||
// // Update the details fragment with the new fine details for the shown torrent
|
||||
// fragmentDetails.updateTorrentDetails(torrent, torrentDetails);
|
||||
// }
|
||||
//
|
||||
// @UiThread
|
||||
// protected void onTorrentFilesRetrieved(Torrent torrent, List<TorrentFile> torrentFiles) {
|
||||
// // Update the details fragment with the newly retrieved list of files
|
||||
// fragmentDetails.updateTorrentFiles(torrent, new ArrayList<>(torrentFiles));
|
||||
// }
|
||||
//
|
||||
// @UiThread
|
||||
// protected void onCommunicationError(DaemonTaskFailureResult result, boolean isCritical) {
|
||||
// log.i(this, result.getException().toString());
|
||||
// String error = getString(LocalTorrent.getResourceForDaemonException(result.getException()));
|
||||
// fragmentDetails.updateIsLoading(false, isCritical ? error : null);
|
||||
// SnackbarManager.show(Snackbar.with(this).text(getString(LocalTorrent.getResourceForDaemonException(result.getException())))
|
||||
// .colorResource(R.color.red));
|
||||
// }
|
||||
//
|
||||
// @UiThread
|
||||
// protected void onTorrentsRetrieved(List<Torrent> torrents, List<org.transdroid.daemon.Label> labels) {
|
||||
// // Update the details fragment accordingly
|
||||
// fragmentDetails.updateIsLoading(false, null);
|
||||
// fragmentDetails.perhapsUpdateTorrent(torrents);
|
||||
// fragmentDetails.updateLabels(Label.convertToNavigationLabels(labels, getResources().getString(R.string.labels_unlabeled)));
|
||||
// }
|
||||
} |
@ -0,0 +1,57 @@
@@ -0,0 +1,57 @@
|
||||
package org.transdroid.core.gui.remoterss; |
||||
|
||||
import android.content.Context; |
||||
import android.view.View; |
||||
import android.view.ViewGroup; |
||||
import android.widget.BaseAdapter; |
||||
|
||||
import org.transdroid.daemon.Utorrent.data.RemoteRssFile; |
||||
|
||||
import java.util.ArrayList; |
||||
import java.util.List; |
||||
|
||||
public class RemoteRssFilesAdapter extends BaseAdapter { |
||||
protected Context context; |
||||
protected List<RemoteRssFile> files; |
||||
|
||||
public RemoteRssFilesAdapter(Context context) { |
||||
this.context = context; |
||||
files = new ArrayList<>(); |
||||
} |
||||
|
||||
@Override |
||||
public int getCount() { |
||||
return files.size(); |
||||
} |
||||
|
||||
@Override |
||||
public Object getItem(int position) { |
||||
return files.get(position); |
||||
} |
||||
|
||||
@Override |
||||
public long getItemId(int position) { |
||||
return position; |
||||
} |
||||
|
||||
@Override |
||||
public View getView(int position, View convertView, ViewGroup parent) { |
||||
RemoteRssItemView itemView; |
||||
|
||||
if (convertView == null) { |
||||
itemView = RemoteRssItemView_.build(context); |
||||
} |
||||
else { |
||||
itemView = (RemoteRssItemView) convertView; |
||||
} |
||||
|
||||
itemView.bind((RemoteRssFile) getItem(position)); |
||||
|
||||
return itemView; |
||||
} |
||||
|
||||
public void updateFiles(List<RemoteRssFile> torrentFiles) { |
||||
files = torrentFiles; |
||||
notifyDataSetChanged(); |
||||
} |
||||
} |
@ -0,0 +1,138 @@
@@ -0,0 +1,138 @@
|
||||
/* |
||||
* Copyright 2010-2013 Eric Kok et al. |
||||
* |
||||
* Transdroid is free software: you can redistribute it and/or modify |
||||
* it under the terms of the GNU General Public License as published by |
||||
* the Free Software Foundation, either version 3 of the License, or |
||||
* (at your option) any later version. |
||||
* |
||||
* Transdroid is distributed in the hope that it will be useful, |
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
* GNU General Public License for more details. |
||||
* |
||||
* You should have received a copy of the GNU General Public License |
||||
* along with Transdroid. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/ |
||||
package org.transdroid.core.gui.remoterss; |
||||
|
||||
|
||||
import android.app.Fragment; |
||||
import android.support.v4.widget.SwipeRefreshLayout; |
||||
import android.support.v7.widget.ActionMenuView; |
||||
import android.view.View; |
||||
import android.widget.ListView; |
||||
|
||||
import org.androidannotations.annotations.AfterViews; |
||||
import org.androidannotations.annotations.EFragment; |
||||
import org.androidannotations.annotations.InstanceState; |
||||
import org.androidannotations.annotations.ItemClick; |
||||
import org.androidannotations.annotations.ViewById; |
||||
import org.transdroid.R; |
||||
import org.transdroid.daemon.Utorrent.data.RemoteRssFile; |
||||
|
||||
import java.util.ArrayList; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* Fragment that shows detailed statistics about some torrent. These come from some already fetched {@link Torrent} object, but it also retrieves |
||||
* further detailed statistics. The actual execution of tasks is performed by the activity that contains this fragment, as per the {@link |
||||
* TorrentTasksExecutor} interface. |
||||
* @author Eric Kok |
||||
*/ |
||||
@EFragment(R.layout.fragment_remoterss) |
||||
public class RemoteRssFragment extends Fragment { |
||||
|
||||
// Local data
|
||||
@InstanceState |
||||
protected ArrayList<RemoteRssFile> torrentFiles; |
||||
|
||||
// Views
|
||||
@ViewById |
||||
protected View detailsContainer; |
||||
@ViewById(R.id.contextual_menu) |
||||
protected ActionMenuView contextualMenu; |
||||
@ViewById |
||||
protected SwipeRefreshLayout swipeRefreshLayout; |
||||
@ViewById |
||||
protected ListView torrentsList; |
||||
|
||||
protected RemoteRssFilesAdapter adapter; |
||||
|
||||
@AfterViews |
||||
protected void init() { |
||||
|
||||
// Inject menu options in the actions toolbar
|
||||
setHasOptionsMenu(true); |
||||
|
||||
// // On large screens where this fragment is shown next to the torrents list, we show a continues grey vertical
|
||||
// // line to separate the lists visually
|
||||
// if (!NavigationHelper_.getInstance_(getActivity()).isSmallScreen()) {
|
||||
// if (SystemSettings_.getInstance_(getActivity()).useDarkTheme()) {
|
||||
// detailsContainer.setBackgroundResource(R.drawable.details_list_background_dark);
|
||||
// } else {
|
||||
// detailsContainer.setBackgroundResource(R.drawable.details_list_background_light);
|
||||
// }
|
||||
// }
|
||||
|
||||
// if (getActivity() != null && getActivity() instanceof RefreshableActivity) {
|
||||
// swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
|
||||
// @Override
|
||||
// public void onRefresh() {
|
||||
// ((RefreshableActivity) getActivity()).refreshScreen();
|
||||
// swipeRefreshLayout.setRefreshing(false); // Use our custom indicator
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
|
||||
// Set up details adapter (itself containing the actual lists to show), which allows multi-select and fast
|
||||
// scrolling
|
||||
adapter = new RemoteRssFilesAdapter(getActivity()); |
||||
torrentsList.setAdapter(adapter); |
||||
torrentsList.setFastScrollEnabled(true); |
||||
|
||||
// Restore the fragment state (on orientation changes et al.)
|
||||
if (torrentFiles != null) { |
||||
updateTorrentFiles(torrentFiles); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* Updates the list adapter to show a new list of torrent files, replacing the old files list. |
||||
* @param checkTorrent The torrent for which the details were retrieved |
||||
* @param newTorrentFiles The new, updated list of torrent file objects |
||||
*/ |
||||
public void updateTorrentFiles(List<RemoteRssFile> remoteRssFiles) { |
||||
torrentFiles = new ArrayList<>(remoteRssFiles); |
||||
adapter.updateFiles(torrentFiles); |
||||
} |
||||
|
||||
@ItemClick(resName = "torrents_list") |
||||
protected void detailsListClicked(int position) { |
||||
torrentsList.setItemChecked(position, false); |
||||
} |
||||
|
||||
// @Override
|
||||
// public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
||||
// super.onCreateOptionsMenu(menu, inflater);
|
||||
//
|
||||
// inflater.inflate(R.menu.fragment_details, menu);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean onOptionsItemSelected(MenuItem item) {
|
||||
// switch (item.getItemId()) {
|
||||
// case R.id.action_start_default:
|
||||
//// startTorrentDefault();
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// return super.onOptionsItemSelected(item);
|
||||
// }
|
||||
|
||||
// @OptionsItem(R.id.action_start_default)
|
||||
// protected void startTorrentDefault() {
|
||||
// if (getTasksExecutor() != null)
|
||||
// getTasksExecutor().startTorrent(torrent, false);
|
||||
// }
|
||||
} |
@ -0,0 +1,50 @@
@@ -0,0 +1,50 @@
|
||||
/* |
||||
* Copyright 2010-2013 Eric Kok et al. |
||||
* |
||||
* Transdroid is free software: you can redistribute it and/or modify |
||||
* it under the terms of the GNU General Public License as published by |
||||
* the Free Software Foundation, either version 3 of the License, or |
||||
* (at your option) any later version. |
||||
* |
||||
* Transdroid is distributed in the hope that it will be useful, |
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
* GNU General Public License for more details. |
||||
* |
||||
* You should have received a copy of the GNU General Public License |
||||
* along with Transdroid. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/ |
||||
package org.transdroid.core.gui.remoterss; |
||||
|
||||
import android.content.Context; |
||||
import android.widget.LinearLayout; |
||||
import android.widget.TextView; |
||||
|
||||
import org.androidannotations.annotations.EViewGroup; |
||||
import org.androidannotations.annotations.ViewById; |
||||
import org.transdroid.R; |
||||
import org.transdroid.core.app.settings.RssfeedSetting; |
||||
import org.transdroid.daemon.Utorrent.data.RemoteRssFile; |
||||
|
||||
/** |
||||
* View that represents some {@link RssfeedSetting} object and displays name as well as loads a favicon for the feed's site and can load how many new |
||||
* items are available. |
||||
* @author Eric Kok |
||||
*/ |
||||
@EViewGroup(R.layout.list_item_remoterssitem) |
||||
public class RemoteRssItemView extends LinearLayout { |
||||
// Views
|
||||
@ViewById |
||||
protected TextView nameText, dateText, labelText; |
||||
|
||||
public RemoteRssItemView(Context context) { |
||||
super(context); |
||||
} |
||||
|
||||
public void bind(RemoteRssFile file) { |
||||
nameText.setText(file.getName()); |
||||
dateText.setText(String.valueOf(file.timestamp)); |
||||
labelText.setText(file.feedLabel); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,69 @@
@@ -0,0 +1,69 @@
|
||||
package org.transdroid.daemon.Utorrent.data; |
||||
|
||||
import android.os.Parcel; |
||||
import android.os.Parcelable; |
||||
|
||||
import org.json.JSONArray; |
||||
import org.json.JSONException; |
||||
import org.transdroid.core.gui.lists.SimpleListItem; |
||||
|
||||
public class RemoteRssFile implements Parcelable, SimpleListItem { |
||||
public String name; |
||||
public String title; |
||||
public String link; |
||||
public String feedLabel; |
||||
public long timestamp; |
||||
public int season; |
||||
public int episode; |
||||
|
||||
public RemoteRssFile(JSONArray json) throws JSONException { |
||||
name = json.getString(0); |
||||
title = json.getString(1); |
||||
link = json.getString(2); |
||||
timestamp = json.getLong(5); |
||||
season = json.getInt(6); |
||||
episode = json.getInt(7); |
||||
} |
||||
|
||||
|
||||
public static final Parcelable.Creator<RemoteRssFile> CREATOR = new Parcelable.Creator<RemoteRssFile>() { |
||||
public RemoteRssFile createFromParcel(Parcel in) { |
||||
return new RemoteRssFile(in); |
||||
} |
||||
|
||||
public RemoteRssFile[] newArray(int size) { |
||||
return new RemoteRssFile[size]; |
||||
} |
||||
}; |
||||
|
||||
public RemoteRssFile(Parcel in) { |
||||
name = in.readString(); |
||||
title = in.readString(); |
||||
link = in.readString(); |
||||
feedLabel = in.readString(); |
||||
timestamp = in.readLong(); |
||||
season = in.readInt(); |
||||
episode = in.readInt(); |
||||
} |
||||
|
||||
@Override |
||||
public int describeContents() { |
||||
return 0; |
||||
} |
||||
|
||||
@Override |
||||
public void writeToParcel(Parcel dest, int flags) { |
||||
dest.writeString(name); |
||||
dest.writeString(title); |
||||
dest.writeString(link); |
||||
dest.writeString(feedLabel); |
||||
dest.writeLong(timestamp); |
||||
dest.writeInt(season); |
||||
dest.writeInt(episode); |
||||
} |
||||
|
||||
@Override |
||||
public String getName() { |
||||
return title; |
||||
} |
||||
} |
@ -0,0 +1,169 @@
@@ -0,0 +1,169 @@
|
||||
package org.transdroid.daemon.Utorrent.data; |
||||
|
||||
import android.os.Parcel; |
||||
import android.os.Parcelable; |
||||
import android.util.Log; |
||||
|
||||
import org.json.JSONArray; |
||||
import org.json.JSONException; |
||||
|
||||
import java.util.ArrayList; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* Created by twig on 29/05/2016. |
||||
*/ |
||||
public class UTorrentRssFeed implements Parcelable { |
||||
/** |
||||
* [ |
||||
* 1, // id?
|
||||
* true, // enabled
|
||||
* false, // false = use custom alias
|
||||
* false, // ?
|
||||
* false, // ?
|
||||
* 0, // ?
|
||||
* "Castle|http:\/\/showrss.info\/show\/53.rss", // Custom alias|url or url
|
||||
* 1464520989, // las updated?
|
||||
* [ // Files
|
||||
* [ |
||||
* "Castle 2009 Crossfire", // name?
|
||||
* "Castle (2009) 8x22 Crossfire", // Title
|
||||
* // link
|
||||
* "magnet:?xt=urn:btih:58E032D0B2E595393828FAED47224B3A2C9CCFE6&dn=Castle+2009+S08E22+HDTV+x264+LOL&tr=udp:\/\/tracker.coppersurfer.tk:6969\/announce&tr=udp:\/\/tracker.leechers-paradise.org:6969&tr=udp:\/\/open.demonii.com:1337", |
||||
* 0, |
||||
* 0, |
||||
* 1463455205, // timestamp
|
||||
* 8, // season
|
||||
* 22, // episode
|
||||
* 0, |
||||
* 1, |
||||
* false, |
||||
* false |
||||
* ], |
||||
* [ |
||||
* "Castle 2009 Crossfire", |
||||
* "Castle (2009) 8x22 Crossfire 720p", |
||||
* "magnet:?xt=urn:btih:6E7764AA9CB23A84914FDB1206A2CD7887CCD622&dn=Castle+2009+S08E22+720p+HDTV+X264+DIMENSION&tr=udp:\/\/tracker.coppersurfer.tk:6969\/announce&tr=udp:\/\/tracker.leechers-paradise.org:6969&tr=udp:\/\/open.demonii.com:1337", |
||||
* 12, |
||||
* 0, |
||||
* 1463455205, |
||||
* 8, |
||||
* 22, |
||||
* 0, |
||||
* 1, |
||||
* false, |
||||
* false |
||||
* ], |
||||
* ["Castle 2009 Hell to Pay","Castle (2009) 8x21 Hell to Pay 720p","magnet:?xt=urn:btih:2436547E7A13201C9A3E9409C7D3112C8DF2560C&dn=Castle+2009+S08E21+720p+HDTV+x264+KILLERS&tr=udp:\/\/tracker.coppersurfer.tk:6969\/announce&tr=udp:\/\/tracker.leechers-paradise.org:6969&tr=udp:\/\/open.demonii.com:1337",12,0,1462762205,8,21,0,1,false,false], |
||||
* ["Castle 2009 Hell to Pay","Castle (2009) 8x21 Hell to Pay","magnet:?xt=urn:btih:329A154C7A4FA68F55409C9F0203C0B0F6FB5F43&dn=Castle+2009+S08E21+HDTV+x264+KILLERS&tr=udp:\/\/tracker.coppersurfer.tk:6969\/announce&tr=udp:\/\/tracker.leechers-paradise.org:6969&tr=udp:\/\/open.demonii.com:1337",0,0,1462762205,8,21,0,1,false,false], |
||||
* ["Castle 2009 Much Ado About Murder PROPER","Castle (2009) 8x20 Much Ado About Murder 720p PROPER","magnet:?xt=urn:btih:98A3CF3CC59EB71658964FCB709E572B1401E35E&dn=Castle+2009+S08E20+PROPER+720p+HDTV+x264+KILLERS&tr=udp:\/\/tracker.coppersurfer.tk:6969\/announce&tr=udp:\/\/tracker.leechers-paradise.org:6969&tr=udp:\/\/open.demonii.com:1337",12,0,1462189505,8,20,0,1,true,false], |
||||
* ["Castle 2009 Much Ado About Murder PROPER","Castle (2009) 8x20 Much Ado About Murder PROPER","magnet:?xt=urn:btih:C1E4F55526B298C9BC9F481F781777E1ACD88536&dn=Castle+2009+S08E20+PROPER+HDTV+x264+KILLERS&tr=udp:\/\/tracker.coppersurfer.tk:6969\/announce&tr=udp:\/\/tracker.leechers-paradise.org:6969&tr=udp:\/\/open.demonii.com:1337",0,0,1462189505,8,20,0,1,true,false], |
||||
* ["Castle 2009 Much Ado About Murder","Castle (2009) 8x20 Much Ado About Murder 720p","magnet:?xt=urn:btih:B80E9DA4DF7D88DC9BF62C8677233F6DB4E5E24E&dn=Castle+2009+S08E20+720p+HDTV+x264+FLEET&tr=udp:\/\/tracker.coppersurfer.tk:6969\/announce&tr=udp:\/\/tracker.leechers-paradise.org:6969&tr=udp:\/\/open.demonii.com:1337",12,0,1462164608,8,20,0,1,false,false], |
||||
* ["Castle 2009 Much Ado About Murder","Castle (2009) 8x20 Much Ado About Murder","magnet:?xt=urn:btih:C73F67FDFCDBCF36686F16C79EDDE663669C72CD&dn=Castle+2009+S08E20+HDTV+x264+FLEET&tr=udp:\/\/tracker.coppersurfer.tk:6969\/announce&tr=udp:\/\/tracker.leechers-paradise.org:6969&tr=udp:\/\/open.demonii.com:1337",0,0,1462164608,8,20,0,1,false,false], |
||||
* ["Castle 2009 Dead Again","Castle (2009) 8x19 Dead Again 720p","magnet:?xt=urn:btih:92FF43AF5BE73B8A79119C7C80CCCF3E5091D241&dn=Castle+2009+S08E19+720p+HDTV+x264+KILLERS&tr=udp:\/\/tracker.coppersurfer.tk:6969\/announce&tr=udp:\/\/tracker.leechers-paradise.org:6969&tr=udp:\/\/open.demonii.com:1337",12,0,1461552608,8,19,0,1,false,false], |
||||
* ["Castle 2009 Dead Again","Castle (2009) 8x19 Dead Again","magnet:?xt=urn:btih:EE3DB0A002EF01B655777D8E56AF7C6046B22455&dn=Castle+2009+S08E19+HDTV+x264+KILLERS&tr=udp:\/\/tracker.coppersurfer.tk:6969\/announce&tr=udp:\/\/tracker.leechers-paradise.org:6969&tr=udp:\/\/open.demonii.com:1337",0,0,1461552608,8,19,0,1,false,false], |
||||
* ["Castle 2009 Backstabber","Castle (2009) 8x18 Backstabber","magnet:?xt=urn:btih:C05B22BEE08D82C84B9A96728EE84FDB0E4286F5&dn=Castle+2009+S08E18+HDTV+x264+LOL&tr=udp:\/\/tracker.coppersurfer.tk:6969\/announce&tr=udp:\/\/tracker.leechers-paradise.org:6969&tr=udp:\/\/open.demonii.com:1337",0,0,1460951407,8,18,0,1,false,false], |
||||
* ["Castle 2009 Backstabber","Castle (2009) 8x18 Backstabber 720p","magnet:?xt=urn:btih:27FB8EC5F537267F8A5543D728150E278B8E4D35&dn=Castle+2009+S08E18+720p+HDTV+x264+2HD&tr=udp:\/\/tracker.coppersurfer.tk:6969\/announce&tr=udp:\/\/tracker.leechers-paradise.org:6969&tr=udp:\/\/open.demonii.com:1337",12,0,1460949608,8,18,0,1,false,false], |
||||
* ["Castle 2009 Death Wish","Castle (2009) 8x17 Death Wish","magnet:?xt=urn:btih:A772093AB91C9A87B1289DBFE7010B088A3FDCD4&dn=Castle+2009+S08E17+HDTV+x264+KILLERS&tr=udp:\/\/tracker.coppersurfer.tk:6969\/announce&tr=udp:\/\/tracker.leechers-paradise.org:6969&tr=udp:\/\/open.demonii.com:1337",0,0,1460438409,8,17,0,1,false,false], |
||||
* ["Castle 2009 Death Wish","Castle (2009) 8x17 Death Wish 720p","magnet:?xt=urn:btih:ECAE7F4DCCB015F3052907CB9EBF255B718B74B4&dn=Castle+2009+S08E17+720p+HDTV+x264+AVS&tr=udp:\/\/tracker.coppersurfer.tk:6969\/announce&tr=udp:\/\/tracker.leechers-paradise.org:6969&tr=udp:\/\/open.demonii.com:1337",12,0,1460433007,8,17,0,1,false,false], |
||||
* ["Castle 2009 Heartbreaker","Castle (2009) 8x16 Heartbreaker","magnet:?xt=urn:btih:1523E75580E6D4EDB34EAE287D53018C365A25BD&dn=Castle+S08E16+WEB+DL+x264+RARBG&tr=udp:\/\/tracker.coppersurfer.tk:6969\/announce&tr=udp:\/\/tracker.leechers-paradise.org:6969&tr=udp:\/\/open.demonii.com:1337",0,0,1459863906,8,16,0,1,false,false], |
||||
* ["Castle 2009 Heartbreaker","Castle (2009) 8x16 Heartbreaker 720p","magnet:?xt=urn:btih:780628ABAADA1F7EEA98F4ED3FE971FCB2550D4E&dn=Castle+2009+S08E16+720p+HDTV+x264+SVA&tr=udp:\/\/tracker.coppersurfer.tk:6969\/announce&tr=udp:\/\/tracker.leechers-paradise.org:6969&tr=udp:\/\/open.demonii.com:1337",12,0,1459828206,8,16,0,1,false,false], |
||||
* ["Castle 2009 Fidelis Ad Mortem","Castle (2009) 8x15 Fidelis Ad Mortem","magnet:?xt=urn:btih:ECB8DF64844076F4EB18349569FEA48DE4B4F2F9&dn=Castle+2009+S08E15+WEB+DL+x264+FUM&tr=udp:\/\/tracker.coppersurfer.tk:6969\/announce&tr=udp:\/\/tracker.leechers-paradise.org:6969&tr=udp:\/\/open.demonii.com:1337",0,0,1458640207,8,15,0,1,false,false], |
||||
* ["Castle 2009 Fidelis Ad Mortem","Castle (2009) 8x15 Fidelis Ad Mortem 720p","magnet:?xt=urn:btih:829C270329F1527D5C1DF7AEE8D6E31028CB23A8&dn=Castle+2009+S08E15+720p+HDTV+x264+AVS&tr=udp:\/\/tracker.coppersurfer.tk:6969\/announce&tr=udp:\/\/tracker.leechers-paradise.org:6969&tr=udp:\/\/open.demonii.com:1337",12,0,1458618610,8,15,0,1,false,false], |
||||
* ["Castle 2009 The G.D.S","Castle (2009) 8x14 The G.D.S.","magnet:?xt=urn:btih:4110431702205393AF8278E9018E4F2D9B3CB28E&dn=Castle+S08E14+WEB+DL+x264+RARBG&tr=udp:\/\/tracker.coppersurfer.tk:6969\/announce&tr=udp:\/\/tracker.leechers-paradise.org:6969&tr=udp:\/\/open.demonii.com:1337",0,0,1457459708,8,14,0,1,false,false], |
||||
* ["Castle 2009 The G.D.S","Castle (2009) 8x14 The G.D.S. 720p","magnet:?xt=urn:btih:B69272F3FC841B6BA37EAE3D2E7128B2ED846F50&dn=Castle+2009+S08E14+720p+HDTV+x264+AVS&tr=udp:\/\/tracker.coppersurfer.tk:6969\/announce&tr=udp:\/\/tracker.leechers-paradise.org:6969&tr=udp:\/\/open.demonii.com:1337",12,0,1457412606,8,14,0,1,false,false], |
||||
* ["Castle 2009 And Justice For All","Castle (2009) 8x13 And Justice For All 720p","magnet:?xt=urn:btih:9715C7CE755DFE6D23633D5E8BA08A7FE2DE7347&dn=Castle+2009+S08E13+720p+HDTV+x264+KILLERS&tr=udp:\/\/tracker.coppersurfer.tk:6969\/announce&tr=udp:\/\/tracker.leechers-paradise.org:6969&tr=udp:\/\/open.demonii.com:1337",12,0,1456807809,8,13,0,1,false,false], |
||||
* ["Castle 2009 And Justice For All","Castle (2009) 8x13 And Justice For All","magnet:?xt=urn:btih:0638AC833ED9D2D72C880FF385651A6BA6CE28EE&dn=Castle+2009+S08E13+HDTV+x264+KILLERS&tr=udp:\/\/tracker.coppersurfer.tk:6969\/announce&tr=udp:\/\/tracker.leechers-paradise.org:6969&tr=udp:\/\/open.demonii.com:1337",0,0,1456807809,8,13,0,1,false,false], |
||||
* ["Castle 2009 The Blame Game","Castle (2009) 8x12 The Blame Game 720p","magnet:?xt=urn:btih:E49F11DC34E7ADC87BBF798C6BB45D49C8475466&dn=Castle+2009+S08E12+720p+HDTV+X264+DIMENSION&tr=udp:\/\/tracker.coppersurfer.tk:6969\/announce&tr=udp:\/\/tracker.leechers-paradise.org:6969&tr=udp:\/\/open.demonii.com:1337",12,0,1456195816,8,12,0,1,false,false], |
||||
* ["Castle 2009 The Blame Game","Castle (2009) 8x12 The Blame Game","magnet:?xt=urn:btih:A9417E1BDD7887C6DB18D06DB37DC48567766D04&dn=Castle+2009+S08E12+HDTV+x264+LOL&tr=udp:\/\/tracker.coppersurfer.tk:6969\/announce&tr=udp:\/\/tracker.leechers-paradise.org:6969&tr=udp:\/\/open.demonii.com:1337",0,0,1456194022,8,12,0,1,false,false], |
||||
* ["Castle 2009 Dead Red","Castle (2009) 8x11 Dead Red 720p","magnet:?xt=urn:btih:94DD4AC8826A59814887E780D38F6D0FCD8590E3&dn=Castle+2009+S08E11+720p+HDTV+X264+DIMENSION&tr=udp:\/\/tracker.coppersurfer.tk:6969\/announce&tr=udp:\/\/tracker.leechers-paradise.org:6969&tr=udp:\/\/open.demonii.com:1337",12,0,1455591012,8,11,0,1,false,false], |
||||
* ["Castle 2009 Dead Red","Castle (2009) 8x11 Dead Red","magnet:?xt=urn:btih:E44F825E3D3B6BE3471A833185B04DCA74A3674D&dn=Castle+2009+S08E11+HDTV+x264+LOL&tr=udp:\/\/tracker.coppersurfer.tk:6969\/announce&tr=udp:\/\/tracker.leechers-paradise.org:6969&tr=udp:\/\/open.demonii.com:1337",0,0,1455589221,8,11,0,1,false,false], |
||||
* ["Castle 2009 Witness for the Prosecution","Castle (2009) 8x10 Witness for the Prosecution 720p","magnet:?xt=urn:btih:6E0F4DA3529B63BE75AECDC9EA1248305A8AD9D7&dn=Castle+2009+S08E10+720p+HDTV+X264+DIMENSION&tr=udp:\/\/tracker.coppersurfer.tk:6969\/announce&tr=udp:\/\/tracker.leechers-paradise.org:6969&tr=udp:\/\/open.demonii.com:1337",12,0,1455515410,8,10,0,1,false,false], |
||||
* ["Castle 2009 Witness for the Prosecution","Castle (2009) 8x10 Witness for the Prosecution","magnet:?xt=urn:btih:8DD8E60B78C1A6703727FD54055C1DA4AD422222&dn=Castle+2009+S08E10+HDTV+x264+LOL&tr=udp:\/\/tracker.coppersurfer.tk:6969\/announce&tr=udp:\/\/tracker.leechers-paradise.org:6969&tr=udp:\/\/open.demonii.com:1337",0,0,1455513610,8,10,0,1,false,false], |
||||
* ["Castle 2009","Castle (2009) 8x09","magnet:?xt=urn:btih:2F5BDC5958C2B7BCBC568D76F1487E68A95B74D3&dn=Castle+2009+S08E09+HDTV+x264+LOL&tr=udp:\/\/tracker.coppersurfer.tk:6969\/announce&tr=udp:\/\/tracker.leechers-paradise.org:6969&tr=udp:\/\/open.demonii.com:1337",0,0,1454991609,8,9,0,1,false,false], |
||||
* ["Castle 2009","Castle (2009) 8x09 720p","magnet:?xt=urn:btih:E21DF496B8F838C37C2F191A623D6EA3315190BD&dn=Castle+2009+S08E09+720p+HDTV+X264+DIMENSION&tr=udp:\/\/tracker.coppersurfer.tk:6969\/announce&tr=udp:\/\/tracker.leechers-paradise.org:6969&tr=udp:\/\/open.demonii.com:1337",12,0,1454991609,8,9,0,1,false,false], |
||||
* ["Castle 2009","Castle (2009) 8x08 720p","magnet:?xt=urn:btih:96A21B41A80043280AA2241C4530AF529655EB8D&dn=Castle+2009+S08E08+720p+HDTV+X264+DIMENSION&tr=udp:\/\/tracker.coppersurfer.tk:6969\/announce&tr=udp:\/\/tracker.leechers-paradise.org:6969&tr=udp:\/\/open.demonii.com:1337",12,0,1448337002,8,8,0,1,false,false], |
||||
* ["Castle 2009","Castle (2009) 8x08","magnet:?xt=urn:btih:4E7BBE21D8B18DC09A9647038DC3254D7E85864C&dn=Castle+2009+S08E08+HDTV+x264+LOL&tr=udp:\/\/tracker.coppersurfer.tk:6969\/announce&tr=udp:\/\/tracker.leechers-paradise.org:6969&tr=udp:\/\/open.demonii.com:1337",0,0,1448334902,8,8,0,1,false,false], |
||||
* ["Castle 2009","Castle (2009) 8x07","magnet:?xt=urn:btih:428208294D380ABDAA2CA9CD4DC0B1CC6CBD2CC8&dn=Castle+2009+S08E07+HDTV+x264+LOL&tr=udp:\/\/tracker.coppersurfer.tk:6969\/announce&tr=udp:\/\/tracker.leechers-paradise.org:6969&tr=udp:\/\/open.demonii.com:1337",0,0,1447728601,8,7,0,1,false,false], |
||||
* ["Castle 2009","Castle (2009) 8x07 720p","magnet:?xt=urn:btih:3CDBF2ED5C14F1E514772D6541EC9D087F0AE3F3&dn=Castle+2009+S08E07+720p+HDTV+X264+DIMENSION&tr=udp:\/\/tracker.coppersurfer.tk:6969\/announce&tr=udp:\/\/tracker.leechers-paradise.org:6969&tr=udp:\/\/open.demonii.com:1337",12,0,1447728601,8,7,0,1,false,false], |
||||
* ["Castle 2009","Castle (2009) 8x06 720p","magnet:?xt=urn:btih:BD99B76B9B3E9BC2401CBAB9100CB1A8CB0F9813&dn=Castle+2009+S08E06+720p+HDTV+X264+DIMENSION&tr=udp:\/\/tracker.coppersurfer.tk:6969\/announce&tr=udp:\/\/tracker.leechers-paradise.org:6969&tr=udp:\/\/open.demonii.com:1337",12,0,1447131002,8,6,0,1,false,false] |
||||
* ] |
||||
* ] |
||||
*/ |
||||
|
||||
|
||||
public int feedID; |
||||
boolean enabled; |
||||
boolean isCustomAlias; |
||||
public String feedAlias; |
||||
public String feedURL; |
||||
public long lastUpdated; |
||||
public List<RemoteRssFile> files; |
||||
|
||||
public UTorrentRssFeed(JSONArray json) throws JSONException { |
||||
Log.e("UTorrentRssFeedItem", "input"); |
||||
|
||||
feedID = json.getInt(0); |
||||
enabled = json.getBoolean(1); |
||||
isCustomAlias = !json.getBoolean(2); |
||||
feedURL = json.getString(6); |
||||
lastUpdated = json.getLong(7); |
||||
|
||||
if (isCustomAlias) { |
||||
feedAlias = feedURL.split("\\|")[0]; |
||||
feedURL = feedURL.split("\\|")[1]; |
||||
} |
||||
else { |
||||
feedAlias = feedURL; |
||||
} |
||||
|
||||
files = new ArrayList<>(); |
||||
|
||||
JSONArray filesJson = json.getJSONArray(8); |
||||
RemoteRssFile file; |
||||
|
||||
for (int i = 0; i < filesJson.length(); i++) { |
||||
file = new RemoteRssFile(filesJson.getJSONArray(i)); |
||||
file.feedLabel = feedAlias; |
||||
files.add(file); |
||||
} |
||||
} |
||||
|
||||
public UTorrentRssFeed(Parcel in) { |
||||
feedID = in.readInt(); |
||||
enabled = (in.readByte() == 1); |
||||
isCustomAlias = (in.readByte() == 1); |
||||
feedAlias = in.readString(); |
||||
feedURL = in.readString(); |
||||
lastUpdated = in.readLong(); |
||||
|
||||
files = new ArrayList<>(); |
||||
in.readList(files, RemoteRssFile.class.getClassLoader()); |
||||
} |
||||
|
||||
@Override |
||||
public int describeContents() { |
||||
return 0; |
||||
} |
||||
|
||||
@Override |
||||
public void writeToParcel(Parcel dest, int flags) { |
||||
dest.writeInt(feedID); |
||||
dest.writeByte((byte) (enabled ? 1 : 0)); |
||||
dest.writeByte((byte) (isCustomAlias ? 1 : 0)); |
||||
dest.writeString(feedAlias); |
||||
dest.writeString(feedURL); |
||||
dest.writeLong(lastUpdated); |
||||
dest.writeList(files); |
||||
} |
||||
|
||||
public static final Parcelable.Creator<UTorrentRssFeed> CREATOR = new Parcelable.Creator<UTorrentRssFeed>() { |
||||
public UTorrentRssFeed createFromParcel(Parcel in) { |
||||
return new UTorrentRssFeed(in); |
||||
} |
||||
|
||||
public UTorrentRssFeed[] newArray(int size) { |
||||
return new UTorrentRssFeed[size]; |
||||
} |
||||
}; |
||||
} |
@ -0,0 +1,124 @@
@@ -0,0 +1,124 @@
|
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<!-- |
||||
Copyright 2010-2013 Eric Kok et al. |
||||
|
||||
Transdroid is free software: you can redistribute it and/or modify |
||||
it under the terms of the GNU General Public License as published by |
||||
the Free Software Foundation, either version 3 of the License, or |
||||
(at your option) any later version. |
||||
|
||||
Transdroid is distributed in the hope that it will be useful, |
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
GNU General Public License for more details. |
||||
|
||||
You should have received a copy of the GNU General Public License |
||||
along with Transdroid. If not, see <http://www.gnu.org/licenses/>. |
||||
--> |
||||
<!-- This layout is for phones in portrait and shows the torrents list with the filters as navigation drawer. --> |
||||
<android.support.v4.widget.DrawerLayout |
||||
android:id="@+id/drawer_layout" |
||||
xmlns:android="http://schemas.android.com/apk/res/android" |
||||
xmlns:app="http://schemas.android.com/apk/res-auto" |
||||
xmlns:tools="http://schemas.android.com/tools" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="match_parent" |
||||
tools:context=".core.gui.remoterss.RemoteRssActivity_"> |
||||
|
||||
<!-- The main content view --> |
||||
<RelativeLayout |
||||
android:layout_width="match_parent" |
||||
android:layout_height="match_parent" |
||||
android:orientation="vertical"> |
||||
|
||||
<android.support.v7.widget.Toolbar |
||||
android:id="@+id/torrents_toolbar" |
||||
style="@style/DefaultToolbar" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content" |
||||
android:minHeight="?attr/actionBarSize" /> |
||||
|
||||
<android.support.v7.widget.Toolbar |
||||
android:id="@+id/actions_toolbar" |
||||
style="@style/SplitToolbar" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content" |
||||
android:layout_alignParentBottom="true" |
||||
android:minHeight="?attr/actionBarSize" |
||||
android:paddingEnd="@dimen/ui_actions_padding" |
||||
android:paddingRight="@dimen/ui_actions_padding" /> |
||||
|
||||
<android.support.v7.widget.ActionMenuView |
||||
android:id="@+id/contextual_menu" |
||||
style="@style/SplitToolbar" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content" |
||||
android:layout_alignParentBottom="true" |
||||
android:minHeight="?attr/actionBarSize" |
||||
android:visibility="gone" |
||||
tools:visibility="visible"/> |
||||
|
||||
<fragment |
||||
android:id="@+id/remoterss_fragment" |
||||
class="org.transdroid.core.gui.remoterss.RemoteRssFragment_" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="match_parent" |
||||
android:layout_above="@id/actions_toolbar" |
||||
android:layout_below="@id/torrents_toolbar" |
||||
tools:layout="@layout/fragment_torrents" /> |
||||
|
||||
<View |
||||
style="@style/DefaultToolbarShadow" |
||||
android:layout_below="@id/torrents_toolbar" /> |
||||
|
||||
<View |
||||
style="@style/SplitToolbarShadow" |
||||
android:layout_above="@id/actions_toolbar" /> |
||||
|
||||
<include |
||||
layout="@layout/actionbar_addbutton" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_alignParentBottom="true" |
||||
android:layout_alignParentEnd="true" |
||||
android:layout_alignParentRight="true" |
||||
android:layout_gravity="bottom|end" |
||||
android:layout_marginBottom="16dp" |
||||
android:layout_marginEnd="10dp" |
||||
android:layout_marginRight="10dp" /> |
||||
|
||||
</RelativeLayout> |
||||
|
||||
<!-- The navigation drawer --> |
||||
<LinearLayout |
||||
android:id="@+id/drawer_container" |
||||
android:layout_width="@dimen/ui_filters_list" |
||||
android:layout_height="match_parent" |
||||
android:layout_gravity="start" |
||||
android:background="?attr/drawer_background" |
||||
android:orientation="vertical"> |
||||
|
||||
<ListView |
||||
android:id="@+id/drawer_list" |
||||
android:layout_width="@dimen/ui_filters_list" |
||||
android:layout_height="0dp" |
||||
android:layout_weight="1" |
||||
android:choiceMode="singleChoice" |
||||
android:divider="@null" |
||||
tools:listitem="@layout/list_item_filter" /> |
||||
|
||||
<android.support.v7.widget.SearchView |
||||
android:id="@+id/filter_search" |
||||
android:layout_width="@dimen/ui_filters_list" |
||||
android:layout_height="wrap_content" |
||||
android:layout_marginBottom="5dp" |
||||
android:layout_marginEnd="5dp" |
||||
android:layout_marginRight="10dp" |
||||
android:layout_marginTop="5dp" |
||||
app:iconifiedByDefault="false" |
||||
app:queryHint="@string/action_filter" |
||||
app:searchIcon="@drawable/ic_action_filter" /> |
||||
|
||||
</LinearLayout> |
||||
|
||||
</android.support.v4.widget.DrawerLayout> |
@ -0,0 +1,40 @@
@@ -0,0 +1,40 @@
|
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<!-- |
||||
Copyright 2010-2013 Eric Kok et al. |
||||
|
||||
Transdroid is free software: you can redistribute it and/or modify |
||||
it under the terms of the GNU General Public License as published by |
||||
the Free Software Foundation, either version 3 of the License, or |
||||
(at your option) any later version. |
||||
|
||||
Transdroid is distributed in the hope that it will be useful, |
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
GNU General Public License for more details. |
||||
|
||||
You should have received a copy of the GNU General Public License |
||||
along with Transdroid. If not, see <http://www.gnu.org/licenses/>. |
||||
--> |
||||
<FrameLayout 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.support.v4.widget.SwipeRefreshLayout |
||||
android:id="@+id/swipe_refresh_layout" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="match_parent"> |
||||
|
||||
<ListView |
||||
android:id="@+id/torrents_list" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="match_parent" |
||||
android:choiceMode="multipleChoiceModal" |
||||
android:clipToPadding="false" |
||||
android:paddingBottom="35dp" |
||||
tools:listitem="@layout/list_item_rssitem" |
||||
tools:visibility="visible"/> |
||||
|
||||
</android.support.v4.widget.SwipeRefreshLayout> |
||||
|
||||
</FrameLayout> |
@ -0,0 +1,58 @@
@@ -0,0 +1,58 @@
|
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<!-- |
||||
Copyright 2010-2013 Eric Kok et al. |
||||
|
||||
Transdroid is free software: you can redistribute it and/or modify |
||||
it under the terms of the GNU General Public License as published by |
||||
the Free Software Foundation, either version 3 of the License, or |
||||
(at your option) any later version. |
||||
|
||||
Transdroid is distributed in the hope that it will be useful, |
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
GNU General Public License for more details. |
||||
|
||||
You should have received a copy of the GNU General Public License |
||||
along with Transdroid. If not, see <http://www.gnu.org/licenses/>. |
||||
--> |
||||
<org.transdroid.core.gui.rss.RssitemStatusLayout xmlns:android="http://schemas.android.com/apk/res/android" |
||||
xmlns:tools="http://schemas.android.com/tools" |
||||
android:layout_width="fill_parent" |
||||
android:layout_height="wrap_content" |
||||
android:background="?attr/activatable_background" |
||||
android:paddingBottom="@dimen/margin_default" |
||||
android:paddingLeft="@dimen/margin_default" |
||||
android:paddingRight="@dimen/margin_default" |
||||
android:paddingTop="@dimen/margin_default"> |
||||
|
||||
<TextView |
||||
android:id="@+id/name_text" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content" |
||||
android:fontFamily="sans-serif-condensed" |
||||
android:textColor="?attr/text_bright" |
||||
android:textIsSelectable="false" |
||||
android:textSize="@dimen/text_enlarged" |
||||
tools:text="Test RSS Item Text Here"/> |
||||
|
||||
<TextView |
||||
android:id="@+id/date_text" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content" |
||||
android:layout_below="@id/name_text" |
||||
android:layout_marginTop="4dip" |
||||
android:textIsSelectable="false" |
||||
android:textSize="@dimen/text_small" |
||||
tools:text="25-12-2015"/> |
||||
|
||||
<TextView |
||||
android:id="@+id/label_text" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content" |
||||
android:layout_below="@id/date_text" |
||||
android:layout_marginTop="4dip" |
||||
android:textIsSelectable="false" |
||||
android:textSize="@dimen/text_small" |
||||
tools:text="Label of torrent"/> |
||||
|
||||
</org.transdroid.core.gui.rss.RssitemStatusLayout> |
Loading…
Reference in new issue