From ad1f14e2b8320beaeff76d698495ee7b22debf7b Mon Sep 17 00:00:00 2001 From: Twig N Date: Wed, 5 Feb 2020 23:36:16 +1100 Subject: [PATCH 01/15] - experiment with using Theme.AppCompat.DayNight --- .../styles_transdroid.xml} | 5 ++++- app/src/main/res/values-v21/styles.xml | 16 ++++++++-------- .../main/res/values/colors_transdroid_dark.xml | 2 +- app/src/main/res/values/styles.xml | 8 ++------ ...ransdroid_light.xml => styles_transdroid.xml} | 5 ++++- 5 files changed, 19 insertions(+), 17 deletions(-) rename app/src/main/res/{values/styles_transdroid_dark.xml => values-night/styles_transdroid.xml} (85%) rename app/src/main/res/values/{styles_transdroid_light.xml => styles_transdroid.xml} (86%) diff --git a/app/src/main/res/values/styles_transdroid_dark.xml b/app/src/main/res/values-night/styles_transdroid.xml similarity index 85% rename from app/src/main/res/values/styles_transdroid_dark.xml rename to app/src/main/res/values-night/styles_transdroid.xml index 5cda3e43..3001b624 100644 --- a/app/src/main/res/values/styles_transdroid_dark.xml +++ b/app/src/main/res/values-night/styles_transdroid.xml @@ -18,7 +18,10 @@ - + + + + - + + + + - diff --git a/app/src/main/res/values/styles_transdroid_light.xml b/app/src/main/res/values/styles_transdroid.xml similarity index 86% rename from app/src/main/res/values/styles_transdroid_light.xml rename to app/src/main/res/values/styles_transdroid.xml index 68902f36..3d079538 100644 --- a/app/src/main/res/values/styles_transdroid_light.xml +++ b/app/src/main/res/values/styles_transdroid.xml @@ -19,7 +19,10 @@ - \ No newline at end of file diff --git a/app/src/main/res/values/styles_transdroid.xml b/app/src/main/res/values/styles_transdroid.xml index 3d079538..3b2089f1 100644 --- a/app/src/main/res/values/styles_transdroid.xml +++ b/app/src/main/res/values/styles_transdroid.xml @@ -20,7 +20,7 @@ \ No newline at end of file From 7587b234698ff1421146154a2e361de3fc232a23 Mon Sep 17 00:00:00 2001 From: Twig N Date: Sat, 8 Feb 2020 14:57:39 +1100 Subject: [PATCH 06/15] (WIP) - fixed drawables --- .../main/java/org/transdroid/core/gui/DetailsFragment.java | 6 +----- .../transdroid/core/gui/search/SearchResultsFragment.java | 6 +----- app/src/main/res/values-night/styles_transdroid.xml | 2 +- app/src/main/res/values/styles_transdroid.xml | 2 +- 4 files changed, 4 insertions(+), 12 deletions(-) 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 3039ae71..d701d54e 100644 --- a/app/src/main/java/org/transdroid/core/gui/DetailsFragment.java +++ b/app/src/main/java/org/transdroid/core/gui/DetailsFragment.java @@ -122,11 +122,7 @@ public class DetailsFragment extends Fragment implements OnTrackersUpdatedListen // On large screens where this fragment is shown next to the torrents list, we show a continues grey vertical // line to separate the lists visually if (!NavigationHelper_.getInstance_(getActivity()).isSmallScreen()) { - if (SystemSettings_.getInstance_(getActivity()).useDarkTheme()) { - detailsContainer.setBackgroundResource(R.drawable.details_list_background_dark); - } else { - detailsContainer.setBackgroundResource(R.drawable.details_list_background_light); - } + detailsContainer.setBackgroundResource(R.drawable.details_list_background); } createMenuOptions(); diff --git a/app/src/main/java/org/transdroid/core/gui/search/SearchResultsFragment.java b/app/src/main/java/org/transdroid/core/gui/search/SearchResultsFragment.java index 6fa7fd4f..696d43b0 100644 --- a/app/src/main/java/org/transdroid/core/gui/search/SearchResultsFragment.java +++ b/app/src/main/java/org/transdroid/core/gui/search/SearchResultsFragment.java @@ -86,11 +86,7 @@ public class SearchResultsFragment extends Fragment { // On large screens where this fragment is shown next to the sites list; we show a continues grey vertical line // to separate the lists visually if (!NavigationHelper_.getInstance_(getActivity()).isSmallScreen()) { - if (SystemSettings_.getInstance_(getActivity()).useDarkTheme()) { - resultsList.setBackgroundResource(R.drawable.details_list_background_dark); - } else { - resultsList.setBackgroundResource(R.drawable.details_list_background_light); - } + resultsList.setBackgroundResource(R.drawable.details_list_background); } // Set up the list adapter, which allows multi-select diff --git a/app/src/main/res/values-night/styles_transdroid.xml b/app/src/main/res/values-night/styles_transdroid.xml index ad2c1c04..18f295bb 100644 --- a/app/src/main/res/values-night/styles_transdroid.xml +++ b/app/src/main/res/values-night/styles_transdroid.xml @@ -28,7 +28,7 @@ @color/grey @style/DefaultTextView @color/transdroid_background - @drawable/loading_progress_dark + @drawable/loading_progress @color/transdroid_text_bright @color/transdroid_text_actionbar @color/transdroid_text_actionbar diff --git a/app/src/main/res/values/styles_transdroid.xml b/app/src/main/res/values/styles_transdroid.xml index 3b2089f1..874faae5 100644 --- a/app/src/main/res/values/styles_transdroid.xml +++ b/app/src/main/res/values/styles_transdroid.xml @@ -30,7 +30,7 @@ @color/grey @style/DefaultTextView @color/transdroid_background - @drawable/loading_progress_light + @drawable/loading_progress @color/transdroid_text_bright @color/transdroid_text_actionbar @color/transdroid_text_actionbar From e649122fbe6ea6485b1fb91256ad293b173e7b2e Mon Sep 17 00:00:00 2001 From: Twig N Date: Sat, 8 Feb 2020 15:21:40 +1100 Subject: [PATCH 07/15] (WIP) - fixed drawables --- .../core/widget/ListWidgetPreviewAdapter.java | 4 +- .../core/widget/ListWidgetProvider.java | 3 +- .../core/widget/ListWidgetViewsService.java | 4 +- .../details_list_background.xml} | 4 +- .../loading_progress.xml} | 0 ..._light.xml => details_list_background.xml} | 4 +- ...rogress_light.xml => loading_progress.xml} | 0 .../main/res/layout/activity_widgetconfig.xml | 4 +- ...m_widget_dark.xml => list_item_widget.xml} | 4 +- .../res/layout/list_item_widget_light.xml | 70 ------ ...torrents_light.xml => widget_torrents.xml} | 15 +- .../main/res/layout/widget_torrents_dark.xml | 222 ------------------ app/src/main/res/xml/listwidget_info.xml | 4 +- 13 files changed, 18 insertions(+), 320 deletions(-) rename app/src/main/res/{drawable/details_list_background_dark.xml => drawable-night/details_list_background.xml} (84%) rename app/src/main/res/{drawable/loading_progress_dark.xml => drawable-night/loading_progress.xml} (100%) rename app/src/main/res/drawable/{details_list_background_light.xml => details_list_background.xml} (84%) rename app/src/main/res/drawable/{loading_progress_light.xml => loading_progress.xml} (100%) rename app/src/main/res/layout/{list_item_widget_dark.xml => list_item_widget.xml} (94%) delete mode 100644 app/src/main/res/layout/list_item_widget_light.xml rename app/src/main/res/layout/{widget_torrents_light.xml => widget_torrents.xml} (93%) delete mode 100644 app/src/main/res/layout/widget_torrents_dark.xml diff --git a/app/src/main/java/org/transdroid/core/widget/ListWidgetPreviewAdapter.java b/app/src/main/java/org/transdroid/core/widget/ListWidgetPreviewAdapter.java index 6a4f98bd..5c941b0c 100644 --- a/app/src/main/java/org/transdroid/core/widget/ListWidgetPreviewAdapter.java +++ b/app/src/main/java/org/transdroid/core/widget/ListWidgetPreviewAdapter.java @@ -42,7 +42,7 @@ public class ListWidgetPreviewAdapter extends ArrayAdapter { * @param torrents The already-retrieved, non-null list of torrents to show */ public ListWidgetPreviewAdapter(Context context, int foo, List torrents) { - super(context, R.layout.list_item_widget_light, torrents); + super(context, R.layout.list_item_widget, torrents); } @Override @@ -51,7 +51,7 @@ public class ListWidgetPreviewAdapter extends ArrayAdapter { // Get the views ViewHolder holder; if (convertView == null) { - convertView = LayoutInflater.from(getContext()).inflate(R.layout.list_item_widget_light, parent, false); + convertView = LayoutInflater.from(getContext()).inflate(R.layout.list_item_widget, parent, false); holder = new ViewHolder(); holder.nameText = (TextView) convertView.findViewById(R.id.name_text); holder.progressText = (TextView) convertView.findViewById(R.id.progress_text); 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 e660e056..2ef2b471 100644 --- a/app/src/main/java/org/transdroid/core/widget/ListWidgetProvider.java +++ b/app/src/main/java/org/transdroid/core/widget/ListWidgetProvider.java @@ -79,8 +79,7 @@ public class ListWidgetProvider extends AppWidgetProvider { } // Load the dark or light widget layout xml - RemoteViews rv = new RemoteViews(context.getPackageName(), - config.shouldUseDarkTheme() ? R.layout.widget_torrents_dark : R.layout.widget_torrents_light); + RemoteViews rv = new RemoteViews(context.getPackageName(), R.layout.widget_torrents); // Set up the widget's list view loading service which refers to the WidgetViewsFactory Intent data = new Intent(context, ListWidgetViewsService_.class); 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 97b0c0f9..78617019 100644 --- a/app/src/main/java/org/transdroid/core/widget/ListWidgetViewsService.java +++ b/app/src/main/java/org/transdroid/core/widget/ListWidgetViewsService.java @@ -30,7 +30,6 @@ import org.transdroid.R; import org.transdroid.core.app.settings.*; import org.transdroid.core.gui.lists.LocalTorrent; import org.transdroid.core.gui.log.*; -import org.transdroid.core.service.*; import org.transdroid.daemon.Daemon; import org.transdroid.daemon.IDaemonAdapter; import org.transdroid.daemon.Torrent; @@ -166,8 +165,7 @@ class WidgetViewsFactory implements RemoteViewsService.RemoteViewsFactory { public RemoteViews getViewAt(int position) { // Load the dark or light widget list item layout xml - RemoteViews rv = new RemoteViews(context.getPackageName(), - config.shouldUseDarkTheme() ? R.layout.list_item_widget_dark : R.layout.list_item_widget_light); + RemoteViews rv = new RemoteViews(context.getPackageName(), R.layout.list_item_widget); // Bind the torrent details texts and status colour Torrent torrent = torrents.get(position); diff --git a/app/src/main/res/drawable/details_list_background_dark.xml b/app/src/main/res/drawable-night/details_list_background.xml similarity index 84% rename from app/src/main/res/drawable/details_list_background_dark.xml rename to app/src/main/res/drawable-night/details_list_background.xml index bbf1fe2f..c4b2c037 100644 --- a/app/src/main/res/drawable/details_list_background_dark.xml +++ b/app/src/main/res/drawable-night/details_list_background.xml @@ -16,6 +16,6 @@ along with Transdroid. If not, see . --> - - + + diff --git a/app/src/main/res/drawable/loading_progress_dark.xml b/app/src/main/res/drawable-night/loading_progress.xml similarity index 100% rename from app/src/main/res/drawable/loading_progress_dark.xml rename to app/src/main/res/drawable-night/loading_progress.xml diff --git a/app/src/main/res/drawable/details_list_background_light.xml b/app/src/main/res/drawable/details_list_background.xml similarity index 84% rename from app/src/main/res/drawable/details_list_background_light.xml rename to app/src/main/res/drawable/details_list_background.xml index a925c811..c4b2c037 100644 --- a/app/src/main/res/drawable/details_list_background_light.xml +++ b/app/src/main/res/drawable/details_list_background.xml @@ -16,6 +16,6 @@ along with Transdroid. If not, see . --> - - + + diff --git a/app/src/main/res/drawable/loading_progress_light.xml b/app/src/main/res/drawable/loading_progress.xml similarity index 100% rename from app/src/main/res/drawable/loading_progress_light.xml rename to app/src/main/res/drawable/loading_progress.xml diff --git a/app/src/main/res/layout/activity_widgetconfig.xml b/app/src/main/res/layout/activity_widgetconfig.xml index e39276ae..05c9cda7 100644 --- a/app/src/main/res/layout/activity_widgetconfig.xml +++ b/app/src/main/res/layout/activity_widgetconfig.xml @@ -28,13 +28,13 @@ android:background="@null" android:padding="@dimen/widget_preview_padding" > - + diff --git a/app/src/main/res/layout/list_item_widget_dark.xml b/app/src/main/res/layout/list_item_widget.xml similarity index 94% rename from app/src/main/res/layout/list_item_widget_dark.xml rename to app/src/main/res/layout/list_item_widget.xml index 5671da12..fdc2f34e 100644 --- a/app/src/main/res/layout/list_item_widget_dark.xml +++ b/app/src/main/res/layout/list_item_widget.xml @@ -36,7 +36,7 @@ android:fontFamily="sans-serif-condensed" android:maxLines="1" android:paddingTop="@dimen/widget_list_item_padding" - android:textColor="@color/text_bright_dark" + android:textColor="@color/transdroid_text_bright" android:textIsSelectable="false" android:textSize="@dimen/text_enlarged" /> @@ -49,6 +49,7 @@ android:layout_marginLeft="@dimen/widget_list_item_padding" android:layout_marginTop="4dip" android:maxLines="1" + android:textColor="@color/transdroid_text_bright" android:paddingBottom="@dimen/widget_list_item_padding" android:textIsSelectable="false" android:textSize="@dimen/text_small" /> @@ -62,6 +63,7 @@ android:layout_marginLeft="@dimen/widget_list_item_padding_left" android:layout_toLeftOf="@id/ratio_text" android:maxLines="1" + android:textColor="@color/transdroid_text_bright" android:textIsSelectable="false" android:textSize="@dimen/text_small" /> diff --git a/app/src/main/res/layout/list_item_widget_light.xml b/app/src/main/res/layout/list_item_widget_light.xml deleted file mode 100644 index 9a81fda7..00000000 --- a/app/src/main/res/layout/list_item_widget_light.xml +++ /dev/null @@ -1,70 +0,0 @@ - - - - - - - - - - - - - diff --git a/app/src/main/res/layout/widget_torrents_light.xml b/app/src/main/res/layout/widget_torrents.xml similarity index 93% rename from app/src/main/res/layout/widget_torrents_light.xml rename to app/src/main/res/layout/widget_torrents.xml index 68b2db32..7868fea3 100644 --- a/app/src/main/res/layout/widget_torrents_light.xml +++ b/app/src/main/res/layout/widget_torrents.xml @@ -19,7 +19,7 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" - android:background="@color/background_light"> + android:background="@color/transdroid_background"> @@ -69,8 +68,7 @@ android:layout_marginTop="-4dip" android:ellipsize="marquee" android:fontFamily="sans-serif-light" - android:maxLines="1" - android:textColor="@color/text_actionbar_dark" + android:singleLine="true" android:textIsSelectable="false" android:textSize="@dimen/ui_navigation_server" tools:text="Server"/> @@ -94,7 +92,6 @@ android:fontFamily="sans-serif-light" android:paddingTop="@dimen/ui_serverstatus_signmargin" android:text="↑" - android:textColor="@color/text_bright_dark" android:textSize="@dimen/ui_serverstatus_sign" tools:ignore="HardcodedText" /> @@ -105,7 +102,6 @@ android:layout_toLeftOf="@id/upcount_sign" android:fontFamily="sans-serif-light" android:gravity="end" - android:textColor="@color/text_bright_dark" android:textSize="@dimen/ui_serverstatus_bignumber" /> @@ -127,7 +122,6 @@ android:layout_toLeftOf="@id/downcount_sign" android:fontFamily="sans-serif-light" android:gravity="end" - android:textColor="@color/text_bright_dark" android:textSize="@dimen/ui_serverstatus_bignumber" /> @@ -209,7 +201,6 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_above="@id/bottomline_view" - android:layout_below="@id/topline_view" android:layout_gravity="center" android:gravity="center" android:maxWidth="400dip" diff --git a/app/src/main/res/layout/widget_torrents_dark.xml b/app/src/main/res/layout/widget_torrents_dark.xml deleted file mode 100644 index f00ca72f..00000000 --- a/app/src/main/res/layout/widget_torrents_dark.xml +++ /dev/null @@ -1,222 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/app/src/main/res/xml/listwidget_info.xml b/app/src/main/res/xml/listwidget_info.xml index a6a6e086..ee685400 100644 --- a/app/src/main/res/xml/listwidget_info.xml +++ b/app/src/main/res/xml/listwidget_info.xml @@ -17,8 +17,8 @@ --> Date: Sat, 8 Feb 2020 15:25:29 +1100 Subject: [PATCH 08/15] - fixed missing import --- .../java/org/transdroid/core/widget/ListWidgetViewsService.java | 1 + 1 file changed, 1 insertion(+) 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 78617019..8ba33e9e 100644 --- a/app/src/main/java/org/transdroid/core/widget/ListWidgetViewsService.java +++ b/app/src/main/java/org/transdroid/core/widget/ListWidgetViewsService.java @@ -30,6 +30,7 @@ import org.transdroid.R; import org.transdroid.core.app.settings.*; import org.transdroid.core.gui.lists.LocalTorrent; import org.transdroid.core.gui.log.*; +import org.transdroid.core.service.ConnectivityHelper_; import org.transdroid.daemon.Daemon; import org.transdroid.daemon.IDaemonAdapter; import org.transdroid.daemon.Torrent; From e37d1ebf8e761d83bf1e5a0e00517286ce455cb6 Mon Sep 17 00:00:00 2001 From: Twig N Date: Sun, 9 Feb 2020 11:58:42 +1100 Subject: [PATCH 09/15] - fixed transdroid_text_actionbar colour (always white is fine) --- app/src/main/res/values-night/colors_transdroid.xml | 1 - app/src/main/res/values/colors_transdroid.xml | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/app/src/main/res/values-night/colors_transdroid.xml b/app/src/main/res/values-night/colors_transdroid.xml index 360b02ff..512c993a 100644 --- a/app/src/main/res/values-night/colors_transdroid.xml +++ b/app/src/main/res/values-night/colors_transdroid.xml @@ -22,5 +22,4 @@ #303030 #2e2e2e #fff - #fff diff --git a/app/src/main/res/values/colors_transdroid.xml b/app/src/main/res/values/colors_transdroid.xml index 9d0e8b9f..82394556 100644 --- a/app/src/main/res/values/colors_transdroid.xml +++ b/app/src/main/res/values/colors_transdroid.xml @@ -22,5 +22,5 @@ #bdbdbd #fff #000 - #000 + #fff From 5582731775f95ae7d2d31d5448a66651fd46f2be Mon Sep 17 00:00:00 2001 From: Twig N Date: Sun, 9 Feb 2020 14:23:47 +1100 Subject: [PATCH 10/15] - fixed widget toolbar text colour --- app/src/main/res/layout/widget_torrents.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/src/main/res/layout/widget_torrents.xml b/app/src/main/res/layout/widget_torrents.xml index 7868fea3..98f3b315 100644 --- a/app/src/main/res/layout/widget_torrents.xml +++ b/app/src/main/res/layout/widget_torrents.xml @@ -59,6 +59,7 @@ android:singleLine="true" android:textIsSelectable="false" android:textSize="@dimen/ui_navigation_filter" + android:textColor="@color/transdroid_text_actionbar" tools:text="Filter" /> From 784c9366191e254426cc3cbcf6245c7f98888689 Mon Sep 17 00:00:00 2001 From: Twig N Date: Sun, 9 Feb 2020 14:26:44 +1100 Subject: [PATCH 11/15] - fixed inconsistent tabs to space --- app/src/main/res/values-night/colors_transdroid.xml | 2 +- app/src/main/res/values/colors_transdroid.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/res/values-night/colors_transdroid.xml b/app/src/main/res/values-night/colors_transdroid.xml index 512c993a..5b16d3c3 100644 --- a/app/src/main/res/values-night/colors_transdroid.xml +++ b/app/src/main/res/values-night/colors_transdroid.xml @@ -19,7 +19,7 @@ #CCaada62 - #303030 + #303030 #2e2e2e #fff diff --git a/app/src/main/res/values/colors_transdroid.xml b/app/src/main/res/values/colors_transdroid.xml index 82394556..db251889 100644 --- a/app/src/main/res/values/colors_transdroid.xml +++ b/app/src/main/res/values/colors_transdroid.xml @@ -19,7 +19,7 @@ #CC8ACC12 - #bdbdbd + #bdbdbd #fff #000 #fff From e1caa2a4f882478901e1fb33e3d504b9b8d458dd Mon Sep 17 00:00:00 2001 From: Twig N Date: Sun, 9 Feb 2020 14:53:27 +1100 Subject: [PATCH 12/15] - fixed up RemoteRssActivity after rebase --- .../transdroid/core/gui/remoterss/RemoteRssActivity.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/org/transdroid/core/gui/remoterss/RemoteRssActivity.java b/app/src/main/java/org/transdroid/core/gui/remoterss/RemoteRssActivity.java index 56445861..7b390c15 100644 --- a/app/src/main/java/org/transdroid/core/gui/remoterss/RemoteRssActivity.java +++ b/app/src/main/java/org/transdroid/core/gui/remoterss/RemoteRssActivity.java @@ -44,7 +44,7 @@ import org.androidannotations.annotations.ViewById; import org.transdroid.R; import org.transdroid.core.app.settings.ApplicationSettings; import org.transdroid.core.app.settings.ServerSetting; -import org.transdroid.core.app.settings.SystemSettings_; +import org.transdroid.core.app.settings.SettingsUtils; import org.transdroid.core.gui.lists.LocalTorrent; import org.transdroid.core.gui.lists.SimpleListItemAdapter; import org.transdroid.core.gui.log.Log; @@ -108,10 +108,7 @@ public class RemoteRssActivity extends AppCompatActivity implements RefreshableA @Override public void onCreate(Bundle savedInstanceState) { - // Set the theme according to the user preference - if (SystemSettings_.getInstance_(this).useDarkTheme()) { - setTheme(R.style.TransdroidTheme_Dark); - } + SettingsUtils.applyDayNightTheme(this); super.onCreate(savedInstanceState); } From 8c131002fe111a6109306edbff87227e52f8ac1b Mon Sep 17 00:00:00 2001 From: Twig N Date: Sun, 9 Feb 2020 14:54:07 +1100 Subject: [PATCH 13/15] - removed unused TransdroidTheme themes in values-v21/styles.xml --- app/src/main/res/values-v21/styles.xml | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/app/src/main/res/values-v21/styles.xml b/app/src/main/res/values-v21/styles.xml index 6ad894ea..d8fcf78a 100644 --- a/app/src/main/res/values-v21/styles.xml +++ b/app/src/main/res/values-v21/styles.xml @@ -16,16 +16,6 @@ --> - - - - - - - - - -