Browse Source

Reinstate dark widget; fixes #555

pull/565/head
Eric Kok 4 years ago
parent
commit
90e59c5420
  1. 4
      app/src/main/java/org/transdroid/core/widget/ListWidgetViewsService.java
  2. 2
      app/src/main/res/layout/activity_widgetconfig.xml
  3. 71
      app/src/main/res/layout/list_item_widget_dark.xml
  4. 2
      app/src/main/res/values-night/colors_transdroid.xml
  5. 3
      app/src/main/res/values-sw600dp/dimens.xml
  6. 5
      app/src/main/res/values/colors_transdroid.xml
  7. 2
      app/src/main/res/values/dimens.xml
  8. 2
      app/src/main/res/values/strings.xml
  9. 3
      app/src/main/res/values/styles.xml
  10. 1
      app/src/main/res/values/styles_transdroid.xml

4
app/src/main/java/org/transdroid/core/widget/ListWidgetViewsService.java

@ -166,7 +166,9 @@ class WidgetViewsFactory implements RemoteViewsService.RemoteViewsFactory {
public RemoteViews getViewAt(int position) { public RemoteViews getViewAt(int position) {
// Load the dark or light widget list item layout xml // Load the dark or light widget list item layout xml
RemoteViews rv = new RemoteViews(context.getPackageName(), R.layout.list_item_widget); RemoteViews rv = new RemoteViews(context.getPackageName(),
config.shouldUseDarkTheme() ? R.layout.list_item_widget_dark : R.layout.list_item_widget);
// Bind the torrent details texts and status colour // Bind the torrent details texts and status colour
Torrent torrent = torrents.get(position); Torrent torrent = torrents.get(position);

2
app/src/main/res/layout/activity_widgetconfig.xml

@ -99,7 +99,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/margin_half" android:layout_marginTop="@dimen/margin_half"
android:text="@string/widget_showstatusview" /> android:text="@string/widget_showstatusview" />
<CheckBox <CheckBox
android:id="@+id/darktheme_check_box" android:id="@+id/darktheme_check_box"
android:layout_width="match_parent" android:layout_width="match_parent"

71
app/src/main/res/layout/list_item_widget_dark.xml

@ -0,0 +1,71 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2010-2018 Eric Kok et al.
Transdroid is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Transdroid is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Transdroid. If not, see <http://www.gnu.org/licenses/>.
-->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/widget_line_layout"
android:layout_width="fill_parent"
android:layout_height="@dimen/widget_list_item_height"
android:background="?android:attr/selectableItemBackground"
android:paddingRight="@dimen/widget_list_item_padding">
<TextView
android:id="@+id/status_view"
android:layout_width="6dp"
android:layout_height="@dimen/widget_list_item_height" />
<TextView
android:id="@+id/name_text"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/widget_list_item_padding_left"
android:ellipsize="end"
android:fontFamily="sans-serif-condensed"
android:maxLines="1"
android:paddingTop="@dimen/widget_list_item_padding"
android:textColor="@color/transdroid_dark_text_bright"
android:textIsSelectable="false"
android:textSize="@dimen/text_enlarged" />
<TextView
android:id="@+id/ratio_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_below="@id/name_text"
android:layout_marginLeft="@dimen/widget_list_item_padding"
android:layout_marginTop="4dip"
android:maxLines="1"
android:textColor="@color/transdroid_dark_text_bright"
android:paddingBottom="@dimen/widget_list_item_padding"
android:textIsSelectable="false"
android:textSize="@dimen/text_small" />
<TextView
android:id="@+id/progress_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@id/ratio_text"
android:layout_alignParentLeft="true"
android:layout_marginLeft="@dimen/widget_list_item_padding_left"
android:layout_toLeftOf="@id/ratio_text"
android:maxLines="1"
android:textColor="@color/transdroid_dark_text_bright"
android:textIsSelectable="false"
android:textSize="@dimen/text_small" />
</RelativeLayout>

2
app/src/main/res/values-night/colors_transdroid.xml

@ -20,6 +20,6 @@
<resources> <resources>
<color name="transdroid_pressed">#CCaada62</color> <color name="transdroid_pressed">#CCaada62</color>
<color name="transdroid_divider">#303030</color> <color name="transdroid_divider">#303030</color>
<color name="transdroid_background">#2e2e2e</color> <color name="transdroid_background">#000</color>
<color name="transdroid_text_bright">#fff</color> <color name="transdroid_text_bright">#fff</color>
</resources> </resources>

3
app/src/main/res/values-sw600dp/dimens.xml

@ -39,6 +39,5 @@
<integer name="widget_config_orientation">0</integer> <integer name="widget_config_orientation">0</integer>
<dimen name="widget_preview_padding">30dp</dimen> <dimen name="widget_preview_padding">30dp</dimen>
<dimen name="widget_preview_height">-1dp</dimen> <dimen name="widget_preview_height">-1dp</dimen>
<dimen name="widget_preview_width">300dp</dimen>
</resources> </resources>

5
app/src/main/res/values/colors_transdroid.xml

@ -23,4 +23,9 @@
<color name="transdroid_background">#fff</color> <color name="transdroid_background">#fff</color>
<color name="transdroid_text_bright">#000</color> <color name="transdroid_text_bright">#000</color>
<color name="transdroid_text_actionbar">#fff</color> <color name="transdroid_text_actionbar">#fff</color>
<color name="transdroid_dark_pressed">#CCaada62</color>
<color name="transdroid_dark_divider">#303030</color>
<color name="transdroid_dark_background">#000</color>
<color name="transdroid_dark_text_bright">#fff</color>
</resources> </resources>

2
app/src/main/res/values/dimens.xml

@ -49,7 +49,7 @@
<integer name="widget_config_orientation">1</integer> <integer name="widget_config_orientation">1</integer>
<dimen name="widget_preview_padding">20dp</dimen> <dimen name="widget_preview_padding">20dp</dimen>
<dimen name="widget_preview_height">200dp</dimen> <dimen name="widget_preview_height">200dp</dimen>
<dimen name="widget_preview_width">-1dp</dimen> <dimen name="widget_preview_width">320dp</dimen>
<dimen name="widget_header_height">46dp</dimen> <dimen name="widget_header_height">46dp</dimen>
<dimen name="widget_header_padding">8dp</dimen> <dimen name="widget_header_padding">8dp</dimen>
<dimen name="widget_list_item_height">54dp</dimen> <dimen name="widget_list_item_height">54dp</dimen>

2
app/src/main/res/values/strings.xml

@ -357,11 +357,13 @@
<string name="pref_clearsearch_success">Search history is cleared</string> <string name="pref_clearsearch_success">Search history is cleared</string>
<string name="pref_import">Import settings</string> <string name="pref_import">Import settings</string>
<string name="pref_import_dialog">%1$s will try to import server, web search, RSS and system settings from: %2$s</string> <string name="pref_import_dialog">%1$s will try to import server, web search, RSS and system settings from: %2$s</string>
<string name="pref_import_dialog_android10">%1$s will try to import server, web search, RSS and system settings</string>
<string name="pref_import_fromfile">Use file</string> <string name="pref_import_fromfile">Use file</string>
<string name="pref_import_fromqr">Use QR code</string> <string name="pref_import_fromqr">Use QR code</string>
<string name="pref_import_success">Settings successfully imported</string> <string name="pref_import_success">Settings successfully imported</string>
<string name="pref_export">Export settings</string> <string name="pref_export">Export settings</string>
<string name="pref_export_dialog">%1$s will export server (including passwords), web search, RSS and system settings to the following plain text JSON file: %2$s</string> <string name="pref_export_dialog">%1$s will export server (including passwords), web search, RSS and system settings to the following plain text JSON file: %2$s</string>
<string name="pref_export_dialog_android10">%1$s will export server (including passwords), web search, RSS and system settings</string>
<string name="pref_export_tofile">To file</string> <string name="pref_export_tofile">To file</string>
<string name="pref_export_toqr">To QR code</string> <string name="pref_export_toqr">To QR code</string>
<string name="pref_export_success">Settings successfully exported</string> <string name="pref_export_success">Settings successfully exported</string>

3
app/src/main/res/values/styles.xml

@ -19,9 +19,6 @@
<style name="TransdroidTheme" parent="Theme.Transdroid.Auto"> <style name="TransdroidTheme" parent="Theme.Transdroid.Auto">
</style> </style>
<style name="TransdroidTheme.Dark" parent="Theme.Transdroid.Auto">
</style>
<!-- No theme background to let the user's wall paper shine through --> <!-- No theme background to let the user's wall paper shine through -->
<!-- Inspired by NoNonsenseNotes's ThemeWidgetConfig --> <!-- Inspired by NoNonsenseNotes's ThemeWidgetConfig -->
<style name="TransdroidTheme.WidgetConfig" parent="@style/TransdroidTheme"> <style name="TransdroidTheme.WidgetConfig" parent="@style/TransdroidTheme">

1
app/src/main/res/values/styles_transdroid.xml

@ -26,6 +26,7 @@
<item name="colorPrimary">@color/green</item> <item name="colorPrimary">@color/green</item>
<item name="colorPrimaryDark">@color/green_dark</item> <item name="colorPrimaryDark">@color/green_dark</item>
<item name="colorControlHighlight">@color/green_light</item> <item name="colorControlHighlight">@color/green_light</item>
<item name="colorAccent">@color/green_light</item>
<item name="windowActionModeOverlay">true</item> <item name="windowActionModeOverlay">true</item>
<item name="actionModeBackground">@color/grey</item> <item name="actionModeBackground">@color/grey</item>
<item name="android:textViewStyle">@style/DefaultTextView</item> <item name="android:textViewStyle">@style/DefaultTextView</item>

Loading…
Cancel
Save