diff --git a/app/build.gradle b/app/build.gradle index 47e5e3d4..3a9cba58 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -37,8 +37,8 @@ dependencies { compile 'com.j256.ormlite:ormlite-core:4.48' compile 'com.j256.ormlite:ormlite-android:4.48' compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.3' - compile 'com.android.support:appcompat-v7:22.1.1' - compile 'com.android.support:support-annotations:22.1.1' + compile 'com.android.support:appcompat-v7:22.2.0' + compile 'com.android.support:support-annotations:22.2.0' compile 'com.getbase:floatingactionbutton:1.8.0' compile 'com.afollestad:material-dialogs:0.6.3.3' compile 'com.nispok:snackbar:2.10.6' diff --git a/app/src/main/java/org/transdroid/core/gui/DetailsActivity.java b/app/src/main/java/org/transdroid/core/gui/DetailsActivity.java index 8dd9c5fa..e5eda021 100644 --- a/app/src/main/java/org/transdroid/core/gui/DetailsActivity.java +++ b/app/src/main/java/org/transdroid/core/gui/DetailsActivity.java @@ -20,7 +20,7 @@ import android.annotation.TargetApi; import android.content.Intent; import android.os.Build; import android.os.Bundle; -import android.support.v7.app.ActionBarActivity; +import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import com.nispok.snackbar.Snackbar; @@ -84,7 +84,7 @@ import java.util.List; */ @EActivity(R.layout.activity_details) @OptionsMenu(R.menu.activity_details) -public class DetailsActivity extends ActionBarActivity implements TorrentTasksExecutor, RefreshableActivity { +public class DetailsActivity extends AppCompatActivity implements TorrentTasksExecutor, RefreshableActivity { @Extra @InstanceState diff --git a/app/src/main/java/org/transdroid/core/gui/DetailsFragment.java b/app/src/main/java/org/transdroid/core/gui/DetailsFragment.java index b6189e98..66b88ac7 100644 --- a/app/src/main/java/org/transdroid/core/gui/DetailsFragment.java +++ b/app/src/main/java/org/transdroid/core/gui/DetailsFragment.java @@ -24,7 +24,7 @@ import android.content.Context; import android.content.Intent; import android.net.Uri; import android.support.v4.widget.SwipeRefreshLayout; -import android.support.v7.app.ActionBarActivity; +import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.ActionMenuView; import android.view.ActionMode; import android.view.Menu; @@ -487,7 +487,7 @@ public class DetailsFragment extends Fragment implements OnTrackersUpdatedListen }); contextualMenu.getMenu().clear(); getActivity().getMenuInflater().inflate(R.menu.fragment_details_cab_main, contextualMenu.getMenu()); - Context themedContext = ((ActionBarActivity) getActivity()).getSupportActionBar().getThemedContext(); + Context themedContext = ((AppCompatActivity) getActivity()).getSupportActionBar().getThemedContext(); mode.getMenuInflater().inflate(R.menu.fragment_details_cab_secondary, menu); selectionManagerMode = new SelectionManagerMode(themedContext, detailsList, R.plurals.navigation_filesselected); selectionManagerMode.setOnlyCheckClass(TorrentFile.class); diff --git a/app/src/main/java/org/transdroid/core/gui/TorrentsActivity.java b/app/src/main/java/org/transdroid/core/gui/TorrentsActivity.java index 151d1345..5cd615fe 100644 --- a/app/src/main/java/org/transdroid/core/gui/TorrentsActivity.java +++ b/app/src/main/java/org/transdroid/core/gui/TorrentsActivity.java @@ -26,8 +26,8 @@ import android.os.Build; import android.os.Bundle; import android.support.v4.view.MenuItemCompat; import android.support.v4.widget.DrawerLayout; -import android.support.v7.app.ActionBarActivity; import android.support.v7.app.ActionBarDrawerToggle; +import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.ActionMenuView; import android.support.v7.widget.SearchView; import android.support.v7.widget.Toolbar; @@ -145,7 +145,7 @@ import java.util.Map.Entry; * @author Eric Kok */ @EActivity(R.layout.activity_torrents) -public class TorrentsActivity extends ActionBarActivity implements TorrentTasksExecutor, RefreshableActivity { +public class TorrentsActivity extends AppCompatActivity implements TorrentTasksExecutor, RefreshableActivity { private static final int RESULT_DETAILS = 0; @@ -795,8 +795,7 @@ public class TorrentsActivity extends ActionBarActivity implements TorrentTasksE protected void onBarcodeScanHandled(String barcode, String result) { log.d(this, "Scanned barcode " + barcode + " and got " + result); if (TextUtils.isEmpty(result)) { - SnackbarManager.show(Snackbar.with(this).text(R.string.error_noproductforcode).colorResource(R.color.red) - .type(SnackbarType.MULTI_LINE)); + SnackbarManager.show(Snackbar.with(this).text(R.string.error_noproductforcode).colorResource(R.color.red).type(SnackbarType.MULTI_LINE)); } else if (result.startsWith("http") || result.startsWith("https")) { addTorrentByUrl(result, "QR code result"); // No torrent title known } else if (result.startsWith("magnet")) { diff --git a/app/src/main/java/org/transdroid/core/gui/TorrentsFragment.java b/app/src/main/java/org/transdroid/core/gui/TorrentsFragment.java index ede7e13f..b03e4af3 100644 --- a/app/src/main/java/org/transdroid/core/gui/TorrentsFragment.java +++ b/app/src/main/java/org/transdroid/core/gui/TorrentsFragment.java @@ -19,7 +19,7 @@ package org.transdroid.core.gui; import android.app.Fragment; import android.content.Context; import android.support.v4.widget.SwipeRefreshLayout; -import android.support.v7.app.ActionBarActivity; +import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.ActionMenuView; import android.support.v7.widget.Toolbar; import android.view.ActionMode; @@ -281,7 +281,7 @@ public class TorrentsFragment extends Fragment implements OnLabelPickedListener }); actionsMenu.getMenu().clear(); getActivity().getMenuInflater().inflate(R.menu.fragment_torrents_cab, actionsMenu.getMenu()); - Context themedContext = ((ActionBarActivity) getActivity()).getSupportActionBar().getThemedContext(); + Context themedContext = ((AppCompatActivity) getActivity()).getSupportActionBar().getThemedContext(); selectionManagerMode = new SelectionManagerMode(themedContext, torrentsList, R.plurals.navigation_torrentsselected); selectionManagerMode.onCreateActionMode(mode, menu); return true; @@ -354,7 +354,7 @@ public class TorrentsFragment extends Fragment implements OnLabelPickedListener } else if (itemId == R.id.action_setlabel) { lastMultiSelectedTorrents = checked; if (currentLabels != null) { - SetLabelDialog.show(getActivity(), TorrentsFragment.this,currentLabels); + SetLabelDialog.show(getActivity(), TorrentsFragment.this, currentLabels); } mode.finish(); return true; diff --git a/app/src/main/java/org/transdroid/core/gui/rss/RssfeedsActivity.java b/app/src/main/java/org/transdroid/core/gui/rss/RssfeedsActivity.java index b1bc2f5a..96298458 100644 --- a/app/src/main/java/org/transdroid/core/gui/rss/RssfeedsActivity.java +++ b/app/src/main/java/org/transdroid/core/gui/rss/RssfeedsActivity.java @@ -21,7 +21,7 @@ import android.content.Intent; import android.net.Uri; import android.os.Build; import android.os.Bundle; -import android.support.v7.app.ActionBarActivity; +import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.text.TextUtils; @@ -51,7 +51,7 @@ import java.util.Date; import java.util.List; @EActivity(R.layout.activity_rssfeeds) -public class RssfeedsActivity extends ActionBarActivity { +public class RssfeedsActivity extends AppCompatActivity { // Settings and local data @Bean diff --git a/app/src/main/java/org/transdroid/core/gui/rss/RssitemsActivity.java b/app/src/main/java/org/transdroid/core/gui/rss/RssitemsActivity.java index 7408b7e6..b57ad0d6 100644 --- a/app/src/main/java/org/transdroid/core/gui/rss/RssitemsActivity.java +++ b/app/src/main/java/org/transdroid/core/gui/rss/RssitemsActivity.java @@ -20,7 +20,7 @@ import android.annotation.TargetApi; import android.content.Intent; import android.os.Build; import android.os.Bundle; -import android.support.v7.app.ActionBarActivity; +import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import org.androidannotations.annotations.AfterViews; @@ -36,7 +36,7 @@ import org.transdroid.core.gui.navigation.NavigationHelper; import org.transdroid.core.rssparser.Channel; @EActivity(R.layout.activity_rssitems) -public class RssitemsActivity extends ActionBarActivity { +public class RssitemsActivity extends AppCompatActivity { @Extra protected Channel rssfeed = null; diff --git a/app/src/main/java/org/transdroid/core/gui/rss/RssitemsFragment.java b/app/src/main/java/org/transdroid/core/gui/rss/RssitemsFragment.java index 39d40fa8..3a2c0c57 100644 --- a/app/src/main/java/org/transdroid/core/gui/rss/RssitemsFragment.java +++ b/app/src/main/java/org/transdroid/core/gui/rss/RssitemsFragment.java @@ -27,7 +27,7 @@ import android.content.Context; import android.content.Intent; import android.net.Uri; import android.os.Bundle; -import android.support.v7.app.ActionBarActivity; +import android.support.v7.app.AppCompatActivity; import android.text.TextUtils; import android.view.ActionMode; import android.view.Menu; @@ -80,7 +80,7 @@ public class RssitemsFragment extends Fragment { public boolean onCreateActionMode(ActionMode mode, Menu menu) { // Show contextual action bar to add items in batch mode mode.getMenuInflater().inflate(R.menu.fragment_rssitems_cab, menu); - Context themedContext = ((ActionBarActivity) getActivity()).getSupportActionBar().getThemedContext(); + Context themedContext = ((AppCompatActivity) getActivity()).getSupportActionBar().getThemedContext(); selectionManagerMode = new SelectionManagerMode(themedContext, rssitemsList, R.plurals.rss_itemsselected); selectionManagerMode.onCreateActionMode(mode, menu); return true; diff --git a/app/src/main/java/org/transdroid/core/gui/search/SearchActivity.java b/app/src/main/java/org/transdroid/core/gui/search/SearchActivity.java index 23e3f183..1021c696 100644 --- a/app/src/main/java/org/transdroid/core/gui/search/SearchActivity.java +++ b/app/src/main/java/org/transdroid/core/gui/search/SearchActivity.java @@ -26,6 +26,7 @@ import android.provider.SearchRecentSuggestions; import android.support.v4.view.MenuItemCompat; import android.support.v7.app.ActionBar; import android.support.v7.app.ActionBarActivity; +import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.view.Menu; import android.view.MenuItem; @@ -62,7 +63,7 @@ import java.util.List; */ @EActivity(R.layout.activity_search) @OptionsMenu(R.menu.activity_search) -public class SearchActivity extends ActionBarActivity implements ActionBar.OnNavigationListener { +public class SearchActivity extends AppCompatActivity implements ActionBar.OnNavigationListener { @ViewById protected Toolbar searchToolbar; diff --git a/app/src/main/java/org/transdroid/core/gui/settings/PreferenceCompatActivity.java b/app/src/main/java/org/transdroid/core/gui/settings/PreferenceCompatActivity.java index a25ba166..b6b713da 100644 --- a/app/src/main/java/org/transdroid/core/gui/settings/PreferenceCompatActivity.java +++ b/app/src/main/java/org/transdroid/core/gui/settings/PreferenceCompatActivity.java @@ -3,6 +3,7 @@ package org.transdroid.core.gui.settings; import android.content.res.Configuration; import android.os.Bundle; import android.preference.PreferenceActivity; +import android.support.annotation.Nullable; import android.support.v7.app.ActionBar; import android.support.v7.app.AppCompatCallback; import android.support.v7.app.AppCompatDelegate; @@ -62,4 +63,10 @@ public class PreferenceCompatActivity extends PreferenceActivity implements AppC public void onSupportActionModeFinished(ActionMode actionMode) { } + + @Nullable + @Override + public ActionMode onWindowStartingSupportActionMode(ActionMode.Callback callback) { + return acd.startSupportActionMode(callback); + } } diff --git a/app/src/main/java/org/transdroid/core/widget/ListWidgetConfigActivity.java b/app/src/main/java/org/transdroid/core/widget/ListWidgetConfigActivity.java index b2f1bb78..324a1ff2 100644 --- a/app/src/main/java/org/transdroid/core/widget/ListWidgetConfigActivity.java +++ b/app/src/main/java/org/transdroid/core/widget/ListWidgetConfigActivity.java @@ -22,7 +22,7 @@ import android.content.Intent; import android.os.Build; import android.os.Bundle; import android.support.v7.app.ActionBar; -import android.support.v7.app.ActionBarActivity; +import android.support.v7.app.AppCompatActivity; import android.view.View; import android.view.View.OnClickListener; import android.widget.CheckBox; @@ -66,7 +66,7 @@ import java.util.List; @TargetApi(Build.VERSION_CODES.HONEYCOMB) @EActivity(resName = "activity_widgetconfig") -public class ListWidgetConfigActivity extends ActionBarActivity { +public class ListWidgetConfigActivity extends AppCompatActivity { // Views and adapters @ViewById @@ -127,14 +127,12 @@ public class ListWidgetConfigActivity extends ActionBarActivity { boolean reverseSort = reverseorderCheckBox.isChecked(); boolean showstatus = showstatusCheckBox.isChecked(); boolean useDarkTheme = darkthemeCheckBox.isChecked(); - ListWidgetConfig config = - new ListWidgetConfig(server, statusType, sortBy, reverseSort, showstatus, useDarkTheme); + ListWidgetConfig config = new ListWidgetConfig(server, statusType, sortBy, reverseSort, showstatus, useDarkTheme); applicationSettings.setWidgetConfig(appWidgetId, config); // Return the widget configuration result AppWidgetManager manager = AppWidgetManager.getInstance(ListWidgetConfigActivity.this); - manager.updateAppWidget(appWidgetId, - ListWidgetProvider.buildRemoteViews(getApplicationContext(), appWidgetId, config)); + manager.updateAppWidget(appWidgetId, ListWidgetProvider.buildRemoteViews(getApplicationContext(), appWidgetId, config)); manager.notifyAppWidgetViewDataChanged(appWidgetId, R.id.torrents_list); setResult(RESULT_OK, new Intent().putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId)); finish(); @@ -149,14 +147,12 @@ public class ListWidgetConfigActivity extends ActionBarActivity { if (getIntent() == null || getIntent().getExtras() == null || !getIntent().hasExtra(AppWidgetManager.EXTRA_APPWIDGET_ID)) { // Invalid configuration; return canceled result - setResult(RESULT_CANCELED, - new Intent().putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID)); + setResult(RESULT_CANCELED, new Intent().putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID)); finish(); } // Get the appwidget ID we are configuring - appWidgetId = - getIntent().getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); + appWidgetId = getIntent().getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); // Set preliminary canceled result and continue with the initialisation setResult(RESULT_CANCELED, new Intent().putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId)); @@ -166,27 +162,26 @@ public class ListWidgetConfigActivity extends ActionBarActivity { protected void init() { // Populate the selection spinners with custom array adapters - List sortOrders = new ArrayList(); + List sortOrders = new ArrayList<>(); for (TorrentsSortBy order : TorrentsSortBy.values()) { sortOrders.add(new SortByListItem(this, order)); } - serverSpinner.setAdapter( - new SimpleListItemSpinnerAdapter(this, 0, applicationSettings.getAllServerSettings())); - filterSpinner.setAdapter( - new SimpleListItemSpinnerAdapter(this, 0, StatusType.getAllStatusTypes(this))); - sortSpinner.setAdapter(new SimpleListItemSpinnerAdapter(this, 0, sortOrders)); - // TODO: Update to AndroidAnnotations 3.0 and use @CheckedChanged + serverSpinner.setAdapter(new SimpleListItemSpinnerAdapter<>(this, 0, applicationSettings.getAllServerSettings())); + filterSpinner.setAdapter(new SimpleListItemSpinnerAdapter<>(this, 0, StatusType.getAllStatusTypes(this))); + sortSpinner.setAdapter(new SimpleListItemSpinnerAdapter<>(this, 0, sortOrders)); reverseorderCheckBox.setOnCheckedChangeListener(reverseorderCheckedChanged); showstatusCheckBox.setOnCheckedChangeListener(showstatusCheckChanged); torrentsList.setEmptyView(errorText); // Set up action bar with a done button // Inspired by NoNonsenseNotes's ListWidgetConfig.java (Apache License, Version 2.0) - getSupportActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM, - ActionBar.DISPLAY_SHOW_CUSTOM | ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_SHOW_TITLE); - View doneButtonFrame = getLayoutInflater().inflate(R.layout.actionbar_donebutton, null); - doneButtonFrame.findViewById(R.id.actionbar_done).setOnClickListener(doneClicked); - getSupportActionBar().setCustomView(doneButtonFrame); + if (getSupportActionBar() != null) { + getSupportActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM, + ActionBar.DISPLAY_SHOW_CUSTOM | ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_SHOW_TITLE); + View doneButtonFrame = getLayoutInflater().inflate(R.layout.actionbar_donebutton, null); + doneButtonFrame.findViewById(R.id.actionbar_done).setOnClickListener(doneClicked); + getSupportActionBar().setCustomView(doneButtonFrame); + } } @@ -215,13 +210,12 @@ public class ListWidgetConfigActivity extends ActionBarActivity { } // Create a connection object and retrieve the live torrents - IDaemonAdapter connection = ((ServerSetting) serverSpinner.getSelectedItem()) - .createServerAdapter(connectivityHelper.getConnectedNetworkName(), this); + IDaemonAdapter connection = + ((ServerSetting) serverSpinner.getSelectedItem()).createServerAdapter(connectivityHelper.getConnectedNetworkName(), this); DaemonTaskResult result = RetrieveTask.create(connection).execute(log); if (result instanceof RetrieveTaskSuccessResult) { // Success; show the active torrents in the widget preview - onTorrentsRetrieved(((RetrieveTaskSuccessResult) result).getTorrents(), - ((RetrieveTaskSuccessResult) result).getLabels()); + onTorrentsRetrieved(((RetrieveTaskSuccessResult) result).getTorrents(), ((RetrieveTaskSuccessResult) result).getLabels()); } else { // Can't connect right now; provide a nice error message showError(false); @@ -252,7 +246,7 @@ public class ListWidgetConfigActivity extends ActionBarActivity { } // Get the already loaded torrents and filter and sort them - ArrayList filteredTorrents = new ArrayList(previewTorrents.size()); + ArrayList filteredTorrents = new ArrayList<>(previewTorrents.size()); StatusTypeFilter statusTypeFilter = (StatusTypeFilter) filterSpinner.getSelectedItem(); boolean dormantAsInactive = systemSettings.treatDormantAsInactive(); for (Torrent torrent : previewTorrents) { @@ -266,8 +260,7 @@ public class ListWidgetConfigActivity extends ActionBarActivity { } TorrentsSortBy sortBy = ((SortByListItem) sortSpinner.getSelectedItem()).getSortBy(); Daemon serverType = filteredTorrents.get(0).getDaemon(); - Collections - .sort(filteredTorrents, new TorrentsComparator(serverType, sortBy, reverseorderCheckBox.isChecked())); + Collections.sort(filteredTorrents, new TorrentsComparator(serverType, sortBy, reverseorderCheckBox.isChecked())); // Update the server status count and speeds int downcount = 0, upcount = 0, downspeed = 0, upspeed = 0; diff --git a/app/src/main/java/org/transdroid/core/widget/ListWidgetProvider.java b/app/src/main/java/org/transdroid/core/widget/ListWidgetProvider.java index f7a0c3a2..0a613e25 100644 --- a/app/src/main/java/org/transdroid/core/widget/ListWidgetProvider.java +++ b/app/src/main/java/org/transdroid/core/widget/ListWidgetProvider.java @@ -30,14 +30,17 @@ import android.widget.RemoteViews; import org.androidannotations.annotations.Bean; import org.androidannotations.annotations.EReceiver; import org.transdroid.R; -import org.transdroid.core.app.settings.*; -import org.transdroid.core.gui.*; -import org.transdroid.core.gui.log.*; +import org.transdroid.core.app.settings.ApplicationSettings; +import org.transdroid.core.app.settings.ApplicationSettings_; +import org.transdroid.core.app.settings.ServerSetting; +import org.transdroid.core.gui.TorrentsActivity_; +import org.transdroid.core.gui.log.Log_; import org.transdroid.core.service.ControlService; +import org.transdroid.core.service.ControlService_; /** - * The provider of a list-style Transdroid widget, which controls the general loading and (touch) event handling. The - * list rows' remote views are loaded in the accompanying {@link ListWidgetViewsService}. + * The provider of a list-style Transdroid widget, which controls the general loading and (touch) event handling. The list rows' remote views are + * loaded in the accompanying {@link ListWidgetViewsService}. * @author Eric Kok */ @TargetApi(Build.VERSION_CODES.HONEYCOMB) @@ -53,8 +56,8 @@ public class ListWidgetProvider extends AppWidgetProvider { protected ApplicationSettings applicationSettings; /** - * Loads and sets up the layout for some specific app widget given the user's widget settings. Note that the views - * for the list view rows are loaded separately in the {@link WidgetViewsFactory}. + * Loads and sets up the layout for some specific app widget given the user's widget settings. Note that the views for the list view rows are + * loaded separately in the {@link WidgetViewsFactory}. * @param context The app widget context, with access to resources * @param appWidgetId The specific ID of the app widget to load * @param config The user widget configuration, with filter and theme preferences @@ -69,9 +72,9 @@ public class ListWidgetProvider extends AppWidgetProvider { } ApplicationSettings appSettings = ApplicationSettings_.getInstance_(context); if (config.getServerId() < 0 || config.getServerId() > appSettings.getMaxOfAllServers()) { - Log_.getInstance_(context).e("ListWidgetProvider", - "Tried to set up widget " + appWidgetId + " but the bound server ID " + config.getServerId() + - " no longer exists."); + Log_.getInstance_(context) + .e("ListWidgetProvider", "Tried to set up widget " + appWidgetId + " but the bound server ID " + config.getServerId() + + " no longer exists."); return null; } @@ -86,8 +89,7 @@ public class ListWidgetProvider extends AppWidgetProvider { rv.setRemoteAdapter(appWidgetId, R.id.torrents_list, data); Intent open = new Intent(context, TorrentsActivity_.class); open.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); - rv.setPendingIntentTemplate(R.id.torrents_list, - PendingIntent.getActivity(context, appWidgetId, open, PendingIntent.FLAG_UPDATE_CURRENT)); + rv.setPendingIntentTemplate(R.id.torrents_list, PendingIntent.getActivity(context, appWidgetId, open, PendingIntent.FLAG_UPDATE_CURRENT)); rv.setEmptyView(R.id.torrents_list, R.id.error_text); rv.setTextViewText(R.id.error_text, context.getString(R.string.widget_loading)); @@ -103,10 +105,8 @@ public class ListWidgetProvider extends AppWidgetProvider { start.setAction(INTENT_STARTSERVER); start.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); start.putExtra(EXTRA_SERVER, config.getServerId()); - rv.setOnClickPendingIntent(R.id.icon_image, - PendingIntent.getActivity(context, appWidgetId, start, PendingIntent.FLAG_UPDATE_CURRENT)); - rv.setOnClickPendingIntent(R.id.navigation_view, - PendingIntent.getActivity(context, appWidgetId, start, PendingIntent.FLAG_UPDATE_CURRENT)); + rv.setOnClickPendingIntent(R.id.icon_image, PendingIntent.getActivity(context, appWidgetId, start, PendingIntent.FLAG_UPDATE_CURRENT)); + rv.setOnClickPendingIntent(R.id.navigation_view, PendingIntent.getActivity(context, appWidgetId, start, PendingIntent.FLAG_UPDATE_CURRENT)); // Set up the widgets refresh button pending intent (calling this WidgetProvider itself) // Make sure that the intent is unique using a custom data path (rather than just the extras) @@ -114,8 +114,7 @@ public class ListWidgetProvider extends AppWidgetProvider { refresh.setData(Uri.parse("intent://widget/" + appWidgetId + "/refresh")); refresh.putExtra(EXTRA_REFRESH, appWidgetId); refresh.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId); - rv.setOnClickPendingIntent(R.id.refresh_button, - PendingIntent.getBroadcast(context, appWidgetId, refresh, PendingIntent.FLAG_UPDATE_CURRENT)); + rv.setOnClickPendingIntent(R.id.refresh_button, PendingIntent.getBroadcast(context, appWidgetId, refresh, PendingIntent.FLAG_UPDATE_CURRENT)); // Set up the control (pause and resume) buttons (calling the WidgetProvider itself) Intent pauseall = new Intent(context, ListWidgetProvider_.class); @@ -144,8 +143,7 @@ public class ListWidgetProvider extends AppWidgetProvider { // Refresh a specific app widget if (intent.hasExtra(EXTRA_REFRESH)) { // Manually requested a refresh for the app widget of which the ID was supplied - RemoteViews views = - buildRemoteViews(context, appWidgetId, applicationSettings.getWidgetConfig(appWidgetId)); + RemoteViews views = buildRemoteViews(context, appWidgetId, applicationSettings.getWidgetConfig(appWidgetId)); if (views != null) { AppWidgetManager.getInstance(context).updateAppWidget(appWidgetId, views); AppWidgetManager.getInstance(context).notifyAppWidgetViewDataChanged(appWidgetId, R.id.torrents_list); @@ -155,7 +153,8 @@ public class ListWidgetProvider extends AppWidgetProvider { // No refresh: this is a control intent: copy the action and EXTRA_APPWIDGET_ID to start the control service if (intent.getAction().startsWith("org.transdroid.control.")) { - Intent action = new Intent(intent.getAction()); + Intent action = new Intent(context, ControlService_.class); + action.setAction(intent.getAction()); action.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId); context.startService(action); } @@ -164,8 +163,7 @@ public class ListWidgetProvider extends AppWidgetProvider { @Override public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { for (int appWidgetId : appWidgetIds) { - appWidgetManager.updateAppWidget(appWidgetId, - buildRemoteViews(context, appWidgetId, applicationSettings.getWidgetConfig(appWidgetId))); + appWidgetManager.updateAppWidget(appWidgetId, buildRemoteViews(context, appWidgetId, applicationSettings.getWidgetConfig(appWidgetId))); appWidgetManager.notifyAppWidgetViewDataChanged(appWidgetId, R.id.torrents_list); } } diff --git a/app/src/main/java/org/transdroid/core/widget/ListWidgetViewsService.java b/app/src/main/java/org/transdroid/core/widget/ListWidgetViewsService.java index a912dc52..e7745e9d 100644 --- a/app/src/main/java/org/transdroid/core/widget/ListWidgetViewsService.java +++ b/app/src/main/java/org/transdroid/core/widget/ListWidgetViewsService.java @@ -117,7 +117,7 @@ class WidgetViewsFactory implements RemoteViewsService.RemoteViewsFactory { // We have data; filter, sort and store it to use later when getViewAt gets called SystemSettings systemSettings = SystemSettings_.getInstance_(context); - ArrayList filteredTorrents = new ArrayList(); + ArrayList filteredTorrents = new ArrayList<>(); List allTorrents = ((RetrieveTaskSuccessResult) result).getTorrents(); for (Torrent torrent : allTorrents) { if (config.getStatusType().getFilterItem(context) diff --git a/app/src/main/res/layout/widget_torrents_dark.xml b/app/src/main/res/layout/widget_torrents_dark.xml index 70b4856b..575772da 100644 --- a/app/src/main/res/layout/widget_torrents_dark.xml +++ b/app/src/main/res/layout/widget_torrents_dark.xml @@ -19,8 +19,7 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" - android:background="@color/background_dark" - android:padding="@dimen/margin_widget"> + android:background="@color/background_dark"> + android:textSize="@dimen/ui_navigation_filter" + tools:text="Filter" /> + android:textSize="@dimen/ui_navigation_server" + tools:text="Server" /> - - - - - - - - + android:background="@color/background_light"> - - - - - + android:background="@color/green" + android:orientation="horizontal"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - + +Transdroid 2.5.2\n +- Native Dediseedbox support\n +- Prevent widget from crashing\n +\n Transdroid 2.5.1\n - Improved rTorrent backwards compatibility\n - UI fixes for dark theme\n diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml index 9ab53fc4..c2223290 100644 --- a/app/src/main/res/values/dimens.xml +++ b/app/src/main/res/values/dimens.xml @@ -51,7 +51,7 @@ 200dp -1dp 46dp - 6dp + 8dp 54dp 6dp 12dp diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 2d226955..23f77986 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -34,6 +34,8 @@ @null true @android:color/transparent + true + false