Browse Source

(WIP)

- fixed drawables
pull/529/head
Twig N 5 years ago
parent
commit
e649122fbe
  1. 4
      app/src/main/java/org/transdroid/core/widget/ListWidgetPreviewAdapter.java
  2. 3
      app/src/main/java/org/transdroid/core/widget/ListWidgetProvider.java
  3. 4
      app/src/main/java/org/transdroid/core/widget/ListWidgetViewsService.java
  4. 4
      app/src/main/res/drawable-night/details_list_background.xml
  5. 0
      app/src/main/res/drawable-night/loading_progress.xml
  6. 4
      app/src/main/res/drawable/details_list_background.xml
  7. 0
      app/src/main/res/drawable/loading_progress.xml
  8. 4
      app/src/main/res/layout/activity_widgetconfig.xml
  9. 4
      app/src/main/res/layout/list_item_widget.xml
  10. 70
      app/src/main/res/layout/list_item_widget_light.xml
  11. 15
      app/src/main/res/layout/widget_torrents.xml
  12. 222
      app/src/main/res/layout/widget_torrents_dark.xml
  13. 4
      app/src/main/res/xml/listwidget_info.xml

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

@ -42,7 +42,7 @@ public class ListWidgetPreviewAdapter extends ArrayAdapter<Torrent> { @@ -42,7 +42,7 @@ public class ListWidgetPreviewAdapter extends ArrayAdapter<Torrent> {
* @param torrents The already-retrieved, non-null list of torrents to show
*/
public ListWidgetPreviewAdapter(Context context, int foo, List<Torrent> 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<Torrent> { @@ -51,7 +51,7 @@ public class ListWidgetPreviewAdapter extends ArrayAdapter<Torrent> {
// 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);

3
app/src/main/java/org/transdroid/core/widget/ListWidgetProvider.java

@ -79,8 +79,7 @@ public class ListWidgetProvider extends AppWidgetProvider { @@ -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);

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

@ -30,7 +30,6 @@ import org.transdroid.R; @@ -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 { @@ -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);

4
app/src/main/res/drawable/details_list_background_dark.xml → app/src/main/res/drawable-night/details_list_background.xml

@ -16,6 +16,6 @@ @@ -16,6 +16,6 @@
along with Transdroid. If not, see <http://www.gnu.org/licenses/>.
-->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:left="2dp" android:drawable="@color/divider_dark" />
<item android:left="4dp" android:drawable="@color/background_dark" />
<item android:left="2dp" android:drawable="@color/transdroid_divider" />
<item android:left="4dp" android:drawable="@color/transdroid_background" />
</layer-list>

0
app/src/main/res/drawable/loading_progress_dark.xml → app/src/main/res/drawable-night/loading_progress.xml

4
app/src/main/res/drawable/details_list_background_light.xml → app/src/main/res/drawable/details_list_background.xml

@ -16,6 +16,6 @@ @@ -16,6 +16,6 @@
along with Transdroid. If not, see <http://www.gnu.org/licenses/>.
-->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:left="2dp" android:drawable="@color/divider_light" />
<item android:left="4dp" android:drawable="@color/background_light" />
<item android:left="2dp" android:drawable="@color/transdroid_divider" />
<item android:left="4dp" android:drawable="@color/transdroid_background" />
</layer-list>

0
app/src/main/res/drawable/loading_progress_light.xml → app/src/main/res/drawable/loading_progress.xml

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

@ -28,13 +28,13 @@ @@ -28,13 +28,13 @@
android:background="@null"
android:padding="@dimen/widget_preview_padding" >
<include layout="@layout/widget_torrents_light" />
<include layout="@layout/widget_torrents" />
</FrameLayout>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/background_light"
android:background="@color/transdroid_background"
android:fillViewport="true"
android:paddingLeft="@dimen/margin_default"
android:paddingRight="@dimen/margin_default" >

4
app/src/main/res/layout/list_item_widget_dark.xml → app/src/main/res/layout/list_item_widget.xml

@ -36,7 +36,7 @@ @@ -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 @@ @@ -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 @@ @@ -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" />

70
app/src/main/res/layout/list_item_widget_light.xml

@ -1,70 +0,0 @@ @@ -1,70 +0,0 @@
<?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"
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/text_bright_light"
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/text_bright_light"
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/text_bright_light"
android:textIsSelectable="false"
android:textSize="@dimen/text_small" />
</RelativeLayout>

15
app/src/main/res/layout/widget_torrents_light.xml → app/src/main/res/layout/widget_torrents.xml

@ -19,7 +19,7 @@ @@ -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">
<LinearLayout
android:id="@+id/header_wrapper"
@ -56,8 +56,7 @@ @@ -56,8 +56,7 @@
android:layout_height="wrap_content"
android:ellipsize="marquee"
android:fontFamily="sans-serif-condensed"
android:maxLines="1"
android:textColor="@color/text_actionbar_dark"
android:singleLine="true"
android:textIsSelectable="false"
android:textSize="@dimen/ui_navigation_filter"
tools:text="Filter" />
@ -69,8 +68,7 @@ @@ -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 @@ @@ -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 @@ @@ -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" />
<TextView
@ -116,7 +112,6 @@ @@ -116,7 +112,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" />
@ -127,7 +122,6 @@ @@ -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" />
<TextView
@ -140,7 +134,6 @@ @@ -140,7 +134,6 @@
android:layout_marginTop="-4dip"
android:fontFamily="sans-serif-light"
android:gravity="end"
android:textColor="@color/text_bright_dark"
android:textSize="@dimen/ui_serverstatus_smallnumber" />
<TextView
@ -153,7 +146,6 @@ @@ -153,7 +146,6 @@
android:layout_marginTop="-4dip"
android:fontFamily="sans-serif-light"
android:gravity="end"
android:textColor="@color/text_bright_dark"
android:textSize="@dimen/ui_serverstatus_smallnumber" />
</RelativeLayout>
@ -209,7 +201,6 @@ @@ -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"

222
app/src/main/res/layout/widget_torrents_dark.xml

@ -1,222 +0,0 @@ @@ -1,222 +0,0 @@
<?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:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/background_dark">
<ImageButton
android:id="@+id/icon_image"
android:layout_width="@dimen/widget_header_height"
android:layout_height="@dimen/widget_header_height"
android:background="?android:attr/selectableItemBackground"
android:contentDescription="@string/widget_opentransdroid"
android:padding="@dimen/widget_header_padding"
android:scaleType="fitXY"
android:src="@drawable/ic_launcher" />
<ImageButton
android:id="@+id/refresh_button"
android:layout_width="@dimen/widget_header_height"
android:layout_height="@dimen/widget_header_height"
android:layout_alignParentRight="true"
android:background="?android:attr/selectableItemBackground"
android:contentDescription="@string/action_refresh"
android:padding="@dimen/widget_header_padding"
android:scaleType="fitXY"
android:src="@drawable/ic_action_refresh" />
<ImageButton
android:id="@+id/pauseall_button"
android:layout_width="@dimen/widget_header_height"
android:layout_height="@dimen/widget_header_height"
android:layout_toLeftOf="@id/refresh_button"
android:background="?android:attr/selectableItemBackground"
android:contentDescription="@string/action_pauseall"
android:padding="@dimen/widget_header_padding"
android:scaleType="fitXY"
android:src="@drawable/ic_action_pause" />
<ImageButton
android:id="@+id/resumeall_button"
android:layout_width="@dimen/widget_header_height"
android:layout_height="@dimen/widget_header_height"
android:layout_toLeftOf="@id/pauseall_button"
android:background="?android:attr/selectableItemBackground"
android:contentDescription="@string/action_resumeall"
android:padding="@dimen/widget_header_padding"
android:scaleType="fitXY"
android:src="@drawable/ic_action_resume" />
<LinearLayout
android:id="@+id/navigation_view"
android:layout_width="match_parent"
android:layout_height="@dimen/widget_header_height"
android:layout_toLeftOf="@id/resumeall_button"
android:layout_toRightOf="@id/icon_image"
android:background="?android:attr/selectableItemBackground"
android:clickable="true"
android:orientation="vertical"
android:paddingRight="@dimen/margin_half"
android:paddingTop="3dp">
<TextView
android:id="@+id/filter_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="marquee"
android:fontFamily="sans-serif-condensed"
android:maxLines="1"
android:textColor="@color/text_actionbar_dark"
android:textIsSelectable="false"
android:textSize="@dimen/ui_navigation_filter"
tools:text="Filter" />
<TextView
android:id="@+id/server_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="-4dip"
android:ellipsize="marquee"
android:fontFamily="sans-serif-light"
android:maxLines="1"
android:textColor="@color/text_actionbar_dark"
android:textIsSelectable="false"
android:textSize="@dimen/ui_navigation_server"
tools:text="Server" />
</LinearLayout>
<RelativeLayout
android:id="@+id/serverstatus_view"
android:layout_width="match_parent"
android:layout_height="@dimen/widget_header_height"
android:layout_toLeftOf="@id/resumeall_button"
android:layout_toRightOf="@id/icon_image"
android:background="?android:attr/selectableItemBackground"
android:clickable="true"
android:paddingTop="@dimen/ui_serverstatus_margin"
android:visibility="gone">
<TextView
android:id="@+id/upcount_sign"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
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" />
<TextView
android:id="@+id/upcount_text"
android:layout_width="@dimen/ui_serverstatus_width"
android:layout_height="wrap_content"
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" />
<TextView
android:id="@+id/downcount_sign"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toLeftOf="@id/upcount_text"
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" />
<TextView
android:id="@+id/downcount_text"
android:layout_width="@dimen/ui_serverstatus_width"
android:layout_height="wrap_content"
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" />
<TextView
android:id="@+id/upspeed_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@id/upcount_text"
android:layout_alignParentRight="true"
android:layout_below="@id/upcount_text"
android:layout_marginTop="-4dip"
android:fontFamily="sans-serif-light"
android:gravity="end"
android:textColor="@color/text_bright_dark"
android:textSize="@dimen/ui_serverstatus_smallnumber" />
<TextView
android:id="@+id/downspeed_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@id/downcount_text"
android:layout_alignRight="@id/downcount_sign"
android:layout_below="@id/downcount_text"
android:layout_marginTop="-4dip"
android:fontFamily="sans-serif-light"
android:gravity="end"
android:textColor="@color/text_bright_dark"
android:textSize="@dimen/ui_serverstatus_smallnumber" />
</RelativeLayout>
<TextView
android:id="@+id/topline_view"
android:layout_width="match_parent"
android:layout_height="2dp"
android:layout_below="@id/icon_image"
android:background="@color/green" />
<TextView
android:id="@+id/bottomline_view"
android:layout_width="match_parent"
android:layout_height="2dp"
android:layout_alignParentBottom="true"
android:background="@color/green" />
<ListView
android:id="@+id/torrents_list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@id/bottomline_view"
android:layout_below="@id/topline_view"
android:visibility="gone" />
<TextView
android:id="@+id/error_text"
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"
android:padding="@dimen/margin_default"
android:textIsSelectable="false"
android:visibility="gone" />
</RelativeLayout>

4
app/src/main/res/xml/listwidget_info.xml

@ -17,8 +17,8 @@ @@ -17,8 +17,8 @@
-->
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
android:configure="org.transdroid.core.widget.ListWidgetConfigActivity_"
android:initialKeyguardLayout="@layout/widget_torrents_light"
android:initialLayout="@layout/widget_torrents_light"
android:initialKeyguardLayout="@layout/widget_torrents"
android:initialLayout="@layout/widget_torrents"
android:minHeight="110dip"
android:minResizeHeight="40dip"
android:minResizeWidth="110dp"

Loading…
Cancel
Save