Eric Kok
4 years ago
committed by
GitHub
377 changed files with 38951 additions and 38617 deletions
@ -0,0 +1,9 @@ |
|||||||
|
# editorconfig.org |
||||||
|
root = true |
||||||
|
|
||||||
|
[*] |
||||||
|
charset = utf-8 |
||||||
|
end_of_line = lf |
||||||
|
indent_style = space |
||||||
|
insert_final_newline = true |
||||||
|
trim_trailing_whitespace = true |
@ -1,29 +1,28 @@ |
|||||||
<?xml version="1.0" encoding="utf-8"?> |
<?xml version="1.0" encoding="utf-8"?><!-- |
||||||
<!-- |
|
||||||
Copyright 2010-2018 Eric Kok et al. |
Copyright 2010-2018 Eric Kok et al. |
||||||
|
|
||||||
Transdroid is free software: you can redistribute it and/or modify |
Transdroid is free software: you can redistribute it and/or modify |
||||||
it under the terms of the GNU General Public License as published by |
it under the terms of the GNU General Public License as published by |
||||||
the Free Software Foundation, either version 3 of the License, or |
the Free Software Foundation, either version 3 of the License, or |
||||||
(at your option) any later version. |
(at your option) any later version. |
||||||
|
|
||||||
Transdroid is distributed in the hope that it will be useful, |
Transdroid is distributed in the hope that it will be useful, |
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
GNU General Public License for more details. |
GNU General Public License for more details. |
||||||
|
|
||||||
You should have received a copy of the GNU General Public License |
You should have received a copy of the GNU General Public License |
||||||
along with Transdroid. If not, see <http://www.gnu.org/licenses/>. |
along with Transdroid. If not, see <http://www.gnu.org/licenses/>. |
||||||
--> |
--> |
||||||
<resources> |
<resources> |
||||||
|
|
||||||
<!-- Used to enable checking for app updates in the background --> |
<!-- Used to enable checking for app updates in the background --> |
||||||
<bool name="updatecheck_available">true</bool> |
<bool name="updatecheck_available">true</bool> |
||||||
<!-- Used to enable the search UI --> |
<!-- Used to enable the search UI --> |
||||||
<bool name="search_available">true</bool> |
<bool name="search_available">true</bool> |
||||||
<!-- Used to enable the RSS UI and background service --> |
<!-- Used to enable the RSS UI and background service --> |
||||||
<bool name="rss_available">true</bool> |
<bool name="rss_available">true</bool> |
||||||
<!-- Used to allow adding of seedboxes via easy server setup --> |
<!-- Used to allow adding of seedboxes via easy server setup --> |
||||||
<bool name="seedboxes_available">true</bool> |
<bool name="seedboxes_available">true</bool> |
||||||
|
|
||||||
</resources> |
</resources> |
||||||
|
@ -1,24 +1,24 @@ |
|||||||
<!-- |
<!-- |
||||||
Copyright 2010-2018 Eric Kok et al. |
Copyright 2010-2018 Eric Kok et al. |
||||||
|
|
||||||
Transdroid is free software: you can redistribute it and/or modify |
Transdroid is free software: you can redistribute it and/or modify |
||||||
it under the terms of the GNU General Public License as published by |
it under the terms of the GNU General Public License as published by |
||||||
the Free Software Foundation, either version 3 of the License, or |
the Free Software Foundation, either version 3 of the License, or |
||||||
(at your option) any later version. |
(at your option) any later version. |
||||||
|
|
||||||
Transdroid is distributed in the hope that it will be useful, |
Transdroid is distributed in the hope that it will be useful, |
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
GNU General Public License for more details. |
GNU General Public License for more details. |
||||||
|
|
||||||
You should have received a copy of the GNU General Public License |
You should have received a copy of the GNU General Public License |
||||||
along with Transdroid. If not, see <http://www.gnu.org/licenses/>. |
along with Transdroid. If not, see <http://www.gnu.org/licenses/>. |
||||||
--> |
--> |
||||||
<resources> |
<resources> |
||||||
|
|
||||||
<string name="app_name" translatable="false">Transdroid</string> |
<string name="app_name" translatable="false">Transdroid</string> |
||||||
|
|
||||||
<string name="donate_text">Donate with PayPal</string> |
<string name="donate_text">Donate with PayPal</string> |
||||||
<string name="donate_url">https://paypal.me/erickoknl</string> |
<string name="donate_url">https://paypal.me/erickoknl</string> |
||||||
|
|
||||||
</resources> |
</resources> |
||||||
|
@ -1,29 +1,28 @@ |
|||||||
<?xml version="1.0" encoding="utf-8"?> |
<?xml version="1.0" encoding="utf-8"?><!-- |
||||||
<!-- |
|
||||||
Copyright 2010-2018 Eric Kok et al. |
Copyright 2010-2018 Eric Kok et al. |
||||||
|
|
||||||
Transdroid is free software: you can redistribute it and/or modify |
Transdroid is free software: you can redistribute it and/or modify |
||||||
it under the terms of the GNU General Public License as published by |
it under the terms of the GNU General Public License as published by |
||||||
the Free Software Foundation, either version 3 of the License, or |
the Free Software Foundation, either version 3 of the License, or |
||||||
(at your option) any later version. |
(at your option) any later version. |
||||||
|
|
||||||
Transdroid is distributed in the hope that it will be useful, |
Transdroid is distributed in the hope that it will be useful, |
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
GNU General Public License for more details. |
GNU General Public License for more details. |
||||||
|
|
||||||
You should have received a copy of the GNU General Public License |
You should have received a copy of the GNU General Public License |
||||||
along with Transdroid. If not, see <http://www.gnu.org/licenses/>. |
along with Transdroid. If not, see <http://www.gnu.org/licenses/>. |
||||||
--> |
--> |
||||||
<resources> |
<resources> |
||||||
|
|
||||||
<!-- Used to enable checking for app updates in the background --> |
<!-- Used to enable checking for app updates in the background --> |
||||||
<bool name="updatecheck_available">false</bool> |
<bool name="updatecheck_available">false</bool> |
||||||
<!-- Used to enable the search UI --> |
<!-- Used to enable the search UI --> |
||||||
<bool name="search_available">false</bool> |
<bool name="search_available">false</bool> |
||||||
<!-- Used to enable the RSS UI and background service --> |
<!-- Used to enable the RSS UI and background service --> |
||||||
<bool name="rss_available">false</bool> |
<bool name="rss_available">false</bool> |
||||||
<!-- Used to allow adding of seedboxes via easy server setup --> |
<!-- Used to allow adding of seedboxes via easy server setup --> |
||||||
<bool name="seedboxes_available">true</bool> |
<bool name="seedboxes_available">true</bool> |
||||||
|
|
||||||
</resources> |
</resources> |
||||||
|
@ -1,24 +1,24 @@ |
|||||||
<!-- |
<!-- |
||||||
Copyright 2010-2018 Eric Kok et al. |
Copyright 2010-2018 Eric Kok et al. |
||||||
|
|
||||||
Transdroid is free software: you can redistribute it and/or modify |
Transdroid is free software: you can redistribute it and/or modify |
||||||
it under the terms of the GNU General Public License as published by |
it under the terms of the GNU General Public License as published by |
||||||
the Free Software Foundation, either version 3 of the License, or |
the Free Software Foundation, either version 3 of the License, or |
||||||
(at your option) any later version. |
(at your option) any later version. |
||||||
|
|
||||||
Transdroid is distributed in the hope that it will be useful, |
Transdroid is distributed in the hope that it will be useful, |
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
GNU General Public License for more details. |
GNU General Public License for more details. |
||||||
|
|
||||||
You should have received a copy of the GNU General Public License |
You should have received a copy of the GNU General Public License |
||||||
along with Transdroid. If not, see <http://www.gnu.org/licenses/>. |
along with Transdroid. If not, see <http://www.gnu.org/licenses/>. |
||||||
--> |
--> |
||||||
<resources> |
<resources> |
||||||
|
|
||||||
<string name="app_name" translatable="false">Transdrone</string> |
<string name="app_name" translatable="false">Transdrone</string> |
||||||
|
|
||||||
<string name="donate_text"></string> |
<string name="donate_text" /> |
||||||
<string name="donate_url"></string> |
<string name="donate_url" /> |
||||||
|
|
||||||
</resources> |
</resources> |
||||||
|
@ -1,333 +1,331 @@ |
|||||||
<?xml version="1.0" encoding="utf-8"?> |
<?xml version="1.0" encoding="utf-8"?><!-- |
||||||
<!-- |
|
||||||
Copyright 2010-2018 Eric Kok et al. |
Copyright 2010-2018 Eric Kok et al. |
||||||
|
|
||||||
Transdroid is free software: you can redistribute it and/or modify |
Transdroid is free software: you can redistribute it and/or modify |
||||||
it under the terms of the GNU General Public License as published by |
it under the terms of the GNU General Public License as published by |
||||||
the Free Software Foundation, either version 3 of the License, or |
the Free Software Foundation, either version 3 of the License, or |
||||||
(at your option) any later version. |
(at your option) any later version. |
||||||
|
|
||||||
Transdroid is distributed in the hope that it will be useful, |
Transdroid is distributed in the hope that it will be useful, |
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
GNU General Public License for more details. |
GNU General Public License for more details. |
||||||
|
|
||||||
You should have received a copy of the GNU General Public License |
You should have received a copy of the GNU General Public License |
||||||
along with Transdroid. If not, see <http://www.gnu.org/licenses/>. |
along with Transdroid. If not, see <http://www.gnu.org/licenses/>. |
||||||
--> |
--> |
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" |
<manifest xmlns:android="http://schemas.android.com/apk/res/android" |
||||||
xmlns:tools="http://schemas.android.com/tools" |
xmlns:tools="http://schemas.android.com/tools" |
||||||
package="org.transdroid" > |
package="org.transdroid"> |
||||||
|
|
||||||
<uses-sdk /> |
<uses-sdk /> |
||||||
|
|
||||||
<supports-screens |
<supports-screens |
||||||
android:anyDensity="true" |
android:anyDensity="true" |
||||||
android:largeScreens="true" |
android:largeScreens="true" |
||||||
android:normalScreens="true" |
android:normalScreens="true" |
||||||
android:smallScreens="true" |
android:smallScreens="true" |
||||||
android:xlargeScreens="true" /> |
android:xlargeScreens="true" /> |
||||||
|
|
||||||
<uses-permission android:name="android.permission.INTERNET" /> |
<uses-permission android:name="android.permission.INTERNET" /> |
||||||
<!-- To check for an active connection --> |
<!-- To check for an active connection --> |
||||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> |
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> |
||||||
<!-- To check currently connected wifi network name --> |
<!-- To check currently connected wifi network name --> |
||||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> |
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> |
||||||
<uses-permission-sdk-23 android:name="android.permission.ACCESS_FINE_LOCATION" /> |
<uses-permission-sdk-23 android:name="android.permission.ACCESS_FINE_LOCATION" /> |
||||||
<!-- To start rss and torrents background check services --> |
<!-- To start rss and torrents background check services --> |
||||||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> |
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> |
||||||
<uses-permission android:name="android.permission.VIBRATE" /> |
<uses-permission android:name="android.permission.VIBRATE" /> |
||||||
<!-- To export settings file to external storage --> |
<!-- To export settings file to external storage --> |
||||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> |
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> |
||||||
|
|
||||||
<uses-feature |
<uses-feature |
||||||
android:name="android.hardware.touchscreen" |
android:name="android.hardware.touchscreen" |
||||||
android:required="false" /> |
android:required="false" /> |
||||||
|
|
||||||
<uses-feature |
<uses-feature |
||||||
android:name="android.software.leanback" |
android:name="android.software.leanback" |
||||||
android:required="false" /> |
android:required="false" /> |
||||||
|
|
||||||
<application |
<application |
||||||
android:name=".core.gui.TransdroidApp_" |
android:name=".core.gui.TransdroidApp_" |
||||||
android:allowBackup="true" |
android:allowBackup="true" |
||||||
android:hardwareAccelerated="true" |
android:banner="@drawable/banner" |
||||||
android:icon="@drawable/ic_launcher" |
android:hardwareAccelerated="true" |
||||||
android:banner="@drawable/banner" |
android:icon="@drawable/ic_launcher" |
||||||
android:label="@string/app_name" |
android:label="@string/app_name" |
||||||
android:theme="@style/Theme.AppCompat" |
android:supportsRtl="true" |
||||||
android:usesCleartextTraffic="true"> |
android:theme="@style/Theme.AppCompat" |
||||||
|
android:usesCleartextTraffic="true"> |
||||||
<uses-library |
|
||||||
android:name="org.apache.http.legacy" |
<uses-library |
||||||
android:required="false" /> |
android:name="org.apache.http.legacy" |
||||||
|
android:required="false" /> |
||||||
<!-- Main activities --> |
|
||||||
<activity |
<!-- Main activities --> |
||||||
android:name="org.transdroid.core.gui.TorrentsActivity_" |
<activity |
||||||
android:allowTaskReparenting="true" |
android:name="org.transdroid.core.gui.TorrentsActivity_" |
||||||
android:label="@string/app_name" |
android:allowTaskReparenting="true" |
||||||
android:launchMode="singleTop" |
android:label="@string/app_name" |
||||||
android:theme="@style/TransdroidTheme" |
android:launchMode="singleTop" |
||||||
android:windowSoftInputMode="stateHidden" > |
android:theme="@style/TransdroidTheme" |
||||||
<intent-filter> |
android:windowSoftInputMode="stateHidden"> |
||||||
<action android:name="android.intent.action.MAIN" /> |
<intent-filter> |
||||||
|
<action android:name="android.intent.action.MAIN" /> |
||||||
<category android:name="android.intent.category.LAUNCHER" /> |
|
||||||
<category android:name="android.intent.category.LEANBACK_LAUNCHER" /> |
<category android:name="android.intent.category.LAUNCHER" /> |
||||||
</intent-filter> |
<category android:name="android.intent.category.LEANBACK_LAUNCHER" /> |
||||||
<intent-filter> |
</intent-filter> |
||||||
<action android:name="android.intent.action.SEARCH" /> |
<intent-filter> |
||||||
</intent-filter> |
<action android:name="android.intent.action.SEARCH" /> |
||||||
<intent-filter> |
</intent-filter> |
||||||
<action android:name="org.transdroid.ADD_MULTIPLE" /> |
<intent-filter> |
||||||
|
<action android:name="org.transdroid.ADD_MULTIPLE" /> |
||||||
<category android:name="android.intent.category.DEFAULT" /> |
|
||||||
</intent-filter> |
<category android:name="android.intent.category.DEFAULT" /> |
||||||
<intent-filter> |
</intent-filter> |
||||||
<action android:name="org.transdroid.START_SERVER" /> |
<intent-filter> |
||||||
|
<action android:name="org.transdroid.START_SERVER" /> |
||||||
<category android:name="android.intent.category.DEFAULT" /> |
|
||||||
</intent-filter> |
<category android:name="android.intent.category.DEFAULT" /> |
||||||
<intent-filter> |
</intent-filter> |
||||||
<action android:name="android.intent.action.VIEW" /> |
<intent-filter> |
||||||
|
<action android:name="android.intent.action.VIEW" /> |
||||||
<category android:name="android.intent.category.DEFAULT" /> |
|
||||||
<category android:name="android.intent.category.BROWSABLE" /> |
<category android:name="android.intent.category.DEFAULT" /> |
||||||
|
<category android:name="android.intent.category.BROWSABLE" /> |
||||||
<data |
|
||||||
android:host="*" |
<data |
||||||
android:mimeType="application/x-bittorrent" |
android:host="*" |
||||||
android:scheme="http" /> |
android:mimeType="application/x-bittorrent" |
||||||
</intent-filter> |
android:scheme="http" /> |
||||||
<intent-filter> |
</intent-filter> |
||||||
<action android:name="android.intent.action.VIEW" /> |
<intent-filter> |
||||||
|
<action android:name="android.intent.action.VIEW" /> |
||||||
<category android:name="android.intent.category.DEFAULT" /> |
|
||||||
<category android:name="android.intent.category.BROWSABLE" /> |
<category android:name="android.intent.category.DEFAULT" /> |
||||||
|
<category android:name="android.intent.category.BROWSABLE" /> |
||||||
<data |
|
||||||
android:host="*" |
<data |
||||||
android:pathPattern=".*\\.torrent" |
android:host="*" |
||||||
android:scheme="http" /> |
android:pathPattern=".*\\.torrent" |
||||||
</intent-filter> |
android:scheme="http" /> |
||||||
<intent-filter> |
</intent-filter> |
||||||
<action android:name="android.intent.action.VIEW" /> |
<intent-filter> |
||||||
|
<action android:name="android.intent.action.VIEW" /> |
||||||
<category android:name="android.intent.category.DEFAULT" /> |
|
||||||
<category android:name="android.intent.category.BROWSABLE" /> |
<category android:name="android.intent.category.DEFAULT" /> |
||||||
|
<category android:name="android.intent.category.BROWSABLE" /> |
||||||
<data |
|
||||||
android:host="*" |
<data |
||||||
android:mimeType="application/x-bittorrent" |
android:host="*" |
||||||
android:scheme="https" /> |
android:mimeType="application/x-bittorrent" |
||||||
</intent-filter> |
android:scheme="https" /> |
||||||
<intent-filter> |
</intent-filter> |
||||||
<action android:name="android.intent.action.VIEW" /> |
<intent-filter> |
||||||
|
<action android:name="android.intent.action.VIEW" /> |
||||||
<category android:name="android.intent.category.DEFAULT" /> |
|
||||||
<category android:name="android.intent.category.BROWSABLE" /> |
<category android:name="android.intent.category.DEFAULT" /> |
||||||
|
<category android:name="android.intent.category.BROWSABLE" /> |
||||||
<data |
|
||||||
android:host="*" |
<data |
||||||
android:pathPattern=".*\\.torrent" |
android:host="*" |
||||||
android:scheme="https" /> |
android:pathPattern=".*\\.torrent" |
||||||
</intent-filter> |
android:scheme="https" /> |
||||||
<intent-filter> |
</intent-filter> |
||||||
<action android:name="android.intent.action.VIEW" /> |
<intent-filter> |
||||||
|
<action android:name="android.intent.action.VIEW" /> |
||||||
<category android:name="android.intent.category.DEFAULT" /> |
|
||||||
<category android:name="android.intent.category.BROWSABLE" /> |
<category android:name="android.intent.category.DEFAULT" /> |
||||||
|
<category android:name="android.intent.category.BROWSABLE" /> |
||||||
<data |
|
||||||
android:host="*" |
<data |
||||||
android:mimeType="application/x-bittorrent" |
android:host="*" |
||||||
android:scheme="file" /> |
android:mimeType="application/x-bittorrent" |
||||||
</intent-filter> |
android:scheme="file" /> |
||||||
<intent-filter> |
</intent-filter> |
||||||
<action android:name="android.intent.action.VIEW" /> |
<intent-filter> |
||||||
|
<action android:name="android.intent.action.VIEW" /> |
||||||
<category android:name="android.intent.category.DEFAULT" /> |
|
||||||
<category android:name="android.intent.category.BROWSABLE" /> |
<category android:name="android.intent.category.DEFAULT" /> |
||||||
|
<category android:name="android.intent.category.BROWSABLE" /> |
||||||
<data |
|
||||||
android:host="*" |
<data |
||||||
android:pathPattern=".*\\.torrent" |
android:host="*" |
||||||
android:scheme="file" /> |
android:pathPattern=".*\\.torrent" |
||||||
</intent-filter> |
android:scheme="file" /> |
||||||
<intent-filter> |
</intent-filter> |
||||||
<action android:name="android.intent.action.VIEW" /> |
<intent-filter> |
||||||
|
<action android:name="android.intent.action.VIEW" /> |
||||||
<category android:name="android.intent.category.DEFAULT" /> |
|
||||||
<category android:name="android.intent.category.BROWSABLE" /> |
<category android:name="android.intent.category.DEFAULT" /> |
||||||
|
<category android:name="android.intent.category.BROWSABLE" /> |
||||||
<data |
|
||||||
android:host="*" |
<data |
||||||
android:mimeType="application/x-bittorrent" |
android:host="*" |
||||||
android:scheme="content" /> |
android:mimeType="application/x-bittorrent" |
||||||
</intent-filter> |
android:scheme="content" /> |
||||||
<intent-filter> |
</intent-filter> |
||||||
<action android:name="android.intent.action.VIEW" /> |
<intent-filter> |
||||||
|
<action android:name="android.intent.action.VIEW" /> |
||||||
<category android:name="android.intent.category.DEFAULT" /> |
|
||||||
<category android:name="android.intent.category.BROWSABLE" /> |
<category android:name="android.intent.category.DEFAULT" /> |
||||||
|
<category android:name="android.intent.category.BROWSABLE" /> |
||||||
<data |
|
||||||
android:host="*" |
<data |
||||||
android:pathPattern=".*\\.torrent" |
android:host="*" |
||||||
android:scheme="content" /> |
android:pathPattern=".*\\.torrent" |
||||||
</intent-filter> |
android:scheme="content" /> |
||||||
<intent-filter> |
</intent-filter> |
||||||
<action android:name="android.intent.action.VIEW" /> |
<intent-filter> |
||||||
|
<action android:name="android.intent.action.VIEW" /> |
||||||
<category android:name="android.intent.category.DEFAULT" /> |
|
||||||
<category android:name="android.intent.category.BROWSABLE" /> |
<category android:name="android.intent.category.DEFAULT" /> |
||||||
|
<category android:name="android.intent.category.BROWSABLE" /> |
||||||
<data android:scheme="magnet" /> |
|
||||||
</intent-filter> |
<data android:scheme="magnet" /> |
||||||
|
</intent-filter> |
||||||
<meta-data |
|
||||||
android:name="android.app.default_searchable" |
<meta-data |
||||||
android:value="org.transdroid.core.gui.search.SearchActivity_" /> |
android:name="android.app.default_searchable" |
||||||
</activity> |
android:value="org.transdroid.core.gui.search.SearchActivity_" /> |
||||||
<activity |
</activity> |
||||||
android:name="org.transdroid.core.gui.DetailsActivity_" |
<activity |
||||||
android:theme="@style/TransdroidTheme" |
android:name="org.transdroid.core.gui.DetailsActivity_" |
||||||
android:uiOptions="splitActionBarWhenNarrow" > |
android:theme="@style/TransdroidTheme" |
||||||
</activity> |
android:uiOptions="splitActionBarWhenNarrow" /> |
||||||
|
|
||||||
<!-- Settings screens --> |
<!-- Settings screens --> |
||||||
<activity |
<activity |
||||||
android:name="org.transdroid.core.gui.settings.MainSettingsActivity_" |
android:name="org.transdroid.core.gui.settings.MainSettingsActivity_" |
||||||
android:theme="@style/TransdroidTheme.Settings" /> |
android:theme="@style/TransdroidTheme.Settings" /> |
||||||
<activity |
<activity |
||||||
android:name="org.transdroid.core.gui.settings.ServerSettingsActivity_" |
android:name="org.transdroid.core.gui.settings.ServerSettingsActivity_" |
||||||
android:theme="@style/TransdroidTheme.Settings" /> |
android:theme="@style/TransdroidTheme.Settings" /> |
||||||
<activity |
<activity |
||||||
android:name="org.transdroid.core.gui.settings.WebsearchSettingsActivity_" |
android:name="org.transdroid.core.gui.settings.WebsearchSettingsActivity_" |
||||||
android:theme="@style/TransdroidTheme.Settings" /> |
android:theme="@style/TransdroidTheme.Settings" /> |
||||||
<activity |
<activity |
||||||
android:name="org.transdroid.core.gui.settings.RssfeedSettingsActivity_" |
android:name="org.transdroid.core.gui.settings.RssfeedSettingsActivity_" |
||||||
android:theme="@style/TransdroidTheme.Settings" /> |
android:theme="@style/TransdroidTheme.Settings" /> |
||||||
<activity |
<activity |
||||||
android:name="org.transdroid.core.gui.settings.NotificationSettingsActivity_" |
android:name="org.transdroid.core.gui.settings.NotificationSettingsActivity_" |
||||||
android:theme="@style/TransdroidTheme.Settings" /> |
android:theme="@style/TransdroidTheme.Settings" /> |
||||||
<activity |
<activity |
||||||
android:name="org.transdroid.core.gui.settings.SystemSettingsActivity_" |
android:name="org.transdroid.core.gui.settings.SystemSettingsActivity_" |
||||||
android:theme="@style/TransdroidTheme.Settings" /> |
android:theme="@style/TransdroidTheme.Settings" /> |
||||||
<activity |
<activity |
||||||
android:name="org.transdroid.core.gui.settings.HelpSettingsActivity_" |
android:name="org.transdroid.core.gui.settings.HelpSettingsActivity_" |
||||||
android:theme="@style/TransdroidTheme.Settings" /> |
android:theme="@style/TransdroidTheme.Settings" /> |
||||||
<activity |
<activity |
||||||
android:name="org.transdroid.core.gui.navigation.DialogHelper_" |
android:name="org.transdroid.core.gui.navigation.DialogHelper_" |
||||||
android:theme="@style/TransdroidTheme.Settings" /> |
android:theme="@style/TransdroidTheme.Settings" /> |
||||||
|
|
||||||
<!-- Seedbox settings --> |
<!-- Seedbox settings --> |
||||||
<activity |
<activity |
||||||
android:name="org.transdroid.core.seedbox.DediseedboxSettingsActivity_" |
android:name="org.transdroid.core.seedbox.DediseedboxSettingsActivity_" |
||||||
android:theme="@style/TransdroidTheme.Settings" /> |
android:theme="@style/TransdroidTheme.Settings" /> |
||||||
<activity |
<activity |
||||||
android:name="org.transdroid.core.seedbox.SeedstuffSettingsActivity_" |
android:name="org.transdroid.core.seedbox.SeedstuffSettingsActivity_" |
||||||
android:theme="@style/TransdroidTheme.Settings" /> |
android:theme="@style/TransdroidTheme.Settings" /> |
||||||
<activity |
<activity |
||||||
android:name="org.transdroid.core.seedbox.XirvikSharedSettingsActivity_" |
android:name="org.transdroid.core.seedbox.XirvikSharedSettingsActivity_" |
||||||
android:theme="@style/TransdroidTheme.Settings" /> |
android:theme="@style/TransdroidTheme.Settings" /> |
||||||
<activity |
<activity |
||||||
android:name="org.transdroid.core.seedbox.XirvikSemiSettingsActivity_" |
android:name="org.transdroid.core.seedbox.XirvikSemiSettingsActivity_" |
||||||
android:theme="@style/TransdroidTheme.Settings" /> |
android:theme="@style/TransdroidTheme.Settings" /> |
||||||
<activity |
<activity |
||||||
android:name="org.transdroid.core.seedbox.XirvikDediSettingsActivity_" |
android:name="org.transdroid.core.seedbox.XirvikDediSettingsActivity_" |
||||||
android:theme="@style/TransdroidTheme.Settings" /> |
android:theme="@style/TransdroidTheme.Settings" /> |
||||||
|
|
||||||
<!-- Search --> |
<!-- Search --> |
||||||
<activity |
<activity |
||||||
android:name="org.transdroid.core.gui.search.SearchActivity_" |
android:name="org.transdroid.core.gui.search.SearchActivity_" |
||||||
android:icon="@drawable/ic_launcher" |
android:icon="@drawable/ic_launcher" |
||||||
android:label="@string/search_torrentsearch" |
android:label="@string/search_torrentsearch" |
||||||
android:launchMode="singleTask" |
android:launchMode="singleTask" |
||||||
android:theme="@style/TransdroidTheme" > |
android:theme="@style/TransdroidTheme"> |
||||||
<intent-filter> |
<intent-filter> |
||||||
<action android:name="android.intent.action.SEARCH" /> |
<action android:name="android.intent.action.SEARCH" /> |
||||||
|
|
||||||
<category android:name="android.intent.category.DEFAULT" /> |
<category android:name="android.intent.category.DEFAULT" /> |
||||||
</intent-filter> |
</intent-filter> |
||||||
<intent-filter> |
<intent-filter> |
||||||
<action android:name="android.intent.action.SEND" /> |
<action android:name="android.intent.action.SEND" /> |
||||||
|
|
||||||
<category android:name="android.intent.category.DEFAULT" /> |
<category android:name="android.intent.category.DEFAULT" /> |
||||||
|
|
||||||
<data android:mimeType="text/plain" /> |
<data android:mimeType="text/plain" /> |
||||||
</intent-filter> |
</intent-filter> |
||||||
|
|
||||||
<meta-data |
<meta-data |
||||||
android:name="android.app.searchable" |
android:name="android.app.searchable" |
||||||
android:resource="@xml/searchable" /> |
android:resource="@xml/searchable" /> |
||||||
<meta-data |
<meta-data |
||||||
android:name="android.app.default_searchable" |
android:name="android.app.default_searchable" |
||||||
android:value="org.transdroid.core.gui.search.SearchActivity_" /> |
android:value="org.transdroid.core.gui.search.SearchActivity_" /> |
||||||
</activity> |
</activity> |
||||||
|
|
||||||
<provider |
<provider |
||||||
android:name="org.transdroid.core.gui.search.SearchHistoryProvider" |
android:name="org.transdroid.core.gui.search.SearchHistoryProvider" |
||||||
android:authorities="@string/search_history_authority" |
android:authorities="@string/search_history_authority" |
||||||
android:exported="false" /> |
android:exported="false" /> |
||||||
|
|
||||||
<!-- RSS --> |
<!-- RSS --> |
||||||
<activity |
<activity |
||||||
android:name="org.transdroid.core.gui.rss.RssFeedsActivity_" |
android:name="org.transdroid.core.gui.rss.RssFeedsActivity_" |
||||||
android:label="@string/rss_feeds" |
android:label="@string/rss_feeds" |
||||||
android:launchMode="singleTop" |
android:launchMode="singleTop" |
||||||
android:theme="@style/TransdroidTheme" /> |
android:theme="@style/TransdroidTheme" /> |
||||||
<activity |
<activity |
||||||
android:name="org.transdroid.core.gui.rss.RssItemsActivity_" |
android:name="org.transdroid.core.gui.rss.RssItemsActivity_" |
||||||
android:label="@string/rss_feeds" |
android:label="@string/rss_feeds" |
||||||
android:theme="@style/TransdroidTheme" /> |
android:theme="@style/TransdroidTheme" /> |
||||||
|
|
||||||
<receiver android:name="org.transdroid.core.service.BootReceiver_" > |
<receiver android:name="org.transdroid.core.service.BootReceiver_"> |
||||||
<intent-filter> |
<intent-filter> |
||||||
<action |
<action |
||||||
android:name="android.intent.action.BOOT_COMPLETED" |
android:name="android.intent.action.BOOT_COMPLETED" |
||||||
android:value="android.intent.action.BOOT_COMPLETED" /> |
android:value="android.intent.action.BOOT_COMPLETED" /> |
||||||
</intent-filter> |
</intent-filter> |
||||||
</receiver> |
</receiver> |
||||||
|
|
||||||
<service |
<service |
||||||
android:name="org.transdroid.core.service.ControlService_" |
android:name="org.transdroid.core.service.ControlService_" |
||||||
android:exported="true" |
android:exported="true" |
||||||
tools:ignore="ExportedService" > |
tools:ignore="ExportedService"> |
||||||
<intent-filter> |
<intent-filter> |
||||||
<action android:name="org.transdroid.control.SET_TRANSFER_RATES" /> |
<action android:name="org.transdroid.control.SET_TRANSFER_RATES" /> |
||||||
<action android:name="org.transdroid.control.PAUSE_ALL" /> |
<action android:name="org.transdroid.control.PAUSE_ALL" /> |
||||||
<action android:name="org.transdroid.control.RESUME_ALL" /> |
<action android:name="org.transdroid.control.RESUME_ALL" /> |
||||||
<action android:name="org.transdroid.control.START_ALL" /> |
<action android:name="org.transdroid.control.START_ALL" /> |
||||||
<action android:name="org.transdroid.control.STOP_ALL" /> |
<action android:name="org.transdroid.control.STOP_ALL" /> |
||||||
</intent-filter> |
</intent-filter> |
||||||
</service> |
</service> |
||||||
|
|
||||||
<!-- Home screen widget --> |
<!-- Home screen widget --> |
||||||
<activity |
<activity |
||||||
android:name="org.transdroid.core.widget.ListWidgetConfigActivity_" |
android:name="org.transdroid.core.widget.ListWidgetConfigActivity_" |
||||||
android:theme="@style/TransdroidTheme.WidgetConfig" > |
android:theme="@style/TransdroidTheme.WidgetConfig"> |
||||||
<intent-filter> |
<intent-filter> |
||||||
<action android:name="android.appwidget.action.APPWIDGET_CONFIGURE" /> |
<action android:name="android.appwidget.action.APPWIDGET_CONFIGURE" /> |
||||||
</intent-filter> |
</intent-filter> |
||||||
</activity> |
</activity> |
||||||
|
|
||||||
<service |
<service |
||||||
android:name="org.transdroid.core.widget.ListWidgetViewsService_" |
android:name="org.transdroid.core.widget.ListWidgetViewsService_" |
||||||
android:exported="false" |
android:exported="false" |
||||||
android:permission="android.permission.BIND_REMOTEVIEWS" /> |
android:permission="android.permission.BIND_REMOTEVIEWS" /> |
||||||
|
|
||||||
<receiver |
<receiver android:name="org.transdroid.core.widget.ListWidgetProvider_"> |
||||||
android:name="org.transdroid.core.widget.ListWidgetProvider_"> |
<intent-filter> |
||||||
<intent-filter> |
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" /> |
||||||
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" /> |
</intent-filter> |
||||||
</intent-filter> |
|
||||||
|
<meta-data |
||||||
<meta-data |
android:name="android.appwidget.provider" |
||||||
android:name="android.appwidget.provider" |
android:resource="@xml/listwidget_info" /> |
||||||
android:resource="@xml/listwidget_info" /> |
</receiver> |
||||||
</receiver> |
</application> |
||||||
</application> |
|
||||||
|
|
||||||
</manifest> |
</manifest> |
||||||
|
@ -1,122 +1,122 @@ |
|||||||
/* |
/* |
||||||
* Copyright 2010-2018 Eric Kok et al. |
* Copyright 2010-2018 Eric Kok et al. |
||||||
* |
* |
||||||
* Transdroid is free software: you can redistribute it and/or modify |
* Transdroid is free software: you can redistribute it and/or modify |
||||||
* it under the terms of the GNU General Public License as published by |
* it under the terms of the GNU General Public License as published by |
||||||
* the Free Software Foundation, either version 3 of the License, or |
* the Free Software Foundation, either version 3 of the License, or |
||||||
* (at your option) any later version. |
* (at your option) any later version. |
||||||
* |
* |
||||||
* Transdroid is distributed in the hope that it will be useful, |
* Transdroid is distributed in the hope that it will be useful, |
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
* GNU General Public License for more details. |
* GNU General Public License for more details. |
||||||
* |
* |
||||||
* You should have received a copy of the GNU General Public License |
* You should have received a copy of the GNU General Public License |
||||||
* along with Transdroid. If not, see <http://www.gnu.org/licenses/>.
|
* along with Transdroid. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/ |
*/ |
||||||
package org.transdroid.core.app.search; |
package org.transdroid.core.app.search; |
||||||
|
|
||||||
import java.util.Date; |
|
||||||
|
|
||||||
import android.os.Parcel; |
import android.os.Parcel; |
||||||
import android.os.Parcelable; |
import android.os.Parcelable; |
||||||
|
|
||||||
|
import java.util.Date; |
||||||
|
|
||||||
/** |
/** |
||||||
* Represents a search result as retrieved by querying the Torrent Search package. |
* Represents a search result as retrieved by querying the Torrent Search package. |
||||||
|
* |
||||||
* @author Eric Kok |
* @author Eric Kok |
||||||
*/ |
*/ |
||||||
public class SearchResult implements Parcelable { |
public class SearchResult implements Parcelable { |
||||||
|
|
||||||
private final int id; |
public static final Parcelable.Creator<SearchResult> CREATOR = new Parcelable.Creator<SearchResult>() { |
||||||
private final String name; |
public SearchResult createFromParcel(Parcel in) { |
||||||
private final String torrentUrl; |
return new SearchResult(in); |
||||||
private final String detailsUrl; |
} |
||||||
private final String size; |
|
||||||
private final Date addedOn; |
public SearchResult[] newArray(int size) { |
||||||
private final String seeders; |
return new SearchResult[size]; |
||||||
private final String leechers; |
} |
||||||
|
}; |
||||||
public SearchResult(int id, String name, String torrentUrl, String detailsUrl, String size, long addedOnTime, |
private final int id; |
||||||
String seeders, String leechers) { |
private final String name; |
||||||
this.id = id; |
private final String torrentUrl; |
||||||
this.name = name; |
private final String detailsUrl; |
||||||
this.torrentUrl = torrentUrl; |
private final String size; |
||||||
this.detailsUrl = detailsUrl; |
private final Date addedOn; |
||||||
this.size = size; |
private final String seeders; |
||||||
this.addedOn = (addedOnTime == -1L) ? null : new Date(addedOnTime); |
private final String leechers; |
||||||
this.seeders = seeders; |
|
||||||
this.leechers = leechers; |
public SearchResult(int id, String name, String torrentUrl, String detailsUrl, String size, long addedOnTime, |
||||||
} |
String seeders, String leechers) { |
||||||
|
this.id = id; |
||||||
public int getId() { |
this.name = name; |
||||||
return id; |
this.torrentUrl = torrentUrl; |
||||||
} |
this.detailsUrl = detailsUrl; |
||||||
|
this.size = size; |
||||||
public String getName() { |
this.addedOn = (addedOnTime == -1L) ? null : new Date(addedOnTime); |
||||||
return name; |
this.seeders = seeders; |
||||||
} |
this.leechers = leechers; |
||||||
|
} |
||||||
public String getTorrentUrl() { |
|
||||||
return torrentUrl; |
public SearchResult(Parcel in) { |
||||||
} |
id = in.readInt(); |
||||||
|
name = in.readString(); |
||||||
public String getDetailsUrl() { |
torrentUrl = in.readString(); |
||||||
return detailsUrl; |
detailsUrl = in.readString(); |
||||||
} |
size = in.readString(); |
||||||
|
long addedOnIn = in.readLong(); |
||||||
public String getSize() { |
addedOn = addedOnIn == -1 ? null : new Date(addedOnIn); |
||||||
return size; |
seeders = in.readString(); |
||||||
} |
leechers = in.readString(); |
||||||
|
} |
||||||
public Date getAddedOn() { |
|
||||||
return addedOn; |
public int getId() { |
||||||
} |
return id; |
||||||
|
} |
||||||
public String getSeeders() { |
|
||||||
return seeders; |
public String getName() { |
||||||
} |
return name; |
||||||
|
} |
||||||
public String getLeechers() { |
|
||||||
return leechers; |
public String getTorrentUrl() { |
||||||
} |
return torrentUrl; |
||||||
|
} |
||||||
@Override |
|
||||||
public int describeContents() { |
public String getDetailsUrl() { |
||||||
return 0; |
return detailsUrl; |
||||||
} |
} |
||||||
|
|
||||||
@Override |
public String getSize() { |
||||||
public void writeToParcel(Parcel out, int flags) { |
return size; |
||||||
out.writeInt(id); |
} |
||||||
out.writeString(name); |
|
||||||
out.writeString(torrentUrl); |
public Date getAddedOn() { |
||||||
out.writeString(detailsUrl); |
return addedOn; |
||||||
out.writeString(size); |
} |
||||||
out.writeLong(addedOn == null ? -1 : addedOn.getTime()); |
|
||||||
out.writeString(seeders); |
public String getSeeders() { |
||||||
out.writeString(leechers); |
return seeders; |
||||||
} |
} |
||||||
|
|
||||||
public static final Parcelable.Creator<SearchResult> CREATOR = new Parcelable.Creator<SearchResult>() { |
public String getLeechers() { |
||||||
public SearchResult createFromParcel(Parcel in) { |
return leechers; |
||||||
return new SearchResult(in); |
} |
||||||
} |
|
||||||
|
@Override |
||||||
public SearchResult[] newArray(int size) { |
public int describeContents() { |
||||||
return new SearchResult[size]; |
return 0; |
||||||
} |
} |
||||||
}; |
|
||||||
|
@Override |
||||||
public SearchResult(Parcel in) { |
public void writeToParcel(Parcel out, int flags) { |
||||||
id = in.readInt(); |
out.writeInt(id); |
||||||
name = in.readString(); |
out.writeString(name); |
||||||
torrentUrl = in.readString(); |
out.writeString(torrentUrl); |
||||||
detailsUrl = in.readString(); |
out.writeString(detailsUrl); |
||||||
size = in.readString(); |
out.writeString(size); |
||||||
long addedOnIn = in.readLong(); |
out.writeLong(addedOn == null ? -1 : addedOn.getTime()); |
||||||
addedOn = addedOnIn == -1 ? null : new Date(addedOnIn); |
out.writeString(seeders); |
||||||
seeders = in.readString(); |
out.writeString(leechers); |
||||||
leechers = in.readString(); |
} |
||||||
} |
|
||||||
|
|
||||||
} |
} |
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,122 +1,126 @@ |
|||||||
/* |
/* |
||||||
* Copyright 2010-2018 Eric Kok et al. |
* Copyright 2010-2018 Eric Kok et al. |
||||||
* |
* |
||||||
* Transdroid is free software: you can redistribute it and/or modify |
* Transdroid is free software: you can redistribute it and/or modify |
||||||
* it under the terms of the GNU General Public License as published by |
* it under the terms of the GNU General Public License as published by |
||||||
* the Free Software Foundation, either version 3 of the License, or |
* the Free Software Foundation, either version 3 of the License, or |
||||||
* (at your option) any later version. |
* (at your option) any later version. |
||||||
* |
* |
||||||
* Transdroid is distributed in the hope that it will be useful, |
* Transdroid is distributed in the hope that it will be useful, |
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
* GNU General Public License for more details. |
* GNU General Public License for more details. |
||||||
* |
* |
||||||
* You should have received a copy of the GNU General Public License |
* You should have received a copy of the GNU General Public License |
||||||
* along with Transdroid. If not, see <http://www.gnu.org/licenses/>.
|
* along with Transdroid. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/ |
*/ |
||||||
package org.transdroid.core.app.settings; |
package org.transdroid.core.app.settings; |
||||||
|
|
||||||
import java.util.Date; |
import android.net.Uri; |
||||||
|
import android.text.TextUtils; |
||||||
|
|
||||||
import org.transdroid.core.gui.lists.SimpleListItem; |
import org.transdroid.core.gui.lists.SimpleListItem; |
||||||
|
|
||||||
import android.net.Uri; |
import java.util.Date; |
||||||
import android.text.TextUtils; |
|
||||||
|
|
||||||
/** |
/** |
||||||
* Represents a user-specified RSS feed. |
* Represents a user-specified RSS feed. |
||||||
|
* |
||||||
* @author Eric Kok |
* @author Eric Kok |
||||||
*/ |
*/ |
||||||
public class RssfeedSetting implements SimpleListItem { |
public class RssfeedSetting implements SimpleListItem { |
||||||
|
|
||||||
private static final String DEFAULT_NAME = "Default"; |
private static final String DEFAULT_NAME = "Default"; |
||||||
|
|
||||||
private final int order; |
private final int order; |
||||||
private final String name; |
private final String name; |
||||||
private final String url; |
private final String url; |
||||||
private final boolean requiresAuth; |
private final boolean requiresAuth; |
||||||
private final boolean alarm; |
private final boolean alarm; |
||||||
private final String excludeFilter; |
private final String excludeFilter; |
||||||
private final String includeFilter; |
private final String includeFilter; |
||||||
private Date lastViewed; |
private final String lastViewedItemUrl; |
||||||
private final String lastViewedItemUrl; |
private Date lastViewed; |
||||||
|
|
||||||
public RssfeedSetting(int order, String name, String baseUrl, boolean needsAuth, boolean alarm, String excludeFilter, String includeFilter, Date lastViewed, |
public RssfeedSetting(int order, String name, String baseUrl, boolean needsAuth, boolean alarm, String excludeFilter, String includeFilter, Date lastViewed, |
||||||
String lastViewedItemUrl) { |
String lastViewedItemUrl) { |
||||||
this.order = order; |
this.order = order; |
||||||
this.name = name; |
this.name = name; |
||||||
this.url = baseUrl; |
this.url = baseUrl; |
||||||
this.requiresAuth = needsAuth; |
this.requiresAuth = needsAuth; |
||||||
this.alarm = alarm; |
this.alarm = alarm; |
||||||
this.excludeFilter = excludeFilter; |
this.excludeFilter = excludeFilter; |
||||||
this.includeFilter = includeFilter; |
this.includeFilter = includeFilter; |
||||||
this.lastViewed = lastViewed; |
this.lastViewed = lastViewed; |
||||||
this.lastViewedItemUrl = lastViewedItemUrl; |
this.lastViewedItemUrl = lastViewedItemUrl; |
||||||
} |
} |
||||||
|
|
||||||
public int getOrder() { |
public int getOrder() { |
||||||
return order; |
return order; |
||||||
} |
} |
||||||
|
|
||||||
@Override |
@Override |
||||||
public String getName() { |
public String getName() { |
||||||
if (!TextUtils.isEmpty(name)) |
if (!TextUtils.isEmpty(name)) |
||||||
return name; |
return name; |
||||||
if (!TextUtils.isEmpty(url)) { |
if (!TextUtils.isEmpty(url)) { |
||||||
String host = Uri.parse(url).getHost(); |
String host = Uri.parse(url).getHost(); |
||||||
return host == null ? DEFAULT_NAME : host; |
return host == null ? DEFAULT_NAME : host; |
||||||
} |
} |
||||||
return DEFAULT_NAME; |
return DEFAULT_NAME; |
||||||
} |
} |
||||||
|
|
||||||
public String getUrl() { |
public String getUrl() { |
||||||
return url; |
return url; |
||||||
} |
} |
||||||
|
|
||||||
public boolean requiresExternalAuthentication() { |
public boolean requiresExternalAuthentication() { |
||||||
return requiresAuth; |
return requiresAuth; |
||||||
} |
} |
||||||
|
|
||||||
public boolean shouldAlarmOnNewItems() { |
public boolean shouldAlarmOnNewItems() { |
||||||
return alarm; |
return alarm; |
||||||
} |
} |
||||||
|
|
||||||
public String getExcludeFilter() { |
public String getExcludeFilter() { |
||||||
return excludeFilter; |
return excludeFilter; |
||||||
} |
} |
||||||
|
|
||||||
public String getIncludeFilter() { |
public String getIncludeFilter() { |
||||||
return includeFilter; |
return includeFilter; |
||||||
} |
} |
||||||
|
|
||||||
/** |
/** |
||||||
* Returns the date on which we last checked this feed. Note that this is NOT updated automatically after the |
* Returns the date on which we last checked this feed. Note that this is NOT updated automatically after the |
||||||
* settings were loaded from {@link ApplicationSettings}; instead the settings have to be manually loaded again |
* settings were loaded from {@link ApplicationSettings}; instead the settings have to be manually loaded again |
||||||
* using {@link ApplicationSettings#getRssfeedSetting(int)}. |
* using {@link ApplicationSettings#getRssfeedSetting(int)}. |
||||||
* @return The last new item's URL as URL-encoded string |
* |
||||||
*/ |
* @return The last new item's URL as URL-encoded string |
||||||
public Date getLastViewed() { |
*/ |
||||||
return this.lastViewed; |
public Date getLastViewed() { |
||||||
} |
return this.lastViewed; |
||||||
|
} |
||||||
/** |
|
||||||
* Returns the URL of the item that was the newest last time we checked this feed. Note that this is NOT updated |
/** |
||||||
* automatically after the settings were loaded from {@link ApplicationSettings}; instead the settings have to be |
* Returns the URL of the item that was the newest last time we checked this feed. Note that this is NOT updated |
||||||
* manually loaded again using {@link ApplicationSettings#getRssfeedSetting(int)}. |
* automatically after the settings were loaded from {@link ApplicationSettings}; instead the settings have to be |
||||||
* @return The last new item's URL as URL-encoded string |
* manually loaded again using {@link ApplicationSettings#getRssfeedSetting(int)}. |
||||||
*/ |
* |
||||||
public String getLastViewedItemUrl() { |
* @return The last new item's URL as URL-encoded string |
||||||
return this.lastViewedItemUrl; |
*/ |
||||||
} |
public String getLastViewedItemUrl() { |
||||||
|
return this.lastViewedItemUrl; |
||||||
/** |
} |
||||||
* Returns a nicely formatted identifier containing (a portion of) the feed URL |
|
||||||
* @return A string to identify this feed's URL |
/** |
||||||
*/ |
* Returns a nicely formatted identifier containing (a portion of) the feed URL |
||||||
public String getHumanReadableIdentifier() { |
* |
||||||
String host = Uri.parse(url).getHost(); |
* @return A string to identify this feed's URL |
||||||
String path = Uri.parse(url).getPath(); |
*/ |
||||||
return (host == null ? null : host + (path == null ? "" : path)); |
public String getHumanReadableIdentifier() { |
||||||
} |
String host = Uri.parse(url).getHost(); |
||||||
|
String path = Uri.parse(url).getPath(); |
||||||
|
return (host == null ? null : host + (path == null ? "" : path)); |
||||||
|
} |
||||||
|
|
||||||
} |
} |
||||||
|
@ -1,81 +1,82 @@ |
|||||||
/* |
/* |
||||||
* Copyright 2010-2018 Eric Kok et al. |
* Copyright 2010-2018 Eric Kok et al. |
||||||
* |
* |
||||||
* Transdroid is free software: you can redistribute it and/or modify |
* Transdroid is free software: you can redistribute it and/or modify |
||||||
* it under the terms of the GNU General Public License as published by |
* it under the terms of the GNU General Public License as published by |
||||||
* the Free Software Foundation, either version 3 of the License, or |
* the Free Software Foundation, either version 3 of the License, or |
||||||
* (at your option) any later version. |
* (at your option) any later version. |
||||||
* |
* |
||||||
* Transdroid is distributed in the hope that it will be useful, |
* Transdroid is distributed in the hope that it will be useful, |
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
* GNU General Public License for more details. |
* GNU General Public License for more details. |
||||||
* |
* |
||||||
* You should have received a copy of the GNU General Public License |
* You should have received a copy of the GNU General Public License |
||||||
* along with Transdroid. If not, see <http://www.gnu.org/licenses/>.
|
* along with Transdroid. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/ |
*/ |
||||||
package org.transdroid.core.app.settings; |
package org.transdroid.core.app.settings; |
||||||
|
|
||||||
import org.transdroid.core.gui.lists.SimpleListItem; |
|
||||||
import org.transdroid.core.gui.search.SearchSetting; |
|
||||||
|
|
||||||
import android.net.Uri; |
import android.net.Uri; |
||||||
import android.text.TextUtils; |
import android.text.TextUtils; |
||||||
|
|
||||||
|
import org.transdroid.core.gui.lists.SimpleListItem; |
||||||
|
import org.transdroid.core.gui.search.SearchSetting; |
||||||
|
|
||||||
/** |
/** |
||||||
* Represents a user-specified website that can be searched (by starting the browser, rather than in-app) |
* Represents a user-specified website that can be searched (by starting the browser, rather than in-app) |
||||||
|
* |
||||||
* @author Eric Kok |
* @author Eric Kok |
||||||
*/ |
*/ |
||||||
public class WebsearchSetting implements SimpleListItem, SearchSetting { |
public class WebsearchSetting implements SimpleListItem, SearchSetting { |
||||||
|
|
||||||
private static final String DEFAULT_NAME = "Default"; |
public static final String KEY_PREFIX = "websearch_"; |
||||||
public static final String KEY_PREFIX = "websearch_"; |
private static final String DEFAULT_NAME = "Default"; |
||||||
|
private final int order; |
||||||
private final int order; |
private final String name; |
||||||
private final String name; |
private final String baseUrl; |
||||||
private final String baseUrl; |
private final String cookies; |
||||||
private final String cookies; |
|
||||||
|
public WebsearchSetting(int order, String name, String baseUrl, String cookies) { |
||||||
|
this.order = order; |
||||||
|
this.name = name; |
||||||
|
this.baseUrl = baseUrl; |
||||||
|
this.cookies = cookies; |
||||||
|
} |
||||||
|
|
||||||
|
public int getOrder() { |
||||||
|
return order; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public String getName() { |
||||||
|
if (!TextUtils.isEmpty(name)) |
||||||
|
return name; |
||||||
|
if (!TextUtils.isEmpty(baseUrl)) { |
||||||
|
String host = Uri.parse(baseUrl).getHost(); |
||||||
|
return host == null ? DEFAULT_NAME : host; |
||||||
|
} |
||||||
|
return DEFAULT_NAME; |
||||||
|
} |
||||||
|
|
||||||
public WebsearchSetting(int order, String name, String baseUrl, String cookies) { |
public String getBaseUrl() { |
||||||
this.order = order; |
return baseUrl; |
||||||
this.name = name; |
} |
||||||
this.baseUrl = baseUrl; |
|
||||||
this.cookies = cookies; |
|
||||||
} |
|
||||||
|
|
||||||
public int getOrder() { |
public String getCookies() { |
||||||
return order; |
return cookies; |
||||||
} |
} |
||||||
|
|
||||||
@Override |
public String getKey() { |
||||||
public String getName() { |
return KEY_PREFIX + getOrder(); |
||||||
if (!TextUtils.isEmpty(name)) |
} |
||||||
return name; |
|
||||||
if (!TextUtils.isEmpty(baseUrl)) { |
|
||||||
String host = Uri.parse(baseUrl).getHost(); |
|
||||||
return host == null? DEFAULT_NAME: host; |
|
||||||
} |
|
||||||
return DEFAULT_NAME; |
|
||||||
} |
|
||||||
|
|
||||||
public String getBaseUrl() { |
|
||||||
return baseUrl; |
|
||||||
} |
|
||||||
|
|
||||||
public String getCookies() { |
/** |
||||||
return cookies; |
* Returns a nicely formatted identifier containing (a portion of) the search base URL |
||||||
} |
* |
||||||
|
* @return A string to identify this site's search URL |
||||||
public String getKey() { |
*/ |
||||||
return KEY_PREFIX + getOrder(); |
public String getHumanReadableIdentifier() { |
||||||
} |
return Uri.parse(baseUrl).getHost(); |
||||||
|
} |
||||||
|
|
||||||
/** |
|
||||||
* Returns a nicely formatted identifier containing (a portion of) the search base URL |
|
||||||
* @return A string to identify this site's search URL |
|
||||||
*/ |
|
||||||
public String getHumanReadableIdentifier() { |
|
||||||
return Uri.parse(baseUrl).getHost(); |
|
||||||
} |
|
||||||
|
|
||||||
} |
} |
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,230 +1,235 @@ |
|||||||
/* |
/* |
||||||
* Copyright 2010-2018 Eric Kok et al. |
* Copyright 2010-2018 Eric Kok et al. |
||||||
* |
* |
||||||
* Transdroid is free software: you can redistribute it and/or modify |
* Transdroid is free software: you can redistribute it and/or modify |
||||||
* it under the terms of the GNU General Public License as published by |
* it under the terms of the GNU General Public License as published by |
||||||
* the Free Software Foundation, either version 3 of the License, or |
* the Free Software Foundation, either version 3 of the License, or |
||||||
* (at your option) any later version. |
* (at your option) any later version. |
||||||
* |
* |
||||||
* Transdroid is distributed in the hope that it will be useful, |
* Transdroid is distributed in the hope that it will be useful, |
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
* GNU General Public License for more details. |
* GNU General Public License for more details. |
||||||
* |
* |
||||||
* You should have received a copy of the GNU General Public License |
* You should have received a copy of the GNU General Public License |
||||||
* along with Transdroid. If not, see <http://www.gnu.org/licenses/>.
|
* along with Transdroid. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/ |
*/ |
||||||
package org.transdroid.core.gui.lists; |
package org.transdroid.core.gui.lists; |
||||||
|
|
||||||
import java.util.ArrayList; |
|
||||||
import java.util.List; |
|
||||||
|
|
||||||
import org.transdroid.R; |
|
||||||
import org.transdroid.core.gui.navigation.*; |
|
||||||
import org.transdroid.core.gui.lists.PiecesMapView; |
|
||||||
import org.transdroid.daemon.Torrent; |
|
||||||
import org.transdroid.daemon.TorrentFile; |
|
||||||
|
|
||||||
import android.content.Context; |
import android.content.Context; |
||||||
import android.text.util.Linkify; |
import android.text.util.Linkify; |
||||||
import android.view.View; |
import android.view.View; |
||||||
import android.view.ViewGroup; |
import android.view.ViewGroup; |
||||||
import android.widget.BaseAdapter; |
import android.widget.BaseAdapter; |
||||||
|
|
||||||
|
import org.transdroid.R; |
||||||
|
import org.transdroid.core.gui.navigation.FilterSeparatorView_; |
||||||
|
import org.transdroid.daemon.Torrent; |
||||||
|
import org.transdroid.daemon.TorrentFile; |
||||||
|
|
||||||
|
import java.util.ArrayList; |
||||||
|
import java.util.List; |
||||||
|
|
||||||
/** |
/** |
||||||
* List adapter that holds a header view showing torrent details and show the list list contained by the torrent. |
* List adapter that holds a header view showing torrent details and show the list list contained by the torrent. |
||||||
|
* |
||||||
* @author Eric Kok |
* @author Eric Kok |
||||||
*/ |
*/ |
||||||
public class DetailsAdapter extends MergeAdapter { |
public class DetailsAdapter extends MergeAdapter { |
||||||
|
|
||||||
private ViewHolderAdapter torrentDetailsViewAdapter = null; |
private ViewHolderAdapter torrentDetailsViewAdapter = null; |
||||||
private TorrentDetailsView torrentDetailsView = null; |
private TorrentDetailsView torrentDetailsView = null; |
||||||
private ViewHolderAdapter piecesSeparatorAdapter = null; |
private ViewHolderAdapter piecesSeparatorAdapter = null; |
||||||
private ViewHolderAdapter piecesMapViewAdapter = null; |
private ViewHolderAdapter piecesMapViewAdapter = null; |
||||||
private PiecesMapView piecesMapView = null; |
private PiecesMapView piecesMapView = null; |
||||||
private ViewHolderAdapter trackersSeparatorAdapter = null; |
private ViewHolderAdapter trackersSeparatorAdapter = null; |
||||||
private SimpleListItemAdapter trackersAdapter = null; |
private SimpleListItemAdapter trackersAdapter = null; |
||||||
private ViewHolderAdapter errorsSeparatorAdapter = null; |
private ViewHolderAdapter errorsSeparatorAdapter = null; |
||||||
private SimpleListItemAdapter errorsAdapter = null; |
private SimpleListItemAdapter errorsAdapter = null; |
||||||
private ViewHolderAdapter torrentFilesSeparatorAdapter = null; |
private ViewHolderAdapter torrentFilesSeparatorAdapter = null; |
||||||
private TorrentFilesAdapter torrentFilesAdapter = null; |
private TorrentFilesAdapter torrentFilesAdapter = null; |
||||||
|
|
||||||
public DetailsAdapter(Context context) { |
public DetailsAdapter(Context context) { |
||||||
// Immediately bind the adapters, or the MergeAdapter will not be able to determine the view types and instead
|
// Immediately bind the adapters, or the MergeAdapter will not be able to determine the view types and instead
|
||||||
// display nothing at all
|
// display nothing at all
|
||||||
|
|
||||||
// Torrent details header
|
// Torrent details header
|
||||||
torrentDetailsView = TorrentDetailsView_.build(context); |
torrentDetailsView = TorrentDetailsView_.build(context); |
||||||
torrentDetailsViewAdapter = new ViewHolderAdapter(torrentDetailsView); |
torrentDetailsViewAdapter = new ViewHolderAdapter(torrentDetailsView); |
||||||
torrentDetailsViewAdapter.setViewEnabled(false); |
torrentDetailsViewAdapter.setViewEnabled(false); |
||||||
torrentDetailsViewAdapter.setViewVisibility(View.GONE); |
torrentDetailsViewAdapter.setViewVisibility(View.GONE); |
||||||
addAdapter(torrentDetailsViewAdapter); |
addAdapter(torrentDetailsViewAdapter); |
||||||
|
|
||||||
// Pieces map
|
// Pieces map
|
||||||
piecesSeparatorAdapter = new ViewHolderAdapter(FilterSeparatorView_.build(context).setText( |
piecesSeparatorAdapter = new ViewHolderAdapter(FilterSeparatorView_.build(context).setText( |
||||||
context.getString(R.string.status_pieces))); |
context.getString(R.string.status_pieces))); |
||||||
piecesSeparatorAdapter.setViewEnabled(false); |
piecesSeparatorAdapter.setViewEnabled(false); |
||||||
piecesSeparatorAdapter.setViewVisibility(View.GONE); |
piecesSeparatorAdapter.setViewVisibility(View.GONE); |
||||||
addAdapter(piecesSeparatorAdapter); |
addAdapter(piecesSeparatorAdapter); |
||||||
piecesMapView = new PiecesMapView(context); |
piecesMapView = new PiecesMapView(context); |
||||||
piecesMapViewAdapter = new ViewHolderAdapter(piecesMapView); |
piecesMapViewAdapter = new ViewHolderAdapter(piecesMapView); |
||||||
piecesMapViewAdapter.setViewEnabled(false); |
piecesMapViewAdapter.setViewEnabled(false); |
||||||
piecesMapViewAdapter.setViewVisibility(View.GONE); |
piecesMapViewAdapter.setViewVisibility(View.GONE); |
||||||
addAdapter(piecesMapViewAdapter); |
addAdapter(piecesMapViewAdapter); |
||||||
|
|
||||||
// Tracker errors
|
// Tracker errors
|
||||||
errorsSeparatorAdapter = new ViewHolderAdapter(FilterSeparatorView_.build(context).setText( |
errorsSeparatorAdapter = new ViewHolderAdapter(FilterSeparatorView_.build(context).setText( |
||||||
context.getString(R.string.status_errors))); |
context.getString(R.string.status_errors))); |
||||||
errorsSeparatorAdapter.setViewEnabled(false); |
errorsSeparatorAdapter.setViewEnabled(false); |
||||||
errorsSeparatorAdapter.setViewVisibility(View.GONE); |
errorsSeparatorAdapter.setViewVisibility(View.GONE); |
||||||
addAdapter(errorsSeparatorAdapter); |
addAdapter(errorsSeparatorAdapter); |
||||||
this.errorsAdapter = new SimpleListItemAdapter(context, new ArrayList<SimpleListItem>()); |
this.errorsAdapter = new SimpleListItemAdapter(context, new ArrayList<>()); |
||||||
this.errorsAdapter.setAutoLinkMask(Linkify.WEB_URLS); |
this.errorsAdapter.setAutoLinkMask(Linkify.WEB_URLS); |
||||||
addAdapter(errorsAdapter); |
addAdapter(errorsAdapter); |
||||||
|
|
||||||
// Trackers
|
// Trackers
|
||||||
trackersSeparatorAdapter = new ViewHolderAdapter(FilterSeparatorView_.build(context).setText( |
trackersSeparatorAdapter = new ViewHolderAdapter(FilterSeparatorView_.build(context).setText( |
||||||
context.getString(R.string.status_trackers))); |
context.getString(R.string.status_trackers))); |
||||||
trackersSeparatorAdapter.setViewEnabled(false); |
trackersSeparatorAdapter.setViewEnabled(false); |
||||||
trackersSeparatorAdapter.setViewVisibility(View.GONE); |
trackersSeparatorAdapter.setViewVisibility(View.GONE); |
||||||
addAdapter(trackersSeparatorAdapter); |
addAdapter(trackersSeparatorAdapter); |
||||||
this.trackersAdapter = new SimpleListItemAdapter(context, new ArrayList<SimpleListItem>()); |
this.trackersAdapter = new SimpleListItemAdapter(context, new ArrayList<>()); |
||||||
addAdapter(trackersAdapter); |
addAdapter(trackersAdapter); |
||||||
|
|
||||||
// Torrent files
|
// Torrent files
|
||||||
torrentFilesSeparatorAdapter = new ViewHolderAdapter(FilterSeparatorView_.build(context).setText( |
torrentFilesSeparatorAdapter = new ViewHolderAdapter(FilterSeparatorView_.build(context).setText( |
||||||
context.getString(R.string.status_files))); |
context.getString(R.string.status_files))); |
||||||
torrentFilesSeparatorAdapter.setViewEnabled(false); |
torrentFilesSeparatorAdapter.setViewEnabled(false); |
||||||
torrentFilesSeparatorAdapter.setViewVisibility(View.GONE); |
torrentFilesSeparatorAdapter.setViewVisibility(View.GONE); |
||||||
addAdapter(torrentFilesSeparatorAdapter); |
addAdapter(torrentFilesSeparatorAdapter); |
||||||
this.torrentFilesAdapter = new TorrentFilesAdapter(context, new ArrayList<TorrentFile>()); |
this.torrentFilesAdapter = new TorrentFilesAdapter(context, new ArrayList<>()); |
||||||
addAdapter(torrentFilesAdapter); |
addAdapter(torrentFilesAdapter); |
||||||
|
|
||||||
} |
} |
||||||
|
|
||||||
/** |
/** |
||||||
* Update the torrent data in the details header of this merge adapter |
* Update the torrent data in the details header of this merge adapter |
||||||
* @param torrent The torrent for which detailed data is shown |
* |
||||||
*/ |
* @param torrent The torrent for which detailed data is shown |
||||||
public void updateTorrent(Torrent torrent) { |
*/ |
||||||
torrentDetailsView.update(torrent); |
public void updateTorrent(Torrent torrent) { |
||||||
torrentDetailsViewAdapter.setViewVisibility(torrent == null ? View.GONE : View.VISIBLE); |
torrentDetailsView.update(torrent); |
||||||
} |
torrentDetailsViewAdapter.setViewVisibility(torrent == null ? View.GONE : View.VISIBLE); |
||||||
|
} |
||||||
/** |
|
||||||
* Update the list of files contained in this torrent |
/** |
||||||
* @param torrentFiles The new list of files, or null if the list and header should be hidden |
* Update the list of files contained in this torrent |
||||||
*/ |
* |
||||||
public void updateTorrentFiles(List<TorrentFile> torrentFiles) { |
* @param torrentFiles The new list of files, or null if the list and header should be hidden |
||||||
if (torrentFiles == null) { |
*/ |
||||||
torrentFilesAdapter.update(new ArrayList<TorrentFile>()); |
public void updateTorrentFiles(List<TorrentFile> torrentFiles) { |
||||||
torrentFilesSeparatorAdapter.setViewVisibility(View.GONE); |
if (torrentFiles == null) { |
||||||
} else { |
torrentFilesAdapter.update(new ArrayList<>()); |
||||||
torrentFilesAdapter.update(torrentFiles); |
torrentFilesSeparatorAdapter.setViewVisibility(View.GONE); |
||||||
torrentFilesSeparatorAdapter.setViewVisibility(View.VISIBLE); |
} else { |
||||||
} |
torrentFilesAdapter.update(torrentFiles); |
||||||
} |
torrentFilesSeparatorAdapter.setViewVisibility(View.VISIBLE); |
||||||
|
} |
||||||
/** |
} |
||||||
* Update the list of trackers |
|
||||||
* @param trackers The new list of trackers known for this torrent, or null if the list and header should be hidden |
/** |
||||||
*/ |
* Update the list of trackers |
||||||
public void updateTrackers(List<? extends SimpleListItem> trackers) { |
* |
||||||
if (trackers == null || trackers.isEmpty()) { |
* @param trackers The new list of trackers known for this torrent, or null if the list and header should be hidden |
||||||
trackersAdapter.update(new ArrayList<SimpleListItemAdapter.SimpleStringItem>()); |
*/ |
||||||
trackersSeparatorAdapter.setViewVisibility(View.GONE); |
public void updateTrackers(List<? extends SimpleListItem> trackers) { |
||||||
} else { |
if (trackers == null || trackers.isEmpty()) { |
||||||
trackersAdapter.update(trackers); |
trackersAdapter.update(new ArrayList<SimpleListItemAdapter.SimpleStringItem>()); |
||||||
trackersSeparatorAdapter.setViewVisibility(View.VISIBLE); |
trackersSeparatorAdapter.setViewVisibility(View.GONE); |
||||||
} |
} else { |
||||||
} |
trackersAdapter.update(trackers); |
||||||
|
trackersSeparatorAdapter.setViewVisibility(View.VISIBLE); |
||||||
/** |
} |
||||||
* Update the list of errors |
} |
||||||
* @param errors The new list of errors known for this torrent, or null if the list and header should be hidden |
|
||||||
*/ |
/** |
||||||
public void updateErrors(List<? extends SimpleListItem> errors) { |
* Update the list of errors |
||||||
if (errors == null || errors.isEmpty()) { |
* |
||||||
errorsAdapter.update(new ArrayList<SimpleListItemAdapter.SimpleStringItem>()); |
* @param errors The new list of errors known for this torrent, or null if the list and header should be hidden |
||||||
errorsSeparatorAdapter.setViewVisibility(View.GONE); |
*/ |
||||||
} else { |
public void updateErrors(List<? extends SimpleListItem> errors) { |
||||||
errorsAdapter.update(errors); |
if (errors == null || errors.isEmpty()) { |
||||||
errorsSeparatorAdapter.setViewVisibility(View.VISIBLE); |
errorsAdapter.update(new ArrayList<SimpleListItemAdapter.SimpleStringItem>()); |
||||||
} |
errorsSeparatorAdapter.setViewVisibility(View.GONE); |
||||||
} |
} else { |
||||||
|
errorsAdapter.update(errors); |
||||||
public void updatePieces(List<Integer> pieces) { |
errorsSeparatorAdapter.setViewVisibility(View.VISIBLE); |
||||||
if (pieces == null || pieces.isEmpty()) { |
} |
||||||
piecesSeparatorAdapter.setViewEnabled(false); |
} |
||||||
piecesSeparatorAdapter.setViewVisibility(View.GONE); |
|
||||||
piecesMapViewAdapter.setViewEnabled(false); |
public void updatePieces(List<Integer> pieces) { |
||||||
piecesMapViewAdapter.setViewVisibility(View.GONE); |
if (pieces == null || pieces.isEmpty()) { |
||||||
} else { |
piecesSeparatorAdapter.setViewEnabled(false); |
||||||
piecesMapView.setPieces(pieces); |
piecesSeparatorAdapter.setViewVisibility(View.GONE); |
||||||
|
piecesMapViewAdapter.setViewEnabled(false); |
||||||
piecesMapViewAdapter.setViewEnabled(true); |
piecesMapViewAdapter.setViewVisibility(View.GONE); |
||||||
piecesMapViewAdapter.setViewVisibility(View.VISIBLE); |
} else { |
||||||
piecesSeparatorAdapter.setViewEnabled(true); |
piecesMapView.setPieces(pieces); |
||||||
piecesSeparatorAdapter.setViewVisibility(View.VISIBLE); |
|
||||||
} |
piecesMapViewAdapter.setViewEnabled(true); |
||||||
} |
piecesMapViewAdapter.setViewVisibility(View.VISIBLE); |
||||||
|
piecesSeparatorAdapter.setViewEnabled(true); |
||||||
/** |
piecesSeparatorAdapter.setViewVisibility(View.VISIBLE); |
||||||
* Clear currently visible torrent, including header and shown lists |
} |
||||||
*/ |
} |
||||||
public void clear() { |
|
||||||
updateTorrent(null); |
/** |
||||||
updateTorrentFiles(null); |
* Clear currently visible torrent, including header and shown lists |
||||||
updateErrors(null); |
*/ |
||||||
updateTrackers(null); |
public void clear() { |
||||||
} |
updateTorrent(null); |
||||||
|
updateTorrentFiles(null); |
||||||
protected static class TorrentFilesAdapter extends BaseAdapter { |
updateErrors(null); |
||||||
|
updateTrackers(null); |
||||||
private final Context context; |
} |
||||||
private List<TorrentFile> items; |
|
||||||
|
protected static class TorrentFilesAdapter extends BaseAdapter { |
||||||
public TorrentFilesAdapter(Context context, List<TorrentFile> items) { |
|
||||||
this.context = context; |
private final Context context; |
||||||
this.items = items; |
private List<TorrentFile> items; |
||||||
} |
|
||||||
|
public TorrentFilesAdapter(Context context, List<TorrentFile> items) { |
||||||
/** |
this.context = context; |
||||||
* Allows updating of the full data list underlying this adapter, replacing all items |
this.items = items; |
||||||
* @param newItems The new list of files to display |
} |
||||||
*/ |
|
||||||
public void update(List<TorrentFile> newItems) { |
/** |
||||||
this.items = newItems; |
* Allows updating of the full data list underlying this adapter, replacing all items |
||||||
notifyDataSetChanged(); |
* |
||||||
} |
* @param newItems The new list of files to display |
||||||
|
*/ |
||||||
@Override |
public void update(List<TorrentFile> newItems) { |
||||||
public int getCount() { |
this.items = newItems; |
||||||
return items.size(); |
notifyDataSetChanged(); |
||||||
} |
} |
||||||
|
|
||||||
@Override |
@Override |
||||||
public TorrentFile getItem(int position) { |
public int getCount() { |
||||||
return items.get(position); |
return items.size(); |
||||||
} |
} |
||||||
|
|
||||||
@Override |
@Override |
||||||
public long getItemId(int position) { |
public TorrentFile getItem(int position) { |
||||||
return position; |
return items.get(position); |
||||||
} |
} |
||||||
|
|
||||||
@Override |
@Override |
||||||
public View getView(int position, View convertView, ViewGroup parent) { |
public long getItemId(int position) { |
||||||
TorrentFileView torrentFileView; |
return position; |
||||||
if (convertView == null) { |
} |
||||||
torrentFileView = TorrentFileView_.build(context); |
|
||||||
} else { |
@Override |
||||||
torrentFileView = (TorrentFileView) convertView; |
public View getView(int position, View convertView, ViewGroup parent) { |
||||||
} |
TorrentFileView torrentFileView; |
||||||
torrentFileView.bind(getItem(position)); |
if (convertView == null) { |
||||||
return torrentFileView; |
torrentFileView = TorrentFileView_.build(context); |
||||||
} |
} else { |
||||||
|
torrentFileView = (TorrentFileView) convertView; |
||||||
} |
} |
||||||
|
torrentFileView.bind(getItem(position)); |
||||||
|
return torrentFileView; |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
} |
} |
||||||
|
@ -1,114 +1,117 @@ |
|||||||
/* |
/* |
||||||
* Copyright 2010-2018 Eric Kok et al. |
* Copyright 2010-2018 Eric Kok et al. |
||||||
* |
* |
||||||
* Transdroid is free software: you can redistribute it and/or modify |
* Transdroid is free software: you can redistribute it and/or modify |
||||||
* it under the terms of the GNU General Public License as published by |
* it under the terms of the GNU General Public License as published by |
||||||
* the Free Software Foundation, either version 3 of the License, or |
* the Free Software Foundation, either version 3 of the License, or |
||||||
* (at your option) any later version. |
* (at your option) any later version. |
||||||
* |
* |
||||||
* Transdroid is distributed in the hope that it will be useful, |
* Transdroid is distributed in the hope that it will be useful, |
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
* GNU General Public License for more details. |
* GNU General Public License for more details. |
||||||
* |
* |
||||||
* You should have received a copy of the GNU General Public License |
* You should have received a copy of the GNU General Public License |
||||||
* along with Transdroid. If not, see <http://www.gnu.org/licenses/>.
|
* along with Transdroid. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/ |
*/ |
||||||
package org.transdroid.core.gui.lists; |
package org.transdroid.core.gui.lists; |
||||||
|
|
||||||
import java.util.ArrayList; |
|
||||||
import java.util.List; |
|
||||||
|
|
||||||
import android.content.Context; |
import android.content.Context; |
||||||
import android.view.View; |
import android.view.View; |
||||||
import android.view.ViewGroup; |
import android.view.ViewGroup; |
||||||
import android.widget.BaseAdapter; |
import android.widget.BaseAdapter; |
||||||
|
|
||||||
|
import java.util.ArrayList; |
||||||
|
import java.util.List; |
||||||
|
|
||||||
public class SimpleListItemAdapter extends BaseAdapter { |
public class SimpleListItemAdapter extends BaseAdapter { |
||||||
|
|
||||||
private final Context context; |
private final Context context; |
||||||
private List<? extends SimpleListItem> items; |
private List<? extends SimpleListItem> items; |
||||||
private int autoLinkMask = 0; |
private int autoLinkMask = 0; |
||||||
|
|
||||||
public SimpleListItemAdapter(Context context, List<? extends SimpleListItem> items) { |
public SimpleListItemAdapter(Context context, List<? extends SimpleListItem> items) { |
||||||
this.context = context; |
this.context = context; |
||||||
this.items = items; |
this.items = items; |
||||||
} |
} |
||||||
|
|
||||||
/** |
/** |
||||||
* Allows updating of the full data list underlying this adapter, replacing all items |
* Allows updating of the full data list underlying this adapter, replacing all items |
||||||
* @param newItems The new list of simple list items to display |
* |
||||||
*/ |
* @param newItems The new list of simple list items to display |
||||||
public void update(List<? extends SimpleListItem> newItems) { |
*/ |
||||||
this.items = newItems; |
public void update(List<? extends SimpleListItem> newItems) { |
||||||
notifyDataSetChanged(); |
this.items = newItems; |
||||||
} |
notifyDataSetChanged(); |
||||||
|
} |
||||||
public void setAutoLinkMask(int autoLinkMask) { |
|
||||||
this.autoLinkMask = autoLinkMask; |
public void setAutoLinkMask(int autoLinkMask) { |
||||||
} |
this.autoLinkMask = autoLinkMask; |
||||||
|
} |
||||||
@Override |
|
||||||
public int getCount() { |
@Override |
||||||
return items.size(); |
public int getCount() { |
||||||
} |
return items.size(); |
||||||
|
} |
||||||
@Override |
|
||||||
public SimpleListItem getItem(int position) { |
@Override |
||||||
return items.get(position); |
public SimpleListItem getItem(int position) { |
||||||
} |
return items.get(position); |
||||||
|
} |
||||||
@Override |
|
||||||
public long getItemId(int position) { |
@Override |
||||||
return position; |
public long getItemId(int position) { |
||||||
} |
return position; |
||||||
|
} |
||||||
@Override |
|
||||||
public View getView(int position, View convertView, ViewGroup parent) { |
@Override |
||||||
SimpleListItemView filterItemView; |
public View getView(int position, View convertView, ViewGroup parent) { |
||||||
if (convertView == null || !(convertView instanceof SimpleListItemView)) { |
SimpleListItemView filterItemView; |
||||||
filterItemView = SimpleListItemView_.build(context); |
if (!(convertView instanceof SimpleListItemView)) { |
||||||
} else { |
filterItemView = SimpleListItemView_.build(context); |
||||||
filterItemView = (SimpleListItemView) convertView; |
} else { |
||||||
} |
filterItemView = (SimpleListItemView) convertView; |
||||||
filterItemView.bind(getItem(position), autoLinkMask); |
} |
||||||
return filterItemView; |
filterItemView.bind(getItem(position), autoLinkMask); |
||||||
} |
return filterItemView; |
||||||
|
} |
||||||
/** |
|
||||||
* Represents a very simple list item that only contains a single string to show in the list. Use wrapStringsList to |
/** |
||||||
* wrap an existing list of strings into a list of {@link SimpleListItem}s. |
* Represents a very simple list item that only contains a single string to show in the list. Use wrapStringsList to |
||||||
* @author Eric Kok |
* wrap an existing list of strings into a list of {@link SimpleListItem}s. |
||||||
*/ |
* |
||||||
public static class SimpleStringItem implements SimpleListItem { |
* @author Eric Kok |
||||||
|
*/ |
||||||
/** |
public static class SimpleStringItem implements SimpleListItem { |
||||||
* Wraps a simple string of strings into a list of SimpleStringItem to add as data to a |
|
||||||
* {@link SimpleListItemAdapter} |
private final String string; |
||||||
* @param strings A list of string |
|
||||||
* @return A list of SimpleStringItem objects representing the input strings |
public SimpleStringItem(String string) { |
||||||
*/ |
this.string = string; |
||||||
public static List<SimpleStringItem> wrapStringsList(List<String> strings) { |
} |
||||||
ArrayList<SimpleStringItem> errors = new ArrayList<SimpleStringItem>(); |
|
||||||
if (strings != null) { |
/** |
||||||
for (String string : strings) { |
* Wraps a simple string of strings into a list of SimpleStringItem to add as data to a |
||||||
errors.add(new SimpleStringItem(string)); |
* {@link SimpleListItemAdapter} |
||||||
} |
* |
||||||
} |
* @param strings A list of string |
||||||
return errors; |
* @return A list of SimpleStringItem objects representing the input strings |
||||||
} |
*/ |
||||||
|
public static List<SimpleStringItem> wrapStringsList(List<String> strings) { |
||||||
private final String string; |
ArrayList<SimpleStringItem> errors = new ArrayList<>(); |
||||||
|
if (strings != null) { |
||||||
public SimpleStringItem(String string) { |
for (String string : strings) { |
||||||
this.string = string; |
errors.add(new SimpleStringItem(string)); |
||||||
} |
} |
||||||
|
} |
||||||
@Override |
return errors; |
||||||
public String getName() { |
} |
||||||
return this.string; |
|
||||||
} |
@Override |
||||||
|
public String getName() { |
||||||
} |
return this.string; |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
} |
} |
||||||
|
@ -1,66 +1,68 @@ |
|||||||
/* |
/* |
||||||
* Copyright 2010-2018 Eric Kok et al. |
* Copyright 2010-2018 Eric Kok et al. |
||||||
* |
* |
||||||
* Transdroid is free software: you can redistribute it and/or modify |
* Transdroid is free software: you can redistribute it and/or modify |
||||||
* it under the terms of the GNU General Public License as published by |
* it under the terms of the GNU General Public License as published by |
||||||
* the Free Software Foundation, either version 3 of the License, or |
* the Free Software Foundation, either version 3 of the License, or |
||||||
* (at your option) any later version. |
* (at your option) any later version. |
||||||
* |
* |
||||||
* Transdroid is distributed in the hope that it will be useful, |
* Transdroid is distributed in the hope that it will be useful, |
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
* GNU General Public License for more details. |
* GNU General Public License for more details. |
||||||
* |
* |
||||||
* You should have received a copy of the GNU General Public License |
* You should have received a copy of the GNU General Public License |
||||||
* along with Transdroid. If not, see <http://www.gnu.org/licenses/>.
|
* along with Transdroid. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/ |
*/ |
||||||
package org.transdroid.core.gui.lists; |
package org.transdroid.core.gui.lists; |
||||||
|
|
||||||
import java.util.List; |
|
||||||
|
|
||||||
import android.content.Context; |
import android.content.Context; |
||||||
import android.view.View; |
import android.view.View; |
||||||
import android.view.ViewGroup; |
import android.view.ViewGroup; |
||||||
import android.widget.ArrayAdapter; |
import android.widget.ArrayAdapter; |
||||||
import android.widget.TextView; |
import android.widget.TextView; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
/** |
/** |
||||||
* A wrapper around {@link ArrayAdapter} that contains {@link SimpleListItem}s which simply show their name in the |
* A wrapper around {@link ArrayAdapter} that contains {@link SimpleListItem}s which simply show their name in the |
||||||
* Spinner. The standard Android spinner resources are used for the layout. |
* Spinner. The standard Android spinner resources are used for the layout. |
||||||
|
* |
||||||
* @author Eric Kok |
* @author Eric Kok |
||||||
*/ |
*/ |
||||||
public class SimpleListItemSpinnerAdapter<T extends SimpleListItem> extends ArrayAdapter<T> { |
public class SimpleListItemSpinnerAdapter<T extends SimpleListItem> extends ArrayAdapter<T> { |
||||||
|
|
||||||
/** |
/** |
||||||
* Constructs the adapter, supplying the {@link SimpleListItem}s to show in the spinner. The given resource will be |
* Constructs the adapter, supplying the {@link SimpleListItem}s to show in the spinner. The given resource will be |
||||||
* ignored as the standard Android Spinner layout is used instead. |
* ignored as the standard Android Spinner layout is used instead. |
||||||
* @param context The UI context to inflate the layout in |
* |
||||||
* @param resource This is ignored; android.R.layout.simple_spinner_item is always used instead |
* @param context The UI context to inflate the layout in |
||||||
* @param objects The items to show in the spinner, which can simply display some name |
* @param resource This is ignored; android.R.layout.simple_spinner_item is always used instead |
||||||
*/ |
* @param objects The items to show in the spinner, which can simply display some name |
||||||
public SimpleListItemSpinnerAdapter(Context context, int resource, List<T> objects) { |
*/ |
||||||
super(context, android.R.layout.simple_spinner_item, objects); |
public SimpleListItemSpinnerAdapter(Context context, int resource, List<T> objects) { |
||||||
setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); |
super(context, android.R.layout.simple_spinner_item, objects); |
||||||
} |
setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); |
||||||
|
} |
||||||
@Override |
|
||||||
public View getView(int position, View convertView, ViewGroup parent) { |
@Override |
||||||
// This relies on the ArrayAdapter implementation and the used standard xml layouts that simply return a
|
public View getView(int position, View convertView, ViewGroup parent) { |
||||||
// TextView; this can then be filled with the SimpleListItem's name instead of the standard toString()
|
// This relies on the ArrayAdapter implementation and the used standard xml layouts that simply return a
|
||||||
// implementation
|
// TextView; this can then be filled with the SimpleListItem's name instead of the standard toString()
|
||||||
TextView text = (TextView) super.getView(position, convertView, parent); |
// implementation
|
||||||
text.setText(getItem(position).getName()); |
TextView text = (TextView) super.getView(position, convertView, parent); |
||||||
return text; |
text.setText(getItem(position).getName()); |
||||||
} |
return text; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public View getDropDownView(int position, View convertView, ViewGroup parent) { |
||||||
|
// This relies on the ArrayAdapter implementation and the used standard xml layouts that simply return a
|
||||||
|
// TextView; this can then be filled with the SimpleListItem's name instead of the standard toString()
|
||||||
|
// implementation
|
||||||
|
TextView text = (TextView) super.getDropDownView(position, convertView, parent); |
||||||
|
text.setText(getItem(position).getName()); |
||||||
|
return text; |
||||||
|
} |
||||||
|
|
||||||
@Override |
|
||||||
public View getDropDownView(int position, View convertView, ViewGroup parent) { |
|
||||||
// This relies on the ArrayAdapter implementation and the used standard xml layouts that simply return a
|
|
||||||
// TextView; this can then be filled with the SimpleListItem's name instead of the standard toString()
|
|
||||||
// implementation
|
|
||||||
TextView text = (TextView) super.getDropDownView(position, convertView, parent); |
|
||||||
text.setText(getItem(position).getName()); |
|
||||||
return text; |
|
||||||
} |
|
||||||
|
|
||||||
} |
} |
||||||
|
@ -1,78 +1,81 @@ |
|||||||
/* |
/* |
||||||
* Copyright 2010-2018 Eric Kok et al. |
* Copyright 2010-2018 Eric Kok et al. |
||||||
* |
* |
||||||
* Transdroid is free software: you can redistribute it and/or modify |
* Transdroid is free software: you can redistribute it and/or modify |
||||||
* it under the terms of the GNU General Public License as published by |
* it under the terms of the GNU General Public License as published by |
||||||
* the Free Software Foundation, either version 3 of the License, or |
* the Free Software Foundation, either version 3 of the License, or |
||||||
* (at your option) any later version. |
* (at your option) any later version. |
||||||
* |
* |
||||||
* Transdroid is distributed in the hope that it will be useful, |
* Transdroid is distributed in the hope that it will be useful, |
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
* GNU General Public License for more details. |
* GNU General Public License for more details. |
||||||
* |
* |
||||||
* You should have received a copy of the GNU General Public License |
* You should have received a copy of the GNU General Public License |
||||||
* along with Transdroid. If not, see <http://www.gnu.org/licenses/>.
|
* along with Transdroid. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/ |
*/ |
||||||
package org.transdroid.core.gui.lists; |
package org.transdroid.core.gui.lists; |
||||||
|
|
||||||
import android.content.Context; |
import android.content.Context; |
||||||
|
|
||||||
import org.transdroid.R; |
import org.transdroid.R; |
||||||
import org.transdroid.daemon.TorrentsSortBy; |
import org.transdroid.daemon.TorrentsSortBy; |
||||||
|
|
||||||
/** |
/** |
||||||
* Represents a way in which a torrents list can be sorted. |
* Represents a way in which a torrents list can be sorted. |
||||||
|
* |
||||||
* @author Eric Kok |
* @author Eric Kok |
||||||
*/ |
*/ |
||||||
public class SortByListItem implements SimpleListItem { |
public class SortByListItem implements SimpleListItem { |
||||||
|
|
||||||
private final TorrentsSortBy sortBy; |
private final TorrentsSortBy sortBy; |
||||||
private final String name; |
private final String name; |
||||||
|
|
||||||
|
public SortByListItem(Context context, TorrentsSortBy sortBy) { |
||||||
|
this.sortBy = sortBy; |
||||||
|
switch (sortBy) { |
||||||
|
case DateAdded: |
||||||
|
this.name = context.getString(R.string.action_sort_added); |
||||||
|
break; |
||||||
|
case DateDone: |
||||||
|
this.name = context.getString(R.string.action_sort_done); |
||||||
|
break; |
||||||
|
case Ratio: |
||||||
|
this.name = context.getString(R.string.action_sort_ratio); |
||||||
|
break; |
||||||
|
case Status: |
||||||
|
this.name = context.getString(R.string.action_sort_status); |
||||||
|
break; |
||||||
|
case UploadSpeed: |
||||||
|
this.name = context.getString(R.string.action_sort_upspeed); |
||||||
|
break; |
||||||
|
case DownloadSpeed: |
||||||
|
this.name = context.getString(R.string.action_sort_downspeed); |
||||||
|
break; |
||||||
|
case Percent: |
||||||
|
this.name = context.getString(R.string.action_sort_percent); |
||||||
|
break; |
||||||
|
case Size: |
||||||
|
this.name = context.getString(R.string.action_sort_size); |
||||||
|
break; |
||||||
|
default: |
||||||
|
this.name = context.getString(R.string.action_sort_alpha); |
||||||
|
break; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* Returns the contained represented sort order. |
||||||
|
* |
||||||
|
* @return The sort by order as its enumeration value |
||||||
|
*/ |
||||||
|
public TorrentsSortBy getSortBy() { |
||||||
|
return sortBy; |
||||||
|
} |
||||||
|
|
||||||
public SortByListItem(Context context, TorrentsSortBy sortBy) { |
@Override |
||||||
this.sortBy = sortBy; |
public String getName() { |
||||||
switch (sortBy) { |
return name; |
||||||
case DateAdded: |
} |
||||||
this.name = context.getString(R.string.action_sort_added); |
|
||||||
break; |
|
||||||
case DateDone: |
|
||||||
this.name = context.getString(R.string.action_sort_done); |
|
||||||
break; |
|
||||||
case Ratio: |
|
||||||
this.name = context.getString(R.string.action_sort_ratio); |
|
||||||
break; |
|
||||||
case Status: |
|
||||||
this.name = context.getString(R.string.action_sort_status); |
|
||||||
break; |
|
||||||
case UploadSpeed: |
|
||||||
this.name = context.getString(R.string.action_sort_upspeed); |
|
||||||
break; |
|
||||||
case DownloadSpeed: |
|
||||||
this.name = context.getString(R.string.action_sort_downspeed); |
|
||||||
break; |
|
||||||
case Percent: |
|
||||||
this.name = context.getString(R.string.action_sort_percent); |
|
||||||
break; |
|
||||||
case Size: |
|
||||||
this.name = context.getString(R.string.action_sort_size); |
|
||||||
break; |
|
||||||
default: |
|
||||||
this.name = context.getString(R.string.action_sort_alpha); |
|
||||||
break; |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* Returns the contained represented sort order. |
|
||||||
* @return The sort by order as its enumeration value |
|
||||||
*/ |
|
||||||
public TorrentsSortBy getSortBy() { |
|
||||||
return sortBy; |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public String getName() { |
|
||||||
return name; |
|
||||||
} |
|
||||||
|
|
||||||
} |
} |
||||||
|
@ -1,69 +1,71 @@ |
|||||||
/* |
/* |
||||||
* Copyright 2010-2018 Eric Kok et al. |
* Copyright 2010-2018 Eric Kok et al. |
||||||
* |
* |
||||||
* Transdroid is free software: you can redistribute it and/or modify |
* Transdroid is free software: you can redistribute it and/or modify |
||||||
* it under the terms of the GNU General Public License as published by |
* it under the terms of the GNU General Public License as published by |
||||||
* the Free Software Foundation, either version 3 of the License, or |
* the Free Software Foundation, either version 3 of the License, or |
||||||
* (at your option) any later version. |
* (at your option) any later version. |
||||||
* |
* |
||||||
* Transdroid is distributed in the hope that it will be useful, |
* Transdroid is distributed in the hope that it will be useful, |
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
* GNU General Public License for more details. |
* GNU General Public License for more details. |
||||||
* |
* |
||||||
* You should have received a copy of the GNU General Public License |
* You should have received a copy of the GNU General Public License |
||||||
* along with Transdroid. If not, see <http://www.gnu.org/licenses/>.
|
* along with Transdroid. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/ |
*/ |
||||||
package org.transdroid.core.gui.log; |
package org.transdroid.core.gui.log; |
||||||
|
|
||||||
import java.sql.SQLException; |
|
||||||
|
|
||||||
import android.content.Context; |
import android.content.Context; |
||||||
import android.database.sqlite.SQLiteDatabase; |
import android.database.sqlite.SQLiteDatabase; |
||||||
import androidx.annotation.Keep; |
|
||||||
import android.util.Log; |
import android.util.Log; |
||||||
|
|
||||||
|
import androidx.annotation.Keep; |
||||||
|
|
||||||
import com.j256.ormlite.android.apptools.OrmLiteSqliteOpenHelper; |
import com.j256.ormlite.android.apptools.OrmLiteSqliteOpenHelper; |
||||||
import com.j256.ormlite.support.ConnectionSource; |
import com.j256.ormlite.support.ConnectionSource; |
||||||
import com.j256.ormlite.table.TableUtils; |
import com.j256.ormlite.table.TableUtils; |
||||||
|
|
||||||
|
import java.sql.SQLException; |
||||||
|
|
||||||
/** |
/** |
||||||
* Helper to access the database to access persisting objects. |
* Helper to access the database to access persisting objects. |
||||||
|
* |
||||||
* @author Eric Kok |
* @author Eric Kok |
||||||
*/ |
*/ |
||||||
public class DatabaseHelper extends OrmLiteSqliteOpenHelper { |
public class DatabaseHelper extends OrmLiteSqliteOpenHelper { |
||||||
|
|
||||||
private static final String DATABASE_NAME = "transdroid.db"; |
private static final String DATABASE_NAME = "transdroid.db"; |
||||||
private static final int DATABASE_VERSION = 1; |
private static final int DATABASE_VERSION = 1; |
||||||
|
|
||||||
@Keep |
@Keep |
||||||
public DatabaseHelper(Context context) { |
public DatabaseHelper(Context context) { |
||||||
super(context, DATABASE_NAME, null, DATABASE_VERSION); |
super(context, DATABASE_NAME, null, DATABASE_VERSION); |
||||||
} |
} |
||||||
|
|
||||||
@Override |
@Override |
||||||
public void onCreate(SQLiteDatabase sqLiteDatabase, ConnectionSource connectionSource) { |
public void onCreate(SQLiteDatabase sqLiteDatabase, ConnectionSource connectionSource) { |
||||||
try { |
try { |
||||||
TableUtils.createTable(connectionSource, ErrorLogEntry.class); |
TableUtils.createTable(connectionSource, ErrorLogEntry.class); |
||||||
} catch (SQLException e) { |
} catch (SQLException e) { |
||||||
Log.e(org.transdroid.core.gui.log.Log.LOG_NAME, "Could not create new table for ErrorLogEntry", e); |
Log.e(org.transdroid.core.gui.log.Log.LOG_NAME, "Could not create new table for ErrorLogEntry", e); |
||||||
} |
} |
||||||
} |
} |
||||||
|
|
||||||
@Override |
@Override |
||||||
public void onUpgrade(SQLiteDatabase sqLiteDatabase, ConnectionSource connectionSource, int oldVersion, |
public void onUpgrade(SQLiteDatabase sqLiteDatabase, ConnectionSource connectionSource, int oldVersion, |
||||||
int newVersion) { |
int newVersion) { |
||||||
try { |
try { |
||||||
switch (oldVersion) { |
switch (oldVersion) { |
||||||
case 1: |
case 1: |
||||||
TableUtils.createTable(connectionSource, ErrorLogEntry.class); |
TableUtils.createTable(connectionSource, ErrorLogEntry.class); |
||||||
/*case 1: |
/*case 2: |
||||||
etc...*/ |
etc...*/ |
||||||
} |
} |
||||||
|
|
||||||
} catch (SQLException e) { |
} catch (SQLException e) { |
||||||
Log.e(org.transdroid.core.gui.log.Log.LOG_NAME, "Could not upgrade the table for ErrorLogEntry", e); |
Log.e(org.transdroid.core.gui.log.Log.LOG_NAME, "Could not upgrade the table for ErrorLogEntry", e); |
||||||
} |
} |
||||||
} |
} |
||||||
|
|
||||||
} |
} |
||||||
|
@ -1,108 +1,107 @@ |
|||||||
/* |
/* |
||||||
* Copyright 2010-2018 Eric Kok et al. |
* Copyright 2010-2018 Eric Kok et al. |
||||||
* |
* |
||||||
* Transdroid is free software: you can redistribute it and/or modify |
* Transdroid is free software: you can redistribute it and/or modify |
||||||
* it under the terms of the GNU General Public License as published by |
* it under the terms of the GNU General Public License as published by |
||||||
* the Free Software Foundation, either version 3 of the License, or |
* the Free Software Foundation, either version 3 of the License, or |
||||||
* (at your option) any later version. |
* (at your option) any later version. |
||||||
* |
* |
||||||
* Transdroid is distributed in the hope that it will be useful, |
* Transdroid is distributed in the hope that it will be useful, |
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
* GNU General Public License for more details. |
* GNU General Public License for more details. |
||||||
* |
* |
||||||
* You should have received a copy of the GNU General Public License |
* You should have received a copy of the GNU General Public License |
||||||
* along with Transdroid. If not, see <http://www.gnu.org/licenses/>.
|
* along with Transdroid. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/ |
*/ |
||||||
package org.transdroid.core.gui.log; |
package org.transdroid.core.gui.log; |
||||||
|
|
||||||
import java.util.Date; |
|
||||||
|
|
||||||
import android.os.Parcel; |
import android.os.Parcel; |
||||||
import android.os.Parcelable; |
import android.os.Parcelable; |
||||||
|
|
||||||
import com.j256.ormlite.field.DatabaseField; |
import com.j256.ormlite.field.DatabaseField; |
||||||
import com.j256.ormlite.table.DatabaseTable; |
import com.j256.ormlite.table.DatabaseTable; |
||||||
|
|
||||||
|
import java.util.Date; |
||||||
|
|
||||||
/** |
/** |
||||||
* Represents an error log entry to be registered in the database. |
* Represents an error log entry to be registered in the database. |
||||||
|
* |
||||||
* @author Eric Kok |
* @author Eric Kok |
||||||
*/ |
*/ |
||||||
@DatabaseTable(tableName = "ErrorLogEntry") |
@DatabaseTable(tableName = "ErrorLogEntry") |
||||||
public class ErrorLogEntry implements Parcelable { |
public class ErrorLogEntry implements Parcelable { |
||||||
|
|
||||||
public static final String ID = "logId"; |
public static final String ID = "logId"; |
||||||
public static final String DATEANDTIME = "dateAndTime"; |
public static final String DATEANDTIME = "dateAndTime"; |
||||||
|
public static final Parcelable.Creator<ErrorLogEntry> CREATOR = new Parcelable.Creator<ErrorLogEntry>() { |
||||||
@DatabaseField(id = true, columnName = ID) |
public ErrorLogEntry createFromParcel(Parcel in) { |
||||||
private Integer logId; |
return new ErrorLogEntry(in); |
||||||
@DatabaseField(columnName = DATEANDTIME) |
} |
||||||
private Date dateAndTime; |
|
||||||
@DatabaseField |
public ErrorLogEntry[] newArray(int size) { |
||||||
private Integer priority; |
return new ErrorLogEntry[size]; |
||||||
@DatabaseField |
} |
||||||
private String tag; |
}; |
||||||
@DatabaseField |
@DatabaseField(id = true, columnName = ID) |
||||||
private String message; |
private Integer logId; |
||||||
|
@DatabaseField(columnName = DATEANDTIME) |
||||||
public ErrorLogEntry() { |
private Date dateAndTime; |
||||||
} |
@DatabaseField |
||||||
|
private Integer priority; |
||||||
public ErrorLogEntry(Integer priority, String tag, String message) { |
@DatabaseField |
||||||
this.dateAndTime = new Date(); |
private String tag; |
||||||
this.priority = priority; |
@DatabaseField |
||||||
this.tag = tag; |
private String message; |
||||||
this.message = message; |
|
||||||
} |
public ErrorLogEntry() { |
||||||
|
} |
||||||
public Integer getLogId() { |
|
||||||
return logId; |
public ErrorLogEntry(Integer priority, String tag, String message) { |
||||||
} |
this.dateAndTime = new Date(); |
||||||
|
this.priority = priority; |
||||||
public Date getDateAndTime() { |
this.tag = tag; |
||||||
return dateAndTime; |
this.message = message; |
||||||
} |
} |
||||||
|
|
||||||
public Integer getPriority() { |
private ErrorLogEntry(Parcel in) { |
||||||
return priority; |
logId = in.readInt(); |
||||||
} |
dateAndTime = new Date(in.readLong()); |
||||||
|
priority = in.readInt(); |
||||||
public String getTag() { |
tag = in.readString(); |
||||||
return tag; |
message = in.readString(); |
||||||
} |
} |
||||||
|
|
||||||
public String getMessage() { |
public Integer getLogId() { |
||||||
return message; |
return logId; |
||||||
} |
} |
||||||
|
|
||||||
public int describeContents() { |
public Date getDateAndTime() { |
||||||
return 0; |
return dateAndTime; |
||||||
} |
} |
||||||
|
|
||||||
public void writeToParcel(Parcel out, int flags) { |
public Integer getPriority() { |
||||||
out.writeInt(logId); |
return priority; |
||||||
out.writeLong(dateAndTime.getTime()); |
} |
||||||
out.writeInt(priority); |
|
||||||
out.writeString(tag); |
public String getTag() { |
||||||
out.writeString(message); |
return tag; |
||||||
} |
} |
||||||
|
|
||||||
public static final Parcelable.Creator<ErrorLogEntry> CREATOR = new Parcelable.Creator<ErrorLogEntry>() { |
public String getMessage() { |
||||||
public ErrorLogEntry createFromParcel(Parcel in) { |
return message; |
||||||
return new ErrorLogEntry(in); |
} |
||||||
} |
|
||||||
|
public int describeContents() { |
||||||
public ErrorLogEntry[] newArray(int size) { |
return 0; |
||||||
return new ErrorLogEntry[size]; |
} |
||||||
} |
|
||||||
}; |
public void writeToParcel(Parcel out, int flags) { |
||||||
|
out.writeInt(logId); |
||||||
private ErrorLogEntry(Parcel in) { |
out.writeLong(dateAndTime.getTime()); |
||||||
logId = in.readInt(); |
out.writeInt(priority); |
||||||
dateAndTime = new Date(in.readLong()); |
out.writeString(tag); |
||||||
priority = in.readInt(); |
out.writeString(message); |
||||||
tag = in.readString(); |
} |
||||||
message = in.readString(); |
|
||||||
} |
|
||||||
|
|
||||||
} |
} |
||||||
|
@ -1,117 +1,124 @@ |
|||||||
/* |
/* |
||||||
* Copyright 2010-2018 Eric Kok et al. |
* Copyright 2010-2018 Eric Kok et al. |
||||||
* |
* |
||||||
* Transdroid is free software: you can redistribute it and/or modify |
* Transdroid is free software: you can redistribute it and/or modify |
||||||
* it under the terms of the GNU General Public License as published by |
* it under the terms of the GNU General Public License as published by |
||||||
* the Free Software Foundation, either version 3 of the License, or |
* the Free Software Foundation, either version 3 of the License, or |
||||||
* (at your option) any later version. |
* (at your option) any later version. |
||||||
* |
* |
||||||
* Transdroid is distributed in the hope that it will be useful, |
* Transdroid is distributed in the hope that it will be useful, |
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
* GNU General Public License for more details. |
* GNU General Public License for more details. |
||||||
* |
* |
||||||
* You should have received a copy of the GNU General Public License |
* You should have received a copy of the GNU General Public License |
||||||
* along with Transdroid. If not, see <http://www.gnu.org/licenses/>.
|
* along with Transdroid. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/ |
*/ |
||||||
package org.transdroid.core.gui.navigation; |
package org.transdroid.core.gui.navigation; |
||||||
|
|
||||||
import org.transdroid.R; |
|
||||||
|
|
||||||
import android.content.Context; |
import android.content.Context; |
||||||
import android.view.View; |
import android.view.View; |
||||||
import android.view.ViewGroup; |
import android.view.ViewGroup; |
||||||
import android.widget.ArrayAdapter; |
import android.widget.ArrayAdapter; |
||||||
import android.widget.Spinner; |
|
||||||
import android.widget.TextView; |
import android.widget.TextView; |
||||||
|
|
||||||
|
import androidx.appcompat.widget.AppCompatSpinner; |
||||||
|
|
||||||
|
import org.transdroid.R; |
||||||
|
|
||||||
/** |
/** |
||||||
* Spinner that holds actions that can be performed on list selections. The spinner itself has some title, which can for |
* Spinner that holds actions that can be performed on list selections. The spinner itself has some title, which can for |
||||||
* example be used to show the number of selected items. |
* example be used to show the number of selected items. |
||||||
|
* |
||||||
* @author Eric Kok |
* @author Eric Kok |
||||||
*/ |
*/ |
||||||
public class SelectionModificationSpinner extends Spinner { |
public class SelectionModificationSpinner extends AppCompatSpinner { |
||||||
|
|
||||||
private SelectionDropDownAdapter selectionAdapter; |
private SelectionDropDownAdapter selectionAdapter; |
||||||
private OnModificationActionSelectedListener onModificationActionSelected = null; |
private OnModificationActionSelectedListener onModificationActionSelected = null; |
||||||
|
|
||||||
/** |
/** |
||||||
* Instantiates a spinner that contains some fixed actions for a user to modify selections. |
* Instantiates a spinner that contains some fixed actions for a user to modify selections. |
||||||
* @param context The interface context where the spinner will be shown in |
* |
||||||
*/ |
* @param context The interface context where the spinner will be shown in |
||||||
public SelectionModificationSpinner(Context context) { |
*/ |
||||||
super(context); |
public SelectionModificationSpinner(Context context) { |
||||||
selectionAdapter = new SelectionDropDownAdapter(context); |
super(context); |
||||||
setAdapter(selectionAdapter); |
selectionAdapter = new SelectionDropDownAdapter(context); |
||||||
} |
setAdapter(selectionAdapter); |
||||||
|
} |
||||||
/** |
|
||||||
* Updates the fixed title text shown in the spinner, regardless of spinner item action selection. |
/** |
||||||
* @param title The new static string to show, such as the number of selected items |
* Updates the fixed title text shown in the spinner, regardless of spinner item action selection. |
||||||
*/ |
* |
||||||
public void updateTitle(String title) { |
* @param title The new static string to show, such as the number of selected items |
||||||
selectionAdapter.titleView.setText(title); |
*/ |
||||||
invalidate(); |
public void updateTitle(String title) { |
||||||
} |
selectionAdapter.titleView.setText(title); |
||||||
|
invalidate(); |
||||||
/** |
} |
||||||
* Sets the listener for action selection events. |
|
||||||
* @param onModificationActionSelected The listener that handles performing of the actions as selected in this |
/** |
||||||
* spinner by the user |
* Sets the listener for action selection events. |
||||||
*/ |
* |
||||||
public void setOnModificationActionSelectedListener(OnModificationActionSelectedListener onModificationActionSelected) { |
* @param onModificationActionSelected The listener that handles performing of the actions as selected in this |
||||||
this.onModificationActionSelected = onModificationActionSelected; |
* spinner by the user |
||||||
} |
*/ |
||||||
|
public void setOnModificationActionSelectedListener(OnModificationActionSelectedListener onModificationActionSelected) { |
||||||
@Override |
this.onModificationActionSelected = onModificationActionSelected; |
||||||
public void setSelection(int position) { |
} |
||||||
if (position == 0) { |
|
||||||
onModificationActionSelected.selectAll(); |
@Override |
||||||
} else if (position == 1) { |
public void setSelection(int position) { |
||||||
onModificationActionSelected.selectFinished(); |
if (position == 0) { |
||||||
} else if (position == 2) { |
onModificationActionSelected.selectAll(); |
||||||
onModificationActionSelected.invertSelection(); |
} else if (position == 1) { |
||||||
} |
onModificationActionSelected.selectFinished(); |
||||||
super.setSelection(position); |
} else if (position == 2) { |
||||||
} |
onModificationActionSelected.invertSelection(); |
||||||
|
} |
||||||
/** |
super.setSelection(position); |
||||||
* Local adapter that holds the actions which can be performed and a title text view that always shows instead of a |
} |
||||||
* list item as in a normal spinner. |
|
||||||
*/ |
/** |
||||||
private class SelectionDropDownAdapter extends ArrayAdapter<String> { |
* Interface to implement if an interface want to respond to selection modification actions. |
||||||
|
*/ |
||||||
protected TextView titleView = null; |
public interface OnModificationActionSelectedListener { |
||||||
|
void selectAll(); |
||||||
public SelectionDropDownAdapter(Context context) { |
|
||||||
super(context, android.R.layout.simple_list_item_1, new String[] { |
void selectFinished(); |
||||||
context.getString(R.string.navigation_selectall), |
|
||||||
context.getString(R.string.navigation_selectfinished), |
void invertSelection(); |
||||||
context.getString(R.string.navigation_invertselection) }); |
} |
||||||
titleView = new TextView(getContext()); |
|
||||||
} |
/** |
||||||
|
* Local adapter that holds the actions which can be performed and a title text view that always shows instead of a |
||||||
@Override |
* list item as in a normal spinner. |
||||||
public View getView(int position, View convertView, ViewGroup parent) { |
*/ |
||||||
// This returns the singleton text view showing the title with the number of selected items
|
private static class SelectionDropDownAdapter extends ArrayAdapter<String> { |
||||||
return titleView; |
|
||||||
} |
protected TextView titleView = null; |
||||||
|
|
||||||
@Override |
public SelectionDropDownAdapter(Context context) { |
||||||
public View getDropDownView(int position, View convertView, ViewGroup parent) { |
super(context, android.R.layout.simple_list_item_1, new String[]{ |
||||||
// This returns the actions to show in the spinner list
|
context.getString(R.string.navigation_selectall), |
||||||
return super.getView(position, convertView, parent); |
context.getString(R.string.navigation_selectfinished), |
||||||
} |
context.getString(R.string.navigation_invertselection)}); |
||||||
|
titleView = new TextView(getContext()); |
||||||
} |
} |
||||||
|
|
||||||
/** |
@Override |
||||||
* Interface to implement if an interface want to respond to selection modification actions. |
public View getView(int position, View convertView, ViewGroup parent) { |
||||||
*/ |
// This returns the singleton text view showing the title with the number of selected items
|
||||||
public interface OnModificationActionSelectedListener { |
return titleView; |
||||||
public void selectAll(); |
} |
||||||
public void selectFinished(); |
|
||||||
public void invertSelection(); |
@Override |
||||||
} |
public View getDropDownView(int position, View convertView, ViewGroup parent) { |
||||||
|
// This returns the actions to show in the spinner list
|
||||||
|
return super.getView(position, convertView, parent); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
} |
} |
||||||
|
@ -1,165 +1,169 @@ |
|||||||
/* |
/* |
||||||
* Copyright 2010-2018 Eric Kok et al. |
* Copyright 2010-2018 Eric Kok et al. |
||||||
* |
* |
||||||
* Transdroid is free software: you can redistribute it and/or modify |
* Transdroid is free software: you can redistribute it and/or modify |
||||||
* it under the terms of the GNU General Public License as published by |
* it under the terms of the GNU General Public License as published by |
||||||
* the Free Software Foundation, either version 3 of the License, or |
* the Free Software Foundation, either version 3 of the License, or |
||||||
* (at your option) any later version. |
* (at your option) any later version. |
||||||
* |
* |
||||||
* Transdroid is distributed in the hope that it will be useful, |
* Transdroid is distributed in the hope that it will be useful, |
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
* GNU General Public License for more details. |
* GNU General Public License for more details. |
||||||
* |
* |
||||||
* You should have received a copy of the GNU General Public License |
* You should have received a copy of the GNU General Public License |
||||||
* along with Transdroid. If not, see <http://www.gnu.org/licenses/>.
|
* along with Transdroid. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/ |
*/ |
||||||
package org.transdroid.core.gui.navigation; |
package org.transdroid.core.gui.navigation; |
||||||
|
|
||||||
import java.util.Arrays; |
import android.content.Context; |
||||||
import java.util.List; |
import android.os.Parcel; |
||||||
|
import android.os.Parcelable; |
||||||
|
|
||||||
import org.transdroid.R; |
import org.transdroid.R; |
||||||
import org.transdroid.core.gui.lists.SimpleListItem; |
import org.transdroid.core.gui.lists.SimpleListItem; |
||||||
import org.transdroid.daemon.Torrent; |
import org.transdroid.daemon.Torrent; |
||||||
|
|
||||||
import android.content.Context; |
import java.util.Arrays; |
||||||
import android.os.Parcel; |
import java.util.List; |
||||||
import android.os.Parcelable; |
|
||||||
|
|
||||||
/** |
/** |
||||||
* Enumeration of all status types, which filter the list of shown torrents based on transfer activity. |
* Enumeration of all status types, which filter the list of shown torrents based on transfer activity. |
||||||
|
* |
||||||
* @author Eric Kok |
* @author Eric Kok |
||||||
*/ |
*/ |
||||||
public enum StatusType { |
public enum StatusType { |
||||||
|
|
||||||
ShowAll { |
ShowAll { |
||||||
public StatusTypeFilter getFilterItem(Context context) { |
public StatusTypeFilter getFilterItem(Context context) { |
||||||
return new StatusTypeFilter(StatusType.ShowAll, context.getString(R.string.navigation_status_showall)); |
return new StatusTypeFilter(StatusType.ShowAll, context.getString(R.string.navigation_status_showall)); |
||||||
} |
} |
||||||
}, |
}, |
||||||
OnlyDownloading { |
OnlyDownloading { |
||||||
public StatusTypeFilter getFilterItem(Context context) { |
public StatusTypeFilter getFilterItem(Context context) { |
||||||
return new StatusTypeFilter(StatusType.OnlyDownloading, context.getString(R.string.navigation_status_onlydown)); |
return new StatusTypeFilter(StatusType.OnlyDownloading, context.getString(R.string.navigation_status_onlydown)); |
||||||
} |
} |
||||||
}, |
}, |
||||||
OnlyUploading { |
OnlyUploading { |
||||||
public StatusTypeFilter getFilterItem(Context context) { |
public StatusTypeFilter getFilterItem(Context context) { |
||||||
return new StatusTypeFilter(StatusType.OnlyUploading, context.getString(R.string.navigation_status_onlyup)); |
return new StatusTypeFilter(StatusType.OnlyUploading, context.getString(R.string.navigation_status_onlyup)); |
||||||
} |
} |
||||||
}, |
}, |
||||||
OnlyActive { |
OnlyActive { |
||||||
public StatusTypeFilter getFilterItem(Context context) { |
public StatusTypeFilter getFilterItem(Context context) { |
||||||
return new StatusTypeFilter(StatusType.OnlyActive, context.getString(R.string.navigation_status_onlyactive)); |
return new StatusTypeFilter(StatusType.OnlyActive, context.getString(R.string.navigation_status_onlyactive)); |
||||||
} |
} |
||||||
}, |
}, |
||||||
OnlyInactive { |
OnlyInactive { |
||||||
public StatusTypeFilter getFilterItem(Context context) { |
public StatusTypeFilter getFilterItem(Context context) { |
||||||
return new StatusTypeFilter(StatusType.OnlyInactive, context.getString(R.string.navigation_status_onlyinactive)); |
return new StatusTypeFilter(StatusType.OnlyInactive, context.getString(R.string.navigation_status_onlyinactive)); |
||||||
} |
} |
||||||
}; |
}; |
||||||
|
|
||||||
/** |
/** |
||||||
* Returns the status type to show all torrents, represented as filter item to show in the navigation list. |
* Returns the status type to show all torrents, represented as filter item to show in the navigation list. |
||||||
* @param context The Android UI context, to access translations |
* |
||||||
* @return The show ShowAll status type filter item |
* @param context The Android UI context, to access translations |
||||||
*/ |
* @return The show ShowAll status type filter item |
||||||
public static StatusTypeFilter getShowAllType(Context context) { |
*/ |
||||||
return ShowAll.getFilterItem(context); |
public static StatusTypeFilter getShowAllType(Context context) { |
||||||
} |
return ShowAll.getFilterItem(context); |
||||||
|
} |
||||||
/** |
|
||||||
* Returns a list with all status types, represented as filter item that can be shown in the GUI. |
/** |
||||||
* @param context The Android UI context, to access translations |
* Returns a list with all status types, represented as filter item that can be shown in the GUI. |
||||||
* @return A list of filter items for all available status types |
* |
||||||
*/ |
* @param context The Android UI context, to access translations |
||||||
public static List<StatusTypeFilter> getAllStatusTypes(Context context) { |
* @return A list of filter items for all available status types |
||||||
return Arrays.asList(ShowAll.getFilterItem(context), OnlyDownloading.getFilterItem(context), |
*/ |
||||||
OnlyUploading.getFilterItem(context), OnlyActive.getFilterItem(context), |
public static List<StatusTypeFilter> getAllStatusTypes(Context context) { |
||||||
OnlyInactive.getFilterItem(context)); |
return Arrays.asList(ShowAll.getFilterItem(context), OnlyDownloading.getFilterItem(context), |
||||||
} |
OnlyUploading.getFilterItem(context), OnlyActive.getFilterItem(context), |
||||||
|
OnlyInactive.getFilterItem(context)); |
||||||
/** |
} |
||||||
* Every status type can return a filter item that represents it in the navigation |
|
||||||
* @param context The Android UI context, to access translations |
/** |
||||||
* @return A filter item object to show in the GUI |
* Every status type can return a filter item that represents it in the navigation |
||||||
*/ |
* |
||||||
public abstract StatusTypeFilter getFilterItem(Context context); |
* @param context The Android UI context, to access translations |
||||||
|
* @return A filter item object to show in the GUI |
||||||
public static class StatusTypeFilter implements SimpleListItem, NavigationFilter { |
*/ |
||||||
|
public abstract StatusTypeFilter getFilterItem(Context context); |
||||||
private final StatusType statusType; |
|
||||||
private final String name; |
public static class StatusTypeFilter implements SimpleListItem, NavigationFilter { |
||||||
|
|
||||||
StatusTypeFilter(StatusType statusType, String name) { |
public static final Parcelable.Creator<StatusTypeFilter> CREATOR = new Parcelable.Creator<StatusTypeFilter>() { |
||||||
this.statusType = statusType; |
public StatusTypeFilter createFromParcel(Parcel in) { |
||||||
this.name = name; |
return new StatusTypeFilter(in); |
||||||
} |
} |
||||||
|
|
||||||
public StatusType getStatusType() { |
public StatusTypeFilter[] newArray(int size) { |
||||||
return statusType; |
return new StatusTypeFilter[size]; |
||||||
} |
} |
||||||
|
}; |
||||||
@Override |
private final StatusType statusType; |
||||||
public String getName() { |
private final String name; |
||||||
return name; |
|
||||||
} |
StatusTypeFilter(StatusType statusType, String name) { |
||||||
|
this.statusType = statusType; |
||||||
@Override |
this.name = name; |
||||||
public String getCode() { |
} |
||||||
// Uses the class name and status type enum to provide a unique navigation filter code
|
|
||||||
return StatusTypeFilter.class.getSimpleName() + "_" + statusType.name(); |
private StatusTypeFilter(Parcel in) { |
||||||
} |
this.statusType = StatusType.valueOf(in.readString()); |
||||||
|
this.name = in.readString(); |
||||||
/** |
} |
||||||
* Returns true if the torrent status matches this (selected) status type, false otherwise |
|
||||||
* @param torrent The torrent to match against this status type |
public StatusType getStatusType() { |
||||||
* @param dormantAsInactive If true, dormant (0KB/s, so no data transfer) torrents are never actively |
return statusType; |
||||||
* downloading or seeding |
} |
||||||
*/ |
|
||||||
@Override |
@Override |
||||||
public boolean matches(Torrent torrent, boolean dormantAsInactive) { |
public String getName() { |
||||||
switch (statusType) { |
return name; |
||||||
case OnlyDownloading: |
} |
||||||
return torrent.isDownloading(dormantAsInactive); |
|
||||||
case OnlyUploading: |
@Override |
||||||
return torrent.isSeeding(dormantAsInactive); |
public String getCode() { |
||||||
case OnlyActive: |
// Uses the class name and status type enum to provide a unique navigation filter code
|
||||||
return torrent.isDownloading(dormantAsInactive) |
return StatusTypeFilter.class.getSimpleName() + "_" + statusType.name(); |
||||||
|| torrent.isSeeding(dormantAsInactive); |
} |
||||||
case OnlyInactive: |
|
||||||
return !torrent.isDownloading(dormantAsInactive) && !torrent.isSeeding(dormantAsInactive); |
/** |
||||||
default: |
* Returns true if the torrent status matches this (selected) status type, false otherwise |
||||||
return true; |
* |
||||||
} |
* @param torrent The torrent to match against this status type |
||||||
} |
* @param dormantAsInactive If true, dormant (0KB/s, so no data transfer) torrents are never actively |
||||||
|
* downloading or seeding |
||||||
private StatusTypeFilter(Parcel in) { |
*/ |
||||||
this.statusType = StatusType.valueOf(in.readString()); |
@Override |
||||||
this.name = in.readString(); |
public boolean matches(Torrent torrent, boolean dormantAsInactive) { |
||||||
} |
switch (statusType) { |
||||||
|
case OnlyDownloading: |
||||||
public static final Parcelable.Creator<StatusTypeFilter> CREATOR = new Parcelable.Creator<StatusTypeFilter>() { |
return torrent.isDownloading(dormantAsInactive); |
||||||
public StatusTypeFilter createFromParcel(Parcel in) { |
case OnlyUploading: |
||||||
return new StatusTypeFilter(in); |
return torrent.isSeeding(dormantAsInactive); |
||||||
} |
case OnlyActive: |
||||||
|
return torrent.isDownloading(dormantAsInactive) |
||||||
public StatusTypeFilter[] newArray(int size) { |
|| torrent.isSeeding(dormantAsInactive); |
||||||
return new StatusTypeFilter[size]; |
case OnlyInactive: |
||||||
} |
return !torrent.isDownloading(dormantAsInactive) && !torrent.isSeeding(dormantAsInactive); |
||||||
}; |
default: |
||||||
|
return true; |
||||||
@Override |
} |
||||||
public int describeContents() { |
} |
||||||
return 0; |
|
||||||
} |
@Override |
||||||
|
public int describeContents() { |
||||||
@Override |
return 0; |
||||||
public void writeToParcel(Parcel dest, int flags) { |
} |
||||||
dest.writeString(statusType.name()); |
|
||||||
dest.writeString(name); |
@Override |
||||||
} |
public void writeToParcel(Parcel dest, int flags) { |
||||||
|
dest.writeString(statusType.name()); |
||||||
} |
dest.writeString(name); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
} |
} |
||||||
|
@ -1,69 +1,65 @@ |
|||||||
/* |
/* |
||||||
* Copyright 2010-2018 Eric Kok et al. |
* Copyright 2010-2018 Eric Kok et al. |
||||||
* |
* |
||||||
* Transdroid is free software: you can redistribute it and/or modify |
* Transdroid is free software: you can redistribute it and/or modify |
||||||
* it under the terms of the GNU General Public License as published by |
* it under the terms of the GNU General Public License as published by |
||||||
* the Free Software Foundation, either version 3 of the License, or |
* the Free Software Foundation, either version 3 of the License, or |
||||||
* (at your option) any later version. |
* (at your option) any later version. |
||||||
* |
* |
||||||
* Transdroid is distributed in the hope that it will be useful, |
* Transdroid is distributed in the hope that it will be useful, |
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
* GNU General Public License for more details. |
* GNU General Public License for more details. |
||||||
* |
* |
||||||
* You should have received a copy of the GNU General Public License |
* You should have received a copy of the GNU General Public License |
||||||
* along with Transdroid. If not, see <http://www.gnu.org/licenses/>.
|
* along with Transdroid. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/ |
*/ |
||||||
package org.transdroid.core.gui.search; |
package org.transdroid.core.gui.search; |
||||||
|
|
||||||
import org.transdroid.R; |
|
||||||
|
|
||||||
import android.annotation.SuppressLint; |
import android.annotation.SuppressLint; |
||||||
import android.app.Activity; |
import android.app.Activity; |
||||||
import android.app.AlertDialog; |
import android.app.AlertDialog; |
||||||
import android.content.Context; |
import android.content.Context; |
||||||
import android.content.DialogInterface; |
|
||||||
import android.content.DialogInterface.OnClickListener; |
|
||||||
import android.content.Intent; |
import android.content.Intent; |
||||||
import android.net.Uri; |
import android.net.Uri; |
||||||
|
|
||||||
|
import org.transdroid.R; |
||||||
|
|
||||||
import java.lang.ref.WeakReference; |
import java.lang.ref.WeakReference; |
||||||
|
|
||||||
public class FilePickerHelper { |
public class FilePickerHelper { |
||||||
|
|
||||||
public static final int ACTIVITY_FILEPICKER = 0x0000c0df; // A 'random' ID to identify file picker intents
|
public static final int ACTIVITY_FILEPICKER = 0x0000c0df; // A 'random' ID to identify file picker intents
|
||||||
public static final Uri FILEMANAGER_MARKET_URI = Uri.parse("market://search?q=pname:org.openintents.filemanager"); |
public static final Uri FILEMANAGER_MARKET_URI = Uri.parse("market://search?q=pname:org.openintents.filemanager"); |
||||||
|
|
||||||
/** |
/** |
||||||
* Call this to start a file picker intent. The calling activity will receive an Intent result with ID |
* Call this to start a file picker intent. The calling activity will receive an Intent result with ID |
||||||
* {@link #ACTIVITY_FILEPICKER} with an Intent that contains the selected local file as data Intent. |
* {@link #ACTIVITY_FILEPICKER} with an Intent that contains the selected local file as data Intent. |
||||||
* @param activity The calling activity, to which the result is returned or a dialog is bound that asks to install |
* |
||||||
* the file picker |
* @param activity The calling activity, to which the result is returned or a dialog is bound that asks to install |
||||||
*/ |
* the file picker |
||||||
@SuppressLint("ValidFragment") |
*/ |
||||||
public static void startFilePicker(final Activity activity) { |
@SuppressLint("ValidFragment") |
||||||
try { |
public static void startFilePicker(final Activity activity) { |
||||||
// Start a file manager that can handle the file/* file/* intents
|
try { |
||||||
activity.startActivityForResult(new Intent(Intent.ACTION_GET_CONTENT).setType("application/x-bittorrent"), |
// Start a file manager that can handle the file/* file/* intents
|
||||||
ACTIVITY_FILEPICKER); |
activity.startActivityForResult(new Intent(Intent.ACTION_GET_CONTENT).setType("application/x-bittorrent"), |
||||||
} catch (Exception e1) { |
ACTIVITY_FILEPICKER); |
||||||
try { |
} catch (Exception e1) { |
||||||
// Start a file manager that can handle the PICK_FILE intent (specifically IO File Manager)
|
try { |
||||||
activity.startActivityForResult(new Intent("org.openintents.action.PICK_FILE"), ACTIVITY_FILEPICKER); |
// Start a file manager that can handle the PICK_FILE intent (specifically IO File Manager)
|
||||||
} catch (Exception e2) { |
activity.startActivityForResult(new Intent("org.openintents.action.PICK_FILE"), ACTIVITY_FILEPICKER); |
||||||
// Can't start the file manager, for example with a SecurityException or when IO File Manager is not present
|
} catch (Exception e2) { |
||||||
final WeakReference<Context> intentStartContext = new WeakReference<Context>(activity); |
// Can't start the file manager, for example with a SecurityException or when IO File Manager is not present
|
||||||
new AlertDialog.Builder(activity).setIcon(android.R.drawable.ic_dialog_alert) |
final WeakReference<Context> intentStartContext = new WeakReference<>(activity); |
||||||
.setMessage(activity.getString(R.string.search_filemanagernotfound)) |
new AlertDialog.Builder(activity).setIcon(android.R.drawable.ic_dialog_alert) |
||||||
.setPositiveButton(android.R.string.yes, new OnClickListener() { |
.setMessage(activity.getString(R.string.search_filemanagernotfound)) |
||||||
@Override |
.setPositiveButton(android.R.string.yes, (dialog, which) -> { |
||||||
public void onClick(DialogInterface dialog, int which) { |
if (intentStartContext.get() != null) |
||||||
if (intentStartContext.get() != null) |
intentStartContext.get().startActivity(new Intent(Intent.ACTION_VIEW, FILEMANAGER_MARKET_URI)); |
||||||
intentStartContext.get().startActivity(new Intent(Intent.ACTION_VIEW, FILEMANAGER_MARKET_URI)); |
}).setNegativeButton(android.R.string.no, null).show(); |
||||||
} |
} |
||||||
}).setNegativeButton(android.R.string.no, null).show(); |
} |
||||||
} |
} |
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
} |
} |
||||||
|
@ -1,56 +1,57 @@ |
|||||||
/* |
/* |
||||||
* Copyright 2010-2018 Eric Kok et al. |
* Copyright 2010-2018 Eric Kok et al. |
||||||
* |
* |
||||||
* Transdroid is free software: you can redistribute it and/or modify |
* Transdroid is free software: you can redistribute it and/or modify |
||||||
* it under the terms of the GNU General Public License as published by |
* it under the terms of the GNU General Public License as published by |
||||||
* the Free Software Foundation, either version 3 of the License, or |
* the Free Software Foundation, either version 3 of the License, or |
||||||
* (at your option) any later version. |
* (at your option) any later version. |
||||||
* |
* |
||||||
* Transdroid is distributed in the hope that it will be useful, |
* Transdroid is distributed in the hope that it will be useful, |
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
* GNU General Public License for more details. |
* GNU General Public License for more details. |
||||||
* |
* |
||||||
* You should have received a copy of the GNU General Public License |
* You should have received a copy of the GNU General Public License |
||||||
* along with Transdroid. If not, see <http://www.gnu.org/licenses/>.
|
* along with Transdroid. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/ |
*/ |
||||||
package org.transdroid.core.gui.search; |
package org.transdroid.core.gui.search; |
||||||
|
|
||||||
import org.androidannotations.annotations.EViewGroup; |
|
||||||
import org.androidannotations.annotations.ViewById; |
|
||||||
import org.transdroid.R; |
|
||||||
import org.transdroid.core.app.search.SearchResult; |
|
||||||
|
|
||||||
import android.content.Context; |
import android.content.Context; |
||||||
import android.text.format.DateUtils; |
import android.text.format.DateUtils; |
||||||
import android.widget.RelativeLayout; |
import android.widget.RelativeLayout; |
||||||
import android.widget.TextView; |
import android.widget.TextView; |
||||||
|
|
||||||
|
import org.androidannotations.annotations.EViewGroup; |
||||||
|
import org.androidannotations.annotations.ViewById; |
||||||
|
import org.transdroid.R; |
||||||
|
import org.transdroid.core.app.search.SearchResult; |
||||||
|
|
||||||
/** |
/** |
||||||
* View that represents a {@link SearchResult} object from an in-app search |
* View that represents a {@link SearchResult} object from an in-app search |
||||||
|
* |
||||||
* @author Eric Kok |
* @author Eric Kok |
||||||
*/ |
*/ |
||||||
@EViewGroup(resName = "list_item_searchresult") |
@EViewGroup(resName = "list_item_searchresult") |
||||||
public class SearchResultView extends RelativeLayout { |
public class SearchResultView extends RelativeLayout { |
||||||
|
|
||||||
// Views
|
// Views
|
||||||
@ViewById |
@ViewById |
||||||
protected TextView nameText, seedersText, leechersText, sizeText, dateText; |
protected TextView nameText, seedersText, leechersText, sizeText, dateText; |
||||||
|
|
||||||
public SearchResultView(Context context) { |
public SearchResultView(Context context) { |
||||||
super(context); |
super(context); |
||||||
} |
} |
||||||
|
|
||||||
public void bind(SearchResult result) { |
public void bind(SearchResult result) { |
||||||
|
|
||||||
nameText.setText(result.getName()); |
nameText.setText(result.getName()); |
||||||
sizeText.setText(result.getSize()); |
sizeText.setText(result.getSize()); |
||||||
dateText.setText(result.getAddedOn() == null ? "" : DateUtils.getRelativeDateTimeString(getContext(), result |
dateText.setText(result.getAddedOn() == null ? "" : DateUtils.getRelativeDateTimeString(getContext(), result |
||||||
.getAddedOn().getTime(), DateUtils.SECOND_IN_MILLIS, DateUtils.WEEK_IN_MILLIS, |
.getAddedOn().getTime(), DateUtils.SECOND_IN_MILLIS, DateUtils.WEEK_IN_MILLIS, |
||||||
DateUtils.FORMAT_ABBREV_MONTH)); |
DateUtils.FORMAT_ABBREV_MONTH)); |
||||||
seedersText.setText(getContext().getString(R.string.search_seeders, result.getSeeders())); |
seedersText.setText(getContext().getString(R.string.search_seeders, result.getSeeders())); |
||||||
leechersText.setText(getContext().getString(R.string.search_leechers, result.getLeechers())); |
leechersText.setText(getContext().getString(R.string.search_leechers, result.getLeechers())); |
||||||
|
|
||||||
} |
} |
||||||
|
|
||||||
} |
} |
||||||
|
@ -1,53 +1,54 @@ |
|||||||
/* |
/* |
||||||
* Copyright 2010-2018 Eric Kok et al. |
* Copyright 2010-2018 Eric Kok et al. |
||||||
* |
* |
||||||
* Transdroid is free software: you can redistribute it and/or modify |
* Transdroid is free software: you can redistribute it and/or modify |
||||||
* it under the terms of the GNU General Public License as published by |
* it under the terms of the GNU General Public License as published by |
||||||
* the Free Software Foundation, either version 3 of the License, or |
* the Free Software Foundation, either version 3 of the License, or |
||||||
* (at your option) any later version. |
* (at your option) any later version. |
||||||
* |
* |
||||||
* Transdroid is distributed in the hope that it will be useful, |
* Transdroid is distributed in the hope that it will be useful, |
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
* GNU General Public License for more details. |
* GNU General Public License for more details. |
||||||
* |
* |
||||||
* You should have received a copy of the GNU General Public License |
* You should have received a copy of the GNU General Public License |
||||||
* along with Transdroid. If not, see <http://www.gnu.org/licenses/>.
|
* along with Transdroid. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/ |
*/ |
||||||
package org.transdroid.core.gui.settings; |
package org.transdroid.core.gui.settings; |
||||||
|
|
||||||
import org.transdroid.R; |
|
||||||
import org.transdroid.core.gui.navigation.DialogHelper; |
|
||||||
|
|
||||||
import android.app.Activity; |
import android.app.Activity; |
||||||
import android.content.Intent; |
import android.content.Intent; |
||||||
import android.net.Uri; |
import android.net.Uri; |
||||||
|
|
||||||
|
import org.transdroid.R; |
||||||
|
import org.transdroid.core.gui.navigation.DialogHelper; |
||||||
|
|
||||||
/** |
/** |
||||||
* Fragment that shows info about the application developer and used open source libraries. |
* Fragment that shows info about the application developer and used open source libraries. |
||||||
|
* |
||||||
* @author Eric Kok |
* @author Eric Kok |
||||||
*/ |
*/ |
||||||
public class AboutDialog implements DialogHelper.DialogSpecification { |
public class AboutDialog implements DialogHelper.DialogSpecification { |
||||||
|
|
||||||
private static final long serialVersionUID = -4711432869714292985L; |
private static final long serialVersionUID = -4711432869714292985L; |
||||||
|
|
||||||
@Override |
@Override |
||||||
public int getDialogLayoutId() { |
public int getDialogLayoutId() { |
||||||
return R.layout.dialog_about; |
return R.layout.dialog_about; |
||||||
} |
} |
||||||
|
|
||||||
@Override |
@Override |
||||||
public int getDialogMenuId() { |
public int getDialogMenuId() { |
||||||
return R.menu.dialog_about; |
return R.menu.dialog_about; |
||||||
} |
} |
||||||
|
|
||||||
@Override |
@Override |
||||||
public boolean onMenuItemSelected(Activity ownerActivity, int selectedItemId) { |
public boolean onMenuItemSelected(Activity ownerActivity, int selectedItemId) { |
||||||
if (selectedItemId == R.id.action_visitwebsite) { |
if (selectedItemId == R.id.action_visitwebsite) { |
||||||
ownerActivity.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://transdroid.org"))); |
ownerActivity.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://transdroid.org"))); |
||||||
return true; |
return true; |
||||||
} |
} |
||||||
return false; |
return false; |
||||||
} |
} |
||||||
|
|
||||||
} |
} |
||||||
|
@ -1,53 +1,54 @@ |
|||||||
/* |
/* |
||||||
* Copyright 2010-2018 Eric Kok et al. |
* Copyright 2010-2018 Eric Kok et al. |
||||||
* |
* |
||||||
* Transdroid is free software: you can redistribute it and/or modify |
* Transdroid is free software: you can redistribute it and/or modify |
||||||
* it under the terms of the GNU General Public License as published by |
* it under the terms of the GNU General Public License as published by |
||||||
* the Free Software Foundation, either version 3 of the License, or |
* the Free Software Foundation, either version 3 of the License, or |
||||||
* (at your option) any later version. |
* (at your option) any later version. |
||||||
* |
* |
||||||
* Transdroid is distributed in the hope that it will be useful, |
* Transdroid is distributed in the hope that it will be useful, |
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
* GNU General Public License for more details. |
* GNU General Public License for more details. |
||||||
* |
* |
||||||
* You should have received a copy of the GNU General Public License |
* You should have received a copy of the GNU General Public License |
||||||
* along with Transdroid. If not, see <http://www.gnu.org/licenses/>.
|
* along with Transdroid. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/ |
*/ |
||||||
package org.transdroid.core.gui.settings; |
package org.transdroid.core.gui.settings; |
||||||
|
|
||||||
import org.transdroid.R; |
|
||||||
import org.transdroid.core.gui.navigation.DialogHelper; |
|
||||||
|
|
||||||
import android.app.Activity; |
import android.app.Activity; |
||||||
import android.content.Intent; |
import android.content.Intent; |
||||||
import android.net.Uri; |
import android.net.Uri; |
||||||
|
|
||||||
|
import org.transdroid.R; |
||||||
|
import org.transdroid.core.gui.navigation.DialogHelper; |
||||||
|
|
||||||
/** |
/** |
||||||
* Fragment that shows recent app changes. |
* Fragment that shows recent app changes. |
||||||
|
* |
||||||
* @author Eric Kok |
* @author Eric Kok |
||||||
*/ |
*/ |
||||||
public class ChangelogDialog implements DialogHelper.DialogSpecification { |
public class ChangelogDialog implements DialogHelper.DialogSpecification { |
||||||
|
|
||||||
private static final long serialVersionUID = -4563410777022941124L; |
private static final long serialVersionUID = -4563410777022941124L; |
||||||
|
|
||||||
@Override |
@Override |
||||||
public int getDialogLayoutId() { |
public int getDialogLayoutId() { |
||||||
return R.layout.dialog_changelog; |
return R.layout.dialog_changelog; |
||||||
} |
} |
||||||
|
|
||||||
@Override |
@Override |
||||||
public int getDialogMenuId() { |
public int getDialogMenuId() { |
||||||
return R.menu.dialog_about; |
return R.menu.dialog_about; |
||||||
} |
} |
||||||
|
|
||||||
@Override |
@Override |
||||||
public boolean onMenuItemSelected(Activity ownerActivity, int selectedItemId) { |
public boolean onMenuItemSelected(Activity ownerActivity, int selectedItemId) { |
||||||
if (selectedItemId == R.id.action_visitwebsite) { |
if (selectedItemId == R.id.action_visitwebsite) { |
||||||
ownerActivity.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://transdroid.org/about/changelog/"))); |
ownerActivity.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://transdroid.org/about/changelog/"))); |
||||||
return true; |
return true; |
||||||
} |
} |
||||||
return false; |
return false; |
||||||
} |
} |
||||||
|
|
||||||
} |
} |
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue